Eclipse SUMO - Simulation of Urban MObility
MSEdgeControl Class Reference

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

#include <MSEdgeControl.h>

Collaboration diagram for MSEdgeControl:

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. More...
 
void checkCollisionForInactive (MSLane *l)
 trigger collision checking for inactive lane More...
 
void detectCollisions (SUMOTime timestep, const std::string &stage)
 Detect collisions. More...
 
const MSEdgeVectorgetEdges () 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...
 
void setAdditionalRestrictions ()
 apply additional restrictions More...
 
 ~MSEdgeControl ()
 Destructor. More...
 
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. More...
 
void setJunctionApproaches (SUMOTime t)
 Register junction approaches for all vehicles after velocities have been planned. This is a prerequisite for executeMovements. More...
 
void executeMovements (SUMOTime t)
 Executes planned vehicle movements with regards to right-of-way. More...
 
void needsVehicleIntegration (MSLane *const l)
 

Private Types

typedef std::vector< LaneUsageLaneUsageVector
 Definition of a container about a lane's number of vehicles and neighbors. More...
 

Private Member Functions

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

Private Attributes

std::list< MSLane * > myActiveLanes
 The list of active (not empty) lanes. More...
 
std::set< MSLane *, ComparatorNumericalIdLessmyChangedStateLanes
 Lanes which changed the state without informing the control. More...
 
MSEdgeVector myEdges
 Loaded edges. More...
 
std::set< MSLane *, ComparatorNumericalIdLessmyInactiveCheckCollisions
 Additional lanes for which collision checking must be performed. More...
 
LaneUsageVector myLanes
 Information about lanes' number of vehicles and neighbors. More...
 
std::vector< SUMOTimemyLastLaneChange
 The list of active (not empty) lanes. More...
 
double myMinLengthGeometryFactor
 
std::priority_queue< std::pair< int, int > > myRNGLoad
 
FXSynchQue< MSLane *, std::vector< MSLane * > > myWithVehicles2Integrate
 A storage for lanes which shall be integrated because vehicles have moved onto them. More...
 

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 74 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 247 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 44 of file MSEdgeControl.cpp.

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

◆ ~MSEdgeControl()

MSEdgeControl::~MSEdgeControl ( )

Destructor.

Definition at line 80 of file MSEdgeControl.cpp.

◆ 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 225 of file MSEdgeControl.cpp.

References MSEdgeControl::LaneUsage::amActive, MSEdge::changeLanes(), MSGlobals::gComputeLC, MSEdge::getLanes(), MSEdge::getNumericalID(), MSLane::getRNGIndex(), MSGlobals::gLateralResolution, MSGlobals::gNumSimThreads, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myLanes, and myLastLaneChange.

Referenced by MSNet::simulationStep().

◆ checkCollisionForInactive()

void MSEdgeControl::checkCollisionForInactive ( MSLane l)

trigger collision checking for inactive lane

Definition at line 318 of file MSEdgeControl.cpp.

References myInactiveCheckCollisions.

Referenced by MSVehicle::processLaneAdvances().

◆ 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 296 of file MSEdgeControl.cpp.

References myActiveLanes, and myInactiveCheckCollisions.

Referenced by MSNet::simulationStep().

◆ 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 155 of file MSEdgeControl.cpp.

References MSEdgeControl::LaneUsage::amActive, FXSynchQue< T, Container >::clear(), FXSynchQue< T, Container >::getContainer(), MSNet::getInstance(), MSLane::getNumRNGs(), MSNet::getVehicleControl(), MSGlobals::gNumSimThreads, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myLanes, myRNGLoad, myWithVehicles2Integrate, PARALLEL_EXEC_MOVE, MSVehicleControl::removePending(), and FXSynchQue< T, Container >::unlock().

Referenced by MSNet::simulationStep().

◆ getEdges()

const MSEdgeVector& MSEdgeControl::getEdges ( ) const
inline

◆ 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 313 of file MSEdgeControl.cpp.

References myChangedStateLanes.

Referenced by MSLane::incorporateVehicle().

◆ needsVehicleIntegration()

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

◆ 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 88 of file MSEdgeControl.cpp.

References MSEdgeControl::LaneUsage::amActive, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myChangedStateLanes, and myLanes.

Referenced by MSNet::simulationStep().

◆ 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 107 of file MSEdgeControl.cpp.

References MSLane::getNumRNGs(), MSGlobals::gNumSimThreads, myActiveLanes, myLanes, and myRNGLoad.

Referenced by MSNet::simulationStep().

◆ setAdditionalRestrictions()

void MSEdgeControl::setAdditionalRestrictions ( )

apply additional restrictions

Definition at line 323 of file MSEdgeControl.cpp.

References myEdges.

Referenced by NLBuilder::build().

◆ 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 147 of file MSEdgeControl.cpp.

References myActiveLanes.

Referenced by MSNet::simulationStep().

Field Documentation

◆ myActiveLanes

std::list<MSLane*> MSEdgeControl::myActiveLanes
private

The list of active (not empty) lanes.

Definition at line 253 of file MSEdgeControl.h.

Referenced by changeLanes(), detectCollisions(), executeMovements(), patchActiveLanes(), planMovements(), and setJunctionApproaches().

◆ myChangedStateLanes

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

Lanes which changed the state without informing the control.

Definition at line 259 of file MSEdgeControl.h.

Referenced by gotActive(), and patchActiveLanes().

◆ myEdges

MSEdgeVector MSEdgeControl::myEdges
private

Loaded edges.

Definition at line 244 of file MSEdgeControl.h.

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

◆ myInactiveCheckCollisions

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

Additional lanes for which collision checking must be performed.

Definition at line 265 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 250 of file MSEdgeControl.h.

Referenced by changeLanes(), executeMovements(), MSEdgeControl(), patchActiveLanes(), and planMovements().

◆ myLastLaneChange

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

The list of active (not empty) lanes.

Definition at line 262 of file MSEdgeControl.h.

Referenced by changeLanes(), and MSEdgeControl().

◆ myMinLengthGeometryFactor

double MSEdgeControl::myMinLengthGeometryFactor
private

Definition at line 267 of file MSEdgeControl.h.

Referenced by MSEdgeControl().

◆ myRNGLoad

std::priority_queue<std::pair<int, int> > MSEdgeControl::myRNGLoad
private

Definition at line 273 of file MSEdgeControl.h.

Referenced by executeMovements(), and planMovements().

◆ myWithVehicles2Integrate

FXSynchQue<MSLane*, std::vector<MSLane*> > MSEdgeControl::myWithVehicles2Integrate
private

A storage for lanes which shall be integrated because vehicles have moved onto them.

Definition at line 256 of file MSEdgeControl.h.

Referenced by executeMovements(), and needsVehicleIntegration().


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