Stage struct
#include <gtopt/stage.hpp>
Investment period grouping consecutive time blocks.
Each stage:
- References
count_blockconsecutive blocks starting atfirst_block - Applies an optional
discount_factorto all costs incurred in this period (present-value discounting) - Can be individually deactivated for scenario analysis
Public static variables
- static std::string_view class_name
Public functions
- auto is_active() const -> auto noexcept
- auto is_periodic() const -> bool noexcept
- True when the stage is a circular typical period (see
periodic).
Public variables
- OptBool active
- Activation status (default: active).
- OptBool chronological
- std::vector<Real> commitment_breaks
- Size count_block
- OptInt cycle_group
- OptReal cycle_weight
- OptReal discount_factor
- Present-value cost multiplier for this stage [p.u.].
- Size first_block
- 0-based index of the first block in this stage [dimensionless]
- std::optional<MonthType> month
- OptName name
- Optional human-readable label.
- OptReal period_hours
- OptBool periodic
- OptName sampling
- OptReal start_hour
- Uid uid
- Unique identifier.
Variable documentation
OptBool gtopt:: Stage:: chronological
Whether blocks in this stage are chronologically ordered. When true, unit commitment constraints (startup/shutdown transitions) are enforced. When false or absent, commitment is silently skipped.
std::vector<Real> gtopt:: Stage:: commitment_breaks
Daily commitment grid of this stage (cell boundaries in hours of the day, [0, 24), strictly increasing; see Commitment::commitment_breaks), e.g. a different sunrise / sunset pattern per month. Overrides model_options. commitment_breaks on this stage for the units without their own commitment_breaks / commitment_period / legacy point grid. Empty (default) = the planning default.
Size gtopt:: Stage:: count_block
Number of consecutive blocks in this stage [dimensionless]
OptInt gtopt:: Stage:: cycle_group
Storage cycle group (weighted representative-day cycle).
Consecutive stages of the same phase that share a cycle_group id form ONE storage cycle for every daily_cycle storage: instead of closing each stage with efin == eini, the stages are chained as cycle_weight repetitions each (in stage order) and the group is closed with Σ_d w_d · (efin_d − eini_d) = 0. Typical use: a weekday and a weekend representative day of one month, with weights 5 and 2 (days per typical week), so a battery may charge on the weekend and discharge on weekdays. Unset (default) = no group, the per-stage daily closure is unchanged. A group must not cross a phase boundary.
OptReal gtopt:: Stage:: cycle_weight
Repetitions of this stage inside its cycle_group (e.g. days per typical week). Must be > 0. Unset = duration / 24 (the number of days the stage represents; duration / period_hours, the periods represented, when period_hours is set). Ignored without cycle_group.
OptReal gtopt:: Stage:: period_hours
Real length [h] of the chronological period sampled by the blocks of this stage (e.g. 168 for a typical week, 24 for a representative day). Block durations are then WEIGHTED durations (energy and cost weights; they sum to the stage duration = period × repetitions) and the real time step of block b is Δt_b = duration_b · period_hours / stage_duration. Real time steps drive the daily_cycle storage balance (cycle closed over the period), ramp limits, minimum up / down times and the max_cycles_day cap (period_hours / 24 days per period). Unset (default) = real time steps are the block durations, except for the legacy daily_cycle 24 h rescaling.
OptBool gtopt:: Stage:: periodic
Circular typical period: the blocks of this stage sample ONE period (typical day / week) that repeats duration / period_hours times. The intra-period couplings wrap around the period (block N−1 → block 0) where an option asks for it: model_options. periodic_storage (start level of daily_cycle storages; state storages run one cycle and move by n · Δ_cycle across the stage), model_options.prev_stage_link = "period" (<attr>_prev user-constraint terms). Commitment.cycle / LineCommitment.cycle = "stage" wrap a unit / line on any chronological stage. Unset (default): periodic when period_hours is set or sampling = "point".
OptName gtopt:: Stage:: sampling
Meaning of the block values of this stage:
"block"(default): a block value holds CONSTANT over the block (piecewise constant, length = real time step)."point": block values are POINT samples at the node timesBlock.time(required on every block), e.g. Chebyshev–Lobatto nodes witht_0= period start andt_N= period end; durations are quadrature weights, not intervals. Storage balances then integrate between nodes (storage_integration, defaultlg4_posfor reservoirs andblockfor other storages), and ramps, minimum up / down times, commitment periods and daily cycle windows use the node spacingt_{k+1} − t_k.
OptReal gtopt:: Stage:: start_hour
Clock time of the stage start [h after midnight], e.g. 12 for a typical week that starts on Wednesday at 12:00 (any value >= 0 is accepted and taken modulo 24, so 60 = Wednesday 12:00 counted from Monday 00:00 works too). Only read by the daily commitment grid (commitment_breaks), which places its cell boundaries at the clock times start_hour + t of the stage time t. Unset = 0: the stage starts at midnight.