Eclipse SUMO - Simulation of Urban MObility
MSCModel_NonInteracting.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2014-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 /****************************************************************************/
15 // The container following model for tranship (prototype)
16 /****************************************************************************/
17 #ifndef MSCModel_NonInteracting_h
18 #define MSCModel_NonInteracting_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <string>
26 #include <limits>
27 #include <utils/common/SUMOTime.h>
28 #include <utils/common/Command.h>
29 #include <microsim/MSContainer.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class MSNet;
36 class MSLink;
37 class MSLane;
38 class MSJunction;
39 class CState;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
51 public:
52 
55 
57 
59 
61  static void cleanup();
62 
65 
66 private:
68 
69 private:
70  class MoveToNextEdge : public Command {
71  public:
74  SUMOTime execute(SUMOTime currentTime);
75 
76  private:
79  private:
82  };
83 
84 
85 private:
88 
89 };
90 
91 class CState {
92 public:
93  CState() {};
94 
95  ~CState() {};
96 
97  // @brief walking directions
98  static const int FORWARD;
99  static const int BACKWARD;
100  static const int UNDEFINED_DIRECTION;
101 
103  static const double LATERAL_OFFSET;
104 
106  double getEdgePos(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const;
110  double getAngle(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const;
112  double getSpeed(const MSContainer::MSContainerStage_Tranship& stage) const;
115 
116 
117 private:
122  Position myCurrentBeginPosition; //the position the container is moving from during its tranship stage
123  Position myCurrentEndPosition; //the position the container is moving to during its tranship stage
124 
125 };
126 
127 
128 #endif /* MSCModel_NonInteracting_h */
129 
CState::getSpeed
double getSpeed(const MSContainer::MSContainerStage_Tranship &stage) const
return the current speed of the container
Definition: MSCModel_NonInteracting.cpp:127
MSCModel_NonInteracting::cleanup
static void cleanup()
remove state at simulation end
Definition: MSCModel_NonInteracting.cpp:79
SUMOTime.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
CState::UNDEFINED_DIRECTION
static const int UNDEFINED_DIRECTION
Definition: MSCModel_NonInteracting.h:100
MSJunction
The base class for an intersection.
Definition: MSJunction.h:60
MSCModel_NonInteracting::MoveToNextEdge
Definition: MSCModel_NonInteracting.h:70
CState::myCurrentEndPos
double myCurrentEndPos
Definition: MSCModel_NonInteracting.h:121
CState::myCurrentDuration
SUMOTime myCurrentDuration
Definition: MSCModel_NonInteracting.h:119
MSCModel_NonInteracting::MoveToNextEdge::execute
SUMOTime execute(SUMOTime currentTime)
Executes the command.
Definition: MSCModel_NonInteracting.cpp:88
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
CState::myCurrentBeginPos
double myCurrentBeginPos
Definition: MSCModel_NonInteracting.h:120
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
CState::FORWARD
static const int FORWARD
Definition: MSCModel_NonInteracting.h:95
MSCModel_NonInteracting::MoveToNextEdge::myContainer
MSTransportable * myContainer
Definition: MSCModel_NonInteracting.h:78
CState::CState
CState()
Definition: MSCModel_NonInteracting.h:93
MSTransportable
Definition: MSTransportable.h:58
CState::myCurrentEndPosition
Position myCurrentEndPosition
Definition: MSCModel_NonInteracting.h:123
CState
Definition: MSCModel_NonInteracting.h:91
MSCModel_NonInteracting::~MSCModel_NonInteracting
~MSCModel_NonInteracting()
Definition: MSCModel_NonInteracting.cpp:57
CState::~CState
~CState()
Definition: MSCModel_NonInteracting.h:95
MSCModel_NonInteracting::MoveToNextEdge::~MoveToNextEdge
~MoveToNextEdge()
Definition: MSCModel_NonInteracting.h:73
MSCModel_NonInteracting::add
CState * add(MSTransportable *container, MSContainer::MSContainerStage_Tranship *stage, SUMOTime now)
register the given container as a transhiped container
Definition: MSCModel_NonInteracting.cpp:70
MSCModel_NonInteracting
The container following model for tranship.
Definition: MSCModel_NonInteracting.h:50
MSCModel_NonInteracting::myNet
MSNet * myNet
the net to which to issue moveToNextEdge commands
Definition: MSCModel_NonInteracting.h:87
CState::getAngle
double getAngle(const MSContainer::MSContainerStage_Tranship &stage, SUMOTime now) const
return the direction in which the container heading to
Definition: MSCModel_NonInteracting.cpp:117
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
MSCModel_NonInteracting::MSCModel_NonInteracting
MSCModel_NonInteracting(MSNet *net)
Constructor (it should not be necessary to construct more than one instance)
Definition: MSCModel_NonInteracting.cpp:51
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSCModel_NonInteracting::myModel
static MSCModel_NonInteracting * myModel
Definition: MSCModel_NonInteracting.h:67
MSContainer.h
CState::BACKWARD
static const int BACKWARD
Definition: MSCModel_NonInteracting.h:99
CState::myLastEntryTime
SUMOTime myLastEntryTime
Definition: MSCModel_NonInteracting.h:118
Command
Base (microsim) event class.
Definition: Command.h:52
MSCModel_NonInteracting::MoveToNextEdge::operator=
MoveToNextEdge & operator=(const MoveToNextEdge &)
Invalidated assignment operator.
CState::computeTranshipTime
SUMOTime computeTranshipTime(const MSEdge *prev, const MSContainer::MSContainerStage_Tranship &stage, SUMOTime currentTime)
compute tranship time on edge and update state members
Definition: MSCModel_NonInteracting.cpp:133
CState::getEdgePos
double getEdgePos(const MSContainer::MSContainerStage_Tranship &stage, SUMOTime now) const
return the offset from the start of the current edge measured in its natural direction
Definition: MSCModel_NonInteracting.cpp:103
CState::LATERAL_OFFSET
static const double LATERAL_OFFSET
the offset for computing container positions when being transhiped
Definition: MSCModel_NonInteracting.h:103
config.h
MSCModel_NonInteracting::MoveToNextEdge::MoveToNextEdge
MoveToNextEdge(MSTransportable *container, MSContainer::MSContainerStage_Tranship &tranship)
Definition: MSCModel_NonInteracting.h:72
Command.h
MSContainer::MSContainerStage_Tranship
Definition: MSContainer.h:107
CState::getPosition
Position getPosition(const MSContainer::MSContainerStage_Tranship &stage, SUMOTime now) const
return the network coordinate of the container
Definition: MSCModel_NonInteracting.cpp:109
CState::myCurrentBeginPosition
Position myCurrentBeginPosition
Definition: MSCModel_NonInteracting.h:122
MSCModel_NonInteracting::MoveToNextEdge::myParent
MSContainer::MSContainerStage_Tranship & myParent
Definition: MSCModel_NonInteracting.h:77
MSCModel_NonInteracting::getModel
static MSCModel_NonInteracting * getModel()
Definition: MSCModel_NonInteracting.cpp:61