forked from etsap-TIMES/TIMES_model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
atlearn.etl
140 lines (126 loc) · 6.25 KB
/
atlearn.etl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP)
* This 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 : ATLEARN.ETL
* Language : GAMS
* Programmer: Ad Seebregts, adaped by Gary Goldstein for TIMES
* Origin : 02-06-98
* Last edit : 07-27-01
* Warning :
* Purpose : Write specific LEARNing output to output file, resembling standard
* MARKAL analysis table output
* Location : TIMES directory
* Called : at the end of RPTMAIN.MOD
* Output : <case>.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));
*-----------------------------------------------------------------------------