lanxicy.com

第一范文网 文档专家

第一范文网 文档专家

Outlook of this talk

What are we going to talk about? About GAMS What is GAMS? Using GAMS for POG&C Downloading GAMS Some Features of GAMS Parts of a GAMS Model (Program) Some proble

ms of POG&C that can be solved with GAMS Economic Dispatch Unit Commitment

Luigi Vanfretti, RPI – p.2/30

What is GAMS?

GAMS (Generalized Algebra Modelling System) is a computer enviorment that can easily be used to model and solve optimization problems. GAMS is specially design for linear, nonlinear and mixed integer optimization. An interesting fact is that GAMS was developed "out of the

frustaging experiences of an economic modeling group at the World Bank... The programmers in the group wrote FORTRAN programs to prepare each model fro solution; the work was dull but demanding, and errors were easy to make and hard to ?nd" [4].

.

Even though it is required some effor to become familiar with GAMS, we will se that this is a very small cost to pay to have a comprehensive and very powerfull tool to solve power systems optimization problems.

Luigi Vanfretti, RPI – p.3/30

Using GAMS for POG&C

In EPOW-6840 Power Generation Operation and Control, all the topics covered involve the solution of an optimization problem. There are many available tools that can solve power system optimization problems, but most of them are not suitable for learning the basic concepts since the modelling details are transparent to the user. Thus, GAMS presents an adequate tool to solve the optimization problems that we deal in PGO&C. The power systems problems that we analyze here are: Economic Dispatch (lossless and with losses) and the Unit Commitment (with different constraints), both presented in [1], . For those interested, there are many other examples presented in [1], [4], [2], [3] and [8].

Luigi Vanfretti, RPI – p.4/30

Downloading GAMS

A free demo of the current distribution, as well as past distributions, is available at http://www.gams.com/ Without a license, the GAMS distribution has the following limitations: Model limits:

Up to 200 constraints Up to 300 variables Up to 2000 nonzero elements (1000 nonlinear). Up to 30 discrete variables.

Solver (Global) limits:

Up to 10 constranints. Up to 10 variables.

Note that this limitations are not a problem for educational purposes since we are not solving large scale networks.

Luigi Vanfretti, RPI – p.5/30

GAMS Features

The most important features of GAMS are: Capability to solve from small scale to large scale problems with small code by means of the use of index to write blocks of similar constraints from only one constraint. The model is independent from the solution method, and it can be solved by different solutions methos by only changing the solver. The translation from the mathematical model to GAMS is almost transparent since GAMS has been built to resemble mathematical programming models. GAMS also uses common english words, thus is easy to understand it’s statements.

Luigi Vanfretti, RPI – p.6/30

Parts of a GAMS Model

The parts of a GAMS Model or Program are de?ned in the table below:

COMMAND

SET SCALAR PARAMETER TABLE VARIABLE EQUATION MODEL SOLVE DISPLAY

PURPOSE Used to indicate the name of the indices Used to declare scalars Used to declare vectors Declare and assign the values of an array Declare variables, assign type and bounds Function to be optimized and it’s constraints Give a name to the model, and list the related constraints Indicate what solver to use Indicate what you would like to display as output

Table 1: Main Commands of GAMS

We will now de?ne each of this parts with the use of a economic dispatch example presented in [1].

Luigi Vanfretti, RPI – p.7/30

Power System Example 1 - Economic Dispatch

Luigi Vanfretti, RPI – p.8/30

Sets

Sets are use to declare indices and its possible values. An index or more should be declared along with its possible values. Here we present the sets of the Economic Dispatch Problem. Example:

SETS G index of generators /G1*G2/ N index of buses /N1*N3/ MAP(G,N) indicates in what bus are the generators connected /G1.N1,G2.N2/;

