ReserveZoneLP class
#include <gtopt/reserve_zone_lp.hpp>
Base classes
-
template<typename ObjectType>class ObjectLP<ReserveZone>
- Wrapper class that adds LP capabilities to objects.
Public types
- struct GenRowRef
- using Base = ObjectLP<ReserveZone>
- using Element = ReserveZone
- enum class InertiaTerm: std::uint8_t { commitment, exogenous, endogenous }
- using object_type = ReserveZone
- Type of the wrapped object.
Public static variables
- static std::string_view CreditTransferName
- static double DefaultDemandLoadFactor
- static InertiaTerm DefaultInertiaTerm
- static std::string_view DnName
- static std::string_view DrcontingencyName
- static std::string_view DrequirementName
- static std::string_view DrplaneBindingName
- static std::string_view DrplaneName
-
static std::array<std::string_view, max_
output_ planes> DrplaneNames - static std::string_view DrshortageName
- static std::string_view DrsurplusName
- static std::string_view DsysName
- static std::string_view FlowCreditName
- static std::string_view InertiaFixedName
- static std::string_view InertiaName
- System inertia column / definition row (
I − Σ … = 0). - static std::string_view InertiaTermCommitment
- Accepted
ReserveZone::inertia_termvalues. - static std::string_view InertiaTermEndogenous
- static std::string_view InertiaTermExogenous
- static std::string_view LoadTermEndogenousGeneration
- static std::string_view LoadTermExogenous
- Accepted
ReserveZone::load_termvalues. - static std::size_t max_output_planes
- static std::string_view ReserveCreditName
- static std::string_view SenseEq
- static std::string_view SenseGe
- Accepted
ReserveZone::requirement_sensevalues. - static double TermColScale
- static std::string_view UpName
- static std::string_view UrcontingencyName
- Largest-contingency columns / rows (
C − p ≥ 0). - static std::string_view UrequirementName
- static std::string_view UrplaneBindingName
- static std::string_view UrplaneName
- Dynamic-requirement plane rows (
R − terms ≥ alpha + dc·D). -
static std::array<std::string_view, max_
output_ planes> UrplaneNames - static std::string_view UrshortageName
- Dynamic-requirement shortage columns (planes mode only).
- static std::string_view UrsurplusName
- Surplus columns of an
requirement_sense: "eq"balance.
Constructors, destructors, conversion operators
- ReserveZoneLP(const ReserveZone& preserve_zone, const InputContext& ic) explicit
Public functions
- auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- auto add_to_output(OutputContext& out) const -> bool
- auto class_name(this const Self& self) -> auto noexcept
- auto contingency_gen_refs(bool upward, const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::vector<GenRowRef>
- Generator memberships of the up (down) contingency rows of a block.
- auto contingency_includes_reserve() const -> bool noexcept
C ≥ a·(p + r): provisions add their column to contingency rows.- auto drequirement_cols() const -> auto&&
- auto drequirement_rows() const -> auto&&
- auto drplane_rows(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::vector<RowIndex>
- auto id() const -> auto noexcept
- auto inertia_term() const -> InertiaTerm noexcept
- auto inertia_zone_index() const -> const auto& noexcept
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto lookup_drcontingency_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- auto lookup_drequirement_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- Look up the down-requirement column for (scenario, stage, block).
- auto lookup_drshortage_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- auto lookup_inertia_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- auto lookup_inertia_fixed_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- auto lookup_inertia_row(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<RowIndex> noexcept
- auto lookup_urcontingency_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- Planes mode: the up/down largest-contingency column
C. - auto lookup_urequirement_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- auto lookup_urshortage_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- Planes mode: the up/down shortage column
s(priced zones only). - auto object() && -> ReserveZone&& noexcept
- auto object() & -> ReserveZone& noexcept
- Gets the wrapped object.
- auto object() const && -> const ReserveZone&& noexcept
- auto object() const & -> const ReserveZone& noexcept
- auto reserve_zone(this auto&& self) -> auto&& noexcept
- auto set_id(Uid uid, Name name) -> auto& noexcept
- Sets the object's identifier.
- auto short_name(this const Self& self) -> auto noexcept
- auto sv_key(this const Self& self, const ScenarioLP& scenario, const StageLP& stage, std::string_view col_name) -> auto noexcept
- Generates a state variable key for the object.
- auto sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) -> auto noexcept
- auto uid() const -> auto noexcept
- auto urequirement_cols() const -> auto&&
- auto urequirement_rows() const -> auto&&
- auto urplane_rows(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::vector<RowIndex>
Typedef documentation
using gtopt:: ReserveZoneLP:: Element = ReserveZone
#include <gtopt/object_lp.hpp>
Alias for the wrapped data-struct type. Lets generic code reach the canonical LPClassName constant via T::Element::class_name where T is any LP wrapper inheriting from ObjectLP. Single source of truth for the class-name constant lives on the data struct (Bus::class_name, Reservoir::class_name, …); the LP wrappers no longer carry a duplicate ClassName member.
using gtopt:: ReserveZoneLP:: object_type = ReserveZone
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
auto gtopt:: ReserveZoneLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ReserveZoneLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
const auto& gtopt:: ReserveZoneLP:: inertia_zone_index() const noexcept
InertiaZone referenced by the plane inertia term (nullopt = none, or add_to_lp has not run yet — the reference is resolved there).
bool gtopt:: ReserveZoneLP:: is_active(const StageLP& stage) const
#include <gtopt/object_lp.hpp>
Checks if object is active in given stage.
| Parameters | |
|---|---|
| stage | The stage to check |
| Returns | true if active in stage, false otherwise |
std::optional<ColIndex> gtopt:: ReserveZoneLP:: lookup_inertia_col(const ScenarioLP& scenario,
const StageLP& stage,
BlockUid buid) const noexcept
Planes mode: the system inertia column I and its definition row I − Σ pf·r = 0 (InertiaProvisionLP stamps −pf into the row).
std::optional<ColIndex> gtopt:: ReserveZoneLP:: lookup_inertia_fixed_col(const ScenarioLP& scenario,
const StageLP& stage,
BlockUid buid) const noexcept
Fixed-inertia column of (scenario, stage, block) — present for the "commitment" term and the "exogenous" must-run fallback.
std::optional<ColIndex> gtopt:: ReserveZoneLP:: lookup_urequirement_col(const ScenarioLP& scenario,
const StageLP& stage,
BlockUid buid) const noexcept
Look up the up-requirement column for (scenario, stage, block). Fixed mode: the "served requirement" column of a priced zone. Planes mode: the dynamic requirement R itself. Returns std::nullopt when no such column exists for this period.
ReserveZone&& gtopt:: ReserveZoneLP:: object() && noexcept
#include <gtopt/object_lp.hpp>
ReserveZone& gtopt:: ReserveZoneLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
const ReserveZone&& gtopt:: ReserveZoneLP:: object() const && noexcept
#include <gtopt/object_lp.hpp>
const ReserveZone& gtopt:: ReserveZoneLP:: object() const & noexcept
#include <gtopt/object_lp.hpp>
auto& gtopt:: ReserveZoneLP:: set_id(Uid uid,
Name name) noexcept
#include <gtopt/object_lp.hpp>
Sets the object's identifier.
| Parameters | |
|---|---|
| uid | Unique identifier |
| name | Human-readable name |
| Returns | Reference to self for chaining |
auto gtopt:: ReserveZoneLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ReserveZoneLP:: sv_key(this const Self& self,
const ScenarioLP& scenario,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
Generates a state variable key for the object.
| Parameters | |
|---|---|
| self | Reference to the object |
| scenario | Scenario context |
| stage | Stage context |
| col_name | The column name for the state variable |
| Returns | StateVariable::Key |
auto gtopt:: ReserveZoneLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: ReserveZoneLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|
std::vector<RowIndex> gtopt:: ReserveZoneLP:: urplane_rows(const ScenarioLP& scenario,
const StageLP& stage,
BlockUid buid) const
Planes mode: the K plane rows of (scenario, stage, block), in urreq_planes / drreq_planes order (empty when absent).
Variable documentation
static InertiaTerm gtopt:: ReserveZoneLP:: DefaultInertiaTerm
Default plane inertia term (see ReserveZone::inertia_term): commitment, the CEN definition I = Σ I_c·u_c (I_c capped at the unit's pmax). On the CEN PCP 2026-11-07 day it gives the realistic requirement (the must-run-only exogenous fallback inflates it, 505 vs 195 MW in PLEXOS) with the same negative-price hours as exogenous (515 vs 509 bus-hours, none below −0.1 $/MWh; the credit comes from the load term). Known risk: with a RELAXED Commitment a cheap unit can raise u at pmin·u generation and earn I_c/pmin per MW, which can price a congested bus negative (test_reserve_inertia_term_default); validate_planning warns and points to inertia_term: "exogenous" as the remedy.
static std::string_view gtopt:: ReserveZoneLP:: DsysName
Endogenous system-load column / definition row (PLEXOS-compat load_term: "endogenous_generation" only).
static std::string_view gtopt:: ReserveZoneLP:: InertiaFixedName
Fixed (data) part of the inertia term: a column with equal bounds, raised by every forced-on / must-run unit (inertia_term "commitment" and the "exogenous" must-run fallback).
static std::string_view gtopt:: ReserveZoneLP:: LoadTermEndogenousGeneration
Default demand_load_factor of the exogenous load term: 1.05, a conservative choice that over- rather than under-sizes the reserve (CEN PCP generation / demand ratio 1.025–1.05; recent days 1.044–1.052). The PLEXOS-compat endogenous form defaults to 1.
static std::size_t gtopt:: ReserveZoneLP:: max_output_planes
Output stems of the per-plane row duals (urplane<k>_dual); planes beyond max_output_planes are solved but not written.
static std::string_view gtopt:: ReserveZoneLP:: ReserveCreditName
Output: requirement credit in the bus LMPs [$/MWh] — the uniform LMP shift Σ_k demand_coef_k · lf · μ_k of the endogenous load term (0 with the default exogenous term); flow_credit is the LMP spread Σ_k flow_coef_k · μ_k added across the flow_lines (B side minus A side); credit_transfer [$] = reserve_credit · (D / lf) · Δt, the money moved through the credit in the block.
static double gtopt:: ReserveZoneLP:: TermColScale
LP scale of the inertia / system-load columns (physical = LP · scale): the LP works in GWs / GW so the plane coefficients (~1e-5 per MWs) and the definition-row entries (~1..1e3) stay in a narrow range. Invisible in the output (primal / duals unscaled).
static std::string_view gtopt:: ReserveZoneLP:: UpName
PAMPL-visible aliases for the up/down requirement columns. Exposed under canonical short names so user constraints can write reserve_zone("Z").up instead of the verbose urequirement.
static std::string_view gtopt:: ReserveZoneLP:: UrplaneBindingName
Output: index (1-based) of the plane that sets R at the solution (urplane_binding_sol), 0 when the floor max(0, req, min) does.