Commit 8db6faca authored by Niina Helistö's avatar Niina Helistö
Browse files

Renaming sets and parameters and adding checks related to issue #119.

parent 355a467a
......@@ -322,8 +322,8 @@ param_unit "Set of possible data parameters for units" /
minUnitCount "Minimum number of units when making integer investments"
// Calculated based on other input data
lastStepNotAggregated "Last time step when the unit is not yet aggregated - calculated in inputsLoop.gms for units that have aggregation"
start "The relative position of the time step when the unit becomes available (calculated from ut(unit, t, start_end))"
end "The relative position of the time step when the unit becomes unavailable (calculated from ut(unit, t, start_end))"
becomeAvailable "The relative position of the time step when the unit becomes available (calculated from ut(unit, t, start_end))"
becomeUnavailable "The relative position of the time step when the unit becomes unavailable (calculated from ut(unit, t, start_end))"
/
param_eff "Parameters used for unit efficiency approximations" /
......@@ -413,6 +413,6 @@ useConstantOrTimeSeries(param_gnBoundaryProperties) "useTimeSeries and useConsta
// Directional sets that are subsets of others
up_down(param_policy) "Direction set used by some variables, e.g. reserve provisions and generation ramps"
/ up, down /
start_end(param_unit) "Start and end, e.g. of unit lifetime"
/ start, end /
availabilityLimits(param_unit) "Start and end, e.g. of unit lifetime"
/ becomeAvailable, becomeUnavailable /
; // END parameter set declarations
......@@ -161,7 +161,7 @@ $if defined scenario
unitCounter(unit, counter) "Counter used for restricting excessive looping over the counter set when defining unit startup/shutdown/online time restrictions"
runUpCounter(unit, counter) "Counter used for unit run-up intervals"
shutdownCounter(unit, counter) "Counter used for unit shutdown intervals"
ut(unit, t, start_end) "Time step when the unit becomes available/unavailable, e.g. because of technical lifetime"
utAvailabilityLimits(unit, t, availabilityLimits) "Time step when the unit becomes available/unavailable, e.g. because of technical lifetime"
* --- Sets used for grouping of units, transfer links, nodes, etc. ------------
uGroup(unit, group) "Units in particular groups"
......
......@@ -204,5 +204,5 @@ 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_stepLengthNoReset(mType, f, t) "Length of an interval in hours - includes also lengths of previously realized intervals"
p_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"
;
......@@ -62,9 +62,9 @@ $ifthen exist '%input_dir%/inputData.gdx'
$$loaddc ts_priceChange
$$loaddc ts_influx
$$loaddc ts_node
$$loaddc p_discountFactor
$$loaddc p_s_discountFactor
$$loaddc t_invest
$$loaddc ut
$$loaddc utAvailabilityLimits
$$loaddc p_storageValue
$$loaddc uGroup
$$loaddc gnuGroup
......@@ -272,8 +272,8 @@ p_unitEmissionCost(unit, node, emission)${nu(node, unit) and p_nEmission(node, e
// Unit lifetime
loop(ut(unit, t, start_end),
p_unit(unit, start_end) = ord(t)
loop(utAvailabilityLimits(unit, t, availabilityLimits),
p_unit(unit, availabilityLimits) = ord(t)
); // END loop(ut)
* =============================================================================
......@@ -616,6 +616,25 @@ loop( (gnu(grid, node, unit), restypeDirection(restype, up_down)),
); // END if(p_gnuReserves)
); // END loop((gnu,restypeDirection))
* --- Check investment related data -------------------------------------------
// Check that units with LP investment possibility have unitSize
loop( unit_investLP(unit),
if(not sum(gnu(grid, node, unit), abs(p_gnu(grid, node, unit, 'unitSize'))),
put log '!!! Error occurred on unit ', unit.tl:0 /;
put log '!!! Abort: Unit is listed as an investment option but it has no unitSize!' /;
abort "All units with investment possibility should have 'unitSize' in p_gnu!"
); // END if
); // END loop(unit_investLP)
// Check that units with MIP investment possibility have unitSize
loop( unit_investMIP(unit),
if(not sum(gnu(grid, node, unit), abs(p_gnu(grid, node, unit, 'unitSize'))),
put log '!!! Error occurred on unit ', unit.tl:0 /;
put log '!!! Abort: Unit is listed as an investment option but it has no unitSize!' /;
abort "All units with investment possibility should have 'unitSize' in p_gnu!"
); // END if
); // END loop(unit_investMIP)
* =============================================================================
* --- Default values ---------------------------------------------------------
......
......@@ -110,7 +110,7 @@ q_obj ..
] // END * p_sft_probability(s,f,t)
* p_discountFactor(s) // Discount costs
* p_s_discountFactor(s) // Discount costs
) // END sum over msft(m, s, f, t)
// Cost of energy storage change (note: not discounted)
......@@ -177,7 +177,7 @@ q_obj ..
) // END sum(t_invest)
* p_msAnnuityWeight(m, s) // Sample weighting to calculate annual costs
* p_discountFactor(s) // Discount costs
* p_s_discountFactor(s) // Discount costs
) // END sum(ms)
$ifthen.addterms exist '%input_dir%/2c_additional_objective_terms.gms'
......
......@@ -725,5 +725,24 @@ loop(m, // Not ideal, but multi-model functionality is not yet implemented
); // END if()
); // END if
* --- Check investment related data -------------------------------------------
loop( unit_investLP(unit),
// Check that the investment decisions are not by accident fixed to zero in 3d_setVariableLimits.gms
if(p_unit(unit, 'becomeAvailable') <= mSettings(m, 't_start'),
put log '!!! Error occurred on unit ', unit.tl:0 /;
put log '!!! Abort: Unit with investment possibility should not become available before t_start!' /;
abort "The 'utAvailabilityLimits(unit, t, 'becomeAvailable')' should correspond to a timestep in the model without the initial timestep!"
); // END if
); // END loop(unit_investLP)
loop( unit_investMIP(unit),
// Check that the investment decisions are not by accident fixed to zero in 3d_setVariableLimits.gms
if(p_unit(unit, 'becomeAvailable') <= mSettings(m, 't_start'),
put log '!!! Error occurred on unit ', unit.tl:0 /;
put log '!!! Abort: Unit with investment possibility should not become available before t_start!' /;
abort "The 'utAvailabilityLimits(unit, t, 'becomeAvailable')' should correspond to a timestep in the model without the initial timestep!"
); // END if
); // END loop(unit_investMIP)
); // END loop(m)
......@@ -26,7 +26,7 @@ Option clear = v_gen;
Option clear = v_state;
Option clear = v_genRamp;
Option clear = v_transfer;
Option clear = v_ICramp;
Option clear = v_ICramp;
// Integer Variables
Option clear = v_online_MIP;
Option clear = v_invest_MIP;
......@@ -566,8 +566,8 @@ uft(unit, ft(f, t))${ ( [
= yes;
// Units are not active before or after their lifetime
uft(unit, ft(f, t))${ [ ord(t) < p_unit(unit, 'start') and p_unit(unit, 'start') ]
or [ ord(t) >= p_unit(unit, 'end') and p_unit(unit, 'end') ]
uft(unit, ft(f, t))${ [ ord(t) < p_unit(unit, 'becomeAvailable') and p_unit(unit, 'becomeAvailable') ]
or [ ord(t) >= p_unit(unit, 'becomeUnavailable') and p_unit(unit, 'becomeUnavailable') ]
}
= no;
......
......@@ -558,10 +558,10 @@ if( tSolveFirst <> mSettings(mSolve, 't_start'), // Avoid rewriting the fixes on
* --- Fix previously realized investment results ------------------------------
* =============================================================================
v_invest_LP.fx(unit_investLP(unit), t_invest(t))${ p_unit(unit, 'start') <= tSolveFirst } // Should this be ord(t) <= tSolveFirst?
v_invest_LP.fx(unit_investLP(unit), t_invest(t))${ p_unit(unit, 'becomeAvailable') <= tSolveFirst }
= r_invest(unit, t)
;
v_invest_MIP.fx(unit_investMIP(unit), t_invest(t))${ p_unit(unit, 'start') <= tSolveFirst } // Should this be ord(t) <= tSolveFirst?
v_invest_MIP.fx(unit_investMIP(unit), t_invest(t))${ p_unit(unit, 'becomeAvailable') <= tSolveFirst }
= r_invest(unit, t)
;
v_investTransfer_LP.fx(gn2n_directional(grid, node, node_), t_invest(t))${ not p_gnn(grid, node, node_, 'investMIP')
......
......@@ -97,28 +97,28 @@ loop(m,
r_gnuTotalVOMCost(gnu_output(grid, node, unit))
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gnuVOMCost(grid, node, unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_discountFactor(s))
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_s_discountFactor(s))
);
// Total fuel & emission costs
r_uTotalFuelEmissionCost(commodity, unit)$un_commodity(unit, commodity)
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_uFuelEmissionCost(commodity, unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_discountFactor(s))
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_s_discountFactor(s))
);
// Total unit startup costs
r_uTotalStartupCost(unit)${ sum(starttype, unitStarttype(unit, starttype)) }
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_uStartupCost(unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_discountFactor(s))
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_s_discountFactor(s))
);
// Total state variable slack costs
r_gnTotalStateSlackCost(gn_stateSlack(grid, node))
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gnStateSlackCost(grid, node, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_discountFactor(s))
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_s_discountFactor(s))
);
// Fixed O&M costs
......@@ -133,7 +133,7 @@ loop(m,
* p_gnu(grid, node, unit, 'unitSize')
]
* p_msAnnuityWeight(m, s) // Sample weighting to calculate annual costs
* p_discountFactor(s) // Discount costs
* p_s_discountFactor(s) // Discount costs
) // END * sum(ms)
* p_gnu(grid, node, unit, 'fomCosts');
......@@ -145,7 +145,7 @@ loop(m,
+ r_invest(unit, t)$sum(msft_realizedNoReset(m, s, f, t_), uft(unit, f, t_)) // only units active in msft_realizedNoReset
)
* p_msAnnuityWeight(m, s) // Sample weighting to calculate annual costs
* p_discountFactor(s) // Discount costs
* p_s_discountFactor(s) // Discount costs
) // END * sum(ms)
* p_gnu(grid, node, unit, 'unitSize')
* p_gnu(grid, node, unit, 'invCosts')
......@@ -159,7 +159,7 @@ loop(m,
+ r_investTransfer(grid, from_node, to_node, t)
)
* p_msAnnuityWeight(m, s) // Sample weighting to calculate annual costs
* p_discountFactor(s) // Discount costs
* p_s_discountFactor(s) // Discount costs
) // END * sum(ms)
* [
+ p_gnn(grid, from_node, to_node, 'invCost')
......@@ -412,7 +412,7 @@ r_gnTotalSpillShare(gn(grid, node_spill))${ r_gTotalSpill(grid) > 0 }
r_gnTotalRealizedOperatingCost(gn(grid, node))
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gnRealizedOperatingCost(grid, node, f ,t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_discountFactor(s))
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s) * p_s_discountFactor(s))
);
// Total realized net operating costs on each gn over the simulation
......
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