[OnOffParameters][flixopt.interface.OnOffParameters] model equipment that operates in discrete on/off states rather than continuous operation. This captures realistic operational constraints including startup costs, minimum run times, cycling limitations, and maintenance scheduling.
Equipment operation is modeled using a binary state variable:
With:
-
$s(t) = 1$ : equipment is operating (on state) -
$s(t) = 0$ : equipment is shutdown (off state)
This state variable controls the equipment's operational constraints and modifies flow bounds using the bounds with state pattern from Bounds and States.
State transitions are tracked using switch variables (see State Transitions):
With:
-
$s^\text{on}(t) \in {0, 1}$ : equals 1 when switching from off to on (startup) -
$s^\text{off}(t) \in {0, 1}$ : equals 1 when switching from on to off (shutdown)
Behavior:
- Off → On:
$s^\text{on}(t) = 1, s^\text{off}(t) = 0$ - On → Off:
$s^\text{on}(t) = 0, s^\text{off}(t) = 1$ - No change:
$s^\text{on}(t) = 0, s^\text{off}(t) = 0$
Effects incurred when equipment starts up:
With:
-
$\text{effect}_{e,\text{switch}}$ being the effect value per startup event
Examples:
- Startup fuel consumption
- Wear and tear costs
- Labor costs for startup procedures
- Inrush power demands
Effects incurred while equipment is operating:
With:
-
$\text{effect}_{e,\text{run}}$ being the effect rate per operating hour -
$\Delta t$ being the time step duration
Examples:
- Fixed operating and maintenance costs
- Auxiliary power consumption
- Consumable materials
- Emissions while running
Bounds on total operating time across the planning horizon:
With:
-
$h_\text{min}$ being the minimum total operating hours -
$h_\text{max}$ being the maximum total operating hours
Use cases:
- Minimum runtime requirements (contracts, maintenance)
- Maximum runtime limits (fuel availability, permits, equipment life)
Minimum Consecutive On-Time:
Enforces minimum runtime once started using duration tracking (see Duration Tracking):
With:
-
$d^\text{on}(t)$ being the consecutive on-time duration at time$t$ -
$h^\text{on}_\text{min}$ being the minimum required on-time
Behavior:
- When shutting down at time
$t$ : enforces equipment was on for at least$h^\text{on}_\text{min}$ prior to the switch - Prevents short cycling and frequent startups
Maximum Consecutive On-Time:
Limits continuous operation before requiring shutdown:
Use cases:
- Mandatory maintenance intervals
- Process batch time limits
- Thermal cycling requirements
Minimum Consecutive Off-Time:
Enforces minimum shutdown duration before restarting:
With:
-
$d^\text{off}(t)$ being the consecutive off-time duration at time$t$ -
$h^\text{off}_\text{min}$ being the minimum required off-time
Use cases:
- Cooling periods
- Maintenance requirements
- Process stabilization
Maximum Consecutive Off-Time:
Limits shutdown duration before mandatory restart:
Use cases:
- Equipment preservation requirements
- Process stability needs
- Contractual minimum activity levels
Maximum number of startups across the planning horizon:
With:
-
$n_\text{max}$ being the maximum allowed number of startups
Use cases:
- Preventing excessive equipment wear
- Grid stability requirements
- Operational complexity limits
- Maintenance budget constraints
OnOffParameters modify flow rate bounds by coupling them to the on/off state.
Without OnOffParameters (continuous operation): $$ P \cdot \text{rel}\text{lower} \leq p(t) \leq P \cdot \text{rel}\text{upper} $$
With OnOffParameters (binary operation): $$ s(t) \cdot P \cdot \max(\varepsilon, \text{rel}\text{lower}) \leq p(t) \leq s(t) \cdot P \cdot \text{rel}\text{upper} $$
Using the bounds with state pattern from Bounds and States.
Behavior:
- When
$s(t) = 0$ : flow is forced to zero - When
$s(t) = 1$ : flow follows normal bounds
For equipment with OnOffParameters, the complete constraint system includes:
-
State variable:
$s(t) \in {0, 1}$ -
Switch tracking:
$s^\text{on}(t) - s^\text{off}(t) = s(t) - s(t-1)$ -
Switch exclusivity:
$s^\text{on}(t) + s^\text{off}(t) \leq 1$ -
Duration tracking:
- On-duration:
$d^\text{on}(t)$ following duration tracking pattern - Off-duration:
$d^\text{off}(t)$ following duration tracking pattern
- On-duration:
-
Minimum on-time:
$d^\text{on}(t) \geq (s(t-1) - s(t)) \cdot h^\text{on}_\text{min}$ -
Maximum on-time:
$d^\text{on}(t) \leq h^\text{on}_\text{max}$ -
Minimum off-time:
$d^\text{off}(t) \geq (s(t) - s(t-1)) \cdot h^\text{off}_\text{min}$ -
Maximum off-time:
$d^\text{off}(t) \leq h^\text{off}_\text{max}$ -
Total hours:
$h_\text{min} \leq \sum_t s(t) \cdot \Delta t \leq h_\text{max}$ -
Cycling limit:
$\sum_t s^\text{on}(t) \leq n_\text{max}$ - Flow bounds: $s(t) \cdot P \cdot \text{rel}\text{lower} \leq p(t) \leq s(t) \cdot P \cdot \text{rel}\text{upper}$
Python Class: [OnOffParameters][flixopt.interface.OnOffParameters]
Key Parameters:
effects_per_switch_on: Costs per startup eventeffects_per_running_hour: Costs per hour of operationon_hours_min,on_hours_max: Total runtime boundsconsecutive_on_hours_min,consecutive_on_hours_max: Consecutive runtime boundsconsecutive_off_hours_min,consecutive_off_hours_max: Consecutive shutdown boundsswitch_on_max: Maximum number of startupsforce_switch_on: Create switch variables even without limits (for tracking)
See the [OnOffParameters][flixopt.interface.OnOffParameters] API documentation for complete parameter list and usage examples.
Mathematical Patterns Used:
- State Transitions - Switch tracking
- Duration Tracking - Consecutive time constraints
- Bounds with State - Flow control
Used in:
- [
Flow][flixopt.elements.Flow] - On/off operation for flows - All components supporting discrete operational states
power_plant = OnOffParameters(
effects_per_switch_on={'startup_cost': 25000}, # €25k per startup
effects_per_running_hour={'fixed_om': 125}, # €125/hour while running
consecutive_on_hours_min=8, # Minimum 8-hour run
consecutive_off_hours_min=4, # 4-hour cooling period
on_hours_max=6000, # Annual limit
)batch_reactor = OnOffParameters(
effects_per_switch_on={'setup_cost': 1500},
consecutive_on_hours_min=12, # 12-hour minimum batch
consecutive_on_hours_max=24, # 24-hour maximum batch
consecutive_off_hours_min=6, # Cleaning time
switch_on_max=200, # Max 200 batches
)hvac = OnOffParameters(
effects_per_switch_on={'compressor_wear': 0.5},
consecutive_on_hours_min=1, # Prevent short cycling
consecutive_off_hours_min=0.5, # 30-min minimum off
switch_on_max=2000, # Limit compressor starts
)backup_gen = OnOffParameters(
effects_per_switch_on={'fuel_priming': 50}, # L diesel
consecutive_on_hours_min=0.5, # 30-min test duration
consecutive_off_hours_max=720, # Test every 30 days
on_hours_min=26, # Weekly testing requirement
)Time Series Boundary: The final time period constraints for consecutive_on_hours_min/max and consecutive_off_hours_min/max are not enforced at the end of the planning horizon. This allows optimization to end with ongoing campaigns that may be shorter/longer than specified, as they extend beyond the modeled period.