Top Banner
GAMS Model Development – Using CHP as an example Using CHP as an example Michael Bussieck [email protected] Jan-Hendrik Jagla [email protected] Lutz Westermann [email protected] GAMS Software GmbH www.gams.de GAMS Development Corporation www.gams.com
35

GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Apr 16, 2018

Download

Documents

nguyentu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

GAMSModel Development –

Using CHP as an exampleUsing CHP as an example

Michael Bussieck [email protected]

Jan-Hendrik Jagla [email protected]

Lutz Westermann [email protected]

GAMS Software GmbH

www.gams.de

GAMS Development Corporation

www.gams.com

Page 2: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Agenda

GAMS – Basic SyntaxGAMS – Basic Syntax

Excursus: GDX

Building a Model: CHP Generation Plant

2

Page 3: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Agenda

GAMS – Basic Syntax

3

GAMS – Basic Syntax

Excursus: GDX

Building a Model: CHP Generation Plant

Page 4: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Sets

• Parameters

GAMS Syntax: Declaration

• Parameters

• Scalars4

Page 5: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

GAMS Syntax: Data Assignment using Sets

• General

• Sum

5

• Product

• Minimum/Maximum

Page 6: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

GAMS Syntax: Defined Elements of a Set

• Ord() and Card()

6

• Sameas(,)

Page 7: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Free (-∞ to ∞)

• Positive (0 to ∞)

GAMS Syntax: Variables

• Negative (-∞ to 0)

• Integer (0, 1, 2, …)

• Binary (0 or 1)

7

Page 8: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Semi continuous (0 or above certain value)

• Semi integer (0 or integer above certain value)

GAMS Syntax: Variables

• Special Ordered Sets Type 1 (Only one member in a set of variables can have nonzero value)

• Special Ordered Sets Type 2 (Only two adjacent members in a set of variables can have nonzero value)

8

Page 9: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

GAMS Syntax: Equations

• Definition

9

• Declaration

Page 10: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

GAMS Syntax: Model Definition

• Model

• Solver selection

10

• GAMS options

• Solver options

• Solve

Page 11: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

GAMS Syntax: Procedural Elements

• For

• While

11

• While

• Loop• If… else…

Page 12: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Mathematical Functions

12 *not exhaustive

Page 13: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Compile time arguments…– start with $– are executed when compiling a GAMS file– are e.g. $if, $set, $goto, $exit, $call …

Compile Time vs. Execution Time

• Execution time arguments…– are executed during the execution of the compiled

GAMS file– are e.g. if, execute, solve, loop, …

NOTE: When reading a model from top to bottom, we can see an execution time command before a compile time command, but the latter will be executed first.

13

Page 14: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Agenda

GAMS – Basic Syntax

14

GAMS – Basic Syntax

Excursus: GDX

Building a Model: CHP Generation Plant

Page 15: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

IDE GDX Viewer

GDX

IDE GDX Viewer

GDX

Gams Data eXchange

Application GDX

GAMS

SOLVER

Binary Data Exchange

GDX Tools

GDX

GDXxrw(MS Office)

GAMS

GDXDiff

GDXDump

GDXMerge

GDXRank

GDXAPI

GDX

GDXxrw(MS Office)

GAMS

GDXDiff

GDXDump

GDXMerge

GDXRank

GDXAPI

• Fast exchange of data

• Syntactical check on data before model starts

• Data Exchange at any stage (Compile and Run-time)

• Platform Independent

• Direct Excel connectivity

• General API

• Scenario Management Support

15

Page 16: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Using GDXXRW to read from Excel

16

Parameter d(i,j) distance in thousands of miles;

$call GDXXRW dist.xls par=d rng=dist!A1 rdim=1 cdim=1

$if errorlevel 1 $abort "Problem with file dist.xls!"

$gdxin dist

$load d

Page 17: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Using GDXXRW to write to Excel

execute_unload 'ship' x;

execute 'GDXXRW ship.gdx var=x rng=ship!A1 rdim=1 cdim=1';

17

Page 18: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Agenda

GAMS – Basic Syntax

18

GAMS – Basic Syntax

Excursus: GDX

Building a Model: CHP Generation Plant

Page 19: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Produces heat and electricity in combination

• Certain demand of heat and

Combined Heat and Power (CHP) Plant

• Certain demand of heat andelectricity has to be satisfied

• Electricity can be traded at energy exchange

• Excess heat cannot be released, the demanded amount has to be generated exactly

• Cogeneration is subsidized by government

19

