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.org/sumo
3 // Copyright (C) 2013-2022 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 
59  SUMOEmissionClass getClassByName(const std::string& eClass, const SUMOVehicleClass vc);
60 
69  SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string& vClass, const std::string& fuel, const std::string& eClass, const double weight) const;
70 
75  std::string getAmitranVehicleClass(const SUMOEmissionClass c) const;
76 
81  std::string getFuel(const SUMOEmissionClass c) const;
82 
87  int getEuroClass(const SUMOEmissionClass c) const;
88 
94  double getWeight(const SUMOEmissionClass c) const;
95 
103  double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams* param) const;
104 
112  double getModifiedAccel(const SUMOEmissionClass c, const double v, const double a, const double slope) const;
113 
114 private:
122  double getEmission(const PHEMCEP* oldCep, PHEMlightdll::CEP* currCep, const std::string& e, const double p, const double v) const;
123 
125  int myIndex;
128  std::map<SUMOEmissionClass, PHEMlightdll::CEP*> myCEPs;
129 };
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
int SUMOEmissionClass
An upper class for objects with additional parameters.
Definition: EnergyParams.h:41
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
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.
double getModifiedAccel(const SUMOEmissionClass c, const double v, const double a, const double slope) const
Returns the adapted acceleration value, useful for comparing with external PHEMlight references.
int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
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:50
zero emission model, used as superclass for the other model helpers
EmissionType
Enumerating all emission types, including fuel.