forked from etsap-TIMES/TIMES_model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coef_ext.vda
74 lines (74 loc) · 4.73 KB
/
coef_ext.vda
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
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright (C) 2000-2023 Energy Technology Systems Analysis Programme (ETSAP)
* This 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);