Does anyone share with me GAMS Linear AC Optimal Power Flow code ?
Hi; I think this book might come in handy:
Power system Optimization Modeling in GAMS by Alireza Soroudi.
Some of the chapters are available to download, anyway you can find the book in Amazon for $127.20 (Kindle version).
Don't know if the following code will be useful but you igth find exaactly what you are looking for in the book.
Best regards.
GAMS CODE
$ONTEXT
DC-OPF GAMS code for three-bus network.
$OFFTEXT
Sets
bus /1*3/
slack(bus) /3/
Gen /g1*g3/;
Scalars
Sbase /100/;
Alias (bus,node);
Table GenData(Gen ,*) Generating units characteristics
b pmin pmax
g1 10 0 65
g2 11 0 100;
Set
GBconect(bus, Gen) connectivity index of each generating unit to each bus
/ 1 . g1
3 . g2/;
Table BusData(bus ,*) Demands of each bus in MW
Pd
2 100;
Set conex Bus connectivity matrix
/
1 . 2
2 . 3
1 . 3/;
conex(bus,node)$(conex(node,bus))=1;
Table branch (bus, node,*) Network technical characteristics
x Limit
1 . 2 0.2 100
2 . 3 0.25 100
1 . 3 0.4 100;
branch(bus, node, 'x')$(branch(bus, node, 'x')=0)=branch(node, bus, 'x');
branch(bus, node, 'Limit')$(branch(bus, node, 'Limit')=0)=branch(node, bus, 'Limit');
branch(bus, node, 'bij')$conex(bus, node)=1/branch(bus, node, 'x');
Variables
OF
Pij(bus, node)
Pg(Gen)
delta(bus);
Equations const1 , const2 , const3;
const1(bus, node)$conex(bus, node).. Pij(bus, node) =E=
branch(bus, node, 'bij')*(delta(bus)-
delta(node));
const2(bus).. +sum(Gen$GBconect(bus, Gen), Pg(Gen))-BusData(bus ,'pd')/Sbase =E=
+sum(node$conex(node, bus), Pij(bus, node));
const3.. OF =G= sum(Gen, Pg(Gen)*GenData(Gen, 'b')*Sbase);
Model loadflow /const1, const2, const3/;
Pg.lo(Gen)=GenData(Gen, 'Pmin')/Sbase;
Pg.up(Gen)=GenData(Gen, 'Pmax')/Sbase;
delta.up(bus)=pi;
delta.lo(bus)=-pi;
delta.fx(slack)=0;
Pij.up(bus, node)$((conex(bus, node)))=1*branch(bus, node, 'Limit')/Sbase;
Pij.lo(bus, node)$((conex(bus, node)))=-1*branch(bus, node, 'Limit')/Sbase;
Solve loadflow minimizing OF using lp;
Parameter report(bus,*), Congestioncost;
report(bus, 'Gen(MW)')= sum(Gen$GBconect(bus, Gen), Pg.l(Gen))*sbase;
report(bus, 'Angle')= delta.l(bus);
report(bus, 'load (MW)')= BusData(bus, 'pd');
report(bus, 'LMP($/MWh)')=const2.m(bus)/sbase;
Congestioncost= sum((bus, node), Pij.l(bus, node)*(-const2.m(bus)+
const2.m(node)))/2;
Display report, Pij.l, Congestioncost;
I have dataset which shows the length of power lines. I need to classify the lines based on the line length. Is there a rule to classify the High voltage (HV) and low voltage (LV) lines based on...
03 March 2021 4,116 4 View
Hi, Could you help me to get the latest (2019, 2020) solar resource data for a particular site in JAPAN? PV GIS and NSRDB data are not in reach to JAPAN, I'm looking for some other database for...
03 March 2021 961 3 View
Hello all, In SPSS I am going to code 2 open-ended questions. I have already read all the answers and I made a list of the most important categories to which I can code the answers. This question...
02 March 2021 1,757 4 View
Is there a powerful system for the security of the systems distributed on IoT systems?
02 March 2021 3,858 10 View
I feel that the practice in teacher education in my country is below the expected performance level due to very poor management system. Hope I will learn something from your experiences.
02 March 2021 1,516 4 View
The following code (see 1st 2 images attached) is used to produce PID controller values that are designed to control the system (G). The code finds the PID controller values (noted as k) by using...
28 February 2021 6,560 14 View
I am working on modeling and simulation of biomecanical material behaviour, I have succeded on simulating skin using anisotropic hyperelastic material, on APDL and in our lab's finite element...
28 February 2021 552 3 View
I am interested in evaluating mesh optimization solvers that converge to high aspect ratio unstructured hexahedral grids. In other words, I am interested in a solver that optimizes warpage,...
26 February 2021 7,279 2 View
I am required to learn about Flyback converters and I got stuck not knowing to full design of the power supply flyback converter Based USB Charger Model using Simulink, especially the design model...
25 February 2021 5,435 2 View
Hello, As part of simulation of gases mixture and water, I need to calculate viscosity of the fluid components and I am using relationships proposed by Chung et al. (1988). The irony is while I...
25 February 2021 8,053 5 View