Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theis Madsen improvements to master #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions base/addons/CCS/bb4/CCS_balbase4.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

$ifi not %OPTIFLOW%==yes $goto NO_OPTIFLOW_CO2_CONNECTION
$ifi not %baloptCCU%==yes $goto NO_OPTIFLOW_CO2_CONNECTION

QFLOWCO2LIM

$label NO_OPTIFLOW_CO2_CONNECTION
20 changes: 20 additions & 0 deletions base/addons/CCS/bb4/CCS_eqndecdef.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* CCS add-on. Added by Juan Gea Bermudez

* Thise file is a further development tying together captured carbon from the CCS addon to CO2 used in the OptiFlow addon.
* Made by Theis Madsen

$ifi not %OPTIFLOW%==yes $goto NO_OPTIFLOW
*$ifi not %baloptCCU%==yes $goto NO_OPTIFLOW_CO2_CONNECTION

EQUATION QFLOWCO2LIM(Y,AAA,PROCSOURCE,FLOW,S,T) "This equation limits the CO2 used in an OptiFlow production pathway by what is captured (ton/h)";

QFLOWCO2LIM(IY411,IA,PROCSOURCE,FLOW,S,T)$(ICO2(PROCSOURCE,FLOW)) ..
VFLOWSOURCE(IY411,IA,PROCSOURCE,FLOW,S,T)
=L=
$ifi %baloptCCU%==yes + SUM(G$(IAGK_HASORPOT(IY411,IA,G) AND IGPROC(PROCSOURCE,G)),(IM_CO2(G) + IM_CO2RE(G)) * IOF0001 * IOF3P6 * VGF_T(IY411,IA,G,S,T) * CCS_CO2CAPTEFF_G(G))
$ifi not %baloptCCU%==yes + EPS
;


$label NO_OPTIFLOW
*$label NO_OPTIFLOW_CO2_CONNECTION
3 changes: 2 additions & 1 deletion base/addons/CCS/bb4/CCS_qlimco2c.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* CCS add-on. Added by Juan Gea Bermudez

*Removing absorbed CO2
+SUM((IA,G)$(IAGK_HASORPOT(IY411,IA,G) AND ICA(C,IA) AND GROUP_AAA(GROUP,IA)), SUM((IS3,T), IHOURSINST(IS3,T)*IHOURFRAC * (IM_CO2(G) * IOF0001) * IOF3P6 * VGF_T(IY411,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G)))
+SUM((IA,G)$(IAGK_HASORPOT(IY411,IA,G) AND ICA(C,IA) AND GROUP_AAA(GROUP,IA)), SUM((IS3,T), IHOURSINST(IS3,T) * IHOURFRAC * (IM_CO2(G) + IM_CO2RE(G)) * IOF0001 * IOF3P6 * VGF_T(IY411,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G)))

3 changes: 2 additions & 1 deletion base/addons/CCS/bb4/CCS_qlimco2na.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* CCS add-on. Added by Juan Gea Bermudez

*Removing absorbed CO2
+SUM(C,SUM((IA,G)$(IAGK_HASORPOT(IY411,IA,G) AND ICA(C,IA) AND GROUP_AAA(GROUP,IA)), SUM((IS3,T), IHOURSINST(IS3,T) * (IM_CO2(G) * IOF0001) * IOF3P6 * VGF_T(IY411,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G))))
+SUM(C,SUM((IA,G)$(IAGK_HASORPOT(IY411,IA,G) AND ICA(C,IA) AND GROUP_AAA(GROUP,IA)), SUM((IS3,T), IHOURSINST(IS3,T) * IHOURFRAC * (IM_CO2(G) + IM_CO2RE(G)) * IOF0001 * IOF3P6 * VGF_T(IY411,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G))))

7 changes: 5 additions & 2 deletions base/addons/CCS/bb4/CCS_qobj.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
* Additions to the objective function:


