ReservoirProductionFactorLP class
LP representation of a ReservoirProductionFactor element.
Stores per-(scenario,stage,block) row/column indices for the turbine conversion-rate constraint so that the coefficient can be updated when the reservoir volume changes during SDDP iterations.
Base classes
-
template<typename ObjectType>class ObjectLP<ReservoirProductionFactor>
- Wrapper class that adds LP capabilities to objects.
Public types
- struct CoeffIndex
- Per-block conversion row and flow column indices for coefficient updates.
-
using BCoeffMap = flat_
map<BlockUid, CoeffIndex> - using Element = ReservoirProductionFactor
- using object_type = ReservoirProductionFactor
- Type of the wrapped object.
Public static functions
- static auto add_to_output(OutputContext& out) -> bool
Constructors, destructors, conversion operators
- ReservoirProductionFactorLP(const ReservoirProductionFactor& pre, InputContext& ic) explicit
Public functions
- auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- Register this production factor element in the LP.
- auto class_name(this const Self& self) -> auto noexcept
- auto coeff_indices_at(ScenarioUid suid, StageUid tuid) const -> const BCoeffMap&
- Access stored coefficient indices for a given (scenario, stage).
- auto compute_production_factor(Real volume) const -> Real noexcept
- Evaluate the piecewise-linear production factor at the given volume.
- auto has_coeff_indices(ScenarioUid suid, StageUid tuid) const -> bool
- Check if coefficient indices are available for a given (scenario, stage).
- auto id() const -> auto noexcept
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto mean_production_factor() const -> Real noexcept
- Return the mean (fallback) production factor value.
- auto object() & -> ReservoirProductionFactor& noexcept
- Gets the wrapped object.
- auto production_factor(this auto&& self) -> auto&& noexcept
- auto reservoir_sid() 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 turbine_sid() const -> auto noexcept
- auto uid() const -> auto noexcept
- auto update_conversion_coeff(LinearInterface& li, ScenarioUid suid, StageUid tuid, Real volume) const -> int
- Update the conversion-rate LP coefficient for a given volume.
- auto update_lp(SystemLP& sys, const ScenarioLP& scenario, const StageLP& stage) const -> int
- Update the conversion-rate LP coefficient based on reservoir volume.
Typedef documentation
using gtopt:: ReservoirProductionFactorLP:: Element = ReservoirProductionFactor
#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:: ReservoirProductionFactorLP:: object_type = ReservoirProductionFactor
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
bool gtopt:: ReservoirProductionFactorLP:: add_to_lp(const SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
Register this production factor element in the LP.
Locates the turbine's conversion rows and the waterway's flow columns, stores their indices for later coefficient updates. The initial conversion-rate coefficient is set during TurbineLP::add_to_lp().
auto gtopt:: ReservoirProductionFactorLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ReservoirProductionFactorLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: ReservoirProductionFactorLP:: 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 |
ReservoirProductionFactor& gtopt:: ReservoirProductionFactorLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
auto& gtopt:: ReservoirProductionFactorLP:: 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:: ReservoirProductionFactorLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ReservoirProductionFactorLP:: 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:: ReservoirProductionFactorLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: ReservoirProductionFactorLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|
int gtopt:: ReservoirProductionFactorLP:: update_conversion_coeff(LinearInterface& li,
ScenarioUid suid,
StageUid tuid,
Real volume) const
Update the conversion-rate LP coefficient for a given volume.
| Parameters | |
|---|---|
| li | The linear interface to modify |
| suid | Scenario UID |
| tuid | Stage UID |
| volume | Current reservoir volume [hm³] |
| Returns | Number of coefficients updated |
Evaluates the piecewise-linear production factor at volume and sets the coefficient to -prod_factor for every (row, col) pair stored for the given (scenario, stage). The negative sign matches the turbine conversion-row convention: generation − efficiency × prod_factor × flow = 0.
int gtopt:: ReservoirProductionFactorLP:: update_lp(SystemLP& sys,
const ScenarioLP& scenario,
const StageLP& stage) const
Update the conversion-rate LP coefficient based on reservoir volume.
| Returns | Number of LP coefficients modified (0 if unchanged or skipped) |
|---|
Determines the current reservoir volume from the previous LP solution (vavg = (vini + vfin) / 2), falling back to the JSON eini value when no previous solution is available (first stage of first phase).
Evaluates the piecewise-linear production factor at that volume and sets the turbine conversion coefficient to -prod_factor for every (row, col) pair stored for the given (scenario, stage).