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-2018 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 
80  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
81 
83  std::string getStageDescription() const;
84  std::string getStageSummary() const;
85 
91  virtual void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
92 
98  virtual void routeOutput(OutputDevice& os, const bool withRouteLength) const;
99  };
100 
108 
109  public:
111  MSContainerStage_Tranship(const std::vector<const MSEdge*>& route, MSStoppingPlace* toStop, double speed, double departPos, double arrivalPos);
112 
115 
117  virtual void proceed(MSNet* net, MSTransportable* container, SUMOTime now, Stage* previous);
118 
120  const MSEdge* getEdge() const;
121 
123  const MSEdge* getFromEdge() const;
124 
126  const MSEdge* getToEdge() const;
127 
129  double getEdgePos(SUMOTime now) const;
130 
132  Position getPosition(SUMOTime now) const;
133 
135  double getAngle(SUMOTime now) const;
136 
138  SUMOTime getWaitingTime(SUMOTime now) const;
139 
141  double getSpeed() const;
142 
144  ConstMSEdgeVector getEdges() const;
145 
147  std::string getStageDescription() const {
148  return "tranship";
149  }
150  std::string getStageSummary() const;
151 
156  virtual void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
157 
162  virtual void routeOutput(OutputDevice& os, const bool withRouteLength) const;
163 
168  virtual void beginEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
169 
174  virtual void endEventOutput(const MSTransportable& c, SUMOTime t, OutputDevice& os) const;
175 
177  bool moveToNextEdge(MSTransportable* container, SUMOTime currentTime, MSEdge* nextInternal = 0);
178 
179 
181  inline double getMaxSpeed() const {
182  return mySpeed;
183  }
184 
185  inline double getDepartPos() const {
186  return myDepartPos;
187  }
188 
189  inline double getArrivalPos() const {
190  return myArrivalPos;
191  }
192 
193  inline const MSEdge* getNextRouteEdge() const {
194  return myRouteStep == myRoute.end() - 1 ? 0 : *(myRouteStep + 1);
195  }
196 
198  return myContainerState;
199  }
200 
201  private:
203  std::vector<const MSEdge*> myRoute;
204 
206  std::vector<const MSEdge*>::iterator myRouteStep;
207 
209  double myDepartPos;
210 
212  double mySpeed;
213 
216 
219 
220  private:
223 
226 
227  };
228 
229 public:
232 
234  virtual ~MSContainer();
235 
236  /* @brief proceeds to the next step of the route,
237  * @return Whether the persons plan continues */
238  virtual bool proceed(MSNet* net, SUMOTime time);
239 
245  virtual void tripInfoOutput(OutputDevice& os) const;
246 
253  virtual void routeOutput(OutputDevice& os, const bool withRouteLength) const;
254 
255 private:
257  MSContainer(const MSContainer&);
258 
261 
262 };
263 
264 
265 #endif
266 
267 /****************************************************************************/
virtual ~MSContainer()
destructor
long long int SUMOTime
Definition: SUMOTime.h:36
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:206
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSContainer.cpp:61
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:72
double myDepartPos
the depart position
Definition: MSContainer.h:209
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:84
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:203
A road/street connecting two junctions.
Definition: MSEdge.h:75
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Representation of a vehicle.
Definition: SUMOVehicle.h:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
const MSEdge * getNextRouteEdge() const
Definition: MSContainer.h:193
double mySpeed
the speed of the container
Definition: MSContainer.h:212
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
double getMaxSpeed() const
accessors to be used by MSCModel_NonInteracting
Definition: MSContainer.h:181
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:215
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:91
std::string getStageDescription() const
returns the stage description as a string
Definition: MSContainer.cpp:85
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:147
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
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:218