SystemLP class
#include <gtopt/system_lp.hpp>
Central coordinator for power system LP formulation.
Manages conversion of System components to LP representations and coordinates:
- Creation of variables and constraints
- Time structure management (blocks, stages, scenarios)
- Grid component interactions
- Result output
Public types
- using collections_t = std::tuple<Collection<BusLP>, Collection<DemandLP>, Collection<GeneratorLP>, Collection<LineLP>, Collection<GeneratorProfileLP>, Collection<DemandProfileLP>, Collection<BatteryLP>, Collection<ConverterLP>, Collection<ReserveZoneLP>, Collection<ReserveProvisionLP>, Collection<JunctionLP>, Collection<WaterwayLP>, Collection<FlowLP>, Collection<ReservoirLP>, Collection<ReservoirSeepageLP>, Collection<ReservoirDischargeLimitLP>, Collection<TurbineLP>, Collection<ReservoirProductionFactorLP>, Collection<FlowRightLP>, Collection<VolumeRightLP>, Collection<UserConstraintLP>>
Constructors, destructors, conversion operators
- SystemLP() deleted
- SystemLP(const System& system, SimulationLP& simulation, const LpMatrixOptions& flat_opts = {}) explicit
- SystemLP(const System& system, SimulationLP& simulation, PhaseLP phase, SceneLP scene, const LpMatrixOptions& flat_opts = {}) explicit
- Construct from System with simulation and options.
- SystemLP(const SystemLP&) deleted
- SystemLP(SystemLP&&) defaulted noexcept
- ~SystemLP() defaulted noexcept
Public functions
- auto collections(this Self&& self) -> constexpr auto&& noexcept
- auto contains(const Id<Element>& id) const -> constexpr bool noexcept
- auto create_lp(const LpMatrixOptions& flat_opts = {}) -> void
- auto element(this Self&& self, const Id<Element>& id) -> constexpr auto&&
- Get element by ID.
- auto element_index(const Id<Element>& id) const -> constexpr auto
- Get index of element by ID.
- auto elements(this Self&& self) -> constexpr auto&& noexcept
- Get all elements of specific type.
- auto is_single_bus(const Id& id) const -> constexpr bool
- auto linear_interface(this Self&& self) -> constexpr auto&& noexcept
- Access linear interfaces.
- auto name() const -> constexpr NameView noexcept
- Get system name.
- auto operator=(const SystemLP&) -> SystemLP& deleted noexcept
- auto operator=(SystemLP&&) -> SystemLP& defaulted noexcept
- auto options() const -> constexpr const auto& noexcept
- Get system options.
- auto phase() const -> constexpr const auto& noexcept
- auto prev_phase_sys() const -> constexpr const SystemLP* noexcept
- Get the previous phase's SystemLP (nullptr when not set).
- auto push_back(Element&& e) -> constexpr auto noexcept(…)
- Add element to appropriate collection.
- auto resolve(const SolverOptions& solver_options = {}) -> std::expected<int, Error>
- Resolves the linear programming problem.
- auto scene() const -> constexpr const auto& noexcept
- auto set_prev_phase_sys(const SystemLP* prev_sys) -> constexpr void noexcept
- Set the previous phase's SystemLP (nullptr for phase 0).
- auto single_bus_id() const -> constexpr const auto& noexcept
- auto system(this Self&& self) -> constexpr auto&& noexcept
- Access the underlying system.
- auto system_context(this Self&& self) -> constexpr auto&& noexcept
- Get system context.
- auto update_lp() -> int
- Update LP elements for all (scenario, stage) pairs in this system.
- auto write_lp(const std::string& filename) const -> std::expected<std::string, Error>
- Writes the LP problem to a file.
- auto write_out() const -> void
- Write output for all linear interfaces.
Typedef documentation
using gtopt:: SystemLP:: collections_t = std::tuple<Collection<BusLP>, Collection<DemandLP>, Collection<GeneratorLP>, Collection<LineLP>, Collection<GeneratorProfileLP>, Collection<DemandProfileLP>, Collection<BatteryLP>, Collection<ConverterLP>, Collection<ReserveZoneLP>, Collection<ReserveProvisionLP>, Collection<JunctionLP>, Collection<WaterwayLP>, Collection<FlowLP>, Collection<ReservoirLP>, Collection<ReservoirSeepageLP>, Collection<ReservoirDischargeLimitLP>, Collection<TurbineLP>, Collection<ReservoirProductionFactorLP>, Collection<FlowRightLP>, Collection<VolumeRightLP>, Collection<UserConstraintLP>>
Tuple of collections for all LP component types. UserConstraintLP is placed LAST so that user-constraint rows are added to the LP after all other elements whose columns they reference.
Function documentation
gtopt:: SystemLP:: SystemLP(const System& system,
SimulationLP& simulation,
PhaseLP phase,
SceneLP scene,
const LpMatrixOptions& flat_opts = {}) explicit
Construct from System with simulation and options.
| Parameters | |
|---|---|
| system | The power system to model |
| simulation | Reference to the SimulationLP (scenarios, phases, etc.) |
| phase | Phase LP to associate with this system |
| scene | Scene LP to associate with this system |
| flat_opts | Additional LP build options (default empty) |
std::expected<int, Error> gtopt:: SystemLP:: resolve(const SolverOptions& solver_options = {})
Resolves the linear programming problem.
| Parameters | |
|---|---|
| solver_options | Configuration options for the LP solver |
| Returns | Expected with solver status code (0 = optimal) or error |
int gtopt:: SystemLP:: update_lp()
Update LP elements for all (scenario, stage) pairs in this system.
| Returns | Total number of LP modifications across all elements |
|---|
Iterates over all scenarios and stages in this SystemLP and dispatches element.update_lp() to every collection element that satisfies the HasUpdateLP concept. May update coefficients, bounds, or RHS values.