PumpLP class
#include <gtopt/pump_lp.hpp>
Linear programming representation of a hydraulic pump.
This class extends ObjectLP to provide LP-specific functionality for pumps, including:
- Conversion rate constraints between electrical power and water flow
- Relationships with connected waterways and demands
- Output of dual variables for sensitivity analysis
The pump constraint links the demand's load column to the waterway's flow column: pump_power [MW] >= pump_factor [MW/(m³/s)] × pump_flow [m³/s]
Or equivalently (as an LP row): pump_factor × flow - load <= 0
This ensures the pump consumes at least enough power to move the water.
Base classes
-
template<typename ObjectType>class ObjectLP<Pump>
- Wrapper class that adds LP capabilities to objects.
Public types
- using Element = Pump
- using object_type = Pump
- Type of the wrapped object.
Public static variables
- static std::string_view CapacityName
- static std::string_view ConversionName
Constructors, destructors, conversion operators
- PumpLP(const Pump& ppump, InputContext& ic) explicit
- Construct a PumpLP from a Pump and input context.
Public functions
- auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- Adds pump constraints to the linear problem.
- auto add_to_output(OutputContext& out) const -> bool
- Adds pump dual variables to the output context.
- auto class_name(this const Self& self) -> auto noexcept
- auto conversion_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const BIndexHolder<RowIndex>&
- Access conversion-rate constraint row indices for a (scenario, stage).
- auto demand_sid() const -> auto noexcept
- auto id() const -> auto noexcept
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto object() & -> Pump& noexcept
- Gets the wrapped object.
- auto pump(this auto&& self) -> 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 stage_efficiency(StageUid tuid) const -> Real
- 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
- auto waterway_sid() const -> WaterwayLPSId
Typedef documentation
using gtopt:: PumpLP:: Element = Pump
#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:: PumpLP:: object_type = Pump
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
gtopt:: PumpLP:: PumpLP(const Pump& ppump,
InputContext& ic) explicit
Construct a PumpLP from a Pump and input context.
| Parameters | |
|---|---|
| ppump | The pump to represent |
| ic | Input context containing system configuration |
bool gtopt:: PumpLP:: add_to_lp(const SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
Adds pump constraints to the linear problem.
| Parameters | |
|---|---|
| sc | System context containing component relationships |
| scenario | Current scenario being processed |
| stage | Current stage being processed |
| lp | Linear problem to add constraints to |
| Returns | true if successful, false on error |
Adds constraints that enforce the relationship between electrical power consumed by the pump and water flow through the waterway.
Conversion constraint (per block): pump_factor × flow - load <= 0
This means: load >= pump_factor × flow, i.e. the pump must consume at least pump_factor MW per m³/s of water pumped.
Optional capacity constraint (per block): flow <= capacity
bool gtopt:: PumpLP:: add_to_output(OutputContext& out) const
Adds pump dual variables to the output context.
| Parameters | |
|---|---|
| out | Output context to write results to |
| Returns | true if successful, false on error |
Outputs the dual variables associated with the pump's conversion rate constraints for sensitivity analysis.
auto gtopt:: PumpLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: PumpLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: PumpLP:: 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 |
Pump& gtopt:: PumpLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
auto& gtopt:: PumpLP:: 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:: PumpLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
Real gtopt:: PumpLP:: stage_efficiency(StageUid tuid) const
| Returns | The pump efficiency [p.u.] for the given stage (default 1.0) |
|---|
auto gtopt:: PumpLP:: 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:: PumpLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: PumpLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|