JunctionLP class
#include <gtopt/junction_lp.hpp>
Linear programming formulation for power system junctions.
This class provides the LP formulation for network junctions, including:
- Flow balance constraints (Kirchhoff's current law)
- Optional drain/loss terms
- Scenario/stage specific constraint indexing
The class inherits from ObjectLP<Junction> to provide basic LP object functionality while adding junction-specific constraints.
Base classes
-
template<typename ObjectType>class ObjectLP<Junction>
- Wrapper class that adds LP capabilities to objects.
Public types
- using Element = Junction
- using object_type = Junction
- Type of the wrapped object.
Public static variables
- static std::string_view BalanceName
- static std::string_view DrainName
Constructors, destructors, conversion operators
- JunctionLP(const Junction& pjunction, const InputContext& ic) explicit
- Construct a JunctionLP from input data.
Public functions
- auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- Add junction constraints to the linear program.
- auto add_to_output(OutputContext& out) const -> bool
- Add junction results to output context.
- auto balance_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- Get balance constraint rows for a scenario/stage combination.
- auto class_name(this const Self& self) -> auto noexcept
- auto drain() const -> auto noexcept
- auto drain_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- Get drain variable columns for a scenario/stage combination.
- auto find_balance_rows(const ScenarioLP& scenario, const StageLP& stage) const -> const BIndexHolder<RowIndex>* noexcept
- auto id() const -> auto noexcept
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto junction(this auto&& self) -> auto&& noexcept
- auto object() & -> Junction& noexcept
- Gets the wrapped object.
- 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:: JunctionLP:: Element = Junction
#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:: JunctionLP:: object_type = Junction
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
gtopt:: JunctionLP:: JunctionLP(const Junction& pjunction,
const InputContext& ic) explicit
Construct a JunctionLP from input data.
| Parameters | |
|---|---|
| pjunction | Junction data to model |
| ic | Input context providing system-wide parameters |
bool gtopt:: JunctionLP:: add_to_lp(const SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
Add junction constraints to the linear program.
| Parameters | |
|---|---|
| sc | System context containing model parameters |
| scenario | Current scenario LP object. |
| stage | Current stage LP object. |
| lp | Linear program to modify |
| Returns | true if successful, false otherwise |
bool gtopt:: JunctionLP:: add_to_output(OutputContext& out) const
Add junction results to output context.
| Parameters | |
|---|---|
| out | Output context to populate |
| Returns | true if successful, false otherwise |
const auto& gtopt:: JunctionLP:: balance_rows_at(const ScenarioLP& scenario,
const StageLP& stage) const
Get balance constraint rows for a scenario/stage combination.
| Parameters | |
|---|---|
| scenario | Scenario identifier |
| stage | Stage identifier |
| Returns | Const reference to the balance constraint rows |
auto gtopt:: JunctionLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: JunctionLP:: drain() const noexcept
| Returns | Whether this junction has drainage enabled |
|---|
const auto& gtopt:: JunctionLP:: drain_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
Get drain variable columns for a scenario/stage combination.
| Parameters | |
|---|---|
| scenario | Scenario identifier |
| stage | Stage identifier |
| Returns | Const reference to the drain variable columns |
const BIndexHolder<RowIndex>* gtopt:: JunctionLP:: find_balance_rows(const ScenarioLP& scenario,
const StageLP& stage) const noexcept
Non-throwing balance_rows_at: nullptr when (scenario, stage) was not built (junction inactive in the stage). See active_ref.hpp.
auto gtopt:: JunctionLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: JunctionLP:: is_active(const StageLP& stage) const
#include <gtopt/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 |
auto&& gtopt:: JunctionLP:: junction(this auto&& self) noexcept
| Returns | Reference to the underlying junction data |
|---|
Junction& gtopt:: JunctionLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
auto& gtopt:: JunctionLP:: 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:: JunctionLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: JunctionLP:: 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:: JunctionLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: JunctionLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|