Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4 : // This program and the accompanying materials are made available under the
5 : // terms of the Eclipse Public License 2.0 which is available at
6 : // https://www.eclipse.org/legal/epl-2.0/
7 : // This Source Code may also be made available under the following Secondary
8 : // Licenses when the conditions for such availability set forth in the Eclipse
9 : // Public License 2.0 are satisfied: GNU General Public License, version 2
10 : // or later which is available at
11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 : /****************************************************************************/
14 : /// @file MSStageWaiting.h
15 : /// @author Michael Behrisch
16 : /// @author Jakob Erdmann
17 : /// @date Wed, 1 Jun 2022
18 : ///
19 : // An stage for planned waiting (stopping)
20 : /****************************************************************************/
21 : #pragma once
22 : #include <config.h>
23 :
24 : #include <microsim/transportables/MSStage.h>
25 :
26 : // ===========================================================================
27 : // class declarations
28 : // ===========================================================================
29 : class MSEdge;
30 : class MSLane;
31 : class MSNet;
32 : class MSStoppingPlace;
33 : class MSVehicleType;
34 : class OutputDevice;
35 : class MSTransportable;
36 :
37 :
38 : /**
39 : * A "real" stage performing a waiting over the specified time
40 : */
41 : class MSStageWaiting : public MSStage {
42 : public:
43 : /// constructor
44 : MSStageWaiting(const MSEdge* destination, MSStoppingPlace* toStop, SUMOTime duration, SUMOTime until,
45 : double pos, const std::string& actType, const bool initial, SUMOTime jumpDuration = -1);
46 :
47 : /// destructor
48 : virtual ~MSStageWaiting();
49 :
50 : MSStage* clone() const;
51 :
52 : /// abort this stage (TraCI)
53 : void abort(MSTransportable*);
54 :
55 : SUMOTime getUntil() const;
56 :
57 : SUMOTime getPlannedDuration() const;
58 :
59 59859 : SUMOTime getJumpDuration() const {
60 59859 : return myJumpDuration;
61 : }
62 :
63 57699 : SUMOTime getTravelTime() const {
64 : // not a travelling stage
65 57699 : return 0;
66 : }
67 :
68 : SUMOTime getDuration() const;
69 :
70 : SUMOTime getStopEnd() const {
71 0 : return myStopEndTime;
72 : }
73 : ///
74 : Position getPosition(SUMOTime now) const;
75 :
76 : double getAngle(SUMOTime now) const;
77 :
78 : /// @brief get travel distance in this stage
79 74 : double getDistance() const {
80 74 : return 0;
81 : }
82 :
83 : std::string getStageDescription(const bool isPerson) const;
84 :
85 : std::string getStageSummary(const bool isPerson) const;
86 :
87 : /// proceeds to the next step
88 : void proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* previous);
89 :
90 : /** @brief Called on writing tripinfo output
91 : *
92 : * @param[in] os The stream to write the information into
93 : * @exception IOError not yet implemented
94 : */
95 : void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
96 :
97 : /** @brief Called on writing vehroute output
98 : * @param[in] isPerson Whether we are writing person or container info
99 : * @param[in] os The stream to write the information into
100 : * @param[in] withRouteLength whether route length shall be written
101 : * @param[in] previous The previous stage for additional info such as from edge
102 : * @exception IOError not yet implemented
103 : */
104 : void routeOutput(const bool isPerson, OutputDevice& os, const bool withRouteLength, const MSStage* const previous) const;
105 :
106 : void saveState(std::ostringstream& out);
107 :
108 : void loadState(MSTransportable* transportable, std::istringstream& state);
109 :
110 : private:
111 : /// the time the person is waiting
112 : SUMOTime myWaitingDuration;
113 :
114 : /// the time until the person is waiting
115 : SUMOTime myWaitingUntil;
116 :
117 : /// @brief waiting position at stopping place
118 : Position myStopWaitPos;
119 :
120 : /// @brief The type of activity
121 : std::string myActType;
122 :
123 : /// @brief the jump duration if this stop is followed by a jump
124 : SUMOTime myJumpDuration;
125 :
126 : /// @brief stores the actual end time of the stop (combination of duration and until)
127 : SUMOTime myStopEndTime;
128 :
129 : private:
130 : /// @brief Invalidated copy constructor.
131 : MSStageWaiting(const MSStageWaiting&);
132 :
133 : /// @brief Invalidated assignment operator.
134 : MSStageWaiting& operator=(const MSStageWaiting&) = delete;
135 :
136 : };
|