SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSLCM_DK2008.h
Go to the documentation of this file.
1 /****************************************************************************/
11 // A lane change model developed by D. Krajzewicz between 2004 and 2010
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
14 // Copyright (C) 2005-2014 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 #ifndef MSLCM_DK2008_h
25 #define MSLCM_DK2008_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
38 #include <vector>
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
48 public:
49 
50  enum MyLCAEnum {
53  LCA_MRIGHT = 1 << 18,
54  LCA_MLEFT = 1 << 19,
55  // !!! never set LCA_UNBLOCK = 1 << 20,
57  // !!! never used LCA_AMBLOCKINGSECONDFOLLOWER = 1 << 22,
58 
59  // !!! never read LCA_KEEP1 = 1 << 24,
60  // !!! never used LCA_KEEP2 = 1 << 25,
61  LCA_AMBACKBLOCKER = 1 << 26,
63  };
64 
66 
67  virtual ~MSLCM_DK2008();
68 
73  int wantsChange(
74  int laneOffset,
75  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
76  const std::pair<MSVehicle*, SUMOReal>& leader,
77  const std::pair<MSVehicle*, SUMOReal>& neighLead,
78  const std::pair<MSVehicle*, SUMOReal>& neighFollow,
79  const MSLane& neighLane,
80  const std::vector<MSVehicle::LaneQ>& preb,
81  MSVehicle** lastBlocked,
82  MSVehicle** firstBlocked);
83 
84  virtual void* inform(void* info, MSVehicle* sender);
85 
94  virtual SUMOReal patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max,
95  const MSCFModel& cfModel);
96 
97  virtual void changed();
98 
99  virtual void prepareStep();
100 
101 
102 protected:
106  virtual int wantsChangeToRight(
107  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
108  const std::pair<MSVehicle*, SUMOReal>& leader,
109  const std::pair<MSVehicle*, SUMOReal>& neighLead,
110  const std::pair<MSVehicle*, SUMOReal>& neighFollow,
111  const MSLane& neighLane,
112  const std::vector<MSVehicle::LaneQ>& preb,
113  MSVehicle** lastBlocked,
114  MSVehicle** firstBlocked);
115 
119  virtual int wantsChangeToLeft(
120  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
121  const std::pair<MSVehicle*, SUMOReal>& leader,
122  const std::pair<MSVehicle*, SUMOReal>& neighLead,
123  const std::pair<MSVehicle*, SUMOReal>& neighFollow,
124  const MSLane& neighLane,
125  const std::vector<MSVehicle::LaneQ>& preb,
126  MSVehicle** lastBlocked,
127  MSVehicle** firstBlocked);
128 
130  int& blocked, int dir,
131  const std::pair<MSVehicle*, SUMOReal>& neighLead,
132  const std::pair<MSVehicle*, SUMOReal>& neighFollow);
133 
134  inline bool amBlockingLeader() {
135  return (myOwnState & LCA_AMBLOCKINGLEADER) != 0;
136  }
137  inline bool amBlockingFollower() {
138  return (myOwnState & LCA_AMBLOCKINGFOLLOWER) != 0;
139  }
140  inline bool amBlockingFollowerNB() {
142  }
143  inline bool amBlockingFollowerPlusNB() {
145  }
146  inline bool currentDistDisallows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) {
147  return dist / (abs(laneOffset)) < lookForwardDist;
148  }
149  inline bool currentDistAllows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) {
150  return dist / abs(laneOffset) > lookForwardDist;
151  }
152 
153  typedef std::pair<SUMOReal, int> Info;
154 
155 
156 
157 protected:
159 
162 
163  std::vector<SUMOReal> myVSafes;
165 
166 };
167 
168 
169 #endif
170 
171 /****************************************************************************/
172