The two indices are G and N. The text that follows is a string (used to make comments and are ignored by the compiler). The index values are speci?ed by two ’slash’(/) symbols. GAMS uses an to de?ne sets in a compact way, the sets could also be de?ned as /N1, N2, N3/. The sets here are dynamic, they have been mapped through MAPG(G, N), where the links between the sets have been de?ned.

Luigi Vanfretti, RPI – p.9/30

Scalars

Scalars indicate a constant value as, for example, the fuel cost of a generating unit in $ / MBtu. Example

Scalar fcost fuel cost in dollars_MBtu /1.1/

The scalar fcost is declared with a common value of 1.1. Slash symbols are used to declare the value of the scalar. Since the fuel cost of the generating units can be included in the cost function of each generating unit, we will not use this scalar in our example, neverless, note that one scalar could be de?ned for each generating unit fuel cost.

Luigi Vanfretti, RPI – p.10/30

Parameters

Parameters are structures used to de?ne data arrays of one or more dimensions, they are vectors of data. Example

PARAMETER LOAD(N) load at bus N / N3 0.85 /

We have declared the parameter LOAD, which is de?ned by the set N. The parameter assigment is de?ned only for Bus 3 by / N3 0.85 / (since is the only bus which has a load). GAMS will automatically check that the index values are valid set values for each index, displaying errors when invalid set values are entered. For example, / N4 0.9 /, will yield in an error since there is no Bus 4 declared in the Set N.

Luigi Vanfretti, RPI – p.11/30

Tables - I

Matrices of data can be de?ned with tables or two-dimensional parameters (that depend on more than one set). Tables are structures used to de?ne data matrices of data of more than one dimension. Example:

TABLE GDATA(G,*) PMIN PMAX * (kW) G1 0.15 G2 0.10 generator input data COST (kW) (dollar/kWh) 0.6 6 0.4 7;

The table GDATA(G,*) is de?ned by the index G. For every pair of set elements, as G1 and PMIN, a table value value is speci?ed, in this case 0.15.

Luigi Vanfretti, RPI – p.12/30

Tables - II

There can also be Tables that use more than one set, these emerge from the use of dynamic sets. Example:

TABLE LDATA(N,N,*) line input data SUS LIMIT * (S) (kW) N1.N2 2.5 0.3 N1.N3 3.5 0.5 N2.N3 3.0 0.4; TABLE LDATA(N,N,*) de?nes a 3D array that relates two sets (in this case only the set N is used, but any other different set could be used) with two different parameters.

For example: we are assigning a susceptance, SUS 2.5, and a limit, LIMIT 0.3, to the line between Bus 1 and Bus 2, N1.N2.

Luigi Vanfretti, RPI – p.13/30

Variables - I

Variables are declared in GAMS in the following way: Example:

VARIABLES z objective function p(G) output power for generator G d(N) angle at bus N; p.lo(G)=GDATA(G,’PMIN’); p.up(G)=GDATA(G,’PMAX’); d.fx(’N3’)=0;

The variable z represents the objective function and must be included always. The index of the variables also has to be included. Optionally, upper and lower bounds can be declared using suf?xes. We have de?ned upper and lower bounds to the variable, p(G), through GAMS suf?xes. The lower bound usses the suf?x lo, p.lo(G) de?nes the minimun power output at node G.

Luigi Vanfretti, RPI – p.14/30

Variables - II

Variables can also be set to a constant value. For example, we have set variable d to a ?xed value of zero with: d.fx(’N3’)=0;. This actually sets the angle at the reference bus at 0? . There are different types of variables: binary, free, integer, negative and positive.; For example, we could have de?ned variable p(G) as a positive variable and then set it’s bounds: Example:

POSITIVE VARIABLE p(G); p.lo(G)=GDATA(G,’PMIN’); p.up(G)=GDATA(G,’PMAX’);

Variables can also have intial values, for example, we could indicate an initial power at Bus 1 like this:

p.l(’G1’)=0.2;

Luigi Vanfretti, RPI – p.15/30

Equations - I

In the Equations command we include the objective function and the constraints of the problem. Example:

EQUATIONS COST objective function MAXPOW(N,N) maximum line power limit MINPOW(N,N) minimum line power limit LOADBAL(N) load balance equation; ALIAS(N,NP); COST.. z =e= SUM(G,GDATA(G,’COST’)*p(G)); MAXPOW(N,NP).. LDATA(N,NP,’SUS’)*(d(N)-d(NP))=l= LDATA(N,NP,’LIMIT’); MINPOW(N,NP).. LDATA(N,NP,’SUS’)*(d(N)-d(NP))=g=-LDATA(N,NP,’LIMIT’); LOADBAL(N).. SUM(G$ MAP(G,N),p(G))+SUM(NP,LDATA(N,NP,’SU?’)*(d(N)-d(NP))+ LDATA(NP,N,’SUS’)*(d(N)-d(NP)))=e=LOAD(N);

From the example above we note that each constraint must be declared ?rst, after they have been declared, they are de?ned using two dots (’..’), to link the constraint name with the equation. A semicolon has to be included after each constraint equation. A summation,

i

xij , is expressed as sum(i,x(i,j)) in GAMS.

Additionally, there are equations symbols such as: =e=, which means equal, and =l=, which means less than or equal to. Please refer to [5, 6] for details.

Luigi Vanfretti, RPI – p.16/30

Equations - II

The equivalent mathematical form of the objective and constraint equations is: Objective function (Cost equation):

COST.. z =e= SUM(G,GDATA(G,’COST’)*p(G));

n

Is equivalent to:

(1)

z=

i=1

{Pi Ci (Pi )}

In this problem we consider power transfer bounds. The lower limit is represents the minimun power that each generator should output; the upper limit represents the maximum power that the generator con output due to termic limits. This can be written as:

(2)

Pimin ≤ Pi ≤ Pimax

Luigi Vanfretti, RPI – p.17/30

Equations - III

The power transmitted in a transmission line is limited by thermal and stability considerations (angle). The power transmitted from Bus i to Bus j through the line i ? j is:

(3)

Bij (δi ? δj )

Considering equations (??) and (??) we have the equation:

(4)

max min Pi ≤ Bij (δi ? δj ) ≤ Pi

Equation (??) translates in the GAMS constraint equations:

MAXPOW(N,NP).. LDATA(N,NP,’SUS’)*(d(N)-d(NP))=l= LDATA(N,NP,’LIMIT’); MINPOW(N,NP).. LDATA(N,NP,’SUS’)*(d(N)-d(NP))=g=-LDATA(N,NP,’LIMIT’);

The Power Balance equation is given by:

(5)

Pi = Di ?

Bij (δi ? δj )

Which translates to: LOADBAL(N).. SUM(G$ MAP(G,N),p(G))+SUM(NP,LDATA(N,NP,’SUS’)*(d(N)-d(NP))+

LDATA(NP,N,’SUS’)*(d(N)-d(NP)))=e=LOAD(N);

The term

Bij (δi ? δj ) implicitly considers losses (but as a constrain, they are not optimized).

Luigi Vanfretti, RPI – p.18/30

Model

This command wil de?ne the equations that should be included in the model to be solved. For the ED example we have a cost equation, a maximum power inequality, minimun power inequality and a load balance equation. Example:

MODEL ed /COST,MAXPOW,MINPOW,LOADBAL/;

This is actually an excellent feature of GAMS, since it will only require us to elliminate one of the equations to solve a different model. For example, we could solve ED without considering maximun and minimun powers by declaring:

MODEL ed /COST,LOADBAL/;

Luigi Vanfretti, RPI – p.19/30

Solve

Solve is the command used to solve the optimization problem that we de?ned. For our problem the solve statement is:

Example:

SOLVE ed USING lp MINIMIZING z;

This command tells GAMS to solve Economic Dispatch, ed, using a linear programing solver, lp, minimizing the variable z; and thus, minimizing the cost function. There are many solvers, options and suf?x that can be used in the solution of an optimization problem; please refer to [5, 6].

