SUMO - Simulation of Urban MObility
MSDevice_DriverState.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-2018 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 /****************************************************************************/
20 /****************************************************************************/
21 #ifndef MSDevice_DriverState_h
22 #define MSDevice_DriverState_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include "MSVehicleDevice.h"
31 #include <utils/common/SUMOTime.h>
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class SUMOVehicle;
39 class MSVehicle;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
56 public:
60  static void insertOptions(OptionsCont& oc);
61 
62 
73  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
74 
75 private:
78  static double getMinAwareness(const SUMOVehicle& v, const OptionsCont& oc);
79  static double getInitialAwareness(const SUMOVehicle& v, const OptionsCont& oc);
80  static double getErrorTimeScaleCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
81  static double getErrorNoiseIntensityCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
82  static double getSpeedDifferenceErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
83  static double getSpeedDifferenceChangePerceptionThreshold(const SUMOVehicle& v, const OptionsCont& oc);
84  static double getHeadwayChangePerceptionThreshold(const SUMOVehicle& v, const OptionsCont& oc);
85  static double getHeadwayErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
87 
88 
89 public:
92 
94  const std::string deviceName() const {
95  return "driverstate";
96  }
97 
99  std::string getParameter(const std::string& key) const;
100 
102  void setParameter(const std::string& key, const std::string& value);
103 
104 
105 private:
111  MSDevice_DriverState(SUMOVehicle& holder, const std::string& id,
112  double minAwareness,
113  double initialAwareness,
114  double errorTimeScaleCoefficient,
115  double errorNoiseIntensityCoefficient,
116  double speedDifferenceErrorCoefficient,
117  double speedDifferenceChangePerceptionThreshold,
118  double headwayChangePerceptionThreshold,
119  double headwayErrorCoefficient);
120 
122  void initDriverState();
123 
126 
127 private:
130 
139 
141  std::shared_ptr<MSSimpleDriverState> myDriverState;
142 
143 private:
146 
149 
150 };
151 
152 
153 #endif
154 
155 /****************************************************************************/
156 
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
long long int SUMOTime
Definition: SUMOTime.h:36
double mySpeedDifferenceChangePerceptionThreshold
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_DriverState-options.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
MSDevice_DriverState & operator=(const MSDevice_DriverState &)
Invalidated assignment operator.
static double getErrorNoiseIntensityCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
static double getInitialAwareness(const SUMOVehicle &v, const OptionsCont &oc)
static double getSpeedDifferenceErrorCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
static double getHeadwayErrorCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
Representation of a vehicle.
Definition: SUMOVehicle.h:60
std::shared_ptr< MSSimpleDriverState > myDriverState
The driver state of the holder.
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key ...
static double getMinAwareness(const SUMOVehicle &v, const OptionsCont &oc)
SUMOTime createDriverState(SUMOTime)
Creates a DriverState for the equipped vehicle.
static double getErrorTimeScaleCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice *> &into)
Build devices for the given vehicle, if needed.
MSVehicle * myHolderMS
The holder vehicle casted to MSVehicle*.
~MSDevice_DriverState()
Destructor.
A storage for options typed value containers)
Definition: OptionsCont.h:92
void initDriverState()
Initializeses the driver state parameters.
Abstract in-vehicle device.
static double getHeadwayChangePerceptionThreshold(const SUMOVehicle &v, const OptionsCont &oc)
The ToC Device controls transition of control between automated and manual driving.
Provides an interface to an error whose fluctuation is controlled via the driver&#39;s &#39;awareness&#39;...
static double getSpeedDifferenceChangePerceptionThreshold(const SUMOVehicle &v, const OptionsCont &oc)
const std::string deviceName() const
return the name for this type of device
MSDevice_DriverState(SUMOVehicle &holder, const std::string &id, double minAwareness, double initialAwareness, double errorTimeScaleCoefficient, double errorNoiseIntensityCoefficient, double speedDifferenceErrorCoefficient, double speedDifferenceChangePerceptionThreshold, double headwayChangePerceptionThreshold, double headwayErrorCoefficient)
Constructor.