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.dev/sumo
3 // Copyright (C) 2016-2024 German Aerospace Center (DLR) and others.
4 // PHEMlight module
5 // Copyright (C) 2016-2023 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:
31 namespace PHEMlightdllV5 { class CEP; }
32 namespace PHEMlightdllV5 { class Correction; }
33 namespace PHEMlightdllV5 { class Helpers; }
34 namespace PHEMlightdllV5 { class VEHPHEMLightJSON; }
35 namespace PHEMlightdllV5 { class Vehicle_Data; }
36 namespace PHEMlightdllV5 { class VEH; }
37 namespace PHEMlightdllV5 { class Aux_Data; }
38 namespace PHEMlightdllV5 { class Engine_Data; }
39 namespace PHEMlightdllV5 { class Rollres_Data; }
40 namespace PHEMlightdllV5 { class FullLoadDrag_Data; }
41 namespace PHEMlightdllV5 { class Transmission_Data; }
42 namespace PHEMlightdllV5 { class ICE_Data; }
43 namespace PHEMlightdllV5 { class EM_Data; }
44 
45 namespace PHEMlightdllV5 {
46  //PHEMLight vehicle
48  // Vehicle data
49  public:
50  class Vehicle_Data {
51  private:
52  std::string privateMassType;
53  std::string privateFuelType;
54  std::string privateCalcType;
55  double privateMass;
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:
88  class Rollres_Data {
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:
142  class Engine_Data {
143  private:
146 
147  public:
148  ICE_Data* getICEData();
149  EM_Data* getEMData();
150  };
151 
152  // Auxiliaries data
153  public:
154  class Aux_Data {
155  private:
157 
158  public:
159  const double& getPauxnorm() const;
160  void setPauxnorm(const double& value);
161  };
162 
163  // Full load and Drag data
164  public:
166  private:
171  std::map<std::string, std::vector<double> > privateDragCurve;
172 
173  public:
174  const double& getP_n_max_v0() const;
175  void setP_n_max_v0(const double& value);
176  const double& getP_n_max_p0() const;
177  void setP_n_max_p0(const double& value);
178  const double& getP_n_max_v1() const;
179  void setP_n_max_v1(const double& value);
180  const double& getP_n_max_p1() const;
181  void setP_n_max_p1(const double& value);
182  std::map<std::string, std::vector<double> >& getDragCurve();
183  void setDragCurve(const std::map<std::string, std::vector<double> >& value);
184 
186  };
187 
188  // Transmission data
189  public:
191  private:
193  std::map<std::string, std::vector<double> > privateTransm;
194 
195  public:
196  const double& getAxelRatio() const;
197  void setAxelRatio(const double& value);
198  std::map<std::string, std::vector<double> >& getTransm();
199  void setTransm(const std::map<std::string, std::vector<double> >& value);
200 
202  };
203 
204  //Root object
205  public:
206  class VEH {
207  private:
208  std::string privateType;
209  std::string privateVersion;
216 
217  public:
218  const std::string& getType() const;
219  void setType(const std::string& value);
220  const std::string& getVersion() const;
221  void setVersion(const std::string& value);
228  };
229 
230  };
231 
232  class CEPHandler {
233  public:
234  CEPHandler();
235 
236  private:
237  std::map<std::string, CEP*> _ceps;
238  public:
239  const std::map<std::string, CEP*>& getCEPS() const;
240 
241 
242  bool GetCEP(std::vector<std::string>& DataPath, Helpers* Helper, Correction* DataCor);
243 
244 
245  private:
246  bool CalcCorrection(Correction* DataCor, Helpers* Helper, VEHPHEMLightJSON::Vehicle_Data* vehicle_Data);
247 
248  bool Load(std::vector<std::string>& DataPath, Helpers* Helper, Correction* DataCor, bool fleetMix = false);
249 
250  bool ReadVehicleFile(const std::vector<std::string>& DataPath, const std::string& emissionClass, Helpers* Helper, bool fleetMix, VEHPHEMLightJSON::VEH*& Vehicle);
251 
252  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);
253 
254  bool CorrectEmissionData(Correction* DataCor, std::vector<std::string>& header, std::vector<std::vector<double> >& matrix, std::vector<double>& idlingValues);
255 
256  //Calculate correction factor for detoriation and temperature correction
257  double GetDetTempCor(Correction* DataCor, const std::string& Emi);
258 
259 
260  //Split the string
261  const std::vector<std::string> split(const std::string& s, char delim);
262 
263  //Convert string to double
264  double todouble(const std::string& s);
265 
266  //Convert string to double list
267  std::vector<double> todoubleList(const std::vector<std::string>& s);
268 
269  //Read a line from file
270  std::string ReadLine(std::ifstream& s);
271  };
272 }
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 setType(const std::string &value)
void setVersion(const std::string &value)
const std::string & getVersion() const
C++ TraCI client API implementation.
Definition: Vehicle.h:34