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.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Calibrates the flow on a segment to a specified one
16 /****************************************************************************/
17 #ifndef METriggeredCalibrator_h
18 #define METriggeredCalibrator_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <vector>
29 #include <mesosim/MESegment.h>
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
40 public:
42  METriggeredCalibrator(const std::string& id,
43  const MSEdge* const edge, const double pos,
44  const std::string& aXMLFilename,
45  const std::string& outputFilename,
46  const SUMOTime freq, const double length,
47  const MSRouteProbe* probe,
48  const std::string& vTypes);
49 
51  virtual ~METriggeredCalibrator();
52 
53 
56  SUMOTime execute(SUMOTime currentTime);
57 
58 protected:
59 
60  bool tryEmit(MESegment* s, MEVehicle* vehicle);
61 
62  inline int passed() const {
63  // calibrator measures at start of segment
65  }
66 
68  bool invalidJam() const;
69 
71  int remainingVehicleCapacity() const;
72 
74  void reset();
75 
77  void updateMeanData() {}
78 
80  inline int maximumInflow() const {
81  return (int)std::ceil((double)myFrequency / (double)mySegment->getMinimumHeadwayTime());
82  }
83 
84 private:
87 
88 };
89 
90 #endif
91 
92 /****************************************************************************/
MEVehicle
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:45
METriggeredCalibrator::tryEmit
bool tryEmit(MESegment *s, MEVehicle *vehicle)
Definition: METriggeredCalibrator.cpp:78
METriggeredCalibrator::execute
SUMOTime execute(SUMOTime currentTime)
Definition: METriggeredCalibrator.cpp:90
MESegment
A single mesoscopic segment (cell)
Definition: MESegment.h:50
MSCalibrator::myFrequency
SUMOTime myFrequency
The frequeny with which to check for calibration.
Definition: MSCalibrator.h:283
MSRouteProbe
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:61
MSCalibrator.h
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
METriggeredCalibrator::remainingVehicleCapacity
int remainingVehicleCapacity() const
returns the number of vehicles (of the current type) that still fit onto the segment
Definition: METriggeredCalibrator.cpp:252
METriggeredCalibrator
Calibrates the flow on a segment to a specified one.
Definition: METriggeredCalibrator.h:39
METriggeredCalibrator::passed
int passed() const
Definition: METriggeredCalibrator.h:62
MESegment.h
METriggeredCalibrator::mySegment
MESegment * mySegment
mesoscopic edge segment the calibrator lies on
Definition: METriggeredCalibrator.h:86
METriggeredCalibrator::~METriggeredCalibrator
virtual ~METriggeredCalibrator()
Definition: METriggeredCalibrator.cpp:66
METriggeredCalibrator::reset
void reset()
reset collected vehicle data
Definition: METriggeredCalibrator.cpp:260
MSMeanData_Net::MSLaneMeanDataValues::nVehVaporized
int nVehVaporized
The number of vehicles that left this lane within the sample interval.
Definition: MSMeanData_Net.h:165
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
MSCalibrator::myEdgeMeanData
MSMeanData_Net::MSLaneMeanDataValues myEdgeMeanData
accumlated data for the whole edge
Definition: MSCalibrator.h:262
METriggeredCalibrator::invalidJam
bool invalidJam() const
returns whether the segment is jammed although it should not be
Definition: METriggeredCalibrator.cpp:241
METriggeredCalibrator::maximumInflow
int maximumInflow() const
returns the maximum number of vehicles that could enter from upstream until the calibrator is activat...
Definition: METriggeredCalibrator.h:80
config.h
METriggeredCalibrator::updateMeanData
void updateMeanData()
do nothing
Definition: METriggeredCalibrator.h:77
MSMeanData_Net::MSLaneMeanDataValues::nVehEntered
int nVehEntered
The number of vehicles that entered this lane within the sample interval.
Definition: MSMeanData_Net.h:159
MSMeanData_Net::MSLaneMeanDataValues::nVehDeparted
int nVehDeparted
Definition: MSMeanData_Net.h:153
MSCalibrator
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:51
METriggeredCalibrator::METriggeredCalibrator
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 std::string &vTypes)
Definition: METriggeredCalibrator.cpp:52
MESegment::getMinimumHeadwayTime
SUMOTime getMinimumHeadwayTime() const
return the minimum headway-time with which vehicles may enter or leave this segment
Definition: MESegment.h:375