Commit 1023101c authored by Topi Rasku's avatar Topi Rasku
Browse files

Merge branch 'nhniina_boundCyclic' into 'dev'

Nhniina bound cyclic

See merge request !7
parents 557afd88 b795a12d
...@@ -54,6 +54,8 @@ if (mType('building'), ...@@ -54,6 +54,8 @@ if (mType('building'),
// Define the probability (weight) of samples // Define the probability (weight) of samples
p_msProbability('building', s) = 0; p_msProbability('building', s) = 0;
p_msProbability('building', 's000') = 1; p_msProbability('building', 's000') = 1;
p_msWeight('building', s) = 0;
p_msWeight('building', 's000') = 1;
* --- Define Time Step Intervals ---------------------------------------------- * --- Define Time Step Intervals ----------------------------------------------
......
...@@ -58,9 +58,13 @@ if (mType('invest'), ...@@ -58,9 +58,13 @@ if (mType('invest'),
// Define the probability (weight) of samples // Define the probability (weight) of samples
p_msProbability('invest', s) = 0; p_msProbability('invest', s) = 0;
p_msProbability('invest', 's000') = 8760/504; p_msProbability('invest', 's000') = 1;
p_msProbability('invest', 's001') = 8760/504; p_msProbability('invest', 's001') = 1;
p_msProbability('invest', 's002') = 8760/504; p_msProbability('invest', 's002') = 1;
p_msWeight('invest', s) = 0;
p_msWeight('invest', 's000') = 8760/504;
p_msWeight('invest', 's001') = 8760/504;
p_msWeight('invest', 's002') = 8760/504;
* --- Define Time Step Intervals ---------------------------------------------- * --- Define Time Step Intervals ----------------------------------------------
......
...@@ -64,6 +64,8 @@ if (mType('schedule'), ...@@ -64,6 +64,8 @@ if (mType('schedule'),
// Define the probability (weight) of samples // Define the probability (weight) of samples
p_msProbability('schedule', s) = 0; p_msProbability('schedule', s) = 0;
p_msProbability('schedule', 's000') = 1; p_msProbability('schedule', 's000') = 1;
p_msWeight('schedule', s) = 0;
p_msWeight('schedule', 's000') = 1;
// If using long-term samples, uncomment // If using long-term samples, uncomment
//ms_central('schedule', 's001') = yes; //ms_central('schedule', 's001') = yes;
......
...@@ -92,7 +92,7 @@ Parameters ...@@ -92,7 +92,7 @@ Parameters
* --- Probability ------------------------------------------------------------- * --- Probability -------------------------------------------------------------
Parameters Parameters
p_msWeight(mType, s) "Weight of sample" p_msWeight(mType, s) "Temporal weight of sample: number of similar periods represented by sample s"
p_msProbability(mType, s) "Probability to reach sample conditioned on anchestor samples" p_msProbability(mType, s) "Probability to reach sample conditioned on anchestor samples"
p_mfProbability(mType, f) "Probability of forecast" p_mfProbability(mType, f) "Probability of forecast"
p_msft_probability(mType, s, f, t) "Probability of forecast" p_msft_probability(mType, s, f, t) "Probability of forecast"
......
...@@ -2118,7 +2118,7 @@ q_boundCyclic(gnss_bound(gn_state(grid, node), s_, s), m) ...@@ -2118,7 +2118,7 @@ q_boundCyclic(gnss_bound(gn_state(grid, node), s_, s), m)
and tSolveFirst = mSettings(m, 't_start') and tSolveFirst = mSettings(m, 't_start')
}.. }..
// Initial value of the state of the node at the start of the sample // Initial value of the state of the node at the start of the sample s
+ sum(mst_start(m, s, t), + sum(mst_start(m, s, t),
+ sum(sft(s, f, t), + sum(sft(s, f, t),
+ v_state(grid, node, s, f+df(f,t+dt(t)), t+dt(t)) + v_state(grid, node, s, f+df(f,t+dt(t)), t+dt(t))
...@@ -2127,12 +2127,28 @@ q_boundCyclic(gnss_bound(gn_state(grid, node), s_, s), m) ...@@ -2127,12 +2127,28 @@ q_boundCyclic(gnss_bound(gn_state(grid, node), s_, s), m)
=E= =E=
// State of the node at the end of the sample // Initial value of the state of the node at the start of the sample s_
+ sum(mst_end(m, s_, t_), + sum(mst_start(m, s_, t),
+ sum(sft(s_, f_, t_), + sum(sft(s_, f, t),
+ v_state(grid, node, s_, f_, t_) + v_state(grid, node, s_, f+df(f,t+dt(t)), t+dt(t))
) // END sum(ft) ) // END sum(ft)
) // END sum(mst_end) ) // END sum(mst_start)
// Change in the state value over the sample s_, multiplied by sample s_ temporal weight
+ p_msWeight(m, s_)
* [
// State of the node at the end of the sample s_
+ sum(mst_end(m, s_, t),
+ sum(sft(s_, f, t),
+ v_state(grid, node, s_, f, t)
) // END sum(ft)
) // END sum(mst_end)
// State of the node at the end of the sample s_
- sum(mst_start(m, s_, t),
+ sum(sft(s_, f, t),
+ v_state(grid, node, s_, f+df(f,t+dt(t)), t+dt(t))
) // END sum(ft)
) // END sum(mst_start)
] // END * p_msWeight(m, s_)
; ;
*--- Minimum Inertia ---------------------------------------------------------- *--- Minimum Inertia ----------------------------------------------------------
......
...@@ -422,7 +422,8 @@ Option clear = p_msft_probability; ...@@ -422,7 +422,8 @@ Option clear = p_msft_probability;
p_msft_probability(msft(mSolve, s, f, t)) p_msft_probability(msft(mSolve, s, f, t))
= p_mfProbability(mSolve, f) = p_mfProbability(mSolve, f)
/ sum(f_${ft(f_, t)}, / sum(f_${ft(f_, t)},
p_mfProbability(mSolve, f_)) * p_msProbability(mSolve, s); p_mfProbability(mSolve, f_)) * p_msProbability(mSolve, s)
* p_msWeight(mSolve, s);
* --- Calculate sample displacements ------------------------------------------ * --- Calculate sample displacements ------------------------------------------
...@@ -454,4 +455,4 @@ if(mSettings(mSolve, 'scenarios'), // Only do smooting if using long-term scena ...@@ -454,4 +455,4 @@ if(mSettings(mSolve, 'scenarios'), // Only do smooting if using long-term scena
$$batinclude 'inc/smoothing.gms' ts_influx $$batinclude 'inc/smoothing.gms' ts_influx
$$batinclude 'inc/smoothing.gms' ts_cf $$batinclude 'inc/smoothing.gms' ts_cf
); );
); // END if('scenarios') ); // END if('scenarios')
\ No newline at end of file
...@@ -96,35 +96,35 @@ loop(m, ...@@ -96,35 +96,35 @@ loop(m,
r_gnuTotalVOMCost(gnu_output(grid, node, unit)) r_gnuTotalVOMCost(gnu_output(grid, node, unit))
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gnuVOMCost(grid, node, unit, f, t) + r_gnuVOMCost(grid, node, unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
); );
// Total fuel & emission costs // Total fuel & emission costs
r_uTotalFuelEmissionCost(fuel, unit)${ uFuel(unit, 'main', fuel) } r_uTotalFuelEmissionCost(fuel, unit)${ uFuel(unit, 'main', fuel) }
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_uFuelEmissionCost(fuel, unit, f, t) + r_uFuelEmissionCost(fuel, unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
); );
// Total unit startup costs // Total unit startup costs
r_uTotalStartupCost(unit)${ sum(starttype, unitStarttype(unit, starttype)) } r_uTotalStartupCost(unit)${ sum(starttype, unitStarttype(unit, starttype)) }
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_uStartupCost(unit, f, t) + r_uStartupCost(unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
); );
// Total state variable slack costs // Total state variable slack costs
r_gnTotalStateSlackCost(gn_stateSlack(grid, node)) r_gnTotalStateSlackCost(gn_stateSlack(grid, node))
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gnStateSlackCost(grid, node, f, t) + r_gnStateSlackCost(grid, node, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
); );
// Fixed O&M costs // Fixed O&M costs
r_gnuFOMCost(gnu(grid, node, unit)) r_gnuFOMCost(gnu(grid, node, unit))
= 1e-6 // Scaling to MEUR = 1e-6 // Scaling to MEUR
* [ * [
+ p_gnu(grid, node, unit, 'maxGen') // Not in v_obj + p_gnu(grid, node, unit, 'maxGen') // Not in v_obj
+ p_gnu(grid, node, unit, 'maxCons') // Not in v_obj + p_gnu(grid, node, unit, 'maxCons') // Not in v_obj
+ r_invest(unit) + r_invest(unit)
* p_gnu(grid, node, unit, 'unitSizeTot') * p_gnu(grid, node, unit, 'unitSizeTot')
...@@ -196,7 +196,7 @@ loop(m, ...@@ -196,7 +196,7 @@ loop(m,
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gen(grid, node, unit, f, t) + r_gen(grid, node, unit, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
// Energy generation by fuels // Energy generation by fuels
...@@ -219,7 +219,7 @@ loop(m, ...@@ -219,7 +219,7 @@ loop(m,
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_genFuel(grid, node, fuel, f, t) + r_genFuel(grid, node, fuel, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
// Total dummy generation/consumption // Total dummy generation/consumption
...@@ -227,7 +227,7 @@ loop(m, ...@@ -227,7 +227,7 @@ loop(m,
= sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_qGen(inc_dec, grid, node, f, t) + r_qGen(inc_dec, grid, node, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
* --- Total Unit Online Results ----------------------------------------------- * --- Total Unit Online Results -----------------------------------------------
...@@ -237,7 +237,7 @@ loop(m, ...@@ -237,7 +237,7 @@ loop(m,
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_online(unit, f, t) + r_online(unit, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
// Approximate utilization rates for gnus over the simulation // Approximate utilization rates for gnus over the simulation
...@@ -256,7 +256,7 @@ loop(m, ...@@ -256,7 +256,7 @@ loop(m,
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_reserve(restype, up_down, node, unit, f, t) + r_reserve(restype, up_down, node, unit, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
// Total dummy reserve provisions over the simulation // Total dummy reserve provisions over the simulation
...@@ -264,7 +264,7 @@ loop(m, ...@@ -264,7 +264,7 @@ loop(m,
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_qResDemand(restype, up_down, node, f, t) + r_qResDemand(restype, up_down, node, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
* --- Total Transfer and Spill ------------------------------------------------ * --- Total Transfer and Spill ------------------------------------------------
...@@ -274,7 +274,7 @@ loop(m, ...@@ -274,7 +274,7 @@ loop(m,
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_transfer(grid, from_node, to_node, f, t) + r_transfer(grid, from_node, to_node, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
// Total energy spill from nodes // Total energy spill from nodes
...@@ -282,7 +282,7 @@ loop(m, ...@@ -282,7 +282,7 @@ loop(m,
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_spill(grid, node, f, t) + r_spill(grid, node, f, t)
* p_stepLengthNoReset(m, f, t) * p_stepLengthNoReset(m, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
* ============================================================================= * =============================================================================
...@@ -331,7 +331,7 @@ r_gTotalqGen(inc_dec, grid) ...@@ -331,7 +331,7 @@ r_gTotalqGen(inc_dec, grid)
r_gnTotalConsumption(gn(grid, node)) r_gnTotalConsumption(gn(grid, node))
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gnConsumption(grid, node, f ,t) + r_gnConsumption(grid, node, f ,t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
); );
// Total consumption in each grid over the simulation // Total consumption in each grid over the simulation
...@@ -375,7 +375,7 @@ r_gnTotalSpillShare(gn(grid, node_spill))${ r_gTotalSpill(grid) > 0 } ...@@ -375,7 +375,7 @@ r_gnTotalSpillShare(gn(grid, node_spill))${ r_gTotalSpill(grid) > 0 }
r_gnTotalRealizedOperatingCost(gn(grid, node)) r_gnTotalRealizedOperatingCost(gn(grid, node))
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_gnRealizedOperatingCost(grid, node, f ,t) + r_gnRealizedOperatingCost(grid, node, f ,t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s)) * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
); );
// Total realized net operating costs on each gn over the simulation // Total realized net operating costs on each gn over the simulation
...@@ -473,14 +473,14 @@ r_uTotalOnlinePerUnit(unit)${ p_unit(unit, 'unitCount') > 0 } ...@@ -473,14 +473,14 @@ r_uTotalOnlinePerUnit(unit)${ p_unit(unit, 'unitCount') > 0 }
r_uTotalStartup(unit, starttype) r_uTotalStartup(unit, starttype)
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_startup(unit, starttype, f, t) + r_startup(unit, starttype, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
// Total sub-unit shutdowns over the simulation // Total sub-unit shutdowns over the simulation
r_uTotalShutdown(unit) r_uTotalShutdown(unit)
= sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')], = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
+ r_shutdown(unit, f, t) + r_shutdown(unit, f, t)
* sum(msft_realizedNoReset(m, s, f, t), p_msProbability(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)
* --- Diagnostic Results ------------------------------------------------------ * --- Diagnostic Results ------------------------------------------------------
......
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