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-2017 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 double 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, double speed, double departPos, double 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  double getEdgePos(SUMOTime now) const;
136 
138  Position getPosition(SUMOTime now) const;
139 
141  double getAngle(SUMOTime now) const;
142 
144  SUMOTime getWaitingTime(SUMOTime now) const;
145 
147  double getSpeed() const;
148 
150  ConstMSEdgeVector getEdges() const;
151 
153  std::string getStageDescription() const {
154  return "tranship";
155  }
156 
161  virtual void tripInfoOutput(OutputDevice& os) const;
162 
167  virtual void routeOutput(OutputDevice& os) const;
168 
173  virtual void beginEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
174 
179  virtual void endEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
180 
182  bool moveToNextEdge(MSTransportable* container, SUMOTime currentTime, MSEdge* nextInternal = 0);
183 
184 
186  inline double getMaxSpeed() const {
187  return mySpeed;
188  }
189 
190  inline double getDepartPos() const {
191  return myDepartPos;
192  }
193 
194  inline double getArrivalPos() const {
195  return myArrivalPos;
196  }
197 
198  inline const MSEdge* getNextRouteEdge() const {
199  return myRouteStep == myRoute.end() - 1 ? 0 : *(myRouteStep + 1);
200  }
201 
203  return myContainerState;
204  }
205 
206  private:
208  std::vector<const MSEdge*> myRoute;
209 
211  std::vector<const MSEdge*>::iterator myRouteStep;
212 
214  double myDepartPos;
215 
217  double mySpeed;
218 
221 
224 
225  private:
228 
231 
232  };
233 
234 public:
236  MSContainer(const SUMOVehicleParameter* pars, const MSVehicleType* vtype, MSTransportablePlan* plan);
237 
239  virtual ~MSContainer();
240 
241  /* @brief proceeds to the next step of the route,
242  * @return Whether the persons plan continues */
243  virtual bool proceed(MSNet* net, SUMOTime time);
244 
250  virtual void tripInfoOutput(OutputDevice& os) const;
251 
257  virtual void routeOutput(OutputDevice& os) const;
258 
259 private:
261  MSContainer(const MSContainer&);
262 
265 
266 };
267 
268 
269 #endif
270 
271 /****************************************************************************/
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:211
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSContainer.cpp:63
const MSEdge * getEdge() const
Returns the current edge.
ConstMSEdgeVector getEdges() const
the edges of the current stage
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:214
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:94
The car-following model and parameter.
Definition: MSVehicleType.h:74
std::vector< const MSEdge * > myRoute
The route of the container.
Definition: MSContainer.h:208
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:67
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
const MSEdge * getNextRouteEdge() const
Definition: MSContainer.h:198
double mySpeed
the speed of the container
Definition: MSContainer.h:217
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSContainer.cpp:94
double getMaxSpeed() const
accessors to be used by MSCModel_NonInteracting
Definition: MSContainer.h:186
Position getPosition(SUMOTime now) const
returns the position of the transportable
CState * myContainerState
state that is to be manipulated by MSCModel
Definition: MSContainer.h:220
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.
std::string getStageDescription() const
returns the stage description as a string
Definition: MSContainer.cpp:88
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:71
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:52
MSContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportablePlan *plan)
constructor
The container following model for tranship.
std::string getStageDescription() const
Returns the current stage description as a string.
Definition: MSContainer.h:153
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
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:223