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-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 /****************************************************************************/
22 // A lane change model developed by D. Krajzewicz between 2004 and 2010
23 /****************************************************************************/
24 #pragma once
25 #include <config.h>
26 
28 #include <vector>
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
38 public:
39 
41 
42  virtual ~MSLCM_DK2008();
43 
46  return LCM_DK2008;
47  }
48 
53  int wantsChange(
54  int laneOffset,
55  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
56  const std::pair<MSVehicle*, double>& leader,
57  const std::pair<MSVehicle*, double>& neighLead,
58  const std::pair<MSVehicle*, double>& neighFollow,
59  const MSLane& neighLane,
60  const std::vector<MSVehicle::LaneQ>& preb,
61  MSVehicle** lastBlocked,
62  MSVehicle** firstBlocked);
63 
64  virtual void* inform(void* info, MSVehicle* sender);
65 
74  virtual double patchSpeed(const double min, const double wanted, const double max,
75  const MSCFModel& cfModel);
76 
77  virtual void changed();
78 
79  virtual void prepareStep();
80 
81 
82 protected:
86  virtual int wantsChangeToRight(
87  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
88  const std::pair<MSVehicle*, double>& leader,
89  const std::pair<MSVehicle*, double>& neighLead,
90  const std::pair<MSVehicle*, double>& neighFollow,
91  const MSLane& neighLane,
92  const std::vector<MSVehicle::LaneQ>& preb,
93  MSVehicle** lastBlocked,
94  MSVehicle** firstBlocked);
95 
99  virtual int wantsChangeToLeft(
100  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
101  const std::pair<MSVehicle*, double>& leader,
102  const std::pair<MSVehicle*, double>& neighLead,
103  const std::pair<MSVehicle*, double>& neighFollow,
104  const MSLane& neighLane,
105  const std::vector<MSVehicle::LaneQ>& preb,
106  MSVehicle** lastBlocked,
107  MSVehicle** firstBlocked);
108 
110  int& blocked, int dir,
111  const std::pair<MSVehicle*, double>& neighLead,
112  const std::pair<MSVehicle*, double>& neighFollow);
113 
114  inline bool amBlockingLeader() {
115  return (myOwnState & LCA_AMBLOCKINGLEADER) != 0;
116  }
117  inline bool amBlockingFollower() {
118  return (myOwnState & LCA_AMBLOCKINGFOLLOWER) != 0;
119  }
120  inline bool amBlockingFollowerNB() {
122  }
123  inline bool amBlockingFollowerPlusNB() {
125  }
126  inline bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist) {
127  return dist / (abs(laneOffset)) < lookForwardDist;
128  }
129  inline bool currentDistAllows(double dist, int laneOffset, double lookForwardDist) {
130  return dist / abs(laneOffset) > lookForwardDist;
131  }
132 
133  typedef std::pair<double, int> Info;
134 
135 
136 
137 protected:
139 
141  double myLeftSpace;
142 
143  std::vector<double> myVSafes;
145 
146 };
@ LCA_AMBLOCKINGLEADER
@ LCA_AMBLOCKINGFOLLOWER_DONTBRAKE
@ LCA_AMBLOCKINGFOLLOWER
LaneChangeModel
@ LCM_DK2008
A class responsible for exchanging messages between cars involved in lane-change interaction.
Interface for lane-change models.
int myOwnState
The current state of the vehicle.
The car-following model abstraction.
Definition: MSCFModel.h:55
A lane change model developed by D. Krajzewicz between 2004 and 2010.
Definition: MSLCM_DK2008.h:37
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...
double myLeftSpace
Definition: MSLCM_DK2008.h:141
LaneChangeModel getModelID() const
Returns the model's id.
Definition: MSLCM_DK2008.h:45
std::vector< double > myVSafes
Definition: MSLCM_DK2008.h:143
std::pair< double, int > Info
Definition: MSLCM_DK2008.h:133
bool amBlockingLeader()
Definition: MSLCM_DK2008.h:114
MSLCM_DK2008(MSVehicle &v)
virtual ~MSLCM_DK2008()
bool amBlockingFollowerPlusNB()
Definition: MSLCM_DK2008.h:123
virtual void changed()
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...
bool amBlockingFollowerNB()
Definition: MSLCM_DK2008.h:120
double myChangeProbability
Definition: MSLCM_DK2008.h:138
bool amBlockingFollower()
Definition: MSLCM_DK2008.h:117
void informBlocker(MSAbstractLaneChangeModel::MSLCMessager &msgPass, int &blocked, int dir, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow)
bool currentDistAllows(double dist, int laneOffset, double lookForwardDist)
Definition: MSLCM_DK2008.h:129
double myLeadingBlockerLength
Definition: MSLCM_DK2008.h:140
virtual void * inform(void *info, MSVehicle *sender)
virtual void prepareStep()
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 ...
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.
bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist)
Definition: MSLCM_DK2008.h:126
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77