HydrogenStorageLP class
#include <gtopt/hydrogen_storage_lp.hpp>
LP representation of a hydrogen storage element.
All numerical accounting is inherited from StorageLP<>; the charge / discharge columns and the HydrogenNode coupling from CarrierStorageLP (carrier_storage_lp.hpp).
Base classes
-
template<typename Storage, typename NodeLP, auto NodeRef, const StorageStateDefaults& Defaults>class CarrierStorageLP<HydrogenStorage, HydrogenNodeLP,&HydrogenStorage::hydrogen_node, storage_state_defaults::hydrogen_storage>
Public types
- using Base = ObjectLP<HydrogenStorage>
- using CapacityAndCol = std::pair<std::optional<double>, std::optional<ColIndex>>
- Pair of optional capacity value and optional expansion column index.
- using CapacityBase = CapacityObjectLP<HydrogenStorage>
-
using CarrierBase = CarrierStorageLP<HydrogenStorage, HydrogenNodeLP,&HydrogenStorage::
hydrogen_node, storage_state_defaults:: hydrogen_storage> - using Element = HydrogenStorage
- using object_type = HydrogenStorage
- Type of the wrapped object.
- using StorageBase = StorageLP<CapacityObjectLP<HydrogenStorage>>
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 ChargeName
- PAMPL alias resolving to
finp_cols. - static std::string_view CycleChainName
- static std::string_view CycleCloseName
- static std::string_view CycleLimitName
- static std::string_view CycleScaleName
- static std::string_view CycleShiftCapName
- static std::string_view CycleShiftName
- static std::string_view DischargeName
- PAMPL alias resolving to
fout_cols. - static std::string_view DrainName
- static std::string_view EfinName
- static std::string_view EfinSlackName
- static std::string_view EiniName
- static std::string_view EnergyBalanceName
- static std::string_view EnergyName
- static std::string_view EnvelopeDnName
- static std::string_view EnvelopeUpName
- static std::string_view ExpmodName
- static std::string_view FinpName
- LP column name for the charging flow (node → storage).
- static std::string_view FoutName
- LP column name for the discharging flow (storage → node).
- static std::string_view SeminGeName
- static std::string_view SiniName
- static std::string_view SoftEminName
- static std::string_view TypeKey
Public functions
- auto add_to_lp(const LPClassName& cname, std::string_view ampl_class, SystemContextT& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp, const double flow_conversion_rate, const BIndexHolder<ColIndex>& finp_cols, FinpEffFn&& finp_efficiency_at, const BIndexHolder<ColIndex>& fout_cols, FoutEffFn&& fout_efficiency_at, const double stage_capacity, const std::optional<ColIndex> capacity_col = {}, const std::optional<Real> drain_cost = {}, const std::optional<Real> drain_capacity = {}, const StorageOptions opts = {}) -> bool
- auto add_to_lp(SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- Adds the storage variables, energy balance and node coupling.
- 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_output(OutputContext& out) const -> bool
- Emits primal / dual / cost streams to the output context.
- auto add_to_output(OutputContext& out, std::string_view cname, std::string_view energy_dual_name = EnergyName) const -> bool
- auto annual_capcost_at(StageUid stage_uid, double social_rate) const -> double
- Annualized investment cost [$/unit-year] at a stage.
- auto balance_time_scale_at(const ScenarioLP& scenario, const StageLP& stage) const -> double
- 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 drain_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- auto efin_col_at(const ScenarioLP& scenario, const StageLP& stage) const -> auto
- auto efin_slack_col_at(const ScenarioLP& scenario, const StageLP& stage) const -> std::optional<ColIndex>
- auto eini_col_at(const ScenarioLP& scenario, const StageLP& stage) const -> ColIndex
- auto energy_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- auto energy_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- auto energy_scale() const -> double noexcept
- auto expmod_col_at(const StageLP& stage) const -> auto noexcept
- Get the column index for the expansion-modules variable at a stage.
- auto find_drain_cols(const ScenarioLP& scenario, const StageLP& stage) const -> const BIndexHolder<ColIndex>* noexcept
- auto find_efin_col(const ScenarioLP& scenario, const StageLP& stage) const -> std::optional<ColIndex> noexcept
- auto find_efin_row(const ScenarioLP& scenario, const StageLP& stage) const -> std::optional<RowIndex> noexcept
- auto find_eini_col(const ScenarioLP& scenario, const StageLP& stage) const -> std::optional<ColIndex> noexcept
- auto find_energy_rows(const ScenarioLP& scenario, const StageLP& stage) const -> const BIndexHolder<RowIndex>* noexcept
- auto finp_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- auto fixed_om_cost_at(StageUid stage_uid) const -> OptReal
- Fixed O&M cost [$/unit-year] at a stage (nullopt when unset).
- auto flow_scale() const -> double noexcept
- auto fout_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- auto hydrogen_storage(this auto&& self) -> auto&& noexcept
- Access the underlying
HydrogenStorageobject. - auto id() const -> auto noexcept
- auto id(this const Self& self) -> auto noexcept
- Gets the object's identifier (explicit object syntax).
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto object() && -> HydrogenStorage&& noexcept
- auto object() & -> HydrogenStorage& noexcept
- Gets the wrapped object.
- auto object() const && -> const HydrogenStorage&& noexcept
- auto object() const & -> const HydrogenStorage& noexcept
- auto output_dual_scale_at(const ScenarioLP& scenario, const StageLP& stage) const -> double
- auto physical_efin(const LinearInterface& li, const ScenarioLP& scenario, const StageLP& stage, double default_efin) const -> double
- auto physical_efin(const SystemLPT& sys, const ScenarioLP& scenario, const StageLP& stage, double default_efin) const -> double
- Overload accepting a SystemLP (extracts LinearInterface internally).
- auto physical_eini(const LinearInterface& li, const ScenarioLP& scenario, const StageLP& stage, double default_eini) const -> double
- auto physical_eini(const SystemLPT& sys, const ScenarioLP& scenario, const StageLP& stage, double default_eini, const SIdT& sid) const -> double
- 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 soft_emin_col_at(const ScenarioLP& scenario, const StageLP& stage) const -> std::optional<ColIndex>
- auto storage(this auto&& 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 to_physical(double lp_value) const -> double noexcept
- Convert an LP-unit energy/volume value to physical units.
- auto uid() const -> auto noexcept
Parameter accessors for user constraint resolution
- auto param_input_efficiency(StageUid s, BlockUid b) const -> auto
- auto param_output_efficiency(StageUid s, BlockUid b) const -> auto
Parameter accessors for user constraint resolution
- auto param_emin(StageUid s, BlockUid b) const -> auto
- auto param_emax(StageUid s, BlockUid b) const -> auto
- auto param_ecost(StageUid s, BlockUid b) const -> auto
Typedef documentation
using gtopt:: HydrogenStorageLP:: Base = ObjectLP<HydrogenStorage>
#include <gtopt/capacity_object_lp.hpp>
using gtopt:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: CapacityBase = CapacityObjectLP<HydrogenStorage>
#include <gtopt/carrier_storage_lp.hpp>
using gtopt:: HydrogenStorageLP:: Element = HydrogenStorage
#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:: HydrogenStorageLP:: object_type = HydrogenStorage
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
using gtopt:: HydrogenStorageLP:: StorageBase = StorageLP<CapacityObjectLP<HydrogenStorage>>
#include <gtopt/carrier_storage_lp.hpp>
Function documentation
bool gtopt:: HydrogenStorageLP:: add_to_lp(const LPClassName& cname,
std::string_view ampl_class,
SystemContextT& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp,
const double flow_conversion_rate,
const BIndexHolder<ColIndex>& finp_cols,
FinpEffFn&& finp_efficiency_at,
const BIndexHolder<ColIndex>& fout_cols,
FoutEffFn&& fout_efficiency_at,
const double stage_capacity,
const std::optional<ColIndex> capacity_col = {},
const std::optional<Real> drain_cost = {},
const std::optional<Real> drain_capacity = {},
const StorageOptions opts = {})
#include <gtopt/storage_lp.hpp>
| Parameters | |
|---|---|
| cname | Class name used for column/row labels. |
| ampl_class | AMPL class name under which the storage attributes are registered for user constraints (empty to skip the registration). |
| sc | System context (schedules, state variables). |
| scenario | Scenario being built. |
| stage | Stage being built. |
| lp | Linear problem that receives the columns/rows. |
| flow_conversion_rate | Flow-to-energy factor applied to the inflow / outflow / drain terms of the energy balance. |
| finp_cols | Per-block inflow (charge) columns. |
| finp_efficiency_at | Callable (BlockUid) -> double returning the per-block charge / inflow efficiency. Pass a lambda sampling an OptTBRealSched for per-block schedules (e.g. Battery's input_efficiency since PR-E), or [](BlockUid){ return 1.0; } for elements with no efficiency loss (Reservoir / LngTerminal / VolumeRight). |
| fout_cols | Per-block outflow (discharge) columns. |
| fout_efficiency_at | Same shape, for discharge / outflow. |
| stage_capacity | Installed capacity of the stage, used to resolve the per-block energy bounds. |
| capacity_col | Optional expansion capacity column; when set, each block's energy is bounded by it. |
| drain_cost | Optional cost of the drain (spill) column; no drain column is added when unset. |
| drain_capacity | Optional upper bound of the drain column (unbounded when unset; a value <= 0 disables the drain). |
| opts | Storage options (state variables, daily cycle, scaling, ...). |
| Returns | true on success. |
Add the storage energy-balance columns and rows of one (scenario, stage) to lp.
bool gtopt:: HydrogenStorageLP:: add_to_lp(SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
#include <gtopt/carrier_storage_lp.hpp>
Adds the storage variables, energy balance and node coupling.
bool gtopt:: HydrogenStorageLP:: 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
bool gtopt:: HydrogenStorageLP:: add_to_output(OutputContext& out) const
#include <gtopt/carrier_storage_lp.hpp>
Emits primal / dual / cost streams to the output context.
bool gtopt:: HydrogenStorageLP:: add_to_output(OutputContext& out,
std::string_view cname,
std::string_view energy_dual_name = EnergyName) const
#include <gtopt/storage_lp.hpp>
double gtopt:: HydrogenStorageLP:: 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.
double gtopt:: HydrogenStorageLP:: balance_time_scale_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
Time scale of the energy-balance rows of (scenario, stage): the factor an external term fcr · rate · duration_b (block weight) must carry to enter the balance in the units of the storage's own flows. 1 except on periodic stages under model_options.periodic_storage, where the balance runs on ONE typical period (real Δt = duration_b · period_hours / duration).
CapacityAndCol gtopt:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
const auto& gtopt:: HydrogenStorageLP:: drain_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
Return the drain/spill column indices for (scenario, stage).
Drain columns represent the spillway (for reservoirs) or energy curtailment (for batteries). They are only present when the storage object has a non-zero drain cost; if absent for the requested pair, std::out_of_range is thrown (caught by the user-constraint resolver to produce a graceful std::nullopt).
auto gtopt:: HydrogenStorageLP:: efin_col_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
std::optional<ColIndex> gtopt:: HydrogenStorageLP:: efin_slack_col_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
Return the soft-efin slack column for (scenario, stage), if it exists.
The slack is created only when Reservoir.efin is set AND Reservoir.efin_cost is > 0 AND the stage is the last stage of the last phase. Returns std::nullopt when the column was not created (i.e., the hard vol_end >= efin row is in effect, or no efin target exists for this storage element).
ColIndex gtopt:: HydrogenStorageLP:: eini_col_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
Return the initial-energy column for (scenario, stage).
Three cases:
- Global initial condition (first stage of first phase): stored in eini_cols with a fixed "eini" column.
- Same-phase reuse: eini_cols stores the previous stage's efin col.
- Cross-phase SDDP boundary: sini_cols stores the "sini" col; fall back from eini_cols (which does NOT have this entry) to sini_cols.
Invariant: every active (scenario, stage) pair is stored in exactly one of the two maps. The fallback throws std::out_of_range only if the caller passes an invalid (scenario, stage) combination.
const auto& gtopt:: HydrogenStorageLP:: energy_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
const auto& gtopt:: HydrogenStorageLP:: energy_rows_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
Return the energy balance row indices for (scenario, stage).
These are the storage balance constraint rows (one per block). External entities can add coefficients to these rows to couple their flow variables into this storage's energy balance.
double gtopt:: HydrogenStorageLP:: energy_scale() const noexcept
#include <gtopt/storage_lp.hpp>
Energy/volume scale factor used in the LP: LP_var = physical / scale. For batteries this is Battery::energy_scale; for reservoirs it is Reservoir::energy_scale. Use to convert between LP and physical units.
auto gtopt:: HydrogenStorageLP:: 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) |
const BIndexHolder<ColIndex>* gtopt:: HydrogenStorageLP:: find_drain_cols(const ScenarioLP& scenario,
const StageLP& stage) const noexcept
#include <gtopt/storage_lp.hpp>
Non-throwing lookup: returns a pointer to the drain/spill column map for (scenario, stage), or nullptr when not present.
std::optional<ColIndex> gtopt:: HydrogenStorageLP:: find_efin_col(const ScenarioLP& scenario,
const StageLP& stage) const noexcept
#include <gtopt/storage_lp.hpp>
Non-throwing efin_col_at: nullopt when (scenario, stage) was not built (storage inactive in the stage). See active_ref.hpp.
std::optional<RowIndex> gtopt:: HydrogenStorageLP:: find_efin_row(const ScenarioLP& scenario,
const StageLP& stage) const noexcept
#include <gtopt/storage_lp.hpp>
Non-throwing lookup of the explicit vol_end >= efin row for (scenario, stage). Returns the row index if present, or std::nullopt when Storage::efin is unset on this element.
std::optional<ColIndex> gtopt:: HydrogenStorageLP:: find_eini_col(const ScenarioLP& scenario,
const StageLP& stage) const noexcept
#include <gtopt/storage_lp.hpp>
Non-throwing eini_col_at (same eini → sini fallback): nullopt when (scenario, stage) was not built (storage inactive in the stage).
const BIndexHolder<RowIndex>* gtopt:: HydrogenStorageLP:: find_energy_rows(const ScenarioLP& scenario,
const StageLP& stage) const noexcept
#include <gtopt/storage_lp.hpp>
Non-throwing energy_rows_at: nullptr when (scenario, stage) was not built (storage inactive in the stage).
const auto& gtopt:: HydrogenStorageLP:: finp_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/carrier_storage_lp.hpp>
Charge-flow columns for (scenario, stage), keyed by block uid. Empty when the storage is out of service in that stage.
OptReal gtopt:: HydrogenStorageLP:: 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).
double gtopt:: HydrogenStorageLP:: flow_scale() const noexcept
#include <gtopt/storage_lp.hpp>
Flow variable scale factor used in the LP.
For drain (and extraction/finp/fout in the reservoir case): LP_var = physical / flow_scale. Default 1.0 (no scaling; battery default). Reservoirs use energy_scale.
const auto& gtopt:: HydrogenStorageLP:: fout_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/carrier_storage_lp.hpp>
Discharge-flow columns for (scenario, stage), keyed by block uid. Empty when the storage is out of service in that stage.
auto gtopt:: HydrogenStorageLP:: id() const noexcept
#include <gtopt/capacity_object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
auto gtopt:: HydrogenStorageLP:: id(this const Self& self) noexcept
#include <gtopt/storage_lp.hpp>
Gets the object's identifier (explicit object syntax).
| Parameters | |
|---|---|
| self | Reference to this object |
| Returns | Id containing the object's uid and name |
bool gtopt:: HydrogenStorageLP:: 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 |
HydrogenStorage&& gtopt:: HydrogenStorageLP:: object() && noexcept
#include <gtopt/capacity_object_lp.hpp>
HydrogenStorage& gtopt:: HydrogenStorageLP:: object() & noexcept
#include <gtopt/capacity_object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
const HydrogenStorage&& gtopt:: HydrogenStorageLP:: object() const && noexcept
#include <gtopt/capacity_object_lp.hpp>
const HydrogenStorage& gtopt:: HydrogenStorageLP:: object() const & noexcept
#include <gtopt/capacity_object_lp.hpp>
double gtopt:: HydrogenStorageLP:: output_dual_scale_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
Per-(scenario, stage) factor applied to the energy-balance dual at Parquet-write time. Folds two effects: a constant -1 sign flip (industry-convention positive water value / marginal storage value) and the 24/duration daily-cycle correction when daily_cycle=true. Exposed for regression tests that pin the sign convention.
double gtopt:: HydrogenStorageLP:: physical_efin(const LinearInterface& li,
const ScenarioLP& scenario,
const StageLP& stage,
double default_efin) const
#include <gtopt/storage_lp.hpp>
Retrieve the physical efin (final energy/volume) for a given scenario and stage. Fallback chain:
- LP optimal solution
- default_efin
double gtopt:: HydrogenStorageLP:: physical_efin(const SystemLPT& sys,
const ScenarioLP& scenario,
const StageLP& stage,
double default_efin) const
#include <gtopt/storage_lp.hpp>
Overload accepting a SystemLP (extracts LinearInterface internally).
double gtopt:: HydrogenStorageLP:: physical_eini(const LinearInterface& li,
const ScenarioLP& scenario,
const StageLP& stage,
double default_eini) const
#include <gtopt/storage_lp.hpp>
Retrieve the physical eini without cross-phase lookup.
Used by callers that only have a LinearInterface (e.g. tests, non-SDDP code). Fallback chain: optimal solution → default_eini.
double gtopt:: HydrogenStorageLP:: physical_eini(const SystemLPT& sys,
const ScenarioLP& scenario,
const StageLP& stage,
double default_eini,
const SIdT& sid) const
#include <gtopt/storage_lp.hpp>
| Parameters | |
|---|---|
| sys | Current SystemLP (provides linear_interface and prev_phase_sys for cross-phase lookups). |
| scenario | Current scenario LP object. |
| stage | Current stage LP object. |
| default_eini | Initial energy/volume when no LP solution exists. |
| sid | ObjectSingleId for this element, used to look up the same storage element in the previous phase. |
Retrieve the physical eini (initial energy/volume) for a given scenario and stage.
For the first stage of the first phase the eini column is the fixed initial condition, so default_eini is returned directly.
For cross-phase boundaries (phase > 0), eini corresponds to the previous phase's efin. When the current LP hasn't been solved, the method looks up the previous phase's efin from sys.prev_phase_sys(). Fallback chain:
- Current LP optimal solution (eini/sini column)
- Current LP warm column solution (from hot-start state file)
- Previous phase's efin (via sys.prev_phase_sys())
- default_eini (system initial volume / vini)
void gtopt:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
std::optional<ColIndex> gtopt:: HydrogenStorageLP:: soft_emin_col_at(const ScenarioLP& scenario,
const StageLP& stage) const
#include <gtopt/storage_lp.hpp>
Return the soft-emin slack column for (scenario, stage), if it exists.
The soft-emin slack is only created when soft_emin > 0 and soft_emin_cost > 0 for the given stage. Returns std::nullopt when the column was not created (i.e., soft_emin is inactive for this stage).
auto&& gtopt:: HydrogenStorageLP:: storage(this auto&& self) noexcept
#include <gtopt/storage_lp.hpp>
auto gtopt:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
double gtopt:: HydrogenStorageLP:: to_physical(double lp_value) const noexcept
#include <gtopt/storage_lp.hpp>
Convert an LP-unit energy/volume value to physical units.
auto gtopt:: HydrogenStorageLP:: uid() const noexcept
#include <gtopt/capacity_object_lp.hpp>
| Returns | The object's unique identifier |
|---|
auto gtopt:: HydrogenStorageLP:: param_input_efficiency(StageUid s,
BlockUid b) const
#include <gtopt/carrier_storage_lp.hpp>
auto gtopt:: HydrogenStorageLP:: param_output_efficiency(StageUid s,
BlockUid b) const
#include <gtopt/carrier_storage_lp.hpp>
auto gtopt:: HydrogenStorageLP:: param_emin(StageUid s,
BlockUid b) const
#include <gtopt/storage_lp.hpp>
auto gtopt:: HydrogenStorageLP:: param_emax(StageUid s,
BlockUid b) const
#include <gtopt/storage_lp.hpp>
auto gtopt:: HydrogenStorageLP:: param_ecost(StageUid s,
BlockUid b) const
#include <gtopt/storage_lp.hpp>
Variable documentation
static std::string_view gtopt:: HydrogenStorageLP:: CapacityName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: CapacostName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: CapacostPrevName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: CapainstName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: 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:: HydrogenStorageLP:: ChargeName
#include <gtopt/carrier_storage_lp.hpp>
PAMPL alias resolving to finp_cols.
static std::string_view gtopt:: HydrogenStorageLP:: CycleChainName
#include <gtopt/storage_lp.hpp>
Weighted cycle group (Stage::cycle_group) rows: the chain carrying the SoC from one grouped stage to the next (eini_{d+1} = eini_d + w_d·Δ_d), the group closure (Σ_d w_d·Δ_d = 0) and the per-block bound of the LAST repetition (emin ≤ energy_b + (w_d − 1)·Δ_d ≤ emax).
static std::string_view gtopt:: HydrogenStorageLP:: CycleCloseName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: CycleLimitName
#include <gtopt/storage_lp.hpp>
LP row label for the daily energy-throughput limit (StorageOptions::max_cycles_day / PLEXOS Max Cycles Day). Duals surface as <class>/cycle_limit_….
static std::string_view gtopt:: HydrogenStorageLP:: CycleScaleName
#include <gtopt/storage_lp.hpp>
Stage-end state of a state storage on a periodic stage standing for n repetitions of its typical period: efin = s + n·(x_{N−1} − s) (model_options.periodic_storage).
static std::string_view gtopt:: HydrogenStorageLP:: CycleShiftCapName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: CycleShiftName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: DischargeName
#include <gtopt/carrier_storage_lp.hpp>
PAMPL alias resolving to fout_cols.
static std::string_view gtopt:: HydrogenStorageLP:: DrainName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: EfinName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: EfinSlackName
#include <gtopt/storage_lp.hpp>
Slack variable name for the soft-efin slack column (created only when Reservoir.efin_cost is set). Mirrors SoftEminName — the slack relaxes the hard vol_end >= efin row into vol_end + slack >= efin priced at efin_cost.
static std::string_view gtopt:: HydrogenStorageLP:: EiniName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: EnergyBalanceName
#include <gtopt/storage_lp.hpp>
Constraint name for the per-block energy-balance row. Distinct from EnergyName (the variable) so the LP row and column do not share a base label — without this split, writers like CPXwriteprob emit #<col_index> disambiguators on every column when they detect the row/col name clash, making LP files much harder to diff. Keeping EnergyName for the variable preserves the <class>.energy.* column convention that downstream tooling (ScaledView lookup, cut I/O, Pampl readers) already depends on.
static std::string_view gtopt:: HydrogenStorageLP:: EnergyName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: EnvelopeDnName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: EnvelopeUpName
#include <gtopt/storage_lp.hpp>
Point-stage envelope rows (banded integration): charge-only / discharge-only level bounds over each node interval.
static std::string_view gtopt:: HydrogenStorageLP:: ExpmodName
#include <gtopt/capacity_object_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: FinpName
#include <gtopt/carrier_storage_lp.hpp>
LP column name for the charging flow (node → storage).
static std::string_view gtopt:: HydrogenStorageLP:: FoutName
#include <gtopt/carrier_storage_lp.hpp>
LP column name for the discharging flow (storage → node).
static std::string_view gtopt:: HydrogenStorageLP:: SeminGeName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: SiniName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: SoftEminName
#include <gtopt/storage_lp.hpp>
static std::string_view gtopt:: HydrogenStorageLP:: TypeKey
#include <gtopt/carrier_storage_lp.hpp>
Filter metadata key published by add_to_lp for sum(...) predicate matching (mirrors BatteryLP::TypeKey).