SUMO - Simulation of Urban MObility
|
A detector of vehicles passing an area between entry/exit points. More...
#include <MSE3Collector.h>
Data Structures | |
struct | E3Values |
Internal storage for values from a vehicle. More... | |
class | MSE3EntryReminder |
A place on the road net (at a certain lane and position on it) where the E3 area begins. More... | |
class | MSE3LeaveReminder |
A place on the road net (at a certain lane and position on it) where the E3 area ends. More... | |
Public Member Functions | |
void | detectorUpdate (const SUMOTime step) |
Computes the detector values in each time step. | |
void | enter (SUMOVehicle &veh, SUMOReal entryTimestep) |
Called if a vehicle touches an entry-cross-section. | |
const std::string & | getID () const |
Returns the id. | |
void | leave (SUMOVehicle &veh, SUMOReal leaveTimestep) |
Called if a vehicle passes a leave-cross-section. | |
MSE3Collector (const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold) | |
Constructor. | |
void | reset () |
Resets all generated values to allow computation of next interval. | |
void | setID (const std::string &newID) |
resets the id | |
virtual | ~MSE3Collector () |
Destructor. | |
Methods returning current values | |
SUMOReal | getCurrentMeanSpeed () const |
Returns the mean speed within the area. | |
SUMOReal | getCurrentHaltingNumber () const |
Returns the number of current haltings within the area. | |
SUMOReal | getVehiclesWithin () const |
Returns the number of vehicles within the area. | |
std::vector< std::string > | getCurrentVehicleIDs () const |
Returns the number of vehicles within the area. | |
Methods inherited from MSDetectorFileOutput. | |
void | writeXMLOutput (OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime) |
Writes collected values into the given stream. | |
void | writeXMLDetectorProlog (OutputDevice &dev) const |
Opens the XML-output using "e3Detector" as root element. | |
Virtual methods to implement by derived classes | |
virtual GUIDetectorWrapper * | buildDetectorGUIRepresentation () |
Builds the graphical representation. | |
Protected Attributes | |
std::map< SUMOVehicle *, E3Values > | myEnteredContainer |
Container for vehicles that have entered the area. | |
CrossSectionVector | myEntries |
The detector's entries. | |
std::vector< MSE3EntryReminder * > | myEntryReminders |
The detector's built entry reminder. | |
CrossSectionVector | myExits |
The detector's exits. | |
SUMOReal | myHaltingSpeedThreshold |
Speed-threshold to determine if a vehicle is halting. | |
SUMOTime | myHaltingTimeThreshold |
std::string | myID |
The name of the object. | |
SUMOTime | myLastResetTime |
Information when the last reset has been done. | |
std::vector< MSE3LeaveReminder * > | myLeaveReminders |
The detector's built exit reminder. | |
std::map< SUMOVehicle *, E3Values > | myLeftContainer |
Container for vehicles that have left the area. | |
Storages for current values | |
SUMOReal | myCurrentMeanSpeed |
The current mean speed of known vehicles (inside) | |
SUMOReal | myCurrentHaltingsNumber |
The current number of haltings (inside) | |
SUMOReal | myCurrentTouchedVehicles |
The current number of vehicles inside;. | |
Private Member Functions | |
MSE3Collector (const MSE3Collector &) | |
Invalidated copy constructor. | |
MSE3Collector & | operator= (const MSE3Collector &) |
Invalidated assignment operator. |
A detector of vehicles passing an area between entry/exit points.
E3 detectors are defined by a set of in-cross-sections and out-cross-sections. Vehicles, that pass an in- and out-cross-section are detected when they pass the out-cross-section. Vehicles passing the out-cross-section without having passed the in-cross-section are not detected.
Definition at line 65 of file MSE3Collector.h.
MSE3Collector::MSE3Collector | ( | const std::string & | id, |
const CrossSectionVector & | entries, | ||
const CrossSectionVector & | exits, | ||
SUMOReal | haltingSpeedThreshold, | ||
SUMOTime | haltingTimeThreshold | ||
) |
Constructor.
Sets reminder objects on entry- and leave-lanes
[in] | id | The detector's unique id. |
[in] | entries | Entry-cross-sections. |
[in] | exits | Leavey-cross-sections. |
[in] | haltingSpeedThreshold | A vehicle must not drive a greater speed than haltingSpeedThreshold to be a "halting" vehicle. |
[in] | haltingTimeThreshold | A vehicle must not drive a greater speed for more than haltingTimeThreshold to be a "halting" vehicle. |
Definition at line 119 of file MSE3Collector.cpp.
References myEntryReminders, myLeaveReminders, and reset().
MSE3Collector::~MSE3Collector | ( | ) | [virtual] |
Destructor.
Definition at line 139 of file MSE3Collector.cpp.
References myEntryReminders, and myLeaveReminders.
MSE3Collector::MSE3Collector | ( | const MSE3Collector & | ) | [private] |
Invalidated copy constructor.
virtual GUIDetectorWrapper* MSDetectorFileOutput::buildDetectorGUIRepresentation | ( | ) | [inline, virtual, inherited] |
Builds the graphical representation.
Meant to be overridden by graphical versions of the detectors
Reimplemented in GUI_E2_ZS_Collector, GUIInductLoop, GUIE3Collector, GUI_E2_ZS_CollectorOverLanes, and GUIInstantInductLoop.
Definition at line 123 of file MSDetectorFileOutput.h.
void MSE3Collector::detectorUpdate | ( | const SUMOTime | step | ) | [virtual] |
Computes the detector values in each time step.
This method should be called at the end of a simulation step, when all vehicles have moved. The current values are computed and summed up with the previous.
[in] | currentTime | The current simulation time (unused) |
Reimplemented from MSDetectorFileOutput.
Definition at line 285 of file MSE3Collector.cpp.
References MSE3Collector::E3Values::entryTime, SUMOVehicle::getSpeed(), MSE3Collector::E3Values::hadUpdate, MSE3Collector::E3Values::haltingBegin, MSE3Collector::E3Values::haltings, MSE3Collector::E3Values::intervalHaltings, MSE3Collector::E3Values::intervalSpeedSum, myCurrentHaltingsNumber, myCurrentMeanSpeed, myCurrentTouchedVehicles, myEnteredContainer, myHaltingSpeedThreshold, myHaltingTimeThreshold, MSE3Collector::E3Values::speedSum, SUMOReal, and TS.
void MSE3Collector::enter | ( | SUMOVehicle & | veh, |
SUMOReal | entryTimestep | ||
) |
Called if a vehicle touches an entry-cross-section.
Inserts vehicle into internal containers.
[in] | veh | The vehicle that entered the area |
[in] | entryTimestep | The time step the vehicle entered the area |
Definition at line 157 of file MSE3Collector.cpp.
References DELTA_T, MSE3Collector::E3Values::entryTime, Named::getID(), SUMOVehicle::getID(), SUMOVehicle::getSpeed(), MSE3Collector::E3Values::hadUpdate, MSE3Collector::E3Values::haltingBegin, MSE3Collector::E3Values::haltings, MSE3Collector::E3Values::intervalHaltings, MSE3Collector::E3Values::intervalSpeedSum, MSE3Collector::E3Values::leaveTime, myEnteredContainer, myHaltingSpeedThreshold, myHaltingTimeThreshold, MSE3Collector::E3Values::speedSum, SUMO_TAG_E3DETECTOR, SUMOReal, toString(), and WRITE_WARNING.
Returns the number of current haltings within the area.
If no vehicle is within the area, 0 is returned.
Definition at line 338 of file MSE3Collector.cpp.
References myCurrentHaltingsNumber.
Referenced by GUIE3Collector::MyWrapper::getParameterWindow(), and TraCIServerAPI_MeMeDetector::processGet().
SUMOReal MSE3Collector::getCurrentMeanSpeed | ( | ) | const |
Returns the mean speed within the area.
If no vehicle is within the area, -1 is returned.
Definition at line 325 of file MSE3Collector.cpp.
References myEnteredContainer, and SUMOReal.
Referenced by GUIE3Collector::MyWrapper::getParameterWindow(), and TraCIServerAPI_MeMeDetector::processGet().
std::vector< std::string > MSE3Collector::getCurrentVehicleIDs | ( | ) | const |
Returns the number of vehicles within the area.
Definition at line 350 of file MSE3Collector.cpp.
References myEnteredContainer.
Referenced by TraCIServerAPI_MeMeDetector::processGet().
const std::string& Named::getID | ( | ) | const [inline, inherited] |
Returns the id.
Reimplemented in MS_E2_ZS_CollectorOverLanes.
Definition at line 61 of file Named.h.
References Named::myID.
Referenced by MSDetectorControl::add(), ShapeContainer::add(), RORouteDef_Alternatives::addAlternative(), MSNet::addBusStop(), NBLoadedSUMOTLDef::addConnection(), NLHandler::addConnection(), NIImporter_OpenDrive::addE2EConnectionsSecure(), RONet::addNode(), NIImporter_SUMO::addPhase(), RONet::addRouteDef(), NBDistrict::addSink(), NBDistrict::addSource(), MSRouteHandler::addStop(), NIXMLTrafficLightsHandler::addTlConnection(), NIVissimDisturbance::addToNode(), MSVehicle::addTraciStop(), NIVisumTL::build(), MS_E2_ZS_CollectorOverLanes::buildCollector(), NIImporter_VISUM::buildDistrictNode(), NIVissimConnection::buildEdgeConnections(), NBEdge::buildInnerEdges(), NIVissimEdge::buildNBEdge(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), ODDistrictHandler::closeDistrict(), NBTrafficLightDefinition::collectEdges(), NBOwnTLDef::collectLinks(), NBTrafficLightDefinition::compute(), NBNode::computeInternalLaneShape(), NBEdge::computeLaneShapes(), NBNode::computeLogic(), NBNode::computeNodeShape(), NBTrafficLightLogicCont::computeSingleLogic(), NBTurningDirectionsComputer::computeTurnDirectionsForNode(), NBEdge::connections_sorter(), MSLane::detectCollisions(), NIVissimDistrictConnection::dict_BuildDistricts(), enter(), Command_SaveTLSSwitches::execute(), MSVTypeProbe::execute(), NBNodeCont::extract(), NBTrafficLightLogicCont::extract(), NBEdgeCont::extract(), MSNet::getBusStopID(), NIImporter_VISUM::getNamedEdgeContinuating(), NLTriggerBuilder::getPosition(), NBNode::getPossiblySplittedIncoming(), NBNode::getPossiblySplittedOutgoing(), NIImporter_VISUM::getReversedContinuating(), NBEdgeCont::ignoreFilterMatch(), MSActuatedTrafficLightLogic::init(), MSAgentbasedTrafficLightLogic::init(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NBDistrictCont::insert(), NBTrafficLightLogicCont::insert(), NBNodeCont::insert(), NBEdgeCont::insert(), NBEdgeCont::joinSameNodeConnectingEdges(), leave(), NIImporter_OpenDrive::loadNetwork(), MSLane::moveCritical(), MSVehicle::MSVehicle(), RORDLoader_SUMOBase::myCharacters(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), NIXMLTrafficLightsHandler::myEndElement(), NIXMLEdgesHandler::myEndElement(), NIImporter_SUMO::myEndElement(), NIXMLConnectionsHandler::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSTriggeredRerouter::myStartElement(), NBConnection::NBConnection(), NBRequest::NBRequest(), MSDevice_Tripinfo::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), Named::ComparatorIdLess::operator()(), NBTurningDirectionsComputer::combination_by_angle_sorter::operator()(), NBOwnTLDef::edge_by_incoming_priority_sorter::operator()(), NBNetBuilder::by_id_sorter::operator()(), NBContHelper::same_connection_edge_sorter::operator()(), NBNode::nodes_by_id_sorter::operator()(), NIImporter_VISUM::parse_EdgePolys(), NIImporter_VISUM::parse_Lanes(), NIImporter_VISUM::parse_LanesConnections(), NIImporter_VISUM::parse_Turns(), NIImporter_VISUM::parse_TurnsToSignalGroups(), NIXMLConnectionsHandler::parseDeprecatedLaneDefinition(), NIXMLConnectionsHandler::parseLaneBound(), NBLoadedTLDef::SignalGroup::patchTYellow(), RORouteDef_Complete::preComputeCurrentRoute(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Vehicle::processGet(), NWWriter_SUMO::prohibitionConnection(), NBLoadedTLDef::SignalGroup::remapIncoming(), NBLoadedTLDef::SignalGroup::remapOutgoing(), NBLoadedSUMOTLDef::removeConnection(), NBNode::removeSelfLoops(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBNodeCont::rename(), NBEdgeCont::rename(), NBConnection::replaceFrom(), MSBaseVehicle::replaceRouteEdges(), NBConnection::replaceTo(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), NBNodeCont::setAsTLControlled(), NBEdge::setControllingTLInformation(), MSLane::setCritical(), NIXMLEdgesHandler::setNodes(), NBOwnTLDef::setTLControllingInformation(), NBLoadedSUMOTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), NBEdgeCont::splitAt(), RORDLoader_SUMOBase::startRoute(), NBEdge::startShapeAt(), NIXMLConnectionsHandler::validateLaneInfo(), MSInstantInductLoop::write(), NWWriter_SUMO::writeConnection(), NWWriter_SUMO::writeDistrict(), NWWriter_SUMO::writeEdge(), MSMeanData::writeEdge(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeInternalConnections(), NWWriter_SUMO::writeJunction(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), MSInductLoop::writeTypedXMLOutput(), MSRouteProbe::writeXMLOutput(), and MSE2Collector::writeXMLOutput().
SUMOReal MSE3Collector::getVehiclesWithin | ( | ) | const |
Returns the number of vehicles within the area.
Definition at line 344 of file MSE3Collector.cpp.
References myEnteredContainer, and SUMOReal.
Referenced by GUIE3Collector::MyWrapper::getParameterWindow(), and TraCIServerAPI_MeMeDetector::processGet().
void MSE3Collector::leave | ( | SUMOVehicle & | veh, |
SUMOReal | leaveTimestep | ||
) |
Called if a vehicle passes a leave-cross-section.
Removes vehicle from internal containers.
[in] | veh | The vehicle that left the area |
[in] | entryTimestep | The time step the vehicle left the area |
Definition at line 184 of file MSE3Collector.cpp.
References DELTA_T, Named::getID(), SUMOVehicle::getID(), SUMOVehicle::getSpeed(), MSE3Collector::E3Values::hadUpdate, MSE3Collector::E3Values::haltingBegin, MSE3Collector::E3Values::haltings, MSE3Collector::E3Values::intervalHaltings, MSE3Collector::E3Values::intervalSpeedSum, MSE3Collector::E3Values::leaveTime, myEnteredContainer, myHaltingSpeedThreshold, myHaltingTimeThreshold, myLeftContainer, MSE3Collector::E3Values::speedSum, SUMO_TAG_E3DETECTOR, SUMOReal, toString(), and WRITE_WARNING.
MSE3Collector& MSE3Collector::operator= | ( | const MSE3Collector & | ) | [private] |
Invalidated assignment operator.
void MSE3Collector::reset | ( | ) | [virtual] |
Resets all generated values to allow computation of next interval.
Reimplemented from MSDetectorFileOutput.
Definition at line 150 of file MSE3Collector.cpp.
References myLeftContainer.
Referenced by MSE3Collector().
void Named::setID | ( | const std::string & | newID | ) | [inline, inherited] |
resets the id
Definition at line 67 of file Named.h.
References Named::myID.
Referenced by NBNodeCont::rename(), and NBEdgeCont::rename().
void MSE3Collector::writeXMLDetectorProlog | ( | OutputDevice & | dev | ) | const [virtual] |
Opens the XML-output using "e3Detector" as root element.
The lists of entries/exists are written, too.
[in] | dev | The output device to write the root into |
IOError | If an error on writing occurs (!!! not yet implemented) |
Implements MSDetectorFileOutput.
Definition at line 279 of file MSE3Collector.cpp.
References OutputDevice::writeXMLHeader().
void MSE3Collector::writeXMLOutput | ( | OutputDevice & | dev, |
SUMOTime | startTime, | ||
SUMOTime | stopTime | ||
) | [virtual] |
Writes collected values into the given stream.
[in] | dev | The output device to write the data into |
[in] | startTime | First time step the data were gathered |
[in] | stopTime | Last time step the data were gathered |
IOError | If an error on writing occurs (!!! not yet implemented) |
Implements MSDetectorFileOutput.
Definition at line 212 of file MSE3Collector.cpp.
References MIN2(), myEnteredContainer, Named::myID, myLastResetTime, myLeftContainer, SUMOReal, and time2string().
SUMOReal MSE3Collector::myCurrentHaltingsNumber [protected] |
The current number of haltings (inside)
Definition at line 366 of file MSE3Collector.h.
Referenced by detectorUpdate(), and getCurrentHaltingNumber().
SUMOReal MSE3Collector::myCurrentMeanSpeed [protected] |
The current mean speed of known vehicles (inside)
Definition at line 363 of file MSE3Collector.h.
Referenced by detectorUpdate().
SUMOReal MSE3Collector::myCurrentTouchedVehicles [protected] |
The current number of vehicles inside;.
Please note, that vehicles that enter the area are given as a fraction
Definition at line 373 of file MSE3Collector.h.
Referenced by detectorUpdate().
std::map<SUMOVehicle*, E3Values> MSE3Collector::myEnteredContainer [protected] |
Container for vehicles that have entered the area.
Definition at line 353 of file MSE3Collector.h.
Referenced by detectorUpdate(), enter(), getCurrentMeanSpeed(), getCurrentVehicleIDs(), getVehiclesWithin(), leave(), and writeXMLOutput().
CrossSectionVector MSE3Collector::myEntries [protected] |
The detector's entries.
Definition at line 307 of file MSE3Collector.h.
Referenced by GUIE3Collector::getEntries().
std::vector<MSE3EntryReminder*> MSE3Collector::myEntryReminders [protected] |
The detector's built entry reminder.
Definition at line 313 of file MSE3Collector.h.
Referenced by MSE3Collector(), and ~MSE3Collector().
CrossSectionVector MSE3Collector::myExits [protected] |
The detector's exits.
Definition at line 310 of file MSE3Collector.h.
Referenced by GUIE3Collector::getExits().
SUMOReal MSE3Collector::myHaltingSpeedThreshold [protected] |
Speed-threshold to determine if a vehicle is halting.
Definition at line 323 of file MSE3Collector.h.
Referenced by detectorUpdate(), enter(), and leave().
SUMOTime MSE3Collector::myHaltingTimeThreshold [protected] |
Definition at line 320 of file MSE3Collector.h.
Referenced by detectorUpdate(), enter(), and leave().
std::string Named::myID [protected, inherited] |
The name of the object.
Reimplemented in MS_E2_ZS_CollectorOverLanes.
Definition at line 83 of file Named.h.
Referenced by NLDetectorBuilder::addE3Entry(), NLDetectorBuilder::addE3Exit(), NBEdge::computeEdgeShape(), Named::getID(), NBEdge::getLaneID(), NBEdge::init(), RORouteDef_OrigDest::preComputeCurrentRoute(), RORouteDef_Alternatives::preComputeCurrentRoute(), RORouteDef_Complete::preComputeCurrentRoute(), MSRoute::release(), Named::setID(), NBEdge::splitGeometry(), MSXMLRawOut::writeLane(), NBNode::writeLogic(), writeXMLOutput(), and MSMeanData::writeXMLOutput().
SUMOTime MSE3Collector::myLastResetTime [protected] |
Information when the last reset has been done.
Definition at line 378 of file MSE3Collector.h.
Referenced by writeXMLOutput().
std::vector<MSE3LeaveReminder*> MSE3Collector::myLeaveReminders [protected] |
The detector's built exit reminder.
Definition at line 316 of file MSE3Collector.h.
Referenced by MSE3Collector(), and ~MSE3Collector().
std::map<SUMOVehicle*, E3Values> MSE3Collector::myLeftContainer [protected] |
Container for vehicles that have left the area.
Definition at line 356 of file MSE3Collector.h.
Referenced by leave(), reset(), and writeXMLOutput().