Eclipse SUMO - Simulation of Urban MObility
HelpersPHEMlight.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2013-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // Helper methods for PHEMlight-based emission computation
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #define INTERNAL_PHEM
25 
26 #include <vector>
27 #include <limits>
28 #include <cmath>
29 #ifdef INTERNAL_PHEM
30 #include "PHEMCEPHandler.h"
31 #endif
35 #include <utils/common/StdDefs.h>
36 #include "PollutantsInterface.h"
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
47 private:
48  static const int PHEMLIGHT_BASE = 3 << 16;
49 
50 public:
54 
57  virtual ~HelpersPHEMlight();
58 
59 protected:
63  HelpersPHEMlight(std::string name, const int baseIndex, const int defaultClass)
64  : PollutantsInterface::Helper(name, baseIndex, defaultClass) {}
65 
66 public:
71  virtual SUMOEmissionClass getClassByName(const std::string& eClass, const SUMOVehicleClass vc);
72 
81  SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string& vClass, const std::string& fuel, const std::string& eClass, const double weight) const;
82 
87  std::string getAmitranVehicleClass(const SUMOEmissionClass c) const;
88 
93  std::string getFuel(const SUMOEmissionClass c) const;
94 
99  int getEuroClass(const SUMOEmissionClass c) const;
100 
106  double getWeight(const SUMOEmissionClass c) const;
107 
115  virtual double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams* param) const;
116 
124  virtual double getModifiedAccel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams* param) const;
125 
134  virtual double getCoastingDecel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams* param) const;
135 
136 private:
144  double getEmission(const PHEMCEP* oldCep, PHEMlightdll::CEP* currCep, const std::string& e, const double p, const double v) const;
145 
147  int myIndex;
150  std::map<SUMOEmissionClass, PHEMlightdll::CEP*> myCEPs;
151 };
int SUMOEmissionClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
An upper class for objects with additional parameters.
Definition: EnergyParams.h:43
Helper methods for PHEMlight-based emission computation.
double getEmission(const PHEMCEP *oldCep, PHEMlightdll::CEP *currCep, const std::string &e, const double p, const double v) const
Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel...
std::map< SUMOEmissionClass, PHEMlightdll::CEP * > myCEPs
SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string &vClass, const std::string &fuel, const std::string &eClass, const double weight) const
Returns the emission class described by the given parameters.
std::string getFuel(const SUMOEmissionClass c) const
Returns the fuel type described by this emission class as described in the Amitran interface (Gasolin...
PHEMlightdll::Helpers myHelper
virtual double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams *param) const
Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel...
HelpersPHEMlight()
Constructor.
virtual double getModifiedAccel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param) const
Returns the adapted acceleration value, useful for comparing with external PHEMlight references.
virtual double getCoastingDecel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param) const
Returns the maximum deceleration value (as a negative number), which can still be considered as non-b...
HelpersPHEMlight(std::string name, const int baseIndex, const int defaultClass)
Constructor for subclasses.
int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
virtual ~HelpersPHEMlight()
Destructor.
virtual SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc)
Checks whether the string describes a known vehicle class.
double getWeight(const SUMOEmissionClass c) const
Returns a reference weight in kg described by this emission class as described in the Amitran interfa...
PHEMlightdll::CEPHandler myCEPHandler
int myIndex
the index of the next class
std::string getAmitranVehicleClass(const SUMOEmissionClass c) const
Returns the vehicle class described by this emission class as described in the Amitran interface (Pas...
static const int PHEMLIGHT_BASE
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:49
zero emission model, used as superclass for the other model helpers
Helper(std::string name, const int baseIndex, const int defaultClass)
Constructor, intializes the name.
Helper methods for PHEMlight-based emission computation.
EmissionType
Enumerating all emission types, including fuel.