SUMO - Simulation of Urban MObility
MSContainer.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // The class for modelling container-movements
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <vector>
36 #include <utils/common/ToString.h>
37 #include "MSNet.h"
38 #include "MSEdge.h"
39 #include "MSLane.h"
40 #include "MSContainer.h"
42 #include "MSContainerControl.h"
43 #include "MSInsertionControl.h"
44 #include "MSVehicle.h"
46 
47 #ifdef CHECK_MEMORY_LEAKS
48 #include <foreign/nvwa/debug_new.h>
49 #endif // CHECK_MEMORY_LEAKS
50 
51 /* -------------------------------------------------------------------------
52  * static member definitions
53  * ----------------------------------------------------------------------- */
55 
56 // ===========================================================================
57 // method definitions
58 // ===========================================================================
59 /* -------------------------------------------------------------------------
60  * MSContainer::MSContainerStage - methods
61  * ----------------------------------------------------------------------- */
63  : myDestination(destination), myDeparted(-1), myArrived(-1), myType(type) {}
64 
66 
67 const MSEdge&
69  return myDestination;
70 }
71 
72 void
74  if (myDeparted < 0) {
75  myDeparted = now;
76  }
77 }
78 
79 void
81  myArrived = now;
82 }
83 
84 bool
85 MSContainer::MSContainerStage::isWaitingFor(const std::string& /*line*/) const {
86  return false;
87 }
88 
91  return getLanePosition(e->getLanes()[0], at, offset);
92 }
93 
96  return lane->getShape().positionAtOffset(lane->interpolateLanePosToGeometryPos(at), offset);
97 }
98 
101  PositionVector shp = e->getLanes()[0]->getShape();
102  return -shp.rotationDegreeAtOffset(at);
103 }
104 
105 
106 
107 /* -------------------------------------------------------------------------
108  * MSContainer::MSContainerStage_Driving - methods
109  * ----------------------------------------------------------------------- */
111  MSContainerStop* toCS, const std::vector<std::string>& lines)
112  : MSContainerStage(destination, DRIVING), myLines(lines.begin(), lines.end()),
113  myVehicle(0), myDestinationContainerStop(toCS) {}
114 
115 
117 
118 void
120  MSEdge* previousEdge, const SUMOReal at) {
121  myWaitingEdge = previousEdge;
122  myWaitingPos = at;
123  myWaitingSince = now;
124  SUMOVehicle* availableVehicle = net->getVehicleControl().getWaitingVehicle(previousEdge, myLines, myWaitingPos, container->getID());
125  if (availableVehicle != 0 && availableVehicle->getParameter().departProcedure == DEPART_CONTAINER_TRIGGERED) {
126  myVehicle = availableVehicle;
127  previousEdge->removeContainer(container);
128  myVehicle->addContainer(container);
129  net->getInsertionControl().add(myVehicle);
130  net->getVehicleControl().removeWaiting(previousEdge, myVehicle);
132  } else {
133  net->getContainerControl().addWaiting(previousEdge, container);
134  previousEdge->addContainer(container);
135  }
136 }
137 
138 const MSEdge*
140  if (myVehicle != 0) {
141  return myVehicle->getEdge();
142  }
143  return myWaitingEdge;
144 }
145 
146 
147 const MSEdge*
149  return myWaitingEdge;
150 }
151 
152 
153 SUMOReal
155  if (myVehicle != 0) {
156  // vehicle may already have passed the lane (check whether this is correct)
157  return MIN2(myVehicle->getPositionOnLane(), getEdge()->getLength());
158  }
159  return myWaitingPos;
160 }
161 
162 Position
164  if (myVehicle != 0) {
166  return myVehicle->getEdge()->getLanes()[0]->getShape().positionAtOffset(myVehicle->getPositionOnLane());
167  }
168  return getEdgePosition(myWaitingEdge, myWaitingPos, ROADSIDE_OFFSET);
169 }
170 
171 SUMOReal
173  if (myVehicle != 0) {
174  MSVehicle* veh = dynamic_cast<MSVehicle*>(myVehicle);
175  if (veh != 0) {
176  return veh->getAngle();
177  } else {
178  return 0;
179  }
180  }
181  return getEdgeAngle(myWaitingEdge, myWaitingPos) + 90;
182 }
183 
184 bool
186  return myLines.count(line) > 0;
187 }
188 
189 bool
191  return myVehicle == 0;
192 }
193 
194 SUMOTime
196  return isWaiting4Vehicle() ? now - myWaitingSince : 0;
197 }
198 
199 SUMOReal
201  return myVehicle == 0 ? 0 : myVehicle->getSpeed();
202 }
203 
204 std::string
206  return isWaiting4Vehicle() ? "waiting for " + joinToString(myLines, ",") : "transport";
207 }
208 
211  return myDepartContainerStop;
212 }
213 
214 void
216  os.openTag("transport").writeAttr("depart", time2string(myDeparted)).writeAttr("arrival", time2string(myArrived)).closeTag();
217 }
218 
219 void
222  os.writeAttr(SUMO_ATTR_LINES, myLines).closeTag();
223 }
224 
225 void
227  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", container.getID()).writeAttr("link", getEdge()->getID()).closeTag();
228 }
229 
230 void
232  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", container.getID()).writeAttr("link", getEdge()->getID()).closeTag();
233 }
234 
235 
236 
237 /* -------------------------------------------------------------------------
238  * MSContainer::MSContainerStage_Waiting - methods
239  * ----------------------------------------------------------------------- */
241  SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string& actType) :
242  MSContainerStage(destination, WAITING),
243  myWaitingDuration(duration),
244  myWaitingUntil(until),
245  myActType(actType),
246  myStartPos(pos) {
248  myStartPos, myDestination.getLength(), SUMO_ATTR_DEPARTPOS, "container stopping at " + myDestination.getID());
249 }
250 
252 
253 const MSEdge*
255  return &myDestination;
256 }
257 
258 const MSEdge*
260  return &myDestination;
261 }
262 
263 SUMOReal
265  return myStartPos;
266 }
267 
268 SUMOTime
270  return myWaitingUntil;
271 }
272 
273 Position
275  return getEdgePosition(&myDestination, myStartPos, ROADSIDE_OFFSET);
276 }
277 
278 SUMOReal
280  return getEdgeAngle(&myDestination, myStartPos) - 180;
281 }
282 
283 SUMOTime
285  return now - myWaitingStart;
286 }
287 
288 SUMOReal
290  return 0;
291 }
292 
295  return myCurrentContainerStop;
296 }
297 
298 void
300  MSEdge* previousEdge, const SUMOReal /* at */) {
301  previousEdge->addContainer(container);
302  myWaitingStart = now;
303  const SUMOTime until = MAX3(now, now + myWaitingDuration, myWaitingUntil);
304  net->getContainerControl().setWaitEnd(until, container);
305 }
306 
307 void
309  os.openTag("stop").writeAttr("arrival", time2string(myArrived)).closeTag();
310 }
311 
312 void
315  if (myWaitingDuration >= 0) {
316  os.writeAttr(SUMO_ATTR_DURATION, time2string(myWaitingDuration));
317  }
318  if (myWaitingUntil >= 0) {
319  os.writeAttr(SUMO_ATTR_UNTIL, time2string(myWaitingUntil));
320  }
321  os.closeTag();
322 }
323 
324 void
326  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actstart " + myActType)
327  .writeAttr("agent", container.getID()).writeAttr("link", getEdge()->getID()).closeTag();
328 }
329 
330 void
332  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actend " + myActType).writeAttr("agent", container.getID())
333  .writeAttr("link", getEdge()->getID()).closeTag();
334 }
335 
336 /* -------------------------------------------------------------------------
337  * MSContainer::MSContainerStage_Tranship - methods
338  * ----------------------------------------------------------------------- */
340  MSContainerStop* toCS,
341  SUMOReal speed,
342  SUMOReal departPos, SUMOReal arrivalPos) :
343  MSContainerStage(*route.back(), TRANSHIP), myRoute(route),
344  myDestinationContainerStop(toCS),
345  mySpeed(speed), myContainerState(0), myCurrentInternalEdge(0) {
347  departPos, myRoute.front()->getLength(), SUMO_ATTR_DEPARTPOS, "container getting transhipped from " + myRoute.front()->getID());
349  arrivalPos, myRoute.back()->getLength(), SUMO_ATTR_ARRIVALPOS, "container getting transhipped to " + myRoute.back()->getID());
350 }
351 
353 }
354 
355 void
356 MSContainer::MSContainerStage_Tranship::proceed(MSNet* /* net */, MSContainer* container, SUMOTime now, MSEdge* previousEdge, const SUMOReal at) {
357  previousEdge->removeContainer(container);
358  myRouteStep = myRoute.end() - 1; //define that the container is already on its destination edge
360  if (at >= 0) {
361  myDepartPos = at;
362  }
363  myContainerState = MSCModel_NonInteracting::getModel()->add(container, this, now);
364  ((MSEdge*) *myRouteStep)->addContainer(container);
365 }
366 
367 const MSEdge*
369  if (myCurrentInternalEdge != 0) {
370  return myCurrentInternalEdge;
371  } else {
372  return *myRouteStep;
373  }
374 }
375 
376 const MSEdge*
378  return myRoute.front();
379 }
380 
381 const MSEdge*
383  return myRoute.back();
384 }
385 
386 SUMOReal
388  return myContainerState->getEdgePos(*this, now);
389 }
390 
391 Position
393  return myContainerState->getPosition(*this, now);
394 }
395 
396 SUMOReal
398  return myContainerState->getAngle(*this, now);
399 }
400 
401 SUMOTime
403  return 0;
404 }
405 
406 SUMOReal
408  return myContainerState->getSpeed(*this);
409 }
410 
413  return myDepartContainerStop;
414 }
415 
416 void
418  os.openTag("tranship").writeAttr("arrival", time2string(myArrived)).closeTag();
419 }
420 
421 
422 void
424  os.openTag("tranship").writeAttr(SUMO_ATTR_EDGES, myRoute);
425  os.writeAttr(SUMO_ATTR_SPEED, mySpeed);
426  os.closeTag();
427 }
428 
429 
430 void
432  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "departure")
433  .writeAttr("agent", c.getID()).writeAttr("link", myRoute.front()->getID()).closeTag();
434 }
435 
436 
437 void
439  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival")
440  .writeAttr("agent", c.getID()).writeAttr("link", myRoute.back()->getID()).closeTag();
441 }
442 
443 bool
445  ((MSEdge*)getEdge())->removeContainer(container);
446  if (myRouteStep == myRoute.end() - 1) {
448  if (myDestinationContainerStop != 0) {
449  myDestinationContainerStop->addContainer(container); //jakob
450  }
451  if (!container->proceed(MSNet::getInstance(), currentTime)) {
453  }
454  return true;
455  } else {
456  if (nextInternal == 0) {
457  ++myRouteStep;
458  myCurrentInternalEdge = 0;
459  } else {
460  myCurrentInternalEdge = nextInternal;
461  }
462  ((MSEdge*) getEdge())->addContainer(container);
463  return false;
464  }
465 }
466 
467 /* -------------------------------------------------------------------------
468  * MSContainer - methods
469  * ----------------------------------------------------------------------- */
471  : myParameter(pars), myVType(vtype), myPlan(plan) {
472  myStep = myPlan->begin();
473  lastDestination = &(myPlan->back())->getDestination();
474 }
475 
477  for (MSContainerPlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
478  delete *i;
479  }
480  delete myPlan;
481  delete myParameter;
482 }
483 
484 const std::string&
486  return myParameter->id;
487 }
488 
489 bool
491  MSEdge* arrivedAt = (MSEdge*)(*myStep)->getEdge();
492  SUMOReal atPos = (*myStep)->getEdgePos(time);
493  (*myStep)->setArrived(time);
494  myStep++;
495  if (myStep != myPlan->end()) {
496  (*myStep)->proceed(net, this, time, arrivedAt, atPos);
497  return true;
498  } else {
499  arrivedAt->removeContainer(this);
500  return false;
501  }
502 }
503 
504 SUMOTime
506  return myParameter->depart;
507 }
508 
509 void
511  (*myStep)->setDeparted(now);
512 }
513 
514 SUMOReal
516  return (*myStep)->getEdgePos(MSNet::getInstance()->getCurrentTimeStep());
517 }
518 
519 Position
521  return (*myStep)->getPosition(MSNet::getInstance()->getCurrentTimeStep());
522 }
523 
524 SUMOReal
526  return (*myStep)->getAngle(MSNet::getInstance()->getCurrentTimeStep());
527 }
528 
529 SUMOReal
531  return STEPS2TIME((*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep()));
532 }
533 
534 SUMOReal
536  return (*myStep)->getSpeed();
537 }
538 
541  return (*myStep)->getDepartContainerStop();
542 }
543 
544 void
546  for (MSContainerPlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
547  (*i)->tripInfoOutput(os);
548  }
549 }
550 
551 void
553  MSContainerPlan::const_iterator i = myPlan->begin();
554  if ((*i)->getStageType() == WAITING && getDesiredDepart() == static_cast<MSContainerStage_Waiting*>(*i)->getUntil()) {
555  ++i;
556  }
557  for (; i != myPlan->end(); ++i) {
558  (*i)->routeOutput(os);
559  }
560 }
561 
562 
563 /****************************************************************************/
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
Definition: MSContainer.cpp:68
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
Definition: MSContainer.h:522
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:257
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.
Definition: MSVehicle.h:80
A lane area vehicles can halt at and load and unload containers.
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSContainer.h:606
SUMOReal getAngle(SUMOTime now) const
the angle of the edge minus 90deg
virtual void addContainer(MSContainer *container) const
Add a container to myContainers.
Definition: MSEdge.h:568
MSContainerPlan * myPlan
the plan of the container
Definition: MSContainer.h:567
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
Definition: MSContainer.cpp:62
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:186
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.
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)
Definition: SUMOTime.cpp:61
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.
Definition: MSContainer.cpp:85
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).
Definition: MSNet.cpp:159
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
Definition: MSContainer.cpp:80
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.
Definition: MSNet.h:235
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
T MAX3(T a, T b, T c)
Definition: StdDefs.h:88
MSContainerStop * getDepartContainerStop() const
MSContainerPlan::iterator myStep
the iterator over the route
Definition: MSContainer.h:570
virtual void removeContainer(MSContainer *container) const
Remove container from myContainers.
Definition: MSEdge.h:573
const MSVehicleType * myVType
This container's type. (mainly used for drawing related information Note sure if it is really necessa...
Definition: MSContainer.h:564
The simulated network and simulation perfomer.
Definition: MSNet.h:94
The car-following model and parameter.
Definition: MSVehicleType.h:74
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.
Definition: MSContainer.h:516
MSContainerStop * getDepartContainerStop() const
returns the container stop from which the container departs
const std::string & getID() const
Returns the id.
Definition: Named.h:60
virtual void beginEventOutput(const MSContainer &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
A road/street connecting two junctions.
Definition: MSEdge.h:81
virtual void beginEventOutput(const MSContainer &container, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
SUMOReal myArrivalPos
the arrival position
Definition: MSContainer.h:525
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.
Definition: MSContainer.h:611
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.h:535
virtual ~MSContainerStage()
destructor
Definition: MSContainer.cpp:65
the edges of a route
SUMOTime getUntil() const
Returns time until the container waits.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Representation of a vehicle.
Definition: SUMOVehicle.h:65
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
Position getLanePosition(const MSLane *lane, SUMOReal at, SUMOReal offset) const
get position on lane at length at with orthogonal offset
Definition: MSContainer.cpp:95
virtual MSContainerControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:666
A list of positions.
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.
Definition: MSNet.h:288
Position getPosition(SUMOTime now) const
Returns the position of the container.
SUMOTime depart
The vehicle's departure time.
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
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
Definition: MSContainer.h:180
SUMOReal getSpeed() const
Returns the speed of the container.
T MIN2(T a, T b)
Definition: StdDefs.h:68
static const SUMOReal ROADSIDE_OFFSET
the offset for computing container positions when standing at an edge
Definition: MSContainer.h:78
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
Definition: MSContainer.h:560
const MSEdge * lastDestination
the last destination of the route of the container
Definition: MSContainer.h:556
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
Definition: MSContainer.h:553
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.
Definition: MSContainer.h:673
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
Definition: MSContainer.cpp:90
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.
Definition: MSNet.h:329
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition: MSLane.h:334
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
int SUMOTime
Definition: SUMOTime.h:43
const MSEdge * getFromEdge() const
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:323
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:159
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
SUMOTime getWaitingTime(SUMOTime now) const
Returns the time the container spent waiting.
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:218
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.
Definition: MSContainer.h:596
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.
Definition: MSLane.h:77
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
Definition: MSContainer.cpp:73
std::string id
The vehicle's id.
SUMOReal getEdgePos(SUMOTime now) const
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
Definition: MSVehicle.cpp:646