SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHEMCEP.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef PHEMCEP_h
21 #define PHEMCEP_h
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <vector>
35 #include "PHEMCEP.h"
36 #include "PHEMConstants.h"
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
46 class PHEMCEP {
47 public:
48  /*** @brief Constructor
49  * @param[in] emissionClass PHEM emission class of vehicle
50  * @param[in] vehicleMass vehicle mass
51  * @param[in] vehicleLoading vehicle loading
52  * @param[in] vehicleMassRot rotational mass of vehicle
53  * @param[in] crossArea crosssectional area of vehicle
54  * @param[in] cWValue cw-value
55  * @param[in] f0 Rolling resistance f0
56  * @param[in] f1 Rolling resistance f1
57  * @param[in] f2 Rolling resistance f2
58  * @param[in] f3 Rolling resistance f3
59  * @param[in] f4 Rolling resistance f4
60  * @param[in] ratedPower rated power of vehicle
61  * @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed
62  * @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed
63  * @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed
64  * @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed
65  * @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel
66  * @param[in] matrixFC Coefficients of the fuel consumption
67  * @param[in] headerLine Definition of covered pollutants
68  * @param[in] headerLinePollutants Coefficients of the pollutants
69  * @param[in] matrixPollutants Coefficients of the pollutants
70  * @param[in] matrixSpeedRotational Table for rotational coefficients over speed
71  */
72  PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass,
73  double vehicleMass, double vehicleLoading, double vehicleMassRot,
74  double crossArea, double cWValue,
75  double f0, double f1, double f2, double f3, double f4,
76  double ratedPower, double pNormV0, double pNormP0, double pNormV1,
77  double pNormP1, std:: string vehicelFuelType,
78  const std::vector< std::vector<double> >& matrixFC,
79  const std::vector<std::string>& headerLinePollutants,
80  const std::vector< std::vector<double> >& matrixPollutants,
81  const std::vector< std::vector<double> > matrixSpeedRotational
82  );
83 
84 
86  ~PHEMCEP();
87 
96  double CalcPower(double v, double a, double slope) const;
97 
98 
107  double GetMaxAccel(double v, double a, double gradient) const;
108 
114  double GetEmission(const std::string& pollutantIdentifier, double power) const;
115 
116 
121  return _emissionClass;
122  }
123 
124 
128  double GetResistanceF0() const {
129  return _resistanceF0;
130  }
131 
132 
136  double GetResistanceF1() const {
137  return _resistanceF1;
138  }
139 
140 
144  double GetResistanceF2() const {
145  return _resistanceF2;
146  }
147 
148 
152  double GetResistanceF3() const {
153  return _resistanceF3;
154  }
155 
156 
160  double GetResistanceF4() const {
161  return _resistanceF4;
162  }
163 
164 
169  double GetCdValue() const {
170  return _cwValue;
171  }
172 
176  double GetCrossSectionalArea() const {
177  return _crossSectionalArea;
178  }
179 
180 
184  double GetMassVehicle() const {
185  return _massVehicle;
186  }
187 
191  double GetVehicleLoading() const {
192  return _vehicleLoading;
193  }
194 
195 
199  double GetMassRot() const {
200  return _massRot;
201  }
202 
203 
207  double GetRatedPower() const {
208  return _ratedPower;
209  }
210 
214  std::string GetVehicleFuelType() const {
215  return _vehicleFuelType;
216  }
217 
218 private:
227  double Interpolate(double px, double p1, double p2, double e1, double e2) const;
228 
235  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, std::vector<double> pattern, double value) const;
236 
240  double GetRotationalCoeffecient(double speed) const;
241 
245  double GetPMaxNorm(double speed) const;
246 
247 private:
261  double _cwValue;
265  double _massVehicle;
269  double _massRot;
271  double _ratedPower;
273  double _pNormV0;
275  double _pNormP0;
277  double _pNormV1;
279  double _pNormP1;
285  std::vector<double> _powerPatternFC;
287  std::vector<double> _powerPatternPollutants;
289  std::vector<double> _cepCurveFC;
293  std::vector<double> _speedPatternRotational;
295  std::vector<double> _speedCurveRotational;
297  std::string _vehicleFuelType;
298 
299 };
300 
301 #endif
302 
303 /****************************************************************************/
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:207
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:46
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:191
std::vector< double > _powerPatternFC
Definition: PHEMCEP.h:285
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:169
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:152
double GetEmission(const std::string &pollutantIdentifier, double power) const
Returns a emission measure for power[kW] level.
Definition: PHEMCEP.cpp:178
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:120
std::vector< double > _speedCurveRotational
Definition: PHEMCEP.h:295
double _massVehicle
vehicle mass
Definition: PHEMCEP.h:265
double _resistanceF1
Rolling resistance f1.
Definition: PHEMCEP.h:253
std::string _vehicleFuelType
Definition: PHEMCEP.h:297
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:184
std::string GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:214
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:176
double _pNormP0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:275
~PHEMCEP()
Destructor.
Definition: PHEMCEP.cpp:148
double _pNormV1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:277
double _resistanceF3
Rolling resistance f3.
Definition: PHEMCEP.h:257
double _massRot
rotational mass of vehicle
Definition: PHEMCEP.h:269
double GetMaxAccel(double v, double a, double gradient) const
Returns the maximum accelaration for a vehicle at state v,a, slope and loading.
Definition: PHEMCEP.cpp:170
int _sizeOfPatternFC
Definition: PHEMCEP.h:281
double _pNormV0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:273
SUMOEmissionClass
Definition of vehicle emission classes.
double _crossSectionalArea
crosssectional area of vehicle
Definition: PHEMCEP.h:263
double _vehicleLoading
vehicle loading
Definition: PHEMCEP.h:267
double _pNormP1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:279
std::vector< double > _speedPatternRotational
Definition: PHEMCEP.h:293
PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, double vehicleMass, double vehicleLoading, double vehicleMassRot, double crossArea, double cWValue, double f0, double f1, double f2, double f3, double f4, double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1, std::string vehicelFuelType, const std::vector< std::vector< double > > &matrixFC, const std::vector< std::string > &headerLinePollutants, const std::vector< std::vector< double > > &matrixPollutants, const std::vector< std::vector< double > > matrixSpeedRotational)
Definition: PHEMCEP.cpp:45
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition: PHEMCEP.cpp:242
double _resistanceF4
Rolling resistance f4.
Definition: PHEMCEP.h:259
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:136
double _resistanceF0
Rolling resistance f0.
Definition: PHEMCEP.h:251
std::vector< double > _cepCurveFC
Definition: PHEMCEP.h:289
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition: PHEMCEP.cpp:297
int _sizeOfPatternPollutants
Definition: PHEMCEP.h:283
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:128
std::vector< double > _powerPatternPollutants
Definition: PHEMCEP.h:287
double Interpolate(double px, double p1, double p2, double e1, double e2) const
Interpolates emission linearly between two known power-emission pairs.
Definition: PHEMCEP.cpp:233
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:144
double _ratedPower
rated power of vehicle
Definition: PHEMCEP.h:271
double _cwValue
Cw value.
Definition: PHEMCEP.h:261
double CalcPower(double v, double a, double slope) const
Returns the power of used for a vehicle at state v,a, slope and loading.
Definition: PHEMCEP.cpp:159
StringBijection< std::vector< double > > _cepCurvePollutants
Definition: PHEMCEP.h:291
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > pattern, double value) const
Finds bounding upper and lower index in pattern for value.
Definition: PHEMCEP.cpp:256
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:199
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition: PHEMCEP.h:249
double _resistanceF2
Rolling resistance f2.
Definition: PHEMCEP.h:255
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:160