SUMO - Simulation of Urban MObility
|
A device that performs vehicle rerouting based on current edge speeds. More...
#include <MSDevice_Routing.h>
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 | |
virtual void | generateOutput () const |
Called on writing tripinfo output. | |
SUMOVehicle & | getHolder () const |
Returns the vehicle that holds this device. | |
const std::string & | getID () const |
Returns the id. | |
const MSLane * | getLane () const |
Returns the lane the reminder works on. | |
virtual void | notifyMoveInternal (SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed) |
Internal notification about the vehicle moves. | |
void | setID (const std::string &newID) |
resets the id | |
~MSDevice_Routing () | |
Destructor. | |
Methods called on vehicle movement / state change, overwriting MSDevice | |
bool | notifyEnter (SUMOVehicle &veh, MSMoveReminder::Notification reason) |
Computes a new route on vehicle insertion. | |
Interface methods, to be derived by subclasses | |
virtual bool | notifyMove (SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed) |
Checks whether the reminder still has to be notified about the vehicle moves. | |
virtual bool | notifyLeave (SUMOVehicle &veh, SUMOReal lastPos, Notification reason) |
Called if the vehicle leaves the reminder's lane. |
Static Public Member Functions | |
static void | buildVehicleDevices (SUMOVehicle &v, std::vector< MSDevice * > &into) |
Build devices for the given vehicle, if needed. | |
static void | insertOptions () |
Inserts MSDevice_Routing-options. |
Protected Attributes | |
SUMOVehicle & | myHolder |
The vehicle that stores the device. | |
std::string | myID |
The name of the object. | |
MSLane *const | myLane |
Lane on which the reminder works. |
Private Member Functions | |
SUMOReal | getEffort (const MSEdge *const e, const SUMOVehicle *const v, SUMOReal t) const |
Returns the effort to pass an edge. | |
MSDevice_Routing (SUMOVehicle &holder, const std::string &id, SUMOTime period, SUMOTime preInsertionPeriod) | |
Constructor. | |
MSDevice_Routing (const MSDevice_Routing &) | |
Invalidated copy constructor. | |
MSDevice_Routing & | operator= (const MSDevice_Routing &) |
Invalidated assignment operator. | |
SUMOTime | preInsertionReroute (SUMOTime currentTime) |
Performs rerouting at insertion into the network. | |
SUMOTime | wrappedRerouteCommandExecute (SUMOTime currentTime) |
Performs rerouting after a period. |
Static Private Member Functions | |
Network state adaptation | |
static SUMOTime | adaptEdgeEfforts (SUMOTime currentTime) |
Adapt edge efforts by the current edge states. |
Private Attributes | |
SUMOTime | myPeriod |
The period with which a vehicle shall be rerouted. | |
SUMOTime | myPreInsertionPeriod |
The period with which a vehicle shall be rerouted before insertion. | |
WrappingCommand < MSDevice_Routing > * | myRerouteCommand |
The (optional) command responsible for rerouting. |
Static Private Attributes | |
static SUMOTime | myAdaptationInterval |
Information which weight prior edge efforts have. | |
static SUMOReal | myAdaptationWeight |
Information which weight prior edge efforts have. | |
static std::map< std::pair < const MSEdge *, const MSEdge * > , const MSRoute * > | myCachedRoutes |
The container of pre-calculated routes. | |
static std::map< const MSEdge *, SUMOReal > | myEdgeEfforts |
The container of edge efforts. | |
static Command * | myEdgeWeightSettingCommand = 0 |
The weights adaptation/overwriting command. | |
static bool | myWithTaz |
whether taz shall be used at initial rerouting |
A device that performs vehicle rerouting based on current edge speeds.
The routing-device system consists of in-vehicle devices that perform a routing and a simulation-wide (static) methods for colecting edge weights.
The edge weights container "myEdgeEfforts" is pre-initialised as soon as one device is built and is kept updated via an event that adapts it to the current mean speed on the simulated network's edges.
A device is assigned to a vehicle using the common explicit/probability - procedure.
A device computes a new route for a vehicle as soon as the vehicle is inserted (within "enterLaneAtInsertion") - and, if the given period is larger than 0 - each x time steps where x is the period. This is triggered by an event that executes "wrappedRerouteCommandExecute".
Definition at line 70 of file MSDevice_Routing.h.
|
inherited |
Definition of a vehicle state.
Definition at line 93 of file MSMoveReminder.h.
MSDevice_Routing::~MSDevice_Routing | ( | ) |
Destructor.
Definition at line 174 of file MSDevice_Routing.cpp.
References WrappingCommand< T >::deschedule(), and myRerouteCommand.
|
private |
Constructor.
[in] | holder | The vehicle that holds this device |
[in] | id | The ID of the device |
[in] | period | The period with which a new route shall be searched |
[in] | preInsertionPeriod | The route search period before insertion |
Definition at line 162 of file MSDevice_Routing.cpp.
References MSEventControl::ADAPT_AFTER_EXECUTION, MSEventControl::addEvent(), SUMOVehicleParameter::depart, MSNet::getInsertionEvents(), MSNet::getInstance(), SUMOVehicle::getParameter(), myRerouteCommand, myWithTaz, and preInsertionReroute().
Referenced by buildVehicleDevices().
|
private |
Invalidated copy constructor.
Adapt edge efforts by the current edge states.
This method is called by the event handler at the end of a simulation step. The current edge weights are combined with the previously stored.
[in] | currentTime | The current simulation time |
Definition at line 245 of file MSDevice_Routing.cpp.
References MSNet::getEdgeControl(), MSEdgeControl::getEdges(), MSNet::getInstance(), myAdaptationInterval, myAdaptationWeight, myCachedRoutes, myEdgeEfforts, and SUMOReal.
Referenced by buildVehicleDevices().
|
static |
Build devices for the given vehicle, if needed.
The options are read and evaluated whether rerouting-devices shall be built for the given vehicle.
When the first device is built, the static container of edge weights used for routing is initialised with the mean speed the edges allow. In addition, an event is generated which updates these weights is built and added to the list of events to execute at a simulation end.
For each seen vehicle, the global vehicle index is increased.
The built device is stored in the given vector.
[in] | v | The vehicle for which a device may be built |
in,filled] | into The vector to store the built device in |
Definition at line 108 of file MSDevice_Routing.cpp.
References MSEventControl::ADAPT_AFTER_EXECUTION, adaptEdgeEfforts(), MSEventControl::addEvent(), MSEdge::dictionary(), SUMOVehicleParameter::fromTaz, OptionsCont::getBool(), MSNet::getEdgeControl(), MSEdgeControl::getEdges(), MSNet::getEndOfTimestepEvents(), OptionsCont::getFloat(), SUMOVehicle::getID(), MSNet::getInstance(), OptionsCont::getOptions(), SUMOVehicle::getParameter(), OptionsCont::getString(), MSNet::getVehicleControl(), MSVehicleControl::isInQuota(), OptionsCont::isInStringVector(), OptionsCont::isSet(), MSDevice_Routing(), myAdaptationInterval, myAdaptationWeight, myEdgeEfforts, myEdgeWeightSettingCommand, myWithTaz, RandHelper::rand(), string2time(), SUMOVehicleParameter::toTaz, VEHPARS_FORCE_REROUTE, SUMOVehicleParameter::wasSet(), and WRITE_ERROR.
Referenced by MSBaseVehicle::MSBaseVehicle().
|
inlinevirtualinherited |
Called on writing tripinfo output.
The device may write some statistics into the tripinfo output. It is assumed that the written information is a valid xml-snipplet, which will be embedded within the vehicle's information.
The device should use the openTag / closeTag methods of the OutputDevice for correct indentation.
[in] | os | The stream to write the information into |
IOError | not yet implemented |
Reimplemented in MSDevice_Tripinfo, MSDevice_HBEFA, and MSDevice_Vehroutes.
Definition at line 102 of file MSDevice.h.
|
private |
Returns the effort to pass an edge.
This method is given to the used router in order to obtain the efforts to pass an edge from the internal edge weights container.
The time is not used, here, as the current simulation state is used in an aggregated way.
[in] | e | The edge for which the effort to be passed shall be returned |
[in] | v | The vehicle that is rerouted |
[in] | t | The time for which the effort shall be returned |
Definition at line 236 of file MSDevice_Routing.cpp.
References MSEdge::getLength(), SUMOVehicle::getMaxSpeed(), MAX2(), and myEdgeEfforts.
Referenced by preInsertionReroute(), and wrappedRerouteCommandExecute().
|
inlineinherited |
Returns the vehicle that holds this device.
Definition at line 85 of file MSDevice.h.
References MSDevice::myHolder.
|
inlineinherited |
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(), 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(), 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().
|
inlineinherited |
Returns the lane the reminder works on.
Definition at line 87 of file MSMoveReminder.h.
References MSMoveReminder::myLane.
Referenced by GUIInstantInductLoop::buildDetectorGUIRepresentation(), GUIInductLoop::buildDetectorGUIRepresentation(), MSE2Collector::detectorUpdate(), GUI_E2_ZS_Collector::MyWrapper::MyWrapper(), MSDevice_Tripinfo::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), TraCIServerAPI_InductionLoop::processGet(), and MSMeanData::writeEdge().
|
static |
Inserts MSDevice_Routing-options.
Definition at line 66 of file MSDevice_Routing.cpp.
References OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), OptionsCont::addSynonyme(), OptionsCont::doRegister(), OptionsCont::getOptions(), myEdgeEfforts, and myEdgeWeightSettingCommand.
Referenced by MSFrame::fillOptions().
|
virtual |
Computes a new route on vehicle insertion.
A new route is computed by calling the vehicle's "reroute" method, supplying "getEffort" as the edge effort retrieval method.
If the reroute period is larger than 0, an event is generated and added to the list of simulation step begin events which executes "wrappedRerouteCommandExecute".
[in] | veh | The entering vehicle. |
[in] | reason | how the vehicle enters the lane |
Reimplemented from MSMoveReminder.
Definition at line 183 of file MSDevice_Routing.cpp.
References MSEventControl::ADAPT_AFTER_EXECUTION, MSEventControl::addEvent(), WrappingCommand< T >::deschedule(), MSNet::getBeginOfTimestepEvents(), MSNet::getInstance(), myPeriod, myPreInsertionPeriod, myRerouteCommand, myWithTaz, MSMoveReminder::NOTIFICATION_DEPARTED, and wrappedRerouteCommandExecute().
|
inlinevirtualinherited |
Called if the vehicle leaves the reminder's lane.
Informs if vehicle leaves reminder lane (due to lane change, removal from the network, or leaving to the next lane). The default is to do nothing.
[in] | veh | The leaving vehicle. |
[in] | lastPos | Position on the lane when leaving. |
[in] | reason | how the vehicle leaves the lane |
Reimplemented in MSMeanData::MeanDataValueTracker, MSE2Collector, MSInductLoop, MSMeanData::MeanDataValues, MSInstantInductLoop, MSE3Collector::MSE3EntryReminder, MSMeanData_Net::MSLaneMeanDataValues, MSDevice_Person, MSDevice_Tripinfo, and MSDevice_Vehroutes.
Definition at line 173 of file MSMoveReminder.h.
References UNUSED_PARAMETER.
|
inlinevirtualinherited |
Checks whether the reminder still has to be notified 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.
[in] | veh | Vehicle that asks this reminder. |
[in] | oldPos | Position before move. |
[in] | newPos | Position after move with newSpeed. |
[in] | newSpeed | Moving speed. |
Reimplemented in MSE3Collector::MSE3LeaveReminder, MSE2Collector, MSInductLoop, MSMeanData::MeanDataValues, MSDevice_HBEFA, MSE3Collector::MSE3EntryReminder, MSInstantInductLoop, MSDevice_Person, and MSDevice_Tripinfo.
Definition at line 148 of file MSMoveReminder.h.
References UNUSED_PARAMETER.
|
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.
[in] | veh | Vehicle that asks this reminder. |
[in] | timeOnLane | time the vehicle spent on the lane. |
[in] | speed | Moving 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.
|
private |
Invalidated assignment operator.
Performs rerouting at insertion into the network.
A new route is computed by calling the vehicle's "reroute" method, supplying "getEffort" as the edge effort retrieval method.
[in] | currentTime | The current simulation time |
Definition at line 207 of file MSDevice_Routing.cpp.
References MSRoute::addReference(), MSEdge::dictionary(), MSEdge::dictSize(), SUMOVehicleParameter::fromTaz, getEffort(), SUMOVehicle::getParameter(), SUMOVehicle::getRoute(), myCachedRoutes, MSDevice::myHolder, myPreInsertionPeriod, SUMOVehicle::replaceRoute(), SUMOVehicle::reroute(), and SUMOVehicleParameter::toTaz.
Referenced by MSDevice_Routing().
|
inlineinherited |
resets the id
Definition at line 67 of file Named.h.
References Named::myID.
Referenced by NBNodeCont::rename(), and NBEdgeCont::rename().
Performs rerouting after a period.
A new route is computed by calling the vehicle's "reroute" method, supplying "getEffort" as the edge effort retrieval method.
This method is called from the event handler at the begin of a simulation step after the rerouting period is over. The reroute period is returned.
[in] | currentTime | The current simulation time |
Definition at line 227 of file MSDevice_Routing.cpp.
References MSEdge::dictSize(), getEffort(), MSDevice::myHolder, myPeriod, and SUMOVehicle::reroute().
Referenced by notifyEnter().
|
staticprivate |
Information which weight prior edge efforts have.
Definition at line 225 of file MSDevice_Routing.h.
Referenced by adaptEdgeEfforts(), and buildVehicleDevices().
|
staticprivate |
Information which weight prior edge efforts have.
Definition at line 222 of file MSDevice_Routing.h.
Referenced by adaptEdgeEfforts(), and buildVehicleDevices().
|
staticprivate |
The container of pre-calculated routes.
Definition at line 231 of file MSDevice_Routing.h.
Referenced by adaptEdgeEfforts(), and preInsertionReroute().
The container of edge efforts.
Definition at line 219 of file MSDevice_Routing.h.
Referenced by adaptEdgeEfforts(), buildVehicleDevices(), getEffort(), and insertOptions().
|
staticprivate |
The weights adaptation/overwriting command.
Definition at line 216 of file MSDevice_Routing.h.
Referenced by buildVehicleDevices(), and insertOptions().
|
protectedinherited |
The vehicle that stores the device.
Definition at line 108 of file MSDevice.h.
Referenced by MSDevice_Vehroutes::addRoute(), MSDevice_Vehroutes::generateOutput(), MSDevice_Tripinfo::generateOutput(), MSDevice::getHolder(), MSDevice_Tripinfo::notifyLeave(), preInsertionReroute(), wrappedRerouteCommandExecute(), MSDevice_Vehroutes::writeXMLRoute(), and MSDevice_Vehroutes::~MSDevice_Vehroutes().
|
protectedinherited |
The name of the object.
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(), MSE3Collector::writeXMLOutput(), and MSMeanData::writeXMLOutput().
|
protectedinherited |
Lane on which the reminder works.
Definition at line 215 of file MSMoveReminder.h.
Referenced by MSE2Collector::detectorUpdate(), MSMoveReminder::getLane(), MSE2Collector::MSE2Collector(), and MSMoveReminder::MSMoveReminder().
|
private |
The period with which a vehicle shall be rerouted.
Definition at line 207 of file MSDevice_Routing.h.
Referenced by notifyEnter(), and wrappedRerouteCommandExecute().
|
private |
The period with which a vehicle shall be rerouted before insertion.
Definition at line 210 of file MSDevice_Routing.h.
Referenced by notifyEnter(), and preInsertionReroute().
|
private |
The (optional) command responsible for rerouting.
Definition at line 213 of file MSDevice_Routing.h.
Referenced by MSDevice_Routing(), notifyEnter(), and ~MSDevice_Routing().
|
staticprivate |
whether taz shall be used at initial rerouting
Definition at line 228 of file MSDevice_Routing.h.
Referenced by buildVehicleDevices(), MSDevice_Routing(), and notifyEnter().