65 double departPos,
double arrivalPos,
double departPosLat,
int departLane,
66 const std::string& routeID) :
68 myWalkingTime(walkingTime),
70 myInternalDistance(0) {
72 "person '" + personID +
"' walking from edge '" + route.front()->getID() +
"'");
74 "person '" + personID +
"' walking to edge '" + route.back()->getID() +
"'");
75 if (walkingTime > 0) {
88 std::vector<const MSEdge*> route =
myRoute;
94 if (departPos > route[0]->getLength()) {
96 departPos = route[0]->getLength();
98 if (arrivalPos > route.back()->getLength()) {
100 arrivalPos = route.back()->getLength();
102 if (departLane >= route[0]->getNumLanes()) {
104 departLane = route[0]->getNumLanes() - 1;
119 if (!person->
proceed(net, now)) {
128 const std::string model = oc.
getString(
"pedestrian.model");
129 if (model !=
"jupedsim") {
152 pControl.
erase(person);
162 (*myRouteStep)->addTransportable(person);
187 if (stage !=
nullptr) {
198 for (ConstMSEdgeVector::const_iterator i =
myRoute.begin(); i != endIt; ++i) {
199 length += (*i)->getLength();
206 for (ConstMSEdgeVector::const_iterator i =
myRoute.begin(); i != endIt - 1; ++i) {
207 const MSEdge* fromEdge = *i;
208 const MSEdge* toEdge = *(i + 1);
209 const MSLane* from = getSidewalk<MSEdge, MSLane>(fromEdge);
210 const MSLane* to = getSidewalk<MSEdge, MSLane>(toEdge);
213 if (from !=
nullptr && to !=
nullptr) {
243 :
myRoute.back()->getLength() - arrivalPos));
247 :
myRoute.back()->getLength() - arrivalPos));
257 if (mayStartForward && mayStartBackward) {
258 length = lengthFwd < lengthBwd ? lengthFwd : lengthBwd;
259 }
else if (mayStartForward) {
261 }
else if (mayStartBackward) {
275 return MAX2(POSITION_EPS, length);
282 if (timeLoss < 0 && timeLoss >
TIME2STEPS(-0.1)) {
293 WRITE_WARNING(
TL(
"The pedestrian model uses infrastructure which is not in the network, timeLoss and routeLength may be invalid."));
318 std::string comment =
"";
332 if (withRouteLength) {
340 std::vector<std::string> exits;
345 exits.insert(exits.end(), missing.begin(), missing.end());
362 if (lane !=
nullptr) {
364 const double lastPos = (arrived
371 if (
myExitTimes !=
nullptr && nextInternal ==
nullptr) {
396 if (nextInternal ==
nullptr) {
411 rem->notifyLeave(*person, lastPos, notification);
418 const MSLane*
const nextLane = getSidewalk<MSEdge, MSLane>(
getEdge());
419 if (nextLane !=
nullptr) {
427 double minDist = std::numeric_limits<double>::max();
431 if (rerouter !=
nullptr) {
433 if (dist2 < minDist) {
439 if (nearest !=
nullptr) {
464 return "walking to " + dest;
485 (*myRouteStep)->addTransportable(transportable);
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
const int VEHPARS_ARRIVALPOS_SET
@ SUMO_ATTR_EDGES
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss)
record tripinfo data for pedestrians
A road/street connecting two junctions.
const MSJunction * getFromJunction() const
double getLength() const
return the length of the edge
const MSJunction * getToJunction() const
virtual void addTransportable(MSTransportable *t) const
Representation of a lane in the micro simulation.
double getLength() const
Returns the lane's length.
MSEdge & getEdge() const
Returns the lane's edge.
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
virtual const PositionVector & getShape(bool) const
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static const int BACKWARD
static int canTraverse(int dir, const ConstMSEdgeVector &route, int &passedEdges)
virtual MSTransportableStateAdapter * loadState(MSTransportable *transportable, MSStageMoving *stage, std::istringstream &state)
load the state of the given transportable
virtual bool usingInternalLanes()=0
whether movements on intersections are modelled
virtual void remove(MSTransportableStateAdapter *state)=0
remove the specified person from the pedestrian simulation
virtual MSTransportableStateAdapter * add(MSTransportable *transportable, MSStageMoving *stage, SUMOTime now)=0
register the given person as a pedestrian
static const int UNDEFINED_DIRECTION
bool isRemoteControlled() const
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
bool hasInfluencer() const
whether the vehicle is individually influenced (via TraCI or special parameters)
Influencer & getInfluencer()
Returns the velocity/lane influencer.
static SumoRNG * getParsingRNG()
get parsing RNG
static bool dictionary(const std::string &id, ConstMSRoutePtr route)
Adds a route to the dictionary.
static RandomDistributor< ConstMSRoutePtr > * distDictionary(const std::string &id)
Returns the named route distribution.
const MSEdge * getDestination() const
returns the destination edge
virtual double getEdgePos(SUMOTime now) const
virtual double getEdgePosLat(SUMOTime now) const
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
double getCosts() const
Returns the costs of the stage.
virtual Position getPosition(SUMOTime now) const =0
returns the position of the transportable
bool wasSet(int what) const
MSStageType getStageType() const
virtual SUMOTime getDuration() const
SUMOTime myArrived
the time at which this stage ended
virtual const MSEdge * getEdge() const
Returns the current edge.
double myArrivalPos
the longitudinal position at which we want to arrive
Position getEdgePosition(const MSEdge *e, double at, double offset) const
get position on edge e at length at with orthogonal offset
SUMOTime myDeparted
the time at which this stage started
std::string myRouteID
The original route id.
double getEdgePos(SUMOTime now) const
Returns the offset from the start of the current edge measured in its natural direction.
double myDepartPosLat
the lateral depart position
double mySpeed
the speed of the transportable
int myDepartLane
the depart lane or -1
MSEdge * myCurrentInternalEdge
The current internal edge this transportable is on or nullptr.
const MSEdge * getEdge() const
Returns the current edge.
MSTransportableStateAdapter * myPState
state that is to be manipulated by MSPModel
std::vector< const MSEdge * > myRoute
The route of the container.
MSTransportableStateAdapter * getPState() const
double myDepartPos
the depart position
std::vector< const MSEdge * >::iterator myRouteStep
current step
double myInternalDistance
distance walked on non-normal edges (i.e. walkingareas)
int getRoutePosition() const
return index of current edge within route
double walkDistance(bool partial=false) const
compute total walking distance
std::vector< MSMoveReminder * > myMoveReminders
the MoveReminders encountered while walking
void abort(MSTransportable *)
abort this stage (TraCI)
SUMOTime myLastEdgeEntryTime
the time the person entered the edge
MSStageWalking(const std::string &personID, const ConstMSEdgeVector &route, MSStoppingPlace *toStop, SUMOTime walkingTime, double speed, double departPos, double arrivalPos, double departPosLat, int departLane=-1, const std::string &routeID="")
constructor
double getArrivalPos() const
SUMOTime myWalkingTime
the time the person is walking
double getMaxSpeed(const MSTransportable *const person) const
accessors to be used by MSPModel
bool moveToNextEdge(MSTransportable *person, SUMOTime currentTime, int prevDir, MSEdge *nextInternal=nullptr)
move forward and return whether the person arrived
void activateLeaveReminders(MSTransportable *person, const MSLane *lane, double lastPos, SUMOTime t, bool arrived)
static bool myWarnedInvalidTripinfo
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, MSStage *previous)
proceeds to the next step
~MSStageWalking()
destructor
double computeAverageSpeed() const
void saveState(std::ostringstream &out)
Saves the current state into the given stream.
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
void loadState(MSTransportable *transportable, std::istringstream &state)
Reconstructs the current state.
void activateEntryReminders(MSTransportable *person, const bool isDepart=false)
add the move reminders for the current lane on entry
SUMOTime getTimeLoss(const MSTransportable *transportable) const
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
std::vector< SUMOTime > * myExitTimes
optional exit time tracking for vehroute output
virtual void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const
Called on writing vehroute output.
A lane area vehicles can halt at.
SumoXMLTag getElement() const
return the type of this stopping place
const std::string & getMyName() const
bool addTransportable(const MSTransportable *p)
adds a transportable to this stop
MSPModel * getMovementModel()
Returns the default movement model for this kind of transportables.
virtual void erase(MSTransportable *transportable)
removes a single transportable
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
Position getPosition(const double) const
Return current position (x/y, cartesian)
double getPositionOnLane() const
Get the object's position along the lane.
MSStage * getCurrentStage() const
Return the current stage.
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and physical maximum speed)
virtual bool isJammed() const
whether the transportable is jammed
virtual const MSLane * getLane() const
the current lane of the transportable
virtual void saveState(std::ostringstream &out)
Saves the current state into the given stream.
virtual double getPathLength() const
return the total length of the current lane (in particular for on a walkingarea)
Reroutes traffic objects passing an edge.
const Position & getPosition()
bool triggerRouting(SUMOTrafficObject &veh, MSMoveReminder::Notification reason)
double getLength() const
Get vehicle's length [m].
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
void setParameters(const Parameterised ¶ms)
set the inner key/value map in map<string, string> format
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
bool almostSame(const Position &p2, double maxDiv=POSITION_EPS) const
check if two position is almost the sme as other
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id, bool silent=false)
Interprets negative edge positions and fits them onto a given edge.
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.