Skip to content

Commit 0b38d80

Browse files
authored
Update to v4.7.7
1 parent 483dc13 commit 0b38d80

13 files changed

+129
-72
lines changed

Version.log

+24-1
Original file line numberDiff line numberDiff line change
@@ -2804,4 +2804,27 @@ preshape.gms : (3)
28042804
solve.stp : (3)
28052805
prepret.dsc : (3)
28062806
recurrin.stc : (3)
2807-
ppm_ext.ecb : (1)
2807+
ppm_ext.ecb : (1)
2808+
2809+
-----------------------------------------------------------------------------------------
2810+
TIMES Version 4.7.7
2811+
-----------------------------------------------------------------------------------------
2812+
Date: 27-Dec-2023 [AL]: Maintenance release
2813+
1) Fixed divide by zero issue in the ECB extension
2814+
2) Performance improvement for EQ_PEAK in large models
2815+
3) Added optional output attribute for process units
2816+
4) Cosmetic improvements
2817+
2818+
Modified files: (reason)
2819+
initsys.mod : Increased version number to 4.7.7
2820+
initmty.mod : (4)
2821+
units.def : (3)
2822+
setglobs.gms : (2)
2823+
pp_lvlpk.mod : (2)
2824+
pp_shapr.mod : (2)
2825+
pp_reduce.red : (2)
2826+
eqpeak.mod : (2)
2827+
cal_ire.mod : (2)
2828+
err_stat.mod : (4)
2829+
rpt_ext.ecb : (1)
2830+
solsetv.v3 : (3)

cal_ire.mod

+8-13
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,27 @@ $IF DEFINED RTP_FFCS $SET MX "(%SHFF%S(R,V,P,C,C%SOW%))*"
1717
*V0.9 022100 - handle the fact that called 2x for aux
1818
$SET IE '%3'
1919
$IF '%IE%'=='' $SET IE "'%1'"
20-
$IF '%1' == 'EXP'
21-
$IF '%2' == 'OUT' $GOTO AUXONLY
22-
$IF '%1' == 'IMP'
23-
$IF '%2' == 'IN' $GOTO AUXONLY
20+
$IF '%1%2' == 'EXPOUT' $GOTO AUXONLY
21+
$IF '%1%2' == 'IMPIN' $GOTO AUXONLY
2422
* actual exchange
25-
*V05c 980923 - check that commodity not just capacity related
2623
*V05c 981016 - change RTPCS_VARFs to ts
27-
SUM((RPC_IRE(%6R,P%7,C,'%1'),RTPCS_VARF(R,T,P,C,TS)),
24+
SUM((RPC_IRE(%6R,P%7,C,'%1'),RTPCS_VARF(R,T,P,C,TS))$RS_FR(R,S,TS),
2825
SUM(RTP_VINTYR(R,V,T,P),
2926
(%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)
3027
)%4
31-
) *
32-
RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))
28+
) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,C,S,TS))
3329
) +
3430

3531
$IF SET IREAUXBAL %IREAUXBAL% %2 %5
3632
$LABEL AUXONLY
37-
*V0.5b handle auxillary commodity flows too
38-
*** NOTE: assumes that attribute at the same level as the variable!!!
33+
*V0.5b handle auxiliary commodity flows too
34+
*** NOTE: assumes that attribute at the same level as the variable!!
3935
*V0.9 022100 - do IN/OUT explicitly
40-
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'),
36+
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)),
4137
IRE_FLOSUM(R,T,P,COM,TS,%IE%,C,'%2') *
4238
SUM(RTP_VINTYR(R,V,T,P), %MX%
4339
(%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)
4440
)%4
45-
) *
46-
RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS))
41+
) * RS_FR(R,S,TS)*(1+RTCS_FR(R,T,COM,S,TS))
4742
) +
4843
*$OFFLISTING

eqpeak.mod

