-
Notifications
You must be signed in to change notification settings - Fork 2
/
Model.h
172 lines (130 loc) · 6.81 KB
/
Model.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
* PGMcpp : PRIMED Grid Modelling (in C++)
* Copyright 2023 (C)
*
* Anthony Truelove MASc, P.Eng.
* email: [email protected]
* github: gears1763-2
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* CONTINUED USE OF THIS SOFTWARE CONSTITUTES ACCEPTANCE OF THESE TERMS.
*
*/
///
/// \file Model.h
///
/// \brief Header file for the Model class.
///
#ifndef MODEL_H
#define MODEL_H
// components
#include "Controller.h"
#include "ElectricalLoad.h"
#include "Resources.h"
// production
#include "Production/Combustion/Diesel.h"
#include "Production/Noncombustion/Hydro.h"
#include "Production/Renewable/Solar.h"
#include "Production/Renewable/Tidal.h"
#include "Production/Renewable/Wave.h"
#include "Production/Renewable/Wind.h"
// storage
#include "Storage/LiIon.h"
///
/// \struct ModelInputs
///
/// \brief A structure which bundles the necessary inputs for the Model constructor.
/// Provides default values for every necessary input (except
/// path_2_electrical_load_time_series, for which a valid input must be provided).
///
struct ModelInputs {
std::string path_2_electrical_load_time_series = ""; ///< A string defining the path (either relative or absolute) to the given electrical load time series.
ControlMode control_mode = ControlMode :: LOAD_FOLLOWING; ///< The control mode to be applied by the Controller object.
// **** DEPRECATED ****
/*
double load_operating_reserve_factor = 0.2; //< An operating reserve factor [0, 1] to cover random fluctuations in load.
double max_operating_reserve_factor = 1; //< A maximum reserve factor [0, 1] that limits the required overall operating reserve to, at most, factor * load_kW.
*/
double firm_dispatch_ratio = 0.1; ///< The ratio [0, 1] of the load in each time step that must be dispatched from firm assets.
double load_reserve_ratio = 0.1; ///< The ratio [0, 1] of the load in each time step that must be included in the required spinning reserve.
};
///
/// \class Model
///
/// \brief A container class which forms the centre of PGMcpp. The Model class is
/// intended to serve as the primary user interface with the functionality of
/// PGMcpp, and as such it contains all other classes.
///
class Model {
private:
// 1. attributes
void __checkInputs(ModelInputs);
void __computeFuelAndEmissions(void);
void __computeNetPresentCost(void);
void __computeLevellizedCostOfEnergy(void);
void __computeEconomics(void);
void __writeSummary(std::string);
void __writeTimeSeries(std::string, int = -1);
// 2. methods
//...
public:
// 1. attributes
double total_fuel_consumed_L; ///< The total fuel consumed [L] over a model run.
Emissions total_emissions; ///< An Emissions structure for holding total emissions [kg].
double net_present_cost; ///< The net present cost of the Model (undefined currency).
double total_renewable_noncombustion_dispatch_kWh; ///< The total energy dispatched [kWh] by all renewable and non-combustion assets over the Model run.
double total_renewable_noncombustion_charge_kWh; ///< The total energy stored [kWh] from all renewable and non-combustion assets over the Model run.
double total_combustion_charge_kWh; ///< The total energy stored [kWh] from all combustion assets over the Model run.
double total_discharge_kWh; ///< The total energy discharged [kWh] from all storage assets over the Model run.
double total_dispatch_kWh; ///< The total energy dispatched [kWh] from all production assets over the Model run.
double renewable_penetration; ///< The total renewable (i.e. non-combustion) penetration over the Model run.
double levellized_cost_of_energy_kWh; ///< The levellized cost of energy, per unit energy dispatched/discharged, of the Model [1/kWh] (undefined currency).
Controller controller; ///< Controller component of Model
ElectricalLoad electrical_load; ///< ElectricalLoad component of Model
Resources resources; ///< Resources component of Model
std::vector<Combustion*> combustion_ptr_vec; ///< A vector of pointers to the various Combustion assets in the Model
std::vector<Noncombustion*> noncombustion_ptr_vec; ///< A vector of pointers to the various Noncombustion assets in the Model
std::vector<Renewable*> renewable_ptr_vec; ///< A vector of pointers to the various Renewable assets in the Model
std::vector<Storage*> storage_ptr_vec; ///< A vector of pointers to the various Storage assets in the Model
// 2. methods
Model(void);
Model(ModelInputs);
void addDiesel(DieselInputs);
void addResource(NoncombustionType, std::string, int);
void addResource(RenewableType, std::string, int);
void addHydro(HydroInputs);
void addSolar(SolarInputs);
void addTidal(TidalInputs);
void addWave(WaveInputs);
void addWind(WindInputs);
void addLiIon(LiIonInputs);
void run(void);
void reset(void);
void clear(void);
void writeResults(std::string, int = -1);
~Model(void);
}; /* Model */
#endif /* Model_H */