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 MEInductLoop.h 15 : /// @author Daniel Krajzewicz 16 : /// @date Tue, May 2005 17 : /// 18 : // An induction loop for mesoscopic simulation 19 : /****************************************************************************/ 20 : #pragma once 21 : #include <config.h> 22 : 23 : #include <string> 24 : #include <deque> 25 : #include <map> 26 : #include <functional> 27 : #include <microsim/output/MSDetectorFileOutput.h> 28 : #include <microsim/output/MSMeanData_Net.h> 29 : #include <utils/iodevices/OutputDevice.h> 30 : #include <utils/common/Named.h> 31 : 32 : 33 : // =========================================================================== 34 : // class declarations 35 : // =========================================================================== 36 : class MESegment; 37 : 38 : // =========================================================================== 39 : // class definitions 40 : // =========================================================================== 41 : /** 42 : * @class MEInductLoop 43 : * @brief An induction loop for mesoscopic simulation 44 : */ 45 : class MEInductLoop : public MSDetectorFileOutput { 46 : public: 47 : MEInductLoop(const std::string& id, 48 : MESegment* s, 49 : double positionInMeters, 50 : const std::string name, const std::string& vTypes, 51 : const std::string& nextEdges, 52 : int detectPersons); 53 : 54 : 55 : ~MEInductLoop(); 56 : 57 : /** 58 : * @name Inherited MSDetectorFileOutput methods. 59 : * 60 : * @see MSDetectorFileOutput 61 : */ 62 : //@{ 63 : /** @brief Opens the XML-output using "detector" as root element 64 : * 65 : * @param[in] dev The output device to write the root into 66 : * @see MSDetectorFileOutput::writeXMLDetectorProlog 67 : */ 68 367 : void writeXMLDetectorProlog(OutputDevice& dev) const { 69 1101 : dev.writeXMLHeader("detector", "det_e1meso_file.xsd"); 70 367 : } 71 : 72 : 73 : /** 74 : * Get the XML-formatted output of all the get*-methods except 75 : * getTimeSinceLastDetection. 76 : * 77 : * @param lastNTimesteps take data out of the interval 78 : * (now-lastNTimesteps, now]. 79 : * 80 : * @return XML-formatted output of all the get*-methods except 81 : * getTimeSinceLastDetection. 82 : * 83 : * @see MSDetector2File 84 : */ 85 : void writeXMLOutput(OutputDevice& dev, 86 : SUMOTime startTime, SUMOTime stopTime); 87 : //@} 88 : 89 : const MSMeanData_Net::MSLaneMeanDataValues& getMeanData() const { 90 120 : return myMeanData; 91 : } 92 : 93 : const MSEdge& getEdge() const; 94 : 95 : protected: 96 : /// @brief name 97 : const std::string myName; 98 : 99 : /// @brief mesoscopic edge segment the loop lies on 100 : MESegment* const mySegment; 101 : 102 : /// @brief position from the start of the edge / lane 103 : const double myPosition; 104 : 105 : /// @brief data collector for the loop 106 : MSMeanData_Net::MSLaneMeanDataValues myMeanData; 107 : 108 : private: 109 : 110 : /// Hidden default constructor. 111 : MEInductLoop(); 112 : 113 : /// Hidden copy constructor. 114 : MEInductLoop(const MEInductLoop&); 115 : 116 : /// Hidden assignment operator. 117 : MEInductLoop& operator=(const MEInductLoop&); 118 : };