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.org/sumo
3 // Copyright (C) 2001-2020 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 
22 #include <iostream>
23 #include <iomanip>
24 
25 //gravity force
26 #define GRAVITY_MPS2 9.81
27 //horsepower to watts conversion factor
28 #define HP_TO_W 745.699872
29 //maximum engine time constant
30 #define TAU_MAX 0.5
31 //maximum degree for the engine polynomial
32 #define MAX_POLY_DEGREE 9
33 
35 
36 public:
37 
45  int degree;
46  double x[MAX_POLY_DEGREE];
47  };
48 
57  double rpm;
58  double deltaRpm;
59  };
60 
61  //id of the type of vehicle
62  std::string id;
63  //number of gears
64  int nGears;
65  //gear ratios
66  double* gearRatios;
67  //differential ratio
69  //wheel diameter in meters
71  //mass of vehicle
72  double mass_kg;
73  //air friction parameters
74  double cAir, a_m2, rho_kgpm3;
75  //precomputed air friction coefficient
77  //tires parameters
78  double cr1, cr2;
79  //precomputed rolling resistance parameters
80  double __cr1, __cr2;
81  //road slope in degrees
82  double slope;
83  //precomputed gravitational force
84  double __gravity;
85  //tires friction coefficient
87  //precomputed maximum acceleration with no slip
89  //engine mapping
91  //gear shifting rule
93  //engine efficiency
95  //factor taking into account inertia of rotating masses, such as flywheel
96  double massFactor;
97  //number of cylinders of the engine
98  int cylinders;
99  //simulation timestep
100  double dt;
101  //min and max rpm
102  double minRpm, maxRpm;
103  //brakes actuation time constant in second
104  double brakesTau_s;
105  //engine time constants for exhaust and burning
107  //whether tauBurn_s is fixed or dynamic
109  //other precomputed coefficients
114  double __engineTau1;
115  double __engineTau2;
119  //todo: finish
120  double minSpeed;
121 
125  void computeCoefficients();
126 
130  void dumpParameters(std::ostream& out);
131 
133  EngineParameters(const EngineParameters& other);
135  virtual ~EngineParameters();
136 
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