- SUM((C,GROUP), SUM((IA,G)$(ICA(C,IA) AND IAGK_HASORPOT(Y,IA,G) AND CCS_G(G) AND GROUP_AAA(GROUP,IA)), SUM((IS3,T), IHOURSINST(IS3,T) * (IM_CO2(G)*IOF0001) * IOF3P6 * VGF_T(Y,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G)) * EMI_POL(Y,C,GROUP,"TAX_CO2")*IHOURFRAC))
- SUM((C,GROUP), SUM((IA,G)$(ICA(C,IA) AND IAGK_HASORPOT(Y,IA,G) AND CCS_G(G) AND GROUP_AAA(GROUP,IA)), SUM((IS3,T), IHOURSINST(IS3,T) * IM_CO2(G) * IOF0001 * IOF3P6 * VGF_T(Y,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G)) * EMI_POL(Y,C,GROUP,"TAX_CO2")*IHOURFRAC))

*Transportation and storage costs
+ SUM(C, SUM((IA,G)$(ICA(C,IA) AND IAGK_HASORPOT(Y,IA,G) AND CCS_G(G)), SUM((IS3,T), IHOURSINST(IS3,T) * (IM_CO2(G)*IHOURFRAC*IOF0001) * IOF3P6 * VGF_T(Y,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G)) *CCS_TRANSPORTCOST ))
*(Right now only what is stored finally - think about how the CCU carbon is priced. Here, or in OptiFlow?)
+ SUM(C, SUM((IA,G)$(ICA(C,IA) AND IAGK_HASORPOT(Y,IA,G) AND CCS_G(G)), SUM((IS3,T), IHOURSINST(IS3,T) * (IM_CO2(G) + IM_CO2RE(G))*IHOURFRAC*IOF0001 * IOF3P6 * VGF_T(Y,IA,G,IS3,T)*CCS_CO2CAPTEFF_G(G)) *CCS_TRANSPORTCOST))


1 change: 1 addition & 0 deletions base/addons/DECOM/DECOM_balbase4.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $ifi not %LIFETIME_DECOM_EXO_G%==yes $ifi not %ECONOMIC_DECOM_EXO_G%==yes $goto
QDECOM_EXO_LIM
QDECOM_EXO_ACCUM


$ifi not %LIFETIME_DECOM_EXO_G%==yes $ifi %ECONOMIC_DECOM_EXO_G%==yes $goto NO_DECOMMISSIONING_EXOGENOUS_GENERATION

QDECOM_EXO_ACCUM_REST
Expand Down
3 changes: 1 addition & 2 deletions base/addons/DECOM/DECOM_eqndecdef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ $ifi not %LIFETIME_DECOM_EXO_G%==yes $ifi not %ECONOMIC_DECOM_EXO_G%==yes $goto
EQUATION QDECOM_EXO_ACCUM(Y,AAA,G) 'Equation that calculates the accumulated endogenous decommissioning of exogenous technologies';
EQUATION QDECOM_EXO_LIM(Y,AAA,G) 'Equation limiting the yearly decommission of exogenous technologies';



QDECOM_EXO_ACCUM(IY411,IA,G)$IGDECOMEXOPOT(IY411,IA,G)..
VDECOM_EXO_ACCUM(IY411,IA,G)
=E=
Expand All @@ -51,6 +49,7 @@ QDECOM_EXO_LIM(IY411,IA,G)$IGDECOMEXOPOT(IY411,IA,G)..
GKFX(IY411,IA,G)
;


$ifi not %LIFETIME_DECOM_EXO_G%==yes $ifi %ECONOMIC_DECOM_EXO_G%==yes $goto NO_DECOMMISSIONING_EXOGENOUS_GENERATION
EQUATION QDECOM_EXO_ACCUM_REST(Y,AAA,G) 'Equation establishing the restriction on the minimum decommissionining of exogenous technologies';

Expand Down
8 changes: 5 additions & 3 deletions base/addons/DECOM/DECOM_ipardecdef.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Decommissioning introduced by Juan Gea Berm�dez 2018.
* Decommissioning introduced by Juan Gea Berm�dez 2018.


