47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
63 : myDestination(destination), myDeparted(-1), myArrived(-1), myType(type) {}
91 return getLanePosition(e->
getLanes()[0], at, offset);
113 myVehicle(0), myDestinationContainerStop(toCS) {}
121 myWaitingEdge = previousEdge;
123 myWaitingSince = now;
126 myVehicle = availableVehicle;
128 myVehicle->addContainer(container);
140 if (myVehicle != 0) {
141 return myVehicle->getEdge();
143 return myWaitingEdge;
149 return myWaitingEdge;
155 if (myVehicle != 0) {
164 if (myVehicle != 0) {
166 return myVehicle->getEdge()->getLanes()[0]->getShape().positionAtOffset(myVehicle->getPositionOnLane());
173 if (myVehicle != 0) {
181 return getEdgeAngle(myWaitingEdge, myWaitingPos) + 90;
186 return myLines.count(line) > 0;
191 return myVehicle == 0;
201 return myVehicle == 0 ? 0 : myVehicle->getSpeed();
211 return myDepartContainerStop;
243 myWaitingDuration(duration),
244 myWaitingUntil(until),
255 return &myDestination;
260 return &myDestination;
270 return myWaitingUntil;
280 return getEdgeAngle(&myDestination, myStartPos) - 180;
285 return now - myWaitingStart;
295 return myCurrentContainerStop;
302 myWaitingStart = now;
303 const SUMOTime until =
MAX3(now, now + myWaitingDuration, myWaitingUntil);
315 if (myWaitingDuration >= 0) {
318 if (myWaitingUntil >= 0) {
344 myDestinationContainerStop(toCS),
345 mySpeed(speed), myContainerState(0), myCurrentInternalEdge(0) {
358 myRouteStep = myRoute.end() - 1;
364 ((
MSEdge*) *myRouteStep)->addContainer(container);
369 if (myCurrentInternalEdge != 0) {
370 return myCurrentInternalEdge;
378 return myRoute.front();
383 return myRoute.back();
388 return myContainerState->getEdgePos(*
this, now);
393 return myContainerState->getPosition(*
this, now);
398 return myContainerState->getAngle(*
this, now);
408 return myContainerState->getSpeed(*
this);
413 return myDepartContainerStop;
433 .
writeAttr(
"agent", c.
getID()).writeAttr(
"link", myRoute.front()->getID()).closeTag();
440 .
writeAttr(
"agent", c.
getID()).writeAttr(
"link", myRoute.back()->getID()).closeTag();
446 if (myRouteStep == myRoute.end() - 1) {
448 if (myDestinationContainerStop != 0) {
449 myDestinationContainerStop->addContainer(container);
456 if (nextInternal == 0) {
458 myCurrentInternalEdge = 0;
460 myCurrentInternalEdge = nextInternal;
477 for (MSContainerPlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
492 SUMOReal atPos = (*myStep)->getEdgePos(time);
493 (*myStep)->setArrived(time);
496 (*myStep)->proceed(net,
this, time, arrivedAt, atPos);
511 (*myStep)->setDeparted(now);
536 return (*myStep)->getSpeed();
541 return (*myStep)->getDepartContainerStop();
546 for (MSContainerPlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
547 (*i)->tripInfoOutput(os);
553 MSContainerPlan::const_iterator i =
myPlan->begin();
557 for (; i !=
myPlan->end(); ++i) {
558 (*i)->routeOutput(os);
MSContainerStage_Tranship(const std::vector< const MSEdge * > &route, MSContainerStop *toCS, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos)
constructor
const MSEdge & getDestination() const
returns the destination edge
virtual ~MSContainer()
destructor
MSContainerStop * getDepartContainerStop() const
returns the container stop from which the container departs
SUMOReal getEdgePos(SUMOTime now) const
Returns the offset from the start of the current edge measured in its natural direction.
SUMOReal myDepartPos
the depart position
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
CState * add(MSContainer *container, MSContainer::MSContainerStage_Tranship *stage, SUMOTime now)
register the given container as a transhiped container
Representation of a vehicle in the micro simulation.
A lane area vehicles can halt at and load and unload containers.
const MSEdge * getEdge() const
Returns the current edge.
SUMOReal getAngle(SUMOTime now) const
the angle of the edge minus 90deg
virtual void addContainer(MSContainer *container) const
Add a container to myContainers.
MSContainerPlan * myPlan
the plan of the container
void setWaitEnd(SUMOTime time, MSContainer *container)
sets the arrival time for a waiting container
SUMOReal getEdgeAngle(const MSEdge *e, SUMOReal at) const
get angle of the edge at a certain position
MSContainerStage(const MSEdge &destination, StageType type)
constructor
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
bool moveToNextEdge(MSContainer *container, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the container arrived
The departure is container triggered.
bool isWaitingFor(const std::string &line) const
Whether the container waits for a vehicle of the line specified.
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
~MSContainerStage_Tranship()
destructor
void addWaiting(const MSEdge *edge, MSContainer *container)
adds a container to the list of containers waiting for a vehicle on the specified edge ...
std::string time2string(SUMOTime t)
SUMOTime getWaitingTime(SUMOTime now) const
the time this container spent waiting
const MSEdge * getEdge() const
Returns the current edge.
SUMOReal getSpeed() const
Returns the speed of the container which is always zero in that stage.
virtual bool isWaitingFor(const std::string &line) const
Whether the container waits for a vehicle of the line specified.
MSContainerStage_Waiting(const MSEdge &destination, SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string &actType)
constructor
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines, const SUMOReal position, const std::string ridingID)
virtual void proceed(MSNet *net, MSContainer *container, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
void setArrived(SUMOTime now)
logs end of the step
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
SUMOReal getEdgePos(SUMOTime now) const
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
virtual void endEventOutput(const MSContainer &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
void setTranship(MSContainer *c)
adds a container to myTranship
MSContainerStop * getDepartContainerStop() const
MSContainerPlan::iterator myStep
the iterator over the route
virtual void removeContainer(MSContainer *container) const
Remove container from myContainers.
const MSVehicleType * myVType
This container's type. (mainly used for drawing related information Note sure if it is really necessa...
The simulated network and simulation perfomer.
~MSContainerStage_Driving()
destructor
The car-following model and parameter.
virtual void erase(MSContainer *container)
removes a single container
void unregisterOneWaitingForContainer()
decreases the count of vehicles waiting for a container to allow recogniztion of container related de...
const MSEdge * getEdge() const
Returns the current edge.
static SUMOReal interpretEdgePos(SUMOReal pos, SUMOReal maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
std::vector< const MSEdge * > myRoute
The route of the container.
MSContainerStop * getDepartContainerStop() const
returns the container stop from which the container departs
const std::string & getID() const
Returns the id.
virtual void beginEventOutput(const MSContainer &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
A road/street connecting two junctions.
virtual void beginEventOutput(const MSContainer &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
SUMOReal myArrivalPos
the arrival position
virtual SUMOReal getAngle() const
return the current angle of the container
const MSEdge * getEdge() const
Returns the current edge.
const MSEdge * getFromEdge() const
Returns the departure edge.
SUMOReal getLength() const
return the length of the edge
~MSContainerStage_Waiting()
destructor
virtual ~MSContainerStage()
destructor
SUMOTime getUntil() const
Returns time until the container waits.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Representation of a vehicle.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
A point in 2D or 3D with translation and scaling methods.
Position getLanePosition(const MSLane *lane, SUMOReal at, SUMOReal offset) const
get position on lane at length at with orthogonal offset
virtual MSContainerControl & getContainerControl()
Returns the container control.
virtual void proceed(MSNet *net, MSContainer *container, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
SUMOReal getSpeed() const
the speed of the container
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Position getPosition(SUMOTime now) const
Returns the position of the container.
SUMOTime depart
The vehicle's departure time.
virtual void beginEventOutput(const MSContainer &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
const MSEdge & myDestination
the next edge to reach by getting transported
SUMOReal getSpeed() const
Returns the speed of the container.
static const SUMOReal ROADSIDE_OFFSET
the offset for computing container positions when standing at an edge
Position getPosition(SUMOTime now) const
returns the position of the container
SUMOTime getDesiredDepart() const
Returns the desired departure time.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
const SUMOVehicleParameter * myParameter
the plan of the container
const MSEdge * lastDestination
the last destination of the route of the container
const MSEdge * getFromEdge() const
Returns first edge of the containers route.
virtual Position getPosition() const
Return the Network coordinate of the container.
std::vector< MSContainerStage * > MSContainerPlan
the structure holding the plan of a container
Position getPosition(SUMOTime now) const
returns the position of the container
const MSEdge * getFromEdge() const
Returns the current edge.
std::string getStageDescription() const
returns the stage description as a string
void setDeparted(SUMOTime now)
logs depart time of the current stage
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
bool isWaiting4Vehicle() const
Whether the container waits for a vehicle.
Structure representing possible vehicle parameter.
virtual void endEventOutput(const MSContainer &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Position getEdgePosition(const MSEdge *e, SUMOReal at, SUMOReal offset) const
get position on edge e at length at with orthogonal offset
virtual SUMOReal getEdgePos() const
Return the position on the edge.
virtual SUMOReal getWaitingSeconds() const
the time this container spent waiting in seconds
MSContainerStage_Driving(const MSEdge &destination, MSContainerStop *toCS, const std::vector< std::string > &lines)
constructor
MSInsertionControl & getInsertionControl()
Returns the insertion control.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
bool proceed(MSNet *net, SUMOTime time)
void unsetTranship(MSContainer *c)
removes a container from myTranship
SUMOReal getAngle(SUMOTime now) const
the angle of the vehicle or the angle of the edge + 90deg
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
const std::string & getID() const
returns the container id
const MSEdge * getFromEdge() const
const PositionVector & getShape() const
Returns this lane's shape.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Static storage of an output device and its base (abstract) implementation.
SUMOTime getWaitingTime(SUMOTime now) const
Returns the time the container spent waiting.
bool closeTag()
Closes the most recently opened tag.
const MSEdge * getToEdge() const
Returns last edge of the containers route.
SUMOReal getAngle(SUMOTime now) const
Returns the angle of the container.
void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
virtual SUMOReal getSpeed() const
the current speed of the container
bool isWaiting4Vehicle() const
Whether the container waits for a vehicle.
const MSEdge & getDestination() const
Returns the current destination.
virtual void proceed(MSNet *net, MSContainer *container, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
virtual void endEventOutput(const MSContainer &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
MSContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSContainerPlan *plan)
constructor
static MSCModel_NonInteracting * getModel()
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
virtual MSContainerStop * getDepartContainerStop() const
void setDeparted(SUMOTime now)
logs end of the step
std::string id
The vehicle's id.
SUMOReal getEdgePos(SUMOTime now) const
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.