Eclipse SUMO - Simulation of Urban MObility
MSCFModel_CACC.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-2020 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 // CACC car-following model based on [1], [2].
19 // [1] Milanes, V., and S. E. Shladover. Handling Cut-In Vehicles in Strings
20 // of Cooperative Adaptive Cruise Control Vehicles. Journal of Intelligent
21 // Transportation Systems, Vol. 20, No. 2, 2015, pp. 178-191.
22 // [2] Xiao, L., M. Wang and B. van Arem. Realistic Car-Following Models for
23 // Microscopic Simulation of Adaptive and Cooperative Adaptive Cruise
24 // Control Vehicles. Transportation Research Record: Journal of the
25 // Transportation Research Board, No. 2623, 2017. (DOI: 10.3141/2623-01).
26 /****************************************************************************/
27 #pragma once
28 #include <config.h>
29 
30 #include "MSCFModel.h"
31 #include "MSCFModel_ACC.h"
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class MSVehicle;
38 class MSVehicleType;
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
47 class MSCFModel_CACC : public MSCFModel {
48 public:
53  MSCFModel_CACC(const MSVehicleType* vtype);
54 
57 
58 
61 
76  double freeSpeed(const MSVehicle* const veh, double speed, double seen, double maxSpeed, const bool onInsertion = false) const;
77 
86  double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
87 
88 
96  double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const;
97 
98 
106  double getSecureGap(const MSVehicle* const veh, const MSVehicle* const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
107 
115  double insertionFollowSpeed(const MSVehicle* const v, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
116 
117 
127  double interactionGap(const MSVehicle* const, double vL) const;
128 
129 
137  virtual std::string getParameter(const MSVehicle* veh, const std::string& key) const;
138 
139 
147  virtual void setParameter(MSVehicle* veh, const std::string& key, const std::string& value) const;
148 
149 
154  int getModelID() const {
155  return SUMO_TAG_CF_CACC;
156  }
158 
159 
160 
165  MSCFModel* duplicate(const MSVehicleType* vtype) const;
166 
169  ret->CACC_ControlMode = 0;
171  ret->lastUpdateTime = 0;
172  return ret;
173  }
174 
175 
176 private:
182  };
183 
184  static std::map<std::string, CommunicationsOverrideMode> CommunicationsOverrideModeMap;
185 
188  enum VehicleMode {
189  CC_MODE = 0,
194  };
195 
197  static std::map<VehicleMode, std::string> VehicleModeNames;
198 
200  public:
206  };
207 
208 private:
209  double _v(const MSVehicle* const veh, const MSVehicle* const pred, const double gap2pred, const double mySpeed,
210  const double predSpeed, const double desSpeed, const bool respectMinGap = true) const;
211 
212  double speedSpeedControl(const double speed, double vErr, VehicleMode& vehMode) const;
213  double speedGapControl(const MSVehicle* const veh, const double gap2pred,
214  const double speed, const double predSpeed, const double desSpeed, double vErr,
215  const MSVehicle* const pred, VehicleMode& vehMode) const;
216 
217 private:
227 
228 private:
231 };
232 
long long int SUMOTime
Definition: SUMOTime.h:31
@ SUMO_TAG_CF_CACC
The ACC car-following model.
Definition: MSCFModel_ACC.h:47
CommunicationsOverrideMode CACC_CommunicationsOverrideMode
int CACC_ControlMode
The vehicle's CACC precious time step gap error.
The CACC car-following model.
MSCFModel_CACC & operator=(const MSCFModel_CACC &s)
Invalidated assignment operator.
virtual std::string getParameter(const MSVehicle *veh, const std::string &key) const
try to get the given parameter for this carFollowingModel
double stopSpeed(const MSVehicle *const veh, const double speed, double gap2pred) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
MSCFModel_ACC acc_CFM
double getSecureGap(const MSVehicle *const veh, const MSVehicle *const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the a gap such that the gap mode acceleration of the follower is zero.
MSCFModel_CACC(const MSVehicleType *vtype)
Constructor.
double myGapControlGainGap
virtual void setParameter(MSVehicle *veh, const std::string &key, const std::string &value) const
try to set the given parameter for this carFollowingModel
double myGapClosingControlGainGap
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
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)
double speedSpeedControl(const double speed, double vErr, VehicleMode &vehMode) const
double _v(const MSVehicle *const veh, const MSVehicle *const pred, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
double insertionFollowSpeed(const MSVehicle *const v, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's acceptable speed at insertion.
double myGapClosingControlGainGapDot
static std::map< std::string, CommunicationsOverrideMode > CommunicationsOverrideModeMap
double mySpeedControlGain
double myCollisionAvoidanceGainGapDot
double speedGapControl(const MSVehicle *const veh, const double gap2pred, const double speed, const double predSpeed, const double desSpeed, double vErr, const MSVehicle *const pred, VehicleMode &vehMode) const
double myHeadwayTimeACC
double myGapControlGainGapDot
int getModelID() const
Returns the model's name.
~MSCFModel_CACC()
Destructor.
VehicleMode
Vehicle mode (default is CACC) Switch to ACC mode if CACC_ControlMode = 1 (gap control mode) and lead...
virtual MSCFModel::VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
static std::map< VehicleMode, std::string > VehicleModeNames
Vehicle mode name map.
double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
double myCollisionAvoidanceGainGap
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
The car-following model abstraction.
Definition: MSCFModel.h:55
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:62