40 #define DEBUG1 "disabled"
41 #define DEBUG2 "disabled"
42 #define DEBUGCOND(PEDID) (PEDID == DEBUG1 || PEDID == DEBUG2)
55 myNumActivePedestrians(0) {
88 dynamic_cast<PState*
>(state)->getCommand()->abortWalk();
102 if (myTransportable ==
nullptr) {
105 const MSEdge* old = myParent.getEdge();
106 const bool arrived = myParent.moveToNextEdge(myTransportable, currentTime);
110 return static_cast<PState*
>(myParent.getState())->computeDuration(old, myParent, currentTime);
126 myLastEntryTime = currentTime;
130 if (prev ==
nullptr) {
137 if (next ==
nullptr) {
151 if ((myCurrentDuration %
DELTA_T) > 0) {
154 return myCurrentDuration;
161 return myCurrentBeginPos + (myCurrentEndPos - myCurrentBeginPos) / myCurrentDuration * (now - myLastEntryTime);
167 const MSLane* lane = getSidewalk<MSEdge, MSLane>(stage.
getEdge());
168 if (lane ==
nullptr) {
178 return stage.
getLanePosition(lane, getEdgePos(stage, now), lateral_offset);
185 double angle = stage.
getEdgeAngle(stage.
getEdge(), getEdgePos(stage, now)) + (myCurrentEndPos < myCurrentBeginPos ?
M_PI : 0);
201 return stage.
getMaxSpeed(myCommand->getTransportable());
213 out <<
" " << myLastEntryTime <<
" " << myCurrentDuration;
226 const double dist = myCurrentBeginPosition.
distanceTo2D(myCurrentEndPosition);
234 double angle = stage.
getEdgeAngle(stage.
getEdge(), getEdgePos(stage, now)) + (myCurrentEndPos < myCurrentBeginPos ? 1.5 *
M_PI : 0.5 *
M_PI);
244 myLastEntryTime = currentTime;
250 myCurrentBeginPosition = stage.
getLanePosition(fromLane, myCurrentBeginPos, LATERAL_OFFSET);
251 const MSLane* toLane = stage.
getEdges().back()->getLanes().front();
252 myCurrentEndPosition = stage.
getLanePosition(toLane, myCurrentEndPos, LATERAL_OFFSET);
255 return myCurrentDuration;
@ SVC_PEDESTRIAN
pedestrian
#define UNUSED_PARAMETER(x)
A road/street connecting two junctions.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSJunction * getFromJunction() const
double getLength() const
return the length of the edge
const MSJunction * getToJunction() const
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static bool gLefthand
Whether lefthand-drive is being simulated.
Representation of a lane in the micro simulation.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
The simulated network and simulation perfomer.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Position getPosition(const MSStageMoving &stage, SUMOTime now) const
return the network coordinate of the container
double getAngle(const MSStageMoving &stage, SUMOTime now) const
return the direction in which the container heading to
SUMOTime computeDuration(const MSEdge *prev, const MSStageMoving &stage, SUMOTime currentTime)
compute tranship time on edge and update state members
static const double LATERAL_OFFSET
the offset for computing container positions when being transhiped
CState(MoveToNextEdge *cmd, std::istringstream *in=nullptr)
MSPModel_NonInteracting * myModel
virtual ~MoveToNextEdge()
SUMOTime execute(SUMOTime currentTime)
Executes the command.
implementation of callbacks to retrieve various state information from the model
SUMOTime getEventTime() const
const MSEdge * getNextEdge(const MSStageMoving &stage) const
return the list of internal edges if the transportable is on an intersection
SUMOTime myCurrentDuration
SUMOTime getWaitingTime(const MSStageMoving &stage, SUMOTime now) const
return the time the transportable spent standing
virtual double getAngle(const MSStageMoving &stage, SUMOTime now) const
return the direction in which the transportable faces in degrees
double getSpeed(const MSStageMoving &stage) const
return the current speed of the transportable
virtual Position getPosition(const MSStageMoving &stage, SUMOTime now) const
return the network coordinate of the transportable
virtual SUMOTime computeDuration(const MSEdge *prev, const MSStageMoving &stage, SUMOTime currentTime)
compute walking time on edge and update state members
double getEdgePos(const MSStageMoving &stage, SUMOTime now) const
abstract methods inherited from PedestrianState
PState(MoveToNextEdge *cmd, std::istringstream *in=nullptr)
void saveState(std::ostringstream &out)
Saves the current state into the given stream.
MSTransportableStateAdapter * add(MSTransportable *transportable, MSStageMoving *stage, SUMOTime now)
register the given transportable
MSPModel_NonInteracting(const OptionsCont &oc, MSNet *net)
Constructor (it should not be necessary to construct more than one instance)
void remove(MSTransportableStateAdapter *state)
remove the specified person from the pedestrian simulation
~MSPModel_NonInteracting()
MSTransportableStateAdapter * loadState(MSTransportable *transportable, MSStageMoving *stage, std::istringstream &in)
load the state of the given transportable
int myNumActivePedestrians
the total number of active pedestrians
MSNet * myNet
the net to which to issue moveToNextEdge commands
static const int BACKWARD
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk
static const int UNDEFINED_DIRECTION
virtual double getArrivalPos() const
Position getLanePosition(const MSLane *lane, double at, double offset) const
get position on lane at length at with orthogonal offset
double getEdgeAngle(const MSEdge *e, double at) const
get angle of the edge at a certain position
ConstMSEdgeVector getEdges() const
the edges of the current stage
const MSEdge * getEdge() const
Returns the current edge.
virtual const MSEdge * getNextRouteEdge() const =0
double getDepartPos() const
const MSEdge * getFromEdge() const
Returns first edge of the containers route.
virtual double getMaxSpeed(const MSTransportable *const transportable=nullptr) const =0
the maximum speed of the transportable
bool isPerson() const
Whether it is a person.
abstract base class for managing callbacks to retrieve various state information from the model
A storage for options typed value containers)
A point in 2D or 3D with translation and scaling methods.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.