Eclipse SUMO - Simulation of Urban MObility
MSCFModel_W99.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 /****************************************************************************/
14 // The psycho-physical model of Wiedemann (10-Parameter version from 1999)
15 // code adapted from https://github.com/glgh/w99-demo
16 // (MIT License, Copyright (c) 2016 glgh)
17 /****************************************************************************/
18 #ifndef MSCFModel_W99_H
19 #define MSCFModel_W99_H
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "MSCFModel.h"
27 #include <microsim/MSLane.h>
28 #include <microsim/MSVehicle.h>
29 #include <microsim/MSVehicleType.h>
31 
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
40 // XXX: which W99 is this? There are several versions... Below it is stated that it is modified it with Krauss vsafe... (Leo)
41 class MSCFModel_W99 : public MSCFModel {
42 public:
43 
47  MSCFModel_W99(const MSVehicleType* vtype);
48 
49 
52 
53 
56 
57 
66  double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
67 
68 
76  double stopSpeed(const MSVehicle* const veh, const double speed, double gap) const;
77 
78 
88  double interactionGap(const MSVehicle* const, double vL) const;
89 
97  double getSecureGap(const MSVehicle* const veh, const MSVehicle* const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
98 
103  int getModelID() const {
104  return SUMO_TAG_CF_W99;
105  }
106 
107 
112  MSCFModel* duplicate(const MSVehicleType* vtype) const;
113 
114 
116 
117  /*
118  enum Status {
119  DECEL1,
120  DECEL2,
121  FOLLOW,
122  FREE_FLOW,
123  }
124 
125  private:
126  class VehicleVariables : public MSCFModel::VehicleVariables {
127  public:
128  VehicleVariables() : lastStatus(FREE_FLOW) {}
130  Status lastStatus;
131  };
132  */
133 
134 
135 private:
138 
139  //const double myCC0; // StandStill Distance - (using minGap)
140  const double myCC1; // Spacing Time - s
141  const double myCC2; // Following Variation ("max drift") - m
142  const double myCC3; // Threshold for Entering 'Following' - s
143  const double myCC4; // Negative 'Following' Threshold - m/s
144  const double myCC5; // Positive 'Following' Threshold - m/s
145  const double myCC6; // Speed Dependency of Oscillation - 10^-4 rad/s
146  const double myCC7; // Oscillation Acceleration - m/s^2
147  const double myCC8; // Standstill Acceleration - m/s^2
148  const double myCC9; // Acceleration at 80km/h - m/s^2
150 
151 
152  void computeThresholds(double speed, double predSpeed, double leaderAccel, double rndVal,
153  double& sdxc, double& sdxo, double& sdxv) const;
154 
155 private:
158 };
159 
160 #endif /* MSCFModel_W99_H */
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
MSCFModel_W99::computeThresholds
void computeThresholds(double speed, double predSpeed, double leaderAccel, double rndVal, double &sdxc, double &sdxo, double &sdxv) const
Definition: MSCFModel_W99.cpp:75
MSCFModel_W99
The W99 Model car-following model.
Definition: MSCFModel_W99.h:41
MSCFModel_W99::myCC7
const double myCC7
Definition: MSCFModel_W99.h:146
MSCFModel_W99::myCC9
const double myCC9
Definition: MSCFModel_W99.h:148
MSVehicle.h
MSVehicleType.h
MSCFModel_W99::myCC2
const double myCC2
Definition: MSCFModel_W99.h:141
MSCFModel_W99::myCC3
const double myCC3
Definition: MSCFModel_W99.h:142
MSCFModel_W99::getSecureGap
double getSecureGap(const MSVehicle *const veh, const MSVehicle *const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
Definition: MSCFModel_W99.cpp:209
MSCFModel_W99::myCC1
const double myCC1
Definition: MSCFModel_W99.h:140
MSCFModel_W99::duplicate
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
Definition: MSCFModel_W99.cpp:203
MSCFModel_W99::MSCFModel_W99
MSCFModel_W99(const MSVehicleType *vtype)
Constructor.
Definition: MSCFModel_W99.cpp:52
SUMO_TAG_CF_W99
Definition: SUMOXMLDefinitions.h:286
MSCFModel_W99::myCC6
const double myCC6
Definition: MSCFModel_W99.h:145
MSCFModel_W99::getModelID
int getModelID() const
Returns the model's name.
Definition: MSCFModel_W99.h:103
MSCFModel_W99::interactionGap
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
Definition: MSCFModel_W99.cpp:196
MSCFModel.h
MSCFModel
The car-following model abstraction.
Definition: MSCFModel.h:56
config.h
MSCFModel_W99::followSpeed
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's safe speed (no dawdling)
Definition: MSCFModel_W99.cpp:90
MSLane.h
MSCFModel_W99::myCC5
const double myCC5
Definition: MSCFModel_W99.h:144
MSCFModel_W99::myCC8
const double myCC8
Definition: MSCFModel_W99.h:147
MSCFModel_W99::stopSpeed
double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
Definition: MSCFModel_W99.cpp:188
MSCFModel_W99::myCC4
const double myCC4
Definition: MSCFModel_W99.h:143
MSCFModel_W99::~MSCFModel_W99
~MSCFModel_W99()
Destructor.
Definition: MSCFModel_W99.cpp:71
SUMOXMLDefinitions.h
MSCFModel_W99::operator=
MSCFModel_W99 & operator=(const MSCFModel_W99 &s)
Invalidated assignment operator.
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79