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.org/sumo
3 // Copyright (C) 2001-2022 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>
27 
34 
35 public:
36 
37  typedef std::map<std::string, std::string> ParMap;
38 
39 protected:
40 
41  //class name, used to log information
42  std::string className;
43  //minimum and maximum acceleration of the model, if any
45 
49  void printParameterError(std::string parameter, std::string value);
50 
54  void parseParameter(const ParMap& parameters, std::string parameter, double& value);
55  void parseParameter(const ParMap& parameters, std::string parameter, int& value);
56  void parseParameter(const ParMap& parameters, std::string parameter, std::string& value);
57 
58 public:
59 
61  virtual ~GenericEngineModel() {};
62 
75  virtual double getRealAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime timeStep = 0) = 0;
76 
83  virtual void setParameter(const std::string parameter, const std::string& value) = 0;
84  virtual void setParameter(const std::string parameter, double value) = 0;
85  virtual void setParameter(const std::string parameter, int value) = 0;
86 
92  void setMaximumAcceleration(double maxAcc);
99  void setMaximumDeceleration(double maxDec);
100 
101 };
long long int SUMOTime
Definition: SUMOTime.h:32
std::map< std::string, std::string > ParMap
void parseParameter(const ParMap &parameters, std::string parameter, double &value)
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 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