$ifi not %LIFETIME_DECOM_EXO_G%==yes $ifi not %ECONOMIC_DECOM_EXO_G%==yes $ifi not %NO_DECOM_EXO_G%==yes $goto DEFAULT_DECOMMISSIONING_EXOGENOUS_GENERATION
Expand All @@ -12,6 +12,9 @@ IDECOM_CHANGE(YYY,IA,G)=0;

ILOOPBREAK=0;

PARAMETER IGKFX_OG(YYY,AAA,G) 'The initial GKFX that isnt edited';
IGKFX_OG(YYY,IA,G) = GKFX(YYY,IA,G);

LOOP(YYY$(NOT(ORD(YYY) EQ 1) AND (YYY.VAL GT GDECOMEXOPOTSTART)),
LOOP(IA,
LOOP(G$IGDECOM(G),
Expand Down Expand Up @@ -89,5 +92,4 @@ LOOP(IGKFIND,
);
);
);
);

);
2 changes: 1 addition & 1 deletion base/addons/_hooks/annuitycgadditions.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* Location of ANNUITYCG additions used in add-ons

$ifi %HYDROGEN%==yes $include "../../base/addons/hydrogen/bb4/hydrogen_annuitycgadditions.inc";
$ifi %HYDROGEN%==yes $include "../../base/addons/hydrogen/bb4/hydrogen_annuitycgadditions.inc";
1 change: 1 addition & 0 deletions base/addons/_hooks/balbase4.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ $ifi %ANC_SERV%==yes $include "../../base/addons/ancilliary_services/ancillia
$ifi %BalancingMarket%==yes $include "../../base/addons/balancing_market/balancing_market_balbase4.inc";
$ifi %INDIVUSERS%==yes $include "../../base/addons/indivusers/bb4/indivusers_balbase4.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_balbase4.inc";
$ifi %CCS%==yes $include "../../base/addons/CCS/bb4/CCS_balbase4.inc";

$label endoffile
1 change: 1 addition & 0 deletions base/addons/_hooks/eqndecdef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ $ifi %ANC_SERV%==yes $include "../../base/addons/ancilliary_services/ancillia
$ifi %BalancingMarket%==yes $include "../../base/addons/balancing_market/balancing_market_eqndecdef.inc";
$ifi %INDIVUSERS%==yes $include "../../base/addons/indivusers/bb4/indivusers_eqndecdef.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_eqndecdef.inc";
$ifi %CCS%==yes $include "../../base/addons/CCS/bb4/CCS_eqndecdef.inc";

$label endoffile
1 change: 1 addition & 0 deletions base/addons/_hooks/ipardecdef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $label beginbb4
$ifi %import_results%==yes $include "../../base/addons/import_results/import_results_ipardecdef.inc";

$ifi %HYDROGEN%==yes $include "../../base/addons/hydrogen/bb4/hydrogen_ipardecdef.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_ipardecdef.inc";
$ifi %UnitComm%==yes $include "../../base/addons/unitcommitment/bb4/uc_ipardecdef.inc";
$ifi %STEPWISE_RAMPING%==yes $include "../../base/addons/STEPWISE_RAMPING/stepwise_ramping_ipardecdef.inc";
$ifi %X3V%==yes $include "../../base/addons/x3v/bb4/x3v_ipardecdef.inc";
Expand Down
7 changes: 7 additions & 0 deletions base/addons/_hooks/qgmaxaf.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* Latest revision 20240423 (tmad)


$ifi %OPTIFLOW%==yes $ifi %baloptfuelbridge%==yes $include "../../base/addons/optiflow/bb4/optiflow_qgmaxaf.inc"


$label endoffile
7 changes: 7 additions & 0 deletions base/addons/_hooks/qgmaxcf.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* Latest revision 20240423 (tmad)


$ifi %OPTIFLOW%==yes $ifi %baloptfuelbridge%==yes $include "../../base/addons/optiflow/bb4/optiflow_qgmaxcf.inc"


