SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSLCM_DK2004.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A lane change model developed by D. Krajzewicz between 2004 and 2010
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef MSLCM_DK2004_h
24 #define MSLCM_DK2004_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
37 #include <vector>
38 
39 // ===========================================================================
40 // enumeration definition
41 // ===========================================================================
42 enum MyLCAEnum {
45  LCA_MRIGHT = 1024, // 2
46  LCA_MLEFT = 2048,// 3
47  // !!! never set LCA_UNBLOCK = 4096,// 4
49  // !!! never used LCA_AMBLOCKINGSECONDFOLLOWER = 16384, // 6
50  // !!! never read LCA_KEEP1 = 65536,// 8
51  // !!! never used LCA_KEEP2 = 131072,// 9
52  LCA_AMBACKBLOCKER = 262144,// 10
54 
55 };
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
65 public:
67 
68  virtual ~MSLCM_DK2004();
69 
73  virtual int wantsChangeToRight(
74  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
75  const std::pair<MSVehicle*, SUMOReal>& leader,
76  const std::pair<MSVehicle*, SUMOReal>& neighLead,
77  const std::pair<MSVehicle*, SUMOReal>& neighFollow,
78  const MSLane& neighLane,
79  const std::vector<MSVehicle::LaneQ>& preb,
80  MSVehicle** lastBlocked);
81 
85  virtual int wantsChangeToLeft(
86  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
87  const std::pair<MSVehicle*, SUMOReal>& leader,
88  const std::pair<MSVehicle*, SUMOReal>& neighLead,
89  const std::pair<MSVehicle*, SUMOReal>& neighFollow,
90  const MSLane& neighLane,
91  const std::vector<MSVehicle::LaneQ>& preb,
92  MSVehicle** lastBlocked);
93 
94  virtual void* inform(void* info, MSVehicle* sender);
95 
104  virtual SUMOReal patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max,
105  const MSCFModel& cfModel);
106 
107  virtual void changed();
108 
109  SUMOReal getProb() const;
110  virtual void prepareStep();
111 
113  return myChangeProbability;
114  }
115 
116 
117 protected:
119  int& blocked, int dir,
120  const std::pair<MSVehicle*, SUMOReal>& neighLead,
121  const std::pair<MSVehicle*, SUMOReal>& neighFollow);
122 
123  inline bool amBlockingLeader() {
124  return (myOwnState & LCA_AMBLOCKINGLEADER) != 0;
125  }
126  inline bool amBlockingFollower() {
127  return (myOwnState & LCA_AMBLOCKINGFOLLOWER) != 0;
128  }
129  inline bool amBlockingFollowerNB() {
131  }
132  inline bool amBlockingFollowerPlusNB() {
134  }
135  inline bool currentDistDisallows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) {
136  return dist / (abs(laneOffset)) < lookForwardDist;
137  }
138  inline bool currentDistAllows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) {
139  return dist / abs(laneOffset) > lookForwardDist;
140  }
141 
142  typedef std::pair<SUMOReal, int> Info;
143 
144 
145 
146 protected:
148 
151 
152  std::vector<SUMOReal> myVSafes;
154 
155 };
156 
157 
158 #endif
159 
160 /****************************************************************************/
161