SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 getEdgePos(SUMOTime now) const
Returns the offset from the start of the current edge measured in its natural direction.
SUMOReal myDepartPos
the depart position
Definition: MSContainer.h:211
virtual void beginEventOutput(const MSTransportable &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
long long int SUMOTime
Definition: SUMOTime.h:43
MSContainerStage_Tranship & operator=(const MSContainerStage_Tranship &)
Invalidated assignment operator.
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
MSContainerStage_Tranship(const std::vector< const MSEdge * > &route, MSStoppingPlace *toStop, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos)
constructor
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSContainer.cpp:98
const MSEdge * getEdge() const
Returns the current edge.
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
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
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 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
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
Position getPosition(SUMOTime now) const
Returns the position of the container.
SUMOReal myArrivalPos
the position at which we want to arrive
SUMOReal getSpeed() const
Returns the speed of the container.
virtual void endEventOutput(const MSTransportable &c, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
const MSEdge * getFromEdge() const
Returns first edge of the containers route.
CState * myContainerState
state that is to be manipulated by MSCModel
Definition: MSContainer.h:217
bool moveToNextEdge(MSTransportable *container, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the container arrived
virtual void proceed(MSNet *net, MSTransportable *container, SUMOTime now, Stage *previous)
proceeds to the next step
const MSEdge * getNextRouteEdge() const
Definition: MSContainer.h:195
std::string getStageDescription() const
returns the stage description as a string
Definition: MSContainer.cpp:92
Structure representing possible vehicle parameter.
virtual bool proceed(MSNet *net, SUMOTime time)
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
SUMOTime getWaitingTime(SUMOTime now) const
Returns the time the container spent waiting.
#define SUMOReal
Definition: config.h:214
MSContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportablePlan *plan)
constructor
The container following model for tranship.
const MSEdge * getToEdge() const
Returns last edge of the containers route.
SUMOReal getAngle(SUMOTime now) const
Returns the angle of the container.
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
MSContainer & operator=(const MSContainer &)
Invalidated assignment operator.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
MSEdge * myCurrentInternalEdge
The current internal edge this container is on or 0.
Definition: MSContainer.h:220