fuel_lp.cpp file
Implementation of FuelLP — parameter carrier + offtake cap/floor.
FuelLP resolves the Fuel schedules (price, heat content, emission factors, offtake bounds) at construction. Generators consume the resolved schedules via the param_* accessors.
LP-active constraints — only when explicitly configured
When Fuel.max_offtake is set for a (scenario, stage), add_to_lp walks every active GeneratorLP whose Generator.fuel == this_fuel and creates a cap row whose LHS is Σ heat_rate · dur · gen_g, stamped DIRECTLY on the consuming generators' dispatch columns:
- default (per-stage SUM): Σ_b Σ_g (heat_rate · gen · dur_b) ≤ max_offtake(s)
Fuel.max_offtake_per_block = true(per-block, mirrors PLEXOS): Σ_g (heat_rate · gen · dur_b) ≤ max_offtake(s) · dur_b / Σ dur
The symmetric Fuel.min_offtake path emits a ≥ floor row with the same LHS shape and an optional +1 slack column.
PAMPL fuel("X").offtake accessor — weighted sum, no LP column
The aggregate Σ_g heat_rate_g · dur_b · generation_g[b] is also exposed to PAMPL as fuel("X").offtake via the AMPL block_cols_weighted_sum registry — no aggregator LP column, no binding equality row. Mirror of the EmissionZone.production substitution: the previous design carried a per-(scenario, stage, block) Y_f[b] LP column plus an equality row Y_f[b] − Σ hr·dur·gen = 0, both of which were pure bookkeeping (zero objective cost, unique-determined-by-gen value). Removing them shrinks the LP by ~N_fuels × N_blocks columns AND the matching equality rows on every (scene, phase) cell.
Optional slack column priced at *_offtake_cost(s) is added with coefficient −1 (cap) or +1 (floor) so the bound can be softened at a per-unit price. In per-block mode each block has its own slack column.
Namespaces
- namespace gtopt