58 myDestination(destination),
59 myDestinationStop(toStop),
60 myArrivalPos(arrivalPos),
154 return e->
getLanes()[0]->getShape().rotationAtOffset(at);
162 if (newDestStop !=
nullptr) {
175 const std::string& vTypes,
const double speed,
const double walkFactor,
176 const std::string& group,
177 const double departPosLat,
const bool hasArrivalPos,
const double arrivalPos):
180 myOriginStop(fromStop),
181 myDuration(duration),
185 myWalkFactor(walkFactor),
187 myDepartPosLat(departPosLat),
188 myHaveArrivalPos(hasArrivalPos) {
232 std::vector<SUMOVehicleParameter*> pars;
235 pars.back()->vtypeid = st.next();
238 pars.back()->id = transportable->
getID() +
"_" +
toString(pars.size() - 1);
243 pars.back()->id = transportable->
getID() +
"_0";
248 pars.back()->id = transportable->
getID() +
"_taxi";
249 pars.back()->line =
"taxi";
253 pars.back()->id = transportable->
getID() +
"_b0";
257 pars.push_back(
nullptr);
278 if (vehPar !=
nullptr) {
287 WRITE_WARNING(
"Ignoring vehicle type '" + type->
getID() +
"' when routing person '" + transportable->
getID() +
"' because it is not allowed on the start edge.");
293 bool carUsed =
false;
294 std::vector<MSNet::MSIntermodalRouter::TripItem> result;
298 for (std::vector<MSNet::MSIntermodalRouter::TripItem>::iterator it = result.begin(); it != result.end(); ++it) {
299 if (!it->edges.empty()) {
301 double localArrivalPos = bs !=
nullptr ? bs->
getAccessPos(it->edges.back()) : it->edges.back()->getLength() / 2.;
305 if (it->line ==
"") {
312 const MSEdge* first = it->edges.front();
321 depPos = it->edges.front()->getLength();
328 const MSEdge* last = it->edges.back();
336 transportable->
appendStage(previous, stageIndex++);
339 if (prevEdges.size() >= 2) {
342 const MSEdge* last = prevEdges.back();
343 const MSEdge* prev = prevEdges[prevEdges.size() - 2];
350 previous =
new MSStageDriving(
nullptr, it->edges.back(), bs, localArrivalPos, std::vector<std::string>({
"taxi" }),
myGroup);
351 transportable->
appendStage(previous, stageIndex++);
352 }
else if (vehicle !=
nullptr && it->line == vehicle->
getID()) {
353 if (bs ==
nullptr && it + 1 != result.end()) {
355 localArrivalPos = it->edges.back()->getLength();
357 previous =
new MSStageDriving(
nullptr, it->edges.back(), bs, localArrivalPos, std::vector<std::string>({ it->line }));
358 transportable->
appendStage(previous, stageIndex++);
364 previous =
new MSStageDriving(
nullptr, it->edges.back(), bs, localArrivalPos, std::vector<std::string>({ it->line }),
myGroup, it->intended,
TIME2STEPS(it->depart));
365 transportable->
appendStage(previous, stageIndex++);
376 if (vehicle !=
nullptr && (isTaxi || !carUsed)) {
394 transportable->
proceed(net, now);
409 const bool initial) :
411 pos, destination->getLength(),
SUMO_ATTR_DEPARTPOS,
"stopping at " + destination->getID()),
413 myWaitingDuration(duration),
414 myWaitingUntil(until),
452 if (
dynamic_cast<MSPerson*
>(transportable) !=
nullptr) {
479 std::string comment =
"";
518 std::string timeInfo;
588 assert(routeOffset >= 0);
589 assert(routeOffset < (
int)
myRoute.size());
597 assert(routeOffset >= 0);
598 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.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool compute(const E *from, const E *to, const double departPos, 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.
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 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.
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 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 getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, MSStage *previous)
proceeds to the next step
double getAngle(SUMOTime now) const
returns the angle of the transportable
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.
bool addTransportable(MSTransportable *p)
adds a transportable to this stop
double getEndLanePosition() const
Returns the end position of this stop.
const std::string & getMyName() const
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 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, std::mt19937 *rng=nullptr)
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 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(std::mt19937 *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)=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.