Documentation of UrbanFireXDT
Documentation of UrbanFireXDT
Loading...
Searching...
No Matches
units.h
Go to the documentation of this file.
1/*
2 * units.h
3 *
4 * It contains the definition of all units. A unit is
5 * a compositions of individual components, that might
6 * has more complex control rules or the additionl data
7 * input.
8 *
9 */
10
11#ifndef UNITS_H
12#define UNITS_H
13
14#include <atomic>
15#include <condition_variable>
16#include <string>
17#include <list>
18#include <map>
19#include <mutex>
20
21// The following classes are defined in this header file:
22class Substation;
23class ControlUnit;
24class MeasurementUnit;
26
27#include "global.h"
28#include "components.h"
30#include "output.h"
31#include "worker_threads.hpp"
32
33
40template<class Derived>
41class BaseUnit {
42 public:
46 ~BaseUnit() = default;
47
55 static void InitializeStaticVariables(unsigned long n) {
56 Derived::InitializeStaticVariables(n);
57 }
58
68 Derived::VacuumInstancesAndStaticVariables();
69 }
70};
71
72
77class Substation : BaseUnit<Substation> {
78 public:
83 static bool InstantiateNewSubstation(unsigned long public_id, std::string* name);
84 private:
85 Substation(unsigned long internal_id, unsigned long public_id, std::string* name);
86 public:
88 // getter methods
89 unsigned long get_internal_id() const { return internal_id; }
90 unsigned long get_id() const { return public_id; }
91 const std::string * get_name() const { return name; }
92 double get_station_load() const { return station_load; }
93 double get_residential_load() const { return resident_load; }
94 double get_residential_demand() const { return resident_demand; }
95 double get_other_demand() const { return other_demand; }
96 double get_current_demand_no_BESS() const { return total_demand; }
97 double get_current_BESS_demand() const { return total_BESS_demand; }
98 double get_current_PV_generation_total_kW() const { return pv_gen_total_kW; }
99 double get_current_BS_generation_total_kW() const { return bs_gen_total_kW; }
100 double get_current_CHP_generation_total_kW() const { return chp_gen_total_kW; }
101 double get_current_wind_generation_total_kW() const { return wind_gen_total_kW; }
102 double get_current_unknown_generation_total_kW() const { return unknown_gen_total_kW; }
103 double get_current_PV_feedin_to_grid_kW() const { return pv_gen_expo_kW; }
104 double get_current_BS_feedin_to_grid_kW() const { return bs_gen_expo_kW; }
105 double get_current_CHP_feedin_to_grid_kW() const { return chp_gen_expo_kW; }
106 double get_current_wind_feedin_to_grid_kW() const { return wind_gen_expo_kW; }
107 double get_current_unknown_feedin_to_grid_kW() const { return unknown_gen_expo_kW; }
108 // modifiers bevore simulation start
109 void add_unit(ControlUnit* unit);
110 // methods for simulation run
111 void calc_load();
112 const std::list<ControlUnit*>* get_connected_units() { return connected_units; }
113 //
114 // static functions
115 // 1. Initializers and destructors
116 static void InitializeStaticVariables(unsigned long n_substations);
118 // 2. getter functions
119 static Substation* GetInstancePublicID(unsigned long public_id);
120 static Substation* GetInstanceInternalID(unsigned long internal_id) { return st__substation_list[internal_id]; }
121 static const std::vector<Substation*>& GetArrayOfInstances() { return st__substation_list; }
122 static size_t GetNumberOfInstances() {return st__n_substations;}
123 private:
124 // constant member variables (other languages might call this 'final')
125 const unsigned long internal_id;
126 const unsigned long public_id;
127 const std::string *const name;
128 // member variables that can change over time
129 std::list<ControlUnit*>* connected_units;
130 double station_load;
131 double resident_load;
132 double resident_demand;
133 double other_demand;
134 double total_demand;
135 double total_BESS_demand;
136 double pv_gen_total_kW;
137 double bs_gen_total_kW;
138 double chp_gen_total_kW;
139 double wind_gen_total_kW;
140 double unknown_gen_total_kW;
141 double pv_gen_expo_kW;
142 double bs_gen_expo_kW;
143 double chp_gen_expo_kW;
144 double wind_gen_expo_kW;
145 double unknown_gen_expo_kW;
146 //
147 // static list of substations
148 //static bool st__substation_list_init;
149 static unsigned long st__n_substations;
150 //static unsigned long st__new_substation_position;
151 static std::vector<Substation*> st__substation_list;
152 static std::map<unsigned long, unsigned long> public_to_internal_id;
153};
154
155
162class ControlUnit : BaseUnit<ControlUnit> {
163 public:
168 static bool InstantiateNewControlUnit(unsigned long unitID, unsigned long substation_id, unsigned long locationID, bool residential, unsigned int n_flats);
169 private:
179 ControlUnit(unsigned long internalID, unsigned long publicID, unsigned long substation_id, unsigned long locationID, bool residential, unsigned int n_flats);
180 public:
181 ~ControlUnit();
182 void add_unit(MeasurementUnit* unit);
183 bool has_electricity_demand() const;
184 bool has_pv() const;
185 bool has_bs() const;
186 bool has_hp() const;
187 bool has_cs() const;
188 bool has_chp() const;
189 bool has_wind() const;
190 bool has_bs_sim_added() const;
191 bool is_expandable_with_pv();
192 bool is_expandable_with_hp();
193 bool is_residential() const { return residential; }
194 bool heat_demand_given_in_data() const;
195 int get_exp_combi_bit_repr() const;
198 double get_current_load_vSMeter_kW() { return current_load_vSM_kW; }
199 double get_current_demand_wo_BS_or_gen_kW() const { return current_total_consumption_kW; }
200 double get_current_BS_demand_kW() const;
201 double get_current_PV_generation_kW() const;
202 double get_current_BS_generation_kW() const;
203 double get_current_CHP_generation_kW() const;
204 double get_current_wind_generation_kW() const;
205 double get_current_unknown_generation_kW() const;
206 double get_current_PV_feedin_to_grid_kW() const { return current_PV_feedin_to_grid_kW; }
207 double get_current_BS_feedin_to_grid_kW() const { return current_BS_feedin_to_grid_kW; }
208 double get_current_CHP_feedin_to_grid_kW() const { return current_CHP_feedin_to_grid_kW; }
209 double get_current_wind_feedin_to_grid_kW() const { return current_wind_feedin_to_grid_kW; }
210 double get_current_unknown_feedin_to_grid_kW() const { return current_unknown_feedin_to_grid_kW;}
211 size_t get_n_MUs() { return connected_units->size(); } // returns the number of MUs, that are connected to the given control unit
212 size_t get_internal_id() const { return internal_id; }
213 size_t get_unitID() const { return unitID; }
214 size_t get_location_id() const { return locationID; }
215 double get_mean_annual_MU_el_demand_kWh() const;
216 double get_sim_comp_pv_kWp() const;
217 double get_sim_comp_bs_P_kW() const;
218 double get_sim_comp_bs_E_kWh() const;
221 double get_sim_comp_cs_max_P_kW() const;
222 size_t get_sim_comp_cs_n_EVs() const;
223 size_t get_sim_comp_cs_possible_n_EVs() const;
224 double get_SSR();
225 double get_SCR();
226 double get_NPV();
227 string* get_metrics_string_annual(); // call this function only if simulation run is finished! It will the compute sums of flows,SSC,SSR and output this as a string
228 string* get_metrics_string_weekly_wr(unsigned long week_number); // This function outputs the weekly metrics AND resets the internal weekly counters!
229 string* get_pv_section_string(); // This function returns a string containing information about the sections of the sim. added PV component. If no PV component is added, it returns an empty string.
230 const ComponentBS* get_component_BS() const { if (has_sim_bs) return sim_comp_bs; else return nullptr; }
231 const ComponentHP* get_component_HP() const { if (has_sim_hp) return sim_comp_hp; else return nullptr; }
232 const ComponentCS* get_component_CS() const { if (has_sim_cs) return sim_comp_cs; else return nullptr; }
233 const ComponentPV* get_component_PV() const { if (has_sim_pv) return sim_comp_pv; else return nullptr; }
234 // public members
236 // modifiers
237 void add_exp_pv();
238 void add_exp_bs();
239 void add_exp_hp();
240 void add_exp_cs();
241 void add_ev(unsigned long carID);
242 void preprocess_ev_data();
243 void set_output_object(CUOutput* output_obj);
244 void set_exp_pv_params_A(float kWp_static);
245 void set_exp_pv_params_B(float kWp_per_m2, float min_kWp_sec, float max_kWp_sec, float max_kWp_unit);
246 void set_exp_bs_maxE_kWh(float value);
247 void set_exp_bs_maxP_kW (float value);
248 void set_exp_bs_E_P_ratio(float value); //< Set the E:P-ratio for simulatively added BS components to @param value
249 void remove_sim_added_pv();
250 void remove_sim_added_bs();
252 void reset_internal_state();
253 // for simulation runs
254 bool compute_next_value(unsigned long ts);
255#ifdef PYTHON_MODULE
256 void send_control_commands_from_py_interface(double p_bs_kW, double p_hp_kW, const std::vector<double>& p_ev_kW);
257#endif
258 //
259 // static functions
260 // 1. Initializers and destructors
261 static void InitializeStaticVariables(unsigned long n_CUs);
263 // 2. getter functions
264 static ControlUnit* GetInstancePublicID(unsigned long unitID);
265 static ControlUnit* GetInstancePublicIDWE(unsigned long unitID);
266 static ControlUnit* GetInstanceInternalID(unsigned long internalID) {return st__cu_list[internalID];}
267 //static ControlUnit* GetInstanceAtLocationID(unsigned long locationID);
268 static const std::vector<ControlUnit*>& GetArrayOfInstances() {return st__cu_list;}
269 static size_t GetNumberOfInstances() {return st__n_CUs;}
270 static size_t GetNumberOfCUsWithSimCompPV();
271 static size_t GetNumberOfCUsWithSimCompHP();
272 static size_t GetNumberOfCUsWithSimCompEV();
273 static double GetAllSimCompBatteriesCharge_kWh();
274 static double GetAllSimCompBatteriesCapacity_kWh();
275 static unsigned long GetTotalNumberOfOptimizationCalls() { return optimization_call_counter; }
276 static unsigned long GetCurrentNumberOfOptiVars() { return n_curr_optimization_vars; }
277 // 3. modifiers for all created objects
278 static void PreprocessEVData();
279 static void ResetAllInternalStates();
280 static void RemoveAllSimAddedComponents();
281 static void ChangeControlHorizonInTS(unsigned int new_horizon);
282 protected:
283 void change_control_horizon_in_ts(unsigned int new_horizon);
284 private:
285 // constant member variables (other languages might call this 'final')
286 const unsigned long internal_id;
287 const unsigned long unitID;
288 Substation *const higher_level_subst;
289 const unsigned long locationID;
290 const bool residential;
291 const bool generate_output_for_this_unit;
292 // member variables that can change over time
293 std::list<MeasurementUnit*>* connected_units;
294 bool has_sim_pv;
295 bool has_sim_bs;
296 bool has_sim_hp;
297 bool has_sim_cs;
298 ComponentPV* sim_comp_pv;
299 ComponentBS* sim_comp_bs;
300 ComponentHP* sim_comp_hp;
301 ComponentCS* sim_comp_cs;
302 CUOutput* output_obj;
303 BaseOptimizedController* optimized_controller;
304#ifdef PYTHON_MODULE
305 bool py_control_commands_obtained;
306 double py_cmd_p_bs_kW;
307 double py_cmd_p_hp_kW;
308 std::vector<double> py_cmd_p_ev_kW;
309#endif
310 // summation variables from the beginning of the simulation run until the current time step
311 double sum_of_consumption_kWh;
312 double sum_of_self_cons_kWh;
313 double sum_of_mu_cons_kWh;
314 double sum_of_feed_into_grid_kWh;
315 double sum_of_grid_demand_kWh;
316 double sum_of_rem_pow_costs_EUR;
317 double sum_of_saved_pow_costs_EUR;
318 double sum_of_feedin_revenue_EUR;
319 double sum_of_emissions_cbgd_kg_CO2eq;
320 double sum_of_emissions_avoi_kg_CO2eq;
321 unsigned long sum_of_errors_in_cntrl;
322 unsigned long sum_of_errors_in_cntrl_cmd_appl;
323 // other variables that are valid from the beginning of the simulation run until the current time step
324 double peak_grid_demand_kW;
325 // summation variables from the beginning of the currently simulated week until the current time step
326 double sum_of_cweek_consumption_kWh;
327 double sum_of_cweek_self_cons_kWh;
328 double sum_of_cweek_mu_cons_kWh;
329 double sum_of_cweek_feed_into_grid_kWh;
330 double sum_of_cweek_grid_demand_kWh;
331 double sum_of_cweek_rem_pow_costs_EUR;
332 double sum_of_cweek_saved_pow_costs_EUR;
333 double sum_of_cweek_feedin_revenue_EUR;
334 double sum_of_cweek_emissions_cbgd_kg_CO2eq;
335 double sum_of_cweek_emissions_avoi_kg_CO2eq;
336 unsigned long sum_of_cweek_errors_in_cntrl;
337 unsigned long sum_of_cweek_errors_in_cntrl_cmd_appl;
338 // other variables that are valid from the beginning of the currently simulated week until the current time step
339 double cweek_peak_grid_demand_kW;
340 // caches for optimization
341 unsigned long ts_since_last_opti_run;
342 //bool create_history_output; ///< True, if a history output should be created for this control unit.
343 // Internal storage variables for the current state, especially the current power flows
344 double current_load_vSM_kW;
345 double self_produced_load_kW;
346 double current_total_consumption_kW;
347 double current_PV_feedin_to_grid_kW;
348 double current_BS_feedin_to_grid_kW;
349 double current_CHP_feedin_to_grid_kW;
350 double current_wind_feedin_to_grid_kW;
351 double current_unknown_feedin_to_grid_kW;
352 //
353 bool is_expandable_with_pv_cache;
354 bool is_expandable_with_pv_cache_computed;
355 bool is_expandable_with_hp_cache;
356 bool is_expandable_with_hp_cache_computed;
357 //
358 // Variables required for multi-threading
359 // CUControllerWorkerThread is getting full access to the member variables of this class
360 // Required only for the member variable worker_thread
362 CUControllerWorkerThread* worker_thread;
363 //
364 // static list of CUs
365 static unsigned long st__n_CUs;
366 static std::vector<ControlUnit*> st__cu_list;
367 static std::map<unsigned long, unsigned long> public_to_internal_id;
368 static std::vector<double>* st__empty_vector_for_time_horizon;
369 //static std::map<unsigned long, ControlUnit*> location_to_cu_map;
370 // other static members
371 static std::atomic<unsigned long> optimization_call_counter;
372 static std::atomic<unsigned long> n_curr_optimization_vars;
373 static std::mutex n_curr_optimization_vars_mutex;
374 static std::condition_variable curr_opti_cv;
375 public:
376 static const std::string MetricsStringHeaderAnnual;
377 static const std::string MetricsStringHeaderWeekly;
378};
379
380
386class MeasurementUnit : BaseUnit<MeasurementUnit> {
387 public:
392 static bool InstantiateNewMeasurementUnit(size_t meUID, size_t public_unitID, std::string * meterPointName, size_t locID,
393 bool has_demand, bool has_feedin, bool has_pv_resid, bool has_pv_opens,
394 bool has_bess, bool has_hp, bool has_wind, bool has_evchst,
395 bool has_chp, const std::string& data_source_path);
396 private:
397 // initialization and destruction
398 MeasurementUnit(size_t internalID, size_t meUID, size_t public_unitID, std::string * meterPointName, size_t locID,
399 bool has_demand, bool has_feedin, bool has_pv_resid, bool has_pv_opens,
400 bool has_bess, bool has_hp, bool has_wind, bool has_evchst,
401 bool has_chp, const std::string& data_source_path);
402 public:
404 const std::string * get_meterPointName() const { return meterPointName; }
405 unsigned long get_internal_id() const { return internal_id; }
406 unsigned long get_meUID() const { return meUID; }
407 unsigned long get_locationID() const { return locationID; }
408 bool load_data();
409 bool has_demand() const { return rsm_has_demand; }
410 bool has_feedin() const { return rsm_has_feedin; }
411 bool has_pv() const { return rsm_with_pv_residential || rsm_with_pv_open_space; }
412 bool has_pv_residential() const { return rsm_with_pv_residential; }
413 bool has_pv_open_space() const { return rsm_with_pv_open_space; }
414 bool has_bs() const { return rsm_with_bess;}
415 bool has_hp() const { return rsm_with_hp; }
416 bool has_evchst() const { return rsm_with_evchst; }
417 bool has_chp() const { return rsm_with_chp; }
418 bool has_wind() const { return rsm_with_wind;}
419 int get_expansion_combination() const { return expansion_combination; }
420 // for simulation runs
421 double get_total_demand_kWh() const;
422 bool compute_next_value(unsigned long ts);
423 float get_current_ts_rsm_value() const { return current_load_rsm_kW; }
432 float get_rsm_load_at_ts(unsigned long ts) const;
441 float get_rsm_demand_at_ts(unsigned long ts) const;
451 float get_rsm_feedin_at_ts(unsigned long ts) const;
452 //
453 // Class (i.e. static) functions
454 // 1. Initializers and destructors
455 static void InitializeStaticVariables(unsigned long n_MUs);
457 static size_t GetNumberOfInstances() {return st__n_MUs;}
458 static bool LoadDataForAllInstances();
459 //
460 // 2. Class getter methods
461 static MeasurementUnit* GetInstancePublicID(unsigned long meUID);
462 private:
463 // constant member variables (other languages might call this 'final')
464 const unsigned long internal_id;
465 const unsigned long meUID;
466 ControlUnit *const higher_level_cu;
467 const std::string *const meterPointName;
468 const unsigned long locationID;
469 const std::string data_source_path;
470 // member variables that can change over time
471 float current_load_rsm_kW;
472 bool rsm_has_demand;
473 bool rsm_has_feedin;
474 bool rsm_with_pv_residential;
475 bool rsm_with_pv_open_space;
476 bool rsm_with_bess;
477 bool rsm_with_hp;
478 bool rsm_with_evchst;
479 bool rsm_with_wind;
480 bool rsm_with_chp;
481 int expansion_combination;
482 // member variables storing the data
483 bool data_loaded;
484 int* data_timestepID;
485 float* data_value_demand;
486 float* data_value_feedin;
487 //char* data_status_demand;
488 //char* data_status_feedin;
489 //
490 // static list of MUs
491 static size_t st__n_MUs;
492 static std::vector<MeasurementUnit*> st__mu_list;
493 static std::map<unsigned long, unsigned long> public_to_internal_id;
494};
495
496
497
502
504 public:
506 float get_current_feedin_kW() { return current_feedin_kW; }
507 // for simulation runs
508 bool compute_next_value(unsigned long ts);
509 private:
510 // constant member variables
511 const float kWp;
512 const float* profile_data;
513 // members that might change during the time
514 float current_feedin_kW;
515};
516
517#endif
518
Definition optimization_unit_general.hpp:16
Definition units.h:41
static void VacuumInstancesAndStaticVariables()
Clean up all instances and static variables of the derived class.
Definition units.h:67
static void InitializeStaticVariables(unsigned long n)
Initialize the number of instances for the derived class that must be known when simulation is starte...
Definition units.h:55
~BaseUnit()=default
Definition worker_threads.hpp:108
Definition output.h:191
Definition components.h:188
Definition components.h:337
Definition components.h:247
Definition components.h:136
Definition units.h:162
~ControlUnit()
Definition units.cpp:293
void preprocess_ev_data()
Preprocesses EV data, calls EVFSM::preprocessTourInformation() for all attached EVs....
Definition units.cpp:881
size_t get_sim_comp_cs_possible_n_EVs() const
Returns the number of EVs that would be connected to the charging station component,...
Definition units.cpp:575
void set_exp_bs_maxE_kWh(float value)
Definition units.cpp:920
const ComponentHP * get_component_HP() const
Returns a pointer to heat pump component, or nullptr if no such component is added.
Definition units.h:231
string * get_metrics_string_annual()
Definition units.cpp:618
void set_exp_bs_E_P_ratio(float value)
Definition units.cpp:930
double get_current_BS_demand_kW() const
Returns the current BESS (charging) demand in kW.
Definition units.cpp:464
double get_current_BS_generation_kW() const
Returns the current local BS generation (regardless of self-consumption), always greater or equal to ...
Definition units.cpp:480
static const std::vector< ControlUnit * > & GetArrayOfInstances()
Definition units.h:268
void remove_sim_added_pv()
Removes a simulatively added PV installation.
Definition units.cpp:944
void add_unit(MeasurementUnit *unit)
Definition units.cpp:303
static void ChangeControlHorizonInTS(unsigned int new_horizon)
Sets the optimization horizon (if another value is whished than given by Global::get_control_horizon_...
Definition units.cpp:1634
bool has_wind() const
Returns true, if the control unit has a wind turbine (or many) attachted (in data or simulated).
Definition units.cpp:363
static size_t GetNumberOfCUsWithSimCompEV()
Returns the number of control units that hold a simulatively added (private) EV charging stations.
Definition units.cpp:1665
int get_exp_combi_bit_repr_sim_added() const
Returns the bit representation of the expansion that has been simulatively added. See also namespace ...
Definition units.cpp:447
bool has_cs() const
Returns true, if the unit has an EV charging station connected (in data or simulated)
Definition units.cpp:345
double get_sim_comp_cs_max_P_kW() const
Returns the maximum available charging power of the simulatively added charging station (if the stati...
Definition units.cpp:567
float get_annual_hp_el_cons_kWh()
Returns the annual HP electricity consumption of a heat pump in kWh, if it would be added simulativel...
Definition units.cpp:563
double get_SSR()
Returns the SSR of the CU from the start of the simulation run until the time of function call; most ...
Definition units.cpp:579
static void InitializeStaticVariables(unsigned long n_CUs)
Definition units.cpp:1549
double get_sim_comp_bs_P_kW() const
Returns the maximum power in kW of the battery storage component that is added for the simulation,...
Definition units.cpp:537
double get_current_demand_wo_BS_or_gen_kW() const
Returns the current local demand of all components excluding the BESS and also not considering the lo...
Definition units.h:199
static size_t GetNumberOfInstances()
Definition units.h:269
string * get_pv_section_string()
Definition units.cpp:775
static size_t GetNumberOfCUsWithSimCompHP()
Returns the number of control units that hold a simulatively added heat pump.
Definition units.cpp:1656
double get_NPV()
Returns the net present value (NPV) of the CU from the start of the simulation run until the time of ...
Definition units.cpp:593
size_t get_unitID() const
returns the unit ID of this control unit as given in the system structure database
Definition units.h:213
static unsigned long GetCurrentNumberOfOptiVars()
Returns the current number of variables used in the currently running (parallel) optimizations....
Definition units.h:276
const ComponentPV * get_component_PV() const
Returns a pointer to PV component, or nullptr if no such component is added.
Definition units.h:233
double get_current_PV_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by a PV installation.
Definition units.h:206
static size_t GetNumberOfCUsWithSimCompPV()
Returns the number of control units that hold a simulatively added PV installation.
Definition units.cpp:1647
double get_current_unknown_generation_kW() const
Returns the current local generation that cannot be attributed to any generation technology (regardle...
Definition units.cpp:514
size_t get_n_MUs()
Definition units.h:211
double get_sim_comp_bs_E_kWh() const
Returns the maximum capacity in kWh of the battery storage component that is added for the simulation...
Definition units.cpp:543
bool has_bs() const
Returns true, if the control unit has a battery storage system attachted (in data or simulated).
Definition units.cpp:325
double get_current_PV_generation_kW() const
Returns the current local PV generation (regardless of self-consumption), always greater or equal to ...
Definition units.cpp:473
bool has_hp() const
Returns true, if the control unit has a heat pump attachted (in data or simulated).
Definition units.cpp:335
float get_annual_heat_demand_th_kWh()
Returns the annual heat demand in (thermal) kWh of all attachted buildings.
Definition units.cpp:549
static ControlUnit * GetInstancePublicID(unsigned long unitID)
Returns instance with a public unitID. Returns NULL, if unitID is out of the given range.
Definition units.cpp:1588
void set_exp_pv_params_B(float kWp_per_m2, float min_kWp_sec, float max_kWp_sec, float max_kWp_unit)
Set the kWp of expanded PV installations in the case of dynamic kWp computation per section.
Definition units.cpp:908
static bool InstantiateNewControlUnit(unsigned long unitID, unsigned long substation_id, unsigned long locationID, bool residential, unsigned int n_flats)
Definition units.cpp:185
void reset_internal_state()
Resets the internal state of the object, without removing added components.
Definition units.cpp:987
size_t get_internal_id() const
Returns the (consecutive) internal ID of the control unit.
Definition units.h:212
double get_current_CHP_generation_kW() const
Returns the current local CHP generation (regardless of self-consumption), always greater or equal to...
Definition units.cpp:489
double get_current_wind_generation_kW() const
Returns the current local wind generation (regardless of self-consumption), always greater or equal t...
Definition units.cpp:501
bool is_expandable_with_hp()
Is a simulated heat pump addable (yes, if geodata or gas consumption data is available)....
Definition units.cpp:398
static const std::string MetricsStringHeaderAnnual
The header for the output string produced by ControlUnit::get_metrics_string_annual()
Definition units.h:376
static double GetAllSimCompBatteriesCharge_kWh()
Returns the charge of all simulatively added battery storage systems at the current ts.
Definition units.cpp:1674
static ControlUnit * GetInstancePublicIDWE(unsigned long unitID)
Returns instance with a public unitID. Throws an error, if untiID is not defined.
Definition units.cpp:1597
void set_exp_pv_params_A(float kWp_static)
Set the kWp of expanded PV installations in the case of static kWp computation per section.
Definition units.cpp:896
bool has_chp() const
Returns true, if the control unit has a combined heat and power (CHP) plant attachted (in data or sim...
Definition units.cpp:355
static void ResetAllInternalStates()
Definition units.cpp:1616
bool compute_next_value(unsigned long ts)
Computes the value for the (next) time step. The parameter 'ts' defines the current time step (starti...
Definition units.cpp:1045
double get_sim_comp_pv_kWp() const
Returns the kWp of the PV-component that is added for the simulation, returns 0 if there is no added ...
Definition units.cpp:531
void change_control_horizon_in_ts(unsigned int new_horizon)
Sets the optimization horizon (if another value is whished than given by Global::get_control_horizon_...
Definition units.cpp:935
double get_SCR()
Returns the SCR of the CU from the start of the simulation run until the time of function call; most ...
Definition units.cpp:586
const ComponentCS * get_component_CS() const
Returns a pointer to EV charging station component, or nullptr if no such component is added.
Definition units.h:232
static void RemoveAllSimAddedComponents()
Removes all simulatively added components from all control units.
Definition units.cpp:1628
size_t get_location_id() const
Returns the location ID of the control unit.
Definition units.h:214
bool has_bs_sim_added() const
Returns true, if the control unit has a simulated battery storage system attachted.
Definition units.cpp:371
double get_current_CHP_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by a CHP.
Definition units.h:208
void remove_sim_added_components()
Remove all components that are added simulatively.
Definition units.cpp:964
static double GetAllSimCompBatteriesCapacity_kWh()
Returns the capacity of all simulatively added battery storage systems.
Definition units.cpp:1683
void add_exp_bs()
Adds a simulated battery storage. Mind: MUST be called after ControlUnit::add_exp_hp() if it is calle...
Definition units.cpp:811
bool is_residential() const
Is this unit a residential unit?
Definition units.h:193
static ControlUnit * GetInstanceInternalID(unsigned long internalID)
Returns the instance with a given internal ID without checking of the boundaries.
Definition units.h:266
size_t get_sim_comp_cs_n_EVs() const
Returns the number of connected EVs if the charging station component is enabled, otherwise 0 is retu...
Definition units.cpp:571
bool is_expandable_with_pv()
Is a simulated PV installation addable (yes, if geodata is available). This function uses caching.
Definition units.cpp:375
string * get_metrics_string_weekly_wr(unsigned long week_number)
Definition units.cpp:695
void add_exp_pv()
Definition units.cpp:783
bool is_sim_expanded
Puplicly accessible member, weather the control unit is expanded or not (required for SAC Planning)....
Definition units.h:235
bool heat_demand_given_in_data() const
Returns true, if the heat demand for this location is given in the input data.
Definition units.cpp:427
double get_current_BS_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by a battery storage system.
Definition units.h:207
void set_exp_bs_maxP_kW(float value)
Definition units.cpp:925
static void VacuumInstancesAndStaticVariables()
Definition units.cpp:1567
int get_exp_combi_bit_repr() const
Returns the bit representation of the current expansion (simulated added components) state (as in dat...
Definition units.cpp:431
double get_current_wind_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by a wind turbine.
Definition units.h:209
void add_exp_cs()
Activates / enables the EV charging station at the control unit.
Definition units.cpp:872
double get_current_load_vSMeter_kW()
Definition units.h:198
bool has_electricity_demand() const
Returns true if there is at least one connected measurement unit (MeasurementUnit) that shows a deman...
Definition units.cpp:307
void set_output_object(CUOutput *output_obj)
Definition units.cpp:892
static unsigned long GetTotalNumberOfOptimizationCalls()
Returns the total number of calls of an optimizer up to now.
Definition units.h:275
double get_mean_annual_MU_el_demand_kWh() const
Returns the mean electricity demand in kWh of all connected MUs over all available years.
Definition units.cpp:518
bool has_pv() const
Returns true, if the control unit has a PV attachted (in data or simulated).
Definition units.cpp:315
void remove_sim_added_bs()
Removes a simulatively added battery storage.
Definition units.cpp:954
void add_exp_hp()
Definition units.cpp:861
const ComponentBS * get_component_BS() const
Returns a pointer to battery storage component, or nullptr if no such component is added.
Definition units.h:230
double get_current_unknown_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by unknown components or not attrib...
Definition units.h:210
static void PreprocessEVData()
Preprocesses EV data (min/max consumption until a given ts, states, ...) for all EVs.
Definition units.cpp:1610
void add_ev(unsigned long carID)
Adds an EV to the charging station (regardless if the charging station is enabled or not)
Definition units.cpp:885
int get_exp_combi_bit_repr_from_MUs() const
Returns the bit representation of the expansion of this unit as defined in the data....
Definition units.cpp:435
static const std::string MetricsStringHeaderWeekly
The header for the output string produced by ControlUnit::get_metrics_string_weekly_wr()
Definition units.h:377
Definition units.h:386
~MeasurementUnit()
Definition units.cpp:1768
bool has_pv() const
Definition units.h:411
unsigned long get_meUID() const
Returns the ID as given in the system structe database.
Definition units.h:406
bool has_pv_open_space() const
Definition units.h:413
static size_t GetNumberOfInstances()
Definition units.h:457
bool load_data()
Load the data as given by the member variable data_source_path. Returns false if an error happend dur...
Definition units.cpp:1784
bool has_hp() const
Definition units.h:415
static bool LoadDataForAllInstances()
Loads the data for all created instances.
Definition units.cpp:1921
static MeasurementUnit * GetInstancePublicID(unsigned long meUID)
Returns instance with public id meUID (or NULL, if the ID is not available)
Definition units.cpp:1968
float get_current_ts_rsm_value() const
Definition units.h:423
static bool InstantiateNewMeasurementUnit(size_t meUID, size_t public_unitID, std::string *meterPointName, size_t locID, bool has_demand, bool has_feedin, bool has_pv_resid, bool has_pv_opens, bool has_bess, bool has_hp, bool has_wind, bool has_evchst, bool has_chp, const std::string &data_source_path)
Definition units.cpp:1705
bool has_evchst() const
Definition units.h:416
bool has_wind() const
Definition units.h:418
static void VacuumInstancesAndStaticVariables()
Definition units.cpp:1912
bool has_pv_residential() const
Definition units.h:412
int get_expansion_combination() const
Definition units.h:419
bool compute_next_value(unsigned long ts)
Definition units.cpp:1880
float get_rsm_load_at_ts(unsigned long ts) const
Definition units.cpp:1890
bool has_feedin() const
Definition units.h:410
unsigned long get_internal_id() const
Returns the (consecutive) internal ID of the measurement unit.
Definition units.h:405
unsigned long get_locationID() const
Returns the ID of the location.
Definition units.h:407
bool has_bs() const
Definition units.h:414
bool has_chp() const
Definition units.h:417
double get_total_demand_kWh() const
Returns the total demand of the measurement unit over the complete time span of data.
Definition units.cpp:1872
const std::string * get_meterPointName() const
Returns the name of the meter point.
Definition units.h:404
float get_rsm_feedin_at_ts(unsigned long ts) const
Definition units.cpp:1902
float get_rsm_demand_at_ts(unsigned long ts) const
Definition units.cpp:1896
bool has_demand() const
Definition units.h:409
static void InitializeStaticVariables(unsigned long n_MUs)
Definition units.cpp:1908
Definition units.h:503
float get_current_feedin_kW()
Definition units.h:506
bool compute_next_value(unsigned long ts)
Definition units.cpp:1998
Definition units.h:77
double get_current_BS_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by all connected battery storage sy...
Definition units.h:104
double get_current_wind_generation_total_kW() const
Returns the current generation (without consideration of self-consumption) in kW that is generated by...
Definition units.h:101
double get_current_unknown_generation_total_kW() const
Returns the current generation (without consideration of self-consumption) in kW that is generated by...
Definition units.h:102
double get_current_BESS_demand() const
Returns the current charging demand of all BESS in all connected units.
Definition units.h:97
void add_unit(ControlUnit *unit)
Definition units.cpp:91
void calc_load()
Definition units.cpp:95
double get_residential_demand() const
Returns the accumulated demand (i.e., only the positive virtual smart meter readings) of all resident...
Definition units.h:94
static void VacuumInstancesAndStaticVariables()
Definition units.cpp:146
static void InitializeStaticVariables(unsigned long n_substations)
Definition units.cpp:142
double get_residential_load() const
Returns the current load at the substation in kW, generated by residential control units only.
Definition units.h:93
double get_other_demand() const
Returns the accumulated demand (i.e., only the positive virtual smart meter readings) of all non-resi...
Definition units.h:95
double get_current_PV_generation_total_kW() const
Returns the current generation (without consideration of self-consumption) in kW that is generated by...
Definition units.h:98
double get_current_unknown_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by unknown components or not attrib...
Definition units.h:107
static Substation * GetInstancePublicID(unsigned long public_id)
Returns the instance with a given public_id.
Definition units.cpp:157
double get_current_CHP_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by all connected CHPs.
Definition units.h:105
static bool InstantiateNewSubstation(unsigned long public_id, std::string *name)
Definition units.cpp:42
const std::list< ControlUnit * > * get_connected_units()
Return the list of connected units (as read only list)
Definition units.h:112
static size_t GetNumberOfInstances()
Definition units.h:122
static const std::vector< Substation * > & GetArrayOfInstances()
Returns the std::vector of all substation instances. The objects itself are mutable,...
Definition units.h:121
double get_current_PV_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by all connected PV installations.
Definition units.h:103
unsigned long get_id() const
Returns the ID of the substation as defined in the system structure database.
Definition units.h:90
unsigned long get_internal_id() const
Returns the internal ID of the substation.
Definition units.h:89
double get_current_wind_feedin_to_grid_kW() const
Returns the current feed-in into the grid in kW that is generated by all connected wind turbines.
Definition units.h:106
double get_current_demand_no_BESS() const
Returns the current demand of all connected units without considering the local generation OR the BES...
Definition units.h:96
const std::string * get_name() const
Returns the name of the substation.
Definition units.h:91
double get_current_BS_generation_total_kW() const
Returns the current generation (without consideration of self-consumption) in kW that is generated by...
Definition units.h:99
double get_current_CHP_generation_total_kW() const
Returns the current generation (without consideration of self-consumption) in kW that is generated by...
Definition units.h:100
double get_station_load() const
Returns the current load at the substation in kW.
Definition units.h:92
~Substation()
Definition units.cpp:86
static Substation * GetInstanceInternalID(unsigned long internal_id)
Returns the instance with a given public_id.
Definition units.h:120
OpenSpacePVOrWindType
Definition units.h:498
@ Wind
Definition units.h:500
@ PV
Definition units.h:499