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-2026 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, const SumoXMLAttrMask& 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:
157 MSMeanData_Amitran(const std::string& id,
158 const SUMOTime dumpBegin, const SUMOTime dumpEnd,
159 const bool useLanes, const std::string& excludeEmpty,
160 const bool withInternal, const bool trackVehicles, const int detectPersons,
161 const double maxTravelTime, const double minSamples,
162 const double haltSpeed, const std::string& vTypes,
163 const std::string& writeAttributes,
164 const std::vector<MSEdge*>& edges,
165 AggregateType aggregate);
166
167
169 virtual ~MSMeanData_Amitran();
170
173
180 virtual void writeXMLDetectorProlog(OutputDevice& dev) const;
182
187 virtual std::string getEdgeID(const MSEdge* const edge);
188
195 virtual void openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime);
196
205 virtual void writePrefix(OutputDevice& dev, const MeanDataValues& values,
206 const SumoXMLTag tag, const std::string id) const;
207
208protected:
214 MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
215
221 void resetOnly(SUMOTime stopTime);
222
223private:
225 const double myHaltSpeed;
226
229
232
233};
long long int SUMOTime
Definition GUI.h:36
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::bitset< 96 > SumoXMLAttrMask
AggregateType
Numbers representing special SUMO-XML-attribute values Information on edgeData/laneData output should...
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.
void write(OutputDevice &dev, const SumoXMLAttrMask &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 notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
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 void writePrefix(OutputDevice &dev, const MeanDataValues &values, const SumoXMLTag tag, const std::string id) const
Writes the surrounding element 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.