Controls Module
API Reference
Below is the API reference for submodules of the Controls
module.
Submodule Components
EvaporationSeries.h
-
class EvaporationSeries : public Catchment
- #include <EvaporationSeries.h>
This class is a subclass of the main
Catchment
class and represents a series of evaporation data over time.Created by bernardoct on 6/22/17.
Public Functions
-
EvaporationSeries(vector<vector<double>> *evaporation_series, int series_length)
Constructs an
EvaporationSeries
object for managing and storing evaporation data over time. Initializes the series with a pointer to evaporation data and its length.- Parameters:
evaporation_series – Pointer to a vector of vectors containing the evaporation data series.
series_length – Integer representing the length of the evaporation data series.
-
EvaporationSeries(const EvaporationSeries &evaporation_series)
Copy constructor for the
EvaporationSeries
class. Creates a newEvaporationSeries
object by copying an existing one.- Parameters:
evaporation_series – Reference to the
EvaporationSeries
object to be copied.
-
EvaporationSeries &operator=(const EvaporationSeries &evaporation_series)
Overloads the assignment operator for the
EvaporationSeries
class, allowing one object to be assigned the attributes of another.- Parameters:
evaporation_series – Reference to the
EvaporationSeries
object to be assigned.- Returns:
A reference to the updated
EvaporationSeries
object after assignment.
-
~EvaporationSeries() override
Destructor for the
EvaporationSeries
class. Cleans up resources associated with the object. Since no dynamic allocation is explicitly used, the destructor is empty.- Returns:
void
-
double getEvaporation(int week)
Retrieves the evaporation value for a specified week. This is a wrapper for the base class
Catchment::getStreamflow
function.- Parameters:
week – Integer representing the week for which the evaporation value is requested.
- Returns:
A double representing the evaporation value for the specified week.
-
virtual void setRealization(unsigned long r, vector<double> &rdm_factors) override
Sets the realization for the
EvaporationSeries
object and scales the evaporation values based on its corresponding DU factors.- Parameters:
r – Unsigned long integer representing the realization ID.
rdm_factors – Reference to a vector of doubles containing Random Decision-Making (RDM) factors to modify evaporation values.
- Returns:
void
-
EvaporationSeries(vector<vector<double>> *evaporation_series, int series_length)
FixedMinEnvFlowControl.h
-
class FixedMinEnvFlowControl : public MinEnvFlowControl
- #include <FixedMinEnvFlowControl.h>
This class is a subclass of the main
MinEnvFlowControl
class and represents a water source with fixed minimum environmental flow control.Created by bernardoct on 6/29/17.
Public Functions
-
FixedMinEnvFlowControl(int water_source_id, double release)
Constructs a
FixedMinEnvFlowControl
object for managing fixed minimum environmental flow controls on a water source. Initializes the control with a specified water source ID and a fixed release amount.- Parameters:
water_source_id – Integer representing the ID of the water source under environmental flow control.
release – Double representing the fixed release amount for the environmental flow.
-
FixedMinEnvFlowControl(const FixedMinEnvFlowControl &min_env_control)
Copy constructor for the
FixedMinEnvFlowControl
class. Creates a newFixedMinEnvFlowControl
object by copying the attributes from an existing one.- Parameters:
min_env_control – Reference to the
FixedMinEnvFlowControl
object to be copied.
-
~FixedMinEnvFlowControl() override
Destructor for the
FixedMinEnvFlowControl
class. Cleans up resources associated with the object. Since the destructor is defaulted, no custom cleanup is required.- Returns:
void
-
virtual double getRelease(int week) override
Retrieves the fixed release amount for the environmental flow control.
This function overrides the
getRelease
function in theMinEnvFlowControl
class.- Parameters:
week – Integer representing the week for which the release amount is requested. (Note: For this fixed flow control, the release amount does not depend on the week.)
- Returns:
A double representing the fixed release amount.
Private Members
-
double release
The release to be maintained to ensure minimum environmental flow.
-
FixedMinEnvFlowControl(int water_source_id, double release)
InflowMinEnvFlowControl.h
-
class InflowMinEnvFlowControl : public MinEnvFlowControl
- #include <InflowMinEnvFlowControl.h>
This class is a subclass of the main
MinEnvFlowControl
class and represents inflow water sources with minimum environmental flow control.Created by bernardoct on 6/29/17.
Public Functions
-
InflowMinEnvFlowControl(int water_source_id, const vector<double> &inflows, const vector<double> &releases)
Constructs an
InflowMinEnvFlowControl
object for managing minimum environmental flow controls based on inflow values. Initializes the control with a specified water source ID, inflow thresholds, and corresponding release amounts.- Parameters:
water_source_id – Integer representing the ID of the water source under environmental flow control.
inflows – Reference to a vector of doubles containing inflow thresholds.
releases – Reference to a vector of doubles containing the corresponding release amounts for each inflow threshold.
-
InflowMinEnvFlowControl(const InflowMinEnvFlowControl &min_env_control)
Copy constructor for the
InflowMinEnvFlowControl
class. Creates a newInflowMinEnvFlowControl
object by copying the attributes from an existing one.- Parameters:
min_env_control – Reference to the
InflowMinEnvFlowControl
object to be copied.
-
~InflowMinEnvFlowControl() override
Destructor for the
InflowMinEnvFlowControl
class. Cleans up resources associated with the object. Since the destructor is defaulted, no custom cleanup is required.- Returns:
void
Public Members
-
const vector<double> &inflows
A reference to a vector of doubles containing inflow.
-
const vector<double> &releases
A reference to a vector of doubles containing the corresponding release amounts.
Private Functions
-
virtual double getRelease(int week) override
Calculates the release amount for a specified week based on the inflow thresholds and corresponding release values.
- Parameters:
week – Integer representing the week for which the release amount is calculated.
- Returns:
A double representing the calculated release amount for the specified week.
-
InflowMinEnvFlowControl(int water_source_id, const vector<double> &inflows, const vector<double> &releases)
MinEnvFlowControl.h
-
class SeasonalMinEnvFlowControl : public MinEnvFlowControl
- #include <SeasonalMinEnvFlowControl.h>
This class is a subclass of the main
MinEnvFlowControl
class and represents water sources with seasonal minimum environmental flow control.Created by bernardoct on 6/28/17.
Public Functions
-
SeasonalMinEnvFlowControl(int water_source_id, const vector<int> &week_thresholds, const vector<double> &min_env_flows)
Constructs a
SeasonalMinEnvFlowControl
object for managing seasonal minimum environmental flow controls. Initializes the control with a specified water source ID, seasonal week thresholds, and corresponding minimum flow rates.- Parameters:
water_source_id – Integer representing the ID of the water source under environmental flow control.
week_thresholds – Reference to a vector of integers specifying the week intervals that define seasonal periods.
min_env_flows – Reference to a vector of doubles specifying the minimum flow rates for each seasonal period.
- Throws:
-
SeasonalMinEnvFlowControl(const SeasonalMinEnvFlowControl &min_env_control)
Copy constructor for the
SeasonalMinEnvFlowControl
class. Creates a newSeasonalMinEnvFlowControl
object by copying the attributes from an existing one.- Parameters:
min_env_control – Reference to the
SeasonalMinEnvFlowControl
object to be copied.
-
virtual double getRelease(int week) override
Calculates the release amount for a specified week based on seasonal week thresholds and corresponding flow rates.
This function overrides the
getRelease
function in theMinEnvFlowControl
class.- Parameters:
week – Integer representing the week for which the release amount is calculated.
- Returns:
A double representing the calculated release amount for the specified week.
Private Members
-
const vector<int> &week_thresholds
A reference to a vector of integers containing the week thresholds for seasonal minimum environmental flow requirements.
-
const vector<double> &min_env_flows
A reference to a vector of doubles containing the minimum environmental flow requirements for each week.
-
SeasonalMinEnvFlowControl(int water_source_id, const vector<int> &week_thresholds, const vector<double> &min_env_flows)
StorageMinEnvFlowControl.h
-
class StorageMinEnvFlowControl : public MinEnvFlowControl
- #include <StorageMinEnvFlowControl.h>
This class is a subclass of the main
MinEnvFlowControl
class and represents storage water sources with minimum environmental flow control.Created by bernardoct on 6/28/17.
Public Functions
-
StorageMinEnvFlowControl(int water_source_id, const vector<int> &aux_water_sources_ids, vector<double> &storages, vector<double> &releases)
Constructs a
StorageMinEnvFlowControl
object for managing minimum environmental flow controls based on storage levels. Initializes the control with a specified water source ID, auxiliary water sources, storage thresholds, and corresponding release values.- Parameters:
water_source_id – Integer representing the ID of the primary water source under environmental flow control.
aux_water_sources_ids – Reference to a vector of integers containing the IDs of auxiliary water sources (e.g., reservoirs or quarries).
storages – Reference to a vector of doubles containing storage thresholds.
releases – Reference to a vector of doubles containing the corresponding release amounts for each storage threshold.
- Throws:
std::invalid_argument – If the number of auxiliary water sources is not exactly one.
-
StorageMinEnvFlowControl(const StorageMinEnvFlowControl &min_env_control)
Copy constructor for the
StorageMinEnvFlowControl
class. Creates a newStorageMinEnvFlowControl
object by copying the attributes from an existing one.- Parameters:
min_env_control – Reference to the
StorageMinEnvFlowControl
object to be copied.
Public Members
-
const vector<double> &storages
A reference to the vector of doubles containing storage thresholds.
-
const vector<double> &releases
A reference to the vector of doubles containing the corresponding release amounts for each storage threshold.
Private Functions
-
virtual double getRelease(int week)
Calculates the release amount for a specified week based on storage thresholds and corresponding release values.
- Parameters:
week – Integer representing the week for which the release amount is calculated.
- Returns:
A double representing the calculated release amount for the specified week.
-
StorageMinEnvFlowControl(int water_source_id, const vector<int> &aux_water_sources_ids, vector<double> &storages, vector<double> &releases)
WwtpDischargeRule.h
-
class WwtpDischargeRule : public ControlRules
- #include <WwtpDischargeRule.h>
This class is a subclass of the main
ControlRules
class and represents the discharge rules for a wastewater treatment plant (WWTP).Created by bernardoct on 6/26/17.
Public Functions
-
WwtpDischargeRule(vector<vector<double>> year_series_fraction_discharge, vector<int> discharge_to_source_ids)
Constructs a
WwtpDischargeRule
object to manage discharge rules for a wastewater treatment plant (WWTP). Initializes the object with time-series discharge fractions and the associated discharge source IDs.- Parameters:
year_series_fraction_discharge – A vector of vectors, where each inner vector contains discharge fractions for each week of the year. Each vector must have exactly 53 elements (to account for years with an extra week).
discharge_to_source_ids – A vector of integers representing the IDs of the discharge sources.
- Throws:
-
WwtpDischargeRule(WwtpDischargeRule &wwtp_discharge_rule)
Copy constructor for the
WwtpDischargeRule
class. Creates a newWwtpDischargeRule
object by copying the attributes from an existing one.- Parameters:
wwtp_discharge_rule – Reference to the
WwtpDischargeRule
object to be copied.
-
WwtpDischargeRule &operator=(const WwtpDischargeRule &wwtp_discharge_rule)
Overloads the assignment operator for the
WwtpDischargeRule
class, allowing one object to be assigned the attributes of another.- Parameters:
wwtp_discharge_rule – Reference to the
WwtpDischargeRule
object to be assigned.- Returns:
A reference to the updated
WwtpDischargeRule
object after assignment.
-
virtual double get_dependent_variable(double water_source_id) override
Throws an exception because this overload of
get_dependent_variable
is not valid forWwtpDischargeRule
. This function serves to catch the potential error where the user misses theweek
parameter.This function overrides the
get_dependent_variable
method in theControlRules
class.- Parameters:
water_source_id – Double placeholder parameter (not used in this implementation).
- Throws:
std::invalid_argument – Always throws an exception with a message indicating that this overload is invalid. The valid method requires a both water source ID (int) and a week number (int) as arguments.
-
virtual double get_dependent_variable(int water_source_id) override
Retrieves the fraction of the week’s demand to be discharged as effluent for a specified water source and week.
This function overrides the
get_dependent_variable
method in theControlRules
class.- Parameters:
water_source_id – Integer representing the ID of the water source for which the discharge fraction is requested.
week – Integer representing the week for which the discharge fraction is requested.
- Returns:
A double representing the fraction of the week’s demand to be discharged as effluent.
-
virtual double get_dependent_variable(double x, int week) override
Throws an exception because this overload of
get_dependent_variable
is not valid forWwtpDischargeRule
. This function serves to catch the potential error where the user attempts to callget_dependent_variable
with a double parameter.This function overrides the
get_dependent_variable
method in theControlRules
class.- Parameters:
x – Double placeholder parameter (not used in this implementation).
week – Integer representing the week for which the discharge fraction is requested.
- Throws:
std::invalid_argument – Always throws an exception with a message indicating that this overload is invalid. The valid method requires a water source ID (int) and a week number (int) as arguments.
-
virtual double get_dependent_variable(int x, int week) override
Retrieves the fraction of the week’s demand to be discharged as effluent for a specified water source and week.
This function overrides the
get_dependent_variable
method in theControlRules
class.- Parameters:
water_source_id – Integer representing the ID of the water source for which the discharge fraction is requested.
week – Integer representing the week for which the discharge fraction is requested.
- Returns:
A double representing the fraction of the week’s demand to be discharged as effluent.
Public Members
-
vector<vector<double>> year_series_fraction_discharge
A 2D vector of doubles containing the fraction of the week’s demand to be discharged as effluent.
-
vector<int> discharge_to_source_ids
A vector of integers containing the IDs of the sources receiving the effluent.
Private Members
-
vector<int> source_id_to_vector_index
A vector of IDs mapping the source IDs to the corresponding index in the
discharge_to_source_ids
vector.
-
WwtpDischargeRule(vector<vector<double>> year_series_fraction_discharge, vector<int> discharge_to_source_ids)