61 myInfluencer(nullptr) {
106 centerLine.push_back(pos);
107 centerLine.push_back(backPos);
162 if ((*myCurrEdge)->isVaporizing()) {
197 if (link !=
nullptr) {
216 if (oldLink != newLink) {
217 if (oldLink !=
nullptr) {
232 bool hadStop =
false;
234 if (stop.joinTriggered) {
235 WRITE_WARNINGF(
TL(
"Join stops are not available in meso yet (vehicle '%', segment '%')."),
243 if (stop.duration > 0) {
244 time += stop.duration;
246 if (stop.pars.until > time) {
249 time = stop.pars.until;
252 time =
MAX2(cur, stop.pars.ended);
257 stop.endBoarding = stop.pars.extension >= 0 ? time + stop.pars.extension :
SUMOTime_MAX;
262 WRITE_WARNINGF(
TL(
"Vehicle '%' has multiple stops on segment '%', time=% (stop-output will be merged)."),
267 if (taxi !=
nullptr) {
271 if (stop.triggered || stop.containerTriggered || stop.joinTriggered) {
277 if (tripinfo !=
nullptr) {
291 rem.first->notifyStopEnded();
321 time += stop.duration;
322 if (stop.pars.until > time) {
325 time = stop.pars.until;
339 bool hadStop =
false;
377 if (stop.triggered || stop.containerTriggered) {
379 if (taxiDevice !=
nullptr) {
382 stop.triggered =
false;
383 stop.containerTriggered =
false;
390 if (stop.triggered) {
393 WRITE_WARNINGF(
TL(
"Vehicle '%' ignores triggered stop on lane '%' due to capacity constraints."),
getID(), stop.lane->getID());
394 stop.triggered =
false;
407 if (stop.containerTriggered) {
410 WRITE_WARNINGF(
TL(
"Vehicle '%' ignores container triggered stop on lane '%' due to capacity constraints."),
getID(), stop.lane->getID());
411 stop.containerTriggered =
false;
424 if (stop.joinTriggered) {
446 if (i->first == rem) {
451 if (myTraceMoveReminders) {
452 traceMoveReminder(
"notifyMove", i->first, i->second,
true);
471 if (myTraceMoveReminders) {
472 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
478 if (isLeave && myTraceMoveReminders) {
479 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
486 if (myTraceMoveReminders) {
487 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
494 if (myTraceMoveReminders) {
495 traceMoveReminder(
"remove", rem->first, rem->second,
false);
554 std::vector<SUMOTime> internals;
567 stop.write(out,
false);
593 throw ProcessError(
TL(
"Error: Invalid vehicles in state (may be a micro state)!"));
621 while (seg->
getIndex() != (
int)segIndex) {
#define WRITE_WARNINGF(...)
std::shared_ptr< const MSRoute > ConstMSRoutePtr
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
const long long int VEHPARS_FORCE_REROUTE
const int STOP_STARTED_SET
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SUMOTime changeSegment(MEVehicle *veh, SUMOTime leaveTime, MESegment *const toSegment, MSMoveReminder::Notification reason, const bool ignoreLink=false) const
change to the next segment this handles combinations of the following cases: (ending / continuing rou...
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
bool removeLeaderCar(MEVehicle *v)
Removes the given car from the leading vehicles.
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
A single mesoscopic segment (cell)
static const int PARKING_QUEUE
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
SUMOTime getLinkPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0)
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
double getLength() const
Returns the length of the segment in meters.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
double getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
double getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
double getAngle() const
Returns the vehicle's direction in degrees.
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
bool replaceRoute(ConstMSRoutePtr route, const std::string &info, bool onInit=false, int offset=0, bool addRouteStops=true, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given one.
SUMOTime myEventTime
The (planned) time of leaving the segment (cell)
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
void updateDetectorForWriting(MSMoveReminder *rem, SUMOTime currentTime, SUMOTime exitTime)
Updates a single vehicle detector if present.
MEVehicle(SUMOVehicleParameter *pars, ConstMSRoutePtr route, MSVehicleType *type, const double speedFactor)
Constructor.
BaseInfluencer & getBaseInfluencer()
Returns the velocity/lane influencer.
double getCurrentStoppingTimeSeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
bool mayProceed()
Returns whether the vehicle is allowed to pass the next junction, checks also for triggered stops.
double estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving across the link.
void processStop()
ends the current stop and performs loading/unloading
SUMOTime getWaitingTime(const bool accumulated=false) const
Returns the duration for which the vehicle was blocked.
bool hasArrived() const
Returns whether this vehicle has already arrived (reached the arrivalPosition on its final edge)
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
int myQueIndex
Index of the que the vehicle is in (important for multiqueue extension)
SUMOTime checkStop(SUMOTime time)
Returns until when to stop at the current segment and sets the information that the stop has been rea...
void updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
virtual bool isIdling() const
Returns whether the vehicle is trying to re-enter the net.
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
double getPositionOnLane() const
Get the vehicle's position along the lane.
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
BaseInfluencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
void setApproaching(MSLink *link)
registers vehicle with the given link
void saveState(OutputDevice &out)
Saves the states of a vehicle.
MESegment * getSegment() const
Returns the current segment the vehicle is on.
MESegment * mySegment
The segment the vehicle is at.
int getQueIndex() const
Returns the index of the que the vehicle is in.
int getSegmentIndex() const
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
double getCurrentLinkPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves its current segment.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
bool resumeFromStopping()
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
PositionVector getBoundingBox(double offset=0) const
get bounding rectangle
double getSlope() const
Returns the slope of the road at vehicle's position in degrees.
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
double getRightSideOnEdge(const MSLane *) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
The base class for microscopic and mesoscopic vehicles.
std::list< MSStop > myStops
The vehicle's list of stops.
void calculateArrivalParams(bool onInit)
(Re-)Calculates the arrival position and lane from the vehicle parameters
MSVehicleType * myType
This vehicle's type.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
double myDepartPos
The real depart position.
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
virtual bool replaceRoute(ConstMSRoutePtr route, const std::string &info, bool onInit=false, int offset=0, bool addRouteStops=true, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given one.
double getLength() const
Returns the vehicle's length.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
int getPersonNumber() const
Returns the number of persons.
MSRouteIterator myCurrEdge
Iterator to current route-edge.
bool hasDeparted() const
Returns whether this vehicle has already departed.
ConstMSRoutePtr myRoute
This vehicle's route.
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr, bool addRouteStops=true)
Adds stops to the built vehicle.
SUMOTime myDeparture
The real departure time.
std::vector< SUMOVehicleParameter::Stop > myPastStops
The list of stops that the vehicle has already reached.
int getRoutePosition() const
return index of edge within route
bool myAmRegisteredAsWaiting
Whether this vehicle is registered as waiting for a person or container (for deadlock-recognition)
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
bool isStopped() const
Returns whether the vehicle is at a stop.
MSDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists, nullptr otherwise.
int myNumberReroutes
The number of reroutings.
double myArrivalPos
The position on the destination lane where the vehicle stops.
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
double myOdometer
A simple odometer to keep track of the length of the route already driven.
int getContainerNumber() const
Returns the number of containers.
A device which collects info on the vehicle trip (mainly on departure and arrival)
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
void cancelCurrentCustomers()
remove the persons the taxi is currently waiting for from reservations
A device which collects info on the vehicle trip (mainly on departure and arrival)
void updateStopTime(const SUMOTime time)
update stopping time for meso
Abstract in-vehicle / in-person device.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double getLength() const
return the length of the edge
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
static bool gUseStopEnded
whether the simulation should replay previous stop times
Representation of a lane in the micro simulation.
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
double getRightSideOnEdge() const
double interpolateLanePosToGeometryPos(double lanePos) const
virtual const PositionVector & getShape(bool) const
double getWidth() const
Returns the lane's width.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
LinkState getState() const
Returns the current state of the link.
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const bool setRequest, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist, double latOffset)
Sets the information about an approaching vehicle.
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
double getLength() const
Returns the length of this link.
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
void updateDetector(SUMOTrafficObject &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual MSTransportableControl & getContainerControl()
Returns the container control.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool hasContainers() const
Returns whether containers are simulated.
bool hasPersons() const
Returns whether persons are simulated.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
bool triggered
whether an arriving person lets the vehicle continue
bool containerTriggered
whether an arriving container lets the vehicle continue
bool joinTriggered
whether coupling another vehicle (train) the vehicle continue
const MESegment * segment
The segment to stop at (mesosim only)
bool reached
Information whether the stop has been reached.
MSRouteIterator edge
The edge in the route to stop at.
const SUMOVehicleParameter::Stop pars
The stop parameter.
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID, bool simEnd=false)
static MSStopOut * getInstance()
bool loadAnyWaiting(const MSEdge *edge, SUMOVehicle *vehicle, SUMOTime &timeToLoadNext, SUMOTime &stopDuration, MSTransportable *const force=nullptr)
load any applicable transportables Loads any person / container that is waiting on that edge for the ...
void registerOneWaiting()
increases the count of vehicles waiting for a transport to allow recognition of person / container re...
void unregisterOneWaiting()
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
The car-following model and parameter.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
int getPersonCapacity() const
Get this vehicle type's person capacity.
double getLength() const
Get vehicle's length [m].
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
void append(const PositionVector &v, double sameThreshold=2.0)
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
void extrapolate2D(const double val, const bool onlyFirst=false)
extrapolate position vector in two dimensions (Z is ignored)
PositionVector reverse() const
reverse position vector
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
Definition of vehicle stop (position and duration)
SUMOTime ended
the time at which this stop was ended
double endPos
The stopping position end.
Structure representing possible vehicle parameter.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
bool wasSet(long long int what) const
Returns whether the given parameter was set.
int arrivalEdge
(optional) The final edge within the route of the vehicle