SUMO - Simulation of Urban MObility
|
The base class for microscopic and mesoscopic vehicles. More...
#include <MSBaseVehicle.h>
Public Member Functions | |
virtual void | activateReminders (const MSMoveReminder::Notification reason) |
"Activates" all current move reminder More... | |
virtual void | addPerson (MSPerson *person) |
Adds a person to this vehicle. More... | |
void | addReminder (MSMoveReminder *rem) |
Adds a MoveReminder dynamically. More... | |
virtual bool | addStop (const SUMOVehicleParameter::Stop &stopPar, SUMOTime untilOffset=0)=0 |
Adds a stop. More... | |
virtual SUMOReal | getAcceleration () const |
Returns the vehicle's acceleration. More... | |
SUMOReal | getChosenSpeedFactor () const |
Returns the precomputed factor by which the driver wants to be faster than the speed limit. More... | |
SUMOTime | getDeparture () const |
Returns this vehicle's real departure time. More... | |
const std::vector< MSDevice * > & | getDevices () const |
Returns this vehicle's devices. More... | |
const MSEdge * | getEdge () const |
Returns the edge the vehicle is currently at. More... | |
const std::string & | getID () const |
Returns the name of the vehicle. More... | |
SUMOReal | getMaxSpeed () const |
Returns the maximum speed. More... | |
unsigned int | getNumberReroutes () const |
Returns the number of new routes this vehicle got. More... | |
const SUMOVehicleParameter & | getParameter () const |
Returns the vehicle's parameter (including departure definition) More... | |
virtual SUMOReal | getPositionOnLane () const =0 |
Get the vehicle's position along the lane. More... | |
const MSRoute & | getRoute () const |
Returns the current route. More... | |
virtual SUMOReal | getSpeed () const =0 |
Returns the vehicle's current speed. More... | |
const MSVehicleType & | getVehicleType () const |
Returns the vehicle's type definition. More... | |
virtual bool | hasArrived () const |
Returns whether this vehicle has already arived (by default this is true if the vehicle has reached its final edge) More... | |
bool | hasDeparted () const |
Returns whether this vehicle has already departed. More... | |
bool | hasValidRoute (std::string &msg) const |
Validates the current route. More... | |
virtual bool | isOnRoad () const |
Returns the information whether the vehicle is on a road (is simulated) More... | |
virtual bool | isStopped () const =0 |
Returns whether the vehicle is at a stop. More... | |
MSBaseVehicle (SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, SUMOReal speedFactor) | |
Constructor. More... | |
void | onDepart () |
Called when the vehicle is inserted into the network. More... | |
void | removeReminder (MSMoveReminder *rem) |
Removes a MoveReminder dynamically. More... | |
virtual bool | replaceRoute (const MSRoute *route, bool onInit=false)=0 |
Replaces the current route by the given one. More... | |
bool | replaceRouteEdges (const MSEdgeVector &edges, bool onInit=false) |
Replaces the current route by the given edges. More... | |
void | reroute (SUMOTime t, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, bool withTaz=false) |
Performs a rerouting using the given router. More... | |
const MSEdge * | succEdge (unsigned int nSuccs) const |
Returns the nSuccs'th successor of edge the vehicle is currently at. More... | |
virtual | ~MSBaseVehicle () |
Destructor. More... | |
Protected Member Functions | |
void | calculateArrivalPos () |
(Re-)Calculates the arrival position from the vehicle parameters More... | |
Protected Attributes | |
SUMOReal | myArrivalPos |
the position on the destination lane where the vehicle stops More... | |
SUMOReal | myChosenSpeedFactor |
A precomputed factor by which the driver wants to be faster than the speed limit. More... | |
MSRouteIterator | myCurrEdge |
Iterator to current route-edge. More... | |
SUMOTime | myDeparture |
The real departure time. More... | |
std::vector< MSDevice * > | myDevices |
The devices this vehicle has. More... | |
unsigned int | myNumberReroutes |
The number of reroutings. More... | |
const SUMOVehicleParameter * | myParameter |
This Vehicle's parameter. More... | |
const MSRoute * | myRoute |
This Vehicle's route. More... | |
const MSVehicleType * | myType |
This Vehicle's type. More... | |
Static Private Attributes | |
static const SUMOTime | NOT_YET_DEPARTED = SUMOTime_MAX |
Move reminder structures | |
typedef std::vector< std::pair < MSMoveReminder *, SUMOReal > > | MoveReminderCont |
Definition of a move reminder container. More... | |
MoveReminderCont | myMoveReminders |
Current lane's move reminder. More... | |
The base class for microscopic and mesoscopic vehicles.
Definition at line 56 of file MSBaseVehicle.h.
|
protected |
Definition of a move reminder container.
Definition at line 266 of file MSBaseVehicle.h.
MSBaseVehicle::MSBaseVehicle | ( | SUMOVehicleParameter * | pars, |
const MSRoute * | route, | ||
const MSVehicleType * | type, | ||
SUMOReal | speedFactor | ||
) |
Constructor.
[in] | pars | The vehicle description |
[in] | route | The vehicle's route |
[in] | type | The vehicle's type |
[in] | speedFactor | The factor for driven lane's speed limits |
ProcessError | If a value is wrong |
Definition at line 60 of file MSBaseVehicle.cpp.
References MSRoute::addReference(), MSDevice_Tripinfo::buildVehicleDevices(), MSDevice_Vehroutes::buildVehicleDevices(), MSDevice_HBEFA::buildVehicleDevices(), MSDevice_Routing::buildVehicleDevices(), calculateArrivalPos(), myDevices, myMoveReminders, and myRoute.
|
virtual |
Destructor.
Definition at line 83 of file MSBaseVehicle.cpp.
References myDevices, myParameter, myRoute, and MSRoute::release().
|
virtual |
"Activates" all current move reminder
For all move reminder stored in "myMoveReminders", their method "MSMoveReminder::notifyEnter" is called.
[in] | reason | The reason for changing the reminders' states |
Reimplemented in MSVehicle.
Definition at line 255 of file MSBaseVehicle.cpp.
References myMoveReminders.
|
virtual |
Adds a person to this vehicle.
The default implementation does nothing since persons are not supported by default
[in] | person | The person to add |
Implements SUMOVehicle.
Reimplemented in MSVehicle.
Definition at line 211 of file MSBaseVehicle.cpp.
void MSBaseVehicle::addReminder | ( | MSMoveReminder * | rem | ) |
Adds a MoveReminder dynamically.
[in] | rem | the reminder to add |
Definition at line 238 of file MSBaseVehicle.cpp.
References myMoveReminders.
Referenced by MSVehicle::adaptLaneEntering2MoveReminder(), MSVehicle::enterLaneAtInsertion(), and MSVehicle::enterLaneAtLaneChange().
|
pure virtualinherited |
Adds a stop.
The stop is put into the sorted list.
[in] | stop | The stop to add |
Implemented in MSVehicle.
|
protected |
(Re-)Calculates the arrival position from the vehicle parameters
Definition at line 267 of file MSBaseVehicle.cpp.
References ARRIVAL_POS_GIVEN, ARRIVAL_POS_RANDOM, SUMOVehicleParameter::arrivalPos, SUMOVehicleParameter::arrivalPosProcedure, getID(), MSEdge::getLanes(), MSRoute::getLastEdge(), MAX2(), MIN2(), myArrivalPos, myParameter, myRoute, RandHelper::rand(), SUMOReal, and WRITE_WARNING.
Referenced by MSBaseVehicle(), and MSVehicle::replaceRoute().
|
virtual |
Returns the vehicle's acceleration.
This default implementation returns always 0.
Implements SUMOVehicle.
Reimplemented in MSVehicle.
Definition at line 187 of file MSBaseVehicle.cpp.
|
inlinevirtual |
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
Implements SUMOVehicle.
Definition at line 236 of file MSBaseVehicle.h.
References myChosenSpeedFactor.
Referenced by GUIVehicle::getParameterWindow().
|
inlinevirtual |
Returns this vehicle's real departure time.
Implements SUMOVehicle.
Definition at line 166 of file MSBaseVehicle.h.
References myDeparture.
|
inlinevirtual |
Returns this vehicle's devices.
Implements SUMOVehicle.
Definition at line 189 of file MSBaseVehicle.h.
References myDevices.
|
virtual |
Returns the edge the vehicle is currently at.
Implements SUMOVehicle.
Definition at line 133 of file MSBaseVehicle.cpp.
References myCurrEdge.
Referenced by MSVehicleTransfer::addVeh(), MSVehicleTransfer::checkInsertions(), TraCIServerAPI_Vehicle::commandDistanceRequest(), and TraCIServerAPI_Vehicle::processSet().
|
virtual |
Returns the name of the vehicle.
Implements SUMOVehicle.
Definition at line 93 of file MSBaseVehicle.cpp.
References SUMOVehicleParameter::id, and myParameter.
Referenced by calculateArrivalPos(), MSVehicleTransfer::checkInsertions(), traci::TraCIServer::commandAddVehicle(), MSLane::detectCollisions(), GUIEdge::drawGL(), MSVehicle::enterLaneAtInsertion(), MSVTypeProbe::execute(), MSLane::isInsertionSuccess(), MSVehicle::moveChecked(), MSCFModel_Daniel1::moveHelper(), MSCFModel_SmartSK::moveHelper(), TraCIServerAPI_Vehicle::processSet(), replaceRouteEdges(), reroute(), MSLane::setCritical(), MSFCDExport::write(), MSEmissionExport::write(), MSXMLRawOut::writeVehicle(), and MSFullExport::writeVehicles().
|
virtual |
Returns the maximum speed.
Implements SUMOVehicle.
Definition at line 117 of file MSBaseVehicle.cpp.
References MSVehicleType::getMaxSpeed(), and myType.
Referenced by MSCFModel_Wiedemann::_v(), MSVehicleTransfer::checkInsertions(), traci::TraCIServer::commandAddVehicle(), GUIVehicle::getColorValue(), MSLane::insertVehicle(), and MSVehicle::moveChecked().
|
inlinevirtual |
Returns the number of new routes this vehicle got.
Implements SUMOVehicle.
Definition at line 182 of file MSBaseVehicle.h.
References myNumberReroutes.
Referenced by GUIVehicle::drawGLAdditional(), GUIVehicle::getColorValue(), and replaceRouteEdges().
|
virtual |
Returns the vehicle's parameter (including departure definition)
Implements SUMOVehicle.
Definition at line 99 of file MSBaseVehicle.cpp.
References myParameter.
Referenced by MSPersonControl::boardAnyWaiting(), MSEdge::getDepartLane(), GUIVehicle::getParameterWindow(), MSLane::insertVehicle(), MSLane::isInsertionSuccess(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Vehicle::processSet(), and GUIVehicle::setFunctionalColor().
|
pure virtualinherited |
Get the vehicle's position along the lane.
Implemented in MSVehicle.
Referenced by MSDevice_Tripinfo::notifyEnter(), MSInstantInductLoop::notifyEnter(), MSInductLoop::notifyEnter(), MSE2Collector::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), MSE2Collector::by_vehicle_position_sorter::operator()(), and MSXMLRawOut::writeVehicle().
|
virtual |
Returns the current route.
Implements SUMOVehicle.
Definition at line 105 of file MSBaseVehicle.cpp.
References myRoute.
Referenced by TraCIServerAPI_Vehicle::commandDistanceRequest(), MSVehicle::enterLaneAtLaneChange(), MSEdge::getDepartLane(), getMaxSpeedRegardingNextLanes(), MSLane::isInsertionSuccess(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Vehicle::processSet(), GUIVehicle::setFunctionalColor(), MSEmissionExport::write(), and MSFullExport::writeVehicles().
|
pure virtualinherited |
Returns the vehicle's current speed.
Implemented in MSVehicle.
Referenced by MSInductLoop::collectVehiclesOnDet(), MSE3Collector::detectorUpdate(), MSE3Collector::enter(), MSE3Collector::leave(), MSDevice_Tripinfo::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), MSInstantInductLoop::notifyLeave(), and MSXMLRawOut::writeVehicle().
|
virtual |
Returns the vehicle's type definition.
Implements SUMOVehicle.
Definition at line 111 of file MSBaseVehicle.cpp.
References myType.
Referenced by MSLaneChanger::change(), MSVehicleTransfer::checkInsertions(), MSVehicle::checkRewindLinkLanes(), MSLane::detectCollisions(), MSE2Collector::detectorUpdate(), drawAction_drawBlinker(), GUIVehicle::drawAction_drawRailCarriages(), GUIVehicle::drawAction_drawVehicleAsBoxPlus(), GUIVehicle::drawAction_drawVehicleAsImage(), GUIVehicle::drawAction_drawVehicleAsPoly(), GUIVehicle::drawAction_drawVehicleAsTrianglePlus(), drawAction_drawVehicleBlinker(), drawAction_drawVehicleBrakeLight(), GUIVehicle::drawGL(), GUIVehicle::drawGLAdditional(), MSLane::enteredByLaneChange(), MSVehicle::enterLaneAtLaneChange(), MSVTypeProbe::execute(), MSLane::freeInsertion(), MSVehicle::gap2pred(), MSEdge::getDepartLane(), MSLane::getFollowerOnConsecutive(), MSLane::getLastVehicleInformation(), MSLane::getLeaderOnConsecutive(), MSLane::getMissingRearGap(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), MSLane::incorporateVehicle(), MSLane::insertVehicle(), MSLane::integrateNewVehicle(), MSLane::isInsertionSuccess(), MSLane::leftByLaneChange(), MSCFModel::leftVehicleVsafe(), MSLane::maxSpeedGapInsertion(), MSVehicle::move(), MSVehicle::moveChecked(), MSVehicle::overlap(), MSLCM_DK2004::patchSpeed(), MSAbstractLaneChangeModel::predInteraction(), TraCIServerAPI_Vehicle::processGet(), MSVehicle::processNextStop(), MSLane::pWagGenericInsertion(), MSLane::pWagSimpleInsertion(), MSLane::removeVehicle(), MSLane::setCritical(), GUIVehicle::setFunctionalColor(), MSLCM_DK2004::wantsChangeToLeft(), MSLCM_DK2004::wantsChangeToRight(), MSEmissionExport::write(), MSFCDExport::write(), MSQueueExport::writeLane(), and MSFullExport::writeVehicles().
|
virtual |
Returns whether this vehicle has already arived (by default this is true if the vehicle has reached its final edge)
Implements SUMOVehicle.
Reimplemented in MSVehicle.
Definition at line 206 of file MSBaseVehicle.cpp.
References succEdge().
|
virtual |
Returns whether this vehicle has already departed.
Implements SUMOVehicle.
Definition at line 200 of file MSBaseVehicle.cpp.
References myDeparture, and NOT_YET_DEPARTED.
bool MSBaseVehicle::hasValidRoute | ( | std::string & | msg | ) | const |
Validates the current route.
[out] | msg | Description why the route is not valid (if it is the case) |
Definition at line 216 of file MSBaseVehicle.cpp.
References MSRoute::end(), MSVehicleType::getVehicleClass(), myCurrEdge, myRoute, and myType.
Referenced by MSVehicle::enterLaneAtInsertion(), and TraCIServerAPI_Vehicle::processGet().
|
inlinevirtual |
Returns the information whether the vehicle is on a road (is simulated)
Implements SUMOVehicle.
Reimplemented in MSVehicle.
Definition at line 119 of file MSBaseVehicle.h.
Referenced by MSXMLRawOut::writeVehicle().
|
pure virtualinherited |
Returns whether the vehicle is at a stop.
Implemented in MSVehicle.
Referenced by MSDevice_Person::notifyMove().
|
virtual |
Called when the vehicle is inserted into the network.
Sets optional information about departure time, informs the vehicle control about a further running vehicle.
Implements SUMOVehicle.
Definition at line 193 of file MSBaseVehicle.cpp.
References MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSNet::getVehicleControl(), myDeparture, and MSVehicleControl::vehicleDeparted().
Referenced by traci::TraCIServer::commandAddVehicle().
void MSBaseVehicle::removeReminder | ( | MSMoveReminder * | rem | ) |
Removes a MoveReminder dynamically.
[in] | rem | the reminder to remove |
Definition at line 244 of file MSBaseVehicle.cpp.
References myMoveReminders.
|
pure virtualinherited |
Replaces the current route by the given one.
Implemented in MSVehicle.
Referenced by MSTriggeredRerouter::notifyEnter(), MSDevice_Routing::preInsertionReroute(), and replaceRouteEdges().
|
virtual |
Replaces the current route by the given edges.
It is possible that the new route is not accepted, if a) it does not contain the vehicle's current edge, or b) something fails on insertion into the routes container (see in-line comments).
[in] | edges | The new list of edges to pass |
[in] | simTime | The time at which the route was replaced |
Implements SUMOVehicle.
Definition at line 160 of file MSBaseVehicle.cpp.
References MSRoute::addReference(), RGBColor::DEFAULT_COLOR, MSRoute::dictionary(), MSRoute::getColor(), Named::getID(), getID(), getNumberReroutes(), MSRoute::getStops(), myRoute, MSRoute::release(), SUMOVehicle::replaceRoute(), and toString().
Referenced by TraCIServerAPI_Vehicle::processSet(), and reroute().
|
virtual |
Performs a rerouting using the given router.
Tries to find a new route between the current edge and the destination edge, first. Tries to replace the current route by the new one using replaceRoute.
[in] | t | The time for which the route is computed |
[in] | router | The router to use |
Implements SUMOVehicle.
Definition at line 139 of file MSBaseVehicle.cpp.
References SUMOAbstractRouter< E, V >::compute(), MSEdge::dictionary(), SUMOVehicleParameter::fromTaz, getID(), MSRoute::getLastEdge(), myCurrEdge, myParameter, myRoute, replaceRouteEdges(), SUMOVehicleParameter::toTaz, and WRITE_WARNING.
Referenced by TraCIServerAPI_Vehicle::processSet().
Returns the nSuccs'th successor of edge the vehicle is currently at.
If the rest of the route (counted from the current edge) has less than nSuccs edges, 0 is returned.
[in] | nSuccs | The number of edge to look forward |
Implements SUMOVehicle.
Definition at line 123 of file MSBaseVehicle.cpp.
References myCurrEdge.
Referenced by MSVehicleTransfer::addVeh(), MSVehicleTransfer::checkInsertions(), hasArrived(), and TraCIServerAPI_Vehicle::processSet().
|
protected |
the position on the destination lane where the vehicle stops
Definition at line 279 of file MSBaseVehicle.h.
Referenced by calculateArrivalPos(), MSVehicle::getBestLanes(), MSVehicle::hasArrived(), MSVehicle::move(), and MSVehicle::resetRoutePosition().
|
protected |
A precomputed factor by which the driver wants to be faster than the speed limit.
Definition at line 259 of file MSBaseVehicle.h.
Referenced by getChosenSpeedFactor().
|
protected |
Iterator to current route-edge.
Definition at line 256 of file MSBaseVehicle.h.
Referenced by MSVehicle::addStop(), GUIVehicle::drawAction_drawRailCarriages(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::enterLaneAtMove(), MSVehicle::getBestLanes(), MSVehicle::getDistanceToPosition(), getEdge(), MSVehicle::getRoutePosition(), MSVehicle::hasArrived(), hasValidRoute(), MSVehicle::move(), MSVehicle::moveChecked(), MSVehicle::processNextStop(), MSVehicle::replaceRoute(), reroute(), MSVehicle::resetRoutePosition(), succEdge(), and MSVehicle::willPass().
|
protected |
The real departure time.
Definition at line 276 of file MSBaseVehicle.h.
Referenced by getDeparture(), hasDeparted(), and onDepart().
|
protected |
The devices this vehicle has.
Definition at line 273 of file MSBaseVehicle.h.
Referenced by MSVehicle::addPerson(), getDevices(), GUIVehicle::GUIVehicle(), MSBaseVehicle(), and ~MSBaseVehicle().
|
protected |
Current lane's move reminder.
Definition at line 269 of file MSBaseVehicle.h.
Referenced by activateReminders(), MSVehicle::activateReminders(), MSVehicle::adaptLaneEntering2MoveReminder(), MSVehicle::addPerson(), addReminder(), GUIVehicle::GUIVehicle(), MSVehicle::leaveLane(), MSBaseVehicle(), removeReminder(), and MSVehicle::workOnMoveReminders().
|
protected |
The number of reroutings.
Definition at line 282 of file MSBaseVehicle.h.
Referenced by getNumberReroutes(), and MSVehicle::replaceRoute().
|
protected |
This Vehicle's parameter.
Definition at line 247 of file MSBaseVehicle.h.
Referenced by calculateArrivalPos(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::getBestLanes(), getID(), getParameter(), MSVehicle::getPersonNumber(), MSVehicle::move(), MSVehicle::moveChecked(), reroute(), and ~MSBaseVehicle().
|
protected |
This Vehicle's route.
Definition at line 250 of file MSBaseVehicle.h.
Referenced by MSVehicle::addStop(), calculateArrivalPos(), GUIVehicle::drawAction_drawRailCarriages(), GUIVehicle::drawRoute(), MSVehicle::getBestLanes(), MSVehicle::getDistanceToPosition(), GUIVehicle::getPreviousLane(), getRoute(), MSVehicle::getRoutePosition(), MSVehicle::hasArrived(), hasValidRoute(), MSVehicle::move(), MSVehicle::moveChecked(), MSBaseVehicle(), MSVehicle::replaceRoute(), replaceRouteEdges(), reroute(), MSVehicle::resetRoutePosition(), MSVehicle::willPass(), and ~MSBaseVehicle().
|
protected |
This Vehicle's type.
Definition at line 253 of file MSBaseVehicle.h.
Referenced by MSVehicle::enterLaneAtInsertion(), MSVehicle::getAngle(), MSVehicle::getBestLanes(), MSVehicle::getCarFollowModel(), MSVehicle::getHarmonoise_NoiseEmissions(), MSVehicle::getHBEFA_CO2Emissions(), MSVehicle::getHBEFA_COEmissions(), MSVehicle::getHBEFA_FuelConsumption(), MSVehicle::getHBEFA_HCEmissions(), MSVehicle::getHBEFA_NOxEmissions(), MSVehicle::getHBEFA_PMxEmissions(), getMaxSpeed(), GUIVehicle::getParameterWindow(), getVehicleType(), hasValidRoute(), MSVehicle::processNextStop(), MSVehicle::replaceVehicleType(), and MSVehicle::~MSVehicle().
|
staticprivate |
Definition at line 288 of file MSBaseVehicle.h.
Referenced by hasDeparted().