60 double departPos,
double arrivalPos,
double departPosLat) :
63 "person '" + personID +
"' walking to " + route.back()->getID()),
64 MOVING_WITHOUT_VEHICLE),
65 myWalkingTime(walkingTime),
67 myCurrentInternalEdge(nullptr),
68 myDepartPos(departPos),
69 myDepartPosLat(departPosLat),
71 myPedestrianState(&myDummyState) {
73 "person '" + personID +
"' walking from " + route.front()->getID());
74 if (walkingTime > 0) {
149 if (!person->
proceed(net, now)) {
167 if (lane !=
nullptr) {
198 length += edge->getLength();
202 for (ConstMSEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end() - 1; ++i) {
203 const MSEdge* fromEdge = *i;
204 const MSEdge* toEdge = *(i + 1);
205 const MSLane* from = getSidewalk<MSEdge, MSLane>(fromEdge);
206 const MSLane* to = getSidewalk<MSEdge, MSLane>(toEdge);
209 if (from !=
nullptr && to !=
nullptr) {
212 toPos = to->getShape().front();
215 toPos = to->getShape().back();
218 toPos = to->getShape().front();
221 toPos = to->getShape().back();
236 const double lengthBwd = (length - (myRoute.front()->getLength() -
myDepartPos) - (
241 if (myRoute.size() == 1) {
248 if (mayStartForward && mayStartBackward) {
249 length = lengthFwd < lengthBwd ? lengthFwd : lengthBwd;
250 }
else if (mayStartForward) {
252 }
else if (mayStartBackward) {
282 os.
writeAttr(
"duration", myDeparted < 0 ?
"-1" :
294 std::string comment =
"";
306 if (withRouteLength) {
332 if (lane !=
nullptr) {
335 rem->notifyLeave(*person,
352 if (nextInternal ==
nullptr) {
358 const MSLane* nextLane = getSidewalk<MSEdge, MSLane>(
getEdge());
359 if (nextLane !=
nullptr) {
371 assert(routeOffset >= 0);
372 assert(routeOffset < (
int)
myRoute.size());
389 return "walking to " + dest;
397 MSStoppingPlace* toStop,
const double arrivalPos,
const std::vector<std::string>& lines,
398 const std::string& intendedVeh,
SUMOTime intendedDepart) :
403 intendedVeh, intendedDepart) {
420 if (start !=
nullptr) {
462 "driving to " + dest;
480 (myDeparted >= 0 ?
time2string(now - myDeparted) :
"-1"));
493 std::string comment =
"";
507 if (withRouteLength) {
518 const double arrivalPos,
const double dist,
const bool isExit) :
520 myDist(dist), myAmExit(isExit) {
581 myStopEdge->removePerson(myPerson);
621 if (accessDist > 0.) {
632 if (accessDist > 0.) {
637 (*myStep)->proceed(net,
this, time, prior);
666 if (nextEdge !=
nullptr) {
667 return nextEdge->
getID();
677 assert(walkingStage != 0);
692 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
693 (*i)->tripInfoOutput(os,
this);
706 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
707 (*i)->routeOutput(os, withRouteLength);
716 assert(nextIndex > firstIndex);
732 for (
int i = nextIndex - 1; i >= firstIndex; i--) {
766 myRemoteXYPos = xyPos;
769 myRemotePosLat = posLat;
770 myRemoteAngle = angle;
771 myRemoteEdgeOffset = edgeOffset;
772 myRemoteRoute = route;
773 myLastRemoteAccess = t;
785 return myLastRemoteAccess >= t -
TIME2STEPS(10);
807 s->
getPedestrianState()->
moveToXY(p, myRemoteXYPos, myRemoteLane, myRemotePos, myRemotePosLat, myRemoteAngle, myRemoteEdgeOffset, myRemoteRoute,
The departure is person triggered.
virtual const MSEdge * getNextEdge(const MSPerson::MSPersonStage_Walking &stage) const =0
return the list of internal edges if the pedestrian is on an intersection
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge ...
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
SUMOTime myEstimatedArrival
MSEdge & getEdge() const
Returns the lane's edge.
static void addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss)
record tripinfo data for pedestrians
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
double getBeginLanePosition() const
Returns the begin position of this stop.
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
~MSPersonStage_Access()
destructor
virtual ~MSPerson()
destructor
virtual double getAngle(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the direction in which the person faces in degrees
double getArrivalPos() const
returns the final arrival pos
virtual void setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now)
logs end of the step
A lane area vehicles can halt at.
virtual SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the time the person spent standing
std::string getStageDescription() const
returns the stage description as a string
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
MSEdge * myCurrentInternalEdge
The current internal edge this person is on or 0.
bool hasArrived() const
return whether the person has reached the end of its plan
The vehicle arrived at a junction.
const MSEdge * getDestination() const
returns the destination edge
virtual const MSEdge * getEdge() const
Returns the current edge.
void postProcessRemoteControl(MSPerson *p)
virtual double getEdgePos(SUMOTime now) const
const MSEdge * getEdge() const
Returns the current edge.
static void addRideData(double rideLength, SUMOTime rideDuration, SUMOVehicleClass vClass, const std::string &line, SUMOTime waitingTime)
record tripinfo data for rides
std::string time2string(SUMOTime t)
Position getPosition(SUMOTime now) const
returns the position of the transportable
virtual void remove(PedestrianState *state)=0
remove the specified person from the pedestrian simulation
std::string myIntendedVehicleID
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const std::string & getNextEdge() const
return the list of internal edges if this person is walking and the pedestrian model allows it ...
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
MSPersonStage_Driving(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines, const std::string &intendedVeh="", SUMOTime intendedDepart=-1)
constructor
double getLength() const
Returns the lane's length.
const PositionVector & getShape() const
Returns this lane's shape.
const std::set< std::string > myLines
the lines to choose from
virtual bool usingInternalLanes()=0
whether movements on intersections are modelled
PositionVector reverse() const
reverse position vector
void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
double getWaitingPositionOnLane(MSTransportable *t) const
Returns the lane position corresponding to getWaitPosition()
std::vector< const MSEdge * > ConstMSEdgeVector
virtual bool proceed(MSNet *net, SUMOTime time)=0
const std::string & getID() const
Returns the id.
const MSEdge * myDestination
the next edge to reach by getting transported
const std::vector< MSMoveReminder *> & getMoveReminders() const
Return the list of this lane's move reminders.
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
MSTransportablePlan::iterator myStep
the iterator over the route
const MSJunction * getToJunction() const
const MSEdge * getFromEdge() const
const std::string & getMyName() const
bool isRemoteAffected(SUMOTime t) const
std::string myVehicleLine
The simulated network and simulation perfomer.
The car-following model and parameter.
virtual void erase(MSTransportable *transportable)
removes a single transportable
static OptionsCont & getOptions()
Retrieves the options.
virtual Position getPosition(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the network coordinate of the person
PedestrianState * getPedestrianState() const
const SUMOVehicleParameter * myParameter
the plan of the transportable
virtual PedestrianState * add(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, SUMOTime now)=0
register the given person as a pedestrian
void removeStage(int next)
removes the nth next stage
std::string getStageSummary() const
return string summary of the current stage
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
SUMOTime myWaitingSince
The time since which this person is waiting for a ride.
std::string getStageSummary() const
return string summary of the current stage
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
ConstMSEdgeVector myRoute
The route of the person.
A road/street connecting two junctions.
static int canTraverse(int dir, const ConstMSEdgeVector &route)
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
MSPersonStage_Access(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const double dist, const bool isExit)
constructor
double getEndLanePosition() const
Returns the end position of this stop.
MSTransportable::Stage * getCurrentStage() const
Return the current stage.
MSTransportable::Stage * getNextStage(int next) const
Return the current stage.
static const int UNDEFINED_DIRECTION
void abort(MSTransportable *)
abort this stage (TraCI)
SUMOTime myArrived
the time at which this stage ended
Influencer & getInfluencer()
Returns the velocity/lane influencer.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SUMOTime myDeparted
the time at which this stage started
Representation of a vehicle.
static MSPModel * getModel()
virtual MSTransportableControl & getPersonControl()
Returns the person control.
A point in 2D or 3D with translation and scaling methods.
SUMOTime getDesiredDepart() const
Returns the desired departure time.
ConstMSEdgeVector getEdges() const
the edges of the current stage
void setVehicle(SUMOVehicle *v)
virtual void addPerson(MSTransportable *p) const
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
~MSPersonStage_Driving()
destructor
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
virtual double getEdgePos(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the offset from the start of the current edge measured in its natural direction ...
The vehicle arrived at its destination (is deleted)
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
double getAngle(SUMOTime now) const
returns the angle of the transportable
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
std::string getStageDescription() const
returns the stage description as a string
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
virtual double getSpeed(const MSPerson::MSPersonStage_Walking &stage) const =0
return the current speed of the person
std::string myVehicleID
cached vehicle data for output after the vehicle has been removed
const std::string & getID() const
returns the id of the transportable
double getMaxSpeed(const MSTransportable *const person) const
accessors to be used by MSPModel
virtual void removePerson(MSTransportable *p) const
ConstMSEdgeVector::iterator myRouteStep
SUMOVehicle * myVehicle
The taken vehicle.
SUMOVehicleClass myVehicleVClass
Something on a lane to be noticed about vehicle movement.
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
double getArrivalPos() const
virtual Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
SUMOTime myIntendedDepart
MSPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
constructor
bool addTransportable(MSTransportable *p)
adds a transportable to this stop
virtual const MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for Stage_Trip
double getAccessDistance(const MSEdge *edge) const
the distance from the access on the given edge to the stop, -1 on failure
static std::string emptyString
An empty string.
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
virtual double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
void appendStage(Stage *stage, int next=-1)
Appends the given stage to the current plan.
Position getPosition(SUMOTime now) const
returns the position of the transportable
Changes the wished person speed and position.
double computeAverageSpeed() const
The vehicle has departed (was inserted into the network)
Structure representing possible vehicle parameter.
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const MSEdge *const edge, const double position)
double length() const
Returns the length.
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
void reroute(ConstMSEdgeVector &newEdges, double departPos, int firstIndex, int nextIndex)
set new walk and replace the stages with relative indices in the interval [firstIndex, nextIndex[
MSInsertionControl & getInsertionControl()
Returns the insertion control.
const std::string DEFAULT_PEDTYPE_ID
const double myChosenSpeedFactor
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
const MSJunction * getFromJunction() const
SUMOTime myWalkingTime
the time the person is walking
double getSpeed() const
the speed of the transportable
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=nullptr)
move forward and return whether the person arrived
StageType getStageType() const
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
~MSPersonStage_Walking()
destructor
const std::string & getID() const
Returns the name of the vehicle type.
MSPersonStage_Walking(const std::string &personID, const ConstMSEdgeVector &route, MSStoppingPlace *toStop, SUMOTime walkingTime, double speed, double departPos, double arrivalPos, double departPosLat)
constructor
double angleAt2D(int pos) const
get angle in certain position of position vector
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
StageType getStageType(int next) const
the stage type for the nth next stage
PedestrianState * myPedestrianState
state that is to be manipulated by MSPModel
bool proceed(MSNet *net, SUMOTime time)
virtual void addPerson(MSTransportable *person)=0
Adds a person to this vehicle.
static DummyState myDummyState
static const int BACKWARD
const MSEdge * getNextEdgePtr() const
returns the next edge ptr if this person is walking and the pedestrian model allows it ...
const MSVehicleType & getVehicleType() const
Returns the vehicle's type.
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.
MSTransportablePlan * myPlan
the plan of the transportable
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
SUMOTime myLastEdgeEntryTime
the time the person entered the edge
double getAngle(SUMOTime now) const
returns the angle of the transportable
SUMOTime execute(SUMOTime currentTime)
Executes the command.
const MSEdge * myWaitingEdge
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
const MSLane & getLane() const
Returns the lane this stop is located at.
double walkDistance() const
compute total walking distance
Influencer * myInfluencer
An instance of a speed/position influencing instance; built in "getInfluencer".
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
bool isRemoteControlled() const
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Representation of a lane in the micro simulation.
const MSEdge * getFromEdge() const
void unregisterOneWaiting(const bool isPerson)
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
double getEdgePos(SUMOTime now) const
void lf()
writes a line feed if applicable
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
static const Position INVALID
used to indicate that a position is valid
void removeWaiting(const MSEdge *const edge, const SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles for the given edge.
double myArrivalPos
the position at which we want to arrive
StageType getCurrentStageType() const
the current stage type of the transportable
void setRouteIndex(MSPerson *person, int routeOffset)
place person on a previously passed edge
virtual void moveToXY(MSPerson *p, Position pos, MSLane *lane, double lanePos, double lanePosLat, double angle, int routeOffset, const ConstMSEdgeVector &edges, SUMOTime t)
try to move person to the given position
std::string getStageSummary() const
return string summary of the current stage