-
Notifications
You must be signed in to change notification settings - Fork 38
/
eqdeclr.mod
195 lines (166 loc) · 10.2 KB
/
eqdeclr.mod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright (C) 2000-2024 Energy Technology Systems Analysis Programme (ETSAP)
* This file is part of the IEA-ETSAP TIMES model generator, licensed
* under the GNU General Public License v3.0 (see file NOTICE-GPLv3.txt).
*=============================================================================*
* EQDECLR.MOD declarations for actual equations
* %1 - mod or v# for the source code to be used
*=============================================================================*
*GaG Questions/Comments:
* - declare all equations so that restarting changed models will work
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
EQUATIONS
*-----------------------------------------------------------------------------
* Objective Function & Components
$IFI %MACRO%==YES $GOTO MACROBJ
*-----------------------------------------------------------------------------
* Overall OBJ linear combination of the regional objs (which are built from rest)
EQ_OBJ 'Overall Objective Function'
* OBJ cost components
%EQ%_OBJELS(R,BD,CUR %SWD%) 'Costs of elastic demands'
%EQ%_OBJFIX(R,CUR %SWD%) 'Fixed Costs'
%EQ%_OBJINV(R,CUR %SWD%) 'Investment component'
%EQ%_OBJSALV(R,CUR %SWD%) 'Salvage'
%EQ%_OBJVAR(R,CUR %SWD%) 'Variable operating costs'
%EQ%_OBJDAM(R,CUR %SWD%) 'Damage costs'
*-----------------------------------------------------------------------------
$IFI %MACRO%==YES
$LABEL MACROBJ BATINCLUDE eqdeclr.tm
*-----------------------------------------------------------------------------
* Core Equations
*-----------------------------------------------------------------------------
* Relationship between process activity & individual primary commodity flows
%EQ%_ACTFLO(R,ALLYEAR,ALLYEAR,P,S %SWTD%) 'Process Activity/Primary Commodity Flows'
* Bound on activity
%EQ%G_ACTBND(R,ALLYEAR,P,S %SWTD%) 'Process activity Bound in a Period (=G=)' //
%EQ%E_ACTBND(R,ALLYEAR,P,S %SWTD%) 'Process activity Bound in a Period (=E=)' //
%EQ%L_ACTBND(R,ALLYEAR,P,S %SWTD%) 'Process activity Bound in a Period (=L=)' //
* Bound on commodities
%EQ%G_BNDNET(R,ALLYEAR,C,S %SWTD%) 'Net bound on a commodity (=G=)'
%EQ%E_BNDNET(R,ALLYEAR,C,S %SWTD%) 'Net bound on a commodity (=E=)'
%EQ%L_BNDNET(R,ALLYEAR,C,S %SWTD%) 'Net bound on a commodity (=L=)'
%EQ%G_BNDPRD(R,ALLYEAR,C,S %SWTD%) 'Production bound on a commodity (=G=)'
%EQ%E_BNDPRD(R,ALLYEAR,C,S %SWTD%) 'Production bound on a commodity (=E=)'
%EQ%L_BNDPRD(R,ALLYEAR,C,S %SWTD%) 'Production bound on a commodity (=L=)'
* Utilization of capacity, or the relationship between process capacity and activity
%EQ%L_CAPACT(R,ALLYEAR,ALLYEAR,P,S %SWTD%) 'Capacity Utilzation (=L=)'
%EQ%E_CAPACT(R,ALLYEAR,ALLYEAR,P,S %SWTD%) 'Capacity Utilzation (=E=)'
%EQ%G_CAPACT(R,ALLYEAR,ALLYEAR,P,S %SWTD%) 'Capacity Utilzation (=G=)'
* Basic commodity balance equations (by type) ensuring that production >=/= consumption
%EQ%G_COMBAL(R,ALLYEAR,C,S %SWTD%) 'Commodity Balance (=G=)' //
%EQ%E_COMBAL(R,ALLYEAR,C,S %SWTD%) 'Commodity Balance (=E=)' //
%EQ%E_COMPRD(R,ALLYEAR,C,S %SWTD%) 'Commodity Production (=E=)'
%EQ%L_COMCES(R,ALLYEAR,C,C,S%SWTD%) 'CES substitution steps (=L=)'
* Transfer of installed capacity between periods
%EQ%G_CPT(R,ALLYEAR,P %SWTD%) 'Capacity Transfer (=G=)'
%EQ%E_CPT(R,ALLYEAR,P %SWTD%) 'Capacity Transfer (=E=)'
%EQ%L_CPT(R,ALLYEAR,P %SWTD%) 'Capacity Transfer (=L=)'
* Cumulative constraints
%EQ%_CUMNET(R,C,ALLYEAR,ALLYEAR %SWD%) 'Cummulative Net Commodity Limit (=E=)'
%EQ%_CUMPRD(R,C,ALLYEAR,ALLYEAR %SWD%) 'Cummulative Commodity Production Limit (=E=)'
%EQ%_CUMFLO(R,P,C,ALLYEAR,LL %SWD%) 'Cummulative Commodity Flow Limit (=E=)'
* Bound on the fraction of a flow within a time slice
%EQ%G_FLOFR(R,T,P,C,S,L %SWTD%) 'Flow fraction (=G=)'
%EQ%E_FLOFR(R,T,P,C,S,L %SWTD%) 'Flow fraction (=E=)'
%EQ%L_FLOFR(R,T,P,C,S,L %SWTD%) 'Flow fraction (=L=)'
* Bound on the total flow
%EQ%G_FLOBND(R,T,P,CG,S %SWTD%) 'Flow bound (=G=)'
%EQ%E_FLOBND(R,T,P,CG,S %SWTD%) 'Flow bound (=E=)'
%EQ%L_FLOBND(R,T,P,CG,S %SWTD%) 'Flow bound (=L=)'
* Market share equation allocating commodity percentages of a group
%EQ%G_INSHR(R,ALLYEAR,ALLYEAR,P,C,CG,S %SWTD%) 'Commodity Input Group Share (=G=)'
%EQ%E_INSHR(R,ALLYEAR,ALLYEAR,P,C,CG,S %SWTD%) 'Commodity Input Group Share (=E=)'
%EQ%L_INSHR(R,ALLYEAR,ALLYEAR,P,C,CG,S %SWTD%) 'Commodity Input Group Share (=L=)'
* Inter-period storage equation
%EQ%_STGIPS(R,ALLYEAR,ALLYEAR,P,ITEM %SWTD%) 'Inter-period storage equation'
%EQ%_STGAUX(R,ALLYEAR,ALLYEAR,P,C,S %SWTD%) 'Storage auxiliary flows'
* Inter-regional exchange balance
%EQ%_IRE(R,ALLYEAR,P,C,IE,S %SWTD%) 'Inter-regional Exchange Process Balance (=E=)'
* Bound on inter-regional exchange of a commodity
%EQ%G_IREBND(R,ALLYEAR,C,S,ALL_REG,IE %SWTD%) 'Limit on Inter-regional Exchange (=G=)'
%EQ%E_IREBND(R,ALLYEAR,C,S,ALL_REG,IE %SWTD%) 'Limit on Inter-regional Exchange (=E=)'
%EQ%L_IREBND(R,ALLYEAR,C,S,ALL_REG,IE %SWTD%) 'Limit on Inter-regional Exchange (=L=)'
* Bound on total exchange of a commodity to/from all regions
%EQ%G_XBND(ALL_REG,ALLYEAR,C,S,IE %SWTD%) 'Limit on Total Exchange (=G=)'
%EQ%E_XBND(ALL_REG,ALLYEAR,C,S,IE %SWTD%) 'Limit on Total Exchange (=E=)'
%EQ%L_XBND(ALL_REG,ALLYEAR,C,S,IE %SWTD%) 'Limit on Total Exchange (=L=)'
* Product share equation allocating commodity percentages of a group
%EQ%G_OUTSHR(R,ALLYEAR,ALLYEAR,P,C,CG,S %SWTD%) 'Commodity Output Group Share (=G=)'
%EQ%E_OUTSHR(R,ALLYEAR,ALLYEAR,P,C,CG,S %SWTD%) 'Commodity Output Group Share (=E=)'
%EQ%L_OUTSHR(R,ALLYEAR,ALLYEAR,P,C,CG,S %SWTD%) 'Commodity Output Group Share (=L=)'
* Process market-share equation of total commodity production
%EQ%G_FLOMRK(R,ALLYEAR,ITEM,C,S %SWTD%) 'Process market-share (=G=)' //
%EQ%E_FLOMRK(R,ALLYEAR,ITEM,C,S %SWTD%) 'Process market-share (=E=)' //
%EQ%L_FLOMRK(R,ALLYEAR,ITEM,C,S %SWTD%) 'Process market-share (=L=)' //
* Peaking Equation
%EQ%_PEAK(R,ALLYEAR,COM_GRP,S %SWTD%) 'Commodity Peaking constraint (=G=)'
* Commodity-to-commodity transformation
%EQ%_PTRANS(R,ALLYEAR,ALLYEAR,P,CG,CG,S %SWTD%) 'Commodity-to-Commodity Transform (=E=)'
* Time-slice storage equation
%EQ%_STGTSS(R,ALLYEAR,ALLYEAR,P,S %SWTD%) 'Time-slice storage equation'
%EQ%_STSBAL(R,ALLYEAR,ALLYEAR,P,TSL,S,L%SWTD%) 'Time-slice storage balancer'
EQ_STSLEV(R,ALLYEAR,ALLYEAR,P,TSLVL,S,ALLSOW) 'Time-slice storage levelizer'
* Bound on storage flow
%EQ%G_STGIN(R,ALLYEAR,P,C,S %SWTD%) 'Bound on input flow of storage (=G=)'
%EQ%E_STGIN(R,ALLYEAR,P,C,S %SWTD%) 'Bound on input flow of storage (=E=)'
%EQ%L_STGIN(R,ALLYEAR,P,C,S %SWTD%) 'Bound on input flow of storage (=L=)'
%EQ%G_STGOUT(R,ALLYEAR,P,C,S %SWTD%) 'Bound on output flow of storage (=G=)'
%EQ%E_STGOUT(R,ALLYEAR,P,C,S %SWTD%) 'Bound on output flow of storage (=E=)'
%EQ%L_STGOUT(R,ALLYEAR,P,C,S %SWTD%) 'Bound on output flow of storage (=L=)'
* Retirements
%EQ%_CUMRET(R,ALLYEAR,ALLYEAR,P%SWTD%) 'Cumulative retirements'
%EQ%L_REFIT(R,ALLYEAR,ALLYEAR,P,L%SWTD%) 'Retrofit/life-extension (=L=)'
%EQ%L_SCAP(R,ALLYEAR,P,IPS%SWD%) 'Salvage capacity (=L=)'
* Cost bounds
%EQ%_BNDCST(REG,ALLYEAR,T,ALLYEAR,COSTCAT,CUR %SWD%) 'Bound on cumulative costs'
* User-constraints
%EQ%E_UC(UC_N %SWD%) 'User-constraints (=E=)'
%EQ%E_UCR(R,UC_N %SWD%) 'User-constraints (=E=)'
%EQ%E_UCT(UC_N,T %SWTD%) 'User-constraints (=E=)'
%EQ%E_UCRT(R,T,UC_N %SWTD%) 'User-constraints (=E=)'
%EQ%E_UCTS(UC_N,T,S %SWTD%) 'User-constraints (=E=)'
%EQ%E_UCRS(R,T,UC_N,TSL,S %SWTD%) 'User-constraints (=E=)'
%EQ%E_UCRTS(R,T,UC_N,S %SWTD%) 'User-constraints (=E=)'
%EQ%E_UCSU(UC_N,T %SWD%) 'User-constraints (=E=)'
%EQ%E_UCSUS(UC_N,T,S %SWD%) 'User-constraints (=E=)'
%EQ%E_UCRSUS(R,T,UC_N,S %SWD%) 'User-constraints (=E=)'
%EQ%E_UCRSU(R,T,UC_N %SWD%) 'User-constraints (=E=)'
$IF %VAR_UC% == YES $GOTO UCDONE
EQG_UC(UC_N) 'User-constraints (=G=)'
EQG_UCR(R,UC_N) 'User-constraints (=G=)'
EQG_UCT(UC_N,T) 'User-constraints (=G=)'
EQG_UCRT(R,T,UC_N) 'User-constraints (=G=)'
EQG_UCTS(UC_N,T,S) 'User-constraints (=G=)'
EQG_UCRS(R,T,UC_N,TSL,S) 'User-constraints (=G=)'
EQG_UCRTS(R,T,UC_N,S) 'User-constraints (=G=)'
EQG_UCSU(UC_N,T) 'User-constraints (=G=)'
EQG_UCSUS(UC_N,T,S) 'User-constraints (=G=)'
EQG_UCRSUS(R,T,UC_N,S) 'User-constraints (=G=)'
EQG_UCRSU(R,T,UC_N) 'User-constraints (=G=)'
EQL_UC(UC_N) 'User-constraints (=L=)'
EQL_UCR(R,UC_N) 'User-constraints (=L=)'
EQL_UCT(UC_N,T) 'User-constraints (=L=)'
EQL_UCRT(R,T,UC_N) 'User-constraints (=L=)'
EQL_UCTS(UC_N,T,S) 'User-constraints (=L=)'
EQL_UCRS(R,T,UC_N,TSL,S) 'User-constraints (=L=)'
EQL_UCRTS(R,T,UC_N,S) 'User-constraints (=L=)'
EQL_UCSU(UC_N,T) 'User-constraints (=L=)'
EQL_UCSUS(UC_N,T,S) 'User-constraints (=L=)'
EQL_UCRSUS(R,T,UC_N,S) 'User-constraints (=L=)'
EQL_UCRSU(R,T,UC_N) 'User-constraints (=L=)'
$LABEL UCDONE
*-----------------------------------------------------------------------------
*GG* V07_2 BLENDing equation
EQL_BLND(R,YEAR,BLE,SPE,ALLSOW) 'Blending (=L=)'
EQG_BLND(R,YEAR,BLE,SPE,ALLSOW) 'Blending (=G=)'
EQE_BLND(R,YEAR,BLE,SPE,ALLSOW) 'Blending (=E=)'
EQN_BLND(R,YEAR,BLE,SPE,ALLSOW) 'Blending non-binding'
* Damage Extension
%EQ%_DAMAGE(R,T,C %SWD%) 'Damages'
* Stochastic extension
%EQ%_ROBJ(R%SWD%) 'Deterministic objective by region and SOW'
%EQ%_SOBJ(LIM%SWD%) 'Deterministic objective by SOW'
EQ_EXPOBJ(ALLSOW) 'Expected value of total system cost'
EQ_UPDEV(ALLSOW) 'Upper absolute deviation'
;