+13-15
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
%EQ%_PEAK(%R_T%,CG2,RTS(SL)%SWT%)$(SUM(COM_GMAP(R,CG2,C)$RTC(R,T,C),1)$COM_PKTS(R,CG2,SL)) ..
1616

1717
SUM((COM_GMAP(R,CG2,C),COM_TS(R,C,S))$RS_FR(R,SL,S),
18-
RS_FR(R,SL,S) *
18+
RS_FR(R,SL,S) *
19+
* Apply maximum reserve among CG2 and C
20+
(1/(1+MAX(SUM(COM(CG2),COM_PKRSV(R,T,COM)),COM_PKRSV(R,T,C))))*COM_IE(R,T,C,S)*
1921

20-
(1/(1+MAX(SMAX(COM(CG2),COM_PKRSV(R,T,COM)),COM_PKRSV(R,T,C))))*COM_IE(R,T,C,S)*
21-
22-
(SUM(RPC_PKC(PRC_CAP(R,P),C), G_YRFR(R,S) * PRC_CAPACT(R,P) *
22+
(SUM(RPC_PKC(R,P,C), G_YRFR(R,S) * PRC_CAPACT(R,P) *
2323
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)*
2424
(%VARV%_NCAP(R,V,P %SWS%)$MILESTONYR(V)+NCAP_PASTI(R,V,P)$PASTYEAR(V) %RCAPSUB%))
25-
) +
25+
) +
2626

2727
*
2828
* production
@@ -34,9 +34,8 @@ $ BATINCLUDE cal_ire.%1 EXP IN IE '*(-NCAP_PKCNT(R,V,P,S)/COM_IE(R,T,C,S))$
3434
(
3535

3636
*GG*PK no multiplier
37-
*[UR] 25.04.2003 added NCAP_PKCNT multiplier to turn off contribution by setting NCAP_PKCNT to zero
38-
*[AL] 25.01.2007 allow using PKNO to switch process to production-based peak contribution
39-
*[AL] When PKNO=YES no default PKCNT is assigned -> process contributes only if PKCNT set by user
37+
* [UR] 25.04.2003 added NCAP_PKCNT multiplier to turn off contribution by setting NCAP_PKCNT to zero
38+
* allow using PKNO to switch process to production-based peak contribution (contributes only if PKCNT set by user)
4039

4140
* storage
4241
$ 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)'
@@ -54,27 +53,26 @@ $IF SET PEAKCHP $BATINCLUDE %PEAKCHP%
5453

5554
SUM((COM_GMAP(R,CG2,C),COM_TS(R,C,S))$RS_FR(R,SL,S),
5655
RS_FR(R,SL,S) *
57-
* Apply the maximum of flexibilities among CG2 an C
56+
* Apply maximum flexibility among CG2 and C
5857
(1+MAX(SUM(COM(CG2),COM_PKFLX(R,T,COM,SL)),COM_PKFLX(R,T,C,S)))*
5958
(
60-
(
6159
*
6260
* consumption
6361
*
6462
*GG*PK pass TS as timeslice
6563

6664
* individual flows
67-
$ BATINCLUDE cal_fflo.%1 IN I '*FLO_PKCOI(R,T,P,C,TS)'
65+
$ BATINCLUDE cal_fflo.%1 IN I '*FLO_PKCOI(R,T,P,C,TS)'
6866

6967
* inter-regional trade from region
70-
$ BATINCLUDE cal_ire.%1 EXP IN IE '*FLO_PKCOI(R,T,P,C,TS)' -
68+
$ BATINCLUDE cal_ire.%1 EXP IN IE '*FLO_PKCOI(R,T,P,C,TS)' -
7169

7270
* capacity related commodity flows
7371
* fixed commodity associated with installed capacity or investment
74-
$ BATINCLUDE cal_cap.%1 IN I '1$(NOT PRC_PKNO(R,P))*'
75-
) +
72+
$ BATINCLUDE cal_cap.%1 IN I '1$(NOT PRC_PKNO(R,P))*'
73+
+
7674
* storage
77-
$ 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))"
75+
$ 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))"
7876

