 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
49 MSStoppingPlace* toStop,
const double arrivalPos,
const std::vector<std::string>& lines) :
52 arrivalPos, destination->getLength(),
SUMO_ATTR_ARRIVALPOS,
"container getting transported to " + destination->getID()),
61 return new MSContainerStage_Driving(myDestination, myDestinationStop, myArrivalPos, std::vector<std::string>(myLines.begin(), myLines.end()));
70 myWaitingEdge = previous->
getEdge();
76 setVehicle(availableVehicle);
77 myVehicle->addContainer(container);
83 myWaitingEdge->addContainer(container);
96 const std::string dest = (getDestinationStop() ==
nullptr ?
98 " stop '" + getDestinationStop()->getID() +
"'");
100 "waiting for " +
joinToString(myLines,
",") +
" then transported to " + dest :
101 "transported to " + dest;
109 const SUMOTime departed = myDeparted >= 0 ? myDeparted : now;
117 (myDeparted >= 0 ?
time2string(now - myDeparted) :
"-1"));
118 os.
writeAttr(
"routeLength", myVehicleDistance);
127 if (withRouteLength) {
128 os.
writeAttr(
"routeLength", myVehicleDistance);
140 double departPos,
double arrivalPos) :
143 "container getting transhipped to " + route.back()->
getID()),
145 mySpeed(speed), myContainerState(nullptr), myCurrentInternalEdge(nullptr) {
148 "container getting transhipped from " +
myRoute.front()->getID());
165 myRouteStep = myRoute.end() - 1;
168 (*myRouteStep)->addContainer(container);
173 if (myCurrentInternalEdge !=
nullptr) {
174 return myCurrentInternalEdge;
182 return myRoute.front();
187 return myRoute.back();
192 return myContainerState->getEdgePos(*
this, now);
197 return myContainerState->getPosition(*
this, now);
202 return myContainerState->getAngle(*
this, now);
212 return myContainerState->getSpeed(*
this);
223 if (myArrived >= 0) {
224 const SUMOTime duration = myArrived - myDeparted;
237 os.
writeAttr(
"arrivalPos", myArrivalPos);
239 os.
writeAttr(
"routeLength", getDistance());
249 if (withRouteLength) {
250 os.
writeAttr(
"routeLength", mySpeed * (myArrived - myDeparted));
259 .
writeAttr(
"agent", c.
getID()).writeAttr(
"link", myRoute.front()->getID()).closeTag();
266 .
writeAttr(
"agent", c.
getID()).writeAttr(
"link", myRoute.back()->getID()).closeTag();
272 if (myRouteStep == myRoute.end() - 1) {
273 if (myDestinationStop !=
nullptr) {
274 myDestinationStop->addTransportable(container);
281 if (nextInternal ==
nullptr) {
283 myCurrentInternalEdge =
nullptr;
285 myCurrentInternalEdge = nextInternal;
294 const std::string dest = (getDestinationStop() ==
nullptr ?
296 " stop '" + getDestinationStop()->getID() +
"'");
297 return "transhipped to " + dest;
320 (*myStep)->proceed(net,
this, time, prior);
335 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
336 (*i)->tripInfoOutput(os,
this);
348 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
349 (*i)->routeOutput(os, withRouteLength);
The car-following model and parameter.
const MSLane & getLane() const
Returns the lane this stop is located at.
SUMOTime getWaitingTime(SUMOTime now) const
Returns the time the container spent waiting.
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
A lane area vehicles can halt at.
const MSEdge * getDestination() const
Returns the current destination.
virtual bool proceed(MSNet *net, SUMOTime time)
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
Static storage of an output device and its base (abstract) implementation.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
void removeWaiting(const MSEdge *const edge, const SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles for the given edge.
virtual void erase(MSTransportable *transportable)
removes a single transportable
The simulated network and simulation perfomer.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Representation of a vehicle.
std::vector< const MSEdge * > ConstMSEdgeVector
MSContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportablePlan *plan)
constructor
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
virtual void setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now)
logs end of the step
virtual double getEdgePos(SUMOTime now) const
Structure representing possible vehicle parameter.
double getSpeed() const
Returns the speed of the container.
virtual bool proceed(MSNet *net, SUMOTime time)=0
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
virtual ~MSContainer()
destructor
virtual const MSEdge * getEdge() const
Returns the current edge.
std::vector< const MSEdge * > myRoute
The route of the container.
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const MSEdge * getEdge() const
Returns the current edge.
MSContainerStage_Tranship(const std::vector< const MSEdge * > &route, MSStoppingPlace *toStop, double speed, double departPos, double arrivalPos)
constructor
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
const MSEdge * getFromEdge() const
Returns first edge of the containers route.
~MSContainerStage_Driving()
destructor
CState * add(MSTransportable *container, MSContainer::MSContainerStage_Tranship *stage, SUMOTime now)
register the given container as a transhiped container
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool moveToNextEdge(MSTransportable *container, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the container arrived
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
A point in 2D or 3D with translation and scaling methods.
std::string time2string(SUMOTime t)
bool isWaiting4Vehicle() const
Whether the transportable waits for a vehicle.
std::string getStageDescription() const
returns the stage description as a string
A road/street connecting two junctions.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
~MSContainerStage_Tranship()
destructor
MSEdge & getEdge() const
Returns the lane's edge.
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
double myDepartPos
the depart position
ConstMSEdgeVector getEdges() const
the edges of the current stage
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
SUMOTime getDesiredDepart() const
Returns the desired departure time.
void lf()
writes a line feed if applicable
const std::string & getID() const
returns the id of the transportable
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
double getEdgePos(SUMOTime now) const
Returns the offset from the start of the current edge measured in its natural direction.
double getDistance() const
get travel distance in this stage
std::string getStageSummary() const
return string summary of the current stage
MSTransportablePlan::iterator myStep
the iterator over the route
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
MSTransportablePlan * myPlan
the plan of the transportable
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const MSEdge *const edge, const double position)
double getAngle(SUMOTime now) const
Returns the angle of the container.
const MSEdge * getFromEdge() const
Returns the departure edge.
virtual void beginEventOutput(const MSTransportable &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
The departure is container triggered.
const MSEdge * getToEdge() const
Returns last edge of the containers route.
const std::string & getID() const
Returns the id.
MSContainerStage_Driving(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines)
constructor
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
static MSCModel_NonInteracting * getModel()
std::string getStageSummary() const
return string summary of the current stage
void unregisterOneWaiting(const bool isPerson)
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
Position getPosition(SUMOTime now) const
Returns the position of the container.
virtual void endEventOutput(const MSTransportable &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
const MSEdge * getEdge() const
Returns the current edge.