59 if (!(*myCurrEdge)->isTazConnector()) {
61 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
65 "' is too high for the vehicle type '" + type->
getID() +
"'.");
145 if ((*myCurrEdge)->isVaporizing()) {
186 MSLink* oldLink =
nullptr;
187 MSLink* newLink =
nullptr;
206 if (oldLink !=
nullptr && oldLink != newLink) {
226 myStops[stopSeg].push_back(stopPar);
227 if (
myStops[stopSeg].back().until >= 0) {
228 myStops[stopSeg].back().until += untilOffset;
258 time += stop.duration;
259 if (stop.until > time) {
303 if (vehroutes !=
nullptr) {
333 if (i->first == rem) {
338 if (myTraceMoveReminders) {
339 traceMoveReminder(
"notifyMove", i->first, i->second,
true);
358 if (myTraceMoveReminders) {
359 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
365 if (isLeave && myTraceMoveReminders) {
366 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
372 if (myTraceMoveReminders) {
373 traceMoveReminder(
"remove", rem->first, rem->second,
false);
386 std::vector<SUMOTime> internals;
396 for (
const auto& it :
myStops) {
412 throw ProcessError(
"Error: Invalid vehicles in state (may be a micro state)!");
426 myDeparture -= offset;
427 myEventTime -= offset;
428 myLastEntryTime -= offset;
432 while (seg->
getIndex() != (int)segIndex) {
445 myBlockTime -= offset;
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
void updateDetectorForWriting(MSMoveReminder *rem, SUMOTime currentTime, SUMOTime exitTime)
Updates a single vehicle detector if present.
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
int getContainerNumber() const
Returns the number of containers.
void updateDetector(SUMOVehicle &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
double getAngle() const
Returns the vehicle's direction in degrees.
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
bool hasPersons() const
Returns whether persons are simulated.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
double getLength() const
Returns the length of the segment in meters.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
const ConstMSEdgeVector & getEdges() const
std::map< const MESegment *const, std::vector< SUMOVehicleParameter::Stop > > myStops
where to stop
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
bool hasDeparted() const
Returns whether this vehicle has already departed.
void release() const
deletes the route if there are no further references to it
double estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving accross the link.
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
double getSlope() const
Returns the slope of the road at vehicle's position.
double myArrivalPos
The position on the destination lane where the vehicle stops.
Notification
Definition of a vehicle state.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const PositionVector & getShape() const
Returns this lane's shape.
const MSRoute * myRoute
This vehicle's route.
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
bool isStoppedInRange(double pos) const
return whether the given position is within range of the current stop
The vehicle changes the segment (meso only)
std::vector< const MSEdge * > ConstMSEdgeVector
bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
const std::string & getID() const
Returns the id.
The base class for microscopic and mesoscopic vehicles.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define UNUSED_PARAMETER(x)
The simulated network and simulation perfomer.
The car-following model and parameter.
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID)
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
double departSpeed
(optional) The initial speed of the vehicle
void stopEnded(const SUMOVehicleParameter::Stop &stop)
A road/street connecting two junctions.
double getCurrentStoppingTimeSeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
SUMOTime getLinkPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0) ...
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
The vehicle got a new route.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
Encapsulated SAX-Attributes.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
A point in 2D or 3D with translation and scaling methods.
MESegment * getSegment() const
Returns the current segment the vehicle is on.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
ConstMSEdgeVector::const_iterator MSRouteIterator
bool isStopped() const
Returns whether the vehicle is at a stop.
bool hasContainers() const
Returns whether containers are simulated.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
void processStop()
ends the current stop and performs loading/unloading
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
double endPos
The stopping position end.
Something on a lane to be noticed about vehicle movement.
int getQueIndex() const
Returns the index of the que the vehicle is in.
void saveState(OutputDevice &out)
Saves the states of a vehicle.
double getLength() const
Returns the length of this link.
bool loadAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToLoadNextContainer, SUMOTime &stopDuration)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
double getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
MESegment * mySegment
The segment the vehicle is at.
static void setApproaching(MEVehicle *veh, MSLink *link)
registers vehicle with the given link
std::string lane
The lane to stop at.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
Abstract in-vehicle / in-person device.
void write(OutputDevice &dev) const
Writes the stop as XML.
SUMOTime getStoptime(const MESegment *const seg, SUMOTime time) const
Returns until when to stop at the given segment.
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
ConstMSEdgeVector myStopEdges
edges to stop
int getPersonNumber() const
Returns the number of persons.
Structure representing possible vehicle parameter.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
bool boardAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToBoardNextPerson, SUMOTime &stopDuration)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
A single mesoscopic segment (cell)
Definition of vehicle stop (position and duration)
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
MEVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
void updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
double interpolateLanePosToGeometryPos(double lanePos) const
const std::string & getID() const
Returns the name of the vehicle type.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
void addReference() const
increments the reference counter for the route
static MELoop * gMesoNet
mesoscopic simulation infrastructure
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
int myNumberReroutes
The number of reroutings.
double getLength() const
Get vehicle's length [m].
static MSStopOut * getInstance()
bool isParking() const
Returns whether the vehicle is parking.
Static storage of an output device and its base (abstract) implementation.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
double getPositionOnLane() const
Get the vehicle's position along the lane.
SUMOTime myEventTime
The (planned) time of leaving the segment (cell)
double getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSRouteIterator myCurrEdge
Iterator to current route-edge.
double getCurrentLinkPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Representation of a lane in the micro simulation.
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
bool contains(const MSEdge *const edge) const
SUMOTime myDeparture
The real departure time.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
std::string id
The vehicle's id.
void removeWaiting(const MSEdge *const edge, const SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.