Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSCFModel_W99.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-2026 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// The psycho-physical model of Wiedemann (10-Parameter version from 1999)
19// code adapted from https://github.com/glgh/w99-demo
20// (MIT License, Copyright (c) 2016 glgh)
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include "MSCFModel.h"
26#include <microsim/MSLane.h>
27#include <microsim/MSVehicle.h>
30
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
39// XXX: which W99 is this? There are several versions... Below it is stated that it is modified it with Krauss vsafe... (Leo)
40class MSCFModel_W99 : public MSCFModel {
41public:
42
46 MSCFModel_W99(const MSVehicleType* vtype);
47
48
51
52
55
56
65 double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed,
66 double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
67
68
76 double stopSpeed(const MSVehicle* const veh, const double speed, double gap, double decel, const CalcReason usage = CalcReason::CURRENT) const;
77
78
88 double interactionGap(const MSVehicle* const, double vL) const;
89
94 int getModelID() const {
95 return SUMO_TAG_CF_W99;
96 }
97
98
103 MSCFModel* duplicate(const MSVehicleType* vtype) const;
104
105 std::string getParameter(const MSVehicle* veh, const std::string& key) const;
106
107 void setParameter(MSVehicle* veh, const std::string& key, const std::string& value) const;
108
110
111 /*
112 enum Status {
113 DECEL1,
114 DECEL2,
115 FOLLOW,
116 FREE_FLOW,
117 }
118
119 private:
120 class VehicleVariables : public MSCFModel::VehicleVariables {
121 public:
122 VehicleVariables() : lastStatus(FREE_FLOW) {}
124 Status lastStatus;
125 };
126 */
127
128
129private:
132
133 //const double myCC0; // StandStill Distance - (using minGap)
134 double myCC1; // Spacing Time - s
135 double myCC2; // Following Variation ("max drift") - m
136 double myCC3; // Threshold for Entering 'Following' - s
137 double myCC4; // Negative 'Following' Threshold - m/s
138 double myCC5; // Positive 'Following' Threshold - m/s
139 double myCC6; // Speed Dependency of Oscillation - 10^-4 rad/s
140 double myCC7; // Oscillation Acceleration - m/s^2
141 double myCC8; // Standstill Acceleration - m/s^2
142 double myCC9; // Acceleration at 80km/h - m/s^2
144
145
146 void computeThresholds(double speed, double predSpeed, double leaderAccel, double rndVal,
147 double& sdxc, double& sdxo, double& sdxv) const;
148
149private:
152};
@ SUMO_TAG_CF_W99
The W99 Model car-following model.
std::string getParameter(const MSVehicle *veh, const std::string &key) const
try to get the given parameter for this carFollowingModel
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
void setParameter(MSVehicle *veh, const std::string &key, const std::string &value) const
try to set the given parameter for this carFollowingModel
double stopSpeed(const MSVehicle *const veh, const double speed, double gap, double decel, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
void computeThresholds(double speed, double predSpeed, double leaderAccel, double rndVal, double &sdxc, double &sdxo, double &sdxv) const
~MSCFModel_W99()
Destructor.
int getModelID() const
Returns the model's name.
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed (no dawdling)
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
MSCFModel_W99 & operator=(const MSCFModel_W99 &s)
Invalidated assignment operator.
The car-following model abstraction.
Definition MSCFModel.h:59
CalcReason
What the return value of stop/follow/free-Speed is used for.
Definition MSCFModel.h:95
@ CURRENT
the return value is used for calculating the next speed
Definition MSCFModel.h:97
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
The car-following model and parameter.