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

Export the queueing length in front of a junction (very experimental!) More...

#include <MSQueueExport.h>

Static Public Member Functions

static void finish (OutputDevice &of, SUMOTime timestep)
 Writes the last (possibly incomplete) aggregation interval and clears the collected samples.
 
static void write (OutputDevice &of, SUMOTime timestep)
 Export the queueing length in front of a junction (very experimental!)
 

Private Member Functions

 MSQueueExport (const MSQueueExport &)
 Invalidated copy constructor.
 
MSQueueExportoperator= (const MSQueueExport &)
 Invalidated assignment operator.
 

Static Private Member Functions

static double percentile (const std::vector< double > &sorted, double p)
 Returns the given percentile (with linear interpolation) of a sorted sample vector.
 
static void writeEdge (OutputDevice *of, double threshold, const std::function< void()> &ensureOpen)
 Iterates through the edges and their lanes (micro) or segment queues (meso). If of is nullptr, queue length samples are collected for aggregation instead of being written. ensureOpen lazily opens the enclosing timestep element before the first record is written.
 
static void writeInterval (OutputDevice &of, SUMOTime begin, SUMOTime end)
 Writes aggregated per-edge queue length statistics for the given interval.
 
static void writeLane (OutputDevice *of, const MSLane &lane, double threshold, const std::function< void()> &ensureOpen)
 Checks a single lane for a vehicle queue (micro)
 
static void writeMesoQueue (OutputDevice *of, const MSEdge &edge, const MESegment &segment, int qIdx, double segmentOffset, double threshold, const std::function< void()> &ensureOpen)
 Checks a single segment queue (meso)
 

Static Private Attributes

static std::map< const MSEdge *, std::vector< std::pair< double, double > > > myEdgeSamples
 Queue length samples (in vehicles, in meters) per edge, collected during the current aggregation interval.
 
static SUMOTime myIntervalStart = SUMOTime_MIN
 The begin of the current aggregation interval.
 

Detailed Description

Export the queueing length in front of a junction (very experimental!)

The class offers a static method, which writes the actual queueing length of the network into the given OutputDevice.

Todo:
consider error-handling on write (using IOError)

Definition at line 52 of file MSQueueExport.h.

Constructor & Destructor Documentation

◆ MSQueueExport()

MSQueueExport::MSQueueExport ( const MSQueueExport )
private

Invalidated copy constructor.

Member Function Documentation

◆ finish()

void MSQueueExport::finish ( OutputDevice of,
SUMOTime  timestep 
)
static

Writes the last (possibly incomplete) aggregation interval and clears the collected samples.

Parameters
[in]ofThe output device to use
[in]timestepThe final time step

Definition at line 96 of file MSQueueExport.cpp.

References OptionsCont::getOptions(), MIN2(), myEdgeSamples, myIntervalStart, string2time(), SUMOTime_MIN, and writeInterval().

Referenced by MSNet::closeSimulation().

Here is the caller graph for this function:

◆ operator=()

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

Invalidated assignment operator.

◆ percentile()

double MSQueueExport::percentile ( const std::vector< double > &  sorted,
double  p 
)
staticprivate

Returns the given percentile (with linear interpolation) of a sorted sample vector.

Definition at line 290 of file MSQueueExport.cpp.

Referenced by writeInterval().

Here is the caller graph for this function:

◆ write()

void MSQueueExport::write ( OutputDevice of,
SUMOTime  timestep 
)
static

Export the queueing length in front of a junction (very experimental!)

Opens the current time step, goes through the lanes check for a traffic jam in front of a junction

Parameters
[in]ofThe output device to use
[in]timestepThe current time step
Exceptions
IOErrorIf an error on writing occurs (!!! not yet implemented)

Definition at line 55 of file MSQueueExport.cpp.

References OutputDevice::closeTag(), OptionsCont::getBool(), OptionsCont::getFloat(), OptionsCont::getOptions(), OptionsCont::getString(), myIntervalStart, OutputDevice::openTag(), string2time(), SUMOTime_MIN, time2string(), OutputDevice::writeAttr(), writeEdge(), and writeInterval().

Referenced by MSNet::writeOutput().

Here is the caller graph for this function:

◆ writeEdge()

void MSQueueExport::writeEdge ( OutputDevice of,
double  threshold,
const std::function< void()> &  ensureOpen 
)
staticprivate

Iterates through the edges and their lanes (micro) or segment queues (meso). If of is nullptr, queue length samples are collected for aggregation instead of being written. ensureOpen lazily opens the enclosing timestep element before the first record is written.

Definition at line 107 of file MSQueueExport.cpp.

References MSNet::getEdgeControl(), MSEdgeControl::getEdges(), MSNet::getInstance(), MSGlobals::gMesoNet, MSGlobals::gUseMesoSim, writeLane(), and writeMesoQueue().

Referenced by write().

Here is the caller graph for this function:

◆ writeInterval()

void MSQueueExport::writeInterval ( OutputDevice of,
SUMOTime  begin,
SUMOTime  end 
)
staticprivate

Writes aggregated per-edge queue length statistics for the given interval.

Definition at line 242 of file MSQueueExport.cpp.

References OutputDevice::closeTag(), OptionsCont::getBool(), MSNet::getEdgeControl(), MSEdgeControl::getEdges(), OptionsCont::getFloat(), Named::getID(), MSNet::getInstance(), OptionsCont::getOptions(), myEdgeSamples, OutputDevice::openTag(), percentile(), time2string(), and OutputDevice::writeAttr().

Referenced by finish(), and write().

Here is the caller graph for this function:

◆ writeLane()

void MSQueueExport::writeLane ( OutputDevice of,
const MSLane lane,
double  threshold,
const std::function< void()> &  ensureOpen 
)
staticprivate

Checks a single lane for a vehicle queue (micro)

Definition at line 128 of file MSQueueExport.cpp.

References OutputDevice::closeTag(), MSLane::empty(), MSLane::getEdge(), Named::getID(), MSVehicle::getLane(), MSLane::getLength(), MSVehicleType::getLength(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSBaseVehicle::getWaitingSeconds(), MSVehicle::isOnRoad(), MAX2(), myEdgeSamples, MSLane::myVehicles, OutputDevice::openTag(), and OutputDevice::writeAttr().

Referenced by writeEdge().

Here is the caller graph for this function:

◆ writeMesoQueue()

void MSQueueExport::writeMesoQueue ( OutputDevice of,
const MSEdge edge,
const MESegment segment,
int  qIdx,
double  segmentOffset,
double  threshold,
const std::function< void()> &  ensureOpen 
)
staticprivate

Field Documentation

◆ myEdgeSamples

std::map< const MSEdge *, std::vector< std::pair< double, double > > > MSQueueExport::myEdgeSamples
staticprivate

Queue length samples (in vehicles, in meters) per edge, collected during the current aggregation interval.

Definition at line 100 of file MSQueueExport.h.

Referenced by finish(), writeInterval(), writeLane(), and writeMesoQueue().

◆ myIntervalStart

SUMOTime MSQueueExport::myIntervalStart = SUMOTime_MIN
staticprivate

The begin of the current aggregation interval.

Definition at line 97 of file MSQueueExport.h.

Referenced by finish(), and write().


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