Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSQueueExport.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2012-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/****************************************************************************/
18// Export the queueing length in front of a junction (very experimental!)
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <functional>
24#include <map>
25#include <utility>
26#include <vector>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class OutputDevice;
34class MSEdgeControl;
35class MSEdge;
36class MSLane;
37class MESegment;
38
39
40// ===========================================================================
41// class definitions
42// ===========================================================================
53public:
62 static void write(OutputDevice& of, SUMOTime timestep);
63
69 static void finish(OutputDevice& of, SUMOTime timestep);
70
71
72private:
75
78
82 static void writeEdge(OutputDevice* of, double threshold, const std::function<void()>& ensureOpen);
83
85 static void writeLane(OutputDevice* of, const MSLane& lane, double threshold, const std::function<void()>& ensureOpen);
86
88 static void writeMesoQueue(OutputDevice* of, const MSEdge& edge, const MESegment& segment, int qIdx, double segmentOffset, double threshold, const std::function<void()>& ensureOpen);
89
91 static void writeInterval(OutputDevice& of, SUMOTime begin, SUMOTime end);
92
94 static double percentile(const std::vector<double>& sorted, double p);
95
98
100 static std::map<const MSEdge*, std::vector<std::pair<double, double> > > myEdgeSamples;
101
102};
long long int SUMOTime
Definition GUI.h:36
A single mesoscopic segment (cell)
Definition MESegment.h:50
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
Export the queueing length in front of a junction (very experimental!)
static SUMOTime myIntervalStart
The begin of the current aggregation interval.
static void writeMesoQueue(OutputDevice *of, const MSEdge &edge, const MESegment &segment, int qIdx, double segmentOffset, double threshold, const std::function< void()> &ensureOpen)
Checks a single segment queue (meso)
static double percentile(const std::vector< double > &sorted, double p)
Returns the given percentile (with linear interpolation) of a sorted sample vector.
static void finish(OutputDevice &of, SUMOTime timestep)
Writes the last (possibly incomplete) aggregation interval and clears the collected samples.
static void writeLane(OutputDevice *of, const MSLane &lane, double threshold, const std::function< void()> &ensureOpen)
Checks a single lane for a vehicle queue (micro)
static void writeInterval(OutputDevice &of, SUMOTime begin, SUMOTime end)
Writes aggregated per-edge queue length statistics for the given interval.
static void write(OutputDevice &of, SUMOTime timestep)
Export the queueing length in front of a junction (very experimental!)
MSQueueExport(const MSQueueExport &)
Invalidated copy constructor.
static std::map< const MSEdge *, std::vector< std::pair< double, double > > > myEdgeSamples
Queue length samples (in vehicles, in meters) per edge, collected during the current aggregation inte...
static void writeEdge(OutputDevice *of, double threshold, const std::function< void()> &ensureOpen)
Iterates through the edges and their lanes (micro) or segment queues (meso). If of is nullptr,...
MSQueueExport & operator=(const MSQueueExport &)
Invalidated assignment operator.
Static storage of an output device and its base (abstract) implementation.