7977
* blending
8078
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%)) +

err_stat.mod

+8-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ SET SOLVESTAT(J) /
2929
8 "Integer solution"
3030
9 "Intermediate non-integer"
3131
10 "Integer infeasible"
32+
11 "Lic problem"
3233
12 "Error unknown"
3334
13 "Error no solution"
35+
14 "No solution returned"
36+
15 "Solved unique"
37+
16 "Solved locally unique"
38+
17 "Solved singular"
39+
18 "Unbnd no solution"
40+
19 "Infes no solution"
3441
/;
3542
FILE SCREEN / '' /;
3643
FILE END_GAMS / %TMP% /;
@@ -46,7 +53,7 @@ $IF NOT ERRORFREE $ECHO %3%5 > %TMP%
4653
$GOTO DONE
4754

4855
$LABEL SOLVE
49-
Z = MIN(14,%MODEL_NAME%.MODELSTAT)-1; IF(Z > 12, Z=11);
56+
Z = MIN(14,%MODEL_NAME%.MODELSTAT)-1; IF(Z > 18, Z=11);
5057
IF(Z>=0,PUT SCREEN /"--- TIMES Solve status: ";
5158
LOOP(SAMEAS(J,'1'), PUT SOLVESTAT.TE(J+Z));
5259
PUTCLOSE;

initmty.mod

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - consider PRC_MAP(PRC_GRP,PRC_SUBGRP,PRC) where PRC_SUBGRP = PRC_RSOURC + any user-provided sub-groupings
1414
* - SOW/COM/PRC/CUR master sets (merged) == entire list, that is not REG
1515
* - lists (eg, DEM_SECT) for _MAP sets not REG (but individual mappings are)
16-
* - HAVE THE USER *.SET/DD files OMIT the declarations to ease maintenance changes
16+
* - HAVE THE USER *.DD files OMIT the declarations to ease maintenance changes
1717
*-----------------------------------------------------------------------------
1818
* Version control
1919
$IF NOT FUNTYPE rpower $ABORT TIMES Version 4.0 and above Requires GAMS 22.0 or above!
@@ -23,6 +23,7 @@ $IF gamsversion 230 $SETGLOBAL OBMAC YES
2323
$IF gamsversion 236 $SETGLOBAL G2X6 YES
2424
$LABEL DECL
2525
$ONEMPTY
26+
2627
*-----------------------------------------------------------------------------
2728
* SET SECTION
2829
*-----------------------------------------------------------------------------
@@ -455,7 +456,7 @@ $IF %PGPRIM%==ACT $SETGLOBAL RETIRE 'YES' SETGLOBAL DSCAUTO Yes
455456
$IFI %DSC%==YES $KILL RCAP_BLK
456457
457458
* Initialize list of standard extensions to be loaded
458-
$SETGLOBAL EXTEND
459+
$SET VDA 'YES' SETGLOBAL EXTEND
459460
460461
* Add recognized extensions if defined
461462
$IFI '%ECB%'==YES $SETGLOBAL EXTEND '%EXTEND% ECB'
@@ -473,7 +474,7 @@ $IFI '%MCA%' == YES $SETGLOBAL EXTEND '%EXTEND% MCA'
473474
$SETGLOBAL EXTEND %EXTEND% %1 %2 %3 %4 %5 %6
474475
475476
* Load all extension declarations
476-
$IF NOT '%EXTEND%' == '' $BATINCLUDE main_ext.mod initmty %EXTEND%
477+
$BATINCLUDE main_ext.mod initmty %EXTEND%
477478
478479
$IF ERRORFREE
479480
$BATINCLUDE err_stat.mod '$IF NOT ERRORFREE' ABORT 'Errors in Compile' 'VARIABLE OBJz' ': Required _TIMES.g00 Restart File Missing'

initsys.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$TITLE TIMES -- VERSION 4.7.6
1+
$TITLE TIMES -- VERSION 4.7.7
22
*==========================================================================================*
33
* INITSYS.MOD has all the fixed system declarations for ETSAP TIMES *
44
*==========================================================================================*

pp_lvlpk.mod

+14-13
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,27 @@
99
* Questions/Comments:
1010
* -
1111
*-----------------------------------------------------------------------------
12-
SET RPC_PKC(R,P,C);
13-
PARAMETER RPC_PKF(R,P,C) //;
12+
SET RPC_PKC(R,P,C);
13+
PARAMETER RPC_PKF(R,P,C) //;
1414
*-----------------------------------------------------------------------------
1515
* Collect PKTS for all COM_PEAK commodities
16-
LOOP(COM_PKTS(R,CG,S), RCS(COM_TS(R,C,TS))$(RS_TREE(R,S,TS)$COM_GMAP(R,CG,C)) = YES);
17-
TRACKC(R,C) $= SUM(RCS(R,C,S),1);
16+
LOOP(COM_PKTS(R,CG,S), RCS(COM_TS(R,C,TS))$(RS_TREE(R,S,TS)$COM_GMAP(R,CG,C)) = YES);
17+
TRACKC(R,C) $= SUM(RCS(R,C,S),1);
1818
*-----------------------------------------------------------------------------
1919
* Levelization of NCAP_PKCNT
20-
LOOP((RTP(R,V,P),S)$NCAP_PKCNT(R,V,P,S),
21-
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);
20+
OPTION RTP_ISHPR < NCAP_PKCNT;
21+
TRACKPC(RPC(R,P,C))$((TOP(RPC,'OUT')+RPC_IRE(RPC,'IMP')+PRC_PKNO(R,P))$TRACKC(R,C)) = YES;
22+
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;
23+
FLO_PKCOI(RTP(R,T,P),C,S)$(TRACKPC(R,P,C)$PRC_PKNO(R,P)) = 0;
2224
*-----------------------------------------------------------------------------
2325
* Aggregation/inheritance to target timeslices
2426
*-----------------------------------------------------------------------------
25-
LOOP(RTP_GRP(R,V,P,C,IO), TS_ARRAY(S) = NCAP_PKCNT(R,V,P,S);
26-
IF((NOT SUM(RS_BELOW(R,'ANNUAL',S)$TS_ARRAY(S),1))$TS_ARRAY('ANNUAL'),
27-
NCAP_PKCNT(R,V,P,S)$RCS(R,C,S) = TS_ARRAY('ANNUAL');
28-
ELSE
27+
LOOP(RTP_GRP(R,V,P,C,IO), TS_ARRAY(S) = NCAP_PKCNT(R,V,P,S);
28+
F = TS_ARRAY('ANNUAL');
29+
IF((NOT SUM(RS_BELOW(R,ANNUAL,S)$TS_ARRAY(S),1))$F,NCAP_PKCNT(R,V,P,S)$RCS(R,C,S) = F;
30+
ELSE
2931
* Set leveling default = %1;
30-
TS_ARRAY('ANNUAL')$(NOT TS_ARRAY('ANNUAL')) = %1;
32+
IF(NOT F,TS_ARRAY(ANNUAL) = %1);
3133
* Simultaneous inheritance/aggregation; but only if target level value is not present
3234
LOOP(RCS(R,C,TS)$(NOT TS_ARRAY(TS)),
3335
NCAP_PKCNT(R,V,P,TS) $=
@@ -36,7 +38,6 @@ LOOP(RTP_GRP(R,V,P,C,IO), TS_ARRAY(S) = NCAP_PKCNT(R,V,P,S);
3638
TS_ARRAY(ALL_TS)))))));
3739
*-----------------------------------------------------------------------------
3840
* Peak contribution
39-
TRACKPC(R,P,C)$((TOP(R,P,C,'OUT')+RPC_IRE(R,P,C,'IMP'))$TRACKC(R,C)) = YES;
4041
* If PRC_PKAF, apply PKCNT only for capacity
4142
TRACKP(PRC_PKAF(RP))=NOT PRC_PKNO(RP); RPC_PKF(TRACKPC(RP,C))=EPS**1$TRACKP(RP);
4243
TRACKPC(PRC_PKNO(RP),C)=NO;
@@ -50,4 +51,4 @@ LOOP(RTP_GRP(R,V,P,C,IO), TS_ARRAY(S) = NCAP_PKCNT(R,V,P,S);
5051
TRACKPC(RP,C)$(NOT RPC_PG(RP,C)*RP_FLO(RP))=NO;
5152
RPC_PKC(TRACKPC(RP_PGACT(RP),C))$(RP_PG(RP,C)+TRACKP(RP))=YES;
5253
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);
53-
OPTION CLEAR=TRACKP,CLEAR=TRACKC,CLEAR=TRACKPC,CLEAR=RTP_GRP,CLEAR=RCS,CLEAR=PRC_TS2;
54+
OPTION CLEAR=TRACKP,CLEAR=TRACKC,CLEAR=TRACKPC,CLEAR=RTP_GRP,CLEAR=RCS,CLEAR=RTP_ISHPR,CLEAR=PRC_TS2;

pp_reduce.red

+2-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ $LABEL REDDONE
177177
LOOP(FS_EMIS(R,P,CG,C,COM), RPCC_FFUNC(R,P,CG,COM) = YES);
178178
OPTION CLEAR=TRACKPC,CLEAR=FSCK;
179179
PRC_TS2(PRC_TS(RP_PGACT(RP_STD),S)) = YES;
180-
RPC_PKF(RPC_PKC(PRC_CAP,C)) = 0;
180+
RPC_PKC(RP,C)$(NOT PRC_CAP(RP)) = NO;
181+
RPC_PKF(RPC_PKC) = 0;
181182

182183
* Remove timeslices turned off if DYNTS enabled
183184
$IF NOT %RTS%==S $BATINCLUDE dynslite.vda REDUCE

pp_shapr.mod

+15-17
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,24 @@
1212
*=============================================================================*
1313
*AL Comments:
1414
*-----------------------------------------------------------------------------
15+
SET RTP_SHAPI(REG,ALLYEAR,PRC,BD,J,J,LL,LL);
16+
$ SETLOCAL PASS %3
17+
$ IF %3=='' $SETLOCAL PASS YES
1518

16-
SET RTP_SHAPI(REG,ALLYEAR,PRC,BD,J,J,LL,LL);
17-
SET RTP_ISHPR(REG,ALLYEAR,PRC) //;
18-
$SETLOCAL PASS %3
19-
$IF %3 == '' $SETLOCAL PASS YES
20-
21-
LOOP(BD,RTP_ISHPR(RTP(R,V,P))$((%1%6X(RTP,BD) GE 1.5)$%1%6X(RTP,BD)) = YES);
22-
RTP_ISHPR(RTP(R,V,P))$((%5 GE 1.5)$%5) = YES;
19+
LOOP(BD,RTP_ISHPR(RTP(R,V,P))$((%1%6X(RTP,BD) GE 1.5)$%1%6X(RTP,BD)) = YES);
20+
RTP_ISHPR(RTP(R,V,P))$((%5 GE 1.5)$%5) = YES;
2321

2422
* Prepare for start and end years
25-
OPTION CLEAR=FIL2; FIL2(V) = B(V)-YEARVAL(V);
26-
PASTSUM(RTP_ISHPR(R,V,P)) = FIL2(V)+NCAP_ILED(R,V,P)+NCAP_TLIFE(R,V,P)-1;
23+
OPTION CLEAR=FIL2; FIL2(V) = B(V)-YEARVAL(V);
24+
PASTSUM(RTP_ISHPR(R,V,P)) = FIL2(V)+NCAP_ILED(R,V,P)+NCAP_TLIFE(R,V,P)-1;
2725

2826
* Shape attributes only for processes around for > 1 period
29-
%1%6X(RTP_ISHPR(R,V,P),BD)$(PASTSUM(R,V,P)-FIL2(V)+1 < D(V)) = 0;
27+
%1%6X(RTP_ISHPR(R,V,P),BD)$(PASTSUM(R,V,P)-FIL2(V)+1 < D(V)) = 0;
3028

3129
* Get hold of the shape and multi index J,JJ for each RVP, as well as start and end years
32-
LOOP(SAMEAS(J,'1'),
33-
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;
34-
);
30+
LOOP(SAMEAS(J,'1'),
31+
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;
32+
);
3533

3634
LOOP(SAMEAS(AGE,'1'),
3735
* Calculate average SHAPE for plants still operating in each period:
@@ -41,8 +39,8 @@ LOOP(SAMEAS(J,'1'),
4139
SHAPE(J,AGE+(MIN(YEARVAL(EOHYEARS),YEARVAL(YEAR))-YEARVAL(LL)))) /
4240
(MAX(1,MIN(E(T),YEARVAL(YEAR))-MAX(B(T),YEARVAL(LL))+1))));
4341

