/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file METriggeredCalibrator.h14/// @author Daniel Krajzewicz15/// @date Tue, May 200516///17// Calibrates the flow on a segment to a specified one18/****************************************************************************/19#pragma once20#include <config.h>2122#include <string>23#include <vector>24#include <microsim/trigger/MSCalibrator.h>25#include <mesosim/MESegment.h>262728// ===========================================================================29// class definitions30// ===========================================================================31/**32* @class METriggeredCalibrator33* @brief Calibrates the flow on a segment to a specified one34*/35class METriggeredCalibrator : public MSCalibrator {36public:37/** constructor */38METriggeredCalibrator(const std::string& id,39MSEdge* const edge, const double pos,40const std::string& aXMLFilename,41const std::string& outputFilename,42const SUMOTime freq, const double length,43const MSRouteProbe* probe,44const double invalidJamThreshold,45const std::string& vTypes);4647/** destructor */48virtual ~METriggeredCalibrator();495051/** the implementation of the MSTrigger / Command interface.52Calibrating takes place here. */53SUMOTime execute(SUMOTime currentTime);5455protected:5657bool tryEmit(MESegment* s, MEVehicle* vehicle);5859inline int passed() const {60// calibrator measures at start of segment61return myEdgeMeanData.nVehEntered + myEdgeMeanData.nVehDeparted - myEdgeMeanData.nVehVaporized;62}6364/// @brief returns whether the segment is jammed although it should not be65bool invalidJam() const;6667/// @brief returns the number of vehicles (of the current type) that still fit onto the segment68int remainingVehicleCapacity() const;6970/// @brief reset collected vehicle data71void reset();7273/// @brief do nothing74void updateMeanData() {}7576/// @brief returns the maximum number of vehicles that could enter from upstream until the calibrator is activated again77inline int maximumInflow() const {78return (int)std::ceil((double)myFrequency / (double)mySegment->getMinimumHeadwayTime());79}8081private:82/// @brief mesoscopic edge segment the calibrator lies on83MESegment* mySegment;8485};868788