Eclipse SUMO - Simulation of Urban MObility
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-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 /****************************************************************************/
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 // ===========================================================================
37 public:
39  METriggeredCalibrator(const std::string& id,
40  const 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 
56 protected:
57 
58  bool tryEmit(MESegment* s, MEVehicle* vehicle);
59 
60  inline int passed() const {
61  // calibrator measures at start of segment
63  }
64 
66  bool invalidJam() const;
67 
69  int remainingVehicleCapacity() const;
70 
72  void reset();
73 
75  void updateMeanData() {}
76 
78  inline int maximumInflow() const {
79  return (int)std::ceil((double)myFrequency / (double)mySegment->getMinimumHeadwayTime());
80  }
81 
82 private:
85 
86 };
long long int SUMOTime
Definition: GUI.h:35
A single mesoscopic segment (cell)
Definition: MESegment.h:49
SUMOTime getMinimumHeadwayTime() const
return the minimum headway-time with which vehicles may enter or leave this segment
Definition: MESegment.h:465
Calibrates the flow on a segment to a specified one.
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
METriggeredCalibrator(const std::string &id, const 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)
void updateMeanData()
do nothing
MESegment * mySegment
mesoscopic edge segment the calibrator lies on
bool tryEmit(MESegment *s, MEVehicle *vehicle)
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:42
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:47
MSMeanData_Net::MSLaneMeanDataValues myEdgeMeanData
accumlated data for the whole edge
Definition: MSCalibrator.h:299
SUMOTime myFrequency
The frequeny with which to check for calibration.
Definition: MSCalibrator.h:318
A road/street connecting two junctions.
Definition: MSEdge.h:77
int nVehVaporized
The number of vehicles that left this lane via vaporization within the sample interval.
int nVehEntered
The number of vehicles that entered this lane within the sample interval.
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:58