$label endoffile
7 changes: 7 additions & 0 deletions base/addons/_hooks/qgmaxrf.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* Latest revision 20240423 (tmad)


$ifi %OPTIFLOW%==yes $ifi %baloptfuelbridge%==yes $include "../../base/addons/optiflow/bb4/optiflow_qgmaxrf.inc"


$label endoffile
2 changes: 1 addition & 1 deletion base/addons/_hooks/qhydrogen_eq.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


$ifi %TRANSPORT%==yes $include "../../base/addons/transport/bb4/transport_qhydrogen_eq.inc";

$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_qh2eq_region.inc"

$ifi %vqdebug%==yes $setglobal equation qhydrogen_eq
$ifi %vqdebug%==yes $include "../../base/addons/vqdebug/bb4/vqdebug_equations.inc";
Expand Down
1 change: 1 addition & 0 deletions base/addons/_hooks/qhydrogen_eq_area.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* Latest revision 20180418 (hr)

$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_qh2eq_area.inc"

$ifi %vqdebug%==yes $setglobal equation qhydrogen_eq_area
$ifi %vqdebug%==yes $include "../../base/addons/vqdebug/bb4/vqdebug_equations.inc";
Expand Down
2 changes: 1 addition & 1 deletion base/addons/_hooks/qlimco2c.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


$ifi %CCS%==yes $include "../../base/addons/CCS/bb4/CCS_qlimco2c.inc";

$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_qlimco2c.inc";



Expand Down
1 change: 1 addition & 0 deletions base/addons/_hooks/qlimco2na.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


$ifi %CCS%==yes $include "../../base/addons/CCS/bb4/CCS_qlimco2na.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_qlimco2na.inc";



Expand Down
1 change: 1 addition & 0 deletions base/addons/_hooks/varassign.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ $ifi %testbb1234%==yes $include "../../base/addons/bb1234compare/bb1234_varas
$ifi %DECOM%==yes $include "../../base/addons/DECOM/DECOM_varassign.inc";
$ifi %HEATTRANS%==yes $include "../../base/addons/heattrans/bb4/heattrans_varassign.inc";
$ifi %HYDROGEN%==yes $include "../../base/addons/hydrogen/bb4/hydrogen_varassign.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_varassign.inc";
$ifi %OFFSHOREGRID%==yes $include "../../base/addons/offshoregrid/bb4/offshoregrid_varassign.inc";
Binary file modified base/addons/optiflow/agkndisc/agkndisc20090331.pdf
Binary file not shown.
72 changes: 72 additions & 0 deletions base/addons/optiflow/bb4/optiflow_annuities.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
* OPTIFLOW ANNUITY CALCULATIONS

$ifi not %inv%==yes $goto NO_PROC_INVESTMENTS

SCALAR ILOOPBREAK "Scalar used as binary number to break any loop function";
PARAMETER IWEIGHTY(Y) "Relative weight of the individual years in Y";
* Set the relative weight of the individual years in Y.
* Two ideas implemented here. Used according to option bb4weighty.
* Simple idea is to give equal weights:
$ifi "%bb4weighty%"=="same" IWEIGHTY(Y) = 1;
* More complex weighting of the individual years (years in YYY but not in Y are shared between two nearest (first and last years double the shared weight contribution)):
$ifi "%bb4weighty%"=="shareYYY" IWEIGHTY(Y)$(ORD(Y) EQ 1) = 1$(CARD(Y) EQ 1) + ((YVALUE(Y+1)-YVALUE(Y)-1)+1)$(CARD(Y) GT 1);
$ifi "%bb4weighty%"=="shareYYY" IWEIGHTY(Y)$((ORD(Y) GT 1) AND (ORD(Y) LT CARD(Y))) = (YVALUE(Y) - YVALUE(Y-1) -1)/2 + (YVALUE(Y+1) - YVALUE(Y) -1)/2 +1;
$ifi "%bb4weighty%"=="shareYYY" IWEIGHTY(Y)$((ORD(Y) EQ CARD(Y)) AND (CARD(Y) GT 1)) = ((YVALUE(Y)-YVALUE(Y-1)-1)+1);

