Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSPerson.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// The class for modelling person-movements
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <string>
27#include <vector>
28#include <set>
31#include <utils/geom/Position.h>
35
36
37// ===========================================================================
38// class declarations
39// ===========================================================================
40class MSNet;
41class MSEdge;
42class MSLane;
43class OutputDevice;
45class MSStoppingPlace;
46class SUMOVehicle;
47class MSVehicleType;
48class MSPModel;
49class MSMoveReminder;
50
51typedef std::vector<const MSEdge*> ConstMSEdgeVector;
52
53// ===========================================================================
54// class definitions
55// ===========================================================================
61class MSPerson : public MSTransportable {
62public:
68 public:
70 MSPersonStage_Access(const MSEdge* destination, MSStoppingPlace* toStop,
71 const double arrivalPos, const double arrivalPosLat, const double dist, const bool isExit,
72 const Position& startPos, const Position& endPos);
73
76
77 MSStage* clone() const;
78
80 virtual void proceed(MSNet* net, MSTransportable* person, SUMOTime now, MSStage* previous);
81
83 std::string getStageDescription(const bool isPerson) const;
84 std::string getStageSummary(const bool isPerson) const;
85
86 Position getPosition(SUMOTime now) const;
87
88 double getAngle(SUMOTime now) const;
89
91 double getDistance() const {
92 return myDist;
93 }
94
96 double getSpeed() const;
97
104 void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
105
107 void routeOutput(const bool, OutputDevice&, const bool, const MSStage* const) const {};
108
111 void saveState(std::ostringstream& out, MSTransportable* transportable);
112
115 void loadState(MSTransportable* person, std::istringstream& state);
116
117 private:
118 class ProceedCmd : public Command {
119 public:
120 ProceedCmd(MSTransportable* person, MSEdge* edge) : myPerson(person), myStopEdge(edge) {}
122 SUMOTime execute(SUMOTime currentTime);
123 private:
126 private:
129 };
130
131 private:
134 const double myDist;
135 const bool myAmExit;
138 };
139
140public:
142 MSPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor);
143
145 virtual ~MSPerson();
146
147 /* @brief check whether an access stage must be added and return whether a
148 * stage was added */
149 bool checkAccess(const MSStage* const prior, const bool waitAtStop = true);
150
152 const std::string& getNextEdge() const;
153
155 const MSEdge* getNextEdgePtr() const;
156
158 virtual bool isSelected() const {
159 return false;
160 }
161
162 inline double getChosenSpeedFactor() const {
163 return myChosenSpeedFactor;
164 }
165
166 inline void setChosenSpeedFactor(const double factor) {
167 myChosenSpeedFactor = factor;
168 }
169
170 double getImpatience() const;
171
173 bool isJammed() const;
174
176 void replaceWalk(const ConstMSEdgeVector& newEdges, double departPos, int firstIndex, int nextIndex);
177
178 inline double getTimegapCrossing() const {
179 return myTimegapCrossing;
180 }
181
188 public:
190 Influencer();
191
192
194 ~Influencer();
195
196
197 void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
198
202
204
205 bool isRemoteControlled() const;
206
207 bool isRemoteAffected(SUMOTime t) const;
208
209 private:
218 };
219
220
227
228 const Influencer* getInfluencer() const;
229
230 bool hasInfluencer() const {
231 return myInfluencer != 0;
232 }
233
236
237private:
240
242
245
246private:
249
252
253};
long long int SUMOTime
Definition GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSEdge.h:74
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSPerson.h:51
Base (microsim) event class.
Definition Command.h:50
A road/street connecting two junctions.
Definition MSEdge.h:77
Representation of a lane in the micro simulation.
Definition MSLane.h:84
Something on a lane to be noticed about vehicle movement.
The simulated network and simulation perfomer.
Definition MSNet.h:89
The pedestrian (and also sometimes container) movement model.
Definition MSPModel.h:51
Changes the wished person speed and position.
Definition MSPerson.h:187
SUMOTime myLastRemoteAccess
Definition MSPerson.h:217
void postProcessRemoteControl(MSPerson *p)
Definition MSPerson.cpp:358
Influencer()
Constructor.
Definition MSPerson.cpp:326
SUMOTime getLastAccessTimeStep() const
Definition MSPerson.h:199
ConstMSEdgeVector myRemoteRoute
Definition MSPerson.h:216
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition MSPerson.cpp:333
~Influencer()
Destructor.
Definition MSPerson.cpp:329
Position myRemoteXYPos
Definition MSPerson.h:210
MSLane * myRemoteLane
Definition MSPerson.h:211
bool isRemoteAffected(SUMOTime t) const
Definition MSPerson.cpp:352
bool isRemoteControlled() const
Definition MSPerson.cpp:346
SUMOTime execute(SUMOTime currentTime)
Executes the command.
Definition MSPerson.cpp:138
ProceedCmd(MSTransportable *person, MSEdge *edge)
Definition MSPerson.h:120
ProceedCmd & operator=(const ProceedCmd &)
Invalidated assignment operator.
void loadState(MSTransportable *person, std::istringstream &state)
Reconstructs the current state.
Definition MSPerson.cpp:155
double getDistance() const
get travel distance in this stage
Definition MSPerson.h:91
double getSpeed() const
the speed of the person in this stage
Definition MSPerson.cpp:119
void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
Definition MSPerson.cpp:124
const MSEdge * myOrigin
the origin edge
Definition MSPerson.h:133
void routeOutput(const bool, OutputDevice &, const bool, const MSStage *const) const
Called on writing vehroute output. Currently does nothing.
Definition MSPerson.h:107
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, MSStage *previous)
proceeds to the next step
Definition MSPerson.cpp:75
std::string getStageDescription(const bool isPerson) const
returns the stage description as a string
Definition MSPerson.cpp:91
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
Definition MSPerson.cpp:97
void saveState(std::ostringstream &out, MSTransportable *transportable)
Saves the current state into the given stream.
Definition MSPerson.cpp:149
bool checkAccess(const MSStage *const prior, const bool waitAtStop=true)
Definition MSPerson.cpp:182
Influencer * myInfluencer
An instance of a speed/position influencing instance; built in "getInfluencer".
Definition MSPerson.h:239
const MSEdge * getNextEdgePtr() const
returns the next edge ptr if this person is walking and the pedestrian model allows it
Definition MSPerson.cpp:270
void setChosenSpeedFactor(const double factor)
Definition MSPerson.h:166
double getImpatience() const
Definition MSPerson.cpp:245
double getChosenSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition MSPerson.h:162
double myChosenSpeedFactor
Definition MSPerson.h:241
double getTimegapCrossing() const
Definition MSPerson.h:178
virtual bool isSelected() const
whether this person is selected in the GUI
Definition MSPerson.h:158
MSPerson(const MSPerson &)
Invalidated copy constructor.
double myTimegapCrossing
value may be sampled from distribution and therefore must be cached
Definition MSPerson.h:244
void replaceWalk(const ConstMSEdgeVector &newEdges, double departPos, int firstIndex, int nextIndex)
set new walk and replace the stages with relative indices in the interval [firstIndex,...
Definition MSPerson.cpp:282
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
MSPerson & operator=(const MSPerson &)
Invalidated assignment operator.
bool hasInfluencer() const
whether the vehicle is individually influenced (via TraCI or special parameters)
Definition MSPerson.h:230
virtual ~MSPerson()
destructor
Definition MSPerson.cpp:176
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition MSPerson.cpp:308
const std::string & getNextEdge() const
return the list of internal edges if this person is walking and the pedestrian model allows it
Definition MSPerson.cpp:251
void setRemoteState(Position xyPos)
sets position outside the road network
A lane area vehicles can halt at.
bool isPerson() const override
Whether it is a person.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
virtual double getAngle() const override
return the current angle of the transportable
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
The car-following model and parameter.
Static storage of an output device and its base (abstract) implementation.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
Representation of a vehicle.
Definition SUMOVehicle.h:63
Structure representing possible vehicle parameter.