SUMO - Simulation of Urban MObility
MSContainer.h
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-2016 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 #ifndef MSContainer_h
22 #define MSContainer_h
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <vector>
35 #include <set>
36 #include <utils/common/SUMOTime.h>
37 #include <utils/common/Command.h>
38 #include <utils/geom/Position.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class MSNet;
47 class MSEdge;
48 class MSLane;
49 class OutputDevice;
51 class MSStoppingPlace;
52 class SUMOVehicle;
53 class MSVehicleType;
55 class CState;
56 
57 
58 // ===========================================================================
59 // class definitions
60 // ===========================================================================
68 class MSContainer : public MSTransportable {
69 public:
70 
71 
78  public:
80  MSContainerStage_Driving(const MSEdge& destination, MSStoppingPlace* toStop,
81  const SUMOReal arrivalPos, const std::vector<std::string>& lines);
82 
85 
87  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
88 
90  std::string getStageDescription() const;
91 
97  virtual void tripInfoOutput(OutputDevice& os) const;
98 
104  virtual void routeOutput(OutputDevice& os) const;
105  };
106 
114 
115  public:
117  MSContainerStage_Tranship(const std::vector<const MSEdge*>& route, MSStoppingPlace* toStop, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos);
118 
121 
123  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
124 
126  const MSEdge* getEdge() const;
127 
129  const MSEdge* getFromEdge() const;
130 
132  const MSEdge* getToEdge() const;
133 
135  SUMOReal getEdgePos(SUMOTime now) const;
136 
138  Position getPosition(SUMOTime now) const;
139 
141  SUMOReal getAngle(SUMOTime now) const;
142 
144  SUMOTime getWaitingTime(SUMOTime now) const;
145 
147  SUMOReal getSpeed() const;
148 
150  std::string getStageDescription() const {
151  return "tranship";
152  }
153 
158  virtual void tripInfoOutput(OutputDevice& os) const;
159 
164  virtual void routeOutput(OutputDevice& os) const;
165 
170  virtual void beginEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
171 
176  virtual void endEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
177 
179  bool moveToNextEdge(MSTransportable* container, SUMOTime currentTime, MSEdge* nextInternal = 0);
180 
181 
183  inline SUMOReal getMaxSpeed() const {
184  return mySpeed;
185  }
186 
187  inline SUMOReal getDepartPos() const {
188  return myDepartPos;
189  }
190 
191  inline SUMOReal getArrivalPos() const {
192  return myArrivalPos;
193  }
194 
195  inline const MSEdge* getNextRouteEdge() const {
196  return myRouteStep == myRoute.end() - 1 ? 0 : *(myRouteStep + 1);
197  }
198 
200  return myContainerState;
201  }
202 
203  private:
205  std::vector<const MSEdge*> myRoute;
206 
208  std::vector<const MSEdge*>::iterator myRouteStep;
209 
212 
215 
218 
221 
222  private:
225 
228 
229  };
230 
231 public:
233  MSContainer(const SUMOVehicleParameter* pars, const MSVehicleType* vtype, MSTransportablePlan* plan);
234 
236  virtual ~MSContainer();
237 
238  /* @brief proceeds to the next step of the route,
239  * @return Whether the persons plan continues */
240  virtual bool proceed(MSNet* net, SUMOTime time);
241 
247  virtual void tripInfoOutput(OutputDevice& os) const;
248 
254  virtual void routeOutput(OutputDevice& os) const;
255 
256 private:
258  MSContainer(const MSContainer&);
259 
262 
263 };
264 
265 
266 #endif
267 
268 /****************************************************************************/
virtual ~MSContainer()
destructor
SUMOReal myDepartPos
the depart position
Definition: MSContainer.h:211
long long int SUMOTime
Definition: SUMOTime.h:43
A lane area vehicles can halt at.
std::vector< const MSEdge * >::iterator myRouteStep
current step
Definition: MSContainer.h:208
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSContainer.cpp:67
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSContainer.cpp:98
MSContainerStage_Driving(const MSEdge &destination, MSStoppingPlace *toStop, const SUMOReal arrivalPos, const std::vector< std::string > &lines)
constructor
Definition: MSContainer.cpp:58
std::string getStageDescription() const
Returns the current stage description as a string.
Definition: MSContainer.h:150
SUMOReal getMaxSpeed() const
accessors to be used by MSCModel_NonInteracting
Definition: MSContainer.h:183
SUMOReal getAngle(SUMOTime now) const
returns the angle of the transportable
Stage_Driving & operator=(const Stage_Driving &)
Invalidated assignment operator.
The simulated network and simulation perfomer.
Definition: MSNet.h:93
The car-following model and parameter.
Definition: MSVehicleType.h:74
std::vector< const MSEdge * > myRoute
The route of the container.
Definition: MSContainer.h:205
const MSEdge * getFromEdge() const
A road/street connecting two junctions.
Definition: MSEdge.h:80
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Representation of a vehicle.
Definition: SUMOVehicle.h:66
SUMOReal mySpeed
the speed of the container
Definition: MSContainer.h:214
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
const MSEdge * getEdge() const
Returns the current edge.
SUMOReal myArrivalPos
the position at which we want to arrive
Position getPosition(SUMOTime now) const
returns the position of the transportable
CState * myContainerState
state that is to be manipulated by MSCModel
Definition: MSContainer.h:217
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
const MSEdge * getNextRouteEdge() const
Definition: MSContainer.h:195
SUMOReal getEdgePos(SUMOTime now) const
std::string getStageDescription() const
returns the stage description as a string
Definition: MSContainer.cpp:92
Structure representing possible vehicle parameter.
SUMOReal getSpeed() const
the speed of the transportable
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:213
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
MSContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportablePlan *plan)
constructor
The container following model for tranship.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
MSEdge * myCurrentInternalEdge
The current internal edge this container is on or 0.
Definition: MSContainer.h:220