Commit f71f99b3 authored by Niina Helistö's avatar Niina Helistö
Browse files

Merge branch 'remove_commodity_set' into 'master'

Remove commodity set and replace it with a parameter

See merge request !21
parents 699044bb b9400d0c
...@@ -58,7 +58,6 @@ Model building / ...@@ -58,7 +58,6 @@ Model building /
* q_conversionIncHR_help2 * q_conversionIncHR_help2
* q_unitEqualityConstraint * q_unitEqualityConstraint
* q_unitGreaterThanConstraint * q_unitGreaterThanConstraint
* q_commodityUseLimit
// Energy Transfer // Energy Transfer
q_transfer q_transfer
......
...@@ -58,7 +58,6 @@ Model invest / ...@@ -58,7 +58,6 @@ Model invest /
q_conversionIncHR_help2 q_conversionIncHR_help2
q_unitEqualityConstraint q_unitEqualityConstraint
q_unitGreaterThanConstraint q_unitGreaterThanConstraint
* q_commodityUseLimit
// Energy Transfer // Energy Transfer
q_transfer q_transfer
......
...@@ -58,7 +58,6 @@ Model schedule / ...@@ -58,7 +58,6 @@ Model schedule /
q_conversionIncHR_help2 q_conversionIncHR_help2
q_unitEqualityConstraint q_unitEqualityConstraint
q_unitGreaterThanConstraint q_unitGreaterThanConstraint
* q_commodityUseLimit
// Energy Transfer // Energy Transfer
q_transfer q_transfer
......
...@@ -132,7 +132,6 @@ v_help_inc ...@@ -132,7 +132,6 @@ v_help_inc
q_conversionIncHR_help2 q_conversionIncHR_help2
q_unitEqualityConstraint q_unitEqualityConstraint
q_unitGreaterThanConstraint q_unitGreaterThanConstraint
* q_commodityUseLimit
// Energy Transfer // Energy Transfer
q_transfer q_transfer
......
...@@ -94,8 +94,7 @@ r_gnnDiffusion ...@@ -94,8 +94,7 @@ r_gnnDiffusion
// Results required for model structure !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Results required for model structure !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
r_gen r_gen
// Fuel use results // Energy output results based on input types or unittypes
r_fuelUse
r_genFuel r_genFuel
r_genUnittype r_genUnittype
r_gnTotalGenFuel r_gnTotalGenFuel
...@@ -142,10 +141,16 @@ r_uTotalShutdown ...@@ -142,10 +141,16 @@ r_uTotalShutdown
// Unit level emissions from normal operation // Unit level emissions from normal operation
r_emissions r_emissions
// Unit level emissions from outputs, not considered in the equations
r_emissionsFromOutput
// Unit level emissions from start-ups // Unit level emissions from start-ups
r_emissionsStartup r_emissionsStartup
// Emission sums from normal operation // Emission sums
r_nuTotalEmissionsOperation
r_nuTotalEmissionsFromOutput
r_nuTotalEmissionsStartup
r_nuTotalEmissions r_nuTotalEmissions
r_nTotalEmissions r_nTotalEmissions
r_uTotalEmissions r_uTotalEmissions
......
...@@ -226,6 +226,7 @@ param_gn "Possible parameters for grid, node" / ...@@ -226,6 +226,7 @@ param_gn "Possible parameters for grid, node" /
* forecastLength "Length of forecasts in use for the node (hours). After this, the node will use the central forecast." // NOT IMPLEMENTED * forecastLength "Length of forecasts in use for the node (hours). After this, the node will use the central forecast." // NOT IMPLEMENTED
capacityMargin "Capacity margin used in invest mode (MW)" capacityMargin "Capacity margin used in invest mode (MW)"
storageValueUseTimeSeries "A flag to determine whether to use time series form `storageValue`" storageValueUseTimeSeries "A flag to determine whether to use time series form `storageValue`"
usePrice "A flag to decide whether ts_priceChange is to be used"
/ /
param_gnBoundaryTypes "Types of boundaries that can be set for a node with a state variable" / param_gnBoundaryTypes "Types of boundaries that can be set for a node with a state variable" /
......
...@@ -22,14 +22,12 @@ Sets ...@@ -22,14 +22,12 @@ Sets
* --- Commodities & resources ------------------------------------------------------- * --- Commodities & resources -------------------------------------------------------
emission "Emissions" emission "Emissions"
commodity(node) "Commodities that can be bought or sold exogenous to model"
flow "Flow based energy resources (time series)" flow "Flow based energy resources (time series)"
* --- Energy generation and consumption --------------------------------------- * --- Energy generation and consumption ---------------------------------------
unit "Set of generators, storages and loads" unit "Set of generators, storages and loads"
unittype "Unit technology types" unittype "Unit technology types"
unit_flow(unit) "Unit that depend directly on variable energy flows (RoR, solar PV, etc.)" unit_flow(unit) "Unit that depend directly on variable energy flows (RoR, solar PV, etc.)"
unit_commodity(unit) "Units using an exogenous commodity with a price"
unit_fail(unit) "Units that might fail" unit_fail(unit) "Units that might fail"
unit_minLoad(unit) "Units that have unit commitment restrictions (e.g. minimum power level)" unit_minLoad(unit) "Units that have unit commitment restrictions (e.g. minimum power level)"
unit_online(unit) "Units that have an online variable in the first active effLevel" unit_online(unit) "Units that have an online variable in the first active effLevel"
...@@ -45,9 +43,6 @@ Sets ...@@ -45,9 +43,6 @@ Sets
flowUnit(flow, unit) "Units linked to a certain energy flow time series" flowUnit(flow, unit) "Units linked to a certain energy flow time series"
unitUnittype(unit, unittype) "Link generation technologies to types" unitUnittype(unit, unittype) "Link generation technologies to types"
unitStarttype(unit, starttype) "Units with special startup properties" unitStarttype(unit, starttype) "Units with special startup properties"
un_commodity(unit, node) "Units linked with commodities"
un_commodity_in(unit, node) "Units linked with input commodities"
un_commodity_out(unit, node) "Units linked with output commodities"
unit_investLP(unit) "Units with continuous investments allowed" unit_investLP(unit) "Units with continuous investments allowed"
unit_investMIP(unit) "Units with integer investments allowed" unit_investMIP(unit) "Units with integer investments allowed"
unit_timeseries(unit) "Units with time series enabled" unit_timeseries(unit) "Units with time series enabled"
...@@ -208,7 +203,6 @@ alias(op, op_, op__); ...@@ -208,7 +203,6 @@ alias(op, op_, op__);
alias(hrop, hrop_, hrop__); alias(hrop, hrop_, hrop__);
alias(eff, eff_, eff__); alias(eff, eff_, eff__);
alias(hr, hr_, hr__); alias(hr, hr_, hr__);
alias(commodity, commodity_);
alias(effLevel, effLevel_); alias(effLevel, effLevel_);
alias(restype, restype_); alias(restype, restype_);
alias(group, group_); alias(group, group_);
......
...@@ -29,8 +29,8 @@ Parameters ...@@ -29,8 +29,8 @@ Parameters
// Unit Operational Cost Components // Unit Operational Cost Components
r_gnuVOMCost(grid, node, unit, f, t) "Variable O&M costs for energy outputs (MEUR)" r_gnuVOMCost(grid, node, unit, f, t) "Variable O&M costs for energy outputs (MEUR)"
r_gnuTotalVOMCost(grid, node, unit) "Total gnu VOM costs over the simulation (MEUR)" r_gnuTotalVOMCost(grid, node, unit) "Total gnu VOM costs over the simulation (MEUR)"
r_uFuelEmissionCost(node, unit, f, t) "Unit fuel & emission costs for normal operation (MEUR)" r_uFuelEmissionCost(grid, node, unit, f, t) "Unit fuel & emission costs for normal operation (MEUR)"
r_uTotalFuelEmissionCost(commodity, unit) "Total unit fuel & emission costs over the simulation for normal operation (MEUR)" r_uTotalFuelEmissionCost(grid, node, unit) "Total unit fuel & emission costs over the simulation for normal operation (MEUR)"
r_uStartupCost(unit, f, t) "Unit startup VOM, fuel, & emission costs (MEUR)" r_uStartupCost(unit, f, t) "Unit startup VOM, fuel, & emission costs (MEUR)"
r_uShutdownCost(unit, f, t) "Unit startup VOM, fuel, & emission costs (MEUR)" r_uShutdownCost(unit, f, t) "Unit startup VOM, fuel, & emission costs (MEUR)"
r_uTotalStartupCost(unit) "Total unit startup costs over the simulation (MEUR)" r_uTotalStartupCost(unit) "Total unit startup costs over the simulation (MEUR)"
...@@ -101,14 +101,13 @@ Parameters ...@@ -101,14 +101,13 @@ Parameters
r_gen(grid, node, unit, f, t) "Energy generation for a unit (MW)" r_gen(grid, node, unit, f, t) "Energy generation for a unit (MW)"
r_gen_gnUnittype(grid, node, unittype) "Energy generation for each unittype in each node (MWh)" r_gen_gnUnittype(grid, node, unittype) "Energy generation for each unittype in each node (MWh)"
// Fuel use results // Energy output results based on input types or unittypes
r_fuelUse(node, unit, f, t) "Fuel use of units" r_genFuel(grid, node, *, f, t) "Energy output to a node based on inputs from another node or flows (MW)"
r_genFuel(grid, node, *, f, t) "Energy generation/consumption based on fuels / flows (MW)" r_genUnittype(grid, node, unittype, f, t) "Energy generation for each unittype (MW)"
r_genUnittype(grid, node, unittype, f, t) "Energy generation/consumption for each unittype (MW)" r_gnTotalGenFuel(grid, node, node) "Total energy generation in gn per input type over the simulation (MWh)"
r_gnTotalGenFuel(grid, node, commodity) "Total energy generation in gn per fuel over the simulation (MWh)" r_gnTotalGenFuelShare(grid, node, node) "Total energy generation in gn per input type as a share of total energy generation in gn"
r_gnTotalGenFuelShare(grid, node, commodity) "Total energy generation fuel consumption gn/g share" r_gTotalGenFuel(grid, node) "Total energy generation in g per input type over the simulation (MWh)"
r_gTotalGenFuel(grid, commodity) "Total energy generation in g per fuel over the simulation (MWh)" r_totalGenFuel(node) "Total overall energy generation per input type over the simulation (MWh)"
r_totalGenFuel(commodity) "Total overall energy generation/consumption per fuel over the simulation (MWh)"
// Interesting energy generation results // Interesting energy generation results
r_gnuTotalGen(grid, node, unit) "Total energy generation in gnu over the simulation (MWh)" r_gnuTotalGen(grid, node, unit) "Total energy generation in gnu over the simulation (MWh)"
...@@ -133,13 +132,19 @@ Parameters ...@@ -133,13 +132,19 @@ Parameters
* --- Emissions Results ------------------------------------------------------- * --- Emissions Results -------------------------------------------------------
// Unit level emissions from normal operation // Unit level emissions from normal operation
r_emissions (node, emission, unit, f, t) "Emissions from units (tCO2)" r_emissions(grid, node, emission, unit, f, t) "Emissions from units (tCO2)"
// Unit level emissions from outputs, not considered in the equations
r_emissionsFromOutput(grid, node, emission, unit, f, t) "Emissions from outputs (tCO2)"
// Unit level emissions from start-ups // Unit level emissions from start-ups
r_emissionsStartup(node, emission, unit, f, t) "Emissions from units in start-ups (tCO2)" r_emissionsStartup(node, emission, unit, f, t) "Emissions from units in start-ups (tCO2)"
// Emission sums from normal operation // Emission sums
r_nuTotalEmissions (node, unit, emission) "node unit total emissions (tCO2)" r_nuTotalEmissionsOperation(node, unit, emission) "node unit total emissions in normal operation (tCO2)"
r_nuTotalEmissionsFromOutput(node, unit, emission) "node unit total emissions from output (tCO2)"
r_nuTotalEmissionsStartup(node, unit, emission) "node unit total emissions in start-ups (tCO2)"
r_nuTotalEmissions(node, unit, emission) "node unit total emissions (tCO2)"
r_nTotalEmissions(node, emission) "node total emissions (tCO2)" r_nTotalEmissions(node, emission) "node total emissions (tCO2)"
r_uTotalEmissions(unit, emission) "unit total emissions (tCO2)" r_uTotalEmissions(unit, emission) "unit total emissions (tCO2)"
r_totalEmissions (emission) "Total emissions (tCO2)" r_totalEmissions (emission) "Total emissions (tCO2)"
......
...@@ -41,7 +41,6 @@ $loaddc unittype ...@@ -41,7 +41,6 @@ $loaddc unittype
$loaddc unit $loaddc unit
$loaddc unitUnittype $loaddc unitUnittype
$loaddc unit_fail $loaddc unit_fail
$loaddc commodity
$loaddc unitUnitEffLevel $loaddc unitUnitEffLevel
$loaddc effLevelGroupUnit $loaddc effLevelGroupUnit
$loaddc group $loaddc group
...@@ -177,11 +176,6 @@ unit_minload(unit)${ p_unit(unit, 'op00') > 0 // If the first defined operati ...@@ -177,11 +176,6 @@ unit_minload(unit)${ p_unit(unit, 'op00') > 0 // If the first defined operati
// Units with flows/commodities // Units with flows/commodities
unit_flow(unit)${ sum(flow, flowUnit(flow, unit)) } unit_flow(unit)${ sum(flow, flowUnit(flow, unit)) }
= yes; = yes;
un_commodity(unit, commodity)$sum(grid, gnu(grid, commodity, unit)) = yes;
un_commodity_in(unit, commodity)$sum(grid, gnu_input(grid, commodity, unit)) = yes;
un_commodity_out(unit, commodity)$sum(grid, gnu_output(grid, commodity, unit)) = yes;
unit_commodity(unit)${ sum(node, un_commodity(unit, node)) }
= yes;
// Units with investment variables // Units with investment variables
unit_investLP(unit)${ not p_unit(unit, 'investMIP') unit_investLP(unit)${ not p_unit(unit, 'investMIP')
...@@ -306,18 +300,18 @@ loop(utAvailabilityLimits(unit, t, availabilityLimits), ...@@ -306,18 +300,18 @@ loop(utAvailabilityLimits(unit, t, availabilityLimits),
// Use time series for commodity prices depending on 'ts_priceChange' // Use time series for commodity prices depending on 'ts_priceChange'
// Determine if commodity prices require a time series representation or not // Determine if commodity prices require a time series representation or not
loop(commodity, loop(node$sum(grid, p_gn(grid, node, 'usePrice')),
// Find the steps with changing fuel prices // Find the steps with changing fuel prices
option clear = tt; option clear = tt;
tt(t)${ ts_priceChange(commodity, t) } = yes; tt(t)${ ts_priceChange(node, t) } = yes;
// If only up to a single value // If only up to a single value
if(sum(tt, 1) <= 1, if(sum(tt, 1) <= 1,
p_price(commodity, 'useConstant') = 1; // Use a constant for commodity prices p_price(node, 'useConstant') = 1; // Use a constant for commodity prices
p_price(commodity, 'price') = sum(tt, ts_priceChange(commodity, tt)) // Determine the price as the only value in the time series p_price(node, 'price') = sum(tt, ts_priceChange(node, tt)) // Determine the price as the only value in the time series
// If multiple values found, use time series // If multiple values found, use time series
else else
p_price(commodity, 'useTimeSeries') = 1; p_price(node, 'useTimeSeries') = 1;
); // END if(sum(tt)) ); // END if(sum(tt))
); // END loop(fuel) ); // END loop(fuel)
...@@ -692,6 +686,27 @@ loop( unit_investMIP(unit), ...@@ -692,6 +686,27 @@ loop( unit_investMIP(unit),
); // END if ); // END if
); // END loop(unit_investMIP) ); // END loop(unit_investMIP)
* --- Check node balance and price related data -------------------------------
// Give a warning if both nodeBalance and usePrice are false
loop( node,
if(not sum(grid, p_gn(grid, node, 'nodeBalance') or p_gn(grid, node, 'usePrice')),
put log '!!! Warning: Node ', node.tl:0, ' does not have nodeBalance or usePrice activated in p_gn' /;
); // END if
); // END loop(node)
// Give a warning if usePrice is true but ts_priceChange has no data
loop( node,
if(p_price(node, 'useConstant') and not p_price(node, 'price'),
put log '!!! Warning: Node ', node.tl:0, ' has usePrice activated in p_gn but there is no ts_priceChange data' /;
); // END if
); // END loop(node)
// Give a warning if both nodeBalance and usePrice are true
loop( node,
if(sum(grid, p_gn(grid, node, 'nodeBalance') and p_gn(grid, node, 'usePrice')),
put log '!!! Warning: Node ', node.tl:0, ' has both nodeBalance or usePrice activated in p_gn' /;
); // END if
); // END loop(node)
* --- Check consistency of inputs for superposed node states ------------------- * --- Check consistency of inputs for superposed node states -------------------
* no checking yet because node_superpos is not given in the gdx input * no checking yet because node_superpos is not given in the gdx input
......
...@@ -86,18 +86,6 @@ $ifthen exist '%input_dir%/unit_fail3.gdx' ...@@ -86,18 +86,6 @@ $ifthen exist '%input_dir%/unit_fail3.gdx'
$$gdxin $$gdxin
$endif $endif
$ifthen exist '%input_dir%/commodity2.gdx'
$$gdxin '%input_dir%/commodity2.gdx'
$$loaddcm commodity
$$gdxin
$endif
$ifthen exist '%input_dir%/commodity3.gdx'
$$gdxin '%input_dir%/commodity3.gdx'
$$loaddcm commodity
$$gdxin
$endif
$ifthen exist '%input_dir%/unitUnitEffLevel2.gdx' $ifthen exist '%input_dir%/unitUnitEffLevel2.gdx'
$$gdxin '%input_dir%/unitUnitEffLevel2.gdx' $$gdxin '%input_dir%/unitUnitEffLevel2.gdx'
$$loaddcm unitUnitEffLevel $$loaddcm unitUnitEffLevel
......
...@@ -91,7 +91,6 @@ equations ...@@ -91,7 +91,6 @@ equations
q_conversionIncHR_help2(grid, node, s, hr, effSelector, unit, f, t) "Helper equation 2 to ensure that the first heat rate segments are used first" q_conversionIncHR_help2(grid, node, s, hr, effSelector, unit, f, t) "Helper equation 2 to ensure that the first heat rate segments are used first"
q_unitEqualityConstraint(s, eq_constraint, unit, f, t) "Fixing the ratio between inputs and/or outputs" q_unitEqualityConstraint(s, eq_constraint, unit, f, t) "Fixing the ratio between inputs and/or outputs"
q_unitGreaterThanConstraint(s, gt_constraint, unit, f, t) "Lower limit for the ratio between inputs and/or outputs" q_unitGreaterThanConstraint(s, gt_constraint, unit, f, t) "Lower limit for the ratio between inputs and/or outputs"
* q_commodityUseLimit(s, commodity, unit, f, t) "Commodity use cannot exceed limits"
// Energy Transfer // Energy Transfer
q_transfer(grid, node, node, s, f, t) "Rightward and leftward transfer must match the total transfer" q_transfer(grid, node, node, s, f, t) "Rightward and leftward transfer must match the total transfer"
......
...@@ -2002,7 +2002,7 @@ q_conversionSOS2IntermediateOutput(s_active(s), suft(effLambda(effGroup), unit, ...@@ -2002,7 +2002,7 @@ q_conversionSOS2IntermediateOutput(s_active(s), suft(effLambda(effGroup), unit,
) // END sum(gnu_output) ) // END sum(gnu_output)
; ;
* --- Commodity Use Limitation ----------------------------------------------------- * --- Fixed ratio of inputs or outputs ----------------------------------------
q_unitEqualityConstraint(s_active(s), eq_constraint, uft(unit, f, t)) q_unitEqualityConstraint(s_active(s), eq_constraint, uft(unit, f, t))
${ sft(s, f, t) ${ sft(s, f, t)
...@@ -2028,7 +2028,7 @@ q_unitEqualityConstraint(s_active(s), eq_constraint, uft(unit, f, t)) ...@@ -2028,7 +2028,7 @@ q_unitEqualityConstraint(s_active(s), eq_constraint, uft(unit, f, t))
] ]
; ;
* --- Commodity Use Limitation ----------------------------------------------------- * --- Constrained ratio of inputs or outputs ----------------------------------
q_unitGreaterThanConstraint(s_active(s), gt_constraint, uft(unit, f, t)) q_unitGreaterThanConstraint(s_active(s), gt_constraint, uft(unit, f, t))
${ sft(s, f, t) ${ sft(s, f, t)
......
...@@ -631,18 +631,18 @@ loop(m, ...@@ -631,18 +631,18 @@ loop(m,
* --- Calculating fuel price time series -------------------------------------- * --- Calculating fuel price time series --------------------------------------
tmp_ = smin(t_full(t),ord(t)); tmp_ = smin(t_full(t),ord(t));
loop(commodity$p_price(commodity, 'useTimeSeries'), loop(node$p_price(node, 'useTimeSeries'),
// Determine the time steps where the prices change // Determine the time steps where the prices change
Option clear = tt; Option clear = tt;
tt(t)$ts_priceChange(commodity,t) = yes; tt(t)$ts_priceChange(node,t) = yes;
tmp = sum(tt(t)$(ord(t) < tmp_), tmp = sum(tt(t)$(ord(t) < tmp_),
ts_priceChange(commodity, t) ts_priceChange(node, t)
); );
loop(t_full(t), loop(t_full(t),
tmp = tmp + ts_priceChange(commodity, t); tmp = tmp + ts_priceChange(node, t);
ts_price(commodity, t) = tmp; ts_price(node, t) = tmp;
); );
); // END loop(commodity) ); // END loop(node)
* --- Slack Direction --------------------------------------------------------- * --- Slack Direction ---------------------------------------------------------
......
...@@ -99,7 +99,6 @@ Option clear = q_conversionIncHR_help1; ...@@ -99,7 +99,6 @@ Option clear = q_conversionIncHR_help1;
Option clear = q_conversionIncHR_help2; Option clear = q_conversionIncHR_help2;
Option clear = q_unitEqualityConstraint; Option clear = q_unitEqualityConstraint;
Option clear = q_unitGreaterThanConstraint; Option clear = q_unitGreaterThanConstraint;
*Option clear = q_commodityUseLimit;
// Energy Transfer // Energy Transfer
Option clear = q_transfer; Option clear = q_transfer;
......
...@@ -423,13 +423,13 @@ $offtext ...@@ -423,13 +423,13 @@ $offtext
+ p_price(node, 'price')$p_price(node, 'useConstant') + p_price(node, 'price')$p_price(node, 'useConstant')
+ sum(tt_aggcircular(t, t_), ts_price(node, t_))$p_price(node, 'useTimeSeries') + sum(tt_aggcircular(t, t_), ts_price(node, t_))$p_price(node, 'useTimeSeries')
/ mInterval(mSolve, 'stepsPerInterval', counter) / mInterval(mSolve, 'stepsPerInterval', counter)
)$un_commodity_in(unit, node) )$gnu_input(grid, node, unit)
// output node cost (if price > 0 --> ts_vomCost_ < 0, i.e. considered as revenue) // output node cost (if price > 0 --> ts_vomCost_ < 0, i.e. considered as revenue)
- ( - (
+ p_price(node, 'price')$p_price(node, 'useConstant') + p_price(node, 'price')$p_price(node, 'useConstant')
+ sum(tt_aggcircular(t, t_), ts_price(node, t_))$p_price(node, 'useTimeSeries') + sum(tt_aggcircular(t, t_), ts_price(node, t_))$p_price(node, 'useTimeSeries')
/ mInterval(mSolve, 'stepsPerInterval', counter) / mInterval(mSolve, 'stepsPerInterval', counter)
)$un_commodity_out(unit, node) )$gnu_output(grid, node, unit)
// emission cost // emission cost
+ sum(emission$p_unitEmissionCost(unit, node, emission), // Emission taxes + sum(emission$p_unitEmissionCost(unit, node, emission), // Emission taxes
+ p_unitEmissionCost(unit, node, emission) + p_unitEmissionCost(unit, node, emission)
......
...@@ -117,10 +117,6 @@ loop(s_realized(s), ...@@ -117,10 +117,6 @@ loop(s_realized(s),
r_gen(gnuft(grid, node, unit, f, startp(t)))$sft_realized(s, f, t) r_gen(gnuft(grid, node, unit, f, startp(t)))$sft_realized(s, f, t)
= v_gen.l(grid, node, unit, s, f, t) = v_gen.l(grid, node, unit, s, f, t)
; ;
// Fuel use of units
r_fuelUse(node, uft(unit_commodity, f, startp(t)))$(un_commodity(unit_commodity, node)$sft_realized(s, f, t))
= - sum(gnu(grid, node, unit_commodity), v_gen.l(grid, node, unit_commodity, s, f, t))
;
// Transfer of energy between nodes // Transfer of energy between nodes
r_transfer(gn2n(grid, from_node, to_node), f, startp(t))$sft_realized(s, f, t) r_transfer(gn2n(grid, from_node, to_node), f, startp(t))$sft_realized(s, f, t)
= v_transfer.l(grid, from_node, to_node, s, f, t) = v_transfer.l(grid, from_node, to_node, s, f, t)
......
...@@ -37,14 +37,19 @@ loop(m, ...@@ -37,14 +37,19 @@ loop(m,
* p_gnu(grid, node, unit, 'vomCosts'); * p_gnu(grid, node, unit, 'vomCosts');
// Fuel and emission costs during normal operation // Fuel and emission costs during normal operation
r_uFuelEmissionCost(commodity, unit_commodity(unit), ft_realizedNoReset(f,startp(t)))$un_commodity(unit, commodity) // Note that this result calculation uses ts_price directly while the
// objective function uses ts_price average over the interval. There can
// be differences if realized intervals contain several time steps.
r_uFuelEmissionCost(gnu(grid, node, unit), ft_realizedNoReset(f,startp(t)))
= 1e-6 // Scaling to MEUR = 1e-6 // Scaling to MEUR
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* r_fuelUse(commodity, unit, f, t) * abs(r_gen(grid, node, unit, f, t))
* [ + p_price(commodity, 'price')$p_price(commodity, 'useConstant') * [ + p_price(node, 'price')${p_price(node, 'useConstant') and gnu_input(grid, node, unit)}
+ ts_price(commodity, t)$p_price(commodity, 'useTimeSeries') + ts_price(node, t)${p_price(node, 'useTimeSeries') and gnu_input(grid, node, unit)}
- p_price(node, 'price')${p_price(node, 'useConstant') and gnu_output(grid, node, unit)}
- ts_price(node, t)${p_price(node, 'useTimeSeries') and gnu_output(grid, node, unit)}
// Emission costs // Emission costs
+ sum(emission, p_unitEmissionCost(unit, commodity, emission)) + sum(emission, p_unitEmissionCost(unit, node, emission))
]; ];
// Unit startup costs // Unit startup costs
...@@ -160,9 +165,9 @@ loop(m, ...@@ -160,9 +165,9 @@ loop(m,
; ;
// Total fuel & emission costs // Total fuel & emission costs
r_uTotalFuelEmissionCost(commodity, unit)$un_commodity(unit, commodity) r_uTotalFuelEmissionCost(gnu(grid, node, unit))
= sum(ft_realizedNoReset(f,startp(t)), = sum(ft_realizedNoReset(f,startp(t)),
+ r_uFuelEmissionCost(commodity, unit, f, t) + r_uFuelEmissionCost(grid, node, unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_s_discountFactor(s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_s_discountFactor(s))
); );
...@@ -230,18 +235,16 @@ loop(m, ...@@ -230,18 +235,16 @@ loop(m,
= + sum(gnu(grid, node, unit), = + sum(gnu(grid, node, unit),
// VOM costs // VOM costs
+ r_gnuVOMCost(grid, node, unit, f, t) + r_gnuVOMCost(grid, node, unit, f, t)
+ r_uFuelEmissionCost(grid, node, unit, f, t)
) )
// Allocate fuel and startup costs on energy basis, but for output nodes only
// Allocate startup costs on energy basis, but for output nodes only
+ sum(unit$(r_gen(grid, node, unit, f, t)$gnu_output(grid, node, unit)), + sum(unit$(r_gen(grid, node, unit, f, t)$gnu_output(grid, node, unit)),
+ abs{r_gen(grid, node, unit, f, t)} // abs is due to potential negative outputs like energy from a cooling unit. It's the energy contribution that matters, not direction. + abs{r_gen(grid, node, unit, f, t)} // abs is due to potential negative outputs like energy from a cooling unit. It's the energy contribution that matters, not direction.
/ sum(gnu_output(grid_output, node_output, unit), / sum(gnu_output(grid_output, node_output, unit),
+ abs{r_gen(grid_output, node_output, unit, f, t)} + abs{r_gen(grid_output, node_output, unit, f, t)}
) // END sum(gnu_output) ) // END sum(gnu_output)
* * r_uStartupCost(unit, f, t)
{
+ sum(un_commodity(unit, commodity), r_uFuelEmissionCost(commodity, unit, f, t))
+ r_uStartupCost(unit, f, t)
}
) )
+ sum(gn2n_directional(grid, node_, node), + sum(gn2n_directional(grid, node_, node),
// Variable Transfer costs // Variable Transfer costs
...@@ -281,9 +284,9 @@ loop(m, ...@@ -281,9 +284,9 @@ loop(m,
) // END sum(ft_realizedNoReset) ) // END sum(ft_realizedNoReset)
); );
// Energy generation by fuels // Energy output to a node based on inputs from another node or flows
r_genFuel(gn(grid, node), commodity, ft_realizedNoReset(f, startp(t)))$sum(gnu_input(grid_, commodity, unit)$gnu_output(grid, node, unit),r_gen(grid_, commodity, unit, f, t)) r_genFuel(gn(grid, node), node_, ft_realizedNoReset(f, startp(t)))$sum(gnu_input(grid_, node_, unit)$gnu_output(grid, node, unit),r_gen(grid_, node_, unit, f, t))
= sum(gnu_output(grid, node, unit)$sum(gnu_input(grid_, commodity, unit), 1), = sum(gnu_output(grid, node, unit)$sum(gnu_input(grid_, node_, unit), 1),
+ r_gen(grid, node, unit, f, t) + r_gen(grid, node, unit, f, t)
); );
// The calculation with multiple inputs needs to be fixed below (right share for different commodities - now units with multiple input commodities will get the same amount allocated which will then be too big // The calculation with multiple inputs needs to be fixed below (right share for different commodities - now units with multiple input commodities will get the same amount allocated which will then be too big
...@@ -295,16 +298,16 @@ loop(m, ...@@ -295,16 +298,16 @@ loop(m,
= sum(gnu_output(grid, node, unit)$flowUnit(flow, unit), = sum(gnu_output(grid, node, unit)$flowUnit(flow, unit),
+ r_gen(grid, node, unit, f, t)); + r_gen(grid, node, unit, f, t));
// Energy generation by fuels // Energy generation for each unittype
r_genUnittype(gn(grid, node), unittype, ft_realizedNoReset(f,startp(t))) r_genUnittype(gn(grid, node), unittype, ft_realizedNoReset(f,startp(t)))
= sum(gnu_output(grid, node, unit)$unitUnittype(unit, unittype), = sum(gnu_output(grid, node, unit)$unitUnittype(unit, unittype),
+ r_gen(grid, node, unit, f, t) + r_gen(grid, node, unit, f, t)
); // END sum(unit) ); // END sum(unit)
// Total generation on each node by fuels // Total energy generation in gn per input type over the simulation
r_gnTotalGenFuel(gn(grid, node), commodity) r_gnTotalGenFuel(gn(grid, node), node_)
= sum(ft_realizedNoReset(f, startp(t)), = sum(ft_realizedNoReset(f, startp(t)),
+ r_genFuel(grid, node, commodity, f, t) + r_genFuel(grid, node, node_, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
); // END sum(ft_realizedNoReset) ); // END sum(ft_realizedNoReset)
...@@ -327,18 +330,29 @@ loop(m, ...@@ -327,18 +330,29 @@ loop(m,
* --- Emission Results -------------------------------------------------------- * --- Emission Results --------------------------------------------------------
// Emissions of units (only for commodities, not including startup fuels) // Emissions of units (not including start-up fuels)
r_emissions(commodity, emission, unit, ft_realizedNoReset(f,startp(t)))$un_commodity(unit, commodity) // Only taking into account emissions from input because emissions from output
// do not cause costs and are not considered in emission cap
r_emissions(grid, node, emission, unit, ft_realizedNoReset(f,startp(t)))
$gnu_input(grid, node, unit)
= + p_stepLengthNoReset(m, f, t) = + p_stepLengthNoReset(m, f, t)
* r_fuelUse(commodity, unit, f, t) * abs(r_gen(grid, node, unit, f, t))
* p_nEmission(commodity, emission) * p_nEmission(node, emission)
/ 1e3 // NOTE!!! Conversion to t/MWh from kg/MWh in data
;
// Emissions from unit outputs
r_emissionsFromOutput(grid, node, emission, unit, ft_realizedNoReset(f,startp(t)))
$gnu_output(grid, node, unit)
= + p_stepLengthNoReset(m, f, t)
* r_gen(grid, node, unit, f, t)
* p_nEmission(node, emission)
/ 1e3 // NOTE!!! Conversion to t/MWh from kg/MWh in data / 1e3 // NOTE!!! Conversion to t/MWh from kg/MWh in data
; ;
// Emissions from unit start-ups