GeneratorAttrs struct
#include <gtopt/generator.hpp>
Core technical and economic attributes shared by generator objects.
Used as a lightweight value type when parsing generator-attribute updates separately from the generator identity fields.
Public variables
- OptTRealFieldSched annual_capcost
- Annualized investment cost [$/MW-year].
- OptTRealFieldSched annual_derating
- Annual capacity derating factor [p.u./year].
- SingleId bus
- Bus ID where the generator is connected.
- OptTRealFieldSched capacity
- Installed generation capacity [MW].
- OptTRealFieldSched capmax
- Absolute maximum capacity after expansion [MW].
- OptName cogen_mode
- OptTRealFieldSched expcap
- Capacity added per expansion module [MW].
- OptTRealFieldSched expmod
- Maximum number of expansion modules [dimensionless].
- OptSingleId fuel
- OptTBUidSched fuel_per_block
- OptTBRealFieldSched gcost
- OptTBRealFieldSched heat_rate
- OptReal initial_generation
- OptBool integer_expmod
- Integer-constrain the expmod variable.
- OptTBRealFieldSched lossfactor
- OptTBRealFieldSched pmax
- Maximum active power output [MW].
- OptTBRealFieldSched pmin
- Minimum active power output [MW].
- OptTBRealFieldSched pmin_fcost
- OptReal uini
Variable documentation
OptName gtopt:: GeneratorAttrs:: cogen_mode
Cogeneration mode tag — see CogenMode in generator_enums.hpp for the full enumeration and semantics. Stored as a string for JSON portability; parse to the typed enum via Generator::cogen_mode_enum(). Unset ⇒ not a cogen.
Extensions belong in the description meta side-channel ([gtopt-meta key=val …] block in description), not as new cogen_mode values — keep this enum narrow and load-bearing.
OptSingleId gtopt:: GeneratorAttrs:: fuel
Optional FK to a Fuel element. When set together with heat_rate (scalar) OR heat_rate_segments (piecewise), the per-MWh fuel cost and combustion emissions are derived from the Fuel:
effective_gcost = fuel.price × heat_rate + gcost effective_ef = (fuel.combustion_ef + fuel.upstream_ef) × heat_rate + emission_rate
Both gcost and emission_rate are kept as additive offsets (variable non-combustion O&M / process emissions respectively). Mirrors PLEXOS Generator.Fuel / SDDP Combustível.
OptTBUidSched gtopt:: GeneratorAttrs:: fuel_per_block
Optional per-(stage, block) OVERRIDE of fuel. When set, each (stage, block) cell resolves to a Fuel by Uid and that Fuel supersedes the static fuel field for that cell — the cost, emission, and Fuel.max_offtake bookkeeping all switch to the per-block fuel. Cells with the sentinel value 0 (or any uid not present in fuel_array) fall back to the static fuel field, so the matrix only has to enumerate the cells that actually deviate from the default.
Uid-only (not SingleId) on purpose: Name = std::string and FileSched = std::string are JSON-indistinguishable, so a single TB-scheduled field couldn't accept both the inline-name scalar form ("Diesel_X") and the file-schedule form ("fuel_uids.parquet"). Uid is a numeric strong type — every variant arm parses unambiguously.
See Issue #510 Phase 1 for the design rationale. Phase 2 (endogenous binary-y commitment-style fuel switching) is deferred to a future FuelSwitch element.
OptTBRealFieldSched gtopt:: GeneratorAttrs:: gcost
Variable generation cost [$/MWh] per-(stage, block). Accepts a scalar (broadcast), a 2-D nested array [[block0, block1, ...], ...], or a file-backed schedule. Non-fuel adder when fuel+heat_rate are set; see Generator docstring.
OptTBRealFieldSched gtopt:: GeneratorAttrs:: heat_rate
Constant (or per-stage) heat rate slope [<fuel_unit>/MWh]. PLEXOS "Heat Rate" / "Heat Rate Incr" / SDDP "Consumo Específico". MUTUALLY EXCLUSIVE with heat_rate_segments — setting both raises a validation error.
OptReal gtopt:: GeneratorAttrs:: initial_generation
Initial generation [MW] at t = 0⁻ — the dispatch of the unit in the period just before the planning horizon (PLEXOS Initial Generation). It is the value of generator("X").generation_prev at the FIRST block of the HORIZON (first block of the first stage of the first phase), where no prior LP column exists, so ramp user constraints such as gen − gen_prev ≤ R see the real starting point instead of a cold start. Also the fallback p_prev of the native Commitment ramp rows at the horizon start when Commitment.initial_power is unset. Later stages / phases never read it (they use the previous block's column within the same LP). Unset → 0 (cold start, legacy behaviour).
OptTBRealFieldSched gtopt:: GeneratorAttrs:: lossfactor
Network loss factor [p.u.] per-(stage, block). Accepts a scalar (broadcast), a 2-D nested array, or a file-backed schedule.
OptTBRealFieldSched gtopt:: GeneratorAttrs:: pmin_fcost
Optional penalty cost [$/MWh] that turns the pmin lower bound into a SOFT constraint. When set (> 0), the hard floor generation ≥ pmin is replaced by generation + unserved ≥ pmin with a non-negative unserved slack column priced at pmin_fcost in the objective. Lets a forced-dispatch / must-run floor (e.g. a PLEXOS Fixed Load trajectory on a thermal unit) be honoured economically while staying feasible when a transmission / commitment / ramp limit drives the unit below pmin — instead of rendering the LP primal-infeasible. Unset keeps pmin hard.
OptReal gtopt:: GeneratorAttrs:: uini
Initial number of units online at t = 0 [dimensionless]. Sourced from PLEXOS Gen_IniUnits.csv. Informational on the gtopt side — the unit-commitment continuity / hot-start state is carried by Commitment.initial_status / initial_hours (one value per gtopt Generator, which models a single physical unit). Kept here so the PLEXOS conversion round-trips the raw input faithfully; future multi-unit / aggregated-generator work can consume it directly. Unset → no information published.