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 
105 
119  void executeMovements(SUMOTime t);
121 
122 
131  void changeLanes(SUMOTime t);
132 
133 
144  void detectCollisions(SUMOTime timestep, const std::string& stage);
145 
146 
152  const MSEdgeVector& getEdges() const {
153  return myEdges;
154  }
155 
156 
161  std::vector<std::string> getEdgeNames() const;
162 
163 
169  void gotActive(MSLane* l);
170 
173 
174 
175 public:
187  struct LaneUsage {
191  std::vector<MSLane*>::const_iterator firstNeigh;
193  std::vector<MSLane*>::const_iterator lastNeigh;
195  bool amActive;
198  };
199 
200 private:
203 
205  typedef std::vector<LaneUsage> LaneUsageVector;
206 
208  LaneUsageVector myLanes;
209 
211  std::list<MSLane*> myActiveLanes;
212 
214  std::vector<MSLane*> myWithVehicles2Integrate;
215 
217  std::set<MSLane*, ComparatorIdLess> myChangedStateLanes;
218 
220  std::vector<SUMOTime> myLastLaneChange;
221 
222 private:
225 
228 
229 };
230 
231 
232 #endif
233 
234 /****************************************************************************/
235 
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
long long int SUMOTime
Definition: SUMOTime.h:36
~MSEdgeControl()
Destructor.
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.
std::vector< MSLane * >::const_iterator firstNeigh
The lane left to the described lane (==lastNeigh if none)
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.
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...
std::set< MSLane *, ComparatorIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
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< MSLane * >::const_iterator lastNeigh
The end of this lane&#39;s edge&#39;s lane container.
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:71
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdgeControl.h:46