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

The gui-version of the MSInstantInductLoop. More...

#include <GUIInstantInductLoop.h>

Inheritance diagram for GUIInstantInductLoop:
MSInstantInductLoop MSMoveReminder MSDetectorFileOutput Named

Data Structures

class  MyWrapper
 A MSInductLoop-visualiser. More...
 

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

void addTo (const StoringVisitor &cont) const
 Adds this object to the given container. More...
 
virtual GUIDetectorWrapperbuildDetectorGUIRepresentation ()
 Returns this detector's visualisation-wrapper. More...
 
const std::string & getID () const
 Returns the id. More...
 
const MSLanegetLane () const
 Returns the lane the reminder works on. More...
 
 GUIInstantInductLoop (const std::string &id, OutputDevice &od, MSLane *const lane, SUMOReal positionInMeters)
 Constructor. More...
 
virtual void notifyMoveInternal (SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
 Internal notification about the vehicle moves. More...
 
void setID (const std::string &newID)
 resets the id More...
 
void writeXMLDetectorProlog (OutputDevice &dev) const
 Open the XML-output. More...
 
void writeXMLOutput (OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
 Write the generated output to the given device. More...
 
 ~GUIInstantInductLoop ()
 Destructor. More...
 
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. More...
 
bool notifyLeave (SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
 Dismisses the vehicle if it is on the detector due to a lane change. More...
 
bool notifyEnter (SUMOVehicle &veh, MSMoveReminder::Notification reason)
 Returns whether the detector may has to be concerned during the vehicle's further movement. More...
 
Virtual methods to implement by derived classes
virtual void reset ()
 Resets collected values. More...
 
virtual void detectorUpdate (const SUMOTime step)
 Updates the detector (computes values) More...
 

Data Fields

MFXMutex myLock
 Mutex preventing parallel read/write access to internal MSInductLoop state. More...
 

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. More...
 

Protected Attributes

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

Detailed Description

The gui-version of the MSInstantInductLoop.

Definition at line 52 of file GUIInstantInductLoop.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

GUIInstantInductLoop::GUIInstantInductLoop ( 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 56 of file GUIInstantInductLoop.cpp.

GUIInstantInductLoop::~GUIInstantInductLoop ( )

Destructor.

Definition at line 61 of file GUIInstantInductLoop.cpp.

Member Function Documentation

void Named::addTo ( const StoringVisitor cont) const
inlineinherited

Adds this object to the given container.

Parameters
in,filled]cont The container to add this item to

Definition at line 114 of file Named.h.

References Named::StoringVisitor::add().

GUIDetectorWrapper * GUIInstantInductLoop::buildDetectorGUIRepresentation ( )
virtual

Returns this detector's visualisation-wrapper.

Returns
The wrapper representing the detector

Reimplemented from MSDetectorFileOutput.

Definition at line 65 of file GUIInstantInductLoop.cpp.

References MSMoveReminder::getLane(), and MSInstantInductLoop::myPosition.

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

Definition at line 60 of file Named.h.

References Named::myID.

Referenced by Named::StoringVisitor::add(), MSDetectorControl::add(), RORouteDef::addAlternative(), MSNet::addBusStop(), NBLoadedSUMOTLDef::addConnection(), NLHandler::addConnection(), NIImporter_OpenDrive::addE2EConnectionsSecure(), RONet::addNode(), NIImporter_SUMO::addPhase(), RONet::addRouteDef(), NBDistrict::addSink(), NBDistrict::addSource(), NBTrafficLightLogic::addStep(), MSRouteHandler::addStop(), NIXMLTrafficLightsHandler::addTlConnection(), NIVissimDisturbance::addToNode(), MSVehicle::addTraciStop(), MSPerson::MSPersonStage_Driving::beginEventOutput(), MSPerson::MSPersonStage_Waiting::beginEventOutput(), NIVisumTL::build(), MS_E2_ZS_CollectorOverLanes::buildCollector(), NIImporter_VISUM::buildDistrictNode(), NIVissimConnection::buildEdgeConnections(), NBEdge::buildInnerEdges(), NIVissimEdge::buildNBEdge(), NBRampsComputer::buildOffRamp(), NBRampsComputer::buildOnRamp(), MSVehicleTransfer::checkInsertions(), ODDistrictHandler::closeDistrict(), NLHandler::closeEdge(), RORouteHandler::closeRouteDistribution(), 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(), MSPerson::MSPersonStage_Driving::endEventOutput(), MSPerson::MSPersonStage_Waiting::endEventOutput(), MSE3Collector::enter(), Command_SaveTLSSwitches::execute(), MSVTypeProbe::execute(), NBNodeCont::extract(), NBTrafficLightLogicCont::extract(), NBEdgeCont::extract(), MSNet::getBusStopID(), MS_E2_ZS_CollectorOverLanes::getLanePredeccessorLanes(), 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(), MSVehicle::moveChecked(), NBRampsComputer::moveRampRight(), MSPerson::MSPersonStage_Waiting::MSPersonStage_Waiting(), MSVehicle::MSVehicle(), 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(), MSDevice_Person::notifyLeave(), RORouteHandler::openRoute(), 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()(), MSEdge::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(), RORDLoader_SUMOBase::parseRoute(), NBLoadedTLDef::SignalGroup::patchTYellow(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Vehicle::processGet(), NWWriter_SUMO::prohibitionConnection(), NBEdgeCont::recheckPostProcessConnections(), NBLoadedTLDef::SignalGroup::remapIncoming(), NBLoadedTLDef::SignalGroup::remapOutgoing(), NBLoadedSUMOTLDef::removeConnection(), NBNode::removeSelfLoops(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBNodeCont::rename(), NBEdgeCont::rename(), NBConnection::replaceFrom(), MSBaseVehicle::replaceRouteEdges(), NBConnection::replaceTo(), NIImporter_DlrNavteq::TrafficlightsHandler::report(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), PCPolyContainer::save(), RONet::saveAndRemoveRoutesUntil(), NBNodeCont::setAsTLControlled(), NBEdge::setControllingTLInformation(), MSLane::setCritical(), NIXMLEdgesHandler::setNodes(), NBOwnTLDef::setTLControllingInformation(), NBLoadedSUMOTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), NBEdgeCont::splitAt(), RORDLoader_SUMOBase::startRoute(), NBEdge::startShapeAt(), NIXMLConnectionsHandler::validateLaneInfo(), MSEmissionExport::write(), MSInstantInductLoop::write(), NBSign::writeAsPOI(), NWWriter_SUMO::writeConnection(), NWWriter_SUMO::writeDistrict(), MSFullExport::writeEdge(), MSXMLRawOut::writeEdge(), NWWriter_SUMO::writeEdge(), MSMeanData::writeEdge(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeInternalConnections(), NWWriter_SUMO::writeJunction(), MSQueueExport::writeLane(), MSFullExport::writeLane(), NWWriter_DlrNavteq::writeLinksUnsplitted(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), MSInductLoop::writeTypedXMLOutput(), MSFullExport::writeVehicles(), MSRouteProbe::writeXMLOutput(), and MSE2Collector::writeXMLOutput().

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

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 MSInstantInductLoop::myPosition.

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

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(), MSInstantInductLoop::myEntryTimes, MSMoveReminder::NOTIFICATION_JUNCTION, STEPS2TIME, and MSInstantInductLoop::write().

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

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(), MSInstantInductLoop::myEntryTimes, MSInstantInductLoop::myLastExitTime, MSInstantInductLoop::myPosition, STEPS2TIME, SUMOReal, and MSInstantInductLoop::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.

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

Parameters
[in]newIDThe new id of this object

Definition at line 68 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 
)
protectedinherited

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(), MSInstantInductLoop::myOutputDevice, OutputDevice::openTag(), toString(), and OutputDevice::writeAttr().

Referenced by MSInstantInductLoop::notifyLeave(), and MSInstantInductLoop::notifyMove().

void MSInstantInductLoop::writeXMLDetectorProlog ( OutputDevice dev) const
virtualinherited

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

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

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
protectedinherited

The last exit time.

Definition at line 187 of file MSInstantInductLoop.h.

Referenced by MSInstantInductLoop::notifyLeave(), and MSInstantInductLoop::notifyMove().

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

The last exit time.

Definition at line 184 of file MSInstantInductLoop.h.

Referenced by MSInstantInductLoop::notifyMove().

MFXMutex GUIInstantInductLoop::myLock
mutable

Mutex preventing parallel read/write access to internal MSInductLoop state.

Definition at line 153 of file GUIInstantInductLoop.h.

OutputDevice& MSInstantInductLoop::myOutputDevice
protectedinherited

The output device to use.

Definition at line 178 of file MSInstantInductLoop.h.

Referenced by MSInstantInductLoop::write().


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