Eclipse SUMO - Simulation of Urban MObility
GenericEngineModel.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 // Generic interface for an engine model
19 /****************************************************************************/
20 
21 #pragma once
22 #include <config.h>
23 
24 #include <map>
25 #include <string>
26 #include <utils/common/SUMOTime.h>
28 
35 
36 public:
39 
41  virtual ~GenericEngineModel() {};
42 
55  virtual double getRealAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime timeStep = 0) = 0;
56 
63  virtual void setParameter(const std::string parameter, const std::string& value) = 0;
64  virtual void setParameter(const std::string parameter, double value) = 0;
65  virtual void setParameter(const std::string parameter, int value) = 0;
66 
72  void setMaximumAcceleration(double maxAcc);
79  void setMaximumDeceleration(double maxDec);
80 
81 protected:
82  //class name, used to log information
83  std::string className;
84 
85  //minimum and maximum acceleration of the model, if any
87 
91  void printParameterError(std::string parameter, std::string value);
92 
96  void parseParameter(const Parameterised::Map& parameters, std::string parameter, double& value);
97  void parseParameter(const Parameterised::Map& parameters, std::string parameter, int& value);
98  void parseParameter(const Parameterised::Map& parameters, std::string parameter, std::string& value);
99 };
long long int SUMOTime
Definition: GUI.h:35
virtual ~GenericEngineModel()
destructor
GenericEngineModel()
constructor
virtual void setParameter(const std::string parameter, int value)=0
void setMaximumAcceleration(double maxAcc)
virtual double getRealAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime timeStep=0)=0
void parseParameter(const Parameterised::Map &parameters, std::string parameter, double &value)
void setMaximumDeceleration(double maxDec)
void printParameterError(std::string parameter, std::string value)
virtual void setParameter(const std::string parameter, double value)=0
virtual void setParameter(const std::string parameter, const std::string &value)=0
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45