gtopt::GasPipeLP class

Base classes

template<typename ObjectType>
class ObjectLP<GasPipe>
Wrapper class that adds LP capabilities to objects.

Public types

using Element = GasPipe
using object_type = GasPipe
Type of the wrapped object.

Public static variables

static std::string_view FlowInName
static std::string_view FlowName
static std::string_view FlowOutName
static std::string_view GasNodeAKey
static std::string_view GasNodeBKey
static std::string_view LinepackBalanceName
static std::string_view LinepackDefName
static std::string_view LinepackEndName
static std::string_view LinepackName
static std::string_view PressureErrorName
static std::string_view ProxDownName
static std::string_view ProximalName
static std::string_view ProxUpName
static std::string_view WeymouthGapName
static std::string_view WeymouthName

Constructors, destructors, conversion operators

GasPipeLP(const GasPipe& pipe, const InputContext& ic) explicit

Public functions

auto add_to_lp(SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
auto add_to_output(OutputContext& out) const -> bool
auto capture_slp_point(const LinearInterface& li, const ScenarioLP& scenario, const StageLP& stage, const GasOptions& go) -> double
auto class_name(this const Self& self) -> auto noexcept
auto effective_k() const -> double noexcept
auto elevation_exponent(double h_a, double h_b, const GasOptions& go = {}) const -> double
Elevation exponent s of the pipe (0 on flat ground).
auto flow_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
auto flow_in_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
auto flow_out_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
auto gas_pipe(this auto&& self) -> auto&& noexcept
auto has_linepack() const -> bool noexcept
auto id() const -> auto noexcept
auto is_active(const StageLP& stage) const -> bool
Checks if object is active in given stage.
auto is_linearized() const -> bool noexcept
auto linepack_coeff(const GasOptions& go = {}) const -> double
Line-pack coefficient c [km³ / bar] (explicit or from geometry).
auto linepack_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
auto object() & -> GasPipe& noexcept
Gets the wrapped object.
auto outlet_factor() const -> double noexcept
e^s and K_e = K (e^s − 1)/s set by add_to_lp.
auto reference_flows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
Reference flows f₀ per block of (scenario, stage) (linearised).
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 tangent_points_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
Tangent points t_k used for (scenario, stage).
auto uid() const -> auto noexcept
auto update_lp(SystemLP& sys, const ScenarioLP& scenario, const StageLP& stage) -> int
auto weymouth_k(const GasOptions& go = {}) const -> double
auto weymouth_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
Tangent rows (k = 1..N) per block.

Parameter accessors for PAMPL user-constraint resolution

auto param_fmax(StageUid s) const -> auto

Typedef documentation

using gtopt::GasPipeLP::Element = GasPipe

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::GasPipeLP::object_type = GasPipe

Type of the wrapped object.

Function documentation

double gtopt::GasPipeLP::capture_slp_point(const LinearInterface& li, const ScenarioLP& scenario, const StageLP& stage, const GasOptions& go)

Linearised mode: move every f₀ of (scenario, stage) towards the solved flow, f₀ ← f₀ + ω (f − f₀) with |f₀| ≥ f_min · fmax, and return the largest relative change |f − f₀| / max(|f₀|, f_min · fmax) (0 for a flow inside ±f_min · fmax on both passes). Reads the solution only (call before any coefficient write, which drops the solution cache). Same per-(scenario, stage) shape as update_lp. Radial pipes and cells without the pipe return 0.

auto gtopt::GasPipeLP::class_name(this const Self& self) noexcept

auto gtopt::GasPipeLP::id() const noexcept

Returns The object's complete identifier (uid + name)

bool gtopt::GasPipeLP::is_active(const StageLP& stage) const

Checks if object is active in given stage.

Parameters
stage The stage to check
Returns true if active in stage, false otherwise

GasPipe& gtopt::GasPipeLP::object() & noexcept

Gets the wrapped object.

Returns Reference to the wrapped object

auto& gtopt::GasPipeLP::set_id(Uid uid, Name name) noexcept

Sets the object's identifier.

Parameters
uid Unique identifier
name Human-readable name
Returns Reference to self for chaining

auto gtopt::GasPipeLP::short_name(this const Self& self) noexcept

auto gtopt::GasPipeLP::sv_key(this const Self& self, const ScenarioLP& scenario, const StageLP& stage, std::string_view col_name) noexcept

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::GasPipeLP::sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) noexcept

auto gtopt::GasPipeLP::uid() const noexcept

Returns The object's unique identifier

int gtopt::GasPipeLP::update_lp(SystemLP& sys, const ScenarioLP& scenario, const StageLP& stage)

Linearised mode: re-issue the flow coefficient and RHS of every block's equality and of its proximal row from the stored reference flows f₀ (always written, so a low-memory reconstruct that restores the construction-time matrix is corrected before the next solve; the writes are recorded by the LP replay buffer). Radial pipes: no-op.

double gtopt::GasPipeLP::weymouth_k(const GasOptions& go = {}) const

Weymouth constant K [bar² / (km³/h)²] (explicit or from geometry, gas properties defaulting to gas_options).