Eclipse SUMO - Simulation of Urban MObility
EngineParameters.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-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 /****************************************************************************/
18 /****************************************************************************/
19 
20 #pragma once
21 #include <config.h>
22 
23 #include <iostream>
24 #include <iomanip>
25 
26 //gravity force
27 #define GRAVITY_MPS2 9.81
28 //horsepower to watts conversion factor
29 #define HP_TO_W 745.699872
30 //maximum engine time constant
31 #define TAU_MAX 0.5
32 //maximum degree for the engine polynomial
33 #define MAX_POLY_DEGREE 9
34 
36 
37 public:
38 
46  int degree;
47  double x[MAX_POLY_DEGREE];
48  };
49 
58  double rpm;
59  double deltaRpm;
60  };
61 
62  //id of the type of vehicle
63  std::string id;
64  //number of gears
65  int nGears;
66  //gear ratios
67  double* gearRatios;
68  //differential ratio
70  //wheel diameter in meters
72  //mass of vehicle
73  double mass_kg;
74  //air friction parameters
75  double cAir, a_m2, rho_kgpm3;
76  //precomputed air friction coefficient
78  //tires parameters
79  double cr1, cr2;
80  //precomputed rolling resistance parameters
81  double __cr1, __cr2;
82  //road slope in degrees
83  double slope;
84  //precomputed gravitational force
85  double __gravity;
86  //tires friction coefficient
88  //precomputed maximum acceleration with no slip
90  //engine mapping
92  //gear shifting rule
94  //engine efficiency
96  //factor taking into account inertia of rotating masses, such as flywheel
97  double massFactor;
98  //number of cylinders of the engine
99  int cylinders;
100  //simulation timestep
101  double dt;
102  //min and max rpm
103  double minRpm, maxRpm;
104  //brakes actuation time constant in second
105  double brakesTau_s;
106  //engine time constants for exhaust and burning
108  //whether tauBurn_s is fixed or dynamic
110  //other precomputed coefficients
115  double __engineTau1;
116  double __engineTau2;
120  //todo: finish
121  double minSpeed;
122 
126  void computeCoefficients();
127 
131  void dumpParameters(std::ostream& out);
132 
134  EngineParameters(const EngineParameters& other);
136  virtual ~EngineParameters();
137 
138 };
#define MAX_POLY_DEGREE
double __airFrictionCoefficient
struct PolynomialEngineModelRpmToHp engineMapping
void dumpParameters(std::ostream &out)
EngineParameters & operator=(const EngineParameters &other)
double __speedToRpmCoefficient
double tiresFrictionCoefficient
double __speedToThrustCoefficient
struct GearShiftingRules shiftingRule
double __maxNoSlipAcceleration
double __rpmToSpeedCoefficient
double __maxAccelerationCoefficient