62 double departPos,
double arrivalPos,
double departPosLat) :
65 "person '" + personID +
"' walking to " + route.back()->getID()),
66 MOVING_WITHOUT_VEHICLE),
67 myWalkingTime(walkingTime),
69 myCurrentInternalEdge(0),
70 myDepartPos(departPos),
71 myDepartPosLat(departPosLat),
73 myPedestrianState(0) {
75 "person '" + personID +
"' walking from " + route.front()->getID());
76 if (walkingTime > 0) {
142 if (!person->
proceed(net, now)) {
158 (*myRouteStep)->addPerson(person);
183 length += edge->getLength();
187 for (ConstMSEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end() - 1; ++i) {
188 const MSEdge* fromEdge = *i;
189 const MSEdge* toEdge = *(i + 1);
190 const MSLane* from = getSidewalk<MSEdge, MSLane>(fromEdge);
191 const MSLane* to = getSidewalk<MSEdge, MSLane>(toEdge);
194 if (from != 0 && to != 0) {
197 toPos = to->getShape().front();
200 toPos = to->getShape().back();
203 toPos = to->getShape().front();
206 toPos = to->getShape().back();
213 bool departFwd =
true;
214 bool arriveFwd =
true;
215 if (myRoute.front() == myRoute.back()) {
222 if ((myRoute.front()->getFromJunction() == myRoute[1]->getToJunction())
223 || (myRoute.front()->getFromJunction() == myRoute[1]->getFromJunction())) {
226 if ((myRoute.back()->getToJunction() == myRoute[myRoute.size() - 2]->getFromJunction())
227 || (myRoute.back()->getToJunction() == myRoute[myRoute.size() - 2]->getToJunction())) {
240 const double maxSpeed =
getMaxSpeed(dynamic_cast<MSPerson*>(person));
300 if (nextInternal == 0) {
322 MSStoppingPlace* toStop,
const double arrivalPos,
const std::vector<std::string>& lines) :
423 (*myStep)->proceed(net,
this, time, prior);
449 return nextEdge->
getID();
459 assert(walkingStage != 0);
471 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
472 (*i)->tripInfoOutput(os, transportable);
485 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
486 (*i)->routeOutput(os);
540 myRemoteXYPos = xyPos;
543 myRemotePosLat = posLat;
544 myRemoteAngle = angle;
545 myRemoteEdgeOffset = edgeOffset;
546 myRemoteRoute = route;
547 myLastRemoteAccess = t;
559 return myLastRemoteAccess >= t -
TIME2STEPS(10);
569 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
double getEdgePos(SUMOTime now) const
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge ...
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
virtual void setArrived(SUMOTime now)
logs end of the step
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.
MSEdge & getEdge() const
Returns the lane's edge.
virtual double getEdgePos() const
Return the position on the 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.
virtual ~MSPerson()
destructor
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
virtual double getAngle(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the direction in which the person faces in degrees
bool isRemoteAffected(SUMOTime t) const
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
double getMaxSpeed(const MSPerson *person) const
accessors to be used by MSPModel
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
MSEdge * myCurrentInternalEdge
The current internal edge this person is on or 0.
MSPersonStage_Driving(const MSEdge &destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines)
constructor
virtual const MSEdge * getEdge() const =0
Returns the current edge.
const MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
void postProcessRemoteControl(MSPerson *p)
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
Position getPosition(SUMOTime now) const
returns the position of the transportable
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)
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
virtual void remove(PedestrianState *state)=0
remove the specified person from the pedestrian simulation
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const MSEdge * getNextEdgePtr() const
returns the next edge ptr if this person is walking and the pedestrian model allows it ...
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
const std::set< std::string > myLines
the lines to choose from
const std::string & getID() const
returns the id of the transportable
virtual bool usingInternalLanes()=0
whether movements on intersections are modelled
MSTransportable::Stage * getCurrentStage() const
Return the current stage.
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
std::vector< const MSEdge * > ConstMSEdgeVector
virtual bool proceed(MSNet *net, SUMOTime time)=0
MSTransportablePlan::iterator myStep
the iterator over the route
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
void reroute(ConstMSEdgeVector &newEdges)
set new walk
std::string myVehicleLine
The simulated network and simulation perfomer.
The car-following model and parameter.
virtual void erase(MSTransportable *transportable)
removes a single transportable
void addTransportable(MSTransportable *p)
adds a transportable to this stop
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
SUMOTime getDesiredDepart() const
Returns the desired departure time.
double getAngle(SUMOTime now) const
returns the angle of the transportable
ConstMSEdgeVector getEdges() const
the edges of the current stage
const MSEdge * getEdge() const
Returns the current edge.
const SUMOVehicleParameter * myParameter
the plan of the transportable
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
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
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
const MSEdge & getDestination() const
returns the destination edge
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
SUMOTime myWaitingSince
The time since which this person is waiting for a ride.
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
const MSEdge * getFromEdge() const
ConstMSEdgeVector myRoute
The route of the person.
const std::string & getID() const
Returns the id.
bool isRemoteControlled() const
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
const MSVehicleType & getVehicleType() const
virtual void removePerson(MSTransportable *p) const
const MSLane & getLane() const
Returns the lane this stop is located at.
void abort(MSTransportable *)
abort this stage (TraCI)
SUMOTime myArrived
the time at which this stage ended
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the person arrived
Influencer & getInfluencer()
Returns the velocity/lane influencer.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
PedestrianState * getPedestrianState() const
SUMOTime myDeparted
the time at which this stage started
virtual void addPerson(MSTransportable *p) const
Representation of a vehicle.
MSStoppingPlace *const myDestinationStop
the stop to reach by getting transported (if any)
virtual double getEdgePos(SUMOTime now) const =0
static MSPModel * getModel()
virtual MSTransportableControl & getPersonControl()
Returns the person control.
A point in 2D or 3D with translation and scaling methods.
void setVehicle(SUMOVehicle *v)
StageType getCurrentStageType() const
the current stage type of the transportable
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
~MSPersonStage_Driving()
destructor
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 ...
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
virtual double getSpeed(const MSPerson::MSPersonStage_Walking &stage) const =0
return the current speed of the person
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines, const double position, const std::string ridingID)
std::string myVehicleID
cached vehicle data for output after the vehicle has been removed
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
ConstMSEdgeVector::iterator myRouteStep
SUMOVehicle * myVehicle
The taken vehicle.
SUMOVehicleClass myVehicleVClass
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
Position getWaitPosition() const
Returns the next free waiting place for pedestrians / containers.
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
MSPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
constructor
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
static std::string emptyString
An empty string.
double computeAverageSpeed() const
void appendStage(Stage *stage, int next=-1)
Appends the given stage to the current plan.
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Changes the wished person speed and position.
Structure representing possible vehicle parameter.
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)
double getSpeed() const
the speed of the transportable
SUMOTime myWalkingTime
the time the person is walking
double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
StageType getStageType(int next) const
the stage type for the nth next stage
~MSPersonStage_Walking()
destructor
const std::string & getNextEdge() const
return the list of internal edges if this person is walking and the pedestrian model allows it ...
MSPersonStage_Walking(const std::string &personID, const ConstMSEdgeVector &route, MSStoppingPlace *toStop, SUMOTime walkingTime, double speed, double departPos, double arrivalPos, double departPosLat)
constructor
const std::string & getID() const
Returns the name of the vehicle type.
std::string getStageDescription() const
returns the stage description as a string
double getWaitingPositionOnLane() const
Returns the lane position corresponding to getWaitPosition()
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.
const MSEdge * getFromEdge() const
double getArrivalPos() const
returns the final arrival pos
const PositionVector & getShape() const
Returns this lane's shape.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
const MSJunction * getFromJunction() const
MSTransportablePlan * myPlan
the plan of the transportable
const MSEdge * myWaitingEdge
Influencer * myInfluencer
An instance of a speed/position influencing instance; built in "getInfluencer".
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
void unregisterOneWaiting(const bool isPerson)
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
double walkDistance() const
compute total walking distance
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.
void lf()
writes a line feed if applicable
static const Position INVALID
used to indicate that a position is valid
const MSJunction * getToJunction() const
double myArrivalPos
the position at which we want to arrive
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