* HERE COMES SOME ANNUITY RELATED PARAMETERS, THE INTENTION IS TO MAKE ANNUITY PAYMENST WORK FOR OPTIFLOW
* SO THAT PREVIOUS YEAR INVESTMENTS WILL BE PAID LATER
PARAMETER IYHASANNUITYPROC(Y,Y,PROC) "Binary parameter to establish whether the annuity of an investment of a process made in Y (first index) should be paid in the time period Y (second index) (0,1)" ;
PARAMETER IINVYEARPROC_LEFT(Y,Y,PROC) "Remaining years of the lifetime of PROC of an investment made in Y (first index) at the beggining of Y (second index) (years)";
PARAMETER IN_INV_PROC(Y,PROC) "Number of investments made OF PROC within Y (fraction)";

**PROCESS
LOOP(IPROCFIND,
LOOP(IYALIAS,
LOOP(Y$(ORD(Y) EQ ORD(IYALIAS)),
IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND)=PROCDATA(IPROCFIND,'PROCLIFETIME');
);
);
);

LOOP(IPROCFIND,
LOOP(IYALIAS,
ILOOPBREAK=0;
IN_INV_PROC(IYALIAS,IPROCFIND)=ROUND(IWEIGHTY(IYALIAS)/PROCDATA(IPROCFIND,'PROCLIFETIME'));
*Correction of IN_INV_PROC
IF (IN_INV_PROC(IYALIAS,IPROCFIND) EQ 0,
IN_INV_PROC(IYALIAS,IPROCFIND)=1;
);
LOOP(Y$(ORD(Y) GE ORD(IYALIAS) AND (ILOOPBREAK EQ 0)),
*First year's annuity
IF (ORD(Y) EQ ORD(IYALIAS),
IYHASANNUITYPROC(IYALIAS,Y,IPROCFIND)= 1;
IF(IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND)*IN_INV_PROC(IYALIAS,IPROCFIND) LE IWEIGHTY(Y),
ILOOPBREAK=1;
);
IINVYEARPROC_LEFT(IYALIAS,Y+1,IPROCFIND)$(ORD(Y) NE CARD(IYALIAS2))=PROCDATA(IPROCFIND,'PROCLIFETIME')*IN_INV_PROC(IYALIAS,IPROCFIND)-IWEIGHTY(Y);
);
*Remaining year's annuity
IF (ORD(Y) GT ORD(IYALIAS),
IF ( IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND) GT IWEIGHTY(Y) ,
IYHASANNUITYPROC(IYALIAS,Y,IPROCFIND)= 1;
IINVYEARPROC_LEFT(IYALIAS,Y+1,IPROCFIND)$(ORD(Y) NE CARD(IYALIAS2))=IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND)-IWEIGHTY(Y);
);
IF ((IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND) GE IWEIGHTY(IYALIAS)/2) AND (IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND) LE IWEIGHTY(Y)) , !!Assumption: if the reamining years are more ore equal than half of IWEIGHTY, then the technology is in in this snapshot
IYHASANNUITYPROC(IYALIAS,Y,IPROCFIND)= 1;
ILOOPBREAK=1;
);
IF ((IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND) LT IWEIGHTY(IYALIAS)/2) AND (IINVYEARPROC_LEFT(IYALIAS,Y,IPROCFIND) LE IWEIGHTY(Y)) , !!Assumption: if the reamining years are less than half of IWEIGHTY, then the technology is out in this snapshot
IYHASANNUITYPROC(IYALIAS,Y,IPROCFIND)= 0;
ILOOPBREAK=1;
);
);
);
);
);


PARAMETER ANNUITYCPROC(CCC,PROC) "Parameter for annuity values of processes";

ANNUITYCPROC(CCC,PROC)$(PROCDATA(PROC,'PROCKAPVARIABLE') EQ 1) = RateOfReturn / (1 - (1 + RateOfReturn) ** (-PROCDATA(PROC,'PROCLIFETIME')));

