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 /****************************************************************************/
19 // A lane change model developed by D. Krajzewicz between 2004 and 2010
20 /****************************************************************************/
21 #ifndef MSLCM_DK2008_h
22 #define MSLCM_DK2008_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
31 #include <vector>
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
41 public:
42 
44 
45  virtual ~MSLCM_DK2008();
46 
49  return LCM_DK2008;
50  }
51 
56  int wantsChange(
57  int laneOffset,
58  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
59  const std::pair<MSVehicle*, double>& leader,
60  const std::pair<MSVehicle*, double>& neighLead,
61  const std::pair<MSVehicle*, double>& neighFollow,
62  const MSLane& neighLane,
63  const std::vector<MSVehicle::LaneQ>& preb,
64  MSVehicle** lastBlocked,
65  MSVehicle** firstBlocked);
66 
67  virtual void* inform(void* info, MSVehicle* sender);
68 
77  virtual double patchSpeed(const double min, const double wanted, const double max,
78  const MSCFModel& cfModel);
79 
80  virtual void changed();
81 
82  virtual void prepareStep();
83 
84 
85 protected:
89  virtual int wantsChangeToRight(
90  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
91  const std::pair<MSVehicle*, double>& leader,
92  const std::pair<MSVehicle*, double>& neighLead,
93  const std::pair<MSVehicle*, double>& neighFollow,
94  const MSLane& neighLane,
95  const std::vector<MSVehicle::LaneQ>& preb,
96  MSVehicle** lastBlocked,
97  MSVehicle** firstBlocked);
98 
102  virtual int wantsChangeToLeft(
103  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
104  const std::pair<MSVehicle*, double>& leader,
105  const std::pair<MSVehicle*, double>& neighLead,
106  const std::pair<MSVehicle*, double>& neighFollow,
107  const MSLane& neighLane,
108  const std::vector<MSVehicle::LaneQ>& preb,
109  MSVehicle** lastBlocked,
110  MSVehicle** firstBlocked);
111 
113  int& blocked, int dir,
114  const std::pair<MSVehicle*, double>& neighLead,
115  const std::pair<MSVehicle*, double>& neighFollow);
116 
117  inline bool amBlockingLeader() {
118  return (myOwnState & LCA_AMBLOCKINGLEADER) != 0;
119  }
120  inline bool amBlockingFollower() {
121  return (myOwnState & LCA_AMBLOCKINGFOLLOWER) != 0;
122  }
123  inline bool amBlockingFollowerNB() {
125  }
126  inline bool amBlockingFollowerPlusNB() {
128  }
129  inline bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist) {
130  return dist / (abs(laneOffset)) < lookForwardDist;
131  }
132  inline bool currentDistAllows(double dist, int laneOffset, double lookForwardDist) {
133  return dist / abs(laneOffset) > lookForwardDist;
134  }
135 
136  typedef std::pair<double, int> Info;
137 
138 
139 
140 protected:
142 
144  double myLeftSpace;
145 
146  std::vector<double> myVSafes;
148 
149 };
150 
151 
152 #endif
153 
154 /****************************************************************************/
155 
MSLCM_DK2008::inform
virtual void * inform(void *info, MSVehicle *sender)
Definition: MSLCM_DK2008.cpp:582
MSLCM_DK2008::currentDistDisallows
bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist)
Definition: MSLCM_DK2008.h:129
MSLCM_DK2008::changed
virtual void changed()
Definition: MSLCM_DK2008.cpp:592
MSLCM_DK2008::getModelID
LaneChangeModel getModelID() const
Returns the model's id.
Definition: MSLCM_DK2008.h:48
MSLCM_DK2008::myLeadingBlockerLength
double myLeadingBlockerLength
Definition: MSLCM_DK2008.h:143
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSLCM_DK2008::myChangeProbability
double myChangeProbability
Definition: MSLCM_DK2008.h:141
MSLCM_DK2008::amBlockingLeader
bool amBlockingLeader()
Definition: MSLCM_DK2008.h:117
MSAbstractLaneChangeModel::MSLCMessager
A class responsible for exchanging messages between cars involved in lane-change interaction.
Definition: MSAbstractLaneChangeModel.h:52
LaneChangeModel
LaneChangeModel
Definition: SUMOXMLDefinitions.h:1298
LCA_AMBLOCKINGLEADER
Definition: SUMOXMLDefinitions.h:1281
MSLCM_DK2008::amBlockingFollower
bool amBlockingFollower()
Definition: MSLCM_DK2008.h:120
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:494
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:63
LCA_AMBLOCKINGFOLLOWER_DONTBRAKE
Definition: SUMOXMLDefinitions.h:1286
MSLCM_DK2008::myLeftSpace
double myLeftSpace
Definition: MSLCM_DK2008.h:144
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:289
MSLCM_DK2008::myDontBrake
bool myDontBrake
Definition: MSLCM_DK2008.h:147
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:82
MSLCM_DK2008::MSLCM_DK2008
MSLCM_DK2008(MSVehicle &v)
Definition: MSLCM_DK2008.cpp:53
MSLCM_DK2008::currentDistAllows
bool currentDistAllows(double dist, int laneOffset, double lookForwardDist)
Definition: MSLCM_DK2008.h:132
MSLCM_DK2008::myVSafes
std::vector< double > myVSafes
Definition: MSLCM_DK2008.h:146
MSAbstractLaneChangeModel::myOwnState
int myOwnState
The current state of the vehicle.
Definition: MSAbstractLaneChangeModel.h:614
MSLCM_DK2008::Info
std::pair< double, int > Info
Definition: MSLCM_DK2008.h:136
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:603
MSCFModel
The car-following model abstraction.
Definition: MSCFModel.h:57
MSLCM_DK2008::amBlockingFollowerPlusNB
bool amBlockingFollowerPlusNB()
Definition: MSLCM_DK2008.h:126
config.h
MSAbstractLaneChangeModel
Interface for lane-change models.
Definition: MSAbstractLaneChangeModel.h:46
LCM_DK2008
Definition: SUMOXMLDefinitions.h:1299
MSLCM_DK2008::~MSLCM_DK2008
virtual ~MSLCM_DK2008()
Definition: MSLCM_DK2008.cpp:58
MSLCM_DK2008
A lane change model developed by D. Krajzewicz between 2004 and 2010.
Definition: MSLCM_DK2008.h:40
LCA_AMBLOCKINGFOLLOWER
Definition: SUMOXMLDefinitions.h:1282
MSLCM_DK2008::amBlockingFollowerNB
bool amBlockingFollowerNB()
Definition: MSLCM_DK2008.h:123
MSAbstractLaneChangeModel.h
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80