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-2018 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 <utils/common/SUMOTime.h>
38 #include <utils/common/Named.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSEdge;
45 class MSLane;
47 
48 typedef std::vector<MSEdge*> MSEdgeVector;
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
68 
69 public:
77  MSEdgeControl(const std::vector< MSEdge* >& edges);
78 
79 
82 
83 
90  void patchActiveLanes();
91 
92 
95 
103  void planMovements(SUMOTime t);
104 
111 
112 
126  void executeMovements(SUMOTime t);
128 
129 
138  void changeLanes(SUMOTime t);
139 
140 
151  void detectCollisions(SUMOTime timestep, const std::string& stage);
152 
153 
159  const MSEdgeVector& getEdges() const {
160  return myEdges;
161  }
162 
163 
168  std::vector<std::string> getEdgeNames() const;
169 
170 
176  void gotActive(MSLane* l);
177 
180 
181 
182 public:
194  struct LaneUsage {
198  bool amActive;
201  };
202 
203 private:
206 
208  typedef std::vector<LaneUsage> LaneUsageVector;
209 
211  LaneUsageVector myLanes;
212 
214  std::list<MSLane*> myActiveLanes;
215 
217  std::vector<MSLane*> myWithVehicles2Integrate;
218 
220  std::set<MSLane*, ComparatorNumericalIdLess> myChangedStateLanes;
221 
223  std::vector<SUMOTime> myLastLaneChange;
224 
225 private:
228 
231 
232 };
233 
234 
235 #endif
236 
237 /****************************************************************************/
238 
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
long long int SUMOTime
Definition: SUMOTime.h:36
~MSEdgeControl()
Destructor.
std::set< MSLane *, ComparatorNumericalIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
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.
LaneUsageVector myLanes
Information about lanes&#39; number of vehicles and neighbors.
MSEdgeControl & operator=(const MSEdgeControl &)
Assignment operator.
void changeLanes(SUMOTime t)
Moves (precomputes) critical vehicles.
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
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
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:75
std::vector< SUMOTime > myLastLaneChange
The list of active (not empty) lanes.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:67
MSEdgeVector myEdges
Loaded edges.
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.
std::vector< MSLane * > myWithVehicles2Integrate
A storage for lanes which shall be integrated because vehicles have moved onto them.
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:71
MSEdgeControl(const std::vector< MSEdge * > &edges)
Constructor.
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdgeControl.h:46