$label NO_PROC_INVESTMENTS
2 changes: 1 addition & 1 deletion base/addons/optiflow/bb4/optiflow_balbase4.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ QMINFLOW_A
QMINFLOW_R
QMINFLOW_C

*$ifi %inv%==yes QPROCKAPACCUMNET !! Has weakness - but used anyway
$ifi %inv%==yes QPROCKAPACCUMNET !! Has weakness - but used anyway
$ifi %inv%==yes QPROCKAP_UP
$ifi %inv%==yes QSTOVOLTLIM_T
$ifi %inv%==yes QSTOVOLTLIM
Expand Down
44 changes: 27 additions & 17 deletions base/addons/optiflow/bb4/optiflow_eqndecdef.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
EQUATION QOBJQ "Objective function value assuming parameterised quantities technique (U)";
EQUATION QOBJWQ "Objective function value assuming weighted objectives values and parameterised quantities technique (U)";
EQUATION QNODEBALANCE(Y,AAA,PROC,IFLOWIN,IFLOWOUT,S,T) "Balance of input and output FLOW in interior PROC (U/h)"
EQUATION QNODEBALANCE(Y,AAA,PROC,IFLOWIN,IFLOWOUT,S,T) "Balance of input and output FLOW in interior PROC (U/h)";
EQUATION QSOURCENODEBALANCE(Y,AAA,PROCSOURCE,FLOW,S,T) "Balance at Source node (U/h)";
EQUATION QSINKNODEBALANCE(Y,AAA,PROCSINK,FLOW,S,T) "Balance at Sink node (U/h)";
EQUATION QBUFFERNODEBALANCE(Y,AAA,PROCBUFFER,FLOW,S,T) "Heat balance in district heating networks - NEJ generel, but includes Heat balance.. (U/h)";
Expand Down Expand Up @@ -48,8 +48,8 @@ EQUATION QMINFLOW_C(Y,C,PROC,FLOW) "Constraint of FLOW consumption equals to a
*----- Any declarations and definitions of equations for addon:
*-------------------------------------------------------------------------------

