Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
METriggeredCalibrator.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-2025 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// Calibrates the flow on a segment to a specified one
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <string>
24#include <vector>
26#include <mesosim/MESegment.h>
27
28
29// ===========================================================================
30// class definitions
31// ===========================================================================
37public:
39 METriggeredCalibrator(const std::string& id,
40 MSEdge* const edge, const double pos,
41 const std::string& aXMLFilename,
42 const std::string& outputFilename,
43 const SUMOTime freq, const double length,
44 const MSRouteProbe* probe,
45 const double invalidJamThreshold,
46 const std::string& vTypes);
47
49 virtual ~METriggeredCalibrator();
50
51
54 SUMOTime execute(SUMOTime currentTime);
55
56protected:
57
58 bool tryEmit(MESegment* s, MEVehicle* vehicle);
59
60 inline int passed() const {
61 // calibrator measures at start of segment
62 return myEdgeMeanData.nVehEntered + myEdgeMeanData.nVehDeparted - myEdgeMeanData.nVehVaporized;
63 }
64
66 bool invalidJam() const;
67
69 int remainingVehicleCapacity() const;
70
72 void reset();
73
76
78 inline int maximumInflow() const {
79 return (int)std::ceil((double)myFrequency / (double)mySegment->getMinimumHeadwayTime());
80 }
81
82private:
85
86};
long long int SUMOTime
Definition GUI.h:36
A single mesoscopic segment (cell).
Definition MESegment.h:50
void reset()
reset collected vehicle data
int maximumInflow() const
returns the maximum number of vehicles that could enter from upstream until the calibrator is activat...
SUMOTime execute(SUMOTime currentTime)
int remainingVehicleCapacity() const
returns the number of vehicles (of the current type) that still fit onto the segment
bool invalidJam() const
returns whether the segment is jammed although it should not be
void updateMeanData()
do nothing
MESegment * mySegment
mesoscopic edge segment the calibrator lies on
bool tryEmit(MESegment *s, MEVehicle *vehicle)
METriggeredCalibrator(const std::string &id, MSEdge *const edge, const double pos, const std::string &aXMLFilename, const std::string &outputFilename, const SUMOTime freq, const double length, const MSRouteProbe *probe, const double invalidJamThreshold, const std::string &vTypes)
A vehicle from the mesoscopic point of view.
Definition MEVehicle.h:42
MSCalibrator(const std::string &id, MSEdge *const edge, MSLane *const lane, MSJunction *const node, const double pos, const std::string &aXMLFilename, const std::string &outputFilename, const SUMOTime freq, const double length, const MSRouteProbe *probe, const double invalidJamThreshold, const std::string &vTypes, const bool local, const bool addLaneMeanData)
MSMeanData_Net::MSLaneMeanDataValues myEdgeMeanData
accumlated data for the whole edge
SUMOTime myFrequency
The frequeny with which to check for calibration.
A road/street connecting two junctions.
Definition MSEdge.h:77
Writes routes of vehicles passing a certain edge.