Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // The class for modelling container-movements
17 /****************************************************************************/
18 #ifndef MSContainer_h
19 #define MSContainer_h
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <vector>
28 #include <set>
29 #include <utils/common/SUMOTime.h>
30 #include <utils/common/Command.h>
31 #include <utils/geom/Position.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class MSNet;
40 class MSEdge;
41 class MSLane;
42 class OutputDevice;
44 class MSStoppingPlace;
45 class SUMOVehicle;
46 class MSVehicleType;
48 class CState;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
61 class MSContainer : public MSTransportable {
62 public:
63 
64 
71  public:
73  MSContainerStage_Driving(const MSEdge* destination, MSStoppingPlace* toStop,
74  const double arrivalPos, const std::vector<std::string>& lines);
75 
78 
79  Stage* clone() const;
80 
82  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
83 
85  std::string getStageDescription() const;
86  std::string getStageSummary() const;
87 
93  virtual void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
94 
100  virtual void routeOutput(OutputDevice& os, const bool withRouteLength) const;
101  };
102 
110 
111  public:
113  MSContainerStage_Tranship(const std::vector<const MSEdge*>& route, MSStoppingPlace* toStop, double speed, double departPos, double arrivalPos);
114 
117 
118  Stage* clone() const;
119 
121  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
122 
124  const MSEdge* getEdge() const;
125 
127  const MSEdge* getFromEdge() const;
128 
130  const MSEdge* getToEdge() const;
131 
133  double getEdgePos(SUMOTime now) const;
134 
136  Position getPosition(SUMOTime now) const;
137 
139  double getAngle(SUMOTime now) const;
140 
142  double getDistance() const;
143 
145  SUMOTime getWaitingTime(SUMOTime now) const;
146 
148  double getSpeed() const;
149 
151  ConstMSEdgeVector getEdges() const;
152 
154  std::string getStageDescription() const {
155  return "tranship";
156  }
157  std::string getStageSummary() const;
158 
163  virtual void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
164 
169  virtual void routeOutput(OutputDevice& os, const bool withRouteLength) const;
170 
175  virtual void beginEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
176 
181  virtual void endEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
182 
184  bool moveToNextEdge(MSTransportable* container, SUMOTime currentTime, MSEdge* nextInternal = 0);
185 
186 
188  inline double getMaxSpeed() const {
189  return mySpeed;
190  }
191 
192  inline double getDepartPos() const {
193  return myDepartPos;
194  }
195 
196  inline double getArrivalPos() const {
197  return myArrivalPos;
198  }
199 
200  inline const MSEdge* getNextRouteEdge() const {
201  return myRouteStep == myRoute.end() - 1 ? 0 : *(myRouteStep + 1);
202  }
203 
205  return myContainerState;
206  }
207 
208  private:
210  std::vector<const MSEdge*> myRoute;
211 
213  std::vector<const MSEdge*>::iterator myRouteStep;
214 
216  double myDepartPos;
217 
219  double mySpeed;
220 
223 
226 
227  private:
230 
233 
234  };
235 
236 public:
239 
241  virtual ~MSContainer();
242 
243  /* @brief proceeds to the next step of the route,
244  * @return Whether the persons plan continues */
245  virtual bool proceed(MSNet* net, SUMOTime time);
246 
252  virtual void tripInfoOutput(OutputDevice& os) const;
253 
260  virtual void routeOutput(OutputDevice& os, const bool withRouteLength) const;
261 
262 private:
264  MSContainer(const MSContainer&);
265 
268 
269 };
270 
271 
272 #endif
273 
274 /****************************************************************************/
virtual ~MSContainer()
destructor
long long int SUMOTime
Definition: SUMOTime.h:35
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:213
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSContainer.cpp:65
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
double getDistance() const
get travel distance in this stage
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:73
double myDepartPos
the depart position
Definition: MSContainer.h:216
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:92
The car-following model and parameter.
Definition: MSVehicleType.h:66
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
std::vector< const MSEdge * > myRoute
The route of the container.
Definition: MSContainer.h:210
A road/street connecting two junctions.
Definition: MSEdge.h:76
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Representation of a vehicle.
Definition: SUMOVehicle.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
const MSEdge * getNextRouteEdge() const
Definition: MSContainer.h:200
double mySpeed
the speed of the container
Definition: MSContainer.h:219
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
double getMaxSpeed() const
accessors to be used by MSCModel_NonInteracting
Definition: MSContainer.h:188
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
Position getPosition(SUMOTime now) const
returns the position of the transportable
CState * myContainerState
state that is to be manipulated by MSCModel
Definition: MSContainer.h:222
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
MSContainerStage_Driving(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines)
constructor
Definition: MSContainer.cpp:48
Structure representing possible vehicle parameter.
std::string getStageSummary() const
return string summary of the current stage
Definition: MSContainer.cpp:95
std::string getStageDescription() const
returns the stage description as a string
Definition: MSContainer.cpp:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
The container following model for tranship.
std::string getStageDescription() const
Returns the current stage description as a string.
Definition: MSContainer.h:154
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
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:225