44-
* If no shape index is pecified, set the BASE value for the attribute
45-
RTP_ISHPR(RTP(R,V,P)) = (NOT RTP_ISHPR(R,V,P));
46-
%4$(RTP_ISHPR(R,V,P)$(%PASS%)) = %1%2;
42+
* If no shape index is specified, set the BASE value for the attribute
43+
RTP_ISHPR(RTP(R,V,P)) = (NOT RTP_ISHPR(RTP));
44+
%4$(RTP_ISHPR(R,V,P)$(%PASS%)) = %1%2;
4745
* Clear the temporary sets
48-
OPTION CLEAR=RTP_SHAPI,CLEAR=RTP_ISHPR,CLEAR=PASTSUM;
46+
OPTION CLEAR=RTP_SHAPI,CLEAR=RTP_ISHPR,CLEAR=PASTSUM;

rpt_ext.ecb

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ $ IF NOT DEFINED RTC_MS $EXIT
1818
PASTSUM(NCAP_YES(RVP(R,V,P))) =
1919
(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) +
2020
(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));
21+
PASTSUM(RVP)$((PASTSUM(RVP)=0)$PASTSUM(RVP)) = 0;
2122
* Calculate INV unit cost annuity and intangibles
2223
COEF_RTP(RVP(R,T,P)) =
2324
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))));
@@ -41,7 +42,7 @@ $ IF NOT DEFINED RTC_MS $EXIT
4142
* Adjust shares, normalize, and get sum over cutoff
4243
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);
4344
F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P));
44-
PRC_YMIN(R,P)$PRC_YMIN(R,P)=(PRC_YMIN(R,P)/F)$(PRC_YMIN(R,P)/F>.01);
45+
PRC_YMIN(R,P)$PRC_YMIN(R,P)=(PRC_YMIN(R,P)/F)$(PRC_YMIN(R,P)/F>.005);
4546
F = SUM(P$PRC_YMIN(R,P),PRC_YMIN(R,P))*.9999;
4647
* Get MY_F = Max share, and Z = sum of differences from max
4748
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));

