SUMO - Simulation of Urban MObility
MSContainer.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // The class for modelling container-movements
19 /****************************************************************************/
20 #ifndef MSContainer_h
21 #define MSContainer_h
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>
34 #include <set>
35 #include <utils/common/SUMOTime.h>
36 #include <utils/common/Command.h>
37 #include <utils/geom/Position.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class MSNet;
46 class MSEdge;
47 class MSLane;
48 class OutputDevice;
50 class MSStoppingPlace;
51 class SUMOVehicle;
52 class MSVehicleType;
54 class CState;
55 
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
67 class MSContainer : public MSTransportable {
68 public:
69 
70 
77  public:
79  MSContainerStage_Driving(const MSEdge& destination, MSStoppingPlace* toStop,
80  const double arrivalPos, const std::vector<std::string>& lines);
81 
84 
86  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
87 
89  std::string getStageDescription() const;
90 
96  virtual void tripInfoOutput(OutputDevice& os, MSTransportable* transportable) const;
97 
103  virtual void routeOutput(OutputDevice& os) const;
104  };
105 
113 
114  public:
116  MSContainerStage_Tranship(const std::vector<const MSEdge*>& route, MSStoppingPlace* toStop, double speed, double departPos, double arrivalPos);
117 
120 
122  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
123 
125  const MSEdge* getEdge() const;
126 
128  const MSEdge* getFromEdge() const;
129 
131  const MSEdge* getToEdge() const;
132 
134  double getEdgePos(SUMOTime now) const;
135 
137  Position getPosition(SUMOTime now) const;
138 
140  double getAngle(SUMOTime now) const;
141 
143  SUMOTime getWaitingTime(SUMOTime now) const;
144 
146  double getSpeed() const;
147 
149  ConstMSEdgeVector getEdges() const;
150 
152  std::string getStageDescription() const {
153  return "tranship";
154  }
155 
160  virtual void tripInfoOutput(OutputDevice& os, MSTransportable* transportable) const;
161 
166  virtual void routeOutput(OutputDevice& os) const;
167 
172  virtual void beginEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
173 
178  virtual void endEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
179 
181  bool moveToNextEdge(MSTransportable* container, SUMOTime currentTime, MSEdge* nextInternal = 0);
182 
183 
185  inline double getMaxSpeed() const {
186  return mySpeed;
187  }
188 
189  inline double getDepartPos() const {
190  return myDepartPos;
191  }
192 
193  inline double getArrivalPos() const {
194  return myArrivalPos;
195  }
196 
197  inline const MSEdge* getNextRouteEdge() const {
198  return myRouteStep == myRoute.end() - 1 ? 0 : *(myRouteStep + 1);
199  }
200 
202  return myContainerState;
203  }
204 
205  private:
207  std::vector<const MSEdge*> myRoute;
208 
210  std::vector<const MSEdge*>::iterator myRouteStep;
211 
213  double myDepartPos;
214 
216  double mySpeed;
217 
220 
223 
224  private:
227 
230 
231  };
232 
233 public:
236 
238  virtual ~MSContainer();
239 
240  /* @brief proceeds to the next step of the route,
241  * @return Whether the persons plan continues */
242  virtual bool proceed(MSNet* net, SUMOTime time);
243 
249  virtual void tripInfoOutput(OutputDevice& os, MSTransportable* transportable) const;
250 
256  virtual void routeOutput(OutputDevice& os) const;
257 
258 private:
260  MSContainer(const MSContainer&);
261 
264 
265 };
266 
267 
268 #endif
269 
270 /****************************************************************************/
virtual ~MSContainer()
destructor
double getAngle(SUMOTime now) const
returns the angle of the transportable
A lane area vehicles can halt at.
std::vector< const MSEdge * >::iterator myRouteStep
current step
Definition: MSContainer.h:210
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSContainer.cpp:67
const MSEdge * getEdge() const
Returns the current edge.
ConstMSEdgeVector getEdges() const
the edges of the current stage
MSContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportablePlan *plan)
constructor
double getSpeed() const
the speed of the transportable
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
double myDepartPos
the depart position
Definition: MSContainer.h:213
double getEdgePos(SUMOTime now) const
const MSEdge * getFromEdge() const
Stage_Driving & operator=(const Stage_Driving &)
Invalidated assignment operator.
The simulated network and simulation perfomer.
Definition: MSNet.h:90
The car-following model and parameter.
Definition: MSVehicleType.h:72
std::vector< const MSEdge * > myRoute
The route of the container.
Definition: MSContainer.h:207
A road/street connecting two junctions.
Definition: MSEdge.h:80
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Representation of a vehicle.
Definition: SUMOVehicle.h:66
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
const MSEdge * getNextRouteEdge() const
Definition: MSContainer.h:197
double mySpeed
the speed of the container
Definition: MSContainer.h:216
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
double getMaxSpeed() const
accessors to be used by MSCModel_NonInteracting
Definition: MSContainer.h:185
Position getPosition(SUMOTime now) const
returns the position of the transportable
CState * myContainerState
state that is to be manipulated by MSCModel
Definition: MSContainer.h:219
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Structure representing possible vehicle parameter.
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
Definition: MSContainer.cpp:97
std::string getStageDescription() const
returns the stage description as a string
Definition: MSContainer.cpp:91
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
MSContainerStage_Driving(const MSEdge &destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines)
constructor
Definition: MSContainer.cpp:54
long long int SUMOTime
Definition: TraCIDefs.h:51
The container following model for tranship.
std::string getStageDescription() const
Returns the current stage description as a string.
Definition: MSContainer.h:152
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
double myArrivalPos
the position at which we want to arrive
MSEdge * myCurrentInternalEdge
The current internal edge this container is on or 0.
Definition: MSContainer.h:222