gtopt::BusLP class

Base classes

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

Public types

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

Public static variables

static std::string_view BalanceName
static std::string_view QBalanceName
LinDistFlow reactive-power balance row.
static std::string_view ThetaName
static std::string_view TypeKey
static std::string_view VsqName
LinDistFlow squared voltage magnitude w = |V|² [p.u.²].

Constructors, destructors, conversion operators

BusLP(const Bus& pbus, const InputContext& ic) explicit constexpr

Public functions

auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
auto add_to_output(OutputContext& out) const -> bool
auto balance_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
auto bus() const -> const auto& noexcept
auto class_name(this const Self& self) -> auto noexcept
auto id() const -> auto noexcept
auto is_active(const StageLP& stage) const -> bool
Checks if object is active in given stage.
auto lookup_theta_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
auto needs_kirchhoff(const SystemContext& sc) const -> bool
auto object() & -> Bus& noexcept
Gets the wrapped object.
auto qbalance_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const BIndexHolder<RowIndex>&
auto reference_theta() const -> auto noexcept
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 theta_cols_at(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp, const std::vector<BlockLP>& blocks) const -> const BIndexHolder<ColIndex>&
auto uid() const -> auto noexcept
auto use_kirchhoff() const -> auto noexcept
auto voltage() const -> auto noexcept
auto vsq_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const BIndexHolder<ColIndex>&

Typedef documentation

using gtopt::BusLP::Element = Bus

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::BusLP::object_type = Bus

Type of the wrapped object.

Function documentation

gtopt::BusLP::BusLP(const Bus& pbus, const InputContext& ic) explicit constexpr

Parameters
pbus The bus to wrap
ic Input context for LP construction

Constructs a BusLP from a Bus and input context

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

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

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

bool gtopt::BusLP::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

std::optional<ColIndex> gtopt::BusLP::lookup_theta_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const noexcept

Look up an already-created theta column without lazy initialisation. Returns std::nullopt if no theta column exists for this (scenario, stage, block) triple (e.g. single-bus or reference bus). Delegates to the shared lookup_inner helper (index_holder.hpp).

Bus& gtopt::BusLP::object() & noexcept

Gets the wrapped object.

Returns Reference to the wrapped object

const BIndexHolder<RowIndex>& gtopt::BusLP::qbalance_rows_at(const ScenarioLP& scenario, const StageLP& stage) const

LinDistFlow reactive balance rows of (scenario, stage); empty when the model is off or the bus is inactive.

auto& gtopt::BusLP::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::BusLP::short_name(this const Self& self) noexcept

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

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

Returns The object's unique identifier

const BIndexHolder<ColIndex>& gtopt::BusLP::vsq_cols_at(const ScenarioLP& scenario, const StageLP& stage) const

LinDistFlow w columns of (scenario, stage); empty when the model is off or the bus is inactive.

Variable documentation

static std::string_view gtopt::BusLP::TypeKey

Metadata key published by add_to_lp so user-constraint filters can match buses by their type field (e.g. bus[type="hydro"]).