48 MSStoppingPlace* toStop,
const double arrivalPos,
const std::vector<std::string>& lines,
49 const std::string& group,
50 const std::string& intendedVeh,
SUMOTime intendedDepart) :
53 myLines(lines.begin(), lines.end()),
57 myVehicleDistance(-1.),
60 myWaitingEdge(nullptr),
62 myOriginStop(nullptr),
63 myIntendedVehicleID(intendedVeh),
64 myIntendedDepart(intendedDepart) {
153 if (veh !=
nullptr) {
187 const std::string modeName = isPerson ?
"driving" :
"transported";
189 "waiting for " +
joinToString(
myLines,
",") + intended +
" then " + modeName +
" to " + dest :
190 modeName +
" to " + dest;
200 const bool isPerson = transportable->
isPerson();
204 const std::string vehID = *
myLines.begin();
206 if (startVeh ==
nullptr) {
207 throw ProcessError(
"Vehicle '" + vehID +
"' not found for triggered departure of " +
208 (isPerson ?
"person" :
"container") +
" '" + transportable->
getID() +
"'.");
236 const bool triggered = availableVehicle !=
nullptr &&
239 if (triggered && !availableVehicle->
hasDeparted()) {
256 const MSEdge* access = &std::get<0>(tuple)->getEdge();
259 toPos = std::get<1>(tuple);
267 const MSEdge* access = &std::get<0>(tuple)->getEdge();
312 os.
openTag(isPerson ?
"ride" :
"transport");
319 std::string comment =
"";
335 if (withRouteLength) {
352 || (
myLines.count(
"ANY") > 0 && (
392 return myArrivalPos == std::numeric_limits<double>::infinity();
402 if (vehicleArrived) {
466 bool canLeave =
false;
485 if (accessPos >= 0) {
501 const bool hasVehicle =
myVehicle !=
nullptr;
std::vector< const MSEdge * > ConstMSEdgeVector
std::string time2string(SUMOTime t)
convert SUMOTime to string
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_TAXI
vehicle is a taxi
const int VEHPARS_ARRIVALPOS_SET
@ DEPART_CONTAINER_TRIGGERED
The departure is container triggered.
@ DEPART_TRIGGERED
The departure is person triggered.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void removeReservation(MSTransportable *person, const std::set< std::string > &lines, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group)
retract reservation
static bool isReservation(const std::set< std::string > &lines)
whether the given lines description is a taxi call
static void addReservation(MSTransportable *person, const std::set< std::string > &lines, SUMOTime reservationTime, SUMOTime pickupTime, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group)
add new reservation
bool compatibleLine(const Reservation *res)
whether the given reservation is compatible with the taxi line
static void addRideTransportData(const bool isPerson, const double distance, const SUMOTime duration, const SUMOVehicleClass vClass, const std::string &line, const SUMOTime waitingTime)
record tripinfo data for rides and transports
A road/street connecting two junctions.
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const double position) const
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
virtual void addPerson(MSTransportable *p) const
double getLength() const
return the length of the edge
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
static double gStopTolerance
The tolerance to apply when matching waiting persons and vehicles.
static bool gLefthand
Whether lefthand-drive is being simulated.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
MSEdge & getEdge() const
Returns the lane's edge.
The simulated network and simulation perfomer.
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.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static const int UNDEFINED_DIRECTION
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
MSStoppingPlace * myOriginStop
the stop at which this ride starts (or nullptr)
const MSEdge * getEdge() const
Returns the current edge.
void loadState(MSTransportable *transportable, std::istringstream &state)
Reconstructs the current state.
void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, MSStage *previous)
proceeds to this stage
std::string myVehicleID
cached vehicle data for output after the vehicle has been removed
virtual ~MSStageDriving()
destructor
ConstMSEdgeVector getEdges() const
the edges of the current stage
std::string getWaitingDescription() const
Return where the person waits and for what.
const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
marks arrival time and records driven distance
std::string myIntendedVehicleID
double getEdgePos(SUMOTime now) const
double getAngle(SUMOTime now) const
returns the angle of the transportable
const std::set< std::string > & getLines() const
bool unspecifiedArrivalPos() const
double getSpeed() const
the speed of the transportable
bool isWaitingFor(const SUMOVehicle *vehicle) const
Whether the person waits for the given vehicle.
Position getPosition(SUMOTime now) const
returns the position of the transportable
void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
const MSEdge * myOrigin
the origin edge
const MSLane * getLane() const
Returns the current lane (if applicable)
SUMOVehicleClass myVehicleVClass
std::string getStageDescription(const bool isPerson) const
return (brief) string representation of the current stage
void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const
Called on writing vehroute output.
const MSEdge * getFromEdge() const
SUMOTime myWaitingSince
The time since which this person is waiting for a ride.
std::string myVehicleLine
void saveState(std::ostringstream &out)
Saves the current state into the given stream.
const MSEdge * myWaitingEdge
SUMOTime myIntendedDepart
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
void setVehicle(SUMOVehicle *v)
std::string myVehicleType
double getDistance() const
get travel distance in this stage
const std::set< std::string > myLines
the lines to choose from
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
SUMOTime myTimeLoss
While driving, this is the timeLoss of the vehicle when the ride started, after arrival this is the t...
double getArrivalPos() const
return default value for undefined arrivalPos
bool canLeaveVehicle(const MSTransportable *t, const SUMOVehicle &veh)
checks whether the person may exit at the current vehicle position
SUMOVehicle * myVehicle
The taken vehicle.
void abort(MSTransportable *t)
abort this stage (TraCI)
int getDirection() const
Return the movement directon on the edge.
MSStageDriving(const MSEdge *origin, const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group="", const std::string &intendedVeh="", SUMOTime intendedDepart=-1)
constructor
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
const MSEdge * getDestination() const
returns the destination edge
virtual double getEdgePos(SUMOTime now) const
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
const std::string myGroup
The id of the group of transportables traveling together.
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)
MSStageType getStageType() const
SUMOTime myArrived
the time at which this stage ended
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
SUMOTime myDeparted
the time at which this stage started
A lane area vehicles can halt at.
double getWaitingPositionOnLane(MSTransportable *t) const
Returns the lane position corresponding to getWaitPosition()
double getBeginLanePosition() const
Returns the begin position of this stop.
const std::vector< std::tuple< MSLane *, double, double > > & getAllAccessPos() const
lanes and positions connected to this stop
SumoXMLTag getElement() const
return the type of this stopping place
double getEndLanePosition() const
Returns the end position of this stop.
void removeTransportable(const MSTransportable *p)
Removes a transportable from this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
const std::string & getMyName() const
Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
void abortWaitingForVehicle(MSTransportable *t)
let the given transportable abort waiting for a vehicle (when removing stage via TraCI)
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
bool isPerson() const
Whether it is a person.
int getNumStages() const
Return the total number stages in this persons plan.
const MSEdge * getDestination() const
Returns the current destination.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void unregisterOneWaiting()
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
Representation of a vehicle in the micro simulation.
double getAngle() const
Returns the vehicle's direction in radians.
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
virtual double getSpeed() const =0
Returns the object's current speed.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.
virtual void removeTransportable(MSTransportable *t)=0
removes a person or container
virtual bool stopsAtEdge(const MSEdge *edge) const =0
Returns whether the vehicle stops at the given edge.
virtual SUMOTime getTimeLoss() const =0
virtual bool stopsAt(MSStoppingPlace *stop) const =0
Returns whether the vehicle stops at the given stopping place.
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
virtual double getOdometer() const =0
Returns the distance that was already driven by this vehicle.
virtual double getLength() const =0
Returns the vehicles's length.
virtual void addTransportable(MSTransportable *transportable)=0
Adds a person or container to this vehicle.
virtual double getArrivalPos() const =0
Returns this vehicle's desired arrivalPos for its current route (may change on reroute)
virtual bool isStoppedInRange(const double pos, const double tolerance) const =0
Returns whether the vehicle is stopped in the range of the given position.
double arrivalPos
(optional) The position the vehicle shall arrive on
bool wasSet(int what) const
Returns whether the given parameter was set.
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.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
std::string line
The vehicle's line (mainly for public transport)
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.