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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Generic interface for an engine model
16 /****************************************************************************/
17 
18 #ifndef GENERICENGINEMODEL_H_
19 #define GENERICENGINEMODEL_H_
20 
21 #include <map>
22 #include <string>
23 #include <utils/common/SUMOTime.h>
24 
31 
32 public:
33 
34  typedef std::map<std::string, std::string> ParMap;
35 
36 protected:
37 
38  //class name, used to log information
39  std::string className;
40  //minimum and maximum acceleration of the model, if any
42 
46  void printParameterError(std::string parameter, std::string value);
47 
51  void parseParameter(const ParMap& parameters, std::string parameter, double& value);
52  void parseParameter(const ParMap& parameters, std::string parameter, int& value);
53  void parseParameter(const ParMap& parameters, std::string parameter, std::string& value);
54 
55 public:
56 
57  GenericEngineModel() : maxAcceleration_mpsps(1.5), maxDeceleration_mpsps(7) {};
58  virtual ~GenericEngineModel() {};
59 
72  virtual double getRealAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime timeStep = 0) = 0;
73 
81  virtual void loadParameters(const ParMap& parameters) = 0;
82 
89  virtual void setParameter(const std::string parameter, const std::string& value) = 0;
90  virtual void setParameter(const std::string parameter, double value) = 0;
91  virtual void setParameter(const std::string parameter, int value) = 0;
92 
98  void setMaximumAcceleration(double maxAcceleration_mpsps);
105  void setMaximumDeceleration(double maxAcceleration_mpsps);
111  double setMaximumAcceleration();
118  double setMaximumDeceleration();
119 
120 };
121 
122 #endif /* GENERICENGINEMODEL_H_ */
void parseParameter(const ParMap &parameters, std::string parameter, double &value)
long long int SUMOTime
Definition: SUMOTime.h:35
virtual void setParameter(const std::string parameter, const std::string &value)=0
void printParameterError(std::string parameter, std::string value)
virtual void loadParameters(const ParMap &parameters)=0
virtual double getRealAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime timeStep=0)=0
std::map< std::string, std::string > ParMap