Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSMeanData_Amitran.h
Go to the documentation of this file.
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/****************************************************************************/
20// Network state mean data collector for edges/lanes
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include <vector>
26#include <set>
27#include <limits>
28#include "MSMeanData.h"
29
30
31// ===========================================================================
32// class declarations
33// ===========================================================================
34class OutputDevice;
35class MSEdgeControl;
36class MSEdge;
37class MSLane;
38
39
40// ===========================================================================
41// class definitions
42// ===========================================================================
55public:
64 public:
68 MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
69 const MSMeanData_Amitran* parent);
70
72 virtual ~MSLaneMeanDataValues();
73
76 void reset(bool afterWrite = false);
77
82 void addTo(MSMeanData::MeanDataValues& val) const;
83
86
100 bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
102
103 bool isEmpty() const;
104
112 void write(OutputDevice& dev, long long int attributeMask, const SUMOTime period,
113 const int numLanes, const double speedLimit, const double defaultTravelTime,
114 const int numVehicles = -1) const;
115
116 protected:
120 void notifyMoveInternal(const SUMOTrafficObject& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double /* meanLengthOnLane */);
121
122 private:
127
129 std::map<const MSVehicleType*, int> typedAmount;
130
132 std::map<const MSVehicleType*, double> typedSamples;
133
135 std::map<const MSVehicleType*, double> typedTravelDistance;
137
138 };
139
140
141public:
158 MSMeanData_Amitran(const std::string& id,
159 const SUMOTime dumpBegin, const SUMOTime dumpEnd,
160 const bool useLanes, const bool withEmpty, const bool printDefaults,
161 const bool withInternal, const bool trackVehicles, const int detectPersons,
162 const double maxTravelTime, const double minSamples,
163 const double haltSpeed, const std::string& vTypes,
164 const std::string& writeAttributes,
165 const std::vector<MSEdge*>& edges,
166 bool aggregate);
167
168
170 virtual ~MSMeanData_Amitran();
171
174
181 virtual void writeXMLDetectorProlog(OutputDevice& dev) const;
183
188 virtual std::string getEdgeID(const MSEdge* const edge);
189
196 virtual void openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime);
197
207 virtual bool writePrefix(OutputDevice& dev, const MeanDataValues& values,
208 const SumoXMLTag tag, const std::string id) const;
209
210protected:
216 MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
217
223 void resetOnly(SUMOTime stopTime);
224
225private:
227 const double myHaltSpeed;
228
231
234
235};
long long int SUMOTime
Definition GUI.h:36
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual void reset()
Resets collected values.
Stores edges and lanes, performs moving of vehicle.
A road/street connecting two junctions.
Definition MSEdge.h:77
Representation of a lane in the micro simulation.
Definition MSLane.h:84
Data structure for mean (aggregated) edge/lane values.
Definition MSMeanData.h:66
Data structure for mean (aggregated) edge/lane values.
void notifyMoveInternal(const SUMOTrafficObject &veh, const double, const double timeOnLane, const double, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double)
Internal notification about the vehicle moves.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
void write(OutputDevice &dev, long long int attributeMask, const SUMOTime period, const int numLanes, const double speedLimit, const double defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
bool isEmpty() const
Returns whether any data was collected.
std::map< const MSVehicleType *, double > typedTravelDistance
The sum of the distances the vehicles travelled by type.
std::map< const MSVehicleType *, int > typedAmount
The number of vehicles that entered this lane within the sample interval by type.
std::map< const MSVehicleType *, double > typedSamples
The number of sampled vehicle movements by type (in s)
Network state mean data collector for edges/lanes.
virtual void openInterval(OutputDevice &dev, const SUMOTime startTime, const SUMOTime stopTime)
Writes the interval opener.
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.
MSMeanData_Amitran & operator=(const MSMeanData_Amitran &)
Invalidated assignment operator.
MSMeanData_Amitran(const MSMeanData_Amitran &)
Invalidated copy constructor.
virtual bool writePrefix(OutputDevice &dev, const MeanDataValues &values, const SumoXMLTag tag, const std::string id) const
Checks for emptiness and writes prefix into the given stream.
virtual std::string getEdgeID(const MSEdge *const edge)
Return the relevant edge id.
virtual ~MSMeanData_Amitran()
Destructor.
const double myHaltSpeed
the minimum sample seconds
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
Data collector for edges/lanes.
Definition MSMeanData.h:57
Notification
Definition of a vehicle state.
Static storage of an output device and its base (abstract) implementation.
Representation of a vehicle, person, or container.