Eclipse SUMO - Simulation of Urban MObility
MSEdgeControl.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
20 // Stores edges and lanes, performs moving of vehicle
21 /****************************************************************************/
22 #ifndef MSEdgeControl_h
23 #define MSEdgeControl_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #include <config.h>
30 
31 #include <vector>
32 #include <map>
33 #include <string>
34 #include <iostream>
35 #include <list>
36 #include <set>
37 #include <queue>
38 #include <utils/common/SUMOTime.h>
39 #include <utils/common/Named.h>
40 
42 #ifdef HAVE_FOX
44 #endif
45 
46 
47 // ===========================================================================
48 // class declarations
49 // ===========================================================================
50 class MSEdge;
51 class MSLane;
53 
54 typedef std::vector<MSEdge*> MSEdgeVector;
55 
56 // ===========================================================================
57 // class definitions
58 // ===========================================================================
74 
75 public:
83  MSEdgeControl(const std::vector< MSEdge* >& edges);
84 
85 
88 
89 
96  void patchActiveLanes();
97 
98 
101 
109  void planMovements(SUMOTime t);
110 
117 
118 
131  void executeMovements(SUMOTime t);
132 
135  }
137 
138 
147  void changeLanes(const SUMOTime t);
148 
149 
160  void detectCollisions(SUMOTime timestep, const std::string& stage);
161 
162 
168  const MSEdgeVector& getEdges() const {
169  return myEdges;
170  }
171 
172 
178  void gotActive(MSLane* l);
179 
182 
185 
186 
187 public:
199  struct LaneUsage {
203  bool amActive;
206  };
207 
208 private:
211 
213  typedef std::vector<LaneUsage> LaneUsageVector;
214 
217 
219  std::list<MSLane*> myActiveLanes;
220 
223 
225  std::set<MSLane*, ComparatorNumericalIdLess> myChangedStateLanes;
226 
228  std::vector<SUMOTime> myLastLaneChange;
229 
231  std::set<MSLane*, ComparatorNumericalIdLess> myInactiveCheckCollisions;
232 
233 #ifdef HAVE_FOX
234  FXWorkerThread::Pool myThreadPool;
235 #endif
236 
237  std::priority_queue<std::pair<int, int> > myRNGLoad;
238 
239 private:
242 
245 
246 };
247 
248 
249 #endif
250 
251 /****************************************************************************/
252 
MSEdgeControl::myInactiveCheckCollisions
std::set< MSLane *, ComparatorNumericalIdLess > myInactiveCheckCollisions
Additional lanes for which collision checking must be performed.
Definition: MSEdgeControl.h:231
MSEdgeControl::LaneUsageVector
std::vector< LaneUsage > LaneUsageVector
Definition of a container about a lane's number of vehicles and neighbors.
Definition: MSEdgeControl.h:213
MSEdgeControl::gotActive
void gotActive(MSLane *l)
Informs the control that the given lane got active.
Definition: MSEdgeControl.cpp:306
MSEdgeControl::LaneUsage::haveNeighbors
bool haveNeighbors
Information whether this lane belongs to a multi-lane edge.
Definition: MSEdgeControl.h:205
SUMOTime.h
MSEdgeControl::setAdditionalRestrictions
void setAdditionalRestrictions()
apply additional restrictions
Definition: MSEdgeControl.cpp:316
MSEdgeControl::LaneUsage::lane
MSLane * lane
The described lane.
Definition: MSEdgeControl.h:201
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSEdgeControl::needsVehicleIntegration
void needsVehicleIntegration(MSLane *const l)
Definition: MSEdgeControl.h:133
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
FXSynchQue.h
MSEdgeControl::changeLanes
void changeLanes(const SUMOTime t)
Moves (precomputes) critical vehicles.
Definition: MSEdgeControl.cpp:217
MSEdgeControl::myChangedStateLanes
std::set< MSLane *, ComparatorNumericalIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
Definition: MSEdgeControl.h:225
MSEdgeControl::myLanes
LaneUsageVector myLanes
Information about lanes' number of vehicles and neighbors.
Definition: MSEdgeControl.h:216
MSEdgeControl::myLastLaneChange
std::vector< SUMOTime > myLastLaneChange
The list of active (not empty) lanes.
Definition: MSEdgeControl.h:228
MSEdgeControl::checkCollisionForInactive
void checkCollisionForInactive(MSLane *l)
trigger collision checking for inactive lane
Definition: MSEdgeControl.cpp:311
MSEdgeVector
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdgeControl.h:52
Named.h
MSEdgeControl::myWithVehicles2Integrate
FXSynchQue< MSLane *, std::vector< MSLane * > > myWithVehicles2Integrate
A storage for lanes which shall be integrated because vehicles have moved onto them.
Definition: MSEdgeControl.h:222
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
FXWorkerThread.h
MSEdgeControl::detectCollisions
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
Definition: MSEdgeControl.cpp:289
FXSynchQue
Definition: FXSynchQue.h:34
MSEdgeControl::setJunctionApproaches
void setJunctionApproaches(SUMOTime t)
Register junction approaches for all vehicles after velocities have been planned. This is a prerequis...
Definition: MSEdgeControl.cpp:142
MSEdgeControl::MSEdgeControl
MSEdgeControl(const std::vector< MSEdge * > &edges)
Constructor.
Definition: MSEdgeControl.cpp:45
MSEdgeControl::myRNGLoad
std::priority_queue< std::pair< int, int > > myRNGLoad
Definition: MSEdgeControl.h:237
FXWorkerThread::Pool
A pool of worker threads which distributes the tasks and collects the results.
Definition: FXWorkerThread.h:89
MSEdgeVector
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:72
MSEdgeControl::myActiveLanes
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
Definition: MSEdgeControl.h:219
MSEdgeControl::LaneUsage::amActive
bool amActive
Information whether this lane is active.
Definition: MSEdgeControl.h:203
MSEdgeControl::myEdges
MSEdgeVector myEdges
Loaded edges.
Definition: MSEdgeControl.h:210
FXSynchQue::push_back
void push_back(T what)
Definition: FXSynchQue.h:91
config.h
MSEdgeControl::~MSEdgeControl
~MSEdgeControl()
Destructor.
Definition: MSEdgeControl.cpp:71
MSEdgeControl
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
MSEdgeControl::executeMovements
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSEdgeControl.cpp:150
MSEdgeControl::planMovements
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step....
Definition: MSEdgeControl.cpp:95
MSEdgeControl::patchActiveLanes
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
Definition: MSEdgeControl.cpp:76
MSEdgeControl::operator=
MSEdgeControl & operator=(const MSEdgeControl &)
Assignment operator.
MSEdgeControl::getEdges
const MSEdgeVector & getEdges() const
Returns loaded edges.
Definition: MSEdgeControl.h:168
MSEdgeControl::LaneUsage
A structure holding some basic information about a simulated lane.
Definition: MSEdgeControl.h:199