Page 20: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Process Model

20

Page 21: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• External Inputs/Output• Intermediate Commodities

Process Model

21

Page 22: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Processes with minimum utilization level

22

Page 23: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Demand Electricity/Heat

23

Page 24: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Demand Electricity/Heat

24

Page 25: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Find cost minimal solution– Satisfy demand– Buy or make electricity– Subsidize cogeneration

Modeling Task

– Subsidize cogeneration– Technical feasible schedule of plants– Investment decisions (new/upgraded power plants)– Economical aspects (e.g. shared ownership of plants)– …

25

Page 26: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Minimize [Fuel costs]+ [Costs/returns from electricity trading]− [Bonus for cogeneration]

s.t. [Matter input] = [Matter output]

Model Formulation Scheme

s.t. [Matter input] = [Matter output]

[Generated electricity] + [Purchased electricity]= [Demand for electricity]

[Generated heat] = [Demand for heat]

26

Page 27: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• At maximum utilization:– Output: Steam 11 kg/s– Input: Coal 35.24 MWh

Electricity 0.5 MWh

Exercise 1: Add Steam Generator (SG)

• At minimum utilization:– Output: Steam 5.5 kg/s– Input: Coal 17.62 MWh

Electricity 0.25 MWh

• Coal costs: 12.23 $/MWh

• Reduces Output of HTB: 25 MWh � 18 MWh27

Page 28: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Consumes up to 53.2 MWh wasteheat

• Cools it down at costs of 4 $ per MWh

Exercise 2: Add Heat Bypass (HB)

• No relevant output

28

Page 29: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Maximum capacity of 50 MW heat

• At most 15 MW per hour input

Exercise 3: Add Heat Storage Tank (HST)

• At most 12 MW per hour output

• “Pump” heat into tank costs 0.05 $ per MW

• 2% of stored heat gets lost per h

29

Page 30: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Before:

After:

Heat Storage Tank

)()( hGENhdem HeatHeat =

After:

30

12)(

15)(

50)(

)()(98.0)1()(

)()()()(

+−⋅−=

−+=

hHOUT

hHIN

hHLVL

hHINhHOUThHLVLhHLVL

hHINhHOUThGENhdem HeatHeat

Page 31: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• Startup costs:– GT: 500 $– SG: 1000$

• GT may be turned on not more than 8 times during modeled time frame

Exercise 4: Limiting Number of GT Starts

modeled time frame

31

1),(0),1(1),( =⇒=−∧= phSTARTUPphONOFFphONOFF

),1(),(),( phONOFFphONOFFphSTARTUP −−≥→

8)'',( ≤∑h

GThSTARTUP

Page 32: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

• GT has to stay off for at least 8 hours when shut down

Exercise 5: Add “cool down” time for GT

)'',()'',1()'',(

1),(1),1(0),(

GThONOFFGThONOFFGThSHUTDOWN

phSHUTDOWNphONOFFphONOFF

−−≥→

=⇒=−∧=

32

)'',(1)'',(8|

2

222

GThSHUTDOWNGThSTARTUPhhhhh

−≤→ ∑+<∧≥

8|0)'',(

1)'',(

22+<≤=⇒

=

hhhGThSTARTUP

GThSHUTDOWN

Page 33: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Demo: Calling GAMS from MS Excel

33

Page 34: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

GAMS on the Web

Download www.gams.de www.gams.com

Help and SupportSupport Wiki http://support.gams-software.com

34

Support Wiki http://support.gams-software.comInterfaces Wiki http://interfaces.gams-software.comMcCarl‘s News http://www.gams.com/maillist/newsletter.htmUser Group http://www.gams.com/maillist/gams_l.htmGoogle Group http://groups.google.de/group/gamsworld

Search all GAMSWebsites http://www.gams.com/search.htm

Page 35: GAMSold.gams.com/presentations/present_gor08_ws_chp.pdf · GAMS Model Development ... Combined Heat and Power (CHP) Plant electricity has to be satisfied • Electricity can be traded

Contacting GAMS

Europe

GAMS Software GmbH

Eupener Str. 135-137

50933 Cologne

USA

GAMS Development Corp. 1217 Potomac Street, NW

50933 CologneGermany

Phone: +49 221 949 9170Fax: +49 221 949 9171http://www.gams.de

[email protected]@gams-software.com

1217 Potomac Street, NW

Washington, DC 20007USA

Phone: +1 202 342 0180 Fax: +1 202 342 0181http://www.gams.com

[email protected]@gams.com

35