0% found this document useful (0 votes)
23 views2 pages

REG19

The document contains code that runs an optimal power flow (OPF) simulation in MATLAB for a power grid case file with various levels of load decrements. It decrements the active and reactive power loads by 5%, 10%, 15%, 20%, and 25% and runs the OPF simulation each time to determine the per unit cost of electricity. It then plots the per unit cost versus the load variation to analyze how costs change with different amounts of load reduction.

Uploaded by

abstudio0049
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

REG19

The document contains code that runs an optimal power flow (OPF) simulation in MATLAB for a power grid case file with various levels of load decrements. It decrements the active and reactive power loads by 5%, 10%, 15%, 20%, and 25% and runs the OPF simulation each time to determine the per unit cost of electricity. It then plots the per unit cost versus the load variation to analyze how costs change with different amounts of load reduction.

Uploaded by

abstudio0049
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MATLAB Command Window Page 1

>> %reg no 19
a=loadcase ('case5')
b=runopf (a)
% 5 decrement
Active_power=a.bus (:,3)
load_decrement_1=a.bus (:,3)-a.bus (:,3)*0.05
a.bus (:,3)=load_decrement_1
Reactive_power=a.bus (:,4)
load_decrement1=a.bus (:,4)-a.bus (:,4)*0.05
a.bus (:,4)=load_decrementl
b=runopf (a)
per_unit_cost_MWh_1=sum(b.bus (:,14))
per_unit_cost_MVarh_l=sum(b.bus (:,15))
Exchange_rate=234
per_unit_cost_MWh_1_PKR=per_unit_cost_MWh_1*Exchange_rate
per_unit_cost_MVarh_1_PKR=per_unit_cost_MVarh_1*Exchange_rate
% 10 decrement
a=loadcase ('case5') b=runopf (a)
Active_power=a.bus (:,3)
load_decrement_2=a.bus (:,3)-a.bus (:,3)*0.10
a.bus (:,3)=load_decrement_2
Reactive_power=a.bus (:,4)
load_decrement2=a.bus (:,4)-a.bus (:,4)*0.10
a.bus (:,4)=load_decrement2
b=runopf (a)
per_unit_cost_MWh_2=sum(b.bus (:,14)) per_unit_cost_MVarh_2=sum (b.bus (:,15))
Exchange_rate=234
per_unit_cost_MWh_2_PKR=per_unit_cost_MWh_2*Exchange_rate
per_unit_cost_MVarh_2_PKR=per_unit_cost_MVarh_2*Exchange_rate
% 15 decrement
a=loadcase ('case5')
b=runopf (a)
Active_power=a.bus (:,3)
load_decrement_3=a.bus (:,3)-a.bus (:,3)*0.15
a.bus (:,3)=load_decrement_3
Reactive power=a.bus (:,4)
load_decrement3 a.bus (:,4)-a.bus (:,4)*0.15 a.bus (:,4)=load_decrement3
b=runopf (a)
per_unit_cost_MWh_3=sum(b.bus (:,14))
per_unit_cost_MVarh_3=sum(b.bus (:,15))
Exchange_rate=234
per_unit_cost_MWh_3_PKR=per_unit_cost_MWh_3*Exchange_rate
per_unit_cost_MVarh_3_PKR=per_unit_cost_MVarh_3*Exchange_rate
% 20 decrement
a=loadcase ('case5')
b=runopf (a)
Active_power=a.bus (:,3)
9/25/23 12:39 AM C:\Users\Admin\Desktop\Untitled.m 2 of 2
load decrement 4-a.bus (:,3)-a.bus (:,3)*0.20 a.bus (:,3)=load_decrement_4
Reactive_power-a.bus (:,4)
load_decrement 4-a.bus (:,4)-a.bus (:,4)*0.20
MATLAB Command Window Page 2

a.bus (:,4)=load_decrement4
b=runopf (a)
per_unit_cost_MWh_4=sum (b.bus (:,14))
per_unit_cost_MVarh_4=sum(b.bus (:,15))
Exchange_rate=234
per_u
_unit_cost_MWh_4_PKR=per_unit_cost_MWh_4*Exchange_rate
per_unit_cost_MVarh_4_PKR=per_unit_cost_MVarh_4*Exchange_rate
% 25 decrement
a=loadcase ('case5')
b=runopf (a)
Active_power=a.bus (:,3)
load decrement 5-a.bus (:,3)-a.bus (:,3)*0.25
a.bus (:,3)=load_decrement_5
Reactive_power=a.bus (:,4)
load decrement5-a.bus (:,4)-a.bus (:,4)*0.25
a.bus (:,4)=load_decrement5
b=runopf (a)
per_unit_cost_MWh_5=sum(b.bus (:,14))
per_unit_cost_MVarh_5-sum (b.bus (:,15))
Exchange_rate=234
per_unit_cost_MWh_5_PKR-per_unit_cost_MWh 5*Exchange_rate
per_unit_cost_MVarh_5_PKR=per_unit_cost_MVarh_5*Exchange_rate
load variation-zeros (5,1);
load_variation=[sum (load_decrement_1) sum (load_decrement_2) sum (load_decrement_3) sum
(load_decrement 4) sum (load_decrement_5)] puc-zeros (5,1);
puc [per_unit_cost_MWh 1 per_unit_cost_MWh 2 per_unit_cost_MWh 3 per_unit_cost_MWh 4
per_unit_cost _MWh_5]
plot (load_variation, puc);
title('Per unit cost in Dollars Vs Load Variation'); xlabel('load_variation');ylabel
('puc')

You might also like