Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSEdgeControl Class Reference

Stores edges and lanes, performs moving of vehicle. More...

#include <MSEdgeControl.h>

Collaboration diagram for MSEdgeControl:
[legend]

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 MSEdgeVectorgetEdges () 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< LaneUsageLaneUsageVector
 Definition of a container about a lane's number of vehicles and neighbors.
 

Private Member Functions

 MSEdgeControl (const MSEdgeControl &)
 Copy constructor.
 
MSEdgeControloperator= (const MSEdgeControl &)
 Assignment operator.
 

Private Attributes

std::list< MSLane * > myActiveLanes
 The list of active (not empty) lanes.
 
std::set< MSLane *, ComparatorNumericalIdLessmyChangedStateLanes
 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< SUMOTimemyLastLaneChange
 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.
 

Detailed Description

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.

Member Typedef Documentation

◆ LaneUsageVector

typedef std::vector<LaneUsage> MSEdgeControl::LaneUsageVector
private

Definition of a container about a lane's number of vehicles and neighbors.

Definition at line 269 of file MSEdgeControl.h.

Constructor & Destructor Documentation

◆ MSEdgeControl() [1/2]

MSEdgeControl::MSEdgeControl ( const std::vector< MSEdge * > &  edges)

Constructor.

Builds LaneUsage information for each lane and assigns them to lanes.

Parameters
[in]edgesThe loaded edges
Todo:
Assure both containers are not 0

Definition at line 45 of file MSEdgeControl.cpp.

References MSGlobals::gNumThreads, MIN2(), myEdges, myLanes, myLastLaneChange, and myMinLengthGeometryFactor.

◆ ~MSEdgeControl()

◆ MSEdgeControl() [2/2]

MSEdgeControl::MSEdgeControl ( const MSEdgeControl )
private

Copy constructor.

Member Function Documentation

◆ changeLanes()

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.

See also
MSEdge::changeLanes

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().

Here is the caller graph for this function:

◆ checkCollisionForInactive()

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 MSLane::executeMovements(), and MSVehicle::processLaneAdvances().

Here is the caller graph for this function:

◆ detectCollisions()

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.

Parameters
[in]timestepThe current time step
[in]stageThe current stage within the simulation step
Note
see MSNet::simulationStep

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().

Here is the caller graph for this function:

◆ executeMovements()

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

See also
MSLane::executeMovements
MSLane::integrateNewVehicle
Todo:
: sorting only needed to account for lane-ordering dependencies.

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().

Here is the caller graph for this function:

◆ getEdges()

const MSEdgeVector & MSEdgeControl::getEdges ( ) const
inline

Returns loaded edges.

Returns
the container storing one-lane edges
Todo:
Check: Is this secure?

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().

Here is the caller graph for this function:

◆ gotActive()

void MSEdgeControl::gotActive ( MSLane l)

Informs the control that the given lane got active.

Parameters
[in]lThe activated lane
Todo:
Check for l==0?

Definition at line 356 of file MSEdgeControl.cpp.

References myChangedStateLanes.

Referenced by MSLane::incorporateVehicle().

Here is the caller graph for this function:

◆ needsVehicleIntegration()

void MSEdgeControl::needsVehicleIntegration ( MSLane *const  l)
inline

Definition at line 138 of file MSEdgeControl.h.

References myWithVehicles2Integrate, and MFXSynchQue< T, Container >::push_back().

Referenced by MSLane::executeMovements().

Here is the caller graph for this function:

◆ operator=()

MSEdgeControl & MSEdgeControl::operator= ( const MSEdgeControl )
private

Assignment operator.

◆ patchActiveLanes()

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().

Here is the caller graph for this function:

◆ planMovements()

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.

See also
MSLane::planMovements

Definition at line 135 of file MSEdgeControl.cpp.

References MSGlobals::gNumSimThreads, myActiveLanes, myLanes, and myStopWatch.

Referenced by MSNet::simulationStep().

Here is the caller graph for this function:

◆ saveState()

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().

Here is the caller graph for this function:

◆ setActiveLanes()

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().

Here is the caller graph for this function:

◆ setAdditionalRestrictions()

void MSEdgeControl::setAdditionalRestrictions ( )

apply additional restrictions

Definition at line 366 of file MSEdgeControl.cpp.

References myEdges.

Referenced by NLBuilder::build().

Here is the caller graph for this function:

◆ setJunctionApproaches()

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().

Here is the caller graph for this function:

◆ setMesoTypes()

void MSEdgeControl::setMesoTypes ( )

update meso edge type parameters

Definition at line 377 of file MSEdgeControl.cpp.

References myEdges.

Referenced by NLBuilder::build().

Here is the caller graph for this function:

Field Documentation

◆ myActiveLanes

std::list<MSLane*> MSEdgeControl::myActiveLanes
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().

◆ myChangedStateLanes

std::set<MSLane*, ComparatorNumericalIdLess> MSEdgeControl::myChangedStateLanes
private

Lanes which changed the state without informing the control.

Definition at line 281 of file MSEdgeControl.h.

Referenced by gotActive(), and patchActiveLanes().

◆ myEdges

MSEdgeVector MSEdgeControl::myEdges
private

Loaded edges.

Definition at line 266 of file MSEdgeControl.h.

Referenced by getEdges(), MSEdgeControl(), setAdditionalRestrictions(), setMesoTypes(), and ~MSEdgeControl().

◆ myInactiveCheckCollisions

MFXSynchSet<MSLane*, std::set<MSLane*, ComparatorNumericalIdLess> > MSEdgeControl::myInactiveCheckCollisions
private

Additional lanes for which collision checking must be performed.

Definition at line 287 of file MSEdgeControl.h.

Referenced by checkCollisionForInactive(), and detectCollisions().

◆ myLanes

LaneUsageVector MSEdgeControl::myLanes
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().

◆ myLastLaneChange

std::vector<SUMOTime> MSEdgeControl::myLastLaneChange
private

The list of active (not empty) lanes.

Definition at line 284 of file MSEdgeControl.h.

Referenced by changeLanes(), and MSEdgeControl().

◆ myMinLengthGeometryFactor

double MSEdgeControl::myMinLengthGeometryFactor
private

Definition at line 289 of file MSEdgeControl.h.

Referenced by MSEdgeControl().

◆ myStopWatch

std::vector<StopWatch<std::chrono::nanoseconds> > MSEdgeControl::myStopWatch
private

Definition at line 299 of file MSEdgeControl.h.

Referenced by executeMovements(), planMovements(), and ~MSEdgeControl().

◆ myWithVehicles2Integrate

MFXSynchQue<MSLane*, std::vector<MSLane*> > MSEdgeControl::myWithVehicles2Integrate
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().


The documentation for this class was generated from the following files: