Commit 917fb953 authored by Topi Rasku's avatar Topi Rasku
Browse files

#127 UNTESTED: `p_storageValue` separated into constant and timeseries `ts_storageValue` versions.

`p_storageValue` is the constant form parameter, while `ts_storageValue` is the corresponding timeseries. `ts_storageValue_` is also added to handle time step aggregation and data circulation of `ts_storageValue` in the objective function. A new flag in `p_gn` called `storageValueUseTimeSeries` controls whether the constant `p_storageValue` or the timeseries `ts_storageValue` is used.

WIP: I have no clue what the file `1e_scenmChanges.gms` is supposed to do, so no changes have been made there. However, since the input data is affected by these changes, I assume that this file will need to be changed as well for this fix to work properly.
parent 5bf6b384
...@@ -174,6 +174,7 @@ Sets ...@@ -174,6 +174,7 @@ Sets
ts_priceChange ts_priceChange
ts_price ts_price
ts_unavailability ts_unavailability
ts_storageValue
/ /
; // END Sets ; // END Sets
...@@ -221,6 +222,7 @@ param_gn "Possible parameters for grid, node" / ...@@ -221,6 +222,7 @@ param_gn "Possible parameters for grid, node" /
boundStartToEnd "Force the last states to equal the first state" boundStartToEnd "Force the last states to equal the first state"
* 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`"
/ /
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" /
......
...@@ -47,6 +47,7 @@ Scalars ...@@ -47,6 +47,7 @@ Scalars
Parameters Parameters
p_gn(grid, node, param_gn) "Properties for energy nodes" p_gn(grid, node, param_gn) "Properties for energy nodes"
p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, param_gnBoundaryProperties) "Properties of different state boundaries and limits" p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, param_gnBoundaryProperties) "Properties of different state boundaries and limits"
p_storageValue(grid, node) "Constant value of stored something at the end of a time step (EUR/<v_state_unit>)"
p_gnn(grid, node, node, param_gnn) "Data for interconnections between energy nodes" p_gnn(grid, node, node, param_gnn) "Data for interconnections between energy nodes"
p_gnu(grid, node, unit, param_gnu) "Unit data where energy type matters" p_gnu(grid, node, unit, param_gnu) "Unit data where energy type matters"
p_gnu_io(grid, node, unit, input_output, param_gnu) "Unit data where energy type matters" p_gnu_io(grid, node, unit, input_output, param_gnu) "Unit data where energy type matters"
...@@ -162,6 +163,7 @@ Parameters ...@@ -162,6 +163,7 @@ Parameters
ts_cf(flow, node, f, t) "Available capacity factor time series (p.u.)" ts_cf(flow, node, f, t) "Available capacity factor time series (p.u.)"
ts_reserveDemand(restype, up_down, group, f, t) "Reserve demand in region in the time step (MW)" ts_reserveDemand(restype, up_down, group, f, t) "Reserve demand in region in the time step (MW)"
ts_node(grid, node, param_gnBoundaryTypes, f, t) "Fix the states of a node according to time-series form exogenous input ([v_state])" ts_node(grid, node, param_gnBoundaryTypes, f, t) "Fix the states of a node according to time-series form exogenous input ([v_state])"
ts_storageValue(grid, node, f, t) "Timeseries value of stored something at the end of a time step (EUR/<v_state_unit>)"
ts_priceChange(node, t) "Initial commodity price and consequent changes in commodity price (EUR/MWh)" ts_priceChange(node, t) "Initial commodity price and consequent changes in commodity price (EUR/MWh)"
ts_price(node, t) "Commodity price time series (EUR/MWh)" ts_price(node, t) "Commodity price time series (EUR/MWh)"
ts_unavailability(unit, t) "Unavailability of a unit in the time step (p.u.)" ts_unavailability(unit, t) "Unavailability of a unit in the time step (p.u.)"
...@@ -171,6 +173,7 @@ Parameters ...@@ -171,6 +173,7 @@ Parameters
ts_cf_(flow, node, s, f, t) "Mean available capacity factor time series (p.u.)" ts_cf_(flow, node, s, f, t) "Mean available capacity factor time series (p.u.)"
ts_reserveDemand_(restype, up_down, group, f, t) "Mean reserve demand in region in the time step (MW)" ts_reserveDemand_(restype, up_down, group, f, t) "Mean reserve demand in region in the time step (MW)"
ts_node_(grid, node, param_gnBoundaryTypes, s, f, t) "Mean value of ts_node" ts_node_(grid, node, param_gnBoundaryTypes, s, f, t) "Mean value of ts_node"
ts_storageValue_(grid, node, s, f, t) "Mean value of ts_storageValue"
ts_vomCost_(grid, node, unit, t) "Calculated variable O&M cost that includes O&M cost, fuel cost and emission cost" ts_vomCost_(grid, node, unit, t) "Calculated variable O&M cost that includes O&M cost, fuel cost and emission cost"
ts_startupCost_(unit, starttype, t) "Calculated variable startup cost that includes startup cost, fuel cost and emission cost" ts_startupCost_(unit, starttype, t) "Calculated variable startup cost that includes startup cost, fuel cost and emission cost"
...@@ -201,7 +204,6 @@ Parameters ...@@ -201,7 +204,6 @@ Parameters
* --- Other time dependent parameters ----------------------------------------- * --- Other time dependent parameters -----------------------------------------
Parameters Parameters
p_storageValue(grid, node, t) "Value of stored something at the end of a time step"
p_stepLength(mType, f, t) "Length of an interval in hours" p_stepLength(mType, f, t) "Length of an interval in hours"
p_stepLengthNoReset(mType, f, t) "Length of an interval in hours - includes also lengths of previously realized intervals" p_stepLengthNoReset(mType, f, t) "Length of an interval in hours - includes also lengths of previously realized intervals"
p_s_discountFactor(s) "Discount factor for samples when using a multi-year horizon" p_s_discountFactor(s) "Discount factor for samples when using a multi-year horizon"
......
...@@ -66,6 +66,7 @@ $ifthen exist '%input_dir%/inputData.gdx' ...@@ -66,6 +66,7 @@ $ifthen exist '%input_dir%/inputData.gdx'
$$loaddc t_invest $$loaddc t_invest
$$loaddc utAvailabilityLimits $$loaddc utAvailabilityLimits
$$loaddc p_storageValue $$loaddc p_storageValue
$$loaddc ts_storageValue
$$loaddc uGroup $$loaddc uGroup
$$loaddc gnuGroup $$loaddc gnuGroup
$$loaddc gn2nGroup $$loaddc gn2nGroup
......
...@@ -115,23 +115,25 @@ q_obj .. ...@@ -115,23 +115,25 @@ q_obj ..
// Cost of energy storage change (note: not discounted) // Cost of energy storage change (note: not discounted)
+ sum(gn_state(grid, node), + sum(gn_state(grid, node),
+ sum(mft_start(m, f, t)${ p_storageValue(grid, node, t) + sum(mft_start(m, f, t)${ active(m, 'storageValue') },
and active(m, 'storageValue') * sum(ms(m, s)${ p_msft_probability(m, s, f, t) },
}, + [
+ p_storageValue(grid, node, t) + p_storageValue(grid, node)${ not p_gn(grid, node, 'storageValueUseTimeSeries') }
* sum(ms(m, s)${ p_msft_probability(m, s, f, t) }, + ts_storageValue_(grid, node, s, f+df_central(f,t), t)${ p_gn(grid, node, 'storageValueUseTimeSeries') }
+ p_msft_probability(m, s, f, t) ]
* v_state(grid, node, s, f+df_central(f,t), t) * p_msft_probability(m, s, f, t)
) // END sum(s) * v_state(grid, node, s, f+df_central(f,t), t)
) // END sum(s)
) // END sum(mftStart) ) // END sum(mftStart)
- sum(mft_lastSteps(m, f, t)${ p_storageValue(grid, node, t) - sum(mft_lastSteps(m, f, t)${ active(m, 'storageValue') },
and active(m, 'storageValue') * sum(ms(m, s)${p_msft_probability(m, s, f, t)},
}, + [
+ p_storageValue(grid, node, t) + p_storageValue(grid, node)${ not p_gn(grid, node, 'storageValueUseTimeSeries') }
* sum(ms(m, s)${p_msft_probability(m, s, f, t)}, + ts_storageValue_(grid, node, s, f+df_central(f,t), t)${ p_gn(grid, node, 'storageValueUseTimeSeries') }
+ p_msft_probability(m, s, f, t) ]
* v_state(grid, node, s, f+df_central(f,t), t) * p_msft_probability(m, s, f, t)
) // END sum(s) * v_state(grid, node, s, f+df_central(f,t), t)
) // END sum(s)
) // END sum(mftLastSteps) ) // END sum(mftLastSteps)
) // END sum(gn_state) ) // END sum(gn_state)
......
...@@ -424,6 +424,18 @@ $offtext ...@@ -424,6 +424,18 @@ $offtext
+ p_unStartup(unit, node, starttype) // MWh/start-up + p_unStartup(unit, node, starttype) // MWh/start-up
* p_unitEmissionCost(unit, node, emission) // CUR/MWh * p_unitEmissionCost(unit, node, emission) // CUR/MWh
) // END sum(nu, emission) ) // END sum(nu, emission)
// `storageValue`
ts_storageValue_(gn_state(grid, node), sft(s, f, tt_interval(t)))
= sum(tt_aggregate(t, t_),
ts_storageValue(grid, node,
f + ( df_realization(f, t)$(not gn_forecasts(grid, node, 'ts_storageValue'))
+ df_scenario(f, t)$gn_scenarios(grid, node, 'ts_storageValue')),
t_+ (+ dt_scenarioOffset(grid, node, 'ts_storageValue', s)
+ dt_circular(t_)$(not gn_scenarios(grid, node, 'ts_storageValue'))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
); // END loop(counter) ); // END loop(counter)
......
...@@ -78,15 +78,21 @@ loop(m, ...@@ -78,15 +78,21 @@ loop(m,
); // END sum(slack) ); // END sum(slack)
// Storage Value Change // Storage Value Change
r_gnStorageValueChange(gn_state(grid, node))${ sum(t_full(t), p_storageValue(grid, node, t)) } r_gnStorageValueChange(gn_state(grid, node))${ active(m, 'storageValue') }
= 1e-6 = 1e-6
* [ * [
+ sum(ft_realizedNoReset(f,t)${ ord(t) = mSettings(m, 't_end') + 1 }, + sum(ft_realizedNoReset(f,t)${ ord(t) = mSettings(m, 't_end') + 1 },
+ p_storageValue(grid, node, t) + [
+ p_storageValue(grid, node, t)${ not p_gn(grid, node, 'storageValueUseTimeSeries') }
+ ts_storageValue(grid, node, f, t)${ p_gn(grid, node, 'storageValueUseTimeSeries') }
]
* r_state(grid, node, f, t) * r_state(grid, node, f, t)
) // END sum(ft_realizedNoReset) ) // END sum(ft_realizedNoReset)
- sum(ft_realizedNoReset(f,t)${ ord(t) = mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod') }, // INITIAL v_state NOW INCLUDED IN THE RESULTS - sum(ft_realizedNoReset(f,t)${ ord(t) = mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod') }, // INITIAL v_state NOW INCLUDED IN THE RESULTS
+ p_storageValue(grid, node, t) + [
+ p_storageValue(grid, node, t)${ not p_gn(grid, node, 'storageValueUseTimeSeries') }
+ ts_storageValue(grid, node, f, t)${ p_gn(grid, node, 'storageValueUseTimeSeries') }
]
* r_state(grid, node, f, t) * r_state(grid, node, f, t)
) // END sum(ft_realizedNoReset) ) // END sum(ft_realizedNoReset)
]; // END * 1e-6 ]; // END * 1e-6
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment