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

A device which collects info on the vehicle trip (mainly on departure and arrival) More...

#include <MSDevice_Example.h>

Inheritance diagram for MSDevice_Example:
MSDevice MSMoveReminder Named

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...
 
void generateOutput () const
 Called on writing tripinfo output. More...
 
const std::string & getDescription () const
 
SUMOVehiclegetHolder () const
 Returns the vehicle that holds this device. More...
 
const std::string & getID () const
 Returns the id. More...
 
const MSLanegetLane () const
 Returns the lane the reminder works on. More...
 
virtual void notifyMoveInternal (SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
 Internal notification about the vehicle moves. More...
 
void setDescription (const std::string &description)
 
void setID (const std::string &newID)
 resets the id More...
 
 ~MSDevice_Example ()
 Destructor. More...
 
Methods called on vehicle movement / state change, overwriting MSDevice
bool notifyMove (SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
 Checks for waiting steps when the vehicle moves. More...
 
bool notifyEnter (SUMOVehicle &veh, MSMoveReminder::Notification reason)
 Saves departure info on insertion. More...
 
bool notifyLeave (SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
 Saves arrival info. More...
 

Static Public Member Functions

static void buildVehicleDevices (SUMOVehicle &v, std::vector< MSDevice * > &into)
 Build devices for the given vehicle, if needed. More...
 
static void insertOptions (OptionsCont &oc)
 Inserts MSDevice_Example-options. More...
 

Static Protected Member Functions

Helper methods for device assignment
static void insertDefaultAssignmentOptions (const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
 Adds common command options that allow to assign devices to vehicles. More...
 
static bool equippedByDefaultAssignmentOptions (const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
 Determines whether a vehicle should get a certain device. More...
 

Protected Attributes

std::string myDescription
 a description of this moveReminder More...
 
SUMOVehiclemyHolder
 The vehicle that stores the device. More...
 
std::string myID
 The name of the object. More...
 
MSLane *const myLane
 Lane on which the reminder works. More...
 

Private Member Functions

 MSDevice_Example (SUMOVehicle &holder, const std::string &id, SUMOReal customValue1, SUMOReal customValue2, SUMOReal customValue3)
 Constructor. More...
 
 MSDevice_Example (const MSDevice_Example &)
 Invalidated copy constructor. More...
 
MSDevice_Exampleoperator= (const MSDevice_Example &)
 Invalidated assignment operator. More...
 

Private Attributes

SUMOReal myCustomValue1
 a value which is initialised based on a commandline/configuration option More...
 
SUMOReal myCustomValue2
 a value which is initialised based on a vehicle parameter More...
 
SUMOReal myCustomValue3
 a value which is initialised based on a vType parameter More...
 

Detailed Description

A device which collects info on the vehicle trip (mainly on departure and arrival)

Each device collects departure time, lane and speed and the same for arrival.

See Also
MSDevice

Definition at line 54 of file MSDevice_Example.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 94 of file MSMoveReminder.h.

Constructor & Destructor Documentation

MSDevice_Example::~MSDevice_Example ( )

Destructor.

Definition at line 115 of file MSDevice_Example.cpp.

MSDevice_Example::MSDevice_Example ( SUMOVehicle holder,
const std::string &  id,
SUMOReal  customValue1,
SUMOReal  customValue2,
SUMOReal  customValue3 
)
private

Constructor.

Parameters
[in]holderThe vehicle that holds this device
[in]idThe ID of the device

Definition at line 105 of file MSDevice_Example.cpp.

References myCustomValue1, myCustomValue2, and myCustomValue3.

Referenced by buildVehicleDevices().

MSDevice_Example::MSDevice_Example ( const MSDevice_Example )
private

Invalidated copy constructor.

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

void MSDevice_Example::buildVehicleDevices ( SUMOVehicle v,
std::vector< MSDevice * > &  into 
)
static

Build devices for the given vehicle, if needed.

The options are read and evaluated whether a example-device shall be built for the given vehicle.

The built device is stored in the given vector.

Parameters
[in]vThe vehicle for which a device may be built
filled]into The vector to store the built device in

Definition at line 65 of file MSDevice_Example.cpp.

References TplConvert::_2SUMOReal(), MSDevice::equippedByDefaultAssignmentOptions(), OptionsCont::getFloat(), SUMOVehicle::getID(), OptionsCont::getOptions(), Parameterised::getParameter(), SUMOVehicle::getParameter(), MSVehicleType::getParameter(), SUMOVehicle::getVehicleType(), Parameterised::knowsParameter(), MSDevice_Example(), SUMOReal, and WRITE_WARNING.

Referenced by MSDevice::buildVehicleDevices().

bool MSDevice::equippedByDefaultAssignmentOptions ( const OptionsCont oc,
const std::string &  deviceName,
SUMOVehicle v 
)
staticprotectedinherited
void MSDevice_Example::generateOutput ( ) const
virtual

Called on writing tripinfo output.

Parameters
[in]osThe stream to write the information into
Exceptions
IOErrornot yet implemented
See Also
MSDevice::generateOutput

Reimplemented from MSDevice.

Definition at line 148 of file MSDevice_Example.cpp.

References OutputDevice::closeTag(), OutputDevice::getDeviceByOption(), OptionsCont::getOptions(), myCustomValue1, myCustomValue2, OutputDevice::openTag(), toString(), and OutputDevice::writeAttr().

const std::string& MSMoveReminder::getDescription ( ) const
inlineinherited

Definition at line 213 of file MSMoveReminder.h.

References MSMoveReminder::myDescription.

SUMOVehicle& MSDevice::getHolder ( ) const
inlineinherited

Returns the vehicle that holds this device.

Returns
The vehicle that holds this device

Definition at line 104 of file MSDevice.h.

References MSDevice::myHolder.

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 NIImporter_SUMO::_loadNetwork(), Named::StoringVisitor::add(), TraCIServerAPI_Lane::StoringVisitor::add(), MSDetectorControl::add(), RORouteDef::addAlternative(), MSNet::addBusStop(), NBLoadedSUMOTLDef::addConnection(), NLHandler::addConnection(), RODFDetectorCon::addDetector(), RONet::addEdge(), ROJTREdge::addFollowerProbability(), MSTLLogicControl::TLSLogicVariants::addLogic(), RONet::addNode(), NIImporter_SUMO::addPhase(), RONet::addRouteDef(), NBDistrict::addSink(), NBDistrict::addSource(), NBTrafficLightLogic::addStep(), MSRouteHandler::addStop(), NIXMLTrafficLightsHandler::addTlConnection(), NIVissimDisturbance::addToNode(), MSVehicle::addTraciStop(), MSVehicleTransfer::addVeh(), GUITrafficLightLogicWrapper::begin2TrackPhases(), MSPerson::MSPersonStage_Driving::beginEventOutput(), MSPerson::MSPersonStage_Waiting::beginEventOutput(), NIVisumTL::build(), RODFNet::buildApproachList(), MS_E2_ZS_CollectorOverLanes::buildCollector(), NIImporter_VISUM::buildDistrictNode(), NIVissimConnection::buildEdgeConnections(), RODFNet::buildEdgeFlowMap(), NBEdge::buildInnerEdges(), NGEdge::buildNBEdge(), NIVissimEdge::buildNBEdge(), NBRampsComputer::buildOffRamp(), NBRampsComputer::buildOnRamp(), MSSimpleTrafficLightLogic::changeStepAndDuration(), NBEdge::checkGeometry(), MSVehicleTransfer::checkInsertions(), ODDistrictHandler::closeDistrict(), NLHandler::closeEdge(), RORouteHandler::closeRouteDistribution(), RORouteHandler::closeVehicle(), NBTrafficLightDefinition::collectAllLinks(), NBTrafficLightDefinition::collectEdges(), ROJTRRouter::compute(), NBTrafficLightDefinition::compute(), NBNode::computeInternalLaneShape(), NBEdge::computeLaneShapes(), NBNode::computeLogic(), NBNode::computeNodeShape(), RODFNet::computeRoutesFor(), NBTrafficLightLogicCont::computeSingleLogic(), NBTurningDirectionsComputer::computeTurnDirectionsForNode(), NGNet::connect(), NBEdge::connections_sorter(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), NLDetectorBuilder::convUncontE2PosLength(), GUINet::createTLWrapper(), MSLane::detectCollisions(), NIVissimDistrictConnection::dict_BuildDistricts(), MSPerson::MSPersonStage_Driving::endEventOutput(), MSPerson::MSPersonStage_Waiting::endEventOutput(), MSE3Collector::enter(), MSCalibrator::execute(), Command_SaveTLSState::execute(), Command_SaveTLSSwitchStates::execute(), Command_SaveTLSSwitches::execute(), MSVTypeProbe::execute(), MSVehicle::executeMove(), MSLane::executeMovements(), NBNodeCont::extract(), NBTrafficLightLogicCont::extract(), NBEdgeCont::extract(), RODFDetectorCon::getAggFlowFor(), RODFDetectorCon::getAnyDetectorForEdge(), MSNet::getBusStopID(), RODFNet::getDetectorEdge(), MS_E2_ZS_CollectorOverLanes::getLanePredeccessorLanes(), AGStreet::getName(), NIImporter_VISUM::getNamedEdgeContinuating(), GUIVehicle::getParameterWindow(), GUITrafficLightLogicWrapper::getPopUpMenu(), NLTriggerBuilder::getPosition(), NLDetectorBuilder::getPositionChecking(), NBNode::getPossiblySplittedIncoming(), NBNode::getPossiblySplittedOutgoing(), NIImporter_VISUM::getReversedContinuating(), RODFDetectorCon::guessEmptyFlows(), GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow(), NBEdgeCont::ignoreFilterMatch(), MSActuatedTrafficLightLogic::init(), MSAgentbasedTrafficLightLogic::init(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NBDistrictCont::insert(), NBTrafficLightLogicCont::insert(), NBNodeCont::insert(), NBEdgeCont::insert(), NBNode::invalidateTLS(), MSTLLogicControl::isActive(), RODFNet::isDestination(), RODFNet::isFalseSource(), RODFNet::isSource(), NBEdgeCont::joinSameNodeConnectingEdges(), MSE3Collector::leave(), NIImporter_OpenDrive::loadNetwork(), NBRampsComputer::moveRampRight(), MSCalibrator::MSCalibrator(), 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_BTreceiver::notifyEnter(), MSDevice_Tripinfo::notifyEnter(), MSDevice_BTsender::notifyEnter(), notifyEnter(), MSCalibrator::VehicleRemover::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), MSDevice_Person::notifyLeave(), notifyLeave(), MSDevice_BTreceiver::notifyLeave(), MSDevice_BTsender::notifyLeave(), notifyMove(), MSDevice_BTreceiver::notifyMove(), MSDevice_BTsender::notifyMove(), GUIViewTraffic::onGamingClick(), RORouteHandler::openRoute(), Named::ComparatorIdLess::operator()(), NBTurningDirectionsComputer::combination_by_angle_sorter::operator()(), RODFNet::idComp::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(), MSLCM_JE2013::patchSpeed(), NBLoadedTLDef::SignalGroup::patchTYellow(), AGStreet::print(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Vehicle::processSet(), NWWriter_SUMO::prohibitionConnection(), NBEdgeCont::recheckPostProcessConnections(), NBLoadedTLDef::SignalGroup::remapIncoming(), NBLoadedTLDef::SignalGroup::remapOutgoing(), NBLoadedSUMOTLDef::removeConnection(), MSCalibrator::removePending(), NBNode::removeSelfLoops(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBNodeCont::rename(), NBEdgeCont::rename(), NBConnection::replaceFrom(), MSBaseVehicle::replaceRouteEdges(), NBConnection::replaceTo(), NIImporter_DlrNavteq::TrafficlightsHandler::report(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), RODFNet::revalidateFlows(), PCPolyContainer::save(), RONet::saveAndRemoveRoutesUntil(), MSBaseVehicle::saveState(), NBNodeCont::setAsTLControlled(), NBEdge::setControllingTLInformation(), NIXMLEdgesHandler::setNodes(), NBOwnTLDef::setTLControllingInformation(), NBLoadedSUMOTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), NBEdgeCont::splitAt(), MSLane::succLinkSec(), GUITrafficLightLogicWrapper::switchTLSLogic(), MSDevice_BTreceiver::BTreceiverUpdate::updateVisibility(), TraCIServerAPI_Vehicle::vtdMap_matchingEdgeLane(), TraCIServerAPI_Vehicle::vtdMap_matchingRoutePosition(), MSLCM_JE2013::wantsChange(), MSEmissionExport::write(), MSFCDExport::write(), MSInstantInductLoop::write(), NBSign::writeAsPOI(), NWWriter_SUMO::writeConnection(), NWWriter_SUMO::writeDistrict(), MSFullExport::writeEdge(), MSXMLRawOut::writeEdge(), NWWriter_SUMO::writeEdge(), MSMeanData::writeEdge(), NWWriter_XML::writeEdgesAndConnections(), RODFDetector::writeEmitterDefinition(), RODFDetectorCon::writeEmitterPOIs(), RODFDetectorCon::writeEmitters(), RODFDetectorCon::writeEndRerouterDetectors(), NWWriter_SUMO::writeInternalConnections(), NWWriter_SUMO::writeJunction(), MSQueueExport::writeLane(), MSFullExport::writeLane(), NWWriter_DlrNavteq::writeLinksUnsplitted(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_SUMO::writeRoundabout(), RODFDetectorCon::writeSpeedTrigger(), NWWriter_DlrNavteq::writeTrafficSignals(), MSInductLoop::writeTypedXMLOutput(), RODFDetectorCon::writeValidationDetectors(), MSFullExport::writeVehicles(), MSRouteProbe::writeXMLOutput(), and MSE2Collector::writeXMLOutput().

void MSDevice::insertDefaultAssignmentOptions ( const std::string &  deviceName,
const std::string &  optionsTopic,
OptionsCont oc 
)
staticprotectedinherited

Adds common command options that allow to assign devices to vehicles.

Parameters
[in]deviceNameThe name of the device type
[in]optionsTopicThe options topic into which the options shall be added
filled]oc The options container to add the options to

!! describe

!! describe

!! describe

Definition at line 83 of file MSDevice.cpp.

References OptionsCont::addDescription(), OptionsCont::addSynonyme(), and OptionsCont::doRegister().

Referenced by MSDevice_BTsender::insertOptions(), MSDevice_BTreceiver::insertOptions(), MSDevice_HBEFA::insertOptions(), and MSDevice_Routing::insertOptions().

void MSDevice_Example::insertOptions ( OptionsCont oc)
static

Inserts MSDevice_Example-options.

Parameters
filled]oc The options container to add the options to

Definition at line 53 of file MSDevice_Example.cpp.

References OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), and OptionsCont::doRegister().

Referenced by MSDevice::insertOptions().

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

Saves departure info on insertion.

Parameters
[in]vehThe entering vehicle.
[in]reasonhow the vehicle enters the lane
Returns
Always true
See Also
MSMoveReminder::notifyEnter
MSMoveReminder::Notification

Reimplemented from MSMoveReminder.

Definition at line 133 of file MSDevice_Example.cpp.

References SUMOVehicle::getEdge(), and Named::getID().

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

Saves arrival info.

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
Returns
True if it did not leave the net.

Reimplemented from MSMoveReminder.

Definition at line 140 of file MSDevice_Example.cpp.

References SUMOVehicle::getEdge(), and Named::getID().

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

Checks for waiting steps when the vehicle moves.

Parameters
[in]vehVehicle that asks this reminder.
[in]oldPosPosition before move.
[in]newPosPosition after move with newSpeed.
[in]newSpeedMoving speed.
Returns
True (always).

Reimplemented from MSMoveReminder.

Definition at line 120 of file MSDevice_Example.cpp.

References SUMOVehicle::getDevice(), Named::getID(), and SUMOVehicle::getID().

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 201 of file MSMoveReminder.h.

References UNUSED_PARAMETER.

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

Invalidated assignment operator.

void MSMoveReminder::setDescription ( const std::string &  description)
inlineinherited

Definition at line 209 of file MSMoveReminder.h.

References MSMoveReminder::myDescription.

Referenced by MSCalibrator::MSCalibrator().

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

Field Documentation

SUMOReal MSDevice_Example::myCustomValue1
private

a value which is initialised based on a commandline/configuration option

Definition at line 148 of file MSDevice_Example.h.

Referenced by generateOutput(), and MSDevice_Example().

SUMOReal MSDevice_Example::myCustomValue2
private

a value which is initialised based on a vehicle parameter

Definition at line 151 of file MSDevice_Example.h.

Referenced by generateOutput(), and MSDevice_Example().

SUMOReal MSDevice_Example::myCustomValue3
private

a value which is initialised based on a vType parameter

Definition at line 154 of file MSDevice_Example.h.

Referenced by MSDevice_Example().

std::string MSMoveReminder::myDescription
protectedinherited

a description of this moveReminder

Definition at line 222 of file MSMoveReminder.h.

Referenced by MSMoveReminder::getDescription(), and MSMoveReminder::setDescription().

MSLane* const MSMoveReminder::myLane
protectedinherited

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