gtopt::Demand struct

Represents an electrical demand (load) at a bus.

A demand consumes active power load ∈ [0, lmax] at its connected bus. Any deficit between lmax and the served load is treated as unserved demand and penalized at the global demand_fail_cost. When expcap and expmod are non-null the solver may invest in additional load capacity.

Public static variables

static LPClassName class_name

Public functions

auto set_attrs(this auto&& self, auto&& attrs) -> auto&
Sets the demand attributes from a DemandAttrs object.

Public variables

OptActive active
Activation status (default: active).
OptTRealFieldSched annual_capcost
Annualized investment cost [$/MW-year].
OptTRealFieldSched annual_derating
Annual capacity derating factor [p.u./year].
SingleId bus
Bus ID where the demand is connected.
OptTRealFieldSched capacity
Installed demand capacity [MW].
OptTRealFieldSched capmax
Absolute maximum capacity after expansion [MW].
OptName description
OptTRealFieldSched ecost
Energy-shortage cost [$/MWh].
OptTRealFieldSched emin
Minimum energy that must be served per stage [MWh].
OptTRealFieldSched expcap
Capacity added per expansion module [MW].
OptTRealFieldSched expmod
Maximum number of expansion modules [dimensionless].
Array<FailSegment> fail_segments
OptTBRealFieldSched fcost
OptBool forced
When true, load is fixed at lmax (PLP-style).
OptBool integer_expmod
Integer-constrain the expmod variable.
OptTBRealFieldSched lmax
Maximum served load [MW].
OptTBRealFieldSched lmin
OptTBRealFieldSched lossfactor
Name name
Descriptive name.
OptReal power_factor
OptName type
Optional demand type tag (e.g. "residential", "industrial").
Uid uid
Unique identifier.

Annuity from overnight cost (per-candidate private rate)

Used only when annual_capcost is unset: the LP charges annual_capcost = overnight_capcost × CRF(wacc, economic_life). wacc unset → the social annual_discount_rate (a public project). All unset (default) → today's LP.

OptTRealFieldSched overnight_capcost
OptTRealFieldSched economic_life
Annuity life [years].
OptTRealFieldSched wacc
OptTRealFieldSched fixed_om_cost

Function documentation

auto& gtopt::Demand::set_attrs(this auto&& self, auto&& attrs)

Sets the demand attributes from a DemandAttrs object.

Parameters
self The demand object to update (deduced; supports const/non-const).
attrs The attribute object to transfer values from
Returns Reference to the updated demand object

Variable documentation

static LPClassName gtopt::Demand::class_name

Canonical class-name constant used in LP row labels and config fields like VariableScale::class_name. Single source of truth — DemandLP exposes no separate ClassName member; callers reach the constant via Demand::class_name directly (or DemandLP::Element::class_name in generic contexts).

OptName gtopt::Demand::description

Optional free-text description (e.g. conversion provenance)

Array<FailSegment> gtopt::Demand::fail_segments

Stepwise demand-failure (VoLL) curve. When non-empty it takes precedence over fcost and the global defaults: the served load is split into one LP column per segment (bounds fraction_k × lmax, cost cost_k). A single segment is LP-identical to fcost. See FailSegment.

OptTBRealFieldSched gtopt::Demand::fcost

Demand curtailment cost [$/MWh] per-(stage, block); see DemandAttrs::fcost for accepted JSON shapes.

OptTBRealFieldSched gtopt::Demand::lmin

Minimum served load [MW] per-(stage, block); see DemandAttrs::lmin.

OptTBRealFieldSched gtopt::Demand::lossfactor

Network loss factor [p.u.] per-(stage, block).

OptReal gtopt::Demand::power_factor

Signed power factor of the served load under network_model = "lindistflow": reactive load sign(pf)·tan(acos|pf|)·load (negative = leading / capacitive). Unset → unity.

OptTRealFieldSched gtopt::Demand::overnight_capcost

Overnight investment cost per unit of capacity [$/MW]

OptTRealFieldSched gtopt::Demand::wacc

Private discount rate of the annuity [p.u./year]

OptTRealFieldSched gtopt::Demand::fixed_om_cost

Fixed O&M of the expansion capacity [$/unit-year], charged on the capacity built from this stage on, next to the annuity and with the same stage discounting. Unset → no fixed O&M.