Commit 17a99771 authored by Niina Helistö's avatar Niina Helistö
Browse files

Merge branch 'trtopi_fix_ramp_constraints' into Fix_ramp_constraints

parents c1aba364 3b6b246e
......@@ -111,13 +111,13 @@ loop(modelSolves(mSolve, tSolve),
$$include 'inc\3d_setVariableLimits.gms' // Set new variable limits (.lo and .up)
$$include 'inc\3e_solve.gms' // Solve model(s)
$$include 'inc\4a_outputVariant.gms' // Store results from the loop
$$iftheni.debug '%debug%' == 'yes'
$iftheni.debug '%debug%' == 'yes'
putclose gdx;
put_utility 'gdxout' / 'output\'mSolve.tl:0, '-', tSolve.tl:0, '.gdx';
execute_unload
$$include defOutput\debugSymbols.inc
;
$$endif.debug
$endif.debug
);
$if exist 'input\3z_modelsClose.gms' $include 'input\3z_modelsClose.gms';
......
This diff is collapsed.
......@@ -20,7 +20,7 @@ $offtext
* =============================================================================
// This is only done if debug mode is not specifically enabled
$$iftheni.debug NOT '%debug%' == 'yes'
$iftheni.debug NOT '%debug%' == 'yes'
* --- Variables ---------------------------------------------------------------
......@@ -30,16 +30,15 @@ $$iftheni.debug NOT '%debug%' == 'yes'
Option clear = v_genRamp;
Option clear = v_transfer;
// Integer Variables
* Option clear = v_online_MIP;
Option clear = v_online_MIP;
Option clear = v_invest_MIP;
Option clear = v_investTransfer_MIP;
// SOS2 Variables
Option clear = v_sos2;
// Positive Variables
Option clear = v_fuelUse;
* Option clear = v_startup;
* Option clear = v_shutdown;
* Option clear = v_genRampChange;
Option clear = v_startup;
Option clear = v_shutdown;
Option clear = v_spill;
Option clear = v_transferRightward;
Option clear = v_transferLeftward;
......@@ -47,7 +46,7 @@ $$iftheni.debug NOT '%debug%' == 'yes'
Option clear = v_resTransferLeftward;
Option clear = v_reserve;
Option clear = v_investTransfer_LP;
* Option clear = v_online_LP;
Option clear = v_online_LP;
Option clear = v_invest_LP;
// Feasibility control
Option clear = v_stateSlack;
......@@ -92,10 +91,8 @@ $$iftheni.debug NOT '%debug%' == 'yes'
Option clear = q_stateSlack;
Option clear = q_stateUpwardLimit;
Option clear = q_stateDownwardLimit;
* q_boundState(grid, node, node, mType, f, t) "Node state variables bounded by other nodes"
Option clear = q_boundStateMaxDiff;
Option clear = q_boundCyclic;
* q_boundCyclicSamples(grid, node, mType, s, f, t, s_, f_, t_) "Cyclic bound inside or between samples"
// Policy
Option clear = q_inertiaMin;
......@@ -475,12 +472,8 @@ p_msft_probability(msft(mSolve, s, f, t))
// Calculate dtt: displacement needed to reach any previous time period (needed to calculate dt_toStartup)
Option clear = dtt;
dtt(t,t_)${ t_active(t)
and t_activeNoReset(t_)
and ord(t_) <= ord(t)
}
= sum(t_activeNoReset(t__)${ord(t__) > ord(t_) and ord(t__) <= ord(t)},
+ dt_noReset(t__));
dtt(t_active(t),t_activeNoReset(t_))${ ord(t_) <= ord(t) }
= ord(t_) - ord(t);
// Calculate dt_toStartup: in case the unit becomes online in the current time period,
// displacement needed to reach the time period where the unit was started up
......@@ -488,11 +481,10 @@ Option clear = dt_toStartup;
loop(unit$(p_u_runUpTimeIntervals(unit)),
loop(t_active(t),
tmp = 1;
loop(t_${ t_activeNoReset(t_) // active or realized time periods
and ord(t_) > ord(t) - p_u_runUpTimeIntervals(unit) // time periods after the start up
and ord(t_) <= ord(t) // time periods before and including the current time period
and tmp = 1
},
loop(t_activeNoReset(t_)${ ord(t_) > ord(t) - p_u_runUpTimeIntervals(unit) // time periods after the start up
and ord(t_) <= ord(t) // time periods before and including the current time period
and tmp = 1
},
if (-dtt(t,t_) < p_u_runUpTimeIntervals(unit), // if the displacement between the two time periods is smaller than the number of time periods required for start-up phase
dt_toStartup(unit, t) = dtt(t,t_ + dt_noReset(t_)); // the displacement to the active or realized time period just before the time period found
tmp = 0;
......
......@@ -178,33 +178,32 @@ v_online_MIP.up(uft_onlineMIP(unit, f, t))${ not unit_investMIP(unit) }
;
// Free the upper bound of start-up and shutdown variables (if previously bounded)
v_startup.up(unitStarttype(unit, starttype), f, t) = inf;
v_shutdown.up(unit, f, t) = inf;
v_startup.up(unitStarttype(unit, starttype), ft(f, t)) = inf;
v_shutdown.up(uft(unit, f, t)) = inf;
// v_startup cannot exceed unitCount
v_startup.up(unitStarttype(unit, starttype), f, t)${uft_online(unit, f, t) and not unit_investLP(unit) and not unit_investMIP(unit) }
v_startup.up(unitStarttype(unit, starttype), ft(f, t))${ uft_online(unit, f, t)
and not unit_investLP(unit)
and not unit_investMIP(unit)
}
= p_unit(unit, 'unitCount')
;
// Cannot start a unit if the time when the unit would become online is outside
// the horizon when the unit has an online variable
v_startup.up(unitStarttype(unit, starttype), f, t)${ uft_online(unit, f, t)
and not sum(t_active(t_)${ord(t) = ord(t_) + dt_toStartup(unit,t_)}, uft_online(unit, f, t_))
}
v_startup.up(unitStarttype(unit, starttype), ft(f, t))${ uft_online(unit, f, t)
and not sum(t_active(t_)${ord(t) = ord(t_) + dt_toStartup(unit,t_)}, uft_online(unit, f, t_))
}
= 0;
// Cannot start up or shut down a unit if the time time step is not active in the current horizon
v_startup.up(unitStarttype(unit, starttype), f, t)${ sum(ft(f_, t_), uft_online(unit, f_, t_))
and mf(mSolve, f)
and ord(t) > tSolveFirst
and ord(t) <= tSolveLast
and not t_active(t)
}
v_startup.up(unitStarttype(unit, starttype), ft(f, t))${ ord(t) > tSolveFirst
and ord(t) <= tSolveLast
and not t_active(t)
}
= 0;
v_shutdown.up(unit, f, t)${ sum(ft(f_, t_), uft_online(unit, f_, t_))
and mf(mSolve, f)
and ord(t) > tSolveFirst
and ord(t) <= tSolveLast
and not t_active(t)
}
v_shutdown.up(uft(unit, f, t))${ ord(t) > tSolveFirst
and ord(t) <= tSolveLast
and not t_active(t)
}
= 0;
//These might speed up, but they should be applied only to the new part of the horizon (should be explored)
......@@ -421,6 +420,7 @@ loop(mft_start(mSolve, f, t),
// Fix previously realized start-up and shutdown decisions.
// Needed for modelling hot and warm start-ups, minimum uptimes and downtimes, and run-up phases.
$ontext
v_startup.up(unitStarttype(unit, starttype), f, t)${ sum(ft(f_, t_), uft_online(unit, f_, t_))
and mf_realization(mSolve, f)
and ord(t) <= tSolveFirst
......@@ -433,6 +433,7 @@ v_shutdown.up(unit, f, t)${ sum(ft(f_, t_), uft_online(unit, f_, t_))
}
= 0
;
$offtext
v_startup.fx(unitStarttype(unit, starttype), ft_realizedNoReset(f, t))${ ord(t) <= tSolveFirst
and sum[ft(f_,t_), uft_online(unit,f_,t_)]
}
......@@ -446,14 +447,14 @@ v_shutdown.fx(unit, ft_realizedNoReset(f, t))${ ord(t) <= tSolveFirst
;
v_online_MIP.fx(unit,ft_realizedNoReset(f, t))${ ord(t) <= tSolveFirst
and sum[ft(f_,t_), uft_onlineMIP(unit,f_,t_)]
}
= v_online_MIP.l(unit, f, t);
v_online_LP.fx(unit,ft_realizedNoReset(f, t))${ ord(t) <= tSolveFirst
and sum[ft(f_,t_), uft_onlineLP(unit,f_,t_)]
}
= v_online_LP.l(unit, f, t);
v_online_MIP.fx(unit, ft_realizedNoReset(f, t))${ ord(t) <= tSolveFirst
and sum[ft(f_,t_), uft_onlineMIP(unit,f_,t_)]
}
= r_online(unit, f, t);
v_online_LP.fx(unit, ft_realizedNoReset(f, t))${ ord(t) <= tSolveFirst
and sum[ft(f_,t_), uft_onlineLP(unit,f_,t_)]
}
= r_online(unit, f, t);
// BoundStartToEnd
v_state.fx(grid, node, ft(f,t))${ mft_lastSteps(mSolve, f, t)
......
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