Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
HelpersHBEFA.h
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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 HBEFA-based emission computation
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <vector>
25
#include <limits>
26
#include <cmath>
27
#include <
utils/common/StdDefs.h
>
28
#include <
utils/geom/GeomHelper.h
>
29
#include <
utils/common/SUMOVehicleClass.h
>
30
#include "
EnergyParams.h
"
31
#include "
PollutantsInterface.h
"
32
33
34
// ===========================================================================
35
// class definitions
36
// ===========================================================================
45
class
HelpersHBEFA
:
public
PollutantsInterface::Helper {
46
private
:
47
static
const
int
HBEFA_BASE
= 1 << 16;
48
49
public
:
52
HelpersHBEFA
();
53
54
68
inline
double
compute
(
const
SUMOEmissionClass
c,
const
PollutantsInterface::EmissionType e,
const
double
v,
const
double
a,
const
double
slope,
const
EnergyParams
* param)
const
{
69
if
(e == PollutantsInterface::ELEC || (param !=
nullptr
&& param->
isEngineOff
())) {
70
return
0.;
71
}
72
if
(v >
ZERO_SPEED_ACCURACY
&& a < getCoastingDecel(c, v, a, slope, param)) {
73
return
0.;
74
}
75
const
int
index = (c &
~PollutantsInterface
::HEAVY_BIT) -
HBEFA_BASE
;
76
const
double
kmh = v * 3.6;
77
const
double
scale = (e == PollutantsInterface::FUEL && myVolumetricFuel) ? 3.6 * 790. : 3.6;
78
if
(index >= 42) {
79
const
double
* f =
myFunctionParameter
[index - 42] + 6 * e;
80
return
MAX2
((f[0] + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.);
81
}
82
const
double
* f =
myFunctionParameter
[index] + 6 * e;
83
const
double
alpha =
RAD2DEG
(asin(a /
GRAVITY
));
84
return
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
};
EnergyParams.h
GeomHelper.h
GRAVITY
#define GRAVITY
Definition
GeomHelper.h:37
RAD2DEG
#define RAD2DEG(x)
Definition
GeomHelper.h:36
ZERO_SPEED_ACCURACY
const double ZERO_SPEED_ACCURACY
Definition
PHEMConstants.h:34
PollutantsInterface.h
SUMOVehicleClass.h
SUMOEmissionClass
int SUMOEmissionClass
Definition
SUMOVehicleClass.h:251
StdDefs.h
MAX2
T MAX2(T a, T b)
Definition
StdDefs.h:86
EnergyParams
An upper class for objects with additional parameters.
Definition
EnergyParams.h:45
EnergyParams::isEngineOff
bool isEngineOff() const
Returns the state of the engine when the vehicle is not moving.
Definition
EnergyParams.cpp:198
HelpersHBEFA::HBEFA_BASE
static const int HBEFA_BASE
Definition
HelpersHBEFA.h:47
HelpersHBEFA::compute
double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams *param) const
Computes the emitted pollutant amount using the given speed and acceleration.
Definition
HelpersHBEFA.h:68
HelpersHBEFA::myFunctionParameter
static double myFunctionParameter[42][36]
The function parameter.
Definition
HelpersHBEFA.h:32
HelpersHBEFA::HelpersHBEFA
HelpersHBEFA()
Constructor (initializes myEmissionClassStrings).
Definition
HelpersHBEFA.cpp:134
PollutantsInterface
Helper methods for PHEMlight-based emission computation.
src
utils
emissions
HelpersHBEFA.h
Generated on
for Eclipse SUMO - Simulation of Urban MObility by
1.15.0