Luigi Vanfretti, RPI – p.20/30

Display

Additionally to the information displayed in the standard gams output ?le, named with a .lst extension, the information can be displayed using the display command. Example:

DISPLAY p.l, d.l;

With this command GAMS will display the output power at the generators and the angle at each bus. The suf?x l, indicates GAMS to display the level of the variable. If we solve the model with this command the output will show:

---42 VARIABLE p.L G1 0.565, G2 0.285 ---42 VARIABLE d.L N1 -0.143, N2 -0.117 output power for generator G angle at bus N

Luigi Vanfretti, RPI – p.21/30

Power System Example 2 - Unit Commitment

This example is also taken from [1]. The system of the Economic Dispatch problem is used. A three hour unit commintment is presented. The demands are: t1 = 150, t2 = 500 and t3 = 400. The generators have the following reserves: Unit 1 = 15, Unit 2 = 50 and Unit 3 = 40. The data for each of the genetors follows:

Table 2: Data for the Unit Commintment Problem

Generator # Pmax Pmin Rampup limit Rampdown limit Fixed Cost Startup Cost Shutdown Cost Variable Cost 1 350 50 200 300 5 20 0.5 0.100 2 200 80 100 150 7 18 0.3 0.125 3 140 40 100 100 6 5 1.0 0.150

Luigi Vanfretti, RPI – p.22/30

Power System Example 2 - Unit Commitment

SETS:

SETS K index of periods of time /1*4/ J index of generators /1*3/

TABLES:

TABLE GDATA(J,*) generator input data PMIN PMAX T S A B * Ramp Ramp Fixed Variable * Down Up Cost Cost * Limit Limit * (kW) (kW) (kW/h) (kW/h) (E) (E) 1 50 350 300 200 5 20 2 80 200 150 100 7 18 3 40 140 100 100 6 5 TABLE PDATA(K,*) data per period D R * Load Reserve * (kW) (kW) 2 150 15 3 500 50 4 400 40;

Luigi Vanfretti, RPI – p.23/30

C E Start Shutdown UP Cost Cost (E) (E/kWh) 0.5 0.100 0.3 0.125 1.0 0.150;

Power System Example 2 - Unit Commitment

VARIABLES:

VARIABLES z objective function variable p(J,K) output power of generator j at period k v(J,K) is equal to 1 if generator j is committed in period k y(J,K) is equal to 1 if generator j is started-up at the beginning of period k s(J,K) is equal to 1 if generator j is shut-down in period k;

VARIABLE INITIALIZATION AND TYPE:

POSITIVE VARIABLES p(J,K); ** Status decisions are modeled using binary variables.

BINARY VARIABLES v(J,K),y(J,K),s(J,K); ** Initial values are stated for some variables. v.fx(J,’1’)=0; p.fx(J,’1’)=0;

Luigi Vanfretti, RPI – p.24/30

Power System Example 2 - Unit Commitment

EQUATIONS:

EQUATIONS COST PMAXLIM(J,K) PMINLIM(J,K) LOAD(K) RESERVE(K) LOGIC(J,K) RAMPUP(J,K) RAMPDOWN(J,K) ** ** objective function maximum output power equation minimum output power equation load balance equation spinning reserve equation start-up shut-down and running logic maximum up ramp rate limit maximum down ramp rate limit;

The objective function is an equality equation. The remaining constraints are defined for all periods K, except for the initial one. To model this exception the $(ord(K) GT 1) condition is included.

