Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2001-2024 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); 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 48442 : SUMOTime getTravelTime() const { 60 : // not a travelling stage 61 48442 : return 0; 62 : } 63 : 64 : SUMOTime getDuration() const; 65 : 66 : SUMOTime getStopEnd() const { 67 0 : return myStopEndTime; 68 : } 69 : /// 70 : Position getPosition(SUMOTime now) const; 71 : 72 : double getAngle(SUMOTime now) const; 73 : 74 : /// @brief get travel distance in this stage 75 99 : double getDistance() const { 76 99 : return 0; 77 : } 78 : 79 : std::string getStageDescription(const bool isPerson) const; 80 : 81 : std::string getStageSummary(const bool isPerson) const; 82 : 83 : /// proceeds to the next step 84 : void proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* previous); 85 : 86 : /** @brief Called on writing tripinfo output 87 : * 88 : * @param[in] os The stream to write the information into 89 : * @exception IOError not yet implemented 90 : */ 91 : void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const; 92 : 93 : /** @brief Called on writing vehroute output 94 : * @param[in] isPerson Whether we are writing person or container info 95 : * @param[in] os The stream to write the information into 96 : * @param[in] withRouteLength whether route length shall be written 97 : * @param[in] previous The previous stage for additional info such as from edge 98 : * @exception IOError not yet implemented 99 : */ 100 : void routeOutput(const bool isPerson, OutputDevice& os, const bool withRouteLength, const MSStage* const previous) const; 101 : 102 : void saveState(std::ostringstream& out); 103 : 104 : void loadState(MSTransportable* transportable, std::istringstream& state); 105 : 106 : private: 107 : /// the time the person is waiting 108 : SUMOTime myWaitingDuration; 109 : 110 : /// the time until the person is waiting 111 : SUMOTime myWaitingUntil; 112 : 113 : /// @brief waiting position at stopping place 114 : Position myStopWaitPos; 115 : 116 : /// @brief The type of activity 117 : std::string myActType; 118 : 119 : /// @brief stores the actual end time of the stop (combination of duration and until) 120 : SUMOTime myStopEndTime; 121 : 122 : private: 123 : /// @brief Invalidated copy constructor. 124 : MSStageWaiting(const MSStageWaiting&); 125 : 126 : /// @brief Invalidated assignment operator. 127 : MSStageWaiting& operator=(const MSStageWaiting&) = delete; 128 : 129 : };