*$ifi %inv%==yes EQUATION QPROCKAPACCUMNET(Y,AAA,PROC) 'NOT FINISHED Accumulated new investments minus decommissioning of previous investments due to lifetime expiration available at beginning of next year (U/h)';
$ifi %inv%==yes EQUATION QPROCKAP_UP(Y,AAA,IPROCFROM,IPROCTO,FLOW,S,T) 'Capacity constraint on ..... (U/h)';
$ifi %inv%==yes EQUATION QPROCKAPACCUMNET(Y,AAA,PROC) 'NOT FINISHED Accumulated new investments minus decommissioning of previous investments due to lifetime expiration available at beginning of next year (U/h)';
$ifi %inv%==yes EQUATION QPROCKAP_UP(Y,AAA,IPROCFROM,IPROCTO,FLOW,S,T) 'Capacity constraint on ..... (U/h)';
$ifi %inv%==yes EQUATION QPROCKAUP_SCALE1(Y,AAA,PROC) "Equation for modelling economy of scale of new investments" ;
$ifi %inv%==yes EQUATION QPROCKAUP_SCALE2(Y,AAA,PROC) "Equation for modelling economy of scale of new investments" ;
$ifi %inv%==yes EQUATION QPROCKAP_DEC(Y,AAA,IPROCFROM,IPROCTO,FLOW,S,T) "Equation for modelling of decomissioning plants";
Expand Down Expand Up @@ -176,7 +176,7 @@ QNODEBALANCE(IY411,IA,PROC,IFLOWIN,IFLOWOUT,S,T)$(IPROCINOUTFLOW(IY411,IA,PROC,I
+ SUM(IPROCTO$(FLOWFROMTOPROC(IY411,IA,PROC,IPROCTO,IFLOWOUT) AND (PROCINOUTFLOW(IY411,IA,PROC,IFLOWIN,IFLOWOUT,"IMANYONE"))), VFLOW(IY411,IA,PROC,IPROCTO,IFLOWOUT,S,T)*PROCINOUTFLOW(IY411,IA,PROC,IFLOWIN,IFLOWOUT,"IMANYONE"))

* The multiple outFLOW that are coming from a single inFLOW (SUM acts as summation):
+ SUM((IPROCTO,FLOW)$(FLOWFROMTOPROC(IY411,IA,PROC,IPROCTO,FLOW) AND (PROCINOUTFLOW(IY411,IA,PROC,IFLOWIN,FLOW,"IONEMANY"))), !!TODO: compare �� above: why different
+ SUM((IPROCTO,FLOW)$(FLOWFROMTOPROC(IY411,IA,PROC,IPROCTO,FLOW) AND (PROCINOUTFLOW(IY411,IA,PROC,IFLOWIN,FLOW,"IONEMANY"))), !!TODO: compare §§ above: why different
VFLOW(IY411,IA,PROC,IPROCTO,FLOW,S,T)*PROCINOUTFLOW(IY411,IA,PROC,IFLOWIN,FLOW,"IONEMANY"))
* Export to other areas:
+ SUM(IAI$(ITRANSFROMTO(IA,IAI)),VFLOWTRANS(IY411,IA,IAI,PROC,IFLOWOUT,S,T)$(NOT TRANSFLOWMAX(IA,IAI,PROC,IFLOWOUT)))$PROCEXIM(PROC)
Expand Down Expand Up @@ -433,27 +433,40 @@ QINDICINDICMIN(IY411,FLOWINDIC)$(INDICLIMGOAL(FLOWINDIC,"INDICMIN") AND (INDICLI
QINDICINDICMAX(IY411,FLOWINDIC)$(INDICLIMGOAL(FLOWINDIC,"INDICMAX") AND (INDICLIMGOAL(FLOWINDIC,"INDICMAX") LT +INF))..
VFLOWINDICVALUES(IY411,FLOWINDIC) =L= INDICLIMGOAL(FLOWINDIC,"INDICMAX");

*-------------------------------------
* Process capacity investments
*-------------------------------------

* This equation accumulates investments into process capacity
QPROCKAPACCUMNET(IY411,IA,IPROC)$SUM(Y$(YVALUE(Y) LE YVALUE(IY411)),IAPROCKAPNEW(Y,IA,IPROC))
..
VPROCKAPACCUMNET(IY411,IA,IPROC)
=E=
SUM(IY402$IY411PREVY(IY411,IY402), VPROCKAPACCUMNET(IY402,IA,IPROC)$SUM(Y$(YVALUE(Y) LT YVALUE(IY411)),IAPROCKAPNEW(Y,IA,IPROC)))$(NOT IYFIRST(IY411))
+ VPROCKAPNEW(IY411,IA,IPROC)$IAPROCKAPNEW(IY411,IA,IPROC)
;


*This equation is for any process that is not a storage process, so IPROCFROM (when is in IFLOWINOUT_OUT or IPROCTO (when is IFLOWIN_IN) cannot be a PROCSTORAGE
*If we want to highlight the importance of storage, we should take them into account and write them

QPROCKAP_UP(IY411,IA,IPROCFROM,IPROCTO,FLOW,S,T)$(
(
*(NOT PROCSTORAGE(IPROCFROM)) AND (NOT PROCSTORAGE_Y(IPROCFROM)) AND
(FLOWFROMTOPROC(IY411,IA,IPROCFROM,IPROCTO,FLOW) AND (PROCKAPDATA(IY411,IPROCFROM,FLOW,'IFLOWINOUT_OUT'))))
(FLOWFROMTOPROC(IY411,IA,IPROCFROM,IPROCTO,FLOW) AND (IPROCKAPDATA(IY411,IPROCFROM,FLOW,'IFLOWINOUT_OUT'))))
OR (
*(NOT PROCSTORAGE(IPROCTO)) AND (NOT PROCSTORAGE_Y(IPROCTO)) AND
(FLOWFROMTOPROC(IY411,IA,IPROCFROM,IPROCTO,FLOW) AND (PROCKAPDATA(IY411,IPROCTO,FLOW,'IFLOWINOUT_IN'))))
(FLOWFROMTOPROC(IY411,IA,IPROCFROM,IPROCTO,FLOW) AND (IPROCKAPDATA(IY411,IPROCTO,FLOW,'IFLOWINOUT_IN'))))
)..
VFLOW(IY411,IA,IPROCFROM,IPROCTO,FLOW,S,T) =L=

VFLOW(IY411,IA,IPROCFROM,IPROCTO,FLOW,S,T)
=L=
PROCKAPFX(IY411,IA,IPROCFROM,FLOW,'IFLOWINOUT_OUT')$(PROCKAPDATA(IY411,IPROCFROM,FLOW,'IFLOWINOUT_OUT'))
+ PROCKAPFX(IY411,IA,IPROCTO,FLOW,'IFLOWINOUT_IN')$(PROCKAPDATA(IY411,IPROCTO,FLOW,'IFLOWINOUT_IN'))
+ VPROCKAPACCUMNET(IY411,IA,IPROCFROM)$(SUM(Y$(YVALUE(Y) LE YVALUE(IY411)),IAPROCKAPNEW(Y,IA,IPROCFROM)) AND (IPROCKAPDATA(IY411,IPROCFROM,FLOW,'IFLOWINOUT_OUT')))
+ VPROCKAPACCUMNET(IY411,IA,IPROCTO)$(SUM(Y$(YVALUE(Y) LE YVALUE(IY411)),IAPROCKAPNEW(Y,IA,IPROCTO)) AND (IPROCKAPDATA(IY411,IPROCTO,FLOW,'IFLOWINOUT_IN')))
;

* + (SUM(IY402$IY411PREVY(IY411,IY402),VPROCKAPACCUMNET(IY402,IA,IPROCFROM)) !! CHECK
+ VPROCKAPNEW(IY411,IA,IPROCFROM)$(FLOWFROMTOPROC(IY411,IA,IPROCFROM,IPROCTO,FLOW) AND (PROCKAPDATA(IY411,IPROCFROM,FLOW,'IFLOWINOUT_OUT')))
* + (SUM(IY402$IY411PREVY(IY411,IY402),VPROCKAPACCUMNET(IY402,IA,IPROCTO)) !! CHECK
+ VPROCKAPNEW(IY411,IA,IPROCTO)$(FLOWFROMTOPROC(IY411,IA,IPROCFROM,IPROCTO,FLOW) AND (PROCKAPDATA(IY411,IPROCTO,FLOW,'IFLOWINOUT_IN')));

*FLOWFROMTOPROC(IY411,IA,IPROCFROM2,IPROCTO,FLOW) AND

QPROCKAUP_SCALE1(IY411,IA,PROC)$(IAPROCKAPNEW(IY411,IA,PROC) AND PROCKAPNEWSCALE(PROC))..
VPROCKAPNEW(IY411,IA,PROC)=G=PROCKAPNEWSCALE(PROC)*VPROCKAPNEWSCALE_U(IY411,IA,PROC);
Expand Down Expand Up @@ -648,7 +661,4 @@ SUM(IA$ICA(C,IA),
(SUM((PROCSINK,S,T)$(PROCSINK(PROC) AND IENTERPROC(IY411,IA,PROCSINK,FLOW)),VFLOWSINK(IY411,IA,PROCSINK,FLOW,S,T)*IHOURSINST(S,T)))$(PROC_T(PROC))+
(SUM((PROCSINK,S,ITWWT)$(PROCSINK(PROC) AND IENTERPROC(IY411,IA,PROCSINK,FLOW)),VFLOWSINK(IY411,IA,PROCSINK,FLOW,S,ITWWT)*IHOURSINSTWWT(S,ITWWT)))$((NOT PROC_T(PROC)))
)
=G=MINFLOW(IY411,C,PROC,FLOW);



=G=MINFLOW(IY411,C,PROC,FLOW);
Loading