Eclipse SUMO - Simulation of Urban MObility
MSLCM_DK2008.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2005-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 /****************************************************************************/
18 // A lane change model developed by D. Krajzewicz between 2004 and 2010
19 /****************************************************************************/
20 #ifndef MSLCM_DK2008_h
21 #define MSLCM_DK2008_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
30 #include <vector>
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
40 public:
41 
43 
44  virtual ~MSLCM_DK2008();
45 
48  return LCM_DK2008;
49  }
50 
55  int wantsChange(
56  int laneOffset,
57  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
58  const std::pair<MSVehicle*, double>& leader,
59  const std::pair<MSVehicle*, double>& neighLead,
60  const std::pair<MSVehicle*, double>& neighFollow,
61  const MSLane& neighLane,
62  const std::vector<MSVehicle::LaneQ>& preb,
63  MSVehicle** lastBlocked,
64  MSVehicle** firstBlocked);
65 
66  virtual void* inform(void* info, MSVehicle* sender);
67 
76  virtual double patchSpeed(const double min, const double wanted, const double max,
77  const MSCFModel& cfModel);
78 
79  virtual void changed();
80 
81  virtual void prepareStep();
82 
83 
84 protected:
88  virtual int wantsChangeToRight(
89  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
90  const std::pair<MSVehicle*, double>& leader,
91  const std::pair<MSVehicle*, double>& neighLead,
92  const std::pair<MSVehicle*, double>& neighFollow,
93  const MSLane& neighLane,
94  const std::vector<MSVehicle::LaneQ>& preb,
95  MSVehicle** lastBlocked,
96  MSVehicle** firstBlocked);
97 
101  virtual int wantsChangeToLeft(
102  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
103  const std::pair<MSVehicle*, double>& leader,
104  const std::pair<MSVehicle*, double>& neighLead,
105  const std::pair<MSVehicle*, double>& neighFollow,
106  const MSLane& neighLane,
107  const std::vector<MSVehicle::LaneQ>& preb,
108  MSVehicle** lastBlocked,
109  MSVehicle** firstBlocked);
110 
112  int& blocked, int dir,
113  const std::pair<MSVehicle*, double>& neighLead,
114  const std::pair<MSVehicle*, double>& neighFollow);
115 
116  inline bool amBlockingLeader() {
117  return (myOwnState & LCA_AMBLOCKINGLEADER) != 0;
118  }
119  inline bool amBlockingFollower() {
120  return (myOwnState & LCA_AMBLOCKINGFOLLOWER) != 0;
121  }
122  inline bool amBlockingFollowerNB() {
124  }
125  inline bool amBlockingFollowerPlusNB() {
127  }
128  inline bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist) {
129  return dist / (abs(laneOffset)) < lookForwardDist;
130  }
131  inline bool currentDistAllows(double dist, int laneOffset, double lookForwardDist) {
132  return dist / abs(laneOffset) > lookForwardDist;
133  }
134 
135  typedef std::pair<double, int> Info;
136 
137 
138 
139 protected:
141 
143  double myLeftSpace;
144 
145  std::vector<double> myVSafes;
147 
148 };
149 
150 
151 #endif
152 
153 /****************************************************************************/
154 
MSLCM_DK2008::inform
virtual void * inform(void *info, MSVehicle *sender)
Definition: MSLCM_DK2008.cpp:581
MSLCM_DK2008::currentDistDisallows
bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist)
Definition: MSLCM_DK2008.h:128
MSLCM_DK2008::changed
virtual void changed()
Definition: MSLCM_DK2008.cpp:591
MSLCM_DK2008::getModelID
LaneChangeModel getModelID() const
Returns the model's id.
Definition: MSLCM_DK2008.h:47
MSLCM_DK2008::myLeadingBlockerLength
double myLeadingBlockerLength
Definition: MSLCM_DK2008.h:142
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSLCM_DK2008::myChangeProbability
double myChangeProbability
Definition: MSLCM_DK2008.h:140
MSLCM_DK2008::amBlockingLeader
bool amBlockingLeader()
Definition: MSLCM_DK2008.h:116
MSAbstractLaneChangeModel::MSLCMessager
A class responsible for exchanging messages between cars involved in lane-change interaction.
Definition: MSAbstractLaneChangeModel.h:51
LaneChangeModel
LaneChangeModel
Definition: SUMOXMLDefinitions.h:1303
LCA_AMBLOCKINGLEADER
Definition: SUMOXMLDefinitions.h:1286
MSLCM_DK2008::amBlockingFollower
bool amBlockingFollower()
Definition: MSLCM_DK2008.h:119
MSLCM_DK2008::prepareStep
virtual void prepareStep()
Definition: MSLCM_DK2008.cpp:632
MSLCM_DK2008::patchSpeed
virtual double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)
Called to adapt the speed in order to allow a lane change.
Definition: MSLCM_DK2008.cpp:493
MSLCM_DK2008::wantsChange
int wantsChange(int laneOffset, MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change using the given laneOffset. This method gets th...
Definition: MSLCM_DK2008.cpp:62
LCA_AMBLOCKINGFOLLOWER_DONTBRAKE
Definition: SUMOXMLDefinitions.h:1291
MSLCM_DK2008::myLeftSpace
double myLeftSpace
Definition: MSLCM_DK2008.h:143
MSLCM_DK2008::wantsChangeToLeft
virtual int wantsChangeToLeft(MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change to left This method gets the information about ...
Definition: MSLCM_DK2008.cpp:288
MSLCM_DK2008::myDontBrake
bool myDontBrake
Definition: MSLCM_DK2008.h:146
MSLCM_DK2008::wantsChangeToRight
virtual int wantsChangeToRight(MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change to right This method gets the information about...
Definition: MSLCM_DK2008.cpp:81
MSLCM_DK2008::MSLCM_DK2008
MSLCM_DK2008(MSVehicle &v)
Definition: MSLCM_DK2008.cpp:52
MSLCM_DK2008::currentDistAllows
bool currentDistAllows(double dist, int laneOffset, double lookForwardDist)
Definition: MSLCM_DK2008.h:131
MSLCM_DK2008::myVSafes
std::vector< double > myVSafes
Definition: MSLCM_DK2008.h:145
MSAbstractLaneChangeModel::myOwnState
int myOwnState
The current state of the vehicle.
Definition: MSAbstractLaneChangeModel.h:592
MSLCM_DK2008::Info
std::pair< double, int > Info
Definition: MSLCM_DK2008.h:135
MSLCM_DK2008::informBlocker
void informBlocker(MSAbstractLaneChangeModel::MSLCMessager &msgPass, int &blocked, int dir, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow)
Definition: MSLCM_DK2008.cpp:602
MSCFModel
The car-following model abstraction.
Definition: MSCFModel.h:56
MSLCM_DK2008::amBlockingFollowerPlusNB
bool amBlockingFollowerPlusNB()
Definition: MSLCM_DK2008.h:125
config.h
MSAbstractLaneChangeModel
Interface for lane-change models.
Definition: MSAbstractLaneChangeModel.h:45
LCM_DK2008
Definition: SUMOXMLDefinitions.h:1304
MSLCM_DK2008::~MSLCM_DK2008
virtual ~MSLCM_DK2008()
Definition: MSLCM_DK2008.cpp:57
MSLCM_DK2008
A lane change model developed by D. Krajzewicz between 2004 and 2010.
Definition: MSLCM_DK2008.h:39
LCA_AMBLOCKINGFOLLOWER
Definition: SUMOXMLDefinitions.h:1287
MSLCM_DK2008::amBlockingFollowerNB
bool amBlockingFollowerNB()
Definition: MSLCM_DK2008.h:122
MSAbstractLaneChangeModel.h
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79