setglobs.gms

+3-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ $ LABEL SYSD
7777
SET RPC_MARKET(R,P,C,IE) 'Market exchange process indicator' //;
7878
SET RPC_PG(R,P,C) 'Commodities in the primary group' //;
7979
SET RPC_SPG(R,P,C) 'Commodities in the shadow primary group'//;
80-
SET RPCS_VAR(R,P,C,ALL_TS) 'The timeslices at which VAR_FLOs are to be created'//;
80+
SET RPCS_VAR(R,P,C,ALL_TS) 'Timeslices at which VAR_FLOs are to be created'//;
8181
SET RPS_S1(R,P,ALL_TS) 'All timeslices at the PRC_TSL/COM_TSLspg'//;
8282
SET RPS_S2(R,P,ALL_TS) 'All timeslices at/above PRC_TSL/COM_TSLspg'//;
8383
SET RPS_PRCTS(R,P,ALL_TS) 'All timeslices at/above the PRC_TSL' //;
@@ -91,10 +91,11 @@ $ LABEL SYSD
9191
SET RTPCS_VARF(ALL_REG,ALLYEAR,P,C,ALL_TS) 'The VAR_FLOs control set' //;
9292
SET RTP_VARA(R,ALLYEAR,P) 'The VAR_ACT control set' //;
9393
SET RTP_VARP(R,T,P) 'RTPs that have a VAR_CAP' //;
94-
SET RTP_VINTYR(ALL_REG,ALLYEAR,ALLYEAR,PRC) 'v/t years when vintaging involved'//;
94+
SET RTP_VINTYR(REG,ALLYEAR,ALLYEAR,PRC) 'v/t years according to vintaging'//;
9595
SET RTP_TT(R,YEAR,T,PRC) 'Retrofit control periods' //;
9696
SET RVP(R,ALLYEAR,P) 'ALIAS(RTP) for Process/time' //;
9797
SET RTP_CAPYR(R,YEAR,YEAR,P) 'Capacity vintage years' //;
98+
SET RTP_ISHPR(REG,ALLYEAR,PRC)'Attribute existence indicator' //;
9899
SET RTP_CGC(REG,YEAR,P,CG,CG) 'Multi-purpose work set' //;
99100
SET RTPS_BD(R,ALLYEAR,P,S,BD) 'Multi-purpose work set' //;
100101
SET CG_GRP(REG,PRC,CG,CG) 'Multi-purpose work set' //;

