Eclipse SUMO - Simulation of Urban MObility
HelpersHBEFA.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Helper methods for HBEFA-based emission computation
16 /****************************************************************************/
17 #ifndef HelpersHBEFA_h
18 #define HelpersHBEFA_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <limits>
28 #include <cmath>
29 #include <utils/common/StdDefs.h>
30 #include <utils/geom/GeomHelper.h>
32 #include "PollutantsInterface.h"
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
47 public:
50  HelpersHBEFA();
51 
52 
66  inline double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map<int, double>* param) const {
67  UNUSED_PARAMETER(slope);
68  UNUSED_PARAMETER(param);
70  return 0.;
71  }
72  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - 1;
73  const double kmh = v * 3.6;
74  const double scale = (e == PollutantsInterface::FUEL) ? 3.6 * 790. : 3.6;
75  if (index >= 42) {
76  const double* f = myFunctionParameter[index - 42] + 6 * e;
77  return (double) MAX2((f[0] + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.);
78  }
79  if (a < 0.) {
80  return 0.;
81  }
82  const double* f = myFunctionParameter[index] + 6 * e;
83  const double alpha = asin(a / 9.81) * 180. / M_PI;
84  return (double) MAX2((f[0] + f[1] * alpha * kmh + f[2] * alpha * alpha * kmh + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.);
85  }
86 
87 
88 private:
90  static double myFunctionParameter[42][36];
91 
92 };
93 
94 
95 #endif
96 
97 /****************************************************************************/
98 
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:31
HelpersHBEFA::myFunctionParameter
static double myFunctionParameter[42][36]
The function parameter.
Definition: HelpersHBEFA.h:90
PollutantsInterface::EmissionType
EmissionType
Enumerating all emission types, including fuel.
Definition: PollutantsInterface.h:55
PollutantsInterface::FUEL
@ FUEL
Definition: PollutantsInterface.h:55
PollutantsInterface::Helper
abstract superclass for the model helpers
Definition: PollutantsInterface.h:102
SUMOEmissionClass
int SUMOEmissionClass
Definition: SUMOVehicleClass.h:231
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
PollutantsInterface.h
SUMOVehicleClass.h
HelpersHBEFA::HelpersHBEFA
HelpersHBEFA()
Constructor (initializes myEmissionClassStrings)
Definition: HelpersHBEFA.cpp:135
HelpersHBEFA::compute
double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map< int, double > *param) const
Computes the emitted pollutant amount using the given speed and acceleration.
Definition: HelpersHBEFA.h:66
PollutantsInterface::ELEC
@ ELEC
Definition: PollutantsInterface.h:55
PollutantsInterface::ZERO_EMISSIONS
static const int ZERO_EMISSIONS
the first class in each model representing a zero emission vehicle
Definition: PollutantsInterface.h:261
HelpersHBEFA
Helper methods for HBEFA-based emission computation.
Definition: HelpersHBEFA.h:46
M_PI
#define M_PI
Definition: odrSpiral.cpp:40
config.h
PollutantsInterface
Helper methods for PHEMlight-based emission computation.
Definition: PollutantsInterface.h:51
GeomHelper.h
StdDefs.h