-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathppm_ext.mlf
92 lines (85 loc) · 4.89 KB
/
ppm_ext.mlf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP)
* This 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)));