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 /****************************************************************************/
16 // The container following model for tranship (prototype)
17 /****************************************************************************/
18 #ifndef MSCModel_NonInteracting_h
19 #define MSCModel_NonInteracting_h
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <limits>
28 #include <utils/common/SUMOTime.h>
29 #include <utils/common/Command.h>
30 #include <microsim/MSContainer.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class MSNet;
37 class MSLink;
38 class MSLane;
39 class MSJunction;
40 class CState;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
52 public:
53 
56 
58 
60 
62  static void cleanup();
63 
66 
67 private:
69 
70 private:
71  class MoveToNextEdge : public Command {
72  public:
75  SUMOTime execute(SUMOTime currentTime);
76 
77  private:
80  private:
83  };
84 
85 
86 private:
89 
90 };
91 
92 class CState {
93 public:
94  CState() {};
95 
96  ~CState() {};
97 
98  // @brief walking directions
99  static const int FORWARD;
100  static const int BACKWARD;
101  static const int UNDEFINED_DIRECTION;
102 
104  static const double LATERAL_OFFSET;
105 
107  double getEdgePos(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const;
111  double getAngle(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const;
113  double getSpeed(const MSContainer::MSContainerStage_Tranship& stage) const;
116 
117 
118 private:
123  Position myCurrentBeginPosition; //the position the container is moving from during its tranship stage
124  Position myCurrentEndPosition; //the position the container is moving to during its tranship stage
125 
126 };
127 
128 
129 #endif /* MSCModel_NonInteracting_h */
130 
CState::getSpeed
double getSpeed(const MSContainer::MSContainerStage_Tranship &stage) const
return the current speed of the container
Definition: MSCModel_NonInteracting.cpp:128
MSCModel_NonInteracting::cleanup
static void cleanup()
remove state at simulation end
Definition: MSCModel_NonInteracting.cpp:80
SUMOTime.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
CState::UNDEFINED_DIRECTION
static const int UNDEFINED_DIRECTION
Definition: MSCModel_NonInteracting.h:101
MSJunction
The base class for an intersection.
Definition: MSJunction.h:61
MSCModel_NonInteracting::MoveToNextEdge
Definition: MSCModel_NonInteracting.h:71
CState::myCurrentEndPos
double myCurrentEndPos
Definition: MSCModel_NonInteracting.h:122
CState::myCurrentDuration
SUMOTime myCurrentDuration
Definition: MSCModel_NonInteracting.h:120
MSCModel_NonInteracting::MoveToNextEdge::execute
SUMOTime execute(SUMOTime currentTime)
Executes the command.
Definition: MSCModel_NonInteracting.cpp:89
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:92
CState::myCurrentBeginPos
double myCurrentBeginPos
Definition: MSCModel_NonInteracting.h:121
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
CState::FORWARD
static const int FORWARD
Definition: MSCModel_NonInteracting.h:96
MSCModel_NonInteracting::MoveToNextEdge::myContainer
MSTransportable * myContainer
Definition: MSCModel_NonInteracting.h:79
CState::CState
CState()
Definition: MSCModel_NonInteracting.h:94
MSTransportable
Definition: MSTransportable.h:59
CState::myCurrentEndPosition
Position myCurrentEndPosition
Definition: MSCModel_NonInteracting.h:124
CState
Definition: MSCModel_NonInteracting.h:92
MSCModel_NonInteracting::~MSCModel_NonInteracting
~MSCModel_NonInteracting()
Definition: MSCModel_NonInteracting.cpp:58
CState::~CState
~CState()
Definition: MSCModel_NonInteracting.h:96
MSCModel_NonInteracting::MoveToNextEdge::~MoveToNextEdge
~MoveToNextEdge()
Definition: MSCModel_NonInteracting.h:74
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:71
MSCModel_NonInteracting
The container following model for tranship.
Definition: MSCModel_NonInteracting.h:51
MSCModel_NonInteracting::myNet
MSNet * myNet
the net to which to issue moveToNextEdge commands
Definition: MSCModel_NonInteracting.h:88
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:118
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
MSCModel_NonInteracting::MSCModel_NonInteracting
MSCModel_NonInteracting(MSNet *net)
Constructor (it should not be necessary to construct more than one instance)
Definition: MSCModel_NonInteracting.cpp:52
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
MSCModel_NonInteracting::myModel
static MSCModel_NonInteracting * myModel
Definition: MSCModel_NonInteracting.h:68
MSContainer.h
CState::BACKWARD
static const int BACKWARD
Definition: MSCModel_NonInteracting.h:100
CState::myLastEntryTime
SUMOTime myLastEntryTime
Definition: MSCModel_NonInteracting.h:119
Command
Base (microsim) event class.
Definition: Command.h:53
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:134
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:104
CState::LATERAL_OFFSET
static const double LATERAL_OFFSET
the offset for computing container positions when being transhiped
Definition: MSCModel_NonInteracting.h:104
config.h
MSCModel_NonInteracting::MoveToNextEdge::MoveToNextEdge
MoveToNextEdge(MSTransportable *container, MSContainer::MSContainerStage_Tranship &tranship)
Definition: MSCModel_NonInteracting.h:73
Command.h
MSContainer::MSContainerStage_Tranship
Definition: MSContainer.h:108
CState::getPosition
Position getPosition(const MSContainer::MSContainerStage_Tranship &stage, SUMOTime now) const
return the network coordinate of the container
Definition: MSCModel_NonInteracting.cpp:110
CState::myCurrentBeginPosition
Position myCurrentBeginPosition
Definition: MSCModel_NonInteracting.h:123
MSCModel_NonInteracting::MoveToNextEdge::myParent
MSContainer::MSContainerStage_Tranship & myParent
Definition: MSCModel_NonInteracting.h:78
MSCModel_NonInteracting::getModel
static MSCModel_NonInteracting * getModel()
Definition: MSCModel_NonInteracting.cpp:62