54 MSStoppingPlace* toStop,
const double arrivalPos,
const double arrivalPosLat,
55 const std::vector<std::string>& lines,
const std::string& group,
56 const std::string& intendedVeh,
SUMOTime intendedDepart) :
59 myLines(lines.begin(), lines.end()),
186 if (veh !=
nullptr) {
220 const std::string modeName = isPerson ?
"driving" :
"transported";
222 "waiting for " +
joinToString(
myLines,
",") + intended +
" then " + modeName +
" to " + dest :
223 modeName +
" to " + dest;
233 const bool isPerson = transportable->
isPerson();
237 const std::string vehID = *
myLines.begin();
239 if (startVeh ==
nullptr && net->
hasFlow(vehID)) {
242 if (startVeh ==
nullptr) {
243 throw ProcessError(
"Vehicle '" + vehID +
"' not found for triggered departure of " +
244 (isPerson ?
"person" :
"container") +
" '" + transportable->
getID() +
"'.");
249 WRITE_WARNING(
TLF(
"Vehicle '%' exceeds personCapacity % when placing triggered person '%', time=%",
255 WRITE_WARNING(
TLF(
"Vehicle '%' exceeds containerCapacity % when placing triggered container '%', time=%",
267 myVehicle->addTransportable(transportable);
287 const bool triggered = availableVehicle !=
nullptr &&
290 if (triggered && !availableVehicle->
hasDeparted()) {
295 myVehicle->addTransportable(transportable);
313 const MSEdge* accessEdge = &access.lane->getEdge();
316 toPos = access.endPos;
323 for (
const auto& access :
myOriginStop->getAllAccessPos()) {
324 const MSEdge* accessEdge = &access.lane->getEdge();
335 MSDevice_Taxi::addReservation(transportable,
getLines(), now, now, -1,
myWaitingEdge,
myWaitingPos,
myOriginStop, to, toPos,
myDestinationStop,
myGroup);
402 std::string comment =
"";
421 if (withRouteLength) {
490 if (vehicleArrived) {
496 if (stop !=
nullptr) {
499 if (access.exit != exit) {
506 if (train !=
nullptr) {
511 const std::vector<MSTrainHelper::Carriage*>& carriages = trainHelper.
getCarriages();
527 if (unboardingPositions.empty()) {
529 const double defaultPassengerRadius =
MAX2(defaultPedestrianType->
getLength(), defaultPedestrianType->
getWidth()) / 2.;
533 const Position availableUnboardingPosition = unboardingPositions.back();
534 unboardingPositions.pop_back();
606 bool canLeave =
false;
624 if (accessPos >= 0) {
630 canLeave = stop.
isInRange(accessPos, tolerance);
640 const bool hasVehicle =
myVehicle !=
nullptr;
657 myVehicle->addTransportable(transportable);
std::vector< const MSEdge * > ConstMSEdgeVector
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNING(msg)
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
const std::string DEFAULT_PEDTYPE_ID
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_TAXI
vehicle is a taxi
const std::string LINE_ANY
const long long int VEHPARS_ARRIVALPOS_SET
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ 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)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
MSDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists, nullptr otherwise.
static void updateReservationFromPos(MSTransportable *person, const std::set< std::string > &lines, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group, double newFromPos)
update reservation's fromPos due to pre-booking
static void addReservation(MSTransportable *person, const std::set< std::string > &lines, SUMOTime reservationTime, SUMOTime pickupTime, SUMOTime earliestPickupTime, const MSEdge *from, double fromPos, const MSStoppingPlace *fromStop, const MSEdge *to, double toPos, const MSStoppingPlace *toStop, const std::string &group)
add new reservation
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
bool compatibleLine(const Reservation *res)
whether the given reservation is compatible with the taxi line
std::vector< Position > & getUnboardingPositions()
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.
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
double getLength() const
return the length of the edge
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static double gStopTolerance
The tolerance to apply when matching waiting persons and vehicles.
static bool gLefthand
Whether lefthand-drive is being simulated.
SUMOVehicle * getLastFlowVehicle(const std::string &id) const
return the last vehicle for the given flow
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
double interpolateGeometryPosToLanePos(double geometryPos) const
virtual const PositionVector & getShape(bool) const
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
bool hasFlow(const std::string &id) const
return whether the given flow is known
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static const int UNDEFINED_DIRECTION
SUMOTime execute(SUMOTime currentTime)
Executes the command.
SUMOTime myEarliestPickupTime
MSTransportable * myTransportable
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.
SUMOTime getWaitingTime() const
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
void registerWaiting(MSTransportable *transportable, SUMOTime now)
brief register waiting person (on proceed or loadState)
void init(MSTransportable *transportable)
initialization, e.g. for param-related events
MSStageDriving(const MSEdge *origin, const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const double arrivalPosLat, const std::vector< std::string > &lines, const std::string &group="", const std::string &intendedVeh="", SUMOTime intendedDepart=-1)
constructor
SUMOTime getTimeLoss(const MSTransportable *transportable) const
double getSpeed() const
the speed of the transportable
bool canLeaveVehicle(const MSTransportable *t, const SUMOVehicle &veh, const MSStop &stop)
checks whether the person may exit at the current vehicle position
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.
BookReservation * myReservationCommand
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
SUMOTime getDuration() const
const std::set< std::string > myLines
the lines to choose from
SUMOTime myTimeLoss
While driving, this is the timeLoss of the vehicle when the ride started, after arrival this is the t...
const std::set< std::string > & getLines() const
double getArrivalPos() const
return default value for undefined arrivalPos
SUMOTime getTravelTime() const
SUMOVehicle * myVehicle
The taken vehicle.
void abort(MSTransportable *t)
abort this stage (TraCI)
int getDirection() const
Return the movement directon on the edge.
const MSEdge * getDestination() const
returns the destination edge
double myArrivalPosLat
the lateral position at which we want to arrive
virtual double getEdgePos(SUMOTime now) const
virtual double getArrivalPos() const
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
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
double getCosts() const
Returns the costs of the stage.
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
bool unspecifiedArrivalPos() const
MSStageType getStageType() const
MSStage(const MSStageType type, const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const double arrivalPosLat=0.0, const std::string &group="")
constructor
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 longitudinal 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
bool isInRange(const double pos, const double tolerance) const
whether the stop is in range of the given position
const MSEdge * getEdge() const
A lane area vehicles can halt at.
const std::vector< Access > & getAllAccessPos() const
lanes and positions connected to this stop
const std::string & getMyName() const
A class that helps computing positions of a train's carriages and additional structures.
void computeDoorPositions()
compute door positions on demand and fills the carriage structures
const std::vector< Carriage * > & getCarriages() const
void computeUnboardingPositions(double passengerRadius, std::vector< Position > &unboardingPositions)
compute unboarding positions on demand and fills the carriage structures
int getNumCarriages() const
int getCarriageDoors() const
int getFirstPassengerCarriage() const
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
const MSEdge * getDestination() const
Returns the current destination.
MSStage * getNextStage(int offset) const
Return the next (or previous) stage denoted by the offset.
int getNumRemainingStages() const
Return the number of remaining stages (including the current).
bool isPerson() const override
Whether it is a person.
int getCurrentStageIndex() const
Return the index of the current stage.
const SUMOVehicleParameter & getParameter() const override
Returns the vehicle's parameter (including departure definition).
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
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.
void handleTriggeredDepart(SUMOVehicle *v, bool add)
register / unregister depart-triggered vehicles with edges
Representation of a vehicle in the micro simulation.
double getAngle() const
Returns the vehicle's direction in radians.
The car-following model and parameter.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
const std::string & getID() const
Returns the name of the vehicle type.
double getLength() const
Get vehicle's length [m].
const SUMOVTypeParameter & getParameter() const
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 & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
void setParameters(const Parameterised ¶ms)
set the given key/value map in map<string, string> format
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
void norm2D()
Normalizes the given vector.
double x() const
Returns the x-position.
void add(const Position &pos)
Adds the given position to this one.
double y() const
Returns the y-position.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Position transformToVectorCoordinates(const Position &p, bool extend=false) const
return position p within the length-wise coordinate system defined by this position vector....
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1).
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition).
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
int personCapacity
The person capacity of the vehicle.
int containerCapacity
The container capacity of the vehicle.
double carriageDoorWidth
the width of the carriage doors
Representation of a vehicle.
virtual bool stopsAtEdge(const MSEdge *edge) const =0
Returns whether the vehicle stops at the given edge.
virtual bool stopsAt(MSStoppingPlace *stop) const =0
Returns whether the vehicle stops at the given stopping place.
virtual int getPersonNumber() const =0
Returns the number of persons.
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
virtual double getLength() const =0
Returns the vehicles's length.
virtual int getContainerNumber() const =0
Returns the number of containers.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double departPos
(optional) The position the vehicle shall depart from
double arrivalPos
(optional) The position the vehicle shall arrive on
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.
std::vector< Position > doorPositions