58 myDestination(destination),
59 myDestinationStop(toStop),
60 myArrivalPos(arrivalPos),
159 return e->
getLanes()[0]->getShape().rotationAtOffset(at);
167 if (newDestStop !=
nullptr) {
180 const std::string& vTypes,
const double speed,
const double walkFactor,
181 const std::string& group,
182 const double departPosLat,
const bool hasArrivalPos,
const double arrivalPos):
185 myOriginStop(fromStop),
186 myDuration(duration),
190 myWalkFactor(walkFactor),
192 myDepartPosLat(departPosLat),
193 myHaveArrivalPos(hasArrivalPos) {
237 std::vector<SUMOVehicleParameter*> pars;
240 pars.back()->vtypeid = st.next();
243 pars.back()->id = transportable->
getID() +
"_" +
toString(pars.size() - 1);
248 pars.back()->id = transportable->
getID() +
"_0";
253 pars.back()->id = transportable->
getID() +
"_taxi";
254 pars.back()->line =
"taxi";
258 pars.back()->id = transportable->
getID() +
"_b0";
262 pars.push_back(
nullptr);
283 if (vehPar !=
nullptr) {
292 WRITE_WARNING(
"Ignoring vehicle type '" + type->
getID() +
"' when routing person '" + transportable->
getID() +
"' because it is not allowed on the start edge.");
298 bool carUsed =
false;
299 std::vector<MSNet::MSIntermodalRouter::TripItem> result;
310 for (std::vector<MSNet::MSIntermodalRouter::TripItem>::iterator it = result.begin(); it != result.end(); ++it) {
311 if (!it->edges.empty()) {
313 double localArrivalPos = bs !=
nullptr ? bs->
getAccessPos(it->edges.back()) : it->edges.back()->getLength() / 2.;
317 if (it->line ==
"") {
324 const MSEdge* first = it->edges.front();
333 depPos = it->edges.front()->getLength();
340 const MSEdge* last = it->edges.back();
348 transportable->
appendStage(previous, stageIndex++);
351 if (prevEdges.size() >= 2) {
354 const MSEdge* last = prevEdges.back();
355 const MSEdge* prev = prevEdges[prevEdges.size() - 2];
362 previous =
new MSStageDriving(
nullptr, it->edges.back(), bs, localArrivalPos, std::vector<std::string>({
"taxi" }),
myGroup);
363 transportable->
appendStage(previous, stageIndex++);
364 }
else if (vehicle !=
nullptr && it->line == vehicle->
getID()) {
365 if (bs ==
nullptr && it + 1 != result.end()) {
367 localArrivalPos = it->edges.back()->getLength();
369 previous =
new MSStageDriving(
nullptr, it->edges.back(), bs, localArrivalPos, std::vector<std::string>({ it->line }));
370 transportable->
appendStage(previous, stageIndex++);
376 previous =
new MSStageDriving(
nullptr, it->edges.back(), bs, localArrivalPos, std::vector<std::string>({ it->line }),
myGroup, it->intended,
TIME2STEPS(it->depart));
377 transportable->
appendStage(previous, stageIndex++);
388 if (vehicle !=
nullptr && (isTaxi || !carUsed)) {
406 transportable->
proceed(net, now);
421 const bool initial) :
423 pos, destination->getLength(),
SUMO_ATTR_DEPARTPOS,
"stopping at " + destination->getID()),
425 myWaitingDuration(duration),
426 myWaitingUntil(until),
475 if (
dynamic_cast<MSPerson*
>(transportable) !=
nullptr) {
502 std::string comment =
"";
551 std::string timeInfo;
559 std::string nameMsg =
"";
582 if (
dynamic_cast<MSPerson*
>(transportable) !=
nullptr) {
656 assert(routeOffset >= 0);
657 assert(routeOffset < (
int)
myRoute.size());
665 assert(routeOffset >= 0);
666 assert(routeOffset < (
int)edges.size());
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
const std::string DEFAULT_TAXITYPE_ID
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_BIKETYPE_ID
@ RANDOM
The position is chosen randomly.
@ GIVEN
The position is given.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_VTYPE_SET
@ DEPART_TRIGGERED
The departure is person triggered.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_STOP
stop for vehicles
#define UNUSED_PARAMETER(x)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool compute(const E *from, const E *to, const double departPos, const std::string &originStopID, const double arrivalPos, const std::string &stopID, const double speed, const V *const vehicle, const SVCPermissions modeSet, const SUMOTime msTime, std::vector< TripItem > &into, const double externalFactor=0.)
Builds the route between the given edges using the minimum effort at the given time The definition of...
A road/street connecting two junctions.
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
const MSEdgeVector & getPredecessors() const
virtual void addPerson(MSTransportable *p) const
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSJunction * getFromJunction() const
double getLength() const
return the length of the edge
bool isTazConnector() const
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
const MSJunction * getToJunction() const
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
virtual void removePerson(MSTransportable *p) const
static bool gLefthand
Whether lefthand-drive is being simulated.
Representation of a lane in the micro simulation.
const PositionVector & getShape() const
Returns this lane's shape.
double interpolateLanePosToGeometryPos(double lanePos) const
The simulated network and simulation perfomer.
MSIntermodalRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual MSTransportableControl & getContainerControl()
Returns the container control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static const int UNDEFINED_DIRECTION
virtual ~MSStage()
destructor
const MSEdge * getDestination() const
returns the destination edge
virtual ConstMSEdgeVector getEdges() const
the edges of the current stage
virtual double getEdgePos(SUMOTime now) const
virtual int getDirection() const
Return the movement directon on the edge.
virtual const MSEdge * getFromEdge() const
MSStage(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, MSStageType type, const std::string &group="")
constructor
virtual double getArrivalPos() const
SUMOTime getDeparted() const
get departure time of stage
void setDeparted(SUMOTime now)
logs end of the step
virtual bool isWaitingFor(const SUMOVehicle *vehicle) const
Whether the transportable waits for the given vehicle.
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
virtual const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
SUMOTime getArrived() const
get arrival time of stage
void setArrivalPos(double arrivalPos)
virtual double getSpeed() const
the speed of the transportable
SUMOTime myArrived
the time at which this stage ended
void setDestination(const MSEdge *newDestination, MSStoppingPlace *newDestStop)
Position getLanePosition(const MSLane *lane, double at, double offset) const
get position on lane at length at with orthogonal offset
MSStageType myType
The type of this stage.
double getEdgeAngle(const MSEdge *e, double at) const
get angle of the edge at a certain position
virtual const MSEdge * getEdge() const
Returns the current edge.
static const double ROADSIDE_OFFSET
the offset for computing positions when standing at an edge
double myArrivalPos
the 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
const MSEdge * myDestination
the next edge to reach by getting transported
virtual SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
SUMOTime myDeparted
the time at which this stage started
double getAngle(SUMOTime now) const
Returns the angle of the container.
const MSLane * getLane() const
Returns the current lane.
double getEdgePos(SUMOTime now) const
Returns the offset from the start of the current edge measured in its natural direction.
int getDirection() const
Return the movement directon on the edge.
MSTransportableStateAdapter * myState
state that is to be manipulated by MSPModel
ConstMSEdgeVector getEdges() const
the edges of the current stage
SUMOTime getWaitingTime(SUMOTime now) const
Returns the time the container spent waiting.
double getSpeed() const
Returns the speed of the container.
MSEdge * myCurrentInternalEdge
The current internal edge this transportable is on or nullptr.
Position getPosition(SUMOTime now) const
Returns the position of the container.
const MSEdge * getEdge() const
Returns the current edge.
virtual void setRouteIndex(MSTransportable *const transportable, int routeOffset)
place transportable on a previously passed edge
std::vector< const MSEdge * > myRoute
The route of the container.
const MSEdge * getFromEdge() const
Returns first edge of the containers route.
virtual void replaceRoute(MSTransportable *const transportable, const ConstMSEdgeVector &edges, int routeOffset)
std::vector< const MSEdge * >::iterator myRouteStep
current step
virtual ~MSStageMoving()
destructor
const bool myHaveArrivalPos
whether an arrivalPos was in the input
double getAngle(SUMOTime now) const
returns the angle of the transportable
MSStageTrip(const MSEdge *origin, MSStoppingPlace *fromStop, const MSEdge *destination, MSStoppingPlace *toStop, const SUMOTime duration, const SVCPermissions modeSet, const std::string &vTypes, const double speed, const double walkFactor, const std::string &group, const double departPosLat, const bool hasArrivalPos, const double arrivalPos)
constructor
void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, MSStage *previous)
proceeds to the next step
const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
const std::string myVTypes
The possible vehicles to use.
double myDepartPos
The depart position.
double getEdgePos(SUMOTime now) const
const MSEdge * getEdge() const
Returns the current edge.
const MSEdge * myOrigin
the origin edge
const double mySpeed
The walking speed.
MSStoppingPlace * myOriginStop
the origin edge
SUMOTime myDuration
the time the trip should take (applies to only walking)
const double myWalkFactor
The factor to apply to walking durations.
const double myDepartPosLat
The lateral depart position.
const SVCPermissions myModeSet
The allowed modes of transportation.
Position getPosition(SUMOTime now) const
returns the position of the transportable
virtual ~MSStageTrip()
destructor
std::string myGroup
The group for this personTrip.
void loadState(MSTransportable *transportable, std::istringstream &state)
Reconstructs the current state, standard implementation does nothing.
void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const
Called on writing vehroute output.
SUMOTime getUntil() const
SUMOTime myWaitingDuration
the time the person is waiting
SUMOTime myWaitingUntil
the time until the person is waiting
SUMOTime getDuration() const
void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, MSStage *previous)
proceeds to the next step
void saveState(std::ostringstream &out)
Saves the current state into the given stream, standard implementation does nothing.
std::string getStageDescription(const bool isPerson) const
return (brief) string representation of the current stage
double getAngle(SUMOTime now) const
returns the angle of the transportable
Position myStopWaitPos
waiting position at stopping place
SUMOTime myStopEndTime
stores the actual end time of the stop (combination of duration and until)
std::string myActType
The type of activity.
virtual ~MSStageWaiting()
destructor
void abort(MSTransportable *)
abort this stage (TraCI)
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
Position getPosition(SUMOTime now) const
returns the position of the transportable
MSStageWaiting(const MSEdge *destination, MSStoppingPlace *toStop, SUMOTime duration, SUMOTime until, double pos, const std::string &actType, const bool initial)
constructor
void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
SumoXMLTag getElement() const
return the type of this stopping place
double getEndLanePosition() const
Returns the end position of this stop.
const std::string & getMyName() const
Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
bool addTransportable(const MSTransportable *p)
adds a transportable to this stop
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
void setWaitEnd(SUMOTime time, MSTransportable *transportable)
sets the arrival time for a waiting transportable
void abortWaiting(MSTransportable *t)
aborts waiting stage of transportable
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
bool isPerson() const
Whether it is a person.
int getNumStages() const
Return the total number stages in this persons plan.
MSStage * getNextStage(int next) const
Return the current stage.
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
double getMaxSpeed() const
Returns the object's maximum speed.
virtual double getSpeed(const MSStageMoving &stage) const =0
return the current speed of the transportable
virtual int getDirection(const MSStageMoving &stage, SUMOTime now) const =0
return the walking direction (FORWARD, BACKWARD)
virtual Position getPosition(const MSStageMoving &stage, SUMOTime now) const =0
return the network coordinate of the transportable
virtual SUMOTime getWaitingTime(const MSStageMoving &stage, SUMOTime now) const =0
return the time the transportable spent standing
virtual double getEdgePos(const MSStageMoving &stage, SUMOTime now) const =0
return the offset from the start of the current edge measured in its natural direction
virtual const MSLane * getLane() const
whether the transportable is jammed
virtual double getAngle(const MSStageMoving &stage, SUMOTime now) const =0
return the direction in which the transportable faces in degrees
The class responsible for building and deletion of vehicles.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
The car-following model and parameter.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
const std::string & getID() const
Returns the name of the vehicle type.
const std::string & getID() const
Returns the id.
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.
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
Representation of a vehicle.
virtual bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true, std::string *msgReturn=nullptr)=0
Replaces the current route by the given edges.
virtual void setArrivalPos(double arrivalPos)=0
Sets this vehicle's desired arrivalPos for its current route.
Structure representing possible vehicle parameter.
double departPos
(optional) The position the vehicle shall depart from
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
bool hasNext()
returns the information whether further substrings exist
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.