CarrierConverterLP class
#include <gtopt/carrier_converter_lp.hpp>
Base classes
-
template<typename Object Object>struct CapacityObjectLP<CarrierConverter>
- A linear programming representation of an object with capacity constraints.
Public types
- using Base = ObjectLP<CarrierConverter>
- using CapacityAndCol = std::pair<std::optional<double>, std::optional<ColIndex>>
- Pair of optional capacity value and optional expansion column index.
- using CapacityBase = CapacityObjectLP<CarrierConverter>
- using Element = CarrierConverter
- using object_type = CarrierConverter
- Type of the wrapped object.
Public static variables
- static std::string_view CapacityName
- Expansion row
capainst − input ≥ 0(only when expandable). - static std::string_view CapacostName
- static std::string_view CapacostPrevName
- static std::string_view CapainstName
- static std::string_view CapainstPrevName
- static std::string_view ExpmodName
- static std::string_view InputName
- static std::string_view TypeKey
Constructors, destructors, conversion operators
- CarrierConverterLP(const CarrierConverter& pcc, const 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 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 carrier_converter(this auto&& self) -> auto&& noexcept
- auto class_name(this const Self& self) -> 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 id() const -> auto noexcept
- auto input_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto object() && -> CarrierConverter&& noexcept
- auto object() & -> CarrierConverter& noexcept
- Gets the wrapped object.
- auto object() const && -> const CarrierConverter&& noexcept
- auto object() const & -> const CarrierConverter& 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
Parameter accessors for PAMPL user-constraint resolution
- auto param_efficiency(StageUid s, BlockUid b) const -> auto
- auto param_ocost(StageUid s, BlockUid b) const -> auto
Typedef documentation
using gtopt:: CarrierConverterLP:: Base = ObjectLP<CarrierConverter>
#include <gtopt/capacity_object_lp.hpp>
using gtopt:: CarrierConverterLP:: 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:: CarrierConverterLP:: Element = CarrierConverter
#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:: CarrierConverterLP:: object_type = CarrierConverter
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
bool gtopt:: CarrierConverterLP:: 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:: CarrierConverterLP:: 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:: CarrierConverterLP:: 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:: CarrierConverterLP:: 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:: CarrierConverterLP:: 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:: CarrierConverterLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: CarrierConverterLP:: 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:: CarrierConverterLP:: 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:: CarrierConverterLP:: id() const noexcept
#include <gtopt/capacity_object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
const auto& gtopt:: CarrierConverterLP:: input_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
Input columns of a cell; empty when the converter (or one of its nodes) is out of service there.
bool gtopt:: CarrierConverterLP:: 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 |
CarrierConverter&& gtopt:: CarrierConverterLP:: object() && noexcept
#include <gtopt/capacity_object_lp.hpp>
CarrierConverter& gtopt:: CarrierConverterLP:: object() & noexcept
#include <gtopt/capacity_object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
const CarrierConverter&& gtopt:: CarrierConverterLP:: object() const && noexcept
#include <gtopt/capacity_object_lp.hpp>
const CarrierConverter& gtopt:: CarrierConverterLP:: object() const & noexcept
#include <gtopt/capacity_object_lp.hpp>
void gtopt:: CarrierConverterLP:: 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:: CarrierConverterLP:: 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:: CarrierConverterLP:: 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:: CarrierConverterLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: CarrierConverterLP:: 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:: CarrierConverterLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: CarrierConverterLP:: uid() const noexcept
#include <gtopt/capacity_object_lp.hpp>
| Returns | The object's unique identifier |
|---|
Variable documentation
static std::string_view gtopt:: CarrierConverterLP:: CapacostName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: CarrierConverterLP:: CapacostPrevName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: CarrierConverterLP:: CapainstName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: CarrierConverterLP:: 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:: CarrierConverterLP:: ExpmodName
#include <gtopt/capacity_object_lp.hpp>