Commit 04accb9a authored by Topi Rasku's avatar Topi Rasku
Browse files

Issue #32: Slightly cleaning up the trajectory equations by separating...

Issue #32: Slightly cleaning up the trajectory equations by separating 'p_uCounter_runUp' and 'p_uCounter_shutdown' into minimum and maximum arrays to avoid doing partial time step calculations in '2b_constraints.gms'
parent 09e96080
......@@ -57,11 +57,13 @@ p_uStartup
p_u_maxOutputInLastRunUpInterval
p_u_runUpTimeIntervals
dt_toStartup
p_uCounter_runUp
p_uCounter_runUpMin
p_uCounter_runUpMax
p_u_maxOutputInFirstShutdownInterval
p_u_shutdownTimeIntervals
dt_toShutdown
p_uCounter_shutdown
p_uCounter_shutdownMin
p_uCounter_shutdownMax
* Variables
v_obj
......
......@@ -68,11 +68,13 @@ Parameters
p_u_maxRampSpeedInLastRunUpInterval(unit) "Maximum ramp speed in the last interval for the run-up to min. load (p.u.)"
p_u_runUpTimeIntervals(unit) "Time steps required for the run-up phase"
p_u_runUpTimeIntervalsCeil(unit) "Ceiling of time steps required for the run-up phase"
p_uCounter_runUp(unit, counter) "Output for the time steps where the unit is being started up to the minimum load (minimum output in the last interval) (p.u.)"
p_uCounter_runUpMin(unit, counter) "Minimum output for the time steps where the unit is being started up to the minimum load (minimum output in the last interval) (p.u.)"
p_uCounter_runUpMax(unit, counter) "Maximum output for the time steps where the unit is being started up to the minimum load (minimum output in the last interval) (p.u.)"
p_u_maxOutputInFirstShutdownInterval(unit) "Maximum output in the first interval for the shutdown from min. load (p.u.)"
p_u_shutdownTimeIntervals(unit) "Time steps required for the shutdown phase"
p_u_shutdownTimeIntervalsCeil(unit) "Floor of time steps required for the shutdown phase"
p_uCounter_shutdown(unit, counter) "Output for the time steps where the unit is being shut down from the minimum load (minimum output in the first interval) (p.u.)"
p_uCounter_shutdownMin(unit, counter) "Minimum output for the time steps where the unit is being shut down from the minimum load (minimum output in the first interval) (p.u.)"
p_uCounter_shutdownMax(unit, counter) "Maximum output for the time steps where the unit is being shut down from the minimum load (minimum output in the first interval) (p.u.)"
// Time dependent unit & fuel parameters
ts_unit(unit, *, f, t) "Time dependent unit data, where energy type doesn't matter"
ts_effUnit(effSelector, unit, effSelector, *, f, t) "Time dependent data for piece-wise linear efficiency blocks"
......
......@@ -259,7 +259,7 @@ q_maxDownward(m, s, gnuft(grid, node, unit, f, t))${msft(m, s, f, t)
* sum(unitStarttype(unit, starttype)${uft_startupTrajectory(unit, f, t)},
sum(runUpCounter(unit, counter)${t_active(t+dt_trajectory(counter))}, // Sum over the run-up intervals
+ v_startup(unit, starttype, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* p_uCounter_runUp(unit, counter)
* p_uCounter_runUpMin(unit, counter)
) // END sum(runUpCounter)
) // END sum(unitStarttype)
......@@ -267,7 +267,7 @@ q_maxDownward(m, s, gnuft(grid, node, unit, f, t))${msft(m, s, f, t)
+ p_gnu(grid, node, unit, 'unitSizeGen')
* sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* p_uCounter_shutdown(unit, counter)
* p_uCounter_shutdownMin(unit, counter)
) // END sum(shutdownCounter)
// Consuming units, greater than maxCons
......@@ -380,11 +380,7 @@ q_maxUpward(m, s, gnuft(grid, node, unit, f, t))${msft(m, s, f, t)
* sum(unitStarttype(unit, starttype)${uft_startupTrajectory(unit, f, t)},
sum(runUpCounter(unit, counter)${t_active(t+dt_trajectory(counter))}, // Sum over the run-up intervals
+ v_startup(unit, starttype, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* [
+ p_uCounter_runUp(unit, counter)
+ ( 1 - p_uCounter_runUp(unit, counter) )${ not runUpCounter(unit, counter+1) } // Final run-up phase can potentially ramp over the min load
* ( p_u_runUpTimeIntervalsCeil(unit) - p_u_runUpTimeIntervals(unit) )
]
* p_uCounter_runUpMax(unit, counter)
) // END sum(runUpCounter)
) // END sum(unitStarttype)
......@@ -392,7 +388,7 @@ q_maxUpward(m, s, gnuft(grid, node, unit, f, t))${msft(m, s, f, t)
+ p_gnu(grid, node, unit, 'unitSizeGen')
* sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* p_uCounter_shutdown(unit, counter)
* p_uCounter_shutdownMax(unit, counter)
) // END sum(shutdownCounter)
;
......@@ -728,20 +724,20 @@ q_rampDownLimit(m, s, gnuft_ramp(grid, node, unit, f, t))${ ord(t) > msStart(m,
// Units in shutdown phase need to keep up with the shutdown ramp rate
- p_gnu(grid, node, unit, 'unitSizeGen')
* sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* [
+ p_unit(unit, 'rampSpeedFromMinLoad')
+ ( p_gnu(grid, node, unit, 'maxRampDown') - p_unit(unit, 'rampSpeedFromMinLoad') )${ not shutdownCounter(unit, counter-1) } // Ramp speed adjusted for the first shutdown interval
* ( p_u_shutdownTimeIntervalsCeil(unit) - p_u_shutdownTimeIntervals(unit) )
]
* 60 // Unit conversion from [p.u./min] to [p.u./h]
* [
+ sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* [
+ p_unit(unit, 'rampSpeedFromMinLoad')
+ ( p_gnu(grid, node, unit, 'maxRampDown') - p_unit(unit, 'rampSpeedFromMinLoad') )${ not shutdownCounter(unit, counter-1) } // Ramp speed adjusted for the first shutdown interval
* ( p_u_shutdownTimeIntervalsCeil(unit) - p_u_shutdownTimeIntervals(unit) )
]
) // END sum(shutdownCounter)
// Units need to be able to shut down after shut down trajectory
+ v_shutdown(unit, s, f+df(f, t+dt_toShutdown(unit, t)), t+dt_toShutdown(unit, t))
* p_unit(unit, 'rampSpeedFromMinload') * 60 // Unit conversion from [p.u./min] to [p.u./h]
* ( 1 - p_u_shutdownTimeIntervalsCeil(unit) + p_u_shutdownTimeIntervals(unit) ) // Adjusted to prevent other sub-units from ramping excessively
/ p_stepLength(m, f, t)
) // END sum(shutdownCounter)
* p_unit(unit, 'rampSpeedFromMinload')
]
* 60 // Unit conversion from [p.u./min] to [p.u./h]
;
* --- Ramps separated into upward and downward ramps --------------------------
......@@ -821,16 +817,21 @@ q_rampSlack(m, s, gnuft_rampCost(grid, node, unit, slack, f, t))${ ord(t) > msS
* 60 // Unit conversion from [p.u./min] to [p.u./h]
// Units in shutdown phase need to keep up with the shutdown ramp rate
- p_gnu(grid, node, unit, 'unitSizeGen')
* sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* [
+ p_unit(unit, 'rampSpeedFromMinLoad')
+ ( p_gnuBoundaryProperties(grid, node, unit, slack, 'rampLimit') - p_unit(unit, 'rampSpeedFromMinLoad') )${ not shutdownCounter(unit, counter-1) } // Ramp speed adjusted for the first shutdown interval
* ( p_u_shutdownTimeIntervalsCeil(Unit) - p_u_shutdownTimeIntervals(unit) )
]
* 60 // Unit conversion from [p.u./min] to [p.u./h]
) // END sum(shutdownCounter)
+ p_gnu(grid, node, unit, 'unitSizeGen')
* [
+ sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* [
+ p_unit(unit, 'rampSpeedFromMinLoad')
+ ( p_gnu(grid, node, unit, 'maxRampDown') - p_unit(unit, 'rampSpeedFromMinLoad') )${ not shutdownCounter(unit, counter-1) } // Ramp speed adjusted for the first shutdown interval
* ( p_u_shutdownTimeIntervalsCeil(unit) - p_u_shutdownTimeIntervals(unit) )
]
) // END sum(shutdownCounter)
// Units need to be able to shut down after shut down trajectory
+ v_shutdown(unit, s, f+df(f, t+dt_toShutdown(unit, t)), t+dt_toShutdown(unit, t))
* p_unit(unit, 'rampSpeedFromMinload')
]
* 60 // Unit conversion from [p.u./min] to [p.u./h]
;
* --- Fixed Output Ratio ------------------------------------------------------
......@@ -903,14 +904,14 @@ q_conversionDirectInputOutput(s, suft(effDirect(effGroup), unit, f, t))$sft(s, f
+ sum(unitStarttype(unit, starttype)${uft_startupTrajectory(unit, f, t)},
+ sum(runUpCounter(unit, counter)${t_active(t+dt_trajectory(counter))}, // Sum over the run-up intervals
+ v_startup(unit, starttype, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* p_uCounter_runUp(unit, counter)
* p_uCounter_runUpMin(unit, counter)
/ p_unit(unit, 'op00') // Scaling the p_uCounter_runUp using minload
) // END sum(runUpCounter)
) // END sum(unitStarttype)
// Shutdown 'online state'
+ sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* p_uCounter_shutdown(unit, counter)
* p_uCounter_shutdownMin(unit, counter)
/ p_unit(unit, 'op00') // Scaling the p_uCounter_shutdown using minload
) // END sum(shutdownCounter)
] // END * sum(gnu_output)
......@@ -973,14 +974,14 @@ q_conversionSOS2Constraint(s, suft(effLambda(effGroup), unit, f, t))$sft(s, f, t
+ sum(unitStarttype(unit, starttype)${uft_startupTrajectory(unit, f, t)},
+ sum(runUpCounter(unit, counter)${t_active(t+dt_trajectory(counter))}, // Sum over the run-up intervals
+ v_startup(unit, starttype, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* p_uCounter_runUp(unit, counter)
* p_uCounter_runUpMin(unit, counter)
/ p_unit(unit, 'op00') // Scaling the p_uCounter_runUp using minload
) // END sum(runUpCounter)
) // END sum(unitStarttype)
// Shutdown 'online state'
+ sum(shutdownCounter(unit, counter)${t_active(t+dt_trajectory(counter)) and uft_shutdownTrajectory(unit, f, t)}, // Sum over the shutdown intervals
+ v_shutdown(unit, s, f+df(f, t+dt_trajectory(counter)), t+dt_trajectory(counter))
* p_uCounter_shutdown(unit, counter)
* p_uCounter_shutdownMin(unit, counter)
/ p_unit(unit, 'op00') // Scaling the p_uCounter_shutdown using minload
) // END sum(shutdownCounter)
;
......
......@@ -421,8 +421,8 @@ loop(m,
${ runUpCounter(unit, counter) }
= - ord(counter) + 1; // Runup starts immediately at v_startup
// Calculate output during the run-up phase; partial intervals calculated using weighted averaging with min load
p_uCounter_runUp(runUpCounter(unit, counter))
// Calculate minimum output during the run-up phase; partial intervals calculated using weighted averaging with min load
p_uCounter_runUpMin(runUpCounter(unit, counter))
= + p_unit(unit, 'rampSpeedToMinLoad')
* ( + min(ord(counter), p_u_runUpTimeIntervals(unit)) // Location on ramp
- 0.5 * min(p_u_runUpTimeIntervals(unit) - ord(counter) + 1, 1) // Average ramp section
......@@ -430,8 +430,16 @@ loop(m,
* min(p_u_runUpTimeIntervals(unit) - ord(counter) + 1, 1) // Portion of time interval spent ramping
* mSettings(m, 'stepLengthInHours') // Ramp length in hours
* 60 // unit conversion from [p.u./min] to [p.u./h]
+ max(ord(counter) - p_u_runUpTimeIntervals(unit), 0) // Portion of time interval spent at min load
* p_unit(unit, 'op00');
+ p_unit(unit, 'op00')${ not runUpCounter(unit, counter+1) } // Time potentially spent at min load during the last run-up interval
* ( p_u_runUpTimeIntervalsCeil(unit) - p_u_runUpTimeIntervals(unit) );
// Maximum output on the last run-up interval can be higher, otherwise the same as minimum.
p_uCounter_runUpMax(runUpCounter(unit, counter))
= p_uCounter_runUpMin(unit, counter);
p_uCounter_runUpMax(runUpCounter(unit, counter))${ not runUpCounter(unit, counter+1) }
= p_uCounter_runUpMax(unit, counter)
+ ( 1 - p_uCounter_runUpMax(unit, counter) )
* ( p_u_runUpTimeIntervalsCeil(unit) - p_u_runUpTimeIntervals(unit) );
); // END loop(unit)
); // END loop(m)
......@@ -451,17 +459,25 @@ loop(m,
${ shutdownCounter(unit, counter) }
= - ord(counter) + 1; // Shutdown starts immediately at v_shutdown
// Calculate output during the shutdown phase; partial intervals calculated using weighted average with zero load
p_uCounter_shutdown(shutdownCounter(unit, counter))
= p_unit(unit, 'op00') // Minimum load load
- p_unit(unit, 'rampSpeedFromMinLoad')
* ( + min(ord(counter), p_u_shutdownTimeIntervals(unit)) // Location on ramp
- 0.5 * min(p_u_shutdownTimeIntervals(unit) - ord(counter) + 1, 1) // Average ramp section
)
* min(p_u_shutdownTimeIntervals(unit) - ord(counter) + 1, 1) // Portion of time interval spent ramping
* mSettings(m, 'stepLengthInHours') // Ramp length in hours
* 60 // unit conversion from [p.u./min] to [p.u./h]
- p_unit(unit, 'op00') * max(ord(counter) - p_u_runUpTimeIntervals(unit), 0); // Portion of time interval spent without generation
// Calculate minimum output during the shutdown phase; partial intervals calculated using weighted average with zero load
p_uCounter_shutdownMin(shutdownCounter(unit, counter))
= + p_unit(unit, 'rampSpeedFromMinLoad')
* ( min(p_u_shutdownTimeIntervalsCeil(unit) - ord(counter) + 1, p_u_shutdownTimeIntervals(unit)) // Location on ramp
- 0.5 * min(p_u_shutdownTimeIntervals(unit) - p_u_shutdownTimeIntervalsCeil(unit) + ord(counter), 1) // Average ramp section
)
* min(p_u_shutdownTimeIntervals(unit) - p_u_shutdownTimeIntervalsCeil(unit) + ord(counter), 1) // Portion of time interval spent ramping
* mSettings(m, 'stepLengthInHours') // Ramp length in hours
* 60 // unit conversion from [p.u./min] to [p.u./h]
+ p_unit(unit, 'op00')${ not shutdownCounter(unit, counter-1) } // Time potentially spent at min load on the first shutdown interval
* ( p_u_shutdownTimeIntervalsCeil(unit) - p_u_shutdownTimeIntervals(unit) );
// Maximum output on the first shutdown interval can be higher, otherwise the same as minimum.
p_uCounter_shutdownMax(shutdownCounter(unit, counter))
= p_uCounter_shutdownMin(unit, counter);
p_uCounter_shutdownMax(shutdownCounter(unit, counter))${ not shutdownCounter(unit, counter-1) }
= p_uCounter_shutdownMax(unit, counter)
+ ( 1 - p_uCounter_shutdownMax(unit, counter) )
* ( p_u_shutdownTimeIntervalsCeil(unit) - p_u_shutdownTimeIntervals(unit) );
); // END loop(unit)
); // END loop(m)
......
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