47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
65 myVehicle(0), myDestinationContainerStop(toCS) {}
73 myWaitingEdge = previousEdge;
78 myVehicle = availableVehicle;
80 myVehicle->addContainer(container);
93 return myVehicle->getEdge();
101 return myWaitingEdge;
107 if (myVehicle != 0) {
116 if (myVehicle != 0) {
118 return myVehicle->getEdge()->getLanes()[0]->getShape().positionAtOffset(myVehicle->getPositionOnLane());
125 if (myVehicle != 0) {
133 return getEdgeAngle(myWaitingEdge, myWaitingPos) + 90;
138 return myLines.count(line) > 0;
143 return myVehicle == 0;
153 return myVehicle == 0 ? 0 : myVehicle->getSpeed();
163 return myDepartContainerStop;
195 myWaitingDuration(duration),
196 myWaitingUntil(until),
207 return &myDestination;
212 return &myDestination;
222 return myWaitingUntil;
232 return getEdgeAngle(&myDestination, myStartPos) - 180;
237 return now - myWaitingStart;
247 return myCurrentContainerStop;
254 myWaitingStart = now;
255 const SUMOTime until =
MAX3(now, now + myWaitingDuration, myWaitingUntil);
267 if (myWaitingDuration >= 0) {
270 if (myWaitingUntil >= 0) {
296 myDestinationContainerStop(toCS),
297 mySpeed(speed), myContainerState(0), myCurrentInternalEdge(0) {
310 myRouteStep = myRoute.end() - 1;
316 (*myRouteStep)->addContainer(container);
321 if (myCurrentInternalEdge != 0) {
322 return myCurrentInternalEdge;
330 return myRoute.front();
335 return myRoute.back();
340 return myContainerState->getEdgePos(*
this, now);
345 return myContainerState->getPosition(*
this, now);
350 return myContainerState->getAngle(*
this, now);
360 return myContainerState->getSpeed(*
this);
365 return myDepartContainerStop;
385 .
writeAttr(
"agent", c.
getID()).writeAttr(
"link", myRoute.front()->getID()).closeTag();
392 .
writeAttr(
"agent", c.
getID()).writeAttr(
"link", myRoute.back()->getID()).closeTag();
398 if (myRouteStep == myRoute.end() - 1) {
400 if (myDestinationContainerStop != 0) {
401 myDestinationContainerStop->addTransportable(container);
408 if (nextInternal == 0) {
410 myCurrentInternalEdge = 0;
412 myCurrentInternalEdge = nextInternal;
432 SUMOReal atPos = (*myStep)->getEdgePos(time);
433 (*myStep)->setArrived(time);
436 (*myStep)->proceed(net,
this, time, arrivedAt, atPos);
447 MSTransportablePlan::const_iterator i =
myPlan->begin();
451 for (; i !=
myPlan->end(); ++i) {
452 (*i)->routeOutput(os);
virtual ~MSContainer()
destructor
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
virtual void beginEventOutput(const MSTransportable &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Representation of a vehicle in the micro simulation.
SUMOReal getAngle(SUMOTime now) const
the angle of the edge minus 90deg
A lane area vehicles can halt at.
bool isWaiting4Vehicle() const
Whether the container waits for a vehicle.
The departure is container triggered.
MSContainerStage_Tranship(const std::vector< const MSEdge * > &route, MSStoppingPlace *toCS, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos)
constructor
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 addContainer(MSTransportable *container) const
Add a container to myContainers.
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
~MSContainerStage_Tranship()
destructor
std::string time2string(SUMOTime t)
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable 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.
MSContainerStage_Waiting(const MSEdge &destination, SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string &actType)
constructor
void addWaiting(const MSEdge *edge, MSTransportable *container)
adds a container to the list of containers waiting for a vehicle on the specified edge ...
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const std::string & getID() const
returns the id of the transportable
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines, const SUMOReal position, const std::string ridingID)
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
virtual bool proceed(MSNet *net, SUMOTime time)=0
SUMOReal getEdgePos(SUMOTime now) const
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
MSTransportablePlan::iterator myStep
the iterator over the route
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
virtual void beginEventOutput(const MSTransportable &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
The simulated network and simulation perfomer.
~MSContainerStage_Driving()
destructor
The car-following model and parameter.
SUMOTime getDesiredDepart() const
Returns the desired departure time.
CState * add(MSTransportable *container, MSContainer::MSContainerStage_Tranship *stage, SUMOTime now)
register the given container as a transhiped 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.
virtual void beginEventOutput(const MSTransportable &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a container
SUMOReal myArrivalPos
the arrival position
const MSEdge * getEdge() const
Returns the current edge.
SUMOReal getLength() const
return the length of the edge
~MSContainerStage_Waiting()
destructor
void setWaitEnd(SUMOTime time, MSTransportable *container)
sets the arrival time for a waiting container
SUMOTime getUntil() const
Returns time until the container waits.
const MSEdge * getEdge() const
Returns the current edge.
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.
virtual MSContainerControl & getContainerControl()
Returns the container control.
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.
void setTranship(MSTransportable *c)
adds a container to myTranship
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
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 transportable
MSContainerStage_Driving(const MSEdge &destination, MSStoppingPlace *toCS, const std::vector< std::string > &lines)
constructor
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
virtual void endEventOutput(const MSTransportable &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
const MSEdge * getFromEdge() const
Returns first edge of the containers route.
bool moveToNextEdge(MSTransportable *container, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the container arrived
const MSEdge & getDestination() const
Returns the current destination.
Position getPosition(SUMOTime now) const
returns the position of the transportable
const MSEdge * getFromEdge() const
Returns the current edge.
std::string getStageDescription() const
returns the stage description as a string
const MSEdge * getFromEdge() const
Returns the departure edge.
Structure representing possible vehicle parameter.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
bool proceed(MSNet *net, SUMOTime time)
SUMOReal getAngle(SUMOTime now) const
the angle of the vehicle or the angle of the edge + 90deg
void unsetTranship(MSTransportable *c)
removes a container from myTranship
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
MSStoppingPlace * getDepartContainerStop() const
const MSEdge * getFromEdge() const
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.
MSStoppingPlace * getDepartContainerStop() const
returns the container stop from which the container departs
MSTransportablePlan * myPlan
the plan of the container
MSContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportablePlan *plan)
constructor
const MSEdge * getToEdge() const
Returns last edge of the containers route.
SUMOReal getAngle(SUMOTime now) const
Returns the angle of the container.
bool isWaiting4Vehicle() const
Whether the container waits for a vehicle.
MSStoppingPlace * getDepartContainerStop() const
returns the container stop from which the container departs
const MSEdge & myDestination
the next edge to reach by getting transported
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
virtual void endEventOutput(const MSTransportable &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
virtual void erase(MSTransportable *container)
removes a single container
virtual void endEventOutput(const MSTransportable &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
static MSCModel_NonInteracting * getModel()
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
SUMOReal getEdgePos(SUMOTime now) const
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.