From 32e1de95e49fd0c1d2e4da10b97868740bd181c9 Mon Sep 17 00:00:00 2001 From: Olexandr Balyk Date: Thu, 11 Jan 2024 22:21:53 -0500 Subject: [PATCH 1/3] Remove TIMES source code --- source/.gitattributes | 32 - source/.zenodo.json | 19 - source/AUTHORS.md | 37 - source/COPYING.txt | 621 --------- source/Contributing.md | 31 - source/NOTICE-GPLv3.txt | 17 - source/README.md | 61 - source/Version-Old.rar | Bin 18364 -> 0 bytes source/Version.log | 2752 ------------------------------------- source/_times.g00 | Bin 6545 -> 0 bytes source/atlearn.etl | 140 -- source/atlearn1.etl | 57 - source/atlearn8.etl | 44 - source/atlearn9.etl | 78 -- source/atsc.etl | 68 - source/bnd_act.mod | 26 - source/bnd_cum.mod | 48 - source/bnd_elas.mod | 40 - source/bnd_flo.mod | 40 - source/bnd_ire.vda | 39 - source/bnd_macro.tm | 38 - source/bnd_set.mod | 34 - source/bnd_stg.mod | 26 - source/bnd_ucv.mod | 97 -- source/bnd_ucw.mod | 25 - source/bndmain.mod | 87 -- source/cal_cap.mod | 30 - source/cal_caps.mod | 29 - source/cal_fflo.mod | 52 - source/cal_ire.mod | 48 - source/cal_nored.red | 30 - source/cal_red.red | 59 - source/cal_stgn.mod | 23 - source/calibase.mlf | 118 -- source/clearsol.stc | 41 - source/clearsol.stp | 34 - source/coef_alt.lin | 161 --- source/coef_cpt.mod | 63 - source/coef_csv.mod | 77 -- source/coef_ext.abs | 112 -- source/coef_ext.cli | 199 --- source/coef_ext.etl | 74 - source/coef_ext.vda | 74 - source/coef_nio.mod | 72 - source/coef_obj.mod | 205 --- source/coef_ptr.mod | 53 - source/coef_shp.mod | 75 - source/coefmain.mod | 29 - source/cost_ann.rpt | 208 --- source/curex.gms | 81 -- source/ddfupd.msa | 46 - source/dumpsol.mod | 28 - source/dumpsol1.mod | 204 --- source/dumpsolv.mod | 92 -- source/dynslite.vda | 115 -- source/eqactbnd.mod | 29 - source/eqactflo.mod | 31 - source/eqactups.vda | 156 --- source/eqashar.vda | 78 -- source/eqblnd.mod | 71 - source/eqbndcom.mod | 25 - source/eqbndcst.mod | 215 --- source/eqcaflac.vda | 60 - source/eqcapact.mod | 52 - source/eqcapvac.mod | 30 - source/eqchpelc.ier | 55 - source/eqcombal.mod | 114 -- source/eqcpt.mod | 28 - source/eqcumcom.mod | 34 - source/eqcumflo.mod | 48 - source/eqdamage.mod | 158 --- source/eqdeclr.mod | 195 --- source/eqdeclr.tm | 77 -- source/eqflobnd.mod | 45 - source/eqflofr.mod | 27 - source/eqflomrk.mod | 104 -- source/eqfloshr.mod | 42 - source/eqire.mod | 55 - source/eqirebnd.mod | 70 - source/eqlducs.vda | 175 --- source/eqmacro.tm | 137 -- source/eqmain.mod | 254 ---- source/eqmrkcom.ier | 94 -- source/eqobj.mod | 125 -- source/eqobj.tm | 64 - source/eqobjann.tm | 100 -- source/eqobjcst.tm | 63 - source/eqobjels.mod | 51 - source/eqobjels.rpt | 37 - source/eqobjfix.mod | 227 --- source/eqobjfix.rpt | 60 - source/eqobjinv.mod | 324 ----- source/eqobjinv.rpt | 69 - source/eqobjvar.mod | 113 -- source/eqobjvar.rpt | 181 --- source/eqobsalv.mod | 143 -- source/eqobsalv.rpt | 74 - source/eqpeak.mod | 90 -- source/eqpk_ect.ier | 11 - source/eqptrans.mod | 41 - source/eqstgaux.lin | 43 - source/eqstgaux.mod | 44 - source/eqstgflo.mod | 31 - source/eqstgips.lin | 68 - source/eqstgips.mod | 46 - source/eqstgtss.mod | 99 -- source/equ_ext.abs | 203 --- source/equ_ext.cli | 109 -- source/equ_ext.dsc | 33 - source/equ_ext.ecb | 48 - source/equ_ext.etl | 76 - source/equ_ext.ier | 48 - source/equ_ext.mlf | 182 --- source/equ_ext.msa | 117 -- source/equ_ext.vda | 105 -- source/equcrtp.vda | 124 -- source/equcwrap.mod | 42 - source/equserco.mod | 122 -- source/eqxbnd.mod | 59 - source/err_stat.mod | 66 - source/fillcost.gms | 43 - source/fillparm.gms | 57 - source/fillsow.stc | 47 - source/fillvint.gms | 35 - source/fillwave.gms | 21 - source/filparam.gms | 43 - source/filshape.gms | 26 - source/forcupd.cli | 33 - source/gdxfilter.gms | 30 - source/globals.def | 16 - source/init_ext.abs | 32 - source/init_ext.dsc | 20 - source/init_ext.vda | 152 -- source/initmty.abs | 56 - source/initmty.cli | 123 -- source/initmty.dsc | 17 - source/initmty.etl | 66 - source/initmty.ier | 23 - source/initmty.mlf | 62 - source/initmty.mod | 499 ------- source/initmty.msa | 117 -- source/initmty.stc | 82 -- source/initmty.tm | 56 - source/initmty.vda | 66 - source/initsys.mod | 187 --- source/main_ext.mod | 23 - source/maindrv.mod | 134 -- source/maplists.def | 122 -- source/mod_equa.mod | 216 --- source/mod_equa.tm | 91 -- source/mod_ext.abs | 28 - source/mod_ext.cli | 13 - source/mod_ext.dsc | 12 - source/mod_ext.etl | 21 - source/mod_ext.ier | 18 - source/mod_ext.vda | 52 - source/mod_vars.abs | 54 - source/mod_vars.cli | 26 - source/mod_vars.dsc | 19 - source/mod_vars.etl | 39 - source/mod_vars.mod | 96 -- source/mod_vars.msa | 34 - source/mod_vars.tm | 57 - source/par_uc.rpt | 20 - source/pextlevs.stc | 63 - source/powerflo.vda | 334 ----- source/pp_actef.vda | 82 -- source/pp_chp.ier | 63 - source/pp_chp.mod | 69 - source/pp_clean.mod | 27 - source/pp_lvlbd.mod | 47 - source/pp_lvlbr.mod | 55 - source/pp_lvlfc.mod | 45 - source/pp_lvlff.mod | 41 - source/pp_lvlfs.mod | 43 - source/pp_lvlif.mod | 45 - source/pp_lvlpk.mod | 53 - source/pp_lvlus.mod | 39 - source/pp_micro.mod | 91 -- source/pp_off.mod | 23 - source/pp_prelv.vda | 116 -- source/pp_qack.mod | 373 ----- source/pp_qafs.mod | 111 -- source/pp_qaput.mod | 16 - source/pp_reduce.red | 183 --- source/pp_shapr.mod | 48 - source/ppm_ext.dsc | 16 - source/ppm_ext.ecb | 49 - source/ppm_ext.mlf | 92 -- source/ppm_ext.vda | 161 --- source/ppmain.mod | 1343 ------------------ source/ppmain.tm | 72 - source/prep_ext.abs | 33 - source/prep_ext.dsc | 20 - source/prep_ext.ier | 21 - source/prep_ext.mlf | 43 - source/prep_ext.stc | 56 - source/prep_ext.tm | 32 - source/prep_ext.vda | 79 -- source/prepparm.gms | 71 - source/preppm.mod | 250 ---- source/preppm.msa | 78 -- source/prepret.dsc | 150 -- source/prepxtra.mod | 90 -- source/preshape.gms | 49 - source/presolve.mlf | 103 -- source/readbprice.mod | 48 - source/recurrin.stc | 180 --- source/resloadc.vda | 154 --- source/rpt_dam.mod | 56 - source/rpt_ext.cli | 53 - source/rpt_ext.ecb | 69 - source/rpt_ext.ier | 50 - source/rpt_ext.mlf | 113 -- source/rpt_ext.msa | 63 - source/rpt_obj.rpt | 145 -- source/rpt_objc.rpt | 128 -- source/rpt_par.cli | 79 -- source/rptlite.rpt | 175 --- source/rptmain.mod | 48 - source/rptmain.rpt | 283 ---- source/rptmain.stc | 125 -- source/rptmain.tm | 140 -- source/rptmisc.rpt | 276 ---- source/sensis.stc | 43 - source/setglobs.gms | 354 ----- source/sol_flo.red | 43 - source/sol_ire.rpt | 20 - source/solprep.msa | 133 -- source/solputta.ans | 263 ---- source/solsetv.v3 | 191 --- source/solsubta.ans | 51 - source/solsysd.v3 | 14 - source/solvcoef.msa | 91 -- source/solve.mod | 47 - source/solve.msa | 178 --- source/solve.stc | 134 -- source/solve.stp | 338 ----- source/spoint.mod | 87 -- source/stages.stc | 272 ---- source/times2veda.vdd | 157 --- source/times2veda_stc.vdd | 148 -- source/times2veda_v3.vdd | 109 -- source/timesrng.gms | 16 - source/timslice.mod | 121 -- source/uc_act.mod | 53 - source/uc_cap.mod | 52 - source/uc_cli.mod | 43 - source/uc_com.mod | 47 - source/uc_flo.mod | 77 -- source/uc_ire.mod | 58 - source/uc_ncap.mod | 51 - source/uc_pasti.mod | 33 - source/ucbet.vda | 129 -- source/units.def | 17 - source/writeddf.msa | 82 -- source/wrtbprice.mod | 35 - 257 files changed, 26217 deletions(-) delete mode 100644 source/.gitattributes delete mode 100644 source/.zenodo.json delete mode 100644 source/AUTHORS.md delete mode 100644 source/COPYING.txt delete mode 100644 source/Contributing.md delete mode 100644 source/NOTICE-GPLv3.txt delete mode 100644 source/README.md delete mode 100644 source/Version-Old.rar delete mode 100644 source/Version.log delete mode 100644 source/_times.g00 delete mode 100644 source/atlearn.etl delete mode 100644 source/atlearn1.etl delete mode 100644 source/atlearn8.etl delete mode 100644 source/atlearn9.etl delete mode 100644 source/atsc.etl delete mode 100644 source/bnd_act.mod delete mode 100644 source/bnd_cum.mod delete mode 100644 source/bnd_elas.mod delete mode 100644 source/bnd_flo.mod delete mode 100644 source/bnd_ire.vda delete mode 100644 source/bnd_macro.tm delete mode 100644 source/bnd_set.mod delete mode 100644 source/bnd_stg.mod delete mode 100644 source/bnd_ucv.mod delete mode 100644 source/bnd_ucw.mod delete mode 100644 source/bndmain.mod delete mode 100644 source/cal_cap.mod delete mode 100644 source/cal_caps.mod delete mode 100644 source/cal_fflo.mod delete mode 100644 source/cal_ire.mod delete mode 100644 source/cal_nored.red delete mode 100644 source/cal_red.red delete mode 100644 source/cal_stgn.mod delete mode 100644 source/calibase.mlf delete mode 100644 source/clearsol.stc delete mode 100644 source/clearsol.stp delete mode 100644 source/coef_alt.lin delete mode 100644 source/coef_cpt.mod delete mode 100644 source/coef_csv.mod delete mode 100644 source/coef_ext.abs delete mode 100644 source/coef_ext.cli delete mode 100644 source/coef_ext.etl delete mode 100644 source/coef_ext.vda delete mode 100644 source/coef_nio.mod delete mode 100644 source/coef_obj.mod delete mode 100644 source/coef_ptr.mod delete mode 100644 source/coef_shp.mod delete mode 100644 source/coefmain.mod delete mode 100644 source/cost_ann.rpt delete mode 100644 source/curex.gms delete mode 100644 source/ddfupd.msa delete mode 100644 source/dumpsol.mod delete mode 100644 source/dumpsol1.mod delete mode 100644 source/dumpsolv.mod delete mode 100644 source/dynslite.vda delete mode 100644 source/eqactbnd.mod delete mode 100644 source/eqactflo.mod delete mode 100644 source/eqactups.vda delete mode 100644 source/eqashar.vda delete mode 100644 source/eqblnd.mod delete mode 100644 source/eqbndcom.mod delete mode 100644 source/eqbndcst.mod delete mode 100644 source/eqcaflac.vda delete mode 100644 source/eqcapact.mod delete mode 100644 source/eqcapvac.mod delete mode 100644 source/eqchpelc.ier delete mode 100644 source/eqcombal.mod delete mode 100644 source/eqcpt.mod delete mode 100644 source/eqcumcom.mod delete mode 100644 source/eqcumflo.mod delete mode 100644 source/eqdamage.mod delete mode 100644 source/eqdeclr.mod delete mode 100644 source/eqdeclr.tm delete mode 100644 source/eqflobnd.mod delete mode 100644 source/eqflofr.mod delete mode 100644 source/eqflomrk.mod delete mode 100644 source/eqfloshr.mod delete mode 100644 source/eqire.mod delete mode 100644 source/eqirebnd.mod delete mode 100644 source/eqlducs.vda delete mode 100644 source/eqmacro.tm delete mode 100644 source/eqmain.mod delete mode 100644 source/eqmrkcom.ier delete mode 100644 source/eqobj.mod delete mode 100644 source/eqobj.tm delete mode 100644 source/eqobjann.tm delete mode 100644 source/eqobjcst.tm delete mode 100644 source/eqobjels.mod delete mode 100644 source/eqobjels.rpt delete mode 100644 source/eqobjfix.mod delete mode 100644 source/eqobjfix.rpt delete mode 100644 source/eqobjinv.mod delete mode 100644 source/eqobjinv.rpt delete mode 100644 source/eqobjvar.mod delete mode 100644 source/eqobjvar.rpt delete mode 100644 source/eqobsalv.mod delete mode 100644 source/eqobsalv.rpt delete mode 100644 source/eqpeak.mod delete mode 100644 source/eqpk_ect.ier delete mode 100644 source/eqptrans.mod delete mode 100644 source/eqstgaux.lin delete mode 100644 source/eqstgaux.mod delete mode 100644 source/eqstgflo.mod delete mode 100644 source/eqstgips.lin delete mode 100644 source/eqstgips.mod delete mode 100644 source/eqstgtss.mod delete mode 100644 source/equ_ext.abs delete mode 100644 source/equ_ext.cli delete mode 100644 source/equ_ext.dsc delete mode 100644 source/equ_ext.ecb delete mode 100644 source/equ_ext.etl delete mode 100644 source/equ_ext.ier delete mode 100644 source/equ_ext.mlf delete mode 100644 source/equ_ext.msa delete mode 100644 source/equ_ext.vda delete mode 100644 source/equcrtp.vda delete mode 100644 source/equcwrap.mod delete mode 100644 source/equserco.mod delete mode 100644 source/eqxbnd.mod delete mode 100644 source/err_stat.mod delete mode 100644 source/fillcost.gms delete mode 100644 source/fillparm.gms delete mode 100644 source/fillsow.stc delete mode 100644 source/fillvint.gms delete mode 100644 source/fillwave.gms delete mode 100644 source/filparam.gms delete mode 100644 source/filshape.gms delete mode 100644 source/forcupd.cli delete mode 100644 source/gdxfilter.gms delete mode 100644 source/globals.def delete mode 100644 source/init_ext.abs delete mode 100644 source/init_ext.dsc delete mode 100644 source/init_ext.vda delete mode 100644 source/initmty.abs delete mode 100644 source/initmty.cli delete mode 100644 source/initmty.dsc delete mode 100644 source/initmty.etl delete mode 100644 source/initmty.ier delete mode 100644 source/initmty.mlf delete mode 100644 source/initmty.mod delete mode 100644 source/initmty.msa delete mode 100644 source/initmty.stc delete mode 100644 source/initmty.tm delete mode 100644 source/initmty.vda delete mode 100644 source/initsys.mod delete mode 100644 source/main_ext.mod delete mode 100644 source/maindrv.mod delete mode 100644 source/maplists.def delete mode 100644 source/mod_equa.mod delete mode 100644 source/mod_equa.tm delete mode 100644 source/mod_ext.abs delete mode 100644 source/mod_ext.cli delete mode 100644 source/mod_ext.dsc delete mode 100644 source/mod_ext.etl delete mode 100644 source/mod_ext.ier delete mode 100644 source/mod_ext.vda delete mode 100644 source/mod_vars.abs delete mode 100644 source/mod_vars.cli delete mode 100644 source/mod_vars.dsc delete mode 100644 source/mod_vars.etl delete mode 100644 source/mod_vars.mod delete mode 100644 source/mod_vars.msa delete mode 100644 source/mod_vars.tm delete mode 100644 source/par_uc.rpt delete mode 100644 source/pextlevs.stc delete mode 100644 source/powerflo.vda delete mode 100644 source/pp_actef.vda delete mode 100644 source/pp_chp.ier delete mode 100644 source/pp_chp.mod delete mode 100644 source/pp_clean.mod delete mode 100644 source/pp_lvlbd.mod delete mode 100644 source/pp_lvlbr.mod delete mode 100644 source/pp_lvlfc.mod delete mode 100644 source/pp_lvlff.mod delete mode 100644 source/pp_lvlfs.mod delete mode 100644 source/pp_lvlif.mod delete mode 100644 source/pp_lvlpk.mod delete mode 100644 source/pp_lvlus.mod delete mode 100644 source/pp_micro.mod delete mode 100644 source/pp_off.mod delete mode 100644 source/pp_prelv.vda delete mode 100644 source/pp_qack.mod delete mode 100644 source/pp_qafs.mod delete mode 100644 source/pp_qaput.mod delete mode 100644 source/pp_reduce.red delete mode 100644 source/pp_shapr.mod delete mode 100644 source/ppm_ext.dsc delete mode 100644 source/ppm_ext.ecb delete mode 100644 source/ppm_ext.mlf delete mode 100644 source/ppm_ext.vda delete mode 100644 source/ppmain.mod delete mode 100644 source/ppmain.tm delete mode 100644 source/prep_ext.abs delete mode 100644 source/prep_ext.dsc delete mode 100644 source/prep_ext.ier delete mode 100644 source/prep_ext.mlf delete mode 100644 source/prep_ext.stc delete mode 100644 source/prep_ext.tm delete mode 100644 source/prep_ext.vda delete mode 100644 source/prepparm.gms delete mode 100644 source/preppm.mod delete mode 100644 source/preppm.msa delete mode 100644 source/prepret.dsc delete mode 100644 source/prepxtra.mod delete mode 100644 source/preshape.gms delete mode 100644 source/presolve.mlf delete mode 100644 source/readbprice.mod delete mode 100644 source/recurrin.stc delete mode 100644 source/resloadc.vda delete mode 100644 source/rpt_dam.mod delete mode 100644 source/rpt_ext.cli delete mode 100644 source/rpt_ext.ecb delete mode 100644 source/rpt_ext.ier delete mode 100644 source/rpt_ext.mlf delete mode 100644 source/rpt_ext.msa delete mode 100644 source/rpt_obj.rpt delete mode 100644 source/rpt_objc.rpt delete mode 100644 source/rpt_par.cli delete mode 100644 source/rptlite.rpt delete mode 100644 source/rptmain.mod delete mode 100644 source/rptmain.rpt delete mode 100644 source/rptmain.stc delete mode 100644 source/rptmain.tm delete mode 100644 source/rptmisc.rpt delete mode 100644 source/sensis.stc delete mode 100644 source/setglobs.gms delete mode 100644 source/sol_flo.red delete mode 100644 source/sol_ire.rpt delete mode 100644 source/solprep.msa delete mode 100644 source/solputta.ans delete mode 100644 source/solsetv.v3 delete mode 100644 source/solsubta.ans delete mode 100644 source/solsysd.v3 delete mode 100644 source/solvcoef.msa delete mode 100644 source/solve.mod delete mode 100644 source/solve.msa delete mode 100644 source/solve.stc delete mode 100644 source/solve.stp delete mode 100644 source/spoint.mod delete mode 100644 source/stages.stc delete mode 100644 source/times2veda.vdd delete mode 100644 source/times2veda_stc.vdd delete mode 100644 source/times2veda_v3.vdd delete mode 100644 source/timesrng.gms delete mode 100644 source/timslice.mod delete mode 100644 source/uc_act.mod delete mode 100644 source/uc_cap.mod delete mode 100644 source/uc_cli.mod delete mode 100644 source/uc_com.mod delete mode 100644 source/uc_flo.mod delete mode 100644 source/uc_ire.mod delete mode 100644 source/uc_ncap.mod delete mode 100644 source/uc_pasti.mod delete mode 100644 source/ucbet.vda delete mode 100644 source/units.def delete mode 100644 source/writeddf.msa delete mode 100644 source/wrtbprice.mod diff --git a/source/.gitattributes b/source/.gitattributes deleted file mode 100644 index e1ae61e..0000000 --- a/source/.gitattributes +++ /dev/null @@ -1,32 +0,0 @@ -# do not attempt any end-of-line conversion -* -text -# These files are in the GAMS language -*.gms linguist-language=GAMS -*.mod linguist-language=GAMS -*.abs linguist-language=GAMS -*.ans linguist-language=GAMS -*.def linguist-language=GAMS -*.dsc linguist-language=GAMS -*.cli linguist-language=GAMS -*.etl linguist-language=GAMS -*.ier linguist-language=GAMS -*.lin linguist-language=GAMS -*.msa linguist-language=GAMS -*.red linguist-language=GAMS -*.rpt linguist-language=GAMS -*.stc linguist-language=GAMS -*.tm linguist-language=GAMS -*.v3 linguist-language=GAMS -*.vda linguist-language=GAMS - -# These files are binary and should be left untouched -# (binary is a macro for -text -diff) -*.g00 binary -*.gz filter=lfs merge=lfs -text -diff -*.zip filter=lfs merge=lfs -text -diff -*.7z filter=lfs merge=lfs -text -diff -*.rar filter=lfs merge=lfs -text -diff -*.exe filter=lfs merge=lfs -text -diff - -# Documents -*.pdf filter=lfs merge=lfs -text -diff diff --git a/source/.zenodo.json b/source/.zenodo.json deleted file mode 100644 index 18ffc6c..0000000 --- a/source/.zenodo.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "creators": [ - { - "name": "IEA-ETSAP" - } - ], - - "license": "GPL-3.0", - - "title": "TIMES Model Generator", - - "keywords": [ - "TIMES", - "optimisation", - "energy system model", - "bottom-up model", - "open source" - ] -} diff --git a/source/AUTHORS.md b/source/AUTHORS.md deleted file mode 100644 index fc5ff8a..0000000 --- a/source/AUTHORS.md +++ /dev/null @@ -1,37 +0,0 @@ -# The Integrated Markal-EFOM System – TIMES -#### The code owner is the IEA Energy Technology Systems Analysis Programme (ETSAP) -# Original Authors of ETSAP TIMES (by contracting party) -* Ken Noble (Australia) -* Denise van Regemorter (Belgium) -* Amit Kanudia (Canada) -* Richard Loulou (Canada) -* Uwe Remme (Germany) -* Peter Schaumann (Germany) -* Günter Schmid (Germany) -* GianCarlo Tosato (Italy) -* Tom Kram (Netherlands) -* Tomas Larsson (Sweden) -* Gary Goldstein (USA) - -# Other contributing authors (incomplete list) -* Martin Baumann (Austria) -* Wouter Nijs (Belgium) -* Kathleen Vaillancourt (Canada) -* Kenneth Karlsson (Denmark) -* Raffaele Salvucci (Denmark) -* Markus Blesl (Germany) -* George Giannakidis (Greece) -* Kostas Tigas (Greece) -* James Glynn (Ireland) -* Maurizio Gargiulo (Italy) -* Ad Seebregts (Netherlands) -* Pernille Seljom (Norway) -* Evangelos Panos (Switzerland) -* Socrates Kypreos (Switzerland) -* Paul Dodds (United Kingdom) -* Evelyn Wright (USA) - -### Many thanks to all individuals who have contributed to ETSAP TIMES. - -# Current maintainer -* [@Antti-L](https://github.com/Antti-L) diff --git a/source/COPYING.txt b/source/COPYING.txt deleted file mode 100644 index ed990f8..0000000 --- a/source/COPYING.txt +++ /dev/null @@ -1,621 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/source/Contributing.md b/source/Contributing.md deleted file mode 100644 index 93e5909..0000000 --- a/source/Contributing.md +++ /dev/null @@ -1,31 +0,0 @@ -## Contributing to TIMES - -Contribution to TIMES is currently done through "Issues" in GitHub which can be used for: -1) filing bug reports, and -2) submitting feature and enhancement requests, - -and discussing all the necessary details about them. - -In "Issues", you can insert code snippets, links and attachments that demonstrate the issue or describe the proposed enhancement in detail. When a consensus is reached about an issue, the maintainer of TIMES will proceed by implementing the fix or the new feature, and integrate it in the next release of the ETSAP TIMES code. - -Currently the TIMES code is maintained by @Antti-L. - -This is the current approach of managing contributions to TIMES, without the need for "pull requests" for the Master branch. For eventual bigger projects a different workflow may be useful in separate branches. - -## Resources: - -- The main ETSAP[website](https://iea-etsap.org/) is a good place to get started with TIMES. -- Extended documentation for TIMES is available on the [website](https://iea-etsap.org/index.php/documentation). -- The [forum](http://iea-etsap.org/forum/index.php) is the main place to ask questions and search for answers from the ETSAP community. - -## Bugs - -If you find a programming error in TIMES, please submit an Issue in the repository. Follow the [issue template](https://github.com/etsap-TIMES/TIMES_model/issues/new) for submitting a bug. - -## Errors in the documentation - -The documentation can be found in the [Documentation Repository](https://github.com/etsap-TIMES/TIMES_Documentation). Please report issues with the Documentation [here](https://github.com/etsap-TIMES/TIMES_Documentation/issues/new). - -## Ideas and Suggestions - -If you have an idea on how TIMES could be improved, or to suggest useful additions, please submit a request using the Github issue [here](https://github.com/etsap-TIMES/TIMES_model/issues/new). diff --git a/source/NOTICE-GPLv3.txt b/source/NOTICE-GPLv3.txt deleted file mode 100644 index 4b0ade3..0000000 --- a/source/NOTICE-GPLv3.txt +++ /dev/null @@ -1,17 +0,0 @@ -*------------------------------------------------------------------------------ -* Copyright (C) 2000-2023 IEA Energy Technology Systems Analysis Programme. -*------------------------------------------------------------------------------ -* This software "The Integrated MARKAL-EFOM System - TIMES" is open source: -* you can redistribute it and/or modify it under the terms of the -* GNU General Public License as published by the Free Software Foundation, -* either version 3 of the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program (see the file COPYING.txt). If not, please visit: -* -*------------------------------------------------------------------------------ \ No newline at end of file diff --git a/source/README.md b/source/README.md deleted file mode 100644 index a1b5a8d..0000000 --- a/source/README.md +++ /dev/null @@ -1,61 +0,0 @@ -

GNU General Public LicenseThis work is licensed under a GNU General Public License.

- -# TIMES_model - -## The Integrated MARKAL-EFOM System (TIMES) – a bottom-up optimization model for energy-environment systems. - -The TIMES (The Integrated MARKAL-EFOM System) model generator was developed by ETSAP the Energy Technology Systems Analysis Program, which is a Technology Cooperation Program of the International Energy Agency. -ETSAP is an international community which uses long term energy scenarios to conduct in-depth energy and environmental analyses. -The TIMES model generator combines two different, but complementary, systematic approaches to modelling energy: a technical engineering approach and an economic approach. -TIMES is a technology rich, bottom-up model generator, which uses linear-programming to produce a least-cost energy system, optimized according to a number of user constraints, over medium to long-term time horizons. -In a nutshell, TIMES is used for, "the exploration of possible energy futures based on contrasted scenarios". - -## Model structure - -TIMES models encompass all the steps from primary resources through the chain of processes that transform, transport, distribute and convert energy into the supply of energy services demanded by energy consumers. -On the energy supply-side, it comprises fuel mining, primary and secondary production, and exogenous import and export. The “agents” of the energy supply-side are the “producers”. -Through various energy carriers, energy is delivered to the demand-side, which can be structured sectorally into residential, commercial, agricultural, transport and industrial sectors. The demand sector breakdwon is completely flexible and adaptable in TIMES. -The “agents” of the energy demand-side are the “consumers”. The mathematical, economic and engineering relationships between these energy “producers” and “consumers” is the basis underpinning TIMES models. - -## Scenarios - -The principle insights generated from TIMES are achieved through scenario analysis. A reference energy scenario is generated first by running the model in the absence of any policy constraints. -These results from the reference scenario are not normally totally aligned to national energy forecasts (generated by simulating future energy demand and supply), mainly because TIMES optimizes the energy systems providing a least cost solution. -A second scenario is then established by imposing a (single of many) policy constraint on the model (e.g. minimum share of renewable energy, maximum amount of GHG emissions or minimum level of energy security) and the model generates a different least cost energy system with different technology and fuel choices. -When the results are compared with those from the reference scenario, the different technology choices can be identified that deliver the policy constraint at least cost. - -## Functionality - -Once all the inputs, constraints and scenarios have been put in place, the model will attempt to solve and determine the energy system that meets the energy service demands over the entire time horizon at least cost. -It does this by simultaneously making equipment investment decisions and operating, primary energy supply, and energy trade decisions, by region. -TIMES assumes perfect foresight, which is to say that all investment decisions are made in each period with full knowledge of future events (myopic runs of the model are also possible). -It optimizes horizontally (across all sectors) and vertically (across all time periods for which the limit is imposed). -The results will be the optimal mix of technologies and fuels at each period, together with the associated emissions to meet the demand. -The model configures the production and consumption of commodities (i.e. fuels, materials, and energy services) and their prices; when the model matches supply with demand, i.e. energy producers with energy consumers, it is said to be in equilibrium. -Mathematically, this means that the model maximizes the producer and consumer surplus. The model is set up such that the price of producing a commodity affects the demand for that commodity, while at the same time the demand affects the commodity’s price. -A market is said to have reached an equilibrium at prices p and quantities q when no consumer wishes to purchase less than q and no producer wishes to produce more than q at price p. -When all markets are in equilibrium the total economic surplus is maximized (i.e. the sum of producers’ and consumers’ surpluses). -The main output TIMES are energy system configurations, which meet the end-use energy service demands at least cost while also adhering to the various constraints (e.g 80% emissions reduction, 40% renewable electricity penetration). -In the first instance, TIMES model addresses the question: is the target feasible? If an energy system is possible, it can then be examined, at what cost? The model outputs are energy flows, energy commodity prices, GHG emissions, capacities of technologies, energy costs and marginal emissions abatement costs. - -## Documentation [![Documentation](https://img.shields.io/badge/docs-passing-brightgreen.svg?style=flat&logo=github)](https://github.com/etsap-TIMES/TIMES_Documentation) - -Detailed documentation is available on ETSAP's [website](https://iea-etsap.org/index.php/documentation): - -i) [Concept and Theory](https://iea-etsap.org/docs/Documentation_for_the_TIMES_Model-Part-I_July-2016.pdf). -ii) [Comprehensive Reference Manual](https://iea-etsap.org/docs/Documentation_for_the_TIMES_Model-Part-II_July-2016.pdf). -iii) [Operation of TIMES code](https://iea-etsap.org/docs/Documentation_for_the_TIMES_Model-Part-III_July-2016.pdf). - -## TIMES Demo [![Demo model](https://img.shields.io/badge/demo%20model-available-brightgreen.svg?style=flat&logo=github)](https://github.com/etsap-TIMES/TIMES_Demo) - -A Demo model is available on [GitHub](https://github.com/etsap-TIMES/TIMES_Demo). - -## Community - -Information on the activities of ETSAP are available on ETSAP's [website](https://iea-etsap.org/). - -If you are interested in receiving information and newsletters on ETSAP's tool you can register [here](https://iea-etsap.org/index.php/etsap-tools/acquiring-etsap-tools). - -A forum for TIMES users is [available](http://iea-etsap.org/forum/index.php). - -[![DOI](https://zenodo.org/badge/229031856.svg)](https://zenodo.org/badge/latestdoi/229031856) diff --git a/source/Version-Old.rar b/source/Version-Old.rar deleted file mode 100644 index 5928b0ec4ca7d1beb691fcea438345e6de070d10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18364 zcmV(!K;^$uVR9iF2LR8Ia{vGh0000000011YjhxhE&y{!003F20RRH}6Xl)&pm97M zGY$YC00011WpZ zodfJC+tP|hREN`Qn_z~0#s#kaq(GeKY^p!z>7d?F>z7;?(CZ}(?yjba3knT6oZiW5 z-IJqX0(55Iedv~jO71XBbd4oG$)jtu1S>z_wPFzx3G{(nShpcC+l};a5&Va4h`RNX zS&t*}eY>nQ$=*}6CT>wI60j!_;3%tP&qBx55_79pK!VNixvT4?CWAc%CD~;G2cS6z z4eVO$nc&2bE3yYmf}EsB#s-vD@KXz|s1y(~AaE&JzD1Z*S%hn45=xm0t% zkxlcPaRZ49xUAO3Oh_tBMr?Ih66;y*1zBluOCIYM#3Z3RVFH{QrdgCN;+xc5A9QaT zpeD1w$127D{hf1;?_!w=AE}w~h?0t!!0)nb?M7+Kd^a1DuNnmYRq0on8v*WN{Lk|6 zz@*qojinDGd?QSC7LnfaepNP8cnzoEwPG1xaa}zitWJjT-;@_)ysLro!h_hXcoIuO zw*6?;@`#S`>@2eRM25SS8a6u5)ORZsTO?W zdbuP&wu>Odp!KfBcJ2svCIfz*o6Ez8S_Oqgq+&0;-q&rj0qE%bH?EkwA{fcv6b6T; z;rnsdsxGLCw0SgL4jia@#M%q9KrB9r?{;q`Mz@!5w5E!L+x!?Q`US?+6c;Sl>2$P2 zf=U#MRhkOGwcYH8X#n)f^@=8m#ZDGl&DM#H;X~d-y~mZ>C>&3eZ59<<6HTJc$vyP7 z;6QhT%6+S_ouudb0JvS>O8R*Q&~)gaWWt0u@cJdbL++6=?IRHWpy`jy%H$gPl$0+p zCs53q=(DFRL+&w*#0#@If;=O)bOW>S=yVNu;O#5pV7^@l4o1O*27{>y7D# z%P_Y@EiiA1YsOh{6_DZ3P`}4b76ZLNarxQnqlw)qft6EH|D0#Ek|Y5)F1LqMwoxDv z5d^>WA|@zt7XEisIv8lVamaU%g2}|VYv24Ymi93mNedsL1SpA;+o#TgClp_pN4Wt$ zauP&Vt4gT;o(~A#Aj~1Im7zgQD z1o$OcTA+k)cfDk2{`U)G-=|fFKfcE<^kA#rDeOVsy|rl!h<2sETWeA5fod1)zZjp%s&wi{Tv`f9 ztwPgyu2)8k^bn7iS64Wpj`_`lv`(4Yx`O-X^u!cVo~sN6K& zX=ozG13q@qvw5nMn@(B;tZ`5K_1@@gmAoF_v^6k0r7PgoDDys714oIIoUyy(r7eb_ zCw~x%?5XCjanoSzE!xtMdz+3(Kd1Qscsq+jydsjzUf;JYfzM<6ZBG);a|N9CNZQU1 zMuYaDFSP2$Sh(q~g0BB7GWAGGqQU+0lC_LBB9{L5`~&R4dHZ1qCN%t1n;)m2LejtE zH2$dNK(K^)cg+G++fP<9g4<2u4SG|q!dIBzn@dkmW~_ZxTd&TWh?^W9p|Qw*^g*H( z*HXIuI5|GzfRHBzC-ty2+cN0HcGh&J;+(MY)@X5)9Z!Bmv4!eM!{yW*vDS&yWgvgU za*BxUuedZ}W5KpH5+&=xUd5b1DFk(;GxXbRI>a|2Uz^WfG7!6U~^9dH;gn4YSu?yQ|%Ue)J&#GaRjP^t`L}di2k2HXnx)H0xqVC;3-f!x`7g6*!OoeO^ zw&oAgoenlO&!w-f9MnWPBc$P05=rD#q~8cI+ou~|0LxRk9EWb!sKswJCI~C2dJ>~M zN%|v_wU#{0_kaEuxtZ7EHagra>2I)O8!~+TeLvsWJ4d22dN=Whm+sItN9f8GIV1PXN439cS}Q1eQUDlNbc$f_%FGqlWv8t8SSKoZ98F4WWp(j;InEsq8PJx{I>$`3fEBZb#<#ro!fcE{lBbj1)QdI0;KIXO7BMScNep#SVQiKmW}v}!2Y z;xu_RqWsH+_)uGpn&0ZX20Zg_2{FW}JzaDRy>iEiZq)Tn6IkH){J0i(!u-6!E8y1D zAfHJ~#vq(1Z`)LOVE~8xQ4!(hjjPoCA>xmlcNTtN**)IB@zIUL{ULbIlUx*sE(<4B z7wxQj(Gy*d?<~v#EV@LCo*n?IEJp4V(^i&=I!2=<;G~z(5Y)vsXY$jIYJWlis z_MC+9nE#=gIWLy@0%zOC+9&aD#0b|zwheekQyP}drt`xYLTD7N7PE_Ge&ZX_eqo?X zo3!Ef)X6`F6$!!-a8y-QqW@=aNrLHO7BG-S^CM@Z7ZbLPL3P+!;FUJB;QqVpzQDk; zw^)X!|H-MVYBDzOmKS8DmG6VeP1m<)|2+F96--I^1A(x-=$nj?3WknTdpNDTd|QtK zuE~C%w>4ir^9*aN3eS)UziH&xP&zbZN|FN9mBY+`>o)6oP>iXGy0f{IfYT z!aKREuR(Y(96IC2?vJn<$F#8RWlYcfdd$x&jx7Zv4*mkn0LFPj9jS$egiJbbKs2Q- zVQCU6YPYU^(N}uq{8npPHzfCiva^=YjSo+$)`pO3{(sVRPPESqw%)aEr~h|JPfb;F zyr~Yo^dR&ZLw`z)`8F96aAL@4oSHU*4>)1TqHkXNALlq`<6BC=CTzL}+b3unHSb7j zgVbmr@s{wX(rOC?ep)nd|Dcn!<%t^?t^AXEgVFuGaL(y|j^o&H?U;mZ?L|fBlC76- zSCoOvj=SpL&nBXMBBQ+;fg2yGC)6ae>|Ng{A(M0eFm`JLG>V+F<+cXGdLE`4vn9F` z;<=cT=4>*rRVxyRm;pZa>ZRkI*d)X6SG0_Y(q2;Hd-~*!On3uzXq3QTi}6g0W~)hW zP3WJ_m}cNumsZ=_3xTnAA0+7|LRu)lUCrEC-c<5QjarRVLRGQ(XIj0d9*7)kxr5o# zVj}Y>EL%3X81W4?!d$1itd-%@AR%MMdQD=q^UFS@{`=rQx$`CsKAS&;=#Xr& z+t;jrGeo(^J?lhS#D|4=lGuyMtao51^5oOu-X3&%5==SG)gi*sg2t2A9ZxY4!Fi8v zo!d;^hO+J2#%vLgfMMfaP8Ep@9^j&;Fd(iqDmt%M0go^uFx7P1=!-=YTw)ZQ)CYlg z%~1}Ygkx#&a$k~QZ4k!vOqQ|+SHxo#y}vg{z+Uff;I}$4IZ#RbrWzhx~M8LPV*r|FjJyc#2$1&VAenJ7k)2)=r&7{g&FsI;-Rb zOYtcL!TJ{Aeql9sMUl9&%|jQQ-Nb0*sZQ7E^~fl?#*W80w?{>$#md*iKX1lp>Pp!8E%j}>h4o0_nH6yV(9oWR?!1tOp)6pNP4?N?DI$fT7QrS;Nn%+ ziMQ2+IOF+*jq&G${J0Kx7XzIZ87y-B^vO4Lf+z}}U?P5Ru1i}m1`0x}Y**gfi+V`h zx7-GAQdHXzJ397^3ptt*@^K)!aQPo8@NxGmUAMaWGgMoO?qPSeSR116-o(EE_!VT4 zDSzfTCXoR1+tHdYhrWHIQ_PX8^m#mLtrpOlMwfR~))JPIKCPPW5{KUOco;w^{*{ zx&>zjjIin^3jU2y+-}G#4{Ia~)Jo>q3K^QG^e)4l$JRH*7rg zvtJ!6s4WA72QYCYCDiR70@$L81aZ@?=ljBXRafeVGLVS0U|7s&%Jj*@m}1HxHu{}p z{pv3JP=P3_eklqSv$xBvRN~N90cXpXl!&}T%a#0`e=UD^NRc@Skiqt{k3~s}<&7-p zz^$gUmt|t);^QkuOZM+?vWi0Atz~Z(@!V{N1reavh*|D(&(~d(1fa-3e218qYZ|e~$v4wBjGI>DS2obhl{1SfklZM-AsSLS zgf)7fo5`4s(CsP?i|Fh1p=lw+u@tmUE5@K*qTR4UYRFbJ;Prabi=qrp^SlF4)@^`4 zXo7Dk)%^o0IRGb3ikgyuul*^$ty1roOkBF&Kl1CpiP>v<(U(|cZ7CtnAHK+{R^;7Z zb1G;j;VETu?qAlO%EAJux{DYuXX>{Fa)h}zB5O>^&vy3 zm#bw%tdV`!pBw6B{?$M?(wQxL>qz?lndzMyT5-^x2Q`TbihLv__}%LEn|O*WsO%mc zw%aD+$W17oZYW~@faW`jzar~s?Z&`NUl6bY6A$?Ss>{XrA`KIW>&J+;3ZRqI3TERQ zs72Sj1=!Y3hUY!i20#}w3#j9EXcAzgvln1qDQX^}K*qw-Hwh2pl^hB>mN1Fo9r4aC z(7|+~MK@<6{eTPF_!*%RblVhCKPfTsVj+1aHMBG=6o;(PD^~GB%LHYb2pNE{S2BP- zEq~y4BeAZSzg>Qi)COi?A;;2#At3%#Spkt8vQQGFb;sBW^5<&##^6}Ge}AoNTwSiCoH>oWKn>1{trg7}3H%_nJCVIe&$l^odC-&uWh$ej-$E-dB?EuFk zh^p}Q&CeDSnRr#8`2F1M<3zOUM>T3uxA|hKCxyqFT4u2FV-z;*P*^59J8Js5uw(~j8^?)BK!D3U6nVVcmAD<5(3~hu?~2m zjhzYdsbe?Av7$j=$33Vs(3m#<#bb{jpEUoWSiVRg3@wtOV{6{fC;o@FB@q>$=(T}#l#>LXtP~06PpTnq3q_oCmQ~en-fFz#a$N1xIW3T*s(_$kesA# zi40G|YwJ3As{SsmDMLa0k(pjV8w{ScfulZT>K28LueBS2Pl<8rD~Qyb%~Vj$b{iBv z)#;D+cwpgzy|IBt62uFyp2I`?U-5NTnuz7T6Bff80xf>w70pg3K-1fUHk8&h$O@9u z0)y)gs-X`e@(TUM#s9c$VZcIxmTsgiI*oi=mt~(5;@p{Gd63e!dCw>jf41`-P#A_t zuKC_&V2_IqN*BW7&J_P4fBfspUO`FXtL)V^#7y#|7sWf51$BaAS8-8`JsKZhBIEP= zx0tS~1KWcvw?*G6s+gFwR8?UNOdT9fBMLags<{1e0s|>n3>4dwtUn%3-xsJ$F>}gnBc`Qt_n~-|Lt;Yb`NLG2H?FZ4^vV2*+H8^fRPkH`S8;QV;xG+^+Xq{(NF7LLTBP(D#Jcr zg{|l=BG}@OOP}BRVQDpTesPCAVR=(2Up!1p_`{o2c=ZPu}6GOrniO3th8NZ zn_ION;<^~1=yK2r0q|J0>@Co?+mbs3NsAhwT~Q_TAYSBbNzG}(#BEFOSerA;kZ z-9d8ZGFimjzs7BzwrLc`NCB1bR^O9rDg+57_F~~J(^zO^qL5?CXgcX4e3AAfR}8rh z?&b1lTr1`8T=h9{-_Qy=aRkK6 zOBpc_Tp&1CMAe5$b!me>u0VovBqk&S3~vvUY-^=hM}6KR(UgmzoFH)qr*kQLQq9$^ zD>4KTTI;ny*Rg?MZIa$0a$WOuHVW6_*_o$x)Z;L-^PZv*XbbTM1Nh4i5U2LPGnjfL zzQe+S;L&51)A*SVzKh;KAJr_%R~haD&Q|wbEXfw+OQ9VPu^Vjlf@na&^2p6h<|nzz zx~FH0fpfkdnsf8>9L3$GcV>6@Q$z+{E=ftccrz{5CUWLP;exl)olh!y3lSstpKWl0Ztv3?y%2u5vO4$4YQpA-4}L)28J5VLbA zKA+NDWQ_}W^KRv-DK+ELZ|MEjG|5+Vl=QlJo9avUC(;NdMpBQNYubtUFs&fb9H*s; z{IECa1oLML^w41(;{&V3Dx$UXp?7CKMoWJ^n)p#kN{;LAYa@B`dMG-f?*~;_wzjo1 z;Se0cGd-mE3U;b2B)bhGc_qb%RfzAyg?oCACGRxnG(t;iaRt8EjC|HyRbCWr8R{h` z+a0<9R2>`mbyawwMQ9Cvl7C)Ps5P)fs;Ak-y4-TnLAK0X#?r24C3?h_udS0d{2*j1 z6j~a3J_QznlF)59x>NTcwWQV5a66l<=OWs>{Jc7=A&l=ke6SB^bPH!^>XZDTJKpJC zpw*~*fVr-(qIn(pcVIaldRy%C=@kkjWW3tva|H`f#SiU!(hhI;9YZUZFHw>IS;NBf zI^?@W!$AANl}4@nsPGr)7?k}TaY)B?-3v)rnO618{?m2SSBt)8*@&vpZ~EzUP4uP` z*HAqzcBBQXU`0#`-dMmzBd!_|KiNWUtJ0wwSdo&&vg8j2tIbYmY@3V8ouT1f{i%2_ ztg&|R(mK`fe9*lO(qbgrW%(fsj3XmL_TvY&RtppN4A-!6M5FdOdV64#YUSe86)j|8 zqHn)m-GeH74mX0ok64r(IN7WKg#@IBDBoB(P>N)cjnGJ^Gwd16AiH zerdf%`wq=Zl${_ltY;pN@p{_d{{ zL(BQ@6ALU;tepzrf{H)zi{c>#y&QKQl?Ynv@;;7toWNL zAS0UM1q>l;s7{!X&aH#pfW>fx56jqxU23rCLMh_eCLHL!oJ+Fpv<3sZvMj*J!oi~( z#Ai~7G%~;+8WZ?oUxX)2K$2$10TK!d$VwbURYk5#hGhWfFS>aWw-!47v8Z+L5g4 zGlqfZ1wItXl6gr@%j~xFWQVF7NG_E;KK6F(VfV)hl;%(175;E4J|}z{1#WH`mVh~n zx6Sr^bUOaeH)`&&xt}1=bd0lKAPL$gF@(w-5D64D+CB1oXp>nI=olBh*--KXv%&7% zT^3w+y4=!Uu}R#&$mFi=Uvo%&C%Z@i zKX+joNaboqO&=O%AV*!kSr5pn&ZX%UMSIh_vyELg#Ie}sW{>F5Xo`{f#6-5;9zR~V zwYD&2%6ZlstSax`ARFv9RsNn1lFV)pnGFs=ONglpV==i#?2lV!+Zup+^cqgsu8p|) z>WqBuHFjbUx&h&jT}bFU-b#oa&X2AHni&`09t3J$di7-={x74Tq(E4$aIRFNUCFM;Gzweb0Il&T`JOZImy%)EsKZ=I8^jt;33ey;3`FHXirWLQx0b`zQA*!+{ zYdH%v4|<%Zk10p=5hFhxV?g{nXO*@7xtLGUcZC!4)2wVvu|Db|Rf7aXv6#k9wK_hW z8Wb*Mu=m0WEtjsdfpBYz<4a_~Ilae01g;u=&$L1tzIlmMJ?{rWB0{6YJwmX&hpI!m|25rj3)+s|FeDjC#t?9-LY|Bp7rZ9V5zrh+L#0 zaN=LX-&_+O^=a8I<}-d-8^8kdhl^70KFcFy&g1~MgU$!hB929zir*M+-EaLGm(y*Z zo11H(H#2v6S(k05iIXzmjOm(C0MQ|CJ7#WjFAXs%d^X?(%+e(tCqXHQ`Bauh0ec4@ zlE)g3>!%=ijYBLa%GWXm8%eisD$<1{jH*@aM3KFJJr&eYiGKyPY8eY;rusRI_D>n# zGz|8&dJVUMrk@{XW6-pxAhO5wDuL!akk#dZFF~qKYYD{UT<^O15u#?tyI-kfsnKeB z0tGq*(Jps#rlEjKf_+6bKhV&HzjmC^<5F(%TZoJS9+65ToGE7uouE(>3B4Gm-jakK zygU@VHqWJf=k_9*83zZdnKZ=orw55SjewMO37B4RQ2T>xn|j%{cSLs#6?#>}pwb#s zM!`1%#Z!=#{=!8vp)eR}Qc;fM550~hDVzZ6zniX#-X9?`AOhJBX849R*c4$;9bSB< zY8k8rEx$2b&%A5((g4@rNd1XM_aMK}ce-!v(2o_~j@8_h*Gj2Jq* zOH*~fXkNRX%^*HtdL~4q-0k}|w&7`|hU(<+MGSXE=Tmf$aA5rQn* z!sDg+mL^r8Q=L6A6SNd5NeFNR18TF?knN}lX2j1YiY*%yq^H5XVc-60I{E(hF3-oR zAC!R7OZ_ZVVVj7cZs2OtKLyOX0$pka?PBL)#N3sNN2g&Jy~r(fCO+uSS@kypOxWCz z@pl4Or1Q zRh}d-xFK!bBrMz?*Hc!i|x)Wm@VZKdfz1=A_j)HBX6c4NxQ3_ zT|_7ZMiXqaDC@`;fZl1P_r*|b2*th%{coDK@2h+dGBo&hm4Ha9ieEEI&`Xqx1oiUjH78&Uv3MQYG}~$T8kozpdE!Xk-oWhfu1=rhpT_I6@ylmsPWJ zKoV^JpH!M&Py1A$pH#tMH%av04rIA9&HT<>IayHaBZHDVJp!{+v(lCs+lZH zIqp^PJ#JK?uk#C2@IVb&9n;!rY+ROIhlVOe=nmfL9O;r97*Dp@{gD-E<`)pe!ubXM z$8+t4wLVZkWE~M!pvwllLXRahIZnOufH$Uiad-TkBU`v79CSO@qF-L2D5E6Lz(^r0 z%yj?XyDS!TG-&689z>7?uq?!km5$TJ^>b{XjMYO(6HZelSu_7Di0 z9_h$*&kjb=3|5ICBDDl3QgQ3T7%7|O364aXWpOQ1ECtR!tab)>97dgH;IbmDEcdxj zZ#&c%!LAnDJSGI!$IW|cT}Z!uK(=BoJK>h0|9%b|ix6@>d`7`2;1!%gD*cT1LJy+T z?ruA-J`6cj$fNBa*Kjv1E><;XpNdZD1q)%&z{oMS z)DHIA`9|c+(r9s92qZy5JXwit0;45rIKZHBH92n`gQqG5W`SGXxMy&?493}(&E(;} zcQC05of4v+(F4&*l6Ny}jRJL!_S4{0TLi1`8HKbBLZ<7F*Sq$z;o7MDuepmdTErJ% zK9+LDy+d{$x6L^^0+W}w+!d-NsC?yh@NqL(;u5KNXC8Z@cnI`sm~?Vzk*1Cj|G|HQ zFh+AJk&(2scX=wk~meHB}cbzIicFwvQS5eEDZ49t!qWm`Ey z;=Mpc5^7k|5rD?XV4~O4tKh2EDO(XG-H6$fIS3{VS&jf!48y>AZrgr@TEV=O|JCN? z3@TYuPip(n<#>>pFLAb(mbd-Pn9Hp{xc{X!kt7y!2y9Nt%tDbqfvV4!v()p=aJp+M zmlz;tiwn>kQ@7IhYgYS)M^u6tScg8ObgWL0y<4Rwyz$P0@Co#3+9;4CL{~UZ`l<`s zVE+eG)icnp+8ZF5d(0JYU?U!^6{OgKB$;1($Fe5qch?FrKouGGe>0ZlI=c5XofkTX zH&&z79fTW_J#!myb`quK<@DJh{!zz$ZuUmi!-nTX009W~Ex49GbQg14=9Uo!EfVgJCzWt2;X!LLr9Y1ZkteCnon$fG5rPPf9~2jRZKE5w{d|Fo~i z&xQfO;;19q9?#(^=o>$eXb03SQ#YxICq2|rFK#`x5y4R(e6i}M7v5X3P39KZKD1iQ zsm*Vl&FK|og|;)kN@95#3cdGb4A*JO#4OYlMTK}%bi|yH&mG|WNzS(eY2n^A01-rUU%qm+*y2)qbqv+$332&zI4U?1B zT|)2_Z-Og8Nc|Q+TnUzM%3_q>%m4GxR=;8Jclp1E9&InU z5H8K_D~5cu81-D7+o`Tt!f28F46$*jso^3Ou+72%OM$`= zDMCHGXFnnFmm1jvfPPYH^Q>lc(DhmK-z#O0QHK6bR83CVOqgTVbZ`1i)eo);`PaUA zD73NM^#yXXR1UjxKLlt3^V=GdyPgsbTC$4vbSIS!P<#PD0-6X7*T`r*t|6v$jVqpx zLva+5H5}SxSu44$pC0Y|zGxM{$20-hIoJ@0}fyOU}BR5%|{+=rRW{ zT;7_uO*zK6gWR#Jq2OSkBvyazV%Y0xFB6zpFV56*(3}Fq7<-<$=y!qAaxHXbrwRI8IF!g2L-ZQ2nJvVY#F2ADImxZim6qgV|{Gg7I9a%#)#_bN7)sbDy1J z8oY0iNzzYT=nmGONPKu^&f?Q2a4RzNBR#1z>di7uah&=e?%UbP_m*2AZjq;UlbbQR z6V&*TjGH)({UtqQxBFwGVKV-cucTP(T@&+%%1m4$2 zFxjy6Q}6`=ccIbESH;I3^J}PUTd%S6%L{2j^$$@8;vgIZ9&?`fX7*;XVY)QswI=?N9 zYg*3TQMQ}F!hg5eOfrQy?hm!u6H0B7+8!QG?0)$zkuk*cy|VY|P9`+2pTNM`HpT1& z!!|tu?*a3)?5$@7^~9Dqu$-OZUY2_L!Kv!j#0zwbDqq|Vl_VwFD!F@m2;EsV`c7&f z-%=&0tKi)o<2kY>g2LP`aXwXvQ7_A4P@6er{a%qr-<`x?@cJ^_2`w3BnPY_I%(F)|!=13g4^?ACK6|`jHH^v<;MGQ1a;Ir1_E7;8 zDZtv{iREHLp@Yj;W*u#TzIbqs0;^rEpsH5e7u7VEn*L(Ok;YSrh9`OFz9WJ>Iq=A< zWLy|OkM%j%#W953`xEw|t>(O;7*kh%H6pP<8}ekj!U*jkgM4GfH$eA)?T&yE2B5We zo+F!%J_q=zh<%v`YmxaE6LiT{hMH2J&vSvl7-X1sdbh*oIq*S7?^0Hn9I{ZK)J6Z< z8$I1AaDhMK!u{mN)m$10-LtuUbRJJ8<(|JIT6JT9{5AwQ#r7~kWKlr=yVd4L`M9FA z?Ahn0J1Ww9W>`K+i-MUU3hVLx89^l8*y5j;hR#A|nZ|7(9Y*Ml1t*8HEqzmiQ6+Vo zdhj}V)(j4ho5MWLbkZy%^RgmpombYj4MJap8(C-0-VUgK&3`2HsJlUPU`9}SvKhDhIgvk?Fsr8fsFUtV+ zhwd-4d05VVID5)Kqm1&6BQt1MG+;fU%Gl773;ahmCBkxE%YZW7`Z^&&*ax-ai&8$P zfNC<$kkjEvtf`yg1?~+M)irh3f#9jhlV%uIU|vV~99p6!wPgW~2(C)yM#c8UDA99t zgOij8<;!!-{L|h&%a@xDvg3lQH^IgtjL8I2cuxkvCUy){scwB`yu$4bm6!vvdwXeF zE3X_@CG!+Ix>J6Rb=tnb*&^2nPesTs99bg59mgR}y@vnlMVd*uW7(>m7UN|cP_iv+ z<+nc{o*QgtSf>`v)W$w)kkuFMD1-!xf;hB7u47@m<7v$Q3EH&ozQ_io&su%nsg{|c z%8dh~Tl?qIjM@B#&gv2Dy$$y~M(h(CpqZ7YxdVt3C5LJat-xfF5|Ab&-kp9`I~ zryab%@7|D5p%4VbOUo3N-t87c6#bK9LJ&OecAHiwcJzF^)4zw+4caKE?&^jYnyS+! z@U!*tXW-n>rBZKa2+=`NvzVJZ-P6G=`Oa?%$K zJO#j_onk>+EZ>W`&GU_xKy_+|dwj|OUjqtw5ic{sy?tbI#jgwzlz)fiNSM!@W!t|+a^Tx>XUKVk*;i_D$C79)QxvMIs%v~O+8 zVTH?UC$ct7_P0XDkJ*Q@PFVjZ`dU3Q4Q(d@K4N=%r?#4Pd;e+1fh#8Hk|8iEdA8hS ze2X-uvK6`MD7j+yPDM&FIcM2S$&wJ_m_VSC&fnu7f$!ftTy#c7{@le|h4}{A6kBQ`)!zfBh(?c*=KF}a%+4GN{7v;& zA@3lxX;o|{7z|h6i^yrFyrN>j1s|hOX6SpUc`9n)FmXj#t zX*Wj`?Yws`=5bLEwqCTSgqYiS0~iZY)wTzB*j?9^z1GZYva^gPx9V_NQJIqfDIwB| zRL;15tvD@Ugw~gp(iTd=ry{S^tu>-9PE+uW#FaUAv#FjPjF5p&g;Q~Ow^8P&{|XXw z1HCbYQ5h*_B|^8X<0TO|dr1tO>g)aXB-QZ|oUx8X>s43dPCfN#^+6SgTVVpQze-}(u)Si5lfU+xm-X@z4SzaG3TX|yS{^fZ zmA}wu%u(~WZ!3{BE?5x*E$ZIy8-c$@cW#z(;lJ4Em3beQV2*yA& zFcZhj2UU#9+g!GTCNbYuk=(ESF5<*^NFh7z&tSDlW|-eX{w!UNM3fMsX$tq|1Zg_Q zvAh^6RYBUqLB<*}52#>jXx&=;SNE5&F`3OtY+Jur6qyL|> ztNxCdZZp?+35w<*5@rU67`iP2Als3yx48^dNAGGE4aLKI2>8lUzXaDz;i?p5#HExB zZD>4*D(I==U7m_IJ0F%9U300XYLAQ^}oE@NsHl*I6Ng_b|!D+FsT3IoEOdJV4i!+1W)kg(n`lKWr`J z@BRA3u2%#~zJs;tKyuImxdO~GDw>1%@g+qcKodztq@EuWI7c$m5@CzRp2M#wp&odA z5?rI(zaW?&UCTmOANvHjRXBQcHca)W;ycej@HjP_e&qC4e(x1~rMtPy*WJ$NS-qIq zj090TzpO5PL9{s0MJbf-lj$4`QxlU%9eoO#9ClYe=qq%yJ;8pm5j?tE8@%odVv?mG zeDS0l25{sKF(%R;p9!hciK~`1frnyl_yhNbSH5XFkRAj8E%ye-i>&9DbFl4kFGnfX zG$)o}`wXb^g^zsH?Xx*ZG=IZNgk?`~n-7U4QWhk`P5TvG|M;PnC4yO@jumhVT?1R6 z2CAUFfSt~NHiJ2@i}`H*bL3}{9wv4z;gu79cVXUUE|C)KVC@%&>FYXO%d-#6V|i9I z<;P$hNLo(xF+CVqL$0n3bUP)=wotlP1bhbWl6&YYBldk*eKnwuIUW?pv%^h@i`?O? zVR?(=#>xO*4<&J5+PQIuo8DQff}o)>W5_}J-a9>aJ$nE2N7?q&P+r&-F1k$TdC^Oy z>xY;a4hI=8*ccPiY&~XHXhvXzt6aY=_LSQNPev0}%hjSDcoerz;g_eS9cSsUvFn^~ z)x5*x?_Ci+A=k+=W<6Xui8_RjA)}cPk=OC+SWv7CUov@x=h?u{?^hcUN$eZZVJb*l z=CB#zMRtqTr?udi@Diw4TZJ)GO5Vv=?tIp@K8ukRR zN;Nyu|AHB_6GK(%7a>gyl*86+g%cZRhiCWT(O9u*wzUt)Y5`Xd}hs4Zhg`Dl$;LuJ(XCjqGq*qHyv` z)Ghr?c&qM_>k(Ky=}SlM9omz&SZpFu+^vA5%H4TF;{2PV@7HWY+ppMi-`%yO)fGU8p+H>kBwL};&@>?9I)BM+>zr&R~y53l(Tm^@0 z)fh2-tRHG56_^?`GG+o~GVzxEYUbnK6&Ew|hCJE2t~&*qdU7Mt4zSD$O`tJ+_KlJ> zO)l+%XH(+Jc*@tLrNEpRO$|J4f{6RA+S*PB@#c3^Esv=YuMOSGnwM%~cm(_j+X8nH zWFFm+cw&+7XLm*U?4y{9+h19ARxRsG>V^wwlkxAsv0?2 z*Q_^Xve@ls5UU_&Q6zR__@ji`SgjFemY^qZ9JLzqSVTWb$a9wQ)wo7jpA!-Pp8e%8 zt+F8J*P^|S9_pLY`X(t4AwpmcVE;j7+O%*RL!ZlUrEMc*XD#ug|f zJ#EKCSmq~Lz}RgI>2@zg0X2Hy61_$lP7w!xijGU*WoPy9y%TKFU3~)}tk9G@pfl3e6c=hqh$ix zV!o!j6q%n)po-}C%sxRgIzWTLyB8kjS+6^I4W>y-#2pv&U|UIcdPBAl5iz|gmS|*% z&GOd;P z14qPPs82`orr}N4La&BmbY=!5H+7n4JCqO#Q~xRUHH5wUF0u#Q$=d! z$EdVpBUrZ4```R8A% zCHkQ9ujNp4KB9^yN%u)j^Wm`s;{6@MWg?kVB2ZoF%(FsIaCQd{I%;tnQkGNzvjrSD zD}_@kj+L7=szp;)xyJ1a zf;z57!qEh+ay@pgX)dqrlJ1gFle`1Fdy)}s)R`%8V1#+aeYeDMJv94cR2{F)qYUa~ zICf8#?WBb;q_>(U|7*B|0#Q9)rTH(}aU@NLmv$`J~337^MZZAw*CrBscOEv$%c|GGO2bX@xDm>&Vz0 z?K@IJX}+DTuDX5R7$rpi^_(yRYTj!`sDMNNIx_ch$ki+y6kel4t&xiC?Hd_AoHHa& z^I@tWDc7vK>JsI|6@UCX-lfrD8c3<7Kj>OK%s$RTLjfB(fv1#f{&IBz5X~?56$ziK z8iw_;xHmf%VmcP>3B5M;DkLH;M6QO5++S z+{-P`z9w1$ru;B)UCiynFo)<>l#%`_77PQ3b`G;`bE%gs&=fdLw)40+kIUOM6NGi( z3hjgmJF*eniGS+dva}ohr&&S`@?}aR5F@!N2ATl7M4ohL^5XXGHuNF}?y(YReG!^2 zy1#g0wfNZYw9IQw(FR4ai;AI{B|XjqYh-?jyEi3}x&b3e&p<-}F6iC}*G-wXgp4D~ zvq|c1F1mC>E_sz~)@3e8A9#WBdX(ue?Pzn=Ed^U=9gF)>cM;SZmzu^`!G4^}I<)}k z(iE*!(#geDAUIL%e}QG+ilJH8dVf*rfd|`(=4>R#&f?%-Aw%&<$1>)iU&!b!!e_V^ z>=riv+Ylu1fc8(1#Tx}RD82L>3f|zK73PUDve@dNln+R+>61|%ll>>cJe2tAo1Y;e z2|O<&&PFstRn$dho~1kp`CrNq5p@%4n~<)a`$3NZfB__o1G_Cxdab>IvWwiI!&^mE zcDl-}fL7Bi05*j#G}D%vU`*2O-qWDIlru2&!F%r9zvn;viHlRV0v%9T&tK0L&sW5K zPJJxiv2?zo@^+Ch@UDv{-Prkip0x$T89{;9Q59G~q%e{hk8=4HPJlV^_Z^ge+sv`lVI&j^zW>|V z6IesI10P$?wP9WG3F7d9xH)n;(|{CMt#dPwL{4$4IMUacAZ4B*?VWBp^)L6@RV=}$vGrg7@js? zz5GP)fmJV67W@BED6HicU<%Ul7$jh2L&od7YFsXjS^H<$D9aU`%gashptztu*YFQU zQ77cKvybbwb3rPCI~Nr81UkMVFxAu1km0z9eGNe3aS z2;$7(4iwYJ^fPh5b6zUJ6H`l`d(0Rl>x{6=`%t$-Bhq=MwkT1Z0zM=SOspO#nq-15 zX4qGvIZNK7a7f)bk;(p)!>tmanz7S?XOGxJy=D#ow8~aXn_Tv7Li0T4|KBPvh3+3h zNFb@9%6OGojmm7hYH2I$52ds!%07;Bjyho1`*1=(j4DNAyDKtc*d$sHX#IeJT$*VZ z;>K}$S#m?Nt_aLBg4_lcl=)`8FFIw8#mXTd^mBB8bfYJ}W~&cCRr zs!Ft*8jYy!n%oq<9zV_xCi>Q0;XjJ^FuCUxi)7PpqLvSg#QgEmIDaabU%!skAYl|C X4!;Bd006&;XZET8)Wkh|06+%-!{V;L diff --git a/source/Version.log b/source/Version.log deleted file mode 100644 index fa9f5f3..0000000 --- a/source/Version.log +++ /dev/null @@ -1,2752 +0,0 @@ -*** For older log entries, see Version-Old.rar *** ------------------------------------------------------------------------------------------ -TIMES Version 3.0.0 ------------------------------------------------------------------------------------------ -Date: 25-Mar-2010 [AL]: - Bug fix: fixed reporting bug when both SENSIS and RPT_FLOTS were used - New Features: - - cumulative process flow bound equations - - cumulative activity, flow and commodity variables can be referred to in TID UCs - New input attributes: - ACT_CUM(r,p,y1,y2,bd) - Bound on cumulative process activity - FLO_CUM(r,p,c,y1,y2,bd) - Bound on cumulative process flow - UC_CUMACT(uc_n,r,p,y1,y2) - Coefficient for cumulative process activity - UC_CUMFLO(uc_n,r,p,c,y1,y2) - Coefficient for cumulative process flow - UC_CUMCOM(uc_n,r,com_var,c,y1,y2) - Coefficient for cumulative commodity PRD/NET - S_FLO_CUM(r,p,c,y1,y2,bd,stage,sow) - Bound on cumulative process flow/activity - -Modified files: -INITSYS.mod : Increased version number to 3.0.0 -initmty.mod : Added declarations for new attributes -ppmain.mod : Moved definition of MIYR_L from coef_obj.mod - Added pre-processing of cumulative parameters with BOH/EOH support - Allow STGTSS conversion storage; can be enabled using a multicom-PG -coef_obj.mod : Moved definition of MIYR_L to ppmain.mod (cosmetic move) -mod_vars.mod : Added new variables for cumulative flows and commodity NET/PRD -eqdeclr.mod : Added new EQ_CUMFLO equation & changed CUMNET/CUMPRD equations -eqmain.mod : Added new EQ_CUMFLO equation & changed CUMNET/CUMPRD equations; Changed EQUSERCO call parameters -eqcumcom.mod : Changed equation to be "slack"-variable based -equserco.mod : Changed handling of call parameters to facilitate cumulative variable terms -uc_flo.mod : Added term for VAR_CUMFLO cumulative flow variables -uc_compd.mod : Added term for VAR_CUMCOM cumulative commodity variables -bnd_ucv.mod : Added control to clearing of free lower bounds (GAMS tweak) -mod_equa.mod : Added new EQ_CUMFLO equation & changed CUMNET/CUMPRD equations -rptmain.mod : Changed directives to be case independent -rptlite.rpt : Added reporting of VAR_CUMFLO levels and marginals; fixed bug when SENSIS+RPT_FLOTS -spoint.mod : Added initialization of cumulative variables -solve.stp : Added/modified the hadling of cumulative equations -initmty.stc : Added declaration of new S_FLO_CUM attribute plus a new internal attribute -prep_ext.stc : Updated handling of S_COM_CUMxxx attributes with BOH/EOH support -stages.stc : Added processing of S_FLO_CUM attribute -fillsow.stc : Added clearing of leftover TS indicators -sensis.stc : Added update of bounds for cumulative variables -rptmain.stc : Added reporting of VAR_CUMFLO marginals -solsetv.v3 : Added reporting of VAR_CUMFLO levels and marginals -eqcaflac.vda : Add TOP control to storage case to support conversion storage -times2veda.vdd: Added reporting of VAR_CUMFLO levels and marginals -times2veda_stc.vdd: Added reporting of VAR_CUMFLO marginals - -Added files: -eqcumflo.mod : New equation for cumulative process flows - ------------------------------------------------------------------------------------------ -TIMES Version 3.0.1 ------------------------------------------------------------------------------------------ -Date: 9-May-2010 [AL]: -1) New versions of reporting routines for ANSWER -2) Added new parameter G_OFFTHD(ALLYEAR) for defining threshold for OFF ranges -3) Better handling of cumulative constraints in stepped mode or shorter horizons -4) Added support for reporting EQ_IRE marginals -5) Added support for IE options 4/5 and constant labels in filparam -6) Cosmetic improvements - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.0.1 -initmty.mod : (2),(3) -ppmain.mod : (2) -pp_off.mod : (2) -filparam.gms : (5) -mod_equa.mod : (6) -rptmain.mod : (1) -rptlite.rpt : (4) -rptmain.stc : (4) -solve.stp : (3) -solputta.ans : (1) -solsubta.ans : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.0.2 ------------------------------------------------------------------------------------------ -Date: 19-May-2010 [AL]: -1) New feature: The N bound may be used for identifying a MULTI multiplier for horizon-dependent cumulative constraints -2) New feature: The UC_TIME attribute may be used for defining horizon- and period-length-dependent RHS constants -3) Fixed small bug related to cost reporting under the SOLVEDA 1 option -4) Experimental support for using the LO reservoir for CH4 and N2O -5) Other small improvements - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.0.2 -initmty.mod : (2) -ppmain.mod : (1) -preppm.mod : (2) -filparam.gms : (5) -coef_obj.mod : (1) -eqcumflo.mod : (1) -eqcumcom.mod : (1) -equserco.mod : (2) -rpt_obj.mod : (3) -initmty.cli : (4) -coef_ext.cli : (4) -equ_ext.cli : (5) -sensis.stc : (1) -solve.stp : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.0.3 ------------------------------------------------------------------------------------------ -Date: 24-May-2010 [AL]: -1) Added new feature: Support for dynamic process-wise equations more directly -2) Changed QA log to display labels in full by flexible fields -3) Fixed MACRO support -4) Added default COEF_OBJINV values for all PRC_CAP -5) Performance improvements - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.0.3 -initmty.mod : (2) -ppmain.mod : (5) -eqflomrk.mod : (5) -eqmain.mod : (3) -bndmain.mod : (3) -initmty.vda : (1) -init_ext.vda : (1) -prep_ext.vda : (1) -ppm_ext.vda : (1) -equ_ext.vda : (1) -mod_ext.vda : (1) -rptlite.rpt : (1) -rpt_objc.rpt : (4) -solve.stp : (1) -times2veda.vdd: (1) - -Added file: -equcrtp.vda : Implementation of new dynamic process-wise equations - ------------------------------------------------------------------------------------------ -TIMES Version 3.0.4 ------------------------------------------------------------------------------------------ -Date: 20-Jul-2010 [AL]: -1) Added aggregated calculation of gross benefit/cost indicators (GGAP, GRATIO) -2) Added support for one-sided storage flows in commodity-balance equations -3) Added support for FLO_SHAR(r,y,p,c,'ACT',ts,bd) for timeslice storage - -- by using upper bound 1 you can limit the output flow to the maximum discharge -4) Added support for including storage flows in peaking constraints (using PKNO+PKCNT) -5) Added reporting of dynamic process bound and EQ_IRE marginals, and COM_AGG aggregated outputs -6) Fixed use of FIXBOH with SENSIS/STAGES -7) Miscellaneous small fixes and improvements - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.0.4 (e) -ppmain.mod : (2) -pp_reduce.mod : (3) -pp_lvlpk.mod : (4) -eqcombal.mod : (2) -eqpeak.mod : (4) -eqcumflo.mod : (7) -eqcapvac.mod : (7) -pp_clean.mod : (1) -rptlite.rpt : (5) -rpt_objc.rpt : (1) -rpt_dam.mod : (7) -prep_ext.stc : (7) -bnd_ucw.stc : (7) -rptmain.stc : (5) -solve.stp : (6) -ppm_ext.vda : (7) -eqashar.vda : (3) -times2veda.vdd: (5) - -Added files: -cal_stgn.mod : (2), new version or cal_stg.mod - ------------------------------------------------------------------------------------------ -TIMES Version 3.0.5 ------------------------------------------------------------------------------------------ -Date: 24-Aug-2010 [AL]: - 1) New reporting attribute Cap_New: lumpsum investments and commissioned capacity - 2) Improved handling of fractional and negative ILED - 3) Added support for referencing capacity commissioned in period in UC_CAP - 4) Minor improvements related to cost indicators and performance - -Modified files: -INITSYS.mod : Increased version number to 3.0.5 -ppmain.mod : (2) -preppm.mod : (4) -coef_obj.mod : (4) -eqobjinv.mod : (2),(4) -eqobjfix.mod : (4) -eqobsalv.mod : (4) -eqobjvar.mod : (4) -uc_ncap.mod : (3) -rptlite.rpt : (1) -rptmain.stc : (1) -rpt_obj.rpt : (4) -rpt_objc.rpt : (4) -cost_ann.rpt : (1) -solputta.ans : (1) -solsetv.v3 : (1) -times2veda.vdd: (1) - -Removed files: -solputv.v3 : Obsolete, not supported -solcostv.v3 : Obsolete, not supported - ------------------------------------------------------------------------------------------ -TIMES Version 3.0.6 ------------------------------------------------------------------------------------------ -Date: 30-Aug-2010 [AL]: - 1) Added New UC_ATTR modifier NEWFLO for referring to the flows of newly installed capacity only (vintaged) - 2) Changed FLO_EMIS to be more general, supporting flow relationships between any flows - 3) Added a currency conversion utility based on user-defined conversion tables G_CUREX and R_CUREX - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.0.6 -initsys.mod : (1) -initmty.mod : (3) -ppmain.mod : (3) -preppm.mod : (3) -eqptrans.mod : (2) -uc_act.mod : (1) -uc_flo.mod : (1) -uc_ire.mod : (1) -pp_qack.mod : (2) -pp_prelv.vda : (2) -ppm_ext.vda : (2) - -Added file: -curex.gms : Implementation of Currency conversions - ------------------------------------------------------------------------------------------ -TIMES Version 3.0.7 ------------------------------------------------------------------------------------------ -Date: 4-Oct-2010 [AL]: - 1) Changed declarations of Damage parameters to circumvent bug in GAMS 23.0 < 23.x < 23.5 - 2) Fixed small buglet in fixed costs for Case 2b, and in alternative ALT and LIN formulations - 3) Amended the calculation of IDC in Case 2b (improved accuracy under changing discount rates) - 4) Fixed reporting of User_Maxbet in UC_R_EACH case, with reference to the regional Max - 5) Cosmetic improvement - -Modified files: -INITSYS.mod : Increased version number to 3.0.7 -ppmain.mod : (2) -coef_cpt.mod : (5) -eqobjinv.mod : (3) -eqobjfix.mod : (2) -eqdamage.mod : (1) -rptlite.rpt : (4) -prep_ext.stc : (1) -rptmain.stc : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 3.1.0 (e) ------------------------------------------------------------------------------------------ -Date: 8-Dec-2010 [AL]: - 1) Added support for Oblong Objective Accounting, which improves STD/MOD formulations - - Set to YES by default when MOD activated; disable by expicit NO setting - - Can also be recommended for users of STD/AUTO - 2) Full review of all objective formulations with small additional improvemenents - 3) Added support for LO bound availablility factors - 4) Added FLO_EFF as an alias for FLO_EMIS (supports now any commodities) - 5) Added support for using PRC_PKNO/NCAP_PKCNT for import flows - 6) Some cleanup of obsolete stuff / cosmetic tweak - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.1.0 -initmty.mod : (1),(2),(6) -ppmain.mod : (1),(2),(3),(6) -preppm.mod : (6) -coef_cpt.mod : (1),(2),(3) -coef_obj.mod : (6) -eqdeclr.mod : (3) -eqmain.mod : (3) -eqcapact.mod : (3) -eqpeak.mod : (5) -eqobj.mod : (1),(2) -eqobjinv.mod : (1),(2) -eqobjfix.mod : (1),(2) -eqobsalv.mod : (1),(2) -eqobjfix.rpt : (1),(2) -eqobsalv.rpt : (1),(2) -mod_equa.mod : (3) -rptlite.rpt : (6) -rpt_obj.rpt : (1),(2) -rpt_objc.rpt : (1),(2) -cost_ann.rpt : (1),(2) -coef_alt.lin : (1),(2) -coef_vc.lin : (1),(2) -solve.stp : (1),(2) -rptmain.stc : (6) -initmty.vda : (4) -init_ext.vda : (4) -pp_prelv.vda : (6) - ------------------------------------------------------------------------------------------ -TIMES Version 3.1.1 ------------------------------------------------------------------------------------------ -Date: 5-Jan-2011 [AL]: - 1) Fixed small bug related to reporting of IRE_FLOSUM flows under stochastic mode - 2) Changed to provide support for using explicit zero discount factor - 3) Small performance improvements - 4) Fixed small discrepancy between code and documentation - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.1.1 -initmty.mod : (3) -timslice.mod : (3) -preshape.gms : (4) -ppmain.mod : (3) -pp_lvlff.mod : (3) -pp_lvlfs.mod : (3) -coef_obj.mod : (2) -pp_qack.mod : (3) -init_ext.vda : (3) -ppm_ext.vda : (3) -coef_ext.vda : (2) -pp_actef.vda : (3) -rptmain.stc : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.1.2 ------------------------------------------------------------------------------------------ -Date: 14-Mar-2011 [AL]: Various small improvements - 1) Small improvements to peak constraints generation; now possible at any TSLVL with UD-CG - 2) Removed superfluous RS_TREE entries for zero YRFR timeslices - 3) Added support for re-generation of reports from previous solution as well as entirely fixed horizon - 4) Added support for using NCAP_BND(N) for (re-)defining PRC_NOFF ranges - 5) Added new reporting parameter Reg_ACost (regional total annualized costs) - 6) Fixed small bug when using EXT_EOH together with interpolation options for CM_MAXC - 7) Fixed problem with using zero probablilities for some branches under stochastic mode - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.1.2 -initmty.mod : (4) -maindrv.mod : (3) -ppmain.mod : (1) -timslice.mod : (2) -eqdeclr.mod : (3) -eqpeak.mod : (1) -mod_equa.mod : (3) -spoint.mod : (3) -solve.stp : (3) -rptlite.rpt : (5) -cost_ann.rpt : (5) -solsetv.v3 : (5) -initmty.vda : (5) -init_ext.vda : (4) -rpt_ext.cli : (7) -coef_ext.cli : (6),(7) -rptmain.stc : (7) -times2veda.vdd: (5) -times2veda_stc.vdd: (5) - ------------------------------------------------------------------------------------------ -TIMES Version 3.1.5 ------------------------------------------------------------------------------------------ -Date: 19-May-2011 [AL]: Various small improvements - 1) Fixed support for using NRG as the PG for TSS/IPS storage - 2) Added support for uncertain inv. costs and process transformation - 3) Cosmetic cleanup of obsolete stuff - 4) Storage improvements: different input/output supported for both IPS/TSS, flaw in TSS activity costs fixed - 5) Constant objective term related to RESID processes now consistent under OBLONG/ALT/LIN - 6) Fixed TIMES-MACRO compliance broken due to RVPT introduced in v3.0.5 - 7) Fixed NCAP_AFC support for single-commodity storage (broken in v3.0.4) - -Modified files: (reason) -INITSYS.mod : Increased version number to 3.1.5 -initmty.mod : (3) -maindrv.mod : (2),(3) -ppmain.mod : (1),(4) -preppm.mod : (3) -timslice.mod : (4) -coef_obj.mod : (2) -eqmain.mod : (2),(6) -eqobjinv.mod : (2),(5) -eqobjfix.mod : (2),(5) -eqobsalv.mod : (2) -eqobjvar.mod : (3),(4) -eqobjinv.rpt : (2),(6) -eqobsalv.rpt : (2) -eqptrans.mod : (2) -eqflomrk.mod : (3) -eqstgtss.mod : (4) -eqstgips.mod : (4) -eqstgips.lin : (4) -cal_fflo.mod : (2) -cal_nored.red : (2) -cal_red.red : (2) -equserco.mod : (2) -uc_flo.mod : (2) -uc_compd.mod : (2) -eqbndcst.mod : (2) -sol_flo.red : (2) -rpt_obj.rpt : (2) -rpt_objc.rpt : (2) -cost_ann.rpt : (2) -init_ext.vda : (2) -pp_prelv.vda : (3) -ppm_ext.vda : (2),(7) -pp_actef.vda : (2) -coef_ext.vda : (2) -ucbet.vda : (2) -coef_alt.lin : (2),(5) -initmty.stc : (2) -prep_ext.stc : (2) -stages.stc : (2) -sensis.stc : (2) - -Added file: -setglobs.gms : Safe-setting of some global controls - ------------------------------------------------------------------------------------------ -TIMES Version 3.2.0 ------------------------------------------------------------------------------------------ -Date: 7-Jul-2011 [AL]: Introducing early and lumpy retirements; small other improvements - 1) Implementation of early retirements - 2) Implementation of lumpy retirements - 3) Added support for using FLO_FUNCX with ACT_FLO parameters (VDA_FLOP/PRC_ACTFLO) - 4) Fixed salvage reporting when both RPOINT and FIXBOH - 5) Added optional reporting of value flows for processes - 6) Added support for using group commodities as the derived commodity in FLO_EFF - -Modified files: (reason) -initsys.mod : Increased version number to 3.2.0 -initmty.mod : (1),(2) -maindrv.mod : (2) -setglobs.gms : (1) -preppm.mod : (1) -ppmain.mod : (1) -eqobj.mod : (1) -eqobjfix.mod : (1) -eqobsalv.mod : (1) -eqcpt.mod : (1) -eqcapact.mod : (1) -eqpeak.mod : (1) -cal_cap.mod : (1) -cal_caps.mod : (1) -mod_equa.mod : (1) -mod_vars.mod : (1) -spoint.mod : (4) -solve.mod : (2) -rptlite.rpt : (1) -cost_ann.rpt : (1) -rptmain.stc : (1) -prep_ext.vda : (1) -ppm_ext.vda : (3) -pp_prelv.vda : (6) -eqcaflac.vda : (1) -coef_ext.vda : (1) -solve.stp : (1) -mod_vars.dsc : (2) -equ_ext.dsc : (2) -prepret.dsc : (1),(2) -solputta.ans : (1) -solsetv.v3 : (5) -times2veda.vdd: (5) - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.0 ------------------------------------------------------------------------------------------ -Date: 22-Sep-2011 [AL]: Introducing new features for stochastic mode - 1) Added a new SPINES variant for modeling recurring stochastics - 2) Added new uncertain parameter S_COM_FR - 3) Added new uncertain parameter S_NCAP_AFS - 4) Generalized FLO_FR to support flow fractions of total under parent - 5) Added a few QA_CHECKs for execution errors - 6) Added option for using NCAP_BND('N') for defining exact process start year - 7) Small improvements to early retirements - 8) Rearranging and cleanup of some code - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.0 -initmty.mod : (1),(2),(3) -maindrv.mod : (1) -setglobs.gms : (1) -ppmain.mod : (1),(6) -preppm.mod : (6) -eqdeclr.mod : (1),(8) -eqmain.mod : (1),(3) -eqobj.mod : (1),(8) -eqobjvar.mod : (1) -eqcapact.mod : (3) -eqcombal.mod : (2) -eqpeak.mod : (1) -eqflofr.mod : (4) -eqcumcom.mod : (8) -eqcumflo.mod : (1),(8) -eqstgips.mod : (1) -eqbndcst.mod : (8) -eqdamage.mod : (8) -equserco.mod : (1) -mod_equa.mod : (1) -mod_vars.mod : (1) -pp_qack.mod : (5) -spoint.mod : (8) -bndmain.mod : (8) -bnd_elas.mod : (2) -rptmain.mod : (1) -rptlite.rpt : (8) -initmty.stc : (2),(3) -prep_ext.stc : (2),(3) -stages.stc : (1),(2),(3) -sensis.stc : (8) -solve.stc : (1) -rptmain.stc : (1) -init_ext.vda : (6) -prep_ext.vda : (6) -coef_ext.vda : (6) -equcrtp.vda : (8) -eqashar.vda : (8) -eqcaflac.vda : (3) -equ_ext.vda : (1) -solve.stp : (1) -equ_ext.dsc : (1) -prepret.dsc : (7) -solputta.ans : (7) -times2veda.vdd: (8) - -Added files: -rptmisc.rpt : (8) -clearsol.stc : (1),(8) -pextlevs.stc : (1) -bnd_cum.mod : (8) -bnd_ire.vda : (8) - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.1 ------------------------------------------------------------------------------------------ -Date: 24-Oct-2011 [AL]: Maintenance update: small fixes -1) Fixed assignment of balance type for 'N' type commodities -2) Generalize S_FLO_FUNC to apply to IRE_FLOSUM as well -3) Fixed levelising of IRE_FLOSUM/FLO_EMIS specified on 'ACT' of trade process -4) Updated SOLPUTTA.ANS -5) Fixed obsolete clear in eqobsalv.rpt - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.1 -ppmain.mod : (1),(2),(3) -eqobjvar.mod : (2) -cal_ire.mod : (2) -rpt_obj.rpt : (2) -cost_ann.rpt : (2) -eqobsalv.rtp : (5) -rptmisc.rpt : (2) -pp_prelv.vda : (2) -solputta.ans : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.2 ------------------------------------------------------------------------------------------ -Date: 10-Jan-2012 [AL]: Improvements into the TIMES-MACRO code plus MERGE link -1) Added support for linking the MERGE code -2) Improvements into MACRO code performance -3) Cleanup and updating of MACRO routine interface up-to-date -4) Imporved MACRO calibration behavior with zero Base Year marginals -5) Fixed bug in MACRO calibration routine -6) Added optional reporting of topology indicators -7) Added auto-activation switch for DSC - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.2 -initmty.mod : (7) -maindrv.mod : (1) -coef_obj.mod : (3) -rptlite.rpt : (6) -initmty.tm : (1) -eqobj.tm : (2),(3) -eqobjinv.tm : (2) -eqobjfix.tm : (2) -eqobsalv.tm : (3) -eqobjvar.tm : (2) -bnd_macro.tm : (1) -mod_vars.tm : (3) -mod_equa.tm : (3) -eqmacro.tm : (2),(4) -rptmain.tm : (3) -ddfnew.gms : (4),(5) -ddfnew0.gms : (4),(5) -initmty.dsc : (7) -prep_ext.dsc : (7) - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.3 ------------------------------------------------------------------------------------------ -Date: 13-Mar-2012 [AL]: Improvements into storage variable cost accounting + small fixes -1) Fixed activity cost and losses accounting for DAYNITE storage -2) Added support for using FLO_COST and FLO_DELIV for storage flows (Cost for Charge, Deliv for Discharge) -3) Fixed problem in ANSWER reporting under stochastic mode -4) Improved small aspects in Merge linking -5) Fixed small problems in TIMES-MACRO cost accounting and DDF calibration - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.3 -timslice.mod : (1) -eqobjvar.mod : (2) -spoint.mod : (4) -eqstgtss.mod : (1) -rptmain.mod : (4) -cost_ann.rpt : (1),(2) -eqobjinv.tm : (5) -eqobjfix.tm : (5) -rptmain.tm : (5) -ddfnew.gms : (5) -solputta.ans : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.4 ------------------------------------------------------------------------------------------ -Date: 24-Apr-2012 [AL]: Improvements into storage modeling; fix into FIXBOH -1) Added support for generalized storage processes -2) Fixed capact equations for storage at non-PRC_TS timeslices -3) Added support for input-based NCAP_AFC for storage -4) Added parameter for the number of WEEKLY storage cycles -5) Fixed small solution leak when using FIXBOH -6) Fixed SENSIS mode that was broken since v3.3.2 -7) Cosmetic cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.4 -initmty.mod : (7) -globals.def : (4) -ppmain.mod : (1),(7) -timslice.mod : (1),(4) -pp_lvlfs.mod : (7) -eqdeclr.mod : (1) -eqcapact.mod : (1),(2) -eqcaflac.vda : (1),(3) -eqstgtss.mod : (1) -eqstgaux.mod : (1) -eqstgin.mod : (1) -bnd_stg.mod : (1) -mod_equa.mod : (1) -init_ext.vda : (7) -ppm_ext.vda : (3) -rptlite.rpt : (6) -rptmisc.rpt : (5) -solve.stp : (5) - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.5 ------------------------------------------------------------------------------------------ -Date: 12-Jun-2012 [AL]: Small improvements into time-stepped TIMES & DSC -1) Added support for combining flexible fixing of first periods with TIMESTEP -2) Added support for semi-continuous VAR_NCAP (new investments) -3) Cosmetic cleanup/improvement - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.5 -initmty.mod : (1) -maindrv.mod : (1) -eqactbnd.mod : (1) -eqblnd.mod : (1) -eqbndcom.mod : (1) -eqcombal.mod : (1) -eqdamage.mod : (1) -eqflobnd.mod : (1) -eqflofr.mod : (1) -eqflomrk.mod : (1) -eqpeak.mod : (1) -eqstgin.mod : (1) -eqstgout.mod : (1) -equcrtp.vda : (1) -equ_ext.dsc : (1) -equ_ext.etl : (1) -rptmain.rpt : (3) -sol_flo.red : (3) -solve.stp : (1) -*.dsc : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.6 ------------------------------------------------------------------------------------------ -Date: 1-Jul-2012 [AL]: Support for power flow equations added (still experimental) -1) Added support for powerflow equations -2) Other minor improvement / cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.6 -cal_ire.mod : (2) -eqcombal.mod : (2) -eqpeak.mod : (2) -initmty.vda : (1) -init_ext.vda : (1) -prep_ext.vda : (1),(2) -ppm_ext.vda : (1),(2) -pp_prelv.vda : (1) -equ_ext.vda : (1) -eqcaflac.vda : (1),(2) -mod_ext.vda : (1) -eqobj.tm : (2) - -Added files: -powerflo.vda : Implementation of powerflo equations - -Deleted files: -timesmacro2veda.vdd : No longer needed - the standard vdd will work - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.7 ------------------------------------------------------------------------------------------ -Date: 13-Jul-2012 [AL]: Small improvements -1) Integration of SHAPE/MULTI processing for NCAP_AF/AFS -2) Added support for currency-dependent discount rates for Damage costs -3) Other minor improvement / cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.7 -initmty.mod : (1),(3) -ppmain.mod : (1),(3) -pp_reduce : (3) -preppm.mod : (1) -preshape.gms : (1) -fillvint.gms : (3) -coef_cpt.mod : (1) -coef_ptr.mod : (3) -pp_shapr.mod : (1) -eqdamage.mod : (2) -pp_qack.mod : (3) -rpt_dam.mod : (2) -rptlite.rpt : (2) -initmty.vda : (3) -init_ext.vda : (3) -prep_ext.vda : (1) - -Deleted files: -pp_multi.mod: No longer needed - ------------------------------------------------------------------------------------------ -TIMES Version 3.3.8 ------------------------------------------------------------------------------------------ -Date: 18-Aug-2012 [AL]: Small reporting improvements -1) Added reporting of forcing by main GHG emission type -2) Added reporting of retirements under VEDA -3) Improved optional reporting of topology indicators - -Modified files: (reason) -initsys.mod : Increased version number to 3.3.8 -rptlite.rpt : (2),(3) -rptmisc.rpt : (2) -solsetv.v3 : (3) -initmty.cli : (1) -rpt_par.cli : (1) -solputta.ans : (2) -*.vdd : (3) - -Deleted files: -*.zzz: Obsolete - ------------------------------------------------------------------------------------------ -TIMES Version 3.4.0 ------------------------------------------------------------------------------------------ -Date: 30-Nov-2012 [AL]: TIMES-MACRO and Grid modeling enhancements -1) Implementation of MACRO Decomposition Algorithm with soft-linked MSA -2) Improvements into original TIMES-MACRO + linkages to soft-linked MSA -3) Further improvements into power flow modeling -4) Added regional annual damage cost reporting - -Modified files: (reason) -initsys.mod : Increased version number to 3.4.0 -initmty.mod : (1),(2) -ppmain.mod : (2) -maindrv.mod : (1) -coef_obj.mod : (2) -eqobj.mod : (1) -eqobjinv.mod : (2) -eqobjfix.mod : (2) -cal_ire.mod : (3) -eqpeak.mod : (3) -mod_vars.mod : (3) -mod_equa.mod : (1) -rptmain.mod : (1) -solsetv.v3 : (1),(2) -initmty.tm : (2) -prep_ext.tm : (2) -ppmain.tm : (2) -mod_vars.tm : (2) -eqdeclr.tm : (2) -eqmacro.tm : (2) -eqobj.tm : (2) -eqobjfix.tm : (2) -eqobjinv.tm : (2) -eqobjvar.tm : (2) -mod_equa.tm : (2) -bnd_macro.tm : (2) -rptmain.tm : (2) -initmty.vda : (3) -prep_ext.vda : (3) -pp_prelv.vda : (3) -coef_ext.vda : (3) -mod_ext.vda : (3) -powerflo.vda : (3) -rpt_dam.cli : (4) -times2veda.vdd: (1),(2) -solputta.ans : (1),(2) - -Added files : (reason) -eqobjann.tm : (1),(2) -initmty.msa : (1) -mod_vars.msa : (1) -equ_ext.msa : (1) -rpt_ext.msa : (1) -solprep.msa : (1) -solvcoef.msa : (1) -solve.msa : (1) -ddfupd.msa : (1) -writeddf.msa : (1) - -Deleted files: -eqobsalv.tm : Obsolete -ddfnew.gms : Obsolete - ------------------------------------------------------------------------------------------ -TIMES Version 3.4.1 ------------------------------------------------------------------------------------------ -Date: 31-Dec-2012 [AL]: Small improvements -1) runtime licence support -2) climate module improvements -3) PRC_CG QA check refined under RELAX_PRC_CG - -Modified files: (reason) -initsys.mod : Increased version number to 3.4.1 -spoint.mod : (1) -eqmain.mod : (1) -mod_equa.mod : (1) -pp_qack.mod : (3) -mod_ext.vda : (1) -initmty.cli : (2) -coef_ext.cli : (2) -equ_ext.cli : (2) -mod_vars.cli : (2) -rpt_par.cli : (2) - -Deleted files : -putdset.v3 : obsolete -solsubv.v3 : obsolete - ------------------------------------------------------------------------------------------ -TIMES Version 3.4.2 ------------------------------------------------------------------------------------------ -Date: 24-Feb-2013 [AL]: Small improvements mainly to reporting routines -1) Small improvements and fixes to reporting issues for MSA/TM -2) Changed VEDA-BE reporting of Reg_Wobj, introduced system label prefix -3) Optional reporting of levelized costs and electricity supply by energy source -4) Cosmetic improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.4.2 -initmty.mod : (2),(4) -ppmain.mod : (4) -pp_lvlpk.mod : (4) -coef_obj.mod : (4) -eqcombal.mod : (4) -eqpeak.mod : (4) -eqobjels.mod : (4) -eqdeclr.mod : (4) -rptmain.mod : (4) -rptlite.rpt : (2),(3) -rptmain.rpt : (2),(4) -rpt_obj.rpt : (2) -rpt_objc.rpt : (2),(3) -cost_ann.rpt : (4) -rptmisc.rpt : (3),(4) -eqobjels.rpt : (4) -eqobsalv.rpt : (4) -eqdamage.mod : (4) -rpt_dam.mod : (4) -rpt_ext.cli : (4) -rptmain.stc : (3),(4) -initmty.msa : (1) -mod_vars.msa : (1) -equ_ext.msa : (1) -rpt_ext.msa : (1) -solprep.msa : (1) -solvcoef.msa : (1) -solve.msa : (1) -writeddf.msa : (1) -initmty.tm : (1) -ppmain.tm : (1) -eqmacro.tm : (1) -eqobj.tm : (1) -eqobjann.tm : (4) -rptmain.tm : (1),(4) -solsetv.v3 : (2),(3) -solputta.ans : (1),(3),(4) -*.vdd : (2),(3) - -Added files: -sol_ire.rpt : IRE flow solution parameters -par_uc.rpt : UC dual solution parameters -solsysd.v3 : define system labels - ------------------------------------------------------------------------------------------ -TIMES Version 3.4.3 ------------------------------------------------------------------------------------------ -Date: 23-Apr-2013 [AL]: Maintenance release -1) Improved handling of PASTI installed within horizon -2) Fixed small defect in RTCS_FR definition -3) Fixed small defect in flow reductions -4) Cosmetic improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.4.3 -initmty.mod : (4) -ppmain.mod : (1),(2),(4) -pp_qafs.mod : (4) -pp_qack.mod : (4) -coef_cpt.mod : (1) -coef_obj.mod : (1),(4) -err_stat.mod : (4) -eqobj.* : (4) -eqobjinv.* : (1),(4) -bndmain.mod : (4) -wrtbprice.mod : (4) -coef_alt.lin : (1),(4) -init_ext.vda : (1),(4) -prep_ext.vda : (1),(4) -ppm_ext.vda : (1),(3),(4) -coef_ext.vda : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.4.4 ------------------------------------------------------------------------------------------ -Date: 19-July-2013 [AL]: Small improvements -1) Added support for defining PRC_PKNO & PRC_PKAF via NCAP_PKCNT I/E -2) Added forcing function updating, removed taxes/subsidies, and fixed reporting problem in MSA -3) Added removal of redundant FLO_MARK equations -4) Added parameter for default IE-options: IE_DEFAULT -5) Removed unused corridor process concept -6) Cosmetic improvements & cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.4.4 -initmty.mod : (4),(6) -ppmain.mod : (5),(6) -preppm.mod : (4),(6) -prepparm.gms : (4) -pp_reduce.red : (5) -coef_nio.mod : (6) -coef_obj.mod : (6) -fillcost.gms : (6) -eqdeclr.mod : (6) -eqmain.mod : (6) -eqflobnd.mod : (6) -eqflomrk.mod : (3) -eqire.mod : (5) -equserco.mod : (6) -cal_ire.mod : (5) -sol_ire.rpt : (5) -cost_ann.rpt : (5) -rptmisc.rpt : (6) -rptmain.rpt : (6) -init_ext.vda : (1) -prep_ext.vda : (6) -pp_prelv.vda : (6) -ppm_ext.vda : (6) -pp_actef.vda : (6) -eqashar.vda : (6) -ucbet.vda : (5) -coef_ext.cli : (2) -solve.stp : (5) -initmty.msa : (6) -solprep.msa : (2) -solve.msa : (2) -rpt_ext.msa : (2) -ppmain.tm : (6) -rptmain.tm : (6) -eqobjann.tm : (2) -solputta.ans : (6) - ------------------------------------------------------------------------------------------ -TIMES Version 3.4.5 ------------------------------------------------------------------------------------------ -Date: 9-Sep-2013 [AL]: New alias/shortcut attributes -1) Added shortcut NCAP_START(r,p)=y for PRC_NOFF(r,p,BOH,y-1) -2) Added alias ACT_FLO for VDA_FLOP -3) Added support for net import peak contribution when PKNO and by capacity when PKAF -4) Cosmetic improvements & cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.4.5 -initmty.mod : (1),(4) -ppmain.mod : (1),(3) -pp_lvlpk.mod : (3) -pp_reduce.red : (3) -eqmain.mod : (4) -eqactbnd.mod : (4) -eqbndcom.mod : (4) -equserco.mod : (4) -cal_ire.mod : (3) -eqpeak.mod : (3) -pp_dumpd.mod : (4) -rptmisc.rpt : (3) -initmty.vda : (2),(4) -init_ext.vda : (1),(2) -prep_ext.vda : (4) -pp_prelv.vda : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 3.4.9 ------------------------------------------------------------------------------------------ -Date: 20-Dec-2013 [AL]: New OBJ reporting parameter + small fixes -1) Added new reporting parameters Cost_NPV and Time_NPV for VEDA-BE -2) Added split of inv. costs according to hurdle rate -3) Fixed support of multiple currencies in TIMES-MACRO -4) Fixed small reporting issues for damage costs -5) Fixed small reporting issue for LUMPINV -6) Added support for levelized annual cost reporting -7) Cosmetic improvements & cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.4.9 -initmty.mod : (7) -ppmain.mod : (7) -preppm.mod : (7) -eqobjfix.mod : (7) -mod_vars.mod : (7) -coef_obj.mod : (6) -coef_ext.vda : (6) -rptlite.rpt : (1),(2),(6) -rpt_obj.rpt : (1),(2),(6) -rpt_objc.rpt : (1) -cost_ann.rpt : (1),(2),(5),(6) -eqobjfix.rpt : (7) -eqobjvar.rpt : (1),(7) -eqdamage.mod : (4) -rpt_dam.mod : (1),(4) -eqobj.tm : (3) -eqobjann.tm : (3) -solsetv.v3 : (1) -solputta.ans : (2) -times2veda.vdd: (1) -times2veda_stc.vdd: (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.5.0 ------------------------------------------------------------------------------------------ -Date: 4-Feb-2014 [AL]: Added new parameters and equations related to residual load curves -1) Added residual load curve stuff -2) Fixed small issues in CAPACT/CAFLAC equations -3) Cosmetic improvements & cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.5.0 -timslice.mod : (2) -coef_cpt.mod : (2) -mod_vars.mod : (3) -eqdeclr.mod : (3) -eqcapact.mod : (2) -eqobj.mod : (3) -mod_equa.mod : (3) -pp_qack.mod : (1) -prep_ext.vda : (1) -ppm_ext.vda : (2) -coef_ext.vda : (1) -equ_ext.vda : (1),(2) -eqcaflac.vda : (2) -mod_ext.vda : (1) - -Added file: -resloadc.vda : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.5.1 ------------------------------------------------------------------------------------------ -Date: 5-Mar-2014 [AL]: Maintenance release -1) Fixed a rare special case in reduction -2) Fixed small past investment cost issues -3) Fixed zero demand issue in MSA -4) Cosmetic maintenance changes - -Modified files: (reason) -initsys.mod : Increased version number to 3.5.1 -coef_obj.mod : (2) -eqobjinv.mod : (2) -eqobjvar.mod : (4) -ppm_ext.vda : (1) -equ_ext.msa : (3) -solve.msa : (3) -eqobj.tm : (4) -eqobjann.tm : (4) - -Added file: -eqobjcst.tm : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 3.6.0 ------------------------------------------------------------------------------------------ -Date: 1-Apr-2014 [AL]: Introduce TS-dynamic UC equations -1) Added support for TS-dynamic UC equations -2) Fixed reporting bug when SOLVEDA=1 and UC slacks not used -3) Fixed bug in currency conversion - -Modified files: (reason) -initsys.mod : Increased version number to 3.6.0 -initmty.mod : (1) -ppmain.mod : (1) -timslice.mod : (1) -curex.gms : (3) -eqdeclr.mod : (1) -equserco.mod : (1) -equcwrap.mod : (1) -uc_act.mod : (1) -uc_flo.mod : (1) -uc_ire.mod : (1) -uc_comnt.mod : (1) -uc_compd.mod : (1) -mod_vars.mod : (1) -mod_equa.mod : (1) -bnd_ucw.mod : (1) -spoint.mod : (1) -recurrin.stc : (1) -rptlite.rpt : (2) -par_uc.rpt : (1),(2) -initmty.vda : (1) -init_ext.vda : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.6.1 ------------------------------------------------------------------------------------------ -Date: 20-May-2014 [AL]: Fix for generalized STS storage -1) Fixed TSLVL bug in STS storage - -Modified files: (reason) -initsys.mod : Increased version number to 3.6.1 -eqstgtss.mod : (1) -eqstgin.mod : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.7.0 ------------------------------------------------------------------------------------------ -Date: 1-Aug-2014 [AL]: Introduce dynamic ramping constraints -1) Added dedicated ramping constraints -2) Added flow-based max. availability factors -3) Cosmetic improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.7.0 -initmty.mod : (1) -maindrv.mod : (3) -ppmain.mod : (3) -dumpsol.mod : (3) -dumpsol1.mod : (3) -bnd_act.mod : (3) -pp_reduce.red : (3) -coef_cpt.mod : (3) -rptmisc.rpt : (3) -initmty.vda : (1) -init_ext.vda : (1) -prep_ext.vda : (1) -ppm_ext.vda : (2) -equ_ext.vda : (1) -eqcaflac.vda : (2) -mod_ext.vda : (1) - -Added file: -eqactups.vda : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.7.1 ------------------------------------------------------------------------------------------ -Date: 1-Oct-2014 [AL]: Maintenance release -1) Fixed numerical problems in the MSA algorithm -2) Fixed S_FLO_FUNC support under SPINES - -Modified files: (reason) -initsys.mod : Increased version number to 3.7.1 -solvcoef.msa : (1) -equ_ext.msa : (1) -solve.msa : (1) -sol_flo.red : (2) -sol_ire.rpt : (2) -rptmain.stc : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 3.8.1 ------------------------------------------------------------------------------------------ -Date: 6-Nov-2014 [AL]: Support for CBA analysis in MSA -1) Added market & non-market damages for CBA analysis in MSA - -Modified files: (reason) -initsys.mod : Increased version number to 3.8.1 -*.msa : (1) -*.cli : (1) - -Added files: -preppm.msa : (1) -forcupd.cli : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.8.2 ------------------------------------------------------------------------------------------ -Date: 4-Dec-2014 [AL]: Maintenance release -1) Fixed reporting of cum constraint marginals in time-stepped mode - -Modified files: (reason) -initsys.mod : Increased version number to 3.8.2 -solve.stp : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.8.3 ------------------------------------------------------------------------------------------ -Date: 9-Jan-2015 [AL]: Small improvements -1) Added support for timeslice-specific NCAP_AFC -2) Added support for CHP modeling via CDME/BPME -3) Added support for levelized FLO_FR bounds -4) Cosmetic improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.8.3 -initmty.mod : (1),(2),(4) -maindrv.mod : (4) -ppmain.mod : (2) -preppm.mod : (2) -preponly.mod : (1) -pp_chp.mod : (2) -coef_cpt.mod : (1) -coef_csv.mod : (4) -pp_qack.mod : (2) -eqdeclr.mod : (3) -eqflofr.mod : (3) -eqcapact.mod : (1) -eqcapvac.mod : (1) -eqmain.mod : (4) -rptlite.rpt : (4) -cost_ann.rpt : (4) -initmty.vda : (4) -init_ext.vda : (2) -prep_ext.vda : (2) -pp_prelv.vda : (2) -ppm_ext.vda : (1) -coef_ext.vda : (3) -equ_ext.vda : (4) -eqcaflac.vda : (1) -eqactups.vda : (1) -eqashar.vda : (4) -resloadc.vda : (1) -ppmain.tm : (4) -equ_ext.etl : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 3.8.4 ------------------------------------------------------------------------------------------ -Date: 10-Apr-2015 [AL]: Maintenance release -1) Fixed problem with damage cost under MSA -2) Reinstate support for TIMESTEP with SPINES -3) Fixed handling of negative ILED with COEF_ICOM -4) Fixed potential exec error under MSA+CLI -5) Cosmetic improvement / cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.8.4 -ppmain.mod : (3) -coef_nio.mod : (3) -spoint.mod : (5) -eqobj.mod : (5) -eqobjinv.mod : (5) -eqobjfix.mod : (5) -eqobsalv.mod : (5) -eqbndcst.mod : (5) -rptmain.rpt : (5) -eqobjfix.rpt : (5) -initmty.stc : (2) -solve.stc : (2) -rptmain.stc : (2) -clearsol.stc : (2) -solve.stp : (2) -initmty.cli : (5) -forcupd.cli : (4) -pp_actef.vda : (5) -ppm_ext.vda : (5) -initmty.msa : (5) -preppm.msa : (1) -initmty.tm : (5) -eqobj.tm : (5) -initmty.ier : (5) -rpt_chp.ier : (5) -initmty.dsc : (5) - ------------------------------------------------------------------------------------------ -TIMES Version 3.8.5 ------------------------------------------------------------------------------------------ -Date: 10-May-2015 [AL]: Maintenance release -1) Added reporting of VAR_CUMCST levels -2) Added support for fixing initial periods with MSA -3) Fixed div/0 error when zero NCAP_DRATE/ELIFE -4) Cosmetic improvements / cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 3.8.5 -maindrv.mod : (2) -eqobj.mod : (4) -eqobjinv.mod : (3) -eqdamage.mod : (2) -coef_alt.lin : (4) -rptlite.rpt : (1) -rpt_obj.rpt : (3) -rptmisc.rpt : (1) -solsetv.v3 : (1) -solve.stp : (2) -initmty.msa : (2) -preppm.msa : (4) -solvcoef.msa : (2) -solve.msa : (2) -writeddf.msa : (2) -times2veda.vdd: (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.8.6 ------------------------------------------------------------------------------------------ -Date: 19-Jun-2015 [AL]: Maintenance release -1) Fixed reporting bug that manifested only when using ACT_UPS(FX) -2) Added support for referring to online capacity: UC_ATTR(CAP,ONLINE) - - modifier ignored for processes that have no ACT_UPS(FX) defined - -Modified files: (reason) -initsys.mod : Increased version number to 3.8.6 -uc_cap.mod : (2) -sol_flo.red : (1) -coef_ext.vda : (2) -equ_ext.vda : (2) -eqcaflac.vda : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 3.9.0 ------------------------------------------------------------------------------------------ -Date: 10-Oct-2015 [AL]: Major release with new equations/variables -1) Added linear dispatch features (may be subject to changes) -2) Fixed G_DYEAR to default to 1st Milestone -3) Fixed small bugs in shaping of NCAP_AFS and residual load curves -4) Added reporting of PRC_MARK marginals -5) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 3.9.0 -globals.def : (2) -initmty.mod : (1) -maindrv.mod : (5) -ppmain.mod : (5) -timslice.mod : (1) -preppm.mod : (1) -pp_chp.mod : (5) -curex.gms : (1) -coef_cpt.mod : (1),(3) -coef_obj.mod : (2) -pp_qack.mod : (1) -spoint.mod : (1) -mod_vars.mod : (1) -eqobj.mod : (5) -eqobjinv.mod : (1) -eqobjfix.mod : (5) -eqobsalv.mod : (5) -eqobjvar.mod : (1) -uc_cap.mod : (1) -bndmain.mod : (5) -rptlite.rpt : (1),(4) -rpt_obj.rpt : (5) -cost_ann.rpt : (1) -eqobjvar.rpt : (1) -rptmisc.rpt : (1),(4) -initmty.vda : (1) -init_ext.vda : (1) -prep_ext.vda : (1) -ppm_ext.vda : (1) -pp_actef.vda : (1) -coef_ext.vda : (1) -equ_ext.vda : (1) -eqactups.vda : (1) -eqcaflac.vda : (1) -eqashar.vda : (5) -resloadc.vda : (1),(3) -mod_ext.vda : (1) -solve.stp : (1) -clearsol.stp : (5) -stages.stc : (5) -recurrin.stc : (1) -pextlevs.stc : (1) -clearsol.stc : (1),(5) -rptmain.stc : (1) -prepret.dsc : (5) -solputta.ans : (1),(4) -times2veda.vdd: (1) - ------------------------------------------------------------------------------------------ -TIMES Version 3.9.1 ------------------------------------------------------------------------------------------ -Date: 29-Dec-2015 [AL]: Maintenance release -1) Added QA checks for commodities/processes at invalid timeslice levels -2) Added elimination of ANNUAL CAPACT(UP/LO) equations if AFA(FX) specified -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 3.9.1 -initmty.mod : (3) -ppmain.mod : (1) -coef_cpt.mod : (2) -init_ext.vda : (3) -pp_qack.mod : (3) -eqashar.vda : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 3.9.2 ------------------------------------------------------------------------------------------ -Date: 18-Mar-2016 [AL]: Maintenance release -1) Fixed bug related to NCAP_AFS(FX) being used for PRC_TS without NCAP_AF -2) Auto-generation of missing members of PCG for storage -3) Fixed bug related to using WAVER with early retirements -4) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 3.9.2 -initmty.mod : (4) -ppmain.mod : (2),(4) -coef_cpt.mod : (1) -uc_ire.mod : (4) -pp_qack.mod : (4) -prepret.dsc : (3) -initmty.vda : (4) -init_ext.vda : (3) -prep_ext.vda : (3) -coef_ext.vda : (3) -equ_ext.vda : (4) -eqcaflac.vda : (4) -eqashar.vda : (4) -solsetv.v3 : (4) -initmty.etl : (4) -coef_ext.etl : (4) -equ_ext.etl : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 3.9.3 ------------------------------------------------------------------------------------------ -Date: 1-May-2016 [AL]: Maintenance release -1) Added support for IE option 5/15 for PRC_RESID -2) Added support for CHP reduction operation -3) Preparations for the UCO extension (forthcoming) -4) Other cosmetic improvements for consistency with the updated documentation - -Modified files: (reason) -initsys.mod : Increased version number to 3.9.3 -initmty.mod : (3) -maplists.def : (4) -pp_chp.mod : (2) -eqobjvar.mod : (3) -eqbndcst.mod : (4) -pp_qack.mod : (4) -solve.mod : (3) -initmty.vda : (3) -init_ext.vda : (1),(3) -prep_ext.vda : (1),(3) -initmty.cli : (4) -coef_ext.cli : (4) -equ_ext.cli : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 3.9.5 ------------------------------------------------------------------------------------------ -Date: 7-Jun-2016 [AL]: Maintenance release -1) Small improvements into the linear dispatching features -2) Cosmetic changes for improved consistency with the documentation update -3) Small improvement to EQ_CAPFLO for storage - -Modified files: (reason) -initsys.mod : Increased version number to 3.9.5 -initmty.mod : (2) -ppmain.mod : (2) -timslice.mod : (1) -preppm.mod : (1),(2) -curex.gms : (2) -pp_shapr.mod : (2) -pp_reduce.red : (2) -fillcost.gms : (2) -coefmain.mod : (2) -mod_vars.mod : (1) -eqobj.mod : (2) -eqcumflo.mod : (2) -eqcumcom.mod : (2) -eqdamage.mod : (2) -eqobjinv.mod : (2) -eqobjfix.mod : (2) -eqobjvar.mod : (1) -eqbndcst.mod : (2) -bndmain.mod : (1) -bnd_cum.mod : (2) -spoint.mod : (1) -eqobjinv.rpt : (2) -eqobjfix.rpt : (2) -eqobjvar.rpt : (1) -rpt_obj.rpt : (2) -rpt_objc.rpt : (2) -cost_ann.rpt : (2) -init_ext.vda : (2) -prep_ext.vda : (1),(3) -eqcaflac.vda : (3) -equ_ext.vda : (1) -eqactups.vda : (1) -mod_ext.vda : (1) -prepret.dsc : (2) -coef_ext.cli : (2) -equ_ext.cli : (2) -coef_alt.lin : (2) -recurrin.stc : (1) -clearsol.stc : (1) -rptmain.stc : (1) -pextlevs.stc : (1),(2) -solve.stp : (2) -eqobj.tm : (2) -eqobjann.tm : (2) -rpt_ext.msa : (2) -solputta.ans : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 3.9.7 ------------------------------------------------------------------------------------------ -Date: 1-Jul-2016 [AL]: Pre-release for v4.0 -1) Enhanced unit cmmitment features, including MIP option (added ACT_CSTSD, ACT_CSTRMP, ACT_MAXNON, ACT_SDTIME, ACT_LOSSD) -2) Added optional Functional Depreciation Rate for Salvage accounting (added NCAP_FDR) -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 3.9.7 -initmty.mod : (1),(2) -preppm.mod : (1),(2) -curex.gms : (3) -setglobs.gms : (3) -mod_vars.mod : (1) -coef_ptr.mod : (3) -cal_cap.mod : (3) -eqobjvar.mod : (1) -eqobsalv.mod : (2) -eqpeak.mod : (3) -eqcombal.mod : (3) -spoint.mod : (1) -bndmain.mod : (1) -eqobjvar.rpt : (1) -solve.stp : (1) -stages.stc : (3) -recurrin.stc : (1) -clearsol.stc : (1) -rptmain.stc : (1) -initmty.vda : (1) -prep_ext.vda : (1) -mod_ext.vda : (1) -equ_ext.vda : (1) -coef_ext.vda : (1) -eqactups.vda : (1) -eqlducs.vda :+(1) -initmty.dsc : (1) -init_ext.dsc : (1) -initmty.tm : (3) -eqmrkcom.ier : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 3.9.8 ------------------------------------------------------------------------------------------ -Date: 2-Aug-2016 [AL]: Maintenance release (second pre-release for v4.0) -1) Fixed flaw in special EQ(l)_ASHAR defined for CG=ACT -2) Fixed bug in fixed cost accounting with standard objective (introduced in v3.9.5) -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 3.9.8 -initmty.mod : (3) -ppmain.mod : (3) -preppm.mod : (3) -curex.gms : (3) -pp_chp.mod : (3) -eqcapvac.mod : (3) -eqobjfix.mod : (2) -uc_flo.mod : (3) -uc_ire.mod : (3) -pp_lvlpk.mod : (3) -eqlducs.vda : (3) -eqashar.vda : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.0.0 ------------------------------------------------------------------------------------------ -Date: 1-Sep-2016 [AL]: Major Release - announce Dispatching and Unit Commitment Features -1) Cleaned up new unit commitment features -2) Corrected reporting of LUMPINV under MID_YEAR -3) Added support for defining RL-TP in GR_VARGEN -4) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.0.0 -initmty.mod : (4) -readbprice.mod: (4) -ppmain.mod : (4) -coef_ptr.mod : (4) -pp_qafs.mod : (4) -pp_qack.mod : (4) -rptlite.rpt : (4) -cost_ann.rpt : (2) -init_ext.vda : (4) -ppm_ext.vda : (4) -pp_actef.vda : (4) -eqlducs.vda : (1) -eqashar.vda : (4) -resloadc.vda : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.0.1 ------------------------------------------------------------------------------------------ -Date: 9-Nov-2016 [AL]: Maintenance release -1) Improved handling of OFF specification when no capacity -2) Improved reporting of electricity by source -3) Cosmetic improvement/cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.0.1 -ppmain.mod : (1),(3) -rptmisc.rpt : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.1.0 ------------------------------------------------------------------------------------------ -Date: 30-Jan-2017 [AL]: Introducing TIMES-Micro -1) Pilot implementation of TIMES-Micro -2) Cosmetic improvements/cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.1.0 -initmty.mod : (1) -maindrv.mod : (1) -setglobs.gms : (1) -ppmain.mod : (1) -preppm.mod : (1) -eqdeclr.mod : (1) -eqobj.mod : (1) -eqobjels.mod : (1) -eqcombal.mod : (1),(2) -eqpeak.mod : (1),(2) -bndmain.mod : (1) -bnd_elas.mod : (1) -pp_qack.mod : (1) -pp_qaput.mod : (2) -mod_equa.mod : (1) -solve.mod : (1) -eqobjels.rpt : (1) -rpt_obj.rpt : (1) -recurrin.stc : (1) -prep_ext.tm : (2) -eqmacro.tm : (2) -bnd_macro.tm : (2) -mod_vars.tm : (1),(2) - -Added files: -pp_micro.mod : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.1.1 ------------------------------------------------------------------------------------------ -Date: 28-Feb-2017 [AL]: Maintenance release -1) Fixed climate temperature reporting under stochastic climate sensitivity -2) Ensure commodity balance for exclusively capacity-related flows -3) Performance improvements under stochastic mode - -Modified files: (reason) -initsys.mod : Increased version number to 4.1.1 -eqdamage.mod : (3) -bnd_act.mod : (3) -coef_ext.vda : (2) -initmty.cli : (3) -coef_ext.cli : (3) -equ_ext.cli : (3) -rpt_ext.cli : (1) -rpt_par.cli : (3) -initmty.stc : (3) -stages.stc : (3) -fillsow.stc : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.1.2 ------------------------------------------------------------------------------------------ -Date: 30-Mar-2017 [AL]: Retrofitting and life-extension -1) Added retrofitting and life-extension: PRC_REFIT(r,prc,p) -2) Added stochastic support for grid modeling features -3) Fixed last period reporting of retired capacity -4) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.1.2 -initmty.mod : (1),(4) -ppmain.mod : (4) -timslice.mod : (4) -mod_vars.mod : (4) -eqdeclr.mod : (1) -eqmain.mod : (4) -eqobsalv.mod : (1) -mod_equa.mod : (1) -cost_ann.rpt : (2) -rptmisc.rpt : (3) -prepret.dsc : (1) -solve.stp : (1) -ppm_ext.vda : (4) -powerflo.vda : (2) -recurrin.stc : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.1.3 ------------------------------------------------------------------------------------------ -Date: 5-Jun-2017 [AL]: Maintenance release -1) Fixed uncertain damage cost reporting for climate variables -2) Fixed stochastic damage cost accounting under stochastic climate sensitivity -3) Fixed retirement cost accounting under NLP MACRO -4) Minor/cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.1.3 -initmty.mod : (4) -coef_obj.mod : (4) -eqdeclr.mod : (2) -bnd_ire.vda : (4) -eqobjvar.mod : (4) -eqobjcst.tm : (3) -eqobjann.tm : (3) -eqdamage.mod : (2) -rpt_obj.rpt : (4) -eqobjvar.rpt : (4) -rpt_dam.mod : (1) -prepret.dsc : (3) -coef_ext.cli : (2) -rpt_ext.cli : (2) -prep_ext.stc : (2) -stages.stc : (2) -recurrin.stc : (4) -rptmain.stc : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 4.1.4 ------------------------------------------------------------------------------------------ -Date: 26-Jul-2017 [AL]: Maintenance release -1) Auto-define -INF bounds for VAR_CUMCOM if neg. enabled -2) Allow ANNUAL charging profiled with COM_FR for NST -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.1.4 -ppmain.mod : (2) -bnd_cum.mod : (1) -pp_qack.mod : (3) -rptlite.rpt : (3) -cost_ann.rpt : (3) -rptmain.rpt : (3) -eqobsalv.rpt : (3) -equ_ext.etl : (3) -mod_vars.etl : (3) -pp_chp.ier : (3) -equ_ext.ier : (3) -eqchpelc.ier : (3) -eqmrkcom.ier : (3) -rpt_ext.ier : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.1.6 ------------------------------------------------------------------------------------------ -Date: 22-Nov-2017 [AL]: Maintenance release -1) Added option for forcing refitted capacity equal to retired -2) Fixed reporting of retired RESIDual capacity -3) Fixed bug when COM_FR defined for an ANNUAL level commodity only at the ANNUAL level - -Modified files: (reason) -initsys.mod : Increased version number to 4.1.6 -ppmain.mod : (1),(3) -prepret.dsc : (1) -rptmisc.rpt : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.0 ------------------------------------------------------------------------------------------ -Date: 7-Jan-2018 [AL]: Intorducing NCAP_CPX & Grid Computing -1) Added NCAP_CPX implementation for shaping capacity transfer -2) Added support for using grid computing facility under sensitivity analysis -3) Added support for always retrieving solution + status code reporting to VEDA-BE -4) Fixed small u*x compatibility issues -5) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.0 -initmty.mod : (1) -maindrv.mod : (4) -ppmain.mod : (5) -preppm.mod : (1) -preponly.mod : (5) -coef_obj.mod : (1) -coef_ptr.mod : (1) -coefmain.mod : (1) -eqobjinv.mod : (5) -equserco.mod : (5) -uc_com.mod : (5) -pp_qack.mod : (5) -eqobsalv.mod : (1) -eqobjfix.mod : (1) -eqobjann.tm : (1) -solve.mod : (5) -err_stat.mod : (3) -rptlite.rpt : (3) -rpt_obj.rpt : (1),(5) -cost_ann.rpt : (1) -eqobjfix.rpt : (1) -eqlducs.vda : (4) -prepret.dsc : (5) -solve.stc : (2) -sensis.stc : (2) -clearsol.stp : (2) - -Added files : (1) -coef_shp.mod : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.1 ------------------------------------------------------------------------------------------ -Date: 2-Feb-2018 [AL]: Introduce S_COM_TAX + Maintenance -1) Added new uncertain parameter S_COM_TAX(r,y,c,s,type,cur,j,sow) -2) Added QA check warnings for inconsistent CAP_BNDs and G_YRFRs -3) Fixed bug in processing of FLO_SUB/FLO_TAX when both defined on the same flow -4) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.1 -initmty.mod : (2) -ppmain.mod : (2) -timslice.mod : (2) -preppm.mod : (3) -eqobj.mod : (1) -eqobjvar.mod : (1) -coefmain.mod : (1) -coef_obj.mod : (1) -coef_alt.lin : (1) -pp_qaput.mod : (2) -rptlite.rpt : (2) -rptmisc.rpt : (2) -rpt_obj.rpt : (1) -eqobjvar.rpt : (1) -prep_ext.vda : (2) -coef_ext.vda : (4) -eqobj.tm : (4) -rptmain.tm : (4) -initmty.stc : (1) -prep_ext.stc : (1) -stages.stc : (1) -rptmain.stc : (1) -rpt_par.cli : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.2 ------------------------------------------------------------------------------------------ -Date: 7-Mar-2018 [AL]: Maintenance release -1) Fixed issues when using PRC_REFIT with time-stepped mode -2) Ignore superfluous UC_ACT/CAP/NCAP entries -3) Minor improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.2 -initmty.mod : (1) -ppmain.mod : (1),(2) -eqmain.mod : (3) -bnd_ucw.mod : (3) -bnd_ucv.mod : (3) -cost_ann.rpt : (3) -prepret.dsc : (1) -solve.stp : (1) -prep_ext.vda : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.3 ------------------------------------------------------------------------------------------ -Date: 7-Apr-2018 [AL]: Maintenance release -1) Improved several specifics of FIXBOH runs -2) Added support for nested CES demand functions -3) Miscellaneous small improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.3 -initmty.mod : (1),(2) -maindrv.mod : (3) -pp_micro.mod : (2) -eqdeclr.mod : (1) -eqobjels.mod : (2) -eqcombal.mod : (2) -bndmain.mod : (1) -bnd_act.mod : (1) -bnd_elas.mod : (2) -pp_qack.mod : (2) -rptlite.rpt : (1) -rptmisc.rpt : (1) -initmty.vda : (1) -solsetv.v3 : (3) -solve.stp : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.4 ------------------------------------------------------------------------------------------ -Date: 7-May-2018 [AL]: Maintenance release -1) Fixed bug related to certain dynamic UCs under FIXBOH runs -2) Improved support for nested CES demand functions -3) Added reporting of EQ(l)_ACTBND duals -4) Added reporting of lump-sum investment taxes/subsidies - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.4 -initmty.mod : (3) -solve.stp : (1) -pp_micro.mod : (2) -eqdeclr.mod : (3) -bnd_elas.mod : (2) -rptlite.rpt : (4) -rpt_obj.rpt : (4) -cost_ann.rpt : (4) -rptmisc.rpt : (3) -clearsol.stc : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.6 ------------------------------------------------------------------------------------------ -Date: 6-Jul-2018 [AL]: Maintenance release -1) Preparations for Monte Carlo Analysis -2) Fixed reporting of stochastic lump-sum investments and taxes -3) Fixed FOM accounting when both early retirements and NCAP_CPX -4) Fixed error due to GAMS change & cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.6 -initmty.mod : (1) -main_ext.mod : (1) -ppmain.mod : (4) -spoint.mod : (1) -pp_reduce.red : (4) -rptlite.rpt : (4) -eqobjvar.rpt : (2) -rpt_obj.rpt : (2) -cost_ann.rpt ; (3) -rptmisc.rpt : (3) -eqlducs.vda : (4) -prepret.dsc : (3) -solve.stp : (1),(4) -stages.stc : (1) -solve.stc : (1) -sensis.stc : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.7 ------------------------------------------------------------------------------------------ -Date: 12-Sep-2018 [AL]: Maintenance release -1) Fixed old bug in UC_CLI processing -2) Improved handling of cumulative commodity constraints -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.7 -eqobjinv.mod : (3) -eqobjfix.mod : (3) -uc_cli.mod : (1) -sensis.stc : (2) -solve.stp : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.2.9 ------------------------------------------------------------------------------------------ -Date: 2-Nov-2018 [AL]: Maintenance release -1) Added UC_MarkS category into BE reporting -2) Added elimination of superfluous CUMCOM equations -3) Fixed problems intoroduced in Macro variants -4) Removed invalid reference to storage flows - -Modified files: (reason) -initsys.mod : Increased version number to 4.2.9 -initmty.mod : (3) -maindrv.mod : (3) -coef_obj.mod : (4) -eqflomrk.mod : (1) -eqobsalv.mod : (3) -bnd_cum.mod : (2) -solve.stp : (3) -solve.msa : (3) -solsetv.v3 : (1) -mod_vars.msa : (3) -equ_ext.msa : (3) -solprep.msa : (3) -rptmain.tm : (3) -eqobj.tm : (3) -eqobjann.tm : (3) -rptmain.stc : (3) -times2veda.vdd: (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.0 ------------------------------------------------------------------------------------------ -Date: 9-Jan-2019 [AL]: Introducing demand response by load-shifting -1) Added new input parameter STG_SIFT and set of new equations for load shifting -2) Added optional reporting of load levels for process flows -3) Cosmetic improvements & cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.0 -initmty.mod : (1) -maplists.def : (3) -ppmain.mod : (1) -timslice.mod : (1) -preppm.mod : (1) -pp_reduce.red : (3) -init_ext.vda : (1) -prep_ext.vda : (1) -pp_prelv.vda : (3) -ppm_ext.vda : (3) -equ_ext.vda : (1) -mod_ext.vda : (1) -eqactups.vda : (1) -powerflo.vda : (3) -rptmisc.rpt : (2) -rptlite.rpt : (2) -solsetv.v3 : (2) -solve.stc : (3) -pextlevs.stc : (3) -times2veda.vdd: (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.1 ------------------------------------------------------------------------------------------ -Date: 9-Feb-2019 [AL]: Maintenance release -1) Added error clearing if DATAGDX saved after domain violations -2) Fixed bug in NCAP_CDME processing -3) Fixed error when using TIMESED with STAGES -4) Cosmetic improvements & cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.1 -preppm.mod : (1) -prepxtra.mod : (1) -fillvint.gms : (4) -pp_chp.mod : (2) -bnd_elas.mod : (3) -eqfloshr.mod : (4) -eqobjels.mod : (3) -solve.stp : (4) -eqactups.vda : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.2 ------------------------------------------------------------------------------------------ -Date: 9-Mar-2019 [AL]: Maintenance release -1) Added support for varying timeslice cycles -2) Added reporting of EQG_COMBAL levels under stochastic -3) Added support for emissions on auxiliary storage flows -4) Cosmetic improvements & cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.2 -initmty.mod : (1) -ppmain.mod : (1) -timslice.mod : (1) -pp_reduce.red : (4) -eqstgaux.mod : (3) -eqstgaux.lin : (3) -init_ext.vda : (4) -pp_prelv.vda : (3) -ppm_ext.vda : (3) -pp_actef.vda : (1) -eqashar.vda : (4) -eqactups.vda : (1) -eqlducs.vda : (1) -times2veda_stc: (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.3 ------------------------------------------------------------------------------------------ -Date: 9-Apr-2019 [AL]: Maintenance release -1) Fixed minor reporting issue under MACRO -2) Preparation for supporting dynamic timeslice trees -3) Added PCG auto-repair of storage converted to ANNUAL - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.3 -initmty.mod : (2) -ppmain.mod : (3) -eqpeak.mod : (2) -eqptrans.mod : (2) -eqstgtss.mod : (2) -rpt_obj.rpt : (1) -cost_ann.rpt : (1) -rptmisc.rpt : (1) -powerflo.vda : (2) -resloadc.vda : (2) -eqcaflac.vda : (2) -coef_alt.lin : (1) -solve.stp : (2) -solprep.msa : (1) -rptmain.tm : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.5 ------------------------------------------------------------------------------------------ -Date: 27-Jul-2019 [AL]: Maintenance release -1) Improved Data-Only GDX (can be later used as input) -2) Allow for making PRD as a timeslice -3) Allow for larger MAXSOW (above 1800) -4) Fixed bug when DUC and DSCAUTO activated simultaneously -5) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.5 -initmty.mod : (1),(4) -setglobs.gms : (1) -ppmain.mod : (2) -prepxtra.mod : (1) -eqactups.vda : (5) -eqlducs.vda : (4) -clearsol.stp : (5) -prepret.dsc : (5) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.6 ------------------------------------------------------------------------------------------ -Date: 6-Sep-2019 [AL]: Maintenance release -1) Fixed division by zero when very long time-span of RESID -2) Added support for asymmetric load shifting constraints -3) Improved UC_FLO consistency under DYNTS - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.6 -ppmain.mod : (2) -eqobjinv.mod : (1) -eqactups.vda : (2) -uc_flo.mod : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.7 ------------------------------------------------------------------------------------------ -Date: 1-Oct-2019 [AL]: Maintenance release -1) Improved QA checks against undefined currencies -2) Preparations for the ABS extension -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.7 -filparam.gms : (3) -coef_obj.mod : (1) -pp_qack.mod : (1) -initmty.vda : (2) -init_ext.vda : (2) -prep_ext.vda : (2) -coef_ext.vda : (2) -equ_ext.vda : (2) -mod_ext.vda : (2) -eqactups.vda : (2) -eqlducs.vda : (2) -powerflo.vda : (2) -recurrin.stc : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.3.8 ------------------------------------------------------------------------------------------ -Date: 1-Nov-2019 [AL]: Maintenance release -1) Added filtering of data when domain violations -2) Added clearing of EQ_COMBAL levels when FIXBOH -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.3.8 -initmty.mod : (1) -ppmain.mod : (1) -fillvint.gms : (3) -setglobs.gms : (1) -pp_qack.mod : (1) -init_ext.vda : (3) -eqactups.vda : (3) -clearsol.stp : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.4.0 ------------------------------------------------------------------------------------------ -Date: 9-Jan-2020 [AL]: Major release; Added Open Source License -1) 1st release of the ABS extension (Ancillary Balancing Services) -2) Added option for reporting flows of given commodity types at ANNUAL -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.4.0 -maplists.def : (1) -pp_micro.mod : (3) -bnd_elas.mod : (3) -bnd_flo.mod : (3) -eqmain.mod : (3) -uc_cap.mod : (1) -pp_prelv.vda : (3) -eqactups.vda : (1) -rptmisc.rpt : (1),(2) -rptlite.rpt : (1),(2) - -Added files: -*.ABS : ABS extension -LICENSE.txt : GPLv3 License - ------------------------------------------------------------------------------------------ -TIMES Version 4.4.1 ------------------------------------------------------------------------------------------ -Date: 9-Feb-2020 [AL]: Minor release -1) Added experimental implementation for dynamic timeslice trees -2) Fixed small Linux compatibility issues -3) Small improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.4.1 -initmty.mod : (2) -setglobs.gms : (2) -pp_reduce.red : (1) -pp_qafs.mod : (3) -mod_vars.mod : (3) -eqmain.mod : (3) -bndmain.mod : (1),(3) -pp_prelev.vda : (1) -ppm_ext.vda : (1) -equ_ext.vda : (3) -resloadc.vda : (3) -ucbet.vda : (3) -sensis.stc : (1) - -Added file: -dynslite.vda : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.4.2 ------------------------------------------------------------------------------------------ -Date: 1-Jul-2020 [AL]: Minor release -1) Added new attribute REG_BDNCAP for fixing new capacities to previous solution -2) Fixed inconsist spread of short-lived investment costs in first period when OBJ=MOD and D(T1)>2 -3) Improved DATAGDX by renaming GDX at compile time -4) Fixed omission of zero FLO_BND when bounding a reduced flow -5) Small improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.4.2 -initmty.mod : (1) -maindrv.mod : (5) -setglobs.gms : (5) -ppmain.mod : (2) -prepxtra.mod : (3) -bnd_flo.mod : (4) -coef_ptr.mod : (5) -rptmisc.rpt : (5) -err_stat.mod : (5) -spoint.mod : (1) -readbprice.mod: (5) -wrtbprice.mod : (5) -initmty.vda : (5) -solsetv.v3 : (5) -times2veda.vdd: (5) - ------------------------------------------------------------------------------------------ -TIMES Version 4.4.3 ------------------------------------------------------------------------------------------ -Date: 4-Sep-2020 [AL]: Minor release -1) Fixed handling of new attribute REG_BDNCAP when STAGES and no FIXBOH -2) Generalized TIMESED to allow for specifying Base price GDX file name -3) Preparation for forthcoming MLF extension -4) Small improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.4.3 -initmty.mod : (3) -maindrv.mod : (3) -spoint.mod : (1) -readbprice.mod: (2),(3) -wrtbprice.mod : (3) -eqdeclr.mod : (3) -eqmain.mod : (3) -eqobjann.mod : (4) -solve.mod : (3) -rptmain.mod : (3) -eqdamage.mod : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.0 ------------------------------------------------------------------------------------------ -Date: 9-Oct-2020 [AL]: Major release -1) Introducing the new Macro MLF extension -2) Fixed support for input data via GDX file -3) Small improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.0 -initmty.mod : (2) -timslice.mod : (3) -ppmain.mod : (1),(3) -spoint.mod : (1) -wrtbprice.mod : (1) -rptmisc.rpt : (1) -initmty.tm : (1) -mod_vars.tm : (1) -eqdeclr.tm : (1) -eqobj.tm : (1) -eqobjann.tm : (1) -eqobjcst.tm : (1) -mod_equa.tm : (1) -rptmain.tm : (1) -ddfupd.msa : (3) - -Added files : -presolve.mlf : (1) -initmty.mlf : (1) -ppm_ext.mlf : (1) -rpt_ext.mlf : (1) -equ_ext.mlf : (1) -prep_ext.mlf : (1) -calibase.mlf : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.1 ------------------------------------------------------------------------------------------ -Date: 9-Jan-2021 [AL]: Maintenance release -1) Allow back injection from NST storage to grid -2) Support independent AFC equations for storage -3) Small improvements and cleanup - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.1 -ppmain.mod : (1) -maplists.def : (3) -pp_qack.mod : (3) -eqstgtss.mod : (1) -eqstgaux.mod : (1) -eqcaflac.vda : (2) -solsetv.v3 : (3) -times2veda.vdd: (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.2 ------------------------------------------------------------------------------------------ -Date: 15-Feb-2021 [AL]: Maintenance release -1) Fixed GDX load issues with GAMS v342 -2) Fixed rare issue with PASTyear beyond EOH -3) Added reporting of ambiguous marginals of multi-region UC - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.2 -initmty.mod : (1) -setglobs.mod : (1) -ppmain.mod : (2) -rptmisc.rpt : (3) -ucbet.vda : (1) - -Added file: -gdxfilter.gms : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.3 ------------------------------------------------------------------------------------------ -Date: 1-Apr-2021 [AL]: Minor release -1) Fixed bug related to dynamic (t,t+1) type UCs under stochastic mode -2) Added support for non-vintaged FLO_FUNC for vintaged processes -3) Added new attribute NCAP_ISPCT(r,y,p) for proportional investment subsidy -4) Added support for dynamic commodity PRD/NET bounds with UC_DYNBND -5) Cosmetic fixes e.g. for backwards compatibility - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.3 -initmty.mod : (3) -setglobs.gms : (5) -ppmain.mod : (4) -preppm.mod : (3) -prepparm.gms : (3) -coef_obj.mod : (3) -coef_shp.mod : (2) -equ_ext.vda : (4) -equcrtp.vda : (4) -bnd_ucv.mod : (1) -bnd_ucw.mod : (1) -mod_ext.vda : (4) -prepret.dsc : (5) -initmty.stc : (1) -stages.stc : (1) -solsetv.v3 : (5) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.4 ------------------------------------------------------------------------------------------ -Date: 1-May-2021 [AL]: Maintenance release -1) Fixed bug introduced in v4.5.3, related to dynamic bound equations -2) Extended RPT_OPT('CAP','9') to apply to PAR_PASTI as well. - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.4 -equcrtp.vda : (1) -solve.stp : (1) -rptmisc.rpt : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.5 ------------------------------------------------------------------------------------------ -Date: 15-Jun-2021 [AL]: Maintenance release -1) Fix unwanted elimination of NST auxiliary storage flows -2) Support reversed storage flow conversion in AFC equations -3) Improved QA for inconsistent CAP_BND - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.5 -ppmain.mod : (1),(3) -eqcaflac.vda : (2) -bndmain.mod : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.6 ------------------------------------------------------------------------------------------ -Date: 24-Jun-2021 [AL]: Maintenance release -1) Fixed compatibility issues with GAMS v34.2 and above -2) Fixed reporting of storage flows in the special STS+STK case - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.6 -setglobs.gms : (1) -gdxfilter.gms : (1) -rptmisc.rpt : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.8 ------------------------------------------------------------------------------------------ -Date: 29-Sep-2021 [AL]: Minor release - storage improvements -1) Implemented a more flexible STS variant - activate by $SET STSFLX YES (for now) -2) Improved accounting of equilibrium losses for timeslice storage -3) Improved consistency in NCAP_AFC handling for multi-commodity storage -4) Fixed bug introduced by typo in v455 related to CAP_BND(LO) - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.8 -ppmain.mod : (1) -mod_vars.mod : (1) -eqdeclr.mod : (1) -eqcapact.mod : (1) -eqstgtss.mod : (1),(2) -bndmain.mod : (1),(4) -bnd_stg.mod : (1) -mod_equa.mod : (1) -rptmisc.rpt : (1) -ppm_ext.vda : (1),(3) -coef_ext.vda : (1) -eqcaflac.vda : (3) -eqashar.vda : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.5.9 ------------------------------------------------------------------------------------------ -Date: 6-Nov-2021 [AL]: Maintenance release -1) Improved reserve provision bounds under the ABS extension -2) Eliminated unnecessary storage output share constraints for STS - -Modified files: (reason) -initsys.mod : Increased version number to 4.5.9 -clearsol.stp : (1) -eqashar.vda : (2) -initmty.abs : (1) -coef_ext.abs : (1) -mod_vars.abs : (1) -equ_ext.abs : (1) -mod_ext.abs : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.0 ------------------------------------------------------------------------------------------ -Date: 20-Jan-2022 [AL]: Maintenance release -1) Added support for shaping NCAP_COM flows with FLO_FUNCX -2) Improved performance and QA for FLO_FUNCX -3) Cosmetic fixes - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.0 -initmty.mod : (1),(3) -setglobs.gms : (1),(3) -preppm.mod : (2) -coef_nio.mod : (3) -coef_shp.mod : (1),(2) -cal_cap.mod : (1) -cal_caps.mod : (1) -rpt_objc.rpt : (1) -rptmisc.rpt : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.1 ------------------------------------------------------------------------------------------ -Date: 23-Mar-2022 [AL]: Maintenance release -1) Some performance improvement for large models -2) Cosmetic fixes - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.1 -ppmain.mod : (1),(2) -timslice.mod : (1) -preppm.mod : (1) -pp_lvlus.mod : (1),(2) -pp_lvlpk.mod : (1) -pp_reduce.red : (1) -ppm_ext.vda : (1) -eqpeak.mod : (1) -rptmisc.rpt : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.2 ------------------------------------------------------------------------------------------ -Date: 22-May-2022 [AL]: Minor release -1) Added option for including input flows in power level reporting per MVU's wish -2) Cosmetic fix - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.2 -coef_nio.mod : (2) -rptmisc.rpt : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.3 ------------------------------------------------------------------------------------------ -Date: 7-Jul-2022 [AL]: Minor release -1) Added new attribute G_RFRIR for defining risk-free reference rate for hurdle rates -2) Fixed bug that allowed some early retirements revoked when using multi-stage stochastics and early retirements -3) Cosmetic fixes - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.3 -initmty.mod : (1) -setglobs.gms : (1) -preppm.mod : (1) -coef_obj.mod : (1) -eqobjinv.mod : (1) -pp_qack.mod : (3) -prepret.dsc : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.4 ------------------------------------------------------------------------------------------ -Date: 14-Jul-2022 [AL]: Minor release -1) Fixed small reporting bugs related to retrofit processes -2) Improvements in retrofit and lifetime extension implementation - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.4 -setglobs.gms : (1) -ppmain.mod : (2) -rpt_obj.rpt : (2) -rpt_objc.rpt : (1) -rptmisc.rpt : (1) -eqobsalv.mod : (2) -prepret.dsc : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.5 ------------------------------------------------------------------------------------------ -Date: 28-Aug-2022 [AL]: Maintenance release -1) Fixed reporting bug related to retirements when filtering off small capacity values -2) Cosmetic fixes - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.5 -setglobs.gms : (2) -pp_reduce.red : (2) -rptmisc.rpt : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.6 ------------------------------------------------------------------------------------------ -Date: 9-Oct-2022 [AL]: Minor release -1) Added new input attribute NCAP_AFSX for shaping seasonal availability factors -2) Improved a few QA checks -3) Cosmetic fixes - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.6 -initmty.mod : (1) -setglobs.gms : (1),(3) -ppmain.mod : (2),(3) -preppm.mod : (1) -pp_lvlbr.mod : (3) -pp_reduce.red : (3) -pp_chp.mod : (2) -coef_cpt.mod : (1) -pp_shapr.mod : (1) -mod_vars.mod : (3) -eqobj.mod : (3) -eqobjfix.mod : (3) -eqobsalv.mod : (3) -cal_caps.mod : (3) -mod_equa.mod : (3) -pp_qack.mod : (2) -solve.stp : (3) -rpt_obj.rpt : (3) -cost_ann.rpt : (3) -rptmisc.rpt : (3) -solputta.ans : (3) -solsetv.v3 : (3) -rptmain.stc : (3) -prep_ext.vda : (1) -ppm_ext.vda : (1) -coef_ext.vda : (3) -eqobjann.tm : (3) -eqobjcst.tm : (3) -initmty.msa : (3) -rpt_ext.msa : (3) -solve.msa : (3) -prep_ext.mlf : (3) -calibase.mlf : (3) -eqpk_ect.ier : (3) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.7 ------------------------------------------------------------------------------------------ -Date: 19-Nov-2022 [AL]: Minor release -1) Completed S_COM_TAX preprocessing that had been unfinalized -2) Changed forced retrofits for residual capacity to obey RESID trajectory -3) Cosmetic fixes, e.g. set TOLPROJ tolerance, restore MCA compatibility - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.7 -initmty.mod : (1) -setglobs.gms : (1) -ppmain.mod : (1) -curex.gms : (1) -gdxfilter.gms : (3) -solve.mod : (3) -initmty.vda : (1) -prep_ext.stc : (1) -prepret.dsc : (2) -solsetv.v3 : (1) -times2veda.vdd: (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.8 ------------------------------------------------------------------------------------------ -Date: 30-Dec-2022 [AL]: Minor release -1) Added exception support for capacities bounded by REG_BDNCAP -2) Finished off forced retrofits for residual capacity to obey RESID trajectory -3) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.8 -units.def : (3) -spoint.mod : (1) -init_ext.vda : (1) -solve.stp : (3) -rptlite.rpt : (3) -cost_ann.rpt : (3) -prepret.dsc : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.6.9 ------------------------------------------------------------------------------------------ -Date: 23-Jan-2023 [AL]: Minor release -1) Improved effective levelization of various process transformation parameters -2) Streamlined performance of reduced model generation -3) Added support for emissions set directly on CHP activity -4) Cosmetic improvements - -Modified files: (reason) -initsys.mod : Increased version number to 4.6.9 -initmty.mod : (4) -setglobs.gms : (1) -ppmain.mod : (1),(3) -pp_lvlfs.mod : (1) -pp_lvlus.mod : (4) -pp_chp.mod : (3) -pp_reduce.red : (1) -coef_ptr.mod : (1),(2) -coef_shp.mod : (2) -eqobjinv.mod : (4) -eqptrans.mod : (1) -pp_qack.mod : (1) -cal_red.red : (2) -sol_flo.red : (2) -rptmisc.rpt : (4) -initmty.vda : (2) -init_ext.vda : (2) -prep_ext.vda : (1) -pp_prelv.vda : (1),(2),(3) -ppm_ext.vda : (2) -pp_actef.vda : (1) -coef_ext.vda : (2) -initmty.stc : (4) -stages.stc : (2) -sensis.stc : (2) -solputta.ans : (4) - ------------------------------------------------------------------------------------------ -TIMES Version 4.7.0 ------------------------------------------------------------------------------------------ -Date: 25-Feb-2023 [AL]: Major release -1) Fixed bug related to auxiliary STS storage flows introduced in v4.6.9 -2) Fixed backwards compatibility workaround using COM_TYPEs as commodities not in topology -3) Added experimental extension implementing logit market share mechanism -4) Fixed loose ends in the levelization enhancement in v4.6.9 - -Modified files: (reason) -initsys.mod : Increased version number to 4.7.0 -initmty.mod : (3) -ppmain.mod : (4) -pp_lvlfc.mod : (4) -coef_ptr.mod : (1) -sol_flo.red : (4) -initmty.vda : (3) -dynslite.vda : (4) -pp_actef.vda : (2) -pp_prelv.vda : (4) -mod_ext.vda : (3) -mod_vars.tm : (3) - -Added files...: (3) -ppm_ext.ecb -equ_ext.ecb -rpt_ext.ecb - ------------------------------------------------------------------------------------------ -TIMES Version 4.7.1 ------------------------------------------------------------------------------------------ -Date: 9-Apr-2023 [AL]: Maintenance release -1) Added option for preventing cascaded forced retrofits -2) Fixed some loose ends in the recent logit market sharing -3) Added QA check against missing base prices under TIMESED - -Modified files: (reason) -initsys.mod : Increased version number to 4.7.1 -setglobs.gms : (3) -ppmain.mod : (1) -readbprice.mod: (3) -eqdeclr.mod : (1) -pp_qack.mod : (3) -prepret.dsc : (1) -ppm_ext.ecb : (2) -rpt_ext.ecb : (2) -rpt_ext.mlf : (2) -recurrin.stc : (1) - ------------------------------------------------------------------------------------------ -TIMES Version 4.7.2 ------------------------------------------------------------------------------------------ -Date: 9-Jun-2023 [AL]: Maintenance release -1) Added support for non-vintaged ACT_FLO variant -2) Added reporting of first pass LEC under the ECB extension - -Modified files: (reason) -initsys.mod : Increased version number to 4.7.2 -setglobs.gms : (1) -pp_lvlff.mod : (1) -prep_ext.vda : (1) -pp_prelv.vda : (1) -ppm_ext.ecb : (2) -rpt_ext.ecb : (2) - ------------------------------------------------------------------------------------------ -TIMES Version 4.7.3 ------------------------------------------------------------------------------------------ -Date: 3-Jul-2023 [AL]: Maintenance release -1) Fixed bug introduced when using S_FLO_FUNC under stochastic mode -2) Loosened default lower bounds VAR_CLITOT - -Modified files: (reason) -initsys.mod : Increased version number to 4.7.3 -setglobs.gms : (1) -coef_obj.mod : (1) -mod_vars.cli : (2) \ No newline at end of file diff --git a/source/_times.g00 b/source/_times.g00 deleted file mode 100644 index 05c55c3c31d2017b0e431e1f84cb0830763c4dc0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6545 zcmciG2{e@N|2J^5FJEH`eN&8>%7_-Sd@;7dOm;I=ViF}qLSZmOmPBUUx`{+e){rGj z7%j@&KcXmG6UEq4mNC$M^Z)uxWPS~Tu;Dl(DuiF2nh(h75Mu$^-tyfQ!oATH$Ex< zU1$HP|1|%9EW5?sj$31OteuW+O?u(qGaCtr@y~URJMuG$zuS*lVg&@m#rS0_7L>jm znSbZ22p04gc(;5)!aylJ;^F?=kM0d0Rcux99eg_S)hjG~{#s+b@8GkP!@lA3`Bh;* z(&H!B=cn@9O$#0n`c^l+%~8$Dy*Foiw2RMN4H_qle%_S z!+^NWQ*E4SIHxem6`tO}m$DmK67M-4a|$C-!2|dbr@(oI+>Jd%dC$UO=FD8yU+lud zf=m){uWzQF2?Y{e2MUYWwO&qjPQ=c~ZcOMg%W-C{`M6ofn>n{(F1^IuvammVeOGuo z3apxW_J&y=WR{Zjv9#7J?$Qb;oQ$ffa`NS_Gv@+{rw10FI0erSe)cAMz-3B+x9S>QUd7dE-D4qKs#s zPxoxtU+mt#u3gg`2TJH!5PDK;ix!I{7a_qoYZJk zT-c`VN98(}$oq9QN42x_Qn|6>L?2JJv)p**@j#-_0Q)hlfpy$|JcUwL1=A-6bI&zW z%I2c`#YVX2N){dQv_Y|4iV9J}6HjA$&7K(L%9ku2!~bhAM;{+&(x21FdeXxd`Zd=* z%<4clLYs4Bc+63273gnWj*g%F(gwOt6+!O<~JxA zRW(6TaoiV;lnf5{ULmERs^;?8cnp&jL^K;%>oP?4-PgRZr3K3RRv$>k`VUey@M%v zYn%c~`>*w&t^%9!SA${0+T4sr%1z@zk%>G%i2mig` zLqtYx1ZlMfHrE=nF}bU5Xi;f})oQY9Xs#o*g?-gXcOZha97WTh zoPS|4t}#6}@ZIS6xZb<@5O%21>$zwmH{v9{si;?Nd^5TGW@5W}2V~4U7jpfl#-=;O zCbL}_59mZNMulLG7`Gq8Lxup%nQ@&i1jZcYz!7*f>Liqt1#@8_=+4UO`KQZk*K8L#LHV2l7q6R~&# zbqb2ka&lp)(%rx|6^=e)@fgYrG9mXlGn^TVciWC~>=D718|{E0qVNg*4%J_qKx7zW zyi;PTffRC|8)GMZ1#H{N*@mdGr#M5}{H)FL+y~EHX(+ggHcV1sRW{dV7Jf+#xKl*6~!7d-)_ipL~N$SKHNG81@3zyeteIVZ_+ zLp*@PaQ%V|J46w=3mNbS;Sr!jE=2}N5`G)kW!aEtkmWE!5%3o|2U#w{If1}idY2a? z>A@g2q0JplpsIkv)?*dL+v#fH_LMd^vftpYU3M#$ylP8@ohohjIv)aj9`tQn6n zg-hTjB$wTxF1WRPIeoWgEoRIDD5EQCmSemvfO5K4r!9g6hj0u5zzV^JYvDpw01Uzq zUXBY@1Z)sF@Bmz>AmE7bSD(X$?gT6m-^uAnV;QIz&>;69C2sn;K!SGe;LjvKH|UC8 zIQa7h-5D~la|8pE>8_BC-4*cZO}Yzo=~fNK-HK7+XRKL>$+qBO>tq2uVg)XOJ)$yE z1LTqukhwBi#ef!B0JKls?hYB*$${y~!WDkP#buaetJ~#%vYK{?b@jKnelb@oL^~XT z>)-8)L3pV@!SzeH+8}nrUm+!u?&8pw?To>O#Je8oFgp=YKM9LP``RHu{Y0!g+RRQ7 z{FIEvp>^zzf}d_+J&GJI;P0`(&i*q9Ew~OAknVRyq^eh8 z0onf3h-G*XR$isw9Z?G}LWbOIa7z{H_eLzH{n>Ac2v*;XV;J&3aBYd#Tp>L>f6z4f znhR7&u12=N=1Kq)axgYjq2CKJ1UJKm{@L$_=&+6|r|&9m!t`2Da1h!~4a~p6#6d20 z=HRXbrUzt66##$Ul*U4;R5x#z z;DH+$TUIc?20ClB?0To7{p7*p|C5SeeXWgbSX6 z^O1xsmpG*flOw-n$O@j?!^e{?lmKU`q2S$wr_SgQDh#P5d8!=PL&hPsggGu_y70=W zU)$f5|58mW9#Zec5Fy-?{VK!<_M zBvWT}FtrdlCrBs*u8?h!bJB#TKn8gqGC+(_0T__|kpU8fYTyD{85tl=COj|{&33xZY%>#|5ih;tGs0vM4#@o$XuN}9+b&<;{ z%@v)ni4uAItyWB^r70E=l0ShMffpd5ZOg9cy>@}1-;GWe^l7^@U~xjH8(PvX23)m} zFVoc0EW*fJw&4H)zzz|jo{F0gK|hj**|~zvR{ZZE--qfbBtZ;a4H%NQBMBntazL4k zMG_>@Re&v7A4w2E^M7c_*N`oLplbjXvNWSo_qjl{0CG4T(vU* zccu7wKyr36V4`Jc1zkWh2lLx1w9?N|lY|Mkh{4q<0v?F_a1ORkW}*~OQ|Itk!qtMm z5*x@b%Jd9I1d>}%iI^Xz;S;Rgw&B}Gv|KeZM(kr1TrqEtNNfG{N9u5(Y z|0TzQPG+0$J>|F3h&pv4)7Oa-0e^Y&upRa$lUMiA$M31n9*H}eeXCPLr4=vY>ozS6 zt{W0taoazCZJMjhQb@8Ya^AmP^8b0^jbBxqlFB-8d+nO(GB@_O>}u}pOwv4lbVGC3 zOu;1d3D&O8n46vXVzAdBt?Q#E6LnhEro2#d_3?byN4kUg{f(F$d$U-4+dUD^0hXH9 zP|~k3QcL0ZS~6izq~@ydq=TGzLCd{@gA7fzaYfakA7V-9`j;k6rjK9f8pk>JTy2{% zow2(bJLsf0-F&P~X%}gCo?MsMhS!AHugGp=r)v>2E@qZTrj5N%qi&b53nq_$ns$2k z>Y9AR^4o^1^JgEm9%h71w0zy4k^5wC-Ql!DFwH{8J!`sjg{Xw-f;@Qc_j>>QxM>#? z8C1*fY~M#+2e^rcbvmvurv^{TZ)Sfvn-`{HlWO=d_9e^5VG^Q!Hr&0g&2;m~D&&Uv z8UNTz{WZ2!FjY?rTeEHW(jD{8_*e7$0JhQMyVORSUB;YKvTpLV>1OrV3&u5J-klpi zKL(WC>T3Swt}>k4E7?jiBYDPtKR1i@YTnW1`zmumxF|DwE0u+?eu56KhFG#Q`}@=p(Uq{mF1hc^zZgFp>{KdedLnGR8n#Sx znl4b85t>>3x>`HwGSQIb+f~)~+9+1;)r8!PV#a<^r2r*|KkN?^~Hs;r129QNz>WWSRS=?wt08on`O;2v`Dj#se3U>7q0nupY~24 zpoY=D8gD1%tX`XlELhEYL=4YX42sR4GFqxG>osJf+FIG)zqZ3B#!?o>_Kl6RmKLg0 zA|lM%TIS0Q&d3hJD2xAY6$@Fs+03@2t-%+FvTW3?XtmCE7>_8EkT~-pT0mA+AW=-< zyP!qn|A@1u0s#?ssNI+Igij zI{1Gb$2RWY|84&pC6?bOI1~1gvr85wmiP~^{*yjjF%Dl`taovb)Peo{)1fnR&pY1( zOGRmO1Wlu^;kC|pMyk(g4|HZ~9%uf4{FKFMDmIZN22Tsoa@WL)nc# z0K>MG060%Yd{gvwNBmOo|49bqx3F+{qPPBVM8Taty>OESo~n3<*z3jkrRWcwcD?TQ zv=&m_3u*lJna-~dUeTJ@Zgy1})-Ly!%9cu9;?6$L*WII{fDqYPsy8vK7kS_rWr@Z> zMNE|XHQysK(oy0Dv3V2M9FxzSkgwZIGupkOJyHATWaYL&8P-QN7A@dkjQn-sFt$z| zEjDd5q~;E+vwmUCx5a-bm9lq%O^e!B{a$D3!?LbeT>RJQeEjpU+$T(zAmg>f@R+<& z)4{zXqmMgFk2V-TZs>LrJNXoL`BO;$p00+1+@X=!Ap)%_Y%0><@z-Cc25v83$ec(E zYCC0r+cu}GVVZs02z4>y-sPjbF7>cJ^U<7@m4&!BH(LC^;7@8_$n;lja`_hWv>g>> zKYLEi^nS-smE4P?R!ugugW_Lz7I|u1yPSCC&cOc`=D9cZltw07_w}|8J(JsMu&5uH zn0)8M7OmdcTpSkvL#4<^Lq9P8pO9G_lBaLgXEQq@Zl+S?ufYsVEV%QbUM|YuKZgOV znA@xk6-X^1XPq*tT2nZG{d&8O;b&G@eFsHl-^W64JiZ1m14dxX($}>v8nj+W`-pCT z+L&_bg~{Oi-xi$Mq4n(Ksagg%wsXC^ZA7iI^we`yWJlk97WKR-u7AeVa?;+=%%RGlL0;MKlm4ewJM3q8Jj8Ob z>8|B75j5d3t-;?SaprHWTHZE%lCk|lfLy;#(oaTAnL%on!< z)lHW>a5W|iVJ4;`+Z~7ovAPs&v&Y({_F?x% zuclug8?}eIc3uU7=1pOUGe~!DCmGzI+M{3aWHyC;D&-q}}m( z%K2Zy2f)?Z8w*Vp_`x>>^v?P0M} zGZ@fW|A>viG=<|LF#OMaPE1IKKMH@X0X6*iDkEM-<@uCNzGsmh=rRZ}7DJvS#e&Zng@eFm0jVr$b$?mkOxS0ZJ)E8f+!%1U6A%sZ zxf<>hXd&i?b^Uw0Tkh}eZrpKuG5-DEd)ipTW{%6k)*A>L8t5F+Ah@^ngrcxOTbx|Amv^es;6x8FObHU)Fo|wd6FHE?i+Req; zPp0Y0^pa_CztN1cB3&7g?KeF$w?A>8lE2^dlbjpFy1kN;k_$@H$u^?NTv3Z}Kg;H4 zmFH&N@8(JBs~h5NEniVz+6@hN+6}$@@LGVXh{>*+oyFx$92E1);7^Rt4rRYu>s!bOD>oGC2{tfRGHqPXNTYdutU0-8zDu` zqPL}Fgfxg63PcTG8EZXlUm^JG?eTB-h.ETL -*=============================================================================* -FILE ETL / %RUN_NAME%.ETL /; -PUT ETL; -$IF NOT %STAGES% == YES $GOTO REPORT -*----------------------------------------------------------------------------- -* If running stochastics, loop over SOW and write results for each -* For now, no stochastic reporting parameters for ETL are available -*----------------------------------------------------------------------------- -$%SW_NOTAGS% -$ BATINCLUDE mod_vars.etl -$ BATINCLUDE eqdeclr.etl -$%SW_TAGS% -LOOP(SOW, -* Get levels - OPTION CLEAR=VAR_CCAP; - OPTION CLEAR=VAR_CCOST; - OPTION CLEAR=VAR_IC; - OPTION CLEAR=VAR_CAP; - OPTION CLEAR=VAR_NCAP; - VAR_CCAP.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_CCAP.L(R,T,P,W)); - VAR_CCOST.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_CCOST.L(R,T,P,W)); - VAR_IC.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_IC.L(R,T,P,W)); - VAR_CAP.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_CAP.L(R,T,P,W)); - VAR_NCAP.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_NCAP.L(R,T,P,W)); - PUT_UTILITY 'REN' / '%RUN_NAME%-',SOW.TL:0,'.ETL' ; -$LABEL REPORT -*----------------------------------------------------------------------------- - -ETL.PW=1000; -ETL.ND=4; - -PUT /"Generated by ATLEARN.ETL"/; -PUT "-----------------------"; -PUT /"Date: ", SYSTEM.DATE, " (M/D/Y)"; -PUT /"Time: ", SYSTEM.TIME; -PUT /"-------------------------------------"; -PUT /"MODELSTAT AND SOLVESTAT INFO"; -PUT /"Modelstat : ", %MODEL_NAME%.MODELSTAT:2:0; -PUT /"Solvestat : ", %MODEL_NAME%.SOLVESTAT:2:0; -PUT /"Number of iterations : ", %MODEL_NAME%.ITERUSD:7:0; -PUT /"Number of variables : ", %MODEL_NAME%.NUMVAR:7:0; -PUT /"Number of equations : ", %MODEL_NAME%.NUMEQU:7:0; - -PUT /"Maximum number of segments: ", (CARD(KP)-1):3:0," (SET KP defined in MMINIT.INC)"; -PUT /"Number of periods T : ", CARD(T):3:0 - -PUT //"---------------------------------------------------------------------------------------"/; -PUT "* Input learning PARAMETERS:"; -PUT " - Progress ratio, Start cost, Initial Cum. Cap., max. Cum. Cap"/; -PUT " - Indicators derived from these: Floor cost (absolute and as percentage)"/; -PUT " - Max. number of doublings, number of segments linearization"/; -PUT "* Cluster input info:"/; -PUT " - number of PRC's in cluster of key TEG (if any)"/; -PUT " - PRC's per cluster and coupling factor"/; -PUT "---------------------------------------------------------------------------------------"/; -PUT //"* PRC/REG", @30 "Description" @60 -PUT " Pr SC0"; -PUT " CCAP0 CCAPM FLOOR perc. n #seg" -PUT " #tch"/; -LOOP((TEG,REG)$SEG(REG,TEG), - PUT "KEY.",TEG.TL:0, '/REG.',REG.TL:0, @30, PRC.TE(TEG):30, @60 - PRAT(REG,TEG):10:3, - SC0(REG,TEG):10:2, - CCAP0(REG,TEG):10:4, - CCAPM(REG,TEG):10:4, -* floor cost implied - (PAT(REG,TEG)*(CCAPM(REG,TEG)**(-PBT(REG,TEG)))):10:2, - ((PAT(REG,TEG)*(CCAPM(REG,TEG)**(-PBT(REG,TEG))))/SC0(REG,TEG)*100):10:2, - (LOG(CCAPM(REG,TEG)/CCAP0(REG,TEG))/LOG(2)):10:2, - SEG(REG,TEG):10:0, - NTCHTEG(REG,TEG):10:0 - ; - PUT /; -* cluster PRC's and coupling factors plus INVCOS - LOOP(PRC$(CLUSTER(REG,TEG,PRC) GT 0), - PUT " ",PRC.TL:0; - PUT PRC.TE(PRC):30; - PUT CLUSTER(REG,TEG,PRC):10:3; - PUT /; - ); - - ); - -PUT //"Levels of learning variables: Cum. Cap. (CCAP) and Specific Cost"/; -PUT "k is for learning key technologies (in set TEG)"/; -PUT "c is for technology in corresponding cluster defined by CLUSTER(REG,TEG,PRC)"/; -PUT "------------------------------------------------------------------------"/; -$BATINCLUDE ATLEARN1.ETL VAR_CCAP 'Cumulative capacity' CCA 1 4 - -$BATINCLUDE ATSC.ETL - - -PUT //"Levels of TEG and PRC INV, CAP variables"/; -PUT "Results in order of Key technologies (TEG) and technologies in corresponding cluster"/; -PUT "Technologies in clusters may appear more than once if they belong to more than one cluster"/; -PUT "*-----------------------------------------------------------------------------------------"/; - -PUT "* INV CAP plus CAP growth factors"/; -PUT "* CAM : maximum capacity based on (user-provided) growth factors"/; -PUT "* GRP : growth in capacity in one period (CAP(T)/CAP(T-1))"/; -PUT "* GRA : average annual growth in NYEARS of period T"/; -PUT "* GRF : growth factor (input): TID and time-dependent"/; -PUT "*-----------------------------------------------------------------------------------------"/; - -$INCLUDE ATLEARN8.ETL - -$IF %STAGES%==YES ); -PUTCLOSE ETL; -$IF %STAGES%==YES $EXIT -*----------------------------------------------------------------------------- -* Exporting capital cost data for clustered technologies - -* Create a set of all key components -* Create a set of all clustered technologies - LOOP((RP(R,P),PRC)$((CLUSTER(R,P,PRC) > 0.0)$CLUSTER(R,P,PRC)), - TL_RP_KC(R,P) = YES; TL_RP_CT(R,PRC) = YES); - - TL_CT_COST(REG,MILESTONYR,PRC,CUR)$TL_RP_CT(REG,PRC) = OBJ_ICOST(REG,MILESTONYR,PRC,CUR) + - INVC_UNIT(REG,MILESTONYR,PRC) + -* Costs of key components in same region - SUM(P$CLUSTER(REG,P,PRC), (OBJ_ICOST(REG,MILESTONYR,P,CUR) + INVC_UNIT(REG,MILESTONYR,P)) * CLUSTER(REG,P,PRC)) + -* Costs of multi-regional key components - SUM(RP(R,P)$TL_MRCLUST(R,P,REG,PRC), (OBJ_ICOST(R,MILESTONYR,P,CUR) + INVC_UNIT(R,MILESTONYR,P)) * TL_MRCLUST(R,P,REG,PRC)); -*----------------------------------------------------------------------------- diff --git a/source/atlearn1.etl b/source/atlearn1.etl deleted file mode 100644 index 8263693..0000000 --- a/source/atlearn1.etl +++ /dev/null @@ -1,57 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* File : ATLEARN1.ML -* Language : GAMS -* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES -* Origin : 02-06-98 -* Last edit : 07-27-01 -* Warning : -* Purpose : generic content of AT output -* Location : TIMES directory -* Called : at the end of ATLEARN.ETL -* Output : .ETL -*=============================================================================* -* %1 IS VARIABLE TO BE OUTPUTTED -* %2 is name of table -* %3 is prefix of row -* %4 is 1 if CCAPM is to be output -* %5 is number of decimals - -PUT /"%2 %1"/; -PUT @63, LOOP(T,PUT T.TL:10); -IF (%4 GT 0, PUT "CCAPM % reached"; - ); -PUT /; - -LOOP((TEG,REG)$SEG(REG,TEG), - PUT "k",".%3.",TEG.TL:0 '/r.'REG.TL:0, ' '; - PUT @30, PRC.TE(TEG):30 @60; - LOOP(T, - IF (%1.L(REG,T,TEG) GT 0, - PUT %1.L(REG,T,TEG):10:%5; - ELSE PUT " 0"; - ); - IF ((ORD(T) EQ CARD(T)) AND (%4 GT 0), - PUT " ",CCAPM(REG,TEG):10:2; PUT (100 - 100*(CCAPM(REG,TEG)-VAR_CCAP.L(REG,T,TEG))/ - (CCAPM(REG,TEG)-CCAP0(REG,TEG))):10:2; - ); - ); - PUT /; -* print PRC in TEG cluster - IF(%4 EQ 0, - LOOP(PRC$(CLUSTER(REG,TEG,PRC) GT 0), - PUT "c",".%3.",PRC.TL:0; - PUT @30, PRC.TE(PRC):30 @60; - LOOP(T, - IF (%1.L(REG,T,PRC) GT 0, - PUT %1.L(REG,T,PRC):10:%5; - ELSE PUT " 0"; - ); - ); - PUT /; - ); - ); - ); diff --git a/source/atlearn8.etl b/source/atlearn8.etl deleted file mode 100644 index 485fca8..0000000 --- a/source/atlearn8.etl +++ /dev/null @@ -1,44 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* File : ATLEARN8.ETL -* Language : GAMS -* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES -* Origin : 04-02-00 -* Last edit : 07-27-01 -*=============================================================================* -* loop over TEG, PRC for key and clusters -* INV CAP -* CAM : maximum capacity based on growth factors -* GRP : growth in capacity in one period (CAP(TP)/CAP(TP-1)) -* GRA : average annual growth in NYEARS of period TP -* GRF : growth factor (input): TID and time-dependent - -LOOP((TEG,REG)$SEG(REG,TEG), -* Investment levels - PUT /; -* first output for key, next its cluster PRC's -$BATINCLUDE ATLEARN9.ETL k VAR_NCAP TEG 0 INV - LOOP(PRC$CLUSTER(REG,TEG,PRC), -$BATINCLUDE ATLEARN9.ETL c VAR_NCAP PRC 0 INV - ); - -* Capacity levels and growth factors (input and resulting) - PUT /; -$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 0 CAP -$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 1 CAM -$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 2 GRP -$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 3 GRA -$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 4 GRF - - LOOP(PRC$CLUSTER(REG,TEG,PRC), -$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 0 CAP -$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 1 CAM -$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 2 GRP -$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 3 GRA -$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 4 GRF - ); - - ); diff --git a/source/atlearn9.etl b/source/atlearn9.etl deleted file mode 100644 index e28ad2b..0000000 --- a/source/atlearn9.etl +++ /dev/null @@ -1,78 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* File : ATLEARN9.ETL -* Language : GAMS -* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES -* Origin : 04-02-00 -* Last edit : 07-27-01 -*=============================================================================* -* %1 = k or c -* %2 = VAR_NCAP or VAR_CAP -* %3 = TEG or PRC -* %4 = 0 1 2 3 4 -* 0 is for variable INV or CAP -* 1 CAM; 2 GRP; 3 GRA; 4 GRF; -* %5 = INV or CAP or CAM or GRP or GRA or GRF; - - - PUT "%1",".%5.",%3.TL:0, '/r.', REG.TL:0, @30; - PUT PRC.TE(%3):30 @74; - LOOP(T, - IF (%4 EQ 0, - PUT %2.L(REG,T,%3):10:2; - ); - -* maximum capacity based on growth factors -* IF (%4 EQ 1, -* -* IF ((PRC_TGR(%3,T) + PRC_GRTI(%3)) GT 0, -* PUT ((PRC_TGR(%3,T)**NYRSPER)*CAP.L(T-1,%3) + -* PRC_GRTI(%3) -* ):10:2; -* ELSE PUT " -"; -* ); -* -* ); - -* period growth factor CAP(T)/CAP(T-1) - IF (%4 EQ 2, - - IF (VAR_CAP.L(REG,T-1,%3) GT 0, - PUT (VAR_CAP.L(REG,T,%3)/(VAR_CAP.L(REG,T-1,%3))):10:2; - ELSE PUT " -"; - ); - ); - -* average annual growth factor in period T compared to T-1 - IF (%4 EQ 3, - IF (VAR_CAP.L(REG,T-1,%3) GT 0, - PUT ((VAR_CAP.L(REG,T,%3)/VAR_CAP.L(REG,T-1,%3))**(1/D(T))):10:2; - ELSE PUT " -"; - ); - - ); -* user-provided maximum growth factors: for the first T, the TID -* growth factor is given, if provided -* IF (%4 EQ 4, -* -* IF (ORD(T) EQ 1, -* IF (PRC_GRTI(%3) GT 0, -* PUT TCH_GRTI(%3):10:2; -* ELSE PUT " -"; -* ); -* ELSE -* IF (PRC_TGR(%3,T) GT 0, -* PUT (TCH_TGR(%3,T)):10:2; -* ELSE PUT " -"; -* ); -* ); -* ); -* -* - ); - - PUT /; - diff --git a/source/atsc.etl b/source/atsc.etl deleted file mode 100644 index c6c423f..0000000 --- a/source/atsc.etl +++ /dev/null @@ -1,68 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -******************************************************************************************************** -* File : ATSC.ETL -* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES -* last edit : 07-27-01 -******************************************************************************************************** - -PUT /"Specific investment Cost SC(T) for key TEG and INVCOS per PRC in cluster of key"; -PUT /"-----------------------------------------------------------------------------------------------"; -PUT /"SCU: Specific Cost (per Unit) for key: linearized"; -PUT /"FOR: specific cost for key: end of T according to exact FORmula: sc = a * ccap ** (-b)"; -PUT /"INC: INvesment cost (per unit) for PRC in cluster key (exogenous, input value, equals INVCOST)"; -PUT /"-----------------------------------------------------------------------------------------------"//; -PUT @63, PUT "Start (SC0) ", LOOP(T,PUT T.TL:10); PUT "% of SC0"/; - -LOOP(RTP(R,T,TEG)$((VAR_NCAP.L(R,T,TEG) NE 0)$SEG(R,TEG)), - INVC_UNIT(R,T,TEG) $= VAR_IC.L(R,T,TEG)/VAR_NCAP.L(R,T,TEG); -); - -PREV(RP(R,TEG)) = SC0(R,TEG); -LOOP((TEG,REG)$SEG(REG,TEG), -* specific cost for key: linearized - PUT "k",".SCU.",TEG.TL:0 "/r.", REG.TL:0, @30; - PUT PRC.TE(TEG):30 @60; - PUT SC0(REG,TEG):14:0; - LOOP(T, - IF (INVC_UNIT(REG,T,TEG) GT 0, - PUT INVC_UNIT(REG,T,TEG):10:2; - PREV(REG,TEG) = INVC_UNIT(REG,T,TEG); - ELSE PUT PREV(REG,TEG):10:2; - ); - ) - PUT /; - -* specific cost for key: end of T according to exact formula - PUT "k",".FOR.",TEG.TL:0, "/r.", REG.TL:0, @30 PRC.TE(TEG):30 @60; - PUT SC0(REG,TEG):14:0; -*formula: sc = a * ccap ** (-b) - LOOP(T, -* TEG may have START>1 - IF (RTP(REG,T,TEG), - PUT (PAT(REG,TEG)*(VAR_CCAP.L(REG,T,TEG)**(-PBT(REG,TEG)))):10:2; - IF (ORD(T) EQ CARD(T), - PUT (100*(((PAT(REG,TEG)* - (VAR_CCAP.L(REG,T,TEG)**(-PBT(REG,TEG)))))/SC0(REG,TEG)) - ):11:2; - ); - ELSE PUT SC0(REG,TEG):10:2; - ); - - ); - PUT /; -* specific cost for PRC in cluster key: input value - - LOOP(PRC$(CLUSTER(REG,TEG,PRC) GT 0), - PUT "c",".INC.",PRC.TL:0, @30; - PUT PRC.TE(PRC):30; - LOOP(T, - PUT (SUM(CUR,NCAP_COST(REG,T,PRC,CUR))):10:2; - ); - PUT /; - ); - - PUT /; - ); diff --git a/source/bnd_act.mod b/source/bnd_act.mod deleted file mode 100644 index 70f6a55..0000000 --- a/source/bnd_act.mod +++ /dev/null @@ -1,26 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_ACT.MOD set the actual bounds for non-vintage VAR_ACTs -*=============================================================================* -*GaG Questions/Comments: -* - FX take precedence as is set last!!! -*----------------------------------------------------------------------------- -*$ONLISTING -* reset any existing bounds - %VAR%_ACT.LO(R,V,T,P,S%SWD%) = 0; - %VAR%_ACT.UP(R,V,T,P,S%SWD%) = INF; - -* assign from user data - only set bounds directly at the PRC_TS level - -$IF %STAGES% == YES $SETLOCAL SWT SW_T(T%SWD%)$ - - %VAR%_ACT.LO(RTP_VINTYR(R,T,T,P),S%SWD%)$(%SWT% PRC_TS(R,P,S) * (NOT PRC_VINT(R,P))) $= ACT_BND(R,T,P,S,'LO'); - %VAR%_ACT.UP(RTP_VINTYR(R,T,T,P),S%SWD%)$(%SWT% PRC_TS(R,P,S) * (NOT PRC_VINT(R,P))) $= ACT_BND(R,T,P,S,'UP'); - %VAR%_ACT.FX(RTP_VINTYR(%R_T%,T,P),S%SWD%)$(%SWT%PRC_TS(R,P,S)* (NOT PRC_VINT(R,P))) $= ACT_BND(R,T,P,S,'FX'); -* for upper bounds of zero, activity variables of all vintages can be bounded to zero - %VAR%_ACT.UP(RTP_VINTYR(R,V,T,P),S%SWD%)$(%SWT% PRC_TS(R,P,S) * PRC_VINT(R,P)$RTPS_OFF(R,T,P,S)) = EPS; - -*$OFFLISTING diff --git a/source/bnd_cum.mod b/source/bnd_cum.mod deleted file mode 100644 index dd0a9ed..0000000 --- a/source/bnd_cum.mod +++ /dev/null @@ -1,48 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_CUM.MOD set the actual bounds for cumulative variables -*=============================================================================* -$SETLOCAL SW1 '' SETLOCAL SW2 "" -$IF %STAGES%==YES $SETLOCAL SW1 'S_' SETLOCAL SW2 ",'1'%SOW%" - -* Ignore negative bounds; reset any N bounds at specific years - %SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%)$((%SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%) LT 0)$%SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%)) = 0; - FLO_CUM(R,P,C,YEAR,'EOH','N') $= FLO_CUM(R,P,C,YEAR,'%EOTIME%','N'); - FLO_CUM(RPC_CUMFLO(R,P,C,YEAR,LL),'N') = 0; - - %SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'FX'%SW2%) = %SW1%FLO_CUM(R,P,C,YEAR,LL,'FX'%SW2%)$BDNEQ(BD); - -* Get modifiers for flexible model horizon - LOOP((SAMEAS(J,'1'),MIYR_L), OPTION CLEAR=UNCD7; UNCD7(RPC_CUMFLO(R,P,C,YEAR,'%EOTIME%'),J+(FLO_CUM(R,P,C,YEAR,'EOH','N')-1),'')=YES; - LOOP(UNCD7(R,P,C,YEAR,LL,JJ,''), FLO_CUM(R,P,C,YEAR,LL,'N') = MIN(0,ABS(MULTI(JJ,MIYR_L))-1)$MULTI(JJ,MIYR_L))); - -* Set bounds - %VAR%_CUMFLO.LO(R,P,C,YEAR,LL %SOW%)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%) = %SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); - %VAR%_CUMFLO.UP(R,P,C,YEAR,LL %SOW%)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%) = %SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); - -* Reset any N bounds at specific years - COM_CUM(R,%1,YEAR,'0',C,'N') $= COM_CUM(R,%1,YEAR,'%EOTIME%',C,'N'); - COM_CUM(RC_CUMCOM(R,%1,YEAR,LL,C),'N') = 0; - - %SW1%COM_CUM(R,%1,YEAR,LL,C,BD%SW2%)$%SW1%COM_CUM(R,%1,YEAR,LL,C,'FX'%SW2%) = %SW1%COM_CUM(R,%1,YEAR,LL,C,'FX'%SW2%)$BDNEQ(BD); - %SW1%COM_CUM(RC_CUMCOM(R,%1,LL,YEAR,C),BD%SW2%)$(YEARVAL(LL)>MIYR_VL)=EPS; RC_CUMCOM(R,%1,LL,YEAR,C)$(YEARVAL(LL)>MIYR_VL)=NO; - -* Get modifiers for flexible model horizon - LOOP((SAMEAS(J,'1'),MIYR_L), OPTION CLEAR=UNCD7; UNCD7(RC_CUMCOM(R,%1,YEAR,'%EOTIME%',C),J+(COM_CUM(R,%1,YEAR,'0',C,'N')-1),'')=YES; - LOOP(UNCD7(R,%1,YEAR,LL,C,JJ,''), COM_CUM(R,%1,YEAR,LL,C,'N') = MIN(0,ABS(MULTI(JJ,MIYR_L))-1)$MULTI(JJ,MIYR_L))); - -* Set bounds - %SW1%COM_CUM(RC_CUMCOM(R,%1,YEAR,LL,C),L('LO')%SW2%)$(NOT %SW1%COM_CUM(RC_CUMCOM,L%SW2%)) = -INF$SUM((RTC(R,T,C),ANNUAL(S)),MIN(0,COM_BNDPRD(RTC,S,L)$DIAG(%1,'PRD')+COM_BNDNET(RTC,S,L)$DIAG(%1,'NET')+1-1)); - %VAR%_CUMCOM.LO(R,C,%1,YEAR,LL %SOW%)$%SW1%COM_CUM(R,%1,YEAR,LL,C,'LO'%SW2%) = %SW1%COM_CUM(R,%1,YEAR,LL,C,'LO'%SW2%)*(1/%CUCSCAL%)*(COM_CUM(R,%1,YEAR,LL,C,'N')+1); - %VAR%_CUMCOM.UP(R,C,%1,YEAR,LL %SOW%)$%SW1%COM_CUM(R,%1,YEAR,LL,C,'UP'%SW2%) = %SW1%COM_CUM(R,%1,YEAR,LL,C,'UP'%SW2%)*(1/%CUCSCAL%)*(COM_CUM(R,%1,YEAR,LL,C,'N')+1); - -$IFI %MACRO%==YES $EXIT -* Set lower bound for combined costs to -INF - LOOP(COST_GMAP(COSTCAT,COSTAGG,COSTYPE), - %VAR%_CUMCST.LO(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%)$REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'UP') = -INF); - %VAR%_CUMCST.UP(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%) $= REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'UP'); - %VAR%_CUMCST.LO(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%) $= REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'LO'); - %VAR%_CUMCST.FX(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%) $= REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'FX'); diff --git a/source/bnd_elas.mod b/source/bnd_elas.mod deleted file mode 100644 index 48c69e3..0000000 --- a/source/bnd_elas.mod +++ /dev/null @@ -1,40 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_ELAS.MOD establishes bounds on demand elasticity variables -* %1 - LO/UP step limit -*=============================================================================* -* Questions/Comments: -* - RCJ includes testing for COM_STEP -* - May want elasticity without COM_PROJ - may use COM_BQTY -*----------------------------------------------------------------------------- - OPTION CLEAR=MI_DOPE; - LOOP((ANNUAL(S),MI_DMAS(RD_AGG(R,C),COM)), - RD_SHAR(R,T,COM,C)=COM_AGG(R,T,COM,C)*DDF_PREF(R,T,C); - COM_AGG(R,T,COM,C)$(COM_ELAST(R,T,C,S,'N')>0)=0; - COM_ELAST(R,T(MIYR_1),COM,TS,BD)=0; - COM_VOC(RTC(R,T,COM),'LO')$MI_ESUB(R,T,C)=MIN(COM_VOC(RTC,'LO'),1-9E9**(-COM_ELAST(RTC,S,'FX'))); - MI_DOPE(R,T,COM)$MI_ESUB(R,T,C)=MAX(ABS(COM_ELAST(R,T,COM,S,'FX')),MI_ESUB(R,T,C))$SUM(BDNEQ$COM_ELAST(R,T,C,S,BDNEQ),1)); - -$IF %STAGES% == YES LOOP(SW_T(T%SOW%), - - %VAR%_ELAST.UP(RTCS_VARC(R,T,C,S),J,BDNEQ(BD)%SOW%)$RCJ(R,C,J,BD) = INF$MI_DOPE(R,T,C) + - (MAX(DDF_QREF(R,T,C) * COM_FR%MX%(R,T,C,S), COM_BQTY(R,C,S)) * COM_VOC(R,T,C,BD)) / COM_STEP(R,C,BD); - -$IF %STAGES% == YES ); - -* Price levels for CES (marginal / average) - MI_RHO(RTC(R,T,C))$MI_DOPE(RTC) = ROUND(1-1/MI_DOPE(RTC),6); - MI_AGC(R,T(TT+1),COM,C,J,BDNEQ(BD))$(RCJ(R,C,J,BD)$MI_DMAS(R,COM,C)$MI_ESUB(R,T,COM)) = (1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**(-1/COM_ELAST(R,T,C,'ANNUAL','FX')); - MI_AGC(R,T,COM,C,J,BD)$((COM_VOC(R,T,C,BD)>0)$MI_AGC(R,T,COM,C,J,BD)$MI_DOPE(R,T,C)) = - BDSIG(BD)/(ORD(J)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD)) * - (((1-(1-BDSIG(BD)*ORD(J)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**MI_RHO(R,T,C))/MI_RHO(R,T,C))$MI_RHO(R,T,C) - - LOG(1-BDSIG(BD)*ORD(J)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))$(MI_RHO(R,T,C)=0)); - -* Fix redundancies - LOOP(RD_AGG(R,COM),FIL(T)=NOT PROD(BDNEQ,SUM(COM_TS(R,C,S)$MI_DMAS(R,COM,C),COM_ELAST(R,T,C,S,BDNEQ))); - COM_ELAST(RTCS_VARC(R,T(FIL),C,S),BD)$MI_DMAS(R,COM,C)=0; RCS_COMPRD(R,T(FIL),COM,S,BD)=NO); - COM_ELASTX(R,T,C,BDNEQ)$MI_DOPE(R,T,C)=1; - RTC_SHED(R,T,C,BD,JJ)$MI_DOPE(R,T,C)=NO; diff --git a/source/bnd_flo.mod b/source/bnd_flo.mod deleted file mode 100644 index 81b1ffe..0000000 --- a/source/bnd_flo.mod +++ /dev/null @@ -1,40 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_FLO.MOD set the actual bounds for non-vintage VAR_FLOs * -*=============================================================================* -*UR Questions/Comments: -*----------------------------------------------------------------------------- -*$ONLISTING -* reset any existing bounds - %VAR%_FLO.LO(R,V,T,P,C,S%SWD%) = 0; - %VAR%_FLO.UP(R,V,T,P,C,S%SWD%) = INF; - -* assign from user data - FLO_BND(R,T,P,C,S,'LO')$((NOT RPC_EMIS(R,P,C))$(FLO_BND(R,T,P,C,S,'LO')=0)$RP_FLO(R,P))=0; - LOOP((RTPC(R,T,P,C),S,BD)$FLO_BND(RTPC,S,BD),TRACKPC(RP_FLO(R,P),C)=YES); - TRACKPC(PRC_VINT(R,P),C) = NO; - TRACKPC(RPC_FFUNC(R,P,C))= NO; - TRACKPC(RPC_EMIS(R,P,C)) = NO; -* Mark all tuples that definitely cannot be handled by VAR bounds - LOOP(T,FLO_BND(R,'%DFLBL%',P,C,S,BD)$FLO_BND(R,T,P,C,S,BD) = EPS$(NOT TRACKPC(R,P,C)); - FLO_BND(R,'%DFLBL%',P,CG,S,BD)$((NOT C(CG))$FLO_BND(R,T,P,CG,S,BD)) = EPS); - TRACKPC(RPC_ACT(R,P,C)) = NO; - -$IF %STAGES% == YES LOOP(SW_T(T%SWD%), - %VAR%_FLO.LO(RTP_VINTYR(R,T,T,P),C,S%SWD%)$((RTPCS_VARF(R,T,P,C,S)*TRACKPC(R,P,C))$FLO_BND(R,T,P,C,S,'LO')) = FLO_BND(R,T,P,C,S,'LO'); - %VAR%_FLO.UP(RTP_VINTYR(R,T,T,P),C,S%SWD%)$((RTPCS_VARF(R,T,P,C,S)*TRACKPC(R,P,C))$FLO_BND(R,T,P,C,S,'UP')) = FLO_BND(R,T,P,C,S,'UP'); - %VAR%_FLO.FX(RTP_VINTYR(R,T,T,P),C,S%SWD%)$((RTPCS_VARF(R,T,P,C,S)*TRACKPC(R,P,C))$FLO_BND(R,T,P,C,S,'FX')) = FLO_BND(R,T,P,C,S,'FX'); -$IF %STAGES% == YES ); - OPTION CLEAR=TRACKPC; - -*$OFFLISTING -$IF NOT '%REDUCE%' == 'YES' $EXIT -$IF %STAGES% == YES $SETLOCAL SWT "%SWD%)$SW_T(T%SWD%" -* As BND_ACT has been set before this, MAX/MIN can be used; FX bound consistency cannot be guaranteed - LOOP(RTPCS_VARF(R,T,P,C,S)$(((NOT PRC_VINT(R,P))*RPC_ACT(R,P,C))$FLO_BND(R,T,P,C,S,'LO')),%VAR%_ACT.LO(R,T,T,P,S%SWT%) = MAX(%VAR%_ACT.LO(R,T,T,P,S%SWT%),FLO_BND(R,T,P,C,S,'LO')/PRC_ACTFLO(R,T,P,C))); - LOOP(RTPCS_VARF(R,T,P,C,S)$(((NOT PRC_VINT(R,P))*RPC_ACT(R,P,C))$FLO_BND(R,T,P,C,S,'UP')),%VAR%_ACT.UP(R,T,T,P,S%SWT%) = MIN(%VAR%_ACT.UP(R,T,T,P,S%SWT%),FLO_BND(R,T,P,C,S,'UP')/PRC_ACTFLO(R,T,P,C))); - LOOP(RTPCS_VARF(R,T,P,C,S)$(((NOT PRC_VINT(R,P))*RPC_ACT(R,P,C))$FLO_BND(R,T,P,C,S,'FX')),%VAR%_ACT.FX(R,T,T,P,S%SWT%) = FLO_BND(R,T,P,C,S,'FX')/PRC_ACTFLO(R,T,P,C)); - diff --git a/source/bnd_ire.vda b/source/bnd_ire.vda deleted file mode 100644 index bd535eb..0000000 --- a/source/bnd_ire.vda +++ /dev/null @@ -1,39 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_IRE.VDA bounds IRE flows and set prices from previous run if requested -*=============================================================================* -$IF NOT DEFINED PREMILE $EXIT - RPC_IREIN(RPC_IREIO) = NO; - PAR_IRE(R,V,T,P,C,TS,IE)$(NOT RPC_IREIN(R,P,C,IE,'IN')) = 0; - PAR_IPRIC(R,T,P,C,TS,IE)$(NOT RPC_IREIN(R,P,C,IE,'IN')) = 0; - PARAMETER FLO_IRE(R,LL,P,C,S,IE); - IF(CARD(PAR_IRE), - %VAR%_IRE.FX(RTP_VINTYR(R,V,PREMILE(T),P),C,TS,IE%SWD%)$(((NOT RPC_AIRE(R,P,C))*RPCS_VAR(R,P,C,TS))$RPC_IREIN(R,P,C,IE,'IN')) = - EPS+PAR_IRE(R,V,T,P,C,TS,IE); - LOOP(IE,FLO_BND(R,PREMILE(T),P,C,TS,'FX')$((RPC_AIRE(R,P,C)*RTPCS_VARF(R,T,P,C,TS))$RPC_IREIN(R,P,C,IE,'IN')) = - EPS+SUM(RTP_VINTYR(R,V,T,P),PAR_IRE(R,V,T,P,C,TS,IE))); - ); -* Set target milestone years into FIL - OPTION CLEAR=FIL; LOOP(T$(NOT PREMILE(T)),FIL(TT)$YK(TT,T) = YES); -* Calculate total flows at milestone years - FLO_IRE(R,PREMILE,P,C,TS,IE)$(RPCS_VAR(R,P,C,TS)$RPC_IREIN(R,P,C,IE,'IN')) = - SUM(YK(PREMILE,LL)$PAR_IRE(R,LL,PREMILE,P,C,TS,IE),PAR_IRE(R,LL,PREMILE,P,C,TS,IE))+EPS; - DM_YEAR(PREMILE) = YES; -$BATINCLUDE fillcost FLO_IRE R 'P,C,TS,IE' ",'0'" FIL CARD(FIL) '' '' FLO_IRE X_IREFLO -$BATINCLUDE fillcost PAR_IPRIC R 'P,C,TS,IE' ",'0'" FIL CARD(FIL) '' '' PAR_IPRIC X_IREFLO -* Set bounds for T not in sync with PREMILE - LOOP(IE$CARD(FIL),TRACKPC(R,P,C)$((RPC_AIRE(R,P,C)+PRC_VINT(R,P))$RPC_IREIN(R,P,C,IE,'IN')) = YES); - %VAR%_IRE.FX(RTP_VINTYR(R,FIL(T),T,P),C,TS,IE%SWD%)$(((NOT TRACKPC(R,P,C))*RPCS_VAR(R,P,C,TS))$RPC_IREIN(R,P,C,IE,'IN')) = - EPS+FLO_IRE(R,T,P,C,TS,IE); -* Remove TRACKPC with either IMP or EXP internal, as FLO_BND will be applied to the SUM - LOOP(IE,TRACKPC(R,P,C)$((NOT RPC_IREIN(R,P,C,IE,'IN'))$RPC_IRE(R,P,C,IE)) = NO); - FLO_BND(R,FIL(T),P,C,TS,'FX')$((RPC_AIRE(R,P,C)*RTPCS_VARF(R,T,P,C,TS))$TRACKPC(R,P,C)) = - EPS+SUM(RPC_IREIN(R,P,C,IE,'IN'),FLO_IRE(R,T,P,C,TS,IE)); - OPTION CLEAR=TRACKPC,CLEAR=FLO_IRE; -* Set the IRE prices - LOOP(T$CARD(PAR_IPRIC), - OBJ_IPRIC(R,Y_EOH,P,C,TS,IE,CUR)$(PERIODYR(T,Y_EOH)$RPCS_VAR(R,P,C,TS)$RPC_IREIN(R,P,C,IE,'IN')) = - PAR_IPRIC(R,T,P,C,TS,IE)); diff --git a/source/bnd_macro.tm b/source/bnd_macro.tm deleted file mode 100644 index d12a256..0000000 --- a/source/bnd_macro.tm +++ /dev/null @@ -1,38 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* Set the Cut-off Point for Applying the Market Penetration Cost Penalty * -*============================================================================* - TM_CAPTB(R,P) = SUM(RTP(R,T,P),TM_EXPBND(RTP)); -* set the bounds for the step variables for quad approx, * clearing them first - VAR_XCAPP.UP(RTP,J) = INF; - VAR_XCAPP.UP(RTP(R,T,P),XCP(J))$((ORD(J)<7)$TM_CAPTB(R,P)) = TM_CAPTB(R,P); - -*============================================================================* -* Set the Lower Bound and Fix the First Year * -* - Demands * -* - Investment * -* - Capital * -* - Marginal Costs of Demands * -*============================================================================* -* user scalar (from CONSTANT table) to control lower bound on demands - VAR_D.LO(RTC(R,T,C))$DEM(R,C) = TM_DMTOL(R) * TM_D0(R,C); - VAR_D.FX(RTC(R,T,C))$(DEM(R,C)*(ORD(T) EQ 1)) = TM_D0(R,C); - VAR_D.FX(RTC(R,T,C))$((COM_PROJ(R,T,C) EQ 0)$DEM(R,C)) = 0; - VAR_DEM.FX(RTC(R,T,C))$((TM_DDATPREF(R,C)=0)$DEM(R,C)) = COM_PROJ(R,T,C); - - VAR_INV.L(R,T) = TM_IV0(R) * TM_L(R,T); - VAR_INV.FX(R,T(T_1)) = TM_IV0(R); - - VAR_K.L(R,T) = TM_K0(R) * TM_L(R,T); -* user scalar (from CONSTANT table) to control investment tolerance - VAR_K.LO(R,T) = TM_K0(R) * (TM_L(R,T) ** (TM_IVETOL(R)$(NOT TM_SL))); - VAR_K.FX(R,T(T_1)) = TM_K0(R); - - VAR_SP.FX(RTC(R,T,C))$DEM(R,C) = 0; - -*SK* V0.4 set MM_C for base year -* VAR_C.FX(R,T(MIYR_1)) = TM_C0(R); - VAR_C.LO(R,TT) = TM_C0(R)*.5; diff --git a/source/bnd_set.mod b/source/bnd_set.mod deleted file mode 100644 index 121819c..0000000 --- a/source/bnd_set.mod +++ /dev/null @@ -1,34 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_SET.MOD set the actual bounds on variables -* %1 - variable reference -* %2 - primary index into variable -* %3 - qualifier/bound expression -* %4 - control index -* %5 - stochastic qualifier -*=============================================================================* -*GaG Questions/Comments: -* - FX take precedence as is set last!!! -* - take primary index loop control criteria too, or reset all in case change -* in data (e.g., process moves from 1 region to another?) LATTER!!! -*----------------------------------------------------------------------------- -*$ONLISTING -* reset any existing bounds - %1.LO(%2%SWD%) = 0; - %1.UP(%2%SWD%) = INF; -* assign from user data - %1.LO(%4%SOW%)%5 $= %3(%2,'LO'); - %1.UP(%4%SOW%)%5 $= %3(%2,'UP'); - %1.FX(%4%SOW%)%5 $= %3(%2,'FX'); - -*----------------------------------------------------------------------------- -* Stochastic bounds -$IF%6 NOT %STAGES%==YES $EXIT -$IF NOT DECLARED S_%3 $EXIT - %1.LO(%4%SOW%)%5 $= S_%3(%2,'LO','1',SOW); - %1.UP(%4%SOW%)%5 $= S_%3(%2,'UP','1',SOW); - %1.FX(%4%SOW%)%5 $= S_%3(%2,'FX','1',SOW); -*$OFFLISTING diff --git a/source/bnd_stg.mod b/source/bnd_stg.mod deleted file mode 100644 index 863f7c2..0000000 --- a/source/bnd_stg.mod +++ /dev/null @@ -1,26 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_STG.MOD set the actual bounds for non-vintage VAR_SIN/OUT -* %1 - which variable -* %2 - which bound -*=============================================================================* -* reset any existing bounds - - %VAR%_%1.LO(R,V,T,P,C,S%SWD%)$PRC_MAP(R,'STG',P) = 0; - %VAR%_%1.UP(R,V,T,P,C,S%SWD%)$PRC_MAP(R,'STG',P) = INF; - %VAR%_%1.LO(RTP_VINTYR(R,V,T,P),%PGPRIM%,S%SWD%)$((RPS_STG(R,P,S)->0)$RP_STS(R,P)) = %3; - -* set bounds at process activity level - TRACKP(RP(R,P))$((NOT PRC_VINT(R,P))$PRC_MAP(R,'STG',P)) = YES; - -$IF %STAGES% == YES LOOP(SW_T(T%SWD%), - - %VAR%_%1.LO(RTP_VINTYR(R,T,T,P),C,S%SWD%)$(RPCS_VAR(R,P,C,S)$TRACKP(R,P)) $= %2_BND(R,T,P,C,S,'LO'); - %VAR%_%1.UP(RTP_VINTYR(R,T,T,P),C,S%SWD%)$(RPCS_VAR(R,P,C,S)$TRACKP(R,P)) $= %2_BND(R,T,P,C,S,'UP'); - %VAR%_%1.FX(RTP_VINTYR(R,T,T,P),C,S%SWD%)$(RPCS_VAR(R,P,C,S)$TRACKP(R,P)) $= %2_BND(R,T,P,C,S,'FX'); - -$IF %STAGES% == YES ); - OPTION CLEAR=TRACKP; \ No newline at end of file diff --git a/source/bnd_ucv.mod b/source/bnd_ucv.mod deleted file mode 100644 index 2af7e9d..0000000 --- a/source/bnd_ucv.mod +++ /dev/null @@ -1,97 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_UCV.MOD set the actual bounds for UC constraint slacks * -*=============================================================================* -* %1 - UC variable name -* %2 - "," or "" -* %3 - "R" or "" -* %4 - period -* %5 - UCRHS attribute name -* %6 - control sets (region, period EACH/SUM/SUCC) -* %7 - optional LOOP -* %8 - optional LOOP close -* %9 - timeslice -* %10 - multi-stage indicator -* %11 - SPAR_UCSL residual dimension -*------------------------------------------------------------------------------ -$IF '%10'=='M' $GOTO MULTIPHASE -*------------------------------------------------------------------------------ -* Clear the bounds for the variables -$IF DEFINED %1 - %1.LO(UC_N%2%3%4%9%SWD%)%12 = -INF; - %1.UP(UC_N%2%3%4%9%SWD%) = INF; -*------------------------------------------------------------------------------ -* Set the bounds for the variables -%7 - %1.LO(UC_N%2%3%4%13%9%SOW%)%6 $= %5(%3%2UC_N%4%9,'LO'); - %1.UP(UC_N%2%3%4%13%9%SOW%)%6 $= %5(%3%2UC_N%4%9,'UP'); - %1.FX(UC_N%2%3%4%13%9%SOW%)%6 $= %5(%3%2UC_N%4%9,'FX'); -%8 -*------------------------------------------------------------------------------ -* Set INF upper bound for N type constraints to activate them (DYN too!) - %5(%3%2UC_N%4%9,'UP')$((NOT %5(%3%2UC_N%4%9,'UP'))$%5(%3%2UC_N%4%9,'N')) = INF; -*------------------------------------------------------------------------------ -$IFI NOT %STAGES%==YES $EXIT -*------------------------------------------------------------------------------ -* Deviation bounds: Check if any specified - IF(SW_PHASE EQ -9, - CNT=CNT+SUM((%3%2UC_N%4%9)$((%5(%3%2UC_N%4%9,'N') GE 0)$%5(%3%2UC_N%4%9,'N')),1); - CNT=CNT+SUM((%3%2UC_N%4%9,W)$((S_%5(%3%2UC_N%4%9,'N','1',W) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',W)),1); - ); -*------------------------------------------------------------------------------ -$IF%10 NOT %STAGES%==YES $EXIT -*------------------------------------------------------------------------------ -* Handle uncertain RHS if stochastic mode: Set uncertain bounds for variables - IF(SW_PHASE NE -2, -%7 - %1.LO(UC_N%2%3%4%13%9%SOW%)%6 $= S_%5(%3%2UC_N%4%9,'LO','1',SOW); - %1.UP(UC_N%2%3%4%13%9%SOW%)%6 $= S_%5(%3%2UC_N%4%9,'UP','1',SOW); - %1.FX(UC_N%2%3%4%13%9%SOW%)%6 $= S_%5(%3%2UC_N%4%9,'FX','1',SOW); -%8 - ); -*------------------------------------------------------------------------------ -$IF NOT '%10'=='I' $EXIT -*------------------------------------------------------------------------------ - IF(SW_PHASE EQ 2, -*------------------------------------------------------------------------------ -* Copy UC slack levels for missing first phase runs if necessary -$IF %STAGES%==YES LOOP((SOW(WW),W(WW-1))$(S_UCOBJ('OBJ1',SOW) EQ 4),%1.L(UC_N%2%3%4%9,SOW) $= %1.L(UC_N%2%3%4%9,W)); -$IF NOT %STAGES%==YES %1.L(UC_N%2%3%4%9%SOW%) $= SPAR_UCSL(SOW,UC_N%2%3%4%9%11); -*------------------------------------------------------------------------------ -%7 -* Set the deviation bounds for the variables - copy defaults to SOW if not specified - S_%5(%3%2UC_N%4%9,'N','1',SOW)$(NOT S_%5(%3%2UC_N%4%9,'N','1',SOW)) $= %5(%3%2UC_N%4%9,'N'); -*------------------------------------------------------------------------------ -* Set deviation uncertain bounds for variables - for SOW that have bound specified - %1.LO(UC_N%2%3%4%13%9%SOW%)$(((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)%6)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = - %1.L(UC_N%2%3%4%9%SOW%)-ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); - %1.UP(UC_N%2%3%4%13%9%SOW%)$(((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)%6)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = - %1.L(UC_N%2%3%4%9%SOW%)+ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); -%8 -*------------------------------------------------------------------------------ - ); -$EXIT -$LABEL MULTIPHASE -*------------------------------------------------------------------------------ - OPTION CLEAR=UNCD1; UNCD1(UC_N)=YES; UNCD1('OBJ1') = NO; -* Initally clear any deterministic N RHS bounds - LOOP(SOW(WW), IF(ORD(WW)=1, %5(%3%2UC_N%4%9,'N')=0); -%7 -* Copy old deviation bounds forward unless cleared - %5(%3%2UC_N%4%9,'N')$S_%5(%3%2UC_N%4%9,'N','1',SOW) = 0; - %1.LO(UC_N(UNCD1)%2%3%4%9,ALLSOW)$%5(%3%2UC_N%4%9,'N') = %1.LO(UC_N%2%3%4%9,SOW); - %1.UP(UC_N(UNCD1)%2%3%4%9,ALLSOW)$%5(%3%2UC_N%4%9,'N') = %1.UP(UC_N%2%3%4%9,SOW); -*------------------------------------------------------------------------------ -* Add flags indicating the new deviation bounds in force - %5(%3%2UC_N%4%9,'N')$((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = -1; -* Set deviation uncertain bounds for variables - for SOW that have bound specified - %1.LO(UC_N(UNCD1)%2%3%4%9,ALLSOW)$((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = - %1.L(UC_N%2%3%4%9%SOW%)-ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); - %1.UP(UC_N(UNCD1)%2%3%4%9,ALLSOW)$((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = - %1.L(UC_N%2%3%4%9%SOW%)+ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); -%8 - ); -*------------------------------------------------------------------------------ diff --git a/source/bnd_ucw.mod b/source/bnd_ucw.mod deleted file mode 100644 index 459f2ca..0000000 --- a/source/bnd_ucw.mod +++ /dev/null @@ -1,25 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BND_UCW.MOD Wrapper for setting bounds on UC RHS variables * -*=============================================================================* -* %1 - Stochastic dollar control or '' -* %2 - I or '' -*------------------------------------------------------------------------------ -$ SET TMP -$ IF %STAGES%==YES $SET TMP (T-SUC_L(R,UC_N)) - CNT=0; - UC_T_EACH(UC_T_SUCC) = YES; -$ BATINCLUDE bnd_ucv.mod %VAR%_UC "" "" "" UC_RHS $UC_R_SUM(R,UC_N) LOOP(R, ); '' '%2' ",'','',''" -$ BATINCLUDE bnd_ucv.mod %VAR%_UCR "," "R" "" UC_RHSR $UC_R_EACH(R,UC_N) '' '' '' '%2' ",'',''" $UC_R_EACH(R,UC_N) -$ BATINCLUDE bnd_ucv.mod %VAR%_UCT "" "" ",TT" UC_RHST $(UC_R_SUM(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) LOOP(R, ); '' '%2' ",'',''" '' %TMP% -$ BATINCLUDE bnd_ucv.mod %VAR%_UCRT "," "R" ",TT" UC_RHSRT $(UC_R_EACH(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) '' '' '' '%2' ",''" $UC_T_EACH(R,UC_N,TT) %TMP% -$ BATINCLUDE bnd_ucv.mod %VAR%_UCTS "" "" ",TT" UC_RHSTS $(UC_R_SUM(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) LOOP(R, ); ,S '%2' ",''" '' %TMP% -$ BATINCLUDE bnd_ucv.mod %VAR%_UCRTS "," "R" ",TT" UC_RHSRTS $(UC_R_EACH(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) '' '' ,S '%2' "" $UC_T_EACH(R,UC_N,TT) %TMP% - UC_T_EACH(UC_T_SUCC) = NO; -*------------------------------------------------------------------------------- -$IFI %STAGES%==YES IF(SW_PHASE EQ -9, -$IF %STAGES%==YES CNT$((SW_PARM GT 0)$CNT) = EPS; -$IFI %STAGES%==YES SW_PHASE=-1; SW_PARM = (-2+4$(CNT GT 0))$CNT;); diff --git a/source/bndmain.mod b/source/bndmain.mod deleted file mode 100644 index 700f743..0000000 --- a/source/bndmain.mod +++ /dev/null @@ -1,87 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* BNDMAIN.MOD establishes bounds on variables -* %1 - mod or v# for the source code to be used -* %2 - flag indicating calling phase -*=============================================================================* -*GaG Questions/Comments: -* - FXs take precedence as are set last!!! -* - TS-based bounds: -* - individual TS vs at/above limit via s-index -*----------------------------------------------------------------------------- -$ IF %2==0 $CLEAR %VAR%_IRE %VAR%_UPS %VAR%_UDP %VAR%_UPT %VAR%_SCAP - -*----------------------------------------------------------------------------- -* elastic demands step curve -*----------------------------------------------------------------------------- - %VAR%_ELAST.UP(R,T,C,S,J,BD %SWD%) = INF; -$ IF %TIMESED%==YES $BATINCLUDE bnd_elas.%1 - -*----------------------------------------------------------------------------- -* limit on total activity capacity when not vintaged -*----------------------------------------------------------------------------- -$ BATINCLUDE bnd_act.%1 - -*----------------------------------------------------------------------------- -* limit on the flow variable when not vintaged -*----------------------------------------------------------------------------- -$ BATINCLUDE bnd_flo.%1 - -*----------------------------------------------------------------------------- -* limit on storage -*----------------------------------------------------------------------------- -$ BATINCLUDE bnd_stg.%1 SIN STGIN 0 -$ BATINCLUDE bnd_stg.%1 SOUT STGOUT -INF - -*----------------------------------------------------------------------------- -* limit on total installation of new capacity -*----------------------------------------------------------------------------- -$ IF %STAGES%==YES $SETLOCAL SWT '$SW_T(T%SOW%)' -* prevent new investment if turned off explicitly by the user - NCAP_BND(RTP_OFF,'UP') = EPS; - NCAP_BND(RTP(R,T,P),'LO')$(NCAP_BND(RTP,'UP')$NCAP_BND(RTP,'LO')) = SMIN(BDNEQ,NCAP_BND(RTP,BDNEQ)); -$ BATINCLUDE bnd_set.%1 %VAR%_NCAP 'R,T,P' NCAP_BND '%R_T%,P' $(RP(R,P)%SWT%) - -*----------------------------------------------------------------------------- -* limit on total installed capacity -*----------------------------------------------------------------------------- - CAP_BND(RTP(RTP_VARP),'LO')$CAP_BND(RTP,'UP') = SMIN(BDNEQ,CAP_BND(RTP,BDNEQ)); -$ BATINCLUDE bnd_set.%1 %VAR%_CAP 'R,T,P' CAP_BND RTP(R,T,P) %SWT% - -*----------------------------------------------------------------------------- -* limit on commdities -*----------------------------------------------------------------------------- -$ BATINCLUDE bnd_set.%1 %VAR%_COMNET 'R,T,C,S' COM_BNDNET RTCS_VARC(%R_T%,C,S) %SWT% -$ BATINCLUDE bnd_set.%1 %VAR%_COMPRD 'R,T,C,S' COM_BNDPRD RTCS_VARC(%R_T%,C,S) %SWT% - %VAR%_COMPRD.FX(RTCS_VARC(R,T,C,S)%SOW%)$((NOT RHS_COMPRD(R,T,C,S))$RCS_COMPRD(R,T,C,S,'FX')) = EPS; - -*----------------------------------------------------------------------------- -* bounds for cumulative variables -*----------------------------------------------------------------------------- -$ IF %2==0 $BATINCLUDE bnd_cum.%1 COM_VAR - -*----------------------------------------------------------------------------- -* bounds for user constraint slacks -*----------------------------------------------------------------------------- -$IF %VAR_UC%==YES $BATINCLUDE bnd_ucw.%1 %SWT% -*----------------------------------------------------------------------------- -$IF %MACRO%==YES $GOTO MACRO -* Bounds for OBJ components - UC_TS_SUM(R,UC_N(OBV),S) = NO; - %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%)$UC_RHS(UC_N,'N') = -INF; - %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%) $= UC_RHS(UC_N,'LO'); - %VAR%_OBJ.UP(R,OBV(UC_N),CUR %SOW%) $= UC_RHS(UC_N,'UP'); - %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%)$UC_RHSR(R,UC_N,'N') = -INF; - %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%) $= UC_RHSR(R,UC_N,'LO'); - %VAR%_OBJ.UP(R,OBV(UC_N),CUR %SOW%) $= UC_RHSR(R,UC_N,'UP'); -*----------------------------------------------------------------------------- -* bounds for TIMES-MACRO -*----------------------------------------------------------------------------- -$LABEL MACRO -$ IF %MACRO% == YES $BATINCLUDE bnd_macro.tm -*----------------------------------------------------------------------------- -* Fix timeslices turned off in projected periods -$IF NOT %RTS%==S $BATINCLUDE dynslite.vda BOUNDS \ No newline at end of file diff --git a/source/cal_cap.mod b/source/cal_cap.mod deleted file mode 100644 index e15da47..0000000 --- a/source/cal_cap.mod +++ /dev/null @@ -1,30 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* CAL_CAP the code for capacity dependent commodity flows in EQ_COMxxx -* %1 - IN/OUT indicator -* %2 - I/O indicator -* %3 - cost expression for EQOBJVAR -*=============================================================================* -*GaG Questions/Comments: -* - COEF_CPT derived in COEF_CPT.MOD -*----------------------------------------------------------------------------- -*$ONLISTING - SUM(RTP_CPTYR(R,V,T,P)$NCAP_COM(R,V,P,C,'%1'), -*V05b 980902 - need to apply seasonal fraction - COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,'%1') * G_YRFR(R,S) * - %3 - (%VARV%_NCAP%4(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V) %RCAPSUB%) * -* Adjust for lagged commodity flows - (1 + COEF_CIO(R,V,T,P,C,'%1')) - ) + -* CAL_NCOM: the term associated with invest/decommission commodities in the EQ_COMxxx - SUM(RPC_CAPFLO(R,V,P,C)$COEF_%2COM(R,V,T,P,C), COEF_%2COM(R,V,T,P,C) * - %3 - G_YRFR(R,S) * (%VARV%_NCAP%4(R,V,P %SWS%)$T(V) -$ IF '%2'=='O' + NCAP_PASTI(R,V,P)$PASTYEAR(V) - ) - ) -*$OFFLISTING \ No newline at end of file diff --git a/source/cal_caps.mod b/source/cal_caps.mod deleted file mode 100644 index 2092128..0000000 --- a/source/cal_caps.mod +++ /dev/null @@ -1,29 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* CAL_CAPS the code for capacity dependent commodity flows regardless of IO -* %1 - Milestone year -* %2 - coefficient expression for EQOBJVAR / UC_FLO -* %3 - TS control index for RPCS_VAR summing -*=============================================================================* -* Questions/Comments: -* - COEF_CPT derived in COEF_CPT.MOD -*----------------------------------------------------------------------------- -*$ONLISTING -*V05c 980923 - use the capacity flow control set - SUM((VNT(V,%1),RPC_CAPFLO(R,V,P,C)), -*V05b 980902 - need to apply seasonal fraction -* Flows related to investment / decommissioning - ((COEF_ICOM(R,V,%1,P,C)+COEF_OCOM(R,V,%1,P,C)) * G_YRFR(R,S) * - (%VARV%_NCAP%4(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)) * - SUM(RPCS_VAR(R,P,C,%3), RS_FR(R,TS,S) * %2))$(COEF_ICOM(R,V,%1,P,C)+COEF_OCOM(R,V,%1,P,C)) + -* Flows related to existing capacity over lifetime - SUM((RTP_CPTYR(R,V,%1,P),IO)$NCAP_COM(R,V,P,C,IO), - COEF_CPT(R,V,%1,P) * NCAP_COM(R,V,P,C,IO) * G_YRFR(R,S) * - (%VARV%_NCAP%4(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P) -$IF DEFINED VNRET -SUM(VNRET(V,MODLYEAR(%1)),%VARM%_SCAP%4(R,V,%1,P%SWS%))$PRC_RCAP(R,P) - ) * SUM(RPCS_VAR(R,P,C,%3), RS_FR(R,TS,S) * %2) * (1+COEF_CIO(R,V,%1,P,C,IO))) - ) -*$OFFLISTING diff --git a/source/cal_fflo.mod b/source/cal_fflo.mod deleted file mode 100644 index a75d6e0..0000000 --- a/source/cal_fflo.mod +++ /dev/null @@ -1,52 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* CAL_FFLO the code associated with the flow variable in the EQ_COMxxx -* %1 - 'IN/OUT' for consumption/production -** %2 - 'I/O' for for invest/decommission checks (for now - NO LONGER USED) -* %3 - * Peak multiplier -*=============================================================================* -*GaG Questions/Comments: -* - VAR_FLOs according to whether c-in-PCG otherwise RPS_S1 -*----------------------------------------------------------------------------- -$IF %REDUCE% == 'YES' $GOTO REDUCE -$SET SHP1 "" SET SHG ",P,CG3,C" -$IF DEFINED RTP_FFCS $SET SHP1 "*(%SHFF%S(R,V%SHG%%SOW%))" -$SET SHP1 "*(%SHFF%X(R,V,T%SHG%)$PRC_VINT(R,P))%SHP1%" -*----------------------------------------------------------------------------- -*V05c 980923 - check that commodity not just capacity related - SUM(TOP(RP_FLO(R,P),C,'%1')$(NOT RPC_EMIS(R,P,C)), - SUM(RTPCS_VARF(R,T,P,C,TS), - SUM(RTP_VINTYR(R,V,T,P), %VAR%_FLO(R,V,T,P,C,TS %SOW%) -* equation coarser than variable or equation finer than variable -*M2T* consider COM_TS shape too, so both TS_MAP and TS_BELOW both embedded - %3) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))) - ) + -* [AL] Handle RPC_EMIS flows separately; They cannot be NOFLO - SUM(TOP(RPC_EMIS(RP_FLO(R,P),C),'%1'), - SUM((FS_EMIS(R,P,CG3,COM2,C),RTPCS_VARF(R,T,P,COM2,TS))$RS_TREE(R,S,TS), - SUM(RTP_VINTYR(R,V,T,P),%VAR%_FLO(R,V,T,P,COM2,TS %SOW%) * - COEF_PTRAN(R,V,P,CG3,COM2,C,TS) %SHP1% %3) * - RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM2,S,TS)))) + - -$EXIT -*----------------------------------------------------------------------------- -$LABEL REDUCE -* [UR] model reduction %REDUCE% is set in *.run -*[AL] Sum over non-vintaged processes - SUM(TOP(RP_FLO(R,P),C,'%1')$(NOT PRC_VINT(R,P)), - SUM((RTP_VINTYR(R,V(T),T,P),RTPCS_VARF(R,T,P,C,TS)), -$ BATINCLUDE cal_red.red C COM TS P T '' T -* equation coarser than variable or equation finer than variable - %3 * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))) - ) + - -*[AL] Sum over vintaged processes - SUM((TOP(PRC_VINT(RP_FLO(R,P)),C,'%1'),RTPCS_VARF(R,T,P,C,TS)), -$ BATINCLUDE cal_red.red C COM TS P T '' V SUM 'RTP_VINTYR(R,V,T,P),' %3 -* equation coarser than variable or equation finer than variable - * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) - ) + - diff --git a/source/cal_ire.mod b/source/cal_ire.mod deleted file mode 100644 index 2f2eaa4..0000000 --- a/source/cal_ire.mod +++ /dev/null @@ -1,48 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* CAL_IRE the code associated with the inter-region trade variable in EQ_COMxxx -* %1 - IMPort/EXPort indicator -* %2 - IN/OUT nature of the aux/emissions -* %3 - IE or '' -* %4 - * Peak multiplier -*=============================================================================* -*GaG Questions/Comments: -*----------------------------------------------------------------------------- -*$ONLISTING - -$IF DEFINED RTP_FFCS $SET MX "(%SHFF%S(R,V,P,C,C%SOW%))*" -*V0.9 022100 - handle the fact that called 2x for aux -$SET IE '%3' -$IF '%IE%'=='' $SET IE "'%1'" -$IF '%1' == 'EXP' -$IF '%2' == 'OUT' $GOTO AUXONLY -$IF '%1' == 'IMP' -$IF '%2' == 'IN' $GOTO AUXONLY -* actual exchange -*V05c 980923 - check that commodity not just capacity related -*V05c 981016 - change RTPCS_VARFs to ts - SUM((RPC_IRE(%6R,P%7,C,'%1'),RTPCS_VARF(R,T,P,C,TS)), - SUM(RTP_VINTYR(R,V,T,P), - (%VAR%_IRE(R,V,T,P,C,TS,'%1'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) - )%4 - ) * - RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) - ) + - -$IF SET IREAUXBAL %IREAUXBAL% %2 %5 -$LABEL AUXONLY -*V0.5b handle auxillary commodity flows too -*** NOTE: assumes that attribute at the same level as the variable!!! -*V0.9 022100 - do IN/OUT explicitly - SUM((RPC_IRE(%6R,P%7,COM,%IE%),RTPCS_VARF(R,T,P,COM,TS))$IRE_FLOSUM(R,T,P,COM,TS,%IE%,C,'%2'), - IRE_FLOSUM(R,T,P,COM,TS,%IE%,C,'%2') * - SUM(RTP_VINTYR(R,V,T,P), %MX% - (%VAR%_IRE(R,V,T,P,COM,TS,%IE%%SOW%)$(NOT RPC_AIRE(R,P,COM))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM) - )%4 - ) * - RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) - ) + -*$OFFLISTING diff --git a/source/cal_nored.red b/source/cal_nored.red deleted file mode 100644 index 74f7968..0000000 --- a/source/cal_nored.red +++ /dev/null @@ -1,30 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================================* -* CAL_RED the code associated with the substitution of flow variables by activity variables -* %1 - commodity of flow -* %2 - commodity associated with the activity variable -* %3 - timeslice index of flow variable -* %4 - process index of flow variable -* %5 - period index of flow variable -* %6 - for output routine '.L' suffix. otherwise nothing -* %7 - optional T or V or '' (for non-vintaged / vintaged / general case) -*=============================================================================================* -$SETLOCAL SHP3 "" SET VNT '%5' SET SHG ",%4,CG3,%1" SET TST '$PRC_VINT(R,%4)' -$IF '%7' == V $SET TST '' -$IF NOT '%7' == T $SET VNT V -$IF DEFINED RTP_FFCS $SET SHP3 "*(%SHFF%S(R,%VNT%%SHG%%SOW%))" -$IF %VNT% == V $SET SHP3 "*(%SHFF%X(R,V,%5%SHG%)%TST%)%SHP3%" -*============================================================================================== -%8(%9 -* flow variable cannot be replaced - %VAR%_FLO%6(R,%VNT%,%5,%4,%1,%3 %SOW%)$(NOT RPC_EMIS(R,%4,%1)) - + -* emission flow = flow variable * emission factor - SUM((FS_EMIS(R,%4,CG3,COM2,%1),ALL_TS)$(RS_FR(R,%3,ALL_TS)*RTPCS_VARF(R,%5,%4,COM2,ALL_TS)), - %VAR%_FLO%6(R,%VNT%,%5,%4,COM2,ALL_TS %SOW%) * COEF_PTRAN(R,%VNT%,%4,CG3,COM2,%1,ALL_TS)%SHP3% * - RS_FR(R,%3,ALL_TS)*(1+RTCS_FR(R,%5,COM2,%3,ALL_TS)) - )$RPC_EMIS(R,%4,%1) -) diff --git a/source/cal_red.red b/source/cal_red.red deleted file mode 100644 index cbb2fef..0000000 --- a/source/cal_red.red +++ /dev/null @@ -1,59 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================================* -* CAL_RED the code associated with the substitution of flow variables by activity variables -* %1 - commodity of flow -* %2 - commodity associated with the activity variable -* %3 - timeslice index of flow variable -* %4 - process index of flow variable -* %5 - period index of flow variable -* %6 - for output routine '.L' suffix. otherwise nothing -* %7 - optional T or V or '' (for non-vintaged / vintaged / general case) -* %8 - optional 'SUM' (only if %7 is not T) -* %9 - optional 'RTP_VINTYR(R,V,%5,%4),' (only if %7 is not T) -* %10 - optional multiplier (NCAP_PKCNT) -*=============================================================================================* -$SET SHP1 "" SET SHP2 "" SET SHP3 "" SET VNT '%5' SET TST '$PRC_VINT(R,%4)' -$SET SHG1 ",%4,%PGPRIM%,COM2" SET SHG2 ",%4,%PGPRIM%,%1" SET SHG ',%4,CG1,%1' -$IF NOT '%7'==T $SET VNT V -$IF DEFINED RTP_FFCS -$SET SHP1 "*(%SHFF%S(R,%VNT%%SHG1%%SOW%))" SET SHP2 "*(%SHFF%S(R,%VNT%%SHG2%%SOW%))" SET SHP3 "*(%SHFF%S(R,%VNT%%SHG%%SOW%))" -$IF '%7' == V $SET TST '' -$IF NOT '%7'==T -$SET SHP1 "*(%SHFF%X(R,V,%5%SHG1%)%TST%)%SHP1%" SET SHP2 "*(%SHFF%X(R,V,%5%SHG2%)%TST%)%SHP2%" SET SHP3 "*(%SHFF%X(R,V,%5%SHG%)%TST%)%SHP3%" -*============================================================================================== -( -* flow variable cannot be replaced - (%8(%9%VAR%_FLO%6(R,%VNT%,%5,%4,%1,%3%SOW%)%10)$(NOT RPC_EMIS(R,%4,%1)) - + -* emission flow = flow variable * emission factor - SUM((FS_EMIS(R,%4,CG1,COM2,%1),ALL_TS)$(RTPCS_VARF(R,%5,%4,COM2,ALL_TS)$RS_FR(R,%3,ALL_TS)), - %8(%9 - ( -* flow variable cannot be replaced - %VAR%_FLO%6(R,%VNT%,%5,%4,COM2,ALL_TS%SOW%)$(NOT RPC_ACT(R,%4,COM2)+RPC_FFUNC(R,%4,COM2)) - + -* flow variable equals activity variable - (%VAR%_ACT%6(R,%VNT%,%5,%4,ALL_TS%SOW%)*PRC_ACTFLO(R,%VNT%,%4,COM2))$RPC_ACT(R,%4,COM2) - + - SUM((RPC_ACT(R,%4,%2),PRC_TS2(R,%4,S2))$RS_FR(R,ALL_TS,S2), - ( - %VAR%_ACT%6(R,%VNT%,%5,%4,S2%SOW%) * ACT_FLO(R,%VNT%,%4,COM2,ALL_TS)%SHP1% - ) * RS_FR(R,ALL_TS,S2)*(1+RTCS_FR(R,%5,%2,ALL_TS,S2)) - )$RPC_FFUNC(R,%4,COM2) - ) * COEF_PTRAN(R,%VNT%,%4,CG1,COM2,%1,ALL_TS)%SHP3% %10 - ) * RS_FR(R,%3,ALL_TS)*(1+RTCS_FR(R,%5,COM2,%3,ALL_TS)) - )$RPC_EMIS(R,%4,%1) - )$(NOT RPC_ACT(R,%4,%1)+RPC_FFUNC(R,%4,%1)) - + -* flow variable equals activity variable - %8(%9%VAR%_ACT%6(R,%VNT%,%5,%4,%3%SOW%)*PRC_ACTFLO(R,%VNT%,%4,%1)%10)$RPC_ACT(R,%4,%1) - + - SUM((RPC_ACT(R,%4,%2),PRC_TS2(R,%4,S2))$RS_FR(R,%3,S2), - ( - %8(%9 %VAR%_ACT%6(R,%VNT%,%5,%4,S2%SOW%) %10 * ACT_FLO(R,%VNT%,%4,%1,%3)%SHP2%) - ) * RS_FR(R,%3,S2)*(1+RTCS_FR(R,%5,%2,%3,S2)) - )$RPC_FFUNC(R,%4,%1) -) diff --git a/source/cal_stgn.mod b/source/cal_stgn.mod deleted file mode 100644 index b2d6e02..0000000 --- a/source/cal_stgn.mod +++ /dev/null @@ -1,23 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* CAL_STG the code associated with the storage flows in the EQ_COMxxx -* %1 - 'IN/OUT' for consumption/production -* %2 - 'OUT/IN' for consumption/production -* %3 - STG_EFF for output -* %4 - STG_EFF for output -* %5 - for day-night storage indicator -*=============================================================================* -* Questions/Comments: -* %6 - NCAP_PKCNT multiplier -*----------------------------------------------------------------------------- -*V05c 980923 - check that commodity not just capacity related - SUM((TOP(RPC_STG(R,P,C),'%1'),RPCS_VAR(R,P,C,TS))$%5, - SUM(RTP_VINTYR(R,V,T,P), - (%VAR%_S%1(R,V,T,P,C,TS %SOW%)%3-%4%VAR%_S%2(R,V,T,P,C,TS %SOW%)$RPC_STGN(R,P,C,'%2'))%6)$(NOT RPC_STGN(R,P,C,'%1')) * -* equation coarser than variable or finer than variable - RS_FR(R,S,TS) - ) + - diff --git a/source/calibase.mlf b/source/calibase.mlf deleted file mode 100644 index a6dd810..0000000 --- a/source/calibase.mlf +++ /dev/null @@ -1,118 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Calibase.MLF is the wrapper for calibrating the MACRO MLF -* %1 - mod or v# for the source code to be used -*=============================================================================* - - TM_YCHECK(R) = TM_IVETOL(R); - TM_IVETOL(R) = MAX(1,TM_IVETOL(R)); - -* Abort execution if execute errors - ABORT$EXECERROR '*** ERRORS IN EXECUTION ***' - - MODEL MCE / EQ_UTIL, EQ_PROD_Y, EQ_AKL, EQ_LABOR, EQ_KNCAP, EQ_MCAP, EQ_TMC, EQ_DD, EQ_IVECBND, EQ_ESCOST, EQ_TRDBAL /; - - OPTION SOLPRINT=OFF,SOLVELINK=1; - OPTION SOLVEOPT=MERGE,BRATIO=0.25; - MCE.MODELSTAT=0; MCE.SOLVESTAT=0; MCE.OPTFILE=1; - MCE.LIMROW=0; MCE.LIMCOL=0; - - SET LOOPS / NWT, DDF, GDP /; - PARAMETER GDPLOSS(REG,tp) 'GDP losses in percent'; - PARAMETER MSA_ERR(NITER,LOOPS,REG); - PARAMETER TM_TOL(ITEM) / CAL 1E-5, MST 1E-7, DEM 0, EQUIL 1 /; - SCALAR ERRDEM / 0 /, ERRGDP / 0 /, DOITER/ 1 /; -*------------------------------------------------------------------------------ - TM_GDP(MR,T) = TM_GDPGOAL(MR,T); - PAR_Y(MR,T) = TM_GDPGOAL(MR,T); - TM_GROWV(R,T) = TM_GR(R,T); - PAR_GRGDP(R,T) = TM_GR(R,T); - PAR_MC(R,T,DM)$TM_DEM(R,T,DM) = TM_DMC(R,T,DM); - MREG(MR) = YES; - TM_NWT(MR) = 1; - TM_HDF(MR,T) = 1; - VAR_NTX.FX(MR,PP)=0; - OPTION DECIMALS=5; - - DOITER=1$CARD(MR); - LOOP(NITER$DOITER, -$ INCLUDE ddfupd.msa - IF(ORD(NITER)<5, - LOOP(MREG, MR(R)= NO; MR(R(MREG))=YES; - SOLVE MCE MAXIMIZING VAR_UTIL USING NLP); MR(R(MREG))=YES; - ELSE SOLVE MCE MAXIMIZING VAR_UTIL USING NLP); - - TM_GDP(R,T) = VAR_C.L(R,T) + VAR_INV.L(R,T); - PAR_GRGDP(MR(R),TP(T-1)) = 100 * ((TM_GDP(R,T)/TM_GDP(R,TP))**(1/NYPER(TP))-1); - PAR_Y(R,T) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_EC.L(R,T) + VAR_NTX.L(R,T)$(NOT TB(T)); - PAR_MC(MR(R),PP(T),DM(C)) = MAX(ABS(VAR_SP.M(R,T,C)*TM_SCALE_NRG),ABS(EQ_DD.M(R,T,C))) / MAX(EQ_ESCOST.M(R,T),-VAR_EC.M(R,T)) / TM_SCALE_CST; - - MSA_ERR(NITER,'DDF',MR(R)) = SMAX((T,DM(C)),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); - MSA_ERR(NITER,'GDP',MR(R)) = SMAX(T,ABS(TM_GDPGOAL(R,T)-TM_GDP(R,T))/TM_GDPGOAL(R,T)); - ERRDEM = SMAX(MR, MSA_ERR(NITER,'DDF',MR)); - ERRGDP = SMAX(MR, MSA_ERR(NITER,'GDP',MR)); - IF(MAX(ERRDEM,ERRGDP) < TM_TOL('CAL')*ORD(NITER), DOITER=0); - ); - - DISPLAY MSA_ERR; - TM_TOL('DEM') = ERRDEM/300; - TM_TOL('GDP') = ERRGDP/300; - -* Prepare for Negishi iterations, relax trades - VAR_NTX.UP(MR,PP) = INF; - VAR_NTX.LO(MR,PP) =-INF; - OPTION CLEAR=MSA_ERR; -* Calculate initial Negishi weights based on regional GDP - TM_NWT(MR(R)) = SUM(TP, TM_GDPGOAL(R,TP)*TM_DFACT(R,TP)); - Z = SUM(MR(R),TM_NWT(R)); - TM_NWT(MR(R)) = TM_NWT(R) / Z; - - DOITER=1$CARD(MR); - LOOP(NITER$DOITER, - - OPTION BRATIO=0.25,SOLVEOPT=REPLACE; - SOLVE MCE MAXIMIZING VAR_UTIL USING NLP; - -*-- Calculate Macro parameters - TM_UDF(R,T)=TM_HDF(R,T); TM_HDF(R,T)=COEF_PVT(R,T); - LOOP(PP(T-1),TM_HDF(MR(R),T) = TM_HDF(R,PP)*EQ_ESCOST.M(R,T)/EQ_ESCOST.M(R,PP)); - Z=ROUND(TM_DEFVAL('USEHDF')); - TM_HDF(R,T)=TM_UDF(R,T)*(TM_HDF(R,T)/COEF_PVT(R,T))**.9$Z; - - TM_GDP(MR(R),PP) = VAR_C.L(R,PP)+VAR_INV.L(R,PP) + VAR_NTX.L(R,PP); - PAR_GRGDP(MR(R),tp(T-1)) = 100 * ((TM_GDP(R,T)/TM_GDP(R,TP))**(1/NYPER(TP))-1); - PAR_Y(R,T) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_EC.L(R,T) + VAR_NTX.L(R,T)$(NOT TB(T)); - PAR_MC(MR(R),PP(T),DM(C)) = MAX(ABS(VAR_SP.M(R,T,C)*TM_SCALE_NRG),ABS(EQ_DD.M(R,T,C))) / MAX(EQ_ESCOST.M(R,T),-VAR_EC.M(R,T)) / TM_SCALE_CST / tm_hdf(r,t); - MSA_ERR(NITER,'DDF',MR(R)) = SMAX((T(TT+1),DM(C)),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); - MSA_ERR(NITER,'GDP',MR(R)) = SMAX(T,ABS(TM_GDPGOAL(R,T)-TM_GDP(R,T))/TM_GDPGOAL(R,T)); - ERRDEM = SMAX(MR, MSA_ERR(NITER,'DDF',MR)); DISPLAY ERRDEM; - ERRGDP = SMAX(MR, MSA_ERR(NITER,'GDP',MR)); - DFUNC = ((ERRGDP>1.5*TM_TOL('GDP'))+(ERRDEM>1.5*TM_TOL('DEM')))*(MAX(ERRDEM,ERRGDP)>TM_TOL('MST')); - -*-- Calculate deflators and new Negishi weights - LOOP(TB(T-1), MY_ARRAY(PP) = ABS(EQ_TRDBAL.M(PP)/EQ_TRDBAL.M(T))); - TM_NWT(MR(R)) = SUM(PP, MY_ARRAY(PP)*VAR_C.L(R,PP) + MY_ARRAY(PP)*VAR_NTX.L(R,PP)); - TM_NWT(MR) = TM_NWT(MR) / SUM(REG, TM_NWT(REG)); - TM_NWTIT(NITER,MR) = TM_NWT(MR); - IF(CARD(MR)=1, TM_TOL('EQUIL')=0; - ELSE TM_TOL('EQUIL') = SUM(MR, ABS(TM_NWTIT(NITER-1,MR) - TM_NWT(MR)))); - MSA_ERR(NITER,'NWT',MR) = TM_TOL('EQUIL'); - IF(DFUNC, TM_TOL('EQUIL')=1); - IF(TM_TOL('EQUIL') LE TM_TOL('MST') OR ORD(NITER)=CARD(NITER), DOITER=0); - - IF(DOITER, -*-- Recalibrate DDF factors -$ INCLUDE ddfupd.msa - )); - - GDPLOSS(MR,TP)= 100*(TM_GDPGOAL(MR,TP)-TM_GDP(MR,TP))/TM_GDPGOAL(MR,TP); - TM_DDF_DM(MR,TP,DM)=(VAR_DEM.L(MR,TP,DM)/TM_DEM(MR,TP,DM)); - - OPTION MSA_ERR:6:2:1; - DISPLAY MSA_ERR,GDPLOSS,ERRDEM,ERRGDP; - -* Calculate IVETOL for policy run - TM_IVETOL(MR(R)) = MAX(TM_YCHECK(R),SMAX(PP$(TM_L(R,PP)>1),LOG((VAR_INV.L(R,PP)+VAR_EC.L(R,PP))/TM_Y0(R))/LOG(TM_L(R,PP)))+.005); diff --git a/source/clearsol.stc b/source/clearsol.stc deleted file mode 100644 index e26c6b3..0000000 --- a/source/clearsol.stc +++ /dev/null @@ -1,41 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* CLEARSOL.stc: Clear solution values -*=============================================================================* -$ IF '%1'=='' $GOTO EXECUTE -$ %SW_NOTAGS% -$ BATINCLUDE mod_vars.mod -$ BATINCLUDE eqdeclr.mod -$ CLEAR VAR_CUMFLO VAR_CUMCOM VAR_CUMCST VAR_ACT VAR_FLO VAR_IRE VAR_SIN VAR_SOUT VAR_COMNET VAR_COMPRD VAR_ELAST VAR_SCAP VAR_UPS VAR_UPT VAR_UDP VAR_UC -$ IFI %1==DEF $EXIT -$ LABEL EXECUTE -* Variables - IF(YES,DISPLAY 'Solution store cleared'; - OPTION CLEAR=VAR_ACT; - OPTION CLEAR=VAR_BLND; - OPTION CLEAR=VAR_COMNET; - OPTION CLEAR=VAR_COMPRD; - OPTION CLEAR=VAR_IRE; - OPTION CLEAR=VAR_ELAST; - OPTION CLEAR=VAR_FLO; - OPTION CLEAR=VAR_SIN,CLEAR=VAR_SOUT; - OPTION CLEAR=VAR_CAP,CLEAR=VAR_NCAP; - OPTION CLEAR=VAR_UC,CLEAR=VAR_UCR; - OPTION CLEAR=VAR_UCT,CLEAR=VAR_UCRT; - OPTION CLEAR=VAR_UCTS,CLEAR=VAR_UCRTS; - OPTION CLEAR=VAR_UPS,CLEAR=VAR_UPT,CLEAR=VAR_UDP; - OPTION CLEAR=VAR_OBJ,CLEAR=VAR_OBJELS; -* Delicate bounds - VAR_CUMCOM.L(R,C,COM_VAR,ALLYEAR,YEAR)=0; - VAR_CUMFLO.L(R,P,C,ALLYEAR,YEAR)=0; -$IF DEFINED %VAR%_DAM VAR_DAM.L(R,T,C,BD,J)=0; -$IF DEFINED %VAR%_SCAP VAR_SCAP.L(R,YEAR,T,P)=0; -* Equations - OPTION CLEAR=EQE_COMBAL,CLEAR=EQG_COMBAL,CLEAR=EQE_COMPRD; - OPTION CLEAR=EQ_PEAK,CLEAR=EQ_IRE,CLEAR=EQE_CPT; - OPTION CLEAR=EQE_FLOMRK,CLEAR=EQG_FLOMRK,CLEAR=EQL_FLOMRK; - OPTION CLEAR=EQE_ACTBND,CLEAR=EQG_ACTBND,CLEAR=EQL_ACTBND; - ); \ No newline at end of file diff --git a/source/clearsol.stp b/source/clearsol.stp deleted file mode 100644 index 0239fc2..0000000 --- a/source/clearsol.stp +++ /dev/null @@ -1,34 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* CLEARSOL.stp: Clear solution values for projection years -*=============================================================================* - IF(1%1, - RVT(R,VNT(V,T))$RT_PP(R,T) = YES; - FIL(LL)=T(LL); LOOP(R, FIL(T)$NO_RT(R,T) = NO); - %VAR%_ACT.L(RVT,P,S%SOW%) = 0; - %VAR%_FLO.L(RVT,P,C,S%SOW%) = 0; - %VAR%_IRE.L(RVT,P,C,S,IE%SOW%) = 0; - %VAR%_SIN.L(RVT,P,C,S%SOW%) = 0; - %VAR%_SOUT.L(RVT,P,C,S%SOW%) = 0; - %VAR%_NCAP.L(RT_PP,P%SOW%) = 0; - %VAR%_COMNET.L(RT_PP,C,S%SOW%) = 0; - %VAR%_COMPRD.L(RT_PP,C,S%SOW%) = 0; - %VAR%_NCAP.L(RT_PP,P%SOW%) = 0; - %VAR%_UCT.L(UC_N,T(FIL)%SOW%) = 0; - %VAR%_UCTS.L(UC_N,T(FIL),S%SOW%) = 0; - %VAR%_UCRT.L(UC_N,RT_PP%SOW%) = 0; - %VAR%_UCRTS.L(UC_N,RT_PP,S%SOW%) = 0; - %VAR%_SCAP.L(RVT,P%SOW%) = 0; - %EQ%G_COMBAL.L(RT_PP,C,S%SWT%) = 0; -$IFI %CLI%==YES %VAR%_CLIBOX.L(CM_VAR,LL%SOW%)$CM_LED(LL)=0; -$IFI %ABS%==YES %VAR%_BSPRS.L(RVT,P,C,S,L%SOW%) = 0; - EQ_OBJ.M = 0); -$IF NOT %STAGES%==YES $EXIT - VAR_NCAP.L(RT_PP,P) = 0; - VAR_UCT.L(UC_N,T(FIL)) = 0; - VAR_UCTS.L(UC_N,T(FIL),S) = 0; - VAR_UCRT.L(UC_N,RT_PP) = 0; - VAR_UCRTS.L(UC_N,RT_PP,S) = 0; diff --git a/source/coef_alt.lin b/source/coef_alt.lin deleted file mode 100644 index 48ff4d9..0000000 --- a/source/coef_alt.lin +++ /dev/null @@ -1,161 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COEF_ALT.LIN do coefficient calculations for the linearized objective * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* -*------------------------------------------------------------------------------ -$IF DEFINED TPULSE $GOTO PREPRO -*------------------------------------------------------------------------------ - SET PERDINV(ALLYEAR,ALLYEAR); - SET TPULSEYR(T,ALLYEAR); - PARAMETER TPULSE(ALLYEAR,ALLYEAR); - PARAMETER OBJ_LINT(R,T,ALLYEAR,CUR); - PARAMETER OBJ_ALTV(R,T); - PARAMETER RTP_CAPVL(R,YEAR,P) //; - PARAMETER RB(R,T); - PARAMETER R_DF(R,ALLYEAR); - PARAMETER OBJ_WD(REG,CUR,ALLYEAR,AGE,ALLYEAR); - PARAMETER OBJ_JD(REG,CUR,ALLYEAR,AGE); -*------------------------------------------------------------------------------ -$LABEL PREPRO -$IFI %1==FIX $GOTO DOFIX -$IFI %1==INV $GOTO DOINV -$IFI %1==STP OPTION CLEAR=PERDINV,CLEAR=TPULSE,CLEAR=TPULSEYR; -$SET ILED $NCAP_ILED(R,V,P) -*------------------------------------------------------------------------------ -* Pre-establish PERDINV (for T) - PERDINV(YK(T,K))$(YEARVAL(K) > M(T)-LEAD(T)) = YES; - OPTION CLEAR=YK1; YK1(T,Y_EOH)$(YEARVAL(T)<=YEARVAL(Y_EOH)) = YES; -* Initialize period pulse years and triangular functions - TPULSEYR(PERDINV(T,Y_EOH)) = YES; - TPULSE(TPULSEYR(T,Y_EOH)) = 1-((M(T)-YEARVAL(Y_EOH))/LEAD(T))$(NOT MIYR_1(T)); - TPULSEYR(YK1(T,Y_EOH))$(YEARVAL(Y_EOH) < M(T)+LAGT(T)) = YES; - TPULSE(TPULSEYR(YK1(T,LL))) = 1-TPULSE(T+1,LL); -*------------------------------------------------------------------------------ -* Complete OBJ_PVT and FPD: -$SET LINFLO '0' SET LINACC 0 -$IFI '%OBJ%'==LIN $SET LINACC 1 -$IFI '%CTST%'==**EPS $SET LINFLO 1 -$IFI '%OBLONG%%OBJ%'==YESALT $SET VARCOST 'LIN' SET LINACC 1 -$IFI '%OBLONG%%LINFLO%'==YES1 $SET ILED '' - -$IF %LINFLO%==1 FPD(T) = SUM(TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)); -$IF %LINFLO%==1 OBJ_PVT(R,T,CUR)$RDCUR(R,CUR) = SUM(TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); COEF_PVT(R,T) = SUM(G_RCUR(R,CUR),OBJ_PVT(R,T,CUR)); - - IF(ABS(ALTOBJ) EQ 2, LOOP(G_RCUR(R,CUR), -* Set up variable cost correction adjustment for ALT -$IF %LINFLO%==1 OBJ_ALTV(R,T) = COEF_PVT(R,T) / SUM(PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR)); -$IF %LINFLO%==0 OBJ_ALTV(R,T) = COEF_PVT(R,T) / SUM(TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); - )); -* Prepare linearized cost coefficients - OBJ_LINT(R,T,TT,CUR)$RDCUR(R,CUR) = -$IFI %OBJ%==ALT OBJ_ALTV(R,T) * -$IFI %LINACC%==1 SUM(TPULSEYR(T,Y_EOH)$TPULSEYR(TT,Y_EOH),TPULSE(T,Y_EOH)*TPULSE(TT,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); -$IFI %LINACC%==0 SUM(PERIODYR(T,Y_EOH)$TPULSEYR(TT,Y_EOH),TPULSE(TT,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); -$IFI %1==VAR $EXIT -*------------------------------------------------------------------------------ -$ LABEL CPT -*------------------------------------------------------------------------------ -$IFI %1==STP $GOTO STP -* Adjustments to COEF_CPT for square objective formulation - PASTSUM(RTP(R,V,P))$PRC_CAP(R,P) = B(V)+NCAP_ILED(R,V,P)+COEF_RPTI(R,V,P)*NCAP_TLIFE(R,V,P); - OPTION CLEAR=FIL2,CLEAR=MY_ARRAY,CLEAR=YK1; - LOOP(G_RCUR(R,CUR), R_DF(R,V) = 1/(1+G_DRATE(R,V,CUR))); - IF(INT_DEFAULT('PASTI'), - NCAP_ILED(R,PHYR(V),P)$(NCAP_ILED(R,V,P)>COEF_ILED(R,V,P)) = LOG(1-(1-R_DF(R,V))*(NCAP_ILED(R,V,P)-COEF_ILED(R,V,P)))/LOG(R_DF(R,V))); - RB(R,T) = B(T); -$IF %LINFLO%==1 YK1(T(LL),LL-FLOOR((LEAD(T)-1)/2)) = NOT MIYR_1(T); - LOOP(G_RCUR(R,CUR), - FIL2(T) = R_DF(R,T); -$IF %LINFLO%==1 LOOP(YK1(T,YEAR), Z=OBJ_DISC(R,YEAR,CUR)/SUM(PERDINV(T,LL),OBJ_DISC(R,LL,CUR))*LEAD(T); RB(R,T)=B(T)-LOG(Z)/LOG(FIL2(T))); - MY_ARRAY(T) = E(T)+1; MY_ARRAY(TT(T-1)) = RB(R,T); - MY_ARRAY(T) = 1-FIL2(T)**(MY_ARRAY(T)-RB(R,T)-1e-8); - COEF_CPT(RTP_CPTYR(R,V,T,P))$PASTSUM(R,V,P) = - MIN(1,(1-FIL2(T)**(PASTSUM(R,V,P)-RB(R,T)))/MY_ARRAY(T)) - ((1-FIL2(T)**MAX(0,B(V)+NCAP_ILED(R,V,P)-RB(R,T))) / MY_ARRAY(T))%ILED%); - COEF_CPT(R,T,TT,P)$((COEF_CPT(R,T,TT,P) LT 1/512)$COEF_CPT(R,T,TT,P)) = 0; -$IFI '%OBLONG%'==YES $GOTO DONE -$IF SET TIMESTEP $GOTO DONE -* Calculate additional cost due to trapezoidal periods - PASTSUM(R,T,P)$NCAP_ILED(R,T,P) = NO; - LOOP(G_RCUR(R,CUR), - FIL2(T) = R_DF(R,T); - RTP_CAPVL(R,T,P)$PASTSUM(R,T,P) = (FIL2(T)**(RB(R,T)-B(T))-1) / (1-FIL2(T)**(MIN(MIYR_VL+1,PASTSUM(R,T,P))-B(T)))); -$GOTO DONE -*------------------------------------------------------------------------------ -$ LABEL DOINV -*------------------------------------------------------------------------------ -$SETGLOBAL CAPJD OBJ_JD(R,CUR,K_EOH,JOT)* - OBJ_JD(RDCUR(R,CUR),K,JOT)$KAGE(K,JOT) = 1; -* The equation divisors for investments: - OBJ_DIVI(OBJ_YES(R,V,P))$(NOT OBJ_I2(R,V,P)) = 1+MIN(IPD(V)-1,ROUND(NCAP_TLIFE(R,V,P))-1)$T(V); - OBJ_DIVI(OBJ_YES(OBJ_1B(R,T,P)))$(ROUND(NCAP_TLIFE(R,T,P)) EQ 1) = NCAP_TLIFE(R,T,P); - OBJ_DIVI(OBJ_YES(R,T,P))$RTP_CAPVL(R,T,P) = OBJ_DIVI(R,T,P) / (1+RTP_CAPVL(R,T,P)); -* The equation divisors for decommissioning : - OBJ_DIVIII(OBJ_SUMS3(R,V,P)) = OBJ_DIVI(R,V,P); - OBJ_DIVIII(OBJ_SUMS3(OBJ_I2(R,V,P))) = ROUND(NCAP_DLIFE(R,V,P)); -* Pastmile investments - OBJ_CRFD(R,PASTMILE(V),P,CUR)$OBJ_PASTI(R,V,P,CUR) = SUM(OBJ_SUMII(R,V,P,LIFE,K,JOT),NCAP_PASTI(R,V,P)*OBJ_CRF(R,V,P,CUR)/OBJ_DISC(R,K,CUR)); - OBJ_PASTI(R,PASTMILE(V),P,CUR)$OBJ_CRFD(R,V,P,CUR) = SUM(VNT(V,T),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR))*OBJ_CRFD(R,V,P,CUR)/COR_SALVI(R,V,P,CUR); - OPTION CLEAR=OBJ_CRFD; -*------------------------------------------------------------------------------ -$ LABEL DOFIX -*------------------------------------------------------------------------------ -$SETGLOBAL CAPWD OBJ_WD(R,CUR,K_EOH,JOT,K)* -* Collect all JOT headers whether or not genuine spreads -* Genuine OBJ_1A / OBJ_1B spreads (JOT>1) for period T cannot start at B(T) - OPTION CLEAR=FIL; FIL(LL+(B(LL)-YEARVAL(LL)))$T(LL) = YES; - OPTION CLEAR=KAGE; KAGE(K,JOT)$((NOT FIL(K))$INVSTEP(K,JOT,K,JOT)) = YES; - KAGE(FIL(LL-FLOOR(ORD(JOT)/2)),JOT)$((ORD(JOT) GT 1)$INVSTEP(FIL,JOT,FIL,JOT)$FIL(LL)) = YES; -* Convert INVSTEP to INVSPRED - INVSPRED(LL,JOT,K,K)$((NOT KAGE(LL,JOT))$INVSTEP(LL,JOT,K,JOT)) = YES; - INVSPRED(KAGE(LL,JOT),LL+FLOOR(ORD(JOT)/2),K)$INVSTEP(LL,JOT,K,JOT) = YES; - OBJ_JD(RDCUR(R,CUR),KAGE(LL,JOT)) = ORD(JOT)/SUM(INVSPRED(LL,JOT,YEAR,K),OBJ_DISC(R,K,CUR)/OBJ_DISC(R,YEAR,CUR)); -%2 OPTION CLEAR=INVSTEP; -%2$GOTO FINISH -* Calculate JOT-based and step-based discount adjustments for genuine spreads - OBJ_WD(RDCUR(R,CUR),LL,JOT,K)$((NOT KAGE(LL,JOT))$INVSTEP(LL,JOT,K,JOT)) = 1; - OBJ_WD(RDCUR(R,CUR),KAGE(LL,JOT),K) $= SUM(INVSPRED(LL,JOT,YEAR,K),OBJ_DISC(R,K,CUR)/OBJ_DISC(R,YEAR,CUR))*OBJ_JD(R,CUR,LL,JOT); - OPTION CLEAR=KAGE; -* The equation divisors for fixed costs: - OBJ_DIVIV(OBJ_YES(R,PASTMILE,P)) = 1; - OBJ_DIVIV(OBJ_YES(R,T,P)) = MAX(1,MIN(IPD(T),ROUND(NCAP_TLIFE(R,T,P)))$(OBJ_1B(R,T,P)+OBJ_1A(R,T,P))); - OBJ_DIVIV(OBJ_YES(R,T,P))$RTP_CAPVL(R,T,P) = OBJ_DIVIV(R,T,P) / (1+RTP_CAPVL(R,T,P)); -* Resids -$IF NOT DEFINED PRC_RESID $GOTO FINISH - LOOP(PYR_S(V), - LOOP((OBJ_SUMIV(V,R,V,P,JOT,LIFE),G_RCUR(R,CUR))$PRC_RESID(R,'0',P), - OBJ_DIVIV(R,V,P) = NCAP_PASTI(R,V,P)*OBJ_LIFE(V,R,JOT,LIFE,CUR)/SUM(VNT(V,T)$PRC_RESID(R,T,P),PRC_RESID(R,T,P)*OBJ_PVT(R,T,CUR)))); -$GOTO FINISH -*------------------------------------------------------------------------------ -$ LABEL STP -*------------------------------------------------------------------------------ -$IF NOT %LINFLO%==1 $GOTO DONE -* Adjustments to Divisors when trapezoidal periods -* Calculate change in capacity value due to change in last period - OPTION CLEAR=RTP_CAPVL; - LOOP(T$(E(T) EQ MIYR_VL), - PASTSUM(RTP(R,TT,P))$((COEF_CPT(R,TT,T,P) GT 0)$PRC_CAP(R,P)) = B(TT)+NCAP_ILED(R,TT,P)+COEF_RPTI(R,TT,P)*NCAP_TLIFE(R,TT,P); - LOOP(G_RCUR(R,CUR), F = RB(R,T); - MY_F = R_DF(R,T); Z = 1-MY_F**(MIYR_VL-F+1); - RTP_CAPVL(R,TT(V),P)$PASTSUM(R,V,P) = COEF_PVT(R,T) * - ((MIN(Z, 1-MY_F**(PASTSUM(R,V,P)-F)) - (1-MY_F**MAX(0,B(V)+NCAP_ILED(R,V,P)-F))%ILED%) / Z - COEF_CPT(R,V,T,P)))); - RTP_CAPVL(R,TT,P)$RTP_CAPVL(R,TT,P) = RTP_CAPVL(R,TT,P)/SUM(VNT(TT,Y_EOH(T)),COEF_PVT(R,T)*MAX(0,COEF_CPT(R,TT,T,P))); - OPTION CLEAR=PASTSUM; -$IFI '%OBLONG%'==YES $GOTO UPDATE -* Calculate additional cost due to trapezoidal periods - LOOP(G_RCUR(R,CUR), - FIL2(T) = R_DF(R,T); - PASTSUM(RTP(R,Y_EOH(T),P))$((NOT NCAP_ILED(R,T,P))$PRC_CAP(R,P)) = (FIL2(T)**(RB(R,T)-B(T))-1) / (1-FIL2(T)**MIN(MIYR_VL+1-B(T),COEF_RPTI(R,T,P)*NCAP_TLIFE(R,T,P)))); - RTP_CAPVL(R,T,P)$PASTSUM(R,T,P) = (1+RTP_CAPVL(R,T,P)) / (1+PASTSUM(R,T,P)) - 1; -$LABEL UPDATE - OBJ_DIVI(RTP(R,T,P)) = STP_DIV('1',R,T,P)*(1+RTP_CAPVL(R,T,P)); - OBJ_DIVIV(RTP(R,T,P)) = STP_DIV('2',R,T,P)*(1+RTP_CAPVL(R,T,P)); - OBJ_DIVIII(RTP(R,T,P)) = STP_DIV('3',R,T,P)*(1+RTP_CAPVL(R,T,P)); -*------------------------------------------------------------------------------ -$ LABEL DONE - OPTION CLEAR=PASTSUM,CLEAR=YK1; -$ LABEL FINISH diff --git a/source/coef_cpt.mod b/source/coef_cpt.mod deleted file mode 100644 index 5dcb564..0000000 --- a/source/coef_cpt.mod +++ /dev/null @@ -1,63 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COEF_CPT.MOD coefficient calculations related to capacity transfer * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -*GaG Questions/Comments: -* - COEF_RPTI calculated in PPMAIN.MOD -*----------------------------------------------------------------------------- -* copy the period values into the years within the period - LOOP(PERIODYR(T,V)$((NOT PHYR(V))$VNT(V,T)), - B(V) = B(T); E(V) = E(T); - M(V) = M(T); D(V) = D(T); - ); -* capacity transfer - set here only when no alternate objective - OPTION CLEAR=FIL; FIL(V)=(NOT 0%CTST%); - PASTSUM(RTP(R,FIL(V),P))$PRC_CAP(R,P) = B(V)+NCAP_ILED(RTP)+COEF_RPTI(RTP)*NCAP_TLIFE(RTP); - COEF_CPT(RTP_CPTYR(R,FIL(V),T,P))$PASTSUM(R,V,P) = - MAX(0, (MIN(E(T)+1,PASTSUM(R,V,P))-MAX(B(V)+NCAP_ILED(R,V,P),B(T))) / D(T)); - -$IF '%VALIDATE%'==YES COEF_CPT(RTP_CPTYR(R,T,T,P)) = 1; - OPTION CLEAR=PASTSUM; - -*------------------------------------------------------------------------------- -* Set NCAP_AF to be the minimum of NCAP_AF and NCAP_AFS, if both at same timeslice - MY_TS(S)=NOT ANNUAL(S); - NCAP_AF(RTP(R,V,P),MY_TS(S),BD)$(PRC_TS(R,P,S)$NCAP_AFS(RTP,S,BD)) = MIN(NCAP_AF(RTP,S,BD)+INF$(NOT NCAP_AF(RTP,S,BD)),NCAP_AFS(RTP,S,BD)); - NCAP_AF(RTP(R,V,P),S,BDNEQ)$(PRC_TS(R,P,S)$NCAP_AFS(RTP,S,'FX')) = 0; -* Remove NCAP_AFS from timeslices that are not above PRC_TS: - NCAP_AFS(RTP(R,V,P),MY_TS(S),BD)$(PRC_TS(R,P,S) OR (NOT RPS_PRCTS(R,P,S))) = 0; - -*------------------------------------------------------------------------------- -* have COEF_AF SHAPEd -* [AL] Rules for vintage-dependent availabilities: -* -- If P is Vintaged, both NCAP_AF and NCAP_AFS are vintage-dependent; -* -- If P is NOT Vintaged but NCAP_AFX is specified, then only NCAP_AF is vintage-dependent; -* -- If P is NOT Vintaged nor NCAP_AFX is specified, then neither is vintage-dependent (except AFS(ANNUAL)); -* -- NCAP_AFA is always non-vintage-dependent, but NCAP_AFS(ANNUAL) overrides it and is always vintaged. - - NCAP_AFX(R,LL--ORD(LL),P) $= NCAP_AFM(R,LL,P); - OPTION TRACKP < NCAP_AFX; - TRACKP(RP)$(NOT PRC_CAP(RP)) = NO; - TRACKP(RP)$RP_UPL(RP,'FX') = NO; - TRACKP(PRC_CAP(PRC_VINT)) = YES; - NCAP_AFBX(RTP(R,V,P),BD)$(RP_AFB(R,P,BD)>0) $= NCAP_AFX(RTP); -$ BATINCLUDE pp_shapr.%1 NCAP_AF (R,V,P,S,BD) "TRACKP(R,P)*PRC_TS(R,P,S)" COEF_AF(RTP_CPTYR(R,V,T,P),S,BD) NCAP_AFM(R,V,P) B - - TRACKP(PRC_CAP(R,P)) = (NOT TRACKP(R,P)); - COEF_AF(RTP_CPTYR(R,V,T,P),S,BD)$(PRC_TS(R,P,S)$TRACKP(R,P)) $= NCAP_AF(R,T,P,S,BD); - COEF_AF(RTP_CPTYR(R,V,T,P),ANNUAL,BD)$PRC_CAP(R,P) $= NCAP_AFA(R,T,P,BD); - -*V07_2 add seasonal AF in addition to process tslvl - OPTION RP_PRC < NCAP_AFSM; NCAP_AFSM(R,V,P)$(NOT RP_PRC(R,P)) $= NCAP_AFM(R,V,P); - NCAP_AFSX(RTP,BD)$NCAP_AFSM(RTP) = NCAP_AFSX(RTP,BD)+EPS; - RTPS_BD(RTP(R,V,P),S,BD)$((PRC_VINT(R,P)+ANNUAL(S)+YES$NCAP_AFSX(RTP,BD))$NCAP_AFS(RTP,S,BD)) = YES; - OPTION RP_PRCZ),MY_ARRAY(TT)); - LOOP(PRC_SIMV(R,P)$RTP_VARA(R,T,P), MY_FYEAR = PRC_YMIN(R,P); - IF(MY_FYEAR NE INF, F = MY_FYEAR-0.5; Z = MY_F-0.5; - FIRST_VAL = (%TRIVINT%-0.5)*(%TRIVINT%+0.5); -* Find the vintage maximizing the distance to first and last - MY_FIL2(TT)= (YEARVAL(TT)-F)*(Z-YEARVAL(TT))$RTP(R,TT,P); Z = SMAX(TT,MY_FIL2(TT)); - IF(Z > FIRST_VAL, Z = SMIN(TT$(MY_FIL2(TT) EQ Z),YEARVAL(TT)); - COEF_CAP(R,LL+(Z-MY_F),T,P) = -1; - COEF_CAP(R,LL+(MY_FYEAR-MY_F),T,P) = 1; - ELSE COEF_CAP(R,LL+(MY_FYEAR-MY_F),T,P) = -1;)))); -*----------------------------------------------------------------------------- -* Set still missing vintage indicators for year T: -COEF_CAP(R,T,T,P)$(RTP_VARA(R,T,P)$PRC_SIMV(R,P)) = 1; -* Initialize capacity transfer of simulated vintages for each TT -COEF_CSV(RTP_CPTYR(R,TT,T,P),TT)$COEF_CAP(R,TT,T,P) = 1; -*----------------------------------------------------------------------------- -OPTION CLEAR=YK1; -IF(CARD(PRC_SIMV), - LOOP(MIYR_1(LL), Z = LEAD(LL); OPTION FIL < T; FIL(LL-Z) = YES; -* Add PASTI vintages - COEF_CSV(RTP_CPTYR(R,PASTMILE,T,P),LL-Z)$(PRC_SIMV(R,P)*NCAP_PASTI(R,PASTMILE,P)) = 1); -* Average effective vintage year for each MODLYEAR: - YK1(FIL,V)$((NOT SAMEAS(FIL,V))$FIL(V)) = YES; - VTV(YK1(FIL,V),T)$((YEARVAL(T)-YEARVAL(FIL)-.5)*(YEARVAL(V)-YEARVAL(T)+.5) > 0) = YES; -* Calculate effective average vintage year - PASTSUM(RTP(R,T,P))$PRC_SIMV(R,P) = - MIN(M(T),FLOOR(MAX(YEARVAL(T)-(LEAD(T)-1)/2,B(T)+MAX(NCAP_ILED(RTP),(D(T)+NCAP_ILED(RTP)-NCAP_TLIFE(RTP))/2))+0.5)); -); -*----------------------------------------------------------------------------- -* Calculate capacity transfer for each simulated vintage: -LOOP(YK1(LL,FIL), Z = YEARVAL(LL); F = YEARVAL(FIL); - COEF_CSV(RTP_CPTYR(R,TT,T,P),FIL)$((COEF_CAP(R,LL,T,P)*COEF_CAP(R,FIL,T,P) < 0)$VTV(LL,FIL,TT)) - = (PASTSUM(R,TT,P)-Z)/(F-Z) -); -* Embed COEF_CPT in the coefficients -COEF_CSV(RTP_CPTYR(R,V,T,P),FIL)$PRC_SIMV(R,P) = COEF_CSV(R,V,T,P,FIL)*COEF_CPT(R,V,T,P); -*----------------------------------------------------------------------------- -* Clear unused vintages and ReSet RTP_VINTYR - OPTION CLEAR=YK1,CLEAR=VTV,CLEAR=PASTSUM; - OPTION COEF_CAP < COEF_CSV; - RTP_VINTYR(R,V,T,P)$PRC_SIMV(R,P) = NO; - RTP_VINTYR(R,V,T,P)$COEF_CAP(R,V,T,P) = YES; - OPTION CLEAR=COEF_CAP; -*----------------------------------------------------------------------------- - AFSV(AFS(R,T,P,S,BD))$=PRC_SIMV(R,P); AFS(AFSV)=NO; -$ BATINCLUDE eqcapvac.mod E FX N -$ BATINCLUDE eqcapvac.mod L UP N -$ BATINCLUDE eqcapvac.mod G LO LO diff --git a/source/coef_ext.abs b/source/coef_ext.abs deleted file mode 100644 index 22db2bd..0000000 --- a/source/coef_ext.abs +++ /dev/null @@ -1,112 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COEF_EXT.vda oversees extended preprocessor activities after COEF_MAIN -* %1 - extension name -*=============================================================================* -* Get storage, end-use and supply processes - BS_BSC(RP,C)$(NOT PRC_CAP(RP))=NO; - OPTION TRACKP < BS_STIME, RP_PRC < COEF_AFUPS; - RP_PRC(RP_PRC)=TRACKP(RP_PRC); OPTION TRACKP < BS_BSC; - TRACKPC(RPC(R,P,C)) $= NRG_TMAP(R,'ELC',C); -* Storage with inflow - BS_ENDP(RP_STG(RP))$SUM(TOP(TRACKPC(RPC_STG(RP,C)),'IN'),1)=YES; -* Qualify as power storage - BS_STGP(RP_PRC(RP))$SUM(TOP(RPC_STG(TRACKPC(RP,C)),'OUT'),1)=YES; - BS_STGP(RP_PRC(RP))$SUM(TOP(RPC_STG(RP,C),'OUT'),NOT TRACKPC(RP,C))=NO; - BS_STGP(RP_PRC(RP))$(((NOT BS_ENDP(RP))+TRACKP(RP))$PRC_SC(RP))=NO; - BS_STIME(BS_STGP(R,P),C,'UP')$BS_RTYPE(R,C)=SMAX(BD,BS_STIME(R,P,C,BD)); - BS_STIME(RP,C,BD)$((NOT BS_STGP(RP))$BS_STIME(RP,C,BD))=NO; - BS_BSC(BS_STGP,C)=NO; -* Qualify as power supply - OPTION RP_GRP=ORD(TSL)), - LOOP(TS_GROUP(R,TSL,TS),BS_RTCS(RSP,R,T,C,S)$(NOT BS_RTCS(RSP,R,T,C,S)) $= BS_RTCS(RSP,R,T,C,TS)$(STOAL(R,S)=F)$RS_BELOW(R,TS,S)))); -* Put-back - BS_OMEGA(RTC,S)$= BS_RTCS('OMEGA',RTC,S); - BS_DELTA(RTC,S)$= BS_RTCS('DELTA',RTC,S); -* Reserve Process attributes - OPTION RP_PRC0,BS_TOP(TOP(R,P,C,IO))$TOP(R,P,C,'OUT')=YES; - ELSE BS_TOP(TOP(R,P,C,IO))$(IPS(IO)+PRC_MAP(R,'STG',P))=YES)); - GR_GENMAP(R,P(BS_K),P)$PROD(PRC$GR_GENMAP(R,PRC,P),0)=1; - OPTION CLEAR=RXX,CLEAR=TRACKP,CLEAR=RP_PRC,CLEAR=RP_GRP,CLEAR=TRACKPC; - -* Timeslices - OPTION RCS < BS_OMEGA; - LOOP(COM_TS(RCS(R,C,S)),BS_COMTS(R,C,TS)$RS_TREE(R,S,TS)=YES); - BS_DELTA(RTCS_VARC(RTC,S))$((NOT BS_DELTA(RTC,S))$BS_OMEGA(RTC,S)) = 1; - BS_SIGMA(RTC(R,T,C),BS_K,S)$((BS_LAMBDA(RTC)$BS_COMTS(R,C,S)=0)$BS_SIGMA(RTC,BS_K,S))=0; - LOOP((R,T,C,BS_K,S)$BS_SIGMA(R,T,C,BS_K,S),BS_RTK(R,T,BS_K)=YES); - LOOP(COM_LIM(R,C,L)$BS_RTYPE(R,C),BS_OMEGA(R,'0',C,S)$BS_COMTS(R,C,S)=FINEST(R,S)$IPS(L)+COM_TS(R,C,S)$BD(L)); -* Activate COMNET, disable COMPRD - RHS_COMBAL(RTCS_VARC(R,T,C,S))$BS_RTYPE(R,C)=BS_COMTS(R,C,S); - RCS_COMBAL(RTCS_VARC(R,T,C,S),'FX') $= BS_RTYPE(R,C); - RHS_COMPRD(RTCS_VARC(R,T,C,S))$BS_RTYPE(R,C) = NO; - RCS_COMPRD(RTCS_VARC(R,T,C,S),'FX')$BS_RTYPE(R,C) = NO; - COM_BNDPRD(RTCS_VARC(R,T,C,S),'UP')$((NOT BS_COMTS(R,C,S)$BS_LAMBDA(R,T,C))$BS_RTYPE(R,C)) = EPS; - COM_AGG(R,T,C,C)$BS_RTYPE(R,C)=1; - RC_AGP(RC,'FX')$=BS_RTYPE(RC); -* Post-process RMAX; no reserve supply from multi-output AFC processes - BS_RMAX(R,V,P,C,S)$(BS_SUPP(R,P)$RP_STD(R,P)$RPS_CAFLAC(R,P,S,'UP'))=0; - LOOP((RC(R,C),BD)$BS_ABD(RC,BD), - VDA_FLOP(RTP(R,V,P),C,S)$((BS_PRS(R,P,S)$PRC_YMAX(R,P)+ANNUAL(S))$BS_BSC(R,P,C)) = - SMAX(BS_ABD(R,COM,BD)$((BS_RTYPE(RC)-BS_RTYPE(R,COM))*BDSIG(BD)<=0),BS_RMAX(RTP,COM,S))); - VDA_FLOP(RTP,C,S)$((BS_RMAX(RTP,C,S)=VDA_FLOP(RTP,C,S))$BS_RMAX(RTP,C,S))=0; - BS_RMAX(RTP,C,S) $= VDA_FLOP(RTP,C,S); OPTION NCAP_AFAC < VDA_FLOP; - LOOP((RTP(R,V,P),C)$NCAP_AFAC(RTP,C), -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'BS_RMAX decreasing at slower reserve types - reset' - PUT QLOG ' WARNING - Kept at preceding value, R=',%RL%,' P=',%PL%,' V=',V.TL, ' C=',C.TL); - BS_RMAX(RTP(R,V,P),C,ANNUAL(S))$BS_BSC(R,P,C) = BS_RMAX(RTP,C,S)$(NOT PRC_YMAX(R,P)); -* Controls for reserve limits - RPC_CONLY(RTP(R,V,P),C)$((BS_RMAX(RTP,C,'ANNUAL')$BS_SUPP(R,P)<1-ACT_MINLD(RTP)$BS_ABD(R,C,'UP'))$BS_BSC(R,P,C))=YES; - LOOP((BS_ABD(RC(R,COM),BD),C,ANNUAL(S))$BS_ABD(R,C,BD), - IF((BS_RTYPE(RC)-BS_RTYPE(R,C))*BDSIG(BD)<0,RPC_CONLY(RTP(R,V,P),C)$((BS_RMAX(RTP,C,S)>=BS_RMAX(RTP,COM,S))$BS_RMAX(RTP,COM,S))=NO)); - LOOP((BS_COMTS(R,C,S),BS_ABD(R,C,L)),BS_SBD(R,S,L)=YES); - OPTION CLEAR=PRC_YMAX,CLEAR=VDA_FLOP,CLEAR=NCAP_AFAC,CLEAR=RCS; -* Build UC map - BS_UCMAP(UC_MAP_FLO(UC_N,SIDE,R,P,C))$(BS_BSC(R,P,C)+BS_STGP(R,P)$BS_STIME(R,P,C,'UP'))$=BS_RTYPE(R,C); \ No newline at end of file diff --git a/source/coef_ext.cli b/source/coef_ext.cli deleted file mode 100644 index b964d31..0000000 --- a/source/coef_ext.cli +++ /dev/null @@ -1,199 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* COEF_EXT.cli - Coefficients for the Climate Module Extension -*----------------------------------------------------------------------------- -* Questions/Comments: -* -*----------------------------------------------------------------------------- -$IF '%1'==SLOPE $GOTO %1 -*----------------------------------------------------------------------------- -* Set up the history calibration values - -* If calibration values are not provided by user, use the defaults: -CM_CONST(CM_HISTS) = 0; -LOOP((LL,CM_HISTS)$CM_HISTORY(LL,CM_HISTS),CM_CONST(CM_HISTS) = EPS); -CM_HISTORY(LL,CM_HISTS)$(NOT CM_CONST(CM_HISTS)) $= CM_DEFAULT(LL,CM_HISTS); - -* Pick up the appropriate calibration values for the calibration year; -CM_CALIB=1; -$IFI %CM_CALIB%==B CM_CALIB = SUM(MIYR_1(T),M(T)-B(T))+1; -$IFI %CM_CALIB%==M CM_CALIB = EPS; - -* Inter-/extrapolate calibration values -OPTION CLEAR=FIL; LOOP(MIYR_1(LL),FIL(LL-CM_CALIB) = YES); -$BATINCLUDE filparam CM_HISTORY '' 'CM_HISTS' ",'','','','','',''" LL FIL '' '' -* Pick the history values -LOOP(MIYR_1(LL), CM_CONST(CM_HISTS) = CM_HISTORY(LL-CM_CALIB,CM_HISTS)); -*----------------------------------------------------------------------------- -* Set up the 3x3 PHI matrix for emissions -IF(NOT SUM((CM_BOX,CM_BUCK),CM_PHI('CO2-GTC',CM_BOX,CM_BUCK)), -* Set up the 3x3 PHI matrix - CM_PHI('CO2-GTC','ATM','UP') = CM_CONST('PHI-UP-AT'); - CM_PHI('CO2-GTC','UP','ATM') = CM_CONST('PHI-AT-UP'); - CM_PHI('CO2-GTC','UP','LO') = CM_CONST('PHI-LO-UP'); - CM_PHI('CO2-GTC','LO','UP') = CM_CONST('PHI-UP-LO'); -); -* Default first-order decay models for CH4 and N2O -IF(NOT SUM((CM_BOX,CM_BUCK),CM_PHI('CH4-MT',CM_BOX,CM_BUCK)), - CM_PHI('CH4-MT','ATM','ATM') = 1-CM_CONST('PHI-CH4'); - CM_PHI('CH4-MT','UP','CH4-MT') = EPS$CM_CONST('CH4-UP'); -); -IF(NOT SUM((CM_BOX,CM_BUCK),CM_PHI('N2O-MT',CM_BOX,CM_BUCK)), - CM_PHI('N2O-MT','ATM','ATM') = 1-CM_CONST('PHI-N2O'); - CM_PHI('N2O-MT','UP','N2O-MT') = EPS$CM_CONST('N2O-UP'); -); -*----------------------------------------------------------------------------- -* Set emission kinds and FORCING to CM_KIND when active - CM_GHGMAP(R,COM,C)$(NOT CM_GHGMAP(R,COM,C)) $= IRE_CCVT(R,COM,R,C); - CM_KIND(CM_VAR(C))$(SUM((R,COM)$CM_GHGMAP(R,COM,C),1)*SUM((CM_BOX,CM_BUCK)$CM_PHI(CM_VAR,CM_BOX,CM_BUCK),1)) = YES; - CM_EMIS(CM_VAR) = CM_KIND(CM_VAR)$CM_PPM(CM_VAR); - CM_KIND('FORCING') = YES$(SUM(LL$CM_MAXC(LL,'DELTA-ATM'),1)+(CARD(CM_EMIS) GT 1)); - IF(CARD(UC_CLI),CM_KIND('FORCING') = YES); - CM_TKIND(CM_KIND) = YES; LOOP(CM_FORCMAP(CM_VAR,CM_HISTS)$SUM(LL$CM_MAXC(LL,CM_VAR),1),CM_TKIND(CM_VAR)=YES); - CM_FORCMAP('FORC-KYO',CM_VAR)$=CM_PPM(CM_VAR); CM_FORCMAP('FORCING',CM_VAR)$=CM_PPM(CM_VAR); -$IFI %STAGES%==YES CM_KIND('FORCING')$SUM((LL,J,W)$S_CM_MAXC(LL,'DELTA-ATM',J,W),1) = YES; -$IF DEFINED DAM_COST CM_KIND('FORCING')$SUM(R$(DAM_BQTY(R,'FORCING')+DAM_BQTY(R,'DELTA-ATM')),1) = YES; -*----------------------------------------------------------------------------- -* Establish set of years beyond EOH -* Set extended EOH (EXT-EOH) year into FIL; -1 deactivates EOH extension - OPTION CLEAR=FIL; YR_VL = 0; FIRST_VAL = CM_CONST('EXT-EOH'); - IF(FIRST_VAL GT 0, FIRST_VAL = ROUND(MAX(MIYR_VL,FIRST_VAL)); - LOOP(MIYR_1(LL), F = FIRST_VAL-YEARVAL(LL); FIL(LL+F) = YES); - CM_BEMI(CM_EMIS,FIL) = EPS; CM_EVAR(CM_EMIS,FIL) = 1; -* Set all MAXC year beyond EOH into FIL - F = SMAX(T(LL),ORD(LL)); CM_MAXC_M(CM_VAR,LL)$CM_MAXC(LL,CM_VAR)=EPS; -$IFI %STAGES%==YES OPTION CM_RESULT < S_CM_MAXC; CM_MAXC_M(ITEM,LL) $= CM_RESULT(ITEM,LL); - LOOP((LL,CM_VAR(CG))$((ORD(LL) GT F)$CM_MAXC_M(CG,LL)), - IF((YEARVAL(LL) GT FIRST_VAL OR NOT(CM_EMIS(CM_VAR)))$YEARVAL(LL), YR_VL = ORD(LL); FIL(LL) = YES)); - FIL(LL)$(ORD(LL) GT YR_VL) = NO; -* Set BEMI to MAXC emissions for years beyond EXT-EOH and zero at EXT-EOH - CM_BEMI(CM_EMIS(CM_HISTS(CG)),FIL(LL))$(YEARVAL(LL) GT FIRST_VAL) = CM_MAXC(LL,CG); - CM_EVAR(CM_EMIS,FIL(LL))$(YEARVAL(LL) GT FIRST_VAL) = EPS$CM_BEMI(CM_EMIS,LL); -* Set EOH contribution to zero at final year (deactivated for now) -* LOOP(MIYR_1(YEAR), CM_EVAR(CM_EMIS,YEAR+(YR_VL-ORD(YEAR))) = EPS); -* Set all years Modulo BEOHMOD to FIL - MY_F = ROUND(MAX(1,CM_CONST('BEOHMOD'))); - FIL(LL)$((ORD(LL) LT YR_VL)$(MOD(YEARVAL(LL),MY_F) = 0)) = YES$(ORD(LL) GT F); - ); - CM_MAXC(LL,CM_EMIS(CM_HISTS(CG)))$(YEARVAL(LL) GT MIYR_VL) = 0; -* Complete CM_LED - LOOP(FIL(LL), Z = ORD(LL); CM_LED(LL) = Z-F; F = Z); - CM_LED(T) = LEAD(T); CM_LED(MIYR_1) = CM_CALIB; - PRET(T,T-1)=YES; -* Interpolate BEMI and BEOH over FIL (mucks-up F, Z, MY_F, MY_FYEAR, FIRST_VAL, LAST_VAL) -$ BATINCLUDE filparam CM_BEMI 'CM_EMIS,' '' ",'','','','',''" LL FIL '' '' -$ BATINCLUDE filparam CM_EVAR 'CM_EMIS,' '' ",'','','','',''" LL FIL '' '' - CM_EVAR(CM_EMIS,T) = 1; -*----------------------------------------------------------------------------- -IF(CM_KIND('FORCING'), - CM_SIG1(SOW) = CM_CONST('SIGMA1'); -* Set up the 2x2 SIG matrix for forcing -$ IFI %STAGES%==YES $BATINCLUDE fillsow.stc CM_CONST CM_STCC '' '' YES YES YES -$ IFI %STAGES%==YES $BATINCLUDE fillsow.stc DAM_COST 'R,' '"DELTA-ATM",CUR' TT YES YES NO -$ IFI %STAGES%==YES CM_SIG1(SOW)=S_CM_CONST('SIGMA1','1',SOW); -$ IFI %STAGES%==YES CM_SIG(SOW,'ATM','ATM') = 1-CM_SIG1(SOW)*(CM_CONST('GAMMA')/S_CM_CONST('CS','1',SOW)+CM_CONST('SIGMA2')); -$ IFI NOT %STAGES%==YES CM_SIG('1','ATM','ATM') = 1-CM_SIG1('1')*(CM_CONST('LAMBDA')+CM_CONST('SIGMA2')); - CM_SIG(SOW,'ATM','LO') = CM_SIG1(SOW)*CM_CONST('SIGMA2'); - CM_SIG(SOW,'LO','ATM') = CM_CONST('SIGMA3'); - CM_SIG(SOW,'LO','LO') = 1-CM_CONST('SIGMA3'); - CM_PHI('FORCING','ATM','FORCING') = 1; -* Intialize CM_AA to the identity matrix, CM_BB to zero - CM_AA('FORCING',LL,SOW,CM_BUCK,CM_BOX)$CM_LED(LL) = DIAG(CM_BUCK,CM_BOX); - CM_BB('FORCING',LL,SOW,CM_BUCK)$CM_LED(LL) = 0; CNT=0; -* Assume linear evolution of forcing between milestone years - LOOP((CM_VAR('FORCING'),LL)$CM_LED(LL), - IF(CNT, CNT=1; Z = CM_LED(LL); ELSE CNT=EPS; Z=CM_CALIB); - FOR(F = 0 TO Z-1, MY_F = F/Z*CNT; - CM_BB(CM_VAR,LL,SOW,CM_BOX) = CM_BB(CM_VAR,LL,SOW,CM_BOX) + CM_SIG1(SOW)*(1-MY_F)*CM_AA(CM_VAR,LL,SOW,CM_BOX,'ATM'); - CM_CC(CM_VAR,LL,SOW,CM_BOX) = CM_CC(CM_VAR,LL,SOW,CM_BOX) + CM_SIG1(SOW)* MY_F *CM_AA(CM_VAR,LL,SOW,CM_BOX,'ATM'); - CM_AA(CM_VAR,LL,SOW,CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_AA(CM_VAR,LL,SOW,CM_BUCK,ITEM)*CM_SIG(SOW,ITEM,CM_BOX)); - ))); -*----------------------------------------------------------------------------- -* Set up control set CM_CONC for the BOX equations; complete PHI - OPTION CM_CONC <= CM_BOXMAP; - CM_PHI(CM_KIND,CM_BOX,CM_BOX)$(NOT CM_PHI(CM_KIND,CM_BOX,CM_BOX)) = 1-SUM(CM_BUCK$(NOT SAMEAS(CM_BOX,CM_BUCK)),CM_PHI(CM_KIND,CM_BUCK,CM_BOX)); -*----------------------------------------------------------------------------- -* Calculate the ith powers of PHI, i=1...Z, where Z = LEAD(T) -* First intialize CM_AA to the identity matrix, and CM_BB(T,1) to 0: -LOOP(CM_EMIS(CM_VAR), - CM_PHI(CM_VAR,'ATM',CM_VAR)$(NOT SUM(CM_BOX$CM_PHI(CM_VAR,'ATM',CM_VAR),1)) = 1; - CM_AA(CM_VAR,LL,'1',CM_BUCK,CM_BOX)$CM_LED(LL) = DIAG(CM_BUCK,CM_BOX); - CM_BB(CM_VAR,LL,'1',CM_BUCK)$CM_LED(LL) = 0; CNT = (ALTOBJ NE 3); -* Loop over MILESTONYR and calculate rest of the powers of PHI - LOOP(T$(ALTOBJ NE 3), - IF(ORD(T) GT 1, MY_F = M(T)-B(T)+1; Z = LEAD(T); ELSE MY_F=CM_CALIB; Z=MY_F); - FOR(F = 1 TO Z, - IF(F LE MY_F, CM_BB(CM_VAR,T,'1',CM_BOX) = CM_BB(CM_VAR,T,'1',CM_BOX) + SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,T,'1',CM_BOX,CM_BUCK)); - ELSE CM_CC(CM_VAR,T,'1',CM_BOX) = CM_CC(CM_VAR,T,'1',CM_BOX) + SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,T,'1',CM_BOX,CM_BUCK))); - CM_AA(CM_VAR,T,'1',CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_AA(CM_VAR,T,'1',CM_BUCK,ITEM)*CM_PHI(CM_VAR,ITEM,CM_BOX)); - )); -* If linear evolution formulation, assume linear evolution of emissions - LOOP(LL$(((ALTOBJ EQ 3) OR NOT T(LL))$CM_LED(LL)), - IF(CNT, CNT=1; Z = CM_LED(LL); ELSE CNT=EPS; Z=CM_CALIB); - FOR(F = 0 TO Z-1, MY_F = F/Z*CNT; - CM_BB(CM_VAR,LL,'1',CM_BOX) = CM_BB(CM_VAR,LL,'1',CM_BOX) + (1-MY_F)*SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,LL,'1',CM_BOX,CM_BUCK)); - CM_CC(CM_VAR,LL,'1',CM_BOX) = CM_CC(CM_VAR,LL,'1',CM_BOX) + MY_F *SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,LL,'1',CM_BOX,CM_BUCK)); - CM_AA(CM_VAR,LL,'1',CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_AA(CM_VAR,LL,'1',CM_BUCK,ITEM)*CM_PHI(CM_VAR,ITEM,CM_BOX)); - )); -); -*----------------------------------------------------------------------------- -* Prepare commodity variables for emissions: - CM_GHGMAP(R,C,'CO2-GTC') $= CM_CO2GTC(R,C); - LOOP((R,C,CM_KIND(CM_VAR(CG)))$CM_GHGMAP(R,C,CG), - RHS_COMBAL(RTCS_VARC(R,T,C,S)) = YES; - RCS_COMBAL(RTCS_VARC(R,T,C,S),'FX') = YES); -*----------------------------------------------------------------------------- -* Construct SUPERYR (needed in MAX constraints) - SUPERYR(PERIODYR(T,LL))$(YEARVAL(LL) LE YEARVAL(T)) = YES; - SUPERYR(T+1,LL)$((YEARVAL(LL) GT YEARVAL(T))$PERIODYR(T,LL)) = YES; - LOOP(MIYR_1(T++1),SUPERYR(T,LL)$(YEARVAL(LL) GT M(T)) = YES); - OPTION FIL < CM_LED, MY_FIL < Y; - MY_FIL(LL)$((YEARVAL(LL)>MIYR_VL)$(ORD(LL) LE YR_VL)) = YES; -*============================================================================= -* Prepare input parameters -*----------------------------------------------------------------------------- -* Interpolate parameters by default or if requested by user: -$BATINCLUDE filparam CM_LINFOR '' 'CM_VAR,LIM' ",'','','','',''" DATAYEAR FIL '' '' -$BATINCLUDE filparam CM_MAXCO2C '' '' ",'','','','','',''" LL T '' '' -1 -$BATINCLUDE filparam CM_MAXC '' 'CG' ",'','','','','',''" LL FIL '' '' -1 -$BATINCLUDE filparam CM_EXOFORC '' '' ",'','','','','',''" LL MY_FIL '' '' -$BATINCLUDE filparam UC_CLI 'UC_N,SIDE,R,' 'CM_VAR' ",'','',''" DATAYEAR T -$IFI %STAGES%==YES $BATINCLUDE filparam S_CM_MAXCO2C '' 'J,WW' ",'','','','',''" DATAYEAR T SW_TSTG(T,J)$ '' -1 -$IFI %STAGES%==YES $BATINCLUDE filparam S_CM_MAXC '' 'CG,J,WW' ",'','','',''" DATAYEAR T SW_TSTG(T,J)$ '' -1 -*----------------------------------------------------------------------------- -* Convert all concentration bounds to PPM basis - CM_MAXC(LL,CG('CO2-PPM'))$CM_MAXCO2C(LL) = MIN(CM_MAXC(LL,CG)+INF$(NOT CM_MAXC(LL,CG)),CM_MAXCO2C(LL)/CM_PPM('CO2-GTC')); - CM_MAXC(LL,CG('CO2-PPM'))$CM_MAXC(LL,'CO2-ATM') = MIN(CM_MAXC(LL,CG)+INF$(NOT CM_MAXC(LL,CG)),CM_MAXC(LL,'CO2-ATM')*CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')); - CM_MAXC(LL,CG('CO2-PPM'))$(CM_MAXC(LL,'FORCING')*(NOT CM_KIND('FORCING'))) = - MIN(CM_MAXC(LL,CG)+INF$(NOT CM_MAXC(LL,CG)),CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')* - EXP((CM_MAXC(LL,'FORCING')-CM_EXOFORC(LL))*LOG(2)/CM_CONST('GAMMA'))); -* Remove bounds from years with undefined concentration - F = SMIN(T,YEARVAL(T)); CM_MAXC(LL,CG)$(YEARVAL(LL) LT F) = 0; -$IFI NOT %STAGES%==YES $GOTO SLOPE - S_CM_MAXC(LL,CG('CO2-PPM'),J,W)$S_CM_MAXCO2C(LL,J,W) = MIN(S_CM_MAXC(LL,CG,J,W)+INF$(NOT S_CM_MAXC(LL,CG,J,W)),S_CM_MAXCO2C(LL,J,W)/CM_PPM('CO2-GTC')); - S_CM_MAXC(LL,CG('CO2-PPM'),J,W)$S_CM_MAXC(LL,'CO2-ATM',J,W) = MIN(S_CM_MAXC(LL,CG,J,W)+INF$(NOT S_CM_MAXC(LL,CG,J,W)),S_CM_MAXC(LL,'CO2-ATM',J,W)*CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')); - S_CM_MAXC(LL,CG('CO2-PPM'),J,W)$(S_CM_MAXC(LL,'FORCING',J,W)*(NOT CM_KIND('FORCING'))) = - MIN(S_CM_MAXC(LL,CG,J,W)+INF$(NOT S_CM_MAXC(LL,CG,J,W)),CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')* - EXP((S_CM_MAXC(LL,'FORCING',J,W)-CM_EXOFORC(LL))*LOG(2)/CM_CONST('GAMMA'))); - S_CM_MAXC(LL,CG,J,W)$(YEARVAL(LL) LT F) = 0; -$ BATINCLUDE fillsow.stc CM_MAXC '' 'CG' LL YES 'SUPERYR(T,LL)' YES -*----------------------------------------------------------------------------- -* Calculate linear slope for FORCING from CO2 -$LABEL SLOPE - IF(CM_KIND('FORCING'),OPTION FIL 0), 1); - -* perhaps other defaults for testing purposes: growth factors etc. - -*----------------------------------------------------------------------------- -* Create a set of all key components of cluster technologies -* Create a set of all cluster technologies -LOOP((RP(R,P),REG,PRC)$((TL_MRCLUST(R,P,REG,PRC) > 0.0)$TL_MRCLUST(R,P,REG,PRC)), - TL_RP_KC(R,P) = YES; TL_RP_CT(REG,PRC) = YES); - -*----------------------------------------------------------------------------- -* setting normal NCAP_COST of ETL technologies to zero to exclude this contribution fro the objective function -OBJ_ICOST(R,EACHYEAR,P,CUR)$SEG(R,P) = 0; -*----------------------------------------------------------------------------- -display ccapk, beta, alph; -*$LABEL NOMIP diff --git a/source/coef_ext.vda b/source/coef_ext.vda deleted file mode 100644 index 155fabf..0000000 --- a/source/coef_ext.vda +++ /dev/null @@ -1,74 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COEF_EXT.vda oversees extended preprocessor activities after COEF_MAIN -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Questions/Comments: -* -*----------------------------------------------------------------------------- - PARAMETER VDA_DISC(R,ALLYEAR); -$ CLEAR VDA_DISC -$ IFI NOT %WAVER%==YES $GOTO RESID -$ BATINCLUDE fillwave PRC_RESID PRC 0 -$ BATINCLUDE fillwave COM_PROJ COM 1 - OPTION CLEAR=VDA_DISC; -$ LABEL RESID -* Try making sensible RESID PASTI (although it does not affect solution) -* Finalize PRC_RESID capacity coefficients: - LOOP(T, TRACKP(R,P)$((PRC_RESID(R,T,P)>0)$PRC_RESID(R,T,P)) = YES); - LOOP(PYR_S(V), - LOOP(PRC_RCAP(TRACKP(R,P)),Z=SMAX(T,PRC_RESID(R,T,P));RTFORC(RTP_CPTYR(R,V,T,P))=Z-PRC_RESID(R,T,P)+EPS;PRC_RESID(R,T,P)$RTFORC(R,V,T,P)=Z); - NCAP_PASTI(R,V,P)$PRC_RESID(R,'0',P) = (SUM(T,PRC_RESID(R,T,P)*D(T))/SUM(T$(PRC_RESID(R,T,P)>0),D(T)))$TRACKP(R,P); - ); - PRC_RESID(R,'0',P)$(NOT TRACKP(R,P)) = 0; - COEF_CPT(RTP_CPTYR(R,PYR_S(V),T,P))$TRACKP(R,P) = PRC_RESID(R,T,P)/NCAP_PASTI(R,V,P); -*----------------------------------------------------------------------------- -* Offline capacity terms & STS amendments -$ SETGLOBAL UPSCAPS -SUM(TS_MAP(R,ALL_TS,S)$RPS_UPS(R,P,ALL_TS),%VAR%_UPS(R,V,T,P,ALL_TS,'N'%SOW%)) -$ IFI %OBMAC%==YES $macro var_sts(r,v,t,p,ts,bd) sum(rp_stl(r,p,tsl,bd)$ts_group(r,tsl,ts),%var%_udp(r,v,t,p,ts,bd%sow%)) -$ IFI NOT %STSFLX%==YES RP_STL(RP_STS,TSL,BD)=0; -*----------------------------------------------------------------------------- -* Get AF-UPs for processes having storage level constrained - COEF_AFUPS(RTP(R,V,P),S)$(NOT RPS_CAFLAC(R,P,S,'UP')) $= NCAP_AF(RTP,S,'UP')$RPS_STG(R,P,S); - COEF_AFUPS(RTP(R,V,P),S(STL))$RPS_STG(R,P,S) $= NCAP_AFC(RTP,%PGPRIM%,STL); - COEF_AFUPS(R,V,P,S)$(NOT PRC_CAP(R,P)) = NO; -* Cycling cost annuity - ACT_CSTUP(RTP(R,V,P),TSL(S),CUR)$(RDCUR(R,CUR)$STG_MAXCYC(RTP))=ACT_CSTUP(RTP,TSL,CUR)*G_DRATE(R,V,CUR)/(1-(1+G_DRATE(R,V,CUR))**(-NCAP_TLIFE(RTP))); -*----------------------------------------------------------------------------- -* Remove commodity balance equations from non-demand sinks - OPTION TRACKP < RTP, TRACKC < RHS_COMBAL, RCS < IRE_FLOSUM; - LOOP(TRACKP(R,P),TRACKC(R,C)$TOP(R,P,C,'IN') = YES); - TRACKC(R,C) $= SUM(RPC_IRE(TRACKP(R,P),C,'EXP'),1); - TRACKC(RC) $= SUM(RCS(RC,S),1); TRACKC(DEM)=YES; - TRACKC(R,C) $= SUM(RPC_NOFLO(TRACKP(R,P),C),1); - RCS_COMBAL(RTCS_VARC(R,T,C,S),L)$(NOT TRACKC(R,C)) = NO; - OPTION CLEAR=TRACKC,CLEAR=TRACKP,CLEAR=RCS; -*----------------------------------------------------------------------------- -* Add singleton ACT_EFFs to COEF_PTRANS or ACT_FLO - RP_CGC(RPG_1ACE) = YES; OPTION TRACKPC < RPG_1ACE, RP_GRP < RP_CGC; -* Convert ACT_EFF factors for reduced flows - TRACKPC(TRACKPC) = RPC_FFUNC(TRACKPC); - ACT_FLO(RTP(R,V,P),C,S)$(RPCS_VAR(R,P,C,S)$TRACKPC(R,P,C)) = 1/SUM(RP_CGC(R,P,CG,C),MAX(MICRO,ACT_EFF(RTP,CG,S)*(1+(ACT_EFF(RTP,C,S)-1)$ACT_EFF(RTP,C,S)))); -* Convert FLO_FUNCX factors for reduced flows - OPTION CG_GRP <= RTP_FFCX; - LOOP(RPCG_PTRAN(RP,C,COM,CG,CG2)$CG_GRP(RP,CG,CG2),IF(RPC_FFUNC(RP,C),RP_DCGG(RP,C,CG,CG2,'UP')=YES; ELSE RP_DCGG(RP,COM,CG,CG2,'LO')=YES)); - RP_DCGG(TRACKPC(RP,COM),CG,C,'UP')$(RP_CGC(RP,CG,COM)$RPC_ACT(RP,C)) $= CG_GRP(RP,CG,C); - RTP_FFCX(RTP_CAPYR(R,V,T,P),ACTCG,C)$RPC_FFUNC(R,P,C) $= SUM(RP_DCGG(R,P,C,CG,CG2,L),(POWER(RTP_FFCX(R,V,T,P,CG,CG2)+1,BDSIG(L))-1)$(RTP_FFCX(R,V,T,P,CG,CG2)+1)); - LOOP(RP_DCGG(R,P,C,CG,CG2,L),RTP_FFCX(R,V,T,P,CG,CG2)=0); -* Default to COEF_PTRAN - RP_CGC(R,P,CG,C)$TRACKPC(R,P,C) = NO; - COEF_PTRAN(RTP(R,V,P),CG,C,COM,S)$(RPCS_VAR(R,P,C,S)$RPC_PG(R,P,COM)$RP_CGC(R,P,CG,C)) = ACT_EFF(RTP,CG,S)*PRC_ACTFLO(RTP,COM)*(1+(ACT_EFF(RTP,C,S)-1)$ACT_EFF(RTP,C,S)); - ACT_EFF(R,LL,P,CG,S)$RP_GRP(R,P,CG) = 0; - OPTION RP_GRP < RP_CGC; RPCC_FFUNC(RP_GRP(R,P,CG),COM)$RPC_PG(R,P,COM) = YES; -$ IFI NOT %SENSIS%==YES OPTION CLEAR=RPCG_PTRAN; - OPTION CLEAR=TRACKPC,CLEAR=RP_GRP,CLEAR=CG_GRP,CLEAR=RP_DCGG,CLEAR=RTP_CAPYR,CLEAR=RP_CGC; -*----------------------------------------------------------------------------- -$ BATINCLUDE eqlducs.vda -$ BATINCLUDE eqashar.vda -$ IF DEFINED COM_CSTBAL $BATINCLUDE powerflo.vda CSTBAL - COEF_PVT(R,T)$(NOT COEF_PVT(R,T)) = FPD(T); - VDA_DISC(R,T) $= COEF_PVT(R,T); - COEF_ILED(RTP(R,T,P))$NCAP_BND(RTP,'N') = MOD(COEF_ILED(RTP),1000)+EPS$NCAP_ILED(RTP); diff --git a/source/coef_nio.mod b/source/coef_nio.mod deleted file mode 100644 index 8e72c8e..0000000 --- a/source/coef_nio.mod +++ /dev/null @@ -1,72 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COEF_NIO.MOD coefficient calculations for the flow equations I/OCOM on new * -* capacity * -*=============================================================================* -*GaG Questions/Comments: -* - COEF_RPTI calculated in PPMAIN.MOD -*[AL] Corrected bugs in the end of commodity flows in the OCOM case -*----------------------------------------------------------------------------- -* commodity flows tied to new capacity -*V0.5b 980828 re-adjust v,t handling to capture enclosed periods & condition to -* handle period of length 1 - RPC_CAPFLO(R,V,P,C)$(NOT RTP(R,V,P)) = 0; - FIL(V) = YEARVAL(V) GE MIYR_V1; -*V05c 980923 - use the capacity flow control set - LOOP(RPC_CAPFLO(R,FIL(V),P,C)$NCAP_ICOM(R,V,P,C), DFUNC = COEF_RPTI(R,V,P); - MY_F = NCAP_ILED(R,V,P); F = COEF_ILED(R,V,P); CNT = ABS(NCAP_CLED(R,V,P,C)); - Z = B(V)+MAX(1$(CNT$MY_F=0),MY_F); F = Z-MAX(1,MIN(CNT,F)); - IF(DFUNC GT 1, -* repeated investment - COEF_ICOM(R,T(V),T,P,C) = (DFUNC * NCAP_ICOM(R,V,P,C) / FPD(T)) - ELSE - LOOP(T$((E(T) >= F) * (B(T) < Z)), - COEF_ICOM(R,V,T,P,C) = -* some part of consumption in T -*V0.5 980718 - beginning of commodity flow is NCAP_ILED - NCAP_CLED! - MAX(0,((MIN(Z-1,E(T))-MAX(F,B(T)) + 1) / FPD(T))) * NCAP_ICOM(R,V,P,C) / (Z-F) - ); - ); - ); - -* commodity flows tied to decommissioning of capacity -*V05c 980921 - include the PASTInvestments, was looping over MILESTONYR -*V05c 980923 - use the capacity flow control set - LOOP(RPC_CAPFLO(R,V,P,C)$NCAP_OCOM(R,V,P,C), - F = NCAP_ILED(R,V,P); MY_F = NCAP_TLIFE(R,V,P); - Z = MAX(1,NCAP_DLIFE(R,V,P)); DFUNC = COEF_RPTI(R,V,P); - IF(DFUNC GT 1, - FOR(CNT = 1 TO CEIL(DFUNC), - COEF_OCOM(R,V,T,P,C)$(YEARVAL(T) >= YEARVAL(V)) = - COEF_OCOM(R,V,T,P,C) + MIN(1,DFUNC-CNT+1) * - (MAX(0,(MIN(B(V)+F+(CNT*MY_F)+NCAP_DLAG(R,V,P)+Z,E(T)+1) - - MAX(B(V)+F+(CNT*MY_F)+NCAP_DLAG(R,V,P),B(T)) - ) / FPD(T) - ) * (NCAP_OCOM(R,V,P,C) / Z) - ) - ) - ELSE - COEF_OCOM(R,V,T,P,C)$(YEARVAL(T) >= YEARVAL(V)) = -* some part of release in T - MAX(0,(MIN(B(V)+F+MY_F+NCAP_DLAG(R,V,P)+Z,E(T)+1) - - MAX(B(V)+F+MY_F+NCAP_DLAG(R,V,P),B(T)) - ) / FPD(T) - ) * (NCAP_OCOM(R,V,P,C) / Z) - ); - ); - OPTION CLEAR = CNT; -*display coef_icom, coef_ocom; - -* Modification: Convert negative ICOM to OCOM so that NCAP-related outputs can also be modeled -* Modification: Convert negative OCOM to ICOM so that DECOM-related inputs can also be modeled - COEF_OCOM(R,V,T,P,C)$((COEF_ICOM(R,V,T,P,C) LT 0)$COEF_ICOM(R,V,T,P,C)) = COEF_OCOM(R,V,T,P,C)-COEF_ICOM(R,V,T,P,C); - COEF_ICOM(R,V,T,P,C)$((COEF_ICOM(R,V,T,P,C) LT 0)$COEF_ICOM(R,V,T,P,C)) = 0; - COEF_ICOM(R,V,T,P,C)$((COEF_OCOM(R,V,T,P,C) LT 0)$COEF_OCOM(R,V,T,P,C)) = COEF_ICOM(R,V,T,P,C)-COEF_OCOM(R,V,T,P,C); - COEF_OCOM(R,V,T,P,C)$((COEF_OCOM(R,V,T,P,C) LT 0)$COEF_OCOM(R,V,T,P,C)) = 0; - -* Allow using NCAP_CLED as NCAP_CLAG, if no NCAP_ICOM - NCAP_CLAG(RTP,C,IO)$((NOT NCAP_ICOM(RTP,C))$NCAP_COM(RTP,C,IO)) $= NCAP_CLED(RTP,C); - NCAP_CLED(R,V,P,C)$(NOT NCAP_ICOM(R,V,P,C)) = 0; diff --git a/source/coef_obj.mod b/source/coef_obj.mod deleted file mode 100644 index 3c2da22..0000000 --- a/source/coef_obj.mod +++ /dev/null @@ -1,205 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COEF_OBJ.MOD do coefficient calculations for the OBJ -* %1 - mod or v# for the source code to be used -*=============================================================================* -* responsible for moving cost data to EACHYEAR from each input period -*----------------------------------------------------------------------------- -* Declarations - ALIAS(K,EACHYEAR); - SET Y(ALLYEAR); - SET Y_EOH(ALLYEAR); - SET YK(ALLYEAR,ALLYEAR); - SET TS_ANN(S,S); - TS_ANN(S,S) = YES; - TS_ANN(S,ANNUAL) = YES; - SCALARS YR_V1 /0/, YR_VL /0/, ACL /0/; - -* For shaped demand elasticises - ALIAS(AGE,SPAN); - SET SHEDJ(LIM,J) 'Elastic demand shape indexes'; - PARAMETER SHAPED(BD,J,AGE) 'Elastic demand shape curves' //; - -* establish eachyear sets matching documentation - YR_VL = MIYR_VL+DUR_MAX; - LOOP(RTP(R,PASTMILE(LL),P)$NCAP_ILED(R,LL,P), K(LL+NCAP_ILED(R,LL,P)) = YES); - Y(K)$((YEARVAL(K) >= MINYR) * (YEARVAL(K) <= YR_VL)) = YES; - YK(Y,K)$(YEARVAL(K)<=YEARVAL(Y)) = YES; -$IFI '%ANNCOST%'==LEV ACL=MINYR; MINYR=MIYR_V1; RPT_OPT('OBJ','2')=1; -$IFI '%ANNCOST%%CTST%'==LEV MINYR=ACL; - Y_EOH(EOHYEARS)$(YEARVAL(EOHYEARS) >= MINYR) = YES; - - OPTION CLEAR=FIL; - YR_V1 = MIN(SMIN(DATAYEAR,YEARVAL(DATAYEAR)),PYR_V1); - YR_VL = MAX(SMAX(DATAYEAR,YEARVAL(DATAYEAR)),YR_VL); - FIL(LL)$((YEARVAL(LL) GE YR_V1)*(YEARVAL(LL) LE YR_VL)) = YES; - -* interpolate discount rates -$ BATINCLUDE filparam.gms G_DRATE 'R,' CUR ",'','','','',''" ALLYEAR LL FIL(LL)$ FIL(LL)$ - -* set discounting factor OBJ_DISC in 'cumulative' way, covering EACHYEAR -* First, initialize the discount factor for YR_V1 to 1.0: - OBJ_DISC(R,LL,CUR)$(RDCUR(R,CUR)$(YEARVAL(LL)=YR_V1)) = 1; - IF(G_DYEAR=0,G_DYEAR=SUM(MIYR_1(T),YEARVAL(T))); -* Calculate all discount factors with respect to YR_V1: - LOOP(FIL(LL-1), OBJ_DISC(R,LL,CUR) = OBJ_DISC(R,FIL,CUR) / (1+G_DRATE(R,LL,CUR))); -* Find the year among FIL that is closest to the base year G_DYEAR: - F = SUM(MIYR_1(LL),YEARVAL(LL)-MAX(MIN(YR_VL,G_DYEAR),YR_V1)); -* Normalize all discount factors so that the base year discount factor = 1.0: - LOOP(RDCUR(R,CUR), - Z = SUM(MIYR_1(LL+F),OBJ_DISC(R,LL,CUR)*(1+G_DRATE(R,LL,CUR))**(-(G_DYEAR-YEARVAL(LL)))); - OBJ_DISC(R,FIL(LL),CUR) = OBJ_DISC(R,LL,CUR) / Z); -* Prevent divide-by-zero if zero discount rate - G_DRATE(R,V,CUR)$((G_DRATE(R,V,CUR) LE 0)$RDCUR(R,CUR)) = 1E-11; -*----------------------------------------------------------------------------- -* Calculate present value factors for time in periods - LOOP(R$(NOT SUM(G_RCUR(RDCUR(R,CUR)),1)), - Z = SMAX(RDCUR(R,CUR), SUM(T,D(T)*OBJ_DISC(R,T,CUR))); - LOOP(RDCUR(R,CUR)$Z, F=SUM(T,D(T)*OBJ_DISC(R,T,CUR)); - IF(ABS(F-Z) LT 1E-7, G_RCUR(R,CUR) = YES; Z = 0))); - OBJ_PVT(R,T,CUR)$RDCUR(R,CUR) = SUM(PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR)); - COEF_PVT(R,T) = SUM(G_RCUR(R,CUR),OBJ_PVT(R,T,CUR)); - OBJ_RFR(R,V,CUR) $= G_DRATE(R,V,CUR); - OBJ_RFR(R,V,CUR)$RDCUR(R,CUR) $= G_RFRIR(R,V); -*----------------------------------------------------------------------------- -* move original data from input to annual value arrays -* commodity costs - OBJ_COMNT(R,DATAYEAR,C,S,COSTYPE,CUR)$(NOT COM_TS(R,C,S)) = 0; - OBJ_COMPD(R,DATAYEAR,C,S,COSTYPE,CUR)$(NOT COM_TS(R,C,S)) = 0; - -* IRE_PRICE - exports negative -* Take IRE_PRICE into account ONLY if the trade is exogenous; map ALL_R into R: -* Additionally allow using R directly as a placeholder of any external region - LOOP(ALL_R$(NOT REG(ALL_R)),OBJ_IPRIC(R,DATAYEAR,P,C,S,IE,CUR)$RPC_IREIO(R,P,C,IE,'OUT') $= - IRE_PRICE(R,DATAYEAR,P,C,S,ALL_R,IE,CUR)*(1-2$XPT(IE))); - OBJ_IPRIC(R,DATAYEAR,P,C,S,IE,CUR)$RPC_IREIO(R,P,C,IE,'OUT') $= IRE_PRICE(R,DATAYEAR,P,C,S,R,IE,CUR)*(1-2$XPT(IE)); -* flow costs; remove invalid costs on storage flows - FLO_COST(R,LL,P,C,S,CUR)$((NOT TOP(R,P,C,'IN'))$RPC_STG(R,P,C)) = 0; - FLO_DELIV(R,LL,P,C,S,CUR)$((NOT TOP(R,P,C,'OUT'))$RPC_STG(R,P,C)) = 0; - OBJ_FSUB(R,LL,P,C,S,CUR) $= FLO_TAX(R,LL,P,C,S,CUR); - OBJ_FSUB(R,LL,P,C,S,CUR)$FLO_SUB(R,LL,P,C,S,CUR) = OBJ_FSUB(R,LL,P,C,S,CUR)-FLO_SUB(R,LL,P,C,S,CUR); - OBJ_FSUB(R,LL,P,C,S,CUR)$((NOT V(LL))$OBJ_VFLO(R,P,C,CUR,'SUB')) = 0; - OPTION RPC_CUR <= FLO_COST; OBJ_VFLO(RPC_CUR,'COST') = YES; - OPTION RPC_CUR <= FLO_DELIV; OBJ_VFLO(RPC_CUR,'COST') = YES; - OPTION RPC_CUR <= FLO_TAX; OBJ_VFLO(RPC_CUR,'TAX') = YES; - OPTION RPC_CUR <= FLO_SUB; OBJ_VFLO(RPC_CUR,'SUB') = YES; -* remove proportional subsidy if absolute defined - IF(CARD(NCAP_ISPCT),OPTION PRC_YMAXZ-1.5-INF$ACTCG(CG)) = 0; - OPTION RP_GRP <= FLO_FUNCX,PRC_YMIN < RP_GRP,CLEAR=PRC_YMAX; - TRACKP(RP)$PRC_YMIN(RP) $= PRC_VINT(RP)+RP_GRP(RP,'CAPFLO'); - RTP_CAPYR(RTP_CPTYR(R,V,T,P)) $= TRACKP(R,P); - - LOOP(AGEJ(J,AGE)$CARD(TRACKP), - LOOP(V, -* Set the starting and ending years taking into account NCAP_ILED: - PRC_YMIN(TRACKP(R,P)) = B(V)+ROUND(NCAP_ILED(R,V,P)); - PRC_YMAX(TRACKP(R,P)) = PRC_YMIN(R,P)+ROUND(NCAP_TLIFE(R,V,P))-1; -* Calculate average SHAPE for plants still operating in each period: - RTP_FFCX(RTP_CAPYR(R,V,T,P),CG1,CG2)$FLO_FUNCX(R,V,P,CG1,CG2) = - SUM(PERIODYR(T,EOHYEARS)$(YEARVAL(EOHYEARS) LE MAX(B(T),PRC_YMAX(R,P))), - SHAPE(J+(FLO_FUNCX(R,V,P,CG1,CG2)-1),AGE+(MIN(YEARVAL(EOHYEARS),PRC_YMAX(R,P))-PRC_YMIN(R,P)))) - / (MAX(1,MIN(E(T),PRC_YMAX(R,P))-MAX(B(T),PRC_YMIN(R,P))+1)) -1; - ); -* For repeated investments, use the average SHAPE over lifetime: - RVPRL(RTP(R,T,P))$((COEF_RPTI(RTP)>1)$TRACKP(R,P)) = ROUND(NCAP_TLIFE(RTP)-1)+EPS; - RTP_FFCX(RTP_CAPYR(R,TT,T,P),CG1,CG2)$(RVPRL(R,TT,P)$FLO_FUNCX(R,TT,P,CG1,CG2)) = - SUM(OPYEAR(AGE+RVPRL(R,TT,P),LIFE),SHAPE(J+(FLO_FUNCX(R,TT,P,CG1,CG2)-1),LIFE)) / (RVPRL(R,TT,P)+1) -1; - ); -* Shapes for capacity-related commodity flows - COEF_CIO(RTP_CAPYR(R,V,T,P),C,IO)$NCAP_COM(R,V,P,C,IO) $= RTP_FFCX(R,V,T,P,'CAPFLO',C); - COEF_CIO(RTP_CPTYR(R,V,T,P),C,IO)$NCAP_CLAG(R,V,P,C,IO) = SIGN(NCAP_CLAG(R,V,P,C,IO)) * - (MAX(0, E(T)+1-MAX(B(V)+NCAP_ILED(R,V,P)+ABS(NCAP_CLAG(R,V,P,C,IO)),B(T))) / - MAX(.1,E(T)+1-MAX(B(V)+NCAP_ILED(R,V,P),B(T)))-1)-1$(NCAP_CLAG(R,V,P,C,IO)<0); - RTP_FFCX(RTP_CAPYR,'CAPFLO',CG) = 0; -* Option for non-vintaged FLO_FUNC multipliers - RTP_FFCX(RTP_VINTYR(R,V,T,P),CG,CG2)$((FLO_FUNC(R,V,P,CG,CG2,'ANNUAL')>0)$RTP_CGC(R,V,P,CG,CG2))=FLO_FUNC(R,T,P,CG,CG2,'ANNUAL')/FLO_FUNC(R,V,P,CG,CG2,'ANNUAL')-1; - OPTION CLEAR=RTP_CGC,CLEAR=TRACKP,CLEAR=RVPRL,CLEAR=RP_GRP; -*------------------------------------------------------------------------------ -* Shaping of COEF_CPT -*------------------------------------------------------------------------------ -* Remove NCAP_CPX indexes that won't have any effect - Z=CARD(J)/2+1; - NCAP_CPX(RTP)$(ABS(NCAP_CPX(RTP)-Z)>Z-1.5) = 0; - OPTION PRC_YMIN < NCAP_CPX,CLEAR=PRC_YMAX; - - LOOP(AGEJ(J,AGE)$CARD(NCAP_CPX), - TRACKP(RP) $= PRC_YMIN(RP); - LOOP(V, -* Set the starting and ending years taking into account NCAP_ILED: - PRC_YMIN(TRACKP(R,P)) = B(V)+ROUND(NCAP_ILED(R,V,P)); - PRC_YMAX(TRACKP(R,P)) = PRC_YMIN(R,P)+NCAP_TLIFE(R,V,P); -* Calculate weighted average SHAPE for plants still operating in each period: - LOOP(G_RCUR(R,CUR), - COEF_CAP(RTP_CPTYR(R,V,T,P))$NCAP_CPX(R,V,P) = - SUM(PERIODYR(T,Y_EOH)$(YEARVAL(Y_EOH)1)$NCAP_CPX(RTP)) = ROUND(NCAP_TLIFE(RTP)-1)+EPS; - COEF_CAP(RTP_CPTYR(R,V(TT),T,P))$RVPRL(R,V,P) = - SUM(OPYEAR(AGE+RVPRL(R,V,P),LIFE),SHAPE(J+(NCAP_CPX(R,V,P)-1),LIFE)) / (RVPRL(R,V,P)+1); - COEF_CAP(R,V,T,P)$COEF_CAP(R,V,T,P) = 1/MAX(1,COEF_CPT(R,V,T,P)/COEF_CAP(R,V,T,P))-1; - ); - OPTION RTP_CPX <= COEF_CAP; - COEF_CPT(R,V,T,P)$COEF_CAP(R,V,T,P) = COEF_CPT(R,V,T,P)*(COEF_CAP(R,V,T,P)+1); - OPTION CLEAR=PRC_YMIN,CLEAR=PRC_YMAX,CLEAR=TRACKP,CLEAR=COEF_CAP,CLEAR=RVPRL; diff --git a/source/coefmain.mod b/source/coefmain.mod deleted file mode 100644 index c171dee..0000000 --- a/source/coefmain.mod +++ /dev/null @@ -1,29 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COEFMAIN.MOD oversees the bulk of the coefficient calculations -* %1 - mod or v# for the source code to be used -*=============================================================================* -*GaG Questions/Comments: -*----------------------------------------------------------------------------- -$IFI NOT %STAGES%==YES SOW(ALLSOW)=DIAG(ALLSOW,'1'); SW_T(T,ALLSOW)=SOW(ALLSOW); - -* handle the capacity transfer and related equation coefficients -$ BATINCLUDE coef_cpt.%1 %1 - -* derive the coefficients related to NCAP I/O flows for new/released -$ BATINCLUDE coef_nio.%1 - -* derive the coefficients related to process transformation -$ BATINCLUDE coef_ptr.%1 - -* derive the coefficients for the OBJ -$ BATINCLUDE coef_obj.%1 %1 - -* derive the additional/adjusted coefficients needed for alternate objectives -$ BATINCLUDE coef_alt.lin VAR%CTST% - -* derive shaped coefficients for process transformation and capacity transfer -$ BATINCLUDE coef_shp.%1 diff --git a/source/cost_ann.rpt b/source/cost_ann.rpt deleted file mode 100644 index 552f634..0000000 --- a/source/cost_ann.rpt +++ /dev/null @@ -1,208 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* COST_ANN: annual cost calculation -* - Investment Costs, Tax/Subsidies -* - Decommissioning -* - Fixed costs and taxes -* - Variable costs and Taxes/Subsidies -*----------------------------------------------------------------------------- -* %1 - Prefix for parameter names (optional) -* %2 - SOW, (optional) -*=============================================================================* - OBJ_YES(NCAP_YES)=YES; - OPTION CLEAR=COEF_CAP; CNT=1$ROUND(RPT_OPT('OBJ','2')); - COEF_CAP(RTP_CPTYR(R,V,T,P))$(NCAP_YES(R,V,P)$PRC_RCAP(R,P)) = VAR_SCAP.L(R,V,T,P)/RTP_CAPVL(R,V,P); -* Levelized annual investment and fixed costs - IF(CNT, OPTION CLEAR=PAR_OBJCAP; - PAR_OBJCAP(OBJ_ICUR(NCAP_YES(R,V,P),CUR)) = SUM(RTP_CPTYR(R,V,T,P),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR)); - RTP_OBJ(J,R,V,P,CUR)$RTP_OBJ(J,R,V,P,CUR) = (RTP_OBJ(J,R,V,P,CUR)/PAR_OBJCAP(R,V,P,CUR))$PAR_OBJCAP(R,V,P,CUR); - %1CST_INVC(%2RTP_CPTYR(R,V,T,P),SYSINV)$NCAP_YES(R,V,P) = - SUM(RDCUR(R,CUR),RTP_OBJ('1',R,V,P,CUR)*COEF_CPT(R,V,T,P)*ABS(SYSONE(SYSINV)-COEF_CRF(R,V,P,CUR))); - %1CST_INVX(%2RTP_CPTYR(R,V,T,P),SYSINV)$NCAP_YES(R,V,P) = - SUM(RDCUR(R,CUR),RTP_OBJ('2',R,V,P,CUR)*COEF_CPT(R,V,T,P)*ABS(SYSONE(SYSINV)-COEF_CRF(R,V,P,CUR))); - IF(ACL, - PAR_OBJCAP(OBJ_FCUR(NCAP_YES(R,V,P),CUR)) = SUM(RTP_CPTYR(R,V,T,P),COEF_CPT(R,V,T,P)*(1-COEF_CAP(R,V,T,P))*OBJ_PVT(R,T,CUR)); - RTP_NPV(J,R,V,P,CUR)$RTP_NPV(J,R,V,P,CUR) = (RTP_NPV(J,R,V,P,CUR)/PAR_OBJCAP(R,V,P,CUR))$PAR_OBJCAP(R,V,P,CUR); - %1CST_FIXC(%2RTP_CPTYR(R,V,T,P))$NCAP_YES(R,V,P) = SUM(RDCUR(R,CUR),RTP_NPV('1',R,V,P,CUR)*COEF_CPT(R,V,T,P)*(1-COEF_CAP(R,V,T,P))); - %1CST_FIXX(%2RTP_CPTYR(R,V,T,P))$NCAP_YES(R,V,P) = SUM(RDCUR(R,CUR),RTP_NPV('2',R,V,P,CUR)*COEF_CPT(R,V,T,P)*(1-COEF_CAP(R,V,T,P))); - OPTION CLEAR=COEF_CAP); - OPTION CLEAR=NCAP_YES; - ); -*------------------------------------------------------------------------------ -* Cases I - Investment Cost and II - Taxes/Subsidies -*------------------------------------------------------------------------------ -* Calculate Annual undiscounted investment costs CST_INVC -$SET TMP '' SET X1 '' SETLOCAL SIC 1 -$IFI %STAGES%==YES PASTSUM(NCAP_YES(R,T,P)) = SUM(SW_TSW(SOW,T,WW),OBJ_SIC(R,T,P,WW)); -$IFI %STAGES%==YES $SETLOCAL SIC 1+PASTSUM(R,V,P) - -OPTION CLEAR=FIL,COEF_RVPT<=COEF_CPT; IF(NOT CNT,NCAP_YES(R,PYR_S,P)$PRC_RESID(R,'0',P)=NO); - -LOOP(OBJ_ICUR(NCAP_YES(R,V,P),CUR), OPTION CLEAR=YKK; MY_F=%SIC%; - SYSPLIT(SYSINV)=ABS(SYSONE(SYSINV)-COEF_CRF(R,V,P,CUR)); - F = RTP_CAPVL(R,V,P)*OBJ_CRF(R,V,P,CUR)/OBJ_DIVI(R,V,P); - LOOP(OBJ_SUMII(R,V,P,LIFE,K_EOH,JOT), Z=ORD(LIFE); FIL(T)=VNT(V,T)$(M(T) 1 index -*$ if '%whtype%' == 'P' $goto param3 - -scalar colcnt; -IF(CARD(%row%) > 0, -$ set preditem 'table' - put / ' ':9,'%whtype%: Solution Reference ','%1':10," '",%1.ts:40,"'" / @24; - colcnt = 0; - loop(col$(colcnt < 19), - put col.tl:11; - colcnt = colcnt + 1 - ); - loop((REG,%row%)$(DUMP0 + SUM(col,%1.%whtype%(REG,col,%row%))), - put / @4 REG.TL:0,'.',%row%.te(%row%) @24; - colcnt = 0; - loop(col, - if(colcnt = 19, - colcnt = 0 - put / @10 col.tl:4 @20 '+++' @24); - colcnt = colcnt + 1; - if(%1.%whtype%(REG,col,%row%), - put %1.%whtype%(REG,col,%row%):<10 ' ' - else - put ' ':11 ))); - put /; -); - -$offuni -option clear=%row%,clear=col; -$shift goto more -*--------------------------------- -$LABEL OTHER -* handle the time-dependant tables by putting out everything -$if NOT '%whtype%' == 'P' col(%whtype%) = yes; - -loop((REG,%c%,%r%)$%1(REG,%c%,%r%), - col(%c%) = yes; - %row%(%r%) = yes); - -* handle parameters with > 1 index -$ if '%whtype%' == 'P' $goto param3 - -scalar colcnt; -IF(CARD(%row%) > 0, -$ set preditem 'table' - put / ' ':9,'TABLE':6,'%1':10," '",%1.ts:40,"'" / @44; - colcnt = 0; - loop(col$(colcnt < 19), - put col.tl:11; - colcnt = colcnt + 1 - ); - loop((REG,%row%)$(DUMP0 + SUM(col,%1(REG,col,%row%))), - put / @4 REG.TL:0,'.',%row%.te(%row%) @44; - colcnt = 0; - loop(col, - if(colcnt = 19, - colcnt = 0 - put / @10 col.tl:4 @40 '+++' @44); - colcnt = colcnt + 1; - if(%1(REG,col,%row%), - put %1(REG,col,%row%):<10 ' ' - else - put ' ':11 ))); - put /; -); -$goto donetab - -* handle parameters with >2 index -$label param3 - -IF(CARD(%row%) > 0, - put / ' ':9,'PARAMETER'@20,'%1':10," '",%1.ts:40,"'"; - loop((REG,col,%row%)$(DUMP0 + (%1(REG,col,%row%) NE 0)), - put / @15, REG.TL:0,'.'col.tl'.'%row%.te(%row%) @66 %1(REG,col,%row%):<10; ); - put /; -); - -$label donetab -$offuni -option clear=%row%,clear=col; -$shift goto more - -$label scalar -* simple scalar -$if not '%preditem%' == 'scalar' put / ' ':9, 'SCALARS' / -$set preditem 'scalar' -put ' ':15,'%1':10,"/ " %1:10 " /" /; -$shift goto more - -$label param2 -$set preditem 'parameter' -$hidden works for any dimension - -$set rc %r% -set %row%(%rc%); - -$ onuni -LOOP(REG, - %row%(%rc%)$%1(REG,%rc%) = yes; -); -IF(CARD(%row%) > 0, - put / ' ':9,'PARAMETER' , @20,'%1':10,"'",%1.ts:40,"' /"; - loop((REG,%row%)$(DUMP0 + (%1(REG,%row%) NE 0)), - put / @15, REG.TL:0'.'%row%.te(%row%) @44 %1(REG,%row%):<10; ); - put @69 '/' /; - option clear=%row%; - put /; -); -$ offuni -$shift goto more - -$label param1 -$set preditem 'parameter' -$hidden works for any dimension - -$set rc %r% -set %row%(%rc%); - -$ onuni -%row%(%rc%)$%1(%rc%) = yes; -IF(CARD(%row%) > 0, - put / ' ':9,'PARAMETER' , @20,'%1':10,"'",%1.ts:40,"' /"; - loop(%row%$(DUMP0 + (%1(%row%) NE 0)), - put / @15, %row%.te(%row%) @44 %1(%row%):<10; ); - put @69 '/' /; - option clear=%row%; - put /; -); -$offuni -option clear=%row%,clear=col; -$shift goto more - -$label done diff --git a/source/dumpsolv.mod b/source/dumpsolv.mod deleted file mode 100644 index 8c23925..0000000 --- a/source/dumpsolv.mod +++ /dev/null @@ -1,92 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* DUMPSOLV.MOD outputs the actual solution values when vintage index -* Dumps output SET, SCALARS, PARAMETER, TABLE -* -* 1 - type indicator = 'L'evel/'M'arginal -* 2-n - for rest of line = component names -* -* - Note that (declaration) is not output -* - $BATINCLUDE dumpsol.mod ITEM1 ITEM2 ... must fit on one line -* -*=============================================================================* -*GaG Questions/Comments: -*----------------------------------------------------------------------------- -$IF '%1'==M $set vy '(fil)' set disc coef_pvt(reg,fil) -$IF '%1'==L $set vy '' set disc 1 -option clear=fil; - -file.tf = 0; -$offlisting -$set preditem '' - -* hold the first parameter for later checking -$set whtype %1 -*GG* later take 2nd as name of set controlling the TABLE column header to improve xeq -$shift - -$label more - -* only one call executes, so done when no more parameters -$if %1a == a $goto done - -$if declared %1.%whtype% $goto declared -* out error message if passed entity not declared -put / '*** UNKNOWN':20,'NAME':6,'%1':10 /; -$set preditem 'unknown' -$shift goto more - -$label declared - -file.nr=3; -$if dimension 0 %1 $goto done -$if dimension 1 %1 $goto done -$if dimension 2 %1 $goto done -$if dimension 3 %1 $goto done -$if not declared u1 alias(u1,u2,u3,u4,u5,u6,u7,u8,u9,*); -$if dimension 4 %1 $set r 'u1' set row row4a -$if dimension 5 %1 $set r 'u1,u2' set row row5a -$if dimension 6 %1 $set r 'u1,u2,u3' set row row6a -$if dimension 7 %1 $set r 'u1,u2,u3,u4' set row row7a -$if dimension 8 %1 $set r 'u1,u2,u3,u4,u5' set row row8a -$if dimension 9 %1 $set r 'u1,u2,u3,u4,u5,u6' set row row9a -file.tf=3; - -set %row%(%r%); -$onuni - -loop((REG,v,ll,%r%)$%1.%whtype%(REG,v,ll,%r%), - fil(ll) = yes; - %row%(%r%) = yes); - -scalar colcnt; -IF(CARD(%row%) > 0, -$ set preditem 'table' - put / ' ':9,'%whtype%: Solution Reference ','%1':10," '",%1.ts:40,"'" / @34; - colcnt = 0; - loop(fil$(colcnt < 19), - put fil.tl:11; - colcnt = colcnt + 1 - ); - loop((REG,%row%)$(DUMP0 + SUM((v,fil)$%1.%whtype%(REG,v,fil,%row%),1)), - put / @4 REG.TL:0,'.',%row%.te(%row%) @34; - colcnt = 0; - loop(fil, - if(colcnt = 19, - colcnt = 0 - put / @10 fil.tl:4 @30 '+++' @34); - colcnt = colcnt + 1; - z = sum(v%vy%,%1.%whtype%(REG,v,fil,%row%)) - if(z, put (z/%disc%):<10 ' ' - else put ' ':11) - )); - put /; -); - -$offuni -option clear=%row%,clear=fil; -$shift goto more -$label done diff --git a/source/dynslite.vda b/source/dynslite.vda deleted file mode 100644 index f5131ed..0000000 --- a/source/dynslite.vda +++ /dev/null @@ -1,115 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* dynslite.vda - experimental lite implementation for dynamic timeslice trees -*=============================================================================* -$ IF %RTS%==S $EXIT -$ SET TMP $NORTS(R,T,S) - IF(CARD(NORTS), -$ GOTO %1 -*------------------------------ -$ LABEL PRELEV -$ IFI %DUC%==YES Abort "TS_OFF cannot be used with DUC"; -* Remove timeslices turned off -* Bounds+varcosts pre-cleared only - ACT_BND(R,T,P,S,BD)%TMP%=0; - COM_BNDNET(R,T,C,S,BD)%TMP%=0; - COM_BNDPRD(R,T,C,S,BD)%TMP%=0; - FLO_BND(R,T,P,CG,S,BD)%TMP%=0; - FLO_FR(R,T,P,C,S,L)%TMP% = 0; - IRE_BND(R,T,C,S,ALL_R,IE,BD)%TMP%=0; - IRE_XBND(R,T,C,S,IE,BD)%TMP%=0; - STGIN_BND(R,T,P,C,S,BD)%TMP%=0; - STGOUT_BND(R,T,P,C,S,BD)%TMP%=0; - COM_BPRICE(R,T,C,S,CUR)%TMP%=0; -$ LABEL CLEAR -* Vintage-based cleared selectively -$ SETLOCAL RTS $(NORTS(R,V,S)+NORTS(R,T,S)$PASTMILE(V)) - RVP(RTP(R,T,P))$(NOT PRC_VINT(R,P))=YES; - ACT_FLO(RVP(R,T,P),CG,S)%TMP%=0; - FLO_FUNC(RVP(R,T,P),CG,CG2,S)%TMP%=0; - FLO_SUM(RVP(R,T,P),CG,C,CG2,S)%TMP%=0; - NCAP_AF(RVP(R,T,P),S,BD)%TMP%=0; - FLO_SHAR(RVP(R,T,P),C,CG,S,BD)%TMP%=0; - FLO_ASHAR(RVP(R,T,P),C,CG,S,BD)%TMP%=0; - STG_LOSS(RVP(R,T,P),S)%TMP%=0; - IRE_FLO(RVP(R,T,P),C,ALL_R,COM,S)%TMP%=0; - ACT_EFF(RVP(R,T,P),CG,S)%TMP%=0; - OPTION CLEAR=RVP; -* Vintaged ANNUAL - RVP(RTP(R,V,P))$PRC_VINT(R,P)$=PRC_TSL(R,P,'ANNUAL'); - LOOP(MIYR_1(T), - ACT_FLO(RVP(R,V,P),CG,S)$(RPS_S1(R,P,'ANNUAL')%RTS%)=0; - FLO_FUNC(RVP(R,V,P),CG,CG2,S)%RTS%=0; - FLO_SUM(RVP(R,V,P),CG,C,CG2,S)$(RPCS_VAR(R,P,C,'ANNUAL')%RTS%)=0; - NCAP_AF(RVP(R,V,P),S,BD)%RTS%=0; - FLO_SHAR(RVP(R,V,P),C,CG,S,BD)$(RPCS_VAR(R,P,C,'ANNUAL')%RTS%)=0; - FLO_ASHAR(RVP(R,V,P),C,CG,S,BD)$(RPS_S2(R,P,'ANNUAL')%RTS%)=0; - STG_LOSS(RVP(R,V,P),S)%RTS%=0; - IRE_FLO(RVP(R,V,P),C,ALL_R,COM,S)%RTS%=0); - OPTION CLEAR=RVP; -* Milestonyr-based all cleared - COM_IE(R,T,C,S)%TMP%=0; - COM_PKFLX(R,T,C,S)%TMP%=0; - COM_ELAST(R,T,C,S,L)%TMP%=0; - FLO_PKCOI(R,T,P,C,S)%TMP%=0; - STG_SIFT(R,T,P,C,S)%TMP%=0; - IRE_FLOSUM(R,T,P,C,S,IE,COM,IO)%TMP%=0; - UC_ACT(UCN,SIDE,R,T,P,S)%TMP%=0; - UC_FLO(UCN,SIDE,R,T,P,C,S)%TMP%=0; - UC_IRE(UCN,SIDE,R,T,P,C,S,IE)%TMP%=0; - UC_COM(UCN,COM_VAR,SIDE,R,T,C,S,UC_GRPTYPE)%TMP%=0; - UC_RHSRTS(R,UCN,T,S,L)%TMP% = 0; -$ GOTO FINISH -*------------------------------ -$ LABEL REDUCE -* Remove from sets timeslices turned off - RTPS_OFF(RTP(R,T,P),S)$PRC_TS(R,P,S) $= NORTS(R,T,S); - RTPCS_OUT(RTP(R,T,P),C,S)$RPCS_VAR(R,P,C,S) $= NORTS(R,T,S); - RTCS_VARC(R,T,C,S)%TMP% = NO; - RCS_COMBAL(R,T,C,S,BD)%TMP% = NO; - RCS_COMPRD(R,T,C,S,BD)%TMP% = NO; - RHS_COMBAL(R,T,C,S)%TMP% = NO; - RHS_COMPRD(R,T,C,S)%TMP% = NO; - RTX_MARK(R,T,ITEM,C,BD,S)%TMP% = NO; -$ GOTO FINISH -*------------------------------ -$ LABEL POSTLEV -* After all levelized, re-interpolate coping ANNUAL fallback -$ SET RESET 0 - RVP(RTP(R,V,P))$PRC_VINT(R,P)$=PRC_TSL(R,P,'ANNUAL'); - OPTION FIL0' X_RPGGS X_RPGGS - RVP(R,V,P)$(NOT RPS_S1(R,P,'ANNUAL')) = NO; - ACT_EFF(R,LL--ORD(LL),P,CG,ANNUAL)$(ACT_EFF(R,LL,P,CG,ANNUAL)$RVP(R,LL,P))=3; - ACT_FLO(R,LL--ORD(LL),P,CG,ANNUAL)$(ACT_FLO(R,LL,P,CG,ANNUAL)$RVP(R,LL,P))=3; - FLO_SUM(R,LL--ORD(LL),P,CG,C,CG2,ANNUAL)$(FLO_SUM(R,LL,P,CG,C,CG2,ANNUAL)$RVP(R,LL,P))=3; -$ BATINCLUDE fillparm ACT_EFF R 'P,CG,ANNUAL' ",'','',''" V 'RVP(R,V,P)' '>0' X_RPGS X_RPGS -$ BATINCLUDE fillparm ACT_FLO R 'P,CG,ANNUAL' ",'','',''" V 'RVP(R,V,P)' '>0' X_RPGS X_RPGS -$ BATINCLUDE fillparm FLO_SUM R 'P,CG1,C,CG2,ANNUAL' ",''" V 'RVP(R,V,P)' '>0' X_RPGCGS X_RPGCGS - OPTION DATAYEAR1)=YES; RPC_CUR(R,P,%PGPRIM%,CUR)=YES); - RP_UPS(RP,TSL,L)$SUM(PRC_TSL(RP,TSLVL)$(ORD(TSL)>ORD(TSLVL)),1)=NO; - RPS_UPS(RP,S)$SUM(RP_UPS(PRC_TSL(RP,TSL),L),1)=NO; - RPS_UPS(R,P,S) $= SUM(RP_UPS(R,P,TSL,L)$TS_GROUP(R,TSL,S),1); - RP_UPS(R,P,TSL,LNX(L))$RP_UPS(R,P,TSL,'UP') = SUM(RP_UPS(R,P,TSLVL,BD),RLUP(R,TSLVL,TSL)$BD(L)+RLUP(R,TSL,TSLVL)$IPS(L)); - RP_UPS(R,P,TSL,'FX')$(SUM(RP_UPS(PRC_TSL(R,P,TSLVL),L),RLUP(R,TSLVL,TSL))$RP_UPR(R,P,'UP'))=YES; -* Check partial loads - LOOP(UNCD7(R,LL,P,TSL(ANNUAL),R,CUR,L),RP_UPS(R,P,TSL,L)=YES; RP_PL(R,P,'N')=NOT RP_PL(R,P,L)); - ACT_LOSPL(RTP(R,V,P),BDNEQ(BD))$((ACT_LOSPL(RTP,BD)<=0)$RP_PL(R,P,'N'))=MAX(.1+.5$BDUPX(BD),ACT_MINLD(RTP)); -* Levelize ACT_UPS -$ BATINCLUDE pp_lvlfc.mod ACT_UPS P PRC_TS ',BD' ",'','',''" ALL_TS V RTP(R,V,P) 0 '' N - RTP_PL(RTP(R,V,P))$((ACT_LOSPL(RTP,'LO')=ACT_MINLD(RTP))$RP_UPL(R,P,'FX'))$=RP_PL(R,P,'N'); -* Check for cycling limits - RP_UPC(R,P,TSL,'N')$RP_UPR(R,P,'N') $= SUM(RP_UPS(PRC_TSL(R,P,TSLVL),L),RLUP(R,TSLVL,TSL)); - RP_UPC(PRC_TSL(RP,TSL),BDNEQ(BD))$RP_UPS(RP,TSL,'UP') $= RP_UPR(RP,BD)); - OPTION RP_UPR < ACT_CSTRMP; -$SET CAPON (COEF_CPT(R,V,T,P)*(%VARV%_NCAP(R,V,P%SWS%)$T(V)+NCAP_PASTI(R,V,P)%RCAPSUB%))$PRC_VINT(R,P)+%VAR%_CAP(R,T,P%SOW%)$RP_UX(R,P) -$SET MX SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P)*(%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)%RCAPSBM%)) -$SET TMP $(NOT RP_UX(R,P))+%VAR%_CAP(R,T,P%SOW%)$RP_UX(R,P)%UPSCAPS% -*----------------------------------------------------------------------- - - %EQ%_CAPLOAD(RTP_VINTYR(%R_V_T%,P),S,BDNEQ(BD)%SWT%)$AFUPS(R,T,P,S).. - - %VAR%_ACT(R,V,T,P,S%SOW%)*BDSIG(BD) =G= %VAR%_UPS(R,V,T,P,S,'FX'%SOW%)$RTP_PL(R,V,P)$BDLOX(BD) + - -* capacity - vintaged or not - (%CAPON%%UPSCAPS%) * MIN(COEF_AF%1(R,V,T,P,S,'UP')*BDSIG(BD),SUM(TS_ANN(S,TS)$(NOT RTP_PL(R,V,P)),ACT_UPS(R,V,P,TS,'FX'))$BDLOX(BD)) * - PRC_CAPACT(R,P) * G_YRFR(R,S); - -*----------------------------------------------------------------------- - - %EQ%_ACTRAMP(RTP_VINTYR(%R_V_T%,P),RTS(S),BDNEQ(BD)%SWT%)$(SUM(TS_ANN(S,TS)$ACT_UPS(R,V,P,TS,BD),1)$PRC_TS(R,P,S)$RP_UPL(R,P,BD)).. - -* max fraction of capacity - SUM(PRC_TS(R,P,TS(S--RS_STG(R,S))),PRC_CAPACT(R,P)*SUM(TS_ANN(S,SL),ACT_UPS(R,V,P,SL,BD)) * - (%MX%%TMP% + ((%VAR%_UPS(R,V,T,P,S,'N'%SOW%)-%VAR%_UPS(R,V,T,P,TS,'N'%SOW%))$BDLOX(BD))$RPS_UPS(R,P,S)) + - -* dynamic ramp limits - RS_STGPRD(R,S)*2/(G_YRFR(R,S)+G_YRFR(R,TS))/8760 * - (%VAR%_ACT(R,V,T,P,S%SOW%)/G_YRFR(R,S)-%VAR%_ACT(R,V,T,P,TS%SOW%)/G_YRFR(R,TS) + - ((%VAR%_UPS(R,V,T,P,S,'N'%SOW%)-%VAR%_UPS(R,V,T,P,TS,'N'%SOW%))*PRC_CAPACT(R,P)*ACT_MINLD(R,V,P))$RPS_UPS(R,P,S))*BDSIG(BD)) - - =G= 0; - -*----------------------------------------------------------------------- - - %EQ%E_ACTUPS(RTP_VINTYR(%R_V_T%,P),TSL,L(BND_TYPE),RTS(S)%SWT%)$(TS_GROUP(R,TSL,S)$RP_UPS(R,P,TSL,L)).. - -* start-up/shut-down capacity - (SUM(TS(S--RS_STG(R,S)),%VAR%_UPS(R,V,T,P,S,'N'%SOW%)-%VAR%_UPS(R,V,T,P,TS,'N'%SOW%)-SUM(BD,%VAR%_UPS(R,V,T,P,S,BD%SOW%)*BDSIG(BD)))$STOA(S) + - SUM(ANNUAL(S)$RP_PL(R,P,'N'),%VAR%_UPS(R,V,T,P,S,L%SOW%)-SUM(PRC_TS(R,P,TS),%VAR%_UPS(R,V,T,P,TS,'FX'%SOW%))))$(BDSIG(L)<0) + - SUM(BDLOX(BD(L)),%MX%%TMP%-%VAR%_UDP(R,V,T,P,S,'FX'%SOW%)-%VAR%_UPS(R,V,T,P,S,'FX'%SOW%)$RP_UPL(R,P,'FX')) - - =E= 0; - -*----------------------------------------------------------------------- - - %EQ%L_ACTUPS(RTP_VINTYR(%R_V_T%,P),TSL,LNX(L),RTS(S)%SWT%)$(TS_GROUP(R,TSL,S)$RP_UPS(R,P,TSL,L)).. - -* balance at higher level - (%VAR%_UPS(R,V,T,P,S,L%SOW%)-SUM(RS_BELOW1(R,TS,S),%VAR%_UPS(R,V,T,P,TS,'FX'%SOW%)))$IPS(L) + - (%VAR%_UPS(R,V,T,P,S,L%SOW%)-SUM(RS_BELOW1(R,S,TS),%VAR%_UPS(R,V,T,P,TS,'UP'%SOW%)))$BD(L) - - =L= 0; - -*----------------------------------------------------------------------- - - %EQ%L_ACTUPC(RTP_VINTYR(%R_V_T%,P),TSL,L,RTS(S)%SWT%)$(TS_GROUP(R,TSL,S)$RP_UPC(R,P,TSL,L)).. - -* max number of cycles - (SUM(RS_BELOW1(R,S,SL),%VAR%_UPS(R,V,T,P,SL,'UP'%SOW%)) - (%CAPON%%UPSCAPS%)*ACT_TIME(R,T,P,L))$IPS(L) + -* min UP/LO hours - SUM(BD(L),SUM((RS_UP(R,S,JS),RJ_SL(R,JS,SL)), - %VAR%_UPS(R,V,T,P,SL,L%SOW%)$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/2+1/JS_CCL(R,JS),1/JS_CCL(R,JS))0) + -* Limit advance and delay or balancing time window - SUM(LASTLL$LNX(L),SUM(LIM$(IPS(L) XOR BD(LIM)),VAR_SIFT(V,S,LIM)) + - SUM((RS_UP(R,S,JS),RJ_SL(R,JS,TS(SL--RS_STG(R,SL)))), - (%VAR%_ACT(R,V,T,P,SL%SOW%)$IPS(L)-%VAR%_SIN(R,V,T,P,COM,SL%SOW%) - - (VAR_SIFT(V,SL,'UP')-VAR_SIFT(V,TS,'UP'))$BD(L))$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/9+1/JS_CCL(R,JS),1/JS_CCL(R,JS)) ORD(YEAR))$YK(T,LL)), - SUM(INVSPRED(K_EOH,JOT,ALLYEAR,K)$((ORD(ALLYEAR)+ORD(AGE) > ORD(YEAR))$YK(T,ALLYEAR)), - OBJ_ICOST(R,K,P,CUR)) * OBJ_CRF(R,TT,P,CUR) / OBJ_DIVI(R,TT,P)); -* Add decommissioning costs when defined -LOOP(RTP_IAN(R,TT,P,CUR)$OBJ_DCOST(R,TT,P,CUR), - CST_ANNC(R,TT,P,T(YEAR),'INVCOST',CUR)$YK1(TT,T) = - CST_ANNC(R,TT,P,T,'INVCOST',CUR) + OBJ_CRFD(R,TT,P,CUR) / OBJ_DIVIII(R,TT,P) * - SUM(OBJ_SUMIII(R,TT,P,K_EOH,K,LL)$((ORD(LL)+ROUND(NCAP_%DECLIF%(R,TT,P)) > ORD(YEAR))$YK(T,LL)), - OBJ_DCOST(R,K,P,CUR))); -* Calculate annual undiscounted INVTAXSUB coefficients -OPTION CLEAR=TRACKP, CLEAR=RTP_IAN; -LOOP(UC_ATTR(R,UC_N,SIDE,'NCAP',UC_ANNUL(UC_NAME(COSTCAT))),LOOP(T,TRACKP(R,P)$UC_NCAP(UC_N,SIDE,R,T,P)=YES)); -RT_IAN(R,T,T,CUR,'INVTAXSUB')$(REG_CUMCST(R,T,T,'INVTAX',CUR,'UP')+REG_CUMCST(R,T,T,'INVSUB',CUR,'UP')) = YES; -RTP_IAN(OBJ_ICUR(R,T,P,CUR))$(RT_IAN(R,T,T,CUR,'INVTAXSUB')+TRACKP(R,P)) = YES; -LOOP(RTP_IAN(R,TT,P,CUR)$(OBJ_ITAX(R,TT,P,CUR)+OBJ_ISUB(R,TT,P,CUR)), - OPTION CLEAR=YKK; F = OBJ_CRF(R,TT,P,CUR)/OBJ_DIVI(R,TT,P); - LOOP(OBJ_SUMII(R,TT,P,LIFE,K_EOH,JOT), Z=ORD(LIFE); - YKK(YK(T(YEAR),LL),K)$((ORD(YEAR) < ORD(LL)+Z)$INVSPRED(K_EOH,JOT,LL,K)) = YES); - CST_ANNC(R,TT,P,T,'INVTAX',CUR)$YK1(TT,T) = SUM(YKK(T,LL,K), F * OBJ_ITAX(R,K,P,CUR)); - CST_ANNC(R,TT,P,T,'INVSUB',CUR)$YK1(TT,T) = SUM(YKK(T,LL,K),-F * OBJ_ISUB(R,K,P,CUR)); -); -OPTION CLEAR=TRACKP, CLEAR=RTP_IAN; -$IF %STAGES%==YES $SET SWT 'SW_T(TT%SOW%)$' -$IF %SCUM%==1 $SET SWT '' -*----------------------------------------------------------------------------- - %EQ%_BNDCST(R,YEAR,SUPERYR(TT,ALLYEAR),COSTCAT,CUR %SOW%)$(%SWT%REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'UP')) .. -*----------------------------------------------------------------------------- -$IF %STAGES%==YES $SET SWD '%SOW%' SET SOW '%SWD%' SET SWTD SUM -$IFI NOT %OBJ%==LIN $SET TPULSE (PERIODYR(T,Y_EOH),YK(ALLYEAR,Y_EOH))$YK(Y_EOH,YEAR), -$IFI %OBJ%==LIN $SET TPULSE (TPULSEYR(T,Y_EOH),YK(ALLYEAR,Y_EOH))$YK(Y_EOH,YEAR),TPULSE(T,Y_EOH)* -$IFI %VARCOST%==LIN $SET TPULSE (PERIODYR(T,Y),MILESTONYR(Y_EOH),YK(ALLYEAR,Y))$(YK(Y,YEAR)$TPULSE(Y_EOH,Y)),TPULSE(Y_EOH,Y)* -$IFI %OBJ%%VARCOST%==LINLIN $SET TPULSE (TPULSEYR(T,Y),MILESTONYR(Y_EOH),YK(ALLYEAR,Y))$(YK(Y,YEAR)$TPULSE(Y_EOH,Y)),TPULSE(Y_EOH,Y)*TPULSE(T,Y)* -*------------------------------------------------------------------------------ -* Investment Costs - (SUM((OBJ_SUMII(R,T,P,AGE,K_EOH(LL),JOT),SPAN(AGE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$YK(TT,T), - SUM(INVSPRED(K_EOH,JOT,Y,K)$YK(ALLYEAR,Y), - OBJ_ICOST(R,K,P,CUR) * - MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(Y)+ORD(AGE))-MAX(YEARVAL(YEAR),YEARVAL(Y)))) * - %VART%_NCAP(R,T,P %SWS%) * OBJ_CRF(R,T,P,CUR) / OBJ_DIVI(R,T,P))$(NOT RT_IAN(R,YEAR,ALLYEAR,CUR,'INV')) + - SUM((T,P)$CST_ANNC(R,T,P,TT,'INVCOST',CUR),CST_ANNC(R,T,P,TT,'INVCOST',CUR)*%VART%_NCAP(R,T,P %SWS%))$RT_IAN(R,YEAR,ALLYEAR,CUR,'INV') - )$SAMEAS(COSTCAT,'INV') + - -* Decommissioning Costs - SUM(RTP(R,T,P)$(YK(TT,T)$OBJ_DCOST(R,T,P,CUR)), - SUM(OBJ_SUMIII(R,T,P,K_EOH,K,LL)$YK(ALLYEAR,LL), OBJ_DCOST(R,K,P,CUR) * - MAX(0,MIN(ORD(ALLYEAR)+1,ORD(LL)+ROUND(NCAP_%DECLIF%(R,T,P)))-MAX(ORD(YEAR),ORD(LL)))) * - %VART%_NCAP(R,T,P %SWS%) * OBJ_CRFD(R,T,P,CUR) / OBJ_DIVIII(R,T,P) - )$SAMEAS(COSTCAT,'INV') + - -* Investment Taxes and Subsidies - (SUM(OBJ_SUMII(R,T,P,AGE,K_EOH,JOT)$(YK(TT,T)$OBJ_ITAX(R,T,P,CUR)), - SUM((INVSPRED(K_EOH,JOT,LL,K),SPAN(AGE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), - OBJ_ITAX(R,K,P,CUR) * (MIN(ORD(ALLYEAR)+1,ORD(LL)+ORD(AGE))-MAX(ORD(YEAR),ORD(LL)))) * - %VART%_NCAP(R,T,P %SWS%) * OBJ_CRF(R,T,P,CUR) / OBJ_DIVI(R,T,P))$(NOT RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB')) + - SUM((T,P)$CST_ANNC(R,T,P,TT,'INVTAX',CUR),CST_ANNC(R,T,P,TT,'INVTAX',CUR)*%VART%_NCAP(R,T,P %SWS%))$RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB') - )$SAMEAS(COSTCAT,'INVTAX') + - - (SUM(OBJ_SUMII(R,T,P,AGE,K_EOH,JOT)$(YK(TT,T)$OBJ_ISUB(R,T,P,CUR)), - SUM((INVSPRED(K_EOH,JOT,LL,K),SPAN(AGE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), - OBJ_ISUB(R,K,P,CUR) * (MIN(ORD(ALLYEAR)+1,ORD(LL)+ORD(AGE))-MAX(ORD(YEAR),ORD(LL)))) * - %VART%_NCAP(R,T,P %SWS%) * OBJ_CRF(R,T,P,CUR) / OBJ_DIVI(R,T,P))$(NOT RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB')) - - SUM((T,P)$CST_ANNC(R,T,P,TT,'INVSUB',CUR),CST_ANNC(R,T,P,TT,'INVSUB',CUR)*%VART%_NCAP(R,T,P %SWS%))$RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB') - )$SAMEAS(COSTCAT,'INVSUB') + -*------------------------------------------------------------------------------ -* Fixed O&M Cost - shaped or not - SUM((OBJ_SUMIV(LL,R,T,P,JOT,LIFE),SPAN(LIFE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$YK(TT,T), - SUM(INVSTEP(LL,JOT,K,JOT)$YK(ALLYEAR,K), OBJ_FOM(R,K,P,CUR) * - MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(K)+ORD(LIFE))-MAX(YEARVAL(YEAR),YEARVAL(K)))) * - %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) - )$SAMEAS(COSTCAT,'FOM') + -* Fixed O&M Cost - YES shaped - SUM(RTP_SHAPE(R,T,P,'1',J,JJ)$YK(TT,T), - SUM((OBJ_SUMIV(K,R,T,P,JOT,LIFE),INVSTEP(K,JOT,LL,JOT),SPAN(LIFE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), - SUM(OPYEAR(LIFE,AGE)$((ORD(LL)+ORD(AGE) > ORD(YEAR))$(ORD(LL)+ORD(AGE) < ORD(ALLYEAR)+2)), - SHAPE(J,AGE)*MULTI(JJ,LL+(ORD(AGE)-1))-1) * OBJ_FOM(R,LL,P,CUR)) * - %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) - )$SAMEAS(COSTCAT,'FOM') + - -* Fixed O&M Taxes - shaped or not - SUM((OBJ_SUMIV(LL,R,T,P,JOT,LIFE),SPAN(LIFE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$(YK(TT,T)$OBJ_FTX(R,T,P,CUR)), - SUM(INVSTEP(LL,JOT,K,JOT)$YK(ALLYEAR,K), OBJ_FTX(R,K,P,CUR) * - MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(K)+ORD(LIFE))-MAX(YEARVAL(YEAR),YEARVAL(K)))) * - %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) - )$SAMEAS(COSTCAT,'FOMTAX') + -* Fixed O&M Taxes - Shaped - SUM(RTP_SHAPE(R,T,P,'2',J,JJ)$(YK(TT,T)$OBJ_FTX(R,T,P,CUR)), - SUM((OBJ_SUMIV(K,R,T,P,JOT,LIFE),INVSTEP(K,JOT,LL,JOT),SPAN(LIFE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), - SUM(OPYEAR(LIFE,AGE)$((ORD(LL)+ORD(AGE) > ORD(YEAR))$(ORD(LL)+ORD(AGE) < ORD(ALLYEAR)+2)), - SHAPE(J,AGE)*MULTI(JJ,LL+(ORD(AGE)-1))-1) * OBJ_FTX(R,LL,P,CUR)) * - %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) - )$SAMEAS(COSTCAT,'FOMTAX') + - -* Fixed O&M Subsidies - shaped or not - SUM((OBJ_SUMIV(LL,R,T,P,JOT,LIFE),SPAN(LIFE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$(YK(TT,T)$OBJ_FSB(R,T,P,CUR)), - SUM(INVSTEP(LL,JOT,K,JOT)$YK(ALLYEAR,K), OBJ_FSB(R,K,P,CUR) * - MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(K)+ORD(LIFE))-MAX(YEARVAL(YEAR),YEARVAL(K)))) * - %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) - )$SAMEAS(COSTCAT,'FOMSUB') + -* Fixed O&M Subsidies - Shaped - SUM(RTP_SHAPE(R,T,P,'3',J,JJ)$(YK(TT,T)$OBJ_FSB(R,T,P,CUR)), - SUM((OBJ_SUMIV(K,R,T,P,JOT,LIFE),INVSTEP(K,JOT,LL,JOT),SPAN(LIFE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), - SUM(OPYEAR(LIFE,AGE)$((ORD(LL)+ORD(AGE) > ORD(YEAR))$(ORD(LL)+ORD(AGE) < ORD(ALLYEAR)+2)), - SHAPE(J,AGE)*MULTI(JJ,LL+(ORD(AGE)-1))-1) * OBJ_FSB(R,LL,P,CUR)) * - %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) - )$SAMEAS(COSTCAT,'FOMSUB') + -*------------------------------------------------------------------------------ -$IF %SCUM%==1 $SET VART SUM(SW_TSW(W,T,W),SW_TPROB(T,W)*Z -* Variable commodity taxes and subsidies - SUM(%TPULSE% - (SUM(RHS_COMBAL(R,T,C,S), %VART%_COMNET(R,T,C,S %SWS%) * OBJ_COMNT(R,Y_EOH,C,S,'TAX',CUR)) + - SUM(RHS_COMPRD(R,T,C,S), %VART%_COMPRD(R,T,C,S %SWS%) * OBJ_COMPD(R,Y_EOH,C,S,'TAX',CUR))) - )$SAMEAS(COSTCAT,'COMTAX') - - - SUM(%TPULSE% - (SUM(RHS_COMBAL(R,T,C,S), %VART%_COMNET(R,T,C,S %SWS%) * OBJ_COMNT(R,Y_EOH,C,S,'SUB',CUR)) + - SUM(RHS_COMPRD(R,T,C,S), %VART%_COMPRD(R,T,C,S %SWS%) * OBJ_COMPD(R,Y_EOH,C,S,'SUB',CUR))) - )$SAMEAS(COSTCAT,'COMSUB') + -*------------------------------------------------------------------------------ -* Variable flow taxes and subsidies - SUM(T$(YK(TT,T)*(M(T)+LAGT(T) GT YEARVAL(YEAR))), - SUM(RTPCS_VARF(R,T,P,C,S)$OBJ_VFLO(R,P,C,CUR,'TAX'), - SUM(TS_ANN(S,TS), SUM(%TPULSE% MAX(0,OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * - SUM(RTP_VINTYR(R,V,T,P), - %SWTD%(%SWSW% -$ BATINCLUDE %cal_red% C COM S P T - )$(NOT RP_IRE(R,P)) + - (SUM(RPC_IRE(R,P,C,IE), - %VART%_IRE(R,V,T,P,C,S,IE %SWS%)$(NOT RPC_AIRE(R,P,C))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,C))$(RPC_AIRE(R,P,C)) - ) + - SUM((RPC_IRE(R,P,COM,IE),IO)$(RTPCS_VARF(R,T,P,COM,S)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO)), - IRE_FLOSUM(R,T,P,COM,S,IE,C,IO) * - (%VART%_IRE(R,V,T,P,COM,S,IE %SWS%)$(NOT RPC_AIRE(R,P,COM))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,COM))$(RPC_AIRE(R,P,COM))) - ))$RP_IRE(R,P) - ) - ))$SAMEAS(COSTCAT,'FLOTAX') + - - SUM(T$(YK(TT,T)*(M(T)+LAGT(T) GT YEARVAL(YEAR))), - SUM(RTPCS_VARF(R,T,P,C,S)$OBJ_VFLO(R,P,C,CUR,'SUB'), - SUM(TS_ANN(S,TS), SUM(%TPULSE% MAX(0,-OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * - SUM(RTP_VINTYR(R,V,T,P), - %SWTD%(%SWSW% -$ BATINCLUDE %cal_red% C COM S P T - )$(NOT RP_IRE(R,P)) + - (SUM(RPC_IRE(R,P,C,IE), - %VART%_IRE(R,V,T,P,C,S,IE %SWS%)$(NOT RPC_AIRE(R,P,C))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,C))$(RPC_AIRE(R,P,C)) - ) + - SUM((RPC_IRE(R,P,COM,IE),IO)$(RTPCS_VARF(R,T,P,COM,S)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO)), - IRE_FLOSUM(R,T,P,COM,S,IE,C,IO) * - (%VART%_IRE(R,V,T,P,COM,S,IE %SWS%)$(NOT RPC_AIRE(R,P,COM))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,COM))$(RPC_AIRE(R,P,COM))) - ))$RP_IRE(R,P) - ) - ))$SAMEAS(COSTCAT,'FLOSUB') + -*------------------------------------------------------------------------------ -$ IF %STAGES%==YES $SET SOW %SWD% - SUM(COST_GMAP(COSTCAT,COSTAGG,COSTYPE), %VAR%_CUMCST(R,YEAR,ALLYEAR,COSTAGG,CUR %SOW%)*(1-2*DIAG(COSTYPE,'SUB'))) -*------------------------------------------------------------------------------ - - =E= %VAR%_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%); - - diff --git a/source/eqcaflac.vda b/source/eqcaflac.vda deleted file mode 100644 index 87962bf..0000000 --- a/source/eqcaflac.vda +++ /dev/null @@ -1,60 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQCAFLAC - implements commodity-specific capacity utilization equations -* %1 - equation declaration type -* %2 - bound type for %1 -*=============================================================================* -* Questions/Comments: -* - COEF_CPT/COEF_AF are defined in COEF_CPT.MOD -* - shaping of COEF_AF is possible via NCAP_AFX -*----------------------------------------------------------------------------- - - %EQ%%1_CAFLAC(RTP_VINTYR(%R_V_T%,P),S%SWT%)$(AFS(R,T,P,S,%2)$RPS_CAFLAC(R,P,S,%2)).. - -* Sum over flows in PG - SUM((RPC_PG(R,P,C),COM_TMAP(R,COM_TYPE(CG),C)), - (1/ABS(PRC_ACTFLO(R,V,P,C))) / - (NCAP_AFCS(R,V,P,C,S)+PROD(XPT$NCAP_AFCS(R,V,P,CG,S),NCAP_AFCS(R,V,P,CG,S))$(NOT NCAP_AFCS(R,V,P,C,S))) * - SUM(RPCS_VAR(R,P,C,TS)$RS_FR(R,S,TS),RS_FR(R,S,TS) * (%VAR%_FLO(R,V,T,P,C,TS %SOW%)$RP_STD(R,P) + - (SUM(TOP(RPC_STG(R,P,C),IO)$(NCAP_AFCS(R,V,P,C,S)+NCAP_AFCS(R,V,P,CG,S)), - (%VAR%_SIN(R,V,T,P,C,TS %SOW%)*PROD(RPG_AFCX(R,P,C,IE)$NCAP_AFCS(R,V,P,C,S),(NCAP_AFCS(R,V,P,C,S)/NCAP_AFCS(R,V,P,CG,S))$NCAP_AFCS(R,V,P,CG,S)))$IPS(IO)+ - (%VAR%_SOUT(R,V,T,P,C,TS %SOW%)*STG_EFF(R,V,P)*(1+RTCS_FR(R,T,C,S,TS)))$(NOT IPS(IO))) + - SUM(RPC_IRE(R,P,C,IE),%VAR%_IRE(R,V,T,P,C,TS,IE %SOW%)*PROD(RPG_AFCX(R,P,C,IE)$((NCAP_AFCS(R,V,P,C,S)$NCAP_AFCS(R,V,P,CG,S))**1$RP_AIRE(R,P,IE)), - (NCAP_AFCS(R,V,P,C,S)/NCAP_AFCS(R,V,P,CG,S))$NCAP_AFCS(R,V,P,CG,S))+1$0))$(NOT RP_STD(R,P))))) - - =%1= - -* process capacity - vintaged or not - (SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P) * COEF_AF%4(R,K,T,P,S,%2) * - (%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)$PYR(K)%RCAPSBM%))+COEF_AF%4(R,V,T,P,S,%2)*%UPSCAP0%) * -* timeslice fraction of capacity - PRC_CAPACT(R,P) * G_YRFR(R,S) - ; - -%3 EXIT -*----------------------------------------------------------------------------- - - %EQ%L_CAPFLO(RTP_VINTYR(%R_V_T%,P),CG,SL(STL(%RTS%))%SWT%)$(RS_TSLVL(R,S)$NCAP_AFC(R,V,P,CG,STL)).. - -* Sum over regular flows - SUM(RPC(RP_FLO(R,P),C)$COM_GMAP(R,CG,C), - SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))* -$ BATINCLUDE %cal_red% C COM TS P T - )) + -* storage: for activity multiply by number of storage cycles in a year - SUM(PRC_TS(RP_STG(R,P),TS)$RS_FR(R,TS,S),(%VAR%_ACT(R,V,T,P,TS%SOW%)+VAR_STS(R,V,T,P,TS,%2))*RS_FR(R,TS,S)*EXP(PRC_SC(R,P))/RS_STGPRD(R,TS)*G_YRFR(R,S))$ACTCG(CG) + - SUM(RPC_STG(R,P,C)$COM_GMAP(R,CG,C), - SUM((TOP(R,P,C,IO),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))* - (%VAR%_SIN(R,V,T,P,C,TS%SOW%)$(NOT TOP(R,P,C,'OUT'))$IPS(IO)+%VAR%_SOUT(R,V,T,P,C,TS%SOW%)*STG_EFF(R,V,P)*DIAG(IO,'OUT')))) - - =%1= - -* process capacity - vintaged or not - (SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P) * - (%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)$PYR(K)%RCAPSBM%))+%UPSCAP0%)*NCAP_AFC(R,V,P,CG,STL) * -* timeslice fraction of capacity - PRC_CAPACT(R,P) * G_YRFR(R,S) - ; \ No newline at end of file diff --git a/source/eqcapact.mod b/source/eqcapact.mod deleted file mode 100644 index 92d3a5f..0000000 --- a/source/eqcapact.mod +++ /dev/null @@ -1,52 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQCAPACT is the capacity utilization equation -* %1 - equation declaration type -* %2 - bound type for %1 -*=============================================================================* -* Questions/Comments: -* - COEF_CPT is defined in COEF_CPT.MOD -* - COEF_AF established by applying SHAPE in COEF_CPT.MOD -* - Commodity-specific AF handled by EQ(l)_CAFLAC (VDA extension) -*----------------------------------------------------------------------------- -$SETLOCAL PASS '' -$IF DEFINED RPS_CAFLAC $SETLOCAL PASS %PASS%*(NOT RPS_CAFLAC(R,P,S,'%2')) - - SET AFS(R,T,P,S,BD) //; -* COEF_AFs are always at PRC_TS or above, can be directly used for testing: -$IF %1==L LOOP(V,AFS(RTP_VARA(R,T,P),S,BD)$COEF_AF(R,V,T,P,S,BD)=YES); AFS(RTPS_OFF,BD) = NO; - - %EQ%%1_CAPACT(RTP_VINTYR(%R_V_T%,P),S %SWT%)$(AFS(R,T,P,S,'%2') %PASS%) .. - -* normal processes - SUM(PRC_TS(R,P,TS)$TS_MAP(R,S,TS),%VAR%_ACT(R,V,T,P,TS %SOW%))$(NOT RP_STG(R,P)) - + -* storage: parent timeslice fraction of the number of storage cycles in a year - SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),(%VAR%_ACT(R,V,T,P,TS %SOW%)+VAR_STS(R,V,T,P,TS,'%2'))*RS_FR(R,TS,S)*EXP(PRC_SC(R,P))/RS_STGPRD(R,TS))$RP_STG(R,P) - - =%1= - - ( -* process is not vintaged -$IF %VALIDATE% == 'YES' $GOTO CAPIT - (SUM(MODLYEAR$COEF_CPT(R,MODLYEAR,T,P), - COEF_CPT(R,MODLYEAR,T,P) * COEF_AF%3(R,MODLYEAR,T,P,S,'%2') * - (%VARM%_NCAP(R,MODLYEAR,P %SWS%)$T(MODLYEAR) + NCAP_PASTI(R,MODLYEAR,P)$PASTYEAR(MODLYEAR)%RCAPSBM%) - ) * PRC_CAPACT(R,P) -$LABEL CAPIT -$IF %VALIDATE% == 'YES' (COEF_AF(R,T,T,P,S,'%2') * PRC_CAPACT(R,P) * %VAR%_CAP(R,T,P %SOW%) - )$(NOT PRC_VINT(R,P)) + - -* process is vintaged - (COEF_AF%3(R,V,T,P,S,'%2') * COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * - (%VARV%_NCAP(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)%RCAPSUB%))$PRC_VINT(R,P) - ) * - -* UR 10/05/00 -* capacity of storage process fully available in each time slice - POWER(G_YRFR(R,S),1-1$RP_STG(R,P)) - - ; diff --git a/source/eqcapvac.mod b/source/eqcapvac.mod deleted file mode 100644 index 8d4ccf1..0000000 --- a/source/eqcapvac.mod +++ /dev/null @@ -1,30 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQCAPVAC is the capacity utilization equation for vintage-simulated processes -* %1 - equation lim type -* %2 - bound type for %1 -*=============================================================================* -* Questions/Comments: -* - COEF_CSV is defined in COEF_CSV.MOD -*----------------------------------------------------------------------------- - - EQ%1_CAPVAC(RTP_VINTYR(%R_V_T%,P),S%SWX%)$(%SWTX%AFSV(R,T,P,S,'%2')).. - -* Activity level at timeslice S - SUM(PRC_TS(R,P,TS)$TS_MAP(R,S,TS),%VAR%_ACT(R,V,T,P,TS %SOW%))$(NOT RPS_CAFLAC(R,P,S,'%2')) + -* Flow levels when commodity-specific availabilities - SUM((RPC_PG(R,P,C),COM_TMAP(R,COM_TYPE(CG),C)), (1/PRC_ACTFLO(R,V,P,C)) / - (NCAP_AFCS(R,V,P,C,S)+PROD(XPT$NCAP_AFCS(R,V,P,CG,S),NCAP_AFCS(R,V,P,CG,S))$(NOT NCAP_AFCS(R,V,P,C,S))) * - SUM(RPCS_VAR(R,P,C,TS)$TS_MAP(R,S,TS),%VAR%_FLO(R,V,T,P,C,TS %SOW%)$RP_STD(R,P) + - SUM(RPC_IRE(R,P,C,IE),%VAR%_IRE(R,V,T,P,C,TS,IE %SOW%))))$RPS_CAFLAC(R,P,S,'%2') - - =%1= - -* process is vintaged - SUM(MODLYEAR(K)$COEF_CSV(R,K,T,P,V),COEF_CSV(R,K,T,P,V)*COEF_AF(R,K,T,P,S,'%2')*%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P))*PRC_CAPACT(R,P)*G_YRFR(R,S) - ; - - diff --git a/source/eqchpelc.ier b/source/eqchpelc.ier deleted file mode 100644 index bb1c037..0000000 --- a/source/eqchpelc.ier +++ /dev/null @@ -1,55 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* Equation bounding the electricity production of extraction condensing CHP plant -* by the available condensing resp. backpressure capacity -* %1 - =L= or =E= qualifier -* %2 - UP of FX bound for ECT_AFCON/ECT_AFCHP -*----------------------------------------------------------------------------- - -EQ%1_CHPCON(RTP_VINTYR(R,V,T,P)%SWX%)$(%SWTX%ECT_AFCON(R,T,P,'%2')*SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C),1)$ECT_CHP(R,P)).. - - SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C), -* [UR] model reduction %REDUCE% is set in *.run -$ BATINCLUDE %cal_red% C COM TS P T - ) -- - SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_DHT(R,P,C), ECT_REH(R,T,P)* -* [UR] model reduction %REDUCE% is set in *.run -$ BATINCLUDE %cal_red% C COM TS P T - ) - - =%1= - -* Case I if AFpcg -* process is not vintaged - SUM(RTP_CPTYR(R,MODLYEAR(K),T,P), - ECT_AFCON(R,T,P,'%2') * ECT_INP2CON(R,T,P) * COEF_CPT(R,K,T,P) * PRC_CAPACT(R,P) * (%VARM%_NCAP(R,K,P %SWS%)$T(K) + NCAP_PASTI(R,K,P)) - )$(NOT PRC_VINT(R,P)) + - -* process is vintaged - (ECT_AFCON(R,T,P,'%2') * ECT_INP2CON(R,T,P) * COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * (%VARV%_NCAP(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)) - )$PRC_VINT(R,P) -; - -EQ%1_CHPBPT(RTP_VINTYR(R,V,T,P)%SWX%)$(%SWTX%ECT_AFBPT(R,T,P,'%2')*SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_DHT(R,P,C),1)$ECT_CHP(R,P)).. - - SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_DHT(R,P,C), ECT_REH(R,T,P)* -* [UR] model reduction %REDUCE% is set in *.run -$ BATINCLUDE %cal_red% C COM TS P T - ) - - =%1= - -* Case I if AFpcg -* process is not vintaged - SUM(RTP_CPTYR(R,MODLYEAR(K),T,P), - ECT_AFBPT(R,T,P,'%2') * ECT_INP2ELC(R,T,P) * COEF_CPT(R,K,T,P) * PRC_CAPACT(R,P) * (%VARM%_NCAP(R,K,P %SWS%)$T(K) + NCAP_PASTI(R,K,P)) - )$(NOT PRC_VINT(R,P)) + - -* process is vintaged - (ECT_AFBPT(R,T,P,'%2') * ECT_INP2ELC(R,T,P) * COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * (%VARV%_NCAP(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)) - )$PRC_VINT(R,P) -; diff --git a/source/eqcombal.mod b/source/eqcombal.mod deleted file mode 100644 index 1f8f44f..0000000 --- a/source/eqcombal.mod +++ /dev/null @@ -1,114 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQCOMBAL is the basic commodity balance and the production limit constraint -* %1 - mod or v# for the source code to be used -* %2 - equation declaration type -* %3 - COM_LIM type for %2 -* %4 - BAL/PRD indicator -* %5 - condition for PRD -*=============================================================================* -*GaG Questions/Comments: -* - need more control over VAR_COMX so only generate when really OK (=>either COMX_BND/PRICE/UC required) -* - apply RS_FR/RTCS_FR whenever process has a COM_TS commodity but the variable is not at that level -*----------------------------------------------------------------------------- -*$ONLISTING -* - %EQ%%2_COM%4(%R_T%,C,S %SWT%)$(RCS_COM%4(R,T,C,S,'%3') %5) .. -* -* production -* - ( - ( - -* individual flows -$ BATINCLUDE cal_fflo.%1 OUT O - -*V07_1b blending flows - SUM(BLE_OPR(R,C,OPR), - RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BLE_BAL(R,T,C,OPR) * %VAR%_BLND(R,T,C,OPR %SOW%) - ) + -*V07_1b emissions due to blending operations - SUM(BLE_ENV(R,C,BLE,OPR), RS_FR(R,S,'ANNUAL') * ENV_BL(R,C,BLE,OPR,T) * %VAR%_BLND(R,T,BLE,OPR %SOW%) - ) + - -* inter-regional trade to region -*V0.9 022100 - exports could also produce aux -$ BATINCLUDE cal_ire.%1 IMP OUT IE - -* storage -$ BATINCLUDE cal_stgn.%1 OUT IN '*STG_EFF(R,V,P)' '' "(NOT PRC_NSTTS(R,P,TS))" - -* (+25-May-2005) Add commodity aggregation to production side - SUM(COM$COM_AGG(R,T,COM,C), COM_AGG(R,T,COM,C) * - SUM(RTCS_VARC(R,T,COM,TS)$RS_TREE(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS))* - (%VAR%_COMNET(R,T,COM,TS %SOW%)$RC_AGP(R,COM,'LO') + %VAR%_COMPRD(R,T,COM,TS %SOW%)$RC_AGP(R,COM,'FX')))) + - -* capacity related commodity flows -* fixed commodity associated with installed capacity or retirement -$ BATINCLUDE cal_cap.%1 OUT O - -* apply commodity infastructure efficiency - ) * COM_IE(R,T,C,S) - -* If production is summed into variable, use it directly -$IF '%4' == BAL )$(NOT RHS_COMPRD(R,T,C,S)) + %VAR%_COMPRD(R,T,C,S %SOW%)$(RHS_COMPRD(R,T,C,S) - ) - -* -* consumption -* -* when doing FLO then need NET otherwise only want production component -$IF '%4' == PRD $GOTO ONLY_PRD - -* include the elasticity variables (moved to consumption side) -$IF %TIMESED%==YES + SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),BDSIG(BD)*%VAR%_ELAST(R,T,C,S,J,BD %SOW%)) - - - ( - -* individual flows -$ BATINCLUDE cal_fflo.%1 IN I - -*V07_1a blending flows - SUM(BLE_TP(R,T,BLE)$BLE_OPR(R,BLE,C), - RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * %VAR%_BLND(R,T,BLE,C %SOW%) - ) + - SUM(BLE_OPR(R,BLE,OPR)$(BLE_INP(R,BLE,C) * BLE_TP(R,T,BLE)), - RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BL_INP(R,BLE,C) * %VAR%_BLND(R,T,BLE,OPR %SOW%) - ) + - -* inter-regional trade from region -*V0.9 022100 - imports could also require aux -$ BATINCLUDE cal_ire.%1 EXP IN IE - -* storage -$ BATINCLUDE cal_stgn.%1 IN OUT '' 'STG_EFF(R,V,P)*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" - -* capacity related commodity flows -* fixed commodity associated with installed capacity or investment -$ BATINCLUDE cal_cap.%1 IN I - - ) -$LABEL ONLY_PRD - - =%2= - -$ IF '%4' == BAL $GOTO BALEQ -* production bound/cost/tax/sub/cum - %VAR%_COMPRD(R,T,C,S %SOW%)$RHS_COMPRD(R,T,C,S) -$IF %TIMESED%==YES +(SUM(RCJ(R,COM,J,BD)$MI_DMAS(R,C,COM),(DDF_PREF(R,T,COM)*(MI_AGC(R,T,C,COM,J,BD)-1)+RD_SHAR(R,T,COM,C))*BDSIG(BD)*SUM(RTCS_VARC(R,T,COM,TS),%VAR%_ELAST(R,T,COM,TS,J,BD%SOW%)))-%VAR%_COMPRD(R,T,C,S %SOW%))$(COM_ELAST(R,T,C,S,'N')>0)$RD_AGG(R,C) -$ GOTO DONE - -$LABEL BALEQ -* set the RHS according to the type of equation and/or commodity net bound/cost/tax/sub/cum -$ IF '%4%3' == BALFX %VAR%_COMNET(R,T,C,S %SOW%)$RHS_COMBAL(R,T,C,S) + - -* demand projection -$IFI %STAGES% == YES $SETLOCAL SWS 'PROD(SW_MAP(T,SOW,J,WW)$S_COM_PROJ(R,T,C,J,WW),S_COM_PROJ(R,T,C,J,WW))*' - ((%SWS% COM_PROJ(R,T,C)$(NOT RD_NLP(R,C)) +%VAR%_DEM(R,T,C%SOW%)$RD_NLP(R,C) +SUM(MI_DMAS(RD_AGG(R,COM),C),RD_SHAR(R,T,COM,C)*%VAR%_COMPRD(R,T,COM,'ANNUAL'%SOW%))) * COM_FR%MX%(R,T,C,S))$DEM(R,C) - -$LABEL DONE - ; -*$OFFLISTING diff --git a/source/eqcpt.mod b/source/eqcpt.mod deleted file mode 100644 index 4f9df4e..0000000 --- a/source/eqcpt.mod +++ /dev/null @@ -1,28 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQCPT.MOD capacity transfer equation -* - %1 = equation type when VALIDATE -* - %2 = equation name adj (L) when VALIDATE (for DMDs in MARKAL) -* - %3 = control qualifier -* - %4 = RHS constant or VAR_CAP -*=============================================================================* -*GaG Questions/Comments: -* - COEF_CPT established in COEF_CPT.MOD -*----------------------------------------------------------------------------- -*GG*V0.6a_3+ check whether used in UserConstraint -*$onlisting - - %EQ%%2_CPT(RTP(R,T,P) %SWT%)$(%3) .. - -* VAR_CAP(r,t,p %sow%) or CAP_BND(r,t,p,bd): - %4 - - =%1= - - SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)%RCAPSUB%)) - ; -*$offlisting diff --git a/source/eqcumcom.mod b/source/eqcumcom.mod deleted file mode 100644 index a959ffd..0000000 --- a/source/eqcumcom.mod +++ /dev/null @@ -1,34 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQCUMCOM sets the cumulative limit on a commodity -* %1 - equation declaration type -* %2 - NET/PRD indicator -*=============================================================================* -*GaG Questions/Comments: -* - scale both sides!!! -* [AL] Changed to support arbitrary year range -*----------------------------------------------------------------------------- -*$ONLISTING - %EQ%_CUM%2(RC(R,C),ALLYEAR,LL %SOW%)$RC_CUMCOM(R,'%2',ALLYEAR,LL,C).. - -* all commodity flows within period range - SUM(RTC_%2(R,TT(T),C)$ -$IFI NOT %OBJ%==LIN ((E(T) >= YEARVAL(ALLYEAR))$(B(T) <= YEARVAL(LL))), -$IFI %OBJ%==LIN ((M(T)+LAGT(T) > YEARVAL(ALLYEAR))$(M(T)-LEAD(T) < YEARVAL(LL))), - SUM(RTCS_VARC(R,T,C,S), -$IFI NOT %OBJ%==LIN MAX(0,MIN(E(T),YEARVAL(LL))-MAX(B(T),YEARVAL(ALLYEAR))+1) -$IFI %OBJ%==LIN SUM(TPULSEYR(T,YEAR)$((ORD(YEAR) >= ORD(ALLYEAR))$(ORD(YEAR) <= ORD(LL))),TPULSE(T,YEAR)) - * %VARTT%_COM%2(R,T,C,S %SWS%) - ) - ) / %CUCSCAL% - - =%1= - -* bound range working on - %VAR%_CUMCOM(R,C,'%2',ALLYEAR,LL %SOW%) - ; - -$OFFLISTING diff --git a/source/eqcumflo.mod b/source/eqcumflo.mod deleted file mode 100644 index 2d5a943..0000000 --- a/source/eqcumflo.mod +++ /dev/null @@ -1,48 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQCUMFLO sets the cumulative upper limit on a flow or activity -* %1 - equation declaration type -*=============================================================================* -*AL Questions/Comments: -* - scale both sides -* - support arbitrary year range -*----------------------------------------------------------------------------- -*$ONLISTING - %EQ%_CUMFLO(RPC_CUMFLO(RP(R,P),C,ALLYEAR,LL) %SOW%) .. -$SETLOCAL SW1 '' SETLOCAL SW2 "" -$IF %STAGES%%SCUM%==YES $SET SOW ',WW' SET SWT ',SOW' SET SW1 'S_' SET SW2 ",'1',SOW" - -* all commodity/activity flows within period range - SUM(TT(T)$ -$IFI NOT %OBJ%==LIN ((E(T) >= YEARVAL(ALLYEAR))$(B(T) <= YEARVAL(LL))), -$IFI %OBJ%==LIN ((M(T)+LAGT(T) > YEARVAL(ALLYEAR))$(M(T)-LEAD(T) < YEARVAL(LL))), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS)), -$IFI NOT %OBJ%==LIN MAX(0,MIN(E(T),YEARVAL(LL))-MAX(B(T),YEARVAL(ALLYEAR))+1) -$IFI %OBJ%==LIN SUM(TPULSEYR(T,YEAR)$((ORD(YEAR) >= ORD(ALLYEAR))$(ORD(YEAR) <= ORD(LL))),TPULSE(T,YEAR)) - * ( -$IF %STAGES%==YES SUM(%SWSW% ( -$ BATINCLUDE %cal_red% C COM TS P T - $RP_STD(R,P) + - (SUM(RPC_IRE(R,P,C,IE),%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%))$(NOT RPC_AIRE(R,P,C)) + - (%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C))$RP_IRE(R,P) -$IF %STAGES%==YES )) - ))$RPC(R,P,C) + - SUM((RTP_VINTYR(R,V,T,P),RTP_VARA(R,T,P),PRC_TS(R,P,TS)), -$IFI NOT %OBJ%==LIN MAX(0,MIN(E(T),YEARVAL(LL))-MAX(B(T),YEARVAL(ALLYEAR))+1) -$IFI %OBJ%==LIN SUM(TPULSEYR(T,YEAR)$((ORD(YEAR) >= ORD(ALLYEAR))$(ORD(YEAR) <= ORD(LL))),TPULSE(T,YEAR)) - * %VARTT%_ACT(R,V,T,P,TS %SWS%) - )$SAMEAS(%PGPRIM%,C) - - ) / %CUFSCAL% - - =E= - -* bound range working on - %VAR%_CUMFLO(R,P,C,ALLYEAR,LL %SWT%)$(MAPVAL(%SW1%FLO_CUM(R,P,C,ALLYEAR,LL,'UP'%SW2%)) NE 8); - ; - -$OFFLISTING - diff --git a/source/eqdamage.mod b/source/eqdamage.mod deleted file mode 100644 index a06bc31..0000000 --- a/source/eqdamage.mod +++ /dev/null @@ -1,158 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* EQDAMAGE.mod - Extension for Linearized/Non-linear Damages -*----------------------------------------------------------------------------- -* Questions/Comments: -*----------------------------------------------------------------------------- -$ IF %1==E $GOTO LPDAM -$ IF NOT DEFINED DAM_ELAST PARAMETER DAM_ELAST //; - -* Internal sets and parameters - SET JSUBJ(J,J) 'All steps up to J' //; - SET DAM_NUM(R,C,J,BD); - SET DAMOBJ / DAM, DAS, DAM-EXT /; - SET WWDAM /DELTA-ATM/, RTDAM(R,T,C%SWD%), SWW(ALLSOW,ALLSOW); - PARAMETER DAM_SIZE(REG,T,COM,LIM) 'Size of emission steps' //; -*----------------------------------------------------------------------------- - OPTION CLEAR=RXX; -$ BATINCLUDE filparam DAM_TQTY 'R,' C ",'0','0','0','0'" DATAYEAR T '' '' '' "YEAR," - DAM_TQTY(R,T,C)$(NOT DAM_TQTY(R,T,C)) $= DAM_BQTY(R,C); - -* Enable damage costs for atmospheric CO2 concentration: -$IF %CLI%==YES RTC(R,T,C(CG(CM_VAR)))$((NOT RC(R,C))$DAM_TQTY(R,T,C)) = YES; - -* Remove EPS costs unless uncertain - DAM_COST(R,T,C,CUR)$((DAM_COST(R,T,C,CUR) EQ 0)$DAM_COST(R,T,C,CUR)) = 0; -$IFI %STAGES%==YES OPTION SWW<=SW_TSW; LOOP(SOW,DAM_COST(R,T,C,CUR)$S_DAM_COST(R,T,C,CUR,'1',SOW) = DAM_COST(R,T,C,CUR)+EPS); - LOOP(RDCUR(R,CUR), RXX(RTC)$DAM_COST(RTC,CUR) = YES); - LOOP(T,TRACKC(R,C)$RXX(R,T,C) = YES); - DAM_TVOC(RXX(R,T,C),BD) $= DAM_VOC(R,C,BD); - - RHS_COMBAL(RTCS_VARC(RXX(R,T,C),S))$(NOT DAM_ELAST(R,C,'N')) = YES; - RCS_COMBAL(RHS_COMBAL(RXX(R,T,C),S),'FX') = YES; - -* If BQTY is zero set VOC to zero to, leading to constant cost - DAM_TQTY(RXX(R,T,C))$(DAM_TQTY(R,T,C) LE 0) = MAX(0,DAM_TVOC(R,T,C,'LO')); - DAM_TVOC(RXX(R,T,C),BD)$(NOT DAM_TQTY(R,T,C)) = 0; - LOOP(T,DAM_ELAST(R,C,BD)$((NOT DAM_TQTY(R,T,C))$RXX(R,T,C)) = 0); - DAM_STEP(TRACKC(R,C),'FX') = 0; Z = 100; - DAM_STEP(TRACKC(R,C),BD)$((NOT DAM_STEP(R,C,BD))$DAM_ELAST(R,C,BD)) = 1; - DAM_STEP(TRACKC(R,C),BD)$DAM_STEP(R,C,BD) = MIN(Z,ABS(ROUND(DAM_STEP(R,C,BD)))); - -* Ensure that elasticities are greater than or equal to 1: - DAM_ELAST(TRACKC(R,C),'LO') = ABS(DAM_ELAST(R,C,'UP')$(NOT DAM_ELAST(R,C,'LO'))+DAM_ELAST(R,C,'LO')); - DAM_ELAST(TRACKC(R,C),'UP') = ABS(DAM_ELAST(R,C,'LO')$(NOT DAM_ELAST(R,C,'UP'))+DAM_ELAST(R,C,'UP')); - -* Adjust VOCs - DAM_TVOC(RXX(R,T,C),BD)$(NOT DAM_TVOC(R,T,C,BD)) $= (DAM_STEP(R,C,BD)+.5)*DAM_VOC(R,C,'N')*DAM_TQTY(R,T,C); - DAM_TVOC(RXX(R,T,C),'LO') = MIN(DAM_TQTY(R,T,C),DAM_TVOC(R,T,C,'LO')+INF$(NOT DAM_TVOC(R,T,C,'LO'))); - DAM_TVOC(RXX(R,T,C),'UP')$(NOT DAM_TVOC(R,T,C,'UP')) = - DAM_TVOC(R,T,C,'LO')*(1+((DAM_STEP(R,C,'UP')+0.5)/(DAM_STEP(R,C,'LO')+0.5)-1)$DAM_STEP(R,C,'LO')); - - LOOP(RXX(R,T,C), F = DAM_STEP(R,C,'LO'); Z = DAM_STEP(R,C,'UP'); - FIRST_VAL = DAM_TVOC(R,T,C,'LO'); LAST_VAL = DAM_TVOC(R,T,C,'UP'); - IF(F, DAM_SIZE(R,T,C,'FX') = 2*(FIRST_VAL-(FIRST_VAL*(4*Z+1)-LAST_VAL)/(1+Z*(4+1/F))); - ELSE DAM_SIZE(R,T,C,'FX') = FIRST_VAL+0.5*LAST_VAL/(Z+0.5)); - ); - DAM_SIZE(RXX(R,T,C),BDNEQ(BD))$DAM_STEP(R,C,BD) = MAX(0,(DAM_TVOC(R,T,C,BD)-0.5*DAM_SIZE(R,T,C,'FX')))/DAM_STEP(R,C,BD); - DAM_SIZE(RXX(R,T,C),'UP')$(NOT DAM_STEP(R,C,'LO')) = MAX(0,DAM_TVOC(R,T,C,'UP')/(DAM_STEP(R,C,'UP')+0.5)); - DAM_SIZE(RXX(R,T,C),'N') = DAM_TQTY(R,T,C)-DAM_TVOC(R,T,C,'LO')+0.5*DAM_SIZE(R,T,C,'LO')$DAM_ELAST(R,C,'N'); - - DAM_COEF(RTCS_VARC(R,T,C,S))$((NOT DAM_COEF(R,T,C,S))$TRACKC(R,C)) = 1; - JSUBJ(JJ,J)$((ORD(J) LE ORD(JJ))$(ORD(JJ)<=100)) = YES; -* Set number of FX steps (any non-zero DAM_STEP(R,C,'N') disables endogenous damage) - DAM_STEP(TRACKC(R,C),'FX')$(DAM_STEP(R,C,'N') EQ 0) = 1+1$SUM(T$(DAM_SIZE(R,T,C,'N') GT 0),YES); - IF(CARD(DAM_COST)=0,SUM_OBJ('OBJDAM',ITEM)=0); - RTDAM(RXX(R,T,C)%SOW%)$(%SWTX%YES+WWDAM(C)) = YES; - -*----------------------------------------------------------------------------- - SET OBV / OBJDAM /; -$IF %DAMAGE%==NO SUM_OBJ('OBJDAM',ITEM)=0; -$IFI %SPINES%==YES $%SW_TAGS% -$IF %DAMAGE%==NO $GOTO FINISH -$IF %DAMAGE%==NLP $GOTO NLPDAM -*----------------------------------------------------------------------------- -* Set bounds for damage variables: - LOOP(SAMEAS(J,'1'),DAM_NUM(TRACKC(R,C),J+(DAM_STEP(R,C,BD)-1),BD) = YES); - %VAR%_DAM.UP(R,T,C,BD,J %SWD%) = INF; - %VAR%_DAM.UP(RTC(R,T,C),'LO',J%SOW%)$((ORD(J) LE DAM_STEP(R,C,'LO'))$RTDAM(RTC%SOW%)) = DAM_SIZE(RTC,'LO'); - %VAR%_DAM.UP(RTC(R,T,C),'LO','1'%SOW%)$(DAM_ELAST(R,C,'N')$RTDAM(RTC%SOW%)) = DAM_SIZE(RTC,'LO')+DAM_TQTY(RTC)-DAM_TVOC(RTC,'LO'); - %VAR%_DAM.UP(RTC(R,T,C),'UP',J%SOW%)$((ORD(J) LT DAM_STEP(R,C,'UP'))$RTDAM(RTC%SOW%)) = DAM_SIZE(RTC,'UP'); - %VAR%_DAM.UP(RTC(R,T,C),'FX','1'%SOW%)$(DAM_TVOC(R,T,C,'UP')$RTDAM(RTC%SOW%)) = DAM_SIZE(RTC,'FX'); - %VAR%_DAM.UP(RTC(R,T,C),'FX','2'%SOW%)$RTDAM(RTC%SOW%) = DAM_SIZE(RTC,'N')$(NOT DAM_ELAST(R,C,'N')); -*----------------------------------------------------------------------------- -$LABEL LPDAM -* Damage cost equation -%2 %EQ%_OBJDAM(RDCUR(R,CUR)%SOW%).. - SUM(RTC(R,T,C)$(DAM_STEP(R,C,'FX')$DAM_COST(R,T,C,CUR)), -$IFI %STAGES%==YES SUM(SWW(SOW,WW)$(SW_TSW(SOW,T,WW)$(NOT WWDAM(C))+SWW(WW,SOW)$WWDAM(C)), - (SUM((DAM_NUM(R,C,JJ,'LO'),JSUBJ(JJ,J)), - (%VAR%_DAM(R,T,C,'LO',J%SWD%) + DAM_ELAST(R,C,'N')*%VAR%_DAM.UP(R,T,C,'LO',J%SWD%))* - ((DAM_TQTY(R,T,C)-DAM_SIZE(R,T,C,'FX')/2-DAM_SIZE(R,T,C,'LO')*(ORD(JJ)-ORD(J)+.5))**DAM_ELAST(R,C,'LO') / - DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'LO') + DAM_ELAST(R,C,'N')))$DAM_TQTY(R,T,C) + - %VAR%_DAM(R,T,C,'FX','1'%SWD%) * (1 + DAM_ELAST(R,C,'N')) + - SUM((DAM_NUM(R,C,JJ,'UP'),JSUBJ(JJ,J)), - %VAR%_DAM(R,T,C,'UP',J%SWD%) * - ((DAM_TQTY(R,T,C)+DAM_SIZE(R,T,C,'FX')/2+DAM_SIZE(R,T,C,'UP')*(ORD(J)-.5))**DAM_ELAST(R,C,'UP') / - DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'UP') + DAM_ELAST(R,C,'N')))$DAM_TQTY(R,T,C) - ) * OBJ_PVT(R,T,CUR) * -$IFI NOT %STAGES%==YES DAM_COST(R,T,C,CUR) -$IFI %STAGES%==YES S_DAM_COST(R,T,C,CUR,'1',WW)) - ) - -%3 =E= SUM(OBV,SUM_OBJ('OBJDAM',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); - -$GOTO FINISH -*============================================================================= -$LABEL NLPDAM -* Set bounds for damage variables: - DAM_STEP(TRACKC(R,C),'LO') = 1; - DAM_STEP(TRACKC(R,C),'UP') = 1; - LOOP(SAMEAS(J,'1'),DAM_NUM(TRACKC(R,C),J+(DAM_STEP(R,C,BD)-1),BD) = YES); - %VAR%_DAM.UP(R,T,C,BD,J %SWD%) = INF; - %VAR%_DAM.UP(RTC(R,T,C),'LO','1'%SOW%)$RTDAM(RTC%SOW%) = (DAM_TQTY(RTC)-DAM_SIZE(RTC,'N'))$DAM_STEP(R,C,'LO'); - %VAR%_DAM.UP(RTC(R,T,C),'FX','1'%SOW%)$RTDAM(RTC%SOW%) = EPS; - %VAR%_DAM.UP(RTC(R,T,C),'FX','2'%SOW%)$RTDAM(RTC%SOW%) = DAM_SIZE(RTC,'N'); -*----------------------------------------------------------------------------- -* Damage cost equation - %EQ%_OBJDAM(RDCUR(R,CUR)%SOW%).. - SUM(RTC(R,T,C)$(DAM_STEP(R,C,'FX')$DAM_COST(R,T,C,CUR)), -$IFI %STAGES%==YES SUM(SWW(SOW,WW)$(SW_TSW(SOW,T,WW)$(NOT WWDAM(C))+SWW(WW,SOW)$WWDAM(C)), - (DAM_TVOC(R,T,C,'N')*(%VAR%_DAM(R,T,C,'FX','2'%SWD%)+DAM_SIZE(R,T,C,'N')*DAM_ELAST(R,C,'N')) + - (((%VAR%_DAM(R,T,C,'LO','1'%SWD%)+DAM_SIZE(R,T,C,'N'))**(DAM_ELAST(R,C,'LO')+1) + -* Subtract full LO costs if DAM_ELAST(N) = -1 (constant term) - DAM_ELAST(R,C,'N')*DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'LO')+1) - - DAM_SIZE(R,T,C,'N')**(DAM_ELAST(R,C,'LO')+1)) / - (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'LO')*(DAM_ELAST(R,C,'LO')+1)))$DAM_STEP(R,C,'LO') + - (((%VAR%_DAM(R,T,C,'UP','1'%SWD%)+DAM_TQTY(R,T,C))**(DAM_ELAST(R,C,'UP')+1) - - DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'UP')+1)) / - (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'UP')*(DAM_ELAST(R,C,'UP')+1))) + -* Shift cost curve by DAM_ELAST(N) if applicable - DAM_ELAST(R,C,'N')*(SUM(BDNEQ(BD),%VAR%_DAM(R,T,C,BD,'1'%SWD%))+DAM_ELAST(R,C,'N')*DAM_TQTY(R,T,C)) - ) * OBJ_PVT(R,T,CUR) * -$IFI NOT %STAGES%==YES DAM_COST(R,T,C,CUR) -$IFI %STAGES%==YES S_DAM_COST(R,T,C,CUR,'1',WW)) - ) - - =E= SUM(OBV,SUM_OBJ('OBJDAM',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); - -*----------------------------------------------------------------------------- -$LABEL FINISH -*----------------------------------------------------------------------------- -* Emission balance equation - - %EQ%_DAMAGE(RTC(%R_T%,C) %SOW%)$(SUM(RDCUR(R,CUR)$DAM_COST(R,T,C,CUR),1)$RTDAM(RTC%SOW%)).. - - SUM(DAM_NUM(R,C,JJ,BD),SUM(JSUBJ(JJ,J),%VAR%_DAM(R,T,C,BD,J %SOW%))) - - =E= ( -$IF %CLI%==YES SUM(CM_VAR(C),%VART%_CLITOT(CM_VAR,T%SWS%)$CM_KIND(CM_VAR)+%VAR%_CLIBOX(CM_VAR,T%SOW%)$(NOT CM_KIND(CM_VAR)))$(NOT RC(R,C)) + - SUM(COM_TS(RC(R,C),S),DAM_COEF(R,T,C,S)*%VAR%_COMNET(R,T,C,S %SOW%)$(NOT DAM_ELAST(R,C,'N')) + - DAM_COEF(R,T,C,S)*%VAR%_COMPRD(R,T,C,S %SOW%)$DAM_ELAST(R,C,'N')) - )$DAM_STEP(R,C,'FX'); -*----------------------------------------------------------------------------- - OPTION CLEAR=TRACKC,CLEAR=RXX,CLEAR=DAM_TVOC; - DAM_TVOC(R,T,C,'N')$DAM_SIZE(R,T,C,'N') = ((DAM_SIZE(R,T,C,'N')/DAM_TQTY(R,T,C))**DAM_ELAST(R,C,'LO'))$DAM_ELAST(R,C,'N'); \ No newline at end of file diff --git a/source/eqdeclr.mod b/source/eqdeclr.mod deleted file mode 100644 index b35bdb0..0000000 --- a/source/eqdeclr.mod +++ /dev/null @@ -1,195 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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(UC_N,R %SWD%) 'User-constraints (=E=)' - %EQ%E_UCT(UC_N,T %SWTD%) 'User-constraints (=E=)' - %EQ%E_UCRT(UC_N,R,T %SWTD%) 'User-constraints (=E=)' - %EQ%E_UCTS(UC_N,T,S %SWTD%) 'User-constraints (=E=)' - %EQ%E_UCRS(R,UC_N,T,TSL,S %SWD%) 'User-constraints (=E=)' - %EQ%E_UCRTS(UC_N,R,T,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(UC_N,R,T,S %SWD%) 'User-constraints (=E=)' - %EQ%E_UCRSU(UC_N,R,T %SWD%) 'User-constraints (=E=)' - -$IF %VAR_UC% == YES $GOTO UCDONE - EQG_UC(UC_N) 'User-constraints (=G=)' - EQG_UCR(UC_N,R) 'User-constraints (=G=)' - EQG_UCT(UC_N,T) 'User-constraints (=G=)' - EQG_UCRT(UC_N,R,T) 'User-constraints (=G=)' - EQG_UCTS(UC_N,T,S) 'User-constraints (=G=)' - EQG_UCRS(R,UC_N,T,TSL,S) 'User-constraints (=G=)' - EQG_UCRTS(UC_N,R,T,S) 'User-constraints (=G=)' - EQG_UCSU(UC_N,T) 'User-constraints (=G=)' - EQG_UCSUS(UC_N,T,S) 'User-constraints (=G=)' - EQG_UCRSUS(UC_N,R,T,S) 'User-constraints (=G=)' - EQG_UCRSU(UC_N,R,T) 'User-constraints (=G=)' - - EQL_UC(UC_N) 'User-constraints (=L=)' - EQL_UCR(UC_N,R) 'User-constraints (=L=)' - EQL_UCT(UC_N,T) 'User-constraints (=L=)' - EQL_UCRT(UC_N,R,T) 'User-constraints (=L=)' - EQL_UCTS(UC_N,T,S) 'User-constraints (=L=)' - EQL_UCRS(R,UC_N,T,TSL,S) 'User-constraints (=L=)' - EQL_UCRTS(UC_N,R,T,S) 'User-constraints (=L=)' - EQL_UCSU(UC_N,T) 'User-constraints (=L=)' - EQL_UCSUS(UC_N,T,S) 'User-constraints (=L=)' - EQL_UCRSUS(UC_N,R,T,S) 'User-constraints (=L=)' - EQL_UCRSU(UC_N,R,T) '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' -; diff --git a/source/eqdeclr.tm b/source/eqdeclr.tm deleted file mode 100644 index 30e17af..0000000 --- a/source/eqdeclr.tm +++ /dev/null @@ -1,77 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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 * -*=============================================================================* -* EQUATIONS -*----------------------------------------------------------------------------- -* Objective Function & Components -*----------------------------------------------------------------------------- -* Overall OBJ by regional objs (which are built from rest) - EQ_OBJ(R,ALLYEAR) 'Overall Objective Function' - -* Costs of elastic demands - EQ_OBJELS(REG,BD,CUR) - -* Fixed Costs - EQ_ANNFIX(REG,ALLYEAR,CUR) - -* Investment component - EQ_ANNINV(REG,ALLYEAR,CUR) - -* Variable operating costs - EQ_ANNVAR(REG,ALLYEAR,CUR) - -*----------------------------------------------------------------------------- -* MACRO equations -*----------------------------------------------------------------------------- - EQ_UTIL 'Utility function' - EQ_CONSO(R,T) 'Consumption equation' - EQ_DD(R,T,C) 'Demand decoupling equation' - EQ_MCAP(R,T) 'Capital dynamics equation' - EQ_TMC(R,T) 'Terminal condition for investment in last period' - EQ_IVECBND(R,T) 'Bound on the sum of investment and energy costs' - EQ_ESCOST(R,T) 'Energy System costs' - EQ_MPEN(R,T,P) 'Definition of variables for cost penalty function' - EQ_XCAPDB(R,T,P) 'Quadratic approximation of market penetration cost penalty function' - -*----------------------------------------------------------------------------- -* MACRO MLF calibration equations -*----------------------------------------------------------------------------- -* Calibration -* EQ_UTIL 'Utility function' - EQ_PROD_Y(R,T) 'Production unction' - EQ_AKL(R,T) 'Aggregate Kapital Labor' - EQ_LABOR(R,T) 'Labor dummy definition' - EQ_KNCAP(R,T) 'Capital dummy definition' -* EQ_MCAP(R,T) 'Capital dynamics equation' -* EQ_TMC(R,T) 'Terminal condition for investment in last period' -* EQ_IVECBND(R,T) 'Bound on the sum of investment and energy costs' -* EQ_DD(R,T,C) 'Demand decoupling equation' -* EQ_ESCOST(R,T) 'Energy System costs' - EQ_TRDBAL(T) 'Trade balance' - EQ_DNLCES(R,T) 'Demand CES function' -*----------------------------------------------------------------------------- -* Full MLF model formulation -*----------------------------------------------------------------------------- - EQ_UTILP 'Utility function' -* EQ_CONSO(R,T) 'Consumption equation' - EQ_CONDA(R,T) 'Consumption disaggregation' - EQ_LOGBD(R,T) 'Linearized log bound' - EQ_MACSH(R,T,CG,CG) 'Macro shares in aggergate' - EQ_MACAG(R,T,CG) 'Macro aggergations' - EQ_MACES(R,T,CG,CG) 'Macro CES functions' -* EQ_LABOR(R,T) 'Labor dummy definition' -* EQ_KNCAP(R,T) 'Capital dummy definition' -* EQ_MCAP(R,T) 'Capital dynamics equation' -* EQ_TMC(R,T) 'Terminal condition for investment in last period' -* EQ_IVECBND(R,T) 'Bound on the sum of investment and energy costs' -* EQ_DD(R,T,C) 'Demand decoupling equation' - EQ_DEMSH(R,T,C) 'Demand shares in aggergate' - EQ_DEMAG(R,T) 'Demand aggregation' - EQ_DEMCES(R,T,C) 'Demand CES function' - EQ_ENSCST(R,T) 'Energy System costs' -* EQ_TRDBAL(T,TRD) 'Trade balance' diff --git a/source/eqflobnd.mod b/source/eqflobnd.mod deleted file mode 100644 index 81dfa8d..0000000 --- a/source/eqflobnd.mod +++ /dev/null @@ -1,45 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQFLOBND limits the flow variable at higher TS-leves -* %1 - equation declaration type -* %2 - bound type for %1 -* %3 - qualifier that bound exists -*=============================================================================* -*UR Questions/Comments: -*----------------------------------------------------------------------------- -*$ONLISTING - - %EQ%%1_FLOBND(RTP_VARA(%R_T%,P),CG,S %SWT%)$( -* Make an equation of the bound if there are flow variables for commodities in CG that are strictly below S, -* ...or the tuple has been otherwise rejected for VAR bound (process is vintaged or IRE, or flow is reduced): - SUM(RTPCS_VARF(R,T,P,C,TS)$(TS_MAP(R,S,TS)*COM_GMAP(R,CG,C)), - RS_BELOW(R,S,TS) OR FLO_BND(R,'%DFLBL%',P,CG,S,'%2') - )$FLO_BND(R,T,P,CG,S,'%2') - ) .. - -* sum over all flows that are either at S or below it - (SUM((COM_GMAP(R,CG,C),RTPCS_VARF(R,T,P,C,TS))$TS_MAP(R,S,TS), -* sum all the existing flows - SUM(RTP_VINTYR(R,V,T,P), -* [UR] model reduction %REDUCE% is set in *.run - ( -$ BATINCLUDE %cal_red% C COM TS P T - )$RP_FLO(R,P) + - -* [AL] add support for IRE - SUM(RPC_IRE(R,P,C,IE),(%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%) -$IF %REDUCE% == 'YES' - $(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) -* apply IRE bound on net flow if group used, otherwise on sum of IMP/EXP - )*(1-2$XPT(IE)$(NOT COM(CG))))$RP_IRE(R,P) - ) - ) - - - FLO_BND(R,T,P,CG,S,'%2'))$%3 - - =%1= 0; - -*$OFFLISTING diff --git a/source/eqflofr.mod b/source/eqflofr.mod deleted file mode 100644 index 9368b80..0000000 --- a/source/eqflofr.mod +++ /dev/null @@ -1,27 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQFLOFR relationship between total flow and the flow in a specific timeslice -* %1 - equation declaration type -* %2 - LIM type of FLO_FR -*=============================================================================* -* Questions/Comments: -* - FLO_FR must be specified on TS-level of the flow or above; value below will be ignored -* - fraction of flows under parent timelice supported by a parent N (or negative) FLO_FR - - - %EQ%%1_FLOFR(RTPC(%R_T%,P,C),S,L(%2)%SWT%)$(SUM(RPCS_VAR(RP_FLO(R,P),C,TS)$TS_MAP(R,S,TS),1)$FLO_FR(R,T,P,C,S,L)).. - - SUM(RTP_VINTYR(R,V,T,P),%VAR%_FLO(R,V,T,P,C,S%SOW%)$IPS(L) + - SUM(RS_BELOW1(R,SL,S),%VAR%_FLO(R,V,T,P,C,SL%SOW%)$FLO_FR(RTPC,SL,'N') + - SUM(RTPCS_VARF(RTPC,TS)$(FLO_FR(RTPC,S,L)>-INF$RS_FR(R,SL,TS)), -$ BATINCLUDE %cal_red% C COM TS P T - )$(NOT FLO_FR(RTPC,SL,'N')))$BD(L)) * ABS(FLO_FR(RTPC,S,L)) - - =%1= - - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(RTPC,TS))$(STOA(TS)$TS_MAP(R,S,TS)), -$ BATINCLUDE %cal_red% C COM TS P T - ); diff --git a/source/eqflomrk.mod b/source/eqflomrk.mod deleted file mode 100644 index fb74bd2..0000000 --- a/source/eqflomrk.mod +++ /dev/null @@ -1,104 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================================================* -* EQx_FLMRK is a market share constraint for a commodity flow of a process -* %1 - equation declaration type -* %2 - BOUND type for %1 -*==================================================================================================* -* Comments: -*--------------------------------------------------------------------------------------------------- -*$ONLISTING -$IF NOT '%2' == '' $GOTO EQUDEF -*--------------------------------------------------------------------------------------------------- - SET RTX_MARK(R,T,ITEM,C,BD,S) //; - SET RX_MARK(R,YEAR,ITEM,C,BD) //; - SET RMKC(R,ITEM,C) //; - -* Remove superfluous data points - PRC_MARK(R,LL,P,ITEM,C,BDNEQ)$PRC_MARK(R,LL,P,ITEM,C,'FX') = NO; - PRC_MARK(R,LL,P,ITEM,C,BD)$((NOT RTP_VARA(R,LL,P))$(NOT SAMEAS(P,ITEM))$PRC_MARK(R,LL,P,ITEM,C,BD)) = NO; - -* Partitioning - LOOP(T,RX_MARK(R,'0',P,C,BD)$((PRC_MARK(R,T,P,P,C,BD)$RP_STD(R,P) GE 0)$PRC_MARK(R,T,P,P,C,BD)) = YES); - RX_MARK(R,T--ORD(T),P,C,BD) $= PRC_MARK(R,T,P,P,C,BD)$(NOT RX_MARK(R,'0',P,C,BD)); -* Eliminate zero values; For standard processes set flow bound - OPTION CLEAR=UNCD7,CLEAR=YK1; - UNCD7(RTP_VARA(R,T,P),ITEM,C,BD,'')$((PRC_MARK(R,T,P,ITEM,C,BD) EQ 0)$PRC_MARK(R,T,P,ITEM,C,BD)) = YES; - UNCD7(RTP_VARA(R,T,P),PRC,C,BD,'')$(PRC_MARK(R,T,PRC,PRC,C,BD)$RX_MARK(R,'0',PRC,C,BD)) = NO; - LOOP(UNCD7(R,T,P,ITEM,C,BDUPX(BD),'')$RP_STD(R,P),FLO_BND(R,T,P,C,ANNUAL,BD) = EPS); - PRC_MARK(R,T,P,ITEM,C,BD)$UNCD7(R,T,P,ITEM,C,BD,'') = 0; -* Make sure that data for all PRC in group are forward extrapolated - LOOP((RTP_VARA(R,T,P),ITEM,C,BD)$PRC_MARK(R,T,P,ITEM,C,BD),RTX_MARK(R,T,ITEM,C,BD,'ANNUAL') = YES); - YK1(TT,T(TT+1)) = YES; - LOOP(YK1(TT,T),PRC_MARK(RTP_VARA(R,T,P),ITEM,C,BD)$(NOT PRC_MARK(R,T,P,ITEM,C,BD)) $= PRC_MARK(R,TT,P,ITEM,C,BD)); - PRC_MARK(R,T,P,ITEM,C,BD)$(NOT RTX_MARK(R,T,ITEM,C,BD,'ANNUAL')) = 0; - OPTION CLEAR=UNCD7,CLEAR=RXX,CLEAR=YK1; - -* Add ANNUAL level for PRC_MARK group commodities not in TOP - LOOP((R,T,P,ITEM,C,BD)$PRC_MARK(R,T,P,ITEM,C,BD),RMKC(R,ITEM,C) = YES); OPTION TRACKC <= RMKC; - TRACKC(RC) = NO; COM_TSL(TRACKC,'ANNUAL')$(NOT SUM(COM_TSL(TRACKC,TSLVL),1)) = YES; -* Prepare the COMPRD variables for all PRC_MARK parameters: - OPTION CLEAR=TRACKC; LOOP(RMKC(R,ITEM,C),TRACKC(RC(R,COM))$COM_GMAP(R,C,COM) = YES); - RHS_COMPRD(RTCS_VARC(R,T,C,S))$TRACKC(R,C) = YES; - OPTION CLEAR=TRACKC,CLEAR=RXX; -* If ITEM is also P (ala FLO_MARK), or C is not in TOP, use commodity timeslices; else use ANNUAL - LOOP(RX_MARK(R,LL,P,C,BD),RXX(R,P,C)=YES); RXX(RMKC(R,ITEM,C))$(NOT RC(R,C))=YES; - RXX(R,ITEM,C)$COM_TSL(R,C,'ANNUAL') = NO; - UNCD7(RTX_MARK(R,T,ITEM,C,BD,S),'')$RXX(R,ITEM,C) = YES; RTX_MARK(R,T,ITEM,C,BD,S)$UNCD7(R,T,ITEM,C,BD,S,'') = NO; - LOOP((RXX(R,ITEM,C),COM_TSL(R,C,TSLVL)),RTX_MARK(R,T,ITEM,C,BD,S)$(TS_GROUP(R,TSLVL,S)$UNCD7(R,T,ITEM,C,BD,'ANNUAL','')) = YES); - -$EXIT -*=================================================================================================== -$LABEL EQUDEF -$SETLOCAL IRED "" -$IF %REDUCE% == YES $SETLOCAL IRED "$(NOT RPC_AIRE(R,P,C))+%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C)$RPC_AIRE(R,P,C)" -* For IRE/STG: Output flow from process if PRC_MARK >= 0, Input flow if PRC_MARK <= 0 -$SETLOCAL SIGO "(PRC_MARK(R,T,P,ITEM,COM,'%2') GE 0)" SETLOCAL SIGI "(PRC_MARK(R,T,P,ITEM,COM,'%2') LE 0)" -*=================================================================================================== - -%EQ%%1_FLOMRK(%R_T%,ITEM,COM,S %SWT%)$RTX_MARK(R,T,ITEM,COM,'%2',S) .. - -* Sum over all processes with PRC_MARK(COM) (not just capacity-related) - SUM(P$PRC_MARK(R,T,P,ITEM,COM,'%2'), - POWER(PRC_MARK(R,T,P,ITEM,COM,'%2'),1$RX_MARK(R,'0',ITEM,COM,'%2')-1) * - -* Sum over all COMPRD balance variables related to timeslice S - SUM((RHS_COMPRD(R,T,C,SL),RS_TREE(R,S,SL))$COM_GMAP(R,COM,C), - -* Sum over all flow variables related to balance timeslice - (SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,SL,TS), - SUM(RTP_VINTYR(R,V,T,P), -$ BATINCLUDE %cal_red% C COM1 TS P T - ) * -* Balance coarser than variable or balance finer than variable - RS_FR(R,SL,TS)*(1+RTCS_FR(R,T,C,SL,TS)) - )*(1+(COM_IE(R,T,C,SL)-1)$TOP(R,P,C,'OUT')))$RP_STD(R,P) - -* Inter-regional trade contribution - + SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,SL,TS), - SUM(RTP_VINTYR(R,V,T,P), - ((%VAR%_IRE(R,V,T,P,C,TS,'IMP'%SOW%)%IRED%)*(1+IRE_FLOSUM(R,T,P,C,S,'IMP',C,'OUT'))*COM_IE(R,T,C,SL))$(%SIGO%$RPC_IRE(R,P,C,'IMP'))- - ((%VAR%_IRE(R,V,T,P,C,TS,'EXP'%SOW%)%IRED%)*(1+IRE_FLOSUM(R,T,P,C,S,'EXP',C,'IN')))$(%SIGI%$RPC_IRE(R,P,C,'EXP'))) * -* Balance coarser than variable or balance finer than variable - RS_FR(R,SL,TS)*(1+RTCS_FR(R,T,C,SL,TS)))$RP_IRE(R,P) - -* Storage contribution - + SUM(RPCS_VAR(RPC_STG(R,P,C),TS)$RS_FR(R,SL,TS), - SUM(RTP_VINTYR(R,V,T,P), - ((%VAR%_SOUT(R,V,T,P,C,TS %SOW%)*STG_EFF(R,V,P)*COM_IE(R,T,C,SL))$%SIGO%-%VAR%_SIN(R,V,T,P,C,TS %SOW%)$%SIGI%)) * -* Balance coarser than variable or balance finer than variable - RS_FR(R,SL,TS)*(1+RTCS_FR(R,T,C,SL,TS)))$PRC_MAP(R,'STG',P) - - )) - - =%1= - -* Reference is the COMPRD variable - SUM((RHS_COMPRD(R,T,C,SL),RS_TREE(R,S,SL))$COM_GMAP(R,COM,C),%VAR%_COMPRD(R,T,C,SL %SOW%)) * - PROD(RX_MARK(R,LL,P(ITEM),COM,'%2'),PRC_MARK(R,T,P,P,COM,'%2')$LASTLL(LL)) - -; - -*$OFFLISTING diff --git a/source/eqfloshr.mod b/source/eqfloshr.mod deleted file mode 100644 index 828501e..0000000 --- a/source/eqfloshr.mod +++ /dev/null @@ -1,42 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQIN/OUTSHR is the market/product share limit constraint -* %1 - equation declaration type -* %2 - FLO_SHAR type for %1 -* %3 - IN/OUT indicator -*=============================================================================* -*GaG Questions/Comments: -* - Needs to be adjusted to handle attribute TS-level diff. the operation level -* - for now FLO_SHAR moved down to S1 level in PP_MAIN (which may be OK) -* - [AL] Changed level of equation to be that of RPCS_VAR; RP_STD control added -*----------------------------------------------------------------------------- - - %EQ%%1_%3SHR(RTP_VINTYR(%R_V_T%,P),C,CG,S %SWT%)$((RP_STD(R,P)*TOP(R,P,C,'%3')*RTPCS_VARF(R,T,P,C,S))$FLO_SHAR(R,V,P,C,CG,S,'%2')).. - -* all flows in the group - FLO_SHAR(R,V,P,C,CG,S,'%2') * -*V0.5a 980729 - RPCS_VAR: com not c -* [AL] Handle reduced/non-reduced groups separately - (SUM((TOP(R,P,COM,'%3'),RTPCS_VARF(R,T,P,COM,TS))$COM_GMAP(R,CG,COM), - %VAR%_FLO(R,V,T,P,COM,TS %SOW%)*RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) - )$(NOT RPG_RED(R,P,CG,'%3')) + - - SUM((TOP(R,P,COM,'%3'),RTPCS_VARF(R,T,P,COM,TS))$COM_GMAP(R,CG,COM), -$ BATINCLUDE %cal_red% COM COM1 TS P T - * -* share-ts coarser than variable or share finer than variable - RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) - )$RPG_RED(R,P,CG,'%3') - )$(FLO_SHAR(R,V,P,C,CG,S,'%2') > 0) - - =%1= - -* commodity working on, summed for all - %VAR%_FLO(R,V,T,P,C,S %SOW%)$(NOT RPG_RED(R,P,CG,'%3')) + - ( -$ BATINCLUDE %cal_red% C COM S P T - )$RPG_RED(R,P,CG,'%3') - ; diff --git a/source/eqire.mod b/source/eqire.mod deleted file mode 100644 index 84d65d2..0000000 --- a/source/eqire.mod +++ /dev/null @@ -1,55 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQIRE ensure that inter-regional imports/exports match up * -*=============================================================================* -* Questions/Comments: -* UR 08/24/01: import flows have to be at PRC_TS(REG,P,S), alternative would be to allow RTPCS_VARF -* to be at a different level using RTCS_TSFR to bring it to the right TSLVL -*----------------------------------------------------------------------------- -*$ONLISTING - - %EQ%_IRE(RTP%RTPX%(REG,%TX%,P),COM,IE,S %SWT%)$(RPCS_VAR(REG,P,COM,S)$RPC_EQIRE(REG,P,COM,IE)) .. - - -* the imports/exports of commodity COM into REG at timeslice S - SUM(RTP_VINTYR(REG,V,T,P)$RTPCS_VARF(REG,T,P,COM,S), - %VAR%_IRE(REG,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(REG,P,COM))+(%VAR%_ACT(REG,V,T,P,S%SOW%)*PRC_ACTFLO(REG,V,P,COM))$RPC_AIRE(REG,P,COM) - ) * (1-2*XPT(IE)) - + -* sum also the imports in other regions in case of market-based equation - SUM(TOP_IRE(REG,COM1,R,C,P)$((NOT SAMEAS(REG,R))$RPC_MARKET(REG,P,COM1,'EXP')), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS),RS_TREE(R,ALL_TS,TS))$IRE_TSCVT(R,ALL_TS,REG,S), - (%VAR%_IRE(R,V,T,P,C,TS,'IMP'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) - * IRE_CCVT(R,C,REG,COM1) * IRE_TSCVT(R,ALL_TS,REG,S) - * RS_FR(R,ALL_TS,TS)*(1+RTCS_FR(R,T,C,ALL_TS,TS)) - ) * IRE_CCVT(REG,COM1,REG,COM) - )$RPC_MARKET(REG,P,COM,'IMP') - + -* sum also the imports in other regions in case of market-based equation: EXP case - SUM(TOP_IRE(REG,COM,R,C,P), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS),RS_TREE(R,ALL_TS,TS))$IRE_TSCVT(R,ALL_TS,REG,S), - (%VAR%_IRE(R,V,T,P,C,TS,'IMP'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) - / IRE_FLO(REG,V,P,COM,R,C,TS) * IRE_TSCVT(R,ALL_TS,REG,S) - * RS_FR(R,ALL_TS,TS)*(1+RTCS_FR(R,T,C,ALL_TS,TS)) - ) * IRE_CCVT(R,C,REG,COM) - )$XPT(IE) - - =E= - -* sum the associated exports - SUM((TOP_IRE(R,C,REG,COM,P),ALL_TS)$IRE_TSCVT(R,ALL_TS,REG,S), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,ALL_TS,TS), - (%VAR%_IRE(R,V,T,P,C,TS,'EXP'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) -* [AL] IRE_TSCVT converts from ALL_TS to S, and RTCS_TSFR from TS to ALL_TS: - * IRE_FLO(R,V,P,C,REG,COM,S) * IRE_TSCVT(R,ALL_TS,REG,S) - * RS_FR(R,ALL_TS,TS)*(1+RTCS_FR(R,T,C,ALL_TS,TS)) - ) * IRE_CCVT(R,C,REG,COM) - )$IMP(IE) - - ; - -*$OFFLISTING - diff --git a/source/eqirebnd.mod b/source/eqirebnd.mod deleted file mode 100644 index a168f78..0000000 --- a/source/eqirebnd.mod +++ /dev/null @@ -1,70 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQIREBND limits the activity of inter-regional exchange process -* %1 - equation declaration type -* %2 - bound type for %1 -* %3 - qualifier that bound exists -*=============================================================================* -*GaG Questions/Comments: -* - BND ts restricted to the PRC_TS level or above? -*UR* /12/09/99 commodity names can be different in the two regions -*----------------------------------------------------------------------------- -*$ONLISTING -*V0.5b 980902 - avoid equations if LO=0/UP=INF -*V0.6a 990301 - %EQ%%1_IREBND(R,%TX%,C,S,ALL_REG,IE %SWT%)$((RCS_COMTS(R,C,S) * SUM(RPC_IRE(R,P,C,IE),1) AND %3 - )$IRE_BND(R,T,C,S,ALL_REG,IE,'%2')) .. - - ( -* For imports from internal non-marketplace region, sum the associated exports - SUM(TOP_IRE(REG(ALL_REG),COM,R,C,P)$RPC_EQIRE(R,P,C,'IMP'), - SUM(SL$(RTPCS_VARF(R,T,P,C,SL)*RS_TREE(R,S,SL)), - SUM((RTP_VINTYR(REG,V,T,P),RTPCS_VARF(REG,T,P,COM,TS),RS_TREE(REG,ALL_TS,TS))$IRE_TSCVT(REG,ALL_TS,R,SL), - (%VAR%_IRE(REG,V,T,P,COM,TS,'EXP'%SOW%)$(NOT RPC_AIRE(REG,P,COM))+(%VAR%_ACT(REG,V,T,P,TS%SOW%)*PRC_ACTFLO(REG,V,P,COM))$RPC_AIRE(REG,P,COM)) - * IRE_FLO(REG,V,P,COM,R,C,SL) * IRE_CCVT(REG,COM,R,C) * IRE_TSCVT(REG,ALL_TS,R,SL) - * RS_FR(REG,ALL_TS,TS)*(1+RTCS_FR(REG,T,COM,ALL_TS,TS)) -* bound coarser than variable or bound finer than variable - ) * (1$TS_MAP(R,S,SL) + (G_YRFR(R,S)/G_YRFR(R,SL))$RS_BELOW(R,SL,S)) - ) - ) - + -* For imports from external regions or marketplace, sum the flows directly in region R - SUM(RPC_IRE(R,P,C,IE)$((NOT RPC_EQIRE(R,P,C,'IMP'))*SUM(TOP_IRE(ALL_REG,COM,R,C,P),1)), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_TREE(R,S,TS), - (%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) -* bound coarser than variable or bound finer than variable - * (1$TS_MAP(R,S,TS) + (G_YRFR(R,S)/G_YRFR(R,TS))$RS_BELOW(R,TS,S)) - ) - ) - )$IMP(IE) - + - ( -* For exports from market region to internal region REG, sum the associated imports into REG - SUM((RPC_MARKET(R,P,C,'EXP'),TOP_IRE(R,C,REG(ALL_REG),COM,P)), - SUM((RTP_VINTYR(REG,V,T,P),RTPCS_VARF(REG,T,P,COM,TS),RS_TREE(REG,ALL_TS,TS))$IRE_TSCVT(REG,ALL_TS,R,S), - (%VAR%_IRE(REG,V,T,P,COM,TS,'IMP'%SOW%)$(NOT RPC_AIRE(REG,P,COM))+(%VAR%_ACT(REG,V,T,P,TS%SOW%)*PRC_ACTFLO(REG,V,P,COM))$RPC_AIRE(REG,P,COM)) - * IRE_CCVT(REG,COM,R,C) * IRE_TSCVT(REG,ALL_TS,R,S) - * RS_FR(REG,ALL_TS,TS)*(1+RTCS_FR(REG,T,COM,ALL_TS,TS)) - ) - ) - + -* For all other exports, sum the flows directly in region R -*UR* /12/09/99 commodity names can be different in the two regions - SUM(RPC_IRE(R,P,C,IE)$((NOT RPC_MARKET(R,P,C,'EXP'))*SUM(TOP_IRE(R,C,ALL_REG,COM,P),1)), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_TREE(R,S,TS), - (%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) -* bound coarser than variable or bound finer than variable - * (1$TS_MAP(R,S,TS) + (G_YRFR(R,S)/G_YRFR(R,TS))$RS_BELOW(R,TS,S)) - ) - ) - )$XPT(IE) - - - =%1= - - IRE_BND(R,T,C,S,ALL_REG,IE,'%2') - ; -*$OFFLISTING diff --git a/source/eqlducs.vda b/source/eqlducs.vda deleted file mode 100644 index d49970f..0000000 --- a/source/eqlducs.vda +++ /dev/null @@ -1,175 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQLDUCS - implements linear and discrete unit commitment -* %1 - Section -*=============================================================================* -$IF NOT %OBMAC%==YES $EXIT -$IF %1==EQU $GOTO EQU -* Internal attributes for equation control - PARAMETER DP_NON(R,LL,P,UPT,TSL,BD) 'Bounds on non-operational time between shut-down and next start-up'; -*------------------------------------ -* Assume valid UPTs must have a cost or SD-time; reset simplified UC options - OPTION RP_UPT1; - ACT_CSTUP(RTP(R,V,P),TSL,CUR)$RP_DP(R,P) = 0; - ACT_CSTSD(RTP(R,V,P),UPT,'FX',CUR)$(RDCUR(R,CUR)$RP_DP(R,P)) = ACT_CSTSD(RTP,UPT,'UP',CUR)+ACT_CSTSD(RTP,'HOT','LO',CUR); - ACT_CSTUP(RTP(R,V,P),TSL,CUR)$RP_DPL(R,P,TSL) $=SUM(UPT$ACT_CSTSD(RTP,UPT,'FX',CUR),EPS); - RP_UPT(RP_DP,UPT,'LO')=DIAG('HOT',UPT); LOOP(V,RP_UPT(R,P,UPT,BD('UP'))$ACT_SDTIME(R,V,P,UPT,BD)=YES); -*------------------------------------ -* Max. non-op. time processing - ACT_MAXNON(R,V,P,UPT)$((NOT ACT_MAXNON(R,V,P,UPT))$RP_DP(R,P)) = EPS; - DP_NON(RTP(R,V,P),UPT,TSL,'UP')$((ACT_MAXNON(RTP,UPT)<8760/G_CYCLE(TSL))$RP_DPL(R,P,TSL)) = ACT_MAXNON(RTP,UPT)/8760; - DP_NON(RTP(R,V,P),'WARM',TSL,'LO')$RP_DP(R,P) = DP_NON(RTP,'HOT',TSL,'UP'); - DP_NON(RTP(R,V,P),UPT,TSL,'LO')$RP_DP(R,P) = MAX(DP_NON(RTP,UPT,TSL,'LO'),ACT_TIME(RTP,'LO')/8760); - DP_NON(RTP(R,V,P),UPT,TSL,BDNEQ(BD))$RP_DP(R,P) = DP_NON(RTP,UPT,TSL,BD)+(ACT_SDTIME(RTP,UPT,'UP')+ACT_SDTIME(RTP,'HOT','LO'))/8760; - DP_NON(RTP(R,V,P),UPT,TSL,'UP')$(DP_NON(RTP,UPT,TSL,'UP')$RP_DP(R,P)) = DP_NON(RTP,UPT,TSL,'UP')-DP_NON(RTP,UPT,TSL,'LO'); - DP_NON(RTP,'COLD',TSL,'UP') = 0; -*------------------------------------ -* Partial loss processing - ACT_SDTIME(RTP(R,V,P),UPT,BD)$(NOT RP_UPT(R,P,UPT,BD)) = 0; - DP_PSUD(RTP,UPT,BDNEQ(BD))$((ACT_SDTIME(RTP,UPT,BD)>0)$ACT_SDTIME(RTP,UPT,BD)) = ACT_MINLD(RTP)/ACT_SDTIME(RTP,UPT,BD); - ACT_LOSSD(RTP,UPT,BD)$(ACT_MINLD(RTP)$DP_PSUD(RTP,UPT,BD)<=DP_PSUD(RTP,UPT,BD)) = 0; - OPTION CLEAR=TRACKP,DP_LOSDORD(sl)), - v_u(ups,r,v,t,p,sl,'LO')$(MOD(RS_HR(r,s)-RS_HR(r,sl)-DP_NON(r,v,p,upt,tsl,'LO')+(G_YRFR(r,sl)/4+G_YRFR(r,s))/RS_STGPRD(r,s)+2/JS_CCL(r,js),1/JS_CCL(r,js)) cplex.op2"; -$ if exist xpress.opt execute "cat xpress.opt indic.txt > xpress.op2"; - ); -*----------------------------------------------------------------------------- - - eq_sdind_1(rtp_vintyr(%R_V_T%,p),tsl,ts(s--rs_stg(r,s)),ips,L)$(ts_group(r,tsl,s)$DP_UNS(r,v,t,p,tsl,ips,l)).. - - var_onind(r,v,t,p,ts,l)*EPS + - (var_on(r,v,t,p,ts)-sum(rs_below1(r,sl,s)$prc_ts(r,p,s),var_ups(r,v,t,p,sl,'FX')-CAPUPS) - ((CAPUPS)+var_ups(r,v,t,p,ts,'LO')+var_ups(r,v,t,p,s,'UP')))$L(ips) + - ((var_on(r,v,t,p,ts) - var_gap(r,v,t,p,ts)$(NOT PRC_TSL(r,p,tsl)) - MAX(DP_UNS(r,v,t,p,tsl,ips,l),NCAP_SEMI(r,v,p)$PRC_TSL(r,p,tsl)/2))$ips(L) + - (var_ups(r,v,t,p,ts,'UP') + var_ups(r,v,t,p,ts,'LO') - MAX(DP_UNS(r,v,t,p,tsl,ips,l),NCAP_SEMI(r,v,p)$PRC_TSL(r,p,tsl)/2))$diag('FX',L) + - (%CAPON%-var_on(r,v,t,p,ts) - DP_UNS(r,v,t,p,tsl,ips,l))$diag('LO',L) + - (var_gap(r,v,t,p,ts) - DP_UNS(r,v,t,p,tsl,ips,l))$diag('UP',L))$io(ips) =G= 0; - -*----------------------------------------------------------------------------- - - eq_sdind_0(rtp_vintyr(%R_V_T%,p),tsl,ts(s--rs_stg(r,s)),ips,l)$(ts_group(r,tsl,s)$DP_UNS(r,v,t,p,tsl,ips,l)).. - - (var_on(r,v,t,p,ts)+sum(rs_below1(r,sl,s),var_gap(r,v,t,p,sl)+var_ups(r,v,t,p,ts,'UP'))$prc_ts(r,p,s))$L(ips) + - ((var_on(r,v,t,p,ts) - var_gap(r,v,t,p,ts)$(NOT PRC_TSL(r,p,tsl)) + var_ups(r,v,t,p,ts,'UP'))$ips(L) + - (var_ups(r,v,t,p,ts,'UP') + var_ups(r,v,t,p,ts,'LO'))$diag('FX',L) + - (%CAPON%-var_on(r,v,t,p,ts)+var_ups(r,v,t,p,ts,'LO'))$diag('LO',L) + - (var_gap(r,v,t,p,ts))$diag('UP',L))$io(ips) =L= 0; diff --git a/source/eqmacro.tm b/source/eqmacro.tm deleted file mode 100644 index 7173875..0000000 --- a/source/eqmacro.tm +++ /dev/null @@ -1,137 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Utility Production Function, the Objective Function * -*=============================================================================* - -EQ_UTIL .. - - SUM((R,T), TM_DFACT(R,T) * TM_PWT(T) * LOG(VAR_C(R,T))) - - =E= - - VAR_UTIL * MAX(1,LOG(TM_SCALE_UTIL*1000))/1000; - ; - - -*=============================================================================* -* Production Constraint -*=============================================================================* - -EQ_CONSO(R,T) .. - - VAR_C(R,T) =L= - - (TM_AKL(R) * (VAR_K(R,T) ** (TM_KPVS(R)*TM_RHO(R))) * TM_L(R,T) ** ((1-TM_KPVS(R)) * TM_RHO(R)) + - - SUM(DEM(R,C), TM_B(R,C) * VAR_D(R,T,C) ** TM_RHO(R))) ** (1 / TM_RHO(R)) - VAR_INV(R,T) - VAR_EC(R,T); - - -*=============================================================================* -* Demand Coupling Equation * -* A demand relation is generated for each demand sector DM and ensures that * -* the end-use energy output from the demand devices which have output to DM * -* is greater than or equal to the end-use demand specified by the user. * -*=============================================================================* - -EQ_DD(R,T,C)$DEM(R,C) .. - - VAR_DEM(R,T,C) - - =E= - - ((1/TM_SCALE_NRG) * (TM_AEEIFAC(R,T,C) * VAR_D(R,T,C) + TM_ADDER(R,T,C) + VAR_SP(R,T,C)))$(COM_PROJ(R,T,C) GT 0) - ; - -*=============================================================================* -* Capital Dynamics Equation * -*=============================================================================* - -EQ_MCAP(R,T+1) .. - - VAR_K(R,T+1) - - =E= - - VAR_K(R,T) * TM_TSRV(R,T) + (D(T+1)*VAR_INV(R,T+1) + TM_TSRV(R,T)*D(T)*VAR_INV(R,T))/2 - ; - -*=============================================================================* -* Terminal Condition for investment in last period * -*=============================================================================* - -EQ_TMC(R,T)$(ORD(T) = CARD(T)) .. - - VAR_K(R,T) * (TM_GROWV(R,T) + TM_DEPR(R))/100 - - =L= - - VAR_INV(R,T) - ; - -*=============================================================================* -* Bound on Sum of Investment and Energy * -*=============================================================================* -EQ_IVECBND(R,T)$(ORD(T) GT 1) .. - - VAR_INV(R,T) + VAR_EC(R,T) - - =L= - - TM_Y0(R) * TM_L(R,T) ** TM_IVETOL(R); - - -*=============================================================================* -* Energy System Costs -*=============================================================================* - -* Calculate annualized undiscounted investment costs - TM_CSTINV(R,V,P)$RTP(R,V,P) - = - SUM(OBJ_ICUR(R,V,P,CUR), COEF_OBINV(R,V,P,CUR)); - - -EQ_ESCOST(R,T) .. - - TM_SCALE_CST * ( - - VAR_OBJCOST(R,T) - + - -* quadratic market penetration curve - (SUM(RTP(R,T,P)$TM_CAPTB(R,P), - 0.5 * TM_QFAC(R) * - TM_CSTINV(R,T,P) * (TM_CAPTB(R,P) / TM_EXPF(R,T) * SUM(XCP(J),VAR_XCAPP(R,T,P,J)*ORD(J)))) - )$(TM_QFAC(R) NE 0)) - -* add initial amortization (from CSA only) - + TM_AMP(R,T) - - =E= - - VAR_EC(R,T); - -*=============================================================================* -* Variable definition for market penetration cost penalty function * -*=============================================================================* -EQ_MPEN(RTP(R,TT(T+1),P))$((TM_QFAC(R) NE 0)$TM_CSTINV(R,TT,P)$TM_CAPTB(R,P)) .. - - VAR_CAP(R,TT,P) - =L= - TM_EXPF(R,T) * VAR_CAP(R,T,P) + VAR_XCAP(R,TT,P); - -*=============================================================================* -* Market Penetration Cost Penalty Function, Quadratic Approximation * -*=============================================================================* - -EQ_XCAPDB(RTP(R,TT(T+1),P))$((TM_QFAC(R) NE 0)$TM_CSTINV(R,TT,P)$TM_CAPTB(R,P)) .. - - VAR_XCAP(R,TT,P) - - =E= - - SUM(XCP(J),VAR_XCAPP(R,TT,P,J)) - ; - diff --git a/source/eqmain.mod b/source/eqmain.mod deleted file mode 100644 index 1a3c28e..0000000 --- a/source/eqmain.mod +++ /dev/null @@ -1,254 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQMAIN.MOD declarations & call for actual equations * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -*GaG Questions/Comments: -* - any non-binding (=N=) accounting equations, or do it all with reports? -* - what about scaling (by region)??? -* - declare all equations so that re-start changing models will work -* - if UP then EQl_ is =L=, LO then EQl_ is =G=, FX then EQl_ is =E= -*----------------------------------------------------------------------------- -* Scaling constants -$IF NOT SET CUFSCAL $SETGLOBAL CUFSCAL 10 -$IF NOT SET CUCSCAL $SETGLOBAL CUCSCAL 1000 - -*----------------------------------------------------------------------------- -* EQUATIONS -*----------------------------------------------------------------------------- -$ BATINCLUDE eqdeclr.%1 %1 -$ IFI %VDA%==YES $BATINCLUDE equ_ext.vda DECLR -*----------------------------------------------------------------------------- -* Objective Function -*----------------------------------------------------------------------------- -* Main OBJ - PARAMETER SUM_OBJ(ITEM,ITEM) 'Objective component summation'; - -$IFI '%SPINES%'==YES $BATINCLUDE recurrin.stc SPINES -$IF '%STAGES%'==YES $%WITSPINE% %SW_STVARS% - -$IFI NOT %OBJ%==LIN $SETLOCAL OBJ %1 -$IFI NOT %MACRO%==YES $BATINCLUDE eqobj.%1 %1 -$IFI %MACRO% ==YES $BATINCLUDE eqobj.tm %1 -* -$IFI '%SPINES%'==YES $%EWISPINE% -*----------------------------------------------------------------------------- -* Relationship between process activity & individual primary commodity flows -*----------------------------------------------------------------------------- -$ BATINCLUDE eqactflo.%1 - -*----------------------------------------------------------------------------- -* Bound of vintage process activity or TS-level above PRC_TS -*----------------------------------------------------------------------------- -*V0.5b 980902 - avoid equations if LO=0/UP=INF -$ BATINCLUDE eqactbnd.%1 G LO "(ACT_BND(R,T,P,S,'LO') NE 0)" -$ BATINCLUDE eqactbnd.%1 E FX YES -$ BATINCLUDE eqactbnd.%1 L UP "(ACT_BND(R,T,P,S,'UP') NE INF)" - -*----------------------------------------------------------------------------- -* Bound on commodity Net/Production activity above COM_TS -*----------------------------------------------------------------------------- -$ BATINCLUDE eqbndcom.%1 G LO "(COM_BNDNET(R,T,C,S,'LO') NE 0)" NET -$ BATINCLUDE eqbndcom.%1 E FX YES NET -$ BATINCLUDE eqbndcom.%1 L UP "(COM_BNDNET(R,T,C,S,'UP') NE INF)" NET -$ BATINCLUDE eqbndcom.%1 G LO "(COM_BNDPRD(R,T,C,S,'LO') NE 0)" PRD -$ BATINCLUDE eqbndcom.%1 E FX YES PRD -$ BATINCLUDE eqbndcom.%1 L UP "(COM_BNDPRD(R,T,C,S,'UP') NE INF)" PRD - -*----------------------------------------------------------------------------- -* Utilization equation ensure activity <= or = capacity -*----------------------------------------------------------------------------- -$ BATINCLUDE eqcapact.%1 E FX %MX% -$ BATINCLUDE eqcapact.%1 L UP %MX% -$ BATINCLUDE eqcapact.%1 G LO -$IF DEFINED PRC_SIMV $INCLUDE coef_csv.mod - -*----------------------------------------------------------------------------- -* Capacity transfer constraint -*----------------------------------------------------------------------------- -$IFI '%SPINES%'==YES $%WITSPINE% -$IF '%VALIDATE%'==YES $GOTO M2T -$IFI %ETL% == YES RTP_VARP(RTP(R,T,P))$TEG(P) = YES; -$IFI %MACRO%==YES RTP_VARP(RTP(R,T,P))$((TM_QFAC(R) NE 0)$TM_CAPTB(R,P)) = YES; -$ BATINCLUDE eqcpt.%1 E E "RTP_VARP(R,T,P) OR YES$CAP_BND(R,T,P,'FX')" "%VAR%_CAP(R,T,P %SOW%)" -$ BATINCLUDE eqcpt.%1 L L "((NOT RTP_VARP(R,T,P))$CAP_BND(R,T,P,'LO'))" "CAP_BND(R,T,P,'LO')" -$ BATINCLUDE eqcpt.%1 G G "((NOT RTP_VARP(R,T,P))$CAP_BND(R,T,P,'UP'))" "CAP_BND(R,T,P,'UP')" -$GOTO NOM2T -$LABEL M2T -$ BATINCLUDE eqcpt.%1 E E "NOT PRC_MAP(R,'DMD',P)" "%VAR%_CAP(R,T,P %SOW%)" -$ BATINCLUDE eqcpt.%1 L L "PRC_MAP(R,'DMD',P)" "%VAR%_CAP(R,T,P %SOW%)" -$ BATINCLUDE eqcpt.%1 G G NO 0 -$LABEL NOM2T - -*----------------------------------------------------------------------------- -* Cumulative Net/Production Commodity Limit -*----------------------------------------------------------------------------- -$ BATINCLUDE eqcumcom.%1 E NET -$ BATINCLUDE eqcumcom.%1 E PRD -* Cumulative process flow / activity -$ BATINCLUDE eqcumflo.%1 E -$IFI '%SPINES%'==YES $%EWISPINE% - -*----------------------------------------------------------------------------- -* Basic commodity balance equations (by type) ensuring that production >=/= consumption -*----------------------------------------------------------------------------- -$ BATINCLUDE eqcombal.%1 %1 G LO BAL -$ BATINCLUDE eqcombal.%1 %1 E FX BAL -* non-binding equation for FRERENEW/CONSRV commodities -*$ BATINCLUDE eqcombal.%1 %1 L UP BAL - -*----------------------------------------------------------------------------- -* Limiting equation when total production is to be constrained -*----------------------------------------------------------------------------- -$ BATINCLUDE eqcombal.%1 %1 E FX PRD "* RHS_COMPRD(R,T,C,S)" - -*----------------------------------------------------------------------------- -* Bound on the flow variable -*----------------------------------------------------------------------------- -$ BATINCLUDE eqflobnd.%1 G LO YES -$ BATINCLUDE eqflobnd.%1 E FX YES -$ BATINCLUDE eqflobnd.%1 L UP "(FLO_BND(R,T,P,CG,S,'UP') NE INF)" - -*----------------------------------------------------------------------------- -* Fraction of a flow within a specific time slice -*----------------------------------------------------------------------------- -$ BATINCLUDE eqflofr.%1 L "'LO'" -$ BATINCLUDE eqflofr.%1 E LNX -$ BATINCLUDE eqflofr.%1 G "'UP'" - -*----------------------------------------------------------------------------- -* Market share equation allocating commodity percentages of a group -*----------------------------------------------------------------------------- -$ BATINCLUDE eqfloshr.%1 L LO IN -$ BATINCLUDE eqfloshr.%1 E FX IN -$ BATINCLUDE eqfloshr.%1 G UP IN - -*----------------------------------------------------------------------------- -* Product share equation allocating commodity percentages of a group -*----------------------------------------------------------------------------- -$ BATINCLUDE eqfloshr.%1 L LO OUT -$ BATINCLUDE eqfloshr.%1 E FX OUT -$ BATINCLUDE eqfloshr.%1 G UP OUT - -*----------------------------------------------------------------------------- -* Process market share constraint in total commodity production -*----------------------------------------------------------------------------- -$ BATINCLUDE eqflomrk.%1 G LO -$ BATINCLUDE eqflomrk.%1 E FX -$ BATINCLUDE eqflomrk.%1 L UP - -*----------------------------------------------------------------------------- -* Inter-regional exchange -*----------------------------------------------------------------------------- -$ BATINCLUDE eqire.%1 - -*----------------------------------------------------------------------------- -* Bound on exchange between internal regions -*----------------------------------------------------------------------------- -*V0.5b 980902 - avoid equations if LO=0/UP=INF -$ BATINCLUDE eqirebnd.%1 G LO "(IRE_BND(R,T,C,S,ALL_REG,IE,'LO') NE 0)" -$ BATINCLUDE eqirebnd.%1 E FX YES -$ BATINCLUDE eqirebnd.%1 L UP "(IRE_BND(R,T,C,S,ALL_REG,IE,'UP') NE INF)" - -*----------------------------------------------------------------------------- -* Commodity peaking -*----------------------------------------------------------------------------- -$ BATINCLUDE eqpeak.%1 %1 - -*----------------------------------------------------------------------------- -* Commodity-to-commodity transformation -*----------------------------------------------------------------------------- -$ BATINCLUDE eqptrans.%1 - -*----------------------------------------------------------------------------- -* Inter-period storage -*----------------------------------------------------------------------------- -$ BATINCLUDE eqstgips.%OBJ% -$ BATINCLUDE eqstgaux.%OBJ% - -*----------------------------------------------------------------------------- -* Time-slice storage -*----------------------------------------------------------------------------- -$ BATINCLUDE eqstgtss.%1 - -*----------------------------------------------------------------------------- -* Bound on input/output flows of storage process -*----------------------------------------------------------------------------- -$ BATINCLUDE eqstgflo.%1 IN G LO 0 -$ BATINCLUDE eqstgflo.%1 IN E FX NA -$ BATINCLUDE eqstgflo.%1 IN L UP INF -$ BATINCLUDE eqstgflo.%1 OUT G LO 0 -$ BATINCLUDE eqstgflo.%1 OUT E FX NA -$ BATINCLUDE eqstgflo.%1 OUT L UP INF - -$IFI '%SPINES%'==YES $%WITSPINE% - -*--------------------------------------------------------------------- -* Bounds on undiscounted costs by region, category and currency -*--------------------------------------------------------------------- -$ BATINCLUDE eqbndcst.%1 - -*----------------------------------------------------------------------------- -* User-constraints -*----------------------------------------------------------------------------- -* Commissioning periods - SET RVPT(R,ALLYEAR,P,T); - LOOP(OBJ_2A(R,T,P)$(NOT RTP_OFF(R,T,P)),F=B(T)+NCAP_ILED(R,T,P); Z=SUM(VNT(T,TT)$(F GT E(TT)+0.5),1); - RVPT(R,T,P,T+Z) = YES); - RTP_OFF(OBJ_2A(R,T,P))$(NOT SUM(RVPT(R,T,P,TT),1)) = YES; -*----------------------------------------------------------------------------- -* Define a map for region and milestone year specific user constraints to be generated -$IF '%VAR_UC%'==YES $SETLOCAL UCBD '' SETLOCAL UCLIM ',LIM' -$IF NOT '%VAR_UC%'==YES $SETLOCAL UCBD ',BD' SETLOCAL UCLIM ',BD' - SET UC_RHSMAP(UC_N,UC_NUMBER,UC_NUMBER,REG,T,S%UCBD%); - SET UC_TMAP(YEAR,YEAR,T,SIDE,UC_DYNT); - UC_TMAP(T,TT(T-DIAG(SIDE,'RHS')),TT,SIDE,'N') = YES; - UC_TMAP(T,TT(T-DIAG(SIDE,'RHS')),MILESTONYR,SIDE,'CUMSUM')$(ORD(T) > ORD(MILESTONYR)+DIAG(SIDE,'RHS')) = YES; - UC_TMAP(T,T,T,'RHS','SYNC') = YES; - UC_TMAP(T,T,TT,'RHS','CUM+')$UC_TMAP(T,T,TT,'LHS','CUMSUM') = YES; - LOOP((UC_R_EACH(R,UC_N),T%UCLIM%)$UC_RHSRT(R,UC_N,T%UCLIM%), - IF( SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','SEVERAL',R,T,ANNUAL%UCBD%) = YES; - ELSEIF SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','SEVERAL',R,T,ANNUAL%UCBD%) = YES; - )); - LOOP((UC_R_EACH(R,UC_N),T,S%UCLIM%)$UC_RHSRTS(R,UC_N,T,S%UCLIM%), - IF( UC_TS_EACH(R,UC_N,S)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','EACH',R,T,S%UCBD%) = YES; - ELSEIF UC_TS_EACH(R,UC_N,S)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','EACH',R,T,S%UCBD%) = YES; - )); -*----------------------------------------------------------------------------- -$ BATINCLUDE equcwrap.%1 E BD '' SUM(BD$ ,1) NOT -$ BATINCLUDE equcwrap.%1 E "'FX'" ",'FX'" -$ BATINCLUDE equcwrap.%1 G "'LO'" ",'LO'" -$ BATINCLUDE equcwrap.%1 L "'UP'" ",'UP'" - -$IFI '%SPINES%'==YES $%EWISPINE% - -*----------------------------------------------------------------------------- -* Bound on total inter-regional exchange, including external+internal regions -*----------------------------------------------------------------------------- - -*V0.5b avoid equations if LO=0/UP=INF -$ BATINCLUDE eqxbnd.%1 G LO "(IRE_XBND(ALL_REG,T,C,S,IE,'LO') NE 0)" -$ BATINCLUDE eqxbnd.%1 E FX YES -$ BATINCLUDE eqxbnd.%1 L UP "(IRE_XBND(ALL_REG,T,C,S,IE,'UP') NE INF)" - -*--------------------------------------------------------------------- -*GG* V07_2 Refinery blending -* Blending constraint to a specification characteristic -*--------------------------------------------------------------------- -$ BATINCLUDE eqblnd.mod L 1 -$ BATINCLUDE eqblnd.mod G 2 -$ BATINCLUDE eqblnd.mod E 3 -$ BATINCLUDE eqblnd.mod N 4 - -*--------------------------------------------------------------------- -* MACRO equations -*--------------------------------------------------------------------- -$IF %MACRO% == YES $BATINCLUDE eqmacro.tm - -*--------------------------------------------------------------------- -* damages -*--------------------------------------------------------------------- -$IF DEFINED DAM_COST $BATINCLUDE eqdamage.%1 diff --git a/source/eqmrkcom.ier b/source/eqmrkcom.ier deleted file mode 100644 index 34fb52a..0000000 --- a/source/eqmrkcom.ier +++ /dev/null @@ -1,94 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQMRKCOM Bound on the market share of flow in the production/consumption of commodity -* %1 - mod or v# for the source code to be used -* %2 - equation declaration type -* %3 - bound type for %1 -* %4 - PRD/CON indicator -* %5 - IN/OUT indicator -*=============================================================================* -*Questions/Comments: -* -*----------------------------------------------------------------------------- -*$ONLISTING - - EQ%2_MRK%4(RTP(R,T,PRC),C,S %SWX%)$(%SWTX%TOP(R,PRC,C,'%5')*FLO_MRK%4(R,T,PRC,C,S,'%3')) .. - - FLO_MRK%4(R,T,PRC,C,S,'%3') * - -$IF '%4'=='CON' $GOTO CONS - - ( - -* production of commodity -* ----------------------- - ( -* individual flows -$ BATINCLUDE cal_fflo.mod OUT O - -*V07_1b blending flows - SUM(OPR$BLE_OPR(R,C,OPR), - RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BLE_BAL(R,T,C,OPR) * %VAR%_BLND(R,T,C,OPR %SOW%) - ) + -*V07_1b emissions due to blending operations - SUM(BLE_ENV(R,C,BLE,OPR), RS_FR(R,S,'ANNUAL') * ENV_BL(R,C,BLE,OPR,T) * %VAR%_BLND(R,T,BLE,OPR %SOW%) - ) + - -* inter-regional trade to region -$ BATINCLUDE cal_ire.mod IMP OUT IE - -* storage -$ BATINCLUDE cal_stgn.mod OUT IN '*STG_EFF(R,V,P)' '' "(NOT PRC_NSTTS(R,P,TS))" - -* capacity related commodity flows -$ BATINCLUDE cal_cap.mod OUT O - - ) - ) - -$GOTO SIGN -$LABEL CONS - ( -* consumption of commodity -* ------------------------ - -* individual flows -$ BATINCLUDE cal_fflo.mod IN I - -*V07_1a blending flows - SUM(BLE_TP(R,T,BLE)$BLE_OPR(R,BLE,C), - RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * %VAR%_BLND(R,T,BLE,C %SOW%) - ) + - SUM(BLE_OPR(R,BLE,OPR)$(BLE_INP(R,BLE,C) * BLE_TP(R,T,BLE)), - RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BL_INP(R,BLE,C) + %VAR%_BLND(R,T,BLE,OPR %SOW%) - ) + - -* inter-regional trade from region -$ BATINCLUDE cal_ire.mod EXP IN IE - -* storage -$ BATINCLUDE cal_stgn.mod IN OUT '' 'STG_EFF(R,V,P)*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" - -* capacity related commodity flows -$ BATINCLUDE cal_cap.mod IN I - -* include the elasticity variables - - SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),BDSIG(BD)*%VAR%_ELAST(R,T,C,S,J,BD %SOW%)) - - ) - -$LABEL SIGN - - =%2= - - SUM(RTPCS_VARF(R,T,PRC,C,TS)$(TOP(R,PRC,C,'%5')$RP_FLO(R,PRC)), - SUM(RTP_VINTYR(R,V,T,PRC), -$ BATINCLUDE %cal_red% C COM TS PRC T - *RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) - ) - ) - ; -*$OFFLISTING diff --git a/source/eqobj.mod b/source/eqobj.mod deleted file mode 100644 index 71af4e1..0000000 --- a/source/eqobj.mod +++ /dev/null @@ -1,125 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJ the objective functions -* %1 - mod or v# for the source code to be used -*=============================================================================* -*GaG Questions/Comments: -* - V-index used in place to T for MODLYEAR -* Note: PASTYEAR always have D(V) = 1 -* - V-vintage MODLYEAR year, the point in time where the investment took place -*----------------------------------------------------------------------------- - SET K_EOH(ALLYEAR); - -* [UR] 21.06.2003: K_EOH must include pastyears, since it links to past vintages - K_EOH(EACHYEAR)$((YEARVAL(EACHYEAR) >= PYR_V1) * (YEARVAL(EACHYEAR) <= MIYR_VL)) = YES; - -* Sets for periodic costs - SET KTYAGE(LL,YEAR,LL,AGE); - LOOP(SAMEAS('1',AGE), - KTYAGE(K(LL),PERIODYR(T,Y_EOH(YEAR)),AGE+(ORD(YEAR)-ORD(LL)))$YK(YEAR,LL)=YES; - KTYAGE(K(LL),YK(PYR_S,Y_EOH(YEAR)),AGE+(ORD(YEAR)-ORD(LL)))$YK(YEAR,LL)=YES); - -* Set up summing of OBJ component variables - SUM_OBJ(OBV,ITEM) = DIAG(OBV,ITEM); - SUM_OBJ(OBV('OBJSAL'),OBV) = -1; - SUM_OBJ(R,'OBJELS') = 1$SUM(RCJ(R,C,J,BD),1); -*----------------------------------------------------------------------------- -* Cases for ILED and TLIFE/D(t); values assigned in EQOBJINV - SET OBJ_1A(R,ALLYEAR,P) //; - SET OBJ_1B(R,ALLYEAR,P) //; - SET OBJ_2A(R,ALLYEAR,P) //; - SET OBJ_2B(R,ALLYEAR,P) //; -* Salvage controls - SET OBJ_SUMS(R,ALLYEAR,P) //; - SET OBJ_SUMS3(R,ALLYEAR,P) //; - SET OBJ_SUMSI(R,ALLYEAR,P,ALLYEAR) //; -$IF DECLARED VNRET $BATINCLUDE prepret.dsc EQOBJ - -*=============================================================================== -* Investment Cost, Tax/Subsidy and Decomissioning components -*=============================================================================== -$ BATINCLUDE eqobjinv.%1 - -*=============================================================================== -* Elastic Demand costs -*=============================================================================== -$IF %TIMESED%==YES $ BATINCLUDE eqobjels.%1 - -*=============================================================================== -* Fixed O&M Cost and Tax components -*=============================================================================== -$ BATINCLUDE eqobjfix.%1 %1 - -*=============================================================================== -* Variable O&M and direct commodity related cost components -*=============================================================================== -$IFI '%OBLONG%%OBJ%'==YESALT $SET OBJ 'LIN' SET VARCOST LIN -$ BATINCLUDE eqobjvar.%1 %1 - -*=============================================================================== -* Salvage value of investment and decommissioning costs -*=============================================================================== -$ BATINCLUDE eqobsalv.%1 %1 - -*=============================================================================== -* Annualized objective formulation -*=============================================================================== -$IFI %OBJANN%==YES $BATINCLUDE eqobjann.tm - -*=============================================================================== -* Actual OBJ -*=============================================================================== -$IFI NOT %STAGES%==YES %EQ%_OBJ .. -objZ + -$IFI %STAGES% == YES %EQ%_ROBJ(REG(R)%SOW%) .. -%VAR%_UCR('OBJZ',R%SOW%) + - - SUM(RDCUR(R,CUR), - -* Investment Costs, Tax/Subsidies and Decommissioning -* Salvage value of investment and decommissioning costs -* Fixed O&M and Tax/Subsidies -* Variable O&M and direct commodity costs -* Damages - - SUM((ITEM,OBV)$SUM_OBJ(ITEM,OBV),%VAR%_OBJ(R,OBV,CUR %SOW%)*SUM_OBJ(ITEM,OBV)) - -* Elastic Demand costs -$IF %TIMESED% == YES +SUM(BD,%VAR%_OBJELS(R,BD,CUR %SOW%)*BDSIG(BD))$SUM_OBJ(R,'OBJELS') -$IFI %MICRO% == YES -%VAR%_OBJELS(R,'FX',CUR %SOW%)$SUM_OBJ(R,'OBJELS') - - ) - -* Extensions to objective function -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod obj_ext %EXTEND% - - =E= 0 -; - -*=============================================================================== -* Stochastic objective function -*=============================================================================== -$IFI NOT %STAGES% == YES $EXIT - - EQ_EXPOBJ(AUXSOW(WW)).. - (SUM(SOW, SW_PROB(SOW) * %VAR%_UC('OBJZ'%SOW%))/SW_NORM - VAS_EXPOBJ)$(NOT SW_PHASE) + - SUM(SOW,SUM(UC_N$(SUM(UC_T_SUM(UC_R_SUM(R,UC_N),T),1)$S_UCOBJ(UC_N,SOW)), - S_UCOBJ(UC_N,SOW)*%VAR%_UC(UC_N%SOW%)) - %VAR%_UC('OBJ1'%SOW%))$(SW_PHASE GT 0) + - SUM(SOW,SUM(UC_N$(SUM(UC_T_SUM(UC_R_SUM(R,UC_N),T),1)$S_UCOBJ(UC_N,WW)), - S_UCOBJ(UC_N,WW)*%VAR%_UC(UC_N%SOW%)) - %VAR%_UC('OBJ1'%SWD%))$(SW_PHASE LT 0) - - =E= 0; - - EQ_UPDEV(SOW)$SW_LAMBDA.. - %VAR%_UC('OBJZ'%SOW%) - VAS_EXPOBJ$(SW_LAMBDA GT 0) - %VAR%_UC('OBJ1'%SOW%)$(SW_LAMBDA LT 0) - =L= VAS_UPDEV(SOW)$(SW_LAMBDA GT 0) + VAS_UPDEV('1')$(SW_LAMBDA LT 0); - - %EQ%_SOBJ('N'%SOW%).. -%VAR%_UC('OBJZ'%SOW%) + SUM(R,%VAR%_UCR('OBJZ',R%SOW%)) =E= 0; - - EQ_OBJ.. - ((VAS_EXPOBJ + SW_LAMBDA * SUM(SOW, SW_PROB(SOW) * VAS_UPDEV(SOW))/SW_NORM)$(SW_LAMBDA GE 0) - - MIN(0,SW_LAMBDA)*VAS_UPDEV('1'))$(NOT SW_PHASE) + - SUM(SOW,%VAR%_UC('OBJ1'%SOW%)$(ABS(SW_PHASE) EQ 1) + %VAR%_UC('OBJZ'%SOW%)$(ABS(SW_PHASE) EQ 2)) - - =E= objZ; diff --git a/source/eqobj.tm b/source/eqobj.tm deleted file mode 100644 index 2b37f1e..0000000 --- a/source/eqobj.tm +++ /dev/null @@ -1,64 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJ the objective cost functions for Macro -* %1 - mod or v# for the source code to be used -*=============================================================================* -*GaG Questions/Comments: -*10/21 -* - V-index used in place to T for MODLYEAR -* Note: PASTYEAR always have D(V) = 1 -* - V-vintage MODLYEAR year, the point in time where the investment took place -*----------------------------------------------------------------------------- - - SET K_EOH(ALLYEAR); - -* [UR] 21.06.2003: K_EOH must include pastyears, since in eqobjfix.mod it links to past vintages - K_EOH(EACHYEAR)$((YEARVAL(EACHYEAR) >= PYR_V1) * (YEARVAL(EACHYEAR) <= MIYR_VL)) = YES; - -* Sets for periodic costs - SET KTYAGE(LL,YEAR,LL,AGE); - LOOP(SAMEAS('1',AGE),KTYAGE(K(LL),PERIODYR(T,Y_EOH(YEAR)),AGE+(ORD(YEAR)-ORD(LL)))$YK(YEAR,LL)=YES); - -* Cases for ILED and TLIFE/D(t); values assigned in EQOBJINV - SET OBJ_1A(R,ALLYEAR,P) //; - SET OBJ_1B(R,ALLYEAR,P) //; - SET OBJ_2A(R,ALLYEAR,P) //; - SET OBJ_2B(R,ALLYEAR,P) //; -* Salvage controls - SET OBJ_SUMS(R,ALLYEAR,P) //; - SET OBJ_SUMS3(R,ALLYEAR,P) //; - SET OBJ_SUMSI(R,ALLYEAR,P,ALLYEAR) //; - PARAMETER OBJ_DCEOH(REG,CUR) //; - -*=============================================================================== -* Investment Cost, Fixed Cost and Variable Cost components -*=============================================================================== -$ BATINCLUDE eqobjinv.mod tm exit -$ BATINCLUDE eqobjfix.mod tm exit -$ BATINCLUDE eqobsalv.mod tm exit -$ BATINCLUDE eqobjann.tm - -*=============================================================================== -* Elastic Demand costs: only when MLF -*=============================================================================== -$ IF %MACRO%==Yes $BATINCLUDE eqobjels.mod - -*=============================================================================== -* Actual OBJ -*=============================================================================== - EQ_OBJ(R,T) .. - - SUM(RDCUR(R,CUR), - -* Investment Costs, Fixed Costs and Variable Costs (elastic demand costs excluded) - - SUM(OBVANN,VAR_ANNCST(OBVANN,R,T,CUR)) - - ) - - =E= - - VAR_OBJCOST(R,T); diff --git a/source/eqobjann.tm b/source/eqobjann.tm deleted file mode 100644 index a9d205b..0000000 --- a/source/eqobjann.tm +++ /dev/null @@ -1,100 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJANN the objective function components for MACRO -* - Annualized costs for all components -*=============================================================================* -$IF DEFINED COEF_OBINV%1 $GOTO COEF - PARAMETER COEF_OBINV%1(R,YEAR,P,CUR) //; - PARAMETER COEF_OBFIX%1(R,YEAR,P,CUR) //; - PARAMETER COEF_CRF(R,ALLYEAR,P,CUR) //; -*------------------------------------------------------------------------------ -$IF %1==N $GOTO COEF - - SET OBVANN(OBV) / OBJINV, OBJFIX, OBJVAR /; - SUM_OBJ(OBV('OBJSAL'),OBV) = 0; - POSITIVE VARIABLES VAR_ANNCST(OBV,R,ALLYEAR,CUR); - EQUATIONS - EQ_OBJANN(OBVANN,REG,CUR) - EQ_ANNFIX(REG,ALLYEAR,CUR) - EQ_ANNINV(REG,ALLYEAR,CUR) - EQ_ANNVAR(REG,ALLYEAR,CUR); - - EQ_OBJANN(OBVANN,RDCUR(R,CUR)).. - VAR_OBJ(R,OBVANN,CUR) =E= SUM(T, OBJ_PVT(R,T,CUR) * VAR_ANNCST(OBVANN,R,T,CUR)) -$IF DEFINED VNRET - + SUM(OBJ_SUMS(R,V,P)$RVPRL(R,V,P),OBJSCC(R,V,P,CUR)*OBJ_DCEOH(R,CUR)*(VAR_NCAP(R,V,P)$T(V)+NCAP_PASTI(R,V,P)-VAR_SCAP(R,V,'0',P)))$DIAG(OBVANN,'OBJINV') - ; - -$ BATINCLUDE eqobjcst.tm - -*=============================================================================== -$LABEL COEF -* Calculate coefficients for annualized costs -* Investment costs: Commissioning years - OPTION CLEAR=OBJ_SUMSI; - FIL2(V) = B(V)-YEARVAL(V); - OBJ_SUMSI(RTP(R,V(LL),P),LL+(FIL2(V)+NCAP_ILED(R,V,P))) = YES; - -* Annualizing coefficient for investment costs over years of capacity transfer - COEF_CRF(OBJ_ICUR(R,V,P,CUR)) = - SUM(RTP_CPTYR(R,TT(V),T,P),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR)) + - SUM(OBJ_SUMSI(R,PASTMILE(V),P,K),OBJ_DISC(R,K,CUR)*(1-(1+G_DRATE(R,V,CUR))**(-NCAP_TLIFE(R,V,P)))/(1-(1/(1+G_DRATE(R,V,CUR))))); - -* Investment cost coefficient - - COEF_OBINV%1(OBJ_ICUR(R,V,P,CUR)) = (1/COEF_CRF(R,V,P,CUR))$COEF_CRF(R,V,P,CUR) * ( - -* Cases I - Investment Cost and II - Taxes/Subsidies - - SUM(OBJ_SUMII(R,V,P,LIFE,K_EOH,JOT), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_DISC(R,K,CUR) * (1-SALV_INV(R,V,P,LL)$T(V)) * - (OBJ_ICOST(R,K,P,CUR) + (OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))%2)) * - COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)) - + -* Cases III - Decommissioning - - SUM(OBJ_SUMIII(R,V,P,LL,K,Y)$OBJ_DCOST(R,V,P,CUR), - OBJ_DISC(R,Y,CUR) * COR_SALVD(R,V,P,CUR) * OBJ_DCOST(R,K,P,CUR) / OBJ_DIVIII(R,V,P)) - ); - - COEF_OBINV%1(OBJ_ICUR(R,PASTMILE(V),P,CUR))$PRC_RESID(R,'0',P) = - OBJ_CRF(R,V,P,CUR)*(OBJ_ICOST(R,V,P,CUR)+(OBJ_ITAX(R,V,P,CUR)-OBJ_ISUB(R,V,P,CUR))%2); - -*------------------------------------------------------------------------------ -* Fixed costs: Annualizing coefficient for costs over years of capacity transfer - COEF_CRF(OBJ_FCUR(R,V,P,CUR)) = SUM(RTP_CPTYR(R,V,T,P),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR)); -$IFI NOT %ANNCOST%==LEV COEF_CRF(OBJ_FCUR(R,PASTMILE(V),P,CUR)) = SUM(OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE),OBJ_LIFE(K_EOH,R,JOT,LIFE,CUR)); - -* Fixed cost coefficient - - COEF_OBFIX%1(OBJ_FCUR(R,V,P,CUR)) = (1/COEF_CRF(R,V,P,CUR))$COEF_CRF(R,V,P,CUR) * ( - -* Case IV - Fixed O&M Cost and Taxes - - SUM(OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE)$(NOT RTP_ISHPR(R,V,P)), - SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_LIFE(LL,R,JOT,LIFE,CUR) * %CAPWD% - (OBJ_FOM(R,K,P,CUR)+(OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))%2)) / OBJ_DIVIV(R,V,P)) + - - SUM(OBJ_SUMIV(K_EOH,RTP_ISHPR(R,V,P),JOT,LIFE), - SUM((INVSPRED(K_EOH,JOT,LL,K),OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))), - OBJ_DISC(R,Y_EOH,CUR) * (1+SUM(PERIODYR(T,Y_EOH),RTP_CPX(R,V,P,T))$NCAP_CPX(R,V,P)) * %CAPWD% - ( - OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + - OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1))%2 - - OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1))%2 - ) - ) / OBJ_DIVIV(R,V,P) - ) + - -* Case V - Decommissioning Surveillance - SUM(OBJ_SUMIVS(R,V,P,K,Y), OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR)) - ); - - COEF_OBFIX%1(OBJ_FCUR(R,PASTMILE(V),P,CUR))$PRC_RESID(R,'0',P) = - COEF_OBFIX%1(R,V,P,CUR) * COEF_CRF(R,V,P,CUR) / - SUM(VNT(V,T)$PRC_RESID(R,T,P),PRC_RESID(R,T,P)/NCAP_PASTI(R,V,P)*OBJ_PVT(R,T,CUR)); -*=============================================================================== - OPTION CLEAR=OBJ_SUMSI,CLEAR=COEF_CRF; \ No newline at end of file diff --git a/source/eqobjcst.tm b/source/eqobjcst.tm deleted file mode 100644 index ee85352..0000000 --- a/source/eqobjcst.tm +++ /dev/null @@ -1,63 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJCST the objective functions investment, fixed and variable costs -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Questions/Comments: -* - Supports also alternative objective formulations -*----------------------------------------------------------------------------- - -*=============================================================================== -* Generate Investment equation summing over all active indexes by region and currency -*=============================================================================== - - EQ_ANNINV(R,T,CUR)$RDCUR(R,CUR).. - - VAR_ANNCST('OBJINV',R,T,CUR) =E= - -* Revised accounting for MACRO: Calculate annualized cost from discounted -* lump-sum investments undiscounted back to the lump-sum commissioning year K - - SUM(RTP_CPTYR(R,V,T,P)$OBJ_ICUR(R,V,P,CUR), COEF_CPT(R,V,T,P) * - COEF_OBINV(R,V,P,CUR) * (VAR_NCAP(R,V,P)$TT(V)+NCAP_PASTI(R,V,P))) - ; - -*=============================================================================== -* Generate Fixed Cost equation summing over all active indexes by region and currency -*=============================================================================== - - EQ_ANNFIX(R,T,CUR)$RDCUR(R,CUR) .. - - VAR_ANNCST('OBJFIX',R,T,CUR)*OBJ_PVT(R,T,CUR) =E= - -* Revised accounting for MACRO: Calculate annualized cost from discounted -* lump-sum fixed costs undiscounted back to the lump-sum commissioning year K - -$IF DEFINED VNRET $BATINCLUDE prepret.dsc OBJFIX - - SUM(RTP_CPTYR(R,V,T,P)$COEF_OBFIX(R,V,P,CUR), COEF_CPT(R,V,T,P) * OBJ_PVT(R,T,CUR) * - COEF_OBFIX(R,V,P,CUR) * (VAR_NCAP(R,V,P)$TT(V)+NCAP_PASTI(R,V,P))) - ; - -*=============================================================================== -* Generate Variable cost equation summing over all active indexes by region and currency -*=============================================================================== - - EQ_ANNVAR(R,T,CUR)$RDCUR(R,CUR) .. - -$BATINCLUDE eqobjvar.mod mod * - - OBJ_PVT(R,T,CUR) * VAR_ANNCST('OBJVAR',R,T,CUR) - -$IF DEFINED DAM_COST - -$IF DEFINED DAM_COST $BATINCLUDE eqdamage.mod E * $EXIT -$IF NOT %TIMESED%==YES $GOTO DONELS - - - SUM((MI_DMAS(R,COM,C),BDNEQ(BD))$MI_ESUB(R,T,COM), BDSIG(BD) * - SUM(RTCS_VARC(R,T,C,S)$COM_STEP(R,C,BD), COEF_PVT(R,T) * COM_BPRICE(R,T,C,S,CUR) * - SUM(RCJ(R,C,J,BD),%VART%_ELAST(R,T,C,S,J,BD %SWS%) * MI_AGC(R,T,COM,C,J,BD)))) -$LABEL DONELS - ; diff --git a/source/eqobjels.mod b/source/eqobjels.mod deleted file mode 100644 index d88b7d8..0000000 --- a/source/eqobjels.mod +++ /dev/null @@ -1,51 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJELS the objective function flexible demand utility -*=============================================================================* -*GaG Questions/Comments: -*----------------------------------------------------------------------------- -$IFI %MICRO%==YES $BATINCLUDE pp_micro.mod NLP - - %EQ%_OBJELS(R,BD,CUR %SOW%)$(RDCUR(R,CUR)$SUM_OBJ(R,'OBJELS')).. - -*------------------------------------------------------------------------------ -* Direction with bound sign BDSIG -*------------------------------------------------------------------------------ -*V0.5b 980824 - correct ORD adjustment - SUM(RTCS_VARC(R,T,C,S)$(COM_ELAST(R,T,C,S,BD)$COM_STEP(R,C,BD)), - COEF_PVT(R,T) * COM_BPRICE(R,T,C,S,CUR) * - (SUM(RCJ(R,C,J,BD), %VART%_ELAST(R,T,C,S,J,BD %SWS%) * - (1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**(1/COM_ELAST(R,T,C,S,BD)))$(NOT COM_ELASTX(R,T,C,BD)) + -* Shaped elasticities - SUM(RTC_SHED(R,T,C,BD,JJ(AGE)), - SUM((RCJ(R,C,J,BD),SPAN(AGE+CEIL((ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD)*100-ORD(AGE)))), - (SHAPED(BD,JJ,SPAN) * - ((1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))/SHAPED(BD,'1',SPAN))**(1/MAX(1E-3,SHAPE(JJ,SPAN))) - )**(1/COM_ELAST(R,T,C,S,BD)) * %VART%_ELAST(R,T,C,S,J,BD %SWS%))) + - SUM(MI_DMAS(R,COM,C)$MI_DOPE(R,T,C),SUM(RCJ(R,C,J,BD),%VART%_ELAST(R,T,C,S,J,BD %SWS%) * MI_AGC(R,T,COM,C,J,BD))) - ) - )$BDNEQ(BD) - - -* Micro NLP formulation -$IFI NOT %MICRO%==YES $GOTO RHS - + SUM(T$(ORD(T)>1), COEF_PVT(R,T) * - SUM(DEM(R,C)$(MI_ELASP(R,T,C)$RD_NLP(R,C)), MI_CCONS(R,T,C) * - ((%VART%_DEM(R,T,C%SWS%)**MI_ELASP(R,T,C))$(RD_NLP(R,C)=1) + - ((SUM(MI_DMAS(R,C,COM),RD_SHAR(R,T,C,COM)**(1/MI_ESUB(R,T,C))*(COM_AGG(R,T,COM,C)*%VART%_DEM(R,T,COM%SWS%))**MI_RHO(R,T,C))**(1/MI_RHO(R,T,C)))**MI_ELASP(R,T,C))$(RD_NLP(R,C)>2) - - DDF_QREF(R,T,C)**MI_ELASP(R,T,C))$(RD_NLP(R,C)>0) - ))$LNX(BD) - -$LABEL RHS - =E= - %VAR%_OBJELS(R,BD,CUR %SOW%); - -*------------------------------------------------------------------------------ - -* Step bounds for linear CES demand functions - %EQ%L_COMCES(RTC(R,T,COM),C,S%SWT%)$(RTCS_VARC(R,T,C,S)$MI_DOPE(R,T,C)$MI_DMAS(R,COM,C)).. - SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),%VAR%_ELAST(R,T,C,S,J,BD%SOW%)*COM_STEP(R,C,BD)/ORD(J)/(DDF_QREF(R,T,C)*COM_FR%MX%(R,T,C,S)*COM_VOC(R,T,C,BD))) - =L= %VAR%_COMPRD(R,T,COM,'ANNUAL'%SOW%)/DDF_QREF(R,T,COM); diff --git a/source/eqobjels.rpt b/source/eqobjels.rpt deleted file mode 100644 index ec66c51..0000000 --- a/source/eqobjels.rpt +++ /dev/null @@ -1,37 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJELS the objective function flexible demand costs reporting -*=============================================================================* -* %1 - assigned parameter(..%2..) -* %2 - year index (Y_EOH/TT) -* %3 - mult or '' -*----------------------------------------------------------------------------- -*V0.5a 980729 control the inner sums according to the years in the periods - - %1$SUM(RCJ(R,C,'1',BDNEQ),1) = %3 - - SUM((RDCUR(R,CUR),BDNEQ(BD)), BDSIG(BD) * -*V0.5b 980824 - correct ORD adjustment - SUM((PERIODYR(T,%2),COM_TS(R,C,S))$COM_ELAST(R,T,C,S,BD), COM_BPRICE(R,T,C,S,CUR) * - (SUM(RCJ(R,C,J,BD), VAR_ELAST.L(R,T,C,S,J,BD) * - ((1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**(1/COM_ELAST(R,T,C,S,BD))))$(NOT COM_ELASTX(R,T,C,BD)) + - SUM(RTC_SHED(R,T,C,BD,JJ(AGE)), - SUM((RCJ(R,C,J,BD),SPAN(AGE+CEIL((ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD)*100-ORD(AGE)))), - (SHAPED(BD,JJ,SPAN) * - ((1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))/SHAPED(BD,'1',SPAN))**(1/MAX(1E-3,SHAPE(JJ,SPAN))) - )**(1/COM_ELAST(R,T,C,S,BD)) * VAR_ELAST.L(R,T,C,S,J,BD))) -$IF DEFINED MI_AGC +SUM(MI_DMAS(R,COM,C)$MI_DOPE(R,T,C),SUM(RCJ(R,C,J,BD),VAR_ELAST.L(R,T,C,S,J,BD)*MI_AGC(R,T,COM,C,J,BD))) - )) - ); -$IFI NOT %MICRO%==YES $EXIT -* NLP utility loss - %1$RD_NLP(R,C) = %3 - SUM(RDCUR(R,CUR), - SUM((PERIODYR(T,%2),COM_TS(R,C,S))$(COM_BPRICE(R,T,C,S,CUR)$MI_ELASP(R,T,C)), -COM_FR(R,T,C,S) * MI_CCONS(R,T,C) * - ((VAR_DEM.L(R,T,C)**MI_ELASP(R,T,C))$(RD_NLP(R,C)=1) + - ((SUM(MI_DMAS(R,C,COM),RD_SHAR(R,T,C,COM)**(1/MI_ESUB(R,T,C))*(COM_AGG(R,T,COM,C)*VAR_DEM.L(R,T,COM))**MI_RHO(R,T,C))**(1/MI_RHO(R,T,C)))**MI_ELASP(R,T,C))$(RD_NLP(R,C)>2) - - DDF_QREF(R,T,C)**MI_ELASP(R,T,C))$(RD_NLP(R,C)>0)) - ); \ No newline at end of file diff --git a/source/eqobjfix.mod b/source/eqobjfix.mod deleted file mode 100644 index ad9a538..0000000 --- a/source/eqobjfix.mod +++ /dev/null @@ -1,227 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJFIX the objective functions capacity fixed costs -* %1 - mod or v# for the source code to be used -* - fixed O&M, including surveillance during decommissioning -* - tax -*=============================================================================* -*GaG Questions/Comments: -* - Note that V=T in OBJ.DOC, but in the code V is assocated with the vintage year, -* that is the of investment as distinguished from T = the current MILESTONYR. -* - Combining all the Fix into a single equation at the moment -* - the test for relevant costs is done on the year of installation, perhaps should be Y-running year -* - COEF_RPTI calculated in PPMAIN.MOD -*----------------------------------------------------------------------------- -* For loop controls - SET OBJ_FCUR(REG,ALLYEAR,P,CUR) //; -* OBJ coefficient SUM control set with the 3 ALLYEAR indexes in sequence = -* Y-running OBJ year, V-variables' investment period, K-cost value counter & index - SET OBJ_SUMIV(ALLYEAR,R,ALLYEAR,P,AGE,AGE) //; - SET OBJ_SUMIVS(R,ALLYEAR,P,ALLYEAR,ALLYEAR) //; -* Shaping controls - SET RTP_SHAPE(REG,ALLYEAR,PRC,J,J,J) //; -* Fixed cost year span divisor - PARAMETER OBJ_DIVIV(REG,ALLYEAR,PRC) //; -* Present value factor of technical life - PARAMETER OBJ_LIFE(ALLYEAR,REG,AGE,AGE,CUR) //; - -*UR: 09/30/01 -* if some relevant cost - OBJ_FCUR(RTP(R,V,P),CUR)$(OBJ_FOM(R,V,P,CUR)+OBJ_FTX(R,V,P,CUR)+OBJ_FSB(R,V,P,CUR)) = YES; -* Decommissioning - OBJ_FCUR(RTP(R,V,P),CUR)$OBJ_DLAGC(R,V,P,CUR) = YES; - OPTION OBJ_YES < OBJ_FCUR; - OBJ_YES(RTP_OFF(R,T,P))$(NOT NCAP_PASTI(R,T,P)) = NO; - -* Set up the rounded lifetimes; round half years down: - OBJ_DIVIV(OBJ_YES(R,V,P)) = MAX(1,MIN(CARD(AGE),CEIL(NCAP_TLIFE(R,V,P)-0.5))); - OBJ_DIVIV(OBJ_YES(R,PYR_S(V),P))$PRC_RESID(R,'0',P)=MAX(2,SMAX(T$(PRC_RESID(R,T,P)>0),E(T))-MIYR_V1+2); -*====================================================================================== -* Apply SHAPE to OBJ_YES: -*-------------------------------------------------------------------------------------- -OPTION CLEAR=RTP_SHAPE; -LOOP(SAMEAS(J,'1'), - RTP_SHAPE(OBJ_YES(RTP),'1',J+MAX(0,NCAP_FOMX(RTP)-1),J+MAX(0,NCAP_FOMM(RTP)-1))$(NCAP_FOMX(RTP)+NCAP_FOMM(RTP)+NCAP_CPX(RTP)) = YES; - RTP_SHAPE(OBJ_YES(RTP),'2',J+MAX(0,NCAP_FTAXX(RTP)-1),J+MAX(0,NCAP_FTAXM(RTP)-1))$(NCAP_FTAXX(RTP)+NCAP_FTAXM(RTP)) = YES; - RTP_SHAPE(OBJ_YES(RTP),'3',J+MAX(0,NCAP_FSUBX(RTP)-1),J+MAX(0,NCAP_FSUBM(RTP)-1))$(NCAP_FSUBX(RTP)+NCAP_FSUBM(RTP)) = YES; -); - OPTION RTP_ISHPR < RTP_SHAPE; - RTP_SHAPE(RTP_SHAPE(RTP,J,'1','1'))$(NOT NCAP_CPX(RTP)) = NO; -$IF '%VALIDATE%' == YES RTP_ISHPR(RTP) = YES; -*===================================================================================== -$ SET ZHALF "CEIL(Z/2-.5)" SET ISTEP IPD(T) -$ IF NOT '%CTST%'=='' $SET ISTEP "MIN(IPD(T),ROUND(Z))" SET ZHALF FLOOR(ROUND(Z)/2) - -*=============================================================================== -* Case IV/V.1.a: Fixed O&M/Tax ILEDt <= ILEDmin,t and TLIFEt + ILEDt >= D(t) -*=============================================================================== - LOOP(SAMEAS(AGE,'1'), -* [AL] 05/08/2003: small further speed-up - -$IF '%VALIDATE%' == 'YES' $GOTO M2T -* Set period parameters for Case 1a: - FIL2(V) = (IPD(V)-1)$T(V); - MY_ARRAY(V) = B(V)-YEARVAL(V) + (M(V)-B(V)-FIL2(V))$T(V); -* The first commissioning year is LL+MY_ARRAY(LL) and the spread is AGE+FIL2(V) - OBJ_SUMIV(LL+MY_ARRAY(LL),OBJ_1A(OBJ_YES(R,V(LL),P)),AGE+FIL2(V),AGE+(OBJ_DIVIV(R,V,P)-1)) = YES; - -$GOTO CONT -$LABEL M2T -* create square for investment costing if validating MARKAL - MY_ARRAY(V) = MAX(MIYR_V1,B(V))-YEARVAL(V); - OBJ_SUMIV(LL+MY_ARRAY(LL),OBJ_1A(OBJ_YES(R,V(LL),P)),AGE+(NCAP_ELIFE(R,V,P)-1),'1') = YES; - -$LABEL CONT - ); - -*=============================================================================== -* Case IV/V.1.b: Fixed O&M/Tax ILEDt <= ILEDmin,t and TLIFEt + ILEDt < D(t) -*=============================================================================== -* if some relevant cost - LOOP(SAMEAS(AGE,'1'), -$IF '%VALIDATE%'==YES $GOTO M2T_2 - LOOP(OBJ_1B(OBJ_YES(R,T(LL),P)), - Z = NCAP_TLIFE(R,T,P); -* Slightly different handling according to objective formulation - IF((ROUND(Z)-IPD(T)%CTST%) LE 0, MY_F = OBJ_DIVIV(R,T,P)-1; - F = B(T) - %ZHALF% - YEARVAL(T); - Z = ROUND(COEF_RPTI(R,T,P)*Z)-1; -* The first commissioning year is LL+F and the spread is AGE+Z - OBJ_SUMIV(LL+F,R,T,P,AGE+Z,AGE+MY_F) = YES; - ELSE CNT = %ISTEP%; OBJ_D = CNT-1; MY_F = B(T)-YEARVAL(T)-FLOOR(CNT/2); - FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), - F = MY_F; MY_F = F+Z; CNT = ROUND(MY_F)-ROUND(F)-1; - OBJ_SUMIV(LL+F,R,T,P,AGE+OBJ_D,AGE+CNT) = YES)); - ); - -* create square for investment costing if validating MARKAL -$LABEL M2T_2 -$IF '%VALIDATE%'==YES - OBJ_SUMIV(LL+MY_ARRAY(LL),OBJ_1B(OBJ_YES(R,T(LL),P)),AGE+(COEF_RPTI(R,T,P)*NCAP_ELIFE(R,T,P)-1),'1') = YES; - - ); -*=============================================================================== -* Case IV/V.2.a: Fixed O&M/Tax ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) -*=============================================================================== -* if some relevant cost -*V05c 981007 - treat PAST == MILE except take cost from decision/capacity installed - LOOP(SAMEAS(AGE,'1'), -* The commissioning year is B(V)+ILED for both MILESTONYR and PASTMILE, spread is '1' - OBJ_SUMIV(LL+(B(LL)+NCAP_ILED(R,LL,P)-YEARVAL(LL)),OBJ_YES(OBJ_2A(R,V(LL),P)),'1',AGE+(OBJ_DIVIV(R,LL,P)-1)) = YES; - ); -*----------------------------------------------------------------------------- -* Case IV.2.a: Surveillance ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) -*----------------------------------------------------------------------------- -* if some relevant cost - LOOP((OBJ_2A(R,V(LL),P),CUR)$OBJ_DLAGC(R,V,P,CUR), - MY_F = B(V) + NCAP_ILED(R,V,P); - F = ROUND(MY_F + NCAP_TLIFE(R,V,P)); Z = F + NCAP_DLAG(R,V,P); MY_F = MY_F-YEARVAL(V); - OBJ_SUMIVS(R,V,P,LL+MY_F,Y)$((YEARVAL(Y) >= F) AND (YEARVAL(Y) < Z)) = YES; - ); - -*=============================================================================== -* Case IV/V.2.b: Fixed O&M/Tax ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) -*=============================================================================== -* determine the number of repeated investments, if some relevant cost - LOOP(SAMEAS(AGE,'1'), - LOOP(OBJ_2B(OBJ_YES(R,T(LL),P)), - Z = NCAP_TLIFE(R,T,P); MY_F = ROUND(B(T)+NCAP_ILED(R,T,P))-YEARVAL(T); - FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), -* The commissioning year is LL+F and the spread is 1 - F = MY_F; MY_F = F+Z; CNT = ROUND(MY_F)-ROUND(F)-1; - OBJ_SUMIV(LL+F,R,T,P,'1',AGE+CNT) = YES; - ); - ); - ); -*----------------------------------------------------------------------------- -* Case IV.2.b: Surveillance ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) -*----------------------------------------------------------------------------- -* determine the number of repeated investments, if some relevant cost - LOOP((OBJ_2B(R,T(LL),P),CUR)$OBJ_DLAGC(R,T,P,CUR), - FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), - MY_F = B(T) + NCAP_ILED(R,T,P) + (OBJ_C-1) * NCAP_TLIFE(R,T,P); - F = ROUND(MY_F + NCAP_TLIFE(R,T,P)); Z = F + NCAP_DLAG(R,T,P); MY_F = MY_F-YEARVAL(T); - OBJ_SUMIVS(R,T,P,LL+MY_F,Y)$((YEARVAL(Y) >= F) AND (YEARVAL(Y) < Z)) = YES; - ); - ); - -*------------------------------------------------------------------------------ -* forget about PASTINV charges if not PASTInvestment -*------------------------------------------------------------------------------ - OBJ_SUMIV(OBJ_SUMIV(K_EOH,R,PASTMILE,P,JOT,AGE))$(NOT NCAP_PASTI(R,PASTMILE,P)) = NO; - OBJ_SUMIVS(OBJ_SUMIVS(R,PASTMILE,P,K,Y))$(NOT NCAP_PASTI(R,PASTMILE,P)) = NO; -*-----------------------------------------------------------------------------* -* precalculation of the PVF sum for the simple case is usually efficient - LOOP((OBJ_SUMIV(K,R,V,P,JOT,LIFE),RDCUR(R,CUR)),OBJ_LIFE(K,R,JOT,LIFE,CUR) = YES); - OPTION KAGE <= OBJ_LIFE; - INVSTEP(KAGE(LL,JOT),LL+(ORD(AGE)-1),AGE+(ORD(JOT)-ORD(AGE)))$OPYEAR(JOT,AGE) = YES; - LOOP(KAGE(K,JOT),OBJ_LIFE(LL,R,JOT,LIFE,CUR)$INVSTEP(K,JOT,LL,JOT) $= OBJ_LIFE(K,R,JOT,LIFE,CUR)); - OBJ_LIFE(K(LL),R,JOT,LIFE,CUR)$OBJ_LIFE(K,R,JOT,LIFE,CUR) = SUM((OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))),OBJ_DISC(R,Y_EOH,CUR)); -* Commissioning years -$IFI NOT '%CTST%'=='' $BATINCLUDE coef_alt.lin FIX * - INVSPRED(KAGE(LL,JOT),K,K)$INVSTEP(LL,JOT,K,JOT) = YES; -*-----------------------------------------------------------------------------* -* Reset OBJ_DIVIV to be the year divisor in the equation -* Only single commissioning year B(V)+ILED is taken for PASTMILE -$IFI NOT '%CTST%'=='' $GOTO EQUA - OBJ_DIVIV(OBJ_YES(R,PASTMILE,P)) = 1; - OBJ_DIVIV(OBJ_YES(R,T,P))$(NOT OBJ_1B(R,T,P)) = 1+(IPD(T)-1)$OBJ_1A(R,T,P); - IF(ALTOBJ, OBJ_DIVIV(OBJ_1B(OBJ_YES(R,T,P)))$((ROUND(NCAP_TLIFE(R,T,P))-IPD(T)%CTST%) GT 0) = IPD(T)); -$IFI '%VALIDATE%'==YES OBJ_DIVIV(OBJ_YES(R,T,P)) = 1; -*-----------------------------------------------------------------------------* - OPTION CLEAR=OBJ_YES, CLEAR=YKAGE; - - -$LABEL EQUA %2 -*=============================================================================== -* Generate Fixed Cost equation summing over all active indexes by region and currency -*=============================================================================== - %EQ%_OBJFIX(RDCUR(R,CUR) %SOW%) .. - -*------------------------------------------------------------------------------ -* Cases IV - Fixed O&M including surveillance during decommissioning, V - Taxes -*------------------------------------------------------------------------------ -* Fixed O&M Cost and Taxes - - SUM(OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE)$(NOT RTP_ISHPR(R,V,P)), - SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_LIFE(LL,R,JOT,LIFE,CUR) * %CAPWD% - (OBJ_FOM(R,K,P,CUR)+OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) / OBJ_DIVIV(R,V,P)) + - - SUM(OBJ_SUMIV(K_EOH,RTP_ISHPR(R,V,P),JOT,LIFE), - SUM((INVSPRED(K_EOH,JOT,LL,K),OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))), - OBJ_DISC(R,Y_EOH,CUR) * (1+SUM(PERIODYR(T,Y_EOH),RTP_CPX(R,V,P,T))$NCAP_CPX(R,V,P)) * %CAPWD% - ( - OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + - OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - - OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - ) - -* [UR] 07.10.2003: for validating MARKAL using VAR_CAP instead of VAR_NCAP+NCAP_PASTI, since it is possible -* in MARKAL to decommission capacity of demand devices (DMD) -$IF %VALIDATE% == 'YES' - *((SUM(PERIODYR(T(V),Y_EOH),%VART%_CAP(R,T,P %SWS%)))$(OBJ_1A(R,V,P)+OBJ_1B(R,V,P))+ -$IF %VALIDATE% == 'YES' (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))$(OBJ_2A(R,V,P)+OBJ_2B(R,V,P))) - - ) -$IF NOT %VALIDATE% == 'YES' - * (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) / OBJ_DIVIV(R,V,P) - ) + - -$IF DEFINED VNRET $BATINCLUDE prepret.dsc OBJFIX - -* Decommissioning Surveillance - SUM(OBJ_SUMIVS(R,V,P,K,Y), - OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * -* Case 2.a-b - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + (NCAP_PASTI(R,V,P)$PASTYEAR(V))$OBJ_2A(R,V,P)) - ) - - =E= - - SUM(OBV,SUM_OBJ('OBJFIX',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); - -* Clears in INITCLR.MOD diff --git a/source/eqobjfix.rpt b/source/eqobjfix.rpt deleted file mode 100644 index 4e38999..0000000 --- a/source/eqobjfix.rpt +++ /dev/null @@ -1,60 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJFIX the objective functions capacity fixed costs -* %1 - mod or v# for the source code to be used -* - fixed O&M, including surveillance during decommissioning -* - fixed taxes and subsidies -*=============================================================================* - -*------------------------------------------------------------------------------ -* Cases IV - Fixed O&M including surveillance during decommissioning, V - Taxes -*------------------------------------------------------------------------------ -* Fixed O&M Cost and Taxes - - LOOP(OBJ_FCUR(NCAP_YES(R,V,P),CUR), - -$IF NOT %VALIDATE% == 'YES' - F = (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) / OBJ_DIVIV(R,V,P); - -* [UR] 07.10.2003: for validating MARKAL using VAR_CAP instead of VAR_NCAP+NCAP_PASTI, since it is possible -* in MARKAL to decommission capacity of demand devices (DMD) -$IF %VALIDATE% == 'YES' F = VAR_CAP.L(R,V,P)$(T(V)$(OBJ_1A(R,V,P)+OBJ_1B(R,V,P)))+F$(OBJ_2A(R,V,P)+OBJ_2B(R,V,P)); - -*------------------------------------------------------------------------------- - OPTION CLEAR=YKAGE; - LOOP((OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE),INVSTEP(K_EOH,JOT,LL,JOT)),YKAGE(Y_EOH(LL+(ORD(AGE)-1)),LL,AGE)$OPYEAR(LIFE,AGE) = YES;); -*------------------------------------------------------------------------------- - - IF(RTP_ISHPR(R,V,P), - PAR_OBJFIX(R,V,Y_EOH,P,CUR) = - OBJ_DISC(R,Y_EOH,CUR) * F * (1+SUM(PERIODYR(T,Y_EOH),RTP_CPX(R,V,P,T))$NCAP_CPX(R,V,P)) * - SUM(YKAGE(Y_EOH,K,AGE), - ( - OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + - OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - - OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - ) -$IF %VALIDATE% == 'YES' - $(PERIODYR(V,Y_EOH)*T(V)+OBJ_2A(R,V,P)+OBJ_2B(R,V,P)) - ); - ELSE - PAR_OBJFIX(R,V,Y_EOH,P,CUR) = - OBJ_DISC(R,Y_EOH,CUR) * F * - SUM(YKAGE(Y_EOH,K,AGE), (OBJ_FOM(R,K,P,CUR)+OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))); - )); - -* Decommissioning Surveillance - LOOP(OBJ_FCUR(NCAP_YES(R,V,P),CUR)$OBJ_DLAGC(R,V,P,CUR), - OPTION YK1 < OBJ_SUMIVS; - PAR_OBJFIX(R,V,Y,P,CUR) = PAR_OBJFIX(R,V,Y,P,CUR) + - SUM(YK1(Y,K), OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * - (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))); - ); - - OBJ_C = SUM((R,V,Y,P,CUR)$PAR_OBJFIX(R,V,Y,P,CUR),PAR_OBJFIX(R,V,Y,P,CUR)); - OBJ_D = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJFIX',OBV)*VAR_OBJ.L(R,OBV,CUR))); - DISPLAY OBJ_C,OBJ_D; - diff --git a/source/eqobjinv.mod b/source/eqobjinv.mod deleted file mode 100644 index 2bd0db9..0000000 --- a/source/eqobjinv.mod +++ /dev/null @@ -1,324 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJINV the objective functions on investments -* - Investment Costs -* - Investmnet Tax/Subsidies -* - Decommissioning -*=============================================================================* -*GaG Questions/Comments: -* - Note that V=T in OBJ.DOC, but in the code V is assocated with the vintage year, -* that is the year of investment as distinguished from T = the current MILESTONYR -* - COEF_RPTI calculated in PPMAIN.MOD -* - combining all the INVs into a single equation at the moment -*----------------------------------------------------------------------------- -*$ONLISTING -* Discounting shift is zero unless the user says otherwise: -$IF NOT SET DISCSHIFT $SETGLOBAL DISCSHIFT 0 - -* If annual cost should be reported for TLIFE years and not just ELIFE, -* change INVLIF and DECLIF to TLIFE and DLIFE instead of ELIFE and DELIF -$SETGLOBAL INVLIF ELIFE -$SETGLOBAL DECLIF DELIF - -* For loop controls - ALIAS(AGE,JOT); - SCALARS OBJ_C /0/, OBJ_D /0/; -* OBJ coefficient SUM control set with the ALLYEAR indexes in sequence = -* V - investment vintage year, K - commissioning index, Y - decommissioning index - SET OBJ_SUMII(R,ALLYEAR,P,AGE,ALLYEAR,AGE) //; - SET OBJ_SUMIII(R,ALLYEAR,P,ALLYEAR,YEAR,ALLYEAR)//; - SET OBJ_YES(REG,ALLYEAR,P) //; - SET OBJ_I2(REG,ALLYEAR,P) //; - SET YKAGE(ALLYEAR,ALLYEAR,AGE) //; - SET KAGE(ALLYEAR,AGE) //; - SET OBJ_SPRED(R,ALLYEAR,P,AGE) //; - SET INVSTEP(ALLYEAR,AGE,ALLYEAR,AGE) //; - SET INVSPRED(ALLYEAR,AGE,ALLYEAR,ALLYEAR) //; - PARAMETER OBJ_PASTI(REG,ALLYEAR,P,CUR) //; - PARAMETER SALV_INV(REG,ALLYEAR,PRC,ALLYEAR) //; - PARAMETER COR_SALVI(REG,ALLYEAR,PRC,CUR) //; - PARAMETER COR_SALVD(REG,ALLYEAR,PRC,CUR) //; - PARAMETER OBJ_DIVI(REG,ALLYEAR,PRC) //; - PARAMETER OBJ_DIVIII(REG,ALLYEAR,PRC) //; - SET OBJ_IDC(R,ALLYEAR,P,LIFE,ALLYEAR,AGE); - PARAMETER OBJ_IAD(R,CUR); -*=============================================================================== -* Hold on to those RTPs for which some investment related cost is provided -*=============================================================================== -* Investment - RTP(R,PASTMILE,P)$(NCAP_PASTI(R,PASTMILE,P)=0) = NO; - OBJ_ICUR(RTP(R,V,P),CUR)$(OBJ_ICOST(R,V,P,CUR) + OBJ_ISUB(R,V,P,CUR) + OBJ_ITAX(R,V,P,CUR)) = YES; -* if ETL technology then going to do it as well -$IF '%ETL%'==YES OBJ_ICUR(RTP(R,V,TEG),CUR)$G_RCUR(R,CUR) = YES; -* Decommissioning - OBJ_ICUR(RTP(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR) = YES; - LOOP(CUR,OBJ_SUMS3(RTP(R,V,P))$OBJ_DCOST(R,V,P,CUR) = YES); - LOOP((RTP,COM)$NCAP_OCOM(RTP,COM),OBJ_SUMS3(RTP) = YES); -* Currency independent OBJ_YES - OBJ_ICUR(RTP_OFF,CUR)$(NOT NCAP_PASTI(RTP_OFF)) = NO; - OBJ_ICUR(R,LL,P,CUR)$(NOT RDCUR(R,CUR)) = NO; - OPTION OBJ_YES < OBJ_ICUR; OBJ_YES(OBJ_SUMS3) = YES; - -* Correct small TLIFE and DLIFE values, because rounded values are used as divisors - NCAP_TLIFE(OBJ_YES(R,V,P))$(ROUND(NCAP_TLIFE(R,V,P)) LE 0) = 1; - NCAP_ELIFE(OBJ_YES(R,V,P))$(ROUND(NCAP_ELIFE(R,V,P)) LE 0) = 1; - NCAP_DLIFE(OBJ_SUMS3(R,V,P))$(ROUND(NCAP_DLIFE(R,V,P)) LE 0) = 1; - NCAP_DELIF(OBJ_SUMS3(R,V,P)) = MAX(1,NCAP_DELIF(R,V,P)); -* Classify processes into I1 / I2 Cases - OBJ_I2(RTP)$NCAP_ILED(RTP) = YES; - LOOP(SAMEAS(LIFE,'1'),OBJ_SPRED(OBJ_YES(R,V,P),LIFE+MAX(0,MIN(CARD(AGE),NCAP_%INVLIF%(R,V,P))-1))=YES); -*------------------------------------------------------------------------------ -* COR_SALVI can be used to take into account technology-specific discount rate -* Take also into account a user-defined discounting shift (0/0.5/1 years): - COR_SALVI(OBJ_ICUR(R,V,P,CUR))=(((((1+NCAP_DRATE(R,V,P))/(1+OBJ_RFR(R,V,CUR)))**%DISCSHIFT%)* - ((1-1/(1+NCAP_DRATE(R,V,P)))*(1-(1+OBJ_RFR(R,V,CUR))**(-NCAP_ELIFE(R,V,P))))/ - ((1-1/(1+OBJ_RFR(R,V,CUR)))*(1-(1+NCAP_DRATE(R,V,P))**(-NCAP_ELIFE(R,V,P)))) - -1)$(NCAP_DRATE(R,V,P) GT 0) + 1)*(1+G_DRATE(R,V,CUR))**%DISCSHIFT%; - COR_SALVI(OBJ_ICUR(OBJ_I2(R,V,P),CUR)) = COR_SALVI(R,V,P,CUR) / ((1+G_DRATE(R,V,CUR))**%DISCSHIFT%); -* OBJ_CRF/OBJ_CRFD must now be based on G_DRATE because we use COR_SALVI and COR_SALVD for the correction - OBJ_CRF(OBJ_ICUR(R,V,P,CUR)) = COR_SALVI(R,V,P,CUR) * (1-(1/(1+G_DRATE(R,V,CUR)))) / (1-(1+G_DRATE(R,V,CUR))**(-ROUND(NCAP_%INVLIF%(R,V,P)))); -*------------------------------------------------------------------------------ -* OBJ_PASTI is the correction for past investments (similar to SALV_INV fraction) - OBJ_PASTI(OBJ_ICUR(RTP(R,PASTYEAR(V),P),CUR)) = NCAP_PASTI(R,V,P) * - MAX(0,MIN(1,(((1+G_DRATE(R,V,CUR))**(YEARVAL(V)+ROUND(NCAP_ILED(R,V,P))-MINYR+NCAP_%INVLIF%(R,V,P))-1) / - ((1+G_DRATE(R,V,CUR))**NCAP_%INVLIF%(R,V,P)-1)))); -*------------------------------------------------------------------------------ -* Operating years for all technical lifetimes - Z=SMAX((RTP(R,PYR_S(V),P),T)$PRC_RESID(R,T,P),E(T))-MIYR_V1+2; - MAXLIFE = MAX(SMAX(T,2*D(T)),Z,CEIL(MAXLIFE)); - OPYEAR(LIFE,AGE)$((ORD(AGE) LE ORD(LIFE))$(ORD(LIFE) LE MAXLIFE)) = YES; -*-------------------------------------------------------------------------------------- -$ SET ZHALF "CEIL(Z/2-.5)" SET ISTEP IPD(T) -$ IF NOT '%CTST%'=='' $SET ZHALF "FLOOR(ROUND(Z)/2)" SET ISTEP MIN(IPD(T),ROUND(Z)) -*=============================================================================== -* Case 1.a: ILEDt <= ILEDmin,t and TLIFEt + ILEDt >= D(t) -*=============================================================================== - OBJ_1A(RTP(R,V,P))$((NOT OBJ_I2(R,V,P))$(COEF_RPTI(R,V,P) LT 1.01)) = YES; -*------------------------------------------------------------------------------ -* build trapazoid covering year and number of payment blocks for a process -*------------------------------------------------------------------------------ -* - K is EACHYEAR -* beginning from the -* MAX(period length before the middle year of the current (investment) -* period, or the current year - the economic lifetime + 1) -* until the -* MIN(middle year of the current (investment) period - 1, or the year -* calculating) -*=============================================================================== -* Case I/II.1.a: Investment/Tax&Sub ILEDt <= ILEDmin,t and TLIFEt + ILEDt >= D(t) -*=============================================================================== -* there is a relevant cost -*V1.3a speed up code a bit -$IF '%VALIDATE%' == 'YES' $GOTO M2T - -* Set period parameters for Case 1a: - FIL2(V) = (IPD(V)-1)$T(V); - MY_ARRAY(V) = B(V)-YEARVAL(V) + (M(V)-B(V)-FIL2(V))$T(V); - LOOP(SAMEAS(AGE,'1'), -* K is both investment year and cost/commissioning year - OBJ_SUMII(OBJ_SPRED(OBJ_1A(R,V(LL),P),LIFE),K(LL+MY_ARRAY(LL)),AGE+FIL2(V)) = YES; - ); - -$GOTO CONT -* create square for investment costing if validating MARKAL -$LABEL M2T -* Y is investment year, V is cost basis year - OBJ_SUMII(OBJ_SPRED(OBJ_1A(R,V,P),LIFE),Y,'1')$(YEARVAL(Y) = B(V)) = YES; -$LABEL CONT -*=============================================================================== -* Case 1.b: ILEDt <= ILEDmin,t and TLIFEt + ILEDt < D(t) -* Note - no PASTINV as TLIFE always >= D(t) which = 1 -*=============================================================================== - OBJ_1B(RTP(R,T,P))$((NOT OBJ_I2(R,T,P))$(NOT OBJ_1A(R,T,P))) = YES; -*=============================================================================== -* Case I/II.1.b: Investment/Tax&Sub ILEDt <= ILEDmin,t and TLIFEt + ILEDt < D(t) -* Note - no PASTINV as TLIFE always >= D(t) which = 1 -*=============================================================================== -*------------------------------------------------------------------------------ -* build repeated investment blocks until end of lifetime -*------------------------------------------------------------------------------ -* calculate the contribution in each year, if there is a cost -$IF '%VALIDATE%' == 'YES' $GOTO M2T_2 - LOOP(SAMEAS(AGE,'1'), - LOOP(OBJ_SPRED(OBJ_1B(R,T(LL),P),LIFE), - Z = NCAP_TLIFE(R,T,P); -* Slightly different handling according to objective formulation - IF((ROUND(Z)-IPD(T)%CTST%) LE 0, - F = B(T) - %ZHALF% - YEARVAL(T); - Z = ROUND(COEF_RPTI(R,T,P)*Z)-1; -* LL+F is both first investment year and first cost/commissioning year - OBJ_SUMII(R,T,P,LIFE,K(LL+F),AGE+Z) = YES; - ELSE CNT = %ISTEP%; F = B(T)-YEARVAL(T)-FLOOR(CNT/2); CNT = CNT-1; - FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), - OBJ_SUMII(R,T,P,LIFE,K(LL+F),AGE+CNT) = YES; F = F+Z)); - ); - ); - -$GOTO CONT_2 -* create square for investment costing if validating MARKAL -$LABEL M2T_2 - LOOP(OBJ_SPRED(OBJ_1B(R,T(LL),P),LIFE), - Z = NCAP_TLIFE(R,T,P); - FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), - F = B(T) + ROUND((OBJ_C-1)*Z) - YEARVAL(T); -* Y is investment year, T is cost basis year - OBJ_SUMII(R,T,P,LIFE,Y(LL+F),'1') = YES); - ); -$LABEL CONT_2 -*=============================================================================== -* Case 2.a: ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) -*=============================================================================== - OBJ_2A(OBJ_I2(R,V,P))$(COEF_RPTI(R,V,P) LE 1) = YES; -*=============================================================================== -* Case I/II.2.a: Investment/Tax&Sub ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) -*=============================================================================== -*------------------------------------------------------------------------------ -* build trapazoid covering year and number of payment blocks for a process -* - K is EACHYEAR -* for MILESTONYR or PASTYEAR -* beginning from the -* MAX(beginning of the period, or the current year - the economic lifetime + 1) -* until the -* MIN(beginning of the period + leadtime - 1, or the year calculating) -*------------------------------------------------------------------------------ -* there is a relevant cost - LOOP(SAMEAS(AGE,'1'), - LOOP(OBJ_SPRED(OBJ_2A(R,V(LL),P),LIFE), - Z = NCAP_ILED(R,V,P); MY_F = B(V)-YEARVAL(V)+Z; -* LL+F is investment year; LL+MY_F is commissioning year (cost basis) - OBJ_IDC(R,V,P,LIFE,LL+MY_F,AGE+MAX(0,Z-1)) = YES; - )); -*=============================================================================== -* Case 2.b: ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) -* Note - no PASTINV as TLIFE always >= D(t) which = 1 -*=============================================================================== - OBJ_2B(OBJ_I2(R,T,P))$(NOT OBJ_2A(R,T,P)) = YES; -*=============================================================================== -* Case I/II.2.b: Investment/Tax&Sub ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) -* Note - no PASTINV as TLIFE always >= D(t) which = 1 -*=============================================================================== -*------------------------------------------------------------------------------ -* build repeated investment blocks until end of lifetime -*------------------------------------------------------------------------------ -* calculate the contribution in each year, if there is a cost - LOOP(SAMEAS(AGE,'1'), - LOOP(OBJ_SPRED(OBJ_2B(R,T(LL),P),LIFE), - FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), - Z = NCAP_ILED(R,T,P); - MY_F = ROUND(B(T)+(OBJ_C-1)*NCAP_TLIFE(R,T,P))-YEARVAL(T)+Z; -* LL+F is investment year; LL+MY_F is commissioning year (cost basis) - OBJ_IDC(R,T,P,LIFE,LL+MY_F,AGE+MAX(0,Z-1)) = YES); - )); - -*=============================================================================== -* Calculate Interest During Construction (IDC) for any fractional ILED -* Note: Zero ILED represents half year's interest, consistently - LOOP(OBJ_ICUR(OBJ_I2(R,V,P),CUR), Z = COEF_ILED(R,V,P); - IF(Z, OBJ_C=1+G_DRATE(R,V,CUR); MY_F=0; F=0; -*..Interest according to rounded spreads using actual discount rates - LOOP(OBJ_IDC(R,V,P,LIFE,LL,JOT), CNT=ORD(JOT); - MY_F=MY_F+SUM((OPYEAR(JOT,AGE),YEAR(LL-ORD(AGE))),OBJ_DISC(R,YEAR,CUR)); F=F+OBJ_DISC(R,LL,CUR)); - MY_F = MY_F/F/CNT-1; -*..Interest according to rounded and accurate spreads using constant discount rate - F = ((OBJ_C**CNT)-1)/(1-1/OBJ_C)/CNT-1; - CNT = MAX(0.001,Z); - Z = ((OBJ_C**CNT)-1)/(1-1/OBJ_C)/CNT-1; - ELSE F=1); OBJ_DIVI(R,V,P) = 1/(1+Z*MY_F/F)); -* Add spread header tuples - OBJ_SUMII(R,V,P,LIFE,LL,JOT+(1-ORD(JOT)))$OBJ_IDC(R,V,P,LIFE,LL,JOT) = YES; - OPTION CLEAR=OBJ_IDC; - -*=============================================================================== -* Generate the Investment spreads -*=============================================================================== - OPTION KAGE < OBJ_SUMII; - INVSTEP(KAGE(LL,JOT),LL+(ORD(AGE)-1),AGE+(ORD(JOT)-ORD(AGE)))$OPYEAR(JOT,AGE) = YES; -$IF NOT '%CTST%'=='' $BATINCLUDE coef_alt.lin INV - INVSPRED(LL,JOT,K,K)$INVSTEP(LL,JOT,K,JOT) = YES; - -*=============================================================================== -* Case III.1.a-b, III.2.a-b: Decommissioning -*=============================================================================== - OPTION CLEAR=UNCD7; -* Collect header tuples for decommissioning spreads - UNCD7(OBJ_SUMS3(R,V,P),LIFE+(NCAP_DLIFE(R,V,P)-ORD(LIFE)),LL--(ORD(LL)$OBJ_I2(R,V,P)),LL,JOT)$OBJ_SUMII(R,V,P,LIFE,LL,JOT) = YES; - -* Generate the Decommissioning spreads - OPTION CLEAR = YKAGE; - LOOP(UNCD7(R,V,P,LIFE,LASTLL(LL),K,JOT),YKAGE(LL,K,LIFE) = YES); - LOOP(YKAGE(YEAR,K(LL),JOT),INVSPRED(YEAR,AGE+(ORD(JOT)-ORD(AGE)),LL+(ORD(AGE)-1),K)$OPYEAR(JOT,AGE) = YES); - LOOP(UNCD7(R,V,P,LIFE,YEAR,K_EOH,JOT), F = CEIL(NCAP_TLIFE(R,V,P)+NCAP_DLAG(R,V,P)); -* K is commissioning year (cost basis), LL+F is decommissioning year - IF(LASTLL(YEAR), - OBJ_SUMIII(R,V,P,K(K_EOH),K,LL+F)$INVSPRED(YEAR,LIFE,LL,K_EOH) = YES; - ELSE OBJ_SUMIII(R,V,P,LL, K,LL+F)$INVSPRED(K_EOH,JOT,LL,K) = YES)); - INVSPRED('0',JOT,YEAR,K) = NO; - -*------------------------------------------------------------------------------ -* The equation divisors for investments: -$IF NOT '%CTST%'=='' $GOTO CLRS - OBJ_DIVI(OBJ_YES(OBJ_1A(R,V,P))) = 1+(IPD(V)-1)$MILESTONYR(V); - OBJ_DIVI(OBJ_YES(OBJ_1B(R,T,P))) = NCAP_TLIFE(R,T,P); - IF(ALTOBJ,OBJ_DIVI(OBJ_YES(OBJ_1B(R,T,P)))$((ROUND(NCAP_TLIFE(R,T,P))-IPD(T)%CTST%) GT 0) = IPD(T)*MIN(1,NCAP_TLIFE(R,T,P))); -$IF '%VALIDATE%'== YES OBJ_DIVI(OBJ_YES(R,T,P))$(NOT OBJ_I2(R,T,P)) = 1; -* The equation divisors for decommissioning : - OBJ_DIVIII(OBJ_SUMS3(R,V,P)) = OBJ_DIVI(R,V,P); - OBJ_DIVIII(OBJ_SUMS3(OBJ_I2(R,V,P))) = ROUND(NCAP_DLIFE(R,V,P)); -$IF '%VALIDATE%' == YES OPTION CLEAR=OBJ_PASTI; -*------------------------------------------------------------------------------ -$LABEL CLRS - OPTION CLEAR = OBJ_YES, CLEAR = OBJ_SUMS3, CLEAR = YKAGE; - OPTION CLEAR = INVSTEP, CLEAR = OBJ_SPRED, CLEAR = OBJ_I2; - -$LABEL EQUA %2 -*=============================================================================== -* Generate Investment equation summing over all active indexes by region and currency -*=============================================================================== - %EQ%_OBJINV(RDCUR(R,CUR) %SOW%) .. - -*------------------------------------------------------------------------------ -* Cases I - Investment Cost and II - Taxes/Subsidies -*------------------------------------------------------------------------------ - - SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT)$OBJ_ICUR(R,T,P,CUR), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,Y,K), OBJ_DISC(R,K,CUR) * - (OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))) * - COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * %VART%_NCAP(R,T,P %SWS%) - -* handle ETL -$IF '%ETL%'==YES + SUM(G_RCUR(R,CUR),%VART%_IC(R,T,P %SWS%)*SUM(INVSPRED(K_EOH,JOT,Y,K),OBJ_DISC(R,K,CUR))*COR_SALVI(R,T,P,CUR)/OBJ_DIVI(R,T,P))$SEG(R,P) - ) - + - -$IFI NOT %STAGES%==YES $GOTO PASTI - SUM((OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT),SW_TSW(SOW,T,WW))$OBJ_SIC(R,T,P,WW), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,Y,K), OBJ_DISC(R,K,CUR) * OBJ_ICOST(R,K,P,CUR) * (1-SALV_INV(R,T,P,Y))) * - OBJ_SIC(R,T,P,WW) * COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * %VAR%_NCAP(R,T,P %SWD%)) + -$LABEL PASTI - -* PASTI charge - SUM(OBJ_SUMII(R,PASTYEAR(V),P,LIFE,K_EOH,JOT)$OBJ_PASTI(R,V,P,CUR), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_DISC(R,K,CUR) * - (OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))) * - OBJ_PASTI(R,V,P,CUR) * COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)) - - + OBJ_IAD(R,CUR) + - -*------------------------------------------------------------------------------ -* Cases III - Decommissioning -*------------------------------------------------------------------------------ - - SUM(OBJ_SUMIII(R,V,P,LL,K,Y)$OBJ_DCOST(R,V,P,CUR), - OBJ_DISC(R,Y,CUR) * COR_SALVD(R,V,P,CUR) * OBJ_DCOST(R,K,P,CUR) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + OBJ_PASTI(R,V,P,CUR)$PASTYEAR(V)) / OBJ_DIVIII(R,V,P)) - - - =E= - - SUM(OBV,SUM_OBJ('OBJINV',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); - - -*$OFFLISTING diff --git a/source/eqobjinv.rpt b/source/eqobjinv.rpt deleted file mode 100644 index bdf0ac7..0000000 --- a/source/eqobjinv.rpt +++ /dev/null @@ -1,69 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJINV the objective functions on investments -* - Investment Costs -* - Investment Tax/Subsidies -* - Decommissioning -*=============================================================================* - - SCALAR VDISC / 0 /; - SET NCAP_YES(R,ALLYEAR,P); - PARAMETER OBJ_SUMIK(REG,ALLYEAR,PRC,CUR); - PARAMETER YKAGEP(ALLYEAR,ALLYEAR,AGE); -*------------------------------------------------------------------------------ -* Identify new capacities - NCAP_YES(RTP(R,V,P))$(VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) = YES; - NCAP_YES(R,LL--ORD(LL),P)$NCAP_YES(R,LL,P) = YES; -*------------------------------------------------------------------------------ -* Cases I - Investment Cost and II - Taxes/Subsidies -*------------------------------------------------------------------------------ -OBJ_SUMIK(R,K,P,CUR)$((OBJ_ICOST(R,K,P,CUR)+OBJ_ITAX(R,K,P,CUR)+OBJ_ISUB(R,K,P,CUR))$NCAP_YES(R,'0',P)) = - OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR); - -* Calculate Annual discounted investment costs PAR_OBJINV -* VDISC is the constant discount rate used to discount annual payments to the investment year LL -LOOP(OBJ_ICUR(NCAP_YES(R,V,P),CUR), - F = (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) * OBJ_CRF(R,V,P,CUR)/OBJ_DIVI(R,V,P); - VDISC = 1+G_DRATE(R,V,CUR); OPTION CLEAR = YKAGEP; - LOOP((OBJ_SUMII(R,V,P,LIFE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K)), - MY_F=F*OBJ_DISC(R,LL,CUR)*OBJ_SUMIK(R,K,P,CUR); YKAGEP(LL+(ORD(AGE)-1),LL,AGE)$OPYEAR(LIFE,AGE) = MY_F); - PAR_OBJINV(R,V,Y,P,CUR) = SUM((LL,AGE)$YKAGEP(Y,LL,AGE),YKAGEP(Y,LL,AGE)*VDISC**(1-ORD(AGE))); -); - -* Handle ETL -$IF NOT %ETL% == 'YES' $GOTO ETLDONE -LOOP(OBJ_ICUR(R,T,TEG(P),CUR)$VAR_IC.L(R,T,P), - F = OBJ_CRF(R,T,P,CUR)*VAR_IC.L(R,T,P)/OBJ_DIVI(R,T,P); VDISC = 1+G_DRATE(R,T,CUR); OPTION CLEAR = YKAGEP; - LOOP((OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K)), - MY_F = F*OBJ_DISC(R,LL,CUR); YKAGEP(LL+(ORD(AGE)-1),LL,AGE)$OPYEAR(LIFE,AGE) = MY_F); - PAR_OBJINV(R,T,Y,P,CUR) = PAR_OBJINV(R,T,Y,P,CUR) + SUM((LL,AGE)$YKAGEP(Y,LL,AGE),YKAGEP(Y,LL,AGE)*VDISC**(1-ORD(AGE))); -); -$LABEL ETLDONE - -*------------------------------------------------------------------------------ -* Check that total OBJINV value is the same in all calculation methods: -* PAST Investments cannot be accurately matched in case 2a; therefore check with OBJ_PASTI - OBJ_C = SUM((R,T,Y,P,CUR)$PAR_OBJINV(R,T,Y,P,CUR),PAR_OBJINV(R,T,Y,P,CUR)) + - SUM((OBJ_SUMII(R,PASTMILE(V),P,AGE,K_EOH,JOT),CUR),COR_SALVI(R,V,P,CUR)/OBJ_DIVI(R,V,P)* - SUM(INVSPRED(K_EOH,JOT,YEAR,K),OBJ_DISC(R,YEAR,CUR)*OBJ_SUMIK(R,K,P,CUR)*OBJ_PASTI(R,V,P,CUR))); - OBJ_D = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJINV',OBV)*VAR_OBJ.L(R,OBV,CUR))); - - DISPLAY OBJ_C,OBJ_D; - OPTION CLEAR=OBJ_SUMIK; - -*------------------------------------------------------------------------------ -* Cases III - Decommissioning -*------------------------------------------------------------------------------ - -* Calculate Annual discounted decommissioning costs PAR_OBJDEC -* VDISC is the constant discount rate used to discount annual payments to the investment year LL -LOOP((NCAP_YES(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR), - F = (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) * OBJ_CRFD(R,V,P,CUR)/OBJ_DIVIII(R,V,P); - VDISC = 1+G_DRATE(R,V,CUR); Z = ROUND(NCAP_%DECLIF%(R,V,P))-1; - PAR_OBJDEC(R,V,Y,P,CUR) = - SUM((OBJ_SUMIII(R,V,P,K_EOH,K,LL),YK(LL+Z,Y))$YK(Y,LL), - F * OBJ_DCOST(R,K,P,CUR) * OBJ_DISC(R,LL,CUR) * VDISC**(YEARVAL(LL)-YEARVAL(Y))); -); diff --git a/source/eqobjvar.mod b/source/eqobjvar.mod deleted file mode 100644 index 79cd0fb..0000000 --- a/source/eqobjvar.mod +++ /dev/null @@ -1,113 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJVAR the objective functions variable costs, variable O&M and commodity -* direct costs -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Questions/Comments: -* - Top-level SUM over Y_EOH moved to individual components -* - This version works for the alternative objective formulations ALT/LIN -*----------------------------------------------------------------------------- -$SET TPULSE PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR) -$IFI %OBJ%==ALT $SET TPULSE PERIODYR(T,Y_EOH),OBJ_ALTV(R,T)*OBJ_DISC(R,Y_EOH,CUR) -$IFI %OBJ%==LIN $SET TPULSE TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR) -$IFI %VARCOST%==LIN $SET TPULSE Y_EOH$OBJ_LINT(R,T,Y_EOH,CUR),OBJ_LINT(R,T,Y_EOH,CUR) -*=============================================================================== -* Generate Variable cost equation summing over all active indexes by region and currency -*=============================================================================== - -%2 %EQ%_OBJVAR(RDCUR(R,CUR) %SOW%) .. - -$IF %STAGES% == YES $SETLOCAL SWTD 'SUM(SW_TSW(SOW,T,WW),' SET SOW ',WW' - (%SWTD% -*------------------------------------------------------------------------------ -* Costs on Overall activity of a process -*------------------------------------------------------------------------------ -* multiply storage activity by average residence time - SUM(RTP_VARA(R,T,P)$OBJ_ACOST(R,T,P,CUR), - SUM(%TPULSE% * OBJ_ACOST(R,Y_EOH,P,CUR)) * - SUM((RTP_VINTYR(R,V,T,P),PRC_TS(R,P,S)),%VAR%_ACT(R,V,T,P,S %SOW%) * - POWER(RS_STGAV(R,S),1$RP_STG(R,P))) - ) + -* modal costs if modeled - SUM(RTP_VINTYR(R,V,T,P)$RPC_CUR(R,P,%PGPRIM%,CUR), - SUM(RP_UPS(R,P,TSL,L('UP')),ACT_CSTUP(R,V,P,TSL,CUR)*OBJ_PVT(R,T,CUR)*SUM(TS_GROUP(R,TSL,S),RS_STGPRD(R,S)*%VAR%_UPS(R,V,T,P,S,L%SOW%))) + - SUM(RP_UPT(R,P,UPT,'UP'),ACT_CSTSD(R,V,P,UPT,'FX',CUR)*OBJ_PVT(R,T,CUR)*SUM(TS_GROUP(R,TSL,S)$RP_DPL(R,P,TSL),RS_STGPRD(R,S)*%VAR%_UPT(R,V,T,P,S,UPT%SOW%))) + - SUM(RP_UPR(R,P,BDNEQ(BD)),ACT_CSTRMP(R,V,P,BD,CUR)*OBJ_PVT(R,T,CUR)*SUM(PRC_TS(R,P,S),RS_STGPRD(R,S)*%VAR%_UDP(R,V,T,P,S,BD%SOW%)))) + - -*------------------------------------------------------------------------------ -* Commodity added costs and sub/tax -*------------------------------------------------------------------------------ - SUM(RHS_COMBAL(R,T,C,S), %VAR%_COMNET(R,T,C,S %SOW%) * - SUM(%TPULSE% * SUM(COSTYPE,OBJ_COMNT(R,Y_EOH,C,S,COSTYPE,CUR)))) + - SUM(RHS_COMPRD(R,T,C,S), %VAR%_COMPRD(R,T,C,S %SOW%) * - SUM(%TPULSE% * SUM(COSTYPE,OBJ_COMPD(R,Y_EOH,C,S,COSTYPE,CUR)))) + -$IFI %STAGES%==YES SUM((RTCS_VARC(R,T,C,S),COM_VAR,W(WW))$S_COM_TAX(R,T,C,S,COM_VAR,CUR,'1',W),SUM(Y_EOH(Y)$OBJ_LINT(R,T,Y,CUR),OBJ_LINT(R,T,Y,CUR)*S_COM_TAX(R,Y,C,S,COM_VAR,CUR,'1',W))*(%VAR%_COMPRD(R,T,C,S%SOW%)$(ORD(COM_VAR)=2)+%VAR%_COMNET(R,T,C,S%SOW%)$UC_NAME(COM_VAR))) + - -*------------------------------------------------------------------------------ -* Commodity costs/tax/sub associated with imports/exports from outside study area -* - note that price only applied when actually an external region -*------------------------------------------------------------------------------ - SUM((RTPCS_VARF(R,T,P,C,S),RPC_IREIO(R,P,C,IE,'OUT')), - SUM(%TPULSE% * OBJ_IPRIC(R,Y_EOH,P,C,S,IE,CUR)) * - SUM(RTP_VINTYR(R,V,T,P), - (%VAR%_IRE(R,V,T,P,C,S,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) - ) - ) + - -*------------------------------------------------------------------------------ -* Flow level costs/tax/sub -*------------------------------------------------------------------------------ -*GG* need to add VAR_NCAP if I/O/COM and FLO_COST/DELIV/SUB/TAX for commodity -* based upon RPC_CAPFLOr,t,p,c - SUM(RTPCS_VARF(R,T,P,C,S)$SUM(OBJ_VFLO(RP_FLO(R,P),C,CUR,UC_COST),1), - SUM(TS_ANN(S,TS), - SUM(%TPULSE% * (OBJ_FCOST(R,Y_EOH,P,C,TS,CUR)+OBJ_FDELV(R,Y_EOH,P,C,TS,CUR)+OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * - SUM(RTP_VINTYR(R,V,T,P), -$ BATINCLUDE %cal_red% C COM S P T - )) + - -* same for IRE processes - SUM(RTPCS_VARF(R,T,P,C,S)$SUM(OBJ_VFLO(RP_IRE(R,P),C,CUR,UC_COST),1), - SUM(TS_ANN(S,TS), - SUM(%TPULSE% * (OBJ_FCOST(R,Y_EOH,P,C,TS,CUR)+OBJ_FDELV(R,Y_EOH,P,C,TS,CUR)+OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * - SUM(RTP_VINTYR(R,V,T,P), - SUM(RPC_IRE(R,P,C,IE), - %VAR%_IRE(R,V,T,P,C,S,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) - ) + -*V06a_3 handle aux delivery cost to exchange processes, BUT NOT HANDLING different TSlevel!!! -* Negative IRE_FLOSUM is resonable for import flows only, and for the commodity itself -$IF DEFINED RTP_FFCS $SET MX "*(%SHFF%S(R,V,P,C,C%SOW%))" - SUM((RPC_IRE(R,P,COM,IE),IO)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO), - IRE_FLOSUM(R,T,P,COM,S,IE,C,IO) %MX% * - (%VAR%_IRE(R,V,T,P,COM,S,IE %SOW%)$(NOT RPC_AIRE(R,P,COM))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM)) - ))) + -*V3.3.3 support costs also for storage flows (FCOST for IN, FDELV for OUT) - SUM(OBJ_VFLO(RPC_STG(R,P,C),CUR,'COST'), - SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,S)), - SUM(TS_ANN(S,TS),SUM(%TPULSE% * (%VAR%_SIN(R,V,T,P,C,S%SOW%)*OBJ_FCOST(R,Y_EOH,P,C,TS,CUR)+%VAR%_SOUT(R,V,T,P,C,S%SOW%)*STG_EFF(R,V,P)*OBJ_FDELV(R,Y_EOH,P,C,TS,CUR)))))) -$IF %STAGES%==YES ) - ) + - -*V05c 980924 handle the fact that commodity costs may be associated with capacity -* note that G_YRFR fraction in the cal_*.mod files -* [AL] Moved cost summation over TPULSEYR inside called routines; V must be in RTP, but T need not be - SUM(ANNUAL(S), -$ BATINCLUDE cal_caps.%1 T 'SUM(TS_ANN(TS,SL),SUM(%TPULSE%*(OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR))))' TS - ) + - -*------------------------------------------------------------------------------ -* Commodity blending costs -*------------------------------------------------------------------------------ - SUM((BLE_OPR(R,BLE,OPR),TT(T)), - SUM(%TPULSE% * OBJ_BLNDV(R,Y_EOH,BLE,OPR,CUR)) * %VART%_BLND(R,T,BLE,OPR %SWS%) - ) - - =E= - -$IF %STAGES% == YES $SET SOW ',SOW' - -%2 SUM(OBV,SUM_OBJ('OBJVAR',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); diff --git a/source/eqobjvar.rpt b/source/eqobjvar.rpt deleted file mode 100644 index 98d86aa..0000000 --- a/source/eqobjvar.rpt +++ /dev/null @@ -1,181 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJVAR - the variable O&M, flow and commodity direct costs -* %1 - mod or prefix -* %2 - '1', or J(UNCD1), -* %3 - '2', or J(UNCD1), -* %4 - T OR Y_EOH -* %5 - SUM or '' -*------------------------------------------------------------------------------ -$IFI '%1'==MOD $GOTO LEGACY -$IFI '%5'=='' $SET TPULSE '' SET TMP '' -$IFI %STAGES%==YES Z=SUM(W(SOW),SW_PROB(W)); -*------------------------------------------------------------------------------ - OPTION CLEAR=%1_ACTC,CLEAR=%1_COMC,CLEAR=%1_FLOC; -*------------------------------------------------------------------------------ -* Costs based on overall activity of process -*------------------------------------------------------------------------------ - - %1_ACTC(%2RTP_VINTYR(R,V,T,P),%PGPRIM%,CUR)$(RDCUR(R,CUR)$OBJ_ACOST(R,T,P,CUR)) = - %5(%TPULSE% OBJ_ACOST(R,%4,P,CUR)) * - SUM(PRC_TS(R,P,S), VAR_ACT.L(R,V,T,P,S) * POWER(RS_STGAV(R,S),1$RP_STG(R,P))); - %1_ACTC(%3RTP_VINTYR(R,V,T,P),C(%PGPRIM%),CUR)$RPC_CUR(R,P,C,CUR) = - SUM(RP_UPS(R,P,TSL,L('UP')),%5(%TPULSE% ACT_CSTUP(R,V,P,TSL,CUR))*SUM(TS_GROUP(R,TSL,S),RS_STGPRD(R,S)*VAR_UPS.L(R,V,T,P,S,L))) + - SUM(RP_UPT(R,P,UPT,'UP'),%5(%TPULSE% ACT_CSTSD(R,V,P,UPT,'FX',CUR)*SUM(TS_GROUP(R,TSL,S)$RP_DPL(R,P,TSL),RS_STGPRD(R,S)*VAR_UPT.L(R,V,T,P,S,UPT)))) + - SUM(RP_UPR(R,P,BDNEQ(BD)),%5(%TPULSE% ACT_CSTRMP(R,V,P,BD,CUR))*SUM(PRC_TS(R,P,S),RS_STGPRD(R,S)*VAR_UDP.L(R,V,T,P,S,BD))); - -*------------------------------------------------------------------------------ -* Commodity added costs and sub/tax -*------------------------------------------------------------------------------ - %1_COMC(%2R,T,C,CUR)$RDCUR(R,CUR) $= - SUM(RHS_COMBAL(R,T,C,S), VAR_COMNET.L(R,T,C,S) * %5(%TPULSE% OBJ_COMNT(R,%4,C,S,'COST',CUR))) + - SUM(RHS_COMPRD(R,T,C,S), VAR_COMPRD.L(R,T,C,S) * %5(%TPULSE% OBJ_COMPD(R,%4,C,S,'COST',CUR))); - %1_COMC(%3R,T,C,CUR)$RDCUR(R,CUR) $= - SUM(RHS_COMBAL(R,T,C,S), VAR_COMNET.L(R,T,C,S) * %5(%TPULSE% (OBJ_COMNT(R,%4,C,S,'TAX',CUR)+OBJ_COMNT(R,%4,C,S,'SUB',CUR)))) + - SUM(RHS_COMPRD(R,T,C,S), VAR_COMPRD.L(R,T,C,S) * %5(%TPULSE% (OBJ_COMPD(R,%4,C,S,'TAX',CUR)+OBJ_COMPD(R,%4,C,S,'SUB',CUR)))); -$IFI %STAGES%==YES - %1_COMC(%3RTC(R,T,C),CUR)$RDCUR(R,CUR) $= SUM((RTCS_VARC(RTC,S),COM_VAR,SW_TSW(SOW,T,W))$S_COM_TAX(RTC,S,COM_VAR,CUR,'1',W),(%5(%TMP%S_COM_TAX(R,%4,C,S,COM_VAR,CUR,'1',W))*(VAR_COMPRD.L(RTC,S)$(ORD(COM_VAR)=2)+VAR_COMNET.L(RTC,S)$UC_NAME(COM_VAR))+%1_COMC(J,RTC,CUR)*G_YRFR(R,S))*SW_PROB(W)/Z); - -*------------------------------------------------------------------------------ -* Commodity costs associated with imports/exports from outside study area -*------------------------------------------------------------------------------ - %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(RDCUR(R,CUR)$RPC(R,P,C)$RP_IRE(R,P)) $= - SUM((RTPCS_VARF(R,T,P,C,S),RPC_IREIO(R,P,C,IE,'OUT')), %5(%TPULSE% OBJ_IPRIC(R,%4,P,C,S,IE,CUR)) * PAR_IRE(R,V,T,P,C,S,IE)); - -*------------------------------------------------------------------------------ -* Flow level costs -*------------------------------------------------------------------------------ - - %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'COST')$RP_FLO(R,P)) = - SUM(RTPCS_VARF(R,T,P,C,S), - SUM(TS_ANN(S,TS),%5(%TPULSE% (OBJ_FCOST(R,%4,P,C,TS,CUR)+OBJ_FDELV(R,%4,P,C,TS,CUR)))) * PAR_FLO(R,V,T,P,C,S)); - - %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'COST')$RPC_STG(R,P,C)) = - SUM(RPCS_VAR(R,P,C,S), - SUM(TS_ANN(S,TS),%5(%TPULSE% (VAR_SIN.L(R,V,T,P,C,S)*OBJ_FCOST(R,%4,P,C,TS,CUR)+VAR_SOUT.L(R,V,T,P,C,S)*STG_EFF(R,V,P)*OBJ_FDELV(R,%4,P,C,TS,CUR))))); - - %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'COST')$RP_IRE(R,P)) = - %1_FLOC(J,R,V,T,P,C,CUR) + - SUM(RTPCS_VARF(R,T,P,C,S), - SUM(TS_ANN(S,TS),%5(%TPULSE% (OBJ_FCOST(R,%4,P,C,TS,CUR) + OBJ_FDELV(R,%4,P,C,TS,CUR)))) * - ( - SUM(RPC_IRE(R,P,C,IE), PAR_IRE(R,V,T,P,C,S,IE)) + - SUM(IO$F_INOUTS(R,V,T,P,C,S,IO),F_INOUTS(R,V,T,P,C,S,IO)) - )); - -* handle the fact that commodity costs may be associated with capacity - %1_FLOC(%2R,V,T,P,C,CUR)$(VNT(V,T)$OBJ_VFLO(R,P,C,CUR,'COST')$RPC_CAPFLO(R,V,P,C)) = - %1_FLOC(J,R,V,T,P,C,CUR) + - SUM(ANNUAL(S), -$ BATINCLUDE cal_caps.mod T 'SUM(TS_ANN(TS,SL),%5(%TPULSE%(OBJ_FCOST(R,%4,P,C,SL,CUR)+OBJ_FDELV(R,%4,P,C,SL,CUR))))' TS .L - ); - -*------------------------------------------------------------------------------ -* Flow level tax/sub -*------------------------------------------------------------------------------ - - %1_FLOC(%3RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'TAX')$RP_FLO(R,P)) = - SUM(RTPCS_VARF(R,T,P,C,S), - SUM(TS_ANN(S,TS),%5(%TPULSE% OBJ_FTAX(R,%4,P,C,TS,CUR))) * PAR_FLO(R,V,T,P,C,S)); - - %1_FLOC(%3RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'TAX')$RP_IRE(R,P)) = - SUM(RTPCS_VARF(R,T,P,C,S), - SUM(TS_ANN(S,TS),%5(%TPULSE% OBJ_FTAX(R,%4,P,C,TS,CUR))) * - ( - SUM(RPC_IRE(R,P,C,IE), PAR_IRE(R,V,T,P,C,S,IE)) + - SUM(IO$F_INOUTS(R,V,T,P,C,S,IO),F_INOUTS(R,V,T,P,C,S,IO)) - )); - -* handle the fact that commodity costs may be associated with capacity - %1_FLOC(%3R,V,T,P,C,CUR)$(VNT(V,T)$OBJ_VFLO(R,P,C,CUR,'TAX')$RPC_CAPFLO(R,V,P,C)) = - %1_FLOC(J,R,V,T,P,C,CUR) + - SUM(ANNUAL(S), -$ BATINCLUDE cal_caps.mod T 'SUM(TS_ANN(TS,SL),%5(%TPULSE% OBJ_FTAX(R,%4,P,C,SL,CUR)))' TS .L - ); - -*------------------------------------------------------------------------------ -* Commodity blending costs -*------------------------------------------------------------------------------ - %1_COMC(%2R,T,BLE,CUR)$RDCUR(R,CUR) = %1_COMC(J,R,T,BLE,CUR) + - SUM(BLE_OPR(R,BLE,OPR), %5(%TPULSE% OBJ_BLNDV(R,%4,BLE,OPR,CUR)) * VAR_BLND.L(R,T,BLE,OPR)); - -*------------------------------------------------------------------------------ -$EXIT -$LABEL LEGACY -*============================================================================== -* Legacy reporting (by every year and timeslice, discounted): -* Generate Variable cost formulas summing over all active indexes by region and currency -*=============================================================================== - -*------------------------------------------------------------------------------ -* Overall activity of a process based costs -*------------------------------------------------------------------------------ - LOOP(T, - PAR_OBJACT(R,V,Y_EOH,P,S,CUR)$(PERIODYR(T,Y_EOH)*RTP_VINTYR(R,V,T,P)*PRC_TS(R,P,S)) = - OBJ_DISC(R,Y_EOH,CUR) * OBJ_ACOST(R,Y_EOH,P,CUR) * VAR_ACT.L(R,V,T,P,S) * POWER(RS_STGAV(R,S),1$RP_STG(R,P)) - ); - -*------------------------------------------------------------------------------ -* Commodity added costs and sub/tax -*------------------------------------------------------------------------------ - LOOP(T, - PAR_OBJCOM(R,Y_EOH,C,S,CUR)$PERIODYR(T,Y_EOH) $= - SUM(RHS_COMBAL(R,T,C,S), OBJ_DISC(R,Y_EOH,CUR) * VAR_COMNET.L(R,T,C,S) * SUM(COSTYPE,OBJ_COMNT(R,Y_EOH,C,S,COSTYPE,CUR))) + - SUM(RHS_COMPRD(R,T,C,S), OBJ_DISC(R,Y_EOH,CUR) * VAR_COMPRD.L(R,T,C,S) * SUM(COSTYPE,OBJ_COMPD(R,Y_EOH,C,S,COSTYPE,CUR))); - ); - -*------------------------------------------------------------------------------ -* Commodity costs/tax/sub associated with imports/exports from outside study area (external regions) -*------------------------------------------------------------------------------ - LOOP(T, - PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$((PERIODYR(T,Y_EOH)*RTPCS_VARF(R,T,P,C,S)*RTP_VINTYR(R,V,T,P))$RP_IRE(R,P)) $= - SUM(RPC_IREIO(R,P,C,IE,'OUT'), OBJ_DISC(R,Y_EOH,CUR) * OBJ_IPRIC(R,Y_EOH,P,C,S,IE,CUR) * PAR_IRE(R,V,T,P,C,S,IE)); - ); - -*------------------------------------------------------------------------------ -* Flow level costs/tax/sub -*------------------------------------------------------------------------------ - LOOP(T, - PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$(PERIODYR(T,Y_EOH)*RTPCS_VARF(R,T,P,C,S)*RTP_VINTYR(R,V,T,P)*RP_FLO(R,P)) = - - OBJ_DISC(R,Y_EOH,CUR) * PAR_FLO(R,V,T,P,C,S) * - SUM(TS_ANN(S,TS),OBJ_FCOST(R,Y_EOH,P,C,TS,CUR) + OBJ_FDELV(R,Y_EOH,P,C,TS,CUR) + OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)) - ); - - LOOP(T, - PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$(SUM(OBJ_VFLO(R,P,C,CUR,UC_COST),1)$(PERIODYR(T,Y_EOH)*RTPCS_VARF(R,T,P,C,S)*RTP_VINTYR(R,V,T,P)$RP_IRE(R,P))) = - - PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR) + - OBJ_DISC(R,Y_EOH,CUR) * - SUM(TS_ANN(S,TS),OBJ_FCOST(R,Y_EOH,P,C,TS,CUR) + OBJ_FDELV(R,Y_EOH,P,C,TS,CUR) + OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)) * - ( - SUM(RPC_IRE(R,P,C,IE), PAR_IRE(R,V,T,P,C,S,IE)) + - SUM(IO$F_INOUTS(R,V,T,P,C,S,IO),F_INOUTS(R,V,T,P,C,S,IO)) - ) - ); - -* handle the fact that commodity costs may be associated with capacity - LOOP(T, - PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$(PERIODYR(T,Y_EOH)*RPCS_VAR(R,P,C,S)*VNT(V,T)*RPC_CAPFLO(R,V,P,C)) = - PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR) + - OBJ_DISC(R,Y_EOH,CUR) * - ( -$ BATINCLUDE cal_caps.mod T 'SUM(TS_ANN(TS,SL),OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR))' TS .L - ) - ); - -*------------------------------------------------------------------------------ -* Commodity blending costs -*------------------------------------------------------------------------------ - PAR_OBJBLE(R,Y_EOH,BLE,CUR)$RDCUR(R,CUR) = OBJ_DISC(R,Y_EOH,CUR) * - SUM((BLE_OPR(R,BLE,OPR),PERIODYR(T,Y_EOH)), OBJ_BLNDV(R,Y_EOH,BLE,OPR,CUR) * VAR_BLND.L(R,T,BLE,OPR)); - -* Check that the Calculated objective components are equal to those Derived by the solver: -OBJ_C = SUM((R,V,Y_EOH,P,S,CUR)$PAR_OBJACT(R,V,Y_EOH,P,S,CUR),PAR_OBJACT(R,V,Y_EOH,P,S,CUR))+ - SUM((R,V,Y_EOH,P,C,S,CUR)$PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR),PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR))+ - SUM((R,Y_EOH,C,S,CUR)$PAR_OBJCOM(R,Y_EOH,C,S,CUR),PAR_OBJCOM(R,Y_EOH,C,S,CUR)); -OBJ_D = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJVAR',OBV)*VAR_OBJ.L(R,OBV,CUR))); -DISPLAY OBJ_C,OBJ_D; \ No newline at end of file diff --git a/source/eqobsalv.mod b/source/eqobsalv.mod deleted file mode 100644 index fadad33..0000000 --- a/source/eqobsalv.mod +++ /dev/null @@ -1,143 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJSALV the objective functions for salvaging -* - Investment Costs -* - Taxes and subsidies on investments -* - Decommissioning -*=============================================================================* -$IF DEFINED OBJSCC $GOTO PREPRO - - PARAMETER SALV_DEC(REG,ALLYEAR,PRC,CUR) //; - PARAMETER OBJSCC(REG,ALLYEAR,PRC,CUR) //; - PARAMETER OBJSIC(REG,ALLYEAR,PRC) //; - PARAMETER OBJ_DCEOH(REG,CUR) //; - -$LABEL PREPRO -$SET PFT '' -*=============================================================================== -* Check stepped mode -$IF SET TIMESTEP OPTION CLEAR=OBJ_SUMS,CLEAR=OBJ_SUMS3,CLEAR=SALV_INV,CLEAR=OBJSCC; -$IF %STEPPED%==+ -$IFI %1==mod $GOTO EQUA -$IF NOT DEFINED VNRET -$IF NOT '%CTST%'=='' $SET PFT (T) -*=============================================================================== -* Salvaging of Investments -* LL is investment year; K is commissioning year -*[UR] 19.12.2003 added -1 in line below, since lifetime starts at the beginning of year K - LOOP(OBJ_SUMII(R,V%PFT%,P,AGE,K_EOH,JOT), Z=NCAP_TLIFE(R,V,P)-1; - IF(YEARVAL(K_EOH)+ORD(JOT)+Z GT MIYR_VL, - LOOP(INVSPRED(K_EOH,JOT,LL,K)$(YEARVAL(LL)+Z GT MIYR_VL),OBJ_SUMSI(R,V,P,LL) = YES))); - -* No retrofit salvage - LOOP((RP(R,PRC),P)$PRC_REFIT(RP,P),IF(PRC_REFIT(RP,P)<0, OBJ_SUMSI(R,T,P,K)=NO)); - OPTION OBJ_SUMS <= OBJ_SUMSI; - -* Salvaging of Decommissioning - LOOP(OBJ_SUMIII(OBJ_SUMS(R,V,P),LL,K,Y), OBJ_SUMS3(R,V,P) = YES); -* Salvaging of Decommissioning surveillance - LOOP(OBJ_SUMIVS(R,V,P,K,Y)$(YEARVAL(K)+NCAP_TLIFE(R,V,P)-1 GT MIYR_VL), - OBJ_SUMS3(R,V,P) = YES; OBJ_SUMSI(R,V,P,K) = YES); - -*=============================================================================== - LOOP(RDCUR(R,CUR), -* Salvage proportion of investments at the commissioning year K: - SALV_INV(OBJ_SUMSI(R,V,P,K))$OBJ_ICUR(R,V,P,CUR) = - MIN(1,(((1+G_DRATE(R,V,CUR))*EXP(NCAP_FDR(R,V,P)))**(NCAP_TLIFE(R,V,P)+YEARVAL(K)-MIYR_VL-1)-1) / - (((1+G_DRATE(R,V,CUR))*EXP(NCAP_FDR(R,V,P)))**NCAP_TLIFE(R,V,P)-1)); - ); -* Discount factors for the year EOH+1: - LOOP(MIYR_1(LL), F = MIYR_VL+1-YEARVAL(MIYR_1); OBJ_DCEOH(RDCUR(R,CUR)) = OBJ_DISC(R,LL+F,CUR)); -* Shape-reduced salvage at EOH+1: - Z = SMAX(T$(B(T)<=MIYR_VL+1),ORD(T)-1); - LOOP(MIYR_1(T-Z), SALV_INV(OBJ_SUMSI(RTP,K))$NCAP_CPX(RTP) = SALV_INV(RTP,K)*(1+RTP_CPX(RTP,T))); - - OPTION CLEAR = OBJ_SUMSI; -*=============================================================================== -* Salvage value of investments at year EOH+1: -* Note that in Cases 2a and 2b investment costs are paid before K - OBJSCC(OBJ_ICUR(OBJ_SUMS(R,V,P),CUR)) = COR_SALVI(R,V,P,CUR) / OBJ_DCEOH(R,CUR) / OBJ_DIVI(R,V,P) * - SUM((OBJ_SUMII(R,V,P,AGE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K))$SALV_INV(R,V,P,LL),%CAPJD% - (OBJ_ICOST(R,K,P,CUR)+OBJ_ITAX(R,K,P,CUR)-OBJ_ISUB(R,K,P,CUR)) * SALV_INV(R,V,P,LL) * OBJ_DISC(R,K,CUR)); -* Handle ETL in similar fashion -$IF %ETL%==YES LOOP((OBJ_SUMS(R,T(V),P),G_RCUR(R,CUR))$SEG(R,P), -$IF %ETL%==YES OBJSIC(R,T,P) = COR_SALVI(R,T,P,CUR) / OBJ_DCEOH(R,CUR) / OBJ_DIVI(R,T,P) * -$IF %ETL%==YES SUM((OBJ_SUMII(R,V,P,AGE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K)),%CAPJD% SALV_INV(R,T,P,LL)*OBJ_DISC(R,K,CUR))); -*=============================================================================== -* Additional constant term - OBJ_IAD(RDCUR(R,CUR)) = SUM(OBJ_ICUR(OBJ_SUMS(R,PASTMILE(V),P),CUR)$((OBJ_PASTI(R,V,P,CUR)=0)+0%CTST%),OBJSCC(R,V,P,CUR)*NCAP_PASTI(R,V,P)*OBJ_DCEOH(R,CUR)); -*=============================================================================== -*GG* only if decommissioning lifetime provided by user - COR_SALVD(RTP(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR) = - (((1-1/(1+NCAP_DRATE(R,V,P)))*(1-1/(1+OBJ_RFR(R,V,CUR))**NCAP_DELIF(R,V,P)))/ - ((1-1/(1+OBJ_RFR(R,V,CUR)))*(1-1/(1+NCAP_DRATE(R,V,P))**NCAP_DELIF(R,V,P))) - )$(NCAP_DRATE(R,V,P) GT 0) + 1$(NCAP_DRATE(R,V,P) EQ 0); - OBJ_CRFD(RTP(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR) = COR_SALVD(R,V,P,CUR) * (1-(1/(1+G_DRATE(R,V,CUR)))) / (1-(1+G_DRATE(R,V,CUR))**(-ROUND(NCAP_%DECLIF%(R,V,P)))); -*------------------------------------------------------------------------------ -* Salvage value of Decommissioning at year EOH+1: -* Documentation defines the value for each decommissioning year Y; here aggregated by vintage - SALV_DEC(OBJ_SUMS3(R,V,P),CUR)$COR_SALVD(R,V,P,CUR) = COR_SALVD(R,V,P,CUR) / OBJ_DIVIII(R,V,P) / OBJ_DCEOH(R,CUR) * - SUM(OBJ_SUMIII(R,V,P,LL,K,Y)$SALV_INV(R,V,P,LL),SALV_INV(R,V,P,LL)*OBJ_DCOST(R,K,P,CUR)*OBJ_DISC(R,Y,CUR)); -*=============================================================================== -$LABEL EQUA -$IFI %2==EXIT $EXIT - -*=============================================================================== -* Generate Salvage Equation summing over all active indexes by region and currency -*=============================================================================== - - - %EQ%_OBJSALV(RDCUR(R,CUR) %SOW%) .. - -*------------------------------------------------------------------------------ -* Cases I - Investment Cost and II - Taxes/Subsidies -*------------------------------------------------------------------------------ -* [AL] Note that discounting to EOH+1 is imbedded in OBJSCC and OBJSIC - - SUM(OBJ_SUMS(R,T,P), OBJSCC(R,T,P,CUR) * %VART%_NCAP(R,T,P %SWS%)) * OBJ_DCEOH(R,CUR) + -$IF NOT '%VALIDATE%'==YES - SUM(OBJ_SUMS(R,PYR(V),P), OBJSCC(R,V,P,CUR) * NCAP_PASTI(R,V,P)) * OBJ_DCEOH(R,CUR) + -$IF %ETL% == YES - SUM((OBJ_SUMS(R,T,TEG(P)),G_RCUR(R,CUR)), OBJSIC(R,T,P) * %VART%_IC(R,T,P %SWS%)) * OBJ_DCEOH(R,CUR) + - -$IF DEFINED VNRET $BATINCLUDE prepret.dsc OBSALV - -*------------------------------------------------------------------------------ -* Cases III - Decommissioning -*------------------------------------------------------------------------------ -* [AL] Note that discounting to EOH+1 is imbedded in SALV_DEC - - SUM(OBJ_SUMS3(R,T,P), %VART%_NCAP(R,T,P %SWS%) * SALV_DEC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) - + -* Past investments - SUM(OBJ_SUMS3(R,PYR,P), NCAP_PASTI(R,PYR,P) * SALV_DEC(R,PYR,P,CUR)) * OBJ_DCEOH(R,CUR) - + - -*------------------------------------------------------------------------------ -* Cases IV - Decommissioning Surveillance -*------------------------------------------------------------------------------ -* The same proportion SALV_INV is salvaged from investments and surveillance costs - SUM(OBJ_SUMIVS(R,V,P,K,Y)$SALV_INV(R,V,P,K), - OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,V,P,K) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))) - + -*------------------------------------------------------------------------------ -* LATE REVENUES -*------------------------------------------------------------------------------ -* [AL] LATEREVENUES identical to decommissioning, with DCOST replaced by OCOM*VALU -* Revenues are obtained in the proportion 1-SALV_INV of the total revenues - - SUM((OBJ_SUMIII(R,V,P,LL,K,Y),COM)$((NOT Y_EOH(Y))$NCAP_OCOM(R,V,P,COM)), - (1-SALV_INV(R,V,P,LL)) * NCAP_VALU(R,K,P,COM,CUR) * OBJ_DISC(R,Y,CUR) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) * - NCAP_OCOM(R,V,P,COM) / OBJ_DIVIII(R,V,P)) - - - =E= - - %VAR%_OBJ(R,'OBJSAL',CUR %SOW%); - -*$offlisting diff --git a/source/eqobsalv.rpt b/source/eqobsalv.rpt deleted file mode 100644 index c3a7579..0000000 --- a/source/eqobsalv.rpt +++ /dev/null @@ -1,74 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQOBJSALV the objective functions for salvaging -* - Investment Costs -* - Taxes and subsidies on investments -* - Decommissioning -*=============================================================================* -* -*============================================================================== -* Generate Investment equation summing over all active indexes by region and currency -*============================================================================== - -PAR_OBJSAL(RTP(R,V,P),CUR)$RDCUR(R,CUR) = - -*------------------------------------------------------------------------------ -* Cases I - Investment Cost and II - Taxes/Subsidies -*------------------------------------------------------------------------------ -* [AL] Note that discounting to EOH+1 is imbedded in OBJSCC and OBJSIC - - SUM(OBJ_SUMS(R,T(V),P), OBJSCC(R,T,P,CUR) * VAR_NCAP.L(R,T,P)) * OBJ_DCEOH(R,CUR) + - SUM(OBJ_SUMS(R,PYR(V),P), OBJSCC(R,V,P,CUR) * NCAP_PASTI(R,V,P)) * OBJ_DCEOH(R,CUR) + -$IF %ETL% == 'YES' - SUM(OBJ_SUMS(R,T(V),P)$TEG(P), OBJSIC(R,T,P) * VAR_IC.L(R,T,P)) * OBJ_DCEOH(R,CUR) + - -*------------------------------------------------------------------------------ -* Cases III - Decommissioning -*------------------------------------------------------------------------------ -* [AL] Note that discounting to EOH+1 is imbedded in SALV_DEC - - SUM(OBJ_SUMS3(R,T(V),P), VAR_NCAP.L(R,T,P) * SALV_DEC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) + - SUM(OBJ_SUMS3(R,PYR(V),P), NCAP_PASTI(R,V,P) * SALV_DEC(R,V,P,CUR)) * OBJ_DCEOH(R,CUR) + - -*------------------------------------------------------------------------------ -* Cases IV - Decommissioning Surveillance -*------------------------------------------------------------------------------ -* The same proportion SALV_INV is salvaged from investments and surveillance costs - SUM(OBJ_SUMIVS(R,T(V),P,K,Y)$SALV_INV(R,T,P,K), - OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,T,P,K) * VAR_NCAP.L(R,T,P)) + - - SUM(OBJ_SUMIVS(R,PYR(V),P,K,Y)$SALV_INV(R,V,P,K), - OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,V,P,K) * NCAP_PASTI(R,V,P)) - ; - -*------------------------------------------------------------------------------ -* LATE REVENUES -*------------------------------------------------------------------------------ -* [AL] LATEREVENUES identical to decommissioning, with DCOST replaced by OCOM*VALU -* Revenues are obtained in the proportion 1-SALV_INV of the total revenues - - PAR_OBJLAT(R,Y,P,CUR)$(YEARVAL(Y) GT MIYR_VL) = - SUM((OBJ_SUMIII(R,V,P,LL,K,Y),COM)$(NCAP_OCOM(R,V,P,COM)*NCAP_VALU(R,K,P,COM,CUR)), - (1-SALV_INV(R,V,P,LL)) * - OBJ_DISC(R,Y,CUR) * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) * - NCAP_VALU(R,K,P,COM,CUR) * NCAP_OCOM(R,V,P,COM) / OBJ_DIVIII(R,V,P)) - ; - -*------------------------------------------------------------------------------ -PARAMETER PAR_OBJCAP(R,YEAR,PRC,CUR) //; -PARAMETER COEF_OBJINV(R,YEAR,PRC) //; -*------------------------------------------------------------------------------ -* Calculate the effect of a one unit of investment costs to the objective. -* The average undiscounted investment cost equivalent to the reduced cost can be -* calculated for each period by dividing the reduced cost by COEF_OBJINV - OPTION CLEAR=PAR_OBJCAP; - PAR_OBJCAP(OBJ_ICUR(R,T,P,CUR)) = COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * - SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,Y,K), (1-SALV_INV(R,T,P,Y)$OBJ_SUMS(R,T,P)) * OBJ_DISC(R,K,CUR))); - COEF_OBJINV(RTP(R,T,P)) $= SUM(RDCUR(R,CUR),PAR_OBJCAP(RTP,CUR)); - -OPTION CLEAR=OBJ_SUMIV, CLEAR=OBJ_SUMIVS, CLEAR=OBJ_SUMIII; -OPTION CLEAR=OBJ_DIVI, CLEAR=OBJ_DIVIV, CLEAR=OBJ_DIVIII; diff --git a/source/eqpeak.mod b/source/eqpeak.mod deleted file mode 100644 index f4e67b4..0000000 --- a/source/eqpeak.mod +++ /dev/null @@ -1,90 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQPEAK is the basic commodity balance and the production limit constraint -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Questions/Comments: -* - NCAP_PKCNT uses the vintage period ! -* - Even annual level processes contribute to a seasonal peak according to PKCNT -*----------------------------------------------------------------------------- -*$ONLISTING -* - %EQ%_PEAK(%R_T%,CG2,RTS(SL)%SWT%)$(SUM(COM_GMAP(R,CG2,C)$RTC(R,T,C),1)$COM_PKTS(R,CG2,SL)) .. - - SUM((COM_GMAP(R,CG2,C),COM_TS(R,C,S))$RS_FR(R,SL,S), - RS_FR(R,SL,S) * - - (1/(1+MAX(SMAX(COM(CG2),COM_PKRSV(R,T,COM)),COM_PKRSV(R,T,C))))*COM_IE(R,T,C,S)* - - (SUM(RPC_PKC(PRC_CAP(R,P),C), G_YRFR(R,S) * PRC_CAPACT(R,P) * - SUM(V$COEF_CPT(R,V,T,P),COEF_CPT(R,V,T,P)*PRC_ACTFLO(R,V,P,C)*NCAP_PKCNT(R,V,P,S)* - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V) %RCAPSUB%)) - ) + - -* -* production -* -* inter-regional trade to region; processes with PKNO+PKCNT contribute by net imports -$ BATINCLUDE cal_ire.%1 IMP OUT IE '*NCAP_PKCNT(R,V,P,S)' - -$ BATINCLUDE cal_ire.%1 EXP IN IE '*(-NCAP_PKCNT(R,V,P,S)/COM_IE(R,T,C,S))$(COM_IE(R,T,C,S)>0)' - PRC_PKNO( ) - - ( - -*GG*PK no multiplier -*[UR] 25.04.2003 added NCAP_PKCNT multiplier to turn off contribution by setting NCAP_PKCNT to zero -*[AL] 25.01.2007 allow using PKNO to switch process to production-based peak contribution -*[AL] When PKNO=YES no default PKCNT is assigned -> process contributes only if PKCNT set by user - -* storage -$ BATINCLUDE cal_stgn.%1 OUT IN '*STG_EFF(R,V,P)' '' "(NOT PRC_NSTTS(R,P,TS))" '*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))$RPC_PKF(R,P,C)' - -* individual flows -$ BATINCLUDE cal_fflo.%1 OUT O '*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))$RPC_PKF(R,P,C)' - - 0) - -* [UR]: 04/22/2003: adjustment for extraction condensing CHP plants -$IF SET PEAKCHP $BATINCLUDE %PEAKCHP% - )) - - =G= - - SUM((COM_GMAP(R,CG2,C),COM_TS(R,C,S))$RS_FR(R,SL,S), - RS_FR(R,SL,S) * -* Apply the maximum of flexibilities among CG2 an C - (1+MAX(SUM(COM(CG2),COM_PKFLX(R,T,COM,SL)),COM_PKFLX(R,T,C,S)))* - ( - ( -* -* consumption -* -*GG*PK pass TS as timeslice - -* individual flows -$ BATINCLUDE cal_fflo.%1 IN I '*FLO_PKCOI(R,T,P,C,TS)' - -* inter-regional trade from region -$ BATINCLUDE cal_ire.%1 EXP IN IE '*FLO_PKCOI(R,T,P,C,TS)' - - -* capacity related commodity flows -* fixed commodity associated with installed capacity or investment -$ BATINCLUDE cal_cap.%1 IN I '1$(NOT PRC_PKNO(R,P))*' - ) + -* storage -$ BATINCLUDE cal_stgn.%1 IN OUT '' 'STG_EFF(R,V,P)*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" "$(NOT RPC_PKC(R,P,C)*PRC_CAP(R,P))" - -* blending - SUM(BLE_OPR(R,BLE,OPR)$(BLE_INP(R,BLE,C)*BLE_TP(R,T,BLE)),G_YRFR(R,S)*(1+RTCS_FR(R,T,C,S,'ANNUAL'))*BL_INP(R,BLE,C)*PEAKDA_BL(R,BLE,T)*%VAR%_BLND(R,T,BLE,OPR %SOW%)) + - -* demand projection -$IFI %STAGES% == YES $SETLOCAL SWS 'PROD(SW_MAP(T,SOW,J,WW)$S_COM_PROJ(R,T,C,J,WW),S_COM_PROJ(R,T,C,J,WW))*' - ((%SWS% COM_PROJ(R,T,C)$(NOT RD_NLP(R,C)) +%VAR%_DEM(R,T,C%SOW%)$RD_NLP(R,C) +SUM(RD_AGG(R,COM),RD_SHAR(R,T,COM,C)*%VAR%_COMPRD(R,T,COM,'ANNUAL'%SOW%))) * COM_FR%MX%(R,T,C,S))$DEM(R,C) + - -* include the elasticity variables -$IF %TIMESED%==YES SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),-BDSIG(BD)*%VAR%_ELAST(R,T,C,S,J,BD %SOW%)) + - - 0)) ; -*$OFFLISTING diff --git a/source/eqpk_ect.ier b/source/eqpk_ect.ier deleted file mode 100644 index 2506837..0000000 --- a/source/eqpk_ect.ier +++ /dev/null @@ -1,11 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* [UR]: 04/22/2003: adjustment for extraction condensing CHP plants - + SUM(ECT_ELC(ECT_CHP(R,P),C)$((NOT PRC_CAP(R,P)*RPC_PKC(R,P,C))$TOP(R,P,C,'OUT')), -$ BATINCLUDE cal_fflo.mod OUT O '*(-(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C)))$RPC_PKF(R,P,C)' - (G_YRFR(R,S)*SUM(RTP_CPTYR(R,V,T,P),PRC_CAPACT(R,P)* - NCAP_PKCNT(R,V,P,S)*COEF_CPT(R,V,T,P)* - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V))))) diff --git a/source/eqptrans.mod b/source/eqptrans.mod deleted file mode 100644 index 0516a6d..0000000 --- a/source/eqptrans.mod +++ /dev/null @@ -1,41 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQPTRANS is the flow-to-flow transformation constraint -*=============================================================================* -* Questions/Comments: -* - EQ_PTRANS is dropped if substition for FLO_FUNC activated -* - EQ level according to RPS_S1, VAR_FLOs according RPCS_VAR -* - COEF_PTRAN created in coef_ptr.mod -*----------------------------------------------------------------------------- -*$ONLISTING -$SET SHP1 "" SET SHG ",P,COM_GRP,CG" -$IF DEFINED RTP_FFCS $SET SHP1 "*(%SHFF%S(R,V%SHG%%SOW%))" -$SET SHP1 "*(%SHFF%X(R,V,T%SHG%)$PRC_VINT(R,P))%SHP1%" -*----------------------------------------------------------------------------- - - %EQ%_PTRANS(RTP_VINTYR(%R_V_T%,P),COM_GRP,CG,RTS(S)%SWT%)$((RPS_S1(R,P,S) * RP_STD(R,P) * -* All valid tuples are in RPCC_FFUNC (REDUCE taken into account); all STG excluded - SUM((RPC(R,P,C),RS_TREE(R,S,TS))$COEF_PTRAN(R,V,P,COM_GRP,C,CG,TS),1))$RPCC_FFUNC(R,P,COM_GRP,CG)).. - -* dependent commodities - consider that the commodity may have a COM_TS shape - SUM((COM_GMAP(R,CG,C),RS_TREE(R,S,TS))$RTPCS_VARF(R,T,P,C,TS), - RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) * -* [UR] model reduction %REDUCE% is set in *.run -$ BATINCLUDE %cal_red% C COM TS P T - ) - - =E= - -* control commodities - SUM((RTPCS_VARF(R,T,P,C,TS),RS_TREE(R,S,TS))$COEF_PTRAN(R,V,P,COM_GRP,C,CG,TS), - COEF_PTRAN(R,V,P,COM_GRP,C,CG,TS) * - RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) * -* [UR] model reduction %REDUCE% is set in *.run -$ BATINCLUDE %cal_red% C COM TS P T - ) %SHP1% * (1+(ACT_FLO(R,V,P,CG,S)-1$ACT_FLO(R,V,P,CG,S))$PRC_CG(R,P,COM_GRP)) - ; - -*$OFFLISTING diff --git a/source/eqstgaux.lin b/source/eqstgaux.lin deleted file mode 100644 index 77d220b..0000000 --- a/source/eqstgaux.lin +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQSTGAUX auxiliary commodities for storage -*=============================================================================* -*AL Questions/Comments: -* Assumption is that all auxiliary flows are at PRC_TS level; NST primary flows can be also above -*-----------------------------------------------------------------------------* -*$ONLISTING - - - %EQ%_STGAUX(RTP_VINTYR(%R_V_T%,P),C,RTS(S)%SWT%)$((RPCS_VAR(R,P,C,S)*(NOT RPC_STG(R,P,C)+RPC_EMIS(R,P,C)))$RP_STG(R,P)).. - -* Auxiliary flow variable - %VAR%_FLO(R,V,T,P,C,S %SOW%) - - =E= - -* flow depends on storage level in period T - SUM(ANNUAL(SL),PRC_ACTFLO(R,V,P,C) * - ( - SUM(PRC_TS(R,P,TS)$TS_MAP(R,TS,S),%VAR%_ACT(R,V,T,P,TS %SOW%)/RS_STGPRD(R,TS)) * G_YRFR(R,S) - -* subtract in- and output flows to/from storage during latter half of milestone year - SUM(TOP(PRC_STGIPS(R,P,COM),IO), 0.5 * - (%VAR%_SIN(R,V,T,P,COM,SL%SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,COM,SL%SOW%)$(NOT IPS(IO))) / PRC_ACTFLO(R,V,P,COM) * -* storage losses (assume that Inflows and outflows occur at the mid-point of each year) - ((1-STG_LOSS(R,V,P,SL))**0.5)) -* For IPS, MID storage level is (1-LOSS)**(0.5) higher - ) * (1+((1-STG_LOSS(R,V,P,SL))**(-0.5)-1)$PRC_MAP(R,'STK',P))) + - -* flow depends on storage in- or outflow in period T - SUM((COM_GMAP(R,CG,COM),TOP(RPC_STG(R,P,COM),'IN'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,COM,C,TS), - (%VAR%_SIN(R,V,T,P,COM,TS %SOW%) * COEF_PTRAN(R,V,P,CG,COM,C,TS))$((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS)) * - RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) + - SUM((COM_GMAP(R,CG,C),TOP(RPC_STG(R,P,COM),'OUT'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,C,COM,S), - (%VAR%_SOUT(R,V,T,P,COM,TS %SOW%) * (1/COEF_PTRAN(R,V,P,CG,C,COM,S)))$(PRC_NSTTS(R,P,TS) EQV RPC_STGN(R,P,COM,'OUT')) * - RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) - -; - -$OFFLISTING diff --git a/source/eqstgaux.mod b/source/eqstgaux.mod deleted file mode 100644 index c4fd459..0000000 --- a/source/eqstgaux.mod +++ /dev/null @@ -1,44 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQSTGAUX auxiliary commodities for storage -*=============================================================================* -*AL Questions/Comments: -* Assumption is that all auxiliary flows are at PRC_TS level; NST primary flows can be also above -*-----------------------------------------------------------------------------* -*$ONLISTING - - - %EQ%_STGAUX(RTP_VINTYR(%R_V_T%,P),C,RTS(S)%SWT%)$((RPCS_VAR(R,P,C,S)*(NOT RPC_STG(R,P,C)+RPC_EMIS(R,P,C)))$RP_STG(R,P)).. - -* Auxiliary flow variable - %VAR%_FLO(R,V,T,P,C,S %SOW%) - - =E= - -* flow depends on storage level in period T - SUM(ANNUAL(SL),PRC_ACTFLO(R,V,P,C) * - ( - SUM(PRC_TS(R,P,TS)$TS_MAP(R,TS,S),%VAR%_ACT(R,V,T,P,TS %SOW%)/RS_STGPRD(R,TS)) * G_YRFR(R,S) - -* subtract in- and output flows to/from storage during latter half of period (from middle of M(T)) - SUM(TOP(PRC_STGIPS(R,P,COM),IO), - (%VAR%_SIN(R,V,T,P,COM,SL%SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,COM,SL%SOW%)$(NOT IPS(IO)))/PRC_ACTFLO(R,V,P,COM)) * - SUM(PERIODYR(T,Y_EOH)$(YEARVAL(Y_EOH) GE M(T)), -* storage losses (assume that Inflows and outflows occur at the mid-point of each year) - MIN(1,YEARVAL(Y_EOH)-M(T)+MAX(0,M(T)+D(T)/2-E(T))) * ((1-STG_LOSS(R,V,P,SL))**(E(T)-YEARVAL(Y_EOH)+0.5))) -* For IPS, MID storage level is (1-LOSS)**(E(T)-M(T)+0.5) higher - ) * (1+((1-STG_LOSS(R,V,P,SL))**(M(T)-E(T)-MIN(0.5,MAX(0,M(T)+D(T)/2-E(T))))-1)$PRC_MAP(R,'STK',P))) + - -* flow depends on storage in- or outflow in period T - SUM((COM_GMAP(R,CG,COM),TOP(RPC_STG(R,P,COM),'IN'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,COM,C,TS), - (%VAR%_SIN(R,V,T,P,COM,TS %SOW%) * COEF_PTRAN(R,V,P,CG,COM,C,TS))$((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS)) * - RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) + - SUM((COM_GMAP(R,CG,C),TOP(RPC_STG(R,P,COM),'OUT'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,C,COM,S), - (%VAR%_SOUT(R,V,T,P,COM,TS %SOW%) * (1/COEF_PTRAN(R,V,P,CG,C,COM,S)))$(PRC_NSTTS(R,P,TS) EQV RPC_STGN(R,P,COM,'OUT')) * - RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) - -; - -$OFFLISTING diff --git a/source/eqstgflo.mod b/source/eqstgflo.mod deleted file mode 100644 index b48c131..0000000 --- a/source/eqstgflo.mod +++ /dev/null @@ -1,31 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQSTGFLO limits the flow of storage process at flow TS-level or higher -* %1 - IN/OUT -* %2 - equation declaration type -* %3 - bound type for %2 -* %4 - qualifier that bound exists -*=============================================================================* -*GaG Questions/Comments: -* - Bound TS restricted to the PRC_TS level or above -* - avoid equations if LO=0/UP=INF -*----------------------------------------------------------------------------- -$SET TMP (NOT PRC_MAP(R,'NST',P))+ -$IF %1==OUT $SET TMP NOT -*$ONLISTING - - %EQ%%2_STG%1(RTPC(%R_T%,P,C),S %SWT%)$((STG%1_BND(R,T,P,C,S,'%3') NE %4)$(PRC_VINT(R,P)+(NOT RPCS_VAR(R,P,C,S))) - $RPS_PRCTS(R,P,S)$RPC_STG(R,P,C)$STG%1_BND(R,T,P,C,S,'%3')) .. - -* sum over all possible flow variables at process TS-level - SUM(RPCS_VAR(R,P,C,TS)$(RS_FR(R,S,TS) * (%TMP% PRC_NSTTS(R,P,TS))), - SUM(RTP_VINTYR(R,V,T,P),%VAR%_S%1(R,V,T,P,C,TS %SOW%)*RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) - - =%2= - - STG%1_BND(R,T,P,C,S,'%3') - ; -*$OFFLISTING diff --git a/source/eqstgips.lin b/source/eqstgips.lin deleted file mode 100644 index d508c23..0000000 --- a/source/eqstgips.lin +++ /dev/null @@ -1,68 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQSTGIPS Inter-Period Storage (IPS) and TIME-Slice Storage (TSS) * -*=============================================================================* -*AL Questions/Comments: -* v2.6.0: VART redefined locally for stochastic mode -*-----------------------------------------------------------------------------* -*$ONLISTING - SET RTP_EQSTK(R,ALLYEAR,T,P,ITEM); -* Charge at beginning of horizon (BOH) - RTP_EQSTK(R,MIYR_1(T),T,P,'IN')$(RTP(R,T,P)$PRC_MAP(R,'STK',P)) = YES; -* Normal storage balance in each period (N) - RTP_EQSTK(RTP_VINTYR(R,V,T,P),'N')$PRC_MAP(R,'STK',P) = YES; -* We must ensure that the storage level is non-negative at end of each period (1) - RTP_EQSTK(RTP_VINTYR(R,V,T,P),'1')$((E(T) GT M(T))$PRC_MAP(R,'STK',P)) = YES; -*------------------------------------------------------------------------------ - - %EQ%_STGIPS(RTP_EQSTK(%R_V_T%,P,ITEM) %SWT%)$(SUM(PRC_STGIPS(R,P,C),1)$PRC_MAP(R,'STK',P)) .. - -* storage level at the milestone year T - %VAR%_ACT(R,V,T,P,'ANNUAL' %SOW%)$LIM(ITEM) + - SUM((IO(ITEM),MODLYEAR,MIYR_1(LL))$RTP_VINTYR(R,MODLYEAR,T,P), - %VAR%_ACT(R,MODLYEAR,LL-LEAD(LL),P,'ANNUAL' %SOW%)) - - =E= - - SUM(TOP(PRC_STGIPS(R,P,C),IO), - - SUM(TT(T-1), -* storage level at the milestone year TT, corrected with storage losses - (%VARTT%_ACT(R,V,TT,P,'ANNUAL'%SWS%)*POWER(1-STG_LOSS(R,V,P,'ANNUAL'),LEAD(T))$IPS(IO) + -* Add in- and output flows to/from storage related to period TT - SUM(PERDINV(T,Y_EOH),TPULSE(TT,Y_EOH)*((1-STG_LOSS(R,V,P,'ANNUAL'))**(M(T)-YEARVAL(Y_EOH)+0.5)))/PRC_ACTFLO(R,V,P,C) * - (%VARTT%_SIN(R,V,TT,P,C,'ANNUAL'%SWS%)$IPS(IO) - %VARTT%_SOUT(R,V,TT,P,C,'ANNUAL'%SWS%)$(NOT IPS(IO))))$(RTP_VINTYR(R,V,TT,P)$PRC_VINT(R,P)) + -* storage level at the milestone year TT, corrected with storage losses - (%VARTT%_ACT(R,TT,TT,P,'ANNUAL'%SWS%)*POWER(1-STG_LOSS(R,V,P,'ANNUAL'),LEAD(T))$IPS(IO) + -* Add in- and output flows to/from storage related to period TT - SUM(PERDINV(T,Y_EOH),TPULSE(TT,Y_EOH)*((1-STG_LOSS(R,V,P,'ANNUAL'))**(M(T)-YEARVAL(Y_EOH)+0.5)))/PRC_ACTFLO(R,TT,P,C) * - (%VARTT%_SIN(R,TT,TT,P,C,'ANNUAL'%SWS%)$IPS(IO) - %VARTT%_SOUT(R,TT,TT,P,C,'ANNUAL'%SWS%)$(NOT IPS(IO))))$(RTP_VINTYR(R,TT,TT,P)$(NOT PRC_VINT(R,P)))) + - -* in- and output flows to/from storage related to period T -* [AL] Summing over PERDINV years, as the activity is measured at M(T) -* [AL] Inflows and outflows occur, on average, at the mid-point of each year - SUM(PERDINV(T,Y_EOH),TPULSE(T,Y_EOH)*((1-STG_LOSS(R,V,P,'ANNUAL'))**(M(T)-YEARVAL(Y_EOH)+0.5)))$RTP_VINTYR(R,V,T,P) * - (%VAR%_SIN(R,V,T,P,C,'ANNUAL' %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,'ANNUAL' %SOW%)$(NOT IPS(IO))) / PRC_ACTFLO(R,V,P,C) - )$LIM(ITEM) + - -* [AL] In the first period VAR_ACT is not available, but exogenous charge can be used - SUM(VNT(T,MIYR_1(LL)),%VAR%_ACT(R,V,LL-LEAD(LL),P,'ANNUAL' %SOW%) * - POWER(1-STG_LOSS(R,V,P,'ANNUAL'),LEAD(T)))$LIM(ITEM) + - -* Exogenous charge at BOH - SUM((IO(ITEM),MIYR_1(LL)),STG_CHRG(R,LL-LEAD(LL),P,'ANNUAL')) + -* Minimum storage balance at end-of-period - (%VAR%_ACT(R,V,T,P,'ANNUAL'%SOW%) * POWER(1-STG_LOSS(R,V,P,'ANNUAL'),E(T)-M(T)) - - SUM((MIYR_1(LL),Y_EOH(LL+(E(T)-YEARVAL(LL)))),%VAR%_ACT(R,V,Y_EOH,P,'ANNUAL'%SOW%)) + -* in- and output flows to/from storage - SUM(TOP(PRC_STGIPS(R,P,C),IO), - SUM(PERIODYR(T,Y_EOH)$(YEARVAL(Y_EOH) GT M(T)),((1-STG_LOSS(R,V,P,'ANNUAL'))**(E(T)-YEARVAL(Y_EOH)+0.5))) * -* half year's correction if LAGT is even - (1+((LAGT(T)-1)/2/(E(T)-M(T))-1)$(E(T) < MIYR_VL)) / PRC_ACTFLO(R,V,P,C) * - (%VAR%_SIN(R,V,T,P,C,'ANNUAL' %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,'ANNUAL' %SOW%)$(NOT IPS(IO)))))$J(ITEM) -; -$OFFLISTING - diff --git a/source/eqstgips.mod b/source/eqstgips.mod deleted file mode 100644 index effb690..0000000 --- a/source/eqstgips.mod +++ /dev/null @@ -1,46 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQSTG Inter-Period Storage (IPS) and TIME-Slice Storage (TSS) * -*=============================================================================* -*UR Questions/Comments: -* -*-----------------------------------------------------------------------------* -*$ONLISTING - - %EQ%_STGIPS(RTP_VINTYR(%R_V_T%,P),IPS %SWT%)$(((MIYR_1(V)*MIYR_1(T)+LIM(IPS))*SUM(PRC_STGIPS(R,P,C),1))$PRC_MAP(R,'STK',P)) .. - -* storage level in the end of period T - %VAR%_ACT(R,V,T,P,'ANNUAL' %SOW%)$LIM(IPS) + - SUM((IO(IPS),MODLYEAR,MIYR_1(LL))$RTP_VINTYR(R,MODLYEAR,T,P), - %VAR%_ACT(R,MODLYEAR,LL-LEAD(LL),P,'ANNUAL' %SOW%)) - - =E= - - ( -* storage level in the end of period T-1 - (SUM(TT(T-1), - (%VARTT%_ACT(R,V,TT,P,'ANNUAL'%SWS%)$RTP_VINTYR(R,V,TT,P))$PRC_VINT(R,P) + - (%VARTT%_ACT(R,TT,TT,P,'ANNUAL'%SWS%)$RTP_VINTYR(R,TT,TT,P))$(NOT PRC_VINT(R,P))) + -* [AL] In the first period VAR_ACT is not available, but exogenous charge can be used - SUM(MIYR_1(LL),%VAR%_ACT(R,V,LL-LEAD(LL),P,'ANNUAL' %SOW%))$MIYR_1(T)) * -* storage losses -* [AL] Initial storage level/charge is reduced to (1-LOSS)**D(T) during the period - POWER(1-STG_LOSS(R,V,P,'ANNUAL'),D(T)) + - -* in- and output flows to/from storage -* [AL] Added summing over PERIODYR, as the storage operates during the whole period - SUM(TOP(PRC_STGIPS(R,P,C),IO), - (%VAR%_SIN(R,V,T,P,C,'ANNUAL' %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,'ANNUAL' %SOW%)$(NOT IPS(IO))) * -* storage losses -* [AL] Inflows and outflows occur, on average, at the mid-point of each year - SUM(PERIODYR(T,Y_EOH),((1-STG_LOSS(R,V,P,'ANNUAL'))**(E(T)-YEARVAL(Y_EOH)+0.5))) / PRC_ACTFLO(R,V,P,C) - ) - )$LIM(IPS) + -* Exogenous charge at BOH - SUM((IO(IPS),MIYR_1(LL)),STG_CHRG(R,LL-LEAD(LL),P,'ANNUAL')) -; -$OFFLISTING - diff --git a/source/eqstgtss.mod b/source/eqstgtss.mod deleted file mode 100644 index 24b7a91..0000000 --- a/source/eqstgtss.mod +++ /dev/null @@ -1,99 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* EQSTGTSS TIME-Slice Storage (TSS) and general storage (STS) -*=============================================================================* -* Questions/Comments: -* - the storage level does NOT need to be fixed to an initial storage level in some TS -*-----------------------------------------------------------------------------* -*$ONLISTING - - %EQ%_STGTSS(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWT%)$(RPS_STG(R,P,S)$RP_STG(R,P)).. - -* storage level in time-slice s - %VAR%_ACT(R,V,T,P,S %SOW%) - - =E= - - SUM(RPS_STG(R,P,ALL_TS(S--RS_STG(R,S))), -* storage level in time-slice s - %VAR%_ACT(R,V,T,P,ALL_TS%SOW%) - + -* for day-night storage; allow flow variable at or above ALL_TS - ( - SUM((RPCS_VAR(RPC_STG(R,P,C),TS),TS_MAP(R,TS,ALL_TS)), - (%VAR%_SIN(R,V,T,P,C,TS%SOW%)$(TOP(R,P,C,'IN')$PRC_NSTTS(R,P,TS)) - - %VAR%_SOUT(R,V,T,P,C,TS%SOW%)$(TOP(R,P,C,'OUT')$(PRC_NSTTS(R,P,TS) EQV RPC_STGN(R,P,C,'OUT')))) * - RS_FR(R,ALL_TS,TS) * (1+RTCS_FR(R,T,C,ALL_TS,TS)) / PRC_ACTFLO(R,V,P,C)) - )$PRC_MAP(R,'NST',P) - + -* for storage processes without charging restriction - SUM(TOP(PRC_STGTSS(R,P,C),'IN'),%VAR%_SIN(R,V,T,P,C,ALL_TS%SOW%)/PRC_ACTFLO(R,V,P,C)) - - SUM(TOP(PRC_STGTSS(R,P,C),'OUT'),%VAR%_SOUT(R,V,T,P,C,ALL_TS%SOW%)/PRC_ACTFLO(R,V,P,C)) - - -* optional balancer flow - SUM(PRC_TS(R,P,TS)$RS_BELOW1(R,TS,S),%VAR%_SOUT(R,V,T,P,%PGPRIM%,TS%SOW%)*RS_FR(R,ALL_TS,TS))$RP_STS(R,P) - - -* storage losses: average storage level per cycle * loss fraction by cycle * cycles - %VAR%_ACT(R,V,T,P,ALL_TS%SOW%) * MAX(STG_LOSS(R,V,P,ALL_TS)/2, -* equilibrium loss (STG_LOSS<0): Act0 * (1-Loss/(1/EXP(-Loss)-1)) - (1+(STG_LOSS(R,V,P,ALL_TS))/(1/EXP(STG_LOSS(R,V,P,ALL_TS))-1)))$STG_LOSS(R,V,P,ALL_TS) - - %VAR%_ACT(R,V,T,P,S%SOW%) * MAX(STG_LOSS(R,V,P,ALL_TS)/2, -* equilibrium loss (STG_LOSS<0): Act1 * (-Loss/(EXP(-Loss)-1)-1) - ((STG_LOSS(R,V,P,ALL_TS))/(EXP(STG_LOSS(R,V,P,ALL_TS))-1)-1))$STG_LOSS(R,V,P,ALL_TS) - ) -* storage charge - + STG_CHRG(R,T,P,S--RS_STG(R,S)) - - ; - - -*--- Balancer Equation --- - - %EQ%_STSBAL(RTP_VINTYR(%R_V_T%,P),TSL,RTS(S),L%SWT%)$(TS_GROUP(R,TSL,S)$PRC_TS(R,P,S)$RP_STL(R,P,TSL,L)).. - -* storage level in time-slice s - SUM(RS_BELOW(R,ANNUAL,S),%VAR%_ACT(R,V,T,P,S%SOW%)+(%VAR%_SIN(R,V,T,P,%PGPRIM%,S%SOW%)+VAR_STS(R,V,T,P,S,'N'))$RP_STL(R,P,TSL,'UP')) - - =E= - - SUM(RS_BELOW(R,ANNUAL,SL(S--RS_STG(R,S))), -* storage level in time-slice s - %VAR%_ACT(R,V,T,P,SL%SOW%)$IPS(L) + %VAR%_UDP(R,V,T,P,SL,'LO'%SOW%)$BD(L) + - (%VAR%_SIN(R,V,T,P,%PGPRIM%,SL%SOW%)+VAR_STS(R,V,T,P,SL,L))$RP_STL(R,P,TSL,'UP') - + -* balancer flows - (%VAR%_SOUT(R,V,T,P,%PGPRIM%,SL%SOW%) - - SUM(PRC_TS(R,P,TS)$RS_BELOW1(R,TS,S),%VAR%_SOUT(R,V,T,P,%PGPRIM%,TS%SOW%)*RS_FR(R,SL,TS)) - - -* storage losses: average storage level * year fraction * loss fraction - (%VAR%_ACT(R,V,T,P,SL%SOW%)$RS_STG(R,S)) * MAX(STG_LOSS(R,V,P,SL)/2, -* equilibrium loss (STG_LOSS<0): Act0 * (1-Loss/(1/EXP(-Loss)-1)) - (1+STG_LOSS(R,V,P,SL)/(1/EXP(STG_LOSS(R,V,P,SL))-1)))$STG_LOSS(R,V,P,SL) - - (%VAR%_ACT(R,V,T,P,S%SOW%)$RS_STG(R,S)+(%VAR%_SIN(R,V,T,P,%PGPRIM%,S%SOW%)-%VAR%_SIN(R,V,T,P,%PGPRIM%,SL%SOW%))$RP_STL(R,P,TSL,'UP')) * -* equilibrium loss (STG_LOSS<0): Act1 * (-Loss/(EXP(-Loss)-1)-1) - MAX(STG_LOSS(R,V,P,SL)/2, (STG_LOSS(R,V,P,SL)/(EXP(STG_LOSS(R,V,P,SL))-1)-1))$STG_LOSS(R,V,P,SL) - )$IPS(L)) - + - SUM(ANNUAL(S), -* net charging into IPS - SUM(TOP(PRC_STGIPS(R,P,C),IO), 1 / PRC_ACTFLO(R,V,P,C) * - %VAR%_SIN(R,V,T,P,C,S %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,S %SOW%)$(NOT IPS(IO))) - -* balancer flow - %VAR%_SOUT(R,V,T,P,%PGPRIM%,S%SOW%)) - - ; - - -*--- Levelizer Equation --- - - EQ_STSLEV(RTP_VINTYR(%R_V_T%,P),TSL,RTS(S)%SWX%)$((STOAL(R,S)=PRC_SGL(R,P))$TS_GROUP(R,TSL,S)$RP_STL(R,P,TSL,'UP')).. - -* Sum of levelizers must be less than average variation over S - SUM(TS_MAP(R,TS,S)$STOA(TS),(%VAR%_SIN(R,V,T,P,%PGPRIM%,TS%SOW%)+%VAR%_UDP(R,V,T,P,TS,'LO'%SOW%)+VAR_STS(R,V,T,P,TS,'N'))/RS_STGPRD(R,TS)) - =L= - SUM(RS_BELOW1(R,S,TS)$RS_FR(R,TS,S),%VAR%_ACT(R,V,T,P,TS%SOW%)/RS_STGPRD(R,TS)*RS_FR(R,TS,S)); - -*$OFFLISTING \ No newline at end of file diff --git a/source/equ_ext.abs b/source/equ_ext.abs deleted file mode 100644 index 03612e8..0000000 --- a/source/equ_ext.abs +++ /dev/null @@ -1,203 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================= -* EQU_EXT.abs - Extension for Ancillery Balancing Services -*----------------------------------------------------------------------------- -* ABS Final pre-processing -*----------------------------------------------------------------------------- -$IFI NOT %OBMAC%==YES $EXIT -* Adjust equation controls - BS_UPL(RP_UPL(BS_SUPP,BDNEQ))=YES; - BS_UPC(PRC_TSL(BS_SUPP(R,P),TSL),BDNEQ)$SUM(BS_BSC(R,P,C)$(ABS(BS_RTYPE(R,C))>2),1)$=RP_UPS(R,P,TSL,'UP'); - RP_UPL(BS_UPL)=NO; - RP_UPC(BS_UPC)=NO; -* Activate capacity equations - OPTION TRACKP=TS_CYCLE(R,S)*24$(F>1))$(RPS_UPS(R,P,S) OR (STOAL(R,S)*SIGN(Z)<2)),UNCD7(RTP,S,RTP)=YES)); - LOOP(UNCD7(RTP,S,R,T,P),RPS_UPS(R,P,TS)$(STOAL(R,TS)=1)=YES; BS_MAINT(RTP,TS)$RS_TREE(R,S,TS)=EPS$(BS_MAINT(RTP,TS)>=0)$BS_MAINT(RTP,TS)); - -*----------------------------------------------------------------------------- -* Variable macros -$ macro var_bson(r,v,t,p,s) sum(ts_map(r,all_ts,s)$(rs_below1(r,all_ts,s)+annual(s)),var_gap(r,v,t,p,all_ts)+(%var%_ups(r,v,t,p,all_ts,'FX'%SOW%)-var_off(r,v,t,p,s))$rps_ups(r,p,s)) -$ macro var_bsd(typ,rtc,s) %var%_comlv(typ,rtc,s%SOW%) -$ macro var_bsmup(r,v,t,p,s) %var%_bsprs(r,v,t,p,%PGPRIM%,s,'N'%SOW%) -$ macro var_bsfsp(r,v,t,p,c,s) %var%_bsprs(r,v,t,p,c,s,'N'%SOW%) -$ macro var_bsfnsp(r,v,t,p,c,s) %var%_bsprs(r,v,t,p,c,s,'FX'%SOW%) -$ macro var_bsupsr(r,v,t,p,s,bd) %var%_bsprs(r,v,t,p,%PGPRIM%,s,bd%SOW%) -$ macro var_bslack(r,t,p,c,s) %var%_bsprs(r,t,t,p,c,s,'UP'%SOW%) -* Capacity-CPT expression -$SET TMP SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P)*(%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)%RCAPSBM%)) - -*----------------------------------------------------------------------------- -* ABS Equation Formulations - numbers refer to document (00=01) -*----------------------------------------------------------------------------- -* ABSEQ1 : Demands for reserves - EQ_BS00(RTC(%R_T%,C),RTS(S)%SWX%)$(%SWTX%BS_OMEGA(R,'0',C,S)$BS_LAMBDA(RTC)).. - SUM(RHS_COMBAL(RTC,TS)$TS_MAP(R,TS,S),%VAR%_COMPRD(RTC,TS%SOW%)/G_YRFR(R,TS)) - =L= -* Supply (converted to common flow units, as also demand) - SUM((RHS_COMBAL(RTC,SL),TS_MAP(R,SL,S))$BS_OMEGA(RTC,SL), - SUM(RTP_VINTYR(R,V,T,P)$(BS_BSC(R,P,C)+YES$BS_STIME(R,P,C,'UP')),PRC_CAPACT(R,P) * - SUM(BS_PRS(R,P,TS)$RS_FR(R,S,TS),(VAR_BSFSP(R,V,T,P,C,TS)+SUM(BS_SUPP(R,P)$(ABS(BS_RTYPE(R,C))>2),VAR_BSFNSP(R,V,T,P,C,TS)))*RS_FR(R,TS,S)))); -*----------------------------------------------------------------------------- -* ABSEQ1+: Max and ABS(diff) and Share equations - EQ_BS01(RHS_COMBAL(RTC(%R_T%,C),RTS(S)),BS_K,L%SWX%)$(%SWTX%(BS_OMEGA(RTC,S)<>2$IPS(L))$BS_SHARE(RTC,BS_K,L)$BS_OMEGA(RTC,S)).. - SUM(BD(LIM(BS_K)),%VAR%_COMNET(RTC,S%SOW%)/G_YRFR(R,S) - BS_LAMBDA(RTC) * - (VAR_BSD('PRB',RTC,S)$BDUPX(BD)-VAR_BSD('DET',RTC,S)$BDLOX(BD))$(BS_OMEGA(RTC,S)<2) - - ((VAR_BSD('PRB',RTC,S)-VAR_BSD('DET',RTC,S))*BDSIG(BD))$(BS_OMEGA(RTC,S)>2))$IPS(L) + - SUM(BD(L), -* Supply by group - SUM(RTP_VINTYR(R,V,T,P)$((BS_BSC(R,P,C)+YES$BS_STIME(R,P,C,'UP'))$GR_GENMAP(R,P,BS_K)),PRC_CAPACT(R,P) * - SUM(BS_PRS(R,P,TS)$RS_FR(R,S,TS),(VAR_BSFSP(R,V,T,P,C,TS)+SUM(BS_SUPP(R,P)$(ABS(BS_RTYPE(R,C))>2),VAR_BSFNSP(R,V,T,P,C,TS)))*RS_FR(R,TS,S))) - -* Share in demand - BS_SHARE(RTC,BS_K,L)*%VAR%_COMNET(RTC,S%SOW%)/G_YRFR(R,S))*BDSIG(L) - =G= 0; -*----------------------------------------------------------------------------- -* ABSEQ2 : Loads by source of imbalance for each user category k - EQ_BS02(%R_T%,RTS(S),BS_K%SWX%)$(%SWTX%SUM(BS_SBD(FINEST(R,S),BD),1)$BS_RTK(R,T,BS_K)).. - SUM(BS_TOP(RP_STD(R,P),C,IO)$GR_GENMAP(R,P,BS_K), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), -$ BATINCLUDE %cal_red% C COM TS P T - * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) + - SUM(RPC_STG(R,P,C)$GR_GENMAP(R,P,BS_K),SIGN(GR_GENMAP(R,P,BS_K))* - SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))* - SUM(BS_TOP(R,P,C,'OUT'),V_U(SOUT,R,V,T,P,C,TS)*STG_EFF(R,V,P))-SUM(BS_TOP(R,P,C,'IN'),V_U(SIN,R,V,T,P,C,TS)))) + - SUM(RPC_IRE(R,P,C,IE)$(NRG_TMAP(R,'ELC',C)$GR_GENMAP(R,P,BS_K)),SIGN(GR_GENMAP(R,P,BS_K))* - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), - (%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C))* - (1-2$XPT(IE)) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) - =E= %VAR%_RLD(R,T,S,BS_K%SOW%)*G_YRFR(R,S); -*----------------------------------------------------------------------------- -* ABSEQ3 : Stochastic or combined demand with variances - EQ_BS03(RTC(%R_T%,C),RTS(S)%SWX%)$(%SWTX%FINEST(R,S)$BS_LAMBDA(RTC)).. - SUM((RTCS_VARC(RTC,TS),TS_MAP(R,TS,S))$BS_OMEGA(RTC,TS), - (BS_LAMBDA(RTC)*VAR_BSD('PRB',RTC,TS))$(BS_OMEGA(RTC,TS)<>2) + - (%VAR%_COMNET(RTC,TS%SOW%)/G_YRFR(R,TS)-BS_LAMBDA(RTC)*VAR_BSD('DET',RTC,TS)*BS_DETWT(RTC))$(BS_OMEGA(RTC,TS)=2) - - BS_LAMBDA(RTC)*(1-BS_DETWT(RTC)$(BS_OMEGA(RTC,TS)=2))*BS_DELTA(RTC,TS)*3*SUM(BS_RTK(R,T,BS_K),BS_SIGMA(RTC,BS_K,S)*%VAR%_RLD(R,T,S,BS_K%SOW%))) - =G= 0; -*----------------------------------------------------------------------------- -* ABSEQ4 : Deterministic demand - EQ_BS04(RHS_COMBAL(RTC(%R_T%,C),RTS(S)),P%SWX%)$(%SWTX%RTP(R,T,P)$GR_GENMAP(R,P,'SI')$BS_OMEGA(RTC,S)).. - VAR_BSD('DET',RTC,S) - =G= - BS_RTCS('EXOGEN',RTC,S)*BS_CAPACT(R) + PRC_CAPACT(R,P) * - BS_RTCS('WMAXSI',RTC,S)*SUM(RTP_VINTYR(R,V,T,P),(%TMP%)*SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),SUM(BDUPX(BD),COEF_AF%MX%(R,V,T,P,TS,BD))*RS_FR(R,TS,S))); -*----------------------------------------------------------------------------- -* ABSEQ5-6 : Minimum online and offline times (adjusted) - EQ_BS05(RTP_VINTYR(%R_V_T%,P),TSL,BD(L),RTS(S)%SWX%)$(%SWTX%TS_GROUP(R,TSL,S)$BS_UPC(R,P,TSL,L)).. - SUM((RS_UP(R,S,JS),RJ_SL(R,JS,SL)), - V_U(UPS,R,V,T,P,SL,L)$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/2+1/JS_CCL(R,JS),1/JS_CCL(R,JS))2),VAR_BSFNSP(R,V,T,P,C,S)$BS_BSC(R,P,C)$BS_COMTS(R,C,S)); -*----------------------------------------------------------------------------- -* ABSEQ19,21 : Limit the provision of TRT & RRR reserves according to quick start-up / shut-down capacity - EQ_BS19(RTP_VINTYR(%R_V_T%,P),C,RTS(S),BD%SWX%)$(%SWTX%(ABS(BS_RTYPE(R,C))>2)$BS_PRS(R,P,S)$BS_SUPP(R,P)$BS_BSC(R,P,C)$BS_ABD(R,C,BD)).. - SUM(BS_ABD(R,COM,BD)$(MOD(ABS(BS_RTYPE(R,COM))-1,BS_RTYPE(R,C))>1),VAR_BSFNSP(R,V,T,P,COM,S)$BS_BSC(R,P,COM)$BS_COMTS(R,COM,S)) - =L= VAR_BSUPSR(R,V,T,P,S,BD)$RPS_UPS(R,P,S) * SUM(TS_ANN(S,TS),BS_RMAX(R,V,P,C,TS))$BS_COMTS(R,C,S); -*----------------------------------------------------------------------------- -* ABSEQ22 : Ensure sufficient storage level when contracted to reserve - EQ_BS22(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_STGP(R,P)$COEF_AFUPS(R,V,P,S)$RPS_STG(R,P,S)).. -* storage: for single-day (true) activity divide by cycles under parent - SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),%VAR%_ACT(R,V,T,P,TS%SOW%)*RS_FR(R,TS,S)/RS_STGPRD(R,TS))$BS_SBD(R,S,'UP') - =G= - SUM(BS_COMTS(BS_APOS(R,C),S),PRC_CAPACT(R,P)/SQRT(STG_EFF(R,V,P)) / 8760 * - VAR_BSFSP(R,V,T,P,C,S)*(BS_STIME(R,P,C,'LO')/2 +(BS_STIME(R,P,C,'UP')-BS_STIME(R,P,C,'LO'))*MAX(1,G_YRFR(R,S)/RS_STGPRD(R,S)*8760/(1+BS_STIME(R,P,C,'UP'))**0.5))); -*----------------------------------------------------------------------------- -* ABSEQ23 : Limit storage level by capacity and contracted reserve - EQ_BS23(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_STGP(R,P)$COEF_AFUPS(R,V,P,S)$RPS_STG(R,P,S)).. -* storage: for single-day (true) activity divide by cycles under parent - SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),%VAR%_ACT(R,V,T,P,TS%SOW%)*RS_FR(R,TS,S)/RS_STGPRD(R,TS)) - =L= -* available process capacity - vintaged or not - ((%TMP%)*COEF_AFUPS(R,V,P,S) / EXP(PRC_SC(R,P)) * PRC_CAPACT(R,P)) - - SUM(BS_COMTS(BS_ANEG(R,C),S),PRC_CAPACT(R,P)*SQRT(STG_EFF(R,V,P)) / 8760 * - VAR_BSFSP(R,V,T,P,C,S)*(BS_STIME(R,P,C,'LO')/2 +(BS_STIME(R,P,C,'UP')-BS_STIME(R,P,C,'LO'))*MAX(1,G_YRFR(R,S)/RS_STGPRD(R,S)*8760/(1+BS_STIME(R,P,C,'UP'))**0.5))); -*----------------------------------------------------------------------------- -* ABSEQ24 : End-use - negative - EQ_BS24(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_PRS(R,P,S)$AFS(R,T,P,S,'UP')$BS_SBD(R,S,'LO')$BS_NEGP(R,P)$BS_ENDP(R,P)).. - SUM(BS_COMTS(BS_ANEG(R,C),S)$BS_BSC(R,P,C),VAR_BSFSP(R,V,T,P,C,S)) =L= -* available process capacity - activity level - (VAR_BSON(R,V,T,P,S)*COEF_AF%MX%(R,V,T,P,S,'UP') - %VAR%_ACT(R,V,T,P,S%SOW%)/PRC_CAPACT(R,P)/G_YRFR(R,S)) * - SUM((TOP(R,P,C,'IN'),RPC_PG(R,P,COM))$NRG_TMAP(R,'ELC',C), - PRC_ACTFLO(R,V,P,C)$RPC_PG(R,P,C) + - (SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,TS,S),RS_FR(R,TS,S)*SUM(RPG_1ACE(R,P,CG,C)$COEF_PTRAN(R,V,P,CG,C,COM,TS),1/COEF_PTRAN(R,V,P,CG,C,COM,TS)))+ - SUM(RP_PG(R,P,CG),COEF_PTRAN(R,V,P,CG,COM,C,S)))$(NOT RPC_PG(R,P,C))); -*----------------------------------------------------------------------------- -* ABSEQ25 : End-use - positive - EQ_BS25(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_PRS(R,P,S)$BS_SBD(R,S,'UP')$BS_ENDP(R,P)).. - SUM(BS_COMTS(BS_APOS(R,C),S)$BS_BSC(R,P,C),VAR_BSFSP(R,V,T,P,C,S))*PRC_CAPACT(R,P)*G_YRFR(R,S) =L= - SUM(TOP(R,P,C,'IN')$NRG_TMAP(R,'ELC',C), - SUM(RTPCS_VARF(R,T,P,C,TS)$TS_MAP(R,S,TS), -$ BATINCLUDE %cal_red% C COM TS P T - )$RP_STD(R,P)+SUM(RPCS_VAR(RPC_STG(R,P,C),TS)$TS_MAP(R,S,TS),V_U(SIN,R,V,T,P,C,TS)$(PRC_NSTTS(R,P,TS)+PRC_STGTSS(R,P,C)))); -*----------------------------------------------------------------------------- -* ABSEQ26 : Bound on process reserve provision - EQ_BS26(RTP(%R_T%,P),C,RTS(S)%SWX%)$(%SWTX%BS_COMTS(R,C,S)$(BS_BSC(R,P,C)+YES$BS_STIME(R,P,C,'UP'))$BS_BNDPRS(RTP,C,S,'N')).. - SUM((RTP_VINTYR(R,V,T,P),BS_PRS(R,P,TS))$RS_FR(R,TS,S), - (VAR_BSFSP(R,V,T,P,C,TS)+VAR_BSFNSP(R,V,T,P,C,TS)$(ABS(BS_RTYPE(R,C))>2)$BS_SUPP(R,P))*RS_FR(R,TS,S)) - =E= VAR_BSLACK(R,T,P,C,S); -*----------------------------------------------------------------------------- -* ABSEQ27 : Maintenence 1 - entrance to maintenance - EQ_BS27(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%(BS_MAINT(R,V,P,S)>=0)$BS_MAINT(R,V,P,S)).. - SUM(TS_MAP(R,S,TS)$RPS_UPS(R,P,TS), - (VAR_BSMUP(R,V,T,P,TS)*MIN(1,ROUND(BS_MAINT(R,V,P,S),1)/8760*RS_STGPRD(R,TS)/G_YRFR(R,S)))$PRC_TS(R,P,TS) + - (VAR_OFF(R,V,T,P,TS)*RS_FR(R,TS,S)$(BS_MAINT(R,V,P,S)=0))$TS_CYCLE(R,TS)) - =G= -* unavailable process capacity - vintaged or not - SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P)*(%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)%RCAPSBM%)*((1-COEF_AF%MX%(R,K,T,P,S,'UP'))$(ACT_UPS(R,T,P,S,'N')=0)+ACT_UPS(R,T,P,S,'N'))); -*----------------------------------------------------------------------------- -* ABSEQ28 : Maintenence 2 - continuous duration - EQ_BS28(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%PRC_TS(R,P,S)$BS_MAINT(R,V,P,S)).. - SUM((RS_UP(R,S,JS),RJ_SL(R,JS,SL)),VAR_BSMUP(R,V,T,P,SL)$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/2+1/JS_CCL(R,JS),1/JS_CCL(R,JS)) %TMP% - IF(execerror,PUT END_GAMS "%3%5"; PUTCLOSE); -%1 $%2 "%3" -$GOTO DONE - -$LABEL SOLVE - Z = MIN(14,%MODEL_NAME%.MODELSTAT)-1; IF(Z > 12, Z=11); - IF(Z>=0,PUT SCREEN /"--- TIMES Solve status: "; - LOOP(SAMEAS(J,'1'), PUT SOLVESTAT.TE(J+Z)); - PUTCLOSE; - PUT END_GAMS "Solve status: "; - LOOP(SAMEAS(J,'1'), PUT SOLVESTAT.TE(J+Z) /); - PUTCLOSE; - Z = ABS(ABS(2*%MODEL_NAME%.MODELSTAT-9)-6)); - IF(Z>1.5 OR %MODEL_NAME%.MODELSTAT=7,execerror=1); -$IF %ERR_ABORT%==NO Z=0; -* [UR] allow solution "optimal with unscaled infeasibilities" -* -- allow even "intermediate non-optimal" for investigation -*ABORT$((%MODEL_NAME%.MODELSTAT GT 1) OR (%MODEL_NAME%.SOLVESTAT GT 1)) '*** ERRORS IN OPTIMIZATION ***' - ABORT$(Z>1.5) '%2'; - IF(execerror,execerror=0); -$LABEL DONE -*$OFFLISTING -; diff --git a/source/fillcost.gms b/source/fillcost.gms deleted file mode 100644 index 76ce21b..0000000 --- a/source/fillcost.gms +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -******************************************************************************* -* FILLCOST : Fill cost parameters -* Description: Dense interpolation/extrapolation of cost parameters -* Parameters: -* %1 - table name -* %2 - control set 1 (before year index) -* %3 - control set 2 (after year index) -* %4 - UNCD7 residual dimension -* %5 - CKEYERS2 or EOHYEARS depending on cost parameter -* %6 - Validity Qualifier restricting interpolation -* %7 - Qualifier restricting backward extrapolation -* %8 - Qualifier restricting forward extrapolation -* %9 - Original data table -* %10 - Write cache -******************************************************************************* -*$ONLISTING -$ EOLCOM ! -$SETLOCAL SRC '%9' SETLOCAL DATA '%10(%2,%3,%5)' SETLOCAL TAKE '$%6' SETLOCAL TMP %3%4 -$IF DIMENSION 8 %9 $SETLOCAL TMP %4 - PARAMETER %10(%2,%3,ALLYEAR); - IF(YES,OPTION CLEAR=UNCD7; -$IF '%11'==1 %1(%2,DATAYEAR,%3) $= %9(%2,DATAYEAR,%3)%TAKE%; -$IF '%11'==1 $SETLOCAL TAKE '' SETLOCAL SRC %1 - UNCD7(%2,LL--ORD(LL),%TMP%)%TAKE% $= %SRC%(%2,LL,%3); - LOOP(UNCD7(%2,YEAR,%TMP%), F=0; LAST_VAL=0; - OPTION CLEAR=MY_FIL2; MY_ARRAY(DM_YEAR)= %SRC%(%2,DM_YEAR,%3); -* do linear interpolation - LOOP(DM_YEAR(LL)$MY_ARRAY(DM_YEAR), ! check for nonzero - MY_F = MY_ARRAY(LL); Z = YEARVAL(LL); - IF(LAST_VAL, LAST_VAL=(MY_F-LAST_VAL)/(Z-MY_FYEAR); - FOR(CNT=MY_FYEAR-Z+1 TO -1, MY_FIL2(%5(LL+CNT)) = MY_F+LAST_VAL*CNT;); - ELSE F = Z; FIRST_VAL = MY_F;); - LAST_VAL = MY_F; MY_FYEAR=Z); ! remember the value and year -* Do back/forward extrapolate -$IF '%11'==2 MY_FIL2(%5) $= MY_ARRAY(%5); - %DATA% $= FIRST_VAL$(%7(YEARVAL(%5) LT F)) + MY_FIL2(%5) + LAST_VAL$(%8(YEARVAL(%5) GT Z)); - ); -); -$IF NOT '%11'==2 %1(%2,%5,%3) $= %DATA%; OPTION CLEAR=%10; -$IF '%11'==2 %10('EMPTY',%3,'EMPTY')=0; -$OFFLISTING diff --git a/source/fillparm.gms b/source/fillparm.gms deleted file mode 100644 index a232166..0000000 --- a/source/fillparm.gms +++ /dev/null @@ -1,57 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -******************************************************************************* -* FILLPARM : Interpolation/extrapolation of user data -* Description: Default interpolation/extrapolation if no control option given -* Non-default interpolation/extrapolation according to user option -* DFUNC = -1-> no interpolation, 0-> default action, -* DFUNC = +1-> interp., 2->interp.+EPS, 3->interp.+extrap. -* DFUNC >999 -> exponential interpolation beyond year DFUNC -* Parameters: -* %1 - table name -* %2 - control set 1 -* %3 - control set 2 -* %4 - UNCD7 residual dimension -* %5 - MODLYEAR or MILESTONYR depending on parameter -* %6 - RTP controlling the assignment to the MODLYEARs -* %7 - Selective test for control option (normally GE 0) -* %8 - Optional name for temporary write cache -******************************************************************************* -*$ONLISTING -$EOLCOM ! -$SETLOCAL DATA '%1(%2,%5,%3)' SETLOCAL ITEM '%1(%2,%5,%3)' SETLOCAL ADD '' -$IF NOT '%8' == '' $SETLOCAL DATA '%8(%2,%3,%5)' SETLOCAL ITEM 'MY_FIL2(%5)' SETLOCAL ADD '+MY_FIL2(%5)' -$IF NOT '%8'=='%9' PARAMETER %8(%2,%3,ALLYEAR); -* conditional interpolation flag - IF(NOT G_NOINTERP, OPTION CLEAR = UNCD7; - LOOP(DATAYEAR, UNCD7(%2,%3%4)$%1(%2,DATAYEAR,%3) = YES;); - LOOP(UNCD7(%2,%3%4), DFUNC = ROUND(%1(%2,'%DFLBL%',%3)); - IF(DFUNC %7, OPTION CLEAR=MY_FIL2; CNT = (DFUNC LE 999); - MY_ARRAY(DM_YEAR) = %1(%2,DM_YEAR,%3); LAST_VAL=0; F = 0; Z = 0; -* do interpolate - LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), ! check for nonzero (including EPS) - MY_F = MY_ARRAY(DM_YEAR); Z = YEARVAL(DM_YEAR); - IF(LAST_VAL, - IF(CNT OR (Z LE DFUNC), ! linear interpolation - %ITEM%$((Z GT YEARVAL(%5))$(YEARVAL(%5) GT MY_FYEAR)) - = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(YEARVAL(%5)-MY_FYEAR); ! not the first one - ELSE ! exponential function - %ITEM%$((Z GT YEARVAL(%5))$(YEARVAL(%5) GT MY_FYEAR)) - = LAST_VAL*POWER(1+MY_F,YEARVAL(%5)-MY_FYEAR); - MY_F = LAST_VAL*POWER(1+MY_F,Z-MY_FYEAR); - %1(%2,DM_YEAR,%3) = MY_F;); ! overwrite old data - ELSE F = Z; FIRST_VAL = MY_F;); - LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year - IF(DFUNC GT 1, - IF(CNT,DFUNC=MOD(DFUNC,10); - IF(DFUNC EQ 2, FIRST_VAL = EPS; LAST_VAL = EPS; ELSEIF DFUNC EQ 4, Z = INF; ELSEIF DFUNC EQ 5, F = 0))); - IF((DFUNC NE 1), -* Do back/forward extrapolate, or fill in with EPS - %DATA%$%6 $= FIRST_VAL$(YEARVAL(%5) LT F) %ADD% + LAST_VAL$(YEARVAL(%5) GT Z); -$IF NOT '%8' == '' ELSE %DATA%$%6 $= %ITEM%; - ))); -* Reset OPT and add DATA - %1(%2,'%DFLBL%',%3)$%1(%2,'%DFLBL%',%3) = MIN(%RESET%,%1(%2,'%DFLBL%',%3)); -$IF NOT '%8' == '' %1(%2,%5,%3) $= %DATA%; OPTION KILL = %8; - ); -$OFFLISTING diff --git a/source/fillsow.stc b/source/fillsow.stc deleted file mode 100644 index 565e557..0000000 --- a/source/fillsow.stc +++ /dev/null @@ -1,47 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -******************************************************************************* -* FILLSOW : Fill stochastic parameters -* Description: Preprocessing of stochastic uncertain data -* Parameters: -* %1 - table name -* %2 - control set 1 (before year index) -* %3 - control set 2 (after year index) -* %4 - Source data years T/LL -* %5 - YES/NO for absolute/relative parameters -* %6 - PERIOD control (SW_T OR PERIODYR OR SUPERYR) -* %7 - YES/NO to copy baseline parameters -******************************************************************************* -*$ONLISTING -$SETLOCAL TAIL ',%3' SETLOCAL STG '' SETLOCAL IX "'0'" -$IF '%3' == '' $SETLOCAL TAIL '' -$IF '%4' == '' $SETLOCAL IX '' -$IF '%4' =='T' $SETLOCAL STG SW_TSTG(T,J)$ - -* Clean up stage 1 from invalid SOW: - S_%1(%2%4%TAIL%,'1',SOW)$(NOT SAMEAS(SOW,'1')) = 0; - -* Set up data indicators -$IF NOT '%4'=='' S_%1(%2LL--ORD(LL)%TAIL%,J,WW) $= S_%1(%2LL%TAIL%,J,WW); - F = CARD(S_%1); - -* Copy parameters from first to other branches when appropriate - S_%1(%2%4%TAIL%,J,WW)$(%STG%(NOT S_%1(%2%IX%%TAIL%,J,WW))) $= SUM(SW_CPMAP(J,WW,SOW),S_%1(%2%4%TAIL%,J,SOW)); - -$IF NOT '%5' == 'YES' $EXIT - -* Update data indicators if eventual copy occurred -$IF NOT '%4'=='' IF(CARD(S_%1)>F, S_%1(%2LL--ORD(LL)%TAIL%,J,WW) $= S_%1(%2LL%TAIL%,J,WW)); - -* Copy baseline parameters to stage 1, SOW 1: -$IF '%7'==YES S_%1(%2%4%TAIL%,'1','1')$(NOT S_%1(%2%IX%%TAIL%,'1','1')) $= %1(%2%4%TAIL%); - -* Merge to single stage 1: - -$IFI NOT '%4'==LL LOOP(J$SW_START(J),S_%1(%2%4%TAIL%,'1',WW)$(%STG%%6) $= SUM(SW_REV(WW,J,SOW),S_%1(%2%4%TAIL%,J,SOW))); -$IFI '%4' == LL LOOP(SW_TSTG(T,J), S_%1(%2%4%TAIL%,'1',WW)$(%6$SW_T(T,WW)) $= SUM(SW_REV(WW,J,SOW),S_%1(%2%4%TAIL%,J,SOW))); - -* Remove flags if LL -$IF '%4'=='LL' S_%1(%2%IX%%TAIL%,J,WW) = 0; diff --git a/source/fillvint.gms b/source/fillvint.gms deleted file mode 100644 index 9ddab9b..0000000 --- a/source/fillvint.gms +++ /dev/null @@ -1,35 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -******************************************************************************* -* FILLVINT : Optional weighting of vintaged attributes -* %1 - table name -* %2 - Control set 1 -* %3 - Control set 2 -* %4 - Name for temporary cache -******************************************************************************* -*$ONLISTING -$ IF NOT '%4'=='' $GOTO FILL -*------------------------------------------------------------------------------ -* Initialization - OPTION CLEAR=PRC_YMIN,CLEAR=PASTSUM; -$IF %VINTOPT%==2 PRC_SIMV(PRC_VINT(R,P)) = NOT PRC_MAP(R,'STG',P); -$IF DEFINED PRC_SIMV PRC_SIMV(R,P)$PRC_MAP(R,'STG',P) = NO; PRC_VINT(PRC_SIMV) = YES; -* Make sure that all PRC_VINT have first leading V in RTP: - LOOP(T(LL),RVP(R,V(LL-LEAD(T)),P)$((NOT RVP(R,V,P))$RVP(R,T,P)$PRC_VINT(R,P)) = YES); -$IF DEFINED PRC_SIMV RTP(RVP(R,V,P)) $=PRC_SIMV(R,P); -$EXIT -*------------------------------------------------------------------------------ -$ LABEL FILL - PARAMETER %4(%2,%3,ALLYEAR); - IF(CARD(PASTSUM)=0, - PASTSUM(RTP(R,T,P))$PRC_VINT(R,P) = - MIN(1,(MAX(YEARVAL(T)-(LEAD(T)-1)/2,B(T)+MAX(NCAP_ILED(RTP),(D(T)+NCAP_ILED(RTP)-NCAP_TLIFE(RTP))/2)) - - (YEARVAL(T)-LEAD(T))) / LEAD(T))); - TRACKP(PRC_VINT) = YES; -$IF DEFINED PRC_SIMV TRACKP(PRC_SIMV) = NO; -* Weighted average of vintages T and T-1 - LOOP((T(LL),V(LL-LEAD(LL))), - %4(%2,%3,T)$(%1(%2,T,%3)$TRACKP(R,P)) = %1(%2,T,%3)*PASTSUM(R,T,P)+%1(%2,V,%3)*(1-PASTSUM(R,T,P))); - %1(%2,T,%3) $= %4(%2,%3,T); - OPTION CLEAR=%4,CLEAR=TRACKP; -$OFFLISTING diff --git a/source/fillwave.gms b/source/fillwave.gms deleted file mode 100644 index 8330ce7..0000000 --- a/source/fillwave.gms +++ /dev/null @@ -1,21 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -******************************************************************* -* FILLWAVE : Fill parameters via weighted centered averaging -* %1 - table name -* %2 - index set (after year index) -******************************************************************* -$ SET TMP OBJ_DISC(R,LL,CUR)/COEF_PVT(R,T) -$ IF '%CTST%'=='' $SET TMP 1/D(T) - SET REG_%2(REG,%2); - IF(CARD(VDA_DISC)=0,VDA_DISC(R,MIYR_1)=1; LOOP((G_RCUR(R,CUR),T(TT+1)),VDA_DISC(R,Y_EOH(LL))$PERIODYR(T,LL)=%TMP%)); - OPTION REG_%2 <= %1; DONE=SMAX(T,M(T)); - LOOP(REG_%2(R,%2), OPTION CLEAR=FIL2; - MY_ARRAY(DM_YEAR)=%1(R,DM_YEAR,%2); MY_F=0; Z=0; -* interpolate densely - LOOP(DM_YEAR(LL)$MY_ARRAY(LL), - LAST_VAL=MY_F; F=Z; MY_F=MY_ARRAY(LL); Z=YEARVAL(LL); - IF(LAST_VAL, FOR(CNT=F-Z+1 TO -1, FIL2(LL+CNT)=MY_F+(MY_F-LAST_VAL)/(Z-F)*CNT))); - IF(DONE=Z$%3,FIL2(Y_EOH)$(YEARVAL(Y_EOH)>Z)=MY_F); -* weighted centered average - %1(R,T,%2) = SUM(PERIODYR(T,Y_EOH(LL)),(MY_ARRAY(LL)+FIL2(LL))*VDA_DISC(R,LL))); diff --git a/source/filparam.gms b/source/filparam.gms deleted file mode 100644 index 04c4efe..0000000 --- a/source/filparam.gms +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -******************************************************************************* -* FILPARAM : Fill parameter -* Description: Dense interpolation/extrapolation of parameters -* Parameters: -* %1 - table name -* %2 - control set 1 (before year index) -* %3 - control set 2 (after year index) -* %4 - UNCD7 residual dimension -* %5 - Source data years (e.g. ALLYEAR, DM_YEAR) -* %6 - Target data years (e.g. ALLYEAR, MILESTONYR) -* %7 - Qualifier restricting backward extrapolation -* %8 - Qualifier restricting forward extrapolation -* %9 - Default interpolation option -******************************************************************************* -*$ONLISTING -$ EOLCOM ! -$SETLOCAL SRC '%1' SETLOCAL TAIL1 '%3' SETLOCAL TAIL2 ',%3' -$IF '%3' == '' $SETLOCAL TAIL1 "''" SETLOCAL TAIL2 '' -$IF '%10'=='' IF(YES, OPTION CLEAR = UNCD7; LOOP((%2%5%TAIL2%)$%SRC%(%2%5%TAIL2%), UNCD7(%2%TAIL1%%4) = YES)); -$IF NOT '%10'=='' IF(YES, OPTION CLEAR = UNCD7; UNCD7(%2LL--ORD(LL),%TAIL1%%4)$%SRC%(%2LL%TAIL2%) = YES); - LOOP(UNCD7(%2%10%TAIL1%%4), F=0; Z=INF; MY_FYEAR=9999; - DFUNC = ROUND(%SRC%(%2'%DFLBL%'%TAIL2%)); -$IF NOT %9=='' IF(NOT DFUNC, DFUNC = %9); - IF(DFUNC GE 0, - MY_ARRAY(%5) = %SRC%(%2%5%TAIL2%); MY_ARRAY('%DFLBL%')=0; -* do interpolate - LOOP(%5$MY_ARRAY(%5), ! check for nonzero (including EPS) - MY_F = MY_ARRAY(%5); Z = YEARVAL(%5); - IF(Z > MY_FYEAR+1, ! linear interpolation - %1(%2%6%TAIL2%)$((Z GT YEARVAL(%6))$(YEARVAL(%6) GT MY_FYEAR)) - = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(YEARVAL(%6)-MY_FYEAR); ! not the first one - ELSEIF Z LT MY_FYEAR, F=Z; FIRST_VAL = MY_F); - LAST_VAL = MY_F; MY_FYEAR=Z); ! remember the value and year -* Do back/forward extrapolate - IF(DFUNC GT 1, DFUNC=MOD(DFUNC,10); - IF(DFUNC EQ 2, FIRST_VAL=EPS; LAST_VAL=EPS; ELSEIF DFUNC EQ 4, Z=INF; ELSEIF DFUNC EQ 5, F=0)); - IF(DFUNC NE 1, - %1(%2%6%TAIL2%) $= FIRST_VAL$(%7(YEARVAL(%6) LT F)) + LAST_VAL$(%8(YEARVAL(%6) GT Z)); - )); - ); -$OFFLISTING diff --git a/source/filshape.gms b/source/filshape.gms deleted file mode 100644 index 7d8c34d..0000000 --- a/source/filshape.gms +++ /dev/null @@ -1,26 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -******************************************************************************* -* FILSHAPE : Fill shape parameters -* Description: Dense interpolation/extrapolation of shape values -* Parameters: -* %1 - Limit for forward extrapolation (MAXLIFE) -******************************************************************************* -*$ONLISTING -$ EOLCOM ! - SET AGEFIL(AGE); - LOOP(J, Z = 0; MY_FYEAR = 9999; -* do interpolate - AGEFIL(AGE) = YES$SHAPE(J,AGE); - LOOP(AGE$AGEFIL(AGE), ! check for nonzero (including EPS) - MY_F = SHAPE(J,AGE); Z = ORD(AGE); - IF(Z > MY_FYEAR+1, ! linear interpolation - SHAPE(J,LIFE)$((ORD(LIFE) GT MY_FYEAR)$(Z GT ORD(LIFE))) - = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(ORD(LIFE)-MY_FYEAR); - ELSEIF Z LT MY_FYEAR, F = Z;); - LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year -* Do back/forward extrapolate - IF(Z, SHAPE(J,LIFE)$(ORD(LIFE) LT F) = 1; - SHAPE(J,LIFE)$((ORD(LIFE) GT Z)$(ORD(LIFE) LE %1)) = LAST_VAL;); - ); -$OFFLISTING diff --git a/source/forcupd.cli b/source/forcupd.cli deleted file mode 100644 index fd35bd7..0000000 --- a/source/forcupd.cli +++ /dev/null @@ -1,33 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*---------------------------------------------------------------------------- -* FORCUPD.cli - Climate Module forcing function update -*---------------------------------------------------------------------------- -$SET CH4_PRE 700 -$SET N2O_PRE 270 -$SET FOFO (0.47*LOG(1 + 2.01E-5*(F*Z)**0.75 + 5.31E-15*F*(F*Z)**1.52)-MY_SUM) - - LOOP(CM_ATMAP(CM_EMIS,CM_HISTS), CM_RESULT(CM_HISTS,LL)$CM_LED(LL) = - SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),VAR_CLIBOX.L(CM_VAR,LL))/CM_PPM(CM_EMIS)); - F=%CH4_PRE%; Z=%N2O_PRE%; MY_SUM=0; MY_SUM=%FOFO%; - LOOP(LL$CM_LED(LL), -*...methane - F = MAX(1,CM_RESULT('CH4-PPB',LL)-.5); Z = %N2O_PRE%; - FIRST_VAL = .036*(SQRT(F)-SQRT(%CH4_PRE%)) - %FOFO%; F=F+1; - LAST_VAL = .036*(SQRT(F)-SQRT(%CH4_PRE%)) - %FOFO%; - Z=LAST_VAL-FIRST_VAL; LAST_VAL=(FIRST_VAL+LAST_VAL)/2; - CM_LINFOR(LL,'CH4-PPB','N') = Z; - CM_LINFOR(LL,'CH4-PPB','FX') = LAST_VAL-Z*(F-0.5); -*...nitrous - F = %CH4_PRE%; Z = MAX(1,CM_RESULT('N2O-PPB',LL)-.5); - FIRST_VAL = 0.12*(SQRT(Z)-SQRT(%N2O_PRE%)) - %FOFO%; Z=Z+1; - LAST_VAL = 0.12*(SQRT(Z)-SQRT(%N2O_PRE%)) - %FOFO%; - F=LAST_VAL-FIRST_VAL; LAST_VAL=(FIRST_VAL+LAST_VAL)/2; - CM_LINFOR(LL,'N2O-PPB','N') = F; - CM_LINFOR(LL,'N2O-PPB','FX') = LAST_VAL-F*(Z-0.5); - ); -* carbon - CM_LINFOR(LL,'CO2-PPM',BDNEQ)$CM_LED(LL) = CM_RESULT('CO2-PPM',LL); -$ BATINCLUDE coef_ext.cli SLOPE diff --git a/source/gdxfilter.gms b/source/gdxfilter.gms deleted file mode 100644 index c7aa51f..0000000 --- a/source/gdxfilter.gms +++ /dev/null @@ -1,30 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -*=============================================================================* -* Filtering Domain Violations via GDX -$ GOTO %1 -$ LABEL MAIN -$ SET TMP "'" SET MX -$ IFI %SYSTEM.FILESYS%==MSNT $SET TMP '"' - DISPLAY 'GAMS Warnings detected; Data have been Filtered via GDX'; -$ hiddencall gdxdump _dd_.gdx NODATA > _dd_.dmp -$ hiddencall sed %TMP%/^\(Scalar\|[^$(]*([^,]*)\|[^$].*empty *$\)/{N;d;}; /^\([^$]\|$\)/d; s/\$LOAD.. /\$LOADR /I%TMP% _dd_.dmp > _dd_.dd -$ IF gamsversion 301 $onFiltered -* Half-baked workaround for GAMS 342 -$ IF %SYSTEM.GAMSVERSION%==342 -$ ONRECURSE $BATINCLUDE gdxfilter DAM_COST GR_VARGEN NCAP_DISC NCAP_OLIFE NCAP_SEMI PRC_DSCNCAP PRC_RCAP PRC_REACT PRC_REFIT RCAP_BLK REG_BDNCAP TM_CATT TM_UDF UC_ACTBET UC_CLI UC_FLOBET S_COM_FR S_DAM_COST S_FLO_FUNC S_NCAP_AFS -$ INCLUDE _dd_.dd -$ GDXIN -$ IF %SYSTEM.GAMSVERSION%==342 $INCLUDE _dd_.dmp -$ hiddencall rm -f _dd_.dmp -$ EXIT -*------------------------------------------------------------------------------ -$ LABEL DAM_COST -* Prepare for killing with GAMS 34.2 -$ LABEL MORE -$ IF %1.==. $GOTO PUTOUT -$ IF DECLARED %1 -$ IF NOT DEFINED %1 $SET MX %1 %MX% -$ SHIFT GOTO MORE -$ LABEL PUTOUT -$ echon $KILL %MX% > _dd_.dmp \ No newline at end of file diff --git a/source/globals.def b/source/globals.def deleted file mode 100644 index 86a802c..0000000 --- a/source/globals.def +++ /dev/null @@ -1,16 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==============================================================================* -* GLOBALS.DEF has all the declaration & defaults for SCALARS & Parameters * -*==============================================================================* - -* global initialization and other scalar defaults which may be changed here -* or overwritten in the user *.DD - SCALAR G_DYEAR 'Year to discount to' / 0 /; - SCALAR G_ILEDNO '1/threshold at which to ignore ILED' / 10 /; - SCALAR G_TLIFE 'Default technology life if not provided' / 10 /; - SCALAR G_VINT '% annual change in input data for vintaging' / .1 /; - SCALAR G_NOINTERP 'Turn off interplation' / 0 /; - PARAMETER G_CYCLE(TSLVL) 'Number of cycles in average year' / ANNUAL 1, SEASON 1, DAYNITE 365 /; diff --git a/source/init_ext.abs b/source/init_ext.abs deleted file mode 100644 index c6040f6..0000000 --- a/source/init_ext.abs +++ /dev/null @@ -1,32 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* INIT_EXT.xtd oversees initial preprocessor activities -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Get processes allowed to participate in the reserve markets per region - OPTION BS_BSC0) $=BS_RTYPE(R,C); - BS_ANEG(R,C) $= BS_ABD(R,C,'LO'); - BS_APOS(R,C) $= BS_ABD(R,C,'UP'); -* Remove invalid values - BS_DEMDET(R,YEAR,RSP,C,S)$(NOT BS_RTYPE(R,C))=0; - BS_OMEGA(R,YEAR,C,S)$(NOT BS_RTYPE(R,C))=0; - BS_DELTA(R,YEAR,C,S)$(NOT BS_RTYPE(R,C))=0; - BS_LAMBDA(R,YEAR,C)$(NOT BS_RTYPE(R,C))=0; - BS_DETWT(R,YEAR,C)$(NOT BS_RTYPE(R,C))=0; - BS_SIGMA(R,YEAR,C,ITEM,S)$(NOT BS_RTYPE(R,C))=0; - BS_RMAX(R,YEAR,P,C,S)$(NOT BS_RTYPE(R,C))=0; - BS_STIME(R,P,C,BD)$(NOT BS_RTYPE(R,C))=0; diff --git a/source/init_ext.dsc b/source/init_ext.dsc deleted file mode 100644 index 88ff198..0000000 --- a/source/init_ext.dsc +++ /dev/null @@ -1,20 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* INIT_EXT.xtd oversees initial preprocessor activities * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* Questions/Comments: -*----------------------------------------------------------------------------- -* Handle automatic activation of discrete extension -$IF DEFINED PRC_DSCNCAP NCAP_DISC(R,T--ORD(T),P,'0')$PRC_DSCNCAP(R,P) = EPS; -$IF DEFINED NCAP_SEMI OPTION PRC_SEMI5,B(T)=YEARVAL(T)); - MIYR_1(T)=YES; MIYR_BOH=B(T)-1); - PYR_S(LL) = YEARVAL(LL)=MIYR_BOH; -$IFI %WAVER%==YES INT_DEFAULT('PASTI')=1; -*----------------------------------------------------------------------------- -* Peaking and Storage stuff - PRC_PKNO(R,P)$((NCAP_PKCNT(R,'0',P,'ANNUAL')>=10)$NCAP_PKCNT(R,'0',P,'ANNUAL')) = YES; - PRC_PKAF(R,P)$((NCAP_PKCNT(R,'0',P,'ANNUAL')<= 0)$NCAP_PKCNT(R,'0',P,'ANNUAL')) = YES; - PRC_STGIPS(R,P,C)$(NOT SUM(PRC_ACTUNT(R,P,CG,UNITS_ACT)$(COM_GMAP(R,CG,C)+SAMEAS(CG,C)),1)) = NO; -* Set penalty cost for partial loads and excess storage cycling - OPTION TRACKP0)$PRC_RESID(R,LL,P)) = PRC_RESID(R,'0',P)+EPS; - NCAP_PASTI(R,PYR_S,P)$PRC_RESID(R,'0',P) = 1; -*----------------------------------------------------------------------------- -* Initial Preprocessing of VDA_EMCB and FLO_EMIS - FLO_EMIS(R,LL,P,CG,C,S) $= FLO_EFF(R,LL,P,CG,C,S); - OPTION CLEAR=RXX,CLEAR=FLO_EFF; - VDA_EMCB(R,DATAYEAR,C,COM)$COM_TMAP(R,'ENV',C) = 0; - LOOP((R,DATAYEAR,C,COM)$VDA_EMCB(R,DATAYEAR,C,COM),RXX(R,C,COM) = YES;); - RXX(R,C,COM)$(NOT COM_TMAP(R,'ENV',COM)) = NO; - LOOP((TOP(R,P,C,'IN'),RXX(R,C,COM)),FS_EMCB(R,P,COM,C)=YES); - FS_EMCB(R,P,COM,C)$TOP(R,P,COM,'IN') = NO; - OPTION TRACKPC <= FS_EMCB; TOP(TRACKPC,'OUT') = YES; - OPTION CLEAR=RXX, CLEAR=TRACKPC, PRC_ACT < PRC_ACTUNT; - LOOP((R,DATAYEAR,P,CG,C,S)$FLO_EMIS(R,DATAYEAR,P,CG,C,S),RPC_EMIS(R,P,C) = YES); - TOP(RPC_EMIS(PRC_ACT(R,P),C),'OUT')$(COM_TMAP(R,'ENV',C)*(NOT TOP(R,P,C,'IN'))) = YES; -*----------------------------------------------------------------------------- -* Initial Preprocessing of COM_AGG and VDA_FLOP - COM_AGG(R,LL,C,C)$COM_AGG(R,LL,C,C) = 0; - VDA_FLOP(R,LL,P,CG,S) $= ACT_FLO(R,LL,P,CG,S); - KEEP_FLOF(R,P,C)$VDA_FLOP(R,'%DFLBL%',P,C,'ANNUAL') = YES; -$IFI %SHELL%==ANSWER KEEP_FLOF(R,P,C)$PRC_ACTFLO(R,'%DFLBL%',P,C) = YES; -*----------------------------------------------------------------------------- -* Initial Preprocessing of IRE_FLOSUM - LOOP((R,DATAYEAR,P,C,S,IE,COM,IO)$IRE_FLOSUM(R,DATAYEAR,P,C,S,IE,COM,IO),RPG_ACE(R,P,COM,IO) = YES); - TOP(RPG_ACE(PRC_ACT,C,IO)) = YES; - OPTION CLEAR=PRC_ACT,CLEAR=ACT_FLO,CLEAR=RPG_ACE; -*----------------------------------------------------------------------------- -* Handle Updatable OFF-ranges & REG_BDNCAP process-based bounds - NCAP_START(R,P)$(NCAP_START(R,P)<=MIYR_BOH)=0; - RVP(R,LL,P) $= NCAP_BND(R,LL,P,'N'); - IF(CARD(RVP), - NCAP_BND(RVP,'N')$(NCAP_BND(RVP,'N')>%EOTIME%) = %EOTIME%; - NCAP_START(R,P)$((ABS(NCAP_BND(R,'0',P,'N'))>999)$RVP(R,'0',P)) = ABS(NCAP_BND(R,'0',P,'N'))+1; - PRC_NOFF(R,P,LL,EOHYEAR)$RVP(R,LL,P) = NO; - PRC_NOFF(R,P,BOHYEAR(LL),LL+(NCAP_BND(R,LL,P,'N')-YEARVAL(LL)))$RVP(R,LL,P) = YES); - NCAP_BND(RVP(R,LL,P),L('N')) = MOD(MIN(2,ROUND(MAX(NCAP_BND(RVP,L),-1))),2)$LASTLL(LL)+(YEARVAL(LL)-1)$(ROUND(MOD(NCAP_BND(RVP,L)-YEARVAL(LL),MAX(1,YEARVAL(LL))))=-1); - OPTION CLEAR=RVP; -*----------------------------------------------------------------------------- -* Prepare UC_CLI, UC_DYNBND and UC_ACTBET -$ BATINCLUDE equcrtp.vda INIT_EXT -$ IF %CLI%==YES LOOP((UC_N,SIDE,R,LL,CM_VAR)$UC_CLI(UC_N,SIDE,R,LL,CM_VAR),UC_ATTR(R,UC_N,'RHS','CLI','YES')=YES); - LOOP(UC_ATTR(R,UC_N,SIDE,UC_GRPTYPE,UC_NAME(TSL)),UC_TSL(R,UC_N,SIDE,TSL)=YES); -$ IF DEFINED UC_ACTBET - UC_FLOBET(UC_N,ALL_R,YEAR,P,%PGPRIM%) $= UC_ACTBET(UC_N,ALL_R,YEAR,P); LOOP((UC_N,R,YEAR,P)$UC_ACTBET(UC_N,R,YEAR,P),UC_GMAP_P(R,UC_N,'ACT',P)=YES); -$ IFI %POWERFLO%==YES LOOP(SAMEAS('REACTANCE',UC_N),PRC_REACT(R,T,P) $= UC_CAP(UC_N,'RHS',R,T,P)); -$ IF DEFINED PRC_REACT $SETGLOBAL POWERFLO YES -*----------------------------------------------------------------------------- -* Load bounds/prices for exogenous trade from previous run if requested -SET PREMILE(ALLYEAR); -$KILL PAR_IRE PAR_IPRIC -$IF NOT SET GDX_IREBND $GOTO IFPRICE -$IF NOT EXIST %GDXPATH%%GDX_IREBND%.GDX $GOTO IFPRICE -$GDXIN %GDXPATH%%GDX_IREBND% -$LOAD RPC_IREIN=RPC_IREIO PREMILE=MILESTONYR PAR_IRE -$IFI %GDX_IREBND%==%GDX_IPRIC% $GOTO LOAD2 -$GDXIN -$LABEL IFPRICE -$IF NOT SET GDX_IPRIC $GOTO FINISH -$IF NOT EXIST %GDXPATH%%GDX_IPRIC%.GDX $GOTO FINISH -$GDXIN %GDXPATH%%GDX_IPRIC% -$LABEL LOAD2 LOAD RPC_IREIN=RPC_IREIO PREMILE=MILESTONYR PAR_IPRIC -$GDXIN -$LABEL FINISH -* Remove originally exogenous trade flows -PAR_IRE(R,LL,T,P,C,S,IE)$RPC_IREIN(R,P,C,IE,'OUT') = 0; -PAR_IPRIC(R,T,P,C,TS,IE)$RPC_IREIN(R,P,C,IE,'OUT') = 0; -RPC_IREIN(R,P,C,IE,'OUT') = NO; diff --git a/source/initmty.abs b/source/initmty.abs deleted file mode 100644 index cf3a226..0000000 --- a/source/initmty.abs +++ /dev/null @@ -1,56 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================= -* INIT Declarations for the ABS Extension (Ancillary Balancing Services) -*============================================================================= -$ SETGLOBAL ABS YES - -* System sets - SETS - ITEM / SI / - CLVT / PRB, DET / - RSP / EXOGEN, WMAXSI, DELTA, OMEGA /; - -* Input parameters - PARAMETERS - BS_CAPACT(R) 'Conversion factor from exogenous reserve demand to activity' // - BS_RTYPE(R,C) 'Types of reserve commodities, positive or negative 1-4' // - BS_DEMDET(R,YEAR,RSP,C,S) 'Deterministic demands of reserves - EXOGEN and WMAXSI' // - BS_STIME(R,P,COM,BD) 'Minimum times for reserve provision from storage (hours)' // - BS_DETWT(R,YEAR,C) 'Weights for deterministic reserve demands' // - BS_LAMBDA(R,YEAR,C) 'Fudge factors for dependencies in reserve requirements' // - BS_SIGMA(R,YEAR,C,ITEM,S) 'Standard deviation of imbalance source ITEM' // - BS_OMEGA(REG,YEAR,COM,TS) 'Indicator of how to define reserve demand from deterministic and probabilistic component' // - BS_MAINT(R,YEAR,P,S) 'Continuous maintenance duration (hours)' // - BS_RMAX(R,YEAR,P,C,S) 'Maximum contribution of process p to provision of reserve c as a fraction of capacity' // - BS_DELTA(R,YEAR,C,S) 'Calibration parameters for probabilistic reserve demands' // - BS_SHARE(R,YEAR,C,ITEM,L) 'Share of group reserve provision' // - BS_BNDPRS(R,YEAR,P,C,S,L) 'Bound on process reserve provision' // - ; - -* Internal sets - SETS - BS_K(ITEM) 'Sources of imbalance or provision' / UP, LO / - BS_RTK(R,T,ITEM) 'Sources of imbalances by period' // - BS_COMTS(R,C,S) 'Reserve commodity timeslices' // - BS_APOS(R,C) 'Positive reserve commodities' // - BS_ANEG(R,C) 'Negative reserve commodities' // - BS_ABD(R,C,L) 'Reserve commodities by direction' // - BS_BSC(R,P,C) 'Reserve provisions by process' // - BS_UPL(R,P,L) 'Maximum ramping rate indicator' // - BS_UPC(R,P,TSL,L) 'Minimum uptime/downtime indicator' // - BS_TOP(R,P,C,IO) 'Topology for imbalance process' // - BS_ENDP(R,P) 'Reserve providion by demand' // - BS_SUPP(R,P) 'Reserve provision by generation' // - BS_STGP(R,P) 'Reserve provision by storage' // - BS_NEGP(R,P) 'Processes with negative provision' // - BS_PRS(R,P,S) 'Process slices for reserve tracking' // - BS_SBD(R,S,L) 'Timeslices for reserve provision' // - BS_UCMAP(UCN,SIDE,R,P,C) 'Map to refer to reserves in UC_FLO' // - ; - - PARAMETERS - BS_RTCS(RSP,R,YEAR,C,S) 'Temporary work parameter' // - ; diff --git a/source/initmty.cli b/source/initmty.cli deleted file mode 100644 index 49c0d9e..0000000 --- a/source/initmty.cli +++ /dev/null @@ -1,123 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* INITMTY.cli - Extension for Climate Module -*----------------------------------------------------------------------------- -* Questions/Comments: -*----------------------------------------------------------------------------- -$ SETGLOBAL CLI YES - SCALAR ATTLVL /0/, VALLVL /0/, CM_CALIB /0/; -*----------------------------------------------------------------------------- -* Set for calibration quantities - SET CM_HISTS 'Historical CO2 concentration and incremental forcing quantities' / - CO2-ATM 'Mass of CO2 in the atmosphere (in GtC)' - CO2-UP 'Mass of CO2 in the upper ocean layer (in GtC)' - CO2-LO 'Mass of CO2 in the lower ocean layer (in GtC)' - CH4-ATM, CH4-UP, CH4-LO 'Mass of CH4 in the atmosphere' - N2O-ATM, N2O-UP, N2O-LO 'Mass of N2O in the atmosphere' - FORCING 'Radiative Forcing' - FORC-CO2, FORC-CH4, FORC-N2O, FORC-FGS, FORC-KYO - CO2-GTC, CH4-MT, N2O-MT - CO2-PPM, CH4-PPB, N2O-PPB - DELTA-ATM 'Temperature change in the surface' - DELTA-LO 'Temperature change in the deep ocean layer' - /; - ALIAS(CM_VAR,CM_HISTS); - SET CM_OFOR(CM_VAR) / FORC-CH4, FORC-N2O, FORC-FGS /; - SET UC_GRPTYPE / CLI /; - -* Mapping and conversion parameter for total CO2 emissions - PARAMETER CM_CO2GTC(REG,C) 'Conversion factors from CO2 commodities to GtC' //; - PARAMETER CM_GHGMAP(R,C,CG) 'Conversion factors from regional GHG commodities to CLI' //; - PARAMETER CM_PPM(CM_VAR) 'Conversion factors between Gt/Mt and ppm/ppb' - / CO2-GTC 2.13, CH4-MT 2.84, N2O-MT 7.81 /; - -* Climate module time-dependent parameters - PARAMETER CM_HISTORY(ALLYEAR,CM_VAR) 'Calibration values for CO2 and forcing' //; - PARAMETER CM_EXOFORC(ALLYEAR) 'Radiative forcing from exogenous sources' //; - PARAMETER CM_MAXCO2C(ALLYEAR) 'Maximum allowable atmospheric CO2 concentration' //; - PARAMETER CM_MAXC(ALLYEAR,ITEM) 'Maximum level of climate variable' //; - PARAMETER CM_LINFOR(ALLYEAR,CM_VAR,LIM) 'Linearized forcing function' //; - PARAMETER UC_CLI(UC_N,SIDE,REG,ALLYEAR,CM_VAR) 'Climate variable' //; - -* Reporting parameters - PARAMETER CM_DT_FORC(ALLYEAR) 'Delta forcing' //; - PARAMETER CM_MAXC_M(ITEM,ALLYEAR) 'Marginals of max constraints' //; - PARAMETER CM_SRESULT(ALLSOW,ITEM,ALLYEAR) 'Climate Module basic results' //; - PARAMETER CM_SMAXC_M(ALLSOW,ITEM,ALLYEAR) 'Marginals for max constraints' //; - -* Internal sets for reservoirs - SET CM_STCC / CS, SIGMA1 /; - SET CM_BOX 'Reservoir buckets' / ATM, UP, LO /; - SET CM_EMIS(CM_HISTS) / CO2-GTC /; - SET CM_KIND(CM_HISTS) / CO2-GTC /; - SET CM_TKIND(CM_HISTS); - SET CM_CONC(CM_HISTS,CM_BOX) / CO2-GTC.ATM /; - SET CM_ATMAP(CM_VAR,CM_VAR) 'Atmospheric reservoir buckets' / CO2-GTC.CO2-PPM, CH4-MT.CH4-PPB, N2O-MT.N2O-PPB, FORCING.DELTA-ATM /; - ALIAS (CM_BUCK, CM_BOX); - SET CM_BOXMAP(CM_HISTS,CM_HISTS,CM_BOX) / CO2-GTC.CO2-ATM.ATM, CO2-GTC.CO2-UP.UP, CO2-GTC.CO2-LO.LO, - CH4-MT.CH4-ATM.ATM, CH4-MT.CH4-UP.UP, N2O-MT.N2O-ATM.ATM, N2O-MT.N2O-UP.UP - FORCING.DELTA-ATM.ATM, FORCING.DELTA-LO.LO /; - SET PRET(T,T) //; - SET SUPERYR(T,ALLYEAR) 'SUpremum PERiod YeaR' //; - SET CM_FORCMAP(CM_VAR,CM_VAR) / FORCING.FORC-FGS,FORC-KYO.FORC-FGS - FORC-CO2.CO2-GTC,FORC-CH4.CH4-MT,FORC-N2O.N2O-MT,FORC-FGS.FORC-FGS /; - -* Internal parameters - PARAMETER CM_SIG1(ALLSOW) //; - PARAMETER CM_PHI(CM_HISTS,*,*) 'Conc. transport matrix between reservoirs' //; - PARAMETER CM_SIG(ALLSOW,*,*) 'Temperature transport matrix between reservoirs' //; - PARAMETER CM_AA(CM_HISTS,ALLYEAR,ALLSOW,*,*) 'Periodical CO2 transport matrix' //; - PARAMETER CM_BB(CM_HISTS,ALLYEAR,ALLSOW,CM_BOX) 'Periodical emission transport vector' //; - PARAMETER CM_CC(CM_HISTS,ALLYEAR,ALLSOW,CM_BOX) 'Periodical emission transport vector' //; - PARAMETER CM_RR(J,CM_BOX,*) 'Reporting' //; - PARAMETER CM_DELTAT(ALLYEAR,CM_BOX) 'Temperature change in T boxes' //; - PARAMETER CM_LED(ALLYEAR) //; - PARAMETER CM_BEMI(CM_HISTS,LL) //; - PARAMETER CM_EVAR(CM_HISTS,LL) //; - -*----------------------------------------------------------------------------- -* If parameter CM_CO2GTC is not implemented in the shell, IRE_CCVT can alternatively be used -* For that purpose, a predefined commodity for global CO2 emissions is needed: - SET COM_GRP / FORCING, CO2-GTC, CO2-ATM, CO2-PPM, CH4-MT, N2O-MT, CH4-PPB, N2O-PPB, DELTA-ATM /; - SET COM_GRP / FORC-CO2, FORC-CH4, FORC-N2O, FORC-FGS, FORC-KYO /; - SET COM / CO2-GTC, CH4-MT, N2O-MT, FORCING, CO2-ATM, DELTA-ATM /; -*----------------------------------------------------------------------------- - PARAMETER CM_CONST(*) 'Climate module constants' / - PHI-UP-AT 0.0453 - PHI-AT-UP 0.0495 - PHI-LO-UP 0.00053 - PHI-UP-LO 0.0146 - GAMMA 0 - LAMBDA 1.41 - CS 2.91 - SIGMA1 0.024 - SIGMA2 0.44 - SIGMA3 0.002 - CO2-PREIND 596.4 - PHI-CH4 0.09158 - PHI-N2O 0.008803 - EXT-EOH -1 - BEOHMOD 20 - /; -IF(NOT CM_CONST('GAMMA'), CM_CONST('GAMMA') = 5.35*LOG(2)); -IF(CM_CONST('LAMBDA') EQ 0, CM_CONST('LAMBDA') = 1.25); -IF(CM_CONST('CS') EQ 0, CM_CONST('CS') = CM_CONST('GAMMA')/CM_CONST('LAMBDA')); -CM_CONST('LAMBDA') = CM_CONST('GAMMA')/CM_CONST('CS'); -E('0')=0; IF(CM_CONST('EXT-EOH') EQ 0, CM_CONST('EXT-EOH')=SMAX(LL$E(LL),E(LL))); -*----------------------------------------------------------------------------- -* The following parameters describe historical mass of CO2 in the ATM and ocean -* as well as historical temperature increases in surface and deep ocean -**** User provided values override these default hard-coded values **** - PARAMETER CM_DEFAULT(ALLYEAR,CM_HISTS) //; - TABLE CM_DEFAULT(ALLYEAR,CM_HISTS) - CO2-ATM CO2-UP CO2-LO DELTA-ATM DELTA-LO CH4-ATM CH4-UP N2O-ATM N2O-UP -1990 735 19230 0.43 0.06 -1995 765 781 19230 0.50 0.06 -2000 785 798 19230 0.65 0.06 3030 1988 360 2109 -2005 806 19230 0.75 0.06 3067 1988 390 2109 -2010 826 830 19230 0.80 0.06 3122 1988 414 2109 -; -*----------------------------------------------------------------------------- diff --git a/source/initmty.dsc b/source/initmty.dsc deleted file mode 100644 index fb72571..0000000 --- a/source/initmty.dsc +++ /dev/null @@ -1,17 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================= -* INIT DECLARATIONS FOR THE DSC EXTENSION -*============================================================================= -$SETGLOBAL DSC YES -$IF NOT %DSC%==YES $ABORT Activation of DSC extension failed -*----------------------------------------------------------------------------- -* Sets and parameters for discrete capacity extension -SET UNIT 'Number of different units' / 0*100 /; -SET PRC_DSCNCAP(R,P) 'Processes with discrete capacity additions'; -PARAMETER NCAP_DISC(R,ALLYEAR,P,UNIT) 'Unit size of discrete capacity addition'; -PARAMETER NCAP_SEMI(R,ALLYEAR,P) 'Semi-continuous capacity, lower bound'; -*PARAMETER NCAP_CSTD(REG,ALLYEAR,PRC,CUR,UNIT) 'Investment cost of unit' //; -*PARAMETER NCAP_FOMD(REG,ALLYEAR,PRC,CUR,UNIT) 'Fixed operating and maintenace cost of unit' //; diff --git a/source/initmty.etl b/source/initmty.etl deleted file mode 100644 index 7496960..0000000 --- a/source/initmty.etl +++ /dev/null @@ -1,66 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -****************************************************************************** -* INITMTY.ETL - declarations for technological change * -****************************************************************************** -* OPTCR from default 0.1 to 0.000001, may want to adjust in *.RUN file - OPTION OPTCR = 0.000001; - -* - Input Data -$ SET ETL YES - SET TEG(PRC) //; - PARAMETER TL_SC0(R,PRC) //; - PARAMETER TL_PRAT(R,PRC) //; - PARAMETER TL_SEG(R,PRC) //; - PARAMETER TL_CCAP0(R,PRC) //; - PARAMETER TL_CCAPM(R,PRC) //; -* Cluster technologies: TEG plus PRC coupled to TEG, mapping and coupling factors - PARAMETER TL_CLUSTER(R,P,P) //; - PARAMETER TL_MRCLUST(R,P,R,P) //; -* Input aliases - PARAMETER SC0(R,PRC) //; - PARAMETER PRAT(R,PRC) //; - PARAMETER SEG(R,PRC) //; - PARAMETER CCAP0(R,PRC) //; - PARAMETER CCAPM(R,PRC) //; - PARAMETER CLUSTER(R,P,P) //; - -* - Internal parameters -* KP up to 6 as default, can be re-assigned in *.RUN file if desired - SET KP / 1*6 /; - ALIAS(KP,KP2); - PARAMETER PAT(R,PRC) //; - PARAMETER PBT(R,PRC) //; - PARAMETER CCOST0(R,PRC) //; - PARAMETER CCOSTM(R,PRC) //; - PARAMETER WEIG(R,KP,PRC) //; - PARAMETER CCOSTK(R,KP,PRC) //; - PARAMETER CCAPK(R,KP,PRC) //; - PARAMETER BETA(R,KP,PRC) //; - PARAMETER ALPH(R,KP,PRC) //; - PARAMETER NTCHTEG(R,PRC) Number of technologies in cluster //; -* report specific - PARAMETER INVC_UNIT(R,T,P) //; - PARAMETER PREV(R,PRC) //; - -* Starting periods for learning technologies - SET TL_START(R,T,P) //; -* sets of cluster2 technologies and key components - SET TL_RP_CT(REG,PRC) //; - SET TL_RP_KC(REG,PRC) //; - -* SET and parameter Declarations for LIC Reporting Module - PARAMETER TL_CT_COST(R,ALLYEAR,PRC,CUR) //; - -*=====================================================* -* ETL Iteration parameters used during TESTing * -*=====================================================* -* new SET MLITER (1*1 default) to enable iterative SOLVE, can be re-assigned in RUN -SET MLITER /1*1/; -* default MLITERM in RUN -SCALAR MLITERM /10.0/; -* CCDIFCRIT is termination criterion for average difference in CCAPM - CCAP(TLAST) -* or for CCAPM values in two subsequent iterations, now set to 0.1 -SCALAR CCDIFCRIT /0.1/; diff --git a/source/initmty.ier b/source/initmty.ier deleted file mode 100644 index 5b1c596..0000000 --- a/source/initmty.ier +++ /dev/null @@ -1,23 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================= -* INIT DECLARATIONS FOR THE IER EXTENSION -*============================================================================= -* Parameters used in EQx_MRKCON -PARAMETER FLO_MRKCON(REG,ALLYEAR,PRC,COM,TS,BD) 'Bound on the share of a flow in the total consumption of a commmodity' //; -PARAMETER FLO_MRKPRD(REG,ALLYEAR,PRC,COM,TS,BD) 'Bound on the share of a flow in the total production of a commmodity' //; - -* Sets and parameters used for CHP plants -SET ECT_CHP(REG,PRC) 'Set of extraction condensing CHP plants' //; -SET ECT_ELC(REG,PRC,COM) 'Electricity commodity of extraction condensing CHP plants' //; -SET ECT_DHT(REG,PRC,COM) 'Heat commodity of extraction condensing CHP plants' //; -SET ECT_CGOUT(REG,PRC,COM_GRP) 'Output commodity group ELC+HEAT of ECT CHP plant' //; -SET ECT_CGIN(REG,PRC,COM_GRP) 'Fuel input commodity group of ECT CHP plant' //; -PARAMETER ECT_INP2ELC(REG,ALLYEAR,PRC) 'Conversion factor from input capacity to ELC capacity in BPT point' //; -PARAMETER ECT_INP2DHT(REG,ALLYEAR,PRC) 'Conversion factor from input capacity to heat capacity in BPT point' //; -PARAMETER ECT_INP2CON(REG,ALLYEAR,PRC) 'Conversion factor from input capacity to heat capacity in BPT point' //; -PARAMETER ECT_REH(REG,ALLYEAR,PRC) 'Ratio of electricity to heat in brackpressure point' //; -PARAMETER ECT_AFCON(REG,ALLYEAR,PRC,BD) 'Availability of condensing mode operation of extraction condensing CHP' //; -PARAMETER ECT_AFBPT(REG,ALLYEAR,PRC,BD) 'Availability of backpressure mode operation of extraction condensing CHP' //; diff --git a/source/initmty.mlf b/source/initmty.mlf deleted file mode 100644 index 9edc354..0000000 --- a/source/initmty.mlf +++ /dev/null @@ -1,62 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================= -* Init Declarations for the MLF Macro extension -*============================================================================= -$ INCLUDE initmty.tm -$ SETGLOBAL MACRO Yes -$ SETGLOBAL SPOINT -*--- Redefined & Additional input parameters --- - PARAMETER TM_ARBM 'Arbitrary multiplier' /1/; - PARAMETER TM_SCALE_UTIL 'Scaling factor utility function' /0.001/; - PARAMETER TM_SCALE_NRG 'Scaling factor demand units' /0.001/; - PARAMETER TM_SCALE_CST 'Scaling factor cost units' /0.001/; - PARAMETER TM_DESUB(R) 'Elasticity of substitution between demands' //; - PARAMETER TM_STEP(R,CG,LIM) 'Steps in CES substitution' //; - PARAMETER TM_VOC(R,YEAR,CG,BD) 'Variance in CES component or utility' //; - -*--- Internal attributes --- - SET COM_GRP / AKL, LAB, KN, YN, CON, UTIL /; - SET NITER /1*18/; - SET TM_PP(R,YEAR) //; -* Initialized Scalar Defaults * - PARAMETER TM_DEFVAL / - DEPR 5 - ESUB 0.25 - KGDP 2.5 - KPVS 0.25 - DMTOL 0.1 - IVETOL 0.5 - NEGTOL 0.01 - MACVOC 0.4 - MACSTEP 200 - LOGSTEP 550 - USEHDF 1 - ESC 1.028 - /; - PARAMETER SOL_ACFR(R,UC_COST,T) Baseline annual cost data //; -* MACRO Sectoral Demands, marginals and AEEIs - PARAMETERS - TM_DEM(REG,YEAR,COM) Demand levels - TM_DMC(REG,YEAR,COM) Demand marginals - TM_DDF_Y(R,T) Production growths - TM_DDF_DM(R,T,C) Demand growth rate - TM_DDF_SP(R,T,C) Demand marginals change rate - TM_F2(R,T,C) Demand DDF calibration - TM_ANNC(REG,YEAR) Estimate of annual energy system cost - TM_GDPGOAL(REG,YEAR) Projected Baseline GDP - TM_GDP(R,T) Actualized gross domestic product - TM_QSFA(REG,T) Quadratic supply function A - TM_QSFB(REG,T,COM) Quadratic supply function B - TM_NWT(REG) Negishi weights - TM_NWTIT(NITER,REG) Negishi weights by iteration - TM_CIE(R,T,CG) Expnditure rate // - PAR_Y(R,T) Production parameter // - PAR_GRGDP(R,T) Growth rate of GDP // - PAR_MC(R,YEAR,C) Marginal costs of demands // - TM_RESULT(ITEM,R,YEAR) MACRO Summary result parameters // -; - - diff --git a/source/initmty.mod b/source/initmty.mod deleted file mode 100644 index 8838443..0000000 --- a/source/initmty.mod +++ /dev/null @@ -1,499 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* INITMTY.MOD has all the EMPTY declarations for system & user data * -* %1..%6 - File extensions of code extensions to be included * -*=============================================================================* -* All the EMPTY declarations for user data * -*=============================================================================* -*GaG Questions/Comments: -* - all but LOCAL (in single BATINCLUDE and its immediate lower routines) -* - consider PRC_MAP(PRC_GRP,PRC_SUBGRP,PRC) where PRC_SUBGRP = PRC_RSOURC + any user-provided sub-groupings -* - SOW/COM/PRC/CUR master sets (merged) == entire list, that is not REG -* - lists (eg, DEM_SECT) for _MAP sets not REG (but individual mappings are) -* - HAVE THE USER *.SET/DD files OMIT the declarations to ease maintenance changes -*----------------------------------------------------------------------------- -* Version control -$IF NOT FUNTYPE rpower $ABORT TIMES Version 4.0 and above Requires GAMS 22.0 or above! -$IF NOT FUNTYPE gamsversion $GOTO DECL -$IF gamsversion 149 $SETGLOBAL G2X6 Yes -$IF gamsversion 230 $SETGLOBAL OBMAC YES -$IF gamsversion 236 $SETGLOBAL G2X6 YES -$LABEL DECL -$ONEMPTY -*----------------------------------------------------------------------------- -* SET SECTION -*----------------------------------------------------------------------------- -* Note: the *-out user SETs are declared in INITSYS.MOD - -* commodities -* SET COM_GRP 'All CGs and each individal commodity'; -* SET COM(COM_GRP) 'All Commodities' //; - SET COM_DESC(REG,COM) 'Region-based commodity descriptions' //; -* SET COM_TYPE(COM_GRP) 'Primary grouping of commodities' //; - SET COM_GMAP(REG,COM_GRP,COM) 'User groups of individual commodities' //; - SET COM_LIM(REG,COM,LIM) 'List of equation type for balance' //; - SET COM_OFF(REG,COM,*,*) 'Periods for which a commodity is unavailable' //; - SET COM_TMAP(REG,COM_TYPE,COM) 'Primary grouping of commodities' //; - SET COM_TS(REG,COM,ALL_TS) 'List of commodity timeslices' //; - SET COM_TSL(REG,COM,TSLVL) 'Level at which a commodity tracked' //; - SET COM_UNIT(REG,COM,UNITS_COM) 'Units associated with each commodity' //; - -* currency -* SET CUR 'Currencies (c$)' //; - SET CUR_MAP(REG,CUR_GRP,CUR) 'Grouping of the currenies' //; - -* demands / emissions / financials - SET DEM_SMAP(REG,DEM_SECT,COM) 'Grouping of DEMs (commodities) to their sector' //; - SET ENV_MAP(REG,ENV_GRP,COM) 'Grouping of ENVs (commodities) to their emissions group' //; - SET FIN_MAP(REG,FIN_GRP,COM) 'Grouping of FINs (commodities) to their financial group' //; - -* materials - SET MAT_GMAP(REG,MAT_GRP,COM) 'Grouping of materials' //; - SET MAT_TMAP(REG,MAT_TYPE,COM) 'Material by type' //; - SET MAT_VOL(REG,COM) 'Material accounted for by volume' //; - SET MAT_WT(REG,COM) 'Material accounted for by weight' //; - -* energy - SET NRG_FMAP(REG,NRG_FORM,COM) 'Grouping of NRG by Solid/Liquid/Gas' //; - SET NRG_GMAP(REG,NRG_GRID,COM) 'Association of energy carriers to grids'//; - SET NRG_TMAP(REG,NRG_TYPE,COM) 'Grouping of energy carriers by type' //; - -* process -* SET PRC 'List of all processes' //; - SET PRC_AOFF(REG,PRC,*,*) 'Periods for which activity is unavailable' //; - SET PRC_ACTUNT(REG,PRC,CG,UNITS_ACT) 'Primary commodity (or group) & activity unit' //; - SET PRC_CAPUNT(REG,PRC,CG,UNITS_CAP) 'Unit of capacity' //; - SET PRC_CG(R,PRC,COM_GRP) 'Commodity groups for a process' //; - SET PRC_DESC(R,P) 'Process descriptions by region' //; - SET PRC_FOFF(REG,PRC,COM,ALL_TS,*,*) 'Periods/timeslices for which flow is not possible' //; - SET PRC_MAP(REG,PRC_GRP,PRC) 'Grouping of processes to nature' //; - SET PRC_NOFF(REG,PRC,*,*) 'Periods for which new capacity can NOT be built' //; - SET PRC_RMAP(REG,PRC_RSOURC,PRC) 'Grouping of XTRACT processes' //; - SET PRC_SPG(REG,PRC,COM_GRP) 'Shadow Primary Group' //; - SET PRC_TS(ALL_REG,PRC,ALL_TS) 'Timeslices for a process' //; - SET PRC_TSL(REG,PRC,TSLVL) 'Timeslice level for a process' //; - SET PRC_VINT(REG,PRC) 'Process is to be vintaged' //; - SET PRC_DSCNCAP(R,P) 'Processes with discrete capacity additions'; - SET PRC_RCAP(REG,PRC) 'Process with early retirement'; - SET PRC_SIMV(REG,PRC) 'Process is to be vintage-simulated'; - -* region -* SET REG(ALL_REG) 'List of Regions' //; - SET REG_GRP(*) 'List of regional groups' //; - SET REG_RMAP(REG_GRP,ALL_REG) 'Grouping of regions in/out of area of study' //; - -* time -* SET TS(ALL_TS) 'Time slices of the year //; - ALIAS(ALL_TS,TS,S,SL,S2); - SET TS_OFF(REG,TS,BOHYEAR,EOHYEAR) 'Timeslices turned off'; - SET TS_GROUP(ALL_REG,TSLVL,TS) 'Timeslice Level assignment' //; - SET TS_MAP(ALL_REG,ALL_TS,ALL_TS) 'Timeslice hierarchy tree: node+below' //; - SET MILESTONYR(ALLYEAR) 'Projection years for which model to be run' //; - ALIAS(MILESTONYR,T,TT); - SET DATAYEAR(ALLYEAR) 'Years for which user data is provided' //; - SET PASTYEAR(ALLYEAR) 'Years before 1st MILESTONYR for which PASTI needs to be handled' //; - SET MODLYEAR(ALLYEAR) 'Years for which the model is to be run (MILESTONYR+PASTYEAR)' //; - ALIAS(TSLVL,TSL); - -* topology - SET TOP(REG,PRC,COM,IO) 'Topology for all process' //; - SET TOP_IRE(ALL_REG,COM,ALL_REG,COM,PRC) 'Trade within area of study' //; - -* peaking - SET COM_PEAK(REG,COM_GRP) 'Peaking required flag' //; - SET COM_PKTS(REG,COM_GRP,TS) 'Peaking time-slices' //; - SET PRC_PKNO(ALL_REG,PRC) 'Processes which cannot be involved in peaking' //; - SET PRC_PKAF(ALL_REG,PRC) 'Flag for default value of NCAP_PKCNT' //; - -* storage - SET PRC_NSTTS(REG,PRC,ALL_TS) 'Night storage process and time-slice for storaging' //; - SET PRC_STGTSS(REG,PRC,COM) 'Storage process and stored commodity for time-slice storage' //; - SET PRC_STGIPS(REG,PRC,COM) 'Storage process and stored commodity for inter-period storage' //; - -* user constraints - SET UC_N(*) 'Names of all manual constraints' / OBJVAR /; - SET UC_T_SUCC(ALL_R,UC_N,ALLYEAR) 'Specification of periods, if UC_DYN=SUCC' //; - SET UC_T_SUM(ALL_R,UC_N,ALLYEAR) 'Specification of periods, if UC_DYN=SEVERAL' //; - SET UC_T_EACH(ALL_R,UC_N,ALLYEAR) 'Specification of periods, if UC_DYN=EACH' //; - SET UC_R_SUM(ALL_R,UC_N) 'Specification of regions, if UC_REG=SUM' //; - SET UC_R_EACH(ALL_R,UC_N) 'Specification of regions, if UC_REG=EACH' //; - SET UC_TS_SUM(ALL_R,UC_N,ALL_TS) 'Specification of time-slices, if UC_TS=SUM' //; - SET UC_TS_EACH(ALL_R,UC_N,ALL_TS) 'Specification of time-slices, if UC_TS=EACH' //; - SET UC_ATTR(ALL_R,UC_N,SIDE,UC_GRPTYPE,UC_NAME) 'Mapping of parameter names to groups' //; - SET UC_TSL(ALL_R,UC_N,SIDE,TSLVL) 'UC timeslice level' //; - ALIAS(UC_N,UCN); - -* miscellaneous -* SET SOW 'Stochastic State-of-the-World' //; - SET SW_T(ALLYEAR,ALLSOW) 'Stochastic state indexes by period' //; - SET G_UAMAT(U) 'Unit for activity of material process' //; - SET G_UANRG(U) 'Unit for activity of energy process' //; - SET G_UCMAT(U) 'Unit for capacity of material process' //; - SET G_UCNRG(U) 'Unit for capacity of energy process' //; - SET G_RCUR(REG,CUR) 'Main currency unit by region' //; - -* Predefined system CGs and one COM: -$IF NOT SET PGPRIM $SETGLOBAL PGPRIM "'ACT'" - SET COM_GRP / %PGPRIM%, CAPFLO /; - SET ACTCG(CG) / %PGPRIM% /; - SET COM / %PGPRIM% /; - -*----------------------------------------------------------------------------- -* PARAMETERS SECTION -*----------------------------------------------------------------------------- -* time - PARAMETER B(ALLYEAR) 'Beginning year of each model period' //; - PARAMETER E(ALLYEAR) 'Ending year of each model period' //; - PARAMETER M(ALLYEAR) 'Middle year of each Period' //; - PARAMETER D(ALLYEAR) 'Length of each period' //; - -* Activity - PARAMETER ACT_BND(REG,ALLYEAR,PRC,TS,BD) 'Bound on activity of a process' //; - PARAMETER ACT_COST(REG,ALLYEAR,PRC,CUR) 'Variable costs associated with activity of a process' //; - PARAMETER ACT_CSTUP(R,ALLYEAR,P,TSLVL,CUR) 'Variable costs associated with startup of a process' //; - PARAMETER ACT_CSTSD(R,ALLYEAR,P,UPT,BD,CUR) 'Start-up (BD=UP) and shutdown costs (BD=LO) per unit of started-up capacity, by start-up type'//; - PARAMETER ACT_CSTRMP(R,ALLYEAR,P,L,CUR) 'Ramp-up (L=UP) or ramp-down (L=LO) cost per unit of load change' //; - PARAMETER ACT_FLO(REG,ALLYEAR,PRC,CG,S) 'General process transformation parameter'// - PARAMETER ACT_TIME(R,ALLYEAR,P,L) 'Minimum online/offline hours' //; - PARAMETER ACT_CUM(REG,PRC,ITEM,ITEM,LIM) 'Bound on cumulative activity' //; - -* New Capacity - PARAMETER NCAP_AF(REG,ALLYEAR,PRC,TS,BD) 'Availability of capacity' //; - PARAMETER NCAP_AFA(REG,ALLYEAR,PRC,BD) 'Annual Availability of capacity' //; - PARAMETER NCAP_AFS(REG,ALLYEAR,PRC,TS,BD) 'Seasonal Availability of capacity' //; - PARAMETER NCAP_AFX(R,ALLYEAR,P) 'Change in capacity availability' //; - PARAMETER NCAP_AFSX(R,ALLYEAR,P,BD) 'Change in seasonal capacity availability'//; - PARAMETER NCAP_AFM(R,ALLYEAR,P) 'Pointer to availity change multiplier' //; - PARAMETER NCAP_BND(REG,ALLYEAR,PRC,LIM) 'Bound on overall capacity in a period' //; - PARAMETER NCAP_BPME(REG,ALLYEAR,PRC) 'Back pressure mode efficiency (or total eff.)' //; - PARAMETER NCAP_CDME(REG,ALLYEAR,PRC) 'Condensing mode efficiency' //; - PARAMETER NCAP_CEH(REG,ALLYEAR,PRC) 'Coefficient of electricity to heat' //; - PARAMETER NCAP_CHPR(REG,ALLYEAR,PRC,LIM) 'Combined heat:power ratio' //; - PARAMETER NCAP_CLED(REG,ALLYEAR,PRC,COM) 'Leadtime of a commodity before new capacity ready' //; - PARAMETER NCAP_CLAG(REG,ALLYEAR,PRC,COM,IO) 'Lagtime of a commodity after new capacity ready' //; - PARAMETER NCAP_COM(REG,ALLYEAR,PRC,COM,IO) 'Use (but +) of commodity based upon capacity' //; - PARAMETER NCAP_COST(REG,ALLYEAR,PRC,CUR) 'Investment cost for new capacity' //; - PARAMETER NCAP_CPX(REG,ALLYEAR,PRC) 'Pointer to capacity transfer multiplier' //; - PARAMETER NCAP_DRATE(REG,ALLYEAR,PRC) 'Process specific discount (hurdle) rate' //; - PARAMETER NCAP_FDR(REG,ALLYEAR,PRC) 'Functional depreciation rate of process' //; - PARAMETER NCAP_ELIFE(REG,ALLYEAR,PRC) 'Economic (payback) lifetime' //; - PARAMETER NCAP_FOM(REG,ALLYEAR,PRC,CUR) 'Fixed annual O&M costs' //; - PARAMETER NCAP_FOMX(REG,ALLYEAR,PRC) 'Change in fixed O&M' //; - PARAMETER NCAP_FOMM(REG,ALLYEAR,PRC) 'Pointer to fixed O&M change multiplier' //; - PARAMETER NCAP_FSUB(REG,ALLYEAR,PRC,CUR) 'Fixed tax on installed capacity' //; - PARAMETER NCAP_FSUBX(REG,ALLYEAR,PRC) 'Change in fixed tax' //; - PARAMETER NCAP_FSUBM(REG,ALLYEAR,PRC) 'Pointer to fixed subsidy change multiplier' //; - PARAMETER NCAP_FTAX(REG,ALLYEAR,PRC,CUR) 'Fixed tax on installed capacity' //; - PARAMETER NCAP_FTAXX(REG,ALLYEAR,PRC) 'Change in fixed tax' //; - PARAMETER NCAP_FTAXM(REG,ALLYEAR,PRC) 'Pointer to fixed tax change multiplier' //; - PARAMETER NCAP_ICOM(REG,ALLYEAR,PRC,COM) 'Input of commodity for install of new capacity' //; - PARAMETER NCAP_ILED(REG,ALLYEAR,PRC) 'Lead-time required for building a new capacity' //; - PARAMETER NCAP_ISUB(REG,ALLYEAR,PRC,CUR) 'Subsidy for a new investment in capacity' //; - PARAMETER NCAP_ITAX(REG,ALLYEAR,PRC,CUR) 'Tax on a new investment in capacity' //; - PARAMETER NCAP_ISPCT(REG,ALLYEAR,PRC) 'Subsidy as % of new investment cost' //; - PARAMETER NCAP_LCOST(REG,ALLYEAR,PRC) '% labor cost of new investment' //; - PARAMETER NCAP_LFOM(REG,ALLYEAR,PRC) '% labor cost of fixed O&M' //; - PARAMETER NCAP_PASTI(REG,ALLYEAR,PRC) 'Capacity install prior to study years' //; - PARAMETER NCAP_PASTY(REG,ALLYEAR,PRC) 'Buildup years for past investments' //; - PARAMETER NCAP_TLIFE(REG,ALLYEAR,PRC) 'Technical lifetime of a process' //; - PARAMETER NCAP_OLIFE(REG,ALLYEAR,PRC) 'Operating lifetime of a process'; - PARAMETER RCAP_BLK(REG,ALLYEAR,PRC) 'Retirement block size' //; - PARAMETER RCAP_BND(REG,ALLYEAR,PRC,LIM) 'Retirement bounds'; - -* decommissioning of Capacity - PARAMETER NCAP_DCOST(REG,ALLYEAR,PRC,CUR) 'Cost of decomissioning' //; - PARAMETER NCAP_DLAG(REG,ALLYEAR,PRC) 'Delay to begin decomissioning' //; - PARAMETER NCAP_DLAGC(REG,ALLYEAR,PRC,CUR) 'Cost of decomissioning delay' //; - PARAMETER NCAP_DELIF(REG,ALLYEAR,PRC) 'Economic lifetime to pay for decomissioning' //; - PARAMETER NCAP_DLIFE(REG,ALLYEAR,PRC) 'Time for the actual decomissioning' //; - PARAMETER NCAP_OCOM(REG,ALLYEAR,PRC,COM) 'Commodity release during decomissioning' //; - PARAMETER NCAP_VALU(REG,ALLYEAR,PRC,COM,CUR) 'Value of material released during decomissioning' //; - -* capacity installed - PARAMETER NCAP_START(REG,PRC) 'Start year for new investments' //; - PARAMETER NCAP_SEMI(R,ALLYEAR,P) 'Semi-continuous capacity, lower bound'; - PARAMETER CAP_BND(REG,ALLYEAR,PRC,BD) 'Bound on total installed capacity in a period' //; - -* general commodities - PARAMETER COM_BNDNET(REG,ALLYEAR,COM,TS,LIM) 'Net bound on commodity (e.g., emissions)' //; - PARAMETER COM_BNDPRD(REG,ALLYEAR,COM,TS,LIM) 'Limit on production of a commodity' //; - PARAMETER COM_CUMNET(REG,BOHYEAR,EOHYEAR,COM,LIM) 'Cumulative net bound on commodity (e.g. emissions)' //; - PARAMETER COM_CUMPRD(REG,BOHYEAR,EOHYEAR,COM,LIM) 'Cumulative limit on production of a commodity' //; - PARAMETER COM_CSTNET(REG,ALLYEAR,COM,TS,CUR) 'Cost on Net of commodity (e.g. emissions tax)' //; - PARAMETER COM_CSTPRD(REG,ALLYEAR,COM,TS,CUR) 'Cost on production of a commodity' //; - PARAMETER COM_FR(REG,ALLYEAR,COM,TS) 'Seasonal distribution of a commodity' //; - PARAMETER COM_IE(REG,ALLYEAR,COM,TS) 'Seasonal efficiency of commodity' //; - PARAMETER COM_SUBNET(REG,ALLYEAR,COM,TS,CUR) 'Subsidy on a commodity net' //; - PARAMETER COM_SUBPRD(REG,ALLYEAR,COM,TS,CUR) 'Subsidy on production of a commodity net' //; - PARAMETER COM_TAXNET(REG,ALLYEAR,COM,TS,CUR) 'Tax on a commodity net' //; - PARAMETER COM_TAXPRD(REG,ALLYEAR,COM,TS,CUR) 'Tax on production of a commodity net' //; - PARAMETER COM_AGG(REG,ALLYEAR,COM,COM) 'Commodity aggregation parameter' //; - -* demands - PARAMETER COM_BPRICE(REG,ALLYEAR,COM,TS,CUR) 'Base price of elastic demands' //; - PARAMETER COM_BQTY(REG,COM,TS) 'Base quantity for elastic demands' //; - PARAMETER COM_ELAST(REG,ALLYEAR,COM,TS,LIM) 'Elasticity of demand' //; - PARAMETER COM_ELASTX(REG,ALLYEAR,COM,BD) 'Elasticity shape of demand' //; - PARAMETER COM_PROJ(REG,ALLYEAR,COM) 'Demand baseline projection' //; - PARAMETER COM_STEP(REG,COM,LIM) 'Step size for elastic demand' //; - PARAMETER COM_VOC(REG,ALLYEAR,COM,BD) 'Variance of elastic demand' //; - -* flow of commodities through processes - PARAMETER FLO_BND(REG,ALLYEAR,PRC,CG,TS,BD) 'Bound on the flow variable' //; - PARAMETER FLO_COST(REG,ALLYEAR,PRC,COM,TS,CUR) 'Added variable O&M of using a commodity' //; - PARAMETER FLO_DELIV(REG,ALLYEAR,PRC,COM,TS,CUR) 'Delivery cost for using a commodity' //; - PARAMETER FLO_FEQ(REG,ALLYEAR,PRC,COM) 'Fossil equivalent of a commodity in a process' //; - PARAMETER FLO_FR(REG,ALLYEAR,PRC,COM,TS,LIM) 'Load-curve of availability of commodity to a process' //; - PARAMETER FLO_FUNC(REG,ALLYEAR,PRC,CG,CG,TS) 'Relationship between 2 (group of) flows' //; - PARAMETER FLO_FUNCX(REG,ALLYEAR,PRC,CG,CG) 'Change in FLO_FUNC/FLO_SUM by age' //; - PARAMETER FLO_SHAR(REG,ALLYEAR,PRC,C,CG,TS,BD) 'Relationship between members of the same flow group' //; - PARAMETER FLO_SUB(REG,ALLYEAR,PRC,COM,TS,CUR) 'Subsidy for the production/use of a commodity' //; - PARAMETER FLO_SUM(REG,ALLYEAR,PRC,CG,C,CG,TS) 'Multipier for commodity in cg1 where each is summed into cg2' //; - PARAMETER FLO_TAX(REG,ALLYEAR,PRC,COM,TS,CUR) 'Tax on the production/use of a commodity' //; - PARAMETER FLO_CUM(REG,PRC,COM,ITEM,ITEM,LIM) 'Bound on cumulative flow' //; - PARAMETER FLO_MARK(REG,ALLYEAR,PRC,COM,BD) 'Process-wise market share in total commodity production' //; - PARAMETER PRC_MARK(REG,ALLYEAR,PRC,ITEM,C,LIM) 'Process group-wise market share' //; - PARAMETER PRC_RESID(REG,ALLYEAR,PRC) 'Residual capacity available in each period' //; - PARAMETER PRC_REFIT(REG,PRC,PRC) 'Process with retrofit or life-extension'; - -* peak - PARAMETER NCAP_PKCNT(REG,ALLYEAR,PRC,ALL_TS) 'Fraction of capacity contributing to peaking in time-slice TS' //; - PARAMETER COM_PKRSV(REG,ALLYEAR,COM) 'Peaking reserve margin' //; - PARAMETER COM_PKFLX(REG,ALLYEAR,COM,TS) 'Peaking flux ratio' //; - PARAMETER FLO_PKCOI(REG,ALLYEAR,PRC,COM,ALL_TS) 'Factor increasing the average demand' //; - -* Storage - PARAMETER STG_EFF(REG,ALLYEAR,PRC) 'Storage efficiency' //; - PARAMETER STG_LOSS(REG,ALLYEAR,PRC,S) 'Annual energy loss from a storage technology' //; - PARAMETER STG_CHRG(REG,ALLYEAR,PRC,S) 'Exogeneous charging of a storage technology ' //; - PARAMETER STG_SIFT(R,ALLYEAR,P,C,S) 'Max load sifting in proportion to total load' //; - PARAMETER STGOUT_BND(REG,ALLYEAR,PRC,C,S,BD) 'Bound on output-flow of storage process' //; - PARAMETER STGIN_BND(REG,ALLYEAR,PRC,C,S,BD) 'Bound on output-flow of storage process' //; - -* Process units - PARAMETER PRC_ACTFLO(REG,ALLYEAR,PRC,CG) 'Convert from process activity to particular commodity flow' //; - PARAMETER PRC_CAPACT(REG,PRC) 'Factor for going from capacity to activity' //; - PARAMETER PRC_GMAP(REG,PRC,ITEM) 'User-defined groupings of processes' //; - -* globals - PARAMETER G_CHNGMONY(REG,ALLYEAR,CUR) 'Exchange rate for currency' //; - PARAMETER G_DRATE(REG,ALLYEAR,CUR) 'Discount rate for a currency'//; - PARAMETER G_RFRIR(REG,ALLYEAR) 'Riskfree real interest rate' //; - PARAMETER G_YRFR(ALL_REG,TS) 'Seasonal fraction of the year' //; - PARAMETER TS_CYCLE(REG,TS) 'Length of cycles below timeslice, in days' //; - PARAMETER G_OFFTHD(ALLYEAR) 'Threshold for OFF ranges'; - PARAMETER G_OVERLAP 'Overlap of stepped solutions (in years)' / 0 /; - PARAMETER REG_FIXT(ALL_R) 'Year up to which periods are fixed'; - PARAMETER REG_BDNCAP(ALL_R,L) 'Year up to which VAR_NCAPs are to be fixed'; - PARAMETER G_CUREX(CUR,CUR) 'Global currency conversions'; - PARAMETER R_CUREX(ALL_REG,CUR,CUR) 'Regional currency conversions'; - -* trade of commodities - PARAMETERS - IRE_BND(ALL_R,ALLYEAR,COM,TS,ALL_REG,IE,BD) 'Limit on inter-reg exchange of commodity' // - IRE_FLO(ALL_R,ALLYEAR,PRC,COM,ALL_R,COM,TS) 'Efficiency of exchange for inter-regional trade' // - IRE_FLOSUM(REG,ALLYEAR,PRC,COM,TS,IE,COM,IO) 'Aux. consumption/emissions from inter-regional trade'// - IRE_PRICE(REG,ALLYEAR,PRC,COM,TS,ALL_R,IE,CUR) 'Exogenous price of import/export' // - IRE_XBND(ALL_REG,ALLYEAR,COM,TS,IE,BD) 'Limit on all (external and inter-regional) exchange of commodity' // - IRE_CCVT(ALL_REG,COM,ALL_REG,COM) 'Commodity unit conversion factor between regions' // - IRE_TSCVT(ALL_REG,ALL_TS,ALL_REG,ALL_TS) 'Identification and TS-conversion factor between regions' //; - -* Shape and Multi - PARAMETER SHAPE(J,AGE) 'Shaping table' //; - PARAMETER MULTI(J,ALLYEAR) 'Multiplier table' //; - -* Regional Cost bounds - PARAMETERS - REG_BNDCST(REG,ALLYEAR,COSTAGG,CUR,BD) 'Bound on regional costs by type' // - REG_CUMCST(REG,ALLYEAR,ALLYEAR,COSTAGG,CUR,BD) 'Cumulative bound on regional costs' //; - -* User Constraints - - PARAMETER UC_RHS(UC_N,LIM) 'Constant in user constraint' //; - PARAMETER UC_RHST(UC_N,ALLYEAR,LIM) 'Constant in user constraint' //; - PARAMETER UC_RHSR(ALL_REG,UC_N,LIM) 'Constant in user constraint' //; - PARAMETER UC_RHSS(UC_N,TS,LIM) 'Constant in user constraint' //; - PARAMETER UC_RHSRT(ALL_REG,UC_N,ALLYEAR,LIM) 'Constant in user constraint' //; - PARAMETER UC_RHSRS(ALL_REG,UC_N,TS,LIM) 'Constant in user constraint' //; - PARAMETER UC_RHSRTS(ALL_REG,UC_N,ALLYEAR,TS,LIM) 'Constant in user constraint' //; - PARAMETER UC_RHSTS(UC_N,ALLYEAR,TS,LIM) 'Constant in user constraint' //; - - PARAMETERS - UC_FLO(UC_N,SIDE,ALL_REG,ALLYEAR,PRC,COM,TS) 'Multiplier of flow variables' // - UC_ACT(UC_N,SIDE,ALL_REG,ALLYEAR,PRC,ALL_TS) 'Multiplier of activity variables' // - UC_CAP(UC_N,SIDE,ALL_REG,ALLYEAR,PRC) 'Multiplier of capacity variables' // - UC_NCAP(UC_N,SIDE,ALL_REG,ALLYEAR,PRC) 'Multiplier of VAR_NCAP variables' // - UC_COMCON(UC_N,SIDE,ALL_REG,ALLYEAR,COM,TS) 'Multiplier of VAR_COMCON variables' // - UC_COMPRD(UC_N,SIDE,ALL_REG,ALLYEAR,COM,TS) 'Multiplier of VAR_COMPRD variables' // - UC_COMNET(UC_N,SIDE,ALL_REG,ALLYEAR,COM,TS) 'Multiplier of VAR_COMNET variables' // - UC_IRE(UC_N,SIDE,ALL_REG,ALLYEAR,PRC,COM,TS,IE) 'Multiplier of inter-regional exchange variables' // - UC_CUMACT(UC_N,ALL_REG,PRC,ITEM,ITEM) 'Multiplier of cumulative process activity variable' // - UC_CUMFLO(UC_N,ALL_REG,PRC,COM,ITEM,ITEM) 'Multiplier of cumulative process flow variable' // - UC_CUMCOM(UC_N,ALL_REG,COM_VAR,COM,ITEM,ITEM) 'Multiplier of cumulative commodity variable' // - UC_UCN(UC_N,SIDE,ALL_R,ALLYEAR,UC_N) 'Multiplier of user constraint variable' // - UC_TIME(UC_N,ALL_REG,ALLYEAR) 'Multiplier of time in model periods (years)' //; - -*----------------------------------------------------------------------------- -* Extensions & System scalars -*----------------------------------------------------------------------------- -* Damage input parameters - PARAMETER DAM_COST(REG,ALLYEAR,COM,CUR) 'Marginal damage cost of emissions'; - PARAMETER DAM_BQTY(REG,COM) 'Base quantity of emissions' //; - PARAMETER DAM_ELAST(REG,COM,LIM) 'Elasticity of damage cost'; - PARAMETER DAM_STEP(REG,COM,LIM) 'Step number for emissions up to base' //; - PARAMETER DAM_VOC(REG,COM,LIM) 'Variance of emissions' //; -* Experimental parameters - PARAMETER DAM_TQTY(REG,ALLYEAR,COM) 'Base quantity of emissions by year' //; - PARAMETER DAM_TVOC(REG,ALLYEAR,COM,LIM) 'Variance of emissions by year' //; - PARAMETER DAM_COEF(REG,ALLYEAR,COM,S) 'Coefficient from commodity to damage' //; -* Parameters used in report routine - PARAMETER RPT_OPT(ITEM,J) 'Reporting options' //; - PARAMETER CST_DAM(REG,T,COM) 'Damage costs' //; - PARAMETER CM_RESULT(ITEM,ALLYEAR) 'Climate module results' //; - PARAMETER CM_MAXC_M(ITEM,ALLYEAR) 'Shadow price of climate constraint' //; - PARAMETER TM_RESULT(ITEM,R,ALLYEAR) 'MACRO results' //; - -* Scalars - SCALARS MIYR_V1 /0/, MIYR_VL /0/, PYR_V1 /0/; - SCALAR MY_F /0/, F /0/, Z /0/, CNT /0/, DFUNC /0/, DONE /0/, IFQ /1/; -* maximum NCAP_ILED+NCAP_TLIFE+NCAP_DLAG+NCAP_DLIFE+NCAP_DELIF - SCALAR DUR_MAX / 0 /; -* first and last given data value to be extrapolated - SCALAR FIRST_VAL /0/, LAST_VAL /0/, MY_FYEAR /0/; -* Placeholder for interpolation control option -$ SETGLOBAL DFLBL '0' - YEARVAL('%DFLBL%') = 0; - SET LASTLL(LL) /%DFLBL%/; Z=SUM(LASTLL(LL),ORD(LL)); ABORT$(Z NE CARD(LL)) 'FATAL'; -* Interpolation defaults - SET INT_DEFAULT(*) //, UNCD1(*); - PARAMETER IE_DEFAULT(*) //; - -* --------------------------------------------------------------------------------------------- -*GG* V07_2 Initializations for BLENDing -* --------------------------------------------------------------------------------------------- -* user provided Sets & Scalars - SET BLE(COM) //; - SET OPR(COM) //; - SET SPE(*) //; - SET REF(R,PRC) //; - PARAMETER REFUNIT(R) //; - -* internal Sets - SET CVT / DENS, WCV, VCV, SLF /; - -* user provided Parameters - PARAMETER CONVERT(OPR,CVT) //; - PARAMETER BL_START(R,COM,SPE) //; - PARAMETER BL_UNIT(R,COM,SPE) //; - PARAMETER BL_TYPE(R,COM,SPE) //; - PARAMETER BL_SPEC(R,COM,SPE) //; -* PARAMETER TBL_SPEC(COM,SPE,YEAR) //; - PARAMETER BL_COM(R,COM,OPR,SPE) //; -* PARAMETER TBL_COM(COM,SPE,OPR,YEAR) //; - PARAMETER BL_INP(R,COM,COM) //; -* PARAMETER TBL_INP(COM,SPE,COM,YEAR) //; - PARAMETER BL_VAROMC(R,COM,CUR) //; -* PARAMETER TBL_VAROM(COM,SPE,YEAR) //; - PARAMETER BL_DELIVC(R,COM,COM,CUR) //; -* PARAMETER TBL_DELIV(COM,SPE,COM,YEAR) //; - PARAMETER ENV_BL(R,COM,COM,OPR,YEAR) //; - PARAMETER PEAKDA_BL(R,COM,YEAR) //; - -* internal Parameters - PARAMETER RU_CVT(R,BLE,SPE,OPR) //; - PARAMETER RU_FEQ(R,COM,YEAR) //; - - PARAMETER OBJ_BLNDV(R,YEAR,C,C,CUR) 'annual variable costs for blending' //; - - -*------------------------------------------------------------------------------ -* CONTROL section -*------------------------------------------------------------------------------ -$ SETGLOBAL GDXPATH -$ IFI EXIST gamssave\nul $SETGLOBAL GDXPATH 'gamssave\' -$ SETGLOBAL SYSPREFIX '' SETGLOBAL PRF FILE=1 -*------------------------------------------------------------------------------ -* Alternative objective controls - SCALAR ALTOBJ / 1 /; -$IFI %OBJ%==STD ALTOBJ=0; -$IFI %OBJ%==ALT ALTOBJ=2; -$IFI %OBJ%==LIN ALTOBJ=3; -$IFI %MACRO%==YES IF(ALTOBJ>1,ABORT 'MACRO Cannot be used with Alternative Objective'); -$IFI %VALIDATE%==YES IF(ALTOBJ>1,ABORT 'VALIDATE cannot be used with Alternative Objective'); ALTOBJ=0; -$SETGLOBAL CTST -$IFI %OBJ%==MOD $SETGLOBAL OBLONG YES -$IFI %OBJ%==ALT $SETGLOBAL CTST **EPS -$IFI %OBLONG%==YES $SETGLOBAL CTST **0 -$IFI %OBJ%==LIN $SETGLOBAL CTST **EPS -$IFI '%OBLONG%%OBJ%'==YESALT $SETGLOBAL VARCOST LIN -$IFI '%OBLONG%%OBJ%'==YESALT ALTOBJ = -2; -*------------------------------------------------------------------------------ -* Stochastic extension -$IFI %SENSIS%==YES $SETLOCAL STAGES yes -$IFI %SPINES%==YES $SETLOCAL STAGES YES -$IFI %STAGES%==YES $BATINCLUDE initmty.stc -*------------------------------------------------------------------------------ -* Stepped extensions etc. - SET ITEM / "%FIXBOH%", "%TIMESTEP%", "%SPOINT%" /; -$SETGLOBAL RPOINT NO -$IF SET SPOINT IF((NOT J('%SPOINT%'))$(NOT SAMEAS('%SPOINT%','YES')), ABORT 'Invalid Control: SPOINT'); -$IF SET TIMESTEP IF(NOT AGE('%TIMESTEP%'), ABORT 'Invalid Control: TIMESTEP'); -$IF SET FIXBOH IF(NOT ALLYEAR('%FIXBOH%'), ABORT 'Invalid Control: FIXBOH'); -$IF SET FIXBOH $SETGLOBAL STEPPED - -$IF SET TIMESTEP $SETGLOBAL STEPPED + -$IF SET STEPPED $SETGLOBAL VAR_UC YES -$IF %SYSTEM.LICENSELEVEL%==2 $SETGLOBAL VAR_UC YES -*------------------------------------------------------------------------------ -* Other extensions to TIMES code -*------------------------------------------------------------------------------ -* Auto-activation of discrete capacity extensions -$IF %DSCAUTO%==YES $SETGLOBAL DSC YES -$IF %PGPRIM%==ACT $SETGLOBAL RETIRE 'YES' SETGLOBAL DSCAUTO Yes -$IFI %DSC%==YES $KILL RCAP_BLK - -* Initialize list of standard extensions to be loaded -$SETGLOBAL EXTEND - -* Add recognized extensions if defined -$IFI '%ECB%'==YES $SETGLOBAL EXTEND '%EXTEND% ECB' -$IFI '%MACRO%'==CSA $SETGLOBAL EXTEND '%EXTEND% MSA' -$IFI '%MACRO%'==MSA $SETGLOBAL EXTEND '%EXTEND% MSA' -$IFI '%MACRO%'==MLF $SETGLOBAL EXTEND '%EXTEND% MLF' -$IFI '%ETL%' == YES $SETGLOBAL EXTEND '%EXTEND% ETL' -$IFI '%CLI%' == YES $SETGLOBAL EXTEND '%EXTEND% CLI' -$IFI '%DSC%' == YES $SETGLOBAL EXTEND '%EXTEND% DSC' -$IFI '%VDA%' == YES $SETGLOBAL EXTEND '%EXTEND% VDA' -$IFI '%ABS%' == YES $SETGLOBAL EXTEND '%EXTEND% ABS' -$IFI '%MCA%' == YES $SETGLOBAL EXTEND '%EXTEND% MCA' - -* Finally, add args %1...%6 to list of extensions: -$SETGLOBAL EXTEND %EXTEND% %1 %2 %3 %4 %5 %6 - -* Load all extension declarations -$IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod initmty %EXTEND% - -$IF ERRORFREE -$BATINCLUDE err_stat.mod '$IF NOT ERRORFREE' ABORT 'Errors in Compile' 'VARIABLE OBJz' ': Required _TIMES.g00 Restart File Missing' - -*------------------------------------------------------------------------------ -* Call MACRO initmty.tm -*------------------------------------------------------------------------------ -$IF NOT SET MACRO $SETGLOBAL MACRO N -$IF %MACRO%==YES $INCLUDE initmty.tm - -*------------------------------------------------------------------------------ -* Load data from GDX if DATAGDX set and %RUN_NAME%~DATA exists -$ IF NOT SET DATAGDX $GOTO RUN -$ IF NOT %G2X6%==YES $GOTO RUN -$ IF NOT SET RUN_NAME $SETNAMES %SYSTEM.INCPARENT% . RUN_NAME . -$ IF NOT EXIST %RUN_NAME%~data.gdx $GOTO RUN -$ hiddencall gdxdump %RUN_NAME%~data.gdx NODATA > _dd_.dmp -$ hiddencall sed "/^\(Alias\|[^($]*(\*) Alias\|[^$].*empty *$\)/{N;d;}; /^\([^$].*$\|$\)/d; s/\$LOAD.. /\$LOAD /I" _dd_.dmp > _dd_.dd -$ INCLUDE _dd_.dd -$ hiddencall rm -f _dd_.dmp -$ TITLE %SYSTEM.TITLE%# -$ GDXIN -$ LABEL RUN diff --git a/source/initmty.msa b/source/initmty.msa deleted file mode 100644 index 31cbc4a..0000000 --- a/source/initmty.msa +++ /dev/null @@ -1,117 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* INITMTY.MSA has all the EMPTY declarations for system & user data * -*=============================================================================* -* Basic Sets - SET NITER /1*18/; - SET MITER /1*16/; - SET TB(T), PP(T), TLAST(T); - ALIAS (T,TP); - -* Initialized Scalar Defaults * - SCALARS - TM_ARBM / 1 / - TM_SCALE_CST / 0.001 / - TM_SCALE_NRG / 1 / - TM_SCALE_UTIL / 0.001 / - ; - PARAMETER TM_DEFVAL / - DEPR 5 - ESUB 0.25 - KGDP 2.5 - KPVS 0.25 - DMTOL 0.1 - IVETOL 0.5 - REFTEMP 2.5 - REFLOSS 0.02 - ESC 1.028 - /; - -*============== Declare/Initialize User Defined Sets - - SET MR(REG) //; - SET DM(COM); - SET MRTC(REG,YEAR,COM); - SET TRD / NMR, IRE /; - SET TM_DAM(R,ITEM) //; - -*============== Declare/Initialize Input Parameters - - PARAMETER TM_GR(REG,YEAR) 'Growth rate' //; - PARAMETER TM_GDP0(REG) 'Initial GDP' //; - PARAMETER TM_DEPR(R) 'Depreciation rate' //; - PARAMETER TM_DMTOL(R) 'Demand lower bound factor' //; - PARAMETER TM_IVETOL(R) 'Investment and enery tolerance' //; - PARAMETER TM_KGDP(R) 'Initial capital to GDP ratio' //; - PARAMETER TM_KPVS(R) 'Capital value share' //; - PARAMETER TM_ESUB(R) 'Elasticity of substitution' //; - PARAMETER TM_MDTL(R) 'Market damage linear coeff.' //; - PARAMETER TM_MDTQ(R) 'Market damage quadratic coeff.' //; - PARAMETER TM_HSX(R,YEAR) 'Hockey-stick exponent' //; - -*============== Intermediate parameters for MACRO--1 - -* MACRO Sectoral Demands, marginals and AEEIs - PARAMETER TM_DDATPREF(REG,COM) //; - PARAMETER TM_DDF(REG,YEAR,COM) //; - PARAMETER TM_DEM(REG,YEAR,COM); - PARAMETER TM_DMC(REG,YEAR,COM); - - PARAMETERS - NYPER(T) number of years until next milestone - TM_EC0(REG) initial energy system cost // - TM_C0(REG) initial consumption - TM_Y0(REG) initial gross output - TM_IV0(REG) initial investment - TM_K0(REG) initial capital - TM_RHO(R) exponent derived from esub - TM_ASRV(R) annual capital survival factor - TM_TSRV(R,T) yearly capital survival factor according to number of years per period - TM_AKL(REG) prod function constant for k-l index; - -*============== Intermediate Parameters for MACRO--2 - - PARAMETERS - TM_AEEIV(R,YEAR,C) Annual AEEI and demand decoupling factor - TM_AEEIFAC(R,LL,C) Periodwise AEEI and demand decoupling factor - TM_B(REG,COM) Prod function constant for demand of useful energy - TM_D0(REG,COM) Base year useful demand - from TIMES - TM_DFACTCURR(R,LL) Current annual utility discount factor - TM_DFACT(R,ALLYEAR) Utility discount factor - TM_PWT(YEAR) Periodic utility weight - TM_L(REG,YEAR) Current labor force index (efficiency units) - TM_ANNC(REG,YEAR) Estimate of annual energy system cost - TM_AMP(REG,YEAR) Amortisation of past investments // - TM_GDPGOAL(REG,TP) Projected Baseline GDP - TM_GROWV(REG,YEAR) Potential Labor Growth Rates //; - - PARAMETERS - TM_QSFA(REG,TP) Quadratic supply function A - TM_QSFB(REG,TP,COM) Quadratic supply function B - TM_CATT(R) Catastrophic temperature - TM_UDF(R,ALLYEAR) Utility discount factor - TM_NWT(REG) Negishi weights - TM_NWTIT(NITER,REG) Negishi weights by iteration - TM_PVPI(ITEM,TP) Present value prices of tradeables; - - PARAMETERS - PAR_Y(R,T) Production parameter // - PAR_IV(R,YEAR) Investment parameter // - PAR_GRGDP(R,T) Growth rate of GDP // - PAR_MC(R,T,C) Marginal costs of demands // - ; - - PARAMETER TM_DDF_Y(R,T); - PARAMETER TM_DDF_DM(R,T,C); - PARAMETER TM_DDF_SP(R,T,C); - PARAMETER TM_F2(R,T,C); - PARAMETER TM_YCHECK(R); - -*==================* Results Parameters for MACRO - - PARAMETER TM_DD(R,C,T) Demand ratio MSA estimates to TED demand levels; - PARAMETER TM_GDP(REG,YEAR) Actualized gross domestic product; - PARAMETER TM_RESULT(ITEM,R,YEAR) MACRO Summary result parameters //; diff --git a/source/initmty.stc b/source/initmty.stc deleted file mode 100644 index 715af09..0000000 --- a/source/initmty.stc +++ /dev/null @@ -1,82 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* INITMTY.stc - Extension for Stochastics -*----------------------------------------------------------------------------- -* Questions/Comments: -*----------------------------------------------------------------------------- -$SETGLOBAL STAGES YES -*----------------------------------------------------------------------------- -* Input Control parameters - PARAMETER SW_START(J) //; - PARAMETER SW_SUBS(J,ALLSOW) //; - PARAMETER SW_SPROB(J,ALLSOW) //; - PARAMETER SW_PROB(ALLSOW) //; - PARAMETER SW_LAMBDA / 0 /; -* Predefined UC names for tradeoff analysis - SET UC_N / OBJZ, OBJ1 /; - -* Internal sets and parameters - ALIAS (ALLSOW,WW); - SET SW_CHILD(J,WW,WW) 'Child SOWs of parent SOW at stage J' //; - SET SW_TREE(J,WW,WW) 'Finest level SOWs of SOW at stage J' //; - SET SW_COPY(J,ALLSOW) 'Parent SOW of SOWs to be copied' //; - SET SW_CPMAP(J,WW,WW) 'Copy map for attributes' //; - SET SW_TSTG(LL,J) 'Valid stages J for each period T' //; - SET SW_MAP(T,WW,J,WW) 'Map from internal to original SOW' //; - SET SW_REV(WW,J,WW) 'Reverse SOW tree' //; - SET SUPERYR(T,ALLYEAR) 'SUpremum PERiod YeaR' //; - PARAMETER SW_DESC(J,ALLSOW) 'Number of finest level SOWs' //; - SCALARS SW_PHASE / 0 /, SW_PARM / 0 /, SW_NORM / 1 /, DOITER / 0 /; - -* Which SOWs are available at each period - SET SW_T(ALLYEAR,ALLSOW) 'Which SOWs are available at each period' //; - SET SW_TSW(ALLSOW,ALLYEAR,ALLSOW) 'Mapping from finest SOWs to unique SOW at each period' //; - SET SW_STAGE(J,ALLSOW) 'Internal SOWs at each stage' //; - SET SW_UCT(UC_N,T,ALLSOW) //; - PARAMETER SW_TPROB(T,ALLSOW) //; - -* Stochastic input parameters - PARAMETER S_COM_PROJ(REG,ALLYEAR,COM,J,ALLSOW) 'Demand scenario projection' //; - PARAMETER S_CAP_BND(REG,ALLYEAR,PRC,BD,J,ALLSOW) 'Bound on total installed capacity' //; - PARAMETER S_COM_CUMPRD(R,BOHYEAR,EOHYEAR,C,BD,J,ALLSOW) 'Cumulative limit on COMPRD' //; - PARAMETER S_COM_CUMNET(R,BOHYEAR,EOHYEAR,C,BD,J,ALLSOW) 'Cumulative limit on COMNET' //; - PARAMETER S_COM_TAX(R,ALLYEAR,C,S,COM_VAR,CUR,J,ALLSOW) 'Tax on commodity NET/PRD' //; - PARAMETER S_FLO_CUM(R,P,C,ITEM,ITEM,BD,J,ALLSOW) 'Cumulative limit on FLOW' //; - PARAMETER S_FLO_FUNC(R,ALLYEAR,P,CG,CG,J,ALLSOW) 'Uncertain multiplier of process transformation'; - PARAMETER S_NCAP_COST(R,ALLYEAR,P,J,ALLSOW) 'Uncertain multiplier of investment cost' //; - PARAMETER S_DAM_COST(R,ALLYEAR,C,CUR,J,ALLSOW) 'Damage costs'; - PARAMETER S_UC_RHS(UC_N,LIM,J,ALLSOW) 'RHS of user constraint' //; - PARAMETER S_UC_RHSR(ALL_REG,UC_N,LIM,J,ALLSOW) 'RHS of user constraint' //; - PARAMETER S_UC_RHST(UC_N,ALLYEAR,LIM,J,ALLSOW) 'RHS of user constraint' //; - PARAMETER S_UC_RHSRT(ALL_REG,UC_N,ALLYEAR,LIM,J,ALLSOW) 'RHS of user constraint' //; - PARAMETER S_UC_RHSTS(UC_N,ALLYEAR,TS,LIM,J,ALLSOW) 'RHS of user constraint' //; - PARAMETER S_UC_RHSRTS(ALL_REG,UC_N,ALLYEAR,TS,LIM,J,ALLSOW) 'RHS of user constraint' //; - PARAMETER S_CM_MAXCO2C(ALLYEAR,J,ALLSOW) 'Maximum allowable atmospheric CO2 concentration' //; - PARAMETER S_CM_MAXC(ALLYEAR,ITEM,J,ALLSOW) 'Maximum allowable climatic quantity' //; - PARAMETER S_CM_CONST(ITEM,J,ALLSOW) 'Climate constants' //; - PARAMETER S_UCOBJ(UC_N,ALLSOW) 'Weight of UC objective component in tradeoff analysis' //; - PARAMETER S_NCAP_AFS(R,ALLYEAR,P,S,J,ALLSOW) 'Seasonal availability factors'; - PARAMETER S_COM_FR(R,ALLYEAR,C,S,J,ALLSOW) 'Commodity fraction multipliers'; - -* Internal work sets and parameters - PARAMETER S_COM_CUM(R,COM_VAR,ALLYEAR,ALLYEAR,C,BD,J,ALLSOW) 'Cumulative limit on COMPRD' //; - SET T0(LL) 'Augmented periods'; - SET SW_T2W(WW,T,WW,LL) 'Augmented map for SOWs by period'; - SET RTCSW(R,T,C,S,WW) 'Indicator for uncertain timeslice fractions'; - SET RTPW(R,ALLYEAR,P,ALLSOW) 'Uncertain SOW by vintage'; - SET RP_FFSGG(R,P,CG,CG) 'Uncertain transformation groups'; - SET RP_FFSGGM(R,P,CG,CG,COM_GRP,COM_GRP) 'Map of transformation groups'; - PARAMETER OBJ_SIC(R,T,P,ALLSOW) 'Uncertainty in investments'; - PARAMETER SUC_L(ALL_R,UC_N) 'Dynamic type LHS' //; - PARAMETER RTP_SAFS(R,T,P,S,WW) 'Uncertain availability factors'; - PARAMETER RTCS_SFR(R,LL,C,S,WW,TS) 'Uncertain COM_FR multipliers'; - PARAMETER RCS_SSFR(R,C,S,TS,WW,LL) 'Uncertain COM_FR multipliers'; - -* Reporting - PARAMETER SPAR_UCSL(WW,UC_N,*,*,*) //; - PARAMETER CM_SRESULT(ALLSOW,ITEM,ALLYEAR) 'Climate Module basic results' //; - PARAMETER CM_SMAXC_M(ALLSOW,ITEM,ALLYEAR) 'Marginals for max constraints' //; -*----------------------------------------------------------------------------- \ No newline at end of file diff --git a/source/initmty.tm b/source/initmty.tm deleted file mode 100644 index 4dc1343..0000000 --- a/source/initmty.tm +++ /dev/null @@ -1,56 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================= -* INIT DECLARATIONS FOR THE MACRO EXTENSION -*============================================================================= -$ SETGLOBAL SPOINT 3 -* As in original IER implementation, disable warm start in MACRO -* This may be overridden in the RUN file after the INITMTY call - OPTION BRATIO=1; -*--- Input parameters --- -PARAMETER TM_ARBM /1000/; -PARAMETER TM_SCALE_UTIL 'Scaling factor utility function' /0/; -PARAMETER TM_SCALE_NRG 'Scaling factor demand units' /0/; -PARAMETER TM_SCALE_CST 'Scaling factor cost units' /0/; -PARAMETER TM_DEPR(R) 'Depreciation rate' //; -PARAMETER TM_DMTOL(R) 'Demand lower bound factor' //; -PARAMETER TM_ESUB(R) 'Elasticity of substitution' //; -PARAMETER TM_GDP0(R) 'GDP in the first period' //; -PARAMETER TM_GR(R,ALLYEAR) 'MACRO Projected Annual GDP Growth' //; -PARAMETER TM_IVETOL(R) 'Investment and enery tolerance' //; -PARAMETER TM_KGDP(R) 'Initial capital to GDP ratio' //; -PARAMETER TM_KPVS(R) 'Capital value share' //; -PARAMETER TM_QFAC(R) 'Switch for market penetration penalty function' //; -PARAMETER TM_EXPBND(R,ALLYEAR,P) 'Market Penetration Cutoff for Applying Cost Penalty' //; -PARAMETER TM_EXPF(R,ALLYEAR) 'Annual percent expansion factor' //; -*--- Calibration parameters --- -PARAMETER TM_EC0(R) 'Energy costs in the first period'; -PARAMETER TM_GROWV(R,ALLYEAR) 'Labour growth rate' //; -PARAMETER TM_DDATPREF(R,C) 'Reference marginal price for demand' //; -PARAMETER TM_DDF(R,ALLYEAR,C) 'Demand decoupling factor' //; -*--- Internal parameters --- -PARAMETER TM_PWT(ALLYEAR) 'Period weight'; -PARAMETER TM_AMP(R,ALLYEAR) 'Amortisation of past investments (from CSA only)' //; -PARAMETER TM_AKL(R) 'Production function constant' //; -PARAMETER TM_ASRV(R) 'Annual capital survival factor' //; -PARAMETER TM_RHO(R) 'Substitution constant' //; -PARAMETER TM_B(R,C) 'Demand coefficient' //; -PARAMETER TM_D0(R,C) 'Demand in first period' //; -PARAMETER TM_L(R,YEAR) 'Annual labor index' //; -PARAMETER TM_TSRV(R,YEAR) 'Capital survival factor between two periods' //; -PARAMETER TM_AEEIV(R,YEAR,C) 'Annual Autonomous energy efficiency and demand decoupling factor' //; -PARAMETER TM_AEEIFAC(R,YEAR,C) 'Periodwise Autonomous energy efficiency and demand decoupling factor' //; -PARAMETER TM_ADDER(R,T,C) 'Demand decoupling adder' //; -PARAMETER TM_C0(R) 'Consume in the first period' //; -PARAMETER TM_K0(R) 'Capital stock in first period' //; -PARAMETER TM_IV0(R) 'Investment in the first period' //; -PARAMETER TM_Y0(R) 'Annual production in first period' //; -PARAMETER TM_DFACT(R,YEAR) 'Utility discount factor' //; -PARAMETER TM_DFACTCURR(R,YEAR) 'Intermediate parameter for the utility discount factor' //; -PARAMETER TM_UDF(R,ALLYEAR) 'Utility discount factor' //; -PARAMETER TM_CAP(R,P) 'Base year capacity values for expanding technologies' //; -PARAMETER TM_CAPTB(R,P) 'Cumulative quadratic capacity penalty level' //; -PARAMETER TM_CSTINV(R,ALLYEAR,P) 'Annualized investment costs' //; -PARAMETER TM_YCHECK(R) 'Check' //; diff --git a/source/initmty.vda b/source/initmty.vda deleted file mode 100644 index 68f80d7..0000000 --- a/source/initmty.vda +++ /dev/null @@ -1,66 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* INITMTY.VDA has all the EMPTY declarations for system & user data * -*=============================================================================* -$ SETGLOBAL VDA YES -*============================================================================= -* User Input attributes in the VDA extension -*----------------------------------------------------------------------------- -* Process transformation parameters: - PARAMETERS - VDA_FLOP(REG,ALLYEAR,PRC,CG,S) 'General process transformation parameter' - VDA_EMCB(REG,ALLYEAR,COM,COM) 'Combustion emission parameter (aka EMI_comb)' // - VDA_CEH(REG,ALLYEAR,PRC) 'The slope of pass-out turbine (alias NCAP_CEH)' // - FLO_EMIS(REG,ALLYEAR,PRC,CG,COM,S) 'General process emission parameter' // - FLO_EFF(REG,ALLYEAR,PRC,CG,COM,S) 'General process flow-relation parameter' //; -*----------------------------------------------------------------------------- -* Commodity-dependent availabilities: -$ SET MX ,SEASON, WEEKLY, DAYNITE - SET STL / SET.S%MX% /; - PARAMETERS - NCAP_AFAC(REG,ALLYEAR,PRC,CG) 'Annual availability of capacity for commodity group CG' // - NCAP_AFC(REG,ALLYEAR,PRC,CG,STL) 'Availability of capacity for commodity group CG' - NCAP_AFCS(REG,ALLYEAR,PRC,CG,TS) 'Availability of capacity for commodity group CG'//; -*----------------------------------------------------------------------------- -* Dynamic UC variable bounds (UC_DYNBND user-defined) - SET UC_DYNBND(UC_N,LIM) 'Dynamic process-wise UC bounds' //; -*----------------------------------------------------------------------------- -* Activity efficiency and dispatching options - PARAMETERS - ACT_EFF(REG,YEAR,PRC,CG,TS) 'Activity efficiency for process' // - ACT_UPS(R,ALLYEAR,P,S,L) 'Max. ramp rate, fraction of capacity per hour' - ACT_MINLD(R,ALLYEAR,P) 'Minimum stable operation level' // - ACT_LOSPL(R,ALLYEAR,P,L) 'Fuel consumption increase at minimum load' // - ACT_CSTPL(R,ALLYEAR,P,CUR) 'Partial load cost penalty' // - ACT_MAXNON(R,LL,P,UPT) 'Max. non-operational time before transition to next stand-by condition, by start-up type, in hours' // - ACT_SDTIME(R,LL,P,UPT,BD) 'Duration of start-up (BD=UP) and shut-down BD=LO) phases, by start-up type, in hours' // - ACT_LOSSD(R,LL,P,UPT,BD) 'Efficiency at one hour from start-up (BD=UP) or at one hour to end of shut-down (BD=LO)' // - STG_MAXCYC(R,YEAR,P) 'Maximum number of storage cycles over lifetime' //; -*----------------------------------------------------------------------------- -* Special: Risk parameters & reporting options - PARAMETER UC_ACTBET(UC_N,ALL_REG,ALLYEAR,PRC); - PARAMETER UC_FLOBET(UC_N,ALL_REG,ALLYEAR,PRC,CG); - PARAMETER PRC_REACT(R,ALLYEAR,P) 'Reactance of transmission line'; - PARAMETER COM_CSTBAL(R,ALLYEAR,C,S,ITEM,CUR) 'Cost on specific component of node balance'; - PARAMETER GR_GENLEV(R,C) 'Grid connection category for electricity generation commodity'//; - PARAMETER GR_DEMFR(R,ALLYEAR,C,S) 'Fraction of total electricity demand allocated to grid node' //; - PARAMETER GR_ENDFR(R,ALLYEAR,C,CG) 'Fraction of sectoral electricity demand allocated to grid node' //; - PARAMETER GR_GENFR(R,ALLYEAR,C,ITEM) 'Fraction of electricity generation type allocated to grid node'//; - PARAMETER GR_GENMAP(R,P,ITEM) 'Mapping of technology to generation type' //; - PARAMETER GR_XBND(R,ALLYEAR) 'Maximum level of net imports to / exports from region' //; - PARAMETER GR_THMIN(R,LL,P) 'Thermal minimum level' //; - PARAMETER GR_VARGEN(R,S,ITEM,BD) 'Variance in type of generation'; -*----------------------------------------------------------------------------- -* Attributes for experimental ECB extension - PARAMETER COM_MSHGV(R,YEAR,C) 'Choices heterogeneity parameter' //; - PARAMETER NCAP_MSPRF(R,YEAR,C,P,LIM) 'Preference parameters in choice' //; -*----------------------------------------------------------------------------- -* Predefined items - SET ALL_REG / IMPEXP /; - SET COM_GRP / IMP, EXP /; - SET ITEM / OBJ /, UC_NAME / ANNUAL %MX% /; - SET UC_N /%SYSPREFIX%SOLVE_STATUS 'Model solution status code'/; -*----------------------------------------------------------------------------- \ No newline at end of file diff --git a/source/initsys.mod b/source/initsys.mod deleted file mode 100644 index 231e5af..0000000 --- a/source/initsys.mod +++ /dev/null @@ -1,187 +0,0 @@ -$TITLE TIMES -- VERSION 4.7.3 -*==========================================================================================* -* INITSYS.MOD has all the fixed system declarations for ETSAP TIMES * -*==========================================================================================* -$ onlisting ontext -*=========================================================================================== -* Copyright (C) 2000-2023 IEA Energy Technology Systems Analysis Programme (IEA-ETSAP). -* This software (ETSAP TIMES) is open source: you can redistribute it and/or modify it -* under the terms of the GNU General Public License v3.0 (see file NOTICE-GPLv3.txt). -* For further information, visit: . -* -* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -*=========================================================================================== -$ offtext -$ offlisting -$ SET TMP Restart -$ IF %SYSTEM.LICENSELEVEL%==2 $SET TMP Runtime -$ IF SET RunTimes $TITLE %SYSTEM.TITLE% -- %TMP% (v%RunTimes%) -$ PHANTOM EMPTY -$ ONEMPTY -$ ONMULTI -* TIME - SET ALL_TS ordering is crucial, since the order of time-slices within a TSLVL is used in EQ_STGTSS. -* Therefore, declare ALL_TS first, before the call to INITSYS.MOD. Example: -* -* SET ALL_TS 'Time-slices ' -* / ANNUAL 'Annual ' -* I 'Intermediate' -* S 'Summer ' -* W 'Winter ' -* / ; - - ALIAS(*,ITEM); -* Defaults for the some total spans available in the model: -$IF NOT SET BOTIME $SETGLOBAL BOTIME 1850 -$IF NOT SET EOTIME $SETGLOBAL EOTIME 2200 -$IF NOT %SHELL%==ANSWER -$IF SET MAXSOW SET ITEM /BOH, 1*%EOTIME%/; - - SET BOHYEAR 'BOH + years' / BOH, %BOTIME%*%EOTIME% / - SET ALLYEAR 'All Years' / %BOTIME%*%EOTIME% / - PARAMETER YEARVAL(ALLYEAR) 'Value of each year'; - YEARVAL(ALLYEAR) = %BOTIME% + ORD(ALLYEAR)-1; - SET EOHYEAR "'BOH/EOH' + years" / SET.BOHYEAR, EOH / - Parameter BEOH(*) 'BOH / EOH offset' / BOH +1, EOH -1 /; - SET PERIODYR(ALLYEAR,ALLYEAR) 'All years in each period' //; - SET ALL_TS 'The universe for time-slices' / ANNUAL / - SET ANNUAL(ALL_TS) 'Annual identifier' / ANNUAL / - SET TSLVL 'Timeslice levels' / ANNUAL, SEASON, WEEKLY, DAYNITE /; - PARAMETER TSLVLNUM(TSLVL) 'Timeslice level values' - / ANNUAL 1 - SEASON 2 - WEEKLY 3 - DAYNITE 4 /; -* SET SEASON(REG,ALL_TS) 'Seasons' //; -* SET WEEK(REG,ALL_TS) 'Week Sub-divisions ' //; -* SET DAYNITE(REG,ALL_TS) 'Daily Sub-divisions' //; - - ALIAS(ALLYEAR,YEAR,LL); - -* topology - SET IMPEXP 'Imports/Exports' / IMP, EXP / - SET IMP 'Imports' / IMP / - SET XPT 'Exports' / EXP / - SET IN_OUT 'Input/Output' / IN, OUT / - ALIAS(IMPEXP,IE); - ALIAS(IN_OUT,IO); - -* limits - SET LIM 'Limit Types' / LO, FX, UP, N / - SET BND_TYPE(LIM) 'Bound Types' / LO, FX, UP / - ALIAS(LIM,L,LIM_TYPE); - ALIAS(BND_TYPE,BD); - -* Start-up types - SET UPT 'Start-up types' / COLD, WARM, HOT / - -* Numbered sets - SET ALLYEAR / 0 /; - SET AGE 'Age for SHAPEing' / 1*200 / - SET J 'Supply/demand steps 1*COM_STEP and SHAPE/MULTI' / 1*999 / - ALIAS(J,JJ); - -* Master Set declarations - SET ALL_REG(*) 'External + Internal Regions' // - SET REG(ALL_REG) 'Region' // - ALIAS(ALL_REG,ALL_R); - ALIAS(REG,R); - - SET COM_GRP 'Commodities & Groups' - / DEM 'Demands', - NRG 'Energy', - MAT 'Material', - ENV 'Environmental Indicators', - FIN 'Financial' /; - ALIAS(COM_GRP,CG,CG1,CG2); - - SET COM(COM_GRP) 'Commodities' // - ALIAS(COM,C,COM1,COM2); - - SET PRC(*) 'Processes' // - ALIAS(PRC,P); - SET CUR(*) 'Currencies = c$' // - ALIAS(CUR,CURR); - -* Stochastics -$ SETGLOBAL MAXSOW 96 - SET ALLSOW 'State-of-the-World' / 1*%MAXSOW% / - SET SOW(ALLSOW) 'State-of-the-World' // - ALIAS(SOW,W); - -*------------------------------------------------------------------------------- -* UC facility - fixed sets and controls for user-constraints -*------------------------------------------------------------------------------- - SET SIDE 'LHS and RHS of an equation' / LHS, RHS / - PARAMETER UC_SIGN(SIDE) 'Sign of LHS and RHS expression' / LHS 1, RHS -1 /; - SETS COM_VAR / NET, PRD /, COV_MAP / NET.COMNET, PRD.COMPRD /; - -* List of parameters that can be used in user-constraints - SET UC_NAME 'Allowed parameters in user-constraints' - / COST, DELIV, TAX, SUB - EFF, NET, N - GROWTH, PERIOD, PERDISC, BUILDUP - CUMSUM, CUM+, SYNC, YES - CAPACT, CAPFLO, NEWFLO, ONLINE - ANNUL, INVCOST, INVTAX, INVSUB - FLO_COST, FLO_DELIV, FLO_SUB, FLO_TAX - NCAP_COST, NCAP_ITAX, NCAP_ISUB - /; - - SET UC_COST(UC_NAME) 'UC cost attributes' - / COST, DELIV, TAX, SUB, ANNUL /; - - SET UC_MAPCOST(UC_COST,UC_NAME) 'Compatibility map for cost attributes' - / COST.(FLO_COST,NCAP_COST) - DELIV.FLO_DELIV - ANNUL.(INVCOST,INVTAX,INVSUB) - TAX.(FLO_TAX,NCAP_ITAX) - SUB.(FLO_SUB,NCAP_ISUB) /; - - SET UC_ANNUL(UC_NAME) / INVCOST, INVTAX, INVSUB /; - SET UC_DYNT(UC_NAME) / N, CUMSUM, CUM+, SYNC /; - - SET UC_NUMBER 'Determines way of handling of REG,T and TS' - / SEVERAL, SUCC, EACH /; - - SET UC_PERDS(UC_NAME) / PERIOD, NEWFLO /; - SET UC_NEWFLO(UC_NAME) / NEWFLO /; - - SET UC_GRPTYPE 'Type of components within UC_GRP' - / ACT, FLO, IRE, CAP, NCAP, COMNET, COMPRD, COMCON, UCN /; - - SET COSTAGG 'Types of cost aggregations' - / INV, INVTAX, INVSUB, FOM, FOMTAX, FOMSUB, COMTAX, COMSUB, FLOTAX, FLOSUB, - INVTAXSUB, INVALL, FOMTAXSUB, FOMALL, FIX, FIXTAX, FIXSUB, FIXTAXSUB, FIXALL, - COMTAXSUB, FLOTAXSUB, ALLTAX, ALLSUB, ALLTAXSUB /; - ALIAS (COSTAGG,COSTCAT) - ALIAS (UC_COST,COSTYPE) -*------------------------------------------------------------------------------- -* control sets -* - expected in *.RUN file -* - throw switch other way in *.RUN to change -*------------------------------------------------------------------------------- -* user should provide name in *.RUN -$ SET MODEL_NAME TIMES -$ SET RUN_NAME TEST -* control of whether all 0 lines are dumped in *.PUT files; user provides 0 to NOT print lines with all 0s (or empty) - SCALAR DUMP0 /1/, OPTFILEID /1/; -* user set to 'YES' to activate -$ SET DEBUG NO -$ SET DUMPSOL NO -$ SET SOLANS NO -* user set to 'NO' to not abort when error condition fails -$ SET ERR_ABORT YES -* user sets to 'WWW' to activate -$ SET GAMS_CGI NO -* user sets to 'NO' if only want to compile -$ SET SOLVE_NOW YES - -* get list of default units -$ BATINCLUDE units.def - -* get list of default mapping group lists -$ BATINCLUDE maplists.def - -* get defalut global scalars and parameters -$ BATINCLUDE globals.def diff --git a/source/main_ext.mod b/source/main_ext.mod deleted file mode 100644 index 12fc046..0000000 --- a/source/main_ext.mod +++ /dev/null @@ -1,23 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MAIN_EXT.mod is the extension driver -*=============================================================================* -* %1 is the name of the extension module to be called, e.g. 'rpt_ext' for reporting extensions -* Different extensions are identified by file extensions given in %2, %3, %4....%9 -* Example: $BATINCLUDE rpt_ext ETL RP1 RP2 -* This would include the reporting extensions for ETL and two custom -* reporting routines rpt_ext.RP1 and rpt_ext.RP2 -*----------------------------------------------------------------------------- -$SETNAMES %SYSTEM.INCPARENT% . TMP . -$SETLOCAL WHCALL %1 -$LABEL MORE -$SHIFT -$IF %1. == . $GOTO DONE -$IF NOT SETLOCAL %1 -$IF EXIST %WHCALL%.%1 $BATINCLUDE %WHCALL%.%1 %1 %TMP% -$SETLOCAL %1 YES -$GOTO MORE -$LABEL DONE diff --git a/source/maindrv.mod b/source/maindrv.mod deleted file mode 100644 index 2037fc9..0000000 --- a/source/maindrv.mod +++ /dev/null @@ -1,134 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MAINDRV.EXT is the main driver hooking together the various core model code * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* Questions/Comments: -* - BATINCLUDE calls should all be with lower case file names for UNIX -* - Move the NO_EMTY to the *.RUN (user controlled) for dumpdata control -* and make YES/NO the expected value in DUMPPUT -* - [AL]: support for TIMES extension modules added -*----------------------------------------------------------------------------- -*$ONLISTING -* adjust GAMS language defaults to allow mixed mode $ tests and allow latest syntax -*----------------------------------------------------------------------------- -$ ONEMPTY -$ ONMIXED -$ USE999 -$ SETLOCAL SRC %1 -$ SETENV GDXCOMPRESS 1 -$ BATINCLUDE setglobs 1 -$ SET MODEL_NAME TIMES -$ IFI %MICRO%%TIMESED%==YES0 $SET TIMESED YES -$ IFI %MACRO%==YES $SET MACRO 'YES' SET TIMESED 0 -$ IF NOT %SYSTEM.FILESYS%==MSNT $SET MODEL_NAME times -$ IFI NOT %TIMESED%==NO -$ IF NOT %TIMESED%==0 $BATINCLUDE readbprice.mod -$ %MX% SETGLOBAL MX -$ IFI %MACRO%==YES $SET MODEL_NAME 'TIMES_MACRO' SETLOCAL SRC tm -* Stochastic & sensitivity analysis controls -$ IFI %STAGES% == YES $SET STAGES YES -$ IFI %SENSIS% == YES $SET STAGES Yes -$ IFI %SPINES% == YES $SET STAGES YES -$ IF %STAGES% == YES $SET SENSIS 'NO' SET OBJANN NO -* Stepped TIMES solution controls -$ IF SET TIMESTEP $SETGLOBAL STEPPED + -$ SET R_T 'R,T' SET TX 'T' SET R_V_T 'R,V,T' SET RTPX '' -$ IF SET STEPPED $SET R_T 'R,SUBT(T)' SET TX 'SUBT(T)' SET R_V_T 'R,V,SUBT(T)' -$ IF SET FIXBOH -$ IF DEFINED REG_FIXT $SET R_T 'RT_PP(%R_T%)' SET R_V_T 'RVT(%R_V_T%)' SET RTPX X -*----------------------------------------------------------------------------- -* do a check on user data -*----------------------------------------------------------------------------- -$ BATINCLUDE err_stat.mod '$IF NOT ERRORFREE' ABORT '*** ERRORS IN INPUT DATA/COMPILE ***' - -*----------------------------------------------------------------------------- -* hook for GAMS-CGI WWW input -*----------------------------------------------------------------------------- -$ IF %GAMS_CGI% == WWW $BATINCLUDE www_in.cgi - -*----------------------------------------------------------------------------- -* perform preprocessor tasks -*----------------------------------------------------------------------------- -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod init_ext %EXTEND% -$ BATINCLUDE ppmain.%1 %1 -$ IFI %INTEXT_ONLY% ==YES $GOTO SKIPTOEND -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod ppm_ext %EXTEND% -*----------------------------------------------------------------------------- -* dump out the user/system data structures -*----------------------------------------------------------------------------- -$ IF %DEBUG% == YES execute_unload "DATADUMP.gdx"; -*----------------------------------------------------------------------------- -* Set the main controls for stochastic mode -$ IFI %STAGES%==YES $BATINCLUDE stages.stc -$ IF %STAGES%==YES $%SW_TAGS% -$ IF NOT %STAGES%==YES $%SW_NOTAGS% -*----------------------------------------------------------------------------- -* build the coefficients -*----------------------------------------------------------------------------- -$ IFI '%MID_YEAR%'==YES $SET DISCSHIFT 0.5 -$ BATINCLUDE coefmain.%1 %1 -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod coef_ext %EXTEND% -*----------------------------------------------------------------------------- -* establish model (use different .ext?) -*----------------------------------------------------------------------------- -$ BATINCLUDE mod_vars.%SRC% -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod mod_vars %EXTEND% -$ BATINCLUDE eqmain.%1 %1 -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod equ_ext %EXTEND% -*----------------------------------------------------------------------------- -$ BATINCLUDE mod_equa.%SRC% -$ IFI %MERGE% == YES $GOTO BNDSET -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod mod_ext %EXTEND% -** End of MODEL statement is removed from mod_equa and added here: -/; - -$LABEL BNDSET -*----------------------------------------------------------------------------- -* establish bounds -*----------------------------------------------------------------------------- -$ BATINCLUDE bndmain.%1 %1 0 - -*----------------------------------------------------------------------------- -* do quality assurance checks -*----------------------------------------------------------------------------- -$ BATINCLUDE pp_qack.%1 %1 - -*----------------------------------------------------------------------------- -* do an check on compile/execute errors -*----------------------------------------------------------------------------- -$ BATINCLUDE err_stat.%1 '$IF NOT ERRORFREE' ABORT '*** ERRORS IN GAMS COMPILE ***' -$ BATINCLUDE err_stat.%1 ABORT EXECERROR '*** ERRORS IN GAMS EXECUTION ***' -$ BATINCLUDE spoint.%1 1 -$ IF NOT %RPOINT%==NO $GOTO REPORT -*----------------------------------------------------------------------------- -* solve the appropriate model & report solver status -*----------------------------------------------------------------------------- -$ SETLOCAL EXT %1 -$ IFI %STAGES% == YES $SETLOCAL EXT stc -$ IF SET STEPPED $SETLOCAL EXT stp -$ IFI %MERGE% == YES $SETLOCAL EXT mrg -$ BATINCLUDE solve.%EXT% %1 -$ IF %SOLVE_NOW% == NO $GOTO SKIPTOEND - -*----------------------------------------------------------------------------- -* produce the reports -*----------------------------------------------------------------------------- -$ LABEL REPORT -$ BATINCLUDE rptmain.%1 %1 NO_EMTY -$ IF NOT %TIMESED%==0 -$ IF NOT %TIMESED%==YES $BATINCLUDE wrtbprice.mod -$ IF SET SPOINT $BATINCLUDE spoint.%1 0 - -*----------------------------------------------------------------------------- -* do an check on compile/execute errors from reports -*----------------------------------------------------------------------------- -$ BATINCLUDE err_stat.mod '$IF NOT ERRORFREE' ABORT '*** ERRORS IN GAMS COMPILE ***' -$ BATINCLUDE err_stat.mod ABORT EXECERROR '*** ERRORS IN GAMS EXECUTION ***' -*----------------------------------------------------------------------------- - -$LABEL SKIPTOEND -*$OFFLISTING diff --git a/source/maplists.def b/source/maplists.def deleted file mode 100644 index 90f9592..0000000 --- a/source/maplists.def +++ /dev/null @@ -1,122 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==============================================================================* -* MAPLISTS.DEF has all the (fixed for now) MAPPING set group declarations -* For the most part the primary purpose of these lists is to group reporting -* table information, however some set members are explicitly tested for in -* the code and should not be removed/re-defined. -*==============================================================================* -* commodities - SET COM_TYPE(COM_GRP) 'List of main commodity types groups' -* This list should NOT be adjusted as these group names are explicitly referenced in the code! - / DEM 'Demands' - NRG 'Energy' - MAT 'Material' - ENV 'Environmental Indicators' - FIN 'Financial' /; - SET PG_SMAP(CG,J,CG) 'Map from PG to SPG' / - DEM.(1.NRG,2.MAT,3.ENV) - NRG.(1.MAT,2.DEM,3.ENV) - MAT.(1.NRG,2.DEM,3.ENV) - ENV.(1.NRG,2.MAT,3.DEM) /; - -* currency - SET CUR_GRP 'List of currency groups' - / DOMESTIC 'Domestic' - FOREIGN 'Foreign' - INTLAID 'International Aid' - RDD 'Research & Development' /; - -* demands - SET DEM_SECT 'List of demand sectors' - / RES 'Residential' - COM 'Commercial' - IND 'Industrial' - TRN 'Transportation' - AGR 'Agriculture' - NE 'Non-energy' - OTH 'Other' /; - -* environmental - SET ENV_GRP 'List of emission groups' - / GHG 'Greenhouse Gases' - PEM 'Particulate emissions' - OEM 'Other emissions' - OTHENV 'Other indicators' /; - -* financial - SET FIN_GRP 'List of financial groups' - / DOMESTIC 'Domestic' - FOREIGN 'Foreign' - INTLAID 'International Aid' /; - -* materials - SET MAT_GRP 'List of material groups' - / PRIMARY 'Primary' - PRODUCT 'Product' - WASTE 'Waste' /; - SET MAT_TYPE 'List of material types' - / DURABLE 'Durables' - CONSUMED 'Consumed' - FINITE 'Finite' - RECYCLED 'Recycled' - RNEWABLE 'Renewable' /; - -* energy - SET NRG_FORM 'List of energy forms' - / SOLID 'Solids' - LIQUID 'Liquids' - GAS 'Gaseous' /; - SET NRG_GRID 'List of grid types' - / ELC 'Electricity' - LTHEAT 'Low-temperature Heat' - HTHEAT 'High-temperature Heat' - GAS 'Natural Gas'/; - SET NRG_TYPE 'List of energy types' - / FOSSIL 'Fossil' - NUCLR 'Nuclear' - SYNTH 'Synthetic' - RATE 'Rate of doing work or transferring heat (dW/dt)' - RENEN 'Renewable Energies' - LIMRENEW 'Limited Renewables' -* these values are explicitly referenced in the code to release the balance EQ - FRERENEW 'Unlimited Renewables' - CONSRV 'Conservation' -* these values are explicitly referenced in the code, e.g. part of CHP modeling - ELC 'Electricity' - HTHEAT 'High-temperature Heat' - LTHEAT 'Low-temperture Heat' /; - -* processes - SET PRC_GRP 'List of process groups' - / XTRACT 'Extraction' - RENEW 'Renewables (limited)' - PRE 'Energy' - PRW 'Material (by weight)' - PRV 'Material (by volume)' - REF 'Refined Products' - ELE 'Electric Generation' - HPL 'Heat Generation' -* this value is explicitly referenced in the code to ensure CHP attributes appropriate - CHP 'Combined Heat+Power' - DMD 'Demand Devices' - DISTR 'Distribution Systems' - CORR 'Corridor Device' - STG 'Storage' - NST 'Night (Off-peak) Storage' - IRE 'Inter-region exchange (IMPort/EXPort)' - STK 'Stockpiling' - MISC 'Miscellaneous' - STS 'Time-slice storage (excluding night storages)' - SGS 'General process with storage capability' /; - - SET PRC_RSOURC 'List of domestic resource supply groups' - / UNDRGRD 'Underground' - STRIP 'Strip Mine' - OFFSHR 'Offshore' - ONSHR 'Onshore' - ENHANCED 'Enhanced Recovery' - BYPRD 'By-product' - HARVST 'Harvest & Gathering' /; diff --git a/source/mod_equa.mod b/source/mod_equa.mod deleted file mode 100644 index 48cba63..0000000 --- a/source/mod_equa.mod +++ /dev/null @@ -1,216 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MOD_EQUA.MOD lists all the equations for each of the MODEL instances * -* a MODEL / / block will appear for each model supported * -*=============================================================================* -*GaG Questions/Comments: -* - any non-binding (=N=) accounting equations, or do it all with reports? -* - Investment component = investment cost + tax/sub + decom, not split? -* - Fixed component = O&M cost + tax/sub, not split? -*----------------------------------------------------------------------------- -$IF %1==CORE $GOTO CORE - - MODEL TIMES / -*----------------------------------------------------------------------------- -* Objective Function & Components -*----------------------------------------------------------------------------- -* Overall OBJ linear combination of the regional objs (which are built from rest) - EQ_OBJ - -$IFI %STAGES%==YES - EQ_EXPOBJ, EQ_UPDEV, %EQ%_SOBJ, %EQ%_ROBJ - -* Resource depletion costs -* EQ_OBJDPL - -* Costs of elastic demands -$IF %TIMESED% == YES %EQ%_OBJELS -$IFI %OBJANN% == YES $GOTO CORE - -* Fixed Costs including tax/subsidy - %EQ%_OBJFIX - -* investment component including tax/subsidy - %EQ%_OBJINV - -* Salvage - %EQ%_OBJSALV - -* Variable operating costs - %EQ%_OBJVAR - -$LABEL CORE -*----------------------------------------------------------------------------- -* MACRO calibration -*----------------------------------------------------------------------------- -$IFI %OBJANN%==YES EQ_OBJANN, EQ_ANNFIX, EQ_ANNINV, EQ_ANNVAR - -*----------------------------------------------------------------------------- -* Core Equations -*----------------------------------------------------------------------------- -* Relationship between process activity & individual commodity flows - %EQ%_ACTFLO - -* Bound of vintage process activity or TS-level above PRC_TS - %EQ%G_ACTBND - %EQ%E_ACTBND - %EQ%L_ACTBND - -* Bound on commodities - %EQ%G_BNDNET - %EQ%E_BNDNET - %EQ%L_BNDNET - %EQ%G_BNDPRD - %EQ%E_BNDPRD - %EQ%L_BNDPRD - -* Utilization of capacity, or the relationship between process capacity and activity - %EQ%L_CAPACT - %EQ%E_CAPACT - %EQ%G_CAPACT -$IF DEFINED PRC_SIMV EQL_CAPVAC, EQE_CAPVAC, EQG_CAPVAC - -* Basic commodity balance equations (by type) ensuring that production >=/= consumption - %EQ%G_COMBAL - %EQ%E_COMBAL - %EQ%E_COMPRD -$IF %TIMESED%==YES %EQ%L_COMCES - -* Transfer of installed capacity between periods - %EQ%E_CPT - %EQ%G_CPT - %EQ%L_CPT - -* Bound on the flow variable - %EQ%G_FLOBND - %EQ%E_FLOBND - %EQ%L_FLOBND - -* Bound on the fraction of a flow within a time slice - %EQ%G_FLOFR - %EQ%E_FLOFR - %EQ%L_FLOFR - -* Market share equation allocating commodity percentages of a group - %EQ%G_INSHR - %EQ%E_INSHR - %EQ%L_INSHR - -* Inter-regional exchange balance - %EQ%_IRE - -* Bound on inter-regional exchange of a commodity - %EQ%G_IREBND - %EQ%E_IREBND - %EQ%L_IREBND - -* Bound on total exchange of a commodity to/from all regions - %EQ%G_XBND - %EQ%E_XBND - %EQ%L_XBND - -* Product share equation allocating commodity percentages of a group - %EQ%G_OUTSHR - %EQ%E_OUTSHR - %EQ%L_OUTSHR - -* Market share equation for process in total commodity production - %EQ%G_FLOMRK - %EQ%E_FLOMRK - %EQ%L_FLOMRK - -* Peaking Equation - %EQ%_PEAK - -* Commodity-to-commodity transformation - %EQ%_PTRANS - -* Cumulative commodity NET/PRD and flow constraint - %EQ%_CUMNET - %EQ%_CUMPRD - %EQ%_CUMFLO - -* Time-slice storage - %EQ%_STGTSS - %EQ%_STSBAL - EQ_STSLEV - -* Bounds on in/output flows of storage process - %EQ%G_STGIN - %EQ%E_STGIN - %EQ%L_STGIN - %EQ%G_STGOUT - %EQ%E_STGOUT - %EQ%L_STGOUT - -* Inter-period storage - %EQ%_STGIPS - %EQ%_STGAUX - -* User-constraint - - %EQ%E_UC - %EQ%E_UCR - %EQ%E_UCT - %EQ%E_UCRS - %EQ%E_UCRT - %EQ%E_UCTS - %EQ%E_UCRTS - %EQ%E_UCSU - %EQ%E_UCRSU - %EQ%E_UCSUS - %EQ%E_UCRSUS - -$IF '%VAR_UC%' == YES $GOTO UCDONE - - EQG_UC - EQG_UCR - EQG_UCT - EQG_UCRS - EQG_UCRT - EQG_UCTS - EQG_UCRTS - EQG_UCSU - EQG_UCRSU - EQG_UCSUS - EQG_UCRSUS - - EQL_UC - EQL_UCR - EQL_UCT - EQL_UCRS - EQL_UCRT - EQL_UCTS - EQL_UCRTS - EQL_UCSU - EQL_UCRSU - EQL_UCSUS - EQL_UCRSUS - -$LABEL UCDONE - -* Bounds on costs by region, category and currency - %EQ%_BNDCST - -*--------------------------------------------------------------------- -*GG* V07_2 Refinery blending -*--------------------------------------------------------------------- - EQL_BLND - EQG_BLND - EQE_BLND - EQN_BLND - -*----------------------------------------------------------------------------- -* damages -*----------------------------------------------------------------------------- -$IF DEFINED DAM_COST -$IF NOT %DAMAGE%==NO %EQ%_DAMAGE, %EQ%_OBJDAM - -$IF DEFINED VNRET %EQ%_DSCRET, %EQ%_CUMRET, %EQ%L_SCAP, %EQ%L_REFIT -$IFI %SPINES%==YES %EQ%_OBW1 - -* [AL] Commented out the end of MODEL statement - now in maindrvx.mod -*/; diff --git a/source/mod_equa.tm b/source/mod_equa.tm deleted file mode 100644 index 1c5ee46..0000000 --- a/source/mod_equa.tm +++ /dev/null @@ -1,91 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MOD_EQUA.MOD lists all the equations for each of the MODEL instances * -* a MODEL / / block will appear for each model supported * -*=============================================================================* - - MODEL TIMES_MACRO / - -$IFI %MERGE%==YES ALL /; -$IFI %MERGE%==YES $EXIT -*----------------------------------------------------------------------------- -* Objective Function & Components -*----------------------------------------------------------------------------- -* Overall OBJ linear combination of the regional objs (which are built from rest) - EQ_OBJ - -* Fixed Costs - EQ_ANNFIX - -* Investment component - EQ_ANNINV - -* Variable operating costs (including substitution loss in MLF) - EQ_ANNVAR - -*----------------------------------------------------------------------------- -* Core Equations -*----------------------------------------------------------------------------- -$ SET OBJANN NO -$ BATINCLUDE mod_equa.mod CORE -$ IF %MACRO%==Yes $GOTO MLF -*--------------------------------------------------------------------- -* MACRO equations -*--------------------------------------------------------------------- - EQ_UTIL - EQ_CONSO - EQ_DD - EQ_MCAP - EQ_TMC - EQ_IVECBND - EQ_ESCOST - EQ_MPEN - EQ_XCAPDB -$ EXIT -*--------------------------------------------------------------------- -$ LABEL MLF -$ IF %NONLP%==NL $GOTO NONLP -*--------------------------------------------------------------------- -* MACRO MLF equations -*--------------------------------------------------------------------- - EQ_UTILP - EQ_CONSO - EQ_CONDA - EQ_LOGBD - EQ_MACSH - EQ_MACAG - EQ_MACES - EQ_KNCAP - EQ_MCAP - EQ_TMC - EQ_IVECBND - EQ_DD - EQ_DEMSH - EQ_DEMAG - EQ_DEMCES - EQ_ENSCST - EQ_TRDBAL -* EQ_MPEN -* EQ_XCAPDB -$ EXIT -*--------------------------------------------------------------------- -$ LABEL NONLP -*--------------------------------------------------------------------- -* MACRO MLF NLP benchmark equations -*--------------------------------------------------------------------- - EQ_UTIL - EQ_PROD_Y - EQ_AKL - EQ_LABOR - EQ_KNCAP - EQ_MCAP - EQ_TMC - EQ_DD - EQ_IVECBND - EQ_DNLCES - EQ_ENSCST - EQ_TRDBAL -* End of MODEL statement now in maindrv.mod diff --git a/source/mod_ext.abs b/source/mod_ext.abs deleted file mode 100644 index 4811606..0000000 --- a/source/mod_ext.abs +++ /dev/null @@ -1,28 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================* -* MOD_EQUA.ABS Ancillary Balancing Services equations -* called from MOD_EQUA.MOD -*==================================================================* -$IFI NOT %OBMAC%==YES $EXIT - EQ_BS00 - EQ_BS01 - EQ_BS02 - EQ_BS03 - EQ_BS04 - EQ_BS05 - EQ_BS07 - EQ_BS09 - EQ_BS10 - EQ_BS11 - EQ_BS18 - EQ_BS19 - EQ_BS22 - EQ_BS23 - EQ_BS24 - EQ_BS25 - EQ_BS26 - EQ_BS27 - EQ_BS28 diff --git a/source/mod_ext.cli b/source/mod_ext.cli deleted file mode 100644 index 4bc2f21..0000000 --- a/source/mod_ext.cli +++ /dev/null @@ -1,13 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================* -* MOD_EXT.EXT EXTENSION EQUATIONS * -* called from MAINDRV.MOD * -*==================================================================* - %EQ%_CLITOT - %EQ%_CLICONC - %EQ%_CLITEMP - %EQ%_CLIBEOH - %EQ%_CLIMAX diff --git a/source/mod_ext.dsc b/source/mod_ext.dsc deleted file mode 100644 index 4f186a9..0000000 --- a/source/mod_ext.dsc +++ /dev/null @@ -1,12 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================* -* MOD_EXT.EXT EXTENSION EQUATIONS * -* called from MAINDRV.MOD * -*==================================================================* -$IF NOT DEFINED PRC_DSCNCAP $EXIT - -%EQ%_DSCNCAP -%EQ%_DSCONE diff --git a/source/mod_ext.etl b/source/mod_ext.etl deleted file mode 100644 index 346797c..0000000 --- a/source/mod_ext.etl +++ /dev/null @@ -1,21 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================* -* MOD_EQUA.ETL Endogenous Technological learning equations * -* called from MOD_EQUA.MOD * -*==================================================================* - %EQ%_CUINV - %EQ%_CC - %EQ%_DEL - %EQ%_COS - %EQ%_LA1 - %EQ%_LA2 - %EQ%_EXPE1 - %EQ%_EXPE2 - %EQ%_IC1 - %EQ%_IC2 -* cluster - %EQ%_CLU - %EQ%_MRCLU diff --git a/source/mod_ext.ier b/source/mod_ext.ier deleted file mode 100644 index f70e621..0000000 --- a/source/mod_ext.ier +++ /dev/null @@ -1,18 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================* -* MOD_EXT.EXT EXTENSION EQUATIONS * -* called from MAINDRV.MOD * -*==================================================================* -EQE_MRKPRD -EQL_MRKPRD -EQG_MRKPRD -EQE_MRKCON -EQL_MRKCON -EQG_MRKCON -$IF %CHP_MODE%==YES EQL_CHPCON -$IF %CHP_MODE%==YES EQL_CHPBPT -$IF %CHP_MODE%==YES EQE_CHPCON -$IF %CHP_MODE%==YES EQE_CHPBPT diff --git a/source/mod_ext.vda b/source/mod_ext.vda deleted file mode 100644 index d55596b..0000000 --- a/source/mod_ext.vda +++ /dev/null @@ -1,52 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* MOD_EXT.EXT Extension equations -* Called from MAINDRV.MOD -*============================================================================* - - %EQ%E_ACTEFF - %EQ%L_CAFLAC - %EQ%E_CAFLAC - %EQ%L_CAPFLO - - %EQ%_CAPLOAD - %EQ%_ACTRAMP - %EQ%E_ACTUPS - %EQ%L_ACTUPS - %EQ%L_ACTUPC - %EQ%_ACTPL - %EQ%_ACTRMPC - %EQ%_SLSIFT - EQL_STGCCL - - %EQ%E_UCRTP - %EQ%N_UCRTP - %EQ%N_UCRTC - - %EQ%E_ASHAR - %EQ%L_ASHAR - %EQ%G_ASHAR - -$IF %OBMAC%==YES - eq_sdlogic, eq_sudupt, eq_sdslant, eq_sdminon, eq_sudload, eq_sudtime, eq_sudpll - -$IFI %DUC%%OBMAC%==YESYES - eq_sdind_1, eq_sdind_0 - -$IF DEFINED UC_FLOBET - %EQ%G_UCMAX, %EQ%G_UCSUMAX - -$IF DEFINED COM_CSTBAL - EQ_OBJBAL - -$IFI %POWERFLO%==YES - %EQ%_GR_POWFLO, %EQ%_GR_GENALL, %EQ%_GR_DEMALL, %EQ%_GR_XBND - -$IF DEFINED GR_VARGEN - %EQ%_RL_LOAD, %EQ%_RL_NDIS, %EQ%_RL_STCAP, %EQ%_RL_PKCAP, %EQ%_RL_THMIN - -$IF DEFINED RTC_MS -$IF %ECB%==YES %EQ%_MSNCAP, %EQ%_MSNCAPB diff --git a/source/mod_vars.abs b/source/mod_vars.abs deleted file mode 100644 index 0340c7e..0000000 --- a/source/mod_vars.abs +++ /dev/null @@ -1,54 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================* -* MOD_VARS.EXT EXTENSION VARIABLES -* called from MAINDRV.MOD -*==================================================================* - - POSITIVE VARIABLES - %VAR%_COMLV(CLVT,R,YEAR,C,S%SWD%) Commodity levels - %VAR%_BSPRS(R,YEAR,T,P,C,S,L%SWD%) Balancing services // - %VAR%_RLD(R,T,S,ITEM%SWD%) Reserve-defining load levels - ; - - EQUATIONS - EQ_BS00(R,T,C,S,ALLSOW) Overall demands for balancing services - EQ_BS01(R,YEAR,C,S,ITEM,L,ALLSOW) Max and Diff over stochastic & determistic demand - EQ_BS02(R,T,S,ITEM,ALLSOW) Load levels by process category - EQ_BS03(R,T,C,S,ALLSOW) Stochastic demand for balancing services - EQ_BS04(R,T,C,S,P,ALLSOW) Deterministic demand for balancing services - EQ_BS05(R,YEAR,T,P,TSL,L,S,ALLSOW) Minimum online - offline times - EQ_BS07(R,YEAR,T,P,S,BD,ALLSOW) Ramping constraints - EQ_BS09(R,YEAR,T,P,S,L,ALLSOW) Capacity margin constraints - positive - EQ_BS10(R,YEAR,T,P,S,ALLSOW) Capacity margin constraints - negative - EQ_BS11(R,YEAR,T,P,C,S,BD,ALLSOW) Limits for spinning reserve by type - EQ_BS18(R,YEAR,T,P,S,BD,ALLSOW) Lower limits for non-spinning reserve by type - EQ_BS19(R,YEAR,T,P,C,S,BD,ALLSOW) Upper limits for non-spinning reserve by type - EQ_BS22(R,YEAR,T,P,S,ALLSOW) Limit for positive reserve from storage - EQ_BS23(R,YEAR,T,P,S,ALLSOW) Limit for negative reserve from storage - EQ_BS24(R,YEAR,T,P,S,ALLSOW) Limits for negative reserve from end-use - EQ_BS25(R,YEAR,T,P,S,ALLSOW) Limits for positive reserve from end-use - EQ_BS26(R,T,P,C,S,ALLSOW) Bounds for process reserves - EQ_BS27(R,YEAR,T,P,S,ALLSOW) Maintenance 1 - EQ_BS28(R,YEAR,T,P,S,ALLSOW) Maintenance 2 - ; - -* Set minimum exogenous demand - BS_CAPACT(R)$(NOT BS_CAPACT(R)) = MAX(0,SMAX(RP_STD(R,P)$GR_GENMAP(R,P,'SI'),PRC_CAPACT(R,P))); - BS_CAPACT(R)$(NOT BS_CAPACT(R)) = MAX(0,SMAX(BS_SUPP(RP_STD(R,P)),PRC_CAPACT(R,P))); - %VAR%_COMLV.LO('DET',RTCS_VARC(R,T,C,S)%SOW%) $= BS_RTCS('EXOGEN',R,T,C,S)*BS_CAPACT(R); - RPT_OPT('RATE','1')$(RPT_OPT('RATE','1')<=0)=SMAX(R,BS_CAPACT(R))$(RPT_OPT('RATE','1')=0); - -* Set bounds on reserve flows - BS_BNDPRS(RTP,C,S,BDNEQ)$=BS_BNDPRS(RTP,C,S,'FX'); - BS_BNDPRS(RTP,C,S,'N')$SUM(BDNEQ$BS_BNDPRS(RTP,C,S,BDNEQ),1) = 1; - LOOP((L(BDUPX),BD)$(BDSIG(L)*BDSIG(BD)<0), - %var%_bsprs.LO(r,t,t,p,c,s,l%SOW%)$(RTP(R,T,P)$BS_COMTS(R,C,S)) $= BS_BNDPRS(R,T,P,C,S,BD); - %var%_bsprs.UP(r,t,t,p,c,s,l%SOW%)$(RTP(R,T,P)$BS_COMTS(R,C,S)) $= BS_BNDPRS(R,T,P,C,S,L)); - -$IFI NOT %OBMAC%==YES $EXIT -* Spines macros -$ macro Z_COMLV VAS_COMLV -$ macro Z_BSPRS VAS_BSPRS diff --git a/source/mod_vars.cli b/source/mod_vars.cli deleted file mode 100644 index a39bb8f..0000000 --- a/source/mod_vars.cli +++ /dev/null @@ -1,26 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MOD_VARS.CLI lists the individual variables of CLI instances of the MODEL * -*=============================================================================* -* Comments: For convenience, equations are declared here as well -*----------------------------------------------------------------------------- -POSITIVE VARIABLES - %VAR%_CLITOT(CM_VAR,LL %SWD%) 'Total emissions or forcing by milestone year' - %VAR%_CLIBOX(CM_VAR,LL %SWD%) 'Quantities in the climate reservoirs' -; -*----------------------------------------------------------------------------- -EQUATIONS - %EQ%_CLITOT(CM_VAR,T,LL %SWD%) 'Balances for the total emissions or forcing' - %EQ%_CLICONC(CM_VAR,CM_BOX,T %SWD%) 'Balances for the concentration in the reservoirs' - %EQ%_CLITEMP(CM_VAR,CM_BOX,T %SWD%) 'Balances for the temperature in the reservoirs' - %EQ%_CLIBEOH(CM_VAR,CM_BOX,T,LL %SWD%) 'Balances for the quantities in the BEOH reservoirs' - %EQ%_CLIMAX(ALLYEAR,CM_VAR %SWD%) 'Constraint for maximum climate quantities' -; -OPTION CLEAR=%EQ%_CLITOT; -*----------------------------------------------------------------------------- -* Allow some negative emissions - %VAR%_CLITOT.LO(CM_VAR,LL %SOW%)$CM_LED(LL) = MIN(-15,CM_BEMI(CM_VAR,LL)); - %VAR%_CLITOT.LO(CM_VAR('FORCING'),LL%SOW%)$CM_LED(LL) = -2; \ No newline at end of file diff --git a/source/mod_vars.dsc b/source/mod_vars.dsc deleted file mode 100644 index 97bdbe4..0000000 --- a/source/mod_vars.dsc +++ /dev/null @@ -1,19 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MOD_VARS.EXT EXTENSION VARIABLES -* called from MAINDRV.MOD -*=============================================================================* -*-----------------------------------------------------------------------------* -* Discrete capacity extensions -*-----------------------------------------------------------------------------* -* Investments -$SETGLOBAL SEMICONT SEMICONT -SOS1 VARIABLE %VAR%_DNCAP(R,ALLYEAR,P%SWD%,UNIT); -%SEMICONT% VARIABLE %VAR%_SNCAP(R,ALLYEAR,P%SWD%); - -* Bounds for semicont -%VAR%_SNCAP.LO(R,T,P%SOW%) $= NCAP_SEMI(R,T,P); -%VAR%_SNCAP.UP(R,T,P%SOW%)$NCAP_SEMI(R,T,P) = MAX(NCAP_SEMI(R,T,P),NCAP_BND(R,T,P,'UP')); \ No newline at end of file diff --git a/source/mod_vars.etl b/source/mod_vars.etl deleted file mode 100644 index 48a9558..0000000 --- a/source/mod_vars.etl +++ /dev/null @@ -1,39 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MOD_VARS.ETL endogenous technology change variables -*=============================================================================* -* %1 - source code extension -*----------------------------------------------------------------------------- -* VARIABLES -*----------------------------------------------------------------------------- -POSITIVE VARIABLES - %VAR%_LAMBD(R,ALLYEAR, PRC, KP %SWD%) - %VAR%_CCAP(R,ALLYEAR,PRC %SWD%) - %VAR%_CCOST(R,ALLYEAR,PRC %SWD%) - %VAR%_IC(R,ALLYEAR,PRC %SWD%) - -BINARY VARIABLES - %VAR%_DELTA(R,ALLYEAR,PRC,KP %SWD%) - -*----------------------------------------------------------------------------- -* EQUATIONS -*----------------------------------------------------------------------------- -EQUATIONS - %EQ%_CUINV(R,ALLYEAR, PRC %SWTD%) Cumulative Capacity Definition - %EQ%_CC(R,ALLYEAR, PRC %SWTD%) Cumulative Capacity Interpolation - %EQ%_DEL(R,ALLYEAR, PRC %SWTD%) Delta to 1 - %EQ%_COS(R,ALLYEAR, PRC %SWTD%) Cumulative Cost - %EQ%_LA1(R,ALLYEAR, PRC, KP %SWTD%) Constraints on lambda 1 - %EQ%_LA2(R,ALLYEAR, PRC, KP %SWTD%) Constraints on lambda 2 - %EQ%_EXPE1(R,ALLYEAR, PRC, KP %SWTD%) Experience grows 1 - %EQ%_EXPE2(R,ALLYEAR, PRC, KP %SWTD%) Experience grows 2 - %EQ%_IC1(R,ALLYEAR, PRC %SWTD%) Investments tech. change 1st period - %EQ%_IC2(R,ALLYEAR, PRC %SWTD%) Investments tech. change other periods -* cluster - %EQ%_CLU(R,ALLYEAR, PRC %SWTD%) Cluster - %EQ%_MRCLU(R,ALLYEAR, PRC %SWTD%) Multi-regional Cluster -; - diff --git a/source/mod_vars.mod b/source/mod_vars.mod deleted file mode 100644 index 8fc957c..0000000 --- a/source/mod_vars.mod +++ /dev/null @@ -1,96 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MOD_VARS.MOD lists the individual variables of all instances of the MODEL * -*=============================================================================* -* Questions/Comments: -* - -*----------------------------------------------------------------------------- -* Set of standard objective components - SET OBV / OBJINV, OBJFIX, OBJSAL, OBJVAR /; - -*----------------------------------------------------------------------------- - POSITIVE VARIABLES -*----------------------------------------------------------------------------- -* Process-related variables -*----------------------------------------------------------------------------- - %VAR%_ACT(R,ALLYEAR,ALLYEAR,P,S %SWD%) Overall activity of a process - %VAR%_CAP(R,ALLYEAR,P %SWD%) Installed capacity of a process - %VAR%_FLO(R,ALLYEAR,ALLYEAR,P,C,S %SWD%) Level of process commodity flow - %VAR%_IRE(R,ALLYEAR,ALLYEAR,P,C,S,IE %SWD%) Inter-regional trade flow - %VAR%_NCAP(R,ALLYEAR,P %SWD%) New capacity of a process - -*----------------------------------------------------------------------------- -* Commodity-related variables -*----------------------------------------------------------------------------- - %VAR%_COMNET(R,ALLYEAR,C,S %SWD%) Net commodity level - %VAR%_COMPRD(R,ALLYEAR,C,S %SWD%) Production of commodity - %VAR%_ELAST(R,ALLYEAR,C,S,J,BD %SWD%) Demand change due to price elasticity - %VAR%_DEM(R,MILESTONYR,C %SWD%) Demand variable for MACRO - -*----------------------------------------------------------------------------- -* Cumulative variables -*----------------------------------------------------------------------------- - %VAR%_CUMCOM(R,C,COM_VAR,ALLYEAR,ALLYEAR %SWD%) Cumulative commodity PRD or NET - %VAR%_CUMFLO(R,P,C,ALLYEAR,ALLYEAR %SWD%) Cumulative process flow - %VAR%_CUMCST(R,ALLYEAR,ALLYEAR,COSTAGG,CUR %SWD%) Cumulative regional cost - -*----------------------------------------------------------------------------- -* Storage variables -*----------------------------------------------------------------------------- - %VAR%_SIN(R,ALLYEAR,ALLYEAR,P,C,S %SWD%) Input flow into storage - %VAR%_SOUT(R,ALLYEAR,ALLYEAR,P,C,S %SWD%) Output flow from storage - -*----------------------------------------------------------------------------- -* Additional features -*----------------------------------------------------------------------------- - %VAR%_BLND(R,ALLYEAR,COM,COM %SWD%) Refinery blending - %VAR%_DAM(R,T,C,BD,J %SWD%) Damage variables - %VAR%_RCAP(R,ALLYEAR,LL,P %SWD%) New retirements - %VAR%_SCAP(R,ALLYEAR,LL,P %SWD%) Cumulative retirements - %VAR%_UPS(R,ALLYEAR,ALLYEAR,P,S,L %SWD%) Start-ups - %VAR%_UPT(R,ALLYEAR,ALLYEAR,P,S,UPT%SWD%) Start-ups by type - %VAR%_UDP(R,ALLYEAR,ALLYEAR,P,S,L %SWD%) Unit dispatching - %VAR%_RLD(R,T,S,ITEM %SWD%) Residual loads - -*=============================================================================* -* Objective Function Components -* - investment cost + tax/sub + decommissioning in INV -* - fixed O&M + fixed tax/sub in FIX -* - variable O&M + commodity direct costs -* - salvage -*=============================================================================* - %VAR%_OBJ(R,OBV,CUR %SWD%) "Objective costs INV,SAL,FIX,VAR,DAM" - %VAR%_OBJELS(R,BD,CUR %SWD%) "Change in Consumer surplus" - VAS_UPDEV(ALLSOW) "Upside deviation of OBJ" - - - VARIABLES -*=============================================================================* -* Objective Function Variables -* - total discounted system cost -*=============================================================================* - - OBJz - VAS_EXPOBJ Expected value of total OBJ - -*----------------------------------------------------------------------------- -* Slack variables of user-constraints -*----------------------------------------------------------------------------- - %VAR%_UC(UC_N %SWD%) Slacks for UC constraints - %VAR%_UCR(UC_N,R %SWD%) Slacks for UCR constraints - %VAR%_UCT(UC_N,T %SWD%) Slacks for UCT constraints - %VAR%_UCRT(UC_N,R,T %SWD%) Slacks for UCRT constraints - %VAR%_UCTS(UC_N,T,S %SWD%) Slacks for UCTS constraints - %VAR%_UCRTS(UC_N,R,T,S %SWD%) Slacks for UCRTS constraints - ; - -*----------------------------------------------------------------------------- -* Other variables in model extensions -*----------------------------------------------------------------------------- -* [AL] ETL variables automatically by extension manager -$IF DECLARED VNRET $BATINCLUDE prepret.dsc DECL -$IF DEFINED PRC_REACT $BATINCLUDE powerflo.vda DECL -$IF NOT DEFINED VAR_STS PARAMETER VAR_STS(R,YEAR,T,P,S,L) //; \ No newline at end of file diff --git a/source/mod_vars.msa b/source/mod_vars.msa deleted file mode 100644 index fd45282..0000000 --- a/source/mod_vars.msa +++ /dev/null @@ -1,34 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* MOD_VARS.MSA Variable declarations for MACRO Stand-Alone -*============================================================================* -$ BATINCLUDE preppm.msa MSA -*---------------------------------------------------------------------------- -* MACRO Related Variables - -POSITIVE VARIABLES - VAR_K(REG,T) total capital stock - VAR_D(REG,T,COM) annual energy demands - before aeei adjustments - VAR_INV(REG,T) annual investments - VAR_EC(REG,T) annual energy cost - VAR_SP(REG,T,COM) artificial variable for scaling shadow price of demand - VAR_Y(REG,T) annual economy output (production) - VAR_C(REG,T) annual consumption - VAR_DEM(REG,T,COM) Decoupled demands used in the energy model - VAR_CDM(R,ITEM,LL) climate change damage - -* Objective Function Value - -VARIABLES - VAR_UTIL discounted log of consumption - VAR_NTX(R,T,ITEM) trade (exports positive) -; -OPTION CLEAR=VAR_NTX; -VAR_CDM.LO(R,'N',XTP) = .01; - -* Enable MACRO discount rates if requested -$IF DEFINED TM_UDF $SETGLOBAL OBJANN YES -$IF NOT DEFINED TM_UDF OPTION CLEAR=TM_UDF; diff --git a/source/mod_vars.tm b/source/mod_vars.tm deleted file mode 100644 index c973679..0000000 --- a/source/mod_vars.tm +++ /dev/null @@ -1,57 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* MOD_VARS.MOD lists the individual variables of all instances of the MODEL -*=============================================================================* -* Questions/Comments: -* - no need to add SOW-index to variables under MACRO -*----------------------------------------------------------------------------- - -* Include declarations for all variables in standard TIMES -$ INCLUDE mod_vars.mod - - SET OBVANN(OBV) / OBJINV, OBJFIX, OBJVAR /; - -* Activate demand variables - RD_NLP(DEM) = 1; - - POSITIVE VARIABLES - -*-----------------------------------------------------------------------------* -* MACRO Interface Variables -* - Annual Cost Components: investment, fixed, variable costs -* - Annual Demands -*-----------------------------------------------------------------------------* - VAR_ANNCST(OBV,R,ALLYEAR,CUR) Annualized costs - VAR_DEM(R,MILESTONYR,C) Annual useful demand - -*-----------------------------------------------------------------------------* -* MACRO variables -*-----------------------------------------------------------------------------* - VAR_EC(R,ALLYEAR) 'Annual energy costs in MACRO' - VAR_C(R,T) 'Annual consumption in MACRO' - VAR_Y(R,T) 'Annual production in MACRO' - VAR_K(R,T) 'Total capital' - VAR_INV(R,T) 'Annual investments in MACRO' - VAR_D(R,T,CG) 'Annual useful demand in MACRO' - VAR_SP(R,T,CG) 'Artificial variable for scaling shadow price' - VAR_OBJCOST(R,ALLYEAR) 'Annual energy costs in TIMES' - VAR_XCAP(R,YEAR,ITEM) 'Market penetration bounds - total new capacity' - VAR_XCAPP(R,YEAR,P,J) 'Market penetration bounds - additional capacity' - VAR_MELA(R,T,CG,J,BD) 'Step variables for elasticities' - ; - - - VARIABLES - -*-----------------------------------------------------------------------------* -* MACRO variables -*-----------------------------------------------------------------------------* - VAR_UTIL Total utility - VAR_NTX(R,T) Trade in numeraire - ; - - VAR_ANNCST.LO(OBV(UCN),R,T,CUR)$(RDCUR(R,CUR)$UC_RHS(UCN,'N')) = INF; - VAR_ANNCST.LO(OBV(UCN),R,T,CUR)$(RDCUR(R,CUR)$UC_RHSR(R,UCN,'N')) = INF; \ No newline at end of file diff --git a/source/par_uc.rpt b/source/par_uc.rpt deleted file mode 100644 index c6ecfbe..0000000 --- a/source/par_uc.rpt +++ /dev/null @@ -1,20 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==================================================================== -* Par_uc.rpt : reporting parameters for UC (no STAGES/SENSIS) -* %1 - parameter suffix -* %2 - equation prefix -*-------------------------------------------------------------------- - LOOP(UC_TSL(R,UC_N,'LHS',TSL),%2_UCRTS.M(UC_N,R,T,S) $= %2_UCRS.M(R,UC_N,T,TSL,S)); - %3PAR_UC%1(%4UC_N,'NONE','NONE','NONE') $= %2_UC.M(UC_N); - %3PAR_UC%1(%4UC_N,R,'NONE','NONE') $= %2_UCR.M(UC_N,R); - %3PAR_UC%1(%4UC_N,'NONE',T,'NONE') $= %2_UCT.M(UC_N,T); - %3PAR_UC%1(%4UC_N,R,T,'NONE') $= %2_UCRT.M(UC_N,R,T)*(1/COEF_PVT(R,T)); - %3PAR_UC%1(%4UC_N,'NONE',T,S) $= %2_UCTS.M(UC_N,T,S); - %3PAR_UC%1(%4UC_N,R,T,S) $= %2_UCRTS.M(UC_N,R,T,S)*(1/COEF_PVT(R,T)); - %3PAR_UC%1(%4UC_N,'NONE',T,'NONE') $= %2_UCSU.M(UC_N,T); - %3PAR_UC%1(%4UC_N,'NONE',T,S) $= %2_UCSUS.M(UC_N,T,S); - %3PAR_UC%1(%4UC_N,R,T,'NONE') $= %2_UCRSU.M(UC_N,R,T)*(1/COEF_PVT(R,T)); - %3PAR_UC%1(%4UC_N,R,T,S) $= %2_UCRSUS.M(UC_N,R,T,S)*(1/COEF_PVT(R,T)); diff --git a/source/pextlevs.stc b/source/pextlevs.stc deleted file mode 100644 index 6065f82..0000000 --- a/source/pextlevs.stc +++ /dev/null @@ -1,63 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PEXTLEVS.stc: Get the expected values -* %1 - SOW control -* %2 - Period control -*=============================================================================* -* Clear results from previous -$ BATINCLUDE clearsol.stc -*--------------------------------------------------------------------- -* Get the sum of weighted Marginals - EQG_COMBAL.M(R,T%2,C,S) $= SUM(SW_T(T,W), %EQ%G_COMBAL.M(R,T,C,S,T,W)); - EQE_COMBAL.M(R,T%2,C,S) $= SUM(SW_T(T,W), %EQ%E_COMBAL.M(R,T,C,S,T,W)); - EQE_COMPRD.M(R,T%2,C,S) $= SUM(SW_T(T,W), %EQ%E_COMPRD.M(R,T,C,S,T,W)); - EQ_PEAK.M(R,T%2,CG,S) $= SUM(SW_T(T,W), %EQ%_PEAK.M(R,T,CG,S,T,W)); - EQ_IRE.M(R,T%2,P,C,IE,S) $= SUM(SW_T(T,W), %EQ%_IRE.M(R,T,P,C,IE,S,T,W)); - EQE_CPT.M(R,T%2,P) $= SUM(SW_T(T,%1), %EQ%E_CPT.M(R,T,P,T,%1)); - EQN_UCRTP.M(UC_N,R,T%2,P,UC_GRPTYPE,BD('FX')) $= SUM(SW_T(T,W), %EQ%E_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)); - EQN_UCRTP.M(UC_N,R,T%2,P,UC_GRPTYPE,BDNEQ(BD)) $= SUM(SW_T(T,W), %EQ%N_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)); - -* Get the expected Levels - VAR_ACT.L(R,V,T%2,P,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_ACT.L(R,V,T,P,S,W)); - VAR_BLND.L(R,T%2,COM,C) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_BLND.L(R,T,COM,C,W)); - VAR_COMNET.L(R,T%2,COM,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_COMNET.L(R,T,COM,S,W)); - VAR_COMPRD.L(R,T%2,COM,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_COMPRD.L(R,T,COM,S,W)); - VAR_IRE.L(R,V,T%2,P,C,S,IE) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_IRE.L(R,V,T,P,C,S,IE,W)); - VAR_ELAST.L(R,T%2,C,S,J,BD) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_ELAST.L(R,T,C,S,J,BD,W)); - VAR_FLO.L(R,V,T%2,P,C,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_FLO.L(R,V,T,P,C,S,W)); - VAR_SIN.L(R,V,T%2,P,C,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_SIN.L(R,V,T,P,C,S,W)); - VAR_SOUT.L(R,V,T%2,P,C,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_SOUT.L(R,V,T,P,C,S,W)); - VAR_UPS.L(R,V,T%2,P,S,L) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UPS.L(R,V,T,P,S,L,W)); - VAR_CUMCOM.L(R,C,COM_VAR,YEAR,LL)$RC_CUMCOM(R,COM_VAR,YEAR,LL,C) $= SUM(W, SW_PROB(W)*%VAR%_CUMCOM.L(R,C,COM_VAR,YEAR,LL,W)); - VAR_CUMFLO.L(RPC,YEAR,LL)$RPC_CUMFLO(RPC,YEAR,LL) $= SUM(W, SW_PROB(W)*%VAR%_CUMFLO.L(RPC,YEAR,LL,W)); -$IF DEFINED %VAR%_DAM VAR_DAM.L(R,T%2,C,BD,J) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_DAM.L(R,T,C,BD,J,W)); -$IF %TIMESED% == YES VAR_OBJELS.L(R,BD,CUR) $= SUM(W, SW_PROB(W)*%VAR%_OBJELS.L(R,BD,CUR,W)); - VAR_CAP.L(R,T%2,P) $= SUM(SW_T(T,SOW), SW_TPROB(T,SOW)*%VAR%_CAP.L(R,T,P,%1)); - VAR_NCAP.L(R,T%2,P) $= SUM(SW_T(T,SOW), SW_TPROB(T,SOW)*%VAR%_NCAP.L(R,T,P,%1)); - VAR_SCAP.L(R,V,T%2,P) $= SUM(SW_T(T,SOW), SW_TPROB(T,SOW)*%VAR%_SCAP.L(R,V,T,P,%1)); - - VAR_UC.L(UC_N) $= SUM(W, SW_PROB(W)*%VAR%_UC.L(UC_N,W)); - VAR_UCR.L(UC_N,R) $= SUM(W, SW_PROB(W)*%VAR%_UCR.L(UC_N,R,W)); - VAR_UCT.L(UC_N,T) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCT.L(UC_N,T,W)); - VAR_UCRT.L(UC_N,R,T) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCRT.L(UC_N,R,T,W)); - VAR_UCTS.L(UC_N,T,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCTS.L(UC_N,T,S,W)); - VAR_UCRTS.L(UC_N,R,T,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCRTS.L(UC_N,R,T,S,W)); - VAR_OBJ.L(R,OBV,CUR) $= SUM(W, SW_PROB(W)*%VAR%_OBJ.L(R,OBV,CUR,W)); - -* Get the sum of weighted Marginals - VAR_ACT.M(R,V,T%2,P,S) $= SUM(SW_T(T,W), %VAR%_ACT.M(R,V,T,P,S,W)); - VAR_COMNET.M(R,T%2,COM,S) $= SUM(SW_T(T,W), %VAR%_COMNET.M(R,T,COM,S,W)); - VAR_COMPRD.M(R,T%2,COM,S) $= SUM(SW_T(T,W), %VAR%_COMPRD.M(R,T,COM,S,W)); - VAR_CUMFLO.M(R,P,C,YEAR,LL) $= SUM(W, %VAR%_CUMFLO.M(R,P,C,YEAR,LL,W)); - VAR_CAP.M(R,T%2,P) $= SUM(SW_T(T,%1), %VAR%_CAP.M(R,T,P,%1)); - VAR_NCAP.M(R,T%2,P) $= SUM(SW_T(T,%1), %VAR%_NCAP.M(R,T,P,%1)); - - VAR_UC.M(UC_N) $= SUM(W, %VAR%_UC.M(UC_N,W)); - VAR_UCR.M(UC_N,R) $= SUM(W, %VAR%_UCR.M(UC_N,R,W)); - VAR_UCT.M(UC_N,T) $= SUM(SW_T(T,W), %VAR%_UCT.M(UC_N,T,W)); - VAR_UCRT.M(UC_N,R,T) $= SUM(SW_T(T,W), %VAR%_UCRT.M(UC_N,R,T,W)); - VAR_UCTS.M(UC_N,T,S) $= SUM(SW_T(T,W), %VAR%_UCTS.M(UC_N,T,S,W)); - VAR_UCRTS.M(UC_N,R,T,S) $= SUM(SW_T(T,W), %VAR%_UCRTS.M(UC_N,R,T,S,W)); diff --git a/source/powerflo.vda b/source/powerflo.vda deleted file mode 100644 index 213f85e..0000000 --- a/source/powerflo.vda +++ /dev/null @@ -1,334 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Powerflo - define powerflo equations and nodal balance costs -*=============================================================================* -$SET MX %3 -$IF NOT '%1'=='' $GOTO %1%2%3 -*----------------------------------------------------------------------------- -* Declarations - SET RP_GRID(R,P); - SET RC_GRID(R,T,C); - SET GR_TOP(ALL_R,C,ALL_R,C,P); - SET GR_ARC(ALL_REG,C,ALL_REG,C); - SET GR_GRID(J,R,C); - SET GR_ALLMAP(R,CG,COM); - SET GR_PRCMAP(R,P,C,ITEM); - SET GR_DEMMAP(R,C,COM); - SET GR_ALGMAP(R,CG,CG); - SET GR_ENDC(R,CG); - SET GR_GENP(R,P); - PARAMETER GR_SUS(ALL_REG,T,C,ALL_REG,C); - PARAMETER GR_FLOW(R,P,C); - PARAMETER GR_GID(R,C); - PARAMETER GR_ADMIT(ALL_REG,T,C,ALL_REG,C); - PARAMETER GR_UNITS(R,T,ITEM); - -* Define grid and default line directions - OPTION TRACKP < PRC_REACT; TRACKC(R,C) $= NRG_TMAP(R,'ELC',C); - GR_TOP(TOP_IRE(R,C,TRACKC(REG,COM),P))$(TRACKC(R,C)$TRACKP(R,P)) = YES; - GR_TOP(TOP_IRE(TRACKC(REG,COM),R,C,P))$(TRACKC(R,C)$TRACKP(R,P)) = YES; - LOOP(GR_TOP(R,C,REG,COM,P),GR_FLOW(R,P,C)=1; GR_FLOW(REG,P,COM)=-1); - OPTION CLEAR=TRACKP; - GR_TOP(R,C,REG,COM,P)$(GR_FLOW(R,P,C) GT 0) = NO; - GR_TOP(R,C,R,C,P) = NO; - LOOP(GR_TOP(R,C,R,COM,P)$(SUM(RPC_IRE(R,P,C,IE)$RPC_IRE(R,P,COM,IE),1)=2),PRC_MAP(R,'DISTR',P)=YES); - -* Synchronize and check for zero line reactances - LOOP(GR_TOP(R,C,REG,COM,P)$(NOT SAMEAS(R,REG)), - RTP_VARA(RTP(R,T,P))$(NOT RTP_VARA(REG,T,P)) = NO; - PRC_REACT(R,T,P) = MAX(PRC_REACT(R,T,P),PRC_REACT(REG,T,P))); - PRC_REACT(R,T,P)$((PRC_REACT(R,T,P) LE 0)$PRC_REACT(R,T,P)) = 0; - LOOP(GR_TOP(R,C,REG,COM,P), GR_ARC(R,C,REG,COM) = YES); - OPTION RP_GRID < GR_FLOW; OPTION RREG <= GR_ARC; OPTION TRACKC < GR_FLOW; - -* Internodal admittance - GR_ADMIT(R,T,C,REG,COM)$GR_ARC(R,C,REG,COM) = SUM(GR_TOP(R,C,REG,COM,P)$(PRC_REACT(R,T,P)$RTP_VARA(R,T,P)),1/PRC_REACT(R,T,P)); - OPTION GR_ARC <= GR_ADMIT; - -* Construct all disjoint grids - CNT = EPS; OPTION CLEAR=GR_GID; - LOOP(GR_ARC(R,C,REG,COM), F = GR_GID(R,C); Z = GR_GID(REG,COM); - IF(NOT F+Z, GR_GID(R,C)=CNT; GR_GID(REG,COM)=CNT; CNT=CNT+1; - ELSEIF NOT F, GR_GID(R,C)=Z; - ELSEIF NOT Z, GR_GID(REG,COM)=F; - ELSEIF F NE Z, MY_F=MIN(F,Z); DONE=MAX(F,Z); IF(CNT=DONE+1,CNT=DONE); - GR_GID(TRACKC)$(GR_GID(TRACKC)=DONE) = MY_F)); -* Assign each node with unique grid ID - LOOP(SAMEAS('1',J),GR_GRID(J+GR_GID(R,C),TRACKC(R,C)) = YES); - -* QA checks - LOOP((R,TSLVL('DAYNITE')), Z=0; - IF(SUM(RP_GRID(R,P)$(NOT PRC_TSL(R,P,TSLVL)),1), Z=1); - IF(SUM(TRACKC(R,C)$(NOT COM_TSL(R,C,TSLVL)),1), Z=1); - LOOP(RREG(R,REG), - IF(SUM(S$(TS_GROUP(R,TSLVL,S) XOR TS_GROUP(REG,TSLVL,S)),1), - RP_GRID(REG,P)=NO; TRACKC(REG,C)=NO; Z = 1)); - IF(Z, RP_GRID(R,P) = NO; TRACKC(R,C) = NO)); - RC_GRID(RTC(R,T,C))$TRACKC(R,C) = YES; - -* Admittance / susceptance matrix - option gr_sus < gr_admit; - gr_sus(rc_grid,rc) $= gr_admit(rc_grid,rc)*(-1); - gr_sus(rc_grid(r,t,c),r,c) = -sum(trackc(rc),gr_sus(rc_grid,rc)); - -* Check nodal commodity balances - COM_BNDNET(RTCS_VARC(RC_GRID(R,T,C),S),'LO') = EPS; - COM_LIM(TRACKC(RC),'FX')$(NOT SUM(COM_LIM(RC,L),1)) = YES; - -*------------------------------------------------------------------------ -* levelization -$ BATINCLUDE pp_lvlfc.mod GR_DEMFR C COM_TS '' ",'0','0','0','0'" ALL_TS T RTC(R,T,C) -* Grid allocations - GR_ENDFR(R,T,COM,C)$TRACKC(R,C) = 0; - OPTION GR_ENDC < GR_ENDFR; - GR_GENLEV(TRACKC) = 0; - GR_GENLEV(R,C)$GR_GENLEV(R,C) = ROUND(GR_GENLEV(R,C)); - GR_ALGMAP(R,'NRG',C)$((GR_GENLEV(R,C)=1)$GR_GENLEV(R,C))=YES; - GR_ALGMAP(R,C,C)$((GR_GENLEV(R,C)=2)$GR_GENLEV(R,C))=YES; - GR_ALGMAP(R,COM_TYPE(CG),CG)$(SUM(TRACKC(R,C),1)>1) $= SUM(GR_ALGMAP(R,CG,C),1); - GR_ALLMAP(TRACKC(R,C),COM)$GR_GENLEV(R,COM) = YES; - GR_DEMMAP(GR_ALLMAP(R,C,COM))$(GR_GENLEV(R,COM) < 3) = YES; - IF(CARD(GR_DEMFR),GR_DEMFR(RTCS_VARC(RC_GRID(R,T,C),S)) = GR_DEMFR(R,T,C,S)+EPS); - OPTION GR_GENP < GR_GENMAP; - GR_ENDC(R,'DEM')$SUM(GR_ENDC(R,C),1) = YES; -* Process regions with sectoral demand fractions - LOOP(R$GR_ENDC(R,'DEM'), - GR_DEMFR(RTCS_VARC(RC_GRID(R,T,C),S)) = SUM(GR_ENDC(R,COM),MIN(0.33,GR_ENDFR(R,T,C,COM))); - GR_UNITS(RTC(R,T,COM))$GR_ENDC(R,COM) = SUM(RC_GRID(R,T,C),GR_ENDFR(R,T,C,COM))+1-1; - GR_ENDFR(RC_GRID(R,T,C),COM)$GR_UNITS(R,T,COM) = GR_ENDFR(R,T,C,COM)/GR_UNITS(R,T,COM); - OPTION CLEAR=GR_UNITS; - ); - GR_ENDC(R,C)$((GR_GENLEV(R,C)>2)$GR_GENLEV(R,C)) = YES; - GR_ENDC(R,'NRG')$(NOT GR_ENDC(R,'DEM')) = YES; -* Genmap normalization - PRC_YMAX(GR_GENP(R,P)) = SUM(ITEM$GR_GENMAP(R,P,ITEM),GR_GENMAP(R,P,ITEM))+1-1; - GR_GENMAP(GR_GENP(R,P),ITEM)$(PRC_YMAX(R,P)$GR_GENMAP(R,P,ITEM)) = GR_GENMAP(R,P,ITEM)/PRC_YMAX(R,P); -* GENFR normalization - LOOP(RC_GRID(R,T,C),GR_UNITS(R,T,ITEM)$GR_GENFR(R,T,C,ITEM)=1); - GR_UNITS(R,T,ITEM)$GR_UNITS(R,T,ITEM) = SUM(TRACKC(R,C),GR_GENFR(R,T,C,ITEM))+1-1; - GR_GENFR(RC_GRID(R,T,C),ITEM)$GR_UNITS(R,T,ITEM) = GR_GENFR(R,T,C,ITEM)/GR_UNITS(R,T,ITEM); - OPTION CLEAR=PRC_YMAX,CLEAR=GR_UNITS; -* DEMFR normalization - LOOP(RC_GRID(R,T,C),GR_UNITS(R,T,S)$GR_DEMFR(R,T,C,S)=1); - GR_UNITS(R,T,S)$GR_UNITS(R,T,S) = SUM(TRACKC(R,C),GR_DEMFR(R,T,C,S))+1-1; - GR_DEMFR(RC_GRID(R,T,C),S)$GR_UNITS(R,T,S) = GR_DEMFR(R,T,C,S)/GR_UNITS(R,T,S)+EPS; - OPTION CLEAR=GR_UNITS,CLEAR=RXX; -* Find and remove node with max demand fraction from GR_DEMFR - GR_UNITS(RC_GRID(R,T,C)) = SUM(COM_TS(R,C,S),GR_DEMFR(R,T,C,S)); - LOOP((R,T), Z=MAX(EPS,SMAX(TRACKC(R,C),GR_UNITS(R,T,C))); - LOOP(TRACKC(R,C)$Z,IF(GR_UNITS(R,T,C)=Z,RXX(R,T,C)=YES;Z=0))); - GR_DEMFR(RXX(R,T,C),S)=0; - TRACKPC(RPC(GR_GENP(R,P),C))$GR_GENLEV(R,C)=YES; - GR_PRCMAP(TRACKPC(R,P,C),ITEM)$(TOP(R,P,C,'OUT')$GR_GENMAP(R,P,ITEM))=YES; - GR_PRCMAP(TRACKPC(RP_IRE(R,P),C),ITEM)$GR_GENMAP(R,P,ITEM)=YES; - - OPTION CLEAR=TRACKC,CLEAR=TRACKPC; -$EXIT -*------------------------------------------------------------------------ -$LABEL PREP -$ BATINCLUDE fillparm PRC_REACT R P ",'0','0','0','0','0'" T 1 'GE 0' -$ BATINCLUDE fillparm GR_DEMFR R 'C,S' ",'0','0','0','0'" T 1 'GE 0' -$ BATINCLUDE fillparm GR_ENDFR R 'C,COM' ",'0','0','0','0'" T 1 'GE 0' -$ BATINCLUDE fillparm GR_GENFR R 'C,ITEM' ",'0','0','0','0'" T 1 'GE 0' -$ BATINCLUDE filparam GR_XBND 'R,' '' ",'0','0','0','0','0'" DATAYEAR T -$EXIT -*------------------------------------------------------------------------ -$LABEL DECL -* Declare variables and equations - POSITIVE VARIABLES %VAR%_GRIDELC(R,YEAR,C,C,S,IO%SWD%); - VARIABLES %VAR%_COMAUX(R,T,C,S%SWD%); - EQUATIONS - %EQ%_GR_POWFLO(R,T,C,S,REG,COM%SWTD%) - %EQ%_GR_GENALL(R,T,C,S,CG %SWTD%) - %EQ%_GR_DEMALL(R,T,C,S %SWTD%) - %EQ%_GR_XBND(R,T,S,IE %SWTD%) - ; -$ SETGLOBAL IREAUXBAL $BATINCLUDE powerflo.vda IREAUX -* For each disjoint grid, set phase angle to zero for the node with most connected lines - LOOP(J$SUM(GR_GRID(J,R,C),1), Z = SMAX(GR_GRID(J,R,C),SUM(P$GR_FLOW(R,P,C),1)); - LOOP(GR_GRID(J,R,C)$Z,IF(SUM(P$GR_FLOW(R,P,C),1)=Z, Z=0; %VAR%_COMAUX.FX(R,T,C,S%SOW%)=EPS))); -$ EXIT -*------------------------------------------------------------------------ -$LABEL POWFLO -* Standard DC power flow equations - %EQ%_GR_POWFLO(RTCS_VARC(%R_T%,C,RTS(S)),REG,COM%SWT%)$GR_ADMIT(R,T,C,REG,COM).. - - SUM((GR_TOP(R,C,REG,COM,P),RTP_VINTYR(REG,V,T,P))$RTPCS_VARF(REG,T,P,COM,S), - SUM(RPC_IRE(REG,P,COM,IE)$PRC_REACT(R,T,P),%VAR%_IRE(REG,V,T,P,COM,S,IE%SOW%)*(1-2*XPT(IE)))) - - =E= - - (%VAR%_COMAUX(R,T,C,S%SOW%)-%VAR%_COMAUX(REG,T,COM,S%SOW%)) * GR_ADMIT(R,T,C,REG,COM); -*---------- -* Generation fractions for all grid nodes C - %EQ%_GR_GENALL(RTCS_VARC(RC_GRID(%R_T%,C),RTS(S)),CG %SWT%)$GR_ALGMAP(R,CG,CG).. - -* Normal processes - SUM((GR_PRCMAP(RP_STD(R,P),COM,ITEM),GR_ALGMAP(R,CG,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), -$ BATINCLUDE %cal_red% COM COM1 TS P T - * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)))) + -* Imports - SUM((GR_PRCMAP(RP_IRE(R,P),COM,ITEM),RPC_IRE(R,P,COM,IE('IMP')))$GR_ALGMAP(R,CG,COM), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), - (1+IRE_FLOSUM(R,T,P,COM,TS,IE,COM,'OUT')) * - (%VAR%_IRE(R,V,T,P,COM,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ - (%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))*RS_FR(R,S,TS))) + -* Net storage output - SUM((GR_PRCMAP(RPC_STG(R,P,COM),ITEM),GR_ALGMAP(R,CG,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * - SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,COM,TS)),(%VAR%_SOUT(R,V,T,P,COM,TS %SOW%)-%VAR%_SIN(R,V,T,P,COM,TS %SOW%)$TOP(R,P,COM,'IN'))*RS_FR(R,S,TS))) - -* Net balance - +SUM(GR_ALLMAP(R,CG,C),%VAR%_GRIDELC(R,T,C,C,S,'OUT'%SOW%)-%VAR%_GRIDELC(R,T,C,C,S,'IN'%SOW%) - - SUM(GR_DEMMAP(R,C,COM),%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%)-%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM))) - - =E= - SUM(GR_ALGMAP(R,CG,COM)$RTC(R,T,COM),%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%)+%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,COM,COM)); -*---------- -* Demand fractions for all but the largest fraction - %EQ%_GR_DEMALL(RTCS_VARC(RC_GRID(%R_T%,C),RTS(S)) %SWT%)$GR_DEMFR(R,T,C,S).. - -* Net injection - SUM(GR_ENDC(R,COM), - SUM(TOP(RP_STD(R,P),COM,'OUT')$(NOT GR_GENP(R,P)*GR_DEMMAP(R,C,COM)), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), -$ BATINCLUDE %cal_red% COM COM1 TS P T - * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS))) * - (SUM(GR_PRCMAP(R,P,COM,ITEM),GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM))-GR_ENDFR(R,T,C,COM)*(1+GR_ENDFR(R,T,COM,COM))-GR_DEMFR(R,T,C,S)$GR_GENP(R,P)$GR_ENDC(R,'NRG')))) + -* Exports - SUM((GR_PRCMAP(RP_IRE(R,P),COM,ITEM),RPC_IRE(R,P,COM,IE('EXP')))$GR_ALGMAP(R,'NRG',COM), GR_GENMAP(R,P,ITEM) * - (GR_ENDFR(R,T,C,COM) + GR_DEMFR(R,T,C,S)$GR_ENDC(R,'NRG') - GR_GENFR(R,T,C,ITEM)) * - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), - (1+IRE_FLOSUM(R,T,P,COM,TS,IE,COM,'IN')) * - (%VAR%_IRE(R,V,T,P,COM,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ - (%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))*RS_FR(R,S,TS))) + -* Net demand shares - SUM(GR_DEMMAP(R,C,COM)$RTC(R,T,COM), %VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%) - - (GR_ENDFR(R,T,C,COM)+GR_DEMFR(R,T,C,S)$GR_ENDC(R,'NRG')) * - SUM(RTC(R,T,COM2)$GR_DEMMAP(R,COM2,COM),%VAR%_GRIDELC(R,T,COM,COM2,S,'IN'%SOW%))) - - =E= 0; -*---------- -* Bound on net imports/exports from grid - %EQ%_GR_XBND(%R_T%,RTS(S),IE %SWT%)$(TS_GROUP(R,'DAYNITE',S)$GR_XBND(R,T)).. - - SUM(GR_DEMMAP(R,C,COM)$(RTC(R,T,COM)$RC_GRID(R,T,C)), PROD(XPT(IE),-1) * - (%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM)-%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%))) - - =L= - SUM(TOP_IRE(R,C,ALL_R,COM,P)$((NOT SAMEAS(R,ALL_R))$RC_GRID(R,T,C)), - SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * GR_XBND(R,T) * G_YRFR(R,S) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V)))$PRC_CAP(R,P) + - SUM((REG(ALL_R),V)$COEF_CPT(REG,V,T,P), COEF_CPT(REG,V,T,P) * PRC_CAPACT(REG,P) * GR_XBND(R,T) * G_YRFR(R,S) * - (%VARV%_NCAP(REG,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(REG,V,P)$PASTYEAR(V))$PRC_CAP(REG,P))$(NOT PRC_CAP(R,P)))$XPT(IE) + - SUM(TOP_IRE(ALL_R,COM,R,C,P)$((NOT SAMEAS(R,ALL_R))$RC_GRID(R,T,C)), - SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * GR_XBND(R,T) * G_YRFR(R,S) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V)))$PRC_CAP(R,P) + - SUM((REG(ALL_R),V)$COEF_CPT(REG,V,T,P), COEF_CPT(REG,V,T,P) * PRC_CAPACT(REG,P) * GR_XBND(R,T) * G_YRFR(R,S) * - (%VARV%_NCAP(REG,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(REG,V,P)$PASTYEAR(V))$PRC_CAP(REG,P))$(NOT PRC_CAP(R,P)))$IMP(IE) -; -$EXIT -*------------------------------------------------------------------------ -$LABEL IREAUXIN -$SET MX COM_IE(R,T,C,S)* -$LABEL IREAUXOUT- -* For balance of C (and grid nodes COM) - SUM(GR_DEMMAP(R,COM,C),%MX%(%VAR%_GRIDELC(R,T,C,COM,S,'OUT'%SOW%)-%VAR%_GRIDELC(R,T,C,COM,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',C))) + -* For balance of grid node C - SUM(GR_DEMMAP(R,C,COM),%MX%(%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM)-%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%))) + -$GOTO IREAUXOUT -*------------------------------------------------------------------------ -$ LABEL CSTBAL -* Preprocess nodal balance costs - SET OBV / OBJBAL /; - SET ITEM / CON, NTX, NPG /; - SETS RC_GRID(R,T,C), GR_ALLMAP(R,CG,COM), GR_PRCMAP(R,P,C,ITEM); - SETS GR_DEMMAP(R,C,COM), GR_ALGMAP(R,CG,CG), GR_ENDC(R,CG); - PARAMETER OBJ_COMBAL(R,T,C,S,ITEM,CUR); -$IF NOT DEFINED RC_GRID OPTION CLEAR=RC_GRID,CLEAR=GR_ALLMAP,CLEAR=GR_ALGMAP,CLEAR=GR_DEMMAP,CLEAR=GR_PRCMAP,CLEAR=GR_ENDC; -* levelization -$ BATINCLUDE pp_lvlfc.mod COM_CSTBAL C COM_TS ',ITEM,CUR' ",'0','0'" ALL_TS T RTC(R,T,C) '' '' N - OPTION TRACKC < COM_CSTBAL; - TRACKC(R,C)$SUM(GR_ALLMAP(R,C,COM),1)=NO; - OBJ_COMBAL(RTCS_VARC(RTC(R,T,C),TS),'PRD',CUR)$TRACKC(R,C) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'PRD',CUR)+COM_CSTBAL(RTC,S,'CON',CUR)+COM_CSTBAL(RTC,S,'OUT',CUR)); - OBJ_COMBAL(RTCS_VARC(RTC(R,T,C),TS),'IMP',CUR)$TRACKC(R,C) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'IMP',CUR)+COM_CSTBAL(RTC,S,'NTX',CUR)-COM_CSTBAL(RTC,S,'PRD',CUR)); - OBJ_COMBAL(RTCS_VARC(RTC(R,T,C),TS),'EXP',CUR)$TRACKC(R,C) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'EXP',CUR)-COM_CSTBAL(RTC,S,'NTX',CUR)-COM_CSTBAL(RTC,S,'CON',CUR)); - LOOP(RDCUR(R,CUR),RHS_COMPRD(RTCS_VARC(R,T,C,S))$OBJ_COMBAL(R,T,C,S,'PRD',CUR)=YES); RCS_COMPRD(RHS_COMPRD(R,T,C,S),'FX')$TRACKC(R,C) = YES; - OBJ_COMBAL(RTCS_VARC(RTC(RC_GRID),TS),'GEN',CUR) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'PRD',CUR)+COM_CSTBAL(RTC,S,'CON',CUR)); - OBJ_COMBAL(RTCS_VARC(RTC(RC_GRID),TS),'NTX',CUR) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'NTX',CUR)+COM_CSTBAL(RTC,S,'CON',CUR)); - OBJ_COMBAL(RTCS_VARC(RTC(RC_GRID),TS),IE,CUR) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,IE,CUR)); -* Add balancer variables if penalty costs on excess - OPTION CLEAR=UNCD7; UNCD7(R,T--ORD(T),C,S--ORD(S),CUR,'','')$RC_GRID(R,T,C) $= COM_CSTBAL(R,T,C,S,'NPG',CUR); - LOOP(UNCD7(R,TT,C,SL,CUR,'',''), GR_ALLMAP(R,'FIN',C) = YES; GR_ALGMAP(R,CG('FIN'),CG) = YES; - OBJ_COMBAL(RC_GRID(R,T,C),TS,'NPG',CUR) $= SUM(TS_ANN(TS,S),COM_CSTBAL(R,T,C,S,'NPG',CUR))); - OPTION CLEAR=TRACKC; -$EXIT -*------------------------------------------------------------------------ -$ LABEL OBJBAL -$ SET TPULSE TT$OBJ_LINT(R,T,TT,CUR),OBJ_LINT(R,T,TT,CUR) - - POSITIVE VARIABLES %VAR%_GRIDELC(R,YEAR,C,C,S,IO%SWD%); - EQUATION EQ_OBJBAL(R,CUR,ALLSOW); - EQ_OBJBAL(RDCUR(R,CUR)%SWX%).. - - %VAR%_OBJ(R,'OBJBAL',CUR %SOW%) =E= - -$IF %STAGES%==YES $SET SOW ,WW -$IF %STAGES%==YES SUM(%SWSW% -* Costs on commodity production - SUM(RHS_COMPRD(R,T,C,S),%VAR%_COMPRD(R,T,C,S %SOW%) * SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,'PRD',CUR))) + - SUM(RTCS_VARC(RC_GRID(R,T,C),S)$OBJ_COMBAL(R,T,C,S,'GEN',CUR), - (SUM(GR_ALGMAP(R,CG,COM),%VAR%_GRIDELC(R,T,COM,C,S,'OUT' %SOW%)+%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,COM,COM))+ - SUM((GR_PRCMAP(RP_STD(R,P),COM,ITEM),GR_ENDC(R,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), -$ BATINCLUDE %cal_red% COM COM1 TS P T - * RS_FR(R,S,TS)))) * SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,'GEN',CUR))) + - -* Costs on net imports to grid node - SUM(RTCS_VARC(RC_GRID(R,T,C),S)$OBJ_COMBAL(R,T,C,S,'NTX',CUR), - SUM(GR_DEMMAP(R,C,COM),%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM)-%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%)) * - SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,'NTX',CUR))) + - -* Costs on Net Positive Generation (NPG) - SUM(RTCS_VARC(RC_GRID(R,T,C),S)$OBJ_COMBAL(R,T,C,S,'NPG',CUR), - %VAR%_GRIDELC(R,T,C,C,S,'OUT' %SOW%) * SUM(%TPULSE% * MAX(0,OBJ_COMBAL(R,TT,C,S,'NPG',CUR)))) + - -* Costs on commodity imports / exports - SUM((RTPCS_VARF(R,T,P,C,S),RPC_IRE(R,P,C,IE))$OBJ_COMBAL(R,T,C,S,IE,CUR), - SUM(RTP_VINTYR(R,V,T,P), - (%VAR%_IRE(R,V,T,P,C,S,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C))) * - SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,IE,CUR))) - -$IF %STAGES%==YES ) - ; -$EXIT -*------------------------------------------------------------------------ -$LABEL RPTB - %4REG_WOBJ(%5R,'VAR',CUR) = %4REG_WOBJ(%5R,'VAR',CUR) + %VAR%_OBJ.L(R,'OBJBAL',CUR%6); - OPTION TRACKC < COM_CSTBAL; - %4CST_COMC(%5RTC(R,T,C))$TRACKC(R,C) = %4CST_COMC(%5RTC) + - SUM((RTCS_VARC(RTC,S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'PRD',CUR),OBJ_COMBAL(RTC,S,'PRD',CUR)*VAR_COMPRD.L(RTC,S)) + - SUM((RPCS_VAR(R,P,C,S),RPC_IRE(R,P,C,IE),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,IE,CUR), - SUM(RTP_VINTYR(R,V,T,P),OBJ_COMBAL(RTC,S,IE,CUR)*PAR_IRE(R,V,T,P,C,S,IE))) + -* Cost on generation to grid - SUM((RTCS_VARC(RC_GRID(RTC),S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'GEN',CUR), - OBJ_COMBAL(RTC,S,'GEN',CUR) * - (SUM(GR_ALGMAP(R,CG,COM),%VART%_GRIDELC.L(R,T,COM,C,S,'OUT' %SWS%)+%VART%_GRIDELC.L(R,T,COM,C,S,'IN'%SWS%)$GR_ALGMAP(R,COM,COM))+ - SUM((GR_PRCMAP(RP_STD(R,P),COM,ITEM),GR_ENDC(R,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(RTC,ITEM) * - SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS), - PAR_FLO(R,V,T,P,C,TS)*RS_FR(R,S,TS))))) + -* Costs on net imports to grid node - SUM((RTCS_VARC(RC_GRID(RTC),S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'NTX',CUR), - SUM(GR_DEMMAP(R,C,COM),%VART%_GRIDELC.L(R,T,COM,C,S,'IN'%SWS%)$GR_ALGMAP(R,'NRG',COM)-%VART%_GRIDELC.L(R,T,COM,C,S,'OUT'%SWS%)) * - OBJ_COMBAL(RTC,S,'NTX',CUR)) + -* Costs on Net Positive Generation (NPG) - SUM((RTCS_VARC(RC_GRID(RTC),S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'NPG',CUR), - %VART%_GRIDELC.L(RTC,C,S,'OUT'%SWS%) * OBJ_COMBAL(RTC,S,'NPG',CUR)); - - OPTION CLEAR=TRACKC; -*------------------------------------------------------------------------ -$LABEL IREAUXIN- -$LABEL IREAUXOUT diff --git a/source/pp_actef.vda b/source/pp_actef.vda deleted file mode 100644 index 681d2d0..0000000 --- a/source/pp_actef.vda +++ /dev/null @@ -1,82 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==============================================================================* -* PP_ACTEF.MOD : Make the necessary preparations for EQE_ACTEFF equations -* - Aggregate / inherit ACT_EFF parameters -*==============================================================================* -$IF NOT '%1' == LVL $GOTO EQUA -*----------------------------------------------------------------------------- - SCALAR MICRO / 1E-6 /; - OPTION CLEAR=UNCD7; -*----------------------------------------------------------------------------- -* Save commodity ACT_EFF partitions - CG_GRP(RPC_ACE(RPC(R,P,C)),C) = YES; - OPTION KEEP_FLOF0)$NCAP_CDME(RTP)) = MAX(.001,(NCAP_CDME(RTP)/NCAP_BPME(RTP)*(1+COEF_RTP(RTP))-1)/COEF_RTP(RTP)); -* EQ_PTRANS control - overall efficiency - FLO_SUM(RTP(R,V,P),C,COM,C,ANNUAL)$(RPC_SPG(R,P,COM)$RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C)) $= NCAP_CDME(RTP); -*----------------------------------------------------------------------------- -* Identify CHP processes using NCAP_CHPR - IF(CARD(CHP), -* Get the ELC / HEAT outputs - OPTION PRC_ACT < NCAP_CHPR; - CHP_ELC(RPC_PG(CHP(PRC_ACT(R,P)),C))$NRG_TMAP(R,'ELC',C) = YES; - OPTION TRACKP < CHP_ELC; TRACKP(RP_PGACT) = NO; - RVP(R,V,P)$(COEF_RTP(R,V,P)$TRACKP(R,P)) = YES; - RP_GRP(RPC_PG(TRACKP(RP),C))$(NOT CHP_ELC(RP,C)) = YES; - RP_GRP(RP_PGACT(CHP),C)$(TOP(CHP,C,'OUT')$(NOT CHP_ELC(CHP,C))) = YES; - TRACKPG(RP_GRP(RPC_PG(R,P,C)))$COM_LIM(R,C,'N')=YES; OPTION RP_PRC.01)$(NOT NCAP_CHPR(RVP,'UP'))) = COEF_RTP(RVP)+EPS; - ); -*----------------------------------------------------------------------------- -* Calculate ACTFLOs for pg and elc - PRC_ACTFLO(RVP(R,V,P),C)$((NCAP_CEH(RVP) LE 1)$RPC_PG(R,P,C)) = - POWER(NCAP_CEH(RVP),(1$CHP_ELC(R,P,C)-1)$NCAP_CEH(RVP)) * (1-NCAP_BPME(RVP)); - PRC_ACTFLO(RVP(R,V,P),C)$(((NCAP_CEH(RVP) GT 1)*NCAP_CEH(RVP))$RPC_PG(R,P,C)) = - (1+(1/NCAP_CEH(RVP)-1)/(1+1/COEF_RTP(RVP))) * POWER(NCAP_CEH(RVP),1-1$CHP_ELC(R,P,C)); - PRC_ACTFLO(RVP(R,V,P),C)$TRACKPG(R,P,C) = PRC_ACTFLO(RVP,C)*(1/COEF_RTP(RVP)+1)/MAX(1E-3,EXP(ABS(LOG(NCAP_CEH(RVP))))-1); -* EQ_PTRANS control - low-temperature heat - FLO_SUM(RTP(R,V,P),C,COM,C,ANNUAL)$(RP_GRP(R,P,COM)$CHP_ELC(R,P,C)$NCAP_CDME(RTP)) = -1/PRC_ACTFLO(RTP,COM); -*----------------------------------------------------------------------------- -* EQ_OUTSHR controls: Set bound for the electricity output -* Define the share over PG if there is more than just ELC, otherwise NRG - RP_GRP(TRACKPG)=NO; TRACKP(RP_PRC)=NO; RP_GRP(TRACKP,C)=NO; - OPTION CLEAR=TRACKPG; TRACKPG(RP_PG(TRACKP,CG))=YES; - TRACKPG(RP_PGACT(RP),'NRG') $= SUM(CHP_ELC(RP,C),1); - LOOP((CHP_ELC(R,P,C),TRACKPG(R,P,CG)), - FLO_SHAR(RTP(R,V,P),C,CG,S,'LO')$(PRC_TS(R,P,S) * NCAP_CHPR(RTP,'UP')) = 1 / (1+NCAP_CHPR(RTP,'UP')); - FLO_SHAR(RTP(R,V,P),C,CG,S,'FX')$(PRC_TS(R,P,S) * NCAP_CHPR(RTP,'FX')) = 1 / (1+NCAP_CHPR(RTP,'FX')); - FLO_SHAR(RTP(R,V,P),C,CG,S,'UP')$(PRC_TS(R,P,S) * NCAP_CHPR(RTP,'LO')) = 1 / (1+NCAP_CHPR(RTP,'LO')); - ); -* Heat share - FLO_SHAR(RTP(R,V,P),C,CG,S,BD)$(PRC_TS(R,P,S)$RP_PG(R,P,CG)$RP_GRP(R,P,C)) = NCAP_CHPR(RTP,BD)/(NCAP_CHPR(RTP,BD)+1); -* ACT emission - FLO_SUM(RVP,COM,C,COM,S)$((NCAP_BPME(RVP)$NCAP_CEH(RVP)$PRC_ACTFLO(RVP,C)<0)$FLO_EFF(RVP,COM,C,S)) = FLO_EFF(RVP,COM,C,S)/PRC_ACTFLO(RVP,C); -*----------------------------------------------------------------------------- -* Adjust PKCNT - LOOP(RPC_PKC(CHP_ELC(R,P,C)),NCAP_PKCNT(RVP(R,V,P),S)$COM_TS(R,C,S)=NCAP_PKCNT(RVP,S)/MAX(1,PRC_ACTFLO(RVP,C))); - RVP(RVP)$(NCAP_CEH(RVP)+1$NCAP_CHPR(RVP,'FX')+NCAP_CHPR(RVP,'LO')>0) = NO; - PUTGRP = 0; - LOOP(RVP(R,V,P)$(T(V)+PRC_VINT(R,P)), -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'CHP process with zero CEH but only upper bound on CHPR.' - PUT QLOG ' WARNING - Unusual CHP operation: R=',%RL%,' P=',%PL%,' V=',V.TL; - ); - OPTION CLEAR=PRC_ACT,CLEAR=RVP,CLEAR=TRACKP,CLEAR=TRACKPG,CLEAR=RP_PRC,CLEAR=RP_GRP,CLEAR=COEF_RTP; \ No newline at end of file diff --git a/source/pp_clean.mod b/source/pp_clean.mod deleted file mode 100644 index 8300ccf..0000000 --- a/source/pp_clean.mod +++ /dev/null @@ -1,27 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------- -* PP_CLEAN.mod - Release memory by clearing items no longer used -*----------------------------------------------------------------------- -* Only items not used in any equations can be cleared; to be careful! -$IF %MEMCLEAN%==NO $EXIT -*----------------------------------------------------------------------- -FLO_SUM(R,ALLYEAR,P,CG1,C,CG2,S) = 0; -FLO_FUNC(R,ALLYEAR,P,CG1,CG2,S) = 0; -NCAP_AF(R,ALLYEAR,P,S,BD) = 0; -NCAP_AFA(R,ALLYEAR,P,BD) = 0; -NCAP_AFS(R,ALLYEAR,P,S,BD) = 0; -NCAP_COST(R,ALLYEAR,P,CUR) = 0; -NCAP_FOM(R,ALLYEAR,P,CUR) = 0; -ACT_COST(R,ALLYEAR,P,CUR) = 0; -FLO_TAX(R,ALLYEAR,P,C,S,CUR) = 0; -FLO_SUB(R,ALLYEAR,P,C,S,CUR) = 0; -FLO_COST(R,ALLYEAR,P,C,S,CUR) = 0; -FLO_DELIV(R,ALLYEAR,P,C,S,CUR) = 0; - -$IF NOT SET BENCOST $SETGLOBAL BENCOST NO -$IFI NOT '%BENCOST%'=='NO' -$IFI EXIST timesrng.inc execute 'mv -f timesrng.inc timesrng_bak.inc'; - diff --git a/source/pp_lvlbd.mod b/source/pp_lvlbd.mod deleted file mode 100644 index 59eb3f1..0000000 --- a/source/pp_lvlbd.mod +++ /dev/null @@ -1,47 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLBD aggregate the bound attributes if finer than level -* %1 - bound attribute name (ACT_BND,FLO_FR,COM_BND,IRE_BND) -* %2 - 'C'ommodity/'P'rocess index -* %3 - 'C,' or none -* %4 - other indexes between S and BD -* %5 - temp residual indexes -* %6 - COM/PRC_TS-level shooting for -* %7 - valid bound levels -* %8 - temp set name -* %9 - treat negative bouds as 0/EPS? -*=============================================================================* -* Questions/Comments: -* - New implementation (Jul-2011) -* - As originally, based on summing of UP/FX and LO/FX bounds from finer levels -*----------------------------------------------------------------------------- -*$ONLISTING - SET BDVAL(BD); - PARAMETER TS_BD(S,BD); - %8(RT%2(R,T,%2),%3S--ORD(S),%4'FX'%5) $= SUM(BD$%1(RT%2,%3S,%4BD),1)$(NOT %7(R,%2,%3S)); - -* Aggregation only if target level value is not present - LOOP((%8(R,T,%2,%3ALL_TS,%4'FX'%5),%6(R,%2,%3TS)), - TS_BD(S,BD) = %1(R,T,%2,%3S,%4BD)$TS_MAP(R,TS,S); - TS_BD(S,BDNEQ) $= TS_BD(S,'FX'); Z=SUM(BD$TS_BD(TS,BD),1); F=CARD(TS_BD)-Z; - IF(Z>1,Z=F; ELSE Z=SUM((RS_BELOW(R,TS,S),BDNEQ(BD))$(TS_BD(S,BD)$TS_BD(TS,BD)),1)$F); - IF(Z, F=(F>Z); -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 '%1 Bounds conflict: Value at %6 level and below, latter ignored' - PUT QLOG ' WARNING - %1: R=',%RL%,' Y=',T.TL,' %2=',%2.TL,' S=',TS.TL); - IF(F, BDVAL(BD)=(NOT TS_BD(TS,BD))$BDNEQ(BD); -* Clear neg bounds and those below the topmost ones -$IF NOT %9=='' TS_BD(S,BDNEQ)$(TS_BD(S,BDNEQ)<0) = %9; - TS_BD(S,BDVAL(BD))$SUM(RS_BELOW(R,SL,S)$TS_BD(SL,BD),1)=0; -* Check the INF default for UP bounds before summing - BDVAL(BDVAL('UP')) = (G_YRFR(R,TS)-SUM(RS_BELOW(R,TS,S)$TS_BD(S,'UP'),G_YRFR(R,S))) < 1E-5; - TS_BD(TS,BDVAL)=SUM(RS_BELOW(R,TS,S),TS_BD(S,BDVAL)); - IF((TS_BD(TS,'UP')-TS_BD(TS,'LO') < 1E-7)$(SUM(BD$TS_BD(TS,BD),1)=2), - %1(R,T,%2,%3TS,%4'FX') = TS_BD(TS,'LO'); - ELSE %1(R,T,%2,%3TS,%4BDVAL) $= TS_BD(TS,BDVAL)))); - - %1(R,T,%2,%3S,%4BDNEQ)$%1(R,T,%2,%3S,%4'FX') = 0; - OPTION CLEAR=%8; -*$OFFLISTING diff --git a/source/pp_lvlbr.mod b/source/pp_lvlbr.mod deleted file mode 100644 index d45d8fa..0000000 --- a/source/pp_lvlbr.mod +++ /dev/null @@ -1,55 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLBR aggregate/inherit relative process bound attributes if different than level -* %1 - attribute name (NCAP_AF, FLO_SHAR etc.) -* %2 - other qualifying indexes ('','') -* %3 - TS set shooting for (PRC_TS, RPS_S1 etc.) -* %4 - UNCD7 residual dimension -* %5 - qualifier to allow inheritance if some values found at target slices (0/1) -* %6 - qualifier triggering the bound conflict test (0/1) -* %7 - optional index in TS set -*=============================================================================* -OPTION CLEAR=UNCD7; -*----------------------------------------------------------------------------- -LOOP((RTP(R,V,P)%2,S,BD)$((NOT %3(R,P,%7S))$%1(R,V,P%2,S,BD)), - F = 0; Z = 1; - LOOP(RS_BELOW(R,TS,S)$Z, -* If value is below target level, aggregate only if value not found at target level - IF(%1(R,V,P%2,TS,BD), F = 1; - IF(%3(R,P,%7TS), Z = 0; IF(NOT UNCD7(R,TS,P%2,TS,BD%4), -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 '%1 Bounds conflict: Bound at %3 level and below, lower ignored' - PUT QLOG ' WARNING - R=',%RL%,' P=',%PL%,' TS=',TS.TL ; - UNCD7(R,TS,P%2,TS,BD%4) = YES)); - ELSEIF %3(R,P,%7TS), Z = 0; UNCD7(R,V,P%2,TS,BD%4) = YES)); - IF(Z, Z = SUM(RS_BELOW(R,S,TS)$%1(R,V,P%2,TS,BD),EPS+(%1(R,V,P%2,TS,BD) > EPS)$%3(R,P,%7TS)); -* If value above target level and no values found below or above, mark to be inherited down: - IF(NOT (F+Z), UNCD7(R,V,P%2,S,BD%4) = YES; -* If value is above targets and all other values in the subtree are at non-target slices, mark to be leveled: - ELSE Z=Z<1; UNCD7(R,V,P%2,TS,BD%4)$(RS_BELOW(R,S,TS)*%3(R,P,%7TS)*(Z+(NOT %1(R,V,P%2,TS,BD))$%5)) = YES))); -*----------------------------------------------------------------------------- -* Aggregation/inheritance to target timeslices -*----------------------------------------------------------------------------- -LOOP(UNCD7(R,V,P%2,TS,BD%4), - IF(%3(R,P,%7TS), -* Leveling by simultaneous aggregation/inheritance - TS_ARRAY(ALL_TS) = %1(R,V,P%2,ALL_TS,BD); - %1(R,V,P%2,TS,BD) $= - SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + - SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), - TS_ARRAY(ALL_TS))))/G_YRFR(R,TS); -* Otherwise just simple direct inheritance down - ELSE Z = %1(R,V,P%2,TS,BD); %1(R,V,P%2,S,BD)$(RS_BELOW(R,TS,S)$%3(R,P,%7S)) = Z)); -*----------------------------------------------------------------------------- -OPTION CLEAR=UNCD7; -IF(%6, PUTGRP = 0; - LOOP((R,V,P%2,S)$%1(R,V,P%2,S,'FX'), -* check to see if both LO/FX and UP/FX at same S - IF(%3(R,P,%7S) AND (%1(R,V,P%2,S,'UP') + %1(R,V,P%2,S,'LO')), -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 '%1 Bounds conflict: FX + LO/UP at same TS-level, latter ignored' - PUT QLOG ' WARNING - R=',%RL%,' Y=',V.TL,' P=',%PL%,' S=',S.TL ; - UNCD7(R,V,P%2,S,'0'%4) = YES;)); - IF(PUTGRP, %1(R,V,P%2,S,BDNEQ)$UNCD7(R,V,P%2,S,'0'%4) = 0; - OPTION CLEAR=UNCD7)); diff --git a/source/pp_lvlfc.mod b/source/pp_lvlfc.mod deleted file mode 100644 index 0bf8e8c..0000000 --- a/source/pp_lvlfc.mod +++ /dev/null @@ -1,45 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLPC aggregate/inherit attributes if at different than target level -* Parameter arguments must be of the form (R,V,{P/C/P,C},S[,xx]*) -* %1 - attribute name (FLO_COST, FLO_TAX etc.) -* %2 - 'P', 'C' 'COM' or 'P,C' depending on attribute -* %3 - TS set shooting for -* %4 - remaining indexes (e.g. ',CUR') -* %5 - UNCD7 residual dimension -* %6 - ALL_TS or TS depending on whether inheritance is allowed -* %7 - YEAR set to look for data (DATAYEAR/XMILE/V/'') -* %8 - Existence qualifier set or YES -* %9 - Optional indicator for weighting: Use 1 if inheritance is weighted -* %10 - Optional indexes between TS set items and the S index -*=============================================================================* -OPTION CLEAR=UNCD7; -$SETLOCAL TAKE '%12' SETLOCAL REGY 'R,%7' SETLOCAL TS (NOT %3(R,%2,S))$ -$SETLOCAL AWGT 'G_YRFR(R,S)/G_YRFR(R,TS)' SETLOCAL IWGT '' -$IF '%7' == '' $SETLOCAL REGY 'R' -$IF '%6' == 'S2' $SETLOCAL TS '' -$IF '%9' == '1' $SETLOCAL AWGT '1' SETLOCAL IWGT '*G_YRFR(R,S)/G_YRFR(R,%6)' -$IF '%11'=='N' $SETLOCAL TAKE $%1(R,'0',%2%10,'ANNUAL'%4) -$IF '%11'=='N' %1(R,LL--ORD(LL),%2%10,S+STOA(S)%4)$(STOAL(R,S)$%1(R,LL,%2%10,S%4)) = 1; -*----------------------------------------------------------------------------- -* Mark to be levelized if inheritance is allowed or S is not ANNUAL: -LOOP((%REGY%,%2%10,S%4)$(%TS%%1(%REGY%,%2%10,S%4)), UNCD7(%REGY%,%2%10%4%5)$(%8%TAKE%) = YES); -*----------------------------------------------------------------------------- -* Aggregation/inheritance to target timeslices -*----------------------------------------------------------------------------- -LOOP(UNCD7(%REGY%,%2%10%4%5), TS_ARRAY(S) = %1(%REGY%,%2%10,S%4); - IF((NOT SUM(RS_BELOW(R,'ANNUAL',S)$TS_ARRAY(S),1))$TS_ARRAY('ANNUAL'), - %1(%REGY%,%2%10,S%4)$%3(R,%2,S) = SUM(ANNUAL(%6),TS_ARRAY(%6)%IWGT%); - ELSE -* Leveling by simultaneous aggregation/inheritance; but only if target level value is not present - LOOP(%3(R,%2,TS)$(NOT TS_ARRAY(TS)), - %1(%REGY%,%2%10,TS%4) $= - SUM(TS_MAP(R,TS,S)$FINEST(R,S), %AWGT% * (TS_ARRAY(S) + - SUM(RS_BELOW(R,%6,S)$(TS_ARRAY(%6) AND NOT SUM(SL$RS_BELOW(R,%6,SL),TS_MAP(R,SL,S)*TS_ARRAY(SL))), - TS_ARRAY(%6)%IWGT%)));))); -*----------------------------------------------------------------------------- -$IF '%11'==0 %1(%REGY%,%2%10,S%4)$((NOT %1(%REGY%,%2%10,S%4))$%3(R,%2,S)) $= %1(%REGY%,%2%10,'ANNUAL'%4); -$IF NOT '%11'=='' %1(R,LL,%2%10,S%4)$((NOT %3(R,%2,S))%TAKE%) = 0; diff --git a/source/pp_lvlff.mod b/source/pp_lvlff.mod deleted file mode 100644 index 8d83b5e..0000000 --- a/source/pp_lvlff.mod +++ /dev/null @@ -1,41 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLFF set the level of FLO_FUNC attribute using aggregation/inheritance -* %1 - mod or v# for the source code to be used -*=============================================================================* -*GaG Questions/Comments: -* - Assumption is that values can be given at any levels -*----------------------------------------------------------------------------- -*$ONLISTING - SET FFCKS(REG,PRC,CG,CG,TS) //; - -* check all commodities in the groups of a process at other than PRC_TS level - OPTION FFCKS <= FLO_FUNC; FFCKS(R,P,CG,CG2,S)$(PRC_TS(R,P,S)+ACTCG(CG))=NO; - LOOP(FFCKS(R,P,CG,COM_GRP,S)$STOA(S),CG_GRP(R,P,CG,COM_GRP) = YES); -*----------------------------------------------------------------------------- -* Leveling by simultaneous aggregation/inheritance -*----------------------------------------------------------------------------- - LOOP((CG_GRP(R,P,CG,COM_GRP),RTP(R,V,P)), - TS_ARRAY(ALL_TS) = FLO_FUNC(R,V,P,CG,COM_GRP,ALL_TS); - FLO_FUNC(R,V,P,CG,COM_GRP,TS)$((NOT TS_ARRAY(TS))$PRC_TS(R,P,TS)) = - SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + - SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), - TS_ARRAY(ALL_TS))))/G_YRFR(R,TS)); -*----------------------------------------------------------------------------- -* Leveling by direct inheritance -*----------------------------------------------------------------------------- - FLO_FUNC(R,V,P,CG,COM_GRP,TS)$(NOT FLO_FUNC(R,V,P,CG,COM_GRP,TS)) $= - SUM(FFCKS(R,P,CG,COM_GRP,ANNUAL)$PRC_TS(R,P,TS),FLO_FUNC(R,V,P,CG,COM_GRP,ANNUAL)); -*----------------------------------------------------------------------------- - -*UR* after inheritance aggregation delete all data that are not specified for elements of PRC_TS -* ? not a good idea since at least partially deleting the input of the user ? -* -* FLO_FUNC(R,T,P,CG,COM_GRP,S)$(FFCKS(R,P,CG,COM_GRP,S)*(NOT PRC_TS(R,P,S))) = 0; - - OPTION CLEAR = FFCKS, CLEAR = CG_GRP; -*$OFFLISTING - diff --git a/source/pp_lvlfs.mod b/source/pp_lvlfs.mod deleted file mode 100644 index d1d67cd..0000000 --- a/source/pp_lvlfs.mod +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLFS set the level of FLO_SUM attribute using aggregation/inheritance -* %1 - mod or v# for the source code to be used -*=============================================================================* -*GaG Questions/Comments: -* - Assumption is that values can be at any level -*----------------------------------------------------------------------------- -*$ONLISTING - SET FSTSL(TSLVL,R,P,CG,CG,CG,S) //; - -* check all commodities in the groups of a process at other than PRC_TS level - COEF_PTRAN(R,LL,P,CG,C,COM_GRP,S) $= FLO_SUM(R,LL,P,CG,C,COM_GRP,S)$(NOT RPCS_VAR(R,P,C,S)); - OPTION FSCKS <= COEF_PTRAN; - FSCK(R,P,CG,C,COM_GRP) $= SUM(FSCKS(R,P,CG,C,COM_GRP,S)$(NOT RPS_PRCTS(R,P,S)),1); - LOOP(ANNUAL(TS(TSLVL)),FSTSL(TSLVL+STOAL(R,S),FSCKS(R,P,CG,C,COM_GRP,S)) = YES); -*----------------------------------------------------------------------------- -* Leveling by simultaneous aggregation/inheritance -*----------------------------------------------------------------------------- - LOOP((FSCK(R,P,CG,C,COM_GRP),RTP(R,V,P)), - TS_ARRAY(ALL_TS) = FLO_SUM(R,V,P,CG,C,COM_GRP,ALL_TS); - FLO_SUM(R,V,P,CG,C,COM_GRP,TS)$RPCS_VAR(R,P,C,TS) = - SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + - SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), - TS_ARRAY(ALL_TS))))/G_YRFR(R,TS)); -*----------------------------------------------------------------------------- -* Leveling by direct inheritance -*----------------------------------------------------------------------------- -* after mixed aggregation/inheritance delete all data that are not specified at PRC_TS - FLO_SUM(R,LL,P,CG,C,COM_GRP,S)$COEF_PTRAN(R,LL,P,CG,C,COM_GRP,S) = 0; - FLO_SUM(R,LL,P,CG,C,COM_GRP,S)$(NOT RTP(R,LL,P)) = 0; - FOR(Z=CARD(TSLVL)-2 DOWNTO 0, - LOOP(SAMEAS(TSLVL-Z,'ANNUAL'), - FLO_SUM(RTP(R,V,P),CG,C,COM_GRP,TS)$((NOT FLO_SUM(R,V,P,CG,C,COM_GRP,TS))$RPCS_VAR(R,P,C,TS)) $= - SUM(FSTSL(TSLVL,R,P,CG,C,COM_GRP,S)$RS_BELOW(R,S,TS),COEF_PTRAN(R,V,P,CG,C,COM_GRP,S)); - )); -*----------------------------------------------------------------------------- - OPTION CLEAR=COEF_PTRAN, CLEAR = FSCK, CLEAR = FSCKS, CLEAR=FSTSL; - FLO_SUM(R,LL,P,CG,C,CG,S)$FSCKS(R,P,CG,C,CG,S) = 0; -*$OFFLISTING diff --git a/source/pp_lvlif.mod b/source/pp_lvlif.mod deleted file mode 100644 index 74f540f..0000000 --- a/source/pp_lvlif.mod +++ /dev/null @@ -1,45 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLIF set the level of a IRE_FLO attribute using aggregation/inheritance -* %1 - mod or v# for the source code to be used -*=============================================================================* -*GaG Questions/Comments: -* - Assumption is that values can be at any level -*----------------------------------------------------------------------------- -*$ONLISTING - - OPTION CLEAR=UNCD7; PUTGRP = 0; -*----------------------------------------------------------------------------- - LOOP((REG,V,P,COM,R,C,S)$IRE_FLO(REG,V,P,COM,R,C,S), - IF(NOT RPCS_VAR(R,P,C,S), - IF(NOT UNCD7(REG,P,COM,R,C,'0','0'), UNCD7(REG,P,COM,R,C,'0','0') = YES; - IF(NOT RPC_IRE(R,P,C,'IMP'), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 02 'IRE_FLO import commodity not in TOP_IRE' - PUT QLOG ' WARNING - R=',%RL%,' P=',%PL%,' C=',C.TL ; - ); - IF((NOT SUM((RS_BELOW(R,S,TS),MODLYEAR),IRE_FLO(REG,MODLYEAR,P,COM,R,C,S)))$SAMEAS('ANNUAL',S), -* No values below an ANNUAL level value: inherit value down - UNCD7(REG,P,COM,R,C,S,'') = YES; - ELSE UNCD7(REG,P,COM,R,C,TS,'')$RPCS_VAR(R,P,C,TS) = YES;)))); -*----------------------------------------------------------------------------- -* Aggregation/inheritance to target timeslices -*----------------------------------------------------------------------------- - LOOP(UNCD7(REG,P,COM,R,C,TS,''), - IF(RPCS_VAR(R,P,C,TS), -* Leveling by simultaneous aggregation/inheritance; but only if target level value is not present - LOOP(RTP(REG,V,P), TS_ARRAY(S) = IRE_FLO(REG,V,P,COM,R,C,S); - IRE_FLO(REG,V,P,COM,R,C,TS)$(NOT TS_ARRAY(TS)) $= - SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + - SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), - TS_ARRAY(ALL_TS))))/G_YRFR(R,TS)); - ELSE MY_ARRAY(V) = IRE_FLO(REG,V,P,COM,R,C,TS); -* Simple direct inheritance down - IRE_FLO(RTP(REG,V,P),COM,R,C,S)$(RS_BELOW(R,TS,S)$RPCS_VAR(R,P,C,S)) $= MY_ARRAY(V);)); -*----------------------------------------------------------------------------- -OPTION CLEAR=UNCD7; - -*$OFFLISTING - diff --git a/source/pp_lvlpk.mod b/source/pp_lvlpk.mod deleted file mode 100644 index 8b25f78..0000000 --- a/source/pp_lvlpk.mod +++ /dev/null @@ -1,53 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLPK - levelization of NCAP_PKCNT -* %1 - Default value for leveling -*=============================================================================* -* Questions/Comments: -* - -*----------------------------------------------------------------------------- -SET RPC_PKC(R,P,C); -PARAMETER RPC_PKF(R,P,C) //; -*----------------------------------------------------------------------------- -* Collect PKTS for all COM_PEAK commodities -LOOP(COM_PKTS(R,CG,S), RCS(COM_TS(R,C,TS))$(RS_TREE(R,S,TS)$COM_GMAP(R,CG,C)) = YES); -TRACKC(R,C) $= SUM(RCS(R,C,S),1); -*----------------------------------------------------------------------------- -* Levelization of NCAP_PKCNT -LOOP((RTP(R,V,P),S)$NCAP_PKCNT(R,V,P,S), - RTP_GRP(R,V,P,C,IO('OUT'))$(SUM(RCS(R,C,TS)$(NOT NCAP_PKCNT(R,V,P,TS)),1)$RPC(R,P,C)) = YES); -*----------------------------------------------------------------------------- -* Aggregation/inheritance to target timeslices -*----------------------------------------------------------------------------- -LOOP(RTP_GRP(R,V,P,C,IO), TS_ARRAY(S) = NCAP_PKCNT(R,V,P,S); - IF((NOT SUM(RS_BELOW(R,'ANNUAL',S)$TS_ARRAY(S),1))$TS_ARRAY('ANNUAL'), - NCAP_PKCNT(R,V,P,S)$RCS(R,C,S) = TS_ARRAY('ANNUAL'); - ELSE -* Set leveling default = %1; - TS_ARRAY('ANNUAL')$(NOT TS_ARRAY('ANNUAL')) = %1; -* Simultaneous inheritance/aggregation; but only if target level value is not present - LOOP(RCS(R,C,TS)$(NOT TS_ARRAY(TS)), - NCAP_PKCNT(R,V,P,TS) $= - SUM(TS_MAP(R,TS,S)$FINEST(R,S), G_YRFR(R,S)/G_YRFR(R,TS) * (TS_ARRAY(S) + - SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(SL$RS_BELOW(R,ALL_TS,SL),TS_MAP(R,SL,S)*TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), - TS_ARRAY(ALL_TS))))))); -*----------------------------------------------------------------------------- -* Peak contribution - TRACKPC(R,P,C)$((TOP(R,P,C,'OUT')+RPC_IRE(R,P,C,'IMP'))$TRACKC(R,C)) = YES; -* If PRC_PKAF, apply PKCNT only for capacity - TRACKP(PRC_PKAF(RP))=NOT PRC_PKNO(RP); RPC_PKF(TRACKPC(RP,C))=EPS**1$TRACKP(RP); - TRACKPC(PRC_PKNO(RP),C)=NO; -* If no PKCNT provided, Copy NCAP_AF if PRC_PKAF; Otherwise set default 1 - LOOP(TRACKPC(R,P,C),PRC_TS2(R,P,S)$((NOT SUM(RTP(R,V,P),NCAP_PKCNT(RTP,S)))$RCS(R,C,S)) = YES); - NCAP_PKCNT(RTP(R,V,P),S)$PRC_TS2(R,P,S) = 1$(NOT PRC_PKAF(R,P)) + - SUM(PRC_TS(R,P,TS)$RS_TREE(R,S,TS),SMAX(BD,NCAP_AF(RTP,TS,BD))*(1+(G_YRFR(R,TS)/G_YRFR(R,S)-1)$RS_BELOW(R,S,TS)))$PRC_PKAF(R,P); -*----------------------------------------------------------------------------- -* RPC_PKC indicator for peak contribution by capacity - RPC_PKC(TRACKPC(RPC_ACT(TRACKP(RP_STD),C)))=YES; - TRACKPC(RP,C)$(NOT RPC_PG(RP,C)*RP_FLO(RP))=NO; - RPC_PKC(TRACKPC(RP_PGACT(RP),C))$(RP_PG(RP,C)+TRACKP(RP))=YES; - LOOP(NRG_TMAP(R,'ELC',C)$TRACKC(R,C),RPC_PKC(TRACKPC(TRACKP(R,P),C))=YES;TRACKP(R,P)$TRACKPC(R,P,C)=NO); - OPTION CLEAR=TRACKP,CLEAR=TRACKC,CLEAR=TRACKPC,CLEAR=RTP_GRP,CLEAR=RCS,CLEAR=PRC_TS2; diff --git a/source/pp_lvlus.mod b/source/pp_lvlus.mod deleted file mode 100644 index 1fee593..0000000 --- a/source/pp_lvlus.mod +++ /dev/null @@ -1,39 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_LVLUS aggregate/inherit UC_N attributes if at different than target level -* %1 - attribute name (UC_ACT, UC_FLO etc.) -* %2 - other qualifying indexes before S index (e.g. ',C') -* %3 - TS set shooting for (PRC_TS, RPCS etc.) -* %4 - UNCD7 residual dimension -* %5 - optional remaining indexes (e.g. 'IE') -* %6 - optional UC_N qualifying indexes (e.g. COM_VAR) -*=============================================================================* - OPTION CLEAR=UNCD7; - LOOP((UC_N%6,SIDE,R,T,%2,S%5)$%1(UC_N%6,SIDE,R,T,%2,S%5), - IF((NOT %3(R,%7%10,S))$STOA(S), - IF(NOT UNCD7(UC_N%6,SIDE,R,%2%5,'OUT'%4), UNCD7(UC_N%6,SIDE,R,%2%5,'OUT'%4)=YES; - F=SMAX(%7%8_TSL(R,%7,TSL),MAX(%9+EPS,ORD(TSL)-1)); IF(F1); - LOOP(FIL(T),RD_NLP(R,C)$(DDF_QREF(R,T,C)*DDF_PREF(R,T,C)*MI_DOPE(R,T,C)=0)=NO); - TRACKC(RD_AGG(RC))$=RD_NLP(RC); - RD_AGG(RC)$RD_NLP(RC)=NO; - -*----------------------------------------------------------------------------- - MI_ESUB(R,T,C)$TRACKC(R,C) = ROUND(MI_ESUB(R,T,C)*(1-5e-6),5)*(1+5e-6); - MI_RHO(R,T,C)$((MI_ESUB(R,T,C)>0)$TRACKC(R,C)) = 1-1/MI_ESUB(R,T,C); - RD_NLP(TRACKC(R,C))$PROD(FIL(T),MI_RHO(R,T,C)) = 3; - LOOP(MI_DMAS(R,C,COM)$(RD_NLP(R,C)>2),RD_NLP(R,COM)=-1); - RCJ(RC,J,BD)$RD_NLP(RC)=NO; - OPTION CLEAR=TRACKC; -*----------------------------------------------------------------------------- -* Calculate demand function parameters - RD_SHAR(R,T(FIL),C,COM)$(MI_DMAS(R,C,COM)$RD_NLP(R,C)) = COM_AGG(R,T,COM,C)*DDF_QREF(R,T,COM)/DDF_QREF(R,T,C)*(DDF_PREF(R,T,COM)/COM_AGG(R,T,COM,C)/DDF_PREF(R,T,C))**MI_ESUB(R,T,C); - MI_ELASP(R,T(FIL),C)$((RD_NLP(R,C)>1)$DEM(R,C)) = 1 - 1/MI_DOPE(R,T,C); - MI_CCONS(R,T(FIL),C)$((RD_NLP(R,C)>1)$DEM(R,C)) = DDF_PREF(R,T,C)*(1/MI_ELASP(R,T,C))*DDF_QREF(R,T,C)**(1/MI_DOPE(R,T,C)); - -* DISPLAY RD_NLP,MI_CCONS,MI_ELASP,RD_SHAR; -*----------------------------------------------------------------------------- -* Bounds section - COM_VOC(R,T,C,BDNEQ(BD))$((NOT COM_VOC(R,T,C,BD))$RD_NLP(R,C)) = 1; - VAR_DEM.L(R,T,C)$RD_NLP(R,C) = DDF_QREF(R,T,C); - VAR_DEM.UP(R,T,C)$RD_NLP(R,C) = DDF_QREF(R,T,C)*(1+COM_VOC(R,T,C,'UP')); - VAR_DEM.LO(R,T,C)$RD_NLP(R,C) = DDF_QREF(R,T,C)*MAX(.1,1-COM_VOC(R,T,C,'LO')); - VAR_DEM.FX(R,T(MIYR_1),C)$RD_NLP(R,C) = DDF_QREF(R,T,C); - VAR_OBJELS.LO(R,'FX',CUR)$RDCUR(R,CUR) = -INF; diff --git a/source/pp_off.mod b/source/pp_off.mod deleted file mode 100644 index ea64d93..0000000 --- a/source/pp_off.mod +++ /dev/null @@ -1,23 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_OFF sets to Start/End of the OFF period range -* %1 - OFF Set name -* %2 - 'C'ommodity/'P'rocess index indicator -* %3 - control set -* %4 - Table to set for each off-range with qualifier and one open ( -* %5 - The value for the off range (EPS/NO) -*=============================================================================* -* Comments: Depends on BOHYEAR/EOHYEAR being ordered 1 higher than ALLYEAR -*----------------------------------------------------------------------------- -*$ONLISTING -* Cope with multiple OFF-ranges - OPTION CLEAR=FIL; - LOOP(%1(R,%2,BOHYEAR,EOHYEAR)%3, STARTOFF=ORD(BOHYEAR)-2; ENDOFF=ORD(EOHYEAR); -* set the flags of the shutoff period - FIL(EOHYEARS(LL))$((ORD(LL) > STARTOFF)$(ORD(LL) < ENDOFF)) = YES); -* open ( - %4(SUM(PERIODYR(T,FIL),1)/D(T) GE G_OFFTHD(T))$FIL(T)) = %5; -*$OFFLISTING diff --git a/source/pp_prelv.vda b/source/pp_prelv.vda deleted file mode 100644 index fd281b5..0000000 --- a/source/pp_prelv.vda +++ /dev/null @@ -1,116 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* pp_prelvl.vda - Auxiliary preprocessing before levelizing -*=============================================================================* -* To be called AFTER establishing RTCS_VARC and RPCS_VAR. -*----------------------------------------------------------------------------- -* Restore NCAP_TLIFE for RESID - LOOP(PYR_S(V),NCAP_TLIFE(R,V,P)$PRC_RESID(R,'%DFLBL%',P) = PRC_RESID(R,'%DFLBL%',P)); -*============================================================================= -* For filtering VDA_FLOP, check ACT_EFF groups - TRACKPC(RPC_SPG(R,P,C))$((NOT RPG_1ACE(R,P,C,C))$RPC_ACE(R,P,%PGPRIM%)) = YES; - Z = CARD(VDA_FLOP); - VDA_FLOP(R,LL,P,C,S)$((NOT KEEP_FLOF(R,P,C))$TRACKPC(R,P,C)) = 0; -$IFI %SHELL%==ANSWER PRC_ACTFLO(R,LL,P,C)$((NOT KEEP_FLOF(R,P,C))$TRACKPC(R,P,C)) = 0; - Z = Z-CARD(VDA_FLOP); IF(Z, DISPLAY 'DELETED FLOPS FOR SPG:',Z); -* Residual values - ACT_FLO(R,LL,P,C,S)$(RPC_PG(R,P,C)+RPS_PRCTS(R,P,S)) = 0; - OPTION RPC_AFLO < ACT_FLO, CLEAR=ACT_FLO,CLEAR=TRACKPC,CLEAR=KEEP_FLOF; - ACT_FLO(R,V,P,C,S)$RPC_AFLO(R,P,C) $= VDA_FLOP(R,V,P,C,S); - VDA_FLOP(RTP,C,S)$ACT_FLO(RTP,C,S) = 1; -*----------------------------------------------------------------------------- -* Preprocessing of VDA_FLOP after establishing PRC_SPG - OPTION RP_GRP < VDA_FLOP; - TRACKPC(RP_GRP(RPC)) = YES; -* RP_GRP contains only CGs that are not in topology, but include some C in RPC - RP_GRP(TRACKPC) = NO; - RP_GRP(R,P,CG)$(NOT SUM(RPC(R,P,C)$COM_GMAP(R,CG,C),1)) = NO; -* Set PRC_CG now automatically - PRC_CG(RP_GRP) = YES; -*----------------------------------------------------------------------------- -* Identify processes with PG-based FLO_SUMs - LOOP(TRACKPC(RPC_PG(R,P,C)),TRACKP(R,P)=YES); -* Add default value for PG commodities not in TRACKPC - VDA_FLOP(RTP(R,V,P),C,ANNUAL)$((RPC_PG(R,P,C)*(NOT TRACKPC(R,P,C)))$TRACKP(R,P)) = 1; -* Remove all PG commodities from TRACKPC: - TRACKPC(RPC_PG) = NO; -*----------------------------------------------------------------------------- -* Partition the groups into direct/PG based ones - CG_GRP(RP_PG(R,P,CG2),CG)$RP_GRP(R,P,CG) = YES; - RPCC_FFUNC(CG_GRP(TRACKP(R,P),CG2,CG))$SUM(RPC_SPG(R,P,C)$COM_GMAP(R,CG,C),1) = YES; - CG_GRP(RPCC_FFUNC) = NO; OPTION CLEAR=RP_GRP; -*----------------------------------------------------------------------------- -* Remove from TRACKP those processes for which CG has been defined: - LOOP(RPCC_FFUNC(R,P,CG2,CG),TRACKP(R,P) = NO); -* Add into FFUNC single SPG commodities for remaining TRACKP: - TRACKP(RP)$(SUM(RPC_SPG(TRACKPC(RP,C)),1)<>1) = NO; - RPCC_FFUNC(RP_PG(TRACKP(RP),CG),C) $= SUM(RPC_SPG(TRACKPC(RP,C)),1); - TRACKPC(RPC_SPG(TRACKP,C)) = NO; -*----------------------------------------------------------------------------- -* VDA_FLOP is in the direction from the PG to the CG: - FLO_FUNC(RTP(R,V,P),CG2,CG,S)$RPCC_FFUNC(R,P,CG2,CG) = VDA_FLOP(RTP,CG,S); -*----------------------------------------------------------------------------- -* Set FLO_SUM for individual commodities in PG: - FLO_SUM(RTP(R,V,P),CG2,C,CG,S)$(RPC_PG(R,P,C)$RPCC_FFUNC(R,P,CG2,CG)) = VDA_FLOP(RTP,C,S)*(1/PRC_ACTFLO(RTP,C)); -* Set FLO_SUM for groups of commodities: - FLO_SUM(RTP(R,V,P),CG2,C,CG,S)$(RPC_PG(R,P,C)$CG_GRP(R,P,CG2,CG)) = VDA_FLOP(RTP,CG,S)*(1/PRC_ACTFLO(RTP,C)); -* Finally, handle single commodities without a group (and not in PG either) - FLO_SUM(RTP(R,V,P),CG,C,COM,S)$(RP_PG(R,P,CG)*RPC_PG(R,P,C)*TRACKPC(R,P,COM)) $= VDA_FLOP(RTP,COM,S)*(1/PRC_ACTFLO(RTP,C)); - FLO_FUNC(RTP(R,V,P),ACTCG,C,ANNUAL(S))$((FLO_FUNCX(RTP,ACTCG,C)<0)$TRACKPC(R,P,C)) $= VDA_FLOP(RTP,C,S); - OPTION CLEAR=TRACKP,CLEAR=TRACKPC,CLEAR=VDA_FLOP,CLEAR=CG_GRP,CLEAR=RPCC_FFUNC; -*----------------------------------------------------------------------------- -* Distribute IRE_FLOSUM for ACT; Ignore possible overwriting for now - PRC_ACTFLO(R,V,P,C) $= FLO_EMIS(R,V,P,%PGPRIM%,C,'ANNUAL')$PRC_MAP(R,'STG',P); - IRE_FLOSUM(R,V,P,C(ACTCG),S,IE,COM,'OUT') $= FLO_EMIS(R,V,P,C,COM,S)$RP_AIRE(R,P,IE); -* Preprocessing of FLO_EMIS - OPTION RP_CGC <= FLO_EMIS; - FLO_EMIS(RTP(R,V,P),C,C,S)$(RP_CGC(R,P,C,C)$RPC_PG(R,P,C)) = 1+(FLO_EMIS(RTP,C,C,S)-1)/PRC_ACTFLO(RTP,C); - RP_CGC(RP_IRE(R,P),CG,C)=NO; RP_CGC(RPC_STG,C)=NO; - RPCC_FFUNC(RP_CGC(RPC,COM)) = YES; - RP_CGC(RPCC_FFUNC(RPC,COM)) = NO; - RPC_EMIS(R,P,C)$SUM(RPCC_FFUNC(R,P,COM,C),1) = NO; -* Add groups of source commodities - FSCK(RP_CGC(R,P,CG,COM),C)$(COM_GMAP(R,CG,C)$RPC(R,P,C)) = YES; - LOOP(FSCK(R,P,CG,COM,C), FLO_SUM(R,V,P,COM,C,COM,S) $= FLO_EMIS(R,V,P,CG,COM,S); RPC_EMIS(R,P,COM) = NO); -* Add activity sources - FLO_SUM(RTP(R,V,P),COM,C,COM,S)$(RPC_PG(R,P,C)$RP_CGC(R,P,%PGPRIM%,COM)) = FLO_EMIS(RTP,%PGPRIM%,COM,S)/PRC_ACTFLO(RTP,C); - RP_CGC(R,P,%PGPRIM%,C) = NO; PUTGRP=0; - LOOP(RP_CGC(R,P,CG,COM)$RPC_EMIS(R,P,COM), -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'FLO_EMIS with no members of source group in process - ignored' - PUT QLOG ' WARNING - R=',%RL%,' P=',%PL%,' CG=',CG.TL,' COM=',COM.TL; - ); - FLO_SUM(RTP(R,V,P),COM,C,COM,ANNUAL)$RPC_PG(R,P,C) $= SUM(RP_CGC(R,P,CG,COM)$RPC_EMIS(R,P,COM),EPS); -* Add single source commodities - OPTION CLEAR=RP_CGC, CLEAR=FSCK, CLEAR=RPC_EMIS, CG_GRP < RPCC_FFUNC; - FLO_SUM(RTP(R,V,P),C,COM,C,S)$CG_GRP(R,P,C,COM) = FLO_EMIS(RTP,COM,C,S); - FLO_EFF(RTP(R,V,P),C,COM,S)$((NOT CG_GRP(R,P,C,COM))$RPC_PG(R,P,COM)$CHP(R,P)) $= FLO_EMIS(RTP,%PGPRIM%,C,S); - OPTION CLEAR=CG_GRP,CLEAR=RPCC_FFUNC,CLEAR=FLO_EMIS; -*============================================================================= -* Other preprocessing stuff for the VEDA interface -*============================================================================= -* Remove non-standard shares from FLO_SHAR - FLO_ASHAR(R,DM_YEAR,P,C,CG,S,BD) $= FLO_SHAR(R,DM_YEAR,P,C,CG,S,BD)$(NOT RP_STD(R,P)); - FLO_SHAR(R,LL,P,C,CG,S,BD)$FLO_ASHAR(R,LL,P,C,CG,S,BD) = 0; - NCAP_CHPR(RTP(R,V,P),'N') $= NCAP_CHPR(R,'0',P,'N'); -* Support for levelised FLO_FR - RPC_CONLY(RTP,C) $=SUM(L$FLO_FR(RTP,C,'ANNUAL',L),1); -$ BATINCLUDE pp_lvlfc.mod FLO_FR 'P,C' RPCS_VAR ',BD' ",'0','0'" ALL_TS T RPC_CONLY(R,T,P,C) - FLO_FR(RPC_CONLY(R,T,P,C),S,'N')=MIN(1,SUM(RS_BELOW1(R,S,TS)$RPCS_VAR(R,P,C,TS),G_YRFR(R,TS)))$TS_CYCLE(R,S); - FLO_FR(RPC_CONLY(R,T,P,C),S,BD)$FLO_FR(R,T,P,C,S,BD)=FLO_FR(R,T,P,C,S,BD)*G_YRFR(R,S)$RPCS_VAR(R,P,C,S); - OPTION CLEAR=RPC_CONLY; -* Call the powerflo extension -$IFI %POWERFLO%==YES $include powerflo.vda -*----------------------------------------------------------------------------- -* Set COM_VAR default bounds - COM_BNDNET(R,T,C,ANNUAL(S),'N')$(NOT COM_BNDNET(R,T,C,S,'N')) $=COM_BNDNET(R,'0',C,S,'N'); - COM_BNDNET(RTCS_VARC(RTC,S),BDLOX(BD))$((NOT COM_BNDNET(RTC,S,BD))$COM_BNDNET(RTC,'ANNUAL','N')) = - (EPS-INF$BDNEQ(BD))$(-SIGN(COM_BNDNET(RTC,'ANNUAL','N'))=1$BDNEQ(BD)); - COM_BNDPRD(R,T,C,ANNUAL(S),'N')$(NOT COM_BNDPRD(R,T,C,S,'N')) $=COM_BNDPRD(R,'0',C,S,'N'); - COM_BNDPRD(RTCS_VARC(RTC,S),BDLOX(BD))$((NOT COM_BNDPRD(RTC,S,BD))$COM_BNDPRD(RTC,'ANNUAL','N')) = - (EPS-INF$BDNEQ(BD))$(-SIGN(COM_BNDPRD(RTC,'ANNUAL','N'))=1$BDNEQ(BD)); -*----------------------------------------------------------------------------- -* Remove timeslices turned off if DYNTS enabled -$IF NOT %RTS%==S $BATINCLUDE dynslite.vda PRELEV \ No newline at end of file diff --git a/source/pp_qack.mod b/source/pp_qack.mod deleted file mode 100644 index e8a1148..0000000 --- a/source/pp_qack.mod +++ /dev/null @@ -1,373 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_QACK.MOD perform the individual quality control checks -* %1 - mod or v# for the source code to be used -*=============================================================================* -*GaG Questions/Comments: -* - Provide control mechansim to turn-off (ALL, NOFATAL, NONE) tests -*------------------------------------------------------------------------------ -* Pending Tests: -* - check that each process consumes/produces a commodity -* - check that each commodity is both produced/consumed -* - TOP not violated by reference to COM not in TOP/T/X -* - every process has PRC_ACTUNT/CAPUNT specified? -* - not both COM_NETBND and COM_PRDBND (or does not matter?) + COM_PROJ -* - check that any commodity/ts-index attribute OK according to COM_TS -* - c=OCOM+NCAP_VALU+input to another process, otherwise warning -* - check that FLO_FUNC/SHAR/SUM cg has all elements on the same side -* - if PRC_ANN and non-ANNUAL attribute provided give warning -* - check that all attributes s-index match up with RPS and the individual commodities -* - warning that "NRG" used if no group matching the PG and PRC_SPG not provided -* - No PRC_CAPUNIT/ACTUNIT assigned and > 1 input; fatal? -* - PRC_CAPUNIT/ACTUNIT cg should be the same; serious? -* - Check that anticipated mapping list members that may affect matrix generation are provided (e.g., FRE/LIMRENEW) -* - check the TS associated with any attribute (as well as COM/PRC_TS) is OK -* - check that if list of peak timeslices provided by the user then actual peak is in said list -* - check that all FLO_* c/cg somehow relate to the PG/SPG (ouch) -* - if TOP_IRE to/from an external check for IRE_BND/PRICE/XBND -* - check that PRC_TSL=COM_TSL=COM_FR for DEM commodities -* - check that TS-attributes are found in TS_GROUP/MAP for the region (during Aggr/Inher) -* - or see what is around for TS_GROUP (TS_MAP if > 2 levels) and G_YRFR at the min!!! -* - check that no 0/EPS for attributes that could turn-off a flow, or cause a 0 divide -*----------------------------------------------------------------------------- -*V0.5c 980904 - File opened in PPMAIN.MOD, setup to append in case any PP_MAIN messages output -* FILE QLOG / QA_CHECK.LOG /; - ALIAS(U2,U3,U4,*); - PUT QLOG; - IF(PUTOUT, QLOG.AP = 1); - -* make 2 decimals points and allow for wider page - QLOG.NW=10;QLOG.ND=2;QLOG.PW=150; - - PUTGRP = 0; -*----------------------------------------------------------------------------- -* Some important control sets are completed here -* Complete merely CAP dependent flow indicators - RPC_CONLY(RTPC(R,T,P,C))$RPC_NOFLO(R,P,C) = YES; -* Complete flow variable indicators - RTPCS_VARF(RPC_CONLY(R,T,P,C),S) = NO; -* Remove superfluous entries from RCS_COMBAL - RCS_COMBAL(RHS_COMBAL,BDNEQ) = NO; -* Establish the RPG_RED control set - TRACKPC(R,P,C)$(RPC_ACT(R,P,C)+RPC_FFUNC(R,P,C)+RPC_EMIS(R,P,C)) = YES; - RPG_RED(R,P,CG,IO)$(NOT SUM(TOP(TRACKPC(R,P,C),IO)$COM_GMAP(R,CG,C),1)) = NO; - OPTION CLEAR = TRACKPC; -$ IFI %VAR_UC%==YES OPTION UC_GMAP_U<=UC_UCN; - RTP(NO_RVP) = NO; -*----------------------------------------------------------------------------- -* Year fractions -*----------------------------------------------------------------------------- - LOOP(R, TS_ARRAY(S) = 0; - LOOP(TS_MAP(R,TS,S)$(G_YRFR(R,S) EQ 0), TS_ARRAY(S) = 1;); - LOOP(S$TS_ARRAY(S), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 99 'Year Fraction G_YRFR is ZERO!' - PUT QLOG ' FATAL ERROR - R=',%RL%,' S=',S.TL; - )); - PUTGRP = 0; -*----------------------------------------------------------------------------- -* Topology -*----------------------------------------------------------------------------- -* Check PGPRIM - LOOP(RPC(R,P,C(%PGPRIM%)), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 99 'Illegal system commodity in topology.' - PUT QLOG ' FATAL ERROR - R=',%RL%,' P=',%PL%,' C=',C.TL; - ); - PUTGRP = 0; Z = 1; -* see that components of any CG for a process in topology - LOOP(PRC_CG(R,P,CG)$(NOT COM_TYPE(CG)), - Z = NOT SUM(COM_GMAP(R,CG,C)$RPC(R,P,C),1); - LOOP(COM_GMAP(R,CG,C)$((NOT RPC(R,P,C))$Z), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 10 'Commodity in CG of process P but not in topology' - PUT QLOG ' SEVERE WARNING - R=',%RL%,' P=',%PL%,' C=',%CL%,' CG=',CG.TL ; - ) - ); - PUTGRP = 0; -*----------------------------------------------------------------------------- -* Commodity description -*----------------------------------------------------------------------------- -$IF NOT %TIMESED%==YES $SETLOCAL TIMESED NO - IF(%TIMESED%, FORWARD(T)=YES; -$IF DEFINED SOL_BPRICE OPTION FORWARD < SOL_BPRICE; - LOOP(T$(NOT FORWARD(T)), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 09 'Elastic Demand but missing BPRICE for some MILESTONYR - using tail extrapolation' - PUT QLOG ' WARNING - Missing BPRICE, MILESTONYR=',T.TL); - PUTGRP = 0; - LOOP(DEM(R,C)$SUM(BD$COM_STEP(R,C,BD),1), -* Check that elastic demands fully sprecifed - IF((NOT SUM((T,S,CUR)$COM_BPRICE(R,T,C,S,CUR),1)) + - (NOT SUM((T,BD)$COM_VOC(R,T,C,BD),1)) + - (NOT SUM((T,S,BD)$COM_ELAST(R,T,C,S,BD),1)), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 10 'Elastic Demand but either COM_BPRICE/ELAST/VOC missing' - PUT QLOG ' WARNING - R=',%RL%,' C=',%CL% ; - ) - ); - ); - PUTGRP = 0; - LOOP(RC(R,C(COM_TYPE)), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 99 'Commodity type is also a commodity' - PUT QLOG ' FATAL ERROR - R=',%RL%,' C=',C.TL ; - ); - PUTGRP = 0; - LOOP(RC(R,C)$(SUM(COM_TMAP(R,COM_TYPE,C),1) NE 1), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 09 'Commodity has ambiguous base type' - IF(SUM(COM_TMAP(R,COM_TYPE,C),1) GT 1, - PUT QLOG ' FATAL ERROR - Several types: R=',%RL%,' C=',C.TL ; - ELSE PUT QLOG ' FATAL ERROR - Missing type : R=',%RL%,' C=',C.TL ;); - ); - PUTGRP = 0; -*----------------------------------------------------------------------------- -* Demand description -*----------------------------------------------------------------------------- - OPTION TRACKC < RD_SHAR; - LOOP((R,T,C)$COM_PROJ(R,T,C),TRACKC(R,C) = YES); - LOOP(COM_GMAP(DEM(R,C),C)$(NOT TRACKC(R,C)), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Demand: DEM commodity with missing COM_PROJ Projection' - PUT QLOG ' WARNING - R=',%RL%,' C=',C.TL ; - ); - PUTGRP = 0; - LOOP(TRACKC(R,C)$(NOT DEM(R,C)), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Demand: COM_PROJ specified for non-DEM commodity' - PUT QLOG ' WARNING - R=',%RL%,' C=',C.TL ; - ); - OPTION CLEAR=TRACKC; - PUTGRP = 0; -*----------------------------------------------------------------------------- -* Process description -*----------------------------------------------------------------------------- - SET QASTAT(J) / 1 'Unreliable (see QA_Check.log)' /; - OPTION TRACKPC43 / @15; - WHILE(QLOG.CC<67,PUT '*****'); PUT @29,'QUALITY ASSURANCE LOG':<>27; - ); - PUT$(NOT %2) QLOG // ' *** %4 '; - -* hold highest errorlevel for shutdown or not -$IF NOT %3==* %2=1+1$(ROUND(%3)>9); PUT QLOG / ' *00'@(5-%2) MIN(99,%3):%2:0; ERRLEV$(%3>ERRLEV)=%3; diff --git a/source/pp_reduce.red b/source/pp_reduce.red deleted file mode 100644 index e881a9c..0000000 --- a/source/pp_reduce.red +++ /dev/null @@ -1,183 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* Reduction of model size -*----------------------------------------------------------------------------- -* when no reduction all processes have capacity variables and activity equations - PRC_CAP(RP) = YES; - PRC_ACT(RP) = RP_STD(RP)+RP_IRE(RP); - OPTION RP_AFB < NCAP_AF; - -$SETGLOBAL CAL_RED 'cal_nored.red' -* skip reduction algorithm by setting REDUCE to NO in run file -$IF %REDUCE% == NO $GOTO REDDONE - -*----------------------------------------------------------------------------- -* limiting the number of capacity variables -*----------------------------------------------------------------------------- -* determining processes that need capacity variables - PRC_CAP(RP) = NO; - LOOP((R,UC_N,P)$UC_GMAP_P(R,UC_N,'CAP',P), PRC_CAP(R,P) = YES); - LOOP((R,UC_N,P)$UC_GMAP_P(R,UC_N,'NCAP',P), PRC_CAP(R,P) = YES); - LOOP((RTP(R,PYR,P))$NCAP_PASTI(R,PYR,P), PRC_CAP(R,P) = YES); - LOOP((RTP(R,T,P),BD)$CAP_BND(R,T,P,BD), PRC_CAP(R,P) = YES); - LOOP((RTP(R,T,P),BD)$NCAP_BND(R,T,P,BD), PRC_CAP(R,P) = YES); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_COST(R,LL,P,CUR) NE 0); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_FOM(R,LL,P,CUR) NE 0); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_ISUB(R,LL,P,CUR) NE 0); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_ITAX(R,LL,P,CUR) NE 0); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_FSUB(R,LL,P,CUR) NE 0); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_FTAX(R,LL,P,CUR) NE 0); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_DCOST(R,LL,P,CUR) NE 0); - OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_DLAGC(R,LL,P,CUR) NE 0); - LOOP(OBJ_ICUR(R,LL,P,CUR), PRC_CAP(R,P) = YES); -*[UR]: added checks for fixed availabilities - PRC_CAP(RP(R,P)) $= RP_AFB(RP,'FX'); - RTPS_BD(R,T--ORD(T),P,S--ORD(S),'FX') $= NCAP_AFS(R,T,P,S,'FX'); - RTPS_BD(R,T--ORD(T),P,ANNUAL,'FX') $= NCAP_AFA(R,T,P,'FX'); - LOOP(RTPS_BD(R,T,P,S,BD), PRC_CAP(R,P) = YES); - OPTION CLEAR=OBJ_ICUR,CLEAR=RTPS_BD; -$IF '%ETL%'==YES PRC_CAP(R,P)$SEG(R,P) = YES; - -*-------------------------------------------------------------------------------------------- -* Occurence of emission flow variable can be replaced by term (source flow x emission factor) -*-------------------------------------------------------------------------------------------- - OPTION CLEAR=TRACKPC; -* Get emission commodity candidates: - TRACKPC(RP_STD(R,P),C)$(TOP(R,P,C,'OUT')$ENV(R,C)) = YES; - TRACKPC(RPC_PG) = NO; - -* Select only those emissions that have been modeled with FLO_SUM on input flows - OPTION FSCK <= FLO_SUM; - FS_EMIS(FSCK(R,P,CG,C,COM))$((COM_GMAP(R,CG,C)$TOP(R,P,C,'IN'))$TRACKPC(R,P,COM)) = YES; - LOOP(FS_EMIS(R,P,CG,C,COM), RPC_EMIS(R,P,COM) = YES); -*------------------------------------------------------------------------------------------ -$IF NOT %REDUCE% == YES $GOTO REDDONE -$SETGLOBAL CAL_RED 'cal_red.red' -*-------------------------------------------------------------- -* only 1 commodity in PCG -* => corresponding VAR_FLO can be replaced by VAR_ACT indicated -* these cases are stored in RPC_ACT -*-------------------------------------------------------------- - RPC_ACT(RPC_PG(RP_PGACT(RP_STD),C)) = YES; - -* VAR_IRE can be replaced by VAR_ACT if only 1 import or export commodity - RPC_AIRE(RPC_PG(RP_IRE(RP_PGACT),C)) = YES; - -* If activity is substituted for the primary flow, EQ_ACTFLO is not needed - PRC_ACT(RP_PGACT) = NO; -*-------------------------------------------------------------------------------------------- -* Process without capacity variable and without activity related parameters -* does not need activity variable -*-------------------------------------------------------------------------------------------- - NO_ACT(PRC_ACT(R,P))$(NOT PRC_CAP(R,P)) = YES; - LOOP((RTP(R,T,P),S,BD)$((ACT_BND(RTP,S,BD)>-INF$BDUPX(BD))$ACT_BND(RTP,S,BD)), NO_ACT(R,P) = NO); - LOOP((R,DM_YEAR,P,CUR)$ACT_COST(R,DM_YEAR,P,CUR), NO_ACT(R,P) = NO); - LOOP((R,UC_N,P)$UC_GMAP_P(R,UC_N,'ACT',P), NO_ACT(R,P) = NO); - NO_ACT(R,P)$SUM(RPC_CUMFLO(R,P,%PGPRIM%,YEAR,LL),1) = NO; - -* Remove activity equation from processes that didn't have activity attributes - PRC_ACT(NO_ACT) = NO; -* Keep RTP_VARA even when no VAR_ACT is needed -**RTP_VARA(R,T,P)$NO_ACT(R,P) = NO; - -*-------------------------------------------------------------------------------------------- -* If FLO_FUNC between two flow variables and one flow variable defines the activity, -* the other flow variable can be expressed by the activity variable -*-------------------------------------------------------------------------------------------- -* check whether commodity defining activity is involved in FLO_FUNC - -* Get all FLO_FUNCs between single-commodity groups - OPTION CG_GRP <= FLO_FUNC; CG_GRP(R,P,CG,CG) = NO; - CG_GRP(R,P,CG,CG2)$(SUM(RPC(R,P,C)$COM_GMAP(R,CG,C),1) NE 1) = NO; - CG_GRP(R,P,CG1,CG)$(SUM(RPC(RP_PGACT(R,P),C)$COM_GMAP(R,CG,C),1) NE 1) = NO; - RPCG_PTRAN(RPC(R,P,C),COM,CG1,CG2)$((COM_GMAP(R,CG1,C)*RPC(R,P,COM)*COM_GMAP(R,CG2,COM))$CG_GRP(R,P,CG1,CG2)) = YES; -* Ensure that possible reverse ordering due to FLO_SUM is taken into account - LOOP(FSCK(R,P,CG1,C,CG2)$CG_GRP(R,P,CG2,CG1),RPCG_PTRAN(R,P,C,COM,CG1,CG2)$COM_GMAP(R,CG2,COM) = YES); - RPCG_PTRAN(R,P,C,COM,CG1,CG2)$(NOT (RPC_ACT(R,P,C)+RPC_ACT(R,P,COM))) = NO; - OPTION TRACKPC < RPCG_PTRAN; - -* Check all processes for commodity-to-commodity FLO_SUM: - OPTION RP_CGG < FSCK; - RPCG_PTRAN(RP_CGG(RPC_ACT(R,P,COM),C,CG),C)$(RP_PG(R,P,CG)+RPC_ACT(R,P,CG)) = YES; - RPCG_PTRAN(RP_CGG(RPC(R,P,COM),C,COM),C)$RPC_ACT(R,P,C) = YES; -* If shadow group has special level, don't substitute - RPCG_PTRAN(RP_SGS,C,COM,CG,CG2) = NO; - LOOP(RPCG_PTRAN(RP_FLO(R,P),C,COM,CG,CG2), - IF(RPC_ACT(R,P,C), RPC_FFUNC(R,P,COM) = YES; ELSE RPC_FFUNC(R,P,C) = YES); - ); -* Remove activity flows and emission flows from RPC_FFUNC - RPC_FFUNC(RPC)$(RPC_ACT(RPC)+RPC_EMIS(RPC)) = NO; - RPC_FFUNC(RPC_AFLO(TRACKPC)) = NO; - -* Add to RPCC_FFUNC all the CG1-CG2 PTRANS equations that are to be eliminated: - RPCG_PTRAN(R,P,C,COM,CG,CG2)$(NOT (RPC_FFUNC(R,P,C)+RPC_FFUNC(R,P,COM))) = NO; - LOOP(RPCG_PTRAN(R,P,C,COM,CG,CG2), RPCC_FFUNC(R,P,CG,CG2) = YES); - - OPTION CLEAR=CG_GRP,CLEAR=RP_CGG; -*-------------------------------------------------------------------------------------------- -* If upper/fixed ACT_BND of zero at a higher TS-level than PRC_TS, -* do not generate EQL/E_ACTBND equation but add upper/fixed bound -* of zero to the VAR_ACT variables in bnd_act.mod -*-------------------------------------------------------------------------------------------- -* (RTP_VARA(r,t,p) will be deleted if only all PRC_TS are fixed to zero in t) - LOOP((R,T,P,S,BDUPX)$((ACT_BND(R,T,P,S,BDUPX) EQ 0)$ACT_BND(R,T,P,S,BDUPX)), - RTPS_OFF(R,T,P,S)$RPS_PRCTS(R,P,S) = YES); - -* Handle any earlier clearing of VARF - LOOP((RTPCS_OUT(R,T,P,C,S),RPCS_VAR(RP_STD(R,P),C,S)), - IF(RPC_FFUNC(R,P,C), RTPS_OFF(R,T,P,TS)$(PRC_TS(R,P,TS)*RS_TREE(R,S,TS)) = YES; - ELSEIF RPC_ACT(R,P,C), RTPS_OFF(R,T,P,S) = YES)); - -*-------------------------------------------------------------------------------------------- -* Process with upper/fixed activity of zero cannot be used in current period -*-------------------------------------------------------------------------------------------- - OPTION CLEAR=RXX; -* Track commodities turned off by some process, by T, timeslice and IO: - LOOP(RTPS_OFF(R,T,P,S),IF(RP_STD(R,P),RTCS_SING(R,T,C,S,IO)$TOP(R,P,C,IO) = YES; - ELSE RTCS_SING(R,T,C,S,'OUT')$RPC_IRE(R,P,C,'IMP') = YES)); -* Track commodities turned off by some process, by IO only: - LOOP(RTCS_SING(R,T,C,S,IO),RXX(R,C,IO) = YES); - RXX(ENV,'IN') = NO; RXX(DEM,'IN') = NO; RXX(R,C,'IN')$RC_AGP(R,C,'LO') = NO; - LOOP((R,T,COM,C)$(RXX(R,C,'OUT')$COM_AGG(R,T,COM,C)),TRACKC(R,C) = YES); - RXX(TRACKC,'OUT') = NO; - RC_IOP(RXX(R,C,IO),P)$TOP(R,P,C,IO) = YES; - RC_IOP(RXX(R,C,'IN'),P)$RPC_IRE(R,P,C,'EXP') = YES; - RC_IOP(RXX(R,C,'OUT'),P)$RPC_IRE(R,P,C,'IMP') = YES; -* Check whether commodity is produced by only one process (including STG, consider e.g. STG_CHRG) - RXX(RXX(R,C,IO))$(SUM(RC_IOP(R,C,IO,P),1) NE 1) = NO; - RTCS_SING(R,T,C,S,IO)$(NOT RXX(R,C,IO)) = NO; - -* turning off all processes in linking to RTCS_SING - LOOP(RTCS_SING(R,T,C,S,IO--1), - LOOP(TOP(R,P,C,IO)$(SUM(COM$TOP(R,P,COM,IO),1)=1), RTPS_OFF(R,T,P,S)$RPS_PRCTS(R,P,S) = YES)); -* turn off RHS_COMPRD if single producer is turned off - RHS_COMPRD(R,T,C,S)$RTCS_SING(R,T,C,S,'OUT') = NO; - OPTION CLEAR=TRACKC,CLEAR=RC_IOP; -*-------------------------------------------------------------------------------------------- - RTPS_OFF(RTPS_OFF(R,T,P,S))$PRC_MAP(R,'STG',P) = NO; - RTPS_OFF(R,T,P,TS) $= SUM(RS_BELOW(R,S,TS)$RTPS_OFF(R,T,P,S),YES); -* Set EPS bounds for PRC_TS timeslices, removing the EPS bounds above - ACT_BND(RTPS_OFF(RTP_VARA(R,T,P),S),'UP')$PRC_TS(R,P,S) = EPS; - ACT_BND(RTPS_OFF(R,T,P,S),BD)$(NOT PRC_TS(R,P,S)) = 0; - -* all flows of process with RTPS_OFF entry are forced to zero -* hence flow variable is not required - RTPCS_OUT(RTPC(RTP(R,T,P),C),S)$RTPS_OFF(R,T,P,S) = YES; - RTP_VARA(R,T,P)$(SUM(PRC_TS(R,P,TS)$(NOT RTPS_OFF(R,T,P,TS)),1) EQ 0) = NO; - -*-------------------------------------------------------------------------------------------- - -$LABEL REDDONE - -*-------------------------------------------------------------------------------------------- -* Mark emissions to be handled by substitution - LOOP(FS_EMIS(R,P,CG,C,COM), RPCC_FFUNC(R,P,CG,COM) = YES); - OPTION CLEAR=TRACKPC,CLEAR=FSCK; - PRC_TS2(PRC_TS(RP_PGACT(RP_STD),S)) = YES; - RPC_PKF(RPC_PKC(PRC_CAP,C)) = 0; - -* Remove timeslices turned off if DYNTS enabled -$IF NOT %RTS%==S $BATINCLUDE dynslite.vda REDUCE diff --git a/source/pp_shapr.mod b/source/pp_shapr.mod deleted file mode 100644 index 5057c69..0000000 --- a/source/pp_shapr.mod +++ /dev/null @@ -1,48 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PP_SHPRC.MOD shape a process based attribute -* %1 - attribute name -* %2 - driving indexes -* %3 - any qualifiers to help narrow loop (if none, set to YES) -* %4 - mapped coefficient -* %5 - optional -M(R,V,P) or 1 -*=============================================================================* -*AL Comments: -*----------------------------------------------------------------------------- - -SET RTP_SHAPI(REG,ALLYEAR,PRC,BD,J,J,LL,LL); -SET RTP_ISHPR(REG,ALLYEAR,PRC) //; -$SETLOCAL PASS %3 -$IF %3 == '' $SETLOCAL PASS YES - -LOOP(BD,RTP_ISHPR(RTP(R,V,P))$((%1%6X(RTP,BD) GE 1.5)$%1%6X(RTP,BD)) = YES); -RTP_ISHPR(RTP(R,V,P))$((%5 GE 1.5)$%5) = YES; - -* Prepare for start and end years -OPTION CLEAR=FIL2; FIL2(V) = B(V)-YEARVAL(V); -PASTSUM(RTP_ISHPR(R,V,P)) = FIL2(V)+NCAP_ILED(R,V,P)+NCAP_TLIFE(R,V,P)-1; - -* Shape attributes only for processes around for > 1 period -%1%6X(RTP_ISHPR(R,V,P),BD)$(PASTSUM(R,V,P)-FIL2(V)+1 < D(V)) = 0; - -* Get hold of the shape and multi index J,JJ for each RVP, as well as start and end years -LOOP(SAMEAS(J,'1'), - RTP_SHAPI(RTP_ISHPR(R,V(LL),P),BD,J+MAX(0,%1%6X(R,V,P,BD)-1),J+MAX(0,%5-1),LL+(FIL2(V)+NCAP_ILED(R,V,P)),LL+PASTSUM(R,V,P)) = YES; -); - - LOOP(SAMEAS(AGE,'1'), -* Calculate average SHAPE for plants still operating in each period: - %4$((%PASS%)$RTP_ISHPR(R,V,P)) = %1%2 * - SUM(RTP_SHAPI(R,V,P,BD,J,JJ,LL,YEAR), MULTI(JJ,T) * - SUM(PERIODYR(T,EOHYEARS)$(YEARVAL(EOHYEARS) LE MAX(B(T),YEARVAL(YEAR))), - SHAPE(J,AGE+(MIN(YEARVAL(EOHYEARS),YEARVAL(YEAR))-YEARVAL(LL)))) / - (MAX(1,MIN(E(T),YEARVAL(YEAR))-MAX(B(T),YEARVAL(LL))+1)))); - -* If no shape index is pecified, set the BASE value for the attribute -RTP_ISHPR(RTP(R,V,P)) = (NOT RTP_ISHPR(R,V,P)); -%4$(RTP_ISHPR(R,V,P)$(%PASS%)) = %1%2; -* Clear the temporary sets -OPTION CLEAR=RTP_SHAPI,CLEAR=RTP_ISHPR,CLEAR=PASTSUM; diff --git a/source/ppm_ext.dsc b/source/ppm_ext.dsc deleted file mode 100644 index 444318c..0000000 --- a/source/ppm_ext.dsc +++ /dev/null @@ -1,16 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PPM_EXT.xtd oversees extended preprocessor activities * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* Questions/Comments: -* -*----------------------------------------------------------------------------- -$IF NOT DEFINED PRC_DSCNCAP $EXIT -*----------------------------------------------------------------------------- -* Discrete capacity extensions -*----------------------------------------------------------------------------- - NCAP_DISC(RTP(R,T,P),'0')$PRC_DSCNCAP(R,P) = EPS$(NOT NCAP_SEMI(R,T,P)); diff --git a/source/ppm_ext.ecb b/source/ppm_ext.ecb deleted file mode 100644 index 58112d1..0000000 --- a/source/ppm_ext.ecb +++ /dev/null @@ -1,49 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* ppm_ext.ecb - coefficients for market sharing (economic choice behavior) -*----------------------------------------------------------------------------- - SET COM_GRP / '_MSVIOL_' /; - SET COM / '_MSVIOL_' /; -*----------------------------------------------------------------------------- -$ IFI %STAGES%==YES $EXIT -$ IF %MACRO%==YES $EXIT -$ IFI %MACRO%==CSA $EXIT -$ IFI %MACRO%==MSA $EXIT -$ IF %STEPPED%==+ $EXIT -$ SETGLOBAL ECB YES -*----------------------------------------------------------------------------- - SET COM_TMAP / (SET.REG).FIN.'_MSVIOL_'/; - SET COM_LIM / (SET.REG).'_MSVIOL_'.N /; - SET RTC_MS(R,YEAR,C) 'Commodities with market sharing' // ; - PARAMETER COEF_LMS(R,ALLYEAR,C,P) 'Logit Market Share coefficients' // ; - PARAMETER ECB_NCAPR(R,ALLYEAR,P) 'First pass LEC results' //; - -$ SET RESET 0 -$ BATINCLUDE fillparm COM_MSHGV R C ",'','','','',''" T 'RTC(R,T,C)' 'GE 0' -$ BATINCLUDE fillparm NCAP_MSPRF R 'C,P,L' ",'','',''" T 'RTP(R,T,P)' 'GE 0' - -* Initialize probing shares - RTC_MS(RTC(R,T,C))$(SUM(TOP(RPC_PG(R,P,C),'OUT')$(NOT RTP_OFF(R,T,P)),ORD(T)>1)$COM_MSHGV(R,T,C)) = YES; - LOOP(RTC_MS(R,T,C),PRC_YMAX(RP_FLO(PRC_CAP(R,P)))$TOP(R,P,C,'OUT') = RPC_PG(R,P,C)$(NOT RTP_OFF(R,T,P)); - Z=SUM(P$PRC_YMAX(R,P),1); IF(Z, COEF_LMS(R,T,C,P)$PRC_YMAX(R,P) = -0.05 / Z)); - -* Complete flow controls for dummy - OPTION TRACKPC < COEF_LMS, RVP < COEF_LMS, TRACKP < TRACKPC; - TOP(TRACKP(R,P),'_MSVIOL_','IN') = YES; - RPC_NOFLO(TRACKP,'_MSVIOL_') = YES; - RPCS_VAR(TRACKP(R,P),'_MSVIOL_',ANNUAL) = YES; - RTPCS_VARF(RTP_VARA(R,T,P),'_MSVIOL_',ANNUAL) = YES; - IF(RPT_OPT('NCAP','1')<>1, RPT_OPT('NCAP','101')=ROUND(RPT_OPT('NCAP','1')); RPT_OPT('NCAP','1')=1); - -* Default values - NCAP_MSPRF(R,T,C,P,L('N'))$((NOT NCAP_MSPRF(R,T,C,P,L))$COEF_LMS(R,T,C,P)) = 1; - NCAP_MSPRF(R,T,C(ACTCG),P,L('UP'))$((NOT NCAP_MSPRF(R,T,C,P,L))$RVP(R,T,P)) = MAX(0,SMAX(TRACKPC(R,P,COM),NCAP_MSPRF(R,T,COM,P,L))); - NCAP_MSPRF(R,T,C(ACTCG),P,L('UP'))$((NOT NCAP_MSPRF(R,T,C,P,L))$RVP(R,T,P)) = 2; - -* Initialize ceiling costs - FLO_COST(R,DATAYEAR,P,C('_MSVIOL_'),ANNUAL,CUR)$TRACKP(R,P) $= NCAP_COST(R,DATAYEAR,P,CUR); - FLO_DELIV(R,DATAYEAR,P,C('_MSVIOL_'),ANNUAL,CUR)$TRACKP(R,P) $= NCAP_FOM(R,DATAYEAR,P,CUR); - OPTION CLEAR=TRACKP,CLEAR=TRACKPC,CLEAR=PRC_YMAX,CLEAR=RVP; diff --git a/source/ppm_ext.mlf b/source/ppm_ext.mlf deleted file mode 100644 index adb0365..0000000 --- a/source/ppm_ext.mlf +++ /dev/null @@ -1,92 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* ppm_ext.MLF oversees extended preprocessing activities for MLF -*============================================================================* - OPTION TM_DM < DEM, CLEAR=TM_DMC; - LOOP(MI_DMAS(R,COM,C),TM_DM(R,C)=NO); -* Marginal costs of demands - TM_DMC(RTC(R,T,C))$DEM(R,C) = SUM((COM_TS(R,C,S),RDCUR(R,CUR)),COM_BPRICE(RTC,S,CUR)*COM_FR(RTC,S)); - TM_DMC(R,T,C)$(TM_DMC(R,T,C)=0) = 0; - TM_AMP(R,T) = SOL_ACFR(R,'COST',T)*SUM(DEM(R,C),TM_DMC(R,T,C)*COM_PROJ(R,T,C))+1-1; - TM_AMP(MR,T)$((M(T)>MIYR_V1+9)$PP(T)) = 0; -$ BATINCLUDE filparam TM_DMC 'R,' C ",'','','','',''" DATAYEAR T -* Demand levels audit - TM_DEM(MR(R),T,C)$((COM_PROJ(R,T,C)>0)$DEM(R,C)) = COM_PROJ(R,T,C); - LOOP(PP(T),TM_DM(DEM(R,C))$(TM_DMC(R,T,C)=0)=NO; TM_DM(DEM(R,C))$(TM_DEM(R,T,C)=0)=NO); -* remove elasticity steps from demands, keeping aggregates elastic - RCJ(TM_DM(MR,C),J,BD)=NO; - COM_ELAST(MR(R),PP,C,ANNUAL,BDNEQ)$TM_DM(R,C) $= RD_AGG(R,C); - RHS_COMBAL(RTCS_VARC(R,T,C,S))$((NOT TM_DM(R,C)$PP(T))$TM_STEP(R,C,'N')) $= RCS_COMBAL(R,T,C,S,'FX'); -*----------------------------------------------------------------------------- -* Aggregate demand, expenditures and price - OPTION CLEAR=DM; DM('ACT')=YES; - TM_ANNC(MR(R),T) = SUM(DEM(R,C),TM_DMC(R,T,C)*TM_DEM(R,T,C)); - TM_DEM(MR(R),T,DM) = SUM(DEM(R,C),TM_DEM(R,T,C)); - TM_DMC(MR(R),T,DM) = TM_ANNC(R,T)/TM_DEM(R,T,DM); - LOOP(TB(TT(T-1)),TM_DMC(R,TT,DM) = MAX(TM_DMC(R,TT,DM),TM_DMC(R,T,DM)*0.7)); -* Annual costs and net taxes for MACRO - TM_ANNC(MR(R),T) = SOL_ACFR(R,'COST',T)*TM_ANNC(R,T); - TM_ANNC(R,T) $= TM_AMP(R,T); - TM_TAXREV(MR(R),T) = SOL_ACFR(R,'TAX',T)*TM_ANNC(R,T); -*----------------------------------------------------------------------------- -* Quadratic supply function - TM_ANNC(R,T) = TM_ANNC(R,T) * TM_SCALE_CST; - LOOP(TB, TM_EC0(R) = TM_ANNC(R,TB); TM_DDATPREF(R,DM) = TM_DMC(R,TB,DM)); - TM_QSFB(R,T,DM)$TM_DEM(R,T,DM) = 0.5*TM_DMC(R,T,DM)*TM_SCALE_CST/TM_DEM(R,T,DM); - TM_QSFA(R,T) = TM_ANNC(R,T)- SUM(DM, TM_QSFB(R,T,DM)*TM_DEM(R,T,DM)**2); -*----------------------------------------------------------------------------- -* Process macro parameters - TM_DEPR(R)$(NOT TM_DEPR(R)) = TM_DEFVAL('DEPR'); - TM_ESUB(R)$(NOT TM_ESUB(R)) = TM_DEFVAL('ESUB'); - TM_DESUB(R)$(NOT TM_DESUB(R)) = TM_ESUB(R); - TM_KGDP(R)$(NOT TM_KGDP(R)) = TM_DEFVAL('KGDP'); - TM_KPVS(R)$(NOT TM_KPVS(R)) = TM_DEFVAL('KPVS'); - TM_DMTOL(R)$(NOT TM_DMTOL(R)) = TM_DEFVAL('DMTOL'); - TM_IVETOL(R)$(NOT TM_IVETOL(R))= TM_DEFVAL('IVETOL'); -* Calculate cost amplifier - TM_AMP(MR,T) = MAX(0,SMAX(PP(TT)$(ORD(TT)>ORD(T)),TM_ANNC(MR,TT)/(TM_GDPGOAL(MR,TT)/TM_GDPGOAL(MR,T))*POWER(TM_DEFVAL('ESC'),YEARVAL(T)-YEARVAL(TT)))-TM_ANNC(MR,T)); - -*============================================================================* -* Initialize the economic parameters -*============================================================================* - TM_DDF(MR,T,DM) = EPS; - TM_AEEIV(MR,T,DM) = EPS; - TM_ASRV(R) = 1 - TM_DEPR(R) / 100; - TM_GROWV(MR,T) = TM_GR(MR,T); - TM_DFACTCURR(R,XTP) = 1 - (TM_KPVS(R) / TM_KGDP(R) - TM_DEPR(R)/100 - TM_GROWV(R,XTP)/100); - TM_RHO(R) = 1 - 1 / TM_ESUB(R); - TM_TSRV(R,T) = TM_ASRV(R) ** NYPER(T); - - TM_K0(R) = TM_KGDP(R) * TM_GDP0(R); - TM_IV0(R) = TM_K0(R) * (TM_DEPR(R) + SUM(TB,TM_GROWV(R,TB))) / 100; - TM_C0(R) = TM_GDP0(R) - TM_IV0(R); - TM_Y0(R) = TM_GDP0(R) + TM_EC0(R) + SUM(TB,TM_AMP(R,TB)); - -*============================================================================* -* Calculate intermediate values -*============================================================================* - TM_AEEIFAC(MR,T,DM) = 1; - TM_DFACT(MR,TB) = 1; - TM_L(MR,TB) = 1; - - LOOP(PP(T+1), - TM_DFACT(R,PP) = TM_DFACT(R,T) * TM_DFACTCURR(R,T) ** NYPER(T); - TM_L(R,PP) = TM_L(R,T) * (1 + TM_GROWV(R,T) / 100) ** NYPER(T); - ); - -* Arbitrary multiplier on utility in last time period - TM_DFACT(MR(R),TLAST)$(TM_ARBM > 1) = TM_DFACT(R,TLAST) * - (1-MIN(.999,TM_DFACTCURR(R,TLAST))**(NYPER(TLAST)*TM_ARBM)) / - (1-MIN(.999,TM_DFACTCURR(R,TLAST))**(NYPER(TLAST) * 1 )); -* Weights for periods - Z=MAX(1,SMAX(T,D(T))); TM_PWT(T) = D(T)/Z; - - TM_D0(MR(R),DM) = SUM(TB,TM_DEM(R,TB,DM))*TM_SCALE_NRG; - TM_B(MR(R),DM) = (TM_D0(R,DM) / TM_Y0(R)) ** (1 - TM_RHO(R)); - TM_B(MR(R),DM) = TM_SCALE_CST / TM_SCALE_NRG * TM_DDATPREF(R,DM) * TM_B(R,DM); - - TM_AKL(MR(R)) = TM_Y0(R) ** TM_RHO(R) - SUM(DM, TM_B(R,DM) * (TM_D0(R,DM) ** TM_RHO(R))); - TM_AKL(MR(R)) = TM_AKL(R) / (TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R))); diff --git a/source/ppm_ext.vda b/source/ppm_ext.vda deleted file mode 100644 index 2de548b..0000000 --- a/source/ppm_ext.vda +++ /dev/null @@ -1,161 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PPM_EXT.xtd oversees extended preprocessor activities -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Questions/Comments: -*----------------------------------------------------------------------------- - DISPLAY 'VEDA PPM_EXT Invoked'; -$IF DEFINED GR_VARGEN $BATINCLUDE resloadc.vda COEF - OPTION RP_UPLRP_GRP(RP,%PGPRIM%)) $= RP_STL(RP,TSL,'N'); - OPTION CLEAR=TRACKP,CLEAR=RP_GRP,CLEAR=TRACKPG,CLEAR=RTPS_BD,CLEAR=RVPS_LIM; -*----------------------------------------------------------------------------- -* Automatic generation of NCAP_AFC for ECT CHP - RVP(RTP(R,V,P))$((NOT RPS_CAFLAC(R,P,'ANNUAL','UP'))$(NCAP_CHPR(RTP,'UP')*NCAP_AFA(RTP,'UP')>0)$CHP(R,P))=YES; - RVP(RTP)$(NCAP_CEH(RTP)<1.5) = NO; -* The maximum of the technical AF for ELC, corrected with ACTFLO: - VDA_CEH(RVP(R,V,P)) = MAX(0,SMAX((PRC_TS(R,P,S),CHP_ELC(R,P,C)),NCAP_AF(RVP,S,'UP')*PRC_ACTFLO(RVP,C))); - RVP(RTP)$(VDA_CEH(RTP)<=0) = NO; - RPS_CAFLAC(R,P,ANNUAL,'UP') $= SUM(RVP(R,V,P)$VDA_CEH(RVP),1); -* AFAC for heat = (heat share)/(1/AFA-(elec share)/AF): - NCAP_AFCS(RVP(R,V,P),C,ANNUAL)$RPC_PG(R,P,C) = - (1/(1+1/NCAP_CHPR(RVP,'UP'))) / NCAP_AFA(RVP,'UP') / PRC_ACTFLO(RVP,C) / - (1/NCAP_AFA(RVP,'UP')-(1-1/(1+1/NCAP_CHPR(RVP,'UP')))/VDA_CEH(RVP)); - NCAP_AFCS(RVP(R,V,P),C,ANNUAL)$CHP_ELC(R,P,C) = VDA_CEH(RVP) / NCAP_AFA(RVP,'UP') / PRC_ACTFLO(RVP,C); - OPTION CLEAR=RVP,VDA_CEH 1), - F = NCAP_PASTY(R,LL,P); MY_F = NCAP_PASTI(R,LL,P) / F; -* for each year within spread build running sum of distributed PASTIs - FOR(Z = F-1 DOWNTO 0, PASTSUM(R,ALLYEAR(LL-Z),P) = PASTSUM(R,ALLYEAR,P) + MY_F); -* since spread this guy, clear original value - NCAP_PASTI(R,LL,P) = 0); -* add any spread past investments to any provided originally (and not spread) - NCAP_PASTI(R,LL,P)$PASTSUM(R,LL,P) = NCAP_PASTI(R,LL,P) + PASTSUM(R,LL,P); -* extend the list of past years - OPTION PASTYEAR < NCAP_PASTI; - INT_DEFAULT('PASTI')$PYR('0')=1; PYR('0')=NO; - OPTION CLEAR=PRC_CAP, CLEAR=PASTSUM; -*----------------------------------------------------------------------------- -* determination of YEAR subsets and period B/E/D -*----------------------------------------------------------------------------- - -* 98/02/23 middle year of period M(T) from *.dd to ppmain.mod -* [UR]: duration of period moved from *.dd to ppmain.mod - D(MILESTONYR)=E(MILESTONYR)-B(MILESTONYR)+1; - M(MILESTONYR)=FLOOR(B(MILESTONYR)+(D(MILESTONYR)-1)/2); -$IFI %OBJ%==MOD M(T) = 0; - IF(ALTOBJ=1,ALTOBJ=1$SUM(T,M(T) NE YEARVAL(T))); - -* establish 1st/last run year - MIYR_1(MILESTONYR)$(ORD(MILESTONYR) = 1) = YES; - IF(ALTOBJ, -* If alternate objective, set B and E, D and M: - E(T(TT-1)) = FLOOR((YEARVAL(T)+YEARVAL(TT))/2); B(T(TT+1)) = E(TT)+1; - B(MIYR_1(T))$(ABS(B(T)-(YEARVAL(T)-5)) GT 5) = YEARVAL(T); - E(T)$((ABS(E(T)-(YEARVAL(T)+15)) GT 15)$(ORD(T)=CARD(T))) = 2*YEARVAL(T)-B(T)+1-1$MOD(YEARVAL(T)-B(T)+1,5); - D(T)=E(T)-B(T)+1; M(T) = YEARVAL(T)); -*V0.5c 980904 - set 1st value to B not milestone itself - MIYR_V1 = SMIN(MIYR_1, B(MIYR_1)); - MIYR_VL = SMAX(MILESTONYR$(ORD(MILESTONYR) = CARD(MILESTONYR)), E(MILESTONYR)); -$IFI '%OBLONG%'==YES IF(MIYR_V1+SUM(T,E(T)+1-B(T))-MIYR_VL NE 1,ABORT "Inconsistent periods - cannot use OBLONG."); - LOOP(MIYR_1(LL),PASTYEAR(LL-(YEARVAL(LL)-MIYR_V1+1)) = YES); -* Set LEADs and LAGs for periods - LEAD(TT(T++1)) = MAX(M(TT)-M(T),M(TT)-B(TT)+1); - LAGT(TT(T--1)) = MAX(M(T)-M(TT),E(TT)-M(TT)+1); - IF(ALTOBJ,IPD(T) = LEAD(T)+MIN(E(T)-M(T),LEAD(T)-1)$MIYR_1(T); - ELSE IPD(T) = D(T)); FPD(T) = D(T); -* Initialize MINYR already here (was in COEF_OBJ.mod) - SCALAR MINYR; - MINYR = MIN(MIYR_V1-1,SMIN(T,M(T)-IPD(T))+1); - PYR_V1 = MIN(SMIN(PASTYEAR,YEARVAL(PASTYEAR)),MINYR); -* Define MIYR_L - LOOP(MIYR_1(ALLYEAR), Z=MIYR_VL-YEARVAL(ALLYEAR); MIYR_L(ALLYEAR+Z) = YES); - -* establish the beginning/end/delta for each MILESTONYR -* introduce PASTMILE (PASTYEAR that are not MILESTONYR) -* set the past years to self - PASTMILE(PASTYEAR)$((YEARVAL(PASTYEAR) LE MIYR_VL)$(NOT T(PASTYEAR))) = YES; - M(PASTMILE) = YEARVAL(PASTMILE); - B(PASTMILE) = M(PASTMILE); - E(PASTMILE) = M(PASTMILE); - D(PASTMILE) = 1; - -*----------------------------------------------------------------------------- -* set EOHYEARS contains all years until MIYR_VL - EOHYEARS(ALLYEAR)$((YEARVAL(ALLYEAR) >= MINYR) * (YEARVAL(ALLYEAR) <= MIYR_VL)) = YES; -* create list of all years in each period - PERIODYR(T,EOHYEARS)$((YEARVAL(EOHYEARS) >= B(T)) * (YEARVAL(EOHYEARS) <= E(T))) = YES; - -* Inter/Extrapolate G_OFFTHD if specified -$IF DEFINED G_OFFTHD $BATINCLUDE filparam G_OFFTHD '' '' ",'','','','','',''" YEAR T '' '' 5 - G_OFFTHD('0') = 0; - -*----------------------------------------------------------------------------- -* complete timeslice declarations -*----------------------------------------------------------------------------- -* Include preprocessing of timeslice attributes -$ INCLUDE timslice.mod - -*----------------------------------------------------------------------------- -* Migrate PASTIs defined on Milestonyr if requested - IF(INT_DEFAULT('PASTI'), LOOP(PYR(T(LL))$(M(T)>B(T)), VNT(LL-1,T)=YES); - LOOP(VNT(LL,T), B(LL)=M(T)-1; E(LL)=M(T); M(LL)=B(LL); D(LL)=2; PASTYEAR(T)=NO; - PASTSUM(R,T,P)$NCAP_PASTI(R,T,P) = NCAP_PASTI(R,LL,P)+NCAP_PASTI(R,T,P)+1-1; - COEF_RTP(R,LL,P)$PASTSUM(R,T,P) = NCAP_PASTI(R,T,P) / PASTSUM(R,T,P); - NCAP_PASTI(R,LL,P)$=PASTSUM(R,T,P); NCAP_PASTI(R,T,P)=0; OPTION CLEAR=PASTSUM; - ); - VNT(PASTMILE,T)$PERIODYR(T,PASTMILE)=YES; - OPTION PHYR<=VNT; PYR(PHYR)=YES; PASTMILE(PHYR)=YES); - -*----------------------------------------------------------------------------- -* initialize start/end year for new investments -*V0.5c 980904 - use OFF instead of START/END -*----------------------------------------------------------------------------- - PUTGRP = 0; -* Convert START to NOFF - LOOP(LASTLL(LL)$CARD(NCAP_START), Z=CARD(LL)+%BOTIME%; - PRC_NOFF(RP,'BOH',EOHYEAR)$NCAP_START(RP) = NO; - PRC_NOFF(RP,'BOH',LL+MIN(-1,NCAP_START(RP)-Z))$NCAP_START(RP) = YES); -* Construct year sets for the active model horizon - OPTION CLEAR=PRC_YMAX, CLEAR=UNCD1; - UNCD1('BOH') = YES; UNCD1(YEAR)$(YEARVAL(YEAR) LE MIYR_V1) = YES; - PRC_YMAX(RP(R,P)) = MAX(0,SMAX(PRC_NOFF(R,P,BOHYEAR(UNCD1),EOHYEAR),ORD(EOHYEAR)+%BOTIME%-2)); -* Set RTP_OFF for delayed processes - TRACKP(RP) $= PRC_YMAX(RP); - RTP_OFF(R,T,P)$((YEARVAL(T) LE PRC_YMAX(R,P))$TRACKP(R,P)) = ((PRC_YMAX(R,P)-B(T)+1)/D(T) GE G_OFFTHD(T)); - PRC_YMAX(TRACKP(R,P)) = SMAX(RTP_OFF(R,T,P),E(T)); -* Check NCAP_PASTI - LOOP(TRACKP(R,P)$SUM(PYR$NCAP_PASTI(R,PYR,P),1), - IF(PRC_YMAX(R,P) GT 0, -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Delayed Process but PASTInvestment' - PUT QLOG ' WARNING - Delay is ignored: R=',%RL%,' P=',P.TL ; - PRC_YMAX(R,P) = 0)); - OPTION CLEAR=TRACKP; -* Set the RTP_OFF for all remaining PRC_NOFF ranges - UNCD1(BOHYEAR) = NOT UNCD1(BOHYEAR); - LOOP(PRC_NOFF(RP(R,P),BOHYEAR(UNCD1),EOHYEAR),TRACKP(R,P) = YES); - LOOP(TRACKP(R,P), -$ BATINCLUDE pp_off.%1 PRC_NOFF P "" "RTP_OFF(R,T,P)$(" YES - ); - RTP(R,T,P)$RP(R,P) = YES$(YEARVAL(T) GT PRC_YMAX(R,P)); - RTP(R,PYR,P)$(RP(R,P)$(NCAP_PASTI(R,PYR,P)>0)$NCAP_PASTI(R,PYR,P)) = YES; - RVP(RTP(R,T,P)) = YES; - OPTION CLEAR=TRACKP; - -*----------------------------------------------- -* interpolation/extrapolation -*----------------------------------------------- -* Call interpolation subsystem -$ INCLUDE preppm.mod -$ IFI %INTEXT_ONLY% == YES $EXIT -*----------------------------------------------- - -* initialize timestep control - SET SUBT(T) / SET.T /; - RT_PP(R,T) = YES; - -* maximum NCAP_ILED+NCAP_TLIFE+NCAP_DLAG+NCAP_DLIFE+NCAP_DELIF - DUR_MAX=G_TLIFE; - LOOP(RVP(R,T,P)$((NCAP_ILED(RVP)+NCAP_TLIFE(RVP)+NCAP_DLAG(RVP)+NCAP_DLIFE(RVP)+NCAP_DELIF(RVP)) GT DUR_MAX), - DUR_MAX=(NCAP_ILED(RVP)+NCAP_TLIFE(RVP)+NCAP_DLAG(RVP)+NCAP_DLIFE(RVP)+NCAP_DELIF(RVP)); - ); - -* establish each year in OBJ -* years before 1st period - EOHYEARS(PYR)$(YEARVAL(PYR)= MINYR) * (YEARVAL(ALLYEAR) <= (MIYR_VL+DUR_MAX))) = YES; - -* LATECOSTS - PERIODYR(T,EACHYEAR)$((E(T)=MIYR_VL)*(YEARVAL(EACHYEAR) >= MIYR_VL)) = YES; - -*----------------------------------------------------------------------------- -* establish rest of primary looping control sets indicating what region/process/commodities -*----------------------------------------------------------------------------- -* expand individual commodities in own CG - COM_GMAP(RC(R,C),C) = YES; - -* UR 02/22/99 PRC_CG is now internally generated - PRC_CG(RPC) = YES; - PRC_CG(RP_PG) = YES; - -* Add aggregate commodities into RC: - OPTION MI_DMAS<=COM_AGG,FIN1),1)=YES; - RP_PGTYPE(RP(R,P),COM_TYPE)$SUM(RPC_PG(R,P,C)$COM_TMAP(R,COM_TYPE,C),1) = YES; - RP_AIRE(RP_IRE(RP),IE)$SUM(RPC_IRE(RPC_PG(RP,C),IE),1) = YES; -* input/output normalized process - RP_INOUT(RP,IO)$SUM(TOP(RPC_PG(RP,C),IO),1) = YES; -* determine shadow primary if not provided - for regular processes only (RP_FLO) - TRACKP(RP_FLO(RP))$(NOT SUM(PRC_SPG(RP,COM_GRP),1)) = YES; - LOOP((RP_PGTYPE(RP_FLO(R,P),CG),IO)$(NOT RP_INOUT(R,P,IO)), - IF(TRACKP(R,P), -* set the SPG to the same type as the PG if commodities on the other side with that COM_TYPE - IF(SUM(TOP(R,P,C,IO)$COM_GMAP(R,CG,C),1),PRC_SPG(R,P,CG) = YES; - ELSE -* did not find any commodities with the same type as the PG, so assume energy -* assume material if PRC is material conversion and PGTYPE is DEM - IF((SUM(RPC(R,P,C)$COM_TMAP(R,'MAT',C),1)$SUM(PRC_MAP(R,MATPRC,P),1))$RP_PGTYPE(R,P,'DEM'), - PRC_SPG(R,P,'MAT') = YES; - ELSE Z=1; LOOP(PG_SMAP(CG,J,COM_TYPE)$Z, - IF(SUM(TOP(R,P,C,IO)$COM_TMAP(R,COM_TYPE,C),1), Z=0; PRC_SPG(R,P,COM_TYPE) = YES))); - ); - ); - ); -* Add commodities in SPG into RPC_SPG - LOOP((PRC_SPG(R,P,CG),IO)$(NOT RP_INOUT(R,P,IO)),RPC_SPG(R,P,C)$(TOP(R,P,C,IO)$COM_GMAP(R,CG,C)) = YES); - PRC_CG(PRC_SPG) = YES; - OPTION CLEAR=TRACKP; - -*----------------------------------------------------------------------------- -* set level and timeslices for each commodity -* - if individual TS provided and no TSL then use TSs to set TSL -* else set the TS from TSL if none provided -*----------------------------------------------------------------------------- -* remove invalid levels - OPTION CLEAR=RXX; RXX(R,TSL,R)$(NOT SUM(RJLVL(J,R,TSL),1))=YES; F=CARD(COM_TSL); Z=CARD(PRC_TSL); - COM_TSL(R,C,TSL-1)$RXX(R,TSL,R)$=COM_TSL(R,C,TSL); F=CARD(COM_TSL)-F; COM_TSL(R,C,TSL)$(RXX(R,TSL,R)$F)=NO; - PRC_TSL(R,P,TSL-1)$RXX(R,TSL,R)$=PRC_TSL(R,P,TSL); Z=CARD(PRC_TSL)-Z; PRC_TSL(R,P,TSL)$(RXX(R,TSL,R)$Z)=NO; - IF(F+Z, PUTGRP=0; -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Commodities/processes defined at non-existing TSLVL' - PUT QLOG ' WARNING - Number of COM/PRC resetted to coarser level: ',F:0:0 '/' Z:0:0/); -* check for individual TS provided - TRACKC(RC) $= SUM(COM_TS(RC,S),1); - LOOP(COM_TS(RC(R,C),S)$(NOT SUM(COM_TSL(RC,TSL),1)),COM_TSL(RC,TSL)$TS_GROUP(R,TSL,S) = YES); -* check for excess or missing COM_TS - LOOP(COM_TSL(TRACKC(R,C),TSLVL)$(SUM(TS_GROUP(R,TSLVL,S),1) NE SUM(COM_TS(R,C,S),1)), - COM_TS(R,C,S)$(NOT TS_GROUP(R,TSLVL,S)) = NO; - RCS(R,C,S)$((NOT SUM(COM_TS(R,C,TS)$RS_TREE(R,S,TS),1))$G_YRFR(R,S))=YES); - COM_TSL(RC,'ANNUAL')$(NOT SUM(COM_TSL(RC,TSL),1)) = YES; -*GG/UR make sure to init all S - LOOP(COM_TSL(RC(R,C),TSL)$(NOT TRACKC(RC)),COM_TS(RC,S)$TS_GROUP(R,TSL,S) = YES); -* identify all TS at/above the COM_TSL - RCS_COMTS(RC(R,C),S)$SUM(TS_MAP(R,S,TS)$COM_TS(RC,TS),1) = YES; - -* determine the spread of periods/slices for the commodities - OPTION CLEAR=TRACKC; - LOOP(COM_OFF(RC,BOHYEAR,EOHYEAR),TRACKC(RC) = YES); - RTC(R,T,C)$RC(R,C) = YES; - LOOP(TRACKC(R,C), -* set the OFF range -$ BATINCLUDE pp_off.%1 COM_OFF C "" "RTC(R,T,C)$(" NO -* create a variable for VAR_COM for desired timeslices unless period turned off - COM_BNDPRD(R,T,C,S,'FX')$(COM_TS(R,C,S)$(NOT RTC(R,T,C))) = EPS; - ); - RTCS_VARC(RTC(R,T,C),S)$COM_TS(R,C,S) = YES; - OPTION CLEAR=TRACKC; - -* Peaking -* a) Time-slices specified on COM_PKTS must be on COM_TSLevel -* b) if no COM_PKTS is specified but COM_PEAK given, for all COM_TS -* COM_PKTS will be set and hence peaking equations generated -*GG*PK 1st check if COM_PKTS has been specified at different level, then set if not provided at all -*UR*PK 1) com_peak is set if at least one com_pkts exists -* 2) if com_peak and com_pkts above com_ts => com_pkts is inherited -* if at least one com_pkts below com_ts => com_pkts is aggregated -* 3) if com_peak but no com_pkts => com_pkts for all com_ts - -* set com_peak when com_pkts - COM_PEAK(R,CG)$SUM(COM_PKTS(R,CG,S),1) = 1; - TRACKC(COM_PEAK(R,C))$(NOT SUM(COM_TSL(R,C,TSL),1)) = YES; - LOOP(ANNUAL(TS(TSL)),COM_TSL(TRACKC(R,C),TSL+SMAX(COM_PKTS(R,C,S),STOAL(R,S)))=YES); - OPTION CLEAR=TRACKC; -* inherit to the COM_TS level if necessary - COM_PKTS(COM_PEAK(R,C),S)$SUM(COM_PKTS(R,C,TS)$RS_TREE(R,S,TS),1) = SUM(COM_TSL(R,C,TSL),ORD(TSL)=STOAL(R,S)+1); -* if nothing then set for all - LOOP(COM_PEAK(R,CG)$(NOT SUM(COM_PKTS(R,CG,S),1)), - Z = SMAX(COM_TSL(R,C,TSL)$COM_GMAP(R,CG,C),TSLVLNUM(TSL)); - LOOP(TSL$(TSLVLNUM(TSL)=Z),COM_PKTS(R,CG,S)$TS_GROUP(R,TSL,S) = YES) - ); -*----------------------------------------------------------------------------- -* set level and timeslices for each process -* - if individual TS provided and no TSL then use TSs to set TSL -* else set the TS from TSL if none provided -*----------------------------------------------------------------------------- - LOOP(PRC_TS(RP(R,P),S)$(NOT SUM(PRC_TSL(RP,TSL),1)),PRC_TSL(RP,TSL)$TS_GROUP(R,TSL,S) = YES); - PRC_TSL(RP,'ANNUAL')$(NOT SUM(PRC_TSL(RP,TSL),1)) = YES; -*GG/UR make sure to init all S - TRACKP(RP)$(NOT SUM(PRC_TS(RP,S),1)) = YES; - LOOP(TSL,PRC_TS(TRACKP(R,P),S)$(TS_GROUP(R,TSL,S)$PRC_TSL(R,P,TSL)) = YES); - OPTION CLEAR=TRACKP; - -* determine seasons for which a process handling seasonal commodities may need to -* be tracked, and identify all the TS above this level -* - RPS_PRCTS corresponds to all levels at/above PRC_TS -* - RPS_S2 corresponds to non-PG flo variables -* - RPS_S1 corresponds to level of EQ_PTRANS - -* Convert ANNUAL level timeslice storage - RP_SGS(RP_FLO(R,P))$(PRC_TSL(R,P,'ANNUAL')$(PRC_MAP(R,'STS',P)+PRC_MAP(R,'NST',P))) = YES; - RP_SGS(RP_FLO(R,P))$=PRC_MAP(R,'SGS',P); - PRC_MAP(R,'STG',P)$((NOT SUM(TOP(RPC_PG(R,P,C),'IN'),1))$RP_SGS(R,P)) = NO; -* All NST operating below ANNUAL level but producing ANNUAL level commodity will be STG: - PRC_MAP(R,'STG',P)$((NOT PRC_TSL(R,P,'ANNUAL'))$PRC_MAP(R,'NST',P)) = YES; - RP_STG(RP(R,P)) $= PRC_MAP(R,'STG',P); - -* identify shadow group timeslice level -* For LOAD processes, take the maximum TSLVL - LOOP((RTC(R,T,C),S)$COM_FR(R,T,C,S),TRACKC(R,C) = YES); - LOOP(COM_TSL(TRACKC(R,C),'ANNUAL'), TRACKP(RP_FLO(R,P))$RPC_PG(R,P,C) = YES); - PRC_YMAX(RP(R,P)) = SMAX((RPC_SPG(R,P,C),COM_TSL(R,C,TSL)),TSLVLNUM(TSL)); - PRC_YMAX(TRACKP(R,P)) = SMAX((RPC(R,P,C),COM_TSL(R,C,TSL)),TSLVLNUM(TSL)); - PRC_YMAX(RP_STG) = 0; - PRC_YMAX(RP) = MAX(PRC_YMAX(RP),SMAX(PRC_TSL(RP,TSL),TSLVLNUM(TSL))); -* First, get levels for each TS - LOOP(R, OPTION CLEAR=TS_ARRAY; - TS_ARRAY(S) $= RS_TSLVL(R,S); - Z = MAX(1,SMAX(RLUP(R,TSLVL,TSL),TSLVLNUM(TSL))); -* identify all S at shadow level - RPS_S2(RP_SGS(R,P),S)$(TS_ARRAY(S) = PRC_YMAX(R,P)) = YES; - PRC_SGL(RP_FLO(RP)) = MIN(PRC_YMAX(RP)-1$RP_STG(RP),Z)-1; - PRC_YMAX(RP_SGS(R,P)) = PRC_SGL(R,P)+1; -* save the finer of the PRC_TS and the finest commodity in the shadow primary - RPS_S1(RP(R,P),S)$(TS_ARRAY(S) = PRC_YMAX(R,P)) = YES; - RPS_S2(RPS_S1(R,P,S))$(NOT RP_SGS(R,P)) = YES; -* identify all TS at/above the PRC_TSL - ); - LOOP(TS_GROUP(R,TSL,S), RPS_PRCTS(R,P,TS)$(TS_MAP(R,TS,S)*PRC_TS(R,P,S)) = YES); - -*----------------------------------------------------------------------------- -* Establish the main control set for generation or not of a VAR_FLO/IRE for -* each commodity involved in a process, and for viable commodity/process timeslices -* Take into consideration whether the commodity is turned off for some timeslice -* Note: RTPCS_VAR further adjusted at the end of PPMAIN (after optional REDUCE) -*----------------------------------------------------------------------------- -* Special handling for storage, esp. night storage - RPC_STG(RPC(RP_STG(R,P),C))$(PRC_STGTSS(RPC)+PRC_STGIPS(RPC)+(RPC_PG(RPC)+RPC_SPG(RPC))$PRC_MAP(R,'NST',P)) = YES; - TRACKPC(RPC_STG(R,P,C))$((TOP(R,P,C,'OUT')+PRC_NSTTS(R,P,'ANNUAL'))$COM_TS(R,C,'ANNUAL')$PRC_MAP(R,'NST',P)) = YES; - RPCS_VAR(RPC(RP_STG(R,P),C),S)$(PRC_TS(R,P,S)$(NOT TRACKPC(RPC))+ANNUAL(S)$TRACKPC(RPC)) = YES; - PRC_NSTTS(RP_STG(R,P),ANNUAL)$(NOT SUM(TOP(TRACKPC(R,P,C),'IN'),1))=NO; OPTION PRC_ACTCAP_BND(RTP,'UP'))$CAP_BND(RTP,'UP')), -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 1 'Inconsistent CAP_BND(UP/LO/FX) defined for process capacity' - PUT ' WARNING - Lower bound set equal to upper bound, R.T.P= ',RTP.TE(RTP)); - -*----------------------------------------------------------------------------- -* turn off RTP/CPTYR if no new investment & installed capacity no longer available - LOOP(BDUPX(BD),RTP_OFF(RTP)$((NCAP_BND(RTP,BD)=0)$NCAP_BND(RTP,BD)) = YES); - NO_RVP(RTP_OFF(R,T,P)) = YES; - LOOP(T, NO_RVP(R,TT,P)$(RTP_CPTYR(R,T,TT,P)$(NOT RTP_OFF(R,T,P))) = NO); - LOOP(PYR(V), NO_RVP(R,T,P)$(RTP_CPTYR(R,V,T,P)$NCAP_PASTI(R,V,P)) = NO); - RTP(NO_RVP) = NO; - RTP_CPTYR(R,T,TT,P)$((NOT NCAP_PASTI(R,T,P))$RTP_OFF(R,T,P)) = NO; - OPTION CLEAR=RVP, CLEAR=NO_RVP; - -*----------------------------------------------------------------------------- -* initialize start/end year for a process & available years -*----------------------------------------------------------------------------- -*-- Speed up by first tracking RPs with PRC_AOFF - LOOP(PRC_AOFF(RP(R,P),BOHYEAR,EOHYEAR),TRACKP(R,P) = YES); - RTP_VARA(RTP(R,T,P))$(NOT TRACKP(R,P)) = YES; - LOOP(TRACKP(R,P), MY_FIL(T) = YES; -* set the OFF range -$ BATINCLUDE pp_off.%1 PRC_AOFF P "" "MY_FIL(T)$(" NO -* set the periods for which VAR_ACT is OK - RTP_VARA(RTP(R,MY_FIL(T),P)) = YES; - ); - OPTION CLEAR=TRACKP; - -*----------------------------------------------------------------------------- -* initialize start/end year for a process flows -*----------------------------------------------------------------------------- -* Initialize start/end year for process commodities - RTPC(RTP(R,T,P),C) $= RPC(R,P,C); - PUTGRP = 0; -*-- track all RPCs with PRC_FOFF: - LOOP(PRC_FOFF(R,P,C,TS,BOHYEAR,EOHYEAR),TRACKPC(R,P,C) = YES); - LOOP(RPCS_VAR(TRACKPC(R,P,C),S), MY_FIL(T) = NO; -* check for shut-off here or timeslice above -$ BATINCLUDE pp_off.%1 PRC_FOFF 'P,C,TS' '$TS_MAP(R,TS,S)' "MY_FIL(T)$(" YES -* QC check that shut-off not specified below the VAR level - RTPCS_OUT(RTP_VARA(R,MY_FIL(T),P),C,S) = YES; - ); - LOOP(PRC_FOFF(RPC(R,P,C),TS,BOHYEAR,EOHYEAR)$SUM(RPCS_VAR(R,P,C,S)$RS_BELOW(R,S,TS),1), -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Flow OFF TS level below VARiable TS level' - PUT QLOG ' WARNING - OFF is ignored: R=',%RL%,' P=',%PL%,' C=',%CL%,' S=',TS.TL ; - ); - OPTION CLEAR=TRACKPC; - -*----------------------------------------------------------------------------- -* Add leading milestones into RTP if/when simulated vintages -$IF DEFINED PRC_SIMV LOOP(T,NO_RVP(R,TT-1,P)$(RTP_CPTYR(R,TT,T,P)$PRC_SIMV(R,P))=YES); NO_RVP(RTP(R,T,P))=NO; RTP(NO_RVP)=YES; -*----------------------------------------------------------------------------- -* Remove commodity from PG if PRC_ACTFLO flagged non-interpolated, as bad - RPC_PG(R,P,C)$((NOT RP_PG(R,P,C))$(ROUND(PRC_ACTFLO(R,'0',P,C)<0))) = NO; -* Save original non-PG PRC_ACTFLO groups - RPC_PG(RPC_STG) = YES; - RP_STD(RP_FLO(RP))$(NOT RP_STG(RP)) = YES; - OPTION RPC_ACT <= PRC_ACTFLO; - RPC_ACT(R,P,C)$(RPC_PG(R,P,C)+(NOT RPC(R,P,C))+RP_STG(R,P)) = NO; - CHP(RP(R,P)) $= PRC_MAP(R,'CHP',P); - -*----------------------------------------------------------------------------- -* establishment PRC_CAPACT/ACTFLO from PRC_CAPUNT/ACTUNT/COM_UNIT & determine INOUT(r,p) -*----------------------------------------------------------------------------- - PRC_CAPACT(RP(R,P))$(NOT PRC_CAPACT(R,P)) = 1; -* Copy PRC_ACTFLO from PG to individual commodities in PG, allowing reserved word %PGPRIM% - PRC_ACTFLO(RTP(R,V,P),C)$((NOT PRC_ACTFLO(RTP,C))$RPC_PG(R,P,C)) $= SUM(RP_PG(R,P,CG),PRC_ACTFLO(R,V,P,CG)); - PRC_ACTFLO(RTP(R,V,P),C)$((NOT PRC_ACTFLO(RTP,C))$RPC_PG(R,P,C)) $= PRC_ACTFLO(RTP,%PGPRIM%); - PRC_ACTFLO(RTP(R,V,P),C)$((NOT PRC_ACTFLO(RTP,C))$RPC_PG(R,P,C)) = 1; -* RP_PGACT signifies that activity can be substituted for the primary flow - RP_PGACT(RP_FLO(R,P))$(SUM(RPC_PG(R,P,C),1) EQ 1) = YES; - RP_PGACT(RP_IRE(R,P))$(SUM(RPC_IRE(RPC_PG(R,P,C),IE),1) EQ 1) = YES; - -*----------------------------------------------------------------------------- -* Extensions after establishing RPCS_VAR and PRC_CAPACT but before levelising -$ BATINCLUDE main_ext.mod pp_prelv %EXTEND% -* Make various QA checks for FLO_SHAR -$ BATINCLUDE pp_qafs.mod mod - -*----------------------------------------------------------------------------- -* setup and apply (some) SHAPE/MULTI -*----------------------------------------------------------------------------- - SCALAR MAXLIFE; - MAXLIFE = SMAX(RTP,NCAP_TLIFE(RTP)); -* Convert indexes to demand elasticity shape curves to tuples - LOOP(SAMEAS(J,'1'),RTC_SHED(R,T,C,BD,J+MAX(0,COM_ELASTX(R,T,C,BD)-1))$COM_ELASTX(R,T,C,BD) = YES); - STARTOFF = CEIL(MAX(MAXLIFE,SMAX(RTC_SHED(R,T,C,BD,J),COM_VOC(R,T,C,BD))*100))+1; -* Call the SHAPE inter-/extrapolation routine -$ BATINCLUDE filshape 'STARTOFF' - SHAPE('1',AGE)$(ORD(AGE) LE STARTOFF) = 1.; - SHAPE(J,AGE)$((SHAPE(J,AGE) EQ 0)$SHAPE(J,AGE)) = 0; - -*GG* note that multi will take additional parameter NO/YES to do 2nd assignment or not -* Call the inter-/extrapolation routine for MULTI -$ BATINCLUDE filparam MULTI 'J,' '' ",'','','','',''" LL EOHYEARS 'NO$' '' - LOOP(J, Z=1; LOOP(LL$(MULTI(J,LL)*Z), Z=0; F=MIN(1,MULTI(J,LL))); - IF(NOT Z, MULTI(J,EOHYEARS)$(NOT MULTI(J,EOHYEARS)) = F)); - MULTI('1',EACHYEAR) = 1; - -*----------------------------------------------------------------------------- -* establish basic defaults for the non-TS attribute -*----------------------------------------------------------------------------- - -* economic life = technical life if not provided - NCAP_ELIFE(RTP)$(NOT NCAP_ELIFE(RTP)) = NCAP_TLIFE(RTP); -* commodity release always in next year if no time provided but release - NCAP_DLIFE(RTP(R,T,P))$((NOT NCAP_DLIFE(RTP))$SUM(RPC(R,P,C)$NCAP_OCOM(RTP,C),1)) = 1; - NCAP_DELIF(RTP(R,T,P))$(NOT NCAP_DELIF(RTP))$= NCAP_DLIFE(RTP); -* if investment requires commodity and has a leadtime, set commodity time = lead, if not provided - NCAP_CLED(RTP(R,T,P),C)$((NOT NCAP_CLED(RTP,C))$NCAP_ICOM(RTP,C)) = COEF_ILED(RTP); -* defaults for CHP plants - NCAP_BPME(RTP(R,V,P))$((NOT NCAP_BPME(RTP))$NCAP_CDME(RTP)$CHP(R,P)) = 1; - NCAP_CHPR(RTP(R,V,P),'UP')$((NOT SUM(LIM$NCAP_CHPR(RTP,LIM),1))$CHP(R,P)) = 1; -* set default storage efficiency if not provided - LOOP(RP_STG(R,P)$(NOT SUM(RTP(R,T,P)$STG_EFF(RTP),1)), STG_EFF(RTP(R,V,P)) = 1); - -*----------------------------------------------------------------------------- -* determination of capacity-ONLY related flows -*----------------------------------------------------------------------------- -* Initialize capflo indicators for UC_FLO - SET UC_CAPFLO(UC_N,SIDE,R,P,C); - UC_CAPFLO(UC_N,SIDE,RPC_NOFLO(R,P,C))$UC_ATTR(R,UC_N,SIDE,'FLO','CAPFLO') = YES; - RPC_NOFLO(RPC_PG) = NO; - RPCS_VAR(RPC_NOFLO(R,P,C),ANNUAL)$(NOT RPC(R,P,C)) = YES; - TRACKPC(RPC_NOFLO) = YES; -* identify those commodities involved ONLY with capacity by eliminating those with flows - LOOP(TRACKPC(R,P,C), - IF(RP_IRE(R,P), -* RPC_IRE implies IRE_FLOc so not only capacity related - Z = NOT SUM(RPC_IRE(R,P,C,IE),1); - Z$Z = NOT SUM((RTPC(R,T,P,COM),S,IE,IO)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO),RPC_IRE(R,P,COM,IE)); - ELSE - Z = NOT SUM(RTPC(R,T,P,C)$PRC_ACTFLO(R,T,P,C),1); -* check for the commodity within flo_func/sum/shar - Z$Z = NOT SUM((T,CG1,CG2,S)$FLO_FUNC(R,T,P,CG1,CG2,S),COM_GMAP(R,CG1,C)+COM_GMAP(R,CG2,C)); - Z$Z = NOT SUM((T,CG1,COM,CG2,S)$FLO_SUM(R,T,P,CG1,COM,CG2,S),COM_GMAP(R,COM,C)+COM_GMAP(R,CG2,C)); - Z$Z = NOT SUM((T,CG,S,BD)$FLO_SHAR(R,T,P,C,CG,S,BD),1); - ); - IF(NOT Z, RPC_NOFLO(R,P,C) = NO); - ); - OPTION CLEAR=TRACKPC; - -*----------------------------------------------------------------------------- -* do the basic initializations that are TS-based, including aggregate/inherit -*----------------------------------------------------------------------------- -* commodity related attributes -*----------------------------------------------------------------------------- -* infastructure efficiency -* set seasonal fraction for commodity if necessary, G_YRFR('ANNUAL') already = 1 -* difference between the average calculated demand and the actual shape of the peak -* commodity based costs, subsidies and taxes -* elastic demands base price, quantity, elasticity and steps - -$ BATINCLUDE pp_lvlfc.mod COM_IE C COM_TS '' ",'0','0','0','0'" ALL_TS T RTC(R,T,C) -$ BATINCLUDE pp_lvlfc.mod COM_FR C COM_TS '' ",'0','0','0','0'" ALL_TS T RTC(R,T,C) 1 -$ BATINCLUDE pp_lvlfc.mod COM_PKFLX C COM_TS '' ",'0','0','0','0'" ALL_TS T YES -$ BATINCLUDE pp_lvlfc.mod OBJ_COMNT C COM_TS ',COSTYPE,CUR' ",'0','0'" ALL_TS DATAYEAR RC(R,C) -$ BATINCLUDE pp_lvlfc.mod OBJ_COMPD C COM_TS ',COSTYPE,CUR' ",'0','0'" ALL_TS DATAYEAR RC(R,C) -$ BATINCLUDE pp_lvlfc.mod COM_ELAST C COM_TS ',BD' ",'0','0','0'" ALL_TS DATAYEAR RC(R,C) -$ BATINCLUDE pp_lvlfc.mod COM_BPRICE C COM_TS ',CUR' ",'0','0','0'" ALL_TS DATAYEAR RC(R,C) -$ BATINCLUDE pp_lvlfc.mod COM_BQTY C COM_TS '' ",'0','0','0','0','0'" ALL_TS '' RC(R,C) 1 - -* Defaults for infrastructure efficiency and seasonal fraction - OPTION RCS < COM_IE; - COM_IE(RTCS_VARC(R,T,C,S))$(NOT RCS(R,C,S)) = 1; -*GG* 010406 - sum up COM_FRs below on a seasonal level so RTCS_TSFR set below -* Get the timeslices where COM_FR has been given - COM_FR(R,LL,C,ANNUAL)=0; OPTION RCS0))/RS_FR(R,S,TS)-1; - COM_FR(RTC(R,T,C),RTS(S))$((NOT COM_FR(RTC,S))$RCS_COMTS(R,C,S)) = G_YRFR(R,S); - -*----------------------------------------------------------------------------- -* Elastic demands -*----------------------------------------------------------------------------- - OPTION DEM < COM_PROJ; -* Preprocess TIMES-Micro -$IF %TIMESED%==YES $BATINCLUDE pp_micro.mod PRE -* check sign of COM_ELAST and set RCJ after assigning default COM_STEPs - COM_ELAST(R,T,C,S,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD) = - -ABS(COM_ELAST(R,T,C,S,BD)-1+1)$SUM(RDCUR(R,CUR),COM_BPRICE(R,T,C,S,CUR)*COM_VOC(R,T,C,BD)>0); - OPTION RC_AGP < COM_ELAST; COM_STEP(RC_AGP(RC,BDNEQ))$(NOT COM_STEP(RC,BDNEQ)) = MAX(1,COM_STEP(RC,'FX')); - RCJ(RC,J,BD)$((ORD(J) <= COM_STEP(RC,BD))$RC_AGP(RC,BD)) = 1; OPTION CLEAR=RC_AGP; - -*----------------------------------------------------------------------------- -* process availability factor -* - apply MULTI (moved to coef_cpt) -* - move up to the appropriate level, if applicable -* - move down to the appropriate level, if applicable -* - set default, if necessary -*----------------------------------------------------------------------------- - -* leveling of availability; set at the PRC level by bring down 1st one from above, if not yet set - PUTGRP = 0; - RTPS_BD(RTP(R,V,P),S,BD)$PRC_TS(R,P,S) $= NCAP_AFS(RTP,S,BD)$(NOT NCAP_AF(RTP,S,BD)); -$ BATINCLUDE pp_lvlbr.%1 NCAP_AF '' PRC_TS ",'0','0'" 0 1 - NCAP_AF(RTPS_BD)$NCAP_AF(RTPS_BD) $= NCAP_AFS(RTPS_BD); - -* Mark those timeslices that have NCAP_AFs: - OPTION CLEAR=RXX,CLEAR=RTPS_BD; - RTPS_BD(R,LL--(ORD(LL)*(NCAP_AF(R,LL,P,S,BD) GT 0)),P,S,BDUPX(BD))$(V(LL)$NCAP_AF(R,LL,P,S,BD))=YES; - OPTION TRACKP < RTPS_BD; RXX(PRC_TS(TRACKP(R,P),S))$=SUM(RTPS_BD(R,LASTLL,P,S,BDUPX),1); -* Set default if no PRC_TS has NCAP_AFs : - NCAP_AF(RTP(R,V,P),S,'UP')$(PRC_TS(R,P,S)$(NOT TRACKP(R,P))) = 1.0; - RXX(PRC_TS(R,P,S)) = (NOT RXX(R,P,S))$TRACKP(R,P); - NCAP_AF(RTP(R,V,P),S,'UP')$(RXX(R,P,S)$RP_STG(R,P)) = EPS; RXX(RP_STG,S) = NO; - -* Make sure to get rid of any remaining PRC_TS for which no NCAP_AF - LOOP(PRC_TS(RXX(R,P,TS)),PRC_TS2(R,P,S)$TS_MAP(R,TS,S) = YES); - PRC_TS(PRC_TS2) = NO; - RPCS_VAR(RPCS_VAR(R,P,C,S))$PRC_TS2(R,P,S) = NO; - RTPCS_OUT(RTPC(R,T,P,C),S)$PRC_TS2(R,P,S) = YES; - OPTION CLEAR=PRC_TS2,CLEAR=TRACKP,CLEAR=RTPS_BD; - -*----------------------------------------------------------------------------- -* Fraction of capacity that can contribute to the peak -* -* 1) If NCAP_PKCNT below or ablve COM_TS is specified => aggregate & inherit to COM_TS -* -* 2) If no value given, -* a) If PRC_PKAF(r,p) is specified, NCAP_AF is used for NCAP_PKCNT, -* where FX has precedence over UP -* b) otherwise 1 -* -$ BATINCLUDE pp_lvlpk.mod 1.0 - -*----------------------------------------------------------------------------- -* flow related attributes -*----------------------------------------------------------------------------- -* costs, subsidy, taxes, & flow rates - -$ BATINCLUDE pp_lvlfc.mod FLO_COST 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N -$ BATINCLUDE pp_lvlfc.mod FLO_DELIV 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N -$ BATINCLUDE pp_lvlfc.mod FLO_SUB 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N -$ BATINCLUDE pp_lvlfc.mod FLO_TAX 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N -$ BATINCLUDE pp_lvlfc.mod FLO_PKCOI 'P,C' RPCS_VAR '' ",'0','0','0'" ALL_TS T RTP(R,T,P) -$ BATINCLUDE pp_lvlfc.mod ACT_FLO 'P' RPS_S1 '' ",'0','0','0'" ALL_TS V RTP(R,V,P) 0 ',C' 0 $STOA(S) - -*GG*PKCOI defaults to 1 - LOOP((RPC(R,P,C),COM_GMAP(COM_PEAK(R,CG),C))$(TOP(RPC,'IN')+RPC_IRE(RPC,'EXP')), - IF(NOT SUM((RTP(R,T,P),RPCS_VAR(RPC,TS))$FLO_PKCOI(RTP,C,TS),1),TRACKPC(RPC)=YES)); - TRACKPC(PRC_PKNO(R,P),C)=NO; - FLO_PKCOI(RTP(R,T,P),C,S)$(RPCS_VAR(R,P,C,S)$TRACKPC(R,P,C)) = 1.0 - OPTION CLEAR=TRACKPC; - -* derive the CHP flow control attributes from the input data -$ BATINCLUDE pp_chp.%1 %1 - -*----------------------------------------------------------------------------- -* the actual flow control attributes -*----------------------------------------------------------------------------- -* FLO_ attributes - -* handle FLO_FUNC aggregation/inheritance -$ BATINCLUDE pp_lvlff.mod - -* handle FLO_SUM aggregation/inheritance -$ BATINCLUDE pp_lvlfs.mod -* Add FLO_SUM translated from PRC_ACTFLO - IRE_FLOSUM(RTP(R,V,P),C,S,IE,COM,IO)$(RPC_PG(R,P,C)*RPC_IRE(R,P,C,IE)*RPCS_VAR(R,P,C,S)*TOP(R,P,COM,IO)) $= - SUM(RPC_ACT(RP_IRE(R,P),COM),PRC_ACTFLO(R,V,P,COM)*(1/PRC_ACTFLO(R,V,P,C))); - FLO_SUM(RTP(R,V,P),CG,C,COM,S)$(RP_PG(R,P,CG)*RPC_PG(R,P,C)*PRC_TS(R,P,S)) $= - SUM(RPC_ACT(RP_FLO(R,P),COM),PRC_ACTFLO(R,V,P,COM)*(1/PRC_ACTFLO(R,V,P,C))); - OPTION CLEAR=RPC_ACT; - -* handle FLO_SHAR aggregation/inheritance -$ BATINCLUDE pp_lvlbr.%1 FLO_SHAR ',C,CG' RPCS_VAR "" 1 0 C, -* preprocessing of FLO_MARK/PRC_MARK -$ BATINCLUDE eqflomrk.%1 - -*----------------------------------------------------------------------------- -* inter-regional exchange related attributes -*----------------------------------------------------------------------------- - PUTGRP = 0; -$ BATINCLUDE pp_lvlfc.mod IRE_PRICE 'P,C' RPCS_VAR ',ALL_REG,IE,CUR' '' ALL_TS DATAYEAR 'RPC_IRE(R,P,C,IE)' -$ BATINCLUDE pp_lvlfc.mod IRE_FLOSUM P PRC_TS ',IE,COM,IO' '' ALL_TS T 'RTP(R,T,P)' 0 ',C' -* this routine only handles IRE_FLO -$ BATINCLUDE pp_lvlif.mod %1 - -*----------------------------------------------------------------------------- -* Preprocess market-based trade -*----------------------------------------------------------------------------- -* Set endogenous trade indicators - IF(CARD(RXX) GT 0, OPTION CLEAR=RXX); - LOOP(TOP_IRE(R,C,REG,COM,P),RXX(R,C,P) = YES; RPC_IREIO(REG,P,COM,'IMP','IN') = YES); - RPC_IREIO(R,P,C,'EXP','IN')$RXX(R,C,P) = YES; - RPC_IREIO(RPC_IRE(R,P,C,IE),'OUT')$(NOT RPC_IREIO(R,P,C,IE,'IN')) = YES; - PRC_MAP(R,'DISTR',P)$PRC_MAP(R,'CORR',P) = YES; - IRE_DIST(RP_IRE(R,P))$PRC_MAP(R,'DISTR',P) = YES; - -* Define a marketplace whenever there are several import regions - LOOP(RXX(R,C,P)$(SUM(TOP_IRE(R,C,REG,COM,P),1) GT 1),RPC_MARKET(R,P,C,'EXP') = YES); -* Define a marketplace whenever there is an intermediate region between two other regions - RXX(R,C,P)$IRE_DIST(R,P) = NO; - LOOP(TOP_IRE(REG,COM,RXX(R,C,P))$(NOT SUM(COM1$TOP_IRE(R,C,REG,COM1,P),1)),RPC_MARKET(R,P,C,'EXP') = YES); - -* Ensure that over distribution all directly linked regions after first market are also markets - TRACKPC(IRE_DIST(R,P),C)$RPC_MARKET(R,P,C,'EXP') = YES; - WHILE(CARD(TRACKPC), OPTION CLEAR=RXX; - LOOP((TRACKPC(R,P,C),TOP_IRE(R,C,REG,COM,P),RPC_IRE(REG,P,COM1,'EXP')), - IF(NOT SUM(COM2$TOP_IRE(REG,COM1,R,COM2,P),1),RXX(REG,P,COM1)=YES)); - OPTION CLEAR=TRACKPC; TRACKPC(RXX(R,P,C))$(NOT RPC_MARKET(R,P,C,'EXP')) = YES; - RPC_MARKET(TRACKPC,'EXP') = YES); - - PUTGRP=0; -* Set the import commodities for marketplaces - LOOP(RPC_MARKET(R,P,C,IE)$(NOT SUM(TOP_IRE(R,C,R,COM,P),1)), -* If only one import and market commodity is involved for (R,P), choose the import: - Z=SUM(RPC_IRE(R,P,COM,'IMP'),1)+EPS; - IF(IRE_DIST(R,P),IF(Z GT 1, -$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Unsupported diverging trade topology' - PUT QLOG ' WARNING - Too complex topology: R=',%RL%,' P=',P.TL;) - ELSEIF Z=1, Z=SUM(COM$RPC_MARKET(R,P,COM,'EXP'),1)); - IF(Z EQ 1, LOOP(RPC_IRE(R,P,COM,'IMP'), Z=0; CG_GRP(R,P,C,COM) = YES)); - IF(Z,CG_GRP(R,P,C,C) = YES)); - LOOP(CG_GRP(R,P,C,COM),RC_RC(R,C,R,COM) = YES); - TOP_IRE(RC_RC(R,C,R,COM),P)$CG_GRP(R,P,C,COM) = YES; - OPTION CLEAR=CG_GRP; - -* Complete the preparation of marketplace - LOOP(TOP_IRE(R,C,R,COM,P), -* If no IRE_FLO set for marketplace, set default values - IF(IRE_DIST(R,P), - IRE_FLO(RTP(R,V,P),C,R,COM,S)$((IRE_FLO(R,V,P,C,R,COM,S) EQ 0)$RPCS_VAR(R,P,COM,S)) = 1; - ELSE F = SUM((RTP(R,T,P),S)$IRE_FLO(R,T,P,C,R,COM,S),1); - LOOP((REG,COM1)$(TOP_IRE(R,C,REG,COM1,P)$(NOT F)), - F = SUM((RTP(R,T,P),S)$IRE_FLO(R,T,P,C,REG,COM1,S),1); - IF(F, IRE_FLO(RTP(R,V,P),C,R,COM,S)$RPCS_VAR(R,P,COM,S) = IRE_FLO(R,V,P,C,REG,COM1,S))))); - -* Set standard EQIRE control for all imports other than from marketplace region - LOOP(TOP_IRE(R,C,REG,COM,P)$RPC_MARKET(R,P,C,'EXP'),IF(NOT SAMEAS(R,REG),TRACKPC(REG,P,COM) = YES)); - RPC_EQIRE(RPC_IRE(R,P,C,'IMP'))$((NOT TRACKPC(R,P,C))$RPC_IREIO(R,P,C,'IMP','IN')) = YES; - OPTION CLEAR=TRACKPC; - -* Set all non-standard EQIRE and MARKET controls - LOOP(TOP_IRE(R,C,R,COM,P), - IF(NOT RPC_EQIRE(R,P,COM,'IMP'), RPC_EQIRE(R,P,C,'EXP') = YES; - ELSEIF RPC_MARKET(R,P,C,'EXP'), - IF(IRE_DIST(R,P), RPC_EQIRE(R,P,C,'EXP') = YES; ELSE RPC_MARKET(R,P,COM,'IMP') = YES))); - TOP_IRE(R,C,R,COM,P)$RPC_EQIRE(R,P,C,'EXP') = NO; - -* Copy shutdown periods of marketplace to import regions - LOOP(RPC_MARKET(R,P,C,'EXP'),RTPC(REG,T,P,COM)$(TOP_IRE(R,C,REG,COM,P)$(NOT RTP_VARA(R,T,P))) = NO); -* Copy shutdown periods of import process to export regions - LOOP(TOP_IRE(REG,C,R,COM,P)$RPC_EQIRE(R,P,COM,'IMP'),RTPC(REG,T,P,C)$(NOT RTP_VARA(R,T,P)) = NO); - -* Reset RP_AIRE for distr IRE processes - RP_AIRE(RP_IRE(R,P),'EXP')$(RP_AIRE(R,P,'IMP')$IRE_DIST(R,P)) = NO; - -* Set IRE_FLOSUM for C if activity has IE flow - IRE_FLOSUM(RTP(R,T,P),C,S,IE,COM,IO)$(RPC_PG(R,P,C)$RP_AIRE(R,P,IE)$IRE_FLOSUM(RTP,%PGPRIM%,S,IE,COM,IO)) = - IRE_FLOSUM(RTP,%PGPRIM%,S,IE,COM,IO)*(1/PRC_ACTFLO(RTP,C)); - IRE_FLOSUM(R,T,P,%PGPRIM%,S,IE,COM,IO) = 0; -*----------------------------------------------------------------------------- - -* OK inter-regional trade if in topology -* Default values for IRE_FLO by LOOP over TOP_IRE - LOOP(TOP_IRE(R,C,REG,COM,P), - IF(NOT SUM((RTP(R,T,P),S)$IRE_FLO(R,T,P,C,REG,COM,S),1), - IRE_FLO(RTP(R,V,P),C,REG,COM,S)$PRC_TS(REG,P,S) = 1)); - -*----------------------------------------------------------------------------- -* determination of vintaging for processes -*----------------------------------------------------------------------------- -* vintaging period control such that v=t if no vintaging, otherwise = CPT periods - RTP_VINTYR(RTP_CPTYR(R,V,T,P))$PRC_VINT(R,P)= YES; -*V0.5a 980810 - always variables within availability of process - RTP_VINTYR(R,T,T,P)$((NOT PRC_VINT(R,P)) * RTP(R,T,P) * SUM(V,RTP_CPTYR(R,V,T,P))) = YES; - -*----------------------------------------------------------------------------- -* initialize the commodity balance equation type -* - equality (MAT,ENV,FIN) -* - prodution >= consumption (NRG,DEM) -*GG* questions about conservation and renewables being =N=? -*----------------------------------------------------------------------------- -* set the sub-sets of commodities - NRG(RC(R,C))$COM_TMAP(R,'NRG',C) = YES; - MAT(RC(R,C))$COM_TMAP(R,'MAT',C) = YES; - DEM(RC(R,C))$COM_TMAP(R,'DEM',C) = YES; - ENV(RC(R,C))$COM_TMAP(R,'ENV',C) = YES; - FIN(RC(R,C))$COM_TMAP(R,'FIN',C) = YES; - -* free up if conservation or free energy type, unless provided by the user -*GG* need to add code to INITSYS/MOD_EQUA/EQMAIN to handle =N= (e.g. what is bound), -* ignored at the moment with no equation created - TRACKC(RC) = YES; - LOOP(LIM,TRACKC(R,C)$COM_LIM(R,C,LIM) = NO); - COM_LIM(TRACKC(NRG(R,C)),'UP')$(NRG_TMAP(R,'CONSRV',C) + NRG_TMAP(R,'FRERENEW',C)) = YES; -* set defaults if not provided by user - TRACKC(R,C)$COM_LIM(R,C,'UP') = NO; - COM_LIM(MAT(TRACKC),'FX') = YES; - COM_LIM(FIN(TRACKC),'FX') = YES; - TRACKC(R,C)$COM_LIM(R,C,'FX') = NO; - COM_LIM(TRACKC,'LO') = YES; - OPTION CLEAR=TRACKC; - -* handle TIMES-MACRO -$ IFI %MACRO%==YES COM_LIM(RC(DEM),BD)$(NOT COM_LIM(RC,'N')) = NOT BDNEQ(BD); -$ IFI %MICRO%==YES COM_LIM(RC(DEM),BD)$(NOT COM_LIM(RC,'N')) = NOT BDNEQ(BD); - -*----------------------------------------------------------------------------- -* establish inter-regional convert attributes -*----------------------------------------------------------------------------- -* identify regions trading - OPTION RREG <= TOP_IRE; OPTION CLEAR=RXX; - LOOP(RREG(ALL_R,ALL_REG), Z=1; -* if all regions working with same time-slices set to 1, -* assumption is if have one direction then have to other too - LOOP(TSLVL$Z, - Z$Z = PROD(TS_GROUP(ALL_R,TSLVL,S),TS_GROUP(ALL_REG,TSLVL,S)); - Z$Z = PROD(TS_GROUP(ALL_REG,TSLVL,S),TS_GROUP(ALL_R,TSLVL,S)); - IF(Z, RXX(ALL_R,S,ALL_REG)$TS_GROUP(ALL_R,TSLVL,S) = YES))); - RXX(ALL_R,S,ALL_REG)$RXX(ALL_REG,S,ALL_R) = YES; - IRE_TSCVT(RXX(ALL_R,S,ALL_REG),S)$(NOT IRE_TSCVT(ALL_R,S,ALL_REG,S)) = 1; -* if regions working with commodities in the same units set convert to 1, -* assumption is if have one direction then have the other too - OPTION RC_RC < IRE_CCVT; - IRE_CCVT(RC_RC(RC,R,C))$(NOT IRE_CCVT(RC_RC)) = 1/IRE_CCVT(R,C,RC); - OPTION RC_RC <= TOP_IRE; IRE_CCVT(RC_RC)$(NOT IRE_CCVT(RC_RC)) = 1; - OPTION RC_RC < TOP_IRE; IRE_CCVT(RC_RC)$(NOT IRE_CCVT(RC_RC)) = 1; - -*----------------------------------------------------------------------------- -* process bounds to see if aggregation is necessary -*----------------------------------------------------------------------------- - PUTGRP = 0; - OPTION CLEAR=UNCD7; -$ BATINCLUDE pp_lvlbd.%1 ACT_BND P '' '' '' PRC_TS RPS_PRCTS RTPS_BD EPS -$ BATINCLUDE pp_lvlbd.%1 FLO_FR P C, '' ",''" RPCS_VAR RPCS_VAR UNCD7 0 -$ BATINCLUDE pp_lvlbd.%1 COM_BNDNET C '' '' ",'',''" COM_TS RCS_COMTS UNCD7 -$ BATINCLUDE pp_lvlbd.%1 COM_BNDPRD C '' '' ",'',''" COM_TS RCS_COMTS UNCD7 -$ BATINCLUDE pp_lvlbd.%1 IRE_BND C '' 'ALL_R,IE,' '' COM_TS RCS_COMTS UNCD7 EPS - -*----------------------------------------------------------------------------- -* process cumulative bounds -*----------------------------------------------------------------------------- -* process flows: UC_CUMFLO - UC_CUMFLO(UC_N,R,P,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR)) $= UC_CUMFLO(UC_N,R,P,C,BOHYEAR,EOHYEAR); - UC_CUMFLO(UC_N,R,P,C,BOHYEAR,EOHYEAR)$(NOT LL(BOHYEAR)*LL(EOHYEAR)) = 0; - UC_CUMFLO(UC_N,R,P,%PGPRIM%,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR)) $= UC_CUMACT(UC_N,R,P,BOHYEAR,EOHYEAR); - LOOP((UC_N,RP,C,YEAR,LL)$UC_CUMFLO(UC_N,RP,C,YEAR,LL),RPC_CUMFLO(RP,C,YEAR,LL)=YES); -* process flows: FLO_CUM - FLO_CUM(R,P,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR),L) $= FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,L); - FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,L)$(NOT LL(BOHYEAR)*LL(EOHYEAR)) = 0; - FLO_CUM(R,P,%PGPRIM%,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR),L) $= ACT_CUM(R,P,BOHYEAR,EOHYEAR,L); - RPC_CUMFLO(RP,C,YEAR,LL) $= SUM(L$FLO_CUM(RP,C,YEAR,LL,L),YES); - OPTION CLEAR=UC_CUMACT,CLEAR=ACT_CUM; -* commodities: UC_CUMCOM - UC_CUMCOM(UC_N,R,COM_VAR,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR)) $= UC_CUMCOM(UC_N,R,COM_VAR,C,BOHYEAR,EOHYEAR); - UC_CUMCOM(UC_N,R,COM_VAR,C,BOHYEAR,EOHYEAR)$(NOT LL(BOHYEAR)*LL(EOHYEAR)*RC(R,C)) = 0; - LOOP((UC_N,R,COM_VAR,C,YEAR,LL)$UC_CUMCOM(UC_N,R,COM_VAR,C,YEAR,LL),RC_CUMCOM(R,COM_VAR,YEAR,LL,C)=YES); -* commodities: COM_CUMNET/COM_CUMPRD - COM_CUM(R,'NET',YEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,L) $= COM_CUMNET(R,BOHYEAR,EOHYEAR,C,L); - COM_CUM(R,'PRD',YEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,L) $= COM_CUMPRD(R,BOHYEAR,EOHYEAR,C,L); - OPTION CLEAR=COM_CUMNET,CLEAR=COM_CUMPRD; - RC_CUMCOM(R,COM_VAR,YEAR,LL(EOHYEAR),C) $= SUM(L$COM_CUM(R,COM_VAR,YEAR,LL,C,L),YES); - -*----------------------------------------------------------------------------- -* determine if VAR_COMxxx needed on RHS of EQ_COM equations -*----------------------------------------------------------------------------- -* commodities aggregated by COM_AGG - LOOP((R,T,C,COM)$COM_AGG(R,T,C,COM),RC_AGP(COM_LIM(R,C,LIM)) = YES); - RC_AGP(R,C,BD)$(COM_TMAP(R,'DEM',C)$RC_AGP(R,C,'LO')) = NOT BDNEQ(BD); - RC_AGP(RC,'FX')$RC_AGP(RC,'N') = YES; - RHS_COMBAL(RTCS_VARC(R,T,C,S))$RC_AGP(R,C,'LO') = YES; - RHS_COMPRD(RTCS_VARC(R,T,C,S))$RC_AGP(R,C,'FX') = YES; -* commodities involved in DAM comprod -$IF DEFINED DAM_ELAST RHS_COMPRD(RTCS_VARC(R,T,C,S))$DAM_ELAST(R,C,'N') = YES; -* commodities involved in CUM constraints - LOOP(RC_CUMCOM(R,'NET',ALLYEAR,LL,C), - RTC_NET(R,T,C)$((E(T) >= YEARVAL(ALLYEAR)) * (B(T) <= YEARVAL(LL))) = YES; -$IFI %OBJ%==LIN RTC_NET(R,T,C)$((M(T)+LAGT(T) > YEARVAL(ALLYEAR)) * (M(T)-LEAD(T) < YEARVAL(LL))) = YES; - ); - LOOP(RC_CUMCOM(R,'PRD',ALLYEAR,LL,C), - RTC_PRD(R,T,C)$((E(T) >= YEARVAL(ALLYEAR)) * (B(T) <= YEARVAL(LL))) = YES; -$IFI %OBJ%==LIN RTC_PRD(R,T,C)$((M(T)+LAGT(T) > YEARVAL(ALLYEAR)) * (M(T)-LEAD(T) < YEARVAL(LL))) = YES; - ); -* check all TS at/above COM_TSL for bounds - RHS_COMBAL(RTCS_VARC(RTC_NET,S)) = YES; - COM_CSTNET(R,LL--ORD(LL),C,S--ORD(S),CUR)$(COM_CSTNET(R,LL,C,S,CUR)+COM_SUBNET(R,LL,C,S,CUR)+COM_TAXNET(R,LL,C,S,CUR)) = EPS; - LOOP((R,C,S,RDCUR(R,CUR))$COM_CSTNET(R,'0',C,S,CUR),RHS_COMBAL(RTCS_VARC(R,T,C,TS)) = YES); - RHS_COMBAL(RTCS_VARC(R,T,C,S))$SUM((TS_MAP(R,TS,S),BD)$COM_BNDNET(R,T,C,TS,BD),ABS(COM_BNDNET(R,T,C,TS,BD)) NE INF$BDUPX(BD)) = YES; - RHS_COMPRD(RTCS_VARC(RTC_PRD,S)) = YES; - COM_CSTPRD(R,LL--ORD(LL),C,S--ORD(S),CUR)$(COM_CSTPRD(R,LL,C,S,CUR)+COM_SUBPRD(R,LL,C,S,CUR)+COM_TAXPRD(R,LL,C,S,CUR)) = EPS; - LOOP((R,C,S,RDCUR(R,CUR))$COM_CSTPRD(R,'0',C,S,CUR),RHS_COMPRD(RTCS_VARC(R,T,C,TS)) = YES); - RHS_COMPRD(RTCS_VARC(R,T,C,S))$SUM((TS_MAP(R,TS,S),BD)$COM_BNDPRD(R,T,C,TS,BD), - (ABS(COM_BNDPRD(R,T,C,TS,BD)) NE INF) AND (COM_BNDPRD(R,T,C,TS,BD) NE NA$BDUPX(BD))) = YES; - -*----------------------------------------------------------------------------- -* Storage -*----------------------------------------------------------------------------- -* Remove standard flow variables from genuine storage charge/discharge flows - RTPCS_OUT(RTP(R,T,P),C,S)$(RPCS_VAR(R,P,C,S)$RPC_STG(R,P,C)) = YES; - -* Prepare demand sifting storages - OPTION TRACKPC < STG_SIFT; TRACKPC(RP,C)$(NOT (TOP(RP,C,'OUT')$RPC_STG(RP,C)+ACTCG(C))$RP_STG(RP))=NO; - TRACKPC(RP,C)$PRC_NSTTS(RP,'ANNUAL')=NO; - LOOP(TRACKPC(R,P,C),TRACKP(R,P)=YES; RPC_PKC(R,P,C)=NO; RHS_COMPRD(RTCS_VARC(R,T,C,S))=YES); - RPC_SPG(RPC_STG(TRACKP,C))=YES; RPC_STGN(TOP(RPC_STG(RPC_SPG(RP,C)),IO))$TOP(RP,C,'IN') = (TRACKPC(RP,C) EQV IPS(IO)); - LOOP(PRC_TSL(TRACKP(RP(R,P)),TSLVL), RP_STS(RP)=NO; RP_STG(RP)=NO; - Z=1-SUM(RPCS_VAR(RP,C,ANNUAL),2); LOOP(TOP(RPC_STG(RP,C),'IN'),IF(Z>0,RPC_LS(RP,C)=YES);Z=Z-1); RPC_LS(RP,C(ACTCG))$Z=YES; -* Levelize STG_SIFT(ACT) - LOOP(TRACKPC(RP,C(ACTCG)),F=SUM(RLUP(R,TSLVL,TSL),ORD(TSL)-1); IF(F=0,F=Z); - LOOP(RJLVL(J,R,TSL)$(F>=ORD(TSL)), - LOOP(TS_GROUP(R,TSL,TS),STG_SIFT(R,T,P,C,S)$(NOT STG_SIFT(R,T,P,C,S)) $= STG_SIFT(R,T,P,C,TS)$(STOAL(R,S)=F)$RS_BELOW(R,TS,S))); - STG_SIFT(R,T,P,C,S)$(STOAL(R,S) NE F)=0); - ACT_TIME(RTP(R,T,P),'LO')$(ACT_TIME(RTP,'UP')=0)=0; - ACT_TIME(RTP(R,T,P),BD)$ACT_TIME(RTP,'FX')=ACT_TIME(RTP,'FX')$BDUPX(BD)); - RPC_LS(RPC(RP,C))$RPC_LS(RP,%PGPRIM%)=NO; - -* Controls for flexible general storage - RPS_STG(PRC_TS(RP_STG,TS)) = YES; - RPS_STG(R,P,ANNUAL)$PRC_MAP(R,'STK',P) = NO; - RP_STS(R,P)$PRC_TSL(R,P,'ANNUAL') = NO; - LOOP(RP_STS(R,P), - PRC_TS(RPS_PRCTS(R,P,S))$STOA(S) = YES; - PRC_TS(R,P,ANNUAL)$PRC_MAP(R,'STK',P) = YES; - PRC_STGTSS(PRC_STGIPS(R,P,C)) = YES; - STG_LOSS(R,V,P,S)$STG_LOSS(R,V,P,S) = -ABS(STG_LOSS(R,V,P,S))); - RP_STL(RP_STS(RP),TSL+1,'N')$(PRC_SGL(RP)>=ORD(TSL)) = YES; - NCAP_AF(RTP(R,V,P),S,BD)$((NOT RPS_STG(R,P,S))$RP_STS(R,P)) = NCAP_AFS(RTP,S,BD); - -* Levelization of STG_LOSS and STG_SIFT - TRACKP(RP_STG)$(NOT RP_STS(RP_STG)) = YES; -$ BATINCLUDE pp_lvlfc.mod STG_LOSS P PRC_TS '' ",'0','0','0','0'" S2 V 'RTP(R,V,P)$(NOT RPS_STG(R,P,S)$TRACKP(R,P))' -$ BATINCLUDE pp_lvlfc.mod STG_SIFT 'P,C' RPCS_VAR '' ",'0','0','0'" ALL_TS T RTP(R,T,P) -* Convert equilibrium losses into standard losses for IPS, and adjust all losses by year fractions - STG_LOSS(RTP(R,V,P),S(TSL))$((ABS(STG_LOSS(RTP,S)*2-1)>=1)$PRC_MAP(R,'STK',P)) = 1-EXP(-ABS(STG_LOSS(RTP,S))); - STG_LOSS(RTP(R,V,P),S)$(STOA(S)$STG_LOSS(RTP,S)) = LOG(EXP(STG_LOSS(RTP,S)*G_YRFR(R,S)/RS_STGPRD(R,S))); - OPTION CLEAR=TRACKP,CLEAR=TRACKPC; - -*----------------------------------------------------------------------------- -* User constraints -*----------------------------------------------------------------------------- -* Default values -$ BATINCLUDE prepxtra.mod UCINT -*----------------------------------------------------------------------------- -* Levelized UC_RHSRTS - LOOP(T,UC_TSL(R,UC_N,SIDE,TSL)$UC_T_SUCC(R,UC_N,T)=NO); - OPTION R_UCORD(TSLVL)), - LOOP(TS_GROUP(R,TSLVL,TS),UC_RHSRTS(R_UC(R,UCN),T,S,L)$((NOT UC_RHSRTS(R_UC,T,S,L))$UC_TSL(R_UC,'LHS',TSL)) $= UC_RHSRTS(R_UC,T,TS,L)$RS_BELOW(R,TS,S)$TS_GROUP(R,TSL,S))); - LOOP(UC_TSL(R_UC(R,UCN),'LHS',TSL)$SUM(UC_TS_EACH(R_UC,S),1),UC_RHSRTS(R_UC,T,S,L)$((NOT UC_TS_EACH(R_UC,S))$TS_GROUP(R,TSL,S))=0); - UC_TS_EACH(R_UC,S) = NO; UC_ATTR(R_UC,SIDE,UC_GRPTYPE,UC_NAME(TSL)) = NO; -* Support for the obsolete - UC_RHS(UC_N,L)$(NOT UC_RHS(UC_N,L)) $= UC_RHSS(UC_N,'ANNUAL',L); - UC_RHSR(R,UC_N,L)$(NOT UC_RHSR(R,UC_N,L)) $= UC_RHSRS(R,UC_N,'ANNUAL',L); -* --- Set UC_R_EACH / UC_R_SUM defaults - OPTION CLEAR=UNCD1; UNCD1(UCN)$(NOT SUM(UC_R_EACH(ALL_R,UCN),1)) = YES; - UC_ON(R,UCN)$SUM(L$UC_RHSR(R,UCN,L),1) = YES; - UC_ON(R,UCN)$SUM((T,L)$UC_RHSRT(R,UCN,T,L),1) = YES; - UC_ON(R,UCN)$SUM((T,S,L)$UC_RHSRTS(R,UCN,T,S,L),1) = YES; - UC_R_EACH(R,UCN)$(NOT UC_ON(R,UCN))=NO; UC_R_EACH(UC_ON(R,UCN))$=UNCD1(UCN); - OPTION CLEAR=UNCD1; UNCD1(UCN)$(NOT SUM(UC_R_SUM(ALL_R,UCN),1)) = YES; - UC_DT(R,UCN)$SUM(L$UC_RHS(UCN,L),1) = YES; - UC_DT(R,UCN)$SUM((T,L)$UC_RHST(UCN,T,L),1) = YES; - UC_DT(R,UCN)$SUM((T,S,L)$UC_RHSTS(UCN,T,S,L),1) = YES; - UC_R_SUM(R,UCN)$(NOT UC_DT(R,UCN))=NO; UC_R_SUM(UC_DT(R,UCN))$=UNCD1(UCN); - OPTION CLEAR=UC_DT,UC_ON= BL_START(R,BLE,SPE)) = YES -); -BL_UNIT(BLE_SPE(R,BLE,SPE))$(NOT BL_UNIT(R,BLE,SPE)) = 1; - -*** ONLY TID FOR NOW *** -* set time-dependent blending SPEcificiation from TID if not provided -*TBL_SPEC(BLE_SPE(BLE,SPE),TP)$(BL_SPEC(BLE,SPE) AND (NOT TBL_SPEC(BLE,SPE,TP))) = -* BL_SPEC(BLE,SPE); -** set time-dependent 3-tuple -BLE_SPEOPR(BLE_SPE(R,BLE,SPE),OPR)$BL_COM(R,BLE,OPR,SPE) = YES; -*BLE_SPEOPR(BLE,SPE,OPR)$(BL_COM(BLE,OPR,SPE) OR -* SUM(YEAR,TBL_COM(BLE,SPE,OPR,YEAR))) = YES; -*TBL_COM(BLE_SPEOPR(BLE,SPE,OPR),TP)$(BL_COM(BLE,OPR,SPE) AND -* (NOT TBL_COM(BLE,SPE,OPR,TP))) = BL_COM(BLE,OPR,SPE); -* -** assumed BLEND INP not SPE dependent, and that values are to be summed for BLE -*BLE_INP(BLE,COM)$(BL_INP(BLE,COM) OR SUM((SPE,YEAR),TBL_INP(BLE,SPE,COM,YEAR))) -* = YES; -BLE_SPEINP(R,BLE,SPE,COM)$(BLE_SPE(R,BLE,SPE) * BLE_INP(R,BLE,COM)) = YES; -**TBL_INP(BLE_SPE(BLE,SPE),COM,TP) = BL_INP(BLE,COM) + TBL_INP(BLE,SPE,COM,TP); -*TBL_INPT(BLE_INP(BLE,ELC),TP) = BL_INP(BLE,ELC) + -* SUM(BLE_SPE(BLE,SPE), TBL_INP(BLE,SPE,ELC,TP)); -* -** assume that values are to be summed -*TBL_VAROMT(BLE,TP) = BL_VAROM(BLE) + SUM(BLE_SPE(BLE,SPE), TBL_VAROM(BLE,SPE,TP)); -* -** DELIV assume that values are to be summed -*TBL_DELIV(BLE_SPE(BLE,SPE),COM,TP) = BL_DELIV(BLE,COM) + -* TBL_DELIV(BLE,SPE,COM,TP); -*TBL_DELIVT(BLE,COM,TP) = SUM(SPE$BLE_SPE(BLE,SPE), -* TBL_INP(BLE,SPE,COM,TP) * TBL_DELIV(BLE,SPE,COM,TP)); -* -** setup BLE/OPR combination and handle the emissions -LOOP(BLE_SPEOPR(R,BLE,SPE,OPR), - BLE_OPR(R,BLE,OPR) = YES; -); -LOOP(BLE_OPR(R,BLE,OPR), - BLE_ENV(R,C,BLE,OPR)$(ENV(R,C) * SUM(T, ENV_BL(R,C,BLE,OPR,T))) = YES; -); - -* handle peakda, setting to 1 if uses COM_PEAK but no value provided -PEAKDA_BL(R,BLE,T)$((NOT PEAKDA_BL(R,BLE,T))$SUM(COM_PEAK(R,C)$BLE_INP(R,BLE,C),1)) = 1; - -****************************************************************************** -* Coefficients for BLENDing -****************************************************************************** -ALIAS(OPR,OPR2); -* balance of energy carriers - BLE_BAL(BLE_TP(R,T,BLE),OPR2)$OPR(BLE) = 1; - BLE_BAL(BLE_TP(R,T,BLE),OPR2)$(NOT OPR(BLE)) = 1$(REFUNIT(R)=1) + - CONVERT(OPR2,'WCV')$(REFUNIT(R)=2) + - CONVERT(OPR2,'VCV')$(REFUNIT(R)=3); - -* create the REFUNIT/BL_UNIT and FEQ convert look-up tables -* volume -LOOP(R, -IF (REFUNIT(R) = 3, - RU_CVT(BLE_SPEOPR(R,BLE,SPE,OPR)) = 1$(BL_UNIT(R,BLE,SPE) = 3) + - CONVERT(OPR,'DENS')$(BL_UNIT(R,BLE,SPE) = 2) + - CONVERT(OPR,'VCV')$(BL_UNIT(R,BLE,SPE) = 1); - RU_FEQ(R,OPR,T) = CONVERT(OPR,'VCV'); -); -* weight -IF (REFUNIT(R) = 2, - RU_CVT(BLE_SPEOPR(R,BLE,SPE,OPR)) = - (1/CONVERT(OPR,'DENS'))$(BL_UNIT(R,BLE,SPE) = 3) + - 1$(BL_UNIT(R,BLE,SPE) = 2) + - CONVERT(OPR,'WCV')$(BL_UNIT(R,BLE,SPE) = 1); - RU_FEQ(R,OPR,T) = CONVERT(OPR,'WCV'); -); -* energy -IF (REFUNIT(R) = 1, - RU_CVT(BLE_SPEOPR(R,BLE,SPE,OPR)) = - (1/CONVERT(OPR,'VCV'))$(BL_UNIT(R,BLE,SPE) = 3) + - (1/CONVERT(OPR,'WCV'))$(BL_UNIT(R,BLE,SPE) = 2) + - 1$(BL_UNIT(R,BLE,SPE) = 1); - RU_FEQ(R,OPR,T) = 1; -); -); -RU_FEQ(R,OPR,T)$(NOT RU_FEQ(R,OPR,T)) = 1; - -*---------------------------------------------------------------- -* Call reduction algorithm -*---------------------------------------------------------------- -$ BATINCLUDE pp_reduce.red - RTPCS_VARF(RTPC(RTP_VARA(R,T,P),C),S)$((NOT RTPCS_OUT(R,T,P,C,S))$RPCS_VAR(R,P,C,S)) = YES; - OPTION CLEAR=R_UC,CLEAR=RTPCS_OUT; -*---------------------------------------------------------------- -* MACRO -*---------------------------------------------------------------- -$ IF %MACRO%==YES $BATINCLUDE ppmain.tm - - PUTCLOSE QLOG; - IF(PUTOUT, QLOG.AP = 1); diff --git a/source/ppmain.tm b/source/ppmain.tm deleted file mode 100644 index 921178b..0000000 --- a/source/ppmain.tm +++ /dev/null @@ -1,72 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* ppmain.tm oversees all the preprocessing activities needed by MACRO -$ BATINCLUDE prep_ext.tm -*============================================================================* -* Initialize the economic parameters -*============================================================================* - - TM_AEEIV(R,T,C)$DEM(R,C) = TM_DDF(R,T,C)/100; - TM_ASRV(R) = 1 - TM_DEPR(R)/100; - TM_DFACTCURR(R,T) = 1 - (TM_KPVS(R)/TM_KGDP(R) - TM_DEPR(R)/100 - TM_GROWV(R,T)/100); - TM_RHO(R) = 1 - 1/TM_ESUB(R); - -* Capital survival defined as factor between the middle year of the period T+1 and the period T - TM_TSRV(R,T) = TM_ASRV(R) ** NYPER(T); - -*============================================================================* -* Calculate initial values for the economic variables for the first time period -* - Capital Stock -* - Investment during time period 0 -* - Consumption during time period 0 -* - GDP (Consumption + Investment) + Energy Costs -*============================================================================* - - TM_K0(R) = TM_KGDP(R) * TM_GDP0(R); - TM_IV0(R) = TM_K0(R) * (TM_DEPR(R) + SUM(T$(ORD(T) = 1),TM_GROWV(R,T)))/100; - TM_C0(R) = TM_GDP0(R) - TM_IV0(R); - TM_Y0(R) = TM_GDP0(R) + TM_EC0(R) + SUM(T_1(T),TM_AMP(R,T)); - -*============================================================================* -* Calculate intermediate values -*============================================================================* - TM_AEEIFAC(R,T,C)$DEM(R,C) = 1; - TM_DFACT(R,T) = 1; - TM_L(R,T) = 1; - - LOOP(T, - TM_AEEIFAC(R,T+1,C)$DEM(R,C) = TM_AEEIFAC(R,T,C) * (1 - TM_AEEIV(R,T+1,C)) ** NYPER(T); - TM_DFACT(R,T+1) = TM_DFACT(R,T) * TM_DFACTCURR(R,T) ** NYPER(T); - TM_L(R,T+1) = TM_L(R,T) * (1 + TM_GROWV(R,T) / 100) ** NYPER(T); - ); - -* Arbitrary multiplier on utility in last time period. - LOOP(MIYR_1(T++1)$(TM_ARBM NE 1), - TM_DFACT(R,T) = TM_DFACT(R,T) * - (1-MIN(.999,TM_DFACTCURR(R,T))**(NYPER(T)*TM_ARBM)) / - (1-MIN(.999,TM_DFACTCURR(R,T))**(NYPER(T) * 1 ))); -* Weights for periods (use only if requested by TM_ARBM=1) - TM_PWT(T) = 1; IF(TM_SL, Z=MAX(1,SMAX(T,D(T))); TM_PWT(T) = D(T)/Z); - - TM_D0(DEM(R,C)) = TM_SCALE_NRG * SUM(MIYR_1(T), COM_PROJ(R,T,C)); - - TM_B(DEM(R,C)) = TM_D0(R,C) / TM_Y0(R); - TM_B(DEM(R,C)) = TM_B(R,C) ** (1 - TM_RHO(R)); - TM_B(DEM(R,C)) = TM_SCALE_CST / TM_SCALE_NRG * TM_DDATPREF(R,C) * TM_B(R,C); - - TM_AKL(R) = TM_Y0(R) ** TM_RHO(R) - SUM(DEM(R,C), TM_B(R,C) * (TM_D0(R,C) ** TM_RHO(R))); - TM_AKL(R) = TM_AKL(R) / (TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R))); - - TM_YCHECK(R) = TM_AKL(R) * TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R)) + SUM(DEM(R,C), TM_B(R,C) * TM_D0(R,C) ** TM_RHO(R)); - TM_YCHECK(R) = TM_YCHECK(R) ** (1 / TM_RHO(R)); - -* annual percent expansion factor converted into 1 period factor - PARAMETER HELP_EXPF(R,T); - HELP_EXPF(R,T) = TM_EXPF(R,T); - TM_EXPF(R,T) = (1+HELP_EXPF(R,T)/100)**(D(T)/2) * (1+HELP_EXPF(R,T+1)/100)**(D(T+1)/2); - OPTION CLEAR=HELP_EXPF; - -display tm_b, tm_expf; diff --git a/source/prep_ext.abs b/source/prep_ext.abs deleted file mode 100644 index 0967b1b..0000000 --- a/source/prep_ext.abs +++ /dev/null @@ -1,33 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREP_ext.abs oversees all the added interpolation activities needed by ABS -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Add reserve commodities to RC - RC(R,C) $= BS_RTYPE(R,C); - LOOP((RP,ITEM)$GR_GENMAP(RP,ITEM),BS_K(ITEM)=YES); - LOOP((R,T,C,P,BD)$BS_SHARE(R,T,C,P,BD),BS_K(P)=YES); - -* Bulk processing - OPTION BS_RTCS < BS_DEMDET; - BS_RTCS('OMEGA',R,YEAR,C,S) $= BS_OMEGA(R,YEAR,C,S); - BS_RTCS('DELTA',R,YEAR,C,S) $= BS_DELTA(R,YEAR,C,S); - -* Interpolation/extrapolation -$ BATINCLUDE fillparm BS_LAMBDA R C ",'0','0','0','0','0'" T YES '>=0' -$ BATINCLUDE fillparm BS_DETWT R C ",'0','0','0','0','0'" T YES '>=0' -$ BATINCLUDE fillparm BS_SIGMA R 'C,BS_K,S' ",'0','0','0'" T YES >=0 -$ BATINCLUDE fillparm BS_SHARE R 'C,BS_K,BD' ",'0','0','0'" T YES >=0 -$ BATINCLUDE fillparm BS_RTCS 'RSP,R' 'C,S' ",'0','0','0'" T YES >=0 -$ BATINCLUDE fillparm BS_MAINT R 'P,S' ",'0','0','0','0'" V 'RTP(R,V,P)' >=0 -$ BATINCLUDE fillparm BS_RMAX R 'P,C,S' ",'0','0','0'" V 'RTP(R,V,P)' >=0 -$ BATINCLUDE prepparm BS_BNDPRS R 'P,C,S,BD' ",'0'" T 'RTP(R,T,P)' 1 - - BS_RTCS(RSP('OMEGA'),R,T,C,S)$BS_RTCS(RSP,R,T,C,S) = ROUND(BS_RTCS(RSP,R,T,C,S)); - BS_SIGMA(R,T,C,BS_K,S)$(BS_LAMBDA(R,T,C)=0)=0; - BS_RMAX(R,LL--ORD(LL),P,C,S+STOA(S)) $= (BS_RMAX(R,LL,P,C,S)>0); - BS_RMAX(R,LL,P,C,S)$(NOT BS_RMAX(R,'0',P,C,'ANNUAL'))=0; - OPTION BS_BSC < BS_RMAX, CLEAR=BS_OMEGA; \ No newline at end of file diff --git a/source/prep_ext.dsc b/source/prep_ext.dsc deleted file mode 100644 index f41042e..0000000 --- a/source/prep_ext.dsc +++ /dev/null @@ -1,20 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREP_EXT.xtd oversees extended preprocessor activities * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* Questions/Comments: -* The default option for NCAP_DISC is 10 (no interpolation/extrapolation, -* but migrate to milestone years) -*----------------------------------------------------------------------------- -$IF NOT DEFINED PRC_DSCNCAP $EXIT - -* Inter-/extrapolation -$BATINCLUDE prepparm NCAP_DISC 'R' 'P,UNIT' ",'0','0','0'" MILESTONYR 'RTP(R,MILESTONYR,P)' 1 - -* Process semicontinuous requests - NCAP_SEMI(RTP(R,T,P))$PRC_DSCNCAP(R,P) = (NCAP_DISC(RTP,'0')+1)-1; - NCAP_SEMI(RTP)$SUM(UNIT(J)$NCAP_DISC(RTP,UNIT),1) = 0; diff --git a/source/prep_ext.ier b/source/prep_ext.ier deleted file mode 100644 index bcc3198..0000000 --- a/source/prep_ext.ier +++ /dev/null @@ -1,21 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREP_ext.vtt oversees all the added inperpolation activities needed by IER * -* %1 - mod or v# for the source code to be used * -*=============================================================================* - -*$BATINCLUDE fillparm FLO_MRKCON 'R' 'P,C,TS,BD' ",'0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' -*$BATINCLUDE fillparm FLO_MRKPRD 'R' 'P,C,TS,BD' ",'0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' -$BATINCLUDE fillparm ECT_AFCON 'R' 'P,BD' ",'0','0','0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' -$BATINCLUDE fillparm ECT_AFBPT 'R' 'P,BD' ",'0','0','0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' - -*----------------------------------------------------------------------------- -* Convert capacity related data for extraction condensing turbines -* from electricity commodity to input commodity grooup -* Assumption: original PRC_ACTUNT contains the electricity commodity of this process -*----------------------------------------------------------------------------- -$IF %CHP_MODE% == YES $BATINCLUDE pp_chp.ier -$SETGLOBAL PEAKCHP eqpk_ect.ier diff --git a/source/prep_ext.mlf b/source/prep_ext.mlf deleted file mode 100644 index 3c5bfe0..0000000 --- a/source/prep_ext.mlf +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREP_ext.tm oversees all the added inperpolation activities needed by MACRO * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -$ IF NOT '%CTST%'=='' MINYR = MIYR_V1; -*------------------------------------------------------------------------------ -* Interpolate MACRO-specific parameters -$ BATINCLUDE filparam TM_EXPBND 'R,' 'P' ",'','','','',''" DATAYEAR T -$ BATINCLUDE filparam TM_EXPF 'R,' '' ",'','','','',''" DATAYEAR T -$ BATINCLUDE filparam TM_VOC 'R,' 'C,BD' ",'','','',''" YEAR T -$ BATINCLUDE filparam TM_GR 'R,' '' ",'','','','',''" YEAR T -*------------------------------------------------------------------------------ -* Additions to support MACRO linear formulation - SET MAG(CG) / ACT, AKL, LAB, KN, YN /; - SET MR(R), PP(T), TLAST(T), DM(C), XCP(J) /1, 6, 12/; - SET TM_DM(REG,COM); - SET XTP(LL); - ALIAS (MIYR_1,T_1,TB); - ALIAS (T,TP); - PARAMETER NYPER(ALLYEAR); - PARAMETER CM_LED(LL); - PARAMETER TM_TAXREV(R,T) //; - PARAMETER TM_HDF(R,T) //; -* Periods stuff - PP(T+1) = YES; - TLAST(T--ORD(T)) = YES; - NYPER(T) = LAGT(T); - NYPER(TLAST(T+1)) = NYPER(T); - CM_LED(T+1)=LAGT(T); - XTP(LL)$=CM_LED(LL); - XTP(T) = YES; - TM_PP(R,PP)=YES; - - MR(R) $= SUM(T$TM_GR(R,T),YES); - TM_GDPGOAL(R,TB) = TM_GDP0(R); - LOOP(PP(T+1),TM_GDPGOAL(R,PP) = TM_GDPGOAL(R,T)*(1+TM_GR(R,T)/100)**NYPER(T)); -* Save demand LIM for non-MR - OPTION TM_DM < COM_PROJ; - TM_STEP(TM_DM(R,C),'N') = NOT COM_LIM(R,C,'FX'); \ No newline at end of file diff --git a/source/prep_ext.stc b/source/prep_ext.stc deleted file mode 100644 index db63e9a..0000000 --- a/source/prep_ext.stc +++ /dev/null @@ -1,56 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREP_ext.stc oversees all the added inperpolation activities needed by STC * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* Preprocess stochastic parameters - Interpolation -$ BATINCLUDE fillparm S_COM_PROJ 'R' 'C,J,WW' ",'0','0','0'" MILESTONYR 1 'GE 0' -$ BATINCLUDE fillparm S_COM_TAX 'R' 'C,S,COM_VAR,CUR,J,WW' "" MILESTONYR 1 'GE 0' -$ BATINCLUDE fillparm S_NCAP_COST 'R' 'P,J,WW' ",'0','0','0'" MILESTONYR 1 'GE 0' -$ BATINCLUDE prepparm S_CAP_BND 'R' 'P,BD,J,WW' ",'0'" MILESTONYR 'RTP(R,MILESTONYR,P)' 1 -$ BATINCLUDE prepparm S_UC_RHSRT 'ALL_R,UC_N' 'L,J,WW' ",'0'" MILESTONYR 1 1 -$ BATINCLUDE prepparm S_UC_RHSRTS 'ALL_R,UC_N' 'TS,L,J,WW' "" MILESTONYR 1 1 -$ BATINCLUDE prepparm S_UC_RHST 'UC_N' 'L,J,WW' ",'0','0'" MILESTONYR 1 1 -$ BATINCLUDE prepparm S_UC_RHSTS 'UC_N' 'TS,L,J,WW' ",'0'" MILESTONYR 1 1 -$ IF DEFINED S_DAM_COST $BATINCLUDE prepparm S_DAM_COST R 'C,CUR,J,WW' ",'0'" MILESTONYR 1 EPS 3 -$ IF DEFINED S_FLO_FUNC $BATINCLUDE fillparm S_FLO_FUNC R 'P,CG,CG2,J,WW' ",'0'" MILESTONYR 1 'GE 0' -$ IF DEFINED S_NCAP_AFS $BATINCLUDE fillparm S_NCAP_AFS R 'P,TS,J,WW' ",'0','0'" MILESTONYR 1 'GE 0' -$ IF DEFINED S_COM_FR $BATINCLUDE fillparm S_COM_FR R 'C,TS,J,WW' ",'0','0'" MILESTONYR 1 'GE 0' -*----------------------------------------------------------------------------- -$ BATINCLUDE recurrin.stc MXPAR -*----------------------------------------------------------------------------- -* commodities involved in CUM constraints - S_COM_CUM(R,'NET',ALLYEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,BD,J,WW) $= S_COM_CUMNET(R,BOHYEAR,EOHYEAR,C,BD,J,WW); - S_COM_CUM(R,'PRD',ALLYEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,BD,J,WW) $= S_COM_CUMPRD(R,BOHYEAR,EOHYEAR,C,BD,J,WW); - OPTION CLEAR=S_COM_CUMPRD,CLEAR=S_COM_CUMNET; - S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,'LO',J,WW)$((S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,'LO',J,WW) EQ 0)$S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,'LO',J,WW)) = 0; - RC_CUMCOM(R,COM_VAR,ALLYEAR,LL,C) $= SUM((BD,J,WW)$S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,BD,J,WW),YES); - LOOP((R,T,C,S,COM_VAR,CUR,J,WW)$S_COM_TAX(R,T,C,S,COM_VAR,CUR,J,WW),UC_COM('OBJ1',COM_VAR,'LHS',R,'0',C,ANNUAL,'UCN')=1); - -* collect transformation tuples -$ IF DEFINED S_FLO_FUNC OPTION RP_FFSGG <= S_FLO_FUNC; - -* Activate capacity variables if S_CAP_BND is specified - LOOP((R,T,P,BD,J,WW)$S_CAP_BND(R,T,P,BD,J,WW),RTP_VARP(R,T,P) = YES); -*----------------------------------------------------------------------------- -$ IF DEFINED S_DAM_COST PARAMETER DAM_COST //; -$ IF DEFINED DAM_COST PARAMETER S_DAM_COST //; -*----------------------------------------------------------------------------- -* Set flags for Phased UC_N - UC_R_SUM(R,'OBJZ') = YES; UC_R_EACH(R,'OBJZ') = YES; UC_R_SUM(R,'OBJ1') = YES; - UC_T_SUM(R,'OBJZ',T) = YES; UC_T_SUM(R,'OBJ1',MIYR_1) = YES; - LOOP((UC_N,WW)$S_UCOBJ(UC_N,WW),UC_RHS(UC_N,'N')$(NOT UC_RHS(UC_N,'N')) = -1); -* Initialize SW_PARM - SW_PARM = CARD(S_COM_PROJ) + CARD(S_CAP_BND) + CARD(S_COM_CUMPRD) + CARD(S_COM_CUMNET); - SW_PARM = SW_PARM + CARD(S_CM_CONST) + CARD(S_CM_MAXC); -* Set flag for detemininstic RHS if none set but is set for some SOW - UC_RHS(UC_N,'UP')$((NOT UC_RHS(UC_N,'UP'))$SUM((LIM,J,WW)$S_UC_RHS(UC_N,LIM,J,WW),1)) = INF; - UC_RHSR(R,UC_N,'UP')$((NOT UC_RHSR(R,UC_N,'UP'))$SUM((LIM,J,WW)$S_UC_RHSR(R,UC_N,LIM,J,WW),1)) = INF; - UC_RHST(UC_N,T,'UP')$((NOT UC_RHST(UC_N,T,'UP'))$SUM((LIM,J,WW)$S_UC_RHST(UC_N,T,LIM,J,WW),1)) = INF; - UC_RHSRT(R,UC_N,T,'UP')$((NOT UC_RHSRT(R,UC_N,T,'UP'))$SUM((LIM,J,WW)$S_UC_RHSRT(R,UC_N,T,LIM,J,WW),1)) = INF; - UC_RHSTS(UC_N,T,S,'UP')$((NOT UC_RHSTS(UC_N,T,S,'UP'))$SUM((LIM,J,WW)$S_UC_RHSTS(UC_N,T,S,LIM,J,WW),1)) = INF; - UC_RHSRTS(R,UC_N,T,S,'UP')$((NOT UC_RHSRTS(R,UC_N,T,S,'UP'))$SUM((LIM,J,WW)$S_UC_RHSRTS(R,UC_N,T,S,LIM,J,WW),1)) = INF; - UC_DYNBND('OBJ1','N')=YES; \ No newline at end of file diff --git a/source/prep_ext.tm b/source/prep_ext.tm deleted file mode 100644 index 474fc4e..0000000 --- a/source/prep_ext.tm +++ /dev/null @@ -1,32 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREP_ext.tm oversees all the added inperpolation activities needed by MACRO * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* Comments: If TM_EC0 not defined, try loading MSADDF -*------------------------------------------------------------------------------ -$IF NOT DEFINED TM_EC0 -$IF EXIST msaddf.dd $INCLUDE msaddf.dd -$IF NOT DEFINED TM_EC0 OPTION CLEAR=TM_EC0; -*------------------------------------------------------------------------------ -* Interpolate MACRO-specific parameters -$BATINCLUDE filparam TM_DDF 'R,' 'C' ",'','','','',''" DATAYEAR T '' '' -$BATINCLUDE filparam TM_EXPBND 'R,' 'P' ",'','','','',''" DATAYEAR T '' '' -$BATINCLUDE filparam TM_EXPF 'R,' '' ",'','','','',''" DATAYEAR T '' '' -$BATINCLUDE filparam TM_GR 'R,' '' ",'','','','',''" DATAYEAR T '' '' -$BATINCLUDE filparam TM_GROWV 'R,' '' ",'','','','',''" DATAYEAR T '' '' -*------------------------------------------------------------------------------ -* Additions to support MACRO soft-link - SCALAR TM_SL /0/; - SETS MR(R), PP(T), TLAST(T), DM(C), XCP(J) /1, 6, 12/; - ALIAS (MIYR_1,T_1); - PARAMETER NYPER(ALLYEAR); - PP(T+1) = YES; - TLAST(T)$(ORD(T) EQ CARD(T)) = YES; - TM_SL = (ROUND(TM_ARBM,1) EQ 1); - IF(TM_SL,NYPER(T) = LAGT(T); ELSE NYPER(TT(T-1)) = (D(T)+D(TT))/2); - NYPER(TLAST(T+1)) = LAGT(T); - LOOP(R,DM(C)$DEM(R,C)=YES); diff --git a/source/prep_ext.vda b/source/prep_ext.vda deleted file mode 100644 index 4d518e9..0000000 --- a/source/prep_ext.vda +++ /dev/null @@ -1,79 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREP_ext.VDA oversees all the added inperpolation activities needed by VEDA -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Comments: RVP can be used to control flow-related attribs instead of RTP -*------------------------------------------------------------------------------ -* Prepare commodity-specific availabilities; NCAP_AFAC overrides NCAP_AFC - OPTION RP_GRP < NCAP_AFAC; - NCAP_AFC(R,DATAYEAR,P,CG,'ANNUAL')$RP_GRP(R,P,CG) = NCAP_AFAC(R,DATAYEAR,P,CG); - NCAP_AFC(R,LL,P,CG,STL(S)) $= NCAP_AFCS(R,LL,P,CG,S); OPTION CLEAR=NCAP_AFCS; -* Collect ACT_EFF groups - OPTION RP_GRP < ACT_EFF, CLEAR=UNCD7; - UNCD7(R,LL--ORD(LL),P,CG,S--ORD(S),'','')$BOHYEAR(LL) $= (ACT_EFF(R,LL,P,CG,S) GT 0)$ACT_EFF(R,LL,P,CG,S); - LOOP(UNCD7(R,LL,P,CG,S,'',''),RPC_ACE(R,P,CG) = YES); - RPG_1ACE(RP_GRP(RPC(R,P,C)),C)$(NOT RPC_ACE(RPC)) = YES; - OPTION CLEAR=RP_GRP; - ACT_FLO(R,LL--ORD(LL),P,C,S)$STOA(S) $= VDA_FLOP(R,LL,P,C,S); -*------------------------------------------------------------------------------ -* Interpolate VDA-specific parameters -$BATINCLUDE fillparm VDA_EMCB R 'C,COM' ",'0','0','0','0'" V 1 'GE 0' -$BATINCLUDE fillparm NCAP_AFC R 'P,CG,STL' ",'0','0','0'" V 'RTP(R,V,P)' 'GE -1$ACTCG(CG)' -$BATINCLUDE fillparm ACT_EFF R 'P,CG,TS' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGS -$BATINCLUDE fillparm VDA_FLOP R 'P,CG,TS' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGS -$BATINCLUDE fillparm FLO_EMIS R 'P,CG,COM,S' ",'0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGCS -$BATINCLUDE fillparm ACT_UPS R 'P,S,BD' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm ACT_LOSPL R 'P,L' ",'0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm ACT_LOSSD R 'P,UPT,BD' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm ACT_SDTIME R 'P,UPT,BD' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm ACT_MAXNON R 'P,UPT' ",'0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm STG_MAXCYC R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$IF DEFINED UC_FLOBET $BATINCLUDE fillparm UC_FLOBET 'UC_N,R' 'P,C' ",'0','0','0'" T 1 'GE 0' -$IF DEFINED COM_CSTBAL $BATINCLUDE fillparm COM_CSTBAL R 'C,S,ITEM,CUR' ",'0','0'" T 1 'GE 0' -$IF DEFINED PRC_REACT $BATINCLUDE powerflo.vda PREP -$IF DEFINED GR_VARGEN $BATINCLUDE resloadc.vda -$BATINCLUDE equcrtp.vda PREP_EXT -*------------------------------------------------------------------------------ -* Special vintaging options -$IF %VINTOPT%==1 $BATINCLUDE fillvint VDA_FLOP R 'P,CG,TS' X_RPGS -$IF %VINTOPT%==1 $BATINCLUDE fillvint ACT_EFF R 'P,CG,TS' X_RPGS - FLO_FUNCX(R,LL,P,C,CG)$(NOT PRC_VINT(R,P)) = 0; -*------------------------------------------------------------------------------ - -* Tailored interpolation of PRC_RESID - OPTION CLEAR=PRC_YMAX,CLEAR=MY_ARRAY; - TRACKP(R,P)$=PRC_RESID(R,'0',P); PRC_YMAX(TRACKP(R,P))=ROUND(PRC_RESID(R,'0',P)); - LOOP(PYR_S(PYR(LL)), - PRC_RESID(R,'0',P)$TRACKP(R,P) = MAX(1,NCAP_TLIFE(R,LL,P)+G_TLIFE$(NOT NCAP_TLIFE(R,LL,P))); - LOOP(TRACKP(R,P), DFUNC=PRC_YMAX(R,P); - MY_ARRAY(DM_YEAR)=PRC_RESID(R,DM_YEAR,P); MY_F=0; F=0; Z=0; -* do interpolate - LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), - LAST_VAL=MY_F; MY_F=MY_ARRAY(DM_YEAR); Z=YEARVAL(DM_YEAR); - IF(LAST_VAL, PRC_RESID(R,T,P)$((Z>M(T))$(M(T)>MY_FYEAR)) = MY_F-(MY_F-LAST_VAL)/(Z-MY_FYEAR)*(Z-M(T)); - ELSE F=Z); MY_FYEAR=Z; CNT$(LAST_VAL+MY_F>0)=Z); -* If only one RESID Interpolate towards EPS at Z+TLIFE - IF(ABS(DFUNC-10)=5, DFUNC=F; F=Z; ELSE F$DFUNC=0); - IF(Z=F,CNT=PRC_RESID(R,'0',P); Z=F+CNT; DFUNC=DFUNC+CNT; - PRC_RESID(R,T,P)$(M(T)>F)=MY_F*MAX(0,1-(M(T)-F)$(M(T)>=DFUNC)/CNT); MY_F=0; ELSE Z=CNT); -$IFI %WAVER%==YES PRC_YMAX(R,P)=Z+1$(MY_F>0); IF(MY_F=0, PRC_RESID(R,LL+(Z-MIYR_BOH),P)=EPS); - ); -* Initialize PRC_RESID capacity availability: - NCAP_TLIFE(R,LL,P)$TRACKP(R,P) = 1; - NCAP_ILED(R,LL,P)$TRACKP(R,P) = 0; - RTP_CPTYR(R,LL,T,P)$(((PRC_RESID(R,T,P)>0)+(B(T) no interpolation, 0-> default action, 10->intra-period -* DFUNC = +1-> interp., 2->interp.+EPS, 3->interp.+extrap. -* DFUNC >999 -> exponential interpolation beyond year DFUNC -* Parameters: -* %1 - table name -* %2 - control set 1 -* %3 - control set 2 -* %4 - UNCD7 residual dimension -* %5 - MODLYEAR or MILESTONYR depending on parameter -* %6 - RTP controlling the assignment to the MODLYEARs -* %7 - Option to prohibit extrapolation (1 for other than cost parameters) -******************************************************************************* -*$ONLISTING -$EOLCOM ! -$SETLOCAL DATA 'MY_FIL2(%5)' SETLOCAL OPT '*' SETLOCAL LL -$IF NOT %7 == 0 $SETLOCAL LL ",'%DFLBL%'" SETLOCAL OPT -$IF NOT %8.== . $SETLOCAL DEF_IEBD %8 -* conditional interpolation flag -IF(G_NOINTERP, INT_DEFAULT('%1')=NO; - ELSE OPTION CLEAR=UNCD7; CNT = (%DEF_IEBD%+(3-%DEF_IEBD%)$IE_DEFAULT('%1'))$%7; - IF(CNT=0, UNCD7(%2%LL%,%3%4)$(%1(%2,'%DFLBL%',%3)>0) = YES; -%OPT% ELSE UNCD7(%2,LL--ORD(LL),%3%4) $= %1(%2,LL,%3); -%OPT% UNCD7(%2,LL,%3%4)$((%9(%1(%2,'%DFLBL%',%3)) LE -.5)$%1(%2,'%DFLBL%',%3)) = NO; - ); - LOOP(UNCD7(%2%LL%,%3%4), DFUNC = CNT; DFUNC $= ROUND(%1(%2,'%DFLBL%',%3)); - MY_ARRAY(DM_YEAR) = %1(%2,DM_YEAR,%3); OPTION CLEAR=MY_FIL2; -* do interpolate - IF(DFUNC NE 10, LAST_VAL=0; F = 0; Z = 0; - LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), ! check for nonzero (including EPS) - MY_F = MY_ARRAY(DM_YEAR); Z = YEARVAL(DM_YEAR); - IF(LAST_VAL, - IF((Z GT DFUNC)$(DFUNC GT 999), ! exponential function - %DATA%$((Z>YEARVAL(%5))$(YEARVAL(%5)>MY_FYEAR)) - = LAST_VAL*POWER(1+MY_F,YEARVAL(%5)-MY_FYEAR)+EPS; - MY_F = LAST_VAL*POWER(1+MY_F,Z-MY_FYEAR)+EPS; - MY_FIL2(DM_YEAR) = MY_F; ! overwrite old data - ELSE ! linear interpolation - %DATA%$((Z>YEARVAL(%5))$(YEARVAL(%5)>MY_FYEAR)) - = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(YEARVAL(%5)-MY_FYEAR); - ); - ELSE F = Z; FIRST_VAL = MY_F); - LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year -%OPT% ELSE FIRST_VAL = 0; MY_FYEAR = 0; ! intra-period I/E -%OPT% LOOP(MY_FIL(LL)$MY_ARRAY(MY_FIL), ! check for data values -%OPT% MY_F = MY_ARRAY(LL); Z = YEARVAL(LL); F = FIL2(LL); -%OPT% IF(MY_FYEAR < F, IF(F > MIN(FIRST_VAL,Z), LAST_VAL = MY_F; FIRST_VAL = F); -%OPT% MY_FIL2(%5(LL+(F-YEARVAL(LL))))$(NOT MY_ARRAY(%5)) = LAST_VAL+(MY_F-LAST_VAL)/(Z-MY_FYEAR)*(F-MY_FYEAR)); -%OPT% LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year -%OPT% DFUNC = %7; - ); -%OPT% IF(FLOOR(DFUNC/10)=1, -%OPT% LOOP(MIYR_1(LL), MY_FYEAR=YEARVAL(LL); -%OPT% MY_F = FIL2(LL+(F-MY_FYEAR)); IF(MY_FZ,MY_FIL2(%5(LL+(MY_F-MY_FYEAR))) = LAST_VAL)); -%OPT% DFUNC=DFUNC-10); - IF(DFUNC NE %7, -* Do back/forward extrapolate, or fill in with EPS - IF(DFUNC LE 2, %DATA%$(%6$(NOT %DATA%+MY_ARRAY(%5))) = EPS; ELSE - IF(DFUNC EQ 4, Z = INF; ELSEIF DFUNC EQ 5, F = 0); - %DATA%$(%6) $= FIRST_VAL$(YEARVAL(%5)Z); - IF((NOT %7)$LAST_VAL, %DATA%$(%6$(NOT %DATA%+MY_ARRAY(%5)))=EPS); - )); %1(%2,%5,%3) $= %DATA%; - )); -* and reset OPT -$IF NOT %9==+ %1(%2,'%DFLBL%',%3)$((%1(%2,'%DFLBL%',%3)-%7)$%1(%2,'%DFLBL%',%3)) = MIN(%RESET%,%1(%2,'%DFLBL%',%3)); -$OFFLISTING diff --git a/source/preppm.mod b/source/preppm.mod deleted file mode 100644 index 646d189..0000000 --- a/source/preppm.mod +++ /dev/null @@ -1,250 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREPPM.MOD oversees all the enhanced interpolation activities -* %1 - mod or v# for the source code to be used -*=============================================================================* -$ SET RESET 0 -$ IFI %INTEXT_ONLY% == YES $SET RESET 15 -$ IFI %DATAGDX% == YES $BATINCLUDE prepxtra.mod SAVE -$ IFI %PREP_ANS%%RESET%==YES15 $BATINCLUDE prepxtra.mod POST -$ IFI %PREP_ANS% == YES $EXIT -*----------------------------------------------------------------------------- -* Ensure that both MODLYEAR and DATAYEAR include PASTYEAR -* Also set the special year among datayears for the processing of control options. - MODLYEAR(LL) = MILESTONYR(LL)+PASTYEAR(LL); - DATAYEAR(PASTYEAR) = YES; - DATAYEAR('%DFLBL%') = YES; -* Build DM_YEAR for interpolation, excluding the special year: - DM_YEAR(MILESTONYR) = YES; - DM_YEAR(DATAYEAR) = (YEARVAL(DATAYEAR)>0); -* Set migrating years MY_FIL, and FIL2 of each MY_FIL to the period year, if within periods: - LOOP(T,FIL2(DM_YEAR)$((YEARVAL(DM_YEAR) >= B(T)) * (YEARVAL(DM_YEAR) <= E(T))) = YEARVAL(T)); - MY_FIL(DM_YEAR)$(FIL2(DM_YEAR)*(NOT T(DM_YEAR))) = YES; -*----------------------------------------------------------------------------- -$IF DEFINED G_CUREX R_CUREX(R,CURR,CUR)$NO=0; R_CUREX(R,CURR,CUR)$(NOT R_CUREX(R,CURR,CUR))$=G_CUREX(CURR,CUR); -$IF DEFINED R_CUREX $INCLUDE curex -*----------------------------------------------------------------------------- -* Merge special case user attributes to generic case - LOOP(DATAYEAR,PRC_MARK(R,'%DFLBL%',P,P,C,BD)$FLO_MARK(R,DATAYEAR,P,C,BD) = 3); - PRC_MARK(R,DATAYEAR,P,P,C,BD) $= FLO_MARK(R,DATAYEAR,P,C,BD); -* Integration of COM costs - OBJ_COMNT(R,DATAYEAR,C,S,'COST',CUR) $= COM_CSTNET(R,DATAYEAR,C,S,CUR); - OBJ_COMNT(R,DATAYEAR,C,S,'TAX',CUR) $= COM_TAXNET(R,DATAYEAR,C,S,CUR); - OBJ_COMNT(R,DATAYEAR,C,S,'SUB',CUR) $= COM_SUBNET(R,DATAYEAR,C,S,CUR)*(-1); - OBJ_COMPD(R,DATAYEAR,C,S,'COST',CUR) $= COM_CSTPRD(R,DATAYEAR,C,S,CUR); - OBJ_COMPD(R,DATAYEAR,C,S,'TAX',CUR) $= COM_TAXPRD(R,DATAYEAR,C,S,CUR); - OBJ_COMPD(R,DATAYEAR,C,S,'SUB',CUR) $= COM_SUBPRD(R,DATAYEAR,C,S,CUR)*(-1); -* Integration of UC_COMxxx - UC_COM(UC_N,'PRD',SIDE,R,DATAYEAR,C,S,'COMPRD')$(NOT UC_ATTR(R,UC_N,SIDE,'COMPRD','NET')) $= UC_COMPRD(UC_N,SIDE,R,DATAYEAR,C,S); - UC_COM(UC_N,'PRD',SIDE,R,DATAYEAR,C,S,'COMCON')$(NOT UC_ATTR(R,UC_N,SIDE,'COMCON','NET')) $= UC_COMCON(UC_N,SIDE,R,DATAYEAR,C,S); - UC_COM(UC_N,'NET',SIDE,R,DATAYEAR,C,S,'COMPRD')$UC_ATTR(R,UC_N,SIDE,'COMPRD','NET') $= UC_COMPRD(UC_N,SIDE,R,DATAYEAR,C,S); - UC_COM(UC_N,'NET',SIDE,R,DATAYEAR,C,S,'COMCON')$UC_COMCON(UC_N,SIDE,R,DATAYEAR,C,S) = UC_COMCON(UC_N,SIDE,R,DATAYEAR,C,S)*(-1); - UC_COM(UC_N,'NET',SIDE,R,DATAYEAR,C,S,'COMNET') $= UC_COMNET(UC_N,SIDE,R,DATAYEAR,C,S); -* Prepare flags for flow tax/sub - SET OBJ_VFLO(R,P,C,CUR,UC_COST); - SET RPC_CUR(REG,PRC,COM,CUR); - OPTION RPC_CUR <= FLO_TAX; OBJ_VFLO(RPC_CUR,'TAX') = YES; - OPTION RPC_CUR <= FLO_SUB; OBJ_VFLO(RPC_CUR,'SUB') $= OBJ_VFLO(RPC_CUR,'TAX'); - FLO_TAX(R,LL--ORD(LL),P,C,S,CUR)$((NOT FLO_TAX(R,'%DFLBL%',P,C,S,CUR))$FLO_TAX(R,LL,P,C,S,CUR)$OBJ_VFLO(R,P,C,CUR,'SUB')) = 3; - FLO_SUB(R,LL--ORD(LL),P,C,S,CUR)$((NOT FLO_SUB(R,'%DFLBL%',P,C,S,CUR))$FLO_SUB(R,LL,P,C,S,CUR)$OBJ_VFLO(R,P,C,CUR,'SUB')) = 3; -*----------------------------------------------------------------------------- -* Starting data pre-preprocessing with temporary control sets for parameters -$IF NOT SET DEF_IEBD $SET DEF_IEBD 10 - IE_DEFAULT(INT_DEFAULT) = 3; -$IF SET RETIRE $BATINCLUDE prepret.dsc PREP PRC_RCAP RCAP_BND -*----------------------------------------------------------------------------- -* Use RVP for extrapolating vintaged flow parameters -$ BATINCLUDE fillvint - RVP(RTP(R,V,P))$PRC_VINT(R,P) = YES; -*----------------------------------------------------------------------------- -* Interpolation Options -* ===================== -* The placeholder for the option flag is parameter data point of year zero. -* Example: NCAP_COST(R,'0',P,CUR) is an option for NCAP_COST(R,T,P,CUR). -* Available option codes: See documentation -* -* Interpolation can be effectively denied for non-cost parameters only. -* -*============================================================================= -* COST PARAMETERS: Interpolated by COEF_OBJ, only special options processed here -*----------------------------------------------------------------------------- -* General attributes -*----------------------------------------------------------------------------- -*$BATINCLUDE prepparm G_DRATE R CUR ",'0','0','0','0'" YEAR 1 1 -$BATINCLUDE filparam G_RFRIR 'R,' '' ",'0','0','0','0','0'" YEAR V -*----------------------------------------------------------------------------- -* Capacity related attributes -*----------------------------------------------------------------------------- -$BATINCLUDE prepparm NCAP_COST R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_DCOST R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_DLAGC R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_FOM R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_FSUB R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_FTAX R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_ISUB R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_ITAX R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_VALU R 'P,C,CUR' ",'0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm NCAP_ISPCT R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 0 -*----------------------------------------------------------------------------- -* Commodity related attributes -*----------------------------------------------------------------------------- -$BATINCLUDE prepparm OBJ_COMNT R 'C,TS,COSTYPE,CUR' ",'0','0'" T 1 0 -$BATINCLUDE prepparm OBJ_COMPD R 'C,TS,COSTYPE,CUR' ",'0','0'" T 1 0 -*----------------------------------------------------------------------------- -* Flow related attributes & inter-regional exchange flows (6) -*----------------------------------------------------------------------------- -$BATINCLUDE prepparm ACT_COST R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm FLO_COST R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm FLO_DELIV R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm FLO_SUB R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm FLO_TAX R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 -$BATINCLUDE prepparm IRE_PRICE R 'P,C,TS,ALL_REG,IE,CUR' "" V 'RTP(R,V,P)' 0 -$IF DEFINED DAM_COST $BATINCLUDE prepparm DAM_COST R 'C,CUR' ",'0','0','0'" T 1 EPS 3 -*============================================================================= -***** REGULAR NON-COST PARAMETERS: Interpolated over DM_YEAR by default ****** -*----------------------------------------------------------------------------- -* Capacity related attributes -*----------------------------------------------------------------------------- -$BATINCLUDE fillparm NCAP_AF R 'P,TS,BD' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPSB -$BATINCLUDE fillparm NCAP_AFA R 'P,BD' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPB -$BATINCLUDE fillparm NCAP_AFS R 'P,TS,BD' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPSB -$BATINCLUDE fillparm NCAP_BPME R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_CDME R P ",'0','0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_CEH R P ",'0','0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_CHPR R 'P,BD' ",'0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPB -$BATINCLUDE fillparm NCAP_CLED R 'P,C' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_CLAG R 'P,C,IO' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_COM R 'P,C,IO' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_DELIF R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_DLAG R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_DLIFE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_DRATE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_FDR R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_ELIFE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_ICOM R 'P,C' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_ILED R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -$BATINCLUDE fillparm NCAP_OCOM R 'P,C' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_PKCNT R 'P,TS' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm NCAP_TLIFE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP -*----------------------------------------------------------------------------- -* Commodity related attributes -*----------------------------------------------------------------------------- -$BATINCLUDE fillparm COM_AGG R 'C,COM' ",'0','0','0','0'" T 1 'GE 0' -$BATINCLUDE fillparm COM_ELAST R 'C,TS,L' ",'0','0','0'" T 1 'GE 0' -$BATINCLUDE fillparm COM_FR R 'C,TS' ",'0','0','0','0'" T 1 'GE 0' X_RCS -$BATINCLUDE fillparm COM_IE R 'C,TS' ",'0','0','0','0'" T 1 'GE 0' -$BATINCLUDE fillparm COM_PKFLX R 'C,TS' ",'0','0','0','0'" T 1 'GE 0' -$BATINCLUDE fillparm COM_PKRSV R C ",'0','0','0','0','0'" T 1 'GE 0' -$BATINCLUDE fillparm COM_PROJ R C ",'0','0','0','0','0'" T 1 'GE 0' -$BATINCLUDE fillparm COM_VOC R 'C,BD' ",'0','0','0','0'" T 1 'GE 0' -*----------------------------------------------------------------------------- -* Flow related attributes & inter-regional exchange -*----------------------------------------------------------------------------- -$BATINCLUDE fillparm ACT_CSTUP R 'P,TSL,CUR' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm ACT_CSTSD R 'P,UPT,BD,CUR' ",'0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm ACT_CSTRMP R 'P,BD,CUR' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm ACT_TIME R 'P,LIM' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm FLO_FUNC R 'P,CG1,CG2,TS' ",'0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGGS -$BATINCLUDE fillparm FLO_PKCOI R 'P,C,TS' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm FLO_SUM R 'P,CG1,C,CG2,TS' ",'0'" V 'RVP(R,V,P)' 'GE 0' X_RPGCGS -$BATINCLUDE fillparm PRC_ACTFLO R 'P,CG' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPG -$BATINCLUDE prepparm PRC_MARK R 'P,ITEM,C,BD' ",'0'" T 1 1 11 -$BATINCLUDE fillparm IRE_FLO R 'P,C,REG,COM,TS' ",'0'" V '(RVP(R,V,P) OR RTP(REG,V,P))' 'GE 0' -$BATINCLUDE fillparm IRE_FLOSUM R 'P,C,TS,IE,COM,IO' "" V 'RVP(R,V,P)' 'GE 0' -*----------------------------------------------------------------------------- -* Storage attributes -*----------------------------------------------------------------------------- -$BATINCLUDE fillparm STG_CHRG R 'P,S' ",'0','0','0','0'" V '(M(V) GE MIYR_V1-1)' 'GE 0' -$BATINCLUDE fillparm STG_EFF R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm STG_LOSS R 'P,S' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' -$BATINCLUDE fillparm STG_SIFT R 'P,C,S' ",'0','0','0'" T 'RTP(R,T,P)' 'GE 0' -*----------------------------------------------------------------------------- -* User constraints -*----------------------------------------------------------------------------- -$BATINCLUDE fillparm UC_ACT 'UC_N,SIDE,R' 'P,TS' ",'0','0'" T 'RTP(R,T,P)' 'GE 0' -$BATINCLUDE fillparm UC_CAP 'UC_N,SIDE,R' P ",'0','0','0'" T 1 'GE 0' -$BATINCLUDE fillparm UC_COM 'UC_N,COM_VAR,SIDE,R' 'C,TS,UC_GRPTYPE' "" T 1 'GE 0' -$BATINCLUDE fillparm UC_FLO 'UC_N,SIDE,R' 'P,C,TS' ",'0'" T 1 'GE 0' -$BATINCLUDE fillparm UC_IRE 'UC_N,SIDE,R' 'P,C,TS,IE' "" T 'RTP(R,T,P)' 'GE 0' -$BATINCLUDE fillparm UC_NCAP 'UC_N,SIDE,R' P ",'0','0','0'" T 'RTP(R,T,P)' 'GE 0' -$BATINCLUDE fillparm UC_UCN 'UC_N,SIDE,R' UCN ",'0','0','0'" T 1 'GE 0' -$BATINCLUDE filparam UC_TIME 'UC_N,R,' '' ",'0','0','0'" DATAYEAR T '' '' '' "YEAR," -*============================================================================= -******* NON-REGULAR NON-COST PARAMETERS: NOT interpolated by default ********* -*----------------------------------------------------------------------------- -* Capacity and commodity related attributes -*----------------------------------------------------------------------------- -$BATINCLUDE prepparm CAP_BND R 'P,BD' ",'0','0','0'" T 'RTP(R,T,P)' 1 -$BATINCLUDE prepparm NCAP_BND R 'P,LIM' ",'0','0','0'" T 'RTP(R,T,P)' 1 -$BATINCLUDE prepparm COM_BNDNET R 'C,TS,BD' ",'0','0'" T 1 1 -$BATINCLUDE prepparm COM_BNDPRD R 'C,TS,BD' ",'0','0'" T 1 1 -*----------------------------------------------------------------------------- -* Flow related attributes & inter-regional exchange -*----------------------------------------------------------------------------- -$BATINCLUDE prepparm ACT_BND R 'P,TS,BD' ",'0','0'" T 'RTP(R,T,P)' 1 -$BATINCLUDE prepparm FLO_BND R 'P,CG,TS,BD' ",'0'" T 'RTP(R,T,P)' 1 -$BATINCLUDE prepparm FLO_FR R 'P,C,TS,LIM' ",'0'" T 'RTP(R,T,P)' 1 -$BATINCLUDE prepparm FLO_SHAR R 'P,C,CG,TS,BD' "" V 'RVP(R,V,P)' 1 '' + -$BATINCLUDE prepparm IRE_BND R 'C,TS,ALL_REG,IE,BD' "" T 1 1 -$BATINCLUDE prepparm IRE_XBND ALL_REG 'C,TS,IE,BD' ",'0'" T 1 1 -*----------------------------------------------------------------------------- -* Storage attributes -*----------------------------------------------------------------------------- -$BATINCLUDE prepparm STGIN_BND R 'P,C,S,BD' ",'0'" T 'RTP(R,T,P)' 1 -$BATINCLUDE prepparm STGOUT_BND R 'P,C,S,BD' ",'0'" T 'RTP(R,T,P)' 1 -*----------------------------------------------------------------------------- -* User constraints -*----------------------------------------------------------------------------- -$BATINCLUDE prepparm UC_RHSRT 'ALL_R,UC_N' LIM ",'0','0','0'" T 1 1 -$BATINCLUDE prepparm UC_RHSRTS 'ALL_R,UC_N' 'TS,LIM' ",'0','0'" T 1 1 -$BATINCLUDE prepparm UC_RHST UC_N LIM ",'0','0','0','0'" T 1 1 -$BATINCLUDE prepparm UC_RHSTS UC_N 'TS,LIM' ",'0','0','0'" T 1 1 -$BATINCLUDE prepparm REG_BNDCST R 'COSTAGG,CUR,BD' ",'0','0'" T 1 1 -*----------------------------------------------------------------------------- -* Parameters that are by default inter/extrapolated over PASTYEARS -*----------------------------------------------------------------------------- -$ BATINCLUDE prepparm FLO_SHAR R 'P,C,CG,TS,BD' "" PASTMILE 'RVP(R,PASTMILE,P)' 1 3 -ABS -*----------------------------------------------------------------------------- -*============================================================================= -* Additions through extensions: -*------------------------------------------------------------------------------ -$ IFI %STAGES% == YES $BATINCLUDE prep_ext.stc -$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod prep_ext %EXTEND% -$ IFI %INTEXT_ONLY%==YES $BATINCLUDE prepxtra.mod XTIE -*============================================================================= -***************************** SHAPE/MULTI INDEXES **************************** -*----------------------------------------------------------------------------- -$BATINCLUDE preshape NCAP_AFX R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape NCAP_AFSX R 'P,BD' ",'0','0','0'" V UNCD7 RTP(R,V,P) -$BATINCLUDE preshape NCAP_AFM R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape NCAP_FOMX R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape NCAP_FSUBX R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape NCAP_FTAXX R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape FLO_FUNCX R 'P,CG1,CG2' ",'0','0'" V UNCD7 RTP(R,V,P) -$BATINCLUDE preshape COM_ELASTX R 'C,BD' ",'0','0','0'" T UNCD7 1 15 -$BATINCLUDE preshape NCAP_FOMM R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape NCAP_FSUBM R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape NCAP_FTAXM R P "" V RXX RTP(R,V,P) -$BATINCLUDE preshape NCAP_CPX R P "" V RXX RTP(R,V,P) -*----------------------------------------------------------------------------- -* All non-cost parameters have now been interpolated / extrapolated and user-defined options processed. -* Second interpolation pass is still needed for cost parameters (dense interpolation). - OPTION CLEAR = UNCD7; -*----------------------------------------------------------------------------- -* Augment datayear with MILESTONYR, as any MODLYEAR may now contain user data. -* Remove the special year from DATAYEAR, as the controls are processed. - DATAYEAR(MILESTONYR) = YES; - DATAYEAR('%DFLBL%') = NO; -*----------------------------------------------------------------------------- -* Optional weighting of vintaged attributes -$IF NOT %VINTOPT%==1 $EXIT -$BATINCLUDE fillvint FLO_FUNC R 'P,CG1,CG2,TS' X_RPGGS -$BATINCLUDE fillvint FLO_SUM R 'P,CG1,C,CG2,TS' X_RPGCGS -$BATINCLUDE fillvint NCAP_CDME R P X_RP -$BATINCLUDE fillvint NCAP_CHPR R 'P,BD' X_RPB -$BATINCLUDE fillvint FLO_SHAR R 'P,C,CG,TS,BD' X_RPCGSB -OPTION CLEAR=PASTSUM; -*----------------------------------------------------------------------------- \ No newline at end of file diff --git a/source/preppm.msa b/source/preppm.msa deleted file mode 100644 index 881e9e0..0000000 --- a/source/preppm.msa +++ /dev/null @@ -1,78 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* PREPPM.MSA Preprocessing for Macro Stand-Alone -*============================================================================* -$GOTO %1 -*---------------------------------------------------------------------------- -$LABEL MSA -$SETGLOBAL MSA CSA -$IF NOT %MACRO%==N $SETGLOBAL MSA %MACRO% -$KILL TM_UDF -$IFI %MSA%==MSA $BATINCLUDE MSADDF.dd -*---------------------------------------------------------------------------- - ALIAS(IPS,MDM); - SET CM_LPK(*), CM_LPT(*), XTP(LL); - PARAMETER CM_LED(LL), TM_XWT(R,LL); -* Periods stuff - ALIAS(TB,T_1); - PP(T)$(ORD(T)>1) = YES; - TB(T)$(ORD(T)=1) = YES; - TLAST(T--ORD(T)) = YES; - NYPER(T) = LAGT(T); - NYPER(TLAST(T+1)) = LAGT(T); - CM_LED(T+1)=LAGT(T); - XTP(LL)$=CM_LED(LL); - XTP(T) = YES; -* Interpolate MACRO-specific parameters -$ BATINCLUDE filparam TM_DDF 'R,' 'C' ",'','','','',''" YEAR T '' '' -$ BATINCLUDE filparam TM_GR 'R,' '' ",'','','','',''" YEAR T '' '' -$ BATINCLUDE filparam TM_GROWV 'R,' '' ",'','','','',''" YEAR XTP '' '' -$ BATINCLUDE filparam TM_HSX 'R,' '' ",'','','','',''" YEAR XTP '' '' - TM_GDPGOAL(R,TB) = TM_GDP0(R); - LOOP(PP(T+1),TM_GDPGOAL(R,PP) = TM_GDPGOAL(R,T)*(1+TM_GR(R,T)/100)**NYPER(T)); -$IFI NOT %MSA%%CLI%==MSAYES $EXIT -*---------------------------------------------------------------------------- -* Preprocess CBA parameters - Z = MAX(1,ABS(TM_DEFVAL('REFTEMP'))); - F = MAX(0,ROUND(TM_DEFVAL('REFLOSS'),4)); - TM_DAM(R,'IN')$= TM_MDTL(R)$TM_GDP0(R); - TM_DAM(R,'IN')$= TM_MDTQ(R)$TM_GDP0(R); - OPTION TM_CATT < TM_HSX; - TM_CATT(R)$TM_CATT(R) = ((Z**2/F)**0.5)$F; - TM_DAM(R,'N')$= TM_CATT(R)$TM_GDP0(R); - MR(R) = SUM((TM_DAM(R,MDM),G_RCUR(R,CUR)),1); - CNT=SMAX(MR,TM_GDP0(MR)); - LOOP(MR(R)$CNT,IF(TM_GDP0(R)=CNT,CNT=0;TM_DAM(R,'0')=YES)); -* Define initial guess for marginal damage for LP - LOOP((G_RCUR(R,CUR),C(CG(CM_EMIS)))$TM_DAM(R,'0'),DAM_BQTY(R,C) = EPS; - DAM_COST(R,PP(T),C,CUR) = 1/TM_SCALE_CST / 10**(3.4-2$DIAG('CO2-GTC',C)) * - SUM(MR(REG),MAX(.01,(2*Z/POWER(TM_CATT(R),2))$TM_CATT(R)+TM_MDTL(R)/Z+2*TM_MDTQ(R)/Z)*TM_GDPGOAL(REG,T))); - CM_LPK(CM_KIND)=YES; CM_LPT(CM_TKIND)=YES; - MR(R)=NO; -$EXIT -*---------------------------------------------------------------------------- -$LABEL TONLP -* Update forcing functions, reset damage and climate module -$IF DEFINED TM_CATT LOOP(G_RCUR(R,CUR)$TM_DAM(R,'0'),DAM_COST(R,PP,C(CG(CM_EMIS)),CUR) = EPS); -$IF DEFINED DAM_COST $INCLUDE rpt_dam.mod -$IFI NOT %CLI%==YES $EXIT -$ INCLUDE forcupd.cli -$IF NOT DEFINED TM_CATT $EXIT - LOOP(G_RCUR(R,CUR)$TM_DAM(R,'0'), - F=REG_WOBJ(R,'DAM-EXT+',CUR); MY_F=REG_WOBJ(R,'DAS',CUR); Z=MAX(0,MIN(MY_F,-F)); - REG_WOBJ(R,'DAS',CUR)=MY_F-Z; REG_WOBJ(R,'DAM-EXT+',CUR)=F+Z); - CM_MAXC_M(CM_EMIS,XTP) = VAR_CLITOT.LO(CM_EMIS,XTP); - IF(CARD(TM_DAM),CM_TKIND(CM_EMIS)=NO; VAR_CLITOT.FX(CM_EMIS,XTP)=VAR_CLITOT.L(CM_EMIS,XTP); - ELSE OPTION CLEAR=CM_KIND,CLEAR=CM_TKIND); -$EXIT -*---------------------------------------------------------------------------- -$LABEL TOLP -* Redefine marginal damages - LOOP((C(CG(CM_EMIS)),G_RCUR(R,CUR))$(CNT$TM_DAM(R,'0')), - DAM_COST(R,PP(T),C,CUR) = SUM(SUPERYR(T,XTP),ABS(VAR_CLITOT.M(CM_EMIS,XTP)/EQ_TRDBAL.M(T,"NMR"))*CM_EVAR(CM_EMIS,XTP)*OBJ_DISC(R,XTP,CUR)/OBJ_DISC(R,T,CUR)/TM_SCALE_CST)); - CM_TKIND(CM_VAR(CM_LPT))=YES; CM_KIND(CM_VAR(CM_LPK))=YES; - VAR_CLITOT.LO(CM_EMIS,XTP) = CM_MAXC_M(CM_EMIS,XTP); - VAR_CLITOT.UP(CM_EMIS,XTP) = INF; diff --git a/source/prepret.dsc b/source/prepret.dsc deleted file mode 100644 index 4242bee..0000000 --- a/source/prepret.dsc +++ /dev/null @@ -1,150 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREPRET.dsc oversees pre-processing for retirements -*=============================================================================* -* Questions/Comments: -*----------------------------------------------------------------------------- -$SET MIP %SOLMIP%==YES -$GOTO %1 -*----------------------------------------------------------------------------- -$LABEL PREP -$SET TST %2 -$IF DEFINED PRC_REFIT SET %2 //; PARAMETER %3 //; -$IFI '%RETIRE%'==NO $KILL %2 -$IF DEFINED %2 PARAMETER %3 //; %3(R,'0',P,'N')$(%3(R,'0',P,'N')=0)$=%2(R,P); -$IFI '%RETIRE%'==YES $SHIFT - PRC_REFIT(RP,P)$0=0; -$IF NOT DEFINED %2 $EXIT -* Declarations - SET VNRET(YEAR,LL); PARAMETER RP_RTF(R,P); -* Interpolate RCAP_BND -$IF %TST%==%1 OPTION %TST% < %2; -$ BATINCLUDE fillparm RCAP_BLK R 'P' ",'','','','',''" V 'RTP(R,V,P)' 'GE 0' -$ BATINCLUDE prepparm RCAP_BND R 'P,L' ",'','',''" V 'RTP(R,V,P)' 1 -$IF DEFINED NCAP_OLIFE $BATINCLUDE fillparm NCAP_OLIFE R P ",'','','','',''" V 'RTP(R,V,P)' 'GE 0' -$IF DEFINED NCAP_OLIFE OPTION PRC_CAP < NCAP_ELIFE; NCAP_ELIFE(R,V,P)$(NOT PRC_CAP(R,P)) $= NCAP_OLIFE(R,V,P); PRC_CAP(R,P)=0; -* Preprocess refits - LOOP((RP(R,PRC),P)$(RP(R,P)$PRC_REFIT(RP,P)), - NCAP_ILED(RTP(R,V,P)) = -ABS(NCAP_ILED(RTP)); - PRC_RCAP(RP)=YES; TRACKP(R,P)$(PRC_REFIT(RP,P)<0)=YES); - RTP_VARP(RTP(R,T,P)) $= PRC_RCAP(R,P); - PRC_RCAP(TRACKP)=YES; OPTION CLEAR=TRACKP; -* Activate MIP solution if requested -$IFI %DSC%==YES $SETGLOBAL SOLMIP %RETIRE% -$IFI %RETIRE%==MIP $SETGLOBAL SOLMIP YES -$EXIT -*----------------------------------------------------------------------------- -$LABEL DECL -$IF %MIP% INTEGER - VARIABLE %VAR%_DRCAP(R,ALLYEAR,LL,P%SWD%,J); - EQUATION %EQ%_DSCRET(R,ALLYEAR,ALLYEAR,P%SWTD%); -* Maps for refit vintages & types - LOOP(PRC_RCAP(R,PRC), F=0; MY_F=0; CNT=EPS; - LOOP(P$PRC_REFIT(R,PRC,P),Z=PRC_REFIT(R,PRC,P); CNT$CNT=CNT+1; - IF(ABS(Z)>2, F=F+1); IF(MOD(Z,2)=0,MY_F$(ABS(Z)-4)=3); - IF(Z<0,RTP_TT(R,T,TT,PRC)$COEF_CPT(R,T,TT,P)=YES; - ELSE RTP_TT(R,T,T,PRC)$RTP(R,T,P)=YES; CNT=0;)); - IF(CNT,Z=(-1+2$(F=CNT))*MAX(1,MY_F); ELSE Z=-2); - IF(NOT MAPVAL(CNT),RP_RTF(R,PRC) = Z); - IF(F,RCAP_BND(RTP(R,T,PRC),'UP')$(NOT SUM(P$PRC_REFIT(R,PRC,P),RTP(R,T,P)$(ABS(PRC_REFIT(R,PRC,P))>2)))=EPS)); -$EXIT -*----------------------------------------------------------------------------- -$LABEL EQOBJ -$SETGLOBAL RCAPSUB -SUM(VNRET(V,T),%VART%_SCAP(R,V,T,P%SWS%))$PRC_RCAP(R,P) -$SETGLOBAL RCAPSBM -SUM(VNRET(MODLYEAR,T),%VART%_SCAP(R,MODLYEAR,T,P%SWS%))$PRC_RCAP(R,P) -* Force obj type 2a/2b - VNRET(VNT(V,T))$(NOT SAMEAS(V,T)) = YES; - RVPRL(RTP(R,V,P))$PRC_RCAP(R,P)=MAX(0,SMAX(RTP_CPTYR(R,VNRET(V,T),P),YEARVAL(T))-YEARVAL(V)); - RVP(RTP) $= RVPRL(RTP); - NCAP_ILED(RVP) = NCAP_ILED(RVP)+EPS; -*------------------- - -* Allow retirements in integer multiples of a user-defined block-size or the full residual capacity - %EQ%_DSCRET(RTP_CPTYR(%R_V_T%,P)%SWT%)$(VNRET(V,T)$RCAP_BLK(R,V,P)).. - - %VAR%_SCAP(R,V,T,P%SOW%) - RTFORC(R,V,T,P) =E= - RCAP_BLK(R,V,P) * %VAR%_DRCAP(R,V,T,P%SOW%,'2') + (NCAP_PASTI(R,V,P)-RTFORC(R,V,T,P)) * %VAR%_DRCAP(R,V,T,P%SOW%,'1'); - -* Cumulative retirements - %EQ%_CUMRET(R,VNRET(V,K(T-1)),P%SWT%)$(RTP_CPTYR(R,V,T,P)$PRC_RCAP(R,P)).. - - SUM(RTP_CPTYR(R,V,MODLYEAR(K),P),%VAR%_SCAP(R,V,T,P%SOW%)-%VAR%_RCAP(R,V,T,P%SOW%)-%VARM%_SCAP(R,V,K,P%SWS%)) - =E= 0; - -* Maximum salvage capacity - %EQ%L_SCAP(RTP(R,V(LL),P),IPS%SOW%)$(((OBJ_SUMS(RTP)+(NOT PRC_VINT(R,P))$T(V))$RVPRL(RTP)$L(IPS) OR NCAP_OLIFE(RTP)$IO(IPS))$PRC_RCAP(R,P)).. - - SUM(IO(IPS),SUM((RTP_CPTYR(R,V,TT,P),PRC_TS(R,P,S)),%VARTT%_ACT(R,V,TT,P,S%SWS%)*FPD(TT))/PRC_CAPACT(R,P)/NCAP_OLIFE(RTP)) + - SUM(VNRET(V,T(LL+RVPRL(RTP))),%VART%_SCAP(R,V,T,P%SWS%))$LIM(IPS) - - =L= %VARV%_NCAP(R,V,P%SWS%)$T(V) + NCAP_PASTI(R,V,P) - %VAR%_SCAP(R,V,'0',P%SOW%)$OBJ_SUMS(R,V,P)$RVPRL(R,V,P); - -* Retrofits and life-extensions - %EQ%L_REFIT(RTP_TT(R,TT,T,PRC),LNX(L)%SWT%)$((BD(L)+VNT(T,TT)$(RP_RTF(R,PRC)=3))$RT_PP(R,T)).. - SUM((V(TT),P)$((VNT(T,V) OR PRC_REFIT(R,PRC,P)<0)$PRC_REFIT(R,PRC,P)),COEF_CPT(R,V,T,P)*(%VARV%_NCAP(R,V,P%SWS%)%RCAPSUB%))+%VAR%_RCAP(R,T,TT,PRC%SOW%)$(RP_RTF(R,PRC)$VNT(T,TT)$BD(L)<3) - =E= - SUM(RTP_CPTYR(R,VNRET(V,TT),PRC),COEF_CPT(R,V,T,PRC) * (%VARTT%_SCAP(R,V,TT,PRC%SWS%)-SUM(MODLYEAR(K(TT-1))$VNRET(V,K),%VARM%_SCAP(R,V,K,PRC%SWS%)+MIN(INF$MOD(RP_RTF(R,PRC),2),RTFORC(R,V,TT,PRC)-RTFORC(R,V,K,PRC)))))+ - SUM(K(TT-1)$RTP_TT(R,K,T,PRC),%VAR%_RCAP(R,T,K,PRC%SOW%))$(RP_RTF(R,PRC)$BD(L)>0); -*----------------------------------------------------------------------------- -$IF %STAGES%==YES $%SW_TAGS% -* Set bounds for continuous retirements - RCAP_BND(R,T,P,BDNEQ) $= RCAP_BND(R,T,P,'FX'); - PASTSUM(RVP(R,V,P))$RCAP_BND(RVP,'N') = -(B(V)+NCAP_ILED(RVP)+ABS(RCAP_BND(RVP,'N'))); - PASTSUM(RVP)$((RCAP_BND(RVP,'N')<0)+MAPVAL(RCAP_BLK(RVP))) = MAX(1,ABS(PASTSUM(RVP))); - LOOP(TT(T--1),Z=ORD(T)-1; - %VAR%_RCAP.LO(RTP_CPTYR(R,VNRET(V,T),P)%SOW%)$RVP(R,V,P) = RCAP_BND(R,T,P,'LO')$(NOT MAPVAL(RCAP_BLK(R,V,P)))+MIN(0,RTFORC(R,V,T,P)-RTFORC(R,V,TT,P)$Z); - %VAR%_RCAP.UP(RTP_CPTYR(R,VNRET(V,T),P)%SOW%)$RCAP_BND(R,T,P,'UP') = - MIN(SMIN(PASTMILE(V),NCAP_PASTI(R,V,P)),RCAP_BND(R,T,P,'UP')+MAX(0,RTFORC(R,V,T,P)-RTFORC(R,V,TT,P)$Z))); - %VAR%_SCAP.LO(RTP_CPTYR(R,V,T,P)%SOW%)$RVP(R,V,P) = MAX(RCAP_BND(R,T,P,'LO'),RTFORC(R,V,T,P)); - %VAR%_SCAP.UP(RTP_CPTYR(R,PASTMILE(V),T,P)%SOW%)$RVP(R,V,P) = MAX(RTFORC(R,V,T,P),NCAP_PASTI(R,V,P)); - LOOP(RVP(R,V,P),Z=1;LOOP(RTP_CPTYR(R,VNRET(V,T),P)$Z,Z=0; %VAR%_SCAP.UP(R,V,T,P%SOW%)=MIN(%VAR%_RCAP.UP(R,V,T,P%SOW%),%VAR%_SCAP.UP(R,V,T,P%SOW%)))); - %VAR%_SCAP.FX(RTP_CPTYR(R,V,T,P)%SOW%)$(((M(T) LT ABS(PASTSUM(R,V,P)))+((M(T)-LEAD(T))/PASTSUM(R,V,P) GE 1))$PASTSUM(R,V,P)) = RTFORC(R,V,T,P); -* Force refits = retirements on request - PRC_YMAX(PRC_RCAP(RP)) = MIN(0,SUM(P$PRC_REFIT(RP,P),MAX(EPS,3-ABS(PRC_REFIT(RP,P))))); - RVPRL(R,'0',P) $= PRC_YMAX(R,P); - %VAR%_RCAP.UP(RTP_TT(R,T(TT++1),T,P)%SOW%)$((RP_RTF(R,P)<3)$PRC_YMAX(R,P))=MAX(0,SUM(RTP(R,PYR_S(V),P),RTFORC(R,V,T,P)-RTFORC(R,V,TT,P))$VNT(TT,T)$(MOD(RP_RTF(R,P),2)=0)); -$IF NOT %MIP% OPTION CLEAR=RCAP_BLK; -* Set bounds for integer retirements - IF(CARD(RCAP_BLK), RCAP_BLK(RTP)$(RCAP_BLK(RTP) LE 0) = 0; -* Define upper bound of 1 for binary variable if past investments - COEF_CAP(RTP_CPTYR(R,V,T,P))$RCAP_BLK(R,V,P) = (NCAP_PASTI(R,V,P)-RTFORC(R,V,T,P))/RCAP_BLK(R,V,P); - %VAR%_DRCAP.UP(RTP_CPTYR(R,V,T,P)%SOW%,'1')$PRC_RCAP(R,P) = 1$(ABS(COEF_CAP(R,V,T,P)-MIN(10,ROUND(COEF_CAP(R,V,T,P)))) >1E-9); -* Define upper bound for integer multiples - %VAR%_DRCAP.UP(RTP_CPTYR(R,V,T,P)%SOW%,'2')$RCAP_BLK(R,V,P) = MIN(10,FLOOR(%VAR%_SCAP.UP(R,V,T,P%SOW%)/RCAP_BLK(R,V,P)+1E-8)); - ); - RVPRL(R,PYR_S,P)$PRC_RESID(R,'0',P)=NO; NCAP_OLIFE(R,T,P)$(NOT PRC_VINT(R,P))=NO; - OPTION CLEAR=COEF_CAP,CLEAR=PASTSUM,CLEAR=RVP; -$EXIT -*----------------------------------------------------------------------------- -$LABEL OBJFIX -* Credit retired capacity for the avoided fixed costs - SUM((OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE),VNRET(V,T))$RVPRL(R,V,P), - SUM((INVSPRED(K_EOH,JOT,LL,K),KTYAGE(LL,T,Y_EOH,AGE))$OPYEAR(LIFE,AGE), - -OBJ_DISC(R,Y_EOH,CUR) * (1+RTP_CPX(R,V,P,T)$NCAP_CPX(R,V,P)) * %CAPWD% - ( - OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + - OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - - OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - ) - ) * - %VART%_SCAP(R,V,T,P %SWS%) / OBJ_DIVIV(R,V,P)) + - -* RESIDS require special handling - SUM(RTP_CPTYR(R,PYR_S(V(K)),T,P)$((NOT RVPRL(R,V,P))$PRC_RCAP(R,P)), - SUM(PERIODYR(T,Y_EOH), -OBJ_DISC(R,Y_EOH,CUR) * - ( - OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),MULTI(JJ,Y_EOH)-1)) + - OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),MULTI(JJ,Y_EOH)-1)) - - OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),MULTI(JJ,Y_EOH)-1)) - )) * - %VART%_SCAP(R,V,T,P %SWS%)) + -$EXIT -*----------------------------------------------------------------------------- -$LABEL OBSALV -* Discredit salvage value for retired capacity - SUM(OBJ_SUMS(R,V,P)$((NOT NCAP_FDR(R,V,P)$RVPRL(R,'0',P))$RVPRL(R,V,P)), - OBJSCC(R,V,P,CUR) * OBJ_DCEOH(R,CUR) * - (%VAR%_SCAP(R,V,'0',P%SOW%)-%VARV%_NCAP(R,V,P%SWS%)$T(V)-NCAP_PASTI(R,V,P))) + diff --git a/source/prepxtra.mod b/source/prepxtra.mod deleted file mode 100644 index 9f2e780..0000000 --- a/source/prepxtra.mod +++ /dev/null @@ -1,90 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* PREPONLY.MOD oversees that all inputs are interpolated when INTEXT_ONLY -*=============================================================================* -$ GOTO %1 -$ LABEL XTIE -*============================================================================= -* COST PARAMETERS: Interpolated by COEF_OBJ, only special options processed here -*----------------------------------------------------------------------------- -$ BATINCLUDE prepparm NCAP_COST R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_DCOST R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_DLAGC R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_FOM R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_FSUB R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_FTAX R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_ISUB R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_ITAX R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm NCAP_VALU R 'P,C,CUR' ",'0','0'" T 'RTP(R,T,P)' EPS 3 -*----------------------------------------------------------------------------- -* Commodity related attributes (6) -*----------------------------------------------------------------------------- -$ BATINCLUDE prepparm COM_CSTNET R 'C,S,CUR' ",'0','0'" T 1 EPS 3 -$ BATINCLUDE prepparm COM_CSTPRD R 'C,S,CUR' ",'0','0'" T 1 EPS 3 -$ BATINCLUDE prepparm COM_SUBNET R 'C,S,CUR' ",'0','0'" T 1 EPS 3 -$ BATINCLUDE prepparm COM_SUBPRD R 'C,S,CUR' ",'0','0'" T 1 EPS 3 -$ BATINCLUDE prepparm COM_TAXNET R 'C,S,CUR' ",'0','0'" T 1 EPS 3 -$ BATINCLUDE prepparm COM_TAXPRD R 'C,S,CUR' ",'0','0'" T 1 EPS 3 -*----------------------------------------------------------------------------- -* Flow related attributes & inter-regional exchange flows (6) -*----------------------------------------------------------------------------- -$ BATINCLUDE prepparm ACT_COST R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm FLO_COST R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm FLO_DELIV R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm FLO_SUB R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE prepparm FLO_TAX R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 -$ BATINCLUDE fillparm IRE_PRICE R 'P,C,S,ALL_R,IE,CUR' "" T 'RTP(R,T,P)' 'GE 0' -*----------------------------------------------------------------------------- -* Components of merged UC attribs -*----------------------------------------------------------------------------- -$ BATINCLUDE fillparm UC_COMCON 'UC_N,SIDE,ALL_R' 'C,S' ",'0','0'" T 1 'GE 0' -$ BATINCLUDE fillparm UC_COMNET 'UC_N,SIDE,ALL_R' 'C,S' ",'0','0'" T 1 'GE 0' -$ BATINCLUDE fillparm UC_COMPRD 'UC_N,SIDE,ALL_R' 'C,S' ",'0','0'" T 1 'GE 0' -*----------------------------------------------------------------------------- -* General attribs: -$ BATINCLUDE filparam MULTI 'J,' '' ",'','','','',''" LL MILESTONYR 'NO$' '' -$ BATINCLUDE filparam.gms G_DRATE 'R,' 'CUR' ",'','','','',''" YEAR T '' '' -*----------------------------------------------------------------------------- -$ LABEL POST - MODLYEAR(LL) = T(LL)+PASTYEAR(LL); -*----------------------------------------------------------------------------- -* Clean up some unwanted stuff -$IF DEFINED PRC_RESID LOOP(PYR_S(LL),NCAP_PASTI(R,LL,P)$PRC_RESID(R,'0',P)=0; NCAP_TLIFE(R,LL,P)$PRC_RESID(R,'0',P)=0); -$IF DEFINED PRC_RESID PRC_RESID(R,'0',P)=0; -*----------------------------------------------------------------------------- -* UC Default values -*----------------------------------------------------------------------------- -$ LABEL UCINT -* Check 'every T' specifications through using DFLBL: -* For T_SUM, fill in between user-specified year range or all - UC_DT(R,UC_N)$UC_T_SUM(R,UC_N,'%DFLBL%') = YES; UC_T_SUM(UC_DT,'%DFLBL%') = NO; - LOOP(UC_DT, Z=SMAX(UC_T_SUM(UC_DT,LL),ORD(LL)); - IF(Z > 0, F=SMIN(UC_T_SUM(UC_DT,LL),ORD(LL)); ELSE F=Z); - IF(Z NE F,UC_T_SUM(UC_DT,T(LL))$((ORD(LL) GT F)$(ORD(LL) LT Z)) = YES; - ELSE UC_T_SUM(UC_DT,T) = YES)); - OPTION CLEAR=UC_DT; - UC_T_SUCC(R,UC_N,T)$UC_T_SUCC(R,UC_N,'%DFLBL%') = YES; - UC_T_EACH(R,UC_N,T)$UC_T_EACH(R,UC_N,'%DFLBL%') = YES; - LOOP(T(YEAR), - UC_T_EACH(R,UC_N,LL+(ORD(YEAR)-ORD(LL)))$(EOHYEARS(LL)$PERIODYR(T,LL)$UC_T_EACH(R,UC_N,LL)) = YES; - UC_T_SUCC(R,UC_N,LL+(ORD(YEAR)-ORD(LL)))$(EOHYEARS(LL)$PERIODYR(T,LL)$UC_T_SUCC(R,UC_N,LL)) = YES; - UC_T_SUM(R,UC_N,LL+(ORD(YEAR)-ORD(LL)))$(EOHYEARS(LL)$PERIODYR(T,LL)$UC_T_SUM(R,UC_N,LL)) = YES; - ); -$ EXIT -*----------------------------------------------------------------------------- -$ LABEL SAVE -* Rename and move saved data GDX file - Z=CARD("%GDXPATH%%RUN_NAME%")+16; -$ SET GDATE '10000*MOD(GYEAR(JSTART),100)+100*GMONTH(JSTART)+GDAY(JSTART)' SET X1 -$ SET GTIME '10000*GHOUR(JSTART)+100*GMINUTE(JSTART)+GSECOND(JSTART)' SET X2 5 -$ IF %G2X6%%1==YESSAVE $SET X2 -$ IFI %G2X6%%1%X2%==YESSAVE5 - PUT QLOG; FILE.PW=512; PUT_UTILITY 'SHELL' / 'mv -f _dd_.gdx ' '%GDXPATH%%RUN_NAME%' @(Z+12) (%GTIME%+10**6):0:0 '.GDX' @(Z+5) (%GDATE%+10**6):0:0 "_" @Z '~Data_'; -$ LABEL PAD -$ IF %X2%0==0 $EVAL X1 '%X1%+1' EVAL X2 'TRUNC(LOG10(%GTIME%+.5))' EVAL GDATE '%GTIME%' SET GTIME %GDATE% -$ IF NOT %X2%==5 $EVAL X2 '%X2%+1' SET GDATE '0%GDATE%' GOTO PAD -$ IF %X1%==1 $SET X2 '' GOTO PAD -$ IF %X1%==2 $hiddencall mv -f _dd_.gdx "%GDXPATH%%RUN_NAME%~Data_%GDATE%_%GTIME%.gdx" diff --git a/source/preshape.gms b/source/preshape.gms deleted file mode 100644 index 22c30e8..0000000 --- a/source/preshape.gms +++ /dev/null @@ -1,49 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -******************************************************************************* -* PRESHAPE : Prepare SHAPE parameters for preprocessing -* Description: Interpolation of X parameter on user request -* Parameters: -* %1 - table name -* %2 - control set 1 -* %3 - control set 2 -* %4 - residual dimension for control tuple -* %5 - MODLYEAR or MILESTONYR depending on parameter -* %6 - temporary table of control tuples -* %7 - P/C -******************************************************************************* -*$ONLISTING -$EOLCOM ! -$SETLOCAL DEF 10 -$IF NOT '%8'=='' $SETLOCAL DEF %8 -OPTION CLEAR = %6; -%6(%2,LL--ORD(LL),%3%4) $= %1(%2,LL,%3); -LOOP(%6(%2,'%DFLBL%',%3%4), - DFUNC=%DEF%; DFUNC $= MOD(ROUND(%1(%2,'%DFLBL%',%3)),1000); - MY_ARRAY(DM_YEAR) = %1(%2,DM_YEAR,%3); - IF(DFUNC NE 10, F=0; LAST_VAL=0; -* do interpolate - LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), ! check for nonzero (including EPS) - MY_F = MY_ARRAY(DM_YEAR); Z = YEARVAL(DM_YEAR); - IF(LAST_VAL, %1(%2,%5,%3)$((Z GT YEARVAL(%5))$(YEARVAL(%5) GT MY_FYEAR)) = LAST_VAL; - ELSE F = Z; FIRST_VAL = MY_F); - LAST_VAL = ROUND(MY_F); MY_FYEAR=Z;); ! remember the value and year - ELSE FIRST_VAL = 0; MY_FYEAR = 0; ! intra-period I/E - LOOP(MY_FIL(LL)$MY_ARRAY(MY_FIL), ! check for data values - MY_F = MY_ARRAY(LL); Z = YEARVAL(MY_FIL); F = FIL2(MY_FIL); - IF(MY_FYEAR LT F, IF(F GT MIN(FIRST_VAL,Z), LAST_VAL = MY_F; FIRST_VAL = F;); - %1(%2,%5(LL+(F-YEARVAL(LL))),%3)$(NOT MY_ARRAY(%5)) = LAST_VAL); - LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year - DFUNC=0; - ); - IF(ROUND(DFUNC-5,-1) EQ 10, - %1(%2,%5,%3)$%7 $= FIRST_VAL$(YEARVAL(%5) LT F)$(E(%5) GE F) + LAST_VAL$(YEARVAL(%5) GT Z)$(B(%5) LE Z); - DFUNC=DFUNC-10); - IF(DFUNC GE 2, -* Do back/forward extrapolate - IF(DFUNC EQ 4, Z = INF; ELSEIF DFUNC EQ 5, F = 0); - %1(%2,%5,%3)$%7 $= FIRST_VAL$(YEARVAL(%5) LT F) + LAST_VAL$(YEARVAL(%5) GT Z); - ); - ); -$OFFLISTING - diff --git a/source/presolve.mlf b/source/presolve.mlf deleted file mode 100644 index eb71106..0000000 --- a/source/presolve.mlf +++ /dev/null @@ -1,103 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Presolve.mlf - Prepare coefficients for full MLF model -*------------------------------------------------------------------------------ - SET TM_DMAS(CG,CG) //; - SET TM_CES(CG) / AKL, YN /; - SET TM_RCJ(R,CG,J,BD) //; - SET LOGJ(J,BD) //; - - PARAMETERS TM_LOGJOT /0/, TM_LSC /0/ - TM_BASEPRI(R,T,CG) - TM_BASELEV(R,T,CG) - TM_PREF(R,T,CG) - TM_QREF(R,T,CG) - TM_SHAR(R,T,CG,CG) - TM_AGG(R,T,CG,CG) - TM_CESLEV(R,T,CG) - TM_AGC(R,T,CG,CG,J,BD) - TM_MIDCON(R,T) - TM_LOGVAL(J,BD); - -* Reset demand indicators - OPTION CLEAR=DM; DM(C)$=SUM(TM_DM(MR,C),1); - - TM_BASEPRI(MR,T,MAG(C))= ABS(EQ_DD.M(MR,T,C)*TM_AEEIFAC(MR,T,C)/TM_SCALE_NRG)/TM_DFACT(MR,T); - TM_BASEPRI(MR,T,'LAB') = ABS(EQ_LABOR.M(MR,T))/TM_DFACT(MR,T); - TM_BASEPRI(MR,T,'KN') = ABS(EQ_KNCAP.M(MR,T))/TM_DFACT(MR,T); - TM_BASEPRI(MR,T,'AKL') = ABS(EQ_AKL.M(MR,T))/TM_DFACT(MR,T); - TM_BASEPRI(MR,T,'YN') = ABS(EQ_PROD_Y.M(MR,T))/TM_DFACT(MR,T); - TM_BASELEV(MR,T,MAG) = VAR_D.L(MR,T,MAG); - TM_BASELEV(MR,T,'YN') = PAR_Y(MR,T); - TM_BASELEV(MR,T,'CON') = VAR_C.L(MR,T); - - TM_DMAS('AKL','KN')=YES; - TM_DMAS('AKL','LAB')=YES; - TM_DMAS('YN','AKL')=YES; - TM_DMAS('YN','ACT')=YES; - -* Calculate CES parameters - TM_PREF(MR(R),T,CG) $= TM_BASEPRI(R,T,CG); - TM_CESLEV(MR(R),T,TM_CES(CG)) = SUM(TM_DMAS(CG,CG1),TM_BASELEV(R,T,CG1)); - TM_PREF(MR(R),T,TM_CES(CG)) = SUM(TM_DMAS(CG,CG1),TM_BASELEV(R,T,CG1)*TM_PREF(R,T,CG1))/TM_CESLEV(R,T,CG); - TM_AGG(MR(R),T,CG1,TM_CES(CG))$TM_DMAS(CG,CG1)=1+(TM_BASEPRI(R,T,CG1)/TM_PREF(R,T,CG)-1)$TM_PREF(R,T,CG); -* Normalize TM_AGG - TM_QREF(MR(R),T,TM_CES(CG)) = SUM(TM_DMAS(CG,CG1),TM_AGG(R,T,CG1,CG)*TM_BASELEV(R,T,CG1)); - TM_AGG(MR(R),T,CG1,TM_CES(CG))$TM_AGG(R,T,CG1,CG)=TM_AGG(R,T,CG1,CG)*TM_CESLEV(R,T,CG)/TM_QREF(R,T,CG); -* Reset QREF and determine shares - TM_QREF(MR(R),T,CG) $= TM_BASELEV(R,T,CG); - TM_SHAR(MR(R),T,CG,CG1)$TM_DMAS(CG,CG1) = TM_BASELEV(R,T,CG1) / TM_CESLEV(R,T,CG); - TM_CIE(MR(R),T,TM_CES(CG))$TM_CESLEV(R,T,CG)= TM_QREF(R,T,CG) / TM_CESLEV(R,T,CG); -* Reverse RD_SHAR for CES aggregation - TM_SHAR(MR(R),T,CG1,CG)$TM_AGG(R,T,CG1,CG)=TM_AGG(R,T,CG1,CG)*TM_PREF(R,T,CG); - -* Prepare elasticity steps - LOOP(TM_DMAS(CG,CG1),Z=TM_DEFVAL('MACVOC'); - TM_STEP(R,CG1,BDNEQ)=TM_DEFVAL('MACSTEP'); - TM_VOC(MR(R),T,CG1,BDNEQ)=MIN(Z,Z/2+(M(T)-MIYR_V1)*0.01); - TM_RCJ(MR(R),CG1,J,BDNEQ)$(ORD(J)<=TM_STEP(R,CG1,BDNEQ))=YES); -* Cobb-Douglas function - TM_AGC(MR(R),T,CG('AKL'),CG1,J,BD)$((TM_VOC(R,T,CG1,BD)>0)$TM_RCJ(R,CG1,J,BD)$TM_DMAS(CG,CG1)) = -BDSIG(BD)* - LOG(1-BDSIG(BD)*ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD))/(ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD)); -* CES Production function - TM_AGC(MR(R),T,CG('YN'),CG1,J,BD)$((TM_VOC(R,T,CG1,BD)>0)$TM_RCJ(R,CG1,J,BD)$TM_DMAS(CG,CG1)) = BDSIG(BD)* - (1-(1-BDSIG(BD)*ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD))**(1-1/TM_ESUB(R)))/(ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD))/(1-1/TM_ESUB(R)); -* Restore PREF to BASEPRI - TM_PREF(MR(R),T,CG) $= TM_BASEPRI(R,T,CG); - -* Calculate demand parameters - TM_PREF(MR(R),T,C)$TM_DM(R,C) = DDF_PREF(R,T,C); - TM_QREF(MR(R),T,C)$TM_DM(R,C) = COM_PROJ(R,T,C); - TM_AGG(MR(R),T,DM(C),CG('ACT')) = TM_PREF(R,T,C)/TM_DMC(R,T,CG); - TM_SHAR(MR(R),T,CG('ACT'),C)$TM_DM(R,C) = TM_QREF(R,T,C) / TM_DEM(R,T,CG); - TM_SHAR(MR(R),T,C,CG('ACT'))$TM_DM(R,C) = TM_AGG(R,T,C,CG)*TM_DMC(R,T,CG); -* Prepare elasticity steps - Z=SMIN(PP(T),M(T)); - TM_STEP(TM_DM(RC),BDNEQ(BD))$(NOT TM_STEP(RC,BD))=55-5*BDSIG(BD); - TM_VOC(MR(R),T,C,'LO')$((NOT TM_VOC(R,T,C,'LO'))$TM_DM(R,C)) = MIN(0.45,0.15+(M(T)-Z)*.015); - TM_VOC(MR(R),T,C,'UP')$((NOT TM_VOC(R,T,C,'UP'))$TM_DM(R,C)) = 0.3/(1-TM_VOC(R,T,C,'LO'))+TM_VOC(R,T,C,'LO')-0.3; - TM_RCJ(TM_DM(MR,C),J,BDNEQ(BD))$(ORD(J)<=TM_STEP(MR,C,BD)) = YES; -* Demand CES aggregation - TM_AGC(MR(R),T,CG('ACT'),C,J,BD)$((TM_VOC(R,T,C,BD)>0)$TM_RCJ(R,C,J,BD)$TM_DM(R,C)) = BDSIG(BD)* - (1-(1-BDSIG(BD)*ORD(J)*TM_VOC(R,T,C,BD)/TM_STEP(R,C,BD))**(1-1/TM_DESUB(R)))/(ORD(J)*TM_VOC(R,T,C,BD)/TM_STEP(R,C,BD))/(1-1/TM_DESUB(R)); - -* Logarithmic utility from consumption - Z=TM_DEFVAL('LOGSTEP'); - LOGJ(J,BDNEQ(BD))$(ORD(J)<=ROUND(Z/2)) = YES; - TM_MIDCON(R,T) = TM_BASELEV(R,T,'CON')*0.5*SQRT(EXP(LOG(2)*1.1)); - TM_LOGJOT=LOG(2)/ROUND(Z/1.1); - TM_LOGVAL(LOGJ(J,BDNEQ(BD))) = (1-EXP(-BDSIG(BD)*ORD(J)*TM_LOGJOT))/(TM_LOGJOT*ORD(J)); - TM_LSC=ROUND(Z**.7,-1); - -*------------------------------------------------------------------------------ -* Reset bounds - VAR_K.UP(MR,T) = INF; - VAR_K.LO(MR,T) = 0; - VAR_D.UP(MR,T,MAG) = INF; - VAR_D.LO(MR,T,MAG) = 0; - VAR_D.FX(MR,T,'LAB') = TM_L(MR,T); - VAR_C.UP(MR(R),T)$(NOT TM_PP(R,T)) = VAR_C.L(R,T); - OPTION BRATIO=1; \ No newline at end of file diff --git a/source/readbprice.mod b/source/readbprice.mod deleted file mode 100644 index a150fff..0000000 --- a/source/readbprice.mod +++ /dev/null @@ -1,48 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Importing sol_bprice and assigning it to parameter COM_BPRICE -*=============================================================================* - PARAMETER SOL_BPRICE(R,YEAR,C,TS,CUR) //; - -$IF NOT ERRORFREE $EXIT -$KILL DAM_TVOC -$SET TMP com_bprice -$IFI %TIMESED%==YES $GOTO LOAD -$SETLOCAL TMP %GDXPATH%%TIMESED% -$IF EXIST %TMP%_DP.gdx $SETLOCAL TMP %TMP%_DP -$IF NOT EXIST %TMP%.gdx $DROPLOCAL TMP -$LABEL LOAD -$GDXIN %TMP% -$IF NOT ERRORFREE $GOTO FINISH -$IFI %MACRO%==MLF $SET MX SET MACRO 'Yes' -$LOAD sol_bprice -$IF NOT ERRORFREE $GOTO FINISH -$SETGLOBAL MX %MX% SET TIMESED 'YES' -$IF DEFINED DAM_ELAST $LOAD DAM_COEF -$IF DEFINED DAM_ELAST $LOAD DAM_TVOC -$IFI %MACRO%==MLF $LOAD SOL_ACFR -$GDXIN - - OPTION DEM < COM_PROJ; - DEM(R,C)$COM_TMAP(R,'DEM',C) = YES; -* Fill in missing tail milestoneyrs to reduce abruption - OPTION FORWARD < SOL_BPRICE; FIL(T) = PROD(FORWARD(TT),ORD(TT)0)+EPS; -DAM_TQTY(R,T,C)$TRACKC(R,C) $= DAM_TVOC(R,T,C,'N'); -OPTION CLEAR=DAM_TVOC,CLEAR=TRACKC; -*-------------------------------------------------------------------- -$LABEL FINISH -$IFI NOT %MACRO%==MLF $CLEARERROR diff --git a/source/recurrin.stc b/source/recurrin.stc deleted file mode 100644 index ac12963..0000000 --- a/source/recurrin.stc +++ /dev/null @@ -1,180 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* RECURRIN.stc oversees recurring stochastic definitions -* %1 - mod or v# for the source code to be used -*=============================================================================* -* Questions/Comments: -* -*----------------------------------------------------------------------------- -* Can we use macroes? -$SET TST NO -$IFI %OBMAC%==YES $SET TST YES -*----------------------------------------------------------------------------- -$GOTO %1 -*----------------------------------------------------------------------------- -$LABEL MXPAR -* Do we need MX parameter macroes? -$SET NEED NO -$IF DEFINED S_NCAP_AFS $SET NEED YES -$IF DEFINED S_COM_FR $SET NEED YES -$IFI %SPINES%==YES $SET NEED YES -$IF %NEED%==NO $GOTO NONEED -*--- -$IF %TST%==YES $GOTO DEFPAR -$error Macro support needed. Upgrade your GAMS system. -$clearerror -$KILL S_NCAP_AFS S_COM_FR -*--- -$LABEL NONEED -$EXIT -*--- -$LABEL DEFPAR -$SET SW1 '' SET SW2 '' -$IF NOT %STAGES%==YES $SET SW1 'SUM' SET SW2 SOW, -$SETGLOBAL MX MX -$macro MX -* Default case -$IF NOT DEFINED S_NCAP_AFS $MACRO COEF_AFMX COEF_AF -$IF NOT DEFINED S_COM_FR $MACRO RTCS_FRMX RTCS_FR -$IF NOT DEFINED S_COM_FR $MACRO COM_FRMX COM_FR -$IFI NOT %SPINES%==YES $MACRO PRC_DYNUCMX PRC_DYNUC -* Defined case -$IF DEFINED S_NCAP_AFS $MACRO COEF_AFMX(R,V,T,P,S,BD) COEF_AF(R,V,T,P,S,BD)*%SW1%(%SW2%1+RTP_SAFS(R,T,P,S,SOW)) -$IF DEFINED S_COM_FR PARAMETER RTCS_FRMX(R,T,C,S,S); -$IF DEFINED S_COM_FR $MACRO RTCS_FR(R,T,C,S,TS) RTCS_FRMX(R,T,C,S,TS)+SUM(SW_T2W(SOW,T,W,T0),RCS_SSFR(R,C,S,TS,W,T0)) -$IF DEFINED S_COM_FR $MACRO COM_FRMX(R,T,C,S) COM_FR(R,T,C,S)*%SW1%(%SW2%1+S_COM_FR(R,T,C,S,'1',SOW)) -$GOTO FINISH -*----------------------------------------------------------------------------- -$LABEL SPINES -* Do we need SPINES macroes? -$IFI NOT %SPINES%==YES $EXIT -$IF %TST%==NO $ABORT Macro support needed. Upgrade your GAMS system. -$SET VSUM SUM(SW_TSW(SOW, -$SETGLOBAL SW_STVARS SET VAR "Z" SET VART '%VSUM%T,W),Z' SET VARM '%VSUM%MODLYEAR,W),Z' SET VARV '%VSUM%V,W),Z' -$SETGLOBAL WITSPINE SET EQS '%EQ%' SET EQ 'Q' -$SETGLOBAL EWISPINE SET EQ %EQ% - SET OBJSW1(OBV); - SET UCRTPSW1(UC_GRPTYPE,WW); - OBJSW1('OBJINV')=YES; - OBJSW1('OBJFIX')=YES; - OBJSW1('OBJSAL')=YES; - UCRTPSW1('ACT',SOW) = YES; - UCRTPSW1('CAP','1') = YES; - UCRTPSW1('NCAP','1') = YES; -$macro QED -$macro PRC_DYNUCMX(uc,side,r,t,p,grp,bd) PRC_DYNUC(uc,side,r,t,p,grp,bd)$UCRTPSW1(grp,SOW) -*----------------------------------------------------------------------------- -* Equations (only if needed) -$macro Q_OBJELS ES_OBJELS -$macro Q_OBJFIX(rc,sow) ES_OBJFIX(rc,SOW('1')) -$macro Q_OBJINV(rc,sow) ES_OBJINV(rc,SOW('1')) -$macro Q_OBJSALV(rc,sow) ES_OBJSALV(rc,SOW('1')) -$macro Q_OBJVAR ES_OBJVAR -$macro Q_ROBJ ES_ROBJ -$macro Q_SOBJ ES_SOBJ - -$macro QG_CPT(rtp,swt) ESG_CPT(rtp,T,SOW('1')) -$macro QE_CPT(rtp,swt) ESE_CPT(rtp,T,SOW('1')) -$macro QL_CPT(rtp,swt) ESL_CPT(rtp,T,SOW('1')) -$macro Q_DSCRET(cpt,sw) ES_DSCRET(cpt,T,SOW('1')) -$macro Q_CUMRET(r,v,p,w) ES_CUMRET(r,v,p,T,SOW('1')) -$macro QL_REFIT(rttp,l,swt) ESL_REFIT(rttp,l,T,SOW('1')) -$macro Q_DSCNCAP(rtp,sw) ES_DSCNCAP(rtp,T,SOW('1')) -$macro Q_DSCONE(rtp,swt) ES_DSCONE(rtp,T,SOW('1')) - -$macro QE_UCT ESE_UCT -$macro QE_UCRT ESE_UCRT -$macro QE_UCTS ESE_UCTS -$macro QE_UCRS ESE_UCRS -$macro QE_UCRTS ESE_UCRTS - -* Cumulative / dynamic -$IF %SOLVEDA%==1 $GOTO DYQAGG -$SETGLOBAL SW_STVARS %SW_STVARS% SET VARTT '%VSUM%TT,W),Z' SET SWSW SW_TSW(SOW,T,WW), -$macro Q_CUMNET ES_CUMNET -$macro Q_CUMPRD ES_CUMPRD -$macro Q_CUMFLO ES_CUMFLO -$macro Q_BNDCST ES_BNDCST -$macro QE_UC ESE_UC -$macro QE_UCR ESE_UCR -$macro QE_UCSU ESE_UCSU -$macro QE_UCSUS ESE_UCSUS -$macro QE_UCRSU ESE_UCRSU -$macro QE_UCRSUS ESE_UCRSUS -$macro QL_SCAP ESL_SCAP -$GOTO DYQDONE -$LABEL DYQAGG -$SETGLOBAL SCUM 1 -$SETGLOBAL SW_STVARS %SW_STVARS% SET VARTT 'SUM(SW_TSW(W,TT,W),SW_TPROB(TT,W)*Z' SET SWSW SW_TSW(SOW(WW),T,WW),SW_TPROB(T,WW)* -$macro Q_CUMNET(rc,y1,y2,sow) ES_CUMNET(rc,y1,y2,'1') -$macro Q_CUMPRD(rc,y1,y2,sow) ES_CUMPRD(rc,y1,y2,'1') -$macro Q_CUMFLO(rpcyy,sw) ES_CUMFLO(rpcyy,'1') -$macro Q_BNDCST(r,y,y2,c,m,w) ES_BNDCST(r,y,y2,c,m,'1') -$macro QE_UC(uc,sow) ESE_UC(uc,'1') -$macro QE_UCR(uc,r,sow) ESE_UCR(uc,r,'1') -$macro QE_UCSU(uc,t,sw) ESE_UCSU(uc,t,'1') -$macro QE_UCSUS(uc,t,s,sw) ESE_UCSUS(uc,t,s,'1') -$macro QE_UCRSU(uc,r,t,sw) ESE_UCRSU(uc,r,t,'1') -$macro QE_UCRSUS(uc,r,t,s,sw) ESE_UCRSUS(uc,r,t,s,'1') -$macro QL_SCAP(rtp,ip,sow) ESL_SCAP(rtp,ip,'1') -$LABEL DYQDONE -*----------------------------------------------------------------------------- -* Variables (must have for all standard) -$macro Z_OBJ VAS_OBJ -$macro Z_OBJELS VAS_OBJELS - -$macro Z_ACT VAS_ACT -$macro Z_FLO VAS_FLO -$macro Z_IRE VAS_IRE -$macro Z_SIN VAS_SIN -$macro Z_SOUT VAS_SOUT -$macro Z_BLND VAS_BLND -$macro Z_COMNET VAS_COMNET -$macro Z_COMPRD VAS_COMPRD -$macro Z_ELAST VAS_ELAST -$macro Z_DEM VAS_DEM -$macro Z_UPS VAS_UPS -$macro Z_UPT VAS_UPT -$macro Z_UDP VAS_UDP -$macro Z_RLD VAS_RLD -$macro Z_GRIDELC VAS_GRIDELC -$macro Z_COMAUX VAS_COMAUX - -$macro Z_CAP(r,t,p,sow) VAS_CAP(r,t,p,'1') -$macro Z_NCAP(r,t,p,sow) VAS_NCAP(r,t,p,'1') -$macro Z_RCAP(r,v,t,p,sow) VAS_RCAP(r,v,t,p,'1') -$macro Z_SCAP(r,v,t,p,sow) VAS_SCAP(r,v,t,p,'1') -$macro Z_DRCAP(r,v,t,p,w,j) VAS_DRCAP(r,v,t,p,'1',j) -$macro Z_DNCAP(r,t,p,sow,j) VAS_DNCAP(r,t,p,'1',j) -$macro Z_SNCAP(r,t,p,sow) VAS_SNCAP(r,t,p,'1') - -$macro Z_UC VAS_UC -$macro Z_UCR VAS_UCR -$macro Z_UCT VAS_UCT -$macro Z_UCRT VAS_UCRT -$macro Z_UCTS VAS_UCTS -$macro Z_UCRTS VAS_UCRTS - -$IF %SOLVEDA%==1 $GOTO DYZAGG -$macro Z_CUMCOM VAS_CUMCOM -$macro Z_CUMFLO VAS_CUMFLO -$macro Z_CUMCST VAS_CUMCST -$GOTO DYZDONE -$LABEL DYZAGG -$macro Z_CUMCOM(r,c,cv,y1,y2,w) VAS_CUMCOM(r,c,cv,y1,y2,'1') -$macro Z_CUMFLO(r,p,cv,y1,y2,w) VAS_CUMFLO(r,p,cv,y1,y2,'1') -$macro Z_CUMCST(r,y1,y2,cg,m,w) VAS_CUMCST(r,y1,y2,cg,m,'1') -$LABEL DYZDONE - -$macro Z_CLITOT VAS_CLITOT -$macro Z_CLIBOX VAS_CLIBOX - -* Map objective components - EQUATION %EQ%_OBW1(OBV,R,CUR,ALLSOW); - %EQ%_OBW1(OBJSW1(OBV),RDCUR(R,CUR),SOW) .. %VAR%_OBJ(R,OBV,CUR,SOW) =E= %VAR%_OBJ(R,OBV,CUR,'1'); - -*----------------------------------------------------------------------------- -$LABEL FINISH diff --git a/source/resloadc.vda b/source/resloadc.vda deleted file mode 100644 index 3ceada3..0000000 --- a/source/resloadc.vda +++ /dev/null @@ -1,154 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* ResLoadC.vda - define residual load curve equations -*=============================================================================* -$IF NOT '%1'=='' $GOTO %1 -*----------------------------------------------------------------------------- -* Internal declarations - SET RLDC / RL-DISP /, ITEM / RL-NDIS, RL-CHP, RL-ROR, RL-SOL, RL-WIND, RL-THMIN, RL-TP /; - SET GR_RLDC(R,LL); - SET RLDBD(LIM) / UP /; - SET GR_RLGT(R,P,ITEM); - PARAMETER GR_THBND(R,LL,P,LIM); - PARAMETER GR_TP(R,BD) / (SET.R).UP INF /; -* FX - constant; LO - proportional to capacity; UP - proportional to online capacity -* Preparations - GR_RLDC(R,'0') $=SUM((S,RLDC,BD)$GR_VARGEN(R,S,RLDC,BD),1); - GR_TP(R,BD)$=GR_VARGEN(R,'ANNUAL','RL-TP',BD); GR_TP(R,BD)$=GR_TP(R,'FX'); GR_VARGEN(R,S,'RL-TP',BD)=0; - OPTION CLEAR=UNCD1; GR_RLDC(R,T(TT+1))$((YEARVAL(T)>=GR_TP(R,'LO'))$(YEARVAL(T)<=GR_TP(R,'UP'))) $= GR_RLDC(R,'0'); - LOOP((R,S,ITEM,BD)$GR_VARGEN(R,S,ITEM,BD),UNCD1(ITEM)=YES); RLDC(UNCD1) = YES; - RLDBD(BD)$=NOT RLDC('RL-THMIN'); GR_VARGEN(R,S,'RL-THMIN',BD) = 0; -$ BATINCLUDE fillparm GR_THMIN R P ",'0','0','0','0','0'" T RTP(R,T,P) 'GE 0' -$ EXIT -*----------------------------------------------------------------------- -$LABEL COEF -* Preprocessing - TRACKPC(RPC_PG(RP_STD(R,P),C))$(TOP(R,P,C,'OUT')$NRG_TMAP(R,'ELC',C)) = YES; - OPTION TRACKP=1)$GR_THMIN(RTP)) = 1/GR_THMIN(RTP); -* Levelize variations - FOR(Z=CARD(TSLVL)-2 DOWNTO 0, - LOOP((ANNUAL(TS(TSL-Z)),TS_GROUP(R,TSL,SL)), - GR_VARGEN(FINEST(R,S),RLDC,BDNEQ(BD))$((NOT GR_VARGEN(R,S,RLDC,BD))$RS_BELOW(R,SL,S)) $= GR_VARGEN(R,SL,RLDC,BD))); -* Ensure curtailment is accounted - GR_RLDC(R,'0')$GR_VARGEN(R,'ANNUAL','RL-DISP','FX') = NO; - LOOP(R$GR_RLDC(R,'0'), - RHS_COMBAL(RTCS_VARC(GR_RLDC(R,T),C,S))$(COM_LIM(R,C,'LO')$NRG_TMAP(R,'ELC',C)) = YES; - RCS_COMBAL(RHS_COMBAL(GR_RLDC(R,T),C,S),'FX')$NRG_TMAP(R,'ELC',C) = YES); - GR_VARGEN(R,ANNUAL,RLDC,'FX') = 1-DIAG('RL-DISP',RLDC); -* Move to ACT_UPS when needed - LOOP(RLDBD(BDNEQ(BD)),ACT_UPS(RTP,ANNUAL(S),'FX')$GR_THBND(RTP,BD)=MAX(GR_THBND(RTP,BD),ACT_UPS(RTP,S,'FX')); - GR_THBND(R,LL,P,BD)$RP_UPL(R,P,'FX')=0) - IF(RLDBD('FX'),FLO_BND(RTP(R,T,P),C,S,'LO')$(RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C)$PRC_TS(R,P,S)$GR_THBND(RTP,'FX')) = - MAX(FLO_BND(RTP,C,S,'LO'),GR_THBND(RTP,'FX')*PRC_CAPACT(R,P)*G_YRFR(R,S))); - OPTION GR_THMIN < GR_THBND; -$ EXIT -*----------------------------------------------------------------------- -$ LABEL EQUA -* Remove cycling if lower bounds are per nominal capacity - RPS_UPS(R,P,S)$SUM(RTP(R,V,P)$GR_THBND(RTP,'LO'),1)=NO; -* Set bounds - %VAS%_RLD.LO(R,T,S,'RL-DISP'%SOW%)=-INF; -*----------------------------------------------------------------------- -* Define the residual load as the sum of dispatchable production plus net storage output - %EQ%_RL_LOAD(GR_RLDC(%R_T%),RTS(S)%SWT%)$FINEST(R,S).. - -* Dispatchable production - SUM(TOP(R,P,C,'OUT')$(NRG_TMAP(R,'ELC',C)$GR_GENMAP(R,P,'RL-DISP')), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), -$ BATINCLUDE %cal_red% C COM TS P T - * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) + - SUM(RLDC('RL-THMIN'),%VAR%_RLD(R,T,S,RLDC%SOW%)*G_YRFR(R,S)) - -* Net storage input - SUM(TOP(RPC_STG(R,P,C),IO)$NRG_TMAP(R,'ELC',C), - SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS), - (%VAR%_SIN(R,V,T,P,C,TS %SOW%)$IPS(IO)-%VAR%_SOUT(R,V,T,P,C,TS %SOW%)*STG_EFF(R,V,P)$(NOT IPS(IO)))*RS_FR(R,S,TS))) - -* Curtailment - SUM(RHS_COMBAL(R,T,C,TS)$(RS_FR(R,S,TS)$NRG_TMAP(R,'ELC',C)$GR_RLDC(R,'0')), - (%VAR%_COMNET(R,T,C,TS%SOW%)/COM_IE(R,T,C,TS)*RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))$(NOT SUM(COM$COM_AGG(R,T,C,COM),1))) - - =E= %VAR%_RLD(R,T,S,'RL-DISP'%SOW%)*G_YRFR(R,S); - -*----------------------------------------------------------------------- -* Total levels of generation by group - %EQ%_RL_NDIS(GR_RLDC(%R_T%),RTS(S),RLDC%SWT%)$(FINEST(R,S)$GR_VARGEN(R,'ANNUAL',RLDC,'FX')).. - - SUM(TOP(R,P,C,'OUT')$(NRG_TMAP(R,'ELC',C)$GR_RLGT(R,P,RLDC)), - SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), -$ BATINCLUDE %cal_red% C COM TS P T - * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) - =E= %VAR%_RLD(R,T,S,RLDC %SOW%)*G_YRFR(R,S); -*----------------------------------------------------------------------- -* Available storage capacity must be at least thermal min minus residual load with lower variation - %EQ%_RL_STCAP(GR_RLDC(%R_T%),RTS(S)%SWT%)$FINEST(R,S).. - -* Daynite storage capacity - SUM(TOP(RPC_STG(PRC_CAP(R,P),C),'OUT')$(PRC_TS(R,P,S)$NRG_TMAP(R,'ELC',C)), PRC_CAPACT(R,P) * RS_STGPRD(R,S) * - SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P) * PRC_ACTFLO(R,V,P,C) * - SMIN(TS_MAP(R,TS,S)$COEF_AF(R,V,T,P,TS,'UP'),COEF_AF(R,V,T,P,TS,'UP') / RS_FR(R,S,TS) * - PROD(TS_GROUP(R,TSL,TS)$RPS_CAFLAC(R,P,TS,'UP'), 1 / RS_STGPRD(R,S) / STG_EFF(R,V,P) * - (NCAP_AFCS(R,V,P,C,TS)+PROD(COM_TMAP(R,COM_TYPE(CG),C)$NCAP_AFCS(R,V,P,CG,TS),NCAP_AFCS(R,V,P,CG,TS))$(NOT NCAP_AFCS(R,V,P,C,TS))))) * - (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)%RCAPSUB%))) - - =G= - -* Thermal min capacity - residual load - %VAR%_RLD(R,T,S,'RL_THMIN'%SOW%) - %VAR%_RLD(R,T,S,'RL-DISP'%SOW%) + -* Plus lower variation - SUM((RLDC,BDNEQ(BD))$(DIAG('RL-DISP',RLDC)=DIAG('LO',BD)), %VAR%_RLD(R,T,S,RLDC%SOW%) * GR_VARGEN(R,S,RLDC,BD)); - -*----------------------------------------------------------------------- -* Available dispatchable plus storage output capacity must be at least residual load upper variation - %EQ%_RL_PKCAP(GR_RLDC(%R_T%),RTS(S)%SWT%)$FINEST(R,S).. - -* Dispatchable capacity - SUM(GR_RLGT(PRC_CAP(R,P),'RL-DISP'), PRC_CAPACT(R,P) * - SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * SMAX(RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C),PRC_ACTFLO(R,V,P,C)) * SUM(PRC_TS(R,P,TS)$RS_FR(R,S,TS),COEF_AF(R,V,T,P,S,'UP')) * - (%VARV%_NCAP(R,V,P %SWS%)$TT(V) + NCAP_PASTI(R,V,P)$PYR(V)%RCAPSUB%))) + -* Storage output capacity - SUM(TOP(RPC_STG(PRC_CAP(R,P),C),'OUT')$(PRC_TS(R,P,S)$NRG_TMAP(R,'ELC',C)), PRC_CAPACT(R,P) * RS_STGPRD(R,S) * - SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P) * COEF_AF(R,V,T,P,S,'UP') * PRC_ACTFLO(R,V,P,C) * STG_EFF(R,V,P) * - PROD(L('N'), - PROD(TS_GROUP(R,TSL,S)$RPS_CAFLAC(R,P,S,'UP'), 1 / RS_STGPRD(R,S) / STG_EFF(R,V,P) * - (NCAP_AFCS(R,V,P,C,S)+PROD(COM_TMAP(R,COM_TYPE(CG),C)$NCAP_AFCS(R,V,P,CG,S),NCAP_AFCS(R,V,P,CG,S))$(NOT NCAP_AFCS(R,V,P,C,S))))) * - (%VARV%_NCAP(R,V,P %SWS%)$TT(V) + NCAP_PASTI(R,V,P)$PYR(V)%RCAPSUB%))) - - =G= - -* Residual load plus upper variation - %VAR%_RLD(R,T,S,'RL-DISP'%SOW%) + - SUM((RLDC,BDNEQ(BD))$(DIAG('RL-DISP',RLDC)=DIAG('UP',BD)), %VAR%_RLD(R,T,S,RLDC%SOW%) * GR_VARGEN(R,S,RLDC,BD)); - -*----------------------------------------------------------------------- -* Aggregate thermal min level - %EQ%_RL_THMIN(GR_RLDC(%R_T%),RTS(TS),BDNEQ %SWT%)$((BDLOX(BDNEQ)+RLDC('RL-THMIN'))$FINEST(R,TS)).. - - %VAR%_RLD(R,T,TS,'RL_THMIN'%SOW%)*BDSIG(BDNEQ) + - %VAR%_RLD(R,T,TS,'RL-THMIN'%SOW%)*BDUPX(BDNEQ) - - =G= - -* Aggregate target load level according to THMIN - SUM(GR_RLGT(PRC_CAP(R,P),'RL-THMIN'), PRC_CAPACT(R,P) * (GR_THBND(R,T,P,'FX') + - SUM((RTP_VINTYR(R,V,T,P),PRC_TS(R,P,S))$RS_FR(R,TS,S),SMAX(RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C),PRC_ACTFLO(R,V,P,C)) * - (SUM(BD$BDNEQ(BD),GR_THBND(R,T,P,BD))+SUM(TS_ANN(S,SL),ACT_UPS(R,V,P,SL,'FX'))$(NOT GR_THMIN(R,T,P))) * - (SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,MODLYEAR,T,P) * - (%VARM%_NCAP(R,K,P %SWS%)$TT(K)+NCAP_PASTI(R,K,P)$PYR(K)%RCAPSBM%))%UPSCAPS%))))$BDLOX(BDNEQ); diff --git a/source/rpt_dam.mod b/source/rpt_dam.mod deleted file mode 100644 index 7f6c437..0000000 --- a/source/rpt_dam.mod +++ /dev/null @@ -1,56 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*------------------------------------------------------------------------------ -* RPT_DAM.mod -* -* Output routine for Damage Costs -*------------------------------------------------------------------------------ -$SETLOCAL SWP '' SETLOCAL SW1 '' -$IF %SOLVEDA%==1 $SETLOCAL SWP 'S' SETLOCAL SW1 "'1'," -$IFI %STAGES%==YES $SETLOCAL SWP 'S' SETLOCAL SW1 'SOW,' - %VAR%_OBJ.M(R,'OBJDAM',CUR %SOW%)$RDCUR(R,CUR) = 0; -*------------------------------------------------------------------------------ -* Always report the accurate non-linear costs - OPTION CLEAR=RXX; LOOP(RDCUR(R,CUR), RXX(RTC)$DAM_COST(RTC,CUR) = YES); -*------------------------------------------------------------------------------ -* If using climate module, enable damages for total emissions/concentration -$IF %CLI%==YES %SWP%CST_DAM(%SW1%R,T,C(CG(CM_VAR)))$((NOT RC(R,C))$RXX(R,T,C)) = -$IF %CLI%==YES %VART%_CLITOT.L(CM_VAR,T%SWS%)$CM_KIND(CM_VAR)+%VAR%_CLIBOX.L(CM_VAR,T%SOW%)$(NOT CM_KIND(CM_VAR)); -*------------------------------------------------------------------------------ - %SWP%CST_DAM(%SW1%RXX(R,T,C))$RC(R,C) = - SUM(COM_TS(R,C,S),DAM_COEF(R,T,C,S) * - (%VART%_COMNET.L(R,T,C,S%SWS%)$(NOT DAM_ELAST(R,C,'N'))+%VART%_COMPRD.L(R,T,C,S%SWS%)$DAM_ELAST(R,C,'N'))); - %SWP%DAM_OBJ(%SW1%RXX(R,T,C),CUR)$RDCUR(R,CUR) = -$IFI NOT %STAGES%==YES DAM_COST(R,T,C,CUR) * -$IFI %STAGES%==YES SUM(SWW(SOW,W)$(SW_TSW(SOW,T,W)$(NOT WWDAM(C))+SWW(W,SOW)$WWDAM(C)),S_DAM_COST(R,T,C,CUR,'1',W)) * - (DAM_TVOC(R,T,C,'N')*(MIN(%SWP%CST_DAM(%SW1%R,T,C),DAM_SIZE(R,T,C,'N'))+DAM_SIZE(R,T,C,'N')*DAM_ELAST(R,C,'N')) + - ((MIN(DAM_TQTY(R,T,C),%SWP%CST_DAM(%SW1%R,T,C))**(DAM_ELAST(R,C,'LO')+1) + -* Subtract full LO costs if DAM_ELAST(N) = -1 (constant term) - DAM_ELAST(R,C,'N')*(DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'LO')+1)-DAM_SIZE(R,T,C,'N')**(DAM_ELAST(R,C,'LO')+1)) - - MIN(DAM_SIZE(R,T,C,'N'),%SWP%CST_DAM(%SW1%R,T,C))**(DAM_ELAST(R,C,'LO')+1)) / - (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'LO')*(DAM_ELAST(R,C,'LO')+1))) + - ((%SWP%CST_DAM(%SW1%R,T,C)**(DAM_ELAST(R,C,'UP')+1) - - DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'UP')+1)) / - (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'UP')*(DAM_ELAST(R,C,'UP')+1)))$(%SWP%CST_DAM(%SW1%R,T,C) GT DAM_TQTY(R,T,C)) + -* Shift cost curve by DAM_ELAST(N) if applicable - DAM_ELAST(R,C,'N')*(%SWP%CST_DAM(%SW1%R,T,C)+DAM_ELAST(R,C,'N')*DAM_TQTY(R,T,C)) - ); - -$IF %SCUM%==1 $SETLOCAL SW1 "'1'," %SW_NOTAGS% -$IF %SCUM%==1 SDAM_OBJ(%SW1%RXX(R,T,C),CUR)$RDCUR(R,CUR) = SUM(W,SW_PROB(W)*SDAM_OBJ(W,R,T,C,CUR)); - - %SWP%CST_DAM(%SW1%RXX(R,T,C)) = SUM(RDCUR(R,CUR),%SWP%DAM_OBJ(%SW1%R,T,C,CUR)); - %SWP%REG_ACOST(%SW1%R,T,'DAM') = SUM(RXX(R,T,C),%SWP%CST_DAM(%SW1%R,T,C)); - %SWP%CST_PVC(%SW1%'DAM',R,C)$DAM_STEP(R,C,'FX') = SUM(T,%SWP%CST_DAM(%SW1%R,T,C)*COEF_PVT(R,T)); -* Complete also reporting of discounted costs - %SWP%REG_WOBJ(%SW1%R,'DAM',CUR) = SUM(RXX(R,T,C)$((NOT DAM_ELAST(R,C,'N'))$DAM_STEP(R,C,'FX')),OBJ_PVT(R,T,CUR)*%SWP%DAM_OBJ(%SW1%R,T,C,CUR)); - %SWP%REG_WOBJ(%SW1%R,'DAS',CUR) = SUM(RXX(R,T,C)$(DAM_ELAST(R,C,'N')$DAM_STEP(R,C,'FX')),OBJ_PVT(R,T,CUR)*%SWP%DAM_OBJ(%SW1%R,T,C,CUR)); - %SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR) = %SWP%REG_WOBJ(%SW1%R,'DAM',CUR)+%SWP%REG_WOBJ(%SW1%R,'DAS',CUR); - %SWP%REG_WOBJ(%SW1%R,'DAM',CUR) = (%SWP%REG_WOBJ(%SW1%R,'DAM',CUR)/%SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR)*%VAR%_OBJ.L(R,'OBJDAM',CUR%SOW%))$(%SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR) GT 0); - %SWP%REG_WOBJ(%SW1%R,'DAS',CUR) = %VAR%_OBJ.L(R,'OBJDAM',CUR%SOW%) - %SWP%REG_WOBJ(%SW1%R,'DAM',CUR); -* Complete also reporting of discounted external damages - %SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR) = SUM(RXX(R,T,C),OBJ_PVT(R,T,CUR)*%SWP%DAM_OBJ(%SW1%R,T,C,CUR)) - %VAR%_OBJ.L(R,'OBJDAM',CUR%SOW%); -* Weighted results -$IF %STAGES%%SCUM%==YES REG_WOBJ(R,DAMOBJ,CUR) = SUM(W,SW_PROB(W)*SREG_WOBJ(W,R,DAMOBJ,CUR)); diff --git a/source/rpt_ext.cli b/source/rpt_ext.cli deleted file mode 100644 index 7023744..0000000 --- a/source/rpt_ext.cli +++ /dev/null @@ -1,53 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* RPT_EXT.cli - Extension for Climate Module: Stochastic report -*----------------------------------------------------------------------------- -* Questions/Comments: -* -*----------------------------------------------------------------------------- -* Calculate Reporting parameters for Climate Module - -*----------------------------------------------------------------------------- -$IFI %SENSIS%==YES $EXIT -$%SW_NOTAGS% -*----------------------------------------------------------------------------- -EQUATIONS - %EQ%_CLITOT(CM_VAR,T,LL %SWD%) 'Balances for the total emissions or forcing' - %EQ%_CLIMAX(ALLYEAR,CM_VAR %SWD%) 'Constraint for maximum climate quantities' -; - -VARIABLES - %VAR%_CLITOT(CM_VAR,LL %SWD%) 'Total emissions or forcing by milestone year' -POSITIVE VARIABLES - %VAR%_CLIBOX(CM_VAR,LL %SWD%) 'Quantities in the climate reservoirs' -; -*----------------------------------------------------------------------------- -$IF %STAGES%==YES $%SW_TAGS% SET SWSW SW_TSW(SOW,T,WW), -$IF %SCUM%==1 $SET SWSW 'SW_T(T,WW),' SET SCUM *SW_TPROB(T,WW) - -* Results for each SOW -$IF NOT %STAGES%==YES LOOP(SOW, -$IF %STAGES%==YES LOOP(AUXSOW(SOW)$SW_PROB(SOW), -* Clear results from previous SOW -$IF NOT %STAGES%==YES $GOTO REPORT - OPTION CLEAR=VAR_CLITOT,CLEAR=VAR_CLIBOX; - OPTION CLEAR=EQ_CLITOT, CLEAR=EQ_CLIMAX; - LOOP(SUPERYR(T,LL)$CM_LED(LL), - VAR_CLITOT.L(CM_VAR,LL) $= SUM(%SWSW% %VAR%_CLITOT.L(CM_VAR,LL%SWD%)%SCUM%); - VAR_CLIBOX.L(CM_VAR,LL) $= SUM(%SWSW% %VAR%_CLIBOX.L(CM_VAR,LL%SWD%)%SCUM%); -$IF %STAGES%%SCUM%==YES VAR_CLIBOX.L(CM_VAR,LL) $= %VAR%_CLIBOX.L(CM_VAR,LL,SOW); - EQ_CLIMAX.M(LL,CM_VAR) $= SUM(%SWSW% %EQ%_CLIMAX.M(LL,CM_VAR%SWD%)*SW_UNPB(T,WW))); - EQ_CLITOT.M(CM_VAR,T,T) $= SUM(%SWSW% %EQ%_CLITOT.M(CM_VAR,T,T%SWD%)*SW_UNPB(T,WW)); -$LABEL REPORT BATINCLUDE rpt_par.cli - ); -IF(CARD(SOW)=1,DISPLAY CM_RESULT,CM_MAXC_M; ELSE DISPLAY CM_SRESULT,CM_SMAXC_M); -*----------------------------------------------------------------------------- -$IF NOT %STAGES%==YES $EXIT -* Expected marginals - LOOP(SUPERYR(T,LL)$CM_LED(LL), - EQ_CLIMAX.M(LL,CM_VAR) $= SUM(SW_T(T,W),%EQ%_CLIMAX.M(LL,CM_VAR,W)); - VAR_CLITOT.L(CM_VAR,LL) $= SUM(SW_T(T,W),SW_TPROB(T,W)*%VAR%_CLITOT.L(CM_VAR,LL,W)); - VAR_CLIBOX.L(CM_VAR,LL) $= SUM(SW_T(T,W),SW_TPROB(T,W)*%VAR%_CLIBOX.L(CM_VAR,LL,W))); diff --git a/source/rpt_ext.ecb b/source/rpt_ext.ecb deleted file mode 100644 index d937117..0000000 --- a/source/rpt_ext.ecb +++ /dev/null @@ -1,69 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* RPT_EXT.ecb - Extension for the Market Sharing Mechanism (economic choices) -*----------------------------------------------------------------------------- -$ IF NOT DEFINED RTC_MS $EXIT -*----------------------------------------------------------------------------- - OPTION RVP < COEF_LMS, CLEAR=OBJ_SUMSI; - OBJ_SUMSI(RTP(R,T,P),V)$RVPT(R,V,P,T) = YES; - OBJ_SUMSI(RTP(R,T,P),T)$(COEF_CPT(R,T,T,P)>0) = YES; -* Existence flags - PAR_TOP(RVP(R,T,P),C,'OUT')$COEF_LMS(R,T,C,P) = SUM((OBJ_SUMSI(RVP,V),PRC_TS(R,P,S)),PAR_FLO(R,V,T,P,C,S)>0); - PAR_TOP(RVP(R,T,P),C,IO)$PAR_TOP(RVP,C,IO) = SUM(OBJ_SUMSI(RVP,V),VAR_NCAP.L(R,V,P)*PRC_CAPACT(R,P)*POWER(COEF_CPT(R,V,T,P),0.5$(DIAG(V,T)-1)))/VAR_XCAP.L(R,T,C)+EPS; -* Implied utilization factors - PASTSUM(RVP(R,T,P))$PAR_CAPL(RVP) = (PAR_CAPL(RVP)+SUM(PASTCV,PAR_PASTI(R,T,P,PASTCV)))*PRC_CAPACT(R,P)+1-1; - PASTSUM(NCAP_YES(RVP(R,V,P))) = - (SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*SUM(RPCS_VAR(RPC_PG(R,P,C),S),PAR_FLO(R,V,T,P,C,S))) / SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*VAR_NCAP.L(RVP)*COEF_CPT(R,V,T,P)*PRC_CAPACT(R,P)))$PRC_VINT(R,P) + - (SUM(RTP_CPTYR(R,V,T,P)$PASTSUM(R,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)/PASTSUM(R,T,P)*SUM(RPCS_VAR(RPC_PG(R,P,C),S),PAR_FLO(R,T,T,P,C,S))) / SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)))$(NOT PRC_VINT(R,P)); -* Calculate INV unit cost annuity and intangibles - COEF_RTP(RVP(R,T,P)) = - SUM(OBJ_ICUR(RVP,CUR),SUM(OBJ_SUMII(RVP,LIFE,K_EOH,JOT),%CAPJD% OBJ_CRF(RVP,CUR) / OBJ_DIVI(RVP) * SUM(INVSPRED(K_EOH,JOT,Y,K),OBJ_ICOST(R,K,P,CUR)))); - NCAP_MSPRF(R,T,C,P,'FX')$COEF_LMS(R,T,C,P) = NCAP_MSPRF(R,T,C,P,'LO')*SUM(OBJ_SUMSI(R,T,P,V)$PASTSUM(R,V,P),COEF_RTP(R,V,P)/PRC_CAPACT(R,P)/PASTSUM(R,V,P)); -* Map LEC(v) and IUF(v) to t - ECB_NCAPR(RVP)$PASTSUM(RVP)$=PAR_NCAPR(RVP,'LEVCOST'); - PAR_NCAPR(RVP(R,T,P),'LEVCOST') = SUM(OBJ_SUMSI(RVP,V),PAR_NCAPR(R,V,P,'LEVCOST')); - PASTSUM(RVP(R,T,P)) = SUM(OBJ_SUMSI(RVP,V),PASTSUM(R,V,P)); - OPTION CLEAR=RVP,CLEAR=COEF_RTP; -*----------------------------------------------------------------------------- -* Calculate logit market shares - LOOP(RTC_MS(RTC(R,T,C)), Z = -ABS(COM_MSHGV(RTC)); OPTION CLEAR=PRC_YMIN; -* Get weights for shares and their sum - PRC_YMIN(R,P)$PAR_TOP(R,T,P,C,'OUT') = (NCAP_MSPRF(RTC,P,'N')/PASTSUM(R,T,P))*((PAR_NCAPR(R,T,P,'LEVCOST')+NCAP_MSPRF(RTC,P,'FX'))**Z)$(PAR_NCAPR(R,T,P,'LEVCOST')>1E-3); - F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); - IF(F>0, -* Get initial shares and their Max - PRC_YMIN(R,P)$PRC_YMIN(R,P)=(PRC_YMIN(R,P)/F); - F = SMAX(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); - MY_F=SMAX(P$PRC_YMIN(R,P),PAR_TOP(R,T,P,C,'OUT')); -* Adjust shares, normalize, and get sum over cutoff - PRC_YMIN(R,P)$((PRC_YMIN(R,P)>.05)$PRC_YMIN(R,P)) = MAX(PRC_YMIN(R,P),PAR_TOP(R,T,P,C,'OUT')/MY_F*F); - F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); - PRC_YMIN(R,P)$PRC_YMIN(R,P)=(PRC_YMIN(R,P)/F)$(PRC_YMIN(R,P)/F>.01); - F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P))*.9999; -* Get MY_F = Max share, and Z = sum of differences from max - MY_F = SMAX(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); Z = SUM(P$PRC_YMIN(R,P),MY_F-PRC_YMIN(R,P)); - IF(Z, CNT=1; ELSE CNT=F); -* Final normalized share values: V0i+(MAX0-V0i)*(1-SUM0)/DIFSUM - COEF_LMS(RTC,P)$COEF_LMS(RTC,P) = PRC_YMIN(R,P)/CNT+((MY_F-PRC_YMIN(R,P))*(1-F)/Z)$PRC_YMIN(R,P)$Z; - ELSE COEF_LMS(RTC,P)$COEF_LMS(RTC,P)=0)); - OPTION CLEAR=PRC_YMIN,CLEAR=OBJ_SUMSI,CLEAR=PASTSUM,CLEAR=PAR_TOP; -*----------------------------------------------------------------------------- -* Reports clear - OPTION CLEAR=REG_WOBJ, CLEAR=REG_IREC, CLEAR=REG_ACOST, CLEAR=CAP_NEW, CLEAR=PAR_EOUT, CLEAR=F_IN, CLEAR=F_OUT, CLEAR=P_OUT, CLEAR=AGG_OUT; - OPTION CLEAR=PAR_ACTL, CLEAR=PAR_ACTM, CLEAR=PAR_PASTI, CLEAR=PAR_CAPL, CLEAR=PAR_CAPM, CLEAR=PAR_CAPLO, CLEAR=PAR_CAPUP, CLEAR=PAR_NCAPL, CLEAR=PAR_NCAPM, CLEAR=PAR_NCAPR, CLEAR=PAR_OBJSAL; - OPTION CLEAR=PAR_COMPRDL, CLEAR=PAR_COMPRDM, CLEAR=PAR_COMNETL, CLEAR=PAR_COMNETM, CLEAR=PAR_COMBALEM, CLEAR=PAR_COMBALGM, CLEAR=PAR_IPRIC, CLEAR=PAR_PEAKM; - OPTION CLEAR=PAR_UCSL, CLEAR=PAR_UCSM, CLEAR=PAR_CUMFLOL, CLEAR=PAR_CUMFLOM, CLEAR=PAR_CUMCST, CLEAR=PAR_UCMRK, CLEAR=PAR_UCRTP, CLEAR=PAR_UCMAX; - OPTION CLEAR=CST_INVC, CLEAR=CST_INVX, CLEAR=CST_DECC, CLEAR=CST_FIXC, CLEAR=CST_FIXX, CLEAR=CST_ACTC, CLEAR=CST_FLOC, CLEAR=CST_FLOX, CLEAR=CST_IREC, CLEAR=CST_COMC, CLEAR=CST_COMX, CLEAR=CST_COME, CLEAR=CST_SALV, CLEAR=CST_TIME; -*----------------------------------------------------------------------------- - F = RPT_OPT('NCAP','101'); IF(F,RPT_OPT('NCAP','1') = ROUND(F)); -$ IF PARTYPE DOITER DOITER=NA; -$ IFI %MACRO%==MLF $EXIT -* Resolve model - OPTION SOLVEOPT=MERGE; -$ BATINCLUDE solve.mod -$ SET SOLVEDA 1 -$ BATINCLUDE rptlite.rpt '' '' '' NO - PAR_NCAPR(RTP,'COST')$=ECB_NCAPR(RTP); diff --git a/source/rpt_ext.ier b/source/rpt_ext.ier deleted file mode 100644 index e2d1106..0000000 --- a/source/rpt_ext.ier +++ /dev/null @@ -1,50 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================= -* CHP reporting for the IER extension -*============================================================================= -$IF %STAGES%==YES $EXIT -$IF %VDA%==YES $SET SOW ,'0' - PARAMETER PAR_BPTL(R,T,P); - PARAMETER PAR_BPTM(R,T,P); - PARAMETER PAR_CONDL(R,T,P) //; - PARAMETER PAR_CONDM(R,T,P) //; - PARAMETER PAR_HEATL(R,T,P) //; - PARAMETER PAR_HEATM(R,T,P) //; - PARAMETER ELE_CONDL(R,YEAR,YEAR,P,C,S) //; - PARAMETER ELE_CONDM(R,YEAR,YEAR,P,C,S) //; - PARAMETER ELE_BPTL(R,YEAR,YEAR,P,C,TS) //; - PARAMETER ELE_BPTM(R,YEAR,YEAR,P,C,TS) //; - -* PAR_ACTL(R,V,T,P,S)$ECT_CHP(R,P) $= PAR_ACTL(R,V,T,P,S)*ECT_INP2ELC(R,V,P); -* PAR_ACTM(R,V,T,P,S)$(PAR_ACTM(R,V,T,P,S)$ECT_CHP(R,P)) $= PAR_ACTM(R,V,T,P,S)/ECT_INP2ELC(R,V,P); - -*--------------------------------------------------------------------- -* Output of VAR_CAP -*--------------------------------------------------------------------- - - PAR_BPTL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2ELC(R,V,P)*COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); - PAR_BPTM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P)/ECT_INP2ELC(R,V,P)* ((VAR_NCAP.M(R,V,P)/VDA_DISC(R,V))$T(V))); - - PAR_CAPL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2ELC(R,V,P) * COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); - PAR_PASTI(RTP(R,T,P)%SOW%)$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2ELC(R,V,P) * COEF_CPT(R,V,T,P) * NCAP_PASTI(R,V,P)); - PAR_CAPM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P) /ECT_INP2ELC(R,V,P)* ((VAR_NCAP.M(R,V,P)/VDA_DISC(R,V))$T(V))); - - PAR_NCAPL(RTP(R,V,P))$ECT_CHP(R,P) = VAR_NCAP.L(R,V,P) * ECT_INP2ELC(R,V,P); - PAR_NCAPM(RTP(R,T,P))$ECT_CHP(R,P) = (VAR_NCAP.M(R,T,P) / ECT_INP2ELC(R,T,P)/COEF_OBJINV(R,T,P))$COEF_OBJINV(R,T,P); - -*--------------------------------------------------------------------- -* ONLY for extraction condensing CHP plants -*--------------------------------------------------------------------- - - PAR_CONDL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2CON(R,V,P)*COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); - PAR_CONDM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P)/ECT_INP2CON(R,V,P) * (VAR_NCAP.M(R,V,P)$T(V))); - PAR_HEATL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2DHT(R,V,P)*COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); - PAR_HEATM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P)/ECT_INP2DHT(R,V,P) * (VAR_NCAP.M(R,V,P)$T(V))); - - ELE_BPTL(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) $= SUM(ECT_DHT(R,P,COM), ECT_REH(R,V,P)*VAR_FLO.L(R,V,T,P,COM,TS)); - ELE_BPTM(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) $= SUM(ECT_DHT(R,P,COM), VAR_FLO.M(R,V,T,P,COM,TS)/ECT_REH(R,V,P)); - ELE_CONDL(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) = VAR_FLO.L(R,V,T,P,C,TS) - SUM(ECT_DHT(R,P,COM), ECT_REH(R,V,P)*VAR_FLO.L(R,V,T,P,COM,TS)); - ELE_CONDM(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) = VAR_FLO.M(R,V,T,P,C,TS) - SUM(ECT_DHT(R,P,COM), VAR_FLO.M(R,V,T,P,COM,TS)/ECT_REH(R,V,P)); diff --git a/source/rpt_ext.mlf b/source/rpt_ext.mlf deleted file mode 100644 index f6405ab..0000000 --- a/source/rpt_ext.mlf +++ /dev/null @@ -1,113 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* RPT_EXT.mlf - Extension for MACRO MLF: Negishi iteration and reporting -*----------------------------------------------------------------------------- -* Common reporting parameter declarations -$ SET SOLVEDA 1 -$ BATINCLUDE rptlite.rpt -* Scenario index not supported in current version, use SOW 1 - SET SOW / 1 /; -*----------------------------------------------------------------------- -$ SET METHOD LP -$ IFI %NONLP%==NL $SET METHOD NLP - DOITER=1-INF$(DOITER=NA); - LOOP(NITER$DOITER, -* Perform Negishi iterations with tax rebate -*----------------------------------------------------------------------- -* Calculation of annual costs and commodity marginals - OPTION CLEAR=PAR_FLO,CLEAR=PAR_IRE; -$ BATINCLUDE sol_flo.red PAR_FLO '' .L -$ BATINCLUDE sol_ire.rpt - OPTION CLEAR=CST_PVP,CLEAR=CST_ACTC,CLEAR=CST_INVC,CLEAR=CST_INVX,CLEAR=CST_FIXC,CLEAR=CST_FIXX; - OPTION CLEAR=CAP_NEW,CLEAR=CST_FLOC,CLEAR=CST_FLOX,CLEAR=CST_COMC,CLEAR=CST_COMX,CLEAR=CST_IREC; -$ SET TIMESED NO -$ BATINCLUDE rpt_obj.rpt '' "" '' '%SYSPREFIX%' 0 -$ BATINCLUDE cost_ann.rpt -*----------------------------------------------------------------------- -* Calculate new Negishi weights - IF(CARD(MR)-MIN(0,DOITER), - TM_NWTIT(NITER,MR) = TM_NWT(MR); - LOOP(TB(T-1), MY_ARRAY(PP) = ABS(EQ_TRDBAL.M(PP)/EQ_TRDBAL.M(T))); - TM_NWT(MR(R)) = SUM(PP, MY_ARRAY(PP)*(VAR_C.L(R,PP)+VAR_NTX.L(R,PP))); - TM_NWT(MR) = TM_NWT(MR) / SUM(REG, TM_NWT(REG)); - IF(CARD(MR)=1, Z=0; ELSE Z = SUM(MR, ABS(TM_NWTIT(NITER,MR)-TM_NWT(MR)))); - F=TM_DEFVAL('NEGTOL'); IF(ORD(NITER)=1, F=F*(1+LOG(10**.1)) ELSE F=ABS(F)); -* Calculate rebate of tax revenues - RB(MR(R),T)=TM_TAXREV(R,T); - TM_TAXREV(MR(R),PP(T)) = REG_ACOST(R,T,'INVX')+REG_ACOST(R,T,'FIXX')+REG_ACOST(R,T,'VARX'); - DFUNC = SMAX(MR(R),TM_SCALE_CST*SUM(PP(T),COEF_PVT(R,T)*ABS(TM_TAXREV(R,T)-RB(R,T)))/SUM(PP(T),COEF_PVT(R,T)*VAR_EC.L(R,T)*TM_HDF(R,T))); - DISPLAY "Negishi Tolerance, Negishi Gap, Tax Gap:",F,Z,DFUNC; - DOITER=(MAX(Z,DFUNC)>=F+MIN(0,DOITER)); - IF(DOITER, SOLVE %MODEL_NAME% MAXIMIZING VAR_UTIL USING %METHOD%) - ELSE DOITER=0)); - -*----------------------------------------------------------------------- -* Calculation of undiscounted shadow prices in MACRO -*----------------------------------------------------------------------- - PARAMETER VDA_DISC(R,ALLYEAR) //; - VDA_DISC(MR,T) = ABS(-EQ_ENSCST.M(MR,T) * TM_SCALE_CST); - LOOP(MIYR_1(TT(T-1)),VDA_DISC(R,TT)$(VDA_DISC(R,TT) LE 0) = COEF_PVT(R,TT)/COEF_PVT(R,T)*VDA_DISC(R,T)); - VAR_OBJ.L(R,OBV(OBVANN),CUR)=0; -* Trade prices and implied costs/revenues - PAR_IPRIC(MR(R),PP(T),P,C,TS,IE)$PAR_IPRIC(R,T,P,C,TS,IE) = -PAR_IPRIC(R,T,P,C,TS,IE)*COEF_PVT(R,T)/VDA_DISC(R,T); - CST_IREC(RTP_VINTYR(MR(R),V,PP(T),P),C)$(RPC(R,P,C)$RP_IRE(R,P)) $= - SUM((RTPCS_VARF(R,T,P,C,S),RPC_IREIO(R,P,C,IE,'IN')),PAR_IPRIC(R,T,P,C,S,IE)*PAR_IRE(R,V,T,P,C,S,IE)); - REG_ACOST(MR(R),PP(T),'IRE') = SUM((VNT(V,T),P,C)$CST_IREC(R,V,T,P,C),CST_IREC(R,V,T,P,C)); - -*----------------------------------------------------------------------- -* Miscellaneous reportings -$ BATINCLUDE sol_flo.red PAR_FLO M .M - TM_UDF(R,T)=COEF_PVT(R,T); - COEF_PVT(MR,T) = -VDA_DISC(MR,T); -$ BATINCLUDE rptmisc.rpt '' '' - VAR_UTIL.UP = INF; - PAR_NCAPM(RTP(R,T,P))$(VAR_NCAP.M(RTP)*COEF_OBJINV(RTP)) = VAR_NCAP.M(RTP)*TM_UDF(R,T)/COEF_PVT(R,T)/COEF_OBJINV(RTP); - -*----------------------------------------------------------------------- -* Discounted objective values by cost type(INV, FIX, VAR etc.) -*----------------------------------------------------------------------- -* Discounted objective value by region - REG_WOBJ(R,'INV',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'INV')); - REG_WOBJ(R,'INVX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'INVX')); - REG_WOBJ(R,'FIX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'FIX')); - REG_WOBJ(R,'FIXX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'FIXX')); - REG_WOBJ(R,'VAR',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'VAR')); - REG_WOBJ(R,'VARX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'VARX')); - REG_WOBJ(R,'ELS',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'ELS')); -$IF DEFINED DAM_COST REG_WOBJ(R,'DAM',CUR) = VAR_OBJ.L(R,'OBJDAM',CUR); - REG_IREC(R) = SUM(T,TM_UDF(R,T)*REG_ACOST(R,T,'IRE')); - REG_OBJ(R) = SUM((ITEM,RDCUR(R,CUR))$REG_WOBJ(R,ITEM,CUR), REG_WOBJ(R,ITEM,CUR)); - OBJz.L = SUM(R,REG_OBJ(R)); - -*--------------------------------------------------------------------- -* Shadow prices of user constraints -*--------------------------------------------------------------------- -* Note: undiscounting only done for user constraints having region and period as index -$ IF %VAR_UC%==YES $GOTO UC_DONE -$ BATINCLUDE par_uc.rpt SM EQE -$ BATINCLUDE par_uc.rpt SM EQG -$ BATINCLUDE par_uc.rpt SM EQL -$ LABEL UC_DONE - -OPTION CLEAR=F_INOUT, CLEAR=F_INOUTS, CLEAR=F_IOSET; - -*--------------------------------------------------------------------- -* Report parameters for TIMES-MACRO -*--------------------------------------------------------------------- - - PAR_Y(MR(R),T(TB)) = TM_Y0(R); PAR_Y(MR(R),PP(T)) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_EC.L(R,T) + VAR_NTX.L(R,T); - TM_GDP(MR(R),T(TB)) = TM_GDP0(R); TM_GDP(MR(R),PP(T)) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_NTX.L(R,T); - -* Reporting parameters - TM_RESULT('TM_GDP-REF',MR,T) = TM_GDPGOAL(MR,T); - TM_RESULT('TM_GDP-ACT',MR,T) = TM_GDP(MR,T); - TM_RESULT('TM_PRD-Y',MR,T) = PAR_Y(MR,T); - TM_RESULT('TM_CON-C',MR,T) = VAR_C.L(MR,T); - TM_RESULT('TM_CAP-K',MR,T) = VAR_K.L(MR,T); - TM_RESULT('TM_INV-I',MR,T) = VAR_INV.L(MR,T); - TM_RESULT('TM_ESCOST',MR,T) = VAR_EC.L(MR,T); - TM_RESULT('TM_GDPLOS',MR,T) = 100*(TM_GDPGOAL(MR,T)-TM_GDP(MR,T))/TM_GDPGOAL(MR,T); - DISPLAY TM_RESULT; \ No newline at end of file diff --git a/source/rpt_ext.msa b/source/rpt_ext.msa deleted file mode 100644 index c33b86c..0000000 --- a/source/rpt_ext.msa +++ /dev/null @@ -1,63 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* RPT_EXT.msa - Extension for MACRO Stand-Alone link: soft-link driver -*----------------------------------------------------------------------------- -* Questions/Comments: -* -*----------------------------------------------------------------------------- - SET MACST / VAR, IRE, DAM /; - LOOP(T,MR(R)$(REG_FIXT(R) LT YEARVAL(T)) = YES); - MR(R)$(NOT SUM(ALLYEAR$TM_GR(R,ALLYEAR),YES)) = NO; - MREG(MR) = YES; -*----------------------------------------------------------------------------- -$ SET SOLVEDA 1 -$ BATINCLUDE rptlite.rpt -$ SET SOLVEDA 0 -$ BATINCLUDE solprep.msa INIT 0 -$ IF %RPOINT%==NO $GOTO PREPRO - %MODEL_NAME%.OPTFILE = 1; -$ BATINCLUDE pp_clean.mod -$ IF SET FIXBOH $BATINCLUDE solve.stp mod -$ LABEL PREPRO -*----------------------------------------------------------------------------- -* Process macro parameters - TM_DEPR(R)$(NOT TM_DEPR(R)) = TM_DEFVAL('DEPR'); - TM_ESUB(R)$(NOT TM_ESUB(R)) = TM_DEFVAL('ESUB'); - TM_KGDP(R)$(NOT TM_KGDP(R)) = TM_DEFVAL('KGDP'); - TM_KPVS(R)$(NOT TM_KPVS(R)) = TM_DEFVAL('KPVS'); - TM_DMTOL(R)$(NOT TM_DMTOL(R)) = TM_DEFVAL('DMTOL'); - TM_IVETOL(R)$(NOT TM_IVETOL(R)) = TM_DEFVAL('IVETOL'); - - IF(CARD(TM_GROWV)=0, TM_GROWV(R,T) $= TM_GR(R,T)); -$IFI %MSA%==CSA TM_AMP(MR,T) = MAX(0,SMAX(PP(TT)$(ORD(TT)>ORD(T)),TM_ANNC(MR,TT)/(TM_GDPGOAL(MR,TT)/TM_GDPGOAL(MR,T))*POWER(TM_DEFVAL('ESC'),YEARVAL(T)-YEARVAL(TT)))-TM_ANNC(MR,T)); - OPTION DEM < TM_DEM; - OPTION MRTC < TM_DEM; - IF(CARD(TM_DDF) = 0, TM_DDF(MRTC) = EPS); - VAR_NTX.FX(MR,TP,TRD) = EPS; TRD(MACST) = NO; - -*----------------------------------------------------------------------------- -$ BATINCLUDE solvcoef.msa -*----------------------------------------------------------------------------- -* Complete BEOH parameters for damage - LOOP(TLAST(T), F=E(T); CNT=TM_PWT(T)/D(T)); - LOOP((XTP(YEAR),SUPERYR(TLAST,LL(YEAR-CM_LED(YEAR)))),Z=CM_LED(XTP)/2; MY_F=YEARVAL(LL); - IF(MY_F>F,TM_PWT(LL)=CNT*(MY_F-F+Z); F=MY_F+Z); TM_PWT(XTP)=CNT*CEIL(YEARVAL(XTP)-F); - TM_UDF(R,XTP) = TM_UDF(R,LL) * TM_DFACTCURR(R,LL)**(2*Z)); - Z=SUM(TLAST(T),B(T)+TM_ARBM*D(T)); TM_XWT(R,XTP)$(CM_LED(XTP)>0)=(MIN(YEARVAL(XTP),Z)-MIN(YEARVAL(XTP)-CM_LED(XTP),Z))/CM_LED(XTP)*TM_PWT(XTP)*TM_UDF(R,XTP); - LOOP(PP(T),TM_XWT(MR(R),XTP)$SUPERYR(T,XTP)=TM_XWT(R,XTP)/SUM(SUPERYR(T,LL)$XTP(LL),TM_XWT(R,LL))); -*----------------------------------------------------------------------------- -$ BATINCLUDE solve.msa -*----------------------------------------------------------------------------- - -* Reporting parameters - TM_RESULT('TM_GDP-REF',MR,T) = TM_GDPGOAL(MR,T); - TM_RESULT('TM_GDP-ACT',MR,T) = TM_GDP(MR,T); - TM_RESULT('TM_PRD-Y',MR,T) = VAR_Y.L(MR,T); - TM_RESULT('TM_CON-C',MR,T) = VAR_C.L(MR,T); - TM_RESULT('TM_INV-I',MR,T) = VAR_INV.L(MR,T); - TM_RESULT('TM_ESCOST',MR,T) = VAR_EC.L(MR,T); -$IFI %MSA%==MSA TM_RESULT('TM_GDPLOS',MR,T) = 100*(TM_GDPGOAL(MR,T)-TM_GDP(MR,T))/TM_GDPGOAL(MR,T); - DISPLAY TM_RESULT; \ No newline at end of file diff --git a/source/rpt_obj.rpt b/source/rpt_obj.rpt deleted file mode 100644 index 5a9d4c1..0000000 --- a/source/rpt_obj.rpt +++ /dev/null @@ -1,145 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* RPT_OBJ.rpt is the objective function reporter for rptlite TIMES -* %1 - S OR '' -* %2 - SOW, or '1', OR '' -* %3 - ,SOW OR '' -*=============================================================================* - OPTION CLEAR=NCAP_YES,CLEAR=RTP_OBJ,CLEAR=RTP_NPV,CLEAR=RTP_CAPVL; - RTP_CAPVL(RTP)=VAR_NCAP.L(RTP)+NCAP_PASTI(RTP); - NCAP_YES(RTP)$(RTP_CAPVL(RTP)>0) = YES; - MY_F=ROUND(RPT_OPT('OBJ','1')); -$ SETLOCAL SIC '' SET TMP '' -$IFI '%STAGES%'==YES $SETLOCAL SIC "*(1+PASTSUM(R,V,P))" -$IFI '%STAGES%'==YES PASTSUM(NCAP_YES(R,T,P)) = SUM(SW_TSW(SOW,T,WW),OBJ_SIC(R,T,P,WW)); MY_F=EPS$MY_F; -*------------------------------------------------------------------------------ -* Hurdle rates - COEF_CRF(OBJ_ICUR(NCAP_YES(R,V,P),CUR))$(NCAP_DRATE(R,V,P)>0) = MAX(0,1- - ((1-(1+NCAP_DRATE(R,V,P))**(-NCAP_ELIFE(R,V,P))) / (1-(1+OBJ_RFR(R,V,CUR))**(-NCAP_ELIFE(R,V,P)))) / - (NCAP_DRATE(R,V,P)/OBJ_RFR(R,V,CUR)*((1+NCAP_DRATE(R,V,P))/(1+OBJ_RFR(R,V,CUR)))**MIN(%DISCSHIFT%-1,-0.5$NCAP_ILED(R,V,P)))); -*------------------------------------------------------------------------------ -* Lump-sum investment costs -*------------------------------------------------------------------------------ -$SET P1 "'%SYSPREFIX%INSTCAP'" - %1CAP_NEW(%2RVPT(NCAP_YES(R,T,P),TT),%P1%) = VAR_NCAP.L(R,T,P); - %1CAP_NEW(%2NCAP_YES(R,T,P),T,%P1%)$(NOT OBJ_2A(R,T,P)) = COEF_RPTI(R,T,P)*VAR_NCAP.L(R,T,P); - OPTION CLEAR=UNCD1; UNCD1(J)$(ORD(J)<3)=YES; - RTP_OBJ(JJ(UNCD1(J)),OBJ_ICUR(NCAP_YES(R,T(V),P),CUR))= -$IF '%ETL%'==YES (VAR_IC.L(R,T,P)*COR_SALVI(R,T,P,CUR))$SEG(R,P) + - SUM((OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT),INVSPRED(K_EOH,JOT,Y,K)), - (OBJ_ICOST(R,K,P,CUR)%SIC%$(ORD(J)=2)+(OBJ_ITAX(R,K,P,CUR)-OBJ_ISUB(R,K,P,CUR))$(ORD(J)=1))) * - VAR_NCAP.L(R,T,P) * COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) / - (1+G_DRATE(R,T,CUR))**(%DISCSHIFT%$(NOT NCAP_ILED(R,T,P))); - SYSPLIT(SYSUC)=1-SUM(SYSUCMAP(SYSUC,ITEM),1); - LOOP(UNCD1(J),%1CAP_NEW(%2R,T,P,TT,SYSUC)$(%1CAP_NEW(%2R,T,P,TT,%P1%)$SUCMAP(J,SYSUC))=SUM(RDCUR(R,CUR),RTP_OBJ(J,R,T,P,CUR)*ABS(SYSPLIT(SYSUC)-COEF_CRF(R,T,P,CUR))) - IF(NOT MY_F,OPTION CLEAR=COEF_CRF)); - OPTION CLEAR=RTP_OBJ; -*----------------------------------------------------------------------------- -* Objective function by component -*----------------------------------------------------------------------------- -* Check objective INV - RTP_OBJ('1',OBJ_ICUR(NCAP_YES(R,V,P),CUR)) = - SUM(OBJ_SUMII(R,V,P,AGE,K_EOH,JOT), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,YEAR,K), OBJ_DISC(R,K,CUR) * (1-SALV_INV(R,V,P,YEAR)) * OBJ_ICOST(R,K,P,CUR)) * - (VAR_NCAP.L(R,V,P)$T(V) + OBJ_PASTI(R,V,P,CUR))%SIC% * COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)) + - SUM(OBJ_SUMIII(R,V,P,LL,K,Y), OBJ_DISC(R,Y,CUR) * (1-SALV_INV(R,V,P,LL)) * - (VAR_NCAP.L(R,V,P)$T(V) + OBJ_PASTI(R,V,P,CUR)) / OBJ_DIVIII(R,V,P) * - (COR_SALVD(R,V,P,CUR)*OBJ_DCOST(R,K,P,CUR)-SUM(C$NCAP_OCOM(R,V,P,C),NCAP_OCOM(R,V,P,C)*NCAP_VALU(R,K,P,C,CUR))$(NOT Y_EOH(Y)))) - - SUM(OBJ_SUMIVS(R,V,P,K,Y),OBJ_DISC(R,Y,CUR)*SALV_INV(R,V,P,K)*OBJ_DLAGC(R,K,P,CUR)*RTP_CAPVL(R,V,P)); - -* Discounted taxes & subsidies - RTP_OBJ('2',OBJ_ICUR(NCAP_YES(R,V,P),CUR)) = - SUM(OBJ_SUMII(R,V,P,AGE,K_EOH,JOT), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,YEAR,K), OBJ_DISC(R,K,CUR) * (1-SALV_INV(R,V,P,YEAR)) * - (OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))) * - (VAR_NCAP.L(R,V,P)$T(V) + OBJ_PASTI(R,V,P,CUR)) * COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)); - -$IF NOT DEFINED VNRET $GOTO ISUM - VAR_SCAP.L(R,T,'0',P)$(NCAP_FDR(R,T,P)$RVPRL(R,'0',P)$RVPRL(R,T,P)) = RTP_CAPVL(R,T,P); - PAR_OBJCAP(OBJ_ICUR(NCAP_YES(R,V,P),CUR))$RVPRL(R,V,P)=OBJSCC(R,V,P,CUR)*OBJ_DCEOH(R,CUR)*(RTP_CAPVL(R,V,P)-VAR_SCAP.L(R,V,'0',P))$OBJ_SUMS(R,V,P); - RTP_OBJ('1',R,V,P,CUR)$PAR_OBJCAP(R,V,P,CUR) = RTP_OBJ('1',R,V,P,CUR)+PAR_OBJCAP(R,V,P,CUR)*(1-(1/(1+RTP_OBJ('1',R,V,P,CUR)/RTP_OBJ('2',R,V,P,CUR)))$(RTP_OBJ('2',R,V,P,CUR)>0)); - RTP_OBJ('2',R,V,P,CUR)$((RTP_OBJ('2',R,V,P,CUR)>0)$PAR_OBJCAP(R,V,P,CUR)) = RTP_OBJ('2',R,V,P,CUR)+PAR_OBJCAP(R,V,P,CUR)/(1+RTP_OBJ('1',R,V,P,CUR)/RTP_OBJ('2',R,V,P,CUR)); - RTP_ISHPR(RTP(R,V,P))$PRC_RCAP(R,P)=YES; -$ SET TMP (1-(VAR_SCAP.L(R,V,Y,P)/PASTSUM(R,V,P)/OBJ_DIVIV(R,V,P))$PRC_RCAP(R,P))* -$LABEL ISUM - - %1REG_WOBJ(%2R,'INVX',CUR) = SUM(OBJ_ICUR(NCAP_YES(R,V,P),CUR),RTP_OBJ('2',R,V,P,CUR)); - OBJVAL_1 = SUM(OBJ_ICUR(NCAP_YES(R,V,P),CUR),RTP_OBJ('1',R,V,P,CUR)) + SUM(RDCUR(R,CUR),%1REG_WOBJ(%2R,'INVX',CUR)); - OBJVAL_2 = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJINV',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%VAR%_OBJ.L(R,'OBJSAL',CUR%3)); -$IF NOT %1==S DISPLAY OBJVAL_1,OBJVAL_2; - - IF(MY_F, SYSINV('%4INV+')=YES); - IF(MY_F>0,OPTION TRACKP0,OPTION TRACKP0, - OPTION PAR_RPMX < PAR_ACTC; - %1CST_PVP(%2'%4ACT',RP) $= SUM((J,V,T,C,CUR)$PAR_RPMX(RP,J,V,T,C,CUR),PAR_RPMX(RP,J,V,T,C,CUR)); - OPTION PAR_RPMX < PAR_FLOC; - %1CST_PVP(%2'%4FLO',RP) $= SUM((J,V,T,C,CUR)$PAR_RPMX(RP,J,V,T,C,CUR),PAR_RPMX(RP,J,V,T,C,CUR)); - OPTION PAR_RCMX < PAR_COMC; - %1CST_PVC(%2'%4COM',RC) $= SUM((J,T,CUR)$PAR_RCMX(RC,J,T,CUR),PAR_RCMX(RC,J,T,CUR)); - ); - %1REG_WOBJ(%2R,'VARX',CUR) = SUM((V,T,P,C)$PAR_FLOC('2',R,V,T,P,C,CUR),PAR_FLOC('2',R,V,T,P,C,CUR)) + - SUM((T,C)$PAR_COMC('2',R,T,C,CUR),PAR_COMC('2',R,T,C,CUR)); -*------------------------------------------------------------------------------ - LOOP(RDCUR(R,CUR), - %1REG_WOBJ(%2R,'INV',CUR) = SUM(OBV,SUM_OBJ('OBJINV',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%VAR%_OBJ.L(R,'OBJSAL',CUR%3)-%1REG_WOBJ(%2R,'INVX',CUR)+EPS; - %1REG_WOBJ(%2R,'FIX',CUR) = SUM(OBV,SUM_OBJ('OBJFIX',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%1REG_WOBJ(%2R,'FIXX',CUR)+EPS; - %1REG_WOBJ(%2R,'VAR',CUR) = SUM(OBV,SUM_OBJ('OBJVAR',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%1REG_WOBJ(%2R,'VARX',CUR)+EPS; -* Elastic demand costs - %1REG_WOBJ(%2R,'ELS',CUR) = EPS -$IF %TIMESED% == YES +SUM(BD,%VAR%_OBJELS.L(R,BD,CUR%3)*(BDSIG(BD)-1$LNX(BD))) - ); -$IFI %5==0 $EXIT -*------------------------------------------------------------------------------ -* Calculate VAR_NCAP coefficients -$BATINCLUDE rpt_objc.rpt "%1" "%2" %4 diff --git a/source/rpt_objc.rpt b/source/rpt_objc.rpt deleted file mode 100644 index 7050734..0000000 --- a/source/rpt_objc.rpt +++ /dev/null @@ -1,128 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* RPT_OBJC.rpt calculates the objective function coefficients for VAR_NCAP * -*=============================================================================* -* Remove any invalid marginals of OFFed technologies - VAR_NCAP.M(RTP_OFF(R,T,P)) = 0; CNT = RPT_OPT('NCAP','1'); -*------------------------------------------------------------------------------- -* Calculate the effect of a one unit of investment costs to the objective. - OPTION CLEAR=PAR_OBJCAP; - PAR_OBJCAP(OBJ_ICUR(R,T,P,CUR)) = COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * - SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,Y,K), (1-SALV_INV(R,T,P,Y)$OBJ_SUMS(R,T,P)) * OBJ_DISC(R,K,CUR))); -* If does not carry investment costs, just undiscount with most common inv. spread - LOOP(G_RCUR(R,CUR), MY_ARRAY(T)=SUM(PERDINV(T,Y),OBJ_DISC(R,Y,CUR))/LEAD(T); COEF_OBJINV(RTP(R,T,P))$PRC_CAP(R,P)=MY_ARRAY(T)); - COEF_OBJINV(RTP(R,T,P)) $= SUM(RDCUR(R,CUR)$PAR_OBJCAP(R,T,P,CUR),PAR_OBJCAP(R,T,P,CUR)); -*------------------------------------------------------------------------------- -$IF %STAGES%==YES $SET BENCOST NO -$IFI '%BENCOST%'==YES CNT = 1; -*------------------------------------------------------------------------------- -* Investment cost coefficient - OPTION CLEAR=PAR_OBJCAP; - IF(CNT, - PAR_OBJCAP(OBJ_ICUR(R,T,P,CUR)) = COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * - SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT), %CAPJD% - SUM(INVSPRED(K_EOH,JOT,Y,K), OBJ_DISC(R,K,CUR) * - (OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR) -$IFI %STAGES%==YES +SUM(SW_TSW(SOW,T,WW)$OBJ_SIC(R,T,P,WW),OBJ_SIC(R,T,P,WW)*OBJ_ICOST(R,K,P,CUR)*(1-SALV_INV(R,T,P,Y))) - ))); - -* Decommissioning costs - OPTION CLEAR=PAR_OBJSAL; - PAR_OBJSAL(RTP(R,T,P),CUR)$RDCUR(R,CUR) = COR_SALVD(R,T,P,CUR) / OBJ_DIVIII(R,T,P) * - SUM(OBJ_SUMIII(R,T,P,LL,K,Y)$OBJ_DCOST(R,T,P,CUR), OBJ_DISC(R,Y,CUR) * OBJ_DCOST(R,K,P,CUR)); - - PAR_OBJCAP(RTP(R,T,P),CUR)$PAR_OBJSAL(R,T,P,CUR) = PAR_OBJCAP(R,T,P,CUR) + PAR_OBJSAL(R,T,P,CUR)); -*------------------------------------------------------------------------------- -* Fixed O&M cost coefficient - OPTION CLEAR=PAR_OBJSAL; - IF(CNT, - PAR_OBJSAL(OBJ_FCUR(R,T,P,CUR)) = - SUM(OBJ_SUMIV(K_EOH,R,T,P,JOT,LIFE)$(NOT RTP_ISHPR(R,T,P)), - SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_LIFE(LL,R,JOT,LIFE,CUR) * %CAPWD% - (OBJ_FOM(R,K,P,CUR)+OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))) / OBJ_DIVIV(R,T,P)) + - - SUM(OBJ_SUMIV(K_EOH,RTP_ISHPR(R,T,P),JOT,LIFE), - SUM((INVSPRED(K_EOH,JOT,LL,K),OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))), - OBJ_DISC(R,Y_EOH,CUR) * %CAPWD% - ( - OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,T,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + - OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,T,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - - OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,T,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - ) - ) / OBJ_DIVIV(R,T,P)); - - PAR_OBJCAP(RTP(R,T,P),CUR)$PAR_OBJSAL(R,T,P,CUR) = PAR_OBJCAP(R,T,P,CUR) + PAR_OBJSAL(R,T,P,CUR)); -*------------------------------------------------------------------------------- -* Decommissioning Surveillance coefficient - PAR_OBJCAP(RTP(R,T,P),CUR)$(OBJ_DLAGC(R,T,P,CUR)$CNT) = PAR_OBJCAP(R,T,P,CUR) + - SUM(OBJ_SUMIVS(R,T,P,K,Y), OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR)); -*------------------------------------------------------------------------------- -* Capacity-related flow cost coefficient - OPTION CLEAR=PAR_OBJSAL; - PASTSUM(RTP(R,V(TT),P))$CNT = - SUM((RPC_CAPFLO(R,V,P,C),RDCUR(R,CUR)), -* Flows related to investment / decommissioning - SUM(VNT(V,T)$(COEF_ICOM(R,V,T,P,C)+COEF_OCOM(R,V,T,P,C)),(COEF_ICOM(R,V,T,P,C)+COEF_OCOM(R,V,T,P,C)) * - SUM(RPCS_VAR(R,P,C,TS), G_YRFR(R,TS) * SUM(TS_ANN(TS,SL),SUM(%TPULSE%(OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR)))))) + -* Flows related to existing capacity over lifetime - SUM((RTP_CPTYR(R,V,T,P),IO)$NCAP_COM(R,V,P,C,IO), - COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,IO) * (1 + COEF_CIO(R,V,T,P,C,IO)) * - SUM(RPCS_VAR(R,P,C,TS), G_YRFR(R,TS) * SUM(TS_ANN(TS,SL),SUM(%TPULSE%(OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR)))))) - ); -*------------------------------------------------------------------------------- -$LABEL SALVAGE -* Salvage coefficient - OPTION CLEAR=PAR_OBJSAL,CLEAR=COEF_RTP; - PAR_OBJSAL(RTP(R,T,P),CUR)$RDCUR(R,CUR) = -* Cases I - Investment Cost and II - Taxes/Subsidies - SUM(OBJ_SUMS(R,T,P), OBJSCC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) * (1+SUM(NCAP_YES(RTP),VAR_SCAP.L(R,T,'0',P)/RTP_CAPVL(RTP)-1)$RVPRL(RTP)) + -* Cases III - Decommissioning - SUM(OBJ_SUMS3(R,T,P), SALV_DEC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) + -* Cases IV - Decommissioning Surveillance - SUM(OBJ_SUMIVS(R,T,P,K,Y)$SALV_INV(R,T,P,K), - OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,T,P,K)); - - COEF_RTP(R,T,P) $= SUM(CUR$PAR_OBJCAP(R,T,P,CUR),ROUND(PAR_OBJCAP(R,T,P,CUR)-PAR_OBJSAL(R,T,P,CUR),7)); -$IFI NOT '%BENCOST%'==YES $GOTO FINISH -*------------------------------------------------------------------------------- -* Add range information if available - OPTION CLEAR=VAR_NCAPRNG; - IF(CNT, - execute 'test -s timesrng.inc' - IF(NOT ERRORLEVEL, - EXECUTE 'GAMS %system.fp%timesrng PS=0'; - EXECUTE_LOAD 'timesrng',VAR_NCAPRNG; - )); -*------------------------------------------------------------------------------- -* Calculate CostBen indicators - %1PAR_NCAPR(%2RTP(R,T,P),'%3COST') $= COEF_RTP(R,T,P)+PASTSUM(R,T,P); - PASTSUM(R,T,P)$%1PAR_NCAPR(%2R,T,P,'%3COST') = VAR_NCAP.M(R,T,P)+EPS; - PASTSUM(RTP(R,T,P))$((VAR_NCAPRNG(RTP,'LO') GT -9E9)$(ABS(VAR_NCAP.L(RTP)) LT MICRO)$PASTSUM(RTP)) = MAX(PASTSUM(RTP),-VAR_NCAPRNG(RTP,'LO')); - OPTION RVP < PASTSUM; - %1PAR_NCAPR(%2RTP(R,T,P),'%3CGAP')$%1PAR_NCAPR(%2RTP,'%3COST') = PASTSUM(RTP)+EPS; - %1PAR_NCAPR(%2RVP(R,T,P),RNGLIM) = SUM(RNGMAP(RNGLIM,BD),VAR_NCAPRNG(R,T,P,BD)); -*------------------------------------------------------------------------------- -* Calculate the net activity benefits - BC_INVACT(RTP_VINTYR(R,V,T,P),S)$(PRC_TS(R,P,S)$RVP(R,V,P)) = - -ROUND(VAR_ACT.M(R,V,T,P,S)+SMIN(RPC_PG(R,P,C),VAR_FLO.M(R,V,T,P,C,S)*PRC_ACTFLO(R,V,P,C)),7); -* Calculate the corresponding net NCAP benefits - BC_INVTOT(RVP(R,V,P))$(NOT PRC_VINT(R,P)) = PRC_CAPACT(R,P) * - SUM((RTP_CPTYR(R,V,T,P),PRC_TS(R,P,S),BDUPX(BD))$COEF_AF(R,V,T,P,S,BD), COEF_CPT(R,V,T,P) * COEF_AF(R,V,T,P,S,BD) * - G_YRFR(R,S) * MAX(-INF$BDLOX(BD),BC_INVACT(R,T,T,P,S))); - BC_INVTOT(RVP(R,V,P))$PRC_VINT(R,P) = PRC_CAPACT(R,P) * - SUM((RTP_VINTYR(R,V,T,P),PRC_TS(R,P,S),BDUPX(BD))$COEF_AF(R,V,T,P,S,BD), COEF_CPT(R,V,T,P) * COEF_AF(R,V,T,P,S,BD) * - G_YRFR(R,S) * MAX(-INF$BDLOX(BD),BC_INVACT(R,V,T,P,S))); -* Add the net activity benefits to the net capacity benefits - BC_INVTOT(RVP(R,T,P)) = BC_INVTOT(R,T,P) - VAR_NCAP.M(R,T,P) - SUM(TT$COEF_CPT(R,T,TT,P), COEF_CPT(R,T,TT,P) * VAR_CAP.M(R,TT,P)) +EPS; - %1PAR_NCAPR(%2RVP(R,T,P),'%3GGAP') = MAX(-BC_INVTOT(R,T,P),(PASTSUM(R,T,P)-INF$(PASTSUM(R,T,P) LE MICRO))); -* Normalize and calculate RATIOs - %1PAR_NCAPR(%2RTP(R,T,P),SYSUC)$%1PAR_NCAPR(%2R,T,P,SYSUC) = %1PAR_NCAPR(%2R,T,P,SYSUC)/COEF_OBJINV(R,T,P); - %1PAR_NCAPR(%2RVP(R,T,P),'%3GRATIO') = 1-ROUND(%1PAR_NCAPR(%2R,T,P,'%3GGAP')/%1PAR_NCAPR(%2R,T,P,'%3COST'),7)+EPS; - %1PAR_NCAPR(%2R,T,P,'%3RATIO')$COEF_RTP(R,T,P) = 1-ROUND(%1PAR_NCAPR(%2R,T,P,'%3CGAP')/%1PAR_NCAPR(%2R,T,P,'%3COST'),6)+EPS; -*------------------------------------------------------------------------------- -$LABEL FINISH - OPTION CLEAR=RVP,CLEAR=PASTSUM; diff --git a/source/rpt_par.cli b/source/rpt_par.cli deleted file mode 100644 index 2fca3d6..0000000 --- a/source/rpt_par.cli +++ /dev/null @@ -1,79 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*----------------------------------------------------------------------------- -* RPT_PAR.cli - Extension for Climate Module -* %1-%2 - none or LOOP(SOW, ) for stochastics -*----------------------------------------------------------------------------- -* Questions/Comments: -* -*----------------------------------------------------------------------------- -* Calculate Reporting parameters for Climate Module -%1 - OPTION CLEAR=CM_RESULT,CLEAR=CM_MAXC_M; -*----------------------------------------------------------------------------- -* Calculate incremental radiative forcing in each year - OPTION CLEAR=MY_ARRAY; - MY_F = SUM(CM_BOXMAP('CO2-GTC',CM_VAR,CM_BOX)$CM_PHI('CO2-GTC',CM_BOX,'CO2-GTC'),CM_CONST(CM_VAR))/CM_CONST('CO2-PREIND'); - VALLVL = CM_CONST('GAMMA') / LOG(2); - Z = SMIN(T,M(T))-CM_CALIB; - LOOP(LL$CM_LED(LL), CNT = MAX(1,CM_LED(LL)); - ATTLVL = SUM(CM_BOXMAP('CO2-GTC',CM_VAR,CM_BOX)$CM_PHI('CO2-GTC',CM_BOX,'CO2-GTC'),VAR_CLIBOX.L(CM_VAR,LL))/CM_CONST('CO2-PREIND'); - Z = (ATTLVL - MY_F) / CNT; - FOR(F = 0 TO CNT-1, MY_ARRAY(LL-F) = VALLVL*LOG(ATTLVL-F*Z)+CM_EXOFORC(LL-F)); - MY_F = ATTLVL; - ); - CM_RESULT('FORC+CO2',LL)$CM_LED(LL) = MY_ARRAY(LL)-CM_EXOFORC(LL); -*----------------------------------------------------------------------------- -* Calculate radiative forcing from other emissions in each year - LOOP(SUPERYR(T,LL)$CM_LED(LL), CM_RESULT(CM_OFOR,LL) = - SUM(CM_FORCMAP(CM_OFOR,CM_EMIS),CM_LINFOR(LL,CM_EMIS,'FX')+CM_LINFOR(LL,CM_EMIS,'N')/CM_PPM(CM_EMIS)* - SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),VAR_CLIBOX.L(CM_VAR,LL))) + - SUM(CM_FORCMAP(CM_TKIND(CM_OFOR),CM_VAR)$(NOT CM_EMIS(CM_VAR)),VAR_CLITOT.L(CM_OFOR,LL))); - LOOP(MIYR_1(T), FIRST_VAL = - SUM(CM_FORCMAP(CM_OFOR,CM_EMIS),CM_LINFOR(T,CM_EMIS,'FX')+CM_LINFOR(T,CM_EMIS,'N')/CM_PPM(CM_EMIS)* - SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),CM_CONST(CM_VAR))) + - SUM(CM_FORCMAP(CM_TKIND,CM_VAR)$(NOT CM_EMIS(CM_VAR)),VAR_CLITOT.L(CM_TKIND,T))); - LOOP(LL$CM_LED(LL), CNT = MAX(1,CM_LED(LL)); - LAST_VAL = SUM(CM_FORCMAP(CM_OFOR,CM_VAR),CM_RESULT(CM_OFOR,LL)); - FOR(F = 0 TO CNT-1, MY_F = F/CNT; MY_FIL2(LL-F) = MY_F*FIRST_VAL+(1-MY_F)*LAST_VAL); - FIRST_VAL = LAST_VAL); - MY_ARRAY(LL)$MY_ARRAY(LL) = MY_ARRAY(LL) + MY_FIL2(LL); -*----------------------------------------------------------------------------- - CM_DT_FORC(LL) = MY_ARRAY(LL); -*----------------------------------------------------------------------------- -* Calculate the ith powers of SIG, i=1...Z, where Z = LEAD(T) -* First intialize CM_DD to the identity matrix, CM_EE to zero - LOOP((CM_VAR('FORCING'),LL)$CM_LED(LL), Z = CM_LED(LL); - OPTION CLEAR=CM_RR; - CM_RR('1',CM_BUCK,CM_BOX) = DIAG(CM_BUCK,CM_BOX); - FOR(F = 0 TO Z-1, - CM_RR('2',CM_BOX,'LO') = CM_RR('2',CM_BOX,'LO') + MY_ARRAY(LL-F)*CM_RR('1',CM_BOX,'ATM'); - CM_RR('1',CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_RR('1',CM_BUCK,ITEM)*CM_SIG(SOW,ITEM,CM_BOX)); - ); -* Calculate temperature changes - CM_DELTAT(LL,CM_BOX) = - CM_RR('1',CM_BOX,'ATM') * CM_DELTAT(LL-CM_LED(LL),'ATM') + - CM_RR('1',CM_BOX,'LO') * CM_DELTAT(LL-CM_LED(LL),'LO') + - CM_RR('2',CM_BOX,'LO') * CM_SIG1(SOW) + - (CM_RR('1',CM_BOX,'ATM') * CM_CONST('DELTA-ATM') + - CM_RR('1',CM_BOX,'LO') * CM_CONST('DELTA-LO'))$MIYR_1(LL); - ); -*----------------------------------------------------------------------------- -* Shadow price of total and maximum constraints - CM_MAXC_M(CM_VAR,T) $= ABS(EQ_CLITOT.M(CM_VAR,T,T)); - CM_MAXC_M(CM_VAR,LL) $= MAX(CM_MAXC_M(CM_VAR,LL),ABS(EQ_CLIMAX.M(LL,CM_VAR)))$EQ_CLIMAX.M(LL,CM_VAR); - -*----------------------------------------------------------------------------- -* Collect all basic results - CM_RESULT(CM_VAR,LL) $= VAR_CLITOT.L(CM_VAR,LL); - CM_RESULT(CM_VAR,LL) $= VAR_CLIBOX.L(CM_VAR,LL); - LOOP(CM_ATMAP(CM_EMIS,CM_HISTS), CM_RESULT(CM_HISTS,LL)$CM_LED(LL) = - SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),VAR_CLIBOX.L(CM_VAR,LL))/CM_PPM(CM_EMIS)); - CM_RESULT('FORC+TOT',LL)$CM_LED(LL) $= CM_DT_FORC(LL); - CM_RESULT('DELTA+ATM',LL) $= CM_DELTAT(LL,'ATM'); - CM_RESULT('DELTA+LO',LL) $= CM_DELTAT(LL,'LO'); - CM_SRESULT(SOW,ITEM,LL) $= CM_RESULT(ITEM,LL); - CM_SMAXC_M(SOW,ITEM,LL) $= CM_MAXC_M(ITEM,LL); -%2 \ No newline at end of file diff --git a/source/rptlite.rpt b/source/rptlite.rpt deleted file mode 100644 index a5e0ffc..0000000 --- a/source/rptlite.rpt +++ /dev/null @@ -1,175 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* RPTLITE.rpt is the main driver for the light-weight report writer for TIMES -* %1 - mod or v# for the source code to be used -*=============================================================================* -*----------------------------------------------------------------------------- -$IF NOT %SOLVEDA%==1 $SHIFT SHIFT SHIFT -$IF '%4'=='NO' $GOTO REPORT -$BATINCLUDE solsysd.v3 SYSUC ! '%SYSPREFIX%' VAR VARX INV INVX INV+ INVX+ FIX FIXX IRE COM ACT FLO ELS DAM DAS DAM-EXT+ -$BATINCLUDE solsysd.v3 SYSUC ,% '%SYSPREFIX%' INSTCAP LUMPINV LUMPIX COST CGAP GGAP RNGLO RNGUP RATIO GRATIO LEVCOST -*----------------------------------------------------------------------------- - ALIAS(ALLSOW,WW); -$IF SET RPT_OPT PARAMETER RPT_OPT / %RPT_OPT% /; -$IF %RPT_FLOTS%==COM RPT_OPT('FLO','1')=1; - RPT_OPT(ITEM,J)$(RPT_OPT(ITEM,J)=0)=0; - RPT_OPT('FLO','1')$RPT_OPT('FLO','3')=1; -*----------------------------------------------------------------------------- -* Other general parameters and sets - PARAMETERS - RTP_OBJ(J,R,ALLYEAR,P,CUR) // - RTP_NPV(J,R,ALLYEAR,P,CUR) // - PAR_ACTC(J,R,LL,T,P,C,CUR) - PAR_FLOC(J,R,LL,T,P,C,CUR) - PAR_COMC(J,R,T,C,CUR) - PAR_RPMX(R,P,J,LL,T,C,CUR) - PAR_RCMX(R,C,J,T,CUR) - PAR_OBJCAP(R,ALLYEAR,P,CUR) - COEF_OBJINV(R,ALLYEAR,PRC) // - COEF_OBINV(R,ALLYEAR,P,CUR) // - COEF_OBFIX(R,ALLYEAR,P,CUR) // - COEF_CRF(R,ALLYEAR,P,CUR) // - VAR_NCAPRNG(R,ALLYEAR,P,BD) // - CSTVNT(J,R,LL,YEAR,P,SYSUC) // - CSTVPJ(R,LL,P,J,SYSUC,YEAR) - F_VIO(R,ALLYEAR,T,P,IO) - F_IOS(R,ALLYEAR,T,P,C,S) // - F_INOUT(R,ALLYEAR,T,P,C,IO) // - F_INOUTS(R,ALLYEAR,T,P,C,S,IO) // - REG_OBJ(REG) // - BC_INVACT(R,ALLYEAR,LL,PRC,S) // - BC_INVTOT(R,ALLYEAR,PRC) // - VAL_FLO(R,ALLYEAR,LL,PRC,C) // - PAR_RTCS(R,T,C,S) - PAR_TOP(R,T,P,C,IO); - - SET NCAP_YES(R,ALLYEAR,P) //; - SET F_IOSET(R,ALLYEAR,T,P,C,S,IO) //; - SET RVTPC(R,ALLYEAR,T,P,C) //; - SET RTTC(R,ALLYEAR,C); - SET PASTCV / '0','' /, RPM / '-','+' /; - SET RNGLIM(SYSUC), SYSINV(SYSUC); - SET SUCMAP(J,SYSUC) /2.%SYSPREFIX%LUMPINV,2.%SYSPREFIX%INV+,1.%SYSPREFIX%LUMPIX,1.%SYSPREFIX%INVX+/; - SET RNGMAP(SYSUC,BD) / %SYSPREFIX%RNGLO.LO, %SYSPREFIX%RNGUP.UP /; - OPTION RNGLIM < RNGMAP; - SCALAR OBJVAL_1 / 0 /, OBJVAL_2 / 0 /; - PARAMETER SYSONE(SYSUC) / %SYSPREFIX%INV 1 /, SYSPLIT(SYSUC); -*------------------------------------------------------------------------------ -* Stochastic result parameters - PARAMETER %1CST_PVC(%2SYSUC,R,C) //; - PARAMETER %1CST_PVP(%2SYSUC,R,P) //; - PARAMETER %1F_IN(%2R,ALLYEAR,T,P,C,S) //; - PARAMETER %1F_OUT(%2R,ALLYEAR,T,P,C,S) //; - PARAMETER %1P_OUT(%2R,T,P,C,S) //; - PARAMETER %1AGG_OUT(%2R,T,C,TS) //; - PARAMETER %1PAR_ACTL(%2R,LL,LL,P,S) //; - PARAMETER %1PAR_ACTM(%2R,LL,LL,P,S) //; - PARAMETER %1PAR_PASTI(%2R,T,P,ITEM) //; - PARAMETER %1PAR_CAPL(%2R,YEAR,P) //; - PARAMETER %1PAR_CAPM(%2R,YEAR,P) //; - PARAMETER %1PAR_CAPLO(%2R,YEAR,P) //; - PARAMETER %1PAR_CAPUP(%2R,YEAR,P) //; - - PARAMETER %1PAR_NCAPL(%2R,ALLYEAR,P) //; - PARAMETER %1PAR_NCAPM(%2R,ALLYEAR,P) //; - PARAMETER %1PAR_NCAPR(%2R,ALLYEAR,P,ITEM) //; - PARAMETER %1PAR_OBJSAL(%2R,ALLYEAR,P,CUR) //; - - PARAMETER %1PAR_COMPRDL(%2R,ALLYEAR,C,S) //; - PARAMETER %1PAR_COMPRDM(%2R,ALLYEAR,C,S) //; - PARAMETER %1PAR_COMNETL(%2R,ALLYEAR,C,S) //; - PARAMETER %1PAR_COMNETM(%2R,ALLYEAR,C,S) //; - PARAMETER %1PAR_COMBALEM(%2R,ALLYEAR,C,S) //; - PARAMETER %1PAR_COMBALGM(%2R,ALLYEAR,C,S) //; - PARAMETER %1PAR_IPRIC(%2R,YEAR,P,C,TS,IE) //; - PARAMETER %1PAR_PEAKM(%2R,ALLYEAR,CG,S) //; - PARAMETER %1PAR_UCSL(%2UC_N,*,*,*) //; - PARAMETER %1PAR_UCSM(%2UC_N,*,*,*) //; - PARAMETER %1PAR_CUMFLOL(%2R,P,C,LL,LL) //; - PARAMETER %1PAR_CUMFLOM(%2R,P,C,LL,LL) //; - PARAMETER %1PAR_CUMCST(%2R,LL,LL,COSTAGG,CUR) //; - PARAMETER %1PAR_UCMRK(%2R,T,ITEM,C,S) //; - PARAMETER %1PAR_UCRTP(%2UC_N,R,T,P,UC_GRPTYPE)//; - PARAMETER %1PAR_UCMAX(%2UC_N,ALL_R,ITEM,C) //; - -* Stochastic cost parameters - PARAMETER REG_WOBJ(REG,ITEM,CUR) //; - PARAMETER %1REG_WOBJ(%2REG,ITEM,CUR) //; - PARAMETER %1REG_IREC(%2REG) //; - PARAMETER %1REG_ACOST(%2R,ALLYEAR,ITEM) //; - PARAMETER %1CST_INVC(%2R,ALLYEAR,T,P,SYSUC) //; - PARAMETER %1CST_INVX(%2R,ALLYEAR,T,P,SYSUC) //; - PARAMETER %1CST_DECC(%2R,ALLYEAR,T,P) //; - PARAMETER %1CST_FIXC(%2R,ALLYEAR,T,P) //; - PARAMETER %1CST_FIXX(%2R,ALLYEAR,T,P) //; - PARAMETER %1CST_ACTC(%2R,ALLYEAR,T,P,RPM) //; - PARAMETER %1CST_FLOC(%2R,ALLYEAR,T,P,C) //; - PARAMETER %1CST_FLOX(%2R,ALLYEAR,T,P,C) //; - PARAMETER %1CST_IREC(%2R,ALLYEAR,T,P,C) //; - PARAMETER %1CST_COMC(%2R,ALLYEAR,C) //; - PARAMETER %1CST_COMX(%2R,ALLYEAR,C) //; - PARAMETER %1CST_COME(%2R,ALLYEAR,C) //; - PARAMETER %1CST_SALV(%2R,ALLYEAR,P) //; - PARAMETER %1CST_TIME(%2R,ALLYEAR,S,SYSUC) //; - PARAMETER %1CAP_NEW(%2R,ALLYEAR,P,T,SYSUC) //; -* Damage cost and custom parameters - PARAMETER %1DAM_OBJ(%2R,T,C,CUR); - PARAMETER %1CST_DAM(%2R,T,C) 'Damage costs' //; - PARAMETER %1PAR_EOUT(%2R,ALLYEAR,T,P,C) //; -*------------------------------------------------------------------------------ -* Prepare some sets and parameters that can be used for all SOW -*------------------------------------------------------------------------------ - SALV_INV(OBJ_SUMS(R,PASTMILE(V),P),V)=SUM(OBJ_ICUR(R,V,P,CUR)$OBJ_PASTI(R,V,P,CUR),SALV_INV(R,V,P,V)*(NCAP_PASTI(R,V,P)/OBJ_PASTI(R,V,P,CUR)))*(1-0%CTST%); -* Hold on to costs - OBJ_VFLO(R,P,C,CUR,UC_COST)$(NOT RDCUR(R,CUR)) = NO; - OBJ_VFLO(R,P,C,CUR,'TAX')$=OBJ_VFLO(R,P,C,CUR,'SUB'); - SYSINV(SYSUC)$=SYSONE(SYSUC); -* Hold on to auxliary flows and past investments - LOOP(RPC_IRE(R,P,COM,IE),F_IOSET(RTP_VINTYR(R,V,T,P),C,TS,IO)$(RPCS_VAR(R,P,COM,TS)$IRE_FLOSUM(R,T,P,COM,TS,IE,C,IO)) = RC(R,C)); -$IFI %SENSIS%==YES $BATINCLUDE solsetv.v3 - OPTION CLEAR=COEF_RTP; -*------------------------------------------------------------------------------ -$IF "%3%SOLVEDA%%3"=="1" $EXIT -$LABEL REPORT -*------------------------------------------------------------------------------ -* Reports based on SOW-specific values -*------------------------------------------------------------------------------ -* Calculation of solution values for (due to reduction) substituted flows -*----------------------------------------------------------------------------- - OPTION CLEAR=PAR_FLO,CLEAR=PAR_FLOM; -$ BATINCLUDE sol_flo.red PAR_FLO '' .L -$ BATINCLUDE sol_flo.red PAR_FLO M .M -$ BATINCLUDE sol_ire.rpt -*----------------------------------------------------------------------------- -* Objective function -*----------------------------------------------------------------------------- - OPTION CLEAR=COEF_OBJINV; -$ BATINCLUDE rpt_obj.rpt '%1' "%3" "%SOW%" %SYSPREFIX% -*----------------------------------------------------------------------------- -* Calculation of annual costs -*----------------------------------------------------------------------------- -$ BATINCLUDE cost_ann.rpt '%1' "%3" -*----------------------------------------------------------------------------- -* Miscellaneous reportings -$ BATINCLUDE rptmisc.rpt '%1' "%3" -* Add aggregation levels -$ IFI NOT %SENSIS%==YES LOOP(NRG_TYPE,Z=RPT_OPT(NRG_TYPE,'1'); IF(Z,PAR_RTCS(RTCS_VARC(R,T,C,S))$NRG_TMAP(R,NRG_TYPE,C)=%1AGG_OUT(%3R,T,C,S)/G_YRFR(R,S)/Z)); -*----------------------------------------------------------------------------- -* User constraints -$IF %VAR_UC% == YES $GOTO UC_DONE -$ BATINCLUDE par_uc.rpt SM EQE '%1' "%3" -$ BATINCLUDE par_uc.rpt SM EQG '%1' "%3" -$ BATINCLUDE par_uc.rpt SM EQL '%1' "%3" - -$LABEL UC_DONE -*----------------------------------------------------------------------------- -$IF %STAGES%==YES REG_WOBJ(R,ITEM,CUR) $= SUM(W$SREG_WOBJ(W,R,ITEM,CUR),SW_PROB(W)*SREG_WOBJ(W,R,ITEM,CUR)); -$IFI NOT %STAGES%==YES REG_WOBJ(R,ITEM,CUR) $= %1REG_WOBJ(%3R,ITEM,CUR); - -$IFI %OBMAC%==YES $ONDOTL -$IFI %ABS%==YES Z=RPT_OPT('RATE','1'); IF(Z,TRACKPC(BS_BSC)=YES; TRACKPC(BS_STGP(R,P),C)$=BS_RTYPE(R,C)); -$IFI %ABS%==YES %1P_OUT(%3RTP(R,T,P),C,S)$(PRC_TS(R,P,S)$BS_COMTS(R,C,S)$TRACKPC(R,P,C)$Z)=SUM(RTP_VINTYR(R,V,T,P),VAR_BSFSP(R,V,T,P,C,S)+VAR_BSFNSP(R,V,T,P,C,S))*PRC_CAPACT(R,P)/Z; - OPTION CLEAR=TRACKPC; \ No newline at end of file diff --git a/source/rptmain.mod b/source/rptmain.mod deleted file mode 100644 index 62d4c7f..0000000 --- a/source/rptmain.mod +++ /dev/null @@ -1,48 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* RPTMAIN.MOD is the main driver for the report writer * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -*GaG Questions/Comments: -* - COM, PRC descriptions need to be taken from the COM_GMAP/PRC_MAP Sets -*----------------------------------------------------------------------------- -*----------------------------------------------------------------------------- -* dump solution if requested -$IF NOT %STAGES% == YES -$IF %DUMPSOL% == 'YES' $BATINCLUDE dumpsol.%1 %1 -*----------------------------------------------------------------------------- -$IFI %VDA% == YES $SETLOCAL SOLVEDA 1 -$IFI %SENSIS% == YES $GOTO FINISH -$IF NOT '%SOLVEDA%'==NO $BATINCLUDE solsetv.v3 -$IFI %MACRO% == YES $GOTO OTHER_REP -$IF DEFINED VAR_NTX $GOTO FINISH -$IF %STAGES% == YES $GOTO OTHER_REP -*----------------------------------------------------------------------------- -* produce standard VEDA report -$IFI %SOLVEDA% == 'YES' $BATINCLUDE rptmain.rpt -$IFI %SOLVEDA% == '1' $BATINCLUDE rptlite.rpt S WW, "'1'," - -$LABEL OTHER_REP -$IF %MACRO% == YES $BATINCLUDE rptmain.tm - -* If running stochastics, streamline reports -$IF %STAGES% == YES $BATINCLUDE rptmain.stc SOW %SWS% "'1'" ",'1')" - -* output ETL info -$IFI %ETL% == 'YES' $BATINCLUDE atlearn.etl - -* produce damage report -$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.%1 -*----------------------------------------------------------------------------- -$LABEL FINISH - -* Extensions -$IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod rpt_ext %EXTEND% - -* Back-end software dependent reporting routines -* produce ANSWER-TIMES report -$IFI %SOLANS% == YES $BATINCLUDE solputta.ans S WW, SOW, -$IFI %VDA%==YES $BATINCLUDE solsetv.v3 FINISHUP \ No newline at end of file diff --git a/source/rptmain.rpt b/source/rptmain.rpt deleted file mode 100644 index 181e09b..0000000 --- a/source/rptmain.rpt +++ /dev/null @@ -1,283 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*--------------------------------------------------------------- -* RPTMAIN.RPT -* -* Output routine -* - creating flat dump for VEDA3 and paramaters for VEDA4 -*GG* VEDABE 'V4' override to avoid PUT related code (e.g., File & SOLSUBV calls) -*--------------------------------------------------------------- -* Output routine for IER extensions -*--------------------------------------------------------------- -* - VAR_FLO/VAR_IRE are replaced by the parameters PAR_FLO/PAR_IRE -* which contain the values of the flow variables in the reduced model -* plus the recalculated values of substituted flows -* - calculation of annual cost terms -* -*----------------------------------------------------------------------- -* Declarations - PARAMETER PAR_CAPL(R,T,P); - PARAMETER PAR_CAPM(R,T,P); - PARAMETER PAR_PASTI(R,T,P); - PARAMETER PAR_CAPLO(R,T,P); - PARAMETER PAR_CAPUP(R,T,P); - PARAMETER PAR_NCAPL(R,ALLYEAR,P); - PARAMETER PAR_NCAPM(R,ALLYEAR,P); - PARAMETER PAR_ACTL(REG,ALLYEAR,ALLYEAR,PRC,ALL_TS); - PARAMETER PAR_ACTM(REG,ALLYEAR,ALLYEAR,PRC,ALL_TS); - PARAMETER PAR_COMPRDL(R,ALLYEAR,C,S); - PARAMETER PAR_COMPRDM(R,ALLYEAR,C,S); - PARAMETER PAR_COMNETL(R,ALLYEAR,C,S); - PARAMETER PAR_COMNETM(R,ALLYEAR,C,S); - PARAMETER PAR_COMBALEM(R,ALLYEAR,C,S); - PARAMETER PAR_COMBALGM(R,ALLYEAR,C,S); - PARAMETER PAR_PEAKM(R,ALLYEAR,COM_GRP,S); - PARAMETER PAR_UCLOM(UC_N,*,*,*); - PARAMETER PAR_UCUPM(UC_N,*,*,*); - PARAMETER PAR_UCFXM(UC_N,*,*,*); - PARAMETER F_IN(R,ALLYEAR,T,P,C,S); - PARAMETER F_OUT(R,ALLYEAR,T,P,C,S); - PARAMETER F_INOUT(R,ALLYEAR,T,P,C,IO); - PARAMETER F_INOUTS(R,ALLYEAR,T,P,C,TS,IO); - SET F_IOSET(R,ALLYEAR,T,P,C,TS,IO); - - PARAMETERS - TOT_INV(R,ALLYEAR,CUR) 'Total annual disocunted investment costs' // - TOT_DEC(R,ALLYEAR,CUR) 'Total annual disocunted decommissioning costs' // - TOT_FIX(R,ALLYEAR,CUR) 'Total annual disocunted FOM costs' // - TOT_SAL(R,ALLYEAR,CUR) 'Total annual disocunted salvage value' // - TOT_LAT(R,ALLYEAR,CUR) 'Total annual disocunted late costs' // - TOT_ACT(R,ALLYEAR,CUR) 'Total annual disocunted variable costs' // - TOT_COM(R,ALLYEAR,CUR) 'Total annual disocunted commodity costs' // - TOT_FLO(R,ALLYEAR,CUR) 'Total annual disocunted flow costs' // - TOT_BLE(R,ALLYEAR,CUR) 'Total annual disocunted blending costs' // - TOT_OBJ(R,ALLYEAR,CUR) 'Annual discounted objective value ' //; - -*----------------------------------------------------------------------- -* Calculation of solution values for (due to reduction) substituted flows -*------------------------------------------------------------------------ -$ BATINCLUDE sol_flo.red PAR_FLO '' .L -$ BATINCLUDE sol_flo.red PAR_FLO M .M - -* IRE auxiliary flows summed up from all IE flows - LOOP((RPC_IRE(R,P,COM,IE),RPCS_VAR(R,P,COM,TS)),F_IOSET(RTP_VINTYR(R,V,T,P),C,TS,IO)$IRE_FLOSUM(R,T,P,COM,TS,IE,C,IO) = RC(R,C)); -$ BATINCLUDE sol_ire.rpt - -*--------------------------------------------------------------- -* Calculation of annual cost terms -*--------------------------------------------------------------- -$ BATINCLUDE eqobjinv.rpt -$ BATINCLUDE eqobjfix.rpt mod -$ BATINCLUDE eqobsalv.rpt rpt -$ BATINCLUDE eqobjvar.rpt mod -$ BATINCLUDE eqobjels.rpt PAR_OBJELS(R,Y_EOH,C,CUR) Y_EOH OBJ_DISC(R,Y_EOH,CUR)* - -*------------------------------------------------------------------------ -* Include explicit EPS values for zero flows -*------------------------------------------------------------------------ -$IF NOT %SUPZERO%==YES - PAR_FLO(RTP_VINTYR(R,V,T,P),C,S)$(RTPCS_VARF(R,T,P,C,S)*RP_FLO(R,P)*(NOT RPC_NOFLO(R,P,C))) $= EPS$(NOT PAR_FLO(R,V,T,P,C,S)); - ; -$IF NOT %SUPZERO%==YES - PAR_IRE(RTP_VINTYR(R,V,T,P),C,TS,IMPEXP)$(RTPCS_VARF(R,T,P,C,TS)$RPC_IRE(R,P,C,IMPEXP)) $= EPS$(NOT PAR_IRE(R,V,T,P,C,TS,IMPEXP)); - ; -*--------------------------------------------------------------------- -* Annual discounted objective values by cost type(INV, FIX, VAR etc.) -*--------------------------------------------------------------------- - -* Total investment costs - TOT_INV(R,ALLYEAR,CUR)=SUM(RTP(R,V,P),PAR_OBJINV(R,V,ALLYEAR,P,CUR)); -* Total decommissioning costs - TOT_DEC(R,ALLYEAR,CUR)=SUM(RTP(R,V,P),PAR_OBJDEC(R,V,ALLYEAR,P,CUR)); -* Total fix costs - TOT_FIX(R,ALLYEAR,CUR)=SUM(RTP(R,V,P),PAR_OBJFIX(R,V,ALLYEAR,P,CUR)); -* Total salvage value - TOT_SAL(R,V,CUR)=-SUM(P,PAR_OBJSAL(R,V,P,CUR)); -* Total late revenues - TOT_LAT(R,ALLYEAR,CUR)=-SUM(P,PAR_OBJLAT(R,ALLYEAR,P,CUR)); -* Total variable costs - TOT_ACT(R,ALLYEAR,CUR)=SUM((RTP_VINTYR(R,V,T,P),TS)$PERIODYR(T,ALLYEAR),PAR_OBJACT(R,V,ALLYEAR,P,TS,CUR)); -* Total flow related costs - TOT_FLO(R,ALLYEAR,CUR) = SUM((RTP_VINTYR(R,V,T,P),C,TS)$PERIODYR(T,ALLYEAR),PAR_OBJFLO(R,V,ALLYEAR,P,C,TS,CUR)); -* Total commodity related costs - TOT_COM(R,ALLYEAR,CUR)=SUM((C,TS),PAR_OBJCOM(R,ALLYEAR,C,TS,CUR)); -* Total blending related costs - TOT_BLE(R,ALLYEAR,CUR)=SUM((C),PAR_OBJBLE(R,ALLYEAR,C,CUR)); -* Total yearly objective value -TOT_OBJ(R,ALLYEAR,CUR) = TOT_INV(R,ALLYEAR,CUR) + - TOT_DEC(R,ALLYEAR,CUR) + - TOT_FIX(R,ALLYEAR,CUR) + - TOT_SAL(R,ALLYEAR,CUR) + - TOT_LAT(R,ALLYEAR,CUR) + - TOT_ACT(R,ALLYEAR,CUR) + - TOT_FLO(R,ALLYEAR,CUR) + - TOT_COM(R,ALLYEAR,CUR) + - TOT_BLE(R,ALLYEAR,CUR); - -**Aggregate Undiscounted Costs w/out CUR -PARAMETER TOT_OBJV(R,ALLYEAR) //; -TOT_OBJV(R,T) $= SUM(CUR,TOT_OBJ(R,T,CUR)/OBJ_DISC(R,T,CUR)); - -* Discounted objective value by region -PARAMETER REG_OBJ(REG) //; -REG_OBJ(R) = SUM((CUR,ALLYEAR),TOT_OBJ(R,ALLYEAR,CUR)); - -*--------------------------------------------------------------------- - -* calculate discounting for the period -PARAMETER VDA_DISC(R,ALLYEAR) //; -* [AL] The MARKAL undiscounting method is not sufficiently accurate for TIMES -*VDA_DISC(R,T) = SUM(CUR,OBJ_DISC(R,T,CUR))*D(T); -LOOP(RDCUR(R,CUR), VDA_DISC(R,T) = SUM(PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR));); - -* Scenario index not supported in current version, use 1 -SOW('1') = YES; - -*--------------------------------------------------------------------- -* Output of VAR_ACT -*--------------------------------------------------------------------- - -PAR_ACTL(RTP_VINTYR(R,V,T,P),S)$PRC_TS(R,P,S) = EPS; -PAR_ACTL(R,V,T,P,S) $= VAR_ACT.L(R,V,T,P,S); -PAR_ACTM(R,V,T,P,S)$VAR_ACT.M(R,V,T,P,S) = VAR_ACT.M(R,V,T,P,S)/VDA_DISC(R,T); - -*--------------------------------------------------------------------- -* Output of VAR_CAP -*--------------------------------------------------------------------- - -RTP_CAPYR(RTP_CPTYR(R,TT,T,P))$VAR_NCAP.L(R,TT,P) = YES; -RTP_CAPYR(RTP_CPTYR(R,PYR,T,P))$NCAP_PASTI(R,PYR,P) = YES; - -PAR_PASTI(RTP(R,T,P)) = SUM(RTP_CAPYR(R,PYR,T,P),COEF_CPT(R,PYR,T,P)*NCAP_PASTI(R,PYR,P)); -PAR_CAPL(RTP(R,T,P)) = SUM(RTP_CAPYR(R,TT,T,P), COEF_CPT(R,TT,T,P) *VAR_NCAP.L(R,TT,P)) + - PAR_PASTI(R,T,P); - -PAR_CAPM(RTP(R,T,P)) $= VAR_CAP.M(R,T,P)*(1/VDA_DISC(R,T)); -PAR_CAPLO(RTP(R,T,P)) $= CAP_BND(R,T,P,'LO'); -PAR_CAPUP(RTP(R,T,P))$(CAP_BND(R,T,P,'UP') NE INF) $= CAP_BND(R,T,P,'UP'); - -PAR_NCAPL(R,V,P) $= VAR_NCAP.L(R,V,P) ; - -* [UR]: undiscounting of dual variable of VAR_NCAP -PAR_NCAPM(R,T,P)$(VAR_NCAP.M(R,T,P)*COEF_OBJINV(R,T,P)) = VAR_NCAP.M(R,T,P)/COEF_OBJINV(R,T,P); - -*--------------------------------------------------------------------- -* Output of VAR_FLO -* - split by in/out -*--------------------------------------------------------------------- -* emission tied to CAP/INV -F_INOUT(RTP_VINTYR(R,V,T,P),C,'IN')$RPC_CAPFLO(R,T,P,C) = COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,'IN') * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) + - (COEF_ICOM(R,V,T,P,C) * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))); -F_INOUT(RTP_VINTYR(R,V,T,P),C,'OUT')$RPC_CAPFLO(R,T,P,C) = COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,'OUT') * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) + - (COEF_OCOM(R,V,T,P,C) * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))); - -* Blending flows *** PENDING!!! Code below from EQCOMBAL *** -*PARAMETER F_BLND(R,T,C,TS,IO) //; -* SUM(OPR$BLE_OPR(R,C,OPR), -* RTCS_TSFR(R,T,C,S,'ANNUAL') * BLE_BAL(R,T,C,OPR) * VAR_BLND(R,T,C,OPR) -* ) + -* emissions due to blending operations -* SUM(BLE_ENV(R,COM,BLE,OPR), -* ENV_BL(R,COM,BLE,OPR,T) * VAR_BLND(R,T,BLE,OPR) -* ) + - -*--------------------------------------------------------------------- -* Process flows -*--------------------------------------------------------------------- -* Flow by IN/OUT -* main flows & emissions -F_IN(R,V,T,P,C,S)$TOP(R,P,C,'IN') $= PAR_FLO(R,V,T,P,C,S); -F_OUT(R,V,T,P,C,S)$TOP(R,P,C,'OUT') $= PAR_FLO(R,V,T,P,C,S); -* IRE flows -* [UR] maybe exports as negativ values for net imports in primary energy balance ? -F_IN(R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'EXP'); -F_OUT(R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'IMP'); -* Aux flows & emissions tied to INV/CAP -F_IN(R,V,T,P,C,'ANNUAL')$F_INOUT(R,V,T,P,C,'IN') = F_IN(R,V,T,P,C,'ANNUAL')+F_INOUT(R,V,T,P,C,'IN'); -F_OUT(R,V,T,P,C,'ANNUAL')$F_INOUT(R,V,T,P,C,'OUT') = F_OUT(R,V,T,P,C,'ANNUAL')+F_INOUT(R,V,T,P,C,'OUT'); -* IRE Aux flows & emissions -F_IN(R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'IN') = F_IN(R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'IN'); -F_OUT(R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'OUT') = F_OUT(R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'OUT'); -* Storage in/output flows -F_IN(R,V,T,P,C,S) $= VAR_SIN.L(R,V,T,P,C,S); -F_OUT(R,V,T,P,C,S) $= VAR_SOUT.L(R,V,T,P,C,S)*STG_EFF(R,V,P); - -*--------------------------------------------------------------------- -* Annual undiscounted costs by process/commodity w/out CUR -*--------------------------------------------------------------------- -PARAMETER CST_INVV(R,ALLYEAR,ALLYEAR,P) //; -PARAMETER CST_DECV(R,ALLYEAR,ALLYEAR,P) //; -PARAMETER CST_FIXV(R,ALLYEAR,ALLYEAR,P) //; -PARAMETER CST_SALV(R,ALLYEAR,P) //; -PARAMETER CST_LATV(R,ALLYEAR,P) //; -PARAMETER CST_ACTV(R,ALLYEAR,ALLYEAR,P,TS) //; -PARAMETER CST_FLOV(R,ALLYEAR,ALLYEAR,P,C,TS) //; -PARAMETER CST_COMV(R,ALLYEAR,C,TS) //; -PARAMETER CST_ELSV(R,ALLYEAR,C) //; - -LOOP(CUR, -CST_INVV(RTP_CPTYR(R,V,T,P)) $= PAR_OBJINV(R,V,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); -CST_DECV(RTP_CPTYR(R,V,T,P)) $= PAR_OBJDEC(R,V,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); -CST_SALV(R,V,P) $= PAR_OBJSAL(R,V,P,CUR); -CST_LATV(RTP(R,T,P)) $= PAR_OBJLAT(R,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); -CST_FIXV(RTP_CPTYR(R,V,T,P)) $= PAR_OBJFIX(R,V,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); -CST_ACTV(RTP_VINTYR(R,V,T,P),TS) $= PAR_OBJACT(R,V,T,P,TS,CUR)*(1/OBJ_DISC(R,T,CUR)); -CST_ELSV(RTC(R,T,C)) $= PAR_OBJELS(R,T,C,CUR)*(1/OBJ_DISC(R,T,CUR)); -CST_FLOV(RTP_VINTYR(R,V,T,P),C,TS) $= PAR_OBJFLO(R,V,T,P,C,TS,CUR)*(1/OBJ_DISC(R,T,CUR)); -CST_COMV(RTC(R,T,C),TS) $= PAR_OBJCOM(R,T,C,TS,CUR)*(1/OBJ_DISC(R,T,CUR)); -); - -*-------------------------------------------------------------------------- -* Production (PRD) and Difference between production and consumption (NET) -*-------------------------------------------------------------------------- - -PAR_COMPRDL(R,T,C,S) $= VAR_COMPRD.L(R,T,C,S); -PAR_COMPRDM(R,T,C,S) $= VAR_COMPRD.M(R,T,C,S)*(1/VDA_DISC(R,T)); -PAR_COMNETL(R,T,C,S) $= VAR_COMNET.L(R,T,C,S); -PAR_COMNETM(R,T,C,S) $= VAR_COMNET.M(R,T,C,S)*(1/VDA_DISC(R,T)); - -*-------------------------------------------------------------------------- -* Undiscounted annual shadow price of commodity balance and peaking equation -*-------------------------------------------------------------------------- - -PAR_COMBALEM(R,T,C,S) $= EQE_COMBAL.M(R,T,C,S)*(1/VDA_DISC(R,T)); -PAR_COMBALGM(R,T,C,S) $= EQG_COMBAL.M(R,T,C,S)*(1/VDA_DISC(R,T)); -PAR_PEAKM(R,T,CG,S) $= EQ_PEAK.M(R,T,CG,S)*(1/VDA_DISC(R,T)); - -*-------------------------------------------------------------------------- -* Shadow prices of user constraints -*-------------------------------------------------------------------------- -* Note: undiscounting only done for user constraints having region and period as index - -$IF '%VAR_UC%'==YES $GOTO UC_VAR - -$ BATINCLUDE par_uc.rpt FXM EQE -$ BATINCLUDE par_uc.rpt LOM EQG -$ BATINCLUDE par_uc.rpt UPM EQL - -$GOTO UC_DONE -$LABEL UC_VAR - -PAR_UCFXM(UC_N,'NONE','NONE','NONE') $= VAR_UC.M(UC_N); -PAR_UCFXM(UC_N,R,'NONE','NONE') $= VAR_UCR.M(UC_N,R); -PAR_UCFXM(UC_N,'NONE',T,'NONE') $= VAR_UCT.M(UC_N,T); -PAR_UCFXM(UC_N,R,T,'NONE') $= VAR_UCRT.M(UC_N,R,T)*(1/VDA_DISC(R,T)); -PAR_UCFXM(UC_N,'NONE',T,S) $= VAR_UCTS.M(UC_N,T,S); -PAR_UCFXM(UC_N,R,T,S) $= VAR_UCRTS.M(UC_N,R,T,S)*(1/VDA_DISC(R,T)); - -$LABEL UC_DONE - -OPTION CLEAR = F_INOUT; -OPTION CLEAR = F_INOUTS; -OPTION CLEAR = F_IOSET; - -*[AL] Added new regional total discounted cost parameter - PARAMETER REG_WOBJ(REG,ITEM,CUR) //; - REG_WOBJ(R,'INV',CUR) = SUM(OBV,SUM_OBJ('OBJINV',OBV)*VAR_OBJ.L(R,OBV,CUR))-VAR_OBJ.L(R,'OBJSAL',CUR); - REG_WOBJ(R,'FIX',CUR) = SUM(OBV,SUM_OBJ('OBJFIX',OBV)*VAR_OBJ.L(R,OBV,CUR)); - REG_WOBJ(R,'VAR',CUR) = SUM(OBV,SUM_OBJ('OBJVAR',OBV)*VAR_OBJ.L(R,OBV,CUR)); - REG_WOBJ(R,'ELS',CUR) = EPS -$IF %TIMESED% == YES +VAR_OBJELS.L(R,'LO',CUR)-VAR_OBJELS.L(R,'UP',CUR) - ; diff --git a/source/rptmain.stc b/source/rptmain.stc deleted file mode 100644 index f876a8b..0000000 --- a/source/rptmain.stc +++ /dev/null @@ -1,125 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* RPTMAIN.stc is the main driver for the report writer for stochastics -* %1, %2 - SOW, %SWS% -*=============================================================================* -$SET EQS '%EQ%' SET V %VAR% -*----------------------------------------------------------------------------- -* VARIABLES & EQUATIONS -*----------------------------------------------------------------------------- -$ BATINCLUDE clearsol.stc DEF -*----------------------------------------------------------------------------- -$IF %ETL%==YES POSITIVE VARIABLES VAR_IC(R,YEAR,PRC) - PARAMETERS SW_UNPB(LL,WW), SW_UNPC(LL,WW); -*----------------------------------------------------------------------------- -$IF %STEPPED%==+ $SET SOLVEDA 1 -$IFI %SPINES%==YES $SHIFT SHIFT -$IFI %SPINES%%SOLVEDA%==YES1 $GOTO DETERRED -*------------------------------------------------------------------------------ -* Reporting parameter declarations -$ SET SOLVEDA 1 -$ BATINCLUDE rptlite.rpt S WW, -*------------------------------------------------------------------------------ - SW_UNPB(SW_T(T,W))=POWER(SW_TPROB(T,W)/SW_NORM,1$SW_PHASE-1); SW_UNPC(T,W) $= SW_UNPB(T,W); - SW_UNPB('0',W)=POWER(SW_PROB(W)/SW_NORM,1$SW_PHASE-1$SW_PROB(W)); -$IF %SPINES%==YES SW_UNPC(SW_T) = 1; -*------------------------------------------------------------------------------ -* Reports based on SOW-specific values -*------------------------------------------------------------------------------ - - LOOP(SOW$SW_PROB(SOW), -*------------------------------------------------------------------------------ -* Clear results from previous SOW -$ BATINCLUDE clearsol.stc -* Get the variable levels - VAR_ACT.L(R,V,T,P,S) $= %VART%_ACT.L(R,V,T,P,S %SWS%); - VAR_BLND.L(R,T,COM,C) $= %VART%_BLND.L(R,T,COM,C %SWS%); - VAR_CAP.L(R,T,P) $= %VART%_CAP.L(R,T,P %2); - VAR_COMNET.L(R,T,COM,S) $= %VART%_COMNET.L(R,T,COM,S %SWS%); - VAR_COMPRD.L(R,T,COM,S) $= %VART%_COMPRD.L(R,T,COM,S %SWS%); - VAR_IRE.L(R,V,T,P,C,S,IE) $= %VART%_IRE.L(R,V,T,P,C,S,IE %SWS%); - VAR_ELAST.L(R,T,C,S,J,BD) $= %VART%_ELAST.L(R,T,C,S,J,BD %SWS%); - VAR_FLO.L(R,V,T,P,C,S) $= %VART%_FLO.L(R,V,T,P,C,S %SWS%); - VAR_NCAP.L(R,T,P) $= %VART%_NCAP.L(R,T,P %2); - VAR_SIN.L(R,V,T,P,C,S) $= %VART%_SIN.L(R,V,T,P,C,S %SWS%); - VAR_SOUT.L(R,V,T,P,C,S) $= %VART%_SOUT.L(R,V,T,P,C,S %SWS%); - VAR_UPS.L(R,V,T,P,S,L) $= %VART%_UPS.L(R,V,T,P,S,L %SWS%); - VAR_UPT.L(R,V,T,P,S,UPT) $= %VART%_UPT.L(R,V,T,P,S,UPT %SWS%); - VAR_UDP.L(R,V,T,P,S,L) $= %VART%_UDP.L(R,V,T,P,S,L %SWS%); - VAR_SCAP.L(R,V,T,P) $= %VART%_SCAP.L(R,V,T,P%2); VAR_SCAP.L(R,V,'0',P) $= %VAR%_SCAP.L(R,V,'0',P,%1); -$IF %ETL% == YES OPTION CLEAR=VAR_IC; VAR_IC.L(R,T,P) $= %VART%_IC.L(R,T,P %2); - -* Get variable marginals - VAR_ACT.M(R,V,T,P,S) $= %VART%_ACT.M(R,V,T,P,S,W)*SW_UNPB(T%SWS%); - VAR_CAP.M(R,T,P) $= SUM(SW_TSW(%1,T,W),%VAR%_CAP.M(R,T,P,W)*SW_UNPC(T,W)); - VAR_NCAP.M(R,T,P) $= SUM(SW_TSW(%1,T,W),%VAR%_NCAP.M(R,T,P,W)*SW_UNPC(T,W)); - VAR_COMNET.M(R,T,COM,S) $= %VART%_COMNET.M(R,T,COM,S,W)*SW_UNPB(T%SWS%); - VAR_COMPRD.M(R,T,COM,S) $= %VART%_COMPRD.M(R,T,COM,S,W)*SW_UNPB(T%SWS%); - VAR_FLO.M(R,V,T,P,C,S) $= %VART%_FLO.M(R,V,T,P,C,S,W)*SW_UNPB(T%SWS%); - -* Get equation marginals - EQG_COMBAL.M(R,T,C,S) $= SUM(SW_TSW(SOW,T,W),%EQ%G_COMBAL.M(R,T,C,S,T,W)*SW_UNPB(T,W)); - EQE_COMBAL.M(R,T,C,S) $= SUM(SW_TSW(SOW,T,W),%EQ%E_COMBAL.M(R,T,C,S,T,W)*SW_UNPB(T,W)); - EQE_COMPRD.M(R,T,C,S) $= SUM(SW_TSW(SOW,T,W),%EQ%E_COMPRD.M(R,T,C,S,T,W)*SW_UNPB(T,W)); - EQ_PEAK.M(R,T,CG,S) $= SUM(SW_TSW(SOW,T,W),%EQ%_PEAK.M(R,T,CG,S,T,W)*SW_UNPB(T,W)); - EQ_IRE.M(R,T,P,C,IE,S) $= SUM(SW_TSW(SOW,T,W),%EQ%_IRE.M(R,T,P,C,IE,S,T,W)*SW_UNPB(T,W)); - EQE_CPT.M(R,T,P) $= SUM(SW_TSW(%1,T,W),%EQ%E_CPT.M(R,T,P,T,W)*SW_UNPC(T,W)); - EQG_COMBAL.L(R,T,C,S) $= %EQ%G_COMBAL.L(R,T,C,S,T,SOW); - -*----------------------------------------------------------------------------- -* Calculate the reporting parameters -*----------------------------------------------------------------------------- -* Calculation of solution values for (due to reduction) substituted flows -*----------------------------------------------------------------------------- - OPTION CLEAR=PAR_FLO,CLEAR=PAR_FLOM; -$ BATINCLUDE sol_flo.red PAR_FLO '' .L -$ BATINCLUDE sol_flo.red PAR_FLO M .M -$ BATINCLUDE sol_ire.rpt -*----------------------------------------------------------------------------- -* Objective function -*----------------------------------------------------------------------------- - OPTION CLEAR=COEF_OBJINV; -$ BATINCLUDE rpt_obj.rpt S SOW, ,SOW %SYSPREFIX% -*----------------------------------------------------------------------------- -* Calculation of annual costs -*----------------------------------------------------------------------------- -$ BATINCLUDE cost_ann.rpt S SOW, -*----------------------------------------------------------------------------- -* Miscellaneous reportings - EQN_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD('FX')) $= SUM(SW_TSW(SOW,T,W),%EQ%E_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)*SW_UNPB(T,W)); - EQN_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BDNEQ(BD)) $= SUM(SW_TSW(SOW,T,W),%EQ%N_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)*SW_UNPB(T,W)); - -$ BATINCLUDE rptmisc.rpt S SOW, ,SOW ,W)*SW_UNPB(T,W) ,SOW)*SW_UNPB('0',SOW - -* Non-common reporting - SPAR_CAPLO(SOW,RTP(R,T,P)) $= S_CAP_BND(RTP,'LO','1',SOW); - SPAR_CAPUP(SOW,RTP(R,T,P))$(S_CAP_BND(RTP,'UP','1',SOW)0)$(COM_PROJ(R,T,C)>0)$DEM(R,C)) = COM_PROJ(R,T,C); - -TM_ERR('DEM') = SMAX((R,T,C)$TM_DEM(R,T,C),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); -TM_ERR('GDP') = SMAX((REG,T),ABS(TM_GDPGOAL(REG,T)-TM_GDP(REG,T))/TM_GDPGOAL(REG,T)); - -* Reporting parameters - TM_RESULT('TM_GDP-REF',MR,T) = TM_GDPGOAL(MR,T)$DONE; - TM_RESULT('TM_GDP-ACT',MR,T) = TM_GDP(MR,T); - TM_RESULT('TM_PRD-Y',MR,T) = PAR_Y(MR,T); - TM_RESULT('TM_CON-C',MR,T) = VAR_C.L(MR,T); - TM_RESULT('TM_CAP-K',MR,T) = VAR_K.L(MR,T); - TM_RESULT('TM_INV-I',MR,T) = VAR_INV.L(MR,T); - TM_RESULT('TM_ESCOST',MR,T) = VAR_EC.L(MR,T); - TM_RESULT('TM_GDPLOS',MR,T)$DONE = 100*(TM_GDPGOAL(MR,T)-TM_GDP(MR,T))/TM_GDPGOAL(MR,T); - -$ INCLUDE ddfupd.msa -$ BATINCLUDE writeddf.msa DDFNEW TM_GR diff --git a/source/rptmisc.rpt b/source/rptmisc.rpt deleted file mode 100644 index f03ae28..0000000 --- a/source/rptmisc.rpt +++ /dev/null @@ -1,276 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* RPTMISC.rpt: Miscellaneous shared reportings -* %1 - Prefix for parameter names (optional) -* %2 - SOW, (optional) -* %3 - %SOW% -*=============================================================================* - R_DF(R,T) = SIGN(COEF_PVT(R,T))/MAX(1E-9,ABS(COEF_PVT(R,T))); -*----------------------------------------------------------------------------- -* Activity levels & marginals -*----------------------------------------------------------------------------- - %1PAR_ACTL(%2RTP_VINTYR(R,V,T,P),S)$PRC_TS(R,P,S) $= VAR_ACT.L(R,V,T,P,S); -* Shift up STS activity levels - LOOP((RP_STL(R,P,TSL,BD),TS_GROUP(R,TSL,TS))$RLUP(R,'DAYNITE',TSL),Z=G_YRFR(R,TS)*365/TS_CYCLE(R,TS); - YKVAL(VNT(V,T))=SMIN(RS_BELOW(R,TS,S),VAR_ACT.L(R,VNT,P,S)/Z)$NCAP_YES(R,V,P); - %1PAR_ACTL(%2R,VNT,P,S)$(TS_MAP(R,TS,S)$YKVAL(VNT))=VAR_ACT.L(R,VNT,P,S)+YKVAL(VNT)*(1-(1+Z)$RS_BELOW(R,TS,S))); - Z = (RPT_OPT('ACT','2') GE 0); - %1PAR_ACTM(%2R,V,T,P,S)$VAR_ACT.M(R,V,T,P,S) = ROUND(VAR_ACT.M(R,V,T,P,S)*R_DF(R,T),7)$Z; - %1PAR_ACTM(%2R,'0',T,P,S) $= EQL_ACTBND.M(R,T,P,S)*R_DF(R,T); - %1PAR_ACTM(%2R,'0',T,P,S) $= EQG_ACTBND.M(R,T,P,S)*R_DF(R,T); - %1PAR_ACTM(%2R,'0',T,P,S) $= EQE_ACTBND.M(R,T,P,S)*R_DF(R,T); - -*----------------------------------------------------------------------------- -* Capacity -*----------------------------------------------------------------------------- - OPTION CLEAR=RTP_CAPYR,CLEAR=COEF_CAP; - RTP_CAPYR(RTP_CPTYR(R,TT,T,P))$VAR_NCAP.L(R,TT,P) = YES; - VAR_CAP.M(RTP)$(NOT VAR_CAP.M(RTP)) $= EQE_CPT.M(RTP); - - %1PAR_CAPL(%2RTP(R,T,P)) = SUM(RTP_CAPYR(R,TT,T,P), COEF_CPT(R,TT,T,P)*VAR_NCAP.L(R,TT,P)); - %1PAR_PASTI(%2RTP(R,T,P),'0') = SUM(PYR(K)$COEF_CPT(R,K,T,P),COEF_CPT(R,K,T,P)*NCAP_PASTI(R,K,P)-RTFORC(R,K,T,P)$PYR_S(K)); - -$IF DEFINED VNRET COEF_CAP(R,V,T,P)$=VAR_SCAP.L(R,V,T,P); %1PAR_PASTI(%2RTP(R,T,P),'')$PRC_RCAP(R,P) = -SUM(VNRET(V,T),COEF_CAP(R,V,T,P)*COEF_CPT(R,V,T,P)-RTFORC(R,V,T,P)); - %1PAR_CAPM(%2RTP(R,T,P)) $= VAR_CAP.M(RTP)*R_DF(R,T); - %1PAR_CAPLO(%2RTP) $= CAP_BND(RTP,'LO'); - %1PAR_CAPUP(%2RTP_OFF(RTP))$RCAP_BND(RTP,'N') $= PRC_RESID(RTP); - %1PAR_CAPUP(%2RTP)$(CAP_BND(RTP,'UP') NE INF) $= CAP_BND(RTP,'UP'); - - %1PAR_NCAPL(%2RTP(R,V,P)) $= VAR_NCAP.L(RTP); - %1PAR_NCAPM(%2RTP)$(VAR_NCAP.M(RTP)*COEF_OBJINV(RTP)) = VAR_NCAP.M(RTP)/COEF_OBJINV(RTP); - -*----------------------------------------------------------------------------- -* Commodities -*----------------------------------------------------------------------------- -* Variables - %1PAR_COMPRDL(%2R,T,C,S) $= VAR_COMPRD.L(R,T,C,S); - %1PAR_COMPRDM(%2R,T,C,S) $= VAR_COMPRD.M(R,T,C,S)*R_DF(R,T); - %1PAR_COMNETL(%2R,T,C,S) $= VAR_COMNET.L(R,T,C,S); - %1PAR_COMNETM(%2R,T,C,S) $= VAR_COMNET.M(R,T,C,S)*R_DF(R,T); - OPTION AGR < COM_AGG; - %1AGG_OUT(%2R,T,C,S)$(RTCS_VARC(R,T,C,S)$AGR(R,C)) = - SUM(RTC(R,T,COM)$COM_AGG(RTC,C),COM_AGG(RTC,C) * - SUM(RTCS_VARC(RTC,TS)$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) * - (VAR_COMNET.L(RTC,TS)$RC_AGP(R,COM,'LO') + VAR_COMPRD.L(RTC,TS)$RC_AGP(R,COM,'FX')))); - OPTION CLEAR=AGR; - -* Equations - %1PAR_COMBALEM(%2R,T,C,S) $= EQG_COMBAL.M(R,T,C,S)*R_DF(R,T); - %1PAR_COMBALEM(%2R,T,C,S) $= EQE_COMBAL.M(R,T,C,S)*R_DF(R,T); - %1PAR_PEAKM(%2R,T,CG,S) $= EQ_PEAK.M(R,T,CG,S)*R_DF(R,T); -$IF %1==S %1PAR_COMBALGM(%2RTC,S) $= EQG_COMBAL.L(RTC,S); - -*----------------------------------------------------------------------------- -* Process flows -*----------------------------------------------------------------------------- - OPTION CLEAR=UNCD1,CLEAR=RTP_CAPYR,CLEAR=F_INOUT; - F_INOUT(R,V,T,P,C,'IN')$COEF_ICOM(R,V,T,P,C) = COEF_ICOM(R,V,T,P,C) * RTP_CAPVL(R,V,P); - F_INOUT(R,V,T,P,C,'OUT')$COEF_OCOM(R,V,T,P,C) = COEF_OCOM(R,V,T,P,C) * RTP_CAPVL(R,V,P); - F_INOUT(RTP_CPTYR(R,V,T,P),C,IO)$NCAP_COM(R,V,P,C,IO) = F_INOUT(R,V,T,P,C,IO) + - (RTP_CAPVL(R,V,P)-COEF_CAP(R,V,T,P)) * COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,IO) * (1+COEF_CIO(R,V,T,P,C,IO)); - F_INOUTS(R,V,T,P,C,ANNUAL(S),IO)$F_INOUT(R,V,T,P,C,IO) = F_INOUTS(R,V,T,P,C,S,IO)+F_INOUT(R,V,T,P,C,IO); - -* inputs: main flows & emissions, aux flows & emissions - %1F_IN(%2R,V,T,P,C,S)$TOP(R,P,C,'IN') $= PAR_FLO(R,V,T,P,C,S); - %1F_IN(%2R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'EXP'); - %1F_IN(%2R,V,T,P,C,S)$RPCS_VAR(R,P,C,S) $= VAR_SIN.L(R,V,T,P,C,S); - %1F_IN(%2R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'IN') = %1F_IN(%2R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'IN'); -* outputs: main flows & emissions, aux flows & emissions - PAR_FLO(R,V,T,P,C,S)$RPCS_VAR(R,P,C,S) $= VAR_SOUT.L(R,V,T,P,C,S)*STG_EFF(R,V,P); - %1F_OUT(%2R,V,T,P,C,S)$TOP(R,P,C,'OUT') $= PAR_FLO(R,V,T,P,C,S); - %1F_OUT(%2R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'IMP'); - %1F_OUT(%2R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'OUT') = %1F_OUT(%2R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'OUT'); -*----------------------------------------------------------------------------- -* Filter out small values if requested - IF(SUM(UC_GRPTYPE$RPT_OPT(UC_GRPTYPE,'9'),1),RPT_OPT(UC_GRPTYPE,'9')$(RPT_OPT(UC_GRPTYPE,'9')>.1)=0; - Z=RPT_OPT('ACT','9'); IF(Z>0,%1PAR_ACTL(%2R,V,T,P,S)$((%1PAR_ACTL(%2R,V,T,P,S)0,%1PAR_CAPL(%2RTP)$((%1PAR_CAPL(%2RTP)0,%1PAR_NCAPL(%2RTP)$((%1PAR_NCAPL(%2RTP)0,%1F_OUT(%2R,V,T,P,C,S)$((ABS(%1F_OUT(%2R,V,T,P,C,S))1); - NCAP_YES(R,T,P)$(VAR_NCAP.L(R,T,P)*COEF_RTP(R,T,P)$RP_INOUT(R,P,'OUT')=0)=NO; - PASTSUM(R,T,P)$%1PAR_CAPL(%2R,T,P) = %1PAR_CAPL(%2R,T,P)+SUM(PASTCV,%1PAR_PASTI(%2R,T,P,PASTCV))+1-1; -* Calculate ENV credit - LOOP(COM_LIM(ENV(R,C),'LO')$Z,TRACKC(R,C)=YES;TRACKP(R,P)$(PRC_MAP(R,'PRE',P)$TOP(R,P,C,'OUT'))=YES); - TRACKPC(TRACKP(R,P),C)$(NRG(R,C)$TOP(R,P,C,'OUT'))=YES; TRACKC(R,C)$SUM(TRACKPC(R,P,C),1)=YES; - VDA_EMCB(R,T,C,C)$(NRG(R,C)$TRACKC(R,C)) = - MIN(SUM(TRACKC(ENV(R,COM)),MIN(0,COM_AGG(R,T,C,COM)*%1PAR_COMBALEM(%2R,T,COM,SL))), - SUM(P$TRACKPC(R,P,C), - SUM((VNT(V,T),S)$%1F_OUT(%2R,V,T,P,C,S),%1F_OUT(%2R,V,T,P,C,S))/MAX(MICRO,SUM((TRACKPC(R,P,COM2),VNT(V,T),S)$%1F_OUT(%2R,V,T,P,COM2,S),%1F_OUT(%2R,V,T,P,COM2,S))) * - SUM((VNT(V,T),TRACKC(ENV(R,COM)))$%1F_OUT(%2R,V,T,P,COM,SL),%1F_OUT(%2R,V,T,P,COM,SL)*MIN(0,%1PAR_COMBALEM(%2R,T,COM,SL)))) / - MAX(MICRO,SUM((VNT(V,T),P,S)$%1F_OUT(%2R,V,T,P,C,S),%1F_OUT(%2R,V,T,P,C,S))+SUM(S$%1AGG_OUT(%2R,T,C,S),%1AGG_OUT(%2R,T,C,S)))); - OPTION CLEAR=TRACKP,CLEAR=TRACKPC,CLEAR=COEF_CAP; TRACKC(NRG)=NO; -* Credit for aux energy ouputs (ELE+CHP+HPL) - OPTION RP_PRC < NCAP_YES; TRACKP(RP_PRC(RP))=ELE(RP)+CHP(RP)+HPL(RP); - TRACKPC(TRACKP(R,P),C)$(TOP(R,P,C,'OUT')$(NOT RPC_PG(R,P,C)*(NRGELC(R,C)+(NOT CHP(R,P))))$NRG(R,C))=YES; - OPTION TRACKP < TRACKPC; - IF(Z,COEF_CAP(RTP_VINTYR(R,V,T,P))$TRACKP(R,P)=1-1/(1+SUM(RPCS_VAR(TRACKPC(R,P,C),S),PAR_FLO(R,V,T,P,C,S))/MAX(MICRO,SUM(RPCS_VAR(RPC_PG(R,P,C),S)$(NOT TRACKPC(R,P,C)),PAR_FLO(R,V,T,P,C,S))))); - IF(F=1,RP_GRP(RPC_PG(RP_PRC,C))$(NOT TRACKPC(RPC_PG))=YES); -* Credit for peak capacity - LOOP((COM_PEAK(R,CG),COM_GMAP(R,CG,C)),TRACKPG(RP_PRC(R,P),C)$TOP(R,P,C,'OUT')=YES; - PAR_RTCS(RTCS_VARC(R,T,C,S))=SUM(COM_PKTS(R,CG,TS)$RS_TREE(R,S,TS),%1PAR_PEAKM(%2R,T,CG,TS)/(1+MAX(COM_PKRSV(R,T,C),SUM(COM(CG),COM_PKRSV(R,T,COM))))*RS_FR(R,TS,S))*COM_IE(R,T,C,S)); - OPTION RP_PRC < RPC_PKC; RP_PRC(RP)$(F<2)=NO; TRACKPG(RPC_PG(RP_PRC,C))=NO; -* Cost ratio for vintaged - %1PAR_NCAPR(%2NCAP_YES(R,TT(V),P),SYSUC)$PRC_VINT(R,P) = - (COEF_RTP(R,V,P)*VAR_NCAP.L(R,V,P) + - SUM(RTP_VINTYR(R,V,T,P),COEF_PVT(R,T) * - (SUM(RPM,%1CST_ACTC(%2R,V,T,P,RPM)) + - SUM(TOP(R,P,C,'IN'),(1-COEF_CAP(R,V,T,P)) * (%1CST_FLOC(%2R,V,T,P,C)+%1CST_FLOX(%2R,V,T,P,C) + - SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_IN(%2R,V,T,P,C,TS), - (%1PAR_COMBALEM(%2R,T,C,S)+VDA_EMCB(R,T,C,C))*%1F_IN(%2R,V,T,P,C,TS)*RS_FR(R,S,TS))$(NOT TRACKC(R,C)))) + - SUM(TOP(R,P,C,'OUT')$(NOT TRACKPC(R,P,C)$Z),%1CST_FLOC(%2R,V,T,P,C)+%1CST_FLOX(%2R,V,T,P,C) - - SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_OUT(%2R,V,T,P,C,TS), - (%1PAR_COMBALEM(%2R,T,C,S)*COM_IE(R,T,C,S)+(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*PAR_RTCS(R,T,C,S)$TRACKPG(R,P,C))*%1F_OUT(%2R,V,T,P,C,TS)*RS_FR(R,S,TS))$(NOT RP_GRP(R,P,C))$F) - - SUM((RPC_PG(RP_PRC(R,P),C),COM_TS(R,C,S)),NCAP_PKCNT(R,V,P,S)*PAR_RTCS(R,T,C,S)*VAR_NCAP.L(R,V,P)*G_YRFR(R,S)*PRC_CAPACT(R,P)*PRC_ACTFLO(R,V,P,C))))) / - MAX(MICRO,SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*SUM(RPCS_VAR(RPC_PG(R,P,C),S)$(NOT TRACKPC(R,P,C)),PAR_FLO(R,V,T,P,C,S)))); -* Cost ratio for non-vintaged - %1PAR_NCAPR(%2NCAP_YES(R,TT(V),P),SYSUC)$(NOT PRC_VINT(R,P)) = - (COEF_RTP(R,V,P) + - SUM(RTP_CPTYR(R,V,T,P)$PASTSUM(R,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)/PASTSUM(R,T,P) * - (SUM(RPM,%1CST_ACTC(%2R,T,T,P,RPM)) + - SUM(TOP(R,P,C,'IN'),(1-COEF_CAP(R,T,T,P)) * (%1CST_FLOC(%2R,T,T,P,C)+%1CST_FLOX(%2R,T,T,P,C) + - SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_IN(%2R,T,T,P,C,TS), - (%1PAR_COMBALEM(%2R,T,C,S)+VDA_EMCB(R,T,C,C))*%1F_IN(%2R,T,T,P,C,TS)*RS_FR(R,S,TS))$(NOT TRACKC(R,C)))) + - SUM(TOP(R,P,C,'OUT')$(NOT TRACKPC(R,P,C)$Z),%1CST_FLOC(%2R,T,T,P,C)+%1CST_FLOX(%2R,T,T,P,C) - - SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_OUT(%2R,T,T,P,C,TS), - (%1PAR_COMBALEM(%2R,T,C,S)*COM_IE(R,T,C,S)+(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*PAR_RTCS(R,T,C,S)$TRACKPG(R,P,C))*%1F_OUT(%2R,T,T,P,C,TS)*RS_FR(R,S,TS))$(NOT RP_GRP(R,P,C))$F) - - SUM((RPC_PG(RP_PRC(R,P),C),COM_TS(R,C,S)),NCAP_PKCNT(R,V,P,S)*PAR_RTCS(R,T,C,S)*PASTSUM(R,T,P)*G_YRFR(R,S)*PRC_CAPACT(R,P)*PRC_ACTFLO(R,V,P,C))))) / - MAX(MICRO,SUM(RTP_CPTYR(R,V,T,P)$PASTSUM(R,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)/PASTSUM(R,T,P)*SUM(RPCS_VAR(RPC_PG(R,P,C),S)$(NOT TRACKPC(R,P,C)),PAR_FLO(R,T,T,P,C,S)))); - OPTION CLEAR=TRACKP,CLEAR=TRACKC,CLEAR=TRACKPC,CLEAR=TRACKPG,CLEAR=VDA_EMCB,CLEAR=PASTSUM,CLEAR=PAR_RTCS,CLEAR=COEF_CAP; - ); -* Fallback of flows to ANNUAL level - LOOP(ANNUAL(TS)$CARD(UNCD1), - LOOP(UNCD1(COM_TYPE(CG)),TRACKC(R,C)$COM_TMAP(R,COM_TYPE,C)=RPT_OPT(CG,'3')<0); - LOOP(UNCD1(NRG_TYPE(U2))$RPT_OPT(U2,'3'),TRACKC(R,C)$NRG_TMAP(R,NRG_TYPE,C)=RPT_OPT(U2,'3')<0); - RVTPC(R,V,T,P,C)$TRACKC(R,C) $= SUM(S$%1F_IN(%2R,V,T,P,C,S),STOA(S)); - F_IOS(RVTPC,TS) = SUM(S$%1F_IN(%2RVTPC,S),%1F_IN(%2RVTPC,S)); - %1F_IN(%2RVTPC,S) = 0; %1F_IN(%2RVTPC,S) $= F_IOS(RVTPC,S); - OPTION CLEAR=RVTPC,CLEAR=F_IOS; - RVTPC(R,V,T,P,C)$TRACKC(R,C) $= SUM(S$%1F_OUT(%2R,V,T,P,C,S),STOA(S)); - F_IOS(RVTPC,TS) = SUM(S$%1F_OUT(%2RVTPC,S),%1F_OUT(%2RVTPC,S)); - %1F_OUT(%2RVTPC,S) = 0; %1F_OUT(%2RVTPC,S) $= F_IOS(RVTPC,S); - OPTION CLEAR=TRACKC,CLEAR=RVTPC,CLEAR=F_IOS; - ); \ No newline at end of file diff --git a/source/sensis.stc b/source/sensis.stc deleted file mode 100644 index abf686a..0000000 --- a/source/sensis.stc +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* sensis.stc Wrapper for sensitivity analysis parameters -*=============================================================================* -$IFI %MCA%==YES $BATINCLUDE main_ext.mod coef_ext MCA -*------------------------------------------------------------------------------ -* Clear deterministic parameter if to be set from uncertain -$IF %CLI%==YES OPTION CLEAR=CM_MAXC; -$IF DEFINED RTP_FFCS OPTION CLEAR=RTP_FFCS; -* Cumulative variable bounds - VAR_CUMFLO.LO(R,P,C,ALLYEAR,LL) = 0; - VAR_CUMFLO.UP(R,P,C,ALLYEAR,LL) = INF; - VAR_CUMCOM.LO(R,C,COM_VAR,ALLYEAR,LL) = 0; - VAR_CUMCOM.UP(R,C,COM_VAR,ALLYEAR,LL) = INF; -*------------------------------------------------------------------------------ - LOOP(SOW, -$ BATINCLUDE bnd_ucw.mod '' I -$ BATINCLUDE bnd_set.mod %VAR%_CAP 'R,T,P' CAP_BND RTP(RT_PP(R,T),P) '' I -* Cumulative variable bounds - VAR_CUMFLO.LO(R,P,C,YEAR,LL)$S_FLO_CUM(R,P,C,YEAR,LL,'LO','1',SOW) = S_FLO_CUM(R,P,C,YEAR,LL,'LO','1',SOW)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); - VAR_CUMFLO.UP(R,P,C,YEAR,LL)$S_FLO_CUM(R,P,C,YEAR,LL,'UP','1',SOW) = S_FLO_CUM(R,P,C,YEAR,LL,'UP','1',SOW)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); - S_COM_CUM(RC_CUMCOM(R,COM_VAR,YEAR,LL,C),L('LO'),'1',SOW)$(NOT S_COM_CUM(RC_CUMCOM,L,'1',SOW)) = -INF$SUM((RTC(R,T,C),ANNUAL(S)),MIN(0,COM_BNDPRD(RTC,S,L)$DIAG(COM_VAR,'PRD')+COM_BNDNET(RTC,S,L)$DIAG(COM_VAR,'NET')+1-1)); - VAR_CUMCOM.LO(R,C,COM_VAR,YEAR,LL)$S_COM_CUM(R,COM_VAR,YEAR,LL,C,'LO','1',SOW) = S_COM_CUM(R,COM_VAR,YEAR,LL,C,'LO','1',SOW)*(1/%CUCSCAL%)*(COM_CUM(R,COM_VAR,YEAR,LL,C,'N')+1); - VAR_CUMCOM.UP(R,C,COM_VAR,YEAR,LL)$S_COM_CUM(R,COM_VAR,YEAR,LL,C,'UP','1',SOW) = S_COM_CUM(R,COM_VAR,YEAR,LL,C,'UP','1',SOW)*(1/%CUCSCAL%)*(COM_CUM(R,COM_VAR,YEAR,LL,C,'N')+1); - -$ IF NOT DEFINED RTP_FFCS $GOTO DIDFUNC - RTP_FFCS(RTP(R,T,P),CG,COM_GRP)$RP_FFSGG(R,P,CG,COM_GRP) = - SUM((RP_FFSGGM(R,P,CG,COM_GRP,CG1,CG2),SW_TSW(SOW,T,W)),PROD(SW_MAP(T,W,J,WW)$S_FLO_FUNC(RTP,CG1,CG2,J,WW),S_FLO_FUNC(RTP,CG1,CG2,J,WW))-1); -* Remap reduced FUNC flows - LOOP(RPCG_PTRAN(RP,C,COM,CG,CG2)$RP_FFSGG(RP,CG,CG2),IF(RPC_FFUNC(RP,C),RP_DCGG(RP,C,CG,CG2,'UP')=YES; ELSE RP_DCGG(RP,COM,CG,CG2,'LO')=YES)); - RP_DCGG(RPC_FFUNC(RP,COM),CG,C,'UP')$(RPG_1ACE(RP,CG,COM)$RPC_ACT(RP,C)) $= RP_FFSGG(RP,CG,C); - RTP_FFCS(RTP(R,T,P),ACTCG,C)$RPC_FFUNC(R,P,C) $= SUM(RP_DCGG(R,P,C,CG,CG2,L),(POWER(RTP_FFCS(RTP,CG,CG2)+1,BDSIG(L))-1)$(RTP_FFCS(RTP,CG,CG2)+1)); - OPTION CLEAR=RP_DCGG; -$ LABEL DIDFUNC -$ IF %CLI%==YES CM_MAXC(ALLYEAR,ITEM) $= S_CM_MAXC(ALLYEAR,ITEM,'1',SOW); - ); -*------------------------------------------------------------------------------ - IF(SW_PHASE=2,SPAR_UCSL(SOW,UC_N,U2,U3,U4)=0); - IF(CARD(REG_FIXT)=0,EQ_OBJ.M$(%MODEL_NAME%.SOLVEOPT<>1)=0; OPTION SOLVEOPT=REPLACE); -$ BATINCLUDE clearsol.stp $EQ_OBJ.M diff --git a/source/setglobs.gms b/source/setglobs.gms deleted file mode 100644 index b909d11..0000000 --- a/source/setglobs.gms +++ /dev/null @@ -1,354 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*========================================================================= -* Setglobs initializes System Declarations and Global Controls -* %1 - optional variable label to jump -*========================================================================= -$ SETARGS X1 X2 -* --- DATA Dump --- -$ IF NOT %DATAGDX%==YES $GOTO SYSD -$ IF NOT ERRORFREE $GOTO SYSD -$ GDXOUT _dd_.gdx -$ IF %G2X6%==YES -$ IF gamsversion 342 $UNLOAD XPT -$ UNLOAD -$ GDXOUT -$ IF NOT warnings $GOTO SYSD -$ IF NOT ERRORFREE $ABORT GAMS cannot filter domain violations -$ IF %G2X6%==YES $BATINCLUDE gdxfilter MAIN -*------------------ -$ LABEL SYSD -*---------------------------------------------------------------------------------------------- -* SYSTEM (Internal) Declarations -*---------------------------------------------------------------------------------------------- -* SET SECTION -*---------------------------------------------------------------------------------------------- -* commodities - SET RC(R,C) 'Commodities in each region'; - SET RCJ(R,C,J,BD) '# of steps for elastic demands'; - SET RC_AGP(REG,COM,LIM) 'Commodity aggregation of production'; - SET RTC_NET(R,ALLYEAR,C) 'VAR_COMNETs within CUM constraint range'; - SET RTC_PRD(R,ALLYEAR,C) 'VAR_COMPRDs within CUM constraint range'; - SET RHS_COMBAL(R,ALLYEAR,C,S) 'VAR_COMNET needed on balance'; - SET RHS_COMPRD(R,ALLYEAR,C,S) 'VAR_COMPRD needed on production'; - SET RCS_COMBAL(R,ALLYEAR,C,S,LIM) 'TS for balance given RHS requirements'; - SET RCS_COMPRD(R,ALLYEAR,C,S,LIM) 'TS for production given RHS requirements'; - SET RCS_COMTS(R,C,ALL_TS) 'All timeslices at/above the COM_TSL'; - SET RD_AGG(REG,COM) 'Micro aggregated demands' //; - SET MI_DMAS(REG,COM,COM) 'Micro aggregation map' //; - -* currency - SET RDCUR(REG,CUR) 'Discounted currencies by region'; - SET OBJ_ICUR(REG,ALLYEAR,P,CUR) 'Capacity-related cost indicator'; - -* commodity types (basic) - SET DEM(REG,COM) 'Demand commodities' //; - SET ENV(REG,COM) 'Environmental indicator commodities' //; - SET FIN(REG,COM) 'Financial flow commodities' //; - SET MAT(REG,COM) 'Material commodities' //; - SET NRG(REG,COM) 'Energy carrier commodities' //; - -* process - SET RP(R,P) 'Processes in each region' //; - SET RP_FLO(R,P) 'Processes with VAR_FLOs (not IRE)' //; - SET RP_STD(R,P) 'Standard processes with VAR_FLOs' //; - SET RP_STG(R,P) 'Storage processes' //; - SET RP_IRE(ALL_REG,P) 'Processes involved in inter-regional trade'//; - SET RP_NRG(R,P) 'Processes with an energy carrier PCG' //; - SET RP_INOUT(R,P,IO) 'Indicator if process input/output normalized (according to PG side)'//; - SET RP_PG(REG,PRC,CG) 'Primary commodity group (PG)' //; - SET RP_PGTYPE(R,P,CG) 'Group type of the primary group' //; - SET RP_UPL(R,P,L) 'Processes with dispatching equations' //; - SET RP_UPR(R,P,L) 'Processes with ramping costs' //; - SET RP_UPS(R,P,TSLVL,L) 'Timeslice levels for startup accounting'//; - SET RP_UPT(R,P,UPT,BD) 'Start-up types for unit commitment' //; - SET RP_DPL(R,P,TSLVL) 'Dispatching process timeslice levels' //; - SET RP_AIRE(R,P,IE) 'Exchange process activity directions' //; - SET RPC(R,P,C) 'Commodities in/out of a processes' //; - SET RPC_CAPFLO(R,ALLYEAR,P,C) 'Commodities involved in capacity' //; - SET RPC_CONLY(R,ALLYEAR,P,C) 'Commodities ONLY involved in capacity' //; - SET RPC_NOFLO(R,P,C) 'Commodities ONLY involved in capacity' //; - SET RPC_IRE(ALL_REG,P,C,IE) 'Process/commodities involved in inter-regional trade'//; - SET RPC_EQIRE(R,P,C,IE) 'Indicator for EQIRE equation generation'//; - SET RPC_MARKET(R,P,C,IE) 'Market exchange process indicator' //; - SET RPC_PG(R,P,C) 'Commodities in the primary group' //; - SET RPC_SPG(R,P,C) 'Commodities in the shadow primary group'//; - SET RPCS_VAR(R,P,C,ALL_TS) 'The timeslices at which VAR_FLOs are to be created'//; - SET RPS_S1(R,P,ALL_TS) 'All timeslices at the PRC_TSL/COM_TSLspg'//; - SET RPS_S2(R,P,ALL_TS) 'All timeslices at/above PRC_TSL/COM_TSLspg'//; - SET RPS_PRCTS(R,P,ALL_TS) 'All timeslices at/above the PRC_TSL' //; - SET RTC(R,ALLYEAR,C) 'Commodity/time' //; - SET RTC_SHED(R,YEAR,C,BD,J) 'Elastic shape indexes' //; - SET RTCS_VARC(R,ALLYEAR,C,ALL_TS) 'The VAR_COMNET/PRDs control set' //; - SET RTP(R,ALLYEAR,P) 'Process/time' //; - SET RTPC(R,ALLYEAR,P,C) 'Commodities of process in period' //; - SET RTP_CPTYR(R,ALLYEAR,ALLYEAR,P) 'Capcity transfer v/t years' //; - SET RTP_OFF(R,ALLYEAR,P) 'Periods for which VAR_NCAP.UP = 0' //; - SET RTPCS_VARF(ALL_REG,ALLYEAR,P,C,ALL_TS) 'The VAR_FLOs control set' //; - SET RTP_VARA(R,ALLYEAR,P) 'The VAR_ACT control set' //; - SET RTP_VARP(R,T,P) 'RTPs that have a VAR_CAP' //; - SET RTP_VINTYR(ALL_REG,ALLYEAR,ALLYEAR,PRC) 'v/t years when vintaging involved'//; - SET RTP_TT(R,YEAR,T,PRC) 'Retrofit control periods' //; - SET RVP(R,ALLYEAR,P) 'ALIAS(RTP) for Process/time' //; - SET RTP_CAPYR(R,YEAR,YEAR,P) 'Capacity vintage years' //; - SET RTP_CGC(REG,YEAR,P,CG,CG) 'Multi-purpose work set' //; - SET RTPS_BD(R,ALLYEAR,P,S,BD) 'Multi-purpose work set' //; - SET CG_GRP(REG,PRC,CG,CG) 'Multi-purpose work set' //; - SET FSCK(REG,PRC,CG,C,CG) 'Multi-purpose work set' //; - SET FSCKS(REG,PRC,CG,C,CG,TS) 'Multi-purpose work set' //; - SET RPC_IREIO(R,P,C,IE,IO) 'Types of trade flows' //; - SET RPC_LS(R,P,C) 'Load sifting control' //; -* process types - SETS ELE(R,P) 'Electric Power Plants' - CHP(R,P) 'Coupled Heat+Power Plants' - HPL(R,P) 'Heat and Steam Plants'; - -* region - SET MREG(ALL_R) 'Set of active regions' //; - SET RREG(ALL_REG,ALL_REG) 'Set of paired regions' //; - -* cumulatives & UCs - SET UC_ON(ALL_R,UC_N) 'Active UCs by region' //; - SET UC_GMAP_C(REG,UC_N,COM_VAR,COM,UC_GRPTYPE) 'Assigning commodities to UC_GRP'; - SET UC_GMAP_P(REG,UC_N,UC_GRPTYPE,PRC) 'Assigning processes to UC_GRP'; - SET UC_GMAP_U(ALL_R,UC_N,UC_N) 'Assigning constraints to UC_GRP' //; - SET UC_DYNBND(UC_N,LIM) 'Dynamic process-wise UC bounds' //; - SET RC_CUMCOM(REG,COM_VAR,ALLYEAR,ALLYEAR,COM) 'Cumulative commodity PRD/NET'; - SET RPC_CUMFLO(REG,PRC,COM,ALLYEAR,ALLYEAR) 'Cumulative process flows'; - -* time - SETS - RS_BELOW(ALL_REG,TS,TS) 'Timeslices stictly below a node' // - RS_BELOW1(ALL_REG,TS,TS) 'Timeslices strictly one level below' // - RS_TREE(ALL_REG,TS,TS) 'Timeslice subtree' // - FINEST(R,ALL_TS) 'Set of the finest timeslices in use' // - PASTMILE(ALLYEAR) 'PAST years that are not MILESYONYR' // - EACHYEAR(ALLYEAR) 'Each year from 1st NCAP_PASTI-Y to last MILESTONYR + DUR_MAX' // - EOHYEARS(ALLYEAR) 'Each year from 1st NCAP_PASTI-Y to last MILESTONYR' //; - ALIAS(PASTYEAR,PYR); - ALIAS(MODLYEAR,V); - -* identifiers for beginning/end of model horizon - SET MIYR_1(ALLYEAR) 'First T' //; - SET MIYR_L(ALLYEAR) 'Last year' //; - -* miscellaneous - SET IPS / IN, N /, LNX(L) / N, FX /; - SET BDUPX(BD) / UP, FX /; - SET BDLOX(BD) / LO, FX /; - SET BDNEQ(BD) / LO, UP /; - SET RP_PRC(R,P); - SET RP_GRP(REG,PRC,CG); - SET RP_CCG(REG,PRC,C,CG); - SET RP_CGG(REG,PRC,C,CG,CG); - SET TRACKC(R,C); - SET TRACKP(R,P); - SET TRACKPC(R,P,C); - SET TRACKPG(R,P,CG); - SET RVT(R,ALLYEAR,T); - SET RTPX(R,T,P); - SET RT_PP(R,T) //; - PARAMETER NO_RT(ALL_R,T) //; - -* --------------------------------------------------------------------------------------------- -* PARAMETERS SECTION -* --------------------------------------------------------------------------------------------- -* Years and splits of timeslices based upon level - PARAMETER LEAD(ALLYEAR) //; - PARAMETER LAGT(ALLYEAR) //; - PARAMETER FPD(ALLYEAR) //; - PARAMETER IPD(ALLYEAR) //; - PARAMETER RS_FR(R,S,S) //; - PARAMETER JS_CCL(R,J,S) //; - -* integrated parameters (created in PREPPM.mod) - PARAMETER UC_COM(UC_N,COM_VAR,SIDE,REG,ALLYEAR,COM,S,UC_GRPTYPE) 'Multiplier of VAR_COM variables' //; - PARAMETER COM_CUM(REG,COM_VAR,ALLYEAR,ALLYEAR,COM,LIM) 'Cumulative bound on commodity' //; - -* derived coefficient components (created in COEF*.MOD) - PARAMETER COEF_AF(R,ALLYEAR,T,PRC,S,BD) 'Capacity/Activity relationship' //; - PARAMETER COEF_CPT(R,ALLYEAR,T,PRC) 'Fraction of capacity available' //; - PARAMETER COEF_ICOM(R,ALLYEAR,T,PRC,C) 'Commodity flow at investment time' //; - PARAMETER COEF_OCOM(R,ALLYEAR,T,PRC,C) 'Commodity flow at decommissioning time' //; - PARAMETER COEF_CIO(R,ALLYEAR,T,P,C,IO) 'Capacity-related commodity in/out flows'//; - PARAMETER COEF_PTRAN(REG,ALLYEAR,PRC,CG,C,CG,TS) 'Multiplier for EQ_PTRANS' //; - PARAMETER COEF_RPTI(R,ALLYEAR,P) 'Repeated investment cycles' //; - PARAMETER COEF_ILED(R,ALLYEAR,P) 'Investment lead time' //; - PARAMETER COEF_PVT(R,T) 'Present value of time in periods' //; - PARAMETER COEF_CAP(R,ALLYEAR,LL,P) 'Generic re-usable work parameter'; - PARAMETER COEF_RTP(R,ALLYEAR,P) 'Generic re-usable work parameter'; - PARAMETER COEF_RVPT(R,ALLYEAR,PRC,T) 'Generic re-usable work parameter'; - PARAMETER RTP_CPX(R,ALLYEAR,P,LL) 'Shape multipliers for capacity transfer'//; - PARAMETER NCAP_AFBX(R,ALLYEAR,P,BD) 'Shape multipliers for NCAP_AF factors' //; - PARAMETER NCAP_AFSM(R,ALLYEAR,P) //; - PARAMETER RVPRL(R,YEAR,P) //; - -* OBJ function yearly values established in COEF_OBJ and used in OBJ_* - PARAMETER OBJ_RFR(R,YEAR,CUR) 'Risk-free rates' //; - PARAMETER OBJ_PVT(R,YEAR,CUR) 'Present value of period' //; - PARAMETER OBJ_CRF(R,ALLYEAR,P,CUR) 'Capital recovery factor' //; - PARAMETER OBJ_CRFD(R,ALLYEAR,P,CUR) 'Capital recovery factor for Decommissioning' //; - PARAMETER OBJ_DISC(R,ALLYEAR,CUR) 'Discounting factor' //; -$IF %OBMAC%==YES $GOTO RESTOBJ - PARAMETER OBJ_ICOST(R,ALLYEAR,P,CUR) 'NCAP_COST for each year' //; - PARAMETER OBJ_ISUB(R,ALLYEAR,P,CUR) 'NCAP_ISUB for each year' //; - PARAMETER OBJ_ITAX(R,ALLYEAR,P,CUR) 'NCAP_ITAX for each year' //; - PARAMETER OBJ_FOM(R,ALLYEAR,P,CUR) 'NCAP_FOM for each year' //; - PARAMETER OBJ_FSB(R,ALLYEAR,P,CUR) 'NCAP_FSUB for each year' //; - PARAMETER OBJ_FTX(R,ALLYEAR,P,CUR) 'NCAP_FTX for each year' //; - PARAMETER OBJ_DCOST(R,ALLYEAR,P,CUR) 'NCAP_DCOST for each year' //; - PARAMETER OBJ_DLAGC(R,ALLYEAR,P,CUR) 'NCAP_DLAGC for each year' //; - PARAMETER OBJ_ACOST(R,ALLYEAR,P,CUR) 'ACT_COST for each year' //; - PARAMETER OBJ_FCOST(R,ALLYEAR,P,C,S,CUR) 'FLO_COST for each year' //; - PARAMETER OBJ_FDELV(R,ALLYEAR,P,C,S,CUR) 'FLO_DELIV for each year' //; - PARAMETER OBJ_FTAX(R,ALLYEAR,P,C,S,CUR) 'FLO_TAX for each year' //; -$LABEL RESTOBJ - PARAMETER OBJ_FSUB(R,ALLYEAR,P,C,S,CUR) 'FLO_SUB for each year' //; - PARAMETER OBJ_COMNT(R,ALLYEAR,C,S,COSTYPE,CUR) 'CSTNET for each year'//; - PARAMETER OBJ_COMPD(R,ALLYEAR,C,S,COSTYPE,CUR) 'CSTPRD for each year'//; - PARAMETER OBJ_IPRIC(R,ALLYEAR,P,C,S,IE,CUR) 'IRE_PRICE for each year'//; - -* Miscellanea - PARAMETERS - PRC_YMIN(REG,PRC) 'Generic process parameter' // - PRC_YMAX(REG,PRC) 'Generic process parameter' // - PRC_SC(REG,PRC) 'Process storage cycles' // - PRC_SGL(REG,PRC) 'Process shadow level (< DAYNITE)' // - PRC_SEMI(R,P) 'Semi-continuous indicator' // - RD_NLP(R,C) 'NLP demand indicator' // - RD_SHAR(R,T,C,C) 'Demand aggregation share' // - RP_AFB(REG,PRC,BD) 'Processes with NCAP_AF by bound type' // - RS_STG(R,ALL_TS) 'Lead from previous storage timeslice' - RS_UCS(R,S,SIDE) 'Lead for TS-dynamic UC' - RS_STGPRD(R,ALL_TS) 'Number of storage periods for each timeslice' - RS_STGAV(R,ALL_TS) 'Average residence time for storage activity' - RS_TSLVL(R,ALL_TS) 'Timeslice levels' - TS_ARRAY(ALL_TS) 'Array for leveling parameter values across timeslices' - STOA(ALL_TS) 'ORD Lag from each timeslice to ANNUAL' - STOAL(ALL_REG,TS) 'ORD Lag from the LVL of each timeslice to ANNUAL' - BDSIG(LIM) 'Bound signum' / LO 1, UP -1 /; - - -*----------------------------------------------------------------------------- -* Initialization interpolation/extrapolation -*----------------------------------------------------------------------------- - SET FIL(ALLYEAR); - SET MY_FIL(ALLYEAR) //; - SET VNT(ALLYEAR,ALLYEAR); - SET YK1(ALLYEAR,ALLYEAR); - PARAMETER FIL2(ALLYEAR); - PARAMETER MY_FIL2(ALLYEAR) //; - PARAMETER MY_ARRAY(ALLYEAR)//; - PARAMETER YKVAL(ALLYEAR,ALLYEAR); - -* flags used in extrapolation - SET BACKWARD(YEAR) //; - SET FORWARD(YEAR) //; -* DM_YEAR is the union of the sets MODLYEAR and DATAYEAR - SET DM_YEAR(ALLYEAR) //; - -*------------------------------------------------------------------------------ -* Additional system declarations -*------------------------------------------------------------------------------ -* Internal Sets: - SETS - PYR_S(ALLYEAR) 'Residual vintage' // - MY_TS(ALL_TS) 'Temporary set for timeslices' // - R_UC(ALL_R,UC_N) 'Temporary set for UCs by region' // - UC_T(UC_N,T) 'Temporary set for UCs by period' // - RXX(ALL_R,*,*) 'General triples related to a region' - UNCD1(*) 'Non-domain-controlled set' - UNCD7(*,*,*,*,*,*,*) 'Non-domain-controlled set of 7-tuples'; - ALIAS(LIFE,AGE); - SET OPYEAR(AGE,LIFE) //; - -*------------------------------------------------------------------------------ -* Sets and parameters used in reduction algorithm -*------------------------------------------------------------------------------ - SET NO_ACT(R,P) 'Process not requiring activity variable' //; - SET RP_PGACT(R,P) 'Process with PCG consisting of 1 commodity' //; - SET RP_PGFLO(R,P) 'Process with PCG having COM_FR' //; - SET RPC_ACT(REG,PRC,CG) 'PG commodity of Process with PCG consisting of 1' //; - SET RPC_AFLO(REG,PRC,CG) 'ACT_FLO residual groups to be handled specially' //; - SET RPC_AIRE(ALL_REG,PRC,COM) 'Exchange process with only one commodity exchanged' //; - SET RPC_EMIS(R,P,COM_GRP) 'Process with emission COM_GRP' //; - SET FS_EMIS(R,P,COM_GRP,C,COM) 'Indicator for emission related FLO_SUM' //; - SET RC_IOP(R,C,IO,P) 'Processes associated with commodity' //; - SET RTCS_SING(R,T,C,S,IO) 'Commodity not being consumed' //; - SET RTPS_OFF(R,T,P,S) 'Process being turned off' //; - SET RTPCS_OUT(R,ALLYEAR,P,C,S) 'Process flows being turned off' //; - SET RPC_FFUNC(R,P,C) 'RPC_ACT Commodity in FFUNC' //; - SET RPCC_FFUNC(REG,PRC,CG,CG) 'Pair of FFUNC commodities with RPC_ACT commodity' //; - SET PRC_CAP(REG,PRC) 'Process requiring capacity variable' //; - SET PRC_ACT(REG,PRC) 'Process requiring activity equation' //; - SET PRC_TS2(REG,PRC,TS) 'Alias for PRC_TS of processes with RPC_ACT' //; - SET RPCG_PTRAN(R,P,COM,C,CG,CG) 'Set for FLO_FUNC/FLO_SUM based substitution' //; - SET KEEP_FLOF(R,P,C) 'Set for FFUNC-defined flows retained'; - ALIAS(CG3,CG4,COM_GRP); - -*------------------------------------------------------------------------------ -* Parameters used in report routine -*------------------------------------------------------------------------------ -* Label lengths exceeding default -$SETGLOBAL RL 'R.TL:MAX(12,R.LEN)' SETGLOBAL PL 'P.TL:MAX(12,P.LEN)' SETGLOBAL CL C.TL:MAX(12,C.LEN) -$IFI NOT %G2X6%==YES $SETGLOBAL RL 'R.TL:MAX(12,CARD(R.TL))' SETGLOBAL PL 'P.TL:MAX(12,CARD(P.TL))' SETGLOBAL CL C.TL:MAX(12,CARD(C.TL)) - - PARAMETERS - PAR_FLO(R,ALLYEAR,ALLYEAR,P,C,S) 'Flow parameter' // - PAR_FLOM(R,ALLYEAR,ALLYEAR,P,C,S) 'Reduced cost of flow variable' // - PAR_IRE(R,ALLYEAR,ALLYEAR,P,C,S,IMPEXP) 'Parameter for im/export flow' // - PAR_IREM(R,ALLYEAR,ALLYEAR,P,C,S,IMPEXP) 'Reduced cost of import/export flow' // - PAR_OBJINV(R,ALLYEAR,ALLYEAR,P,CUR) 'Annual discounted investment costs' // - PAR_OBJDEC(R,ALLYEAR,ALLYEAR,P,CUR) 'Annual discounted decommissioning costs' // - PAR_OBJFIX(R,ALLYEAR,ALLYEAR,P,CUR) 'Annual discounted FOM cost' // - PAR_OBJSAL(R,ALLYEAR,P,CUR) 'Annual discounted salvage value' // - PAR_OBJLAT(R,ALLYEAR,P,CUR) 'Annual discounted late costs' // - PAR_OBJACT(R,ALLYEAR,ALLYEAR,P,TS,CUR) 'Annual discounted variable costs' // - PAR_OBJFLO(R,ALLYEAR,ALLYEAR,P,C,TS,CUR) 'Annual discounted flow costs (incl import/export)' // - PAR_OBJCOM(R,ALLYEAR,COM,TS,CUR) 'Annual discounted commodity costs ' // - PAR_OBJBLE(R,ALLYEAR,COM,CUR) 'Annual discounted blending costs' // - PAR_OBJELS(R,ALLYEAR,COM,CUR) 'Annual discounted elastic demand cost term' //; - - -*---------------------------------------------------------------------------------------------- -* GLOBALS SECTION - Safe Set of TIMES Critical Global control variables -*---------------------------------------------------------------------------------------------- -$SETGLOBAL TIMESED 0 -$SET ControlAbort "Abort Internal Control variable being set by user, aborted" -$LABEL RESET -$IF NOT '%X2%'=='' $EXIT -*------------------------------------------------------------------------- -* Normal Tags for standard TIMES (changed under stochastic mode) -$SETGLOBAL SW_NOTAGS %X1% -$IF NOT %SW_NOTAGS%=="%X1%" $%ControlAbort%: SW_NOTAGS -$IF "%X1%"=='' -$SETGLOBAL SW_NOTAGS SET EQ 'EQ' SET VAR 'VAR' SET SWS '' SET SOW '' SET SWT '' SET SWD '' SET SWTD '' SET SWSW '' SET VART 'VAR' SET VARV 'VAR' SET VARM 'VAR' SET VARTT VAR - -* Helper for process tranformation shape controls -$SETGLOBAL SHFF '%X1%' SETGLOBAL RCAPSUB '%X1%' SETGLOBAL RCAPSBM %X1% -$IF NOT "%SHFF%%RCAPSUB%%RCAPSBM%"=='%X1%%X1%%X1%' $%ControlAbort%: SHFF / RCAPSUB -$SETGLOBAL SHFF 1+RTP_FFC - -* Additional tags for stochastic -$SETGLOBAL MX '%X1%' SETGLOBAL SCUM '%X1%' SETGLOBAL SW_STVARS %X1% -$IF NOT "%MX%%SCUM%%SW_STVARS%"=='%X1%%X1%%X1%' $%ControlAbort%: MX / SW_STVARS / SCUM - -* Objective function variants -$SETGLOBAL CAPJD '%X1%' SETGLOBAL CAPWD %X1% -$IF NOT '%CAPJD%%CAPWD%'=='%X1%%X1%' $%ControlAbort%: CAPxD -* -$SETGLOBAL SWX '%X1%' SETGLOBAL SWTX %X1% -$IF NOT "%SWX%%SWTX%"=='%X1%%X1%' $%ControlAbort%: SWX -$SETGLOBAL SWX ,'1' -* -$SET TMP '%CTST%' SETGLOBAL CTST %X1% -$IF NOT "%CTST%"=='%X1%' $%ControlAbort%: CTST -$SETGLOBAL CTST %TMP% -* -* Tags for stochastic TIMES (set in stages.stc) -$SETGLOBAL SW_TAGS %X1% -$IF NOT "%SW_TAGS%"=='%X1%' $%ControlAbort%: SW_TAGS -$IF NOT '%X1%'=='' $SETLOCAL X1 '' GOTO RESET -*------------------------------------------------------------------------- diff --git a/source/sol_flo.red b/source/sol_flo.red deleted file mode 100644 index a8e7b3b..0000000 --- a/source/sol_flo.red +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* SOL_FLO - code associated with the substitution of flow variables -* %1 - target parameter name -* %2 - parameter name suffix -* %3 - VAR_FLO suffix (.L or .M) -*=============================================================================* -$SET SHP1 "" SET SHP2 "" SET SHP3 "" SET TST '$PRC_VINT(R,P)' SET%4 V VAR -$SET SHG1 ",P,%PGPRIM%,C" SET SHG ',P,CG1,C' -$IF DEFINED RTP_FFCS -$SET SHP1 "*(%SHFF%S(R,V%SHG1%%SOW%))" SET SHP3 "*(%SHFF%S(R,V%SHG%%SOW%))" -$SET SHP1 "*(%SHFF%X(R,V,T%SHG1%)%TST%)%SHP1%" SET SHP3 "*(%SHFF%X(R,V,T%SHG%)%TST%)%SHP3%" - -* Non-substituted flows -$IF '%2'=='' %1(R,V,T,P,C,S%5) $= %V%_FLO%3(R,V,T,P,C,S%5); - -* Activity flows -$IF '%3'=='.L' %1%2(RTP_VINTYR(R,V,T,P),C,S%5)$PRC_TS(R,P,S) $= SUM(RPC_ACT(RP_PGACT(R,P),C),%V%_ACT%3(R,V,T,P,S%5)*PRC_ACTFLO(R,V,P,C)); -$IF '%3'=='.M' %1%2(RTP_VINTYR(R,V,T,P),C,S%5)$PRC_TS(R,P,S) $= SUM(RPC_ACT(RP_PGACT(R,P),C),%V%_ACT%3(R,V,T,P,S%5)*(1/PRC_ACTFLO(R,V,P,C))); - -* Set NO_ACT flows to activity; they were not substituted -$IF '%3'=='.L' %V%_ACT%3(RTP_VINTYR(R,V,T,P),S%5) $= SUM(RPC_PG(RP_FLO(NO_ACT(R,P)),C),%V%_FLO%3(R,V,T,P,C,S%5)*(1/PRC_ACTFLO(R,V,P,C))); -$IF '%3'=='.L' %V%_ACT%3(RTP_VINTYR(R,V,T,P),S%5) $= SUM(RPC_IRE(RPC_PG(NO_ACT(R,P),C),IE)$RP_AIRE(R,P,IE),%V%_IRE%3(R,V,T,P,C,S,IE%5)*(1/PRC_ACTFLO(R,V,P,C))); -$IF '%3'=='.M' %V%_ACT%3(R,V,T,P,S%5) $= SUM(RPC_PG(RP_FLO(NO_ACT(R,P)),C),%V%_FLO%3(R,V,T,P,C,S%5)*PRC_ACTFLO(R,V,P,C)); -$IF '%3'=='.M' %V%_ACT%3(R,V,T,P,S%5) $= SUM(RPC_IRE(RPC_PG(NO_ACT(R,P),C),IE)$RP_AIRE(R,P,IE),%V%_IRE%3(R,V,T,P,C,S,IE%5)*PRC_ACTFLO(R,V,P,C)); -*------------------------------------------------------------------------------- -* Marginals for substituted flows currently not supported -$IF '%3'=='.M' $EXIT -*------------------------------------------------------------------------------- -* FFUNC substituted flows -%1%2(RTP_VINTYR(R,V,T,P),C,S%5)$(RTPCS_VARF(R,T,P,C,S)%6$RPC_FFUNC(R,P,C)) = - SUM((RPC_ACT(R,P,COM),RS_TREE(R,S,TS))$%V%_ACT%3(R,V,T,P,TS%5), - %V%_ACT%3(R,V,T,P,TS%5) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) * - ( ACT_FLO(R,V,P,C,S)%SHP1% )); - -* Emission flows -%1%2(RTP_VINTYR(R,V,T,P),C,S%5)$(RTPCS_VARF(R,T,P,C,S)%6$RPC_EMIS(R,P,C)) = - SUM((FS_EMIS(R,P,CG1,COM,C),RS_TREE(R,S,TS))$%1%2(R,V,T,P,COM,TS%5), - %1%2(R,V,T,P,COM,TS%5) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) * - COEF_PTRAN(R,V,P,CG1,COM,C,TS)%SHP3%); diff --git a/source/sol_ire.rpt b/source/sol_ire.rpt deleted file mode 100644 index e555bf9..0000000 --- a/source/sol_ire.rpt +++ /dev/null @@ -1,20 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*==============================================================================* -* SOL_IRE - basic solution parameters for IRE flows and auxiliaries -*==============================================================================* -$SET SRC 'PAR_IRE(R,V,T,P,C,S,IE)' SET%1 V VAR -$SET SWS %V%_IRE.L(R,V,T,P,C,S,IE%2)$(NOT RPC_AIRE(R,P,C))+(%V%_ACT.L(R,V,T,P,S%2)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) -$SET SWD %V%_IRE.M(R,V,T,P,C,S,IE%2)$(NOT RPC_AIRE(R,P,C))+(%V%_ACT.M(R,V,T,P,S%2)/PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) -$IF '%4'==) $SET SRC '%SWS%' SET SWS '0' SET SWD 0 - - OPTION CLEAR=PAR_IRE,CLEAR=PAR_IREM; - PAR_IRE(RTP_VINTYR(R,V,T,P),C,S,IE)$(RTPCS_VARF(R,T,P,C,S)$RPC_IRE(R,P,C,IE)) = %SWS%; - PAR_IREM(RTP_VINTYR(R,V,T,P),C,S,IE)$(RTPCS_VARF(R,T,P,C,S)$RPC_IRE(R,P,C,IE)) = %SWD%; - -* emissions & auxiliary flows from IRE -$IF DEFINED RTP_FFCS $SET MX "(%SHFF%S(R,V,P,COM,COM%SOW%))*" - F_INOUTS(F_IOSET(R,V,T,P,COM,S,IO)) = %3 %MX% - SUM(RPC_IRE(R,P,C,IE),IRE_FLOSUM(R,T,P,C,S,IE,COM,IO)*(%SRC%%4)); diff --git a/source/solprep.msa b/source/solprep.msa deleted file mode 100644 index 12df7bb..0000000 --- a/source/solprep.msa +++ /dev/null @@ -1,133 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* SOLPREP.MSA Preprocessing routine for MACRO Stand-Alone -*============================================================================* -$IF NOT '%1'=='' $GOTO %1 -*----------------------------------------------------------------------------- -* Calculation of solution values for (due to reduction) substituted flows -*----------------------------------------------------------------------------- -$LABEL INIT - OPTION CLEAR=PAR_FLO,CLEAR=PAR_IRE; -$ BATINCLUDE sol_flo.red PAR_FLO '' .L -$ BATINCLUDE sol_ire.rpt -*----------------------------------------------------------------------------- -* Calculation of annual costs and commodity marginals -*----------------------------------------------------------------------------- - OPTION CLEAR=CST_PVP,CLEAR=CST_ACTC,CLEAR=CST_INVC,CLEAR=CST_INVX,CLEAR=CST_FIXC,CLEAR=CST_FIXX; - OPTION CLEAR=CAP_NEW,CLEAR=CST_FLOC,CLEAR=CST_FLOX,CLEAR=CST_COMC,CLEAR=CST_COMX,CLEAR=CST_IREC; -$ BATINCLUDE rpt_obj.rpt '' "" '' '%SYSPREFIX%' 0 -$ BATINCLUDE cost_ann.rpt -* Commodity levels and marginals - OPTION CLEAR=PAR_COMBALEM; - PAR_COMPRDL(R,T,C,S) $= VAR_COMPRD.L(R,T,C,S); - PAR_COMNETL(R,T,C,S) $= VAR_COMNET.L(R,T,C,S); - PAR_COMBALEM(R,T,C,S) $= EQG_COMBAL.M(R,T,C,S)*(1/COEF_PVT(R,T)); - PAR_COMBALEM(R,T,C,S) $= EQE_COMBAL.M(R,T,C,S)*(1/COEF_PVT(R,T)); -$ BATINCLUDE preppm.msa TONLP -*============================================================================= -* Annual costs for MACRO - OPTION CLEAR=NCAP_YES,CLEAR=PAR_OBJINV,CLEAR=PAR_OBJFIX; - NCAP_YES(R,V,P)$(VAR_NCAP.L(R,V,P)+NCAP_PASTI(R,V,P))=YES; - PAR_OBJINV(RTP_CPTYR(R,V,T,P),CUR)$(NCAP_YES(R,V,P)$COEF_OBINVN(R,V,P,CUR)) = COEF_CPT(R,V,T,P) * - COEF_OBINVN(R,V,P,CUR) * (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)); - PAR_OBJFIX(RTP_CPTYR(R,V,T,P),CUR)$(NCAP_YES(R,V,P)$COEF_OBFIXN(R,V,P,CUR)) = COEF_CPT(R,V,T,P) * - COEF_OBFIXN(R,V,P,CUR) * (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)); -$IFI %OBJANN%==YES MACST('VAR')=NO; VAR_ANNCST.UP('OBJVAR',R,T,CUR)=INF; - TM_ANNC(MR(R),T) = SUM(MACST$REG_ACOST(R,T,MACST),REG_ACOST(R,T,MACST)) + - SUM((VNT(V,T),P,RDCUR(R,CUR))$PAR_OBJINV(R,V,T,P,CUR),PAR_OBJINV(R,V,T,P,CUR)) + - SUM((VNT(V,T),P,RDCUR(R,CUR))$PAR_OBJFIX(R,V,T,P,CUR),PAR_OBJFIX(R,V,T,P,CUR)); -$IFI %OBJANN%==YES TM_ANNC(R,T) = TM_ANNC(R,T)+SUM(RDCUR(R,CUR),VAR_ANNCST.L('OBJVAR',R,T,CUR)); -*----------------------------------------------------------------------------- -* Marginal costs of demands - OPTION CLEAR=TM_DMC; - TM_DMC(RTC(MR(R),T,C))$DEM(R,C) = SUM(RTCS_VARC(R,T,C,S),PAR_COMBALEM(R,T,C,S) * G_YRFR(R,S)); - TM_DMC(R,T,C)$(TM_DMC(R,T,C) EQ 0) = 0; - LOOP(MIYR_1(TT(T-1)),TM_DMC(R,TT,C)$((TM_DMC(R,TT,C) GT TM_DMC(R,T,C))$DEM(R,C)) = TM_DMC(R,T,C)); -$ BATINCLUDE filparam TM_DMC 'R,' C ",'0','0','0','0','0'" DATAYEAR T - LOOP(MIYR_1(TT(T-1)),TM_DMC(R,TT,C)$((TM_DMC(R,TT,C) LT TM_DMC(R,T,C)*0.7)$DEM(R,C)) = TM_DMC(R,T,C)*0.7); -* Demand levels - TM_DEM(MR(R),T,C)$((COM_PROJ(R,T,C) GT 0)$DEM(R,C)) = COM_PROJ(R,T,C) - - SUM((RTCS_VARC(R,T,C,S),RCJ(R,C,J,'LO')), VAR_ELAST.L(R,T,C,S,J,'LO')) - + SUM((RTCS_VARC(R,T,C,S),RCJ(R,C,J,'UP')), VAR_ELAST.L(R,T,C,S,J,'UP')); -*----------------------------------------------------------------- -$LABEL QSF -* Quadratic supply function - OPTION DM < TM_DEM; - TM_DMC(MR,TB,DM)$(TM_DMC(MR,TB,DM)*TM_DEM(MR,TB,DM) < 1E-5*TM_ANNC(MR,TB)) = 0; - TM_ANNC(REG,TP)=TM_ANNC(REG,TP) * TM_SCALE_CST; - LOOP(TB(T-1), TM_ANNC(REG,TB) = MIN(TM_ANNC(REG,T),TM_ANNC(REG,TB)); -$IFI %MSA%%2==CSA0 TM_EC0(REG) = TM_ANNC(REG,TB); TM_DDATPREF(REG,DM) = TM_DMC(REG,TB,DM); - TM_ANNC(REG,TB) = TM_EC0(REG); TM_DMC(REG,TB,DM) = TM_DDATPREF(REG,DM)); - TM_QSFB(REG,TP,DM)$TM_DEM(REG,TP,DM) = 0.5*TM_DMC(REG,TP,DM)*TM_SCALE_CST/TM_DEM(REG,TP,DM); - TM_QSFA(REG,TP)=TM_ANNC(REG,TP)- SUM(DM, TM_QSFB(REG,TP,DM)*TM_DEM(REG,TP,DM)**2); -*----------------------------------------------------------------------------- -$EXIT -$LABEL OUT -* Write data transfer attributes to file - FILE TIM2MSA / MSAQSF.DD /; -* - PUT TIM2MSA; - PUT "$ONMULTI" /; -* Milestones - PUT "SET T /" /; - LOOP(T, PUT T.TL /;); - PUT "/;" /; -* Lagtimes - PUT "PARAMETER LAGT /" /; - LOOP(T, PUT T.TL, LAGT(T) /;); - PUT "/;" /; -* Durations - PUT "PARAMETER D /" /; - LOOP(T, PUT T.TL, D(T) /;); - PUT "/;" /; -* Regions - PUT "SET REG /" /; - LOOP(MR(R), PUT R.TL /;); - PUT "/;" /; -* Commodities - PUT "SET COM /" /; - LOOP(DM(C), PUT C.TL /;); - PUT "/;" /; -* - TIM2MSA.nr = 2; - TIM2MSA.nd = 9; - TIM2MSA.nw = 17; - TIM2MSA.nz = 1e-9; -* Annual regional costs - PUT "PARAMETER TM_ANNC /" /; - LOOP((MR(R),T), PUT R.TL:0,".":0,T.TL:0 (TM_ANNC(R,T)/TM_SCALE_CST) /;); - PUT "/;" /; -* GDP target - PUT "PARAMETER TM_GR /" /; - LOOP((MR(R),T), PUT R.TL:0,".":0,T.TL:0 TM_GR(R,T) /;); - PUT "/;" /; -* Demand levels - PUT "PARAMETER TM_DEM /" /; - LOOP(MRTC(MR(R),T,C),PUT MRTC.TE(MRTC), TM_DEM(MRTC) /;); - PUT "/;" /; -* Demand marginals - PUT "PARAMETER TM_DMC /" /; - LOOP(MRTC(MR(R),T,C)$TM_DMC(MRTC), PUT MRTC.TE(MRTC), TM_DMC(MRTC) /;); - PUT "/;" /; - PUT 'SCALAR TM_ARBM' @25 '/' TM_ARBM ' /;' /; - PUT 'SCALAR TM_SCALE_UTIL' @25 '/' TM_SCALE_UTIL ' /;' /; - PUT 'SCALAR TM_SCALE_CST' @25 '/' TM_SCALE_CST ' /;' /; - PUT 'SCALAR TM_SCALE_NRG' @25 '/' TM_SCALE_NRG ' /;' /; - PUT / 'PARAMETER TM_KGDP(R)' @25 '/' /; - LOOP(MR(R), PUT @1 R.TL:0, TM_KGDP(R) / @1 '/;'); - PUT / 'PARAMETER TM_KPVS(R)' @25 '/' /; - LOOP(MR(R), PUT @1 R.TL:0, TM_KPVS(R) / @1 '/;'); - PUT / 'PARAMETER TM_DEPR(R)' @25 '/' /; - LOOP(MR(R), PUT @1 R.TL:0, TM_DEPR(R) / @1 '/;'); - PUT / 'PARAMETER TM_ESUB(R)' @25 '/' /; - LOOP(MR(R), PUT @1 R.TL:0, TM_ESUB(R) / @1 '/;'); - PUT / 'PARAMETER TM_GDP0(R)' @25 '/' /; - LOOP(MR(R), PUT @1 R.TL:0, TM_GDP0(R) / @1 '/;'); - PUT / 'PARAMETER TM_DMTOL(R)' @25 '/' /; - LOOP(MR(R), PUT @1 R.TL:0, TM_DMTOL(R) / @1 '/;'); - PUT / 'PARAMETER TM_IVETOL(R)' @25 '/' /; - LOOP(MR(R), PUT @1 R.TL:0, TM_IVETOL(R) / @1 '/;'); - PUTCLOSE TIM2MSA; diff --git a/source/solputta.ans b/source/solputta.ans deleted file mode 100644 index 3fa03ad..0000000 --- a/source/solputta.ans +++ /dev/null @@ -1,263 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -*--------------------------------------------------------------------- -* SOLPUTTA.ANS -* -* Output routine for ANSWER -* - creating table for TIMES Analyst within ANSWER -* - seperate calls for primal/dual values -*--------------------------------------------------------------------- -* placeholder for stochastic scenario -* SET SOW / EMPTY /; -$IF %SCUM%==1 SOW(W)=AUXSOW(W); -*--------------------------------------------------------------------- -$IF NOT %SOLVEDA%==1 -$IFI NOT %STAGES%==YES $SHIFT SHIFT SHIFT -$SETLOCAL ITEM2 ',ITEM' -$IF %1==S $SETLOCAL ITEM2 '' -*--------------------------------------------------------------------- -* reconstruct variable levels and marginals for those eliminated by the REDUCE option - -* Scenario name for run coming from $SET RUN_NAME in *.DD or .RUN file -FILE sola / %RUN_NAME%.ANT /; - -sola.PW=1000; -sola.ND=4; -sola.NW=15; -sola.LW=0; - -PUT sola; -PUT '*** ' SYSTEM.TITLE -PUT / '*** Case %RUN_NAME%' / - -SET PUTIT(%2R,T,P); -SET PUTI1(%2R,ALLYEAR,T,P); -SET PUTI2(%2R,ALLYEAR,T,P,TS); -SET PUTI3(%2R,ALLYEAR,T,P,C,S); -SET PUTI4(%2R,T,C,TS); -SET PUTI5(%2R,T,P,TS); -SET PUTI6(%2R,T,P,C,S); -SET PUTI7(%2R,T,P,C); -SET UCITEM3(%2UC_N,ITEM,ITEM,ITEM); -SET CUMITEM4(%2R,ITEM,ITEM,ITEM,ITEM); -* --- Retirement results --- -PARAMETER %1PAR_RET(%2R,ALLYEAR,T,P) //; -* --- CumCom results --- -PARAMETER %1PAR_CUMCOML(%2R,C,COM_VAR,ALLYEAR,ALLYEAR) //; -PARAMETER %1PAR_CUMCOMM(%2R,C,COM_VAR,ALLYEAR,ALLYEAR) //; - -*--------------------------------------------------------------------- -* Output of VAR_NCAP, units of capacity -*--------------------------------------------------------------------- -* ATTR R P COM V TS P/D -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' VAR_NCAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.L' %1PAR_NCAPL(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' VAR_NCAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.M' %1PAR_NCAPM(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) - -*--------------------------------------------------------------------- -* Output of VAR_ACT, units of activity -*--------------------------------------------------------------------- -* split out non/vintage processes - PARAMETER APARRTP(%2R,T,P); - PARAMETERS NV_ACTL(%2R,T,P,S); - PARAMETERS NV_ACTM(%2R,T,P,S); - NV_ACTL(%3RTP_VARA(R,T,P),S)$PRC_TS(R,P,S) = SUM(YK(T,V)$%1PAR_ACTL(%3R,V,T,P,S),%1PAR_ACTL(%3R,V,T,P,S)); - NV_ACTM(%3R,T,P,S)$(NOT PRC_VINT(R,P)) $= ABS(%1PAR_ACTM(%3R,T,T,P,S)); - NV_ACTM(%3RTP_VARA(R,T,P),S)$(PRC_TS(R,P,S)$PRC_VINT(R,P)) = SMIN(RTP_VINTYR(R,V,T,P),ABS(%1PAR_ACTM(%3R,V,T,P,S))); - -* ALL-vintage -$ BATINCLUDE solsubta.ans PUTI5 '(RTP_VARA(R,T,P)*PRC_TS(R,P,S))' VAR_ACT 'R.TL' 'P.TL' "' '" "' '" 'S.TL' '.L' 'NV_ACTL(%3R,T,P,S)' (%3R,TT,P,S) (%3R,TT(T--ORD(T)),P,S) -$ BATINCLUDE solsubta.ans PUTI5 '(RTP_VARA(R,T,P)*PRC_TS(R,P,S))' VAR_ACT 'R.TL' 'P.TL' "' '" "' '" 'S.TL' '.M' 'NV_ACTM(%3R,T,P,S)' (%3R,TT,P,S) (%3R,TT(T--ORD(T)),P,S) -* by vintage for PRC_VINT -$ BATINCLUDE solsubta.ans PUTI2 '((RTP_VINTYR(R,V,T,P)*PRC_TS(R,P,S))$PRC_VINT(R,P))' VAR_ACTV 'R.TL' 'P.TL' "' '" 'V.TL' 'S.TL' '.L' '%1PAR_ACTL(%3R,V,T,P,S)' (%3R,V,TT,P,S) (%3R,V,TT(T--ORD(T)),P,S) -$ BATINCLUDE solsubta.ans PUTI2 '((RTP_VINTYR(R,V,T,P)*PRC_TS(R,P,S))$PRC_VINT(R,P))' VAR_ACTV 'R.TL' 'P.TL' "' '" 'V.TL' 'S.TL' '.M' '%1PAR_ACTM(%3R,V,T,P,S)' (%3R,V,TT,P,S) (%3R,V,TT(T--ORD(T)),P,S) -* For retirements -$IF NOT DEFINED VNRET $GOTO NORET - LOOP(TT(T--1),Z=ORD(T)-1;%1PAR_RET(%3RTP_CPTYR(R,V,T,P))$PRC_RCAP(R,P) = MAX(0,%VART%_SCAP.L(R,V,T,P%SWS%)-RTFORC(R,V,T,P)-(%VART%_SCAP.L(R,V,TT,P%SWS%)-RTFORC(R,V,TT,P))$Z)); -$ BATINCLUDE solsubta.ans PUTI1 '(RTP_CPTYR(R,V,T,P)$PRC_RCAP(R,P))' VAR_RCAPGV 'R.TL' 'P.TL' "' '" 'V.TL' "' '" '.L' '%1PAR_RET(%3R,V,T,P)' (%3R,V,TT,P) (%3R,V,TT(T--ORD(T)),P) - OPTION CLEAR=%1PAR_RET; LOOP(RTP(R,V,P)$PRC_RCAP(R,P),Z=1;LOOP(RTP_CPTYR(R,VNRET(V,T),P)$Z,Z=0; %1PAR_RET(%3R,V,T,P) $= %VART%_SCAP.L(R,V,T,P%SWS%))); - %1PAR_RET(%3R,V,T,P) $= %VART%_RCAP.L(R,V,T,P%SWS%); -$ BATINCLUDE solsubta.ans PUTI1 '(RTP_CPTYR(R,V,T,P)$VNRET(V,T)$PRC_RCAP(R,P))' VAR_RCAPV 'R.TL' 'P.TL' "' '" 'V.TL' "' '" '.L' '%1PAR_RET(%3R,V,T,P)' (%3R,V,TT,P) (%3R,V,TT(T--ORD(T)),P) - OPTION CLEAR=%1PAR_RET; %1PAR_RET(%3R,V,T,P) $= %VART%_RCAP.M(R,V,T,P%SWS%); -$ BATINCLUDE solsubta.ans PUTI1 '(RTP_CPTYR(R,V,T,P)$VNRET(V,T)$PRC_RCAP(R,P))' VAR_RCAPV 'R.TL' 'P.TL' "' '" 'V.TL' "' '" '.M' '%1PAR_RET(%3R,V,T,P)' (%3R,V,TT,P) (%3R,V,TT(T--ORD(T)),P) -$LABEL NORET -*--------------------------------------------------------------------- -* Output of VAR_FLO, units of activity -*--------------------------------------------------------------------- -$SET FLOTS RPCS_VAR(R,P,C,S) -$IFI %RPT_FLOTS%==ANNUAL $SET FLOTS ANNUAL(S) -$IFI %RPT_FLOTS%==COM $SET FLOTS COM_TS(R,C,S) - -* split in/out - PARAMETER NV_FLOL(%2R,T,P,C,S); -* ATTR R P COM V TS L/M DATA LOOP ASSIGN -* VAR_FLO: ALL-vintage - OPTION CLEAR=NV_FLOL; OPTION PUTI6 < %1F_IN; - NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_IN(%3R,V,T,P,C,S),%1F_IN(%3R,V,T,P,C,S)); -$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'IN')*%FLOTS%)" VAR_FIN 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) -$ BATINCLUDE solsubta.ans PUTI6 "((NOT TOP(R,P,C,'IN')+RPC_IRE(R,P,C,'EXP'))$NV_FLOL(%3R,T,P,C,S))" VAR_FIN 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) - OPTION CLEAR=NV_FLOL; OPTION PUTI6 < %1F_OUT; - NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_OUT(%3R,V,T,P,C,S),%1F_OUT(%3R,V,T,P,C,S)); -$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'OUT')*%FLOTS%)" VAR_FOUT 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) -$ BATINCLUDE solsubta.ans PUTI6 "((NOT TOP(R,P,C,'OUT')+RPC_IRE(R,P,C,'IMP'))$NV_FLOL(%3R,T,P,C,S))" VAR_FOUT 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) - -* VAR_FLO marginals: ALL-vintage (only non-substituted and PG flows) -$IFI %1==S $GOTO DONEFLOM - OPTION CLEAR=NV_FLOL; - TRACKPC(RPC(R,P,C))$(NOT RPC_FFUNC(R,P,C)+RPC_EMIS(R,P,C)) = YES; - NV_FLOL(%3R,T,P,C,S)$(TRACKPC(R,P,C)$(NOT PRC_VINT(R,P))) $= ABS(%1PAR_FLOM(%3R,T,T,P,C,S))*(1/COEF_PVT(R,T)); - NV_FLOL(RTPCS_VARF(%3R,T,P,C,S))$(TRACKPC(R,P,C)$PRC_VINT(R,P)) = SMIN(RTP_VINTYR(R,V,T,P),ABS(%1PAR_FLOM(%3R,V,T,P,C,S)))/COEF_PVT(R,T); -$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'IN')*%FLOTS%)" VAR_FIN 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) -$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'OUT')*%FLOTS%)" VAR_FOUT 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) - OPTION CLEAR=TRACKPC; -$LABEL DONEFLOM - -* VAR_IRE: ALL-vintage - OPTION CLEAR=NV_FLOL,CLEAR=PUTI3; - PUTI3(%3R,LL--ORD(LL),T,P,C,S)$RP_IRE(R,P) $= %1F_IN(%3R,LL,T,P,C,S); OPTION PUTI6 < PUTI3; - NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_IN(%3R,V,T,P,C,S),%1F_IN(%3R,V,T,P,C,S)); -$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'EXP')*%FLOTS%)" VAR_XEXP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) - OPTION CLEAR=NV_FLOL,CLEAR=PUTI3; - PUTI3(%3R,LL--ORD(LL),T,P,C,S)$RP_IRE(R,P) $= %1F_OUT(%3R,LL,T,P,C,S); OPTION PUTI6 < PUTI3; - NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_OUT(%3R,V,T,P,C,S),%1F_OUT(%3R,V,T,P,C,S)); -$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'IMP')*%FLOTS%)" VAR_XIMP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) - -$IFI %1==S $GOTO DONEIREM -* VAR_IRE marginals: All vintage - OPTION CLEAR=NV_FLOL; - NV_FLOL(RTPCS_VARF(R,T,P,C,S))$RPC_IRE(R,P,C,'EXP') = SMIN(RTP_VINTYR(R,V,T,P),ABS(PAR_IREM(R,V,T,P,C,S,'EXP')))/COEF_PVT(R,T); -$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'EXP')*RPCS_VAR(R,P,C,S))" VAR_XEXP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(R,T,P,C,S) (R,TT,P,C,S) (R,TT(T--ORD(T)),P,C,S) - OPTION CLEAR=NV_FLOL; - NV_FLOL(RTPCS_VARF(R,T,P,C,S))$RPC_IRE(R,P,C,'IMP') = SMIN(RTP_VINTYR(R,V,T,P),ABS(PAR_IREM(R,V,T,P,C,S,'IMP')))/COEF_PVT(R,T); -$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'IMP')*RPCS_VAR(R,P,C,S))" VAR_XIMP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(R,T,P,C,S) (R,TT,P,C,S) (R,TT(T--ORD(T)),P,C,S) -$LABEL DONEIREM - -* EQIRE marginals: ALL-vintage - OPTION CLEAR=NV_FLOL; - NV_FLOL(%3R,T,P,C,S)$RP_IRE(R,P) $= %1PAR_IPRIC(%3R,T,P,C,S,'EXP'); -$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'EXP')*RPCS_VAR(R,P,C,S))" EQIRE_EXP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) - OPTION CLEAR=NV_FLOL; - NV_FLOL(%3R,T,P,C,S)$RP_IRE(R,P) $= %1PAR_IPRIC(%3R,T,P,C,S,'IMP'); -$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'IMP')*RPCS_VAR(R,P,C,S))" EQIRE_IMP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) - -* ELC supply by source - OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1PAR_EOUT; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1PAR_EOUT(%3R,V,T,P,C),%1PAR_EOUT(%3R,V,T,P,C)); -$ BATINCLUDE solsubta.ans PUTI6 KEEP_FLOF(R,P,C) ELC- 'R.TL' 'P.TL' C.TL "''" "''" 'BY-SRC' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) - -*--------------------------------------------------------------------- -* Output of VAR_CAP, units of capacity -*--------------------------------------------------------------------- -* ATTR R P COM V TS L/M - APARRTP(%3RTP(R,T,P)) = %1PAR_CAPL(%3R,T,P)+SUM(PASTCV,%1PAR_PASTI(%3R,T,P,PASTCV)); -$ BATINCLUDE solsubta.ans PUTIT '(RTP(R,T,P)*PRC_CAP(R,P))' VAR_CAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.L' APARRTP(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -$ BATINCLUDE solsubta.ans PUTIT '(RTP(R,T,P)*%1PAR_CAPM(%3R,T,P))' VAR_CAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.M' %1PAR_CAPM(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) - -*--------------------------------------------------------------------- -* Output of Commodity and peaking balance, commodity units -*--------------------------------------------------------------------- -* ATTR R P COM V TS L/M -$IFI %STAGES%%SCUM%==YES $GOTO DONEBALL -$ BATINCLUDE solsubta.ans PUTI4 "RCS_COMBAL(R,T,C,S,'LO')" EQ_COMBAL R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' 'EQG_COMBAL.L(R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -$ BATINCLUDE solsubta.ans PUTI4 "RCS_COMBAL(R,T,C,S,'FX')" EQ_COMBAL R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' 'EQE_COMBAL.L(R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -$ BATINCLUDE solsubta.ans PUTI4 '(RTCS_VARC(R,T,C,S)$COM_PKTS(R,C,S))' EQ_PEAK R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' 'EQ_PEAK.L(R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -$LABEL DONEBALL -$ BATINCLUDE solsubta.ans PUTI4 "RTCS_VARC(R,T,C,S)" EQ_COMBAL R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_COMBALEM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -$ BATINCLUDE solsubta.ans PUTI4 '(RTCS_VARC(R,T,C,S)$COM_PKTS(R,C,S))' EQ_PEAK R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_PEAKM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -* Balance variables -$IFI %1==S LOOP(%3 - RHS_COMBAL(R,T,C,S)$=%1PAR_COMNETL(%3R,T,C,S); RHS_COMPRD(R,T,C,S)$=%1PAR_COMPRDL(%3R,T,C,S); -$IFI %1==S ); -$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMBAL(R,T,C,S)" VAR_COMNET R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' '%1PAR_COMNETL(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMBAL(R,T,C,S)" VAR_COMNET R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_COMNETM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMPRD(R,T,C,S)" VAR_COMPRD R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' '%1PAR_COMPRDL(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) -$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMPRD(R,T,C,S)" VAR_COMPRD R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_COMPRDM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) - -*--------------------------------------------------------------------- -* Output of user constraints -*--------------------------------------------------------------------- -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,'NONE','NONE','NONE') UC.L "''" UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSL(%3UC_N,'NONE','NONE','NONE')" (%3UC_N,ITEM,ITEM,ITEM) "(%3UC_N,'','','')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,R,'NONE','NONE') UCR.L R.TL UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSL(%3UC_N,R,'NONE','NONE')" (%3UC_N,R,ITEM,ITEM) "(%3UC_N,R,'','')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,'NONE',T,'NONE') UCT "''" UC_N.TL "' '" "' '" "' '" '.L' "%1PAR_UCSL(%3UC_N,'NONE',T,'NONE')" (%3UC_N,ITEM,TT,ITEM) "(%3UC_N,'',TT(T--ORD(T)),'')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,R,T,'NONE') UCRT R.TL UC_N.TL "' '" "' '" "' '" '.L' "%1PAR_UCSL(%3UC_N,R,T,'NONE')" (%3UC_N,R,TT,ITEM) "(%3UC_N,R,TT(T--ORD(T)),'')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,'NONE',T,S) UCTS "''" UC_N.TL "' '" "' '" S.TL '.L' "%1PAR_UCSL(%3UC_N,'NONE',T,S)" (%3UC_N,ITEM,TT,S) "(%3UC_N,'',TT(T--ORD(T)),S)" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,R,T,S) UCRTS R.TL UC_N.TL "' '" "' '" S.TL '.L' "%1PAR_UCSL(%3UC_N,R,T,S)" (%3UC_N,R,TT,S) "(%3UC_N,R,TT(T--ORD(T)),S)" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,'NONE','NONE','NONE') UC.M "''" UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSM(%3UC_N,'NONE','NONE','NONE')" (%3UC_N,ITEM,ITEM,ITEM) "(%3UC_N,'','','')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,R,'NONE','NONE') UCR.M R.TL UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSM(%3UC_N,R,'NONE','NONE')" (%3UC_N,R,ITEM,ITEM) "(%3UC_N,R,'','')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,'NONE',T,'NONE') UCT "''" UC_N.TL "' '" "' '" "' '" '.M' "%1PAR_UCSM(%3UC_N,'NONE',T,'NONE')" (%3UC_N,ITEM,TT,ITEM) "(%3UC_N,'',TT(T--ORD(T)),'')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,R,T,'NONE') UCRT R.TL UC_N.TL "' '" "' '" "' '" '.M' "%1PAR_UCSM(%3UC_N,R,T,'NONE')" (%3UC_N,R,TT,ITEM) "(%3UC_N,R,TT(T--ORD(T)),'')" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,'NONE',T,S) UCTS "''" UC_N.TL "' '" "' '" S.TL '.M' "%1PAR_UCSM(%3UC_N,'NONE',T,S)" (%3UC_N,ITEM,TT,S) "(%3UC_N,'',TT(T--ORD(T)),S)" -$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,R,T,S) UCRTS R.TL UC_N.TL "' '" "' '" S.TL '.M' "%1PAR_UCSM(%3UC_N,R,T,S)" (%3UC_N,R,TT,S) "(%3UC_N,R,TT(T--ORD(T)),S)" -$ BATINCLUDE solsubta.ans CUMITEM4 %1PAR_UCMRK(%3R,T,ITEM,C,S) UC_MARK R.TL ITEM.TL C.TL "' '" S.TL '.M' "%1PAR_UCMRK(%3R,T,ITEM,C,S)" (%3R,TT,ITEM,C,S) "(%3R,TT(T--ORD(T)),ITEM,C,S)" - -*--------------------------------------------------------------------- -* Output of cumulatives -*--------------------------------------------------------------------- -* Cumcom results (unscaling) - %1PAR_CUMCOML(%3R,C,COM_VAR,ALLYEAR,LL) $= %VAR%_CUMCOM.L(R,C,COM_VAR,ALLYEAR,LL%SOW%)*%CUCSCAL%; - %1PAR_CUMCOMM(%3R,C,COM_VAR,ALLYEAR,LL) $= %VAR%_CUMCOM.M(R,C,COM_VAR,ALLYEAR,LL%SOW%)*(1/%CUCSCAL%); -$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMNET.L 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOML(%3R,C,"NET",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("NET"),YEAR,LL) -$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMNET.M 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOMM(%3R,C,"NET",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("NET"),YEAR,LL) -$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMPRD.L 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOML(%3R,C,"PRD",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("PRD"),YEAR,LL) -$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMPRD.M 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOMM(%3R,C,"PRD",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("PRD"),YEAR,LL) -$ BATINCLUDE solsubta.ans CUMITEM4 RPC_CUMFLO(R,P,C,YEAR,LL) VAR_CUMFLO.L 'R.TL' 'P.TL' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMFLOL(%3R,P,C,YEAR,LL)' (%3R,P,C,YEAR,LL) (%3R,P,C,YEAR,LL) -$ BATINCLUDE solsubta.ans CUMITEM4 RPC_CUMFLO(R,P,C,YEAR,LL) VAR_CUMFLO.M 'R.TL' 'P.TL' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMFLOM(%3R,P,C,YEAR,LL)' (%3R,P,C,YEAR,LL) (%3R,P,C,YEAR,LL) - -*--------------------------------------------------------------------- -* Output of various cost components - only non-zero series -*--------------------------------------------------------------------- -$SET SUPZERO YES -*--------------------------------------------------------------------- -* Objective by component -PARAMETER REG_OBJ2(%2REG,ITEM); -REG_OBJ2(%3R,ITEM) $= SUM(RDCUR(R,CUR)$%1REG_WOBJ(%3R,ITEM,CUR),%1REG_WOBJ(%3R,ITEM,CUR)); -REG_OBJ2(%3R,'IRE') = %1REG_IREC(%3R); -$IFI NOT %STAGES%==YES -$ BATINCLUDE solsubta.ans UNCD1 YES OBJZ "' '" "' '" "' '" "' '" "''" "''" 'OBJZ.L' (ANNUAL) (ANNUAL) -$ BATINCLUDE solsubta.ans RXX REG_OBJ2(%3R,ITEM) REG_OBJ 'R.TL' "' '" 'ITEM.TL' "' '" "''" "''" 'REG_OBJ2(%3R,ITEM)' (R,%3ITEM%ITEM2%) (R,%3ITEM%ITEM2%) - -* ATTR R P COM V TS L/M -* Annualized investment costs -OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_INVC; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM((YK(T,V),SYSINV)$%1CST_INVC(%3R,V,T,P,SYSINV),%1CST_INVC(%3R,V,T,P,SYSINV)); -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'INV' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -* Annualized investment taxes/subsidies -OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_INVX; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM((YK(T,V),SYSINV)$%1CST_INVX(%3R,V,T,P,SYSINV),%1CST_INVX(%3R,V,T,P,SYSINV)); -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'INVX' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -* Total salvage value at EOH+1 -OPTION CLEAR=NV_ACTL;NV_ACTL(%3R,TT(MIYR_1),P,ANNUAL) $= SUM((RTP(R,T,P),RDCUR(R,CUR)),%1PAR_OBJSAL(%3R,T,P,CUR)*(1/OBJ_DCEOH(R,CUR))); -$ BATINCLUDE solsubta.ans PUTIT 'RP(R,P)' COST_SALV 'R.TL' 'P.TL' "' '" "' '" "''" "''" NV_ACTL(%3R,T,P,'ANNUAL') (%3R,T,P) (%3R,T(MIYR_1),P) -* Annualized decommissioning costs -OPTION CLEAR=NV_ACTL;NV_ACTL(%3R,T,P,ANNUAL) $= SUM(RTP_CPTYR(R,V,T,P),%1CST_DECC(%3R,V,T,P)); -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'DEC' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -* Annualized fixed costs -OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_FIXC; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM(YK(T,V)$%1CST_FIXC(%3R,V,T,P),%1CST_FIXC(%3R,V,T,P)); -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'FOM' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -* Annualized fixed taxes/subsidies -OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_FIXX; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM(YK(T,V)$%1CST_FIXX(%3R,V,T,P),%1CST_FIXX(%3R,V,T,P)); -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'FIXX' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -* Annualized activity costs -OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_ACTC; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM((YK(T,V),RPM)$%1CST_ACTC(%3R,V,T,P,RPM),%1CST_ACTC(%3R,V,T,P,RPM)); -$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'ACT' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) -* Annualized flow costs -OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1CST_FLOC; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1CST_FLOC(%3R,V,T,P,C),%1CST_FLOC(%3R,V,T,P,C)); -$ BATINCLUDE solsubta.ans PUTI6 'RPC(R,P,C)' COST_ 'R.TL' 'P.TL' C.TL "' '" "''" 'FLO' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) -* Annualized flow taxes/subsidies -OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1CST_FLOX; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1CST_FLOX(%3R,V,T,P,C),%1CST_FLOX(%3R,V,T,P,C)); -$ BATINCLUDE solsubta.ans PUTI6 'RPC(R,P,C)' COST_ 'R.TL' 'P.TL' C.TL "' '" "''" 'FLOX' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) -* Annualized implied trade costs -OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1CST_IREC; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1CST_IREC(%3R,V,T,P,C),%1CST_IREC(%3R,V,T,P,C)); -$ BATINCLUDE solsubta.ans PUTI6 'RPC(R,P,C)' COST_ 'R.TL' 'P.TL' C.TL "' '" "''" 'IRE' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) -* Annualized commodity costs -$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'COM' %1CST_COMC(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) -* Annualized commodity taxes/subsidies -$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'COMX' %1CST_COMX(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) -* Annualized demand elasticity costs -$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'ELS' %1CST_COME(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) -* Annualized commodity costs -$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'DAM' %1CST_DAM(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) - -* MACRO -SET XRT(%2ITEM,U2,T); -$IF %1=='' -$ BATINCLUDE solsubta.ans XRT TM_RESULT(ITEM,R,T) "" 'R.TL' "''" "''" "''" "''" '_' TM_RESULT(ITEM,R,T) (ITEM,R,TT) (ITEM,R,TT(T--ORD(T))) @1,ITEM.TL -$ BATINCLUDE solsubta.ans XRT CM_%1RESULT(%3ITEM,T) CM "''" "''" "''" "''" "''" '_' CM_%1RESULT(%3ITEM,T) (%3ITEM,'',TT) (%3ITEM,'',TT(T--ORD(T))) ITEM.TL -*--------------------------------------------------------------------- -PUTCLOSE sola; diff --git a/source/solsetv.v3 b/source/solsetv.v3 deleted file mode 100644 index cb7b796..0000000 --- a/source/solsetv.v3 +++ /dev/null @@ -1,191 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -*----------------------------------------------------------------------------- -* SOLSETV.VDA -* -* Output routine - creating flat Sets for VEDA -* -*----------------------------------------------------------------------------- -$IF NOT '%1'=='' $GOTO %1 -* Scenario index not supported in current version -$IF NOT %STAGES%==YES SOW('1') = YES; -*----------------------------------------------------------------------------- -* Make sure CLI attributes are defined -$IF %CLI%==YES $GOTO ADESCVDD -$IF %SOLVEDA%==1 PARAMETER CM_SRESULT(ALLSOW,ITEM,ALLYEAR) //; -$IF %SOLVEDA%==1 PARAMETER CM_SMAXC_M(ALLSOW,ITEM,ALLYEAR) //; -*----------------------------------------------------------------------------- -$LABEL ADESCVDD -SET ADESC Attribute Descriptions / - -* variables (and their marginals) -VAR_act 'Process Activity' -VAR_actM 'Process Activity - Marginals' -VAR_cap 'Technology Capacity' -VAR_capM 'Technology Capacity - Marginals' -VAR_ncap 'Technology Investment - New capacity' -VAR_ncapM 'Technology Investment - Marginals' -VAR_ncapR 'Technology Investment - BenCost + ObjRange' -VAR_fin 'Commodity Consumption by Process' -VAR_fout 'Commodity Production by Process' -VAR_Pout 'Commodity Output Level by Process' -VAR_comprd 'Commodity Total Production' -VAR_comprdM 'Commodity Total Production - Marginal' -VAR_comnet 'Commodity Net' -VAR_comnetM 'Commodity Net - Marginal' -VAR_eout 'Electricity supply by technology and energy source' -VAR_CumCst 'Cumulative costs by type (if constrained)' - -* equations (and their marginals) -EQ_combal 'Commodity Slack/Levels' -EQ_combalM 'Commodity Slack/Levels - Marginals' -EQ_peak 'Peaking Constraint Slack' -EQ_peakM 'Peaking Constraint Slack - Marginals' -EQ_Cumflo 'Cumulative flow constraint - Levels' -EQ_CumfloM 'Cumulative flow constraint - Marginals' -EQ_IreM 'Inter-regional trade equations - Marginals' - -* calculated parameters -PAR_capLO 'Capacity Lower Limit' -PAR_capUP 'Capacity Upper Limit' -PAR_Top 'Process topology (Opted out - SET RPT_TOP YES to activate)' -Cap_New 'Newly installed capacity and lumpsum investment by vintage and commissioning period' - -* calculated costs -COST_inv 'Annual investment costs' -COST_dec 'Annual decommissioning costs' -COST_salv 'Salvage values of capacities at EOH+1' -COST_late 'Annual late costs' -COST_fom 'Annual fixed operating and maintenance costs' -COST_act 'Annual activity costs' -COST_flo 'Annual flow costs (including import/export prices)' -COST_com 'Annual commodity costs' -COST_els 'Annual elastic demand cost term' -COST_dam 'Annual damage cost term' -COST_invx 'Annual investment taxes/subsidies' -COST_fixx 'Annual fixed taxes/subsidies' -COST_flox 'Annual flow taxes/subsidies' -COST_comx 'Annual commodity taxes/subsidies' -COST_ire 'Annual implied costs of endogenous trade' -COST_NPV 'Total discounted costs by process/commodity (optional)' -Time_NPV 'Discounted value of time by period' -VAL_Flo 'Annual commodity flow values' -ObjZ 'Total discounted system cost' -Reg_wobj 'Regional total expected discounted system cost' -Reg_obj 'Regional total discounted system cost' -Reg_irec 'Regional total discounted implied trade cost' -Reg_ACost 'Regional total annualized costs by period' -User_Con 'Level of user constraint' -User_ConFXM 'Marginal cost of user constraint (or group-wise market share)' -User_ConLOM 'Marginal cost of lower bound user constraint' -User_ConUPM 'Marginal cost of upper bound user constraint' -User_DynbM 'Marginal cost of dynamic process bound constraint' -User_Maxbet 'Level of MaxBet constraint' - -* Climate module and MACRO -VAR_climate 'Climate result variables' -Dual_Clic 'Shadow price of climate constraint' -VAR_Macro 'MACRO result variables' -/; - -$LABEL REST - -$IF DECLARED IRE $ABORT Illegal Declaration of Internal TIMES Identifier: IRE - Run Aborted -SCALAR IRE "Inter-regional Exchange (Exports & Imports)"; -SCALAR STG "Storage Processes (genuine)"; -SETS - DMD(R,P) 'Demand Devices' - PRE(R,P) 'Energy Processes' - PRW(R,P) 'Material Processes - Weight' - PRV(R,P) 'Material Processes - Volume' - REF(R,P) 'Refineries' - ELE(R,P) 'Electric Power Plants' - CHP(R,P) 'Coupled Heat+Power Plants' - HPL(R,P) 'Heating Plants' - DISTR(R,P) 'Distribution Technologies' - RENEW(R,P) 'Renewables Processes' - XTRACT(R,P)'Extraction Processes' -; -* set the regional memebers of the reporting sets - DMD(RP(R,P)) $= PRC_MAP(R,'DMD',P); - PRE(RP(R,P)) $= PRC_MAP(R,'PRE',P); - PRW(RP(R,P)) $= PRC_MAP(R,'PRW',P); - PRV(RP(R,P)) $= PRC_MAP(R,'PRV',P); - REF(RP(R,P)) $= PRC_MAP(R,'REF',P); - ELE(RP(R,P)) $= PRC_MAP(R,'ELE',P); - CHP(RP(R,P)) $= PRC_MAP(R,'CHP',P); - HPL(RP(R,P)) $= PRC_MAP(R,'HPL',P); - DISTR(RP(R,P)) $= PRC_MAP(R,'DISTR',P); - RENEW(RP(R,P)) $= PRC_MAP(R,'RENEW',P); - XTRACT(RP(R,P))$= PRC_MAP(R,'XTRACT',P); - -SETS - RES(R,COM) 'Residential Sector Demands' - COMM(R,COM) 'Commercial Sector Demands' - TRN(R,COM) 'Transporation Sector Demands' - AGR(REG,COM) 'Agriculature Sector Demands' - OTHD(R,COM) 'Other Demands' - IND(REG,COM) 'Industrial Demands' - NE(REG,COM) 'Non-energy Demands' - NRGFOS(R,C) 'Fossil' - NRGREN(R,C) 'Renewable' - NRGSYN(R,C) 'Synthetic' - NRGELC(ALL_R,C) 'Electricity' - NRGHET(ALL_R,C) 'Heat' -; -* set the regional memebers of the reporting sets - RES(RC(R,C)) $= DEM_SMAP(R,'RES',C); - COMM(RC(R,C)) $= DEM_SMAP(R,'COM',C); - TRN(RC(R,C)) $= DEM_SMAP(R,'TRN',C); - AGR(RC(R,C)) $= DEM_SMAP(R,'AGR',C); - IND(RC(R,C)) $= DEM_SMAP(R,'IND',C); - OTHD(RC(R,C)) $= DEM_SMAP(R,'OTH',C); - NE(RC(R,C)) $= DEM_SMAP(R,'NE',C); - NRGELC(NRG(R,C)) $= NRG_TMAP(R,'ELC',C); - NRGHET(NRG(R,C)) $= NRG_TMAP(R,'LTHEAT',C); - NRGHET(NRG(R,C)) $= NRG_TMAP(R,'HTHEAT',C); - NRGFOS(NRG(R,C)) $= NRG_TMAP(R,'FOSSIL',C); - NRGREN(NRG(R,C)) $= NRG_TMAP(R,'RENEN',C); - NRGREN(NRG(R,C)) $= NRG_TMAP(R,'FRERENEW',C); - NRGREN(NRG(R,C)) $= NRG_TMAP(R,'LIMRENEW',C); - NRGSYN(NRG(R,C)) $= NRG_TMAP(R,'SYNTH',C); - -*GG* set the REGional descriptions if not provided -* Use the RC / RP masks - COM_DESC(RC(R,C))$(NOT COM_DESC(R,C)) = COM_GRP(C); - PRC_DESC(RP(R,P))$(NOT PRC_DESC(R,P)) = PRC(P); - -* timeslices - SET RS(R,ALL_TS); - OPTION RS < RS_TSLVL; -* UCs and completion of missing labels - SETS - NONSET / NONE / - PLUSET / '+' / - OTHCOM(ITEM) // - SET REG_ACT(ITEM,C) - UC_CONST(*,UC_N) 'Genuine TIMES UC constraints' - UC_MARKS(R,ITEM) 'PRC_MARK Share UC constraints' - UC_DYNBD(R,UC_N) 'Dynamic UC bound constraints'; - LOOP(R,UC_CONST('NONE',UC_N)$UC_R_SUM(R,UC_N)=YES); - LOOP(RMKC(R,ITEM,C)$RPT_OPT('COMPRD','4'),UC_MARKS(R,ITEM)=YES); - REG_ACT(ALL_R,%PGPRIM%) = ALL_REG(ALL_R); - REG_ACT(NONSET,%PGPRIM%) = YES; - OTHCOM(CG) $= SUM(COM_PEAK(R,CG),1); - OTHCOM(CUR) $= SUM(RDCUR(R,CUR),1); - -$ EXIT -*--------------------------------------------------------------------- -$ LABEL FINISHUP -* Finally, do some cleanup and set optional TOP indicators - OPTION UC_DYNBD < PRC_DYNUC; -$ BATINCLUDE solsysd.v3 REG_ACOST ! ,T, '' SOW,R S R -$ BATINCLUDE solsysd.v3 REG_WOBJ ! , ,CUR SOW,R S R - OPTION CLEAR=AFS,CLEAR=PAR_OBJSAL,CLEAR=RTPC,CLEAR=RTTC,CLEAR=PAR_TOP; -$IFI %RPT_TOP%==YES SET ADESC / PAR_Top 'Process topology indicator' /; RPT_OPT('FLO','7')=1; - IF(RPT_OPT('FLO','7'), - PAR_TOP(R,T(MIYR_1),P,C,IO)$TOP(R,P,C,IO) = EPS; - PAR_TOP(R,T(MIYR_1),P,C,'OUT')$RPC_IRE(R,P,C,'IMP') = EPS; - PAR_TOP(R,T(MIYR_1),P,C,'IN')$RPC_IRE(R,P,C,'EXP') = EPS; - PAR_TOP(R,T-(ORD(T)-1),P,C,IO)$NCAP_COM(R,T,P,C,IO) = EPS; - ); diff --git a/source/solsubta.ans b/source/solsubta.ans deleted file mode 100644 index 37c0a2a..0000000 --- a/source/solsubta.ans +++ /dev/null @@ -1,51 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -*--------------------------------------------------------------------- -* SOLSUB_TA.ANS -* -* Sub routine for SOLPUTTA.ANS to ouput ANSWER dumps -* %1 - control set -* %2 - qualifier -* %3 - parameter name -* %4 - region -* %5 - process -* %6 - commodity -* %7 - vintage -* %8 - timeslice -* %9 - .Level/.Marginal indicator -* %10 - result values -* %11 - loop indices -* %12 - assigned indices -* - Looping over all rows and filling cells -* -*--------------------------------------------------------------------- -$SET SOW "'1'" -$IFI %STAGES%==YES $SET SOW 'SOW.TL' -*--------------------------------------------------------------------- -*PUT @1, 'ATTRIB', -**** @17, 'SCENARIO', -* @21, 'REG', -* @32, 'PRC', -* @57, 'COM' -* @82, 'VIN' -* @91, 'TS' -* @:1, 'P/D' -OPTION CLEAR=%1; -$IF NOT %SUPZERO%==NO %1%12$%2 $= %10; -$IF %SUPZERO%==NO %1%12$%2 = YES; -LOOP((%1%11), -* print trigger so that only output once - PUT @1, '%3':0, '%9':0, %13 - @17, %SOW%, - @21, %4, - @32, %5, - @57, %6, - @82, %7, - @91, %8, @116 -$IF NOT %9=='' LOOP(T, - PUT (%10):12,' ':0 -$IF NOT %9=='' ) - PUT / ; - ); -OPTION CLEAR=%1; - diff --git a/source/solsysd.v3 b/source/solsysd.v3 deleted file mode 100644 index b0cc423..0000000 --- a/source/solsysd.v3 +++ /dev/null @@ -1,14 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -*----------------------------------------------------------------------------- -* SOLSYSD.V3 - define system label mappings -*----------------------------------------------------------------------------- -$SETARGS P1 P2 P3 P4 * -$SHIFT SHIFT EOLCOM %P2% GOTO %1 -$LABEL SYSUC SHIFT - SET %P1% / %P3%%1 %1 /,%P1%MAP(%P1%,*) / %P3%%1.%1 /; -$IF NOT '%2'=='' $GOTO %P1% -$EXIT -$LABEL %P1% SHIFT SHIFT -$IF DEFINED %2%P1% %2%P1%(%1%P3%SYSUC%P4%)$=SUM(SYSUCMAP(SYSUC,U2),%2%P1%(%1%P3%U2%P4%));;%2%P1%(%1%P3%U2%P4%)$(NOT SYSUC(U2))=0; -$IF NOT '%3'=='' $GOTO %P1% diff --git a/source/solvcoef.msa b/source/solvcoef.msa deleted file mode 100644 index dfb9686..0000000 --- a/source/solvcoef.msa +++ /dev/null @@ -1,91 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================* -* SOLVCOEF.MSA oversees extended preprocessing activities for MSA -*============================================================================* - -*============================================================================* -* Initialize the economic parameters * -*============================================================================* - TM_AEEIV(R,TP,C)$DEM(R,C) = TM_DDF(R,TP,C) / 100; - TM_ASRV(R) = 1 - TM_DEPR(R) / 100; - TM_DFACTCURR(R,XTP) = 1 - (TM_KPVS(R) / TM_KGDP(R) - TM_DEPR(R)/100 - TM_GROWV(R,XTP)/100); - TM_RHO(R) = 1 - 1 / TM_ESUB(R); - TM_TSRV(R,TP) = TM_ASRV(R) ** NYPER(TP); - -*============================================================================* -* Calculate the initial values for the economic variables for the first time period -* - Capital Stock -* - Investment during time period 0 -* - Consumption during time period 0 -* - GDP (Consumption + Investment) + Energy Costs - - TM_K0(R) = TM_KGDP(R) * TM_GDP0(R); - TM_IV0(R) = TM_K0(R) * (TM_DEPR(R) + SUM(TB, TM_GROWV(R,TB))) / 100; - TM_C0(R) = TM_GDP0(R) - TM_IV0(R); - TM_Y0(R) = TM_GDP0(R) + TM_EC0(R) + SUM(TB,TM_AMP(R,TB)); - -*============================================================================* -* Calculate intermediate values * -*============================================================================* - TM_AEEIFAC(R,TB,DM) = 1; - TM_DFACT(R,TB) = 1; - TM_L(R,TB) = 1; - - LOOP(PP(T+1), - TM_AEEIFAC(R,PP,DM) = TM_AEEIFAC(R,T,DM) * (1 - TM_AEEIV(R,PP,DM)) ** NYPER(T); - TM_DFACT(R,PP) = TM_DFACT(R,T) * TM_DFACTCURR(R,T) ** NYPER(T); - TM_L(R,PP) = TM_L(R,T) * (1 + TM_GROWV(R,T) / 100) ** NYPER(T); - ); - OPTION TM_UDF < TM_DFACT; - -* Arbitrary multiplier on utility in last time period. - TM_DFACT(MR(R),TLAST)$(TM_ARBM NE 1) = TM_DFACT(R,TLAST) * - (1-MIN(.999,TM_DFACTCURR(R,TLAST))**(NYPER(TLAST)*TM_ARBM)) / - (1-MIN(.999,TM_DFACTCURR(R,TLAST))**(NYPER(TLAST) * 1 )); -* Weights for periods (use only if requested by TM_ARBM=1) - TM_PWT(T) = 1; IF(TM_ARBM=1, Z=MAX(1,SMAX(T,D(T))); TM_PWT(T) = D(T)/Z); - - TM_D0(MR(R),DM) = SUM(TB,TM_DEM(R,TB,DM))*TM_SCALE_NRG; - - TM_B(MR(R),DM) = TM_D0(R,DM) / TM_Y0(R); - TM_B(MR(R),DM) = TM_B(R,DM) ** (1 - TM_RHO(R)); - TM_B(MR(R),DM) = TM_SCALE_CST / TM_SCALE_NRG * TM_DDATPREF(R,DM) * TM_B(R,DM); - - TM_AKL(MR(R)) = TM_Y0(R) ** TM_RHO(R) - SUM(DEM(R,C), TM_B(R,C) * (TM_D0(R,C) ** TM_RHO(R))); - TM_AKL(MR(R)) = TM_AKL(R) / (TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R))); - - TM_YCHECK(MR(R)) = TM_AKL(R) * TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R)) + SUM(DEM(R,C),TM_B(R,C)*(TM_D0(R,C)**TM_RHO(R))); - TM_YCHECK(MR(R)) = TM_YCHECK(R) ** (1 / TM_RHO(R)); - -display TM_b,TM_akl,TM_ycheck; - -*----------------------------------------------------------------- -* Variable bounds - - VAR_D.LO(MRTC(R,PP,DM)) = TM_DMTOL(R) * TM_D0(R,DM); - VAR_D.L(MRTC(R,PP,DM)) = TM_D0(R,DM); - VAR_D.FX(MR(R),TB,DM) = TM_D0(R,DM); - VAR_D.FX(MR(R),T,DM)$(TM_DEM(R,T,DM) LE 0) = 0; - VAR_DEM.FX(MR(R),T,C)$((TM_DDATPREF(R,C) LE 0)$DEM(R,C)) = TM_DEM(R,T,C); - VAR_DEM.FX(MR(R),T,C)$NO_RT(R,T) = TM_DEM(R,T,C); - - LOOP(MR(R), Z=TM_K0(R)*TM_DEPR(R)/100; LOOP(PP(T+1), Z=Z*TM_TSRV(R,T); VAR_INV.LO(R,PP) = Z)); - VAR_INV.FX(MR(R),T)$NO_RT(R,T) = PAR_IV(R,T); - - VAR_INV.L(MR,PP) = TM_IV0(MR) * TM_L(MR,PP); - VAR_INV.FX(MR,TB) = TM_IV0(MR); - VAR_K.L(MR,TP) = TM_K0(MR) * TM_L(MR,TP); - VAR_K.LO(MR,TP) = TM_K0(MR) * 0.5; - VAR_K.FX(MR,TB) = TM_K0(MR); - - VAR_C.L(MR,TP) = TM_GDP0(MR) - TM_IV0(MR); - VAR_C.LO(MR,TP) = TM_GDP0(MR) * 0.1; - VAR_Y.L(MR,TP) = TM_Y0(MR); - VAR_Y.LO(MR,TP) = TM_GDP0(MR) * 0.5; - VAR_SP.FX(MR,TP,DM) = 0; - - VAR_EC.LO(MR,PP) = TM_ANNC(MR,PP) * 0.1; - VAR_EC.FX(MR,TB) = TM_EC0(MR) + TM_AMP(MR,TB); diff --git a/source/solve.mod b/source/solve.mod deleted file mode 100644 index a1697da..0000000 --- a/source/solve.mod +++ /dev/null @@ -1,47 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* SOLVE.MOD solver and solve controls -*=============================================================================* -*GaG Questions/Comments: -*----------------------------------------------------------------------------- -*$ONLISTING -* Release some memory -$ BATINCLUDE pp_clean.mod -* get the optimizer directive file -%MODEL_NAME%.OPTFILE = OPTFILEID; -%MODEL_NAME%.PRIOROPT=(OPTFILEID=2); -* set the model solver status -%MODEL_NAME%.MODELSTAT = 0; -%MODEL_NAME%.TOLPROJ= 1e-8; - -* MACRO: Loading solution from GDX file replaced by activating the SPOINT utility - -$ IF '%SOLVE_NOW%'==NO $GOTO NO_SOLVE -* solve TIMES with appropriate METHOD -$ IF NOT SET MIXLP $SETLOCAL MIXLP '' -$ IF NOT SET NONLP $SETLOCAL NONLP '' -* if ETL or DSC with binary variables use MIP -$ IF '%DAMAGE%'==NLP $SETLOCAL NONLP NL -$ IF '%MICRO%'==YES $SETLOCAL NONLP NL -$ IF '%MACRO%'==YES $SETLOCAL NONLP NL -$ IF '%ETL%' == YES $SETLOCAL MIXLP MI -$ IF '%SOLMIP%'==YES $SETLOCAL MIXLP MI -$ SETLOCAL METHOD '%MIXLP%%NONLP%P' -$ IF %METHOD% == P $SETLOCAL METHOD LP -$ IFI '%MACRO%'==YES SOLVE %MODEL_NAME% MAXIMIZING VAR_UTIL USING %METHOD%; -$ IFI '%MACRO%'==YES $GOTO CHECK -* solve TIMES as an LP/MIP -SOLVE %MODEL_NAME% MINIMIZING objZ USING %METHOD%; - -$LABEL CHECK -* do an check on solution errors -$ BATINCLUDE err_stat.mod SOLVE '*** ERRORS DURING SOLUTION ***' - -* hook for GAMS-CGI WWW output -$ IF %GAMS_CGI% == WWW $BATINCLUDE www_out.cgi - -$LABEL NO_SOLVE -*$OFFLISTING diff --git a/source/solve.msa b/source/solve.msa deleted file mode 100644 index c4f9ac3..0000000 --- a/source/solve.msa +++ /dev/null @@ -1,178 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Solve.MSA is the wrapper for solving the soft-linked standalone MACRO -* %1 - mod or v# for the source code to be used -*=============================================================================* - -$IF %MSA%==CSA TM_YCHECK(R) = TM_IVETOL(R); TM_IVETOL(R)=MAX(1,TM_IVETOL(R)); - -* Abort execution if execute errors - ABORT$EXECERROR '*** ERRORS IN EXECUTION ***' - - OPTION SOLPRINT = OFF; - OPTION SOLVELINK = 1; - OPTION DECIMALS = 5; - - MODEL MCE / EQ_UTIL, EQ_CONSO, EQ_PROD_Y, EQ_MCAP, EQ_TMC, EQ_DD, EQ_IVECBND, EQ_ESCOST, EQ_TRDBAL -$IF DEFINED TM_CATT EQ_CCDM, EQ_CLITOT, EQ_CLICONC, EQ_CLITEMP, EQ_CLIBEOH - /; - MCE.MODELSTAT=0; MCE.SOLVESTAT=0; MCE.OPTFILE=1; - - SET LOOPS / NWT, DDF, GDP /; - PARAMETER GDPLOSS(MITER,REG,tp) 'GDP losses in percent'; - PARAMETER MSA_ERR(MITER,NITER,LOOPS,REG); - PARAMETER TM_TOL(ITEM) / CAL 7E-7, MST 1E-5, BND 0.5, TIG 0.6, DEM 0, EQUIL 1 /; - SCALAR ERRDEM / 0 /, ERRGDP / 0 /, TM_CAL / 1 /, DOITER/ 1 /; - TM_GDP(MR(R),T) = TM_GDPGOAL(R,T); - PAR_Y(R,T) = TM_GDPGOAL(R,T); - TM_NWT(MR) = 1; -*-------------------------------------------------------- -$IFI %MSA%==MSA $GOTO POLICY -*-------------------------------------------------------- - TM_GROWV(R,T) = TM_GR(R,T); - PAR_GRGDP(R,T) = TM_GR(R,T); - PAR_MC(R,T,DM)$TM_DEM(R,T,DM) = TM_DMC(R,T,DM); - - DOITER=1; - OPTION SOLVEOPT=MERGE,LIMROW=0,BRATIO=0.25; - - LOOP(NITER$DOITER, - -$ INCLUDE ddfupd.msa - - IF(ORD(NITER)<5, - LOOP(MREG, MR(R)= NO; MR(R(MREG))=YES; - SOLVE MCE MAXIMIZING VAR_UTIL USING NLP); MR(R(MREG))=YES; - ELSE SOLVE MCE MAXIMIZING VAR_UTIL USING NLP); - - TM_GDP(R,T) = VAR_C.L(R,T) + VAR_INV.L(R,T); - PAR_GRGDP(MR(R),TP(T-1)) = 100 * ((TM_GDP(R,T)/TM_GDP(R,TP))**(1/NYPER(TP))-1); - PAR_Y(R,T) = VAR_Y.L(R,T); - PAR_MC(MR(R),PP(T),C)$TM_DEM(R,T,C) = MAX(ABS(VAR_SP.M(R,T,C)*TM_SCALE_NRG),ABS(EQ_DD.M(R,T,C))) / MAX(EQ_ESCOST.M(R,T),-VAR_EC.M(R,T)) / TM_SCALE_CST; - - MSA_ERR('1',NITER,'DDF',MR(R)) = SMAX((T,C)$TM_DEM(R,T,C),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); - MSA_ERR('1',NITER,'GDP',MR(R)) = SMAX(T,ABS(TM_GDPGOAL(R,T)-TM_GDP(R,T))/TM_GDPGOAL(R,T)); - ERRDEM = SMAX(MR, MSA_ERR('1',NITER,'DDF',MR)); - ERRGDP = SMAX(MR, MSA_ERR('1',NITER,'GDP',MR)); - IF(MAX(ERRDEM,ERRGDP) < TM_TOL('CAL')*ORD(NITER), DOITER=0); - ); - - DISPLAY MSA_ERR; - TM_DDF_DM(MR,TP,DM)$TM_DEM(MR,TP,DM)=(1-VAR_DEM.L(MR,TP,DM)/TM_DEM(MR,TP,DM))*100; - OPTION TM_DD < TM_DDF_DM; - DISPLAY 'estimated to assumed demand difference in percent', TM_dd; - TM_TOL('DEM') = ERRDEM; - TM_TOL('GDP') = ERRGDP; - -$IFI NOT %OBJANN%==YES $GOTO NEGISHI -*----------------------------------------------------------------- -* Update discounting factors - TM_CAL = 2; - LOOP(PP(T-1),OBJ_PVT(MR(R),T,CUR) = OBJ_PVT(R,PP,CUR)*EQ_ESCOST.M(R,T)/EQ_ESCOST.M(R,PP)); - COEF_PVT(MR(R),T) = SUM(G_RCUR(R,CUR),OBJ_PVT(R,T,CUR)); - OPTION SOLVEOPT=REPLACE,LIMROW=0,BRATIO=1; - SOLVE %MODEL_NAME% MINIMIZING objZ USING LP; -$ batinclude solprep.msa -$ GOTO NEGISHI - -*----------------------------------------------------------------- -$LABEL POLICY -*----------------------------------------------------------------- -* Get initial solution - TM_CAL=0; - OPTION SOLVEOPT=MERGE; - LOOP(MREG, MR(R)= NO; MR(R(MREG))=YES; SOLVE MCE MAXIMIZING VAR_UTIL USING NLP); - MR(R(MREG))=YES; - -$LABEL NEGISHI -* Prepare Negishi iterations - -* Calculate initial Negishi weights as in MERGE, e.g. based on the regional GDP - TM_NWT(MR(R)) = SUM(TP, TM_GDPGOAL(R,TP)*TM_DFACT(R,TP)); - Z = SUM(MR(R),TM_NWT(R)); - TM_NWT(MR(R)) = TM_NWT(R) / Z; - OPTION CLEAR=MSA_ERR; - -* Relax trades - VAR_NTX.UP(MR,PP,TRD) = INF; - VAR_NTX.LO(MR,PP,TRD) = -INF; - RT_PP(R,T)$(NOT NO_RT(R,T)) = YES; - DOITER=1; ERRDEM=0.8; - - LOOP(MITER$DOITER, -* Heuristic tightening of demand bounds - TM_TOL('BND')=MIN(TM_TOL('BND'),ERRDEM); - IF(NOT TM_CAL, - VAR_DEM.LO(RT_PP(MR(R),T),C)$((TM_DDATPREF(R,C)>0)$TM_DEM(R,T,C)) = TM_DEM(R,T,C)*(1-TM_TOL('BND')*TM_TOL('TIG')); - VAR_DEM.UP(RT_PP(MR(R),T),C)$((TM_DDATPREF(R,C)>0)$TM_DEM(R,T,C)) = TM_DEM(R,T,C)*(1+TM_TOL('BND')*TM_TOL('TIG')); - ); - LOOP(NITER$DOITER, - - OPTION BRATIO=0.25,SOLVEOPT=REPLACE; - SOLVE MCE MAXIMIZING VAR_UTIL USING NLP; - -*-- Calculate Macro parameters - EQ_TRDBAL.M(PP,TRD) = EQ_TRDBAL.M(PP,"NMR"); - VAR_NTX.L(MR,PP,TRD('IRE')) = -REG_ACOST(MR,PP,TRD)*TM_SCALE_CST; - TM_GDP(MR(R),PP) = VAR_C.L(R,PP)+VAR_INV.L(R,PP) + SUM(TRD, ABS(EQ_TRDBAL.M(PP,TRD)/EQ_TRDBAL.M(PP,"NMR"))*VAR_NTX.L(R,PP,TRD)); - PAR_GRGDP(MR(R),tp(T-1)) = 100 * ((TM_GDP(R,T)/TM_GDP(R,TP))**(1/NYPER(TP))-1); - PAR_Y(R,T) = VAR_Y.L(R,T); - PAR_MC(MR(R),PP(T),C)$TM_DEM(R,T,C) = MAX(ABS(VAR_SP.M(R,T,C)*TM_SCALE_NRG),ABS(EQ_DD.M(R,T,C))) / MAX(EQ_ESCOST.M(R,T),-VAR_EC.M(R,T)) / TM_SCALE_CST; - MSA_ERR(MITER,NITER,'DDF',MR(R)) = SMAX((T,C)$TM_DEM(R,T,C),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); - MSA_ERR(MITER,NITER,'GDP',MR(R)) = SMAX(T,ABS(TM_GDPGOAL(R,T)-TM_GDP(R,T))/TM_GDPGOAL(R,T)); - ERRDEM = SMAX(MR, MSA_ERR(MITER,NITER,'DDF',MR)); DISPLAY ERRDEM; - ERRGDP = SMAX(MR, MSA_ERR(MITER,NITER,'GDP',MR)); - DFUNC = ((ERRGDP>1.5*TM_TOL('GDP'))+(ERRDEM>1.5*TM_TOL('DEM')))*(MAX(ERRDEM,ERRGDP)>TM_TOL('MST'))$TM_CAL; - -*-- Calculate deflators and new Negishi weights - LOOP(TB(T-1), TM_PVPI(TRD,PP) = ABS(EQ_TRDBAL.M(PP,TRD)/EQ_TRDBAL.M(T,"NMR"))); - TM_NWT(MR(R)) = SUM(PP,TM_PVPI("NMR",PP)*VAR_C.L(R,PP) + SUM(TRD, TM_PVPI(TRD,PP)*VAR_NTX.L(R,PP,TRD))); - TM_NWT(MR) = TM_NWT(MR) / SUM(REG, TM_NWT(REG)); - TM_NWTIT(NITER,MR) = TM_NWT(MR); - IF(CARD(MR)=1, TM_TOL('EQUIL')=0; - ELSE TM_TOL('EQUIL') = SUM(MR, ABS(TM_NWTIT(NITER-1,MR) - TM_NWT(MR)))); - MSA_ERR(MITER,NITER,'NWT',MR) = TM_TOL('EQUIL'); - IF((TM_CAL=1)$DFUNC, TM_TOL('EQUIL')=1; DFUNC=0); - IF(TM_TOL('EQUIL') LE TM_TOL('MST') OR ORD(NITER)=CARD(NITER), DOITER=0); - - IF(DOITER+DFUNC, -*-- Recalibrate DDF factors -$IFI %MSA%==CSA $INCLUDE ddfupd.msa - )); - - GDPLOSS(MITER,MR,TP)= 100*(TM_GDPGOAL(MR,TP)-TM_GDP(MR,TP))/TM_GDPGOAL(MR,TP); - TM_DDF_DM(MR,TP,DM)$TM_DEM(MR,TP,DM)=(VAR_DEM.L(MR,TP,DM)/TM_DEM(MR,TP,DM)); - OPTION TM_DD < TM_DDF_DM; -* DISPLAY 'Demand ratio VAR_DEM/TM_DEM', TM_dd; - IF(TM_CAL=2, DOITER=DFUNC; ELSEIF NOT TM_CAL, DOITER=ROUND(ERRDEM/CARD(MR),5)>3*TM_TOL('MST')); -$ IF DEFINED TM_CATT $batinclude preppm.msa TOLP - IF(DOITER$(ORD(MITER) < CARD(MITER)), -* Update either demands or PVT factors - IF(NOT TM_CAL,OPTION CLEAR=RCJ; COM_PROJ(MR(R),PP(T),C)$TM_DEM(R,T,C) = COM_PROJ(R,T,C)+VAR_DEM.L(R,T,C)-TM_DEM(R,T,C); - ELSEIF TM_CAL=2,LOOP(PP(T-1),OBJ_PVT(MR(R),T,CUR) = OBJ_PVT(R,PP,CUR)*EQ_ESCOST.M(R,T)/EQ_ESCOST.M(R,PP)); - COEF_PVT(MR(R),T) = SUM(G_RCUR(R,CUR),OBJ_PVT(R,T,CUR)) DISPLAY "UDF updated";); - OPTION BRATIO=1; -$ INCLUDE clearsol.stp - OPTION SOLVEOPT=MERGE; - SOLVE %MODEL_NAME% MINIMIZING objZ USING LP; -$ BATINCLUDE solprep.msa - ); - ); - OPTION MSA_ERR:6:3:1; - DISPLAY MSA_ERR,GDPLOSS,ERRDEM,ERRGDP; - -$SET SOLVEDA 1 -$batinclude rptlite.rpt '' '' '' NO -$IFI %QSF%==YES $batinclude solprep.msa OUT -$IFI NOT %MSA%==CSA $EXIT -*------------------------------------------------------------------ -* Calculate IVETOL for policy run - TM_IVETOL(MR(R)) = MAX(TM_YCHECK(R),SMAX(PP$(TM_L(R,PP)>1),LOG((VAR_INV.L(R,PP)+VAR_EC.L(R,PP))/TM_Y0(R))/LOG(TM_L(R,PP)))+.005); - PAR_IV(MR(R),T) = VAR_INV.L(R,T); - -* Write out final calibrated DDF factors and realized GDP - OPTION CLEAR=TM_UDF; IF(TM_CAL=2,TM_UDF(MR(R),T)=COEF_PVT(R,T); DISPLAY TM_UDF); -$batinclude writeddf.msa MSADDF PAR_GRGDP diff --git a/source/solve.stc b/source/solve.stc deleted file mode 100644 index cc738bb..0000000 --- a/source/solve.stc +++ /dev/null @@ -1,134 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Solve.stc is the wrapper for solving stochastic problems -* %1 - mod or v# for the source code to be used -*=============================================================================* - SCALAR GDL /0/; - PARAMETER WHANDLE(ALLSOW) //; -*------------------------------------------------------------------------------ -$ SET SOLVEDA 1 -$IFI %MCA%==YES %MODEL_NAME%.number=%MCA1%-1; -$IF NOT %STAGES%==YES $BATINCLUDE rptlite.rpt S WW, -$IF %OBMAC%==YES -$IF NOT %gams.gdir%==%gams.scrdir% GDL=%solvelink.AsyncGrid%; -*------------------------------------------------------------------------------ - DOITER = (SUM(SW_T(MIYR_1,WW),1) GT 1) OR SW_PHASE OR (SUM((XPT%SWD%(W)),1)=0); -$IFI %SPINES%==YES DOITER = 0; - IF(DOITER, -*------------------------------------------------------------------------------ -* Set of deterministic runs if several scenarios at stage 1 -*------------------------------------------------------------------------------ -$ IF %STEPPED%==YES Abort "Cannot use Stepped Mode with Sensitivity/Tradeoff Analysis"; - CNT = SUM(SW_T(MIYR_1,SOW),1); - IF(SW_PHASE, GDL=0; - IF(S_UCOBJ('OBJ1','1') GT 0, - SW_PHASE=1; DISPLAY "Phase 1 deterministic scenarios.",CNT; - ELSE SW_PHASE=-1; DISPLAY "Multiphase tradeoff scenarios.",CNT); - ELSE DISPLAY "Decomposed deterministic scenarios!",CNT; - IF(GDL,%MODEL_NAME%.solvelink = GDL)); -* Use MERGE for stochastic, because otherwise bounds for other scenarios get cleared - OPTION SOLVEOPT=MERGE; - ); - LOOP(ALLSOW$(SUM(SW_T(MIYR_1,ALLSOW),1)$DOITER), - CNT = ORD(ALLSOW); DISPLAY CNT; - IF(S_UCOBJ('OBJ1',ALLSOW) EQ 4, -* If no user-defined objective, skip Phase 1 copying previous VAR_UC solution if necessary -$IF NOT %STAGES%==YES LOOP(SOW,SPAR_UCSL(ALLSOW,UC_N,U2,U3,U4) $= SPAR_UCSL(SOW,UC_N,U2,U3,U4)); - ELSE - IF((SW_PHASE EQ -1) AND (ORD(ALLSOW) GT 1), -* Set deviation bounds in multiphase -$IF %STAGES%==YES $BATINCLUDE bnd_ucw.mod '' M - LOOP(SOW, Z = S_UC_RHS('OBJ1','N','1',SOW); - %VAR%_UC.LO(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)-ABS(%VAR%_UC.L(UC_N%SOW%)*Z); - %VAR%_UC.UP(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)+ABS(%VAR%_UC.L(UC_N%SOW%)*Z)); - AUXSOW(ALLSOW) = YES; - ); - LOOP(MIYR_1(T),SOW(WW) = SW_TSW(WW,T,ALLSOW); - SW_NORM = SW_TPROB(T,ALLSOW)); -$IF NOT %STAGES%==YES $BATINCLUDE sensis.stc -$ BATINCLUDE solve.mod - WHANDLE(ALLSOW)=%MODEL_NAME%.handle; -$IF %STAGES%==YES $GOTO ENDPHASE1 - IF(NOT (SW_PARM OR GDL), Z=0; -$ BATINCLUDE rptlite.rpt S WW, ALLSOW, NO -$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.mod -$IF %CLI%==YES $BATINCLUDE rpt_par.cli LOOP(SOW, ); - ELSEIF NOT GDL, -* Save VAR_UC solution - SPAR_UCSL(SOW,UC_N,'','','') $= VAR_UC.L(UC_N); - SPAR_UCSL(SOW,UC_N,R,'','') $= VAR_UCR.L(UC_N,R); - SPAR_UCSL(SOW,UC_N,T,'','') $= VAR_UCT.L(UC_N,T); - SPAR_UCSL(SOW,UC_N,R,T,'') $= VAR_UCRT.L(UC_N,R,T); - SPAR_UCSL(SOW,UC_N,T,S,'') $= VAR_UCTS.L(UC_N,T,S); - SPAR_UCSL(SOW,UC_N,R,T,S) $= VAR_UCRTS.L(UC_N,R,T,S)); -$LABEL ENDPHASE1 - ); - ); -* Reset SOW - IF(DOITER, - SOW(WW)$(ORD(WW) LE SW_DESC('1','1')) = YES; - AUXSOW(WW)$(ORD(WW) GT 1) = NO; - ); -*------------------------------------------------------------------------------ - IF(SW_PARM$SW_PHASE, SW_PHASE = SW_PARM; -$IF %STAGES%==YES $BATINCLUDE bnd_ucw.mod '' I - IF(SW_PARM EQ 2, - DISPLAY "Phase 2 determinstic secnarios."; - LOOP(ALLSOW$(SUM(SW_T(MIYR_1,ALLSOW),1)$(S_UCOBJ('OBJ1',ALLSOW) GT 0)), - CNT = ORD(ALLSOW); DISPLAY CNT; - LOOP(MIYR_1,SOW(WW) = SW_TSW(WW,MIYR_1,ALLSOW)); -$IF NOT %STAGES%==YES $BATINCLUDE sensis.stc -$ BATINCLUDE solve.mod -$IF %STAGES%==YES $GOTO ENDPHASE2 -$ BATINCLUDE rptlite.rpt S WW, ALLSOW, NO -$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.mod -$IF %CLI%==YES $BATINCLUDE rpt_par.cli LOOP(SOW, ); -$LABEL ENDPHASE2 - ); -* Reset SOW for reporting - SOW(WW)$(ORD(WW) LE SW_DESC('1','1')) = YES$(S_UCOBJ('OBJ1',WW) GE 0); - ELSE -* Set deviation bounds for OBJ1 if Single run in Phase 2 - F = UC_RHS('OBJ1','N'); - LOOP(SOW, Z = F; Z $= S_UC_RHS('OBJ1','N','1',SOW); - %VAR%_UC.LO(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)-ABS(%VAR%_UC.L(UC_N%SOW%)*Z); - %VAR%_UC.UP(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)+ABS(%VAR%_UC.L(UC_N%SOW%)*Z)); - AUXSOW(WW) = SOW(WW); SOW(WW) = ORD(WW) EQ 1; - OPTION SOLVEOPT=REPLACE; -$ BATINCLUDE solve.mod - )); - IF(SW_PHASE,SW_PROB(SOW) = EPS); -*------------------------------------------------------------------------------ - IF(NOT DOITER, SW_NORM = 1; -$ BATINCLUDE solve.mod - ); -*------------------------------------------------------------------------------ -$IF NOT %OBMAC%==YES $EXIT -* Load grid solutions if asynchronous - DOITER=2*(%MODEL_NAME%.solvelink=GDL)$GDL; -* Force clear solution if Grid SENSIS Runs - REG_FIXT(R)$GDL=MAX(REG_FIXT(R),1); - IF(NOT DOITER,OPTION CLEAR=WHANDLE); DUR_MAX=TIMEELAPSED; - REPEAT DONE=DOITER; - LOOP(ALLSOW$(SW_PROB(ALLSOW)$DOITER), - OPTION CLEAR=SOW; SOW(ALLSOW) = YES; - F = handlestatus(WHANDLE(ALLSOW)); - IF(F<>%Handlestatus.Running%, - IF(F=%handlestatus.Ready%, - Z=WHANDLE(ALLSOW); %MODEL_NAME%.handle=Z; -$IFI %SENSIS%==YES $BATINCLUDE sensis.stc - execute_loadhandle %MODEL_NAME%; -$IF %STAGES%==YES $GOTO ENDLD -$BATINCLUDE rptlite.rpt S WW, ALLSOW, NO -$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.mod -$IFI %CLI%==YES $BATINCLUDE rpt_par.cli LOOP(SOW, ); -$IFI %MCA%==YES $BATINCLUDE main_ext.mod rpt_ext MCA -$LABEL ENDLD - F=1; DUR_MAX=TIMEELAPSED; DONE=0); - IF(F, F=handledelete(WHANDLE(ALLSOW))); - WHANDLE(SOW)=0)); - F=sleep(DONE+card(WHANDLE)*0.3); - UNTIL(CARD(WHANDLE)=0 OR TIMEELAPSED-DUR_MAX>10000); diff --git a/source/solve.stp b/source/solve.stp deleted file mode 100644 index 86dd913..0000000 --- a/source/solve.stp +++ /dev/null @@ -1,338 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* SOLVE.stp is the code for handling stepped solution of TIMES -* %1 - mod -*=============================================================================* -$SET STEPPED YES -$IFI NOT %SPINES%==YES -$IFI %STAGES%==YES $SET STEPPED NO -$IF %STEPPED%==NO -$IF SET TIMESTEP $ABORT Stepped TIMES Not available with STAGES/SENSIS! -$IF NOT %VAR_UC%==YES $ABORT Invalid VAR_UC setting for stepped mode. -$IF NOT %RPOINT%==NO $SET SOLVE_NOW NO -$IF NOT SET TIMESTEP $SET TIMESTEP '999' SET STEPPED NO -*----------------------------------------------------------------------------- - SCALAR PRESOL / 1 /; - SET UC_RN(UC_N,ALL_R) //; - SET R_UCT(R,UC_N,T) //; - SET RTP_IRE(R,T,P,IE) 'IRE equations with fixed regions'; - SET IRE_RPR(R,P,R,IE) 'All regions REG linked to IRE process by equations in R'; - SET IRE_FXT(R,T,P) 'IRE with some linked regions fixed at T'; - PARAMETER STP_UCT(J,ALL_R,UCN,LL); - PARAMETER STP_DIV(J,R,T,P) //; - PARAMETER UC_BND(J,ALL_R,UCN,LL,S,L); - PARAMETER PAR_CUMFLOM(R,P,C,LL,LL), PAR_UCR(UC_N,ALL_R); -*----------------------------------------------------------------------------- -$ IF NOT SET FIXBOH $GOTO MCOPIED -* Copy previous marginals to preseve freezed results -$ IF NOT %STAGES%==YES $GOTO MCOPIED - %EQ%G_COMBAL.M(RTC,S%SWT%) $= EQG_COMBAL.M(RTC,S); - %EQ%E_COMBAL.M(RTC,S%SWT%) $= EQE_COMBAL.M(RTC,S); - %EQ%_PEAK.M(RTC,S%SWT%) $= EQ_PEAK.M(RTC,S); -$ LABEL MCOPIED -$ SETLOCAL SW1 '' SETLOCAL SW2 -$ IFI %STAGES%==YES $SETLOCAL SW2 ",'1',SOW" SETLOCAL SW1 S_ -$ IFI %SPINES%==YES $BATINCLUDE clearsol.stc DEF -*----------------------------------------------------------------------------- -* Establish partitioning of T into fixed, current, and pending -* BACKWARD(T) = fixed T -* SUBT(T) = current T -* FORWARD(T) = pending T - YR_V1 = 0; YR_VL = %TIMESTEP%; MY_FYEAR = 0; REG_FIXT(R)$NO = 0; - IF(G_OVERLAP, G_OVERLAP = MAX(EPS,G_OVERLAP); ELSE G_OVERLAP = FLOOR(YR_VL/2)); -$ IF SET FIXBOH YR_V1 = ABS(%FIXBOH%); REG_FIXT(R)$(NOT REG_FIXT(R)) = YR_V1; -$ IF '%RTPX%'==X MY_FYEAR = 1; - F = SUM(MIYR_1(T),M(T)); - REG_FIXT(R)$(REG_FIXT(R) < F) = 0; - YR_V1 = SMIN((R,T)$(M(T) > REG_FIXT(R)),M(T)); - Z = YR_V1 + YR_VL; - SUBT(T)$(M(T) < YR_V1) = NO; - SUBT(T)$(M(T) GE Z) = NO; - OPTION CLEAR=BACKWARD, CLEAR=FORWARD, RTC_NET REG_FIXT(R)); - NO_RT(R,T) = NOT RT_PP(R,T); -*----------------------------------------------------------------------------- -* Clear previous solution for projection years & ensure VAR_ACT loadpoint -$ INCLUDE clearsol.stp - VAR_ACT.M(RVT,P,S)=0; - IF(VAR_UC.L('%SYSPREFIX%SOLVE_STATUS')=0, OPTION TRACKP 1, - STP_DIV('1',R,T,P) $= OBJ_DIVI(R,T,P); - STP_DIV('2',R,T,P) $= OBJ_DIVIV(R,T,P); - STP_DIV('3',R,T,P) $= OBJ_DIVIII(R,T,P)); -*----------------------------------------------------------------------------- -$IF %STEPPED%==YES WHILE(CARD(SUBT), -*----------------------------------------------------------------------------- - BACKWARD(T) = (M(T) < YR_V1); - FORWARD(SUBT) = NO; - NO_RT(R,T(BACKWARD)) = 1; - RT_PP(R,T) = SUBT(T)$(NOT NO_RT(R,T)); - V(FORWARD) = NO; -* Re-define End-of-Horizon - IF(CARD(SUBT), MIYR_VL = SMAX(SUBT(T),E(T))); - OPTION CLEAR=Y_EOH, CLEAR=MIYR_L; - Y_EOH(EOHYEARS)$((YEARVAL(EOHYEARS) <= MIYR_VL)$(YEARVAL(EOHYEARS) >= MINYR)) = YES; - LOOP(MIYR_1(YEAR), Z=MIYR_VL-YEARVAL(YEAR); MIYR_L(YEAR+Z) = YES); -*----------------------------------------------------------------------------- -* Complete adjusted model -* Adjust divisor data when appropriate -$IF NOT '%CTST%'=='' $BATINCLUDE coef_alt.lin STP -* We must recompute OBJ_LIFE and salvage values - OBJ_LIFE(K(LL),R,JOT,LIFE,CUR)$OBJ_LIFE(K,R,JOT,LIFE,CUR) = SUM((OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))),OBJ_DISC(R,Y_EOH,CUR))+EPS; -$IF %STEPPED%==YES $BATINCLUDE eqobsalv.%1 STP EXIT - RVPRL(R,K,P)$RVPRL(R,K,P)=MAX(1,SMAX(RTP_CPTYR(R,VNT(K,V(T)),P),YEARVAL(V))-YEARVAL(K)); -*----------------------------------------------------------------------------- -* Handle Dynamic constraints and Multi-regional UC relaxation -* Remove UC_T_SUM if it does not overlap with SUBT - OPTION CLEAR=RXX,CLEAR=UNCD1; - RXX(UC_R_EACH(R,UC_N),R)$SUM(UC_T_SUM(R,UC_N,T)$RT_PP(R,T),YES) = YES; - UNCD1(UC_N)$SUM(UC_T_SUM(UC_R_SUM(R,UC_N),T)$RT_PP(R,T),YES) = YES; - UC_T_SUM(R,UC_N,T)$FORWARD(T) = NO; - UC_T_SUM(R,UC_N,T)$((NOT UNCD1(UC_N))$(NOT RXX(R,UC_N,R))) = NO; - IF(PRESOL, VAR_UC.L(UC_N(UNCD1)) = 0; VAR_UCR.L(UC_N,R)$RXX(R,UC_N,R) = 0); -* Remove UC_T_EACH for all but SUBT -* Remove UC_T_SUCC until not completely fixed or if even partly pending - OPTION CLEAR=UC_T; - LOOP(UC_T_EACH(UC_R_SUM(R,UC_N),T)$RT_PP(R,T), UC_T(UC_N,T) = YES); - LOOP(UC_T_SUCC(UC_R_SUM(R,UC_N),T)$RT_PP(R,T), UC_T(UC_N,T) = YES); - UC_T_EACH(UC_R_SUM(R,UC_N),T)$(NOT UC_T(UC_N,T)) = NO; - UC_T_SUCC(UC_R_SUM(R,UC_N),T)$(UC_DYNDIR(R,UC_N,'RHS')$(NOT UC_T(UC_N,T))) = NO; - UC_T_EACH(UC_R_EACH(R,UC_N),T)$(NOT RT_PP(R,T)) = NO; - UC_T_SUCC(UC_R_EACH(R,UC_N),T)$(UC_DYNDIR(R,UC_N,'RHS')$(NOT RT_PP(R,T))) = NO; - UC_T_SUCC(UC_T_SUCC(R,UC_N,T-1)) = UC_DYNDIR(R,UC_N,'RHS')+RT_PP(R,T); - UC_T(UC_N,T)$(NOT SUM(R$NO_RT(R,T),1)) = NO; -$ IFI %CLI%==YES LOOP(T$(NOT SUM(R,NOT NO_RT(R,T))),CM_MAXC(LL,CG)$SUPERYR(T,LL) = 0); - - LOOP(BD,UC_T_SUCC(R,UC_N,T)$UC_DYNBND(UC_N,BD) = RT_PP(R,T)); -* RHS and Bounds Relaxation -$ SETLOCAL TOLR '3E-6' SETLOCAL TOLA '1E-4' SETLOCAL TOLX '1E-5' -$IF DEFINED XTP $SETLOCAL TOLR '2E-8' SETLOCAL TOLA 1E-6 - IF(CARD(BACKWARD) OR MY_FYEAR, OPTION CLEAR=UC_BND,CLEAR=R_UCT; - R_UCT(R_UC(R,UC_N),T)$(UC_T_EACH(R,UC_N,T)+UC_T_SUCC(R,UC_N,T)) = YES; - LOOP(UC_R_SUM(R_UC(R,UC_N)),UC_T(UC_N,T)$R_UCT(R,UC_N,T) = YES); - R_UCT(R,UC_N,T)$(NOT REG_FIXT(R)) = NO; -* Set into UC_BND the RHS corrected by actual slack level, if RHS already violated - UC_BND('1','IMPEXP',UC_N,'0','ANNUAL','UP')$UC_RHS(UC_N,'UP') = MAX(UC_RHS(UC_N,'UP'),VAR_UC.L(UC_N)-INF$(NOT VAR_UC.L(UC_N))); - UC_BND('2',R,UC_N,'0','ANNUAL','UP')$UC_RHSR(R,UC_N,'UP') = MAX(UC_RHSR(R,UC_N,'UP'),VAR_UCR.L(UC_N,R)-INF$(NOT VAR_UCR.L(UC_N,R))); - UC_BND('3','IMPEXP',UC_N,T,'ANNUAL','UP')$UC_RHST(UC_N,T,'UP') = MAX(UC_RHST(UC_N,T,'UP'),VAR_UCT.L(UC_N,T)-INF$(NOT VAR_UCT.L(UC_N,T))); - UC_BND('4','IMPEXP',UC_N,T,S,'UP')$UC_RHSTS(UC_N,T,S,'UP') = MAX(UC_RHSTS(UC_N,T,S,'UP'),VAR_UCTS.L(UC_N,T,S)-INF$(NOT VAR_UCTS.L(UC_N,T,S))); - UC_BND('5',R,UC_N,T,'ANNUAL','UP')$UC_RHSRT(R,UC_N,T,'UP') = MAX(UC_RHSRT(R,UC_N,T,'UP'),VAR_UCRT.L(UC_N,R,T)-INF$(NOT VAR_UCRT.L(UC_N,R,T))); - UC_BND('6',R,UC_N,T,S,'UP')$UC_RHSRTS(R,UC_N,T,S,'UP') = MAX(UC_RHSRTS(R,UC_N,T,S,'UP'),VAR_UCRTS.L(UC_N,R,T,S)-INF$(NOT VAR_UCRTS.L(UC_N,R,T,S))); - UC_BND('1','IMPEXP',UC_N,'0','ANNUAL','LO')$UC_RHS(UC_N,'LO') = MIN(UC_RHS(UC_N,'LO'),VAR_UC.L(UC_N)+INF$(NOT VAR_UC.L(UC_N))); - UC_BND('2',R,UC_N,'0','ANNUAL','LO')$UC_RHSR(R,UC_N,'LO') = MIN(UC_RHSR(R,UC_N,'LO'),VAR_UCR.L(UC_N,R)+INF$(NOT VAR_UCR.L(UC_N,R))); - UC_BND('3','IMPEXP',UC_N,T,'ANNUAL','LO')$UC_RHST(UC_N,T,'LO') = MIN(UC_RHST(UC_N,T,'LO'),VAR_UCT.L(UC_N,T)+INF$(NOT VAR_UCT.L(UC_N,T))); - UC_BND('4','IMPEXP',UC_N,T,S,'LO')$UC_RHSTS(UC_N,T,S,'LO') = MIN(UC_RHSTS(UC_N,T,S,'LO'),VAR_UCTS.L(UC_N,T,S)+INF$(NOT VAR_UCTS.L(UC_N,T,S))); - UC_BND('5',R,UC_N,T,'ANNUAL','LO')$UC_RHSRT(R,UC_N,T,'LO') = MIN(UC_RHSRT(R,UC_N,T,'LO'),VAR_UCRT.L(UC_N,R,T)+INF$(NOT VAR_UCRT.L(UC_N,R,T))); - UC_BND('6',R,UC_N,T,S,'LO')$UC_RHSRTS(R,UC_N,T,S,'LO') = MIN(UC_RHSRTS(R,UC_N,T,S,'LO'),VAR_UCRTS.L(UC_N,R,T,S)+INF$(NOT VAR_UCRTS.L(UC_N,R,T,S))); -* Add relaxation tolerances; absolute only if both positive+negative coefficients - UC_BND(J,ALL_R,UC_N,LL,S,'UP')$UC_BND(J,ALL_R,UC_N,LL,S,'UP') = UC_BND(J,ALL_R,UC_N,LL,S,'UP')+ABS(UC_BND(J,ALL_R,UC_N,LL,S,'UP'))*%TOLR%+%TOLA%$UC_RN(UC_N,ALL_R); - UC_BND(J,ALL_R,UC_N,LL,S,'LO')$UC_BND(J,ALL_R,UC_N,LL,S,'LO') = UC_BND(J,ALL_R,UC_N,LL,S,'LO')-ABS(UC_BND(J,ALL_R,UC_N,LL,S,'LO'))*%TOLR%-%TOLA%$UC_RN(UC_N,ALL_R); -* Copy back to RHS (VAR bounds would be cleared in sensitivity analysis) - UC_RHS(UC_N,BDNEQ(BD)) $= UC_BND('1','IMPEXP',UC_N,'0','ANNUAL',BD); - UC_RHSR(R,UC_N,BDNEQ(BD))$REG_FIXT(R) $= UC_BND('2',R,UC_N,'0','ANNUAL',BD); - UC_RHST(UC_T(UC_N,T),BDNEQ(BD)) $= UC_BND('3','IMPEXP',UC_N,T,'ANNUAL',BD); - UC_RHSTS(UC_T(UC_N,T),S,BDNEQ(BD)) $= UC_BND('4','IMPEXP',UC_N,T,S,BD); - UC_RHSRT(R_UCT(R,UC_N,T),BDNEQ(BD)) $= UC_BND('5',R,UC_N,T,'ANNUAL',BD); - UC_RHSRTS(R_UCT(R,UC_N,T),S,BDNEQ(BD)) $= UC_BND('6',R,UC_N,T,S,BD); -* Handle other important dynamic constraints - LOOP((R,T,SAMEAS(T+1,TT))$NO_RT(R,T), - PRC_DYNUC(UC_N,'LHS',RTP(R,TT,P),UC_GRPTYPE,'UP')$PRC_DYNUC(UC_N,'RHS',R,'0',P,UC_GRPTYPE,'UP') = PRC_DYNUC(UC_N,'LHS',R,TT,P,UC_GRPTYPE,'UP')*(1+%TOLR%); - PRC_DYNUC(UC_N,'LHS',RTP(R,TT,P),UC_GRPTYPE,'LO')$PRC_DYNUC(UC_N,'RHS',R,'0',P,UC_GRPTYPE,'LO') = PRC_DYNUC(UC_N,'LHS',R,TT,P,UC_GRPTYPE,'LO')*(1-%TOLX%)); - %SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%)$(REG_FIXT(R)$%SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%)) = MAX(%SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%),MIN(%SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%),VAR_CUMCOM.L(R,C,COM_VAR,YEAR,LL)*%CUCSCAL%)*(1+%TOLR%)); - %SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'LO'%SW2%)$REG_FIXT(R) $= %SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'LO'%SW2%)*(1-%TOLR%); - %SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%)$(REG_FIXT(R)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%)) = MAX(%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%),MIN(%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%),VAR_CUMFLO.L(R,P,C,YEAR,LL)*%CUFSCAL%)*(1+%TOLR%)); - %SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%)$REG_FIXT(R) $= %SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%)*(1-%TOLR%); - %SW1%CAP_BND(R,T,P,'UP'%SW2%)$%SW1%CAP_BND(R,T,P,'UP'%SW2%) = MAX(%SW1%CAP_BND(R,T,P,'UP'%SW2%),VAR_CAP.L(R,T,P)*(1+%TOLR%)); - %SW1%CAP_BND(R,T,P,'LO'%SW2%) $= %SW1%CAP_BND(R,T,P,'LO'%SW2%)*(1-%TOLR%); - ); -$ BATINCLUDE bnd_ucw.%1 -* Redefine UC_RHSMAP according to current flags - OPTION CLEAR=UC_RHSMAP; - LOOP((UC_R_EACH(R,UC_N),T,LIM)$UC_RHSRT(R,UC_N,T,LIM), - IF( SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','SEVERAL',R,T,ANNUAL) = YES; - ELSEIF SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','SEVERAL',R,T,ANNUAL) = YES; - )); - LOOP((UC_R_EACH(R,UC_N),T,S,LIM)$UC_RHSRTS(R,UC_N,T,S,LIM), - IF( UC_TS_EACH(R,UC_N,S)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','EACH',R,T,S) = YES; - ELSEIF UC_TS_EACH(R,UC_N,S)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','EACH',R,T,S) = YES; - )); - IF(CARD(REG_CUMCST),LOOP((R,T)$NO_RT(R,T),REG_CUMCST(R,YEAR,LL,COSTCAT,CUR,'UP')$SUPERYR(T,LL) = 0)); -*----------------------------------------------------------------------------- -* Activities and flows -$IF '%RTPX%'==X LOOP(R, BACKWARD(T) = NO_RT(R,T); SUBT(T) = RT_PP(R,T); - %VAR%_ACT.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S%SOW%)$(PRC_TS(R,P,S)) = VAR_ACT.L(R,V,T,P,S); - %VAR%_FLO.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S%SOW%)$(RPCS_VAR(R,P,C,S)*RP_FLO(R,P)) = VAR_FLO.L(R,V,T,P,C,S); - %VAR%_IRE.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S,IE%SOW%)$(RPCS_VAR(R,P,C,S)*RPC_IRE(R,P,C,IE)) = VAR_IRE.L(R,V,T,P,C,S,IE); - %VAR%_SIN.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S%SOW%)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = VAR_SIN.L(R,V,T,P,C,S); - %VAR%_SOUT.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S%SOW%)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = VAR_SOUT.L(R,V,T,P,C,S); - %VAR%_UPS.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S,BD(L)%SOW%)$RPS_UPS(R,P,S) = VAR_UPS.L(R,V,T,P,S,L); - %VAR%_UPT.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S,UPT%SOW%)$(RPS_UPS(R,P,S)$RP_DP(R,P)) = VAR_UPT.L(R,V,T,P,S,UPT); - %VAR%_UDP.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S,BD(L)%SOW%)$(PRC_TS(R,P,S)$RP_UPR(R,P,BD)) = VAR_UDP.L(R,V,T,P,S,L); -* Commodities - %VAR%_COMNET.FX(RTC_NET(R,BACKWARD(T),C),S%SOW%)$COM_TS(R,C,S) = VAR_COMNET.L(R,T,C,S); - %VAR%_COMPRD.FX(RTC_PRD(R,BACKWARD(T),C),S%SOW%)$COM_TS(R,C,S) = VAR_COMPRD.L(R,T,C,S); - %VAR%_ELAST.FX(RTC(R,BACKWARD(T),C),S,J,BD%SOW%)$(COM_TS(R,C,S)$RCJ(R,C,J,BD)) = VAR_ELAST.L(RTC,S,J,BD); -$IF DEFINED %VAR%_DAM VAR_DAM.L(R,T,C,BD,J)$NO=0; %VAR%_DAM.FX(R,T(BACKWARD),C,BD,J%SOW%)$((ORD(J) LE DAM_STEP(R,C,BD))$DAM_STEP(R,C,'FX')) = VAR_DAM.L(R,T,C,BD,J); -* Capacities - %VAR%_NCAP.FX(R,BACKWARD(T),P%SOW%)$RP(R,P) = MAX(EPS,VAR_NCAP.L(R,T,P)); - %VAR%_CAP.UP(RTP(R,BACKWARD(T),P)%SOW%) = INF; - %VAR%_CAP.LO(RTP(R,BACKWARD(T),P)%SOW%) = 0; - OPTION CLEAR=NO_RVP; NO_RVP(RTP_VARP(R,SUBT(T),P))$SUM(RTP_CPTYR(R,BACKWARD(TT),T,P),1) = YES; - %VAR%_CAP.UP(NO_RVP(R,T,P)%SOW%)$CAP_BND(R,T,P,'UP') = CAP_BND(R,T,P,'UP'); - %VAR%_CAP.LO(NO_RVP(R,T,P)%SOW%)$CAP_BND(R,T,P,'LO') = CAP_BND(R,T,P,'LO'); - %VAR%_SCAP.FX(RTP_CPTYR(R,V,BACKWARD(T),P)%SOW%)$PRC_RCAP(R,P) = VAR_SCAP.L(R,V,T,P); -* Cumulative variables - Z = (SMAX(T,M(T)) > MIYR_VL); - FIL(LL) = Z*(MIYR_VL < YEARVAL(LL)); -* Get new modifiers for flexible model horizon -$IFI NOT %SENSIS%==YES $BATINCLUDE bnd_cum.mod COM_VAR -* Remove LO bounds if years only partially in current horizon and no adjustment for shorter horizon - %VAR%_CUMFLO.LO(R,P,C,YEAR,LL %SOW%)$((NOT FLO_CUM(R,P,C,YEAR,LL,'N'))$FIL(LL)) = 0; - %VAR%_CUMCOM.LO(R,C,COM_VAR,YEAR,LL %SOW%)$((NOT COM_CUM(R,COM_VAR,YEAR,LL,C,'N'))$FIL(LL)) = 0; -$LABEL DONECUM -* Blending - VAR_BLND.L(RT_PP,BLE,OPR)=0; - %VAR%_BLND.FX(R,BACKWARD(T),BLE,OPR%SOW%)$BLE_OPR(R,BLE,OPR) = VAR_BLND.L(R,T,BLE,OPR); -$IF '%RTPX%'==X ); BACKWARD(T) = M(T) < YR_V1; SUBT(T) = TT(T)-BACKWARD(T)-FORWARD(T); -*----------------------------------------------------------------------------- - IF(MY_FYEAR, -* Find all regions REG linked to IRE equations in region R - TRACKPC(RPC(R,P,C))$(RPC_EQIRE(R,P,C,'EXP')+RPC_MARKET(R,P,C,'EXP')) = YES; - LOOP((TRACKPC(R,P,C),TOP_IRE(R,C,REG,COM,P)),IRE_RPR(R,P,REG,'EXP') = YES); - OPTION CLEAR=TRACKPC; - LOOP((TOP_IRE(R,C,REG,COM,P),RPC_EQIRE(REG,P,COM,'IMP')),IRE_RPR(REG,P,R,'IMP') = YES); - OPTION CLEAR=RTPX; RTPX(RTP(R,T,P))$RP_IRE(R,P) = RT_PP(R,T); - LOOP((REG,IE),RTPX(RTP(R,T,P))$(RT_PP(REG,T)$IRE_RPR(R,P,REG,IE)) = YES); - IRE_FXT(RTP(R,T,P))$(NO_RT(R,T)$RP_IRE(R,P)) = YES; - LOOP((REG,IE),IRE_FXT(R,T,P)$(NO_RT(REG,T)$IRE_RPR(R,P,REG,IE)) = YES); -* Remove RTP for IRE fixed in all linked regions, and save marginals - IF(PRESOL,OPTION CLEAR=PAR_IPRIC; EQ_IRE.M(R,T,P,C,IE,S)$NO = 0); - PAR_IPRIC(IRE_FXT,C,S,IE)$(PAR_IPRIC(IRE_FXT,C,S,IE)=0) $= EQ_IRE.M(IRE_FXT,C,IE,S); -* Relax all fixed flows in regions with IRE equations - OPTION CLEAR=RTP_IRE; LOOP(REG,RTP_IRE(RTPX(R,T,P),IE)$(IRE_RPR(R,P,REG,IE)$NO_RT(R,T)) = YES); - %VAR%_IRE.UP(RTP_VINTYR(R,V,T,P),C,S,IE%SOW%)$(RTP_IRE(R,T,P,IE)*RPCS_VAR(R,P,C,S)*RPC_IREIO(R,P,C,IE,'IN')) = VAR_IRE.L(R,V,T,P,C,S,IE)*(1+%TOLX%*POWER(8,-1$XPT(IE))); - %VAR%_IRE.LO(RTP_VINTYR(R,V,T,P),C,S,IE%SOW%)$(RTP_IRE(R,T,P,IE)*RPCS_VAR(R,P,C,S)*RPC_IREIO(R,P,C,IE,'IN')) = VAR_IRE.L(R,V,T,P,C,S,IE)*(1-%TOLX%*POWER(8,-1$IMP(IE))); - LOOP(IE, -$IF %REDUCE%==YES %VAR%_ACT.UP(RTP_VINTYR(R,V,T,P),S%SOW%)$(RTP_IRE(R,T,P,IE)*PRC_TS(R,P,S)*RP_PGACT(R,P)) = VAR_ACT.L(R,V,T,P,S)*(1+%TOLX%*POWER(8,-1$XPT(IE))); -$IF %REDUCE%==YES %VAR%_ACT.LO(RTP_VINTYR(R,V,T,P),S%SOW%)$(RTP_IRE(R,T,P,IE)*PRC_TS(R,P,S)*RP_PGACT(R,P)) = VAR_ACT.L(R,V,T,P,S)*(1-%TOLX%*POWER(8,-1$IMP(IE))); - ); -* Remove IRE_BND from fixed regions with no related IRE equation, and all IRE_XBND from fixed regions - OPTION CLEAR=RXX; - LOOP((R,T,C,S,ALL_REG,IE,BD)$(NO_RT(R,T)$IRE_BND(R,T,C,S,ALL_REG,IE,BD)), - IF(NOT SUM(RPC_EQIRE(R,P,C,IE)$RTPX(R,T,P),1), - IF(NOT SUM(RPC_MARKET(R,P,C,IE)$RTPX(R,T,P),1),RXX(R,C,IE) = YES))); - IRE_BND(R,T,C,S,ALL_REG,IE,BD)$(NO_RT(R,T)$RXX(R,C,IE)) = 0; - IRE_XBND(R,T,C,S,IE,BD)$NO_RT(R,T) = 0; - ); -*----------------------------------------------------------------------------- -$IF '%RTPX%'==X FIL(T)=FORWARD(T); LOOP(R, FORWARD(T)=FIL(T)$(NOT NO_RT(R,T)); -* Activities and flows - VAR_ACT.FX(RTP_VINTYR(R,V,FORWARD(T),P),S)$(PRC_TS(R,P,S)) = 0; - VAR_FLO.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S)$(RPCS_VAR(R,P,C,S)*RP_FLO(R,P)) = 0; - VAR_IRE.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S,IE)$(RPCS_VAR(R,P,C,S)*RPC_IRE(R,P,C,IE)) = 0; - VAR_SIN.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = 0; - VAR_SOUT.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = 0; -* Commodities - VAR_COMNET.FX(RTCS_VARC(R,FORWARD(T),C,S)) = 0; - VAR_COMPRD.FX(RTCS_VARC(R,FORWARD(T),C,S)) = 0; - VAR_ELAST.FX(RTCS_VARC(R,FORWARD(T),C,S),J,BD)$RCJ(R,C,J,BD) = 0; -* Capacities - VAR_CAP.LO(RTP(R,FORWARD(T),P)) = 0; - VAR_CAP.UP(RTP(R,FORWARD(T),P)) $= CAP_BND(RTP,'UP'); -* Blending - VAR_BLND.FX(R,FORWARD(T),BLE,OPR)$BLE_OPR(R,BLE,OPR) = 0; -$IF '%RTPX%'==X ); FORWARD(T)=FIL(T); -*----------------------------------------------------------------------------- -* Reject starting basis if equations were removed: - IF(CARD(NO_RT)+CARD(FORWARD), OPTION BRATIO=1); - OPTION SOLVEOPT=MERGE; -* Save last cum marginal - IF(PRESOL=0, PAR_CUMFLOM(R,P,C,YEAR,LL) $= VAR_CUMFLO.M(R,P,C,YEAR,LL); - PAR_UCR(UC_N,'IMPEXP') $= VAR_UC.M(UC_N); PAR_UCR(UC_N,R) $= VAR_UCR.M(UC_N,R)); -*----------------------------------------------------------------------------- -$ SET EXT mod -$ IFI %STAGES%==YES $SET EXT stc -$ IFI %SPINES%==YES $SET EXT mod -$ BATINCLUDE solve.%EXT% - PRESOL = 0; -$IF NOT %STEPPED%==YES $GOTO ENDSTEP -*----------------------------------------------------------------------------- -* Restore last cum marginal - VAR_UC.M(UC_N)$(VAR_UC.M(UC_N)=0) $= PAR_UCR(UC_N,'IMPEXP'); - VAR_UCR.M(UC_N,R)$(VAR_UCR.M(UC_N,R)=0) $= PAR_UCR(UC_N,R); - VAR_CUMFLO.M(R,P,C,YEAR,LL)$(VAR_CUMFLO.M(R,P,C,YEAR,LL)=0) $= PAR_CUMFLOM(R,P,C,YEAR,LL); -* Adjust SUBT - SUBT(T) = SUBT(T-1); - Z = SMIN(FORWARD(T),B(T)); - YR_V1 = SMIN(SUBT(T)$(M(T) GE Z-G_OVERLAP),M(T)); - Z = YR_V1 + YR_VL; - SUBT(T)$(M(T) < Z) = YES; - SUBT(T)$(M(T) < YR_V1) = NO; -*----------------------------------------------------------------------------- -* Restore some original data - V(T) = YES; - UC_T_SUM(R,UC_N,T) $= STP_UCT('1',R,UC_N,T); - UC_T_SUCC(R,UC_N,T) $= STP_UCT('2',R,UC_N,T); - UC_T_EACH(R,UC_N,T) $= STP_UCT('3',R,UC_N,T); -$IF '%RTPX%'==X LOOP(R, BACKWARD(T)=NO_RT(R,T); -$ IFI %SPINES%==YES $BATINCLUDE pextlevs.stc "'1'" (BACKWARD) -$IF '%RTPX%'==X ); -* Reset bounds -$ BATINCLUDE bndmain.%1 %1 1 -*----------------------------------------------------------------------------- - ); -$LABEL ENDSTEP -*----------------------------------------------------------------------------- -* Remove superfluous values - %VAR%_NCAP.L(R,T,P%SOW%)$((%VAR%_NCAP.L(R,T,P%SOW%) EQ 0)$%VAR%_NCAP.L(R,T,P%SOW%)) = 0; - %VAR%_NCAP.M(R,T,P%SOW%)$NO_RT(R,T) = 0; - %VAR%_ACT.M(R,V,T,P,S%SOW%)$NO_RT(R,T) = 0; - %VAR%_FLO.M(R,V,T,P,C,S%SOW%)$NO_RT(R,T) = 0; - %VAR%_IRE.M(R,V,T,P,C,S,IE%SOW%)$NO_RT(R,T) = 0; - IF(MY_FYEAR,%EQ%_IRE.M(IRE_FXT(R,T,P),C,IE,S%SWT%) $= PAR_IPRIC(R,T,P,C,S,IE)); diff --git a/source/spoint.mod b/source/spoint.mod deleted file mode 100644 index 728a9c4..0000000 --- a/source/spoint.mod +++ /dev/null @@ -1,87 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* SPOINT.mod is the code for handling solution point saving/loading -* %1 - 1 or 0 (1: before solve, 0: renaming after solve) -* Note: Using Posix utility mv for renaming for portability -*=============================================================================* -$SETLOCAL PATH '%GDXPATH%' SETLOCAL PNT1 '_p' SETLOCAL PNT2 '' -$IF SET FIXBOH $SETLOCAL PNT1 '' SETLOCAL PNT2 '_p' -$IF NOT SET SPOINT $GOTO CHECK -$IFI %SPOINT%==YES $SET SPOINT 1 - IF(J('%SPOINT%'), Z = SUM(SAMEAS('%SPOINT%',J),ORD(J)); - IF(MOD(Z,2), OPTION SAVEPOINT=1; -* Reset GDX file to ensure it will always be written if SAVEPOINT=1 - IF(%1,execute_unload '%MODEL_NAME%_p.gdx',IMP; - ELSE execute 'mv -uf %MODEL_NAME%_p.gdx %PATH%%RUN_NAME%_p.gdx'))); -$LABEL CHECK -$IF '%1'=='0' $EXIT -*----------------------------------------------------------------------------- -$IF %STAGES%==YES $BATINCLUDE clearsol.stc ALL -*----------------------------------------------------------------------------- -$LABEL LOADS -$IF %RPOINT%==NO $GOTO LLOAD -$IFI NOT %RPOINT%==YES $SET LPOINT %RPOINT% -$CLEAR EQ_IRE EQE_CPT EQ_PEAK EQE_UCRTP EQE_COMBAL EQG_COMBAL EQE_COMPRD VAR_UPS VAR_UPT VAR_UDP -$CLEAR EQE_UC EQE_UCR EQE_UCT EQE_UCRT EQE_UCTS EQE_UCRTS EQE_UCRS EQE_UCSU EQE_UCSUS EQE_UCRSU EQE_UCRSUS -$IF %VAR_UC%==YES $GOTO UCLEAR -$CLEAR EQG_UC EQG_UCR EQG_UCT EQG_UCRT EQG_UCTS EQG_UCRTS EQG_UCRS EQG_UCSU EQG_UCSUS EQG_UCRSU EQG_UCRSUS -$CLEAR EQL_UC EQL_UCR EQL_UCT EQL_UCRT EQL_UCTS EQL_UCRTS EQL_UCRS EQL_UCSU EQL_UCSUS EQL_UCRSU EQL_UCRSUS -$LABEL UCLEAR -$IF DEFINED EQ_CLITOT OPTION CLEAR=EQ_CLITOT,CLEAR=EQ_CLIMAX; VAR_CLIBOX.L(CM_VAR,LL)$NO=0; - VAR_BLND.L(R,T,BLE,OPR)$NO = 0; -$IF %TIMESED%==YES VAR_OBJELS.L(R,BD,CUR)$NO = 0; -$IFI %MERGE%==YES $BATINCLUDE clears.mrg -$IF SET TIMESTEP $BATINCLUDE eqobsalv.mod STP EXIT -$ BATINCLUDE pp_clean.mod -*----------------------------------------------------------------------------- -$LABEL LLOAD -$SET LOAD 0 -$IF NOT SET LPOINT $GOTO RUNNAME -$IF EXIST %PATH%%LPOINT%%PNT1%.gdx $SET LOAD 2 -$IF %LOAD%==2 execute_loadpoint '%PATH%%LPOINT%%PNT1%.gdx'; -$IF %LOAD%==2 $GOTO FINISH -$IF EXIST %PATH%%LPOINT%%PNT2%.gdx $SET LOAD 2 -$IF %LOAD%==2 execute_loadpoint '%PATH%%LPOINT%%PNT2%.gdx'; -$IF %LOAD%==2 $GOTO FINISH -$IF SET FIXBOH $ABORT Could not load gdx file %LPOINT% -*----------------------------------------------------------------------------- -$LABEL RUNNAME -$IF NOT SET SPOINT $GOTO FINISH -$IFI %LPOINT%==%RUN_NAME% $GOTO FINISH -$IF %SPOINT%==2 $SET LOAD 1 -$IF %SPOINT%==3 $SET LOAD 1 -$IF %LOAD%==0 $GOTO FINISH -$IF EXIST %PATH%%RUN_NAME%_P.gdx $SET LOAD 2 -$IF %LOAD%==2 execute_loadpoint '%PATH%%RUN_NAME%_p.gdx'; -$IF %LOAD%==2 $GOTO FINISH -$IF EXIST %PATH%%RUN_NAME%.gdx $SET LOAD 2 -$IF %LOAD%==2 execute_loadpoint '%PATH%%RUN_NAME%.gdx'; -*----------------------------------------------------------------------------- -$LABEL FINISH -$IF NOT DEFINED REG_BDNCAP $SET LOAD 0 -$IF NOT %LOAD%==2 $CLEAR REG_BDNCAP -$IF NOT %LOAD%==2 $EXIT -* Fix new capacities to previous solution if requested - SET RT_NO(R,T), RTCS(R,ALLYEAR,C,S); - REG_BDNCAP(R,BDNEQ)$REG_BDNCAP(R,'FX')=MAX(REG_BDNCAP(R,BDNEQ),REG_BDNCAP(R,'FX'))$SUM(BD,REG_BDNCAP(R,BD)$BDSIG(BD)); - REG_BDNCAP(R,'FX')$SUM(BDNEQ$REG_BDNCAP(R,BDNEQ),1)=0; - LOOP((R,BD)$REG_BDNCAP(R,BD),Z=REG_BDNCAP(R,BD); RT_NO(R,T)$(M(T)<=Z)=YES); -* Determine which milestones available - RTCS(RTC,S--ORD(S))$=EQG_COMBAL.M(RTC,S); - RTCS(RTC,S--ORD(S))$=EQE_COMBAL.M(RTC,S); - OPTION FIL < RTCS; - PASTSUM(RTP(RT_NO(R,T(FIL)),P))$PRC_CAP(R,P)=EPS; - PASTSUM(RTP(RT_NO,P)) $= VAR_NCAP.L(RTP); - RTPS_BD(RTP(RT_NO(R,T),P),ANNUAL,BD)$((M(T)<=REG_BDNCAP(R,BD))$PASTSUM(RTP)) = YES; - RTPS_BD(RTP(RT_NO(R,T),P),ANNUAL(S),BDNEQ)$(RTPS_BD(RTP,S,'LO')$RTPS_BD(RTP,S,'UP')) = BDSIG(BDNEQ)-NCAP_BND(R,'0',P,'N'); - NCAP_BND(RTP(RT_NO(R,T),P),BD)$RTPS_BD(RTP,'ANNUAL',BD) = MAX(EPS,PASTSUM(RTP),NCAP_BND(RTP,BD)$BDLOX(BD)); - NCAP_BND(RTP(RT_NO,P),'UP')$(NCAP_BND(RTP,'LO')$NCAP_BND(RTP,'UP')) = SMAX(BDNEQ,NCAP_BND(RTP,BDNEQ)); -$ IF %STAGES%==YES $SETLOCAL SWT '$SW_T(T%SOW%)' - %VAR%_NCAP.LO(RTP(RT_NO(R,T),P)%SOW%)%SWT% $= NCAP_BND(RTP,'LO'); - %VAR%_NCAP.UP(RTP(RT_NO(R,T),P)%SOW%)%SWT% $= NCAP_BND(RTP,'UP'); - %VAR%_NCAP.FX(RTP(RT_NO(R,T),P)%SOW%)%SWT% $= NCAP_BND(RTP,'FX'); - VAR_NCAP.L(RTP(RT_NO,P)) $= PASTSUM(RTP); - OPTION CLEAR=PASTSUM,CLEAR=RTCS,CLEAR=FIL,CLEAR=RTPS_BD,CLEAR=RT_NO; \ No newline at end of file diff --git a/source/stages.stc b/source/stages.stc deleted file mode 100644 index a4cccb6..0000000 --- a/source/stages.stc +++ /dev/null @@ -1,272 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* STAGES.stc - Preprocessing for multi-stage stochastics -* %1 - mod or v# for the source code to be used -*=============================================================================* -$IF %MACRO%==YES $ABORT Stochastic MACRO Not Implemented - aborted. -$IF %1==MCA $GOTO POST -* -$SETGLOBAL SW_TAGS SET EQ 'ES' SET VAR 'VAS' SET SWD ',WW' SET SWTD ',T,WW' SET SWS ',W)' SET SOW ',SOW' SET SWT ',SW_T(T,SOW)' SET VART 'SUM(SW_TSW(SOW,T,W),VAS' SET VARV 'SUM(SW_TSW(SOW,V,W),VAS' SET VARM 'SUM(SW_TSW(SOW,MODLYEAR,W),VAS' -$IF %STAGES%==YES $SETGLOBAL SW_STVARS SET VARTT 'SUM(SW_TSW(SOW,TT,W),VAS' SET SWSW SW_TSW(SOW,T,WW), -$SETGLOBAL SWD ',WW' SETGLOBAL WITSPINE -$IF %STAGES%==YES $SETGLOBAL SWX ',SOW' SETGLOBAL SWTX SW_T(T,SOW)$ -$IF %SENSIS%==YES $SETGLOBAL SWD -SET AUXSOW(ALLSOW) / 1 /; -*----------------------------------------------------------------------------- -* Use slack variables in user-constraints -$SETGLOBAL VAR_UC YES -$IF NOT %VAR_UC%==YES $ABORT Invalid VAR_UC setting in stochastic mode - abort. - OPTION SUC_L 1) = 0; - IF(SW_SUBS('1','1') EQ 0, - IF(CARD(SW_SUBS)+CARD(SW_SPROB) EQ 0, SW_SUBS('1','1') = MAX(1,SMAX(WW$SW_PROB(WW),ORD(WW))); - ELSE SW_SUBS('1','1') = MAX(1,SMAX(WW$(SW_SPROB('2',WW)+SW_SUBS('2',WW)),ORD(WW))))); - -* Copy number of childs from first parent to others when missing - LAST_VAL = SMAX((J,WW)$SW_SUBS(J,WW),ORD(J)); - LOOP(JJ(J-1)$(ORD(J) LE LAST_VAL), - F = MAX(1,SW_SUBS(J,'1')); Z = SUM(WW$SW_SUBS(JJ,WW),SW_SUBS(JJ,WW)); - LOOP(WW$(ORD(WW) LE Z), - IF(NOT SW_SUBS(J,WW), SW_COPY(J,WW)$(ORD(WW) > 1) = YES; SW_SUBS(J,WW) = F;))); - -* Construch SW_CHILD - LOOP((J,ALLSOW)$SW_SUBS(J,ALLSOW), - IF(ORD(ALLSOW) EQ 1, F = 0); - Z = SW_SUBS(J,ALLSOW)+F; - SW_CHILD(J,ALLSOW,WW)$((ORD(WW) LE Z)*(ORD(WW) > F)) = YES; - F = Z;); - -* Construct sow: - LOOP(SW_CHILD(J,ALLSOW,WW), SOW(WW) = YES); - -*----------------------------------------------------------------------------- - SW_PHASE = 0; -* Make sure OBJZ will not be generated - UC_TS_SUM(R,'OBJZ',S) = NO; - UC_TS_EACH(R,'OBJZ',S) = NO; - IF(SUM((UC_N,SOW)$S_UCOBJ(UC_N,SOW),1), - SW_START('1') = 9999; - SW_LAMBDA = 0; - SW_PHASE = -9; -* Make sure OBJ1 will not be generated - UC_TS_SUM(R,'OBJ1',S) = NO; - UC_TS_EACH(R,'OBJ1',S) = NO; - UC_T_SUM(R,'OBJ1',T) = NO; -* Complete checking for uncertain parameters - CNT = SW_PARM; - CNT$(NOT CNT) = SUM((UC_N,BD,J,W)$S_UC_RHS(UC_N,BD,J,W),1); - CNT$(NOT CNT) = SUM((R,UC_N,BD,J,W)$S_UC_RHSR(R,UC_N,BD,J,W),1); - CNT$(NOT CNT) = SUM((UC_N,T,BD,J,W)$S_UC_RHST(UC_N,T,BD,J,W),1); - CNT$(NOT CNT) = SUM((R,UC_N,T,BD,J,W)$S_UC_RHSRT(R,UC_N,T,BD,J,W),1); - CNT$(NOT CNT) = SUM((UC_N,T,S,BD,J,W)$S_UC_RHSTS(UC_N,T,S,BD,J,W),1); - CNT$(NOT CNT) = SUM((R,UC_N,T,S,BD,J,W)$S_UC_RHSRTS(R,UC_N,T,S,BD,J,W),1); -* Reset UCOBJ(OBJ1) flags to either 1 or 2: - FIRST_VAL = S_UCOBJ('OBJ1','1'); - S_UCOBJ('OBJ1',SOW) = 1+1$(S_UCOBJ('OBJ1',SOW) GE 0); -* Copy UCOBJ from previous if missing and uncertain parameters defined - LOOP((SOW(WW),W(WW-1)), - IF(SUM(UC_N$S_UCOBJ(UC_N,SOW),1) EQ 1, - S_UCOBJ(UC_N,SOW) $= S_UCOBJ(UC_N,W); - S_UCOBJ('OBJ1',SOW) = 4+2$CNT;)); -* Check setups with single terminal SOW: - IF(FIRST_VAL, -$IF %STAGES%==YES IF((FIRST_VAL EQ 0)$(NOT SW_PARM), SW_PARM = 1; -$IF %STAGES%==YES ELSE S_UCOBJ('OBJ1',SOW)=S_UCOBJ('OBJ1',SOW)-ABS(S_UCOBJ('OBJ1',SOW)-4); SW_PARM = -1); - ELSE SW_PARM = 0); S_UCOBJ('OBJ1',SOW(WW))$(ORD(WW) EQ CARD(SOW)) = MAX(0,S_UCOBJ('OBJ1',WW)); -* Check MinMax Regret option - ELSEIF SUM((J,SOW)$S_UC_RHS('OBJ1','FX',J,SOW),1), UC_T_SUM(R,'OBJ1',T) = NO; SW_LAMBDA = -1 - ); -$IF NOT %STAGES%==YES SW_START('1') = 9999; SW_LAMBDA = 0; SW_PARM = 0; -*----------------------------------------------------------------------------- -* Contruct spanning tree - FOR(Z = LAST_VAL-1 DOWNTO 0, - LOOP((SAMEAS(J-Z,'1'),JJ(J+1)), - IF(Z=LAST_VAL-1,SW_TREE(J,ALLSOW,SOW)$SW_CHILD(J,ALLSOW,SOW) = YES; - ELSE LOOP(SW_CHILD(J,ALLSOW,WW),SW_TREE(J,ALLSOW,SOW)$SW_TREE(JJ,WW,SOW) = YES;)); - )); - -* Adjust SW_START to period years - MY_FYEAR = SW_START('1'); Z = 0; SW_START('1') = 0; - SW_START(J)$(ORD(J) > LAST_VAL+1) = 0; - LOOP(MIYR_1(TT), F = -1; - LOOP(J$(ORD(J) LE LAST_VAL+1), - MY_F = SW_START(J); - IF(NOT MY_F, F = F+1; Z = MAX(Z+1,YEARVAL(TT+F)); SW_START(J) = Z; - ELSEIF MY_F > Z, Z = MY_F; F = MAX(1,F,SUM(T$(YEARVAL(T) < MY_F),1)); - SW_START(J) = MAX(YEARVAL(TT+(F-1))+1,Z); - ELSE SW_START(J) = SW_START(J-1)); - )); - -* Construct mapping of valid data stages for each T - LOOP(J$SW_START(J), SW_TSTG(T,J)$(SW_START(J) LE YEARVAL(T)) = YES); -* Reset SW_START if first year is large - IF(MY_FYEAR GE SW_START('2'), SW_START(J)$((SW_START(J) LE MY_FYEAR)$SW_START(J)) = MIYR_V1); - -* Construct SW_STAGE for internal SOWs - SW_DESC(J,WW) = SUM(SW_TREE(J,WW,SOW),1); - LOOP(SAMEAS(WW,'1'), F = 0; - LOOP((J,SOW)$SW_SUBS(J,SOW), - IF(ORD(J) NE F, Z = 0; F = ORD(J)); - SW_STAGE(J,WW+Z) = YES; - Z = Z + SW_DESC(J,SOW); - )); - -* Copy probabilities when missing - LOOP((JJ(J-1),ALLSOW)$SW_SUBS(JJ,ALLSOW), Z=0; MY_F=0; - IF(ORD(ALLSOW) EQ 1, F=0; ELSE F=F+CNT); CNT=SW_SUBS(JJ,ALLSOW); - LOOP(SW_CHILD(JJ,ALLSOW,WW)$SW_SPROB(J,WW), Z=Z+SW_SPROB(J,WW); MY_F=MY_F+1); - IF(SW_COPY(JJ,ALLSOW)$(NOT MY_F), SW_SPROB(J,WW)$SW_CHILD(JJ,ALLSOW,WW) = SW_SPROB(J,WW-F); - ELSE SW_SPROB(J,WW)$((NOT SW_SPROB(J,WW))*SW_CHILD(JJ,ALLSOW,WW)) = MAX(0,1-Z)/(CNT-MY_F)); - ); -* Set map for copying attributes - LOOP(SW_COPY(JJ(J-1),W), F=0; LOOP(SW_CHILD(JJ,W,WW), IF(F=0,F=ORD(WW)-1); SW_CPMAP(J,WW,WW-F)=YES)); - -* Normalize probabilities under each parent - SW_SPROB('1','1') = 1; - LOOP((J,WW)$SW_SUBS(J,WW), - Z = SUM(SOW$SW_CHILD(J,WW,SOW),SW_SPROB(J+1,SOW)); - IF(Z NE 1,SW_SPROB(J+1,SOW)$SW_CHILD(J,WW,SOW) = SW_SPROB(J+1,SOW)/Z;); - ); - -* Add final stage to SW_TREE - LOOP(SAMEAS(J-LAST_VAL,'1'), SW_TREE(J,SOW,SOW) = YES); - OPTION SW_REV < SW_TREE; -* Calculate final stage probabilities - SW_PROB(SOW)$(NOT SW_PROB(SOW)) = PROD(SW_TREE(JJ,ALLSOW,SOW),SW_SPROB(JJ,ALLSOW)); -$IF SETLOCAL DEBUG DISPLAY SW_PROB,SW_SPROB; -*----------------------------------------------------------------------------- -* Normalize probability distribution - SW_PROB(ALLSOW)$(SW_PROB(ALLSOW) LE 0) = 0; - Z = SUM(ALLSOW,SW_PROB(ALLSOW)); - IF(Z EQ 0, Z = 1; SW_PROB('1') = Z); - SW_PROB(SOW) = SW_PROB(SOW)/Z; - -* Set all SOWs into the last stage and Cumulate SOW from each stage to next: - LOOP(SAMEAS(J,'1'), SW_STAGE(J+LAST_VAL,SOW) = YES;); - LOOP(J$(ORD(J) LE LAST_VAL), SW_STAGE(J+1,SOW)$SW_STAGE(J,SOW) = YES;); - -* Convert stages to periods - LOOP(SW_STAGE(J,SOW), SW_T(T,SOW)$(SW_START(J) LE YEARVAL(T)) = YES); - -* Map SOWs to unique SOW at each period: - LOOP(T, F = 0; - LOOP(SW_T(T,WW), Z = ORD(WW); - SW_TSW(SOW(ALLSOW),T,WW+(F-Z))$((ORD(ALLSOW) GE F)*(ORD(ALLSOW) < Z)) = YES; - F = Z;); - SW_TSW(SOW(ALLSOW),T,WW)$((ORD(WW) EQ F)*(ORD(ALLSOW) GE F)) = YES; - ); - -* Calculate aggregate probablilities; remove from maps all SOWs with zero PROB - SW_TPROB(T,W) = SUM(SW_TSW(SOW,T,W),SW_PROB(SOW)); - SW_T(T,ALLSOW)$(SW_TPROB(T,ALLSOW) EQ 0) = NO; - SW_TSW(SOW,T,WW)$(NOT SW_T(T,WW)) = NO; - -* Construct mapping between internal (T,SOW) and original (J,SOW) - SW_MAP(SW_T(T,WW),J,SOW)$(SW_TSTG(T,J)*SW_TREE(J,SOW,WW)) = YES; - -$IF SETLOCAL DEBUG DISPLAY SW_START,SW_SUBS,SW_CHILD,SW_TREE,SW_MAP,SW_STAGE,SW_T,SW_TSW,SW_TPROB,SW_TSTG; - -*----------------------------------------------------------------------------- -* Construct SW_UCT (needed to control dynamic stochastic UC-constraints) - LOOP(R, SW_UCT(UC_N,SW_T(T,SOW))$(UC_T_SUCC(R,UC_N,T)$UC_DYNDIR(R,UC_N,'RHS')) = YES; - LOOP(SW_T(T+1,SOW),SW_UCT(UC_N,T,SOW)$(UC_T_SUCC(R,UC_N,T)*(NOT UC_DYNDIR(R,UC_N,'RHS'))) = YES;)); -*----------------------------------------------------------------------------- -* Pre-Process cumulative bounds - S_FLO_CUM(R,P,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR),BD,J,SOW) $= S_FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,BD,J,SOW); - S_FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,BD,J,SOW)$(NOT LL(BOHYEAR)*LL(EOHYEAR)) = 0; - RPC_CUMFLO(RP(R,P),C,ALLYEAR,LL) $= SUM((BD,J,SOW)$S_FLO_CUM(R,P,C,ALLYEAR,LL,BD,J,SOW),YES); -*----------------------------------------------------------------------------- -* Construct SUPERYR (needed in cumulative constraints) - SUPERYR(PERIODYR(T,LL)) = YES; - LOOP(MIYR_1(T),SUPERYR(T--1,LL)$(YEARVAL(LL) > MIYR_VL) = YES); -*----------------------------------------------------------------------------- -$ BATINCLUDE fillsow.stc COM_PROJ 'R,' C T NO -$ BATINCLUDE fillsow.stc COM_TAX 'R,' 'C,S,COM_VAR,CUR' T YES 'SW_T(T,WW)' NO -$ BATINCLUDE fillsow.stc NCAP_COST 'R,' P T NO -$ IF DEFINED S_FLO_FUNC $BATINCLUDE fillsow.stc FLO_FUNC 'R,' 'P,CG,CG2' T NO -$ IF DEFINED S_NCAP_AFS $BATINCLUDE fillsow.stc NCAP_AFS 'R,' 'P,S' T NO -$ IF DEFINED S_COM_FR $BATINCLUDE fillsow.stc COM_FR 'R,' 'C,S' T NO -$ BATINCLUDE fillsow.stc CAP_BND 'R,' 'P,BD' T YES 'SW_T(T,WW)' NO -$ BATINCLUDE fillsow.stc COM_CUM 'R,COM_VAR,ALLYEAR,' 'C,BD' LL YES 'SUPERYR(T,LL)' YES -$ BATINCLUDE fillsow.stc FLO_CUM 'R,P,C,ALLYEAR,' 'BD' LL YES 'SUPERYR(T,LL)' YES -$ BATINCLUDE fillsow.stc UC_RHST 'UC_N,' 'LIM' T YES 'SW_T(T,WW)' NO -$ BATINCLUDE fillsow.stc UC_RHSRT 'R,UC_N,' 'LIM' T YES 'SW_T(T,WW)' NO -$ BATINCLUDE fillsow.stc UC_RHSTS 'UC_N,' 'TS,LIM' T YES 'SW_T(T,WW)' NO -$ BATINCLUDE fillsow.stc UC_RHSRTS 'R,UC_N,' 'TS,LIM' T YES 'SW_T(T,WW)' NO -$IF DEFINED S_DAM_COST $BATINCLUDE fillsow.stc DAM_COST 'R,' 'COM,CUR' T YES 'SW_T(T,WW)' YES -* Handle uncertain attributes without year index -$ BATINCLUDE fillsow.stc UC_RHS 'UC_N,LIM' '' '' YES YES YES -$ BATINCLUDE fillsow.stc UC_RHSR 'R,UC_N,LIM' '' '' YES YES YES - OPTION CLEAR=SUPERYR; -$ IF %MCA%==YES $EXIT -$ LABEL POST -* Levelize & merge -$ BATINCLUDE pp_lvlfc.mod S_COM_TAX C COM_TS ',COM_VAR,CUR,J,WW' "" ALL_TS T RC(R,C)$(ORD(J)=1) - S_COM_TAX(RTC(R,T,C),S,COM_VAR,CUR,'1',W)$(NOT SW_T(T,W)) $= SUM(SW_TSW(W,T,WW),S_COM_TAX(RTC,S,COM_VAR,CUR,'1',WW)); -*----------------------------------------------------------------------------- -* Pre-Process FLO_FUNC transformation -$IF NOT DEFINED S_FLO_FUNC $GOTO DIDFUNC - PARAMETER RTP_FFCS(R,ALLYEAR,P,CG,CG%SWD%); OPTION CLEAR=RTP_FFCS; - RP_FFSGG(R,P,ACTCG(CG),CG) = NO; - RP_FFSGGM(RP_PG(RP,CG1),CG,ACTCG,CG)$RP_FFSGG(RP,ACTCG,CG) = YES; - RP_FFSGGM(RP_FFSGG(RP,CG,CG2),CG,CG2)$(NOT ACTCG(CG)) = YES; - OPTION RP_FFSGG <= RP_FFSGGM, TRACKP < RP_FFSGG; -$IF %SENSIS%==YES $GOTO DIDFUNC - OPTION CLEAR=UNCD7; UNCD7(R,TT,T--ORD(T),P,SOW,'','')$TRACKP(R,P) $= RTP_VINTYR(R,TT,T,P)$SW_T(T,SOW); - LOOP(UNCD7(R,T,TT,P,SOW,'',''),RTPW(R,T,P,SOW)=YES); - RTP_FFCS(R,T,P,CG,COM_GRP,SOW)$(RTPW(R,T,P,SOW)*RP_FFSGG(R,P,CG,COM_GRP)) = - SUM((RP_FFSGGM(R,P,CG,COM_GRP,CG1,CG2),SW_TSW(SOW,T,W)), - PROD(SW_MAP(T,W,J,WW)$S_FLO_FUNC(R,T,P,CG1,CG2,J,WW),S_FLO_FUNC(R,T,P,CG1,CG2,J,WW))-1); -* Remap reduced FUNC flows - LOOP(RPCG_PTRAN(RP,C,COM,CG,CG2)$RP_FFSGG(RP,CG,CG2),IF(RPC_FFUNC(RP,C),RP_DCGG(RP,C,CG,CG2,'UP')=YES; ELSE RP_DCGG(RP,COM,CG,CG2,'LO')=YES)); - RP_DCGG(RPC_FFUNC(RP,COM),CG,C,'UP')$(RPG_1ACE(RP,CG,COM)$RPC_ACT(RP,C)) $= RP_FFSGG(RP,CG,C); - RTP_FFCS(RTP(R,T,P),ACTCG,C,W)$RPC_FFUNC(R,P,C) $= SUM(RP_DCGG(R,P,C,CG,CG2,L),(POWER(RTP_FFCS(RTP,CG,CG2,W)+1,BDSIG(L))-1)$(RTP_FFCS(RTP,CG,CG2,W)+1)); - LOOP(RP_DCGG(R,P,C,CG,CG2,L),RTP_FFCS(R,T,P,CG,CG2,W) = 0); - OPTION CLEAR=S_FLO_FUNC,CLEAR=RTPW,CLEAR=RP_DCGG,CLEAR=RP_FFSGG,CLEAR=RP_FFSGGM; -$LABEL DIDFUNC -* Pre-process uncertain NCAP_COST - OPTION RVP < S_NCAP_COST; - OBJ_SIC(RVP(R,T,P),SOW)$SW_T(T,SOW) = PROD(SW_MAP(T,SOW,J,WW)$S_NCAP_COST(R,T,P,J,WW),S_NCAP_COST(R,T,P,J,WW))-1; - OPTION CLEAR=RVP,CLEAR=TRACKP,CLEAR=S_NCAP_COST; -* Process uncertain NCAP_AFS -$IF NOT DEFINED S_NCAP_AFS $GOTO DIDAFS - LOOP(J, RTP_SAFS(R,T,P,S,W) $= SUM(SW_MAP(T,W,J,WW),S_NCAP_AFS(R,T,P,S,J,WW))); - OPTION CLEAR=S_NCAP_AFS; - LOOP(BDUPX(BD), - S_NCAP_AFS(R,T,P,S,'1',W)$((NCAP_AF(R,T,P,S,BD) > 0)$RTP_SAFS(R,T,P,S,W)) = RTP_SAFS(R,T,P,S,W)/NCAP_AF(R,T,P,S,BD); - S_NCAP_AFS(R,T,P,S,'1',W)$((NCAP_AFS(R,T,P,S,BD) > 0)$RTP_SAFS(R,T,P,S,W)) = RTP_SAFS(R,T,P,S,W)/NCAP_AFS(R,T,P,S,BD); - S_NCAP_AFS(R,T,P,ANNUAL(S),'1',W)$((NCAP_AFA(R,T,P,BD) > 0)$RTP_SAFS(R,T,P,S,W)) = RTP_SAFS(R,T,P,S,W)/NCAP_AFA(R,T,P,BD)); - OPTION CLEAR=RTP_SAFS; - RTP_SAFS(R,T,P,S,W)$S_NCAP_AFS(R,T,P,S,'1',W) = ROUND(S_NCAP_AFS(R,T,P,S,'1',W)-1,8); - OPTION CLEAR=S_NCAP_AFS; -$LABEL DIDAFS -* Process uncertain COM_FR -$IF NOT DEFINED S_COM_FR $GOTO DIDCOMFR - T0(T)=YES; T0('0')=YES; SW_T2W(SW_TSW(SOW,T,WW),T)=YES; SW_T2W(SW_TSW(SOW,T,WW),'0')$SW_TSTG(T,'2')=YES; - LOOP(J, RTCS_SFR(R,T,C,S,W,S) $= SUM(SW_MAP(T,W,J,WW),S_COM_FR(R,T,C,S,J,WW))); - RTCS_SFR(R,T,C,S,W,S)$RTCS_SFR(R,T,C,S,W,S) = RTCS_SFR(R,T,C,S,W,S)-1; - OPTION CLEAR=S_COM_FR; -* Fill down the multipliers - RTCSW(R,T,C,S+STOA(S),W)$RTCS_SFR(R,T,C,S,W,S) = YES; - RTCSW(R,T,C,S,W)$((COM_FR(R,T,C,S) > 0)$RTCSW(R,T,C,'ANNUAL',W)) = YES; - RTCS_SFR(RTCSW(R,T,C,S,W),S)$((NOT RTCS_SFR(RTCSW,S))$TS_GROUP(R,'WEEKLY',S)) = SUM(RS_BELOW1(R,TS,S),RTCS_SFR(R,T,C,TS,W,TS)); - RTCS_SFR(RTCSW(R,T,C,S,W),S)$((NOT RTCS_SFR(RTCSW,S))$TS_GROUP(R,'DAYNITE',S)) = SUM(RS_BELOW1(R,TS,S),RTCS_SFR(R,T,C,TS,W,TS)); -* Sum up COM_FR for all commodities that have it defined - FOR(Z=3 DOWNTO 1,LOOP(TSLVL$(ORD(TSLVL)=Z), - RTCS_SFR(RTCSW(R,T,C,S,W),S)$TS_GROUP(R,TSLVL,S) = - SUM(RS_BELOW1(R,S,TS),(1+RTCS_SFR(R,T,C,TS,W,TS))*COM_FR(R,T,C,TS))/COM_FR(R,T,C,S)-1; - )); - S_COM_FR(R,T,C,S,'1',W)$RTCSW(R,T,C,S,W) = (1+RTCS_SFR(R,T,C,S,W,S))/(1+RTCS_SFR(R,T,C,'ANNUAL',W,'ANNUAL'))-1; - OPTION CLEAR=RTCS_SFR; - RTCS_SFR(RTCSW(R,T,C,S,W),TS)$RS_BELOW(R,TS,S) = (1+RTCS_FRMX(R,T,C,S,TS))*(((1+S_COM_FR(R,T,C,S,'1',W))/MAX(1E-9,1+S_COM_FR(R,T,C,TS,'1',W)))-1); - RTCS_SFR(RTCSW(R,T,C,S,W),TS)$(ABS(RTCS_SFR(R,T,C,S,W,TS)) < 1E-9) = 0; - RTCS_SFR(R,LL--ORD(LL),C,S,W,TS)$SW_TSTG(LL,'2') $= RTCS_SFR(R,LL,C,S,W,TS); - RTCS_SFR(R,T,C,S,W,TS)$(SW_TSTG(T,'2')$RTCS_SFR(R,'0',C,S,W,TS)) = RTCS_SFR(R,T,C,S,W,TS)-RTCS_SFR(R,'0',C,S,W,TS); - OPTION RCS_SSFR <= RTCS_SFR; OPTION CLEAR=RTCSW,CLEAR=RTCS_SFR; -$LABEL DIDCOMFR diff --git a/source/times2veda.vdd b/source/times2veda.vdd deleted file mode 100644 index 638af4e..0000000 --- a/source/times2veda.vdd +++ /dev/null @@ -1,157 +0,0 @@ -* -* TIMES GDX2VEDA Set Directives -* - -[DataBaseName] - TIMES - -[Dimensions] - Attribute attr - Commodity c - Process p - Period t - Region r - Vintage v - TimeSlice s - UserConstraint uc_n - -[ParentDimension] - Region Commodity Process UserConstraint - -[Options] -SetsAllowed Commodity Process UserConstraint -*Scenario SCENCASE -*ValueDim 2 -not-0 var_fin var_fout var_act var_actm var_cap var_capm cost_flo cost_act eq_cumflo eq_combal eq_combalm - -[DataEntries] -* VEDA Attr GAMS - indexes - -*** Variables & Parameters - VAR_Act par_actl r v t p s - VAR_ActM par_actm r v t p s - VAR_Cap par_capl r t p - VAR_Cap par_pasti r t p v - VAR_CapM par_capm r t p - VAR_Ncap par_ncapl r t p - VAR_NcapM par_ncapm r t p - VAR_NcapR par_ncapr r t p uc_n - VAR_FIn f_in r v t p c s - VAR_FOut f_out r v t p c s - VAR_FOut agg_out r t c s - VAR_POut p_out r t p c s - VAR_POut par_rtcs r t c s - VAR_Comprd par_comprdl r t c s - VAR_ComprdM par_comprdm r t c s - VAR_Comnet par_comnetl r t c s - VAR_ComnetM par_comnetm r t c s - VAR_Eout par_eout r v t p c - VAR_CumCst par_cumcst r v t uc_n c -*** Equations - EQ_Combal eqg_combal.l r t c s - EQ_CombalM par_combalem r t c s - EQ_Combal eqe_combal.l r t c s - EQ_CombalM par_combalgm r t c s - EQ_Peak eq_peak.l r t c s - EQ_PeakM par_peakm r t c s - EQ_IreM par_ipric r t p c s uc_n - EQ_Cumflo par_cumflol r p c v t - EQ_CumfloM par_cumflom r p c v t -*** Parameters - PAR_Top par_top r t p c uc_n - PAR_CapLO par_caplo r t p - PAR_CapUP par_capup r t p - Cap_New Cap_New r v p t uc_n -*** Costs - Cost_Inv cst_invc r v t p uc_n - Cost_Invx cst_invx r v t p uc_n - Cost_Salv cst_salv r v p - Cost_Dec cst_decc r v t p - Cost_Fom cst_fixc r v t p - Cost_Fixx cst_fixx r v t p - Cost_Act cst_actc r v t p uc_n - Cost_Flo cst_floc r v t p c - Cost_Flox cst_flox r v t p c - Cost_Com cst_comc r t c - Cost_Comx cst_comx r t c - Cost_Els cst_come r t c - Cost_Dam cst_dam r t c - Cost_ire cst_irec r v t p c - Cost_NPV cst_pvp uc_n r p - Cost_NPV cst_pvc uc_n r c - Time_NPV cst_time r t s uc_n - Val_Flo val_flo r v t p c - ObjZ ObjZ.l - Reg_wobj reg_wobj r uc_n c - Reg_obj reg_obj r - Reg_irec reg_irec r - Reg_ACost reg_acost r t uc_n - User_con par_ucsl uc_n r t s - User_conFXM par_ucsm uc_n r t s - User_conFXM par_ucmrk r t uc_n c s - User_DynbM par_ucrtp uc_n r t p c - User_MaxBet par_ucmax uc_n r p c -*** Climate and MACRO - VAR_Climate CM_RESULT c t - Dual_clic CM_MAXC_M c t - VAR_Macro TM_RESULT c r t - -[DimensionTextAll] -* Gams_set_name Veda_Tab -adesc attr -uc_n uc_n -sysuc uc_n -costagg uc_n -pluset uc_n -in_out uc_n -impexp uc_n -uc_grptype c -othcom c -all_ts s -nonset s -modlyear v -pastcv v -milestonyr t -nonset t - -[ParentDimensionTextAll] -* Gams_set_name Veda_Tab -prc_desc r p -com_desc r c -reg_act r c - -[ParentSubSets] -* subset GAMS VEDA Tab -* processes - DMD DMD r p - PRE PRE r p - PRW PRW r p - PRV PRV r p - REF REF r p - ELE ELE r p - CHP CHP r p - HPL HPL r p - STG RP_STG r p - DISTR DISTR r p - IRE RP_IRE r p - XTRACT XTRACT r p - RENEW RENEW r p -* commodities - NRG NRG r c - DEM DEM r c - ENV ENV r c - MAT MAT r c - RES RES r c - COMM COMM r c - TRN TRN r c - AGR AGR r c - IND IND r c - OTH OTHD r c - ELC+ NRGELC r c - HET+ NRGHET r c - FOS+ NRGFOS r c - REN+ NRGREN r c - SYN+ NRGSYN r c - UC_Const uc_r_each r uc_n - UC_Const uc_const r uc_n - UC_DynBD uc_dynbd r uc_n - UC_MarkS uc_marks r uc_n diff --git a/source/times2veda_stc.vdd b/source/times2veda_stc.vdd deleted file mode 100644 index 2cef803..0000000 --- a/source/times2veda_stc.vdd +++ /dev/null @@ -1,148 +0,0 @@ -* -* TIMES GDX2VEDA Set Directives -* - -[DataBaseName] - TIMES - -[Dimensions] - Attribute attr - Sow w - Commodity c - Process p - Period t - Region r - Vintage v - TimeSlice s - UserConstraint uc_n - -[ParentDimension] - Region Commodity Process UserConstraint - -[Options] -SetsAllowed Commodity Process UserConstraint -*Scenario SCENCASE -not-0 var_fin var_fout var_act var_actm var_cap var_capm cost_flo cost_act eq_combal eq_combalm - -[DataEntries] -* VEDA Attr GAMS - indexes - -*** Variables & Parameters - VAR_Act spar_actl w r v t p s - VAR_ActM spar_actm w r v t p s - VAR_Cap spar_capl w r t p - VAR_Cap spar_pasti w r t p v - VAR_CapM spar_capm w r t p - VAR_Ncap spar_ncapl w r t p - VAR_NcapM spar_ncapm w r t p - VAR_NcapR spar_ncapr w r t p uc_n - VAR_FIn sf_in w r v t p c s - VAR_FOut sf_out w r v t p c s - VAR_FOut sagg_out w r t c s - VAR_POut sp_out w r t p c s - VAR_Comprd spar_comprdl w r t c s - VAR_ComprdM spar_comprdm w r t c s - VAR_Comnet spar_comnetl w r t c s - VAR_ComnetM spar_comnetm w r t c s - VAR_Eout spar_eout w r v t p c - VAR_CumCst spar_cumcst w r v t uc_n c -*** Equations - EQ_Combal spar_combalgm w r t c s - EQ_CombalM spar_combalem w r t c s - EQ_PeakM spar_peakm w r t c s - EQ_IreM spar_ipric w r t p c s uc_n - EQ_Cumflo spar_cumflol w r p c v t - EQ_CumfloM spar_cumflom w r p c v t -*** Parameters - PAR_Top par_top r t p c uc_n - PAR_CapLO spar_caplo w r t p - PAR_CapUP spar_capup w r t p - Cap_New SCap_New w r v p t uc_n -*** Costs - Cost_Inv scst_invc w r v t p uc_n - Cost_Invx scst_invx w r v t p uc_n - Cost_Dec scst_decc w r v t p - Cost_Fom scst_fixc w r v t p - Cost_Fixx scst_fixx w r v t p - Cost_Act scst_actc w r v t p uc_n - Cost_Flo scst_floc w r v t p c - Cost_Flox scst_flox w r v t p c - Cost_Com scst_comc w r t c - Cost_Comx scst_comx w r t c - Cost_Els scst_come w r t c - Cost_Dam scst_dam w r t c - Cost_ire scst_irec w r v t p c - Time_NPV scst_time w r t s uc_n - ObjZ ObjZ.l - Reg_wobj reg_wobj r uc_n c - Reg_obj sreg_wobj w r uc_n c - Reg_irec sreg_irec w r - Reg_ACost sreg_acost w r t uc_n - User_con spar_ucsl w uc_n r t s - User_conFXM spar_ucsm w uc_n r t s - User_DynbM spar_ucrtp w uc_n r t p c - User_MaxBet spar_ucmax w uc_n r p c -*** Climate module - VAR_Climate CM_SRESULT w c t - Dual_clic CM_SMAXC_M w c t - -[DimensionTextAll] -* Gams_set_name Veda_Tab -adesc attr -sow w -uc_n uc_n -sysuc uc_n -costagg uc_n -pluset uc_n -in_out uc_n -impexp uc_n -uc_grptype c -othcom c -all_ts s -nonset s -modlyear v -pastcv v -milestonyr t -nonset t - -[ParentDimensionTextAll] -* Gams_set_name Veda_Tab -prc_desc r p -com_desc r c -reg_act r c - -[ParentSubSets] -* subset GAMS VEDA Tab -* processes - DMD DMD r p - PRE PRE r p - PRW PRW r p - PRV PRV r p - REF REF r p - ELE ELE r p - CHP CHP r p - HPL HPL r p - STG RP_STG r p - DISTR DISTR r p - IRE RP_IRE r p - XTRACT XTRACT r p - RENEW RENEW r p -* commodities - NRG NRG r c - DEM DEM r c - ENV ENV r c - MAT MAT r c - RES RES r c - COMM COMM r c - TRN TRN r c - AGR AGR r c - IND IND r c - OTH OTHD r c - ELC+ NRGELC r c - HET+ NRGHET r c - FOS+ NRGFOS r c - REN+ NRGREN r c - SYN+ NRGSYN r c - UC_Const uc_r_each r uc_n - UC_Const uc_const r uc_n - UC_DynBD uc_dynbd r uc_n - UC_MarkS uc_marks r uc_n diff --git a/source/times2veda_v3.vdd b/source/times2veda_v3.vdd deleted file mode 100644 index c1ec0bc..0000000 --- a/source/times2veda_v3.vdd +++ /dev/null @@ -1,109 +0,0 @@ -* -* TIMES GDX2VEDA Set Directives -* - -[DataBaseName] - TIMES - -[Dimensions] - Attribute attr - Commodity c - Process p - Period t - Region r - Vintage v - TimeSlice s - UserConstraint uc_n - -[ParentDimension] - Region Commodity Process - -[Options] -SetsAllowed Commodity Process -*Scenario SCENCASE -*ValueDim 2 -not-0 var_fin var_fout var_act var_actm cost_flo cost_act - -[DataEntries] -* VEDA Attr GAMS - indexes - -*** Variables & Parameters - VAR_Act par_actl r v t p s - VAR_ActM par_actm r v t p s - VAR_Cap par_capl r t p - VAR_CapM par_capm r t p - VAR_Ncap par_ncapl r t p - VAR_NcapM par_ncapm r t p - VAR_FIn f_in r v t p c s - VAR_FOut f_out r v t p c s - VAR_Comprd par_comprdl r t c s - VAR_ComprdM par_comprdm r t c s - VAR_Comnet par_comnetl r t c s - VAR_ComnetM par_comnetm r t c s -*** Equations - EQ_Combal eqg_combal.l r t c s - EQ_CombalM par_combalem r t c s - EQ_Combal eqe_combal.l r t c s - EQ_CombalM par_combalgm r t c s - EQ_Peak eq_peak.l r t c s - EQ_PeakM par_peakm r t c s -*** Parameters - PAR_CapLO par_caplo r t p - PAR_CapUP par_capup r t p - PAR_Pasti par_pasti r t p -*** Costs - Cost_Inv cst_invv r v t p - Cost_Dec cst_decv r v t p - Cost_Salv cst_salv r v p - Cost_Late cst_latv r t p - Cost_FOM cst_fixv r v t p - Cost_Act cst_actv r v t p s - Cost_Flo cst_flov r v t p c s - Cost_Com cst_comv r t c s - Cost_Els cst_elsv r t c - Cost_Dam cst_dam r t c - ObjZ ObjZ.l - Reg_wobj reg_wobj r c uc_n - Reg_obj reg_obj r - User_conLOM par_uclom uc_n r t s - User_conUPM par_ucupm uc_n r t s - User_conFXM par_ucfxm uc_n r t s -*** Climate module - VAR_Climate CM_RESULT c t - Dual_clic CM_MAXC_M c t - -[DimensionTextAll] -* Gams_set_name Veda_Tab -adesc attr - - -[ParentDimensionTextAll] -* Gams_set_name Veda_Tab -prc_desc r p -com_desc r c - -[ParentSubSets] -* subset GAMS VEDA Tab -* processes - DMD DMD r p - PRE PRE r p - PRW PRW r p - PRV PRV r p - REF REF r p - ELE ELE r p - CHP CHP r p - HPL HPL r p - STG STG r p - DISTR DISTR r p - IRE RP_IRE r p -* commodities - NRG NRG r c - DEM DEM r c - ENV ENV r c - MAT MAT r c - RES RES r c - COMM COMM r c - TRN TRN r c - AGR AGR r c - NE NE r c - IND IND r c - diff --git a/source/timesrng.gms b/source/timesrng.gms deleted file mode 100644 index 4f188d7..0000000 --- a/source/timesrng.gms +++ /dev/null @@ -1,16 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). -*============================================================================* -* Create Ranging GDX at execution time -*============================================================================* -$ONWARNING -$ONMULTI -$OFFLISTING -$PHANTOM EMPTY -ALIAS (*,R,REG,ALLYEAR,P,RNGLIM); -ALIAS (*,C,COM,J,S,T,ALL_REG,IE,CUR,BD,OBV,LL); -ALIAS (*,COM_GRP,CG,ITEM,IO,UC_N,CM_VAR,CM_BOX); -ALIAS (*,PRC,KP,UNIT); -PARAMETER VAR_NCAPRNG(R,ALLYEAR,P,RNGLIM) / EMPTY.EMPTY.EMPTY.EMPTY 0 /; -$IF EXIST timesrng.inc $INCLUDE timesrng.inc -EXECUTE_UNLOAD 'timesrng',VAR_NCAPRNG; diff --git a/source/timslice.mod b/source/timslice.mod deleted file mode 100644 index 49e9029..0000000 --- a/source/timslice.mod +++ /dev/null @@ -1,121 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* Timslice.mod - Auxiliary timeslice preprocessing -*=============================================================================* -* complete timeslice declarations -* - all below ANNUAL -* - each individual to itself, including leaves -* - all TS below a node -*----------------------------------------------------------------------------- - SET RJLVL(J,R,TSLVL), RLUP(R,TSL,TSL); - PARAMETERS RS_HR(R,S) //, MY_SUM /0/, NORTS(R,YEAR,S) //; - SETS RS_UP(R,TS,J,TS), RJ_SL(R,J,TS,TS), JS(J,TS) /1.ANNUAL/; -*----------------------------------------------------------------------------- - TS_GROUP(ALL_R,'ANNUAL',S) = ANNUAL(S); - OPTION STOAL < TS_GROUP; - TS_MAP(R,ANNUAL,S) = STOAL(R,S); - TS_MAP(R,ALL_TS,TS)$SUM(TS_MAP(R,ALL_TS,S),TS_MAP(R,S,TS)) = YES; - TS_MAP(R,S,S) = STOAL(R,S); - STOAL(ALL_R,S)$STOAL(ALL_R,S) = STOAL(ALL_R,S)-1; - IF(CARD(STOAL),ABORT "Error: Timeslice on several levels."); -* Set for timeslices strictly below - RS_BELOW(TS_MAP(R,S,TS))$(NOT TS_MAP(R,TS,S)) = YES; -* Set for timeslices strictly ONE level below - RS_BELOW1(RS_BELOW(R,S,TS))$(SUM(TS_MAP(R,S,ALL_TS)$RS_BELOW(R,ALL_TS,TS),1)=1) = YES; -*----------------------------------------------------------------------------- -* Prepare dynamic timeslice tree -$ SET MX '(MIYR_1)' SETGLOBAL RTS S -$ IFI %OBMAC%%DYNTS%==YESYES -$ IF DEFINED TS_OFF $SET MX '' SETGLOBAL RTS S+NORTS(R,T,S) - SET TS_OFF //; - LOOP(RS_BELOW1(R,ANNUAL,S)$SUM(TS_OFF(R,S,BOHYEAR,EOHYEAR),1), -$ BATINCLUDE pp_off.mod TS_OFF S "" "NORTS(R,T%MX%,S)$(" 1 - IF(PROD(T%MX%,FIL(T)),G_YRFR(R,TS)$TS_MAP(R,S,TS) = 0; - ELSE NORTS(R,T(FIL%MX%),TS)$TS_MAP(R,S,TS) = -INF)); -$ IF %OBMAC%==YES $MACRO RTS(S) %RTS% -$ IF NOT %OBMAC%==YES ALIAS(ALL_TS,RTS); -*----------------------------------------------------------------------------- -* Set the annual year fraction to 1 - G_YRFR(ALL_R,ANNUAL) = 1; -* Complete missing year fractions if non-zero fractions are given for timeslices right below: - G_YRFR(R,S)$((G_YRFR(R,S)<=0)$TS_GROUP(R,'WEEKLY',S)) $= SUM(RS_BELOW1(R,S,TS),G_YRFR(R,TS)); - G_YRFR(R,S)$((G_YRFR(R,S)<=0)$TS_GROUP(R,'SEASON',S)) $= SUM(RS_BELOW1(R,S,TS),G_YRFR(R,TS)); - -*----------------------------------------------------------------------------- -* Remove timeslices that have a zero time fraction - LOOP(TSL,FINEST(R,S)$((G_YRFR(R,S)<=0)$TS_GROUP(R,TSL,S)) = YES); - TS_GROUP(R,TSL,S)$FINEST(R,S) = NO; - TS_MAP(R,TS,S)$FINEST(R,S) = NO; - RS_BELOW(R,TS,S)$FINEST(R,S) = NO; - RS_BELOW1(R,TS,S)$FINEST(R,S) = NO; - NORTS(R,T,S)$FINEST(R,S) = 0; - OPTION CLEAR=FINEST; -* Build a set for all timeslices in the same subtree - RS_TREE(R,S,TS)$(TS_MAP(R,TS,S) OR RS_BELOW(R,S,TS)) = YES; -* Define the set of the finest (highest) timeslices in use: - FINEST(R,S)$(SUM(TS_MAP(R,S,TS),1)=1) = YES; - LOOP(SAMEAS('5',J),RJLVL(J-ORD(TSL),R,TSL)=SUM(TS_GROUP(R,TSL,S),1)); -* Define above-map for TSL levels - LOOP((J,R,TSL)$RJLVL(J,R,TSL),Z=ORD(J);LOOP(RJLVL(JJ,R,TSLVL)$(ORD(JJ)>Z),RLUP(R,TSL,TSLVL)=1;Z=9)); -*----------------------------------------------------------------------------- - -* Target accuracy of fractions: 1 second - Z = 8760*3600; PUTGRP=0; -* Normalize year fractions if they do not sum up - LOOP(TS_GROUP(R,TSL,S)$(NOT FINEST(R,S)), - IF(ANNUAL(S)$CARD(NORTS), F=0; - LOOP(T,MY_F=1-SUM(RS_BELOW1(R,S,TS)$(RS_HR(R,TS)$(NORTS(R,T,TS)=0)),RS_HR(R,TS)); - MY_SUM = SUM(RS_BELOW1(R,S,TS)$((NOT RS_HR(R,TS))$(NORTS(R,T,TS)=0)),G_YRFR(R,TS)); - IF(MY_SUM*MY_F>0,RS_HR(R,TS)$((NORTS(R,T,TS)=0)$(NOT RS_HR(R,TS))$RS_BELOW1(R,S,TS))=MY_F/MY_SUM*G_YRFR(R,TS); - ELSEIF ABS(MY_F)>99/Z,ABORT 'Invalid dynamic Timeslice configuration'); F=MAX(F,ABS(MY_F-MY_SUM))); - G_YRFR(R,TS) $= RS_HR(R,TS); -* Get the year fraction of current timeslice and sum of those below - ELSE MY_F=G_YRFR(R,S); MY_SUM=SUM(RS_BELOW1(R,S,TS),G_YRFR(R,TS)); - F=ABS(MY_F-MY_SUM); IF(F*Z>1,G_YRFR(R,TS)$RS_BELOW1(R,S,TS)=MY_F/MY_SUM*G_YRFR(R,TS))); -* If the sum differs from the lump sum by over a second, do normalize: - IF(F*Z > 1, -$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'User-provided G_YRFR values are not valid year fractions' - PUT QLOG ' WARNING - TS fractions normalized, (R.TSL.S)=',TS_GROUP.TE(TS_GROUP); - )); -*----------------------------------------------------------------------------- -* Calculate the number of storage periods for each timeslice - G_CYCLE(TSL('WEEKLY'))$(G_CYCLE(TSL)=0)=8760/(24*7); TS_CYCLE(FINEST)=0; - LOOP(RLUP(R,TSLVL,TSL),TS_CYCLE(R,S)$((TS_CYCLE(R,S)<1)$TS_GROUP(R,TSL,S)) = 365/G_CYCLE(TSLVL)); - LOOP(TSL,RS_STGPRD(R,S)$TS_GROUP(R,TSL,S) = MAX(1,SUM(RS_BELOW1(R,TS,S),G_YRFR(R,TS)*365/TS_CYCLE(R,TS)))); - -* Timeslice level for all timeslices - LOOP(TSL, RS_TSLVL(R,S)$TS_GROUP(R,TSL,S) = TSLVLNUM(TSL)); -* Calculate the lead from previous storage timeslice for each timeslice - LOOP(TS_MAP(R,ANNUAL,S), F=0; - LOOP(RS_BELOW1(R,S,TS), IF(F, RS_STG(R,TS)=ORD(TS)-Z; Z=ORD(TS); ELSE Z=ORD(TS); F=Z)); - RS_STG(R,S+(F-ORD(S)))$F = F-Z;); -* Calculate average residence time for storage activity in each timeslice - LOOP((R,S,TS(S--RS_STG(R,S)))$RS_STGPRD(R,S),RS_STGAV(R,S) = (G_YRFR(R,S)+G_YRFR(R,TS))/2/RS_STGPRD(R,S)); - RS_STGAV(R,ANNUAL) = 1; - - OPTION STOAL2))))) - ) - -$LABEL END diff --git a/source/uc_cli.mod b/source/uc_cli.mod deleted file mode 100644 index f180c62..0000000 --- a/source/uc_cli.mod +++ /dev/null @@ -1,43 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UC_CLI the UC code associated with climate variables -* - %1 region summation index -* - %2 period summation index -* - %3 time-slice summation index -* - %4 'T' or 'T+1' index -* - %5 'LHS' or 'RHS' -* - %6 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) -*=============================================================================* -*[AL] Questions/Comments: -* - -*----------------------------------------------------------------------------- -$IF NOT DEFINED UC_CLI $EXIT -* "SUM(UC_R_SUM(R,UC_N)," or bracket ( -+ %1 -* "SUM(UC_T_SUM(UC_N,T)," or bracket ( - %2 -* "SUM(UC_TS_SUM(UC_N,S)," or bracket ( - %3 - SUM(CM_VAR$UC_CLI(UC_N,%5,R,%7,CM_VAR), UC_CLI(UC_N,%5,R,%7,CM_VAR) * - (%VAR%_CLITOT(CM_VAR,%4 %SOW%)$CM_KIND(CM_VAR) + - SUM(CM_BOXMAP(CM_KIND,CM_VAR,CM_BOX),%VAR%_CLIBOX(CM_VAR,%4 %SOW%))) * - -* [AL] PROD operator is useful here, but requires 'initialization' due to GAMS bug - PROD(ANNUAL,1) * -$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'CLI','GROWTH'), -$IF %6==1 POWER(ABS(UC_CLI(UC_N,%5,R,%7,CM_VAR)),%8*UC_SIGN(%5)-1)) * - PROD(UC_ATTR(R,UC_N,%5,'CLI','PERIOD'),FPD(%4)) - ) - -* closing bracket of %3 : - ) - -* closing bracket of %2 : - ) - -* closing bracket of %1 : - ) - diff --git a/source/uc_com.mod b/source/uc_com.mod deleted file mode 100644 index d8f55ce..0000000 --- a/source/uc_com.mod +++ /dev/null @@ -1,47 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UC_COMPD the code associated with the COMPRD variable in the EQ_USERCON -* - %1 region summation index -* - %2 period summation index -* - %3 time-slice summation index -* - %4 'T' or 'T+1' index -* - %5 'LHS' or 'RHS' -* - %6 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) -*=============================================================================* -*UR Questions/Comments: -* - -*----------------------------------------------------------------------------- - -*"SUM(UC_R_SUM(R,UC_N)," or bracket ( - %1 -* "SUM(UC_T_SUM(UC_N,T)," or bracket ( - %2 -* "SUM(UC_TS_SUM(UC_N,S)," or bracket ( - %3 - SUM(UC_GMAP_C(R,UC_N,'%9',C,UC_GRPTYPE), -$IF %6==2 (1+(FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS',UC_GRPTYPE,'PERDISC')-1)$UC_DT(R,UC_N)) * - SUM(RHS_COM%8(R,%4,C,TS)$RS_TREE(R,S,TS), - UC_COM(UC_N,'%9',%5,R,%7,C,TS,UC_GRPTYPE) * %VAR%_COM%9(R,%4,C,TS %SOW%)* - (1+(1/COM_IE(R,%4,C,TS)-1)$(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,'EFF') XOR DIAG(UC_GRPTYPE,'COM%9'))) * - -* [AL] PROD operator is useful here - PROD(ANNUAL,1)*PROD(RS_BELOW(R,TS,S),RS_FR(R,S,TS)*(1+RTCS_FR(R,%4,C,S,TS))) * -$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,'GROWTH'), -$IF %6==1 POWER(ABS(UC_COM(UC_N,'%9',%5,R,%7,C,TS,UC_GRPTYPE)),%11*UC_SIGN(%5)-1)) * -$IF %6==S (1/G_YRFR(R,S)) * - PROD(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,'PERIOD'),FPD(%4)) * - - PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,UC_COST),1), - SUM((UC_ATTR(R,UC_N,%5,UC_GRPTYPE,UC_COST),RDCUR(R,CUR)), - OBJ_COM%10(R,%4,C,TS,UC_COST,CUR))) - ) - ) -* closing bracket of %3 : - ) -* closing bracket of %2 : - ) -* closing bracket of %1 : - ) diff --git a/source/uc_flo.mod b/source/uc_flo.mod deleted file mode 100644 index 041359c..0000000 --- a/source/uc_flo.mod +++ /dev/null @@ -1,77 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UC_FLO the code associated with the flow variable in the EQ_USERCON -* - %1 region summation index -* - %2 period summation index -* - %3 time-slice summation index -* - %4 'T' or 'T+1' index -* - %5 'LHS' or 'RHS' -* - %6 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) -*=============================================================================* -*UR Questions/Comments: -* - -*----------------------------------------------------------------------------- -$IF %6==1 $SET VAR '%9' SET SOW %10 -*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" - %1 -* "SUM(UC_T_SUM(R,UC_N,T)," or bracket "(" - %2 -$IF %6==2 (1+(FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','FLO','PERDISC')-1)$UC_DT(R,UC_N)) * -$IF %6==S (1/G_YRFR(R,S)) * -* "SUM(UC_TS_SUM(R,UC_N,S)," or bracket "(" - %3 - SUM((RTP_VINTYR(R,V,%4,P),UC_MAP_FLO(UC_N,%5,R,P,C),RTPCS_VARF(R,%4,P,C,TS))$RS_FR(R,S,TS), - %11(%12 -*V0.9a S reference should be TS -* [UR] model reduction %REDUCE% is set in *.run -$ BATINCLUDE %cal_red% C COM TS P %4 - * UC_FLO(UC_N,%5,R,%7,P,C,TS) * -*GG* use the derived multipier -* [AL] PROD operator is useful here, but must be activated due to a GAMS bug: - PROD(ANNUAL,1)*PROD(RS_BELOW(R,TS,S),RS_FR(R,S,TS)*(1+RTCS_FR(R,%4,C,S,TS))) * - -$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'FLO','GROWTH'), -$IF %6==1 POWER(ABS(UC_FLO(UC_N,%5,R,%7,P,C,TS)),%8*UC_SIGN(%5)-1)) * - PROD(UC_ATTR(R,UC_N,%5,'FLO',UC_PERDS),FPD(%4) * - PROD(UC_NEWFLO(UC_PERDS),1$(SAMEAS(V,%4)+RVPT(R,V,P,%4))/FPD(%4))) * - - PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,'FLO',UC_COST),1), - SUM((RDCUR(R,CUR),TS_ANN(TS,SL)), - OBJ_FCOST(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','COST') - +OBJ_FDELV(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','DELIV') - +MIN(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','SUB') - +MAX(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','TAX'))) - ) - ) + - - SUM(UC_CAPFLO(UC_N,%5,R,P,C), -$ BATINCLUDE cal_caps.mod %4 "UC_FLO(UC_N,%5,R,%7,P,C,TS)" TS - * -$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'FLO','GROWTH'), -$IF %6==1 SUM(RPCS_VAR(R,P,C,TS),RS_FR(R,TS,S)*POWER(ABS(UC_FLO(UC_N,%5,R,%7,P,C,TS)),%8*UC_SIGN(%5)-1))) * - PROD(UC_ATTR(R,UC_N,%5,'FLO',UC_PERDS),FPD(%4)$(NOT UC_NEWFLO(UC_PERDS))) * - - PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,'FLO',UC_COST),1), - SUM(RPCS_VAR(R,P,C,TS),RS_FR(R,TS,S) * - SUM((RDCUR(R,CUR),TS_ANN(TS,SL)), - OBJ_FCOST(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','COST') - +OBJ_FDELV(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','DELIV') - +MIN(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','SUB') - +MAX(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','TAX')))) - ) - - -* closing bracket of %3 : - ) - -* closing bracket of %2 : - ) - -* closing bracket of %1 : - ) - -* Add Cumflos -$IF %6==2 +SUM((%8RPC_CUMFLO(R,P,C,ALLYEAR,LL))$UC_CUMFLO(UC_N,R,P,C,ALLYEAR,LL),UC_CUMFLO(UC_N,R,P,C,ALLYEAR,LL)*%VAR%_CUMFLO(R,P,C,ALLYEAR,LL %SWT%)*%CUFSCAL%) diff --git a/source/uc_ire.mod b/source/uc_ire.mod deleted file mode 100644 index de303aa..0000000 --- a/source/uc_ire.mod +++ /dev/null @@ -1,58 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UC_IRE the code associated with the IRE variable in the EQ_USERCON -* - %1 region summation index -* - %2 period summation index -* - %3 time-slice summation index -* - %4 'T' or 'T+1' index -* - %5 'LHS' or 'RHS' -*=============================================================================* -*UR Questions/Comments: -* - -*----------------------------------------------------------------------------- - -*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" - %1 -* "SUM(UC_T_SUM(R,UC_N,T)," or bracket "(" - %2 -$IF %6==2 (1+(FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','IRE','PERDISC')-1)$UC_DT(R,UC_N)) * -* "SUM(UC_TS_SUM(R,UC_N,S)," or bracket "(" - %3 -*[UR]: RPC_IRE comtrol may be redundant, only necessary if UC_IRE givrn for non-exchange processes by mistake - SUM((RTP_VINTYR(R,V,%4,P),UC_MAP_IRE(UC_N,R,P,C,IE),RTPCS_VARF(R,%4,P,C,TS))$RS_FR(R,S,TS), - ( - -* [UR] model reduction %REDUCE% is set in *.run - (%VAR%_IRE(R,V,%4,P,C,TS,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,%4,P,TS %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) - * UC_IRE(UC_N,%5,R,%7,P,C,TS,IE) * -*GG* use the derived multipier -* [AL] PROD operator is useful here, but must be activated due to a GAMS bug: - PROD(ANNUAL,1)*PROD(RS_BELOW(R,TS,S),RS_FR(R,S,TS)*(1+RTCS_FR(R,%4,C,S,TS))) * - -$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'IRE','GROWTH'), -$IF %6==1 POWER(ABS(UC_IRE(UC_N,%5,R,%7,P,C,TS,IE)),%8*UC_SIGN(%5)-1)) * -$IF %6==S (1/G_YRFR(R,S)) * - PROD(UC_ATTR(R,UC_N,%5,'IRE',UC_PERDS),FPD(%4) * - PROD(UC_NEWFLO(UC_PERDS),1$(SAMEAS(V,%4)+RVPT(R,V,P,%4))/FPD(%4))) * - - PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,'IRE',UC_COST),1), - SUM((RDCUR(R,CUR),TS_ANN(TS,SL)), - OBJ_FCOST(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'IRE','COST') - +OBJ_FDELV(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'IRE','DELIV') - +MIN(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'IRE','SUB') - +MAX(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'IRE','TAX'))) - ) - ) - -* closing bracket of %3 : - ) - -* closing bracket of %2 : - ) - -* closing bracket of %1 : - ) - diff --git a/source/uc_ncap.mod b/source/uc_ncap.mod deleted file mode 100644 index a63d540..0000000 --- a/source/uc_ncap.mod +++ /dev/null @@ -1,51 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UC_NCAP the code associated with the flow variable in the EQ_USERCON -* - %1 region summation index -* - %2 period summation index -* - %3 'T' or 'T+1' index -* - %4 'LHS' or 'RHS' -* - %5 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) -*=============================================================================* -*UR Questions/Comments: -* - -*----------------------------------------------------------------------------- -*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" - %1 - -* UR 05/15/00 -* SUM(UC_GRP$( UC_GMAP(R,UC_N,'NCAP',UC_GRP)*%4 ), - -* "SUM(UC_T_SUM(UC_N,T)," or bracket "(" - %2 -* [AL] VAR_NCAP(R,%3,P) can be active even if there is no RTP_CPTYR(R,V,T,P) (due to ILED)! -* [AL] Therefore, changed to check for RTP(R,%3,P) without RTP_OFF(R,%3,P) -* SUM((P,CUR)$(UC_GMAP_P(R,UC_N,'NCAP',P)*SUM(V,RTP_CPTYR(R,V,T,P))), - SUM(UC_GMAP_P(R,UC_N,'NCAP',P)$RTP(R,%3,P), UC_NCAP(UC_N,%4,R,%6,P) * - (%VAR%_NCAP(R,%3,P %SOW%)$(NOT RTP_OFF(R,%3,P)) + - (SUM(RVPT(R,V,P,%3),%VARV%_NCAP(R,V,P %SWS%)) + %VAR%_NCAP(R,%3,P %SOW%) * - (COEF_RPTI(R,%3,P)-PROD(RVPT(R,%3,P,MILESTONYR),2)))$UC_ATTR(R,UC_N,%4,'NCAP','PERIOD')) * - -* [AL] PROD operator is useful here, but needs to be 'tweaked' due to a bug in GAMS 21.3-21.4: -$IF %5==1 PROD(UC_ATTR(R,UC_N,%4,'NCAP','GROWTH'), -$IF %5==1 POWER(ABS(UC_NCAP(UC_N,%4,R,%6,P)),%7*UC_SIGN(%4)-1)) * - PROD(UC_ATTR(R,UC_N,%4,'NCAP','BUILDUP'),1/LEAD(%3)) * - - PROD(L('N'),PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%4,'NCAP',UC_COST),1), - SUM(RDCUR(R,CUR), -$IF NOT %3==%6 SUM(UC_ATTR(R,UC_N,%4,'NCAP',UC_ANNUL),CST_ANNC(R,%3,P,%6,UC_ANNUL,CUR))+ - OBJ_ICOST(R,%3,P,CUR)$UC_ATTR(R,UC_N,%4,'NCAP','COST') - +OBJ_ITAX(R,%3,P,CUR)$UC_ATTR(R,UC_N,%4,'NCAP','TAX') - -OBJ_ISUB(R,%3,P,CUR)$UC_ATTR(R,UC_N,%4,'NCAP','SUB')))) - - ) - -* closing bracket of %2 : - ) - -* closing bracket of %1 : - ) - diff --git a/source/uc_pasti.mod b/source/uc_pasti.mod deleted file mode 100644 index 69af228..0000000 --- a/source/uc_pasti.mod +++ /dev/null @@ -1,33 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UC_PASTI code associated with first period capacity in GROWTH constraint -* - %1 region summation index -* - %2 period summation index (MIYR_1) -* - %3 T index -* - %4 'LHS' or 'RHS' -*=============================================================================* -*AL Questions/Comments: -* - Possible bound attributes are for now ignored for PASTI -*----------------------------------------------------------------------------- -*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" - %1 - -*[AL] Sum over RTP that have UC_CAP specified on current side - SUM(RTP(R,%3,P)$UC_GMAP_P(R,UC_N,'CAP',P), - -* Sum of PASTI inherited to first period is used as a capacity value for T-1 of MIYR_1(T) -* UC_CAP coefficient is taken from MIYR_1, because UC_CAP is interpolated on T only - SUM(RTP_CPTYR(R,PASTYEAR,%3,P),COEF_CPT(R,PASTYEAR,%3,P)*NCAP_PASTI(R,PASTYEAR,P)) * - UC_CAP(UC_N,%4,R,%3,P) * -* [AL] PROD operator is useful here, but needs to be 'initialized' due to a GAMS bug: - PROD(SIDE(%4),PROD(UC_ATTR(R,UC_N,SIDE,'CAP','GROWTH'), - POWER(ABS(UC_CAP(UC_N,%4,R,%3,P)),M(%3)-B(%3)))) - - ) - -* closing bracket of %1 : - )$SUM(%2(%3),1) - diff --git a/source/ucbet.vda b/source/ucbet.vda deleted file mode 100644 index 5caafac..0000000 --- a/source/ucbet.vda +++ /dev/null @@ -1,129 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UCBET.vda Derivation of maximum activities and flows according to UCBET * -* %1 - mod or v# for the source code to be used * -*=============================================================================* -* Questions/Comments: -*----------------------------------------------------------------------------- -* Preprocessing of UC_FLOBET: - SET UC_GMAX(UC_N,ALL_R,ITEM,C,ITEM); - SET UC_GMAXR(ALL_R,UC_N); - ALIAS(*,NAME); - -* Collect set of all regional cumulative UC_N - OPTION CLEAR=UNCD1; - LOOP((UC_N,R,T,P,C)$UC_FLOBET(UC_N,R,T,P,C),UNCD1(UC_N)=YES); - UC_GMAXR(UC_R_EACH) = YES; - UC_R_SUM(R,UC_N(UNCD1)) = YES; - -* Set Equation controls - LOOP((UC_N,R,T,P,C)$UC_FLOBET(UC_N,R,T,P,C), - IF(SAMEAS(%PGPRIM%,C), - IF(UC_ATTR(R,UC_N,'LHS','ACT','N'), - UC_GMAX(UC_N,'IMPEXP',P,C,'EACH') = YES; - ELSE UC_GMAX(UC_N,R,P,C,'EACH') = YES); - ELSE - IF(UC_GMAXR(R,UC_N), UC_GMAX(UC_N,R,'N',C,'N') = YES; - ELSE UC_GMAX(UC_N,'IMPEXP','N',C,'N') = YES); - )); - -* If IMPEXP should be one group, add IMPEXP for regional UC_N - LOOP(R,UC_GMAXR('IMPEXP',UC_N)$UC_GMAXR(R,UC_N) = YES); -* Remove all (ALL_R,UC_N) not used in betting parameters - OPTION CLEAR=RXX; - LOOP(UC_GMAX(UC_N,ALL_R,ITEM,C,NAME),RXX('IMPEXP',UC_N,ALL_R) = YES); - UC_GMAXR(ALL_R,UC_N)$(NOT RXX('IMPEXP',UC_N,ALL_R)) = NO; -* Remove EQE_UC equations for maxed UC_N - UC_TS_SUM(R,UC_N(UNCD1),S) = NO; - -*----------------------------------------------------------------------------- -* EQUATIONS -*----------------------------------------------------------------------------- - - %EQ%G_UCMAX(UC_GMAX(UC_N,ALL_R,ITEM,C,NAME)%SOW%) .. - -* Select variable to be maximized (remove SUM if IMPEXP group allowed) - - %VAR%_UC(UC_N%SOW%)$(NOT UC_GMAXR(ALL_R,UC_N)) + - SUM(R(ALL_R),%VAR%_UCR(UC_N,R%SOW%)$UC_GMAXR(ALL_R,UC_N)) - - =G= - -$IF %STAGES%==YES $SETLOCAL ORGSOW '%SOW%' SET SWTD ",SW_TSW(SOW,T,W)" SET SOW ,W - -* Sum of flows by region - SUM((UC_T_SUM(UC_GMAXR(R(ALL_R),UC_N),T)%SWTD%), -*....Time Mutiplier - (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * - SUM(RTPCS_VARF(R,T,P,COM,S)$(COM_GMAP(R,C,COM)$UC_FLOBET(UC_N,R,T,P,C)), - UC_FLOBET(UC_N,R,T,P,C) * - SUM(RTP_VINTYR(R,V,T,P), - ( -$ BATINCLUDE %cal_red% COM COM1 S P T - )$RP_STD(R,P) + -*....For IRE processes, sum Import flows only - SUM(RPC_IRE(R,P,COM,IE('IMP')), - %VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM)) + - (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))$RP_IRE(R,P) - )))$LIM(NAME) + - -* Sum of flows globally - SUM((UC_T_SUM(R,UC_N,T)%SWTD%)$(NOT UC_GMAXR(R,UC_N)), -*....Time Mutiplier - (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * - SUM(RTPCS_VARF(R,T,P,COM,S)$(COM_GMAP(R,C,COM)$UC_FLOBET(UC_N,R,T,P,C)), - UC_FLOBET(UC_N,R,T,P,C) * - SUM(RTP_VINTYR(R,V,T,P), - ( -$ BATINCLUDE %cal_red% COM COM1 S P T - )$RP_STD(R,P) + -*....For IRE processes, sum Import flows only - SUM(RPC_IRE(R,P,COM,IE('IMP')), - %VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM)) + - (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))$RP_IRE(R,P) - )))$((NOT REG(ALL_R))$LIM(NAME)) + - -* Sum of activities by region - SUM((UC_T_SUM(R(ALL_R),UC_N,T)%SWTD%), -*....Time Mutiplier - (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * - SUM(RTP_VINTYR(R,V,T,P(ITEM))$UC_FLOBET(UC_N,R,T,P,%PGPRIM%), - UC_FLOBET(UC_N,R,T,P,%PGPRIM%) * - ( -*........For Standard processes, sum activities - SUM((RTP_VARA(R,T,P),PRC_TS(R,P,S)), %VAR%_ACT(R,V,T,P,S%SOW%))$RP_STD(R,P) + -*........For IRE processes, sum Import flows only - SUM((RPC_IRE(R,P,COM,IE('IMP')),RTPCS_VARF(R,T,P,COM,S)), - (%VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ - (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM)))$RP_IRE(R,P) - )) - )$UC_NUMBER(NAME) + - -* Sum of activities globally - SUM((UC_T_SUM(R,UC_N,T)%SWTD%)$(NOT REG(ALL_R)), -*....Time Mutiplier - (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * - SUM(RTP_VINTYR(R,V,T,P(ITEM))$UC_FLOBET(UC_N,R,T,P,%PGPRIM%), - UC_FLOBET(UC_N,R,T,P,%PGPRIM%) * - ( -*........For Standard processes, sum activities - SUM((RTP_VARA(R,T,P),PRC_TS(R,P,S)), %VAR%_ACT(R,V,T,P,S%SOW%))$RP_STD(R,P) + -*........For IRE processes, sum Import flows only - SUM((RPC_IRE(R,P,COM,IE('IMP')),RTPCS_VARF(R,T,P,COM,S)), - (%VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ - (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM)))$RP_IRE(R,P) - )) - )$((NOT REG(ALL_R))$UC_NUMBER(NAME)) - -; -$IF %STAGES%==YES $SET SOW %ORGSOW% -*----------------------------------------------------------------------------- -* Sum regional maximums to global (change R to ALL_R if IMPEXP allowed) - %EQ%G_UCSUMAX(UC_N%SOW%)$SUM(UC_GMAXR(ALL_R,UC_N),1) .. - - %VAR%_UC(UC_N%SOW%) =G= SUM(UC_GMAXR(R,UC_N),%VAR%_UCR(UC_N,R%SOW%)); - -*----------------------------------------------------------------------------- diff --git a/source/units.def b/source/units.def deleted file mode 100644 index d5e9153..0000000 --- a/source/units.def +++ /dev/null @@ -1,17 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*=============================================================================* -* UNITS.DEF has complete list of unit types * -*=============================================================================* - -* units by group - SET UNITS 'Units' / Bv-km, Bv-kma, GW, Mt, Mta, kt, t, PJ, PJa, TJ, uvol, CUR, GPKM, GVKM, Mcar, UCU / - ALIAS(UNITS,U); - SET UNITS_COM(UNITS) 'Commodity Units' / Bv-km, Mt, kt, t, PJ, TJ, uvol, GPKM, GVKM, UCU / - SET UNITS_CAP(UNITS) 'Capacity Units' / PJa, GW, Mta, Bv-kma, Mcar / - SET UNITS_ACT(UNITS) 'Activity Units' / Mt, kt, PJ, TJ, GPKM, GVKM / - SET UNITS_MONY(UNITS) 'Monatary Units' / CUR / - -* unit mapping table(s) diff --git a/source/writeddf.msa b/source/writeddf.msa deleted file mode 100644 index 781bbe0..0000000 --- a/source/writeddf.msa +++ /dev/null @@ -1,82 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================== -* TIMES MACRO/MSA DDF Writing utility -*============================================================================== - -FILE DDFFILE /%1.DD/; -PUT DDFFILE; -* make 7 decimals points and allow for wider page -DDFFILE.NW=15;DDFFILE.ND=7;DDFFILE.PW=255; - -* Output updated value of TM_EC0 -PUT 'PARAMETER TM_EC0(R) /' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_EC0(R) /); -PUT '/;' /; -IF(CARD(TM_AMP),PUT 'PARAMETER TM_AMP(R,ALLYEAR) /' /; -LOOP((MR(R),T)$TM_AMP(R,T), PUT @1 R.TL:0,".":0,T.TL:0, TM_AMP(R,T) /); -PUT '/;' /); -* Output updated value of TM_GROWV -PUT "PARAMETER TM_GROWV(R,ALLYEAR) /" /; -LOOP((MR(R),T)$TM_GROWV(R,T), PUT R.TL:0,".":0, T.TL:0, TM_GROWV(R,T) /); -PUT '/;' /; -* Output calibrated Baseline GDP GROWth -PUT "PARAMETER TM_GR(R,ALLYEAR) /" /; -LOOP((MR(R),T)$PAR_GRGDP(R,T), PUT R.TL:0,".":0, T.TL:0, %2(R,T) /); -PUT '/;' /; -* Output calibrated Baseline IV -PUT "PARAMETER PAR_IV(R,ALLYEAR) /" /; -LOOP((MR(R),T)$PAR_IV(R,T), PUT R.TL:0,".":0, T.TL:0, PAR_IV(R,T) /); -PUT '/;' /; -* Output calibrated Baseline Discount Factors -IF(CARD(TM_UDF),PUT "PARAMETER TM_UDF(R,ALLYEAR) /" /; -LOOP((MR(R),T)$TM_UDF(R,T), PUT R.TL:0,".":0, T.TL:0, TM_UDF(R,T) /); -PUT '/;' /); -* -* output the PREFs -PUT "PARAMETER TM_DDATPREF(R,C) /" /; -LOOP(DEM(MR(R),C)$TM_DDATPREF(R,C), PUT R.TL:0,".":0,C.TL:0, TM_DDATPREF(R,C) /;); -PUT "/;" /; - -* output the DDFs -PUT "PARAMETER TM_DDF(R,ALLYEAR,C) /" /; -LOOP((MR(R),T,DM(C))$TM_DDF(R,T,DM), -PUT PUT R.TL:0,".":0,T.TL:0,".":0,C.TL:0, TM_DDF(R,T,C) /;); -PUT "/;" /; - -PUT / @1,'SCALAR TM_ARBM' / @1 '/' /; -PUT @1 TM_ARBM / @1 '/;'; - -PUT / @1,'SCALAR TM_SCALE_UTIL' / @1 '/' /; -PUT @1 TM_SCALE_UTIL / @1 '/;'; - -PUT / @1,'SCALAR TM_SCALE_CST' / @1 '/' /; -PUT @1 TM_SCALE_CST / @1 '/;'; - -PUT / @1,'SCALAR TM_SCALE_NRG' / @1 '/' /; -PUT @1 TM_SCALE_NRG / @1 '/;'; - -PUT / @1,'PARAMETER TM_KGDP(R)' / @1 '/' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_KGDP(R) / @1 '/;'); - -PUT / @1,'PARAMETER TM_KPVS(R)' / @1 '/' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_KPVS(R) / @1 '/;'); - -PUT / @1,'PARAMETER TM_DEPR(R)' / @1 '/' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_DEPR(R) / @1 '/;'); - -PUT / @1,'PARAMETER TM_ESUB(R)' / @1 '/' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_ESUB(R) / @1 '/;'); - -PUT / @1,'PARAMETER TM_GDP0(R)' / @1 '/' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_GDP0(R) / @1 '/;'); - -PUT / @1,'PARAMETER TM_DMTOL(R)' / @1 '/' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_DMTOL(R) / @1 '/;'); - -PUT / @1,'PARAMETER TM_IVETOL(R)' / @1 '/' /; -LOOP(MR(R), PUT @1 R.TL:0, TM_IVETOL(R) / @1 '/;'); - -PUTCLOSE DDFFILE; \ No newline at end of file diff --git a/source/wrtbprice.mod b/source/wrtbprice.mod deleted file mode 100644 index 79502c4..0000000 --- a/source/wrtbprice.mod +++ /dev/null @@ -1,35 +0,0 @@ -*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 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). -*============================================================================== -* Saving shadow prices of commodity balances to be used as base prices -* for elastic demands into gdx files com_bprice.gdx & _DP.dgx -*============================================================================== - PARAMETER DINV(R,YEAR,CUR) //; - PARAMETER SOL_BPRICE(REG,ALLYEAR,COM,ALL_TS,CUR) //; - PARAMETER SOL_ACFR(R,UC_COST,YEAR) //; - SET ANCAT(UC_COST,ITEM) / COST.(INV, FIX, VAR, DAM), TAX.(INVX, FIXX, VARX) /; -*------------------------------------------------------------------------------ -* Undiscounting via matrix inversion currently disabled; using direct method - DINV(R,T,CUR)$G_RCUR(R,CUR) = 1/COEF_PVT(R,T); - - SOL_BPRICE(R,T,C,S,CUR)$(RCS_COMBAL(R,T,C,S,'LO')$DEM(R,C)) = DINV(R,T,CUR)*EQG_COMBAL.M(R,T,C,S); - SOL_BPRICE(R,T,C,S,CUR)$(RCS_COMBAL(R,T,C,S,'FX')$DEM(R,C)) = DINV(R,T,CUR)*EQE_COMBAL.M(R,T,C,S); - -* Check elastic supply curve requests -$ IF DEFINED DAM_ELAST TRACKC(RC)$((NOT DAM_BQTY(RC))$DAM_ELAST(RC,'N')) = YES; -$ IF DEFINED DAM_COST LOOP((R,T,C,CUR)$DAM_COST(R,T,C,CUR), TRACKC(R,C) = NO); - OPTION CLEAR=DAM_COEF,CLEAR=DAM_TVOC; - DAM_COEF(RTCS_VARC(R,T,C,S))$TRACKC(R,C) = EQE_COMPRD.M(R,T,C,S)/COEF_PVT(R,T)+EPS; - DAM_TVOC(RTC(R,T,C),'N')$TRACKC(R,C) = SUM(RTCS_VARC(RTC,S),DAM_COEF(RTC,S)*VAR_COMPRD.L(RTC,S)); - -* Save also annual cost to expenditure ratios for TIMES CGE calibration - RB(R,T) = SUM((COM_TS(DEM(R,C),S),RDCUR(R,CUR)),SOL_BPRICE(R,T,C,S,CUR)*COM_FR(R,T,C,S)*COM_PROJ(R,T,C))+1-1; -$ IFI NOT %STAGES%==YES -$ IFI %ANNCOST%==LEV SOL_ACFR(R,UC_COST,T)$RB(R,T)=SUM(SYSUCMAP(SYSUC,ITEM)$ANCAT(UC_COST,ITEM),REG_ACOST(R,T,SYSUC)) / RB(R,T); - OPTION CLEAR=RB,CLEAR=TRACKC; - - EXECUTE_UNLOAD 'com_bprice',sol_bprice,DAM_COEF,DAM_TVOC,SOL_ACFR; - EXECUTE_UNLOAD '%GDXPATH%%RUN_NAME%_DP',sol_bprice,DAM_COEF,DAM_TVOC,SOL_ACFR; -*------------------------------------------------------------------------------ From 81ba35b7b704abb365afa3e44b9bde50b2c76277 Mon Sep 17 00:00:00 2001 From: Olexandr Balyk Date: Thu, 11 Jan 2024 22:23:12 -0500 Subject: [PATCH 2/3] Squashed 'source/' content from commit 0b38d80 git-subtree-dir: source git-subtree-split: 0b38d80b421cd1120bdee247089e4524665fef43 --- .gitattributes | 38 + .github/ISSUE_TEMPLATE/bug_report.md | 34 + .github/ISSUE_TEMPLATE/feature_request.md | 22 + .zenodo.json | 19 + AUTHORS.md | 37 + COPYING.txt | 621 +++++ Contributing.md | 31 + NOTICE-GPLv3.txt | 17 + README.md | 61 + Version-Old.rar | Bin 0 -> 18364 bytes Version.log | 2830 +++++++++++++++++++++ _times.g00 | Bin 0 -> 6545 bytes atlearn.etl | 140 + atlearn1.etl | 57 + atlearn8.etl | 44 + atlearn9.etl | 78 + atsc.etl | 68 + bnd_act.mod | 26 + bnd_cum.mod | 48 + bnd_elas.mod | 40 + bnd_flo.mod | 40 + bnd_ire.vda | 39 + bnd_macro.tm | 38 + bnd_set.mod | 34 + bnd_stg.mod | 27 + bnd_ucv.mod | 97 + bnd_ucw.mod | 25 + bndmain.mod | 87 + cal_cap.mod | 28 + cal_caps.mod | 29 + cal_fflo.mod | 52 + cal_ire.mod | 43 + cal_nored.red | 30 + cal_red.red | 59 + cal_stgn.mod | 23 + calibase.mlf | 118 + clearsol.stc | 41 + clearsol.stp | 34 + coef_alt.lin | 161 ++ coef_cpt.mod | 63 + coef_csv.mod | 77 + coef_ext.abs | 112 + coef_ext.cli | 199 ++ coef_ext.etl | 74 + coef_ext.vda | 74 + coef_nio.mod | 72 + coef_obj.mod | 205 ++ coef_ptr.mod | 53 + coef_shp.mod | 75 + coefmain.mod | 29 + cost_ann.rpt | 208 ++ curex.gms | 81 + ddfupd.msa | 46 + dumpsol.mod | 28 + dumpsol1.mod | 204 ++ dumpsolv.mod | 92 + dynslite.vda | 115 + eqactbnd.mod | 29 + eqactflo.mod | 31 + eqactups.vda | 156 ++ eqashar.vda | 78 + eqblnd.mod | 71 + eqbndcom.mod | 25 + eqbndcst.mod | 215 ++ eqcaflac.vda | 60 + eqcapact.mod | 52 + eqcapvac.mod | 30 + eqchpelc.ier | 55 + eqcombal.mod | 114 + eqcpt.mod | 28 + eqcumcom.mod | 34 + eqcumflo.mod | 48 + eqdamage.mod | 161 ++ eqdeclr.mod | 195 ++ eqdeclr.tm | 77 + eqflobnd.mod | 45 + eqflofr.mod | 27 + eqflomrk.mod | 104 + eqfloshr.mod | 42 + eqire.mod | 55 + eqirebnd.mod | 70 + eqlducs.vda | 175 ++ eqmacro.tm | 137 + eqmain.mod | 254 ++ eqmrkcom.ier | 94 + eqobj.mod | 125 + eqobj.tm | 64 + eqobjann.tm | 100 + eqobjcst.tm | 63 + eqobjels.mod | 51 + eqobjels.rpt | 37 + eqobjfix.mod | 227 ++ eqobjfix.rpt | 60 + eqobjinv.mod | 324 +++ eqobjinv.rpt | 69 + eqobjvar.mod | 113 + eqobjvar.rpt | 181 ++ eqobsalv.mod | 143 ++ eqobsalv.rpt | 74 + eqpeak.mod | 88 + eqpk_ect.ier | 11 + eqptrans.mod | 41 + eqstgaux.lin | 43 + eqstgaux.mod | 44 + eqstgflo.mod | 31 + eqstgips.lin | 68 + eqstgips.mod | 46 + eqstgtss.mod | 95 + equ_ext.abs | 204 ++ equ_ext.cli | 109 + equ_ext.dsc | 33 + equ_ext.ecb | 48 + equ_ext.etl | 76 + equ_ext.ier | 48 + equ_ext.mlf | 182 ++ equ_ext.msa | 117 + equ_ext.vda | 105 + equcrtp.vda | 124 + equcwrap.mod | 42 + equserco.mod | 122 + eqxbnd.mod | 59 + err_stat.mod | 73 + fillcost.gms | 43 + fillparm.gms | 57 + fillsow.stc | 47 + fillvint.gms | 35 + fillwave.gms | 21 + filparam.gms | 43 + filshape.gms | 26 + forcupd.cli | 33 + gdxfilter.gms | 30 + globals.def | 16 + init_ext.abs | 32 + init_ext.dsc | 20 + init_ext.vda | 152 ++ initmty.abs | 56 + initmty.cli | 123 + initmty.dsc | 17 + initmty.etl | 66 + initmty.ier | 23 + initmty.mlf | 62 + initmty.mod | 500 ++++ initmty.msa | 117 + initmty.stc | 82 + initmty.tm | 56 + initmty.vda | 66 + initsys.mod | 187 ++ main_ext.mod | 23 + maindrv.mod | 133 + maplists.def | 122 + mod_equa.mod | 216 ++ mod_equa.tm | 91 + mod_ext.abs | 28 + mod_ext.cli | 13 + mod_ext.dsc | 12 + mod_ext.etl | 21 + mod_ext.ier | 18 + mod_ext.vda | 52 + mod_vars.abs | 54 + mod_vars.cli | 26 + mod_vars.dsc | 19 + mod_vars.etl | 39 + mod_vars.mod | 96 + mod_vars.msa | 34 + mod_vars.tm | 57 + par_uc.rpt | 20 + pextlevs.stc | 63 + powerflo.vda | 334 +++ pp_actef.vda | 82 + pp_chp.ier | 63 + pp_chp.mod | 69 + pp_clean.mod | 27 + pp_lvlbd.mod | 47 + pp_lvlbr.mod | 55 + pp_lvlfc.mod | 45 + pp_lvlff.mod | 41 + pp_lvlfs.mod | 43 + pp_lvlif.mod | 45 + pp_lvlpk.mod | 54 + pp_lvlus.mod | 39 + pp_micro.mod | 91 + pp_off.mod | 23 + pp_prelv.vda | 116 + pp_qack.mod | 373 +++ pp_qafs.mod | 111 + pp_qaput.mod | 16 + pp_reduce.red | 184 ++ pp_shapr.mod | 46 + ppm_ext.dsc | 16 + ppm_ext.ecb | 50 + ppm_ext.mlf | 92 + ppm_ext.vda | 161 ++ ppmain.mod | 1343 ++++++++++ ppmain.tm | 72 + prep_ext.abs | 33 + prep_ext.dsc | 20 + prep_ext.ier | 21 + prep_ext.mlf | 43 + prep_ext.stc | 56 + prep_ext.tm | 32 + prep_ext.vda | 79 + prepparm.gms | 71 + preppm.mod | 250 ++ preppm.msa | 78 + prepret.dsc | 152 ++ prepxtra.mod | 90 + preshape.gms | 49 + presolve.mlf | 103 + readbprice.mod | 48 + recurrin.stc | 181 ++ resloadc.vda | 154 ++ rpt_dam.mod | 56 + rpt_ext.cli | 53 + rpt_ext.ecb | 70 + rpt_ext.ier | 50 + rpt_ext.mlf | 113 + rpt_ext.msa | 63 + rpt_obj.rpt | 145 ++ rpt_objc.rpt | 128 + rpt_par.cli | 79 + rptlite.rpt | 175 ++ rptmain.mod | 48 + rptmain.rpt | 283 +++ rptmain.stc | 125 + rptmain.tm | 140 + rptmisc.rpt | 276 ++ sensis.stc | 43 + setglobs.gms | 358 +++ sol_flo.red | 43 + sol_ire.rpt | 20 + solprep.msa | 133 + solputta.ans | 263 ++ solsetv.v3 | 201 ++ solsubta.ans | 51 + solsysd.v3 | 14 + solvcoef.msa | 91 + solve.mod | 47 + solve.msa | 178 ++ solve.stc | 134 + solve.stp | 338 +++ spoint.mod | 87 + stages.stc | 272 ++ times2veda.vdd | 157 ++ times2veda_stc.vdd | 148 ++ times2veda_v3.vdd | 109 + timesrng.gms | 16 + timslice.mod | 121 + uc_act.mod | 53 + uc_cap.mod | 52 + uc_cli.mod | 43 + uc_com.mod | 47 + uc_flo.mod | 77 + uc_ire.mod | 58 + uc_ncap.mod | 51 + uc_pasti.mod | 33 + ucbet.vda | 129 + units.def | 38 + writeddf.msa | 82 + wrtbprice.mod | 35 + 259 files changed, 26396 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .zenodo.json create mode 100644 AUTHORS.md create mode 100644 COPYING.txt create mode 100644 Contributing.md create mode 100644 NOTICE-GPLv3.txt create mode 100644 README.md create mode 100644 Version-Old.rar create mode 100644 Version.log create mode 100644 _times.g00 create mode 100644 atlearn.etl create mode 100644 atlearn1.etl create mode 100644 atlearn8.etl create mode 100644 atlearn9.etl create mode 100644 atsc.etl create mode 100644 bnd_act.mod create mode 100644 bnd_cum.mod create mode 100644 bnd_elas.mod create mode 100644 bnd_flo.mod create mode 100644 bnd_ire.vda create mode 100644 bnd_macro.tm create mode 100644 bnd_set.mod create mode 100644 bnd_stg.mod create mode 100644 bnd_ucv.mod create mode 100644 bnd_ucw.mod create mode 100644 bndmain.mod create mode 100644 cal_cap.mod create mode 100644 cal_caps.mod create mode 100644 cal_fflo.mod create mode 100644 cal_ire.mod create mode 100644 cal_nored.red create mode 100644 cal_red.red create mode 100644 cal_stgn.mod create mode 100644 calibase.mlf create mode 100644 clearsol.stc create mode 100644 clearsol.stp create mode 100644 coef_alt.lin create mode 100644 coef_cpt.mod create mode 100644 coef_csv.mod create mode 100644 coef_ext.abs create mode 100644 coef_ext.cli create mode 100644 coef_ext.etl create mode 100644 coef_ext.vda create mode 100644 coef_nio.mod create mode 100644 coef_obj.mod create mode 100644 coef_ptr.mod create mode 100644 coef_shp.mod create mode 100644 coefmain.mod create mode 100644 cost_ann.rpt create mode 100644 curex.gms create mode 100644 ddfupd.msa create mode 100644 dumpsol.mod create mode 100644 dumpsol1.mod create mode 100644 dumpsolv.mod create mode 100644 dynslite.vda create mode 100644 eqactbnd.mod create mode 100644 eqactflo.mod create mode 100644 eqactups.vda create mode 100644 eqashar.vda create mode 100644 eqblnd.mod create mode 100644 eqbndcom.mod create mode 100644 eqbndcst.mod create mode 100644 eqcaflac.vda create mode 100644 eqcapact.mod create mode 100644 eqcapvac.mod create mode 100644 eqchpelc.ier create mode 100644 eqcombal.mod create mode 100644 eqcpt.mod create mode 100644 eqcumcom.mod create mode 100644 eqcumflo.mod create mode 100644 eqdamage.mod create mode 100644 eqdeclr.mod create mode 100644 eqdeclr.tm create mode 100644 eqflobnd.mod create mode 100644 eqflofr.mod create mode 100644 eqflomrk.mod create mode 100644 eqfloshr.mod create mode 100644 eqire.mod create mode 100644 eqirebnd.mod create mode 100644 eqlducs.vda create mode 100644 eqmacro.tm create mode 100644 eqmain.mod create mode 100644 eqmrkcom.ier create mode 100644 eqobj.mod create mode 100644 eqobj.tm create mode 100644 eqobjann.tm create mode 100644 eqobjcst.tm create mode 100644 eqobjels.mod create mode 100644 eqobjels.rpt create mode 100644 eqobjfix.mod create mode 100644 eqobjfix.rpt create mode 100644 eqobjinv.mod create mode 100644 eqobjinv.rpt create mode 100644 eqobjvar.mod create mode 100644 eqobjvar.rpt create mode 100644 eqobsalv.mod create mode 100644 eqobsalv.rpt create mode 100644 eqpeak.mod create mode 100644 eqpk_ect.ier create mode 100644 eqptrans.mod create mode 100644 eqstgaux.lin create mode 100644 eqstgaux.mod create mode 100644 eqstgflo.mod create mode 100644 eqstgips.lin create mode 100644 eqstgips.mod create mode 100644 eqstgtss.mod create mode 100644 equ_ext.abs create mode 100644 equ_ext.cli create mode 100644 equ_ext.dsc create mode 100644 equ_ext.ecb create mode 100644 equ_ext.etl create mode 100644 equ_ext.ier create mode 100644 equ_ext.mlf create mode 100644 equ_ext.msa create mode 100644 equ_ext.vda create mode 100644 equcrtp.vda create mode 100644 equcwrap.mod create mode 100644 equserco.mod create mode 100644 eqxbnd.mod create mode 100644 err_stat.mod create mode 100644 fillcost.gms create mode 100644 fillparm.gms create mode 100644 fillsow.stc create mode 100644 fillvint.gms create mode 100644 fillwave.gms create mode 100644 filparam.gms create mode 100644 filshape.gms create mode 100644 forcupd.cli create mode 100644 gdxfilter.gms create mode 100644 globals.def create mode 100644 init_ext.abs create mode 100644 init_ext.dsc create mode 100644 init_ext.vda create mode 100644 initmty.abs create mode 100644 initmty.cli create mode 100644 initmty.dsc create mode 100644 initmty.etl create mode 100644 initmty.ier create mode 100644 initmty.mlf create mode 100644 initmty.mod create mode 100644 initmty.msa create mode 100644 initmty.stc create mode 100644 initmty.tm create mode 100644 initmty.vda create mode 100644 initsys.mod create mode 100644 main_ext.mod create mode 100644 maindrv.mod create mode 100644 maplists.def create mode 100644 mod_equa.mod create mode 100644 mod_equa.tm create mode 100644 mod_ext.abs create mode 100644 mod_ext.cli create mode 100644 mod_ext.dsc create mode 100644 mod_ext.etl create mode 100644 mod_ext.ier create mode 100644 mod_ext.vda create mode 100644 mod_vars.abs create mode 100644 mod_vars.cli create mode 100644 mod_vars.dsc create mode 100644 mod_vars.etl create mode 100644 mod_vars.mod create mode 100644 mod_vars.msa create mode 100644 mod_vars.tm create mode 100644 par_uc.rpt create mode 100644 pextlevs.stc create mode 100644 powerflo.vda create mode 100644 pp_actef.vda create mode 100644 pp_chp.ier create mode 100644 pp_chp.mod create mode 100644 pp_clean.mod create mode 100644 pp_lvlbd.mod create mode 100644 pp_lvlbr.mod create mode 100644 pp_lvlfc.mod create mode 100644 pp_lvlff.mod create mode 100644 pp_lvlfs.mod create mode 100644 pp_lvlif.mod create mode 100644 pp_lvlpk.mod create mode 100644 pp_lvlus.mod create mode 100644 pp_micro.mod create mode 100644 pp_off.mod create mode 100644 pp_prelv.vda create mode 100644 pp_qack.mod create mode 100644 pp_qafs.mod create mode 100644 pp_qaput.mod create mode 100644 pp_reduce.red create mode 100644 pp_shapr.mod create mode 100644 ppm_ext.dsc create mode 100644 ppm_ext.ecb create mode 100644 ppm_ext.mlf create mode 100644 ppm_ext.vda create mode 100644 ppmain.mod create mode 100644 ppmain.tm create mode 100644 prep_ext.abs create mode 100644 prep_ext.dsc create mode 100644 prep_ext.ier create mode 100644 prep_ext.mlf create mode 100644 prep_ext.stc create mode 100644 prep_ext.tm create mode 100644 prep_ext.vda create mode 100644 prepparm.gms create mode 100644 preppm.mod create mode 100644 preppm.msa create mode 100644 prepret.dsc create mode 100644 prepxtra.mod create mode 100644 preshape.gms create mode 100644 presolve.mlf create mode 100644 readbprice.mod create mode 100644 recurrin.stc create mode 100644 resloadc.vda create mode 100644 rpt_dam.mod create mode 100644 rpt_ext.cli create mode 100644 rpt_ext.ecb create mode 100644 rpt_ext.ier create mode 100644 rpt_ext.mlf create mode 100644 rpt_ext.msa create mode 100644 rpt_obj.rpt create mode 100644 rpt_objc.rpt create mode 100644 rpt_par.cli create mode 100644 rptlite.rpt create mode 100644 rptmain.mod create mode 100644 rptmain.rpt create mode 100644 rptmain.stc create mode 100644 rptmain.tm create mode 100644 rptmisc.rpt create mode 100644 sensis.stc create mode 100644 setglobs.gms create mode 100644 sol_flo.red create mode 100644 sol_ire.rpt create mode 100644 solprep.msa create mode 100644 solputta.ans create mode 100644 solsetv.v3 create mode 100644 solsubta.ans create mode 100644 solsysd.v3 create mode 100644 solvcoef.msa create mode 100644 solve.mod create mode 100644 solve.msa create mode 100644 solve.stc create mode 100644 solve.stp create mode 100644 spoint.mod create mode 100644 stages.stc create mode 100644 times2veda.vdd create mode 100644 times2veda_stc.vdd create mode 100644 times2veda_v3.vdd create mode 100644 timesrng.gms create mode 100644 timslice.mod create mode 100644 uc_act.mod create mode 100644 uc_cap.mod create mode 100644 uc_cli.mod create mode 100644 uc_com.mod create mode 100644 uc_flo.mod create mode 100644 uc_ire.mod create mode 100644 uc_ncap.mod create mode 100644 uc_pasti.mod create mode 100644 ucbet.vda create mode 100644 units.def create mode 100644 writeddf.msa create mode 100644 wrtbprice.mod diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5536f79 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,38 @@ +# do not attempt any end-of-line conversion +* -text +# Exclude files from archive +/.github export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore + +# These files are in the GAMS language +*.gms linguist-language=GAMS +*.mod linguist-language=GAMS +*.abs linguist-language=GAMS +*.ans linguist-language=GAMS +*.def linguist-language=GAMS +*.dsc linguist-language=GAMS +*.cli linguist-language=GAMS +*.ecb linguist-language=GAMS +*.etl linguist-language=GAMS +*.ier linguist-language=GAMS +*.lin linguist-language=GAMS +*.msa linguist-language=GAMS +*.red linguist-language=GAMS +*.rpt linguist-language=GAMS +*.stc linguist-language=GAMS +*.tm linguist-language=GAMS +*.v3 linguist-language=GAMS +*.vda linguist-language=GAMS + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.g00 binary +*.gz filter=lfs merge=lfs -text -diff +*.zip filter=lfs merge=lfs -text -diff +*.7z filter=lfs merge=lfs -text -diff +*.rar filter=lfs merge=lfs -text -diff +*.exe filter=lfs merge=lfs -text -diff + +# Documents +*.pdf filter=lfs merge=lfs -text -diff diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..4c3f387 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,34 @@ +--- +name: Bug report +about: Create a report to help us improve TIMES +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Provide information for reproducing the bug, as much in detail as possible: +- Which TIMES feature used in your model appears to be triggering the bad behavior? +- What exactly is the manifested incorrect or undesirable behaviour? +- Which steps would be needed to be able to reproduce the bad behavior? + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Test case** +If possible, attach a ZIP file containing the TIMES input files (*.DD, \*.RUN) and the listing file (\*.LST) for a test case reproducing the issue. + +**Versions (please complete the following information):** + - GAMS version used (e.g. GAMS 27.3) + - TIMES version used (see version info in QA_Check.log) + - Operating system (if not Windows) + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..5e7b89f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,22 @@ +--- +name: Feature request +about: Suggest an idea for ETSAP-TIMES +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a modeling issue? Please describe.** +A clear and concise description of what the modeling issue is. Ex.: I'm always frustrated when [...] + +**Describe the solution you'd like to have implemented** +A clear and concise description of the new or improved functionality: +- If applicable, describe the new input attribute(s) needed for the new feature(s) +- Describe what should happen when the new or improved feature(s) are used + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.zenodo.json b/.zenodo.json new file mode 100644 index 0000000..18ffc6c --- /dev/null +++ b/.zenodo.json @@ -0,0 +1,19 @@ +{ + "creators": [ + { + "name": "IEA-ETSAP" + } + ], + + "license": "GPL-3.0", + + "title": "TIMES Model Generator", + + "keywords": [ + "TIMES", + "optimisation", + "energy system model", + "bottom-up model", + "open source" + ] +} diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..fc5ff8a --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,37 @@ +# The Integrated Markal-EFOM System – TIMES +#### The code owner is the IEA Energy Technology Systems Analysis Programme (ETSAP) +# Original Authors of ETSAP TIMES (by contracting party) +* Ken Noble (Australia) +* Denise van Regemorter (Belgium) +* Amit Kanudia (Canada) +* Richard Loulou (Canada) +* Uwe Remme (Germany) +* Peter Schaumann (Germany) +* Günter Schmid (Germany) +* GianCarlo Tosato (Italy) +* Tom Kram (Netherlands) +* Tomas Larsson (Sweden) +* Gary Goldstein (USA) + +# Other contributing authors (incomplete list) +* Martin Baumann (Austria) +* Wouter Nijs (Belgium) +* Kathleen Vaillancourt (Canada) +* Kenneth Karlsson (Denmark) +* Raffaele Salvucci (Denmark) +* Markus Blesl (Germany) +* George Giannakidis (Greece) +* Kostas Tigas (Greece) +* James Glynn (Ireland) +* Maurizio Gargiulo (Italy) +* Ad Seebregts (Netherlands) +* Pernille Seljom (Norway) +* Evangelos Panos (Switzerland) +* Socrates Kypreos (Switzerland) +* Paul Dodds (United Kingdom) +* Evelyn Wright (USA) + +### Many thanks to all individuals who have contributed to ETSAP TIMES. + +# Current maintainer +* [@Antti-L](https://github.com/Antti-L) diff --git a/COPYING.txt b/COPYING.txt new file mode 100644 index 0000000..ed990f8 --- /dev/null +++ b/COPYING.txt @@ -0,0 +1,621 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/Contributing.md b/Contributing.md new file mode 100644 index 0000000..93e5909 --- /dev/null +++ b/Contributing.md @@ -0,0 +1,31 @@ +## Contributing to TIMES + +Contribution to TIMES is currently done through "Issues" in GitHub which can be used for: +1) filing bug reports, and +2) submitting feature and enhancement requests, + +and discussing all the necessary details about them. + +In "Issues", you can insert code snippets, links and attachments that demonstrate the issue or describe the proposed enhancement in detail. When a consensus is reached about an issue, the maintainer of TIMES will proceed by implementing the fix or the new feature, and integrate it in the next release of the ETSAP TIMES code. + +Currently the TIMES code is maintained by @Antti-L. + +This is the current approach of managing contributions to TIMES, without the need for "pull requests" for the Master branch. For eventual bigger projects a different workflow may be useful in separate branches. + +## Resources: + +- The main ETSAP[website](https://iea-etsap.org/) is a good place to get started with TIMES. +- Extended documentation for TIMES is available on the [website](https://iea-etsap.org/index.php/documentation). +- The [forum](http://iea-etsap.org/forum/index.php) is the main place to ask questions and search for answers from the ETSAP community. + +## Bugs + +If you find a programming error in TIMES, please submit an Issue in the repository. Follow the [issue template](https://github.com/etsap-TIMES/TIMES_model/issues/new) for submitting a bug. + +## Errors in the documentation + +The documentation can be found in the [Documentation Repository](https://github.com/etsap-TIMES/TIMES_Documentation). Please report issues with the Documentation [here](https://github.com/etsap-TIMES/TIMES_Documentation/issues/new). + +## Ideas and Suggestions + +If you have an idea on how TIMES could be improved, or to suggest useful additions, please submit a request using the Github issue [here](https://github.com/etsap-TIMES/TIMES_model/issues/new). diff --git a/NOTICE-GPLv3.txt b/NOTICE-GPLv3.txt new file mode 100644 index 0000000..4b0ade3 --- /dev/null +++ b/NOTICE-GPLv3.txt @@ -0,0 +1,17 @@ +*------------------------------------------------------------------------------ +* Copyright (C) 2000-2023 IEA Energy Technology Systems Analysis Programme. +*------------------------------------------------------------------------------ +* This software "The Integrated MARKAL-EFOM System - TIMES" is open source: +* you can redistribute it and/or modify it under the terms of the +* GNU General Public License as published by the Free Software Foundation, +* either version 3 of the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program (see the file COPYING.txt). If not, please visit: +* +*------------------------------------------------------------------------------ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a1b5a8d --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +

GNU General Public LicenseThis work is licensed under a GNU General Public License.

+ +# TIMES_model + +## The Integrated MARKAL-EFOM System (TIMES) – a bottom-up optimization model for energy-environment systems. + +The TIMES (The Integrated MARKAL-EFOM System) model generator was developed by ETSAP the Energy Technology Systems Analysis Program, which is a Technology Cooperation Program of the International Energy Agency. +ETSAP is an international community which uses long term energy scenarios to conduct in-depth energy and environmental analyses. +The TIMES model generator combines two different, but complementary, systematic approaches to modelling energy: a technical engineering approach and an economic approach. +TIMES is a technology rich, bottom-up model generator, which uses linear-programming to produce a least-cost energy system, optimized according to a number of user constraints, over medium to long-term time horizons. +In a nutshell, TIMES is used for, "the exploration of possible energy futures based on contrasted scenarios". + +## Model structure + +TIMES models encompass all the steps from primary resources through the chain of processes that transform, transport, distribute and convert energy into the supply of energy services demanded by energy consumers. +On the energy supply-side, it comprises fuel mining, primary and secondary production, and exogenous import and export. The “agents” of the energy supply-side are the “producers”. +Through various energy carriers, energy is delivered to the demand-side, which can be structured sectorally into residential, commercial, agricultural, transport and industrial sectors. The demand sector breakdwon is completely flexible and adaptable in TIMES. +The “agents” of the energy demand-side are the “consumers”. The mathematical, economic and engineering relationships between these energy “producers” and “consumers” is the basis underpinning TIMES models. + +## Scenarios + +The principle insights generated from TIMES are achieved through scenario analysis. A reference energy scenario is generated first by running the model in the absence of any policy constraints. +These results from the reference scenario are not normally totally aligned to national energy forecasts (generated by simulating future energy demand and supply), mainly because TIMES optimizes the energy systems providing a least cost solution. +A second scenario is then established by imposing a (single of many) policy constraint on the model (e.g. minimum share of renewable energy, maximum amount of GHG emissions or minimum level of energy security) and the model generates a different least cost energy system with different technology and fuel choices. +When the results are compared with those from the reference scenario, the different technology choices can be identified that deliver the policy constraint at least cost. + +## Functionality + +Once all the inputs, constraints and scenarios have been put in place, the model will attempt to solve and determine the energy system that meets the energy service demands over the entire time horizon at least cost. +It does this by simultaneously making equipment investment decisions and operating, primary energy supply, and energy trade decisions, by region. +TIMES assumes perfect foresight, which is to say that all investment decisions are made in each period with full knowledge of future events (myopic runs of the model are also possible). +It optimizes horizontally (across all sectors) and vertically (across all time periods for which the limit is imposed). +The results will be the optimal mix of technologies and fuels at each period, together with the associated emissions to meet the demand. +The model configures the production and consumption of commodities (i.e. fuels, materials, and energy services) and their prices; when the model matches supply with demand, i.e. energy producers with energy consumers, it is said to be in equilibrium. +Mathematically, this means that the model maximizes the producer and consumer surplus. The model is set up such that the price of producing a commodity affects the demand for that commodity, while at the same time the demand affects the commodity’s price. +A market is said to have reached an equilibrium at prices p and quantities q when no consumer wishes to purchase less than q and no producer wishes to produce more than q at price p. +When all markets are in equilibrium the total economic surplus is maximized (i.e. the sum of producers’ and consumers’ surpluses). +The main output TIMES are energy system configurations, which meet the end-use energy service demands at least cost while also adhering to the various constraints (e.g 80% emissions reduction, 40% renewable electricity penetration). +In the first instance, TIMES model addresses the question: is the target feasible? If an energy system is possible, it can then be examined, at what cost? The model outputs are energy flows, energy commodity prices, GHG emissions, capacities of technologies, energy costs and marginal emissions abatement costs. + +## Documentation [![Documentation](https://img.shields.io/badge/docs-passing-brightgreen.svg?style=flat&logo=github)](https://github.com/etsap-TIMES/TIMES_Documentation) + +Detailed documentation is available on ETSAP's [website](https://iea-etsap.org/index.php/documentation): + +i) [Concept and Theory](https://iea-etsap.org/docs/Documentation_for_the_TIMES_Model-Part-I_July-2016.pdf). +ii) [Comprehensive Reference Manual](https://iea-etsap.org/docs/Documentation_for_the_TIMES_Model-Part-II_July-2016.pdf). +iii) [Operation of TIMES code](https://iea-etsap.org/docs/Documentation_for_the_TIMES_Model-Part-III_July-2016.pdf). + +## TIMES Demo [![Demo model](https://img.shields.io/badge/demo%20model-available-brightgreen.svg?style=flat&logo=github)](https://github.com/etsap-TIMES/TIMES_Demo) + +A Demo model is available on [GitHub](https://github.com/etsap-TIMES/TIMES_Demo). + +## Community + +Information on the activities of ETSAP are available on ETSAP's [website](https://iea-etsap.org/). + +If you are interested in receiving information and newsletters on ETSAP's tool you can register [here](https://iea-etsap.org/index.php/etsap-tools/acquiring-etsap-tools). + +A forum for TIMES users is [available](http://iea-etsap.org/forum/index.php). + +[![DOI](https://zenodo.org/badge/229031856.svg)](https://zenodo.org/badge/latestdoi/229031856) diff --git a/Version-Old.rar b/Version-Old.rar new file mode 100644 index 0000000000000000000000000000000000000000..5928b0ec4ca7d1beb691fcea438345e6de070d10 GIT binary patch literal 18364 zcmV(!K;^$uVR9iF2LR8Ia{vGh0000000011YjhxhE&y{!003F20RRH}6Xl)&pm97M zGY$YC00011WpZ zodfJC+tP|hREN`Qn_z~0#s#kaq(GeKY^p!z>7d?F>z7;?(CZ}(?yjba3knT6oZiW5 z-IJqX0(55Iedv~jO71XBbd4oG$)jtu1S>z_wPFzx3G{(nShpcC+l};a5&Va4h`RNX zS&t*}eY>nQ$=*}6CT>wI60j!_;3%tP&qBx55_79pK!VNixvT4?CWAc%CD~;G2cS6z z4eVO$nc&2bE3yYmf}EsB#s-vD@KXz|s1y(~AaE&JzD1Z*S%hn45=xm0t% zkxlcPaRZ49xUAO3Oh_tBMr?Ih66;y*1zBluOCIYM#3Z3RVFH{QrdgCN;+xc5A9QaT zpeD1w$127D{hf1;?_!w=AE}w~h?0t!!0)nb?M7+Kd^a1DuNnmYRq0on8v*WN{Lk|6 zz@*qojinDGd?QSC7LnfaepNP8cnzoEwPG1xaa}zitWJjT-;@_)ysLro!h_hXcoIuO zw*6?;@`#S`>@2eRM25SS8a6u5)ORZsTO?W zdbuP&wu>Odp!KfBcJ2svCIfz*o6Ez8S_Oqgq+&0;-q&rj0qE%bH?EkwA{fcv6b6T; z;rnsdsxGLCw0SgL4jia@#M%q9KrB9r?{;q`Mz@!5w5E!L+x!?Q`US?+6c;Sl>2$P2 zf=U#MRhkOGwcYH8X#n)f^@=8m#ZDGl&DM#H;X~d-y~mZ>C>&3eZ59<<6HTJc$vyP7 z;6QhT%6+S_ouudb0JvS>O8R*Q&~)gaWWt0u@cJdbL++6=?IRHWpy`jy%H$gPl$0+p zCs53q=(DFRL+&w*#0#@If;=O)bOW>S=yVNu;O#5pV7^@l4o1O*27{>y7D# z%P_Y@EiiA1YsOh{6_DZ3P`}4b76ZLNarxQnqlw)qft6EH|D0#Ek|Y5)F1LqMwoxDv z5d^>WA|@zt7XEisIv8lVamaU%g2}|VYv24Ymi93mNedsL1SpA;+o#TgClp_pN4Wt$ zauP&Vt4gT;o(~A#Aj~1Im7zgQD z1o$OcTA+k)cfDk2{`U)G-=|fFKfcE<^kA#rDeOVsy|rl!h<2sETWeA5fod1)zZjp%s&wi{Tv`f9 ztwPgyu2)8k^bn7iS64Wpj`_`lv`(4Yx`O-X^u!cVo~sN6K& zX=ozG13q@qvw5nMn@(B;tZ`5K_1@@gmAoF_v^6k0r7PgoDDys714oIIoUyy(r7eb_ zCw~x%?5XCjanoSzE!xtMdz+3(Kd1Qscsq+jydsjzUf;JYfzM<6ZBG);a|N9CNZQU1 zMuYaDFSP2$Sh(q~g0BB7GWAGGqQU+0lC_LBB9{L5`~&R4dHZ1qCN%t1n;)m2LejtE zH2$dNK(K^)cg+G++fP<9g4<2u4SG|q!dIBzn@dkmW~_ZxTd&TWh?^W9p|Qw*^g*H( z*HXIuI5|GzfRHBzC-ty2+cN0HcGh&J;+(MY)@X5)9Z!Bmv4!eM!{yW*vDS&yWgvgU za*BxUuedZ}W5KpH5+&=xUd5b1DFk(;GxXbRI>a|2Uz^WfG7!6U~^9dH;gn4YSu?yQ|%Ue)J&#GaRjP^t`L}di2k2HXnx)H0xqVC;3-f!x`7g6*!OoeO^ zw&oAgoenlO&!w-f9MnWPBc$P05=rD#q~8cI+ou~|0LxRk9EWb!sKswJCI~C2dJ>~M zN%|v_wU#{0_kaEuxtZ7EHagra>2I)O8!~+TeLvsWJ4d22dN=Whm+sItN9f8GIV1PXN439cS}Q1eQUDlNbc$f_%FGqlWv8t8SSKoZ98F4WWp(j;InEsq8PJx{I>$`3fEBZb#<#ro!fcE{lBbj1)QdI0;KIXO7BMScNep#SVQiKmW}v}!2Y z;xu_RqWsH+_)uGpn&0ZX20Zg_2{FW}JzaDRy>iEiZq)Tn6IkH){J0i(!u-6!E8y1D zAfHJ~#vq(1Z`)LOVE~8xQ4!(hjjPoCA>xmlcNTtN**)IB@zIUL{ULbIlUx*sE(<4B z7wxQj(Gy*d?<~v#EV@LCo*n?IEJp4V(^i&=I!2=<;G~z(5Y)vsXY$jIYJWlis z_MC+9nE#=gIWLy@0%zOC+9&aD#0b|zwheekQyP}drt`xYLTD7N7PE_Ge&ZX_eqo?X zo3!Ef)X6`F6$!!-a8y-QqW@=aNrLHO7BG-S^CM@Z7ZbLPL3P+!;FUJB;QqVpzQDk; zw^)X!|H-MVYBDzOmKS8DmG6VeP1m<)|2+F96--I^1A(x-=$nj?3WknTdpNDTd|QtK zuE~C%w>4ir^9*aN3eS)UziH&xP&zbZN|FN9mBY+`>o)6oP>iXGy0f{IfYT z!aKREuR(Y(96IC2?vJn<$F#8RWlYcfdd$x&jx7Zv4*mkn0LFPj9jS$egiJbbKs2Q- zVQCU6YPYU^(N}uq{8npPHzfCiva^=YjSo+$)`pO3{(sVRPPESqw%)aEr~h|JPfb;F zyr~Yo^dR&ZLw`z)`8F96aAL@4oSHU*4>)1TqHkXNALlq`<6BC=CTzL}+b3unHSb7j zgVbmr@s{wX(rOC?ep)nd|Dcn!<%t^?t^AXEgVFuGaL(y|j^o&H?U;mZ?L|fBlC76- zSCoOvj=SpL&nBXMBBQ+;fg2yGC)6ae>|Ng{A(M0eFm`JLG>V+F<+cXGdLE`4vn9F` z;<=cT=4>*rRVxyRm;pZa>ZRkI*d)X6SG0_Y(q2;Hd-~*!On3uzXq3QTi}6g0W~)hW zP3WJ_m}cNumsZ=_3xTnAA0+7|LRu)lUCrEC-c<5QjarRVLRGQ(XIj0d9*7)kxr5o# zVj}Y>EL%3X81W4?!d$1itd-%@AR%MMdQD=q^UFS@{`=rQx$`CsKAS&;=#Xr& z+t;jrGeo(^J?lhS#D|4=lGuyMtao51^5oOu-X3&%5==SG)gi*sg2t2A9ZxY4!Fi8v zo!d;^hO+J2#%vLgfMMfaP8Ep@9^j&;Fd(iqDmt%M0go^uFx7P1=!-=YTw)ZQ)CYlg z%~1}Ygkx#&a$k~QZ4k!vOqQ|+SHxo#y}vg{z+Uff;I}$4IZ#RbrWzhx~M8LPV*r|FjJyc#2$1&VAenJ7k)2)=r&7{g&FsI;-Rb zOYtcL!TJ{Aeql9sMUl9&%|jQQ-Nb0*sZQ7E^~fl?#*W80w?{>$#md*iKX1lp>Pp!8E%j}>h4o0_nH6yV(9oWR?!1tOp)6pNP4?N?DI$fT7QrS;Nn%+ ziMQ2+IOF+*jq&G${J0Kx7XzIZ87y-B^vO4Lf+z}}U?P5Ru1i}m1`0x}Y**gfi+V`h zx7-GAQdHXzJ397^3ptt*@^K)!aQPo8@NxGmUAMaWGgMoO?qPSeSR116-o(EE_!VT4 zDSzfTCXoR1+tHdYhrWHIQ_PX8^m#mLtrpOlMwfR~))JPIKCPPW5{KUOco;w^{*{ zx&>zjjIin^3jU2y+-}G#4{Ia~)Jo>q3K^QG^e)4l$JRH*7rg zvtJ!6s4WA72QYCYCDiR70@$L81aZ@?=ljBXRafeVGLVS0U|7s&%Jj*@m}1HxHu{}p z{pv3JP=P3_eklqSv$xBvRN~N90cXpXl!&}T%a#0`e=UD^NRc@Skiqt{k3~s}<&7-p zz^$gUmt|t);^QkuOZM+?vWi0Atz~Z(@!V{N1reavh*|D(&(~d(1fa-3e218qYZ|e~$v4wBjGI>DS2obhl{1SfklZM-AsSLS zgf)7fo5`4s(CsP?i|Fh1p=lw+u@tmUE5@K*qTR4UYRFbJ;Prabi=qrp^SlF4)@^`4 zXo7Dk)%^o0IRGb3ikgyuul*^$ty1roOkBF&Kl1CpiP>v<(U(|cZ7CtnAHK+{R^;7Z zb1G;j;VETu?qAlO%EAJux{DYuXX>{Fa)h}zB5O>^&vy3 zm#bw%tdV`!pBw6B{?$M?(wQxL>qz?lndzMyT5-^x2Q`TbihLv__}%LEn|O*WsO%mc zw%aD+$W17oZYW~@faW`jzar~s?Z&`NUl6bY6A$?Ss>{XrA`KIW>&J+;3ZRqI3TERQ zs72Sj1=!Y3hUY!i20#}w3#j9EXcAzgvln1qDQX^}K*qw-Hwh2pl^hB>mN1Fo9r4aC z(7|+~MK@<6{eTPF_!*%RblVhCKPfTsVj+1aHMBG=6o;(PD^~GB%LHYb2pNE{S2BP- zEq~y4BeAZSzg>Qi)COi?A;;2#At3%#Spkt8vQQGFb;sBW^5<&##^6}Ge}AoNTwSiCoH>oWKn>1{trg7}3H%_nJCVIe&$l^odC-&uWh$ej-$E-dB?EuFk zh^p}Q&CeDSnRr#8`2F1M<3zOUM>T3uxA|hKCxyqFT4u2FV-z;*P*^59J8Js5uw(~j8^?)BK!D3U6nVVcmAD<5(3~hu?~2m zjhzYdsbe?Av7$j=$33Vs(3m#<#bb{jpEUoWSiVRg3@wtOV{6{fC;o@FB@q>$=(T}#l#>LXtP~06PpTnq3q_oCmQ~en-fFz#a$N1xIW3T*s(_$kesA# zi40G|YwJ3As{SsmDMLa0k(pjV8w{ScfulZT>K28LueBS2Pl<8rD~Qyb%~Vj$b{iBv z)#;D+cwpgzy|IBt62uFyp2I`?U-5NTnuz7T6Bff80xf>w70pg3K-1fUHk8&h$O@9u z0)y)gs-X`e@(TUM#s9c$VZcIxmTsgiI*oi=mt~(5;@p{Gd63e!dCw>jf41`-P#A_t zuKC_&V2_IqN*BW7&J_P4fBfspUO`FXtL)V^#7y#|7sWf51$BaAS8-8`JsKZhBIEP= zx0tS~1KWcvw?*G6s+gFwR8?UNOdT9fBMLags<{1e0s|>n3>4dwtUn%3-xsJ$F>}gnBc`Qt_n~-|Lt;Yb`NLG2H?FZ4^vV2*+H8^fRPkH`S8;QV;xG+^+Xq{(NF7LLTBP(D#Jcr zg{|l=BG}@OOP}BRVQDpTesPCAVR=(2Up!1p_`{o2c=ZPu}6GOrniO3th8NZ zn_ION;<^~1=yK2r0q|J0>@Co?+mbs3NsAhwT~Q_TAYSBbNzG}(#BEFOSerA;kZ z-9d8ZGFimjzs7BzwrLc`NCB1bR^O9rDg+57_F~~J(^zO^qL5?CXgcX4e3AAfR}8rh z?&b1lTr1`8T=h9{-_Qy=aRkK6 zOBpc_Tp&1CMAe5$b!me>u0VovBqk&S3~vvUY-^=hM}6KR(UgmzoFH)qr*kQLQq9$^ zD>4KTTI;ny*Rg?MZIa$0a$WOuHVW6_*_o$x)Z;L-^PZv*XbbTM1Nh4i5U2LPGnjfL zzQe+S;L&51)A*SVzKh;KAJr_%R~haD&Q|wbEXfw+OQ9VPu^Vjlf@na&^2p6h<|nzz zx~FH0fpfkdnsf8>9L3$GcV>6@Q$z+{E=ftccrz{5CUWLP;exl)olh!y3lSstpKWl0Ztv3?y%2u5vO4$4YQpA-4}L)28J5VLbA zKA+NDWQ_}W^KRv-DK+ELZ|MEjG|5+Vl=QlJo9avUC(;NdMpBQNYubtUFs&fb9H*s; z{IECa1oLML^w41(;{&V3Dx$UXp?7CKMoWJ^n)p#kN{;LAYa@B`dMG-f?*~;_wzjo1 z;Se0cGd-mE3U;b2B)bhGc_qb%RfzAyg?oCACGRxnG(t;iaRt8EjC|HyRbCWr8R{h` z+a0<9R2>`mbyawwMQ9Cvl7C)Ps5P)fs;Ak-y4-TnLAK0X#?r24C3?h_udS0d{2*j1 z6j~a3J_QznlF)59x>NTcwWQV5a66l<=OWs>{Jc7=A&l=ke6SB^bPH!^>XZDTJKpJC zpw*~*fVr-(qIn(pcVIaldRy%C=@kkjWW3tva|H`f#SiU!(hhI;9YZUZFHw>IS;NBf zI^?@W!$AANl}4@nsPGr)7?k}TaY)B?-3v)rnO618{?m2SSBt)8*@&vpZ~EzUP4uP` z*HAqzcBBQXU`0#`-dMmzBd!_|KiNWUtJ0wwSdo&&vg8j2tIbYmY@3V8ouT1f{i%2_ ztg&|R(mK`fe9*lO(qbgrW%(fsj3XmL_TvY&RtppN4A-!6M5FdOdV64#YUSe86)j|8 zqHn)m-GeH74mX0ok64r(IN7WKg#@IBDBoB(P>N)cjnGJ^Gwd16AiH zerdf%`wq=Zl${_ltY;pN@p{_d{{ zL(BQ@6ALU;tepzrf{H)zi{c>#y&QKQl?Ynv@;;7toWNL zAS0UM1q>l;s7{!X&aH#pfW>fx56jqxU23rCLMh_eCLHL!oJ+Fpv<3sZvMj*J!oi~( z#Ai~7G%~;+8WZ?oUxX)2K$2$10TK!d$VwbURYk5#hGhWfFS>aWw-!47v8Z+L5g4 zGlqfZ1wItXl6gr@%j~xFWQVF7NG_E;KK6F(VfV)hl;%(175;E4J|}z{1#WH`mVh~n zx6Sr^bUOaeH)`&&xt}1=bd0lKAPL$gF@(w-5D64D+CB1oXp>nI=olBh*--KXv%&7% zT^3w+y4=!Uu}R#&$mFi=Uvo%&C%Z@i zKX+joNaboqO&=O%AV*!kSr5pn&ZX%UMSIh_vyELg#Ie}sW{>F5Xo`{f#6-5;9zR~V zwYD&2%6ZlstSax`ARFv9RsNn1lFV)pnGFs=ONglpV==i#?2lV!+Zup+^cqgsu8p|) z>WqBuHFjbUx&h&jT}bFU-b#oa&X2AHni&`09t3J$di7-={x74Tq(E4$aIRFNUCFM;Gzweb0Il&T`JOZImy%)EsKZ=I8^jt;33ey;3`FHXirWLQx0b`zQA*!+{ zYdH%v4|<%Zk10p=5hFhxV?g{nXO*@7xtLGUcZC!4)2wVvu|Db|Rf7aXv6#k9wK_hW z8Wb*Mu=m0WEtjsdfpBYz<4a_~Ilae01g;u=&$L1tzIlmMJ?{rWB0{6YJwmX&hpI!m|25rj3)+s|FeDjC#t?9-LY|Bp7rZ9V5zrh+L#0 zaN=LX-&_+O^=a8I<}-d-8^8kdhl^70KFcFy&g1~MgU$!hB929zir*M+-EaLGm(y*Z zo11H(H#2v6S(k05iIXzmjOm(C0MQ|CJ7#WjFAXs%d^X?(%+e(tCqXHQ`Bauh0ec4@ zlE)g3>!%=ijYBLa%GWXm8%eisD$<1{jH*@aM3KFJJr&eYiGKyPY8eY;rusRI_D>n# zGz|8&dJVUMrk@{XW6-pxAhO5wDuL!akk#dZFF~qKYYD{UT<^O15u#?tyI-kfsnKeB z0tGq*(Jps#rlEjKf_+6bKhV&HzjmC^<5F(%TZoJS9+65ToGE7uouE(>3B4Gm-jakK zygU@VHqWJf=k_9*83zZdnKZ=orw55SjewMO37B4RQ2T>xn|j%{cSLs#6?#>}pwb#s zM!`1%#Z!=#{=!8vp)eR}Qc;fM550~hDVzZ6zniX#-X9?`AOhJBX849R*c4$;9bSB< zY8k8rEx$2b&%A5((g4@rNd1XM_aMK}ce-!v(2o_~j@8_h*Gj2Jq* zOH*~fXkNRX%^*HtdL~4q-0k}|w&7`|hU(<+MGSXE=Tmf$aA5rQn* z!sDg+mL^r8Q=L6A6SNd5NeFNR18TF?knN}lX2j1YiY*%yq^H5XVc-60I{E(hF3-oR zAC!R7OZ_ZVVVj7cZs2OtKLyOX0$pka?PBL)#N3sNN2g&Jy~r(fCO+uSS@kypOxWCz z@pl4Or1Q zRh}d-xFK!bBrMz?*Hc!i|x)Wm@VZKdfz1=A_j)HBX6c4NxQ3_ zT|_7ZMiXqaDC@`;fZl1P_r*|b2*th%{coDK@2h+dGBo&hm4Ha9ieEEI&`Xqx1oiUjH78&Uv3MQYG}~$T8kozpdE!Xk-oWhfu1=rhpT_I6@ylmsPWJ zKoV^JpH!M&Py1A$pH#tMH%av04rIA9&HT<>IayHaBZHDVJp!{+v(lCs+lZH zIqp^PJ#JK?uk#C2@IVb&9n;!rY+ROIhlVOe=nmfL9O;r97*Dp@{gD-E<`)pe!ubXM z$8+t4wLVZkWE~M!pvwllLXRahIZnOufH$Uiad-TkBU`v79CSO@qF-L2D5E6Lz(^r0 z%yj?XyDS!TG-&689z>7?uq?!km5$TJ^>b{XjMYO(6HZelSu_7Di0 z9_h$*&kjb=3|5ICBDDl3QgQ3T7%7|O364aXWpOQ1ECtR!tab)>97dgH;IbmDEcdxj zZ#&c%!LAnDJSGI!$IW|cT}Z!uK(=BoJK>h0|9%b|ix6@>d`7`2;1!%gD*cT1LJy+T z?ruA-J`6cj$fNBa*Kjv1E><;XpNdZD1q)%&z{oMS z)DHIA`9|c+(r9s92qZy5JXwit0;45rIKZHBH92n`gQqG5W`SGXxMy&?493}(&E(;} zcQC05of4v+(F4&*l6Ny}jRJL!_S4{0TLi1`8HKbBLZ<7F*Sq$z;o7MDuepmdTErJ% zK9+LDy+d{$x6L^^0+W}w+!d-NsC?yh@NqL(;u5KNXC8Z@cnI`sm~?Vzk*1Cj|G|HQ zFh+AJk&(2scX=wk~meHB}cbzIicFwvQS5eEDZ49t!qWm`Ey z;=Mpc5^7k|5rD?XV4~O4tKh2EDO(XG-H6$fIS3{VS&jf!48y>AZrgr@TEV=O|JCN? z3@TYuPip(n<#>>pFLAb(mbd-Pn9Hp{xc{X!kt7y!2y9Nt%tDbqfvV4!v()p=aJp+M zmlz;tiwn>kQ@7IhYgYS)M^u6tScg8ObgWL0y<4Rwyz$P0@Co#3+9;4CL{~UZ`l<`s zVE+eG)icnp+8ZF5d(0JYU?U!^6{OgKB$;1($Fe5qch?FrKouGGe>0ZlI=c5XofkTX zH&&z79fTW_J#!myb`quK<@DJh{!zz$ZuUmi!-nTX009W~Ex49GbQg14=9Uo!EfVgJCzWt2;X!LLr9Y1ZkteCnon$fG5rPPf9~2jRZKE5w{d|Fo~i z&xQfO;;19q9?#(^=o>$eXb03SQ#YxICq2|rFK#`x5y4R(e6i}M7v5X3P39KZKD1iQ zsm*Vl&FK|og|;)kN@95#3cdGb4A*JO#4OYlMTK}%bi|yH&mG|WNzS(eY2n^A01-rUU%qm+*y2)qbqv+$332&zI4U?1B zT|)2_Z-Og8Nc|Q+TnUzM%3_q>%m4GxR=;8Jclp1E9&InU z5H8K_D~5cu81-D7+o`Tt!f28F46$*jso^3Ou+72%OM$`= zDMCHGXFnnFmm1jvfPPYH^Q>lc(DhmK-z#O0QHK6bR83CVOqgTVbZ`1i)eo);`PaUA zD73NM^#yXXR1UjxKLlt3^V=GdyPgsbTC$4vbSIS!P<#PD0-6X7*T`r*t|6v$jVqpx zLva+5H5}SxSu44$pC0Y|zGxM{$20-hIoJ@0}fyOU}BR5%|{+=rRW{ zT;7_uO*zK6gWR#Jq2OSkBvyazV%Y0xFB6zpFV56*(3}Fq7<-<$=y!qAaxHXbrwRI8IF!g2L-ZQ2nJvVY#F2ADImxZim6qgV|{Gg7I9a%#)#_bN7)sbDy1J z8oY0iNzzYT=nmGONPKu^&f?Q2a4RzNBR#1z>di7uah&=e?%UbP_m*2AZjq;UlbbQR z6V&*TjGH)({UtqQxBFwGVKV-cucTP(T@&+%%1m4$2 zFxjy6Q}6`=ccIbESH;I3^J}PUTd%S6%L{2j^$$@8;vgIZ9&?`fX7*;XVY)QswI=?N9 zYg*3TQMQ}F!hg5eOfrQy?hm!u6H0B7+8!QG?0)$zkuk*cy|VY|P9`+2pTNM`HpT1& z!!|tu?*a3)?5$@7^~9Dqu$-OZUY2_L!Kv!j#0zwbDqq|Vl_VwFD!F@m2;EsV`c7&f z-%=&0tKi)o<2kY>g2LP`aXwXvQ7_A4P@6er{a%qr-<`x?@cJ^_2`w3BnPY_I%(F)|!=13g4^?ACK6|`jHH^v<;MGQ1a;Ir1_E7;8 zDZtv{iREHLp@Yj;W*u#TzIbqs0;^rEpsH5e7u7VEn*L(Ok;YSrh9`OFz9WJ>Iq=A< zWLy|OkM%j%#W953`xEw|t>(O;7*kh%H6pP<8}ekj!U*jkgM4GfH$eA)?T&yE2B5We zo+F!%J_q=zh<%v`YmxaE6LiT{hMH2J&vSvl7-X1sdbh*oIq*S7?^0Hn9I{ZK)J6Z< z8$I1AaDhMK!u{mN)m$10-LtuUbRJJ8<(|JIT6JT9{5AwQ#r7~kWKlr=yVd4L`M9FA z?Ahn0J1Ww9W>`K+i-MUU3hVLx89^l8*y5j;hR#A|nZ|7(9Y*Ml1t*8HEqzmiQ6+Vo zdhj}V)(j4ho5MWLbkZy%^RgmpombYj4MJap8(C-0-VUgK&3`2HsJlUPU`9}SvKhDhIgvk?Fsr8fsFUtV+ zhwd-4d05VVID5)Kqm1&6BQt1MG+;fU%Gl773;ahmCBkxE%YZW7`Z^&&*ax-ai&8$P zfNC<$kkjEvtf`yg1?~+M)irh3f#9jhlV%uIU|vV~99p6!wPgW~2(C)yM#c8UDA99t zgOij8<;!!-{L|h&%a@xDvg3lQH^IgtjL8I2cuxkvCUy){scwB`yu$4bm6!vvdwXeF zE3X_@CG!+Ix>J6Rb=tnb*&^2nPesTs99bg59mgR}y@vnlMVd*uW7(>m7UN|cP_iv+ z<+nc{o*QgtSf>`v)W$w)kkuFMD1-!xf;hB7u47@m<7v$Q3EH&ozQ_io&su%nsg{|c z%8dh~Tl?qIjM@B#&gv2Dy$$y~M(h(CpqZ7YxdVt3C5LJat-xfF5|Ab&-kp9`I~ zryab%@7|D5p%4VbOUo3N-t87c6#bK9LJ&OecAHiwcJzF^)4zw+4caKE?&^jYnyS+! z@U!*tXW-n>rBZKa2+=`NvzVJZ-P6G=`Oa?%$K zJO#j_onk>+EZ>W`&GU_xKy_+|dwj|OUjqtw5ic{sy?tbI#jgwzlz)fiNSM!@W!t|+a^Tx>XUKVk*;i_D$C79)QxvMIs%v~O+8 zVTH?UC$ct7_P0XDkJ*Q@PFVjZ`dU3Q4Q(d@K4N=%r?#4Pd;e+1fh#8Hk|8iEdA8hS ze2X-uvK6`MD7j+yPDM&FIcM2S$&wJ_m_VSC&fnu7f$!ftTy#c7{@le|h4}{A6kBQ`)!zfBh(?c*=KF}a%+4GN{7v;& zA@3lxX;o|{7z|h6i^yrFyrN>j1s|hOX6SpUc`9n)FmXj#t zX*Wj`?Yws`=5bLEwqCTSgqYiS0~iZY)wTzB*j?9^z1GZYva^gPx9V_NQJIqfDIwB| zRL;15tvD@Ugw~gp(iTd=ry{S^tu>-9PE+uW#FaUAv#FjPjF5p&g;Q~Ow^8P&{|XXw z1HCbYQ5h*_B|^8X<0TO|dr1tO>g)aXB-QZ|oUx8X>s43dPCfN#^+6SgTVVpQze-}(u)Si5lfU+xm-X@z4SzaG3TX|yS{^fZ zmA}wu%u(~WZ!3{BE?5x*E$ZIy8-c$@cW#z(;lJ4Em3beQV2*yA& zFcZhj2UU#9+g!GTCNbYuk=(ESF5<*^NFh7z&tSDlW|-eX{w!UNM3fMsX$tq|1Zg_Q zvAh^6RYBUqLB<*}52#>jXx&=;SNE5&F`3OtY+Jur6qyL|> ztNxCdZZp?+35w<*5@rU67`iP2Als3yx48^dNAGGE4aLKI2>8lUzXaDz;i?p5#HExB zZD>4*D(I==U7m_IJ0F%9U300XYLAQ^}oE@NsHl*I6Ng_b|!D+FsT3IoEOdJV4i!+1W)kg(n`lKWr`J z@BRA3u2%#~zJs;tKyuImxdO~GDw>1%@g+qcKodztq@EuWI7c$m5@CzRp2M#wp&odA z5?rI(zaW?&UCTmOANvHjRXBQcHca)W;ycej@HjP_e&qC4e(x1~rMtPy*WJ$NS-qIq zj090TzpO5PL9{s0MJbf-lj$4`QxlU%9eoO#9ClYe=qq%yJ;8pm5j?tE8@%odVv?mG zeDS0l25{sKF(%R;p9!hciK~`1frnyl_yhNbSH5XFkRAj8E%ye-i>&9DbFl4kFGnfX zG$)o}`wXb^g^zsH?Xx*ZG=IZNgk?`~n-7U4QWhk`P5TvG|M;PnC4yO@jumhVT?1R6 z2CAUFfSt~NHiJ2@i}`H*bL3}{9wv4z;gu79cVXUUE|C)KVC@%&>FYXO%d-#6V|i9I z<;P$hNLo(xF+CVqL$0n3bUP)=wotlP1bhbWl6&YYBldk*eKnwuIUW?pv%^h@i`?O? zVR?(=#>xO*4<&J5+PQIuo8DQff}o)>W5_}J-a9>aJ$nE2N7?q&P+r&-F1k$TdC^Oy z>xY;a4hI=8*ccPiY&~XHXhvXzt6aY=_LSQNPev0}%hjSDcoerz;g_eS9cSsUvFn^~ z)x5*x?_Ci+A=k+=W<6Xui8_RjA)}cPk=OC+SWv7CUov@x=h?u{?^hcUN$eZZVJb*l z=CB#zMRtqTr?udi@Diw4TZJ)GO5Vv=?tIp@K8ukRR zN;Nyu|AHB_6GK(%7a>gyl*86+g%cZRhiCWT(O9u*wzUt)Y5`Xd}hs4Zhg`Dl$;LuJ(XCjqGq*qHyv` z)Ghr?c&qM_>k(Ky=}SlM9omz&SZpFu+^vA5%H4TF;{2PV@7HWY+ppMi-`%yO)fGU8p+H>kBwL};&@>?9I)BM+>zr&R~y53l(Tm^@0 z)fh2-tRHG56_^?`GG+o~GVzxEYUbnK6&Ew|hCJE2t~&*qdU7Mt4zSD$O`tJ+_KlJ> zO)l+%XH(+Jc*@tLrNEpRO$|J4f{6RA+S*PB@#c3^Esv=YuMOSGnwM%~cm(_j+X8nH zWFFm+cw&+7XLm*U?4y{9+h19ARxRsG>V^wwlkxAsv0?2 z*Q_^Xve@ls5UU_&Q6zR__@ji`SgjFemY^qZ9JLzqSVTWb$a9wQ)wo7jpA!-Pp8e%8 zt+F8J*P^|S9_pLY`X(t4AwpmcVE;j7+O%*RL!ZlUrEMc*XD#ug|f zJ#EKCSmq~Lz}RgI>2@zg0X2Hy61_$lP7w!xijGU*WoPy9y%TKFU3~)}tk9G@pfl3e6c=hqh$ix zV!o!j6q%n)po-}C%sxRgIzWTLyB8kjS+6^I4W>y-#2pv&U|UIcdPBAl5iz|gmS|*% z&GOd;P z14qPPs82`orr}N4La&BmbY=!5H+7n4JCqO#Q~xRUHH5wUF0u#Q$=d! z$EdVpBUrZ4```R8A% zCHkQ9ujNp4KB9^yN%u)j^Wm`s;{6@MWg?kVB2ZoF%(FsIaCQd{I%;tnQkGNzvjrSD zD}_@kj+L7=szp;)xyJ1a zf;z57!qEh+ay@pgX)dqrlJ1gFle`1Fdy)}s)R`%8V1#+aeYeDMJv94cR2{F)qYUa~ zICf8#?WBb;q_>(U|7*B|0#Q9)rTH(}aU@NLmv$`J~337^MZZAw*CrBscOEv$%c|GGO2bX@xDm>&Vz0 z?K@IJX}+DTuDX5R7$rpi^_(yRYTj!`sDMNNIx_ch$ki+y6kel4t&xiC?Hd_AoHHa& z^I@tWDc7vK>JsI|6@UCX-lfrD8c3<7Kj>OK%s$RTLjfB(fv1#f{&IBz5X~?56$ziK z8iw_;xHmf%VmcP>3B5M;DkLH;M6QO5++S z+{-P`z9w1$ru;B)UCiynFo)<>l#%`_77PQ3b`G;`bE%gs&=fdLw)40+kIUOM6NGi( z3hjgmJF*eniGS+dva}ohr&&S`@?}aR5F@!N2ATl7M4ohL^5XXGHuNF}?y(YReG!^2 zy1#g0wfNZYw9IQw(FR4ai;AI{B|XjqYh-?jyEi3}x&b3e&p<-}F6iC}*G-wXgp4D~ zvq|c1F1mC>E_sz~)@3e8A9#WBdX(ue?Pzn=Ed^U=9gF)>cM;SZmzu^`!G4^}I<)}k z(iE*!(#geDAUIL%e}QG+ilJH8dVf*rfd|`(=4>R#&f?%-Aw%&<$1>)iU&!b!!e_V^ z>=riv+Ylu1fc8(1#Tx}RD82L>3f|zK73PUDve@dNln+R+>61|%ll>>cJe2tAo1Y;e z2|O<&&PFstRn$dho~1kp`CrNq5p@%4n~<)a`$3NZfB__o1G_Cxdab>IvWwiI!&^mE zcDl-}fL7Bi05*j#G}D%vU`*2O-qWDIlru2&!F%r9zvn;viHlRV0v%9T&tK0L&sW5K zPJJxiv2?zo@^+Ch@UDv{-Prkip0x$T89{;9Q59G~q%e{hk8=4HPJlV^_Z^ge+sv`lVI&j^zW>|V z6IesI10P$?wP9WG3F7d9xH)n;(|{CMt#dPwL{4$4IMUacAZ4B*?VWBp^)L6@RV=}$vGrg7@js? zz5GP)fmJV67W@BED6HicU<%Ul7$jh2L&od7YFsXjS^H<$D9aU`%gashptztu*YFQU zQ77cKvybbwb3rPCI~Nr81UkMVFxAu1km0z9eGNe3aS z2;$7(4iwYJ^fPh5b6zUJ6H`l`d(0Rl>x{6=`%t$-Bhq=MwkT1Z0zM=SOspO#nq-15 zX4qGvIZNK7a7f)bk;(p)!>tmanz7S?XOGxJy=D#ow8~aXn_Tv7Li0T4|KBPvh3+3h zNFb@9%6OGojmm7hYH2I$52ds!%07;Bjyho1`*1=(j4DNAyDKtc*d$sHX#IeJT$*VZ z;>K}$S#m?Nt_aLBg4_lcl=)`8FFIw8#mXTd^mBB8bfYJ}W~&cCRr zs!Ft*8jYy!n%oq<9zV_xCi>Q0;XjJ^FuCUxi)7PpqLvSg#QgEmIDaabU%!skAYl|C X4!;Bd006&;XZET8)Wkh|06+%-!{V;L literal 0 HcmV?d00001 diff --git a/Version.log b/Version.log new file mode 100644 index 0000000..8b5d882 --- /dev/null +++ b/Version.log @@ -0,0 +1,2830 @@ +*** For older log entries, see Version-Old.rar *** +----------------------------------------------------------------------------------------- +TIMES Version 3.0.0 +----------------------------------------------------------------------------------------- +Date: 25-Mar-2010 [AL]: + Bug fix: fixed reporting bug when both SENSIS and RPT_FLOTS were used + New Features: + - cumulative process flow bound equations + - cumulative activity, flow and commodity variables can be referred to in TID UCs + New input attributes: + ACT_CUM(r,p,y1,y2,bd) - Bound on cumulative process activity + FLO_CUM(r,p,c,y1,y2,bd) - Bound on cumulative process flow + UC_CUMACT(uc_n,r,p,y1,y2) - Coefficient for cumulative process activity + UC_CUMFLO(uc_n,r,p,c,y1,y2) - Coefficient for cumulative process flow + UC_CUMCOM(uc_n,r,com_var,c,y1,y2) - Coefficient for cumulative commodity PRD/NET + S_FLO_CUM(r,p,c,y1,y2,bd,stage,sow) - Bound on cumulative process flow/activity + +Modified files: +INITSYS.mod : Increased version number to 3.0.0 +initmty.mod : Added declarations for new attributes +ppmain.mod : Moved definition of MIYR_L from coef_obj.mod + Added pre-processing of cumulative parameters with BOH/EOH support + Allow STGTSS conversion storage; can be enabled using a multicom-PG +coef_obj.mod : Moved definition of MIYR_L to ppmain.mod (cosmetic move) +mod_vars.mod : Added new variables for cumulative flows and commodity NET/PRD +eqdeclr.mod : Added new EQ_CUMFLO equation & changed CUMNET/CUMPRD equations +eqmain.mod : Added new EQ_CUMFLO equation & changed CUMNET/CUMPRD equations; Changed EQUSERCO call parameters +eqcumcom.mod : Changed equation to be "slack"-variable based +equserco.mod : Changed handling of call parameters to facilitate cumulative variable terms +uc_flo.mod : Added term for VAR_CUMFLO cumulative flow variables +uc_compd.mod : Added term for VAR_CUMCOM cumulative commodity variables +bnd_ucv.mod : Added control to clearing of free lower bounds (GAMS tweak) +mod_equa.mod : Added new EQ_CUMFLO equation & changed CUMNET/CUMPRD equations +rptmain.mod : Changed directives to be case independent +rptlite.rpt : Added reporting of VAR_CUMFLO levels and marginals; fixed bug when SENSIS+RPT_FLOTS +spoint.mod : Added initialization of cumulative variables +solve.stp : Added/modified the hadling of cumulative equations +initmty.stc : Added declaration of new S_FLO_CUM attribute plus a new internal attribute +prep_ext.stc : Updated handling of S_COM_CUMxxx attributes with BOH/EOH support +stages.stc : Added processing of S_FLO_CUM attribute +fillsow.stc : Added clearing of leftover TS indicators +sensis.stc : Added update of bounds for cumulative variables +rptmain.stc : Added reporting of VAR_CUMFLO marginals +solsetv.v3 : Added reporting of VAR_CUMFLO levels and marginals +eqcaflac.vda : Add TOP control to storage case to support conversion storage +times2veda.vdd: Added reporting of VAR_CUMFLO levels and marginals +times2veda_stc.vdd: Added reporting of VAR_CUMFLO marginals + +Added files: +eqcumflo.mod : New equation for cumulative process flows + +----------------------------------------------------------------------------------------- +TIMES Version 3.0.1 +----------------------------------------------------------------------------------------- +Date: 9-May-2010 [AL]: +1) New versions of reporting routines for ANSWER +2) Added new parameter G_OFFTHD(ALLYEAR) for defining threshold for OFF ranges +3) Better handling of cumulative constraints in stepped mode or shorter horizons +4) Added support for reporting EQ_IRE marginals +5) Added support for IE options 4/5 and constant labels in filparam +6) Cosmetic improvements + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.0.1 +initmty.mod : (2),(3) +ppmain.mod : (2) +pp_off.mod : (2) +filparam.gms : (5) +mod_equa.mod : (6) +rptmain.mod : (1) +rptlite.rpt : (4) +rptmain.stc : (4) +solve.stp : (3) +solputta.ans : (1) +solsubta.ans : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.0.2 +----------------------------------------------------------------------------------------- +Date: 19-May-2010 [AL]: +1) New feature: The N bound may be used for identifying a MULTI multiplier for horizon-dependent cumulative constraints +2) New feature: The UC_TIME attribute may be used for defining horizon- and period-length-dependent RHS constants +3) Fixed small bug related to cost reporting under the SOLVEDA 1 option +4) Experimental support for using the LO reservoir for CH4 and N2O +5) Other small improvements + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.0.2 +initmty.mod : (2) +ppmain.mod : (1) +preppm.mod : (2) +filparam.gms : (5) +coef_obj.mod : (1) +eqcumflo.mod : (1) +eqcumcom.mod : (1) +equserco.mod : (2) +rpt_obj.mod : (3) +initmty.cli : (4) +coef_ext.cli : (4) +equ_ext.cli : (5) +sensis.stc : (1) +solve.stp : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.0.3 +----------------------------------------------------------------------------------------- +Date: 24-May-2010 [AL]: +1) Added new feature: Support for dynamic process-wise equations more directly +2) Changed QA log to display labels in full by flexible fields +3) Fixed MACRO support +4) Added default COEF_OBJINV values for all PRC_CAP +5) Performance improvements + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.0.3 +initmty.mod : (2) +ppmain.mod : (5) +eqflomrk.mod : (5) +eqmain.mod : (3) +bndmain.mod : (3) +initmty.vda : (1) +init_ext.vda : (1) +prep_ext.vda : (1) +ppm_ext.vda : (1) +equ_ext.vda : (1) +mod_ext.vda : (1) +rptlite.rpt : (1) +rpt_objc.rpt : (4) +solve.stp : (1) +times2veda.vdd: (1) + +Added file: +equcrtp.vda : Implementation of new dynamic process-wise equations + +----------------------------------------------------------------------------------------- +TIMES Version 3.0.4 +----------------------------------------------------------------------------------------- +Date: 20-Jul-2010 [AL]: +1) Added aggregated calculation of gross benefit/cost indicators (GGAP, GRATIO) +2) Added support for one-sided storage flows in commodity-balance equations +3) Added support for FLO_SHAR(r,y,p,c,'ACT',ts,bd) for timeslice storage + -- by using upper bound 1 you can limit the output flow to the maximum discharge +4) Added support for including storage flows in peaking constraints (using PKNO+PKCNT) +5) Added reporting of dynamic process bound and EQ_IRE marginals, and COM_AGG aggregated outputs +6) Fixed use of FIXBOH with SENSIS/STAGES +7) Miscellaneous small fixes and improvements + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.0.4 (e) +ppmain.mod : (2) +pp_reduce.mod : (3) +pp_lvlpk.mod : (4) +eqcombal.mod : (2) +eqpeak.mod : (4) +eqcumflo.mod : (7) +eqcapvac.mod : (7) +pp_clean.mod : (1) +rptlite.rpt : (5) +rpt_objc.rpt : (1) +rpt_dam.mod : (7) +prep_ext.stc : (7) +bnd_ucw.stc : (7) +rptmain.stc : (5) +solve.stp : (6) +ppm_ext.vda : (7) +eqashar.vda : (3) +times2veda.vdd: (5) + +Added files: +cal_stgn.mod : (2), new version or cal_stg.mod + +----------------------------------------------------------------------------------------- +TIMES Version 3.0.5 +----------------------------------------------------------------------------------------- +Date: 24-Aug-2010 [AL]: + 1) New reporting attribute Cap_New: lumpsum investments and commissioned capacity + 2) Improved handling of fractional and negative ILED + 3) Added support for referencing capacity commissioned in period in UC_CAP + 4) Minor improvements related to cost indicators and performance + +Modified files: +INITSYS.mod : Increased version number to 3.0.5 +ppmain.mod : (2) +preppm.mod : (4) +coef_obj.mod : (4) +eqobjinv.mod : (2),(4) +eqobjfix.mod : (4) +eqobsalv.mod : (4) +eqobjvar.mod : (4) +uc_ncap.mod : (3) +rptlite.rpt : (1) +rptmain.stc : (1) +rpt_obj.rpt : (4) +rpt_objc.rpt : (4) +cost_ann.rpt : (1) +solputta.ans : (1) +solsetv.v3 : (1) +times2veda.vdd: (1) + +Removed files: +solputv.v3 : Obsolete, not supported +solcostv.v3 : Obsolete, not supported + +----------------------------------------------------------------------------------------- +TIMES Version 3.0.6 +----------------------------------------------------------------------------------------- +Date: 30-Aug-2010 [AL]: + 1) Added New UC_ATTR modifier NEWFLO for referring to the flows of newly installed capacity only (vintaged) + 2) Changed FLO_EMIS to be more general, supporting flow relationships between any flows + 3) Added a currency conversion utility based on user-defined conversion tables G_CUREX and R_CUREX + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.0.6 +initsys.mod : (1) +initmty.mod : (3) +ppmain.mod : (3) +preppm.mod : (3) +eqptrans.mod : (2) +uc_act.mod : (1) +uc_flo.mod : (1) +uc_ire.mod : (1) +pp_qack.mod : (2) +pp_prelv.vda : (2) +ppm_ext.vda : (2) + +Added file: +curex.gms : Implementation of Currency conversions + +----------------------------------------------------------------------------------------- +TIMES Version 3.0.7 +----------------------------------------------------------------------------------------- +Date: 4-Oct-2010 [AL]: + 1) Changed declarations of Damage parameters to circumvent bug in GAMS 23.0 < 23.x < 23.5 + 2) Fixed small buglet in fixed costs for Case 2b, and in alternative ALT and LIN formulations + 3) Amended the calculation of IDC in Case 2b (improved accuracy under changing discount rates) + 4) Fixed reporting of User_Maxbet in UC_R_EACH case, with reference to the regional Max + 5) Cosmetic improvement + +Modified files: +INITSYS.mod : Increased version number to 3.0.7 +ppmain.mod : (2) +coef_cpt.mod : (5) +eqobjinv.mod : (3) +eqobjfix.mod : (2) +eqdamage.mod : (1) +rptlite.rpt : (4) +prep_ext.stc : (1) +rptmain.stc : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 3.1.0 (e) +----------------------------------------------------------------------------------------- +Date: 8-Dec-2010 [AL]: + 1) Added support for Oblong Objective Accounting, which improves STD/MOD formulations + - Set to YES by default when MOD activated; disable by expicit NO setting + - Can also be recommended for users of STD/AUTO + 2) Full review of all objective formulations with small additional improvemenents + 3) Added support for LO bound availablility factors + 4) Added FLO_EFF as an alias for FLO_EMIS (supports now any commodities) + 5) Added support for using PRC_PKNO/NCAP_PKCNT for import flows + 6) Some cleanup of obsolete stuff / cosmetic tweak + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.1.0 +initmty.mod : (1),(2),(6) +ppmain.mod : (1),(2),(3),(6) +preppm.mod : (6) +coef_cpt.mod : (1),(2),(3) +coef_obj.mod : (6) +eqdeclr.mod : (3) +eqmain.mod : (3) +eqcapact.mod : (3) +eqpeak.mod : (5) +eqobj.mod : (1),(2) +eqobjinv.mod : (1),(2) +eqobjfix.mod : (1),(2) +eqobsalv.mod : (1),(2) +eqobjfix.rpt : (1),(2) +eqobsalv.rpt : (1),(2) +mod_equa.mod : (3) +rptlite.rpt : (6) +rpt_obj.rpt : (1),(2) +rpt_objc.rpt : (1),(2) +cost_ann.rpt : (1),(2) +coef_alt.lin : (1),(2) +coef_vc.lin : (1),(2) +solve.stp : (1),(2) +rptmain.stc : (6) +initmty.vda : (4) +init_ext.vda : (4) +pp_prelv.vda : (6) + +----------------------------------------------------------------------------------------- +TIMES Version 3.1.1 +----------------------------------------------------------------------------------------- +Date: 5-Jan-2011 [AL]: + 1) Fixed small bug related to reporting of IRE_FLOSUM flows under stochastic mode + 2) Changed to provide support for using explicit zero discount factor + 3) Small performance improvements + 4) Fixed small discrepancy between code and documentation + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.1.1 +initmty.mod : (3) +timslice.mod : (3) +preshape.gms : (4) +ppmain.mod : (3) +pp_lvlff.mod : (3) +pp_lvlfs.mod : (3) +coef_obj.mod : (2) +pp_qack.mod : (3) +init_ext.vda : (3) +ppm_ext.vda : (3) +coef_ext.vda : (2) +pp_actef.vda : (3) +rptmain.stc : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.1.2 +----------------------------------------------------------------------------------------- +Date: 14-Mar-2011 [AL]: Various small improvements + 1) Small improvements to peak constraints generation; now possible at any TSLVL with UD-CG + 2) Removed superfluous RS_TREE entries for zero YRFR timeslices + 3) Added support for re-generation of reports from previous solution as well as entirely fixed horizon + 4) Added support for using NCAP_BND(N) for (re-)defining PRC_NOFF ranges + 5) Added new reporting parameter Reg_ACost (regional total annualized costs) + 6) Fixed small bug when using EXT_EOH together with interpolation options for CM_MAXC + 7) Fixed problem with using zero probablilities for some branches under stochastic mode + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.1.2 +initmty.mod : (4) +maindrv.mod : (3) +ppmain.mod : (1) +timslice.mod : (2) +eqdeclr.mod : (3) +eqpeak.mod : (1) +mod_equa.mod : (3) +spoint.mod : (3) +solve.stp : (3) +rptlite.rpt : (5) +cost_ann.rpt : (5) +solsetv.v3 : (5) +initmty.vda : (5) +init_ext.vda : (4) +rpt_ext.cli : (7) +coef_ext.cli : (6),(7) +rptmain.stc : (7) +times2veda.vdd: (5) +times2veda_stc.vdd: (5) + +----------------------------------------------------------------------------------------- +TIMES Version 3.1.5 +----------------------------------------------------------------------------------------- +Date: 19-May-2011 [AL]: Various small improvements + 1) Fixed support for using NRG as the PG for TSS/IPS storage + 2) Added support for uncertain inv. costs and process transformation + 3) Cosmetic cleanup of obsolete stuff + 4) Storage improvements: different input/output supported for both IPS/TSS, flaw in TSS activity costs fixed + 5) Constant objective term related to RESID processes now consistent under OBLONG/ALT/LIN + 6) Fixed TIMES-MACRO compliance broken due to RVPT introduced in v3.0.5 + 7) Fixed NCAP_AFC support for single-commodity storage (broken in v3.0.4) + +Modified files: (reason) +INITSYS.mod : Increased version number to 3.1.5 +initmty.mod : (3) +maindrv.mod : (2),(3) +ppmain.mod : (1),(4) +preppm.mod : (3) +timslice.mod : (4) +coef_obj.mod : (2) +eqmain.mod : (2),(6) +eqobjinv.mod : (2),(5) +eqobjfix.mod : (2),(5) +eqobsalv.mod : (2) +eqobjvar.mod : (3),(4) +eqobjinv.rpt : (2),(6) +eqobsalv.rpt : (2) +eqptrans.mod : (2) +eqflomrk.mod : (3) +eqstgtss.mod : (4) +eqstgips.mod : (4) +eqstgips.lin : (4) +cal_fflo.mod : (2) +cal_nored.red : (2) +cal_red.red : (2) +equserco.mod : (2) +uc_flo.mod : (2) +uc_compd.mod : (2) +eqbndcst.mod : (2) +sol_flo.red : (2) +rpt_obj.rpt : (2) +rpt_objc.rpt : (2) +cost_ann.rpt : (2) +init_ext.vda : (2) +pp_prelv.vda : (3) +ppm_ext.vda : (2),(7) +pp_actef.vda : (2) +coef_ext.vda : (2) +ucbet.vda : (2) +coef_alt.lin : (2),(5) +initmty.stc : (2) +prep_ext.stc : (2) +stages.stc : (2) +sensis.stc : (2) + +Added file: +setglobs.gms : Safe-setting of some global controls + +----------------------------------------------------------------------------------------- +TIMES Version 3.2.0 +----------------------------------------------------------------------------------------- +Date: 7-Jul-2011 [AL]: Introducing early and lumpy retirements; small other improvements + 1) Implementation of early retirements + 2) Implementation of lumpy retirements + 3) Added support for using FLO_FUNCX with ACT_FLO parameters (VDA_FLOP/PRC_ACTFLO) + 4) Fixed salvage reporting when both RPOINT and FIXBOH + 5) Added optional reporting of value flows for processes + 6) Added support for using group commodities as the derived commodity in FLO_EFF + +Modified files: (reason) +initsys.mod : Increased version number to 3.2.0 +initmty.mod : (1),(2) +maindrv.mod : (2) +setglobs.gms : (1) +preppm.mod : (1) +ppmain.mod : (1) +eqobj.mod : (1) +eqobjfix.mod : (1) +eqobsalv.mod : (1) +eqcpt.mod : (1) +eqcapact.mod : (1) +eqpeak.mod : (1) +cal_cap.mod : (1) +cal_caps.mod : (1) +mod_equa.mod : (1) +mod_vars.mod : (1) +spoint.mod : (4) +solve.mod : (2) +rptlite.rpt : (1) +cost_ann.rpt : (1) +rptmain.stc : (1) +prep_ext.vda : (1) +ppm_ext.vda : (3) +pp_prelv.vda : (6) +eqcaflac.vda : (1) +coef_ext.vda : (1) +solve.stp : (1) +mod_vars.dsc : (2) +equ_ext.dsc : (2) +prepret.dsc : (1),(2) +solputta.ans : (1) +solsetv.v3 : (5) +times2veda.vdd: (5) + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.0 +----------------------------------------------------------------------------------------- +Date: 22-Sep-2011 [AL]: Introducing new features for stochastic mode + 1) Added a new SPINES variant for modeling recurring stochastics + 2) Added new uncertain parameter S_COM_FR + 3) Added new uncertain parameter S_NCAP_AFS + 4) Generalized FLO_FR to support flow fractions of total under parent + 5) Added a few QA_CHECKs for execution errors + 6) Added option for using NCAP_BND('N') for defining exact process start year + 7) Small improvements to early retirements + 8) Rearranging and cleanup of some code + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.0 +initmty.mod : (1),(2),(3) +maindrv.mod : (1) +setglobs.gms : (1) +ppmain.mod : (1),(6) +preppm.mod : (6) +eqdeclr.mod : (1),(8) +eqmain.mod : (1),(3) +eqobj.mod : (1),(8) +eqobjvar.mod : (1) +eqcapact.mod : (3) +eqcombal.mod : (2) +eqpeak.mod : (1) +eqflofr.mod : (4) +eqcumcom.mod : (8) +eqcumflo.mod : (1),(8) +eqstgips.mod : (1) +eqbndcst.mod : (8) +eqdamage.mod : (8) +equserco.mod : (1) +mod_equa.mod : (1) +mod_vars.mod : (1) +pp_qack.mod : (5) +spoint.mod : (8) +bndmain.mod : (8) +bnd_elas.mod : (2) +rptmain.mod : (1) +rptlite.rpt : (8) +initmty.stc : (2),(3) +prep_ext.stc : (2),(3) +stages.stc : (1),(2),(3) +sensis.stc : (8) +solve.stc : (1) +rptmain.stc : (1) +init_ext.vda : (6) +prep_ext.vda : (6) +coef_ext.vda : (6) +equcrtp.vda : (8) +eqashar.vda : (8) +eqcaflac.vda : (3) +equ_ext.vda : (1) +solve.stp : (1) +equ_ext.dsc : (1) +prepret.dsc : (7) +solputta.ans : (7) +times2veda.vdd: (8) + +Added files: +rptmisc.rpt : (8) +clearsol.stc : (1),(8) +pextlevs.stc : (1) +bnd_cum.mod : (8) +bnd_ire.vda : (8) + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.1 +----------------------------------------------------------------------------------------- +Date: 24-Oct-2011 [AL]: Maintenance update: small fixes +1) Fixed assignment of balance type for 'N' type commodities +2) Generalize S_FLO_FUNC to apply to IRE_FLOSUM as well +3) Fixed levelising of IRE_FLOSUM/FLO_EMIS specified on 'ACT' of trade process +4) Updated SOLPUTTA.ANS +5) Fixed obsolete clear in eqobsalv.rpt + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.1 +ppmain.mod : (1),(2),(3) +eqobjvar.mod : (2) +cal_ire.mod : (2) +rpt_obj.rpt : (2) +cost_ann.rpt : (2) +eqobsalv.rtp : (5) +rptmisc.rpt : (2) +pp_prelv.vda : (2) +solputta.ans : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.2 +----------------------------------------------------------------------------------------- +Date: 10-Jan-2012 [AL]: Improvements into the TIMES-MACRO code plus MERGE link +1) Added support for linking the MERGE code +2) Improvements into MACRO code performance +3) Cleanup and updating of MACRO routine interface up-to-date +4) Imporved MACRO calibration behavior with zero Base Year marginals +5) Fixed bug in MACRO calibration routine +6) Added optional reporting of topology indicators +7) Added auto-activation switch for DSC + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.2 +initmty.mod : (7) +maindrv.mod : (1) +coef_obj.mod : (3) +rptlite.rpt : (6) +initmty.tm : (1) +eqobj.tm : (2),(3) +eqobjinv.tm : (2) +eqobjfix.tm : (2) +eqobsalv.tm : (3) +eqobjvar.tm : (2) +bnd_macro.tm : (1) +mod_vars.tm : (3) +mod_equa.tm : (3) +eqmacro.tm : (2),(4) +rptmain.tm : (3) +ddfnew.gms : (4),(5) +ddfnew0.gms : (4),(5) +initmty.dsc : (7) +prep_ext.dsc : (7) + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.3 +----------------------------------------------------------------------------------------- +Date: 13-Mar-2012 [AL]: Improvements into storage variable cost accounting + small fixes +1) Fixed activity cost and losses accounting for DAYNITE storage +2) Added support for using FLO_COST and FLO_DELIV for storage flows (Cost for Charge, Deliv for Discharge) +3) Fixed problem in ANSWER reporting under stochastic mode +4) Improved small aspects in Merge linking +5) Fixed small problems in TIMES-MACRO cost accounting and DDF calibration + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.3 +timslice.mod : (1) +eqobjvar.mod : (2) +spoint.mod : (4) +eqstgtss.mod : (1) +rptmain.mod : (4) +cost_ann.rpt : (1),(2) +eqobjinv.tm : (5) +eqobjfix.tm : (5) +rptmain.tm : (5) +ddfnew.gms : (5) +solputta.ans : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.4 +----------------------------------------------------------------------------------------- +Date: 24-Apr-2012 [AL]: Improvements into storage modeling; fix into FIXBOH +1) Added support for generalized storage processes +2) Fixed capact equations for storage at non-PRC_TS timeslices +3) Added support for input-based NCAP_AFC for storage +4) Added parameter for the number of WEEKLY storage cycles +5) Fixed small solution leak when using FIXBOH +6) Fixed SENSIS mode that was broken since v3.3.2 +7) Cosmetic cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.4 +initmty.mod : (7) +globals.def : (4) +ppmain.mod : (1),(7) +timslice.mod : (1),(4) +pp_lvlfs.mod : (7) +eqdeclr.mod : (1) +eqcapact.mod : (1),(2) +eqcaflac.vda : (1),(3) +eqstgtss.mod : (1) +eqstgaux.mod : (1) +eqstgin.mod : (1) +bnd_stg.mod : (1) +mod_equa.mod : (1) +init_ext.vda : (7) +ppm_ext.vda : (3) +rptlite.rpt : (6) +rptmisc.rpt : (5) +solve.stp : (5) + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.5 +----------------------------------------------------------------------------------------- +Date: 12-Jun-2012 [AL]: Small improvements into time-stepped TIMES & DSC +1) Added support for combining flexible fixing of first periods with TIMESTEP +2) Added support for semi-continuous VAR_NCAP (new investments) +3) Cosmetic cleanup/improvement + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.5 +initmty.mod : (1) +maindrv.mod : (1) +eqactbnd.mod : (1) +eqblnd.mod : (1) +eqbndcom.mod : (1) +eqcombal.mod : (1) +eqdamage.mod : (1) +eqflobnd.mod : (1) +eqflofr.mod : (1) +eqflomrk.mod : (1) +eqpeak.mod : (1) +eqstgin.mod : (1) +eqstgout.mod : (1) +equcrtp.vda : (1) +equ_ext.dsc : (1) +equ_ext.etl : (1) +rptmain.rpt : (3) +sol_flo.red : (3) +solve.stp : (1) +*.dsc : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.6 +----------------------------------------------------------------------------------------- +Date: 1-Jul-2012 [AL]: Support for power flow equations added (still experimental) +1) Added support for powerflow equations +2) Other minor improvement / cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.6 +cal_ire.mod : (2) +eqcombal.mod : (2) +eqpeak.mod : (2) +initmty.vda : (1) +init_ext.vda : (1) +prep_ext.vda : (1),(2) +ppm_ext.vda : (1),(2) +pp_prelv.vda : (1) +equ_ext.vda : (1) +eqcaflac.vda : (1),(2) +mod_ext.vda : (1) +eqobj.tm : (2) + +Added files: +powerflo.vda : Implementation of powerflo equations + +Deleted files: +timesmacro2veda.vdd : No longer needed - the standard vdd will work + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.7 +----------------------------------------------------------------------------------------- +Date: 13-Jul-2012 [AL]: Small improvements +1) Integration of SHAPE/MULTI processing for NCAP_AF/AFS +2) Added support for currency-dependent discount rates for Damage costs +3) Other minor improvement / cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.7 +initmty.mod : (1),(3) +ppmain.mod : (1),(3) +pp_reduce : (3) +preppm.mod : (1) +preshape.gms : (1) +fillvint.gms : (3) +coef_cpt.mod : (1) +coef_ptr.mod : (3) +pp_shapr.mod : (1) +eqdamage.mod : (2) +pp_qack.mod : (3) +rpt_dam.mod : (2) +rptlite.rpt : (2) +initmty.vda : (3) +init_ext.vda : (3) +prep_ext.vda : (1) + +Deleted files: +pp_multi.mod: No longer needed + +----------------------------------------------------------------------------------------- +TIMES Version 3.3.8 +----------------------------------------------------------------------------------------- +Date: 18-Aug-2012 [AL]: Small reporting improvements +1) Added reporting of forcing by main GHG emission type +2) Added reporting of retirements under VEDA +3) Improved optional reporting of topology indicators + +Modified files: (reason) +initsys.mod : Increased version number to 3.3.8 +rptlite.rpt : (2),(3) +rptmisc.rpt : (2) +solsetv.v3 : (3) +initmty.cli : (1) +rpt_par.cli : (1) +solputta.ans : (2) +*.vdd : (3) + +Deleted files: +*.zzz: Obsolete + +----------------------------------------------------------------------------------------- +TIMES Version 3.4.0 +----------------------------------------------------------------------------------------- +Date: 30-Nov-2012 [AL]: TIMES-MACRO and Grid modeling enhancements +1) Implementation of MACRO Decomposition Algorithm with soft-linked MSA +2) Improvements into original TIMES-MACRO + linkages to soft-linked MSA +3) Further improvements into power flow modeling +4) Added regional annual damage cost reporting + +Modified files: (reason) +initsys.mod : Increased version number to 3.4.0 +initmty.mod : (1),(2) +ppmain.mod : (2) +maindrv.mod : (1) +coef_obj.mod : (2) +eqobj.mod : (1) +eqobjinv.mod : (2) +eqobjfix.mod : (2) +cal_ire.mod : (3) +eqpeak.mod : (3) +mod_vars.mod : (3) +mod_equa.mod : (1) +rptmain.mod : (1) +solsetv.v3 : (1),(2) +initmty.tm : (2) +prep_ext.tm : (2) +ppmain.tm : (2) +mod_vars.tm : (2) +eqdeclr.tm : (2) +eqmacro.tm : (2) +eqobj.tm : (2) +eqobjfix.tm : (2) +eqobjinv.tm : (2) +eqobjvar.tm : (2) +mod_equa.tm : (2) +bnd_macro.tm : (2) +rptmain.tm : (2) +initmty.vda : (3) +prep_ext.vda : (3) +pp_prelv.vda : (3) +coef_ext.vda : (3) +mod_ext.vda : (3) +powerflo.vda : (3) +rpt_dam.cli : (4) +times2veda.vdd: (1),(2) +solputta.ans : (1),(2) + +Added files : (reason) +eqobjann.tm : (1),(2) +initmty.msa : (1) +mod_vars.msa : (1) +equ_ext.msa : (1) +rpt_ext.msa : (1) +solprep.msa : (1) +solvcoef.msa : (1) +solve.msa : (1) +ddfupd.msa : (1) +writeddf.msa : (1) + +Deleted files: +eqobsalv.tm : Obsolete +ddfnew.gms : Obsolete + +----------------------------------------------------------------------------------------- +TIMES Version 3.4.1 +----------------------------------------------------------------------------------------- +Date: 31-Dec-2012 [AL]: Small improvements +1) runtime licence support +2) climate module improvements +3) PRC_CG QA check refined under RELAX_PRC_CG + +Modified files: (reason) +initsys.mod : Increased version number to 3.4.1 +spoint.mod : (1) +eqmain.mod : (1) +mod_equa.mod : (1) +pp_qack.mod : (3) +mod_ext.vda : (1) +initmty.cli : (2) +coef_ext.cli : (2) +equ_ext.cli : (2) +mod_vars.cli : (2) +rpt_par.cli : (2) + +Deleted files : +putdset.v3 : obsolete +solsubv.v3 : obsolete + +----------------------------------------------------------------------------------------- +TIMES Version 3.4.2 +----------------------------------------------------------------------------------------- +Date: 24-Feb-2013 [AL]: Small improvements mainly to reporting routines +1) Small improvements and fixes to reporting issues for MSA/TM +2) Changed VEDA-BE reporting of Reg_Wobj, introduced system label prefix +3) Optional reporting of levelized costs and electricity supply by energy source +4) Cosmetic improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.4.2 +initmty.mod : (2),(4) +ppmain.mod : (4) +pp_lvlpk.mod : (4) +coef_obj.mod : (4) +eqcombal.mod : (4) +eqpeak.mod : (4) +eqobjels.mod : (4) +eqdeclr.mod : (4) +rptmain.mod : (4) +rptlite.rpt : (2),(3) +rptmain.rpt : (2),(4) +rpt_obj.rpt : (2) +rpt_objc.rpt : (2),(3) +cost_ann.rpt : (4) +rptmisc.rpt : (3),(4) +eqobjels.rpt : (4) +eqobsalv.rpt : (4) +eqdamage.mod : (4) +rpt_dam.mod : (4) +rpt_ext.cli : (4) +rptmain.stc : (3),(4) +initmty.msa : (1) +mod_vars.msa : (1) +equ_ext.msa : (1) +rpt_ext.msa : (1) +solprep.msa : (1) +solvcoef.msa : (1) +solve.msa : (1) +writeddf.msa : (1) +initmty.tm : (1) +ppmain.tm : (1) +eqmacro.tm : (1) +eqobj.tm : (1) +eqobjann.tm : (4) +rptmain.tm : (1),(4) +solsetv.v3 : (2),(3) +solputta.ans : (1),(3),(4) +*.vdd : (2),(3) + +Added files: +sol_ire.rpt : IRE flow solution parameters +par_uc.rpt : UC dual solution parameters +solsysd.v3 : define system labels + +----------------------------------------------------------------------------------------- +TIMES Version 3.4.3 +----------------------------------------------------------------------------------------- +Date: 23-Apr-2013 [AL]: Maintenance release +1) Improved handling of PASTI installed within horizon +2) Fixed small defect in RTCS_FR definition +3) Fixed small defect in flow reductions +4) Cosmetic improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.4.3 +initmty.mod : (4) +ppmain.mod : (1),(2),(4) +pp_qafs.mod : (4) +pp_qack.mod : (4) +coef_cpt.mod : (1) +coef_obj.mod : (1),(4) +err_stat.mod : (4) +eqobj.* : (4) +eqobjinv.* : (1),(4) +bndmain.mod : (4) +wrtbprice.mod : (4) +coef_alt.lin : (1),(4) +init_ext.vda : (1),(4) +prep_ext.vda : (1),(4) +ppm_ext.vda : (1),(3),(4) +coef_ext.vda : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.4.4 +----------------------------------------------------------------------------------------- +Date: 19-July-2013 [AL]: Small improvements +1) Added support for defining PRC_PKNO & PRC_PKAF via NCAP_PKCNT I/E +2) Added forcing function updating, removed taxes/subsidies, and fixed reporting problem in MSA +3) Added removal of redundant FLO_MARK equations +4) Added parameter for default IE-options: IE_DEFAULT +5) Removed unused corridor process concept +6) Cosmetic improvements & cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.4.4 +initmty.mod : (4),(6) +ppmain.mod : (5),(6) +preppm.mod : (4),(6) +prepparm.gms : (4) +pp_reduce.red : (5) +coef_nio.mod : (6) +coef_obj.mod : (6) +fillcost.gms : (6) +eqdeclr.mod : (6) +eqmain.mod : (6) +eqflobnd.mod : (6) +eqflomrk.mod : (3) +eqire.mod : (5) +equserco.mod : (6) +cal_ire.mod : (5) +sol_ire.rpt : (5) +cost_ann.rpt : (5) +rptmisc.rpt : (6) +rptmain.rpt : (6) +init_ext.vda : (1) +prep_ext.vda : (6) +pp_prelv.vda : (6) +ppm_ext.vda : (6) +pp_actef.vda : (6) +eqashar.vda : (6) +ucbet.vda : (5) +coef_ext.cli : (2) +solve.stp : (5) +initmty.msa : (6) +solprep.msa : (2) +solve.msa : (2) +rpt_ext.msa : (2) +ppmain.tm : (6) +rptmain.tm : (6) +eqobjann.tm : (2) +solputta.ans : (6) + +----------------------------------------------------------------------------------------- +TIMES Version 3.4.5 +----------------------------------------------------------------------------------------- +Date: 9-Sep-2013 [AL]: New alias/shortcut attributes +1) Added shortcut NCAP_START(r,p)=y for PRC_NOFF(r,p,BOH,y-1) +2) Added alias ACT_FLO for VDA_FLOP +3) Added support for net import peak contribution when PKNO and by capacity when PKAF +4) Cosmetic improvements & cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.4.5 +initmty.mod : (1),(4) +ppmain.mod : (1),(3) +pp_lvlpk.mod : (3) +pp_reduce.red : (3) +eqmain.mod : (4) +eqactbnd.mod : (4) +eqbndcom.mod : (4) +equserco.mod : (4) +cal_ire.mod : (3) +eqpeak.mod : (3) +pp_dumpd.mod : (4) +rptmisc.rpt : (3) +initmty.vda : (2),(4) +init_ext.vda : (1),(2) +prep_ext.vda : (4) +pp_prelv.vda : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 3.4.9 +----------------------------------------------------------------------------------------- +Date: 20-Dec-2013 [AL]: New OBJ reporting parameter + small fixes +1) Added new reporting parameters Cost_NPV and Time_NPV for VEDA-BE +2) Added split of inv. costs according to hurdle rate +3) Fixed support of multiple currencies in TIMES-MACRO +4) Fixed small reporting issues for damage costs +5) Fixed small reporting issue for LUMPINV +6) Added support for levelized annual cost reporting +7) Cosmetic improvements & cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.4.9 +initmty.mod : (7) +ppmain.mod : (7) +preppm.mod : (7) +eqobjfix.mod : (7) +mod_vars.mod : (7) +coef_obj.mod : (6) +coef_ext.vda : (6) +rptlite.rpt : (1),(2),(6) +rpt_obj.rpt : (1),(2),(6) +rpt_objc.rpt : (1) +cost_ann.rpt : (1),(2),(5),(6) +eqobjfix.rpt : (7) +eqobjvar.rpt : (1),(7) +eqdamage.mod : (4) +rpt_dam.mod : (1),(4) +eqobj.tm : (3) +eqobjann.tm : (3) +solsetv.v3 : (1) +solputta.ans : (2) +times2veda.vdd: (1) +times2veda_stc.vdd: (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.5.0 +----------------------------------------------------------------------------------------- +Date: 4-Feb-2014 [AL]: Added new parameters and equations related to residual load curves +1) Added residual load curve stuff +2) Fixed small issues in CAPACT/CAFLAC equations +3) Cosmetic improvements & cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.5.0 +timslice.mod : (2) +coef_cpt.mod : (2) +mod_vars.mod : (3) +eqdeclr.mod : (3) +eqcapact.mod : (2) +eqobj.mod : (3) +mod_equa.mod : (3) +pp_qack.mod : (1) +prep_ext.vda : (1) +ppm_ext.vda : (2) +coef_ext.vda : (1) +equ_ext.vda : (1),(2) +eqcaflac.vda : (2) +mod_ext.vda : (1) + +Added file: +resloadc.vda : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.5.1 +----------------------------------------------------------------------------------------- +Date: 5-Mar-2014 [AL]: Maintenance release +1) Fixed a rare special case in reduction +2) Fixed small past investment cost issues +3) Fixed zero demand issue in MSA +4) Cosmetic maintenance changes + +Modified files: (reason) +initsys.mod : Increased version number to 3.5.1 +coef_obj.mod : (2) +eqobjinv.mod : (2) +eqobjvar.mod : (4) +ppm_ext.vda : (1) +equ_ext.msa : (3) +solve.msa : (3) +eqobj.tm : (4) +eqobjann.tm : (4) + +Added file: +eqobjcst.tm : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 3.6.0 +----------------------------------------------------------------------------------------- +Date: 1-Apr-2014 [AL]: Introduce TS-dynamic UC equations +1) Added support for TS-dynamic UC equations +2) Fixed reporting bug when SOLVEDA=1 and UC slacks not used +3) Fixed bug in currency conversion + +Modified files: (reason) +initsys.mod : Increased version number to 3.6.0 +initmty.mod : (1) +ppmain.mod : (1) +timslice.mod : (1) +curex.gms : (3) +eqdeclr.mod : (1) +equserco.mod : (1) +equcwrap.mod : (1) +uc_act.mod : (1) +uc_flo.mod : (1) +uc_ire.mod : (1) +uc_comnt.mod : (1) +uc_compd.mod : (1) +mod_vars.mod : (1) +mod_equa.mod : (1) +bnd_ucw.mod : (1) +spoint.mod : (1) +recurrin.stc : (1) +rptlite.rpt : (2) +par_uc.rpt : (1),(2) +initmty.vda : (1) +init_ext.vda : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.6.1 +----------------------------------------------------------------------------------------- +Date: 20-May-2014 [AL]: Fix for generalized STS storage +1) Fixed TSLVL bug in STS storage + +Modified files: (reason) +initsys.mod : Increased version number to 3.6.1 +eqstgtss.mod : (1) +eqstgin.mod : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.7.0 +----------------------------------------------------------------------------------------- +Date: 1-Aug-2014 [AL]: Introduce dynamic ramping constraints +1) Added dedicated ramping constraints +2) Added flow-based max. availability factors +3) Cosmetic improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.7.0 +initmty.mod : (1) +maindrv.mod : (3) +ppmain.mod : (3) +dumpsol.mod : (3) +dumpsol1.mod : (3) +bnd_act.mod : (3) +pp_reduce.red : (3) +coef_cpt.mod : (3) +rptmisc.rpt : (3) +initmty.vda : (1) +init_ext.vda : (1) +prep_ext.vda : (1) +ppm_ext.vda : (2) +equ_ext.vda : (1) +eqcaflac.vda : (2) +mod_ext.vda : (1) + +Added file: +eqactups.vda : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.7.1 +----------------------------------------------------------------------------------------- +Date: 1-Oct-2014 [AL]: Maintenance release +1) Fixed numerical problems in the MSA algorithm +2) Fixed S_FLO_FUNC support under SPINES + +Modified files: (reason) +initsys.mod : Increased version number to 3.7.1 +solvcoef.msa : (1) +equ_ext.msa : (1) +solve.msa : (1) +sol_flo.red : (2) +sol_ire.rpt : (2) +rptmain.stc : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 3.8.1 +----------------------------------------------------------------------------------------- +Date: 6-Nov-2014 [AL]: Support for CBA analysis in MSA +1) Added market & non-market damages for CBA analysis in MSA + +Modified files: (reason) +initsys.mod : Increased version number to 3.8.1 +*.msa : (1) +*.cli : (1) + +Added files: +preppm.msa : (1) +forcupd.cli : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.8.2 +----------------------------------------------------------------------------------------- +Date: 4-Dec-2014 [AL]: Maintenance release +1) Fixed reporting of cum constraint marginals in time-stepped mode + +Modified files: (reason) +initsys.mod : Increased version number to 3.8.2 +solve.stp : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.8.3 +----------------------------------------------------------------------------------------- +Date: 9-Jan-2015 [AL]: Small improvements +1) Added support for timeslice-specific NCAP_AFC +2) Added support for CHP modeling via CDME/BPME +3) Added support for levelized FLO_FR bounds +4) Cosmetic improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.8.3 +initmty.mod : (1),(2),(4) +maindrv.mod : (4) +ppmain.mod : (2) +preppm.mod : (2) +preponly.mod : (1) +pp_chp.mod : (2) +coef_cpt.mod : (1) +coef_csv.mod : (4) +pp_qack.mod : (2) +eqdeclr.mod : (3) +eqflofr.mod : (3) +eqcapact.mod : (1) +eqcapvac.mod : (1) +eqmain.mod : (4) +rptlite.rpt : (4) +cost_ann.rpt : (4) +initmty.vda : (4) +init_ext.vda : (2) +prep_ext.vda : (2) +pp_prelv.vda : (2) +ppm_ext.vda : (1) +coef_ext.vda : (3) +equ_ext.vda : (4) +eqcaflac.vda : (1) +eqactups.vda : (1) +eqashar.vda : (4) +resloadc.vda : (1) +ppmain.tm : (4) +equ_ext.etl : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 3.8.4 +----------------------------------------------------------------------------------------- +Date: 10-Apr-2015 [AL]: Maintenance release +1) Fixed problem with damage cost under MSA +2) Reinstate support for TIMESTEP with SPINES +3) Fixed handling of negative ILED with COEF_ICOM +4) Fixed potential exec error under MSA+CLI +5) Cosmetic improvement / cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.8.4 +ppmain.mod : (3) +coef_nio.mod : (3) +spoint.mod : (5) +eqobj.mod : (5) +eqobjinv.mod : (5) +eqobjfix.mod : (5) +eqobsalv.mod : (5) +eqbndcst.mod : (5) +rptmain.rpt : (5) +eqobjfix.rpt : (5) +initmty.stc : (2) +solve.stc : (2) +rptmain.stc : (2) +clearsol.stc : (2) +solve.stp : (2) +initmty.cli : (5) +forcupd.cli : (4) +pp_actef.vda : (5) +ppm_ext.vda : (5) +initmty.msa : (5) +preppm.msa : (1) +initmty.tm : (5) +eqobj.tm : (5) +initmty.ier : (5) +rpt_chp.ier : (5) +initmty.dsc : (5) + +----------------------------------------------------------------------------------------- +TIMES Version 3.8.5 +----------------------------------------------------------------------------------------- +Date: 10-May-2015 [AL]: Maintenance release +1) Added reporting of VAR_CUMCST levels +2) Added support for fixing initial periods with MSA +3) Fixed div/0 error when zero NCAP_DRATE/ELIFE +4) Cosmetic improvements / cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 3.8.5 +maindrv.mod : (2) +eqobj.mod : (4) +eqobjinv.mod : (3) +eqdamage.mod : (2) +coef_alt.lin : (4) +rptlite.rpt : (1) +rpt_obj.rpt : (3) +rptmisc.rpt : (1) +solsetv.v3 : (1) +solve.stp : (2) +initmty.msa : (2) +preppm.msa : (4) +solvcoef.msa : (2) +solve.msa : (2) +writeddf.msa : (2) +times2veda.vdd: (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.8.6 +----------------------------------------------------------------------------------------- +Date: 19-Jun-2015 [AL]: Maintenance release +1) Fixed reporting bug that manifested only when using ACT_UPS(FX) +2) Added support for referring to online capacity: UC_ATTR(CAP,ONLINE) + - modifier ignored for processes that have no ACT_UPS(FX) defined + +Modified files: (reason) +initsys.mod : Increased version number to 3.8.6 +uc_cap.mod : (2) +sol_flo.red : (1) +coef_ext.vda : (2) +equ_ext.vda : (2) +eqcaflac.vda : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 3.9.0 +----------------------------------------------------------------------------------------- +Date: 10-Oct-2015 [AL]: Major release with new equations/variables +1) Added linear dispatch features (may be subject to changes) +2) Fixed G_DYEAR to default to 1st Milestone +3) Fixed small bugs in shaping of NCAP_AFS and residual load curves +4) Added reporting of PRC_MARK marginals +5) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 3.9.0 +globals.def : (2) +initmty.mod : (1) +maindrv.mod : (5) +ppmain.mod : (5) +timslice.mod : (1) +preppm.mod : (1) +pp_chp.mod : (5) +curex.gms : (1) +coef_cpt.mod : (1),(3) +coef_obj.mod : (2) +pp_qack.mod : (1) +spoint.mod : (1) +mod_vars.mod : (1) +eqobj.mod : (5) +eqobjinv.mod : (1) +eqobjfix.mod : (5) +eqobsalv.mod : (5) +eqobjvar.mod : (1) +uc_cap.mod : (1) +bndmain.mod : (5) +rptlite.rpt : (1),(4) +rpt_obj.rpt : (5) +cost_ann.rpt : (1) +eqobjvar.rpt : (1) +rptmisc.rpt : (1),(4) +initmty.vda : (1) +init_ext.vda : (1) +prep_ext.vda : (1) +ppm_ext.vda : (1) +pp_actef.vda : (1) +coef_ext.vda : (1) +equ_ext.vda : (1) +eqactups.vda : (1) +eqcaflac.vda : (1) +eqashar.vda : (5) +resloadc.vda : (1),(3) +mod_ext.vda : (1) +solve.stp : (1) +clearsol.stp : (5) +stages.stc : (5) +recurrin.stc : (1) +pextlevs.stc : (1) +clearsol.stc : (1),(5) +rptmain.stc : (1) +prepret.dsc : (5) +solputta.ans : (1),(4) +times2veda.vdd: (1) + +----------------------------------------------------------------------------------------- +TIMES Version 3.9.1 +----------------------------------------------------------------------------------------- +Date: 29-Dec-2015 [AL]: Maintenance release +1) Added QA checks for commodities/processes at invalid timeslice levels +2) Added elimination of ANNUAL CAPACT(UP/LO) equations if AFA(FX) specified +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 3.9.1 +initmty.mod : (3) +ppmain.mod : (1) +coef_cpt.mod : (2) +init_ext.vda : (3) +pp_qack.mod : (3) +eqashar.vda : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 3.9.2 +----------------------------------------------------------------------------------------- +Date: 18-Mar-2016 [AL]: Maintenance release +1) Fixed bug related to NCAP_AFS(FX) being used for PRC_TS without NCAP_AF +2) Auto-generation of missing members of PCG for storage +3) Fixed bug related to using WAVER with early retirements +4) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 3.9.2 +initmty.mod : (4) +ppmain.mod : (2),(4) +coef_cpt.mod : (1) +uc_ire.mod : (4) +pp_qack.mod : (4) +prepret.dsc : (3) +initmty.vda : (4) +init_ext.vda : (3) +prep_ext.vda : (3) +coef_ext.vda : (3) +equ_ext.vda : (4) +eqcaflac.vda : (4) +eqashar.vda : (4) +solsetv.v3 : (4) +initmty.etl : (4) +coef_ext.etl : (4) +equ_ext.etl : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 3.9.3 +----------------------------------------------------------------------------------------- +Date: 1-May-2016 [AL]: Maintenance release +1) Added support for IE option 5/15 for PRC_RESID +2) Added support for CHP reduction operation +3) Preparations for the UCO extension (forthcoming) +4) Other cosmetic improvements for consistency with the updated documentation + +Modified files: (reason) +initsys.mod : Increased version number to 3.9.3 +initmty.mod : (3) +maplists.def : (4) +pp_chp.mod : (2) +eqobjvar.mod : (3) +eqbndcst.mod : (4) +pp_qack.mod : (4) +solve.mod : (3) +initmty.vda : (3) +init_ext.vda : (1),(3) +prep_ext.vda : (1),(3) +initmty.cli : (4) +coef_ext.cli : (4) +equ_ext.cli : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 3.9.5 +----------------------------------------------------------------------------------------- +Date: 7-Jun-2016 [AL]: Maintenance release +1) Small improvements into the linear dispatching features +2) Cosmetic changes for improved consistency with the documentation update +3) Small improvement to EQ_CAPFLO for storage + +Modified files: (reason) +initsys.mod : Increased version number to 3.9.5 +initmty.mod : (2) +ppmain.mod : (2) +timslice.mod : (1) +preppm.mod : (1),(2) +curex.gms : (2) +pp_shapr.mod : (2) +pp_reduce.red : (2) +fillcost.gms : (2) +coefmain.mod : (2) +mod_vars.mod : (1) +eqobj.mod : (2) +eqcumflo.mod : (2) +eqcumcom.mod : (2) +eqdamage.mod : (2) +eqobjinv.mod : (2) +eqobjfix.mod : (2) +eqobjvar.mod : (1) +eqbndcst.mod : (2) +bndmain.mod : (1) +bnd_cum.mod : (2) +spoint.mod : (1) +eqobjinv.rpt : (2) +eqobjfix.rpt : (2) +eqobjvar.rpt : (1) +rpt_obj.rpt : (2) +rpt_objc.rpt : (2) +cost_ann.rpt : (2) +init_ext.vda : (2) +prep_ext.vda : (1),(3) +eqcaflac.vda : (3) +equ_ext.vda : (1) +eqactups.vda : (1) +mod_ext.vda : (1) +prepret.dsc : (2) +coef_ext.cli : (2) +equ_ext.cli : (2) +coef_alt.lin : (2) +recurrin.stc : (1) +clearsol.stc : (1) +rptmain.stc : (1) +pextlevs.stc : (1),(2) +solve.stp : (2) +eqobj.tm : (2) +eqobjann.tm : (2) +rpt_ext.msa : (2) +solputta.ans : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 3.9.7 +----------------------------------------------------------------------------------------- +Date: 1-Jul-2016 [AL]: Pre-release for v4.0 +1) Enhanced unit cmmitment features, including MIP option (added ACT_CSTSD, ACT_CSTRMP, ACT_MAXNON, ACT_SDTIME, ACT_LOSSD) +2) Added optional Functional Depreciation Rate for Salvage accounting (added NCAP_FDR) +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 3.9.7 +initmty.mod : (1),(2) +preppm.mod : (1),(2) +curex.gms : (3) +setglobs.gms : (3) +mod_vars.mod : (1) +coef_ptr.mod : (3) +cal_cap.mod : (3) +eqobjvar.mod : (1) +eqobsalv.mod : (2) +eqpeak.mod : (3) +eqcombal.mod : (3) +spoint.mod : (1) +bndmain.mod : (1) +eqobjvar.rpt : (1) +solve.stp : (1) +stages.stc : (3) +recurrin.stc : (1) +clearsol.stc : (1) +rptmain.stc : (1) +initmty.vda : (1) +prep_ext.vda : (1) +mod_ext.vda : (1) +equ_ext.vda : (1) +coef_ext.vda : (1) +eqactups.vda : (1) +eqlducs.vda :+(1) +initmty.dsc : (1) +init_ext.dsc : (1) +initmty.tm : (3) +eqmrkcom.ier : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 3.9.8 +----------------------------------------------------------------------------------------- +Date: 2-Aug-2016 [AL]: Maintenance release (second pre-release for v4.0) +1) Fixed flaw in special EQ(l)_ASHAR defined for CG=ACT +2) Fixed bug in fixed cost accounting with standard objective (introduced in v3.9.5) +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 3.9.8 +initmty.mod : (3) +ppmain.mod : (3) +preppm.mod : (3) +curex.gms : (3) +pp_chp.mod : (3) +eqcapvac.mod : (3) +eqobjfix.mod : (2) +uc_flo.mod : (3) +uc_ire.mod : (3) +pp_lvlpk.mod : (3) +eqlducs.vda : (3) +eqashar.vda : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.0.0 +----------------------------------------------------------------------------------------- +Date: 1-Sep-2016 [AL]: Major Release - announce Dispatching and Unit Commitment Features +1) Cleaned up new unit commitment features +2) Corrected reporting of LUMPINV under MID_YEAR +3) Added support for defining RL-TP in GR_VARGEN +4) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.0.0 +initmty.mod : (4) +readbprice.mod: (4) +ppmain.mod : (4) +coef_ptr.mod : (4) +pp_qafs.mod : (4) +pp_qack.mod : (4) +rptlite.rpt : (4) +cost_ann.rpt : (2) +init_ext.vda : (4) +ppm_ext.vda : (4) +pp_actef.vda : (4) +eqlducs.vda : (1) +eqashar.vda : (4) +resloadc.vda : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.0.1 +----------------------------------------------------------------------------------------- +Date: 9-Nov-2016 [AL]: Maintenance release +1) Improved handling of OFF specification when no capacity +2) Improved reporting of electricity by source +3) Cosmetic improvement/cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.0.1 +ppmain.mod : (1),(3) +rptmisc.rpt : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.1.0 +----------------------------------------------------------------------------------------- +Date: 30-Jan-2017 [AL]: Introducing TIMES-Micro +1) Pilot implementation of TIMES-Micro +2) Cosmetic improvements/cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.1.0 +initmty.mod : (1) +maindrv.mod : (1) +setglobs.gms : (1) +ppmain.mod : (1) +preppm.mod : (1) +eqdeclr.mod : (1) +eqobj.mod : (1) +eqobjels.mod : (1) +eqcombal.mod : (1),(2) +eqpeak.mod : (1),(2) +bndmain.mod : (1) +bnd_elas.mod : (1) +pp_qack.mod : (1) +pp_qaput.mod : (2) +mod_equa.mod : (1) +solve.mod : (1) +eqobjels.rpt : (1) +rpt_obj.rpt : (1) +recurrin.stc : (1) +prep_ext.tm : (2) +eqmacro.tm : (2) +bnd_macro.tm : (2) +mod_vars.tm : (1),(2) + +Added files: +pp_micro.mod : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.1.1 +----------------------------------------------------------------------------------------- +Date: 28-Feb-2017 [AL]: Maintenance release +1) Fixed climate temperature reporting under stochastic climate sensitivity +2) Ensure commodity balance for exclusively capacity-related flows +3) Performance improvements under stochastic mode + +Modified files: (reason) +initsys.mod : Increased version number to 4.1.1 +eqdamage.mod : (3) +bnd_act.mod : (3) +coef_ext.vda : (2) +initmty.cli : (3) +coef_ext.cli : (3) +equ_ext.cli : (3) +rpt_ext.cli : (1) +rpt_par.cli : (3) +initmty.stc : (3) +stages.stc : (3) +fillsow.stc : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.1.2 +----------------------------------------------------------------------------------------- +Date: 30-Mar-2017 [AL]: Retrofitting and life-extension +1) Added retrofitting and life-extension: PRC_REFIT(r,prc,p) +2) Added stochastic support for grid modeling features +3) Fixed last period reporting of retired capacity +4) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.1.2 +initmty.mod : (1),(4) +ppmain.mod : (4) +timslice.mod : (4) +mod_vars.mod : (4) +eqdeclr.mod : (1) +eqmain.mod : (4) +eqobsalv.mod : (1) +mod_equa.mod : (1) +cost_ann.rpt : (2) +rptmisc.rpt : (3) +prepret.dsc : (1) +solve.stp : (1) +ppm_ext.vda : (4) +powerflo.vda : (2) +recurrin.stc : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.1.3 +----------------------------------------------------------------------------------------- +Date: 5-Jun-2017 [AL]: Maintenance release +1) Fixed uncertain damage cost reporting for climate variables +2) Fixed stochastic damage cost accounting under stochastic climate sensitivity +3) Fixed retirement cost accounting under NLP MACRO +4) Minor/cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.1.3 +initmty.mod : (4) +coef_obj.mod : (4) +eqdeclr.mod : (2) +bnd_ire.vda : (4) +eqobjvar.mod : (4) +eqobjcst.tm : (3) +eqobjann.tm : (3) +eqdamage.mod : (2) +rpt_obj.rpt : (4) +eqobjvar.rpt : (4) +rpt_dam.mod : (1) +prepret.dsc : (3) +coef_ext.cli : (2) +rpt_ext.cli : (2) +prep_ext.stc : (2) +stages.stc : (2) +recurrin.stc : (4) +rptmain.stc : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 4.1.4 +----------------------------------------------------------------------------------------- +Date: 26-Jul-2017 [AL]: Maintenance release +1) Auto-define -INF bounds for VAR_CUMCOM if neg. enabled +2) Allow ANNUAL charging profiled with COM_FR for NST +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.1.4 +ppmain.mod : (2) +bnd_cum.mod : (1) +pp_qack.mod : (3) +rptlite.rpt : (3) +cost_ann.rpt : (3) +rptmain.rpt : (3) +eqobsalv.rpt : (3) +equ_ext.etl : (3) +mod_vars.etl : (3) +pp_chp.ier : (3) +equ_ext.ier : (3) +eqchpelc.ier : (3) +eqmrkcom.ier : (3) +rpt_ext.ier : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.1.6 +----------------------------------------------------------------------------------------- +Date: 22-Nov-2017 [AL]: Maintenance release +1) Added option for forcing refitted capacity equal to retired +2) Fixed reporting of retired RESIDual capacity +3) Fixed bug when COM_FR defined for an ANNUAL level commodity only at the ANNUAL level + +Modified files: (reason) +initsys.mod : Increased version number to 4.1.6 +ppmain.mod : (1),(3) +prepret.dsc : (1) +rptmisc.rpt : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.0 +----------------------------------------------------------------------------------------- +Date: 7-Jan-2018 [AL]: Intorducing NCAP_CPX & Grid Computing +1) Added NCAP_CPX implementation for shaping capacity transfer +2) Added support for using grid computing facility under sensitivity analysis +3) Added support for always retrieving solution + status code reporting to VEDA-BE +4) Fixed small u*x compatibility issues +5) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.0 +initmty.mod : (1) +maindrv.mod : (4) +ppmain.mod : (5) +preppm.mod : (1) +preponly.mod : (5) +coef_obj.mod : (1) +coef_ptr.mod : (1) +coefmain.mod : (1) +eqobjinv.mod : (5) +equserco.mod : (5) +uc_com.mod : (5) +pp_qack.mod : (5) +eqobsalv.mod : (1) +eqobjfix.mod : (1) +eqobjann.tm : (1) +solve.mod : (5) +err_stat.mod : (3) +rptlite.rpt : (3) +rpt_obj.rpt : (1),(5) +cost_ann.rpt : (1) +eqobjfix.rpt : (1) +eqlducs.vda : (4) +prepret.dsc : (5) +solve.stc : (2) +sensis.stc : (2) +clearsol.stp : (2) + +Added files : (1) +coef_shp.mod : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.1 +----------------------------------------------------------------------------------------- +Date: 2-Feb-2018 [AL]: Introduce S_COM_TAX + Maintenance +1) Added new uncertain parameter S_COM_TAX(r,y,c,s,type,cur,j,sow) +2) Added QA check warnings for inconsistent CAP_BNDs and G_YRFRs +3) Fixed bug in processing of FLO_SUB/FLO_TAX when both defined on the same flow +4) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.1 +initmty.mod : (2) +ppmain.mod : (2) +timslice.mod : (2) +preppm.mod : (3) +eqobj.mod : (1) +eqobjvar.mod : (1) +coefmain.mod : (1) +coef_obj.mod : (1) +coef_alt.lin : (1) +pp_qaput.mod : (2) +rptlite.rpt : (2) +rptmisc.rpt : (2) +rpt_obj.rpt : (1) +eqobjvar.rpt : (1) +prep_ext.vda : (2) +coef_ext.vda : (4) +eqobj.tm : (4) +rptmain.tm : (4) +initmty.stc : (1) +prep_ext.stc : (1) +stages.stc : (1) +rptmain.stc : (1) +rpt_par.cli : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.2 +----------------------------------------------------------------------------------------- +Date: 7-Mar-2018 [AL]: Maintenance release +1) Fixed issues when using PRC_REFIT with time-stepped mode +2) Ignore superfluous UC_ACT/CAP/NCAP entries +3) Minor improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.2 +initmty.mod : (1) +ppmain.mod : (1),(2) +eqmain.mod : (3) +bnd_ucw.mod : (3) +bnd_ucv.mod : (3) +cost_ann.rpt : (3) +prepret.dsc : (1) +solve.stp : (1) +prep_ext.vda : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.3 +----------------------------------------------------------------------------------------- +Date: 7-Apr-2018 [AL]: Maintenance release +1) Improved several specifics of FIXBOH runs +2) Added support for nested CES demand functions +3) Miscellaneous small improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.3 +initmty.mod : (1),(2) +maindrv.mod : (3) +pp_micro.mod : (2) +eqdeclr.mod : (1) +eqobjels.mod : (2) +eqcombal.mod : (2) +bndmain.mod : (1) +bnd_act.mod : (1) +bnd_elas.mod : (2) +pp_qack.mod : (2) +rptlite.rpt : (1) +rptmisc.rpt : (1) +initmty.vda : (1) +solsetv.v3 : (3) +solve.stp : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.4 +----------------------------------------------------------------------------------------- +Date: 7-May-2018 [AL]: Maintenance release +1) Fixed bug related to certain dynamic UCs under FIXBOH runs +2) Improved support for nested CES demand functions +3) Added reporting of EQ(l)_ACTBND duals +4) Added reporting of lump-sum investment taxes/subsidies + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.4 +initmty.mod : (3) +solve.stp : (1) +pp_micro.mod : (2) +eqdeclr.mod : (3) +bnd_elas.mod : (2) +rptlite.rpt : (4) +rpt_obj.rpt : (4) +cost_ann.rpt : (4) +rptmisc.rpt : (3) +clearsol.stc : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.6 +----------------------------------------------------------------------------------------- +Date: 6-Jul-2018 [AL]: Maintenance release +1) Preparations for Monte Carlo Analysis +2) Fixed reporting of stochastic lump-sum investments and taxes +3) Fixed FOM accounting when both early retirements and NCAP_CPX +4) Fixed error due to GAMS change & cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.6 +initmty.mod : (1) +main_ext.mod : (1) +ppmain.mod : (4) +spoint.mod : (1) +pp_reduce.red : (4) +rptlite.rpt : (4) +eqobjvar.rpt : (2) +rpt_obj.rpt : (2) +cost_ann.rpt ; (3) +rptmisc.rpt : (3) +eqlducs.vda : (4) +prepret.dsc : (3) +solve.stp : (1),(4) +stages.stc : (1) +solve.stc : (1) +sensis.stc : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.7 +----------------------------------------------------------------------------------------- +Date: 12-Sep-2018 [AL]: Maintenance release +1) Fixed old bug in UC_CLI processing +2) Improved handling of cumulative commodity constraints +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.7 +eqobjinv.mod : (3) +eqobjfix.mod : (3) +uc_cli.mod : (1) +sensis.stc : (2) +solve.stp : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.2.9 +----------------------------------------------------------------------------------------- +Date: 2-Nov-2018 [AL]: Maintenance release +1) Added UC_MarkS category into BE reporting +2) Added elimination of superfluous CUMCOM equations +3) Fixed problems intoroduced in Macro variants +4) Removed invalid reference to storage flows + +Modified files: (reason) +initsys.mod : Increased version number to 4.2.9 +initmty.mod : (3) +maindrv.mod : (3) +coef_obj.mod : (4) +eqflomrk.mod : (1) +eqobsalv.mod : (3) +bnd_cum.mod : (2) +solve.stp : (3) +solve.msa : (3) +solsetv.v3 : (1) +mod_vars.msa : (3) +equ_ext.msa : (3) +solprep.msa : (3) +rptmain.tm : (3) +eqobj.tm : (3) +eqobjann.tm : (3) +rptmain.stc : (3) +times2veda.vdd: (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.0 +----------------------------------------------------------------------------------------- +Date: 9-Jan-2019 [AL]: Introducing demand response by load-shifting +1) Added new input parameter STG_SIFT and set of new equations for load shifting +2) Added optional reporting of load levels for process flows +3) Cosmetic improvements & cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.0 +initmty.mod : (1) +maplists.def : (3) +ppmain.mod : (1) +timslice.mod : (1) +preppm.mod : (1) +pp_reduce.red : (3) +init_ext.vda : (1) +prep_ext.vda : (1) +pp_prelv.vda : (3) +ppm_ext.vda : (3) +equ_ext.vda : (1) +mod_ext.vda : (1) +eqactups.vda : (1) +powerflo.vda : (3) +rptmisc.rpt : (2) +rptlite.rpt : (2) +solsetv.v3 : (2) +solve.stc : (3) +pextlevs.stc : (3) +times2veda.vdd: (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.1 +----------------------------------------------------------------------------------------- +Date: 9-Feb-2019 [AL]: Maintenance release +1) Added error clearing if DATAGDX saved after domain violations +2) Fixed bug in NCAP_CDME processing +3) Fixed error when using TIMESED with STAGES +4) Cosmetic improvements & cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.1 +preppm.mod : (1) +prepxtra.mod : (1) +fillvint.gms : (4) +pp_chp.mod : (2) +bnd_elas.mod : (3) +eqfloshr.mod : (4) +eqobjels.mod : (3) +solve.stp : (4) +eqactups.vda : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.2 +----------------------------------------------------------------------------------------- +Date: 9-Mar-2019 [AL]: Maintenance release +1) Added support for varying timeslice cycles +2) Added reporting of EQG_COMBAL levels under stochastic +3) Added support for emissions on auxiliary storage flows +4) Cosmetic improvements & cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.2 +initmty.mod : (1) +ppmain.mod : (1) +timslice.mod : (1) +pp_reduce.red : (4) +eqstgaux.mod : (3) +eqstgaux.lin : (3) +init_ext.vda : (4) +pp_prelv.vda : (3) +ppm_ext.vda : (3) +pp_actef.vda : (1) +eqashar.vda : (4) +eqactups.vda : (1) +eqlducs.vda : (1) +times2veda_stc: (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.3 +----------------------------------------------------------------------------------------- +Date: 9-Apr-2019 [AL]: Maintenance release +1) Fixed minor reporting issue under MACRO +2) Preparation for supporting dynamic timeslice trees +3) Added PCG auto-repair of storage converted to ANNUAL + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.3 +initmty.mod : (2) +ppmain.mod : (3) +eqpeak.mod : (2) +eqptrans.mod : (2) +eqstgtss.mod : (2) +rpt_obj.rpt : (1) +cost_ann.rpt : (1) +rptmisc.rpt : (1) +powerflo.vda : (2) +resloadc.vda : (2) +eqcaflac.vda : (2) +coef_alt.lin : (1) +solve.stp : (2) +solprep.msa : (1) +rptmain.tm : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.5 +----------------------------------------------------------------------------------------- +Date: 27-Jul-2019 [AL]: Maintenance release +1) Improved Data-Only GDX (can be later used as input) +2) Allow for making PRD as a timeslice +3) Allow for larger MAXSOW (above 1800) +4) Fixed bug when DUC and DSCAUTO activated simultaneously +5) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.5 +initmty.mod : (1),(4) +setglobs.gms : (1) +ppmain.mod : (2) +prepxtra.mod : (1) +eqactups.vda : (5) +eqlducs.vda : (4) +clearsol.stp : (5) +prepret.dsc : (5) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.6 +----------------------------------------------------------------------------------------- +Date: 6-Sep-2019 [AL]: Maintenance release +1) Fixed division by zero when very long time-span of RESID +2) Added support for asymmetric load shifting constraints +3) Improved UC_FLO consistency under DYNTS + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.6 +ppmain.mod : (2) +eqobjinv.mod : (1) +eqactups.vda : (2) +uc_flo.mod : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.7 +----------------------------------------------------------------------------------------- +Date: 1-Oct-2019 [AL]: Maintenance release +1) Improved QA checks against undefined currencies +2) Preparations for the ABS extension +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.7 +filparam.gms : (3) +coef_obj.mod : (1) +pp_qack.mod : (1) +initmty.vda : (2) +init_ext.vda : (2) +prep_ext.vda : (2) +coef_ext.vda : (2) +equ_ext.vda : (2) +mod_ext.vda : (2) +eqactups.vda : (2) +eqlducs.vda : (2) +powerflo.vda : (2) +recurrin.stc : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.3.8 +----------------------------------------------------------------------------------------- +Date: 1-Nov-2019 [AL]: Maintenance release +1) Added filtering of data when domain violations +2) Added clearing of EQ_COMBAL levels when FIXBOH +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.3.8 +initmty.mod : (1) +ppmain.mod : (1) +fillvint.gms : (3) +setglobs.gms : (1) +pp_qack.mod : (1) +init_ext.vda : (3) +eqactups.vda : (3) +clearsol.stp : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.4.0 +----------------------------------------------------------------------------------------- +Date: 9-Jan-2020 [AL]: Major release; Added Open Source License +1) 1st release of the ABS extension (Ancillary Balancing Services) +2) Added option for reporting flows of given commodity types at ANNUAL +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.4.0 +maplists.def : (1) +pp_micro.mod : (3) +bnd_elas.mod : (3) +bnd_flo.mod : (3) +eqmain.mod : (3) +uc_cap.mod : (1) +pp_prelv.vda : (3) +eqactups.vda : (1) +rptmisc.rpt : (1),(2) +rptlite.rpt : (1),(2) + +Added files: +*.ABS : ABS extension +LICENSE.txt : GPLv3 License + +----------------------------------------------------------------------------------------- +TIMES Version 4.4.1 +----------------------------------------------------------------------------------------- +Date: 9-Feb-2020 [AL]: Minor release +1) Added experimental implementation for dynamic timeslice trees +2) Fixed small Linux compatibility issues +3) Small improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.4.1 +initmty.mod : (2) +setglobs.gms : (2) +pp_reduce.red : (1) +pp_qafs.mod : (3) +mod_vars.mod : (3) +eqmain.mod : (3) +bndmain.mod : (1),(3) +pp_prelev.vda : (1) +ppm_ext.vda : (1) +equ_ext.vda : (3) +resloadc.vda : (3) +ucbet.vda : (3) +sensis.stc : (1) + +Added file: +dynslite.vda : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.4.2 +----------------------------------------------------------------------------------------- +Date: 1-Jul-2020 [AL]: Minor release +1) Added new attribute REG_BDNCAP for fixing new capacities to previous solution +2) Fixed inconsist spread of short-lived investment costs in first period when OBJ=MOD and D(T1)>2 +3) Improved DATAGDX by renaming GDX at compile time +4) Fixed omission of zero FLO_BND when bounding a reduced flow +5) Small improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.4.2 +initmty.mod : (1) +maindrv.mod : (5) +setglobs.gms : (5) +ppmain.mod : (2) +prepxtra.mod : (3) +bnd_flo.mod : (4) +coef_ptr.mod : (5) +rptmisc.rpt : (5) +err_stat.mod : (5) +spoint.mod : (1) +readbprice.mod: (5) +wrtbprice.mod : (5) +initmty.vda : (5) +solsetv.v3 : (5) +times2veda.vdd: (5) + +----------------------------------------------------------------------------------------- +TIMES Version 4.4.3 +----------------------------------------------------------------------------------------- +Date: 4-Sep-2020 [AL]: Minor release +1) Fixed handling of new attribute REG_BDNCAP when STAGES and no FIXBOH +2) Generalized TIMESED to allow for specifying Base price GDX file name +3) Preparation for forthcoming MLF extension +4) Small improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.4.3 +initmty.mod : (3) +maindrv.mod : (3) +spoint.mod : (1) +readbprice.mod: (2),(3) +wrtbprice.mod : (3) +eqdeclr.mod : (3) +eqmain.mod : (3) +eqobjann.mod : (4) +solve.mod : (3) +rptmain.mod : (3) +eqdamage.mod : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.0 +----------------------------------------------------------------------------------------- +Date: 9-Oct-2020 [AL]: Major release +1) Introducing the new Macro MLF extension +2) Fixed support for input data via GDX file +3) Small improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.0 +initmty.mod : (2) +timslice.mod : (3) +ppmain.mod : (1),(3) +spoint.mod : (1) +wrtbprice.mod : (1) +rptmisc.rpt : (1) +initmty.tm : (1) +mod_vars.tm : (1) +eqdeclr.tm : (1) +eqobj.tm : (1) +eqobjann.tm : (1) +eqobjcst.tm : (1) +mod_equa.tm : (1) +rptmain.tm : (1) +ddfupd.msa : (3) + +Added files : +presolve.mlf : (1) +initmty.mlf : (1) +ppm_ext.mlf : (1) +rpt_ext.mlf : (1) +equ_ext.mlf : (1) +prep_ext.mlf : (1) +calibase.mlf : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.1 +----------------------------------------------------------------------------------------- +Date: 9-Jan-2021 [AL]: Maintenance release +1) Allow back injection from NST storage to grid +2) Support independent AFC equations for storage +3) Small improvements and cleanup + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.1 +ppmain.mod : (1) +maplists.def : (3) +pp_qack.mod : (3) +eqstgtss.mod : (1) +eqstgaux.mod : (1) +eqcaflac.vda : (2) +solsetv.v3 : (3) +times2veda.vdd: (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.2 +----------------------------------------------------------------------------------------- +Date: 15-Feb-2021 [AL]: Maintenance release +1) Fixed GDX load issues with GAMS v342 +2) Fixed rare issue with PASTyear beyond EOH +3) Added reporting of ambiguous marginals of multi-region UC + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.2 +initmty.mod : (1) +setglobs.mod : (1) +ppmain.mod : (2) +rptmisc.rpt : (3) +ucbet.vda : (1) + +Added file: +gdxfilter.gms : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.3 +----------------------------------------------------------------------------------------- +Date: 1-Apr-2021 [AL]: Minor release +1) Fixed bug related to dynamic (t,t+1) type UCs under stochastic mode +2) Added support for non-vintaged FLO_FUNC for vintaged processes +3) Added new attribute NCAP_ISPCT(r,y,p) for proportional investment subsidy +4) Added support for dynamic commodity PRD/NET bounds with UC_DYNBND +5) Cosmetic fixes e.g. for backwards compatibility + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.3 +initmty.mod : (3) +setglobs.gms : (5) +ppmain.mod : (4) +preppm.mod : (3) +prepparm.gms : (3) +coef_obj.mod : (3) +coef_shp.mod : (2) +equ_ext.vda : (4) +equcrtp.vda : (4) +bnd_ucv.mod : (1) +bnd_ucw.mod : (1) +mod_ext.vda : (4) +prepret.dsc : (5) +initmty.stc : (1) +stages.stc : (1) +solsetv.v3 : (5) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.4 +----------------------------------------------------------------------------------------- +Date: 1-May-2021 [AL]: Maintenance release +1) Fixed bug introduced in v4.5.3, related to dynamic bound equations +2) Extended RPT_OPT('CAP','9') to apply to PAR_PASTI as well. + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.4 +equcrtp.vda : (1) +solve.stp : (1) +rptmisc.rpt : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.5 +----------------------------------------------------------------------------------------- +Date: 15-Jun-2021 [AL]: Maintenance release +1) Fix unwanted elimination of NST auxiliary storage flows +2) Support reversed storage flow conversion in AFC equations +3) Improved QA for inconsistent CAP_BND + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.5 +ppmain.mod : (1),(3) +eqcaflac.vda : (2) +bndmain.mod : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.6 +----------------------------------------------------------------------------------------- +Date: 24-Jun-2021 [AL]: Maintenance release +1) Fixed compatibility issues with GAMS v34.2 and above +2) Fixed reporting of storage flows in the special STS+STK case + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.6 +setglobs.gms : (1) +gdxfilter.gms : (1) +rptmisc.rpt : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.8 +----------------------------------------------------------------------------------------- +Date: 29-Sep-2021 [AL]: Minor release - storage improvements +1) Implemented a more flexible STS variant - activate by $SET STSFLX YES (for now) +2) Improved accounting of equilibrium losses for timeslice storage +3) Improved consistency in NCAP_AFC handling for multi-commodity storage +4) Fixed bug introduced by typo in v455 related to CAP_BND(LO) + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.8 +ppmain.mod : (1) +mod_vars.mod : (1) +eqdeclr.mod : (1) +eqcapact.mod : (1) +eqstgtss.mod : (1),(2) +bndmain.mod : (1),(4) +bnd_stg.mod : (1) +mod_equa.mod : (1) +rptmisc.rpt : (1) +ppm_ext.vda : (1),(3) +coef_ext.vda : (1) +eqcaflac.vda : (3) +eqashar.vda : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.5.9 +----------------------------------------------------------------------------------------- +Date: 6-Nov-2021 [AL]: Maintenance release +1) Improved reserve provision bounds under the ABS extension +2) Eliminated unnecessary storage output share constraints for STS + +Modified files: (reason) +initsys.mod : Increased version number to 4.5.9 +clearsol.stp : (1) +eqashar.vda : (2) +initmty.abs : (1) +coef_ext.abs : (1) +mod_vars.abs : (1) +equ_ext.abs : (1) +mod_ext.abs : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.0 +----------------------------------------------------------------------------------------- +Date: 20-Jan-2022 [AL]: Maintenance release +1) Added support for shaping NCAP_COM flows with FLO_FUNCX +2) Improved performance and QA for FLO_FUNCX +3) Cosmetic fixes + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.0 +initmty.mod : (1),(3) +setglobs.gms : (1),(3) +preppm.mod : (2) +coef_nio.mod : (3) +coef_shp.mod : (1),(2) +cal_cap.mod : (1) +cal_caps.mod : (1) +rpt_objc.rpt : (1) +rptmisc.rpt : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.1 +----------------------------------------------------------------------------------------- +Date: 23-Mar-2022 [AL]: Maintenance release +1) Some performance improvement for large models +2) Cosmetic fixes + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.1 +ppmain.mod : (1),(2) +timslice.mod : (1) +preppm.mod : (1) +pp_lvlus.mod : (1),(2) +pp_lvlpk.mod : (1) +pp_reduce.red : (1) +ppm_ext.vda : (1) +eqpeak.mod : (1) +rptmisc.rpt : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.2 +----------------------------------------------------------------------------------------- +Date: 22-May-2022 [AL]: Minor release +1) Added option for including input flows in power level reporting per MVU's wish +2) Cosmetic fix + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.2 +coef_nio.mod : (2) +rptmisc.rpt : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.3 +----------------------------------------------------------------------------------------- +Date: 7-Jul-2022 [AL]: Minor release +1) Added new attribute G_RFRIR for defining risk-free reference rate for hurdle rates +2) Fixed bug that allowed some early retirements revoked when using multi-stage stochastics and early retirements +3) Cosmetic fixes + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.3 +initmty.mod : (1) +setglobs.gms : (1) +preppm.mod : (1) +coef_obj.mod : (1) +eqobjinv.mod : (1) +pp_qack.mod : (3) +prepret.dsc : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.4 +----------------------------------------------------------------------------------------- +Date: 14-Jul-2022 [AL]: Minor release +1) Fixed small reporting bugs related to retrofit processes +2) Improvements in retrofit and lifetime extension implementation + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.4 +setglobs.gms : (1) +ppmain.mod : (2) +rpt_obj.rpt : (2) +rpt_objc.rpt : (1) +rptmisc.rpt : (1) +eqobsalv.mod : (2) +prepret.dsc : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.5 +----------------------------------------------------------------------------------------- +Date: 28-Aug-2022 [AL]: Maintenance release +1) Fixed reporting bug related to retirements when filtering off small capacity values +2) Cosmetic fixes + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.5 +setglobs.gms : (2) +pp_reduce.red : (2) +rptmisc.rpt : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.6 +----------------------------------------------------------------------------------------- +Date: 9-Oct-2022 [AL]: Minor release +1) Added new input attribute NCAP_AFSX for shaping seasonal availability factors +2) Improved a few QA checks +3) Cosmetic fixes + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.6 +initmty.mod : (1) +setglobs.gms : (1),(3) +ppmain.mod : (2),(3) +preppm.mod : (1) +pp_lvlbr.mod : (3) +pp_reduce.red : (3) +pp_chp.mod : (2) +coef_cpt.mod : (1) +pp_shapr.mod : (1) +mod_vars.mod : (3) +eqobj.mod : (3) +eqobjfix.mod : (3) +eqobsalv.mod : (3) +cal_caps.mod : (3) +mod_equa.mod : (3) +pp_qack.mod : (2) +solve.stp : (3) +rpt_obj.rpt : (3) +cost_ann.rpt : (3) +rptmisc.rpt : (3) +solputta.ans : (3) +solsetv.v3 : (3) +rptmain.stc : (3) +prep_ext.vda : (1) +ppm_ext.vda : (1) +coef_ext.vda : (3) +eqobjann.tm : (3) +eqobjcst.tm : (3) +initmty.msa : (3) +rpt_ext.msa : (3) +solve.msa : (3) +prep_ext.mlf : (3) +calibase.mlf : (3) +eqpk_ect.ier : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.7 +----------------------------------------------------------------------------------------- +Date: 19-Nov-2022 [AL]: Minor release +1) Completed S_COM_TAX preprocessing that had been unfinalized +2) Changed forced retrofits for residual capacity to obey RESID trajectory +3) Cosmetic fixes, e.g. set TOLPROJ tolerance, restore MCA compatibility + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.7 +initmty.mod : (1) +setglobs.gms : (1) +ppmain.mod : (1) +curex.gms : (1) +gdxfilter.gms : (3) +solve.mod : (3) +initmty.vda : (1) +prep_ext.stc : (1) +prepret.dsc : (2) +solsetv.v3 : (1) +times2veda.vdd: (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.8 +----------------------------------------------------------------------------------------- +Date: 30-Dec-2022 [AL]: Minor release +1) Added exception support for capacities bounded by REG_BDNCAP +2) Finished off forced retrofits for residual capacity to obey RESID trajectory +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.8 +units.def : (3) +spoint.mod : (1) +init_ext.vda : (1) +solve.stp : (3) +rptlite.rpt : (3) +cost_ann.rpt : (3) +prepret.dsc : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.6.9 +----------------------------------------------------------------------------------------- +Date: 23-Jan-2023 [AL]: Minor release +1) Improved effective levelization of various process transformation parameters +2) Streamlined performance of reduced model generation +3) Added support for emissions set directly on CHP activity +4) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.6.9 +initmty.mod : (4) +setglobs.gms : (1) +ppmain.mod : (1),(3) +pp_lvlfs.mod : (1) +pp_lvlus.mod : (4) +pp_chp.mod : (3) +pp_reduce.red : (1) +coef_ptr.mod : (1),(2) +coef_shp.mod : (2) +eqobjinv.mod : (4) +eqptrans.mod : (1) +pp_qack.mod : (1) +cal_red.red : (2) +sol_flo.red : (2) +rptmisc.rpt : (4) +initmty.vda : (2) +init_ext.vda : (2) +prep_ext.vda : (1) +pp_prelv.vda : (1),(2),(3) +ppm_ext.vda : (2) +pp_actef.vda : (1) +coef_ext.vda : (2) +initmty.stc : (4) +stages.stc : (2) +sensis.stc : (2) +solputta.ans : (4) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.0 +----------------------------------------------------------------------------------------- +Date: 25-Feb-2023 [AL]: Major release +1) Fixed bug related to auxiliary STS storage flows introduced in v4.6.9 +2) Fixed backwards compatibility workaround using COM_TYPEs as commodities not in topology +3) Added experimental extension implementing logit market share mechanism +4) Fixed loose ends in the levelization enhancement in v4.6.9 + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.0 +initmty.mod : (3) +ppmain.mod : (4) +pp_lvlfc.mod : (4) +coef_ptr.mod : (1) +sol_flo.red : (4) +initmty.vda : (3) +dynslite.vda : (4) +pp_actef.vda : (2) +pp_prelv.vda : (4) +mod_ext.vda : (3) +mod_vars.tm : (3) + +Added files...: (3) +ppm_ext.ecb +equ_ext.ecb +rpt_ext.ecb + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.1 +----------------------------------------------------------------------------------------- +Date: 9-Apr-2023 [AL]: Maintenance release +1) Added option for preventing cascaded forced retrofits +2) Fixed some loose ends in the recent logit market sharing +3) Added QA check against missing base prices under TIMESED + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.1 +setglobs.gms : (3) +ppmain.mod : (1) +readbprice.mod: (3) +eqdeclr.mod : (1) +pp_qack.mod : (3) +prepret.dsc : (1) +ppm_ext.ecb : (2) +rpt_ext.ecb : (2) +rpt_ext.mlf : (2) +recurrin.stc : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.2 +----------------------------------------------------------------------------------------- +Date: 9-Jun-2023 [AL]: Maintenance release +1) Added support for non-vintaged ACT_FLO variant +2) Added reporting of first pass LEC under the ECB extension + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.2 +setglobs.gms : (1) +pp_lvlff.mod : (1) +prep_ext.vda : (1) +pp_prelv.vda : (1) +ppm_ext.ecb : (2) +rpt_ext.ecb : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.3 +----------------------------------------------------------------------------------------- +Date: 3-Jul-2023 [AL]: Maintenance release +1) Fixed bug introduced when using S_FLO_FUNC under stochastic mode +2) Loosened default lower bounds VAR_CLITOT + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.3 +setglobs.gms : (1) +coef_obj.mod : (1) +mod_vars.cli : (2) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.4 +----------------------------------------------------------------------------------------- +Date: 13-Oct-2023 [AL]: Maintenance release +1) Fixed bug related to zero new capacities when deriving logit market shares +2) Fixed bug related to zero SHAPE values for NCAP_CPX +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.4 +ppmain.mod : (3) +coef_shp.mod : (2) +eqobjvar.mod : (3) +eqobjels.mod : (3) +eqobjvar.rpt : (3) +equ_ext.abs : (3) +rpt_ext.ecb : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.5 +----------------------------------------------------------------------------------------- +Date: 28-Oct-2023 [AL]: Maintenance release +1) Fixed divide by zero error in certain condition of PASTI with ILED within active horizon +2) Added support for NCAP_ICOM for past investments +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.5 +ppmain.mod : (1) +cal_cap.mod : (2) +bndmain.mod : (3) +bnd_stg.mod : (3) +initmty.vda : (3) +eqactups.vda : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.6 +----------------------------------------------------------------------------------------- +Date: 15-Nov-2023 [AL]: Maintenance release +1) Fixed bug in ECB extension when defining multiple markets with Logit choices +2) Added stochastic support for flexible STS storage option (STSFLX) +3) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.6 +maindrv.mod : (3) +setglobs.gms : (3) +eqstgtss.mod : (2) +eqdamage.mod : (3) +preshape.gms : (3) +solve.stp : (3) +prepret.dsc : (3) +recurrin.stc : (3) +ppm_ext.ecb : (1) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.7 +----------------------------------------------------------------------------------------- +Date: 27-Dec-2023 [AL]: Maintenance release +1) Fixed divide by zero issue in the ECB extension +2) Performance improvement for EQ_PEAK in large models +3) Added optional output attribute for process units +4) Cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.7 +initmty.mod : (4) +units.def : (3) +setglobs.gms : (2) +pp_lvlpk.mod : (2) +pp_shapr.mod : (2) +pp_reduce.red : (2) +eqpeak.mod : (2) +cal_ire.mod : (2) +err_stat.mod : (4) +rpt_ext.ecb : (1) +solsetv.v3 : (3) \ No newline at end of file diff --git a/_times.g00 b/_times.g00 new file mode 100644 index 0000000000000000000000000000000000000000..05c55c3c31d2017b0e431e1f84cb0830763c4dc0 GIT binary patch literal 6545 zcmciG2{e@N|2J^5FJEH`eN&8>%7_-Sd@;7dOm;I=ViF}qLSZmOmPBUUx`{+e){rGj z7%j@&KcXmG6UEq4mNC$M^Z)uxWPS~Tu;Dl(DuiF2nh(h75Mu$^-tyfQ!oATH$Ex< zU1$HP|1|%9EW5?sj$31OteuW+O?u(qGaCtr@y~URJMuG$zuS*lVg&@m#rS0_7L>jm znSbZ22p04gc(;5)!aylJ;^F?=kM0d0Rcux99eg_S)hjG~{#s+b@8GkP!@lA3`Bh;* z(&H!B=cn@9O$#0n`c^l+%~8$Dy*Foiw2RMN4H_qle%_S z!+^NWQ*E4SIHxem6`tO}m$DmK67M-4a|$C-!2|dbr@(oI+>Jd%dC$UO=FD8yU+lud zf=m){uWzQF2?Y{e2MUYWwO&qjPQ=c~ZcOMg%W-C{`M6ofn>n{(F1^IuvammVeOGuo z3apxW_J&y=WR{Zjv9#7J?$Qb;oQ$ffa`NS_Gv@+{rw10FI0erSe)cAMz-3B+x9S>QUd7dE-D4qKs#s zPxoxtU+mt#u3gg`2TJH!5PDK;ix!I{7a_qoYZJk zT-c`VN98(}$oq9QN42x_Qn|6>L?2JJv)p**@j#-_0Q)hlfpy$|JcUwL1=A-6bI&zW z%I2c`#YVX2N){dQv_Y|4iV9J}6HjA$&7K(L%9ku2!~bhAM;{+&(x21FdeXxd`Zd=* z%<4clLYs4Bc+63273gnWj*g%F(gwOt6+!O<~JxA zRW(6TaoiV;lnf5{ULmERs^;?8cnp&jL^K;%>oP?4-PgRZr3K3RRv$>k`VUey@M%v zYn%c~`>*w&t^%9!SA${0+T4sr%1z@zk%>G%i2mig` zLqtYx1ZlMfHrE=nF}bU5Xi;f})oQY9Xs#o*g?-gXcOZha97WTh zoPS|4t}#6}@ZIS6xZb<@5O%21>$zwmH{v9{si;?Nd^5TGW@5W}2V~4U7jpfl#-=;O zCbL}_59mZNMulLG7`Gq8Lxup%nQ@&i1jZcYz!7*f>Liqt1#@8_=+4UO`KQZk*K8L#LHV2l7q6R~&# zbqb2ka&lp)(%rx|6^=e)@fgYrG9mXlGn^TVciWC~>=D718|{E0qVNg*4%J_qKx7zW zyi;PTffRC|8)GMZ1#H{N*@mdGr#M5}{H)FL+y~EHX(+ggHcV1sRW{dV7Jf+#xKl*6~!7d-)_ipL~N$SKHNG81@3zyeteIVZ_+ zLp*@PaQ%V|J46w=3mNbS;Sr!jE=2}N5`G)kW!aEtkmWE!5%3o|2U#w{If1}idY2a? z>A@g2q0JplpsIkv)?*dL+v#fH_LMd^vftpYU3M#$ylP8@ohohjIv)aj9`tQn6n zg-hTjB$wTxF1WRPIeoWgEoRIDD5EQCmSemvfO5K4r!9g6hj0u5zzV^JYvDpw01Uzq zUXBY@1Z)sF@Bmz>AmE7bSD(X$?gT6m-^uAnV;QIz&>;69C2sn;K!SGe;LjvKH|UC8 zIQa7h-5D~la|8pE>8_BC-4*cZO}Yzo=~fNK-HK7+XRKL>$+qBO>tq2uVg)XOJ)$yE z1LTqukhwBi#ef!B0JKls?hYB*$${y~!WDkP#buaetJ~#%vYK{?b@jKnelb@oL^~XT z>)-8)L3pV@!SzeH+8}nrUm+!u?&8pw?To>O#Je8oFgp=YKM9LP``RHu{Y0!g+RRQ7 z{FIEvp>^zzf}d_+J&GJI;P0`(&i*q9Ew~OAknVRyq^eh8 z0onf3h-G*XR$isw9Z?G}LWbOIa7z{H_eLzH{n>Ac2v*;XV;J&3aBYd#Tp>L>f6z4f znhR7&u12=N=1Kq)axgYjq2CKJ1UJKm{@L$_=&+6|r|&9m!t`2Da1h!~4a~p6#6d20 z=HRXbrUzt66##$Ul*U4;R5x#z z;DH+$TUIc?20ClB?0To7{p7*p|C5SeeXWgbSX6 z^O1xsmpG*flOw-n$O@j?!^e{?lmKU`q2S$wr_SgQDh#P5d8!=PL&hPsggGu_y70=W zU)$f5|58mW9#Zec5Fy-?{VK!<_M zBvWT}FtrdlCrBs*u8?h!bJB#TKn8gqGC+(_0T__|kpU8fYTyD{85tl=COj|{&33xZY%>#|5ih;tGs0vM4#@o$XuN}9+b&<;{ z%@v)ni4uAItyWB^r70E=l0ShMffpd5ZOg9cy>@}1-;GWe^l7^@U~xjH8(PvX23)m} zFVoc0EW*fJw&4H)zzz|jo{F0gK|hj**|~zvR{ZZE--qfbBtZ;a4H%NQBMBntazL4k zMG_>@Re&v7A4w2E^M7c_*N`oLplbjXvNWSo_qjl{0CG4T(vU* zccu7wKyr36V4`Jc1zkWh2lLx1w9?N|lY|Mkh{4q<0v?F_a1ORkW}*~OQ|Itk!qtMm z5*x@b%Jd9I1d>}%iI^Xz;S;Rgw&B}Gv|KeZM(kr1TrqEtNNfG{N9u5(Y z|0TzQPG+0$J>|F3h&pv4)7Oa-0e^Y&upRa$lUMiA$M31n9*H}eeXCPLr4=vY>ozS6 zt{W0taoazCZJMjhQb@8Ya^AmP^8b0^jbBxqlFB-8d+nO(GB@_O>}u}pOwv4lbVGC3 zOu;1d3D&O8n46vXVzAdBt?Q#E6LnhEro2#d_3?byN4kUg{f(F$d$U-4+dUD^0hXH9 zP|~k3QcL0ZS~6izq~@ydq=TGzLCd{@gA7fzaYfakA7V-9`j;k6rjK9f8pk>JTy2{% zow2(bJLsf0-F&P~X%}gCo?MsMhS!AHugGp=r)v>2E@qZTrj5N%qi&b53nq_$ns$2k z>Y9AR^4o^1^JgEm9%h71w0zy4k^5wC-Ql!DFwH{8J!`sjg{Xw-f;@Qc_j>>QxM>#? z8C1*fY~M#+2e^rcbvmvurv^{TZ)Sfvn-`{HlWO=d_9e^5VG^Q!Hr&0g&2;m~D&&Uv z8UNTz{WZ2!FjY?rTeEHW(jD{8_*e7$0JhQMyVORSUB;YKvTpLV>1OrV3&u5J-klpi zKL(WC>T3Swt}>k4E7?jiBYDPtKR1i@YTnW1`zmumxF|DwE0u+?eu56KhFG#Q`}@=p(Uq{mF1hc^zZgFp>{KdedLnGR8n#Sx znl4b85t>>3x>`HwGSQIb+f~)~+9+1;)r8!PV#a<^r2r*|KkN?^~Hs;r129QNz>WWSRS=?wt08on`O;2v`Dj#se3U>7q0nupY~24 zpoY=D8gD1%tX`XlELhEYL=4YX42sR4GFqxG>osJf+FIG)zqZ3B#!?o>_Kl6RmKLg0 zA|lM%TIS0Q&d3hJD2xAY6$@Fs+03@2t-%+FvTW3?XtmCE7>_8EkT~-pT0mA+AW=-< zyP!qn|A@1u0s#?ssNI+Igij zI{1Gb$2RWY|84&pC6?bOI1~1gvr85wmiP~^{*yjjF%Dl`taovb)Peo{)1fnR&pY1( zOGRmO1Wlu^;kC|pMyk(g4|HZ~9%uf4{FKFMDmIZN22Tsoa@WL)nc# z0K>MG060%Yd{gvwNBmOo|49bqx3F+{qPPBVM8Taty>OESo~n3<*z3jkrRWcwcD?TQ zv=&m_3u*lJna-~dUeTJ@Zgy1})-Ly!%9cu9;?6$L*WII{fDqYPsy8vK7kS_rWr@Z> zMNE|XHQysK(oy0Dv3V2M9FxzSkgwZIGupkOJyHATWaYL&8P-QN7A@dkjQn-sFt$z| zEjDd5q~;E+vwmUCx5a-bm9lq%O^e!B{a$D3!?LbeT>RJQeEjpU+$T(zAmg>f@R+<& z)4{zXqmMgFk2V-TZs>LrJNXoL`BO;$p00+1+@X=!Ap)%_Y%0><@z-Cc25v83$ec(E zYCC0r+cu}GVVZs02z4>y-sPjbF7>cJ^U<7@m4&!BH(LC^;7@8_$n;lja`_hWv>g>> zKYLEi^nS-smE4P?R!ugugW_Lz7I|u1yPSCC&cOc`=D9cZltw07_w}|8J(JsMu&5uH zn0)8M7OmdcTpSkvL#4<^Lq9P8pO9G_lBaLgXEQq@Zl+S?ufYsVEV%QbUM|YuKZgOV znA@xk6-X^1XPq*tT2nZG{d&8O;b&G@eFsHl-^W64JiZ1m14dxX($}>v8nj+W`-pCT z+L&_bg~{Oi-xi$Mq4n(Ksagg%wsXC^ZA7iI^we`yWJlk97WKR-u7AeVa?;+=%%RGlL0;MKlm4ewJM3q8Jj8Ob z>8|B75j5d3t-;?SaprHWTHZE%lCk|lfLy;#(oaTAnL%on!< z)lHW>a5W|iVJ4;`+Z~7ovAPs&v&Y({_F?x% zuclug8?}eIc3uU7=1pOUGe~!DCmGzI+M{3aWHyC;D&-q}}m( z%K2Zy2f)?Z8w*Vp_`x>>^v?P0M} zGZ@fW|A>viG=<|LF#OMaPE1IKKMH@X0X6*iDkEM-<@uCNzGsmh=rRZ}7DJvS#e&Zng@eFm0jVr$b$?mkOxS0ZJ)E8f+!%1U6A%sZ zxf<>hXd&i?b^Uw0Tkh}eZrpKuG5-DEd)ipTW{%6k)*A>L8t5F+Ah@^ngrcxOTbx|Amv^es;6x8FObHU)Fo|wd6FHE?i+Req; zPp0Y0^pa_CztN1cB3&7g?KeF$w?A>8lE2^dlbjpFy1kN;k_$@H$u^?NTv3Z}Kg;H4 zmFH&N@8(JBs~h5NEniVz+6@hN+6}$@@LGVXh{>*+oyFx$92E1);7^Rt4rRYu>s!bOD>oGC2{tfRGHqPXNTYdutU0-8zDu` zqPL}Fgfxg63PcTG8EZXlUm^JG?eTB-h.ETL +*=============================================================================* +FILE ETL / %RUN_NAME%.ETL /; +PUT ETL; +$IF NOT %STAGES% == YES $GOTO REPORT +*----------------------------------------------------------------------------- +* If running stochastics, loop over SOW and write results for each +* For now, no stochastic reporting parameters for ETL are available +*----------------------------------------------------------------------------- +$%SW_NOTAGS% +$ BATINCLUDE mod_vars.etl +$ BATINCLUDE eqdeclr.etl +$%SW_TAGS% +LOOP(SOW, +* Get levels + OPTION CLEAR=VAR_CCAP; + OPTION CLEAR=VAR_CCOST; + OPTION CLEAR=VAR_IC; + OPTION CLEAR=VAR_CAP; + OPTION CLEAR=VAR_NCAP; + VAR_CCAP.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_CCAP.L(R,T,P,W)); + VAR_CCOST.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_CCOST.L(R,T,P,W)); + VAR_IC.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_IC.L(R,T,P,W)); + VAR_CAP.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_CAP.L(R,T,P,W)); + VAR_NCAP.L(R,T,P) $= SUM(SW_TSW(SOW,T,W), %VAR%_NCAP.L(R,T,P,W)); + PUT_UTILITY 'REN' / '%RUN_NAME%-',SOW.TL:0,'.ETL' ; +$LABEL REPORT +*----------------------------------------------------------------------------- + +ETL.PW=1000; +ETL.ND=4; + +PUT /"Generated by ATLEARN.ETL"/; +PUT "-----------------------"; +PUT /"Date: ", SYSTEM.DATE, " (M/D/Y)"; +PUT /"Time: ", SYSTEM.TIME; +PUT /"-------------------------------------"; +PUT /"MODELSTAT AND SOLVESTAT INFO"; +PUT /"Modelstat : ", %MODEL_NAME%.MODELSTAT:2:0; +PUT /"Solvestat : ", %MODEL_NAME%.SOLVESTAT:2:0; +PUT /"Number of iterations : ", %MODEL_NAME%.ITERUSD:7:0; +PUT /"Number of variables : ", %MODEL_NAME%.NUMVAR:7:0; +PUT /"Number of equations : ", %MODEL_NAME%.NUMEQU:7:0; + +PUT /"Maximum number of segments: ", (CARD(KP)-1):3:0," (SET KP defined in MMINIT.INC)"; +PUT /"Number of periods T : ", CARD(T):3:0 + +PUT //"---------------------------------------------------------------------------------------"/; +PUT "* Input learning PARAMETERS:"; +PUT " - Progress ratio, Start cost, Initial Cum. Cap., max. Cum. Cap"/; +PUT " - Indicators derived from these: Floor cost (absolute and as percentage)"/; +PUT " - Max. number of doublings, number of segments linearization"/; +PUT "* Cluster input info:"/; +PUT " - number of PRC's in cluster of key TEG (if any)"/; +PUT " - PRC's per cluster and coupling factor"/; +PUT "---------------------------------------------------------------------------------------"/; +PUT //"* PRC/REG", @30 "Description" @60 +PUT " Pr SC0"; +PUT " CCAP0 CCAPM FLOOR perc. n #seg" +PUT " #tch"/; +LOOP((TEG,REG)$SEG(REG,TEG), + PUT "KEY.",TEG.TL:0, '/REG.',REG.TL:0, @30, PRC.TE(TEG):30, @60 + PRAT(REG,TEG):10:3, + SC0(REG,TEG):10:2, + CCAP0(REG,TEG):10:4, + CCAPM(REG,TEG):10:4, +* floor cost implied + (PAT(REG,TEG)*(CCAPM(REG,TEG)**(-PBT(REG,TEG)))):10:2, + ((PAT(REG,TEG)*(CCAPM(REG,TEG)**(-PBT(REG,TEG))))/SC0(REG,TEG)*100):10:2, + (LOG(CCAPM(REG,TEG)/CCAP0(REG,TEG))/LOG(2)):10:2, + SEG(REG,TEG):10:0, + NTCHTEG(REG,TEG):10:0 + ; + PUT /; +* cluster PRC's and coupling factors plus INVCOS + LOOP(PRC$(CLUSTER(REG,TEG,PRC) GT 0), + PUT " ",PRC.TL:0; + PUT PRC.TE(PRC):30; + PUT CLUSTER(REG,TEG,PRC):10:3; + PUT /; + ); + + ); + +PUT //"Levels of learning variables: Cum. Cap. (CCAP) and Specific Cost"/; +PUT "k is for learning key technologies (in set TEG)"/; +PUT "c is for technology in corresponding cluster defined by CLUSTER(REG,TEG,PRC)"/; +PUT "------------------------------------------------------------------------"/; +$BATINCLUDE ATLEARN1.ETL VAR_CCAP 'Cumulative capacity' CCA 1 4 + +$BATINCLUDE ATSC.ETL + + +PUT //"Levels of TEG and PRC INV, CAP variables"/; +PUT "Results in order of Key technologies (TEG) and technologies in corresponding cluster"/; +PUT "Technologies in clusters may appear more than once if they belong to more than one cluster"/; +PUT "*-----------------------------------------------------------------------------------------"/; + +PUT "* INV CAP plus CAP growth factors"/; +PUT "* CAM : maximum capacity based on (user-provided) growth factors"/; +PUT "* GRP : growth in capacity in one period (CAP(T)/CAP(T-1))"/; +PUT "* GRA : average annual growth in NYEARS of period T"/; +PUT "* GRF : growth factor (input): TID and time-dependent"/; +PUT "*-----------------------------------------------------------------------------------------"/; + +$INCLUDE ATLEARN8.ETL + +$IF %STAGES%==YES ); +PUTCLOSE ETL; +$IF %STAGES%==YES $EXIT +*----------------------------------------------------------------------------- +* Exporting capital cost data for clustered technologies + +* Create a set of all key components +* Create a set of all clustered technologies + LOOP((RP(R,P),PRC)$((CLUSTER(R,P,PRC) > 0.0)$CLUSTER(R,P,PRC)), + TL_RP_KC(R,P) = YES; TL_RP_CT(R,PRC) = YES); + + TL_CT_COST(REG,MILESTONYR,PRC,CUR)$TL_RP_CT(REG,PRC) = OBJ_ICOST(REG,MILESTONYR,PRC,CUR) + + INVC_UNIT(REG,MILESTONYR,PRC) + +* Costs of key components in same region + SUM(P$CLUSTER(REG,P,PRC), (OBJ_ICOST(REG,MILESTONYR,P,CUR) + INVC_UNIT(REG,MILESTONYR,P)) * CLUSTER(REG,P,PRC)) + +* Costs of multi-regional key components + SUM(RP(R,P)$TL_MRCLUST(R,P,REG,PRC), (OBJ_ICOST(R,MILESTONYR,P,CUR) + INVC_UNIT(R,MILESTONYR,P)) * TL_MRCLUST(R,P,REG,PRC)); +*----------------------------------------------------------------------------- diff --git a/atlearn1.etl b/atlearn1.etl new file mode 100644 index 0000000..8263693 --- /dev/null +++ b/atlearn1.etl @@ -0,0 +1,57 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* File : ATLEARN1.ML +* Language : GAMS +* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES +* Origin : 02-06-98 +* Last edit : 07-27-01 +* Warning : +* Purpose : generic content of AT output +* Location : TIMES directory +* Called : at the end of ATLEARN.ETL +* Output : .ETL +*=============================================================================* +* %1 IS VARIABLE TO BE OUTPUTTED +* %2 is name of table +* %3 is prefix of row +* %4 is 1 if CCAPM is to be output +* %5 is number of decimals + +PUT /"%2 %1"/; +PUT @63, LOOP(T,PUT T.TL:10); +IF (%4 GT 0, PUT "CCAPM % reached"; + ); +PUT /; + +LOOP((TEG,REG)$SEG(REG,TEG), + PUT "k",".%3.",TEG.TL:0 '/r.'REG.TL:0, ' '; + PUT @30, PRC.TE(TEG):30 @60; + LOOP(T, + IF (%1.L(REG,T,TEG) GT 0, + PUT %1.L(REG,T,TEG):10:%5; + ELSE PUT " 0"; + ); + IF ((ORD(T) EQ CARD(T)) AND (%4 GT 0), + PUT " ",CCAPM(REG,TEG):10:2; PUT (100 - 100*(CCAPM(REG,TEG)-VAR_CCAP.L(REG,T,TEG))/ + (CCAPM(REG,TEG)-CCAP0(REG,TEG))):10:2; + ); + ); + PUT /; +* print PRC in TEG cluster + IF(%4 EQ 0, + LOOP(PRC$(CLUSTER(REG,TEG,PRC) GT 0), + PUT "c",".%3.",PRC.TL:0; + PUT @30, PRC.TE(PRC):30 @60; + LOOP(T, + IF (%1.L(REG,T,PRC) GT 0, + PUT %1.L(REG,T,PRC):10:%5; + ELSE PUT " 0"; + ); + ); + PUT /; + ); + ); + ); diff --git a/atlearn8.etl b/atlearn8.etl new file mode 100644 index 0000000..485fca8 --- /dev/null +++ b/atlearn8.etl @@ -0,0 +1,44 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* File : ATLEARN8.ETL +* Language : GAMS +* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES +* Origin : 04-02-00 +* Last edit : 07-27-01 +*=============================================================================* +* loop over TEG, PRC for key and clusters +* INV CAP +* CAM : maximum capacity based on growth factors +* GRP : growth in capacity in one period (CAP(TP)/CAP(TP-1)) +* GRA : average annual growth in NYEARS of period TP +* GRF : growth factor (input): TID and time-dependent + +LOOP((TEG,REG)$SEG(REG,TEG), +* Investment levels + PUT /; +* first output for key, next its cluster PRC's +$BATINCLUDE ATLEARN9.ETL k VAR_NCAP TEG 0 INV + LOOP(PRC$CLUSTER(REG,TEG,PRC), +$BATINCLUDE ATLEARN9.ETL c VAR_NCAP PRC 0 INV + ); + +* Capacity levels and growth factors (input and resulting) + PUT /; +$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 0 CAP +$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 1 CAM +$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 2 GRP +$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 3 GRA +$BATINCLUDE ATLEARN9.ETL k VAR_CAP TEG 4 GRF + + LOOP(PRC$CLUSTER(REG,TEG,PRC), +$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 0 CAP +$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 1 CAM +$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 2 GRP +$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 3 GRA +$BATINCLUDE ATLEARN9.ETL c VAR_CAP PRC 4 GRF + ); + + ); diff --git a/atlearn9.etl b/atlearn9.etl new file mode 100644 index 0000000..e28ad2b --- /dev/null +++ b/atlearn9.etl @@ -0,0 +1,78 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* File : ATLEARN9.ETL +* Language : GAMS +* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES +* Origin : 04-02-00 +* Last edit : 07-27-01 +*=============================================================================* +* %1 = k or c +* %2 = VAR_NCAP or VAR_CAP +* %3 = TEG or PRC +* %4 = 0 1 2 3 4 +* 0 is for variable INV or CAP +* 1 CAM; 2 GRP; 3 GRA; 4 GRF; +* %5 = INV or CAP or CAM or GRP or GRA or GRF; + + + PUT "%1",".%5.",%3.TL:0, '/r.', REG.TL:0, @30; + PUT PRC.TE(%3):30 @74; + LOOP(T, + IF (%4 EQ 0, + PUT %2.L(REG,T,%3):10:2; + ); + +* maximum capacity based on growth factors +* IF (%4 EQ 1, +* +* IF ((PRC_TGR(%3,T) + PRC_GRTI(%3)) GT 0, +* PUT ((PRC_TGR(%3,T)**NYRSPER)*CAP.L(T-1,%3) + +* PRC_GRTI(%3) +* ):10:2; +* ELSE PUT " -"; +* ); +* +* ); + +* period growth factor CAP(T)/CAP(T-1) + IF (%4 EQ 2, + + IF (VAR_CAP.L(REG,T-1,%3) GT 0, + PUT (VAR_CAP.L(REG,T,%3)/(VAR_CAP.L(REG,T-1,%3))):10:2; + ELSE PUT " -"; + ); + ); + +* average annual growth factor in period T compared to T-1 + IF (%4 EQ 3, + IF (VAR_CAP.L(REG,T-1,%3) GT 0, + PUT ((VAR_CAP.L(REG,T,%3)/VAR_CAP.L(REG,T-1,%3))**(1/D(T))):10:2; + ELSE PUT " -"; + ); + + ); +* user-provided maximum growth factors: for the first T, the TID +* growth factor is given, if provided +* IF (%4 EQ 4, +* +* IF (ORD(T) EQ 1, +* IF (PRC_GRTI(%3) GT 0, +* PUT TCH_GRTI(%3):10:2; +* ELSE PUT " -"; +* ); +* ELSE +* IF (PRC_TGR(%3,T) GT 0, +* PUT (TCH_TGR(%3,T)):10:2; +* ELSE PUT " -"; +* ); +* ); +* ); +* +* + ); + + PUT /; + diff --git a/atsc.etl b/atsc.etl new file mode 100644 index 0000000..c6c423f --- /dev/null +++ b/atsc.etl @@ -0,0 +1,68 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +******************************************************************************************************** +* File : ATSC.ETL +* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES +* last edit : 07-27-01 +******************************************************************************************************** + +PUT /"Specific investment Cost SC(T) for key TEG and INVCOS per PRC in cluster of key"; +PUT /"-----------------------------------------------------------------------------------------------"; +PUT /"SCU: Specific Cost (per Unit) for key: linearized"; +PUT /"FOR: specific cost for key: end of T according to exact FORmula: sc = a * ccap ** (-b)"; +PUT /"INC: INvesment cost (per unit) for PRC in cluster key (exogenous, input value, equals INVCOST)"; +PUT /"-----------------------------------------------------------------------------------------------"//; +PUT @63, PUT "Start (SC0) ", LOOP(T,PUT T.TL:10); PUT "% of SC0"/; + +LOOP(RTP(R,T,TEG)$((VAR_NCAP.L(R,T,TEG) NE 0)$SEG(R,TEG)), + INVC_UNIT(R,T,TEG) $= VAR_IC.L(R,T,TEG)/VAR_NCAP.L(R,T,TEG); +); + +PREV(RP(R,TEG)) = SC0(R,TEG); +LOOP((TEG,REG)$SEG(REG,TEG), +* specific cost for key: linearized + PUT "k",".SCU.",TEG.TL:0 "/r.", REG.TL:0, @30; + PUT PRC.TE(TEG):30 @60; + PUT SC0(REG,TEG):14:0; + LOOP(T, + IF (INVC_UNIT(REG,T,TEG) GT 0, + PUT INVC_UNIT(REG,T,TEG):10:2; + PREV(REG,TEG) = INVC_UNIT(REG,T,TEG); + ELSE PUT PREV(REG,TEG):10:2; + ); + ) + PUT /; + +* specific cost for key: end of T according to exact formula + PUT "k",".FOR.",TEG.TL:0, "/r.", REG.TL:0, @30 PRC.TE(TEG):30 @60; + PUT SC0(REG,TEG):14:0; +*formula: sc = a * ccap ** (-b) + LOOP(T, +* TEG may have START>1 + IF (RTP(REG,T,TEG), + PUT (PAT(REG,TEG)*(VAR_CCAP.L(REG,T,TEG)**(-PBT(REG,TEG)))):10:2; + IF (ORD(T) EQ CARD(T), + PUT (100*(((PAT(REG,TEG)* + (VAR_CCAP.L(REG,T,TEG)**(-PBT(REG,TEG)))))/SC0(REG,TEG)) + ):11:2; + ); + ELSE PUT SC0(REG,TEG):10:2; + ); + + ); + PUT /; +* specific cost for PRC in cluster key: input value + + LOOP(PRC$(CLUSTER(REG,TEG,PRC) GT 0), + PUT "c",".INC.",PRC.TL:0, @30; + PUT PRC.TE(PRC):30; + LOOP(T, + PUT (SUM(CUR,NCAP_COST(REG,T,PRC,CUR))):10:2; + ); + PUT /; + ); + + PUT /; + ); diff --git a/bnd_act.mod b/bnd_act.mod new file mode 100644 index 0000000..70f6a55 --- /dev/null +++ b/bnd_act.mod @@ -0,0 +1,26 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_ACT.MOD set the actual bounds for non-vintage VAR_ACTs +*=============================================================================* +*GaG Questions/Comments: +* - FX take precedence as is set last!!! +*----------------------------------------------------------------------------- +*$ONLISTING +* reset any existing bounds + %VAR%_ACT.LO(R,V,T,P,S%SWD%) = 0; + %VAR%_ACT.UP(R,V,T,P,S%SWD%) = INF; + +* assign from user data - only set bounds directly at the PRC_TS level + +$IF %STAGES% == YES $SETLOCAL SWT SW_T(T%SWD%)$ + + %VAR%_ACT.LO(RTP_VINTYR(R,T,T,P),S%SWD%)$(%SWT% PRC_TS(R,P,S) * (NOT PRC_VINT(R,P))) $= ACT_BND(R,T,P,S,'LO'); + %VAR%_ACT.UP(RTP_VINTYR(R,T,T,P),S%SWD%)$(%SWT% PRC_TS(R,P,S) * (NOT PRC_VINT(R,P))) $= ACT_BND(R,T,P,S,'UP'); + %VAR%_ACT.FX(RTP_VINTYR(%R_T%,T,P),S%SWD%)$(%SWT%PRC_TS(R,P,S)* (NOT PRC_VINT(R,P))) $= ACT_BND(R,T,P,S,'FX'); +* for upper bounds of zero, activity variables of all vintages can be bounded to zero + %VAR%_ACT.UP(RTP_VINTYR(R,V,T,P),S%SWD%)$(%SWT% PRC_TS(R,P,S) * PRC_VINT(R,P)$RTPS_OFF(R,T,P,S)) = EPS; + +*$OFFLISTING diff --git a/bnd_cum.mod b/bnd_cum.mod new file mode 100644 index 0000000..dd0a9ed --- /dev/null +++ b/bnd_cum.mod @@ -0,0 +1,48 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_CUM.MOD set the actual bounds for cumulative variables +*=============================================================================* +$SETLOCAL SW1 '' SETLOCAL SW2 "" +$IF %STAGES%==YES $SETLOCAL SW1 'S_' SETLOCAL SW2 ",'1'%SOW%" + +* Ignore negative bounds; reset any N bounds at specific years + %SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%)$((%SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%) LT 0)$%SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%)) = 0; + FLO_CUM(R,P,C,YEAR,'EOH','N') $= FLO_CUM(R,P,C,YEAR,'%EOTIME%','N'); + FLO_CUM(RPC_CUMFLO(R,P,C,YEAR,LL),'N') = 0; + + %SW1%FLO_CUM(R,P,C,YEAR,LL,BD%SW2%)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'FX'%SW2%) = %SW1%FLO_CUM(R,P,C,YEAR,LL,'FX'%SW2%)$BDNEQ(BD); + +* Get modifiers for flexible model horizon + LOOP((SAMEAS(J,'1'),MIYR_L), OPTION CLEAR=UNCD7; UNCD7(RPC_CUMFLO(R,P,C,YEAR,'%EOTIME%'),J+(FLO_CUM(R,P,C,YEAR,'EOH','N')-1),'')=YES; + LOOP(UNCD7(R,P,C,YEAR,LL,JJ,''), FLO_CUM(R,P,C,YEAR,LL,'N') = MIN(0,ABS(MULTI(JJ,MIYR_L))-1)$MULTI(JJ,MIYR_L))); + +* Set bounds + %VAR%_CUMFLO.LO(R,P,C,YEAR,LL %SOW%)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%) = %SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); + %VAR%_CUMFLO.UP(R,P,C,YEAR,LL %SOW%)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%) = %SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); + +* Reset any N bounds at specific years + COM_CUM(R,%1,YEAR,'0',C,'N') $= COM_CUM(R,%1,YEAR,'%EOTIME%',C,'N'); + COM_CUM(RC_CUMCOM(R,%1,YEAR,LL,C),'N') = 0; + + %SW1%COM_CUM(R,%1,YEAR,LL,C,BD%SW2%)$%SW1%COM_CUM(R,%1,YEAR,LL,C,'FX'%SW2%) = %SW1%COM_CUM(R,%1,YEAR,LL,C,'FX'%SW2%)$BDNEQ(BD); + %SW1%COM_CUM(RC_CUMCOM(R,%1,LL,YEAR,C),BD%SW2%)$(YEARVAL(LL)>MIYR_VL)=EPS; RC_CUMCOM(R,%1,LL,YEAR,C)$(YEARVAL(LL)>MIYR_VL)=NO; + +* Get modifiers for flexible model horizon + LOOP((SAMEAS(J,'1'),MIYR_L), OPTION CLEAR=UNCD7; UNCD7(RC_CUMCOM(R,%1,YEAR,'%EOTIME%',C),J+(COM_CUM(R,%1,YEAR,'0',C,'N')-1),'')=YES; + LOOP(UNCD7(R,%1,YEAR,LL,C,JJ,''), COM_CUM(R,%1,YEAR,LL,C,'N') = MIN(0,ABS(MULTI(JJ,MIYR_L))-1)$MULTI(JJ,MIYR_L))); + +* Set bounds + %SW1%COM_CUM(RC_CUMCOM(R,%1,YEAR,LL,C),L('LO')%SW2%)$(NOT %SW1%COM_CUM(RC_CUMCOM,L%SW2%)) = -INF$SUM((RTC(R,T,C),ANNUAL(S)),MIN(0,COM_BNDPRD(RTC,S,L)$DIAG(%1,'PRD')+COM_BNDNET(RTC,S,L)$DIAG(%1,'NET')+1-1)); + %VAR%_CUMCOM.LO(R,C,%1,YEAR,LL %SOW%)$%SW1%COM_CUM(R,%1,YEAR,LL,C,'LO'%SW2%) = %SW1%COM_CUM(R,%1,YEAR,LL,C,'LO'%SW2%)*(1/%CUCSCAL%)*(COM_CUM(R,%1,YEAR,LL,C,'N')+1); + %VAR%_CUMCOM.UP(R,C,%1,YEAR,LL %SOW%)$%SW1%COM_CUM(R,%1,YEAR,LL,C,'UP'%SW2%) = %SW1%COM_CUM(R,%1,YEAR,LL,C,'UP'%SW2%)*(1/%CUCSCAL%)*(COM_CUM(R,%1,YEAR,LL,C,'N')+1); + +$IFI %MACRO%==YES $EXIT +* Set lower bound for combined costs to -INF + LOOP(COST_GMAP(COSTCAT,COSTAGG,COSTYPE), + %VAR%_CUMCST.LO(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%)$REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'UP') = -INF); + %VAR%_CUMCST.UP(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%) $= REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'UP'); + %VAR%_CUMCST.LO(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%) $= REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'LO'); + %VAR%_CUMCST.FX(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%) $= REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'FX'); diff --git a/bnd_elas.mod b/bnd_elas.mod new file mode 100644 index 0000000..48c69e3 --- /dev/null +++ b/bnd_elas.mod @@ -0,0 +1,40 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_ELAS.MOD establishes bounds on demand elasticity variables +* %1 - LO/UP step limit +*=============================================================================* +* Questions/Comments: +* - RCJ includes testing for COM_STEP +* - May want elasticity without COM_PROJ - may use COM_BQTY +*----------------------------------------------------------------------------- + OPTION CLEAR=MI_DOPE; + LOOP((ANNUAL(S),MI_DMAS(RD_AGG(R,C),COM)), + RD_SHAR(R,T,COM,C)=COM_AGG(R,T,COM,C)*DDF_PREF(R,T,C); + COM_AGG(R,T,COM,C)$(COM_ELAST(R,T,C,S,'N')>0)=0; + COM_ELAST(R,T(MIYR_1),COM,TS,BD)=0; + COM_VOC(RTC(R,T,COM),'LO')$MI_ESUB(R,T,C)=MIN(COM_VOC(RTC,'LO'),1-9E9**(-COM_ELAST(RTC,S,'FX'))); + MI_DOPE(R,T,COM)$MI_ESUB(R,T,C)=MAX(ABS(COM_ELAST(R,T,COM,S,'FX')),MI_ESUB(R,T,C))$SUM(BDNEQ$COM_ELAST(R,T,C,S,BDNEQ),1)); + +$IF %STAGES% == YES LOOP(SW_T(T%SOW%), + + %VAR%_ELAST.UP(RTCS_VARC(R,T,C,S),J,BDNEQ(BD)%SOW%)$RCJ(R,C,J,BD) = INF$MI_DOPE(R,T,C) + + (MAX(DDF_QREF(R,T,C) * COM_FR%MX%(R,T,C,S), COM_BQTY(R,C,S)) * COM_VOC(R,T,C,BD)) / COM_STEP(R,C,BD); + +$IF %STAGES% == YES ); + +* Price levels for CES (marginal / average) + MI_RHO(RTC(R,T,C))$MI_DOPE(RTC) = ROUND(1-1/MI_DOPE(RTC),6); + MI_AGC(R,T(TT+1),COM,C,J,BDNEQ(BD))$(RCJ(R,C,J,BD)$MI_DMAS(R,COM,C)$MI_ESUB(R,T,COM)) = (1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**(-1/COM_ELAST(R,T,C,'ANNUAL','FX')); + MI_AGC(R,T,COM,C,J,BD)$((COM_VOC(R,T,C,BD)>0)$MI_AGC(R,T,COM,C,J,BD)$MI_DOPE(R,T,C)) = + BDSIG(BD)/(ORD(J)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD)) * + (((1-(1-BDSIG(BD)*ORD(J)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**MI_RHO(R,T,C))/MI_RHO(R,T,C))$MI_RHO(R,T,C) - + LOG(1-BDSIG(BD)*ORD(J)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))$(MI_RHO(R,T,C)=0)); + +* Fix redundancies + LOOP(RD_AGG(R,COM),FIL(T)=NOT PROD(BDNEQ,SUM(COM_TS(R,C,S)$MI_DMAS(R,COM,C),COM_ELAST(R,T,C,S,BDNEQ))); + COM_ELAST(RTCS_VARC(R,T(FIL),C,S),BD)$MI_DMAS(R,COM,C)=0; RCS_COMPRD(R,T(FIL),COM,S,BD)=NO); + COM_ELASTX(R,T,C,BDNEQ)$MI_DOPE(R,T,C)=1; + RTC_SHED(R,T,C,BD,JJ)$MI_DOPE(R,T,C)=NO; diff --git a/bnd_flo.mod b/bnd_flo.mod new file mode 100644 index 0000000..81b1ffe --- /dev/null +++ b/bnd_flo.mod @@ -0,0 +1,40 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_FLO.MOD set the actual bounds for non-vintage VAR_FLOs * +*=============================================================================* +*UR Questions/Comments: +*----------------------------------------------------------------------------- +*$ONLISTING +* reset any existing bounds + %VAR%_FLO.LO(R,V,T,P,C,S%SWD%) = 0; + %VAR%_FLO.UP(R,V,T,P,C,S%SWD%) = INF; + +* assign from user data + FLO_BND(R,T,P,C,S,'LO')$((NOT RPC_EMIS(R,P,C))$(FLO_BND(R,T,P,C,S,'LO')=0)$RP_FLO(R,P))=0; + LOOP((RTPC(R,T,P,C),S,BD)$FLO_BND(RTPC,S,BD),TRACKPC(RP_FLO(R,P),C)=YES); + TRACKPC(PRC_VINT(R,P),C) = NO; + TRACKPC(RPC_FFUNC(R,P,C))= NO; + TRACKPC(RPC_EMIS(R,P,C)) = NO; +* Mark all tuples that definitely cannot be handled by VAR bounds + LOOP(T,FLO_BND(R,'%DFLBL%',P,C,S,BD)$FLO_BND(R,T,P,C,S,BD) = EPS$(NOT TRACKPC(R,P,C)); + FLO_BND(R,'%DFLBL%',P,CG,S,BD)$((NOT C(CG))$FLO_BND(R,T,P,CG,S,BD)) = EPS); + TRACKPC(RPC_ACT(R,P,C)) = NO; + +$IF %STAGES% == YES LOOP(SW_T(T%SWD%), + %VAR%_FLO.LO(RTP_VINTYR(R,T,T,P),C,S%SWD%)$((RTPCS_VARF(R,T,P,C,S)*TRACKPC(R,P,C))$FLO_BND(R,T,P,C,S,'LO')) = FLO_BND(R,T,P,C,S,'LO'); + %VAR%_FLO.UP(RTP_VINTYR(R,T,T,P),C,S%SWD%)$((RTPCS_VARF(R,T,P,C,S)*TRACKPC(R,P,C))$FLO_BND(R,T,P,C,S,'UP')) = FLO_BND(R,T,P,C,S,'UP'); + %VAR%_FLO.FX(RTP_VINTYR(R,T,T,P),C,S%SWD%)$((RTPCS_VARF(R,T,P,C,S)*TRACKPC(R,P,C))$FLO_BND(R,T,P,C,S,'FX')) = FLO_BND(R,T,P,C,S,'FX'); +$IF %STAGES% == YES ); + OPTION CLEAR=TRACKPC; + +*$OFFLISTING +$IF NOT '%REDUCE%' == 'YES' $EXIT +$IF %STAGES% == YES $SETLOCAL SWT "%SWD%)$SW_T(T%SWD%" +* As BND_ACT has been set before this, MAX/MIN can be used; FX bound consistency cannot be guaranteed + LOOP(RTPCS_VARF(R,T,P,C,S)$(((NOT PRC_VINT(R,P))*RPC_ACT(R,P,C))$FLO_BND(R,T,P,C,S,'LO')),%VAR%_ACT.LO(R,T,T,P,S%SWT%) = MAX(%VAR%_ACT.LO(R,T,T,P,S%SWT%),FLO_BND(R,T,P,C,S,'LO')/PRC_ACTFLO(R,T,P,C))); + LOOP(RTPCS_VARF(R,T,P,C,S)$(((NOT PRC_VINT(R,P))*RPC_ACT(R,P,C))$FLO_BND(R,T,P,C,S,'UP')),%VAR%_ACT.UP(R,T,T,P,S%SWT%) = MIN(%VAR%_ACT.UP(R,T,T,P,S%SWT%),FLO_BND(R,T,P,C,S,'UP')/PRC_ACTFLO(R,T,P,C))); + LOOP(RTPCS_VARF(R,T,P,C,S)$(((NOT PRC_VINT(R,P))*RPC_ACT(R,P,C))$FLO_BND(R,T,P,C,S,'FX')),%VAR%_ACT.FX(R,T,T,P,S%SWT%) = FLO_BND(R,T,P,C,S,'FX')/PRC_ACTFLO(R,T,P,C)); + diff --git a/bnd_ire.vda b/bnd_ire.vda new file mode 100644 index 0000000..bd535eb --- /dev/null +++ b/bnd_ire.vda @@ -0,0 +1,39 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_IRE.VDA bounds IRE flows and set prices from previous run if requested +*=============================================================================* +$IF NOT DEFINED PREMILE $EXIT + RPC_IREIN(RPC_IREIO) = NO; + PAR_IRE(R,V,T,P,C,TS,IE)$(NOT RPC_IREIN(R,P,C,IE,'IN')) = 0; + PAR_IPRIC(R,T,P,C,TS,IE)$(NOT RPC_IREIN(R,P,C,IE,'IN')) = 0; + PARAMETER FLO_IRE(R,LL,P,C,S,IE); + IF(CARD(PAR_IRE), + %VAR%_IRE.FX(RTP_VINTYR(R,V,PREMILE(T),P),C,TS,IE%SWD%)$(((NOT RPC_AIRE(R,P,C))*RPCS_VAR(R,P,C,TS))$RPC_IREIN(R,P,C,IE,'IN')) = + EPS+PAR_IRE(R,V,T,P,C,TS,IE); + LOOP(IE,FLO_BND(R,PREMILE(T),P,C,TS,'FX')$((RPC_AIRE(R,P,C)*RTPCS_VARF(R,T,P,C,TS))$RPC_IREIN(R,P,C,IE,'IN')) = + EPS+SUM(RTP_VINTYR(R,V,T,P),PAR_IRE(R,V,T,P,C,TS,IE))); + ); +* Set target milestone years into FIL + OPTION CLEAR=FIL; LOOP(T$(NOT PREMILE(T)),FIL(TT)$YK(TT,T) = YES); +* Calculate total flows at milestone years + FLO_IRE(R,PREMILE,P,C,TS,IE)$(RPCS_VAR(R,P,C,TS)$RPC_IREIN(R,P,C,IE,'IN')) = + SUM(YK(PREMILE,LL)$PAR_IRE(R,LL,PREMILE,P,C,TS,IE),PAR_IRE(R,LL,PREMILE,P,C,TS,IE))+EPS; + DM_YEAR(PREMILE) = YES; +$BATINCLUDE fillcost FLO_IRE R 'P,C,TS,IE' ",'0'" FIL CARD(FIL) '' '' FLO_IRE X_IREFLO +$BATINCLUDE fillcost PAR_IPRIC R 'P,C,TS,IE' ",'0'" FIL CARD(FIL) '' '' PAR_IPRIC X_IREFLO +* Set bounds for T not in sync with PREMILE + LOOP(IE$CARD(FIL),TRACKPC(R,P,C)$((RPC_AIRE(R,P,C)+PRC_VINT(R,P))$RPC_IREIN(R,P,C,IE,'IN')) = YES); + %VAR%_IRE.FX(RTP_VINTYR(R,FIL(T),T,P),C,TS,IE%SWD%)$(((NOT TRACKPC(R,P,C))*RPCS_VAR(R,P,C,TS))$RPC_IREIN(R,P,C,IE,'IN')) = + EPS+FLO_IRE(R,T,P,C,TS,IE); +* Remove TRACKPC with either IMP or EXP internal, as FLO_BND will be applied to the SUM + LOOP(IE,TRACKPC(R,P,C)$((NOT RPC_IREIN(R,P,C,IE,'IN'))$RPC_IRE(R,P,C,IE)) = NO); + FLO_BND(R,FIL(T),P,C,TS,'FX')$((RPC_AIRE(R,P,C)*RTPCS_VARF(R,T,P,C,TS))$TRACKPC(R,P,C)) = + EPS+SUM(RPC_IREIN(R,P,C,IE,'IN'),FLO_IRE(R,T,P,C,TS,IE)); + OPTION CLEAR=TRACKPC,CLEAR=FLO_IRE; +* Set the IRE prices + LOOP(T$CARD(PAR_IPRIC), + OBJ_IPRIC(R,Y_EOH,P,C,TS,IE,CUR)$(PERIODYR(T,Y_EOH)$RPCS_VAR(R,P,C,TS)$RPC_IREIN(R,P,C,IE,'IN')) = + PAR_IPRIC(R,T,P,C,TS,IE)); diff --git a/bnd_macro.tm b/bnd_macro.tm new file mode 100644 index 0000000..d12a256 --- /dev/null +++ b/bnd_macro.tm @@ -0,0 +1,38 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================* +* Set the Cut-off Point for Applying the Market Penetration Cost Penalty * +*============================================================================* + TM_CAPTB(R,P) = SUM(RTP(R,T,P),TM_EXPBND(RTP)); +* set the bounds for the step variables for quad approx, * clearing them first + VAR_XCAPP.UP(RTP,J) = INF; + VAR_XCAPP.UP(RTP(R,T,P),XCP(J))$((ORD(J)<7)$TM_CAPTB(R,P)) = TM_CAPTB(R,P); + +*============================================================================* +* Set the Lower Bound and Fix the First Year * +* - Demands * +* - Investment * +* - Capital * +* - Marginal Costs of Demands * +*============================================================================* +* user scalar (from CONSTANT table) to control lower bound on demands + VAR_D.LO(RTC(R,T,C))$DEM(R,C) = TM_DMTOL(R) * TM_D0(R,C); + VAR_D.FX(RTC(R,T,C))$(DEM(R,C)*(ORD(T) EQ 1)) = TM_D0(R,C); + VAR_D.FX(RTC(R,T,C))$((COM_PROJ(R,T,C) EQ 0)$DEM(R,C)) = 0; + VAR_DEM.FX(RTC(R,T,C))$((TM_DDATPREF(R,C)=0)$DEM(R,C)) = COM_PROJ(R,T,C); + + VAR_INV.L(R,T) = TM_IV0(R) * TM_L(R,T); + VAR_INV.FX(R,T(T_1)) = TM_IV0(R); + + VAR_K.L(R,T) = TM_K0(R) * TM_L(R,T); +* user scalar (from CONSTANT table) to control investment tolerance + VAR_K.LO(R,T) = TM_K0(R) * (TM_L(R,T) ** (TM_IVETOL(R)$(NOT TM_SL))); + VAR_K.FX(R,T(T_1)) = TM_K0(R); + + VAR_SP.FX(RTC(R,T,C))$DEM(R,C) = 0; + +*SK* V0.4 set MM_C for base year +* VAR_C.FX(R,T(MIYR_1)) = TM_C0(R); + VAR_C.LO(R,TT) = TM_C0(R)*.5; diff --git a/bnd_set.mod b/bnd_set.mod new file mode 100644 index 0000000..121819c --- /dev/null +++ b/bnd_set.mod @@ -0,0 +1,34 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_SET.MOD set the actual bounds on variables +* %1 - variable reference +* %2 - primary index into variable +* %3 - qualifier/bound expression +* %4 - control index +* %5 - stochastic qualifier +*=============================================================================* +*GaG Questions/Comments: +* - FX take precedence as is set last!!! +* - take primary index loop control criteria too, or reset all in case change +* in data (e.g., process moves from 1 region to another?) LATTER!!! +*----------------------------------------------------------------------------- +*$ONLISTING +* reset any existing bounds + %1.LO(%2%SWD%) = 0; + %1.UP(%2%SWD%) = INF; +* assign from user data + %1.LO(%4%SOW%)%5 $= %3(%2,'LO'); + %1.UP(%4%SOW%)%5 $= %3(%2,'UP'); + %1.FX(%4%SOW%)%5 $= %3(%2,'FX'); + +*----------------------------------------------------------------------------- +* Stochastic bounds +$IF%6 NOT %STAGES%==YES $EXIT +$IF NOT DECLARED S_%3 $EXIT + %1.LO(%4%SOW%)%5 $= S_%3(%2,'LO','1',SOW); + %1.UP(%4%SOW%)%5 $= S_%3(%2,'UP','1',SOW); + %1.FX(%4%SOW%)%5 $= S_%3(%2,'FX','1',SOW); +*$OFFLISTING diff --git a/bnd_stg.mod b/bnd_stg.mod new file mode 100644 index 0000000..bf45d7c --- /dev/null +++ b/bnd_stg.mod @@ -0,0 +1,27 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_STG.MOD set the actual bounds for non-vintage VAR_SIN/OUT +* %1 - which variable +* %2 - which bound +*=============================================================================* +* reset any existing bounds + + %VAR%_%1.LO(R,V,T,P,C,S%SWD%)$PRC_MAP(R,'STG',P) = 0; + %VAR%_%1.UP(R,V,T,P,C,S%SWD%)$PRC_MAP(R,'STG',P) = INF; + %VAR%_%1.LO(RTP_VINTYR(R,V,T,P),%PGPRIM%,S%SWD%)$((RPS_STG(R,P,S)->0)$RP_STS(R,P)) = %3; + +* set bounds at process activity level + TRACKP(RP(R,P))$((NOT PRC_VINT(R,P))$PRC_MAP(R,'STG',P)) = YES; + STG%2_BND(R,T,P,C,S,BD)$((NOT TOP(R,P,C,'%2'))$RP_STG(R,P)) = 0; + +$IF %STAGES% == YES LOOP(SW_T(T%SWD%), + + %VAR%_%1.LO(RTP_VINTYR(R,T,T,P),C,S%SWD%)$(RPCS_VAR(R,P,C,S)$TRACKP(R,P)) $= STG%2_BND(R,T,P,C,S,'LO'); + %VAR%_%1.UP(RTP_VINTYR(R,T,T,P),C,S%SWD%)$(RPCS_VAR(R,P,C,S)$TRACKP(R,P)) $= STG%2_BND(R,T,P,C,S,'UP'); + %VAR%_%1.FX(RTP_VINTYR(R,T,T,P),C,S%SWD%)$(RPCS_VAR(R,P,C,S)$TRACKP(R,P)) $= STG%2_BND(R,T,P,C,S,'FX'); + +$IF %STAGES% == YES ); + OPTION CLEAR=TRACKP; \ No newline at end of file diff --git a/bnd_ucv.mod b/bnd_ucv.mod new file mode 100644 index 0000000..2af7e9d --- /dev/null +++ b/bnd_ucv.mod @@ -0,0 +1,97 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_UCV.MOD set the actual bounds for UC constraint slacks * +*=============================================================================* +* %1 - UC variable name +* %2 - "," or "" +* %3 - "R" or "" +* %4 - period +* %5 - UCRHS attribute name +* %6 - control sets (region, period EACH/SUM/SUCC) +* %7 - optional LOOP +* %8 - optional LOOP close +* %9 - timeslice +* %10 - multi-stage indicator +* %11 - SPAR_UCSL residual dimension +*------------------------------------------------------------------------------ +$IF '%10'=='M' $GOTO MULTIPHASE +*------------------------------------------------------------------------------ +* Clear the bounds for the variables +$IF DEFINED %1 + %1.LO(UC_N%2%3%4%9%SWD%)%12 = -INF; + %1.UP(UC_N%2%3%4%9%SWD%) = INF; +*------------------------------------------------------------------------------ +* Set the bounds for the variables +%7 + %1.LO(UC_N%2%3%4%13%9%SOW%)%6 $= %5(%3%2UC_N%4%9,'LO'); + %1.UP(UC_N%2%3%4%13%9%SOW%)%6 $= %5(%3%2UC_N%4%9,'UP'); + %1.FX(UC_N%2%3%4%13%9%SOW%)%6 $= %5(%3%2UC_N%4%9,'FX'); +%8 +*------------------------------------------------------------------------------ +* Set INF upper bound for N type constraints to activate them (DYN too!) + %5(%3%2UC_N%4%9,'UP')$((NOT %5(%3%2UC_N%4%9,'UP'))$%5(%3%2UC_N%4%9,'N')) = INF; +*------------------------------------------------------------------------------ +$IFI NOT %STAGES%==YES $EXIT +*------------------------------------------------------------------------------ +* Deviation bounds: Check if any specified + IF(SW_PHASE EQ -9, + CNT=CNT+SUM((%3%2UC_N%4%9)$((%5(%3%2UC_N%4%9,'N') GE 0)$%5(%3%2UC_N%4%9,'N')),1); + CNT=CNT+SUM((%3%2UC_N%4%9,W)$((S_%5(%3%2UC_N%4%9,'N','1',W) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',W)),1); + ); +*------------------------------------------------------------------------------ +$IF%10 NOT %STAGES%==YES $EXIT +*------------------------------------------------------------------------------ +* Handle uncertain RHS if stochastic mode: Set uncertain bounds for variables + IF(SW_PHASE NE -2, +%7 + %1.LO(UC_N%2%3%4%13%9%SOW%)%6 $= S_%5(%3%2UC_N%4%9,'LO','1',SOW); + %1.UP(UC_N%2%3%4%13%9%SOW%)%6 $= S_%5(%3%2UC_N%4%9,'UP','1',SOW); + %1.FX(UC_N%2%3%4%13%9%SOW%)%6 $= S_%5(%3%2UC_N%4%9,'FX','1',SOW); +%8 + ); +*------------------------------------------------------------------------------ +$IF NOT '%10'=='I' $EXIT +*------------------------------------------------------------------------------ + IF(SW_PHASE EQ 2, +*------------------------------------------------------------------------------ +* Copy UC slack levels for missing first phase runs if necessary +$IF %STAGES%==YES LOOP((SOW(WW),W(WW-1))$(S_UCOBJ('OBJ1',SOW) EQ 4),%1.L(UC_N%2%3%4%9,SOW) $= %1.L(UC_N%2%3%4%9,W)); +$IF NOT %STAGES%==YES %1.L(UC_N%2%3%4%9%SOW%) $= SPAR_UCSL(SOW,UC_N%2%3%4%9%11); +*------------------------------------------------------------------------------ +%7 +* Set the deviation bounds for the variables - copy defaults to SOW if not specified + S_%5(%3%2UC_N%4%9,'N','1',SOW)$(NOT S_%5(%3%2UC_N%4%9,'N','1',SOW)) $= %5(%3%2UC_N%4%9,'N'); +*------------------------------------------------------------------------------ +* Set deviation uncertain bounds for variables - for SOW that have bound specified + %1.LO(UC_N%2%3%4%13%9%SOW%)$(((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)%6)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = + %1.L(UC_N%2%3%4%9%SOW%)-ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); + %1.UP(UC_N%2%3%4%13%9%SOW%)$(((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)%6)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = + %1.L(UC_N%2%3%4%9%SOW%)+ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); +%8 +*------------------------------------------------------------------------------ + ); +$EXIT +$LABEL MULTIPHASE +*------------------------------------------------------------------------------ + OPTION CLEAR=UNCD1; UNCD1(UC_N)=YES; UNCD1('OBJ1') = NO; +* Initally clear any deterministic N RHS bounds + LOOP(SOW(WW), IF(ORD(WW)=1, %5(%3%2UC_N%4%9,'N')=0); +%7 +* Copy old deviation bounds forward unless cleared + %5(%3%2UC_N%4%9,'N')$S_%5(%3%2UC_N%4%9,'N','1',SOW) = 0; + %1.LO(UC_N(UNCD1)%2%3%4%9,ALLSOW)$%5(%3%2UC_N%4%9,'N') = %1.LO(UC_N%2%3%4%9,SOW); + %1.UP(UC_N(UNCD1)%2%3%4%9,ALLSOW)$%5(%3%2UC_N%4%9,'N') = %1.UP(UC_N%2%3%4%9,SOW); +*------------------------------------------------------------------------------ +* Add flags indicating the new deviation bounds in force + %5(%3%2UC_N%4%9,'N')$((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = -1; +* Set deviation uncertain bounds for variables - for SOW that have bound specified + %1.LO(UC_N(UNCD1)%2%3%4%9,ALLSOW)$((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = + %1.L(UC_N%2%3%4%9%SOW%)-ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); + %1.UP(UC_N(UNCD1)%2%3%4%9,ALLSOW)$((S_%5(%3%2UC_N%4%9,'N','1',SOW) GE 0)$S_%5(%3%2UC_N%4%9,'N','1',SOW)) = + %1.L(UC_N%2%3%4%9%SOW%)+ABS(%1.L(UC_N%2%3%4%9%SOW%)*S_%5(%3%2UC_N%4%9,'N','1',SOW)); +%8 + ); +*------------------------------------------------------------------------------ diff --git a/bnd_ucw.mod b/bnd_ucw.mod new file mode 100644 index 0000000..459f2ca --- /dev/null +++ b/bnd_ucw.mod @@ -0,0 +1,25 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BND_UCW.MOD Wrapper for setting bounds on UC RHS variables * +*=============================================================================* +* %1 - Stochastic dollar control or '' +* %2 - I or '' +*------------------------------------------------------------------------------ +$ SET TMP +$ IF %STAGES%==YES $SET TMP (T-SUC_L(R,UC_N)) + CNT=0; + UC_T_EACH(UC_T_SUCC) = YES; +$ BATINCLUDE bnd_ucv.mod %VAR%_UC "" "" "" UC_RHS $UC_R_SUM(R,UC_N) LOOP(R, ); '' '%2' ",'','',''" +$ BATINCLUDE bnd_ucv.mod %VAR%_UCR "," "R" "" UC_RHSR $UC_R_EACH(R,UC_N) '' '' '' '%2' ",'',''" $UC_R_EACH(R,UC_N) +$ BATINCLUDE bnd_ucv.mod %VAR%_UCT "" "" ",TT" UC_RHST $(UC_R_SUM(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) LOOP(R, ); '' '%2' ",'',''" '' %TMP% +$ BATINCLUDE bnd_ucv.mod %VAR%_UCRT "," "R" ",TT" UC_RHSRT $(UC_R_EACH(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) '' '' '' '%2' ",''" $UC_T_EACH(R,UC_N,TT) %TMP% +$ BATINCLUDE bnd_ucv.mod %VAR%_UCTS "" "" ",TT" UC_RHSTS $(UC_R_SUM(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) LOOP(R, ); ,S '%2' ",''" '' %TMP% +$ BATINCLUDE bnd_ucv.mod %VAR%_UCRTS "," "R" ",TT" UC_RHSRTS $(UC_R_EACH(R,UC_N)*UC_T_EACH(R,UC_N,TT)%1) '' '' ,S '%2' "" $UC_T_EACH(R,UC_N,TT) %TMP% + UC_T_EACH(UC_T_SUCC) = NO; +*------------------------------------------------------------------------------- +$IFI %STAGES%==YES IF(SW_PHASE EQ -9, +$IF %STAGES%==YES CNT$((SW_PARM GT 0)$CNT) = EPS; +$IFI %STAGES%==YES SW_PHASE=-1; SW_PARM = (-2+4$(CNT GT 0))$CNT;); diff --git a/bndmain.mod b/bndmain.mod new file mode 100644 index 0000000..0685ed4 --- /dev/null +++ b/bndmain.mod @@ -0,0 +1,87 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* BNDMAIN.MOD establishes bounds on variables +* %1 - mod or v# for the source code to be used +* %2 - flag indicating calling phase +*=============================================================================* +*GaG Questions/Comments: +* - FXs take precedence as are set last!!! +* - TS-based bounds: +* - individual TS vs at/above limit via s-index +*----------------------------------------------------------------------------- +$ IF %2==0 $CLEAR %VAR%_IRE %VAR%_UPS %VAR%_UDP %VAR%_UPT %VAR%_SCAP + +*----------------------------------------------------------------------------- +* elastic demands step curve +*----------------------------------------------------------------------------- + %VAR%_ELAST.UP(R,T,C,S,J,BD %SWD%) = INF; +$ IF %TIMESED%==YES $BATINCLUDE bnd_elas.%1 + +*----------------------------------------------------------------------------- +* limit on total activity capacity when not vintaged +*----------------------------------------------------------------------------- +$ BATINCLUDE bnd_act.%1 + +*----------------------------------------------------------------------------- +* limit on the flow variable when not vintaged +*----------------------------------------------------------------------------- +$ BATINCLUDE bnd_flo.%1 + +*----------------------------------------------------------------------------- +* limit on storage +*----------------------------------------------------------------------------- +$ BATINCLUDE bnd_stg.%1 SIN IN 0 +$ BATINCLUDE bnd_stg.%1 SOUT OUT -INF + +*----------------------------------------------------------------------------- +* limit on total installation of new capacity +*----------------------------------------------------------------------------- +$ IF %STAGES%==YES $SETLOCAL SWT '$SW_T(T%SOW%)' +* prevent new investment if turned off explicitly by the user + NCAP_BND(RTP_OFF,'UP') = EPS; + NCAP_BND(RTP(R,T,P),'LO')$(NCAP_BND(RTP,'UP')$NCAP_BND(RTP,'LO')) = SMIN(BDNEQ,NCAP_BND(RTP,BDNEQ)); +$ BATINCLUDE bnd_set.%1 %VAR%_NCAP 'R,T,P' NCAP_BND '%R_T%,P' $(RP(R,P)%SWT%) + +*----------------------------------------------------------------------------- +* limit on total installed capacity +*----------------------------------------------------------------------------- + CAP_BND(RTP(RTP_VARP),'LO')$CAP_BND(RTP,'UP') = SMIN(BDNEQ,CAP_BND(RTP,BDNEQ)); +$ BATINCLUDE bnd_set.%1 %VAR%_CAP 'R,T,P' CAP_BND RTP(R,T,P) %SWT% + +*----------------------------------------------------------------------------- +* limit on commdities +*----------------------------------------------------------------------------- +$ BATINCLUDE bnd_set.%1 %VAR%_COMNET 'R,T,C,S' COM_BNDNET RTCS_VARC(%R_T%,C,S) %SWT% +$ BATINCLUDE bnd_set.%1 %VAR%_COMPRD 'R,T,C,S' COM_BNDPRD RTCS_VARC(%R_T%,C,S) %SWT% + %VAR%_COMPRD.FX(RTCS_VARC(R,T,C,S)%SOW%)$((NOT RHS_COMPRD(R,T,C,S))$RCS_COMPRD(R,T,C,S,'FX')) = EPS; + +*----------------------------------------------------------------------------- +* bounds for cumulative variables +*----------------------------------------------------------------------------- +$ IF %2==0 $BATINCLUDE bnd_cum.%1 COM_VAR + +*----------------------------------------------------------------------------- +* bounds for user constraint slacks +*----------------------------------------------------------------------------- +$IF %VAR_UC%==YES $BATINCLUDE bnd_ucw.%1 %SWT% +*----------------------------------------------------------------------------- +$IF %MACRO%==YES $GOTO MACRO +* Bounds for OBJ components + UC_TS_SUM(R,UC_N(OBV),S) = NO; + %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%)$UC_RHS(UC_N,'N') = -INF; + %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%) $= UC_RHS(UC_N,'LO'); + %VAR%_OBJ.UP(R,OBV(UC_N),CUR %SOW%) $= UC_RHS(UC_N,'UP'); + %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%)$UC_RHSR(R,UC_N,'N') = -INF; + %VAR%_OBJ.LO(R,OBV(UC_N),CUR %SOW%) $= UC_RHSR(R,UC_N,'LO'); + %VAR%_OBJ.UP(R,OBV(UC_N),CUR %SOW%) $= UC_RHSR(R,UC_N,'UP'); +*----------------------------------------------------------------------------- +* bounds for TIMES-MACRO +*----------------------------------------------------------------------------- +$LABEL MACRO +$ IF %MACRO% == YES $BATINCLUDE bnd_macro.tm +*----------------------------------------------------------------------------- +* Fix timeslices turned off in projected periods +$IF NOT %RTS%==S $BATINCLUDE dynslite.vda BOUNDS \ No newline at end of file diff --git a/cal_cap.mod b/cal_cap.mod new file mode 100644 index 0000000..ac9e4b2 --- /dev/null +++ b/cal_cap.mod @@ -0,0 +1,28 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* CAL_CAP the code for capacity dependent commodity flows in EQ_COMxxx +* %1 - IN/OUT indicator +* %2 - I/O indicator +* %3 - cost expression for EQOBJVAR +*=============================================================================* +*GaG Questions/Comments: +* - COEF_CPT derived in COEF_CPT.MOD +*----------------------------------------------------------------------------- +*$ONLISTING + SUM(RTP_CPTYR(R,V,T,P)$NCAP_COM(R,V,P,C,'%1'), +*V05b 980902 - need to apply seasonal fraction + COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,'%1') * G_YRFR(R,S) * + %3 + (%VARV%_NCAP%4(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V) %RCAPSUB%) * +* Adjust for lagged commodity flows + (1 + COEF_CIO(R,V,T,P,C,'%1')) + ) + +* CAL_NCOM: the term associated with invest/decommission commodities in the EQ_COMxxx + SUM(RPC_CAPFLO(R,V,P,C)$COEF_%2COM(R,V,T,P,C), COEF_%2COM(R,V,T,P,C) * + %3 + G_YRFR(R,S) * (%VARV%_NCAP%4(R,V,P %SWS%)$T(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V)) + ) +*$OFFLISTING \ No newline at end of file diff --git a/cal_caps.mod b/cal_caps.mod new file mode 100644 index 0000000..2092128 --- /dev/null +++ b/cal_caps.mod @@ -0,0 +1,29 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* CAL_CAPS the code for capacity dependent commodity flows regardless of IO +* %1 - Milestone year +* %2 - coefficient expression for EQOBJVAR / UC_FLO +* %3 - TS control index for RPCS_VAR summing +*=============================================================================* +* Questions/Comments: +* - COEF_CPT derived in COEF_CPT.MOD +*----------------------------------------------------------------------------- +*$ONLISTING +*V05c 980923 - use the capacity flow control set + SUM((VNT(V,%1),RPC_CAPFLO(R,V,P,C)), +*V05b 980902 - need to apply seasonal fraction +* Flows related to investment / decommissioning + ((COEF_ICOM(R,V,%1,P,C)+COEF_OCOM(R,V,%1,P,C)) * G_YRFR(R,S) * + (%VARV%_NCAP%4(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)) * + SUM(RPCS_VAR(R,P,C,%3), RS_FR(R,TS,S) * %2))$(COEF_ICOM(R,V,%1,P,C)+COEF_OCOM(R,V,%1,P,C)) + +* Flows related to existing capacity over lifetime + SUM((RTP_CPTYR(R,V,%1,P),IO)$NCAP_COM(R,V,P,C,IO), + COEF_CPT(R,V,%1,P) * NCAP_COM(R,V,P,C,IO) * G_YRFR(R,S) * + (%VARV%_NCAP%4(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P) +$IF DEFINED VNRET -SUM(VNRET(V,MODLYEAR(%1)),%VARM%_SCAP%4(R,V,%1,P%SWS%))$PRC_RCAP(R,P) + ) * SUM(RPCS_VAR(R,P,C,%3), RS_FR(R,TS,S) * %2) * (1+COEF_CIO(R,V,%1,P,C,IO))) + ) +*$OFFLISTING diff --git a/cal_fflo.mod b/cal_fflo.mod new file mode 100644 index 0000000..a75d6e0 --- /dev/null +++ b/cal_fflo.mod @@ -0,0 +1,52 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* CAL_FFLO the code associated with the flow variable in the EQ_COMxxx +* %1 - 'IN/OUT' for consumption/production +** %2 - 'I/O' for for invest/decommission checks (for now - NO LONGER USED) +* %3 - * Peak multiplier +*=============================================================================* +*GaG Questions/Comments: +* - VAR_FLOs according to whether c-in-PCG otherwise RPS_S1 +*----------------------------------------------------------------------------- +$IF %REDUCE% == 'YES' $GOTO REDUCE +$SET SHP1 "" SET SHG ",P,CG3,C" +$IF DEFINED RTP_FFCS $SET SHP1 "*(%SHFF%S(R,V%SHG%%SOW%))" +$SET SHP1 "*(%SHFF%X(R,V,T%SHG%)$PRC_VINT(R,P))%SHP1%" +*----------------------------------------------------------------------------- +*V05c 980923 - check that commodity not just capacity related + SUM(TOP(RP_FLO(R,P),C,'%1')$(NOT RPC_EMIS(R,P,C)), + SUM(RTPCS_VARF(R,T,P,C,TS), + SUM(RTP_VINTYR(R,V,T,P), %VAR%_FLO(R,V,T,P,C,TS %SOW%) +* equation coarser than variable or equation finer than variable +*M2T* consider COM_TS shape too, so both TS_MAP and TS_BELOW both embedded + %3) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))) + ) + +* [AL] Handle RPC_EMIS flows separately; They cannot be NOFLO + SUM(TOP(RPC_EMIS(RP_FLO(R,P),C),'%1'), + SUM((FS_EMIS(R,P,CG3,COM2,C),RTPCS_VARF(R,T,P,COM2,TS))$RS_TREE(R,S,TS), + SUM(RTP_VINTYR(R,V,T,P),%VAR%_FLO(R,V,T,P,COM2,TS %SOW%) * + COEF_PTRAN(R,V,P,CG3,COM2,C,TS) %SHP1% %3) * + RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM2,S,TS)))) + + +$EXIT +*----------------------------------------------------------------------------- +$LABEL REDUCE +* [UR] model reduction %REDUCE% is set in *.run +*[AL] Sum over non-vintaged processes + SUM(TOP(RP_FLO(R,P),C,'%1')$(NOT PRC_VINT(R,P)), + SUM((RTP_VINTYR(R,V(T),T,P),RTPCS_VARF(R,T,P,C,TS)), +$ BATINCLUDE cal_red.red C COM TS P T '' T +* equation coarser than variable or equation finer than variable + %3 * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))) + ) + + +*[AL] Sum over vintaged processes + SUM((TOP(PRC_VINT(RP_FLO(R,P)),C,'%1'),RTPCS_VARF(R,T,P,C,TS)), +$ BATINCLUDE cal_red.red C COM TS P T '' V SUM 'RTP_VINTYR(R,V,T,P),' %3 +* equation coarser than variable or equation finer than variable + * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) + ) + + diff --git a/cal_ire.mod b/cal_ire.mod new file mode 100644 index 0000000..b22b517 --- /dev/null +++ b/cal_ire.mod @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* CAL_IRE the code associated with the inter-region trade variable in EQ_COMxxx +* %1 - IMPort/EXPort indicator +* %2 - IN/OUT nature of the aux/emissions +* %3 - IE or '' +* %4 - * Peak multiplier +*=============================================================================* +*GaG Questions/Comments: +*----------------------------------------------------------------------------- +*$ONLISTING + +$IF DEFINED RTP_FFCS $SET MX "(%SHFF%S(R,V,P,C,C%SOW%))*" +*V0.9 022100 - handle the fact that called 2x for aux +$SET IE '%3' +$IF '%IE%'=='' $SET IE "'%1'" +$IF '%1%2' == 'EXPOUT' $GOTO AUXONLY +$IF '%1%2' == 'IMPIN' $GOTO AUXONLY +* actual exchange +*V05c 981016 - change RTPCS_VARFs to ts + SUM((RPC_IRE(%6R,P%7,C,'%1'),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), + SUM(RTP_VINTYR(R,V,T,P), + (%VAR%_IRE(R,V,T,P,C,TS,'%1'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) + )%4 + ) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) + ) + + +$IF SET IREAUXBAL %IREAUXBAL% %2 %5 +$LABEL AUXONLY +*V0.5b handle auxiliary commodity flows too +*** NOTE: assumes that attribute at the same level as the variable!! +*V0.9 022100 - do IN/OUT explicitly + SUM((RPC_IRE(%6R,P%7,COM,%IE%),RTPCS_VARF(R,T,P,COM,TS))$(IRE_FLOSUM(R,T,P,COM,TS,%IE%,C,'%2')$RS_FR(R,S,TS)), + IRE_FLOSUM(R,T,P,COM,TS,%IE%,C,'%2') * + SUM(RTP_VINTYR(R,V,T,P), %MX% + (%VAR%_IRE(R,V,T,P,COM,TS,%IE%%SOW%)$(NOT RPC_AIRE(R,P,COM))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM) + )%4 + ) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) + ) + +*$OFFLISTING diff --git a/cal_nored.red b/cal_nored.red new file mode 100644 index 0000000..74f7968 --- /dev/null +++ b/cal_nored.red @@ -0,0 +1,30 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================================* +* CAL_RED the code associated with the substitution of flow variables by activity variables +* %1 - commodity of flow +* %2 - commodity associated with the activity variable +* %3 - timeslice index of flow variable +* %4 - process index of flow variable +* %5 - period index of flow variable +* %6 - for output routine '.L' suffix. otherwise nothing +* %7 - optional T or V or '' (for non-vintaged / vintaged / general case) +*=============================================================================================* +$SETLOCAL SHP3 "" SET VNT '%5' SET SHG ",%4,CG3,%1" SET TST '$PRC_VINT(R,%4)' +$IF '%7' == V $SET TST '' +$IF NOT '%7' == T $SET VNT V +$IF DEFINED RTP_FFCS $SET SHP3 "*(%SHFF%S(R,%VNT%%SHG%%SOW%))" +$IF %VNT% == V $SET SHP3 "*(%SHFF%X(R,V,%5%SHG%)%TST%)%SHP3%" +*============================================================================================== +%8(%9 +* flow variable cannot be replaced + %VAR%_FLO%6(R,%VNT%,%5,%4,%1,%3 %SOW%)$(NOT RPC_EMIS(R,%4,%1)) + + +* emission flow = flow variable * emission factor + SUM((FS_EMIS(R,%4,CG3,COM2,%1),ALL_TS)$(RS_FR(R,%3,ALL_TS)*RTPCS_VARF(R,%5,%4,COM2,ALL_TS)), + %VAR%_FLO%6(R,%VNT%,%5,%4,COM2,ALL_TS %SOW%) * COEF_PTRAN(R,%VNT%,%4,CG3,COM2,%1,ALL_TS)%SHP3% * + RS_FR(R,%3,ALL_TS)*(1+RTCS_FR(R,%5,COM2,%3,ALL_TS)) + )$RPC_EMIS(R,%4,%1) +) diff --git a/cal_red.red b/cal_red.red new file mode 100644 index 0000000..cbb2fef --- /dev/null +++ b/cal_red.red @@ -0,0 +1,59 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================================* +* CAL_RED the code associated with the substitution of flow variables by activity variables +* %1 - commodity of flow +* %2 - commodity associated with the activity variable +* %3 - timeslice index of flow variable +* %4 - process index of flow variable +* %5 - period index of flow variable +* %6 - for output routine '.L' suffix. otherwise nothing +* %7 - optional T or V or '' (for non-vintaged / vintaged / general case) +* %8 - optional 'SUM' (only if %7 is not T) +* %9 - optional 'RTP_VINTYR(R,V,%5,%4),' (only if %7 is not T) +* %10 - optional multiplier (NCAP_PKCNT) +*=============================================================================================* +$SET SHP1 "" SET SHP2 "" SET SHP3 "" SET VNT '%5' SET TST '$PRC_VINT(R,%4)' +$SET SHG1 ",%4,%PGPRIM%,COM2" SET SHG2 ",%4,%PGPRIM%,%1" SET SHG ',%4,CG1,%1' +$IF NOT '%7'==T $SET VNT V +$IF DEFINED RTP_FFCS +$SET SHP1 "*(%SHFF%S(R,%VNT%%SHG1%%SOW%))" SET SHP2 "*(%SHFF%S(R,%VNT%%SHG2%%SOW%))" SET SHP3 "*(%SHFF%S(R,%VNT%%SHG%%SOW%))" +$IF '%7' == V $SET TST '' +$IF NOT '%7'==T +$SET SHP1 "*(%SHFF%X(R,V,%5%SHG1%)%TST%)%SHP1%" SET SHP2 "*(%SHFF%X(R,V,%5%SHG2%)%TST%)%SHP2%" SET SHP3 "*(%SHFF%X(R,V,%5%SHG%)%TST%)%SHP3%" +*============================================================================================== +( +* flow variable cannot be replaced + (%8(%9%VAR%_FLO%6(R,%VNT%,%5,%4,%1,%3%SOW%)%10)$(NOT RPC_EMIS(R,%4,%1)) + + +* emission flow = flow variable * emission factor + SUM((FS_EMIS(R,%4,CG1,COM2,%1),ALL_TS)$(RTPCS_VARF(R,%5,%4,COM2,ALL_TS)$RS_FR(R,%3,ALL_TS)), + %8(%9 + ( +* flow variable cannot be replaced + %VAR%_FLO%6(R,%VNT%,%5,%4,COM2,ALL_TS%SOW%)$(NOT RPC_ACT(R,%4,COM2)+RPC_FFUNC(R,%4,COM2)) + + +* flow variable equals activity variable + (%VAR%_ACT%6(R,%VNT%,%5,%4,ALL_TS%SOW%)*PRC_ACTFLO(R,%VNT%,%4,COM2))$RPC_ACT(R,%4,COM2) + + + SUM((RPC_ACT(R,%4,%2),PRC_TS2(R,%4,S2))$RS_FR(R,ALL_TS,S2), + ( + %VAR%_ACT%6(R,%VNT%,%5,%4,S2%SOW%) * ACT_FLO(R,%VNT%,%4,COM2,ALL_TS)%SHP1% + ) * RS_FR(R,ALL_TS,S2)*(1+RTCS_FR(R,%5,%2,ALL_TS,S2)) + )$RPC_FFUNC(R,%4,COM2) + ) * COEF_PTRAN(R,%VNT%,%4,CG1,COM2,%1,ALL_TS)%SHP3% %10 + ) * RS_FR(R,%3,ALL_TS)*(1+RTCS_FR(R,%5,COM2,%3,ALL_TS)) + )$RPC_EMIS(R,%4,%1) + )$(NOT RPC_ACT(R,%4,%1)+RPC_FFUNC(R,%4,%1)) + + +* flow variable equals activity variable + %8(%9%VAR%_ACT%6(R,%VNT%,%5,%4,%3%SOW%)*PRC_ACTFLO(R,%VNT%,%4,%1)%10)$RPC_ACT(R,%4,%1) + + + SUM((RPC_ACT(R,%4,%2),PRC_TS2(R,%4,S2))$RS_FR(R,%3,S2), + ( + %8(%9 %VAR%_ACT%6(R,%VNT%,%5,%4,S2%SOW%) %10 * ACT_FLO(R,%VNT%,%4,%1,%3)%SHP2%) + ) * RS_FR(R,%3,S2)*(1+RTCS_FR(R,%5,%2,%3,S2)) + )$RPC_FFUNC(R,%4,%1) +) diff --git a/cal_stgn.mod b/cal_stgn.mod new file mode 100644 index 0000000..b2d6e02 --- /dev/null +++ b/cal_stgn.mod @@ -0,0 +1,23 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* CAL_STG the code associated with the storage flows in the EQ_COMxxx +* %1 - 'IN/OUT' for consumption/production +* %2 - 'OUT/IN' for consumption/production +* %3 - STG_EFF for output +* %4 - STG_EFF for output +* %5 - for day-night storage indicator +*=============================================================================* +* Questions/Comments: +* %6 - NCAP_PKCNT multiplier +*----------------------------------------------------------------------------- +*V05c 980923 - check that commodity not just capacity related + SUM((TOP(RPC_STG(R,P,C),'%1'),RPCS_VAR(R,P,C,TS))$%5, + SUM(RTP_VINTYR(R,V,T,P), + (%VAR%_S%1(R,V,T,P,C,TS %SOW%)%3-%4%VAR%_S%2(R,V,T,P,C,TS %SOW%)$RPC_STGN(R,P,C,'%2'))%6)$(NOT RPC_STGN(R,P,C,'%1')) * +* equation coarser than variable or finer than variable + RS_FR(R,S,TS) + ) + + diff --git a/calibase.mlf b/calibase.mlf new file mode 100644 index 0000000..a6dd810 --- /dev/null +++ b/calibase.mlf @@ -0,0 +1,118 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* Calibase.MLF is the wrapper for calibrating the MACRO MLF +* %1 - mod or v# for the source code to be used +*=============================================================================* + + TM_YCHECK(R) = TM_IVETOL(R); + TM_IVETOL(R) = MAX(1,TM_IVETOL(R)); + +* Abort execution if execute errors + ABORT$EXECERROR '*** ERRORS IN EXECUTION ***' + + MODEL MCE / EQ_UTIL, EQ_PROD_Y, EQ_AKL, EQ_LABOR, EQ_KNCAP, EQ_MCAP, EQ_TMC, EQ_DD, EQ_IVECBND, EQ_ESCOST, EQ_TRDBAL /; + + OPTION SOLPRINT=OFF,SOLVELINK=1; + OPTION SOLVEOPT=MERGE,BRATIO=0.25; + MCE.MODELSTAT=0; MCE.SOLVESTAT=0; MCE.OPTFILE=1; + MCE.LIMROW=0; MCE.LIMCOL=0; + + SET LOOPS / NWT, DDF, GDP /; + PARAMETER GDPLOSS(REG,tp) 'GDP losses in percent'; + PARAMETER MSA_ERR(NITER,LOOPS,REG); + PARAMETER TM_TOL(ITEM) / CAL 1E-5, MST 1E-7, DEM 0, EQUIL 1 /; + SCALAR ERRDEM / 0 /, ERRGDP / 0 /, DOITER/ 1 /; +*------------------------------------------------------------------------------ + TM_GDP(MR,T) = TM_GDPGOAL(MR,T); + PAR_Y(MR,T) = TM_GDPGOAL(MR,T); + TM_GROWV(R,T) = TM_GR(R,T); + PAR_GRGDP(R,T) = TM_GR(R,T); + PAR_MC(R,T,DM)$TM_DEM(R,T,DM) = TM_DMC(R,T,DM); + MREG(MR) = YES; + TM_NWT(MR) = 1; + TM_HDF(MR,T) = 1; + VAR_NTX.FX(MR,PP)=0; + OPTION DECIMALS=5; + + DOITER=1$CARD(MR); + LOOP(NITER$DOITER, +$ INCLUDE ddfupd.msa + IF(ORD(NITER)<5, + LOOP(MREG, MR(R)= NO; MR(R(MREG))=YES; + SOLVE MCE MAXIMIZING VAR_UTIL USING NLP); MR(R(MREG))=YES; + ELSE SOLVE MCE MAXIMIZING VAR_UTIL USING NLP); + + TM_GDP(R,T) = VAR_C.L(R,T) + VAR_INV.L(R,T); + PAR_GRGDP(MR(R),TP(T-1)) = 100 * ((TM_GDP(R,T)/TM_GDP(R,TP))**(1/NYPER(TP))-1); + PAR_Y(R,T) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_EC.L(R,T) + VAR_NTX.L(R,T)$(NOT TB(T)); + PAR_MC(MR(R),PP(T),DM(C)) = MAX(ABS(VAR_SP.M(R,T,C)*TM_SCALE_NRG),ABS(EQ_DD.M(R,T,C))) / MAX(EQ_ESCOST.M(R,T),-VAR_EC.M(R,T)) / TM_SCALE_CST; + + MSA_ERR(NITER,'DDF',MR(R)) = SMAX((T,DM(C)),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); + MSA_ERR(NITER,'GDP',MR(R)) = SMAX(T,ABS(TM_GDPGOAL(R,T)-TM_GDP(R,T))/TM_GDPGOAL(R,T)); + ERRDEM = SMAX(MR, MSA_ERR(NITER,'DDF',MR)); + ERRGDP = SMAX(MR, MSA_ERR(NITER,'GDP',MR)); + IF(MAX(ERRDEM,ERRGDP) < TM_TOL('CAL')*ORD(NITER), DOITER=0); + ); + + DISPLAY MSA_ERR; + TM_TOL('DEM') = ERRDEM/300; + TM_TOL('GDP') = ERRGDP/300; + +* Prepare for Negishi iterations, relax trades + VAR_NTX.UP(MR,PP) = INF; + VAR_NTX.LO(MR,PP) =-INF; + OPTION CLEAR=MSA_ERR; +* Calculate initial Negishi weights based on regional GDP + TM_NWT(MR(R)) = SUM(TP, TM_GDPGOAL(R,TP)*TM_DFACT(R,TP)); + Z = SUM(MR(R),TM_NWT(R)); + TM_NWT(MR(R)) = TM_NWT(R) / Z; + + DOITER=1$CARD(MR); + LOOP(NITER$DOITER, + + OPTION BRATIO=0.25,SOLVEOPT=REPLACE; + SOLVE MCE MAXIMIZING VAR_UTIL USING NLP; + +*-- Calculate Macro parameters + TM_UDF(R,T)=TM_HDF(R,T); TM_HDF(R,T)=COEF_PVT(R,T); + LOOP(PP(T-1),TM_HDF(MR(R),T) = TM_HDF(R,PP)*EQ_ESCOST.M(R,T)/EQ_ESCOST.M(R,PP)); + Z=ROUND(TM_DEFVAL('USEHDF')); + TM_HDF(R,T)=TM_UDF(R,T)*(TM_HDF(R,T)/COEF_PVT(R,T))**.9$Z; + + TM_GDP(MR(R),PP) = VAR_C.L(R,PP)+VAR_INV.L(R,PP) + VAR_NTX.L(R,PP); + PAR_GRGDP(MR(R),tp(T-1)) = 100 * ((TM_GDP(R,T)/TM_GDP(R,TP))**(1/NYPER(TP))-1); + PAR_Y(R,T) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_EC.L(R,T) + VAR_NTX.L(R,T)$(NOT TB(T)); + PAR_MC(MR(R),PP(T),DM(C)) = MAX(ABS(VAR_SP.M(R,T,C)*TM_SCALE_NRG),ABS(EQ_DD.M(R,T,C))) / MAX(EQ_ESCOST.M(R,T),-VAR_EC.M(R,T)) / TM_SCALE_CST / tm_hdf(r,t); + MSA_ERR(NITER,'DDF',MR(R)) = SMAX((T(TT+1),DM(C)),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); + MSA_ERR(NITER,'GDP',MR(R)) = SMAX(T,ABS(TM_GDPGOAL(R,T)-TM_GDP(R,T))/TM_GDPGOAL(R,T)); + ERRDEM = SMAX(MR, MSA_ERR(NITER,'DDF',MR)); DISPLAY ERRDEM; + ERRGDP = SMAX(MR, MSA_ERR(NITER,'GDP',MR)); + DFUNC = ((ERRGDP>1.5*TM_TOL('GDP'))+(ERRDEM>1.5*TM_TOL('DEM')))*(MAX(ERRDEM,ERRGDP)>TM_TOL('MST')); + +*-- Calculate deflators and new Negishi weights + LOOP(TB(T-1), MY_ARRAY(PP) = ABS(EQ_TRDBAL.M(PP)/EQ_TRDBAL.M(T))); + TM_NWT(MR(R)) = SUM(PP, MY_ARRAY(PP)*VAR_C.L(R,PP) + MY_ARRAY(PP)*VAR_NTX.L(R,PP)); + TM_NWT(MR) = TM_NWT(MR) / SUM(REG, TM_NWT(REG)); + TM_NWTIT(NITER,MR) = TM_NWT(MR); + IF(CARD(MR)=1, TM_TOL('EQUIL')=0; + ELSE TM_TOL('EQUIL') = SUM(MR, ABS(TM_NWTIT(NITER-1,MR) - TM_NWT(MR)))); + MSA_ERR(NITER,'NWT',MR) = TM_TOL('EQUIL'); + IF(DFUNC, TM_TOL('EQUIL')=1); + IF(TM_TOL('EQUIL') LE TM_TOL('MST') OR ORD(NITER)=CARD(NITER), DOITER=0); + + IF(DOITER, +*-- Recalibrate DDF factors +$ INCLUDE ddfupd.msa + )); + + GDPLOSS(MR,TP)= 100*(TM_GDPGOAL(MR,TP)-TM_GDP(MR,TP))/TM_GDPGOAL(MR,TP); + TM_DDF_DM(MR,TP,DM)=(VAR_DEM.L(MR,TP,DM)/TM_DEM(MR,TP,DM)); + + OPTION MSA_ERR:6:2:1; + DISPLAY MSA_ERR,GDPLOSS,ERRDEM,ERRGDP; + +* Calculate IVETOL for policy run + TM_IVETOL(MR(R)) = MAX(TM_YCHECK(R),SMAX(PP$(TM_L(R,PP)>1),LOG((VAR_INV.L(R,PP)+VAR_EC.L(R,PP))/TM_Y0(R))/LOG(TM_L(R,PP)))+.005); diff --git a/clearsol.stc b/clearsol.stc new file mode 100644 index 0000000..e26c6b3 --- /dev/null +++ b/clearsol.stc @@ -0,0 +1,41 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* CLEARSOL.stc: Clear solution values +*=============================================================================* +$ IF '%1'=='' $GOTO EXECUTE +$ %SW_NOTAGS% +$ BATINCLUDE mod_vars.mod +$ BATINCLUDE eqdeclr.mod +$ CLEAR VAR_CUMFLO VAR_CUMCOM VAR_CUMCST VAR_ACT VAR_FLO VAR_IRE VAR_SIN VAR_SOUT VAR_COMNET VAR_COMPRD VAR_ELAST VAR_SCAP VAR_UPS VAR_UPT VAR_UDP VAR_UC +$ IFI %1==DEF $EXIT +$ LABEL EXECUTE +* Variables + IF(YES,DISPLAY 'Solution store cleared'; + OPTION CLEAR=VAR_ACT; + OPTION CLEAR=VAR_BLND; + OPTION CLEAR=VAR_COMNET; + OPTION CLEAR=VAR_COMPRD; + OPTION CLEAR=VAR_IRE; + OPTION CLEAR=VAR_ELAST; + OPTION CLEAR=VAR_FLO; + OPTION CLEAR=VAR_SIN,CLEAR=VAR_SOUT; + OPTION CLEAR=VAR_CAP,CLEAR=VAR_NCAP; + OPTION CLEAR=VAR_UC,CLEAR=VAR_UCR; + OPTION CLEAR=VAR_UCT,CLEAR=VAR_UCRT; + OPTION CLEAR=VAR_UCTS,CLEAR=VAR_UCRTS; + OPTION CLEAR=VAR_UPS,CLEAR=VAR_UPT,CLEAR=VAR_UDP; + OPTION CLEAR=VAR_OBJ,CLEAR=VAR_OBJELS; +* Delicate bounds + VAR_CUMCOM.L(R,C,COM_VAR,ALLYEAR,YEAR)=0; + VAR_CUMFLO.L(R,P,C,ALLYEAR,YEAR)=0; +$IF DEFINED %VAR%_DAM VAR_DAM.L(R,T,C,BD,J)=0; +$IF DEFINED %VAR%_SCAP VAR_SCAP.L(R,YEAR,T,P)=0; +* Equations + OPTION CLEAR=EQE_COMBAL,CLEAR=EQG_COMBAL,CLEAR=EQE_COMPRD; + OPTION CLEAR=EQ_PEAK,CLEAR=EQ_IRE,CLEAR=EQE_CPT; + OPTION CLEAR=EQE_FLOMRK,CLEAR=EQG_FLOMRK,CLEAR=EQL_FLOMRK; + OPTION CLEAR=EQE_ACTBND,CLEAR=EQG_ACTBND,CLEAR=EQL_ACTBND; + ); \ No newline at end of file diff --git a/clearsol.stp b/clearsol.stp new file mode 100644 index 0000000..0239fc2 --- /dev/null +++ b/clearsol.stp @@ -0,0 +1,34 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* CLEARSOL.stp: Clear solution values for projection years +*=============================================================================* + IF(1%1, + RVT(R,VNT(V,T))$RT_PP(R,T) = YES; + FIL(LL)=T(LL); LOOP(R, FIL(T)$NO_RT(R,T) = NO); + %VAR%_ACT.L(RVT,P,S%SOW%) = 0; + %VAR%_FLO.L(RVT,P,C,S%SOW%) = 0; + %VAR%_IRE.L(RVT,P,C,S,IE%SOW%) = 0; + %VAR%_SIN.L(RVT,P,C,S%SOW%) = 0; + %VAR%_SOUT.L(RVT,P,C,S%SOW%) = 0; + %VAR%_NCAP.L(RT_PP,P%SOW%) = 0; + %VAR%_COMNET.L(RT_PP,C,S%SOW%) = 0; + %VAR%_COMPRD.L(RT_PP,C,S%SOW%) = 0; + %VAR%_NCAP.L(RT_PP,P%SOW%) = 0; + %VAR%_UCT.L(UC_N,T(FIL)%SOW%) = 0; + %VAR%_UCTS.L(UC_N,T(FIL),S%SOW%) = 0; + %VAR%_UCRT.L(UC_N,RT_PP%SOW%) = 0; + %VAR%_UCRTS.L(UC_N,RT_PP,S%SOW%) = 0; + %VAR%_SCAP.L(RVT,P%SOW%) = 0; + %EQ%G_COMBAL.L(RT_PP,C,S%SWT%) = 0; +$IFI %CLI%==YES %VAR%_CLIBOX.L(CM_VAR,LL%SOW%)$CM_LED(LL)=0; +$IFI %ABS%==YES %VAR%_BSPRS.L(RVT,P,C,S,L%SOW%) = 0; + EQ_OBJ.M = 0); +$IF NOT %STAGES%==YES $EXIT + VAR_NCAP.L(RT_PP,P) = 0; + VAR_UCT.L(UC_N,T(FIL)) = 0; + VAR_UCTS.L(UC_N,T(FIL),S) = 0; + VAR_UCRT.L(UC_N,RT_PP) = 0; + VAR_UCRTS.L(UC_N,RT_PP,S) = 0; diff --git a/coef_alt.lin b/coef_alt.lin new file mode 100644 index 0000000..48ff4d9 --- /dev/null +++ b/coef_alt.lin @@ -0,0 +1,161 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COEF_ALT.LIN do coefficient calculations for the linearized objective * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* +*------------------------------------------------------------------------------ +$IF DEFINED TPULSE $GOTO PREPRO +*------------------------------------------------------------------------------ + SET PERDINV(ALLYEAR,ALLYEAR); + SET TPULSEYR(T,ALLYEAR); + PARAMETER TPULSE(ALLYEAR,ALLYEAR); + PARAMETER OBJ_LINT(R,T,ALLYEAR,CUR); + PARAMETER OBJ_ALTV(R,T); + PARAMETER RTP_CAPVL(R,YEAR,P) //; + PARAMETER RB(R,T); + PARAMETER R_DF(R,ALLYEAR); + PARAMETER OBJ_WD(REG,CUR,ALLYEAR,AGE,ALLYEAR); + PARAMETER OBJ_JD(REG,CUR,ALLYEAR,AGE); +*------------------------------------------------------------------------------ +$LABEL PREPRO +$IFI %1==FIX $GOTO DOFIX +$IFI %1==INV $GOTO DOINV +$IFI %1==STP OPTION CLEAR=PERDINV,CLEAR=TPULSE,CLEAR=TPULSEYR; +$SET ILED $NCAP_ILED(R,V,P) +*------------------------------------------------------------------------------ +* Pre-establish PERDINV (for T) + PERDINV(YK(T,K))$(YEARVAL(K) > M(T)-LEAD(T)) = YES; + OPTION CLEAR=YK1; YK1(T,Y_EOH)$(YEARVAL(T)<=YEARVAL(Y_EOH)) = YES; +* Initialize period pulse years and triangular functions + TPULSEYR(PERDINV(T,Y_EOH)) = YES; + TPULSE(TPULSEYR(T,Y_EOH)) = 1-((M(T)-YEARVAL(Y_EOH))/LEAD(T))$(NOT MIYR_1(T)); + TPULSEYR(YK1(T,Y_EOH))$(YEARVAL(Y_EOH) < M(T)+LAGT(T)) = YES; + TPULSE(TPULSEYR(YK1(T,LL))) = 1-TPULSE(T+1,LL); +*------------------------------------------------------------------------------ +* Complete OBJ_PVT and FPD: +$SET LINFLO '0' SET LINACC 0 +$IFI '%OBJ%'==LIN $SET LINACC 1 +$IFI '%CTST%'==**EPS $SET LINFLO 1 +$IFI '%OBLONG%%OBJ%'==YESALT $SET VARCOST 'LIN' SET LINACC 1 +$IFI '%OBLONG%%LINFLO%'==YES1 $SET ILED '' + +$IF %LINFLO%==1 FPD(T) = SUM(TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)); +$IF %LINFLO%==1 OBJ_PVT(R,T,CUR)$RDCUR(R,CUR) = SUM(TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); COEF_PVT(R,T) = SUM(G_RCUR(R,CUR),OBJ_PVT(R,T,CUR)); + + IF(ABS(ALTOBJ) EQ 2, LOOP(G_RCUR(R,CUR), +* Set up variable cost correction adjustment for ALT +$IF %LINFLO%==1 OBJ_ALTV(R,T) = COEF_PVT(R,T) / SUM(PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR)); +$IF %LINFLO%==0 OBJ_ALTV(R,T) = COEF_PVT(R,T) / SUM(TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); + )); +* Prepare linearized cost coefficients + OBJ_LINT(R,T,TT,CUR)$RDCUR(R,CUR) = +$IFI %OBJ%==ALT OBJ_ALTV(R,T) * +$IFI %LINACC%==1 SUM(TPULSEYR(T,Y_EOH)$TPULSEYR(TT,Y_EOH),TPULSE(T,Y_EOH)*TPULSE(TT,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); +$IFI %LINACC%==0 SUM(PERIODYR(T,Y_EOH)$TPULSEYR(TT,Y_EOH),TPULSE(TT,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR)); +$IFI %1==VAR $EXIT +*------------------------------------------------------------------------------ +$ LABEL CPT +*------------------------------------------------------------------------------ +$IFI %1==STP $GOTO STP +* Adjustments to COEF_CPT for square objective formulation + PASTSUM(RTP(R,V,P))$PRC_CAP(R,P) = B(V)+NCAP_ILED(R,V,P)+COEF_RPTI(R,V,P)*NCAP_TLIFE(R,V,P); + OPTION CLEAR=FIL2,CLEAR=MY_ARRAY,CLEAR=YK1; + LOOP(G_RCUR(R,CUR), R_DF(R,V) = 1/(1+G_DRATE(R,V,CUR))); + IF(INT_DEFAULT('PASTI'), + NCAP_ILED(R,PHYR(V),P)$(NCAP_ILED(R,V,P)>COEF_ILED(R,V,P)) = LOG(1-(1-R_DF(R,V))*(NCAP_ILED(R,V,P)-COEF_ILED(R,V,P)))/LOG(R_DF(R,V))); + RB(R,T) = B(T); +$IF %LINFLO%==1 YK1(T(LL),LL-FLOOR((LEAD(T)-1)/2)) = NOT MIYR_1(T); + LOOP(G_RCUR(R,CUR), + FIL2(T) = R_DF(R,T); +$IF %LINFLO%==1 LOOP(YK1(T,YEAR), Z=OBJ_DISC(R,YEAR,CUR)/SUM(PERDINV(T,LL),OBJ_DISC(R,LL,CUR))*LEAD(T); RB(R,T)=B(T)-LOG(Z)/LOG(FIL2(T))); + MY_ARRAY(T) = E(T)+1; MY_ARRAY(TT(T-1)) = RB(R,T); + MY_ARRAY(T) = 1-FIL2(T)**(MY_ARRAY(T)-RB(R,T)-1e-8); + COEF_CPT(RTP_CPTYR(R,V,T,P))$PASTSUM(R,V,P) = + MIN(1,(1-FIL2(T)**(PASTSUM(R,V,P)-RB(R,T)))/MY_ARRAY(T)) - ((1-FIL2(T)**MAX(0,B(V)+NCAP_ILED(R,V,P)-RB(R,T))) / MY_ARRAY(T))%ILED%); + COEF_CPT(R,T,TT,P)$((COEF_CPT(R,T,TT,P) LT 1/512)$COEF_CPT(R,T,TT,P)) = 0; +$IFI '%OBLONG%'==YES $GOTO DONE +$IF SET TIMESTEP $GOTO DONE +* Calculate additional cost due to trapezoidal periods + PASTSUM(R,T,P)$NCAP_ILED(R,T,P) = NO; + LOOP(G_RCUR(R,CUR), + FIL2(T) = R_DF(R,T); + RTP_CAPVL(R,T,P)$PASTSUM(R,T,P) = (FIL2(T)**(RB(R,T)-B(T))-1) / (1-FIL2(T)**(MIN(MIYR_VL+1,PASTSUM(R,T,P))-B(T)))); +$GOTO DONE +*------------------------------------------------------------------------------ +$ LABEL DOINV +*------------------------------------------------------------------------------ +$SETGLOBAL CAPJD OBJ_JD(R,CUR,K_EOH,JOT)* + OBJ_JD(RDCUR(R,CUR),K,JOT)$KAGE(K,JOT) = 1; +* The equation divisors for investments: + OBJ_DIVI(OBJ_YES(R,V,P))$(NOT OBJ_I2(R,V,P)) = 1+MIN(IPD(V)-1,ROUND(NCAP_TLIFE(R,V,P))-1)$T(V); + OBJ_DIVI(OBJ_YES(OBJ_1B(R,T,P)))$(ROUND(NCAP_TLIFE(R,T,P)) EQ 1) = NCAP_TLIFE(R,T,P); + OBJ_DIVI(OBJ_YES(R,T,P))$RTP_CAPVL(R,T,P) = OBJ_DIVI(R,T,P) / (1+RTP_CAPVL(R,T,P)); +* The equation divisors for decommissioning : + OBJ_DIVIII(OBJ_SUMS3(R,V,P)) = OBJ_DIVI(R,V,P); + OBJ_DIVIII(OBJ_SUMS3(OBJ_I2(R,V,P))) = ROUND(NCAP_DLIFE(R,V,P)); +* Pastmile investments + OBJ_CRFD(R,PASTMILE(V),P,CUR)$OBJ_PASTI(R,V,P,CUR) = SUM(OBJ_SUMII(R,V,P,LIFE,K,JOT),NCAP_PASTI(R,V,P)*OBJ_CRF(R,V,P,CUR)/OBJ_DISC(R,K,CUR)); + OBJ_PASTI(R,PASTMILE(V),P,CUR)$OBJ_CRFD(R,V,P,CUR) = SUM(VNT(V,T),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR))*OBJ_CRFD(R,V,P,CUR)/COR_SALVI(R,V,P,CUR); + OPTION CLEAR=OBJ_CRFD; +*------------------------------------------------------------------------------ +$ LABEL DOFIX +*------------------------------------------------------------------------------ +$SETGLOBAL CAPWD OBJ_WD(R,CUR,K_EOH,JOT,K)* +* Collect all JOT headers whether or not genuine spreads +* Genuine OBJ_1A / OBJ_1B spreads (JOT>1) for period T cannot start at B(T) + OPTION CLEAR=FIL; FIL(LL+(B(LL)-YEARVAL(LL)))$T(LL) = YES; + OPTION CLEAR=KAGE; KAGE(K,JOT)$((NOT FIL(K))$INVSTEP(K,JOT,K,JOT)) = YES; + KAGE(FIL(LL-FLOOR(ORD(JOT)/2)),JOT)$((ORD(JOT) GT 1)$INVSTEP(FIL,JOT,FIL,JOT)$FIL(LL)) = YES; +* Convert INVSTEP to INVSPRED + INVSPRED(LL,JOT,K,K)$((NOT KAGE(LL,JOT))$INVSTEP(LL,JOT,K,JOT)) = YES; + INVSPRED(KAGE(LL,JOT),LL+FLOOR(ORD(JOT)/2),K)$INVSTEP(LL,JOT,K,JOT) = YES; + OBJ_JD(RDCUR(R,CUR),KAGE(LL,JOT)) = ORD(JOT)/SUM(INVSPRED(LL,JOT,YEAR,K),OBJ_DISC(R,K,CUR)/OBJ_DISC(R,YEAR,CUR)); +%2 OPTION CLEAR=INVSTEP; +%2$GOTO FINISH +* Calculate JOT-based and step-based discount adjustments for genuine spreads + OBJ_WD(RDCUR(R,CUR),LL,JOT,K)$((NOT KAGE(LL,JOT))$INVSTEP(LL,JOT,K,JOT)) = 1; + OBJ_WD(RDCUR(R,CUR),KAGE(LL,JOT),K) $= SUM(INVSPRED(LL,JOT,YEAR,K),OBJ_DISC(R,K,CUR)/OBJ_DISC(R,YEAR,CUR))*OBJ_JD(R,CUR,LL,JOT); + OPTION CLEAR=KAGE; +* The equation divisors for fixed costs: + OBJ_DIVIV(OBJ_YES(R,PASTMILE,P)) = 1; + OBJ_DIVIV(OBJ_YES(R,T,P)) = MAX(1,MIN(IPD(T),ROUND(NCAP_TLIFE(R,T,P)))$(OBJ_1B(R,T,P)+OBJ_1A(R,T,P))); + OBJ_DIVIV(OBJ_YES(R,T,P))$RTP_CAPVL(R,T,P) = OBJ_DIVIV(R,T,P) / (1+RTP_CAPVL(R,T,P)); +* Resids +$IF NOT DEFINED PRC_RESID $GOTO FINISH + LOOP(PYR_S(V), + LOOP((OBJ_SUMIV(V,R,V,P,JOT,LIFE),G_RCUR(R,CUR))$PRC_RESID(R,'0',P), + OBJ_DIVIV(R,V,P) = NCAP_PASTI(R,V,P)*OBJ_LIFE(V,R,JOT,LIFE,CUR)/SUM(VNT(V,T)$PRC_RESID(R,T,P),PRC_RESID(R,T,P)*OBJ_PVT(R,T,CUR)))); +$GOTO FINISH +*------------------------------------------------------------------------------ +$ LABEL STP +*------------------------------------------------------------------------------ +$IF NOT %LINFLO%==1 $GOTO DONE +* Adjustments to Divisors when trapezoidal periods +* Calculate change in capacity value due to change in last period + OPTION CLEAR=RTP_CAPVL; + LOOP(T$(E(T) EQ MIYR_VL), + PASTSUM(RTP(R,TT,P))$((COEF_CPT(R,TT,T,P) GT 0)$PRC_CAP(R,P)) = B(TT)+NCAP_ILED(R,TT,P)+COEF_RPTI(R,TT,P)*NCAP_TLIFE(R,TT,P); + LOOP(G_RCUR(R,CUR), F = RB(R,T); + MY_F = R_DF(R,T); Z = 1-MY_F**(MIYR_VL-F+1); + RTP_CAPVL(R,TT(V),P)$PASTSUM(R,V,P) = COEF_PVT(R,T) * + ((MIN(Z, 1-MY_F**(PASTSUM(R,V,P)-F)) - (1-MY_F**MAX(0,B(V)+NCAP_ILED(R,V,P)-F))%ILED%) / Z - COEF_CPT(R,V,T,P)))); + RTP_CAPVL(R,TT,P)$RTP_CAPVL(R,TT,P) = RTP_CAPVL(R,TT,P)/SUM(VNT(TT,Y_EOH(T)),COEF_PVT(R,T)*MAX(0,COEF_CPT(R,TT,T,P))); + OPTION CLEAR=PASTSUM; +$IFI '%OBLONG%'==YES $GOTO UPDATE +* Calculate additional cost due to trapezoidal periods + LOOP(G_RCUR(R,CUR), + FIL2(T) = R_DF(R,T); + PASTSUM(RTP(R,Y_EOH(T),P))$((NOT NCAP_ILED(R,T,P))$PRC_CAP(R,P)) = (FIL2(T)**(RB(R,T)-B(T))-1) / (1-FIL2(T)**MIN(MIYR_VL+1-B(T),COEF_RPTI(R,T,P)*NCAP_TLIFE(R,T,P)))); + RTP_CAPVL(R,T,P)$PASTSUM(R,T,P) = (1+RTP_CAPVL(R,T,P)) / (1+PASTSUM(R,T,P)) - 1; +$LABEL UPDATE + OBJ_DIVI(RTP(R,T,P)) = STP_DIV('1',R,T,P)*(1+RTP_CAPVL(R,T,P)); + OBJ_DIVIV(RTP(R,T,P)) = STP_DIV('2',R,T,P)*(1+RTP_CAPVL(R,T,P)); + OBJ_DIVIII(RTP(R,T,P)) = STP_DIV('3',R,T,P)*(1+RTP_CAPVL(R,T,P)); +*------------------------------------------------------------------------------ +$ LABEL DONE + OPTION CLEAR=PASTSUM,CLEAR=YK1; +$ LABEL FINISH diff --git a/coef_cpt.mod b/coef_cpt.mod new file mode 100644 index 0000000..5dcb564 --- /dev/null +++ b/coef_cpt.mod @@ -0,0 +1,63 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COEF_CPT.MOD coefficient calculations related to capacity transfer * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +*GaG Questions/Comments: +* - COEF_RPTI calculated in PPMAIN.MOD +*----------------------------------------------------------------------------- +* copy the period values into the years within the period + LOOP(PERIODYR(T,V)$((NOT PHYR(V))$VNT(V,T)), + B(V) = B(T); E(V) = E(T); + M(V) = M(T); D(V) = D(T); + ); +* capacity transfer - set here only when no alternate objective + OPTION CLEAR=FIL; FIL(V)=(NOT 0%CTST%); + PASTSUM(RTP(R,FIL(V),P))$PRC_CAP(R,P) = B(V)+NCAP_ILED(RTP)+COEF_RPTI(RTP)*NCAP_TLIFE(RTP); + COEF_CPT(RTP_CPTYR(R,FIL(V),T,P))$PASTSUM(R,V,P) = + MAX(0, (MIN(E(T)+1,PASTSUM(R,V,P))-MAX(B(V)+NCAP_ILED(R,V,P),B(T))) / D(T)); + +$IF '%VALIDATE%'==YES COEF_CPT(RTP_CPTYR(R,T,T,P)) = 1; + OPTION CLEAR=PASTSUM; + +*------------------------------------------------------------------------------- +* Set NCAP_AF to be the minimum of NCAP_AF and NCAP_AFS, if both at same timeslice + MY_TS(S)=NOT ANNUAL(S); + NCAP_AF(RTP(R,V,P),MY_TS(S),BD)$(PRC_TS(R,P,S)$NCAP_AFS(RTP,S,BD)) = MIN(NCAP_AF(RTP,S,BD)+INF$(NOT NCAP_AF(RTP,S,BD)),NCAP_AFS(RTP,S,BD)); + NCAP_AF(RTP(R,V,P),S,BDNEQ)$(PRC_TS(R,P,S)$NCAP_AFS(RTP,S,'FX')) = 0; +* Remove NCAP_AFS from timeslices that are not above PRC_TS: + NCAP_AFS(RTP(R,V,P),MY_TS(S),BD)$(PRC_TS(R,P,S) OR (NOT RPS_PRCTS(R,P,S))) = 0; + +*------------------------------------------------------------------------------- +* have COEF_AF SHAPEd +* [AL] Rules for vintage-dependent availabilities: +* -- If P is Vintaged, both NCAP_AF and NCAP_AFS are vintage-dependent; +* -- If P is NOT Vintaged but NCAP_AFX is specified, then only NCAP_AF is vintage-dependent; +* -- If P is NOT Vintaged nor NCAP_AFX is specified, then neither is vintage-dependent (except AFS(ANNUAL)); +* -- NCAP_AFA is always non-vintage-dependent, but NCAP_AFS(ANNUAL) overrides it and is always vintaged. + + NCAP_AFX(R,LL--ORD(LL),P) $= NCAP_AFM(R,LL,P); + OPTION TRACKP < NCAP_AFX; + TRACKP(RP)$(NOT PRC_CAP(RP)) = NO; + TRACKP(RP)$RP_UPL(RP,'FX') = NO; + TRACKP(PRC_CAP(PRC_VINT)) = YES; + NCAP_AFBX(RTP(R,V,P),BD)$(RP_AFB(R,P,BD)>0) $= NCAP_AFX(RTP); +$ BATINCLUDE pp_shapr.%1 NCAP_AF (R,V,P,S,BD) "TRACKP(R,P)*PRC_TS(R,P,S)" COEF_AF(RTP_CPTYR(R,V,T,P),S,BD) NCAP_AFM(R,V,P) B + + TRACKP(PRC_CAP(R,P)) = (NOT TRACKP(R,P)); + COEF_AF(RTP_CPTYR(R,V,T,P),S,BD)$(PRC_TS(R,P,S)$TRACKP(R,P)) $= NCAP_AF(R,T,P,S,BD); + COEF_AF(RTP_CPTYR(R,V,T,P),ANNUAL,BD)$PRC_CAP(R,P) $= NCAP_AFA(R,T,P,BD); + +*V07_2 add seasonal AF in addition to process tslvl + OPTION RP_PRC < NCAP_AFSM; NCAP_AFSM(R,V,P)$(NOT RP_PRC(R,P)) $= NCAP_AFM(R,V,P); + NCAP_AFSX(RTP,BD)$NCAP_AFSM(RTP) = NCAP_AFSX(RTP,BD)+EPS; + RTPS_BD(RTP(R,V,P),S,BD)$((PRC_VINT(R,P)+ANNUAL(S)+YES$NCAP_AFSX(RTP,BD))$NCAP_AFS(RTP,S,BD)) = YES; + OPTION RP_PRCZ),MY_ARRAY(TT)); + LOOP(PRC_SIMV(R,P)$RTP_VARA(R,T,P), MY_FYEAR = PRC_YMIN(R,P); + IF(MY_FYEAR NE INF, F = MY_FYEAR-0.5; Z = MY_F-0.5; + FIRST_VAL = (%TRIVINT%-0.5)*(%TRIVINT%+0.5); +* Find the vintage maximizing the distance to first and last + MY_FIL2(TT)= (YEARVAL(TT)-F)*(Z-YEARVAL(TT))$RTP(R,TT,P); Z = SMAX(TT,MY_FIL2(TT)); + IF(Z > FIRST_VAL, Z = SMIN(TT$(MY_FIL2(TT) EQ Z),YEARVAL(TT)); + COEF_CAP(R,LL+(Z-MY_F),T,P) = -1; + COEF_CAP(R,LL+(MY_FYEAR-MY_F),T,P) = 1; + ELSE COEF_CAP(R,LL+(MY_FYEAR-MY_F),T,P) = -1;)))); +*----------------------------------------------------------------------------- +* Set still missing vintage indicators for year T: +COEF_CAP(R,T,T,P)$(RTP_VARA(R,T,P)$PRC_SIMV(R,P)) = 1; +* Initialize capacity transfer of simulated vintages for each TT +COEF_CSV(RTP_CPTYR(R,TT,T,P),TT)$COEF_CAP(R,TT,T,P) = 1; +*----------------------------------------------------------------------------- +OPTION CLEAR=YK1; +IF(CARD(PRC_SIMV), + LOOP(MIYR_1(LL), Z = LEAD(LL); OPTION FIL < T; FIL(LL-Z) = YES; +* Add PASTI vintages + COEF_CSV(RTP_CPTYR(R,PASTMILE,T,P),LL-Z)$(PRC_SIMV(R,P)*NCAP_PASTI(R,PASTMILE,P)) = 1); +* Average effective vintage year for each MODLYEAR: + YK1(FIL,V)$((NOT SAMEAS(FIL,V))$FIL(V)) = YES; + VTV(YK1(FIL,V),T)$((YEARVAL(T)-YEARVAL(FIL)-.5)*(YEARVAL(V)-YEARVAL(T)+.5) > 0) = YES; +* Calculate effective average vintage year + PASTSUM(RTP(R,T,P))$PRC_SIMV(R,P) = + MIN(M(T),FLOOR(MAX(YEARVAL(T)-(LEAD(T)-1)/2,B(T)+MAX(NCAP_ILED(RTP),(D(T)+NCAP_ILED(RTP)-NCAP_TLIFE(RTP))/2))+0.5)); +); +*----------------------------------------------------------------------------- +* Calculate capacity transfer for each simulated vintage: +LOOP(YK1(LL,FIL), Z = YEARVAL(LL); F = YEARVAL(FIL); + COEF_CSV(RTP_CPTYR(R,TT,T,P),FIL)$((COEF_CAP(R,LL,T,P)*COEF_CAP(R,FIL,T,P) < 0)$VTV(LL,FIL,TT)) + = (PASTSUM(R,TT,P)-Z)/(F-Z) +); +* Embed COEF_CPT in the coefficients +COEF_CSV(RTP_CPTYR(R,V,T,P),FIL)$PRC_SIMV(R,P) = COEF_CSV(R,V,T,P,FIL)*COEF_CPT(R,V,T,P); +*----------------------------------------------------------------------------- +* Clear unused vintages and ReSet RTP_VINTYR + OPTION CLEAR=YK1,CLEAR=VTV,CLEAR=PASTSUM; + OPTION COEF_CAP < COEF_CSV; + RTP_VINTYR(R,V,T,P)$PRC_SIMV(R,P) = NO; + RTP_VINTYR(R,V,T,P)$COEF_CAP(R,V,T,P) = YES; + OPTION CLEAR=COEF_CAP; +*----------------------------------------------------------------------------- + AFSV(AFS(R,T,P,S,BD))$=PRC_SIMV(R,P); AFS(AFSV)=NO; +$ BATINCLUDE eqcapvac.mod E FX N +$ BATINCLUDE eqcapvac.mod L UP N +$ BATINCLUDE eqcapvac.mod G LO LO diff --git a/coef_ext.abs b/coef_ext.abs new file mode 100644 index 0000000..22db2bd --- /dev/null +++ b/coef_ext.abs @@ -0,0 +1,112 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COEF_EXT.vda oversees extended preprocessor activities after COEF_MAIN +* %1 - extension name +*=============================================================================* +* Get storage, end-use and supply processes + BS_BSC(RP,C)$(NOT PRC_CAP(RP))=NO; + OPTION TRACKP < BS_STIME, RP_PRC < COEF_AFUPS; + RP_PRC(RP_PRC)=TRACKP(RP_PRC); OPTION TRACKP < BS_BSC; + TRACKPC(RPC(R,P,C)) $= NRG_TMAP(R,'ELC',C); +* Storage with inflow + BS_ENDP(RP_STG(RP))$SUM(TOP(TRACKPC(RPC_STG(RP,C)),'IN'),1)=YES; +* Qualify as power storage + BS_STGP(RP_PRC(RP))$SUM(TOP(RPC_STG(TRACKPC(RP,C)),'OUT'),1)=YES; + BS_STGP(RP_PRC(RP))$SUM(TOP(RPC_STG(RP,C),'OUT'),NOT TRACKPC(RP,C))=NO; + BS_STGP(RP_PRC(RP))$(((NOT BS_ENDP(RP))+TRACKP(RP))$PRC_SC(RP))=NO; + BS_STIME(BS_STGP(R,P),C,'UP')$BS_RTYPE(R,C)=SMAX(BD,BS_STIME(R,P,C,BD)); + BS_STIME(RP,C,BD)$((NOT BS_STGP(RP))$BS_STIME(RP,C,BD))=NO; + BS_BSC(BS_STGP,C)=NO; +* Qualify as power supply + OPTION RP_GRP=ORD(TSL)), + LOOP(TS_GROUP(R,TSL,TS),BS_RTCS(RSP,R,T,C,S)$(NOT BS_RTCS(RSP,R,T,C,S)) $= BS_RTCS(RSP,R,T,C,TS)$(STOAL(R,S)=F)$RS_BELOW(R,TS,S)))); +* Put-back + BS_OMEGA(RTC,S)$= BS_RTCS('OMEGA',RTC,S); + BS_DELTA(RTC,S)$= BS_RTCS('DELTA',RTC,S); +* Reserve Process attributes + OPTION RP_PRC0,BS_TOP(TOP(R,P,C,IO))$TOP(R,P,C,'OUT')=YES; + ELSE BS_TOP(TOP(R,P,C,IO))$(IPS(IO)+PRC_MAP(R,'STG',P))=YES)); + GR_GENMAP(R,P(BS_K),P)$PROD(PRC$GR_GENMAP(R,PRC,P),0)=1; + OPTION CLEAR=RXX,CLEAR=TRACKP,CLEAR=RP_PRC,CLEAR=RP_GRP,CLEAR=TRACKPC; + +* Timeslices + OPTION RCS < BS_OMEGA; + LOOP(COM_TS(RCS(R,C,S)),BS_COMTS(R,C,TS)$RS_TREE(R,S,TS)=YES); + BS_DELTA(RTCS_VARC(RTC,S))$((NOT BS_DELTA(RTC,S))$BS_OMEGA(RTC,S)) = 1; + BS_SIGMA(RTC(R,T,C),BS_K,S)$((BS_LAMBDA(RTC)$BS_COMTS(R,C,S)=0)$BS_SIGMA(RTC,BS_K,S))=0; + LOOP((R,T,C,BS_K,S)$BS_SIGMA(R,T,C,BS_K,S),BS_RTK(R,T,BS_K)=YES); + LOOP(COM_LIM(R,C,L)$BS_RTYPE(R,C),BS_OMEGA(R,'0',C,S)$BS_COMTS(R,C,S)=FINEST(R,S)$IPS(L)+COM_TS(R,C,S)$BD(L)); +* Activate COMNET, disable COMPRD + RHS_COMBAL(RTCS_VARC(R,T,C,S))$BS_RTYPE(R,C)=BS_COMTS(R,C,S); + RCS_COMBAL(RTCS_VARC(R,T,C,S),'FX') $= BS_RTYPE(R,C); + RHS_COMPRD(RTCS_VARC(R,T,C,S))$BS_RTYPE(R,C) = NO; + RCS_COMPRD(RTCS_VARC(R,T,C,S),'FX')$BS_RTYPE(R,C) = NO; + COM_BNDPRD(RTCS_VARC(R,T,C,S),'UP')$((NOT BS_COMTS(R,C,S)$BS_LAMBDA(R,T,C))$BS_RTYPE(R,C)) = EPS; + COM_AGG(R,T,C,C)$BS_RTYPE(R,C)=1; + RC_AGP(RC,'FX')$=BS_RTYPE(RC); +* Post-process RMAX; no reserve supply from multi-output AFC processes + BS_RMAX(R,V,P,C,S)$(BS_SUPP(R,P)$RP_STD(R,P)$RPS_CAFLAC(R,P,S,'UP'))=0; + LOOP((RC(R,C),BD)$BS_ABD(RC,BD), + VDA_FLOP(RTP(R,V,P),C,S)$((BS_PRS(R,P,S)$PRC_YMAX(R,P)+ANNUAL(S))$BS_BSC(R,P,C)) = + SMAX(BS_ABD(R,COM,BD)$((BS_RTYPE(RC)-BS_RTYPE(R,COM))*BDSIG(BD)<=0),BS_RMAX(RTP,COM,S))); + VDA_FLOP(RTP,C,S)$((BS_RMAX(RTP,C,S)=VDA_FLOP(RTP,C,S))$BS_RMAX(RTP,C,S))=0; + BS_RMAX(RTP,C,S) $= VDA_FLOP(RTP,C,S); OPTION NCAP_AFAC < VDA_FLOP; + LOOP((RTP(R,V,P),C)$NCAP_AFAC(RTP,C), +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'BS_RMAX decreasing at slower reserve types - reset' + PUT QLOG ' WARNING - Kept at preceding value, R=',%RL%,' P=',%PL%,' V=',V.TL, ' C=',C.TL); + BS_RMAX(RTP(R,V,P),C,ANNUAL(S))$BS_BSC(R,P,C) = BS_RMAX(RTP,C,S)$(NOT PRC_YMAX(R,P)); +* Controls for reserve limits + RPC_CONLY(RTP(R,V,P),C)$((BS_RMAX(RTP,C,'ANNUAL')$BS_SUPP(R,P)<1-ACT_MINLD(RTP)$BS_ABD(R,C,'UP'))$BS_BSC(R,P,C))=YES; + LOOP((BS_ABD(RC(R,COM),BD),C,ANNUAL(S))$BS_ABD(R,C,BD), + IF((BS_RTYPE(RC)-BS_RTYPE(R,C))*BDSIG(BD)<0,RPC_CONLY(RTP(R,V,P),C)$((BS_RMAX(RTP,C,S)>=BS_RMAX(RTP,COM,S))$BS_RMAX(RTP,COM,S))=NO)); + LOOP((BS_COMTS(R,C,S),BS_ABD(R,C,L)),BS_SBD(R,S,L)=YES); + OPTION CLEAR=PRC_YMAX,CLEAR=VDA_FLOP,CLEAR=NCAP_AFAC,CLEAR=RCS; +* Build UC map + BS_UCMAP(UC_MAP_FLO(UC_N,SIDE,R,P,C))$(BS_BSC(R,P,C)+BS_STGP(R,P)$BS_STIME(R,P,C,'UP'))$=BS_RTYPE(R,C); \ No newline at end of file diff --git a/coef_ext.cli b/coef_ext.cli new file mode 100644 index 0000000..b964d31 --- /dev/null +++ b/coef_ext.cli @@ -0,0 +1,199 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* COEF_EXT.cli - Coefficients for the Climate Module Extension +*----------------------------------------------------------------------------- +* Questions/Comments: +* +*----------------------------------------------------------------------------- +$IF '%1'==SLOPE $GOTO %1 +*----------------------------------------------------------------------------- +* Set up the history calibration values + +* If calibration values are not provided by user, use the defaults: +CM_CONST(CM_HISTS) = 0; +LOOP((LL,CM_HISTS)$CM_HISTORY(LL,CM_HISTS),CM_CONST(CM_HISTS) = EPS); +CM_HISTORY(LL,CM_HISTS)$(NOT CM_CONST(CM_HISTS)) $= CM_DEFAULT(LL,CM_HISTS); + +* Pick up the appropriate calibration values for the calibration year; +CM_CALIB=1; +$IFI %CM_CALIB%==B CM_CALIB = SUM(MIYR_1(T),M(T)-B(T))+1; +$IFI %CM_CALIB%==M CM_CALIB = EPS; + +* Inter-/extrapolate calibration values +OPTION CLEAR=FIL; LOOP(MIYR_1(LL),FIL(LL-CM_CALIB) = YES); +$BATINCLUDE filparam CM_HISTORY '' 'CM_HISTS' ",'','','','','',''" LL FIL '' '' +* Pick the history values +LOOP(MIYR_1(LL), CM_CONST(CM_HISTS) = CM_HISTORY(LL-CM_CALIB,CM_HISTS)); +*----------------------------------------------------------------------------- +* Set up the 3x3 PHI matrix for emissions +IF(NOT SUM((CM_BOX,CM_BUCK),CM_PHI('CO2-GTC',CM_BOX,CM_BUCK)), +* Set up the 3x3 PHI matrix + CM_PHI('CO2-GTC','ATM','UP') = CM_CONST('PHI-UP-AT'); + CM_PHI('CO2-GTC','UP','ATM') = CM_CONST('PHI-AT-UP'); + CM_PHI('CO2-GTC','UP','LO') = CM_CONST('PHI-LO-UP'); + CM_PHI('CO2-GTC','LO','UP') = CM_CONST('PHI-UP-LO'); +); +* Default first-order decay models for CH4 and N2O +IF(NOT SUM((CM_BOX,CM_BUCK),CM_PHI('CH4-MT',CM_BOX,CM_BUCK)), + CM_PHI('CH4-MT','ATM','ATM') = 1-CM_CONST('PHI-CH4'); + CM_PHI('CH4-MT','UP','CH4-MT') = EPS$CM_CONST('CH4-UP'); +); +IF(NOT SUM((CM_BOX,CM_BUCK),CM_PHI('N2O-MT',CM_BOX,CM_BUCK)), + CM_PHI('N2O-MT','ATM','ATM') = 1-CM_CONST('PHI-N2O'); + CM_PHI('N2O-MT','UP','N2O-MT') = EPS$CM_CONST('N2O-UP'); +); +*----------------------------------------------------------------------------- +* Set emission kinds and FORCING to CM_KIND when active + CM_GHGMAP(R,COM,C)$(NOT CM_GHGMAP(R,COM,C)) $= IRE_CCVT(R,COM,R,C); + CM_KIND(CM_VAR(C))$(SUM((R,COM)$CM_GHGMAP(R,COM,C),1)*SUM((CM_BOX,CM_BUCK)$CM_PHI(CM_VAR,CM_BOX,CM_BUCK),1)) = YES; + CM_EMIS(CM_VAR) = CM_KIND(CM_VAR)$CM_PPM(CM_VAR); + CM_KIND('FORCING') = YES$(SUM(LL$CM_MAXC(LL,'DELTA-ATM'),1)+(CARD(CM_EMIS) GT 1)); + IF(CARD(UC_CLI),CM_KIND('FORCING') = YES); + CM_TKIND(CM_KIND) = YES; LOOP(CM_FORCMAP(CM_VAR,CM_HISTS)$SUM(LL$CM_MAXC(LL,CM_VAR),1),CM_TKIND(CM_VAR)=YES); + CM_FORCMAP('FORC-KYO',CM_VAR)$=CM_PPM(CM_VAR); CM_FORCMAP('FORCING',CM_VAR)$=CM_PPM(CM_VAR); +$IFI %STAGES%==YES CM_KIND('FORCING')$SUM((LL,J,W)$S_CM_MAXC(LL,'DELTA-ATM',J,W),1) = YES; +$IF DEFINED DAM_COST CM_KIND('FORCING')$SUM(R$(DAM_BQTY(R,'FORCING')+DAM_BQTY(R,'DELTA-ATM')),1) = YES; +*----------------------------------------------------------------------------- +* Establish set of years beyond EOH +* Set extended EOH (EXT-EOH) year into FIL; -1 deactivates EOH extension + OPTION CLEAR=FIL; YR_VL = 0; FIRST_VAL = CM_CONST('EXT-EOH'); + IF(FIRST_VAL GT 0, FIRST_VAL = ROUND(MAX(MIYR_VL,FIRST_VAL)); + LOOP(MIYR_1(LL), F = FIRST_VAL-YEARVAL(LL); FIL(LL+F) = YES); + CM_BEMI(CM_EMIS,FIL) = EPS; CM_EVAR(CM_EMIS,FIL) = 1; +* Set all MAXC year beyond EOH into FIL + F = SMAX(T(LL),ORD(LL)); CM_MAXC_M(CM_VAR,LL)$CM_MAXC(LL,CM_VAR)=EPS; +$IFI %STAGES%==YES OPTION CM_RESULT < S_CM_MAXC; CM_MAXC_M(ITEM,LL) $= CM_RESULT(ITEM,LL); + LOOP((LL,CM_VAR(CG))$((ORD(LL) GT F)$CM_MAXC_M(CG,LL)), + IF((YEARVAL(LL) GT FIRST_VAL OR NOT(CM_EMIS(CM_VAR)))$YEARVAL(LL), YR_VL = ORD(LL); FIL(LL) = YES)); + FIL(LL)$(ORD(LL) GT YR_VL) = NO; +* Set BEMI to MAXC emissions for years beyond EXT-EOH and zero at EXT-EOH + CM_BEMI(CM_EMIS(CM_HISTS(CG)),FIL(LL))$(YEARVAL(LL) GT FIRST_VAL) = CM_MAXC(LL,CG); + CM_EVAR(CM_EMIS,FIL(LL))$(YEARVAL(LL) GT FIRST_VAL) = EPS$CM_BEMI(CM_EMIS,LL); +* Set EOH contribution to zero at final year (deactivated for now) +* LOOP(MIYR_1(YEAR), CM_EVAR(CM_EMIS,YEAR+(YR_VL-ORD(YEAR))) = EPS); +* Set all years Modulo BEOHMOD to FIL + MY_F = ROUND(MAX(1,CM_CONST('BEOHMOD'))); + FIL(LL)$((ORD(LL) LT YR_VL)$(MOD(YEARVAL(LL),MY_F) = 0)) = YES$(ORD(LL) GT F); + ); + CM_MAXC(LL,CM_EMIS(CM_HISTS(CG)))$(YEARVAL(LL) GT MIYR_VL) = 0; +* Complete CM_LED + LOOP(FIL(LL), Z = ORD(LL); CM_LED(LL) = Z-F; F = Z); + CM_LED(T) = LEAD(T); CM_LED(MIYR_1) = CM_CALIB; + PRET(T,T-1)=YES; +* Interpolate BEMI and BEOH over FIL (mucks-up F, Z, MY_F, MY_FYEAR, FIRST_VAL, LAST_VAL) +$ BATINCLUDE filparam CM_BEMI 'CM_EMIS,' '' ",'','','','',''" LL FIL '' '' +$ BATINCLUDE filparam CM_EVAR 'CM_EMIS,' '' ",'','','','',''" LL FIL '' '' + CM_EVAR(CM_EMIS,T) = 1; +*----------------------------------------------------------------------------- +IF(CM_KIND('FORCING'), + CM_SIG1(SOW) = CM_CONST('SIGMA1'); +* Set up the 2x2 SIG matrix for forcing +$ IFI %STAGES%==YES $BATINCLUDE fillsow.stc CM_CONST CM_STCC '' '' YES YES YES +$ IFI %STAGES%==YES $BATINCLUDE fillsow.stc DAM_COST 'R,' '"DELTA-ATM",CUR' TT YES YES NO +$ IFI %STAGES%==YES CM_SIG1(SOW)=S_CM_CONST('SIGMA1','1',SOW); +$ IFI %STAGES%==YES CM_SIG(SOW,'ATM','ATM') = 1-CM_SIG1(SOW)*(CM_CONST('GAMMA')/S_CM_CONST('CS','1',SOW)+CM_CONST('SIGMA2')); +$ IFI NOT %STAGES%==YES CM_SIG('1','ATM','ATM') = 1-CM_SIG1('1')*(CM_CONST('LAMBDA')+CM_CONST('SIGMA2')); + CM_SIG(SOW,'ATM','LO') = CM_SIG1(SOW)*CM_CONST('SIGMA2'); + CM_SIG(SOW,'LO','ATM') = CM_CONST('SIGMA3'); + CM_SIG(SOW,'LO','LO') = 1-CM_CONST('SIGMA3'); + CM_PHI('FORCING','ATM','FORCING') = 1; +* Intialize CM_AA to the identity matrix, CM_BB to zero + CM_AA('FORCING',LL,SOW,CM_BUCK,CM_BOX)$CM_LED(LL) = DIAG(CM_BUCK,CM_BOX); + CM_BB('FORCING',LL,SOW,CM_BUCK)$CM_LED(LL) = 0; CNT=0; +* Assume linear evolution of forcing between milestone years + LOOP((CM_VAR('FORCING'),LL)$CM_LED(LL), + IF(CNT, CNT=1; Z = CM_LED(LL); ELSE CNT=EPS; Z=CM_CALIB); + FOR(F = 0 TO Z-1, MY_F = F/Z*CNT; + CM_BB(CM_VAR,LL,SOW,CM_BOX) = CM_BB(CM_VAR,LL,SOW,CM_BOX) + CM_SIG1(SOW)*(1-MY_F)*CM_AA(CM_VAR,LL,SOW,CM_BOX,'ATM'); + CM_CC(CM_VAR,LL,SOW,CM_BOX) = CM_CC(CM_VAR,LL,SOW,CM_BOX) + CM_SIG1(SOW)* MY_F *CM_AA(CM_VAR,LL,SOW,CM_BOX,'ATM'); + CM_AA(CM_VAR,LL,SOW,CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_AA(CM_VAR,LL,SOW,CM_BUCK,ITEM)*CM_SIG(SOW,ITEM,CM_BOX)); + ))); +*----------------------------------------------------------------------------- +* Set up control set CM_CONC for the BOX equations; complete PHI + OPTION CM_CONC <= CM_BOXMAP; + CM_PHI(CM_KIND,CM_BOX,CM_BOX)$(NOT CM_PHI(CM_KIND,CM_BOX,CM_BOX)) = 1-SUM(CM_BUCK$(NOT SAMEAS(CM_BOX,CM_BUCK)),CM_PHI(CM_KIND,CM_BUCK,CM_BOX)); +*----------------------------------------------------------------------------- +* Calculate the ith powers of PHI, i=1...Z, where Z = LEAD(T) +* First intialize CM_AA to the identity matrix, and CM_BB(T,1) to 0: +LOOP(CM_EMIS(CM_VAR), + CM_PHI(CM_VAR,'ATM',CM_VAR)$(NOT SUM(CM_BOX$CM_PHI(CM_VAR,'ATM',CM_VAR),1)) = 1; + CM_AA(CM_VAR,LL,'1',CM_BUCK,CM_BOX)$CM_LED(LL) = DIAG(CM_BUCK,CM_BOX); + CM_BB(CM_VAR,LL,'1',CM_BUCK)$CM_LED(LL) = 0; CNT = (ALTOBJ NE 3); +* Loop over MILESTONYR and calculate rest of the powers of PHI + LOOP(T$(ALTOBJ NE 3), + IF(ORD(T) GT 1, MY_F = M(T)-B(T)+1; Z = LEAD(T); ELSE MY_F=CM_CALIB; Z=MY_F); + FOR(F = 1 TO Z, + IF(F LE MY_F, CM_BB(CM_VAR,T,'1',CM_BOX) = CM_BB(CM_VAR,T,'1',CM_BOX) + SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,T,'1',CM_BOX,CM_BUCK)); + ELSE CM_CC(CM_VAR,T,'1',CM_BOX) = CM_CC(CM_VAR,T,'1',CM_BOX) + SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,T,'1',CM_BOX,CM_BUCK))); + CM_AA(CM_VAR,T,'1',CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_AA(CM_VAR,T,'1',CM_BUCK,ITEM)*CM_PHI(CM_VAR,ITEM,CM_BOX)); + )); +* If linear evolution formulation, assume linear evolution of emissions + LOOP(LL$(((ALTOBJ EQ 3) OR NOT T(LL))$CM_LED(LL)), + IF(CNT, CNT=1; Z = CM_LED(LL); ELSE CNT=EPS; Z=CM_CALIB); + FOR(F = 0 TO Z-1, MY_F = F/Z*CNT; + CM_BB(CM_VAR,LL,'1',CM_BOX) = CM_BB(CM_VAR,LL,'1',CM_BOX) + (1-MY_F)*SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,LL,'1',CM_BOX,CM_BUCK)); + CM_CC(CM_VAR,LL,'1',CM_BOX) = CM_CC(CM_VAR,LL,'1',CM_BOX) + MY_F *SUM(CM_BUCK,CM_PHI(CM_VAR,CM_BUCK,CM_VAR)*CM_AA(CM_VAR,LL,'1',CM_BOX,CM_BUCK)); + CM_AA(CM_VAR,LL,'1',CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_AA(CM_VAR,LL,'1',CM_BUCK,ITEM)*CM_PHI(CM_VAR,ITEM,CM_BOX)); + )); +); +*----------------------------------------------------------------------------- +* Prepare commodity variables for emissions: + CM_GHGMAP(R,C,'CO2-GTC') $= CM_CO2GTC(R,C); + LOOP((R,C,CM_KIND(CM_VAR(CG)))$CM_GHGMAP(R,C,CG), + RHS_COMBAL(RTCS_VARC(R,T,C,S)) = YES; + RCS_COMBAL(RTCS_VARC(R,T,C,S),'FX') = YES); +*----------------------------------------------------------------------------- +* Construct SUPERYR (needed in MAX constraints) + SUPERYR(PERIODYR(T,LL))$(YEARVAL(LL) LE YEARVAL(T)) = YES; + SUPERYR(T+1,LL)$((YEARVAL(LL) GT YEARVAL(T))$PERIODYR(T,LL)) = YES; + LOOP(MIYR_1(T++1),SUPERYR(T,LL)$(YEARVAL(LL) GT M(T)) = YES); + OPTION FIL < CM_LED, MY_FIL < Y; + MY_FIL(LL)$((YEARVAL(LL)>MIYR_VL)$(ORD(LL) LE YR_VL)) = YES; +*============================================================================= +* Prepare input parameters +*----------------------------------------------------------------------------- +* Interpolate parameters by default or if requested by user: +$BATINCLUDE filparam CM_LINFOR '' 'CM_VAR,LIM' ",'','','','',''" DATAYEAR FIL '' '' +$BATINCLUDE filparam CM_MAXCO2C '' '' ",'','','','','',''" LL T '' '' -1 +$BATINCLUDE filparam CM_MAXC '' 'CG' ",'','','','','',''" LL FIL '' '' -1 +$BATINCLUDE filparam CM_EXOFORC '' '' ",'','','','','',''" LL MY_FIL '' '' +$BATINCLUDE filparam UC_CLI 'UC_N,SIDE,R,' 'CM_VAR' ",'','',''" DATAYEAR T +$IFI %STAGES%==YES $BATINCLUDE filparam S_CM_MAXCO2C '' 'J,WW' ",'','','','',''" DATAYEAR T SW_TSTG(T,J)$ '' -1 +$IFI %STAGES%==YES $BATINCLUDE filparam S_CM_MAXC '' 'CG,J,WW' ",'','','',''" DATAYEAR T SW_TSTG(T,J)$ '' -1 +*----------------------------------------------------------------------------- +* Convert all concentration bounds to PPM basis + CM_MAXC(LL,CG('CO2-PPM'))$CM_MAXCO2C(LL) = MIN(CM_MAXC(LL,CG)+INF$(NOT CM_MAXC(LL,CG)),CM_MAXCO2C(LL)/CM_PPM('CO2-GTC')); + CM_MAXC(LL,CG('CO2-PPM'))$CM_MAXC(LL,'CO2-ATM') = MIN(CM_MAXC(LL,CG)+INF$(NOT CM_MAXC(LL,CG)),CM_MAXC(LL,'CO2-ATM')*CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')); + CM_MAXC(LL,CG('CO2-PPM'))$(CM_MAXC(LL,'FORCING')*(NOT CM_KIND('FORCING'))) = + MIN(CM_MAXC(LL,CG)+INF$(NOT CM_MAXC(LL,CG)),CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')* + EXP((CM_MAXC(LL,'FORCING')-CM_EXOFORC(LL))*LOG(2)/CM_CONST('GAMMA'))); +* Remove bounds from years with undefined concentration + F = SMIN(T,YEARVAL(T)); CM_MAXC(LL,CG)$(YEARVAL(LL) LT F) = 0; +$IFI NOT %STAGES%==YES $GOTO SLOPE + S_CM_MAXC(LL,CG('CO2-PPM'),J,W)$S_CM_MAXCO2C(LL,J,W) = MIN(S_CM_MAXC(LL,CG,J,W)+INF$(NOT S_CM_MAXC(LL,CG,J,W)),S_CM_MAXCO2C(LL,J,W)/CM_PPM('CO2-GTC')); + S_CM_MAXC(LL,CG('CO2-PPM'),J,W)$S_CM_MAXC(LL,'CO2-ATM',J,W) = MIN(S_CM_MAXC(LL,CG,J,W)+INF$(NOT S_CM_MAXC(LL,CG,J,W)),S_CM_MAXC(LL,'CO2-ATM',J,W)*CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')); + S_CM_MAXC(LL,CG('CO2-PPM'),J,W)$(S_CM_MAXC(LL,'FORCING',J,W)*(NOT CM_KIND('FORCING'))) = + MIN(S_CM_MAXC(LL,CG,J,W)+INF$(NOT S_CM_MAXC(LL,CG,J,W)),CM_CONST('CO2-PREIND')/CM_PPM('CO2-GTC')* + EXP((S_CM_MAXC(LL,'FORCING',J,W)-CM_EXOFORC(LL))*LOG(2)/CM_CONST('GAMMA'))); + S_CM_MAXC(LL,CG,J,W)$(YEARVAL(LL) LT F) = 0; +$ BATINCLUDE fillsow.stc CM_MAXC '' 'CG' LL YES 'SUPERYR(T,LL)' YES +*----------------------------------------------------------------------------- +* Calculate linear slope for FORCING from CO2 +$LABEL SLOPE + IF(CM_KIND('FORCING'),OPTION FIL 0), 1); + +* perhaps other defaults for testing purposes: growth factors etc. + +*----------------------------------------------------------------------------- +* Create a set of all key components of cluster technologies +* Create a set of all cluster technologies +LOOP((RP(R,P),REG,PRC)$((TL_MRCLUST(R,P,REG,PRC) > 0.0)$TL_MRCLUST(R,P,REG,PRC)), + TL_RP_KC(R,P) = YES; TL_RP_CT(REG,PRC) = YES); + +*----------------------------------------------------------------------------- +* setting normal NCAP_COST of ETL technologies to zero to exclude this contribution fro the objective function +OBJ_ICOST(R,EACHYEAR,P,CUR)$SEG(R,P) = 0; +*----------------------------------------------------------------------------- +display ccapk, beta, alph; +*$LABEL NOMIP diff --git a/coef_ext.vda b/coef_ext.vda new file mode 100644 index 0000000..155fabf --- /dev/null +++ b/coef_ext.vda @@ -0,0 +1,74 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COEF_EXT.vda oversees extended preprocessor activities after COEF_MAIN +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Questions/Comments: +* +*----------------------------------------------------------------------------- + PARAMETER VDA_DISC(R,ALLYEAR); +$ CLEAR VDA_DISC +$ IFI NOT %WAVER%==YES $GOTO RESID +$ BATINCLUDE fillwave PRC_RESID PRC 0 +$ BATINCLUDE fillwave COM_PROJ COM 1 + OPTION CLEAR=VDA_DISC; +$ LABEL RESID +* Try making sensible RESID PASTI (although it does not affect solution) +* Finalize PRC_RESID capacity coefficients: + LOOP(T, TRACKP(R,P)$((PRC_RESID(R,T,P)>0)$PRC_RESID(R,T,P)) = YES); + LOOP(PYR_S(V), + LOOP(PRC_RCAP(TRACKP(R,P)),Z=SMAX(T,PRC_RESID(R,T,P));RTFORC(RTP_CPTYR(R,V,T,P))=Z-PRC_RESID(R,T,P)+EPS;PRC_RESID(R,T,P)$RTFORC(R,V,T,P)=Z); + NCAP_PASTI(R,V,P)$PRC_RESID(R,'0',P) = (SUM(T,PRC_RESID(R,T,P)*D(T))/SUM(T$(PRC_RESID(R,T,P)>0),D(T)))$TRACKP(R,P); + ); + PRC_RESID(R,'0',P)$(NOT TRACKP(R,P)) = 0; + COEF_CPT(RTP_CPTYR(R,PYR_S(V),T,P))$TRACKP(R,P) = PRC_RESID(R,T,P)/NCAP_PASTI(R,V,P); +*----------------------------------------------------------------------------- +* Offline capacity terms & STS amendments +$ SETGLOBAL UPSCAPS -SUM(TS_MAP(R,ALL_TS,S)$RPS_UPS(R,P,ALL_TS),%VAR%_UPS(R,V,T,P,ALL_TS,'N'%SOW%)) +$ IFI %OBMAC%==YES $macro var_sts(r,v,t,p,ts,bd) sum(rp_stl(r,p,tsl,bd)$ts_group(r,tsl,ts),%var%_udp(r,v,t,p,ts,bd%sow%)) +$ IFI NOT %STSFLX%==YES RP_STL(RP_STS,TSL,BD)=0; +*----------------------------------------------------------------------------- +* Get AF-UPs for processes having storage level constrained + COEF_AFUPS(RTP(R,V,P),S)$(NOT RPS_CAFLAC(R,P,S,'UP')) $= NCAP_AF(RTP,S,'UP')$RPS_STG(R,P,S); + COEF_AFUPS(RTP(R,V,P),S(STL))$RPS_STG(R,P,S) $= NCAP_AFC(RTP,%PGPRIM%,STL); + COEF_AFUPS(R,V,P,S)$(NOT PRC_CAP(R,P)) = NO; +* Cycling cost annuity + ACT_CSTUP(RTP(R,V,P),TSL(S),CUR)$(RDCUR(R,CUR)$STG_MAXCYC(RTP))=ACT_CSTUP(RTP,TSL,CUR)*G_DRATE(R,V,CUR)/(1-(1+G_DRATE(R,V,CUR))**(-NCAP_TLIFE(RTP))); +*----------------------------------------------------------------------------- +* Remove commodity balance equations from non-demand sinks + OPTION TRACKP < RTP, TRACKC < RHS_COMBAL, RCS < IRE_FLOSUM; + LOOP(TRACKP(R,P),TRACKC(R,C)$TOP(R,P,C,'IN') = YES); + TRACKC(R,C) $= SUM(RPC_IRE(TRACKP(R,P),C,'EXP'),1); + TRACKC(RC) $= SUM(RCS(RC,S),1); TRACKC(DEM)=YES; + TRACKC(R,C) $= SUM(RPC_NOFLO(TRACKP(R,P),C),1); + RCS_COMBAL(RTCS_VARC(R,T,C,S),L)$(NOT TRACKC(R,C)) = NO; + OPTION CLEAR=TRACKC,CLEAR=TRACKP,CLEAR=RCS; +*----------------------------------------------------------------------------- +* Add singleton ACT_EFFs to COEF_PTRANS or ACT_FLO + RP_CGC(RPG_1ACE) = YES; OPTION TRACKPC < RPG_1ACE, RP_GRP < RP_CGC; +* Convert ACT_EFF factors for reduced flows + TRACKPC(TRACKPC) = RPC_FFUNC(TRACKPC); + ACT_FLO(RTP(R,V,P),C,S)$(RPCS_VAR(R,P,C,S)$TRACKPC(R,P,C)) = 1/SUM(RP_CGC(R,P,CG,C),MAX(MICRO,ACT_EFF(RTP,CG,S)*(1+(ACT_EFF(RTP,C,S)-1)$ACT_EFF(RTP,C,S)))); +* Convert FLO_FUNCX factors for reduced flows + OPTION CG_GRP <= RTP_FFCX; + LOOP(RPCG_PTRAN(RP,C,COM,CG,CG2)$CG_GRP(RP,CG,CG2),IF(RPC_FFUNC(RP,C),RP_DCGG(RP,C,CG,CG2,'UP')=YES; ELSE RP_DCGG(RP,COM,CG,CG2,'LO')=YES)); + RP_DCGG(TRACKPC(RP,COM),CG,C,'UP')$(RP_CGC(RP,CG,COM)$RPC_ACT(RP,C)) $= CG_GRP(RP,CG,C); + RTP_FFCX(RTP_CAPYR(R,V,T,P),ACTCG,C)$RPC_FFUNC(R,P,C) $= SUM(RP_DCGG(R,P,C,CG,CG2,L),(POWER(RTP_FFCX(R,V,T,P,CG,CG2)+1,BDSIG(L))-1)$(RTP_FFCX(R,V,T,P,CG,CG2)+1)); + LOOP(RP_DCGG(R,P,C,CG,CG2,L),RTP_FFCX(R,V,T,P,CG,CG2)=0); +* Default to COEF_PTRAN + RP_CGC(R,P,CG,C)$TRACKPC(R,P,C) = NO; + COEF_PTRAN(RTP(R,V,P),CG,C,COM,S)$(RPCS_VAR(R,P,C,S)$RPC_PG(R,P,COM)$RP_CGC(R,P,CG,C)) = ACT_EFF(RTP,CG,S)*PRC_ACTFLO(RTP,COM)*(1+(ACT_EFF(RTP,C,S)-1)$ACT_EFF(RTP,C,S)); + ACT_EFF(R,LL,P,CG,S)$RP_GRP(R,P,CG) = 0; + OPTION RP_GRP < RP_CGC; RPCC_FFUNC(RP_GRP(R,P,CG),COM)$RPC_PG(R,P,COM) = YES; +$ IFI NOT %SENSIS%==YES OPTION CLEAR=RPCG_PTRAN; + OPTION CLEAR=TRACKPC,CLEAR=RP_GRP,CLEAR=CG_GRP,CLEAR=RP_DCGG,CLEAR=RTP_CAPYR,CLEAR=RP_CGC; +*----------------------------------------------------------------------------- +$ BATINCLUDE eqlducs.vda +$ BATINCLUDE eqashar.vda +$ IF DEFINED COM_CSTBAL $BATINCLUDE powerflo.vda CSTBAL + COEF_PVT(R,T)$(NOT COEF_PVT(R,T)) = FPD(T); + VDA_DISC(R,T) $= COEF_PVT(R,T); + COEF_ILED(RTP(R,T,P))$NCAP_BND(RTP,'N') = MOD(COEF_ILED(RTP),1000)+EPS$NCAP_ILED(RTP); diff --git a/coef_nio.mod b/coef_nio.mod new file mode 100644 index 0000000..8e72c8e --- /dev/null +++ b/coef_nio.mod @@ -0,0 +1,72 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COEF_NIO.MOD coefficient calculations for the flow equations I/OCOM on new * +* capacity * +*=============================================================================* +*GaG Questions/Comments: +* - COEF_RPTI calculated in PPMAIN.MOD +*[AL] Corrected bugs in the end of commodity flows in the OCOM case +*----------------------------------------------------------------------------- +* commodity flows tied to new capacity +*V0.5b 980828 re-adjust v,t handling to capture enclosed periods & condition to +* handle period of length 1 + RPC_CAPFLO(R,V,P,C)$(NOT RTP(R,V,P)) = 0; + FIL(V) = YEARVAL(V) GE MIYR_V1; +*V05c 980923 - use the capacity flow control set + LOOP(RPC_CAPFLO(R,FIL(V),P,C)$NCAP_ICOM(R,V,P,C), DFUNC = COEF_RPTI(R,V,P); + MY_F = NCAP_ILED(R,V,P); F = COEF_ILED(R,V,P); CNT = ABS(NCAP_CLED(R,V,P,C)); + Z = B(V)+MAX(1$(CNT$MY_F=0),MY_F); F = Z-MAX(1,MIN(CNT,F)); + IF(DFUNC GT 1, +* repeated investment + COEF_ICOM(R,T(V),T,P,C) = (DFUNC * NCAP_ICOM(R,V,P,C) / FPD(T)) + ELSE + LOOP(T$((E(T) >= F) * (B(T) < Z)), + COEF_ICOM(R,V,T,P,C) = +* some part of consumption in T +*V0.5 980718 - beginning of commodity flow is NCAP_ILED - NCAP_CLED! + MAX(0,((MIN(Z-1,E(T))-MAX(F,B(T)) + 1) / FPD(T))) * NCAP_ICOM(R,V,P,C) / (Z-F) + ); + ); + ); + +* commodity flows tied to decommissioning of capacity +*V05c 980921 - include the PASTInvestments, was looping over MILESTONYR +*V05c 980923 - use the capacity flow control set + LOOP(RPC_CAPFLO(R,V,P,C)$NCAP_OCOM(R,V,P,C), + F = NCAP_ILED(R,V,P); MY_F = NCAP_TLIFE(R,V,P); + Z = MAX(1,NCAP_DLIFE(R,V,P)); DFUNC = COEF_RPTI(R,V,P); + IF(DFUNC GT 1, + FOR(CNT = 1 TO CEIL(DFUNC), + COEF_OCOM(R,V,T,P,C)$(YEARVAL(T) >= YEARVAL(V)) = + COEF_OCOM(R,V,T,P,C) + MIN(1,DFUNC-CNT+1) * + (MAX(0,(MIN(B(V)+F+(CNT*MY_F)+NCAP_DLAG(R,V,P)+Z,E(T)+1) - + MAX(B(V)+F+(CNT*MY_F)+NCAP_DLAG(R,V,P),B(T)) + ) / FPD(T) + ) * (NCAP_OCOM(R,V,P,C) / Z) + ) + ) + ELSE + COEF_OCOM(R,V,T,P,C)$(YEARVAL(T) >= YEARVAL(V)) = +* some part of release in T + MAX(0,(MIN(B(V)+F+MY_F+NCAP_DLAG(R,V,P)+Z,E(T)+1) - + MAX(B(V)+F+MY_F+NCAP_DLAG(R,V,P),B(T)) + ) / FPD(T) + ) * (NCAP_OCOM(R,V,P,C) / Z) + ); + ); + OPTION CLEAR = CNT; +*display coef_icom, coef_ocom; + +* Modification: Convert negative ICOM to OCOM so that NCAP-related outputs can also be modeled +* Modification: Convert negative OCOM to ICOM so that DECOM-related inputs can also be modeled + COEF_OCOM(R,V,T,P,C)$((COEF_ICOM(R,V,T,P,C) LT 0)$COEF_ICOM(R,V,T,P,C)) = COEF_OCOM(R,V,T,P,C)-COEF_ICOM(R,V,T,P,C); + COEF_ICOM(R,V,T,P,C)$((COEF_ICOM(R,V,T,P,C) LT 0)$COEF_ICOM(R,V,T,P,C)) = 0; + COEF_ICOM(R,V,T,P,C)$((COEF_OCOM(R,V,T,P,C) LT 0)$COEF_OCOM(R,V,T,P,C)) = COEF_ICOM(R,V,T,P,C)-COEF_OCOM(R,V,T,P,C); + COEF_OCOM(R,V,T,P,C)$((COEF_OCOM(R,V,T,P,C) LT 0)$COEF_OCOM(R,V,T,P,C)) = 0; + +* Allow using NCAP_CLED as NCAP_CLAG, if no NCAP_ICOM + NCAP_CLAG(RTP,C,IO)$((NOT NCAP_ICOM(RTP,C))$NCAP_COM(RTP,C,IO)) $= NCAP_CLED(RTP,C); + NCAP_CLED(R,V,P,C)$(NOT NCAP_ICOM(R,V,P,C)) = 0; diff --git a/coef_obj.mod b/coef_obj.mod new file mode 100644 index 0000000..3c2da22 --- /dev/null +++ b/coef_obj.mod @@ -0,0 +1,205 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COEF_OBJ.MOD do coefficient calculations for the OBJ +* %1 - mod or v# for the source code to be used +*=============================================================================* +* responsible for moving cost data to EACHYEAR from each input period +*----------------------------------------------------------------------------- +* Declarations + ALIAS(K,EACHYEAR); + SET Y(ALLYEAR); + SET Y_EOH(ALLYEAR); + SET YK(ALLYEAR,ALLYEAR); + SET TS_ANN(S,S); + TS_ANN(S,S) = YES; + TS_ANN(S,ANNUAL) = YES; + SCALARS YR_V1 /0/, YR_VL /0/, ACL /0/; + +* For shaped demand elasticises + ALIAS(AGE,SPAN); + SET SHEDJ(LIM,J) 'Elastic demand shape indexes'; + PARAMETER SHAPED(BD,J,AGE) 'Elastic demand shape curves' //; + +* establish eachyear sets matching documentation + YR_VL = MIYR_VL+DUR_MAX; + LOOP(RTP(R,PASTMILE(LL),P)$NCAP_ILED(R,LL,P), K(LL+NCAP_ILED(R,LL,P)) = YES); + Y(K)$((YEARVAL(K) >= MINYR) * (YEARVAL(K) <= YR_VL)) = YES; + YK(Y,K)$(YEARVAL(K)<=YEARVAL(Y)) = YES; +$IFI '%ANNCOST%'==LEV ACL=MINYR; MINYR=MIYR_V1; RPT_OPT('OBJ','2')=1; +$IFI '%ANNCOST%%CTST%'==LEV MINYR=ACL; + Y_EOH(EOHYEARS)$(YEARVAL(EOHYEARS) >= MINYR) = YES; + + OPTION CLEAR=FIL; + YR_V1 = MIN(SMIN(DATAYEAR,YEARVAL(DATAYEAR)),PYR_V1); + YR_VL = MAX(SMAX(DATAYEAR,YEARVAL(DATAYEAR)),YR_VL); + FIL(LL)$((YEARVAL(LL) GE YR_V1)*(YEARVAL(LL) LE YR_VL)) = YES; + +* interpolate discount rates +$ BATINCLUDE filparam.gms G_DRATE 'R,' CUR ",'','','','',''" ALLYEAR LL FIL(LL)$ FIL(LL)$ + +* set discounting factor OBJ_DISC in 'cumulative' way, covering EACHYEAR +* First, initialize the discount factor for YR_V1 to 1.0: + OBJ_DISC(R,LL,CUR)$(RDCUR(R,CUR)$(YEARVAL(LL)=YR_V1)) = 1; + IF(G_DYEAR=0,G_DYEAR=SUM(MIYR_1(T),YEARVAL(T))); +* Calculate all discount factors with respect to YR_V1: + LOOP(FIL(LL-1), OBJ_DISC(R,LL,CUR) = OBJ_DISC(R,FIL,CUR) / (1+G_DRATE(R,LL,CUR))); +* Find the year among FIL that is closest to the base year G_DYEAR: + F = SUM(MIYR_1(LL),YEARVAL(LL)-MAX(MIN(YR_VL,G_DYEAR),YR_V1)); +* Normalize all discount factors so that the base year discount factor = 1.0: + LOOP(RDCUR(R,CUR), + Z = SUM(MIYR_1(LL+F),OBJ_DISC(R,LL,CUR)*(1+G_DRATE(R,LL,CUR))**(-(G_DYEAR-YEARVAL(LL)))); + OBJ_DISC(R,FIL(LL),CUR) = OBJ_DISC(R,LL,CUR) / Z); +* Prevent divide-by-zero if zero discount rate + G_DRATE(R,V,CUR)$((G_DRATE(R,V,CUR) LE 0)$RDCUR(R,CUR)) = 1E-11; +*----------------------------------------------------------------------------- +* Calculate present value factors for time in periods + LOOP(R$(NOT SUM(G_RCUR(RDCUR(R,CUR)),1)), + Z = SMAX(RDCUR(R,CUR), SUM(T,D(T)*OBJ_DISC(R,T,CUR))); + LOOP(RDCUR(R,CUR)$Z, F=SUM(T,D(T)*OBJ_DISC(R,T,CUR)); + IF(ABS(F-Z) LT 1E-7, G_RCUR(R,CUR) = YES; Z = 0))); + OBJ_PVT(R,T,CUR)$RDCUR(R,CUR) = SUM(PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR)); + COEF_PVT(R,T) = SUM(G_RCUR(R,CUR),OBJ_PVT(R,T,CUR)); + OBJ_RFR(R,V,CUR) $= G_DRATE(R,V,CUR); + OBJ_RFR(R,V,CUR)$RDCUR(R,CUR) $= G_RFRIR(R,V); +*----------------------------------------------------------------------------- +* move original data from input to annual value arrays +* commodity costs + OBJ_COMNT(R,DATAYEAR,C,S,COSTYPE,CUR)$(NOT COM_TS(R,C,S)) = 0; + OBJ_COMPD(R,DATAYEAR,C,S,COSTYPE,CUR)$(NOT COM_TS(R,C,S)) = 0; + +* IRE_PRICE - exports negative +* Take IRE_PRICE into account ONLY if the trade is exogenous; map ALL_R into R: +* Additionally allow using R directly as a placeholder of any external region + LOOP(ALL_R$(NOT REG(ALL_R)),OBJ_IPRIC(R,DATAYEAR,P,C,S,IE,CUR)$RPC_IREIO(R,P,C,IE,'OUT') $= + IRE_PRICE(R,DATAYEAR,P,C,S,ALL_R,IE,CUR)*(1-2$XPT(IE))); + OBJ_IPRIC(R,DATAYEAR,P,C,S,IE,CUR)$RPC_IREIO(R,P,C,IE,'OUT') $= IRE_PRICE(R,DATAYEAR,P,C,S,R,IE,CUR)*(1-2$XPT(IE)); +* flow costs; remove invalid costs on storage flows + FLO_COST(R,LL,P,C,S,CUR)$((NOT TOP(R,P,C,'IN'))$RPC_STG(R,P,C)) = 0; + FLO_DELIV(R,LL,P,C,S,CUR)$((NOT TOP(R,P,C,'OUT'))$RPC_STG(R,P,C)) = 0; + OBJ_FSUB(R,LL,P,C,S,CUR) $= FLO_TAX(R,LL,P,C,S,CUR); + OBJ_FSUB(R,LL,P,C,S,CUR)$FLO_SUB(R,LL,P,C,S,CUR) = OBJ_FSUB(R,LL,P,C,S,CUR)-FLO_SUB(R,LL,P,C,S,CUR); + OBJ_FSUB(R,LL,P,C,S,CUR)$((NOT V(LL))$OBJ_VFLO(R,P,C,CUR,'SUB')) = 0; + OPTION RPC_CUR <= FLO_COST; OBJ_VFLO(RPC_CUR,'COST') = YES; + OPTION RPC_CUR <= FLO_DELIV; OBJ_VFLO(RPC_CUR,'COST') = YES; + OPTION RPC_CUR <= FLO_TAX; OBJ_VFLO(RPC_CUR,'TAX') = YES; + OPTION RPC_CUR <= FLO_SUB; OBJ_VFLO(RPC_CUR,'SUB') = YES; +* remove proportional subsidy if absolute defined + IF(CARD(NCAP_ISPCT),OPTION PRC_YMAXZ-1.5-INF$ACTCG(CG)) = 0; + OPTION RP_GRP <= FLO_FUNCX,PRC_YMIN < RP_GRP,CLEAR=PRC_YMAX; + TRACKP(RP)$PRC_YMIN(RP) $= PRC_VINT(RP)+RP_GRP(RP,'CAPFLO'); + RTP_CAPYR(RTP_CPTYR(R,V,T,P)) $= TRACKP(R,P); + + LOOP(AGEJ(J,AGE)$CARD(TRACKP), + LOOP(V, +* Set the starting and ending years taking into account NCAP_ILED: + PRC_YMIN(TRACKP(R,P)) = B(V)+ROUND(NCAP_ILED(R,V,P)); + PRC_YMAX(TRACKP(R,P)) = PRC_YMIN(R,P)+ROUND(NCAP_TLIFE(R,V,P))-1; +* Calculate average SHAPE for plants still operating in each period: + RTP_FFCX(RTP_CAPYR(R,V,T,P),CG1,CG2)$FLO_FUNCX(R,V,P,CG1,CG2) = + SUM(PERIODYR(T,EOHYEARS)$(YEARVAL(EOHYEARS) LE MAX(B(T),PRC_YMAX(R,P))), + SHAPE(J+(FLO_FUNCX(R,V,P,CG1,CG2)-1),AGE+(MIN(YEARVAL(EOHYEARS),PRC_YMAX(R,P))-PRC_YMIN(R,P)))) + / (MAX(1,MIN(E(T),PRC_YMAX(R,P))-MAX(B(T),PRC_YMIN(R,P))+1)) -1; + ); +* For repeated investments, use the average SHAPE over lifetime: + RVPRL(RTP(R,T,P))$((COEF_RPTI(RTP)>1)$TRACKP(R,P)) = ROUND(NCAP_TLIFE(RTP)-1)+EPS; + RTP_FFCX(RTP_CAPYR(R,TT,T,P),CG1,CG2)$(RVPRL(R,TT,P)$FLO_FUNCX(R,TT,P,CG1,CG2)) = + SUM(OPYEAR(AGE+RVPRL(R,TT,P),LIFE),SHAPE(J+(FLO_FUNCX(R,TT,P,CG1,CG2)-1),LIFE)) / (RVPRL(R,TT,P)+1) -1; + ); +* Shapes for capacity-related commodity flows + COEF_CIO(RTP_CAPYR(R,V,T,P),C,IO)$NCAP_COM(R,V,P,C,IO) $= RTP_FFCX(R,V,T,P,'CAPFLO',C); + COEF_CIO(RTP_CPTYR(R,V,T,P),C,IO)$NCAP_CLAG(R,V,P,C,IO) = SIGN(NCAP_CLAG(R,V,P,C,IO)) * + (MAX(0, E(T)+1-MAX(B(V)+NCAP_ILED(R,V,P)+ABS(NCAP_CLAG(R,V,P,C,IO)),B(T))) / + MAX(.1,E(T)+1-MAX(B(V)+NCAP_ILED(R,V,P),B(T)))-1)-1$(NCAP_CLAG(R,V,P,C,IO)<0); + RTP_FFCX(RTP_CAPYR,'CAPFLO',CG) = 0; +* Option for non-vintaged FLO_FUNC multipliers + RTP_FFCX(RTP_VINTYR(R,V,T,P),CG,CG2)$((FLO_FUNC(R,V,P,CG,CG2,'ANNUAL')>0)$RTP_CGC(R,V,P,CG,CG2))=FLO_FUNC(R,T,P,CG,CG2,'ANNUAL')/FLO_FUNC(R,V,P,CG,CG2,'ANNUAL')-1; + OPTION CLEAR=RTP_CGC,CLEAR=TRACKP,CLEAR=RVPRL,CLEAR=RP_GRP; +*------------------------------------------------------------------------------ +* Shaping of COEF_CPT +*------------------------------------------------------------------------------ +* Remove NCAP_CPX indexes that won't have any effect + Z=CARD(J)/2+1; + NCAP_CPX(RTP)$(ABS(NCAP_CPX(RTP)-Z)>Z-1.5) = 0; + OPTION PRC_YMIN < NCAP_CPX,CLEAR=PRC_YMAX; + + LOOP(AGEJ(J,AGE)$CARD(NCAP_CPX), + TRACKP(RP) $= PRC_YMIN(RP); + LOOP(V, +* Set the starting and ending years taking into account NCAP_ILED: + PRC_YMIN(TRACKP(R,P)) = B(V)+ROUND(NCAP_ILED(R,V,P)); + PRC_YMAX(TRACKP(R,P)) = PRC_YMIN(R,P)+NCAP_TLIFE(R,V,P); +* Calculate weighted average SHAPE for plants still operating in each period: + LOOP(G_RCUR(R,CUR), + COEF_CAP(RTP_CPTYR(R,V,T,P))$NCAP_CPX(R,V,P) = + SUM(PERIODYR(T,Y_EOH)$(YEARVAL(Y_EOH)1)$NCAP_CPX(RTP)) = ROUND(NCAP_TLIFE(RTP)-1)+EPS; + COEF_CAP(RTP_CPTYR(R,V(TT),T,P))$RVPRL(R,V,P) = + SUM(OPYEAR(AGE+RVPRL(R,V,P),LIFE),SHAPE(J+(NCAP_CPX(R,V,P)-1),LIFE)) / (RVPRL(R,V,P)+1); + COEF_CAP(RTP_CPTYR(R,V,T,P))$NCAP_CPX(R,V,P) = (1/MAX(1,COEF_CPT(R,V,T,P)/COEF_CAP(R,V,T,P)))$COEF_CAP(R,V,T,P)-1; + ); + OPTION RTP_CPX <= COEF_CAP; + COEF_CPT(R,V,T,P)$COEF_CAP(R,V,T,P) = COEF_CPT(R,V,T,P)*(COEF_CAP(R,V,T,P)+1); + OPTION CLEAR=PRC_YMIN,CLEAR=PRC_YMAX,CLEAR=TRACKP,CLEAR=COEF_CAP,CLEAR=RVPRL; diff --git a/coefmain.mod b/coefmain.mod new file mode 100644 index 0000000..c171dee --- /dev/null +++ b/coefmain.mod @@ -0,0 +1,29 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COEFMAIN.MOD oversees the bulk of the coefficient calculations +* %1 - mod or v# for the source code to be used +*=============================================================================* +*GaG Questions/Comments: +*----------------------------------------------------------------------------- +$IFI NOT %STAGES%==YES SOW(ALLSOW)=DIAG(ALLSOW,'1'); SW_T(T,ALLSOW)=SOW(ALLSOW); + +* handle the capacity transfer and related equation coefficients +$ BATINCLUDE coef_cpt.%1 %1 + +* derive the coefficients related to NCAP I/O flows for new/released +$ BATINCLUDE coef_nio.%1 + +* derive the coefficients related to process transformation +$ BATINCLUDE coef_ptr.%1 + +* derive the coefficients for the OBJ +$ BATINCLUDE coef_obj.%1 %1 + +* derive the additional/adjusted coefficients needed for alternate objectives +$ BATINCLUDE coef_alt.lin VAR%CTST% + +* derive shaped coefficients for process transformation and capacity transfer +$ BATINCLUDE coef_shp.%1 diff --git a/cost_ann.rpt b/cost_ann.rpt new file mode 100644 index 0000000..552f634 --- /dev/null +++ b/cost_ann.rpt @@ -0,0 +1,208 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* COST_ANN: annual cost calculation +* - Investment Costs, Tax/Subsidies +* - Decommissioning +* - Fixed costs and taxes +* - Variable costs and Taxes/Subsidies +*----------------------------------------------------------------------------- +* %1 - Prefix for parameter names (optional) +* %2 - SOW, (optional) +*=============================================================================* + OBJ_YES(NCAP_YES)=YES; + OPTION CLEAR=COEF_CAP; CNT=1$ROUND(RPT_OPT('OBJ','2')); + COEF_CAP(RTP_CPTYR(R,V,T,P))$(NCAP_YES(R,V,P)$PRC_RCAP(R,P)) = VAR_SCAP.L(R,V,T,P)/RTP_CAPVL(R,V,P); +* Levelized annual investment and fixed costs + IF(CNT, OPTION CLEAR=PAR_OBJCAP; + PAR_OBJCAP(OBJ_ICUR(NCAP_YES(R,V,P),CUR)) = SUM(RTP_CPTYR(R,V,T,P),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR)); + RTP_OBJ(J,R,V,P,CUR)$RTP_OBJ(J,R,V,P,CUR) = (RTP_OBJ(J,R,V,P,CUR)/PAR_OBJCAP(R,V,P,CUR))$PAR_OBJCAP(R,V,P,CUR); + %1CST_INVC(%2RTP_CPTYR(R,V,T,P),SYSINV)$NCAP_YES(R,V,P) = + SUM(RDCUR(R,CUR),RTP_OBJ('1',R,V,P,CUR)*COEF_CPT(R,V,T,P)*ABS(SYSONE(SYSINV)-COEF_CRF(R,V,P,CUR))); + %1CST_INVX(%2RTP_CPTYR(R,V,T,P),SYSINV)$NCAP_YES(R,V,P) = + SUM(RDCUR(R,CUR),RTP_OBJ('2',R,V,P,CUR)*COEF_CPT(R,V,T,P)*ABS(SYSONE(SYSINV)-COEF_CRF(R,V,P,CUR))); + IF(ACL, + PAR_OBJCAP(OBJ_FCUR(NCAP_YES(R,V,P),CUR)) = SUM(RTP_CPTYR(R,V,T,P),COEF_CPT(R,V,T,P)*(1-COEF_CAP(R,V,T,P))*OBJ_PVT(R,T,CUR)); + RTP_NPV(J,R,V,P,CUR)$RTP_NPV(J,R,V,P,CUR) = (RTP_NPV(J,R,V,P,CUR)/PAR_OBJCAP(R,V,P,CUR))$PAR_OBJCAP(R,V,P,CUR); + %1CST_FIXC(%2RTP_CPTYR(R,V,T,P))$NCAP_YES(R,V,P) = SUM(RDCUR(R,CUR),RTP_NPV('1',R,V,P,CUR)*COEF_CPT(R,V,T,P)*(1-COEF_CAP(R,V,T,P))); + %1CST_FIXX(%2RTP_CPTYR(R,V,T,P))$NCAP_YES(R,V,P) = SUM(RDCUR(R,CUR),RTP_NPV('2',R,V,P,CUR)*COEF_CPT(R,V,T,P)*(1-COEF_CAP(R,V,T,P))); + OPTION CLEAR=COEF_CAP); + OPTION CLEAR=NCAP_YES; + ); +*------------------------------------------------------------------------------ +* Cases I - Investment Cost and II - Taxes/Subsidies +*------------------------------------------------------------------------------ +* Calculate Annual undiscounted investment costs CST_INVC +$SET TMP '' SET X1 '' SETLOCAL SIC 1 +$IFI %STAGES%==YES PASTSUM(NCAP_YES(R,T,P)) = SUM(SW_TSW(SOW,T,WW),OBJ_SIC(R,T,P,WW)); +$IFI %STAGES%==YES $SETLOCAL SIC 1+PASTSUM(R,V,P) + +OPTION CLEAR=FIL,COEF_RVPT<=COEF_CPT; IF(NOT CNT,NCAP_YES(R,PYR_S,P)$PRC_RESID(R,'0',P)=NO); + +LOOP(OBJ_ICUR(NCAP_YES(R,V,P),CUR), OPTION CLEAR=YKK; MY_F=%SIC%; + SYSPLIT(SYSINV)=ABS(SYSONE(SYSINV)-COEF_CRF(R,V,P,CUR)); + F = RTP_CAPVL(R,V,P)*OBJ_CRF(R,V,P,CUR)/OBJ_DIVI(R,V,P); + LOOP(OBJ_SUMII(R,V,P,LIFE,K_EOH,JOT), Z=ORD(LIFE); FIL(T)=VNT(V,T)$(M(T) 1 index +*$ if '%whtype%' == 'P' $goto param3 + +scalar colcnt; +IF(CARD(%row%) > 0, +$ set preditem 'table' + put / ' ':9,'%whtype%: Solution Reference ','%1':10," '",%1.ts:40,"'" / @24; + colcnt = 0; + loop(col$(colcnt < 19), + put col.tl:11; + colcnt = colcnt + 1 + ); + loop((REG,%row%)$(DUMP0 + SUM(col,%1.%whtype%(REG,col,%row%))), + put / @4 REG.TL:0,'.',%row%.te(%row%) @24; + colcnt = 0; + loop(col, + if(colcnt = 19, + colcnt = 0 + put / @10 col.tl:4 @20 '+++' @24); + colcnt = colcnt + 1; + if(%1.%whtype%(REG,col,%row%), + put %1.%whtype%(REG,col,%row%):<10 ' ' + else + put ' ':11 ))); + put /; +); + +$offuni +option clear=%row%,clear=col; +$shift goto more +*--------------------------------- +$LABEL OTHER +* handle the time-dependant tables by putting out everything +$if NOT '%whtype%' == 'P' col(%whtype%) = yes; + +loop((REG,%c%,%r%)$%1(REG,%c%,%r%), + col(%c%) = yes; + %row%(%r%) = yes); + +* handle parameters with > 1 index +$ if '%whtype%' == 'P' $goto param3 + +scalar colcnt; +IF(CARD(%row%) > 0, +$ set preditem 'table' + put / ' ':9,'TABLE':6,'%1':10," '",%1.ts:40,"'" / @44; + colcnt = 0; + loop(col$(colcnt < 19), + put col.tl:11; + colcnt = colcnt + 1 + ); + loop((REG,%row%)$(DUMP0 + SUM(col,%1(REG,col,%row%))), + put / @4 REG.TL:0,'.',%row%.te(%row%) @44; + colcnt = 0; + loop(col, + if(colcnt = 19, + colcnt = 0 + put / @10 col.tl:4 @40 '+++' @44); + colcnt = colcnt + 1; + if(%1(REG,col,%row%), + put %1(REG,col,%row%):<10 ' ' + else + put ' ':11 ))); + put /; +); +$goto donetab + +* handle parameters with >2 index +$label param3 + +IF(CARD(%row%) > 0, + put / ' ':9,'PARAMETER'@20,'%1':10," '",%1.ts:40,"'"; + loop((REG,col,%row%)$(DUMP0 + (%1(REG,col,%row%) NE 0)), + put / @15, REG.TL:0,'.'col.tl'.'%row%.te(%row%) @66 %1(REG,col,%row%):<10; ); + put /; +); + +$label donetab +$offuni +option clear=%row%,clear=col; +$shift goto more + +$label scalar +* simple scalar +$if not '%preditem%' == 'scalar' put / ' ':9, 'SCALARS' / +$set preditem 'scalar' +put ' ':15,'%1':10,"/ " %1:10 " /" /; +$shift goto more + +$label param2 +$set preditem 'parameter' +$hidden works for any dimension + +$set rc %r% +set %row%(%rc%); + +$ onuni +LOOP(REG, + %row%(%rc%)$%1(REG,%rc%) = yes; +); +IF(CARD(%row%) > 0, + put / ' ':9,'PARAMETER' , @20,'%1':10,"'",%1.ts:40,"' /"; + loop((REG,%row%)$(DUMP0 + (%1(REG,%row%) NE 0)), + put / @15, REG.TL:0'.'%row%.te(%row%) @44 %1(REG,%row%):<10; ); + put @69 '/' /; + option clear=%row%; + put /; +); +$ offuni +$shift goto more + +$label param1 +$set preditem 'parameter' +$hidden works for any dimension + +$set rc %r% +set %row%(%rc%); + +$ onuni +%row%(%rc%)$%1(%rc%) = yes; +IF(CARD(%row%) > 0, + put / ' ':9,'PARAMETER' , @20,'%1':10,"'",%1.ts:40,"' /"; + loop(%row%$(DUMP0 + (%1(%row%) NE 0)), + put / @15, %row%.te(%row%) @44 %1(%row%):<10; ); + put @69 '/' /; + option clear=%row%; + put /; +); +$offuni +option clear=%row%,clear=col; +$shift goto more + +$label done diff --git a/dumpsolv.mod b/dumpsolv.mod new file mode 100644 index 0000000..8c23925 --- /dev/null +++ b/dumpsolv.mod @@ -0,0 +1,92 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* DUMPSOLV.MOD outputs the actual solution values when vintage index +* Dumps output SET, SCALARS, PARAMETER, TABLE +* +* 1 - type indicator = 'L'evel/'M'arginal +* 2-n - for rest of line = component names +* +* - Note that (declaration) is not output +* - $BATINCLUDE dumpsol.mod ITEM1 ITEM2 ... must fit on one line +* +*=============================================================================* +*GaG Questions/Comments: +*----------------------------------------------------------------------------- +$IF '%1'==M $set vy '(fil)' set disc coef_pvt(reg,fil) +$IF '%1'==L $set vy '' set disc 1 +option clear=fil; + +file.tf = 0; +$offlisting +$set preditem '' + +* hold the first parameter for later checking +$set whtype %1 +*GG* later take 2nd as name of set controlling the TABLE column header to improve xeq +$shift + +$label more + +* only one call executes, so done when no more parameters +$if %1a == a $goto done + +$if declared %1.%whtype% $goto declared +* out error message if passed entity not declared +put / '*** UNKNOWN':20,'NAME':6,'%1':10 /; +$set preditem 'unknown' +$shift goto more + +$label declared + +file.nr=3; +$if dimension 0 %1 $goto done +$if dimension 1 %1 $goto done +$if dimension 2 %1 $goto done +$if dimension 3 %1 $goto done +$if not declared u1 alias(u1,u2,u3,u4,u5,u6,u7,u8,u9,*); +$if dimension 4 %1 $set r 'u1' set row row4a +$if dimension 5 %1 $set r 'u1,u2' set row row5a +$if dimension 6 %1 $set r 'u1,u2,u3' set row row6a +$if dimension 7 %1 $set r 'u1,u2,u3,u4' set row row7a +$if dimension 8 %1 $set r 'u1,u2,u3,u4,u5' set row row8a +$if dimension 9 %1 $set r 'u1,u2,u3,u4,u5,u6' set row row9a +file.tf=3; + +set %row%(%r%); +$onuni + +loop((REG,v,ll,%r%)$%1.%whtype%(REG,v,ll,%r%), + fil(ll) = yes; + %row%(%r%) = yes); + +scalar colcnt; +IF(CARD(%row%) > 0, +$ set preditem 'table' + put / ' ':9,'%whtype%: Solution Reference ','%1':10," '",%1.ts:40,"'" / @34; + colcnt = 0; + loop(fil$(colcnt < 19), + put fil.tl:11; + colcnt = colcnt + 1 + ); + loop((REG,%row%)$(DUMP0 + SUM((v,fil)$%1.%whtype%(REG,v,fil,%row%),1)), + put / @4 REG.TL:0,'.',%row%.te(%row%) @34; + colcnt = 0; + loop(fil, + if(colcnt = 19, + colcnt = 0 + put / @10 fil.tl:4 @30 '+++' @34); + colcnt = colcnt + 1; + z = sum(v%vy%,%1.%whtype%(REG,v,fil,%row%)) + if(z, put (z/%disc%):<10 ' ' + else put ' ':11) + )); + put /; +); + +$offuni +option clear=%row%,clear=fil; +$shift goto more +$label done diff --git a/dynslite.vda b/dynslite.vda new file mode 100644 index 0000000..f5131ed --- /dev/null +++ b/dynslite.vda @@ -0,0 +1,115 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* dynslite.vda - experimental lite implementation for dynamic timeslice trees +*=============================================================================* +$ IF %RTS%==S $EXIT +$ SET TMP $NORTS(R,T,S) + IF(CARD(NORTS), +$ GOTO %1 +*------------------------------ +$ LABEL PRELEV +$ IFI %DUC%==YES Abort "TS_OFF cannot be used with DUC"; +* Remove timeslices turned off +* Bounds+varcosts pre-cleared only + ACT_BND(R,T,P,S,BD)%TMP%=0; + COM_BNDNET(R,T,C,S,BD)%TMP%=0; + COM_BNDPRD(R,T,C,S,BD)%TMP%=0; + FLO_BND(R,T,P,CG,S,BD)%TMP%=0; + FLO_FR(R,T,P,C,S,L)%TMP% = 0; + IRE_BND(R,T,C,S,ALL_R,IE,BD)%TMP%=0; + IRE_XBND(R,T,C,S,IE,BD)%TMP%=0; + STGIN_BND(R,T,P,C,S,BD)%TMP%=0; + STGOUT_BND(R,T,P,C,S,BD)%TMP%=0; + COM_BPRICE(R,T,C,S,CUR)%TMP%=0; +$ LABEL CLEAR +* Vintage-based cleared selectively +$ SETLOCAL RTS $(NORTS(R,V,S)+NORTS(R,T,S)$PASTMILE(V)) + RVP(RTP(R,T,P))$(NOT PRC_VINT(R,P))=YES; + ACT_FLO(RVP(R,T,P),CG,S)%TMP%=0; + FLO_FUNC(RVP(R,T,P),CG,CG2,S)%TMP%=0; + FLO_SUM(RVP(R,T,P),CG,C,CG2,S)%TMP%=0; + NCAP_AF(RVP(R,T,P),S,BD)%TMP%=0; + FLO_SHAR(RVP(R,T,P),C,CG,S,BD)%TMP%=0; + FLO_ASHAR(RVP(R,T,P),C,CG,S,BD)%TMP%=0; + STG_LOSS(RVP(R,T,P),S)%TMP%=0; + IRE_FLO(RVP(R,T,P),C,ALL_R,COM,S)%TMP%=0; + ACT_EFF(RVP(R,T,P),CG,S)%TMP%=0; + OPTION CLEAR=RVP; +* Vintaged ANNUAL + RVP(RTP(R,V,P))$PRC_VINT(R,P)$=PRC_TSL(R,P,'ANNUAL'); + LOOP(MIYR_1(T), + ACT_FLO(RVP(R,V,P),CG,S)$(RPS_S1(R,P,'ANNUAL')%RTS%)=0; + FLO_FUNC(RVP(R,V,P),CG,CG2,S)%RTS%=0; + FLO_SUM(RVP(R,V,P),CG,C,CG2,S)$(RPCS_VAR(R,P,C,'ANNUAL')%RTS%)=0; + NCAP_AF(RVP(R,V,P),S,BD)%RTS%=0; + FLO_SHAR(RVP(R,V,P),C,CG,S,BD)$(RPCS_VAR(R,P,C,'ANNUAL')%RTS%)=0; + FLO_ASHAR(RVP(R,V,P),C,CG,S,BD)$(RPS_S2(R,P,'ANNUAL')%RTS%)=0; + STG_LOSS(RVP(R,V,P),S)%RTS%=0; + IRE_FLO(RVP(R,V,P),C,ALL_R,COM,S)%RTS%=0); + OPTION CLEAR=RVP; +* Milestonyr-based all cleared + COM_IE(R,T,C,S)%TMP%=0; + COM_PKFLX(R,T,C,S)%TMP%=0; + COM_ELAST(R,T,C,S,L)%TMP%=0; + FLO_PKCOI(R,T,P,C,S)%TMP%=0; + STG_SIFT(R,T,P,C,S)%TMP%=0; + IRE_FLOSUM(R,T,P,C,S,IE,COM,IO)%TMP%=0; + UC_ACT(UCN,SIDE,R,T,P,S)%TMP%=0; + UC_FLO(UCN,SIDE,R,T,P,C,S)%TMP%=0; + UC_IRE(UCN,SIDE,R,T,P,C,S,IE)%TMP%=0; + UC_COM(UCN,COM_VAR,SIDE,R,T,C,S,UC_GRPTYPE)%TMP%=0; + UC_RHSRTS(R,UCN,T,S,L)%TMP% = 0; +$ GOTO FINISH +*------------------------------ +$ LABEL REDUCE +* Remove from sets timeslices turned off + RTPS_OFF(RTP(R,T,P),S)$PRC_TS(R,P,S) $= NORTS(R,T,S); + RTPCS_OUT(RTP(R,T,P),C,S)$RPCS_VAR(R,P,C,S) $= NORTS(R,T,S); + RTCS_VARC(R,T,C,S)%TMP% = NO; + RCS_COMBAL(R,T,C,S,BD)%TMP% = NO; + RCS_COMPRD(R,T,C,S,BD)%TMP% = NO; + RHS_COMBAL(R,T,C,S)%TMP% = NO; + RHS_COMPRD(R,T,C,S)%TMP% = NO; + RTX_MARK(R,T,ITEM,C,BD,S)%TMP% = NO; +$ GOTO FINISH +*------------------------------ +$ LABEL POSTLEV +* After all levelized, re-interpolate coping ANNUAL fallback +$ SET RESET 0 + RVP(RTP(R,V,P))$PRC_VINT(R,P)$=PRC_TSL(R,P,'ANNUAL'); + OPTION FIL0' X_RPGGS X_RPGGS + RVP(R,V,P)$(NOT RPS_S1(R,P,'ANNUAL')) = NO; + ACT_EFF(R,LL--ORD(LL),P,CG,ANNUAL)$(ACT_EFF(R,LL,P,CG,ANNUAL)$RVP(R,LL,P))=3; + ACT_FLO(R,LL--ORD(LL),P,CG,ANNUAL)$(ACT_FLO(R,LL,P,CG,ANNUAL)$RVP(R,LL,P))=3; + FLO_SUM(R,LL--ORD(LL),P,CG,C,CG2,ANNUAL)$(FLO_SUM(R,LL,P,CG,C,CG2,ANNUAL)$RVP(R,LL,P))=3; +$ BATINCLUDE fillparm ACT_EFF R 'P,CG,ANNUAL' ",'','',''" V 'RVP(R,V,P)' '>0' X_RPGS X_RPGS +$ BATINCLUDE fillparm ACT_FLO R 'P,CG,ANNUAL' ",'','',''" V 'RVP(R,V,P)' '>0' X_RPGS X_RPGS +$ BATINCLUDE fillparm FLO_SUM R 'P,CG1,C,CG2,ANNUAL' ",''" V 'RVP(R,V,P)' '>0' X_RPGCGS X_RPGCGS + OPTION DATAYEAR1)=YES; RPC_CUR(R,P,%PGPRIM%,CUR)=YES); + RP_UPS(RP,TSL,L)$SUM(PRC_TSL(RP,TSLVL)$(ORD(TSL)>ORD(TSLVL)),1)=NO; + RPS_UPS(RP,S)$SUM(RP_UPS(PRC_TSL(RP,TSL),L),1)=NO; + RPS_UPS(R,P,S) $= SUM(RP_UPS(R,P,TSL,L)$TS_GROUP(R,TSL,S),1); + RP_UPS(R,P,TSL,LNX(L))$RP_UPS(R,P,TSL,'UP') = SUM(RP_UPS(R,P,TSLVL,BD),RLUP(R,TSLVL,TSL)$BD(L)+RLUP(R,TSL,TSLVL)$IPS(L)); + RP_UPS(R,P,TSL,'FX')$(SUM(RP_UPS(PRC_TSL(R,P,TSLVL),L),RLUP(R,TSLVL,TSL))$RP_UPR(R,P,'UP'))=YES; +* Check partial loads + LOOP(UNCD7(R,LL,P,TSL(ANNUAL),R,CUR,L),RP_UPS(R,P,TSL,L)=YES; RP_PL(R,P,'N')=NOT RP_PL(R,P,L)); + ACT_LOSPL(RTP(R,V,P),BDNEQ(BD))$((ACT_LOSPL(RTP,BD)<=0)$RP_PL(R,P,'N'))=MAX(.1+.5$BDUPX(BD),ACT_MINLD(RTP)); +* Levelize ACT_UPS +$ BATINCLUDE pp_lvlfc.mod ACT_UPS P PRC_TS ',BD' ",'','',''" ALL_TS V RTP(R,V,P) 0 '' N + RTP_PL(RTP(R,V,P))$((ACT_LOSPL(RTP,'LO')=ACT_MINLD(RTP))$RP_UPL(R,P,'FX'))$=RP_PL(R,P,'N'); +* Check for cycling limits + RP_UPC(R,P,TSL,'N')$RP_UPR(R,P,'N') $= SUM(RP_UPS(PRC_TSL(R,P,TSLVL),L),RLUP(R,TSLVL,TSL)); + RP_UPC(PRC_TSL(RP,TSL),BDNEQ(BD))$RP_UPS(RP,TSL,'UP') $= RP_UPR(RP,BD)); + OPTION RP_UPR < ACT_CSTRMP; +$SET CAPON (COEF_CPT(R,V,T,P)*(%VARV%_NCAP(R,V,P%SWS%)$T(V)+NCAP_PASTI(R,V,P)%RCAPSUB%))$PRC_VINT(R,P)+%VAR%_CAP(R,T,P%SOW%)$RP_UX(R,P) +$SET MX SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P)*(%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)%RCAPSBM%)) +$SET TMP $(NOT RP_UX(R,P))+%VAR%_CAP(R,T,P%SOW%)$RP_UX(R,P)%UPSCAPS% +*----------------------------------------------------------------------- + + %EQ%_CAPLOAD(RTP_VINTYR(%R_V_T%,P),S,BDNEQ(BD)%SWT%)$AFUPS(R,T,P,S).. + + %VAR%_ACT(R,V,T,P,S%SOW%)*BDSIG(BD) =G= %VAR%_UPS(R,V,T,P,S,'FX'%SOW%)$RTP_PL(R,V,P)$BDLOX(BD) + + +* capacity - vintaged or not + (%CAPON%%UPSCAPS%) * MIN(COEF_AF%1(R,V,T,P,S,'UP')*BDSIG(BD),SUM(TS_ANN(S,TS)$(NOT RTP_PL(R,V,P)),ACT_UPS(R,V,P,TS,'FX'))$BDLOX(BD)) * + PRC_CAPACT(R,P) * G_YRFR(R,S); + +*----------------------------------------------------------------------- + + %EQ%_ACTRAMP(RTP_VINTYR(%R_V_T%,P),RTS(S),BDNEQ(BD)%SWT%)$(SUM(TS_ANN(S,TS)$ACT_UPS(R,V,P,TS,BD),1)$PRC_TS(R,P,S)$RP_UPL(R,P,BD)).. + +* max fraction of capacity + SUM(PRC_TS(R,P,TS(S--RS_STG(R,S))),PRC_CAPACT(R,P)*SUM(TS_ANN(S,SL),ACT_UPS(R,V,P,SL,BD)) * + (%MX%%TMP% + ((%VAR%_UPS(R,V,T,P,S,'N'%SOW%)-%VAR%_UPS(R,V,T,P,TS,'N'%SOW%))$BDLOX(BD))$RPS_UPS(R,P,S)) + + +* dynamic ramp limits + RS_STGPRD(R,S)*2/(G_YRFR(R,S)+G_YRFR(R,TS))/8760 * + (%VAR%_ACT(R,V,T,P,S%SOW%)/G_YRFR(R,S)-%VAR%_ACT(R,V,T,P,TS%SOW%)/G_YRFR(R,TS) + + ((%VAR%_UPS(R,V,T,P,S,'N'%SOW%)-%VAR%_UPS(R,V,T,P,TS,'N'%SOW%))*PRC_CAPACT(R,P)*ACT_MINLD(R,V,P))$RPS_UPS(R,P,S))*BDSIG(BD)) + + =G= 0; + +*----------------------------------------------------------------------- + + %EQ%E_ACTUPS(RTP_VINTYR(%R_V_T%,P),TSL,L(BND_TYPE),RTS(S)%SWT%)$(TS_GROUP(R,TSL,S)$RP_UPS(R,P,TSL,L)).. + +* start-up/shut-down capacity + (SUM(TS(S--RS_STG(R,S)),%VAR%_UPS(R,V,T,P,S,'N'%SOW%)-%VAR%_UPS(R,V,T,P,TS,'N'%SOW%)-SUM(BD,%VAR%_UPS(R,V,T,P,S,BD%SOW%)*BDSIG(BD)))$STOA(S) + + SUM(ANNUAL(S)$RP_PL(R,P,'N'),%VAR%_UPS(R,V,T,P,S,L%SOW%)-SUM(PRC_TS(R,P,TS),%VAR%_UPS(R,V,T,P,TS,'FX'%SOW%))))$(BDSIG(L)<0) + + SUM(BDLOX(BD(L)),%MX%%TMP%-%VAR%_UDP(R,V,T,P,S,'FX'%SOW%)-%VAR%_UPS(R,V,T,P,S,'FX'%SOW%)$RP_UPL(R,P,'FX')) + + =E= 0; + +*----------------------------------------------------------------------- + + %EQ%L_ACTUPS(RTP_VINTYR(%R_V_T%,P),TSL,LNX(L),RTS(S)%SWT%)$(TS_GROUP(R,TSL,S)$RP_UPS(R,P,TSL,L)).. + +* balance at higher level + (%VAR%_UPS(R,V,T,P,S,L%SOW%)-SUM(RS_BELOW1(R,TS,S),%VAR%_UPS(R,V,T,P,TS,'FX'%SOW%)))$IPS(L) + + (%VAR%_UPS(R,V,T,P,S,L%SOW%)-SUM(RS_BELOW1(R,S,TS),%VAR%_UPS(R,V,T,P,TS,'UP'%SOW%)))$BD(L) + + =L= 0; + +*----------------------------------------------------------------------- + + %EQ%L_ACTUPC(RTP_VINTYR(%R_V_T%,P),TSL,L,RTS(S)%SWT%)$(TS_GROUP(R,TSL,S)$RP_UPC(R,P,TSL,L)).. + +* max number of cycles + (SUM(RS_BELOW1(R,S,SL),%VAR%_UPS(R,V,T,P,SL,'UP'%SOW%)) - (%CAPON%%UPSCAPS%)*ACT_TIME(R,T,P,L))$IPS(L) + +* min UP/LO hours + SUM(BD(L),SUM((RS_UP(R,S,JS),RJ_SL(R,JS,SL)), + %VAR%_UPS(R,V,T,P,SL,L%SOW%)$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/2+1/JS_CCL(R,JS),1/JS_CCL(R,JS))0) + +* Limit advance and delay or balancing time window + SUM(LASTLL$LNX(L),SUM(LIM$(IPS(L) XOR BD(LIM)),VAR_SIFT(V,S,LIM)) + + SUM((RS_UP(R,S,JS),RJ_SL(R,JS,TS(SL--RS_STG(R,SL)))), + (%VAR%_ACT(R,V,T,P,SL%SOW%)$IPS(L)-%VAR%_SIN(R,V,T,P,COM,SL%SOW%) - + (VAR_SIFT(V,SL,'UP')-VAR_SIFT(V,TS,'UP'))$BD(L))$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/9+1/JS_CCL(R,JS),1/JS_CCL(R,JS)) ORD(YEAR))$YK(T,LL)), + SUM(INVSPRED(K_EOH,JOT,ALLYEAR,K)$((ORD(ALLYEAR)+ORD(AGE) > ORD(YEAR))$YK(T,ALLYEAR)), + OBJ_ICOST(R,K,P,CUR)) * OBJ_CRF(R,TT,P,CUR) / OBJ_DIVI(R,TT,P)); +* Add decommissioning costs when defined +LOOP(RTP_IAN(R,TT,P,CUR)$OBJ_DCOST(R,TT,P,CUR), + CST_ANNC(R,TT,P,T(YEAR),'INVCOST',CUR)$YK1(TT,T) = + CST_ANNC(R,TT,P,T,'INVCOST',CUR) + OBJ_CRFD(R,TT,P,CUR) / OBJ_DIVIII(R,TT,P) * + SUM(OBJ_SUMIII(R,TT,P,K_EOH,K,LL)$((ORD(LL)+ROUND(NCAP_%DECLIF%(R,TT,P)) > ORD(YEAR))$YK(T,LL)), + OBJ_DCOST(R,K,P,CUR))); +* Calculate annual undiscounted INVTAXSUB coefficients +OPTION CLEAR=TRACKP, CLEAR=RTP_IAN; +LOOP(UC_ATTR(R,UC_N,SIDE,'NCAP',UC_ANNUL(UC_NAME(COSTCAT))),LOOP(T,TRACKP(R,P)$UC_NCAP(UC_N,SIDE,R,T,P)=YES)); +RT_IAN(R,T,T,CUR,'INVTAXSUB')$(REG_CUMCST(R,T,T,'INVTAX',CUR,'UP')+REG_CUMCST(R,T,T,'INVSUB',CUR,'UP')) = YES; +RTP_IAN(OBJ_ICUR(R,T,P,CUR))$(RT_IAN(R,T,T,CUR,'INVTAXSUB')+TRACKP(R,P)) = YES; +LOOP(RTP_IAN(R,TT,P,CUR)$(OBJ_ITAX(R,TT,P,CUR)+OBJ_ISUB(R,TT,P,CUR)), + OPTION CLEAR=YKK; F = OBJ_CRF(R,TT,P,CUR)/OBJ_DIVI(R,TT,P); + LOOP(OBJ_SUMII(R,TT,P,LIFE,K_EOH,JOT), Z=ORD(LIFE); + YKK(YK(T(YEAR),LL),K)$((ORD(YEAR) < ORD(LL)+Z)$INVSPRED(K_EOH,JOT,LL,K)) = YES); + CST_ANNC(R,TT,P,T,'INVTAX',CUR)$YK1(TT,T) = SUM(YKK(T,LL,K), F * OBJ_ITAX(R,K,P,CUR)); + CST_ANNC(R,TT,P,T,'INVSUB',CUR)$YK1(TT,T) = SUM(YKK(T,LL,K),-F * OBJ_ISUB(R,K,P,CUR)); +); +OPTION CLEAR=TRACKP, CLEAR=RTP_IAN; +$IF %STAGES%==YES $SET SWT 'SW_T(TT%SOW%)$' +$IF %SCUM%==1 $SET SWT '' +*----------------------------------------------------------------------------- + %EQ%_BNDCST(R,YEAR,SUPERYR(TT,ALLYEAR),COSTCAT,CUR %SOW%)$(%SWT%REG_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR,'UP')) .. +*----------------------------------------------------------------------------- +$IF %STAGES%==YES $SET SWD '%SOW%' SET SOW '%SWD%' SET SWTD SUM +$IFI NOT %OBJ%==LIN $SET TPULSE (PERIODYR(T,Y_EOH),YK(ALLYEAR,Y_EOH))$YK(Y_EOH,YEAR), +$IFI %OBJ%==LIN $SET TPULSE (TPULSEYR(T,Y_EOH),YK(ALLYEAR,Y_EOH))$YK(Y_EOH,YEAR),TPULSE(T,Y_EOH)* +$IFI %VARCOST%==LIN $SET TPULSE (PERIODYR(T,Y),MILESTONYR(Y_EOH),YK(ALLYEAR,Y))$(YK(Y,YEAR)$TPULSE(Y_EOH,Y)),TPULSE(Y_EOH,Y)* +$IFI %OBJ%%VARCOST%==LINLIN $SET TPULSE (TPULSEYR(T,Y),MILESTONYR(Y_EOH),YK(ALLYEAR,Y))$(YK(Y,YEAR)$TPULSE(Y_EOH,Y)),TPULSE(Y_EOH,Y)*TPULSE(T,Y)* +*------------------------------------------------------------------------------ +* Investment Costs + (SUM((OBJ_SUMII(R,T,P,AGE,K_EOH(LL),JOT),SPAN(AGE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$YK(TT,T), + SUM(INVSPRED(K_EOH,JOT,Y,K)$YK(ALLYEAR,Y), + OBJ_ICOST(R,K,P,CUR) * + MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(Y)+ORD(AGE))-MAX(YEARVAL(YEAR),YEARVAL(Y)))) * + %VART%_NCAP(R,T,P %SWS%) * OBJ_CRF(R,T,P,CUR) / OBJ_DIVI(R,T,P))$(NOT RT_IAN(R,YEAR,ALLYEAR,CUR,'INV')) + + SUM((T,P)$CST_ANNC(R,T,P,TT,'INVCOST',CUR),CST_ANNC(R,T,P,TT,'INVCOST',CUR)*%VART%_NCAP(R,T,P %SWS%))$RT_IAN(R,YEAR,ALLYEAR,CUR,'INV') + )$SAMEAS(COSTCAT,'INV') + + +* Decommissioning Costs + SUM(RTP(R,T,P)$(YK(TT,T)$OBJ_DCOST(R,T,P,CUR)), + SUM(OBJ_SUMIII(R,T,P,K_EOH,K,LL)$YK(ALLYEAR,LL), OBJ_DCOST(R,K,P,CUR) * + MAX(0,MIN(ORD(ALLYEAR)+1,ORD(LL)+ROUND(NCAP_%DECLIF%(R,T,P)))-MAX(ORD(YEAR),ORD(LL)))) * + %VART%_NCAP(R,T,P %SWS%) * OBJ_CRFD(R,T,P,CUR) / OBJ_DIVIII(R,T,P) + )$SAMEAS(COSTCAT,'INV') + + +* Investment Taxes and Subsidies + (SUM(OBJ_SUMII(R,T,P,AGE,K_EOH,JOT)$(YK(TT,T)$OBJ_ITAX(R,T,P,CUR)), + SUM((INVSPRED(K_EOH,JOT,LL,K),SPAN(AGE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), + OBJ_ITAX(R,K,P,CUR) * (MIN(ORD(ALLYEAR)+1,ORD(LL)+ORD(AGE))-MAX(ORD(YEAR),ORD(LL)))) * + %VART%_NCAP(R,T,P %SWS%) * OBJ_CRF(R,T,P,CUR) / OBJ_DIVI(R,T,P))$(NOT RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB')) + + SUM((T,P)$CST_ANNC(R,T,P,TT,'INVTAX',CUR),CST_ANNC(R,T,P,TT,'INVTAX',CUR)*%VART%_NCAP(R,T,P %SWS%))$RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB') + )$SAMEAS(COSTCAT,'INVTAX') + + + (SUM(OBJ_SUMII(R,T,P,AGE,K_EOH,JOT)$(YK(TT,T)$OBJ_ISUB(R,T,P,CUR)), + SUM((INVSPRED(K_EOH,JOT,LL,K),SPAN(AGE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), + OBJ_ISUB(R,K,P,CUR) * (MIN(ORD(ALLYEAR)+1,ORD(LL)+ORD(AGE))-MAX(ORD(YEAR),ORD(LL)))) * + %VART%_NCAP(R,T,P %SWS%) * OBJ_CRF(R,T,P,CUR) / OBJ_DIVI(R,T,P))$(NOT RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB')) - + SUM((T,P)$CST_ANNC(R,T,P,TT,'INVSUB',CUR),CST_ANNC(R,T,P,TT,'INVSUB',CUR)*%VART%_NCAP(R,T,P %SWS%))$RT_IAN(R,YEAR,ALLYEAR,CUR,'INVTAXSUB') + )$SAMEAS(COSTCAT,'INVSUB') + +*------------------------------------------------------------------------------ +* Fixed O&M Cost - shaped or not + SUM((OBJ_SUMIV(LL,R,T,P,JOT,LIFE),SPAN(LIFE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$YK(TT,T), + SUM(INVSTEP(LL,JOT,K,JOT)$YK(ALLYEAR,K), OBJ_FOM(R,K,P,CUR) * + MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(K)+ORD(LIFE))-MAX(YEARVAL(YEAR),YEARVAL(K)))) * + %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) + )$SAMEAS(COSTCAT,'FOM') + +* Fixed O&M Cost - YES shaped + SUM(RTP_SHAPE(R,T,P,'1',J,JJ)$YK(TT,T), + SUM((OBJ_SUMIV(K,R,T,P,JOT,LIFE),INVSTEP(K,JOT,LL,JOT),SPAN(LIFE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), + SUM(OPYEAR(LIFE,AGE)$((ORD(LL)+ORD(AGE) > ORD(YEAR))$(ORD(LL)+ORD(AGE) < ORD(ALLYEAR)+2)), + SHAPE(J,AGE)*MULTI(JJ,LL+(ORD(AGE)-1))-1) * OBJ_FOM(R,LL,P,CUR)) * + %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) + )$SAMEAS(COSTCAT,'FOM') + + +* Fixed O&M Taxes - shaped or not + SUM((OBJ_SUMIV(LL,R,T,P,JOT,LIFE),SPAN(LIFE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$(YK(TT,T)$OBJ_FTX(R,T,P,CUR)), + SUM(INVSTEP(LL,JOT,K,JOT)$YK(ALLYEAR,K), OBJ_FTX(R,K,P,CUR) * + MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(K)+ORD(LIFE))-MAX(YEARVAL(YEAR),YEARVAL(K)))) * + %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) + )$SAMEAS(COSTCAT,'FOMTAX') + +* Fixed O&M Taxes - Shaped + SUM(RTP_SHAPE(R,T,P,'2',J,JJ)$(YK(TT,T)$OBJ_FTX(R,T,P,CUR)), + SUM((OBJ_SUMIV(K,R,T,P,JOT,LIFE),INVSTEP(K,JOT,LL,JOT),SPAN(LIFE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), + SUM(OPYEAR(LIFE,AGE)$((ORD(LL)+ORD(AGE) > ORD(YEAR))$(ORD(LL)+ORD(AGE) < ORD(ALLYEAR)+2)), + SHAPE(J,AGE)*MULTI(JJ,LL+(ORD(AGE)-1))-1) * OBJ_FTX(R,LL,P,CUR)) * + %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) + )$SAMEAS(COSTCAT,'FOMTAX') + + +* Fixed O&M Subsidies - shaped or not + SUM((OBJ_SUMIV(LL,R,T,P,JOT,LIFE),SPAN(LIFE+MIN(ORD(LL)+ORD(JOT)-ORD(YEAR)-1,0)))$(YK(TT,T)$OBJ_FSB(R,T,P,CUR)), + SUM(INVSTEP(LL,JOT,K,JOT)$YK(ALLYEAR,K), OBJ_FSB(R,K,P,CUR) * + MAX(0,MIN(YEARVAL(ALLYEAR)+1,YEARVAL(K)+ORD(LIFE))-MAX(YEARVAL(YEAR),YEARVAL(K)))) * + %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) + )$SAMEAS(COSTCAT,'FOMSUB') + +* Fixed O&M Subsidies - Shaped + SUM(RTP_SHAPE(R,T,P,'3',J,JJ)$(YK(TT,T)$OBJ_FSB(R,T,P,CUR)), + SUM((OBJ_SUMIV(K,R,T,P,JOT,LIFE),INVSTEP(K,JOT,LL,JOT),SPAN(LIFE+MIN(ORD(LL)-ORD(YEAR),0)))$YK(ALLYEAR,LL), + SUM(OPYEAR(LIFE,AGE)$((ORD(LL)+ORD(AGE) > ORD(YEAR))$(ORD(LL)+ORD(AGE) < ORD(ALLYEAR)+2)), + SHAPE(J,AGE)*MULTI(JJ,LL+(ORD(AGE)-1))-1) * OBJ_FSB(R,LL,P,CUR)) * + %VART%_NCAP(R,T,P %SWS%) / OBJ_DIVIV(R,T,P) + )$SAMEAS(COSTCAT,'FOMSUB') + +*------------------------------------------------------------------------------ +$IF %SCUM%==1 $SET VART SUM(SW_TSW(W,T,W),SW_TPROB(T,W)*Z +* Variable commodity taxes and subsidies + SUM(%TPULSE% + (SUM(RHS_COMBAL(R,T,C,S), %VART%_COMNET(R,T,C,S %SWS%) * OBJ_COMNT(R,Y_EOH,C,S,'TAX',CUR)) + + SUM(RHS_COMPRD(R,T,C,S), %VART%_COMPRD(R,T,C,S %SWS%) * OBJ_COMPD(R,Y_EOH,C,S,'TAX',CUR))) + )$SAMEAS(COSTCAT,'COMTAX') - + + SUM(%TPULSE% + (SUM(RHS_COMBAL(R,T,C,S), %VART%_COMNET(R,T,C,S %SWS%) * OBJ_COMNT(R,Y_EOH,C,S,'SUB',CUR)) + + SUM(RHS_COMPRD(R,T,C,S), %VART%_COMPRD(R,T,C,S %SWS%) * OBJ_COMPD(R,Y_EOH,C,S,'SUB',CUR))) + )$SAMEAS(COSTCAT,'COMSUB') + +*------------------------------------------------------------------------------ +* Variable flow taxes and subsidies + SUM(T$(YK(TT,T)*(M(T)+LAGT(T) GT YEARVAL(YEAR))), + SUM(RTPCS_VARF(R,T,P,C,S)$OBJ_VFLO(R,P,C,CUR,'TAX'), + SUM(TS_ANN(S,TS), SUM(%TPULSE% MAX(0,OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * + SUM(RTP_VINTYR(R,V,T,P), + %SWTD%(%SWSW% +$ BATINCLUDE %cal_red% C COM S P T + )$(NOT RP_IRE(R,P)) + + (SUM(RPC_IRE(R,P,C,IE), + %VART%_IRE(R,V,T,P,C,S,IE %SWS%)$(NOT RPC_AIRE(R,P,C))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,C))$(RPC_AIRE(R,P,C)) + ) + + SUM((RPC_IRE(R,P,COM,IE),IO)$(RTPCS_VARF(R,T,P,COM,S)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO)), + IRE_FLOSUM(R,T,P,COM,S,IE,C,IO) * + (%VART%_IRE(R,V,T,P,COM,S,IE %SWS%)$(NOT RPC_AIRE(R,P,COM))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,COM))$(RPC_AIRE(R,P,COM))) + ))$RP_IRE(R,P) + ) + ))$SAMEAS(COSTCAT,'FLOTAX') + + + SUM(T$(YK(TT,T)*(M(T)+LAGT(T) GT YEARVAL(YEAR))), + SUM(RTPCS_VARF(R,T,P,C,S)$OBJ_VFLO(R,P,C,CUR,'SUB'), + SUM(TS_ANN(S,TS), SUM(%TPULSE% MAX(0,-OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * + SUM(RTP_VINTYR(R,V,T,P), + %SWTD%(%SWSW% +$ BATINCLUDE %cal_red% C COM S P T + )$(NOT RP_IRE(R,P)) + + (SUM(RPC_IRE(R,P,C,IE), + %VART%_IRE(R,V,T,P,C,S,IE %SWS%)$(NOT RPC_AIRE(R,P,C))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,C))$(RPC_AIRE(R,P,C)) + ) + + SUM((RPC_IRE(R,P,COM,IE),IO)$(RTPCS_VARF(R,T,P,COM,S)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO)), + IRE_FLOSUM(R,T,P,COM,S,IE,C,IO) * + (%VART%_IRE(R,V,T,P,COM,S,IE %SWS%)$(NOT RPC_AIRE(R,P,COM))+(%VART%_ACT(R,V,T,P,S %SWS%)*PRC_ACTFLO(R,V,P,COM))$(RPC_AIRE(R,P,COM))) + ))$RP_IRE(R,P) + ) + ))$SAMEAS(COSTCAT,'FLOSUB') + +*------------------------------------------------------------------------------ +$ IF %STAGES%==YES $SET SOW %SWD% + SUM(COST_GMAP(COSTCAT,COSTAGG,COSTYPE), %VAR%_CUMCST(R,YEAR,ALLYEAR,COSTAGG,CUR %SOW%)*(1-2*DIAG(COSTYPE,'SUB'))) +*------------------------------------------------------------------------------ + + =E= %VAR%_CUMCST(R,YEAR,ALLYEAR,COSTCAT,CUR %SOW%); + + diff --git a/eqcaflac.vda b/eqcaflac.vda new file mode 100644 index 0000000..87962bf --- /dev/null +++ b/eqcaflac.vda @@ -0,0 +1,60 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQCAFLAC - implements commodity-specific capacity utilization equations +* %1 - equation declaration type +* %2 - bound type for %1 +*=============================================================================* +* Questions/Comments: +* - COEF_CPT/COEF_AF are defined in COEF_CPT.MOD +* - shaping of COEF_AF is possible via NCAP_AFX +*----------------------------------------------------------------------------- + + %EQ%%1_CAFLAC(RTP_VINTYR(%R_V_T%,P),S%SWT%)$(AFS(R,T,P,S,%2)$RPS_CAFLAC(R,P,S,%2)).. + +* Sum over flows in PG + SUM((RPC_PG(R,P,C),COM_TMAP(R,COM_TYPE(CG),C)), + (1/ABS(PRC_ACTFLO(R,V,P,C))) / + (NCAP_AFCS(R,V,P,C,S)+PROD(XPT$NCAP_AFCS(R,V,P,CG,S),NCAP_AFCS(R,V,P,CG,S))$(NOT NCAP_AFCS(R,V,P,C,S))) * + SUM(RPCS_VAR(R,P,C,TS)$RS_FR(R,S,TS),RS_FR(R,S,TS) * (%VAR%_FLO(R,V,T,P,C,TS %SOW%)$RP_STD(R,P) + + (SUM(TOP(RPC_STG(R,P,C),IO)$(NCAP_AFCS(R,V,P,C,S)+NCAP_AFCS(R,V,P,CG,S)), + (%VAR%_SIN(R,V,T,P,C,TS %SOW%)*PROD(RPG_AFCX(R,P,C,IE)$NCAP_AFCS(R,V,P,C,S),(NCAP_AFCS(R,V,P,C,S)/NCAP_AFCS(R,V,P,CG,S))$NCAP_AFCS(R,V,P,CG,S)))$IPS(IO)+ + (%VAR%_SOUT(R,V,T,P,C,TS %SOW%)*STG_EFF(R,V,P)*(1+RTCS_FR(R,T,C,S,TS)))$(NOT IPS(IO))) + + SUM(RPC_IRE(R,P,C,IE),%VAR%_IRE(R,V,T,P,C,TS,IE %SOW%)*PROD(RPG_AFCX(R,P,C,IE)$((NCAP_AFCS(R,V,P,C,S)$NCAP_AFCS(R,V,P,CG,S))**1$RP_AIRE(R,P,IE)), + (NCAP_AFCS(R,V,P,C,S)/NCAP_AFCS(R,V,P,CG,S))$NCAP_AFCS(R,V,P,CG,S))+1$0))$(NOT RP_STD(R,P))))) + + =%1= + +* process capacity - vintaged or not + (SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P) * COEF_AF%4(R,K,T,P,S,%2) * + (%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)$PYR(K)%RCAPSBM%))+COEF_AF%4(R,V,T,P,S,%2)*%UPSCAP0%) * +* timeslice fraction of capacity + PRC_CAPACT(R,P) * G_YRFR(R,S) + ; + +%3 EXIT +*----------------------------------------------------------------------------- + + %EQ%L_CAPFLO(RTP_VINTYR(%R_V_T%,P),CG,SL(STL(%RTS%))%SWT%)$(RS_TSLVL(R,S)$NCAP_AFC(R,V,P,CG,STL)).. + +* Sum over regular flows + SUM(RPC(RP_FLO(R,P),C)$COM_GMAP(R,CG,C), + SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))* +$ BATINCLUDE %cal_red% C COM TS P T + )) + +* storage: for activity multiply by number of storage cycles in a year + SUM(PRC_TS(RP_STG(R,P),TS)$RS_FR(R,TS,S),(%VAR%_ACT(R,V,T,P,TS%SOW%)+VAR_STS(R,V,T,P,TS,%2))*RS_FR(R,TS,S)*EXP(PRC_SC(R,P))/RS_STGPRD(R,TS)*G_YRFR(R,S))$ACTCG(CG) + + SUM(RPC_STG(R,P,C)$COM_GMAP(R,CG,C), + SUM((TOP(R,P,C,IO),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))* + (%VAR%_SIN(R,V,T,P,C,TS%SOW%)$(NOT TOP(R,P,C,'OUT'))$IPS(IO)+%VAR%_SOUT(R,V,T,P,C,TS%SOW%)*STG_EFF(R,V,P)*DIAG(IO,'OUT')))) + + =%1= + +* process capacity - vintaged or not + (SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P) * + (%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)$PYR(K)%RCAPSBM%))+%UPSCAP0%)*NCAP_AFC(R,V,P,CG,STL) * +* timeslice fraction of capacity + PRC_CAPACT(R,P) * G_YRFR(R,S) + ; \ No newline at end of file diff --git a/eqcapact.mod b/eqcapact.mod new file mode 100644 index 0000000..92d3a5f --- /dev/null +++ b/eqcapact.mod @@ -0,0 +1,52 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQCAPACT is the capacity utilization equation +* %1 - equation declaration type +* %2 - bound type for %1 +*=============================================================================* +* Questions/Comments: +* - COEF_CPT is defined in COEF_CPT.MOD +* - COEF_AF established by applying SHAPE in COEF_CPT.MOD +* - Commodity-specific AF handled by EQ(l)_CAFLAC (VDA extension) +*----------------------------------------------------------------------------- +$SETLOCAL PASS '' +$IF DEFINED RPS_CAFLAC $SETLOCAL PASS %PASS%*(NOT RPS_CAFLAC(R,P,S,'%2')) + + SET AFS(R,T,P,S,BD) //; +* COEF_AFs are always at PRC_TS or above, can be directly used for testing: +$IF %1==L LOOP(V,AFS(RTP_VARA(R,T,P),S,BD)$COEF_AF(R,V,T,P,S,BD)=YES); AFS(RTPS_OFF,BD) = NO; + + %EQ%%1_CAPACT(RTP_VINTYR(%R_V_T%,P),S %SWT%)$(AFS(R,T,P,S,'%2') %PASS%) .. + +* normal processes + SUM(PRC_TS(R,P,TS)$TS_MAP(R,S,TS),%VAR%_ACT(R,V,T,P,TS %SOW%))$(NOT RP_STG(R,P)) + + +* storage: parent timeslice fraction of the number of storage cycles in a year + SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),(%VAR%_ACT(R,V,T,P,TS %SOW%)+VAR_STS(R,V,T,P,TS,'%2'))*RS_FR(R,TS,S)*EXP(PRC_SC(R,P))/RS_STGPRD(R,TS))$RP_STG(R,P) + + =%1= + + ( +* process is not vintaged +$IF %VALIDATE% == 'YES' $GOTO CAPIT + (SUM(MODLYEAR$COEF_CPT(R,MODLYEAR,T,P), + COEF_CPT(R,MODLYEAR,T,P) * COEF_AF%3(R,MODLYEAR,T,P,S,'%2') * + (%VARM%_NCAP(R,MODLYEAR,P %SWS%)$T(MODLYEAR) + NCAP_PASTI(R,MODLYEAR,P)$PASTYEAR(MODLYEAR)%RCAPSBM%) + ) * PRC_CAPACT(R,P) +$LABEL CAPIT +$IF %VALIDATE% == 'YES' (COEF_AF(R,T,T,P,S,'%2') * PRC_CAPACT(R,P) * %VAR%_CAP(R,T,P %SOW%) + )$(NOT PRC_VINT(R,P)) + + +* process is vintaged + (COEF_AF%3(R,V,T,P,S,'%2') * COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * + (%VARV%_NCAP(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)%RCAPSUB%))$PRC_VINT(R,P) + ) * + +* UR 10/05/00 +* capacity of storage process fully available in each time slice + POWER(G_YRFR(R,S),1-1$RP_STG(R,P)) + + ; diff --git a/eqcapvac.mod b/eqcapvac.mod new file mode 100644 index 0000000..8d4ccf1 --- /dev/null +++ b/eqcapvac.mod @@ -0,0 +1,30 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQCAPVAC is the capacity utilization equation for vintage-simulated processes +* %1 - equation lim type +* %2 - bound type for %1 +*=============================================================================* +* Questions/Comments: +* - COEF_CSV is defined in COEF_CSV.MOD +*----------------------------------------------------------------------------- + + EQ%1_CAPVAC(RTP_VINTYR(%R_V_T%,P),S%SWX%)$(%SWTX%AFSV(R,T,P,S,'%2')).. + +* Activity level at timeslice S + SUM(PRC_TS(R,P,TS)$TS_MAP(R,S,TS),%VAR%_ACT(R,V,T,P,TS %SOW%))$(NOT RPS_CAFLAC(R,P,S,'%2')) + +* Flow levels when commodity-specific availabilities + SUM((RPC_PG(R,P,C),COM_TMAP(R,COM_TYPE(CG),C)), (1/PRC_ACTFLO(R,V,P,C)) / + (NCAP_AFCS(R,V,P,C,S)+PROD(XPT$NCAP_AFCS(R,V,P,CG,S),NCAP_AFCS(R,V,P,CG,S))$(NOT NCAP_AFCS(R,V,P,C,S))) * + SUM(RPCS_VAR(R,P,C,TS)$TS_MAP(R,S,TS),%VAR%_FLO(R,V,T,P,C,TS %SOW%)$RP_STD(R,P) + + SUM(RPC_IRE(R,P,C,IE),%VAR%_IRE(R,V,T,P,C,TS,IE %SOW%))))$RPS_CAFLAC(R,P,S,'%2') + + =%1= + +* process is vintaged + SUM(MODLYEAR(K)$COEF_CSV(R,K,T,P,V),COEF_CSV(R,K,T,P,V)*COEF_AF(R,K,T,P,S,'%2')*%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P))*PRC_CAPACT(R,P)*G_YRFR(R,S) + ; + + diff --git a/eqchpelc.ier b/eqchpelc.ier new file mode 100644 index 0000000..bb1c037 --- /dev/null +++ b/eqchpelc.ier @@ -0,0 +1,55 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* Equation bounding the electricity production of extraction condensing CHP plant +* by the available condensing resp. backpressure capacity +* %1 - =L= or =E= qualifier +* %2 - UP of FX bound for ECT_AFCON/ECT_AFCHP +*----------------------------------------------------------------------------- + +EQ%1_CHPCON(RTP_VINTYR(R,V,T,P)%SWX%)$(%SWTX%ECT_AFCON(R,T,P,'%2')*SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C),1)$ECT_CHP(R,P)).. + + SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C), +* [UR] model reduction %REDUCE% is set in *.run +$ BATINCLUDE %cal_red% C COM TS P T + ) +- + SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_DHT(R,P,C), ECT_REH(R,T,P)* +* [UR] model reduction %REDUCE% is set in *.run +$ BATINCLUDE %cal_red% C COM TS P T + ) + + =%1= + +* Case I if AFpcg +* process is not vintaged + SUM(RTP_CPTYR(R,MODLYEAR(K),T,P), + ECT_AFCON(R,T,P,'%2') * ECT_INP2CON(R,T,P) * COEF_CPT(R,K,T,P) * PRC_CAPACT(R,P) * (%VARM%_NCAP(R,K,P %SWS%)$T(K) + NCAP_PASTI(R,K,P)) + )$(NOT PRC_VINT(R,P)) + + +* process is vintaged + (ECT_AFCON(R,T,P,'%2') * ECT_INP2CON(R,T,P) * COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * (%VARV%_NCAP(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)) + )$PRC_VINT(R,P) +; + +EQ%1_CHPBPT(RTP_VINTYR(R,V,T,P)%SWX%)$(%SWTX%ECT_AFBPT(R,T,P,'%2')*SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_DHT(R,P,C),1)$ECT_CHP(R,P)).. + + SUM(RTPCS_VARF(R,T,P,C,TS)$ECT_DHT(R,P,C), ECT_REH(R,T,P)* +* [UR] model reduction %REDUCE% is set in *.run +$ BATINCLUDE %cal_red% C COM TS P T + ) + + =%1= + +* Case I if AFpcg +* process is not vintaged + SUM(RTP_CPTYR(R,MODLYEAR(K),T,P), + ECT_AFBPT(R,T,P,'%2') * ECT_INP2ELC(R,T,P) * COEF_CPT(R,K,T,P) * PRC_CAPACT(R,P) * (%VARM%_NCAP(R,K,P %SWS%)$T(K) + NCAP_PASTI(R,K,P)) + )$(NOT PRC_VINT(R,P)) + + +* process is vintaged + (ECT_AFBPT(R,T,P,'%2') * ECT_INP2ELC(R,T,P) * COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * (%VARV%_NCAP(R,V,P %SWS%)$T(V) + NCAP_PASTI(R,V,P)) + )$PRC_VINT(R,P) +; diff --git a/eqcombal.mod b/eqcombal.mod new file mode 100644 index 0000000..1f8f44f --- /dev/null +++ b/eqcombal.mod @@ -0,0 +1,114 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQCOMBAL is the basic commodity balance and the production limit constraint +* %1 - mod or v# for the source code to be used +* %2 - equation declaration type +* %3 - COM_LIM type for %2 +* %4 - BAL/PRD indicator +* %5 - condition for PRD +*=============================================================================* +*GaG Questions/Comments: +* - need more control over VAR_COMX so only generate when really OK (=>either COMX_BND/PRICE/UC required) +* - apply RS_FR/RTCS_FR whenever process has a COM_TS commodity but the variable is not at that level +*----------------------------------------------------------------------------- +*$ONLISTING +* + %EQ%%2_COM%4(%R_T%,C,S %SWT%)$(RCS_COM%4(R,T,C,S,'%3') %5) .. +* +* production +* + ( + ( + +* individual flows +$ BATINCLUDE cal_fflo.%1 OUT O + +*V07_1b blending flows + SUM(BLE_OPR(R,C,OPR), + RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BLE_BAL(R,T,C,OPR) * %VAR%_BLND(R,T,C,OPR %SOW%) + ) + +*V07_1b emissions due to blending operations + SUM(BLE_ENV(R,C,BLE,OPR), RS_FR(R,S,'ANNUAL') * ENV_BL(R,C,BLE,OPR,T) * %VAR%_BLND(R,T,BLE,OPR %SOW%) + ) + + +* inter-regional trade to region +*V0.9 022100 - exports could also produce aux +$ BATINCLUDE cal_ire.%1 IMP OUT IE + +* storage +$ BATINCLUDE cal_stgn.%1 OUT IN '*STG_EFF(R,V,P)' '' "(NOT PRC_NSTTS(R,P,TS))" + +* (+25-May-2005) Add commodity aggregation to production side + SUM(COM$COM_AGG(R,T,COM,C), COM_AGG(R,T,COM,C) * + SUM(RTCS_VARC(R,T,COM,TS)$RS_TREE(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS))* + (%VAR%_COMNET(R,T,COM,TS %SOW%)$RC_AGP(R,COM,'LO') + %VAR%_COMPRD(R,T,COM,TS %SOW%)$RC_AGP(R,COM,'FX')))) + + +* capacity related commodity flows +* fixed commodity associated with installed capacity or retirement +$ BATINCLUDE cal_cap.%1 OUT O + +* apply commodity infastructure efficiency + ) * COM_IE(R,T,C,S) + +* If production is summed into variable, use it directly +$IF '%4' == BAL )$(NOT RHS_COMPRD(R,T,C,S)) + %VAR%_COMPRD(R,T,C,S %SOW%)$(RHS_COMPRD(R,T,C,S) + ) + +* +* consumption +* +* when doing FLO then need NET otherwise only want production component +$IF '%4' == PRD $GOTO ONLY_PRD + +* include the elasticity variables (moved to consumption side) +$IF %TIMESED%==YES + SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),BDSIG(BD)*%VAR%_ELAST(R,T,C,S,J,BD %SOW%)) + + - ( + +* individual flows +$ BATINCLUDE cal_fflo.%1 IN I + +*V07_1a blending flows + SUM(BLE_TP(R,T,BLE)$BLE_OPR(R,BLE,C), + RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * %VAR%_BLND(R,T,BLE,C %SOW%) + ) + + SUM(BLE_OPR(R,BLE,OPR)$(BLE_INP(R,BLE,C) * BLE_TP(R,T,BLE)), + RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BL_INP(R,BLE,C) * %VAR%_BLND(R,T,BLE,OPR %SOW%) + ) + + +* inter-regional trade from region +*V0.9 022100 - imports could also require aux +$ BATINCLUDE cal_ire.%1 EXP IN IE + +* storage +$ BATINCLUDE cal_stgn.%1 IN OUT '' 'STG_EFF(R,V,P)*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" + +* capacity related commodity flows +* fixed commodity associated with installed capacity or investment +$ BATINCLUDE cal_cap.%1 IN I + + ) +$LABEL ONLY_PRD + + =%2= + +$ IF '%4' == BAL $GOTO BALEQ +* production bound/cost/tax/sub/cum + %VAR%_COMPRD(R,T,C,S %SOW%)$RHS_COMPRD(R,T,C,S) +$IF %TIMESED%==YES +(SUM(RCJ(R,COM,J,BD)$MI_DMAS(R,C,COM),(DDF_PREF(R,T,COM)*(MI_AGC(R,T,C,COM,J,BD)-1)+RD_SHAR(R,T,COM,C))*BDSIG(BD)*SUM(RTCS_VARC(R,T,COM,TS),%VAR%_ELAST(R,T,COM,TS,J,BD%SOW%)))-%VAR%_COMPRD(R,T,C,S %SOW%))$(COM_ELAST(R,T,C,S,'N')>0)$RD_AGG(R,C) +$ GOTO DONE + +$LABEL BALEQ +* set the RHS according to the type of equation and/or commodity net bound/cost/tax/sub/cum +$ IF '%4%3' == BALFX %VAR%_COMNET(R,T,C,S %SOW%)$RHS_COMBAL(R,T,C,S) + + +* demand projection +$IFI %STAGES% == YES $SETLOCAL SWS 'PROD(SW_MAP(T,SOW,J,WW)$S_COM_PROJ(R,T,C,J,WW),S_COM_PROJ(R,T,C,J,WW))*' + ((%SWS% COM_PROJ(R,T,C)$(NOT RD_NLP(R,C)) +%VAR%_DEM(R,T,C%SOW%)$RD_NLP(R,C) +SUM(MI_DMAS(RD_AGG(R,COM),C),RD_SHAR(R,T,COM,C)*%VAR%_COMPRD(R,T,COM,'ANNUAL'%SOW%))) * COM_FR%MX%(R,T,C,S))$DEM(R,C) + +$LABEL DONE + ; +*$OFFLISTING diff --git a/eqcpt.mod b/eqcpt.mod new file mode 100644 index 0000000..4f9df4e --- /dev/null +++ b/eqcpt.mod @@ -0,0 +1,28 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQCPT.MOD capacity transfer equation +* - %1 = equation type when VALIDATE +* - %2 = equation name adj (L) when VALIDATE (for DMDs in MARKAL) +* - %3 = control qualifier +* - %4 = RHS constant or VAR_CAP +*=============================================================================* +*GaG Questions/Comments: +* - COEF_CPT established in COEF_CPT.MOD +*----------------------------------------------------------------------------- +*GG*V0.6a_3+ check whether used in UserConstraint +*$onlisting + + %EQ%%2_CPT(RTP(R,T,P) %SWT%)$(%3) .. + +* VAR_CAP(r,t,p %sow%) or CAP_BND(r,t,p,bd): + %4 + + =%1= + + SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)%RCAPSUB%)) + ; +*$offlisting diff --git a/eqcumcom.mod b/eqcumcom.mod new file mode 100644 index 0000000..a959ffd --- /dev/null +++ b/eqcumcom.mod @@ -0,0 +1,34 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQCUMCOM sets the cumulative limit on a commodity +* %1 - equation declaration type +* %2 - NET/PRD indicator +*=============================================================================* +*GaG Questions/Comments: +* - scale both sides!!! +* [AL] Changed to support arbitrary year range +*----------------------------------------------------------------------------- +*$ONLISTING + %EQ%_CUM%2(RC(R,C),ALLYEAR,LL %SOW%)$RC_CUMCOM(R,'%2',ALLYEAR,LL,C).. + +* all commodity flows within period range + SUM(RTC_%2(R,TT(T),C)$ +$IFI NOT %OBJ%==LIN ((E(T) >= YEARVAL(ALLYEAR))$(B(T) <= YEARVAL(LL))), +$IFI %OBJ%==LIN ((M(T)+LAGT(T) > YEARVAL(ALLYEAR))$(M(T)-LEAD(T) < YEARVAL(LL))), + SUM(RTCS_VARC(R,T,C,S), +$IFI NOT %OBJ%==LIN MAX(0,MIN(E(T),YEARVAL(LL))-MAX(B(T),YEARVAL(ALLYEAR))+1) +$IFI %OBJ%==LIN SUM(TPULSEYR(T,YEAR)$((ORD(YEAR) >= ORD(ALLYEAR))$(ORD(YEAR) <= ORD(LL))),TPULSE(T,YEAR)) + * %VARTT%_COM%2(R,T,C,S %SWS%) + ) + ) / %CUCSCAL% + + =%1= + +* bound range working on + %VAR%_CUMCOM(R,C,'%2',ALLYEAR,LL %SOW%) + ; + +$OFFLISTING diff --git a/eqcumflo.mod b/eqcumflo.mod new file mode 100644 index 0000000..2d5a943 --- /dev/null +++ b/eqcumflo.mod @@ -0,0 +1,48 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQCUMFLO sets the cumulative upper limit on a flow or activity +* %1 - equation declaration type +*=============================================================================* +*AL Questions/Comments: +* - scale both sides +* - support arbitrary year range +*----------------------------------------------------------------------------- +*$ONLISTING + %EQ%_CUMFLO(RPC_CUMFLO(RP(R,P),C,ALLYEAR,LL) %SOW%) .. +$SETLOCAL SW1 '' SETLOCAL SW2 "" +$IF %STAGES%%SCUM%==YES $SET SOW ',WW' SET SWT ',SOW' SET SW1 'S_' SET SW2 ",'1',SOW" + +* all commodity/activity flows within period range + SUM(TT(T)$ +$IFI NOT %OBJ%==LIN ((E(T) >= YEARVAL(ALLYEAR))$(B(T) <= YEARVAL(LL))), +$IFI %OBJ%==LIN ((M(T)+LAGT(T) > YEARVAL(ALLYEAR))$(M(T)-LEAD(T) < YEARVAL(LL))), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS)), +$IFI NOT %OBJ%==LIN MAX(0,MIN(E(T),YEARVAL(LL))-MAX(B(T),YEARVAL(ALLYEAR))+1) +$IFI %OBJ%==LIN SUM(TPULSEYR(T,YEAR)$((ORD(YEAR) >= ORD(ALLYEAR))$(ORD(YEAR) <= ORD(LL))),TPULSE(T,YEAR)) + * ( +$IF %STAGES%==YES SUM(%SWSW% ( +$ BATINCLUDE %cal_red% C COM TS P T + $RP_STD(R,P) + + (SUM(RPC_IRE(R,P,C,IE),%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%))$(NOT RPC_AIRE(R,P,C)) + + (%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C))$RP_IRE(R,P) +$IF %STAGES%==YES )) + ))$RPC(R,P,C) + + SUM((RTP_VINTYR(R,V,T,P),RTP_VARA(R,T,P),PRC_TS(R,P,TS)), +$IFI NOT %OBJ%==LIN MAX(0,MIN(E(T),YEARVAL(LL))-MAX(B(T),YEARVAL(ALLYEAR))+1) +$IFI %OBJ%==LIN SUM(TPULSEYR(T,YEAR)$((ORD(YEAR) >= ORD(ALLYEAR))$(ORD(YEAR) <= ORD(LL))),TPULSE(T,YEAR)) + * %VARTT%_ACT(R,V,T,P,TS %SWS%) + )$SAMEAS(%PGPRIM%,C) + + ) / %CUFSCAL% + + =E= + +* bound range working on + %VAR%_CUMFLO(R,P,C,ALLYEAR,LL %SWT%)$(MAPVAL(%SW1%FLO_CUM(R,P,C,ALLYEAR,LL,'UP'%SW2%)) NE 8); + ; + +$OFFLISTING + diff --git a/eqdamage.mod b/eqdamage.mod new file mode 100644 index 0000000..2552a26 --- /dev/null +++ b/eqdamage.mod @@ -0,0 +1,161 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* EQDAMAGE.mod - Extension for Linearized/Non-linear Damages +*----------------------------------------------------------------------------- +* Questions/Comments: +*----------------------------------------------------------------------------- +$ IF %1==E $GOTO LPDAM +$ IF NOT DEFINED DAM_ELAST PARAMETER DAM_ELAST //; + +* Internal sets and parameters + SET JSUBJ(J,J) 'All steps up to J' //; + SET DAM_NUM(R,C,J,BD); + SET DAMOBJ / DAM, DAS, DAM-EXT /; + SET WWDAM /DELTA-ATM/, RTDAM(R,T,C,ALLSOW), SWW(ALLSOW,ALLSOW); + PARAMETER DAM_SIZE(REG,T,COM,LIM) 'Size of emission steps' //; +*----------------------------------------------------------------------------- + OPTION CLEAR=RXX; +$ BATINCLUDE filparam DAM_TQTY 'R,' C ",'0','0','0','0'" DATAYEAR T '' '' '' "YEAR," + DAM_TQTY(R,T,C)$(NOT DAM_TQTY(R,T,C)) $= DAM_BQTY(R,C); + +* Enable damage costs for atmospheric CO2 concentration: +$IF %CLI%==YES RTC(R,T,C(CG(CM_VAR)))$((NOT RC(R,C))$DAM_TQTY(R,T,C)) = YES; + +* Remove EPS costs unless uncertain + DAM_COST(R,T,C,CUR)$((DAM_COST(R,T,C,CUR) EQ 0)$DAM_COST(R,T,C,CUR)) = 0; +$IFI %STAGES%==YES OPTION SWW<=SW_TSW; LOOP(SOW,DAM_COST(R,T,C,CUR)$S_DAM_COST(R,T,C,CUR,'1',SOW) = DAM_COST(R,T,C,CUR)+EPS); + LOOP(RDCUR(R,CUR), RXX(RTC)$DAM_COST(RTC,CUR) = YES); + LOOP(T,TRACKC(R,C)$RXX(R,T,C) = YES); + DAM_TVOC(RXX(R,T,C),BD) $= DAM_VOC(R,C,BD); + + RHS_COMBAL(RTCS_VARC(RXX(R,T,C),S))$(NOT DAM_ELAST(R,C,'N')) = YES; + RCS_COMBAL(RHS_COMBAL(RXX(R,T,C),S),'FX') = YES; + +* If BQTY is zero set VOC to zero to, leading to constant cost + DAM_TQTY(RXX(R,T,C))$(DAM_TQTY(R,T,C) LE 0) = MAX(0,DAM_TVOC(R,T,C,'LO')); + DAM_TVOC(RXX(R,T,C),BD)$(NOT DAM_TQTY(R,T,C)) = 0; + LOOP(T,DAM_ELAST(R,C,BD)$((NOT DAM_TQTY(R,T,C))$RXX(R,T,C)) = 0); + DAM_STEP(TRACKC(R,C),'FX') = 0; Z = 100; + DAM_STEP(TRACKC(R,C),BD)$((NOT DAM_STEP(R,C,BD))$DAM_ELAST(R,C,BD)) = 1; + DAM_STEP(TRACKC(R,C),BD)$DAM_STEP(R,C,BD) = MIN(Z,ABS(ROUND(DAM_STEP(R,C,BD)))); + +* Ensure that elasticities are greater than or equal to 1: + DAM_ELAST(TRACKC(R,C),'LO') = ABS(DAM_ELAST(R,C,'UP')$(NOT DAM_ELAST(R,C,'LO'))+DAM_ELAST(R,C,'LO')); + DAM_ELAST(TRACKC(R,C),'UP') = ABS(DAM_ELAST(R,C,'LO')$(NOT DAM_ELAST(R,C,'UP'))+DAM_ELAST(R,C,'UP')); + +* Adjust VOCs + DAM_TVOC(RXX(R,T,C),BD)$(NOT DAM_TVOC(R,T,C,BD)) $= (DAM_STEP(R,C,BD)+.5)*DAM_VOC(R,C,'N')*DAM_TQTY(R,T,C); + DAM_TVOC(RXX(R,T,C),'LO') = MIN(DAM_TQTY(R,T,C),DAM_TVOC(R,T,C,'LO')+INF$(NOT DAM_TVOC(R,T,C,'LO'))); + DAM_TVOC(RXX(R,T,C),'UP')$(NOT DAM_TVOC(R,T,C,'UP')) = + DAM_TVOC(R,T,C,'LO')*(1+((DAM_STEP(R,C,'UP')+0.5)/(DAM_STEP(R,C,'LO')+0.5)-1)$DAM_STEP(R,C,'LO')); + + LOOP(RXX(R,T,C), F = DAM_STEP(R,C,'LO'); Z = DAM_STEP(R,C,'UP'); + FIRST_VAL = DAM_TVOC(R,T,C,'LO'); LAST_VAL = DAM_TVOC(R,T,C,'UP'); + IF(F, DAM_SIZE(R,T,C,'FX') = 2*(FIRST_VAL-(FIRST_VAL*(4*Z+1)-LAST_VAL)/(1+Z*(4+1/F))); + ELSE DAM_SIZE(R,T,C,'FX') = FIRST_VAL+0.5*LAST_VAL/(Z+0.5)); + ); + DAM_SIZE(RXX(R,T,C),BDNEQ(BD))$DAM_STEP(R,C,BD) = MAX(0,(DAM_TVOC(R,T,C,BD)-0.5*DAM_SIZE(R,T,C,'FX')))/DAM_STEP(R,C,BD); + DAM_SIZE(RXX(R,T,C),'UP')$(NOT DAM_STEP(R,C,'LO')) = MAX(0,DAM_TVOC(R,T,C,'UP')/(DAM_STEP(R,C,'UP')+0.5)); + DAM_SIZE(RXX(R,T,C),'N') = DAM_TQTY(R,T,C)-DAM_TVOC(R,T,C,'LO')+0.5*DAM_SIZE(R,T,C,'LO')$DAM_ELAST(R,C,'N'); + + DAM_COEF(RTCS_VARC(R,T,C,S))$((NOT DAM_COEF(R,T,C,S))$TRACKC(R,C)) = 1; + JSUBJ(JJ,J)$((ORD(J) LE ORD(JJ))$(ORD(JJ)<=100)) = YES; +* Set number of FX steps (any non-zero DAM_STEP(R,C,'N') disables endogenous damage) + DAM_STEP(TRACKC(R,C),'FX')$(DAM_STEP(R,C,'N') EQ 0) = 1+1$SUM(T$(DAM_SIZE(R,T,C,'N') GT 0),YES); + IF(CARD(DAM_COST)=0,SUM_OBJ('OBJDAM',ITEM)=0); + RTDAM(RXX(R,T,C)%SWX%)$(%SWTX%YES+WWDAM(C)) = YES; + +*----------------------------------------------------------------------------- + SET OBV / OBJDAM /; +$IF %DAMAGE%==NO SUM_OBJ('OBJDAM',ITEM)=0; +$IF %VARMAC% $SET VAR %VAS% +$IF %DAMAGE%==NO $GOTO FINISH +*----------------------------------------------------------------------------- +* Emission balance equation + + %EQ%_DAMAGE(RTC(%R_T%,C) %SOW%)$(SUM(RDCUR(R,CUR)$DAM_COST(R,T,C,CUR),1)$RTDAM(RTC%SWX%)).. + + SUM(DAM_NUM(R,C,JJ,BD),SUM(JSUBJ(JJ,J),%VAR%_DAM(R,T,C,BD,J %SOW%))) + + =E= ( +$IF %CLI%==YES SUM(CM_VAR(C),%VART%_CLITOT(CM_VAR,T%SWS%)$CM_KIND(CM_VAR)+%VAR%_CLIBOX(CM_VAR,T%SOW%)$(NOT CM_KIND(CM_VAR)))$(NOT RC(R,C)) + + SUM(COM_TS(RC(R,C),S),DAM_COEF(R,T,C,S)*%VAR%_COMNET(R,T,C,S %SOW%)$(NOT DAM_ELAST(R,C,'N')) + + DAM_COEF(R,T,C,S)*%VAR%_COMPRD(R,T,C,S %SOW%)$DAM_ELAST(R,C,'N')) + )$DAM_STEP(R,C,'FX'); + +$IF %DAMAGE%==NLP $GOTO NLPDAM +*----------------------------------------------------------------------------- +$LABEL LPDAM +* Damage cost equation +%2 %EQ%_OBJDAM(RDCUR(R,CUR)%SOW%).. + SUM(RTC(R,T,C)$(DAM_STEP(R,C,'FX')$DAM_COST(R,T,C,CUR)), +$IFI %STAGES%==YES SUM(SWW(SOW,WW)$(SW_TSW(SOW,T,WW)$(NOT WWDAM(C))+SWW(WW,SOW)$WWDAM(C)), + (SUM((DAM_NUM(R,C,JJ,'LO'),JSUBJ(JJ,J)), + (%VAR%_DAM(R,T,C,'LO',J%SWD%) + DAM_ELAST(R,C,'N')*%VAR%_DAM.UP(R,T,C,'LO',J%SWD%))* + ((DAM_TQTY(R,T,C)-DAM_SIZE(R,T,C,'FX')/2-DAM_SIZE(R,T,C,'LO')*(ORD(JJ)-ORD(J)+.5))**DAM_ELAST(R,C,'LO') / + DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'LO') + DAM_ELAST(R,C,'N')))$DAM_TQTY(R,T,C) + + %VAR%_DAM(R,T,C,'FX','1'%SWD%) * (1 + DAM_ELAST(R,C,'N')) + + SUM((DAM_NUM(R,C,JJ,'UP'),JSUBJ(JJ,J)), + %VAR%_DAM(R,T,C,'UP',J%SWD%) * + ((DAM_TQTY(R,T,C)+DAM_SIZE(R,T,C,'FX')/2+DAM_SIZE(R,T,C,'UP')*(ORD(J)-.5))**DAM_ELAST(R,C,'UP') / + DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'UP') + DAM_ELAST(R,C,'N')))$DAM_TQTY(R,T,C) + ) * OBJ_PVT(R,T,CUR) * +$IFI NOT %STAGES%==YES DAM_COST(R,T,C,CUR) +$IFI %STAGES%==YES S_DAM_COST(R,T,C,CUR,'1',WW)) + ) + +%3 =E= SUM(OBV,SUM_OBJ('OBJDAM',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); + +$GOTO BOUND +*============================================================================= +$LABEL NLPDAM +* Damage cost equation + %EQ%_OBJDAM(RDCUR(R,CUR)%SOW%).. + SUM(RTC(R,T,C)$(DAM_STEP(R,C,'FX')$DAM_COST(R,T,C,CUR)), +$IFI %STAGES%==YES SUM(SWW(SOW,WW)$(SW_TSW(SOW,T,WW)$(NOT WWDAM(C))+SWW(WW,SOW)$WWDAM(C)), + (DAM_TVOC(R,T,C,'N')*(%VAR%_DAM(R,T,C,'FX','2'%SWD%)+DAM_SIZE(R,T,C,'N')*DAM_ELAST(R,C,'N')) + + (((%VAR%_DAM(R,T,C,'LO','1'%SWD%)+DAM_SIZE(R,T,C,'N'))**(DAM_ELAST(R,C,'LO')+1) + +* Subtract full LO costs if DAM_ELAST(N) = -1 (constant term) + DAM_ELAST(R,C,'N')*DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'LO')+1) - + DAM_SIZE(R,T,C,'N')**(DAM_ELAST(R,C,'LO')+1)) / + (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'LO')*(DAM_ELAST(R,C,'LO')+1)))$DAM_STEP(R,C,'LO') + + (((%VAR%_DAM(R,T,C,'UP','1'%SWD%)+DAM_TQTY(R,T,C))**(DAM_ELAST(R,C,'UP')+1) - + DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'UP')+1)) / + (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'UP')*(DAM_ELAST(R,C,'UP')+1))) + +* Shift cost curve by DAM_ELAST(N) if applicable + DAM_ELAST(R,C,'N')*(SUM(BDNEQ(BD),%VAR%_DAM(R,T,C,BD,'1'%SWD%))+DAM_ELAST(R,C,'N')*DAM_TQTY(R,T,C)) + ) * OBJ_PVT(R,T,CUR) * +$IFI NOT %STAGES%==YES DAM_COST(R,T,C,CUR) +$IFI %STAGES%==YES S_DAM_COST(R,T,C,CUR,'1',WW)) + ) + + =E= SUM(OBV,SUM_OBJ('OBJDAM',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); +*----------------------------------------------------------------------------- +$LABEL BOUND +$IF %DAMAGE%==NLP $GOTO BDNLP +* Set bounds for damage variables: + LOOP(SAMEAS(J,'1'),DAM_NUM(TRACKC(R,C),J+(DAM_STEP(R,C,BD)-1),BD) = YES); + %VAR%_DAM.UP(R,T,C,BD,J %SWD%) = INF; + %VAR%_DAM.UP(RTC(R,T,C),'LO',J%SOW%)$((ORD(J) LE DAM_STEP(R,C,'LO'))$RTDAM(RTC%SWX%)) = DAM_SIZE(RTC,'LO'); + %VAR%_DAM.UP(RTC(R,T,C),'LO','1'%SOW%)$(DAM_ELAST(R,C,'N')$RTDAM(RTC%SWX%)) = DAM_SIZE(RTC,'LO')+DAM_TQTY(RTC)-DAM_TVOC(RTC,'LO'); + %VAR%_DAM.UP(RTC(R,T,C),'UP',J%SOW%)$((ORD(J) LT DAM_STEP(R,C,'UP'))$RTDAM(RTC%SWX%)) = DAM_SIZE(RTC,'UP'); + %VAR%_DAM.UP(RTC(R,T,C),'FX','1'%SOW%)$(DAM_TVOC(RTC,'UP')$RTDAM(RTC%SWX%)) = DAM_SIZE(RTC,'FX'); + %VAR%_DAM.UP(RTC(R,T,C),'FX','2'%SOW%)$RTDAM(RTC%SWX%) = DAM_SIZE(RTC,'N')$(NOT DAM_ELAST(R,C,'N')); +$GOTO FINISH +*----------------------------------------------------------------------------- +$LABEL BDNLP +* Set bounds for damage variables: + DAM_STEP(TRACKC,BDNEQ) = 1; + LOOP(SAMEAS(J,'1'),DAM_NUM(TRACKC(R,C),J+(DAM_STEP(R,C,BD)-1),BD) = YES); + %VAR%_DAM.UP(R,T,C,BD,J %SWD%) = INF; + %VAR%_DAM.UP(RTC(R,T,C),'LO','1'%SOW%)$RTDAM(RTC%SWX%) = (DAM_TQTY(RTC)-DAM_SIZE(RTC,'N'))$DAM_STEP(R,C,'LO'); + %VAR%_DAM.UP(RTC(R,T,C),'FX','1'%SOW%)$RTDAM(RTC%SWX%) = EPS; + %VAR%_DAM.UP(RTC(R,T,C),'FX','2'%SOW%)$RTDAM(RTC%SWX%) = DAM_SIZE(RTC,'N'); +*----------------------------------------------------------------------------- +$LABEL FINISH +*----------------------------------------------------------------------------- + OPTION CLEAR=TRACKC,CLEAR=RXX,CLEAR=DAM_TVOC; + DAM_TVOC(R,T,C,'N')$DAM_SIZE(R,T,C,'N') = ((DAM_SIZE(R,T,C,'N')/DAM_TQTY(R,T,C))**DAM_ELAST(R,C,'LO'))$DAM_ELAST(R,C,'N'); \ No newline at end of file diff --git a/eqdeclr.mod b/eqdeclr.mod new file mode 100644 index 0000000..b35bdb0 --- /dev/null +++ b/eqdeclr.mod @@ -0,0 +1,195 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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(UC_N,R %SWD%) 'User-constraints (=E=)' + %EQ%E_UCT(UC_N,T %SWTD%) 'User-constraints (=E=)' + %EQ%E_UCRT(UC_N,R,T %SWTD%) 'User-constraints (=E=)' + %EQ%E_UCTS(UC_N,T,S %SWTD%) 'User-constraints (=E=)' + %EQ%E_UCRS(R,UC_N,T,TSL,S %SWD%) 'User-constraints (=E=)' + %EQ%E_UCRTS(UC_N,R,T,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(UC_N,R,T,S %SWD%) 'User-constraints (=E=)' + %EQ%E_UCRSU(UC_N,R,T %SWD%) 'User-constraints (=E=)' + +$IF %VAR_UC% == YES $GOTO UCDONE + EQG_UC(UC_N) 'User-constraints (=G=)' + EQG_UCR(UC_N,R) 'User-constraints (=G=)' + EQG_UCT(UC_N,T) 'User-constraints (=G=)' + EQG_UCRT(UC_N,R,T) 'User-constraints (=G=)' + EQG_UCTS(UC_N,T,S) 'User-constraints (=G=)' + EQG_UCRS(R,UC_N,T,TSL,S) 'User-constraints (=G=)' + EQG_UCRTS(UC_N,R,T,S) 'User-constraints (=G=)' + EQG_UCSU(UC_N,T) 'User-constraints (=G=)' + EQG_UCSUS(UC_N,T,S) 'User-constraints (=G=)' + EQG_UCRSUS(UC_N,R,T,S) 'User-constraints (=G=)' + EQG_UCRSU(UC_N,R,T) 'User-constraints (=G=)' + + EQL_UC(UC_N) 'User-constraints (=L=)' + EQL_UCR(UC_N,R) 'User-constraints (=L=)' + EQL_UCT(UC_N,T) 'User-constraints (=L=)' + EQL_UCRT(UC_N,R,T) 'User-constraints (=L=)' + EQL_UCTS(UC_N,T,S) 'User-constraints (=L=)' + EQL_UCRS(R,UC_N,T,TSL,S) 'User-constraints (=L=)' + EQL_UCRTS(UC_N,R,T,S) 'User-constraints (=L=)' + EQL_UCSU(UC_N,T) 'User-constraints (=L=)' + EQL_UCSUS(UC_N,T,S) 'User-constraints (=L=)' + EQL_UCRSUS(UC_N,R,T,S) 'User-constraints (=L=)' + EQL_UCRSU(UC_N,R,T) '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' +; diff --git a/eqdeclr.tm b/eqdeclr.tm new file mode 100644 index 0000000..30e17af --- /dev/null +++ b/eqdeclr.tm @@ -0,0 +1,77 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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 * +*=============================================================================* +* EQUATIONS +*----------------------------------------------------------------------------- +* Objective Function & Components +*----------------------------------------------------------------------------- +* Overall OBJ by regional objs (which are built from rest) + EQ_OBJ(R,ALLYEAR) 'Overall Objective Function' + +* Costs of elastic demands + EQ_OBJELS(REG,BD,CUR) + +* Fixed Costs + EQ_ANNFIX(REG,ALLYEAR,CUR) + +* Investment component + EQ_ANNINV(REG,ALLYEAR,CUR) + +* Variable operating costs + EQ_ANNVAR(REG,ALLYEAR,CUR) + +*----------------------------------------------------------------------------- +* MACRO equations +*----------------------------------------------------------------------------- + EQ_UTIL 'Utility function' + EQ_CONSO(R,T) 'Consumption equation' + EQ_DD(R,T,C) 'Demand decoupling equation' + EQ_MCAP(R,T) 'Capital dynamics equation' + EQ_TMC(R,T) 'Terminal condition for investment in last period' + EQ_IVECBND(R,T) 'Bound on the sum of investment and energy costs' + EQ_ESCOST(R,T) 'Energy System costs' + EQ_MPEN(R,T,P) 'Definition of variables for cost penalty function' + EQ_XCAPDB(R,T,P) 'Quadratic approximation of market penetration cost penalty function' + +*----------------------------------------------------------------------------- +* MACRO MLF calibration equations +*----------------------------------------------------------------------------- +* Calibration +* EQ_UTIL 'Utility function' + EQ_PROD_Y(R,T) 'Production unction' + EQ_AKL(R,T) 'Aggregate Kapital Labor' + EQ_LABOR(R,T) 'Labor dummy definition' + EQ_KNCAP(R,T) 'Capital dummy definition' +* EQ_MCAP(R,T) 'Capital dynamics equation' +* EQ_TMC(R,T) 'Terminal condition for investment in last period' +* EQ_IVECBND(R,T) 'Bound on the sum of investment and energy costs' +* EQ_DD(R,T,C) 'Demand decoupling equation' +* EQ_ESCOST(R,T) 'Energy System costs' + EQ_TRDBAL(T) 'Trade balance' + EQ_DNLCES(R,T) 'Demand CES function' +*----------------------------------------------------------------------------- +* Full MLF model formulation +*----------------------------------------------------------------------------- + EQ_UTILP 'Utility function' +* EQ_CONSO(R,T) 'Consumption equation' + EQ_CONDA(R,T) 'Consumption disaggregation' + EQ_LOGBD(R,T) 'Linearized log bound' + EQ_MACSH(R,T,CG,CG) 'Macro shares in aggergate' + EQ_MACAG(R,T,CG) 'Macro aggergations' + EQ_MACES(R,T,CG,CG) 'Macro CES functions' +* EQ_LABOR(R,T) 'Labor dummy definition' +* EQ_KNCAP(R,T) 'Capital dummy definition' +* EQ_MCAP(R,T) 'Capital dynamics equation' +* EQ_TMC(R,T) 'Terminal condition for investment in last period' +* EQ_IVECBND(R,T) 'Bound on the sum of investment and energy costs' +* EQ_DD(R,T,C) 'Demand decoupling equation' + EQ_DEMSH(R,T,C) 'Demand shares in aggergate' + EQ_DEMAG(R,T) 'Demand aggregation' + EQ_DEMCES(R,T,C) 'Demand CES function' + EQ_ENSCST(R,T) 'Energy System costs' +* EQ_TRDBAL(T,TRD) 'Trade balance' diff --git a/eqflobnd.mod b/eqflobnd.mod new file mode 100644 index 0000000..81dfa8d --- /dev/null +++ b/eqflobnd.mod @@ -0,0 +1,45 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQFLOBND limits the flow variable at higher TS-leves +* %1 - equation declaration type +* %2 - bound type for %1 +* %3 - qualifier that bound exists +*=============================================================================* +*UR Questions/Comments: +*----------------------------------------------------------------------------- +*$ONLISTING + + %EQ%%1_FLOBND(RTP_VARA(%R_T%,P),CG,S %SWT%)$( +* Make an equation of the bound if there are flow variables for commodities in CG that are strictly below S, +* ...or the tuple has been otherwise rejected for VAR bound (process is vintaged or IRE, or flow is reduced): + SUM(RTPCS_VARF(R,T,P,C,TS)$(TS_MAP(R,S,TS)*COM_GMAP(R,CG,C)), + RS_BELOW(R,S,TS) OR FLO_BND(R,'%DFLBL%',P,CG,S,'%2') + )$FLO_BND(R,T,P,CG,S,'%2') + ) .. + +* sum over all flows that are either at S or below it + (SUM((COM_GMAP(R,CG,C),RTPCS_VARF(R,T,P,C,TS))$TS_MAP(R,S,TS), +* sum all the existing flows + SUM(RTP_VINTYR(R,V,T,P), +* [UR] model reduction %REDUCE% is set in *.run + ( +$ BATINCLUDE %cal_red% C COM TS P T + )$RP_FLO(R,P) + + +* [AL] add support for IRE + SUM(RPC_IRE(R,P,C,IE),(%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%) +$IF %REDUCE% == 'YES' + $(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) +* apply IRE bound on net flow if group used, otherwise on sum of IMP/EXP + )*(1-2$XPT(IE)$(NOT COM(CG))))$RP_IRE(R,P) + ) + ) + + - FLO_BND(R,T,P,CG,S,'%2'))$%3 + + =%1= 0; + +*$OFFLISTING diff --git a/eqflofr.mod b/eqflofr.mod new file mode 100644 index 0000000..9368b80 --- /dev/null +++ b/eqflofr.mod @@ -0,0 +1,27 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQFLOFR relationship between total flow and the flow in a specific timeslice +* %1 - equation declaration type +* %2 - LIM type of FLO_FR +*=============================================================================* +* Questions/Comments: +* - FLO_FR must be specified on TS-level of the flow or above; value below will be ignored +* - fraction of flows under parent timelice supported by a parent N (or negative) FLO_FR + + + %EQ%%1_FLOFR(RTPC(%R_T%,P,C),S,L(%2)%SWT%)$(SUM(RPCS_VAR(RP_FLO(R,P),C,TS)$TS_MAP(R,S,TS),1)$FLO_FR(R,T,P,C,S,L)).. + + SUM(RTP_VINTYR(R,V,T,P),%VAR%_FLO(R,V,T,P,C,S%SOW%)$IPS(L) + + SUM(RS_BELOW1(R,SL,S),%VAR%_FLO(R,V,T,P,C,SL%SOW%)$FLO_FR(RTPC,SL,'N') + + SUM(RTPCS_VARF(RTPC,TS)$(FLO_FR(RTPC,S,L)>-INF$RS_FR(R,SL,TS)), +$ BATINCLUDE %cal_red% C COM TS P T + )$(NOT FLO_FR(RTPC,SL,'N')))$BD(L)) * ABS(FLO_FR(RTPC,S,L)) + + =%1= + + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(RTPC,TS))$(STOA(TS)$TS_MAP(R,S,TS)), +$ BATINCLUDE %cal_red% C COM TS P T + ); diff --git a/eqflomrk.mod b/eqflomrk.mod new file mode 100644 index 0000000..fb74bd2 --- /dev/null +++ b/eqflomrk.mod @@ -0,0 +1,104 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================================================* +* EQx_FLMRK is a market share constraint for a commodity flow of a process +* %1 - equation declaration type +* %2 - BOUND type for %1 +*==================================================================================================* +* Comments: +*--------------------------------------------------------------------------------------------------- +*$ONLISTING +$IF NOT '%2' == '' $GOTO EQUDEF +*--------------------------------------------------------------------------------------------------- + SET RTX_MARK(R,T,ITEM,C,BD,S) //; + SET RX_MARK(R,YEAR,ITEM,C,BD) //; + SET RMKC(R,ITEM,C) //; + +* Remove superfluous data points + PRC_MARK(R,LL,P,ITEM,C,BDNEQ)$PRC_MARK(R,LL,P,ITEM,C,'FX') = NO; + PRC_MARK(R,LL,P,ITEM,C,BD)$((NOT RTP_VARA(R,LL,P))$(NOT SAMEAS(P,ITEM))$PRC_MARK(R,LL,P,ITEM,C,BD)) = NO; + +* Partitioning + LOOP(T,RX_MARK(R,'0',P,C,BD)$((PRC_MARK(R,T,P,P,C,BD)$RP_STD(R,P) GE 0)$PRC_MARK(R,T,P,P,C,BD)) = YES); + RX_MARK(R,T--ORD(T),P,C,BD) $= PRC_MARK(R,T,P,P,C,BD)$(NOT RX_MARK(R,'0',P,C,BD)); +* Eliminate zero values; For standard processes set flow bound + OPTION CLEAR=UNCD7,CLEAR=YK1; + UNCD7(RTP_VARA(R,T,P),ITEM,C,BD,'')$((PRC_MARK(R,T,P,ITEM,C,BD) EQ 0)$PRC_MARK(R,T,P,ITEM,C,BD)) = YES; + UNCD7(RTP_VARA(R,T,P),PRC,C,BD,'')$(PRC_MARK(R,T,PRC,PRC,C,BD)$RX_MARK(R,'0',PRC,C,BD)) = NO; + LOOP(UNCD7(R,T,P,ITEM,C,BDUPX(BD),'')$RP_STD(R,P),FLO_BND(R,T,P,C,ANNUAL,BD) = EPS); + PRC_MARK(R,T,P,ITEM,C,BD)$UNCD7(R,T,P,ITEM,C,BD,'') = 0; +* Make sure that data for all PRC in group are forward extrapolated + LOOP((RTP_VARA(R,T,P),ITEM,C,BD)$PRC_MARK(R,T,P,ITEM,C,BD),RTX_MARK(R,T,ITEM,C,BD,'ANNUAL') = YES); + YK1(TT,T(TT+1)) = YES; + LOOP(YK1(TT,T),PRC_MARK(RTP_VARA(R,T,P),ITEM,C,BD)$(NOT PRC_MARK(R,T,P,ITEM,C,BD)) $= PRC_MARK(R,TT,P,ITEM,C,BD)); + PRC_MARK(R,T,P,ITEM,C,BD)$(NOT RTX_MARK(R,T,ITEM,C,BD,'ANNUAL')) = 0; + OPTION CLEAR=UNCD7,CLEAR=RXX,CLEAR=YK1; + +* Add ANNUAL level for PRC_MARK group commodities not in TOP + LOOP((R,T,P,ITEM,C,BD)$PRC_MARK(R,T,P,ITEM,C,BD),RMKC(R,ITEM,C) = YES); OPTION TRACKC <= RMKC; + TRACKC(RC) = NO; COM_TSL(TRACKC,'ANNUAL')$(NOT SUM(COM_TSL(TRACKC,TSLVL),1)) = YES; +* Prepare the COMPRD variables for all PRC_MARK parameters: + OPTION CLEAR=TRACKC; LOOP(RMKC(R,ITEM,C),TRACKC(RC(R,COM))$COM_GMAP(R,C,COM) = YES); + RHS_COMPRD(RTCS_VARC(R,T,C,S))$TRACKC(R,C) = YES; + OPTION CLEAR=TRACKC,CLEAR=RXX; +* If ITEM is also P (ala FLO_MARK), or C is not in TOP, use commodity timeslices; else use ANNUAL + LOOP(RX_MARK(R,LL,P,C,BD),RXX(R,P,C)=YES); RXX(RMKC(R,ITEM,C))$(NOT RC(R,C))=YES; + RXX(R,ITEM,C)$COM_TSL(R,C,'ANNUAL') = NO; + UNCD7(RTX_MARK(R,T,ITEM,C,BD,S),'')$RXX(R,ITEM,C) = YES; RTX_MARK(R,T,ITEM,C,BD,S)$UNCD7(R,T,ITEM,C,BD,S,'') = NO; + LOOP((RXX(R,ITEM,C),COM_TSL(R,C,TSLVL)),RTX_MARK(R,T,ITEM,C,BD,S)$(TS_GROUP(R,TSLVL,S)$UNCD7(R,T,ITEM,C,BD,'ANNUAL','')) = YES); + +$EXIT +*=================================================================================================== +$LABEL EQUDEF +$SETLOCAL IRED "" +$IF %REDUCE% == YES $SETLOCAL IRED "$(NOT RPC_AIRE(R,P,C))+%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C)$RPC_AIRE(R,P,C)" +* For IRE/STG: Output flow from process if PRC_MARK >= 0, Input flow if PRC_MARK <= 0 +$SETLOCAL SIGO "(PRC_MARK(R,T,P,ITEM,COM,'%2') GE 0)" SETLOCAL SIGI "(PRC_MARK(R,T,P,ITEM,COM,'%2') LE 0)" +*=================================================================================================== + +%EQ%%1_FLOMRK(%R_T%,ITEM,COM,S %SWT%)$RTX_MARK(R,T,ITEM,COM,'%2',S) .. + +* Sum over all processes with PRC_MARK(COM) (not just capacity-related) + SUM(P$PRC_MARK(R,T,P,ITEM,COM,'%2'), + POWER(PRC_MARK(R,T,P,ITEM,COM,'%2'),1$RX_MARK(R,'0',ITEM,COM,'%2')-1) * + +* Sum over all COMPRD balance variables related to timeslice S + SUM((RHS_COMPRD(R,T,C,SL),RS_TREE(R,S,SL))$COM_GMAP(R,COM,C), + +* Sum over all flow variables related to balance timeslice + (SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,SL,TS), + SUM(RTP_VINTYR(R,V,T,P), +$ BATINCLUDE %cal_red% C COM1 TS P T + ) * +* Balance coarser than variable or balance finer than variable + RS_FR(R,SL,TS)*(1+RTCS_FR(R,T,C,SL,TS)) + )*(1+(COM_IE(R,T,C,SL)-1)$TOP(R,P,C,'OUT')))$RP_STD(R,P) + +* Inter-regional trade contribution + + SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,SL,TS), + SUM(RTP_VINTYR(R,V,T,P), + ((%VAR%_IRE(R,V,T,P,C,TS,'IMP'%SOW%)%IRED%)*(1+IRE_FLOSUM(R,T,P,C,S,'IMP',C,'OUT'))*COM_IE(R,T,C,SL))$(%SIGO%$RPC_IRE(R,P,C,'IMP'))- + ((%VAR%_IRE(R,V,T,P,C,TS,'EXP'%SOW%)%IRED%)*(1+IRE_FLOSUM(R,T,P,C,S,'EXP',C,'IN')))$(%SIGI%$RPC_IRE(R,P,C,'EXP'))) * +* Balance coarser than variable or balance finer than variable + RS_FR(R,SL,TS)*(1+RTCS_FR(R,T,C,SL,TS)))$RP_IRE(R,P) + +* Storage contribution + + SUM(RPCS_VAR(RPC_STG(R,P,C),TS)$RS_FR(R,SL,TS), + SUM(RTP_VINTYR(R,V,T,P), + ((%VAR%_SOUT(R,V,T,P,C,TS %SOW%)*STG_EFF(R,V,P)*COM_IE(R,T,C,SL))$%SIGO%-%VAR%_SIN(R,V,T,P,C,TS %SOW%)$%SIGI%)) * +* Balance coarser than variable or balance finer than variable + RS_FR(R,SL,TS)*(1+RTCS_FR(R,T,C,SL,TS)))$PRC_MAP(R,'STG',P) + + )) + + =%1= + +* Reference is the COMPRD variable + SUM((RHS_COMPRD(R,T,C,SL),RS_TREE(R,S,SL))$COM_GMAP(R,COM,C),%VAR%_COMPRD(R,T,C,SL %SOW%)) * + PROD(RX_MARK(R,LL,P(ITEM),COM,'%2'),PRC_MARK(R,T,P,P,COM,'%2')$LASTLL(LL)) + +; + +*$OFFLISTING diff --git a/eqfloshr.mod b/eqfloshr.mod new file mode 100644 index 0000000..828501e --- /dev/null +++ b/eqfloshr.mod @@ -0,0 +1,42 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQIN/OUTSHR is the market/product share limit constraint +* %1 - equation declaration type +* %2 - FLO_SHAR type for %1 +* %3 - IN/OUT indicator +*=============================================================================* +*GaG Questions/Comments: +* - Needs to be adjusted to handle attribute TS-level diff. the operation level +* - for now FLO_SHAR moved down to S1 level in PP_MAIN (which may be OK) +* - [AL] Changed level of equation to be that of RPCS_VAR; RP_STD control added +*----------------------------------------------------------------------------- + + %EQ%%1_%3SHR(RTP_VINTYR(%R_V_T%,P),C,CG,S %SWT%)$((RP_STD(R,P)*TOP(R,P,C,'%3')*RTPCS_VARF(R,T,P,C,S))$FLO_SHAR(R,V,P,C,CG,S,'%2')).. + +* all flows in the group + FLO_SHAR(R,V,P,C,CG,S,'%2') * +*V0.5a 980729 - RPCS_VAR: com not c +* [AL] Handle reduced/non-reduced groups separately + (SUM((TOP(R,P,COM,'%3'),RTPCS_VARF(R,T,P,COM,TS))$COM_GMAP(R,CG,COM), + %VAR%_FLO(R,V,T,P,COM,TS %SOW%)*RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) + )$(NOT RPG_RED(R,P,CG,'%3')) + + + SUM((TOP(R,P,COM,'%3'),RTPCS_VARF(R,T,P,COM,TS))$COM_GMAP(R,CG,COM), +$ BATINCLUDE %cal_red% COM COM1 TS P T + * +* share-ts coarser than variable or share finer than variable + RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) + )$RPG_RED(R,P,CG,'%3') + )$(FLO_SHAR(R,V,P,C,CG,S,'%2') > 0) + + =%1= + +* commodity working on, summed for all + %VAR%_FLO(R,V,T,P,C,S %SOW%)$(NOT RPG_RED(R,P,CG,'%3')) + + ( +$ BATINCLUDE %cal_red% C COM S P T + )$RPG_RED(R,P,CG,'%3') + ; diff --git a/eqire.mod b/eqire.mod new file mode 100644 index 0000000..84d65d2 --- /dev/null +++ b/eqire.mod @@ -0,0 +1,55 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQIRE ensure that inter-regional imports/exports match up * +*=============================================================================* +* Questions/Comments: +* UR 08/24/01: import flows have to be at PRC_TS(REG,P,S), alternative would be to allow RTPCS_VARF +* to be at a different level using RTCS_TSFR to bring it to the right TSLVL +*----------------------------------------------------------------------------- +*$ONLISTING + + %EQ%_IRE(RTP%RTPX%(REG,%TX%,P),COM,IE,S %SWT%)$(RPCS_VAR(REG,P,COM,S)$RPC_EQIRE(REG,P,COM,IE)) .. + + +* the imports/exports of commodity COM into REG at timeslice S + SUM(RTP_VINTYR(REG,V,T,P)$RTPCS_VARF(REG,T,P,COM,S), + %VAR%_IRE(REG,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(REG,P,COM))+(%VAR%_ACT(REG,V,T,P,S%SOW%)*PRC_ACTFLO(REG,V,P,COM))$RPC_AIRE(REG,P,COM) + ) * (1-2*XPT(IE)) + + +* sum also the imports in other regions in case of market-based equation + SUM(TOP_IRE(REG,COM1,R,C,P)$((NOT SAMEAS(REG,R))$RPC_MARKET(REG,P,COM1,'EXP')), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS),RS_TREE(R,ALL_TS,TS))$IRE_TSCVT(R,ALL_TS,REG,S), + (%VAR%_IRE(R,V,T,P,C,TS,'IMP'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) + * IRE_CCVT(R,C,REG,COM1) * IRE_TSCVT(R,ALL_TS,REG,S) + * RS_FR(R,ALL_TS,TS)*(1+RTCS_FR(R,T,C,ALL_TS,TS)) + ) * IRE_CCVT(REG,COM1,REG,COM) + )$RPC_MARKET(REG,P,COM,'IMP') + + +* sum also the imports in other regions in case of market-based equation: EXP case + SUM(TOP_IRE(REG,COM,R,C,P), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS),RS_TREE(R,ALL_TS,TS))$IRE_TSCVT(R,ALL_TS,REG,S), + (%VAR%_IRE(R,V,T,P,C,TS,'IMP'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) + / IRE_FLO(REG,V,P,COM,R,C,TS) * IRE_TSCVT(R,ALL_TS,REG,S) + * RS_FR(R,ALL_TS,TS)*(1+RTCS_FR(R,T,C,ALL_TS,TS)) + ) * IRE_CCVT(R,C,REG,COM) + )$XPT(IE) + + =E= + +* sum the associated exports + SUM((TOP_IRE(R,C,REG,COM,P),ALL_TS)$IRE_TSCVT(R,ALL_TS,REG,S), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,ALL_TS,TS), + (%VAR%_IRE(R,V,T,P,C,TS,'EXP'%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) +* [AL] IRE_TSCVT converts from ALL_TS to S, and RTCS_TSFR from TS to ALL_TS: + * IRE_FLO(R,V,P,C,REG,COM,S) * IRE_TSCVT(R,ALL_TS,REG,S) + * RS_FR(R,ALL_TS,TS)*(1+RTCS_FR(R,T,C,ALL_TS,TS)) + ) * IRE_CCVT(R,C,REG,COM) + )$IMP(IE) + + ; + +*$OFFLISTING + diff --git a/eqirebnd.mod b/eqirebnd.mod new file mode 100644 index 0000000..a168f78 --- /dev/null +++ b/eqirebnd.mod @@ -0,0 +1,70 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQIREBND limits the activity of inter-regional exchange process +* %1 - equation declaration type +* %2 - bound type for %1 +* %3 - qualifier that bound exists +*=============================================================================* +*GaG Questions/Comments: +* - BND ts restricted to the PRC_TS level or above? +*UR* /12/09/99 commodity names can be different in the two regions +*----------------------------------------------------------------------------- +*$ONLISTING +*V0.5b 980902 - avoid equations if LO=0/UP=INF +*V0.6a 990301 + %EQ%%1_IREBND(R,%TX%,C,S,ALL_REG,IE %SWT%)$((RCS_COMTS(R,C,S) * SUM(RPC_IRE(R,P,C,IE),1) AND %3 + )$IRE_BND(R,T,C,S,ALL_REG,IE,'%2')) .. + + ( +* For imports from internal non-marketplace region, sum the associated exports + SUM(TOP_IRE(REG(ALL_REG),COM,R,C,P)$RPC_EQIRE(R,P,C,'IMP'), + SUM(SL$(RTPCS_VARF(R,T,P,C,SL)*RS_TREE(R,S,SL)), + SUM((RTP_VINTYR(REG,V,T,P),RTPCS_VARF(REG,T,P,COM,TS),RS_TREE(REG,ALL_TS,TS))$IRE_TSCVT(REG,ALL_TS,R,SL), + (%VAR%_IRE(REG,V,T,P,COM,TS,'EXP'%SOW%)$(NOT RPC_AIRE(REG,P,COM))+(%VAR%_ACT(REG,V,T,P,TS%SOW%)*PRC_ACTFLO(REG,V,P,COM))$RPC_AIRE(REG,P,COM)) + * IRE_FLO(REG,V,P,COM,R,C,SL) * IRE_CCVT(REG,COM,R,C) * IRE_TSCVT(REG,ALL_TS,R,SL) + * RS_FR(REG,ALL_TS,TS)*(1+RTCS_FR(REG,T,COM,ALL_TS,TS)) +* bound coarser than variable or bound finer than variable + ) * (1$TS_MAP(R,S,SL) + (G_YRFR(R,S)/G_YRFR(R,SL))$RS_BELOW(R,SL,S)) + ) + ) + + +* For imports from external regions or marketplace, sum the flows directly in region R + SUM(RPC_IRE(R,P,C,IE)$((NOT RPC_EQIRE(R,P,C,'IMP'))*SUM(TOP_IRE(ALL_REG,COM,R,C,P),1)), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_TREE(R,S,TS), + (%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) +* bound coarser than variable or bound finer than variable + * (1$TS_MAP(R,S,TS) + (G_YRFR(R,S)/G_YRFR(R,TS))$RS_BELOW(R,TS,S)) + ) + ) + )$IMP(IE) + + + ( +* For exports from market region to internal region REG, sum the associated imports into REG + SUM((RPC_MARKET(R,P,C,'EXP'),TOP_IRE(R,C,REG(ALL_REG),COM,P)), + SUM((RTP_VINTYR(REG,V,T,P),RTPCS_VARF(REG,T,P,COM,TS),RS_TREE(REG,ALL_TS,TS))$IRE_TSCVT(REG,ALL_TS,R,S), + (%VAR%_IRE(REG,V,T,P,COM,TS,'IMP'%SOW%)$(NOT RPC_AIRE(REG,P,COM))+(%VAR%_ACT(REG,V,T,P,TS%SOW%)*PRC_ACTFLO(REG,V,P,COM))$RPC_AIRE(REG,P,COM)) + * IRE_CCVT(REG,COM,R,C) * IRE_TSCVT(REG,ALL_TS,R,S) + * RS_FR(REG,ALL_TS,TS)*(1+RTCS_FR(REG,T,COM,ALL_TS,TS)) + ) + ) + + +* For all other exports, sum the flows directly in region R +*UR* /12/09/99 commodity names can be different in the two regions + SUM(RPC_IRE(R,P,C,IE)$((NOT RPC_MARKET(R,P,C,'EXP'))*SUM(TOP_IRE(R,C,ALL_REG,COM,P),1)), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_TREE(R,S,TS), + (%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) +* bound coarser than variable or bound finer than variable + * (1$TS_MAP(R,S,TS) + (G_YRFR(R,S)/G_YRFR(R,TS))$RS_BELOW(R,TS,S)) + ) + ) + )$XPT(IE) + + + =%1= + + IRE_BND(R,T,C,S,ALL_REG,IE,'%2') + ; +*$OFFLISTING diff --git a/eqlducs.vda b/eqlducs.vda new file mode 100644 index 0000000..d49970f --- /dev/null +++ b/eqlducs.vda @@ -0,0 +1,175 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQLDUCS - implements linear and discrete unit commitment +* %1 - Section +*=============================================================================* +$IF NOT %OBMAC%==YES $EXIT +$IF %1==EQU $GOTO EQU +* Internal attributes for equation control + PARAMETER DP_NON(R,LL,P,UPT,TSL,BD) 'Bounds on non-operational time between shut-down and next start-up'; +*------------------------------------ +* Assume valid UPTs must have a cost or SD-time; reset simplified UC options + OPTION RP_UPT1; + ACT_CSTUP(RTP(R,V,P),TSL,CUR)$RP_DP(R,P) = 0; + ACT_CSTSD(RTP(R,V,P),UPT,'FX',CUR)$(RDCUR(R,CUR)$RP_DP(R,P)) = ACT_CSTSD(RTP,UPT,'UP',CUR)+ACT_CSTSD(RTP,'HOT','LO',CUR); + ACT_CSTUP(RTP(R,V,P),TSL,CUR)$RP_DPL(R,P,TSL) $=SUM(UPT$ACT_CSTSD(RTP,UPT,'FX',CUR),EPS); + RP_UPT(RP_DP,UPT,'LO')=DIAG('HOT',UPT); LOOP(V,RP_UPT(R,P,UPT,BD('UP'))$ACT_SDTIME(R,V,P,UPT,BD)=YES); +*------------------------------------ +* Max. non-op. time processing + ACT_MAXNON(R,V,P,UPT)$((NOT ACT_MAXNON(R,V,P,UPT))$RP_DP(R,P)) = EPS; + DP_NON(RTP(R,V,P),UPT,TSL,'UP')$((ACT_MAXNON(RTP,UPT)<8760/G_CYCLE(TSL))$RP_DPL(R,P,TSL)) = ACT_MAXNON(RTP,UPT)/8760; + DP_NON(RTP(R,V,P),'WARM',TSL,'LO')$RP_DP(R,P) = DP_NON(RTP,'HOT',TSL,'UP'); + DP_NON(RTP(R,V,P),UPT,TSL,'LO')$RP_DP(R,P) = MAX(DP_NON(RTP,UPT,TSL,'LO'),ACT_TIME(RTP,'LO')/8760); + DP_NON(RTP(R,V,P),UPT,TSL,BDNEQ(BD))$RP_DP(R,P) = DP_NON(RTP,UPT,TSL,BD)+(ACT_SDTIME(RTP,UPT,'UP')+ACT_SDTIME(RTP,'HOT','LO'))/8760; + DP_NON(RTP(R,V,P),UPT,TSL,'UP')$(DP_NON(RTP,UPT,TSL,'UP')$RP_DP(R,P)) = DP_NON(RTP,UPT,TSL,'UP')-DP_NON(RTP,UPT,TSL,'LO'); + DP_NON(RTP,'COLD',TSL,'UP') = 0; +*------------------------------------ +* Partial loss processing + ACT_SDTIME(RTP(R,V,P),UPT,BD)$(NOT RP_UPT(R,P,UPT,BD)) = 0; + DP_PSUD(RTP,UPT,BDNEQ(BD))$((ACT_SDTIME(RTP,UPT,BD)>0)$ACT_SDTIME(RTP,UPT,BD)) = ACT_MINLD(RTP)/ACT_SDTIME(RTP,UPT,BD); + ACT_LOSSD(RTP,UPT,BD)$(ACT_MINLD(RTP)$DP_PSUD(RTP,UPT,BD)<=DP_PSUD(RTP,UPT,BD)) = 0; + OPTION CLEAR=TRACKP,DP_LOSDORD(sl)), + v_u(ups,r,v,t,p,sl,'LO')$(MOD(RS_HR(r,s)-RS_HR(r,sl)-DP_NON(r,v,p,upt,tsl,'LO')+(G_YRFR(r,sl)/4+G_YRFR(r,s))/RS_STGPRD(r,s)+2/JS_CCL(r,js),1/JS_CCL(r,js)) cplex.op2"; +$ if exist xpress.opt execute "cat xpress.opt indic.txt > xpress.op2"; + ); +*----------------------------------------------------------------------------- + + eq_sdind_1(rtp_vintyr(%R_V_T%,p),tsl,ts(s--rs_stg(r,s)),ips,L)$(ts_group(r,tsl,s)$DP_UNS(r,v,t,p,tsl,ips,l)).. + + var_onind(r,v,t,p,ts,l)*EPS + + (var_on(r,v,t,p,ts)-sum(rs_below1(r,sl,s)$prc_ts(r,p,s),var_ups(r,v,t,p,sl,'FX')-CAPUPS) - ((CAPUPS)+var_ups(r,v,t,p,ts,'LO')+var_ups(r,v,t,p,s,'UP')))$L(ips) + + ((var_on(r,v,t,p,ts) - var_gap(r,v,t,p,ts)$(NOT PRC_TSL(r,p,tsl)) - MAX(DP_UNS(r,v,t,p,tsl,ips,l),NCAP_SEMI(r,v,p)$PRC_TSL(r,p,tsl)/2))$ips(L) + + (var_ups(r,v,t,p,ts,'UP') + var_ups(r,v,t,p,ts,'LO') - MAX(DP_UNS(r,v,t,p,tsl,ips,l),NCAP_SEMI(r,v,p)$PRC_TSL(r,p,tsl)/2))$diag('FX',L) + + (%CAPON%-var_on(r,v,t,p,ts) - DP_UNS(r,v,t,p,tsl,ips,l))$diag('LO',L) + + (var_gap(r,v,t,p,ts) - DP_UNS(r,v,t,p,tsl,ips,l))$diag('UP',L))$io(ips) =G= 0; + +*----------------------------------------------------------------------------- + + eq_sdind_0(rtp_vintyr(%R_V_T%,p),tsl,ts(s--rs_stg(r,s)),ips,l)$(ts_group(r,tsl,s)$DP_UNS(r,v,t,p,tsl,ips,l)).. + + (var_on(r,v,t,p,ts)+sum(rs_below1(r,sl,s),var_gap(r,v,t,p,sl)+var_ups(r,v,t,p,ts,'UP'))$prc_ts(r,p,s))$L(ips) + + ((var_on(r,v,t,p,ts) - var_gap(r,v,t,p,ts)$(NOT PRC_TSL(r,p,tsl)) + var_ups(r,v,t,p,ts,'UP'))$ips(L) + + (var_ups(r,v,t,p,ts,'UP') + var_ups(r,v,t,p,ts,'LO'))$diag('FX',L) + + (%CAPON%-var_on(r,v,t,p,ts)+var_ups(r,v,t,p,ts,'LO'))$diag('LO',L) + + (var_gap(r,v,t,p,ts))$diag('UP',L))$io(ips) =L= 0; diff --git a/eqmacro.tm b/eqmacro.tm new file mode 100644 index 0000000..7173875 --- /dev/null +++ b/eqmacro.tm @@ -0,0 +1,137 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* Utility Production Function, the Objective Function * +*=============================================================================* + +EQ_UTIL .. + + SUM((R,T), TM_DFACT(R,T) * TM_PWT(T) * LOG(VAR_C(R,T))) + + =E= + + VAR_UTIL * MAX(1,LOG(TM_SCALE_UTIL*1000))/1000; + ; + + +*=============================================================================* +* Production Constraint +*=============================================================================* + +EQ_CONSO(R,T) .. + + VAR_C(R,T) =L= + + (TM_AKL(R) * (VAR_K(R,T) ** (TM_KPVS(R)*TM_RHO(R))) * TM_L(R,T) ** ((1-TM_KPVS(R)) * TM_RHO(R)) + + + SUM(DEM(R,C), TM_B(R,C) * VAR_D(R,T,C) ** TM_RHO(R))) ** (1 / TM_RHO(R)) - VAR_INV(R,T) - VAR_EC(R,T); + + +*=============================================================================* +* Demand Coupling Equation * +* A demand relation is generated for each demand sector DM and ensures that * +* the end-use energy output from the demand devices which have output to DM * +* is greater than or equal to the end-use demand specified by the user. * +*=============================================================================* + +EQ_DD(R,T,C)$DEM(R,C) .. + + VAR_DEM(R,T,C) + + =E= + + ((1/TM_SCALE_NRG) * (TM_AEEIFAC(R,T,C) * VAR_D(R,T,C) + TM_ADDER(R,T,C) + VAR_SP(R,T,C)))$(COM_PROJ(R,T,C) GT 0) + ; + +*=============================================================================* +* Capital Dynamics Equation * +*=============================================================================* + +EQ_MCAP(R,T+1) .. + + VAR_K(R,T+1) + + =E= + + VAR_K(R,T) * TM_TSRV(R,T) + (D(T+1)*VAR_INV(R,T+1) + TM_TSRV(R,T)*D(T)*VAR_INV(R,T))/2 + ; + +*=============================================================================* +* Terminal Condition for investment in last period * +*=============================================================================* + +EQ_TMC(R,T)$(ORD(T) = CARD(T)) .. + + VAR_K(R,T) * (TM_GROWV(R,T) + TM_DEPR(R))/100 + + =L= + + VAR_INV(R,T) + ; + +*=============================================================================* +* Bound on Sum of Investment and Energy * +*=============================================================================* +EQ_IVECBND(R,T)$(ORD(T) GT 1) .. + + VAR_INV(R,T) + VAR_EC(R,T) + + =L= + + TM_Y0(R) * TM_L(R,T) ** TM_IVETOL(R); + + +*=============================================================================* +* Energy System Costs +*=============================================================================* + +* Calculate annualized undiscounted investment costs + TM_CSTINV(R,V,P)$RTP(R,V,P) + = + SUM(OBJ_ICUR(R,V,P,CUR), COEF_OBINV(R,V,P,CUR)); + + +EQ_ESCOST(R,T) .. + + TM_SCALE_CST * ( + + VAR_OBJCOST(R,T) + + + +* quadratic market penetration curve + (SUM(RTP(R,T,P)$TM_CAPTB(R,P), + 0.5 * TM_QFAC(R) * + TM_CSTINV(R,T,P) * (TM_CAPTB(R,P) / TM_EXPF(R,T) * SUM(XCP(J),VAR_XCAPP(R,T,P,J)*ORD(J)))) + )$(TM_QFAC(R) NE 0)) + +* add initial amortization (from CSA only) + + TM_AMP(R,T) + + =E= + + VAR_EC(R,T); + +*=============================================================================* +* Variable definition for market penetration cost penalty function * +*=============================================================================* +EQ_MPEN(RTP(R,TT(T+1),P))$((TM_QFAC(R) NE 0)$TM_CSTINV(R,TT,P)$TM_CAPTB(R,P)) .. + + VAR_CAP(R,TT,P) + =L= + TM_EXPF(R,T) * VAR_CAP(R,T,P) + VAR_XCAP(R,TT,P); + +*=============================================================================* +* Market Penetration Cost Penalty Function, Quadratic Approximation * +*=============================================================================* + +EQ_XCAPDB(RTP(R,TT(T+1),P))$((TM_QFAC(R) NE 0)$TM_CSTINV(R,TT,P)$TM_CAPTB(R,P)) .. + + VAR_XCAP(R,TT,P) + + =E= + + SUM(XCP(J),VAR_XCAPP(R,TT,P,J)) + ; + diff --git a/eqmain.mod b/eqmain.mod new file mode 100644 index 0000000..1a3c28e --- /dev/null +++ b/eqmain.mod @@ -0,0 +1,254 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQMAIN.MOD declarations & call for actual equations * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +*GaG Questions/Comments: +* - any non-binding (=N=) accounting equations, or do it all with reports? +* - what about scaling (by region)??? +* - declare all equations so that re-start changing models will work +* - if UP then EQl_ is =L=, LO then EQl_ is =G=, FX then EQl_ is =E= +*----------------------------------------------------------------------------- +* Scaling constants +$IF NOT SET CUFSCAL $SETGLOBAL CUFSCAL 10 +$IF NOT SET CUCSCAL $SETGLOBAL CUCSCAL 1000 + +*----------------------------------------------------------------------------- +* EQUATIONS +*----------------------------------------------------------------------------- +$ BATINCLUDE eqdeclr.%1 %1 +$ IFI %VDA%==YES $BATINCLUDE equ_ext.vda DECLR +*----------------------------------------------------------------------------- +* Objective Function +*----------------------------------------------------------------------------- +* Main OBJ + PARAMETER SUM_OBJ(ITEM,ITEM) 'Objective component summation'; + +$IFI '%SPINES%'==YES $BATINCLUDE recurrin.stc SPINES +$IF '%STAGES%'==YES $%WITSPINE% %SW_STVARS% + +$IFI NOT %OBJ%==LIN $SETLOCAL OBJ %1 +$IFI NOT %MACRO%==YES $BATINCLUDE eqobj.%1 %1 +$IFI %MACRO% ==YES $BATINCLUDE eqobj.tm %1 +* +$IFI '%SPINES%'==YES $%EWISPINE% +*----------------------------------------------------------------------------- +* Relationship between process activity & individual primary commodity flows +*----------------------------------------------------------------------------- +$ BATINCLUDE eqactflo.%1 + +*----------------------------------------------------------------------------- +* Bound of vintage process activity or TS-level above PRC_TS +*----------------------------------------------------------------------------- +*V0.5b 980902 - avoid equations if LO=0/UP=INF +$ BATINCLUDE eqactbnd.%1 G LO "(ACT_BND(R,T,P,S,'LO') NE 0)" +$ BATINCLUDE eqactbnd.%1 E FX YES +$ BATINCLUDE eqactbnd.%1 L UP "(ACT_BND(R,T,P,S,'UP') NE INF)" + +*----------------------------------------------------------------------------- +* Bound on commodity Net/Production activity above COM_TS +*----------------------------------------------------------------------------- +$ BATINCLUDE eqbndcom.%1 G LO "(COM_BNDNET(R,T,C,S,'LO') NE 0)" NET +$ BATINCLUDE eqbndcom.%1 E FX YES NET +$ BATINCLUDE eqbndcom.%1 L UP "(COM_BNDNET(R,T,C,S,'UP') NE INF)" NET +$ BATINCLUDE eqbndcom.%1 G LO "(COM_BNDPRD(R,T,C,S,'LO') NE 0)" PRD +$ BATINCLUDE eqbndcom.%1 E FX YES PRD +$ BATINCLUDE eqbndcom.%1 L UP "(COM_BNDPRD(R,T,C,S,'UP') NE INF)" PRD + +*----------------------------------------------------------------------------- +* Utilization equation ensure activity <= or = capacity +*----------------------------------------------------------------------------- +$ BATINCLUDE eqcapact.%1 E FX %MX% +$ BATINCLUDE eqcapact.%1 L UP %MX% +$ BATINCLUDE eqcapact.%1 G LO +$IF DEFINED PRC_SIMV $INCLUDE coef_csv.mod + +*----------------------------------------------------------------------------- +* Capacity transfer constraint +*----------------------------------------------------------------------------- +$IFI '%SPINES%'==YES $%WITSPINE% +$IF '%VALIDATE%'==YES $GOTO M2T +$IFI %ETL% == YES RTP_VARP(RTP(R,T,P))$TEG(P) = YES; +$IFI %MACRO%==YES RTP_VARP(RTP(R,T,P))$((TM_QFAC(R) NE 0)$TM_CAPTB(R,P)) = YES; +$ BATINCLUDE eqcpt.%1 E E "RTP_VARP(R,T,P) OR YES$CAP_BND(R,T,P,'FX')" "%VAR%_CAP(R,T,P %SOW%)" +$ BATINCLUDE eqcpt.%1 L L "((NOT RTP_VARP(R,T,P))$CAP_BND(R,T,P,'LO'))" "CAP_BND(R,T,P,'LO')" +$ BATINCLUDE eqcpt.%1 G G "((NOT RTP_VARP(R,T,P))$CAP_BND(R,T,P,'UP'))" "CAP_BND(R,T,P,'UP')" +$GOTO NOM2T +$LABEL M2T +$ BATINCLUDE eqcpt.%1 E E "NOT PRC_MAP(R,'DMD',P)" "%VAR%_CAP(R,T,P %SOW%)" +$ BATINCLUDE eqcpt.%1 L L "PRC_MAP(R,'DMD',P)" "%VAR%_CAP(R,T,P %SOW%)" +$ BATINCLUDE eqcpt.%1 G G NO 0 +$LABEL NOM2T + +*----------------------------------------------------------------------------- +* Cumulative Net/Production Commodity Limit +*----------------------------------------------------------------------------- +$ BATINCLUDE eqcumcom.%1 E NET +$ BATINCLUDE eqcumcom.%1 E PRD +* Cumulative process flow / activity +$ BATINCLUDE eqcumflo.%1 E +$IFI '%SPINES%'==YES $%EWISPINE% + +*----------------------------------------------------------------------------- +* Basic commodity balance equations (by type) ensuring that production >=/= consumption +*----------------------------------------------------------------------------- +$ BATINCLUDE eqcombal.%1 %1 G LO BAL +$ BATINCLUDE eqcombal.%1 %1 E FX BAL +* non-binding equation for FRERENEW/CONSRV commodities +*$ BATINCLUDE eqcombal.%1 %1 L UP BAL + +*----------------------------------------------------------------------------- +* Limiting equation when total production is to be constrained +*----------------------------------------------------------------------------- +$ BATINCLUDE eqcombal.%1 %1 E FX PRD "* RHS_COMPRD(R,T,C,S)" + +*----------------------------------------------------------------------------- +* Bound on the flow variable +*----------------------------------------------------------------------------- +$ BATINCLUDE eqflobnd.%1 G LO YES +$ BATINCLUDE eqflobnd.%1 E FX YES +$ BATINCLUDE eqflobnd.%1 L UP "(FLO_BND(R,T,P,CG,S,'UP') NE INF)" + +*----------------------------------------------------------------------------- +* Fraction of a flow within a specific time slice +*----------------------------------------------------------------------------- +$ BATINCLUDE eqflofr.%1 L "'LO'" +$ BATINCLUDE eqflofr.%1 E LNX +$ BATINCLUDE eqflofr.%1 G "'UP'" + +*----------------------------------------------------------------------------- +* Market share equation allocating commodity percentages of a group +*----------------------------------------------------------------------------- +$ BATINCLUDE eqfloshr.%1 L LO IN +$ BATINCLUDE eqfloshr.%1 E FX IN +$ BATINCLUDE eqfloshr.%1 G UP IN + +*----------------------------------------------------------------------------- +* Product share equation allocating commodity percentages of a group +*----------------------------------------------------------------------------- +$ BATINCLUDE eqfloshr.%1 L LO OUT +$ BATINCLUDE eqfloshr.%1 E FX OUT +$ BATINCLUDE eqfloshr.%1 G UP OUT + +*----------------------------------------------------------------------------- +* Process market share constraint in total commodity production +*----------------------------------------------------------------------------- +$ BATINCLUDE eqflomrk.%1 G LO +$ BATINCLUDE eqflomrk.%1 E FX +$ BATINCLUDE eqflomrk.%1 L UP + +*----------------------------------------------------------------------------- +* Inter-regional exchange +*----------------------------------------------------------------------------- +$ BATINCLUDE eqire.%1 + +*----------------------------------------------------------------------------- +* Bound on exchange between internal regions +*----------------------------------------------------------------------------- +*V0.5b 980902 - avoid equations if LO=0/UP=INF +$ BATINCLUDE eqirebnd.%1 G LO "(IRE_BND(R,T,C,S,ALL_REG,IE,'LO') NE 0)" +$ BATINCLUDE eqirebnd.%1 E FX YES +$ BATINCLUDE eqirebnd.%1 L UP "(IRE_BND(R,T,C,S,ALL_REG,IE,'UP') NE INF)" + +*----------------------------------------------------------------------------- +* Commodity peaking +*----------------------------------------------------------------------------- +$ BATINCLUDE eqpeak.%1 %1 + +*----------------------------------------------------------------------------- +* Commodity-to-commodity transformation +*----------------------------------------------------------------------------- +$ BATINCLUDE eqptrans.%1 + +*----------------------------------------------------------------------------- +* Inter-period storage +*----------------------------------------------------------------------------- +$ BATINCLUDE eqstgips.%OBJ% +$ BATINCLUDE eqstgaux.%OBJ% + +*----------------------------------------------------------------------------- +* Time-slice storage +*----------------------------------------------------------------------------- +$ BATINCLUDE eqstgtss.%1 + +*----------------------------------------------------------------------------- +* Bound on input/output flows of storage process +*----------------------------------------------------------------------------- +$ BATINCLUDE eqstgflo.%1 IN G LO 0 +$ BATINCLUDE eqstgflo.%1 IN E FX NA +$ BATINCLUDE eqstgflo.%1 IN L UP INF +$ BATINCLUDE eqstgflo.%1 OUT G LO 0 +$ BATINCLUDE eqstgflo.%1 OUT E FX NA +$ BATINCLUDE eqstgflo.%1 OUT L UP INF + +$IFI '%SPINES%'==YES $%WITSPINE% + +*--------------------------------------------------------------------- +* Bounds on undiscounted costs by region, category and currency +*--------------------------------------------------------------------- +$ BATINCLUDE eqbndcst.%1 + +*----------------------------------------------------------------------------- +* User-constraints +*----------------------------------------------------------------------------- +* Commissioning periods + SET RVPT(R,ALLYEAR,P,T); + LOOP(OBJ_2A(R,T,P)$(NOT RTP_OFF(R,T,P)),F=B(T)+NCAP_ILED(R,T,P); Z=SUM(VNT(T,TT)$(F GT E(TT)+0.5),1); + RVPT(R,T,P,T+Z) = YES); + RTP_OFF(OBJ_2A(R,T,P))$(NOT SUM(RVPT(R,T,P,TT),1)) = YES; +*----------------------------------------------------------------------------- +* Define a map for region and milestone year specific user constraints to be generated +$IF '%VAR_UC%'==YES $SETLOCAL UCBD '' SETLOCAL UCLIM ',LIM' +$IF NOT '%VAR_UC%'==YES $SETLOCAL UCBD ',BD' SETLOCAL UCLIM ',BD' + SET UC_RHSMAP(UC_N,UC_NUMBER,UC_NUMBER,REG,T,S%UCBD%); + SET UC_TMAP(YEAR,YEAR,T,SIDE,UC_DYNT); + UC_TMAP(T,TT(T-DIAG(SIDE,'RHS')),TT,SIDE,'N') = YES; + UC_TMAP(T,TT(T-DIAG(SIDE,'RHS')),MILESTONYR,SIDE,'CUMSUM')$(ORD(T) > ORD(MILESTONYR)+DIAG(SIDE,'RHS')) = YES; + UC_TMAP(T,T,T,'RHS','SYNC') = YES; + UC_TMAP(T,T,TT,'RHS','CUM+')$UC_TMAP(T,T,TT,'LHS','CUMSUM') = YES; + LOOP((UC_R_EACH(R,UC_N),T%UCLIM%)$UC_RHSRT(R,UC_N,T%UCLIM%), + IF( SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','SEVERAL',R,T,ANNUAL%UCBD%) = YES; + ELSEIF SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','SEVERAL',R,T,ANNUAL%UCBD%) = YES; + )); + LOOP((UC_R_EACH(R,UC_N),T,S%UCLIM%)$UC_RHSRTS(R,UC_N,T,S%UCLIM%), + IF( UC_TS_EACH(R,UC_N,S)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','EACH',R,T,S%UCBD%) = YES; + ELSEIF UC_TS_EACH(R,UC_N,S)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','EACH',R,T,S%UCBD%) = YES; + )); +*----------------------------------------------------------------------------- +$ BATINCLUDE equcwrap.%1 E BD '' SUM(BD$ ,1) NOT +$ BATINCLUDE equcwrap.%1 E "'FX'" ",'FX'" +$ BATINCLUDE equcwrap.%1 G "'LO'" ",'LO'" +$ BATINCLUDE equcwrap.%1 L "'UP'" ",'UP'" + +$IFI '%SPINES%'==YES $%EWISPINE% + +*----------------------------------------------------------------------------- +* Bound on total inter-regional exchange, including external+internal regions +*----------------------------------------------------------------------------- + +*V0.5b avoid equations if LO=0/UP=INF +$ BATINCLUDE eqxbnd.%1 G LO "(IRE_XBND(ALL_REG,T,C,S,IE,'LO') NE 0)" +$ BATINCLUDE eqxbnd.%1 E FX YES +$ BATINCLUDE eqxbnd.%1 L UP "(IRE_XBND(ALL_REG,T,C,S,IE,'UP') NE INF)" + +*--------------------------------------------------------------------- +*GG* V07_2 Refinery blending +* Blending constraint to a specification characteristic +*--------------------------------------------------------------------- +$ BATINCLUDE eqblnd.mod L 1 +$ BATINCLUDE eqblnd.mod G 2 +$ BATINCLUDE eqblnd.mod E 3 +$ BATINCLUDE eqblnd.mod N 4 + +*--------------------------------------------------------------------- +* MACRO equations +*--------------------------------------------------------------------- +$IF %MACRO% == YES $BATINCLUDE eqmacro.tm + +*--------------------------------------------------------------------- +* damages +*--------------------------------------------------------------------- +$IF DEFINED DAM_COST $BATINCLUDE eqdamage.%1 diff --git a/eqmrkcom.ier b/eqmrkcom.ier new file mode 100644 index 0000000..34fb52a --- /dev/null +++ b/eqmrkcom.ier @@ -0,0 +1,94 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQMRKCOM Bound on the market share of flow in the production/consumption of commodity +* %1 - mod or v# for the source code to be used +* %2 - equation declaration type +* %3 - bound type for %1 +* %4 - PRD/CON indicator +* %5 - IN/OUT indicator +*=============================================================================* +*Questions/Comments: +* +*----------------------------------------------------------------------------- +*$ONLISTING + + EQ%2_MRK%4(RTP(R,T,PRC),C,S %SWX%)$(%SWTX%TOP(R,PRC,C,'%5')*FLO_MRK%4(R,T,PRC,C,S,'%3')) .. + + FLO_MRK%4(R,T,PRC,C,S,'%3') * + +$IF '%4'=='CON' $GOTO CONS + + ( + +* production of commodity +* ----------------------- + ( +* individual flows +$ BATINCLUDE cal_fflo.mod OUT O + +*V07_1b blending flows + SUM(OPR$BLE_OPR(R,C,OPR), + RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BLE_BAL(R,T,C,OPR) * %VAR%_BLND(R,T,C,OPR %SOW%) + ) + +*V07_1b emissions due to blending operations + SUM(BLE_ENV(R,C,BLE,OPR), RS_FR(R,S,'ANNUAL') * ENV_BL(R,C,BLE,OPR,T) * %VAR%_BLND(R,T,BLE,OPR %SOW%) + ) + + +* inter-regional trade to region +$ BATINCLUDE cal_ire.mod IMP OUT IE + +* storage +$ BATINCLUDE cal_stgn.mod OUT IN '*STG_EFF(R,V,P)' '' "(NOT PRC_NSTTS(R,P,TS))" + +* capacity related commodity flows +$ BATINCLUDE cal_cap.mod OUT O + + ) + ) + +$GOTO SIGN +$LABEL CONS + ( +* consumption of commodity +* ------------------------ + +* individual flows +$ BATINCLUDE cal_fflo.mod IN I + +*V07_1a blending flows + SUM(BLE_TP(R,T,BLE)$BLE_OPR(R,BLE,C), + RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * %VAR%_BLND(R,T,BLE,C %SOW%) + ) + + SUM(BLE_OPR(R,BLE,OPR)$(BLE_INP(R,BLE,C) * BLE_TP(R,T,BLE)), + RS_FR(R,S,'ANNUAL')*(1+RTCS_FR(R,T,C,S,'ANNUAL')) * BL_INP(R,BLE,C) + %VAR%_BLND(R,T,BLE,OPR %SOW%) + ) + + +* inter-regional trade from region +$ BATINCLUDE cal_ire.mod EXP IN IE + +* storage +$ BATINCLUDE cal_stgn.mod IN OUT '' 'STG_EFF(R,V,P)*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" + +* capacity related commodity flows +$ BATINCLUDE cal_cap.mod IN I + +* include the elasticity variables + - SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),BDSIG(BD)*%VAR%_ELAST(R,T,C,S,J,BD %SOW%)) + + ) + +$LABEL SIGN + + =%2= + + SUM(RTPCS_VARF(R,T,PRC,C,TS)$(TOP(R,PRC,C,'%5')$RP_FLO(R,PRC)), + SUM(RTP_VINTYR(R,V,T,PRC), +$ BATINCLUDE %cal_red% C COM TS PRC T + *RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) + ) + ) + ; +*$OFFLISTING diff --git a/eqobj.mod b/eqobj.mod new file mode 100644 index 0000000..71af4e1 --- /dev/null +++ b/eqobj.mod @@ -0,0 +1,125 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJ the objective functions +* %1 - mod or v# for the source code to be used +*=============================================================================* +*GaG Questions/Comments: +* - V-index used in place to T for MODLYEAR +* Note: PASTYEAR always have D(V) = 1 +* - V-vintage MODLYEAR year, the point in time where the investment took place +*----------------------------------------------------------------------------- + SET K_EOH(ALLYEAR); + +* [UR] 21.06.2003: K_EOH must include pastyears, since it links to past vintages + K_EOH(EACHYEAR)$((YEARVAL(EACHYEAR) >= PYR_V1) * (YEARVAL(EACHYEAR) <= MIYR_VL)) = YES; + +* Sets for periodic costs + SET KTYAGE(LL,YEAR,LL,AGE); + LOOP(SAMEAS('1',AGE), + KTYAGE(K(LL),PERIODYR(T,Y_EOH(YEAR)),AGE+(ORD(YEAR)-ORD(LL)))$YK(YEAR,LL)=YES; + KTYAGE(K(LL),YK(PYR_S,Y_EOH(YEAR)),AGE+(ORD(YEAR)-ORD(LL)))$YK(YEAR,LL)=YES); + +* Set up summing of OBJ component variables + SUM_OBJ(OBV,ITEM) = DIAG(OBV,ITEM); + SUM_OBJ(OBV('OBJSAL'),OBV) = -1; + SUM_OBJ(R,'OBJELS') = 1$SUM(RCJ(R,C,J,BD),1); +*----------------------------------------------------------------------------- +* Cases for ILED and TLIFE/D(t); values assigned in EQOBJINV + SET OBJ_1A(R,ALLYEAR,P) //; + SET OBJ_1B(R,ALLYEAR,P) //; + SET OBJ_2A(R,ALLYEAR,P) //; + SET OBJ_2B(R,ALLYEAR,P) //; +* Salvage controls + SET OBJ_SUMS(R,ALLYEAR,P) //; + SET OBJ_SUMS3(R,ALLYEAR,P) //; + SET OBJ_SUMSI(R,ALLYEAR,P,ALLYEAR) //; +$IF DECLARED VNRET $BATINCLUDE prepret.dsc EQOBJ + +*=============================================================================== +* Investment Cost, Tax/Subsidy and Decomissioning components +*=============================================================================== +$ BATINCLUDE eqobjinv.%1 + +*=============================================================================== +* Elastic Demand costs +*=============================================================================== +$IF %TIMESED%==YES $ BATINCLUDE eqobjels.%1 + +*=============================================================================== +* Fixed O&M Cost and Tax components +*=============================================================================== +$ BATINCLUDE eqobjfix.%1 %1 + +*=============================================================================== +* Variable O&M and direct commodity related cost components +*=============================================================================== +$IFI '%OBLONG%%OBJ%'==YESALT $SET OBJ 'LIN' SET VARCOST LIN +$ BATINCLUDE eqobjvar.%1 %1 + +*=============================================================================== +* Salvage value of investment and decommissioning costs +*=============================================================================== +$ BATINCLUDE eqobsalv.%1 %1 + +*=============================================================================== +* Annualized objective formulation +*=============================================================================== +$IFI %OBJANN%==YES $BATINCLUDE eqobjann.tm + +*=============================================================================== +* Actual OBJ +*=============================================================================== +$IFI NOT %STAGES%==YES %EQ%_OBJ .. -objZ + +$IFI %STAGES% == YES %EQ%_ROBJ(REG(R)%SOW%) .. -%VAR%_UCR('OBJZ',R%SOW%) + + + SUM(RDCUR(R,CUR), + +* Investment Costs, Tax/Subsidies and Decommissioning +* Salvage value of investment and decommissioning costs +* Fixed O&M and Tax/Subsidies +* Variable O&M and direct commodity costs +* Damages + + SUM((ITEM,OBV)$SUM_OBJ(ITEM,OBV),%VAR%_OBJ(R,OBV,CUR %SOW%)*SUM_OBJ(ITEM,OBV)) + +* Elastic Demand costs +$IF %TIMESED% == YES +SUM(BD,%VAR%_OBJELS(R,BD,CUR %SOW%)*BDSIG(BD))$SUM_OBJ(R,'OBJELS') +$IFI %MICRO% == YES -%VAR%_OBJELS(R,'FX',CUR %SOW%)$SUM_OBJ(R,'OBJELS') + + ) + +* Extensions to objective function +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod obj_ext %EXTEND% + + =E= 0 +; + +*=============================================================================== +* Stochastic objective function +*=============================================================================== +$IFI NOT %STAGES% == YES $EXIT + + EQ_EXPOBJ(AUXSOW(WW)).. + (SUM(SOW, SW_PROB(SOW) * %VAR%_UC('OBJZ'%SOW%))/SW_NORM - VAS_EXPOBJ)$(NOT SW_PHASE) + + SUM(SOW,SUM(UC_N$(SUM(UC_T_SUM(UC_R_SUM(R,UC_N),T),1)$S_UCOBJ(UC_N,SOW)), + S_UCOBJ(UC_N,SOW)*%VAR%_UC(UC_N%SOW%)) - %VAR%_UC('OBJ1'%SOW%))$(SW_PHASE GT 0) + + SUM(SOW,SUM(UC_N$(SUM(UC_T_SUM(UC_R_SUM(R,UC_N),T),1)$S_UCOBJ(UC_N,WW)), + S_UCOBJ(UC_N,WW)*%VAR%_UC(UC_N%SOW%)) - %VAR%_UC('OBJ1'%SWD%))$(SW_PHASE LT 0) + + =E= 0; + + EQ_UPDEV(SOW)$SW_LAMBDA.. + %VAR%_UC('OBJZ'%SOW%) - VAS_EXPOBJ$(SW_LAMBDA GT 0) - %VAR%_UC('OBJ1'%SOW%)$(SW_LAMBDA LT 0) + =L= VAS_UPDEV(SOW)$(SW_LAMBDA GT 0) + VAS_UPDEV('1')$(SW_LAMBDA LT 0); + + %EQ%_SOBJ('N'%SOW%).. -%VAR%_UC('OBJZ'%SOW%) + SUM(R,%VAR%_UCR('OBJZ',R%SOW%)) =E= 0; + + EQ_OBJ.. + ((VAS_EXPOBJ + SW_LAMBDA * SUM(SOW, SW_PROB(SOW) * VAS_UPDEV(SOW))/SW_NORM)$(SW_LAMBDA GE 0) + - MIN(0,SW_LAMBDA)*VAS_UPDEV('1'))$(NOT SW_PHASE) + + SUM(SOW,%VAR%_UC('OBJ1'%SOW%)$(ABS(SW_PHASE) EQ 1) + %VAR%_UC('OBJZ'%SOW%)$(ABS(SW_PHASE) EQ 2)) + + =E= objZ; diff --git a/eqobj.tm b/eqobj.tm new file mode 100644 index 0000000..2b37f1e --- /dev/null +++ b/eqobj.tm @@ -0,0 +1,64 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJ the objective cost functions for Macro +* %1 - mod or v# for the source code to be used +*=============================================================================* +*GaG Questions/Comments: +*10/21 +* - V-index used in place to T for MODLYEAR +* Note: PASTYEAR always have D(V) = 1 +* - V-vintage MODLYEAR year, the point in time where the investment took place +*----------------------------------------------------------------------------- + + SET K_EOH(ALLYEAR); + +* [UR] 21.06.2003: K_EOH must include pastyears, since in eqobjfix.mod it links to past vintages + K_EOH(EACHYEAR)$((YEARVAL(EACHYEAR) >= PYR_V1) * (YEARVAL(EACHYEAR) <= MIYR_VL)) = YES; + +* Sets for periodic costs + SET KTYAGE(LL,YEAR,LL,AGE); + LOOP(SAMEAS('1',AGE),KTYAGE(K(LL),PERIODYR(T,Y_EOH(YEAR)),AGE+(ORD(YEAR)-ORD(LL)))$YK(YEAR,LL)=YES); + +* Cases for ILED and TLIFE/D(t); values assigned in EQOBJINV + SET OBJ_1A(R,ALLYEAR,P) //; + SET OBJ_1B(R,ALLYEAR,P) //; + SET OBJ_2A(R,ALLYEAR,P) //; + SET OBJ_2B(R,ALLYEAR,P) //; +* Salvage controls + SET OBJ_SUMS(R,ALLYEAR,P) //; + SET OBJ_SUMS3(R,ALLYEAR,P) //; + SET OBJ_SUMSI(R,ALLYEAR,P,ALLYEAR) //; + PARAMETER OBJ_DCEOH(REG,CUR) //; + +*=============================================================================== +* Investment Cost, Fixed Cost and Variable Cost components +*=============================================================================== +$ BATINCLUDE eqobjinv.mod tm exit +$ BATINCLUDE eqobjfix.mod tm exit +$ BATINCLUDE eqobsalv.mod tm exit +$ BATINCLUDE eqobjann.tm + +*=============================================================================== +* Elastic Demand costs: only when MLF +*=============================================================================== +$ IF %MACRO%==Yes $BATINCLUDE eqobjels.mod + +*=============================================================================== +* Actual OBJ +*=============================================================================== + EQ_OBJ(R,T) .. + + SUM(RDCUR(R,CUR), + +* Investment Costs, Fixed Costs and Variable Costs (elastic demand costs excluded) + + SUM(OBVANN,VAR_ANNCST(OBVANN,R,T,CUR)) + + ) + + =E= + + VAR_OBJCOST(R,T); diff --git a/eqobjann.tm b/eqobjann.tm new file mode 100644 index 0000000..a9d205b --- /dev/null +++ b/eqobjann.tm @@ -0,0 +1,100 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJANN the objective function components for MACRO +* - Annualized costs for all components +*=============================================================================* +$IF DEFINED COEF_OBINV%1 $GOTO COEF + PARAMETER COEF_OBINV%1(R,YEAR,P,CUR) //; + PARAMETER COEF_OBFIX%1(R,YEAR,P,CUR) //; + PARAMETER COEF_CRF(R,ALLYEAR,P,CUR) //; +*------------------------------------------------------------------------------ +$IF %1==N $GOTO COEF + + SET OBVANN(OBV) / OBJINV, OBJFIX, OBJVAR /; + SUM_OBJ(OBV('OBJSAL'),OBV) = 0; + POSITIVE VARIABLES VAR_ANNCST(OBV,R,ALLYEAR,CUR); + EQUATIONS + EQ_OBJANN(OBVANN,REG,CUR) + EQ_ANNFIX(REG,ALLYEAR,CUR) + EQ_ANNINV(REG,ALLYEAR,CUR) + EQ_ANNVAR(REG,ALLYEAR,CUR); + + EQ_OBJANN(OBVANN,RDCUR(R,CUR)).. + VAR_OBJ(R,OBVANN,CUR) =E= SUM(T, OBJ_PVT(R,T,CUR) * VAR_ANNCST(OBVANN,R,T,CUR)) +$IF DEFINED VNRET + + SUM(OBJ_SUMS(R,V,P)$RVPRL(R,V,P),OBJSCC(R,V,P,CUR)*OBJ_DCEOH(R,CUR)*(VAR_NCAP(R,V,P)$T(V)+NCAP_PASTI(R,V,P)-VAR_SCAP(R,V,'0',P)))$DIAG(OBVANN,'OBJINV') + ; + +$ BATINCLUDE eqobjcst.tm + +*=============================================================================== +$LABEL COEF +* Calculate coefficients for annualized costs +* Investment costs: Commissioning years + OPTION CLEAR=OBJ_SUMSI; + FIL2(V) = B(V)-YEARVAL(V); + OBJ_SUMSI(RTP(R,V(LL),P),LL+(FIL2(V)+NCAP_ILED(R,V,P))) = YES; + +* Annualizing coefficient for investment costs over years of capacity transfer + COEF_CRF(OBJ_ICUR(R,V,P,CUR)) = + SUM(RTP_CPTYR(R,TT(V),T,P),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR)) + + SUM(OBJ_SUMSI(R,PASTMILE(V),P,K),OBJ_DISC(R,K,CUR)*(1-(1+G_DRATE(R,V,CUR))**(-NCAP_TLIFE(R,V,P)))/(1-(1/(1+G_DRATE(R,V,CUR))))); + +* Investment cost coefficient + + COEF_OBINV%1(OBJ_ICUR(R,V,P,CUR)) = (1/COEF_CRF(R,V,P,CUR))$COEF_CRF(R,V,P,CUR) * ( + +* Cases I - Investment Cost and II - Taxes/Subsidies + + SUM(OBJ_SUMII(R,V,P,LIFE,K_EOH,JOT), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_DISC(R,K,CUR) * (1-SALV_INV(R,V,P,LL)$T(V)) * + (OBJ_ICOST(R,K,P,CUR) + (OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))%2)) * + COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)) + + +* Cases III - Decommissioning + + SUM(OBJ_SUMIII(R,V,P,LL,K,Y)$OBJ_DCOST(R,V,P,CUR), + OBJ_DISC(R,Y,CUR) * COR_SALVD(R,V,P,CUR) * OBJ_DCOST(R,K,P,CUR) / OBJ_DIVIII(R,V,P)) + ); + + COEF_OBINV%1(OBJ_ICUR(R,PASTMILE(V),P,CUR))$PRC_RESID(R,'0',P) = + OBJ_CRF(R,V,P,CUR)*(OBJ_ICOST(R,V,P,CUR)+(OBJ_ITAX(R,V,P,CUR)-OBJ_ISUB(R,V,P,CUR))%2); + +*------------------------------------------------------------------------------ +* Fixed costs: Annualizing coefficient for costs over years of capacity transfer + COEF_CRF(OBJ_FCUR(R,V,P,CUR)) = SUM(RTP_CPTYR(R,V,T,P),COEF_CPT(R,V,T,P)*OBJ_PVT(R,T,CUR)); +$IFI NOT %ANNCOST%==LEV COEF_CRF(OBJ_FCUR(R,PASTMILE(V),P,CUR)) = SUM(OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE),OBJ_LIFE(K_EOH,R,JOT,LIFE,CUR)); + +* Fixed cost coefficient + + COEF_OBFIX%1(OBJ_FCUR(R,V,P,CUR)) = (1/COEF_CRF(R,V,P,CUR))$COEF_CRF(R,V,P,CUR) * ( + +* Case IV - Fixed O&M Cost and Taxes + + SUM(OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE)$(NOT RTP_ISHPR(R,V,P)), + SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_LIFE(LL,R,JOT,LIFE,CUR) * %CAPWD% + (OBJ_FOM(R,K,P,CUR)+(OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))%2)) / OBJ_DIVIV(R,V,P)) + + + SUM(OBJ_SUMIV(K_EOH,RTP_ISHPR(R,V,P),JOT,LIFE), + SUM((INVSPRED(K_EOH,JOT,LL,K),OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))), + OBJ_DISC(R,Y_EOH,CUR) * (1+SUM(PERIODYR(T,Y_EOH),RTP_CPX(R,V,P,T))$NCAP_CPX(R,V,P)) * %CAPWD% + ( + OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + + OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1))%2 - + OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1))%2 + ) + ) / OBJ_DIVIV(R,V,P) + ) + + +* Case V - Decommissioning Surveillance + SUM(OBJ_SUMIVS(R,V,P,K,Y), OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR)) + ); + + COEF_OBFIX%1(OBJ_FCUR(R,PASTMILE(V),P,CUR))$PRC_RESID(R,'0',P) = + COEF_OBFIX%1(R,V,P,CUR) * COEF_CRF(R,V,P,CUR) / + SUM(VNT(V,T)$PRC_RESID(R,T,P),PRC_RESID(R,T,P)/NCAP_PASTI(R,V,P)*OBJ_PVT(R,T,CUR)); +*=============================================================================== + OPTION CLEAR=OBJ_SUMSI,CLEAR=COEF_CRF; \ No newline at end of file diff --git a/eqobjcst.tm b/eqobjcst.tm new file mode 100644 index 0000000..ee85352 --- /dev/null +++ b/eqobjcst.tm @@ -0,0 +1,63 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJCST the objective functions investment, fixed and variable costs +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Questions/Comments: +* - Supports also alternative objective formulations +*----------------------------------------------------------------------------- + +*=============================================================================== +* Generate Investment equation summing over all active indexes by region and currency +*=============================================================================== + + EQ_ANNINV(R,T,CUR)$RDCUR(R,CUR).. + + VAR_ANNCST('OBJINV',R,T,CUR) =E= + +* Revised accounting for MACRO: Calculate annualized cost from discounted +* lump-sum investments undiscounted back to the lump-sum commissioning year K + + SUM(RTP_CPTYR(R,V,T,P)$OBJ_ICUR(R,V,P,CUR), COEF_CPT(R,V,T,P) * + COEF_OBINV(R,V,P,CUR) * (VAR_NCAP(R,V,P)$TT(V)+NCAP_PASTI(R,V,P))) + ; + +*=============================================================================== +* Generate Fixed Cost equation summing over all active indexes by region and currency +*=============================================================================== + + EQ_ANNFIX(R,T,CUR)$RDCUR(R,CUR) .. + + VAR_ANNCST('OBJFIX',R,T,CUR)*OBJ_PVT(R,T,CUR) =E= + +* Revised accounting for MACRO: Calculate annualized cost from discounted +* lump-sum fixed costs undiscounted back to the lump-sum commissioning year K + +$IF DEFINED VNRET $BATINCLUDE prepret.dsc OBJFIX + + SUM(RTP_CPTYR(R,V,T,P)$COEF_OBFIX(R,V,P,CUR), COEF_CPT(R,V,T,P) * OBJ_PVT(R,T,CUR) * + COEF_OBFIX(R,V,P,CUR) * (VAR_NCAP(R,V,P)$TT(V)+NCAP_PASTI(R,V,P))) + ; + +*=============================================================================== +* Generate Variable cost equation summing over all active indexes by region and currency +*=============================================================================== + + EQ_ANNVAR(R,T,CUR)$RDCUR(R,CUR) .. + +$BATINCLUDE eqobjvar.mod mod * + + OBJ_PVT(R,T,CUR) * VAR_ANNCST('OBJVAR',R,T,CUR) + +$IF DEFINED DAM_COST - +$IF DEFINED DAM_COST $BATINCLUDE eqdamage.mod E * $EXIT +$IF NOT %TIMESED%==YES $GOTO DONELS + - + SUM((MI_DMAS(R,COM,C),BDNEQ(BD))$MI_ESUB(R,T,COM), BDSIG(BD) * + SUM(RTCS_VARC(R,T,C,S)$COM_STEP(R,C,BD), COEF_PVT(R,T) * COM_BPRICE(R,T,C,S,CUR) * + SUM(RCJ(R,C,J,BD),%VART%_ELAST(R,T,C,S,J,BD %SWS%) * MI_AGC(R,T,COM,C,J,BD)))) +$LABEL DONELS + ; diff --git a/eqobjels.mod b/eqobjels.mod new file mode 100644 index 0000000..ab5315f --- /dev/null +++ b/eqobjels.mod @@ -0,0 +1,51 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJELS the objective function flexible demand utility +*=============================================================================* +*GaG Questions/Comments: +*----------------------------------------------------------------------------- +$IFI %MICRO%==YES $BATINCLUDE pp_micro.mod NLP + + %EQ%_OBJELS(R,BD,CUR %SOW%)$(RDCUR(R,CUR)$SUM_OBJ(R,'OBJELS')).. + +*------------------------------------------------------------------------------ +* Direction with bound sign BDSIG +*------------------------------------------------------------------------------ +*V0.5b 980824 - correct ORD adjustment + SUM(RTCS_VARC(R,T,C,S)$(COM_ELAST(R,T,C,S,BD)$COM_STEP(R,C,BD)), + COEF_PVT(R,T) * COM_BPRICE(R,T,C,S,CUR) * + (SUM(RCJ(R,C,J,BD), %VART%_ELAST(R,T,C,S,J,BD %SWS%) * + (1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**(1/COM_ELAST(R,T,C,S,BD)))$(NOT COM_ELASTX(R,T,C,BD)) + +* Shaped elasticities + SUM(RTC_SHED(R,T,C,BD,JJ(AGE)), + SUM((RCJ(R,C,J,BD),SPAN(AGE+CEIL((ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD)*100-ORD(AGE)))), + (SHAPED(BD,JJ,SPAN) * + ((1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))/SHAPED(BD,'1',SPAN))**(1/MAX(1E-3,SHAPE(JJ,SPAN))) + )**(1/COM_ELAST(R,T,C,S,BD)) * %VART%_ELAST(R,T,C,S,J,BD %SWS%))) + + SUM(MI_DMAS(R,COM,C)$MI_DOPE(R,T,C),SUM(RCJ(R,C,J,BD),%VART%_ELAST(R,T,C,S,J,BD %SWS%) * MI_AGC(R,T,COM,C,J,BD))) + ) + )$BDNEQ(BD) + + +* Micro NLP formulation +$IFI NOT %MICRO%==YES $GOTO RHS + + SUM(T$(ORD(T)>1), COEF_PVT(R,T) * + SUM(DEM(R,C)$(MI_ELASP(R,T,C)$RD_NLP(R,C)), MI_CCONS(R,T,C) * + ((%VART%_DEM(R,T,C%SWS%)**MI_ELASP(R,T,C))$(RD_NLP(R,C)=1) + + ((SUM(MI_DMAS(R,C,COM),RD_SHAR(R,T,C,COM)**(1/MI_ESUB(R,T,C))*(COM_AGG(R,T,COM,C)*%VART%_DEM(R,T,COM%SWS%))**MI_RHO(R,T,C))**(1/MI_RHO(R,T,C)))**MI_ELASP(R,T,C))$(RD_NLP(R,C)>2) - + DDF_QREF(R,T,C)**MI_ELASP(R,T,C))$(RD_NLP(R,C)>0) + ))$LNX(BD) + +$LABEL RHS + =E= + %VAR%_OBJELS(R,BD,CUR %SOW%); + +*------------------------------------------------------------------------------ + +* Step bounds for linear CES demand functions + %EQ%L_COMCES(RTC(%R_T%,COM),C,S%SWT%)$(RTCS_VARC(R,T,C,S)$MI_DOPE(R,T,C)$MI_DMAS(R,COM,C)).. + SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),%VAR%_ELAST(R,T,C,S,J,BD%SOW%)*COM_STEP(R,C,BD)/ORD(J)/(DDF_QREF(R,T,C)*COM_FR%MX%(R,T,C,S)*COM_VOC(R,T,C,BD))) + =L= %VAR%_COMPRD(R,T,COM,'ANNUAL'%SOW%)/DDF_QREF(R,T,COM); diff --git a/eqobjels.rpt b/eqobjels.rpt new file mode 100644 index 0000000..ec66c51 --- /dev/null +++ b/eqobjels.rpt @@ -0,0 +1,37 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJELS the objective function flexible demand costs reporting +*=============================================================================* +* %1 - assigned parameter(..%2..) +* %2 - year index (Y_EOH/TT) +* %3 - mult or '' +*----------------------------------------------------------------------------- +*V0.5a 980729 control the inner sums according to the years in the periods + + %1$SUM(RCJ(R,C,'1',BDNEQ),1) = %3 + + SUM((RDCUR(R,CUR),BDNEQ(BD)), BDSIG(BD) * +*V0.5b 980824 - correct ORD adjustment + SUM((PERIODYR(T,%2),COM_TS(R,C,S))$COM_ELAST(R,T,C,S,BD), COM_BPRICE(R,T,C,S,CUR) * + (SUM(RCJ(R,C,J,BD), VAR_ELAST.L(R,T,C,S,J,BD) * + ((1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))**(1/COM_ELAST(R,T,C,S,BD))))$(NOT COM_ELASTX(R,T,C,BD)) + + SUM(RTC_SHED(R,T,C,BD,JJ(AGE)), + SUM((RCJ(R,C,J,BD),SPAN(AGE+CEIL((ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD)*100-ORD(AGE)))), + (SHAPED(BD,JJ,SPAN) * + ((1-BDSIG(BD)*(ORD(J)-.5)*COM_VOC(R,T,C,BD)/COM_STEP(R,C,BD))/SHAPED(BD,'1',SPAN))**(1/MAX(1E-3,SHAPE(JJ,SPAN))) + )**(1/COM_ELAST(R,T,C,S,BD)) * VAR_ELAST.L(R,T,C,S,J,BD))) +$IF DEFINED MI_AGC +SUM(MI_DMAS(R,COM,C)$MI_DOPE(R,T,C),SUM(RCJ(R,C,J,BD),VAR_ELAST.L(R,T,C,S,J,BD)*MI_AGC(R,T,COM,C,J,BD))) + )) + ); +$IFI NOT %MICRO%==YES $EXIT +* NLP utility loss + %1$RD_NLP(R,C) = %3 + SUM(RDCUR(R,CUR), + SUM((PERIODYR(T,%2),COM_TS(R,C,S))$(COM_BPRICE(R,T,C,S,CUR)$MI_ELASP(R,T,C)), -COM_FR(R,T,C,S) * MI_CCONS(R,T,C) * + ((VAR_DEM.L(R,T,C)**MI_ELASP(R,T,C))$(RD_NLP(R,C)=1) + + ((SUM(MI_DMAS(R,C,COM),RD_SHAR(R,T,C,COM)**(1/MI_ESUB(R,T,C))*(COM_AGG(R,T,COM,C)*VAR_DEM.L(R,T,COM))**MI_RHO(R,T,C))**(1/MI_RHO(R,T,C)))**MI_ELASP(R,T,C))$(RD_NLP(R,C)>2) - + DDF_QREF(R,T,C)**MI_ELASP(R,T,C))$(RD_NLP(R,C)>0)) + ); \ No newline at end of file diff --git a/eqobjfix.mod b/eqobjfix.mod new file mode 100644 index 0000000..ad9a538 --- /dev/null +++ b/eqobjfix.mod @@ -0,0 +1,227 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJFIX the objective functions capacity fixed costs +* %1 - mod or v# for the source code to be used +* - fixed O&M, including surveillance during decommissioning +* - tax +*=============================================================================* +*GaG Questions/Comments: +* - Note that V=T in OBJ.DOC, but in the code V is assocated with the vintage year, +* that is the of investment as distinguished from T = the current MILESTONYR. +* - Combining all the Fix into a single equation at the moment +* - the test for relevant costs is done on the year of installation, perhaps should be Y-running year +* - COEF_RPTI calculated in PPMAIN.MOD +*----------------------------------------------------------------------------- +* For loop controls + SET OBJ_FCUR(REG,ALLYEAR,P,CUR) //; +* OBJ coefficient SUM control set with the 3 ALLYEAR indexes in sequence = +* Y-running OBJ year, V-variables' investment period, K-cost value counter & index + SET OBJ_SUMIV(ALLYEAR,R,ALLYEAR,P,AGE,AGE) //; + SET OBJ_SUMIVS(R,ALLYEAR,P,ALLYEAR,ALLYEAR) //; +* Shaping controls + SET RTP_SHAPE(REG,ALLYEAR,PRC,J,J,J) //; +* Fixed cost year span divisor + PARAMETER OBJ_DIVIV(REG,ALLYEAR,PRC) //; +* Present value factor of technical life + PARAMETER OBJ_LIFE(ALLYEAR,REG,AGE,AGE,CUR) //; + +*UR: 09/30/01 +* if some relevant cost + OBJ_FCUR(RTP(R,V,P),CUR)$(OBJ_FOM(R,V,P,CUR)+OBJ_FTX(R,V,P,CUR)+OBJ_FSB(R,V,P,CUR)) = YES; +* Decommissioning + OBJ_FCUR(RTP(R,V,P),CUR)$OBJ_DLAGC(R,V,P,CUR) = YES; + OPTION OBJ_YES < OBJ_FCUR; + OBJ_YES(RTP_OFF(R,T,P))$(NOT NCAP_PASTI(R,T,P)) = NO; + +* Set up the rounded lifetimes; round half years down: + OBJ_DIVIV(OBJ_YES(R,V,P)) = MAX(1,MIN(CARD(AGE),CEIL(NCAP_TLIFE(R,V,P)-0.5))); + OBJ_DIVIV(OBJ_YES(R,PYR_S(V),P))$PRC_RESID(R,'0',P)=MAX(2,SMAX(T$(PRC_RESID(R,T,P)>0),E(T))-MIYR_V1+2); +*====================================================================================== +* Apply SHAPE to OBJ_YES: +*-------------------------------------------------------------------------------------- +OPTION CLEAR=RTP_SHAPE; +LOOP(SAMEAS(J,'1'), + RTP_SHAPE(OBJ_YES(RTP),'1',J+MAX(0,NCAP_FOMX(RTP)-1),J+MAX(0,NCAP_FOMM(RTP)-1))$(NCAP_FOMX(RTP)+NCAP_FOMM(RTP)+NCAP_CPX(RTP)) = YES; + RTP_SHAPE(OBJ_YES(RTP),'2',J+MAX(0,NCAP_FTAXX(RTP)-1),J+MAX(0,NCAP_FTAXM(RTP)-1))$(NCAP_FTAXX(RTP)+NCAP_FTAXM(RTP)) = YES; + RTP_SHAPE(OBJ_YES(RTP),'3',J+MAX(0,NCAP_FSUBX(RTP)-1),J+MAX(0,NCAP_FSUBM(RTP)-1))$(NCAP_FSUBX(RTP)+NCAP_FSUBM(RTP)) = YES; +); + OPTION RTP_ISHPR < RTP_SHAPE; + RTP_SHAPE(RTP_SHAPE(RTP,J,'1','1'))$(NOT NCAP_CPX(RTP)) = NO; +$IF '%VALIDATE%' == YES RTP_ISHPR(RTP) = YES; +*===================================================================================== +$ SET ZHALF "CEIL(Z/2-.5)" SET ISTEP IPD(T) +$ IF NOT '%CTST%'=='' $SET ISTEP "MIN(IPD(T),ROUND(Z))" SET ZHALF FLOOR(ROUND(Z)/2) + +*=============================================================================== +* Case IV/V.1.a: Fixed O&M/Tax ILEDt <= ILEDmin,t and TLIFEt + ILEDt >= D(t) +*=============================================================================== + LOOP(SAMEAS(AGE,'1'), +* [AL] 05/08/2003: small further speed-up + +$IF '%VALIDATE%' == 'YES' $GOTO M2T +* Set period parameters for Case 1a: + FIL2(V) = (IPD(V)-1)$T(V); + MY_ARRAY(V) = B(V)-YEARVAL(V) + (M(V)-B(V)-FIL2(V))$T(V); +* The first commissioning year is LL+MY_ARRAY(LL) and the spread is AGE+FIL2(V) + OBJ_SUMIV(LL+MY_ARRAY(LL),OBJ_1A(OBJ_YES(R,V(LL),P)),AGE+FIL2(V),AGE+(OBJ_DIVIV(R,V,P)-1)) = YES; + +$GOTO CONT +$LABEL M2T +* create square for investment costing if validating MARKAL + MY_ARRAY(V) = MAX(MIYR_V1,B(V))-YEARVAL(V); + OBJ_SUMIV(LL+MY_ARRAY(LL),OBJ_1A(OBJ_YES(R,V(LL),P)),AGE+(NCAP_ELIFE(R,V,P)-1),'1') = YES; + +$LABEL CONT + ); + +*=============================================================================== +* Case IV/V.1.b: Fixed O&M/Tax ILEDt <= ILEDmin,t and TLIFEt + ILEDt < D(t) +*=============================================================================== +* if some relevant cost + LOOP(SAMEAS(AGE,'1'), +$IF '%VALIDATE%'==YES $GOTO M2T_2 + LOOP(OBJ_1B(OBJ_YES(R,T(LL),P)), + Z = NCAP_TLIFE(R,T,P); +* Slightly different handling according to objective formulation + IF((ROUND(Z)-IPD(T)%CTST%) LE 0, MY_F = OBJ_DIVIV(R,T,P)-1; + F = B(T) - %ZHALF% - YEARVAL(T); + Z = ROUND(COEF_RPTI(R,T,P)*Z)-1; +* The first commissioning year is LL+F and the spread is AGE+Z + OBJ_SUMIV(LL+F,R,T,P,AGE+Z,AGE+MY_F) = YES; + ELSE CNT = %ISTEP%; OBJ_D = CNT-1; MY_F = B(T)-YEARVAL(T)-FLOOR(CNT/2); + FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), + F = MY_F; MY_F = F+Z; CNT = ROUND(MY_F)-ROUND(F)-1; + OBJ_SUMIV(LL+F,R,T,P,AGE+OBJ_D,AGE+CNT) = YES)); + ); + +* create square for investment costing if validating MARKAL +$LABEL M2T_2 +$IF '%VALIDATE%'==YES + OBJ_SUMIV(LL+MY_ARRAY(LL),OBJ_1B(OBJ_YES(R,T(LL),P)),AGE+(COEF_RPTI(R,T,P)*NCAP_ELIFE(R,T,P)-1),'1') = YES; + + ); +*=============================================================================== +* Case IV/V.2.a: Fixed O&M/Tax ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) +*=============================================================================== +* if some relevant cost +*V05c 981007 - treat PAST == MILE except take cost from decision/capacity installed + LOOP(SAMEAS(AGE,'1'), +* The commissioning year is B(V)+ILED for both MILESTONYR and PASTMILE, spread is '1' + OBJ_SUMIV(LL+(B(LL)+NCAP_ILED(R,LL,P)-YEARVAL(LL)),OBJ_YES(OBJ_2A(R,V(LL),P)),'1',AGE+(OBJ_DIVIV(R,LL,P)-1)) = YES; + ); +*----------------------------------------------------------------------------- +* Case IV.2.a: Surveillance ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) +*----------------------------------------------------------------------------- +* if some relevant cost + LOOP((OBJ_2A(R,V(LL),P),CUR)$OBJ_DLAGC(R,V,P,CUR), + MY_F = B(V) + NCAP_ILED(R,V,P); + F = ROUND(MY_F + NCAP_TLIFE(R,V,P)); Z = F + NCAP_DLAG(R,V,P); MY_F = MY_F-YEARVAL(V); + OBJ_SUMIVS(R,V,P,LL+MY_F,Y)$((YEARVAL(Y) >= F) AND (YEARVAL(Y) < Z)) = YES; + ); + +*=============================================================================== +* Case IV/V.2.b: Fixed O&M/Tax ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) +*=============================================================================== +* determine the number of repeated investments, if some relevant cost + LOOP(SAMEAS(AGE,'1'), + LOOP(OBJ_2B(OBJ_YES(R,T(LL),P)), + Z = NCAP_TLIFE(R,T,P); MY_F = ROUND(B(T)+NCAP_ILED(R,T,P))-YEARVAL(T); + FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), +* The commissioning year is LL+F and the spread is 1 + F = MY_F; MY_F = F+Z; CNT = ROUND(MY_F)-ROUND(F)-1; + OBJ_SUMIV(LL+F,R,T,P,'1',AGE+CNT) = YES; + ); + ); + ); +*----------------------------------------------------------------------------- +* Case IV.2.b: Surveillance ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) +*----------------------------------------------------------------------------- +* determine the number of repeated investments, if some relevant cost + LOOP((OBJ_2B(R,T(LL),P),CUR)$OBJ_DLAGC(R,T,P,CUR), + FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), + MY_F = B(T) + NCAP_ILED(R,T,P) + (OBJ_C-1) * NCAP_TLIFE(R,T,P); + F = ROUND(MY_F + NCAP_TLIFE(R,T,P)); Z = F + NCAP_DLAG(R,T,P); MY_F = MY_F-YEARVAL(T); + OBJ_SUMIVS(R,T,P,LL+MY_F,Y)$((YEARVAL(Y) >= F) AND (YEARVAL(Y) < Z)) = YES; + ); + ); + +*------------------------------------------------------------------------------ +* forget about PASTINV charges if not PASTInvestment +*------------------------------------------------------------------------------ + OBJ_SUMIV(OBJ_SUMIV(K_EOH,R,PASTMILE,P,JOT,AGE))$(NOT NCAP_PASTI(R,PASTMILE,P)) = NO; + OBJ_SUMIVS(OBJ_SUMIVS(R,PASTMILE,P,K,Y))$(NOT NCAP_PASTI(R,PASTMILE,P)) = NO; +*-----------------------------------------------------------------------------* +* precalculation of the PVF sum for the simple case is usually efficient + LOOP((OBJ_SUMIV(K,R,V,P,JOT,LIFE),RDCUR(R,CUR)),OBJ_LIFE(K,R,JOT,LIFE,CUR) = YES); + OPTION KAGE <= OBJ_LIFE; + INVSTEP(KAGE(LL,JOT),LL+(ORD(AGE)-1),AGE+(ORD(JOT)-ORD(AGE)))$OPYEAR(JOT,AGE) = YES; + LOOP(KAGE(K,JOT),OBJ_LIFE(LL,R,JOT,LIFE,CUR)$INVSTEP(K,JOT,LL,JOT) $= OBJ_LIFE(K,R,JOT,LIFE,CUR)); + OBJ_LIFE(K(LL),R,JOT,LIFE,CUR)$OBJ_LIFE(K,R,JOT,LIFE,CUR) = SUM((OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))),OBJ_DISC(R,Y_EOH,CUR)); +* Commissioning years +$IFI NOT '%CTST%'=='' $BATINCLUDE coef_alt.lin FIX * + INVSPRED(KAGE(LL,JOT),K,K)$INVSTEP(LL,JOT,K,JOT) = YES; +*-----------------------------------------------------------------------------* +* Reset OBJ_DIVIV to be the year divisor in the equation +* Only single commissioning year B(V)+ILED is taken for PASTMILE +$IFI NOT '%CTST%'=='' $GOTO EQUA + OBJ_DIVIV(OBJ_YES(R,PASTMILE,P)) = 1; + OBJ_DIVIV(OBJ_YES(R,T,P))$(NOT OBJ_1B(R,T,P)) = 1+(IPD(T)-1)$OBJ_1A(R,T,P); + IF(ALTOBJ, OBJ_DIVIV(OBJ_1B(OBJ_YES(R,T,P)))$((ROUND(NCAP_TLIFE(R,T,P))-IPD(T)%CTST%) GT 0) = IPD(T)); +$IFI '%VALIDATE%'==YES OBJ_DIVIV(OBJ_YES(R,T,P)) = 1; +*-----------------------------------------------------------------------------* + OPTION CLEAR=OBJ_YES, CLEAR=YKAGE; + + +$LABEL EQUA %2 +*=============================================================================== +* Generate Fixed Cost equation summing over all active indexes by region and currency +*=============================================================================== + %EQ%_OBJFIX(RDCUR(R,CUR) %SOW%) .. + +*------------------------------------------------------------------------------ +* Cases IV - Fixed O&M including surveillance during decommissioning, V - Taxes +*------------------------------------------------------------------------------ +* Fixed O&M Cost and Taxes + + SUM(OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE)$(NOT RTP_ISHPR(R,V,P)), + SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_LIFE(LL,R,JOT,LIFE,CUR) * %CAPWD% + (OBJ_FOM(R,K,P,CUR)+OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) / OBJ_DIVIV(R,V,P)) + + + SUM(OBJ_SUMIV(K_EOH,RTP_ISHPR(R,V,P),JOT,LIFE), + SUM((INVSPRED(K_EOH,JOT,LL,K),OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))), + OBJ_DISC(R,Y_EOH,CUR) * (1+SUM(PERIODYR(T,Y_EOH),RTP_CPX(R,V,P,T))$NCAP_CPX(R,V,P)) * %CAPWD% + ( + OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + + OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - + OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + ) + +* [UR] 07.10.2003: for validating MARKAL using VAR_CAP instead of VAR_NCAP+NCAP_PASTI, since it is possible +* in MARKAL to decommission capacity of demand devices (DMD) +$IF %VALIDATE% == 'YES' + *((SUM(PERIODYR(T(V),Y_EOH),%VART%_CAP(R,T,P %SWS%)))$(OBJ_1A(R,V,P)+OBJ_1B(R,V,P))+ +$IF %VALIDATE% == 'YES' (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))$(OBJ_2A(R,V,P)+OBJ_2B(R,V,P))) + + ) +$IF NOT %VALIDATE% == 'YES' + * (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) / OBJ_DIVIV(R,V,P) + ) + + +$IF DEFINED VNRET $BATINCLUDE prepret.dsc OBJFIX + +* Decommissioning Surveillance + SUM(OBJ_SUMIVS(R,V,P,K,Y), + OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * +* Case 2.a-b + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + (NCAP_PASTI(R,V,P)$PASTYEAR(V))$OBJ_2A(R,V,P)) + ) + + =E= + + SUM(OBV,SUM_OBJ('OBJFIX',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); + +* Clears in INITCLR.MOD diff --git a/eqobjfix.rpt b/eqobjfix.rpt new file mode 100644 index 0000000..4e38999 --- /dev/null +++ b/eqobjfix.rpt @@ -0,0 +1,60 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJFIX the objective functions capacity fixed costs +* %1 - mod or v# for the source code to be used +* - fixed O&M, including surveillance during decommissioning +* - fixed taxes and subsidies +*=============================================================================* + +*------------------------------------------------------------------------------ +* Cases IV - Fixed O&M including surveillance during decommissioning, V - Taxes +*------------------------------------------------------------------------------ +* Fixed O&M Cost and Taxes + + LOOP(OBJ_FCUR(NCAP_YES(R,V,P),CUR), + +$IF NOT %VALIDATE% == 'YES' + F = (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) / OBJ_DIVIV(R,V,P); + +* [UR] 07.10.2003: for validating MARKAL using VAR_CAP instead of VAR_NCAP+NCAP_PASTI, since it is possible +* in MARKAL to decommission capacity of demand devices (DMD) +$IF %VALIDATE% == 'YES' F = VAR_CAP.L(R,V,P)$(T(V)$(OBJ_1A(R,V,P)+OBJ_1B(R,V,P)))+F$(OBJ_2A(R,V,P)+OBJ_2B(R,V,P)); + +*------------------------------------------------------------------------------- + OPTION CLEAR=YKAGE; + LOOP((OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE),INVSTEP(K_EOH,JOT,LL,JOT)),YKAGE(Y_EOH(LL+(ORD(AGE)-1)),LL,AGE)$OPYEAR(LIFE,AGE) = YES;); +*------------------------------------------------------------------------------- + + IF(RTP_ISHPR(R,V,P), + PAR_OBJFIX(R,V,Y_EOH,P,CUR) = + OBJ_DISC(R,Y_EOH,CUR) * F * (1+SUM(PERIODYR(T,Y_EOH),RTP_CPX(R,V,P,T))$NCAP_CPX(R,V,P)) * + SUM(YKAGE(Y_EOH,K,AGE), + ( + OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + + OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - + OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + ) +$IF %VALIDATE% == 'YES' + $(PERIODYR(V,Y_EOH)*T(V)+OBJ_2A(R,V,P)+OBJ_2B(R,V,P)) + ); + ELSE + PAR_OBJFIX(R,V,Y_EOH,P,CUR) = + OBJ_DISC(R,Y_EOH,CUR) * F * + SUM(YKAGE(Y_EOH,K,AGE), (OBJ_FOM(R,K,P,CUR)+OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))); + )); + +* Decommissioning Surveillance + LOOP(OBJ_FCUR(NCAP_YES(R,V,P),CUR)$OBJ_DLAGC(R,V,P,CUR), + OPTION YK1 < OBJ_SUMIVS; + PAR_OBJFIX(R,V,Y,P,CUR) = PAR_OBJFIX(R,V,Y,P,CUR) + + SUM(YK1(Y,K), OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * + (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))); + ); + + OBJ_C = SUM((R,V,Y,P,CUR)$PAR_OBJFIX(R,V,Y,P,CUR),PAR_OBJFIX(R,V,Y,P,CUR)); + OBJ_D = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJFIX',OBV)*VAR_OBJ.L(R,OBV,CUR))); + DISPLAY OBJ_C,OBJ_D; + diff --git a/eqobjinv.mod b/eqobjinv.mod new file mode 100644 index 0000000..2bd0db9 --- /dev/null +++ b/eqobjinv.mod @@ -0,0 +1,324 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJINV the objective functions on investments +* - Investment Costs +* - Investmnet Tax/Subsidies +* - Decommissioning +*=============================================================================* +*GaG Questions/Comments: +* - Note that V=T in OBJ.DOC, but in the code V is assocated with the vintage year, +* that is the year of investment as distinguished from T = the current MILESTONYR +* - COEF_RPTI calculated in PPMAIN.MOD +* - combining all the INVs into a single equation at the moment +*----------------------------------------------------------------------------- +*$ONLISTING +* Discounting shift is zero unless the user says otherwise: +$IF NOT SET DISCSHIFT $SETGLOBAL DISCSHIFT 0 + +* If annual cost should be reported for TLIFE years and not just ELIFE, +* change INVLIF and DECLIF to TLIFE and DLIFE instead of ELIFE and DELIF +$SETGLOBAL INVLIF ELIFE +$SETGLOBAL DECLIF DELIF + +* For loop controls + ALIAS(AGE,JOT); + SCALARS OBJ_C /0/, OBJ_D /0/; +* OBJ coefficient SUM control set with the ALLYEAR indexes in sequence = +* V - investment vintage year, K - commissioning index, Y - decommissioning index + SET OBJ_SUMII(R,ALLYEAR,P,AGE,ALLYEAR,AGE) //; + SET OBJ_SUMIII(R,ALLYEAR,P,ALLYEAR,YEAR,ALLYEAR)//; + SET OBJ_YES(REG,ALLYEAR,P) //; + SET OBJ_I2(REG,ALLYEAR,P) //; + SET YKAGE(ALLYEAR,ALLYEAR,AGE) //; + SET KAGE(ALLYEAR,AGE) //; + SET OBJ_SPRED(R,ALLYEAR,P,AGE) //; + SET INVSTEP(ALLYEAR,AGE,ALLYEAR,AGE) //; + SET INVSPRED(ALLYEAR,AGE,ALLYEAR,ALLYEAR) //; + PARAMETER OBJ_PASTI(REG,ALLYEAR,P,CUR) //; + PARAMETER SALV_INV(REG,ALLYEAR,PRC,ALLYEAR) //; + PARAMETER COR_SALVI(REG,ALLYEAR,PRC,CUR) //; + PARAMETER COR_SALVD(REG,ALLYEAR,PRC,CUR) //; + PARAMETER OBJ_DIVI(REG,ALLYEAR,PRC) //; + PARAMETER OBJ_DIVIII(REG,ALLYEAR,PRC) //; + SET OBJ_IDC(R,ALLYEAR,P,LIFE,ALLYEAR,AGE); + PARAMETER OBJ_IAD(R,CUR); +*=============================================================================== +* Hold on to those RTPs for which some investment related cost is provided +*=============================================================================== +* Investment + RTP(R,PASTMILE,P)$(NCAP_PASTI(R,PASTMILE,P)=0) = NO; + OBJ_ICUR(RTP(R,V,P),CUR)$(OBJ_ICOST(R,V,P,CUR) + OBJ_ISUB(R,V,P,CUR) + OBJ_ITAX(R,V,P,CUR)) = YES; +* if ETL technology then going to do it as well +$IF '%ETL%'==YES OBJ_ICUR(RTP(R,V,TEG),CUR)$G_RCUR(R,CUR) = YES; +* Decommissioning + OBJ_ICUR(RTP(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR) = YES; + LOOP(CUR,OBJ_SUMS3(RTP(R,V,P))$OBJ_DCOST(R,V,P,CUR) = YES); + LOOP((RTP,COM)$NCAP_OCOM(RTP,COM),OBJ_SUMS3(RTP) = YES); +* Currency independent OBJ_YES + OBJ_ICUR(RTP_OFF,CUR)$(NOT NCAP_PASTI(RTP_OFF)) = NO; + OBJ_ICUR(R,LL,P,CUR)$(NOT RDCUR(R,CUR)) = NO; + OPTION OBJ_YES < OBJ_ICUR; OBJ_YES(OBJ_SUMS3) = YES; + +* Correct small TLIFE and DLIFE values, because rounded values are used as divisors + NCAP_TLIFE(OBJ_YES(R,V,P))$(ROUND(NCAP_TLIFE(R,V,P)) LE 0) = 1; + NCAP_ELIFE(OBJ_YES(R,V,P))$(ROUND(NCAP_ELIFE(R,V,P)) LE 0) = 1; + NCAP_DLIFE(OBJ_SUMS3(R,V,P))$(ROUND(NCAP_DLIFE(R,V,P)) LE 0) = 1; + NCAP_DELIF(OBJ_SUMS3(R,V,P)) = MAX(1,NCAP_DELIF(R,V,P)); +* Classify processes into I1 / I2 Cases + OBJ_I2(RTP)$NCAP_ILED(RTP) = YES; + LOOP(SAMEAS(LIFE,'1'),OBJ_SPRED(OBJ_YES(R,V,P),LIFE+MAX(0,MIN(CARD(AGE),NCAP_%INVLIF%(R,V,P))-1))=YES); +*------------------------------------------------------------------------------ +* COR_SALVI can be used to take into account technology-specific discount rate +* Take also into account a user-defined discounting shift (0/0.5/1 years): + COR_SALVI(OBJ_ICUR(R,V,P,CUR))=(((((1+NCAP_DRATE(R,V,P))/(1+OBJ_RFR(R,V,CUR)))**%DISCSHIFT%)* + ((1-1/(1+NCAP_DRATE(R,V,P)))*(1-(1+OBJ_RFR(R,V,CUR))**(-NCAP_ELIFE(R,V,P))))/ + ((1-1/(1+OBJ_RFR(R,V,CUR)))*(1-(1+NCAP_DRATE(R,V,P))**(-NCAP_ELIFE(R,V,P)))) + -1)$(NCAP_DRATE(R,V,P) GT 0) + 1)*(1+G_DRATE(R,V,CUR))**%DISCSHIFT%; + COR_SALVI(OBJ_ICUR(OBJ_I2(R,V,P),CUR)) = COR_SALVI(R,V,P,CUR) / ((1+G_DRATE(R,V,CUR))**%DISCSHIFT%); +* OBJ_CRF/OBJ_CRFD must now be based on G_DRATE because we use COR_SALVI and COR_SALVD for the correction + OBJ_CRF(OBJ_ICUR(R,V,P,CUR)) = COR_SALVI(R,V,P,CUR) * (1-(1/(1+G_DRATE(R,V,CUR)))) / (1-(1+G_DRATE(R,V,CUR))**(-ROUND(NCAP_%INVLIF%(R,V,P)))); +*------------------------------------------------------------------------------ +* OBJ_PASTI is the correction for past investments (similar to SALV_INV fraction) + OBJ_PASTI(OBJ_ICUR(RTP(R,PASTYEAR(V),P),CUR)) = NCAP_PASTI(R,V,P) * + MAX(0,MIN(1,(((1+G_DRATE(R,V,CUR))**(YEARVAL(V)+ROUND(NCAP_ILED(R,V,P))-MINYR+NCAP_%INVLIF%(R,V,P))-1) / + ((1+G_DRATE(R,V,CUR))**NCAP_%INVLIF%(R,V,P)-1)))); +*------------------------------------------------------------------------------ +* Operating years for all technical lifetimes + Z=SMAX((RTP(R,PYR_S(V),P),T)$PRC_RESID(R,T,P),E(T))-MIYR_V1+2; + MAXLIFE = MAX(SMAX(T,2*D(T)),Z,CEIL(MAXLIFE)); + OPYEAR(LIFE,AGE)$((ORD(AGE) LE ORD(LIFE))$(ORD(LIFE) LE MAXLIFE)) = YES; +*-------------------------------------------------------------------------------------- +$ SET ZHALF "CEIL(Z/2-.5)" SET ISTEP IPD(T) +$ IF NOT '%CTST%'=='' $SET ZHALF "FLOOR(ROUND(Z)/2)" SET ISTEP MIN(IPD(T),ROUND(Z)) +*=============================================================================== +* Case 1.a: ILEDt <= ILEDmin,t and TLIFEt + ILEDt >= D(t) +*=============================================================================== + OBJ_1A(RTP(R,V,P))$((NOT OBJ_I2(R,V,P))$(COEF_RPTI(R,V,P) LT 1.01)) = YES; +*------------------------------------------------------------------------------ +* build trapazoid covering year and number of payment blocks for a process +*------------------------------------------------------------------------------ +* - K is EACHYEAR +* beginning from the +* MAX(period length before the middle year of the current (investment) +* period, or the current year - the economic lifetime + 1) +* until the +* MIN(middle year of the current (investment) period - 1, or the year +* calculating) +*=============================================================================== +* Case I/II.1.a: Investment/Tax&Sub ILEDt <= ILEDmin,t and TLIFEt + ILEDt >= D(t) +*=============================================================================== +* there is a relevant cost +*V1.3a speed up code a bit +$IF '%VALIDATE%' == 'YES' $GOTO M2T + +* Set period parameters for Case 1a: + FIL2(V) = (IPD(V)-1)$T(V); + MY_ARRAY(V) = B(V)-YEARVAL(V) + (M(V)-B(V)-FIL2(V))$T(V); + LOOP(SAMEAS(AGE,'1'), +* K is both investment year and cost/commissioning year + OBJ_SUMII(OBJ_SPRED(OBJ_1A(R,V(LL),P),LIFE),K(LL+MY_ARRAY(LL)),AGE+FIL2(V)) = YES; + ); + +$GOTO CONT +* create square for investment costing if validating MARKAL +$LABEL M2T +* Y is investment year, V is cost basis year + OBJ_SUMII(OBJ_SPRED(OBJ_1A(R,V,P),LIFE),Y,'1')$(YEARVAL(Y) = B(V)) = YES; +$LABEL CONT +*=============================================================================== +* Case 1.b: ILEDt <= ILEDmin,t and TLIFEt + ILEDt < D(t) +* Note - no PASTINV as TLIFE always >= D(t) which = 1 +*=============================================================================== + OBJ_1B(RTP(R,T,P))$((NOT OBJ_I2(R,T,P))$(NOT OBJ_1A(R,T,P))) = YES; +*=============================================================================== +* Case I/II.1.b: Investment/Tax&Sub ILEDt <= ILEDmin,t and TLIFEt + ILEDt < D(t) +* Note - no PASTINV as TLIFE always >= D(t) which = 1 +*=============================================================================== +*------------------------------------------------------------------------------ +* build repeated investment blocks until end of lifetime +*------------------------------------------------------------------------------ +* calculate the contribution in each year, if there is a cost +$IF '%VALIDATE%' == 'YES' $GOTO M2T_2 + LOOP(SAMEAS(AGE,'1'), + LOOP(OBJ_SPRED(OBJ_1B(R,T(LL),P),LIFE), + Z = NCAP_TLIFE(R,T,P); +* Slightly different handling according to objective formulation + IF((ROUND(Z)-IPD(T)%CTST%) LE 0, + F = B(T) - %ZHALF% - YEARVAL(T); + Z = ROUND(COEF_RPTI(R,T,P)*Z)-1; +* LL+F is both first investment year and first cost/commissioning year + OBJ_SUMII(R,T,P,LIFE,K(LL+F),AGE+Z) = YES; + ELSE CNT = %ISTEP%; F = B(T)-YEARVAL(T)-FLOOR(CNT/2); CNT = CNT-1; + FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), + OBJ_SUMII(R,T,P,LIFE,K(LL+F),AGE+CNT) = YES; F = F+Z)); + ); + ); + +$GOTO CONT_2 +* create square for investment costing if validating MARKAL +$LABEL M2T_2 + LOOP(OBJ_SPRED(OBJ_1B(R,T(LL),P),LIFE), + Z = NCAP_TLIFE(R,T,P); + FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), + F = B(T) + ROUND((OBJ_C-1)*Z) - YEARVAL(T); +* Y is investment year, T is cost basis year + OBJ_SUMII(R,T,P,LIFE,Y(LL+F),'1') = YES); + ); +$LABEL CONT_2 +*=============================================================================== +* Case 2.a: ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) +*=============================================================================== + OBJ_2A(OBJ_I2(R,V,P))$(COEF_RPTI(R,V,P) LE 1) = YES; +*=============================================================================== +* Case I/II.2.a: Investment/Tax&Sub ILEDt > ILEDmin,t and TLIFEt + ILEDt >= D(t) +*=============================================================================== +*------------------------------------------------------------------------------ +* build trapazoid covering year and number of payment blocks for a process +* - K is EACHYEAR +* for MILESTONYR or PASTYEAR +* beginning from the +* MAX(beginning of the period, or the current year - the economic lifetime + 1) +* until the +* MIN(beginning of the period + leadtime - 1, or the year calculating) +*------------------------------------------------------------------------------ +* there is a relevant cost + LOOP(SAMEAS(AGE,'1'), + LOOP(OBJ_SPRED(OBJ_2A(R,V(LL),P),LIFE), + Z = NCAP_ILED(R,V,P); MY_F = B(V)-YEARVAL(V)+Z; +* LL+F is investment year; LL+MY_F is commissioning year (cost basis) + OBJ_IDC(R,V,P,LIFE,LL+MY_F,AGE+MAX(0,Z-1)) = YES; + )); +*=============================================================================== +* Case 2.b: ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) +* Note - no PASTINV as TLIFE always >= D(t) which = 1 +*=============================================================================== + OBJ_2B(OBJ_I2(R,T,P))$(NOT OBJ_2A(R,T,P)) = YES; +*=============================================================================== +* Case I/II.2.b: Investment/Tax&Sub ILEDt > ILEDmin,t and TLIFEt + ILEDt < D(t) +* Note - no PASTINV as TLIFE always >= D(t) which = 1 +*=============================================================================== +*------------------------------------------------------------------------------ +* build repeated investment blocks until end of lifetime +*------------------------------------------------------------------------------ +* calculate the contribution in each year, if there is a cost + LOOP(SAMEAS(AGE,'1'), + LOOP(OBJ_SPRED(OBJ_2B(R,T(LL),P),LIFE), + FOR(OBJ_C = 1 TO COEF_RPTI(R,T,P), + Z = NCAP_ILED(R,T,P); + MY_F = ROUND(B(T)+(OBJ_C-1)*NCAP_TLIFE(R,T,P))-YEARVAL(T)+Z; +* LL+F is investment year; LL+MY_F is commissioning year (cost basis) + OBJ_IDC(R,T,P,LIFE,LL+MY_F,AGE+MAX(0,Z-1)) = YES); + )); + +*=============================================================================== +* Calculate Interest During Construction (IDC) for any fractional ILED +* Note: Zero ILED represents half year's interest, consistently + LOOP(OBJ_ICUR(OBJ_I2(R,V,P),CUR), Z = COEF_ILED(R,V,P); + IF(Z, OBJ_C=1+G_DRATE(R,V,CUR); MY_F=0; F=0; +*..Interest according to rounded spreads using actual discount rates + LOOP(OBJ_IDC(R,V,P,LIFE,LL,JOT), CNT=ORD(JOT); + MY_F=MY_F+SUM((OPYEAR(JOT,AGE),YEAR(LL-ORD(AGE))),OBJ_DISC(R,YEAR,CUR)); F=F+OBJ_DISC(R,LL,CUR)); + MY_F = MY_F/F/CNT-1; +*..Interest according to rounded and accurate spreads using constant discount rate + F = ((OBJ_C**CNT)-1)/(1-1/OBJ_C)/CNT-1; + CNT = MAX(0.001,Z); + Z = ((OBJ_C**CNT)-1)/(1-1/OBJ_C)/CNT-1; + ELSE F=1); OBJ_DIVI(R,V,P) = 1/(1+Z*MY_F/F)); +* Add spread header tuples + OBJ_SUMII(R,V,P,LIFE,LL,JOT+(1-ORD(JOT)))$OBJ_IDC(R,V,P,LIFE,LL,JOT) = YES; + OPTION CLEAR=OBJ_IDC; + +*=============================================================================== +* Generate the Investment spreads +*=============================================================================== + OPTION KAGE < OBJ_SUMII; + INVSTEP(KAGE(LL,JOT),LL+(ORD(AGE)-1),AGE+(ORD(JOT)-ORD(AGE)))$OPYEAR(JOT,AGE) = YES; +$IF NOT '%CTST%'=='' $BATINCLUDE coef_alt.lin INV + INVSPRED(LL,JOT,K,K)$INVSTEP(LL,JOT,K,JOT) = YES; + +*=============================================================================== +* Case III.1.a-b, III.2.a-b: Decommissioning +*=============================================================================== + OPTION CLEAR=UNCD7; +* Collect header tuples for decommissioning spreads + UNCD7(OBJ_SUMS3(R,V,P),LIFE+(NCAP_DLIFE(R,V,P)-ORD(LIFE)),LL--(ORD(LL)$OBJ_I2(R,V,P)),LL,JOT)$OBJ_SUMII(R,V,P,LIFE,LL,JOT) = YES; + +* Generate the Decommissioning spreads + OPTION CLEAR = YKAGE; + LOOP(UNCD7(R,V,P,LIFE,LASTLL(LL),K,JOT),YKAGE(LL,K,LIFE) = YES); + LOOP(YKAGE(YEAR,K(LL),JOT),INVSPRED(YEAR,AGE+(ORD(JOT)-ORD(AGE)),LL+(ORD(AGE)-1),K)$OPYEAR(JOT,AGE) = YES); + LOOP(UNCD7(R,V,P,LIFE,YEAR,K_EOH,JOT), F = CEIL(NCAP_TLIFE(R,V,P)+NCAP_DLAG(R,V,P)); +* K is commissioning year (cost basis), LL+F is decommissioning year + IF(LASTLL(YEAR), + OBJ_SUMIII(R,V,P,K(K_EOH),K,LL+F)$INVSPRED(YEAR,LIFE,LL,K_EOH) = YES; + ELSE OBJ_SUMIII(R,V,P,LL, K,LL+F)$INVSPRED(K_EOH,JOT,LL,K) = YES)); + INVSPRED('0',JOT,YEAR,K) = NO; + +*------------------------------------------------------------------------------ +* The equation divisors for investments: +$IF NOT '%CTST%'=='' $GOTO CLRS + OBJ_DIVI(OBJ_YES(OBJ_1A(R,V,P))) = 1+(IPD(V)-1)$MILESTONYR(V); + OBJ_DIVI(OBJ_YES(OBJ_1B(R,T,P))) = NCAP_TLIFE(R,T,P); + IF(ALTOBJ,OBJ_DIVI(OBJ_YES(OBJ_1B(R,T,P)))$((ROUND(NCAP_TLIFE(R,T,P))-IPD(T)%CTST%) GT 0) = IPD(T)*MIN(1,NCAP_TLIFE(R,T,P))); +$IF '%VALIDATE%'== YES OBJ_DIVI(OBJ_YES(R,T,P))$(NOT OBJ_I2(R,T,P)) = 1; +* The equation divisors for decommissioning : + OBJ_DIVIII(OBJ_SUMS3(R,V,P)) = OBJ_DIVI(R,V,P); + OBJ_DIVIII(OBJ_SUMS3(OBJ_I2(R,V,P))) = ROUND(NCAP_DLIFE(R,V,P)); +$IF '%VALIDATE%' == YES OPTION CLEAR=OBJ_PASTI; +*------------------------------------------------------------------------------ +$LABEL CLRS + OPTION CLEAR = OBJ_YES, CLEAR = OBJ_SUMS3, CLEAR = YKAGE; + OPTION CLEAR = INVSTEP, CLEAR = OBJ_SPRED, CLEAR = OBJ_I2; + +$LABEL EQUA %2 +*=============================================================================== +* Generate Investment equation summing over all active indexes by region and currency +*=============================================================================== + %EQ%_OBJINV(RDCUR(R,CUR) %SOW%) .. + +*------------------------------------------------------------------------------ +* Cases I - Investment Cost and II - Taxes/Subsidies +*------------------------------------------------------------------------------ + + SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT)$OBJ_ICUR(R,T,P,CUR), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,Y,K), OBJ_DISC(R,K,CUR) * + (OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))) * + COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * %VART%_NCAP(R,T,P %SWS%) + +* handle ETL +$IF '%ETL%'==YES + SUM(G_RCUR(R,CUR),%VART%_IC(R,T,P %SWS%)*SUM(INVSPRED(K_EOH,JOT,Y,K),OBJ_DISC(R,K,CUR))*COR_SALVI(R,T,P,CUR)/OBJ_DIVI(R,T,P))$SEG(R,P) + ) + + + +$IFI NOT %STAGES%==YES $GOTO PASTI + SUM((OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT),SW_TSW(SOW,T,WW))$OBJ_SIC(R,T,P,WW), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,Y,K), OBJ_DISC(R,K,CUR) * OBJ_ICOST(R,K,P,CUR) * (1-SALV_INV(R,T,P,Y))) * + OBJ_SIC(R,T,P,WW) * COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * %VAR%_NCAP(R,T,P %SWD%)) + +$LABEL PASTI + +* PASTI charge + SUM(OBJ_SUMII(R,PASTYEAR(V),P,LIFE,K_EOH,JOT)$OBJ_PASTI(R,V,P,CUR), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_DISC(R,K,CUR) * + (OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))) * + OBJ_PASTI(R,V,P,CUR) * COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)) + + + OBJ_IAD(R,CUR) + + +*------------------------------------------------------------------------------ +* Cases III - Decommissioning +*------------------------------------------------------------------------------ + + SUM(OBJ_SUMIII(R,V,P,LL,K,Y)$OBJ_DCOST(R,V,P,CUR), + OBJ_DISC(R,Y,CUR) * COR_SALVD(R,V,P,CUR) * OBJ_DCOST(R,K,P,CUR) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + OBJ_PASTI(R,V,P,CUR)$PASTYEAR(V)) / OBJ_DIVIII(R,V,P)) + + + =E= + + SUM(OBV,SUM_OBJ('OBJINV',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); + + +*$OFFLISTING diff --git a/eqobjinv.rpt b/eqobjinv.rpt new file mode 100644 index 0000000..bdf0ac7 --- /dev/null +++ b/eqobjinv.rpt @@ -0,0 +1,69 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJINV the objective functions on investments +* - Investment Costs +* - Investment Tax/Subsidies +* - Decommissioning +*=============================================================================* + + SCALAR VDISC / 0 /; + SET NCAP_YES(R,ALLYEAR,P); + PARAMETER OBJ_SUMIK(REG,ALLYEAR,PRC,CUR); + PARAMETER YKAGEP(ALLYEAR,ALLYEAR,AGE); +*------------------------------------------------------------------------------ +* Identify new capacities + NCAP_YES(RTP(R,V,P))$(VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) = YES; + NCAP_YES(R,LL--ORD(LL),P)$NCAP_YES(R,LL,P) = YES; +*------------------------------------------------------------------------------ +* Cases I - Investment Cost and II - Taxes/Subsidies +*------------------------------------------------------------------------------ +OBJ_SUMIK(R,K,P,CUR)$((OBJ_ICOST(R,K,P,CUR)+OBJ_ITAX(R,K,P,CUR)+OBJ_ISUB(R,K,P,CUR))$NCAP_YES(R,'0',P)) = + OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR); + +* Calculate Annual discounted investment costs PAR_OBJINV +* VDISC is the constant discount rate used to discount annual payments to the investment year LL +LOOP(OBJ_ICUR(NCAP_YES(R,V,P),CUR), + F = (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) * OBJ_CRF(R,V,P,CUR)/OBJ_DIVI(R,V,P); + VDISC = 1+G_DRATE(R,V,CUR); OPTION CLEAR = YKAGEP; + LOOP((OBJ_SUMII(R,V,P,LIFE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K)), + MY_F=F*OBJ_DISC(R,LL,CUR)*OBJ_SUMIK(R,K,P,CUR); YKAGEP(LL+(ORD(AGE)-1),LL,AGE)$OPYEAR(LIFE,AGE) = MY_F); + PAR_OBJINV(R,V,Y,P,CUR) = SUM((LL,AGE)$YKAGEP(Y,LL,AGE),YKAGEP(Y,LL,AGE)*VDISC**(1-ORD(AGE))); +); + +* Handle ETL +$IF NOT %ETL% == 'YES' $GOTO ETLDONE +LOOP(OBJ_ICUR(R,T,TEG(P),CUR)$VAR_IC.L(R,T,P), + F = OBJ_CRF(R,T,P,CUR)*VAR_IC.L(R,T,P)/OBJ_DIVI(R,T,P); VDISC = 1+G_DRATE(R,T,CUR); OPTION CLEAR = YKAGEP; + LOOP((OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K)), + MY_F = F*OBJ_DISC(R,LL,CUR); YKAGEP(LL+(ORD(AGE)-1),LL,AGE)$OPYEAR(LIFE,AGE) = MY_F); + PAR_OBJINV(R,T,Y,P,CUR) = PAR_OBJINV(R,T,Y,P,CUR) + SUM((LL,AGE)$YKAGEP(Y,LL,AGE),YKAGEP(Y,LL,AGE)*VDISC**(1-ORD(AGE))); +); +$LABEL ETLDONE + +*------------------------------------------------------------------------------ +* Check that total OBJINV value is the same in all calculation methods: +* PAST Investments cannot be accurately matched in case 2a; therefore check with OBJ_PASTI + OBJ_C = SUM((R,T,Y,P,CUR)$PAR_OBJINV(R,T,Y,P,CUR),PAR_OBJINV(R,T,Y,P,CUR)) + + SUM((OBJ_SUMII(R,PASTMILE(V),P,AGE,K_EOH,JOT),CUR),COR_SALVI(R,V,P,CUR)/OBJ_DIVI(R,V,P)* + SUM(INVSPRED(K_EOH,JOT,YEAR,K),OBJ_DISC(R,YEAR,CUR)*OBJ_SUMIK(R,K,P,CUR)*OBJ_PASTI(R,V,P,CUR))); + OBJ_D = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJINV',OBV)*VAR_OBJ.L(R,OBV,CUR))); + + DISPLAY OBJ_C,OBJ_D; + OPTION CLEAR=OBJ_SUMIK; + +*------------------------------------------------------------------------------ +* Cases III - Decommissioning +*------------------------------------------------------------------------------ + +* Calculate Annual discounted decommissioning costs PAR_OBJDEC +* VDISC is the constant discount rate used to discount annual payments to the investment year LL +LOOP((NCAP_YES(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR), + F = (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)$PYR(V)) * OBJ_CRFD(R,V,P,CUR)/OBJ_DIVIII(R,V,P); + VDISC = 1+G_DRATE(R,V,CUR); Z = ROUND(NCAP_%DECLIF%(R,V,P))-1; + PAR_OBJDEC(R,V,Y,P,CUR) = + SUM((OBJ_SUMIII(R,V,P,K_EOH,K,LL),YK(LL+Z,Y))$YK(Y,LL), + F * OBJ_DCOST(R,K,P,CUR) * OBJ_DISC(R,LL,CUR) * VDISC**(YEARVAL(LL)-YEARVAL(Y))); +); diff --git a/eqobjvar.mod b/eqobjvar.mod new file mode 100644 index 0000000..ec1e334 --- /dev/null +++ b/eqobjvar.mod @@ -0,0 +1,113 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJVAR the objective functions variable costs, variable O&M and commodity +* direct costs +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Questions/Comments: +* - Top-level SUM over Y_EOH moved to individual components +* - This version works for the alternative objective formulations ALT/LIN +*----------------------------------------------------------------------------- +$SET TPULSE PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR) +$IFI %OBJ%==ALT $SET TPULSE PERIODYR(T,Y_EOH),OBJ_ALTV(R,T)*OBJ_DISC(R,Y_EOH,CUR) +$IFI %OBJ%==LIN $SET TPULSE TPULSEYR(T,Y_EOH),TPULSE(T,Y_EOH)*OBJ_DISC(R,Y_EOH,CUR) +$IFI %VARCOST%==LIN $SET TPULSE Y_EOH$OBJ_LINT(R,T,Y_EOH,CUR),OBJ_LINT(R,T,Y_EOH,CUR) +*=============================================================================== +* Generate Variable cost equation summing over all active indexes by region and currency +*=============================================================================== + +%2 %EQ%_OBJVAR(RDCUR(R,CUR) %SOW%) .. + +$IF %STAGES% == YES $SETLOCAL SWTD 'SUM(SW_TSW(SOW,T,WW),' SET SOW ',WW' + (%SWTD% +*------------------------------------------------------------------------------ +* Costs on Overall activity of a process +*------------------------------------------------------------------------------ +* multiply storage activity by average residence time + SUM(RTP_VARA(R,T,P)$OBJ_ACOST(R,T,P,CUR), + SUM(%TPULSE% * OBJ_ACOST(R,Y_EOH,P,CUR)) * + SUM((RTP_VINTYR(R,V,T,P),PRC_TS(R,P,S)),%VAR%_ACT(R,V,T,P,S %SOW%) * + POWER(RS_STGAV(R,S),1$RP_STG(R,P))) + ) + +* modal costs if modeled + SUM(RTP_VINTYR(R,V,T,P)$RPC_CUR(R,P,%PGPRIM%,CUR), + SUM(RP_UPS(R,P,TSL,L('UP')),ACT_CSTUP(R,V,P,TSL,CUR)*OBJ_PVT(R,T,CUR)*SUM(TS_GROUP(R,TSL,S),RS_STGPRD(R,S)*%VAR%_UPS(R,V,T,P,S,L%SOW%))) + + SUM(RP_UPT(R,P,UPT,'UP'),ACT_CSTSD(R,V,P,UPT,'FX',CUR)*OBJ_PVT(R,T,CUR)*SUM(TS_GROUP(R,TSL,S)$RP_DPL(R,P,TSL),RS_STGPRD(R,S)*%VAR%_UPT(R,V,T,P,S,UPT%SOW%))) + + SUM(RP_UPR(R,P,BDNEQ(BD)),ACT_CSTRMP(R,V,P,BD,CUR)*OBJ_PVT(R,T,CUR)*SUM(PRC_TS(R,P,S),RS_STGPRD(R,S)*%VAR%_UDP(R,V,T,P,S,BD%SOW%)))) + + +*------------------------------------------------------------------------------ +* Commodity added costs and sub/tax +*------------------------------------------------------------------------------ + SUM(RHS_COMBAL(R,T,C,S), %VAR%_COMNET(R,T,C,S %SOW%) * + SUM(%TPULSE% * SUM(COSTYPE,OBJ_COMNT(R,Y_EOH,C,S,COSTYPE,CUR)))) + + SUM(RHS_COMPRD(R,T,C,S), %VAR%_COMPRD(R,T,C,S %SOW%) * + SUM(%TPULSE% * SUM(COSTYPE,OBJ_COMPD(R,Y_EOH,C,S,COSTYPE,CUR)))) + +$IFI %STAGES%==YES SUM((RTCS_VARC(R,T,C,S),COM_VAR,W(WW))$S_COM_TAX(R,T,C,S,COM_VAR,CUR,'1',W),SUM(Y_EOH(Y)$OBJ_LINT(R,T,Y,CUR),OBJ_LINT(R,T,Y,CUR)*S_COM_TAX(R,Y,C,S,COM_VAR,CUR,'1',W))*(%VAR%_COMPRD(R,T,C,S%SOW%)$DIAG('PRD',COM_VAR)+%VAR%_COMNET(R,T,C,S%SOW%)$DIAG('NET',COM_VAR))) + + +*------------------------------------------------------------------------------ +* Commodity costs/tax/sub associated with imports/exports from outside study area +* - note that price only applied when actually an external region +*------------------------------------------------------------------------------ + SUM((RTPCS_VARF(R,T,P,C,S),RPC_IREIO(R,P,C,IE,'OUT')), + SUM(%TPULSE% * OBJ_IPRIC(R,Y_EOH,P,C,S,IE,CUR)) * + SUM(RTP_VINTYR(R,V,T,P), + (%VAR%_IRE(R,V,T,P,C,S,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) + ) + ) + + +*------------------------------------------------------------------------------ +* Flow level costs/tax/sub +*------------------------------------------------------------------------------ +*GG* need to add VAR_NCAP if I/O/COM and FLO_COST/DELIV/SUB/TAX for commodity +* based upon RPC_CAPFLOr,t,p,c + SUM(RTPCS_VARF(R,T,P,C,S)$SUM(OBJ_VFLO(RP_FLO(R,P),C,CUR,UC_COST),1), + SUM(TS_ANN(S,TS), + SUM(%TPULSE% * (OBJ_FCOST(R,Y_EOH,P,C,TS,CUR)+OBJ_FDELV(R,Y_EOH,P,C,TS,CUR)+OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * + SUM(RTP_VINTYR(R,V,T,P), +$ BATINCLUDE %cal_red% C COM S P T + )) + + +* same for IRE processes + SUM(RTPCS_VARF(R,T,P,C,S)$SUM(OBJ_VFLO(RP_IRE(R,P),C,CUR,UC_COST),1), + SUM(TS_ANN(S,TS), + SUM(%TPULSE% * (OBJ_FCOST(R,Y_EOH,P,C,TS,CUR)+OBJ_FDELV(R,Y_EOH,P,C,TS,CUR)+OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)))) * + SUM(RTP_VINTYR(R,V,T,P), + SUM(RPC_IRE(R,P,C,IE), + %VAR%_IRE(R,V,T,P,C,S,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) + ) + +*V06a_3 handle aux delivery cost to exchange processes, BUT NOT HANDLING different TSlevel!!! +* Negative IRE_FLOSUM is resonable for import flows only, and for the commodity itself +$IF DEFINED RTP_FFCS $SET MX "*(%SHFF%S(R,V,P,C,C%SOW%))" + SUM((RPC_IRE(R,P,COM,IE),IO)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO), + IRE_FLOSUM(R,T,P,COM,S,IE,C,IO) %MX% * + (%VAR%_IRE(R,V,T,P,COM,S,IE %SOW%)$(NOT RPC_AIRE(R,P,COM))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM)) + ))) + +*V3.3.3 support costs also for storage flows (FCOST for IN, FDELV for OUT) + SUM(OBJ_VFLO(RPC_STG(R,P,C),CUR,'COST'), + SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,S)), + SUM(TS_ANN(S,TS),SUM(%TPULSE% * (%VAR%_SIN(R,V,T,P,C,S%SOW%)*OBJ_FCOST(R,Y_EOH,P,C,TS,CUR)+%VAR%_SOUT(R,V,T,P,C,S%SOW%)*STG_EFF(R,V,P)*OBJ_FDELV(R,Y_EOH,P,C,TS,CUR)))))) +$IF %STAGES%==YES ) + ) + + +*V05c 980924 handle the fact that commodity costs may be associated with capacity +* note that G_YRFR fraction in the cal_*.mod files +* [AL] Moved cost summation over TPULSEYR inside called routines; V must be in RTP, but T need not be + SUM(ANNUAL(S), +$ BATINCLUDE cal_caps.%1 T 'SUM(TS_ANN(TS,SL),SUM(%TPULSE%*(OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR))))' TS + ) + + +*------------------------------------------------------------------------------ +* Commodity blending costs +*------------------------------------------------------------------------------ + SUM((BLE_OPR(R,BLE,OPR),TT(T)), + SUM(%TPULSE% * OBJ_BLNDV(R,Y_EOH,BLE,OPR,CUR)) * %VART%_BLND(R,T,BLE,OPR %SWS%) + ) + + =E= + +$IF %STAGES% == YES $SET SOW ',SOW' + +%2 SUM(OBV,SUM_OBJ('OBJVAR',OBV)*%VAR%_OBJ(R,OBV,CUR %SOW%)); diff --git a/eqobjvar.rpt b/eqobjvar.rpt new file mode 100644 index 0000000..b5b8bf6 --- /dev/null +++ b/eqobjvar.rpt @@ -0,0 +1,181 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJVAR - the variable O&M, flow and commodity direct costs +* %1 - mod or prefix +* %2 - '1', or J(UNCD1), +* %3 - '2', or J(UNCD1), +* %4 - T OR Y_EOH +* %5 - SUM or '' +*------------------------------------------------------------------------------ +$IFI '%1'==MOD $GOTO LEGACY +$IFI '%5'=='' $SET TPULSE '' SET TMP '' +$IFI %STAGES%==YES Z=SUM(W(SOW),SW_PROB(W)); +*------------------------------------------------------------------------------ + OPTION CLEAR=%1_ACTC,CLEAR=%1_COMC,CLEAR=%1_FLOC; +*------------------------------------------------------------------------------ +* Costs based on overall activity of process +*------------------------------------------------------------------------------ + + %1_ACTC(%2RTP_VINTYR(R,V,T,P),%PGPRIM%,CUR)$(RDCUR(R,CUR)$OBJ_ACOST(R,T,P,CUR)) = + %5(%TPULSE% OBJ_ACOST(R,%4,P,CUR)) * + SUM(PRC_TS(R,P,S), VAR_ACT.L(R,V,T,P,S) * POWER(RS_STGAV(R,S),1$RP_STG(R,P))); + %1_ACTC(%3RTP_VINTYR(R,V,T,P),C(%PGPRIM%),CUR)$RPC_CUR(R,P,C,CUR) = + SUM(RP_UPS(R,P,TSL,L('UP')),%5(%TPULSE% ACT_CSTUP(R,V,P,TSL,CUR))*SUM(TS_GROUP(R,TSL,S),RS_STGPRD(R,S)*VAR_UPS.L(R,V,T,P,S,L))) + + SUM(RP_UPT(R,P,UPT,'UP'),%5(%TPULSE% ACT_CSTSD(R,V,P,UPT,'FX',CUR)*SUM(TS_GROUP(R,TSL,S)$RP_DPL(R,P,TSL),RS_STGPRD(R,S)*VAR_UPT.L(R,V,T,P,S,UPT)))) + + SUM(RP_UPR(R,P,BDNEQ(BD)),%5(%TPULSE% ACT_CSTRMP(R,V,P,BD,CUR))*SUM(PRC_TS(R,P,S),RS_STGPRD(R,S)*VAR_UDP.L(R,V,T,P,S,BD))); + +*------------------------------------------------------------------------------ +* Commodity added costs and sub/tax +*------------------------------------------------------------------------------ + %1_COMC(%2R,T,C,CUR)$RDCUR(R,CUR) $= + SUM(RHS_COMBAL(R,T,C,S), VAR_COMNET.L(R,T,C,S) * %5(%TPULSE% OBJ_COMNT(R,%4,C,S,'COST',CUR))) + + SUM(RHS_COMPRD(R,T,C,S), VAR_COMPRD.L(R,T,C,S) * %5(%TPULSE% OBJ_COMPD(R,%4,C,S,'COST',CUR))); + %1_COMC(%3R,T,C,CUR)$RDCUR(R,CUR) $= + SUM(RHS_COMBAL(R,T,C,S), VAR_COMNET.L(R,T,C,S) * %5(%TPULSE% (OBJ_COMNT(R,%4,C,S,'TAX',CUR)+OBJ_COMNT(R,%4,C,S,'SUB',CUR)))) + + SUM(RHS_COMPRD(R,T,C,S), VAR_COMPRD.L(R,T,C,S) * %5(%TPULSE% (OBJ_COMPD(R,%4,C,S,'TAX',CUR)+OBJ_COMPD(R,%4,C,S,'SUB',CUR)))); +$IFI %STAGES%==YES + %1_COMC(%3RTC(R,T,C),CUR)$RDCUR(R,CUR) $= SUM((RTCS_VARC(RTC,S),COM_VAR,SW_TSW(SOW,T,W))$S_COM_TAX(RTC,S,COM_VAR,CUR,'1',W),(%5(%TMP%S_COM_TAX(R,%4,C,S,COM_VAR,CUR,'1',W))*(VAR_COMPRD.L(RTC,S)$DIAG('PRD',COM_VAR)+VAR_COMNET.L(RTC,S)$DIAG('NET',COM_VAR))+%1_COMC(J,RTC,CUR)*G_YRFR(R,S))*SW_PROB(W)/Z); + +*------------------------------------------------------------------------------ +* Commodity costs associated with imports/exports from outside study area +*------------------------------------------------------------------------------ + %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(RDCUR(R,CUR)$RPC(R,P,C)$RP_IRE(R,P)) $= + SUM((RTPCS_VARF(R,T,P,C,S),RPC_IREIO(R,P,C,IE,'OUT')), %5(%TPULSE% OBJ_IPRIC(R,%4,P,C,S,IE,CUR)) * PAR_IRE(R,V,T,P,C,S,IE)); + +*------------------------------------------------------------------------------ +* Flow level costs +*------------------------------------------------------------------------------ + + %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'COST')$RP_FLO(R,P)) = + SUM(RTPCS_VARF(R,T,P,C,S), + SUM(TS_ANN(S,TS),%5(%TPULSE% (OBJ_FCOST(R,%4,P,C,TS,CUR)+OBJ_FDELV(R,%4,P,C,TS,CUR)))) * PAR_FLO(R,V,T,P,C,S)); + + %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'COST')$RPC_STG(R,P,C)) = + SUM(RPCS_VAR(R,P,C,S), + SUM(TS_ANN(S,TS),%5(%TPULSE% (VAR_SIN.L(R,V,T,P,C,S)*OBJ_FCOST(R,%4,P,C,TS,CUR)+VAR_SOUT.L(R,V,T,P,C,S)*STG_EFF(R,V,P)*OBJ_FDELV(R,%4,P,C,TS,CUR))))); + + %1_FLOC(%2RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'COST')$RP_IRE(R,P)) = + %1_FLOC(J,R,V,T,P,C,CUR) + + SUM(RTPCS_VARF(R,T,P,C,S), + SUM(TS_ANN(S,TS),%5(%TPULSE% (OBJ_FCOST(R,%4,P,C,TS,CUR) + OBJ_FDELV(R,%4,P,C,TS,CUR)))) * + ( + SUM(RPC_IRE(R,P,C,IE), PAR_IRE(R,V,T,P,C,S,IE)) + + SUM(IO$F_INOUTS(R,V,T,P,C,S,IO),F_INOUTS(R,V,T,P,C,S,IO)) + )); + +* handle the fact that commodity costs may be associated with capacity + %1_FLOC(%2R,V,T,P,C,CUR)$(VNT(V,T)$OBJ_VFLO(R,P,C,CUR,'COST')$RPC_CAPFLO(R,V,P,C)) = + %1_FLOC(J,R,V,T,P,C,CUR) + + SUM(ANNUAL(S), +$ BATINCLUDE cal_caps.mod T 'SUM(TS_ANN(TS,SL),%5(%TPULSE%(OBJ_FCOST(R,%4,P,C,SL,CUR)+OBJ_FDELV(R,%4,P,C,SL,CUR))))' TS .L + ); + +*------------------------------------------------------------------------------ +* Flow level tax/sub +*------------------------------------------------------------------------------ + + %1_FLOC(%3RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'TAX')$RP_FLO(R,P)) = + SUM(RTPCS_VARF(R,T,P,C,S), + SUM(TS_ANN(S,TS),%5(%TPULSE% OBJ_FTAX(R,%4,P,C,TS,CUR))) * PAR_FLO(R,V,T,P,C,S)); + + %1_FLOC(%3RTP_VINTYR(R,V,T,P),C,CUR)$(OBJ_VFLO(R,P,C,CUR,'TAX')$RP_IRE(R,P)) = + SUM(RTPCS_VARF(R,T,P,C,S), + SUM(TS_ANN(S,TS),%5(%TPULSE% OBJ_FTAX(R,%4,P,C,TS,CUR))) * + ( + SUM(RPC_IRE(R,P,C,IE), PAR_IRE(R,V,T,P,C,S,IE)) + + SUM(IO$F_INOUTS(R,V,T,P,C,S,IO),F_INOUTS(R,V,T,P,C,S,IO)) + )); + +* handle the fact that commodity costs may be associated with capacity + %1_FLOC(%3R,V,T,P,C,CUR)$(VNT(V,T)$OBJ_VFLO(R,P,C,CUR,'TAX')$RPC_CAPFLO(R,V,P,C)) = + %1_FLOC(J,R,V,T,P,C,CUR) + + SUM(ANNUAL(S), +$ BATINCLUDE cal_caps.mod T 'SUM(TS_ANN(TS,SL),%5(%TPULSE% OBJ_FTAX(R,%4,P,C,SL,CUR)))' TS .L + ); + +*------------------------------------------------------------------------------ +* Commodity blending costs +*------------------------------------------------------------------------------ + %1_COMC(%2R,T,BLE,CUR)$RDCUR(R,CUR) = %1_COMC(J,R,T,BLE,CUR) + + SUM(BLE_OPR(R,BLE,OPR), %5(%TPULSE% OBJ_BLNDV(R,%4,BLE,OPR,CUR)) * VAR_BLND.L(R,T,BLE,OPR)); + +*------------------------------------------------------------------------------ +$EXIT +$LABEL LEGACY +*============================================================================== +* Legacy reporting (by every year and timeslice, discounted): +* Generate Variable cost formulas summing over all active indexes by region and currency +*=============================================================================== + +*------------------------------------------------------------------------------ +* Overall activity of a process based costs +*------------------------------------------------------------------------------ + LOOP(T, + PAR_OBJACT(R,V,Y_EOH,P,S,CUR)$(PERIODYR(T,Y_EOH)*RTP_VINTYR(R,V,T,P)*PRC_TS(R,P,S)) = + OBJ_DISC(R,Y_EOH,CUR) * OBJ_ACOST(R,Y_EOH,P,CUR) * VAR_ACT.L(R,V,T,P,S) * POWER(RS_STGAV(R,S),1$RP_STG(R,P)) + ); + +*------------------------------------------------------------------------------ +* Commodity added costs and sub/tax +*------------------------------------------------------------------------------ + LOOP(T, + PAR_OBJCOM(R,Y_EOH,C,S,CUR)$PERIODYR(T,Y_EOH) $= + SUM(RHS_COMBAL(R,T,C,S), OBJ_DISC(R,Y_EOH,CUR) * VAR_COMNET.L(R,T,C,S) * SUM(COSTYPE,OBJ_COMNT(R,Y_EOH,C,S,COSTYPE,CUR))) + + SUM(RHS_COMPRD(R,T,C,S), OBJ_DISC(R,Y_EOH,CUR) * VAR_COMPRD.L(R,T,C,S) * SUM(COSTYPE,OBJ_COMPD(R,Y_EOH,C,S,COSTYPE,CUR))); + ); + +*------------------------------------------------------------------------------ +* Commodity costs/tax/sub associated with imports/exports from outside study area (external regions) +*------------------------------------------------------------------------------ + LOOP(T, + PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$((PERIODYR(T,Y_EOH)*RTPCS_VARF(R,T,P,C,S)*RTP_VINTYR(R,V,T,P))$RP_IRE(R,P)) $= + SUM(RPC_IREIO(R,P,C,IE,'OUT'), OBJ_DISC(R,Y_EOH,CUR) * OBJ_IPRIC(R,Y_EOH,P,C,S,IE,CUR) * PAR_IRE(R,V,T,P,C,S,IE)); + ); + +*------------------------------------------------------------------------------ +* Flow level costs/tax/sub +*------------------------------------------------------------------------------ + LOOP(T, + PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$(PERIODYR(T,Y_EOH)*RTPCS_VARF(R,T,P,C,S)*RTP_VINTYR(R,V,T,P)*RP_FLO(R,P)) = + + OBJ_DISC(R,Y_EOH,CUR) * PAR_FLO(R,V,T,P,C,S) * + SUM(TS_ANN(S,TS),OBJ_FCOST(R,Y_EOH,P,C,TS,CUR) + OBJ_FDELV(R,Y_EOH,P,C,TS,CUR) + OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)) + ); + + LOOP(T, + PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$(SUM(OBJ_VFLO(R,P,C,CUR,UC_COST),1)$(PERIODYR(T,Y_EOH)*RTPCS_VARF(R,T,P,C,S)*RTP_VINTYR(R,V,T,P)$RP_IRE(R,P))) = + + PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR) + + OBJ_DISC(R,Y_EOH,CUR) * + SUM(TS_ANN(S,TS),OBJ_FCOST(R,Y_EOH,P,C,TS,CUR) + OBJ_FDELV(R,Y_EOH,P,C,TS,CUR) + OBJ_FTAX(R,Y_EOH,P,C,TS,CUR)) * + ( + SUM(RPC_IRE(R,P,C,IE), PAR_IRE(R,V,T,P,C,S,IE)) + + SUM(IO$F_INOUTS(R,V,T,P,C,S,IO),F_INOUTS(R,V,T,P,C,S,IO)) + ) + ); + +* handle the fact that commodity costs may be associated with capacity + LOOP(T, + PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR)$(PERIODYR(T,Y_EOH)*RPCS_VAR(R,P,C,S)*VNT(V,T)*RPC_CAPFLO(R,V,P,C)) = + PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR) + + OBJ_DISC(R,Y_EOH,CUR) * + ( +$ BATINCLUDE cal_caps.mod T 'SUM(TS_ANN(TS,SL),OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR))' TS .L + ) + ); + +*------------------------------------------------------------------------------ +* Commodity blending costs +*------------------------------------------------------------------------------ + PAR_OBJBLE(R,Y_EOH,BLE,CUR)$RDCUR(R,CUR) = OBJ_DISC(R,Y_EOH,CUR) * + SUM((BLE_OPR(R,BLE,OPR),PERIODYR(T,Y_EOH)), OBJ_BLNDV(R,Y_EOH,BLE,OPR,CUR) * VAR_BLND.L(R,T,BLE,OPR)); + +* Check that the Calculated objective components are equal to those Derived by the solver: +OBJ_C = SUM((R,V,Y_EOH,P,S,CUR)$PAR_OBJACT(R,V,Y_EOH,P,S,CUR),PAR_OBJACT(R,V,Y_EOH,P,S,CUR))+ + SUM((R,V,Y_EOH,P,C,S,CUR)$PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR),PAR_OBJFLO(R,V,Y_EOH,P,C,S,CUR))+ + SUM((R,Y_EOH,C,S,CUR)$PAR_OBJCOM(R,Y_EOH,C,S,CUR),PAR_OBJCOM(R,Y_EOH,C,S,CUR)); +OBJ_D = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJVAR',OBV)*VAR_OBJ.L(R,OBV,CUR))); +DISPLAY OBJ_C,OBJ_D; \ No newline at end of file diff --git a/eqobsalv.mod b/eqobsalv.mod new file mode 100644 index 0000000..fadad33 --- /dev/null +++ b/eqobsalv.mod @@ -0,0 +1,143 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJSALV the objective functions for salvaging +* - Investment Costs +* - Taxes and subsidies on investments +* - Decommissioning +*=============================================================================* +$IF DEFINED OBJSCC $GOTO PREPRO + + PARAMETER SALV_DEC(REG,ALLYEAR,PRC,CUR) //; + PARAMETER OBJSCC(REG,ALLYEAR,PRC,CUR) //; + PARAMETER OBJSIC(REG,ALLYEAR,PRC) //; + PARAMETER OBJ_DCEOH(REG,CUR) //; + +$LABEL PREPRO +$SET PFT '' +*=============================================================================== +* Check stepped mode +$IF SET TIMESTEP OPTION CLEAR=OBJ_SUMS,CLEAR=OBJ_SUMS3,CLEAR=SALV_INV,CLEAR=OBJSCC; +$IF %STEPPED%==+ +$IFI %1==mod $GOTO EQUA +$IF NOT DEFINED VNRET +$IF NOT '%CTST%'=='' $SET PFT (T) +*=============================================================================== +* Salvaging of Investments +* LL is investment year; K is commissioning year +*[UR] 19.12.2003 added -1 in line below, since lifetime starts at the beginning of year K + LOOP(OBJ_SUMII(R,V%PFT%,P,AGE,K_EOH,JOT), Z=NCAP_TLIFE(R,V,P)-1; + IF(YEARVAL(K_EOH)+ORD(JOT)+Z GT MIYR_VL, + LOOP(INVSPRED(K_EOH,JOT,LL,K)$(YEARVAL(LL)+Z GT MIYR_VL),OBJ_SUMSI(R,V,P,LL) = YES))); + +* No retrofit salvage + LOOP((RP(R,PRC),P)$PRC_REFIT(RP,P),IF(PRC_REFIT(RP,P)<0, OBJ_SUMSI(R,T,P,K)=NO)); + OPTION OBJ_SUMS <= OBJ_SUMSI; + +* Salvaging of Decommissioning + LOOP(OBJ_SUMIII(OBJ_SUMS(R,V,P),LL,K,Y), OBJ_SUMS3(R,V,P) = YES); +* Salvaging of Decommissioning surveillance + LOOP(OBJ_SUMIVS(R,V,P,K,Y)$(YEARVAL(K)+NCAP_TLIFE(R,V,P)-1 GT MIYR_VL), + OBJ_SUMS3(R,V,P) = YES; OBJ_SUMSI(R,V,P,K) = YES); + +*=============================================================================== + LOOP(RDCUR(R,CUR), +* Salvage proportion of investments at the commissioning year K: + SALV_INV(OBJ_SUMSI(R,V,P,K))$OBJ_ICUR(R,V,P,CUR) = + MIN(1,(((1+G_DRATE(R,V,CUR))*EXP(NCAP_FDR(R,V,P)))**(NCAP_TLIFE(R,V,P)+YEARVAL(K)-MIYR_VL-1)-1) / + (((1+G_DRATE(R,V,CUR))*EXP(NCAP_FDR(R,V,P)))**NCAP_TLIFE(R,V,P)-1)); + ); +* Discount factors for the year EOH+1: + LOOP(MIYR_1(LL), F = MIYR_VL+1-YEARVAL(MIYR_1); OBJ_DCEOH(RDCUR(R,CUR)) = OBJ_DISC(R,LL+F,CUR)); +* Shape-reduced salvage at EOH+1: + Z = SMAX(T$(B(T)<=MIYR_VL+1),ORD(T)-1); + LOOP(MIYR_1(T-Z), SALV_INV(OBJ_SUMSI(RTP,K))$NCAP_CPX(RTP) = SALV_INV(RTP,K)*(1+RTP_CPX(RTP,T))); + + OPTION CLEAR = OBJ_SUMSI; +*=============================================================================== +* Salvage value of investments at year EOH+1: +* Note that in Cases 2a and 2b investment costs are paid before K + OBJSCC(OBJ_ICUR(OBJ_SUMS(R,V,P),CUR)) = COR_SALVI(R,V,P,CUR) / OBJ_DCEOH(R,CUR) / OBJ_DIVI(R,V,P) * + SUM((OBJ_SUMII(R,V,P,AGE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K))$SALV_INV(R,V,P,LL),%CAPJD% + (OBJ_ICOST(R,K,P,CUR)+OBJ_ITAX(R,K,P,CUR)-OBJ_ISUB(R,K,P,CUR)) * SALV_INV(R,V,P,LL) * OBJ_DISC(R,K,CUR)); +* Handle ETL in similar fashion +$IF %ETL%==YES LOOP((OBJ_SUMS(R,T(V),P),G_RCUR(R,CUR))$SEG(R,P), +$IF %ETL%==YES OBJSIC(R,T,P) = COR_SALVI(R,T,P,CUR) / OBJ_DCEOH(R,CUR) / OBJ_DIVI(R,T,P) * +$IF %ETL%==YES SUM((OBJ_SUMII(R,V,P,AGE,K_EOH,JOT),INVSPRED(K_EOH,JOT,LL,K)),%CAPJD% SALV_INV(R,T,P,LL)*OBJ_DISC(R,K,CUR))); +*=============================================================================== +* Additional constant term + OBJ_IAD(RDCUR(R,CUR)) = SUM(OBJ_ICUR(OBJ_SUMS(R,PASTMILE(V),P),CUR)$((OBJ_PASTI(R,V,P,CUR)=0)+0%CTST%),OBJSCC(R,V,P,CUR)*NCAP_PASTI(R,V,P)*OBJ_DCEOH(R,CUR)); +*=============================================================================== +*GG* only if decommissioning lifetime provided by user + COR_SALVD(RTP(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR) = + (((1-1/(1+NCAP_DRATE(R,V,P)))*(1-1/(1+OBJ_RFR(R,V,CUR))**NCAP_DELIF(R,V,P)))/ + ((1-1/(1+OBJ_RFR(R,V,CUR)))*(1-1/(1+NCAP_DRATE(R,V,P))**NCAP_DELIF(R,V,P))) + )$(NCAP_DRATE(R,V,P) GT 0) + 1$(NCAP_DRATE(R,V,P) EQ 0); + OBJ_CRFD(RTP(R,V,P),CUR)$OBJ_DCOST(R,V,P,CUR) = COR_SALVD(R,V,P,CUR) * (1-(1/(1+G_DRATE(R,V,CUR)))) / (1-(1+G_DRATE(R,V,CUR))**(-ROUND(NCAP_%DECLIF%(R,V,P)))); +*------------------------------------------------------------------------------ +* Salvage value of Decommissioning at year EOH+1: +* Documentation defines the value for each decommissioning year Y; here aggregated by vintage + SALV_DEC(OBJ_SUMS3(R,V,P),CUR)$COR_SALVD(R,V,P,CUR) = COR_SALVD(R,V,P,CUR) / OBJ_DIVIII(R,V,P) / OBJ_DCEOH(R,CUR) * + SUM(OBJ_SUMIII(R,V,P,LL,K,Y)$SALV_INV(R,V,P,LL),SALV_INV(R,V,P,LL)*OBJ_DCOST(R,K,P,CUR)*OBJ_DISC(R,Y,CUR)); +*=============================================================================== +$LABEL EQUA +$IFI %2==EXIT $EXIT + +*=============================================================================== +* Generate Salvage Equation summing over all active indexes by region and currency +*=============================================================================== + + + %EQ%_OBJSALV(RDCUR(R,CUR) %SOW%) .. + +*------------------------------------------------------------------------------ +* Cases I - Investment Cost and II - Taxes/Subsidies +*------------------------------------------------------------------------------ +* [AL] Note that discounting to EOH+1 is imbedded in OBJSCC and OBJSIC + + SUM(OBJ_SUMS(R,T,P), OBJSCC(R,T,P,CUR) * %VART%_NCAP(R,T,P %SWS%)) * OBJ_DCEOH(R,CUR) + +$IF NOT '%VALIDATE%'==YES + SUM(OBJ_SUMS(R,PYR(V),P), OBJSCC(R,V,P,CUR) * NCAP_PASTI(R,V,P)) * OBJ_DCEOH(R,CUR) + +$IF %ETL% == YES + SUM((OBJ_SUMS(R,T,TEG(P)),G_RCUR(R,CUR)), OBJSIC(R,T,P) * %VART%_IC(R,T,P %SWS%)) * OBJ_DCEOH(R,CUR) + + +$IF DEFINED VNRET $BATINCLUDE prepret.dsc OBSALV + +*------------------------------------------------------------------------------ +* Cases III - Decommissioning +*------------------------------------------------------------------------------ +* [AL] Note that discounting to EOH+1 is imbedded in SALV_DEC + + SUM(OBJ_SUMS3(R,T,P), %VART%_NCAP(R,T,P %SWS%) * SALV_DEC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) + + +* Past investments + SUM(OBJ_SUMS3(R,PYR,P), NCAP_PASTI(R,PYR,P) * SALV_DEC(R,PYR,P,CUR)) * OBJ_DCEOH(R,CUR) + + + +*------------------------------------------------------------------------------ +* Cases IV - Decommissioning Surveillance +*------------------------------------------------------------------------------ +* The same proportion SALV_INV is salvaged from investments and surveillance costs + SUM(OBJ_SUMIVS(R,V,P,K,Y)$SALV_INV(R,V,P,K), + OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,V,P,K) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))) + + +*------------------------------------------------------------------------------ +* LATE REVENUES +*------------------------------------------------------------------------------ +* [AL] LATEREVENUES identical to decommissioning, with DCOST replaced by OCOM*VALU +* Revenues are obtained in the proportion 1-SALV_INV of the total revenues + + SUM((OBJ_SUMIII(R,V,P,LL,K,Y),COM)$((NOT Y_EOH(Y))$NCAP_OCOM(R,V,P,COM)), + (1-SALV_INV(R,V,P,LL)) * NCAP_VALU(R,K,P,COM,CUR) * OBJ_DISC(R,Y,CUR) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) * + NCAP_OCOM(R,V,P,COM) / OBJ_DIVIII(R,V,P)) + + + =E= + + %VAR%_OBJ(R,'OBJSAL',CUR %SOW%); + +*$offlisting diff --git a/eqobsalv.rpt b/eqobsalv.rpt new file mode 100644 index 0000000..c3a7579 --- /dev/null +++ b/eqobsalv.rpt @@ -0,0 +1,74 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQOBJSALV the objective functions for salvaging +* - Investment Costs +* - Taxes and subsidies on investments +* - Decommissioning +*=============================================================================* +* +*============================================================================== +* Generate Investment equation summing over all active indexes by region and currency +*============================================================================== + +PAR_OBJSAL(RTP(R,V,P),CUR)$RDCUR(R,CUR) = + +*------------------------------------------------------------------------------ +* Cases I - Investment Cost and II - Taxes/Subsidies +*------------------------------------------------------------------------------ +* [AL] Note that discounting to EOH+1 is imbedded in OBJSCC and OBJSIC + + SUM(OBJ_SUMS(R,T(V),P), OBJSCC(R,T,P,CUR) * VAR_NCAP.L(R,T,P)) * OBJ_DCEOH(R,CUR) + + SUM(OBJ_SUMS(R,PYR(V),P), OBJSCC(R,V,P,CUR) * NCAP_PASTI(R,V,P)) * OBJ_DCEOH(R,CUR) + +$IF %ETL% == 'YES' + SUM(OBJ_SUMS(R,T(V),P)$TEG(P), OBJSIC(R,T,P) * VAR_IC.L(R,T,P)) * OBJ_DCEOH(R,CUR) + + +*------------------------------------------------------------------------------ +* Cases III - Decommissioning +*------------------------------------------------------------------------------ +* [AL] Note that discounting to EOH+1 is imbedded in SALV_DEC + + SUM(OBJ_SUMS3(R,T(V),P), VAR_NCAP.L(R,T,P) * SALV_DEC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) + + SUM(OBJ_SUMS3(R,PYR(V),P), NCAP_PASTI(R,V,P) * SALV_DEC(R,V,P,CUR)) * OBJ_DCEOH(R,CUR) + + +*------------------------------------------------------------------------------ +* Cases IV - Decommissioning Surveillance +*------------------------------------------------------------------------------ +* The same proportion SALV_INV is salvaged from investments and surveillance costs + SUM(OBJ_SUMIVS(R,T(V),P,K,Y)$SALV_INV(R,T,P,K), + OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,T,P,K) * VAR_NCAP.L(R,T,P)) + + + SUM(OBJ_SUMIVS(R,PYR(V),P,K,Y)$SALV_INV(R,V,P,K), + OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,V,P,K) * NCAP_PASTI(R,V,P)) + ; + +*------------------------------------------------------------------------------ +* LATE REVENUES +*------------------------------------------------------------------------------ +* [AL] LATEREVENUES identical to decommissioning, with DCOST replaced by OCOM*VALU +* Revenues are obtained in the proportion 1-SALV_INV of the total revenues + + PAR_OBJLAT(R,Y,P,CUR)$(YEARVAL(Y) GT MIYR_VL) = + SUM((OBJ_SUMIII(R,V,P,LL,K,Y),COM)$(NCAP_OCOM(R,V,P,COM)*NCAP_VALU(R,K,P,COM,CUR)), + (1-SALV_INV(R,V,P,LL)) * + OBJ_DISC(R,Y,CUR) * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) * + NCAP_VALU(R,K,P,COM,CUR) * NCAP_OCOM(R,V,P,COM) / OBJ_DIVIII(R,V,P)) + ; + +*------------------------------------------------------------------------------ +PARAMETER PAR_OBJCAP(R,YEAR,PRC,CUR) //; +PARAMETER COEF_OBJINV(R,YEAR,PRC) //; +*------------------------------------------------------------------------------ +* Calculate the effect of a one unit of investment costs to the objective. +* The average undiscounted investment cost equivalent to the reduced cost can be +* calculated for each period by dividing the reduced cost by COEF_OBJINV + OPTION CLEAR=PAR_OBJCAP; + PAR_OBJCAP(OBJ_ICUR(R,T,P,CUR)) = COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * + SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,Y,K), (1-SALV_INV(R,T,P,Y)$OBJ_SUMS(R,T,P)) * OBJ_DISC(R,K,CUR))); + COEF_OBJINV(RTP(R,T,P)) $= SUM(RDCUR(R,CUR),PAR_OBJCAP(RTP,CUR)); + +OPTION CLEAR=OBJ_SUMIV, CLEAR=OBJ_SUMIVS, CLEAR=OBJ_SUMIII; +OPTION CLEAR=OBJ_DIVI, CLEAR=OBJ_DIVIV, CLEAR=OBJ_DIVIII; diff --git a/eqpeak.mod b/eqpeak.mod new file mode 100644 index 0000000..62561f2 --- /dev/null +++ b/eqpeak.mod @@ -0,0 +1,88 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQPEAK is the basic commodity balance and the production limit constraint +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Questions/Comments: +* - NCAP_PKCNT uses the vintage period ! +* - Even annual level processes contribute to a seasonal peak according to PKCNT +*----------------------------------------------------------------------------- +*$ONLISTING +* + %EQ%_PEAK(%R_T%,CG2,RTS(SL)%SWT%)$(SUM(COM_GMAP(R,CG2,C)$RTC(R,T,C),1)$COM_PKTS(R,CG2,SL)) .. + + SUM((COM_GMAP(R,CG2,C),COM_TS(R,C,S))$RS_FR(R,SL,S), + RS_FR(R,SL,S) * +* Apply maximum reserve among CG2 and C + (1/(1+MAX(SUM(COM(CG2),COM_PKRSV(R,T,COM)),COM_PKRSV(R,T,C))))*COM_IE(R,T,C,S)* + + (SUM(RPC_PKC(R,P,C), G_YRFR(R,S) * PRC_CAPACT(R,P) * + SUM(V$COEF_CPT(R,V,T,P),COEF_CPT(R,V,T,P)*PRC_ACTFLO(R,V,P,C)*NCAP_PKCNT(R,V,P,S)* + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V) %RCAPSUB%)) + ) + + +* +* production +* +* inter-regional trade to region; processes with PKNO+PKCNT contribute by net imports +$ BATINCLUDE cal_ire.%1 IMP OUT IE '*NCAP_PKCNT(R,V,P,S)' - +$ BATINCLUDE cal_ire.%1 EXP IN IE '*(-NCAP_PKCNT(R,V,P,S)/COM_IE(R,T,C,S))$(COM_IE(R,T,C,S)>0)' - PRC_PKNO( ) + + ( + +*GG*PK no multiplier +* [UR] 25.04.2003 added NCAP_PKCNT multiplier to turn off contribution by setting NCAP_PKCNT to zero +* allow using PKNO to switch process to production-based peak contribution (contributes only if PKCNT set by user) + +* storage +$ BATINCLUDE cal_stgn.%1 OUT IN '*STG_EFF(R,V,P)' '' "(NOT PRC_NSTTS(R,P,TS))" '*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))$RPC_PKF(R,P,C)' + +* individual flows +$ BATINCLUDE cal_fflo.%1 OUT O '*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))$RPC_PKF(R,P,C)' + + 0) + +* [UR]: 04/22/2003: adjustment for extraction condensing CHP plants +$IF SET PEAKCHP $BATINCLUDE %PEAKCHP% + )) + + =G= + + SUM((COM_GMAP(R,CG2,C),COM_TS(R,C,S))$RS_FR(R,SL,S), + RS_FR(R,SL,S) * +* Apply maximum flexibility among CG2 and C + (1+MAX(SUM(COM(CG2),COM_PKFLX(R,T,COM,SL)),COM_PKFLX(R,T,C,S)))* + ( +* +* consumption +* +*GG*PK pass TS as timeslice + +* individual flows +$ BATINCLUDE cal_fflo.%1 IN I '*FLO_PKCOI(R,T,P,C,TS)' + +* inter-regional trade from region +$ BATINCLUDE cal_ire.%1 EXP IN IE '*FLO_PKCOI(R,T,P,C,TS)' - + +* capacity related commodity flows +* fixed commodity associated with installed capacity or investment +$ BATINCLUDE cal_cap.%1 IN I '1$(NOT PRC_PKNO(R,P))*' + + +* storage +$ BATINCLUDE cal_stgn.%1 IN OUT '' 'STG_EFF(R,V,P)*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" "$(NOT RPC_PKC(R,P,C))" + +* blending + SUM(BLE_OPR(R,BLE,OPR)$(BLE_INP(R,BLE,C)*BLE_TP(R,T,BLE)),G_YRFR(R,S)*(1+RTCS_FR(R,T,C,S,'ANNUAL'))*BL_INP(R,BLE,C)*PEAKDA_BL(R,BLE,T)*%VAR%_BLND(R,T,BLE,OPR %SOW%)) + + +* demand projection +$IFI %STAGES% == YES $SETLOCAL SWS 'PROD(SW_MAP(T,SOW,J,WW)$S_COM_PROJ(R,T,C,J,WW),S_COM_PROJ(R,T,C,J,WW))*' + ((%SWS% COM_PROJ(R,T,C)$(NOT RD_NLP(R,C)) +%VAR%_DEM(R,T,C%SOW%)$RD_NLP(R,C) +SUM(RD_AGG(R,COM),RD_SHAR(R,T,COM,C)*%VAR%_COMPRD(R,T,COM,'ANNUAL'%SOW%))) * COM_FR%MX%(R,T,C,S))$DEM(R,C) + + +* include the elasticity variables +$IF %TIMESED%==YES SUM(RCJ(R,C,J,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD),-BDSIG(BD)*%VAR%_ELAST(R,T,C,S,J,BD %SOW%)) + + + 0)) ; +*$OFFLISTING diff --git a/eqpk_ect.ier b/eqpk_ect.ier new file mode 100644 index 0000000..2506837 --- /dev/null +++ b/eqpk_ect.ier @@ -0,0 +1,11 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* [UR]: 04/22/2003: adjustment for extraction condensing CHP plants + + SUM(ECT_ELC(ECT_CHP(R,P),C)$((NOT PRC_CAP(R,P)*RPC_PKC(R,P,C))$TOP(R,P,C,'OUT')), +$ BATINCLUDE cal_fflo.mod OUT O '*(-(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C)))$RPC_PKF(R,P,C)' + (G_YRFR(R,S)*SUM(RTP_CPTYR(R,V,T,P),PRC_CAPACT(R,P)* + NCAP_PKCNT(R,V,P,S)*COEF_CPT(R,V,T,P)* + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V))))) diff --git a/eqptrans.mod b/eqptrans.mod new file mode 100644 index 0000000..0516a6d --- /dev/null +++ b/eqptrans.mod @@ -0,0 +1,41 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQPTRANS is the flow-to-flow transformation constraint +*=============================================================================* +* Questions/Comments: +* - EQ_PTRANS is dropped if substition for FLO_FUNC activated +* - EQ level according to RPS_S1, VAR_FLOs according RPCS_VAR +* - COEF_PTRAN created in coef_ptr.mod +*----------------------------------------------------------------------------- +*$ONLISTING +$SET SHP1 "" SET SHG ",P,COM_GRP,CG" +$IF DEFINED RTP_FFCS $SET SHP1 "*(%SHFF%S(R,V%SHG%%SOW%))" +$SET SHP1 "*(%SHFF%X(R,V,T%SHG%)$PRC_VINT(R,P))%SHP1%" +*----------------------------------------------------------------------------- + + %EQ%_PTRANS(RTP_VINTYR(%R_V_T%,P),COM_GRP,CG,RTS(S)%SWT%)$((RPS_S1(R,P,S) * RP_STD(R,P) * +* All valid tuples are in RPCC_FFUNC (REDUCE taken into account); all STG excluded + SUM((RPC(R,P,C),RS_TREE(R,S,TS))$COEF_PTRAN(R,V,P,COM_GRP,C,CG,TS),1))$RPCC_FFUNC(R,P,COM_GRP,CG)).. + +* dependent commodities - consider that the commodity may have a COM_TS shape + SUM((COM_GMAP(R,CG,C),RS_TREE(R,S,TS))$RTPCS_VARF(R,T,P,C,TS), + RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) * +* [UR] model reduction %REDUCE% is set in *.run +$ BATINCLUDE %cal_red% C COM TS P T + ) + + =E= + +* control commodities + SUM((RTPCS_VARF(R,T,P,C,TS),RS_TREE(R,S,TS))$COEF_PTRAN(R,V,P,COM_GRP,C,CG,TS), + COEF_PTRAN(R,V,P,COM_GRP,C,CG,TS) * + RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) * +* [UR] model reduction %REDUCE% is set in *.run +$ BATINCLUDE %cal_red% C COM TS P T + ) %SHP1% * (1+(ACT_FLO(R,V,P,CG,S)-1$ACT_FLO(R,V,P,CG,S))$PRC_CG(R,P,COM_GRP)) + ; + +*$OFFLISTING diff --git a/eqstgaux.lin b/eqstgaux.lin new file mode 100644 index 0000000..77d220b --- /dev/null +++ b/eqstgaux.lin @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQSTGAUX auxiliary commodities for storage +*=============================================================================* +*AL Questions/Comments: +* Assumption is that all auxiliary flows are at PRC_TS level; NST primary flows can be also above +*-----------------------------------------------------------------------------* +*$ONLISTING + + + %EQ%_STGAUX(RTP_VINTYR(%R_V_T%,P),C,RTS(S)%SWT%)$((RPCS_VAR(R,P,C,S)*(NOT RPC_STG(R,P,C)+RPC_EMIS(R,P,C)))$RP_STG(R,P)).. + +* Auxiliary flow variable + %VAR%_FLO(R,V,T,P,C,S %SOW%) + + =E= + +* flow depends on storage level in period T + SUM(ANNUAL(SL),PRC_ACTFLO(R,V,P,C) * + ( + SUM(PRC_TS(R,P,TS)$TS_MAP(R,TS,S),%VAR%_ACT(R,V,T,P,TS %SOW%)/RS_STGPRD(R,TS)) * G_YRFR(R,S) - +* subtract in- and output flows to/from storage during latter half of milestone year + SUM(TOP(PRC_STGIPS(R,P,COM),IO), 0.5 * + (%VAR%_SIN(R,V,T,P,COM,SL%SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,COM,SL%SOW%)$(NOT IPS(IO))) / PRC_ACTFLO(R,V,P,COM) * +* storage losses (assume that Inflows and outflows occur at the mid-point of each year) + ((1-STG_LOSS(R,V,P,SL))**0.5)) +* For IPS, MID storage level is (1-LOSS)**(0.5) higher + ) * (1+((1-STG_LOSS(R,V,P,SL))**(-0.5)-1)$PRC_MAP(R,'STK',P))) + + +* flow depends on storage in- or outflow in period T + SUM((COM_GMAP(R,CG,COM),TOP(RPC_STG(R,P,COM),'IN'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,COM,C,TS), + (%VAR%_SIN(R,V,T,P,COM,TS %SOW%) * COEF_PTRAN(R,V,P,CG,COM,C,TS))$((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS)) * + RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) + + SUM((COM_GMAP(R,CG,C),TOP(RPC_STG(R,P,COM),'OUT'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,C,COM,S), + (%VAR%_SOUT(R,V,T,P,COM,TS %SOW%) * (1/COEF_PTRAN(R,V,P,CG,C,COM,S)))$(PRC_NSTTS(R,P,TS) EQV RPC_STGN(R,P,COM,'OUT')) * + RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) + +; + +$OFFLISTING diff --git a/eqstgaux.mod b/eqstgaux.mod new file mode 100644 index 0000000..c4fd459 --- /dev/null +++ b/eqstgaux.mod @@ -0,0 +1,44 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQSTGAUX auxiliary commodities for storage +*=============================================================================* +*AL Questions/Comments: +* Assumption is that all auxiliary flows are at PRC_TS level; NST primary flows can be also above +*-----------------------------------------------------------------------------* +*$ONLISTING + + + %EQ%_STGAUX(RTP_VINTYR(%R_V_T%,P),C,RTS(S)%SWT%)$((RPCS_VAR(R,P,C,S)*(NOT RPC_STG(R,P,C)+RPC_EMIS(R,P,C)))$RP_STG(R,P)).. + +* Auxiliary flow variable + %VAR%_FLO(R,V,T,P,C,S %SOW%) + + =E= + +* flow depends on storage level in period T + SUM(ANNUAL(SL),PRC_ACTFLO(R,V,P,C) * + ( + SUM(PRC_TS(R,P,TS)$TS_MAP(R,TS,S),%VAR%_ACT(R,V,T,P,TS %SOW%)/RS_STGPRD(R,TS)) * G_YRFR(R,S) - +* subtract in- and output flows to/from storage during latter half of period (from middle of M(T)) + SUM(TOP(PRC_STGIPS(R,P,COM),IO), + (%VAR%_SIN(R,V,T,P,COM,SL%SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,COM,SL%SOW%)$(NOT IPS(IO)))/PRC_ACTFLO(R,V,P,COM)) * + SUM(PERIODYR(T,Y_EOH)$(YEARVAL(Y_EOH) GE M(T)), +* storage losses (assume that Inflows and outflows occur at the mid-point of each year) + MIN(1,YEARVAL(Y_EOH)-M(T)+MAX(0,M(T)+D(T)/2-E(T))) * ((1-STG_LOSS(R,V,P,SL))**(E(T)-YEARVAL(Y_EOH)+0.5))) +* For IPS, MID storage level is (1-LOSS)**(E(T)-M(T)+0.5) higher + ) * (1+((1-STG_LOSS(R,V,P,SL))**(M(T)-E(T)-MIN(0.5,MAX(0,M(T)+D(T)/2-E(T))))-1)$PRC_MAP(R,'STK',P))) + + +* flow depends on storage in- or outflow in period T + SUM((COM_GMAP(R,CG,COM),TOP(RPC_STG(R,P,COM),'IN'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,COM,C,TS), + (%VAR%_SIN(R,V,T,P,COM,TS %SOW%) * COEF_PTRAN(R,V,P,CG,COM,C,TS))$((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS)) * + RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) + + SUM((COM_GMAP(R,CG,C),TOP(RPC_STG(R,P,COM),'OUT'),RPCS_VAR(R,P,COM,TS))$COEF_PTRAN(R,V,P,CG,C,COM,S), + (%VAR%_SOUT(R,V,T,P,COM,TS %SOW%) * (1/COEF_PTRAN(R,V,P,CG,C,COM,S)))$(PRC_NSTTS(R,P,TS) EQV RPC_STGN(R,P,COM,'OUT')) * + RS_FR(R,S,TS) * (1+RTCS_FR(R,T,C,S,TS))) + +; + +$OFFLISTING diff --git a/eqstgflo.mod b/eqstgflo.mod new file mode 100644 index 0000000..b48c131 --- /dev/null +++ b/eqstgflo.mod @@ -0,0 +1,31 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQSTGFLO limits the flow of storage process at flow TS-level or higher +* %1 - IN/OUT +* %2 - equation declaration type +* %3 - bound type for %2 +* %4 - qualifier that bound exists +*=============================================================================* +*GaG Questions/Comments: +* - Bound TS restricted to the PRC_TS level or above +* - avoid equations if LO=0/UP=INF +*----------------------------------------------------------------------------- +$SET TMP (NOT PRC_MAP(R,'NST',P))+ +$IF %1==OUT $SET TMP NOT +*$ONLISTING + + %EQ%%2_STG%1(RTPC(%R_T%,P,C),S %SWT%)$((STG%1_BND(R,T,P,C,S,'%3') NE %4)$(PRC_VINT(R,P)+(NOT RPCS_VAR(R,P,C,S))) + $RPS_PRCTS(R,P,S)$RPC_STG(R,P,C)$STG%1_BND(R,T,P,C,S,'%3')) .. + +* sum over all possible flow variables at process TS-level + SUM(RPCS_VAR(R,P,C,TS)$(RS_FR(R,S,TS) * (%TMP% PRC_NSTTS(R,P,TS))), + SUM(RTP_VINTYR(R,V,T,P),%VAR%_S%1(R,V,T,P,C,TS %SOW%)*RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) + + =%2= + + STG%1_BND(R,T,P,C,S,'%3') + ; +*$OFFLISTING diff --git a/eqstgips.lin b/eqstgips.lin new file mode 100644 index 0000000..d508c23 --- /dev/null +++ b/eqstgips.lin @@ -0,0 +1,68 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQSTGIPS Inter-Period Storage (IPS) and TIME-Slice Storage (TSS) * +*=============================================================================* +*AL Questions/Comments: +* v2.6.0: VART redefined locally for stochastic mode +*-----------------------------------------------------------------------------* +*$ONLISTING + SET RTP_EQSTK(R,ALLYEAR,T,P,ITEM); +* Charge at beginning of horizon (BOH) + RTP_EQSTK(R,MIYR_1(T),T,P,'IN')$(RTP(R,T,P)$PRC_MAP(R,'STK',P)) = YES; +* Normal storage balance in each period (N) + RTP_EQSTK(RTP_VINTYR(R,V,T,P),'N')$PRC_MAP(R,'STK',P) = YES; +* We must ensure that the storage level is non-negative at end of each period (1) + RTP_EQSTK(RTP_VINTYR(R,V,T,P),'1')$((E(T) GT M(T))$PRC_MAP(R,'STK',P)) = YES; +*------------------------------------------------------------------------------ + + %EQ%_STGIPS(RTP_EQSTK(%R_V_T%,P,ITEM) %SWT%)$(SUM(PRC_STGIPS(R,P,C),1)$PRC_MAP(R,'STK',P)) .. + +* storage level at the milestone year T + %VAR%_ACT(R,V,T,P,'ANNUAL' %SOW%)$LIM(ITEM) + + SUM((IO(ITEM),MODLYEAR,MIYR_1(LL))$RTP_VINTYR(R,MODLYEAR,T,P), + %VAR%_ACT(R,MODLYEAR,LL-LEAD(LL),P,'ANNUAL' %SOW%)) + + =E= + + SUM(TOP(PRC_STGIPS(R,P,C),IO), + + SUM(TT(T-1), +* storage level at the milestone year TT, corrected with storage losses + (%VARTT%_ACT(R,V,TT,P,'ANNUAL'%SWS%)*POWER(1-STG_LOSS(R,V,P,'ANNUAL'),LEAD(T))$IPS(IO) + +* Add in- and output flows to/from storage related to period TT + SUM(PERDINV(T,Y_EOH),TPULSE(TT,Y_EOH)*((1-STG_LOSS(R,V,P,'ANNUAL'))**(M(T)-YEARVAL(Y_EOH)+0.5)))/PRC_ACTFLO(R,V,P,C) * + (%VARTT%_SIN(R,V,TT,P,C,'ANNUAL'%SWS%)$IPS(IO) - %VARTT%_SOUT(R,V,TT,P,C,'ANNUAL'%SWS%)$(NOT IPS(IO))))$(RTP_VINTYR(R,V,TT,P)$PRC_VINT(R,P)) + +* storage level at the milestone year TT, corrected with storage losses + (%VARTT%_ACT(R,TT,TT,P,'ANNUAL'%SWS%)*POWER(1-STG_LOSS(R,V,P,'ANNUAL'),LEAD(T))$IPS(IO) + +* Add in- and output flows to/from storage related to period TT + SUM(PERDINV(T,Y_EOH),TPULSE(TT,Y_EOH)*((1-STG_LOSS(R,V,P,'ANNUAL'))**(M(T)-YEARVAL(Y_EOH)+0.5)))/PRC_ACTFLO(R,TT,P,C) * + (%VARTT%_SIN(R,TT,TT,P,C,'ANNUAL'%SWS%)$IPS(IO) - %VARTT%_SOUT(R,TT,TT,P,C,'ANNUAL'%SWS%)$(NOT IPS(IO))))$(RTP_VINTYR(R,TT,TT,P)$(NOT PRC_VINT(R,P)))) + + +* in- and output flows to/from storage related to period T +* [AL] Summing over PERDINV years, as the activity is measured at M(T) +* [AL] Inflows and outflows occur, on average, at the mid-point of each year + SUM(PERDINV(T,Y_EOH),TPULSE(T,Y_EOH)*((1-STG_LOSS(R,V,P,'ANNUAL'))**(M(T)-YEARVAL(Y_EOH)+0.5)))$RTP_VINTYR(R,V,T,P) * + (%VAR%_SIN(R,V,T,P,C,'ANNUAL' %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,'ANNUAL' %SOW%)$(NOT IPS(IO))) / PRC_ACTFLO(R,V,P,C) + )$LIM(ITEM) + + +* [AL] In the first period VAR_ACT is not available, but exogenous charge can be used + SUM(VNT(T,MIYR_1(LL)),%VAR%_ACT(R,V,LL-LEAD(LL),P,'ANNUAL' %SOW%) * + POWER(1-STG_LOSS(R,V,P,'ANNUAL'),LEAD(T)))$LIM(ITEM) + + +* Exogenous charge at BOH + SUM((IO(ITEM),MIYR_1(LL)),STG_CHRG(R,LL-LEAD(LL),P,'ANNUAL')) + +* Minimum storage balance at end-of-period + (%VAR%_ACT(R,V,T,P,'ANNUAL'%SOW%) * POWER(1-STG_LOSS(R,V,P,'ANNUAL'),E(T)-M(T)) - + SUM((MIYR_1(LL),Y_EOH(LL+(E(T)-YEARVAL(LL)))),%VAR%_ACT(R,V,Y_EOH,P,'ANNUAL'%SOW%)) + +* in- and output flows to/from storage + SUM(TOP(PRC_STGIPS(R,P,C),IO), + SUM(PERIODYR(T,Y_EOH)$(YEARVAL(Y_EOH) GT M(T)),((1-STG_LOSS(R,V,P,'ANNUAL'))**(E(T)-YEARVAL(Y_EOH)+0.5))) * +* half year's correction if LAGT is even + (1+((LAGT(T)-1)/2/(E(T)-M(T))-1)$(E(T) < MIYR_VL)) / PRC_ACTFLO(R,V,P,C) * + (%VAR%_SIN(R,V,T,P,C,'ANNUAL' %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,'ANNUAL' %SOW%)$(NOT IPS(IO)))))$J(ITEM) +; +$OFFLISTING + diff --git a/eqstgips.mod b/eqstgips.mod new file mode 100644 index 0000000..effb690 --- /dev/null +++ b/eqstgips.mod @@ -0,0 +1,46 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQSTG Inter-Period Storage (IPS) and TIME-Slice Storage (TSS) * +*=============================================================================* +*UR Questions/Comments: +* +*-----------------------------------------------------------------------------* +*$ONLISTING + + %EQ%_STGIPS(RTP_VINTYR(%R_V_T%,P),IPS %SWT%)$(((MIYR_1(V)*MIYR_1(T)+LIM(IPS))*SUM(PRC_STGIPS(R,P,C),1))$PRC_MAP(R,'STK',P)) .. + +* storage level in the end of period T + %VAR%_ACT(R,V,T,P,'ANNUAL' %SOW%)$LIM(IPS) + + SUM((IO(IPS),MODLYEAR,MIYR_1(LL))$RTP_VINTYR(R,MODLYEAR,T,P), + %VAR%_ACT(R,MODLYEAR,LL-LEAD(LL),P,'ANNUAL' %SOW%)) + + =E= + + ( +* storage level in the end of period T-1 + (SUM(TT(T-1), + (%VARTT%_ACT(R,V,TT,P,'ANNUAL'%SWS%)$RTP_VINTYR(R,V,TT,P))$PRC_VINT(R,P) + + (%VARTT%_ACT(R,TT,TT,P,'ANNUAL'%SWS%)$RTP_VINTYR(R,TT,TT,P))$(NOT PRC_VINT(R,P))) + +* [AL] In the first period VAR_ACT is not available, but exogenous charge can be used + SUM(MIYR_1(LL),%VAR%_ACT(R,V,LL-LEAD(LL),P,'ANNUAL' %SOW%))$MIYR_1(T)) * +* storage losses +* [AL] Initial storage level/charge is reduced to (1-LOSS)**D(T) during the period + POWER(1-STG_LOSS(R,V,P,'ANNUAL'),D(T)) + + +* in- and output flows to/from storage +* [AL] Added summing over PERIODYR, as the storage operates during the whole period + SUM(TOP(PRC_STGIPS(R,P,C),IO), + (%VAR%_SIN(R,V,T,P,C,'ANNUAL' %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,'ANNUAL' %SOW%)$(NOT IPS(IO))) * +* storage losses +* [AL] Inflows and outflows occur, on average, at the mid-point of each year + SUM(PERIODYR(T,Y_EOH),((1-STG_LOSS(R,V,P,'ANNUAL'))**(E(T)-YEARVAL(Y_EOH)+0.5))) / PRC_ACTFLO(R,V,P,C) + ) + )$LIM(IPS) + +* Exogenous charge at BOH + SUM((IO(IPS),MIYR_1(LL)),STG_CHRG(R,LL-LEAD(LL),P,'ANNUAL')) +; +$OFFLISTING + diff --git a/eqstgtss.mod b/eqstgtss.mod new file mode 100644 index 0000000..88188fc --- /dev/null +++ b/eqstgtss.mod @@ -0,0 +1,95 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* EQSTGTSS TIME-Slice Storage (TSS) and general storage (STS) +*=============================================================================* +* Questions/Comments: +* - the storage level does NOT need to be fixed to an initial storage level in some TS +*-----------------------------------------------------------------------------* +*$ONLISTING + + %EQ%_STGTSS(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWT%)$(RPS_STG(R,P,S)$RP_STG(R,P)).. + +* storage level in time-slice s + %VAR%_ACT(R,V,T,P,S %SOW%) + + =E= + + SUM(RPS_STG(R,P,ALL_TS(S--RS_STG(R,S))), +* storage level in time-slice s + %VAR%_ACT(R,V,T,P,ALL_TS%SOW%) + + +* for day-night storage; allow flow variable at or above ALL_TS + ( + SUM((RPCS_VAR(RPC_STG(R,P,C),TS),TS_MAP(R,TS,ALL_TS)), + (%VAR%_SIN(R,V,T,P,C,TS%SOW%)$(TOP(R,P,C,'IN')$PRC_NSTTS(R,P,TS)) - + %VAR%_SOUT(R,V,T,P,C,TS%SOW%)$(TOP(R,P,C,'OUT')$(PRC_NSTTS(R,P,TS) EQV RPC_STGN(R,P,C,'OUT')))) * + RS_FR(R,ALL_TS,TS) * (1+RTCS_FR(R,T,C,ALL_TS,TS)) / PRC_ACTFLO(R,V,P,C)) + )$PRC_MAP(R,'NST',P) + + +* for storage processes without charging restriction + SUM(TOP(PRC_STGTSS(R,P,C),'IN'),%VAR%_SIN(R,V,T,P,C,ALL_TS%SOW%)/PRC_ACTFLO(R,V,P,C)) - + SUM(TOP(PRC_STGTSS(R,P,C),'OUT'),%VAR%_SOUT(R,V,T,P,C,ALL_TS%SOW%)/PRC_ACTFLO(R,V,P,C)) + - +* optional balancer flow + SUM(PRC_TS(R,P,TS)$RS_BELOW1(R,TS,S),%VAR%_SOUT(R,V,T,P,%PGPRIM%,TS%SOW%)*RS_FR(R,ALL_TS,TS))$RP_STS(R,P) - + +* storage losses: average storage level per cycle * loss fraction by cycle * cycles + %VAR%_ACT(R,V,T,P,ALL_TS%SOW%) * MAX(STG_LOSS(R,V,P,ALL_TS)/2, +* equilibrium loss (STG_LOSS<0): Act0 * (1-Loss/(1/EXP(-Loss)-1)) + (1+(STG_LOSS(R,V,P,ALL_TS))/(1/EXP(STG_LOSS(R,V,P,ALL_TS))-1)))$STG_LOSS(R,V,P,ALL_TS) - + %VAR%_ACT(R,V,T,P,S%SOW%) * MAX(STG_LOSS(R,V,P,ALL_TS)/2, +* equilibrium loss (STG_LOSS<0): Act1 * (-Loss/(EXP(-Loss)-1)-1) + ((STG_LOSS(R,V,P,ALL_TS))/(EXP(STG_LOSS(R,V,P,ALL_TS))-1)-1))$STG_LOSS(R,V,P,ALL_TS) + ) +* storage charge + + STG_CHRG(R,T,P,S--RS_STG(R,S)); + + +*--- Balancer Equation --- + + %EQ%_STSBAL(RTP_VINTYR(%R_V_T%,P),TSL,RTS(S),L%SWT%)$(TS_GROUP(R,TSL,S)$PRC_TS(R,P,S)$RP_STL(R,P,TSL,L)).. + +* storage level in time-slice s + SUM(RS_BELOW(R,ANNUAL,S),%VAR%_ACT(R,V,T,P,S%SOW%)+(%VAR%_SIN(R,V,T,P,%PGPRIM%,S%SOW%)+VAR_STS(R,V,T,P,S,'N'))$RP_STL(R,P,TSL,'UP')) + + =E= + + SUM(RS_BELOW(R,ANNUAL,SL(S--RS_STG(R,S))), +* storage level in time-slice s + %VAR%_ACT(R,V,T,P,SL%SOW%)$IPS(L) + %VAR%_UDP(R,V,T,P,SL,'LO'%SOW%)$BD(L) + + (%VAR%_SIN(R,V,T,P,%PGPRIM%,SL%SOW%)+VAR_STS(R,V,T,P,SL,L))$RP_STL(R,P,TSL,'UP') + + +* balancer flows + (%VAR%_SOUT(R,V,T,P,%PGPRIM%,SL%SOW%) - + SUM(PRC_TS(R,P,TS)$RS_BELOW1(R,TS,S),%VAR%_SOUT(R,V,T,P,%PGPRIM%,TS%SOW%)*RS_FR(R,SL,TS)) + - +* storage losses: average storage level * year fraction * loss fraction + (%VAR%_ACT(R,V,T,P,SL%SOW%)$RS_STG(R,S)) * MAX(STG_LOSS(R,V,P,SL)/2, +* equilibrium loss (STG_LOSS<0): Act0 * (1-Loss/(1/EXP(-Loss)-1)) + (1+STG_LOSS(R,V,P,SL)/(1/EXP(STG_LOSS(R,V,P,SL))-1)))$STG_LOSS(R,V,P,SL) - + (%VAR%_ACT(R,V,T,P,S%SOW%)$RS_STG(R,S)+(%VAR%_SIN(R,V,T,P,%PGPRIM%,S%SOW%)-%VAR%_SIN(R,V,T,P,%PGPRIM%,SL%SOW%))$RP_STL(R,P,TSL,'UP')) * +* equilibrium loss (STG_LOSS<0): Act1 * (-Loss/(EXP(-Loss)-1)-1) + MAX(STG_LOSS(R,V,P,SL)/2, (STG_LOSS(R,V,P,SL)/(EXP(STG_LOSS(R,V,P,SL))-1)-1))$STG_LOSS(R,V,P,SL) + )$IPS(L)) + + + SUM(ANNUAL(S), +* net charging into IPS + SUM(TOP(PRC_STGIPS(R,P,C),IO), 1 / PRC_ACTFLO(R,V,P,C) * + %VAR%_SIN(R,V,T,P,C,S %SOW%)$IPS(IO) - %VAR%_SOUT(R,V,T,P,C,S %SOW%)$(NOT IPS(IO))) - +* balancer flow + %VAR%_SOUT(R,V,T,P,%PGPRIM%,S%SOW%)); + + +*--- Levelizer Equation --- + + EQ_STSLEV(RTP_VINTYR(%R_V_T%,P),TSL,RTS(S)%SWX%)$(%SWTX%(STOAL(R,S)=PRC_SGL(R,P))$TS_GROUP(R,TSL,S)$RP_STL(R,P,TSL,'UP')).. + +* Sum of levelizers must be less than average variation over S + SUM(TS_MAP(R,TS,S)$STOA(TS),(%VAR%_SIN(R,V,T,P,%PGPRIM%,TS%SOW%)+%VAR%_UDP(R,V,T,P,TS,'LO'%SOW%)+VAR_STS(R,V,T,P,TS,'N'))/RS_STGPRD(R,TS)) + =L= + SUM(RS_BELOW1(R,S,TS)$RS_FR(R,TS,S),%VAR%_ACT(R,V,T,P,TS%SOW%)/RS_STGPRD(R,TS)*RS_FR(R,TS,S)); + +*$OFFLISTING \ No newline at end of file diff --git a/equ_ext.abs b/equ_ext.abs new file mode 100644 index 0000000..ed29a42 --- /dev/null +++ b/equ_ext.abs @@ -0,0 +1,204 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================= +* EQU_EXT.abs - Extension for Ancillery Balancing Services +*----------------------------------------------------------------------------- +* ABS Final pre-processing +*----------------------------------------------------------------------------- +$IFI NOT %OBMAC%==YES $EXIT +* Adjust equation controls + BS_UPL(RP_UPL(BS_SUPP,BDNEQ))=YES; + BS_UPC(PRC_TSL(BS_SUPP(R,P),TSL),BDNEQ)$SUM(BS_BSC(R,P,C)$(ABS(BS_RTYPE(R,C))>2),1)$=RP_UPS(R,P,TSL,'UP'); + RP_UPL(BS_UPL)=NO; + RP_UPC(BS_UPC)=NO; +* Activate capacity equations + OPTION TRACKP=TS_CYCLE(R,S)*24$(F>1))$(RPS_UPS(R,P,S) OR (STOAL(R,S)*SIGN(Z)<2)),UNCD7(RTP,S,RTP)=YES)); + LOOP(UNCD7(RTP,S,R,T,P),RPS_UPS(R,P,TS)$(STOAL(R,TS)=1)=YES; BS_MAINT(RTP,TS)$RS_TREE(R,S,TS)=EPS$(BS_MAINT(RTP,TS)>=0)$BS_MAINT(RTP,TS)); + +*----------------------------------------------------------------------------- +* Variable macros +$ macro var_bson(r,v,t,p,s) sum(ts_map(r,all_ts,s)$(rs_below1(r,all_ts,s)+annual(s)),var_gap(r,v,t,p,all_ts)+(%var%_ups(r,v,t,p,all_ts,'FX'%SOW%)-var_off(r,v,t,p,s))$rps_ups(r,p,s)) +$ macro var_bsd(typ,rtc,s) %var%_comlv(typ,rtc,s%SOW%) +$ macro var_bsmup(r,v,t,p,s) %var%_bsprs(r,v,t,p,%PGPRIM%,s,'N'%SOW%) +$ macro var_bsfsp(r,v,t,p,c,s) %var%_bsprs(r,v,t,p,c,s,'N'%SOW%) +$ macro var_bsfnsp(r,v,t,p,c,s) %var%_bsprs(r,v,t,p,c,s,'FX'%SOW%) +$ macro var_bsupsr(r,v,t,p,s,bd) %var%_bsprs(r,v,t,p,%PGPRIM%,s,bd%SOW%) +$ macro var_bslack(r,t,p,c,s) %var%_bsprs(r,t,t,p,c,s,'UP'%SOW%) +* Capacity-CPT expression +$IF %STAGES%==YES $%SW_STVARS% +$SET TMP SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P)*(%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)%RCAPSBM%)) + +*----------------------------------------------------------------------------- +* ABS Equation Formulations - numbers refer to document (00=01) +*----------------------------------------------------------------------------- +* ABSEQ1 : Demands for reserves + EQ_BS00(RTC(%R_T%,C),RTS(S)%SWX%)$(%SWTX%BS_OMEGA(R,'0',C,S)$BS_LAMBDA(RTC)).. + SUM(RHS_COMBAL(RTC,TS)$TS_MAP(R,TS,S),%VAR%_COMPRD(RTC,TS%SOW%)/G_YRFR(R,TS)) + =L= +* Supply (converted to common flow units, as also demand) + SUM((RHS_COMBAL(RTC,SL),TS_MAP(R,SL,S))$BS_OMEGA(RTC,SL), + SUM(RTP_VINTYR(R,V,T,P)$(BS_BSC(R,P,C)+YES$BS_STIME(R,P,C,'UP')),PRC_CAPACT(R,P) * + SUM(BS_PRS(R,P,TS)$RS_FR(R,S,TS),(VAR_BSFSP(R,V,T,P,C,TS)+SUM(BS_SUPP(R,P)$(ABS(BS_RTYPE(R,C))>2),VAR_BSFNSP(R,V,T,P,C,TS)))*RS_FR(R,TS,S)))); +*----------------------------------------------------------------------------- +* ABSEQ1+: Max and ABS(diff) and Share equations + EQ_BS01(RHS_COMBAL(RTC(%R_T%,C),RTS(S)),BS_K,L%SWX%)$(%SWTX%(BS_OMEGA(RTC,S)<>2$IPS(L))$BS_SHARE(RTC,BS_K,L)$BS_OMEGA(RTC,S)).. + SUM(BD(LIM(BS_K)),%VAR%_COMNET(RTC,S%SOW%)/G_YRFR(R,S) - BS_LAMBDA(RTC) * + (VAR_BSD('PRB',RTC,S)$BDUPX(BD)-VAR_BSD('DET',RTC,S)$BDLOX(BD))$(BS_OMEGA(RTC,S)<2) - + ((VAR_BSD('PRB',RTC,S)-VAR_BSD('DET',RTC,S))*BDSIG(BD))$(BS_OMEGA(RTC,S)>2))$IPS(L) + + SUM(BD(L), +* Supply by group + SUM(RTP_VINTYR(R,V,T,P)$((BS_BSC(R,P,C)+YES$BS_STIME(R,P,C,'UP'))$GR_GENMAP(R,P,BS_K)),PRC_CAPACT(R,P) * + SUM(BS_PRS(R,P,TS)$RS_FR(R,S,TS),(VAR_BSFSP(R,V,T,P,C,TS)+SUM(BS_SUPP(R,P)$(ABS(BS_RTYPE(R,C))>2),VAR_BSFNSP(R,V,T,P,C,TS)))*RS_FR(R,TS,S))) - +* Share in demand + BS_SHARE(RTC,BS_K,L)*%VAR%_COMNET(RTC,S%SOW%)/G_YRFR(R,S))*BDSIG(L) + =G= 0; +*----------------------------------------------------------------------------- +* ABSEQ2 : Loads by source of imbalance for each user category k + EQ_BS02(%R_T%,RTS(S),BS_K%SWX%)$(%SWTX%SUM(BS_SBD(FINEST(R,S),BD),1)$BS_RTK(R,T,BS_K)).. + SUM(BS_TOP(RP_STD(R,P),C,IO)$GR_GENMAP(R,P,BS_K), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), +$ BATINCLUDE %cal_red% C COM TS P T + * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) + + SUM(RPC_STG(R,P,C)$GR_GENMAP(R,P,BS_K),SIGN(GR_GENMAP(R,P,BS_K))* + SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))* + SUM(BS_TOP(R,P,C,'OUT'),V_U(SOUT,R,V,T,P,C,TS)*STG_EFF(R,V,P))-SUM(BS_TOP(R,P,C,'IN'),V_U(SIN,R,V,T,P,C,TS)))) + + SUM(RPC_IRE(R,P,C,IE)$(NRG_TMAP(R,'ELC',C)$GR_GENMAP(R,P,BS_K)),SIGN(GR_GENMAP(R,P,BS_K))* + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), + (%VAR%_IRE(R,V,T,P,C,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C))* + (1-2$XPT(IE)) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) + =E= %VAR%_RLD(R,T,S,BS_K%SOW%)*G_YRFR(R,S); +*----------------------------------------------------------------------------- +* ABSEQ3 : Stochastic or combined demand with variances + EQ_BS03(RTC(%R_T%,C),RTS(S)%SWX%)$(%SWTX%FINEST(R,S)$BS_LAMBDA(RTC)).. + SUM((RTCS_VARC(RTC,TS),TS_MAP(R,TS,S))$BS_OMEGA(RTC,TS), + (BS_LAMBDA(RTC)*VAR_BSD('PRB',RTC,TS))$(BS_OMEGA(RTC,TS)<>2) + + (%VAR%_COMNET(RTC,TS%SOW%)/G_YRFR(R,TS)-BS_LAMBDA(RTC)*VAR_BSD('DET',RTC,TS)*BS_DETWT(RTC))$(BS_OMEGA(RTC,TS)=2) - + BS_LAMBDA(RTC)*(1-BS_DETWT(RTC)$(BS_OMEGA(RTC,TS)=2))*BS_DELTA(RTC,TS)*3*SUM(BS_RTK(R,T,BS_K),BS_SIGMA(RTC,BS_K,S)*%VAR%_RLD(R,T,S,BS_K%SOW%))) + =G= 0; +*----------------------------------------------------------------------------- +* ABSEQ4 : Deterministic demand + EQ_BS04(RHS_COMBAL(RTC(%R_T%,C),RTS(S)),P%SWX%)$(%SWTX%RTP(R,T,P)$GR_GENMAP(R,P,'SI')$BS_OMEGA(RTC,S)).. + VAR_BSD('DET',RTC,S) + =G= + BS_RTCS('EXOGEN',RTC,S)*BS_CAPACT(R) + PRC_CAPACT(R,P) * + BS_RTCS('WMAXSI',RTC,S)*SUM(RTP_VINTYR(R,V,T,P),(%TMP%)*SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),SUM(BDUPX(BD),COEF_AF%MX%(R,V,T,P,TS,BD))*RS_FR(R,TS,S))); +*----------------------------------------------------------------------------- +* ABSEQ5-6 : Minimum online and offline times (adjusted) + EQ_BS05(RTP_VINTYR(%R_V_T%,P),TSL,BD(L),RTS(S)%SWX%)$(%SWTX%TS_GROUP(R,TSL,S)$BS_UPC(R,P,TSL,L)).. + SUM((RS_UP(R,S,JS),RJ_SL(R,JS,SL)), + V_U(UPS,R,V,T,P,SL,L)$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/2+1/JS_CCL(R,JS),1/JS_CCL(R,JS))2),VAR_BSFNSP(R,V,T,P,C,S)$BS_BSC(R,P,C)$BS_COMTS(R,C,S)); +*----------------------------------------------------------------------------- +* ABSEQ19,21 : Limit the provision of TRT & RRR reserves according to quick start-up / shut-down capacity + EQ_BS19(RTP_VINTYR(%R_V_T%,P),C,RTS(S),BD%SWX%)$(%SWTX%(ABS(BS_RTYPE(R,C))>2)$BS_PRS(R,P,S)$BS_SUPP(R,P)$BS_BSC(R,P,C)$BS_ABD(R,C,BD)).. + SUM(BS_ABD(R,COM,BD)$(MOD(ABS(BS_RTYPE(R,COM))-1,BS_RTYPE(R,C))>1),VAR_BSFNSP(R,V,T,P,COM,S)$BS_BSC(R,P,COM)$BS_COMTS(R,COM,S)) + =L= VAR_BSUPSR(R,V,T,P,S,BD)$RPS_UPS(R,P,S) * SUM(TS_ANN(S,TS),BS_RMAX(R,V,P,C,TS))$BS_COMTS(R,C,S); +*----------------------------------------------------------------------------- +* ABSEQ22 : Ensure sufficient storage level when contracted to reserve + EQ_BS22(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_STGP(R,P)$COEF_AFUPS(R,V,P,S)$RPS_STG(R,P,S)).. +* storage: for single-day (true) activity divide by cycles under parent + SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),%VAR%_ACT(R,V,T,P,TS%SOW%)*RS_FR(R,TS,S)/RS_STGPRD(R,TS))$BS_SBD(R,S,'UP') + =G= + SUM(BS_COMTS(BS_APOS(R,C),S),PRC_CAPACT(R,P)/SQRT(STG_EFF(R,V,P)) / 8760 * + VAR_BSFSP(R,V,T,P,C,S)*(BS_STIME(R,P,C,'LO')/2 +(BS_STIME(R,P,C,'UP')-BS_STIME(R,P,C,'LO'))*MAX(1,G_YRFR(R,S)/RS_STGPRD(R,S)*8760/(1+BS_STIME(R,P,C,'UP'))**0.5))); +*----------------------------------------------------------------------------- +* ABSEQ23 : Limit storage level by capacity and contracted reserve + EQ_BS23(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_STGP(R,P)$COEF_AFUPS(R,V,P,S)$RPS_STG(R,P,S)).. +* storage: for single-day (true) activity divide by cycles under parent + SUM(PRC_TS(R,P,TS)$RS_FR(R,TS,S),%VAR%_ACT(R,V,T,P,TS%SOW%)*RS_FR(R,TS,S)/RS_STGPRD(R,TS)) + =L= +* available process capacity - vintaged or not + ((%TMP%)*COEF_AFUPS(R,V,P,S) / EXP(PRC_SC(R,P)) * PRC_CAPACT(R,P)) - + SUM(BS_COMTS(BS_ANEG(R,C),S),PRC_CAPACT(R,P)*SQRT(STG_EFF(R,V,P)) / 8760 * + VAR_BSFSP(R,V,T,P,C,S)*(BS_STIME(R,P,C,'LO')/2 +(BS_STIME(R,P,C,'UP')-BS_STIME(R,P,C,'LO'))*MAX(1,G_YRFR(R,S)/RS_STGPRD(R,S)*8760/(1+BS_STIME(R,P,C,'UP'))**0.5))); +*----------------------------------------------------------------------------- +* ABSEQ24 : End-use - negative + EQ_BS24(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_PRS(R,P,S)$AFS(R,T,P,S,'UP')$BS_SBD(R,S,'LO')$BS_NEGP(R,P)$BS_ENDP(R,P)).. + SUM(BS_COMTS(BS_ANEG(R,C),S)$BS_BSC(R,P,C),VAR_BSFSP(R,V,T,P,C,S)) =L= +* available process capacity - activity level + (VAR_BSON(R,V,T,P,S)*COEF_AF%MX%(R,V,T,P,S,'UP') - %VAR%_ACT(R,V,T,P,S%SOW%)/PRC_CAPACT(R,P)/G_YRFR(R,S)) * + SUM((TOP(R,P,C,'IN'),RPC_PG(R,P,COM))$NRG_TMAP(R,'ELC',C), + PRC_ACTFLO(R,V,P,C)$RPC_PG(R,P,C) + + (SUM(RTPCS_VARF(R,T,P,C,TS)$RS_FR(R,TS,S),RS_FR(R,TS,S)*SUM(RPG_1ACE(R,P,CG,C)$COEF_PTRAN(R,V,P,CG,C,COM,TS),1/COEF_PTRAN(R,V,P,CG,C,COM,TS)))+ + SUM(RP_PG(R,P,CG),COEF_PTRAN(R,V,P,CG,COM,C,S)))$(NOT RPC_PG(R,P,C))); +*----------------------------------------------------------------------------- +* ABSEQ25 : End-use - positive + EQ_BS25(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%BS_PRS(R,P,S)$BS_SBD(R,S,'UP')$BS_ENDP(R,P)).. + SUM(BS_COMTS(BS_APOS(R,C),S)$BS_BSC(R,P,C),VAR_BSFSP(R,V,T,P,C,S))*PRC_CAPACT(R,P)*G_YRFR(R,S) =L= + SUM(TOP(R,P,C,'IN')$NRG_TMAP(R,'ELC',C), + SUM(RTPCS_VARF(R,T,P,C,TS)$TS_MAP(R,S,TS), +$ BATINCLUDE %cal_red% C COM TS P T + )$RP_STD(R,P)+SUM(RPCS_VAR(RPC_STG(R,P,C),TS)$TS_MAP(R,S,TS),V_U(SIN,R,V,T,P,C,TS)$(PRC_NSTTS(R,P,TS)+PRC_STGTSS(R,P,C)))); +*----------------------------------------------------------------------------- +* ABSEQ26 : Bound on process reserve provision + EQ_BS26(RTP(%R_T%,P),C,RTS(S)%SWX%)$(%SWTX%BS_COMTS(R,C,S)$(BS_BSC(R,P,C)+YES$BS_STIME(R,P,C,'UP'))$BS_BNDPRS(RTP,C,S,'N')).. + SUM((RTP_VINTYR(R,V,T,P),BS_PRS(R,P,TS))$RS_FR(R,TS,S), + (VAR_BSFSP(R,V,T,P,C,TS)+VAR_BSFNSP(R,V,T,P,C,TS)$(ABS(BS_RTYPE(R,C))>2)$BS_SUPP(R,P))*RS_FR(R,TS,S)) + =E= VAR_BSLACK(R,T,P,C,S); +*----------------------------------------------------------------------------- +* ABSEQ27 : Maintenence 1 - entrance to maintenance + EQ_BS27(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%(BS_MAINT(R,V,P,S)>=0)$BS_MAINT(R,V,P,S)).. + SUM(TS_MAP(R,S,TS)$RPS_UPS(R,P,TS), + (VAR_BSMUP(R,V,T,P,TS)*MIN(1,ROUND(BS_MAINT(R,V,P,S),1)/8760*RS_STGPRD(R,TS)/G_YRFR(R,S)))$PRC_TS(R,P,TS) + + (VAR_OFF(R,V,T,P,TS)*RS_FR(R,TS,S)$(BS_MAINT(R,V,P,S)=0))$TS_CYCLE(R,TS)) + =G= +* unavailable process capacity - vintaged or not + SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,K,T,P)*(%VARM%_NCAP(R,K,P%SWS%)$T(K)+NCAP_PASTI(R,K,P)%RCAPSBM%)*((1-COEF_AF%MX%(R,K,T,P,S,'UP'))$(ACT_UPS(R,T,P,S,'N')=0)+ACT_UPS(R,T,P,S,'N'))); +*----------------------------------------------------------------------------- +* ABSEQ28 : Maintenence 2 - continuous duration + EQ_BS28(RTP_VINTYR(%R_V_T%,P),RTS(S)%SWX%)$(%SWTX%PRC_TS(R,P,S)$BS_MAINT(R,V,P,S)).. + SUM((RS_UP(R,S,JS),RJ_SL(R,JS,SL)),VAR_BSMUP(R,V,T,P,SL)$(MOD(RS_HR(R,S)-RS_HR(R,SL)+G_YRFR(R,S)/RS_STGPRD(R,S)/2+1/JS_CCL(R,JS),1/JS_CCL(R,JS)) %TMP% + IF(execerror,PUT END_GAMS "%3%5"; PUTCLOSE); +%1 $%2 "%3" +$GOTO DONE + +$LABEL SOLVE + Z = MIN(14,%MODEL_NAME%.MODELSTAT)-1; IF(Z > 18, Z=11); + IF(Z>=0,PUT SCREEN /"--- TIMES Solve status: "; + LOOP(SAMEAS(J,'1'), PUT SOLVESTAT.TE(J+Z)); + PUTCLOSE; + PUT END_GAMS "Solve status: "; + LOOP(SAMEAS(J,'1'), PUT SOLVESTAT.TE(J+Z) /); + PUTCLOSE; + Z = ABS(ABS(2*%MODEL_NAME%.MODELSTAT-9)-6)); + IF(Z>1.5 OR %MODEL_NAME%.MODELSTAT=7,execerror=1); +$IF %ERR_ABORT%==NO Z=0; +* [UR] allow solution "optimal with unscaled infeasibilities" +* -- allow even "intermediate non-optimal" for investigation +*ABORT$((%MODEL_NAME%.MODELSTAT GT 1) OR (%MODEL_NAME%.SOLVESTAT GT 1)) '*** ERRORS IN OPTIMIZATION ***' + ABORT$(Z>1.5) '%2'; + IF(execerror,execerror=0); +$LABEL DONE +*$OFFLISTING +; diff --git a/fillcost.gms b/fillcost.gms new file mode 100644 index 0000000..76ce21b --- /dev/null +++ b/fillcost.gms @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +******************************************************************************* +* FILLCOST : Fill cost parameters +* Description: Dense interpolation/extrapolation of cost parameters +* Parameters: +* %1 - table name +* %2 - control set 1 (before year index) +* %3 - control set 2 (after year index) +* %4 - UNCD7 residual dimension +* %5 - CKEYERS2 or EOHYEARS depending on cost parameter +* %6 - Validity Qualifier restricting interpolation +* %7 - Qualifier restricting backward extrapolation +* %8 - Qualifier restricting forward extrapolation +* %9 - Original data table +* %10 - Write cache +******************************************************************************* +*$ONLISTING +$ EOLCOM ! +$SETLOCAL SRC '%9' SETLOCAL DATA '%10(%2,%3,%5)' SETLOCAL TAKE '$%6' SETLOCAL TMP %3%4 +$IF DIMENSION 8 %9 $SETLOCAL TMP %4 + PARAMETER %10(%2,%3,ALLYEAR); + IF(YES,OPTION CLEAR=UNCD7; +$IF '%11'==1 %1(%2,DATAYEAR,%3) $= %9(%2,DATAYEAR,%3)%TAKE%; +$IF '%11'==1 $SETLOCAL TAKE '' SETLOCAL SRC %1 + UNCD7(%2,LL--ORD(LL),%TMP%)%TAKE% $= %SRC%(%2,LL,%3); + LOOP(UNCD7(%2,YEAR,%TMP%), F=0; LAST_VAL=0; + OPTION CLEAR=MY_FIL2; MY_ARRAY(DM_YEAR)= %SRC%(%2,DM_YEAR,%3); +* do linear interpolation + LOOP(DM_YEAR(LL)$MY_ARRAY(DM_YEAR), ! check for nonzero + MY_F = MY_ARRAY(LL); Z = YEARVAL(LL); + IF(LAST_VAL, LAST_VAL=(MY_F-LAST_VAL)/(Z-MY_FYEAR); + FOR(CNT=MY_FYEAR-Z+1 TO -1, MY_FIL2(%5(LL+CNT)) = MY_F+LAST_VAL*CNT;); + ELSE F = Z; FIRST_VAL = MY_F;); + LAST_VAL = MY_F; MY_FYEAR=Z); ! remember the value and year +* Do back/forward extrapolate +$IF '%11'==2 MY_FIL2(%5) $= MY_ARRAY(%5); + %DATA% $= FIRST_VAL$(%7(YEARVAL(%5) LT F)) + MY_FIL2(%5) + LAST_VAL$(%8(YEARVAL(%5) GT Z)); + ); +); +$IF NOT '%11'==2 %1(%2,%5,%3) $= %DATA%; OPTION CLEAR=%10; +$IF '%11'==2 %10('EMPTY',%3,'EMPTY')=0; +$OFFLISTING diff --git a/fillparm.gms b/fillparm.gms new file mode 100644 index 0000000..a232166 --- /dev/null +++ b/fillparm.gms @@ -0,0 +1,57 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +******************************************************************************* +* FILLPARM : Interpolation/extrapolation of user data +* Description: Default interpolation/extrapolation if no control option given +* Non-default interpolation/extrapolation according to user option +* DFUNC = -1-> no interpolation, 0-> default action, +* DFUNC = +1-> interp., 2->interp.+EPS, 3->interp.+extrap. +* DFUNC >999 -> exponential interpolation beyond year DFUNC +* Parameters: +* %1 - table name +* %2 - control set 1 +* %3 - control set 2 +* %4 - UNCD7 residual dimension +* %5 - MODLYEAR or MILESTONYR depending on parameter +* %6 - RTP controlling the assignment to the MODLYEARs +* %7 - Selective test for control option (normally GE 0) +* %8 - Optional name for temporary write cache +******************************************************************************* +*$ONLISTING +$EOLCOM ! +$SETLOCAL DATA '%1(%2,%5,%3)' SETLOCAL ITEM '%1(%2,%5,%3)' SETLOCAL ADD '' +$IF NOT '%8' == '' $SETLOCAL DATA '%8(%2,%3,%5)' SETLOCAL ITEM 'MY_FIL2(%5)' SETLOCAL ADD '+MY_FIL2(%5)' +$IF NOT '%8'=='%9' PARAMETER %8(%2,%3,ALLYEAR); +* conditional interpolation flag + IF(NOT G_NOINTERP, OPTION CLEAR = UNCD7; + LOOP(DATAYEAR, UNCD7(%2,%3%4)$%1(%2,DATAYEAR,%3) = YES;); + LOOP(UNCD7(%2,%3%4), DFUNC = ROUND(%1(%2,'%DFLBL%',%3)); + IF(DFUNC %7, OPTION CLEAR=MY_FIL2; CNT = (DFUNC LE 999); + MY_ARRAY(DM_YEAR) = %1(%2,DM_YEAR,%3); LAST_VAL=0; F = 0; Z = 0; +* do interpolate + LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), ! check for nonzero (including EPS) + MY_F = MY_ARRAY(DM_YEAR); Z = YEARVAL(DM_YEAR); + IF(LAST_VAL, + IF(CNT OR (Z LE DFUNC), ! linear interpolation + %ITEM%$((Z GT YEARVAL(%5))$(YEARVAL(%5) GT MY_FYEAR)) + = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(YEARVAL(%5)-MY_FYEAR); ! not the first one + ELSE ! exponential function + %ITEM%$((Z GT YEARVAL(%5))$(YEARVAL(%5) GT MY_FYEAR)) + = LAST_VAL*POWER(1+MY_F,YEARVAL(%5)-MY_FYEAR); + MY_F = LAST_VAL*POWER(1+MY_F,Z-MY_FYEAR); + %1(%2,DM_YEAR,%3) = MY_F;); ! overwrite old data + ELSE F = Z; FIRST_VAL = MY_F;); + LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year + IF(DFUNC GT 1, + IF(CNT,DFUNC=MOD(DFUNC,10); + IF(DFUNC EQ 2, FIRST_VAL = EPS; LAST_VAL = EPS; ELSEIF DFUNC EQ 4, Z = INF; ELSEIF DFUNC EQ 5, F = 0))); + IF((DFUNC NE 1), +* Do back/forward extrapolate, or fill in with EPS + %DATA%$%6 $= FIRST_VAL$(YEARVAL(%5) LT F) %ADD% + LAST_VAL$(YEARVAL(%5) GT Z); +$IF NOT '%8' == '' ELSE %DATA%$%6 $= %ITEM%; + ))); +* Reset OPT and add DATA + %1(%2,'%DFLBL%',%3)$%1(%2,'%DFLBL%',%3) = MIN(%RESET%,%1(%2,'%DFLBL%',%3)); +$IF NOT '%8' == '' %1(%2,%5,%3) $= %DATA%; OPTION KILL = %8; + ); +$OFFLISTING diff --git a/fillsow.stc b/fillsow.stc new file mode 100644 index 0000000..565e557 --- /dev/null +++ b/fillsow.stc @@ -0,0 +1,47 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +******************************************************************************* +* FILLSOW : Fill stochastic parameters +* Description: Preprocessing of stochastic uncertain data +* Parameters: +* %1 - table name +* %2 - control set 1 (before year index) +* %3 - control set 2 (after year index) +* %4 - Source data years T/LL +* %5 - YES/NO for absolute/relative parameters +* %6 - PERIOD control (SW_T OR PERIODYR OR SUPERYR) +* %7 - YES/NO to copy baseline parameters +******************************************************************************* +*$ONLISTING +$SETLOCAL TAIL ',%3' SETLOCAL STG '' SETLOCAL IX "'0'" +$IF '%3' == '' $SETLOCAL TAIL '' +$IF '%4' == '' $SETLOCAL IX '' +$IF '%4' =='T' $SETLOCAL STG SW_TSTG(T,J)$ + +* Clean up stage 1 from invalid SOW: + S_%1(%2%4%TAIL%,'1',SOW)$(NOT SAMEAS(SOW,'1')) = 0; + +* Set up data indicators +$IF NOT '%4'=='' S_%1(%2LL--ORD(LL)%TAIL%,J,WW) $= S_%1(%2LL%TAIL%,J,WW); + F = CARD(S_%1); + +* Copy parameters from first to other branches when appropriate + S_%1(%2%4%TAIL%,J,WW)$(%STG%(NOT S_%1(%2%IX%%TAIL%,J,WW))) $= SUM(SW_CPMAP(J,WW,SOW),S_%1(%2%4%TAIL%,J,SOW)); + +$IF NOT '%5' == 'YES' $EXIT + +* Update data indicators if eventual copy occurred +$IF NOT '%4'=='' IF(CARD(S_%1)>F, S_%1(%2LL--ORD(LL)%TAIL%,J,WW) $= S_%1(%2LL%TAIL%,J,WW)); + +* Copy baseline parameters to stage 1, SOW 1: +$IF '%7'==YES S_%1(%2%4%TAIL%,'1','1')$(NOT S_%1(%2%IX%%TAIL%,'1','1')) $= %1(%2%4%TAIL%); + +* Merge to single stage 1: + +$IFI NOT '%4'==LL LOOP(J$SW_START(J),S_%1(%2%4%TAIL%,'1',WW)$(%STG%%6) $= SUM(SW_REV(WW,J,SOW),S_%1(%2%4%TAIL%,J,SOW))); +$IFI '%4' == LL LOOP(SW_TSTG(T,J), S_%1(%2%4%TAIL%,'1',WW)$(%6$SW_T(T,WW)) $= SUM(SW_REV(WW,J,SOW),S_%1(%2%4%TAIL%,J,SOW))); + +* Remove flags if LL +$IF '%4'=='LL' S_%1(%2%IX%%TAIL%,J,WW) = 0; diff --git a/fillvint.gms b/fillvint.gms new file mode 100644 index 0000000..9ddab9b --- /dev/null +++ b/fillvint.gms @@ -0,0 +1,35 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +******************************************************************************* +* FILLVINT : Optional weighting of vintaged attributes +* %1 - table name +* %2 - Control set 1 +* %3 - Control set 2 +* %4 - Name for temporary cache +******************************************************************************* +*$ONLISTING +$ IF NOT '%4'=='' $GOTO FILL +*------------------------------------------------------------------------------ +* Initialization + OPTION CLEAR=PRC_YMIN,CLEAR=PASTSUM; +$IF %VINTOPT%==2 PRC_SIMV(PRC_VINT(R,P)) = NOT PRC_MAP(R,'STG',P); +$IF DEFINED PRC_SIMV PRC_SIMV(R,P)$PRC_MAP(R,'STG',P) = NO; PRC_VINT(PRC_SIMV) = YES; +* Make sure that all PRC_VINT have first leading V in RTP: + LOOP(T(LL),RVP(R,V(LL-LEAD(T)),P)$((NOT RVP(R,V,P))$RVP(R,T,P)$PRC_VINT(R,P)) = YES); +$IF DEFINED PRC_SIMV RTP(RVP(R,V,P)) $=PRC_SIMV(R,P); +$EXIT +*------------------------------------------------------------------------------ +$ LABEL FILL + PARAMETER %4(%2,%3,ALLYEAR); + IF(CARD(PASTSUM)=0, + PASTSUM(RTP(R,T,P))$PRC_VINT(R,P) = + MIN(1,(MAX(YEARVAL(T)-(LEAD(T)-1)/2,B(T)+MAX(NCAP_ILED(RTP),(D(T)+NCAP_ILED(RTP)-NCAP_TLIFE(RTP))/2)) - + (YEARVAL(T)-LEAD(T))) / LEAD(T))); + TRACKP(PRC_VINT) = YES; +$IF DEFINED PRC_SIMV TRACKP(PRC_SIMV) = NO; +* Weighted average of vintages T and T-1 + LOOP((T(LL),V(LL-LEAD(LL))), + %4(%2,%3,T)$(%1(%2,T,%3)$TRACKP(R,P)) = %1(%2,T,%3)*PASTSUM(R,T,P)+%1(%2,V,%3)*(1-PASTSUM(R,T,P))); + %1(%2,T,%3) $= %4(%2,%3,T); + OPTION CLEAR=%4,CLEAR=TRACKP; +$OFFLISTING diff --git a/fillwave.gms b/fillwave.gms new file mode 100644 index 0000000..8330ce7 --- /dev/null +++ b/fillwave.gms @@ -0,0 +1,21 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +******************************************************************* +* FILLWAVE : Fill parameters via weighted centered averaging +* %1 - table name +* %2 - index set (after year index) +******************************************************************* +$ SET TMP OBJ_DISC(R,LL,CUR)/COEF_PVT(R,T) +$ IF '%CTST%'=='' $SET TMP 1/D(T) + SET REG_%2(REG,%2); + IF(CARD(VDA_DISC)=0,VDA_DISC(R,MIYR_1)=1; LOOP((G_RCUR(R,CUR),T(TT+1)),VDA_DISC(R,Y_EOH(LL))$PERIODYR(T,LL)=%TMP%)); + OPTION REG_%2 <= %1; DONE=SMAX(T,M(T)); + LOOP(REG_%2(R,%2), OPTION CLEAR=FIL2; + MY_ARRAY(DM_YEAR)=%1(R,DM_YEAR,%2); MY_F=0; Z=0; +* interpolate densely + LOOP(DM_YEAR(LL)$MY_ARRAY(LL), + LAST_VAL=MY_F; F=Z; MY_F=MY_ARRAY(LL); Z=YEARVAL(LL); + IF(LAST_VAL, FOR(CNT=F-Z+1 TO -1, FIL2(LL+CNT)=MY_F+(MY_F-LAST_VAL)/(Z-F)*CNT))); + IF(DONE=Z$%3,FIL2(Y_EOH)$(YEARVAL(Y_EOH)>Z)=MY_F); +* weighted centered average + %1(R,T,%2) = SUM(PERIODYR(T,Y_EOH(LL)),(MY_ARRAY(LL)+FIL2(LL))*VDA_DISC(R,LL))); diff --git a/filparam.gms b/filparam.gms new file mode 100644 index 0000000..04c4efe --- /dev/null +++ b/filparam.gms @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +******************************************************************************* +* FILPARAM : Fill parameter +* Description: Dense interpolation/extrapolation of parameters +* Parameters: +* %1 - table name +* %2 - control set 1 (before year index) +* %3 - control set 2 (after year index) +* %4 - UNCD7 residual dimension +* %5 - Source data years (e.g. ALLYEAR, DM_YEAR) +* %6 - Target data years (e.g. ALLYEAR, MILESTONYR) +* %7 - Qualifier restricting backward extrapolation +* %8 - Qualifier restricting forward extrapolation +* %9 - Default interpolation option +******************************************************************************* +*$ONLISTING +$ EOLCOM ! +$SETLOCAL SRC '%1' SETLOCAL TAIL1 '%3' SETLOCAL TAIL2 ',%3' +$IF '%3' == '' $SETLOCAL TAIL1 "''" SETLOCAL TAIL2 '' +$IF '%10'=='' IF(YES, OPTION CLEAR = UNCD7; LOOP((%2%5%TAIL2%)$%SRC%(%2%5%TAIL2%), UNCD7(%2%TAIL1%%4) = YES)); +$IF NOT '%10'=='' IF(YES, OPTION CLEAR = UNCD7; UNCD7(%2LL--ORD(LL),%TAIL1%%4)$%SRC%(%2LL%TAIL2%) = YES); + LOOP(UNCD7(%2%10%TAIL1%%4), F=0; Z=INF; MY_FYEAR=9999; + DFUNC = ROUND(%SRC%(%2'%DFLBL%'%TAIL2%)); +$IF NOT %9=='' IF(NOT DFUNC, DFUNC = %9); + IF(DFUNC GE 0, + MY_ARRAY(%5) = %SRC%(%2%5%TAIL2%); MY_ARRAY('%DFLBL%')=0; +* do interpolate + LOOP(%5$MY_ARRAY(%5), ! check for nonzero (including EPS) + MY_F = MY_ARRAY(%5); Z = YEARVAL(%5); + IF(Z > MY_FYEAR+1, ! linear interpolation + %1(%2%6%TAIL2%)$((Z GT YEARVAL(%6))$(YEARVAL(%6) GT MY_FYEAR)) + = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(YEARVAL(%6)-MY_FYEAR); ! not the first one + ELSEIF Z LT MY_FYEAR, F=Z; FIRST_VAL = MY_F); + LAST_VAL = MY_F; MY_FYEAR=Z); ! remember the value and year +* Do back/forward extrapolate + IF(DFUNC GT 1, DFUNC=MOD(DFUNC,10); + IF(DFUNC EQ 2, FIRST_VAL=EPS; LAST_VAL=EPS; ELSEIF DFUNC EQ 4, Z=INF; ELSEIF DFUNC EQ 5, F=0)); + IF(DFUNC NE 1, + %1(%2%6%TAIL2%) $= FIRST_VAL$(%7(YEARVAL(%6) LT F)) + LAST_VAL$(%8(YEARVAL(%6) GT Z)); + )); + ); +$OFFLISTING diff --git a/filshape.gms b/filshape.gms new file mode 100644 index 0000000..7d8c34d --- /dev/null +++ b/filshape.gms @@ -0,0 +1,26 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +******************************************************************************* +* FILSHAPE : Fill shape parameters +* Description: Dense interpolation/extrapolation of shape values +* Parameters: +* %1 - Limit for forward extrapolation (MAXLIFE) +******************************************************************************* +*$ONLISTING +$ EOLCOM ! + SET AGEFIL(AGE); + LOOP(J, Z = 0; MY_FYEAR = 9999; +* do interpolate + AGEFIL(AGE) = YES$SHAPE(J,AGE); + LOOP(AGE$AGEFIL(AGE), ! check for nonzero (including EPS) + MY_F = SHAPE(J,AGE); Z = ORD(AGE); + IF(Z > MY_FYEAR+1, ! linear interpolation + SHAPE(J,LIFE)$((ORD(LIFE) GT MY_FYEAR)$(Z GT ORD(LIFE))) + = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(ORD(LIFE)-MY_FYEAR); + ELSEIF Z LT MY_FYEAR, F = Z;); + LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year +* Do back/forward extrapolate + IF(Z, SHAPE(J,LIFE)$(ORD(LIFE) LT F) = 1; + SHAPE(J,LIFE)$((ORD(LIFE) GT Z)$(ORD(LIFE) LE %1)) = LAST_VAL;); + ); +$OFFLISTING diff --git a/forcupd.cli b/forcupd.cli new file mode 100644 index 0000000..fd35bd7 --- /dev/null +++ b/forcupd.cli @@ -0,0 +1,33 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*---------------------------------------------------------------------------- +* FORCUPD.cli - Climate Module forcing function update +*---------------------------------------------------------------------------- +$SET CH4_PRE 700 +$SET N2O_PRE 270 +$SET FOFO (0.47*LOG(1 + 2.01E-5*(F*Z)**0.75 + 5.31E-15*F*(F*Z)**1.52)-MY_SUM) + + LOOP(CM_ATMAP(CM_EMIS,CM_HISTS), CM_RESULT(CM_HISTS,LL)$CM_LED(LL) = + SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),VAR_CLIBOX.L(CM_VAR,LL))/CM_PPM(CM_EMIS)); + F=%CH4_PRE%; Z=%N2O_PRE%; MY_SUM=0; MY_SUM=%FOFO%; + LOOP(LL$CM_LED(LL), +*...methane + F = MAX(1,CM_RESULT('CH4-PPB',LL)-.5); Z = %N2O_PRE%; + FIRST_VAL = .036*(SQRT(F)-SQRT(%CH4_PRE%)) - %FOFO%; F=F+1; + LAST_VAL = .036*(SQRT(F)-SQRT(%CH4_PRE%)) - %FOFO%; + Z=LAST_VAL-FIRST_VAL; LAST_VAL=(FIRST_VAL+LAST_VAL)/2; + CM_LINFOR(LL,'CH4-PPB','N') = Z; + CM_LINFOR(LL,'CH4-PPB','FX') = LAST_VAL-Z*(F-0.5); +*...nitrous + F = %CH4_PRE%; Z = MAX(1,CM_RESULT('N2O-PPB',LL)-.5); + FIRST_VAL = 0.12*(SQRT(Z)-SQRT(%N2O_PRE%)) - %FOFO%; Z=Z+1; + LAST_VAL = 0.12*(SQRT(Z)-SQRT(%N2O_PRE%)) - %FOFO%; + F=LAST_VAL-FIRST_VAL; LAST_VAL=(FIRST_VAL+LAST_VAL)/2; + CM_LINFOR(LL,'N2O-PPB','N') = F; + CM_LINFOR(LL,'N2O-PPB','FX') = LAST_VAL-F*(Z-0.5); + ); +* carbon + CM_LINFOR(LL,'CO2-PPM',BDNEQ)$CM_LED(LL) = CM_RESULT('CO2-PPM',LL); +$ BATINCLUDE coef_ext.cli SLOPE diff --git a/gdxfilter.gms b/gdxfilter.gms new file mode 100644 index 0000000..c7aa51f --- /dev/null +++ b/gdxfilter.gms @@ -0,0 +1,30 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +*=============================================================================* +* Filtering Domain Violations via GDX +$ GOTO %1 +$ LABEL MAIN +$ SET TMP "'" SET MX +$ IFI %SYSTEM.FILESYS%==MSNT $SET TMP '"' + DISPLAY 'GAMS Warnings detected; Data have been Filtered via GDX'; +$ hiddencall gdxdump _dd_.gdx NODATA > _dd_.dmp +$ hiddencall sed %TMP%/^\(Scalar\|[^$(]*([^,]*)\|[^$].*empty *$\)/{N;d;}; /^\([^$]\|$\)/d; s/\$LOAD.. /\$LOADR /I%TMP% _dd_.dmp > _dd_.dd +$ IF gamsversion 301 $onFiltered +* Half-baked workaround for GAMS 342 +$ IF %SYSTEM.GAMSVERSION%==342 +$ ONRECURSE $BATINCLUDE gdxfilter DAM_COST GR_VARGEN NCAP_DISC NCAP_OLIFE NCAP_SEMI PRC_DSCNCAP PRC_RCAP PRC_REACT PRC_REFIT RCAP_BLK REG_BDNCAP TM_CATT TM_UDF UC_ACTBET UC_CLI UC_FLOBET S_COM_FR S_DAM_COST S_FLO_FUNC S_NCAP_AFS +$ INCLUDE _dd_.dd +$ GDXIN +$ IF %SYSTEM.GAMSVERSION%==342 $INCLUDE _dd_.dmp +$ hiddencall rm -f _dd_.dmp +$ EXIT +*------------------------------------------------------------------------------ +$ LABEL DAM_COST +* Prepare for killing with GAMS 34.2 +$ LABEL MORE +$ IF %1.==. $GOTO PUTOUT +$ IF DECLARED %1 +$ IF NOT DEFINED %1 $SET MX %1 %MX% +$ SHIFT GOTO MORE +$ LABEL PUTOUT +$ echon $KILL %MX% > _dd_.dmp \ No newline at end of file diff --git a/globals.def b/globals.def new file mode 100644 index 0000000..86a802c --- /dev/null +++ b/globals.def @@ -0,0 +1,16 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==============================================================================* +* GLOBALS.DEF has all the declaration & defaults for SCALARS & Parameters * +*==============================================================================* + +* global initialization and other scalar defaults which may be changed here +* or overwritten in the user *.DD + SCALAR G_DYEAR 'Year to discount to' / 0 /; + SCALAR G_ILEDNO '1/threshold at which to ignore ILED' / 10 /; + SCALAR G_TLIFE 'Default technology life if not provided' / 10 /; + SCALAR G_VINT '% annual change in input data for vintaging' / .1 /; + SCALAR G_NOINTERP 'Turn off interplation' / 0 /; + PARAMETER G_CYCLE(TSLVL) 'Number of cycles in average year' / ANNUAL 1, SEASON 1, DAYNITE 365 /; diff --git a/init_ext.abs b/init_ext.abs new file mode 100644 index 0000000..c6040f6 --- /dev/null +++ b/init_ext.abs @@ -0,0 +1,32 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* INIT_EXT.xtd oversees initial preprocessor activities +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Get processes allowed to participate in the reserve markets per region + OPTION BS_BSC0) $=BS_RTYPE(R,C); + BS_ANEG(R,C) $= BS_ABD(R,C,'LO'); + BS_APOS(R,C) $= BS_ABD(R,C,'UP'); +* Remove invalid values + BS_DEMDET(R,YEAR,RSP,C,S)$(NOT BS_RTYPE(R,C))=0; + BS_OMEGA(R,YEAR,C,S)$(NOT BS_RTYPE(R,C))=0; + BS_DELTA(R,YEAR,C,S)$(NOT BS_RTYPE(R,C))=0; + BS_LAMBDA(R,YEAR,C)$(NOT BS_RTYPE(R,C))=0; + BS_DETWT(R,YEAR,C)$(NOT BS_RTYPE(R,C))=0; + BS_SIGMA(R,YEAR,C,ITEM,S)$(NOT BS_RTYPE(R,C))=0; + BS_RMAX(R,YEAR,P,C,S)$(NOT BS_RTYPE(R,C))=0; + BS_STIME(R,P,C,BD)$(NOT BS_RTYPE(R,C))=0; diff --git a/init_ext.dsc b/init_ext.dsc new file mode 100644 index 0000000..88ff198 --- /dev/null +++ b/init_ext.dsc @@ -0,0 +1,20 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* INIT_EXT.xtd oversees initial preprocessor activities * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* Questions/Comments: +*----------------------------------------------------------------------------- +* Handle automatic activation of discrete extension +$IF DEFINED PRC_DSCNCAP NCAP_DISC(R,T--ORD(T),P,'0')$PRC_DSCNCAP(R,P) = EPS; +$IF DEFINED NCAP_SEMI OPTION PRC_SEMI5,B(T)=YEARVAL(T)); + MIYR_1(T)=YES; MIYR_BOH=B(T)-1); + PYR_S(LL) = YEARVAL(LL)=MIYR_BOH; +$IFI %WAVER%==YES INT_DEFAULT('PASTI')=1; +*----------------------------------------------------------------------------- +* Peaking and Storage stuff + PRC_PKNO(R,P)$((NCAP_PKCNT(R,'0',P,'ANNUAL')>=10)$NCAP_PKCNT(R,'0',P,'ANNUAL')) = YES; + PRC_PKAF(R,P)$((NCAP_PKCNT(R,'0',P,'ANNUAL')<= 0)$NCAP_PKCNT(R,'0',P,'ANNUAL')) = YES; + PRC_STGIPS(R,P,C)$(NOT SUM(PRC_ACTUNT(R,P,CG,UNITS_ACT)$(COM_GMAP(R,CG,C)+SAMEAS(CG,C)),1)) = NO; +* Set penalty cost for partial loads and excess storage cycling + OPTION TRACKP0)$PRC_RESID(R,LL,P)) = PRC_RESID(R,'0',P)+EPS; + NCAP_PASTI(R,PYR_S,P)$PRC_RESID(R,'0',P) = 1; +*----------------------------------------------------------------------------- +* Initial Preprocessing of VDA_EMCB and FLO_EMIS + FLO_EMIS(R,LL,P,CG,C,S) $= FLO_EFF(R,LL,P,CG,C,S); + OPTION CLEAR=RXX,CLEAR=FLO_EFF; + VDA_EMCB(R,DATAYEAR,C,COM)$COM_TMAP(R,'ENV',C) = 0; + LOOP((R,DATAYEAR,C,COM)$VDA_EMCB(R,DATAYEAR,C,COM),RXX(R,C,COM) = YES;); + RXX(R,C,COM)$(NOT COM_TMAP(R,'ENV',COM)) = NO; + LOOP((TOP(R,P,C,'IN'),RXX(R,C,COM)),FS_EMCB(R,P,COM,C)=YES); + FS_EMCB(R,P,COM,C)$TOP(R,P,COM,'IN') = NO; + OPTION TRACKPC <= FS_EMCB; TOP(TRACKPC,'OUT') = YES; + OPTION CLEAR=RXX, CLEAR=TRACKPC, PRC_ACT < PRC_ACTUNT; + LOOP((R,DATAYEAR,P,CG,C,S)$FLO_EMIS(R,DATAYEAR,P,CG,C,S),RPC_EMIS(R,P,C) = YES); + TOP(RPC_EMIS(PRC_ACT(R,P),C),'OUT')$(COM_TMAP(R,'ENV',C)*(NOT TOP(R,P,C,'IN'))) = YES; +*----------------------------------------------------------------------------- +* Initial Preprocessing of COM_AGG and VDA_FLOP + COM_AGG(R,LL,C,C)$COM_AGG(R,LL,C,C) = 0; + VDA_FLOP(R,LL,P,CG,S) $= ACT_FLO(R,LL,P,CG,S); + KEEP_FLOF(R,P,C)$VDA_FLOP(R,'%DFLBL%',P,C,'ANNUAL') = YES; +$IFI %SHELL%==ANSWER KEEP_FLOF(R,P,C)$PRC_ACTFLO(R,'%DFLBL%',P,C) = YES; +*----------------------------------------------------------------------------- +* Initial Preprocessing of IRE_FLOSUM + LOOP((R,DATAYEAR,P,C,S,IE,COM,IO)$IRE_FLOSUM(R,DATAYEAR,P,C,S,IE,COM,IO),RPG_ACE(R,P,COM,IO) = YES); + TOP(RPG_ACE(PRC_ACT,C,IO)) = YES; + OPTION CLEAR=PRC_ACT,CLEAR=ACT_FLO,CLEAR=RPG_ACE; +*----------------------------------------------------------------------------- +* Handle Updatable OFF-ranges & REG_BDNCAP process-based bounds + NCAP_START(R,P)$(NCAP_START(R,P)<=MIYR_BOH)=0; + RVP(R,LL,P) $= NCAP_BND(R,LL,P,'N'); + IF(CARD(RVP), + NCAP_BND(RVP,'N')$(NCAP_BND(RVP,'N')>%EOTIME%) = %EOTIME%; + NCAP_START(R,P)$((ABS(NCAP_BND(R,'0',P,'N'))>999)$RVP(R,'0',P)) = ABS(NCAP_BND(R,'0',P,'N'))+1; + PRC_NOFF(R,P,LL,EOHYEAR)$RVP(R,LL,P) = NO; + PRC_NOFF(R,P,BOHYEAR(LL),LL+(NCAP_BND(R,LL,P,'N')-YEARVAL(LL)))$RVP(R,LL,P) = YES); + NCAP_BND(RVP(R,LL,P),L('N')) = MOD(MIN(2,ROUND(MAX(NCAP_BND(RVP,L),-1))),2)$LASTLL(LL)+(YEARVAL(LL)-1)$(ROUND(MOD(NCAP_BND(RVP,L)-YEARVAL(LL),MAX(1,YEARVAL(LL))))=-1); + OPTION CLEAR=RVP; +*----------------------------------------------------------------------------- +* Prepare UC_CLI, UC_DYNBND and UC_ACTBET +$ BATINCLUDE equcrtp.vda INIT_EXT +$ IF %CLI%==YES LOOP((UC_N,SIDE,R,LL,CM_VAR)$UC_CLI(UC_N,SIDE,R,LL,CM_VAR),UC_ATTR(R,UC_N,'RHS','CLI','YES')=YES); + LOOP(UC_ATTR(R,UC_N,SIDE,UC_GRPTYPE,UC_NAME(TSL)),UC_TSL(R,UC_N,SIDE,TSL)=YES); +$ IF DEFINED UC_ACTBET + UC_FLOBET(UC_N,ALL_R,YEAR,P,%PGPRIM%) $= UC_ACTBET(UC_N,ALL_R,YEAR,P); LOOP((UC_N,R,YEAR,P)$UC_ACTBET(UC_N,R,YEAR,P),UC_GMAP_P(R,UC_N,'ACT',P)=YES); +$ IFI %POWERFLO%==YES LOOP(SAMEAS('REACTANCE',UC_N),PRC_REACT(R,T,P) $= UC_CAP(UC_N,'RHS',R,T,P)); +$ IF DEFINED PRC_REACT $SETGLOBAL POWERFLO YES +*----------------------------------------------------------------------------- +* Load bounds/prices for exogenous trade from previous run if requested +SET PREMILE(ALLYEAR); +$KILL PAR_IRE PAR_IPRIC +$IF NOT SET GDX_IREBND $GOTO IFPRICE +$IF NOT EXIST %GDXPATH%%GDX_IREBND%.GDX $GOTO IFPRICE +$GDXIN %GDXPATH%%GDX_IREBND% +$LOAD RPC_IREIN=RPC_IREIO PREMILE=MILESTONYR PAR_IRE +$IFI %GDX_IREBND%==%GDX_IPRIC% $GOTO LOAD2 +$GDXIN +$LABEL IFPRICE +$IF NOT SET GDX_IPRIC $GOTO FINISH +$IF NOT EXIST %GDXPATH%%GDX_IPRIC%.GDX $GOTO FINISH +$GDXIN %GDXPATH%%GDX_IPRIC% +$LABEL LOAD2 LOAD RPC_IREIN=RPC_IREIO PREMILE=MILESTONYR PAR_IPRIC +$GDXIN +$LABEL FINISH +* Remove originally exogenous trade flows +PAR_IRE(R,LL,T,P,C,S,IE)$RPC_IREIN(R,P,C,IE,'OUT') = 0; +PAR_IPRIC(R,T,P,C,TS,IE)$RPC_IREIN(R,P,C,IE,'OUT') = 0; +RPC_IREIN(R,P,C,IE,'OUT') = NO; diff --git a/initmty.abs b/initmty.abs new file mode 100644 index 0000000..cf3a226 --- /dev/null +++ b/initmty.abs @@ -0,0 +1,56 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================= +* INIT Declarations for the ABS Extension (Ancillary Balancing Services) +*============================================================================= +$ SETGLOBAL ABS YES + +* System sets + SETS + ITEM / SI / + CLVT / PRB, DET / + RSP / EXOGEN, WMAXSI, DELTA, OMEGA /; + +* Input parameters + PARAMETERS + BS_CAPACT(R) 'Conversion factor from exogenous reserve demand to activity' // + BS_RTYPE(R,C) 'Types of reserve commodities, positive or negative 1-4' // + BS_DEMDET(R,YEAR,RSP,C,S) 'Deterministic demands of reserves - EXOGEN and WMAXSI' // + BS_STIME(R,P,COM,BD) 'Minimum times for reserve provision from storage (hours)' // + BS_DETWT(R,YEAR,C) 'Weights for deterministic reserve demands' // + BS_LAMBDA(R,YEAR,C) 'Fudge factors for dependencies in reserve requirements' // + BS_SIGMA(R,YEAR,C,ITEM,S) 'Standard deviation of imbalance source ITEM' // + BS_OMEGA(REG,YEAR,COM,TS) 'Indicator of how to define reserve demand from deterministic and probabilistic component' // + BS_MAINT(R,YEAR,P,S) 'Continuous maintenance duration (hours)' // + BS_RMAX(R,YEAR,P,C,S) 'Maximum contribution of process p to provision of reserve c as a fraction of capacity' // + BS_DELTA(R,YEAR,C,S) 'Calibration parameters for probabilistic reserve demands' // + BS_SHARE(R,YEAR,C,ITEM,L) 'Share of group reserve provision' // + BS_BNDPRS(R,YEAR,P,C,S,L) 'Bound on process reserve provision' // + ; + +* Internal sets + SETS + BS_K(ITEM) 'Sources of imbalance or provision' / UP, LO / + BS_RTK(R,T,ITEM) 'Sources of imbalances by period' // + BS_COMTS(R,C,S) 'Reserve commodity timeslices' // + BS_APOS(R,C) 'Positive reserve commodities' // + BS_ANEG(R,C) 'Negative reserve commodities' // + BS_ABD(R,C,L) 'Reserve commodities by direction' // + BS_BSC(R,P,C) 'Reserve provisions by process' // + BS_UPL(R,P,L) 'Maximum ramping rate indicator' // + BS_UPC(R,P,TSL,L) 'Minimum uptime/downtime indicator' // + BS_TOP(R,P,C,IO) 'Topology for imbalance process' // + BS_ENDP(R,P) 'Reserve providion by demand' // + BS_SUPP(R,P) 'Reserve provision by generation' // + BS_STGP(R,P) 'Reserve provision by storage' // + BS_NEGP(R,P) 'Processes with negative provision' // + BS_PRS(R,P,S) 'Process slices for reserve tracking' // + BS_SBD(R,S,L) 'Timeslices for reserve provision' // + BS_UCMAP(UCN,SIDE,R,P,C) 'Map to refer to reserves in UC_FLO' // + ; + + PARAMETERS + BS_RTCS(RSP,R,YEAR,C,S) 'Temporary work parameter' // + ; diff --git a/initmty.cli b/initmty.cli new file mode 100644 index 0000000..49c0d9e --- /dev/null +++ b/initmty.cli @@ -0,0 +1,123 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* INITMTY.cli - Extension for Climate Module +*----------------------------------------------------------------------------- +* Questions/Comments: +*----------------------------------------------------------------------------- +$ SETGLOBAL CLI YES + SCALAR ATTLVL /0/, VALLVL /0/, CM_CALIB /0/; +*----------------------------------------------------------------------------- +* Set for calibration quantities + SET CM_HISTS 'Historical CO2 concentration and incremental forcing quantities' / + CO2-ATM 'Mass of CO2 in the atmosphere (in GtC)' + CO2-UP 'Mass of CO2 in the upper ocean layer (in GtC)' + CO2-LO 'Mass of CO2 in the lower ocean layer (in GtC)' + CH4-ATM, CH4-UP, CH4-LO 'Mass of CH4 in the atmosphere' + N2O-ATM, N2O-UP, N2O-LO 'Mass of N2O in the atmosphere' + FORCING 'Radiative Forcing' + FORC-CO2, FORC-CH4, FORC-N2O, FORC-FGS, FORC-KYO + CO2-GTC, CH4-MT, N2O-MT + CO2-PPM, CH4-PPB, N2O-PPB + DELTA-ATM 'Temperature change in the surface' + DELTA-LO 'Temperature change in the deep ocean layer' + /; + ALIAS(CM_VAR,CM_HISTS); + SET CM_OFOR(CM_VAR) / FORC-CH4, FORC-N2O, FORC-FGS /; + SET UC_GRPTYPE / CLI /; + +* Mapping and conversion parameter for total CO2 emissions + PARAMETER CM_CO2GTC(REG,C) 'Conversion factors from CO2 commodities to GtC' //; + PARAMETER CM_GHGMAP(R,C,CG) 'Conversion factors from regional GHG commodities to CLI' //; + PARAMETER CM_PPM(CM_VAR) 'Conversion factors between Gt/Mt and ppm/ppb' + / CO2-GTC 2.13, CH4-MT 2.84, N2O-MT 7.81 /; + +* Climate module time-dependent parameters + PARAMETER CM_HISTORY(ALLYEAR,CM_VAR) 'Calibration values for CO2 and forcing' //; + PARAMETER CM_EXOFORC(ALLYEAR) 'Radiative forcing from exogenous sources' //; + PARAMETER CM_MAXCO2C(ALLYEAR) 'Maximum allowable atmospheric CO2 concentration' //; + PARAMETER CM_MAXC(ALLYEAR,ITEM) 'Maximum level of climate variable' //; + PARAMETER CM_LINFOR(ALLYEAR,CM_VAR,LIM) 'Linearized forcing function' //; + PARAMETER UC_CLI(UC_N,SIDE,REG,ALLYEAR,CM_VAR) 'Climate variable' //; + +* Reporting parameters + PARAMETER CM_DT_FORC(ALLYEAR) 'Delta forcing' //; + PARAMETER CM_MAXC_M(ITEM,ALLYEAR) 'Marginals of max constraints' //; + PARAMETER CM_SRESULT(ALLSOW,ITEM,ALLYEAR) 'Climate Module basic results' //; + PARAMETER CM_SMAXC_M(ALLSOW,ITEM,ALLYEAR) 'Marginals for max constraints' //; + +* Internal sets for reservoirs + SET CM_STCC / CS, SIGMA1 /; + SET CM_BOX 'Reservoir buckets' / ATM, UP, LO /; + SET CM_EMIS(CM_HISTS) / CO2-GTC /; + SET CM_KIND(CM_HISTS) / CO2-GTC /; + SET CM_TKIND(CM_HISTS); + SET CM_CONC(CM_HISTS,CM_BOX) / CO2-GTC.ATM /; + SET CM_ATMAP(CM_VAR,CM_VAR) 'Atmospheric reservoir buckets' / CO2-GTC.CO2-PPM, CH4-MT.CH4-PPB, N2O-MT.N2O-PPB, FORCING.DELTA-ATM /; + ALIAS (CM_BUCK, CM_BOX); + SET CM_BOXMAP(CM_HISTS,CM_HISTS,CM_BOX) / CO2-GTC.CO2-ATM.ATM, CO2-GTC.CO2-UP.UP, CO2-GTC.CO2-LO.LO, + CH4-MT.CH4-ATM.ATM, CH4-MT.CH4-UP.UP, N2O-MT.N2O-ATM.ATM, N2O-MT.N2O-UP.UP + FORCING.DELTA-ATM.ATM, FORCING.DELTA-LO.LO /; + SET PRET(T,T) //; + SET SUPERYR(T,ALLYEAR) 'SUpremum PERiod YeaR' //; + SET CM_FORCMAP(CM_VAR,CM_VAR) / FORCING.FORC-FGS,FORC-KYO.FORC-FGS + FORC-CO2.CO2-GTC,FORC-CH4.CH4-MT,FORC-N2O.N2O-MT,FORC-FGS.FORC-FGS /; + +* Internal parameters + PARAMETER CM_SIG1(ALLSOW) //; + PARAMETER CM_PHI(CM_HISTS,*,*) 'Conc. transport matrix between reservoirs' //; + PARAMETER CM_SIG(ALLSOW,*,*) 'Temperature transport matrix between reservoirs' //; + PARAMETER CM_AA(CM_HISTS,ALLYEAR,ALLSOW,*,*) 'Periodical CO2 transport matrix' //; + PARAMETER CM_BB(CM_HISTS,ALLYEAR,ALLSOW,CM_BOX) 'Periodical emission transport vector' //; + PARAMETER CM_CC(CM_HISTS,ALLYEAR,ALLSOW,CM_BOX) 'Periodical emission transport vector' //; + PARAMETER CM_RR(J,CM_BOX,*) 'Reporting' //; + PARAMETER CM_DELTAT(ALLYEAR,CM_BOX) 'Temperature change in T boxes' //; + PARAMETER CM_LED(ALLYEAR) //; + PARAMETER CM_BEMI(CM_HISTS,LL) //; + PARAMETER CM_EVAR(CM_HISTS,LL) //; + +*----------------------------------------------------------------------------- +* If parameter CM_CO2GTC is not implemented in the shell, IRE_CCVT can alternatively be used +* For that purpose, a predefined commodity for global CO2 emissions is needed: + SET COM_GRP / FORCING, CO2-GTC, CO2-ATM, CO2-PPM, CH4-MT, N2O-MT, CH4-PPB, N2O-PPB, DELTA-ATM /; + SET COM_GRP / FORC-CO2, FORC-CH4, FORC-N2O, FORC-FGS, FORC-KYO /; + SET COM / CO2-GTC, CH4-MT, N2O-MT, FORCING, CO2-ATM, DELTA-ATM /; +*----------------------------------------------------------------------------- + PARAMETER CM_CONST(*) 'Climate module constants' / + PHI-UP-AT 0.0453 + PHI-AT-UP 0.0495 + PHI-LO-UP 0.00053 + PHI-UP-LO 0.0146 + GAMMA 0 + LAMBDA 1.41 + CS 2.91 + SIGMA1 0.024 + SIGMA2 0.44 + SIGMA3 0.002 + CO2-PREIND 596.4 + PHI-CH4 0.09158 + PHI-N2O 0.008803 + EXT-EOH -1 + BEOHMOD 20 + /; +IF(NOT CM_CONST('GAMMA'), CM_CONST('GAMMA') = 5.35*LOG(2)); +IF(CM_CONST('LAMBDA') EQ 0, CM_CONST('LAMBDA') = 1.25); +IF(CM_CONST('CS') EQ 0, CM_CONST('CS') = CM_CONST('GAMMA')/CM_CONST('LAMBDA')); +CM_CONST('LAMBDA') = CM_CONST('GAMMA')/CM_CONST('CS'); +E('0')=0; IF(CM_CONST('EXT-EOH') EQ 0, CM_CONST('EXT-EOH')=SMAX(LL$E(LL),E(LL))); +*----------------------------------------------------------------------------- +* The following parameters describe historical mass of CO2 in the ATM and ocean +* as well as historical temperature increases in surface and deep ocean +**** User provided values override these default hard-coded values **** + PARAMETER CM_DEFAULT(ALLYEAR,CM_HISTS) //; + TABLE CM_DEFAULT(ALLYEAR,CM_HISTS) + CO2-ATM CO2-UP CO2-LO DELTA-ATM DELTA-LO CH4-ATM CH4-UP N2O-ATM N2O-UP +1990 735 19230 0.43 0.06 +1995 765 781 19230 0.50 0.06 +2000 785 798 19230 0.65 0.06 3030 1988 360 2109 +2005 806 19230 0.75 0.06 3067 1988 390 2109 +2010 826 830 19230 0.80 0.06 3122 1988 414 2109 +; +*----------------------------------------------------------------------------- diff --git a/initmty.dsc b/initmty.dsc new file mode 100644 index 0000000..fb72571 --- /dev/null +++ b/initmty.dsc @@ -0,0 +1,17 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================= +* INIT DECLARATIONS FOR THE DSC EXTENSION +*============================================================================= +$SETGLOBAL DSC YES +$IF NOT %DSC%==YES $ABORT Activation of DSC extension failed +*----------------------------------------------------------------------------- +* Sets and parameters for discrete capacity extension +SET UNIT 'Number of different units' / 0*100 /; +SET PRC_DSCNCAP(R,P) 'Processes with discrete capacity additions'; +PARAMETER NCAP_DISC(R,ALLYEAR,P,UNIT) 'Unit size of discrete capacity addition'; +PARAMETER NCAP_SEMI(R,ALLYEAR,P) 'Semi-continuous capacity, lower bound'; +*PARAMETER NCAP_CSTD(REG,ALLYEAR,PRC,CUR,UNIT) 'Investment cost of unit' //; +*PARAMETER NCAP_FOMD(REG,ALLYEAR,PRC,CUR,UNIT) 'Fixed operating and maintenace cost of unit' //; diff --git a/initmty.etl b/initmty.etl new file mode 100644 index 0000000..7496960 --- /dev/null +++ b/initmty.etl @@ -0,0 +1,66 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +****************************************************************************** +* INITMTY.ETL - declarations for technological change * +****************************************************************************** +* OPTCR from default 0.1 to 0.000001, may want to adjust in *.RUN file + OPTION OPTCR = 0.000001; + +* - Input Data +$ SET ETL YES + SET TEG(PRC) //; + PARAMETER TL_SC0(R,PRC) //; + PARAMETER TL_PRAT(R,PRC) //; + PARAMETER TL_SEG(R,PRC) //; + PARAMETER TL_CCAP0(R,PRC) //; + PARAMETER TL_CCAPM(R,PRC) //; +* Cluster technologies: TEG plus PRC coupled to TEG, mapping and coupling factors + PARAMETER TL_CLUSTER(R,P,P) //; + PARAMETER TL_MRCLUST(R,P,R,P) //; +* Input aliases + PARAMETER SC0(R,PRC) //; + PARAMETER PRAT(R,PRC) //; + PARAMETER SEG(R,PRC) //; + PARAMETER CCAP0(R,PRC) //; + PARAMETER CCAPM(R,PRC) //; + PARAMETER CLUSTER(R,P,P) //; + +* - Internal parameters +* KP up to 6 as default, can be re-assigned in *.RUN file if desired + SET KP / 1*6 /; + ALIAS(KP,KP2); + PARAMETER PAT(R,PRC) //; + PARAMETER PBT(R,PRC) //; + PARAMETER CCOST0(R,PRC) //; + PARAMETER CCOSTM(R,PRC) //; + PARAMETER WEIG(R,KP,PRC) //; + PARAMETER CCOSTK(R,KP,PRC) //; + PARAMETER CCAPK(R,KP,PRC) //; + PARAMETER BETA(R,KP,PRC) //; + PARAMETER ALPH(R,KP,PRC) //; + PARAMETER NTCHTEG(R,PRC) Number of technologies in cluster //; +* report specific + PARAMETER INVC_UNIT(R,T,P) //; + PARAMETER PREV(R,PRC) //; + +* Starting periods for learning technologies + SET TL_START(R,T,P) //; +* sets of cluster2 technologies and key components + SET TL_RP_CT(REG,PRC) //; + SET TL_RP_KC(REG,PRC) //; + +* SET and parameter Declarations for LIC Reporting Module + PARAMETER TL_CT_COST(R,ALLYEAR,PRC,CUR) //; + +*=====================================================* +* ETL Iteration parameters used during TESTing * +*=====================================================* +* new SET MLITER (1*1 default) to enable iterative SOLVE, can be re-assigned in RUN +SET MLITER /1*1/; +* default MLITERM in RUN +SCALAR MLITERM /10.0/; +* CCDIFCRIT is termination criterion for average difference in CCAPM - CCAP(TLAST) +* or for CCAPM values in two subsequent iterations, now set to 0.1 +SCALAR CCDIFCRIT /0.1/; diff --git a/initmty.ier b/initmty.ier new file mode 100644 index 0000000..5b1c596 --- /dev/null +++ b/initmty.ier @@ -0,0 +1,23 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================= +* INIT DECLARATIONS FOR THE IER EXTENSION +*============================================================================= +* Parameters used in EQx_MRKCON +PARAMETER FLO_MRKCON(REG,ALLYEAR,PRC,COM,TS,BD) 'Bound on the share of a flow in the total consumption of a commmodity' //; +PARAMETER FLO_MRKPRD(REG,ALLYEAR,PRC,COM,TS,BD) 'Bound on the share of a flow in the total production of a commmodity' //; + +* Sets and parameters used for CHP plants +SET ECT_CHP(REG,PRC) 'Set of extraction condensing CHP plants' //; +SET ECT_ELC(REG,PRC,COM) 'Electricity commodity of extraction condensing CHP plants' //; +SET ECT_DHT(REG,PRC,COM) 'Heat commodity of extraction condensing CHP plants' //; +SET ECT_CGOUT(REG,PRC,COM_GRP) 'Output commodity group ELC+HEAT of ECT CHP plant' //; +SET ECT_CGIN(REG,PRC,COM_GRP) 'Fuel input commodity group of ECT CHP plant' //; +PARAMETER ECT_INP2ELC(REG,ALLYEAR,PRC) 'Conversion factor from input capacity to ELC capacity in BPT point' //; +PARAMETER ECT_INP2DHT(REG,ALLYEAR,PRC) 'Conversion factor from input capacity to heat capacity in BPT point' //; +PARAMETER ECT_INP2CON(REG,ALLYEAR,PRC) 'Conversion factor from input capacity to heat capacity in BPT point' //; +PARAMETER ECT_REH(REG,ALLYEAR,PRC) 'Ratio of electricity to heat in brackpressure point' //; +PARAMETER ECT_AFCON(REG,ALLYEAR,PRC,BD) 'Availability of condensing mode operation of extraction condensing CHP' //; +PARAMETER ECT_AFBPT(REG,ALLYEAR,PRC,BD) 'Availability of backpressure mode operation of extraction condensing CHP' //; diff --git a/initmty.mlf b/initmty.mlf new file mode 100644 index 0000000..9edc354 --- /dev/null +++ b/initmty.mlf @@ -0,0 +1,62 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================= +* Init Declarations for the MLF Macro extension +*============================================================================= +$ INCLUDE initmty.tm +$ SETGLOBAL MACRO Yes +$ SETGLOBAL SPOINT +*--- Redefined & Additional input parameters --- + PARAMETER TM_ARBM 'Arbitrary multiplier' /1/; + PARAMETER TM_SCALE_UTIL 'Scaling factor utility function' /0.001/; + PARAMETER TM_SCALE_NRG 'Scaling factor demand units' /0.001/; + PARAMETER TM_SCALE_CST 'Scaling factor cost units' /0.001/; + PARAMETER TM_DESUB(R) 'Elasticity of substitution between demands' //; + PARAMETER TM_STEP(R,CG,LIM) 'Steps in CES substitution' //; + PARAMETER TM_VOC(R,YEAR,CG,BD) 'Variance in CES component or utility' //; + +*--- Internal attributes --- + SET COM_GRP / AKL, LAB, KN, YN, CON, UTIL /; + SET NITER /1*18/; + SET TM_PP(R,YEAR) //; +* Initialized Scalar Defaults * + PARAMETER TM_DEFVAL / + DEPR 5 + ESUB 0.25 + KGDP 2.5 + KPVS 0.25 + DMTOL 0.1 + IVETOL 0.5 + NEGTOL 0.01 + MACVOC 0.4 + MACSTEP 200 + LOGSTEP 550 + USEHDF 1 + ESC 1.028 + /; + PARAMETER SOL_ACFR(R,UC_COST,T) Baseline annual cost data //; +* MACRO Sectoral Demands, marginals and AEEIs + PARAMETERS + TM_DEM(REG,YEAR,COM) Demand levels + TM_DMC(REG,YEAR,COM) Demand marginals + TM_DDF_Y(R,T) Production growths + TM_DDF_DM(R,T,C) Demand growth rate + TM_DDF_SP(R,T,C) Demand marginals change rate + TM_F2(R,T,C) Demand DDF calibration + TM_ANNC(REG,YEAR) Estimate of annual energy system cost + TM_GDPGOAL(REG,YEAR) Projected Baseline GDP + TM_GDP(R,T) Actualized gross domestic product + TM_QSFA(REG,T) Quadratic supply function A + TM_QSFB(REG,T,COM) Quadratic supply function B + TM_NWT(REG) Negishi weights + TM_NWTIT(NITER,REG) Negishi weights by iteration + TM_CIE(R,T,CG) Expnditure rate // + PAR_Y(R,T) Production parameter // + PAR_GRGDP(R,T) Growth rate of GDP // + PAR_MC(R,YEAR,C) Marginal costs of demands // + TM_RESULT(ITEM,R,YEAR) MACRO Summary result parameters // +; + + diff --git a/initmty.mod b/initmty.mod new file mode 100644 index 0000000..20dd5e5 --- /dev/null +++ b/initmty.mod @@ -0,0 +1,500 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* INITMTY.MOD has all the EMPTY declarations for system & user data * +* %1..%6 - File extensions of code extensions to be included * +*=============================================================================* +* All the EMPTY declarations for user data * +*=============================================================================* +*GaG Questions/Comments: +* - all but LOCAL (in single BATINCLUDE and its immediate lower routines) +* - consider PRC_MAP(PRC_GRP,PRC_SUBGRP,PRC) where PRC_SUBGRP = PRC_RSOURC + any user-provided sub-groupings +* - SOW/COM/PRC/CUR master sets (merged) == entire list, that is not REG +* - lists (eg, DEM_SECT) for _MAP sets not REG (but individual mappings are) +* - HAVE THE USER *.DD files OMIT the declarations to ease maintenance changes +*----------------------------------------------------------------------------- +* Version control +$IF NOT FUNTYPE rpower $ABORT TIMES Version 4.0 and above Requires GAMS 22.0 or above! +$IF NOT FUNTYPE gamsversion $GOTO DECL +$IF gamsversion 149 $SETGLOBAL G2X6 Yes +$IF gamsversion 230 $SETGLOBAL OBMAC YES +$IF gamsversion 236 $SETGLOBAL G2X6 YES +$LABEL DECL +$ONEMPTY + +*----------------------------------------------------------------------------- +* SET SECTION +*----------------------------------------------------------------------------- +* Note: the *-out user SETs are declared in INITSYS.MOD + +* commodities +* SET COM_GRP 'All CGs and each individal commodity'; +* SET COM(COM_GRP) 'All Commodities' //; + SET COM_DESC(REG,COM) 'Region-based commodity descriptions' //; +* SET COM_TYPE(COM_GRP) 'Primary grouping of commodities' //; + SET COM_GMAP(REG,COM_GRP,COM) 'User groups of individual commodities' //; + SET COM_LIM(REG,COM,LIM) 'List of equation type for balance' //; + SET COM_OFF(REG,COM,*,*) 'Periods for which a commodity is unavailable' //; + SET COM_TMAP(REG,COM_TYPE,COM) 'Primary grouping of commodities' //; + SET COM_TS(REG,COM,ALL_TS) 'List of commodity timeslices' //; + SET COM_TSL(REG,COM,TSLVL) 'Level at which a commodity tracked' //; + SET COM_UNIT(REG,COM,UNITS_COM) 'Units associated with each commodity' //; + +* currency +* SET CUR 'Currencies (c$)' //; + SET CUR_MAP(REG,CUR_GRP,CUR) 'Grouping of the currenies' //; + +* demands / emissions / financials + SET DEM_SMAP(REG,DEM_SECT,COM) 'Grouping of DEMs (commodities) to their sector' //; + SET ENV_MAP(REG,ENV_GRP,COM) 'Grouping of ENVs (commodities) to their emissions group' //; + SET FIN_MAP(REG,FIN_GRP,COM) 'Grouping of FINs (commodities) to their financial group' //; + +* materials + SET MAT_GMAP(REG,MAT_GRP,COM) 'Grouping of materials' //; + SET MAT_TMAP(REG,MAT_TYPE,COM) 'Material by type' //; + SET MAT_VOL(REG,COM) 'Material accounted for by volume' //; + SET MAT_WT(REG,COM) 'Material accounted for by weight' //; + +* energy + SET NRG_FMAP(REG,NRG_FORM,COM) 'Grouping of NRG by Solid/Liquid/Gas' //; + SET NRG_GMAP(REG,NRG_GRID,COM) 'Association of energy carriers to grids'//; + SET NRG_TMAP(REG,NRG_TYPE,COM) 'Grouping of energy carriers by type' //; + +* process +* SET PRC 'List of all processes' //; + SET PRC_AOFF(REG,PRC,*,*) 'Periods for which activity is unavailable' //; + SET PRC_ACTUNT(REG,PRC,CG,UNITS_ACT) 'Primary commodity (or group) & activity unit' //; + SET PRC_CAPUNT(REG,PRC,CG,UNITS_CAP) 'Unit of capacity' //; + SET PRC_CG(R,PRC,COM_GRP) 'Commodity groups for a process' //; + SET PRC_DESC(R,P) 'Process descriptions by region' //; + SET PRC_FOFF(REG,PRC,COM,ALL_TS,*,*) 'Periods/timeslices for which flow is not possible' //; + SET PRC_MAP(REG,PRC_GRP,PRC) 'Grouping of processes to nature' //; + SET PRC_NOFF(REG,PRC,*,*) 'Periods for which new capacity can NOT be built' //; + SET PRC_RMAP(REG,PRC_RSOURC,PRC) 'Grouping of XTRACT processes' //; + SET PRC_SPG(REG,PRC,COM_GRP) 'Shadow Primary Group' //; + SET PRC_TS(ALL_REG,PRC,ALL_TS) 'Timeslices for a process' //; + SET PRC_TSL(REG,PRC,TSLVL) 'Timeslice level for a process' //; + SET PRC_VINT(REG,PRC) 'Process is to be vintaged' //; + SET PRC_DSCNCAP(R,P) 'Processes with discrete capacity additions'; + SET PRC_RCAP(REG,PRC) 'Process with early retirement'; + SET PRC_SIMV(REG,PRC) 'Process is to be vintage-simulated'; + +* region +* SET REG(ALL_REG) 'List of Regions' //; + SET REG_GRP(*) 'List of regional groups' //; + SET REG_RMAP(REG_GRP,ALL_REG) 'Grouping of regions in/out of area of study' //; + +* time +* SET TS(ALL_TS) 'Time slices of the year //; + ALIAS(ALL_TS,TS,S,SL,S2); + SET TS_OFF(REG,TS,BOHYEAR,EOHYEAR) 'Timeslices turned off'; + SET TS_GROUP(ALL_REG,TSLVL,TS) 'Timeslice Level assignment' //; + SET TS_MAP(ALL_REG,ALL_TS,ALL_TS) 'Timeslice hierarchy tree: node+below' //; + SET MILESTONYR(ALLYEAR) 'Projection years for which model to be run' //; + ALIAS(MILESTONYR,T,TT); + SET DATAYEAR(ALLYEAR) 'Years for which user data is provided' //; + SET PASTYEAR(ALLYEAR) 'Years before 1st MILESTONYR for which PASTI needs to be handled' //; + SET MODLYEAR(ALLYEAR) 'Years for which the model is to be run (MILESTONYR+PASTYEAR)' //; + ALIAS(TSLVL,TSL); + +* topology + SET TOP(REG,PRC,COM,IO) 'Topology for all process' //; + SET TOP_IRE(ALL_REG,COM,ALL_REG,COM,PRC) 'Trade within area of study' //; + +* peaking + SET COM_PEAK(REG,COM_GRP) 'Peaking required flag' //; + SET COM_PKTS(REG,COM_GRP,TS) 'Peaking time-slices' //; + SET PRC_PKNO(ALL_REG,PRC) 'Processes which cannot be involved in peaking' //; + SET PRC_PKAF(ALL_REG,PRC) 'Flag for default value of NCAP_PKCNT' //; + +* storage + SET PRC_NSTTS(REG,PRC,ALL_TS) 'Night storage process and time-slice for storaging' //; + SET PRC_STGTSS(REG,PRC,COM) 'Storage process and stored commodity for time-slice storage' //; + SET PRC_STGIPS(REG,PRC,COM) 'Storage process and stored commodity for inter-period storage' //; + +* user constraints + SET UC_N(*) 'Names of all manual constraints' / OBJVAR /; + SET UC_T_SUCC(ALL_R,UC_N,ALLYEAR) 'Specification of periods, if UC_DYN=SUCC' //; + SET UC_T_SUM(ALL_R,UC_N,ALLYEAR) 'Specification of periods, if UC_DYN=SEVERAL' //; + SET UC_T_EACH(ALL_R,UC_N,ALLYEAR) 'Specification of periods, if UC_DYN=EACH' //; + SET UC_R_SUM(ALL_R,UC_N) 'Specification of regions, if UC_REG=SUM' //; + SET UC_R_EACH(ALL_R,UC_N) 'Specification of regions, if UC_REG=EACH' //; + SET UC_TS_SUM(ALL_R,UC_N,ALL_TS) 'Specification of time-slices, if UC_TS=SUM' //; + SET UC_TS_EACH(ALL_R,UC_N,ALL_TS) 'Specification of time-slices, if UC_TS=EACH' //; + SET UC_ATTR(ALL_R,UC_N,SIDE,UC_GRPTYPE,UC_NAME) 'Mapping of parameter names to groups' //; + SET UC_TSL(ALL_R,UC_N,SIDE,TSLVL) 'UC timeslice level' //; + ALIAS(UC_N,UCN); + +* miscellaneous +* SET SOW 'Stochastic State-of-the-World' //; + SET SW_T(ALLYEAR,ALLSOW) 'Stochastic state indexes by period' //; + SET G_UAMAT(U) 'Unit for activity of material process' //; + SET G_UANRG(U) 'Unit for activity of energy process' //; + SET G_UCMAT(U) 'Unit for capacity of material process' //; + SET G_UCNRG(U) 'Unit for capacity of energy process' //; + SET G_RCUR(REG,CUR) 'Main currency unit by region' //; + +* Predefined system CGs and one COM: +$IF NOT SET PGPRIM $SETGLOBAL PGPRIM "'ACT'" + SET COM_GRP / %PGPRIM%, CAPFLO /; + SET ACTCG(CG) / %PGPRIM% /; + SET COM / %PGPRIM% /; + +*----------------------------------------------------------------------------- +* PARAMETERS SECTION +*----------------------------------------------------------------------------- +* time + PARAMETER B(ALLYEAR) 'Beginning year of each model period' //; + PARAMETER E(ALLYEAR) 'Ending year of each model period' //; + PARAMETER M(ALLYEAR) 'Middle year of each Period' //; + PARAMETER D(ALLYEAR) 'Length of each period' //; + +* Activity + PARAMETER ACT_BND(REG,ALLYEAR,PRC,TS,BD) 'Bound on activity of a process' //; + PARAMETER ACT_COST(REG,ALLYEAR,PRC,CUR) 'Variable costs associated with activity of a process' //; + PARAMETER ACT_CSTUP(R,ALLYEAR,P,TSLVL,CUR) 'Variable costs associated with startup of a process' //; + PARAMETER ACT_CSTSD(R,ALLYEAR,P,UPT,BD,CUR) 'Start-up (BD=UP) and shutdown costs (BD=LO) per unit of started-up capacity, by start-up type'//; + PARAMETER ACT_CSTRMP(R,ALLYEAR,P,L,CUR) 'Ramp-up (L=UP) or ramp-down (L=LO) cost per unit of load change' //; + PARAMETER ACT_FLO(REG,ALLYEAR,PRC,CG,S) 'General process transformation parameter'// + PARAMETER ACT_TIME(R,ALLYEAR,P,L) 'Minimum online/offline hours' //; + PARAMETER ACT_CUM(REG,PRC,ITEM,ITEM,LIM) 'Bound on cumulative activity' //; + +* New Capacity + PARAMETER NCAP_AF(REG,ALLYEAR,PRC,TS,BD) 'Availability of capacity' //; + PARAMETER NCAP_AFA(REG,ALLYEAR,PRC,BD) 'Annual Availability of capacity' //; + PARAMETER NCAP_AFS(REG,ALLYEAR,PRC,TS,BD) 'Seasonal Availability of capacity' //; + PARAMETER NCAP_AFX(R,ALLYEAR,P) 'Change in capacity availability' //; + PARAMETER NCAP_AFSX(R,ALLYEAR,P,BD) 'Change in seasonal capacity availability'//; + PARAMETER NCAP_AFM(R,ALLYEAR,P) 'Pointer to availity change multiplier' //; + PARAMETER NCAP_BND(REG,ALLYEAR,PRC,LIM) 'Bound on overall capacity in a period' //; + PARAMETER NCAP_BPME(REG,ALLYEAR,PRC) 'Back pressure mode efficiency (or total eff.)' //; + PARAMETER NCAP_CDME(REG,ALLYEAR,PRC) 'Condensing mode efficiency' //; + PARAMETER NCAP_CEH(REG,ALLYEAR,PRC) 'Coefficient of electricity to heat' //; + PARAMETER NCAP_CHPR(REG,ALLYEAR,PRC,LIM) 'Combined heat:power ratio' //; + PARAMETER NCAP_CLED(REG,ALLYEAR,PRC,COM) 'Leadtime of a commodity before new capacity ready' //; + PARAMETER NCAP_CLAG(REG,ALLYEAR,PRC,COM,IO) 'Lagtime of a commodity after new capacity ready' //; + PARAMETER NCAP_COM(REG,ALLYEAR,PRC,COM,IO) 'Use (but +) of commodity based upon capacity' //; + PARAMETER NCAP_COST(REG,ALLYEAR,PRC,CUR) 'Investment cost for new capacity' //; + PARAMETER NCAP_CPX(REG,ALLYEAR,PRC) 'Pointer to capacity transfer multiplier' //; + PARAMETER NCAP_DRATE(REG,ALLYEAR,PRC) 'Process specific discount (hurdle) rate' //; + PARAMETER NCAP_FDR(REG,ALLYEAR,PRC) 'Functional depreciation rate of process' //; + PARAMETER NCAP_ELIFE(REG,ALLYEAR,PRC) 'Economic (payback) lifetime' //; + PARAMETER NCAP_FOM(REG,ALLYEAR,PRC,CUR) 'Fixed annual O&M costs' //; + PARAMETER NCAP_FOMX(REG,ALLYEAR,PRC) 'Change in fixed O&M' //; + PARAMETER NCAP_FOMM(REG,ALLYEAR,PRC) 'Pointer to fixed O&M change multiplier' //; + PARAMETER NCAP_FSUB(REG,ALLYEAR,PRC,CUR) 'Fixed tax on installed capacity' //; + PARAMETER NCAP_FSUBX(REG,ALLYEAR,PRC) 'Change in fixed tax' //; + PARAMETER NCAP_FSUBM(REG,ALLYEAR,PRC) 'Pointer to fixed subsidy change multiplier' //; + PARAMETER NCAP_FTAX(REG,ALLYEAR,PRC,CUR) 'Fixed tax on installed capacity' //; + PARAMETER NCAP_FTAXX(REG,ALLYEAR,PRC) 'Change in fixed tax' //; + PARAMETER NCAP_FTAXM(REG,ALLYEAR,PRC) 'Pointer to fixed tax change multiplier' //; + PARAMETER NCAP_ICOM(REG,ALLYEAR,PRC,COM) 'Input of commodity for install of new capacity' //; + PARAMETER NCAP_ILED(REG,ALLYEAR,PRC) 'Lead-time required for building a new capacity' //; + PARAMETER NCAP_ISUB(REG,ALLYEAR,PRC,CUR) 'Subsidy for a new investment in capacity' //; + PARAMETER NCAP_ITAX(REG,ALLYEAR,PRC,CUR) 'Tax on a new investment in capacity' //; + PARAMETER NCAP_ISPCT(REG,ALLYEAR,PRC) 'Subsidy as % of new investment cost' //; + PARAMETER NCAP_LCOST(REG,ALLYEAR,PRC) '% labor cost of new investment' //; + PARAMETER NCAP_LFOM(REG,ALLYEAR,PRC) '% labor cost of fixed O&M' //; + PARAMETER NCAP_PASTI(REG,ALLYEAR,PRC) 'Capacity install prior to study years' //; + PARAMETER NCAP_PASTY(REG,ALLYEAR,PRC) 'Buildup years for past investments' //; + PARAMETER NCAP_TLIFE(REG,ALLYEAR,PRC) 'Technical lifetime of a process' //; + PARAMETER NCAP_OLIFE(REG,ALLYEAR,PRC) 'Operating lifetime of a process'; + PARAMETER RCAP_BLK(REG,ALLYEAR,PRC) 'Retirement block size' //; + PARAMETER RCAP_BND(REG,ALLYEAR,PRC,LIM) 'Retirement bounds'; + +* decommissioning of Capacity + PARAMETER NCAP_DCOST(REG,ALLYEAR,PRC,CUR) 'Cost of decomissioning' //; + PARAMETER NCAP_DLAG(REG,ALLYEAR,PRC) 'Delay to begin decomissioning' //; + PARAMETER NCAP_DLAGC(REG,ALLYEAR,PRC,CUR) 'Cost of decomissioning delay' //; + PARAMETER NCAP_DELIF(REG,ALLYEAR,PRC) 'Economic lifetime to pay for decomissioning' //; + PARAMETER NCAP_DLIFE(REG,ALLYEAR,PRC) 'Time for the actual decomissioning' //; + PARAMETER NCAP_OCOM(REG,ALLYEAR,PRC,COM) 'Commodity release during decomissioning' //; + PARAMETER NCAP_VALU(REG,ALLYEAR,PRC,COM,CUR) 'Value of material released during decomissioning' //; + +* capacity installed + PARAMETER NCAP_START(REG,PRC) 'Start year for new investments' //; + PARAMETER NCAP_SEMI(R,ALLYEAR,P) 'Semi-continuous capacity, lower bound'; + PARAMETER CAP_BND(REG,ALLYEAR,PRC,BD) 'Bound on total installed capacity in a period' //; + +* general commodities + PARAMETER COM_BNDNET(REG,ALLYEAR,COM,TS,LIM) 'Net bound on commodity (e.g., emissions)' //; + PARAMETER COM_BNDPRD(REG,ALLYEAR,COM,TS,LIM) 'Limit on production of a commodity' //; + PARAMETER COM_CUMNET(REG,BOHYEAR,EOHYEAR,COM,LIM) 'Cumulative net bound on commodity (e.g. emissions)' //; + PARAMETER COM_CUMPRD(REG,BOHYEAR,EOHYEAR,COM,LIM) 'Cumulative limit on production of a commodity' //; + PARAMETER COM_CSTNET(REG,ALLYEAR,COM,TS,CUR) 'Cost on Net of commodity (e.g. emissions tax)' //; + PARAMETER COM_CSTPRD(REG,ALLYEAR,COM,TS,CUR) 'Cost on production of a commodity' //; + PARAMETER COM_FR(REG,ALLYEAR,COM,TS) 'Seasonal distribution of a commodity' //; + PARAMETER COM_IE(REG,ALLYEAR,COM,TS) 'Seasonal efficiency of commodity' //; + PARAMETER COM_SUBNET(REG,ALLYEAR,COM,TS,CUR) 'Subsidy on a commodity net' //; + PARAMETER COM_SUBPRD(REG,ALLYEAR,COM,TS,CUR) 'Subsidy on production of a commodity net' //; + PARAMETER COM_TAXNET(REG,ALLYEAR,COM,TS,CUR) 'Tax on a commodity net' //; + PARAMETER COM_TAXPRD(REG,ALLYEAR,COM,TS,CUR) 'Tax on production of a commodity net' //; + PARAMETER COM_AGG(REG,ALLYEAR,COM,COM) 'Commodity aggregation parameter' //; + +* demands + PARAMETER COM_BPRICE(REG,ALLYEAR,COM,TS,CUR) 'Base price of elastic demands' //; + PARAMETER COM_BQTY(REG,COM,TS) 'Base quantity for elastic demands' //; + PARAMETER COM_ELAST(REG,ALLYEAR,COM,TS,LIM) 'Elasticity of demand' //; + PARAMETER COM_ELASTX(REG,ALLYEAR,COM,BD) 'Elasticity shape of demand' //; + PARAMETER COM_PROJ(REG,ALLYEAR,COM) 'Demand baseline projection' //; + PARAMETER COM_STEP(REG,COM,LIM) 'Step size for elastic demand' //; + PARAMETER COM_VOC(REG,ALLYEAR,COM,BD) 'Variance of elastic demand' //; + +* flow of commodities through processes + PARAMETER FLO_BND(REG,ALLYEAR,PRC,CG,TS,BD) 'Bound on the flow variable' //; + PARAMETER FLO_COST(REG,ALLYEAR,PRC,COM,TS,CUR) 'Added variable O&M of using a commodity' //; + PARAMETER FLO_DELIV(REG,ALLYEAR,PRC,COM,TS,CUR) 'Delivery cost for using a commodity' //; + PARAMETER FLO_FEQ(REG,ALLYEAR,PRC,COM) 'Fossil equivalent of a commodity in a process' //; + PARAMETER FLO_FR(REG,ALLYEAR,PRC,COM,TS,LIM) 'Load-curve of availability of commodity to a process' //; + PARAMETER FLO_FUNC(REG,ALLYEAR,PRC,CG,CG,TS) 'Relationship between 2 (group of) flows' //; + PARAMETER FLO_FUNCX(REG,ALLYEAR,PRC,CG,CG) 'Change in FLO_FUNC/FLO_SUM by age' //; + PARAMETER FLO_SHAR(REG,ALLYEAR,PRC,C,CG,TS,BD) 'Relationship between members of the same flow group' //; + PARAMETER FLO_SUB(REG,ALLYEAR,PRC,COM,TS,CUR) 'Subsidy for the production/use of a commodity' //; + PARAMETER FLO_SUM(REG,ALLYEAR,PRC,CG,C,CG,TS) 'Multipier for commodity in cg1 where each is summed into cg2' //; + PARAMETER FLO_TAX(REG,ALLYEAR,PRC,COM,TS,CUR) 'Tax on the production/use of a commodity' //; + PARAMETER FLO_CUM(REG,PRC,COM,ITEM,ITEM,LIM) 'Bound on cumulative flow' //; + PARAMETER FLO_MARK(REG,ALLYEAR,PRC,COM,BD) 'Process-wise market share in total commodity production' //; + PARAMETER PRC_MARK(REG,ALLYEAR,PRC,ITEM,C,LIM) 'Process group-wise market share' //; + PARAMETER PRC_RESID(REG,ALLYEAR,PRC) 'Residual capacity available in each period' //; + PARAMETER PRC_REFIT(REG,PRC,PRC) 'Process with retrofit or life-extension'; + +* peak + PARAMETER NCAP_PKCNT(REG,ALLYEAR,PRC,ALL_TS) 'Fraction of capacity contributing to peaking in time-slice TS' //; + PARAMETER COM_PKRSV(REG,ALLYEAR,COM) 'Peaking reserve margin' //; + PARAMETER COM_PKFLX(REG,ALLYEAR,COM,TS) 'Peaking flux ratio' //; + PARAMETER FLO_PKCOI(REG,ALLYEAR,PRC,COM,ALL_TS) 'Factor increasing the average demand' //; + +* Storage + PARAMETER STG_EFF(REG,ALLYEAR,PRC) 'Storage efficiency' //; + PARAMETER STG_LOSS(REG,ALLYEAR,PRC,S) 'Annual energy loss from a storage technology' //; + PARAMETER STG_CHRG(REG,ALLYEAR,PRC,S) 'Exogeneous charging of a storage technology ' //; + PARAMETER STG_SIFT(R,ALLYEAR,P,C,S) 'Max load sifting in proportion to total load' //; + PARAMETER STGOUT_BND(REG,ALLYEAR,PRC,C,S,BD) 'Bound on output-flow of storage process' //; + PARAMETER STGIN_BND(REG,ALLYEAR,PRC,C,S,BD) 'Bound on output-flow of storage process' //; + +* Process units + PARAMETER PRC_ACTFLO(REG,ALLYEAR,PRC,CG) 'Convert from process activity to particular commodity flow' //; + PARAMETER PRC_CAPACT(REG,PRC) 'Factor for going from capacity to activity' //; + PARAMETER PRC_GMAP(REG,PRC,ITEM) 'User-defined groupings of processes' //; + +* globals + PARAMETER G_CHNGMONY(REG,ALLYEAR,CUR) 'Exchange rate for currency' //; + PARAMETER G_DRATE(REG,ALLYEAR,CUR) 'Discount rate for a currency'//; + PARAMETER G_RFRIR(REG,ALLYEAR) 'Riskfree real interest rate' //; + PARAMETER G_YRFR(ALL_REG,TS) 'Seasonal fraction of the year' //; + PARAMETER TS_CYCLE(REG,TS) 'Length of cycles below timeslice, in days' //; + PARAMETER G_OFFTHD(ALLYEAR) 'Threshold for OFF ranges'; + PARAMETER G_OVERLAP 'Overlap of stepped solutions (in years)' / 0 /; + PARAMETER REG_FIXT(ALL_R) 'Year up to which periods are fixed'; + PARAMETER REG_BDNCAP(ALL_R,L) 'Year up to which VAR_NCAPs are to be fixed'; + PARAMETER G_CUREX(CUR,CUR) 'Global currency conversions'; + PARAMETER R_CUREX(ALL_REG,CUR,CUR) 'Regional currency conversions'; + +* trade of commodities + PARAMETERS + IRE_BND(ALL_R,ALLYEAR,COM,TS,ALL_REG,IE,BD) 'Limit on inter-reg exchange of commodity' // + IRE_FLO(ALL_R,ALLYEAR,PRC,COM,ALL_R,COM,TS) 'Efficiency of exchange for inter-regional trade' // + IRE_FLOSUM(REG,ALLYEAR,PRC,COM,TS,IE,COM,IO) 'Aux. consumption/emissions from inter-regional trade'// + IRE_PRICE(REG,ALLYEAR,PRC,COM,TS,ALL_R,IE,CUR) 'Exogenous price of import/export' // + IRE_XBND(ALL_REG,ALLYEAR,COM,TS,IE,BD) 'Limit on all (external and inter-regional) exchange of commodity' // + IRE_CCVT(ALL_REG,COM,ALL_REG,COM) 'Commodity unit conversion factor between regions' // + IRE_TSCVT(ALL_REG,ALL_TS,ALL_REG,ALL_TS) 'Identification and TS-conversion factor between regions' //; + +* Shape and Multi + PARAMETER SHAPE(J,AGE) 'Shaping table' //; + PARAMETER MULTI(J,ALLYEAR) 'Multiplier table' //; + +* Regional Cost bounds + PARAMETERS + REG_BNDCST(REG,ALLYEAR,COSTAGG,CUR,BD) 'Bound on regional costs by type' // + REG_CUMCST(REG,ALLYEAR,ALLYEAR,COSTAGG,CUR,BD) 'Cumulative bound on regional costs' //; + +* User Constraints + + PARAMETER UC_RHS(UC_N,LIM) 'Constant in user constraint' //; + PARAMETER UC_RHST(UC_N,ALLYEAR,LIM) 'Constant in user constraint' //; + PARAMETER UC_RHSR(ALL_REG,UC_N,LIM) 'Constant in user constraint' //; + PARAMETER UC_RHSS(UC_N,TS,LIM) 'Constant in user constraint' //; + PARAMETER UC_RHSRT(ALL_REG,UC_N,ALLYEAR,LIM) 'Constant in user constraint' //; + PARAMETER UC_RHSRS(ALL_REG,UC_N,TS,LIM) 'Constant in user constraint' //; + PARAMETER UC_RHSRTS(ALL_REG,UC_N,ALLYEAR,TS,LIM) 'Constant in user constraint' //; + PARAMETER UC_RHSTS(UC_N,ALLYEAR,TS,LIM) 'Constant in user constraint' //; + + PARAMETERS + UC_FLO(UC_N,SIDE,ALL_REG,ALLYEAR,PRC,COM,TS) 'Multiplier of flow variables' // + UC_ACT(UC_N,SIDE,ALL_REG,ALLYEAR,PRC,ALL_TS) 'Multiplier of activity variables' // + UC_CAP(UC_N,SIDE,ALL_REG,ALLYEAR,PRC) 'Multiplier of capacity variables' // + UC_NCAP(UC_N,SIDE,ALL_REG,ALLYEAR,PRC) 'Multiplier of VAR_NCAP variables' // + UC_COMCON(UC_N,SIDE,ALL_REG,ALLYEAR,COM,TS) 'Multiplier of VAR_COMCON variables' // + UC_COMPRD(UC_N,SIDE,ALL_REG,ALLYEAR,COM,TS) 'Multiplier of VAR_COMPRD variables' // + UC_COMNET(UC_N,SIDE,ALL_REG,ALLYEAR,COM,TS) 'Multiplier of VAR_COMNET variables' // + UC_IRE(UC_N,SIDE,ALL_REG,ALLYEAR,PRC,COM,TS,IE) 'Multiplier of inter-regional exchange variables' // + UC_CUMACT(UC_N,ALL_REG,PRC,ITEM,ITEM) 'Multiplier of cumulative process activity variable' // + UC_CUMFLO(UC_N,ALL_REG,PRC,COM,ITEM,ITEM) 'Multiplier of cumulative process flow variable' // + UC_CUMCOM(UC_N,ALL_REG,COM_VAR,COM,ITEM,ITEM) 'Multiplier of cumulative commodity variable' // + UC_UCN(UC_N,SIDE,ALL_R,ALLYEAR,UC_N) 'Multiplier of user constraint variable' // + UC_TIME(UC_N,ALL_REG,ALLYEAR) 'Multiplier of time in model periods (years)' //; + +*----------------------------------------------------------------------------- +* Extensions & System scalars +*----------------------------------------------------------------------------- +* Damage input parameters + PARAMETER DAM_COST(REG,ALLYEAR,COM,CUR) 'Marginal damage cost of emissions'; + PARAMETER DAM_BQTY(REG,COM) 'Base quantity of emissions' //; + PARAMETER DAM_ELAST(REG,COM,LIM) 'Elasticity of damage cost'; + PARAMETER DAM_STEP(REG,COM,LIM) 'Step number for emissions up to base' //; + PARAMETER DAM_VOC(REG,COM,LIM) 'Variance of emissions' //; +* Experimental parameters + PARAMETER DAM_TQTY(REG,ALLYEAR,COM) 'Base quantity of emissions by year' //; + PARAMETER DAM_TVOC(REG,ALLYEAR,COM,LIM) 'Variance of emissions by year' //; + PARAMETER DAM_COEF(REG,ALLYEAR,COM,S) 'Coefficient from commodity to damage' //; +* Parameters used in report routine + PARAMETER RPT_OPT(ITEM,J) 'Reporting options' //; + PARAMETER CST_DAM(REG,T,COM) 'Damage costs' //; + PARAMETER CM_RESULT(ITEM,ALLYEAR) 'Climate module results' //; + PARAMETER CM_MAXC_M(ITEM,ALLYEAR) 'Shadow price of climate constraint' //; + PARAMETER TM_RESULT(ITEM,R,ALLYEAR) 'MACRO results' //; + +* Scalars + SCALARS MIYR_V1 /0/, MIYR_VL /0/, PYR_V1 /0/; + SCALAR MY_F /0/, F /0/, Z /0/, CNT /0/, DFUNC /0/, DONE /0/, IFQ /1/; +* maximum NCAP_ILED+NCAP_TLIFE+NCAP_DLAG+NCAP_DLIFE+NCAP_DELIF + SCALAR DUR_MAX / 0 /; +* first and last given data value to be extrapolated + SCALAR FIRST_VAL /0/, LAST_VAL /0/, MY_FYEAR /0/; +* Placeholder for interpolation control option +$ SETGLOBAL DFLBL '0' + YEARVAL('%DFLBL%') = 0; + SET LASTLL(LL) /%DFLBL%/; Z=SUM(LASTLL(LL),ORD(LL)); ABORT$(Z NE CARD(LL)) 'FATAL'; +* Interpolation defaults + SET INT_DEFAULT(*) //, UNCD1(*); + PARAMETER IE_DEFAULT(*) //; + +* --------------------------------------------------------------------------------------------- +*GG* V07_2 Initializations for BLENDing +* --------------------------------------------------------------------------------------------- +* user provided Sets & Scalars + SET BLE(COM) //; + SET OPR(COM) //; + SET SPE(*) //; + SET REF(R,PRC) //; + PARAMETER REFUNIT(R) //; + +* internal Sets + SET CVT / DENS, WCV, VCV, SLF /; + +* user provided Parameters + PARAMETER CONVERT(OPR,CVT) //; + PARAMETER BL_START(R,COM,SPE) //; + PARAMETER BL_UNIT(R,COM,SPE) //; + PARAMETER BL_TYPE(R,COM,SPE) //; + PARAMETER BL_SPEC(R,COM,SPE) //; +* PARAMETER TBL_SPEC(COM,SPE,YEAR) //; + PARAMETER BL_COM(R,COM,OPR,SPE) //; +* PARAMETER TBL_COM(COM,SPE,OPR,YEAR) //; + PARAMETER BL_INP(R,COM,COM) //; +* PARAMETER TBL_INP(COM,SPE,COM,YEAR) //; + PARAMETER BL_VAROMC(R,COM,CUR) //; +* PARAMETER TBL_VAROM(COM,SPE,YEAR) //; + PARAMETER BL_DELIVC(R,COM,COM,CUR) //; +* PARAMETER TBL_DELIV(COM,SPE,COM,YEAR) //; + PARAMETER ENV_BL(R,COM,COM,OPR,YEAR) //; + PARAMETER PEAKDA_BL(R,COM,YEAR) //; + +* internal Parameters + PARAMETER RU_CVT(R,BLE,SPE,OPR) //; + PARAMETER RU_FEQ(R,COM,YEAR) //; + + PARAMETER OBJ_BLNDV(R,YEAR,C,C,CUR) 'annual variable costs for blending' //; + + +*------------------------------------------------------------------------------ +* CONTROL section +*------------------------------------------------------------------------------ +$ SETGLOBAL GDXPATH +$ IFI EXIST gamssave\nul $SETGLOBAL GDXPATH 'gamssave\' +$ SETGLOBAL SYSPREFIX '' SETGLOBAL PRF FILE=1 +*------------------------------------------------------------------------------ +* Alternative objective controls + SCALAR ALTOBJ / 1 /; +$IFI %OBJ%==STD ALTOBJ=0; +$IFI %OBJ%==ALT ALTOBJ=2; +$IFI %OBJ%==LIN ALTOBJ=3; +$IFI %MACRO%==YES IF(ALTOBJ>1,ABORT 'MACRO Cannot be used with Alternative Objective'); +$IFI %VALIDATE%==YES IF(ALTOBJ>1,ABORT 'VALIDATE cannot be used with Alternative Objective'); ALTOBJ=0; +$SETGLOBAL CTST +$IFI %OBJ%==MOD $SETGLOBAL OBLONG YES +$IFI %OBJ%==ALT $SETGLOBAL CTST **EPS +$IFI %OBLONG%==YES $SETGLOBAL CTST **0 +$IFI %OBJ%==LIN $SETGLOBAL CTST **EPS +$IFI '%OBLONG%%OBJ%'==YESALT $SETGLOBAL VARCOST LIN +$IFI '%OBLONG%%OBJ%'==YESALT ALTOBJ = -2; +*------------------------------------------------------------------------------ +* Stochastic extension +$IFI %SENSIS%==YES $SETLOCAL STAGES yes +$IFI %SPINES%==YES $SETLOCAL STAGES YES +$IFI %STAGES%==YES $BATINCLUDE initmty.stc +*------------------------------------------------------------------------------ +* Stepped extensions etc. + SET ITEM / "%FIXBOH%", "%TIMESTEP%", "%SPOINT%" /; +$SETGLOBAL RPOINT NO +$IF SET SPOINT IF((NOT J('%SPOINT%'))$(NOT SAMEAS('%SPOINT%','YES')), ABORT 'Invalid Control: SPOINT'); +$IF SET TIMESTEP IF(NOT AGE('%TIMESTEP%'), ABORT 'Invalid Control: TIMESTEP'); +$IF SET FIXBOH IF(NOT ALLYEAR('%FIXBOH%'), ABORT 'Invalid Control: FIXBOH'); +$IF SET FIXBOH $SETGLOBAL STEPPED - +$IF SET TIMESTEP $SETGLOBAL STEPPED + +$IF SET STEPPED $SETGLOBAL VAR_UC YES +$IF %SYSTEM.LICENSELEVEL%==2 $SETGLOBAL VAR_UC YES +*------------------------------------------------------------------------------ +* Other extensions to TIMES code +*------------------------------------------------------------------------------ +* Auto-activation of discrete capacity extensions +$IF %DSCAUTO%==YES $SETGLOBAL DSC YES +$IF %PGPRIM%==ACT $SETGLOBAL RETIRE 'YES' SETGLOBAL DSCAUTO Yes +$IFI %DSC%==YES $KILL RCAP_BLK + +* Initialize list of standard extensions to be loaded +$SET VDA 'YES' SETGLOBAL EXTEND + +* Add recognized extensions if defined +$IFI '%ECB%'==YES $SETGLOBAL EXTEND '%EXTEND% ECB' +$IFI '%MACRO%'==CSA $SETGLOBAL EXTEND '%EXTEND% MSA' +$IFI '%MACRO%'==MSA $SETGLOBAL EXTEND '%EXTEND% MSA' +$IFI '%MACRO%'==MLF $SETGLOBAL EXTEND '%EXTEND% MLF' +$IFI '%ETL%' == YES $SETGLOBAL EXTEND '%EXTEND% ETL' +$IFI '%CLI%' == YES $SETGLOBAL EXTEND '%EXTEND% CLI' +$IFI '%DSC%' == YES $SETGLOBAL EXTEND '%EXTEND% DSC' +$IFI '%VDA%' == YES $SETGLOBAL EXTEND '%EXTEND% VDA' +$IFI '%ABS%' == YES $SETGLOBAL EXTEND '%EXTEND% ABS' +$IFI '%MCA%' == YES $SETGLOBAL EXTEND '%EXTEND% MCA' + +* Finally, add args %1...%6 to list of extensions: +$SETGLOBAL EXTEND %EXTEND% %1 %2 %3 %4 %5 %6 + +* Load all extension declarations +$BATINCLUDE main_ext.mod initmty %EXTEND% + +$IF ERRORFREE +$BATINCLUDE err_stat.mod '$IF NOT ERRORFREE' ABORT 'Errors in Compile' 'VARIABLE OBJz' ': Required _TIMES.g00 Restart File Missing' + +*------------------------------------------------------------------------------ +* Call MACRO initmty.tm +*------------------------------------------------------------------------------ +$IF NOT SET MACRO $SETGLOBAL MACRO N +$IF %MACRO%==YES $INCLUDE initmty.tm + +*------------------------------------------------------------------------------ +* Load data from GDX if DATAGDX set and %RUN_NAME%~DATA exists +$ IF NOT SET DATAGDX $GOTO RUN +$ IF NOT %G2X6%==YES $GOTO RUN +$ IF NOT SET RUN_NAME $SETNAMES %SYSTEM.INCPARENT% . RUN_NAME . +$ IF NOT EXIST %RUN_NAME%~data.gdx $GOTO RUN +$ hiddencall gdxdump %RUN_NAME%~data.gdx NODATA > _dd_.dmp +$ hiddencall sed "/^\(Alias\|[^($]*(\*) Alias\|[^$].*empty *$\)/{N;d;}; /^\([^$].*$\|$\)/d; s/\$LOAD.. /\$LOAD /I" _dd_.dmp > _dd_.dd +$ INCLUDE _dd_.dd +$ hiddencall rm -f _dd_.dmp +$ TITLE %SYSTEM.TITLE%# +$ GDXIN +$ LABEL RUN diff --git a/initmty.msa b/initmty.msa new file mode 100644 index 0000000..31cbc4a --- /dev/null +++ b/initmty.msa @@ -0,0 +1,117 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* INITMTY.MSA has all the EMPTY declarations for system & user data * +*=============================================================================* +* Basic Sets + SET NITER /1*18/; + SET MITER /1*16/; + SET TB(T), PP(T), TLAST(T); + ALIAS (T,TP); + +* Initialized Scalar Defaults * + SCALARS + TM_ARBM / 1 / + TM_SCALE_CST / 0.001 / + TM_SCALE_NRG / 1 / + TM_SCALE_UTIL / 0.001 / + ; + PARAMETER TM_DEFVAL / + DEPR 5 + ESUB 0.25 + KGDP 2.5 + KPVS 0.25 + DMTOL 0.1 + IVETOL 0.5 + REFTEMP 2.5 + REFLOSS 0.02 + ESC 1.028 + /; + +*============== Declare/Initialize User Defined Sets + + SET MR(REG) //; + SET DM(COM); + SET MRTC(REG,YEAR,COM); + SET TRD / NMR, IRE /; + SET TM_DAM(R,ITEM) //; + +*============== Declare/Initialize Input Parameters + + PARAMETER TM_GR(REG,YEAR) 'Growth rate' //; + PARAMETER TM_GDP0(REG) 'Initial GDP' //; + PARAMETER TM_DEPR(R) 'Depreciation rate' //; + PARAMETER TM_DMTOL(R) 'Demand lower bound factor' //; + PARAMETER TM_IVETOL(R) 'Investment and enery tolerance' //; + PARAMETER TM_KGDP(R) 'Initial capital to GDP ratio' //; + PARAMETER TM_KPVS(R) 'Capital value share' //; + PARAMETER TM_ESUB(R) 'Elasticity of substitution' //; + PARAMETER TM_MDTL(R) 'Market damage linear coeff.' //; + PARAMETER TM_MDTQ(R) 'Market damage quadratic coeff.' //; + PARAMETER TM_HSX(R,YEAR) 'Hockey-stick exponent' //; + +*============== Intermediate parameters for MACRO--1 + +* MACRO Sectoral Demands, marginals and AEEIs + PARAMETER TM_DDATPREF(REG,COM) //; + PARAMETER TM_DDF(REG,YEAR,COM) //; + PARAMETER TM_DEM(REG,YEAR,COM); + PARAMETER TM_DMC(REG,YEAR,COM); + + PARAMETERS + NYPER(T) number of years until next milestone + TM_EC0(REG) initial energy system cost // + TM_C0(REG) initial consumption + TM_Y0(REG) initial gross output + TM_IV0(REG) initial investment + TM_K0(REG) initial capital + TM_RHO(R) exponent derived from esub + TM_ASRV(R) annual capital survival factor + TM_TSRV(R,T) yearly capital survival factor according to number of years per period + TM_AKL(REG) prod function constant for k-l index; + +*============== Intermediate Parameters for MACRO--2 + + PARAMETERS + TM_AEEIV(R,YEAR,C) Annual AEEI and demand decoupling factor + TM_AEEIFAC(R,LL,C) Periodwise AEEI and demand decoupling factor + TM_B(REG,COM) Prod function constant for demand of useful energy + TM_D0(REG,COM) Base year useful demand - from TIMES + TM_DFACTCURR(R,LL) Current annual utility discount factor + TM_DFACT(R,ALLYEAR) Utility discount factor + TM_PWT(YEAR) Periodic utility weight + TM_L(REG,YEAR) Current labor force index (efficiency units) + TM_ANNC(REG,YEAR) Estimate of annual energy system cost + TM_AMP(REG,YEAR) Amortisation of past investments // + TM_GDPGOAL(REG,TP) Projected Baseline GDP + TM_GROWV(REG,YEAR) Potential Labor Growth Rates //; + + PARAMETERS + TM_QSFA(REG,TP) Quadratic supply function A + TM_QSFB(REG,TP,COM) Quadratic supply function B + TM_CATT(R) Catastrophic temperature + TM_UDF(R,ALLYEAR) Utility discount factor + TM_NWT(REG) Negishi weights + TM_NWTIT(NITER,REG) Negishi weights by iteration + TM_PVPI(ITEM,TP) Present value prices of tradeables; + + PARAMETERS + PAR_Y(R,T) Production parameter // + PAR_IV(R,YEAR) Investment parameter // + PAR_GRGDP(R,T) Growth rate of GDP // + PAR_MC(R,T,C) Marginal costs of demands // + ; + + PARAMETER TM_DDF_Y(R,T); + PARAMETER TM_DDF_DM(R,T,C); + PARAMETER TM_DDF_SP(R,T,C); + PARAMETER TM_F2(R,T,C); + PARAMETER TM_YCHECK(R); + +*==================* Results Parameters for MACRO + + PARAMETER TM_DD(R,C,T) Demand ratio MSA estimates to TED demand levels; + PARAMETER TM_GDP(REG,YEAR) Actualized gross domestic product; + PARAMETER TM_RESULT(ITEM,R,YEAR) MACRO Summary result parameters //; diff --git a/initmty.stc b/initmty.stc new file mode 100644 index 0000000..715af09 --- /dev/null +++ b/initmty.stc @@ -0,0 +1,82 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* INITMTY.stc - Extension for Stochastics +*----------------------------------------------------------------------------- +* Questions/Comments: +*----------------------------------------------------------------------------- +$SETGLOBAL STAGES YES +*----------------------------------------------------------------------------- +* Input Control parameters + PARAMETER SW_START(J) //; + PARAMETER SW_SUBS(J,ALLSOW) //; + PARAMETER SW_SPROB(J,ALLSOW) //; + PARAMETER SW_PROB(ALLSOW) //; + PARAMETER SW_LAMBDA / 0 /; +* Predefined UC names for tradeoff analysis + SET UC_N / OBJZ, OBJ1 /; + +* Internal sets and parameters + ALIAS (ALLSOW,WW); + SET SW_CHILD(J,WW,WW) 'Child SOWs of parent SOW at stage J' //; + SET SW_TREE(J,WW,WW) 'Finest level SOWs of SOW at stage J' //; + SET SW_COPY(J,ALLSOW) 'Parent SOW of SOWs to be copied' //; + SET SW_CPMAP(J,WW,WW) 'Copy map for attributes' //; + SET SW_TSTG(LL,J) 'Valid stages J for each period T' //; + SET SW_MAP(T,WW,J,WW) 'Map from internal to original SOW' //; + SET SW_REV(WW,J,WW) 'Reverse SOW tree' //; + SET SUPERYR(T,ALLYEAR) 'SUpremum PERiod YeaR' //; + PARAMETER SW_DESC(J,ALLSOW) 'Number of finest level SOWs' //; + SCALARS SW_PHASE / 0 /, SW_PARM / 0 /, SW_NORM / 1 /, DOITER / 0 /; + +* Which SOWs are available at each period + SET SW_T(ALLYEAR,ALLSOW) 'Which SOWs are available at each period' //; + SET SW_TSW(ALLSOW,ALLYEAR,ALLSOW) 'Mapping from finest SOWs to unique SOW at each period' //; + SET SW_STAGE(J,ALLSOW) 'Internal SOWs at each stage' //; + SET SW_UCT(UC_N,T,ALLSOW) //; + PARAMETER SW_TPROB(T,ALLSOW) //; + +* Stochastic input parameters + PARAMETER S_COM_PROJ(REG,ALLYEAR,COM,J,ALLSOW) 'Demand scenario projection' //; + PARAMETER S_CAP_BND(REG,ALLYEAR,PRC,BD,J,ALLSOW) 'Bound on total installed capacity' //; + PARAMETER S_COM_CUMPRD(R,BOHYEAR,EOHYEAR,C,BD,J,ALLSOW) 'Cumulative limit on COMPRD' //; + PARAMETER S_COM_CUMNET(R,BOHYEAR,EOHYEAR,C,BD,J,ALLSOW) 'Cumulative limit on COMNET' //; + PARAMETER S_COM_TAX(R,ALLYEAR,C,S,COM_VAR,CUR,J,ALLSOW) 'Tax on commodity NET/PRD' //; + PARAMETER S_FLO_CUM(R,P,C,ITEM,ITEM,BD,J,ALLSOW) 'Cumulative limit on FLOW' //; + PARAMETER S_FLO_FUNC(R,ALLYEAR,P,CG,CG,J,ALLSOW) 'Uncertain multiplier of process transformation'; + PARAMETER S_NCAP_COST(R,ALLYEAR,P,J,ALLSOW) 'Uncertain multiplier of investment cost' //; + PARAMETER S_DAM_COST(R,ALLYEAR,C,CUR,J,ALLSOW) 'Damage costs'; + PARAMETER S_UC_RHS(UC_N,LIM,J,ALLSOW) 'RHS of user constraint' //; + PARAMETER S_UC_RHSR(ALL_REG,UC_N,LIM,J,ALLSOW) 'RHS of user constraint' //; + PARAMETER S_UC_RHST(UC_N,ALLYEAR,LIM,J,ALLSOW) 'RHS of user constraint' //; + PARAMETER S_UC_RHSRT(ALL_REG,UC_N,ALLYEAR,LIM,J,ALLSOW) 'RHS of user constraint' //; + PARAMETER S_UC_RHSTS(UC_N,ALLYEAR,TS,LIM,J,ALLSOW) 'RHS of user constraint' //; + PARAMETER S_UC_RHSRTS(ALL_REG,UC_N,ALLYEAR,TS,LIM,J,ALLSOW) 'RHS of user constraint' //; + PARAMETER S_CM_MAXCO2C(ALLYEAR,J,ALLSOW) 'Maximum allowable atmospheric CO2 concentration' //; + PARAMETER S_CM_MAXC(ALLYEAR,ITEM,J,ALLSOW) 'Maximum allowable climatic quantity' //; + PARAMETER S_CM_CONST(ITEM,J,ALLSOW) 'Climate constants' //; + PARAMETER S_UCOBJ(UC_N,ALLSOW) 'Weight of UC objective component in tradeoff analysis' //; + PARAMETER S_NCAP_AFS(R,ALLYEAR,P,S,J,ALLSOW) 'Seasonal availability factors'; + PARAMETER S_COM_FR(R,ALLYEAR,C,S,J,ALLSOW) 'Commodity fraction multipliers'; + +* Internal work sets and parameters + PARAMETER S_COM_CUM(R,COM_VAR,ALLYEAR,ALLYEAR,C,BD,J,ALLSOW) 'Cumulative limit on COMPRD' //; + SET T0(LL) 'Augmented periods'; + SET SW_T2W(WW,T,WW,LL) 'Augmented map for SOWs by period'; + SET RTCSW(R,T,C,S,WW) 'Indicator for uncertain timeslice fractions'; + SET RTPW(R,ALLYEAR,P,ALLSOW) 'Uncertain SOW by vintage'; + SET RP_FFSGG(R,P,CG,CG) 'Uncertain transformation groups'; + SET RP_FFSGGM(R,P,CG,CG,COM_GRP,COM_GRP) 'Map of transformation groups'; + PARAMETER OBJ_SIC(R,T,P,ALLSOW) 'Uncertainty in investments'; + PARAMETER SUC_L(ALL_R,UC_N) 'Dynamic type LHS' //; + PARAMETER RTP_SAFS(R,T,P,S,WW) 'Uncertain availability factors'; + PARAMETER RTCS_SFR(R,LL,C,S,WW,TS) 'Uncertain COM_FR multipliers'; + PARAMETER RCS_SSFR(R,C,S,TS,WW,LL) 'Uncertain COM_FR multipliers'; + +* Reporting + PARAMETER SPAR_UCSL(WW,UC_N,*,*,*) //; + PARAMETER CM_SRESULT(ALLSOW,ITEM,ALLYEAR) 'Climate Module basic results' //; + PARAMETER CM_SMAXC_M(ALLSOW,ITEM,ALLYEAR) 'Marginals for max constraints' //; +*----------------------------------------------------------------------------- \ No newline at end of file diff --git a/initmty.tm b/initmty.tm new file mode 100644 index 0000000..4dc1343 --- /dev/null +++ b/initmty.tm @@ -0,0 +1,56 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================= +* INIT DECLARATIONS FOR THE MACRO EXTENSION +*============================================================================= +$ SETGLOBAL SPOINT 3 +* As in original IER implementation, disable warm start in MACRO +* This may be overridden in the RUN file after the INITMTY call + OPTION BRATIO=1; +*--- Input parameters --- +PARAMETER TM_ARBM /1000/; +PARAMETER TM_SCALE_UTIL 'Scaling factor utility function' /0/; +PARAMETER TM_SCALE_NRG 'Scaling factor demand units' /0/; +PARAMETER TM_SCALE_CST 'Scaling factor cost units' /0/; +PARAMETER TM_DEPR(R) 'Depreciation rate' //; +PARAMETER TM_DMTOL(R) 'Demand lower bound factor' //; +PARAMETER TM_ESUB(R) 'Elasticity of substitution' //; +PARAMETER TM_GDP0(R) 'GDP in the first period' //; +PARAMETER TM_GR(R,ALLYEAR) 'MACRO Projected Annual GDP Growth' //; +PARAMETER TM_IVETOL(R) 'Investment and enery tolerance' //; +PARAMETER TM_KGDP(R) 'Initial capital to GDP ratio' //; +PARAMETER TM_KPVS(R) 'Capital value share' //; +PARAMETER TM_QFAC(R) 'Switch for market penetration penalty function' //; +PARAMETER TM_EXPBND(R,ALLYEAR,P) 'Market Penetration Cutoff for Applying Cost Penalty' //; +PARAMETER TM_EXPF(R,ALLYEAR) 'Annual percent expansion factor' //; +*--- Calibration parameters --- +PARAMETER TM_EC0(R) 'Energy costs in the first period'; +PARAMETER TM_GROWV(R,ALLYEAR) 'Labour growth rate' //; +PARAMETER TM_DDATPREF(R,C) 'Reference marginal price for demand' //; +PARAMETER TM_DDF(R,ALLYEAR,C) 'Demand decoupling factor' //; +*--- Internal parameters --- +PARAMETER TM_PWT(ALLYEAR) 'Period weight'; +PARAMETER TM_AMP(R,ALLYEAR) 'Amortisation of past investments (from CSA only)' //; +PARAMETER TM_AKL(R) 'Production function constant' //; +PARAMETER TM_ASRV(R) 'Annual capital survival factor' //; +PARAMETER TM_RHO(R) 'Substitution constant' //; +PARAMETER TM_B(R,C) 'Demand coefficient' //; +PARAMETER TM_D0(R,C) 'Demand in first period' //; +PARAMETER TM_L(R,YEAR) 'Annual labor index' //; +PARAMETER TM_TSRV(R,YEAR) 'Capital survival factor between two periods' //; +PARAMETER TM_AEEIV(R,YEAR,C) 'Annual Autonomous energy efficiency and demand decoupling factor' //; +PARAMETER TM_AEEIFAC(R,YEAR,C) 'Periodwise Autonomous energy efficiency and demand decoupling factor' //; +PARAMETER TM_ADDER(R,T,C) 'Demand decoupling adder' //; +PARAMETER TM_C0(R) 'Consume in the first period' //; +PARAMETER TM_K0(R) 'Capital stock in first period' //; +PARAMETER TM_IV0(R) 'Investment in the first period' //; +PARAMETER TM_Y0(R) 'Annual production in first period' //; +PARAMETER TM_DFACT(R,YEAR) 'Utility discount factor' //; +PARAMETER TM_DFACTCURR(R,YEAR) 'Intermediate parameter for the utility discount factor' //; +PARAMETER TM_UDF(R,ALLYEAR) 'Utility discount factor' //; +PARAMETER TM_CAP(R,P) 'Base year capacity values for expanding technologies' //; +PARAMETER TM_CAPTB(R,P) 'Cumulative quadratic capacity penalty level' //; +PARAMETER TM_CSTINV(R,ALLYEAR,P) 'Annualized investment costs' //; +PARAMETER TM_YCHECK(R) 'Check' //; diff --git a/initmty.vda b/initmty.vda new file mode 100644 index 0000000..0be626e --- /dev/null +++ b/initmty.vda @@ -0,0 +1,66 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* INITMTY.VDA has all the EMPTY declarations for system & user data * +*=============================================================================* +$ SETGLOBAL VDA YES +*============================================================================= +* User Input attributes in the VDA extension +*----------------------------------------------------------------------------- +* Process transformation parameters: + PARAMETERS + VDA_FLOP(REG,ALLYEAR,PRC,CG,S) 'General process transformation parameter' + VDA_EMCB(REG,ALLYEAR,COM,COM) 'Combustion emission parameter (aka EMI_comb)' // + VDA_CEH(REG,ALLYEAR,PRC) 'The slope of pass-out turbine (alias NCAP_CEH)' // + FLO_EMIS(REG,ALLYEAR,PRC,CG,COM,S) 'General process emission parameter' // + FLO_EFF(REG,ALLYEAR,PRC,CG,COM,S) 'General process flow-relation parameter' //; +*----------------------------------------------------------------------------- +* Commodity-dependent availabilities: +$ SET MX ,SEASON, WEEKLY, DAYNITE + SET STL / SET.S%MX% /; + PARAMETERS + NCAP_AFAC(REG,ALLYEAR,PRC,CG) 'Annual availability of capacity for commodity group CG' // + NCAP_AFC(REG,ALLYEAR,PRC,CG,STL) 'Availability of capacity for commodity group CG'// + NCAP_AFCS(REG,ALLYEAR,PRC,CG,TS) 'Availability of capacity for commodity group CG'//; +*----------------------------------------------------------------------------- +* Dynamic UC variable bounds (UC_DYNBND user-defined) + SET UC_DYNBND(UC_N,LIM) 'Dynamic process-wise UC bounds' //; +*----------------------------------------------------------------------------- +* Activity efficiency and dispatching options + PARAMETERS + ACT_EFF(REG,YEAR,PRC,CG,TS) 'Activity efficiency for process' // + ACT_UPS(R,ALLYEAR,P,S,L) 'Max. ramp rate, fraction of capacity per hour' + ACT_MINLD(R,ALLYEAR,P) 'Minimum stable operation level' // + ACT_LOSPL(R,ALLYEAR,P,L) 'Fuel consumption increase at minimum load' // + ACT_CSTPL(R,ALLYEAR,P,CUR) 'Partial load cost penalty' // + ACT_MAXNON(R,LL,P,UPT) 'Max. non-operational time before transition to next stand-by condition, by start-up type, in hours' // + ACT_SDTIME(R,LL,P,UPT,BD) 'Duration of start-up (BD=UP) and shut-down BD=LO) phases, by start-up type, in hours' // + ACT_LOSSD(R,LL,P,UPT,BD) 'Efficiency at one hour from start-up (BD=UP) or at one hour to end of shut-down (BD=LO)' // + STG_MAXCYC(R,YEAR,P) 'Maximum number of storage cycles over lifetime' //; +*----------------------------------------------------------------------------- +* Special: Risk parameters & reporting options + PARAMETER UC_ACTBET(UC_N,ALL_REG,ALLYEAR,PRC); + PARAMETER UC_FLOBET(UC_N,ALL_REG,ALLYEAR,PRC,CG); + PARAMETER PRC_REACT(R,ALLYEAR,P) 'Reactance of transmission line'; + PARAMETER COM_CSTBAL(R,ALLYEAR,C,S,ITEM,CUR) 'Cost on specific component of node balance'; + PARAMETER GR_GENLEV(R,C) 'Grid connection category for electricity generation commodity'//; + PARAMETER GR_DEMFR(R,ALLYEAR,C,S) 'Fraction of total electricity demand allocated to grid node' //; + PARAMETER GR_ENDFR(R,ALLYEAR,C,CG) 'Fraction of sectoral electricity demand allocated to grid node' //; + PARAMETER GR_GENFR(R,ALLYEAR,C,ITEM) 'Fraction of electricity generation type allocated to grid node'//; + PARAMETER GR_GENMAP(R,P,ITEM) 'Mapping of technology to generation type' //; + PARAMETER GR_XBND(R,ALLYEAR) 'Maximum level of net imports to / exports from region' //; + PARAMETER GR_THMIN(R,LL,P) 'Thermal minimum level' //; + PARAMETER GR_VARGEN(R,S,ITEM,BD) 'Variance in type of generation'; +*----------------------------------------------------------------------------- +* Attributes for experimental ECB extension + PARAMETER COM_MSHGV(R,YEAR,C) 'Choices heterogeneity parameter' //; + PARAMETER NCAP_MSPRF(R,YEAR,C,P,LIM) 'Preference parameters in choice' //; +*----------------------------------------------------------------------------- +* Predefined items + SET ALL_REG / IMPEXP /; + SET COM_GRP / IMP, EXP /; + SET ITEM / OBJ /, UC_NAME / ANNUAL %MX% /; + SET UC_N /%SYSPREFIX%SOLVE_STATUS 'Model solution status code'/; +*----------------------------------------------------------------------------- \ No newline at end of file diff --git a/initsys.mod b/initsys.mod new file mode 100644 index 0000000..3a0782a --- /dev/null +++ b/initsys.mod @@ -0,0 +1,187 @@ +$TITLE TIMES -- VERSION 4.7.7 +*==========================================================================================* +* INITSYS.MOD has all the fixed system declarations for ETSAP TIMES * +*==========================================================================================* +$ onlisting ontext +*=========================================================================================== +* Copyright (C) 2000-2023 IEA Energy Technology Systems Analysis Programme (IEA-ETSAP). +* This software (ETSAP TIMES) is open source: you can redistribute it and/or modify it +* under the terms of the GNU General Public License v3.0 (see file NOTICE-GPLv3.txt). +* For further information, visit: . +* +* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*=========================================================================================== +$ offtext +$ offlisting +$ SET TMP Restart +$ IF %SYSTEM.LICENSELEVEL%==2 $SET TMP Runtime +$ IF SET RunTimes $TITLE %SYSTEM.TITLE% -- %TMP% (v%RunTimes%) +$ PHANTOM EMPTY +$ ONEMPTY +$ ONMULTI +* TIME - SET ALL_TS ordering is crucial, since the order of time-slices within a TSLVL is used in EQ_STGTSS. +* Therefore, declare ALL_TS first, before the call to INITSYS.MOD. Example: +* +* SET ALL_TS 'Time-slices ' +* / ANNUAL 'Annual ' +* I 'Intermediate' +* S 'Summer ' +* W 'Winter ' +* / ; + + ALIAS(*,ITEM); +* Defaults for the some total spans available in the model: +$IF NOT SET BOTIME $SETGLOBAL BOTIME 1850 +$IF NOT SET EOTIME $SETGLOBAL EOTIME 2200 +$IF NOT %SHELL%==ANSWER +$IF SET MAXSOW SET ITEM /BOH, 1*%EOTIME%/; + + SET BOHYEAR 'BOH + years' / BOH, %BOTIME%*%EOTIME% / + SET ALLYEAR 'All Years' / %BOTIME%*%EOTIME% / + PARAMETER YEARVAL(ALLYEAR) 'Value of each year'; + YEARVAL(ALLYEAR) = %BOTIME% + ORD(ALLYEAR)-1; + SET EOHYEAR "'BOH/EOH' + years" / SET.BOHYEAR, EOH / + Parameter BEOH(*) 'BOH / EOH offset' / BOH +1, EOH -1 /; + SET PERIODYR(ALLYEAR,ALLYEAR) 'All years in each period' //; + SET ALL_TS 'The universe for time-slices' / ANNUAL / + SET ANNUAL(ALL_TS) 'Annual identifier' / ANNUAL / + SET TSLVL 'Timeslice levels' / ANNUAL, SEASON, WEEKLY, DAYNITE /; + PARAMETER TSLVLNUM(TSLVL) 'Timeslice level values' + / ANNUAL 1 + SEASON 2 + WEEKLY 3 + DAYNITE 4 /; +* SET SEASON(REG,ALL_TS) 'Seasons' //; +* SET WEEK(REG,ALL_TS) 'Week Sub-divisions ' //; +* SET DAYNITE(REG,ALL_TS) 'Daily Sub-divisions' //; + + ALIAS(ALLYEAR,YEAR,LL); + +* topology + SET IMPEXP 'Imports/Exports' / IMP, EXP / + SET IMP 'Imports' / IMP / + SET XPT 'Exports' / EXP / + SET IN_OUT 'Input/Output' / IN, OUT / + ALIAS(IMPEXP,IE); + ALIAS(IN_OUT,IO); + +* limits + SET LIM 'Limit Types' / LO, FX, UP, N / + SET BND_TYPE(LIM) 'Bound Types' / LO, FX, UP / + ALIAS(LIM,L,LIM_TYPE); + ALIAS(BND_TYPE,BD); + +* Start-up types + SET UPT 'Start-up types' / COLD, WARM, HOT / + +* Numbered sets + SET ALLYEAR / 0 /; + SET AGE 'Age for SHAPEing' / 1*200 / + SET J 'Supply/demand steps 1*COM_STEP and SHAPE/MULTI' / 1*999 / + ALIAS(J,JJ); + +* Master Set declarations + SET ALL_REG(*) 'External + Internal Regions' // + SET REG(ALL_REG) 'Region' // + ALIAS(ALL_REG,ALL_R); + ALIAS(REG,R); + + SET COM_GRP 'Commodities & Groups' + / DEM 'Demands', + NRG 'Energy', + MAT 'Material', + ENV 'Environmental Indicators', + FIN 'Financial' /; + ALIAS(COM_GRP,CG,CG1,CG2); + + SET COM(COM_GRP) 'Commodities' // + ALIAS(COM,C,COM1,COM2); + + SET PRC(*) 'Processes' // + ALIAS(PRC,P); + SET CUR(*) 'Currencies = c$' // + ALIAS(CUR,CURR); + +* Stochastics +$ SETGLOBAL MAXSOW 96 + SET ALLSOW 'State-of-the-World' / 1*%MAXSOW% / + SET SOW(ALLSOW) 'State-of-the-World' // + ALIAS(SOW,W); + +*------------------------------------------------------------------------------- +* UC facility - fixed sets and controls for user-constraints +*------------------------------------------------------------------------------- + SET SIDE 'LHS and RHS of an equation' / LHS, RHS / + PARAMETER UC_SIGN(SIDE) 'Sign of LHS and RHS expression' / LHS 1, RHS -1 /; + SETS COM_VAR / NET, PRD /, COV_MAP / NET.COMNET, PRD.COMPRD /; + +* List of parameters that can be used in user-constraints + SET UC_NAME 'Allowed parameters in user-constraints' + / COST, DELIV, TAX, SUB + EFF, NET, N + GROWTH, PERIOD, PERDISC, BUILDUP + CUMSUM, CUM+, SYNC, YES + CAPACT, CAPFLO, NEWFLO, ONLINE + ANNUL, INVCOST, INVTAX, INVSUB + FLO_COST, FLO_DELIV, FLO_SUB, FLO_TAX + NCAP_COST, NCAP_ITAX, NCAP_ISUB + /; + + SET UC_COST(UC_NAME) 'UC cost attributes' + / COST, DELIV, TAX, SUB, ANNUL /; + + SET UC_MAPCOST(UC_COST,UC_NAME) 'Compatibility map for cost attributes' + / COST.(FLO_COST,NCAP_COST) + DELIV.FLO_DELIV + ANNUL.(INVCOST,INVTAX,INVSUB) + TAX.(FLO_TAX,NCAP_ITAX) + SUB.(FLO_SUB,NCAP_ISUB) /; + + SET UC_ANNUL(UC_NAME) / INVCOST, INVTAX, INVSUB /; + SET UC_DYNT(UC_NAME) / N, CUMSUM, CUM+, SYNC /; + + SET UC_NUMBER 'Determines way of handling of REG,T and TS' + / SEVERAL, SUCC, EACH /; + + SET UC_PERDS(UC_NAME) / PERIOD, NEWFLO /; + SET UC_NEWFLO(UC_NAME) / NEWFLO /; + + SET UC_GRPTYPE 'Type of components within UC_GRP' + / ACT, FLO, IRE, CAP, NCAP, COMNET, COMPRD, COMCON, UCN /; + + SET COSTAGG 'Types of cost aggregations' + / INV, INVTAX, INVSUB, FOM, FOMTAX, FOMSUB, COMTAX, COMSUB, FLOTAX, FLOSUB, + INVTAXSUB, INVALL, FOMTAXSUB, FOMALL, FIX, FIXTAX, FIXSUB, FIXTAXSUB, FIXALL, + COMTAXSUB, FLOTAXSUB, ALLTAX, ALLSUB, ALLTAXSUB /; + ALIAS (COSTAGG,COSTCAT) + ALIAS (UC_COST,COSTYPE) +*------------------------------------------------------------------------------- +* control sets +* - expected in *.RUN file +* - throw switch other way in *.RUN to change +*------------------------------------------------------------------------------- +* user should provide name in *.RUN +$ SET MODEL_NAME TIMES +$ SET RUN_NAME TEST +* control of whether all 0 lines are dumped in *.PUT files; user provides 0 to NOT print lines with all 0s (or empty) + SCALAR DUMP0 /1/, OPTFILEID /1/; +* user set to 'YES' to activate +$ SET DEBUG NO +$ SET DUMPSOL NO +$ SET SOLANS NO +* user set to 'NO' to not abort when error condition fails +$ SET ERR_ABORT YES +* user sets to 'WWW' to activate +$ SET GAMS_CGI NO +* user sets to 'NO' if only want to compile +$ SET SOLVE_NOW YES + +* get list of default units +$ BATINCLUDE units.def + +* get list of default mapping group lists +$ BATINCLUDE maplists.def + +* get defalut global scalars and parameters +$ BATINCLUDE globals.def diff --git a/main_ext.mod b/main_ext.mod new file mode 100644 index 0000000..12fc046 --- /dev/null +++ b/main_ext.mod @@ -0,0 +1,23 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MAIN_EXT.mod is the extension driver +*=============================================================================* +* %1 is the name of the extension module to be called, e.g. 'rpt_ext' for reporting extensions +* Different extensions are identified by file extensions given in %2, %3, %4....%9 +* Example: $BATINCLUDE rpt_ext ETL RP1 RP2 +* This would include the reporting extensions for ETL and two custom +* reporting routines rpt_ext.RP1 and rpt_ext.RP2 +*----------------------------------------------------------------------------- +$SETNAMES %SYSTEM.INCPARENT% . TMP . +$SETLOCAL WHCALL %1 +$LABEL MORE +$SHIFT +$IF %1. == . $GOTO DONE +$IF NOT SETLOCAL %1 +$IF EXIST %WHCALL%.%1 $BATINCLUDE %WHCALL%.%1 %1 %TMP% +$SETLOCAL %1 YES +$GOTO MORE +$LABEL DONE diff --git a/maindrv.mod b/maindrv.mod new file mode 100644 index 0000000..e211c30 --- /dev/null +++ b/maindrv.mod @@ -0,0 +1,133 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MAINDRV.EXT is the main driver hooking together the various core model code * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* Questions/Comments: +* - BATINCLUDE calls should all be with lower case file names for UNIX +* - Move the NO_EMTY to the *.RUN (user controlled) for dumpdata control +* and make YES/NO the expected value in DUMPPUT +* - [AL]: support for TIMES extension modules added +*----------------------------------------------------------------------------- +*$ONLISTING +* adjust GAMS language defaults to allow mixed mode $ tests and allow latest syntax +*----------------------------------------------------------------------------- +$ ONEMPTY +$ ONMIXED +$ USE999 +$ SETLOCAL SRC %1 +$ SETENV GDXCOMPRESS 1 +$ BATINCLUDE setglobs 1 +$ SET MODEL_NAME TIMES +$ IFI %MICRO%%TIMESED%==YES0 $SET TIMESED YES +$ IFI %MACRO%==YES $SET MACRO 'YES' SET TIMESED 0 +$ IF NOT %SYSTEM.FILESYS%==MSNT $SET MODEL_NAME times +$ IFI NOT %TIMESED%==NO +$ IF NOT %TIMESED%==0 $BATINCLUDE readbprice.mod +$ %MX% SETGLOBAL MX +$ IFI %MACRO%==YES $SET MODEL_NAME 'TIMES_MACRO' SETLOCAL SRC tm +* Stochastic & sensitivity analysis controls +$ IFI %STAGES% == YES $SET STAGES YES +$ IFI %SENSIS% == YES $SET STAGES Yes +$ IFI %SPINES% == YES $SET STAGES YES +$ IF %STAGES% == YES $SET SENSIS 'NO' SET OBJANN NO +* Stepped TIMES solution controls +$ IF SET TIMESTEP $SETGLOBAL STEPPED + +$ SET R_T 'R,T' SET TX 'T' SET R_V_T 'R,V,T' SET RTPX '' +$ IF SET STEPPED $SET R_T 'R,SUBT(T)' SET TX 'SUBT(T)' SET R_V_T 'R,V,SUBT(T)' +$ IF DEFINED REG_FIXT $SET R_T 'RT_PP(%R_T%)' SET R_V_T 'RVT(%R_V_T%)' SET RTPX X +*----------------------------------------------------------------------------- +* do a check on user data +*----------------------------------------------------------------------------- +$ BATINCLUDE err_stat.mod '$IF NOT ERRORFREE' ABORT '*** ERRORS IN INPUT DATA/COMPILE ***' + +*----------------------------------------------------------------------------- +* hook for GAMS-CGI WWW input +*----------------------------------------------------------------------------- +$ IF %GAMS_CGI% == WWW $BATINCLUDE www_in.cgi + +*----------------------------------------------------------------------------- +* perform preprocessor tasks +*----------------------------------------------------------------------------- +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod init_ext %EXTEND% +$ BATINCLUDE ppmain.%1 %1 +$ IFI %INTEXT_ONLY% ==YES $GOTO SKIPTOEND +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod ppm_ext %EXTEND% +*----------------------------------------------------------------------------- +* dump out the user/system data structures +*----------------------------------------------------------------------------- +$ IF %DEBUG% == YES execute_unload "DATADUMP.gdx"; +*----------------------------------------------------------------------------- +* Set the main controls for stochastic mode +$ IFI %STAGES%==YES $BATINCLUDE stages.stc +$ IF %STAGES%==YES $%SW_TAGS% +$ IF NOT %STAGES%==YES $%SW_NOTAGS% +*----------------------------------------------------------------------------- +* build the coefficients +*----------------------------------------------------------------------------- +$ IFI '%MID_YEAR%'==YES $SET DISCSHIFT 0.5 +$ BATINCLUDE coefmain.%1 %1 +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod coef_ext %EXTEND% +*----------------------------------------------------------------------------- +* establish model (use different .ext?) +*----------------------------------------------------------------------------- +$ BATINCLUDE mod_vars.%SRC% +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod mod_vars %EXTEND% +$ BATINCLUDE eqmain.%1 %1 +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod equ_ext %EXTEND% +*----------------------------------------------------------------------------- +$ BATINCLUDE mod_equa.%SRC% +$ IFI %MERGE% == YES $GOTO BNDSET +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod mod_ext %EXTEND% +** End of MODEL statement is removed from mod_equa and added here: +/; + +$LABEL BNDSET +*----------------------------------------------------------------------------- +* establish bounds +*----------------------------------------------------------------------------- +$ BATINCLUDE bndmain.%1 %1 0 + +*----------------------------------------------------------------------------- +* do quality assurance checks +*----------------------------------------------------------------------------- +$ BATINCLUDE pp_qack.%1 %1 + +*----------------------------------------------------------------------------- +* do an check on compile/execute errors +*----------------------------------------------------------------------------- +$ BATINCLUDE err_stat.%1 '$IF NOT ERRORFREE' ABORT '*** ERRORS IN GAMS COMPILE ***' +$ BATINCLUDE err_stat.%1 ABORT EXECERROR '*** ERRORS IN GAMS EXECUTION ***' +$ BATINCLUDE spoint.%1 1 +$ IF NOT %RPOINT%==NO $GOTO REPORT +*----------------------------------------------------------------------------- +* solve the appropriate model & report solver status +*----------------------------------------------------------------------------- +$ SETLOCAL EXT %1 +$ IFI %STAGES% == YES $SETLOCAL EXT stc +$ IF SET STEPPED $SETLOCAL EXT stp +$ IFI %MERGE% == YES $SETLOCAL EXT mrg +$ BATINCLUDE solve.%EXT% %1 +$ IF %SOLVE_NOW% == NO $GOTO SKIPTOEND + +*----------------------------------------------------------------------------- +* produce the reports +*----------------------------------------------------------------------------- +$ LABEL REPORT +$ BATINCLUDE rptmain.%1 %1 NO_EMTY +$ IF NOT %TIMESED%==0 +$ IF NOT %TIMESED%==YES $BATINCLUDE wrtbprice.mod +$ IF SET SPOINT $BATINCLUDE spoint.%1 0 + +*----------------------------------------------------------------------------- +* do an check on compile/execute errors from reports +*----------------------------------------------------------------------------- +$ BATINCLUDE err_stat.mod '$IF NOT ERRORFREE' ABORT '*** ERRORS IN GAMS COMPILE ***' +$ BATINCLUDE err_stat.mod ABORT EXECERROR '*** ERRORS IN GAMS EXECUTION ***' +*----------------------------------------------------------------------------- + +$LABEL SKIPTOEND +*$OFFLISTING diff --git a/maplists.def b/maplists.def new file mode 100644 index 0000000..90f9592 --- /dev/null +++ b/maplists.def @@ -0,0 +1,122 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==============================================================================* +* MAPLISTS.DEF has all the (fixed for now) MAPPING set group declarations +* For the most part the primary purpose of these lists is to group reporting +* table information, however some set members are explicitly tested for in +* the code and should not be removed/re-defined. +*==============================================================================* +* commodities + SET COM_TYPE(COM_GRP) 'List of main commodity types groups' +* This list should NOT be adjusted as these group names are explicitly referenced in the code! + / DEM 'Demands' + NRG 'Energy' + MAT 'Material' + ENV 'Environmental Indicators' + FIN 'Financial' /; + SET PG_SMAP(CG,J,CG) 'Map from PG to SPG' / + DEM.(1.NRG,2.MAT,3.ENV) + NRG.(1.MAT,2.DEM,3.ENV) + MAT.(1.NRG,2.DEM,3.ENV) + ENV.(1.NRG,2.MAT,3.DEM) /; + +* currency + SET CUR_GRP 'List of currency groups' + / DOMESTIC 'Domestic' + FOREIGN 'Foreign' + INTLAID 'International Aid' + RDD 'Research & Development' /; + +* demands + SET DEM_SECT 'List of demand sectors' + / RES 'Residential' + COM 'Commercial' + IND 'Industrial' + TRN 'Transportation' + AGR 'Agriculture' + NE 'Non-energy' + OTH 'Other' /; + +* environmental + SET ENV_GRP 'List of emission groups' + / GHG 'Greenhouse Gases' + PEM 'Particulate emissions' + OEM 'Other emissions' + OTHENV 'Other indicators' /; + +* financial + SET FIN_GRP 'List of financial groups' + / DOMESTIC 'Domestic' + FOREIGN 'Foreign' + INTLAID 'International Aid' /; + +* materials + SET MAT_GRP 'List of material groups' + / PRIMARY 'Primary' + PRODUCT 'Product' + WASTE 'Waste' /; + SET MAT_TYPE 'List of material types' + / DURABLE 'Durables' + CONSUMED 'Consumed' + FINITE 'Finite' + RECYCLED 'Recycled' + RNEWABLE 'Renewable' /; + +* energy + SET NRG_FORM 'List of energy forms' + / SOLID 'Solids' + LIQUID 'Liquids' + GAS 'Gaseous' /; + SET NRG_GRID 'List of grid types' + / ELC 'Electricity' + LTHEAT 'Low-temperature Heat' + HTHEAT 'High-temperature Heat' + GAS 'Natural Gas'/; + SET NRG_TYPE 'List of energy types' + / FOSSIL 'Fossil' + NUCLR 'Nuclear' + SYNTH 'Synthetic' + RATE 'Rate of doing work or transferring heat (dW/dt)' + RENEN 'Renewable Energies' + LIMRENEW 'Limited Renewables' +* these values are explicitly referenced in the code to release the balance EQ + FRERENEW 'Unlimited Renewables' + CONSRV 'Conservation' +* these values are explicitly referenced in the code, e.g. part of CHP modeling + ELC 'Electricity' + HTHEAT 'High-temperature Heat' + LTHEAT 'Low-temperture Heat' /; + +* processes + SET PRC_GRP 'List of process groups' + / XTRACT 'Extraction' + RENEW 'Renewables (limited)' + PRE 'Energy' + PRW 'Material (by weight)' + PRV 'Material (by volume)' + REF 'Refined Products' + ELE 'Electric Generation' + HPL 'Heat Generation' +* this value is explicitly referenced in the code to ensure CHP attributes appropriate + CHP 'Combined Heat+Power' + DMD 'Demand Devices' + DISTR 'Distribution Systems' + CORR 'Corridor Device' + STG 'Storage' + NST 'Night (Off-peak) Storage' + IRE 'Inter-region exchange (IMPort/EXPort)' + STK 'Stockpiling' + MISC 'Miscellaneous' + STS 'Time-slice storage (excluding night storages)' + SGS 'General process with storage capability' /; + + SET PRC_RSOURC 'List of domestic resource supply groups' + / UNDRGRD 'Underground' + STRIP 'Strip Mine' + OFFSHR 'Offshore' + ONSHR 'Onshore' + ENHANCED 'Enhanced Recovery' + BYPRD 'By-product' + HARVST 'Harvest & Gathering' /; diff --git a/mod_equa.mod b/mod_equa.mod new file mode 100644 index 0000000..48cba63 --- /dev/null +++ b/mod_equa.mod @@ -0,0 +1,216 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MOD_EQUA.MOD lists all the equations for each of the MODEL instances * +* a MODEL / / block will appear for each model supported * +*=============================================================================* +*GaG Questions/Comments: +* - any non-binding (=N=) accounting equations, or do it all with reports? +* - Investment component = investment cost + tax/sub + decom, not split? +* - Fixed component = O&M cost + tax/sub, not split? +*----------------------------------------------------------------------------- +$IF %1==CORE $GOTO CORE + + MODEL TIMES / +*----------------------------------------------------------------------------- +* Objective Function & Components +*----------------------------------------------------------------------------- +* Overall OBJ linear combination of the regional objs (which are built from rest) + EQ_OBJ + +$IFI %STAGES%==YES + EQ_EXPOBJ, EQ_UPDEV, %EQ%_SOBJ, %EQ%_ROBJ + +* Resource depletion costs +* EQ_OBJDPL + +* Costs of elastic demands +$IF %TIMESED% == YES %EQ%_OBJELS +$IFI %OBJANN% == YES $GOTO CORE + +* Fixed Costs including tax/subsidy + %EQ%_OBJFIX + +* investment component including tax/subsidy + %EQ%_OBJINV + +* Salvage + %EQ%_OBJSALV + +* Variable operating costs + %EQ%_OBJVAR + +$LABEL CORE +*----------------------------------------------------------------------------- +* MACRO calibration +*----------------------------------------------------------------------------- +$IFI %OBJANN%==YES EQ_OBJANN, EQ_ANNFIX, EQ_ANNINV, EQ_ANNVAR + +*----------------------------------------------------------------------------- +* Core Equations +*----------------------------------------------------------------------------- +* Relationship between process activity & individual commodity flows + %EQ%_ACTFLO + +* Bound of vintage process activity or TS-level above PRC_TS + %EQ%G_ACTBND + %EQ%E_ACTBND + %EQ%L_ACTBND + +* Bound on commodities + %EQ%G_BNDNET + %EQ%E_BNDNET + %EQ%L_BNDNET + %EQ%G_BNDPRD + %EQ%E_BNDPRD + %EQ%L_BNDPRD + +* Utilization of capacity, or the relationship between process capacity and activity + %EQ%L_CAPACT + %EQ%E_CAPACT + %EQ%G_CAPACT +$IF DEFINED PRC_SIMV EQL_CAPVAC, EQE_CAPVAC, EQG_CAPVAC + +* Basic commodity balance equations (by type) ensuring that production >=/= consumption + %EQ%G_COMBAL + %EQ%E_COMBAL + %EQ%E_COMPRD +$IF %TIMESED%==YES %EQ%L_COMCES + +* Transfer of installed capacity between periods + %EQ%E_CPT + %EQ%G_CPT + %EQ%L_CPT + +* Bound on the flow variable + %EQ%G_FLOBND + %EQ%E_FLOBND + %EQ%L_FLOBND + +* Bound on the fraction of a flow within a time slice + %EQ%G_FLOFR + %EQ%E_FLOFR + %EQ%L_FLOFR + +* Market share equation allocating commodity percentages of a group + %EQ%G_INSHR + %EQ%E_INSHR + %EQ%L_INSHR + +* Inter-regional exchange balance + %EQ%_IRE + +* Bound on inter-regional exchange of a commodity + %EQ%G_IREBND + %EQ%E_IREBND + %EQ%L_IREBND + +* Bound on total exchange of a commodity to/from all regions + %EQ%G_XBND + %EQ%E_XBND + %EQ%L_XBND + +* Product share equation allocating commodity percentages of a group + %EQ%G_OUTSHR + %EQ%E_OUTSHR + %EQ%L_OUTSHR + +* Market share equation for process in total commodity production + %EQ%G_FLOMRK + %EQ%E_FLOMRK + %EQ%L_FLOMRK + +* Peaking Equation + %EQ%_PEAK + +* Commodity-to-commodity transformation + %EQ%_PTRANS + +* Cumulative commodity NET/PRD and flow constraint + %EQ%_CUMNET + %EQ%_CUMPRD + %EQ%_CUMFLO + +* Time-slice storage + %EQ%_STGTSS + %EQ%_STSBAL + EQ_STSLEV + +* Bounds on in/output flows of storage process + %EQ%G_STGIN + %EQ%E_STGIN + %EQ%L_STGIN + %EQ%G_STGOUT + %EQ%E_STGOUT + %EQ%L_STGOUT + +* Inter-period storage + %EQ%_STGIPS + %EQ%_STGAUX + +* User-constraint + + %EQ%E_UC + %EQ%E_UCR + %EQ%E_UCT + %EQ%E_UCRS + %EQ%E_UCRT + %EQ%E_UCTS + %EQ%E_UCRTS + %EQ%E_UCSU + %EQ%E_UCRSU + %EQ%E_UCSUS + %EQ%E_UCRSUS + +$IF '%VAR_UC%' == YES $GOTO UCDONE + + EQG_UC + EQG_UCR + EQG_UCT + EQG_UCRS + EQG_UCRT + EQG_UCTS + EQG_UCRTS + EQG_UCSU + EQG_UCRSU + EQG_UCSUS + EQG_UCRSUS + + EQL_UC + EQL_UCR + EQL_UCT + EQL_UCRS + EQL_UCRT + EQL_UCTS + EQL_UCRTS + EQL_UCSU + EQL_UCRSU + EQL_UCSUS + EQL_UCRSUS + +$LABEL UCDONE + +* Bounds on costs by region, category and currency + %EQ%_BNDCST + +*--------------------------------------------------------------------- +*GG* V07_2 Refinery blending +*--------------------------------------------------------------------- + EQL_BLND + EQG_BLND + EQE_BLND + EQN_BLND + +*----------------------------------------------------------------------------- +* damages +*----------------------------------------------------------------------------- +$IF DEFINED DAM_COST +$IF NOT %DAMAGE%==NO %EQ%_DAMAGE, %EQ%_OBJDAM + +$IF DEFINED VNRET %EQ%_DSCRET, %EQ%_CUMRET, %EQ%L_SCAP, %EQ%L_REFIT +$IFI %SPINES%==YES %EQ%_OBW1 + +* [AL] Commented out the end of MODEL statement - now in maindrvx.mod +*/; diff --git a/mod_equa.tm b/mod_equa.tm new file mode 100644 index 0000000..1c5ee46 --- /dev/null +++ b/mod_equa.tm @@ -0,0 +1,91 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MOD_EQUA.MOD lists all the equations for each of the MODEL instances * +* a MODEL / / block will appear for each model supported * +*=============================================================================* + + MODEL TIMES_MACRO / + +$IFI %MERGE%==YES ALL /; +$IFI %MERGE%==YES $EXIT +*----------------------------------------------------------------------------- +* Objective Function & Components +*----------------------------------------------------------------------------- +* Overall OBJ linear combination of the regional objs (which are built from rest) + EQ_OBJ + +* Fixed Costs + EQ_ANNFIX + +* Investment component + EQ_ANNINV + +* Variable operating costs (including substitution loss in MLF) + EQ_ANNVAR + +*----------------------------------------------------------------------------- +* Core Equations +*----------------------------------------------------------------------------- +$ SET OBJANN NO +$ BATINCLUDE mod_equa.mod CORE +$ IF %MACRO%==Yes $GOTO MLF +*--------------------------------------------------------------------- +* MACRO equations +*--------------------------------------------------------------------- + EQ_UTIL + EQ_CONSO + EQ_DD + EQ_MCAP + EQ_TMC + EQ_IVECBND + EQ_ESCOST + EQ_MPEN + EQ_XCAPDB +$ EXIT +*--------------------------------------------------------------------- +$ LABEL MLF +$ IF %NONLP%==NL $GOTO NONLP +*--------------------------------------------------------------------- +* MACRO MLF equations +*--------------------------------------------------------------------- + EQ_UTILP + EQ_CONSO + EQ_CONDA + EQ_LOGBD + EQ_MACSH + EQ_MACAG + EQ_MACES + EQ_KNCAP + EQ_MCAP + EQ_TMC + EQ_IVECBND + EQ_DD + EQ_DEMSH + EQ_DEMAG + EQ_DEMCES + EQ_ENSCST + EQ_TRDBAL +* EQ_MPEN +* EQ_XCAPDB +$ EXIT +*--------------------------------------------------------------------- +$ LABEL NONLP +*--------------------------------------------------------------------- +* MACRO MLF NLP benchmark equations +*--------------------------------------------------------------------- + EQ_UTIL + EQ_PROD_Y + EQ_AKL + EQ_LABOR + EQ_KNCAP + EQ_MCAP + EQ_TMC + EQ_DD + EQ_IVECBND + EQ_DNLCES + EQ_ENSCST + EQ_TRDBAL +* End of MODEL statement now in maindrv.mod diff --git a/mod_ext.abs b/mod_ext.abs new file mode 100644 index 0000000..4811606 --- /dev/null +++ b/mod_ext.abs @@ -0,0 +1,28 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================* +* MOD_EQUA.ABS Ancillary Balancing Services equations +* called from MOD_EQUA.MOD +*==================================================================* +$IFI NOT %OBMAC%==YES $EXIT + EQ_BS00 + EQ_BS01 + EQ_BS02 + EQ_BS03 + EQ_BS04 + EQ_BS05 + EQ_BS07 + EQ_BS09 + EQ_BS10 + EQ_BS11 + EQ_BS18 + EQ_BS19 + EQ_BS22 + EQ_BS23 + EQ_BS24 + EQ_BS25 + EQ_BS26 + EQ_BS27 + EQ_BS28 diff --git a/mod_ext.cli b/mod_ext.cli new file mode 100644 index 0000000..4bc2f21 --- /dev/null +++ b/mod_ext.cli @@ -0,0 +1,13 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================* +* MOD_EXT.EXT EXTENSION EQUATIONS * +* called from MAINDRV.MOD * +*==================================================================* + %EQ%_CLITOT + %EQ%_CLICONC + %EQ%_CLITEMP + %EQ%_CLIBEOH + %EQ%_CLIMAX diff --git a/mod_ext.dsc b/mod_ext.dsc new file mode 100644 index 0000000..4f186a9 --- /dev/null +++ b/mod_ext.dsc @@ -0,0 +1,12 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================* +* MOD_EXT.EXT EXTENSION EQUATIONS * +* called from MAINDRV.MOD * +*==================================================================* +$IF NOT DEFINED PRC_DSCNCAP $EXIT + +%EQ%_DSCNCAP +%EQ%_DSCONE diff --git a/mod_ext.etl b/mod_ext.etl new file mode 100644 index 0000000..346797c --- /dev/null +++ b/mod_ext.etl @@ -0,0 +1,21 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================* +* MOD_EQUA.ETL Endogenous Technological learning equations * +* called from MOD_EQUA.MOD * +*==================================================================* + %EQ%_CUINV + %EQ%_CC + %EQ%_DEL + %EQ%_COS + %EQ%_LA1 + %EQ%_LA2 + %EQ%_EXPE1 + %EQ%_EXPE2 + %EQ%_IC1 + %EQ%_IC2 +* cluster + %EQ%_CLU + %EQ%_MRCLU diff --git a/mod_ext.ier b/mod_ext.ier new file mode 100644 index 0000000..f70e621 --- /dev/null +++ b/mod_ext.ier @@ -0,0 +1,18 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================* +* MOD_EXT.EXT EXTENSION EQUATIONS * +* called from MAINDRV.MOD * +*==================================================================* +EQE_MRKPRD +EQL_MRKPRD +EQG_MRKPRD +EQE_MRKCON +EQL_MRKCON +EQG_MRKCON +$IF %CHP_MODE%==YES EQL_CHPCON +$IF %CHP_MODE%==YES EQL_CHPBPT +$IF %CHP_MODE%==YES EQE_CHPCON +$IF %CHP_MODE%==YES EQE_CHPBPT diff --git a/mod_ext.vda b/mod_ext.vda new file mode 100644 index 0000000..d55596b --- /dev/null +++ b/mod_ext.vda @@ -0,0 +1,52 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================* +* MOD_EXT.EXT Extension equations +* Called from MAINDRV.MOD +*============================================================================* + + %EQ%E_ACTEFF + %EQ%L_CAFLAC + %EQ%E_CAFLAC + %EQ%L_CAPFLO + + %EQ%_CAPLOAD + %EQ%_ACTRAMP + %EQ%E_ACTUPS + %EQ%L_ACTUPS + %EQ%L_ACTUPC + %EQ%_ACTPL + %EQ%_ACTRMPC + %EQ%_SLSIFT + EQL_STGCCL + + %EQ%E_UCRTP + %EQ%N_UCRTP + %EQ%N_UCRTC + + %EQ%E_ASHAR + %EQ%L_ASHAR + %EQ%G_ASHAR + +$IF %OBMAC%==YES + eq_sdlogic, eq_sudupt, eq_sdslant, eq_sdminon, eq_sudload, eq_sudtime, eq_sudpll + +$IFI %DUC%%OBMAC%==YESYES + eq_sdind_1, eq_sdind_0 + +$IF DEFINED UC_FLOBET + %EQ%G_UCMAX, %EQ%G_UCSUMAX + +$IF DEFINED COM_CSTBAL + EQ_OBJBAL + +$IFI %POWERFLO%==YES + %EQ%_GR_POWFLO, %EQ%_GR_GENALL, %EQ%_GR_DEMALL, %EQ%_GR_XBND + +$IF DEFINED GR_VARGEN + %EQ%_RL_LOAD, %EQ%_RL_NDIS, %EQ%_RL_STCAP, %EQ%_RL_PKCAP, %EQ%_RL_THMIN + +$IF DEFINED RTC_MS +$IF %ECB%==YES %EQ%_MSNCAP, %EQ%_MSNCAPB diff --git a/mod_vars.abs b/mod_vars.abs new file mode 100644 index 0000000..0340c7e --- /dev/null +++ b/mod_vars.abs @@ -0,0 +1,54 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================* +* MOD_VARS.EXT EXTENSION VARIABLES +* called from MAINDRV.MOD +*==================================================================* + + POSITIVE VARIABLES + %VAR%_COMLV(CLVT,R,YEAR,C,S%SWD%) Commodity levels + %VAR%_BSPRS(R,YEAR,T,P,C,S,L%SWD%) Balancing services // + %VAR%_RLD(R,T,S,ITEM%SWD%) Reserve-defining load levels + ; + + EQUATIONS + EQ_BS00(R,T,C,S,ALLSOW) Overall demands for balancing services + EQ_BS01(R,YEAR,C,S,ITEM,L,ALLSOW) Max and Diff over stochastic & determistic demand + EQ_BS02(R,T,S,ITEM,ALLSOW) Load levels by process category + EQ_BS03(R,T,C,S,ALLSOW) Stochastic demand for balancing services + EQ_BS04(R,T,C,S,P,ALLSOW) Deterministic demand for balancing services + EQ_BS05(R,YEAR,T,P,TSL,L,S,ALLSOW) Minimum online - offline times + EQ_BS07(R,YEAR,T,P,S,BD,ALLSOW) Ramping constraints + EQ_BS09(R,YEAR,T,P,S,L,ALLSOW) Capacity margin constraints - positive + EQ_BS10(R,YEAR,T,P,S,ALLSOW) Capacity margin constraints - negative + EQ_BS11(R,YEAR,T,P,C,S,BD,ALLSOW) Limits for spinning reserve by type + EQ_BS18(R,YEAR,T,P,S,BD,ALLSOW) Lower limits for non-spinning reserve by type + EQ_BS19(R,YEAR,T,P,C,S,BD,ALLSOW) Upper limits for non-spinning reserve by type + EQ_BS22(R,YEAR,T,P,S,ALLSOW) Limit for positive reserve from storage + EQ_BS23(R,YEAR,T,P,S,ALLSOW) Limit for negative reserve from storage + EQ_BS24(R,YEAR,T,P,S,ALLSOW) Limits for negative reserve from end-use + EQ_BS25(R,YEAR,T,P,S,ALLSOW) Limits for positive reserve from end-use + EQ_BS26(R,T,P,C,S,ALLSOW) Bounds for process reserves + EQ_BS27(R,YEAR,T,P,S,ALLSOW) Maintenance 1 + EQ_BS28(R,YEAR,T,P,S,ALLSOW) Maintenance 2 + ; + +* Set minimum exogenous demand + BS_CAPACT(R)$(NOT BS_CAPACT(R)) = MAX(0,SMAX(RP_STD(R,P)$GR_GENMAP(R,P,'SI'),PRC_CAPACT(R,P))); + BS_CAPACT(R)$(NOT BS_CAPACT(R)) = MAX(0,SMAX(BS_SUPP(RP_STD(R,P)),PRC_CAPACT(R,P))); + %VAR%_COMLV.LO('DET',RTCS_VARC(R,T,C,S)%SOW%) $= BS_RTCS('EXOGEN',R,T,C,S)*BS_CAPACT(R); + RPT_OPT('RATE','1')$(RPT_OPT('RATE','1')<=0)=SMAX(R,BS_CAPACT(R))$(RPT_OPT('RATE','1')=0); + +* Set bounds on reserve flows + BS_BNDPRS(RTP,C,S,BDNEQ)$=BS_BNDPRS(RTP,C,S,'FX'); + BS_BNDPRS(RTP,C,S,'N')$SUM(BDNEQ$BS_BNDPRS(RTP,C,S,BDNEQ),1) = 1; + LOOP((L(BDUPX),BD)$(BDSIG(L)*BDSIG(BD)<0), + %var%_bsprs.LO(r,t,t,p,c,s,l%SOW%)$(RTP(R,T,P)$BS_COMTS(R,C,S)) $= BS_BNDPRS(R,T,P,C,S,BD); + %var%_bsprs.UP(r,t,t,p,c,s,l%SOW%)$(RTP(R,T,P)$BS_COMTS(R,C,S)) $= BS_BNDPRS(R,T,P,C,S,L)); + +$IFI NOT %OBMAC%==YES $EXIT +* Spines macros +$ macro Z_COMLV VAS_COMLV +$ macro Z_BSPRS VAS_BSPRS diff --git a/mod_vars.cli b/mod_vars.cli new file mode 100644 index 0000000..a39bb8f --- /dev/null +++ b/mod_vars.cli @@ -0,0 +1,26 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MOD_VARS.CLI lists the individual variables of CLI instances of the MODEL * +*=============================================================================* +* Comments: For convenience, equations are declared here as well +*----------------------------------------------------------------------------- +POSITIVE VARIABLES + %VAR%_CLITOT(CM_VAR,LL %SWD%) 'Total emissions or forcing by milestone year' + %VAR%_CLIBOX(CM_VAR,LL %SWD%) 'Quantities in the climate reservoirs' +; +*----------------------------------------------------------------------------- +EQUATIONS + %EQ%_CLITOT(CM_VAR,T,LL %SWD%) 'Balances for the total emissions or forcing' + %EQ%_CLICONC(CM_VAR,CM_BOX,T %SWD%) 'Balances for the concentration in the reservoirs' + %EQ%_CLITEMP(CM_VAR,CM_BOX,T %SWD%) 'Balances for the temperature in the reservoirs' + %EQ%_CLIBEOH(CM_VAR,CM_BOX,T,LL %SWD%) 'Balances for the quantities in the BEOH reservoirs' + %EQ%_CLIMAX(ALLYEAR,CM_VAR %SWD%) 'Constraint for maximum climate quantities' +; +OPTION CLEAR=%EQ%_CLITOT; +*----------------------------------------------------------------------------- +* Allow some negative emissions + %VAR%_CLITOT.LO(CM_VAR,LL %SOW%)$CM_LED(LL) = MIN(-15,CM_BEMI(CM_VAR,LL)); + %VAR%_CLITOT.LO(CM_VAR('FORCING'),LL%SOW%)$CM_LED(LL) = -2; \ No newline at end of file diff --git a/mod_vars.dsc b/mod_vars.dsc new file mode 100644 index 0000000..97bdbe4 --- /dev/null +++ b/mod_vars.dsc @@ -0,0 +1,19 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MOD_VARS.EXT EXTENSION VARIABLES +* called from MAINDRV.MOD +*=============================================================================* +*-----------------------------------------------------------------------------* +* Discrete capacity extensions +*-----------------------------------------------------------------------------* +* Investments +$SETGLOBAL SEMICONT SEMICONT +SOS1 VARIABLE %VAR%_DNCAP(R,ALLYEAR,P%SWD%,UNIT); +%SEMICONT% VARIABLE %VAR%_SNCAP(R,ALLYEAR,P%SWD%); + +* Bounds for semicont +%VAR%_SNCAP.LO(R,T,P%SOW%) $= NCAP_SEMI(R,T,P); +%VAR%_SNCAP.UP(R,T,P%SOW%)$NCAP_SEMI(R,T,P) = MAX(NCAP_SEMI(R,T,P),NCAP_BND(R,T,P,'UP')); \ No newline at end of file diff --git a/mod_vars.etl b/mod_vars.etl new file mode 100644 index 0000000..48a9558 --- /dev/null +++ b/mod_vars.etl @@ -0,0 +1,39 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MOD_VARS.ETL endogenous technology change variables +*=============================================================================* +* %1 - source code extension +*----------------------------------------------------------------------------- +* VARIABLES +*----------------------------------------------------------------------------- +POSITIVE VARIABLES + %VAR%_LAMBD(R,ALLYEAR, PRC, KP %SWD%) + %VAR%_CCAP(R,ALLYEAR,PRC %SWD%) + %VAR%_CCOST(R,ALLYEAR,PRC %SWD%) + %VAR%_IC(R,ALLYEAR,PRC %SWD%) + +BINARY VARIABLES + %VAR%_DELTA(R,ALLYEAR,PRC,KP %SWD%) + +*----------------------------------------------------------------------------- +* EQUATIONS +*----------------------------------------------------------------------------- +EQUATIONS + %EQ%_CUINV(R,ALLYEAR, PRC %SWTD%) Cumulative Capacity Definition + %EQ%_CC(R,ALLYEAR, PRC %SWTD%) Cumulative Capacity Interpolation + %EQ%_DEL(R,ALLYEAR, PRC %SWTD%) Delta to 1 + %EQ%_COS(R,ALLYEAR, PRC %SWTD%) Cumulative Cost + %EQ%_LA1(R,ALLYEAR, PRC, KP %SWTD%) Constraints on lambda 1 + %EQ%_LA2(R,ALLYEAR, PRC, KP %SWTD%) Constraints on lambda 2 + %EQ%_EXPE1(R,ALLYEAR, PRC, KP %SWTD%) Experience grows 1 + %EQ%_EXPE2(R,ALLYEAR, PRC, KP %SWTD%) Experience grows 2 + %EQ%_IC1(R,ALLYEAR, PRC %SWTD%) Investments tech. change 1st period + %EQ%_IC2(R,ALLYEAR, PRC %SWTD%) Investments tech. change other periods +* cluster + %EQ%_CLU(R,ALLYEAR, PRC %SWTD%) Cluster + %EQ%_MRCLU(R,ALLYEAR, PRC %SWTD%) Multi-regional Cluster +; + diff --git a/mod_vars.mod b/mod_vars.mod new file mode 100644 index 0000000..8fc957c --- /dev/null +++ b/mod_vars.mod @@ -0,0 +1,96 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MOD_VARS.MOD lists the individual variables of all instances of the MODEL * +*=============================================================================* +* Questions/Comments: +* - +*----------------------------------------------------------------------------- +* Set of standard objective components + SET OBV / OBJINV, OBJFIX, OBJSAL, OBJVAR /; + +*----------------------------------------------------------------------------- + POSITIVE VARIABLES +*----------------------------------------------------------------------------- +* Process-related variables +*----------------------------------------------------------------------------- + %VAR%_ACT(R,ALLYEAR,ALLYEAR,P,S %SWD%) Overall activity of a process + %VAR%_CAP(R,ALLYEAR,P %SWD%) Installed capacity of a process + %VAR%_FLO(R,ALLYEAR,ALLYEAR,P,C,S %SWD%) Level of process commodity flow + %VAR%_IRE(R,ALLYEAR,ALLYEAR,P,C,S,IE %SWD%) Inter-regional trade flow + %VAR%_NCAP(R,ALLYEAR,P %SWD%) New capacity of a process + +*----------------------------------------------------------------------------- +* Commodity-related variables +*----------------------------------------------------------------------------- + %VAR%_COMNET(R,ALLYEAR,C,S %SWD%) Net commodity level + %VAR%_COMPRD(R,ALLYEAR,C,S %SWD%) Production of commodity + %VAR%_ELAST(R,ALLYEAR,C,S,J,BD %SWD%) Demand change due to price elasticity + %VAR%_DEM(R,MILESTONYR,C %SWD%) Demand variable for MACRO + +*----------------------------------------------------------------------------- +* Cumulative variables +*----------------------------------------------------------------------------- + %VAR%_CUMCOM(R,C,COM_VAR,ALLYEAR,ALLYEAR %SWD%) Cumulative commodity PRD or NET + %VAR%_CUMFLO(R,P,C,ALLYEAR,ALLYEAR %SWD%) Cumulative process flow + %VAR%_CUMCST(R,ALLYEAR,ALLYEAR,COSTAGG,CUR %SWD%) Cumulative regional cost + +*----------------------------------------------------------------------------- +* Storage variables +*----------------------------------------------------------------------------- + %VAR%_SIN(R,ALLYEAR,ALLYEAR,P,C,S %SWD%) Input flow into storage + %VAR%_SOUT(R,ALLYEAR,ALLYEAR,P,C,S %SWD%) Output flow from storage + +*----------------------------------------------------------------------------- +* Additional features +*----------------------------------------------------------------------------- + %VAR%_BLND(R,ALLYEAR,COM,COM %SWD%) Refinery blending + %VAR%_DAM(R,T,C,BD,J %SWD%) Damage variables + %VAR%_RCAP(R,ALLYEAR,LL,P %SWD%) New retirements + %VAR%_SCAP(R,ALLYEAR,LL,P %SWD%) Cumulative retirements + %VAR%_UPS(R,ALLYEAR,ALLYEAR,P,S,L %SWD%) Start-ups + %VAR%_UPT(R,ALLYEAR,ALLYEAR,P,S,UPT%SWD%) Start-ups by type + %VAR%_UDP(R,ALLYEAR,ALLYEAR,P,S,L %SWD%) Unit dispatching + %VAR%_RLD(R,T,S,ITEM %SWD%) Residual loads + +*=============================================================================* +* Objective Function Components +* - investment cost + tax/sub + decommissioning in INV +* - fixed O&M + fixed tax/sub in FIX +* - variable O&M + commodity direct costs +* - salvage +*=============================================================================* + %VAR%_OBJ(R,OBV,CUR %SWD%) "Objective costs INV,SAL,FIX,VAR,DAM" + %VAR%_OBJELS(R,BD,CUR %SWD%) "Change in Consumer surplus" + VAS_UPDEV(ALLSOW) "Upside deviation of OBJ" + + + VARIABLES +*=============================================================================* +* Objective Function Variables +* - total discounted system cost +*=============================================================================* + + OBJz + VAS_EXPOBJ Expected value of total OBJ + +*----------------------------------------------------------------------------- +* Slack variables of user-constraints +*----------------------------------------------------------------------------- + %VAR%_UC(UC_N %SWD%) Slacks for UC constraints + %VAR%_UCR(UC_N,R %SWD%) Slacks for UCR constraints + %VAR%_UCT(UC_N,T %SWD%) Slacks for UCT constraints + %VAR%_UCRT(UC_N,R,T %SWD%) Slacks for UCRT constraints + %VAR%_UCTS(UC_N,T,S %SWD%) Slacks for UCTS constraints + %VAR%_UCRTS(UC_N,R,T,S %SWD%) Slacks for UCRTS constraints + ; + +*----------------------------------------------------------------------------- +* Other variables in model extensions +*----------------------------------------------------------------------------- +* [AL] ETL variables automatically by extension manager +$IF DECLARED VNRET $BATINCLUDE prepret.dsc DECL +$IF DEFINED PRC_REACT $BATINCLUDE powerflo.vda DECL +$IF NOT DEFINED VAR_STS PARAMETER VAR_STS(R,YEAR,T,P,S,L) //; \ No newline at end of file diff --git a/mod_vars.msa b/mod_vars.msa new file mode 100644 index 0000000..fd45282 --- /dev/null +++ b/mod_vars.msa @@ -0,0 +1,34 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================* +* MOD_VARS.MSA Variable declarations for MACRO Stand-Alone +*============================================================================* +$ BATINCLUDE preppm.msa MSA +*---------------------------------------------------------------------------- +* MACRO Related Variables + +POSITIVE VARIABLES + VAR_K(REG,T) total capital stock + VAR_D(REG,T,COM) annual energy demands - before aeei adjustments + VAR_INV(REG,T) annual investments + VAR_EC(REG,T) annual energy cost + VAR_SP(REG,T,COM) artificial variable for scaling shadow price of demand + VAR_Y(REG,T) annual economy output (production) + VAR_C(REG,T) annual consumption + VAR_DEM(REG,T,COM) Decoupled demands used in the energy model + VAR_CDM(R,ITEM,LL) climate change damage + +* Objective Function Value + +VARIABLES + VAR_UTIL discounted log of consumption + VAR_NTX(R,T,ITEM) trade (exports positive) +; +OPTION CLEAR=VAR_NTX; +VAR_CDM.LO(R,'N',XTP) = .01; + +* Enable MACRO discount rates if requested +$IF DEFINED TM_UDF $SETGLOBAL OBJANN YES +$IF NOT DEFINED TM_UDF OPTION CLEAR=TM_UDF; diff --git a/mod_vars.tm b/mod_vars.tm new file mode 100644 index 0000000..c973679 --- /dev/null +++ b/mod_vars.tm @@ -0,0 +1,57 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* MOD_VARS.MOD lists the individual variables of all instances of the MODEL +*=============================================================================* +* Questions/Comments: +* - no need to add SOW-index to variables under MACRO +*----------------------------------------------------------------------------- + +* Include declarations for all variables in standard TIMES +$ INCLUDE mod_vars.mod + + SET OBVANN(OBV) / OBJINV, OBJFIX, OBJVAR /; + +* Activate demand variables + RD_NLP(DEM) = 1; + + POSITIVE VARIABLES + +*-----------------------------------------------------------------------------* +* MACRO Interface Variables +* - Annual Cost Components: investment, fixed, variable costs +* - Annual Demands +*-----------------------------------------------------------------------------* + VAR_ANNCST(OBV,R,ALLYEAR,CUR) Annualized costs + VAR_DEM(R,MILESTONYR,C) Annual useful demand + +*-----------------------------------------------------------------------------* +* MACRO variables +*-----------------------------------------------------------------------------* + VAR_EC(R,ALLYEAR) 'Annual energy costs in MACRO' + VAR_C(R,T) 'Annual consumption in MACRO' + VAR_Y(R,T) 'Annual production in MACRO' + VAR_K(R,T) 'Total capital' + VAR_INV(R,T) 'Annual investments in MACRO' + VAR_D(R,T,CG) 'Annual useful demand in MACRO' + VAR_SP(R,T,CG) 'Artificial variable for scaling shadow price' + VAR_OBJCOST(R,ALLYEAR) 'Annual energy costs in TIMES' + VAR_XCAP(R,YEAR,ITEM) 'Market penetration bounds - total new capacity' + VAR_XCAPP(R,YEAR,P,J) 'Market penetration bounds - additional capacity' + VAR_MELA(R,T,CG,J,BD) 'Step variables for elasticities' + ; + + + VARIABLES + +*-----------------------------------------------------------------------------* +* MACRO variables +*-----------------------------------------------------------------------------* + VAR_UTIL Total utility + VAR_NTX(R,T) Trade in numeraire + ; + + VAR_ANNCST.LO(OBV(UCN),R,T,CUR)$(RDCUR(R,CUR)$UC_RHS(UCN,'N')) = INF; + VAR_ANNCST.LO(OBV(UCN),R,T,CUR)$(RDCUR(R,CUR)$UC_RHSR(R,UCN,'N')) = INF; \ No newline at end of file diff --git a/par_uc.rpt b/par_uc.rpt new file mode 100644 index 0000000..c6ecfbe --- /dev/null +++ b/par_uc.rpt @@ -0,0 +1,20 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==================================================================== +* Par_uc.rpt : reporting parameters for UC (no STAGES/SENSIS) +* %1 - parameter suffix +* %2 - equation prefix +*-------------------------------------------------------------------- + LOOP(UC_TSL(R,UC_N,'LHS',TSL),%2_UCRTS.M(UC_N,R,T,S) $= %2_UCRS.M(R,UC_N,T,TSL,S)); + %3PAR_UC%1(%4UC_N,'NONE','NONE','NONE') $= %2_UC.M(UC_N); + %3PAR_UC%1(%4UC_N,R,'NONE','NONE') $= %2_UCR.M(UC_N,R); + %3PAR_UC%1(%4UC_N,'NONE',T,'NONE') $= %2_UCT.M(UC_N,T); + %3PAR_UC%1(%4UC_N,R,T,'NONE') $= %2_UCRT.M(UC_N,R,T)*(1/COEF_PVT(R,T)); + %3PAR_UC%1(%4UC_N,'NONE',T,S) $= %2_UCTS.M(UC_N,T,S); + %3PAR_UC%1(%4UC_N,R,T,S) $= %2_UCRTS.M(UC_N,R,T,S)*(1/COEF_PVT(R,T)); + %3PAR_UC%1(%4UC_N,'NONE',T,'NONE') $= %2_UCSU.M(UC_N,T); + %3PAR_UC%1(%4UC_N,'NONE',T,S) $= %2_UCSUS.M(UC_N,T,S); + %3PAR_UC%1(%4UC_N,R,T,'NONE') $= %2_UCRSU.M(UC_N,R,T)*(1/COEF_PVT(R,T)); + %3PAR_UC%1(%4UC_N,R,T,S) $= %2_UCRSUS.M(UC_N,R,T,S)*(1/COEF_PVT(R,T)); diff --git a/pextlevs.stc b/pextlevs.stc new file mode 100644 index 0000000..6065f82 --- /dev/null +++ b/pextlevs.stc @@ -0,0 +1,63 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PEXTLEVS.stc: Get the expected values +* %1 - SOW control +* %2 - Period control +*=============================================================================* +* Clear results from previous +$ BATINCLUDE clearsol.stc +*--------------------------------------------------------------------- +* Get the sum of weighted Marginals + EQG_COMBAL.M(R,T%2,C,S) $= SUM(SW_T(T,W), %EQ%G_COMBAL.M(R,T,C,S,T,W)); + EQE_COMBAL.M(R,T%2,C,S) $= SUM(SW_T(T,W), %EQ%E_COMBAL.M(R,T,C,S,T,W)); + EQE_COMPRD.M(R,T%2,C,S) $= SUM(SW_T(T,W), %EQ%E_COMPRD.M(R,T,C,S,T,W)); + EQ_PEAK.M(R,T%2,CG,S) $= SUM(SW_T(T,W), %EQ%_PEAK.M(R,T,CG,S,T,W)); + EQ_IRE.M(R,T%2,P,C,IE,S) $= SUM(SW_T(T,W), %EQ%_IRE.M(R,T,P,C,IE,S,T,W)); + EQE_CPT.M(R,T%2,P) $= SUM(SW_T(T,%1), %EQ%E_CPT.M(R,T,P,T,%1)); + EQN_UCRTP.M(UC_N,R,T%2,P,UC_GRPTYPE,BD('FX')) $= SUM(SW_T(T,W), %EQ%E_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)); + EQN_UCRTP.M(UC_N,R,T%2,P,UC_GRPTYPE,BDNEQ(BD)) $= SUM(SW_T(T,W), %EQ%N_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)); + +* Get the expected Levels + VAR_ACT.L(R,V,T%2,P,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_ACT.L(R,V,T,P,S,W)); + VAR_BLND.L(R,T%2,COM,C) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_BLND.L(R,T,COM,C,W)); + VAR_COMNET.L(R,T%2,COM,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_COMNET.L(R,T,COM,S,W)); + VAR_COMPRD.L(R,T%2,COM,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_COMPRD.L(R,T,COM,S,W)); + VAR_IRE.L(R,V,T%2,P,C,S,IE) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_IRE.L(R,V,T,P,C,S,IE,W)); + VAR_ELAST.L(R,T%2,C,S,J,BD) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_ELAST.L(R,T,C,S,J,BD,W)); + VAR_FLO.L(R,V,T%2,P,C,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_FLO.L(R,V,T,P,C,S,W)); + VAR_SIN.L(R,V,T%2,P,C,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_SIN.L(R,V,T,P,C,S,W)); + VAR_SOUT.L(R,V,T%2,P,C,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_SOUT.L(R,V,T,P,C,S,W)); + VAR_UPS.L(R,V,T%2,P,S,L) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UPS.L(R,V,T,P,S,L,W)); + VAR_CUMCOM.L(R,C,COM_VAR,YEAR,LL)$RC_CUMCOM(R,COM_VAR,YEAR,LL,C) $= SUM(W, SW_PROB(W)*%VAR%_CUMCOM.L(R,C,COM_VAR,YEAR,LL,W)); + VAR_CUMFLO.L(RPC,YEAR,LL)$RPC_CUMFLO(RPC,YEAR,LL) $= SUM(W, SW_PROB(W)*%VAR%_CUMFLO.L(RPC,YEAR,LL,W)); +$IF DEFINED %VAR%_DAM VAR_DAM.L(R,T%2,C,BD,J) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_DAM.L(R,T,C,BD,J,W)); +$IF %TIMESED% == YES VAR_OBJELS.L(R,BD,CUR) $= SUM(W, SW_PROB(W)*%VAR%_OBJELS.L(R,BD,CUR,W)); + VAR_CAP.L(R,T%2,P) $= SUM(SW_T(T,SOW), SW_TPROB(T,SOW)*%VAR%_CAP.L(R,T,P,%1)); + VAR_NCAP.L(R,T%2,P) $= SUM(SW_T(T,SOW), SW_TPROB(T,SOW)*%VAR%_NCAP.L(R,T,P,%1)); + VAR_SCAP.L(R,V,T%2,P) $= SUM(SW_T(T,SOW), SW_TPROB(T,SOW)*%VAR%_SCAP.L(R,V,T,P,%1)); + + VAR_UC.L(UC_N) $= SUM(W, SW_PROB(W)*%VAR%_UC.L(UC_N,W)); + VAR_UCR.L(UC_N,R) $= SUM(W, SW_PROB(W)*%VAR%_UCR.L(UC_N,R,W)); + VAR_UCT.L(UC_N,T) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCT.L(UC_N,T,W)); + VAR_UCRT.L(UC_N,R,T) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCRT.L(UC_N,R,T,W)); + VAR_UCTS.L(UC_N,T,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCTS.L(UC_N,T,S,W)); + VAR_UCRTS.L(UC_N,R,T,S) $= SUM(SW_T(T,W), SW_TPROB(T,W)*%VAR%_UCRTS.L(UC_N,R,T,S,W)); + VAR_OBJ.L(R,OBV,CUR) $= SUM(W, SW_PROB(W)*%VAR%_OBJ.L(R,OBV,CUR,W)); + +* Get the sum of weighted Marginals + VAR_ACT.M(R,V,T%2,P,S) $= SUM(SW_T(T,W), %VAR%_ACT.M(R,V,T,P,S,W)); + VAR_COMNET.M(R,T%2,COM,S) $= SUM(SW_T(T,W), %VAR%_COMNET.M(R,T,COM,S,W)); + VAR_COMPRD.M(R,T%2,COM,S) $= SUM(SW_T(T,W), %VAR%_COMPRD.M(R,T,COM,S,W)); + VAR_CUMFLO.M(R,P,C,YEAR,LL) $= SUM(W, %VAR%_CUMFLO.M(R,P,C,YEAR,LL,W)); + VAR_CAP.M(R,T%2,P) $= SUM(SW_T(T,%1), %VAR%_CAP.M(R,T,P,%1)); + VAR_NCAP.M(R,T%2,P) $= SUM(SW_T(T,%1), %VAR%_NCAP.M(R,T,P,%1)); + + VAR_UC.M(UC_N) $= SUM(W, %VAR%_UC.M(UC_N,W)); + VAR_UCR.M(UC_N,R) $= SUM(W, %VAR%_UCR.M(UC_N,R,W)); + VAR_UCT.M(UC_N,T) $= SUM(SW_T(T,W), %VAR%_UCT.M(UC_N,T,W)); + VAR_UCRT.M(UC_N,R,T) $= SUM(SW_T(T,W), %VAR%_UCRT.M(UC_N,R,T,W)); + VAR_UCTS.M(UC_N,T,S) $= SUM(SW_T(T,W), %VAR%_UCTS.M(UC_N,T,S,W)); + VAR_UCRTS.M(UC_N,R,T,S) $= SUM(SW_T(T,W), %VAR%_UCRTS.M(UC_N,R,T,S,W)); diff --git a/powerflo.vda b/powerflo.vda new file mode 100644 index 0000000..213f85e --- /dev/null +++ b/powerflo.vda @@ -0,0 +1,334 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* Powerflo - define powerflo equations and nodal balance costs +*=============================================================================* +$SET MX %3 +$IF NOT '%1'=='' $GOTO %1%2%3 +*----------------------------------------------------------------------------- +* Declarations + SET RP_GRID(R,P); + SET RC_GRID(R,T,C); + SET GR_TOP(ALL_R,C,ALL_R,C,P); + SET GR_ARC(ALL_REG,C,ALL_REG,C); + SET GR_GRID(J,R,C); + SET GR_ALLMAP(R,CG,COM); + SET GR_PRCMAP(R,P,C,ITEM); + SET GR_DEMMAP(R,C,COM); + SET GR_ALGMAP(R,CG,CG); + SET GR_ENDC(R,CG); + SET GR_GENP(R,P); + PARAMETER GR_SUS(ALL_REG,T,C,ALL_REG,C); + PARAMETER GR_FLOW(R,P,C); + PARAMETER GR_GID(R,C); + PARAMETER GR_ADMIT(ALL_REG,T,C,ALL_REG,C); + PARAMETER GR_UNITS(R,T,ITEM); + +* Define grid and default line directions + OPTION TRACKP < PRC_REACT; TRACKC(R,C) $= NRG_TMAP(R,'ELC',C); + GR_TOP(TOP_IRE(R,C,TRACKC(REG,COM),P))$(TRACKC(R,C)$TRACKP(R,P)) = YES; + GR_TOP(TOP_IRE(TRACKC(REG,COM),R,C,P))$(TRACKC(R,C)$TRACKP(R,P)) = YES; + LOOP(GR_TOP(R,C,REG,COM,P),GR_FLOW(R,P,C)=1; GR_FLOW(REG,P,COM)=-1); + OPTION CLEAR=TRACKP; + GR_TOP(R,C,REG,COM,P)$(GR_FLOW(R,P,C) GT 0) = NO; + GR_TOP(R,C,R,C,P) = NO; + LOOP(GR_TOP(R,C,R,COM,P)$(SUM(RPC_IRE(R,P,C,IE)$RPC_IRE(R,P,COM,IE),1)=2),PRC_MAP(R,'DISTR',P)=YES); + +* Synchronize and check for zero line reactances + LOOP(GR_TOP(R,C,REG,COM,P)$(NOT SAMEAS(R,REG)), + RTP_VARA(RTP(R,T,P))$(NOT RTP_VARA(REG,T,P)) = NO; + PRC_REACT(R,T,P) = MAX(PRC_REACT(R,T,P),PRC_REACT(REG,T,P))); + PRC_REACT(R,T,P)$((PRC_REACT(R,T,P) LE 0)$PRC_REACT(R,T,P)) = 0; + LOOP(GR_TOP(R,C,REG,COM,P), GR_ARC(R,C,REG,COM) = YES); + OPTION RP_GRID < GR_FLOW; OPTION RREG <= GR_ARC; OPTION TRACKC < GR_FLOW; + +* Internodal admittance + GR_ADMIT(R,T,C,REG,COM)$GR_ARC(R,C,REG,COM) = SUM(GR_TOP(R,C,REG,COM,P)$(PRC_REACT(R,T,P)$RTP_VARA(R,T,P)),1/PRC_REACT(R,T,P)); + OPTION GR_ARC <= GR_ADMIT; + +* Construct all disjoint grids + CNT = EPS; OPTION CLEAR=GR_GID; + LOOP(GR_ARC(R,C,REG,COM), F = GR_GID(R,C); Z = GR_GID(REG,COM); + IF(NOT F+Z, GR_GID(R,C)=CNT; GR_GID(REG,COM)=CNT; CNT=CNT+1; + ELSEIF NOT F, GR_GID(R,C)=Z; + ELSEIF NOT Z, GR_GID(REG,COM)=F; + ELSEIF F NE Z, MY_F=MIN(F,Z); DONE=MAX(F,Z); IF(CNT=DONE+1,CNT=DONE); + GR_GID(TRACKC)$(GR_GID(TRACKC)=DONE) = MY_F)); +* Assign each node with unique grid ID + LOOP(SAMEAS('1',J),GR_GRID(J+GR_GID(R,C),TRACKC(R,C)) = YES); + +* QA checks + LOOP((R,TSLVL('DAYNITE')), Z=0; + IF(SUM(RP_GRID(R,P)$(NOT PRC_TSL(R,P,TSLVL)),1), Z=1); + IF(SUM(TRACKC(R,C)$(NOT COM_TSL(R,C,TSLVL)),1), Z=1); + LOOP(RREG(R,REG), + IF(SUM(S$(TS_GROUP(R,TSLVL,S) XOR TS_GROUP(REG,TSLVL,S)),1), + RP_GRID(REG,P)=NO; TRACKC(REG,C)=NO; Z = 1)); + IF(Z, RP_GRID(R,P) = NO; TRACKC(R,C) = NO)); + RC_GRID(RTC(R,T,C))$TRACKC(R,C) = YES; + +* Admittance / susceptance matrix + option gr_sus < gr_admit; + gr_sus(rc_grid,rc) $= gr_admit(rc_grid,rc)*(-1); + gr_sus(rc_grid(r,t,c),r,c) = -sum(trackc(rc),gr_sus(rc_grid,rc)); + +* Check nodal commodity balances + COM_BNDNET(RTCS_VARC(RC_GRID(R,T,C),S),'LO') = EPS; + COM_LIM(TRACKC(RC),'FX')$(NOT SUM(COM_LIM(RC,L),1)) = YES; + +*------------------------------------------------------------------------ +* levelization +$ BATINCLUDE pp_lvlfc.mod GR_DEMFR C COM_TS '' ",'0','0','0','0'" ALL_TS T RTC(R,T,C) +* Grid allocations + GR_ENDFR(R,T,COM,C)$TRACKC(R,C) = 0; + OPTION GR_ENDC < GR_ENDFR; + GR_GENLEV(TRACKC) = 0; + GR_GENLEV(R,C)$GR_GENLEV(R,C) = ROUND(GR_GENLEV(R,C)); + GR_ALGMAP(R,'NRG',C)$((GR_GENLEV(R,C)=1)$GR_GENLEV(R,C))=YES; + GR_ALGMAP(R,C,C)$((GR_GENLEV(R,C)=2)$GR_GENLEV(R,C))=YES; + GR_ALGMAP(R,COM_TYPE(CG),CG)$(SUM(TRACKC(R,C),1)>1) $= SUM(GR_ALGMAP(R,CG,C),1); + GR_ALLMAP(TRACKC(R,C),COM)$GR_GENLEV(R,COM) = YES; + GR_DEMMAP(GR_ALLMAP(R,C,COM))$(GR_GENLEV(R,COM) < 3) = YES; + IF(CARD(GR_DEMFR),GR_DEMFR(RTCS_VARC(RC_GRID(R,T,C),S)) = GR_DEMFR(R,T,C,S)+EPS); + OPTION GR_GENP < GR_GENMAP; + GR_ENDC(R,'DEM')$SUM(GR_ENDC(R,C),1) = YES; +* Process regions with sectoral demand fractions + LOOP(R$GR_ENDC(R,'DEM'), + GR_DEMFR(RTCS_VARC(RC_GRID(R,T,C),S)) = SUM(GR_ENDC(R,COM),MIN(0.33,GR_ENDFR(R,T,C,COM))); + GR_UNITS(RTC(R,T,COM))$GR_ENDC(R,COM) = SUM(RC_GRID(R,T,C),GR_ENDFR(R,T,C,COM))+1-1; + GR_ENDFR(RC_GRID(R,T,C),COM)$GR_UNITS(R,T,COM) = GR_ENDFR(R,T,C,COM)/GR_UNITS(R,T,COM); + OPTION CLEAR=GR_UNITS; + ); + GR_ENDC(R,C)$((GR_GENLEV(R,C)>2)$GR_GENLEV(R,C)) = YES; + GR_ENDC(R,'NRG')$(NOT GR_ENDC(R,'DEM')) = YES; +* Genmap normalization + PRC_YMAX(GR_GENP(R,P)) = SUM(ITEM$GR_GENMAP(R,P,ITEM),GR_GENMAP(R,P,ITEM))+1-1; + GR_GENMAP(GR_GENP(R,P),ITEM)$(PRC_YMAX(R,P)$GR_GENMAP(R,P,ITEM)) = GR_GENMAP(R,P,ITEM)/PRC_YMAX(R,P); +* GENFR normalization + LOOP(RC_GRID(R,T,C),GR_UNITS(R,T,ITEM)$GR_GENFR(R,T,C,ITEM)=1); + GR_UNITS(R,T,ITEM)$GR_UNITS(R,T,ITEM) = SUM(TRACKC(R,C),GR_GENFR(R,T,C,ITEM))+1-1; + GR_GENFR(RC_GRID(R,T,C),ITEM)$GR_UNITS(R,T,ITEM) = GR_GENFR(R,T,C,ITEM)/GR_UNITS(R,T,ITEM); + OPTION CLEAR=PRC_YMAX,CLEAR=GR_UNITS; +* DEMFR normalization + LOOP(RC_GRID(R,T,C),GR_UNITS(R,T,S)$GR_DEMFR(R,T,C,S)=1); + GR_UNITS(R,T,S)$GR_UNITS(R,T,S) = SUM(TRACKC(R,C),GR_DEMFR(R,T,C,S))+1-1; + GR_DEMFR(RC_GRID(R,T,C),S)$GR_UNITS(R,T,S) = GR_DEMFR(R,T,C,S)/GR_UNITS(R,T,S)+EPS; + OPTION CLEAR=GR_UNITS,CLEAR=RXX; +* Find and remove node with max demand fraction from GR_DEMFR + GR_UNITS(RC_GRID(R,T,C)) = SUM(COM_TS(R,C,S),GR_DEMFR(R,T,C,S)); + LOOP((R,T), Z=MAX(EPS,SMAX(TRACKC(R,C),GR_UNITS(R,T,C))); + LOOP(TRACKC(R,C)$Z,IF(GR_UNITS(R,T,C)=Z,RXX(R,T,C)=YES;Z=0))); + GR_DEMFR(RXX(R,T,C),S)=0; + TRACKPC(RPC(GR_GENP(R,P),C))$GR_GENLEV(R,C)=YES; + GR_PRCMAP(TRACKPC(R,P,C),ITEM)$(TOP(R,P,C,'OUT')$GR_GENMAP(R,P,ITEM))=YES; + GR_PRCMAP(TRACKPC(RP_IRE(R,P),C),ITEM)$GR_GENMAP(R,P,ITEM)=YES; + + OPTION CLEAR=TRACKC,CLEAR=TRACKPC; +$EXIT +*------------------------------------------------------------------------ +$LABEL PREP +$ BATINCLUDE fillparm PRC_REACT R P ",'0','0','0','0','0'" T 1 'GE 0' +$ BATINCLUDE fillparm GR_DEMFR R 'C,S' ",'0','0','0','0'" T 1 'GE 0' +$ BATINCLUDE fillparm GR_ENDFR R 'C,COM' ",'0','0','0','0'" T 1 'GE 0' +$ BATINCLUDE fillparm GR_GENFR R 'C,ITEM' ",'0','0','0','0'" T 1 'GE 0' +$ BATINCLUDE filparam GR_XBND 'R,' '' ",'0','0','0','0','0'" DATAYEAR T +$EXIT +*------------------------------------------------------------------------ +$LABEL DECL +* Declare variables and equations + POSITIVE VARIABLES %VAR%_GRIDELC(R,YEAR,C,C,S,IO%SWD%); + VARIABLES %VAR%_COMAUX(R,T,C,S%SWD%); + EQUATIONS + %EQ%_GR_POWFLO(R,T,C,S,REG,COM%SWTD%) + %EQ%_GR_GENALL(R,T,C,S,CG %SWTD%) + %EQ%_GR_DEMALL(R,T,C,S %SWTD%) + %EQ%_GR_XBND(R,T,S,IE %SWTD%) + ; +$ SETGLOBAL IREAUXBAL $BATINCLUDE powerflo.vda IREAUX +* For each disjoint grid, set phase angle to zero for the node with most connected lines + LOOP(J$SUM(GR_GRID(J,R,C),1), Z = SMAX(GR_GRID(J,R,C),SUM(P$GR_FLOW(R,P,C),1)); + LOOP(GR_GRID(J,R,C)$Z,IF(SUM(P$GR_FLOW(R,P,C),1)=Z, Z=0; %VAR%_COMAUX.FX(R,T,C,S%SOW%)=EPS))); +$ EXIT +*------------------------------------------------------------------------ +$LABEL POWFLO +* Standard DC power flow equations + %EQ%_GR_POWFLO(RTCS_VARC(%R_T%,C,RTS(S)),REG,COM%SWT%)$GR_ADMIT(R,T,C,REG,COM).. + + SUM((GR_TOP(R,C,REG,COM,P),RTP_VINTYR(REG,V,T,P))$RTPCS_VARF(REG,T,P,COM,S), + SUM(RPC_IRE(REG,P,COM,IE)$PRC_REACT(R,T,P),%VAR%_IRE(REG,V,T,P,COM,S,IE%SOW%)*(1-2*XPT(IE)))) + + =E= + + (%VAR%_COMAUX(R,T,C,S%SOW%)-%VAR%_COMAUX(REG,T,COM,S%SOW%)) * GR_ADMIT(R,T,C,REG,COM); +*---------- +* Generation fractions for all grid nodes C + %EQ%_GR_GENALL(RTCS_VARC(RC_GRID(%R_T%,C),RTS(S)),CG %SWT%)$GR_ALGMAP(R,CG,CG).. + +* Normal processes + SUM((GR_PRCMAP(RP_STD(R,P),COM,ITEM),GR_ALGMAP(R,CG,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), +$ BATINCLUDE %cal_red% COM COM1 TS P T + * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)))) + +* Imports + SUM((GR_PRCMAP(RP_IRE(R,P),COM,ITEM),RPC_IRE(R,P,COM,IE('IMP')))$GR_ALGMAP(R,CG,COM), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), + (1+IRE_FLOSUM(R,T,P,COM,TS,IE,COM,'OUT')) * + (%VAR%_IRE(R,V,T,P,COM,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ + (%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))*RS_FR(R,S,TS))) + +* Net storage output + SUM((GR_PRCMAP(RPC_STG(R,P,COM),ITEM),GR_ALGMAP(R,CG,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * + SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,COM,TS)),(%VAR%_SOUT(R,V,T,P,COM,TS %SOW%)-%VAR%_SIN(R,V,T,P,COM,TS %SOW%)$TOP(R,P,COM,'IN'))*RS_FR(R,S,TS))) + +* Net balance + +SUM(GR_ALLMAP(R,CG,C),%VAR%_GRIDELC(R,T,C,C,S,'OUT'%SOW%)-%VAR%_GRIDELC(R,T,C,C,S,'IN'%SOW%) - + SUM(GR_DEMMAP(R,C,COM),%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%)-%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM))) + + =E= + SUM(GR_ALGMAP(R,CG,COM)$RTC(R,T,COM),%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%)+%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,COM,COM)); +*---------- +* Demand fractions for all but the largest fraction + %EQ%_GR_DEMALL(RTCS_VARC(RC_GRID(%R_T%,C),RTS(S)) %SWT%)$GR_DEMFR(R,T,C,S).. + +* Net injection + SUM(GR_ENDC(R,COM), + SUM(TOP(RP_STD(R,P),COM,'OUT')$(NOT GR_GENP(R,P)*GR_DEMMAP(R,C,COM)), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), +$ BATINCLUDE %cal_red% COM COM1 TS P T + * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS))) * + (SUM(GR_PRCMAP(R,P,COM,ITEM),GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM))-GR_ENDFR(R,T,C,COM)*(1+GR_ENDFR(R,T,COM,COM))-GR_DEMFR(R,T,C,S)$GR_GENP(R,P)$GR_ENDC(R,'NRG')))) + +* Exports + SUM((GR_PRCMAP(RP_IRE(R,P),COM,ITEM),RPC_IRE(R,P,COM,IE('EXP')))$GR_ALGMAP(R,'NRG',COM), GR_GENMAP(R,P,ITEM) * + (GR_ENDFR(R,T,C,COM) + GR_DEMFR(R,T,C,S)$GR_ENDC(R,'NRG') - GR_GENFR(R,T,C,ITEM)) * + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), + (1+IRE_FLOSUM(R,T,P,COM,TS,IE,COM,'IN')) * + (%VAR%_IRE(R,V,T,P,COM,TS,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ + (%VAR%_ACT(R,V,T,P,TS%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))*RS_FR(R,S,TS))) + +* Net demand shares + SUM(GR_DEMMAP(R,C,COM)$RTC(R,T,COM), %VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%) - + (GR_ENDFR(R,T,C,COM)+GR_DEMFR(R,T,C,S)$GR_ENDC(R,'NRG')) * + SUM(RTC(R,T,COM2)$GR_DEMMAP(R,COM2,COM),%VAR%_GRIDELC(R,T,COM,COM2,S,'IN'%SOW%))) + + =E= 0; +*---------- +* Bound on net imports/exports from grid + %EQ%_GR_XBND(%R_T%,RTS(S),IE %SWT%)$(TS_GROUP(R,'DAYNITE',S)$GR_XBND(R,T)).. + + SUM(GR_DEMMAP(R,C,COM)$(RTC(R,T,COM)$RC_GRID(R,T,C)), PROD(XPT(IE),-1) * + (%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM)-%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%))) + + =L= + SUM(TOP_IRE(R,C,ALL_R,COM,P)$((NOT SAMEAS(R,ALL_R))$RC_GRID(R,T,C)), + SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * GR_XBND(R,T) * G_YRFR(R,S) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V)))$PRC_CAP(R,P) + + SUM((REG(ALL_R),V)$COEF_CPT(REG,V,T,P), COEF_CPT(REG,V,T,P) * PRC_CAPACT(REG,P) * GR_XBND(R,T) * G_YRFR(R,S) * + (%VARV%_NCAP(REG,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(REG,V,P)$PASTYEAR(V))$PRC_CAP(REG,P))$(NOT PRC_CAP(R,P)))$XPT(IE) + + SUM(TOP_IRE(ALL_R,COM,R,C,P)$((NOT SAMEAS(R,ALL_R))$RC_GRID(R,T,C)), + SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * PRC_CAPACT(R,P) * GR_XBND(R,T) * G_YRFR(R,S) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V)))$PRC_CAP(R,P) + + SUM((REG(ALL_R),V)$COEF_CPT(REG,V,T,P), COEF_CPT(REG,V,T,P) * PRC_CAPACT(REG,P) * GR_XBND(R,T) * G_YRFR(R,S) * + (%VARV%_NCAP(REG,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(REG,V,P)$PASTYEAR(V))$PRC_CAP(REG,P))$(NOT PRC_CAP(R,P)))$IMP(IE) +; +$EXIT +*------------------------------------------------------------------------ +$LABEL IREAUXIN +$SET MX COM_IE(R,T,C,S)* +$LABEL IREAUXOUT- +* For balance of C (and grid nodes COM) + SUM(GR_DEMMAP(R,COM,C),%MX%(%VAR%_GRIDELC(R,T,C,COM,S,'OUT'%SOW%)-%VAR%_GRIDELC(R,T,C,COM,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',C))) + +* For balance of grid node C + SUM(GR_DEMMAP(R,C,COM),%MX%(%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM)-%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%))) + +$GOTO IREAUXOUT +*------------------------------------------------------------------------ +$ LABEL CSTBAL +* Preprocess nodal balance costs + SET OBV / OBJBAL /; + SET ITEM / CON, NTX, NPG /; + SETS RC_GRID(R,T,C), GR_ALLMAP(R,CG,COM), GR_PRCMAP(R,P,C,ITEM); + SETS GR_DEMMAP(R,C,COM), GR_ALGMAP(R,CG,CG), GR_ENDC(R,CG); + PARAMETER OBJ_COMBAL(R,T,C,S,ITEM,CUR); +$IF NOT DEFINED RC_GRID OPTION CLEAR=RC_GRID,CLEAR=GR_ALLMAP,CLEAR=GR_ALGMAP,CLEAR=GR_DEMMAP,CLEAR=GR_PRCMAP,CLEAR=GR_ENDC; +* levelization +$ BATINCLUDE pp_lvlfc.mod COM_CSTBAL C COM_TS ',ITEM,CUR' ",'0','0'" ALL_TS T RTC(R,T,C) '' '' N + OPTION TRACKC < COM_CSTBAL; + TRACKC(R,C)$SUM(GR_ALLMAP(R,C,COM),1)=NO; + OBJ_COMBAL(RTCS_VARC(RTC(R,T,C),TS),'PRD',CUR)$TRACKC(R,C) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'PRD',CUR)+COM_CSTBAL(RTC,S,'CON',CUR)+COM_CSTBAL(RTC,S,'OUT',CUR)); + OBJ_COMBAL(RTCS_VARC(RTC(R,T,C),TS),'IMP',CUR)$TRACKC(R,C) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'IMP',CUR)+COM_CSTBAL(RTC,S,'NTX',CUR)-COM_CSTBAL(RTC,S,'PRD',CUR)); + OBJ_COMBAL(RTCS_VARC(RTC(R,T,C),TS),'EXP',CUR)$TRACKC(R,C) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'EXP',CUR)-COM_CSTBAL(RTC,S,'NTX',CUR)-COM_CSTBAL(RTC,S,'CON',CUR)); + LOOP(RDCUR(R,CUR),RHS_COMPRD(RTCS_VARC(R,T,C,S))$OBJ_COMBAL(R,T,C,S,'PRD',CUR)=YES); RCS_COMPRD(RHS_COMPRD(R,T,C,S),'FX')$TRACKC(R,C) = YES; + OBJ_COMBAL(RTCS_VARC(RTC(RC_GRID),TS),'GEN',CUR) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'PRD',CUR)+COM_CSTBAL(RTC,S,'CON',CUR)); + OBJ_COMBAL(RTCS_VARC(RTC(RC_GRID),TS),'NTX',CUR) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,'NTX',CUR)+COM_CSTBAL(RTC,S,'CON',CUR)); + OBJ_COMBAL(RTCS_VARC(RTC(RC_GRID),TS),IE,CUR) = SUM(TS_ANN(TS,S),COM_CSTBAL(RTC,S,IE,CUR)); +* Add balancer variables if penalty costs on excess + OPTION CLEAR=UNCD7; UNCD7(R,T--ORD(T),C,S--ORD(S),CUR,'','')$RC_GRID(R,T,C) $= COM_CSTBAL(R,T,C,S,'NPG',CUR); + LOOP(UNCD7(R,TT,C,SL,CUR,'',''), GR_ALLMAP(R,'FIN',C) = YES; GR_ALGMAP(R,CG('FIN'),CG) = YES; + OBJ_COMBAL(RC_GRID(R,T,C),TS,'NPG',CUR) $= SUM(TS_ANN(TS,S),COM_CSTBAL(R,T,C,S,'NPG',CUR))); + OPTION CLEAR=TRACKC; +$EXIT +*------------------------------------------------------------------------ +$ LABEL OBJBAL +$ SET TPULSE TT$OBJ_LINT(R,T,TT,CUR),OBJ_LINT(R,T,TT,CUR) + + POSITIVE VARIABLES %VAR%_GRIDELC(R,YEAR,C,C,S,IO%SWD%); + EQUATION EQ_OBJBAL(R,CUR,ALLSOW); + EQ_OBJBAL(RDCUR(R,CUR)%SWX%).. + + %VAR%_OBJ(R,'OBJBAL',CUR %SOW%) =E= + +$IF %STAGES%==YES $SET SOW ,WW +$IF %STAGES%==YES SUM(%SWSW% +* Costs on commodity production + SUM(RHS_COMPRD(R,T,C,S),%VAR%_COMPRD(R,T,C,S %SOW%) * SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,'PRD',CUR))) + + SUM(RTCS_VARC(RC_GRID(R,T,C),S)$OBJ_COMBAL(R,T,C,S,'GEN',CUR), + (SUM(GR_ALGMAP(R,CG,COM),%VAR%_GRIDELC(R,T,COM,C,S,'OUT' %SOW%)+%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,COM,COM))+ + SUM((GR_PRCMAP(RP_STD(R,P),COM,ITEM),GR_ENDC(R,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(R,T,C,ITEM) * + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,COM,TS))$RS_FR(R,S,TS), +$ BATINCLUDE %cal_red% COM COM1 TS P T + * RS_FR(R,S,TS)))) * SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,'GEN',CUR))) + + +* Costs on net imports to grid node + SUM(RTCS_VARC(RC_GRID(R,T,C),S)$OBJ_COMBAL(R,T,C,S,'NTX',CUR), + SUM(GR_DEMMAP(R,C,COM),%VAR%_GRIDELC(R,T,COM,C,S,'IN'%SOW%)$GR_ALGMAP(R,'NRG',COM)-%VAR%_GRIDELC(R,T,COM,C,S,'OUT'%SOW%)) * + SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,'NTX',CUR))) + + +* Costs on Net Positive Generation (NPG) + SUM(RTCS_VARC(RC_GRID(R,T,C),S)$OBJ_COMBAL(R,T,C,S,'NPG',CUR), + %VAR%_GRIDELC(R,T,C,C,S,'OUT' %SOW%) * SUM(%TPULSE% * MAX(0,OBJ_COMBAL(R,TT,C,S,'NPG',CUR)))) + + +* Costs on commodity imports / exports + SUM((RTPCS_VARF(R,T,P,C,S),RPC_IRE(R,P,C,IE))$OBJ_COMBAL(R,T,C,S,IE,CUR), + SUM(RTP_VINTYR(R,V,T,P), + (%VAR%_IRE(R,V,T,P,C,S,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,T,P,S %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C))) * + SUM(%TPULSE% * OBJ_COMBAL(R,TT,C,S,IE,CUR))) + +$IF %STAGES%==YES ) + ; +$EXIT +*------------------------------------------------------------------------ +$LABEL RPTB + %4REG_WOBJ(%5R,'VAR',CUR) = %4REG_WOBJ(%5R,'VAR',CUR) + %VAR%_OBJ.L(R,'OBJBAL',CUR%6); + OPTION TRACKC < COM_CSTBAL; + %4CST_COMC(%5RTC(R,T,C))$TRACKC(R,C) = %4CST_COMC(%5RTC) + + SUM((RTCS_VARC(RTC,S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'PRD',CUR),OBJ_COMBAL(RTC,S,'PRD',CUR)*VAR_COMPRD.L(RTC,S)) + + SUM((RPCS_VAR(R,P,C,S),RPC_IRE(R,P,C,IE),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,IE,CUR), + SUM(RTP_VINTYR(R,V,T,P),OBJ_COMBAL(RTC,S,IE,CUR)*PAR_IRE(R,V,T,P,C,S,IE))) + +* Cost on generation to grid + SUM((RTCS_VARC(RC_GRID(RTC),S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'GEN',CUR), + OBJ_COMBAL(RTC,S,'GEN',CUR) * + (SUM(GR_ALGMAP(R,CG,COM),%VART%_GRIDELC.L(R,T,COM,C,S,'OUT' %SWS%)+%VART%_GRIDELC.L(R,T,COM,C,S,'IN'%SWS%)$GR_ALGMAP(R,COM,COM))+ + SUM((GR_PRCMAP(RP_STD(R,P),COM,ITEM),GR_ENDC(R,COM)), GR_GENMAP(R,P,ITEM)*GR_GENFR(RTC,ITEM) * + SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS), + PAR_FLO(R,V,T,P,C,TS)*RS_FR(R,S,TS))))) + +* Costs on net imports to grid node + SUM((RTCS_VARC(RC_GRID(RTC),S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'NTX',CUR), + SUM(GR_DEMMAP(R,C,COM),%VART%_GRIDELC.L(R,T,COM,C,S,'IN'%SWS%)$GR_ALGMAP(R,'NRG',COM)-%VART%_GRIDELC.L(R,T,COM,C,S,'OUT'%SWS%)) * + OBJ_COMBAL(RTC,S,'NTX',CUR)) + +* Costs on Net Positive Generation (NPG) + SUM((RTCS_VARC(RC_GRID(RTC),S),RDCUR(R,CUR))$OBJ_COMBAL(RTC,S,'NPG',CUR), + %VART%_GRIDELC.L(RTC,C,S,'OUT'%SWS%) * OBJ_COMBAL(RTC,S,'NPG',CUR)); + + OPTION CLEAR=TRACKC; +*------------------------------------------------------------------------ +$LABEL IREAUXIN- +$LABEL IREAUXOUT diff --git a/pp_actef.vda b/pp_actef.vda new file mode 100644 index 0000000..681d2d0 --- /dev/null +++ b/pp_actef.vda @@ -0,0 +1,82 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==============================================================================* +* PP_ACTEF.MOD : Make the necessary preparations for EQE_ACTEFF equations +* - Aggregate / inherit ACT_EFF parameters +*==============================================================================* +$IF NOT '%1' == LVL $GOTO EQUA +*----------------------------------------------------------------------------- + SCALAR MICRO / 1E-6 /; + OPTION CLEAR=UNCD7; +*----------------------------------------------------------------------------- +* Save commodity ACT_EFF partitions + CG_GRP(RPC_ACE(RPC(R,P,C)),C) = YES; + OPTION KEEP_FLOF0)$NCAP_CDME(RTP)) = MAX(.001,(NCAP_CDME(RTP)/NCAP_BPME(RTP)*(1+COEF_RTP(RTP))-1)/COEF_RTP(RTP)); +* EQ_PTRANS control - overall efficiency + FLO_SUM(RTP(R,V,P),C,COM,C,ANNUAL)$(RPC_SPG(R,P,COM)$RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C)) $= NCAP_CDME(RTP); +*----------------------------------------------------------------------------- +* Identify CHP processes using NCAP_CHPR + IF(CARD(CHP), +* Get the ELC / HEAT outputs + OPTION PRC_ACT < NCAP_CHPR; + CHP_ELC(RPC_PG(CHP(PRC_ACT(R,P)),C))$NRG_TMAP(R,'ELC',C) = YES; + OPTION TRACKP < CHP_ELC; TRACKP(RP_PGACT) = NO; + RVP(R,V,P)$(COEF_RTP(R,V,P)$TRACKP(R,P)) = YES; + RP_GRP(RPC_PG(TRACKP(RP),C))$(NOT CHP_ELC(RP,C)) = YES; + RP_GRP(RP_PGACT(CHP),C)$(TOP(CHP,C,'OUT')$(NOT CHP_ELC(CHP,C))) = YES; + TRACKPG(RP_GRP(RPC_PG(R,P,C)))$COM_LIM(R,C,'N')=YES; OPTION RP_PRC.01)$(NOT NCAP_CHPR(RVP,'UP'))) = COEF_RTP(RVP)+EPS; + ); +*----------------------------------------------------------------------------- +* Calculate ACTFLOs for pg and elc + PRC_ACTFLO(RVP(R,V,P),C)$((NCAP_CEH(RVP) LE 1)$RPC_PG(R,P,C)) = + POWER(NCAP_CEH(RVP),(1$CHP_ELC(R,P,C)-1)$NCAP_CEH(RVP)) * (1-NCAP_BPME(RVP)); + PRC_ACTFLO(RVP(R,V,P),C)$(((NCAP_CEH(RVP) GT 1)*NCAP_CEH(RVP))$RPC_PG(R,P,C)) = + (1+(1/NCAP_CEH(RVP)-1)/(1+1/COEF_RTP(RVP))) * POWER(NCAP_CEH(RVP),1-1$CHP_ELC(R,P,C)); + PRC_ACTFLO(RVP(R,V,P),C)$TRACKPG(R,P,C) = PRC_ACTFLO(RVP,C)*(1/COEF_RTP(RVP)+1)/MAX(1E-3,EXP(ABS(LOG(NCAP_CEH(RVP))))-1); +* EQ_PTRANS control - low-temperature heat + FLO_SUM(RTP(R,V,P),C,COM,C,ANNUAL)$(RP_GRP(R,P,COM)$CHP_ELC(R,P,C)$NCAP_CDME(RTP)) = -1/PRC_ACTFLO(RTP,COM); +*----------------------------------------------------------------------------- +* EQ_OUTSHR controls: Set bound for the electricity output +* Define the share over PG if there is more than just ELC, otherwise NRG + RP_GRP(TRACKPG)=NO; TRACKP(RP_PRC)=NO; RP_GRP(TRACKP,C)=NO; + OPTION CLEAR=TRACKPG; TRACKPG(RP_PG(TRACKP,CG))=YES; + TRACKPG(RP_PGACT(RP),'NRG') $= SUM(CHP_ELC(RP,C),1); + LOOP((CHP_ELC(R,P,C),TRACKPG(R,P,CG)), + FLO_SHAR(RTP(R,V,P),C,CG,S,'LO')$(PRC_TS(R,P,S) * NCAP_CHPR(RTP,'UP')) = 1 / (1+NCAP_CHPR(RTP,'UP')); + FLO_SHAR(RTP(R,V,P),C,CG,S,'FX')$(PRC_TS(R,P,S) * NCAP_CHPR(RTP,'FX')) = 1 / (1+NCAP_CHPR(RTP,'FX')); + FLO_SHAR(RTP(R,V,P),C,CG,S,'UP')$(PRC_TS(R,P,S) * NCAP_CHPR(RTP,'LO')) = 1 / (1+NCAP_CHPR(RTP,'LO')); + ); +* Heat share + FLO_SHAR(RTP(R,V,P),C,CG,S,BD)$(PRC_TS(R,P,S)$RP_PG(R,P,CG)$RP_GRP(R,P,C)) = NCAP_CHPR(RTP,BD)/(NCAP_CHPR(RTP,BD)+1); +* ACT emission + FLO_SUM(RVP,COM,C,COM,S)$((NCAP_BPME(RVP)$NCAP_CEH(RVP)$PRC_ACTFLO(RVP,C)<0)$FLO_EFF(RVP,COM,C,S)) = FLO_EFF(RVP,COM,C,S)/PRC_ACTFLO(RVP,C); +*----------------------------------------------------------------------------- +* Adjust PKCNT + LOOP(RPC_PKC(CHP_ELC(R,P,C)),NCAP_PKCNT(RVP(R,V,P),S)$COM_TS(R,C,S)=NCAP_PKCNT(RVP,S)/MAX(1,PRC_ACTFLO(RVP,C))); + RVP(RVP)$(NCAP_CEH(RVP)+1$NCAP_CHPR(RVP,'FX')+NCAP_CHPR(RVP,'LO')>0) = NO; + PUTGRP = 0; + LOOP(RVP(R,V,P)$(T(V)+PRC_VINT(R,P)), +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'CHP process with zero CEH but only upper bound on CHPR.' + PUT QLOG ' WARNING - Unusual CHP operation: R=',%RL%,' P=',%PL%,' V=',V.TL; + ); + OPTION CLEAR=PRC_ACT,CLEAR=RVP,CLEAR=TRACKP,CLEAR=TRACKPG,CLEAR=RP_PRC,CLEAR=RP_GRP,CLEAR=COEF_RTP; \ No newline at end of file diff --git a/pp_clean.mod b/pp_clean.mod new file mode 100644 index 0000000..8300ccf --- /dev/null +++ b/pp_clean.mod @@ -0,0 +1,27 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------- +* PP_CLEAN.mod - Release memory by clearing items no longer used +*----------------------------------------------------------------------- +* Only items not used in any equations can be cleared; to be careful! +$IF %MEMCLEAN%==NO $EXIT +*----------------------------------------------------------------------- +FLO_SUM(R,ALLYEAR,P,CG1,C,CG2,S) = 0; +FLO_FUNC(R,ALLYEAR,P,CG1,CG2,S) = 0; +NCAP_AF(R,ALLYEAR,P,S,BD) = 0; +NCAP_AFA(R,ALLYEAR,P,BD) = 0; +NCAP_AFS(R,ALLYEAR,P,S,BD) = 0; +NCAP_COST(R,ALLYEAR,P,CUR) = 0; +NCAP_FOM(R,ALLYEAR,P,CUR) = 0; +ACT_COST(R,ALLYEAR,P,CUR) = 0; +FLO_TAX(R,ALLYEAR,P,C,S,CUR) = 0; +FLO_SUB(R,ALLYEAR,P,C,S,CUR) = 0; +FLO_COST(R,ALLYEAR,P,C,S,CUR) = 0; +FLO_DELIV(R,ALLYEAR,P,C,S,CUR) = 0; + +$IF NOT SET BENCOST $SETGLOBAL BENCOST NO +$IFI NOT '%BENCOST%'=='NO' +$IFI EXIST timesrng.inc execute 'mv -f timesrng.inc timesrng_bak.inc'; + diff --git a/pp_lvlbd.mod b/pp_lvlbd.mod new file mode 100644 index 0000000..59eb3f1 --- /dev/null +++ b/pp_lvlbd.mod @@ -0,0 +1,47 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLBD aggregate the bound attributes if finer than level +* %1 - bound attribute name (ACT_BND,FLO_FR,COM_BND,IRE_BND) +* %2 - 'C'ommodity/'P'rocess index +* %3 - 'C,' or none +* %4 - other indexes between S and BD +* %5 - temp residual indexes +* %6 - COM/PRC_TS-level shooting for +* %7 - valid bound levels +* %8 - temp set name +* %9 - treat negative bouds as 0/EPS? +*=============================================================================* +* Questions/Comments: +* - New implementation (Jul-2011) +* - As originally, based on summing of UP/FX and LO/FX bounds from finer levels +*----------------------------------------------------------------------------- +*$ONLISTING + SET BDVAL(BD); + PARAMETER TS_BD(S,BD); + %8(RT%2(R,T,%2),%3S--ORD(S),%4'FX'%5) $= SUM(BD$%1(RT%2,%3S,%4BD),1)$(NOT %7(R,%2,%3S)); + +* Aggregation only if target level value is not present + LOOP((%8(R,T,%2,%3ALL_TS,%4'FX'%5),%6(R,%2,%3TS)), + TS_BD(S,BD) = %1(R,T,%2,%3S,%4BD)$TS_MAP(R,TS,S); + TS_BD(S,BDNEQ) $= TS_BD(S,'FX'); Z=SUM(BD$TS_BD(TS,BD),1); F=CARD(TS_BD)-Z; + IF(Z>1,Z=F; ELSE Z=SUM((RS_BELOW(R,TS,S),BDNEQ(BD))$(TS_BD(S,BD)$TS_BD(TS,BD)),1)$F); + IF(Z, F=(F>Z); +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 '%1 Bounds conflict: Value at %6 level and below, latter ignored' + PUT QLOG ' WARNING - %1: R=',%RL%,' Y=',T.TL,' %2=',%2.TL,' S=',TS.TL); + IF(F, BDVAL(BD)=(NOT TS_BD(TS,BD))$BDNEQ(BD); +* Clear neg bounds and those below the topmost ones +$IF NOT %9=='' TS_BD(S,BDNEQ)$(TS_BD(S,BDNEQ)<0) = %9; + TS_BD(S,BDVAL(BD))$SUM(RS_BELOW(R,SL,S)$TS_BD(SL,BD),1)=0; +* Check the INF default for UP bounds before summing + BDVAL(BDVAL('UP')) = (G_YRFR(R,TS)-SUM(RS_BELOW(R,TS,S)$TS_BD(S,'UP'),G_YRFR(R,S))) < 1E-5; + TS_BD(TS,BDVAL)=SUM(RS_BELOW(R,TS,S),TS_BD(S,BDVAL)); + IF((TS_BD(TS,'UP')-TS_BD(TS,'LO') < 1E-7)$(SUM(BD$TS_BD(TS,BD),1)=2), + %1(R,T,%2,%3TS,%4'FX') = TS_BD(TS,'LO'); + ELSE %1(R,T,%2,%3TS,%4BDVAL) $= TS_BD(TS,BDVAL)))); + + %1(R,T,%2,%3S,%4BDNEQ)$%1(R,T,%2,%3S,%4'FX') = 0; + OPTION CLEAR=%8; +*$OFFLISTING diff --git a/pp_lvlbr.mod b/pp_lvlbr.mod new file mode 100644 index 0000000..d45d8fa --- /dev/null +++ b/pp_lvlbr.mod @@ -0,0 +1,55 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLBR aggregate/inherit relative process bound attributes if different than level +* %1 - attribute name (NCAP_AF, FLO_SHAR etc.) +* %2 - other qualifying indexes ('','') +* %3 - TS set shooting for (PRC_TS, RPS_S1 etc.) +* %4 - UNCD7 residual dimension +* %5 - qualifier to allow inheritance if some values found at target slices (0/1) +* %6 - qualifier triggering the bound conflict test (0/1) +* %7 - optional index in TS set +*=============================================================================* +OPTION CLEAR=UNCD7; +*----------------------------------------------------------------------------- +LOOP((RTP(R,V,P)%2,S,BD)$((NOT %3(R,P,%7S))$%1(R,V,P%2,S,BD)), + F = 0; Z = 1; + LOOP(RS_BELOW(R,TS,S)$Z, +* If value is below target level, aggregate only if value not found at target level + IF(%1(R,V,P%2,TS,BD), F = 1; + IF(%3(R,P,%7TS), Z = 0; IF(NOT UNCD7(R,TS,P%2,TS,BD%4), +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 '%1 Bounds conflict: Bound at %3 level and below, lower ignored' + PUT QLOG ' WARNING - R=',%RL%,' P=',%PL%,' TS=',TS.TL ; + UNCD7(R,TS,P%2,TS,BD%4) = YES)); + ELSEIF %3(R,P,%7TS), Z = 0; UNCD7(R,V,P%2,TS,BD%4) = YES)); + IF(Z, Z = SUM(RS_BELOW(R,S,TS)$%1(R,V,P%2,TS,BD),EPS+(%1(R,V,P%2,TS,BD) > EPS)$%3(R,P,%7TS)); +* If value above target level and no values found below or above, mark to be inherited down: + IF(NOT (F+Z), UNCD7(R,V,P%2,S,BD%4) = YES; +* If value is above targets and all other values in the subtree are at non-target slices, mark to be leveled: + ELSE Z=Z<1; UNCD7(R,V,P%2,TS,BD%4)$(RS_BELOW(R,S,TS)*%3(R,P,%7TS)*(Z+(NOT %1(R,V,P%2,TS,BD))$%5)) = YES))); +*----------------------------------------------------------------------------- +* Aggregation/inheritance to target timeslices +*----------------------------------------------------------------------------- +LOOP(UNCD7(R,V,P%2,TS,BD%4), + IF(%3(R,P,%7TS), +* Leveling by simultaneous aggregation/inheritance + TS_ARRAY(ALL_TS) = %1(R,V,P%2,ALL_TS,BD); + %1(R,V,P%2,TS,BD) $= + SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + + SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), + TS_ARRAY(ALL_TS))))/G_YRFR(R,TS); +* Otherwise just simple direct inheritance down + ELSE Z = %1(R,V,P%2,TS,BD); %1(R,V,P%2,S,BD)$(RS_BELOW(R,TS,S)$%3(R,P,%7S)) = Z)); +*----------------------------------------------------------------------------- +OPTION CLEAR=UNCD7; +IF(%6, PUTGRP = 0; + LOOP((R,V,P%2,S)$%1(R,V,P%2,S,'FX'), +* check to see if both LO/FX and UP/FX at same S + IF(%3(R,P,%7S) AND (%1(R,V,P%2,S,'UP') + %1(R,V,P%2,S,'LO')), +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 '%1 Bounds conflict: FX + LO/UP at same TS-level, latter ignored' + PUT QLOG ' WARNING - R=',%RL%,' Y=',V.TL,' P=',%PL%,' S=',S.TL ; + UNCD7(R,V,P%2,S,'0'%4) = YES;)); + IF(PUTGRP, %1(R,V,P%2,S,BDNEQ)$UNCD7(R,V,P%2,S,'0'%4) = 0; + OPTION CLEAR=UNCD7)); diff --git a/pp_lvlfc.mod b/pp_lvlfc.mod new file mode 100644 index 0000000..0bf8e8c --- /dev/null +++ b/pp_lvlfc.mod @@ -0,0 +1,45 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLPC aggregate/inherit attributes if at different than target level +* Parameter arguments must be of the form (R,V,{P/C/P,C},S[,xx]*) +* %1 - attribute name (FLO_COST, FLO_TAX etc.) +* %2 - 'P', 'C' 'COM' or 'P,C' depending on attribute +* %3 - TS set shooting for +* %4 - remaining indexes (e.g. ',CUR') +* %5 - UNCD7 residual dimension +* %6 - ALL_TS or TS depending on whether inheritance is allowed +* %7 - YEAR set to look for data (DATAYEAR/XMILE/V/'') +* %8 - Existence qualifier set or YES +* %9 - Optional indicator for weighting: Use 1 if inheritance is weighted +* %10 - Optional indexes between TS set items and the S index +*=============================================================================* +OPTION CLEAR=UNCD7; +$SETLOCAL TAKE '%12' SETLOCAL REGY 'R,%7' SETLOCAL TS (NOT %3(R,%2,S))$ +$SETLOCAL AWGT 'G_YRFR(R,S)/G_YRFR(R,TS)' SETLOCAL IWGT '' +$IF '%7' == '' $SETLOCAL REGY 'R' +$IF '%6' == 'S2' $SETLOCAL TS '' +$IF '%9' == '1' $SETLOCAL AWGT '1' SETLOCAL IWGT '*G_YRFR(R,S)/G_YRFR(R,%6)' +$IF '%11'=='N' $SETLOCAL TAKE $%1(R,'0',%2%10,'ANNUAL'%4) +$IF '%11'=='N' %1(R,LL--ORD(LL),%2%10,S+STOA(S)%4)$(STOAL(R,S)$%1(R,LL,%2%10,S%4)) = 1; +*----------------------------------------------------------------------------- +* Mark to be levelized if inheritance is allowed or S is not ANNUAL: +LOOP((%REGY%,%2%10,S%4)$(%TS%%1(%REGY%,%2%10,S%4)), UNCD7(%REGY%,%2%10%4%5)$(%8%TAKE%) = YES); +*----------------------------------------------------------------------------- +* Aggregation/inheritance to target timeslices +*----------------------------------------------------------------------------- +LOOP(UNCD7(%REGY%,%2%10%4%5), TS_ARRAY(S) = %1(%REGY%,%2%10,S%4); + IF((NOT SUM(RS_BELOW(R,'ANNUAL',S)$TS_ARRAY(S),1))$TS_ARRAY('ANNUAL'), + %1(%REGY%,%2%10,S%4)$%3(R,%2,S) = SUM(ANNUAL(%6),TS_ARRAY(%6)%IWGT%); + ELSE +* Leveling by simultaneous aggregation/inheritance; but only if target level value is not present + LOOP(%3(R,%2,TS)$(NOT TS_ARRAY(TS)), + %1(%REGY%,%2%10,TS%4) $= + SUM(TS_MAP(R,TS,S)$FINEST(R,S), %AWGT% * (TS_ARRAY(S) + + SUM(RS_BELOW(R,%6,S)$(TS_ARRAY(%6) AND NOT SUM(SL$RS_BELOW(R,%6,SL),TS_MAP(R,SL,S)*TS_ARRAY(SL))), + TS_ARRAY(%6)%IWGT%)));))); +*----------------------------------------------------------------------------- +$IF '%11'==0 %1(%REGY%,%2%10,S%4)$((NOT %1(%REGY%,%2%10,S%4))$%3(R,%2,S)) $= %1(%REGY%,%2%10,'ANNUAL'%4); +$IF NOT '%11'=='' %1(R,LL,%2%10,S%4)$((NOT %3(R,%2,S))%TAKE%) = 0; diff --git a/pp_lvlff.mod b/pp_lvlff.mod new file mode 100644 index 0000000..8d83b5e --- /dev/null +++ b/pp_lvlff.mod @@ -0,0 +1,41 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLFF set the level of FLO_FUNC attribute using aggregation/inheritance +* %1 - mod or v# for the source code to be used +*=============================================================================* +*GaG Questions/Comments: +* - Assumption is that values can be given at any levels +*----------------------------------------------------------------------------- +*$ONLISTING + SET FFCKS(REG,PRC,CG,CG,TS) //; + +* check all commodities in the groups of a process at other than PRC_TS level + OPTION FFCKS <= FLO_FUNC; FFCKS(R,P,CG,CG2,S)$(PRC_TS(R,P,S)+ACTCG(CG))=NO; + LOOP(FFCKS(R,P,CG,COM_GRP,S)$STOA(S),CG_GRP(R,P,CG,COM_GRP) = YES); +*----------------------------------------------------------------------------- +* Leveling by simultaneous aggregation/inheritance +*----------------------------------------------------------------------------- + LOOP((CG_GRP(R,P,CG,COM_GRP),RTP(R,V,P)), + TS_ARRAY(ALL_TS) = FLO_FUNC(R,V,P,CG,COM_GRP,ALL_TS); + FLO_FUNC(R,V,P,CG,COM_GRP,TS)$((NOT TS_ARRAY(TS))$PRC_TS(R,P,TS)) = + SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + + SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), + TS_ARRAY(ALL_TS))))/G_YRFR(R,TS)); +*----------------------------------------------------------------------------- +* Leveling by direct inheritance +*----------------------------------------------------------------------------- + FLO_FUNC(R,V,P,CG,COM_GRP,TS)$(NOT FLO_FUNC(R,V,P,CG,COM_GRP,TS)) $= + SUM(FFCKS(R,P,CG,COM_GRP,ANNUAL)$PRC_TS(R,P,TS),FLO_FUNC(R,V,P,CG,COM_GRP,ANNUAL)); +*----------------------------------------------------------------------------- + +*UR* after inheritance aggregation delete all data that are not specified for elements of PRC_TS +* ? not a good idea since at least partially deleting the input of the user ? +* +* FLO_FUNC(R,T,P,CG,COM_GRP,S)$(FFCKS(R,P,CG,COM_GRP,S)*(NOT PRC_TS(R,P,S))) = 0; + + OPTION CLEAR = FFCKS, CLEAR = CG_GRP; +*$OFFLISTING + diff --git a/pp_lvlfs.mod b/pp_lvlfs.mod new file mode 100644 index 0000000..d1d67cd --- /dev/null +++ b/pp_lvlfs.mod @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLFS set the level of FLO_SUM attribute using aggregation/inheritance +* %1 - mod or v# for the source code to be used +*=============================================================================* +*GaG Questions/Comments: +* - Assumption is that values can be at any level +*----------------------------------------------------------------------------- +*$ONLISTING + SET FSTSL(TSLVL,R,P,CG,CG,CG,S) //; + +* check all commodities in the groups of a process at other than PRC_TS level + COEF_PTRAN(R,LL,P,CG,C,COM_GRP,S) $= FLO_SUM(R,LL,P,CG,C,COM_GRP,S)$(NOT RPCS_VAR(R,P,C,S)); + OPTION FSCKS <= COEF_PTRAN; + FSCK(R,P,CG,C,COM_GRP) $= SUM(FSCKS(R,P,CG,C,COM_GRP,S)$(NOT RPS_PRCTS(R,P,S)),1); + LOOP(ANNUAL(TS(TSLVL)),FSTSL(TSLVL+STOAL(R,S),FSCKS(R,P,CG,C,COM_GRP,S)) = YES); +*----------------------------------------------------------------------------- +* Leveling by simultaneous aggregation/inheritance +*----------------------------------------------------------------------------- + LOOP((FSCK(R,P,CG,C,COM_GRP),RTP(R,V,P)), + TS_ARRAY(ALL_TS) = FLO_SUM(R,V,P,CG,C,COM_GRP,ALL_TS); + FLO_SUM(R,V,P,CG,C,COM_GRP,TS)$RPCS_VAR(R,P,C,TS) = + SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + + SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), + TS_ARRAY(ALL_TS))))/G_YRFR(R,TS)); +*----------------------------------------------------------------------------- +* Leveling by direct inheritance +*----------------------------------------------------------------------------- +* after mixed aggregation/inheritance delete all data that are not specified at PRC_TS + FLO_SUM(R,LL,P,CG,C,COM_GRP,S)$COEF_PTRAN(R,LL,P,CG,C,COM_GRP,S) = 0; + FLO_SUM(R,LL,P,CG,C,COM_GRP,S)$(NOT RTP(R,LL,P)) = 0; + FOR(Z=CARD(TSLVL)-2 DOWNTO 0, + LOOP(SAMEAS(TSLVL-Z,'ANNUAL'), + FLO_SUM(RTP(R,V,P),CG,C,COM_GRP,TS)$((NOT FLO_SUM(R,V,P,CG,C,COM_GRP,TS))$RPCS_VAR(R,P,C,TS)) $= + SUM(FSTSL(TSLVL,R,P,CG,C,COM_GRP,S)$RS_BELOW(R,S,TS),COEF_PTRAN(R,V,P,CG,C,COM_GRP,S)); + )); +*----------------------------------------------------------------------------- + OPTION CLEAR=COEF_PTRAN, CLEAR = FSCK, CLEAR = FSCKS, CLEAR=FSTSL; + FLO_SUM(R,LL,P,CG,C,CG,S)$FSCKS(R,P,CG,C,CG,S) = 0; +*$OFFLISTING diff --git a/pp_lvlif.mod b/pp_lvlif.mod new file mode 100644 index 0000000..74f540f --- /dev/null +++ b/pp_lvlif.mod @@ -0,0 +1,45 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLIF set the level of a IRE_FLO attribute using aggregation/inheritance +* %1 - mod or v# for the source code to be used +*=============================================================================* +*GaG Questions/Comments: +* - Assumption is that values can be at any level +*----------------------------------------------------------------------------- +*$ONLISTING + + OPTION CLEAR=UNCD7; PUTGRP = 0; +*----------------------------------------------------------------------------- + LOOP((REG,V,P,COM,R,C,S)$IRE_FLO(REG,V,P,COM,R,C,S), + IF(NOT RPCS_VAR(R,P,C,S), + IF(NOT UNCD7(REG,P,COM,R,C,'0','0'), UNCD7(REG,P,COM,R,C,'0','0') = YES; + IF(NOT RPC_IRE(R,P,C,'IMP'), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 02 'IRE_FLO import commodity not in TOP_IRE' + PUT QLOG ' WARNING - R=',%RL%,' P=',%PL%,' C=',C.TL ; + ); + IF((NOT SUM((RS_BELOW(R,S,TS),MODLYEAR),IRE_FLO(REG,MODLYEAR,P,COM,R,C,S)))$SAMEAS('ANNUAL',S), +* No values below an ANNUAL level value: inherit value down + UNCD7(REG,P,COM,R,C,S,'') = YES; + ELSE UNCD7(REG,P,COM,R,C,TS,'')$RPCS_VAR(R,P,C,TS) = YES;)))); +*----------------------------------------------------------------------------- +* Aggregation/inheritance to target timeslices +*----------------------------------------------------------------------------- + LOOP(UNCD7(REG,P,COM,R,C,TS,''), + IF(RPCS_VAR(R,P,C,TS), +* Leveling by simultaneous aggregation/inheritance; but only if target level value is not present + LOOP(RTP(REG,V,P), TS_ARRAY(S) = IRE_FLO(REG,V,P,COM,R,C,S); + IRE_FLO(REG,V,P,COM,R,C,TS)$(NOT TS_ARRAY(TS)) $= + SUM(RS_TREE(FINEST(R,S),TS), G_YRFR(R,S) * (TS_ARRAY(S) + + SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(TS_MAP(R,SL,S)$RS_BELOW(R,ALL_TS,SL),TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), + TS_ARRAY(ALL_TS))))/G_YRFR(R,TS)); + ELSE MY_ARRAY(V) = IRE_FLO(REG,V,P,COM,R,C,TS); +* Simple direct inheritance down + IRE_FLO(RTP(REG,V,P),COM,R,C,S)$(RS_BELOW(R,TS,S)$RPCS_VAR(R,P,C,S)) $= MY_ARRAY(V);)); +*----------------------------------------------------------------------------- +OPTION CLEAR=UNCD7; + +*$OFFLISTING + diff --git a/pp_lvlpk.mod b/pp_lvlpk.mod new file mode 100644 index 0000000..5f44ff0 --- /dev/null +++ b/pp_lvlpk.mod @@ -0,0 +1,54 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLPK - levelization of NCAP_PKCNT +* %1 - Default value for leveling +*=============================================================================* +* Questions/Comments: +* - +*----------------------------------------------------------------------------- + SET RPC_PKC(R,P,C); + PARAMETER RPC_PKF(R,P,C) //; +*----------------------------------------------------------------------------- +* Collect PKTS for all COM_PEAK commodities + LOOP(COM_PKTS(R,CG,S), RCS(COM_TS(R,C,TS))$(RS_TREE(R,S,TS)$COM_GMAP(R,CG,C)) = YES); + TRACKC(R,C) $= SUM(RCS(R,C,S),1); +*----------------------------------------------------------------------------- +* Levelization of NCAP_PKCNT + OPTION RTP_ISHPR < NCAP_PKCNT; + TRACKPC(RPC(R,P,C))$((TOP(RPC,'OUT')+RPC_IRE(RPC,'IMP')+PRC_PKNO(R,P))$TRACKC(R,C)) = YES; + RTP_GRP(RTP_ISHPR(RTP(R,V,P)),C,IO('OUT'))$(SUM(RCS(R,C,S)$(NOT NCAP_PKCNT(R,V,P,S)),1)$TRACKPC(R,P,C)) = YES; + FLO_PKCOI(RTP(R,T,P),C,S)$(TRACKPC(R,P,C)$PRC_PKNO(R,P)) = 0; +*----------------------------------------------------------------------------- +* Aggregation/inheritance to target timeslices +*----------------------------------------------------------------------------- + LOOP(RTP_GRP(R,V,P,C,IO), TS_ARRAY(S) = NCAP_PKCNT(R,V,P,S); + F = TS_ARRAY('ANNUAL'); + IF((NOT SUM(RS_BELOW(R,ANNUAL,S)$TS_ARRAY(S),1))$F,NCAP_PKCNT(R,V,P,S)$RCS(R,C,S) = F; + ELSE +* Set leveling default = %1; + IF(NOT F,TS_ARRAY(ANNUAL) = %1); +* Simultaneous inheritance/aggregation; but only if target level value is not present + LOOP(RCS(R,C,TS)$(NOT TS_ARRAY(TS)), + NCAP_PKCNT(R,V,P,TS) $= + SUM(TS_MAP(R,TS,S)$FINEST(R,S), G_YRFR(R,S)/G_YRFR(R,TS) * (TS_ARRAY(S) + + SUM(RS_BELOW(R,ALL_TS,S)$((NOT SUM(SL$RS_BELOW(R,ALL_TS,SL),TS_MAP(R,SL,S)*TS_ARRAY(SL)))$TS_ARRAY(ALL_TS)), + TS_ARRAY(ALL_TS))))))); +*----------------------------------------------------------------------------- +* Peak contribution +* If PRC_PKAF, apply PKCNT only for capacity + TRACKP(PRC_PKAF(RP))=NOT PRC_PKNO(RP); RPC_PKF(TRACKPC(RP,C))=EPS**1$TRACKP(RP); + TRACKPC(PRC_PKNO(RP),C)=NO; +* If no PKCNT provided, Copy NCAP_AF if PRC_PKAF; Otherwise set default 1 + LOOP(TRACKPC(R,P,C),PRC_TS2(R,P,S)$((NOT SUM(RTP(R,V,P),NCAP_PKCNT(RTP,S)))$RCS(R,C,S)) = YES); + NCAP_PKCNT(RTP(R,V,P),S)$PRC_TS2(R,P,S) = 1$(NOT PRC_PKAF(R,P)) + + SUM(PRC_TS(R,P,TS)$RS_TREE(R,S,TS),SMAX(BD,NCAP_AF(RTP,TS,BD))*(1+(G_YRFR(R,TS)/G_YRFR(R,S)-1)$RS_BELOW(R,S,TS)))$PRC_PKAF(R,P); +*----------------------------------------------------------------------------- +* RPC_PKC indicator for peak contribution by capacity + RPC_PKC(TRACKPC(RPC_ACT(TRACKP(RP_STD),C)))=YES; + TRACKPC(RP,C)$(NOT RPC_PG(RP,C)*RP_FLO(RP))=NO; + RPC_PKC(TRACKPC(RP_PGACT(RP),C))$(RP_PG(RP,C)+TRACKP(RP))=YES; + LOOP(NRG_TMAP(R,'ELC',C)$TRACKC(R,C),RPC_PKC(TRACKPC(TRACKP(R,P),C))=YES;TRACKP(R,P)$TRACKPC(R,P,C)=NO); + OPTION CLEAR=TRACKP,CLEAR=TRACKC,CLEAR=TRACKPC,CLEAR=RTP_GRP,CLEAR=RCS,CLEAR=RTP_ISHPR,CLEAR=PRC_TS2; diff --git a/pp_lvlus.mod b/pp_lvlus.mod new file mode 100644 index 0000000..1fee593 --- /dev/null +++ b/pp_lvlus.mod @@ -0,0 +1,39 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_LVLUS aggregate/inherit UC_N attributes if at different than target level +* %1 - attribute name (UC_ACT, UC_FLO etc.) +* %2 - other qualifying indexes before S index (e.g. ',C') +* %3 - TS set shooting for (PRC_TS, RPCS etc.) +* %4 - UNCD7 residual dimension +* %5 - optional remaining indexes (e.g. 'IE') +* %6 - optional UC_N qualifying indexes (e.g. COM_VAR) +*=============================================================================* + OPTION CLEAR=UNCD7; + LOOP((UC_N%6,SIDE,R,T,%2,S%5)$%1(UC_N%6,SIDE,R,T,%2,S%5), + IF((NOT %3(R,%7%10,S))$STOA(S), + IF(NOT UNCD7(UC_N%6,SIDE,R,%2%5,'OUT'%4), UNCD7(UC_N%6,SIDE,R,%2%5,'OUT'%4)=YES; + F=SMAX(%7%8_TSL(R,%7,TSL),MAX(%9+EPS,ORD(TSL)-1)); IF(F1); + LOOP(FIL(T),RD_NLP(R,C)$(DDF_QREF(R,T,C)*DDF_PREF(R,T,C)*MI_DOPE(R,T,C)=0)=NO); + TRACKC(RD_AGG(RC))$=RD_NLP(RC); + RD_AGG(RC)$RD_NLP(RC)=NO; + +*----------------------------------------------------------------------------- + MI_ESUB(R,T,C)$TRACKC(R,C) = ROUND(MI_ESUB(R,T,C)*(1-5e-6),5)*(1+5e-6); + MI_RHO(R,T,C)$((MI_ESUB(R,T,C)>0)$TRACKC(R,C)) = 1-1/MI_ESUB(R,T,C); + RD_NLP(TRACKC(R,C))$PROD(FIL(T),MI_RHO(R,T,C)) = 3; + LOOP(MI_DMAS(R,C,COM)$(RD_NLP(R,C)>2),RD_NLP(R,COM)=-1); + RCJ(RC,J,BD)$RD_NLP(RC)=NO; + OPTION CLEAR=TRACKC; +*----------------------------------------------------------------------------- +* Calculate demand function parameters + RD_SHAR(R,T(FIL),C,COM)$(MI_DMAS(R,C,COM)$RD_NLP(R,C)) = COM_AGG(R,T,COM,C)*DDF_QREF(R,T,COM)/DDF_QREF(R,T,C)*(DDF_PREF(R,T,COM)/COM_AGG(R,T,COM,C)/DDF_PREF(R,T,C))**MI_ESUB(R,T,C); + MI_ELASP(R,T(FIL),C)$((RD_NLP(R,C)>1)$DEM(R,C)) = 1 - 1/MI_DOPE(R,T,C); + MI_CCONS(R,T(FIL),C)$((RD_NLP(R,C)>1)$DEM(R,C)) = DDF_PREF(R,T,C)*(1/MI_ELASP(R,T,C))*DDF_QREF(R,T,C)**(1/MI_DOPE(R,T,C)); + +* DISPLAY RD_NLP,MI_CCONS,MI_ELASP,RD_SHAR; +*----------------------------------------------------------------------------- +* Bounds section + COM_VOC(R,T,C,BDNEQ(BD))$((NOT COM_VOC(R,T,C,BD))$RD_NLP(R,C)) = 1; + VAR_DEM.L(R,T,C)$RD_NLP(R,C) = DDF_QREF(R,T,C); + VAR_DEM.UP(R,T,C)$RD_NLP(R,C) = DDF_QREF(R,T,C)*(1+COM_VOC(R,T,C,'UP')); + VAR_DEM.LO(R,T,C)$RD_NLP(R,C) = DDF_QREF(R,T,C)*MAX(.1,1-COM_VOC(R,T,C,'LO')); + VAR_DEM.FX(R,T(MIYR_1),C)$RD_NLP(R,C) = DDF_QREF(R,T,C); + VAR_OBJELS.LO(R,'FX',CUR)$RDCUR(R,CUR) = -INF; diff --git a/pp_off.mod b/pp_off.mod new file mode 100644 index 0000000..ea64d93 --- /dev/null +++ b/pp_off.mod @@ -0,0 +1,23 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_OFF sets to Start/End of the OFF period range +* %1 - OFF Set name +* %2 - 'C'ommodity/'P'rocess index indicator +* %3 - control set +* %4 - Table to set for each off-range with qualifier and one open ( +* %5 - The value for the off range (EPS/NO) +*=============================================================================* +* Comments: Depends on BOHYEAR/EOHYEAR being ordered 1 higher than ALLYEAR +*----------------------------------------------------------------------------- +*$ONLISTING +* Cope with multiple OFF-ranges + OPTION CLEAR=FIL; + LOOP(%1(R,%2,BOHYEAR,EOHYEAR)%3, STARTOFF=ORD(BOHYEAR)-2; ENDOFF=ORD(EOHYEAR); +* set the flags of the shutoff period + FIL(EOHYEARS(LL))$((ORD(LL) > STARTOFF)$(ORD(LL) < ENDOFF)) = YES); +* open ( + %4(SUM(PERIODYR(T,FIL),1)/D(T) GE G_OFFTHD(T))$FIL(T)) = %5; +*$OFFLISTING diff --git a/pp_prelv.vda b/pp_prelv.vda new file mode 100644 index 0000000..fd281b5 --- /dev/null +++ b/pp_prelv.vda @@ -0,0 +1,116 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* pp_prelvl.vda - Auxiliary preprocessing before levelizing +*=============================================================================* +* To be called AFTER establishing RTCS_VARC and RPCS_VAR. +*----------------------------------------------------------------------------- +* Restore NCAP_TLIFE for RESID + LOOP(PYR_S(V),NCAP_TLIFE(R,V,P)$PRC_RESID(R,'%DFLBL%',P) = PRC_RESID(R,'%DFLBL%',P)); +*============================================================================= +* For filtering VDA_FLOP, check ACT_EFF groups + TRACKPC(RPC_SPG(R,P,C))$((NOT RPG_1ACE(R,P,C,C))$RPC_ACE(R,P,%PGPRIM%)) = YES; + Z = CARD(VDA_FLOP); + VDA_FLOP(R,LL,P,C,S)$((NOT KEEP_FLOF(R,P,C))$TRACKPC(R,P,C)) = 0; +$IFI %SHELL%==ANSWER PRC_ACTFLO(R,LL,P,C)$((NOT KEEP_FLOF(R,P,C))$TRACKPC(R,P,C)) = 0; + Z = Z-CARD(VDA_FLOP); IF(Z, DISPLAY 'DELETED FLOPS FOR SPG:',Z); +* Residual values + ACT_FLO(R,LL,P,C,S)$(RPC_PG(R,P,C)+RPS_PRCTS(R,P,S)) = 0; + OPTION RPC_AFLO < ACT_FLO, CLEAR=ACT_FLO,CLEAR=TRACKPC,CLEAR=KEEP_FLOF; + ACT_FLO(R,V,P,C,S)$RPC_AFLO(R,P,C) $= VDA_FLOP(R,V,P,C,S); + VDA_FLOP(RTP,C,S)$ACT_FLO(RTP,C,S) = 1; +*----------------------------------------------------------------------------- +* Preprocessing of VDA_FLOP after establishing PRC_SPG + OPTION RP_GRP < VDA_FLOP; + TRACKPC(RP_GRP(RPC)) = YES; +* RP_GRP contains only CGs that are not in topology, but include some C in RPC + RP_GRP(TRACKPC) = NO; + RP_GRP(R,P,CG)$(NOT SUM(RPC(R,P,C)$COM_GMAP(R,CG,C),1)) = NO; +* Set PRC_CG now automatically + PRC_CG(RP_GRP) = YES; +*----------------------------------------------------------------------------- +* Identify processes with PG-based FLO_SUMs + LOOP(TRACKPC(RPC_PG(R,P,C)),TRACKP(R,P)=YES); +* Add default value for PG commodities not in TRACKPC + VDA_FLOP(RTP(R,V,P),C,ANNUAL)$((RPC_PG(R,P,C)*(NOT TRACKPC(R,P,C)))$TRACKP(R,P)) = 1; +* Remove all PG commodities from TRACKPC: + TRACKPC(RPC_PG) = NO; +*----------------------------------------------------------------------------- +* Partition the groups into direct/PG based ones + CG_GRP(RP_PG(R,P,CG2),CG)$RP_GRP(R,P,CG) = YES; + RPCC_FFUNC(CG_GRP(TRACKP(R,P),CG2,CG))$SUM(RPC_SPG(R,P,C)$COM_GMAP(R,CG,C),1) = YES; + CG_GRP(RPCC_FFUNC) = NO; OPTION CLEAR=RP_GRP; +*----------------------------------------------------------------------------- +* Remove from TRACKP those processes for which CG has been defined: + LOOP(RPCC_FFUNC(R,P,CG2,CG),TRACKP(R,P) = NO); +* Add into FFUNC single SPG commodities for remaining TRACKP: + TRACKP(RP)$(SUM(RPC_SPG(TRACKPC(RP,C)),1)<>1) = NO; + RPCC_FFUNC(RP_PG(TRACKP(RP),CG),C) $= SUM(RPC_SPG(TRACKPC(RP,C)),1); + TRACKPC(RPC_SPG(TRACKP,C)) = NO; +*----------------------------------------------------------------------------- +* VDA_FLOP is in the direction from the PG to the CG: + FLO_FUNC(RTP(R,V,P),CG2,CG,S)$RPCC_FFUNC(R,P,CG2,CG) = VDA_FLOP(RTP,CG,S); +*----------------------------------------------------------------------------- +* Set FLO_SUM for individual commodities in PG: + FLO_SUM(RTP(R,V,P),CG2,C,CG,S)$(RPC_PG(R,P,C)$RPCC_FFUNC(R,P,CG2,CG)) = VDA_FLOP(RTP,C,S)*(1/PRC_ACTFLO(RTP,C)); +* Set FLO_SUM for groups of commodities: + FLO_SUM(RTP(R,V,P),CG2,C,CG,S)$(RPC_PG(R,P,C)$CG_GRP(R,P,CG2,CG)) = VDA_FLOP(RTP,CG,S)*(1/PRC_ACTFLO(RTP,C)); +* Finally, handle single commodities without a group (and not in PG either) + FLO_SUM(RTP(R,V,P),CG,C,COM,S)$(RP_PG(R,P,CG)*RPC_PG(R,P,C)*TRACKPC(R,P,COM)) $= VDA_FLOP(RTP,COM,S)*(1/PRC_ACTFLO(RTP,C)); + FLO_FUNC(RTP(R,V,P),ACTCG,C,ANNUAL(S))$((FLO_FUNCX(RTP,ACTCG,C)<0)$TRACKPC(R,P,C)) $= VDA_FLOP(RTP,C,S); + OPTION CLEAR=TRACKP,CLEAR=TRACKPC,CLEAR=VDA_FLOP,CLEAR=CG_GRP,CLEAR=RPCC_FFUNC; +*----------------------------------------------------------------------------- +* Distribute IRE_FLOSUM for ACT; Ignore possible overwriting for now + PRC_ACTFLO(R,V,P,C) $= FLO_EMIS(R,V,P,%PGPRIM%,C,'ANNUAL')$PRC_MAP(R,'STG',P); + IRE_FLOSUM(R,V,P,C(ACTCG),S,IE,COM,'OUT') $= FLO_EMIS(R,V,P,C,COM,S)$RP_AIRE(R,P,IE); +* Preprocessing of FLO_EMIS + OPTION RP_CGC <= FLO_EMIS; + FLO_EMIS(RTP(R,V,P),C,C,S)$(RP_CGC(R,P,C,C)$RPC_PG(R,P,C)) = 1+(FLO_EMIS(RTP,C,C,S)-1)/PRC_ACTFLO(RTP,C); + RP_CGC(RP_IRE(R,P),CG,C)=NO; RP_CGC(RPC_STG,C)=NO; + RPCC_FFUNC(RP_CGC(RPC,COM)) = YES; + RP_CGC(RPCC_FFUNC(RPC,COM)) = NO; + RPC_EMIS(R,P,C)$SUM(RPCC_FFUNC(R,P,COM,C),1) = NO; +* Add groups of source commodities + FSCK(RP_CGC(R,P,CG,COM),C)$(COM_GMAP(R,CG,C)$RPC(R,P,C)) = YES; + LOOP(FSCK(R,P,CG,COM,C), FLO_SUM(R,V,P,COM,C,COM,S) $= FLO_EMIS(R,V,P,CG,COM,S); RPC_EMIS(R,P,COM) = NO); +* Add activity sources + FLO_SUM(RTP(R,V,P),COM,C,COM,S)$(RPC_PG(R,P,C)$RP_CGC(R,P,%PGPRIM%,COM)) = FLO_EMIS(RTP,%PGPRIM%,COM,S)/PRC_ACTFLO(RTP,C); + RP_CGC(R,P,%PGPRIM%,C) = NO; PUTGRP=0; + LOOP(RP_CGC(R,P,CG,COM)$RPC_EMIS(R,P,COM), +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'FLO_EMIS with no members of source group in process - ignored' + PUT QLOG ' WARNING - R=',%RL%,' P=',%PL%,' CG=',CG.TL,' COM=',COM.TL; + ); + FLO_SUM(RTP(R,V,P),COM,C,COM,ANNUAL)$RPC_PG(R,P,C) $= SUM(RP_CGC(R,P,CG,COM)$RPC_EMIS(R,P,COM),EPS); +* Add single source commodities + OPTION CLEAR=RP_CGC, CLEAR=FSCK, CLEAR=RPC_EMIS, CG_GRP < RPCC_FFUNC; + FLO_SUM(RTP(R,V,P),C,COM,C,S)$CG_GRP(R,P,C,COM) = FLO_EMIS(RTP,COM,C,S); + FLO_EFF(RTP(R,V,P),C,COM,S)$((NOT CG_GRP(R,P,C,COM))$RPC_PG(R,P,COM)$CHP(R,P)) $= FLO_EMIS(RTP,%PGPRIM%,C,S); + OPTION CLEAR=CG_GRP,CLEAR=RPCC_FFUNC,CLEAR=FLO_EMIS; +*============================================================================= +* Other preprocessing stuff for the VEDA interface +*============================================================================= +* Remove non-standard shares from FLO_SHAR + FLO_ASHAR(R,DM_YEAR,P,C,CG,S,BD) $= FLO_SHAR(R,DM_YEAR,P,C,CG,S,BD)$(NOT RP_STD(R,P)); + FLO_SHAR(R,LL,P,C,CG,S,BD)$FLO_ASHAR(R,LL,P,C,CG,S,BD) = 0; + NCAP_CHPR(RTP(R,V,P),'N') $= NCAP_CHPR(R,'0',P,'N'); +* Support for levelised FLO_FR + RPC_CONLY(RTP,C) $=SUM(L$FLO_FR(RTP,C,'ANNUAL',L),1); +$ BATINCLUDE pp_lvlfc.mod FLO_FR 'P,C' RPCS_VAR ',BD' ",'0','0'" ALL_TS T RPC_CONLY(R,T,P,C) + FLO_FR(RPC_CONLY(R,T,P,C),S,'N')=MIN(1,SUM(RS_BELOW1(R,S,TS)$RPCS_VAR(R,P,C,TS),G_YRFR(R,TS)))$TS_CYCLE(R,S); + FLO_FR(RPC_CONLY(R,T,P,C),S,BD)$FLO_FR(R,T,P,C,S,BD)=FLO_FR(R,T,P,C,S,BD)*G_YRFR(R,S)$RPCS_VAR(R,P,C,S); + OPTION CLEAR=RPC_CONLY; +* Call the powerflo extension +$IFI %POWERFLO%==YES $include powerflo.vda +*----------------------------------------------------------------------------- +* Set COM_VAR default bounds + COM_BNDNET(R,T,C,ANNUAL(S),'N')$(NOT COM_BNDNET(R,T,C,S,'N')) $=COM_BNDNET(R,'0',C,S,'N'); + COM_BNDNET(RTCS_VARC(RTC,S),BDLOX(BD))$((NOT COM_BNDNET(RTC,S,BD))$COM_BNDNET(RTC,'ANNUAL','N')) = + (EPS-INF$BDNEQ(BD))$(-SIGN(COM_BNDNET(RTC,'ANNUAL','N'))=1$BDNEQ(BD)); + COM_BNDPRD(R,T,C,ANNUAL(S),'N')$(NOT COM_BNDPRD(R,T,C,S,'N')) $=COM_BNDPRD(R,'0',C,S,'N'); + COM_BNDPRD(RTCS_VARC(RTC,S),BDLOX(BD))$((NOT COM_BNDPRD(RTC,S,BD))$COM_BNDPRD(RTC,'ANNUAL','N')) = + (EPS-INF$BDNEQ(BD))$(-SIGN(COM_BNDPRD(RTC,'ANNUAL','N'))=1$BDNEQ(BD)); +*----------------------------------------------------------------------------- +* Remove timeslices turned off if DYNTS enabled +$IF NOT %RTS%==S $BATINCLUDE dynslite.vda PRELEV \ No newline at end of file diff --git a/pp_qack.mod b/pp_qack.mod new file mode 100644 index 0000000..e8a1148 --- /dev/null +++ b/pp_qack.mod @@ -0,0 +1,373 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_QACK.MOD perform the individual quality control checks +* %1 - mod or v# for the source code to be used +*=============================================================================* +*GaG Questions/Comments: +* - Provide control mechansim to turn-off (ALL, NOFATAL, NONE) tests +*------------------------------------------------------------------------------ +* Pending Tests: +* - check that each process consumes/produces a commodity +* - check that each commodity is both produced/consumed +* - TOP not violated by reference to COM not in TOP/T/X +* - every process has PRC_ACTUNT/CAPUNT specified? +* - not both COM_NETBND and COM_PRDBND (or does not matter?) + COM_PROJ +* - check that any commodity/ts-index attribute OK according to COM_TS +* - c=OCOM+NCAP_VALU+input to another process, otherwise warning +* - check that FLO_FUNC/SHAR/SUM cg has all elements on the same side +* - if PRC_ANN and non-ANNUAL attribute provided give warning +* - check that all attributes s-index match up with RPS and the individual commodities +* - warning that "NRG" used if no group matching the PG and PRC_SPG not provided +* - No PRC_CAPUNIT/ACTUNIT assigned and > 1 input; fatal? +* - PRC_CAPUNIT/ACTUNIT cg should be the same; serious? +* - Check that anticipated mapping list members that may affect matrix generation are provided (e.g., FRE/LIMRENEW) +* - check the TS associated with any attribute (as well as COM/PRC_TS) is OK +* - check that if list of peak timeslices provided by the user then actual peak is in said list +* - check that all FLO_* c/cg somehow relate to the PG/SPG (ouch) +* - if TOP_IRE to/from an external check for IRE_BND/PRICE/XBND +* - check that PRC_TSL=COM_TSL=COM_FR for DEM commodities +* - check that TS-attributes are found in TS_GROUP/MAP for the region (during Aggr/Inher) +* - or see what is around for TS_GROUP (TS_MAP if > 2 levels) and G_YRFR at the min!!! +* - check that no 0/EPS for attributes that could turn-off a flow, or cause a 0 divide +*----------------------------------------------------------------------------- +*V0.5c 980904 - File opened in PPMAIN.MOD, setup to append in case any PP_MAIN messages output +* FILE QLOG / QA_CHECK.LOG /; + ALIAS(U2,U3,U4,*); + PUT QLOG; + IF(PUTOUT, QLOG.AP = 1); + +* make 2 decimals points and allow for wider page + QLOG.NW=10;QLOG.ND=2;QLOG.PW=150; + + PUTGRP = 0; +*----------------------------------------------------------------------------- +* Some important control sets are completed here +* Complete merely CAP dependent flow indicators + RPC_CONLY(RTPC(R,T,P,C))$RPC_NOFLO(R,P,C) = YES; +* Complete flow variable indicators + RTPCS_VARF(RPC_CONLY(R,T,P,C),S) = NO; +* Remove superfluous entries from RCS_COMBAL + RCS_COMBAL(RHS_COMBAL,BDNEQ) = NO; +* Establish the RPG_RED control set + TRACKPC(R,P,C)$(RPC_ACT(R,P,C)+RPC_FFUNC(R,P,C)+RPC_EMIS(R,P,C)) = YES; + RPG_RED(R,P,CG,IO)$(NOT SUM(TOP(TRACKPC(R,P,C),IO)$COM_GMAP(R,CG,C),1)) = NO; + OPTION CLEAR = TRACKPC; +$ IFI %VAR_UC%==YES OPTION UC_GMAP_U<=UC_UCN; + RTP(NO_RVP) = NO; +*----------------------------------------------------------------------------- +* Year fractions +*----------------------------------------------------------------------------- + LOOP(R, TS_ARRAY(S) = 0; + LOOP(TS_MAP(R,TS,S)$(G_YRFR(R,S) EQ 0), TS_ARRAY(S) = 1;); + LOOP(S$TS_ARRAY(S), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 99 'Year Fraction G_YRFR is ZERO!' + PUT QLOG ' FATAL ERROR - R=',%RL%,' S=',S.TL; + )); + PUTGRP = 0; +*----------------------------------------------------------------------------- +* Topology +*----------------------------------------------------------------------------- +* Check PGPRIM + LOOP(RPC(R,P,C(%PGPRIM%)), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 99 'Illegal system commodity in topology.' + PUT QLOG ' FATAL ERROR - R=',%RL%,' P=',%PL%,' C=',C.TL; + ); + PUTGRP = 0; Z = 1; +* see that components of any CG for a process in topology + LOOP(PRC_CG(R,P,CG)$(NOT COM_TYPE(CG)), + Z = NOT SUM(COM_GMAP(R,CG,C)$RPC(R,P,C),1); + LOOP(COM_GMAP(R,CG,C)$((NOT RPC(R,P,C))$Z), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 10 'Commodity in CG of process P but not in topology' + PUT QLOG ' SEVERE WARNING - R=',%RL%,' P=',%PL%,' C=',%CL%,' CG=',CG.TL ; + ) + ); + PUTGRP = 0; +*----------------------------------------------------------------------------- +* Commodity description +*----------------------------------------------------------------------------- +$IF NOT %TIMESED%==YES $SETLOCAL TIMESED NO + IF(%TIMESED%, FORWARD(T)=YES; +$IF DEFINED SOL_BPRICE OPTION FORWARD < SOL_BPRICE; + LOOP(T$(NOT FORWARD(T)), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 09 'Elastic Demand but missing BPRICE for some MILESTONYR - using tail extrapolation' + PUT QLOG ' WARNING - Missing BPRICE, MILESTONYR=',T.TL); + PUTGRP = 0; + LOOP(DEM(R,C)$SUM(BD$COM_STEP(R,C,BD),1), +* Check that elastic demands fully sprecifed + IF((NOT SUM((T,S,CUR)$COM_BPRICE(R,T,C,S,CUR),1)) + + (NOT SUM((T,BD)$COM_VOC(R,T,C,BD),1)) + + (NOT SUM((T,S,BD)$COM_ELAST(R,T,C,S,BD),1)), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 10 'Elastic Demand but either COM_BPRICE/ELAST/VOC missing' + PUT QLOG ' WARNING - R=',%RL%,' C=',%CL% ; + ) + ); + ); + PUTGRP = 0; + LOOP(RC(R,C(COM_TYPE)), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 99 'Commodity type is also a commodity' + PUT QLOG ' FATAL ERROR - R=',%RL%,' C=',C.TL ; + ); + PUTGRP = 0; + LOOP(RC(R,C)$(SUM(COM_TMAP(R,COM_TYPE,C),1) NE 1), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 09 'Commodity has ambiguous base type' + IF(SUM(COM_TMAP(R,COM_TYPE,C),1) GT 1, + PUT QLOG ' FATAL ERROR - Several types: R=',%RL%,' C=',C.TL ; + ELSE PUT QLOG ' FATAL ERROR - Missing type : R=',%RL%,' C=',C.TL ;); + ); + PUTGRP = 0; +*----------------------------------------------------------------------------- +* Demand description +*----------------------------------------------------------------------------- + OPTION TRACKC < RD_SHAR; + LOOP((R,T,C)$COM_PROJ(R,T,C),TRACKC(R,C) = YES); + LOOP(COM_GMAP(DEM(R,C),C)$(NOT TRACKC(R,C)), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Demand: DEM commodity with missing COM_PROJ Projection' + PUT QLOG ' WARNING - R=',%RL%,' C=',C.TL ; + ); + PUTGRP = 0; + LOOP(TRACKC(R,C)$(NOT DEM(R,C)), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Demand: COM_PROJ specified for non-DEM commodity' + PUT QLOG ' WARNING - R=',%RL%,' C=',C.TL ; + ); + OPTION CLEAR=TRACKC; + PUTGRP = 0; +*----------------------------------------------------------------------------- +* Process description +*----------------------------------------------------------------------------- + SET QASTAT(J) / 1 'Unreliable (see QA_Check.log)' /; + OPTION TRACKPC43 / @15; + WHILE(QLOG.CC<67,PUT '*****'); PUT @29,'QUALITY ASSURANCE LOG':<>27; + ); + PUT$(NOT %2) QLOG // ' *** %4 '; + +* hold highest errorlevel for shutdown or not +$IF NOT %3==* %2=1+1$(ROUND(%3)>9); PUT QLOG / ' *00'@(5-%2) MIN(99,%3):%2:0; ERRLEV$(%3>ERRLEV)=%3; diff --git a/pp_reduce.red b/pp_reduce.red new file mode 100644 index 0000000..b3b9dce --- /dev/null +++ b/pp_reduce.red @@ -0,0 +1,184 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* Reduction of model size +*----------------------------------------------------------------------------- +* when no reduction all processes have capacity variables and activity equations + PRC_CAP(RP) = YES; + PRC_ACT(RP) = RP_STD(RP)+RP_IRE(RP); + OPTION RP_AFB < NCAP_AF; + +$SETGLOBAL CAL_RED 'cal_nored.red' +* skip reduction algorithm by setting REDUCE to NO in run file +$IF %REDUCE% == NO $GOTO REDDONE + +*----------------------------------------------------------------------------- +* limiting the number of capacity variables +*----------------------------------------------------------------------------- +* determining processes that need capacity variables + PRC_CAP(RP) = NO; + LOOP((R,UC_N,P)$UC_GMAP_P(R,UC_N,'CAP',P), PRC_CAP(R,P) = YES); + LOOP((R,UC_N,P)$UC_GMAP_P(R,UC_N,'NCAP',P), PRC_CAP(R,P) = YES); + LOOP((RTP(R,PYR,P))$NCAP_PASTI(R,PYR,P), PRC_CAP(R,P) = YES); + LOOP((RTP(R,T,P),BD)$CAP_BND(R,T,P,BD), PRC_CAP(R,P) = YES); + LOOP((RTP(R,T,P),BD)$NCAP_BND(R,T,P,BD), PRC_CAP(R,P) = YES); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_COST(R,LL,P,CUR) NE 0); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_FOM(R,LL,P,CUR) NE 0); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_ISUB(R,LL,P,CUR) NE 0); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_ITAX(R,LL,P,CUR) NE 0); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_FSUB(R,LL,P,CUR) NE 0); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_FTAX(R,LL,P,CUR) NE 0); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_DCOST(R,LL,P,CUR) NE 0); + OBJ_ICUR(R,LL--ORD(LL),P,CUR)$DM_YEAR(LL) $= (NCAP_DLAGC(R,LL,P,CUR) NE 0); + LOOP(OBJ_ICUR(R,LL,P,CUR), PRC_CAP(R,P) = YES); +*[UR]: added checks for fixed availabilities + PRC_CAP(RP(R,P)) $= RP_AFB(RP,'FX'); + RTPS_BD(R,T--ORD(T),P,S--ORD(S),'FX') $= NCAP_AFS(R,T,P,S,'FX'); + RTPS_BD(R,T--ORD(T),P,ANNUAL,'FX') $= NCAP_AFA(R,T,P,'FX'); + LOOP(RTPS_BD(R,T,P,S,BD), PRC_CAP(R,P) = YES); + OPTION CLEAR=OBJ_ICUR,CLEAR=RTPS_BD; +$IF '%ETL%'==YES PRC_CAP(R,P)$SEG(R,P) = YES; + +*-------------------------------------------------------------------------------------------- +* Occurence of emission flow variable can be replaced by term (source flow x emission factor) +*-------------------------------------------------------------------------------------------- + OPTION CLEAR=TRACKPC; +* Get emission commodity candidates: + TRACKPC(RP_STD(R,P),C)$(TOP(R,P,C,'OUT')$ENV(R,C)) = YES; + TRACKPC(RPC_PG) = NO; + +* Select only those emissions that have been modeled with FLO_SUM on input flows + OPTION FSCK <= FLO_SUM; + FS_EMIS(FSCK(R,P,CG,C,COM))$((COM_GMAP(R,CG,C)$TOP(R,P,C,'IN'))$TRACKPC(R,P,COM)) = YES; + LOOP(FS_EMIS(R,P,CG,C,COM), RPC_EMIS(R,P,COM) = YES); +*------------------------------------------------------------------------------------------ +$IF NOT %REDUCE% == YES $GOTO REDDONE +$SETGLOBAL CAL_RED 'cal_red.red' +*-------------------------------------------------------------- +* only 1 commodity in PCG +* => corresponding VAR_FLO can be replaced by VAR_ACT indicated +* these cases are stored in RPC_ACT +*-------------------------------------------------------------- + RPC_ACT(RPC_PG(RP_PGACT(RP_STD),C)) = YES; + +* VAR_IRE can be replaced by VAR_ACT if only 1 import or export commodity + RPC_AIRE(RPC_PG(RP_IRE(RP_PGACT),C)) = YES; + +* If activity is substituted for the primary flow, EQ_ACTFLO is not needed + PRC_ACT(RP_PGACT) = NO; +*-------------------------------------------------------------------------------------------- +* Process without capacity variable and without activity related parameters +* does not need activity variable +*-------------------------------------------------------------------------------------------- + NO_ACT(PRC_ACT(R,P))$(NOT PRC_CAP(R,P)) = YES; + LOOP((RTP(R,T,P),S,BD)$((ACT_BND(RTP,S,BD)>-INF$BDUPX(BD))$ACT_BND(RTP,S,BD)), NO_ACT(R,P) = NO); + LOOP((R,DM_YEAR,P,CUR)$ACT_COST(R,DM_YEAR,P,CUR), NO_ACT(R,P) = NO); + LOOP((R,UC_N,P)$UC_GMAP_P(R,UC_N,'ACT',P), NO_ACT(R,P) = NO); + NO_ACT(R,P)$SUM(RPC_CUMFLO(R,P,%PGPRIM%,YEAR,LL),1) = NO; + +* Remove activity equation from processes that didn't have activity attributes + PRC_ACT(NO_ACT) = NO; +* Keep RTP_VARA even when no VAR_ACT is needed +**RTP_VARA(R,T,P)$NO_ACT(R,P) = NO; + +*-------------------------------------------------------------------------------------------- +* If FLO_FUNC between two flow variables and one flow variable defines the activity, +* the other flow variable can be expressed by the activity variable +*-------------------------------------------------------------------------------------------- +* check whether commodity defining activity is involved in FLO_FUNC + +* Get all FLO_FUNCs between single-commodity groups + OPTION CG_GRP <= FLO_FUNC; CG_GRP(R,P,CG,CG) = NO; + CG_GRP(R,P,CG,CG2)$(SUM(RPC(R,P,C)$COM_GMAP(R,CG,C),1) NE 1) = NO; + CG_GRP(R,P,CG1,CG)$(SUM(RPC(RP_PGACT(R,P),C)$COM_GMAP(R,CG,C),1) NE 1) = NO; + RPCG_PTRAN(RPC(R,P,C),COM,CG1,CG2)$((COM_GMAP(R,CG1,C)*RPC(R,P,COM)*COM_GMAP(R,CG2,COM))$CG_GRP(R,P,CG1,CG2)) = YES; +* Ensure that possible reverse ordering due to FLO_SUM is taken into account + LOOP(FSCK(R,P,CG1,C,CG2)$CG_GRP(R,P,CG2,CG1),RPCG_PTRAN(R,P,C,COM,CG1,CG2)$COM_GMAP(R,CG2,COM) = YES); + RPCG_PTRAN(R,P,C,COM,CG1,CG2)$(NOT (RPC_ACT(R,P,C)+RPC_ACT(R,P,COM))) = NO; + OPTION TRACKPC < RPCG_PTRAN; + +* Check all processes for commodity-to-commodity FLO_SUM: + OPTION RP_CGG < FSCK; + RPCG_PTRAN(RP_CGG(RPC_ACT(R,P,COM),C,CG),C)$(RP_PG(R,P,CG)+RPC_ACT(R,P,CG)) = YES; + RPCG_PTRAN(RP_CGG(RPC(R,P,COM),C,COM),C)$RPC_ACT(R,P,C) = YES; +* If shadow group has special level, don't substitute + RPCG_PTRAN(RP_SGS,C,COM,CG,CG2) = NO; + LOOP(RPCG_PTRAN(RP_FLO(R,P),C,COM,CG,CG2), + IF(RPC_ACT(R,P,C), RPC_FFUNC(R,P,COM) = YES; ELSE RPC_FFUNC(R,P,C) = YES); + ); +* Remove activity flows and emission flows from RPC_FFUNC + RPC_FFUNC(RPC)$(RPC_ACT(RPC)+RPC_EMIS(RPC)) = NO; + RPC_FFUNC(RPC_AFLO(TRACKPC)) = NO; + +* Add to RPCC_FFUNC all the CG1-CG2 PTRANS equations that are to be eliminated: + RPCG_PTRAN(R,P,C,COM,CG,CG2)$(NOT (RPC_FFUNC(R,P,C)+RPC_FFUNC(R,P,COM))) = NO; + LOOP(RPCG_PTRAN(R,P,C,COM,CG,CG2), RPCC_FFUNC(R,P,CG,CG2) = YES); + + OPTION CLEAR=CG_GRP,CLEAR=RP_CGG; +*-------------------------------------------------------------------------------------------- +* If upper/fixed ACT_BND of zero at a higher TS-level than PRC_TS, +* do not generate EQL/E_ACTBND equation but add upper/fixed bound +* of zero to the VAR_ACT variables in bnd_act.mod +*-------------------------------------------------------------------------------------------- +* (RTP_VARA(r,t,p) will be deleted if only all PRC_TS are fixed to zero in t) + LOOP((R,T,P,S,BDUPX)$((ACT_BND(R,T,P,S,BDUPX) EQ 0)$ACT_BND(R,T,P,S,BDUPX)), + RTPS_OFF(R,T,P,S)$RPS_PRCTS(R,P,S) = YES); + +* Handle any earlier clearing of VARF + LOOP((RTPCS_OUT(R,T,P,C,S),RPCS_VAR(RP_STD(R,P),C,S)), + IF(RPC_FFUNC(R,P,C), RTPS_OFF(R,T,P,TS)$(PRC_TS(R,P,TS)*RS_TREE(R,S,TS)) = YES; + ELSEIF RPC_ACT(R,P,C), RTPS_OFF(R,T,P,S) = YES)); + +*-------------------------------------------------------------------------------------------- +* Process with upper/fixed activity of zero cannot be used in current period +*-------------------------------------------------------------------------------------------- + OPTION CLEAR=RXX; +* Track commodities turned off by some process, by T, timeslice and IO: + LOOP(RTPS_OFF(R,T,P,S),IF(RP_STD(R,P),RTCS_SING(R,T,C,S,IO)$TOP(R,P,C,IO) = YES; + ELSE RTCS_SING(R,T,C,S,'OUT')$RPC_IRE(R,P,C,'IMP') = YES)); +* Track commodities turned off by some process, by IO only: + LOOP(RTCS_SING(R,T,C,S,IO),RXX(R,C,IO) = YES); + RXX(ENV,'IN') = NO; RXX(DEM,'IN') = NO; RXX(R,C,'IN')$RC_AGP(R,C,'LO') = NO; + LOOP((R,T,COM,C)$(RXX(R,C,'OUT')$COM_AGG(R,T,COM,C)),TRACKC(R,C) = YES); + RXX(TRACKC,'OUT') = NO; + RC_IOP(RXX(R,C,IO),P)$TOP(R,P,C,IO) = YES; + RC_IOP(RXX(R,C,'IN'),P)$RPC_IRE(R,P,C,'EXP') = YES; + RC_IOP(RXX(R,C,'OUT'),P)$RPC_IRE(R,P,C,'IMP') = YES; +* Check whether commodity is produced by only one process (including STG, consider e.g. STG_CHRG) + RXX(RXX(R,C,IO))$(SUM(RC_IOP(R,C,IO,P),1) NE 1) = NO; + RTCS_SING(R,T,C,S,IO)$(NOT RXX(R,C,IO)) = NO; + +* turning off all processes in linking to RTCS_SING + LOOP(RTCS_SING(R,T,C,S,IO--1), + LOOP(TOP(R,P,C,IO)$(SUM(COM$TOP(R,P,COM,IO),1)=1), RTPS_OFF(R,T,P,S)$RPS_PRCTS(R,P,S) = YES)); +* turn off RHS_COMPRD if single producer is turned off + RHS_COMPRD(R,T,C,S)$RTCS_SING(R,T,C,S,'OUT') = NO; + OPTION CLEAR=TRACKC,CLEAR=RC_IOP; +*-------------------------------------------------------------------------------------------- + RTPS_OFF(RTPS_OFF(R,T,P,S))$PRC_MAP(R,'STG',P) = NO; + RTPS_OFF(R,T,P,TS) $= SUM(RS_BELOW(R,S,TS)$RTPS_OFF(R,T,P,S),YES); +* Set EPS bounds for PRC_TS timeslices, removing the EPS bounds above + ACT_BND(RTPS_OFF(RTP_VARA(R,T,P),S),'UP')$PRC_TS(R,P,S) = EPS; + ACT_BND(RTPS_OFF(R,T,P,S),BD)$(NOT PRC_TS(R,P,S)) = 0; + +* all flows of process with RTPS_OFF entry are forced to zero +* hence flow variable is not required + RTPCS_OUT(RTPC(RTP(R,T,P),C),S)$RTPS_OFF(R,T,P,S) = YES; + RTP_VARA(R,T,P)$(SUM(PRC_TS(R,P,TS)$(NOT RTPS_OFF(R,T,P,TS)),1) EQ 0) = NO; + +*-------------------------------------------------------------------------------------------- + +$LABEL REDDONE + +*-------------------------------------------------------------------------------------------- +* Mark emissions to be handled by substitution + LOOP(FS_EMIS(R,P,CG,C,COM), RPCC_FFUNC(R,P,CG,COM) = YES); + OPTION CLEAR=TRACKPC,CLEAR=FSCK; + PRC_TS2(PRC_TS(RP_PGACT(RP_STD),S)) = YES; + RPC_PKC(RP,C)$(NOT PRC_CAP(RP)) = NO; + RPC_PKF(RPC_PKC) = 0; + +* Remove timeslices turned off if DYNTS enabled +$IF NOT %RTS%==S $BATINCLUDE dynslite.vda REDUCE diff --git a/pp_shapr.mod b/pp_shapr.mod new file mode 100644 index 0000000..5691f3f --- /dev/null +++ b/pp_shapr.mod @@ -0,0 +1,46 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PP_SHPRC.MOD shape a process based attribute +* %1 - attribute name +* %2 - driving indexes +* %3 - any qualifiers to help narrow loop (if none, set to YES) +* %4 - mapped coefficient +* %5 - optional -M(R,V,P) or 1 +*=============================================================================* +*AL Comments: +*----------------------------------------------------------------------------- + SET RTP_SHAPI(REG,ALLYEAR,PRC,BD,J,J,LL,LL); +$ SETLOCAL PASS %3 +$ IF %3=='' $SETLOCAL PASS YES + + LOOP(BD,RTP_ISHPR(RTP(R,V,P))$((%1%6X(RTP,BD) GE 1.5)$%1%6X(RTP,BD)) = YES); + RTP_ISHPR(RTP(R,V,P))$((%5 GE 1.5)$%5) = YES; + +* Prepare for start and end years + OPTION CLEAR=FIL2; FIL2(V) = B(V)-YEARVAL(V); + PASTSUM(RTP_ISHPR(R,V,P)) = FIL2(V)+NCAP_ILED(R,V,P)+NCAP_TLIFE(R,V,P)-1; + +* Shape attributes only for processes around for > 1 period + %1%6X(RTP_ISHPR(R,V,P),BD)$(PASTSUM(R,V,P)-FIL2(V)+1 < D(V)) = 0; + +* Get hold of the shape and multi index J,JJ for each RVP, as well as start and end years + LOOP(SAMEAS(J,'1'), + RTP_SHAPI(RTP_ISHPR(R,V(LL),P),BD,J+MAX(0,%1%6X(R,V,P,BD)-1),J+MAX(0,%5-1),LL+(FIL2(V)+NCAP_ILED(R,V,P)),LL+PASTSUM(R,V,P)) = YES; + ); + + LOOP(SAMEAS(AGE,'1'), +* Calculate average SHAPE for plants still operating in each period: + %4$((%PASS%)$RTP_ISHPR(R,V,P)) = %1%2 * + SUM(RTP_SHAPI(R,V,P,BD,J,JJ,LL,YEAR), MULTI(JJ,T) * + SUM(PERIODYR(T,EOHYEARS)$(YEARVAL(EOHYEARS) LE MAX(B(T),YEARVAL(YEAR))), + SHAPE(J,AGE+(MIN(YEARVAL(EOHYEARS),YEARVAL(YEAR))-YEARVAL(LL)))) / + (MAX(1,MIN(E(T),YEARVAL(YEAR))-MAX(B(T),YEARVAL(LL))+1)))); + +* If no shape index is specified, set the BASE value for the attribute + RTP_ISHPR(RTP(R,V,P)) = (NOT RTP_ISHPR(RTP)); + %4$(RTP_ISHPR(R,V,P)$(%PASS%)) = %1%2; +* Clear the temporary sets + OPTION CLEAR=RTP_SHAPI,CLEAR=RTP_ISHPR,CLEAR=PASTSUM; diff --git a/ppm_ext.dsc b/ppm_ext.dsc new file mode 100644 index 0000000..444318c --- /dev/null +++ b/ppm_ext.dsc @@ -0,0 +1,16 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PPM_EXT.xtd oversees extended preprocessor activities * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* Questions/Comments: +* +*----------------------------------------------------------------------------- +$IF NOT DEFINED PRC_DSCNCAP $EXIT +*----------------------------------------------------------------------------- +* Discrete capacity extensions +*----------------------------------------------------------------------------- + NCAP_DISC(RTP(R,T,P),'0')$PRC_DSCNCAP(R,P) = EPS$(NOT NCAP_SEMI(R,T,P)); diff --git a/ppm_ext.ecb b/ppm_ext.ecb new file mode 100644 index 0000000..099ce21 --- /dev/null +++ b/ppm_ext.ecb @@ -0,0 +1,50 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* ppm_ext.ecb - coefficients for market sharing (economic choice behavior) +*----------------------------------------------------------------------------- + SET COM_GRP / '_MSVIOL_' /; + SET COM / '_MSVIOL_' /; +*----------------------------------------------------------------------------- +$ IFI %STAGES%==YES $EXIT +$ IF %MACRO%==YES $EXIT +$ IFI %MACRO%==CSA $EXIT +$ IFI %MACRO%==MSA $EXIT +$ IF %STEPPED%==+ $EXIT +$ SETGLOBAL ECB YES +*----------------------------------------------------------------------------- + SET COM_TMAP / (SET.REG).FIN.'_MSVIOL_'/; + SET COM_LIM / (SET.REG).'_MSVIOL_'.N /; + SET RTC_MS(R,YEAR,C) 'Commodities with market sharing' // ; + PARAMETER COEF_LMS(R,ALLYEAR,C,P) 'Logit Market Share coefficients' // ; + PARAMETER ECB_NCAPR(R,ALLYEAR,P) 'First pass LEC results' //; + +$ SET RESET 0 +$ BATINCLUDE fillparm COM_MSHGV R C ",'','','','',''" T 'RTC(R,T,C)' 'GE 0' +$ BATINCLUDE fillparm NCAP_MSPRF R 'C,P,L' ",'','',''" T 'RTP(R,T,P)' 'GE 0' + +* Initialize probing shares + RTC_MS(RTC(R,T,C))$(SUM(TOP(RPC_PG(R,P,C),'OUT')$(NOT RTP_OFF(R,T,P)),ORD(T)>1)$COM_MSHGV(R,T,C)) = YES; + LOOP(RTC_MS(R,T,C), OPTION CLEAR=PRC_YMAX; + PRC_YMAX(RP_FLO(PRC_CAP(R,P)))$TOP(R,P,C,'OUT') = RPC_PG(R,P,C)$(NOT RTP_OFF(R,T,P)); + Z=SUM(P$PRC_YMAX(R,P),1); IF(Z, COEF_LMS(R,T,C,P)$PRC_YMAX(R,P) = -0.05 / Z)); + +* Complete flow controls for dummy + OPTION TRACKPC < COEF_LMS, RVP < COEF_LMS, TRACKP < TRACKPC; + TOP(TRACKP(R,P),'_MSVIOL_','IN') = YES; + RPC_NOFLO(TRACKP,'_MSVIOL_') = YES; + RPCS_VAR(TRACKP(R,P),'_MSVIOL_',ANNUAL) = YES; + RTPCS_VARF(RTP_VARA(R,T,P),'_MSVIOL_',ANNUAL) = YES; + IF(RPT_OPT('NCAP','1')<>1, RPT_OPT('NCAP','101')=ROUND(RPT_OPT('NCAP','1')); RPT_OPT('NCAP','1')=1); + +* Default values + NCAP_MSPRF(R,T,C,P,L('N'))$((NOT NCAP_MSPRF(R,T,C,P,L))$COEF_LMS(R,T,C,P)) = 1; + NCAP_MSPRF(R,T,C(ACTCG),P,L('UP'))$((NOT NCAP_MSPRF(R,T,C,P,L))$RVP(R,T,P)) = MAX(0,SMAX(TRACKPC(R,P,COM),NCAP_MSPRF(R,T,COM,P,L))); + NCAP_MSPRF(R,T,C(ACTCG),P,L('UP'))$((NOT NCAP_MSPRF(R,T,C,P,L))$RVP(R,T,P)) = 2; + +* Initialize ceiling costs + FLO_COST(R,DATAYEAR,P,C('_MSVIOL_'),ANNUAL,CUR)$TRACKP(R,P) $= NCAP_COST(R,DATAYEAR,P,CUR); + FLO_DELIV(R,DATAYEAR,P,C('_MSVIOL_'),ANNUAL,CUR)$TRACKP(R,P) $= NCAP_FOM(R,DATAYEAR,P,CUR); + OPTION CLEAR=TRACKP,CLEAR=TRACKPC,CLEAR=PRC_YMAX,CLEAR=RVP; diff --git a/ppm_ext.mlf b/ppm_ext.mlf new file mode 100644 index 0000000..adb0365 --- /dev/null +++ b/ppm_ext.mlf @@ -0,0 +1,92 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================* +* ppm_ext.MLF oversees extended preprocessing activities for MLF +*============================================================================* + OPTION TM_DM < DEM, CLEAR=TM_DMC; + LOOP(MI_DMAS(R,COM,C),TM_DM(R,C)=NO); +* Marginal costs of demands + TM_DMC(RTC(R,T,C))$DEM(R,C) = SUM((COM_TS(R,C,S),RDCUR(R,CUR)),COM_BPRICE(RTC,S,CUR)*COM_FR(RTC,S)); + TM_DMC(R,T,C)$(TM_DMC(R,T,C)=0) = 0; + TM_AMP(R,T) = SOL_ACFR(R,'COST',T)*SUM(DEM(R,C),TM_DMC(R,T,C)*COM_PROJ(R,T,C))+1-1; + TM_AMP(MR,T)$((M(T)>MIYR_V1+9)$PP(T)) = 0; +$ BATINCLUDE filparam TM_DMC 'R,' C ",'','','','',''" DATAYEAR T +* Demand levels audit + TM_DEM(MR(R),T,C)$((COM_PROJ(R,T,C)>0)$DEM(R,C)) = COM_PROJ(R,T,C); + LOOP(PP(T),TM_DM(DEM(R,C))$(TM_DMC(R,T,C)=0)=NO; TM_DM(DEM(R,C))$(TM_DEM(R,T,C)=0)=NO); +* remove elasticity steps from demands, keeping aggregates elastic + RCJ(TM_DM(MR,C),J,BD)=NO; + COM_ELAST(MR(R),PP,C,ANNUAL,BDNEQ)$TM_DM(R,C) $= RD_AGG(R,C); + RHS_COMBAL(RTCS_VARC(R,T,C,S))$((NOT TM_DM(R,C)$PP(T))$TM_STEP(R,C,'N')) $= RCS_COMBAL(R,T,C,S,'FX'); +*----------------------------------------------------------------------------- +* Aggregate demand, expenditures and price + OPTION CLEAR=DM; DM('ACT')=YES; + TM_ANNC(MR(R),T) = SUM(DEM(R,C),TM_DMC(R,T,C)*TM_DEM(R,T,C)); + TM_DEM(MR(R),T,DM) = SUM(DEM(R,C),TM_DEM(R,T,C)); + TM_DMC(MR(R),T,DM) = TM_ANNC(R,T)/TM_DEM(R,T,DM); + LOOP(TB(TT(T-1)),TM_DMC(R,TT,DM) = MAX(TM_DMC(R,TT,DM),TM_DMC(R,T,DM)*0.7)); +* Annual costs and net taxes for MACRO + TM_ANNC(MR(R),T) = SOL_ACFR(R,'COST',T)*TM_ANNC(R,T); + TM_ANNC(R,T) $= TM_AMP(R,T); + TM_TAXREV(MR(R),T) = SOL_ACFR(R,'TAX',T)*TM_ANNC(R,T); +*----------------------------------------------------------------------------- +* Quadratic supply function + TM_ANNC(R,T) = TM_ANNC(R,T) * TM_SCALE_CST; + LOOP(TB, TM_EC0(R) = TM_ANNC(R,TB); TM_DDATPREF(R,DM) = TM_DMC(R,TB,DM)); + TM_QSFB(R,T,DM)$TM_DEM(R,T,DM) = 0.5*TM_DMC(R,T,DM)*TM_SCALE_CST/TM_DEM(R,T,DM); + TM_QSFA(R,T) = TM_ANNC(R,T)- SUM(DM, TM_QSFB(R,T,DM)*TM_DEM(R,T,DM)**2); +*----------------------------------------------------------------------------- +* Process macro parameters + TM_DEPR(R)$(NOT TM_DEPR(R)) = TM_DEFVAL('DEPR'); + TM_ESUB(R)$(NOT TM_ESUB(R)) = TM_DEFVAL('ESUB'); + TM_DESUB(R)$(NOT TM_DESUB(R)) = TM_ESUB(R); + TM_KGDP(R)$(NOT TM_KGDP(R)) = TM_DEFVAL('KGDP'); + TM_KPVS(R)$(NOT TM_KPVS(R)) = TM_DEFVAL('KPVS'); + TM_DMTOL(R)$(NOT TM_DMTOL(R)) = TM_DEFVAL('DMTOL'); + TM_IVETOL(R)$(NOT TM_IVETOL(R))= TM_DEFVAL('IVETOL'); +* Calculate cost amplifier + TM_AMP(MR,T) = MAX(0,SMAX(PP(TT)$(ORD(TT)>ORD(T)),TM_ANNC(MR,TT)/(TM_GDPGOAL(MR,TT)/TM_GDPGOAL(MR,T))*POWER(TM_DEFVAL('ESC'),YEARVAL(T)-YEARVAL(TT)))-TM_ANNC(MR,T)); + +*============================================================================* +* Initialize the economic parameters +*============================================================================* + TM_DDF(MR,T,DM) = EPS; + TM_AEEIV(MR,T,DM) = EPS; + TM_ASRV(R) = 1 - TM_DEPR(R) / 100; + TM_GROWV(MR,T) = TM_GR(MR,T); + TM_DFACTCURR(R,XTP) = 1 - (TM_KPVS(R) / TM_KGDP(R) - TM_DEPR(R)/100 - TM_GROWV(R,XTP)/100); + TM_RHO(R) = 1 - 1 / TM_ESUB(R); + TM_TSRV(R,T) = TM_ASRV(R) ** NYPER(T); + + TM_K0(R) = TM_KGDP(R) * TM_GDP0(R); + TM_IV0(R) = TM_K0(R) * (TM_DEPR(R) + SUM(TB,TM_GROWV(R,TB))) / 100; + TM_C0(R) = TM_GDP0(R) - TM_IV0(R); + TM_Y0(R) = TM_GDP0(R) + TM_EC0(R) + SUM(TB,TM_AMP(R,TB)); + +*============================================================================* +* Calculate intermediate values +*============================================================================* + TM_AEEIFAC(MR,T,DM) = 1; + TM_DFACT(MR,TB) = 1; + TM_L(MR,TB) = 1; + + LOOP(PP(T+1), + TM_DFACT(R,PP) = TM_DFACT(R,T) * TM_DFACTCURR(R,T) ** NYPER(T); + TM_L(R,PP) = TM_L(R,T) * (1 + TM_GROWV(R,T) / 100) ** NYPER(T); + ); + +* Arbitrary multiplier on utility in last time period + TM_DFACT(MR(R),TLAST)$(TM_ARBM > 1) = TM_DFACT(R,TLAST) * + (1-MIN(.999,TM_DFACTCURR(R,TLAST))**(NYPER(TLAST)*TM_ARBM)) / + (1-MIN(.999,TM_DFACTCURR(R,TLAST))**(NYPER(TLAST) * 1 )); +* Weights for periods + Z=MAX(1,SMAX(T,D(T))); TM_PWT(T) = D(T)/Z; + + TM_D0(MR(R),DM) = SUM(TB,TM_DEM(R,TB,DM))*TM_SCALE_NRG; + TM_B(MR(R),DM) = (TM_D0(R,DM) / TM_Y0(R)) ** (1 - TM_RHO(R)); + TM_B(MR(R),DM) = TM_SCALE_CST / TM_SCALE_NRG * TM_DDATPREF(R,DM) * TM_B(R,DM); + + TM_AKL(MR(R)) = TM_Y0(R) ** TM_RHO(R) - SUM(DM, TM_B(R,DM) * (TM_D0(R,DM) ** TM_RHO(R))); + TM_AKL(MR(R)) = TM_AKL(R) / (TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R))); diff --git a/ppm_ext.vda b/ppm_ext.vda new file mode 100644 index 0000000..2de548b --- /dev/null +++ b/ppm_ext.vda @@ -0,0 +1,161 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PPM_EXT.xtd oversees extended preprocessor activities +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Questions/Comments: +*----------------------------------------------------------------------------- + DISPLAY 'VEDA PPM_EXT Invoked'; +$IF DEFINED GR_VARGEN $BATINCLUDE resloadc.vda COEF + OPTION RP_UPLRP_GRP(RP,%PGPRIM%)) $= RP_STL(RP,TSL,'N'); + OPTION CLEAR=TRACKP,CLEAR=RP_GRP,CLEAR=TRACKPG,CLEAR=RTPS_BD,CLEAR=RVPS_LIM; +*----------------------------------------------------------------------------- +* Automatic generation of NCAP_AFC for ECT CHP + RVP(RTP(R,V,P))$((NOT RPS_CAFLAC(R,P,'ANNUAL','UP'))$(NCAP_CHPR(RTP,'UP')*NCAP_AFA(RTP,'UP')>0)$CHP(R,P))=YES; + RVP(RTP)$(NCAP_CEH(RTP)<1.5) = NO; +* The maximum of the technical AF for ELC, corrected with ACTFLO: + VDA_CEH(RVP(R,V,P)) = MAX(0,SMAX((PRC_TS(R,P,S),CHP_ELC(R,P,C)),NCAP_AF(RVP,S,'UP')*PRC_ACTFLO(RVP,C))); + RVP(RTP)$(VDA_CEH(RTP)<=0) = NO; + RPS_CAFLAC(R,P,ANNUAL,'UP') $= SUM(RVP(R,V,P)$VDA_CEH(RVP),1); +* AFAC for heat = (heat share)/(1/AFA-(elec share)/AF): + NCAP_AFCS(RVP(R,V,P),C,ANNUAL)$RPC_PG(R,P,C) = + (1/(1+1/NCAP_CHPR(RVP,'UP'))) / NCAP_AFA(RVP,'UP') / PRC_ACTFLO(RVP,C) / + (1/NCAP_AFA(RVP,'UP')-(1-1/(1+1/NCAP_CHPR(RVP,'UP')))/VDA_CEH(RVP)); + NCAP_AFCS(RVP(R,V,P),C,ANNUAL)$CHP_ELC(R,P,C) = VDA_CEH(RVP) / NCAP_AFA(RVP,'UP') / PRC_ACTFLO(RVP,C); + OPTION CLEAR=RVP,VDA_CEH 1), + F = NCAP_PASTY(R,LL,P); MY_F = NCAP_PASTI(R,LL,P) / F; +* for each year within spread build running sum of distributed PASTIs + FOR(Z = F-1 DOWNTO 0, PASTSUM(R,ALLYEAR(LL-Z),P) = PASTSUM(R,ALLYEAR,P) + MY_F); +* since spread this guy, clear original value + NCAP_PASTI(R,LL,P) = 0); +* add any spread past investments to any provided originally (and not spread) + NCAP_PASTI(R,LL,P)$PASTSUM(R,LL,P) = NCAP_PASTI(R,LL,P) + PASTSUM(R,LL,P); +* extend the list of past years + OPTION PASTYEAR < NCAP_PASTI; + INT_DEFAULT('PASTI')$PYR('0')=1; PYR('0')=NO; + OPTION CLEAR=PRC_CAP, CLEAR=PASTSUM; +*----------------------------------------------------------------------------- +* determination of YEAR subsets and period B/E/D +*----------------------------------------------------------------------------- + +* 98/02/23 middle year of period M(T) from *.dd to ppmain.mod +* [UR]: duration of period moved from *.dd to ppmain.mod + D(MILESTONYR)=E(MILESTONYR)-B(MILESTONYR)+1; + M(MILESTONYR)=FLOOR(B(MILESTONYR)+(D(MILESTONYR)-1)/2); +$IFI %OBJ%==MOD M(T) = 0; + IF(ALTOBJ=1,ALTOBJ=1$SUM(T,M(T) NE YEARVAL(T))); + +* establish 1st/last run year + MIYR_1(MILESTONYR)$(ORD(MILESTONYR) = 1) = YES; + IF(ALTOBJ, +* If alternate objective, set B and E, D and M: + E(T(TT-1)) = FLOOR((YEARVAL(T)+YEARVAL(TT))/2); B(T(TT+1)) = E(TT)+1; + B(MIYR_1(T))$(ABS(B(T)-(YEARVAL(T)-5)) GT 5) = YEARVAL(T); + E(T)$((ABS(E(T)-(YEARVAL(T)+15)) GT 15)$(ORD(T)=CARD(T))) = 2*YEARVAL(T)-B(T)+1-1$MOD(YEARVAL(T)-B(T)+1,5); + D(T)=E(T)-B(T)+1; M(T) = YEARVAL(T)); +*V0.5c 980904 - set 1st value to B not milestone itself + MIYR_V1 = SMIN(MIYR_1, B(MIYR_1)); + MIYR_VL = SMAX(MILESTONYR$(ORD(MILESTONYR) = CARD(MILESTONYR)), E(MILESTONYR)); +$IFI '%OBLONG%'==YES IF(MIYR_V1+SUM(T,E(T)+1-B(T))-MIYR_VL NE 1,ABORT "Inconsistent periods - cannot use OBLONG."); + LOOP(MIYR_1(LL),PASTYEAR(LL-(YEARVAL(LL)-MIYR_V1+1)) = YES); +* Set LEADs and LAGs for periods + LEAD(TT(T++1)) = MAX(M(TT)-M(T),M(TT)-B(TT)+1); + LAGT(TT(T--1)) = MAX(M(T)-M(TT),E(TT)-M(TT)+1); + IF(ALTOBJ,IPD(T) = LEAD(T)+MIN(E(T)-M(T),LEAD(T)-1)$MIYR_1(T); + ELSE IPD(T) = D(T)); FPD(T) = D(T); +* Initialize MINYR already here (was in COEF_OBJ.mod) + SCALAR MINYR; + MINYR = MIN(MIYR_V1-1,SMIN(T,M(T)-IPD(T))+1); + PYR_V1 = MIN(SMIN(PASTYEAR,YEARVAL(PASTYEAR)),MINYR); +* Define MIYR_L + LOOP(MIYR_1(ALLYEAR), Z=MIYR_VL-YEARVAL(ALLYEAR); MIYR_L(ALLYEAR+Z) = YES); + +* establish the beginning/end/delta for each MILESTONYR +* introduce PASTMILE (PASTYEAR that are not MILESTONYR) +* set the past years to self + PASTMILE(PASTYEAR)$((YEARVAL(PASTYEAR) LE MIYR_VL)$(NOT T(PASTYEAR))) = YES; + M(PASTMILE) = YEARVAL(PASTMILE); + B(PASTMILE) = M(PASTMILE); + E(PASTMILE) = M(PASTMILE); + D(PASTMILE) = 1; + +*----------------------------------------------------------------------------- +* set EOHYEARS contains all years until MIYR_VL + EOHYEARS(ALLYEAR)$((YEARVAL(ALLYEAR) >= MINYR) * (YEARVAL(ALLYEAR) <= MIYR_VL)) = YES; +* create list of all years in each period + PERIODYR(T,EOHYEARS)$((YEARVAL(EOHYEARS) >= B(T)) * (YEARVAL(EOHYEARS) <= E(T))) = YES; + +* Inter/Extrapolate G_OFFTHD if specified +$IF DEFINED G_OFFTHD $BATINCLUDE filparam G_OFFTHD '' '' ",'','','','','',''" YEAR T '' '' 5 + G_OFFTHD('0') = 0; + +*----------------------------------------------------------------------------- +* complete timeslice declarations +*----------------------------------------------------------------------------- +* Include preprocessing of timeslice attributes +$ INCLUDE timslice.mod + +*----------------------------------------------------------------------------- +* Migrate PASTIs defined on Milestonyr if requested + IF(INT_DEFAULT('PASTI'), LOOP(PYR(T(LL))$(M(T)>B(T)), VNT(LL-1,T)=YES); + LOOP(VNT(LL,T), B(LL)=M(T)-1; E(LL)=M(T); M(LL)=B(LL); D(LL)=2; PASTYEAR(T)=NO; + PASTSUM(R,T,P)$NCAP_PASTI(R,T,P) = NCAP_PASTI(R,LL,P)+NCAP_PASTI(R,T,P)+1-1; + COEF_RTP(R,LL,P)$PASTSUM(R,T,P) = NCAP_PASTI(R,T,P) / PASTSUM(R,T,P); + NCAP_PASTI(R,LL,P)$=PASTSUM(R,T,P); NCAP_PASTI(R,T,P)=0; OPTION CLEAR=PASTSUM; + ); + VNT(PASTMILE,T)$PERIODYR(T,PASTMILE)=YES; + OPTION PHYR<=VNT; PYR(PHYR)=YES; PASTMILE(PHYR)=YES); + +*----------------------------------------------------------------------------- +* initialize start/end year for new investments +*V0.5c 980904 - use OFF instead of START/END +*----------------------------------------------------------------------------- + PUTGRP = 0; +* Convert START to NOFF + LOOP(LASTLL(LL)$CARD(NCAP_START), Z=CARD(LL)+%BOTIME%; + PRC_NOFF(RP,'BOH',EOHYEAR)$NCAP_START(RP) = NO; + PRC_NOFF(RP,'BOH',LL+MIN(-1,NCAP_START(RP)-Z))$NCAP_START(RP) = YES); +* Construct year sets for the active model horizon + OPTION CLEAR=PRC_YMAX, CLEAR=UNCD1; + UNCD1('BOH') = YES; UNCD1(YEAR)$(YEARVAL(YEAR) LE MIYR_V1) = YES; + PRC_YMAX(RP(R,P)) = MAX(0,SMAX(PRC_NOFF(R,P,BOHYEAR(UNCD1),EOHYEAR),ORD(EOHYEAR)+%BOTIME%-2)); +* Set RTP_OFF for delayed processes + TRACKP(RP) $= PRC_YMAX(RP); + RTP_OFF(R,T,P)$((YEARVAL(T) LE PRC_YMAX(R,P))$TRACKP(R,P)) = ((PRC_YMAX(R,P)-B(T)+1)/D(T) GE G_OFFTHD(T)); + PRC_YMAX(TRACKP(R,P)) = SMAX(RTP_OFF(R,T,P),E(T)); +* Check NCAP_PASTI + LOOP(TRACKP(R,P)$SUM(PYR$NCAP_PASTI(R,PYR,P),1), + IF(PRC_YMAX(R,P) GT 0, +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Delayed Process but PASTInvestment' + PUT QLOG ' WARNING - Delay is ignored: R=',%RL%,' P=',P.TL ; + PRC_YMAX(R,P) = 0)); + OPTION CLEAR=TRACKP; +* Set the RTP_OFF for all remaining PRC_NOFF ranges + UNCD1(BOHYEAR) = NOT UNCD1(BOHYEAR); + LOOP(PRC_NOFF(RP(R,P),BOHYEAR(UNCD1),EOHYEAR),TRACKP(R,P) = YES); + LOOP(TRACKP(R,P), +$ BATINCLUDE pp_off.%1 PRC_NOFF P "" "RTP_OFF(R,T,P)$(" YES + ); + RTP(R,T,P)$RP(R,P) = YES$(YEARVAL(T) GT PRC_YMAX(R,P)); + RTP(R,PYR,P)$(RP(R,P)$(NCAP_PASTI(R,PYR,P)>0)$NCAP_PASTI(R,PYR,P)) = YES; + RVP(RTP(R,T,P)) = YES; + OPTION CLEAR=TRACKP; + +*----------------------------------------------- +* interpolation/extrapolation +*----------------------------------------------- +* Call interpolation subsystem +$ INCLUDE preppm.mod +$ IFI %INTEXT_ONLY% == YES $EXIT +*----------------------------------------------- + +* initialize timestep control + SET SUBT(T) / SET.T /; + RT_PP(R,T) = YES; + +* maximum NCAP_ILED+NCAP_TLIFE+NCAP_DLAG+NCAP_DLIFE+NCAP_DELIF + DUR_MAX=G_TLIFE; + LOOP(RVP(R,T,P)$((NCAP_ILED(RVP)+NCAP_TLIFE(RVP)+NCAP_DLAG(RVP)+NCAP_DLIFE(RVP)+NCAP_DELIF(RVP)) GT DUR_MAX), + DUR_MAX=(NCAP_ILED(RVP)+NCAP_TLIFE(RVP)+NCAP_DLAG(RVP)+NCAP_DLIFE(RVP)+NCAP_DELIF(RVP)); + ); + +* establish each year in OBJ +* years before 1st period + EOHYEARS(PYR)$(YEARVAL(PYR)= MINYR) * (YEARVAL(ALLYEAR) <= (MIYR_VL+DUR_MAX))) = YES; + +* LATECOSTS + PERIODYR(T,EACHYEAR)$((E(T)=MIYR_VL)*(YEARVAL(EACHYEAR) >= MIYR_VL)) = YES; + +*----------------------------------------------------------------------------- +* establish rest of primary looping control sets indicating what region/process/commodities +*----------------------------------------------------------------------------- +* expand individual commodities in own CG + COM_GMAP(RC(R,C),C) = YES; + +* UR 02/22/99 PRC_CG is now internally generated + PRC_CG(RPC) = YES; + PRC_CG(RP_PG) = YES; + +* Add aggregate commodities into RC: + OPTION MI_DMAS<=COM_AGG,FIN1),1)=YES; + RP_PGTYPE(RP(R,P),COM_TYPE)$SUM(RPC_PG(R,P,C)$COM_TMAP(R,COM_TYPE,C),1) = YES; + RP_AIRE(RP_IRE(RP),IE)$SUM(RPC_IRE(RPC_PG(RP,C),IE),1) = YES; +* input/output normalized process + RP_INOUT(RP,IO)$SUM(TOP(RPC_PG(RP,C),IO),1) = YES; +* determine shadow primary if not provided - for regular processes only (RP_FLO) + TRACKP(RP_FLO(RP))$(NOT SUM(PRC_SPG(RP,COM_GRP),1)) = YES; + LOOP((RP_PGTYPE(RP_FLO(R,P),CG),IO)$(NOT RP_INOUT(R,P,IO)), + IF(TRACKP(R,P), +* set the SPG to the same type as the PG if commodities on the other side with that COM_TYPE + IF(SUM(TOP(R,P,C,IO)$COM_GMAP(R,CG,C),1),PRC_SPG(R,P,CG) = YES; + ELSE +* did not find any commodities with the same type as the PG, so assume energy +* assume material if PRC is material conversion and PGTYPE is DEM + IF((SUM(RPC(R,P,C)$COM_TMAP(R,'MAT',C),1)$SUM(PRC_MAP(R,MATPRC,P),1))$RP_PGTYPE(R,P,'DEM'), + PRC_SPG(R,P,'MAT') = YES; + ELSE Z=1; LOOP(PG_SMAP(CG,J,COM_TYPE)$Z, + IF(SUM(TOP(R,P,C,IO)$COM_TMAP(R,COM_TYPE,C),1), Z=0; PRC_SPG(R,P,COM_TYPE) = YES))); + ); + ); + ); +* Add commodities in SPG into RPC_SPG + LOOP((PRC_SPG(R,P,CG),IO)$(NOT RP_INOUT(R,P,IO)),RPC_SPG(R,P,C)$(TOP(R,P,C,IO)$COM_GMAP(R,CG,C)) = YES); + PRC_CG(PRC_SPG) = YES; + OPTION CLEAR=TRACKP; + +*----------------------------------------------------------------------------- +* set level and timeslices for each commodity +* - if individual TS provided and no TSL then use TSs to set TSL +* else set the TS from TSL if none provided +*----------------------------------------------------------------------------- +* remove invalid levels + OPTION CLEAR=RXX; RXX(R,TSL,R)$(NOT SUM(RJLVL(J,R,TSL),1))=YES; F=CARD(COM_TSL); Z=CARD(PRC_TSL); + COM_TSL(R,C,TSL-1)$RXX(R,TSL,R)$=COM_TSL(R,C,TSL); F=CARD(COM_TSL)-F; COM_TSL(R,C,TSL)$(RXX(R,TSL,R)$F)=NO; + PRC_TSL(R,P,TSL-1)$RXX(R,TSL,R)$=PRC_TSL(R,P,TSL); Z=CARD(PRC_TSL)-Z; PRC_TSL(R,P,TSL)$(RXX(R,TSL,R)$Z)=NO; + IF(F+Z, PUTGRP=0; +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Commodities/processes defined at non-existing TSLVL' + PUT QLOG ' WARNING - Number of COM/PRC resetted to coarser level: ',F:0:0 '/' Z:0:0/); +* check for individual TS provided + TRACKC(RC) $= SUM(COM_TS(RC,S),1); + LOOP(COM_TS(RC(R,C),S)$(NOT SUM(COM_TSL(RC,TSL),1)),COM_TSL(RC,TSL)$TS_GROUP(R,TSL,S) = YES); +* check for excess or missing COM_TS + LOOP(COM_TSL(TRACKC(R,C),TSLVL)$(SUM(TS_GROUP(R,TSLVL,S),1) NE SUM(COM_TS(R,C,S),1)), + COM_TS(R,C,S)$(NOT TS_GROUP(R,TSLVL,S)) = NO; + RCS(R,C,S)$((NOT SUM(COM_TS(R,C,TS)$RS_TREE(R,S,TS),1))$G_YRFR(R,S))=YES); + COM_TSL(RC,'ANNUAL')$(NOT SUM(COM_TSL(RC,TSL),1)) = YES; +*GG/UR make sure to init all S + LOOP(COM_TSL(RC(R,C),TSL)$(NOT TRACKC(RC)),COM_TS(RC,S)$TS_GROUP(R,TSL,S) = YES); +* identify all TS at/above the COM_TSL + RCS_COMTS(RC(R,C),S)$SUM(TS_MAP(R,S,TS)$COM_TS(RC,TS),1) = YES; + +* determine the spread of periods/slices for the commodities + OPTION CLEAR=TRACKC; + LOOP(COM_OFF(RC,BOHYEAR,EOHYEAR),TRACKC(RC) = YES); + RTC(R,T,C)$RC(R,C) = YES; + LOOP(TRACKC(R,C), +* set the OFF range +$ BATINCLUDE pp_off.%1 COM_OFF C "" "RTC(R,T,C)$(" NO +* create a variable for VAR_COM for desired timeslices unless period turned off + COM_BNDPRD(R,T,C,S,'FX')$(COM_TS(R,C,S)$(NOT RTC(R,T,C))) = EPS; + ); + RTCS_VARC(RTC(R,T,C),S)$COM_TS(R,C,S) = YES; + OPTION CLEAR=TRACKC; + +* Peaking +* a) Time-slices specified on COM_PKTS must be on COM_TSLevel +* b) if no COM_PKTS is specified but COM_PEAK given, for all COM_TS +* COM_PKTS will be set and hence peaking equations generated +*GG*PK 1st check if COM_PKTS has been specified at different level, then set if not provided at all +*UR*PK 1) com_peak is set if at least one com_pkts exists +* 2) if com_peak and com_pkts above com_ts => com_pkts is inherited +* if at least one com_pkts below com_ts => com_pkts is aggregated +* 3) if com_peak but no com_pkts => com_pkts for all com_ts + +* set com_peak when com_pkts + COM_PEAK(R,CG)$SUM(COM_PKTS(R,CG,S),1) = 1; + TRACKC(COM_PEAK(R,C))$(NOT SUM(COM_TSL(R,C,TSL),1)) = YES; + LOOP(ANNUAL(TS(TSL)),COM_TSL(TRACKC(R,C),TSL+SMAX(COM_PKTS(R,C,S),STOAL(R,S)))=YES); + OPTION CLEAR=TRACKC; +* inherit to the COM_TS level if necessary + COM_PKTS(COM_PEAK(R,C),S)$SUM(COM_PKTS(R,C,TS)$RS_TREE(R,S,TS),1) = SUM(COM_TSL(R,C,TSL),ORD(TSL)=STOAL(R,S)+1); +* if nothing then set for all + LOOP(COM_PEAK(R,CG)$(NOT SUM(COM_PKTS(R,CG,S),1)), + Z = SMAX(COM_TSL(R,C,TSL)$COM_GMAP(R,CG,C),TSLVLNUM(TSL)); + LOOP(TSL$(TSLVLNUM(TSL)=Z),COM_PKTS(R,CG,S)$TS_GROUP(R,TSL,S) = YES) + ); +*----------------------------------------------------------------------------- +* set level and timeslices for each process +* - if individual TS provided and no TSL then use TSs to set TSL +* else set the TS from TSL if none provided +*----------------------------------------------------------------------------- + LOOP(PRC_TS(RP(R,P),S)$(NOT SUM(PRC_TSL(RP,TSL),1)),PRC_TSL(RP,TSL)$TS_GROUP(R,TSL,S) = YES); + PRC_TSL(RP,'ANNUAL')$(NOT SUM(PRC_TSL(RP,TSL),1)) = YES; +*GG/UR make sure to init all S + TRACKP(RP)$(NOT SUM(PRC_TS(RP,S),1)) = YES; + LOOP(TSL,PRC_TS(TRACKP(R,P),S)$(TS_GROUP(R,TSL,S)$PRC_TSL(R,P,TSL)) = YES); + OPTION CLEAR=TRACKP; + +* determine seasons for which a process handling seasonal commodities may need to +* be tracked, and identify all the TS above this level +* - RPS_PRCTS corresponds to all levels at/above PRC_TS +* - RPS_S2 corresponds to non-PG flo variables +* - RPS_S1 corresponds to level of EQ_PTRANS + +* Convert ANNUAL level timeslice storage + RP_SGS(RP_FLO(R,P))$(PRC_TSL(R,P,'ANNUAL')$(PRC_MAP(R,'STS',P)+PRC_MAP(R,'NST',P))) = YES; + RP_SGS(RP_FLO(R,P))$=PRC_MAP(R,'SGS',P); + PRC_MAP(R,'STG',P)$((NOT SUM(TOP(RPC_PG(R,P,C),'IN'),1))$RP_SGS(R,P)) = NO; +* All NST operating below ANNUAL level but producing ANNUAL level commodity will be STG: + PRC_MAP(R,'STG',P)$((NOT PRC_TSL(R,P,'ANNUAL'))$PRC_MAP(R,'NST',P)) = YES; + RP_STG(RP(R,P)) $= PRC_MAP(R,'STG',P); + +* identify shadow group timeslice level +* For LOAD processes, take the maximum TSLVL + LOOP((RTC(R,T,C),S)$COM_FR(R,T,C,S),TRACKC(R,C) = YES); + LOOP(COM_TSL(TRACKC(R,C),'ANNUAL'), TRACKP(RP_FLO(R,P))$RPC_PG(R,P,C) = YES); + PRC_YMAX(RP(R,P)) = SMAX((RPC_SPG(R,P,C),COM_TSL(R,C,TSL)),TSLVLNUM(TSL)); + PRC_YMAX(TRACKP(R,P)) = SMAX((RPC(R,P,C),COM_TSL(R,C,TSL)),TSLVLNUM(TSL)); + PRC_YMAX(RP_STG) = 0; + PRC_YMAX(RP) = MAX(PRC_YMAX(RP),SMAX(PRC_TSL(RP,TSL),TSLVLNUM(TSL))); +* First, get levels for each TS + LOOP(R, OPTION CLEAR=TS_ARRAY; + TS_ARRAY(S) $= RS_TSLVL(R,S); + Z = MAX(1,SMAX(RLUP(R,TSLVL,TSL),TSLVLNUM(TSL))); +* identify all S at shadow level + RPS_S2(RP_SGS(R,P),S)$(TS_ARRAY(S) = PRC_YMAX(R,P)) = YES; + PRC_SGL(RP_FLO(RP)) = MIN(PRC_YMAX(RP)-1$RP_STG(RP),Z)-1; + PRC_YMAX(RP_SGS(R,P)) = PRC_SGL(R,P)+1; +* save the finer of the PRC_TS and the finest commodity in the shadow primary + RPS_S1(RP(R,P),S)$(TS_ARRAY(S) = PRC_YMAX(R,P)) = YES; + RPS_S2(RPS_S1(R,P,S))$(NOT RP_SGS(R,P)) = YES; +* identify all TS at/above the PRC_TSL + ); + LOOP(TS_GROUP(R,TSL,S), RPS_PRCTS(R,P,TS)$(TS_MAP(R,TS,S)*PRC_TS(R,P,S)) = YES); + +*----------------------------------------------------------------------------- +* Establish the main control set for generation or not of a VAR_FLO/IRE for +* each commodity involved in a process, and for viable commodity/process timeslices +* Take into consideration whether the commodity is turned off for some timeslice +* Note: RTPCS_VAR further adjusted at the end of PPMAIN (after optional REDUCE) +*----------------------------------------------------------------------------- +* Special handling for storage, esp. night storage + RPC_STG(RPC(RP_STG(R,P),C))$(PRC_STGTSS(RPC)+PRC_STGIPS(RPC)+(RPC_PG(RPC)+RPC_SPG(RPC))$PRC_MAP(R,'NST',P)) = YES; + TRACKPC(RPC_STG(R,P,C))$((TOP(R,P,C,'OUT')+PRC_NSTTS(R,P,'ANNUAL'))$COM_TS(R,C,'ANNUAL')$PRC_MAP(R,'NST',P)) = YES; + RPCS_VAR(RPC(RP_STG(R,P),C),S)$(PRC_TS(R,P,S)$(NOT TRACKPC(RPC))+ANNUAL(S)$TRACKPC(RPC)) = YES; + PRC_NSTTS(RP_STG(R,P),ANNUAL)$(NOT SUM(TOP(TRACKPC(R,P,C),'IN'),1))=NO; OPTION PRC_ACTCAP_BND(RTP,'UP'))$CAP_BND(RTP,'UP')), +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 1 'Inconsistent CAP_BND(UP/LO/FX) defined for process capacity' + PUT ' WARNING - Lower bound set equal to upper bound, R.T.P= ',RTP.TE(RTP)); + +*----------------------------------------------------------------------------- +* turn off RTP/CPTYR if no new investment & installed capacity no longer available + LOOP(BDUPX(BD),RTP_OFF(RTP)$((NCAP_BND(RTP,BD)=0)$NCAP_BND(RTP,BD)) = YES); + NO_RVP(RTP_OFF(R,T,P))$(NOT NCAP_PASTI(R,T,P)) = YES; + LOOP(T, NO_RVP(R,TT,P)$(RTP_CPTYR(R,T,TT,P)$(NOT RTP_OFF(R,T,P))) = NO); + LOOP(PYR(V), NO_RVP(R,T,P)$(RTP_CPTYR(R,V,T,P)$NCAP_PASTI(R,V,P)) = NO); + RTP(NO_RVP) = NO; + RTP_CPTYR(R,T,TT,P)$((NOT NCAP_PASTI(R,T,P))$RTP_OFF(R,T,P)) = NO; + OPTION CLEAR=RVP, CLEAR=NO_RVP; + +*----------------------------------------------------------------------------- +* initialize start/end year for a process & available years +*----------------------------------------------------------------------------- +*-- Speed up by first tracking RPs with PRC_AOFF + LOOP(PRC_AOFF(RP(R,P),BOHYEAR,EOHYEAR),TRACKP(R,P) = YES); + RTP_VARA(RTP(R,T,P))$(NOT TRACKP(R,P)) = YES; + LOOP(TRACKP(R,P), MY_FIL(T) = YES; +* set the OFF range +$ BATINCLUDE pp_off.%1 PRC_AOFF P "" "MY_FIL(T)$(" NO +* set the periods for which VAR_ACT is OK + RTP_VARA(RTP(R,MY_FIL(T),P)) = YES; + ); + OPTION CLEAR=TRACKP; + +*----------------------------------------------------------------------------- +* initialize start/end year for a process flows +*----------------------------------------------------------------------------- +* Initialize start/end year for process commodities + RTPC(RTP(R,T,P),C) $= RPC(R,P,C); + PUTGRP = 0; +*-- track all RPCs with PRC_FOFF: + LOOP(PRC_FOFF(R,P,C,TS,BOHYEAR,EOHYEAR),TRACKPC(R,P,C) = YES); + LOOP(RPCS_VAR(TRACKPC(R,P,C),S), MY_FIL(T) = NO; +* check for shut-off here or timeslice above +$ BATINCLUDE pp_off.%1 PRC_FOFF 'P,C,TS' '$TS_MAP(R,TS,S)' "MY_FIL(T)$(" YES +* QC check that shut-off not specified below the VAR level + RTPCS_OUT(RTP_VARA(R,MY_FIL(T),P),C,S) = YES; + ); + LOOP(PRC_FOFF(RPC(R,P,C),TS,BOHYEAR,EOHYEAR)$SUM(RPCS_VAR(R,P,C,S)$RS_BELOW(R,S,TS),1), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Flow OFF TS level below VARiable TS level' + PUT QLOG ' WARNING - OFF is ignored: R=',%RL%,' P=',%PL%,' C=',%CL%,' S=',TS.TL ; + ); + OPTION CLEAR=TRACKPC; + +*----------------------------------------------------------------------------- +* Add leading milestones into RTP if/when simulated vintages +$IF DEFINED PRC_SIMV LOOP(T,NO_RVP(R,TT-1,P)$(RTP_CPTYR(R,TT,T,P)$PRC_SIMV(R,P))=YES); NO_RVP(RTP(R,T,P))=NO; RTP(NO_RVP)=YES; +*----------------------------------------------------------------------------- +* Remove commodity from PG if PRC_ACTFLO flagged non-interpolated, as bad + RPC_PG(R,P,C)$((NOT RP_PG(R,P,C))$(ROUND(PRC_ACTFLO(R,'0',P,C)<0))) = NO; +* Save original non-PG PRC_ACTFLO groups + RPC_PG(RPC_STG) = YES; + RP_STD(RP_FLO(RP))$(NOT RP_STG(RP)) = YES; + OPTION RPC_ACT <= PRC_ACTFLO; + RPC_ACT(R,P,C)$(RPC_PG(R,P,C)+(NOT RPC(R,P,C))+RP_STG(R,P)) = NO; + CHP(RP(R,P)) $= PRC_MAP(R,'CHP',P); + +*----------------------------------------------------------------------------- +* establishment PRC_CAPACT/ACTFLO from PRC_CAPUNT/ACTUNT/COM_UNIT & determine INOUT(r,p) +*----------------------------------------------------------------------------- + PRC_CAPACT(RP(R,P))$(NOT PRC_CAPACT(R,P)) = 1; +* Copy PRC_ACTFLO from PG to individual commodities in PG, allowing reserved word %PGPRIM% + PRC_ACTFLO(RTP(R,V,P),C)$((NOT PRC_ACTFLO(RTP,C))$RPC_PG(R,P,C)) $= SUM(RP_PG(R,P,CG),PRC_ACTFLO(R,V,P,CG)); + PRC_ACTFLO(RTP(R,V,P),C)$((NOT PRC_ACTFLO(RTP,C))$RPC_PG(R,P,C)) $= PRC_ACTFLO(RTP,%PGPRIM%); + PRC_ACTFLO(RTP(R,V,P),C)$((NOT PRC_ACTFLO(RTP,C))$RPC_PG(R,P,C)) = 1; +* RP_PGACT signifies that activity can be substituted for the primary flow + RP_PGACT(RP_FLO(R,P))$(SUM(RPC_PG(R,P,C),1) EQ 1) = YES; + RP_PGACT(RP_IRE(R,P))$(SUM(RPC_IRE(RPC_PG(R,P,C),IE),1) EQ 1) = YES; + +*----------------------------------------------------------------------------- +* Extensions after establishing RPCS_VAR and PRC_CAPACT but before levelising +$ BATINCLUDE main_ext.mod pp_prelv %EXTEND% +* Make various QA checks for FLO_SHAR +$ BATINCLUDE pp_qafs.mod mod + +*----------------------------------------------------------------------------- +* setup and apply (some) SHAPE/MULTI +*----------------------------------------------------------------------------- + SCALAR MAXLIFE; + MAXLIFE = SMAX(RTP,NCAP_TLIFE(RTP)); +* Convert indexes to demand elasticity shape curves to tuples + LOOP(SAMEAS(J,'1'),RTC_SHED(R,T,C,BD,J+MAX(0,COM_ELASTX(R,T,C,BD)-1))$COM_ELASTX(R,T,C,BD) = YES); + STARTOFF = CEIL(MAX(MAXLIFE,SMAX(RTC_SHED(R,T,C,BD,J),COM_VOC(R,T,C,BD))*100))+1; +* Call the SHAPE inter-/extrapolation routine +$ BATINCLUDE filshape 'STARTOFF' + SHAPE('1',AGE)$(ORD(AGE) LE STARTOFF) = 1.; + SHAPE(J,AGE)$((SHAPE(J,AGE) EQ 0)$SHAPE(J,AGE)) = 0; + +*GG* note that multi will take additional parameter NO/YES to do 2nd assignment or not +* Call the inter-/extrapolation routine for MULTI +$ BATINCLUDE filparam MULTI 'J,' '' ",'','','','',''" LL EOHYEARS 'NO$' '' + LOOP(J, Z=1; LOOP(LL$(MULTI(J,LL)*Z), Z=0; F=MIN(1,MULTI(J,LL))); + IF(NOT Z, MULTI(J,EOHYEARS)$(NOT MULTI(J,EOHYEARS)) = F)); + MULTI('1',EACHYEAR) = 1; + +*----------------------------------------------------------------------------- +* establish basic defaults for the non-TS attribute +*----------------------------------------------------------------------------- + +* economic life = technical life if not provided + NCAP_ELIFE(RTP)$(NOT NCAP_ELIFE(RTP)) = NCAP_TLIFE(RTP); +* commodity release always in next year if no time provided but release + NCAP_DLIFE(RTP(R,T,P))$((NOT NCAP_DLIFE(RTP))$SUM(RPC(R,P,C)$NCAP_OCOM(RTP,C),1)) = 1; + NCAP_DELIF(RTP(R,T,P))$(NOT NCAP_DELIF(RTP))$= NCAP_DLIFE(RTP); +* if investment requires commodity and has a leadtime, set commodity time = lead, if not provided + NCAP_CLED(RTP(R,T,P),C)$((NOT NCAP_CLED(RTP,C))$NCAP_ICOM(RTP,C)) = COEF_ILED(RTP); +* defaults for CHP plants + NCAP_BPME(RTP(R,V,P))$((NOT NCAP_BPME(RTP))$NCAP_CDME(RTP)$CHP(R,P)) = 1; + NCAP_CHPR(RTP(R,V,P),'UP')$((NOT SUM(LIM$NCAP_CHPR(RTP,LIM),1))$CHP(R,P)) = 1; +* set default storage efficiency if not provided + LOOP(RP_STG(R,P)$(NOT SUM(RTP(R,T,P)$STG_EFF(RTP),1)), STG_EFF(RTP(R,V,P)) = 1); + +*----------------------------------------------------------------------------- +* determination of capacity-ONLY related flows +*----------------------------------------------------------------------------- +* Initialize capflo indicators for UC_FLO + SET UC_CAPFLO(UC_N,SIDE,R,P,C); + UC_CAPFLO(UC_N,SIDE,RPC_NOFLO(R,P,C))$UC_ATTR(R,UC_N,SIDE,'FLO','CAPFLO') = YES; + RPC_NOFLO(RPC_PG) = NO; + RPCS_VAR(RPC_NOFLO(R,P,C),ANNUAL)$(NOT RPC(R,P,C)) = YES; + TRACKPC(RPC_NOFLO) = YES; +* identify those commodities involved ONLY with capacity by eliminating those with flows + LOOP(TRACKPC(R,P,C), + IF(RP_IRE(R,P), +* RPC_IRE implies IRE_FLOc so not only capacity related + Z = NOT SUM(RPC_IRE(R,P,C,IE),1); + Z$Z = NOT SUM((RTPC(R,T,P,COM),S,IE,IO)$IRE_FLOSUM(R,T,P,COM,S,IE,C,IO),RPC_IRE(R,P,COM,IE)); + ELSE + Z = NOT SUM(RTPC(R,T,P,C)$PRC_ACTFLO(R,T,P,C),1); +* check for the commodity within flo_func/sum/shar + Z$Z = NOT SUM((T,CG1,CG2,S)$FLO_FUNC(R,T,P,CG1,CG2,S),COM_GMAP(R,CG1,C)+COM_GMAP(R,CG2,C)); + Z$Z = NOT SUM((T,CG1,COM,CG2,S)$FLO_SUM(R,T,P,CG1,COM,CG2,S),COM_GMAP(R,COM,C)+COM_GMAP(R,CG2,C)); + Z$Z = NOT SUM((T,CG,S,BD)$FLO_SHAR(R,T,P,C,CG,S,BD),1); + ); + IF(NOT Z, RPC_NOFLO(R,P,C) = NO); + ); + OPTION CLEAR=TRACKPC; + +*----------------------------------------------------------------------------- +* do the basic initializations that are TS-based, including aggregate/inherit +*----------------------------------------------------------------------------- +* commodity related attributes +*----------------------------------------------------------------------------- +* infastructure efficiency +* set seasonal fraction for commodity if necessary, G_YRFR('ANNUAL') already = 1 +* difference between the average calculated demand and the actual shape of the peak +* commodity based costs, subsidies and taxes +* elastic demands base price, quantity, elasticity and steps + +$ BATINCLUDE pp_lvlfc.mod COM_IE C COM_TS '' ",'0','0','0','0'" ALL_TS T RTC(R,T,C) +$ BATINCLUDE pp_lvlfc.mod COM_FR C COM_TS '' ",'0','0','0','0'" ALL_TS T RTC(R,T,C) 1 +$ BATINCLUDE pp_lvlfc.mod COM_PKFLX C COM_TS '' ",'0','0','0','0'" ALL_TS T YES +$ BATINCLUDE pp_lvlfc.mod OBJ_COMNT C COM_TS ',COSTYPE,CUR' ",'0','0'" ALL_TS DATAYEAR RC(R,C) +$ BATINCLUDE pp_lvlfc.mod OBJ_COMPD C COM_TS ',COSTYPE,CUR' ",'0','0'" ALL_TS DATAYEAR RC(R,C) +$ BATINCLUDE pp_lvlfc.mod COM_ELAST C COM_TS ',BD' ",'0','0','0'" ALL_TS DATAYEAR RC(R,C) +$ BATINCLUDE pp_lvlfc.mod COM_BPRICE C COM_TS ',CUR' ",'0','0','0'" ALL_TS DATAYEAR RC(R,C) +$ BATINCLUDE pp_lvlfc.mod COM_BQTY C COM_TS '' ",'0','0','0','0','0'" ALL_TS '' RC(R,C) 1 + +* Defaults for infrastructure efficiency and seasonal fraction + OPTION RCS < COM_IE; + COM_IE(RTCS_VARC(R,T,C,S))$(NOT RCS(R,C,S)) = 1; +*GG* 010406 - sum up COM_FRs below on a seasonal level so RTCS_TSFR set below +* Get the timeslices where COM_FR has been given + COM_FR(R,LL,C,ANNUAL)=0; OPTION RCS0))/RS_FR(R,S,TS)-1; + COM_FR(RTC(R,T,C),RTS(S))$((NOT COM_FR(RTC,S))$RCS_COMTS(R,C,S)) = G_YRFR(R,S); + +*----------------------------------------------------------------------------- +* Elastic demands +*----------------------------------------------------------------------------- + OPTION DEM < COM_PROJ; +* Preprocess TIMES-Micro +$IF %TIMESED%==YES $BATINCLUDE pp_micro.mod PRE +* check sign of COM_ELAST and set RCJ after assigning default COM_STEPs + COM_ELAST(R,T,C,S,BDNEQ(BD))$COM_ELAST(R,T,C,S,BD) = + -ABS(COM_ELAST(R,T,C,S,BD)-1+1)$SUM(RDCUR(R,CUR),COM_BPRICE(R,T,C,S,CUR)*COM_VOC(R,T,C,BD)>0); + OPTION RC_AGP < COM_ELAST; COM_STEP(RC_AGP(RC,BDNEQ))$(NOT COM_STEP(RC,BDNEQ)) = MAX(1,COM_STEP(RC,'FX')); + RCJ(RC,J,BD)$((ORD(J) <= COM_STEP(RC,BD))$RC_AGP(RC,BD)) = 1; OPTION CLEAR=RC_AGP; + +*----------------------------------------------------------------------------- +* process availability factor +* - apply MULTI (moved to coef_cpt) +* - move up to the appropriate level, if applicable +* - move down to the appropriate level, if applicable +* - set default, if necessary +*----------------------------------------------------------------------------- + +* leveling of availability; set at the PRC level by bring down 1st one from above, if not yet set + PUTGRP = 0; + RTPS_BD(RTP(R,V,P),S,BD)$PRC_TS(R,P,S) $= NCAP_AFS(RTP,S,BD)$(NOT NCAP_AF(RTP,S,BD)); +$ BATINCLUDE pp_lvlbr.%1 NCAP_AF '' PRC_TS ",'0','0'" 0 1 + NCAP_AF(RTPS_BD)$NCAP_AF(RTPS_BD) $= NCAP_AFS(RTPS_BD); + +* Mark those timeslices that have NCAP_AFs: + OPTION CLEAR=RXX,CLEAR=RTPS_BD; + RTPS_BD(R,LL--(ORD(LL)*(NCAP_AF(R,LL,P,S,BD) GT 0)),P,S,BDUPX(BD))$(V(LL)$NCAP_AF(R,LL,P,S,BD))=YES; + OPTION TRACKP < RTPS_BD; RXX(PRC_TS(TRACKP(R,P),S))$=SUM(RTPS_BD(R,LASTLL,P,S,BDUPX),1); +* Set default if no PRC_TS has NCAP_AFs : + NCAP_AF(RTP(R,V,P),S,'UP')$(PRC_TS(R,P,S)$(NOT TRACKP(R,P))) = 1.0; + RXX(PRC_TS(R,P,S)) = (NOT RXX(R,P,S))$TRACKP(R,P); + NCAP_AF(RTP(R,V,P),S,'UP')$(RXX(R,P,S)$RP_STG(R,P)) = EPS; RXX(RP_STG,S) = NO; + +* Make sure to get rid of any remaining PRC_TS for which no NCAP_AF + LOOP(PRC_TS(RXX(R,P,TS)),PRC_TS2(R,P,S)$TS_MAP(R,TS,S) = YES); + PRC_TS(PRC_TS2) = NO; + RPCS_VAR(RPCS_VAR(R,P,C,S))$PRC_TS2(R,P,S) = NO; + RTPCS_OUT(RTPC(R,T,P,C),S)$PRC_TS2(R,P,S) = YES; + OPTION CLEAR=PRC_TS2,CLEAR=TRACKP,CLEAR=RTPS_BD; + +*----------------------------------------------------------------------------- +* Fraction of capacity that can contribute to the peak +* +* 1) If NCAP_PKCNT below or ablve COM_TS is specified => aggregate & inherit to COM_TS +* +* 2) If no value given, +* a) If PRC_PKAF(r,p) is specified, NCAP_AF is used for NCAP_PKCNT, +* where FX has precedence over UP +* b) otherwise 1 +* +$ BATINCLUDE pp_lvlpk.mod 1.0 + +*----------------------------------------------------------------------------- +* flow related attributes +*----------------------------------------------------------------------------- +* costs, subsidy, taxes, & flow rates + +$ BATINCLUDE pp_lvlfc.mod FLO_COST 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N +$ BATINCLUDE pp_lvlfc.mod FLO_DELIV 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N +$ BATINCLUDE pp_lvlfc.mod FLO_SUB 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N +$ BATINCLUDE pp_lvlfc.mod FLO_TAX 'P,C' RPCS_VAR ',CUR' ",'0','0'" ALL_TS DATAYEAR RPC(R,P,C) '' '' N +$ BATINCLUDE pp_lvlfc.mod FLO_PKCOI 'P,C' RPCS_VAR '' ",'0','0','0'" ALL_TS T RTP(R,T,P) +$ BATINCLUDE pp_lvlfc.mod ACT_FLO 'P' RPS_S1 '' ",'0','0','0'" ALL_TS V RTP(R,V,P) 0 ',C' 0 $STOA(S) + +*GG*PKCOI defaults to 1 + LOOP((RPC(R,P,C),COM_GMAP(COM_PEAK(R,CG),C))$(TOP(RPC,'IN')+RPC_IRE(RPC,'EXP')), + IF(NOT SUM((RTP(R,T,P),RPCS_VAR(RPC,TS))$FLO_PKCOI(RTP,C,TS),1),TRACKPC(RPC)=YES)); + TRACKPC(PRC_PKNO(R,P),C)=NO; + FLO_PKCOI(RTP(R,T,P),C,S)$(RPCS_VAR(R,P,C,S)$TRACKPC(R,P,C)) = 1.0 + OPTION CLEAR=TRACKPC; + +* derive the CHP flow control attributes from the input data +$ BATINCLUDE pp_chp.%1 %1 + +*----------------------------------------------------------------------------- +* the actual flow control attributes +*----------------------------------------------------------------------------- +* FLO_ attributes + +* handle FLO_FUNC aggregation/inheritance +$ BATINCLUDE pp_lvlff.mod + +* handle FLO_SUM aggregation/inheritance +$ BATINCLUDE pp_lvlfs.mod +* Add FLO_SUM translated from PRC_ACTFLO + IRE_FLOSUM(RTP(R,V,P),C,S,IE,COM,IO)$(RPC_PG(R,P,C)*RPC_IRE(R,P,C,IE)*RPCS_VAR(R,P,C,S)*TOP(R,P,COM,IO)) $= + SUM(RPC_ACT(RP_IRE(R,P),COM),PRC_ACTFLO(R,V,P,COM)*(1/PRC_ACTFLO(R,V,P,C))); + FLO_SUM(RTP(R,V,P),CG,C,COM,S)$(RP_PG(R,P,CG)*RPC_PG(R,P,C)*PRC_TS(R,P,S)) $= + SUM(RPC_ACT(RP_FLO(R,P),COM),PRC_ACTFLO(R,V,P,COM)*(1/PRC_ACTFLO(R,V,P,C))); + OPTION CLEAR=RPC_ACT; + +* handle FLO_SHAR aggregation/inheritance +$ BATINCLUDE pp_lvlbr.%1 FLO_SHAR ',C,CG' RPCS_VAR "" 1 0 C, +* preprocessing of FLO_MARK/PRC_MARK +$ BATINCLUDE eqflomrk.%1 + +*----------------------------------------------------------------------------- +* inter-regional exchange related attributes +*----------------------------------------------------------------------------- + PUTGRP = 0; +$ BATINCLUDE pp_lvlfc.mod IRE_PRICE 'P,C' RPCS_VAR ',ALL_REG,IE,CUR' '' ALL_TS DATAYEAR 'RPC_IRE(R,P,C,IE)' +$ BATINCLUDE pp_lvlfc.mod IRE_FLOSUM P PRC_TS ',IE,COM,IO' '' ALL_TS T 'RTP(R,T,P)' 0 ',C' +* this routine only handles IRE_FLO +$ BATINCLUDE pp_lvlif.mod %1 + +*----------------------------------------------------------------------------- +* Preprocess market-based trade +*----------------------------------------------------------------------------- +* Set endogenous trade indicators + IF(CARD(RXX) GT 0, OPTION CLEAR=RXX); + LOOP(TOP_IRE(R,C,REG,COM,P),RXX(R,C,P) = YES; RPC_IREIO(REG,P,COM,'IMP','IN') = YES); + RPC_IREIO(R,P,C,'EXP','IN')$RXX(R,C,P) = YES; + RPC_IREIO(RPC_IRE(R,P,C,IE),'OUT')$(NOT RPC_IREIO(R,P,C,IE,'IN')) = YES; + PRC_MAP(R,'DISTR',P)$PRC_MAP(R,'CORR',P) = YES; + IRE_DIST(RP_IRE(R,P))$PRC_MAP(R,'DISTR',P) = YES; + +* Define a marketplace whenever there are several import regions + LOOP(RXX(R,C,P)$(SUM(TOP_IRE(R,C,REG,COM,P),1) GT 1),RPC_MARKET(R,P,C,'EXP') = YES); +* Define a marketplace whenever there is an intermediate region between two other regions + RXX(R,C,P)$IRE_DIST(R,P) = NO; + LOOP(TOP_IRE(REG,COM,RXX(R,C,P))$(NOT SUM(COM1$TOP_IRE(R,C,REG,COM1,P),1)),RPC_MARKET(R,P,C,'EXP') = YES); + +* Ensure that over distribution all directly linked regions after first market are also markets + TRACKPC(IRE_DIST(R,P),C)$RPC_MARKET(R,P,C,'EXP') = YES; + WHILE(CARD(TRACKPC), OPTION CLEAR=RXX; + LOOP((TRACKPC(R,P,C),TOP_IRE(R,C,REG,COM,P),RPC_IRE(REG,P,COM1,'EXP')), + IF(NOT SUM(COM2$TOP_IRE(REG,COM1,R,COM2,P),1),RXX(REG,P,COM1)=YES)); + OPTION CLEAR=TRACKPC; TRACKPC(RXX(R,P,C))$(NOT RPC_MARKET(R,P,C,'EXP')) = YES; + RPC_MARKET(TRACKPC,'EXP') = YES); + + PUTGRP=0; +* Set the import commodities for marketplaces + LOOP(RPC_MARKET(R,P,C,IE)$(NOT SUM(TOP_IRE(R,C,R,COM,P),1)), +* If only one import and market commodity is involved for (R,P), choose the import: + Z=SUM(RPC_IRE(R,P,COM,'IMP'),1)+EPS; + IF(IRE_DIST(R,P),IF(Z GT 1, +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Unsupported diverging trade topology' + PUT QLOG ' WARNING - Too complex topology: R=',%RL%,' P=',P.TL;) + ELSEIF Z=1, Z=SUM(COM$RPC_MARKET(R,P,COM,'EXP'),1)); + IF(Z EQ 1, LOOP(RPC_IRE(R,P,COM,'IMP'), Z=0; CG_GRP(R,P,C,COM) = YES)); + IF(Z,CG_GRP(R,P,C,C) = YES)); + LOOP(CG_GRP(R,P,C,COM),RC_RC(R,C,R,COM) = YES); + TOP_IRE(RC_RC(R,C,R,COM),P)$CG_GRP(R,P,C,COM) = YES; + OPTION CLEAR=CG_GRP; + +* Complete the preparation of marketplace + LOOP(TOP_IRE(R,C,R,COM,P), +* If no IRE_FLO set for marketplace, set default values + IF(IRE_DIST(R,P), + IRE_FLO(RTP(R,V,P),C,R,COM,S)$((IRE_FLO(R,V,P,C,R,COM,S) EQ 0)$RPCS_VAR(R,P,COM,S)) = 1; + ELSE F = SUM((RTP(R,T,P),S)$IRE_FLO(R,T,P,C,R,COM,S),1); + LOOP((REG,COM1)$(TOP_IRE(R,C,REG,COM1,P)$(NOT F)), + F = SUM((RTP(R,T,P),S)$IRE_FLO(R,T,P,C,REG,COM1,S),1); + IF(F, IRE_FLO(RTP(R,V,P),C,R,COM,S)$RPCS_VAR(R,P,COM,S) = IRE_FLO(R,V,P,C,REG,COM1,S))))); + +* Set standard EQIRE control for all imports other than from marketplace region + LOOP(TOP_IRE(R,C,REG,COM,P)$RPC_MARKET(R,P,C,'EXP'),IF(NOT SAMEAS(R,REG),TRACKPC(REG,P,COM) = YES)); + RPC_EQIRE(RPC_IRE(R,P,C,'IMP'))$((NOT TRACKPC(R,P,C))$RPC_IREIO(R,P,C,'IMP','IN')) = YES; + OPTION CLEAR=TRACKPC; + +* Set all non-standard EQIRE and MARKET controls + LOOP(TOP_IRE(R,C,R,COM,P), + IF(NOT RPC_EQIRE(R,P,COM,'IMP'), RPC_EQIRE(R,P,C,'EXP') = YES; + ELSEIF RPC_MARKET(R,P,C,'EXP'), + IF(IRE_DIST(R,P), RPC_EQIRE(R,P,C,'EXP') = YES; ELSE RPC_MARKET(R,P,COM,'IMP') = YES))); + TOP_IRE(R,C,R,COM,P)$RPC_EQIRE(R,P,C,'EXP') = NO; + +* Copy shutdown periods of marketplace to import regions + LOOP(RPC_MARKET(R,P,C,'EXP'),RTPC(REG,T,P,COM)$(TOP_IRE(R,C,REG,COM,P)$(NOT RTP_VARA(R,T,P))) = NO); +* Copy shutdown periods of import process to export regions + LOOP(TOP_IRE(REG,C,R,COM,P)$RPC_EQIRE(R,P,COM,'IMP'),RTPC(REG,T,P,C)$(NOT RTP_VARA(R,T,P)) = NO); + +* Reset RP_AIRE for distr IRE processes + RP_AIRE(RP_IRE(R,P),'EXP')$(RP_AIRE(R,P,'IMP')$IRE_DIST(R,P)) = NO; + +* Set IRE_FLOSUM for C if activity has IE flow + IRE_FLOSUM(RTP(R,T,P),C,S,IE,COM,IO)$(RPC_PG(R,P,C)$RP_AIRE(R,P,IE)$IRE_FLOSUM(RTP,%PGPRIM%,S,IE,COM,IO)) = + IRE_FLOSUM(RTP,%PGPRIM%,S,IE,COM,IO)*(1/PRC_ACTFLO(RTP,C)); + IRE_FLOSUM(R,T,P,%PGPRIM%,S,IE,COM,IO) = 0; +*----------------------------------------------------------------------------- + +* OK inter-regional trade if in topology +* Default values for IRE_FLO by LOOP over TOP_IRE + LOOP(TOP_IRE(R,C,REG,COM,P), + IF(NOT SUM((RTP(R,T,P),S)$IRE_FLO(R,T,P,C,REG,COM,S),1), + IRE_FLO(RTP(R,V,P),C,REG,COM,S)$PRC_TS(REG,P,S) = 1)); + +*----------------------------------------------------------------------------- +* determination of vintaging for processes +*----------------------------------------------------------------------------- +* vintaging period control such that v=t if no vintaging, otherwise = CPT periods + RTP_VINTYR(RTP_CPTYR(R,V,T,P))$PRC_VINT(R,P)= YES; +*V0.5a 980810 - always variables within availability of process + RTP_VINTYR(R,T,T,P)$((NOT PRC_VINT(R,P)) * RTP(R,T,P) * SUM(V,RTP_CPTYR(R,V,T,P))) = YES; + +*----------------------------------------------------------------------------- +* initialize the commodity balance equation type +* - equality (MAT,ENV,FIN) +* - prodution >= consumption (NRG,DEM) +*GG* questions about conservation and renewables being =N=? +*----------------------------------------------------------------------------- +* set the sub-sets of commodities + NRG(RC(R,C))$COM_TMAP(R,'NRG',C) = YES; + MAT(RC(R,C))$COM_TMAP(R,'MAT',C) = YES; + DEM(RC(R,C))$COM_TMAP(R,'DEM',C) = YES; + ENV(RC(R,C))$COM_TMAP(R,'ENV',C) = YES; + FIN(RC(R,C))$COM_TMAP(R,'FIN',C) = YES; + +* free up if conservation or free energy type, unless provided by the user +*GG* need to add code to INITSYS/MOD_EQUA/EQMAIN to handle =N= (e.g. what is bound), +* ignored at the moment with no equation created + TRACKC(RC) = YES; + LOOP(LIM,TRACKC(R,C)$COM_LIM(R,C,LIM) = NO); + COM_LIM(TRACKC(NRG(R,C)),'UP')$(NRG_TMAP(R,'CONSRV',C) + NRG_TMAP(R,'FRERENEW',C)) = YES; +* set defaults if not provided by user + TRACKC(R,C)$COM_LIM(R,C,'UP') = NO; + COM_LIM(MAT(TRACKC),'FX') = YES; + COM_LIM(FIN(TRACKC),'FX') = YES; + TRACKC(R,C)$COM_LIM(R,C,'FX') = NO; + COM_LIM(TRACKC,'LO') = YES; + OPTION CLEAR=TRACKC; + +* handle TIMES-MACRO +$ IFI %MACRO%==YES COM_LIM(RC(DEM),BD)$(NOT COM_LIM(RC,'N')) = NOT BDNEQ(BD); +$ IFI %MICRO%==YES COM_LIM(RC(DEM),BD)$(NOT COM_LIM(RC,'N')) = NOT BDNEQ(BD); + +*----------------------------------------------------------------------------- +* establish inter-regional convert attributes +*----------------------------------------------------------------------------- +* identify regions trading + OPTION RREG <= TOP_IRE; OPTION CLEAR=RXX; + LOOP(RREG(ALL_R,ALL_REG), Z=1; +* if all regions working with same time-slices set to 1, +* assumption is if have one direction then have to other too + LOOP(TSLVL$Z, + Z$Z = PROD(TS_GROUP(ALL_R,TSLVL,S),TS_GROUP(ALL_REG,TSLVL,S)); + Z$Z = PROD(TS_GROUP(ALL_REG,TSLVL,S),TS_GROUP(ALL_R,TSLVL,S)); + IF(Z, RXX(ALL_R,S,ALL_REG)$TS_GROUP(ALL_R,TSLVL,S) = YES))); + RXX(ALL_R,S,ALL_REG)$RXX(ALL_REG,S,ALL_R) = YES; + IRE_TSCVT(RXX(ALL_R,S,ALL_REG),S)$(NOT IRE_TSCVT(ALL_R,S,ALL_REG,S)) = 1; +* if regions working with commodities in the same units set convert to 1, +* assumption is if have one direction then have the other too + OPTION RC_RC < IRE_CCVT; + IRE_CCVT(RC_RC(RC,R,C))$(NOT IRE_CCVT(RC_RC)) = 1/IRE_CCVT(R,C,RC); + OPTION RC_RC <= TOP_IRE; IRE_CCVT(RC_RC)$(NOT IRE_CCVT(RC_RC)) = 1; + OPTION RC_RC < TOP_IRE; IRE_CCVT(RC_RC)$(NOT IRE_CCVT(RC_RC)) = 1; + +*----------------------------------------------------------------------------- +* process bounds to see if aggregation is necessary +*----------------------------------------------------------------------------- + PUTGRP = 0; + OPTION CLEAR=UNCD7; +$ BATINCLUDE pp_lvlbd.%1 ACT_BND P '' '' '' PRC_TS RPS_PRCTS RTPS_BD EPS +$ BATINCLUDE pp_lvlbd.%1 FLO_FR P C, '' ",''" RPCS_VAR RPCS_VAR UNCD7 0 +$ BATINCLUDE pp_lvlbd.%1 COM_BNDNET C '' '' ",'',''" COM_TS RCS_COMTS UNCD7 +$ BATINCLUDE pp_lvlbd.%1 COM_BNDPRD C '' '' ",'',''" COM_TS RCS_COMTS UNCD7 +$ BATINCLUDE pp_lvlbd.%1 IRE_BND C '' 'ALL_R,IE,' '' COM_TS RCS_COMTS UNCD7 EPS + +*----------------------------------------------------------------------------- +* process cumulative bounds +*----------------------------------------------------------------------------- +* process flows: UC_CUMFLO + UC_CUMFLO(UC_N,R,P,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR)) $= UC_CUMFLO(UC_N,R,P,C,BOHYEAR,EOHYEAR); + UC_CUMFLO(UC_N,R,P,C,BOHYEAR,EOHYEAR)$(NOT LL(BOHYEAR)*LL(EOHYEAR)) = 0; + UC_CUMFLO(UC_N,R,P,%PGPRIM%,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR)) $= UC_CUMACT(UC_N,R,P,BOHYEAR,EOHYEAR); + LOOP((UC_N,RP,C,YEAR,LL)$UC_CUMFLO(UC_N,RP,C,YEAR,LL),RPC_CUMFLO(RP,C,YEAR,LL)=YES); +* process flows: FLO_CUM + FLO_CUM(R,P,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR),L) $= FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,L); + FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,L)$(NOT LL(BOHYEAR)*LL(EOHYEAR)) = 0; + FLO_CUM(R,P,%PGPRIM%,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR),L) $= ACT_CUM(R,P,BOHYEAR,EOHYEAR,L); + RPC_CUMFLO(RP,C,YEAR,LL) $= SUM(L$FLO_CUM(RP,C,YEAR,LL,L),YES); + OPTION CLEAR=UC_CUMACT,CLEAR=ACT_CUM; +* commodities: UC_CUMCOM + UC_CUMCOM(UC_N,R,COM_VAR,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR)) $= UC_CUMCOM(UC_N,R,COM_VAR,C,BOHYEAR,EOHYEAR); + UC_CUMCOM(UC_N,R,COM_VAR,C,BOHYEAR,EOHYEAR)$(NOT LL(BOHYEAR)*LL(EOHYEAR)*RC(R,C)) = 0; + LOOP((UC_N,R,COM_VAR,C,YEAR,LL)$UC_CUMCOM(UC_N,R,COM_VAR,C,YEAR,LL),RC_CUMCOM(R,COM_VAR,YEAR,LL,C)=YES); +* commodities: COM_CUMNET/COM_CUMPRD + COM_CUM(R,'NET',YEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,L) $= COM_CUMNET(R,BOHYEAR,EOHYEAR,C,L); + COM_CUM(R,'PRD',YEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,L) $= COM_CUMPRD(R,BOHYEAR,EOHYEAR,C,L); + OPTION CLEAR=COM_CUMNET,CLEAR=COM_CUMPRD; + RC_CUMCOM(R,COM_VAR,YEAR,LL(EOHYEAR),C) $= SUM(L$COM_CUM(R,COM_VAR,YEAR,LL,C,L),YES); + +*----------------------------------------------------------------------------- +* determine if VAR_COMxxx needed on RHS of EQ_COM equations +*----------------------------------------------------------------------------- +* commodities aggregated by COM_AGG + LOOP((R,T,C,COM)$COM_AGG(R,T,C,COM),RC_AGP(COM_LIM(R,C,LIM)) = YES); + RC_AGP(R,C,BD)$(COM_TMAP(R,'DEM',C)$RC_AGP(R,C,'LO')) = NOT BDNEQ(BD); + RC_AGP(RC,'FX')$RC_AGP(RC,'N') = YES; + RHS_COMBAL(RTCS_VARC(R,T,C,S))$RC_AGP(R,C,'LO') = YES; + RHS_COMPRD(RTCS_VARC(R,T,C,S))$RC_AGP(R,C,'FX') = YES; +* commodities involved in DAM comprod +$IF DEFINED DAM_ELAST RHS_COMPRD(RTCS_VARC(R,T,C,S))$DAM_ELAST(R,C,'N') = YES; +* commodities involved in CUM constraints + LOOP(RC_CUMCOM(R,'NET',ALLYEAR,LL,C), + RTC_NET(R,T,C)$((E(T) >= YEARVAL(ALLYEAR)) * (B(T) <= YEARVAL(LL))) = YES; +$IFI %OBJ%==LIN RTC_NET(R,T,C)$((M(T)+LAGT(T) > YEARVAL(ALLYEAR)) * (M(T)-LEAD(T) < YEARVAL(LL))) = YES; + ); + LOOP(RC_CUMCOM(R,'PRD',ALLYEAR,LL,C), + RTC_PRD(R,T,C)$((E(T) >= YEARVAL(ALLYEAR)) * (B(T) <= YEARVAL(LL))) = YES; +$IFI %OBJ%==LIN RTC_PRD(R,T,C)$((M(T)+LAGT(T) > YEARVAL(ALLYEAR)) * (M(T)-LEAD(T) < YEARVAL(LL))) = YES; + ); +* check all TS at/above COM_TSL for bounds + RHS_COMBAL(RTCS_VARC(RTC_NET,S)) = YES; + COM_CSTNET(R,LL--ORD(LL),C,S--ORD(S),CUR)$(COM_CSTNET(R,LL,C,S,CUR)+COM_SUBNET(R,LL,C,S,CUR)+COM_TAXNET(R,LL,C,S,CUR)) = EPS; + LOOP((R,C,S,RDCUR(R,CUR))$COM_CSTNET(R,'0',C,S,CUR),RHS_COMBAL(RTCS_VARC(R,T,C,TS)) = YES); + RHS_COMBAL(RTCS_VARC(R,T,C,S))$SUM((TS_MAP(R,TS,S),BD)$COM_BNDNET(R,T,C,TS,BD),ABS(COM_BNDNET(R,T,C,TS,BD)) NE INF$BDUPX(BD)) = YES; + RHS_COMPRD(RTCS_VARC(RTC_PRD,S)) = YES; + COM_CSTPRD(R,LL--ORD(LL),C,S--ORD(S),CUR)$(COM_CSTPRD(R,LL,C,S,CUR)+COM_SUBPRD(R,LL,C,S,CUR)+COM_TAXPRD(R,LL,C,S,CUR)) = EPS; + LOOP((R,C,S,RDCUR(R,CUR))$COM_CSTPRD(R,'0',C,S,CUR),RHS_COMPRD(RTCS_VARC(R,T,C,TS)) = YES); + RHS_COMPRD(RTCS_VARC(R,T,C,S))$SUM((TS_MAP(R,TS,S),BD)$COM_BNDPRD(R,T,C,TS,BD), + (ABS(COM_BNDPRD(R,T,C,TS,BD)) NE INF) AND (COM_BNDPRD(R,T,C,TS,BD) NE NA$BDUPX(BD))) = YES; + +*----------------------------------------------------------------------------- +* Storage +*----------------------------------------------------------------------------- +* Remove standard flow variables from genuine storage charge/discharge flows + RTPCS_OUT(RTP(R,T,P),C,S)$(RPCS_VAR(R,P,C,S)$RPC_STG(R,P,C)) = YES; + +* Prepare demand sifting storages + OPTION TRACKPC < STG_SIFT; TRACKPC(RP,C)$(NOT (TOP(RP,C,'OUT')$RPC_STG(RP,C)+ACTCG(C))$RP_STG(RP))=NO; + TRACKPC(RP,C)$PRC_NSTTS(RP,'ANNUAL')=NO; + LOOP(TRACKPC(R,P,C),TRACKP(R,P)=YES; RPC_PKC(R,P,C)=NO; RHS_COMPRD(RTCS_VARC(R,T,C,S))=YES); + RPC_SPG(RPC_STG(TRACKP,C))=YES; RPC_STGN(TOP(RPC_STG(RPC_SPG(RP,C)),IO))$TOP(RP,C,'IN') = (TRACKPC(RP,C) EQV IPS(IO)); + LOOP(PRC_TSL(TRACKP(RP(R,P)),TSLVL), RP_STS(RP)=NO; RP_STG(RP)=NO; + Z=1-SUM(RPCS_VAR(RP,C,ANNUAL),2); LOOP(TOP(RPC_STG(RP,C),'IN'),IF(Z>0,RPC_LS(RP,C)=YES);Z=Z-1); RPC_LS(RP,C(ACTCG))$Z=YES; +* Levelize STG_SIFT(ACT) + LOOP(TRACKPC(RP,C(ACTCG)),F=SUM(RLUP(R,TSLVL,TSL),ORD(TSL)-1); IF(F=0,F=Z); + LOOP(RJLVL(J,R,TSL)$(F>=ORD(TSL)), + LOOP(TS_GROUP(R,TSL,TS),STG_SIFT(R,T,P,C,S)$(NOT STG_SIFT(R,T,P,C,S)) $= STG_SIFT(R,T,P,C,TS)$(STOAL(R,S)=F)$RS_BELOW(R,TS,S))); + STG_SIFT(R,T,P,C,S)$(STOAL(R,S) NE F)=0); + ACT_TIME(RTP(R,T,P),'LO')$(ACT_TIME(RTP,'UP')=0)=0; + ACT_TIME(RTP(R,T,P),BD)$ACT_TIME(RTP,'FX')=ACT_TIME(RTP,'FX')$BDUPX(BD)); + RPC_LS(RPC(RP,C))$RPC_LS(RP,%PGPRIM%)=NO; + +* Controls for flexible general storage + RPS_STG(PRC_TS(RP_STG,TS)) = YES; + RPS_STG(R,P,ANNUAL)$PRC_MAP(R,'STK',P) = NO; + RP_STS(R,P)$PRC_TSL(R,P,'ANNUAL') = NO; + LOOP(RP_STS(R,P), + PRC_TS(RPS_PRCTS(R,P,S))$STOA(S) = YES; + PRC_TS(R,P,ANNUAL)$PRC_MAP(R,'STK',P) = YES; + PRC_STGTSS(PRC_STGIPS(R,P,C)) = YES; + STG_LOSS(R,V,P,S)$STG_LOSS(R,V,P,S) = -ABS(STG_LOSS(R,V,P,S))); + RP_STL(RP_STS(RP),TSL+1,'N')$(PRC_SGL(RP)>=ORD(TSL)) = YES; + NCAP_AF(RTP(R,V,P),S,BD)$((NOT RPS_STG(R,P,S))$RP_STS(R,P)) = NCAP_AFS(RTP,S,BD); + +* Levelization of STG_LOSS and STG_SIFT + TRACKP(RP_STG)$(NOT RP_STS(RP_STG)) = YES; +$ BATINCLUDE pp_lvlfc.mod STG_LOSS P PRC_TS '' ",'0','0','0','0'" S2 V 'RTP(R,V,P)$(NOT RPS_STG(R,P,S)$TRACKP(R,P))' +$ BATINCLUDE pp_lvlfc.mod STG_SIFT 'P,C' RPCS_VAR '' ",'0','0','0'" ALL_TS T RTP(R,T,P) +* Convert equilibrium losses into standard losses for IPS, and adjust all losses by year fractions + STG_LOSS(RTP(R,V,P),S(TSL))$((ABS(STG_LOSS(RTP,S)*2-1)>=1)$PRC_MAP(R,'STK',P)) = 1-EXP(-ABS(STG_LOSS(RTP,S))); + STG_LOSS(RTP(R,V,P),S)$(STOA(S)$STG_LOSS(RTP,S)) = LOG(EXP(STG_LOSS(RTP,S)*G_YRFR(R,S)/RS_STGPRD(R,S))); + OPTION CLEAR=TRACKP,CLEAR=TRACKPC; + +*----------------------------------------------------------------------------- +* User constraints +*----------------------------------------------------------------------------- +* Default values +$ BATINCLUDE prepxtra.mod UCINT +*----------------------------------------------------------------------------- +* Levelized UC_RHSRTS + LOOP(T,UC_TSL(R,UC_N,SIDE,TSL)$UC_T_SUCC(R,UC_N,T)=NO); + OPTION R_UCORD(TSLVL)), + LOOP(TS_GROUP(R,TSLVL,TS),UC_RHSRTS(R_UC(R,UCN),T,S,L)$((NOT UC_RHSRTS(R_UC,T,S,L))$UC_TSL(R_UC,'LHS',TSL)) $= UC_RHSRTS(R_UC,T,TS,L)$RS_BELOW(R,TS,S)$TS_GROUP(R,TSL,S))); + LOOP(UC_TSL(R_UC(R,UCN),'LHS',TSL)$SUM(UC_TS_EACH(R_UC,S),1),UC_RHSRTS(R_UC,T,S,L)$((NOT UC_TS_EACH(R_UC,S))$TS_GROUP(R,TSL,S))=0); + UC_TS_EACH(R_UC,S) = NO; UC_ATTR(R_UC,SIDE,UC_GRPTYPE,UC_NAME(TSL)) = NO; +* Support for the obsolete + UC_RHS(UC_N,L)$(NOT UC_RHS(UC_N,L)) $= UC_RHSS(UC_N,'ANNUAL',L); + UC_RHSR(R,UC_N,L)$(NOT UC_RHSR(R,UC_N,L)) $= UC_RHSRS(R,UC_N,'ANNUAL',L); +* --- Set UC_R_EACH / UC_R_SUM defaults + OPTION CLEAR=UNCD1; UNCD1(UCN)$(NOT SUM(UC_R_EACH(ALL_R,UCN),1)) = YES; + UC_ON(R,UCN)$SUM(L$UC_RHSR(R,UCN,L),1) = YES; + UC_ON(R,UCN)$SUM((T,L)$UC_RHSRT(R,UCN,T,L),1) = YES; + UC_ON(R,UCN)$SUM((T,S,L)$UC_RHSRTS(R,UCN,T,S,L),1) = YES; + UC_R_EACH(R,UCN)$(NOT UC_ON(R,UCN))=NO; UC_R_EACH(UC_ON(R,UCN))$=UNCD1(UCN); + OPTION CLEAR=UNCD1; UNCD1(UCN)$(NOT SUM(UC_R_SUM(ALL_R,UCN),1)) = YES; + UC_DT(R,UCN)$SUM(L$UC_RHS(UCN,L),1) = YES; + UC_DT(R,UCN)$SUM((T,L)$UC_RHST(UCN,T,L),1) = YES; + UC_DT(R,UCN)$SUM((T,S,L)$UC_RHSTS(UCN,T,S,L),1) = YES; + UC_R_SUM(R,UCN)$(NOT UC_DT(R,UCN))=NO; UC_R_SUM(UC_DT(R,UCN))$=UNCD1(UCN); + OPTION CLEAR=UC_DT,UC_ON= BL_START(R,BLE,SPE)) = YES +); +BL_UNIT(BLE_SPE(R,BLE,SPE))$(NOT BL_UNIT(R,BLE,SPE)) = 1; + +*** ONLY TID FOR NOW *** +* set time-dependent blending SPEcificiation from TID if not provided +*TBL_SPEC(BLE_SPE(BLE,SPE),TP)$(BL_SPEC(BLE,SPE) AND (NOT TBL_SPEC(BLE,SPE,TP))) = +* BL_SPEC(BLE,SPE); +** set time-dependent 3-tuple +BLE_SPEOPR(BLE_SPE(R,BLE,SPE),OPR)$BL_COM(R,BLE,OPR,SPE) = YES; +*BLE_SPEOPR(BLE,SPE,OPR)$(BL_COM(BLE,OPR,SPE) OR +* SUM(YEAR,TBL_COM(BLE,SPE,OPR,YEAR))) = YES; +*TBL_COM(BLE_SPEOPR(BLE,SPE,OPR),TP)$(BL_COM(BLE,OPR,SPE) AND +* (NOT TBL_COM(BLE,SPE,OPR,TP))) = BL_COM(BLE,OPR,SPE); +* +** assumed BLEND INP not SPE dependent, and that values are to be summed for BLE +*BLE_INP(BLE,COM)$(BL_INP(BLE,COM) OR SUM((SPE,YEAR),TBL_INP(BLE,SPE,COM,YEAR))) +* = YES; +BLE_SPEINP(R,BLE,SPE,COM)$(BLE_SPE(R,BLE,SPE) * BLE_INP(R,BLE,COM)) = YES; +**TBL_INP(BLE_SPE(BLE,SPE),COM,TP) = BL_INP(BLE,COM) + TBL_INP(BLE,SPE,COM,TP); +*TBL_INPT(BLE_INP(BLE,ELC),TP) = BL_INP(BLE,ELC) + +* SUM(BLE_SPE(BLE,SPE), TBL_INP(BLE,SPE,ELC,TP)); +* +** assume that values are to be summed +*TBL_VAROMT(BLE,TP) = BL_VAROM(BLE) + SUM(BLE_SPE(BLE,SPE), TBL_VAROM(BLE,SPE,TP)); +* +** DELIV assume that values are to be summed +*TBL_DELIV(BLE_SPE(BLE,SPE),COM,TP) = BL_DELIV(BLE,COM) + +* TBL_DELIV(BLE,SPE,COM,TP); +*TBL_DELIVT(BLE,COM,TP) = SUM(SPE$BLE_SPE(BLE,SPE), +* TBL_INP(BLE,SPE,COM,TP) * TBL_DELIV(BLE,SPE,COM,TP)); +* +** setup BLE/OPR combination and handle the emissions +LOOP(BLE_SPEOPR(R,BLE,SPE,OPR), + BLE_OPR(R,BLE,OPR) = YES; +); +LOOP(BLE_OPR(R,BLE,OPR), + BLE_ENV(R,C,BLE,OPR)$(ENV(R,C) * SUM(T, ENV_BL(R,C,BLE,OPR,T))) = YES; +); + +* handle peakda, setting to 1 if uses COM_PEAK but no value provided +PEAKDA_BL(R,BLE,T)$((NOT PEAKDA_BL(R,BLE,T))$SUM(COM_PEAK(R,C)$BLE_INP(R,BLE,C),1)) = 1; + +****************************************************************************** +* Coefficients for BLENDing +****************************************************************************** +ALIAS(OPR,OPR2); +* balance of energy carriers + BLE_BAL(BLE_TP(R,T,BLE),OPR2)$OPR(BLE) = 1; + BLE_BAL(BLE_TP(R,T,BLE),OPR2)$(NOT OPR(BLE)) = 1$(REFUNIT(R)=1) + + CONVERT(OPR2,'WCV')$(REFUNIT(R)=2) + + CONVERT(OPR2,'VCV')$(REFUNIT(R)=3); + +* create the REFUNIT/BL_UNIT and FEQ convert look-up tables +* volume +LOOP(R, +IF (REFUNIT(R) = 3, + RU_CVT(BLE_SPEOPR(R,BLE,SPE,OPR)) = 1$(BL_UNIT(R,BLE,SPE) = 3) + + CONVERT(OPR,'DENS')$(BL_UNIT(R,BLE,SPE) = 2) + + CONVERT(OPR,'VCV')$(BL_UNIT(R,BLE,SPE) = 1); + RU_FEQ(R,OPR,T) = CONVERT(OPR,'VCV'); +); +* weight +IF (REFUNIT(R) = 2, + RU_CVT(BLE_SPEOPR(R,BLE,SPE,OPR)) = + (1/CONVERT(OPR,'DENS'))$(BL_UNIT(R,BLE,SPE) = 3) + + 1$(BL_UNIT(R,BLE,SPE) = 2) + + CONVERT(OPR,'WCV')$(BL_UNIT(R,BLE,SPE) = 1); + RU_FEQ(R,OPR,T) = CONVERT(OPR,'WCV'); +); +* energy +IF (REFUNIT(R) = 1, + RU_CVT(BLE_SPEOPR(R,BLE,SPE,OPR)) = + (1/CONVERT(OPR,'VCV'))$(BL_UNIT(R,BLE,SPE) = 3) + + (1/CONVERT(OPR,'WCV'))$(BL_UNIT(R,BLE,SPE) = 2) + + 1$(BL_UNIT(R,BLE,SPE) = 1); + RU_FEQ(R,OPR,T) = 1; +); +); +RU_FEQ(R,OPR,T)$(NOT RU_FEQ(R,OPR,T)) = 1; + +*---------------------------------------------------------------- +* Call reduction algorithm +*---------------------------------------------------------------- +$ BATINCLUDE pp_reduce.red + RTPCS_VARF(RTPC(RTP_VARA(R,T,P),C),S)$((NOT RTPCS_OUT(R,T,P,C,S))$RPCS_VAR(R,P,C,S)) = YES; + OPTION CLEAR=R_UC,CLEAR=RTPCS_OUT; +*---------------------------------------------------------------- +* MACRO +*---------------------------------------------------------------- +$ IF %MACRO%==YES $BATINCLUDE ppmain.tm + + PUTCLOSE QLOG; + IF(PUTOUT, QLOG.AP = 1); diff --git a/ppmain.tm b/ppmain.tm new file mode 100644 index 0000000..921178b --- /dev/null +++ b/ppmain.tm @@ -0,0 +1,72 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================* +* ppmain.tm oversees all the preprocessing activities needed by MACRO +$ BATINCLUDE prep_ext.tm +*============================================================================* +* Initialize the economic parameters +*============================================================================* + + TM_AEEIV(R,T,C)$DEM(R,C) = TM_DDF(R,T,C)/100; + TM_ASRV(R) = 1 - TM_DEPR(R)/100; + TM_DFACTCURR(R,T) = 1 - (TM_KPVS(R)/TM_KGDP(R) - TM_DEPR(R)/100 - TM_GROWV(R,T)/100); + TM_RHO(R) = 1 - 1/TM_ESUB(R); + +* Capital survival defined as factor between the middle year of the period T+1 and the period T + TM_TSRV(R,T) = TM_ASRV(R) ** NYPER(T); + +*============================================================================* +* Calculate initial values for the economic variables for the first time period +* - Capital Stock +* - Investment during time period 0 +* - Consumption during time period 0 +* - GDP (Consumption + Investment) + Energy Costs +*============================================================================* + + TM_K0(R) = TM_KGDP(R) * TM_GDP0(R); + TM_IV0(R) = TM_K0(R) * (TM_DEPR(R) + SUM(T$(ORD(T) = 1),TM_GROWV(R,T)))/100; + TM_C0(R) = TM_GDP0(R) - TM_IV0(R); + TM_Y0(R) = TM_GDP0(R) + TM_EC0(R) + SUM(T_1(T),TM_AMP(R,T)); + +*============================================================================* +* Calculate intermediate values +*============================================================================* + TM_AEEIFAC(R,T,C)$DEM(R,C) = 1; + TM_DFACT(R,T) = 1; + TM_L(R,T) = 1; + + LOOP(T, + TM_AEEIFAC(R,T+1,C)$DEM(R,C) = TM_AEEIFAC(R,T,C) * (1 - TM_AEEIV(R,T+1,C)) ** NYPER(T); + TM_DFACT(R,T+1) = TM_DFACT(R,T) * TM_DFACTCURR(R,T) ** NYPER(T); + TM_L(R,T+1) = TM_L(R,T) * (1 + TM_GROWV(R,T) / 100) ** NYPER(T); + ); + +* Arbitrary multiplier on utility in last time period. + LOOP(MIYR_1(T++1)$(TM_ARBM NE 1), + TM_DFACT(R,T) = TM_DFACT(R,T) * + (1-MIN(.999,TM_DFACTCURR(R,T))**(NYPER(T)*TM_ARBM)) / + (1-MIN(.999,TM_DFACTCURR(R,T))**(NYPER(T) * 1 ))); +* Weights for periods (use only if requested by TM_ARBM=1) + TM_PWT(T) = 1; IF(TM_SL, Z=MAX(1,SMAX(T,D(T))); TM_PWT(T) = D(T)/Z); + + TM_D0(DEM(R,C)) = TM_SCALE_NRG * SUM(MIYR_1(T), COM_PROJ(R,T,C)); + + TM_B(DEM(R,C)) = TM_D0(R,C) / TM_Y0(R); + TM_B(DEM(R,C)) = TM_B(R,C) ** (1 - TM_RHO(R)); + TM_B(DEM(R,C)) = TM_SCALE_CST / TM_SCALE_NRG * TM_DDATPREF(R,C) * TM_B(R,C); + + TM_AKL(R) = TM_Y0(R) ** TM_RHO(R) - SUM(DEM(R,C), TM_B(R,C) * (TM_D0(R,C) ** TM_RHO(R))); + TM_AKL(R) = TM_AKL(R) / (TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R))); + + TM_YCHECK(R) = TM_AKL(R) * TM_K0(R) ** (TM_KPVS(R) * TM_RHO(R)) + SUM(DEM(R,C), TM_B(R,C) * TM_D0(R,C) ** TM_RHO(R)); + TM_YCHECK(R) = TM_YCHECK(R) ** (1 / TM_RHO(R)); + +* annual percent expansion factor converted into 1 period factor + PARAMETER HELP_EXPF(R,T); + HELP_EXPF(R,T) = TM_EXPF(R,T); + TM_EXPF(R,T) = (1+HELP_EXPF(R,T)/100)**(D(T)/2) * (1+HELP_EXPF(R,T+1)/100)**(D(T+1)/2); + OPTION CLEAR=HELP_EXPF; + +display tm_b, tm_expf; diff --git a/prep_ext.abs b/prep_ext.abs new file mode 100644 index 0000000..0967b1b --- /dev/null +++ b/prep_ext.abs @@ -0,0 +1,33 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREP_ext.abs oversees all the added interpolation activities needed by ABS +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Add reserve commodities to RC + RC(R,C) $= BS_RTYPE(R,C); + LOOP((RP,ITEM)$GR_GENMAP(RP,ITEM),BS_K(ITEM)=YES); + LOOP((R,T,C,P,BD)$BS_SHARE(R,T,C,P,BD),BS_K(P)=YES); + +* Bulk processing + OPTION BS_RTCS < BS_DEMDET; + BS_RTCS('OMEGA',R,YEAR,C,S) $= BS_OMEGA(R,YEAR,C,S); + BS_RTCS('DELTA',R,YEAR,C,S) $= BS_DELTA(R,YEAR,C,S); + +* Interpolation/extrapolation +$ BATINCLUDE fillparm BS_LAMBDA R C ",'0','0','0','0','0'" T YES '>=0' +$ BATINCLUDE fillparm BS_DETWT R C ",'0','0','0','0','0'" T YES '>=0' +$ BATINCLUDE fillparm BS_SIGMA R 'C,BS_K,S' ",'0','0','0'" T YES >=0 +$ BATINCLUDE fillparm BS_SHARE R 'C,BS_K,BD' ",'0','0','0'" T YES >=0 +$ BATINCLUDE fillparm BS_RTCS 'RSP,R' 'C,S' ",'0','0','0'" T YES >=0 +$ BATINCLUDE fillparm BS_MAINT R 'P,S' ",'0','0','0','0'" V 'RTP(R,V,P)' >=0 +$ BATINCLUDE fillparm BS_RMAX R 'P,C,S' ",'0','0','0'" V 'RTP(R,V,P)' >=0 +$ BATINCLUDE prepparm BS_BNDPRS R 'P,C,S,BD' ",'0'" T 'RTP(R,T,P)' 1 + + BS_RTCS(RSP('OMEGA'),R,T,C,S)$BS_RTCS(RSP,R,T,C,S) = ROUND(BS_RTCS(RSP,R,T,C,S)); + BS_SIGMA(R,T,C,BS_K,S)$(BS_LAMBDA(R,T,C)=0)=0; + BS_RMAX(R,LL--ORD(LL),P,C,S+STOA(S)) $= (BS_RMAX(R,LL,P,C,S)>0); + BS_RMAX(R,LL,P,C,S)$(NOT BS_RMAX(R,'0',P,C,'ANNUAL'))=0; + OPTION BS_BSC < BS_RMAX, CLEAR=BS_OMEGA; \ No newline at end of file diff --git a/prep_ext.dsc b/prep_ext.dsc new file mode 100644 index 0000000..f41042e --- /dev/null +++ b/prep_ext.dsc @@ -0,0 +1,20 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREP_EXT.xtd oversees extended preprocessor activities * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* Questions/Comments: +* The default option for NCAP_DISC is 10 (no interpolation/extrapolation, +* but migrate to milestone years) +*----------------------------------------------------------------------------- +$IF NOT DEFINED PRC_DSCNCAP $EXIT + +* Inter-/extrapolation +$BATINCLUDE prepparm NCAP_DISC 'R' 'P,UNIT' ",'0','0','0'" MILESTONYR 'RTP(R,MILESTONYR,P)' 1 + +* Process semicontinuous requests + NCAP_SEMI(RTP(R,T,P))$PRC_DSCNCAP(R,P) = (NCAP_DISC(RTP,'0')+1)-1; + NCAP_SEMI(RTP)$SUM(UNIT(J)$NCAP_DISC(RTP,UNIT),1) = 0; diff --git a/prep_ext.ier b/prep_ext.ier new file mode 100644 index 0000000..bcc3198 --- /dev/null +++ b/prep_ext.ier @@ -0,0 +1,21 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREP_ext.vtt oversees all the added inperpolation activities needed by IER * +* %1 - mod or v# for the source code to be used * +*=============================================================================* + +*$BATINCLUDE fillparm FLO_MRKCON 'R' 'P,C,TS,BD' ",'0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' +*$BATINCLUDE fillparm FLO_MRKPRD 'R' 'P,C,TS,BD' ",'0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' +$BATINCLUDE fillparm ECT_AFCON 'R' 'P,BD' ",'0','0','0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' +$BATINCLUDE fillparm ECT_AFBPT 'R' 'P,BD' ",'0','0','0','0'" MODLYEAR 'RTP(R,MODLYEAR,P)' 'GE 0' + +*----------------------------------------------------------------------------- +* Convert capacity related data for extraction condensing turbines +* from electricity commodity to input commodity grooup +* Assumption: original PRC_ACTUNT contains the electricity commodity of this process +*----------------------------------------------------------------------------- +$IF %CHP_MODE% == YES $BATINCLUDE pp_chp.ier +$SETGLOBAL PEAKCHP eqpk_ect.ier diff --git a/prep_ext.mlf b/prep_ext.mlf new file mode 100644 index 0000000..3c5bfe0 --- /dev/null +++ b/prep_ext.mlf @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREP_ext.tm oversees all the added inperpolation activities needed by MACRO * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +$ IF NOT '%CTST%'=='' MINYR = MIYR_V1; +*------------------------------------------------------------------------------ +* Interpolate MACRO-specific parameters +$ BATINCLUDE filparam TM_EXPBND 'R,' 'P' ",'','','','',''" DATAYEAR T +$ BATINCLUDE filparam TM_EXPF 'R,' '' ",'','','','',''" DATAYEAR T +$ BATINCLUDE filparam TM_VOC 'R,' 'C,BD' ",'','','',''" YEAR T +$ BATINCLUDE filparam TM_GR 'R,' '' ",'','','','',''" YEAR T +*------------------------------------------------------------------------------ +* Additions to support MACRO linear formulation + SET MAG(CG) / ACT, AKL, LAB, KN, YN /; + SET MR(R), PP(T), TLAST(T), DM(C), XCP(J) /1, 6, 12/; + SET TM_DM(REG,COM); + SET XTP(LL); + ALIAS (MIYR_1,T_1,TB); + ALIAS (T,TP); + PARAMETER NYPER(ALLYEAR); + PARAMETER CM_LED(LL); + PARAMETER TM_TAXREV(R,T) //; + PARAMETER TM_HDF(R,T) //; +* Periods stuff + PP(T+1) = YES; + TLAST(T--ORD(T)) = YES; + NYPER(T) = LAGT(T); + NYPER(TLAST(T+1)) = NYPER(T); + CM_LED(T+1)=LAGT(T); + XTP(LL)$=CM_LED(LL); + XTP(T) = YES; + TM_PP(R,PP)=YES; + + MR(R) $= SUM(T$TM_GR(R,T),YES); + TM_GDPGOAL(R,TB) = TM_GDP0(R); + LOOP(PP(T+1),TM_GDPGOAL(R,PP) = TM_GDPGOAL(R,T)*(1+TM_GR(R,T)/100)**NYPER(T)); +* Save demand LIM for non-MR + OPTION TM_DM < COM_PROJ; + TM_STEP(TM_DM(R,C),'N') = NOT COM_LIM(R,C,'FX'); \ No newline at end of file diff --git a/prep_ext.stc b/prep_ext.stc new file mode 100644 index 0000000..db63e9a --- /dev/null +++ b/prep_ext.stc @@ -0,0 +1,56 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREP_ext.stc oversees all the added inperpolation activities needed by STC * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* Preprocess stochastic parameters - Interpolation +$ BATINCLUDE fillparm S_COM_PROJ 'R' 'C,J,WW' ",'0','0','0'" MILESTONYR 1 'GE 0' +$ BATINCLUDE fillparm S_COM_TAX 'R' 'C,S,COM_VAR,CUR,J,WW' "" MILESTONYR 1 'GE 0' +$ BATINCLUDE fillparm S_NCAP_COST 'R' 'P,J,WW' ",'0','0','0'" MILESTONYR 1 'GE 0' +$ BATINCLUDE prepparm S_CAP_BND 'R' 'P,BD,J,WW' ",'0'" MILESTONYR 'RTP(R,MILESTONYR,P)' 1 +$ BATINCLUDE prepparm S_UC_RHSRT 'ALL_R,UC_N' 'L,J,WW' ",'0'" MILESTONYR 1 1 +$ BATINCLUDE prepparm S_UC_RHSRTS 'ALL_R,UC_N' 'TS,L,J,WW' "" MILESTONYR 1 1 +$ BATINCLUDE prepparm S_UC_RHST 'UC_N' 'L,J,WW' ",'0','0'" MILESTONYR 1 1 +$ BATINCLUDE prepparm S_UC_RHSTS 'UC_N' 'TS,L,J,WW' ",'0'" MILESTONYR 1 1 +$ IF DEFINED S_DAM_COST $BATINCLUDE prepparm S_DAM_COST R 'C,CUR,J,WW' ",'0'" MILESTONYR 1 EPS 3 +$ IF DEFINED S_FLO_FUNC $BATINCLUDE fillparm S_FLO_FUNC R 'P,CG,CG2,J,WW' ",'0'" MILESTONYR 1 'GE 0' +$ IF DEFINED S_NCAP_AFS $BATINCLUDE fillparm S_NCAP_AFS R 'P,TS,J,WW' ",'0','0'" MILESTONYR 1 'GE 0' +$ IF DEFINED S_COM_FR $BATINCLUDE fillparm S_COM_FR R 'C,TS,J,WW' ",'0','0'" MILESTONYR 1 'GE 0' +*----------------------------------------------------------------------------- +$ BATINCLUDE recurrin.stc MXPAR +*----------------------------------------------------------------------------- +* commodities involved in CUM constraints + S_COM_CUM(R,'NET',ALLYEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,BD,J,WW) $= S_COM_CUMNET(R,BOHYEAR,EOHYEAR,C,BD,J,WW); + S_COM_CUM(R,'PRD',ALLYEAR(BOHYEAR+BEOH(BOHYEAR)),LL(EOHYEAR+BEOH(EOHYEAR)),C,BD,J,WW) $= S_COM_CUMPRD(R,BOHYEAR,EOHYEAR,C,BD,J,WW); + OPTION CLEAR=S_COM_CUMPRD,CLEAR=S_COM_CUMNET; + S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,'LO',J,WW)$((S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,'LO',J,WW) EQ 0)$S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,'LO',J,WW)) = 0; + RC_CUMCOM(R,COM_VAR,ALLYEAR,LL,C) $= SUM((BD,J,WW)$S_COM_CUM(R,COM_VAR,ALLYEAR,LL,C,BD,J,WW),YES); + LOOP((R,T,C,S,COM_VAR,CUR,J,WW)$S_COM_TAX(R,T,C,S,COM_VAR,CUR,J,WW),UC_COM('OBJ1',COM_VAR,'LHS',R,'0',C,ANNUAL,'UCN')=1); + +* collect transformation tuples +$ IF DEFINED S_FLO_FUNC OPTION RP_FFSGG <= S_FLO_FUNC; + +* Activate capacity variables if S_CAP_BND is specified + LOOP((R,T,P,BD,J,WW)$S_CAP_BND(R,T,P,BD,J,WW),RTP_VARP(R,T,P) = YES); +*----------------------------------------------------------------------------- +$ IF DEFINED S_DAM_COST PARAMETER DAM_COST //; +$ IF DEFINED DAM_COST PARAMETER S_DAM_COST //; +*----------------------------------------------------------------------------- +* Set flags for Phased UC_N + UC_R_SUM(R,'OBJZ') = YES; UC_R_EACH(R,'OBJZ') = YES; UC_R_SUM(R,'OBJ1') = YES; + UC_T_SUM(R,'OBJZ',T) = YES; UC_T_SUM(R,'OBJ1',MIYR_1) = YES; + LOOP((UC_N,WW)$S_UCOBJ(UC_N,WW),UC_RHS(UC_N,'N')$(NOT UC_RHS(UC_N,'N')) = -1); +* Initialize SW_PARM + SW_PARM = CARD(S_COM_PROJ) + CARD(S_CAP_BND) + CARD(S_COM_CUMPRD) + CARD(S_COM_CUMNET); + SW_PARM = SW_PARM + CARD(S_CM_CONST) + CARD(S_CM_MAXC); +* Set flag for detemininstic RHS if none set but is set for some SOW + UC_RHS(UC_N,'UP')$((NOT UC_RHS(UC_N,'UP'))$SUM((LIM,J,WW)$S_UC_RHS(UC_N,LIM,J,WW),1)) = INF; + UC_RHSR(R,UC_N,'UP')$((NOT UC_RHSR(R,UC_N,'UP'))$SUM((LIM,J,WW)$S_UC_RHSR(R,UC_N,LIM,J,WW),1)) = INF; + UC_RHST(UC_N,T,'UP')$((NOT UC_RHST(UC_N,T,'UP'))$SUM((LIM,J,WW)$S_UC_RHST(UC_N,T,LIM,J,WW),1)) = INF; + UC_RHSRT(R,UC_N,T,'UP')$((NOT UC_RHSRT(R,UC_N,T,'UP'))$SUM((LIM,J,WW)$S_UC_RHSRT(R,UC_N,T,LIM,J,WW),1)) = INF; + UC_RHSTS(UC_N,T,S,'UP')$((NOT UC_RHSTS(UC_N,T,S,'UP'))$SUM((LIM,J,WW)$S_UC_RHSTS(UC_N,T,S,LIM,J,WW),1)) = INF; + UC_RHSRTS(R,UC_N,T,S,'UP')$((NOT UC_RHSRTS(R,UC_N,T,S,'UP'))$SUM((LIM,J,WW)$S_UC_RHSRTS(R,UC_N,T,S,LIM,J,WW),1)) = INF; + UC_DYNBND('OBJ1','N')=YES; \ No newline at end of file diff --git a/prep_ext.tm b/prep_ext.tm new file mode 100644 index 0000000..474fc4e --- /dev/null +++ b/prep_ext.tm @@ -0,0 +1,32 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREP_ext.tm oversees all the added inperpolation activities needed by MACRO * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* Comments: If TM_EC0 not defined, try loading MSADDF +*------------------------------------------------------------------------------ +$IF NOT DEFINED TM_EC0 +$IF EXIST msaddf.dd $INCLUDE msaddf.dd +$IF NOT DEFINED TM_EC0 OPTION CLEAR=TM_EC0; +*------------------------------------------------------------------------------ +* Interpolate MACRO-specific parameters +$BATINCLUDE filparam TM_DDF 'R,' 'C' ",'','','','',''" DATAYEAR T '' '' +$BATINCLUDE filparam TM_EXPBND 'R,' 'P' ",'','','','',''" DATAYEAR T '' '' +$BATINCLUDE filparam TM_EXPF 'R,' '' ",'','','','',''" DATAYEAR T '' '' +$BATINCLUDE filparam TM_GR 'R,' '' ",'','','','',''" DATAYEAR T '' '' +$BATINCLUDE filparam TM_GROWV 'R,' '' ",'','','','',''" DATAYEAR T '' '' +*------------------------------------------------------------------------------ +* Additions to support MACRO soft-link + SCALAR TM_SL /0/; + SETS MR(R), PP(T), TLAST(T), DM(C), XCP(J) /1, 6, 12/; + ALIAS (MIYR_1,T_1); + PARAMETER NYPER(ALLYEAR); + PP(T+1) = YES; + TLAST(T)$(ORD(T) EQ CARD(T)) = YES; + TM_SL = (ROUND(TM_ARBM,1) EQ 1); + IF(TM_SL,NYPER(T) = LAGT(T); ELSE NYPER(TT(T-1)) = (D(T)+D(TT))/2); + NYPER(TLAST(T+1)) = LAGT(T); + LOOP(R,DM(C)$DEM(R,C)=YES); diff --git a/prep_ext.vda b/prep_ext.vda new file mode 100644 index 0000000..4d518e9 --- /dev/null +++ b/prep_ext.vda @@ -0,0 +1,79 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREP_ext.VDA oversees all the added inperpolation activities needed by VEDA +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Comments: RVP can be used to control flow-related attribs instead of RTP +*------------------------------------------------------------------------------ +* Prepare commodity-specific availabilities; NCAP_AFAC overrides NCAP_AFC + OPTION RP_GRP < NCAP_AFAC; + NCAP_AFC(R,DATAYEAR,P,CG,'ANNUAL')$RP_GRP(R,P,CG) = NCAP_AFAC(R,DATAYEAR,P,CG); + NCAP_AFC(R,LL,P,CG,STL(S)) $= NCAP_AFCS(R,LL,P,CG,S); OPTION CLEAR=NCAP_AFCS; +* Collect ACT_EFF groups + OPTION RP_GRP < ACT_EFF, CLEAR=UNCD7; + UNCD7(R,LL--ORD(LL),P,CG,S--ORD(S),'','')$BOHYEAR(LL) $= (ACT_EFF(R,LL,P,CG,S) GT 0)$ACT_EFF(R,LL,P,CG,S); + LOOP(UNCD7(R,LL,P,CG,S,'',''),RPC_ACE(R,P,CG) = YES); + RPG_1ACE(RP_GRP(RPC(R,P,C)),C)$(NOT RPC_ACE(RPC)) = YES; + OPTION CLEAR=RP_GRP; + ACT_FLO(R,LL--ORD(LL),P,C,S)$STOA(S) $= VDA_FLOP(R,LL,P,C,S); +*------------------------------------------------------------------------------ +* Interpolate VDA-specific parameters +$BATINCLUDE fillparm VDA_EMCB R 'C,COM' ",'0','0','0','0'" V 1 'GE 0' +$BATINCLUDE fillparm NCAP_AFC R 'P,CG,STL' ",'0','0','0'" V 'RTP(R,V,P)' 'GE -1$ACTCG(CG)' +$BATINCLUDE fillparm ACT_EFF R 'P,CG,TS' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGS +$BATINCLUDE fillparm VDA_FLOP R 'P,CG,TS' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGS +$BATINCLUDE fillparm FLO_EMIS R 'P,CG,COM,S' ",'0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGCS +$BATINCLUDE fillparm ACT_UPS R 'P,S,BD' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm ACT_LOSPL R 'P,L' ",'0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm ACT_LOSSD R 'P,UPT,BD' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm ACT_SDTIME R 'P,UPT,BD' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm ACT_MAXNON R 'P,UPT' ",'0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm STG_MAXCYC R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$IF DEFINED UC_FLOBET $BATINCLUDE fillparm UC_FLOBET 'UC_N,R' 'P,C' ",'0','0','0'" T 1 'GE 0' +$IF DEFINED COM_CSTBAL $BATINCLUDE fillparm COM_CSTBAL R 'C,S,ITEM,CUR' ",'0','0'" T 1 'GE 0' +$IF DEFINED PRC_REACT $BATINCLUDE powerflo.vda PREP +$IF DEFINED GR_VARGEN $BATINCLUDE resloadc.vda +$BATINCLUDE equcrtp.vda PREP_EXT +*------------------------------------------------------------------------------ +* Special vintaging options +$IF %VINTOPT%==1 $BATINCLUDE fillvint VDA_FLOP R 'P,CG,TS' X_RPGS +$IF %VINTOPT%==1 $BATINCLUDE fillvint ACT_EFF R 'P,CG,TS' X_RPGS + FLO_FUNCX(R,LL,P,C,CG)$(NOT PRC_VINT(R,P)) = 0; +*------------------------------------------------------------------------------ + +* Tailored interpolation of PRC_RESID + OPTION CLEAR=PRC_YMAX,CLEAR=MY_ARRAY; + TRACKP(R,P)$=PRC_RESID(R,'0',P); PRC_YMAX(TRACKP(R,P))=ROUND(PRC_RESID(R,'0',P)); + LOOP(PYR_S(PYR(LL)), + PRC_RESID(R,'0',P)$TRACKP(R,P) = MAX(1,NCAP_TLIFE(R,LL,P)+G_TLIFE$(NOT NCAP_TLIFE(R,LL,P))); + LOOP(TRACKP(R,P), DFUNC=PRC_YMAX(R,P); + MY_ARRAY(DM_YEAR)=PRC_RESID(R,DM_YEAR,P); MY_F=0; F=0; Z=0; +* do interpolate + LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), + LAST_VAL=MY_F; MY_F=MY_ARRAY(DM_YEAR); Z=YEARVAL(DM_YEAR); + IF(LAST_VAL, PRC_RESID(R,T,P)$((Z>M(T))$(M(T)>MY_FYEAR)) = MY_F-(MY_F-LAST_VAL)/(Z-MY_FYEAR)*(Z-M(T)); + ELSE F=Z); MY_FYEAR=Z; CNT$(LAST_VAL+MY_F>0)=Z); +* If only one RESID Interpolate towards EPS at Z+TLIFE + IF(ABS(DFUNC-10)=5, DFUNC=F; F=Z; ELSE F$DFUNC=0); + IF(Z=F,CNT=PRC_RESID(R,'0',P); Z=F+CNT; DFUNC=DFUNC+CNT; + PRC_RESID(R,T,P)$(M(T)>F)=MY_F*MAX(0,1-(M(T)-F)$(M(T)>=DFUNC)/CNT); MY_F=0; ELSE Z=CNT); +$IFI %WAVER%==YES PRC_YMAX(R,P)=Z+1$(MY_F>0); IF(MY_F=0, PRC_RESID(R,LL+(Z-MIYR_BOH),P)=EPS); + ); +* Initialize PRC_RESID capacity availability: + NCAP_TLIFE(R,LL,P)$TRACKP(R,P) = 1; + NCAP_ILED(R,LL,P)$TRACKP(R,P) = 0; + RTP_CPTYR(R,LL,T,P)$(((PRC_RESID(R,T,P)>0)+(B(T) no interpolation, 0-> default action, 10->intra-period +* DFUNC = +1-> interp., 2->interp.+EPS, 3->interp.+extrap. +* DFUNC >999 -> exponential interpolation beyond year DFUNC +* Parameters: +* %1 - table name +* %2 - control set 1 +* %3 - control set 2 +* %4 - UNCD7 residual dimension +* %5 - MODLYEAR or MILESTONYR depending on parameter +* %6 - RTP controlling the assignment to the MODLYEARs +* %7 - Option to prohibit extrapolation (1 for other than cost parameters) +******************************************************************************* +*$ONLISTING +$EOLCOM ! +$SETLOCAL DATA 'MY_FIL2(%5)' SETLOCAL OPT '*' SETLOCAL LL +$IF NOT %7 == 0 $SETLOCAL LL ",'%DFLBL%'" SETLOCAL OPT +$IF NOT %8.== . $SETLOCAL DEF_IEBD %8 +* conditional interpolation flag +IF(G_NOINTERP, INT_DEFAULT('%1')=NO; + ELSE OPTION CLEAR=UNCD7; CNT = (%DEF_IEBD%+(3-%DEF_IEBD%)$IE_DEFAULT('%1'))$%7; + IF(CNT=0, UNCD7(%2%LL%,%3%4)$(%1(%2,'%DFLBL%',%3)>0) = YES; +%OPT% ELSE UNCD7(%2,LL--ORD(LL),%3%4) $= %1(%2,LL,%3); +%OPT% UNCD7(%2,LL,%3%4)$((%9(%1(%2,'%DFLBL%',%3)) LE -.5)$%1(%2,'%DFLBL%',%3)) = NO; + ); + LOOP(UNCD7(%2%LL%,%3%4), DFUNC = CNT; DFUNC $= ROUND(%1(%2,'%DFLBL%',%3)); + MY_ARRAY(DM_YEAR) = %1(%2,DM_YEAR,%3); OPTION CLEAR=MY_FIL2; +* do interpolate + IF(DFUNC NE 10, LAST_VAL=0; F = 0; Z = 0; + LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), ! check for nonzero (including EPS) + MY_F = MY_ARRAY(DM_YEAR); Z = YEARVAL(DM_YEAR); + IF(LAST_VAL, + IF((Z GT DFUNC)$(DFUNC GT 999), ! exponential function + %DATA%$((Z>YEARVAL(%5))$(YEARVAL(%5)>MY_FYEAR)) + = LAST_VAL*POWER(1+MY_F,YEARVAL(%5)-MY_FYEAR)+EPS; + MY_F = LAST_VAL*POWER(1+MY_F,Z-MY_FYEAR)+EPS; + MY_FIL2(DM_YEAR) = MY_F; ! overwrite old data + ELSE ! linear interpolation + %DATA%$((Z>YEARVAL(%5))$(YEARVAL(%5)>MY_FYEAR)) + = LAST_VAL + (MY_F-LAST_VAL)/(Z-MY_FYEAR)*(YEARVAL(%5)-MY_FYEAR); + ); + ELSE F = Z; FIRST_VAL = MY_F); + LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year +%OPT% ELSE FIRST_VAL = 0; MY_FYEAR = 0; ! intra-period I/E +%OPT% LOOP(MY_FIL(LL)$MY_ARRAY(MY_FIL), ! check for data values +%OPT% MY_F = MY_ARRAY(LL); Z = YEARVAL(LL); F = FIL2(LL); +%OPT% IF(MY_FYEAR < F, IF(F > MIN(FIRST_VAL,Z), LAST_VAL = MY_F; FIRST_VAL = F); +%OPT% MY_FIL2(%5(LL+(F-YEARVAL(LL))))$(NOT MY_ARRAY(%5)) = LAST_VAL+(MY_F-LAST_VAL)/(Z-MY_FYEAR)*(F-MY_FYEAR)); +%OPT% LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year +%OPT% DFUNC = %7; + ); +%OPT% IF(FLOOR(DFUNC/10)=1, +%OPT% LOOP(MIYR_1(LL), MY_FYEAR=YEARVAL(LL); +%OPT% MY_F = FIL2(LL+(F-MY_FYEAR)); IF(MY_FZ,MY_FIL2(%5(LL+(MY_F-MY_FYEAR))) = LAST_VAL)); +%OPT% DFUNC=DFUNC-10); + IF(DFUNC NE %7, +* Do back/forward extrapolate, or fill in with EPS + IF(DFUNC LE 2, %DATA%$(%6$(NOT %DATA%+MY_ARRAY(%5))) = EPS; ELSE + IF(DFUNC EQ 4, Z = INF; ELSEIF DFUNC EQ 5, F = 0); + %DATA%$(%6) $= FIRST_VAL$(YEARVAL(%5)Z); + IF((NOT %7)$LAST_VAL, %DATA%$(%6$(NOT %DATA%+MY_ARRAY(%5)))=EPS); + )); %1(%2,%5,%3) $= %DATA%; + )); +* and reset OPT +$IF NOT %9==+ %1(%2,'%DFLBL%',%3)$((%1(%2,'%DFLBL%',%3)-%7)$%1(%2,'%DFLBL%',%3)) = MIN(%RESET%,%1(%2,'%DFLBL%',%3)); +$OFFLISTING diff --git a/preppm.mod b/preppm.mod new file mode 100644 index 0000000..646d189 --- /dev/null +++ b/preppm.mod @@ -0,0 +1,250 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREPPM.MOD oversees all the enhanced interpolation activities +* %1 - mod or v# for the source code to be used +*=============================================================================* +$ SET RESET 0 +$ IFI %INTEXT_ONLY% == YES $SET RESET 15 +$ IFI %DATAGDX% == YES $BATINCLUDE prepxtra.mod SAVE +$ IFI %PREP_ANS%%RESET%==YES15 $BATINCLUDE prepxtra.mod POST +$ IFI %PREP_ANS% == YES $EXIT +*----------------------------------------------------------------------------- +* Ensure that both MODLYEAR and DATAYEAR include PASTYEAR +* Also set the special year among datayears for the processing of control options. + MODLYEAR(LL) = MILESTONYR(LL)+PASTYEAR(LL); + DATAYEAR(PASTYEAR) = YES; + DATAYEAR('%DFLBL%') = YES; +* Build DM_YEAR for interpolation, excluding the special year: + DM_YEAR(MILESTONYR) = YES; + DM_YEAR(DATAYEAR) = (YEARVAL(DATAYEAR)>0); +* Set migrating years MY_FIL, and FIL2 of each MY_FIL to the period year, if within periods: + LOOP(T,FIL2(DM_YEAR)$((YEARVAL(DM_YEAR) >= B(T)) * (YEARVAL(DM_YEAR) <= E(T))) = YEARVAL(T)); + MY_FIL(DM_YEAR)$(FIL2(DM_YEAR)*(NOT T(DM_YEAR))) = YES; +*----------------------------------------------------------------------------- +$IF DEFINED G_CUREX R_CUREX(R,CURR,CUR)$NO=0; R_CUREX(R,CURR,CUR)$(NOT R_CUREX(R,CURR,CUR))$=G_CUREX(CURR,CUR); +$IF DEFINED R_CUREX $INCLUDE curex +*----------------------------------------------------------------------------- +* Merge special case user attributes to generic case + LOOP(DATAYEAR,PRC_MARK(R,'%DFLBL%',P,P,C,BD)$FLO_MARK(R,DATAYEAR,P,C,BD) = 3); + PRC_MARK(R,DATAYEAR,P,P,C,BD) $= FLO_MARK(R,DATAYEAR,P,C,BD); +* Integration of COM costs + OBJ_COMNT(R,DATAYEAR,C,S,'COST',CUR) $= COM_CSTNET(R,DATAYEAR,C,S,CUR); + OBJ_COMNT(R,DATAYEAR,C,S,'TAX',CUR) $= COM_TAXNET(R,DATAYEAR,C,S,CUR); + OBJ_COMNT(R,DATAYEAR,C,S,'SUB',CUR) $= COM_SUBNET(R,DATAYEAR,C,S,CUR)*(-1); + OBJ_COMPD(R,DATAYEAR,C,S,'COST',CUR) $= COM_CSTPRD(R,DATAYEAR,C,S,CUR); + OBJ_COMPD(R,DATAYEAR,C,S,'TAX',CUR) $= COM_TAXPRD(R,DATAYEAR,C,S,CUR); + OBJ_COMPD(R,DATAYEAR,C,S,'SUB',CUR) $= COM_SUBPRD(R,DATAYEAR,C,S,CUR)*(-1); +* Integration of UC_COMxxx + UC_COM(UC_N,'PRD',SIDE,R,DATAYEAR,C,S,'COMPRD')$(NOT UC_ATTR(R,UC_N,SIDE,'COMPRD','NET')) $= UC_COMPRD(UC_N,SIDE,R,DATAYEAR,C,S); + UC_COM(UC_N,'PRD',SIDE,R,DATAYEAR,C,S,'COMCON')$(NOT UC_ATTR(R,UC_N,SIDE,'COMCON','NET')) $= UC_COMCON(UC_N,SIDE,R,DATAYEAR,C,S); + UC_COM(UC_N,'NET',SIDE,R,DATAYEAR,C,S,'COMPRD')$UC_ATTR(R,UC_N,SIDE,'COMPRD','NET') $= UC_COMPRD(UC_N,SIDE,R,DATAYEAR,C,S); + UC_COM(UC_N,'NET',SIDE,R,DATAYEAR,C,S,'COMCON')$UC_COMCON(UC_N,SIDE,R,DATAYEAR,C,S) = UC_COMCON(UC_N,SIDE,R,DATAYEAR,C,S)*(-1); + UC_COM(UC_N,'NET',SIDE,R,DATAYEAR,C,S,'COMNET') $= UC_COMNET(UC_N,SIDE,R,DATAYEAR,C,S); +* Prepare flags for flow tax/sub + SET OBJ_VFLO(R,P,C,CUR,UC_COST); + SET RPC_CUR(REG,PRC,COM,CUR); + OPTION RPC_CUR <= FLO_TAX; OBJ_VFLO(RPC_CUR,'TAX') = YES; + OPTION RPC_CUR <= FLO_SUB; OBJ_VFLO(RPC_CUR,'SUB') $= OBJ_VFLO(RPC_CUR,'TAX'); + FLO_TAX(R,LL--ORD(LL),P,C,S,CUR)$((NOT FLO_TAX(R,'%DFLBL%',P,C,S,CUR))$FLO_TAX(R,LL,P,C,S,CUR)$OBJ_VFLO(R,P,C,CUR,'SUB')) = 3; + FLO_SUB(R,LL--ORD(LL),P,C,S,CUR)$((NOT FLO_SUB(R,'%DFLBL%',P,C,S,CUR))$FLO_SUB(R,LL,P,C,S,CUR)$OBJ_VFLO(R,P,C,CUR,'SUB')) = 3; +*----------------------------------------------------------------------------- +* Starting data pre-preprocessing with temporary control sets for parameters +$IF NOT SET DEF_IEBD $SET DEF_IEBD 10 + IE_DEFAULT(INT_DEFAULT) = 3; +$IF SET RETIRE $BATINCLUDE prepret.dsc PREP PRC_RCAP RCAP_BND +*----------------------------------------------------------------------------- +* Use RVP for extrapolating vintaged flow parameters +$ BATINCLUDE fillvint + RVP(RTP(R,V,P))$PRC_VINT(R,P) = YES; +*----------------------------------------------------------------------------- +* Interpolation Options +* ===================== +* The placeholder for the option flag is parameter data point of year zero. +* Example: NCAP_COST(R,'0',P,CUR) is an option for NCAP_COST(R,T,P,CUR). +* Available option codes: See documentation +* +* Interpolation can be effectively denied for non-cost parameters only. +* +*============================================================================= +* COST PARAMETERS: Interpolated by COEF_OBJ, only special options processed here +*----------------------------------------------------------------------------- +* General attributes +*----------------------------------------------------------------------------- +*$BATINCLUDE prepparm G_DRATE R CUR ",'0','0','0','0'" YEAR 1 1 +$BATINCLUDE filparam G_RFRIR 'R,' '' ",'0','0','0','0','0'" YEAR V +*----------------------------------------------------------------------------- +* Capacity related attributes +*----------------------------------------------------------------------------- +$BATINCLUDE prepparm NCAP_COST R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_DCOST R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_DLAGC R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_FOM R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_FSUB R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_FTAX R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_ISUB R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_ITAX R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_VALU R 'P,C,CUR' ",'0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm NCAP_ISPCT R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 0 +*----------------------------------------------------------------------------- +* Commodity related attributes +*----------------------------------------------------------------------------- +$BATINCLUDE prepparm OBJ_COMNT R 'C,TS,COSTYPE,CUR' ",'0','0'" T 1 0 +$BATINCLUDE prepparm OBJ_COMPD R 'C,TS,COSTYPE,CUR' ",'0','0'" T 1 0 +*----------------------------------------------------------------------------- +* Flow related attributes & inter-regional exchange flows (6) +*----------------------------------------------------------------------------- +$BATINCLUDE prepparm ACT_COST R 'P,CUR' ",'0','0','0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm FLO_COST R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm FLO_DELIV R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm FLO_SUB R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm FLO_TAX R 'P,C,TS,CUR' ",'0','0'" V 'RTP(R,V,P)' 0 +$BATINCLUDE prepparm IRE_PRICE R 'P,C,TS,ALL_REG,IE,CUR' "" V 'RTP(R,V,P)' 0 +$IF DEFINED DAM_COST $BATINCLUDE prepparm DAM_COST R 'C,CUR' ",'0','0','0'" T 1 EPS 3 +*============================================================================= +***** REGULAR NON-COST PARAMETERS: Interpolated over DM_YEAR by default ****** +*----------------------------------------------------------------------------- +* Capacity related attributes +*----------------------------------------------------------------------------- +$BATINCLUDE fillparm NCAP_AF R 'P,TS,BD' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPSB +$BATINCLUDE fillparm NCAP_AFA R 'P,BD' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPB +$BATINCLUDE fillparm NCAP_AFS R 'P,TS,BD' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPSB +$BATINCLUDE fillparm NCAP_BPME R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_CDME R P ",'0','0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_CEH R P ",'0','0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_CHPR R 'P,BD' ",'0','0','0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPB +$BATINCLUDE fillparm NCAP_CLED R 'P,C' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_CLAG R 'P,C,IO' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_COM R 'P,C,IO' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_DELIF R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_DLAG R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_DLIFE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_DRATE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_FDR R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_ELIFE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_ICOM R 'P,C' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_ILED R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +$BATINCLUDE fillparm NCAP_OCOM R 'P,C' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_PKCNT R 'P,TS' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm NCAP_TLIFE R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RP +*----------------------------------------------------------------------------- +* Commodity related attributes +*----------------------------------------------------------------------------- +$BATINCLUDE fillparm COM_AGG R 'C,COM' ",'0','0','0','0'" T 1 'GE 0' +$BATINCLUDE fillparm COM_ELAST R 'C,TS,L' ",'0','0','0'" T 1 'GE 0' +$BATINCLUDE fillparm COM_FR R 'C,TS' ",'0','0','0','0'" T 1 'GE 0' X_RCS +$BATINCLUDE fillparm COM_IE R 'C,TS' ",'0','0','0','0'" T 1 'GE 0' +$BATINCLUDE fillparm COM_PKFLX R 'C,TS' ",'0','0','0','0'" T 1 'GE 0' +$BATINCLUDE fillparm COM_PKRSV R C ",'0','0','0','0','0'" T 1 'GE 0' +$BATINCLUDE fillparm COM_PROJ R C ",'0','0','0','0','0'" T 1 'GE 0' +$BATINCLUDE fillparm COM_VOC R 'C,BD' ",'0','0','0','0'" T 1 'GE 0' +*----------------------------------------------------------------------------- +* Flow related attributes & inter-regional exchange +*----------------------------------------------------------------------------- +$BATINCLUDE fillparm ACT_CSTUP R 'P,TSL,CUR' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm ACT_CSTSD R 'P,UPT,BD,CUR' ",'0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm ACT_CSTRMP R 'P,BD,CUR' ",'0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm ACT_TIME R 'P,LIM' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm FLO_FUNC R 'P,CG1,CG2,TS' ",'0','0'" V 'RVP(R,V,P)' 'GE 0' X_RPGGS +$BATINCLUDE fillparm FLO_PKCOI R 'P,C,TS' ",'0','0','0'" V 'RVP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm FLO_SUM R 'P,CG1,C,CG2,TS' ",'0'" V 'RVP(R,V,P)' 'GE 0' X_RPGCGS +$BATINCLUDE fillparm PRC_ACTFLO R 'P,CG' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' X_RPG +$BATINCLUDE prepparm PRC_MARK R 'P,ITEM,C,BD' ",'0'" T 1 1 11 +$BATINCLUDE fillparm IRE_FLO R 'P,C,REG,COM,TS' ",'0'" V '(RVP(R,V,P) OR RTP(REG,V,P))' 'GE 0' +$BATINCLUDE fillparm IRE_FLOSUM R 'P,C,TS,IE,COM,IO' "" V 'RVP(R,V,P)' 'GE 0' +*----------------------------------------------------------------------------- +* Storage attributes +*----------------------------------------------------------------------------- +$BATINCLUDE fillparm STG_CHRG R 'P,S' ",'0','0','0','0'" V '(M(V) GE MIYR_V1-1)' 'GE 0' +$BATINCLUDE fillparm STG_EFF R P ",'0','0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm STG_LOSS R 'P,S' ",'0','0','0','0'" V 'RTP(R,V,P)' 'GE 0' +$BATINCLUDE fillparm STG_SIFT R 'P,C,S' ",'0','0','0'" T 'RTP(R,T,P)' 'GE 0' +*----------------------------------------------------------------------------- +* User constraints +*----------------------------------------------------------------------------- +$BATINCLUDE fillparm UC_ACT 'UC_N,SIDE,R' 'P,TS' ",'0','0'" T 'RTP(R,T,P)' 'GE 0' +$BATINCLUDE fillparm UC_CAP 'UC_N,SIDE,R' P ",'0','0','0'" T 1 'GE 0' +$BATINCLUDE fillparm UC_COM 'UC_N,COM_VAR,SIDE,R' 'C,TS,UC_GRPTYPE' "" T 1 'GE 0' +$BATINCLUDE fillparm UC_FLO 'UC_N,SIDE,R' 'P,C,TS' ",'0'" T 1 'GE 0' +$BATINCLUDE fillparm UC_IRE 'UC_N,SIDE,R' 'P,C,TS,IE' "" T 'RTP(R,T,P)' 'GE 0' +$BATINCLUDE fillparm UC_NCAP 'UC_N,SIDE,R' P ",'0','0','0'" T 'RTP(R,T,P)' 'GE 0' +$BATINCLUDE fillparm UC_UCN 'UC_N,SIDE,R' UCN ",'0','0','0'" T 1 'GE 0' +$BATINCLUDE filparam UC_TIME 'UC_N,R,' '' ",'0','0','0'" DATAYEAR T '' '' '' "YEAR," +*============================================================================= +******* NON-REGULAR NON-COST PARAMETERS: NOT interpolated by default ********* +*----------------------------------------------------------------------------- +* Capacity and commodity related attributes +*----------------------------------------------------------------------------- +$BATINCLUDE prepparm CAP_BND R 'P,BD' ",'0','0','0'" T 'RTP(R,T,P)' 1 +$BATINCLUDE prepparm NCAP_BND R 'P,LIM' ",'0','0','0'" T 'RTP(R,T,P)' 1 +$BATINCLUDE prepparm COM_BNDNET R 'C,TS,BD' ",'0','0'" T 1 1 +$BATINCLUDE prepparm COM_BNDPRD R 'C,TS,BD' ",'0','0'" T 1 1 +*----------------------------------------------------------------------------- +* Flow related attributes & inter-regional exchange +*----------------------------------------------------------------------------- +$BATINCLUDE prepparm ACT_BND R 'P,TS,BD' ",'0','0'" T 'RTP(R,T,P)' 1 +$BATINCLUDE prepparm FLO_BND R 'P,CG,TS,BD' ",'0'" T 'RTP(R,T,P)' 1 +$BATINCLUDE prepparm FLO_FR R 'P,C,TS,LIM' ",'0'" T 'RTP(R,T,P)' 1 +$BATINCLUDE prepparm FLO_SHAR R 'P,C,CG,TS,BD' "" V 'RVP(R,V,P)' 1 '' + +$BATINCLUDE prepparm IRE_BND R 'C,TS,ALL_REG,IE,BD' "" T 1 1 +$BATINCLUDE prepparm IRE_XBND ALL_REG 'C,TS,IE,BD' ",'0'" T 1 1 +*----------------------------------------------------------------------------- +* Storage attributes +*----------------------------------------------------------------------------- +$BATINCLUDE prepparm STGIN_BND R 'P,C,S,BD' ",'0'" T 'RTP(R,T,P)' 1 +$BATINCLUDE prepparm STGOUT_BND R 'P,C,S,BD' ",'0'" T 'RTP(R,T,P)' 1 +*----------------------------------------------------------------------------- +* User constraints +*----------------------------------------------------------------------------- +$BATINCLUDE prepparm UC_RHSRT 'ALL_R,UC_N' LIM ",'0','0','0'" T 1 1 +$BATINCLUDE prepparm UC_RHSRTS 'ALL_R,UC_N' 'TS,LIM' ",'0','0'" T 1 1 +$BATINCLUDE prepparm UC_RHST UC_N LIM ",'0','0','0','0'" T 1 1 +$BATINCLUDE prepparm UC_RHSTS UC_N 'TS,LIM' ",'0','0','0'" T 1 1 +$BATINCLUDE prepparm REG_BNDCST R 'COSTAGG,CUR,BD' ",'0','0'" T 1 1 +*----------------------------------------------------------------------------- +* Parameters that are by default inter/extrapolated over PASTYEARS +*----------------------------------------------------------------------------- +$ BATINCLUDE prepparm FLO_SHAR R 'P,C,CG,TS,BD' "" PASTMILE 'RVP(R,PASTMILE,P)' 1 3 -ABS +*----------------------------------------------------------------------------- +*============================================================================= +* Additions through extensions: +*------------------------------------------------------------------------------ +$ IFI %STAGES% == YES $BATINCLUDE prep_ext.stc +$ IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod prep_ext %EXTEND% +$ IFI %INTEXT_ONLY%==YES $BATINCLUDE prepxtra.mod XTIE +*============================================================================= +***************************** SHAPE/MULTI INDEXES **************************** +*----------------------------------------------------------------------------- +$BATINCLUDE preshape NCAP_AFX R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape NCAP_AFSX R 'P,BD' ",'0','0','0'" V UNCD7 RTP(R,V,P) +$BATINCLUDE preshape NCAP_AFM R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape NCAP_FOMX R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape NCAP_FSUBX R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape NCAP_FTAXX R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape FLO_FUNCX R 'P,CG1,CG2' ",'0','0'" V UNCD7 RTP(R,V,P) +$BATINCLUDE preshape COM_ELASTX R 'C,BD' ",'0','0','0'" T UNCD7 1 15 +$BATINCLUDE preshape NCAP_FOMM R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape NCAP_FSUBM R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape NCAP_FTAXM R P "" V RXX RTP(R,V,P) +$BATINCLUDE preshape NCAP_CPX R P "" V RXX RTP(R,V,P) +*----------------------------------------------------------------------------- +* All non-cost parameters have now been interpolated / extrapolated and user-defined options processed. +* Second interpolation pass is still needed for cost parameters (dense interpolation). + OPTION CLEAR = UNCD7; +*----------------------------------------------------------------------------- +* Augment datayear with MILESTONYR, as any MODLYEAR may now contain user data. +* Remove the special year from DATAYEAR, as the controls are processed. + DATAYEAR(MILESTONYR) = YES; + DATAYEAR('%DFLBL%') = NO; +*----------------------------------------------------------------------------- +* Optional weighting of vintaged attributes +$IF NOT %VINTOPT%==1 $EXIT +$BATINCLUDE fillvint FLO_FUNC R 'P,CG1,CG2,TS' X_RPGGS +$BATINCLUDE fillvint FLO_SUM R 'P,CG1,C,CG2,TS' X_RPGCGS +$BATINCLUDE fillvint NCAP_CDME R P X_RP +$BATINCLUDE fillvint NCAP_CHPR R 'P,BD' X_RPB +$BATINCLUDE fillvint FLO_SHAR R 'P,C,CG,TS,BD' X_RPCGSB +OPTION CLEAR=PASTSUM; +*----------------------------------------------------------------------------- \ No newline at end of file diff --git a/preppm.msa b/preppm.msa new file mode 100644 index 0000000..881e9e0 --- /dev/null +++ b/preppm.msa @@ -0,0 +1,78 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================* +* PREPPM.MSA Preprocessing for Macro Stand-Alone +*============================================================================* +$GOTO %1 +*---------------------------------------------------------------------------- +$LABEL MSA +$SETGLOBAL MSA CSA +$IF NOT %MACRO%==N $SETGLOBAL MSA %MACRO% +$KILL TM_UDF +$IFI %MSA%==MSA $BATINCLUDE MSADDF.dd +*---------------------------------------------------------------------------- + ALIAS(IPS,MDM); + SET CM_LPK(*), CM_LPT(*), XTP(LL); + PARAMETER CM_LED(LL), TM_XWT(R,LL); +* Periods stuff + ALIAS(TB,T_1); + PP(T)$(ORD(T)>1) = YES; + TB(T)$(ORD(T)=1) = YES; + TLAST(T--ORD(T)) = YES; + NYPER(T) = LAGT(T); + NYPER(TLAST(T+1)) = LAGT(T); + CM_LED(T+1)=LAGT(T); + XTP(LL)$=CM_LED(LL); + XTP(T) = YES; +* Interpolate MACRO-specific parameters +$ BATINCLUDE filparam TM_DDF 'R,' 'C' ",'','','','',''" YEAR T '' '' +$ BATINCLUDE filparam TM_GR 'R,' '' ",'','','','',''" YEAR T '' '' +$ BATINCLUDE filparam TM_GROWV 'R,' '' ",'','','','',''" YEAR XTP '' '' +$ BATINCLUDE filparam TM_HSX 'R,' '' ",'','','','',''" YEAR XTP '' '' + TM_GDPGOAL(R,TB) = TM_GDP0(R); + LOOP(PP(T+1),TM_GDPGOAL(R,PP) = TM_GDPGOAL(R,T)*(1+TM_GR(R,T)/100)**NYPER(T)); +$IFI NOT %MSA%%CLI%==MSAYES $EXIT +*---------------------------------------------------------------------------- +* Preprocess CBA parameters + Z = MAX(1,ABS(TM_DEFVAL('REFTEMP'))); + F = MAX(0,ROUND(TM_DEFVAL('REFLOSS'),4)); + TM_DAM(R,'IN')$= TM_MDTL(R)$TM_GDP0(R); + TM_DAM(R,'IN')$= TM_MDTQ(R)$TM_GDP0(R); + OPTION TM_CATT < TM_HSX; + TM_CATT(R)$TM_CATT(R) = ((Z**2/F)**0.5)$F; + TM_DAM(R,'N')$= TM_CATT(R)$TM_GDP0(R); + MR(R) = SUM((TM_DAM(R,MDM),G_RCUR(R,CUR)),1); + CNT=SMAX(MR,TM_GDP0(MR)); + LOOP(MR(R)$CNT,IF(TM_GDP0(R)=CNT,CNT=0;TM_DAM(R,'0')=YES)); +* Define initial guess for marginal damage for LP + LOOP((G_RCUR(R,CUR),C(CG(CM_EMIS)))$TM_DAM(R,'0'),DAM_BQTY(R,C) = EPS; + DAM_COST(R,PP(T),C,CUR) = 1/TM_SCALE_CST / 10**(3.4-2$DIAG('CO2-GTC',C)) * + SUM(MR(REG),MAX(.01,(2*Z/POWER(TM_CATT(R),2))$TM_CATT(R)+TM_MDTL(R)/Z+2*TM_MDTQ(R)/Z)*TM_GDPGOAL(REG,T))); + CM_LPK(CM_KIND)=YES; CM_LPT(CM_TKIND)=YES; + MR(R)=NO; +$EXIT +*---------------------------------------------------------------------------- +$LABEL TONLP +* Update forcing functions, reset damage and climate module +$IF DEFINED TM_CATT LOOP(G_RCUR(R,CUR)$TM_DAM(R,'0'),DAM_COST(R,PP,C(CG(CM_EMIS)),CUR) = EPS); +$IF DEFINED DAM_COST $INCLUDE rpt_dam.mod +$IFI NOT %CLI%==YES $EXIT +$ INCLUDE forcupd.cli +$IF NOT DEFINED TM_CATT $EXIT + LOOP(G_RCUR(R,CUR)$TM_DAM(R,'0'), + F=REG_WOBJ(R,'DAM-EXT+',CUR); MY_F=REG_WOBJ(R,'DAS',CUR); Z=MAX(0,MIN(MY_F,-F)); + REG_WOBJ(R,'DAS',CUR)=MY_F-Z; REG_WOBJ(R,'DAM-EXT+',CUR)=F+Z); + CM_MAXC_M(CM_EMIS,XTP) = VAR_CLITOT.LO(CM_EMIS,XTP); + IF(CARD(TM_DAM),CM_TKIND(CM_EMIS)=NO; VAR_CLITOT.FX(CM_EMIS,XTP)=VAR_CLITOT.L(CM_EMIS,XTP); + ELSE OPTION CLEAR=CM_KIND,CLEAR=CM_TKIND); +$EXIT +*---------------------------------------------------------------------------- +$LABEL TOLP +* Redefine marginal damages + LOOP((C(CG(CM_EMIS)),G_RCUR(R,CUR))$(CNT$TM_DAM(R,'0')), + DAM_COST(R,PP(T),C,CUR) = SUM(SUPERYR(T,XTP),ABS(VAR_CLITOT.M(CM_EMIS,XTP)/EQ_TRDBAL.M(T,"NMR"))*CM_EVAR(CM_EMIS,XTP)*OBJ_DISC(R,XTP,CUR)/OBJ_DISC(R,T,CUR)/TM_SCALE_CST)); + CM_TKIND(CM_VAR(CM_LPT))=YES; CM_KIND(CM_VAR(CM_LPK))=YES; + VAR_CLITOT.LO(CM_EMIS,XTP) = CM_MAXC_M(CM_EMIS,XTP); + VAR_CLITOT.UP(CM_EMIS,XTP) = INF; diff --git a/prepret.dsc b/prepret.dsc new file mode 100644 index 0000000..c5b3e09 --- /dev/null +++ b/prepret.dsc @@ -0,0 +1,152 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREPRET.dsc oversees pre-processing for retirements +*=============================================================================* +* Questions/Comments: +*----------------------------------------------------------------------------- +$SET MIP %SOLMIP%==YES +$GOTO %1 +*----------------------------------------------------------------------------- +$LABEL PREP +$SET TST %2 +$IF DEFINED PRC_REFIT SET %2 //; PARAMETER %3 //; +$IFI '%RETIRE%'==NO $KILL %2 +$IF DEFINED %2 PARAMETER %3 //; %3(R,'0',P,'N')$(%3(R,'0',P,'N')=0)$=%2(R,P); +$IFI '%RETIRE%'==YES $SHIFT + PRC_REFIT(RP,P)$0=0; +$IF NOT DEFINED %2 $EXIT +* Declarations + SET VNRET(YEAR,LL); PARAMETER RP_RTF(R,P); +* Interpolate RCAP_BND +$IF %TST%==%1 OPTION %TST% < %2; +$ BATINCLUDE fillparm RCAP_BLK R 'P' ",'','','','',''" V 'RTP(R,V,P)' 'GE 0' +$ BATINCLUDE prepparm RCAP_BND R 'P,L' ",'','',''" V 'RTP(R,V,P)' 1 +$IF DEFINED NCAP_OLIFE $BATINCLUDE fillparm NCAP_OLIFE R P ",'','','','',''" V 'RTP(R,V,P)' 'GE 0' +$IF DEFINED NCAP_OLIFE OPTION PRC_CAP < NCAP_ELIFE; NCAP_ELIFE(R,V,P)$(NOT PRC_CAP(R,P)) $= NCAP_OLIFE(R,V,P); PRC_CAP(R,P)=0; +* Preprocess refits + LOOP((RP(R,PRC),P)$(RP(R,P)$PRC_REFIT(RP,P)), + NCAP_ILED(RTP(R,V,P)) = -ABS(NCAP_ILED(RTP)); + PRC_RCAP(RP)=YES; TRACKP(R,P)$(PRC_REFIT(RP,P)<0)=YES); + RTP_VARP(RTP(R,T,P)) $= PRC_RCAP(R,P); + PRC_RCAP(TRACKP)=YES; OPTION CLEAR=TRACKP; +* Activate MIP solution if requested +$IFI %DSC%==YES $SETGLOBAL SOLMIP %RETIRE% +$IFI %RETIRE%==MIP $SETGLOBAL SOLMIP YES +$EXIT +*----------------------------------------------------------------------------- +$LABEL DECL +$IF %MIP% INTEGER + VARIABLE %VAR%_DRCAP(R,ALLYEAR,LL,P%SWD%,J); + EQUATION %EQ%_DSCRET(R,ALLYEAR,ALLYEAR,P%SWTD%); +* Maps for refit vintages & types + LOOP(PRC_RCAP(R,PRC), F=0; MY_F=0; CNT=EPS; + LOOP(P$PRC_REFIT(R,PRC,P),Z=PRC_REFIT(R,PRC,P); CNT$CNT=CNT+1; + IF(ABS(Z)>2, F=F+1); IF(MOD(Z,2)=0,MY_F$(ABS(Z)-4)=3); + IF(Z<0,RTP_TT(R,T,TT,PRC)$COEF_CPT(R,T,TT,P)=YES; + ELSE RTP_TT(R,T,T,PRC)$RTP(R,T,P)=YES; CNT=0;)); + IF(CNT,Z=(-1+2$(F=CNT))*MAX(1,MY_F); ELSE Z=-2); + IF(NOT MAPVAL(CNT),RP_RTF(R,PRC) = Z); + IF(F,RCAP_BND(RTP(R,T,PRC),'UP')$(NOT SUM(P$PRC_REFIT(R,PRC,P),RTP(R,T,P)$(ABS(PRC_REFIT(R,PRC,P))>2)))=EPS)); +* Force obj type 2a/2b + VNRET(VNT(V,T))$(NOT SAMEAS(V,T)) = YES; + RVPRL(RTP(R,V,P))$PRC_RCAP(R,P)=MAX(0,SMAX(RTP_CPTYR(R,VNRET(V,T),P),YEARVAL(T))-YEARVAL(V)); + RVP(RTP) $= RVPRL(RTP); + NCAP_ILED(RVP) = NCAP_ILED(RVP)+EPS; +* Set bounds for continuous retirements + RCAP_BND(R,T,P,BDNEQ) $= RCAP_BND(R,T,P,'FX'); + PASTSUM(RVP(R,V,P))$RCAP_BND(RVP,'N') = -(B(V)+NCAP_ILED(RVP)+ABS(RCAP_BND(RVP,'N'))); + PASTSUM(RVP)$((RCAP_BND(RVP,'N')<0)+MAPVAL(RCAP_BLK(RVP))) = MAX(1,ABS(PASTSUM(RVP))); + LOOP(TT(T--1),Z=ORD(T)-1; + %VAR%_RCAP.LO(RTP_CPTYR(R,VNRET(V,T),P)%SOW%)$RVP(R,V,P) = RCAP_BND(R,T,P,'LO')$(NOT MAPVAL(RCAP_BLK(R,V,P)))+MIN(0,RTFORC(R,V,T,P)-RTFORC(R,V,TT,P)$Z); + %VAR%_RCAP.UP(RTP_CPTYR(R,VNRET(V,T),P)%SOW%)$RCAP_BND(R,T,P,'UP') = + MIN(SMIN(PASTMILE(V),NCAP_PASTI(R,V,P)),RCAP_BND(R,T,P,'UP')+MAX(0,RTFORC(R,V,T,P)-RTFORC(R,V,TT,P)$Z))); + %VAR%_SCAP.LO(RTP_CPTYR(R,VNRET(V,T),P)%SOW%)$RVP(R,V,P) = MAX(RCAP_BND(R,T,P,'LO'),RTFORC(R,V,T,P)); + %VAR%_SCAP.UP(RTP_CPTYR(R,PASTMILE(V),T,P)%SOW%)$RVP(R,V,P) = MAX(RTFORC(R,V,T,P),NCAP_PASTI(R,V,P)); + LOOP(RVP(R,V,P),Z=1;LOOP(RTP_CPTYR(R,VNRET(V,T),P)$Z,Z=0; %VAR%_SCAP.UP(R,V,T,P%SOW%)=MIN(%VAR%_RCAP.UP(R,V,T,P%SOW%),%VAR%_SCAP.UP(R,V,T,P%SOW%)))); + %VAR%_SCAP.FX(RTP_CPTYR(R,V,T,P)%SOW%)$(((M(T) LT ABS(PASTSUM(R,V,P)))+((M(T)-LEAD(T))/PASTSUM(R,V,P) GE 1))$PASTSUM(R,V,P)) = RTFORC(R,V,T,P); +* Force refits = retirements on request + PRC_YMAX(PRC_RCAP(RP)) = MIN(0,SUM(P$PRC_REFIT(RP,P),MAX(EPS,3-ABS(PRC_REFIT(RP,P))))); + RVPRL(R,'0',P) $= PRC_YMAX(R,P); + %VAR%_RCAP.UP(RTP_TT(R,T(TT++1),T,P)%SOW%)$((RP_RTF(R,P)<3)$PRC_YMAX(R,P))=MAX(0,SUM(RTP(R,PYR_S(V),P),RTFORC(R,V,T,P)-RTFORC(R,V,TT,P))$VNT(TT,T)$(MOD(RP_RTF(R,P),2)=0)); + OPTION CLEAR=PASTSUM,CLEAR=RVP; +$EXIT +*----------------------------------------------------------------------------- +$LABEL EQOBJ +$SETGLOBAL RCAPSUB -SUM(VNRET(V,T),%VART%_SCAP(R,V,T,P%SWS%))$PRC_RCAP(R,P) +$SETGLOBAL RCAPSBM -SUM(VNRET(MODLYEAR,T),%VART%_SCAP(R,MODLYEAR,T,P%SWS%))$PRC_RCAP(R,P) +*------------------- + +* Allow retirements in integer multiples of a user-defined block-size or the full residual capacity + %EQ%_DSCRET(RTP_CPTYR(%R_V_T%,P)%SWT%)$(VNRET(V,T)$RCAP_BLK(R,V,P)).. + + %VAR%_SCAP(R,V,T,P%SOW%) - RTFORC(R,V,T,P) =E= + RCAP_BLK(R,V,P) * %VAR%_DRCAP(R,V,T,P%SOW%,'2') + (NCAP_PASTI(R,V,P)-RTFORC(R,V,T,P)) * %VAR%_DRCAP(R,V,T,P%SOW%,'1'); + +* Cumulative retirements + %EQ%_CUMRET(R,VNRET(V,K(T-(1-1$RP_RTF(R,P)))),P%SWT%)$(RTP_CPTYR(R,V,T,P)$PRC_RCAP(R,P)).. + + SUM(RTP_CPTYR(R,V,K,P),%VAR%_SCAP(R,V,T,P%SOW%) - %VAR%_RCAP(R,V,T,P%SOW%)) - + SUM(RTP_CPTYR(R,V,MODLYEAR(Y(T-1)),P)$VNRET(V,Y),%VARM%_SCAP(R,V,Y,P%SWS%)) + =E= 0; + +* Maximum salvage capacity + %EQ%L_SCAP(RTP(R,V(LL),P),IPS%SOW%)$(((OBJ_SUMS(RTP)+(NOT PRC_VINT(R,P))$T(V))$RVPRL(RTP)$L(IPS) OR NCAP_OLIFE(RTP)$IO(IPS))$PRC_RCAP(R,P)).. + + SUM(IO(IPS),SUM((RTP_CPTYR(R,V,TT,P),PRC_TS(R,P,S)),%VARTT%_ACT(R,V,TT,P,S%SWS%)*FPD(TT))/PRC_CAPACT(R,P)/NCAP_OLIFE(RTP)) + + SUM(VNRET(V,T(LL+RVPRL(RTP))),%VART%_SCAP(R,V,T,P%SWS%))$LIM(IPS) + + =L= %VARV%_NCAP(R,V,P%SWS%)$T(V) + NCAP_PASTI(R,V,P) - %VAR%_SCAP(R,V,'0',P%SOW%)$OBJ_SUMS(R,V,P)$RVPRL(R,V,P); + +* Retrofits and life-extensions + %EQ%L_REFIT(RTP_TT(R,TT,T,PRC),LNX(L)%SWT%)$((BD(L)+VNT(T,TT)$(RP_RTF(R,PRC)=3))$RT_PP(R,T)).. + SUM((V(TT),P)$((VNT(T,V) OR PRC_REFIT(R,PRC,P)<0)$PRC_REFIT(R,PRC,P)),COEF_CPT(R,V,T,P)*(%VARV%_NCAP(R,V,P%SWS%)%RCAPSUB%))+%VAR%_RCAP(R,T,TT,PRC%SOW%)$(RP_RTF(R,PRC)$VNT(T,TT)$BD(L)<3) + =E= + SUM(RTP_CPTYR(R,VNRET(V,TT),PRC),COEF_CPT(R,V,T,PRC) * (%VARTT%_RCAP(R,V,TT,PRC%SWS%)-SUM(MODLYEAR(K(TT-1))$VNT(V,K),MIN(INF$MOD(RP_RTF(R,PRC),2),RTFORC(R,V,TT,PRC)-RTFORC(R,V,K,PRC)))))+ + SUM(K(TT-1)$RTP_TT(R,K,T,PRC),%VAR%_RCAP(R,T,K,PRC%SOW%))$(RP_RTF(R,PRC)$BD(L)>0); +*----------------------------------------------------------------------------- +$IF %VARMAC% $SET VAR %VAS% +$IF NOT %MIP% OPTION CLEAR=RCAP_BLK; +* Set bounds for integer retirements + IF(CARD(RCAP_BLK), RCAP_BLK(RTP)$(RCAP_BLK(RTP) LE 0) = 0; +* Define upper bound of 1 for binary variable if past investments + COEF_CAP(RTP_CPTYR(R,V,T,P))$RCAP_BLK(R,V,P) = (NCAP_PASTI(R,V,P)-RTFORC(R,V,T,P))/RCAP_BLK(R,V,P); + %VAR%_DRCAP.UP(RTP_CPTYR(R,V,T,P)%SOW%,'1')$PRC_RCAP(R,P) = 1$(ABS(COEF_CAP(R,V,T,P)-MIN(10,ROUND(COEF_CAP(R,V,T,P)))) >1E-9); +* Define upper bound for integer multiples + %VAR%_DRCAP.UP(RTP_CPTYR(R,V,T,P)%SOW%,'2')$RCAP_BLK(R,V,P) = MIN(10,FLOOR(%VAR%_SCAP.UP(R,V,T,P%SOW%)/RCAP_BLK(R,V,P)+1E-8)); + ); + RVPRL(R,PYR_S,P)$PRC_RESID(R,'0',P)=NO; NCAP_OLIFE(R,T,P)$(NOT PRC_VINT(R,P))=NO; + OPTION CLEAR=COEF_CAP; +$EXIT +*----------------------------------------------------------------------------- +$LABEL OBJFIX +* Credit retired capacity for the avoided fixed costs + SUM((OBJ_SUMIV(K_EOH,R,V,P,JOT,LIFE),VNRET(V,T))$RVPRL(R,V,P), + SUM((INVSPRED(K_EOH,JOT,LL,K),KTYAGE(LL,T,Y_EOH,AGE))$OPYEAR(LIFE,AGE), + -OBJ_DISC(R,Y_EOH,CUR) * (1+RTP_CPX(R,V,P,T)$NCAP_CPX(R,V,P)) * %CAPWD% + ( + OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + + OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - + OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + ) + ) * + %VART%_SCAP(R,V,T,P %SWS%) / OBJ_DIVIV(R,V,P)) + + +* RESIDS require special handling + SUM(RTP_CPTYR(R,PYR_S(V(K)),T,P)$((NOT RVPRL(R,V,P))$PRC_RCAP(R,P)), + SUM(PERIODYR(T,Y_EOH), -OBJ_DISC(R,Y_EOH,CUR) * + ( + OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'1',J,JJ),MULTI(JJ,Y_EOH)-1)) + + OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'2',J,JJ),MULTI(JJ,Y_EOH)-1)) - + OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,V,P,'3',J,JJ),MULTI(JJ,Y_EOH)-1)) + )) * + %VART%_SCAP(R,V,T,P %SWS%)) + +$EXIT +*----------------------------------------------------------------------------- +$LABEL OBSALV +* Discredit salvage value for retired capacity + SUM(OBJ_SUMS(R,V,P)$((NOT NCAP_FDR(R,V,P)$RVPRL(R,'0',P))$RVPRL(R,V,P)), + OBJSCC(R,V,P,CUR) * OBJ_DCEOH(R,CUR) * + (%VAR%_SCAP(R,V,'0',P%SOW%)-%VARV%_NCAP(R,V,P%SWS%)$T(V)-NCAP_PASTI(R,V,P))) + diff --git a/prepxtra.mod b/prepxtra.mod new file mode 100644 index 0000000..9f2e780 --- /dev/null +++ b/prepxtra.mod @@ -0,0 +1,90 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* PREPONLY.MOD oversees that all inputs are interpolated when INTEXT_ONLY +*=============================================================================* +$ GOTO %1 +$ LABEL XTIE +*============================================================================= +* COST PARAMETERS: Interpolated by COEF_OBJ, only special options processed here +*----------------------------------------------------------------------------- +$ BATINCLUDE prepparm NCAP_COST R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_DCOST R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_DLAGC R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_FOM R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_FSUB R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_FTAX R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_ISUB R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_ITAX R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm NCAP_VALU R 'P,C,CUR' ",'0','0'" T 'RTP(R,T,P)' EPS 3 +*----------------------------------------------------------------------------- +* Commodity related attributes (6) +*----------------------------------------------------------------------------- +$ BATINCLUDE prepparm COM_CSTNET R 'C,S,CUR' ",'0','0'" T 1 EPS 3 +$ BATINCLUDE prepparm COM_CSTPRD R 'C,S,CUR' ",'0','0'" T 1 EPS 3 +$ BATINCLUDE prepparm COM_SUBNET R 'C,S,CUR' ",'0','0'" T 1 EPS 3 +$ BATINCLUDE prepparm COM_SUBPRD R 'C,S,CUR' ",'0','0'" T 1 EPS 3 +$ BATINCLUDE prepparm COM_TAXNET R 'C,S,CUR' ",'0','0'" T 1 EPS 3 +$ BATINCLUDE prepparm COM_TAXPRD R 'C,S,CUR' ",'0','0'" T 1 EPS 3 +*----------------------------------------------------------------------------- +* Flow related attributes & inter-regional exchange flows (6) +*----------------------------------------------------------------------------- +$ BATINCLUDE prepparm ACT_COST R 'P,CUR' ",'0','0','0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm FLO_COST R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm FLO_DELIV R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm FLO_SUB R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE prepparm FLO_TAX R 'P,C,S,CUR' ",'0'" T 'RTP(R,T,P)' EPS 3 +$ BATINCLUDE fillparm IRE_PRICE R 'P,C,S,ALL_R,IE,CUR' "" T 'RTP(R,T,P)' 'GE 0' +*----------------------------------------------------------------------------- +* Components of merged UC attribs +*----------------------------------------------------------------------------- +$ BATINCLUDE fillparm UC_COMCON 'UC_N,SIDE,ALL_R' 'C,S' ",'0','0'" T 1 'GE 0' +$ BATINCLUDE fillparm UC_COMNET 'UC_N,SIDE,ALL_R' 'C,S' ",'0','0'" T 1 'GE 0' +$ BATINCLUDE fillparm UC_COMPRD 'UC_N,SIDE,ALL_R' 'C,S' ",'0','0'" T 1 'GE 0' +*----------------------------------------------------------------------------- +* General attribs: +$ BATINCLUDE filparam MULTI 'J,' '' ",'','','','',''" LL MILESTONYR 'NO$' '' +$ BATINCLUDE filparam.gms G_DRATE 'R,' 'CUR' ",'','','','',''" YEAR T '' '' +*----------------------------------------------------------------------------- +$ LABEL POST + MODLYEAR(LL) = T(LL)+PASTYEAR(LL); +*----------------------------------------------------------------------------- +* Clean up some unwanted stuff +$IF DEFINED PRC_RESID LOOP(PYR_S(LL),NCAP_PASTI(R,LL,P)$PRC_RESID(R,'0',P)=0; NCAP_TLIFE(R,LL,P)$PRC_RESID(R,'0',P)=0); +$IF DEFINED PRC_RESID PRC_RESID(R,'0',P)=0; +*----------------------------------------------------------------------------- +* UC Default values +*----------------------------------------------------------------------------- +$ LABEL UCINT +* Check 'every T' specifications through using DFLBL: +* For T_SUM, fill in between user-specified year range or all + UC_DT(R,UC_N)$UC_T_SUM(R,UC_N,'%DFLBL%') = YES; UC_T_SUM(UC_DT,'%DFLBL%') = NO; + LOOP(UC_DT, Z=SMAX(UC_T_SUM(UC_DT,LL),ORD(LL)); + IF(Z > 0, F=SMIN(UC_T_SUM(UC_DT,LL),ORD(LL)); ELSE F=Z); + IF(Z NE F,UC_T_SUM(UC_DT,T(LL))$((ORD(LL) GT F)$(ORD(LL) LT Z)) = YES; + ELSE UC_T_SUM(UC_DT,T) = YES)); + OPTION CLEAR=UC_DT; + UC_T_SUCC(R,UC_N,T)$UC_T_SUCC(R,UC_N,'%DFLBL%') = YES; + UC_T_EACH(R,UC_N,T)$UC_T_EACH(R,UC_N,'%DFLBL%') = YES; + LOOP(T(YEAR), + UC_T_EACH(R,UC_N,LL+(ORD(YEAR)-ORD(LL)))$(EOHYEARS(LL)$PERIODYR(T,LL)$UC_T_EACH(R,UC_N,LL)) = YES; + UC_T_SUCC(R,UC_N,LL+(ORD(YEAR)-ORD(LL)))$(EOHYEARS(LL)$PERIODYR(T,LL)$UC_T_SUCC(R,UC_N,LL)) = YES; + UC_T_SUM(R,UC_N,LL+(ORD(YEAR)-ORD(LL)))$(EOHYEARS(LL)$PERIODYR(T,LL)$UC_T_SUM(R,UC_N,LL)) = YES; + ); +$ EXIT +*----------------------------------------------------------------------------- +$ LABEL SAVE +* Rename and move saved data GDX file + Z=CARD("%GDXPATH%%RUN_NAME%")+16; +$ SET GDATE '10000*MOD(GYEAR(JSTART),100)+100*GMONTH(JSTART)+GDAY(JSTART)' SET X1 +$ SET GTIME '10000*GHOUR(JSTART)+100*GMINUTE(JSTART)+GSECOND(JSTART)' SET X2 5 +$ IF %G2X6%%1==YESSAVE $SET X2 +$ IFI %G2X6%%1%X2%==YESSAVE5 + PUT QLOG; FILE.PW=512; PUT_UTILITY 'SHELL' / 'mv -f _dd_.gdx ' '%GDXPATH%%RUN_NAME%' @(Z+12) (%GTIME%+10**6):0:0 '.GDX' @(Z+5) (%GDATE%+10**6):0:0 "_" @Z '~Data_'; +$ LABEL PAD +$ IF %X2%0==0 $EVAL X1 '%X1%+1' EVAL X2 'TRUNC(LOG10(%GTIME%+.5))' EVAL GDATE '%GTIME%' SET GTIME %GDATE% +$ IF NOT %X2%==5 $EVAL X2 '%X2%+1' SET GDATE '0%GDATE%' GOTO PAD +$ IF %X1%==1 $SET X2 '' GOTO PAD +$ IF %X1%==2 $hiddencall mv -f _dd_.gdx "%GDXPATH%%RUN_NAME%~Data_%GDATE%_%GTIME%.gdx" diff --git a/preshape.gms b/preshape.gms new file mode 100644 index 0000000..3da2d10 --- /dev/null +++ b/preshape.gms @@ -0,0 +1,49 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +******************************************************************************* +* PRESHAPE : Prepare SHAPE parameters for preprocessing +* Description: Interpolation of X parameter on user request +* Parameters: +* %1 - table name +* %2 - control set 1 +* %3 - control set 2 +* %4 - residual dimension for control tuple +* %5 - MODLYEAR or MILESTONYR depending on parameter +* %6 - temporary table of control tuples +* %7 - P/C +******************************************************************************* +*$ONLISTING +$EOLCOM ! +$SETLOCAL TAIL ",%3" SETLOCAL DEF 10 +$IF '%3'=='' $SETLOCAL TAIL +$IF NOT '%8'=='' $SETLOCAL DEF %8 +OPTION CLEAR = %6; +%6(%2,LL--ORD(LL)%TAIL%%4) $= %1(%2,LL%TAIL%); +LOOP(%6(%2,'%DFLBL%'%TAIL%%4), + DFUNC=%DEF%; DFUNC $= MOD(ROUND(%1(%2,'%DFLBL%'%TAIL%)),1000); + MY_ARRAY(DM_YEAR) = %1(%2,DM_YEAR%TAIL%); + IF(DFUNC NE 10, F=0; LAST_VAL=0; +* do interpolate + LOOP(DM_YEAR$MY_ARRAY(DM_YEAR), ! check for nonzero (including EPS) + MY_F = MY_ARRAY(DM_YEAR); Z = YEARVAL(DM_YEAR); + IF(LAST_VAL, %1(%2,%5%TAIL%)$((Z>YEARVAL(%5))$(YEARVAL(%5)>MY_FYEAR)) = LAST_VAL; + ELSE F = Z; FIRST_VAL = MY_F); + LAST_VAL = ROUND(MY_F); MY_FYEAR=Z;); ! remember the value and year + ELSE FIRST_VAL = 0; MY_FYEAR = 0; ! intra-period I/E + LOOP(MY_FIL(LL)$MY_ARRAY(MY_FIL), ! check for data values + MY_F = MY_ARRAY(LL); Z = YEARVAL(MY_FIL); F = FIL2(MY_FIL); + IF(MY_FYEARMIN(FIRST_VAL,Z), LAST_VAL = MY_F; FIRST_VAL = F;); + %1(%2,%5(LL+(F-YEARVAL(LL)))%TAIL%)$(NOT MY_ARRAY(%5)) = LAST_VAL); + LAST_VAL = MY_F; MY_FYEAR=Z;); ! remember the value and year + DFUNC=0; + ); + IF(ROUND(DFUNC-5,-1)=10, + %1(%2,%5%TAIL%)$%7 $= FIRST_VAL$(YEARVAL(%5)Z)$(B(%5) LE Z); + DFUNC=DFUNC-10); + IF(DFUNC GE 2, +* Do back/forward extrapolate + IF(DFUNC=4, Z = INF; ELSEIF DFUNC=5, F = 0); + %1(%2,%5%TAIL%)$%7 $= FIRST_VAL$(YEARVAL(%5)Z); + ); + ); +$OFFLISTING diff --git a/presolve.mlf b/presolve.mlf new file mode 100644 index 0000000..eb71106 --- /dev/null +++ b/presolve.mlf @@ -0,0 +1,103 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* Presolve.mlf - Prepare coefficients for full MLF model +*------------------------------------------------------------------------------ + SET TM_DMAS(CG,CG) //; + SET TM_CES(CG) / AKL, YN /; + SET TM_RCJ(R,CG,J,BD) //; + SET LOGJ(J,BD) //; + + PARAMETERS TM_LOGJOT /0/, TM_LSC /0/ + TM_BASEPRI(R,T,CG) + TM_BASELEV(R,T,CG) + TM_PREF(R,T,CG) + TM_QREF(R,T,CG) + TM_SHAR(R,T,CG,CG) + TM_AGG(R,T,CG,CG) + TM_CESLEV(R,T,CG) + TM_AGC(R,T,CG,CG,J,BD) + TM_MIDCON(R,T) + TM_LOGVAL(J,BD); + +* Reset demand indicators + OPTION CLEAR=DM; DM(C)$=SUM(TM_DM(MR,C),1); + + TM_BASEPRI(MR,T,MAG(C))= ABS(EQ_DD.M(MR,T,C)*TM_AEEIFAC(MR,T,C)/TM_SCALE_NRG)/TM_DFACT(MR,T); + TM_BASEPRI(MR,T,'LAB') = ABS(EQ_LABOR.M(MR,T))/TM_DFACT(MR,T); + TM_BASEPRI(MR,T,'KN') = ABS(EQ_KNCAP.M(MR,T))/TM_DFACT(MR,T); + TM_BASEPRI(MR,T,'AKL') = ABS(EQ_AKL.M(MR,T))/TM_DFACT(MR,T); + TM_BASEPRI(MR,T,'YN') = ABS(EQ_PROD_Y.M(MR,T))/TM_DFACT(MR,T); + TM_BASELEV(MR,T,MAG) = VAR_D.L(MR,T,MAG); + TM_BASELEV(MR,T,'YN') = PAR_Y(MR,T); + TM_BASELEV(MR,T,'CON') = VAR_C.L(MR,T); + + TM_DMAS('AKL','KN')=YES; + TM_DMAS('AKL','LAB')=YES; + TM_DMAS('YN','AKL')=YES; + TM_DMAS('YN','ACT')=YES; + +* Calculate CES parameters + TM_PREF(MR(R),T,CG) $= TM_BASEPRI(R,T,CG); + TM_CESLEV(MR(R),T,TM_CES(CG)) = SUM(TM_DMAS(CG,CG1),TM_BASELEV(R,T,CG1)); + TM_PREF(MR(R),T,TM_CES(CG)) = SUM(TM_DMAS(CG,CG1),TM_BASELEV(R,T,CG1)*TM_PREF(R,T,CG1))/TM_CESLEV(R,T,CG); + TM_AGG(MR(R),T,CG1,TM_CES(CG))$TM_DMAS(CG,CG1)=1+(TM_BASEPRI(R,T,CG1)/TM_PREF(R,T,CG)-1)$TM_PREF(R,T,CG); +* Normalize TM_AGG + TM_QREF(MR(R),T,TM_CES(CG)) = SUM(TM_DMAS(CG,CG1),TM_AGG(R,T,CG1,CG)*TM_BASELEV(R,T,CG1)); + TM_AGG(MR(R),T,CG1,TM_CES(CG))$TM_AGG(R,T,CG1,CG)=TM_AGG(R,T,CG1,CG)*TM_CESLEV(R,T,CG)/TM_QREF(R,T,CG); +* Reset QREF and determine shares + TM_QREF(MR(R),T,CG) $= TM_BASELEV(R,T,CG); + TM_SHAR(MR(R),T,CG,CG1)$TM_DMAS(CG,CG1) = TM_BASELEV(R,T,CG1) / TM_CESLEV(R,T,CG); + TM_CIE(MR(R),T,TM_CES(CG))$TM_CESLEV(R,T,CG)= TM_QREF(R,T,CG) / TM_CESLEV(R,T,CG); +* Reverse RD_SHAR for CES aggregation + TM_SHAR(MR(R),T,CG1,CG)$TM_AGG(R,T,CG1,CG)=TM_AGG(R,T,CG1,CG)*TM_PREF(R,T,CG); + +* Prepare elasticity steps + LOOP(TM_DMAS(CG,CG1),Z=TM_DEFVAL('MACVOC'); + TM_STEP(R,CG1,BDNEQ)=TM_DEFVAL('MACSTEP'); + TM_VOC(MR(R),T,CG1,BDNEQ)=MIN(Z,Z/2+(M(T)-MIYR_V1)*0.01); + TM_RCJ(MR(R),CG1,J,BDNEQ)$(ORD(J)<=TM_STEP(R,CG1,BDNEQ))=YES); +* Cobb-Douglas function + TM_AGC(MR(R),T,CG('AKL'),CG1,J,BD)$((TM_VOC(R,T,CG1,BD)>0)$TM_RCJ(R,CG1,J,BD)$TM_DMAS(CG,CG1)) = -BDSIG(BD)* + LOG(1-BDSIG(BD)*ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD))/(ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD)); +* CES Production function + TM_AGC(MR(R),T,CG('YN'),CG1,J,BD)$((TM_VOC(R,T,CG1,BD)>0)$TM_RCJ(R,CG1,J,BD)$TM_DMAS(CG,CG1)) = BDSIG(BD)* + (1-(1-BDSIG(BD)*ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD))**(1-1/TM_ESUB(R)))/(ORD(J)*TM_VOC(R,T,CG1,BD)/TM_STEP(R,CG1,BD))/(1-1/TM_ESUB(R)); +* Restore PREF to BASEPRI + TM_PREF(MR(R),T,CG) $= TM_BASEPRI(R,T,CG); + +* Calculate demand parameters + TM_PREF(MR(R),T,C)$TM_DM(R,C) = DDF_PREF(R,T,C); + TM_QREF(MR(R),T,C)$TM_DM(R,C) = COM_PROJ(R,T,C); + TM_AGG(MR(R),T,DM(C),CG('ACT')) = TM_PREF(R,T,C)/TM_DMC(R,T,CG); + TM_SHAR(MR(R),T,CG('ACT'),C)$TM_DM(R,C) = TM_QREF(R,T,C) / TM_DEM(R,T,CG); + TM_SHAR(MR(R),T,C,CG('ACT'))$TM_DM(R,C) = TM_AGG(R,T,C,CG)*TM_DMC(R,T,CG); +* Prepare elasticity steps + Z=SMIN(PP(T),M(T)); + TM_STEP(TM_DM(RC),BDNEQ(BD))$(NOT TM_STEP(RC,BD))=55-5*BDSIG(BD); + TM_VOC(MR(R),T,C,'LO')$((NOT TM_VOC(R,T,C,'LO'))$TM_DM(R,C)) = MIN(0.45,0.15+(M(T)-Z)*.015); + TM_VOC(MR(R),T,C,'UP')$((NOT TM_VOC(R,T,C,'UP'))$TM_DM(R,C)) = 0.3/(1-TM_VOC(R,T,C,'LO'))+TM_VOC(R,T,C,'LO')-0.3; + TM_RCJ(TM_DM(MR,C),J,BDNEQ(BD))$(ORD(J)<=TM_STEP(MR,C,BD)) = YES; +* Demand CES aggregation + TM_AGC(MR(R),T,CG('ACT'),C,J,BD)$((TM_VOC(R,T,C,BD)>0)$TM_RCJ(R,C,J,BD)$TM_DM(R,C)) = BDSIG(BD)* + (1-(1-BDSIG(BD)*ORD(J)*TM_VOC(R,T,C,BD)/TM_STEP(R,C,BD))**(1-1/TM_DESUB(R)))/(ORD(J)*TM_VOC(R,T,C,BD)/TM_STEP(R,C,BD))/(1-1/TM_DESUB(R)); + +* Logarithmic utility from consumption + Z=TM_DEFVAL('LOGSTEP'); + LOGJ(J,BDNEQ(BD))$(ORD(J)<=ROUND(Z/2)) = YES; + TM_MIDCON(R,T) = TM_BASELEV(R,T,'CON')*0.5*SQRT(EXP(LOG(2)*1.1)); + TM_LOGJOT=LOG(2)/ROUND(Z/1.1); + TM_LOGVAL(LOGJ(J,BDNEQ(BD))) = (1-EXP(-BDSIG(BD)*ORD(J)*TM_LOGJOT))/(TM_LOGJOT*ORD(J)); + TM_LSC=ROUND(Z**.7,-1); + +*------------------------------------------------------------------------------ +* Reset bounds + VAR_K.UP(MR,T) = INF; + VAR_K.LO(MR,T) = 0; + VAR_D.UP(MR,T,MAG) = INF; + VAR_D.LO(MR,T,MAG) = 0; + VAR_D.FX(MR,T,'LAB') = TM_L(MR,T); + VAR_C.UP(MR(R),T)$(NOT TM_PP(R,T)) = VAR_C.L(R,T); + OPTION BRATIO=1; \ No newline at end of file diff --git a/readbprice.mod b/readbprice.mod new file mode 100644 index 0000000..a150fff --- /dev/null +++ b/readbprice.mod @@ -0,0 +1,48 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* Importing sol_bprice and assigning it to parameter COM_BPRICE +*=============================================================================* + PARAMETER SOL_BPRICE(R,YEAR,C,TS,CUR) //; + +$IF NOT ERRORFREE $EXIT +$KILL DAM_TVOC +$SET TMP com_bprice +$IFI %TIMESED%==YES $GOTO LOAD +$SETLOCAL TMP %GDXPATH%%TIMESED% +$IF EXIST %TMP%_DP.gdx $SETLOCAL TMP %TMP%_DP +$IF NOT EXIST %TMP%.gdx $DROPLOCAL TMP +$LABEL LOAD +$GDXIN %TMP% +$IF NOT ERRORFREE $GOTO FINISH +$IFI %MACRO%==MLF $SET MX SET MACRO 'Yes' +$LOAD sol_bprice +$IF NOT ERRORFREE $GOTO FINISH +$SETGLOBAL MX %MX% SET TIMESED 'YES' +$IF DEFINED DAM_ELAST $LOAD DAM_COEF +$IF DEFINED DAM_ELAST $LOAD DAM_TVOC +$IFI %MACRO%==MLF $LOAD SOL_ACFR +$GDXIN + + OPTION DEM < COM_PROJ; + DEM(R,C)$COM_TMAP(R,'DEM',C) = YES; +* Fill in missing tail milestoneyrs to reduce abruption + OPTION FORWARD < SOL_BPRICE; FIL(T) = PROD(FORWARD(TT),ORD(TT)0)+EPS; +DAM_TQTY(R,T,C)$TRACKC(R,C) $= DAM_TVOC(R,T,C,'N'); +OPTION CLEAR=DAM_TVOC,CLEAR=TRACKC; +*-------------------------------------------------------------------- +$LABEL FINISH +$IFI NOT %MACRO%==MLF $CLEARERROR diff --git a/recurrin.stc b/recurrin.stc new file mode 100644 index 0000000..d7a9307 --- /dev/null +++ b/recurrin.stc @@ -0,0 +1,181 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* RECURRIN.stc oversees recurring stochastic definitions +* %1 - mod or v# for the source code to be used +*=============================================================================* +* Questions/Comments: +* +*----------------------------------------------------------------------------- +* Can we use macroes? +$SET TST NO +$IFI %OBMAC%==YES $SET TST YES +*----------------------------------------------------------------------------- +$GOTO %1 +*----------------------------------------------------------------------------- +$LABEL MXPAR +$IF %STAGES%==YES $SETGLOBAL VARMAC '1==1' SETGLOBAL VAS VAS +* Do we need MX parameter macroes? +$SET NEED NO +$IF DEFINED S_NCAP_AFS $SET NEED YES +$IF DEFINED S_COM_FR $SET NEED YES +$IFI %SPINES%==YES $SET NEED YES +$IF %NEED%==NO $GOTO NONEED +*--- +$IF %TST%==YES $GOTO DEFPAR +$error Macro support needed. Upgrade your GAMS system. +$clearerror +$KILL S_NCAP_AFS S_COM_FR +*--- +$LABEL NONEED +$EXIT +*--- +$LABEL DEFPAR +$SET SW1 '' SET SW2 '' +$IF NOT %STAGES%==YES $SET SW1 'SUM' SET SW2 SOW, +$SETGLOBAL MX MX +$macro MX +* Default case +$IF NOT DEFINED S_NCAP_AFS $MACRO COEF_AFMX COEF_AF +$IF NOT DEFINED S_COM_FR $MACRO RTCS_FRMX RTCS_FR +$IF NOT DEFINED S_COM_FR $MACRO COM_FRMX COM_FR +$IFI NOT %SPINES%==YES $MACRO PRC_DYNUCMX PRC_DYNUC +* Defined case +$IF DEFINED S_NCAP_AFS $MACRO COEF_AFMX(R,V,T,P,S,BD) COEF_AF(R,V,T,P,S,BD)*%SW1%(%SW2%1+RTP_SAFS(R,T,P,S,SOW)) +$IF DEFINED S_COM_FR PARAMETER RTCS_FRMX(R,T,C,S,S); +$IF DEFINED S_COM_FR $MACRO RTCS_FR(R,T,C,S,TS) RTCS_FRMX(R,T,C,S,TS)+SUM(SW_T2W(SOW,T,W,T0),RCS_SSFR(R,C,S,TS,W,T0)) +$IF DEFINED S_COM_FR $MACRO COM_FRMX(R,T,C,S) COM_FR(R,T,C,S)*%SW1%(%SW2%1+S_COM_FR(R,T,C,S,'1',SOW)) +$GOTO FINISH +*----------------------------------------------------------------------------- +$LABEL SPINES +* Do we need SPINES macroes? +$IFI NOT %SPINES%==YES $EXIT +$IF %TST%==NO $ABORT Macro support needed. Upgrade your GAMS system. +$SET VSUM SUM(SW_TSW(SOW, +$SETGLOBAL SW_STVARS SET VAR "Z" SET VART '%VSUM%T,W),Z' SET VARM '%VSUM%MODLYEAR,W),Z' SET VARV '%VSUM%V,W),Z' +$SETGLOBAL WITSPINE SET EQS '%EQ%' SET EQ 'Q' +$SETGLOBAL EWISPINE SET EQ %EQ% + SET OBJSW1(OBV); + SET UCRTPSW1(UC_GRPTYPE,WW); + OBJSW1('OBJINV')=YES; + OBJSW1('OBJFIX')=YES; + OBJSW1('OBJSAL')=YES; + UCRTPSW1('ACT',SOW) = YES; + UCRTPSW1('CAP','1') = YES; + UCRTPSW1('NCAP','1') = YES; +$macro QED +$macro PRC_DYNUCMX(uc,side,r,t,p,grp,bd) PRC_DYNUC(uc,side,r,t,p,grp,bd)$UCRTPSW1(grp,SOW) +*----------------------------------------------------------------------------- +* Equations (only if needed) +$macro Q_OBJELS ES_OBJELS +$macro Q_OBJFIX(rc,sow) ES_OBJFIX(rc,SOW('1')) +$macro Q_OBJINV(rc,sow) ES_OBJINV(rc,SOW('1')) +$macro Q_OBJSALV(rc,sow) ES_OBJSALV(rc,SOW('1')) +$macro Q_OBJVAR ES_OBJVAR +$macro Q_ROBJ ES_ROBJ +$macro Q_SOBJ ES_SOBJ + +$macro QG_CPT(rtp,swt) ESG_CPT(rtp,T,SOW('1')) +$macro QE_CPT(rtp,swt) ESE_CPT(rtp,T,SOW('1')) +$macro QL_CPT(rtp,swt) ESL_CPT(rtp,T,SOW('1')) +$macro Q_DSCRET(cpt,sw) ES_DSCRET(cpt,T,SOW('1')) +$macro Q_CUMRET(r,v,p,w) ES_CUMRET(r,v,p,T,SOW('1')) +$macro QL_REFIT(rttp,l,swt) ESL_REFIT(rttp,l,T,SOW('1')) +$macro Q_DSCNCAP(rtp,sw) ES_DSCNCAP(rtp,T,SOW('1')) +$macro Q_DSCONE(rtp,swt) ES_DSCONE(rtp,T,SOW('1')) + +$macro QE_UCT ESE_UCT +$macro QE_UCRT ESE_UCRT +$macro QE_UCTS ESE_UCTS +$macro QE_UCRS ESE_UCRS +$macro QE_UCRTS ESE_UCRTS + +* Cumulative / dynamic +$IF %SOLVEDA%==1 $GOTO DYQAGG +$SETGLOBAL SW_STVARS %SW_STVARS% SET VARTT '%VSUM%TT,W),Z' SET SWSW SW_TSW(SOW,T,WW), +$macro Q_CUMNET ES_CUMNET +$macro Q_CUMPRD ES_CUMPRD +$macro Q_CUMFLO ES_CUMFLO +$macro Q_BNDCST ES_BNDCST +$macro QE_UC ESE_UC +$macro QE_UCR ESE_UCR +$macro QE_UCSU ESE_UCSU +$macro QE_UCSUS ESE_UCSUS +$macro QE_UCRSU ESE_UCRSU +$macro QE_UCRSUS ESE_UCRSUS +$macro QL_SCAP ESL_SCAP +$GOTO DYQDONE +$LABEL DYQAGG +$SETGLOBAL SCUM 1 +$SETGLOBAL SW_STVARS %SW_STVARS% SET VARTT 'SUM(SW_TSW(W,TT,W),SW_TPROB(TT,W)*Z' SET SWSW SW_TSW(SOW(WW),T,WW),SW_TPROB(T,WW)* +$macro Q_CUMNET(rc,y1,y2,sow) ES_CUMNET(rc,y1,y2,'1') +$macro Q_CUMPRD(rc,y1,y2,sow) ES_CUMPRD(rc,y1,y2,'1') +$macro Q_CUMFLO(rpcyy,sw) ES_CUMFLO(rpcyy,'1') +$macro Q_BNDCST(r,y,y2,c,m,w) ES_BNDCST(r,y,y2,c,m,'1') +$macro QE_UC(uc,sow) ESE_UC(uc,'1') +$macro QE_UCR(uc,r,sow) ESE_UCR(uc,r,'1') +$macro QE_UCSU(uc,t,sw) ESE_UCSU(uc,t,'1') +$macro QE_UCSUS(uc,t,s,sw) ESE_UCSUS(uc,t,s,'1') +$macro QE_UCRSU(uc,r,t,sw) ESE_UCRSU(uc,r,t,'1') +$macro QE_UCRSUS(uc,r,t,s,sw) ESE_UCRSUS(uc,r,t,s,'1') +$macro QL_SCAP(rtp,ip,sow) ESL_SCAP(rtp,ip,'1') +$LABEL DYQDONE +*----------------------------------------------------------------------------- +* Variables (must have for all standard) +$macro Z_OBJ VAS_OBJ +$macro Z_OBJELS VAS_OBJELS + +$macro Z_ACT VAS_ACT +$macro Z_FLO VAS_FLO +$macro Z_IRE VAS_IRE +$macro Z_SIN VAS_SIN +$macro Z_SOUT VAS_SOUT +$macro Z_BLND VAS_BLND +$macro Z_COMNET VAS_COMNET +$macro Z_COMPRD VAS_COMPRD +$macro Z_ELAST VAS_ELAST +$macro Z_DEM VAS_DEM +$macro Z_UPS VAS_UPS +$macro Z_UPT VAS_UPT +$macro Z_UDP VAS_UDP +$macro Z_RLD VAS_RLD +$macro Z_GRIDELC VAS_GRIDELC +$macro Z_COMAUX VAS_COMAUX + +$macro Z_CAP(r,t,p,sow) VAS_CAP(r,t,p,'1') +$macro Z_NCAP(r,t,p,sow) VAS_NCAP(r,t,p,'1') +$macro Z_RCAP(r,v,t,p,sow) VAS_RCAP(r,v,t,p,'1') +$macro Z_SCAP(r,v,t,p,sow) VAS_SCAP(r,v,t,p,'1') +$macro Z_DRCAP(r,v,t,p,w,j) VAS_DRCAP(r,v,t,p,'1',j) +$macro Z_DNCAP(r,t,p,sow,j) VAS_DNCAP(r,t,p,'1',j) +$macro Z_SNCAP(r,t,p,sow) VAS_SNCAP(r,t,p,'1') + +$macro Z_UC VAS_UC +$macro Z_UCR VAS_UCR +$macro Z_UCT VAS_UCT +$macro Z_UCRT VAS_UCRT +$macro Z_UCTS VAS_UCTS +$macro Z_UCRTS VAS_UCRTS + +$IF %SOLVEDA%==1 $GOTO DYZAGG +$macro Z_CUMCOM VAS_CUMCOM +$macro Z_CUMFLO VAS_CUMFLO +$macro Z_CUMCST VAS_CUMCST +$GOTO DYZDONE +$LABEL DYZAGG +$macro Z_CUMCOM(r,c,cv,y1,y2,w) VAS_CUMCOM(r,c,cv,y1,y2,'1') +$macro Z_CUMFLO(r,p,cv,y1,y2,w) VAS_CUMFLO(r,p,cv,y1,y2,'1') +$macro Z_CUMCST(r,y1,y2,cg,m,w) VAS_CUMCST(r,y1,y2,cg,m,'1') +$LABEL DYZDONE + +$macro Z_CLITOT VAS_CLITOT +$macro Z_CLIBOX VAS_CLIBOX + +* Map objective components + EQUATION %EQ%_OBW1(OBV,R,CUR,ALLSOW); + %EQ%_OBW1(OBJSW1(OBV),RDCUR(R,CUR),SOW) .. %VAR%_OBJ(R,OBV,CUR,SOW) =E= %VAR%_OBJ(R,OBV,CUR,'1'); + +*----------------------------------------------------------------------------- +$LABEL FINISH diff --git a/resloadc.vda b/resloadc.vda new file mode 100644 index 0000000..3ceada3 --- /dev/null +++ b/resloadc.vda @@ -0,0 +1,154 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* ResLoadC.vda - define residual load curve equations +*=============================================================================* +$IF NOT '%1'=='' $GOTO %1 +*----------------------------------------------------------------------------- +* Internal declarations + SET RLDC / RL-DISP /, ITEM / RL-NDIS, RL-CHP, RL-ROR, RL-SOL, RL-WIND, RL-THMIN, RL-TP /; + SET GR_RLDC(R,LL); + SET RLDBD(LIM) / UP /; + SET GR_RLGT(R,P,ITEM); + PARAMETER GR_THBND(R,LL,P,LIM); + PARAMETER GR_TP(R,BD) / (SET.R).UP INF /; +* FX - constant; LO - proportional to capacity; UP - proportional to online capacity +* Preparations + GR_RLDC(R,'0') $=SUM((S,RLDC,BD)$GR_VARGEN(R,S,RLDC,BD),1); + GR_TP(R,BD)$=GR_VARGEN(R,'ANNUAL','RL-TP',BD); GR_TP(R,BD)$=GR_TP(R,'FX'); GR_VARGEN(R,S,'RL-TP',BD)=0; + OPTION CLEAR=UNCD1; GR_RLDC(R,T(TT+1))$((YEARVAL(T)>=GR_TP(R,'LO'))$(YEARVAL(T)<=GR_TP(R,'UP'))) $= GR_RLDC(R,'0'); + LOOP((R,S,ITEM,BD)$GR_VARGEN(R,S,ITEM,BD),UNCD1(ITEM)=YES); RLDC(UNCD1) = YES; + RLDBD(BD)$=NOT RLDC('RL-THMIN'); GR_VARGEN(R,S,'RL-THMIN',BD) = 0; +$ BATINCLUDE fillparm GR_THMIN R P ",'0','0','0','0','0'" T RTP(R,T,P) 'GE 0' +$ EXIT +*----------------------------------------------------------------------- +$LABEL COEF +* Preprocessing + TRACKPC(RPC_PG(RP_STD(R,P),C))$(TOP(R,P,C,'OUT')$NRG_TMAP(R,'ELC',C)) = YES; + OPTION TRACKP=1)$GR_THMIN(RTP)) = 1/GR_THMIN(RTP); +* Levelize variations + FOR(Z=CARD(TSLVL)-2 DOWNTO 0, + LOOP((ANNUAL(TS(TSL-Z)),TS_GROUP(R,TSL,SL)), + GR_VARGEN(FINEST(R,S),RLDC,BDNEQ(BD))$((NOT GR_VARGEN(R,S,RLDC,BD))$RS_BELOW(R,SL,S)) $= GR_VARGEN(R,SL,RLDC,BD))); +* Ensure curtailment is accounted + GR_RLDC(R,'0')$GR_VARGEN(R,'ANNUAL','RL-DISP','FX') = NO; + LOOP(R$GR_RLDC(R,'0'), + RHS_COMBAL(RTCS_VARC(GR_RLDC(R,T),C,S))$(COM_LIM(R,C,'LO')$NRG_TMAP(R,'ELC',C)) = YES; + RCS_COMBAL(RHS_COMBAL(GR_RLDC(R,T),C,S),'FX')$NRG_TMAP(R,'ELC',C) = YES); + GR_VARGEN(R,ANNUAL,RLDC,'FX') = 1-DIAG('RL-DISP',RLDC); +* Move to ACT_UPS when needed + LOOP(RLDBD(BDNEQ(BD)),ACT_UPS(RTP,ANNUAL(S),'FX')$GR_THBND(RTP,BD)=MAX(GR_THBND(RTP,BD),ACT_UPS(RTP,S,'FX')); + GR_THBND(R,LL,P,BD)$RP_UPL(R,P,'FX')=0) + IF(RLDBD('FX'),FLO_BND(RTP(R,T,P),C,S,'LO')$(RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C)$PRC_TS(R,P,S)$GR_THBND(RTP,'FX')) = + MAX(FLO_BND(RTP,C,S,'LO'),GR_THBND(RTP,'FX')*PRC_CAPACT(R,P)*G_YRFR(R,S))); + OPTION GR_THMIN < GR_THBND; +$ EXIT +*----------------------------------------------------------------------- +$ LABEL EQUA +* Remove cycling if lower bounds are per nominal capacity + RPS_UPS(R,P,S)$SUM(RTP(R,V,P)$GR_THBND(RTP,'LO'),1)=NO; +* Set bounds + %VAS%_RLD.LO(R,T,S,'RL-DISP'%SOW%)=-INF; +*----------------------------------------------------------------------- +* Define the residual load as the sum of dispatchable production plus net storage output + %EQ%_RL_LOAD(GR_RLDC(%R_T%),RTS(S)%SWT%)$FINEST(R,S).. + +* Dispatchable production + SUM(TOP(R,P,C,'OUT')$(NRG_TMAP(R,'ELC',C)$GR_GENMAP(R,P,'RL-DISP')), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), +$ BATINCLUDE %cal_red% C COM TS P T + * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) + + SUM(RLDC('RL-THMIN'),%VAR%_RLD(R,T,S,RLDC%SOW%)*G_YRFR(R,S)) - +* Net storage input + SUM(TOP(RPC_STG(R,P,C),IO)$NRG_TMAP(R,'ELC',C), + SUM((RTP_VINTYR(R,V,T,P),RPCS_VAR(R,P,C,TS))$RS_FR(R,S,TS), + (%VAR%_SIN(R,V,T,P,C,TS %SOW%)$IPS(IO)-%VAR%_SOUT(R,V,T,P,C,TS %SOW%)*STG_EFF(R,V,P)$(NOT IPS(IO)))*RS_FR(R,S,TS))) - +* Curtailment + SUM(RHS_COMBAL(R,T,C,TS)$(RS_FR(R,S,TS)$NRG_TMAP(R,'ELC',C)$GR_RLDC(R,'0')), + (%VAR%_COMNET(R,T,C,TS%SOW%)/COM_IE(R,T,C,TS)*RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))$(NOT SUM(COM$COM_AGG(R,T,C,COM),1))) + + =E= %VAR%_RLD(R,T,S,'RL-DISP'%SOW%)*G_YRFR(R,S); + +*----------------------------------------------------------------------- +* Total levels of generation by group + %EQ%_RL_NDIS(GR_RLDC(%R_T%),RTS(S),RLDC%SWT%)$(FINEST(R,S)$GR_VARGEN(R,'ANNUAL',RLDC,'FX')).. + + SUM(TOP(R,P,C,'OUT')$(NRG_TMAP(R,'ELC',C)$GR_RLGT(R,P,RLDC)), + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS), +$ BATINCLUDE %cal_red% C COM TS P T + * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)))) + =E= %VAR%_RLD(R,T,S,RLDC %SOW%)*G_YRFR(R,S); +*----------------------------------------------------------------------- +* Available storage capacity must be at least thermal min minus residual load with lower variation + %EQ%_RL_STCAP(GR_RLDC(%R_T%),RTS(S)%SWT%)$FINEST(R,S).. + +* Daynite storage capacity + SUM(TOP(RPC_STG(PRC_CAP(R,P),C),'OUT')$(PRC_TS(R,P,S)$NRG_TMAP(R,'ELC',C)), PRC_CAPACT(R,P) * RS_STGPRD(R,S) * + SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P) * PRC_ACTFLO(R,V,P,C) * + SMIN(TS_MAP(R,TS,S)$COEF_AF(R,V,T,P,TS,'UP'),COEF_AF(R,V,T,P,TS,'UP') / RS_FR(R,S,TS) * + PROD(TS_GROUP(R,TSL,TS)$RPS_CAFLAC(R,P,TS,'UP'), 1 / RS_STGPRD(R,S) / STG_EFF(R,V,P) * + (NCAP_AFCS(R,V,P,C,TS)+PROD(COM_TMAP(R,COM_TYPE(CG),C)$NCAP_AFCS(R,V,P,CG,TS),NCAP_AFCS(R,V,P,CG,TS))$(NOT NCAP_AFCS(R,V,P,C,TS))))) * + (%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)%RCAPSUB%))) + + =G= + +* Thermal min capacity - residual load + %VAR%_RLD(R,T,S,'RL_THMIN'%SOW%) - %VAR%_RLD(R,T,S,'RL-DISP'%SOW%) + +* Plus lower variation + SUM((RLDC,BDNEQ(BD))$(DIAG('RL-DISP',RLDC)=DIAG('LO',BD)), %VAR%_RLD(R,T,S,RLDC%SOW%) * GR_VARGEN(R,S,RLDC,BD)); + +*----------------------------------------------------------------------- +* Available dispatchable plus storage output capacity must be at least residual load upper variation + %EQ%_RL_PKCAP(GR_RLDC(%R_T%),RTS(S)%SWT%)$FINEST(R,S).. + +* Dispatchable capacity + SUM(GR_RLGT(PRC_CAP(R,P),'RL-DISP'), PRC_CAPACT(R,P) * + SUM(V$COEF_CPT(R,V,T,P), COEF_CPT(R,V,T,P) * SMAX(RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C),PRC_ACTFLO(R,V,P,C)) * SUM(PRC_TS(R,P,TS)$RS_FR(R,S,TS),COEF_AF(R,V,T,P,S,'UP')) * + (%VARV%_NCAP(R,V,P %SWS%)$TT(V) + NCAP_PASTI(R,V,P)$PYR(V)%RCAPSUB%))) + +* Storage output capacity + SUM(TOP(RPC_STG(PRC_CAP(R,P),C),'OUT')$(PRC_TS(R,P,S)$NRG_TMAP(R,'ELC',C)), PRC_CAPACT(R,P) * RS_STGPRD(R,S) * + SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P) * COEF_AF(R,V,T,P,S,'UP') * PRC_ACTFLO(R,V,P,C) * STG_EFF(R,V,P) * + PROD(L('N'), + PROD(TS_GROUP(R,TSL,S)$RPS_CAFLAC(R,P,S,'UP'), 1 / RS_STGPRD(R,S) / STG_EFF(R,V,P) * + (NCAP_AFCS(R,V,P,C,S)+PROD(COM_TMAP(R,COM_TYPE(CG),C)$NCAP_AFCS(R,V,P,CG,S),NCAP_AFCS(R,V,P,CG,S))$(NOT NCAP_AFCS(R,V,P,C,S))))) * + (%VARV%_NCAP(R,V,P %SWS%)$TT(V) + NCAP_PASTI(R,V,P)$PYR(V)%RCAPSUB%))) + + =G= + +* Residual load plus upper variation + %VAR%_RLD(R,T,S,'RL-DISP'%SOW%) + + SUM((RLDC,BDNEQ(BD))$(DIAG('RL-DISP',RLDC)=DIAG('UP',BD)), %VAR%_RLD(R,T,S,RLDC%SOW%) * GR_VARGEN(R,S,RLDC,BD)); + +*----------------------------------------------------------------------- +* Aggregate thermal min level + %EQ%_RL_THMIN(GR_RLDC(%R_T%),RTS(TS),BDNEQ %SWT%)$((BDLOX(BDNEQ)+RLDC('RL-THMIN'))$FINEST(R,TS)).. + + %VAR%_RLD(R,T,TS,'RL_THMIN'%SOW%)*BDSIG(BDNEQ) + + %VAR%_RLD(R,T,TS,'RL-THMIN'%SOW%)*BDUPX(BDNEQ) + + =G= + +* Aggregate target load level according to THMIN + SUM(GR_RLGT(PRC_CAP(R,P),'RL-THMIN'), PRC_CAPACT(R,P) * (GR_THBND(R,T,P,'FX') + + SUM((RTP_VINTYR(R,V,T,P),PRC_TS(R,P,S))$RS_FR(R,TS,S),SMAX(RPC_PG(R,P,C)$NRG_TMAP(R,'ELC',C),PRC_ACTFLO(R,V,P,C)) * + (SUM(BD$BDNEQ(BD),GR_THBND(R,T,P,BD))+SUM(TS_ANN(S,SL),ACT_UPS(R,V,P,SL,'FX'))$(NOT GR_THMIN(R,T,P))) * + (SUM(MODLYEAR(K)$(COEF_CPT(R,K,T,P)$(DIAG(V,K)>=1$PRC_VINT(R,P))),COEF_CPT(R,MODLYEAR,T,P) * + (%VARM%_NCAP(R,K,P %SWS%)$TT(K)+NCAP_PASTI(R,K,P)$PYR(K)%RCAPSBM%))%UPSCAPS%))))$BDLOX(BDNEQ); diff --git a/rpt_dam.mod b/rpt_dam.mod new file mode 100644 index 0000000..7f6c437 --- /dev/null +++ b/rpt_dam.mod @@ -0,0 +1,56 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*------------------------------------------------------------------------------ +* RPT_DAM.mod +* +* Output routine for Damage Costs +*------------------------------------------------------------------------------ +$SETLOCAL SWP '' SETLOCAL SW1 '' +$IF %SOLVEDA%==1 $SETLOCAL SWP 'S' SETLOCAL SW1 "'1'," +$IFI %STAGES%==YES $SETLOCAL SWP 'S' SETLOCAL SW1 'SOW,' + %VAR%_OBJ.M(R,'OBJDAM',CUR %SOW%)$RDCUR(R,CUR) = 0; +*------------------------------------------------------------------------------ +* Always report the accurate non-linear costs + OPTION CLEAR=RXX; LOOP(RDCUR(R,CUR), RXX(RTC)$DAM_COST(RTC,CUR) = YES); +*------------------------------------------------------------------------------ +* If using climate module, enable damages for total emissions/concentration +$IF %CLI%==YES %SWP%CST_DAM(%SW1%R,T,C(CG(CM_VAR)))$((NOT RC(R,C))$RXX(R,T,C)) = +$IF %CLI%==YES %VART%_CLITOT.L(CM_VAR,T%SWS%)$CM_KIND(CM_VAR)+%VAR%_CLIBOX.L(CM_VAR,T%SOW%)$(NOT CM_KIND(CM_VAR)); +*------------------------------------------------------------------------------ + %SWP%CST_DAM(%SW1%RXX(R,T,C))$RC(R,C) = + SUM(COM_TS(R,C,S),DAM_COEF(R,T,C,S) * + (%VART%_COMNET.L(R,T,C,S%SWS%)$(NOT DAM_ELAST(R,C,'N'))+%VART%_COMPRD.L(R,T,C,S%SWS%)$DAM_ELAST(R,C,'N'))); + %SWP%DAM_OBJ(%SW1%RXX(R,T,C),CUR)$RDCUR(R,CUR) = +$IFI NOT %STAGES%==YES DAM_COST(R,T,C,CUR) * +$IFI %STAGES%==YES SUM(SWW(SOW,W)$(SW_TSW(SOW,T,W)$(NOT WWDAM(C))+SWW(W,SOW)$WWDAM(C)),S_DAM_COST(R,T,C,CUR,'1',W)) * + (DAM_TVOC(R,T,C,'N')*(MIN(%SWP%CST_DAM(%SW1%R,T,C),DAM_SIZE(R,T,C,'N'))+DAM_SIZE(R,T,C,'N')*DAM_ELAST(R,C,'N')) + + ((MIN(DAM_TQTY(R,T,C),%SWP%CST_DAM(%SW1%R,T,C))**(DAM_ELAST(R,C,'LO')+1) + +* Subtract full LO costs if DAM_ELAST(N) = -1 (constant term) + DAM_ELAST(R,C,'N')*(DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'LO')+1)-DAM_SIZE(R,T,C,'N')**(DAM_ELAST(R,C,'LO')+1)) - + MIN(DAM_SIZE(R,T,C,'N'),%SWP%CST_DAM(%SW1%R,T,C))**(DAM_ELAST(R,C,'LO')+1)) / + (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'LO')*(DAM_ELAST(R,C,'LO')+1))) + + ((%SWP%CST_DAM(%SW1%R,T,C)**(DAM_ELAST(R,C,'UP')+1) - + DAM_TQTY(R,T,C)**(DAM_ELAST(R,C,'UP')+1)) / + (DAM_TQTY(R,T,C)**DAM_ELAST(R,C,'UP')*(DAM_ELAST(R,C,'UP')+1)))$(%SWP%CST_DAM(%SW1%R,T,C) GT DAM_TQTY(R,T,C)) + +* Shift cost curve by DAM_ELAST(N) if applicable + DAM_ELAST(R,C,'N')*(%SWP%CST_DAM(%SW1%R,T,C)+DAM_ELAST(R,C,'N')*DAM_TQTY(R,T,C)) + ); + +$IF %SCUM%==1 $SETLOCAL SW1 "'1'," %SW_NOTAGS% +$IF %SCUM%==1 SDAM_OBJ(%SW1%RXX(R,T,C),CUR)$RDCUR(R,CUR) = SUM(W,SW_PROB(W)*SDAM_OBJ(W,R,T,C,CUR)); + + %SWP%CST_DAM(%SW1%RXX(R,T,C)) = SUM(RDCUR(R,CUR),%SWP%DAM_OBJ(%SW1%R,T,C,CUR)); + %SWP%REG_ACOST(%SW1%R,T,'DAM') = SUM(RXX(R,T,C),%SWP%CST_DAM(%SW1%R,T,C)); + %SWP%CST_PVC(%SW1%'DAM',R,C)$DAM_STEP(R,C,'FX') = SUM(T,%SWP%CST_DAM(%SW1%R,T,C)*COEF_PVT(R,T)); +* Complete also reporting of discounted costs + %SWP%REG_WOBJ(%SW1%R,'DAM',CUR) = SUM(RXX(R,T,C)$((NOT DAM_ELAST(R,C,'N'))$DAM_STEP(R,C,'FX')),OBJ_PVT(R,T,CUR)*%SWP%DAM_OBJ(%SW1%R,T,C,CUR)); + %SWP%REG_WOBJ(%SW1%R,'DAS',CUR) = SUM(RXX(R,T,C)$(DAM_ELAST(R,C,'N')$DAM_STEP(R,C,'FX')),OBJ_PVT(R,T,CUR)*%SWP%DAM_OBJ(%SW1%R,T,C,CUR)); + %SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR) = %SWP%REG_WOBJ(%SW1%R,'DAM',CUR)+%SWP%REG_WOBJ(%SW1%R,'DAS',CUR); + %SWP%REG_WOBJ(%SW1%R,'DAM',CUR) = (%SWP%REG_WOBJ(%SW1%R,'DAM',CUR)/%SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR)*%VAR%_OBJ.L(R,'OBJDAM',CUR%SOW%))$(%SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR) GT 0); + %SWP%REG_WOBJ(%SW1%R,'DAS',CUR) = %VAR%_OBJ.L(R,'OBJDAM',CUR%SOW%) - %SWP%REG_WOBJ(%SW1%R,'DAM',CUR); +* Complete also reporting of discounted external damages + %SWP%REG_WOBJ(%SW1%R,'DAM-EXT+',CUR) = SUM(RXX(R,T,C),OBJ_PVT(R,T,CUR)*%SWP%DAM_OBJ(%SW1%R,T,C,CUR)) - %VAR%_OBJ.L(R,'OBJDAM',CUR%SOW%); +* Weighted results +$IF %STAGES%%SCUM%==YES REG_WOBJ(R,DAMOBJ,CUR) = SUM(W,SW_PROB(W)*SREG_WOBJ(W,R,DAMOBJ,CUR)); diff --git a/rpt_ext.cli b/rpt_ext.cli new file mode 100644 index 0000000..7023744 --- /dev/null +++ b/rpt_ext.cli @@ -0,0 +1,53 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* RPT_EXT.cli - Extension for Climate Module: Stochastic report +*----------------------------------------------------------------------------- +* Questions/Comments: +* +*----------------------------------------------------------------------------- +* Calculate Reporting parameters for Climate Module + +*----------------------------------------------------------------------------- +$IFI %SENSIS%==YES $EXIT +$%SW_NOTAGS% +*----------------------------------------------------------------------------- +EQUATIONS + %EQ%_CLITOT(CM_VAR,T,LL %SWD%) 'Balances for the total emissions or forcing' + %EQ%_CLIMAX(ALLYEAR,CM_VAR %SWD%) 'Constraint for maximum climate quantities' +; + +VARIABLES + %VAR%_CLITOT(CM_VAR,LL %SWD%) 'Total emissions or forcing by milestone year' +POSITIVE VARIABLES + %VAR%_CLIBOX(CM_VAR,LL %SWD%) 'Quantities in the climate reservoirs' +; +*----------------------------------------------------------------------------- +$IF %STAGES%==YES $%SW_TAGS% SET SWSW SW_TSW(SOW,T,WW), +$IF %SCUM%==1 $SET SWSW 'SW_T(T,WW),' SET SCUM *SW_TPROB(T,WW) + +* Results for each SOW +$IF NOT %STAGES%==YES LOOP(SOW, +$IF %STAGES%==YES LOOP(AUXSOW(SOW)$SW_PROB(SOW), +* Clear results from previous SOW +$IF NOT %STAGES%==YES $GOTO REPORT + OPTION CLEAR=VAR_CLITOT,CLEAR=VAR_CLIBOX; + OPTION CLEAR=EQ_CLITOT, CLEAR=EQ_CLIMAX; + LOOP(SUPERYR(T,LL)$CM_LED(LL), + VAR_CLITOT.L(CM_VAR,LL) $= SUM(%SWSW% %VAR%_CLITOT.L(CM_VAR,LL%SWD%)%SCUM%); + VAR_CLIBOX.L(CM_VAR,LL) $= SUM(%SWSW% %VAR%_CLIBOX.L(CM_VAR,LL%SWD%)%SCUM%); +$IF %STAGES%%SCUM%==YES VAR_CLIBOX.L(CM_VAR,LL) $= %VAR%_CLIBOX.L(CM_VAR,LL,SOW); + EQ_CLIMAX.M(LL,CM_VAR) $= SUM(%SWSW% %EQ%_CLIMAX.M(LL,CM_VAR%SWD%)*SW_UNPB(T,WW))); + EQ_CLITOT.M(CM_VAR,T,T) $= SUM(%SWSW% %EQ%_CLITOT.M(CM_VAR,T,T%SWD%)*SW_UNPB(T,WW)); +$LABEL REPORT BATINCLUDE rpt_par.cli + ); +IF(CARD(SOW)=1,DISPLAY CM_RESULT,CM_MAXC_M; ELSE DISPLAY CM_SRESULT,CM_SMAXC_M); +*----------------------------------------------------------------------------- +$IF NOT %STAGES%==YES $EXIT +* Expected marginals + LOOP(SUPERYR(T,LL)$CM_LED(LL), + EQ_CLIMAX.M(LL,CM_VAR) $= SUM(SW_T(T,W),%EQ%_CLIMAX.M(LL,CM_VAR,W)); + VAR_CLITOT.L(CM_VAR,LL) $= SUM(SW_T(T,W),SW_TPROB(T,W)*%VAR%_CLITOT.L(CM_VAR,LL,W)); + VAR_CLIBOX.L(CM_VAR,LL) $= SUM(SW_T(T,W),SW_TPROB(T,W)*%VAR%_CLIBOX.L(CM_VAR,LL,W))); diff --git a/rpt_ext.ecb b/rpt_ext.ecb new file mode 100644 index 0000000..b4ce936 --- /dev/null +++ b/rpt_ext.ecb @@ -0,0 +1,70 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* RPT_EXT.ecb - Extension for the Market Sharing Mechanism (economic choices) +*----------------------------------------------------------------------------- +$ IF NOT DEFINED RTC_MS $EXIT +*----------------------------------------------------------------------------- + OPTION RVP < COEF_LMS, CLEAR=OBJ_SUMSI; + OBJ_SUMSI(RTP(R,T,P),V)$RVPT(R,V,P,T) = YES; + OBJ_SUMSI(RTP(R,T,P),T)$(COEF_CPT(R,T,T,P)>0) = YES; +* Existence flags + PAR_TOP(RVP(R,T,P),C,'OUT')$COEF_LMS(R,T,C,P) = SUM((OBJ_SUMSI(RVP,V),PRC_TS(R,P,S)),PAR_NCAPL(R,V,P)*PAR_FLO(R,V,T,P,C,S)>0); + PAR_TOP(RVP(R,T,P),C,IO)$PAR_TOP(RVP,C,IO) = SUM(OBJ_SUMSI(RVP,V),PAR_NCAPL(R,V,P)*PRC_CAPACT(R,P)*POWER(COEF_CPT(R,V,T,P),0.5$(DIAG(V,T)-1)))/VAR_XCAP.L(R,T,C)+EPS; +* Implied utilization factors + PASTSUM(RVP(R,T,P))$PAR_CAPL(RVP) = (PAR_CAPL(RVP)+SUM(PASTCV,PAR_PASTI(R,T,P,PASTCV)))*PRC_CAPACT(R,P)+1-1; + PASTSUM(NCAP_YES(RVP(R,V,P))) = + (SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*SUM(RPCS_VAR(RPC_PG(R,P,C),S),PAR_FLO(R,V,T,P,C,S))) / SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*VAR_NCAP.L(RVP)*COEF_CPT(R,V,T,P)*PRC_CAPACT(R,P)))$PRC_VINT(R,P) + + (SUM(RTP_CPTYR(R,V,T,P)$PASTSUM(R,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)/PASTSUM(R,T,P)*SUM(RPCS_VAR(RPC_PG(R,P,C),S),PAR_FLO(R,T,T,P,C,S))) / SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)))$(NOT PRC_VINT(R,P)); + PASTSUM(RVP)$((PASTSUM(RVP)=0)$PASTSUM(RVP)) = 0; +* Calculate INV unit cost annuity and intangibles + COEF_RTP(RVP(R,T,P)) = + SUM(OBJ_ICUR(RVP,CUR),SUM(OBJ_SUMII(RVP,LIFE,K_EOH,JOT),%CAPJD% OBJ_CRF(RVP,CUR) / OBJ_DIVI(RVP) * SUM(INVSPRED(K_EOH,JOT,Y,K),OBJ_ICOST(R,K,P,CUR)))); + NCAP_MSPRF(R,T,C,P,'FX')$COEF_LMS(R,T,C,P) = NCAP_MSPRF(R,T,C,P,'LO')*SUM(OBJ_SUMSI(R,T,P,V)$PASTSUM(R,V,P),COEF_RTP(R,V,P)/PRC_CAPACT(R,P)/PASTSUM(R,V,P)); +* Map LEC(v) and IUF(v) to t + ECB_NCAPR(RVP)$PASTSUM(RVP)$=PAR_NCAPR(RVP,'LEVCOST'); + PAR_NCAPR(RVP(R,T,P),'LEVCOST') = SUM(OBJ_SUMSI(RVP,V),PAR_NCAPR(R,V,P,'LEVCOST')); + PASTSUM(RVP(R,T,P)) = SUM(OBJ_SUMSI(RVP,V),PASTSUM(R,V,P)); + OPTION CLEAR=RVP,CLEAR=COEF_RTP; +*----------------------------------------------------------------------------- +* Calculate logit market shares + LOOP(RTC_MS(RTC(R,T,C)), Z = -ABS(COM_MSHGV(RTC)); OPTION CLEAR=PRC_YMIN; +* Get weights for shares and their sum + PRC_YMIN(R,P)$PAR_TOP(R,T,P,C,'OUT') = (NCAP_MSPRF(RTC,P,'N')/PASTSUM(R,T,P))*((PAR_NCAPR(R,T,P,'LEVCOST')+NCAP_MSPRF(RTC,P,'FX'))**Z)$(PAR_NCAPR(R,T,P,'LEVCOST')>1E-3); + F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); + IF(F>0, +* Get initial shares and their Max + PRC_YMIN(R,P)$PRC_YMIN(R,P)=(PRC_YMIN(R,P)/F); + F = SMAX(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); + MY_F=SMAX(P$PRC_YMIN(R,P),PAR_TOP(R,T,P,C,'OUT')); +* Adjust shares, normalize, and get sum over cutoff + PRC_YMIN(R,P)$((PRC_YMIN(R,P)>.05)$PRC_YMIN(R,P)) = MAX(PRC_YMIN(R,P),PAR_TOP(R,T,P,C,'OUT')/MY_F*F); + F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); + PRC_YMIN(R,P)$PRC_YMIN(R,P)=(PRC_YMIN(R,P)/F)$(PRC_YMIN(R,P)/F>.005); + F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P))*.9999; +* Get MY_F = Max share, and Z = sum of differences from max + MY_F = SMAX(P$PRC_YMIN(R,P),PRC_YMIN(R,P)); Z = SUM(P$PRC_YMIN(R,P),MY_F-PRC_YMIN(R,P)); + IF(Z, CNT=1; ELSE CNT=F); +* Final normalized share values: V0i+(MAX0-V0i)*(1-SUM0)/DIFSUM + COEF_LMS(RTC,P)$COEF_LMS(RTC,P) = PRC_YMIN(R,P)/CNT+((MY_F-PRC_YMIN(R,P))*(1-F)/Z)$PRC_YMIN(R,P)$Z; + ELSE COEF_LMS(RTC,P)$COEF_LMS(RTC,P)=0)); + OPTION CLEAR=PRC_YMIN,CLEAR=OBJ_SUMSI,CLEAR=PASTSUM,CLEAR=PAR_TOP; +*----------------------------------------------------------------------------- +* Reports clear + OPTION CLEAR=REG_WOBJ, CLEAR=REG_IREC, CLEAR=REG_ACOST, CLEAR=CAP_NEW, CLEAR=PAR_EOUT, CLEAR=F_IN, CLEAR=F_OUT, CLEAR=P_OUT, CLEAR=AGG_OUT; + OPTION CLEAR=PAR_ACTL, CLEAR=PAR_ACTM, CLEAR=PAR_PASTI, CLEAR=PAR_CAPL, CLEAR=PAR_CAPM, CLEAR=PAR_CAPLO, CLEAR=PAR_CAPUP, CLEAR=PAR_NCAPL, CLEAR=PAR_NCAPM, CLEAR=PAR_NCAPR, CLEAR=PAR_OBJSAL; + OPTION CLEAR=PAR_COMPRDL, CLEAR=PAR_COMPRDM, CLEAR=PAR_COMNETL, CLEAR=PAR_COMNETM, CLEAR=PAR_COMBALEM, CLEAR=PAR_COMBALGM, CLEAR=PAR_IPRIC, CLEAR=PAR_PEAKM; + OPTION CLEAR=PAR_UCSL, CLEAR=PAR_UCSM, CLEAR=PAR_CUMFLOL, CLEAR=PAR_CUMFLOM, CLEAR=PAR_CUMCST, CLEAR=PAR_UCMRK, CLEAR=PAR_UCRTP, CLEAR=PAR_UCMAX; + OPTION CLEAR=CST_INVC, CLEAR=CST_INVX, CLEAR=CST_DECC, CLEAR=CST_FIXC, CLEAR=CST_FIXX, CLEAR=CST_ACTC, CLEAR=CST_FLOC, CLEAR=CST_FLOX, CLEAR=CST_IREC, CLEAR=CST_COMC, CLEAR=CST_COMX, CLEAR=CST_COME, CLEAR=CST_SALV, CLEAR=CST_TIME; +*----------------------------------------------------------------------------- + F = RPT_OPT('NCAP','101'); IF(F,RPT_OPT('NCAP','1') = ROUND(F)); +$ IF PARTYPE DOITER DOITER=NA; +$ IFI %MACRO%==MLF $EXIT +* Resolve model + OPTION SOLVEOPT=MERGE; +$ BATINCLUDE solve.mod +$ SET SOLVEDA 1 +$ BATINCLUDE rptlite.rpt '' '' '' NO + PAR_NCAPR(RTP,'COST')$=ECB_NCAPR(RTP); diff --git a/rpt_ext.ier b/rpt_ext.ier new file mode 100644 index 0000000..e2d1106 --- /dev/null +++ b/rpt_ext.ier @@ -0,0 +1,50 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================= +* CHP reporting for the IER extension +*============================================================================= +$IF %STAGES%==YES $EXIT +$IF %VDA%==YES $SET SOW ,'0' + PARAMETER PAR_BPTL(R,T,P); + PARAMETER PAR_BPTM(R,T,P); + PARAMETER PAR_CONDL(R,T,P) //; + PARAMETER PAR_CONDM(R,T,P) //; + PARAMETER PAR_HEATL(R,T,P) //; + PARAMETER PAR_HEATM(R,T,P) //; + PARAMETER ELE_CONDL(R,YEAR,YEAR,P,C,S) //; + PARAMETER ELE_CONDM(R,YEAR,YEAR,P,C,S) //; + PARAMETER ELE_BPTL(R,YEAR,YEAR,P,C,TS) //; + PARAMETER ELE_BPTM(R,YEAR,YEAR,P,C,TS) //; + +* PAR_ACTL(R,V,T,P,S)$ECT_CHP(R,P) $= PAR_ACTL(R,V,T,P,S)*ECT_INP2ELC(R,V,P); +* PAR_ACTM(R,V,T,P,S)$(PAR_ACTM(R,V,T,P,S)$ECT_CHP(R,P)) $= PAR_ACTM(R,V,T,P,S)/ECT_INP2ELC(R,V,P); + +*--------------------------------------------------------------------- +* Output of VAR_CAP +*--------------------------------------------------------------------- + + PAR_BPTL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2ELC(R,V,P)*COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); + PAR_BPTM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P)/ECT_INP2ELC(R,V,P)* ((VAR_NCAP.M(R,V,P)/VDA_DISC(R,V))$T(V))); + + PAR_CAPL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2ELC(R,V,P) * COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); + PAR_PASTI(RTP(R,T,P)%SOW%)$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2ELC(R,V,P) * COEF_CPT(R,V,T,P) * NCAP_PASTI(R,V,P)); + PAR_CAPM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P) /ECT_INP2ELC(R,V,P)* ((VAR_NCAP.M(R,V,P)/VDA_DISC(R,V))$T(V))); + + PAR_NCAPL(RTP(R,V,P))$ECT_CHP(R,P) = VAR_NCAP.L(R,V,P) * ECT_INP2ELC(R,V,P); + PAR_NCAPM(RTP(R,T,P))$ECT_CHP(R,P) = (VAR_NCAP.M(R,T,P) / ECT_INP2ELC(R,T,P)/COEF_OBJINV(R,T,P))$COEF_OBJINV(R,T,P); + +*--------------------------------------------------------------------- +* ONLY for extraction condensing CHP plants +*--------------------------------------------------------------------- + + PAR_CONDL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2CON(R,V,P)*COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); + PAR_CONDM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P)/ECT_INP2CON(R,V,P) * (VAR_NCAP.M(R,V,P)$T(V))); + PAR_HEATL(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), ECT_INP2DHT(R,V,P)*COEF_CPT(R,V,T,P) * (VAR_NCAP.L(R,V,P)$T(V) + NCAP_PASTI(R,V,P))); + PAR_HEATM(RTP(R,T,P))$ECT_CHP(R,P) = SUM(RTP_CPTYR(R,V,T,P), COEF_CPT(R,V,T,P)/ECT_INP2DHT(R,V,P) * (VAR_NCAP.M(R,V,P)$T(V))); + + ELE_BPTL(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) $= SUM(ECT_DHT(R,P,COM), ECT_REH(R,V,P)*VAR_FLO.L(R,V,T,P,COM,TS)); + ELE_BPTM(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) $= SUM(ECT_DHT(R,P,COM), VAR_FLO.M(R,V,T,P,COM,TS)/ECT_REH(R,V,P)); + ELE_CONDL(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) = VAR_FLO.L(R,V,T,P,C,TS) - SUM(ECT_DHT(R,P,COM), ECT_REH(R,V,P)*VAR_FLO.L(R,V,T,P,COM,TS)); + ELE_CONDM(RTP_VINTYR(R,V,T,P),C,TS)$(RTPCS_VARF(R,T,P,C,TS)$ECT_ELC(R,P,C)) = VAR_FLO.M(R,V,T,P,C,TS) - SUM(ECT_DHT(R,P,COM), VAR_FLO.M(R,V,T,P,COM,TS)/ECT_REH(R,V,P)); diff --git a/rpt_ext.mlf b/rpt_ext.mlf new file mode 100644 index 0000000..f6405ab --- /dev/null +++ b/rpt_ext.mlf @@ -0,0 +1,113 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* RPT_EXT.mlf - Extension for MACRO MLF: Negishi iteration and reporting +*----------------------------------------------------------------------------- +* Common reporting parameter declarations +$ SET SOLVEDA 1 +$ BATINCLUDE rptlite.rpt +* Scenario index not supported in current version, use SOW 1 + SET SOW / 1 /; +*----------------------------------------------------------------------- +$ SET METHOD LP +$ IFI %NONLP%==NL $SET METHOD NLP + DOITER=1-INF$(DOITER=NA); + LOOP(NITER$DOITER, +* Perform Negishi iterations with tax rebate +*----------------------------------------------------------------------- +* Calculation of annual costs and commodity marginals + OPTION CLEAR=PAR_FLO,CLEAR=PAR_IRE; +$ BATINCLUDE sol_flo.red PAR_FLO '' .L +$ BATINCLUDE sol_ire.rpt + OPTION CLEAR=CST_PVP,CLEAR=CST_ACTC,CLEAR=CST_INVC,CLEAR=CST_INVX,CLEAR=CST_FIXC,CLEAR=CST_FIXX; + OPTION CLEAR=CAP_NEW,CLEAR=CST_FLOC,CLEAR=CST_FLOX,CLEAR=CST_COMC,CLEAR=CST_COMX,CLEAR=CST_IREC; +$ SET TIMESED NO +$ BATINCLUDE rpt_obj.rpt '' "" '' '%SYSPREFIX%' 0 +$ BATINCLUDE cost_ann.rpt +*----------------------------------------------------------------------- +* Calculate new Negishi weights + IF(CARD(MR)-MIN(0,DOITER), + TM_NWTIT(NITER,MR) = TM_NWT(MR); + LOOP(TB(T-1), MY_ARRAY(PP) = ABS(EQ_TRDBAL.M(PP)/EQ_TRDBAL.M(T))); + TM_NWT(MR(R)) = SUM(PP, MY_ARRAY(PP)*(VAR_C.L(R,PP)+VAR_NTX.L(R,PP))); + TM_NWT(MR) = TM_NWT(MR) / SUM(REG, TM_NWT(REG)); + IF(CARD(MR)=1, Z=0; ELSE Z = SUM(MR, ABS(TM_NWTIT(NITER,MR)-TM_NWT(MR)))); + F=TM_DEFVAL('NEGTOL'); IF(ORD(NITER)=1, F=F*(1+LOG(10**.1)) ELSE F=ABS(F)); +* Calculate rebate of tax revenues + RB(MR(R),T)=TM_TAXREV(R,T); + TM_TAXREV(MR(R),PP(T)) = REG_ACOST(R,T,'INVX')+REG_ACOST(R,T,'FIXX')+REG_ACOST(R,T,'VARX'); + DFUNC = SMAX(MR(R),TM_SCALE_CST*SUM(PP(T),COEF_PVT(R,T)*ABS(TM_TAXREV(R,T)-RB(R,T)))/SUM(PP(T),COEF_PVT(R,T)*VAR_EC.L(R,T)*TM_HDF(R,T))); + DISPLAY "Negishi Tolerance, Negishi Gap, Tax Gap:",F,Z,DFUNC; + DOITER=(MAX(Z,DFUNC)>=F+MIN(0,DOITER)); + IF(DOITER, SOLVE %MODEL_NAME% MAXIMIZING VAR_UTIL USING %METHOD%) + ELSE DOITER=0)); + +*----------------------------------------------------------------------- +* Calculation of undiscounted shadow prices in MACRO +*----------------------------------------------------------------------- + PARAMETER VDA_DISC(R,ALLYEAR) //; + VDA_DISC(MR,T) = ABS(-EQ_ENSCST.M(MR,T) * TM_SCALE_CST); + LOOP(MIYR_1(TT(T-1)),VDA_DISC(R,TT)$(VDA_DISC(R,TT) LE 0) = COEF_PVT(R,TT)/COEF_PVT(R,T)*VDA_DISC(R,T)); + VAR_OBJ.L(R,OBV(OBVANN),CUR)=0; +* Trade prices and implied costs/revenues + PAR_IPRIC(MR(R),PP(T),P,C,TS,IE)$PAR_IPRIC(R,T,P,C,TS,IE) = -PAR_IPRIC(R,T,P,C,TS,IE)*COEF_PVT(R,T)/VDA_DISC(R,T); + CST_IREC(RTP_VINTYR(MR(R),V,PP(T),P),C)$(RPC(R,P,C)$RP_IRE(R,P)) $= + SUM((RTPCS_VARF(R,T,P,C,S),RPC_IREIO(R,P,C,IE,'IN')),PAR_IPRIC(R,T,P,C,S,IE)*PAR_IRE(R,V,T,P,C,S,IE)); + REG_ACOST(MR(R),PP(T),'IRE') = SUM((VNT(V,T),P,C)$CST_IREC(R,V,T,P,C),CST_IREC(R,V,T,P,C)); + +*----------------------------------------------------------------------- +* Miscellaneous reportings +$ BATINCLUDE sol_flo.red PAR_FLO M .M + TM_UDF(R,T)=COEF_PVT(R,T); + COEF_PVT(MR,T) = -VDA_DISC(MR,T); +$ BATINCLUDE rptmisc.rpt '' '' + VAR_UTIL.UP = INF; + PAR_NCAPM(RTP(R,T,P))$(VAR_NCAP.M(RTP)*COEF_OBJINV(RTP)) = VAR_NCAP.M(RTP)*TM_UDF(R,T)/COEF_PVT(R,T)/COEF_OBJINV(RTP); + +*----------------------------------------------------------------------- +* Discounted objective values by cost type(INV, FIX, VAR etc.) +*----------------------------------------------------------------------- +* Discounted objective value by region + REG_WOBJ(R,'INV',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'INV')); + REG_WOBJ(R,'INVX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'INVX')); + REG_WOBJ(R,'FIX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'FIX')); + REG_WOBJ(R,'FIXX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'FIXX')); + REG_WOBJ(R,'VAR',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'VAR')); + REG_WOBJ(R,'VARX',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'VARX')); + REG_WOBJ(R,'ELS',CUR) = SUM(T, OBJ_PVT(R,T,CUR)*REG_ACOST(R,T,'ELS')); +$IF DEFINED DAM_COST REG_WOBJ(R,'DAM',CUR) = VAR_OBJ.L(R,'OBJDAM',CUR); + REG_IREC(R) = SUM(T,TM_UDF(R,T)*REG_ACOST(R,T,'IRE')); + REG_OBJ(R) = SUM((ITEM,RDCUR(R,CUR))$REG_WOBJ(R,ITEM,CUR), REG_WOBJ(R,ITEM,CUR)); + OBJz.L = SUM(R,REG_OBJ(R)); + +*--------------------------------------------------------------------- +* Shadow prices of user constraints +*--------------------------------------------------------------------- +* Note: undiscounting only done for user constraints having region and period as index +$ IF %VAR_UC%==YES $GOTO UC_DONE +$ BATINCLUDE par_uc.rpt SM EQE +$ BATINCLUDE par_uc.rpt SM EQG +$ BATINCLUDE par_uc.rpt SM EQL +$ LABEL UC_DONE + +OPTION CLEAR=F_INOUT, CLEAR=F_INOUTS, CLEAR=F_IOSET; + +*--------------------------------------------------------------------- +* Report parameters for TIMES-MACRO +*--------------------------------------------------------------------- + + PAR_Y(MR(R),T(TB)) = TM_Y0(R); PAR_Y(MR(R),PP(T)) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_EC.L(R,T) + VAR_NTX.L(R,T); + TM_GDP(MR(R),T(TB)) = TM_GDP0(R); TM_GDP(MR(R),PP(T)) = VAR_C.L(R,T) + VAR_INV.L(R,T) + VAR_NTX.L(R,T); + +* Reporting parameters + TM_RESULT('TM_GDP-REF',MR,T) = TM_GDPGOAL(MR,T); + TM_RESULT('TM_GDP-ACT',MR,T) = TM_GDP(MR,T); + TM_RESULT('TM_PRD-Y',MR,T) = PAR_Y(MR,T); + TM_RESULT('TM_CON-C',MR,T) = VAR_C.L(MR,T); + TM_RESULT('TM_CAP-K',MR,T) = VAR_K.L(MR,T); + TM_RESULT('TM_INV-I',MR,T) = VAR_INV.L(MR,T); + TM_RESULT('TM_ESCOST',MR,T) = VAR_EC.L(MR,T); + TM_RESULT('TM_GDPLOS',MR,T) = 100*(TM_GDPGOAL(MR,T)-TM_GDP(MR,T))/TM_GDPGOAL(MR,T); + DISPLAY TM_RESULT; \ No newline at end of file diff --git a/rpt_ext.msa b/rpt_ext.msa new file mode 100644 index 0000000..c33b86c --- /dev/null +++ b/rpt_ext.msa @@ -0,0 +1,63 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* RPT_EXT.msa - Extension for MACRO Stand-Alone link: soft-link driver +*----------------------------------------------------------------------------- +* Questions/Comments: +* +*----------------------------------------------------------------------------- + SET MACST / VAR, IRE, DAM /; + LOOP(T,MR(R)$(REG_FIXT(R) LT YEARVAL(T)) = YES); + MR(R)$(NOT SUM(ALLYEAR$TM_GR(R,ALLYEAR),YES)) = NO; + MREG(MR) = YES; +*----------------------------------------------------------------------------- +$ SET SOLVEDA 1 +$ BATINCLUDE rptlite.rpt +$ SET SOLVEDA 0 +$ BATINCLUDE solprep.msa INIT 0 +$ IF %RPOINT%==NO $GOTO PREPRO + %MODEL_NAME%.OPTFILE = 1; +$ BATINCLUDE pp_clean.mod +$ IF SET FIXBOH $BATINCLUDE solve.stp mod +$ LABEL PREPRO +*----------------------------------------------------------------------------- +* Process macro parameters + TM_DEPR(R)$(NOT TM_DEPR(R)) = TM_DEFVAL('DEPR'); + TM_ESUB(R)$(NOT TM_ESUB(R)) = TM_DEFVAL('ESUB'); + TM_KGDP(R)$(NOT TM_KGDP(R)) = TM_DEFVAL('KGDP'); + TM_KPVS(R)$(NOT TM_KPVS(R)) = TM_DEFVAL('KPVS'); + TM_DMTOL(R)$(NOT TM_DMTOL(R)) = TM_DEFVAL('DMTOL'); + TM_IVETOL(R)$(NOT TM_IVETOL(R)) = TM_DEFVAL('IVETOL'); + + IF(CARD(TM_GROWV)=0, TM_GROWV(R,T) $= TM_GR(R,T)); +$IFI %MSA%==CSA TM_AMP(MR,T) = MAX(0,SMAX(PP(TT)$(ORD(TT)>ORD(T)),TM_ANNC(MR,TT)/(TM_GDPGOAL(MR,TT)/TM_GDPGOAL(MR,T))*POWER(TM_DEFVAL('ESC'),YEARVAL(T)-YEARVAL(TT)))-TM_ANNC(MR,T)); + OPTION DEM < TM_DEM; + OPTION MRTC < TM_DEM; + IF(CARD(TM_DDF) = 0, TM_DDF(MRTC) = EPS); + VAR_NTX.FX(MR,TP,TRD) = EPS; TRD(MACST) = NO; + +*----------------------------------------------------------------------------- +$ BATINCLUDE solvcoef.msa +*----------------------------------------------------------------------------- +* Complete BEOH parameters for damage + LOOP(TLAST(T), F=E(T); CNT=TM_PWT(T)/D(T)); + LOOP((XTP(YEAR),SUPERYR(TLAST,LL(YEAR-CM_LED(YEAR)))),Z=CM_LED(XTP)/2; MY_F=YEARVAL(LL); + IF(MY_F>F,TM_PWT(LL)=CNT*(MY_F-F+Z); F=MY_F+Z); TM_PWT(XTP)=CNT*CEIL(YEARVAL(XTP)-F); + TM_UDF(R,XTP) = TM_UDF(R,LL) * TM_DFACTCURR(R,LL)**(2*Z)); + Z=SUM(TLAST(T),B(T)+TM_ARBM*D(T)); TM_XWT(R,XTP)$(CM_LED(XTP)>0)=(MIN(YEARVAL(XTP),Z)-MIN(YEARVAL(XTP)-CM_LED(XTP),Z))/CM_LED(XTP)*TM_PWT(XTP)*TM_UDF(R,XTP); + LOOP(PP(T),TM_XWT(MR(R),XTP)$SUPERYR(T,XTP)=TM_XWT(R,XTP)/SUM(SUPERYR(T,LL)$XTP(LL),TM_XWT(R,LL))); +*----------------------------------------------------------------------------- +$ BATINCLUDE solve.msa +*----------------------------------------------------------------------------- + +* Reporting parameters + TM_RESULT('TM_GDP-REF',MR,T) = TM_GDPGOAL(MR,T); + TM_RESULT('TM_GDP-ACT',MR,T) = TM_GDP(MR,T); + TM_RESULT('TM_PRD-Y',MR,T) = VAR_Y.L(MR,T); + TM_RESULT('TM_CON-C',MR,T) = VAR_C.L(MR,T); + TM_RESULT('TM_INV-I',MR,T) = VAR_INV.L(MR,T); + TM_RESULT('TM_ESCOST',MR,T) = VAR_EC.L(MR,T); +$IFI %MSA%==MSA TM_RESULT('TM_GDPLOS',MR,T) = 100*(TM_GDPGOAL(MR,T)-TM_GDP(MR,T))/TM_GDPGOAL(MR,T); + DISPLAY TM_RESULT; \ No newline at end of file diff --git a/rpt_obj.rpt b/rpt_obj.rpt new file mode 100644 index 0000000..5a9d4c1 --- /dev/null +++ b/rpt_obj.rpt @@ -0,0 +1,145 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* RPT_OBJ.rpt is the objective function reporter for rptlite TIMES +* %1 - S OR '' +* %2 - SOW, or '1', OR '' +* %3 - ,SOW OR '' +*=============================================================================* + OPTION CLEAR=NCAP_YES,CLEAR=RTP_OBJ,CLEAR=RTP_NPV,CLEAR=RTP_CAPVL; + RTP_CAPVL(RTP)=VAR_NCAP.L(RTP)+NCAP_PASTI(RTP); + NCAP_YES(RTP)$(RTP_CAPVL(RTP)>0) = YES; + MY_F=ROUND(RPT_OPT('OBJ','1')); +$ SETLOCAL SIC '' SET TMP '' +$IFI '%STAGES%'==YES $SETLOCAL SIC "*(1+PASTSUM(R,V,P))" +$IFI '%STAGES%'==YES PASTSUM(NCAP_YES(R,T,P)) = SUM(SW_TSW(SOW,T,WW),OBJ_SIC(R,T,P,WW)); MY_F=EPS$MY_F; +*------------------------------------------------------------------------------ +* Hurdle rates + COEF_CRF(OBJ_ICUR(NCAP_YES(R,V,P),CUR))$(NCAP_DRATE(R,V,P)>0) = MAX(0,1- + ((1-(1+NCAP_DRATE(R,V,P))**(-NCAP_ELIFE(R,V,P))) / (1-(1+OBJ_RFR(R,V,CUR))**(-NCAP_ELIFE(R,V,P)))) / + (NCAP_DRATE(R,V,P)/OBJ_RFR(R,V,CUR)*((1+NCAP_DRATE(R,V,P))/(1+OBJ_RFR(R,V,CUR)))**MIN(%DISCSHIFT%-1,-0.5$NCAP_ILED(R,V,P)))); +*------------------------------------------------------------------------------ +* Lump-sum investment costs +*------------------------------------------------------------------------------ +$SET P1 "'%SYSPREFIX%INSTCAP'" + %1CAP_NEW(%2RVPT(NCAP_YES(R,T,P),TT),%P1%) = VAR_NCAP.L(R,T,P); + %1CAP_NEW(%2NCAP_YES(R,T,P),T,%P1%)$(NOT OBJ_2A(R,T,P)) = COEF_RPTI(R,T,P)*VAR_NCAP.L(R,T,P); + OPTION CLEAR=UNCD1; UNCD1(J)$(ORD(J)<3)=YES; + RTP_OBJ(JJ(UNCD1(J)),OBJ_ICUR(NCAP_YES(R,T(V),P),CUR))= +$IF '%ETL%'==YES (VAR_IC.L(R,T,P)*COR_SALVI(R,T,P,CUR))$SEG(R,P) + + SUM((OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT),INVSPRED(K_EOH,JOT,Y,K)), + (OBJ_ICOST(R,K,P,CUR)%SIC%$(ORD(J)=2)+(OBJ_ITAX(R,K,P,CUR)-OBJ_ISUB(R,K,P,CUR))$(ORD(J)=1))) * + VAR_NCAP.L(R,T,P) * COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) / + (1+G_DRATE(R,T,CUR))**(%DISCSHIFT%$(NOT NCAP_ILED(R,T,P))); + SYSPLIT(SYSUC)=1-SUM(SYSUCMAP(SYSUC,ITEM),1); + LOOP(UNCD1(J),%1CAP_NEW(%2R,T,P,TT,SYSUC)$(%1CAP_NEW(%2R,T,P,TT,%P1%)$SUCMAP(J,SYSUC))=SUM(RDCUR(R,CUR),RTP_OBJ(J,R,T,P,CUR)*ABS(SYSPLIT(SYSUC)-COEF_CRF(R,T,P,CUR))) + IF(NOT MY_F,OPTION CLEAR=COEF_CRF)); + OPTION CLEAR=RTP_OBJ; +*----------------------------------------------------------------------------- +* Objective function by component +*----------------------------------------------------------------------------- +* Check objective INV + RTP_OBJ('1',OBJ_ICUR(NCAP_YES(R,V,P),CUR)) = + SUM(OBJ_SUMII(R,V,P,AGE,K_EOH,JOT), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,YEAR,K), OBJ_DISC(R,K,CUR) * (1-SALV_INV(R,V,P,YEAR)) * OBJ_ICOST(R,K,P,CUR)) * + (VAR_NCAP.L(R,V,P)$T(V) + OBJ_PASTI(R,V,P,CUR))%SIC% * COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)) + + SUM(OBJ_SUMIII(R,V,P,LL,K,Y), OBJ_DISC(R,Y,CUR) * (1-SALV_INV(R,V,P,LL)) * + (VAR_NCAP.L(R,V,P)$T(V) + OBJ_PASTI(R,V,P,CUR)) / OBJ_DIVIII(R,V,P) * + (COR_SALVD(R,V,P,CUR)*OBJ_DCOST(R,K,P,CUR)-SUM(C$NCAP_OCOM(R,V,P,C),NCAP_OCOM(R,V,P,C)*NCAP_VALU(R,K,P,C,CUR))$(NOT Y_EOH(Y)))) - + SUM(OBJ_SUMIVS(R,V,P,K,Y),OBJ_DISC(R,Y,CUR)*SALV_INV(R,V,P,K)*OBJ_DLAGC(R,K,P,CUR)*RTP_CAPVL(R,V,P)); + +* Discounted taxes & subsidies + RTP_OBJ('2',OBJ_ICUR(NCAP_YES(R,V,P),CUR)) = + SUM(OBJ_SUMII(R,V,P,AGE,K_EOH,JOT), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,YEAR,K), OBJ_DISC(R,K,CUR) * (1-SALV_INV(R,V,P,YEAR)) * + (OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR))) * + (VAR_NCAP.L(R,V,P)$T(V) + OBJ_PASTI(R,V,P,CUR)) * COR_SALVI(R,V,P,CUR) / OBJ_DIVI(R,V,P)); + +$IF NOT DEFINED VNRET $GOTO ISUM + VAR_SCAP.L(R,T,'0',P)$(NCAP_FDR(R,T,P)$RVPRL(R,'0',P)$RVPRL(R,T,P)) = RTP_CAPVL(R,T,P); + PAR_OBJCAP(OBJ_ICUR(NCAP_YES(R,V,P),CUR))$RVPRL(R,V,P)=OBJSCC(R,V,P,CUR)*OBJ_DCEOH(R,CUR)*(RTP_CAPVL(R,V,P)-VAR_SCAP.L(R,V,'0',P))$OBJ_SUMS(R,V,P); + RTP_OBJ('1',R,V,P,CUR)$PAR_OBJCAP(R,V,P,CUR) = RTP_OBJ('1',R,V,P,CUR)+PAR_OBJCAP(R,V,P,CUR)*(1-(1/(1+RTP_OBJ('1',R,V,P,CUR)/RTP_OBJ('2',R,V,P,CUR)))$(RTP_OBJ('2',R,V,P,CUR)>0)); + RTP_OBJ('2',R,V,P,CUR)$((RTP_OBJ('2',R,V,P,CUR)>0)$PAR_OBJCAP(R,V,P,CUR)) = RTP_OBJ('2',R,V,P,CUR)+PAR_OBJCAP(R,V,P,CUR)/(1+RTP_OBJ('1',R,V,P,CUR)/RTP_OBJ('2',R,V,P,CUR)); + RTP_ISHPR(RTP(R,V,P))$PRC_RCAP(R,P)=YES; +$ SET TMP (1-(VAR_SCAP.L(R,V,Y,P)/PASTSUM(R,V,P)/OBJ_DIVIV(R,V,P))$PRC_RCAP(R,P))* +$LABEL ISUM + + %1REG_WOBJ(%2R,'INVX',CUR) = SUM(OBJ_ICUR(NCAP_YES(R,V,P),CUR),RTP_OBJ('2',R,V,P,CUR)); + OBJVAL_1 = SUM(OBJ_ICUR(NCAP_YES(R,V,P),CUR),RTP_OBJ('1',R,V,P,CUR)) + SUM(RDCUR(R,CUR),%1REG_WOBJ(%2R,'INVX',CUR)); + OBJVAL_2 = SUM(RDCUR(R,CUR),SUM(OBV,SUM_OBJ('OBJINV',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%VAR%_OBJ.L(R,'OBJSAL',CUR%3)); +$IF NOT %1==S DISPLAY OBJVAL_1,OBJVAL_2; + + IF(MY_F, SYSINV('%4INV+')=YES); + IF(MY_F>0,OPTION TRACKP0,OPTION TRACKP0, + OPTION PAR_RPMX < PAR_ACTC; + %1CST_PVP(%2'%4ACT',RP) $= SUM((J,V,T,C,CUR)$PAR_RPMX(RP,J,V,T,C,CUR),PAR_RPMX(RP,J,V,T,C,CUR)); + OPTION PAR_RPMX < PAR_FLOC; + %1CST_PVP(%2'%4FLO',RP) $= SUM((J,V,T,C,CUR)$PAR_RPMX(RP,J,V,T,C,CUR),PAR_RPMX(RP,J,V,T,C,CUR)); + OPTION PAR_RCMX < PAR_COMC; + %1CST_PVC(%2'%4COM',RC) $= SUM((J,T,CUR)$PAR_RCMX(RC,J,T,CUR),PAR_RCMX(RC,J,T,CUR)); + ); + %1REG_WOBJ(%2R,'VARX',CUR) = SUM((V,T,P,C)$PAR_FLOC('2',R,V,T,P,C,CUR),PAR_FLOC('2',R,V,T,P,C,CUR)) + + SUM((T,C)$PAR_COMC('2',R,T,C,CUR),PAR_COMC('2',R,T,C,CUR)); +*------------------------------------------------------------------------------ + LOOP(RDCUR(R,CUR), + %1REG_WOBJ(%2R,'INV',CUR) = SUM(OBV,SUM_OBJ('OBJINV',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%VAR%_OBJ.L(R,'OBJSAL',CUR%3)-%1REG_WOBJ(%2R,'INVX',CUR)+EPS; + %1REG_WOBJ(%2R,'FIX',CUR) = SUM(OBV,SUM_OBJ('OBJFIX',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%1REG_WOBJ(%2R,'FIXX',CUR)+EPS; + %1REG_WOBJ(%2R,'VAR',CUR) = SUM(OBV,SUM_OBJ('OBJVAR',OBV)*%VAR%_OBJ.L(R,OBV,CUR%3))-%1REG_WOBJ(%2R,'VARX',CUR)+EPS; +* Elastic demand costs + %1REG_WOBJ(%2R,'ELS',CUR) = EPS +$IF %TIMESED% == YES +SUM(BD,%VAR%_OBJELS.L(R,BD,CUR%3)*(BDSIG(BD)-1$LNX(BD))) + ); +$IFI %5==0 $EXIT +*------------------------------------------------------------------------------ +* Calculate VAR_NCAP coefficients +$BATINCLUDE rpt_objc.rpt "%1" "%2" %4 diff --git a/rpt_objc.rpt b/rpt_objc.rpt new file mode 100644 index 0000000..7050734 --- /dev/null +++ b/rpt_objc.rpt @@ -0,0 +1,128 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* RPT_OBJC.rpt calculates the objective function coefficients for VAR_NCAP * +*=============================================================================* +* Remove any invalid marginals of OFFed technologies + VAR_NCAP.M(RTP_OFF(R,T,P)) = 0; CNT = RPT_OPT('NCAP','1'); +*------------------------------------------------------------------------------- +* Calculate the effect of a one unit of investment costs to the objective. + OPTION CLEAR=PAR_OBJCAP; + PAR_OBJCAP(OBJ_ICUR(R,T,P,CUR)) = COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * + SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,Y,K), (1-SALV_INV(R,T,P,Y)$OBJ_SUMS(R,T,P)) * OBJ_DISC(R,K,CUR))); +* If does not carry investment costs, just undiscount with most common inv. spread + LOOP(G_RCUR(R,CUR), MY_ARRAY(T)=SUM(PERDINV(T,Y),OBJ_DISC(R,Y,CUR))/LEAD(T); COEF_OBJINV(RTP(R,T,P))$PRC_CAP(R,P)=MY_ARRAY(T)); + COEF_OBJINV(RTP(R,T,P)) $= SUM(RDCUR(R,CUR)$PAR_OBJCAP(R,T,P,CUR),PAR_OBJCAP(R,T,P,CUR)); +*------------------------------------------------------------------------------- +$IF %STAGES%==YES $SET BENCOST NO +$IFI '%BENCOST%'==YES CNT = 1; +*------------------------------------------------------------------------------- +* Investment cost coefficient + OPTION CLEAR=PAR_OBJCAP; + IF(CNT, + PAR_OBJCAP(OBJ_ICUR(R,T,P,CUR)) = COR_SALVI(R,T,P,CUR) / OBJ_DIVI(R,T,P) * + SUM(OBJ_SUMII(R,T,P,LIFE,K_EOH,JOT), %CAPJD% + SUM(INVSPRED(K_EOH,JOT,Y,K), OBJ_DISC(R,K,CUR) * + (OBJ_ICOST(R,K,P,CUR) + OBJ_ITAX(R,K,P,CUR) - OBJ_ISUB(R,K,P,CUR) +$IFI %STAGES%==YES +SUM(SW_TSW(SOW,T,WW)$OBJ_SIC(R,T,P,WW),OBJ_SIC(R,T,P,WW)*OBJ_ICOST(R,K,P,CUR)*(1-SALV_INV(R,T,P,Y))) + ))); + +* Decommissioning costs + OPTION CLEAR=PAR_OBJSAL; + PAR_OBJSAL(RTP(R,T,P),CUR)$RDCUR(R,CUR) = COR_SALVD(R,T,P,CUR) / OBJ_DIVIII(R,T,P) * + SUM(OBJ_SUMIII(R,T,P,LL,K,Y)$OBJ_DCOST(R,T,P,CUR), OBJ_DISC(R,Y,CUR) * OBJ_DCOST(R,K,P,CUR)); + + PAR_OBJCAP(RTP(R,T,P),CUR)$PAR_OBJSAL(R,T,P,CUR) = PAR_OBJCAP(R,T,P,CUR) + PAR_OBJSAL(R,T,P,CUR)); +*------------------------------------------------------------------------------- +* Fixed O&M cost coefficient + OPTION CLEAR=PAR_OBJSAL; + IF(CNT, + PAR_OBJSAL(OBJ_FCUR(R,T,P,CUR)) = + SUM(OBJ_SUMIV(K_EOH,R,T,P,JOT,LIFE)$(NOT RTP_ISHPR(R,T,P)), + SUM(INVSPRED(K_EOH,JOT,LL,K), OBJ_LIFE(LL,R,JOT,LIFE,CUR) * %CAPWD% + (OBJ_FOM(R,K,P,CUR)+OBJ_FTX(R,K,P,CUR)-OBJ_FSB(R,K,P,CUR))) / OBJ_DIVIV(R,T,P)) + + + SUM(OBJ_SUMIV(K_EOH,RTP_ISHPR(R,T,P),JOT,LIFE), + SUM((INVSPRED(K_EOH,JOT,LL,K),OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))), + OBJ_DISC(R,Y_EOH,CUR) * %CAPWD% + ( + OBJ_FOM(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,T,P,'1',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + + OBJ_FTX(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,T,P,'2',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) - + OBJ_FSB(R,K,P,CUR) * (1+SUM(RTP_SHAPE(R,T,P,'3',J,JJ),SHAPE(J,AGE)*MULTI(JJ,Y_EOH)-1)) + ) + ) / OBJ_DIVIV(R,T,P)); + + PAR_OBJCAP(RTP(R,T,P),CUR)$PAR_OBJSAL(R,T,P,CUR) = PAR_OBJCAP(R,T,P,CUR) + PAR_OBJSAL(R,T,P,CUR)); +*------------------------------------------------------------------------------- +* Decommissioning Surveillance coefficient + PAR_OBJCAP(RTP(R,T,P),CUR)$(OBJ_DLAGC(R,T,P,CUR)$CNT) = PAR_OBJCAP(R,T,P,CUR) + + SUM(OBJ_SUMIVS(R,T,P,K,Y), OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR)); +*------------------------------------------------------------------------------- +* Capacity-related flow cost coefficient + OPTION CLEAR=PAR_OBJSAL; + PASTSUM(RTP(R,V(TT),P))$CNT = + SUM((RPC_CAPFLO(R,V,P,C),RDCUR(R,CUR)), +* Flows related to investment / decommissioning + SUM(VNT(V,T)$(COEF_ICOM(R,V,T,P,C)+COEF_OCOM(R,V,T,P,C)),(COEF_ICOM(R,V,T,P,C)+COEF_OCOM(R,V,T,P,C)) * + SUM(RPCS_VAR(R,P,C,TS), G_YRFR(R,TS) * SUM(TS_ANN(TS,SL),SUM(%TPULSE%(OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR)))))) + +* Flows related to existing capacity over lifetime + SUM((RTP_CPTYR(R,V,T,P),IO)$NCAP_COM(R,V,P,C,IO), + COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,IO) * (1 + COEF_CIO(R,V,T,P,C,IO)) * + SUM(RPCS_VAR(R,P,C,TS), G_YRFR(R,TS) * SUM(TS_ANN(TS,SL),SUM(%TPULSE%(OBJ_FCOST(R,Y_EOH,P,C,SL,CUR)+OBJ_FDELV(R,Y_EOH,P,C,SL,CUR)+OBJ_FTAX(R,Y_EOH,P,C,SL,CUR)))))) + ); +*------------------------------------------------------------------------------- +$LABEL SALVAGE +* Salvage coefficient + OPTION CLEAR=PAR_OBJSAL,CLEAR=COEF_RTP; + PAR_OBJSAL(RTP(R,T,P),CUR)$RDCUR(R,CUR) = +* Cases I - Investment Cost and II - Taxes/Subsidies + SUM(OBJ_SUMS(R,T,P), OBJSCC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) * (1+SUM(NCAP_YES(RTP),VAR_SCAP.L(R,T,'0',P)/RTP_CAPVL(RTP)-1)$RVPRL(RTP)) + +* Cases III - Decommissioning + SUM(OBJ_SUMS3(R,T,P), SALV_DEC(R,T,P,CUR)) * OBJ_DCEOH(R,CUR) + +* Cases IV - Decommissioning Surveillance + SUM(OBJ_SUMIVS(R,T,P,K,Y)$SALV_INV(R,T,P,K), + OBJ_DISC(R,Y,CUR) * OBJ_DLAGC(R,K,P,CUR) * SALV_INV(R,T,P,K)); + + COEF_RTP(R,T,P) $= SUM(CUR$PAR_OBJCAP(R,T,P,CUR),ROUND(PAR_OBJCAP(R,T,P,CUR)-PAR_OBJSAL(R,T,P,CUR),7)); +$IFI NOT '%BENCOST%'==YES $GOTO FINISH +*------------------------------------------------------------------------------- +* Add range information if available + OPTION CLEAR=VAR_NCAPRNG; + IF(CNT, + execute 'test -s timesrng.inc' + IF(NOT ERRORLEVEL, + EXECUTE 'GAMS %system.fp%timesrng PS=0'; + EXECUTE_LOAD 'timesrng',VAR_NCAPRNG; + )); +*------------------------------------------------------------------------------- +* Calculate CostBen indicators + %1PAR_NCAPR(%2RTP(R,T,P),'%3COST') $= COEF_RTP(R,T,P)+PASTSUM(R,T,P); + PASTSUM(R,T,P)$%1PAR_NCAPR(%2R,T,P,'%3COST') = VAR_NCAP.M(R,T,P)+EPS; + PASTSUM(RTP(R,T,P))$((VAR_NCAPRNG(RTP,'LO') GT -9E9)$(ABS(VAR_NCAP.L(RTP)) LT MICRO)$PASTSUM(RTP)) = MAX(PASTSUM(RTP),-VAR_NCAPRNG(RTP,'LO')); + OPTION RVP < PASTSUM; + %1PAR_NCAPR(%2RTP(R,T,P),'%3CGAP')$%1PAR_NCAPR(%2RTP,'%3COST') = PASTSUM(RTP)+EPS; + %1PAR_NCAPR(%2RVP(R,T,P),RNGLIM) = SUM(RNGMAP(RNGLIM,BD),VAR_NCAPRNG(R,T,P,BD)); +*------------------------------------------------------------------------------- +* Calculate the net activity benefits + BC_INVACT(RTP_VINTYR(R,V,T,P),S)$(PRC_TS(R,P,S)$RVP(R,V,P)) = + -ROUND(VAR_ACT.M(R,V,T,P,S)+SMIN(RPC_PG(R,P,C),VAR_FLO.M(R,V,T,P,C,S)*PRC_ACTFLO(R,V,P,C)),7); +* Calculate the corresponding net NCAP benefits + BC_INVTOT(RVP(R,V,P))$(NOT PRC_VINT(R,P)) = PRC_CAPACT(R,P) * + SUM((RTP_CPTYR(R,V,T,P),PRC_TS(R,P,S),BDUPX(BD))$COEF_AF(R,V,T,P,S,BD), COEF_CPT(R,V,T,P) * COEF_AF(R,V,T,P,S,BD) * + G_YRFR(R,S) * MAX(-INF$BDLOX(BD),BC_INVACT(R,T,T,P,S))); + BC_INVTOT(RVP(R,V,P))$PRC_VINT(R,P) = PRC_CAPACT(R,P) * + SUM((RTP_VINTYR(R,V,T,P),PRC_TS(R,P,S),BDUPX(BD))$COEF_AF(R,V,T,P,S,BD), COEF_CPT(R,V,T,P) * COEF_AF(R,V,T,P,S,BD) * + G_YRFR(R,S) * MAX(-INF$BDLOX(BD),BC_INVACT(R,V,T,P,S))); +* Add the net activity benefits to the net capacity benefits + BC_INVTOT(RVP(R,T,P)) = BC_INVTOT(R,T,P) - VAR_NCAP.M(R,T,P) - SUM(TT$COEF_CPT(R,T,TT,P), COEF_CPT(R,T,TT,P) * VAR_CAP.M(R,TT,P)) +EPS; + %1PAR_NCAPR(%2RVP(R,T,P),'%3GGAP') = MAX(-BC_INVTOT(R,T,P),(PASTSUM(R,T,P)-INF$(PASTSUM(R,T,P) LE MICRO))); +* Normalize and calculate RATIOs + %1PAR_NCAPR(%2RTP(R,T,P),SYSUC)$%1PAR_NCAPR(%2R,T,P,SYSUC) = %1PAR_NCAPR(%2R,T,P,SYSUC)/COEF_OBJINV(R,T,P); + %1PAR_NCAPR(%2RVP(R,T,P),'%3GRATIO') = 1-ROUND(%1PAR_NCAPR(%2R,T,P,'%3GGAP')/%1PAR_NCAPR(%2R,T,P,'%3COST'),7)+EPS; + %1PAR_NCAPR(%2R,T,P,'%3RATIO')$COEF_RTP(R,T,P) = 1-ROUND(%1PAR_NCAPR(%2R,T,P,'%3CGAP')/%1PAR_NCAPR(%2R,T,P,'%3COST'),6)+EPS; +*------------------------------------------------------------------------------- +$LABEL FINISH + OPTION CLEAR=RVP,CLEAR=PASTSUM; diff --git a/rpt_par.cli b/rpt_par.cli new file mode 100644 index 0000000..2fca3d6 --- /dev/null +++ b/rpt_par.cli @@ -0,0 +1,79 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*----------------------------------------------------------------------------- +* RPT_PAR.cli - Extension for Climate Module +* %1-%2 - none or LOOP(SOW, ) for stochastics +*----------------------------------------------------------------------------- +* Questions/Comments: +* +*----------------------------------------------------------------------------- +* Calculate Reporting parameters for Climate Module +%1 + OPTION CLEAR=CM_RESULT,CLEAR=CM_MAXC_M; +*----------------------------------------------------------------------------- +* Calculate incremental radiative forcing in each year + OPTION CLEAR=MY_ARRAY; + MY_F = SUM(CM_BOXMAP('CO2-GTC',CM_VAR,CM_BOX)$CM_PHI('CO2-GTC',CM_BOX,'CO2-GTC'),CM_CONST(CM_VAR))/CM_CONST('CO2-PREIND'); + VALLVL = CM_CONST('GAMMA') / LOG(2); + Z = SMIN(T,M(T))-CM_CALIB; + LOOP(LL$CM_LED(LL), CNT = MAX(1,CM_LED(LL)); + ATTLVL = SUM(CM_BOXMAP('CO2-GTC',CM_VAR,CM_BOX)$CM_PHI('CO2-GTC',CM_BOX,'CO2-GTC'),VAR_CLIBOX.L(CM_VAR,LL))/CM_CONST('CO2-PREIND'); + Z = (ATTLVL - MY_F) / CNT; + FOR(F = 0 TO CNT-1, MY_ARRAY(LL-F) = VALLVL*LOG(ATTLVL-F*Z)+CM_EXOFORC(LL-F)); + MY_F = ATTLVL; + ); + CM_RESULT('FORC+CO2',LL)$CM_LED(LL) = MY_ARRAY(LL)-CM_EXOFORC(LL); +*----------------------------------------------------------------------------- +* Calculate radiative forcing from other emissions in each year + LOOP(SUPERYR(T,LL)$CM_LED(LL), CM_RESULT(CM_OFOR,LL) = + SUM(CM_FORCMAP(CM_OFOR,CM_EMIS),CM_LINFOR(LL,CM_EMIS,'FX')+CM_LINFOR(LL,CM_EMIS,'N')/CM_PPM(CM_EMIS)* + SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),VAR_CLIBOX.L(CM_VAR,LL))) + + SUM(CM_FORCMAP(CM_TKIND(CM_OFOR),CM_VAR)$(NOT CM_EMIS(CM_VAR)),VAR_CLITOT.L(CM_OFOR,LL))); + LOOP(MIYR_1(T), FIRST_VAL = + SUM(CM_FORCMAP(CM_OFOR,CM_EMIS),CM_LINFOR(T,CM_EMIS,'FX')+CM_LINFOR(T,CM_EMIS,'N')/CM_PPM(CM_EMIS)* + SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),CM_CONST(CM_VAR))) + + SUM(CM_FORCMAP(CM_TKIND,CM_VAR)$(NOT CM_EMIS(CM_VAR)),VAR_CLITOT.L(CM_TKIND,T))); + LOOP(LL$CM_LED(LL), CNT = MAX(1,CM_LED(LL)); + LAST_VAL = SUM(CM_FORCMAP(CM_OFOR,CM_VAR),CM_RESULT(CM_OFOR,LL)); + FOR(F = 0 TO CNT-1, MY_F = F/CNT; MY_FIL2(LL-F) = MY_F*FIRST_VAL+(1-MY_F)*LAST_VAL); + FIRST_VAL = LAST_VAL); + MY_ARRAY(LL)$MY_ARRAY(LL) = MY_ARRAY(LL) + MY_FIL2(LL); +*----------------------------------------------------------------------------- + CM_DT_FORC(LL) = MY_ARRAY(LL); +*----------------------------------------------------------------------------- +* Calculate the ith powers of SIG, i=1...Z, where Z = LEAD(T) +* First intialize CM_DD to the identity matrix, CM_EE to zero + LOOP((CM_VAR('FORCING'),LL)$CM_LED(LL), Z = CM_LED(LL); + OPTION CLEAR=CM_RR; + CM_RR('1',CM_BUCK,CM_BOX) = DIAG(CM_BUCK,CM_BOX); + FOR(F = 0 TO Z-1, + CM_RR('2',CM_BOX,'LO') = CM_RR('2',CM_BOX,'LO') + MY_ARRAY(LL-F)*CM_RR('1',CM_BOX,'ATM'); + CM_RR('1',CM_BUCK,CM_BOX) = SUM(ITEM$CM_BOX(ITEM),CM_RR('1',CM_BUCK,ITEM)*CM_SIG(SOW,ITEM,CM_BOX)); + ); +* Calculate temperature changes + CM_DELTAT(LL,CM_BOX) = + CM_RR('1',CM_BOX,'ATM') * CM_DELTAT(LL-CM_LED(LL),'ATM') + + CM_RR('1',CM_BOX,'LO') * CM_DELTAT(LL-CM_LED(LL),'LO') + + CM_RR('2',CM_BOX,'LO') * CM_SIG1(SOW) + + (CM_RR('1',CM_BOX,'ATM') * CM_CONST('DELTA-ATM') + + CM_RR('1',CM_BOX,'LO') * CM_CONST('DELTA-LO'))$MIYR_1(LL); + ); +*----------------------------------------------------------------------------- +* Shadow price of total and maximum constraints + CM_MAXC_M(CM_VAR,T) $= ABS(EQ_CLITOT.M(CM_VAR,T,T)); + CM_MAXC_M(CM_VAR,LL) $= MAX(CM_MAXC_M(CM_VAR,LL),ABS(EQ_CLIMAX.M(LL,CM_VAR)))$EQ_CLIMAX.M(LL,CM_VAR); + +*----------------------------------------------------------------------------- +* Collect all basic results + CM_RESULT(CM_VAR,LL) $= VAR_CLITOT.L(CM_VAR,LL); + CM_RESULT(CM_VAR,LL) $= VAR_CLIBOX.L(CM_VAR,LL); + LOOP(CM_ATMAP(CM_EMIS,CM_HISTS), CM_RESULT(CM_HISTS,LL)$CM_LED(LL) = + SUM(CM_BOXMAP(CM_EMIS,CM_VAR,CM_BOX)$CM_PHI(CM_EMIS,CM_BOX,CM_EMIS),VAR_CLIBOX.L(CM_VAR,LL))/CM_PPM(CM_EMIS)); + CM_RESULT('FORC+TOT',LL)$CM_LED(LL) $= CM_DT_FORC(LL); + CM_RESULT('DELTA+ATM',LL) $= CM_DELTAT(LL,'ATM'); + CM_RESULT('DELTA+LO',LL) $= CM_DELTAT(LL,'LO'); + CM_SRESULT(SOW,ITEM,LL) $= CM_RESULT(ITEM,LL); + CM_SMAXC_M(SOW,ITEM,LL) $= CM_MAXC_M(ITEM,LL); +%2 \ No newline at end of file diff --git a/rptlite.rpt b/rptlite.rpt new file mode 100644 index 0000000..a5e0ffc --- /dev/null +++ b/rptlite.rpt @@ -0,0 +1,175 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* RPTLITE.rpt is the main driver for the light-weight report writer for TIMES +* %1 - mod or v# for the source code to be used +*=============================================================================* +*----------------------------------------------------------------------------- +$IF NOT %SOLVEDA%==1 $SHIFT SHIFT SHIFT +$IF '%4'=='NO' $GOTO REPORT +$BATINCLUDE solsysd.v3 SYSUC ! '%SYSPREFIX%' VAR VARX INV INVX INV+ INVX+ FIX FIXX IRE COM ACT FLO ELS DAM DAS DAM-EXT+ +$BATINCLUDE solsysd.v3 SYSUC ,% '%SYSPREFIX%' INSTCAP LUMPINV LUMPIX COST CGAP GGAP RNGLO RNGUP RATIO GRATIO LEVCOST +*----------------------------------------------------------------------------- + ALIAS(ALLSOW,WW); +$IF SET RPT_OPT PARAMETER RPT_OPT / %RPT_OPT% /; +$IF %RPT_FLOTS%==COM RPT_OPT('FLO','1')=1; + RPT_OPT(ITEM,J)$(RPT_OPT(ITEM,J)=0)=0; + RPT_OPT('FLO','1')$RPT_OPT('FLO','3')=1; +*----------------------------------------------------------------------------- +* Other general parameters and sets + PARAMETERS + RTP_OBJ(J,R,ALLYEAR,P,CUR) // + RTP_NPV(J,R,ALLYEAR,P,CUR) // + PAR_ACTC(J,R,LL,T,P,C,CUR) + PAR_FLOC(J,R,LL,T,P,C,CUR) + PAR_COMC(J,R,T,C,CUR) + PAR_RPMX(R,P,J,LL,T,C,CUR) + PAR_RCMX(R,C,J,T,CUR) + PAR_OBJCAP(R,ALLYEAR,P,CUR) + COEF_OBJINV(R,ALLYEAR,PRC) // + COEF_OBINV(R,ALLYEAR,P,CUR) // + COEF_OBFIX(R,ALLYEAR,P,CUR) // + COEF_CRF(R,ALLYEAR,P,CUR) // + VAR_NCAPRNG(R,ALLYEAR,P,BD) // + CSTVNT(J,R,LL,YEAR,P,SYSUC) // + CSTVPJ(R,LL,P,J,SYSUC,YEAR) + F_VIO(R,ALLYEAR,T,P,IO) + F_IOS(R,ALLYEAR,T,P,C,S) // + F_INOUT(R,ALLYEAR,T,P,C,IO) // + F_INOUTS(R,ALLYEAR,T,P,C,S,IO) // + REG_OBJ(REG) // + BC_INVACT(R,ALLYEAR,LL,PRC,S) // + BC_INVTOT(R,ALLYEAR,PRC) // + VAL_FLO(R,ALLYEAR,LL,PRC,C) // + PAR_RTCS(R,T,C,S) + PAR_TOP(R,T,P,C,IO); + + SET NCAP_YES(R,ALLYEAR,P) //; + SET F_IOSET(R,ALLYEAR,T,P,C,S,IO) //; + SET RVTPC(R,ALLYEAR,T,P,C) //; + SET RTTC(R,ALLYEAR,C); + SET PASTCV / '0','' /, RPM / '-','+' /; + SET RNGLIM(SYSUC), SYSINV(SYSUC); + SET SUCMAP(J,SYSUC) /2.%SYSPREFIX%LUMPINV,2.%SYSPREFIX%INV+,1.%SYSPREFIX%LUMPIX,1.%SYSPREFIX%INVX+/; + SET RNGMAP(SYSUC,BD) / %SYSPREFIX%RNGLO.LO, %SYSPREFIX%RNGUP.UP /; + OPTION RNGLIM < RNGMAP; + SCALAR OBJVAL_1 / 0 /, OBJVAL_2 / 0 /; + PARAMETER SYSONE(SYSUC) / %SYSPREFIX%INV 1 /, SYSPLIT(SYSUC); +*------------------------------------------------------------------------------ +* Stochastic result parameters + PARAMETER %1CST_PVC(%2SYSUC,R,C) //; + PARAMETER %1CST_PVP(%2SYSUC,R,P) //; + PARAMETER %1F_IN(%2R,ALLYEAR,T,P,C,S) //; + PARAMETER %1F_OUT(%2R,ALLYEAR,T,P,C,S) //; + PARAMETER %1P_OUT(%2R,T,P,C,S) //; + PARAMETER %1AGG_OUT(%2R,T,C,TS) //; + PARAMETER %1PAR_ACTL(%2R,LL,LL,P,S) //; + PARAMETER %1PAR_ACTM(%2R,LL,LL,P,S) //; + PARAMETER %1PAR_PASTI(%2R,T,P,ITEM) //; + PARAMETER %1PAR_CAPL(%2R,YEAR,P) //; + PARAMETER %1PAR_CAPM(%2R,YEAR,P) //; + PARAMETER %1PAR_CAPLO(%2R,YEAR,P) //; + PARAMETER %1PAR_CAPUP(%2R,YEAR,P) //; + + PARAMETER %1PAR_NCAPL(%2R,ALLYEAR,P) //; + PARAMETER %1PAR_NCAPM(%2R,ALLYEAR,P) //; + PARAMETER %1PAR_NCAPR(%2R,ALLYEAR,P,ITEM) //; + PARAMETER %1PAR_OBJSAL(%2R,ALLYEAR,P,CUR) //; + + PARAMETER %1PAR_COMPRDL(%2R,ALLYEAR,C,S) //; + PARAMETER %1PAR_COMPRDM(%2R,ALLYEAR,C,S) //; + PARAMETER %1PAR_COMNETL(%2R,ALLYEAR,C,S) //; + PARAMETER %1PAR_COMNETM(%2R,ALLYEAR,C,S) //; + PARAMETER %1PAR_COMBALEM(%2R,ALLYEAR,C,S) //; + PARAMETER %1PAR_COMBALGM(%2R,ALLYEAR,C,S) //; + PARAMETER %1PAR_IPRIC(%2R,YEAR,P,C,TS,IE) //; + PARAMETER %1PAR_PEAKM(%2R,ALLYEAR,CG,S) //; + PARAMETER %1PAR_UCSL(%2UC_N,*,*,*) //; + PARAMETER %1PAR_UCSM(%2UC_N,*,*,*) //; + PARAMETER %1PAR_CUMFLOL(%2R,P,C,LL,LL) //; + PARAMETER %1PAR_CUMFLOM(%2R,P,C,LL,LL) //; + PARAMETER %1PAR_CUMCST(%2R,LL,LL,COSTAGG,CUR) //; + PARAMETER %1PAR_UCMRK(%2R,T,ITEM,C,S) //; + PARAMETER %1PAR_UCRTP(%2UC_N,R,T,P,UC_GRPTYPE)//; + PARAMETER %1PAR_UCMAX(%2UC_N,ALL_R,ITEM,C) //; + +* Stochastic cost parameters + PARAMETER REG_WOBJ(REG,ITEM,CUR) //; + PARAMETER %1REG_WOBJ(%2REG,ITEM,CUR) //; + PARAMETER %1REG_IREC(%2REG) //; + PARAMETER %1REG_ACOST(%2R,ALLYEAR,ITEM) //; + PARAMETER %1CST_INVC(%2R,ALLYEAR,T,P,SYSUC) //; + PARAMETER %1CST_INVX(%2R,ALLYEAR,T,P,SYSUC) //; + PARAMETER %1CST_DECC(%2R,ALLYEAR,T,P) //; + PARAMETER %1CST_FIXC(%2R,ALLYEAR,T,P) //; + PARAMETER %1CST_FIXX(%2R,ALLYEAR,T,P) //; + PARAMETER %1CST_ACTC(%2R,ALLYEAR,T,P,RPM) //; + PARAMETER %1CST_FLOC(%2R,ALLYEAR,T,P,C) //; + PARAMETER %1CST_FLOX(%2R,ALLYEAR,T,P,C) //; + PARAMETER %1CST_IREC(%2R,ALLYEAR,T,P,C) //; + PARAMETER %1CST_COMC(%2R,ALLYEAR,C) //; + PARAMETER %1CST_COMX(%2R,ALLYEAR,C) //; + PARAMETER %1CST_COME(%2R,ALLYEAR,C) //; + PARAMETER %1CST_SALV(%2R,ALLYEAR,P) //; + PARAMETER %1CST_TIME(%2R,ALLYEAR,S,SYSUC) //; + PARAMETER %1CAP_NEW(%2R,ALLYEAR,P,T,SYSUC) //; +* Damage cost and custom parameters + PARAMETER %1DAM_OBJ(%2R,T,C,CUR); + PARAMETER %1CST_DAM(%2R,T,C) 'Damage costs' //; + PARAMETER %1PAR_EOUT(%2R,ALLYEAR,T,P,C) //; +*------------------------------------------------------------------------------ +* Prepare some sets and parameters that can be used for all SOW +*------------------------------------------------------------------------------ + SALV_INV(OBJ_SUMS(R,PASTMILE(V),P),V)=SUM(OBJ_ICUR(R,V,P,CUR)$OBJ_PASTI(R,V,P,CUR),SALV_INV(R,V,P,V)*(NCAP_PASTI(R,V,P)/OBJ_PASTI(R,V,P,CUR)))*(1-0%CTST%); +* Hold on to costs + OBJ_VFLO(R,P,C,CUR,UC_COST)$(NOT RDCUR(R,CUR)) = NO; + OBJ_VFLO(R,P,C,CUR,'TAX')$=OBJ_VFLO(R,P,C,CUR,'SUB'); + SYSINV(SYSUC)$=SYSONE(SYSUC); +* Hold on to auxliary flows and past investments + LOOP(RPC_IRE(R,P,COM,IE),F_IOSET(RTP_VINTYR(R,V,T,P),C,TS,IO)$(RPCS_VAR(R,P,COM,TS)$IRE_FLOSUM(R,T,P,COM,TS,IE,C,IO)) = RC(R,C)); +$IFI %SENSIS%==YES $BATINCLUDE solsetv.v3 + OPTION CLEAR=COEF_RTP; +*------------------------------------------------------------------------------ +$IF "%3%SOLVEDA%%3"=="1" $EXIT +$LABEL REPORT +*------------------------------------------------------------------------------ +* Reports based on SOW-specific values +*------------------------------------------------------------------------------ +* Calculation of solution values for (due to reduction) substituted flows +*----------------------------------------------------------------------------- + OPTION CLEAR=PAR_FLO,CLEAR=PAR_FLOM; +$ BATINCLUDE sol_flo.red PAR_FLO '' .L +$ BATINCLUDE sol_flo.red PAR_FLO M .M +$ BATINCLUDE sol_ire.rpt +*----------------------------------------------------------------------------- +* Objective function +*----------------------------------------------------------------------------- + OPTION CLEAR=COEF_OBJINV; +$ BATINCLUDE rpt_obj.rpt '%1' "%3" "%SOW%" %SYSPREFIX% +*----------------------------------------------------------------------------- +* Calculation of annual costs +*----------------------------------------------------------------------------- +$ BATINCLUDE cost_ann.rpt '%1' "%3" +*----------------------------------------------------------------------------- +* Miscellaneous reportings +$ BATINCLUDE rptmisc.rpt '%1' "%3" +* Add aggregation levels +$ IFI NOT %SENSIS%==YES LOOP(NRG_TYPE,Z=RPT_OPT(NRG_TYPE,'1'); IF(Z,PAR_RTCS(RTCS_VARC(R,T,C,S))$NRG_TMAP(R,NRG_TYPE,C)=%1AGG_OUT(%3R,T,C,S)/G_YRFR(R,S)/Z)); +*----------------------------------------------------------------------------- +* User constraints +$IF %VAR_UC% == YES $GOTO UC_DONE +$ BATINCLUDE par_uc.rpt SM EQE '%1' "%3" +$ BATINCLUDE par_uc.rpt SM EQG '%1' "%3" +$ BATINCLUDE par_uc.rpt SM EQL '%1' "%3" + +$LABEL UC_DONE +*----------------------------------------------------------------------------- +$IF %STAGES%==YES REG_WOBJ(R,ITEM,CUR) $= SUM(W$SREG_WOBJ(W,R,ITEM,CUR),SW_PROB(W)*SREG_WOBJ(W,R,ITEM,CUR)); +$IFI NOT %STAGES%==YES REG_WOBJ(R,ITEM,CUR) $= %1REG_WOBJ(%3R,ITEM,CUR); + +$IFI %OBMAC%==YES $ONDOTL +$IFI %ABS%==YES Z=RPT_OPT('RATE','1'); IF(Z,TRACKPC(BS_BSC)=YES; TRACKPC(BS_STGP(R,P),C)$=BS_RTYPE(R,C)); +$IFI %ABS%==YES %1P_OUT(%3RTP(R,T,P),C,S)$(PRC_TS(R,P,S)$BS_COMTS(R,C,S)$TRACKPC(R,P,C)$Z)=SUM(RTP_VINTYR(R,V,T,P),VAR_BSFSP(R,V,T,P,C,S)+VAR_BSFNSP(R,V,T,P,C,S))*PRC_CAPACT(R,P)/Z; + OPTION CLEAR=TRACKPC; \ No newline at end of file diff --git a/rptmain.mod b/rptmain.mod new file mode 100644 index 0000000..62d4c7f --- /dev/null +++ b/rptmain.mod @@ -0,0 +1,48 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* RPTMAIN.MOD is the main driver for the report writer * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +*GaG Questions/Comments: +* - COM, PRC descriptions need to be taken from the COM_GMAP/PRC_MAP Sets +*----------------------------------------------------------------------------- +*----------------------------------------------------------------------------- +* dump solution if requested +$IF NOT %STAGES% == YES +$IF %DUMPSOL% == 'YES' $BATINCLUDE dumpsol.%1 %1 +*----------------------------------------------------------------------------- +$IFI %VDA% == YES $SETLOCAL SOLVEDA 1 +$IFI %SENSIS% == YES $GOTO FINISH +$IF NOT '%SOLVEDA%'==NO $BATINCLUDE solsetv.v3 +$IFI %MACRO% == YES $GOTO OTHER_REP +$IF DEFINED VAR_NTX $GOTO FINISH +$IF %STAGES% == YES $GOTO OTHER_REP +*----------------------------------------------------------------------------- +* produce standard VEDA report +$IFI %SOLVEDA% == 'YES' $BATINCLUDE rptmain.rpt +$IFI %SOLVEDA% == '1' $BATINCLUDE rptlite.rpt S WW, "'1'," + +$LABEL OTHER_REP +$IF %MACRO% == YES $BATINCLUDE rptmain.tm + +* If running stochastics, streamline reports +$IF %STAGES% == YES $BATINCLUDE rptmain.stc SOW %SWS% "'1'" ",'1')" + +* output ETL info +$IFI %ETL% == 'YES' $BATINCLUDE atlearn.etl + +* produce damage report +$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.%1 +*----------------------------------------------------------------------------- +$LABEL FINISH + +* Extensions +$IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod rpt_ext %EXTEND% + +* Back-end software dependent reporting routines +* produce ANSWER-TIMES report +$IFI %SOLANS% == YES $BATINCLUDE solputta.ans S WW, SOW, +$IFI %VDA%==YES $BATINCLUDE solsetv.v3 FINISHUP \ No newline at end of file diff --git a/rptmain.rpt b/rptmain.rpt new file mode 100644 index 0000000..181e09b --- /dev/null +++ b/rptmain.rpt @@ -0,0 +1,283 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*--------------------------------------------------------------- +* RPTMAIN.RPT +* +* Output routine +* - creating flat dump for VEDA3 and paramaters for VEDA4 +*GG* VEDABE 'V4' override to avoid PUT related code (e.g., File & SOLSUBV calls) +*--------------------------------------------------------------- +* Output routine for IER extensions +*--------------------------------------------------------------- +* - VAR_FLO/VAR_IRE are replaced by the parameters PAR_FLO/PAR_IRE +* which contain the values of the flow variables in the reduced model +* plus the recalculated values of substituted flows +* - calculation of annual cost terms +* +*----------------------------------------------------------------------- +* Declarations + PARAMETER PAR_CAPL(R,T,P); + PARAMETER PAR_CAPM(R,T,P); + PARAMETER PAR_PASTI(R,T,P); + PARAMETER PAR_CAPLO(R,T,P); + PARAMETER PAR_CAPUP(R,T,P); + PARAMETER PAR_NCAPL(R,ALLYEAR,P); + PARAMETER PAR_NCAPM(R,ALLYEAR,P); + PARAMETER PAR_ACTL(REG,ALLYEAR,ALLYEAR,PRC,ALL_TS); + PARAMETER PAR_ACTM(REG,ALLYEAR,ALLYEAR,PRC,ALL_TS); + PARAMETER PAR_COMPRDL(R,ALLYEAR,C,S); + PARAMETER PAR_COMPRDM(R,ALLYEAR,C,S); + PARAMETER PAR_COMNETL(R,ALLYEAR,C,S); + PARAMETER PAR_COMNETM(R,ALLYEAR,C,S); + PARAMETER PAR_COMBALEM(R,ALLYEAR,C,S); + PARAMETER PAR_COMBALGM(R,ALLYEAR,C,S); + PARAMETER PAR_PEAKM(R,ALLYEAR,COM_GRP,S); + PARAMETER PAR_UCLOM(UC_N,*,*,*); + PARAMETER PAR_UCUPM(UC_N,*,*,*); + PARAMETER PAR_UCFXM(UC_N,*,*,*); + PARAMETER F_IN(R,ALLYEAR,T,P,C,S); + PARAMETER F_OUT(R,ALLYEAR,T,P,C,S); + PARAMETER F_INOUT(R,ALLYEAR,T,P,C,IO); + PARAMETER F_INOUTS(R,ALLYEAR,T,P,C,TS,IO); + SET F_IOSET(R,ALLYEAR,T,P,C,TS,IO); + + PARAMETERS + TOT_INV(R,ALLYEAR,CUR) 'Total annual disocunted investment costs' // + TOT_DEC(R,ALLYEAR,CUR) 'Total annual disocunted decommissioning costs' // + TOT_FIX(R,ALLYEAR,CUR) 'Total annual disocunted FOM costs' // + TOT_SAL(R,ALLYEAR,CUR) 'Total annual disocunted salvage value' // + TOT_LAT(R,ALLYEAR,CUR) 'Total annual disocunted late costs' // + TOT_ACT(R,ALLYEAR,CUR) 'Total annual disocunted variable costs' // + TOT_COM(R,ALLYEAR,CUR) 'Total annual disocunted commodity costs' // + TOT_FLO(R,ALLYEAR,CUR) 'Total annual disocunted flow costs' // + TOT_BLE(R,ALLYEAR,CUR) 'Total annual disocunted blending costs' // + TOT_OBJ(R,ALLYEAR,CUR) 'Annual discounted objective value ' //; + +*----------------------------------------------------------------------- +* Calculation of solution values for (due to reduction) substituted flows +*------------------------------------------------------------------------ +$ BATINCLUDE sol_flo.red PAR_FLO '' .L +$ BATINCLUDE sol_flo.red PAR_FLO M .M + +* IRE auxiliary flows summed up from all IE flows + LOOP((RPC_IRE(R,P,COM,IE),RPCS_VAR(R,P,COM,TS)),F_IOSET(RTP_VINTYR(R,V,T,P),C,TS,IO)$IRE_FLOSUM(R,T,P,COM,TS,IE,C,IO) = RC(R,C)); +$ BATINCLUDE sol_ire.rpt + +*--------------------------------------------------------------- +* Calculation of annual cost terms +*--------------------------------------------------------------- +$ BATINCLUDE eqobjinv.rpt +$ BATINCLUDE eqobjfix.rpt mod +$ BATINCLUDE eqobsalv.rpt rpt +$ BATINCLUDE eqobjvar.rpt mod +$ BATINCLUDE eqobjels.rpt PAR_OBJELS(R,Y_EOH,C,CUR) Y_EOH OBJ_DISC(R,Y_EOH,CUR)* + +*------------------------------------------------------------------------ +* Include explicit EPS values for zero flows +*------------------------------------------------------------------------ +$IF NOT %SUPZERO%==YES + PAR_FLO(RTP_VINTYR(R,V,T,P),C,S)$(RTPCS_VARF(R,T,P,C,S)*RP_FLO(R,P)*(NOT RPC_NOFLO(R,P,C))) $= EPS$(NOT PAR_FLO(R,V,T,P,C,S)); + ; +$IF NOT %SUPZERO%==YES + PAR_IRE(RTP_VINTYR(R,V,T,P),C,TS,IMPEXP)$(RTPCS_VARF(R,T,P,C,TS)$RPC_IRE(R,P,C,IMPEXP)) $= EPS$(NOT PAR_IRE(R,V,T,P,C,TS,IMPEXP)); + ; +*--------------------------------------------------------------------- +* Annual discounted objective values by cost type(INV, FIX, VAR etc.) +*--------------------------------------------------------------------- + +* Total investment costs + TOT_INV(R,ALLYEAR,CUR)=SUM(RTP(R,V,P),PAR_OBJINV(R,V,ALLYEAR,P,CUR)); +* Total decommissioning costs + TOT_DEC(R,ALLYEAR,CUR)=SUM(RTP(R,V,P),PAR_OBJDEC(R,V,ALLYEAR,P,CUR)); +* Total fix costs + TOT_FIX(R,ALLYEAR,CUR)=SUM(RTP(R,V,P),PAR_OBJFIX(R,V,ALLYEAR,P,CUR)); +* Total salvage value + TOT_SAL(R,V,CUR)=-SUM(P,PAR_OBJSAL(R,V,P,CUR)); +* Total late revenues + TOT_LAT(R,ALLYEAR,CUR)=-SUM(P,PAR_OBJLAT(R,ALLYEAR,P,CUR)); +* Total variable costs + TOT_ACT(R,ALLYEAR,CUR)=SUM((RTP_VINTYR(R,V,T,P),TS)$PERIODYR(T,ALLYEAR),PAR_OBJACT(R,V,ALLYEAR,P,TS,CUR)); +* Total flow related costs + TOT_FLO(R,ALLYEAR,CUR) = SUM((RTP_VINTYR(R,V,T,P),C,TS)$PERIODYR(T,ALLYEAR),PAR_OBJFLO(R,V,ALLYEAR,P,C,TS,CUR)); +* Total commodity related costs + TOT_COM(R,ALLYEAR,CUR)=SUM((C,TS),PAR_OBJCOM(R,ALLYEAR,C,TS,CUR)); +* Total blending related costs + TOT_BLE(R,ALLYEAR,CUR)=SUM((C),PAR_OBJBLE(R,ALLYEAR,C,CUR)); +* Total yearly objective value +TOT_OBJ(R,ALLYEAR,CUR) = TOT_INV(R,ALLYEAR,CUR) + + TOT_DEC(R,ALLYEAR,CUR) + + TOT_FIX(R,ALLYEAR,CUR) + + TOT_SAL(R,ALLYEAR,CUR) + + TOT_LAT(R,ALLYEAR,CUR) + + TOT_ACT(R,ALLYEAR,CUR) + + TOT_FLO(R,ALLYEAR,CUR) + + TOT_COM(R,ALLYEAR,CUR) + + TOT_BLE(R,ALLYEAR,CUR); + +**Aggregate Undiscounted Costs w/out CUR +PARAMETER TOT_OBJV(R,ALLYEAR) //; +TOT_OBJV(R,T) $= SUM(CUR,TOT_OBJ(R,T,CUR)/OBJ_DISC(R,T,CUR)); + +* Discounted objective value by region +PARAMETER REG_OBJ(REG) //; +REG_OBJ(R) = SUM((CUR,ALLYEAR),TOT_OBJ(R,ALLYEAR,CUR)); + +*--------------------------------------------------------------------- + +* calculate discounting for the period +PARAMETER VDA_DISC(R,ALLYEAR) //; +* [AL] The MARKAL undiscounting method is not sufficiently accurate for TIMES +*VDA_DISC(R,T) = SUM(CUR,OBJ_DISC(R,T,CUR))*D(T); +LOOP(RDCUR(R,CUR), VDA_DISC(R,T) = SUM(PERIODYR(T,Y_EOH),OBJ_DISC(R,Y_EOH,CUR));); + +* Scenario index not supported in current version, use 1 +SOW('1') = YES; + +*--------------------------------------------------------------------- +* Output of VAR_ACT +*--------------------------------------------------------------------- + +PAR_ACTL(RTP_VINTYR(R,V,T,P),S)$PRC_TS(R,P,S) = EPS; +PAR_ACTL(R,V,T,P,S) $= VAR_ACT.L(R,V,T,P,S); +PAR_ACTM(R,V,T,P,S)$VAR_ACT.M(R,V,T,P,S) = VAR_ACT.M(R,V,T,P,S)/VDA_DISC(R,T); + +*--------------------------------------------------------------------- +* Output of VAR_CAP +*--------------------------------------------------------------------- + +RTP_CAPYR(RTP_CPTYR(R,TT,T,P))$VAR_NCAP.L(R,TT,P) = YES; +RTP_CAPYR(RTP_CPTYR(R,PYR,T,P))$NCAP_PASTI(R,PYR,P) = YES; + +PAR_PASTI(RTP(R,T,P)) = SUM(RTP_CAPYR(R,PYR,T,P),COEF_CPT(R,PYR,T,P)*NCAP_PASTI(R,PYR,P)); +PAR_CAPL(RTP(R,T,P)) = SUM(RTP_CAPYR(R,TT,T,P), COEF_CPT(R,TT,T,P) *VAR_NCAP.L(R,TT,P)) + + PAR_PASTI(R,T,P); + +PAR_CAPM(RTP(R,T,P)) $= VAR_CAP.M(R,T,P)*(1/VDA_DISC(R,T)); +PAR_CAPLO(RTP(R,T,P)) $= CAP_BND(R,T,P,'LO'); +PAR_CAPUP(RTP(R,T,P))$(CAP_BND(R,T,P,'UP') NE INF) $= CAP_BND(R,T,P,'UP'); + +PAR_NCAPL(R,V,P) $= VAR_NCAP.L(R,V,P) ; + +* [UR]: undiscounting of dual variable of VAR_NCAP +PAR_NCAPM(R,T,P)$(VAR_NCAP.M(R,T,P)*COEF_OBJINV(R,T,P)) = VAR_NCAP.M(R,T,P)/COEF_OBJINV(R,T,P); + +*--------------------------------------------------------------------- +* Output of VAR_FLO +* - split by in/out +*--------------------------------------------------------------------- +* emission tied to CAP/INV +F_INOUT(RTP_VINTYR(R,V,T,P),C,'IN')$RPC_CAPFLO(R,T,P,C) = COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,'IN') * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) + + (COEF_ICOM(R,V,T,P,C) * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))); +F_INOUT(RTP_VINTYR(R,V,T,P),C,'OUT')$RPC_CAPFLO(R,T,P,C) = COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,'OUT') * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V)) + + (COEF_OCOM(R,V,T,P,C) * (VAR_NCAP.L(R,V,P)$MILESTONYR(V) + NCAP_PASTI(R,V,P)$PASTYEAR(V))); + +* Blending flows *** PENDING!!! Code below from EQCOMBAL *** +*PARAMETER F_BLND(R,T,C,TS,IO) //; +* SUM(OPR$BLE_OPR(R,C,OPR), +* RTCS_TSFR(R,T,C,S,'ANNUAL') * BLE_BAL(R,T,C,OPR) * VAR_BLND(R,T,C,OPR) +* ) + +* emissions due to blending operations +* SUM(BLE_ENV(R,COM,BLE,OPR), +* ENV_BL(R,COM,BLE,OPR,T) * VAR_BLND(R,T,BLE,OPR) +* ) + + +*--------------------------------------------------------------------- +* Process flows +*--------------------------------------------------------------------- +* Flow by IN/OUT +* main flows & emissions +F_IN(R,V,T,P,C,S)$TOP(R,P,C,'IN') $= PAR_FLO(R,V,T,P,C,S); +F_OUT(R,V,T,P,C,S)$TOP(R,P,C,'OUT') $= PAR_FLO(R,V,T,P,C,S); +* IRE flows +* [UR] maybe exports as negativ values for net imports in primary energy balance ? +F_IN(R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'EXP'); +F_OUT(R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'IMP'); +* Aux flows & emissions tied to INV/CAP +F_IN(R,V,T,P,C,'ANNUAL')$F_INOUT(R,V,T,P,C,'IN') = F_IN(R,V,T,P,C,'ANNUAL')+F_INOUT(R,V,T,P,C,'IN'); +F_OUT(R,V,T,P,C,'ANNUAL')$F_INOUT(R,V,T,P,C,'OUT') = F_OUT(R,V,T,P,C,'ANNUAL')+F_INOUT(R,V,T,P,C,'OUT'); +* IRE Aux flows & emissions +F_IN(R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'IN') = F_IN(R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'IN'); +F_OUT(R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'OUT') = F_OUT(R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'OUT'); +* Storage in/output flows +F_IN(R,V,T,P,C,S) $= VAR_SIN.L(R,V,T,P,C,S); +F_OUT(R,V,T,P,C,S) $= VAR_SOUT.L(R,V,T,P,C,S)*STG_EFF(R,V,P); + +*--------------------------------------------------------------------- +* Annual undiscounted costs by process/commodity w/out CUR +*--------------------------------------------------------------------- +PARAMETER CST_INVV(R,ALLYEAR,ALLYEAR,P) //; +PARAMETER CST_DECV(R,ALLYEAR,ALLYEAR,P) //; +PARAMETER CST_FIXV(R,ALLYEAR,ALLYEAR,P) //; +PARAMETER CST_SALV(R,ALLYEAR,P) //; +PARAMETER CST_LATV(R,ALLYEAR,P) //; +PARAMETER CST_ACTV(R,ALLYEAR,ALLYEAR,P,TS) //; +PARAMETER CST_FLOV(R,ALLYEAR,ALLYEAR,P,C,TS) //; +PARAMETER CST_COMV(R,ALLYEAR,C,TS) //; +PARAMETER CST_ELSV(R,ALLYEAR,C) //; + +LOOP(CUR, +CST_INVV(RTP_CPTYR(R,V,T,P)) $= PAR_OBJINV(R,V,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); +CST_DECV(RTP_CPTYR(R,V,T,P)) $= PAR_OBJDEC(R,V,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); +CST_SALV(R,V,P) $= PAR_OBJSAL(R,V,P,CUR); +CST_LATV(RTP(R,T,P)) $= PAR_OBJLAT(R,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); +CST_FIXV(RTP_CPTYR(R,V,T,P)) $= PAR_OBJFIX(R,V,T,P,CUR)*(1/OBJ_DISC(R,T,CUR)); +CST_ACTV(RTP_VINTYR(R,V,T,P),TS) $= PAR_OBJACT(R,V,T,P,TS,CUR)*(1/OBJ_DISC(R,T,CUR)); +CST_ELSV(RTC(R,T,C)) $= PAR_OBJELS(R,T,C,CUR)*(1/OBJ_DISC(R,T,CUR)); +CST_FLOV(RTP_VINTYR(R,V,T,P),C,TS) $= PAR_OBJFLO(R,V,T,P,C,TS,CUR)*(1/OBJ_DISC(R,T,CUR)); +CST_COMV(RTC(R,T,C),TS) $= PAR_OBJCOM(R,T,C,TS,CUR)*(1/OBJ_DISC(R,T,CUR)); +); + +*-------------------------------------------------------------------------- +* Production (PRD) and Difference between production and consumption (NET) +*-------------------------------------------------------------------------- + +PAR_COMPRDL(R,T,C,S) $= VAR_COMPRD.L(R,T,C,S); +PAR_COMPRDM(R,T,C,S) $= VAR_COMPRD.M(R,T,C,S)*(1/VDA_DISC(R,T)); +PAR_COMNETL(R,T,C,S) $= VAR_COMNET.L(R,T,C,S); +PAR_COMNETM(R,T,C,S) $= VAR_COMNET.M(R,T,C,S)*(1/VDA_DISC(R,T)); + +*-------------------------------------------------------------------------- +* Undiscounted annual shadow price of commodity balance and peaking equation +*-------------------------------------------------------------------------- + +PAR_COMBALEM(R,T,C,S) $= EQE_COMBAL.M(R,T,C,S)*(1/VDA_DISC(R,T)); +PAR_COMBALGM(R,T,C,S) $= EQG_COMBAL.M(R,T,C,S)*(1/VDA_DISC(R,T)); +PAR_PEAKM(R,T,CG,S) $= EQ_PEAK.M(R,T,CG,S)*(1/VDA_DISC(R,T)); + +*-------------------------------------------------------------------------- +* Shadow prices of user constraints +*-------------------------------------------------------------------------- +* Note: undiscounting only done for user constraints having region and period as index + +$IF '%VAR_UC%'==YES $GOTO UC_VAR + +$ BATINCLUDE par_uc.rpt FXM EQE +$ BATINCLUDE par_uc.rpt LOM EQG +$ BATINCLUDE par_uc.rpt UPM EQL + +$GOTO UC_DONE +$LABEL UC_VAR + +PAR_UCFXM(UC_N,'NONE','NONE','NONE') $= VAR_UC.M(UC_N); +PAR_UCFXM(UC_N,R,'NONE','NONE') $= VAR_UCR.M(UC_N,R); +PAR_UCFXM(UC_N,'NONE',T,'NONE') $= VAR_UCT.M(UC_N,T); +PAR_UCFXM(UC_N,R,T,'NONE') $= VAR_UCRT.M(UC_N,R,T)*(1/VDA_DISC(R,T)); +PAR_UCFXM(UC_N,'NONE',T,S) $= VAR_UCTS.M(UC_N,T,S); +PAR_UCFXM(UC_N,R,T,S) $= VAR_UCRTS.M(UC_N,R,T,S)*(1/VDA_DISC(R,T)); + +$LABEL UC_DONE + +OPTION CLEAR = F_INOUT; +OPTION CLEAR = F_INOUTS; +OPTION CLEAR = F_IOSET; + +*[AL] Added new regional total discounted cost parameter + PARAMETER REG_WOBJ(REG,ITEM,CUR) //; + REG_WOBJ(R,'INV',CUR) = SUM(OBV,SUM_OBJ('OBJINV',OBV)*VAR_OBJ.L(R,OBV,CUR))-VAR_OBJ.L(R,'OBJSAL',CUR); + REG_WOBJ(R,'FIX',CUR) = SUM(OBV,SUM_OBJ('OBJFIX',OBV)*VAR_OBJ.L(R,OBV,CUR)); + REG_WOBJ(R,'VAR',CUR) = SUM(OBV,SUM_OBJ('OBJVAR',OBV)*VAR_OBJ.L(R,OBV,CUR)); + REG_WOBJ(R,'ELS',CUR) = EPS +$IF %TIMESED% == YES +VAR_OBJELS.L(R,'LO',CUR)-VAR_OBJELS.L(R,'UP',CUR) + ; diff --git a/rptmain.stc b/rptmain.stc new file mode 100644 index 0000000..f876a8b --- /dev/null +++ b/rptmain.stc @@ -0,0 +1,125 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* RPTMAIN.stc is the main driver for the report writer for stochastics +* %1, %2 - SOW, %SWS% +*=============================================================================* +$SET EQS '%EQ%' SET V %VAR% +*----------------------------------------------------------------------------- +* VARIABLES & EQUATIONS +*----------------------------------------------------------------------------- +$ BATINCLUDE clearsol.stc DEF +*----------------------------------------------------------------------------- +$IF %ETL%==YES POSITIVE VARIABLES VAR_IC(R,YEAR,PRC) + PARAMETERS SW_UNPB(LL,WW), SW_UNPC(LL,WW); +*----------------------------------------------------------------------------- +$IF %STEPPED%==+ $SET SOLVEDA 1 +$IFI %SPINES%==YES $SHIFT SHIFT +$IFI %SPINES%%SOLVEDA%==YES1 $GOTO DETERRED +*------------------------------------------------------------------------------ +* Reporting parameter declarations +$ SET SOLVEDA 1 +$ BATINCLUDE rptlite.rpt S WW, +*------------------------------------------------------------------------------ + SW_UNPB(SW_T(T,W))=POWER(SW_TPROB(T,W)/SW_NORM,1$SW_PHASE-1); SW_UNPC(T,W) $= SW_UNPB(T,W); + SW_UNPB('0',W)=POWER(SW_PROB(W)/SW_NORM,1$SW_PHASE-1$SW_PROB(W)); +$IF %SPINES%==YES SW_UNPC(SW_T) = 1; +*------------------------------------------------------------------------------ +* Reports based on SOW-specific values +*------------------------------------------------------------------------------ + + LOOP(SOW$SW_PROB(SOW), +*------------------------------------------------------------------------------ +* Clear results from previous SOW +$ BATINCLUDE clearsol.stc +* Get the variable levels + VAR_ACT.L(R,V,T,P,S) $= %VART%_ACT.L(R,V,T,P,S %SWS%); + VAR_BLND.L(R,T,COM,C) $= %VART%_BLND.L(R,T,COM,C %SWS%); + VAR_CAP.L(R,T,P) $= %VART%_CAP.L(R,T,P %2); + VAR_COMNET.L(R,T,COM,S) $= %VART%_COMNET.L(R,T,COM,S %SWS%); + VAR_COMPRD.L(R,T,COM,S) $= %VART%_COMPRD.L(R,T,COM,S %SWS%); + VAR_IRE.L(R,V,T,P,C,S,IE) $= %VART%_IRE.L(R,V,T,P,C,S,IE %SWS%); + VAR_ELAST.L(R,T,C,S,J,BD) $= %VART%_ELAST.L(R,T,C,S,J,BD %SWS%); + VAR_FLO.L(R,V,T,P,C,S) $= %VART%_FLO.L(R,V,T,P,C,S %SWS%); + VAR_NCAP.L(R,T,P) $= %VART%_NCAP.L(R,T,P %2); + VAR_SIN.L(R,V,T,P,C,S) $= %VART%_SIN.L(R,V,T,P,C,S %SWS%); + VAR_SOUT.L(R,V,T,P,C,S) $= %VART%_SOUT.L(R,V,T,P,C,S %SWS%); + VAR_UPS.L(R,V,T,P,S,L) $= %VART%_UPS.L(R,V,T,P,S,L %SWS%); + VAR_UPT.L(R,V,T,P,S,UPT) $= %VART%_UPT.L(R,V,T,P,S,UPT %SWS%); + VAR_UDP.L(R,V,T,P,S,L) $= %VART%_UDP.L(R,V,T,P,S,L %SWS%); + VAR_SCAP.L(R,V,T,P) $= %VART%_SCAP.L(R,V,T,P%2); VAR_SCAP.L(R,V,'0',P) $= %VAR%_SCAP.L(R,V,'0',P,%1); +$IF %ETL% == YES OPTION CLEAR=VAR_IC; VAR_IC.L(R,T,P) $= %VART%_IC.L(R,T,P %2); + +* Get variable marginals + VAR_ACT.M(R,V,T,P,S) $= %VART%_ACT.M(R,V,T,P,S,W)*SW_UNPB(T%SWS%); + VAR_CAP.M(R,T,P) $= SUM(SW_TSW(%1,T,W),%VAR%_CAP.M(R,T,P,W)*SW_UNPC(T,W)); + VAR_NCAP.M(R,T,P) $= SUM(SW_TSW(%1,T,W),%VAR%_NCAP.M(R,T,P,W)*SW_UNPC(T,W)); + VAR_COMNET.M(R,T,COM,S) $= %VART%_COMNET.M(R,T,COM,S,W)*SW_UNPB(T%SWS%); + VAR_COMPRD.M(R,T,COM,S) $= %VART%_COMPRD.M(R,T,COM,S,W)*SW_UNPB(T%SWS%); + VAR_FLO.M(R,V,T,P,C,S) $= %VART%_FLO.M(R,V,T,P,C,S,W)*SW_UNPB(T%SWS%); + +* Get equation marginals + EQG_COMBAL.M(R,T,C,S) $= SUM(SW_TSW(SOW,T,W),%EQ%G_COMBAL.M(R,T,C,S,T,W)*SW_UNPB(T,W)); + EQE_COMBAL.M(R,T,C,S) $= SUM(SW_TSW(SOW,T,W),%EQ%E_COMBAL.M(R,T,C,S,T,W)*SW_UNPB(T,W)); + EQE_COMPRD.M(R,T,C,S) $= SUM(SW_TSW(SOW,T,W),%EQ%E_COMPRD.M(R,T,C,S,T,W)*SW_UNPB(T,W)); + EQ_PEAK.M(R,T,CG,S) $= SUM(SW_TSW(SOW,T,W),%EQ%_PEAK.M(R,T,CG,S,T,W)*SW_UNPB(T,W)); + EQ_IRE.M(R,T,P,C,IE,S) $= SUM(SW_TSW(SOW,T,W),%EQ%_IRE.M(R,T,P,C,IE,S,T,W)*SW_UNPB(T,W)); + EQE_CPT.M(R,T,P) $= SUM(SW_TSW(%1,T,W),%EQ%E_CPT.M(R,T,P,T,W)*SW_UNPC(T,W)); + EQG_COMBAL.L(R,T,C,S) $= %EQ%G_COMBAL.L(R,T,C,S,T,SOW); + +*----------------------------------------------------------------------------- +* Calculate the reporting parameters +*----------------------------------------------------------------------------- +* Calculation of solution values for (due to reduction) substituted flows +*----------------------------------------------------------------------------- + OPTION CLEAR=PAR_FLO,CLEAR=PAR_FLOM; +$ BATINCLUDE sol_flo.red PAR_FLO '' .L +$ BATINCLUDE sol_flo.red PAR_FLO M .M +$ BATINCLUDE sol_ire.rpt +*----------------------------------------------------------------------------- +* Objective function +*----------------------------------------------------------------------------- + OPTION CLEAR=COEF_OBJINV; +$ BATINCLUDE rpt_obj.rpt S SOW, ,SOW %SYSPREFIX% +*----------------------------------------------------------------------------- +* Calculation of annual costs +*----------------------------------------------------------------------------- +$ BATINCLUDE cost_ann.rpt S SOW, +*----------------------------------------------------------------------------- +* Miscellaneous reportings + EQN_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD('FX')) $= SUM(SW_TSW(SOW,T,W),%EQ%E_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)*SW_UNPB(T,W)); + EQN_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BDNEQ(BD)) $= SUM(SW_TSW(SOW,T,W),%EQ%N_UCRTP.M(UC_N,R,T,P,UC_GRPTYPE,BD,T,W)*SW_UNPB(T,W)); + +$ BATINCLUDE rptmisc.rpt S SOW, ,SOW ,W)*SW_UNPB(T,W) ,SOW)*SW_UNPB('0',SOW + +* Non-common reporting + SPAR_CAPLO(SOW,RTP(R,T,P)) $= S_CAP_BND(RTP,'LO','1',SOW); + SPAR_CAPUP(SOW,RTP(R,T,P))$(S_CAP_BND(RTP,'UP','1',SOW)0)$(COM_PROJ(R,T,C)>0)$DEM(R,C)) = COM_PROJ(R,T,C); + +TM_ERR('DEM') = SMAX((R,T,C)$TM_DEM(R,T,C),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); +TM_ERR('GDP') = SMAX((REG,T),ABS(TM_GDPGOAL(REG,T)-TM_GDP(REG,T))/TM_GDPGOAL(REG,T)); + +* Reporting parameters + TM_RESULT('TM_GDP-REF',MR,T) = TM_GDPGOAL(MR,T)$DONE; + TM_RESULT('TM_GDP-ACT',MR,T) = TM_GDP(MR,T); + TM_RESULT('TM_PRD-Y',MR,T) = PAR_Y(MR,T); + TM_RESULT('TM_CON-C',MR,T) = VAR_C.L(MR,T); + TM_RESULT('TM_CAP-K',MR,T) = VAR_K.L(MR,T); + TM_RESULT('TM_INV-I',MR,T) = VAR_INV.L(MR,T); + TM_RESULT('TM_ESCOST',MR,T) = VAR_EC.L(MR,T); + TM_RESULT('TM_GDPLOS',MR,T)$DONE = 100*(TM_GDPGOAL(MR,T)-TM_GDP(MR,T))/TM_GDPGOAL(MR,T); + +$ INCLUDE ddfupd.msa +$ BATINCLUDE writeddf.msa DDFNEW TM_GR diff --git a/rptmisc.rpt b/rptmisc.rpt new file mode 100644 index 0000000..f03ae28 --- /dev/null +++ b/rptmisc.rpt @@ -0,0 +1,276 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* RPTMISC.rpt: Miscellaneous shared reportings +* %1 - Prefix for parameter names (optional) +* %2 - SOW, (optional) +* %3 - %SOW% +*=============================================================================* + R_DF(R,T) = SIGN(COEF_PVT(R,T))/MAX(1E-9,ABS(COEF_PVT(R,T))); +*----------------------------------------------------------------------------- +* Activity levels & marginals +*----------------------------------------------------------------------------- + %1PAR_ACTL(%2RTP_VINTYR(R,V,T,P),S)$PRC_TS(R,P,S) $= VAR_ACT.L(R,V,T,P,S); +* Shift up STS activity levels + LOOP((RP_STL(R,P,TSL,BD),TS_GROUP(R,TSL,TS))$RLUP(R,'DAYNITE',TSL),Z=G_YRFR(R,TS)*365/TS_CYCLE(R,TS); + YKVAL(VNT(V,T))=SMIN(RS_BELOW(R,TS,S),VAR_ACT.L(R,VNT,P,S)/Z)$NCAP_YES(R,V,P); + %1PAR_ACTL(%2R,VNT,P,S)$(TS_MAP(R,TS,S)$YKVAL(VNT))=VAR_ACT.L(R,VNT,P,S)+YKVAL(VNT)*(1-(1+Z)$RS_BELOW(R,TS,S))); + Z = (RPT_OPT('ACT','2') GE 0); + %1PAR_ACTM(%2R,V,T,P,S)$VAR_ACT.M(R,V,T,P,S) = ROUND(VAR_ACT.M(R,V,T,P,S)*R_DF(R,T),7)$Z; + %1PAR_ACTM(%2R,'0',T,P,S) $= EQL_ACTBND.M(R,T,P,S)*R_DF(R,T); + %1PAR_ACTM(%2R,'0',T,P,S) $= EQG_ACTBND.M(R,T,P,S)*R_DF(R,T); + %1PAR_ACTM(%2R,'0',T,P,S) $= EQE_ACTBND.M(R,T,P,S)*R_DF(R,T); + +*----------------------------------------------------------------------------- +* Capacity +*----------------------------------------------------------------------------- + OPTION CLEAR=RTP_CAPYR,CLEAR=COEF_CAP; + RTP_CAPYR(RTP_CPTYR(R,TT,T,P))$VAR_NCAP.L(R,TT,P) = YES; + VAR_CAP.M(RTP)$(NOT VAR_CAP.M(RTP)) $= EQE_CPT.M(RTP); + + %1PAR_CAPL(%2RTP(R,T,P)) = SUM(RTP_CAPYR(R,TT,T,P), COEF_CPT(R,TT,T,P)*VAR_NCAP.L(R,TT,P)); + %1PAR_PASTI(%2RTP(R,T,P),'0') = SUM(PYR(K)$COEF_CPT(R,K,T,P),COEF_CPT(R,K,T,P)*NCAP_PASTI(R,K,P)-RTFORC(R,K,T,P)$PYR_S(K)); + +$IF DEFINED VNRET COEF_CAP(R,V,T,P)$=VAR_SCAP.L(R,V,T,P); %1PAR_PASTI(%2RTP(R,T,P),'')$PRC_RCAP(R,P) = -SUM(VNRET(V,T),COEF_CAP(R,V,T,P)*COEF_CPT(R,V,T,P)-RTFORC(R,V,T,P)); + %1PAR_CAPM(%2RTP(R,T,P)) $= VAR_CAP.M(RTP)*R_DF(R,T); + %1PAR_CAPLO(%2RTP) $= CAP_BND(RTP,'LO'); + %1PAR_CAPUP(%2RTP_OFF(RTP))$RCAP_BND(RTP,'N') $= PRC_RESID(RTP); + %1PAR_CAPUP(%2RTP)$(CAP_BND(RTP,'UP') NE INF) $= CAP_BND(RTP,'UP'); + + %1PAR_NCAPL(%2RTP(R,V,P)) $= VAR_NCAP.L(RTP); + %1PAR_NCAPM(%2RTP)$(VAR_NCAP.M(RTP)*COEF_OBJINV(RTP)) = VAR_NCAP.M(RTP)/COEF_OBJINV(RTP); + +*----------------------------------------------------------------------------- +* Commodities +*----------------------------------------------------------------------------- +* Variables + %1PAR_COMPRDL(%2R,T,C,S) $= VAR_COMPRD.L(R,T,C,S); + %1PAR_COMPRDM(%2R,T,C,S) $= VAR_COMPRD.M(R,T,C,S)*R_DF(R,T); + %1PAR_COMNETL(%2R,T,C,S) $= VAR_COMNET.L(R,T,C,S); + %1PAR_COMNETM(%2R,T,C,S) $= VAR_COMNET.M(R,T,C,S)*R_DF(R,T); + OPTION AGR < COM_AGG; + %1AGG_OUT(%2R,T,C,S)$(RTCS_VARC(R,T,C,S)$AGR(R,C)) = + SUM(RTC(R,T,COM)$COM_AGG(RTC,C),COM_AGG(RTC,C) * + SUM(RTCS_VARC(RTC,TS)$RS_FR(R,S,TS),RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) * + (VAR_COMNET.L(RTC,TS)$RC_AGP(R,COM,'LO') + VAR_COMPRD.L(RTC,TS)$RC_AGP(R,COM,'FX')))); + OPTION CLEAR=AGR; + +* Equations + %1PAR_COMBALEM(%2R,T,C,S) $= EQG_COMBAL.M(R,T,C,S)*R_DF(R,T); + %1PAR_COMBALEM(%2R,T,C,S) $= EQE_COMBAL.M(R,T,C,S)*R_DF(R,T); + %1PAR_PEAKM(%2R,T,CG,S) $= EQ_PEAK.M(R,T,CG,S)*R_DF(R,T); +$IF %1==S %1PAR_COMBALGM(%2RTC,S) $= EQG_COMBAL.L(RTC,S); + +*----------------------------------------------------------------------------- +* Process flows +*----------------------------------------------------------------------------- + OPTION CLEAR=UNCD1,CLEAR=RTP_CAPYR,CLEAR=F_INOUT; + F_INOUT(R,V,T,P,C,'IN')$COEF_ICOM(R,V,T,P,C) = COEF_ICOM(R,V,T,P,C) * RTP_CAPVL(R,V,P); + F_INOUT(R,V,T,P,C,'OUT')$COEF_OCOM(R,V,T,P,C) = COEF_OCOM(R,V,T,P,C) * RTP_CAPVL(R,V,P); + F_INOUT(RTP_CPTYR(R,V,T,P),C,IO)$NCAP_COM(R,V,P,C,IO) = F_INOUT(R,V,T,P,C,IO) + + (RTP_CAPVL(R,V,P)-COEF_CAP(R,V,T,P)) * COEF_CPT(R,V,T,P) * NCAP_COM(R,V,P,C,IO) * (1+COEF_CIO(R,V,T,P,C,IO)); + F_INOUTS(R,V,T,P,C,ANNUAL(S),IO)$F_INOUT(R,V,T,P,C,IO) = F_INOUTS(R,V,T,P,C,S,IO)+F_INOUT(R,V,T,P,C,IO); + +* inputs: main flows & emissions, aux flows & emissions + %1F_IN(%2R,V,T,P,C,S)$TOP(R,P,C,'IN') $= PAR_FLO(R,V,T,P,C,S); + %1F_IN(%2R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'EXP'); + %1F_IN(%2R,V,T,P,C,S)$RPCS_VAR(R,P,C,S) $= VAR_SIN.L(R,V,T,P,C,S); + %1F_IN(%2R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'IN') = %1F_IN(%2R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'IN'); +* outputs: main flows & emissions, aux flows & emissions + PAR_FLO(R,V,T,P,C,S)$RPCS_VAR(R,P,C,S) $= VAR_SOUT.L(R,V,T,P,C,S)*STG_EFF(R,V,P); + %1F_OUT(%2R,V,T,P,C,S)$TOP(R,P,C,'OUT') $= PAR_FLO(R,V,T,P,C,S); + %1F_OUT(%2R,V,T,P,C,S) $= PAR_IRE(R,V,T,P,C,S,'IMP'); + %1F_OUT(%2R,V,T,P,C,S)$F_INOUTS(R,V,T,P,C,S,'OUT') = %1F_OUT(%2R,V,T,P,C,S)+F_INOUTS(R,V,T,P,C,S,'OUT'); +*----------------------------------------------------------------------------- +* Filter out small values if requested + IF(SUM(UC_GRPTYPE$RPT_OPT(UC_GRPTYPE,'9'),1),RPT_OPT(UC_GRPTYPE,'9')$(RPT_OPT(UC_GRPTYPE,'9')>.1)=0; + Z=RPT_OPT('ACT','9'); IF(Z>0,%1PAR_ACTL(%2R,V,T,P,S)$((%1PAR_ACTL(%2R,V,T,P,S)0,%1PAR_CAPL(%2RTP)$((%1PAR_CAPL(%2RTP)0,%1PAR_NCAPL(%2RTP)$((%1PAR_NCAPL(%2RTP)0,%1F_OUT(%2R,V,T,P,C,S)$((ABS(%1F_OUT(%2R,V,T,P,C,S))1); + NCAP_YES(R,T,P)$(VAR_NCAP.L(R,T,P)*COEF_RTP(R,T,P)$RP_INOUT(R,P,'OUT')=0)=NO; + PASTSUM(R,T,P)$%1PAR_CAPL(%2R,T,P) = %1PAR_CAPL(%2R,T,P)+SUM(PASTCV,%1PAR_PASTI(%2R,T,P,PASTCV))+1-1; +* Calculate ENV credit + LOOP(COM_LIM(ENV(R,C),'LO')$Z,TRACKC(R,C)=YES;TRACKP(R,P)$(PRC_MAP(R,'PRE',P)$TOP(R,P,C,'OUT'))=YES); + TRACKPC(TRACKP(R,P),C)$(NRG(R,C)$TOP(R,P,C,'OUT'))=YES; TRACKC(R,C)$SUM(TRACKPC(R,P,C),1)=YES; + VDA_EMCB(R,T,C,C)$(NRG(R,C)$TRACKC(R,C)) = + MIN(SUM(TRACKC(ENV(R,COM)),MIN(0,COM_AGG(R,T,C,COM)*%1PAR_COMBALEM(%2R,T,COM,SL))), + SUM(P$TRACKPC(R,P,C), + SUM((VNT(V,T),S)$%1F_OUT(%2R,V,T,P,C,S),%1F_OUT(%2R,V,T,P,C,S))/MAX(MICRO,SUM((TRACKPC(R,P,COM2),VNT(V,T),S)$%1F_OUT(%2R,V,T,P,COM2,S),%1F_OUT(%2R,V,T,P,COM2,S))) * + SUM((VNT(V,T),TRACKC(ENV(R,COM)))$%1F_OUT(%2R,V,T,P,COM,SL),%1F_OUT(%2R,V,T,P,COM,SL)*MIN(0,%1PAR_COMBALEM(%2R,T,COM,SL)))) / + MAX(MICRO,SUM((VNT(V,T),P,S)$%1F_OUT(%2R,V,T,P,C,S),%1F_OUT(%2R,V,T,P,C,S))+SUM(S$%1AGG_OUT(%2R,T,C,S),%1AGG_OUT(%2R,T,C,S)))); + OPTION CLEAR=TRACKP,CLEAR=TRACKPC,CLEAR=COEF_CAP; TRACKC(NRG)=NO; +* Credit for aux energy ouputs (ELE+CHP+HPL) + OPTION RP_PRC < NCAP_YES; TRACKP(RP_PRC(RP))=ELE(RP)+CHP(RP)+HPL(RP); + TRACKPC(TRACKP(R,P),C)$(TOP(R,P,C,'OUT')$(NOT RPC_PG(R,P,C)*(NRGELC(R,C)+(NOT CHP(R,P))))$NRG(R,C))=YES; + OPTION TRACKP < TRACKPC; + IF(Z,COEF_CAP(RTP_VINTYR(R,V,T,P))$TRACKP(R,P)=1-1/(1+SUM(RPCS_VAR(TRACKPC(R,P,C),S),PAR_FLO(R,V,T,P,C,S))/MAX(MICRO,SUM(RPCS_VAR(RPC_PG(R,P,C),S)$(NOT TRACKPC(R,P,C)),PAR_FLO(R,V,T,P,C,S))))); + IF(F=1,RP_GRP(RPC_PG(RP_PRC,C))$(NOT TRACKPC(RPC_PG))=YES); +* Credit for peak capacity + LOOP((COM_PEAK(R,CG),COM_GMAP(R,CG,C)),TRACKPG(RP_PRC(R,P),C)$TOP(R,P,C,'OUT')=YES; + PAR_RTCS(RTCS_VARC(R,T,C,S))=SUM(COM_PKTS(R,CG,TS)$RS_TREE(R,S,TS),%1PAR_PEAKM(%2R,T,CG,TS)/(1+MAX(COM_PKRSV(R,T,C),SUM(COM(CG),COM_PKRSV(R,T,COM))))*RS_FR(R,TS,S))*COM_IE(R,T,C,S)); + OPTION RP_PRC < RPC_PKC; RP_PRC(RP)$(F<2)=NO; TRACKPG(RPC_PG(RP_PRC,C))=NO; +* Cost ratio for vintaged + %1PAR_NCAPR(%2NCAP_YES(R,TT(V),P),SYSUC)$PRC_VINT(R,P) = + (COEF_RTP(R,V,P)*VAR_NCAP.L(R,V,P) + + SUM(RTP_VINTYR(R,V,T,P),COEF_PVT(R,T) * + (SUM(RPM,%1CST_ACTC(%2R,V,T,P,RPM)) + + SUM(TOP(R,P,C,'IN'),(1-COEF_CAP(R,V,T,P)) * (%1CST_FLOC(%2R,V,T,P,C)+%1CST_FLOX(%2R,V,T,P,C) + + SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_IN(%2R,V,T,P,C,TS), + (%1PAR_COMBALEM(%2R,T,C,S)+VDA_EMCB(R,T,C,C))*%1F_IN(%2R,V,T,P,C,TS)*RS_FR(R,S,TS))$(NOT TRACKC(R,C)))) + + SUM(TOP(R,P,C,'OUT')$(NOT TRACKPC(R,P,C)$Z),%1CST_FLOC(%2R,V,T,P,C)+%1CST_FLOX(%2R,V,T,P,C) - + SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_OUT(%2R,V,T,P,C,TS), + (%1PAR_COMBALEM(%2R,T,C,S)*COM_IE(R,T,C,S)+(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*PAR_RTCS(R,T,C,S)$TRACKPG(R,P,C))*%1F_OUT(%2R,V,T,P,C,TS)*RS_FR(R,S,TS))$(NOT RP_GRP(R,P,C))$F) - + SUM((RPC_PG(RP_PRC(R,P),C),COM_TS(R,C,S)),NCAP_PKCNT(R,V,P,S)*PAR_RTCS(R,T,C,S)*VAR_NCAP.L(R,V,P)*G_YRFR(R,S)*PRC_CAPACT(R,P)*PRC_ACTFLO(R,V,P,C))))) / + MAX(MICRO,SUM(RTP_CPTYR(R,V,T,P),COEF_PVT(R,T)*SUM(RPCS_VAR(RPC_PG(R,P,C),S)$(NOT TRACKPC(R,P,C)),PAR_FLO(R,V,T,P,C,S)))); +* Cost ratio for non-vintaged + %1PAR_NCAPR(%2NCAP_YES(R,TT(V),P),SYSUC)$(NOT PRC_VINT(R,P)) = + (COEF_RTP(R,V,P) + + SUM(RTP_CPTYR(R,V,T,P)$PASTSUM(R,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)/PASTSUM(R,T,P) * + (SUM(RPM,%1CST_ACTC(%2R,T,T,P,RPM)) + + SUM(TOP(R,P,C,'IN'),(1-COEF_CAP(R,T,T,P)) * (%1CST_FLOC(%2R,T,T,P,C)+%1CST_FLOX(%2R,T,T,P,C) + + SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_IN(%2R,T,T,P,C,TS), + (%1PAR_COMBALEM(%2R,T,C,S)+VDA_EMCB(R,T,C,C))*%1F_IN(%2R,T,T,P,C,TS)*RS_FR(R,S,TS))$(NOT TRACKC(R,C)))) + + SUM(TOP(R,P,C,'OUT')$(NOT TRACKPC(R,P,C)$Z),%1CST_FLOC(%2R,T,T,P,C)+%1CST_FLOX(%2R,T,T,P,C) - + SUM((COM_TS(R,C,S),RS_TREE(R,S,TS))$%1F_OUT(%2R,T,T,P,C,TS), + (%1PAR_COMBALEM(%2R,T,C,S)*COM_IE(R,T,C,S)+(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*PAR_RTCS(R,T,C,S)$TRACKPG(R,P,C))*%1F_OUT(%2R,T,T,P,C,TS)*RS_FR(R,S,TS))$(NOT RP_GRP(R,P,C))$F) - + SUM((RPC_PG(RP_PRC(R,P),C),COM_TS(R,C,S)),NCAP_PKCNT(R,V,P,S)*PAR_RTCS(R,T,C,S)*PASTSUM(R,T,P)*G_YRFR(R,S)*PRC_CAPACT(R,P)*PRC_ACTFLO(R,V,P,C))))) / + MAX(MICRO,SUM(RTP_CPTYR(R,V,T,P)$PASTSUM(R,T,P),COEF_PVT(R,T)*COEF_CPT(R,V,T,P)/PASTSUM(R,T,P)*SUM(RPCS_VAR(RPC_PG(R,P,C),S)$(NOT TRACKPC(R,P,C)),PAR_FLO(R,T,T,P,C,S)))); + OPTION CLEAR=TRACKP,CLEAR=TRACKC,CLEAR=TRACKPC,CLEAR=TRACKPG,CLEAR=VDA_EMCB,CLEAR=PASTSUM,CLEAR=PAR_RTCS,CLEAR=COEF_CAP; + ); +* Fallback of flows to ANNUAL level + LOOP(ANNUAL(TS)$CARD(UNCD1), + LOOP(UNCD1(COM_TYPE(CG)),TRACKC(R,C)$COM_TMAP(R,COM_TYPE,C)=RPT_OPT(CG,'3')<0); + LOOP(UNCD1(NRG_TYPE(U2))$RPT_OPT(U2,'3'),TRACKC(R,C)$NRG_TMAP(R,NRG_TYPE,C)=RPT_OPT(U2,'3')<0); + RVTPC(R,V,T,P,C)$TRACKC(R,C) $= SUM(S$%1F_IN(%2R,V,T,P,C,S),STOA(S)); + F_IOS(RVTPC,TS) = SUM(S$%1F_IN(%2RVTPC,S),%1F_IN(%2RVTPC,S)); + %1F_IN(%2RVTPC,S) = 0; %1F_IN(%2RVTPC,S) $= F_IOS(RVTPC,S); + OPTION CLEAR=RVTPC,CLEAR=F_IOS; + RVTPC(R,V,T,P,C)$TRACKC(R,C) $= SUM(S$%1F_OUT(%2R,V,T,P,C,S),STOA(S)); + F_IOS(RVTPC,TS) = SUM(S$%1F_OUT(%2RVTPC,S),%1F_OUT(%2RVTPC,S)); + %1F_OUT(%2RVTPC,S) = 0; %1F_OUT(%2RVTPC,S) $= F_IOS(RVTPC,S); + OPTION CLEAR=TRACKC,CLEAR=RVTPC,CLEAR=F_IOS; + ); \ No newline at end of file diff --git a/sensis.stc b/sensis.stc new file mode 100644 index 0000000..abf686a --- /dev/null +++ b/sensis.stc @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* sensis.stc Wrapper for sensitivity analysis parameters +*=============================================================================* +$IFI %MCA%==YES $BATINCLUDE main_ext.mod coef_ext MCA +*------------------------------------------------------------------------------ +* Clear deterministic parameter if to be set from uncertain +$IF %CLI%==YES OPTION CLEAR=CM_MAXC; +$IF DEFINED RTP_FFCS OPTION CLEAR=RTP_FFCS; +* Cumulative variable bounds + VAR_CUMFLO.LO(R,P,C,ALLYEAR,LL) = 0; + VAR_CUMFLO.UP(R,P,C,ALLYEAR,LL) = INF; + VAR_CUMCOM.LO(R,C,COM_VAR,ALLYEAR,LL) = 0; + VAR_CUMCOM.UP(R,C,COM_VAR,ALLYEAR,LL) = INF; +*------------------------------------------------------------------------------ + LOOP(SOW, +$ BATINCLUDE bnd_ucw.mod '' I +$ BATINCLUDE bnd_set.mod %VAR%_CAP 'R,T,P' CAP_BND RTP(RT_PP(R,T),P) '' I +* Cumulative variable bounds + VAR_CUMFLO.LO(R,P,C,YEAR,LL)$S_FLO_CUM(R,P,C,YEAR,LL,'LO','1',SOW) = S_FLO_CUM(R,P,C,YEAR,LL,'LO','1',SOW)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); + VAR_CUMFLO.UP(R,P,C,YEAR,LL)$S_FLO_CUM(R,P,C,YEAR,LL,'UP','1',SOW) = S_FLO_CUM(R,P,C,YEAR,LL,'UP','1',SOW)*(1/%CUFSCAL%)*(FLO_CUM(R,P,C,YEAR,LL,'N')+1); + S_COM_CUM(RC_CUMCOM(R,COM_VAR,YEAR,LL,C),L('LO'),'1',SOW)$(NOT S_COM_CUM(RC_CUMCOM,L,'1',SOW)) = -INF$SUM((RTC(R,T,C),ANNUAL(S)),MIN(0,COM_BNDPRD(RTC,S,L)$DIAG(COM_VAR,'PRD')+COM_BNDNET(RTC,S,L)$DIAG(COM_VAR,'NET')+1-1)); + VAR_CUMCOM.LO(R,C,COM_VAR,YEAR,LL)$S_COM_CUM(R,COM_VAR,YEAR,LL,C,'LO','1',SOW) = S_COM_CUM(R,COM_VAR,YEAR,LL,C,'LO','1',SOW)*(1/%CUCSCAL%)*(COM_CUM(R,COM_VAR,YEAR,LL,C,'N')+1); + VAR_CUMCOM.UP(R,C,COM_VAR,YEAR,LL)$S_COM_CUM(R,COM_VAR,YEAR,LL,C,'UP','1',SOW) = S_COM_CUM(R,COM_VAR,YEAR,LL,C,'UP','1',SOW)*(1/%CUCSCAL%)*(COM_CUM(R,COM_VAR,YEAR,LL,C,'N')+1); + +$ IF NOT DEFINED RTP_FFCS $GOTO DIDFUNC + RTP_FFCS(RTP(R,T,P),CG,COM_GRP)$RP_FFSGG(R,P,CG,COM_GRP) = + SUM((RP_FFSGGM(R,P,CG,COM_GRP,CG1,CG2),SW_TSW(SOW,T,W)),PROD(SW_MAP(T,W,J,WW)$S_FLO_FUNC(RTP,CG1,CG2,J,WW),S_FLO_FUNC(RTP,CG1,CG2,J,WW))-1); +* Remap reduced FUNC flows + LOOP(RPCG_PTRAN(RP,C,COM,CG,CG2)$RP_FFSGG(RP,CG,CG2),IF(RPC_FFUNC(RP,C),RP_DCGG(RP,C,CG,CG2,'UP')=YES; ELSE RP_DCGG(RP,COM,CG,CG2,'LO')=YES)); + RP_DCGG(RPC_FFUNC(RP,COM),CG,C,'UP')$(RPG_1ACE(RP,CG,COM)$RPC_ACT(RP,C)) $= RP_FFSGG(RP,CG,C); + RTP_FFCS(RTP(R,T,P),ACTCG,C)$RPC_FFUNC(R,P,C) $= SUM(RP_DCGG(R,P,C,CG,CG2,L),(POWER(RTP_FFCS(RTP,CG,CG2)+1,BDSIG(L))-1)$(RTP_FFCS(RTP,CG,CG2)+1)); + OPTION CLEAR=RP_DCGG; +$ LABEL DIDFUNC +$ IF %CLI%==YES CM_MAXC(ALLYEAR,ITEM) $= S_CM_MAXC(ALLYEAR,ITEM,'1',SOW); + ); +*------------------------------------------------------------------------------ + IF(SW_PHASE=2,SPAR_UCSL(SOW,UC_N,U2,U3,U4)=0); + IF(CARD(REG_FIXT)=0,EQ_OBJ.M$(%MODEL_NAME%.SOLVEOPT<>1)=0; OPTION SOLVEOPT=REPLACE); +$ BATINCLUDE clearsol.stp $EQ_OBJ.M diff --git a/setglobs.gms b/setglobs.gms new file mode 100644 index 0000000..d1162e5 --- /dev/null +++ b/setglobs.gms @@ -0,0 +1,358 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*========================================================================= +* Setglobs initializes System Declarations and Global Controls +* %1 - optional variable label to jump +*========================================================================= +$ SETARGS X1 X2 +* --- FIXT Dump --- +$ IF NOT SET FIXBOH $KILL REG_FIXT +* --- DATA Dump --- +$ IF NOT %DATAGDX%==YES $GOTO SYSD +$ IF NOT ERRORFREE $GOTO SYSD +$ GDXOUT _dd_.gdx +$ IF %G2X6%==YES +$ IF gamsversion 342 $UNLOAD XPT +$ UNLOAD +$ GDXOUT +$ IF NOT warnings $GOTO SYSD +$ IF NOT ERRORFREE $ABORT GAMS cannot filter domain violations +$ IF %G2X6%==YES $BATINCLUDE gdxfilter MAIN +*------------------ +$ LABEL SYSD +*---------------------------------------------------------------------------------------------- +* SYSTEM (Internal) Declarations +*---------------------------------------------------------------------------------------------- +* SET SECTION +*---------------------------------------------------------------------------------------------- +* commodities + SET RC(R,C) 'Commodities in each region'; + SET RCJ(R,C,J,BD) '# of steps for elastic demands'; + SET RC_AGP(REG,COM,LIM) 'Commodity aggregation of production'; + SET RTC_NET(R,ALLYEAR,C) 'VAR_COMNETs within CUM constraint range'; + SET RTC_PRD(R,ALLYEAR,C) 'VAR_COMPRDs within CUM constraint range'; + SET RHS_COMBAL(R,ALLYEAR,C,S) 'VAR_COMNET needed on balance'; + SET RHS_COMPRD(R,ALLYEAR,C,S) 'VAR_COMPRD needed on production'; + SET RCS_COMBAL(R,ALLYEAR,C,S,LIM) 'TS for balance given RHS requirements'; + SET RCS_COMPRD(R,ALLYEAR,C,S,LIM) 'TS for production given RHS requirements'; + SET RCS_COMTS(R,C,ALL_TS) 'All timeslices at/above the COM_TSL'; + SET RD_AGG(REG,COM) 'Micro aggregated demands' //; + SET MI_DMAS(REG,COM,COM) 'Micro aggregation map' //; + +* currency + SET RDCUR(REG,CUR) 'Discounted currencies by region'; + SET OBJ_ICUR(REG,ALLYEAR,P,CUR) 'Capacity-related cost indicator'; + +* commodity types (basic) + SET DEM(REG,COM) 'Demand commodities' //; + SET ENV(REG,COM) 'Environmental indicator commodities' //; + SET FIN(REG,COM) 'Financial flow commodities' //; + SET MAT(REG,COM) 'Material commodities' //; + SET NRG(REG,COM) 'Energy carrier commodities' //; + +* process + SET RP(R,P) 'Processes in each region' //; + SET RP_FLO(R,P) 'Processes with VAR_FLOs (not IRE)' //; + SET RP_STD(R,P) 'Standard processes with VAR_FLOs' //; + SET RP_STG(R,P) 'Storage processes' //; + SET RP_IRE(ALL_REG,P) 'Processes involved in inter-regional trade'//; + SET RP_NRG(R,P) 'Processes with an energy carrier PCG' //; + SET RP_INOUT(R,P,IO) 'Indicator if process input/output normalized (according to PG side)'//; + SET RP_PG(REG,PRC,CG) 'Primary commodity group (PG)' //; + SET RP_PGTYPE(R,P,CG) 'Group type of the primary group' //; + SET RP_UPL(R,P,L) 'Processes with dispatching equations' //; + SET RP_UPR(R,P,L) 'Processes with ramping costs' //; + SET RP_UPS(R,P,TSLVL,L) 'Timeslice levels for startup accounting'//; + SET RP_UPT(R,P,UPT,BD) 'Start-up types for unit commitment' //; + SET RP_DPL(R,P,TSLVL) 'Dispatching process timeslice levels' //; + SET RP_AIRE(R,P,IE) 'Exchange process activity directions' //; + SET RPC(R,P,C) 'Commodities in/out of a processes' //; + SET RPC_CAPFLO(R,ALLYEAR,P,C) 'Commodities involved in capacity' //; + SET RPC_CONLY(R,ALLYEAR,P,C) 'Commodities ONLY involved in capacity' //; + SET RPC_NOFLO(R,P,C) 'Commodities ONLY involved in capacity' //; + SET RPC_IRE(ALL_REG,P,C,IE) 'Process/commodities involved in inter-regional trade'//; + SET RPC_EQIRE(R,P,C,IE) 'Indicator for EQIRE equation generation'//; + SET RPC_MARKET(R,P,C,IE) 'Market exchange process indicator' //; + SET RPC_PG(R,P,C) 'Commodities in the primary group' //; + SET RPC_SPG(R,P,C) 'Commodities in the shadow primary group'//; + SET RPCS_VAR(R,P,C,ALL_TS) 'Timeslices at which VAR_FLOs are to be created'//; + SET RPS_S1(R,P,ALL_TS) 'All timeslices at the PRC_TSL/COM_TSLspg'//; + SET RPS_S2(R,P,ALL_TS) 'All timeslices at/above PRC_TSL/COM_TSLspg'//; + SET RPS_PRCTS(R,P,ALL_TS) 'All timeslices at/above the PRC_TSL' //; + SET RTC(R,ALLYEAR,C) 'Commodity/time' //; + SET RTC_SHED(R,YEAR,C,BD,J) 'Elastic shape indexes' //; + SET RTCS_VARC(R,ALLYEAR,C,ALL_TS) 'The VAR_COMNET/PRDs control set' //; + SET RTP(R,ALLYEAR,P) 'Process/time' //; + SET RTPC(R,ALLYEAR,P,C) 'Commodities of process in period' //; + SET RTP_CPTYR(R,ALLYEAR,ALLYEAR,P) 'Capcity transfer v/t years' //; + SET RTP_OFF(R,ALLYEAR,P) 'Periods for which VAR_NCAP.UP = 0' //; + SET RTPCS_VARF(ALL_REG,ALLYEAR,P,C,ALL_TS) 'The VAR_FLOs control set' //; + SET RTP_VARA(R,ALLYEAR,P) 'The VAR_ACT control set' //; + SET RTP_VARP(R,T,P) 'RTPs that have a VAR_CAP' //; + SET RTP_VINTYR(REG,ALLYEAR,ALLYEAR,PRC) 'v/t years according to vintaging'//; + SET RTP_TT(R,YEAR,T,PRC) 'Retrofit control periods' //; + SET RVP(R,ALLYEAR,P) 'ALIAS(RTP) for Process/time' //; + SET RTP_CAPYR(R,YEAR,YEAR,P) 'Capacity vintage years' //; + SET RTP_ISHPR(REG,ALLYEAR,PRC)'Attribute existence indicator' //; + SET RTP_CGC(REG,YEAR,P,CG,CG) 'Multi-purpose work set' //; + SET RTPS_BD(R,ALLYEAR,P,S,BD) 'Multi-purpose work set' //; + SET CG_GRP(REG,PRC,CG,CG) 'Multi-purpose work set' //; + SET FSCK(REG,PRC,CG,C,CG) 'Multi-purpose work set' //; + SET FSCKS(REG,PRC,CG,C,CG,TS) 'Multi-purpose work set' //; + SET RPC_IREIO(R,P,C,IE,IO) 'Types of trade flows' //; + SET RPC_LS(R,P,C) 'Load sifting control' //; +* process types + SETS ELE(R,P) 'Electric Power Plants' + CHP(R,P) 'Coupled Heat+Power Plants' + HPL(R,P) 'Heat and Steam Plants'; + +* region + SET MREG(ALL_R) 'Set of active regions' //; + SET RREG(ALL_REG,ALL_REG) 'Set of paired regions' //; + +* cumulatives & UCs + SET UC_ON(ALL_R,UC_N) 'Active UCs by region' //; + SET UC_GMAP_C(REG,UC_N,COM_VAR,COM,UC_GRPTYPE) 'Assigning commodities to UC_GRP'; + SET UC_GMAP_P(REG,UC_N,UC_GRPTYPE,PRC) 'Assigning processes to UC_GRP'; + SET UC_GMAP_U(ALL_R,UC_N,UC_N) 'Assigning constraints to UC_GRP' //; + SET UC_DYNBND(UC_N,LIM) 'Dynamic process-wise UC bounds' //; + SET RC_CUMCOM(REG,COM_VAR,ALLYEAR,ALLYEAR,COM) 'Cumulative commodity PRD/NET'; + SET RPC_CUMFLO(REG,PRC,COM,ALLYEAR,ALLYEAR) 'Cumulative process flows'; + +* time + SETS + RS_BELOW(ALL_REG,TS,TS) 'Timeslices stictly below a node' // + RS_BELOW1(ALL_REG,TS,TS) 'Timeslices strictly one level below' // + RS_TREE(ALL_REG,TS,TS) 'Timeslice subtree' // + FINEST(R,ALL_TS) 'Set of the finest timeslices in use' // + PASTMILE(ALLYEAR) 'PAST years that are not MILESYONYR' // + EACHYEAR(ALLYEAR) 'Each year from 1st NCAP_PASTI-Y to last MILESTONYR + DUR_MAX' // + EOHYEARS(ALLYEAR) 'Each year from 1st NCAP_PASTI-Y to last MILESTONYR' //; + ALIAS(PASTYEAR,PYR); + ALIAS(MODLYEAR,V); + +* identifiers for beginning/end of model horizon + SET MIYR_1(ALLYEAR) 'First T' //; + SET MIYR_L(ALLYEAR) 'Last year' //; + +* miscellaneous + SET IPS / IN, N /, LNX(L) / N, FX /; + SET BDUPX(BD) / UP, FX /; + SET BDLOX(BD) / LO, FX /; + SET BDNEQ(BD) / LO, UP /; + SET RP_PRC(R,P); + SET RP_GRP(REG,PRC,CG); + SET RP_CCG(REG,PRC,C,CG); + SET RP_CGG(REG,PRC,C,CG,CG); + SET TRACKC(R,C); + SET TRACKP(R,P); + SET TRACKPC(R,P,C); + SET TRACKPG(R,P,CG); + SET RVT(R,ALLYEAR,T); + SET RTPX(R,T,P); + SET RT_PP(R,T) //; + PARAMETER NO_RT(ALL_R,T) //; + +* --------------------------------------------------------------------------------------------- +* PARAMETERS SECTION +* --------------------------------------------------------------------------------------------- +* Years and splits of timeslices based upon level + PARAMETER LEAD(ALLYEAR) //; + PARAMETER LAGT(ALLYEAR) //; + PARAMETER FPD(ALLYEAR) //; + PARAMETER IPD(ALLYEAR) //; + PARAMETER RS_FR(R,S,S) //; + PARAMETER JS_CCL(R,J,S) //; + +* integrated parameters (created in PREPPM.mod) + PARAMETER UC_COM(UC_N,COM_VAR,SIDE,REG,ALLYEAR,COM,S,UC_GRPTYPE) 'Multiplier of VAR_COM variables' //; + PARAMETER COM_CUM(REG,COM_VAR,ALLYEAR,ALLYEAR,COM,LIM) 'Cumulative bound on commodity' //; + +* derived coefficient components (created in COEF*.MOD) + PARAMETER COEF_AF(R,ALLYEAR,T,PRC,S,BD) 'Capacity/Activity relationship' //; + PARAMETER COEF_CPT(R,ALLYEAR,T,PRC) 'Fraction of capacity available' //; + PARAMETER COEF_ICOM(R,ALLYEAR,T,PRC,C) 'Commodity flow at investment time' //; + PARAMETER COEF_OCOM(R,ALLYEAR,T,PRC,C) 'Commodity flow at decommissioning time' //; + PARAMETER COEF_CIO(R,ALLYEAR,T,P,C,IO) 'Capacity-related commodity in/out flows'//; + PARAMETER COEF_PTRAN(REG,ALLYEAR,PRC,CG,C,CG,TS) 'Multiplier for EQ_PTRANS' //; + PARAMETER COEF_RPTI(R,ALLYEAR,P) 'Repeated investment cycles' //; + PARAMETER COEF_ILED(R,ALLYEAR,P) 'Investment lead time' //; + PARAMETER COEF_PVT(R,T) 'Present value of time in periods' //; + PARAMETER COEF_CAP(R,ALLYEAR,LL,P) 'Generic re-usable work parameter'; + PARAMETER COEF_RTP(R,ALLYEAR,P) 'Generic re-usable work parameter'; + PARAMETER COEF_RVPT(R,ALLYEAR,PRC,T) 'Generic re-usable work parameter'; + PARAMETER RTP_CPX(R,ALLYEAR,P,LL) 'Shape multipliers for capacity transfer'//; + PARAMETER NCAP_AFBX(R,ALLYEAR,P,BD) 'Shape multipliers for NCAP_AF factors' //; + PARAMETER NCAP_AFSM(R,ALLYEAR,P) //; + PARAMETER RVPRL(R,YEAR,P) //; + +* OBJ function yearly values established in COEF_OBJ and used in OBJ_* + PARAMETER OBJ_RFR(R,YEAR,CUR) 'Risk-free rates' //; + PARAMETER OBJ_PVT(R,YEAR,CUR) 'Present value of period' //; + PARAMETER OBJ_CRF(R,ALLYEAR,P,CUR) 'Capital recovery factor' //; + PARAMETER OBJ_CRFD(R,ALLYEAR,P,CUR) 'Capital recovery factor for Decommissioning' //; + PARAMETER OBJ_DISC(R,ALLYEAR,CUR) 'Discounting factor' //; +$IF %OBMAC%==YES $GOTO RESTOBJ + PARAMETER OBJ_ICOST(R,ALLYEAR,P,CUR) 'NCAP_COST for each year' //; + PARAMETER OBJ_ISUB(R,ALLYEAR,P,CUR) 'NCAP_ISUB for each year' //; + PARAMETER OBJ_ITAX(R,ALLYEAR,P,CUR) 'NCAP_ITAX for each year' //; + PARAMETER OBJ_FOM(R,ALLYEAR,P,CUR) 'NCAP_FOM for each year' //; + PARAMETER OBJ_FSB(R,ALLYEAR,P,CUR) 'NCAP_FSUB for each year' //; + PARAMETER OBJ_FTX(R,ALLYEAR,P,CUR) 'NCAP_FTX for each year' //; + PARAMETER OBJ_DCOST(R,ALLYEAR,P,CUR) 'NCAP_DCOST for each year' //; + PARAMETER OBJ_DLAGC(R,ALLYEAR,P,CUR) 'NCAP_DLAGC for each year' //; + PARAMETER OBJ_ACOST(R,ALLYEAR,P,CUR) 'ACT_COST for each year' //; + PARAMETER OBJ_FCOST(R,ALLYEAR,P,C,S,CUR) 'FLO_COST for each year' //; + PARAMETER OBJ_FDELV(R,ALLYEAR,P,C,S,CUR) 'FLO_DELIV for each year' //; + PARAMETER OBJ_FTAX(R,ALLYEAR,P,C,S,CUR) 'FLO_TAX for each year' //; +$LABEL RESTOBJ + PARAMETER OBJ_FSUB(R,ALLYEAR,P,C,S,CUR) 'FLO_SUB for each year' //; + PARAMETER OBJ_COMNT(R,ALLYEAR,C,S,COSTYPE,CUR) 'CSTNET for each year'//; + PARAMETER OBJ_COMPD(R,ALLYEAR,C,S,COSTYPE,CUR) 'CSTPRD for each year'//; + PARAMETER OBJ_IPRIC(R,ALLYEAR,P,C,S,IE,CUR) 'IRE_PRICE for each year'//; + +* Miscellanea + PARAMETERS + PRC_YMIN(REG,PRC) 'Generic process parameter' // + PRC_YMAX(REG,PRC) 'Generic process parameter' // + PRC_SC(REG,PRC) 'Process storage cycles' // + PRC_SGL(REG,PRC) 'Process shadow level (< DAYNITE)' // + PRC_SEMI(R,P) 'Semi-continuous indicator' // + RD_NLP(R,C) 'NLP demand indicator' // + RD_SHAR(R,T,C,C) 'Demand aggregation share' // + RP_AFB(REG,PRC,BD) 'Processes with NCAP_AF by bound type' // + RS_STG(R,ALL_TS) 'Lead from previous storage timeslice' + RS_UCS(R,S,SIDE) 'Lead for TS-dynamic UC' + RS_STGPRD(R,ALL_TS) 'Number of storage periods for each timeslice' + RS_STGAV(R,ALL_TS) 'Average residence time for storage activity' + RS_TSLVL(R,ALL_TS) 'Timeslice levels' + TS_ARRAY(ALL_TS) 'Array for leveling parameter values across timeslices' + STOA(ALL_TS) 'ORD Lag from each timeslice to ANNUAL' + STOAL(ALL_REG,TS) 'ORD Lag from the LVL of each timeslice to ANNUAL' + BDSIG(LIM) 'Bound signum' / LO 1, UP -1 /; + + +*----------------------------------------------------------------------------- +* Initialization interpolation/extrapolation +*----------------------------------------------------------------------------- + SET FIL(ALLYEAR); + SET MY_FIL(ALLYEAR) //; + SET VNT(ALLYEAR,ALLYEAR); + SET YK1(ALLYEAR,ALLYEAR); + PARAMETER FIL2(ALLYEAR); + PARAMETER MY_FIL2(ALLYEAR) //; + PARAMETER MY_ARRAY(ALLYEAR)//; + PARAMETER YKVAL(ALLYEAR,ALLYEAR); + +* flags used in extrapolation + SET BACKWARD(YEAR) //; + SET FORWARD(YEAR) //; +* DM_YEAR is the union of the sets MODLYEAR and DATAYEAR + SET DM_YEAR(ALLYEAR) //; + +*------------------------------------------------------------------------------ +* Additional system declarations +*------------------------------------------------------------------------------ +* Internal Sets: + SETS + PYR_S(ALLYEAR) 'Residual vintage' // + MY_TS(ALL_TS) 'Temporary set for timeslices' // + R_UC(ALL_R,UC_N) 'Temporary set for UCs by region' // + UC_T(UC_N,T) 'Temporary set for UCs by period' // + RXX(ALL_R,*,*) 'General triples related to a region' + UNCD1(*) 'Non-domain-controlled set' + UNCD7(*,*,*,*,*,*,*) 'Non-domain-controlled set of 7-tuples'; + ALIAS(LIFE,AGE); + SET OPYEAR(AGE,LIFE) //; + +*------------------------------------------------------------------------------ +* Sets and parameters used in reduction algorithm +*------------------------------------------------------------------------------ + SET NO_ACT(R,P) 'Process not requiring activity variable' //; + SET RP_PGACT(R,P) 'Process with PCG consisting of 1 commodity' //; + SET RP_PGFLO(R,P) 'Process with PCG having COM_FR' //; + SET RPC_ACT(REG,PRC,CG) 'PG commodity of Process with PCG consisting of 1' //; + SET RPC_AFLO(REG,PRC,CG) 'ACT_FLO residual groups to be handled specially' //; + SET RPC_AIRE(ALL_REG,PRC,COM) 'Exchange process with only one commodity exchanged' //; + SET RPC_EMIS(R,P,COM_GRP) 'Process with emission COM_GRP' //; + SET FS_EMIS(R,P,COM_GRP,C,COM) 'Indicator for emission related FLO_SUM' //; + SET RC_IOP(R,C,IO,P) 'Processes associated with commodity' //; + SET RTCS_SING(R,T,C,S,IO) 'Commodity not being consumed' //; + SET RTPS_OFF(R,T,P,S) 'Process being turned off' //; + SET RTPCS_OUT(R,ALLYEAR,P,C,S) 'Process flows being turned off' //; + SET RPC_FFUNC(R,P,C) 'RPC_ACT Commodity in FFUNC' //; + SET RPCC_FFUNC(REG,PRC,CG,CG) 'Pair of FFUNC commodities with RPC_ACT commodity' //; + SET PRC_CAP(REG,PRC) 'Process requiring capacity variable' //; + SET PRC_ACT(REG,PRC) 'Process requiring activity equation' //; + SET PRC_TS2(REG,PRC,TS) 'Alias for PRC_TS of processes with RPC_ACT' //; + SET RPCG_PTRAN(R,P,COM,C,CG,CG) 'Set for FLO_FUNC/FLO_SUM based substitution' //; + SET KEEP_FLOF(R,P,C) 'Set for FFUNC-defined flows retained'; + ALIAS(CG3,CG4,COM_GRP); + +*------------------------------------------------------------------------------ +* Parameters used in report routine +*------------------------------------------------------------------------------ +* Label lengths exceeding default +$SETGLOBAL RL 'R.TL:MAX(12,R.LEN)' SETGLOBAL PL 'P.TL:MAX(12,P.LEN)' SETGLOBAL CL C.TL:MAX(12,C.LEN) +$IFI NOT %G2X6%==YES $SETGLOBAL RL 'R.TL:MAX(12,CARD(R.TL))' SETGLOBAL PL 'P.TL:MAX(12,CARD(P.TL))' SETGLOBAL CL C.TL:MAX(12,CARD(C.TL)) + + PARAMETERS + PAR_FLO(R,ALLYEAR,ALLYEAR,P,C,S) 'Flow parameter' // + PAR_FLOM(R,ALLYEAR,ALLYEAR,P,C,S) 'Reduced cost of flow variable' // + PAR_IRE(R,ALLYEAR,ALLYEAR,P,C,S,IMPEXP) 'Parameter for im/export flow' // + PAR_IREM(R,ALLYEAR,ALLYEAR,P,C,S,IMPEXP) 'Reduced cost of import/export flow' // + PAR_OBJINV(R,ALLYEAR,ALLYEAR,P,CUR) 'Annual discounted investment costs' // + PAR_OBJDEC(R,ALLYEAR,ALLYEAR,P,CUR) 'Annual discounted decommissioning costs' // + PAR_OBJFIX(R,ALLYEAR,ALLYEAR,P,CUR) 'Annual discounted FOM cost' // + PAR_OBJSAL(R,ALLYEAR,P,CUR) 'Annual discounted salvage value' // + PAR_OBJLAT(R,ALLYEAR,P,CUR) 'Annual discounted late costs' // + PAR_OBJACT(R,ALLYEAR,ALLYEAR,P,TS,CUR) 'Annual discounted variable costs' // + PAR_OBJFLO(R,ALLYEAR,ALLYEAR,P,C,TS,CUR) 'Annual discounted flow costs (incl import/export)' // + PAR_OBJCOM(R,ALLYEAR,COM,TS,CUR) 'Annual discounted commodity costs ' // + PAR_OBJBLE(R,ALLYEAR,COM,CUR) 'Annual discounted blending costs' // + PAR_OBJELS(R,ALLYEAR,COM,CUR) 'Annual discounted elastic demand cost term' //; + + +*---------------------------------------------------------------------------------------------- +* GLOBALS SECTION - Safe Set of TIMES Critical Global control variables +*---------------------------------------------------------------------------------------------- +$SETGLOBAL TIMESED 0 +$SET ControlAbort "Abort Internal Control variable being set by user, aborted" +$LABEL RESET +$IF NOT '%X2%'=='' $EXIT +*------------------------------------------------------------------------- +* Normal Tags for standard TIMES (changed under stochastic mode) +$SETGLOBAL SW_NOTAGS %X1% +$IF NOT %SW_NOTAGS%=="%X1%" $%ControlAbort%: SW_NOTAGS +$IF "%X1%"=='' +$SETGLOBAL SW_NOTAGS SET EQ 'EQ' SET VAR 'VAR' SET SWS '' SET SOW '' SET SWT '' SET SWD '' SET SWTD '' SET SWSW '' SET VART 'VAR' SET VARV 'VAR' SET VARM 'VAR' SET VARTT VAR + +* Helper for process tranformation shape controls +$SETGLOBAL SHFF '%X1%' SETGLOBAL RCAPSUB '%X1%' SETGLOBAL RCAPSBM %X1% +$IF NOT "%SHFF%%RCAPSUB%%RCAPSBM%"=='%X1%%X1%%X1%' $%ControlAbort%: SHFF / RCAPSUB +$SETGLOBAL SHFF 1+RTP_FFC + +* Additional tags for stochastic +$SETGLOBAL MX '%X1%' SETGLOBAL SCUM '%X1%' SETGLOBAL SW_STVARS %X1% +$IF NOT "%MX%%SCUM%%SW_STVARS%"=='%X1%%X1%%X1%' $%ControlAbort%: MX / SW_STVARS / SCUM + +* Objective function variants +$SETGLOBAL CAPJD '%X1%' SETGLOBAL CAPWD %X1% +$IF NOT '%CAPJD%%CAPWD%'=='%X1%%X1%' $%ControlAbort%: CAPxD +* +$SETGLOBAL SWX '%X1%' SETGLOBAL SWTX '%X1%' SETGLOBAL VARMAC %X1% +$IF NOT "%SWX%%SWTX%%VARMAC%"=='%X1%%X1%%X1%' $%ControlAbort%: SWX +$SETGLOBAL SWX ,'1' +* +$SET TMP '%CTST%' SETGLOBAL CTST %X1% +$IF NOT "%CTST%"=='%X1%' $%ControlAbort%: CTST +$SETGLOBAL CTST %TMP% +* +* Tags for stochastic TIMES (set in stages.stc) +$SETGLOBAL SW_TAGS %X1% +$IF NOT "%SW_TAGS%"=='%X1%' $%ControlAbort%: SW_TAGS +$IF NOT '%X1%'=='' $SETLOCAL X1 '' GOTO RESET +$SETGLOBAL VARMAC 0==1 +*------------------------------------------------------------------------- diff --git a/sol_flo.red b/sol_flo.red new file mode 100644 index 0000000..a8e7b3b --- /dev/null +++ b/sol_flo.red @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* SOL_FLO - code associated with the substitution of flow variables +* %1 - target parameter name +* %2 - parameter name suffix +* %3 - VAR_FLO suffix (.L or .M) +*=============================================================================* +$SET SHP1 "" SET SHP2 "" SET SHP3 "" SET TST '$PRC_VINT(R,P)' SET%4 V VAR +$SET SHG1 ",P,%PGPRIM%,C" SET SHG ',P,CG1,C' +$IF DEFINED RTP_FFCS +$SET SHP1 "*(%SHFF%S(R,V%SHG1%%SOW%))" SET SHP3 "*(%SHFF%S(R,V%SHG%%SOW%))" +$SET SHP1 "*(%SHFF%X(R,V,T%SHG1%)%TST%)%SHP1%" SET SHP3 "*(%SHFF%X(R,V,T%SHG%)%TST%)%SHP3%" + +* Non-substituted flows +$IF '%2'=='' %1(R,V,T,P,C,S%5) $= %V%_FLO%3(R,V,T,P,C,S%5); + +* Activity flows +$IF '%3'=='.L' %1%2(RTP_VINTYR(R,V,T,P),C,S%5)$PRC_TS(R,P,S) $= SUM(RPC_ACT(RP_PGACT(R,P),C),%V%_ACT%3(R,V,T,P,S%5)*PRC_ACTFLO(R,V,P,C)); +$IF '%3'=='.M' %1%2(RTP_VINTYR(R,V,T,P),C,S%5)$PRC_TS(R,P,S) $= SUM(RPC_ACT(RP_PGACT(R,P),C),%V%_ACT%3(R,V,T,P,S%5)*(1/PRC_ACTFLO(R,V,P,C))); + +* Set NO_ACT flows to activity; they were not substituted +$IF '%3'=='.L' %V%_ACT%3(RTP_VINTYR(R,V,T,P),S%5) $= SUM(RPC_PG(RP_FLO(NO_ACT(R,P)),C),%V%_FLO%3(R,V,T,P,C,S%5)*(1/PRC_ACTFLO(R,V,P,C))); +$IF '%3'=='.L' %V%_ACT%3(RTP_VINTYR(R,V,T,P),S%5) $= SUM(RPC_IRE(RPC_PG(NO_ACT(R,P),C),IE)$RP_AIRE(R,P,IE),%V%_IRE%3(R,V,T,P,C,S,IE%5)*(1/PRC_ACTFLO(R,V,P,C))); +$IF '%3'=='.M' %V%_ACT%3(R,V,T,P,S%5) $= SUM(RPC_PG(RP_FLO(NO_ACT(R,P)),C),%V%_FLO%3(R,V,T,P,C,S%5)*PRC_ACTFLO(R,V,P,C)); +$IF '%3'=='.M' %V%_ACT%3(R,V,T,P,S%5) $= SUM(RPC_IRE(RPC_PG(NO_ACT(R,P),C),IE)$RP_AIRE(R,P,IE),%V%_IRE%3(R,V,T,P,C,S,IE%5)*PRC_ACTFLO(R,V,P,C)); +*------------------------------------------------------------------------------- +* Marginals for substituted flows currently not supported +$IF '%3'=='.M' $EXIT +*------------------------------------------------------------------------------- +* FFUNC substituted flows +%1%2(RTP_VINTYR(R,V,T,P),C,S%5)$(RTPCS_VARF(R,T,P,C,S)%6$RPC_FFUNC(R,P,C)) = + SUM((RPC_ACT(R,P,COM),RS_TREE(R,S,TS))$%V%_ACT%3(R,V,T,P,TS%5), + %V%_ACT%3(R,V,T,P,TS%5) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) * + ( ACT_FLO(R,V,P,C,S)%SHP1% )); + +* Emission flows +%1%2(RTP_VINTYR(R,V,T,P),C,S%5)$(RTPCS_VARF(R,T,P,C,S)%6$RPC_EMIS(R,P,C)) = + SUM((FS_EMIS(R,P,CG1,COM,C),RS_TREE(R,S,TS))$%1%2(R,V,T,P,COM,TS%5), + %1%2(R,V,T,P,COM,TS%5) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS)) * + COEF_PTRAN(R,V,P,CG1,COM,C,TS)%SHP3%); diff --git a/sol_ire.rpt b/sol_ire.rpt new file mode 100644 index 0000000..e555bf9 --- /dev/null +++ b/sol_ire.rpt @@ -0,0 +1,20 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*==============================================================================* +* SOL_IRE - basic solution parameters for IRE flows and auxiliaries +*==============================================================================* +$SET SRC 'PAR_IRE(R,V,T,P,C,S,IE)' SET%1 V VAR +$SET SWS %V%_IRE.L(R,V,T,P,C,S,IE%2)$(NOT RPC_AIRE(R,P,C))+(%V%_ACT.L(R,V,T,P,S%2)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) +$SET SWD %V%_IRE.M(R,V,T,P,C,S,IE%2)$(NOT RPC_AIRE(R,P,C))+(%V%_ACT.M(R,V,T,P,S%2)/PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C) +$IF '%4'==) $SET SRC '%SWS%' SET SWS '0' SET SWD 0 + + OPTION CLEAR=PAR_IRE,CLEAR=PAR_IREM; + PAR_IRE(RTP_VINTYR(R,V,T,P),C,S,IE)$(RTPCS_VARF(R,T,P,C,S)$RPC_IRE(R,P,C,IE)) = %SWS%; + PAR_IREM(RTP_VINTYR(R,V,T,P),C,S,IE)$(RTPCS_VARF(R,T,P,C,S)$RPC_IRE(R,P,C,IE)) = %SWD%; + +* emissions & auxiliary flows from IRE +$IF DEFINED RTP_FFCS $SET MX "(%SHFF%S(R,V,P,COM,COM%SOW%))*" + F_INOUTS(F_IOSET(R,V,T,P,COM,S,IO)) = %3 %MX% + SUM(RPC_IRE(R,P,C,IE),IRE_FLOSUM(R,T,P,C,S,IE,COM,IO)*(%SRC%%4)); diff --git a/solprep.msa b/solprep.msa new file mode 100644 index 0000000..12df7bb --- /dev/null +++ b/solprep.msa @@ -0,0 +1,133 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================* +* SOLPREP.MSA Preprocessing routine for MACRO Stand-Alone +*============================================================================* +$IF NOT '%1'=='' $GOTO %1 +*----------------------------------------------------------------------------- +* Calculation of solution values for (due to reduction) substituted flows +*----------------------------------------------------------------------------- +$LABEL INIT + OPTION CLEAR=PAR_FLO,CLEAR=PAR_IRE; +$ BATINCLUDE sol_flo.red PAR_FLO '' .L +$ BATINCLUDE sol_ire.rpt +*----------------------------------------------------------------------------- +* Calculation of annual costs and commodity marginals +*----------------------------------------------------------------------------- + OPTION CLEAR=CST_PVP,CLEAR=CST_ACTC,CLEAR=CST_INVC,CLEAR=CST_INVX,CLEAR=CST_FIXC,CLEAR=CST_FIXX; + OPTION CLEAR=CAP_NEW,CLEAR=CST_FLOC,CLEAR=CST_FLOX,CLEAR=CST_COMC,CLEAR=CST_COMX,CLEAR=CST_IREC; +$ BATINCLUDE rpt_obj.rpt '' "" '' '%SYSPREFIX%' 0 +$ BATINCLUDE cost_ann.rpt +* Commodity levels and marginals + OPTION CLEAR=PAR_COMBALEM; + PAR_COMPRDL(R,T,C,S) $= VAR_COMPRD.L(R,T,C,S); + PAR_COMNETL(R,T,C,S) $= VAR_COMNET.L(R,T,C,S); + PAR_COMBALEM(R,T,C,S) $= EQG_COMBAL.M(R,T,C,S)*(1/COEF_PVT(R,T)); + PAR_COMBALEM(R,T,C,S) $= EQE_COMBAL.M(R,T,C,S)*(1/COEF_PVT(R,T)); +$ BATINCLUDE preppm.msa TONLP +*============================================================================= +* Annual costs for MACRO + OPTION CLEAR=NCAP_YES,CLEAR=PAR_OBJINV,CLEAR=PAR_OBJFIX; + NCAP_YES(R,V,P)$(VAR_NCAP.L(R,V,P)+NCAP_PASTI(R,V,P))=YES; + PAR_OBJINV(RTP_CPTYR(R,V,T,P),CUR)$(NCAP_YES(R,V,P)$COEF_OBINVN(R,V,P,CUR)) = COEF_CPT(R,V,T,P) * + COEF_OBINVN(R,V,P,CUR) * (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)); + PAR_OBJFIX(RTP_CPTYR(R,V,T,P),CUR)$(NCAP_YES(R,V,P)$COEF_OBFIXN(R,V,P,CUR)) = COEF_CPT(R,V,T,P) * + COEF_OBFIXN(R,V,P,CUR) * (VAR_NCAP.L(R,V,P)$T(V)+NCAP_PASTI(R,V,P)); +$IFI %OBJANN%==YES MACST('VAR')=NO; VAR_ANNCST.UP('OBJVAR',R,T,CUR)=INF; + TM_ANNC(MR(R),T) = SUM(MACST$REG_ACOST(R,T,MACST),REG_ACOST(R,T,MACST)) + + SUM((VNT(V,T),P,RDCUR(R,CUR))$PAR_OBJINV(R,V,T,P,CUR),PAR_OBJINV(R,V,T,P,CUR)) + + SUM((VNT(V,T),P,RDCUR(R,CUR))$PAR_OBJFIX(R,V,T,P,CUR),PAR_OBJFIX(R,V,T,P,CUR)); +$IFI %OBJANN%==YES TM_ANNC(R,T) = TM_ANNC(R,T)+SUM(RDCUR(R,CUR),VAR_ANNCST.L('OBJVAR',R,T,CUR)); +*----------------------------------------------------------------------------- +* Marginal costs of demands + OPTION CLEAR=TM_DMC; + TM_DMC(RTC(MR(R),T,C))$DEM(R,C) = SUM(RTCS_VARC(R,T,C,S),PAR_COMBALEM(R,T,C,S) * G_YRFR(R,S)); + TM_DMC(R,T,C)$(TM_DMC(R,T,C) EQ 0) = 0; + LOOP(MIYR_1(TT(T-1)),TM_DMC(R,TT,C)$((TM_DMC(R,TT,C) GT TM_DMC(R,T,C))$DEM(R,C)) = TM_DMC(R,T,C)); +$ BATINCLUDE filparam TM_DMC 'R,' C ",'0','0','0','0','0'" DATAYEAR T + LOOP(MIYR_1(TT(T-1)),TM_DMC(R,TT,C)$((TM_DMC(R,TT,C) LT TM_DMC(R,T,C)*0.7)$DEM(R,C)) = TM_DMC(R,T,C)*0.7); +* Demand levels + TM_DEM(MR(R),T,C)$((COM_PROJ(R,T,C) GT 0)$DEM(R,C)) = COM_PROJ(R,T,C) + - SUM((RTCS_VARC(R,T,C,S),RCJ(R,C,J,'LO')), VAR_ELAST.L(R,T,C,S,J,'LO')) + + SUM((RTCS_VARC(R,T,C,S),RCJ(R,C,J,'UP')), VAR_ELAST.L(R,T,C,S,J,'UP')); +*----------------------------------------------------------------- +$LABEL QSF +* Quadratic supply function + OPTION DM < TM_DEM; + TM_DMC(MR,TB,DM)$(TM_DMC(MR,TB,DM)*TM_DEM(MR,TB,DM) < 1E-5*TM_ANNC(MR,TB)) = 0; + TM_ANNC(REG,TP)=TM_ANNC(REG,TP) * TM_SCALE_CST; + LOOP(TB(T-1), TM_ANNC(REG,TB) = MIN(TM_ANNC(REG,T),TM_ANNC(REG,TB)); +$IFI %MSA%%2==CSA0 TM_EC0(REG) = TM_ANNC(REG,TB); TM_DDATPREF(REG,DM) = TM_DMC(REG,TB,DM); + TM_ANNC(REG,TB) = TM_EC0(REG); TM_DMC(REG,TB,DM) = TM_DDATPREF(REG,DM)); + TM_QSFB(REG,TP,DM)$TM_DEM(REG,TP,DM) = 0.5*TM_DMC(REG,TP,DM)*TM_SCALE_CST/TM_DEM(REG,TP,DM); + TM_QSFA(REG,TP)=TM_ANNC(REG,TP)- SUM(DM, TM_QSFB(REG,TP,DM)*TM_DEM(REG,TP,DM)**2); +*----------------------------------------------------------------------------- +$EXIT +$LABEL OUT +* Write data transfer attributes to file + FILE TIM2MSA / MSAQSF.DD /; +* + PUT TIM2MSA; + PUT "$ONMULTI" /; +* Milestones + PUT "SET T /" /; + LOOP(T, PUT T.TL /;); + PUT "/;" /; +* Lagtimes + PUT "PARAMETER LAGT /" /; + LOOP(T, PUT T.TL, LAGT(T) /;); + PUT "/;" /; +* Durations + PUT "PARAMETER D /" /; + LOOP(T, PUT T.TL, D(T) /;); + PUT "/;" /; +* Regions + PUT "SET REG /" /; + LOOP(MR(R), PUT R.TL /;); + PUT "/;" /; +* Commodities + PUT "SET COM /" /; + LOOP(DM(C), PUT C.TL /;); + PUT "/;" /; +* + TIM2MSA.nr = 2; + TIM2MSA.nd = 9; + TIM2MSA.nw = 17; + TIM2MSA.nz = 1e-9; +* Annual regional costs + PUT "PARAMETER TM_ANNC /" /; + LOOP((MR(R),T), PUT R.TL:0,".":0,T.TL:0 (TM_ANNC(R,T)/TM_SCALE_CST) /;); + PUT "/;" /; +* GDP target + PUT "PARAMETER TM_GR /" /; + LOOP((MR(R),T), PUT R.TL:0,".":0,T.TL:0 TM_GR(R,T) /;); + PUT "/;" /; +* Demand levels + PUT "PARAMETER TM_DEM /" /; + LOOP(MRTC(MR(R),T,C),PUT MRTC.TE(MRTC), TM_DEM(MRTC) /;); + PUT "/;" /; +* Demand marginals + PUT "PARAMETER TM_DMC /" /; + LOOP(MRTC(MR(R),T,C)$TM_DMC(MRTC), PUT MRTC.TE(MRTC), TM_DMC(MRTC) /;); + PUT "/;" /; + PUT 'SCALAR TM_ARBM' @25 '/' TM_ARBM ' /;' /; + PUT 'SCALAR TM_SCALE_UTIL' @25 '/' TM_SCALE_UTIL ' /;' /; + PUT 'SCALAR TM_SCALE_CST' @25 '/' TM_SCALE_CST ' /;' /; + PUT 'SCALAR TM_SCALE_NRG' @25 '/' TM_SCALE_NRG ' /;' /; + PUT / 'PARAMETER TM_KGDP(R)' @25 '/' /; + LOOP(MR(R), PUT @1 R.TL:0, TM_KGDP(R) / @1 '/;'); + PUT / 'PARAMETER TM_KPVS(R)' @25 '/' /; + LOOP(MR(R), PUT @1 R.TL:0, TM_KPVS(R) / @1 '/;'); + PUT / 'PARAMETER TM_DEPR(R)' @25 '/' /; + LOOP(MR(R), PUT @1 R.TL:0, TM_DEPR(R) / @1 '/;'); + PUT / 'PARAMETER TM_ESUB(R)' @25 '/' /; + LOOP(MR(R), PUT @1 R.TL:0, TM_ESUB(R) / @1 '/;'); + PUT / 'PARAMETER TM_GDP0(R)' @25 '/' /; + LOOP(MR(R), PUT @1 R.TL:0, TM_GDP0(R) / @1 '/;'); + PUT / 'PARAMETER TM_DMTOL(R)' @25 '/' /; + LOOP(MR(R), PUT @1 R.TL:0, TM_DMTOL(R) / @1 '/;'); + PUT / 'PARAMETER TM_IVETOL(R)' @25 '/' /; + LOOP(MR(R), PUT @1 R.TL:0, TM_IVETOL(R) / @1 '/;'); + PUTCLOSE TIM2MSA; diff --git a/solputta.ans b/solputta.ans new file mode 100644 index 0000000..3fa03ad --- /dev/null +++ b/solputta.ans @@ -0,0 +1,263 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +*--------------------------------------------------------------------- +* SOLPUTTA.ANS +* +* Output routine for ANSWER +* - creating table for TIMES Analyst within ANSWER +* - seperate calls for primal/dual values +*--------------------------------------------------------------------- +* placeholder for stochastic scenario +* SET SOW / EMPTY /; +$IF %SCUM%==1 SOW(W)=AUXSOW(W); +*--------------------------------------------------------------------- +$IF NOT %SOLVEDA%==1 +$IFI NOT %STAGES%==YES $SHIFT SHIFT SHIFT +$SETLOCAL ITEM2 ',ITEM' +$IF %1==S $SETLOCAL ITEM2 '' +*--------------------------------------------------------------------- +* reconstruct variable levels and marginals for those eliminated by the REDUCE option + +* Scenario name for run coming from $SET RUN_NAME in *.DD or .RUN file +FILE sola / %RUN_NAME%.ANT /; + +sola.PW=1000; +sola.ND=4; +sola.NW=15; +sola.LW=0; + +PUT sola; +PUT '*** ' SYSTEM.TITLE +PUT / '*** Case %RUN_NAME%' / + +SET PUTIT(%2R,T,P); +SET PUTI1(%2R,ALLYEAR,T,P); +SET PUTI2(%2R,ALLYEAR,T,P,TS); +SET PUTI3(%2R,ALLYEAR,T,P,C,S); +SET PUTI4(%2R,T,C,TS); +SET PUTI5(%2R,T,P,TS); +SET PUTI6(%2R,T,P,C,S); +SET PUTI7(%2R,T,P,C); +SET UCITEM3(%2UC_N,ITEM,ITEM,ITEM); +SET CUMITEM4(%2R,ITEM,ITEM,ITEM,ITEM); +* --- Retirement results --- +PARAMETER %1PAR_RET(%2R,ALLYEAR,T,P) //; +* --- CumCom results --- +PARAMETER %1PAR_CUMCOML(%2R,C,COM_VAR,ALLYEAR,ALLYEAR) //; +PARAMETER %1PAR_CUMCOMM(%2R,C,COM_VAR,ALLYEAR,ALLYEAR) //; + +*--------------------------------------------------------------------- +* Output of VAR_NCAP, units of capacity +*--------------------------------------------------------------------- +* ATTR R P COM V TS P/D +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' VAR_NCAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.L' %1PAR_NCAPL(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' VAR_NCAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.M' %1PAR_NCAPM(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) + +*--------------------------------------------------------------------- +* Output of VAR_ACT, units of activity +*--------------------------------------------------------------------- +* split out non/vintage processes + PARAMETER APARRTP(%2R,T,P); + PARAMETERS NV_ACTL(%2R,T,P,S); + PARAMETERS NV_ACTM(%2R,T,P,S); + NV_ACTL(%3RTP_VARA(R,T,P),S)$PRC_TS(R,P,S) = SUM(YK(T,V)$%1PAR_ACTL(%3R,V,T,P,S),%1PAR_ACTL(%3R,V,T,P,S)); + NV_ACTM(%3R,T,P,S)$(NOT PRC_VINT(R,P)) $= ABS(%1PAR_ACTM(%3R,T,T,P,S)); + NV_ACTM(%3RTP_VARA(R,T,P),S)$(PRC_TS(R,P,S)$PRC_VINT(R,P)) = SMIN(RTP_VINTYR(R,V,T,P),ABS(%1PAR_ACTM(%3R,V,T,P,S))); + +* ALL-vintage +$ BATINCLUDE solsubta.ans PUTI5 '(RTP_VARA(R,T,P)*PRC_TS(R,P,S))' VAR_ACT 'R.TL' 'P.TL' "' '" "' '" 'S.TL' '.L' 'NV_ACTL(%3R,T,P,S)' (%3R,TT,P,S) (%3R,TT(T--ORD(T)),P,S) +$ BATINCLUDE solsubta.ans PUTI5 '(RTP_VARA(R,T,P)*PRC_TS(R,P,S))' VAR_ACT 'R.TL' 'P.TL' "' '" "' '" 'S.TL' '.M' 'NV_ACTM(%3R,T,P,S)' (%3R,TT,P,S) (%3R,TT(T--ORD(T)),P,S) +* by vintage for PRC_VINT +$ BATINCLUDE solsubta.ans PUTI2 '((RTP_VINTYR(R,V,T,P)*PRC_TS(R,P,S))$PRC_VINT(R,P))' VAR_ACTV 'R.TL' 'P.TL' "' '" 'V.TL' 'S.TL' '.L' '%1PAR_ACTL(%3R,V,T,P,S)' (%3R,V,TT,P,S) (%3R,V,TT(T--ORD(T)),P,S) +$ BATINCLUDE solsubta.ans PUTI2 '((RTP_VINTYR(R,V,T,P)*PRC_TS(R,P,S))$PRC_VINT(R,P))' VAR_ACTV 'R.TL' 'P.TL' "' '" 'V.TL' 'S.TL' '.M' '%1PAR_ACTM(%3R,V,T,P,S)' (%3R,V,TT,P,S) (%3R,V,TT(T--ORD(T)),P,S) +* For retirements +$IF NOT DEFINED VNRET $GOTO NORET + LOOP(TT(T--1),Z=ORD(T)-1;%1PAR_RET(%3RTP_CPTYR(R,V,T,P))$PRC_RCAP(R,P) = MAX(0,%VART%_SCAP.L(R,V,T,P%SWS%)-RTFORC(R,V,T,P)-(%VART%_SCAP.L(R,V,TT,P%SWS%)-RTFORC(R,V,TT,P))$Z)); +$ BATINCLUDE solsubta.ans PUTI1 '(RTP_CPTYR(R,V,T,P)$PRC_RCAP(R,P))' VAR_RCAPGV 'R.TL' 'P.TL' "' '" 'V.TL' "' '" '.L' '%1PAR_RET(%3R,V,T,P)' (%3R,V,TT,P) (%3R,V,TT(T--ORD(T)),P) + OPTION CLEAR=%1PAR_RET; LOOP(RTP(R,V,P)$PRC_RCAP(R,P),Z=1;LOOP(RTP_CPTYR(R,VNRET(V,T),P)$Z,Z=0; %1PAR_RET(%3R,V,T,P) $= %VART%_SCAP.L(R,V,T,P%SWS%))); + %1PAR_RET(%3R,V,T,P) $= %VART%_RCAP.L(R,V,T,P%SWS%); +$ BATINCLUDE solsubta.ans PUTI1 '(RTP_CPTYR(R,V,T,P)$VNRET(V,T)$PRC_RCAP(R,P))' VAR_RCAPV 'R.TL' 'P.TL' "' '" 'V.TL' "' '" '.L' '%1PAR_RET(%3R,V,T,P)' (%3R,V,TT,P) (%3R,V,TT(T--ORD(T)),P) + OPTION CLEAR=%1PAR_RET; %1PAR_RET(%3R,V,T,P) $= %VART%_RCAP.M(R,V,T,P%SWS%); +$ BATINCLUDE solsubta.ans PUTI1 '(RTP_CPTYR(R,V,T,P)$VNRET(V,T)$PRC_RCAP(R,P))' VAR_RCAPV 'R.TL' 'P.TL' "' '" 'V.TL' "' '" '.M' '%1PAR_RET(%3R,V,T,P)' (%3R,V,TT,P) (%3R,V,TT(T--ORD(T)),P) +$LABEL NORET +*--------------------------------------------------------------------- +* Output of VAR_FLO, units of activity +*--------------------------------------------------------------------- +$SET FLOTS RPCS_VAR(R,P,C,S) +$IFI %RPT_FLOTS%==ANNUAL $SET FLOTS ANNUAL(S) +$IFI %RPT_FLOTS%==COM $SET FLOTS COM_TS(R,C,S) + +* split in/out + PARAMETER NV_FLOL(%2R,T,P,C,S); +* ATTR R P COM V TS L/M DATA LOOP ASSIGN +* VAR_FLO: ALL-vintage + OPTION CLEAR=NV_FLOL; OPTION PUTI6 < %1F_IN; + NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_IN(%3R,V,T,P,C,S),%1F_IN(%3R,V,T,P,C,S)); +$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'IN')*%FLOTS%)" VAR_FIN 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) +$ BATINCLUDE solsubta.ans PUTI6 "((NOT TOP(R,P,C,'IN')+RPC_IRE(R,P,C,'EXP'))$NV_FLOL(%3R,T,P,C,S))" VAR_FIN 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) + OPTION CLEAR=NV_FLOL; OPTION PUTI6 < %1F_OUT; + NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_OUT(%3R,V,T,P,C,S),%1F_OUT(%3R,V,T,P,C,S)); +$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'OUT')*%FLOTS%)" VAR_FOUT 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) +$ BATINCLUDE solsubta.ans PUTI6 "((NOT TOP(R,P,C,'OUT')+RPC_IRE(R,P,C,'IMP'))$NV_FLOL(%3R,T,P,C,S))" VAR_FOUT 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) + +* VAR_FLO marginals: ALL-vintage (only non-substituted and PG flows) +$IFI %1==S $GOTO DONEFLOM + OPTION CLEAR=NV_FLOL; + TRACKPC(RPC(R,P,C))$(NOT RPC_FFUNC(R,P,C)+RPC_EMIS(R,P,C)) = YES; + NV_FLOL(%3R,T,P,C,S)$(TRACKPC(R,P,C)$(NOT PRC_VINT(R,P))) $= ABS(%1PAR_FLOM(%3R,T,T,P,C,S))*(1/COEF_PVT(R,T)); + NV_FLOL(RTPCS_VARF(%3R,T,P,C,S))$(TRACKPC(R,P,C)$PRC_VINT(R,P)) = SMIN(RTP_VINTYR(R,V,T,P),ABS(%1PAR_FLOM(%3R,V,T,P,C,S)))/COEF_PVT(R,T); +$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'IN')*%FLOTS%)" VAR_FIN 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) +$ BATINCLUDE solsubta.ans PUTI6 "(TOP(R,P,C,'OUT')*%FLOTS%)" VAR_FOUT 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) + OPTION CLEAR=TRACKPC; +$LABEL DONEFLOM + +* VAR_IRE: ALL-vintage + OPTION CLEAR=NV_FLOL,CLEAR=PUTI3; + PUTI3(%3R,LL--ORD(LL),T,P,C,S)$RP_IRE(R,P) $= %1F_IN(%3R,LL,T,P,C,S); OPTION PUTI6 < PUTI3; + NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_IN(%3R,V,T,P,C,S),%1F_IN(%3R,V,T,P,C,S)); +$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'EXP')*%FLOTS%)" VAR_XEXP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) + OPTION CLEAR=NV_FLOL,CLEAR=PUTI3; + PUTI3(%3R,LL--ORD(LL),T,P,C,S)$RP_IRE(R,P) $= %1F_OUT(%3R,LL,T,P,C,S); OPTION PUTI6 < PUTI3; + NV_FLOL(PUTI6(%3R,T,P,C,S)) = SUM(YK(T,V)$%1F_OUT(%3R,V,T,P,C,S),%1F_OUT(%3R,V,T,P,C,S)); +$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'IMP')*%FLOTS%)" VAR_XIMP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.L' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) + +$IFI %1==S $GOTO DONEIREM +* VAR_IRE marginals: All vintage + OPTION CLEAR=NV_FLOL; + NV_FLOL(RTPCS_VARF(R,T,P,C,S))$RPC_IRE(R,P,C,'EXP') = SMIN(RTP_VINTYR(R,V,T,P),ABS(PAR_IREM(R,V,T,P,C,S,'EXP')))/COEF_PVT(R,T); +$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'EXP')*RPCS_VAR(R,P,C,S))" VAR_XEXP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(R,T,P,C,S) (R,TT,P,C,S) (R,TT(T--ORD(T)),P,C,S) + OPTION CLEAR=NV_FLOL; + NV_FLOL(RTPCS_VARF(R,T,P,C,S))$RPC_IRE(R,P,C,'IMP') = SMIN(RTP_VINTYR(R,V,T,P),ABS(PAR_IREM(R,V,T,P,C,S,'IMP')))/COEF_PVT(R,T); +$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'IMP')*RPCS_VAR(R,P,C,S))" VAR_XIMP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(R,T,P,C,S) (R,TT,P,C,S) (R,TT(T--ORD(T)),P,C,S) +$LABEL DONEIREM + +* EQIRE marginals: ALL-vintage + OPTION CLEAR=NV_FLOL; + NV_FLOL(%3R,T,P,C,S)$RP_IRE(R,P) $= %1PAR_IPRIC(%3R,T,P,C,S,'EXP'); +$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'EXP')*RPCS_VAR(R,P,C,S))" EQIRE_EXP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) + OPTION CLEAR=NV_FLOL; + NV_FLOL(%3R,T,P,C,S)$RP_IRE(R,P) $= %1PAR_IPRIC(%3R,T,P,C,S,'IMP'); +$ BATINCLUDE solsubta.ans PUTI6 "(RPC_IRE(R,P,C,'IMP')*RPCS_VAR(R,P,C,S))" EQIRE_IMP 'R.TL' 'P.TL' 'C.TL' "' '" 'S.TL' '.M' NV_FLOL(%3R,T,P,C,S) (%3R,TT,P,C,S) (%3R,TT(T--ORD(T)),P,C,S) + +* ELC supply by source + OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1PAR_EOUT; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1PAR_EOUT(%3R,V,T,P,C),%1PAR_EOUT(%3R,V,T,P,C)); +$ BATINCLUDE solsubta.ans PUTI6 KEEP_FLOF(R,P,C) ELC- 'R.TL' 'P.TL' C.TL "''" "''" 'BY-SRC' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) + +*--------------------------------------------------------------------- +* Output of VAR_CAP, units of capacity +*--------------------------------------------------------------------- +* ATTR R P COM V TS L/M + APARRTP(%3RTP(R,T,P)) = %1PAR_CAPL(%3R,T,P)+SUM(PASTCV,%1PAR_PASTI(%3R,T,P,PASTCV)); +$ BATINCLUDE solsubta.ans PUTIT '(RTP(R,T,P)*PRC_CAP(R,P))' VAR_CAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.L' APARRTP(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +$ BATINCLUDE solsubta.ans PUTIT '(RTP(R,T,P)*%1PAR_CAPM(%3R,T,P))' VAR_CAP 'R.TL' 'P.TL' "' '" "' '" "' '" '.M' %1PAR_CAPM(%3R,T,P) (%3R,TT,P) (%3R,TT(T--ORD(T)),P) + +*--------------------------------------------------------------------- +* Output of Commodity and peaking balance, commodity units +*--------------------------------------------------------------------- +* ATTR R P COM V TS L/M +$IFI %STAGES%%SCUM%==YES $GOTO DONEBALL +$ BATINCLUDE solsubta.ans PUTI4 "RCS_COMBAL(R,T,C,S,'LO')" EQ_COMBAL R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' 'EQG_COMBAL.L(R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +$ BATINCLUDE solsubta.ans PUTI4 "RCS_COMBAL(R,T,C,S,'FX')" EQ_COMBAL R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' 'EQE_COMBAL.L(R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +$ BATINCLUDE solsubta.ans PUTI4 '(RTCS_VARC(R,T,C,S)$COM_PKTS(R,C,S))' EQ_PEAK R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' 'EQ_PEAK.L(R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +$LABEL DONEBALL +$ BATINCLUDE solsubta.ans PUTI4 "RTCS_VARC(R,T,C,S)" EQ_COMBAL R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_COMBALEM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +$ BATINCLUDE solsubta.ans PUTI4 '(RTCS_VARC(R,T,C,S)$COM_PKTS(R,C,S))' EQ_PEAK R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_PEAKM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +* Balance variables +$IFI %1==S LOOP(%3 + RHS_COMBAL(R,T,C,S)$=%1PAR_COMNETL(%3R,T,C,S); RHS_COMPRD(R,T,C,S)$=%1PAR_COMPRDL(%3R,T,C,S); +$IFI %1==S ); +$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMBAL(R,T,C,S)" VAR_COMNET R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' '%1PAR_COMNETL(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMBAL(R,T,C,S)" VAR_COMNET R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_COMNETM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMPRD(R,T,C,S)" VAR_COMPRD R.TL "' '" 'C.TL' "' '" 'S.TL' '.L' '%1PAR_COMPRDL(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) +$ BATINCLUDE solsubta.ans PUTI4 "RHS_COMPRD(R,T,C,S)" VAR_COMPRD R.TL "' '" 'C.TL' "' '" 'S.TL' '.M' '%1PAR_COMPRDM(%3R,T,C,S)' (%3R,TT,C,S) (%3R,TT(T--ORD(T)),C,S) + +*--------------------------------------------------------------------- +* Output of user constraints +*--------------------------------------------------------------------- +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,'NONE','NONE','NONE') UC.L "''" UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSL(%3UC_N,'NONE','NONE','NONE')" (%3UC_N,ITEM,ITEM,ITEM) "(%3UC_N,'','','')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,R,'NONE','NONE') UCR.L R.TL UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSL(%3UC_N,R,'NONE','NONE')" (%3UC_N,R,ITEM,ITEM) "(%3UC_N,R,'','')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,'NONE',T,'NONE') UCT "''" UC_N.TL "' '" "' '" "' '" '.L' "%1PAR_UCSL(%3UC_N,'NONE',T,'NONE')" (%3UC_N,ITEM,TT,ITEM) "(%3UC_N,'',TT(T--ORD(T)),'')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,R,T,'NONE') UCRT R.TL UC_N.TL "' '" "' '" "' '" '.L' "%1PAR_UCSL(%3UC_N,R,T,'NONE')" (%3UC_N,R,TT,ITEM) "(%3UC_N,R,TT(T--ORD(T)),'')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,'NONE',T,S) UCTS "''" UC_N.TL "' '" "' '" S.TL '.L' "%1PAR_UCSL(%3UC_N,'NONE',T,S)" (%3UC_N,ITEM,TT,S) "(%3UC_N,'',TT(T--ORD(T)),S)" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSL(%3UC_N,R,T,S) UCRTS R.TL UC_N.TL "' '" "' '" S.TL '.L' "%1PAR_UCSL(%3UC_N,R,T,S)" (%3UC_N,R,TT,S) "(%3UC_N,R,TT(T--ORD(T)),S)" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,'NONE','NONE','NONE') UC.M "''" UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSM(%3UC_N,'NONE','NONE','NONE')" (%3UC_N,ITEM,ITEM,ITEM) "(%3UC_N,'','','')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,R,'NONE','NONE') UCR.M R.TL UC_N.TL "' '" "' '" "' '" "''" "%1PAR_UCSM(%3UC_N,R,'NONE','NONE')" (%3UC_N,R,ITEM,ITEM) "(%3UC_N,R,'','')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,'NONE',T,'NONE') UCT "''" UC_N.TL "' '" "' '" "' '" '.M' "%1PAR_UCSM(%3UC_N,'NONE',T,'NONE')" (%3UC_N,ITEM,TT,ITEM) "(%3UC_N,'',TT(T--ORD(T)),'')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,R,T,'NONE') UCRT R.TL UC_N.TL "' '" "' '" "' '" '.M' "%1PAR_UCSM(%3UC_N,R,T,'NONE')" (%3UC_N,R,TT,ITEM) "(%3UC_N,R,TT(T--ORD(T)),'')" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,'NONE',T,S) UCTS "''" UC_N.TL "' '" "' '" S.TL '.M' "%1PAR_UCSM(%3UC_N,'NONE',T,S)" (%3UC_N,ITEM,TT,S) "(%3UC_N,'',TT(T--ORD(T)),S)" +$ BATINCLUDE solsubta.ans UCITEM3 %1PAR_UCSM(%3UC_N,R,T,S) UCRTS R.TL UC_N.TL "' '" "' '" S.TL '.M' "%1PAR_UCSM(%3UC_N,R,T,S)" (%3UC_N,R,TT,S) "(%3UC_N,R,TT(T--ORD(T)),S)" +$ BATINCLUDE solsubta.ans CUMITEM4 %1PAR_UCMRK(%3R,T,ITEM,C,S) UC_MARK R.TL ITEM.TL C.TL "' '" S.TL '.M' "%1PAR_UCMRK(%3R,T,ITEM,C,S)" (%3R,TT,ITEM,C,S) "(%3R,TT(T--ORD(T)),ITEM,C,S)" + +*--------------------------------------------------------------------- +* Output of cumulatives +*--------------------------------------------------------------------- +* Cumcom results (unscaling) + %1PAR_CUMCOML(%3R,C,COM_VAR,ALLYEAR,LL) $= %VAR%_CUMCOM.L(R,C,COM_VAR,ALLYEAR,LL%SOW%)*%CUCSCAL%; + %1PAR_CUMCOMM(%3R,C,COM_VAR,ALLYEAR,LL) $= %VAR%_CUMCOM.M(R,C,COM_VAR,ALLYEAR,LL%SOW%)*(1/%CUCSCAL%); +$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMNET.L 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOML(%3R,C,"NET",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("NET"),YEAR,LL) +$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMNET.M 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOMM(%3R,C,"NET",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("NET"),YEAR,LL) +$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMPRD.L 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOML(%3R,C,"PRD",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("PRD"),YEAR,LL) +$ BATINCLUDE solsubta.ans CUMITEM4 RC_CUMCOM(R,COM_VAR,YEAR,LL,C) VAR_CUMPRD.M 'R.TL' '" "' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMCOMM(%3R,C,"PRD",YEAR,LL)' (%3R,C,COM_VAR,YEAR,LL) (%3R,C,COM_VAR("PRD"),YEAR,LL) +$ BATINCLUDE solsubta.ans CUMITEM4 RPC_CUMFLO(R,P,C,YEAR,LL) VAR_CUMFLO.L 'R.TL' 'P.TL' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMFLOL(%3R,P,C,YEAR,LL)' (%3R,P,C,YEAR,LL) (%3R,P,C,YEAR,LL) +$ BATINCLUDE solsubta.ans CUMITEM4 RPC_CUMFLO(R,P,C,YEAR,LL) VAR_CUMFLO.M 'R.TL' 'P.TL' 'C.TL' 'YEAR.TL,"-",LL.TL' "' '" "''" '%1PAR_CUMFLOM(%3R,P,C,YEAR,LL)' (%3R,P,C,YEAR,LL) (%3R,P,C,YEAR,LL) + +*--------------------------------------------------------------------- +* Output of various cost components - only non-zero series +*--------------------------------------------------------------------- +$SET SUPZERO YES +*--------------------------------------------------------------------- +* Objective by component +PARAMETER REG_OBJ2(%2REG,ITEM); +REG_OBJ2(%3R,ITEM) $= SUM(RDCUR(R,CUR)$%1REG_WOBJ(%3R,ITEM,CUR),%1REG_WOBJ(%3R,ITEM,CUR)); +REG_OBJ2(%3R,'IRE') = %1REG_IREC(%3R); +$IFI NOT %STAGES%==YES +$ BATINCLUDE solsubta.ans UNCD1 YES OBJZ "' '" "' '" "' '" "' '" "''" "''" 'OBJZ.L' (ANNUAL) (ANNUAL) +$ BATINCLUDE solsubta.ans RXX REG_OBJ2(%3R,ITEM) REG_OBJ 'R.TL' "' '" 'ITEM.TL' "' '" "''" "''" 'REG_OBJ2(%3R,ITEM)' (R,%3ITEM%ITEM2%) (R,%3ITEM%ITEM2%) + +* ATTR R P COM V TS L/M +* Annualized investment costs +OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_INVC; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM((YK(T,V),SYSINV)$%1CST_INVC(%3R,V,T,P,SYSINV),%1CST_INVC(%3R,V,T,P,SYSINV)); +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'INV' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +* Annualized investment taxes/subsidies +OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_INVX; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM((YK(T,V),SYSINV)$%1CST_INVX(%3R,V,T,P,SYSINV),%1CST_INVX(%3R,V,T,P,SYSINV)); +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'INVX' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +* Total salvage value at EOH+1 +OPTION CLEAR=NV_ACTL;NV_ACTL(%3R,TT(MIYR_1),P,ANNUAL) $= SUM((RTP(R,T,P),RDCUR(R,CUR)),%1PAR_OBJSAL(%3R,T,P,CUR)*(1/OBJ_DCEOH(R,CUR))); +$ BATINCLUDE solsubta.ans PUTIT 'RP(R,P)' COST_SALV 'R.TL' 'P.TL' "' '" "' '" "''" "''" NV_ACTL(%3R,T,P,'ANNUAL') (%3R,T,P) (%3R,T(MIYR_1),P) +* Annualized decommissioning costs +OPTION CLEAR=NV_ACTL;NV_ACTL(%3R,T,P,ANNUAL) $= SUM(RTP_CPTYR(R,V,T,P),%1CST_DECC(%3R,V,T,P)); +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'DEC' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +* Annualized fixed costs +OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_FIXC; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM(YK(T,V)$%1CST_FIXC(%3R,V,T,P),%1CST_FIXC(%3R,V,T,P)); +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'FOM' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +* Annualized fixed taxes/subsidies +OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_FIXX; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM(YK(T,V)$%1CST_FIXX(%3R,V,T,P),%1CST_FIXX(%3R,V,T,P)); +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'FIXX' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +* Annualized activity costs +OPTION CLEAR=NV_ACTL; OPTION PUTIT < %1CST_ACTC; NV_ACTL(%3R,T,P,ANNUAL)$PUTIT(%3R,T,P)=SUM((YK(T,V),RPM)$%1CST_ACTC(%3R,V,T,P,RPM),%1CST_ACTC(%3R,V,T,P,RPM)); +$ BATINCLUDE solsubta.ans PUTIT 'RTP(R,T,P)' COST_ 'R.TL' 'P.TL' "' '" "' '" "''" 'ACT' NV_ACTL(%3R,T,P,'ANNUAL') (%3R,TT,P) (%3R,TT(T--ORD(T)),P) +* Annualized flow costs +OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1CST_FLOC; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1CST_FLOC(%3R,V,T,P,C),%1CST_FLOC(%3R,V,T,P,C)); +$ BATINCLUDE solsubta.ans PUTI6 'RPC(R,P,C)' COST_ 'R.TL' 'P.TL' C.TL "' '" "''" 'FLO' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) +* Annualized flow taxes/subsidies +OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1CST_FLOX; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1CST_FLOX(%3R,V,T,P,C),%1CST_FLOX(%3R,V,T,P,C)); +$ BATINCLUDE solsubta.ans PUTI6 'RPC(R,P,C)' COST_ 'R.TL' 'P.TL' C.TL "' '" "''" 'FLOX' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) +* Annualized implied trade costs +OPTION CLEAR=NV_FLOL; OPTION PUTI7 < %1CST_IREC; NV_FLOL(%3R,T,P,C,ANNUAL)$PUTI7(%3R,T,P,C)=SUM(YK(T,V)$%1CST_IREC(%3R,V,T,P,C),%1CST_IREC(%3R,V,T,P,C)); +$ BATINCLUDE solsubta.ans PUTI6 'RPC(R,P,C)' COST_ 'R.TL' 'P.TL' C.TL "' '" "''" 'IRE' NV_FLOL(%3R,T,P,C,'ANNUAL') (%3R,TT,P,C,ANNUAL) (%3R,TT(T--ORD(T)),P,C,ANNUAL) +* Annualized commodity costs +$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'COM' %1CST_COMC(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) +* Annualized commodity taxes/subsidies +$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'COMX' %1CST_COMX(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) +* Annualized demand elasticity costs +$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'ELS' %1CST_COME(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) +* Annualized commodity costs +$ BATINCLUDE solsubta.ans PUTI4 'RTC(R,T,C)' COST_ 'R.TL' 'C.TL' "' '" "' '" "''" 'DAM' %1CST_DAM(%3R,T,C) (%3R,TT,C,ANNUAL) (%3R,TT(T--ORD(T)),C,ANNUAL) + +* MACRO +SET XRT(%2ITEM,U2,T); +$IF %1=='' +$ BATINCLUDE solsubta.ans XRT TM_RESULT(ITEM,R,T) "" 'R.TL' "''" "''" "''" "''" '_' TM_RESULT(ITEM,R,T) (ITEM,R,TT) (ITEM,R,TT(T--ORD(T))) @1,ITEM.TL +$ BATINCLUDE solsubta.ans XRT CM_%1RESULT(%3ITEM,T) CM "''" "''" "''" "''" "''" '_' CM_%1RESULT(%3ITEM,T) (%3ITEM,'',TT) (%3ITEM,'',TT(T--ORD(T))) ITEM.TL +*--------------------------------------------------------------------- +PUTCLOSE sola; diff --git a/solsetv.v3 b/solsetv.v3 new file mode 100644 index 0000000..080f146 --- /dev/null +++ b/solsetv.v3 @@ -0,0 +1,201 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +*----------------------------------------------------------------------------- +* SOLSETV.VDA +* +* Output routine - creating flat Sets for VEDA +* +*----------------------------------------------------------------------------- +$IF NOT '%1'=='' $GOTO %1 +* Scenario index not supported in current version +$IF NOT %STAGES%==YES SOW('1') = YES; +*----------------------------------------------------------------------------- +* Make sure CLI attributes are defined +$IF %CLI%==YES $GOTO ADESCVDD +$IF %SOLVEDA%==1 PARAMETER CM_SRESULT(ALLSOW,ITEM,ALLYEAR) //; +$IF %SOLVEDA%==1 PARAMETER CM_SMAXC_M(ALLSOW,ITEM,ALLYEAR) //; +*----------------------------------------------------------------------------- +$LABEL ADESCVDD +SET ADESC Attribute Descriptions / + +* variables (and their marginals) +VAR_act 'Process Activity' +VAR_actM 'Process Activity - Marginals' +VAR_cap 'Technology Capacity' +VAR_capM 'Technology Capacity - Marginals' +VAR_ncap 'Technology Investment - New capacity' +VAR_ncapM 'Technology Investment - Marginals' +VAR_ncapR 'Technology Investment - BenCost + ObjRange' +VAR_fin 'Commodity Consumption by Process' +VAR_fout 'Commodity Production by Process' +VAR_Pout 'Commodity Output Level by Process' +VAR_comprd 'Commodity Total Production' +VAR_comprdM 'Commodity Total Production - Marginal' +VAR_comnet 'Commodity Net' +VAR_comnetM 'Commodity Net - Marginal' +VAR_eout 'Electricity supply by technology and energy source' +VAR_CumCst 'Cumulative costs by type (if constrained)' + +* equations (and their marginals) +EQ_combal 'Commodity Slack/Levels' +EQ_combalM 'Commodity Slack/Levels - Marginals' +EQ_peak 'Peaking Constraint Slack' +EQ_peakM 'Peaking Constraint Slack - Marginals' +EQ_Cumflo 'Cumulative flow constraint - Levels' +EQ_CumfloM 'Cumulative flow constraint - Marginals' +EQ_IreM 'Inter-regional trade equations - Marginals' + +* calculated parameters +PAR_capLO 'Capacity Lower Limit' +PAR_capUP 'Capacity Upper Limit' +PAR_Top 'Process topology (Opted out - SET RPT_TOP YES to activate)' +Cap_New 'Newly installed capacity and lumpsum investment by vintage and commissioning period' + +* calculated costs +COST_inv 'Annual investment costs' +COST_dec 'Annual decommissioning costs' +COST_salv 'Salvage values of capacities at EOH+1' +COST_late 'Annual late costs' +COST_fom 'Annual fixed operating and maintenance costs' +COST_act 'Annual activity costs' +COST_flo 'Annual flow costs (including import/export prices)' +COST_com 'Annual commodity costs' +COST_els 'Annual elastic demand cost term' +COST_dam 'Annual damage cost term' +COST_invx 'Annual investment taxes/subsidies' +COST_fixx 'Annual fixed taxes/subsidies' +COST_flox 'Annual flow taxes/subsidies' +COST_comx 'Annual commodity taxes/subsidies' +COST_ire 'Annual implied costs of endogenous trade' +COST_NPV 'Total discounted costs by process/commodity (optional)' +Time_NPV 'Discounted value of time by period' +VAL_Flo 'Annual commodity flow values' +ObjZ 'Total discounted system cost' +Reg_wobj 'Regional total expected discounted system cost' +Reg_obj 'Regional total discounted system cost' +Reg_irec 'Regional total discounted implied trade cost' +Reg_ACost 'Regional total annualized costs by period' +User_Con 'Level of user constraint' +User_ConFXM 'Marginal cost of user constraint (or group-wise market share)' +User_ConLOM 'Marginal cost of lower bound user constraint' +User_ConUPM 'Marginal cost of upper bound user constraint' +User_DynbM 'Marginal cost of dynamic process bound constraint' +User_Maxbet 'Level of MaxBet constraint' + +* Climate module and MACRO +VAR_climate 'Climate result variables' +Dual_Clic 'Shadow price of climate constraint' +VAR_Macro 'MACRO result variables' +/; + +$LABEL REST + +$IF DECLARED IRE $ABORT Illegal Declaration of Internal TIMES Identifier: IRE - Run Aborted +SCALAR IRE "Inter-regional Exchange (Exports & Imports)"; +SCALAR STG "Storage Processes (genuine)"; +SETS + DMD(R,P) 'Demand Devices' + PRE(R,P) 'Energy Processes' + PRW(R,P) 'Material Processes - Weight' + PRV(R,P) 'Material Processes - Volume' + REF(R,P) 'Refineries' + ELE(R,P) 'Electric Power Plants' + CHP(R,P) 'Coupled Heat+Power Plants' + HPL(R,P) 'Heating Plants' + DISTR(R,P) 'Distribution Technologies' + RENEW(R,P) 'Renewables Processes' + XTRACT(R,P)'Extraction Processes' +; +* set the regional memebers of the reporting sets + DMD(RP(R,P)) $= PRC_MAP(R,'DMD',P); + PRE(RP(R,P)) $= PRC_MAP(R,'PRE',P); + PRW(RP(R,P)) $= PRC_MAP(R,'PRW',P); + PRV(RP(R,P)) $= PRC_MAP(R,'PRV',P); + REF(RP(R,P)) $= PRC_MAP(R,'REF',P); + ELE(RP(R,P)) $= PRC_MAP(R,'ELE',P); + CHP(RP(R,P)) $= PRC_MAP(R,'CHP',P); + HPL(RP(R,P)) $= PRC_MAP(R,'HPL',P); + DISTR(RP(R,P)) $= PRC_MAP(R,'DISTR',P); + RENEW(RP(R,P)) $= PRC_MAP(R,'RENEW',P); + XTRACT(RP(R,P))$= PRC_MAP(R,'XTRACT',P); + +SETS + RES(R,COM) 'Residential Sector Demands' + COMM(R,COM) 'Commercial Sector Demands' + TRN(R,COM) 'Transporation Sector Demands' + AGR(REG,COM) 'Agriculature Sector Demands' + OTHD(R,COM) 'Other Demands' + IND(REG,COM) 'Industrial Demands' + NE(REG,COM) 'Non-energy Demands' + NRGFOS(R,C) 'Fossil' + NRGREN(R,C) 'Renewable' + NRGSYN(R,C) 'Synthetic' + NRGELC(ALL_R,C) 'Electricity' + NRGHET(ALL_R,C) 'Heat' +; +* set the regional memebers of the reporting sets + RES(RC(R,C)) $= DEM_SMAP(R,'RES',C); + COMM(RC(R,C)) $= DEM_SMAP(R,'COM',C); + TRN(RC(R,C)) $= DEM_SMAP(R,'TRN',C); + AGR(RC(R,C)) $= DEM_SMAP(R,'AGR',C); + IND(RC(R,C)) $= DEM_SMAP(R,'IND',C); + OTHD(RC(R,C)) $= DEM_SMAP(R,'OTH',C); + NE(RC(R,C)) $= DEM_SMAP(R,'NE',C); + NRGELC(NRG(R,C)) $= NRG_TMAP(R,'ELC',C); + NRGHET(NRG(R,C)) $= NRG_TMAP(R,'LTHEAT',C); + NRGHET(NRG(R,C)) $= NRG_TMAP(R,'HTHEAT',C); + NRGFOS(NRG(R,C)) $= NRG_TMAP(R,'FOSSIL',C); + NRGREN(NRG(R,C)) $= NRG_TMAP(R,'RENEN',C); + NRGREN(NRG(R,C)) $= NRG_TMAP(R,'FRERENEW',C); + NRGREN(NRG(R,C)) $= NRG_TMAP(R,'LIMRENEW',C); + NRGSYN(NRG(R,C)) $= NRG_TMAP(R,'SYNTH',C); + +*GG* set the REGional descriptions if not provided +* Use the RC / RP masks + COM_DESC(RC(R,C))$(NOT COM_DESC(R,C)) = COM_GRP(C); + PRC_DESC(RP(R,P))$(NOT PRC_DESC(R,P)) = PRC(P); + +* timeslices + SET RS(R,ALL_TS); + OPTION RS < RS_TSLVL; +* UCs and completion of missing labels + SETS + NONSET / NONE / + PLUSET / '+' / + OTHCOM(ITEM) // + SET REG_ACT(ITEM,C) + UC_CONST(*,UC_N) 'Genuine TIMES UC constraints' + UC_MARKS(R,ITEM) 'PRC_MARK Share UC constraints' + UC_DYNBD(R,UC_N) 'Dynamic UC bound constraints'; + LOOP(R,UC_CONST('NONE',UC_N)$UC_R_SUM(R,UC_N)=YES); + LOOP(RMKC(R,ITEM,C)$RPT_OPT('COMPRD','4'),UC_MARKS(R,ITEM)=YES); + REG_ACT(ALL_R,%PGPRIM%) = ALL_REG(ALL_R); + REG_ACT(NONSET,%PGPRIM%) = YES; + OTHCOM(CG) $= SUM(COM_PEAK(R,CG),1); + OTHCOM(CUR) $= SUM(RDCUR(R,CUR),1); +*--------------------------------------------------------------------- +$ IFI NOT %PUNITS%==YES $EXIT + SET PRC_UNITS(R,P,UC_GRPTYPE,UNITS); +* Add default capacity unit and conversion if missing + G_UNCA(UNITS_ACT,UNITS_ACT)$(NOT SUM(UNITS$(G_UNCA(UNITS,UNITS_ACT)=1),1)) = 1; + PRC_UNITS(RP,'ACT',UNITS_ACT)$SUM(PRC_ACTUNT(RP,CG,UNITS_ACT),1) = YES; + LOOP(UNITS_ACT, + PRC_UNITS(PRC_CAP(RP),'CAP',UNITS)$((ABS(G_UNCA(UNITS,UNITS_ACT)-PRC_CAPACT(RP))0)$TM_DEM(R,T,C)) = TM_DEM(R,T,C)*(1-TM_TOL('BND')*TM_TOL('TIG')); + VAR_DEM.UP(RT_PP(MR(R),T),C)$((TM_DDATPREF(R,C)>0)$TM_DEM(R,T,C)) = TM_DEM(R,T,C)*(1+TM_TOL('BND')*TM_TOL('TIG')); + ); + LOOP(NITER$DOITER, + + OPTION BRATIO=0.25,SOLVEOPT=REPLACE; + SOLVE MCE MAXIMIZING VAR_UTIL USING NLP; + +*-- Calculate Macro parameters + EQ_TRDBAL.M(PP,TRD) = EQ_TRDBAL.M(PP,"NMR"); + VAR_NTX.L(MR,PP,TRD('IRE')) = -REG_ACOST(MR,PP,TRD)*TM_SCALE_CST; + TM_GDP(MR(R),PP) = VAR_C.L(R,PP)+VAR_INV.L(R,PP) + SUM(TRD, ABS(EQ_TRDBAL.M(PP,TRD)/EQ_TRDBAL.M(PP,"NMR"))*VAR_NTX.L(R,PP,TRD)); + PAR_GRGDP(MR(R),tp(T-1)) = 100 * ((TM_GDP(R,T)/TM_GDP(R,TP))**(1/NYPER(TP))-1); + PAR_Y(R,T) = VAR_Y.L(R,T); + PAR_MC(MR(R),PP(T),C)$TM_DEM(R,T,C) = MAX(ABS(VAR_SP.M(R,T,C)*TM_SCALE_NRG),ABS(EQ_DD.M(R,T,C))) / MAX(EQ_ESCOST.M(R,T),-VAR_EC.M(R,T)) / TM_SCALE_CST; + MSA_ERR(MITER,NITER,'DDF',MR(R)) = SMAX((T,C)$TM_DEM(R,T,C),ABS(TM_DEM(R,T,C)-VAR_DEM.L(R,T,C))/TM_DEM(R,T,C)); + MSA_ERR(MITER,NITER,'GDP',MR(R)) = SMAX(T,ABS(TM_GDPGOAL(R,T)-TM_GDP(R,T))/TM_GDPGOAL(R,T)); + ERRDEM = SMAX(MR, MSA_ERR(MITER,NITER,'DDF',MR)); DISPLAY ERRDEM; + ERRGDP = SMAX(MR, MSA_ERR(MITER,NITER,'GDP',MR)); + DFUNC = ((ERRGDP>1.5*TM_TOL('GDP'))+(ERRDEM>1.5*TM_TOL('DEM')))*(MAX(ERRDEM,ERRGDP)>TM_TOL('MST'))$TM_CAL; + +*-- Calculate deflators and new Negishi weights + LOOP(TB(T-1), TM_PVPI(TRD,PP) = ABS(EQ_TRDBAL.M(PP,TRD)/EQ_TRDBAL.M(T,"NMR"))); + TM_NWT(MR(R)) = SUM(PP,TM_PVPI("NMR",PP)*VAR_C.L(R,PP) + SUM(TRD, TM_PVPI(TRD,PP)*VAR_NTX.L(R,PP,TRD))); + TM_NWT(MR) = TM_NWT(MR) / SUM(REG, TM_NWT(REG)); + TM_NWTIT(NITER,MR) = TM_NWT(MR); + IF(CARD(MR)=1, TM_TOL('EQUIL')=0; + ELSE TM_TOL('EQUIL') = SUM(MR, ABS(TM_NWTIT(NITER-1,MR) - TM_NWT(MR)))); + MSA_ERR(MITER,NITER,'NWT',MR) = TM_TOL('EQUIL'); + IF((TM_CAL=1)$DFUNC, TM_TOL('EQUIL')=1; DFUNC=0); + IF(TM_TOL('EQUIL') LE TM_TOL('MST') OR ORD(NITER)=CARD(NITER), DOITER=0); + + IF(DOITER+DFUNC, +*-- Recalibrate DDF factors +$IFI %MSA%==CSA $INCLUDE ddfupd.msa + )); + + GDPLOSS(MITER,MR,TP)= 100*(TM_GDPGOAL(MR,TP)-TM_GDP(MR,TP))/TM_GDPGOAL(MR,TP); + TM_DDF_DM(MR,TP,DM)$TM_DEM(MR,TP,DM)=(VAR_DEM.L(MR,TP,DM)/TM_DEM(MR,TP,DM)); + OPTION TM_DD < TM_DDF_DM; +* DISPLAY 'Demand ratio VAR_DEM/TM_DEM', TM_dd; + IF(TM_CAL=2, DOITER=DFUNC; ELSEIF NOT TM_CAL, DOITER=ROUND(ERRDEM/CARD(MR),5)>3*TM_TOL('MST')); +$ IF DEFINED TM_CATT $batinclude preppm.msa TOLP + IF(DOITER$(ORD(MITER) < CARD(MITER)), +* Update either demands or PVT factors + IF(NOT TM_CAL,OPTION CLEAR=RCJ; COM_PROJ(MR(R),PP(T),C)$TM_DEM(R,T,C) = COM_PROJ(R,T,C)+VAR_DEM.L(R,T,C)-TM_DEM(R,T,C); + ELSEIF TM_CAL=2,LOOP(PP(T-1),OBJ_PVT(MR(R),T,CUR) = OBJ_PVT(R,PP,CUR)*EQ_ESCOST.M(R,T)/EQ_ESCOST.M(R,PP)); + COEF_PVT(MR(R),T) = SUM(G_RCUR(R,CUR),OBJ_PVT(R,T,CUR)) DISPLAY "UDF updated";); + OPTION BRATIO=1; +$ INCLUDE clearsol.stp + OPTION SOLVEOPT=MERGE; + SOLVE %MODEL_NAME% MINIMIZING objZ USING LP; +$ BATINCLUDE solprep.msa + ); + ); + OPTION MSA_ERR:6:3:1; + DISPLAY MSA_ERR,GDPLOSS,ERRDEM,ERRGDP; + +$SET SOLVEDA 1 +$batinclude rptlite.rpt '' '' '' NO +$IFI %QSF%==YES $batinclude solprep.msa OUT +$IFI NOT %MSA%==CSA $EXIT +*------------------------------------------------------------------ +* Calculate IVETOL for policy run + TM_IVETOL(MR(R)) = MAX(TM_YCHECK(R),SMAX(PP$(TM_L(R,PP)>1),LOG((VAR_INV.L(R,PP)+VAR_EC.L(R,PP))/TM_Y0(R))/LOG(TM_L(R,PP)))+.005); + PAR_IV(MR(R),T) = VAR_INV.L(R,T); + +* Write out final calibrated DDF factors and realized GDP + OPTION CLEAR=TM_UDF; IF(TM_CAL=2,TM_UDF(MR(R),T)=COEF_PVT(R,T); DISPLAY TM_UDF); +$batinclude writeddf.msa MSADDF PAR_GRGDP diff --git a/solve.stc b/solve.stc new file mode 100644 index 0000000..cc738bb --- /dev/null +++ b/solve.stc @@ -0,0 +1,134 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* Solve.stc is the wrapper for solving stochastic problems +* %1 - mod or v# for the source code to be used +*=============================================================================* + SCALAR GDL /0/; + PARAMETER WHANDLE(ALLSOW) //; +*------------------------------------------------------------------------------ +$ SET SOLVEDA 1 +$IFI %MCA%==YES %MODEL_NAME%.number=%MCA1%-1; +$IF NOT %STAGES%==YES $BATINCLUDE rptlite.rpt S WW, +$IF %OBMAC%==YES +$IF NOT %gams.gdir%==%gams.scrdir% GDL=%solvelink.AsyncGrid%; +*------------------------------------------------------------------------------ + DOITER = (SUM(SW_T(MIYR_1,WW),1) GT 1) OR SW_PHASE OR (SUM((XPT%SWD%(W)),1)=0); +$IFI %SPINES%==YES DOITER = 0; + IF(DOITER, +*------------------------------------------------------------------------------ +* Set of deterministic runs if several scenarios at stage 1 +*------------------------------------------------------------------------------ +$ IF %STEPPED%==YES Abort "Cannot use Stepped Mode with Sensitivity/Tradeoff Analysis"; + CNT = SUM(SW_T(MIYR_1,SOW),1); + IF(SW_PHASE, GDL=0; + IF(S_UCOBJ('OBJ1','1') GT 0, + SW_PHASE=1; DISPLAY "Phase 1 deterministic scenarios.",CNT; + ELSE SW_PHASE=-1; DISPLAY "Multiphase tradeoff scenarios.",CNT); + ELSE DISPLAY "Decomposed deterministic scenarios!",CNT; + IF(GDL,%MODEL_NAME%.solvelink = GDL)); +* Use MERGE for stochastic, because otherwise bounds for other scenarios get cleared + OPTION SOLVEOPT=MERGE; + ); + LOOP(ALLSOW$(SUM(SW_T(MIYR_1,ALLSOW),1)$DOITER), + CNT = ORD(ALLSOW); DISPLAY CNT; + IF(S_UCOBJ('OBJ1',ALLSOW) EQ 4, +* If no user-defined objective, skip Phase 1 copying previous VAR_UC solution if necessary +$IF NOT %STAGES%==YES LOOP(SOW,SPAR_UCSL(ALLSOW,UC_N,U2,U3,U4) $= SPAR_UCSL(SOW,UC_N,U2,U3,U4)); + ELSE + IF((SW_PHASE EQ -1) AND (ORD(ALLSOW) GT 1), +* Set deviation bounds in multiphase +$IF %STAGES%==YES $BATINCLUDE bnd_ucw.mod '' M + LOOP(SOW, Z = S_UC_RHS('OBJ1','N','1',SOW); + %VAR%_UC.LO(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)-ABS(%VAR%_UC.L(UC_N%SOW%)*Z); + %VAR%_UC.UP(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)+ABS(%VAR%_UC.L(UC_N%SOW%)*Z)); + AUXSOW(ALLSOW) = YES; + ); + LOOP(MIYR_1(T),SOW(WW) = SW_TSW(WW,T,ALLSOW); + SW_NORM = SW_TPROB(T,ALLSOW)); +$IF NOT %STAGES%==YES $BATINCLUDE sensis.stc +$ BATINCLUDE solve.mod + WHANDLE(ALLSOW)=%MODEL_NAME%.handle; +$IF %STAGES%==YES $GOTO ENDPHASE1 + IF(NOT (SW_PARM OR GDL), Z=0; +$ BATINCLUDE rptlite.rpt S WW, ALLSOW, NO +$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.mod +$IF %CLI%==YES $BATINCLUDE rpt_par.cli LOOP(SOW, ); + ELSEIF NOT GDL, +* Save VAR_UC solution + SPAR_UCSL(SOW,UC_N,'','','') $= VAR_UC.L(UC_N); + SPAR_UCSL(SOW,UC_N,R,'','') $= VAR_UCR.L(UC_N,R); + SPAR_UCSL(SOW,UC_N,T,'','') $= VAR_UCT.L(UC_N,T); + SPAR_UCSL(SOW,UC_N,R,T,'') $= VAR_UCRT.L(UC_N,R,T); + SPAR_UCSL(SOW,UC_N,T,S,'') $= VAR_UCTS.L(UC_N,T,S); + SPAR_UCSL(SOW,UC_N,R,T,S) $= VAR_UCRTS.L(UC_N,R,T,S)); +$LABEL ENDPHASE1 + ); + ); +* Reset SOW + IF(DOITER, + SOW(WW)$(ORD(WW) LE SW_DESC('1','1')) = YES; + AUXSOW(WW)$(ORD(WW) GT 1) = NO; + ); +*------------------------------------------------------------------------------ + IF(SW_PARM$SW_PHASE, SW_PHASE = SW_PARM; +$IF %STAGES%==YES $BATINCLUDE bnd_ucw.mod '' I + IF(SW_PARM EQ 2, + DISPLAY "Phase 2 determinstic secnarios."; + LOOP(ALLSOW$(SUM(SW_T(MIYR_1,ALLSOW),1)$(S_UCOBJ('OBJ1',ALLSOW) GT 0)), + CNT = ORD(ALLSOW); DISPLAY CNT; + LOOP(MIYR_1,SOW(WW) = SW_TSW(WW,MIYR_1,ALLSOW)); +$IF NOT %STAGES%==YES $BATINCLUDE sensis.stc +$ BATINCLUDE solve.mod +$IF %STAGES%==YES $GOTO ENDPHASE2 +$ BATINCLUDE rptlite.rpt S WW, ALLSOW, NO +$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.mod +$IF %CLI%==YES $BATINCLUDE rpt_par.cli LOOP(SOW, ); +$LABEL ENDPHASE2 + ); +* Reset SOW for reporting + SOW(WW)$(ORD(WW) LE SW_DESC('1','1')) = YES$(S_UCOBJ('OBJ1',WW) GE 0); + ELSE +* Set deviation bounds for OBJ1 if Single run in Phase 2 + F = UC_RHS('OBJ1','N'); + LOOP(SOW, Z = F; Z $= S_UC_RHS('OBJ1','N','1',SOW); + %VAR%_UC.LO(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)-ABS(%VAR%_UC.L(UC_N%SOW%)*Z); + %VAR%_UC.UP(UC_N('OBJ1')%SOW%)$((Z GE 0)$Z) = %VAR%_UC.L(UC_N%SOW%)+ABS(%VAR%_UC.L(UC_N%SOW%)*Z)); + AUXSOW(WW) = SOW(WW); SOW(WW) = ORD(WW) EQ 1; + OPTION SOLVEOPT=REPLACE; +$ BATINCLUDE solve.mod + )); + IF(SW_PHASE,SW_PROB(SOW) = EPS); +*------------------------------------------------------------------------------ + IF(NOT DOITER, SW_NORM = 1; +$ BATINCLUDE solve.mod + ); +*------------------------------------------------------------------------------ +$IF NOT %OBMAC%==YES $EXIT +* Load grid solutions if asynchronous + DOITER=2*(%MODEL_NAME%.solvelink=GDL)$GDL; +* Force clear solution if Grid SENSIS Runs + REG_FIXT(R)$GDL=MAX(REG_FIXT(R),1); + IF(NOT DOITER,OPTION CLEAR=WHANDLE); DUR_MAX=TIMEELAPSED; + REPEAT DONE=DOITER; + LOOP(ALLSOW$(SW_PROB(ALLSOW)$DOITER), + OPTION CLEAR=SOW; SOW(ALLSOW) = YES; + F = handlestatus(WHANDLE(ALLSOW)); + IF(F<>%Handlestatus.Running%, + IF(F=%handlestatus.Ready%, + Z=WHANDLE(ALLSOW); %MODEL_NAME%.handle=Z; +$IFI %SENSIS%==YES $BATINCLUDE sensis.stc + execute_loadhandle %MODEL_NAME%; +$IF %STAGES%==YES $GOTO ENDLD +$BATINCLUDE rptlite.rpt S WW, ALLSOW, NO +$IF DEFINED DAM_COST $BATINCLUDE rpt_dam.mod +$IFI %CLI%==YES $BATINCLUDE rpt_par.cli LOOP(SOW, ); +$IFI %MCA%==YES $BATINCLUDE main_ext.mod rpt_ext MCA +$LABEL ENDLD + F=1; DUR_MAX=TIMEELAPSED; DONE=0); + IF(F, F=handledelete(WHANDLE(ALLSOW))); + WHANDLE(SOW)=0)); + F=sleep(DONE+card(WHANDLE)*0.3); + UNTIL(CARD(WHANDLE)=0 OR TIMEELAPSED-DUR_MAX>10000); diff --git a/solve.stp b/solve.stp new file mode 100644 index 0000000..d9e6d47 --- /dev/null +++ b/solve.stp @@ -0,0 +1,338 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* SOLVE.stp is the code for handling stepped solution of TIMES +* %1 - mod +*=============================================================================* +$SET STEPPED YES +$IFI NOT %SPINES%==YES +$IFI %STAGES%==YES $SET STEPPED NO +$IF %STEPPED%==NO +$IF SET TIMESTEP $ABORT Stepped TIMES Not available with STAGES/SENSIS! +$IF NOT %VAR_UC%==YES $ABORT Invalid VAR_UC setting for stepped mode. +$IF NOT %RPOINT%==NO $SET SOLVE_NOW NO +$IF NOT SET TIMESTEP $SET TIMESTEP '999' SET STEPPED NO +*----------------------------------------------------------------------------- + SCALAR PRESOL / 1 /; + SET UC_RN(UC_N,ALL_R) //; + SET R_UCT(R,UC_N,T) //; + SET RTP_IRE(R,T,P,IE) 'IRE equations with fixed regions'; + SET IRE_RPR(R,P,R,IE) 'All regions REG linked to IRE process by equations in R'; + SET IRE_FXT(R,T,P) 'IRE with some linked regions fixed at T'; + PARAMETER STP_UCT(J,ALL_R,UCN,LL); + PARAMETER STP_DIV(J,R,T,P) //; + PARAMETER UC_BND(J,ALL_R,UCN,LL,S,L); + PARAMETER PAR_CUMFLOM(R,P,C,LL,LL), PAR_UCR(UC_N,ALL_R); +*----------------------------------------------------------------------------- +$ IF NOT SET FIXBOH $GOTO MCOPIED +* Copy previous marginals to preseve freezed results +$ IF NOT %STAGES%==YES $GOTO MCOPIED + %EQ%G_COMBAL.M(RTC,S%SWT%) $= EQG_COMBAL.M(RTC,S); + %EQ%E_COMBAL.M(RTC,S%SWT%) $= EQE_COMBAL.M(RTC,S); + %EQ%_PEAK.M(RTC,S%SWT%) $= EQ_PEAK.M(RTC,S); +$ LABEL MCOPIED +$ SETLOCAL SW1 '' SETLOCAL SW2 +$ IFI %STAGES%==YES $SETLOCAL SW2 ",'1',SOW" SETLOCAL SW1 S_ +$ IFI %SPINES%==YES $BATINCLUDE clearsol.stc DEF +*----------------------------------------------------------------------------- +* Establish partitioning of T into fixed, current, and pending +* BACKWARD(T) = fixed T +* SUBT(T) = current T +* FORWARD(T) = pending T + YR_V1 = 0; YR_VL = %TIMESTEP%; MY_FYEAR = 0; REG_FIXT(R)$NO = 0; + IF(G_OVERLAP, G_OVERLAP = MAX(EPS,G_OVERLAP); ELSE G_OVERLAP = FLOOR(YR_VL/2)); +$ IF SET FIXBOH YR_V1 = ABS(%FIXBOH%); REG_FIXT(R)$(NOT REG_FIXT(R)) = YR_V1; +$ IF '%RTPX%'==X MY_FYEAR = 1; + F = SUM(MIYR_1(T),M(T)); + REG_FIXT(R)$(REG_FIXT(R) < F) = 0; + YR_V1 = SMIN((R,T)$(M(T) > REG_FIXT(R)),M(T)); + Z = YR_V1 + YR_VL; + SUBT(T)$(M(T) < YR_V1) = NO; + SUBT(T)$(M(T) GE Z) = NO; + OPTION CLEAR=BACKWARD, CLEAR=FORWARD, RTC_NET REG_FIXT(R)); + NO_RT(R,T) = NOT RT_PP(R,T); +*----------------------------------------------------------------------------- +* Clear previous solution for projection years & ensure VAR_ACT loadpoint +$ INCLUDE clearsol.stp + VAR_ACT.M(RVT,P,S)=0; + IF(VAR_UC.L('%SYSPREFIX%SOLVE_STATUS')=0, OPTION TRACKP 1, + STP_DIV('1',R,T,P) $= OBJ_DIVI(R,T,P); + STP_DIV('2',R,T,P) $= OBJ_DIVIV(R,T,P); + STP_DIV('3',R,T,P) $= OBJ_DIVIII(R,T,P)); +*----------------------------------------------------------------------------- +$IF %STEPPED%==YES WHILE(CARD(SUBT), +*----------------------------------------------------------------------------- + BACKWARD(T) = (M(T) < YR_V1); + FORWARD(SUBT) = NO; + NO_RT(R,T(BACKWARD)) = 1; + RT_PP(R,T) = SUBT(T)$(NOT NO_RT(R,T)); + V(FORWARD) = NO; +* Re-define End-of-Horizon + IF(CARD(SUBT), MIYR_VL = SMAX(SUBT(T),E(T))); + OPTION CLEAR=Y_EOH, CLEAR=MIYR_L; + Y_EOH(EOHYEARS)$((YEARVAL(EOHYEARS) <= MIYR_VL)$(YEARVAL(EOHYEARS) >= MINYR)) = YES; + LOOP(MIYR_1(YEAR), Z=MIYR_VL-YEARVAL(YEAR); MIYR_L(YEAR+Z) = YES); +*----------------------------------------------------------------------------- +* Complete adjusted model +* Adjust divisor data when appropriate +$IF NOT '%CTST%'=='' $BATINCLUDE coef_alt.lin STP +* We must recompute OBJ_LIFE and salvage values + OBJ_LIFE(K(LL),R,JOT,LIFE,CUR)$OBJ_LIFE(K,R,JOT,LIFE,CUR) = SUM((OPYEAR(LIFE,AGE),Y_EOH(LL+(ORD(AGE)-1))),OBJ_DISC(R,Y_EOH,CUR))+EPS; +$IF %STEPPED%==YES $BATINCLUDE eqobsalv.%1 STP EXIT + RVPRL(R,K,P)$RVPRL(R,K,P)=MAX(1,SMAX(RTP_CPTYR(R,VNT(K,V(T)),P),YEARVAL(V))-YEARVAL(K)); +*----------------------------------------------------------------------------- +* Handle Dynamic constraints and Multi-regional UC relaxation +* Remove UC_T_SUM if it does not overlap with SUBT + OPTION CLEAR=RXX,CLEAR=UNCD1; + RXX(UC_R_EACH(R,UC_N),R)$SUM(UC_T_SUM(R,UC_N,T)$RT_PP(R,T),YES) = YES; + UNCD1(UC_N)$SUM(UC_T_SUM(UC_R_SUM(R,UC_N),T)$RT_PP(R,T),YES) = YES; + UC_T_SUM(R,UC_N,T)$FORWARD(T) = NO; + UC_T_SUM(R,UC_N,T)$((NOT UNCD1(UC_N))$(NOT RXX(R,UC_N,R))) = NO; + IF(PRESOL, VAR_UC.L(UC_N(UNCD1)) = 0; VAR_UCR.L(UC_N,R)$RXX(R,UC_N,R) = 0); +* Remove UC_T_EACH for all but SUBT +* Remove UC_T_SUCC until not completely fixed or if even partly pending + OPTION CLEAR=UC_T; + LOOP(UC_T_EACH(UC_R_SUM(R,UC_N),T)$RT_PP(R,T), UC_T(UC_N,T) = YES); + LOOP(UC_T_SUCC(UC_R_SUM(R,UC_N),T)$RT_PP(R,T), UC_T(UC_N,T) = YES); + UC_T_EACH(UC_R_SUM(R,UC_N),T)$(NOT UC_T(UC_N,T)) = NO; + UC_T_SUCC(UC_R_SUM(R,UC_N),T)$(UC_DYNDIR(R,UC_N,'RHS')$(NOT UC_T(UC_N,T))) = NO; + UC_T_EACH(UC_R_EACH(R,UC_N),T)$(NOT RT_PP(R,T)) = NO; + UC_T_SUCC(UC_R_EACH(R,UC_N),T)$(UC_DYNDIR(R,UC_N,'RHS')$(NOT RT_PP(R,T))) = NO; + UC_T_SUCC(UC_T_SUCC(R,UC_N,T-1)) = UC_DYNDIR(R,UC_N,'RHS')+RT_PP(R,T); + UC_T(UC_N,T)$(NOT SUM(R$NO_RT(R,T),1)) = NO; +$ IFI %CLI%==YES LOOP(T$(NOT SUM(R,NOT NO_RT(R,T))),CM_MAXC(LL,CG)$SUPERYR(T,LL) = 0); + + LOOP(BD,UC_T_SUCC(R,UC_N,T)$UC_DYNBND(UC_N,BD) = RT_PP(R,T)); +* RHS and Bounds Relaxation +$ SETLOCAL TOLR '3E-6' SETLOCAL TOLA '1E-4' SETLOCAL TOLX '1E-5' +$IF DEFINED XTP $SETLOCAL TOLR '2E-8' SETLOCAL TOLA 1E-6 + IF(CARD(BACKWARD) OR MY_FYEAR, OPTION CLEAR=UC_BND,CLEAR=R_UCT; + R_UCT(R_UC(R,UC_N),T)$(UC_T_EACH(R,UC_N,T)+UC_T_SUCC(R,UC_N,T)) = YES; + LOOP(UC_R_SUM(R_UC(R,UC_N)),UC_T(UC_N,T)$R_UCT(R,UC_N,T) = YES); + R_UCT(R,UC_N,T)$(NOT REG_FIXT(R)) = NO; +* Set into UC_BND the RHS corrected by actual slack level, if RHS already violated + UC_BND('1','IMPEXP',UC_N,'0','ANNUAL','UP')$UC_RHS(UC_N,'UP') = MAX(UC_RHS(UC_N,'UP'),VAR_UC.L(UC_N)-INF$(NOT VAR_UC.L(UC_N))); + UC_BND('2',R,UC_N,'0','ANNUAL','UP')$UC_RHSR(R,UC_N,'UP') = MAX(UC_RHSR(R,UC_N,'UP'),VAR_UCR.L(UC_N,R)-INF$(NOT VAR_UCR.L(UC_N,R))); + UC_BND('3','IMPEXP',UC_N,T,'ANNUAL','UP')$UC_RHST(UC_N,T,'UP') = MAX(UC_RHST(UC_N,T,'UP'),VAR_UCT.L(UC_N,T)-INF$(NOT VAR_UCT.L(UC_N,T))); + UC_BND('4','IMPEXP',UC_N,T,S,'UP')$UC_RHSTS(UC_N,T,S,'UP') = MAX(UC_RHSTS(UC_N,T,S,'UP'),VAR_UCTS.L(UC_N,T,S)-INF$(NOT VAR_UCTS.L(UC_N,T,S))); + UC_BND('5',R,UC_N,T,'ANNUAL','UP')$UC_RHSRT(R,UC_N,T,'UP') = MAX(UC_RHSRT(R,UC_N,T,'UP'),VAR_UCRT.L(UC_N,R,T)-INF$(NOT VAR_UCRT.L(UC_N,R,T))); + UC_BND('6',R,UC_N,T,S,'UP')$UC_RHSRTS(R,UC_N,T,S,'UP') = MAX(UC_RHSRTS(R,UC_N,T,S,'UP'),VAR_UCRTS.L(UC_N,R,T,S)-INF$(NOT VAR_UCRTS.L(UC_N,R,T,S))); + UC_BND('1','IMPEXP',UC_N,'0','ANNUAL','LO')$UC_RHS(UC_N,'LO') = MIN(UC_RHS(UC_N,'LO'),VAR_UC.L(UC_N)+INF$(NOT VAR_UC.L(UC_N))); + UC_BND('2',R,UC_N,'0','ANNUAL','LO')$UC_RHSR(R,UC_N,'LO') = MIN(UC_RHSR(R,UC_N,'LO'),VAR_UCR.L(UC_N,R)+INF$(NOT VAR_UCR.L(UC_N,R))); + UC_BND('3','IMPEXP',UC_N,T,'ANNUAL','LO')$UC_RHST(UC_N,T,'LO') = MIN(UC_RHST(UC_N,T,'LO'),VAR_UCT.L(UC_N,T)+INF$(NOT VAR_UCT.L(UC_N,T))); + UC_BND('4','IMPEXP',UC_N,T,S,'LO')$UC_RHSTS(UC_N,T,S,'LO') = MIN(UC_RHSTS(UC_N,T,S,'LO'),VAR_UCTS.L(UC_N,T,S)+INF$(NOT VAR_UCTS.L(UC_N,T,S))); + UC_BND('5',R,UC_N,T,'ANNUAL','LO')$UC_RHSRT(R,UC_N,T,'LO') = MIN(UC_RHSRT(R,UC_N,T,'LO'),VAR_UCRT.L(UC_N,R,T)+INF$(NOT VAR_UCRT.L(UC_N,R,T))); + UC_BND('6',R,UC_N,T,S,'LO')$UC_RHSRTS(R,UC_N,T,S,'LO') = MIN(UC_RHSRTS(R,UC_N,T,S,'LO'),VAR_UCRTS.L(UC_N,R,T,S)+INF$(NOT VAR_UCRTS.L(UC_N,R,T,S))); +* Add relaxation tolerances; absolute only if both positive+negative coefficients + UC_BND(J,ALL_R,UC_N,LL,S,'UP')$UC_BND(J,ALL_R,UC_N,LL,S,'UP') = UC_BND(J,ALL_R,UC_N,LL,S,'UP')+ABS(UC_BND(J,ALL_R,UC_N,LL,S,'UP'))*%TOLR%+%TOLA%$UC_RN(UC_N,ALL_R); + UC_BND(J,ALL_R,UC_N,LL,S,'LO')$UC_BND(J,ALL_R,UC_N,LL,S,'LO') = UC_BND(J,ALL_R,UC_N,LL,S,'LO')-ABS(UC_BND(J,ALL_R,UC_N,LL,S,'LO'))*%TOLR%-%TOLA%$UC_RN(UC_N,ALL_R); +* Copy back to RHS (VAR bounds would be cleared in sensitivity analysis) + UC_RHS(UC_N,BDNEQ(BD)) $= UC_BND('1','IMPEXP',UC_N,'0','ANNUAL',BD); + UC_RHSR(R,UC_N,BDNEQ(BD))$REG_FIXT(R) $= UC_BND('2',R,UC_N,'0','ANNUAL',BD); + UC_RHST(UC_T(UC_N,T),BDNEQ(BD)) $= UC_BND('3','IMPEXP',UC_N,T,'ANNUAL',BD); + UC_RHSTS(UC_T(UC_N,T),S,BDNEQ(BD)) $= UC_BND('4','IMPEXP',UC_N,T,S,BD); + UC_RHSRT(R_UCT(R,UC_N,T),BDNEQ(BD)) $= UC_BND('5',R,UC_N,T,'ANNUAL',BD); + UC_RHSRTS(R_UCT(R,UC_N,T),S,BDNEQ(BD)) $= UC_BND('6',R,UC_N,T,S,BD); +* Handle other important dynamic constraints + LOOP((R,T,SAMEAS(T+1,TT))$NO_RT(R,T), + PRC_DYNUC(UC_N,'LHS',RTP(R,TT,P),UC_GRPTYPE,'UP')$PRC_DYNUC(UC_N,'RHS',R,'0',P,UC_GRPTYPE,'UP') = PRC_DYNUC(UC_N,'LHS',R,TT,P,UC_GRPTYPE,'UP')*(1+%TOLR%); + PRC_DYNUC(UC_N,'LHS',RTP(R,TT,P),UC_GRPTYPE,'LO')$PRC_DYNUC(UC_N,'RHS',R,'0',P,UC_GRPTYPE,'LO') = PRC_DYNUC(UC_N,'LHS',R,TT,P,UC_GRPTYPE,'LO')*(1-%TOLX%)); + %SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%)$(REG_FIXT(R)$%SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%)) = MAX(%SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%),MIN(%SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'UP'%SW2%),VAR_CUMCOM.L(R,C,COM_VAR,YEAR,LL)*%CUCSCAL%)*(1+%TOLR%)); + %SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'LO'%SW2%)$REG_FIXT(R) $= %SW1%COM_CUM(R,COM_VAR,YEAR,LL,C,'LO'%SW2%)*(1-%TOLR%); + %SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%)$(REG_FIXT(R)$%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%)) = MAX(%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%),MIN(%SW1%FLO_CUM(R,P,C,YEAR,LL,'UP'%SW2%),VAR_CUMFLO.L(R,P,C,YEAR,LL)*%CUFSCAL%)*(1+%TOLR%)); + %SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%)$REG_FIXT(R) $= %SW1%FLO_CUM(R,P,C,YEAR,LL,'LO'%SW2%)*(1-%TOLR%); + %SW1%CAP_BND(R,T,P,'UP'%SW2%)$%SW1%CAP_BND(R,T,P,'UP'%SW2%) = MAX(%SW1%CAP_BND(R,T,P,'UP'%SW2%),VAR_CAP.L(R,T,P)*(1+%TOLR%)); + %SW1%CAP_BND(R,T,P,'LO'%SW2%) $= %SW1%CAP_BND(R,T,P,'LO'%SW2%)*(1-%TOLR%); + ); +$ BATINCLUDE bnd_ucw.%1 +* Redefine UC_RHSMAP according to current flags + OPTION CLEAR=UC_RHSMAP; + LOOP((UC_R_EACH(R,UC_N),T,LIM)$UC_RHSRT(R,UC_N,T,LIM), + IF( SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','SEVERAL',R,T,ANNUAL) = YES; + ELSEIF SUM(UC_TS_SUM(R,UC_N,S),1)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','SEVERAL',R,T,ANNUAL) = YES; + )); + LOOP((UC_R_EACH(R,UC_N),T,S,LIM)$UC_RHSRTS(R,UC_N,T,S,LIM), + IF( UC_TS_EACH(R,UC_N,S)$UC_T_EACH(R,UC_N,T),UC_RHSMAP(UC_N,'EACH','EACH',R,T,S) = YES; + ELSEIF UC_TS_EACH(R,UC_N,S)$UC_T_SUCC(R,UC_N,T),UC_RHSMAP(UC_N,'SUCC','EACH',R,T,S) = YES; + )); + IF(CARD(REG_CUMCST),LOOP((R,T)$NO_RT(R,T),REG_CUMCST(R,YEAR,LL,COSTCAT,CUR,'UP')$SUPERYR(T,LL) = 0)); +*----------------------------------------------------------------------------- +* Activities and flows +$IF '%RTPX%'==X LOOP(R, BACKWARD(T) = NO_RT(R,T); SUBT(T) = RT_PP(R,T); + %VAR%_ACT.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S%SOW%)$(PRC_TS(R,P,S)) = VAR_ACT.L(R,V,T,P,S); + %VAR%_FLO.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S%SOW%)$(RPCS_VAR(R,P,C,S)*RP_FLO(R,P)) = VAR_FLO.L(R,V,T,P,C,S); + %VAR%_IRE.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S,IE%SOW%)$(RPCS_VAR(R,P,C,S)*RPC_IRE(R,P,C,IE)) = VAR_IRE.L(R,V,T,P,C,S,IE); + %VAR%_SIN.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S%SOW%)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = VAR_SIN.L(R,V,T,P,C,S); + %VAR%_SOUT.FX(RTP_VINTYR(R,V,BACKWARD(T),P),C,S%SOW%)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = VAR_SOUT.L(R,V,T,P,C,S); + %VAR%_UPS.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S,BD(L)%SOW%)$RPS_UPS(R,P,S) = VAR_UPS.L(R,V,T,P,S,L); + %VAR%_UPT.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S,UPT%SOW%)$(RPS_UPS(R,P,S)$RP_DP(R,P)) = VAR_UPT.L(R,V,T,P,S,UPT); + %VAR%_UDP.FX(RTP_VINTYR(R,V,BACKWARD(T),P),S,BD(L)%SOW%)$(PRC_TS(R,P,S)$RP_UPR(R,P,BD)) = VAR_UDP.L(R,V,T,P,S,L); +* Commodities + %VAR%_COMNET.FX(RTC_NET(R,BACKWARD(T),C),S%SOW%)$COM_TS(R,C,S) = VAR_COMNET.L(R,T,C,S); + %VAR%_COMPRD.FX(RTC_PRD(R,BACKWARD(T),C),S%SOW%)$COM_TS(R,C,S) = VAR_COMPRD.L(R,T,C,S); + %VAR%_ELAST.FX(RTC(R,BACKWARD(T),C),S,J,BD%SOW%)$(COM_TS(R,C,S)$RCJ(R,C,J,BD)) = VAR_ELAST.L(RTC,S,J,BD); +$IF DEFINED %VAR%_DAM VAR_DAM.L(R,T,C,BD,J)$NO=0; %VAR%_DAM.FX(R,T(BACKWARD),C,BD,J%SOW%)$((ORD(J) LE DAM_STEP(R,C,BD))$DAM_STEP(R,C,'FX')) = VAR_DAM.L(R,T,C,BD,J); +* Capacities + %VAR%_NCAP.FX(R,BACKWARD(T),P%SOW%)$RP(R,P) = MAX(EPS,VAR_NCAP.L(R,T,P)); + %VAR%_CAP.UP(RTP(R,BACKWARD(T),P)%SOW%) = INF; + %VAR%_CAP.LO(RTP(R,BACKWARD(T),P)%SOW%) = 0; + OPTION CLEAR=NO_RVP; NO_RVP(RTP_VARP(R,SUBT(T),P))$SUM(RTP_CPTYR(R,BACKWARD(TT),T,P),1) = YES; + %VAR%_CAP.UP(NO_RVP(R,T,P)%SOW%)$CAP_BND(R,T,P,'UP') = CAP_BND(R,T,P,'UP'); + %VAR%_CAP.LO(NO_RVP(R,T,P)%SOW%)$CAP_BND(R,T,P,'LO') = CAP_BND(R,T,P,'LO'); + %VAR%_SCAP.FX(RTP_CPTYR(R,V,BACKWARD(T),P)%SOW%)$PRC_RCAP(R,P) = VAR_SCAP.L(R,V,T,P); +* Cumulative variables + Z = (SMAX(T,M(T)) > MIYR_VL); + FIL(LL) = Z*(MIYR_VL < YEARVAL(LL)); +* Get new modifiers for flexible model horizon +$IFI NOT %SENSIS%==YES $BATINCLUDE bnd_cum.mod COM_VAR +* Remove LO bounds if years only partially in current horizon and no adjustment for shorter horizon + %VAR%_CUMFLO.LO(R,P,C,YEAR,LL %SOW%)$((NOT FLO_CUM(R,P,C,YEAR,LL,'N'))$FIL(LL)) = 0; + %VAR%_CUMCOM.LO(R,C,COM_VAR,YEAR,LL %SOW%)$((NOT COM_CUM(R,COM_VAR,YEAR,LL,C,'N'))$FIL(LL)) = 0; +$LABEL DONECUM +* Blending + VAR_BLND.L(RT_PP,BLE,OPR)=0; + %VAR%_BLND.FX(R,BACKWARD(T),BLE,OPR%SOW%)$BLE_OPR(R,BLE,OPR) = VAR_BLND.L(R,T,BLE,OPR); +$IF '%RTPX%'==X ); BACKWARD(T) = M(T) < YR_V1; SUBT(T) = TT(T)-BACKWARD(T)-FORWARD(T); +*----------------------------------------------------------------------------- + IF(MY_FYEAR, +* Find all regions REG linked to IRE equations in region R + TRACKPC(RPC(R,P,C))$(RPC_EQIRE(R,P,C,'EXP')+RPC_MARKET(R,P,C,'EXP')) = YES; + LOOP((TRACKPC(R,P,C),TOP_IRE(R,C,REG,COM,P)),IRE_RPR(R,P,REG,'EXP') = YES); + OPTION CLEAR=TRACKPC; + LOOP((TOP_IRE(R,C,REG,COM,P),RPC_EQIRE(REG,P,COM,'IMP')),IRE_RPR(REG,P,R,'IMP') = YES); + OPTION CLEAR=RTPX; RTPX(RTP(R,T,P))$RP_IRE(R,P) = RT_PP(R,T); + LOOP((REG,IE),RTPX(RTP(R,T,P))$(RT_PP(REG,T)$IRE_RPR(R,P,REG,IE)) = YES); + IRE_FXT(RTP(R,T,P))$(NO_RT(R,T)$RP_IRE(R,P)) = YES; + LOOP((REG,IE),IRE_FXT(R,T,P)$(NO_RT(REG,T)$IRE_RPR(R,P,REG,IE)) = YES); +* Remove RTP for IRE fixed in all linked regions, and save marginals + IF(PRESOL,OPTION CLEAR=PAR_IPRIC; EQ_IRE.M(R,T,P,C,IE,S)$NO = 0); + PAR_IPRIC(IRE_FXT,C,S,IE)$(PAR_IPRIC(IRE_FXT,C,S,IE)=0) $= EQ_IRE.M(IRE_FXT,C,IE,S); +* Relax all fixed flows in regions with IRE equations + OPTION CLEAR=RTP_IRE; LOOP(REG,RTP_IRE(RTPX(R,T,P),IE)$(IRE_RPR(R,P,REG,IE)$NO_RT(R,T)) = YES); + %VAR%_IRE.UP(RTP_VINTYR(R,V,T,P),C,S,IE%SOW%)$(RTP_IRE(R,T,P,IE)*RPCS_VAR(R,P,C,S)*RPC_IREIO(R,P,C,IE,'IN')) = VAR_IRE.L(R,V,T,P,C,S,IE)*(1+%TOLX%*POWER(8,-1$XPT(IE))); + %VAR%_IRE.LO(RTP_VINTYR(R,V,T,P),C,S,IE%SOW%)$(RTP_IRE(R,T,P,IE)*RPCS_VAR(R,P,C,S)*RPC_IREIO(R,P,C,IE,'IN')) = VAR_IRE.L(R,V,T,P,C,S,IE)*(1-%TOLX%*POWER(8,-1$IMP(IE))); + LOOP(IE, +$IF %REDUCE%==YES %VAR%_ACT.UP(RTP_VINTYR(R,V,T,P),S%SOW%)$(RTP_IRE(R,T,P,IE)*PRC_TS(R,P,S)*RP_PGACT(R,P)) = VAR_ACT.L(R,V,T,P,S)*(1+%TOLX%*POWER(8,-1$XPT(IE))); +$IF %REDUCE%==YES %VAR%_ACT.LO(RTP_VINTYR(R,V,T,P),S%SOW%)$(RTP_IRE(R,T,P,IE)*PRC_TS(R,P,S)*RP_PGACT(R,P)) = VAR_ACT.L(R,V,T,P,S)*(1-%TOLX%*POWER(8,-1$IMP(IE))); + ); +* Remove IRE_BND from fixed regions with no related IRE equation, and all IRE_XBND from fixed regions + OPTION CLEAR=RXX; + LOOP((R,T,C,S,ALL_REG,IE,BD)$(NO_RT(R,T)$IRE_BND(R,T,C,S,ALL_REG,IE,BD)), + IF(NOT SUM(RPC_EQIRE(R,P,C,IE)$RTPX(R,T,P),1), + IF(NOT SUM(RPC_MARKET(R,P,C,IE)$RTPX(R,T,P),1),RXX(R,C,IE) = YES))); + IRE_BND(R,T,C,S,ALL_REG,IE,BD)$(NO_RT(R,T)$RXX(R,C,IE)) = 0; + IRE_XBND(R,T,C,S,IE,BD)$NO_RT(R,T) = 0; + ); +*----------------------------------------------------------------------------- +$IF '%RTPX%'==X FIL(T)=FORWARD(T); LOOP(R, FORWARD(T)=FIL(T)$(NOT NO_RT(R,T)); +* Activities and flows + VAR_ACT.FX(RTP_VINTYR(R,V,FORWARD(T),P),S)$(PRC_TS(R,P,S)) = 0; + VAR_FLO.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S)$(RPCS_VAR(R,P,C,S)*RP_FLO(R,P)) = 0; +* VAR_IRE.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S,IE)$(RPCS_VAR(R,P,C,S)*RPC_IRE(R,P,C,IE)) = 0; + VAR_SIN.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = 0; + VAR_SOUT.FX(RTP_VINTYR(R,V,FORWARD(T),P),C,S)$(RPCS_VAR(R,P,C,S)*RPC_STG(R,P,C)) = 0; +* Commodities + VAR_COMNET.FX(RTCS_VARC(R,FORWARD(T),C,S)) = 0; + VAR_COMPRD.FX(RTCS_VARC(R,FORWARD(T),C,S)) = 0; + VAR_ELAST.FX(RTCS_VARC(R,FORWARD(T),C,S),J,BD)$RCJ(R,C,J,BD) = 0; +* Capacities + VAR_CAP.LO(RTP(R,FORWARD(T),P)) = 0; + VAR_CAP.UP(RTP(R,FORWARD(T),P)) $= CAP_BND(RTP,'UP'); +* Blending + VAR_BLND.FX(R,FORWARD(T),BLE,OPR)$BLE_OPR(R,BLE,OPR) = 0; +$IF '%RTPX%'==X ); FORWARD(T)=FIL(T); +*----------------------------------------------------------------------------- +* Reject starting basis if equations were removed: + IF(CARD(NO_RT)+CARD(FORWARD), OPTION BRATIO=1); + OPTION SOLVEOPT=MERGE; +* Save last cum marginal + IF(PRESOL=0, PAR_CUMFLOM(R,P,C,YEAR,LL) $= VAR_CUMFLO.M(R,P,C,YEAR,LL); + PAR_UCR(UC_N,'IMPEXP') $= VAR_UC.M(UC_N); PAR_UCR(UC_N,R) $= VAR_UCR.M(UC_N,R)); +*----------------------------------------------------------------------------- +$ SET EXT mod +$ IFI %STAGES%==YES $SET EXT stc +$ IFI %SPINES%==YES $SET EXT mod +$ BATINCLUDE solve.%EXT% + PRESOL = 0; +$IF NOT %STEPPED%==YES $GOTO ENDSTEP +*----------------------------------------------------------------------------- +* Restore last cum marginal + VAR_UC.M(UC_N)$(VAR_UC.M(UC_N)=0) $= PAR_UCR(UC_N,'IMPEXP'); + VAR_UCR.M(UC_N,R)$(VAR_UCR.M(UC_N,R)=0) $= PAR_UCR(UC_N,R); + VAR_CUMFLO.M(R,P,C,YEAR,LL)$(VAR_CUMFLO.M(R,P,C,YEAR,LL)=0) $= PAR_CUMFLOM(R,P,C,YEAR,LL); +* Adjust SUBT + SUBT(T) = SUBT(T-1); + Z = SMIN(FORWARD(T),B(T)); + YR_V1 = SMIN(SUBT(T)$(M(T) GE Z-G_OVERLAP),M(T)); + Z = YR_V1 + YR_VL; + SUBT(T)$(M(T) < Z) = YES; + SUBT(T)$(M(T) < YR_V1) = NO; +*----------------------------------------------------------------------------- +* Restore some original data + V(T) = YES; + UC_T_SUM(R,UC_N,T) $= STP_UCT('1',R,UC_N,T); + UC_T_SUCC(R,UC_N,T) $= STP_UCT('2',R,UC_N,T); + UC_T_EACH(R,UC_N,T) $= STP_UCT('3',R,UC_N,T); +$IF '%RTPX%'==X LOOP(R, BACKWARD(T)=NO_RT(R,T); +$ IFI %SPINES%==YES $BATINCLUDE pextlevs.stc "'1'" (BACKWARD) +$IF '%RTPX%'==X ); +* Reset bounds +$ BATINCLUDE bndmain.%1 %1 1 +*----------------------------------------------------------------------------- + ); +$LABEL ENDSTEP +*----------------------------------------------------------------------------- +* Remove superfluous values + %VAR%_NCAP.L(R,T,P%SOW%)$((%VAR%_NCAP.L(R,T,P%SOW%) EQ 0)$%VAR%_NCAP.L(R,T,P%SOW%)) = 0; + %VAR%_NCAP.M(R,T,P%SOW%)$NO_RT(R,T) = 0; + %VAR%_ACT.M(R,V,T,P,S%SOW%)$NO_RT(R,T) = 0; + %VAR%_FLO.M(R,V,T,P,C,S%SOW%)$NO_RT(R,T) = 0; + %VAR%_IRE.M(R,V,T,P,C,S,IE%SOW%)$NO_RT(R,T) = 0; + IF(MY_FYEAR,%EQ%_IRE.M(IRE_FXT(R,T,P),C,IE,S%SWT%) $= PAR_IPRIC(R,T,P,C,S,IE)); diff --git a/spoint.mod b/spoint.mod new file mode 100644 index 0000000..728a9c4 --- /dev/null +++ b/spoint.mod @@ -0,0 +1,87 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* SPOINT.mod is the code for handling solution point saving/loading +* %1 - 1 or 0 (1: before solve, 0: renaming after solve) +* Note: Using Posix utility mv for renaming for portability +*=============================================================================* +$SETLOCAL PATH '%GDXPATH%' SETLOCAL PNT1 '_p' SETLOCAL PNT2 '' +$IF SET FIXBOH $SETLOCAL PNT1 '' SETLOCAL PNT2 '_p' +$IF NOT SET SPOINT $GOTO CHECK +$IFI %SPOINT%==YES $SET SPOINT 1 + IF(J('%SPOINT%'), Z = SUM(SAMEAS('%SPOINT%',J),ORD(J)); + IF(MOD(Z,2), OPTION SAVEPOINT=1; +* Reset GDX file to ensure it will always be written if SAVEPOINT=1 + IF(%1,execute_unload '%MODEL_NAME%_p.gdx',IMP; + ELSE execute 'mv -uf %MODEL_NAME%_p.gdx %PATH%%RUN_NAME%_p.gdx'))); +$LABEL CHECK +$IF '%1'=='0' $EXIT +*----------------------------------------------------------------------------- +$IF %STAGES%==YES $BATINCLUDE clearsol.stc ALL +*----------------------------------------------------------------------------- +$LABEL LOADS +$IF %RPOINT%==NO $GOTO LLOAD +$IFI NOT %RPOINT%==YES $SET LPOINT %RPOINT% +$CLEAR EQ_IRE EQE_CPT EQ_PEAK EQE_UCRTP EQE_COMBAL EQG_COMBAL EQE_COMPRD VAR_UPS VAR_UPT VAR_UDP +$CLEAR EQE_UC EQE_UCR EQE_UCT EQE_UCRT EQE_UCTS EQE_UCRTS EQE_UCRS EQE_UCSU EQE_UCSUS EQE_UCRSU EQE_UCRSUS +$IF %VAR_UC%==YES $GOTO UCLEAR +$CLEAR EQG_UC EQG_UCR EQG_UCT EQG_UCRT EQG_UCTS EQG_UCRTS EQG_UCRS EQG_UCSU EQG_UCSUS EQG_UCRSU EQG_UCRSUS +$CLEAR EQL_UC EQL_UCR EQL_UCT EQL_UCRT EQL_UCTS EQL_UCRTS EQL_UCRS EQL_UCSU EQL_UCSUS EQL_UCRSU EQL_UCRSUS +$LABEL UCLEAR +$IF DEFINED EQ_CLITOT OPTION CLEAR=EQ_CLITOT,CLEAR=EQ_CLIMAX; VAR_CLIBOX.L(CM_VAR,LL)$NO=0; + VAR_BLND.L(R,T,BLE,OPR)$NO = 0; +$IF %TIMESED%==YES VAR_OBJELS.L(R,BD,CUR)$NO = 0; +$IFI %MERGE%==YES $BATINCLUDE clears.mrg +$IF SET TIMESTEP $BATINCLUDE eqobsalv.mod STP EXIT +$ BATINCLUDE pp_clean.mod +*----------------------------------------------------------------------------- +$LABEL LLOAD +$SET LOAD 0 +$IF NOT SET LPOINT $GOTO RUNNAME +$IF EXIST %PATH%%LPOINT%%PNT1%.gdx $SET LOAD 2 +$IF %LOAD%==2 execute_loadpoint '%PATH%%LPOINT%%PNT1%.gdx'; +$IF %LOAD%==2 $GOTO FINISH +$IF EXIST %PATH%%LPOINT%%PNT2%.gdx $SET LOAD 2 +$IF %LOAD%==2 execute_loadpoint '%PATH%%LPOINT%%PNT2%.gdx'; +$IF %LOAD%==2 $GOTO FINISH +$IF SET FIXBOH $ABORT Could not load gdx file %LPOINT% +*----------------------------------------------------------------------------- +$LABEL RUNNAME +$IF NOT SET SPOINT $GOTO FINISH +$IFI %LPOINT%==%RUN_NAME% $GOTO FINISH +$IF %SPOINT%==2 $SET LOAD 1 +$IF %SPOINT%==3 $SET LOAD 1 +$IF %LOAD%==0 $GOTO FINISH +$IF EXIST %PATH%%RUN_NAME%_P.gdx $SET LOAD 2 +$IF %LOAD%==2 execute_loadpoint '%PATH%%RUN_NAME%_p.gdx'; +$IF %LOAD%==2 $GOTO FINISH +$IF EXIST %PATH%%RUN_NAME%.gdx $SET LOAD 2 +$IF %LOAD%==2 execute_loadpoint '%PATH%%RUN_NAME%.gdx'; +*----------------------------------------------------------------------------- +$LABEL FINISH +$IF NOT DEFINED REG_BDNCAP $SET LOAD 0 +$IF NOT %LOAD%==2 $CLEAR REG_BDNCAP +$IF NOT %LOAD%==2 $EXIT +* Fix new capacities to previous solution if requested + SET RT_NO(R,T), RTCS(R,ALLYEAR,C,S); + REG_BDNCAP(R,BDNEQ)$REG_BDNCAP(R,'FX')=MAX(REG_BDNCAP(R,BDNEQ),REG_BDNCAP(R,'FX'))$SUM(BD,REG_BDNCAP(R,BD)$BDSIG(BD)); + REG_BDNCAP(R,'FX')$SUM(BDNEQ$REG_BDNCAP(R,BDNEQ),1)=0; + LOOP((R,BD)$REG_BDNCAP(R,BD),Z=REG_BDNCAP(R,BD); RT_NO(R,T)$(M(T)<=Z)=YES); +* Determine which milestones available + RTCS(RTC,S--ORD(S))$=EQG_COMBAL.M(RTC,S); + RTCS(RTC,S--ORD(S))$=EQE_COMBAL.M(RTC,S); + OPTION FIL < RTCS; + PASTSUM(RTP(RT_NO(R,T(FIL)),P))$PRC_CAP(R,P)=EPS; + PASTSUM(RTP(RT_NO,P)) $= VAR_NCAP.L(RTP); + RTPS_BD(RTP(RT_NO(R,T),P),ANNUAL,BD)$((M(T)<=REG_BDNCAP(R,BD))$PASTSUM(RTP)) = YES; + RTPS_BD(RTP(RT_NO(R,T),P),ANNUAL(S),BDNEQ)$(RTPS_BD(RTP,S,'LO')$RTPS_BD(RTP,S,'UP')) = BDSIG(BDNEQ)-NCAP_BND(R,'0',P,'N'); + NCAP_BND(RTP(RT_NO(R,T),P),BD)$RTPS_BD(RTP,'ANNUAL',BD) = MAX(EPS,PASTSUM(RTP),NCAP_BND(RTP,BD)$BDLOX(BD)); + NCAP_BND(RTP(RT_NO,P),'UP')$(NCAP_BND(RTP,'LO')$NCAP_BND(RTP,'UP')) = SMAX(BDNEQ,NCAP_BND(RTP,BDNEQ)); +$ IF %STAGES%==YES $SETLOCAL SWT '$SW_T(T%SOW%)' + %VAR%_NCAP.LO(RTP(RT_NO(R,T),P)%SOW%)%SWT% $= NCAP_BND(RTP,'LO'); + %VAR%_NCAP.UP(RTP(RT_NO(R,T),P)%SOW%)%SWT% $= NCAP_BND(RTP,'UP'); + %VAR%_NCAP.FX(RTP(RT_NO(R,T),P)%SOW%)%SWT% $= NCAP_BND(RTP,'FX'); + VAR_NCAP.L(RTP(RT_NO,P)) $= PASTSUM(RTP); + OPTION CLEAR=PASTSUM,CLEAR=RTCS,CLEAR=FIL,CLEAR=RTPS_BD,CLEAR=RT_NO; \ No newline at end of file diff --git a/stages.stc b/stages.stc new file mode 100644 index 0000000..a4cccb6 --- /dev/null +++ b/stages.stc @@ -0,0 +1,272 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* STAGES.stc - Preprocessing for multi-stage stochastics +* %1 - mod or v# for the source code to be used +*=============================================================================* +$IF %MACRO%==YES $ABORT Stochastic MACRO Not Implemented - aborted. +$IF %1==MCA $GOTO POST +* +$SETGLOBAL SW_TAGS SET EQ 'ES' SET VAR 'VAS' SET SWD ',WW' SET SWTD ',T,WW' SET SWS ',W)' SET SOW ',SOW' SET SWT ',SW_T(T,SOW)' SET VART 'SUM(SW_TSW(SOW,T,W),VAS' SET VARV 'SUM(SW_TSW(SOW,V,W),VAS' SET VARM 'SUM(SW_TSW(SOW,MODLYEAR,W),VAS' +$IF %STAGES%==YES $SETGLOBAL SW_STVARS SET VARTT 'SUM(SW_TSW(SOW,TT,W),VAS' SET SWSW SW_TSW(SOW,T,WW), +$SETGLOBAL SWD ',WW' SETGLOBAL WITSPINE +$IF %STAGES%==YES $SETGLOBAL SWX ',SOW' SETGLOBAL SWTX SW_T(T,SOW)$ +$IF %SENSIS%==YES $SETGLOBAL SWD +SET AUXSOW(ALLSOW) / 1 /; +*----------------------------------------------------------------------------- +* Use slack variables in user-constraints +$SETGLOBAL VAR_UC YES +$IF NOT %VAR_UC%==YES $ABORT Invalid VAR_UC setting in stochastic mode - abort. + OPTION SUC_L 1) = 0; + IF(SW_SUBS('1','1') EQ 0, + IF(CARD(SW_SUBS)+CARD(SW_SPROB) EQ 0, SW_SUBS('1','1') = MAX(1,SMAX(WW$SW_PROB(WW),ORD(WW))); + ELSE SW_SUBS('1','1') = MAX(1,SMAX(WW$(SW_SPROB('2',WW)+SW_SUBS('2',WW)),ORD(WW))))); + +* Copy number of childs from first parent to others when missing + LAST_VAL = SMAX((J,WW)$SW_SUBS(J,WW),ORD(J)); + LOOP(JJ(J-1)$(ORD(J) LE LAST_VAL), + F = MAX(1,SW_SUBS(J,'1')); Z = SUM(WW$SW_SUBS(JJ,WW),SW_SUBS(JJ,WW)); + LOOP(WW$(ORD(WW) LE Z), + IF(NOT SW_SUBS(J,WW), SW_COPY(J,WW)$(ORD(WW) > 1) = YES; SW_SUBS(J,WW) = F;))); + +* Construch SW_CHILD + LOOP((J,ALLSOW)$SW_SUBS(J,ALLSOW), + IF(ORD(ALLSOW) EQ 1, F = 0); + Z = SW_SUBS(J,ALLSOW)+F; + SW_CHILD(J,ALLSOW,WW)$((ORD(WW) LE Z)*(ORD(WW) > F)) = YES; + F = Z;); + +* Construct sow: + LOOP(SW_CHILD(J,ALLSOW,WW), SOW(WW) = YES); + +*----------------------------------------------------------------------------- + SW_PHASE = 0; +* Make sure OBJZ will not be generated + UC_TS_SUM(R,'OBJZ',S) = NO; + UC_TS_EACH(R,'OBJZ',S) = NO; + IF(SUM((UC_N,SOW)$S_UCOBJ(UC_N,SOW),1), + SW_START('1') = 9999; + SW_LAMBDA = 0; + SW_PHASE = -9; +* Make sure OBJ1 will not be generated + UC_TS_SUM(R,'OBJ1',S) = NO; + UC_TS_EACH(R,'OBJ1',S) = NO; + UC_T_SUM(R,'OBJ1',T) = NO; +* Complete checking for uncertain parameters + CNT = SW_PARM; + CNT$(NOT CNT) = SUM((UC_N,BD,J,W)$S_UC_RHS(UC_N,BD,J,W),1); + CNT$(NOT CNT) = SUM((R,UC_N,BD,J,W)$S_UC_RHSR(R,UC_N,BD,J,W),1); + CNT$(NOT CNT) = SUM((UC_N,T,BD,J,W)$S_UC_RHST(UC_N,T,BD,J,W),1); + CNT$(NOT CNT) = SUM((R,UC_N,T,BD,J,W)$S_UC_RHSRT(R,UC_N,T,BD,J,W),1); + CNT$(NOT CNT) = SUM((UC_N,T,S,BD,J,W)$S_UC_RHSTS(UC_N,T,S,BD,J,W),1); + CNT$(NOT CNT) = SUM((R,UC_N,T,S,BD,J,W)$S_UC_RHSRTS(R,UC_N,T,S,BD,J,W),1); +* Reset UCOBJ(OBJ1) flags to either 1 or 2: + FIRST_VAL = S_UCOBJ('OBJ1','1'); + S_UCOBJ('OBJ1',SOW) = 1+1$(S_UCOBJ('OBJ1',SOW) GE 0); +* Copy UCOBJ from previous if missing and uncertain parameters defined + LOOP((SOW(WW),W(WW-1)), + IF(SUM(UC_N$S_UCOBJ(UC_N,SOW),1) EQ 1, + S_UCOBJ(UC_N,SOW) $= S_UCOBJ(UC_N,W); + S_UCOBJ('OBJ1',SOW) = 4+2$CNT;)); +* Check setups with single terminal SOW: + IF(FIRST_VAL, +$IF %STAGES%==YES IF((FIRST_VAL EQ 0)$(NOT SW_PARM), SW_PARM = 1; +$IF %STAGES%==YES ELSE S_UCOBJ('OBJ1',SOW)=S_UCOBJ('OBJ1',SOW)-ABS(S_UCOBJ('OBJ1',SOW)-4); SW_PARM = -1); + ELSE SW_PARM = 0); S_UCOBJ('OBJ1',SOW(WW))$(ORD(WW) EQ CARD(SOW)) = MAX(0,S_UCOBJ('OBJ1',WW)); +* Check MinMax Regret option + ELSEIF SUM((J,SOW)$S_UC_RHS('OBJ1','FX',J,SOW),1), UC_T_SUM(R,'OBJ1',T) = NO; SW_LAMBDA = -1 + ); +$IF NOT %STAGES%==YES SW_START('1') = 9999; SW_LAMBDA = 0; SW_PARM = 0; +*----------------------------------------------------------------------------- +* Contruct spanning tree + FOR(Z = LAST_VAL-1 DOWNTO 0, + LOOP((SAMEAS(J-Z,'1'),JJ(J+1)), + IF(Z=LAST_VAL-1,SW_TREE(J,ALLSOW,SOW)$SW_CHILD(J,ALLSOW,SOW) = YES; + ELSE LOOP(SW_CHILD(J,ALLSOW,WW),SW_TREE(J,ALLSOW,SOW)$SW_TREE(JJ,WW,SOW) = YES;)); + )); + +* Adjust SW_START to period years + MY_FYEAR = SW_START('1'); Z = 0; SW_START('1') = 0; + SW_START(J)$(ORD(J) > LAST_VAL+1) = 0; + LOOP(MIYR_1(TT), F = -1; + LOOP(J$(ORD(J) LE LAST_VAL+1), + MY_F = SW_START(J); + IF(NOT MY_F, F = F+1; Z = MAX(Z+1,YEARVAL(TT+F)); SW_START(J) = Z; + ELSEIF MY_F > Z, Z = MY_F; F = MAX(1,F,SUM(T$(YEARVAL(T) < MY_F),1)); + SW_START(J) = MAX(YEARVAL(TT+(F-1))+1,Z); + ELSE SW_START(J) = SW_START(J-1)); + )); + +* Construct mapping of valid data stages for each T + LOOP(J$SW_START(J), SW_TSTG(T,J)$(SW_START(J) LE YEARVAL(T)) = YES); +* Reset SW_START if first year is large + IF(MY_FYEAR GE SW_START('2'), SW_START(J)$((SW_START(J) LE MY_FYEAR)$SW_START(J)) = MIYR_V1); + +* Construct SW_STAGE for internal SOWs + SW_DESC(J,WW) = SUM(SW_TREE(J,WW,SOW),1); + LOOP(SAMEAS(WW,'1'), F = 0; + LOOP((J,SOW)$SW_SUBS(J,SOW), + IF(ORD(J) NE F, Z = 0; F = ORD(J)); + SW_STAGE(J,WW+Z) = YES; + Z = Z + SW_DESC(J,SOW); + )); + +* Copy probabilities when missing + LOOP((JJ(J-1),ALLSOW)$SW_SUBS(JJ,ALLSOW), Z=0; MY_F=0; + IF(ORD(ALLSOW) EQ 1, F=0; ELSE F=F+CNT); CNT=SW_SUBS(JJ,ALLSOW); + LOOP(SW_CHILD(JJ,ALLSOW,WW)$SW_SPROB(J,WW), Z=Z+SW_SPROB(J,WW); MY_F=MY_F+1); + IF(SW_COPY(JJ,ALLSOW)$(NOT MY_F), SW_SPROB(J,WW)$SW_CHILD(JJ,ALLSOW,WW) = SW_SPROB(J,WW-F); + ELSE SW_SPROB(J,WW)$((NOT SW_SPROB(J,WW))*SW_CHILD(JJ,ALLSOW,WW)) = MAX(0,1-Z)/(CNT-MY_F)); + ); +* Set map for copying attributes + LOOP(SW_COPY(JJ(J-1),W), F=0; LOOP(SW_CHILD(JJ,W,WW), IF(F=0,F=ORD(WW)-1); SW_CPMAP(J,WW,WW-F)=YES)); + +* Normalize probabilities under each parent + SW_SPROB('1','1') = 1; + LOOP((J,WW)$SW_SUBS(J,WW), + Z = SUM(SOW$SW_CHILD(J,WW,SOW),SW_SPROB(J+1,SOW)); + IF(Z NE 1,SW_SPROB(J+1,SOW)$SW_CHILD(J,WW,SOW) = SW_SPROB(J+1,SOW)/Z;); + ); + +* Add final stage to SW_TREE + LOOP(SAMEAS(J-LAST_VAL,'1'), SW_TREE(J,SOW,SOW) = YES); + OPTION SW_REV < SW_TREE; +* Calculate final stage probabilities + SW_PROB(SOW)$(NOT SW_PROB(SOW)) = PROD(SW_TREE(JJ,ALLSOW,SOW),SW_SPROB(JJ,ALLSOW)); +$IF SETLOCAL DEBUG DISPLAY SW_PROB,SW_SPROB; +*----------------------------------------------------------------------------- +* Normalize probability distribution + SW_PROB(ALLSOW)$(SW_PROB(ALLSOW) LE 0) = 0; + Z = SUM(ALLSOW,SW_PROB(ALLSOW)); + IF(Z EQ 0, Z = 1; SW_PROB('1') = Z); + SW_PROB(SOW) = SW_PROB(SOW)/Z; + +* Set all SOWs into the last stage and Cumulate SOW from each stage to next: + LOOP(SAMEAS(J,'1'), SW_STAGE(J+LAST_VAL,SOW) = YES;); + LOOP(J$(ORD(J) LE LAST_VAL), SW_STAGE(J+1,SOW)$SW_STAGE(J,SOW) = YES;); + +* Convert stages to periods + LOOP(SW_STAGE(J,SOW), SW_T(T,SOW)$(SW_START(J) LE YEARVAL(T)) = YES); + +* Map SOWs to unique SOW at each period: + LOOP(T, F = 0; + LOOP(SW_T(T,WW), Z = ORD(WW); + SW_TSW(SOW(ALLSOW),T,WW+(F-Z))$((ORD(ALLSOW) GE F)*(ORD(ALLSOW) < Z)) = YES; + F = Z;); + SW_TSW(SOW(ALLSOW),T,WW)$((ORD(WW) EQ F)*(ORD(ALLSOW) GE F)) = YES; + ); + +* Calculate aggregate probablilities; remove from maps all SOWs with zero PROB + SW_TPROB(T,W) = SUM(SW_TSW(SOW,T,W),SW_PROB(SOW)); + SW_T(T,ALLSOW)$(SW_TPROB(T,ALLSOW) EQ 0) = NO; + SW_TSW(SOW,T,WW)$(NOT SW_T(T,WW)) = NO; + +* Construct mapping between internal (T,SOW) and original (J,SOW) + SW_MAP(SW_T(T,WW),J,SOW)$(SW_TSTG(T,J)*SW_TREE(J,SOW,WW)) = YES; + +$IF SETLOCAL DEBUG DISPLAY SW_START,SW_SUBS,SW_CHILD,SW_TREE,SW_MAP,SW_STAGE,SW_T,SW_TSW,SW_TPROB,SW_TSTG; + +*----------------------------------------------------------------------------- +* Construct SW_UCT (needed to control dynamic stochastic UC-constraints) + LOOP(R, SW_UCT(UC_N,SW_T(T,SOW))$(UC_T_SUCC(R,UC_N,T)$UC_DYNDIR(R,UC_N,'RHS')) = YES; + LOOP(SW_T(T+1,SOW),SW_UCT(UC_N,T,SOW)$(UC_T_SUCC(R,UC_N,T)*(NOT UC_DYNDIR(R,UC_N,'RHS'))) = YES;)); +*----------------------------------------------------------------------------- +* Pre-Process cumulative bounds + S_FLO_CUM(R,P,C,BOHYEAR+BEOH(BOHYEAR),EOHYEAR+BEOH(EOHYEAR),BD,J,SOW) $= S_FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,BD,J,SOW); + S_FLO_CUM(R,P,C,BOHYEAR,EOHYEAR,BD,J,SOW)$(NOT LL(BOHYEAR)*LL(EOHYEAR)) = 0; + RPC_CUMFLO(RP(R,P),C,ALLYEAR,LL) $= SUM((BD,J,SOW)$S_FLO_CUM(R,P,C,ALLYEAR,LL,BD,J,SOW),YES); +*----------------------------------------------------------------------------- +* Construct SUPERYR (needed in cumulative constraints) + SUPERYR(PERIODYR(T,LL)) = YES; + LOOP(MIYR_1(T),SUPERYR(T--1,LL)$(YEARVAL(LL) > MIYR_VL) = YES); +*----------------------------------------------------------------------------- +$ BATINCLUDE fillsow.stc COM_PROJ 'R,' C T NO +$ BATINCLUDE fillsow.stc COM_TAX 'R,' 'C,S,COM_VAR,CUR' T YES 'SW_T(T,WW)' NO +$ BATINCLUDE fillsow.stc NCAP_COST 'R,' P T NO +$ IF DEFINED S_FLO_FUNC $BATINCLUDE fillsow.stc FLO_FUNC 'R,' 'P,CG,CG2' T NO +$ IF DEFINED S_NCAP_AFS $BATINCLUDE fillsow.stc NCAP_AFS 'R,' 'P,S' T NO +$ IF DEFINED S_COM_FR $BATINCLUDE fillsow.stc COM_FR 'R,' 'C,S' T NO +$ BATINCLUDE fillsow.stc CAP_BND 'R,' 'P,BD' T YES 'SW_T(T,WW)' NO +$ BATINCLUDE fillsow.stc COM_CUM 'R,COM_VAR,ALLYEAR,' 'C,BD' LL YES 'SUPERYR(T,LL)' YES +$ BATINCLUDE fillsow.stc FLO_CUM 'R,P,C,ALLYEAR,' 'BD' LL YES 'SUPERYR(T,LL)' YES +$ BATINCLUDE fillsow.stc UC_RHST 'UC_N,' 'LIM' T YES 'SW_T(T,WW)' NO +$ BATINCLUDE fillsow.stc UC_RHSRT 'R,UC_N,' 'LIM' T YES 'SW_T(T,WW)' NO +$ BATINCLUDE fillsow.stc UC_RHSTS 'UC_N,' 'TS,LIM' T YES 'SW_T(T,WW)' NO +$ BATINCLUDE fillsow.stc UC_RHSRTS 'R,UC_N,' 'TS,LIM' T YES 'SW_T(T,WW)' NO +$IF DEFINED S_DAM_COST $BATINCLUDE fillsow.stc DAM_COST 'R,' 'COM,CUR' T YES 'SW_T(T,WW)' YES +* Handle uncertain attributes without year index +$ BATINCLUDE fillsow.stc UC_RHS 'UC_N,LIM' '' '' YES YES YES +$ BATINCLUDE fillsow.stc UC_RHSR 'R,UC_N,LIM' '' '' YES YES YES + OPTION CLEAR=SUPERYR; +$ IF %MCA%==YES $EXIT +$ LABEL POST +* Levelize & merge +$ BATINCLUDE pp_lvlfc.mod S_COM_TAX C COM_TS ',COM_VAR,CUR,J,WW' "" ALL_TS T RC(R,C)$(ORD(J)=1) + S_COM_TAX(RTC(R,T,C),S,COM_VAR,CUR,'1',W)$(NOT SW_T(T,W)) $= SUM(SW_TSW(W,T,WW),S_COM_TAX(RTC,S,COM_VAR,CUR,'1',WW)); +*----------------------------------------------------------------------------- +* Pre-Process FLO_FUNC transformation +$IF NOT DEFINED S_FLO_FUNC $GOTO DIDFUNC + PARAMETER RTP_FFCS(R,ALLYEAR,P,CG,CG%SWD%); OPTION CLEAR=RTP_FFCS; + RP_FFSGG(R,P,ACTCG(CG),CG) = NO; + RP_FFSGGM(RP_PG(RP,CG1),CG,ACTCG,CG)$RP_FFSGG(RP,ACTCG,CG) = YES; + RP_FFSGGM(RP_FFSGG(RP,CG,CG2),CG,CG2)$(NOT ACTCG(CG)) = YES; + OPTION RP_FFSGG <= RP_FFSGGM, TRACKP < RP_FFSGG; +$IF %SENSIS%==YES $GOTO DIDFUNC + OPTION CLEAR=UNCD7; UNCD7(R,TT,T--ORD(T),P,SOW,'','')$TRACKP(R,P) $= RTP_VINTYR(R,TT,T,P)$SW_T(T,SOW); + LOOP(UNCD7(R,T,TT,P,SOW,'',''),RTPW(R,T,P,SOW)=YES); + RTP_FFCS(R,T,P,CG,COM_GRP,SOW)$(RTPW(R,T,P,SOW)*RP_FFSGG(R,P,CG,COM_GRP)) = + SUM((RP_FFSGGM(R,P,CG,COM_GRP,CG1,CG2),SW_TSW(SOW,T,W)), + PROD(SW_MAP(T,W,J,WW)$S_FLO_FUNC(R,T,P,CG1,CG2,J,WW),S_FLO_FUNC(R,T,P,CG1,CG2,J,WW))-1); +* Remap reduced FUNC flows + LOOP(RPCG_PTRAN(RP,C,COM,CG,CG2)$RP_FFSGG(RP,CG,CG2),IF(RPC_FFUNC(RP,C),RP_DCGG(RP,C,CG,CG2,'UP')=YES; ELSE RP_DCGG(RP,COM,CG,CG2,'LO')=YES)); + RP_DCGG(RPC_FFUNC(RP,COM),CG,C,'UP')$(RPG_1ACE(RP,CG,COM)$RPC_ACT(RP,C)) $= RP_FFSGG(RP,CG,C); + RTP_FFCS(RTP(R,T,P),ACTCG,C,W)$RPC_FFUNC(R,P,C) $= SUM(RP_DCGG(R,P,C,CG,CG2,L),(POWER(RTP_FFCS(RTP,CG,CG2,W)+1,BDSIG(L))-1)$(RTP_FFCS(RTP,CG,CG2,W)+1)); + LOOP(RP_DCGG(R,P,C,CG,CG2,L),RTP_FFCS(R,T,P,CG,CG2,W) = 0); + OPTION CLEAR=S_FLO_FUNC,CLEAR=RTPW,CLEAR=RP_DCGG,CLEAR=RP_FFSGG,CLEAR=RP_FFSGGM; +$LABEL DIDFUNC +* Pre-process uncertain NCAP_COST + OPTION RVP < S_NCAP_COST; + OBJ_SIC(RVP(R,T,P),SOW)$SW_T(T,SOW) = PROD(SW_MAP(T,SOW,J,WW)$S_NCAP_COST(R,T,P,J,WW),S_NCAP_COST(R,T,P,J,WW))-1; + OPTION CLEAR=RVP,CLEAR=TRACKP,CLEAR=S_NCAP_COST; +* Process uncertain NCAP_AFS +$IF NOT DEFINED S_NCAP_AFS $GOTO DIDAFS + LOOP(J, RTP_SAFS(R,T,P,S,W) $= SUM(SW_MAP(T,W,J,WW),S_NCAP_AFS(R,T,P,S,J,WW))); + OPTION CLEAR=S_NCAP_AFS; + LOOP(BDUPX(BD), + S_NCAP_AFS(R,T,P,S,'1',W)$((NCAP_AF(R,T,P,S,BD) > 0)$RTP_SAFS(R,T,P,S,W)) = RTP_SAFS(R,T,P,S,W)/NCAP_AF(R,T,P,S,BD); + S_NCAP_AFS(R,T,P,S,'1',W)$((NCAP_AFS(R,T,P,S,BD) > 0)$RTP_SAFS(R,T,P,S,W)) = RTP_SAFS(R,T,P,S,W)/NCAP_AFS(R,T,P,S,BD); + S_NCAP_AFS(R,T,P,ANNUAL(S),'1',W)$((NCAP_AFA(R,T,P,BD) > 0)$RTP_SAFS(R,T,P,S,W)) = RTP_SAFS(R,T,P,S,W)/NCAP_AFA(R,T,P,BD)); + OPTION CLEAR=RTP_SAFS; + RTP_SAFS(R,T,P,S,W)$S_NCAP_AFS(R,T,P,S,'1',W) = ROUND(S_NCAP_AFS(R,T,P,S,'1',W)-1,8); + OPTION CLEAR=S_NCAP_AFS; +$LABEL DIDAFS +* Process uncertain COM_FR +$IF NOT DEFINED S_COM_FR $GOTO DIDCOMFR + T0(T)=YES; T0('0')=YES; SW_T2W(SW_TSW(SOW,T,WW),T)=YES; SW_T2W(SW_TSW(SOW,T,WW),'0')$SW_TSTG(T,'2')=YES; + LOOP(J, RTCS_SFR(R,T,C,S,W,S) $= SUM(SW_MAP(T,W,J,WW),S_COM_FR(R,T,C,S,J,WW))); + RTCS_SFR(R,T,C,S,W,S)$RTCS_SFR(R,T,C,S,W,S) = RTCS_SFR(R,T,C,S,W,S)-1; + OPTION CLEAR=S_COM_FR; +* Fill down the multipliers + RTCSW(R,T,C,S+STOA(S),W)$RTCS_SFR(R,T,C,S,W,S) = YES; + RTCSW(R,T,C,S,W)$((COM_FR(R,T,C,S) > 0)$RTCSW(R,T,C,'ANNUAL',W)) = YES; + RTCS_SFR(RTCSW(R,T,C,S,W),S)$((NOT RTCS_SFR(RTCSW,S))$TS_GROUP(R,'WEEKLY',S)) = SUM(RS_BELOW1(R,TS,S),RTCS_SFR(R,T,C,TS,W,TS)); + RTCS_SFR(RTCSW(R,T,C,S,W),S)$((NOT RTCS_SFR(RTCSW,S))$TS_GROUP(R,'DAYNITE',S)) = SUM(RS_BELOW1(R,TS,S),RTCS_SFR(R,T,C,TS,W,TS)); +* Sum up COM_FR for all commodities that have it defined + FOR(Z=3 DOWNTO 1,LOOP(TSLVL$(ORD(TSLVL)=Z), + RTCS_SFR(RTCSW(R,T,C,S,W),S)$TS_GROUP(R,TSLVL,S) = + SUM(RS_BELOW1(R,S,TS),(1+RTCS_SFR(R,T,C,TS,W,TS))*COM_FR(R,T,C,TS))/COM_FR(R,T,C,S)-1; + )); + S_COM_FR(R,T,C,S,'1',W)$RTCSW(R,T,C,S,W) = (1+RTCS_SFR(R,T,C,S,W,S))/(1+RTCS_SFR(R,T,C,'ANNUAL',W,'ANNUAL'))-1; + OPTION CLEAR=RTCS_SFR; + RTCS_SFR(RTCSW(R,T,C,S,W),TS)$RS_BELOW(R,TS,S) = (1+RTCS_FRMX(R,T,C,S,TS))*(((1+S_COM_FR(R,T,C,S,'1',W))/MAX(1E-9,1+S_COM_FR(R,T,C,TS,'1',W)))-1); + RTCS_SFR(RTCSW(R,T,C,S,W),TS)$(ABS(RTCS_SFR(R,T,C,S,W,TS)) < 1E-9) = 0; + RTCS_SFR(R,LL--ORD(LL),C,S,W,TS)$SW_TSTG(LL,'2') $= RTCS_SFR(R,LL,C,S,W,TS); + RTCS_SFR(R,T,C,S,W,TS)$(SW_TSTG(T,'2')$RTCS_SFR(R,'0',C,S,W,TS)) = RTCS_SFR(R,T,C,S,W,TS)-RTCS_SFR(R,'0',C,S,W,TS); + OPTION RCS_SSFR <= RTCS_SFR; OPTION CLEAR=RTCSW,CLEAR=RTCS_SFR; +$LABEL DIDCOMFR diff --git a/times2veda.vdd b/times2veda.vdd new file mode 100644 index 0000000..638af4e --- /dev/null +++ b/times2veda.vdd @@ -0,0 +1,157 @@ +* +* TIMES GDX2VEDA Set Directives +* + +[DataBaseName] + TIMES + +[Dimensions] + Attribute attr + Commodity c + Process p + Period t + Region r + Vintage v + TimeSlice s + UserConstraint uc_n + +[ParentDimension] + Region Commodity Process UserConstraint + +[Options] +SetsAllowed Commodity Process UserConstraint +*Scenario SCENCASE +*ValueDim 2 +not-0 var_fin var_fout var_act var_actm var_cap var_capm cost_flo cost_act eq_cumflo eq_combal eq_combalm + +[DataEntries] +* VEDA Attr GAMS - indexes - +*** Variables & Parameters + VAR_Act par_actl r v t p s + VAR_ActM par_actm r v t p s + VAR_Cap par_capl r t p + VAR_Cap par_pasti r t p v + VAR_CapM par_capm r t p + VAR_Ncap par_ncapl r t p + VAR_NcapM par_ncapm r t p + VAR_NcapR par_ncapr r t p uc_n + VAR_FIn f_in r v t p c s + VAR_FOut f_out r v t p c s + VAR_FOut agg_out r t c s + VAR_POut p_out r t p c s + VAR_POut par_rtcs r t c s + VAR_Comprd par_comprdl r t c s + VAR_ComprdM par_comprdm r t c s + VAR_Comnet par_comnetl r t c s + VAR_ComnetM par_comnetm r t c s + VAR_Eout par_eout r v t p c + VAR_CumCst par_cumcst r v t uc_n c +*** Equations + EQ_Combal eqg_combal.l r t c s + EQ_CombalM par_combalem r t c s + EQ_Combal eqe_combal.l r t c s + EQ_CombalM par_combalgm r t c s + EQ_Peak eq_peak.l r t c s + EQ_PeakM par_peakm r t c s + EQ_IreM par_ipric r t p c s uc_n + EQ_Cumflo par_cumflol r p c v t + EQ_CumfloM par_cumflom r p c v t +*** Parameters + PAR_Top par_top r t p c uc_n + PAR_CapLO par_caplo r t p + PAR_CapUP par_capup r t p + Cap_New Cap_New r v p t uc_n +*** Costs + Cost_Inv cst_invc r v t p uc_n + Cost_Invx cst_invx r v t p uc_n + Cost_Salv cst_salv r v p + Cost_Dec cst_decc r v t p + Cost_Fom cst_fixc r v t p + Cost_Fixx cst_fixx r v t p + Cost_Act cst_actc r v t p uc_n + Cost_Flo cst_floc r v t p c + Cost_Flox cst_flox r v t p c + Cost_Com cst_comc r t c + Cost_Comx cst_comx r t c + Cost_Els cst_come r t c + Cost_Dam cst_dam r t c + Cost_ire cst_irec r v t p c + Cost_NPV cst_pvp uc_n r p + Cost_NPV cst_pvc uc_n r c + Time_NPV cst_time r t s uc_n + Val_Flo val_flo r v t p c + ObjZ ObjZ.l + Reg_wobj reg_wobj r uc_n c + Reg_obj reg_obj r + Reg_irec reg_irec r + Reg_ACost reg_acost r t uc_n + User_con par_ucsl uc_n r t s + User_conFXM par_ucsm uc_n r t s + User_conFXM par_ucmrk r t uc_n c s + User_DynbM par_ucrtp uc_n r t p c + User_MaxBet par_ucmax uc_n r p c +*** Climate and MACRO + VAR_Climate CM_RESULT c t + Dual_clic CM_MAXC_M c t + VAR_Macro TM_RESULT c r t + +[DimensionTextAll] +* Gams_set_name Veda_Tab +adesc attr +uc_n uc_n +sysuc uc_n +costagg uc_n +pluset uc_n +in_out uc_n +impexp uc_n +uc_grptype c +othcom c +all_ts s +nonset s +modlyear v +pastcv v +milestonyr t +nonset t + +[ParentDimensionTextAll] +* Gams_set_name Veda_Tab +prc_desc r p +com_desc r c +reg_act r c + +[ParentSubSets] +* subset GAMS VEDA Tab +* processes + DMD DMD r p + PRE PRE r p + PRW PRW r p + PRV PRV r p + REF REF r p + ELE ELE r p + CHP CHP r p + HPL HPL r p + STG RP_STG r p + DISTR DISTR r p + IRE RP_IRE r p + XTRACT XTRACT r p + RENEW RENEW r p +* commodities + NRG NRG r c + DEM DEM r c + ENV ENV r c + MAT MAT r c + RES RES r c + COMM COMM r c + TRN TRN r c + AGR AGR r c + IND IND r c + OTH OTHD r c + ELC+ NRGELC r c + HET+ NRGHET r c + FOS+ NRGFOS r c + REN+ NRGREN r c + SYN+ NRGSYN r c + UC_Const uc_r_each r uc_n + UC_Const uc_const r uc_n + UC_DynBD uc_dynbd r uc_n + UC_MarkS uc_marks r uc_n diff --git a/times2veda_stc.vdd b/times2veda_stc.vdd new file mode 100644 index 0000000..2cef803 --- /dev/null +++ b/times2veda_stc.vdd @@ -0,0 +1,148 @@ +* +* TIMES GDX2VEDA Set Directives +* + +[DataBaseName] + TIMES + +[Dimensions] + Attribute attr + Sow w + Commodity c + Process p + Period t + Region r + Vintage v + TimeSlice s + UserConstraint uc_n + +[ParentDimension] + Region Commodity Process UserConstraint + +[Options] +SetsAllowed Commodity Process UserConstraint +*Scenario SCENCASE +not-0 var_fin var_fout var_act var_actm var_cap var_capm cost_flo cost_act eq_combal eq_combalm + +[DataEntries] +* VEDA Attr GAMS - indexes - +*** Variables & Parameters + VAR_Act spar_actl w r v t p s + VAR_ActM spar_actm w r v t p s + VAR_Cap spar_capl w r t p + VAR_Cap spar_pasti w r t p v + VAR_CapM spar_capm w r t p + VAR_Ncap spar_ncapl w r t p + VAR_NcapM spar_ncapm w r t p + VAR_NcapR spar_ncapr w r t p uc_n + VAR_FIn sf_in w r v t p c s + VAR_FOut sf_out w r v t p c s + VAR_FOut sagg_out w r t c s + VAR_POut sp_out w r t p c s + VAR_Comprd spar_comprdl w r t c s + VAR_ComprdM spar_comprdm w r t c s + VAR_Comnet spar_comnetl w r t c s + VAR_ComnetM spar_comnetm w r t c s + VAR_Eout spar_eout w r v t p c + VAR_CumCst spar_cumcst w r v t uc_n c +*** Equations + EQ_Combal spar_combalgm w r t c s + EQ_CombalM spar_combalem w r t c s + EQ_PeakM spar_peakm w r t c s + EQ_IreM spar_ipric w r t p c s uc_n + EQ_Cumflo spar_cumflol w r p c v t + EQ_CumfloM spar_cumflom w r p c v t +*** Parameters + PAR_Top par_top r t p c uc_n + PAR_CapLO spar_caplo w r t p + PAR_CapUP spar_capup w r t p + Cap_New SCap_New w r v p t uc_n +*** Costs + Cost_Inv scst_invc w r v t p uc_n + Cost_Invx scst_invx w r v t p uc_n + Cost_Dec scst_decc w r v t p + Cost_Fom scst_fixc w r v t p + Cost_Fixx scst_fixx w r v t p + Cost_Act scst_actc w r v t p uc_n + Cost_Flo scst_floc w r v t p c + Cost_Flox scst_flox w r v t p c + Cost_Com scst_comc w r t c + Cost_Comx scst_comx w r t c + Cost_Els scst_come w r t c + Cost_Dam scst_dam w r t c + Cost_ire scst_irec w r v t p c + Time_NPV scst_time w r t s uc_n + ObjZ ObjZ.l + Reg_wobj reg_wobj r uc_n c + Reg_obj sreg_wobj w r uc_n c + Reg_irec sreg_irec w r + Reg_ACost sreg_acost w r t uc_n + User_con spar_ucsl w uc_n r t s + User_conFXM spar_ucsm w uc_n r t s + User_DynbM spar_ucrtp w uc_n r t p c + User_MaxBet spar_ucmax w uc_n r p c +*** Climate module + VAR_Climate CM_SRESULT w c t + Dual_clic CM_SMAXC_M w c t + +[DimensionTextAll] +* Gams_set_name Veda_Tab +adesc attr +sow w +uc_n uc_n +sysuc uc_n +costagg uc_n +pluset uc_n +in_out uc_n +impexp uc_n +uc_grptype c +othcom c +all_ts s +nonset s +modlyear v +pastcv v +milestonyr t +nonset t + +[ParentDimensionTextAll] +* Gams_set_name Veda_Tab +prc_desc r p +com_desc r c +reg_act r c + +[ParentSubSets] +* subset GAMS VEDA Tab +* processes + DMD DMD r p + PRE PRE r p + PRW PRW r p + PRV PRV r p + REF REF r p + ELE ELE r p + CHP CHP r p + HPL HPL r p + STG RP_STG r p + DISTR DISTR r p + IRE RP_IRE r p + XTRACT XTRACT r p + RENEW RENEW r p +* commodities + NRG NRG r c + DEM DEM r c + ENV ENV r c + MAT MAT r c + RES RES r c + COMM COMM r c + TRN TRN r c + AGR AGR r c + IND IND r c + OTH OTHD r c + ELC+ NRGELC r c + HET+ NRGHET r c + FOS+ NRGFOS r c + REN+ NRGREN r c + SYN+ NRGSYN r c + UC_Const uc_r_each r uc_n + UC_Const uc_const r uc_n + UC_DynBD uc_dynbd r uc_n + UC_MarkS uc_marks r uc_n diff --git a/times2veda_v3.vdd b/times2veda_v3.vdd new file mode 100644 index 0000000..c1ec0bc --- /dev/null +++ b/times2veda_v3.vdd @@ -0,0 +1,109 @@ +* +* TIMES GDX2VEDA Set Directives +* + +[DataBaseName] + TIMES + +[Dimensions] + Attribute attr + Commodity c + Process p + Period t + Region r + Vintage v + TimeSlice s + UserConstraint uc_n + +[ParentDimension] + Region Commodity Process + +[Options] +SetsAllowed Commodity Process +*Scenario SCENCASE +*ValueDim 2 +not-0 var_fin var_fout var_act var_actm cost_flo cost_act + +[DataEntries] +* VEDA Attr GAMS - indexes - +*** Variables & Parameters + VAR_Act par_actl r v t p s + VAR_ActM par_actm r v t p s + VAR_Cap par_capl r t p + VAR_CapM par_capm r t p + VAR_Ncap par_ncapl r t p + VAR_NcapM par_ncapm r t p + VAR_FIn f_in r v t p c s + VAR_FOut f_out r v t p c s + VAR_Comprd par_comprdl r t c s + VAR_ComprdM par_comprdm r t c s + VAR_Comnet par_comnetl r t c s + VAR_ComnetM par_comnetm r t c s +*** Equations + EQ_Combal eqg_combal.l r t c s + EQ_CombalM par_combalem r t c s + EQ_Combal eqe_combal.l r t c s + EQ_CombalM par_combalgm r t c s + EQ_Peak eq_peak.l r t c s + EQ_PeakM par_peakm r t c s +*** Parameters + PAR_CapLO par_caplo r t p + PAR_CapUP par_capup r t p + PAR_Pasti par_pasti r t p +*** Costs + Cost_Inv cst_invv r v t p + Cost_Dec cst_decv r v t p + Cost_Salv cst_salv r v p + Cost_Late cst_latv r t p + Cost_FOM cst_fixv r v t p + Cost_Act cst_actv r v t p s + Cost_Flo cst_flov r v t p c s + Cost_Com cst_comv r t c s + Cost_Els cst_elsv r t c + Cost_Dam cst_dam r t c + ObjZ ObjZ.l + Reg_wobj reg_wobj r c uc_n + Reg_obj reg_obj r + User_conLOM par_uclom uc_n r t s + User_conUPM par_ucupm uc_n r t s + User_conFXM par_ucfxm uc_n r t s +*** Climate module + VAR_Climate CM_RESULT c t + Dual_clic CM_MAXC_M c t + +[DimensionTextAll] +* Gams_set_name Veda_Tab +adesc attr + + +[ParentDimensionTextAll] +* Gams_set_name Veda_Tab +prc_desc r p +com_desc r c + +[ParentSubSets] +* subset GAMS VEDA Tab +* processes + DMD DMD r p + PRE PRE r p + PRW PRW r p + PRV PRV r p + REF REF r p + ELE ELE r p + CHP CHP r p + HPL HPL r p + STG STG r p + DISTR DISTR r p + IRE RP_IRE r p +* commodities + NRG NRG r c + DEM DEM r c + ENV ENV r c + MAT MAT r c + RES RES r c + COMM COMM r c + TRN TRN r c + AGR AGR r c + NE NE r c + IND IND r c + diff --git a/timesrng.gms b/timesrng.gms new file mode 100644 index 0000000..4f188d7 --- /dev/null +++ b/timesrng.gms @@ -0,0 +1,16 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2023 IEA-ETSAP. Licensed under GPLv3 (see file NOTICE-GPLv3.txt). +*============================================================================* +* Create Ranging GDX at execution time +*============================================================================* +$ONWARNING +$ONMULTI +$OFFLISTING +$PHANTOM EMPTY +ALIAS (*,R,REG,ALLYEAR,P,RNGLIM); +ALIAS (*,C,COM,J,S,T,ALL_REG,IE,CUR,BD,OBV,LL); +ALIAS (*,COM_GRP,CG,ITEM,IO,UC_N,CM_VAR,CM_BOX); +ALIAS (*,PRC,KP,UNIT); +PARAMETER VAR_NCAPRNG(R,ALLYEAR,P,RNGLIM) / EMPTY.EMPTY.EMPTY.EMPTY 0 /; +$IF EXIST timesrng.inc $INCLUDE timesrng.inc +EXECUTE_UNLOAD 'timesrng',VAR_NCAPRNG; diff --git a/timslice.mod b/timslice.mod new file mode 100644 index 0000000..49e9029 --- /dev/null +++ b/timslice.mod @@ -0,0 +1,121 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* Timslice.mod - Auxiliary timeslice preprocessing +*=============================================================================* +* complete timeslice declarations +* - all below ANNUAL +* - each individual to itself, including leaves +* - all TS below a node +*----------------------------------------------------------------------------- + SET RJLVL(J,R,TSLVL), RLUP(R,TSL,TSL); + PARAMETERS RS_HR(R,S) //, MY_SUM /0/, NORTS(R,YEAR,S) //; + SETS RS_UP(R,TS,J,TS), RJ_SL(R,J,TS,TS), JS(J,TS) /1.ANNUAL/; +*----------------------------------------------------------------------------- + TS_GROUP(ALL_R,'ANNUAL',S) = ANNUAL(S); + OPTION STOAL < TS_GROUP; + TS_MAP(R,ANNUAL,S) = STOAL(R,S); + TS_MAP(R,ALL_TS,TS)$SUM(TS_MAP(R,ALL_TS,S),TS_MAP(R,S,TS)) = YES; + TS_MAP(R,S,S) = STOAL(R,S); + STOAL(ALL_R,S)$STOAL(ALL_R,S) = STOAL(ALL_R,S)-1; + IF(CARD(STOAL),ABORT "Error: Timeslice on several levels."); +* Set for timeslices strictly below + RS_BELOW(TS_MAP(R,S,TS))$(NOT TS_MAP(R,TS,S)) = YES; +* Set for timeslices strictly ONE level below + RS_BELOW1(RS_BELOW(R,S,TS))$(SUM(TS_MAP(R,S,ALL_TS)$RS_BELOW(R,ALL_TS,TS),1)=1) = YES; +*----------------------------------------------------------------------------- +* Prepare dynamic timeslice tree +$ SET MX '(MIYR_1)' SETGLOBAL RTS S +$ IFI %OBMAC%%DYNTS%==YESYES +$ IF DEFINED TS_OFF $SET MX '' SETGLOBAL RTS S+NORTS(R,T,S) + SET TS_OFF //; + LOOP(RS_BELOW1(R,ANNUAL,S)$SUM(TS_OFF(R,S,BOHYEAR,EOHYEAR),1), +$ BATINCLUDE pp_off.mod TS_OFF S "" "NORTS(R,T%MX%,S)$(" 1 + IF(PROD(T%MX%,FIL(T)),G_YRFR(R,TS)$TS_MAP(R,S,TS) = 0; + ELSE NORTS(R,T(FIL%MX%),TS)$TS_MAP(R,S,TS) = -INF)); +$ IF %OBMAC%==YES $MACRO RTS(S) %RTS% +$ IF NOT %OBMAC%==YES ALIAS(ALL_TS,RTS); +*----------------------------------------------------------------------------- +* Set the annual year fraction to 1 + G_YRFR(ALL_R,ANNUAL) = 1; +* Complete missing year fractions if non-zero fractions are given for timeslices right below: + G_YRFR(R,S)$((G_YRFR(R,S)<=0)$TS_GROUP(R,'WEEKLY',S)) $= SUM(RS_BELOW1(R,S,TS),G_YRFR(R,TS)); + G_YRFR(R,S)$((G_YRFR(R,S)<=0)$TS_GROUP(R,'SEASON',S)) $= SUM(RS_BELOW1(R,S,TS),G_YRFR(R,TS)); + +*----------------------------------------------------------------------------- +* Remove timeslices that have a zero time fraction + LOOP(TSL,FINEST(R,S)$((G_YRFR(R,S)<=0)$TS_GROUP(R,TSL,S)) = YES); + TS_GROUP(R,TSL,S)$FINEST(R,S) = NO; + TS_MAP(R,TS,S)$FINEST(R,S) = NO; + RS_BELOW(R,TS,S)$FINEST(R,S) = NO; + RS_BELOW1(R,TS,S)$FINEST(R,S) = NO; + NORTS(R,T,S)$FINEST(R,S) = 0; + OPTION CLEAR=FINEST; +* Build a set for all timeslices in the same subtree + RS_TREE(R,S,TS)$(TS_MAP(R,TS,S) OR RS_BELOW(R,S,TS)) = YES; +* Define the set of the finest (highest) timeslices in use: + FINEST(R,S)$(SUM(TS_MAP(R,S,TS),1)=1) = YES; + LOOP(SAMEAS('5',J),RJLVL(J-ORD(TSL),R,TSL)=SUM(TS_GROUP(R,TSL,S),1)); +* Define above-map for TSL levels + LOOP((J,R,TSL)$RJLVL(J,R,TSL),Z=ORD(J);LOOP(RJLVL(JJ,R,TSLVL)$(ORD(JJ)>Z),RLUP(R,TSL,TSLVL)=1;Z=9)); +*----------------------------------------------------------------------------- + +* Target accuracy of fractions: 1 second + Z = 8760*3600; PUTGRP=0; +* Normalize year fractions if they do not sum up + LOOP(TS_GROUP(R,TSL,S)$(NOT FINEST(R,S)), + IF(ANNUAL(S)$CARD(NORTS), F=0; + LOOP(T,MY_F=1-SUM(RS_BELOW1(R,S,TS)$(RS_HR(R,TS)$(NORTS(R,T,TS)=0)),RS_HR(R,TS)); + MY_SUM = SUM(RS_BELOW1(R,S,TS)$((NOT RS_HR(R,TS))$(NORTS(R,T,TS)=0)),G_YRFR(R,TS)); + IF(MY_SUM*MY_F>0,RS_HR(R,TS)$((NORTS(R,T,TS)=0)$(NOT RS_HR(R,TS))$RS_BELOW1(R,S,TS))=MY_F/MY_SUM*G_YRFR(R,TS); + ELSEIF ABS(MY_F)>99/Z,ABORT 'Invalid dynamic Timeslice configuration'); F=MAX(F,ABS(MY_F-MY_SUM))); + G_YRFR(R,TS) $= RS_HR(R,TS); +* Get the year fraction of current timeslice and sum of those below + ELSE MY_F=G_YRFR(R,S); MY_SUM=SUM(RS_BELOW1(R,S,TS),G_YRFR(R,TS)); + F=ABS(MY_F-MY_SUM); IF(F*Z>1,G_YRFR(R,TS)$RS_BELOW1(R,S,TS)=MY_F/MY_SUM*G_YRFR(R,TS))); +* If the sum differs from the lump sum by over a second, do normalize: + IF(F*Z > 1, +$ BATINCLUDE pp_qaput.mod PUTOUT PUTGRP 01 'User-provided G_YRFR values are not valid year fractions' + PUT QLOG ' WARNING - TS fractions normalized, (R.TSL.S)=',TS_GROUP.TE(TS_GROUP); + )); +*----------------------------------------------------------------------------- +* Calculate the number of storage periods for each timeslice + G_CYCLE(TSL('WEEKLY'))$(G_CYCLE(TSL)=0)=8760/(24*7); TS_CYCLE(FINEST)=0; + LOOP(RLUP(R,TSLVL,TSL),TS_CYCLE(R,S)$((TS_CYCLE(R,S)<1)$TS_GROUP(R,TSL,S)) = 365/G_CYCLE(TSLVL)); + LOOP(TSL,RS_STGPRD(R,S)$TS_GROUP(R,TSL,S) = MAX(1,SUM(RS_BELOW1(R,TS,S),G_YRFR(R,TS)*365/TS_CYCLE(R,TS)))); + +* Timeslice level for all timeslices + LOOP(TSL, RS_TSLVL(R,S)$TS_GROUP(R,TSL,S) = TSLVLNUM(TSL)); +* Calculate the lead from previous storage timeslice for each timeslice + LOOP(TS_MAP(R,ANNUAL,S), F=0; + LOOP(RS_BELOW1(R,S,TS), IF(F, RS_STG(R,TS)=ORD(TS)-Z; Z=ORD(TS); ELSE Z=ORD(TS); F=Z)); + RS_STG(R,S+(F-ORD(S)))$F = F-Z;); +* Calculate average residence time for storage activity in each timeslice + LOOP((R,S,TS(S--RS_STG(R,S)))$RS_STGPRD(R,S),RS_STGAV(R,S) = (G_YRFR(R,S)+G_YRFR(R,TS))/2/RS_STGPRD(R,S)); + RS_STGAV(R,ANNUAL) = 1; + + OPTION STOAL2))))) + ) + +$LABEL END diff --git a/uc_cli.mod b/uc_cli.mod new file mode 100644 index 0000000..f180c62 --- /dev/null +++ b/uc_cli.mod @@ -0,0 +1,43 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UC_CLI the UC code associated with climate variables +* - %1 region summation index +* - %2 period summation index +* - %3 time-slice summation index +* - %4 'T' or 'T+1' index +* - %5 'LHS' or 'RHS' +* - %6 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) +*=============================================================================* +*[AL] Questions/Comments: +* - +*----------------------------------------------------------------------------- +$IF NOT DEFINED UC_CLI $EXIT +* "SUM(UC_R_SUM(R,UC_N)," or bracket ( ++ %1 +* "SUM(UC_T_SUM(UC_N,T)," or bracket ( + %2 +* "SUM(UC_TS_SUM(UC_N,S)," or bracket ( + %3 + SUM(CM_VAR$UC_CLI(UC_N,%5,R,%7,CM_VAR), UC_CLI(UC_N,%5,R,%7,CM_VAR) * + (%VAR%_CLITOT(CM_VAR,%4 %SOW%)$CM_KIND(CM_VAR) + + SUM(CM_BOXMAP(CM_KIND,CM_VAR,CM_BOX),%VAR%_CLIBOX(CM_VAR,%4 %SOW%))) * + +* [AL] PROD operator is useful here, but requires 'initialization' due to GAMS bug + PROD(ANNUAL,1) * +$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'CLI','GROWTH'), +$IF %6==1 POWER(ABS(UC_CLI(UC_N,%5,R,%7,CM_VAR)),%8*UC_SIGN(%5)-1)) * + PROD(UC_ATTR(R,UC_N,%5,'CLI','PERIOD'),FPD(%4)) + ) + +* closing bracket of %3 : + ) + +* closing bracket of %2 : + ) + +* closing bracket of %1 : + ) + diff --git a/uc_com.mod b/uc_com.mod new file mode 100644 index 0000000..d8f55ce --- /dev/null +++ b/uc_com.mod @@ -0,0 +1,47 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UC_COMPD the code associated with the COMPRD variable in the EQ_USERCON +* - %1 region summation index +* - %2 period summation index +* - %3 time-slice summation index +* - %4 'T' or 'T+1' index +* - %5 'LHS' or 'RHS' +* - %6 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) +*=============================================================================* +*UR Questions/Comments: +* - +*----------------------------------------------------------------------------- + +*"SUM(UC_R_SUM(R,UC_N)," or bracket ( + %1 +* "SUM(UC_T_SUM(UC_N,T)," or bracket ( + %2 +* "SUM(UC_TS_SUM(UC_N,S)," or bracket ( + %3 + SUM(UC_GMAP_C(R,UC_N,'%9',C,UC_GRPTYPE), +$IF %6==2 (1+(FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS',UC_GRPTYPE,'PERDISC')-1)$UC_DT(R,UC_N)) * + SUM(RHS_COM%8(R,%4,C,TS)$RS_TREE(R,S,TS), + UC_COM(UC_N,'%9',%5,R,%7,C,TS,UC_GRPTYPE) * %VAR%_COM%9(R,%4,C,TS %SOW%)* + (1+(1/COM_IE(R,%4,C,TS)-1)$(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,'EFF') XOR DIAG(UC_GRPTYPE,'COM%9'))) * + +* [AL] PROD operator is useful here + PROD(ANNUAL,1)*PROD(RS_BELOW(R,TS,S),RS_FR(R,S,TS)*(1+RTCS_FR(R,%4,C,S,TS))) * +$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,'GROWTH'), +$IF %6==1 POWER(ABS(UC_COM(UC_N,'%9',%5,R,%7,C,TS,UC_GRPTYPE)),%11*UC_SIGN(%5)-1)) * +$IF %6==S (1/G_YRFR(R,S)) * + PROD(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,'PERIOD'),FPD(%4)) * + + PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,UC_GRPTYPE,UC_COST),1), + SUM((UC_ATTR(R,UC_N,%5,UC_GRPTYPE,UC_COST),RDCUR(R,CUR)), + OBJ_COM%10(R,%4,C,TS,UC_COST,CUR))) + ) + ) +* closing bracket of %3 : + ) +* closing bracket of %2 : + ) +* closing bracket of %1 : + ) diff --git a/uc_flo.mod b/uc_flo.mod new file mode 100644 index 0000000..041359c --- /dev/null +++ b/uc_flo.mod @@ -0,0 +1,77 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UC_FLO the code associated with the flow variable in the EQ_USERCON +* - %1 region summation index +* - %2 period summation index +* - %3 time-slice summation index +* - %4 'T' or 'T+1' index +* - %5 'LHS' or 'RHS' +* - %6 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) +*=============================================================================* +*UR Questions/Comments: +* - +*----------------------------------------------------------------------------- +$IF %6==1 $SET VAR '%9' SET SOW %10 +*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" + %1 +* "SUM(UC_T_SUM(R,UC_N,T)," or bracket "(" + %2 +$IF %6==2 (1+(FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','FLO','PERDISC')-1)$UC_DT(R,UC_N)) * +$IF %6==S (1/G_YRFR(R,S)) * +* "SUM(UC_TS_SUM(R,UC_N,S)," or bracket "(" + %3 + SUM((RTP_VINTYR(R,V,%4,P),UC_MAP_FLO(UC_N,%5,R,P,C),RTPCS_VARF(R,%4,P,C,TS))$RS_FR(R,S,TS), + %11(%12 +*V0.9a S reference should be TS +* [UR] model reduction %REDUCE% is set in *.run +$ BATINCLUDE %cal_red% C COM TS P %4 + * UC_FLO(UC_N,%5,R,%7,P,C,TS) * +*GG* use the derived multipier +* [AL] PROD operator is useful here, but must be activated due to a GAMS bug: + PROD(ANNUAL,1)*PROD(RS_BELOW(R,TS,S),RS_FR(R,S,TS)*(1+RTCS_FR(R,%4,C,S,TS))) * + +$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'FLO','GROWTH'), +$IF %6==1 POWER(ABS(UC_FLO(UC_N,%5,R,%7,P,C,TS)),%8*UC_SIGN(%5)-1)) * + PROD(UC_ATTR(R,UC_N,%5,'FLO',UC_PERDS),FPD(%4) * + PROD(UC_NEWFLO(UC_PERDS),1$(SAMEAS(V,%4)+RVPT(R,V,P,%4))/FPD(%4))) * + + PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,'FLO',UC_COST),1), + SUM((RDCUR(R,CUR),TS_ANN(TS,SL)), + OBJ_FCOST(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','COST') + +OBJ_FDELV(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','DELIV') + +MIN(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','SUB') + +MAX(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','TAX'))) + ) + ) + + + SUM(UC_CAPFLO(UC_N,%5,R,P,C), +$ BATINCLUDE cal_caps.mod %4 "UC_FLO(UC_N,%5,R,%7,P,C,TS)" TS + * +$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'FLO','GROWTH'), +$IF %6==1 SUM(RPCS_VAR(R,P,C,TS),RS_FR(R,TS,S)*POWER(ABS(UC_FLO(UC_N,%5,R,%7,P,C,TS)),%8*UC_SIGN(%5)-1))) * + PROD(UC_ATTR(R,UC_N,%5,'FLO',UC_PERDS),FPD(%4)$(NOT UC_NEWFLO(UC_PERDS))) * + + PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,'FLO',UC_COST),1), + SUM(RPCS_VAR(R,P,C,TS),RS_FR(R,TS,S) * + SUM((RDCUR(R,CUR),TS_ANN(TS,SL)), + OBJ_FCOST(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','COST') + +OBJ_FDELV(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'FLO','DELIV') + +MIN(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','SUB') + +MAX(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'FLO','TAX')))) + ) + + +* closing bracket of %3 : + ) + +* closing bracket of %2 : + ) + +* closing bracket of %1 : + ) + +* Add Cumflos +$IF %6==2 +SUM((%8RPC_CUMFLO(R,P,C,ALLYEAR,LL))$UC_CUMFLO(UC_N,R,P,C,ALLYEAR,LL),UC_CUMFLO(UC_N,R,P,C,ALLYEAR,LL)*%VAR%_CUMFLO(R,P,C,ALLYEAR,LL %SWT%)*%CUFSCAL%) diff --git a/uc_ire.mod b/uc_ire.mod new file mode 100644 index 0000000..de303aa --- /dev/null +++ b/uc_ire.mod @@ -0,0 +1,58 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UC_IRE the code associated with the IRE variable in the EQ_USERCON +* - %1 region summation index +* - %2 period summation index +* - %3 time-slice summation index +* - %4 'T' or 'T+1' index +* - %5 'LHS' or 'RHS' +*=============================================================================* +*UR Questions/Comments: +* - +*----------------------------------------------------------------------------- + +*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" + %1 +* "SUM(UC_T_SUM(R,UC_N,T)," or bracket "(" + %2 +$IF %6==2 (1+(FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','IRE','PERDISC')-1)$UC_DT(R,UC_N)) * +* "SUM(UC_TS_SUM(R,UC_N,S)," or bracket "(" + %3 +*[UR]: RPC_IRE comtrol may be redundant, only necessary if UC_IRE givrn for non-exchange processes by mistake + SUM((RTP_VINTYR(R,V,%4,P),UC_MAP_IRE(UC_N,R,P,C,IE),RTPCS_VARF(R,%4,P,C,TS))$RS_FR(R,S,TS), + ( + +* [UR] model reduction %REDUCE% is set in *.run + (%VAR%_IRE(R,V,%4,P,C,TS,IE %SOW%)$(NOT RPC_AIRE(R,P,C))+(%VAR%_ACT(R,V,%4,P,TS %SOW%)*PRC_ACTFLO(R,V,P,C))$RPC_AIRE(R,P,C)) + * UC_IRE(UC_N,%5,R,%7,P,C,TS,IE) * +*GG* use the derived multipier +* [AL] PROD operator is useful here, but must be activated due to a GAMS bug: + PROD(ANNUAL,1)*PROD(RS_BELOW(R,TS,S),RS_FR(R,S,TS)*(1+RTCS_FR(R,%4,C,S,TS))) * + +$IF %6==1 PROD(UC_ATTR(R,UC_N,%5,'IRE','GROWTH'), +$IF %6==1 POWER(ABS(UC_IRE(UC_N,%5,R,%7,P,C,TS,IE)),%8*UC_SIGN(%5)-1)) * +$IF %6==S (1/G_YRFR(R,S)) * + PROD(UC_ATTR(R,UC_N,%5,'IRE',UC_PERDS),FPD(%4) * + PROD(UC_NEWFLO(UC_PERDS),1$(SAMEAS(V,%4)+RVPT(R,V,P,%4))/FPD(%4))) * + + PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%5,'IRE',UC_COST),1), + SUM((RDCUR(R,CUR),TS_ANN(TS,SL)), + OBJ_FCOST(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'IRE','COST') + +OBJ_FDELV(R,%4,P,C,SL,CUR)$UC_ATTR(R,UC_N,%5,'IRE','DELIV') + +MIN(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'IRE','SUB') + +MAX(0,OBJ_FTAX(R,%4,P,C,SL,CUR))$UC_ATTR(R,UC_N,%5,'IRE','TAX'))) + ) + ) + +* closing bracket of %3 : + ) + +* closing bracket of %2 : + ) + +* closing bracket of %1 : + ) + diff --git a/uc_ncap.mod b/uc_ncap.mod new file mode 100644 index 0000000..a63d540 --- /dev/null +++ b/uc_ncap.mod @@ -0,0 +1,51 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UC_NCAP the code associated with the flow variable in the EQ_USERCON +* - %1 region summation index +* - %2 period summation index +* - %3 'T' or 'T+1' index +* - %4 'LHS' or 'RHS' +* - %5 Type of constraint (0=EACH, 1=SUCC or 2=SEVERAL) +*=============================================================================* +*UR Questions/Comments: +* - +*----------------------------------------------------------------------------- +*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" + %1 + +* UR 05/15/00 +* SUM(UC_GRP$( UC_GMAP(R,UC_N,'NCAP',UC_GRP)*%4 ), + +* "SUM(UC_T_SUM(UC_N,T)," or bracket "(" + %2 +* [AL] VAR_NCAP(R,%3,P) can be active even if there is no RTP_CPTYR(R,V,T,P) (due to ILED)! +* [AL] Therefore, changed to check for RTP(R,%3,P) without RTP_OFF(R,%3,P) +* SUM((P,CUR)$(UC_GMAP_P(R,UC_N,'NCAP',P)*SUM(V,RTP_CPTYR(R,V,T,P))), + SUM(UC_GMAP_P(R,UC_N,'NCAP',P)$RTP(R,%3,P), UC_NCAP(UC_N,%4,R,%6,P) * + (%VAR%_NCAP(R,%3,P %SOW%)$(NOT RTP_OFF(R,%3,P)) + + (SUM(RVPT(R,V,P,%3),%VARV%_NCAP(R,V,P %SWS%)) + %VAR%_NCAP(R,%3,P %SOW%) * + (COEF_RPTI(R,%3,P)-PROD(RVPT(R,%3,P,MILESTONYR),2)))$UC_ATTR(R,UC_N,%4,'NCAP','PERIOD')) * + +* [AL] PROD operator is useful here, but needs to be 'tweaked' due to a bug in GAMS 21.3-21.4: +$IF %5==1 PROD(UC_ATTR(R,UC_N,%4,'NCAP','GROWTH'), +$IF %5==1 POWER(ABS(UC_NCAP(UC_N,%4,R,%6,P)),%7*UC_SIGN(%4)-1)) * + PROD(UC_ATTR(R,UC_N,%4,'NCAP','BUILDUP'),1/LEAD(%3)) * + + PROD(L('N'),PROD(REG(R)$SUM(UC_ATTR(R,UC_N,%4,'NCAP',UC_COST),1), + SUM(RDCUR(R,CUR), +$IF NOT %3==%6 SUM(UC_ATTR(R,UC_N,%4,'NCAP',UC_ANNUL),CST_ANNC(R,%3,P,%6,UC_ANNUL,CUR))+ + OBJ_ICOST(R,%3,P,CUR)$UC_ATTR(R,UC_N,%4,'NCAP','COST') + +OBJ_ITAX(R,%3,P,CUR)$UC_ATTR(R,UC_N,%4,'NCAP','TAX') + -OBJ_ISUB(R,%3,P,CUR)$UC_ATTR(R,UC_N,%4,'NCAP','SUB')))) + + ) + +* closing bracket of %2 : + ) + +* closing bracket of %1 : + ) + diff --git a/uc_pasti.mod b/uc_pasti.mod new file mode 100644 index 0000000..69af228 --- /dev/null +++ b/uc_pasti.mod @@ -0,0 +1,33 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UC_PASTI code associated with first period capacity in GROWTH constraint +* - %1 region summation index +* - %2 period summation index (MIYR_1) +* - %3 T index +* - %4 'LHS' or 'RHS' +*=============================================================================* +*AL Questions/Comments: +* - Possible bound attributes are for now ignored for PASTI +*----------------------------------------------------------------------------- +*"SUM(UC_R_SUM(R,UC_N)," or bracket "(" + %1 + +*[AL] Sum over RTP that have UC_CAP specified on current side + SUM(RTP(R,%3,P)$UC_GMAP_P(R,UC_N,'CAP',P), + +* Sum of PASTI inherited to first period is used as a capacity value for T-1 of MIYR_1(T) +* UC_CAP coefficient is taken from MIYR_1, because UC_CAP is interpolated on T only + SUM(RTP_CPTYR(R,PASTYEAR,%3,P),COEF_CPT(R,PASTYEAR,%3,P)*NCAP_PASTI(R,PASTYEAR,P)) * + UC_CAP(UC_N,%4,R,%3,P) * +* [AL] PROD operator is useful here, but needs to be 'initialized' due to a GAMS bug: + PROD(SIDE(%4),PROD(UC_ATTR(R,UC_N,SIDE,'CAP','GROWTH'), + POWER(ABS(UC_CAP(UC_N,%4,R,%3,P)),M(%3)-B(%3)))) + + ) + +* closing bracket of %1 : + )$SUM(%2(%3),1) + diff --git a/ucbet.vda b/ucbet.vda new file mode 100644 index 0000000..5caafac --- /dev/null +++ b/ucbet.vda @@ -0,0 +1,129 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UCBET.vda Derivation of maximum activities and flows according to UCBET * +* %1 - mod or v# for the source code to be used * +*=============================================================================* +* Questions/Comments: +*----------------------------------------------------------------------------- +* Preprocessing of UC_FLOBET: + SET UC_GMAX(UC_N,ALL_R,ITEM,C,ITEM); + SET UC_GMAXR(ALL_R,UC_N); + ALIAS(*,NAME); + +* Collect set of all regional cumulative UC_N + OPTION CLEAR=UNCD1; + LOOP((UC_N,R,T,P,C)$UC_FLOBET(UC_N,R,T,P,C),UNCD1(UC_N)=YES); + UC_GMAXR(UC_R_EACH) = YES; + UC_R_SUM(R,UC_N(UNCD1)) = YES; + +* Set Equation controls + LOOP((UC_N,R,T,P,C)$UC_FLOBET(UC_N,R,T,P,C), + IF(SAMEAS(%PGPRIM%,C), + IF(UC_ATTR(R,UC_N,'LHS','ACT','N'), + UC_GMAX(UC_N,'IMPEXP',P,C,'EACH') = YES; + ELSE UC_GMAX(UC_N,R,P,C,'EACH') = YES); + ELSE + IF(UC_GMAXR(R,UC_N), UC_GMAX(UC_N,R,'N',C,'N') = YES; + ELSE UC_GMAX(UC_N,'IMPEXP','N',C,'N') = YES); + )); + +* If IMPEXP should be one group, add IMPEXP for regional UC_N + LOOP(R,UC_GMAXR('IMPEXP',UC_N)$UC_GMAXR(R,UC_N) = YES); +* Remove all (ALL_R,UC_N) not used in betting parameters + OPTION CLEAR=RXX; + LOOP(UC_GMAX(UC_N,ALL_R,ITEM,C,NAME),RXX('IMPEXP',UC_N,ALL_R) = YES); + UC_GMAXR(ALL_R,UC_N)$(NOT RXX('IMPEXP',UC_N,ALL_R)) = NO; +* Remove EQE_UC equations for maxed UC_N + UC_TS_SUM(R,UC_N(UNCD1),S) = NO; + +*----------------------------------------------------------------------------- +* EQUATIONS +*----------------------------------------------------------------------------- + + %EQ%G_UCMAX(UC_GMAX(UC_N,ALL_R,ITEM,C,NAME)%SOW%) .. + +* Select variable to be maximized (remove SUM if IMPEXP group allowed) + + %VAR%_UC(UC_N%SOW%)$(NOT UC_GMAXR(ALL_R,UC_N)) + + SUM(R(ALL_R),%VAR%_UCR(UC_N,R%SOW%)$UC_GMAXR(ALL_R,UC_N)) + + =G= + +$IF %STAGES%==YES $SETLOCAL ORGSOW '%SOW%' SET SWTD ",SW_TSW(SOW,T,W)" SET SOW ,W + +* Sum of flows by region + SUM((UC_T_SUM(UC_GMAXR(R(ALL_R),UC_N),T)%SWTD%), +*....Time Mutiplier + (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * + SUM(RTPCS_VARF(R,T,P,COM,S)$(COM_GMAP(R,C,COM)$UC_FLOBET(UC_N,R,T,P,C)), + UC_FLOBET(UC_N,R,T,P,C) * + SUM(RTP_VINTYR(R,V,T,P), + ( +$ BATINCLUDE %cal_red% COM COM1 S P T + )$RP_STD(R,P) + +*....For IRE processes, sum Import flows only + SUM(RPC_IRE(R,P,COM,IE('IMP')), + %VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM)) + + (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))$RP_IRE(R,P) + )))$LIM(NAME) + + +* Sum of flows globally + SUM((UC_T_SUM(R,UC_N,T)%SWTD%)$(NOT UC_GMAXR(R,UC_N)), +*....Time Mutiplier + (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * + SUM(RTPCS_VARF(R,T,P,COM,S)$(COM_GMAP(R,C,COM)$UC_FLOBET(UC_N,R,T,P,C)), + UC_FLOBET(UC_N,R,T,P,C) * + SUM(RTP_VINTYR(R,V,T,P), + ( +$ BATINCLUDE %cal_red% COM COM1 S P T + )$RP_STD(R,P) + +*....For IRE processes, sum Import flows only + SUM(RPC_IRE(R,P,COM,IE('IMP')), + %VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM)) + + (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM))$RP_IRE(R,P) + )))$((NOT REG(ALL_R))$LIM(NAME)) + + +* Sum of activities by region + SUM((UC_T_SUM(R(ALL_R),UC_N,T)%SWTD%), +*....Time Mutiplier + (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * + SUM(RTP_VINTYR(R,V,T,P(ITEM))$UC_FLOBET(UC_N,R,T,P,%PGPRIM%), + UC_FLOBET(UC_N,R,T,P,%PGPRIM%) * + ( +*........For Standard processes, sum activities + SUM((RTP_VARA(R,T,P),PRC_TS(R,P,S)), %VAR%_ACT(R,V,T,P,S%SOW%))$RP_STD(R,P) + +*........For IRE processes, sum Import flows only + SUM((RPC_IRE(R,P,COM,IE('IMP')),RTPCS_VARF(R,T,P,COM,S)), + (%VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ + (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM)))$RP_IRE(R,P) + )) + )$UC_NUMBER(NAME) + + +* Sum of activities globally + SUM((UC_T_SUM(R,UC_N,T)%SWTD%)$(NOT REG(ALL_R)), +*....Time Mutiplier + (FPD(T)+(COEF_PVT(R,T)-FPD(T))$UC_ATTR(R,UC_N,'LHS','ACT','PERDISC')) * + SUM(RTP_VINTYR(R,V,T,P(ITEM))$UC_FLOBET(UC_N,R,T,P,%PGPRIM%), + UC_FLOBET(UC_N,R,T,P,%PGPRIM%) * + ( +*........For Standard processes, sum activities + SUM((RTP_VARA(R,T,P),PRC_TS(R,P,S)), %VAR%_ACT(R,V,T,P,S%SOW%))$RP_STD(R,P) + +*........For IRE processes, sum Import flows only + SUM((RPC_IRE(R,P,COM,IE('IMP')),RTPCS_VARF(R,T,P,COM,S)), + (%VAR%_IRE(R,V,T,P,COM,S,IE%SOW%)$(NOT RPC_AIRE(R,P,COM))+ + (%VAR%_ACT(R,V,T,P,S%SOW%)*PRC_ACTFLO(R,V,P,COM))$RPC_AIRE(R,P,COM)))$RP_IRE(R,P) + )) + )$((NOT REG(ALL_R))$UC_NUMBER(NAME)) + +; +$IF %STAGES%==YES $SET SOW %ORGSOW% +*----------------------------------------------------------------------------- +* Sum regional maximums to global (change R to ALL_R if IMPEXP allowed) + %EQ%G_UCSUMAX(UC_N%SOW%)$SUM(UC_GMAXR(ALL_R,UC_N),1) .. + + %VAR%_UC(UC_N%SOW%) =G= SUM(UC_GMAXR(R,UC_N),%VAR%_UCR(UC_N,R%SOW%)); + +*----------------------------------------------------------------------------- diff --git a/units.def b/units.def new file mode 100644 index 0000000..fb2bd40 --- /dev/null +++ b/units.def @@ -0,0 +1,38 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*=============================================================================* +* UNITS.DEF has complete list of unit types * +*=============================================================================* + +* units by group + SET UNITS 'Units' / Bv-km, Bv-kma, GW, MW, Mt, Mta, kt, kta, kth, t, PJ, PJa, TJ, TJa, TWh, GWh, MWh, uvol, CUR, GPKM, GVKM, Mcar, UCU / + ALIAS(UNITS,U); + SET UNITS_COM(UNITS) 'Commodity Units' / Bv-km, Mt, kt, t, PJ, TJ, uvol, GPKM, GVKM, UCU / + SET UNITS_CAP(UNITS) 'Capacity Units' / PJa, GW, MW, Mta, kta, Bv-kma, Mcar / + SET UNITS_ACT(UNITS) 'Activity Units' / Mt, kt, kth, PJ, TJ, TWh, GWh, MWh, GPKM, GVKM / + SET UNITS_MONY(UNITS) 'Monatary Units' / CUR / + +* unit mapping table(s) + PARAMETER G_UNCA(UNITS,UNITS_ACT) 'Cap-to-Act conversions' / + GW.GWH 8760 + GW.PJ 31.536 + GW.TWH 8.760 + GWH.PJ 0.0036 + GWH.TJ 3.6 + GWH.TWH 0.001 + MW.GWH 8.76 + MW.MWH 8760 + MW.PJ 0.031536 + MW.TJ 31.536 + MWH.GWH 0.001 + MWH.TJ 0.0036 + PJA.PJ 1 + TJA.TJ 1 + TWH.PJ 3.6 + Mta.Mt 1 + Mta.kt 1000 + kta.Mt 0.001 + kta.kt 1 + kta.kth 8760 /; \ No newline at end of file diff --git a/writeddf.msa b/writeddf.msa new file mode 100644 index 0000000..781bbe0 --- /dev/null +++ b/writeddf.msa @@ -0,0 +1,82 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================== +* TIMES MACRO/MSA DDF Writing utility +*============================================================================== + +FILE DDFFILE /%1.DD/; +PUT DDFFILE; +* make 7 decimals points and allow for wider page +DDFFILE.NW=15;DDFFILE.ND=7;DDFFILE.PW=255; + +* Output updated value of TM_EC0 +PUT 'PARAMETER TM_EC0(R) /' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_EC0(R) /); +PUT '/;' /; +IF(CARD(TM_AMP),PUT 'PARAMETER TM_AMP(R,ALLYEAR) /' /; +LOOP((MR(R),T)$TM_AMP(R,T), PUT @1 R.TL:0,".":0,T.TL:0, TM_AMP(R,T) /); +PUT '/;' /); +* Output updated value of TM_GROWV +PUT "PARAMETER TM_GROWV(R,ALLYEAR) /" /; +LOOP((MR(R),T)$TM_GROWV(R,T), PUT R.TL:0,".":0, T.TL:0, TM_GROWV(R,T) /); +PUT '/;' /; +* Output calibrated Baseline GDP GROWth +PUT "PARAMETER TM_GR(R,ALLYEAR) /" /; +LOOP((MR(R),T)$PAR_GRGDP(R,T), PUT R.TL:0,".":0, T.TL:0, %2(R,T) /); +PUT '/;' /; +* Output calibrated Baseline IV +PUT "PARAMETER PAR_IV(R,ALLYEAR) /" /; +LOOP((MR(R),T)$PAR_IV(R,T), PUT R.TL:0,".":0, T.TL:0, PAR_IV(R,T) /); +PUT '/;' /; +* Output calibrated Baseline Discount Factors +IF(CARD(TM_UDF),PUT "PARAMETER TM_UDF(R,ALLYEAR) /" /; +LOOP((MR(R),T)$TM_UDF(R,T), PUT R.TL:0,".":0, T.TL:0, TM_UDF(R,T) /); +PUT '/;' /); +* +* output the PREFs +PUT "PARAMETER TM_DDATPREF(R,C) /" /; +LOOP(DEM(MR(R),C)$TM_DDATPREF(R,C), PUT R.TL:0,".":0,C.TL:0, TM_DDATPREF(R,C) /;); +PUT "/;" /; + +* output the DDFs +PUT "PARAMETER TM_DDF(R,ALLYEAR,C) /" /; +LOOP((MR(R),T,DM(C))$TM_DDF(R,T,DM), +PUT PUT R.TL:0,".":0,T.TL:0,".":0,C.TL:0, TM_DDF(R,T,C) /;); +PUT "/;" /; + +PUT / @1,'SCALAR TM_ARBM' / @1 '/' /; +PUT @1 TM_ARBM / @1 '/;'; + +PUT / @1,'SCALAR TM_SCALE_UTIL' / @1 '/' /; +PUT @1 TM_SCALE_UTIL / @1 '/;'; + +PUT / @1,'SCALAR TM_SCALE_CST' / @1 '/' /; +PUT @1 TM_SCALE_CST / @1 '/;'; + +PUT / @1,'SCALAR TM_SCALE_NRG' / @1 '/' /; +PUT @1 TM_SCALE_NRG / @1 '/;'; + +PUT / @1,'PARAMETER TM_KGDP(R)' / @1 '/' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_KGDP(R) / @1 '/;'); + +PUT / @1,'PARAMETER TM_KPVS(R)' / @1 '/' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_KPVS(R) / @1 '/;'); + +PUT / @1,'PARAMETER TM_DEPR(R)' / @1 '/' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_DEPR(R) / @1 '/;'); + +PUT / @1,'PARAMETER TM_ESUB(R)' / @1 '/' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_ESUB(R) / @1 '/;'); + +PUT / @1,'PARAMETER TM_GDP0(R)' / @1 '/' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_GDP0(R) / @1 '/;'); + +PUT / @1,'PARAMETER TM_DMTOL(R)' / @1 '/' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_DMTOL(R) / @1 '/;'); + +PUT / @1,'PARAMETER TM_IVETOL(R)' / @1 '/' /; +LOOP(MR(R), PUT @1 R.TL:0, TM_IVETOL(R) / @1 '/;'); + +PUTCLOSE DDFFILE; \ No newline at end of file diff --git a/wrtbprice.mod b/wrtbprice.mod new file mode 100644 index 0000000..79502c4 --- /dev/null +++ b/wrtbprice.mod @@ -0,0 +1,35 @@ +*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* Copyright (C) 2000-2023 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). +*============================================================================== +* Saving shadow prices of commodity balances to be used as base prices +* for elastic demands into gdx files com_bprice.gdx & _DP.dgx +*============================================================================== + PARAMETER DINV(R,YEAR,CUR) //; + PARAMETER SOL_BPRICE(REG,ALLYEAR,COM,ALL_TS,CUR) //; + PARAMETER SOL_ACFR(R,UC_COST,YEAR) //; + SET ANCAT(UC_COST,ITEM) / COST.(INV, FIX, VAR, DAM), TAX.(INVX, FIXX, VARX) /; +*------------------------------------------------------------------------------ +* Undiscounting via matrix inversion currently disabled; using direct method + DINV(R,T,CUR)$G_RCUR(R,CUR) = 1/COEF_PVT(R,T); + + SOL_BPRICE(R,T,C,S,CUR)$(RCS_COMBAL(R,T,C,S,'LO')$DEM(R,C)) = DINV(R,T,CUR)*EQG_COMBAL.M(R,T,C,S); + SOL_BPRICE(R,T,C,S,CUR)$(RCS_COMBAL(R,T,C,S,'FX')$DEM(R,C)) = DINV(R,T,CUR)*EQE_COMBAL.M(R,T,C,S); + +* Check elastic supply curve requests +$ IF DEFINED DAM_ELAST TRACKC(RC)$((NOT DAM_BQTY(RC))$DAM_ELAST(RC,'N')) = YES; +$ IF DEFINED DAM_COST LOOP((R,T,C,CUR)$DAM_COST(R,T,C,CUR), TRACKC(R,C) = NO); + OPTION CLEAR=DAM_COEF,CLEAR=DAM_TVOC; + DAM_COEF(RTCS_VARC(R,T,C,S))$TRACKC(R,C) = EQE_COMPRD.M(R,T,C,S)/COEF_PVT(R,T)+EPS; + DAM_TVOC(RTC(R,T,C),'N')$TRACKC(R,C) = SUM(RTCS_VARC(RTC,S),DAM_COEF(RTC,S)*VAR_COMPRD.L(RTC,S)); + +* Save also annual cost to expenditure ratios for TIMES CGE calibration + RB(R,T) = SUM((COM_TS(DEM(R,C),S),RDCUR(R,CUR)),SOL_BPRICE(R,T,C,S,CUR)*COM_FR(R,T,C,S)*COM_PROJ(R,T,C))+1-1; +$ IFI NOT %STAGES%==YES +$ IFI %ANNCOST%==LEV SOL_ACFR(R,UC_COST,T)$RB(R,T)=SUM(SYSUCMAP(SYSUC,ITEM)$ANCAT(UC_COST,ITEM),REG_ACOST(R,T,SYSUC)) / RB(R,T); + OPTION CLEAR=RB,CLEAR=TRACKC; + + EXECUTE_UNLOAD 'com_bprice',sol_bprice,DAM_COEF,DAM_TVOC,SOL_ACFR; + EXECUTE_UNLOAD '%GDXPATH%%RUN_NAME%_DP',sol_bprice,DAM_COEF,DAM_TVOC,SOL_ACFR; +*------------------------------------------------------------------------------ From 30a6de29458712aad692720e3d64766c2a1bc055 Mon Sep 17 00:00:00 2001 From: Olexandr Balyk Date: Thu, 18 Jan 2024 14:22:09 -0500 Subject: [PATCH 3/3] Squashed 'source/' changes from 0b38d80..88f6d8c 88f6d8c Update to v4.7.8 git-subtree-dir: source git-subtree-split: 88f6d8cf58ff463e5676bed3cd7fd55e3f91bb78 --- Version.log | 21 ++++++++++++++++++++- cal_fflo.mod | 25 ++++++++++++------------- eqpeak.mod | 6 +++--- init_ext.vda | 19 ++++++++----------- initsys.mod | 4 ++-- pp_lvlpk.mod | 20 ++++++++++---------- pp_prelv.vda | 7 ++++--- pp_qack.mod | 17 +++++++++++++---- pp_qafs.mod | 3 +-- ppmain.mod | 16 ++++++++++------ setglobs.gms | 4 +++- 11 files changed, 86 insertions(+), 56 deletions(-) diff --git a/Version.log b/Version.log index 8b5d882..f0405b9 100644 --- a/Version.log +++ b/Version.log @@ -2827,4 +2827,23 @@ eqpeak.mod : (2) cal_ire.mod : (2) err_stat.mod : (4) rpt_ext.ecb : (1) -solsetv.v3 : (3) \ No newline at end of file +solsetv.v3 : (3) + +----------------------------------------------------------------------------------------- +TIMES Version 4.7.8 +----------------------------------------------------------------------------------------- +Date: 19-Jan-2024 [AL]: Maintenance QA release +1) Added QA checks against invalid attributes +2) Improved topology check for auxiliary IRE flows +3) Small performance/cosmetic improvements + +Modified files: (reason) +initsys.mod : Increased version number to 4.7.8 +ppmain.mod : (1),(2) +setglobs.gms : (1) +pp_lvlpk.mod : (3) +eqpeak.mod : (3) +cal_fflo.mod : (3) +pp_qack.mod : (1) +init_ext.vda : (2) +pp_prelv.vda : (3) \ No newline at end of file diff --git a/cal_fflo.mod b/cal_fflo.mod index a75d6e0..cf91b39 100644 --- a/cal_fflo.mod +++ b/cal_fflo.mod @@ -1,30 +1,30 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *=============================================================================* * CAL_FFLO the code associated with the flow variable in the EQ_COMxxx * %1 - 'IN/OUT' for consumption/production -** %2 - 'I/O' for for invest/decommission checks (for now - NO LONGER USED) +** %2 - 'I/O' for invest/decommission checks (no longer used) * %3 - * Peak multiplier +* %4 - Peak by flow contribution *=============================================================================* *GaG Questions/Comments: * - VAR_FLOs according to whether c-in-PCG otherwise RPS_S1 *----------------------------------------------------------------------------- -$IF %REDUCE% == 'YES' $GOTO REDUCE +$IF %REDUCE% == YES $GOTO REDUCE $SET SHP1 "" SET SHG ",P,CG3,C" $IF DEFINED RTP_FFCS $SET SHP1 "*(%SHFF%S(R,V%SHG%%SOW%))" $SET SHP1 "*(%SHFF%X(R,V,T%SHG%)$PRC_VINT(R,P))%SHP1%" *----------------------------------------------------------------------------- *V05c 980923 - check that commodity not just capacity related SUM(TOP(RP_FLO(R,P),C,'%1')$(NOT RPC_EMIS(R,P,C)), - SUM(RTPCS_VARF(R,T,P,C,TS), - SUM(RTP_VINTYR(R,V,T,P), %VAR%_FLO(R,V,T,P,C,TS %SOW%) + SUM((RTP_VINTYR(R,V,T,P),RTPCS_VARF(R,T,P,C,TS)), * equation coarser than variable or equation finer than variable -*M2T* consider COM_TS shape too, so both TS_MAP and TS_BELOW both embedded - %3) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))) +* consider COM_TS shape too, so both TS_MAP and RS_BELOW embedded + %VAR%_FLO(R,V,T,P,C,TS %SOW%) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) %3) ) + -* [AL] Handle RPC_EMIS flows separately; They cannot be NOFLO +* Handle RPC_EMIS flows separately; They cannot be NOFLO SUM(TOP(RPC_EMIS(RP_FLO(R,P),C),'%1'), SUM((FS_EMIS(R,P,CG3,COM2,C),RTPCS_VARF(R,T,P,COM2,TS))$RS_TREE(R,S,TS), SUM(RTP_VINTYR(R,V,T,P),%VAR%_FLO(R,V,T,P,COM2,TS %SOW%) * @@ -35,18 +35,17 @@ $EXIT *----------------------------------------------------------------------------- $LABEL REDUCE * [UR] model reduction %REDUCE% is set in *.run -*[AL] Sum over non-vintaged processes +* Sum over non-vintaged processes SUM(TOP(RP_FLO(R,P),C,'%1')$(NOT PRC_VINT(R,P)), SUM((RTP_VINTYR(R,V(T),T,P),RTPCS_VARF(R,T,P,C,TS)), $ BATINCLUDE cal_red.red C COM TS P T '' T * equation coarser than variable or equation finer than variable - %3 * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))) + * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) %3)%4 ) + -*[AL] Sum over vintaged processes - SUM((TOP(PRC_VINT(RP_FLO(R,P)),C,'%1'),RTPCS_VARF(R,T,P,C,TS)), +* Sum over vintaged processes + SUM((TOP(PRC_VINT(RP_FLO(R,P)),C,'%1'),RTPCS_VARF(R,T,P,C,TS))%4, $ BATINCLUDE cal_red.red C COM TS P T '' V SUM 'RTP_VINTYR(R,V,T,P),' %3 * equation coarser than variable or equation finer than variable * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS)) ) + - diff --git a/eqpeak.mod b/eqpeak.mod index 62561f2..3d470fc 100644 --- a/eqpeak.mod +++ b/eqpeak.mod @@ -1,5 +1,5 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *=============================================================================* @@ -41,7 +41,7 @@ $ BATINCLUDE cal_ire.%1 EXP IN IE '*(-NCAP_PKCNT(R,V,P,S)/COM_IE(R,T,C,S))$ $ BATINCLUDE cal_stgn.%1 OUT IN '*STG_EFF(R,V,P)' '' "(NOT PRC_NSTTS(R,P,TS))" '*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))$RPC_PKF(R,P,C)' * individual flows -$ BATINCLUDE cal_fflo.%1 OUT O '*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))$RPC_PKF(R,P,C)' +$ BATINCLUDE cal_fflo.%1 OUT O '*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))' '$RPC_PKF(R,P,C)' 0) @@ -72,7 +72,7 @@ $ BATINCLUDE cal_ire.%1 EXP IN IE '*FLO_PKCOI(R,T,P,C,TS)' - $ BATINCLUDE cal_cap.%1 IN I '1$(NOT PRC_PKNO(R,P))*' + * storage -$ BATINCLUDE cal_stgn.%1 IN OUT '' 'STG_EFF(R,V,P)*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" "$(NOT RPC_PKC(R,P,C))" +$ BATINCLUDE cal_stgn.%1 IN OUT '' 'STG_EFF(R,V,P)*(NCAP_PKCNT(R,V,P,S)**RPC_PKF(R,P,C))*' "((NOT PRC_MAP(R,'NST',P))+PRC_NSTTS(R,P,TS))" "$RPC_PKF(R,P,C)" * blending SUM(BLE_OPR(R,BLE,OPR)$(BLE_INP(R,BLE,C)*BLE_TP(R,T,BLE)),G_YRFR(R,S)*(1+RTCS_FR(R,T,C,S,'ANNUAL'))*BL_INP(R,BLE,C)*PEAKDA_BL(R,BLE,T)*%VAR%_BLND(R,T,BLE,OPR %SOW%)) + diff --git a/init_ext.vda b/init_ext.vda index 5940707..d200f00 100644 --- a/init_ext.vda +++ b/init_ext.vda @@ -1,5 +1,5 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *=============================================================================* @@ -86,29 +86,26 @@ $IF NOT %OBMAC%==YES PARAMETER VAR_SIFT(LL,S,L) //; PRC_RESID(R,LL--ORD(LL),P)$((PRC_RESID(R,LL,P)>0)$PRC_RESID(R,LL,P)) = PRC_RESID(R,'0',P)+EPS; NCAP_PASTI(R,PYR_S,P)$PRC_RESID(R,'0',P) = 1; *----------------------------------------------------------------------------- -* Initial Preprocessing of VDA_EMCB and FLO_EMIS +* Initial Preprocessing of VDA_EMCB, FLO_EMIS and IRE_FLOSUM FLO_EMIS(R,LL,P,CG,C,S) $= FLO_EFF(R,LL,P,CG,C,S); OPTION CLEAR=RXX,CLEAR=FLO_EFF; - VDA_EMCB(R,DATAYEAR,C,COM)$COM_TMAP(R,'ENV',C) = 0; - LOOP((R,DATAYEAR,C,COM)$VDA_EMCB(R,DATAYEAR,C,COM),RXX(R,C,COM) = YES;); + VDA_EMCB(R,YEAR,C,COM)$COM_TMAP(R,'ENV',C) = 0; + LOOP((R,DATAYEAR,C,COM)$VDA_EMCB(R,DATAYEAR,C,COM),RXX(R,C,COM) = YES); RXX(R,C,COM)$(NOT COM_TMAP(R,'ENV',COM)) = NO; LOOP((TOP(R,P,C,'IN'),RXX(R,C,COM)),FS_EMCB(R,P,COM,C)=YES); FS_EMCB(R,P,COM,C)$TOP(R,P,COM,'IN') = NO; OPTION TRACKPC <= FS_EMCB; TOP(TRACKPC,'OUT') = YES; - OPTION CLEAR=RXX, CLEAR=TRACKPC, PRC_ACT < PRC_ACTUNT; + OPTION CLEAR=RXX, CLEAR=TRACKPC; LOOP((R,DATAYEAR,P,CG,C,S)$FLO_EMIS(R,DATAYEAR,P,CG,C,S),RPC_EMIS(R,P,C) = YES); - TOP(RPC_EMIS(PRC_ACT(R,P),C),'OUT')$(COM_TMAP(R,'ENV',C)*(NOT TOP(R,P,C,'IN'))) = YES; + RPG_RED(RPC_EMIS(R,P,C),'OUT')$(NOT TOP(R,P,C,'IN')) = YES; + LOOP((R,DATAYEAR,P,C,S,IE,COM,IO)$(PRC_MAP(R,'IRE',P)$IRE_FLOSUM(R,DATAYEAR,P,C,S,IE,COM,IO)),RPG_RED(R,P,COM,IO) = YES); *----------------------------------------------------------------------------- * Initial Preprocessing of COM_AGG and VDA_FLOP COM_AGG(R,LL,C,C)$COM_AGG(R,LL,C,C) = 0; VDA_FLOP(R,LL,P,CG,S) $= ACT_FLO(R,LL,P,CG,S); KEEP_FLOF(R,P,C)$VDA_FLOP(R,'%DFLBL%',P,C,'ANNUAL') = YES; $IFI %SHELL%==ANSWER KEEP_FLOF(R,P,C)$PRC_ACTFLO(R,'%DFLBL%',P,C) = YES; -*----------------------------------------------------------------------------- -* Initial Preprocessing of IRE_FLOSUM - LOOP((R,DATAYEAR,P,C,S,IE,COM,IO)$IRE_FLOSUM(R,DATAYEAR,P,C,S,IE,COM,IO),RPG_ACE(R,P,COM,IO) = YES); - TOP(RPG_ACE(PRC_ACT,C,IO)) = YES; - OPTION CLEAR=PRC_ACT,CLEAR=ACT_FLO,CLEAR=RPG_ACE; + OPTION CLEAR=ACT_FLO; *----------------------------------------------------------------------------- * Handle Updatable OFF-ranges & REG_BDNCAP process-based bounds NCAP_START(R,P)$(NCAP_START(R,P)<=MIYR_BOH)=0; diff --git a/initsys.mod b/initsys.mod index 3a0782a..161986a 100644 --- a/initsys.mod +++ b/initsys.mod @@ -1,10 +1,10 @@ -$TITLE TIMES -- VERSION 4.7.7 +$TITLE TIMES -- VERSION 4.7.8 *==========================================================================================* * INITSYS.MOD has all the fixed system declarations for ETSAP TIMES * *==========================================================================================* $ onlisting ontext *=========================================================================================== -* Copyright (C) 2000-2023 IEA Energy Technology Systems Analysis Programme (IEA-ETSAP). +* Copyright (C) 2000-2024 IEA Energy Technology Systems Analysis Programme (IEA-ETSAP). * This software (ETSAP TIMES) is open source: you can redistribute it and/or modify it * under the terms of the GNU General Public License v3.0 (see file NOTICE-GPLv3.txt). * For further information, visit: . diff --git a/pp_lvlpk.mod b/pp_lvlpk.mod index 5f44ff0..463a419 100644 --- a/pp_lvlpk.mod +++ b/pp_lvlpk.mod @@ -1,5 +1,5 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *=============================================================================* @@ -18,9 +18,9 @@ *----------------------------------------------------------------------------- * Levelization of NCAP_PKCNT OPTION RTP_ISHPR < NCAP_PKCNT; - TRACKPC(RPC(R,P,C))$((TOP(RPC,'OUT')+RPC_IRE(RPC,'IMP')+PRC_PKNO(R,P))$TRACKC(R,C)) = YES; - RTP_GRP(RTP_ISHPR(RTP(R,V,P)),C,IO('OUT'))$(SUM(RCS(R,C,S)$(NOT NCAP_PKCNT(R,V,P,S)),1)$TRACKPC(R,P,C)) = YES; - FLO_PKCOI(RTP(R,T,P),C,S)$(TRACKPC(R,P,C)$PRC_PKNO(R,P)) = 0; + FLO_PKCOI(RTP(R,T,P),C,S)$(TRACKC(R,C)$PRC_PKNO(R,P)) = 0; + TRACKPC(RPC(R,P,C))$((TOP(RPC,'OUT')+RPC_IRE(RPC,'IMP'))$TRACKC(R,C)) = YES; + RTP_GRP(RTP_ISHPR(RTP(R,V,P)),C,IO(IPS))$(SUM(RCS(R,C,S)$(NOT NCAP_PKCNT(R,V,P,S)),1)$TRACKPC(R,P,C)) = YES; *----------------------------------------------------------------------------- * Aggregation/inheritance to target timeslices *----------------------------------------------------------------------------- @@ -39,12 +39,12 @@ *----------------------------------------------------------------------------- * Peak contribution * If PRC_PKAF, apply PKCNT only for capacity - TRACKP(PRC_PKAF(RP))=NOT PRC_PKNO(RP); RPC_PKF(TRACKPC(RP,C))=EPS**1$TRACKP(RP); - TRACKPC(PRC_PKNO(RP),C)=NO; -* If no PKCNT provided, Copy NCAP_AF if PRC_PKAF; Otherwise set default 1 - LOOP(TRACKPC(R,P,C),PRC_TS2(R,P,S)$((NOT SUM(RTP(R,V,P),NCAP_PKCNT(RTP,S)))$RCS(R,C,S)) = YES); - NCAP_PKCNT(RTP(R,V,P),S)$PRC_TS2(R,P,S) = 1$(NOT PRC_PKAF(R,P)) + - SUM(PRC_TS(R,P,TS)$RS_TREE(R,S,TS),SMAX(BD,NCAP_AF(RTP,TS,BD))*(1+(G_YRFR(R,TS)/G_YRFR(R,S)-1)$RS_BELOW(R,S,TS)))$PRC_PKAF(R,P); + TRACKP(PRC_PKAF(RP))=NOT PRC_PKNO(RP); TRACKPC(PRC_PKNO(RP),C) = NO; + RPC_PKF(RPC(RP_FLO(R,P),C))$TRACKC(R,C) = EPS**1$TRACKP(R,P); +* If no PKCNT provided, copy NCAP_AF if PRC_PKAF; otherwise set default 1 + LOOP(TRACKPC(R,P,C),PRC_TS2(R,P,S)$((NOT SUM(RTP(R,V,P),NCAP_PKCNT(RTP,S)))$RCS(R,C,S)) = YES); + NCAP_PKCNT(RTP(R,V,P),S)$PRC_TS2(R,P,S) = 1$(NOT PRC_PKAF(R,P)) + + SUM(PRC_TS(R,P,TS)$RS_TREE(R,S,TS),SMAX(BD,NCAP_AF(RTP,TS,BD))*(1+(G_YRFR(R,TS)/G_YRFR(R,S)-1)$RS_BELOW(R,S,TS)))$PRC_PKAF(R,P); *----------------------------------------------------------------------------- * RPC_PKC indicator for peak contribution by capacity RPC_PKC(TRACKPC(RPC_ACT(TRACKP(RP_STD),C)))=YES; diff --git a/pp_prelv.vda b/pp_prelv.vda index fd281b5..57ac323 100644 --- a/pp_prelv.vda +++ b/pp_prelv.vda @@ -1,11 +1,11 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *=============================================================================* * pp_prelvl.vda - Auxiliary preprocessing before levelizing *=============================================================================* -* To be called AFTER establishing RTCS_VARC and RPCS_VAR. +* Called AFTER establishing RTCS_VARC and RPCS_VAR. *----------------------------------------------------------------------------- * Restore NCAP_TLIFE for RESID LOOP(PYR_S(V),NCAP_TLIFE(R,V,P)$PRC_RESID(R,'%DFLBL%',P) = PRC_RESID(R,'%DFLBL%',P)); @@ -74,7 +74,8 @@ $IFI %SHELL%==ANSWER PRC_ACTFLO(R,LL,P,C)$((NOT KEEP_FLOF(R,P,C))$TRACKPC(R,P,C) RPC_EMIS(R,P,C)$SUM(RPCC_FFUNC(R,P,COM,C),1) = NO; * Add groups of source commodities FSCK(RP_CGC(R,P,CG,COM),C)$(COM_GMAP(R,CG,C)$RPC(R,P,C)) = YES; - LOOP(FSCK(R,P,CG,COM,C), FLO_SUM(R,V,P,COM,C,COM,S) $= FLO_EMIS(R,V,P,CG,COM,S); RPC_EMIS(R,P,COM) = NO); + LOOP(FSCK(R,P,CG,COM,C), FLO_SUM(R,V,P,COM,C,COM,S) $= FLO_EMIS(R,V,P,CG,COM,S)); + RPC_EMIS(R,P,COM)$SUM(FSCK(R,P,CG,COM,C),1) = NO; * Add activity sources FLO_SUM(RTP(R,V,P),COM,C,COM,S)$(RPC_PG(R,P,C)$RP_CGC(R,P,%PGPRIM%,COM)) = FLO_EMIS(RTP,%PGPRIM%,COM,S)/PRC_ACTFLO(RTP,C); RP_CGC(R,P,%PGPRIM%,C) = NO; PUTGRP=0; diff --git a/pp_qack.mod b/pp_qack.mod index e8a1148..3059505 100644 --- a/pp_qack.mod +++ b/pp_qack.mod @@ -1,5 +1,5 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *=============================================================================* @@ -220,12 +220,21 @@ $ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'IRE Process with invalid Paramet IF(Z = 3, PUT QLOG ' WARNING - IRE with FLO_SHAR: R=',%RL%,' P=',%PL%,' C=',CG.TL); IF(Z = 4, PUT QLOG ' WARNING - IRE with ACT_EFF: R=',%RL%,' P=',%PL%,' CG=',CG.TL); ); - OPTION CLEAR=UNCD7; - UNCD7(UC_N,SIDE--ORD(SIDE),R,LL--ORD(LL),P,C,S--ORD(S)) $= UC_FLO(UC_N,SIDE,R,LL,P,C,S)$RP_IRE(R,P); - LOOP(UNCD7(UC_N,SIDE,R,LL,P,C,S), + OPTION CLEAR=RXX; + LOOP(UC_QAFLO('1',UCN,SIDE,R,P,C)$(NOT UC_CAPFLO(UCN,SIDE,R,P,C)),RXX(R,P,UCN)=YES); + LOOP(RXX(R,P,UC_N), $ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'IRE Process with invalid Parameters' PUT QLOG ' WARNING - IRE with UC_FLO: R=',%RL%,' P=',%PL%,' UC_N=',UC_N.TL; ); + OPTION CLEAR=RXX; PUTGRP=0; + LOOP(PRC_MAP(R,'IRE',P)$(RP(R,P)$(NOT RP_IRE(R,P))), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 09 'Standard Flow Process with invalid Attributes' + PUT QLOG ' SEVERE ERROR - Process Group is IRE: R=',%RL%,' P=',%PL%; + ); + LOOP(UC_QAFLO('2',UC_N,SIDE,RPC(R,P,C)), +$ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'Standard Flow Process with invalid Parameters' + PUT QLOG ' WARNING - FLO flow with UC_IRE: R=',%RL%,' P=',%PL%,' C=',%CL%,' UC_N=',UC_N.TL; + ); *----------------------------------------------------------------------------- PUTGRP = 0; * ACT_EFF quality tests diff --git a/pp_qafs.mod b/pp_qafs.mod index f8aec94..cd20f0b 100644 --- a/pp_qafs.mod +++ b/pp_qafs.mod @@ -1,5 +1,5 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *============================================================================= @@ -10,7 +10,6 @@ SET RTP_CG(R,ALLYEAR,P,CG,IO) //; SET RTP_GRP(R,ALLYEAR,P,CG,IO) //; SET RP_GIC(R,P,CG,IO,C) //; - SET RPG_RED(R,P,CG,IO) //; *----------------------------------------------------------------------------- * Collect the Groups involved OPTION RP_CCG <= FLO_SHAR; PUTGRP=0; diff --git a/ppmain.mod b/ppmain.mod index f3cee43..2b2eec7 100644 --- a/ppmain.mod +++ b/ppmain.mod @@ -41,12 +41,14 @@ $ IF WARNINGS $BATINCLUDE pp_qaput.%1 PUTOUT 0 * 'GAMS Warnings Detected%TMP%' * establish initial primary looping control sets indicating what region/process/commodities *----------------------------------------------------------------------------- * process/commodities in each region, including inter-regional exchanges + PRC_ACTUNT(R,P,%PGPRIM%,UNITS_ACT) = NO; OPTION RPC_AIRE < TOP_IRE; RPC_IRE(RPC_AIRE,'IMP') = YES; OPTION RPC_AIRE <= TOP_IRE; RPC_IRE(RPC_AIRE,'EXP') = YES; - OPTION CLEAR=RPC_AIRE; + OPTION CLEAR=RPC_AIRE, PRC_ACT < PRC_ACTUNT; RP_IRE(ALL_R,P)$SUM(RPC_IRE(ALL_R,P,C,IE),1) = YES; TOP(RP_IRE(R,P),C,'IN')$RPC_IRE(R,P,C,'EXP') = NO; TOP(RP_IRE(R,P),C,'OUT')$RPC_IRE(R,P,C,'IMP') = NO; + TOP(RPG_RED(PRC_ACT(R,P),C,IO))$(COM_TMAP(R,'ENV',C)+RP_IRE(R,P)) = YES; * process/commodities in each region RPC(R,P,C)$(SUM(TOP(R,P,C,IO),1) + SUM(RPC_IRE(R,P,C,IE),1)) = YES; RC(R,C)$SUM(RPC(R,P,C),1) = YES; @@ -54,8 +56,8 @@ $ IF WARNINGS $BATINCLUDE pp_qaput.%1 PUTOUT 0 * 'GAMS Warnings Detected%TMP%' RP_FLO(RP)$(NOT RP_IRE(RP)) = YES; * establish PCG, checking for missing ones - PRC_ACTUNT(R,P,%PGPRIM%,UNITS_ACT) = NO; - OPTION RP_PG < PRC_ACTUNT; PRC_ACT(RP)$(NOT SUM(RP_PG(RP,CG),1))=YES; + OPTION RP_PG < PRC_ACTUNT, CLEAR=RPG_RED, CLEAR=PRC_ACT; + PRC_ACT(RP)$(NOT SUM(RP_PG(RP,CG),1))=YES; IF(CARD(PRC_ACT), TRACKPC(PRC_ACT(R,P),C)$((NOT COM_TMAP(R,'ENV',C)+COM_TMAP(R,'FIN',C))$TOP(R,P,C,'OUT'))=YES; PRC_ACT(RP)$(SUM(TRACKPC(RP,C),1) NE 1)=NO; RP_PG(TRACKPC(PRC_ACT,C))=YES; @@ -145,7 +147,7 @@ $IFI %OBJ%==MOD M(T) = 0; IF(ALTOBJ=1,ALTOBJ=1$SUM(T,M(T) NE YEARVAL(T))); * establish 1st/last run year - MIYR_1(MILESTONYR)$(ORD(MILESTONYR) = 1) = YES; + MIYR_1(T)$(ORD(T) = 1) = YES; IF(ALTOBJ, * If alternate objective, set B and E, D and M: E(T(TT-1)) = FLOOR((YEARVAL(T)+YEARVAL(TT))/2); B(T(TT+1)) = E(TT)+1; @@ -154,7 +156,7 @@ $IFI %OBJ%==MOD M(T) = 0; D(T)=E(T)-B(T)+1; M(T) = YEARVAL(T)); *V0.5c 980904 - set 1st value to B not milestone itself MIYR_V1 = SMIN(MIYR_1, B(MIYR_1)); - MIYR_VL = SMAX(MILESTONYR$(ORD(MILESTONYR) = CARD(MILESTONYR)), E(MILESTONYR)); + MIYR_VL = SMAX(T$(ORD(T) = CARD(T)), E(T)); $IFI '%OBLONG%'==YES IF(MIYR_V1+SUM(T,E(T)+1-B(T))-MIYR_VL NE 1,ABORT "Inconsistent periods - cannot use OBLONG."); LOOP(MIYR_1(LL),PASTYEAR(LL-(YEARVAL(LL)-MIYR_V1+1)) = YES); * Set LEADs and LAGs for periods @@ -481,7 +483,7 @@ $ BATINCLUDE pp_qaput.%1 PUTOUT PUTGRP 01 'NCAP_TLIFE out of feasible range SET PRC_RCAP //; PARAMETER PRC_REFIT //; PRC_REFIT(R,P,PRC)$PRC_REFIT(R,P,PRC)=MAX(ABS(ROUND(PRC_REFIT(R,P,PRC))),MIN(6,ABS(MAX(ROUND(PRC_REFIT(R,P,P)),-1)*2)))*MOD(ROUND(PRC_REFIT(R,P,PRC)),2); LOOP((RP(R,PRC),P)$PRC_REFIT(RP,P),IF(NOT PRC_RCAP(RP),RTP_OFF(R,T,P)=YES); - IF(PRC_REFIT(RP,P)<-4,NCAP_ELIFE(RTP(R,T,P))$(NCAP_ELIFE(RTP)<1)=NCAP_TLIFE(RTP); + IF(PRC_REFIT(RP,P)<-4,NCAP_ELIFE(RTP(R,T,P))$(NCAP_ELIFE(RTP)<1)=NCAP_TLIFE(RTP); NCAP_TLIFE(RTP(R,T,P))=MAX(NCAP_TLIFE(R,T,PRC)+NCAP_ILED(R,T,PRC)-1,NCAP_TLIFE(RTP)))); *----------------------------------------------------------------------------- @@ -1181,9 +1183,11 @@ $ BATINCLUDE prepxtra.mod UCINT * FLO / IRE / COM OPTION UC_MAP_FLO < UC_FLO; + UC_QAFLO('1',UC_MAP_FLO(UCN,SIDE,RP_IRE(R,P),C))=YES; UC_CAPFLO(UC_N,SIDE,R,P,C)$(NOT UC_MAP_FLO(UC_N,SIDE,R,P,C)) = NO; UC_MAP_FLO(UC_N,SIDE,RP_IRE,C) = NO; OPTION UC_MAP_IRE < UC_IRE; + UC_QAFLO('2',UCN,'LHS',RP_FLO,C)$=SUM(UC_MAP_IRE(UCN,RP_FLO,C,IE),1); UC_MAP_IRE(UC_N,R,P,C,IE)$(NOT RPC_IRE(R,P,C,IE)) = NO; OPTION UC_GMAP_C < UC_COM; UC_ATTR(R,UCN,SIDE,UC_GRPTYPE,UC_DYNT)$UC_ATTR(R,UCN,SIDE,'COMCON',UC_DYNT)$=SUM(UC_GMAP_C(R,UCN,COM_VAR,C,'COMCON')$COV_MAP(COM_VAR,UC_GRPTYPE),1); diff --git a/setglobs.gms b/setglobs.gms index d1162e5..6eb849d 100644 --- a/setglobs.gms +++ b/setglobs.gms @@ -1,5 +1,5 @@ *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP) +* 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). *========================================================================= @@ -118,6 +118,7 @@ $ LABEL SYSD SET UC_GMAP_P(REG,UC_N,UC_GRPTYPE,PRC) 'Assigning processes to UC_GRP'; SET UC_GMAP_U(ALL_R,UC_N,UC_N) 'Assigning constraints to UC_GRP' //; SET UC_DYNBND(UC_N,LIM) 'Dynamic process-wise UC bounds' //; + SET UC_QAFLO(J,UC_N,SIDE,R,P,C) 'QA_checks for UC FLO/IRE tuples' SET RC_CUMCOM(REG,COM_VAR,ALLYEAR,ALLYEAR,COM) 'Cumulative commodity PRD/NET'; SET RPC_CUMFLO(REG,PRC,COM,ALLYEAR,ALLYEAR) 'Cumulative process flows'; @@ -143,6 +144,7 @@ $ LABEL SYSD SET BDLOX(BD) / LO, FX /; SET BDNEQ(BD) / LO, UP /; SET RP_PRC(R,P); + SET RPG_RED(R,P,CG,IO) //; SET RP_GRP(REG,PRC,CG); SET RP_CCG(REG,PRC,C,CG); SET RP_CGG(REG,PRC,C,CG,CG);