Eclipse SUMO - Simulation of Urban MObility
V5/cpp/CEPHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2016-2022 German Aerospace Center (DLR) and others.
4// PHEMlight module
5// Copyright (C) 2016-2022 Technische Universitaet Graz, https://www.tugraz.at/
6// This program and the accompanying materials are made available under the
7// terms of the Eclipse Public License 2.0 which is available at
8// https://www.eclipse.org/legal/epl-2.0/
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License 2.0 are satisfied: GNU General Public License, version 2
12// or later which is available at
13// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
14// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
15/****************************************************************************/
21//
22/****************************************************************************/
23#pragma once
24
25#include <string>
26#include <map>
27#include <vector>
28#include <utility>
29
30//C# TO C++ CONVERTER NOTE: Forward class declarations:
31namespace PHEMlightdllV5 { class CEP; }
32namespace PHEMlightdllV5 { class Correction; }
33namespace PHEMlightdllV5 { class Helpers; }
34namespace PHEMlightdllV5 { class VEHPHEMLightJSON; }
35namespace PHEMlightdllV5 { class Vehicle_Data; }
36namespace PHEMlightdllV5 { class VEH; }
37namespace PHEMlightdllV5 { class Aux_Data; }
38namespace PHEMlightdllV5 { class Engine_Data; }
39namespace PHEMlightdllV5 { class Rollres_Data; }
40namespace PHEMlightdllV5 { class FullLoadDrag_Data; }
41namespace PHEMlightdllV5 { class Transmission_Data; }
42namespace PHEMlightdllV5 { class ICE_Data; }
43namespace PHEMlightdllV5 { class EM_Data; }
44
45namespace PHEMlightdllV5 {
46 //PHEMLight vehicle
48 // Vehicle data
49 public:
51 private:
52 std::string privateMassType;
53 std::string privateFuelType;
54 std::string privateCalcType;
59 double privateCw;
60 double privateA;
62
63 public:
64 const std::string& getMassType() const;
65 void setMassType(const std::string& value);
66 const std::string& getFuelType() const;
67 void setFuelType(const std::string& value);
68 const std::string& getCalcType() const;
69 void setCalcType(const std::string& value);
70 const double& getMass() const;
71 void setMass(const double& value);
72 const double& getLoading() const;
73 void setLoading(const double& value);
74 const double& getRedMassWheel() const;
75 void setRedMassWheel(const double& value);
76 const double& getWheelDiameter() const;
77 void setWheelDiameter(const double& value);
78 const double& getCw() const;
79 void setCw(const double& value);
80 const double& getA() const;
81 void setA(const double& value);
82 const double& getMileage() const;
83 void setMileage(const double& value);
84 };
85
86 // Rolling resistance data
87 public:
89 private:
90 double privateFr0;
91 double privateFr1;
92 double privateFr2;
93 double privateFr3;
94 double privateFr4;
95
96 public:
97 const double& getFr0() const;
98 void setFr0(const double& value);
99 const double& getFr1() const;
100 void setFr1(const double& value);
101 const double& getFr2() const;
102 void setFr2(const double& value);
103 const double& getFr3() const;
104 void setFr3(const double& value);
105 const double& getFr4() const;
106 void setFr4(const double& value);
107 };
108
109 // ICE engine
110 public:
111 class ICE_Data {
112 private:
116
117 public:
118 const double& getPrated() const;
119 void setPrated(const double& value);
120 const double& getnrated() const;
121 void setnrated(const double& value);
122 const double& getIdling() const;
123 void setIdling(const double& value);
124 };
125
126 // EM engine
127 public:
128 class EM_Data {
129 private:
132
133 public:
134 const double& getPrated() const;
135 void setPrated(const double& value);
136 const double& getnrated() const;
137 void setnrated(const double& value);
138 };
139
140 // Engine data
141 public:
143 private:
146
147 public:
148 ICE_Data* getICEData() const;
149 void setICEData(ICE_Data* value);
150 EM_Data* getEMData() const;
151 void setEMData(EM_Data* value);
152
153 Engine_Data();
154 };
155
156 // Auxiliaries data
157 public:
158 class Aux_Data {
159 private:
161
162 public:
163 const double& getPauxnorm() const;
164 void setPauxnorm(const double& value);
165 };
166
167 // Full load and Drag data
168 public:
170 private:
175 std::map<std::string, std::vector<double> > privateDragCurve;
176
177 public:
178 const double& getP_n_max_v0() const;
179 void setP_n_max_v0(const double& value);
180 const double& getP_n_max_p0() const;
181 void setP_n_max_p0(const double& value);
182 const double& getP_n_max_v1() const;
183 void setP_n_max_v1(const double& value);
184 const double& getP_n_max_p1() const;
185 void setP_n_max_p1(const double& value);
186 std::map<std::string, std::vector<double> >& getDragCurve();
187 void setDragCurve(const std::map<std::string, std::vector<double> >& value);
188
190 };
191
192 // Transmission data
193 public:
195 private:
197 std::map<std::string, std::vector<double> > privateTransm;
198
199 public:
200 const double& getAxelRatio() const;
201 void setAxelRatio(const double& value);
202 std::map<std::string, std::vector<double> >& getTransm();
203 void setTransm(const std::map<std::string, std::vector<double> >& value);
204
206 };
207
208 //Root object
209 public:
210 class VEH {
211 private:
212 std::string privateType;
213 std::string privateVersion;
220
221 public:
222 const std::string& getType() const;
223 void setType(const std::string& value);
224 const std::string& getVersion() const;
225 void setVersion(const std::string& value);
227 void setVehicleData(Vehicle_Data* value);
229 void setAuxiliariesData(Aux_Data* value);
230 Engine_Data* getEngineData() const;
231 void setEngineData(Engine_Data* value);
233 void setRollingResData(Rollres_Data* value);
235 void setFLDData(FullLoadDrag_Data* value);
238
239 VEH();
240 };
241
242 };
243
245 public:
246 CEPHandler();
247
248 private:
249 std::map<std::string, CEP*> _ceps;
250 public:
251 const std::map<std::string, CEP*>& getCEPS() const;
252
253
254 bool GetCEP(std::vector<std::string>& DataPath, Helpers* Helper, Correction* DataCor);
255
256
257 private:
258 bool CalcCorrection(Correction* DataCor, Helpers* Helper, VEHPHEMLightJSON::Vehicle_Data* vehicle_Data);
259
260 bool Load(std::vector<std::string>& DataPath, Helpers* Helper, Correction* DataCor, bool fleetMix = false);
261
262 bool ReadVehicleFile(const std::vector<std::string>& DataPath, const std::string& emissionClass, Helpers* Helper, bool fleetMix, VEHPHEMLightJSON::VEH*& Vehicle);
263
264 bool ReadEmissionData(bool readFC, const std::vector<std::string>& DataPath, const std::string& emissionClass, Helpers* Helper, bool fleetMix, Correction* DataCor, std::vector<std::string>& header, std::vector<std::vector<double> >& matrix, std::vector<double>& idlingValues);
265
266 bool CorrectEmissionData(Correction* DataCor, std::vector<std::string>& header, std::vector<std::vector<double> >& matrix, std::vector<double>& idlingValues);
267
268 //Calculate correction factor for detoriation and temperature correction
269 double GetDetTempCor(Correction* DataCor, const std::string& Emi);
270
271
272 //Split the string
273 const std::vector<std::string> split(const std::string& s, char delim);
274
275 //Convert string to double
276 double todouble(const std::string& s);
277
278 //Convert string to double list
279 std::vector<double> todoubleList(const std::vector<std::string>& s);
280
281 //Read a line from file
282 std::string ReadLine(std::ifstream& s);
283 };
284}
285
bool Load(std::vector< std::string > &DataPath, Helpers *Helper, Correction *DataCor, bool fleetMix=false)
const std::map< std::string, CEP * > & getCEPS() const
bool ReadVehicleFile(const std::vector< std::string > &DataPath, const std::string &emissionClass, Helpers *Helper, bool fleetMix, VEHPHEMLightJSON::VEH *&Vehicle)
std::string ReadLine(std::ifstream &s)
std::vector< double > todoubleList(const std::vector< std::string > &s)
double todouble(const std::string &s)
bool CorrectEmissionData(Correction *DataCor, std::vector< std::string > &header, std::vector< std::vector< double > > &matrix, std::vector< double > &idlingValues)
bool CalcCorrection(Correction *DataCor, Helpers *Helper, VEHPHEMLightJSON::Vehicle_Data *vehicle_Data)
std::map< std::string, CEP * > _ceps
bool GetCEP(std::vector< std::string > &DataPath, Helpers *Helper, Correction *DataCor)
const std::vector< std::string > split(const std::string &s, char delim)
double GetDetTempCor(Correction *DataCor, const std::string &Emi)
bool ReadEmissionData(bool readFC, const std::vector< std::string > &DataPath, const std::string &emissionClass, Helpers *Helper, bool fleetMix, Correction *DataCor, std::vector< std::string > &header, std::vector< std::vector< double > > &matrix, std::vector< double > &idlingValues)
std::map< std::string, std::vector< double > > & getDragCurve()
void setDragCurve(const std::map< std::string, std::vector< double > > &value)
std::map< std::string, std::vector< double > > privateDragCurve
void setTransm(const std::map< std::string, std::vector< double > > &value)
std::map< std::string, std::vector< double > > & getTransm()
std::map< std::string, std::vector< double > > privateTransm
void setTransmissionData(Transmission_Data *value)
void setType(const std::string &value)
void setVersion(const std::string &value)
void setFLDData(FullLoadDrag_Data *value)
void setVehicleData(Vehicle_Data *value)
FullLoadDrag_Data * getFLDData() const
Transmission_Data * getTransmissionData() const
void setRollingResData(Rollres_Data *value)
const std::string & getVersion() const
C++ TraCI client API implementation.