61 if (!(*myCurrEdge)->isTazConnector()) {
63 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
67 "' is too high for the vehicle type '" + type->
getID() +
"'.");
147 if ((*myCurrEdge)->isVaporizing()) {
208 if (oldLink != 0 && oldLink != newLink) {
255 return myStops.find(seg)->second;
264 for (std::map<const MESegment* const, SUMOTime>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
265 result.push_back(&iter->first->getEdge());
290 if (i->first == rem) {
295 if (myTraceMoveReminders) {
296 traceMoveReminder(
"notifyMove", i->first, i->second,
true);
315 if (myTraceMoveReminders) {
316 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
322 if (isLeave && myTraceMoveReminders) {
323 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
329 if (myTraceMoveReminders) {
330 traceMoveReminder(
"remove", rem->first, rem->second,
false);
343 std::vector<SUMOTime> internals;
353 for (std::map<const MESegment* const, SUMOTime>::const_iterator it =
myStops.begin(); it !=
myStops.end(); ++it) {
361 for (std::vector<MSDevice*>::const_iterator dev =
myDevices.begin(); dev !=
myDevices.end(); ++dev) {
362 (*dev)->saveState(out);
371 throw ProcessError(
"Error: Invalid vehicles in state (may be a micro state)!");
385 myDeparture -= offset;
386 myEventTime -= offset;
387 myLastEntryTime -= offset;
391 while (seg->
getIndex() != (int)segIndex) {
404 myBlockTime -= offset;
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
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.
double getLength() const
Returns the length of the segment in meters.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
const ConstMSEdgeVector & getEdges() const
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.
SUMOTime duration
The stopping duration.
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
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
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 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.
void writeParams(OutputDevice &out) const
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
A road/street connecting two junctions.
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
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)
Encapsulated SAX-Attributes.
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.
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.
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) ...
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.
double getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
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.
SUMOTime getStoptime(const MESegment *const seg) const
Returns how long to stop at the given segment.
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
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.
A single mesoscopic segment (cell)
Definition of vehicle stop (position and duration)
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
std::map< const MESegment *const, SUMOTime > myStops
where to stop
static MELoop * gMesoNet
mesoscopic simulation infrastructure
int myNumberReroutes
The number of reroutings.
double getLength() const
Get vehicle's length [m].
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle's state change.
bool isParking() const
Returns whether the vehicle is parking.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
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.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
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.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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.
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.