solsetv.v3

+11-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,17 @@ SETS
173173
REG_ACT(NONSET,%PGPRIM%) = YES;
174174
OTHCOM(CG) $= SUM(COM_PEAK(R,CG),1);
175175
OTHCOM(CUR) $= SUM(RDCUR(R,CUR),1);
176-
176+
*---------------------------------------------------------------------
177+
$ IFI NOT %PUNITS%==YES $EXIT
178+
SET PRC_UNITS(R,P,UC_GRPTYPE,UNITS);
179+
* Add default capacity unit and conversion if missing
180+
G_UNCA(UNITS_ACT,UNITS_ACT)$(NOT SUM(UNITS$(G_UNCA(UNITS,UNITS_ACT)=1),1)) = 1;
181+
PRC_UNITS(RP,'ACT',UNITS_ACT)$SUM(PRC_ACTUNT(RP,CG,UNITS_ACT),1) = YES;
182+
LOOP(UNITS_ACT,
183+
PRC_UNITS(PRC_CAP(RP),'CAP',UNITS)$((ABS(G_UNCA(UNITS,UNITS_ACT)-PRC_CAPACT(RP))<PRC_CAPACT(RP)/1280)$G_UNCA(UNITS,UNITS_ACT)$PRC_UNITS(RP,'ACT',UNITS_ACT)) = YES);
184+
TRACKP(PRC_CAP(RP))$PROD(PRC_UNITS(RP,'CAP',UNITS),SUM(PRC_CAPUNT(RP,CG,UNITS_CAP),1)$PRC_UNITS(RP,'ACT',UNITS)) = YES;
185+
PRC_UNITS(TRACKP(RP),'CAP',UNITS) = SUM(PRC_CAPUNT(RP,CG,UNITS_CAP(UNITS)),1);
186+
OPTION CLEAR=TRACKP;
177187
$ EXIT
178188
*---------------------------------------------------------------------
179189
$ LABEL FINISHUP

0 commit comments

Comments
 (0)