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 
216  LaneUsageVector myLanes;
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 
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
void needsVehicleIntegration(MSLane *const l)
long long int SUMOTime
Definition: SUMOTime.h:35
~MSEdgeControl()
Destructor.
std::set< MSLane *, ComparatorNumericalIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
void checkCollisionForInactive(MSLane *l)
trigger collision checking for inactive lane
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
MSLane * lane
The described lane.
std::vector< LaneUsage > LaneUsageVector
Definition of a container about a lane&#39;s number of vehicles and neighbors.
std::set< MSLane *, ComparatorNumericalIdLess > myInactiveCheckCollisions
Additional lanes for which collision checking must be performed.
LaneUsageVector myLanes
Information about lanes&#39; number of vehicles and neighbors.
MSEdgeControl & operator=(const MSEdgeControl &)
Assignment operator.
bool amActive
Information whether this lane is active.
A structure holding some basic information about a simulated lane.
void gotActive(MSLane *l)
Informs the control that the given lane got active.
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
void setAdditionalRestrictions()
apply additional restrictions
FXSynchQue< MSLane *, std::vector< MSLane * > > myWithVehicles2Integrate
A storage for lanes which shall be integrated because vehicles have moved onto them.
void setJunctionApproaches(SUMOTime t)
Register junction approaches for all vehicles after velocities have been planned. This is a prerequis...
A road/street connecting two junctions.
Definition: MSEdge.h:76
void push_back(T what)
Definition: FXSynchQue.h:91
std::priority_queue< std::pair< int, int > > myRNGLoad
std::vector< SUMOTime > myLastLaneChange
The list of active (not empty) lanes.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
void changeLanes(const SUMOTime t)
Moves (precomputes) critical vehicles.
MSEdgeVector myEdges
Loaded edges.
A pool of worker threads which distributes the tasks and collects the results.
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
bool haveNeighbors
Information whether this lane belongs to a multi-lane edge.
const MSEdgeVector & getEdges() const
Returns loaded edges.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:72
MSEdgeControl(const std::vector< MSEdge * > &edges)
Constructor.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdgeControl.h:52