COST.. z =e= SUM((K,J), GDATA(J,’A’)*v(J,K)+GDATA(J,’B’)*y(J,K)+ GDATA(J,’C’)*s(J,K)+GDATA(J,’D’)*p(J,K)); PMAXLIM(J,K)$(ord(K) GT 1).. p(J,K)=l=GDATA(J,’PMAX’)*v(J,K); PMINLIM(J,K)$(ord(K) GT 1).. p(J,K)=g=GDATA(J,’PMIN’)*v(J,K); LOAD(K)$(ord(K) GT 1).. SUM(J,p(J,K))=e=PDATA(K,’D’); RESERVE(K)$(ord(K) GT 1).. SUM(J,GDATA(J,’PMAX’)*v(J,K))=g=PDATA(K,’D’) +PDATA(K,’R’); LOGIC(J,K)$(ord(K) GT 1).. y(J,K)-s(J,K)=e=v(J,K)-v(J,K-1); RAMPUP(J,K)$(ord(K) GT 1).. p(J,K)-p(J,K-1)=l=GDATA(J,’S’); RAMPDOWN(J,K)$(ord(K) GT 1)..p(J,K-1)-p(J,K)=l=GDATA(J,’T’);

Luigi Vanfretti, RPI – p.25/30

Power System Example 2 - Unit Commitment

MODEL: The model declaration /ALL/ will allow us to solve the UC problem with all the constraints:

MODEL uc /ALL/;

MODEL: If we are only interested in solving the UC problem without the reserve contrarint, ramup and rampdown limits, we can declare the model as:

MODEL uc /COST,PMAXLIM,PMINLIM,LOAD,LOGIC/;

SOLVER: GAMS will use a mixed-integer solver to ?nd the solution of the problem above, with the following command.

SOLVE uc USING mip MINIMIZING z;

Luigi Vanfretti, RPI – p.26/30

Power System Example 2 - Unit Commitment

GAMS OUTPUT: The following is an abstract of the output from GAMS when all the constraints are considered:

---88 VARIABLE p.L 2 1 2 3 150.000 3 350.000 100.000 50.000 output power of generator j at period k 4 260.000 140.000

----

88 VARIABLE z.L

=

77.300

objective function va riable

GAMS OUTPUT: Solution without the reserve contraint, ramup and rampdown limits:

---87 VARIABLE p.L 2 1 2 150.000 3 350.000 150.000 output power of generator j at period k 4 320.000 80.000

----

87 VARIABLE z.L

=

67.000

objective function va riable

Luigi Vanfretti, RPI – p.27/30

相关文章:

- 电力系统各种研究领域和主题
- 18.
*Power**Generation**Operation**and**Control*发电 运行和控制 19.*Power*system ...Digital protection*for**power*system 电力系统数字保护 81.*Power*system ...

- 新能源科学与工程专业人才培养方案
*Operation**and**Control*of Photovoltaic*Power*Station 00301730 风力发电原理 Principle of Wind*Power**Generation*00301762 01501240 风电机组设计与制造 Design*and*...

- 重庆大学 - 重庆大学电气工程学院
*for*careers in the fields of Electrical ...*Power**Operation**and*Automatic*Control*, High Voltage...In addition, a wind*power**generation*system with...

- 电力系统英文原版书籍推荐
- 18.
*Power**Generation**Operation**and**Control*发电 运行和控制 19.*Power*system ...Digital protection*for**power*system 电力系统数字保护 81.*Power*system ...

更多相关标签:

- Power System Operation and Control(发电与运行)
- Fuzzy system control for combined wind and solar power distributed generation unit
- PhotoVoltaic distributed generation for lanai power grid real-time simulation and control integratio
- An accurate power control strategy for Power-Electronics-Interfaced Distributed Generation
- A Framework for Operation and Control of
- An accurate power control strategy for power-electronics-interfaced distributed generation units
- Control and operation of distributed generation indistribution systems[1].
- Wireless-Control Strategy for Parallel Operation of Distributed-Generation Inverters
- q6 Operation and Control Strategies for
- A----Control of power converters for distributed generation applications--192页论文
- Assessing Impacts of State Highway Stormwater Runoff on Stream Invertebrate Communities
- Power System Operation and Control(发电与运行)
- Electricity around the world
- BP2035展望-2014
- 钻井英语1