Eclipse 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 Member Functions | |
void | changeLanes (const SUMOTime t) |
Moves (precomputes) critical vehicles. | |
void | checkCollisionForInactive (MSLane *l) |
trigger collision checking for inactive lane | |
void | detectCollisions (SUMOTime timestep, const std::string &stage) |
Detect collisions. | |
const MSEdgeVector & | getEdges () const |
Returns loaded edges. | |
void | gotActive (MSLane *l) |
Informs the control that the given lane got active. | |
MSEdgeControl (const std::vector< MSEdge * > &edges) | |
Constructor. | |
void | patchActiveLanes () |
Resets information whether a lane is active for all lanes. | |
void | saveState (OutputDevice &out) |
Saves the current state into the given stream. | |
void | setActiveLanes (std::list< MSLane * > lanes) |
Reconstruct the current state. | |
void | setAdditionalRestrictions () |
apply additional restrictions | |
void | setMesoTypes () |
update meso edge type parameters | |
~MSEdgeControl () | |
Destructor. | |
Interfaces for longitudinal vehicle movement | |
void | planMovements (SUMOTime t) |
Compute safe velocities for all vehicles based on positions and speeds from the last time step. Also registers ApproachingVehicleInformation for all links. | |
void | setJunctionApproaches (SUMOTime t) |
Register junction approaches for all vehicles after velocities have been planned. This is a prerequisite for executeMovements. | |
void | executeMovements (SUMOTime t) |
Executes planned vehicle movements with regards to right-of-way. | |
void | needsVehicleIntegration (MSLane *const l) |
Private Types | |
typedef std::vector< LaneUsage > | LaneUsageVector |
Definition of a container about a lane's number of vehicles and neighbors. | |
Private Member Functions | |
MSEdgeControl (const MSEdgeControl &) | |
Copy constructor. | |
MSEdgeControl & | operator= (const MSEdgeControl &) |
Assignment operator. | |
Private Attributes | |
std::list< MSLane * > | myActiveLanes |
The list of active (not empty) lanes. | |
std::set< MSLane *, ComparatorNumericalIdLess > | myChangedStateLanes |
Lanes which changed the state without informing the control. | |
MSEdgeVector | myEdges |
Loaded edges. | |
MFXSynchSet< MSLane *, std::set< MSLane *, ComparatorNumericalIdLess > > | myInactiveCheckCollisions |
Additional lanes for which collision checking must be performed. | |
LaneUsageVector | myLanes |
Information about lanes' number of vehicles and neighbors. | |
std::vector< SUMOTime > | myLastLaneChange |
The list of active (not empty) lanes. | |
double | myMinLengthGeometryFactor |
std::vector< StopWatch< std::chrono::nanoseconds > > | myStopWatch |
MFXSynchQue< MSLane *, std::vector< MSLane * > > | myWithVehicles2Integrate |
A storage for lanes which shall be integrated because vehicles have moved onto them. | |
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 78 of file MSEdgeControl.h.
|
private |
Definition of a container about a lane's number of vehicles and neighbors.
Definition at line 269 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 45 of file MSEdgeControl.cpp.
References MSGlobals::gNumThreads, MIN2(), myEdges, myLanes, myLastLaneChange, and myMinLengthGeometryFactor.
MSEdgeControl::~MSEdgeControl | ( | ) |
Destructor.
Definition at line 88 of file MSEdgeControl.cpp.
References StopWatch< TimeT, ClockT >::add(), StopWatch< TimeT, ClockT >::getAverage(), StopWatch< TimeT, ClockT >::getHistory(), StopWatch< TimeT, ClockT >::getTotal(), myEdges, and myStopWatch.
|
private |
Copy constructor.
void MSEdgeControl::changeLanes | ( | const 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 270 of file MSEdgeControl.cpp.
References MSEdgeControl::LaneUsage::amActive, MSEdge::changeLanes(), MSGlobals::gComputeLC, MSEdge::getLanes(), MSEdge::getNumericalID(), MSLane::getRNGIndex(), MSGlobals::gLateralResolution, MSGlobals::gNumSimThreads, myActiveLanes, myLanes, and myLastLaneChange.
Referenced by MSNet::simulationStep().
void MSEdgeControl::checkCollisionForInactive | ( | MSLane * | l | ) |
trigger collision checking for inactive lane
Definition at line 361 of file MSEdgeControl.cpp.
References MFXSynchSet< T, Container >::insert(), and myInactiveCheckCollisions.
Referenced by MSVehicle::enterLaneAtInsertion(), MSLane::executeMovements(), and MSVehicle::processLaneAdvances().
void MSEdgeControl::detectCollisions | ( | SUMOTime | timestep, |
const std::string & | stage | ||
) |
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 |
[in] | stage | The current stage within the simulation step |
Definition at line 338 of file MSEdgeControl.cpp.
References MFXSynchSet< T, Container >::clear(), MFXSynchSet< T, Container >::getContainer(), myActiveLanes, myInactiveCheckCollisions, MFXSynchSet< T, Container >::size(), and MFXSynchSet< T, Container >::unlock().
Referenced by MSNet::postMoveStep(), and MSNet::simulationStep().
void MSEdgeControl::executeMovements | ( | SUMOTime | t | ) |
Executes planned vehicle movements with regards to right-of-way.
This method goes through all active lanes calling their executeMovements method which causes vehicles to update their positions and speeds. Lanes which receive new vehicles are stored in myWithVehicles2Integrate After movements are executed the vehicles in myWithVehicles2Integrate are put onto their new lanes This method also updates the "active" status of lanes
Definition at line 195 of file MSEdgeControl.cpp.
References MSEdgeControl::LaneUsage::amActive, MFXSynchQue< T, Container >::clear(), MFXSynchQue< T, Container >::getContainer(), MSNet::getInstance(), MSNet::getVehicleControl(), MSGlobals::gNumSimThreads, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myLanes, myStopWatch, myWithVehicles2Integrate, PARALLEL_EXEC_MOVE, MSVehicleControl::removePending(), and MFXSynchQue< T, Container >::unlock().
Referenced by MSNet::simulationStep().
|
inline |
Returns loaded edges.
Definition at line 173 of file MSEdgeControl.h.
References myEdges.
Referenced by MSRoutingEngine::_initEdgeWeights(), MSRoutingEngine::adaptEdgeEfforts(), MSNet::adaptIntermodalRouter(), MSPModel_JuPedSim::buildPedestrianNetwork(), MSNet::checkBidiEdges(), MSNet::checkElevation(), MSNet::checkWalkingarea(), MSMeanData::init(), MSXMLRawOut::write(), MSFCDExport::write(), MSFullExport::writeEdge(), MSQueueExport::writeEdge(), and MSNet::writeOutput().
void MSEdgeControl::gotActive | ( | MSLane * | l | ) |
Informs the control that the given lane got active.
[in] | l | The activated lane |
Definition at line 356 of file MSEdgeControl.cpp.
References myChangedStateLanes.
Referenced by MSLane::incorporateVehicle().
|
inline |
Definition at line 138 of file MSEdgeControl.h.
References myWithVehicles2Integrate, and MFXSynchQue< T, Container >::push_back().
Referenced by MSLane::executeMovements().
|
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 116 of file MSEdgeControl.cpp.
References MSEdgeControl::LaneUsage::amActive, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myChangedStateLanes, and myLanes.
Referenced by MSNet::simulationStep().
void MSEdgeControl::planMovements | ( | SUMOTime | t | ) |
Compute safe velocities for all vehicles based on positions and speeds from the last time step. Also registers ApproachingVehicleInformation for all links.
This method goes through all active lanes calling their "planMovements" method.
Definition at line 135 of file MSEdgeControl.cpp.
References MSGlobals::gNumSimThreads, myActiveLanes, myLanes, and myStopWatch.
Referenced by MSNet::simulationStep().
void MSEdgeControl::saveState | ( | OutputDevice & | out | ) |
Saves the current state into the given stream.
Definition at line 384 of file MSEdgeControl.cpp.
References OutputDevice::closeTag(), myActiveLanes, OutputDevice::openTag(), SUMO_ATTR_LANES, SUMO_TAG_EDGECONTROL, and OutputDevice::writeAttr().
Referenced by MSStateHandler::saveState().
void MSEdgeControl::setActiveLanes | ( | std::list< MSLane * > | lanes | ) |
Reconstruct the current state.
Definition at line 108 of file MSEdgeControl.cpp.
References myActiveLanes, and myLanes.
Referenced by MSStateHandler::myStartElement().
void MSEdgeControl::setAdditionalRestrictions | ( | ) |
apply additional restrictions
Definition at line 366 of file MSEdgeControl.cpp.
References myEdges.
Referenced by NLBuilder::build().
void MSEdgeControl::setJunctionApproaches | ( | SUMOTime | t | ) |
Register junction approaches for all vehicles after velocities have been planned. This is a prerequisite for executeMovements.
This method goes through all active lanes calling their "setJunctionApproaches" method.
Definition at line 187 of file MSEdgeControl.cpp.
References myActiveLanes.
Referenced by MSNet::simulationStep().
void MSEdgeControl::setMesoTypes | ( | ) |
update meso edge type parameters
Definition at line 377 of file MSEdgeControl.cpp.
References myEdges.
Referenced by NLBuilder::build().
|
private |
The list of active (not empty) lanes.
Definition at line 275 of file MSEdgeControl.h.
Referenced by changeLanes(), detectCollisions(), executeMovements(), patchActiveLanes(), planMovements(), saveState(), setActiveLanes(), and setJunctionApproaches().
|
private |
Lanes which changed the state without informing the control.
Definition at line 281 of file MSEdgeControl.h.
Referenced by gotActive(), and patchActiveLanes().
|
private |
Loaded edges.
Definition at line 266 of file MSEdgeControl.h.
Referenced by getEdges(), MSEdgeControl(), setAdditionalRestrictions(), setMesoTypes(), and ~MSEdgeControl().
|
private |
Additional lanes for which collision checking must be performed.
Definition at line 287 of file MSEdgeControl.h.
Referenced by checkCollisionForInactive(), and detectCollisions().
|
private |
Information about lanes' number of vehicles and neighbors.
Definition at line 272 of file MSEdgeControl.h.
Referenced by changeLanes(), executeMovements(), MSEdgeControl(), patchActiveLanes(), planMovements(), and setActiveLanes().
|
private |
The list of active (not empty) lanes.
Definition at line 284 of file MSEdgeControl.h.
Referenced by changeLanes(), and MSEdgeControl().
|
private |
Definition at line 289 of file MSEdgeControl.h.
Referenced by MSEdgeControl().
|
private |
Definition at line 299 of file MSEdgeControl.h.
Referenced by executeMovements(), planMovements(), and ~MSEdgeControl().
|
private |
A storage for lanes which shall be integrated because vehicles have moved onto them.
Definition at line 278 of file MSEdgeControl.h.
Referenced by executeMovements(), and needsVehicleIntegration().