SUMO - Simulation of Urban MObility
|
Stores edges and lanes, performs moving of vehicle. More...
#include <MSEdgeControl.h>
Data Structures | |
struct | LaneUsage |
A structure holding some basic information about a simulated lane. More... | |
Public Types | |
typedef std::vector< MSEdge * > | EdgeCont |
Container for edges. More... | |
Public Member Functions | |
void | changeLanes (SUMOTime t) |
Moves (precomputes) critical vehicles. More... | |
void | detectCollisions (SUMOTime timestep) |
Detect collisions. More... | |
std::vector< std::string > | getEdgeNames () const |
Returns the list of names of all known edges. More... | |
const std::vector< MSEdge * > & | getEdges () const |
Returns loaded edges. More... | |
void | gotActive (MSLane *l) |
Informs the control that the given lane got active. More... | |
MSEdgeControl (const std::vector< MSEdge * > &edges) | |
Constructor. More... | |
void | patchActiveLanes () |
Resets information whether a lane is active for all lanes. More... | |
~MSEdgeControl () | |
Destructor. More... | |
Interfaces for longitudinal vehicle movement | |
void | moveCritical (SUMOTime t) |
Moves (precomputes) critical vehicles. More... | |
void | moveFirst (SUMOTime t) |
Really moves critical vehicles. More... | |
Private Types | |
typedef std::vector< LaneUsage > | LaneUsageVector |
Definition of a container about a lane's number of vehicles and neighbors. More... | |
Private Member Functions | |
MSEdgeControl (const MSEdgeControl &) | |
Copy constructor. More... | |
MSEdgeControl & | operator= (const MSEdgeControl &) |
Assignment operator. More... | |
Private Attributes | |
std::list< MSLane * > | myActiveLanes |
The list of active (not empty) lanes. More... | |
std::set< MSLane *, Named::ComparatorIdLess > | myChangedStateLanes |
Lanes which changed the state without informing the control. More... | |
std::vector< MSEdge * > | myEdges |
Loaded edges. More... | |
LaneUsageVector | myLanes |
Information about lanes' number of vehicles and neighbors. More... | |
std::vector< SUMOTime > | myLastLaneChange |
The list of active (not empty) lanes. More... | |
std::vector< MSLane * > | myWithVehicles2Integrate |
A storage for lanes which shall be integrated because vehicles have moved onto them. More... | |
Stores edges and lanes, performs moving of vehicle.
In order to avoid touching all lanes, even the empty ones, this class stores and updates the information about "active" lanes, those that have at least one vehicle on them. During longitudinal movement, this can be simply achieved through return values of the MSLane-methods, signalling either that the lane got active or inactive. This is but not possible when changing lanes, we have to go through the lanes, here. Also, we have to add lanes on which a vehicle was inserted, separately, doing this into ("myChangedStateLanes") which entries are integrated at the begin of is step in "patchActiveLanes".
Definition at line 73 of file MSEdgeControl.h.
typedef std::vector< MSEdge* > MSEdgeControl::EdgeCont |
Container for edges.
Definition at line 76 of file MSEdgeControl.h.
|
private |
Definition of a container about a lane's number of vehicles and neighbors.
Definition at line 219 of file MSEdgeControl.h.
MSEdgeControl::MSEdgeControl | ( | const std::vector< MSEdge * > & | edges | ) |
Constructor.
Builds LaneUsage information for each lane and assigns them to lanes.
[in] | edges | The loaded edges |
Definition at line 48 of file MSEdgeControl.cpp.
References myEdges, myLanes, and myLastLaneChange.
MSEdgeControl::~MSEdgeControl | ( | ) |
Destructor.
Definition at line 77 of file MSEdgeControl.cpp.
|
private |
Copy constructor.
void MSEdgeControl::changeLanes | ( | SUMOTime | t | ) |
Moves (precomputes) critical vehicles.
Calls "changeLanes" of each of the multi-lane edges. Check then for this edge whether a lane got active, adding it to "myActiveLanes" and marking it as active in such cases.
Definition at line 140 of file MSEdgeControl.cpp.
References MSEdgeControl::LaneUsage::amActive, MSEdge::changeLanes(), MSEdge::getLanes(), MSEdge::getNumericalID(), MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myLanes, and myLastLaneChange.
Referenced by MSNet::simulationStep().
void MSEdgeControl::detectCollisions | ( | SUMOTime | timestep | ) |
Detect collisions.
Calls "detectCollisions" of each lane. Shouldn't be necessary if model-implementation is correct. The parameter is simply passed to the lane-instance for reporting.
[in] | timestep | The current time step |
Definition at line 170 of file MSEdgeControl.cpp.
References myActiveLanes.
Referenced by MSNet::simulationStep().
std::vector< std::string > MSEdgeControl::getEdgeNames | ( | ) | const |
Returns the list of names of all known edges.
Definition at line 179 of file MSEdgeControl.cpp.
References myEdges.
Referenced by TraCIServerAPI_Simulation::convertCartesianToRoadMap().
|
inline |
Returns loaded edges.
Definition at line 169 of file MSEdgeControl.h.
References myEdges.
Referenced by MSDevice_Routing::adaptEdgeEfforts(), MSDevice_Routing::buildVehicleDevices(), TraCIServerAPI_Edge::getTree(), TraCIServerAPI_Lane::getTree(), MSMeanData::init(), MSXMLRawOut::write(), MSQueueExport::writeEdge(), and MSFullExport::writeEdge().
void MSEdgeControl::gotActive | ( | MSLane * | l | ) |
Informs the control that the given lane got active.
[in] | l | The activated lane |
Definition at line 189 of file MSEdgeControl.cpp.
References myChangedStateLanes.
Referenced by MSLane::incorporateVehicle().
void MSEdgeControl::moveCritical | ( | SUMOTime | t | ) |
Moves (precomputes) critical vehicles.
"Critical" are those vehicles that interact with the next junction and all first vehicles. They are not moved, in fact, but their speed along the next path is precomputed.
This method goes through all active lanes calling their "moveCritical" implementation. If this call returns true, the lane is removed from the list of active lanes.
Definition at line 100 of file MSEdgeControl.cpp.
References myActiveLanes, and myLanes.
Referenced by MSNet::simulationStep().
void MSEdgeControl::moveFirst | ( | SUMOTime | t | ) |
Really moves critical vehicles.
"Critical" are those vehicles that interact with the next junction and all first vehicles.
At first, this method goes through all active lanes calling their "setCritical" implementation. If this call returns true, the lane is removed from the list of active lanes. During this call, "myWithVehicles2Integrate" is filled with lanes that obtain new vehicles.
Then, myWithVehicles2Integrate is gone through, calling "integrateNewVehicle" of each of the stored instances. If this call returns true and the lane was not active before, it is added to the list of active lanes.
Definition at line 113 of file MSEdgeControl.cpp.
References MSEdgeControl::LaneUsage::amActive, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myLanes, and myWithVehicles2Integrate.
Referenced by MSNet::simulationStep().
|
private |
Assignment operator.
void MSEdgeControl::patchActiveLanes | ( | ) |
Resets information whether a lane is active for all lanes.
For each lane in "myChangedStateLanes": if the lane has at least one vehicle and is not marked as being active, it is added to the list og active lanes and marked as being active.
Definition at line 82 of file MSEdgeControl.cpp.
References MSEdgeControl::LaneUsage::amActive, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myChangedStateLanes, and myLanes.
Referenced by MSNet::simulationStep().
|
private |
The list of active (not empty) lanes.
Definition at line 225 of file MSEdgeControl.h.
Referenced by changeLanes(), detectCollisions(), moveCritical(), moveFirst(), and patchActiveLanes().
|
private |
Lanes which changed the state without informing the control.
Definition at line 231 of file MSEdgeControl.h.
Referenced by gotActive(), and patchActiveLanes().
|
private |
Loaded edges.
Definition at line 216 of file MSEdgeControl.h.
Referenced by getEdgeNames(), getEdges(), and MSEdgeControl().
|
private |
Information about lanes' number of vehicles and neighbors.
Definition at line 222 of file MSEdgeControl.h.
Referenced by changeLanes(), moveCritical(), moveFirst(), MSEdgeControl(), and patchActiveLanes().
|
private |
The list of active (not empty) lanes.
Definition at line 234 of file MSEdgeControl.h.
Referenced by changeLanes(), and MSEdgeControl().
|
private |
A storage for lanes which shall be integrated because vehicles have moved onto them.
Definition at line 228 of file MSEdgeControl.h.
Referenced by moveFirst().