ConverterLP class
#include <gtopt/converter_lp.hpp>
Base classes
-
template<typename Object Object>struct CapacityObjectLP<Converter>
- A linear programming representation of an object with capacity constraints.
Public types
- using Base = ObjectLP<Converter>
- using CapacityAndCol = std::pair<std::optional<double>, std::optional<ColIndex>>
- Pair of optional capacity value and optional expansion column index.
- using CapacityBase = CapacityObjectLP<Converter>
- using Element = Converter
- using object_type = Converter
- Type of the wrapped object.
Public static variables
- static std::string_view CapacityName
- static std::string_view CapacostName
- static std::string_view CapacostPrevName
- static std::string_view CapainstName
- static std::string_view CapainstPrevName
- static std::string_view ChargeDischargeExclusiveName
- static std::string_view ChargeLowerName
- static std::string_view ChargeUpperName
- C2-style gating row labels.
- static std::string_view DemandName
- static std::string_view DischargeLowerName
- static std::string_view DischargeUpperName
- static std::string_view DurationName
- static std::string_view ExpmodName
- static std::string_view FlowName
- static std::string_view GenerationName
- static std::string_view PowerEnvelopeName
- static std::string_view ReserveDnChargeName
- static std::string_view ReserveDnDischargeName
- static std::string_view ReserveDnEnergyName
- static std::string_view ReserveDnHeadroomName
- static std::string_view ReserveDnSplitName
- static std::string_view ReserveUpChargeName
- static std::string_view ReserveUpDischargeName
- static std::string_view ReserveUpEnergyName
- static std::string_view ReserveUpHeadroomName
- static std::string_view ReserveUpSplitName
- static std::string_view UChargeName
- static std::string_view UDischargeName
Constructors, destructors, conversion operators
- ConverterLP(const Converter& pconverter, InputContext& ic) explicit
Public functions
- auto add_to_lp(SystemContext& sc, std::string_view ampl_class, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- Add capacity constraints to the linear problem.
- auto add_to_lp(SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- auto add_to_output(OutputContext& out) const -> bool
- auto annual_capcost_at(StageUid stage_uid, double social_rate) const -> double
- Annualized investment cost [$/unit-year] at a stage.
- auto battery_sid() const -> auto noexcept
- auto capacity_and_col(const StageLP& stage, LinearProblem& lp) const -> CapacityAndCol
- Query capacity value and optional expansion column for a stage.
- auto capacity_at(const StageLP& stage, const double def_capacity = std::numeric_limits<double>::max()) const -> double
- Get the capacity at a specific stage.
- auto capacity_col_at(const StageLP& stage) const -> auto noexcept
- Get the column index for capacity at a specific stage.
- auto class_name(this const Self& self) -> auto noexcept
- auto converter(this auto&& self) -> auto&& noexcept
- auto demand_sid() const -> auto noexcept
- auto expmod_col_at(const StageLP& stage) const -> auto noexcept
- Get the column index for the expansion-modules variable at a stage.
- auto fixed_om_cost_at(StageUid stage_uid) const -> OptReal
- Fixed O&M cost [$/unit-year] at a stage (nullopt when unset).
- auto generator_sid() const -> auto noexcept
- auto id() const -> auto noexcept
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto object() && -> Converter&& noexcept
- auto object() & -> Converter& noexcept
- Gets the wrapped object.
- auto object() const && -> const Converter&& noexcept
- auto object() const & -> const Converter& noexcept
- void set_annuity_inputs(const InputContext& ic, OF&& overnight_capcost, OF&& economic_life, OF&& wacc)
- Set the annuity inputs of an object priced by overnight cost.
- void set_fixed_om_cost(const InputContext& ic, OF&& fixed_om_cost)
- Set the fixed O&M cost of the expansion capacity.
- 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
Typedef documentation
using gtopt:: ConverterLP:: Base = ObjectLP<Converter>
#include <gtopt/capacity_object_lp.hpp>
using gtopt:: ConverterLP:: CapacityAndCol = std::pair<std::optional<double>, std::optional<ColIndex>>
#include <gtopt/capacity_object_lp.hpp>
Pair of optional capacity value and optional expansion column index.
using gtopt:: ConverterLP:: Element = Converter
#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:: ConverterLP:: object_type = Converter
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
bool gtopt:: ConverterLP:: add_to_lp(SystemContext& sc,
std::string_view ampl_class,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
#include <gtopt/capacity_object_lp.hpp>
Add capacity constraints to the linear problem.
| Parameters | |
|---|---|
| sc | System context providing stage/scenario info |
| ampl_class | Canonical lowercase PAMPL class name ("generator", "demand", "line", "battery", "converter") — used to register the stage-level capainst column into the AMPL variable registry for user-constraint lookups. |
| scenario | Current scenario |
| stage | Current stage |
| lp | Linear problem to modify |
| Returns | true if successful, false otherwise |
Adds capacity-related variables and constraints:
- Capacity installation variables
- Capacity cost variables
- Expansion model variables (if applicable)
- Balance equations between stages
- Cost tracking equations
double gtopt:: ConverterLP:: annual_capcost_at(StageUid stage_uid,
double social_rate) const
#include <gtopt/capacity_object_lp.hpp>
Annualized investment cost [$/unit-year] at a stage.
annual_capcost when set; else the annuity of overnight_capcost at the object's wacc (or social_rate when unset) over its economic_life; else 0.
CapacityAndCol gtopt:: ConverterLP:: capacity_and_col(const StageLP& stage,
LinearProblem& lp) const
#include <gtopt/capacity_object_lp.hpp>
Query capacity value and optional expansion column for a stage.
| Parameters | |
|---|---|
| stage | The stage to query |
| lp | Linear problem reference (needed for expansion col bounds) |
Returns {std::optional<double>, std::optional<ColIndex>}. The capacity is nullopt when no expansion column exists AND no capacity schedule value is defined — i.e. when the physical capacity is truly undefined. Callers that need a numeric fallback should use value_or(default) on the returned optional.
double gtopt:: ConverterLP:: capacity_at(const StageLP& stage,
const double def_capacity = std::numeric_limits<double>::max()) const
#include <gtopt/capacity_object_lp.hpp>
Get the capacity at a specific stage.
| Parameters | |
|---|---|
| stage | The stage to query capacity for |
| def_capacity | Default value if capacity not specified (default: unlimited) |
| Returns | The capacity at given stage or default if not specified |
auto gtopt:: ConverterLP:: capacity_col_at(const StageLP& stage) const noexcept
#include <gtopt/capacity_object_lp.hpp>
Get the column index for capacity at a specific stage.
| Parameters | |
|---|---|
| stage | The stage to get column index for |
| Returns | Optional containing column index if exists |
auto gtopt:: ConverterLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ConverterLP:: expmod_col_at(const StageLP& stage) const noexcept
#include <gtopt/capacity_object_lp.hpp>
Get the column index for the expansion-modules variable at a stage.
| Parameters | |
|---|---|
| stage | The stage to query |
| Returns | Optional column index (empty when the object has no expansion capacity or the stage did not create an expmod column) |
OptReal gtopt:: ConverterLP:: fixed_om_cost_at(StageUid stage_uid) const
#include <gtopt/capacity_object_lp.hpp>
Fixed O&M cost [$/unit-year] at a stage (nullopt when unset).
auto gtopt:: ConverterLP:: id() const noexcept
#include <gtopt/capacity_object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: ConverterLP:: is_active(const StageLP& stage) const
#include <gtopt/capacity_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 |
Converter&& gtopt:: ConverterLP:: object() && noexcept
#include <gtopt/capacity_object_lp.hpp>
Converter& gtopt:: ConverterLP:: object() & noexcept
#include <gtopt/capacity_object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
const Converter&& gtopt:: ConverterLP:: object() const && noexcept
#include <gtopt/capacity_object_lp.hpp>
const Converter& gtopt:: ConverterLP:: object() const & noexcept
#include <gtopt/capacity_object_lp.hpp>
void gtopt:: ConverterLP:: set_annuity_inputs(const InputContext& ic,
OF&& overnight_capcost,
OF&& economic_life,
OF&& wacc)
#include <gtopt/capacity_object_lp.hpp>
Set the annuity inputs of an object priced by overnight cost.
Used where annual_capcost is unset at a stage: the LP charges overnight_capcost × CRF(wacc, economic_life) per unit-year, wacc falling back to the planning-wide annual_discount_rate.
void gtopt:: ConverterLP:: set_fixed_om_cost(const InputContext& ic,
OF&& fixed_om_cost)
#include <gtopt/capacity_object_lp.hpp>
Set the fixed O&M cost of the expansion capacity.
fixed_om_cost [$/unit-year] is charged, next to the annuity, on the capacity built from a stage on. Unset → no fixed O&M.
auto& gtopt:: ConverterLP:: 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:: ConverterLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ConverterLP:: 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:: ConverterLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: ConverterLP:: uid() const noexcept
#include <gtopt/capacity_object_lp.hpp>
| Returns | The object's unique identifier |
|---|
Variable documentation
static std::string_view gtopt:: ConverterLP:: CapacostName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: ConverterLP:: CapacostPrevName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: ConverterLP:: CapainstName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: ConverterLP:: CapainstPrevName
#include <gtopt/capacity_object_lp.hpp>
LP metadata variable_names for the dependent capainst/capacost columns that mirror a publisher in the previous phase at a cross-phase boundary. Named with a distinct suffix so the eager duplicate detector in LinearInterface::add_col can tell the dependent mirror apart from the current stage's own capainst/capacost (which share everything else in the 4-tuple metadata: class_name, variable_uid, stage context). The StateVariable lookup key still uses the un-suffixed names to match the publisher side in the previous phase.
static std::string_view gtopt:: ConverterLP:: ChargeDischargeExclusiveName
Charge/discharge exclusivity row u_charge + u_discharge ≤ 1 per block (Converter.exclusive_charge_discharge, default on with commitment).
static std::string_view gtopt:: ConverterLP:: DurationName
Fixed-duration coupling row (Converter.energy_power_ratio): battery capainst − ratio × converter capainst = 0 per stage.
static std::string_view gtopt:: ConverterLP:: ExpmodName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: ConverterLP:: FlowName
PAMPL bidirectional flow compound: flow = +discharge − charge. Mirrors line.flow = +flowp − flown. Resolves to the converter's signed net flow (positive when discharging the battery to the grid, negative when charging from the grid). Registered as a class-level compound in system_lp.cpp::register_all_ampl_element_names.
static std::string_view gtopt:: ConverterLP:: PowerEnvelopeName
Battery power-envelope valid inequality (default ON, model_options.battery_power_envelope): p_charge/Pc_max + p_discharge/Pd_max ≤ 1 per block, emitted row-scaled by max(Pc_max, Pd_max) so it stays in MW units. Cuts simultaneous full-power charge + discharge.
static std::string_view gtopt:: ConverterLP:: ReserveUpHeadroomName
Native BESS reserve rows (Battery.reserve_sustain_hours set): power headroom (pd − pc + Σr_up ≤ Pd, pc + Σr_dn ≤ Pc) and state-of-charge sufficiency (e − (T/ηd)Σr_up ≥ e_min, e + T·ηc·Σr_dn ≤ e_max). See Battery::reserve_sustain_hours.
static std::string_view gtopt:: ConverterLP:: ReserveUpSplitName
Per-side split of a native BESS provision (PLEXOS Max Response / Max Charge Response): r − r_dis − r_chg = 0 per provision (columns and split row labelled ReserveProvision with the provision uid, so several provisions of one battery stay distinct), then the side headroom rows (up: pd + Σr_dis ≤ Pd, Σr_chg − pc ≤ 0; down: Σr_dis − pd ≤ 0, pc + Σr_chg ≤ Pc).
static std::string_view gtopt:: ConverterLP:: UChargeName
Per-block commitment-status columns added when Converter.commitment is set: u_charge gates the synthetic charge Demand floor/ceiling; u_discharge gates the synthetic discharge Generator floor/ceiling. Continuous in [0, 1] by default; integer when integer_commitment is set.