SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSInstantInductLoop Class Reference

An instantaneous induction loop. More...

#include <MSInstantInductLoop.h>

Inheritance diagram for MSInstantInductLoop:
MSMoveReminder MSDetectorFileOutput Named GUIInstantInductLoop

Public Types

enum  Notification {
  NOTIFICATION_DEPARTED, NOTIFICATION_JUNCTION, NOTIFICATION_SEGMENT, NOTIFICATION_LANE_CHANGE,
  NOTIFICATION_TELEPORT, NOTIFICATION_PARKING, NOTIFICATION_ARRIVED, NOTIFICATION_VAPORIZED,
  NOTIFICATION_TELEPORT_ARRIVED
}
 Definition of a vehicle state. More...

Public Member Functions

const std::string & getID () const
 Returns the id.
const MSLanegetLane () const
 Returns the lane the reminder works on.
 MSInstantInductLoop (const std::string &id, OutputDevice &od, MSLane *const lane, SUMOReal positionInMeters)
 Constructor.
virtual void notifyMoveInternal (SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
 Internal notification about the vehicle moves.
void setID (const std::string &newID)
 resets the id
void writeXMLDetectorProlog (OutputDevice &dev) const
 Open the XML-output.
void writeXMLOutput (OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
 Write the generated output to the given device.
 ~MSInstantInductLoop ()
 Destructor.
Methods inherited from MSMoveReminder
bool notifyMove (SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
 Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
bool notifyLeave (SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
 Dismisses the vehicle if it is on the detector due to a lane change.
bool notifyEnter (SUMOVehicle &veh, MSMoveReminder::Notification reason)
 Returns whether the detector may has to be concerned during the vehicle's further movement.
Virtual methods to implement by derived classes
virtual void reset ()
 Resets collected values.
virtual void detectorUpdate (const SUMOTime step)
 Updates the detector (computes values)
virtual GUIDetectorWrapperbuildDetectorGUIRepresentation ()
 Builds the graphical representation.

Protected Member Functions

void write (const char *state, SUMOReal t, SUMOVehicle &veh, SUMOReal speed, const char *add=0, SUMOReal addValue=-1)
 Writes an event line.

Protected Attributes

std::map< SUMOVehicle *, SUMORealmyEntryTimes
 The last exit time.
std::string myID
 The name of the object.
MSLane *const myLane
 Lane on which the reminder works.
SUMOReal myLastExitTime
 The last exit time.
OutputDevicemyOutputDevice
 The output device to use.
const SUMOReal myPosition
 Detector's position on lane [m].

Private Member Functions

 MSInstantInductLoop (const MSInstantInductLoop &)
 Invalidated copy constructor.
MSInstantInductLoopoperator= (const MSInstantInductLoop &)
 Invalidated assignment operator.

Detailed Description

An instantaneous induction loop.

See Also
MSMoveReminder
MSDetectorFileOutput

Definition at line 59 of file MSInstantInductLoop.h.

Member Enumeration Documentation

Definition of a vehicle state.

Enumerator:
NOTIFICATION_DEPARTED 

The vehicle has departed (was inserted into the network)

NOTIFICATION_JUNCTION 

The vehicle arrived at a junction.

NOTIFICATION_SEGMENT 

The vehicle changes the segment (meso only)

NOTIFICATION_LANE_CHANGE 

The vehicle changes lanes (micro only)

NOTIFICATION_TELEPORT 

The vehicle is being teleported.

NOTIFICATION_PARKING 

The vehicle starts or ends parking.

NOTIFICATION_ARRIVED 

The vehicle arrived at its destination (is deleted)

NOTIFICATION_VAPORIZED 

The vehicle got vaporized.

NOTIFICATION_TELEPORT_ARRIVED 

The vehicle was teleported out of the net.

Definition at line 93 of file MSMoveReminder.h.

Constructor & Destructor Documentation

MSInstantInductLoop::MSInstantInductLoop ( const std::string &  id,
OutputDevice od,
MSLane *const  lane,
SUMOReal  positionInMeters 
)

Constructor.

Parameters
[in]idUnique id
[in]odThe device to write to
[in]laneLane where detector woks on.
[in]positionPosition of the detector within the lane.

Definition at line 54 of file MSInstantInductLoop.cpp.

References myPosition, and writeXMLDetectorProlog().

MSInstantInductLoop::~MSInstantInductLoop ( )

Destructor.

Definition at line 63 of file MSInstantInductLoop.cpp.

MSInstantInductLoop::MSInstantInductLoop ( const MSInstantInductLoop )
private

Invalidated copy constructor.

Member Function Documentation

virtual GUIDetectorWrapper* MSDetectorFileOutput::buildDetectorGUIRepresentation ( )
inlinevirtualinherited

Builds the graphical representation.

Meant to be overridden by graphical versions of the detectors

Returns
A wrapper for the detector which performs the user I/O within the GUI

Reimplemented in GUI_E2_ZS_Collector, GUIInductLoop, GUIE3Collector, GUI_E2_ZS_CollectorOverLanes, and GUIInstantInductLoop.

Definition at line 123 of file MSDetectorFileOutput.h.

virtual void MSDetectorFileOutput::detectorUpdate ( const SUMOTime  step)
inlinevirtualinherited

Updates the detector (computes values)

Parameters
[in]stepThe current time step

Reimplemented in MSMeanData, MSE3Collector, MSMeanData_Harmonoise, and MSE2Collector.

Definition at line 113 of file MSDetectorFileOutput.h.

References UNUSED_PARAMETER.

const std::string& Named::getID ( ) const
inlineinherited

Returns the id.

Returns
The stored 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(), MSE3Collector::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(), MSE3Collector::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(), 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().

bool MSInstantInductLoop::notifyEnter ( SUMOVehicle veh,
MSMoveReminder::Notification  reason 
)
virtual

Returns whether the detector may has to be concerned during the vehicle's further movement.

If the detector is in front of the vehicle, true is returned. If the vehicle's front has passed the detector, false, because the vehicle is no longer relevant for the detector.

Parameters
[in]vehThe entering vehicle.
[in]reasonhow the vehicle enters the lane
Returns
True if vehicle is on or in front of the detector.
See Also
MSMoveReminder
MSMoveReminder::notifyEnter
MSMoveReminder::Notification

Reimplemented from MSMoveReminder.

Definition at line 138 of file MSInstantInductLoop.cpp.

References MSVehicleType::getLength(), SUMOVehicle::getPositionOnLane(), SUMOVehicle::getVehicleType(), and myPosition.

bool MSInstantInductLoop::notifyLeave ( SUMOVehicle veh,
SUMOReal  lastPos,
MSMoveReminder::Notification  reason 
)
virtual

Dismisses the vehicle if it is on the detector due to a lane change.

If the vehicle is on the detector, it will be dismissed by incrementing myDismissedVehicleNumber and removing this vehicle's entering time from myVehiclesOnDet.

Parameters
[in]vehThe leaving vehicle.
[in]lastPosPosition on the lane when leaving.
[in]isArrivalwhether the vehicle arrived at its destination
[in]isLaneChangewhether the vehicle changed from the lane
See Also
leaveDetectorByLaneChange
MSMoveReminder
MSMoveReminder::notifyLeave

Reimplemented from MSMoveReminder.

Definition at line 124 of file MSInstantInductLoop.cpp.

References MSNet::getInstance(), SUMOVehicle::getSpeed(), myEntryTimes, MSMoveReminder::NOTIFICATION_JUNCTION, STEPS2TIME, and write().

bool MSInstantInductLoop::notifyMove ( SUMOVehicle veh,
SUMOReal  oldPos,
SUMOReal  newPos,
SUMOReal  newSpeed 
)
virtual

Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.

As soon a vehicle enters the detector, its entry time is computed and stored in myVehiclesOnDet via enterDetectorByMove. If it passes the detector, the according leaving time is computed and stored, too, using leaveDetectorByMove.

Parameters
[in]vehVehicle that asks this remider.
[in]oldPosPosition before move.
[in]newPosPosition after move with newSpeed.
[in]newSpeedMoving speed.
Returns
True if vehicle hasn't passed the detector completely.
See Also
MSMoveReminder
MSMoveReminder::notifyMove
enterDetectorByMove
leaveDetectorByMove

Reimplemented from MSMoveReminder.

Definition at line 68 of file MSInstantInductLoop.cpp.

References MSNet::getInstance(), MSVehicleType::getLength(), SUMOVehicle::getVehicleType(), myEntryTimes, myLastExitTime, myPosition, STEPS2TIME, SUMOReal, and write().

virtual void MSMoveReminder::notifyMoveInternal ( SUMOVehicle veh,
SUMOReal  timeOnLane,
SUMOReal  speed 
)
inlinevirtualinherited

Internal notification about the vehicle moves.

Indicator if the reminders is still active for the passed vehicle/parameters. If false, the vehicle will erase this reminder from it's reminder-container.

Parameters
[in]vehVehicle that asks this reminder.
[in]timeOnLanetime the vehicle spent on the lane.
[in]speedMoving speed.

Reimplemented in MSMeanData::MeanDataValueTracker, MSMeanData_Net::MSLaneMeanDataValues, MSMeanData_Harmonoise::MSLaneMeanDataValues, and MSMeanData_HBEFA::MSLaneMeanDataValues.

Definition at line 200 of file MSMoveReminder.h.

References UNUSED_PARAMETER.

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

Invalidated assignment operator.

virtual void MSDetectorFileOutput::reset ( )
inlinevirtualinherited

Resets collected values.

Please note that this is only a "hack" for coupled-tls-outputs.

See Also
Command_SaveTLCoupledLaneDet
Todo:
Reckeck/refactor

Reimplemented in MSE2Collector, MSE3Collector, MSInductLoop, and GUIInductLoop.

Definition at line 106 of file MSDetectorFileOutput.h.

Referenced by Command_SaveTLCoupledLaneDet::execute().

void Named::setID ( const std::string &  newID)
inlineinherited

resets the id

Definition at line 67 of file Named.h.

References Named::myID.

Referenced by NBNodeCont::rename(), and NBEdgeCont::rename().

void MSInstantInductLoop::write ( const char *  state,
SUMOReal  t,
SUMOVehicle veh,
SUMOReal  speed,
const char *  add = 0,
SUMOReal  addValue = -1 
)
protected

Writes an event line.

Parameters
[in]stateThe current state to report
[in]tThe event time
[in]vehThe vehicle responsible for the event
[in]speedThe speed of the vehicle
[in]addAn optional attribute to report
[in]addValueThe value of the optional attribute

Definition at line 110 of file MSInstantInductLoop.cpp.

References OutputDevice::closeTag(), Named::getID(), SUMOVehicle::getID(), MSVehicleType::getID(), MSVehicleType::getLength(), SUMOVehicle::getVehicleType(), myOutputDevice, OutputDevice::openTag(), toString(), and OutputDevice::writeAttr().

Referenced by notifyLeave(), and notifyMove().

void MSInstantInductLoop::writeXMLDetectorProlog ( OutputDevice dev) const
virtual

Open the XML-output.

The implementing function should open an xml element using OutputDevice::writeXMLHeader.

Parameters
[in]devThe output device to write the root into
Exceptions
IOErrorIf an error on writing occurs

Implements MSDetectorFileOutput.

Definition at line 149 of file MSInstantInductLoop.cpp.

References OutputDevice::writeXMLHeader().

Referenced by MSInstantInductLoop().

void MSInstantInductLoop::writeXMLOutput ( OutputDevice dev,
SUMOTime  startTime,
SUMOTime  stopTime 
)
inlinevirtual

Write the generated output to the given device.

This method is not used - output is written as soon as a vehicle visits the detector.

Parameters
[in]devThe output device to write the data into
[in]startTimeFirst time step the data were gathered
[in]stopTimeLast time step the data were gathered
Exceptions
IOErrorIf an error on writing occurs

Implements MSDetectorFileOutput.

Definition at line 145 of file MSInstantInductLoop.h.

References UNUSED_PARAMETER.

Field Documentation

std::map<SUMOVehicle*, SUMOReal> MSInstantInductLoop::myEntryTimes
protected

The last exit time.

Definition at line 187 of file MSInstantInductLoop.h.

Referenced by notifyLeave(), and notifyMove().

MSLane* const MSMoveReminder::myLane
protectedinherited
SUMOReal MSInstantInductLoop::myLastExitTime
protected

The last exit time.

Definition at line 184 of file MSInstantInductLoop.h.

Referenced by notifyMove().

OutputDevice& MSInstantInductLoop::myOutputDevice
protected

The output device to use.

Definition at line 178 of file MSInstantInductLoop.h.

Referenced by write().

const SUMOReal MSInstantInductLoop::myPosition
protected

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