LCOV - code coverage report
Current view: top level - src/mesosim - MESegment.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 75.0 % 52 39
Test Date: 2026-07-26 16:30:20 Functions: 14.3 % 7 1

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-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              : /****************************************************************************/
      14              : /// @file    MESegment.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @date    Tue, May 2005
      17              : ///
      18              : // A single mesoscopic segment (cell)
      19              : /****************************************************************************/
      20              : #pragma once
      21              : #include <config.h>
      22              : 
      23              : #include <vector>
      24              : #include <cassert>
      25              : #include <utils/common/SUMOVehicleClass.h>
      26              : #include <utils/common/Named.h>
      27              : #include <utils/common/SUMOTime.h>
      28              : #include <microsim/MSMoveReminder.h>
      29              : 
      30              : 
      31              : // ===========================================================================
      32              : // class declarations
      33              : // ===========================================================================
      34              : class SUMOVehicle;
      35              : class MSEdge;
      36              : class MSLink;
      37              : class MSDetectorFileOutput;
      38              : class MSVehicleControl;
      39              : class MEVehicle;
      40              : class OutputDevice;
      41              : 
      42              : 
      43              : // ===========================================================================
      44              : // class definitions
      45              : // ===========================================================================
      46              : /**
      47              :  * @class MESegment
      48              :  * @brief A single mesoscopic segment (cell)
      49              :  */
      50              : class MESegment : public Named {
      51              : public:
      52              :     static const double DO_NOT_PATCH_JAM_THRESHOLD;
      53              :     static const int PARKING_QUEUE = -1;
      54              :     /// @brief special param value
      55              :     static const std::string OVERRIDE_TLS_PENALTIES;
      56              : 
      57              :     /// @brief edge type specific meso parameters
      58              :     struct MesoEdgeType {
      59              :         SUMOTime tauff;
      60              :         SUMOTime taufj;
      61              :         SUMOTime taujf;
      62              :         SUMOTime taujj;
      63              :         double jamThreshold;
      64              :         bool junctionControl;
      65              :         double tlsPenalty;
      66              :         double tlsFlowPenalty;
      67              :         SUMOTime minorPenalty;
      68              :         bool overtaking;
      69              :         double edgeLength;
      70              :     };
      71              : 
      72              : 
      73              : protected:
      74      2310728 :     class Queue {
      75              :     public:
      76       758599 :         Queue(const SVCPermissions permissions) : myPermissions(permissions) {}
      77              :         inline int size() const {
      78    256830336 :             return (int)myVehicles.size();
      79              :         }
      80              :         inline const std::vector<MEVehicle*>& getVehicles() const {
      81      1269130 :             return myVehicles;
      82              :         }
      83              :         MEVehicle* remove(MEVehicle* v);
      84              :         inline std::vector<MEVehicle*>& getModifiableVehicles() {
      85     26708120 :             return myVehicles;
      86              :         }
      87              :         inline double getOccupancy() const {
      88    283729177 :             return myOccupancy;
      89              :         }
      90              :         inline void setOccupancy(const double occ) {
      91     26702312 :             myOccupancy = occ;
      92              :         }
      93              :         inline bool allows(SUMOVehicleClass vclass) const {
      94     69417015 :             return (myPermissions & vclass) == vclass;
      95              :         }
      96              : 
      97              :         /// @brief return the next time at which a vehicle may enter this queue
      98              :         inline SUMOTime getEntryBlockTime() const {
      99     18343335 :             return myEntryBlockTime;
     100              :         }
     101              : 
     102              :         /// @brief set the next time at which a vehicle may enter this queue
     103              :         inline void setEntryBlockTime(SUMOTime entryBlockTime) {
     104     25870881 :             myEntryBlockTime = entryBlockTime;
     105     25869720 :         }
     106              : 
     107              :         inline SUMOTime getBlockTime() const {
     108     46626723 :             return myBlockTime;
     109              :         }
     110              :         inline void setBlockTime(SUMOTime t) {
     111     26679671 :             myBlockTime = t;
     112     25885152 :         }
     113              : 
     114              :         inline void setPermissions(SVCPermissions p) {
     115           48 :             myPermissions = p;
     116         2451 :         }
     117              : 
     118              :         void addDetector(MSMoveReminder* data);
     119              : 
     120              :         void addReminders(MEVehicle* veh) const;
     121              : 
     122              :     private:
     123              :         /// The vClass permissions for this queue
     124              :         SVCPermissions myPermissions;
     125              : 
     126              :         std::vector<MEVehicle*> myVehicles;
     127              : 
     128              :         /// @brief The occupied space (in m) in the queue
     129              :         double myOccupancy = 0.;
     130              : 
     131              :         /// @brief The block time for vehicles who wish to enter this queue
     132              :         SUMOTime myEntryBlockTime = SUMOTime_MIN;
     133              : 
     134              :         /// @brief The block time
     135              :         SUMOTime myBlockTime = -1;
     136              : 
     137              :         /// @brief The data collection for all kinds of detectors
     138              :         std::vector<MSMoveReminder*> myDetectorData;
     139              : 
     140              :     };
     141              : 
     142              : public:
     143              :     /** @brief constructor
     144              :      * @param[in] id The id of this segment (currently: "<EDGEID>:<SEGMENTNO>")
     145              :      * @param[in] parent The edge this segment is located within
     146              :      * @param[in] next The following segment (belonging to the same edge)
     147              :      * @param[in] length The segment's length
     148              :      * @param[in] speed The speed allowed on this segment
     149              :      * @param[in] idx The running index of this segment within the segment's edge
     150              :      * @param[in] multiQueue whether to install multiple queues on this segment
     151              :      * @param[in] edgeType edge type specific meso parameters such as the different taus
     152              :      */
     153              :     MESegment(const std::string& id,
     154              :               const MSEdge& parent, MESegment* next,
     155              :               const double length, const double speed,
     156              :               const int idx,
     157              :               const bool multiQueue,
     158              :               const MesoEdgeType& edgeType);
     159              : 
     160              :     /// @brief set model parameters (may be updated from additional file after network loading is complete)
     161              :     void initSegment(const MesoEdgeType& edgeType, const MSEdge& parent, const double capacity);
     162              : 
     163              :     /// @name Measure collection
     164              :     /// @{
     165              : 
     166              :     /** @brief Adds a data collector for a detector to this segment
     167              :      *
     168              :      * @param[in] data The data collector to add
     169              :      * @param[in] queueIndex The queue (aka lane) to use, -1 means all
     170              :      */
     171              :     void addDetector(MSMoveReminder* data, int queueIndex = -1);
     172              : 
     173              :     /** @brief Removes a data collector for a detector from this segment
     174              :      *
     175              :      * @param[in] data The data collector to remove
     176              :      * @note: currently not used
     177              :      */
     178              :     // void removeDetector(MSMoveReminder* data);
     179              : 
     180              :     /** @brief Updates data of a detector for one or all vehicle queues
     181              :      *
     182              :      * @param[in] data The detector data to update
     183              :      * @param[in] queueIndex The queue (aka lane) to use, -1 means all
     184              :      */
     185              :     void prepareDetectorForWriting(MSMoveReminder& data, int queueIndex = -1);
     186              :     /// @}
     187              : 
     188              :     /** @brief Returns whether the given vehicle would still fit into the segment
     189              :      *
     190              :      * @param[in] veh The vehicle to check space for
     191              :      * @param[in] entryTime The time at which the vehicle wants to enter
     192              :      * @param[out] qIdx The index of the queue the vehicle should choose
     193              :      * @param[in] init whether the check is done at insertion time
     194              :      * @return the earliest time a vehicle may be added to this segment
     195              :      */
     196              :     SUMOTime hasSpaceFor(const MEVehicle* const veh, const SUMOTime entryTime, int& qIdx, const bool init = false) const;
     197              : 
     198              :     /// @brief update entry blockTime for all queues
     199     37700288 :     virtual void updateEntryBlockTime(SUMOTime /*time*/) {}
     200              : 
     201              :     /** @brief Inserts (emits) vehicle into the segment
     202              :      *
     203              :      * @param[in] veh The vehicle to emit
     204              :      * @param[in] time The emission time
     205              :      * @return Whether the emission was successful
     206              :      */
     207              :     bool initialise(MEVehicle* veh, SUMOTime time);
     208              : 
     209              :     /** @brief Returns the total number of cars on the segment
     210              :      *
     211              :      * @return the total number of cars on the segment
     212              :      */
     213            0 :     inline int getCarNumber() const {
     214    187743379 :         return myNumVehicles;
     215              :     }
     216              : 
     217              :     /// @brief return the number of queues
     218              :     inline int numQueues() const {
     219      2497840 :         return (int)myQueues.size();
     220              :     }
     221              :     /** @brief Returns the cars in the queue with the given index for visualization
     222              :      * @return the Queue (XXX not thread-safe!)
     223              :      */
     224              :     inline const std::vector<MEVehicle*>& getQueue(int index) const {
     225              :         assert(index < (int)myQueues.size());
     226      1420184 :         return myQueues[index].getVehicles();
     227              :     }
     228              : 
     229              :     inline SUMOTime getQueueBlockTime(int index) const {
     230              :         assert(index < (int)myQueues.size());
     231       245494 :         return myQueues[index].getBlockTime();
     232              :     }
     233              : 
     234              :     /** @brief Returns the running index of the segment in the edge (0 is the most upstream).
     235              :      *
     236              :      * @return the running index of the segment in the edge
     237              :      */
     238              :     inline int getIndex() const {
     239      9307225 :         return myIndex;
     240              :     }
     241              : 
     242              :     /** @brief Returns the following segment on the same edge (0 if it is the last).
     243              :      *
     244              :      * @return the following segment on the same edge (0 if it is the last)
     245              :      */
     246              :     inline MESegment* getNextSegment() const {
     247    262141286 :         return myNextSegment;
     248              :     }
     249              : 
     250              :     /** @brief Returns the length of the segment in meters.
     251              :      *
     252              :      * @return the length of the segment
     253              :      */
     254              :     inline double getLength() const {
     255    124482028 :         return myLength;
     256              :     }
     257              : 
     258              :     /** @brief Returns the sum of the lengths of all usable lanes of the segment in meters.
     259              :      *
     260              :      * @return the capacity of the segment
     261              :      */
     262              :     inline double getCapacity() const {
     263      1562700 :         return myCapacity;
     264              :     }
     265              : 
     266              :     /** @brief Returns the occupany of the segment (the sum of the vehicle lengths + minGaps)
     267              :      *
     268              :      * @return the occupany of the segment in meters
     269              :      */
     270              :     inline double getBruttoOccupancy() const {
     271              :         double occ = 0.;
     272       364582 :         for (const Queue& q : myQueues) {
     273       183248 :             occ += q.getOccupancy();
     274              :         }
     275              :         return occ;
     276              :     }
     277              : 
     278              :     /** @brief Returns the relative occupany of the segment (percentage of road used))
     279              :      * @return the occupany of the segment in percent
     280              :      */
     281            0 :     inline double getRelativeOccupancy() const {
     282            0 :         return getBruttoOccupancy() / myCapacity;
     283              :     }
     284              : 
     285              :     /** @brief Returns the relative occupany of the segment (percentage of road used))
     286              :      * at which the segment is considered jammed
     287              :      * @return the jam threshold of the segment in percent
     288              :      */
     289              :     inline double getRelativeJamThreshold() const {
     290            0 :         return myJamThreshold / myCapacity;
     291              :     }
     292              : 
     293              :     /** @brief Returns the average speed of vehicles on the segment in meters per second.
     294              :      * If there is no vehicle on the segment it returns the maximum allowed speed
     295              :      * @param[in] useCache whether to use a cached value if available
     296              :      * @note this value is cached in myMeanSpeed. Since caching only takes place
     297              :      * once every simstep there is a potential for side-influences (i.e. GUI calls to
     298              :      * this method, ...) For that reason the simulation logic doesn't use the cache.
     299              :      * This shouldn't matter much for speed since it is only used during
     300              :      * initializsation of vehicles onto the segment.
     301              :      * @return the average speed on the segment
     302              :      */
     303              :     double getMeanSpeed(bool useCache) const;
     304              : 
     305              :     /// @brief reset myLastMeanSpeedUpdate
     306              :     void resetCachedSpeeds();
     307              : 
     308              :     /// @brief wrapper to satisfy the FunctionBinding signature
     309            0 :     inline double getMeanSpeed() const {
     310     25463029 :         return getMeanSpeed(true);
     311              :     }
     312              : 
     313              : 
     314              :     void writeVehicles(OutputDevice& of) const;
     315              : 
     316              :     /** @brief Removes the given car from the edge's que
     317              :      *
     318              :      * @param[in] v The vehicle to remove
     319              :      * @param[in] leaveTime The time at which the vehicle is leaving the que
     320              :      * @param[in] reason The reason for removing to send to reminders
     321              :      * @return The next first vehicle to add to the net's que
     322              :      */
     323              :     MEVehicle* removeCar(MEVehicle* v, SUMOTime leaveTime, const MSMoveReminder::Notification reason);
     324              : 
     325              :     /** @brief Returns the link the given car will use when passing the next junction
     326              :      *
     327              :      * This returns non-zero values only for the last segment and only
     328              :      *  if junction control is enabled.
     329              :      *
     330              :      * @param[in] veh The vehicle in question
     331              :      * @param[in] tlsPenalty Whether the link should be returned for computing tlsPenalty
     332              :      * @return The link to use or 0 without junction control
     333              :      */
     334              :     MSLink* getLink(const MEVehicle* veh, bool tlsPenalty = false) const;
     335              : 
     336              :     /** @brief Returns whether the vehicle may use the next link
     337              :      *
     338              :      * In case of disabled junction control it returns always true.
     339              :      *
     340              :      * @param[in] veh The vehicle in question
     341              :      * @return Whether it may pass to the next segment
     342              :      */
     343              :     bool isOpen(const MEVehicle* veh) const;
     344              : 
     345              :     /** @brief Removes the vehicle from the segment, adapting its parameters
     346              :      *
     347              :      * @param[in] veh The vehicle in question
     348              :      * @param[in] next The subsequent segment for delay calculation
     349              :      * @param[in] time the leave time
     350              :      * @todo Isn't always time == veh->getEventTime?
     351              :      */
     352              :     virtual void send(MEVehicle* veh, MESegment* const next, const int nextQIdx, SUMOTime time, const MSMoveReminder::Notification reason);
     353              : 
     354              :     /** @brief Adds the vehicle to the segment, adapting its parameters
     355              :      *
     356              :      * @param[in] veh The vehicle in question
     357              :      * @param[in] time the leave time
     358              :      * @param[in] isDepart whether the vehicle just departed
     359              :      * @todo Isn't always time == veh->getEventTime?
     360              :      */
     361              :     void receive(MEVehicle* veh, const int qIdx, SUMOTime time, const bool isDepart = false, const bool isTeleport = false, const bool newEdge = false);
     362              : 
     363              : 
     364              :     /** @brief tries to remove any car from this segment
     365              :      *
     366              :      * @param[in] currentTime the current time
     367              :      * @return Whether vaporization was successful
     368              :      * @note: cars removed via this method do NOT count as arrivals */
     369              :     bool vaporizeAnyCar(SUMOTime currentTime, const MSDetectorFileOutput* filter);
     370              : 
     371              :     /** @brief Returns the edge this segment belongs to
     372              :      * @return the edge this segment belongs to
     373              :      */
     374              :     inline const MSEdge& getEdge() const {
     375     91869704 :         return myEdge;
     376              :     }
     377              : 
     378              : 
     379              :     /** @brief reset mySpeed and patch the speed of
     380              :      * all vehicles in it. Also set/recompute myJamThreshold
     381              :      * @param[in] jamThresh follows the semantic of option meso-jam-threshold
     382              :      */
     383              :     void setSpeed(double newSpeed, SUMOTime currentTime, double jamThresh = DO_NOT_PATCH_JAM_THRESHOLD, int qIdx = -1);
     384              : 
     385              :     /** @brief Returns the (planned) time at which the next vehicle leaves this segment
     386              :      * @return The time the vehicle thinks it leaves
     387              :      */
     388              :     SUMOTime getEventTime() const;
     389              : 
     390              :     /// @brief Like getEventTime but returns seconds (for visualization)
     391            0 :     inline double getEventTimeSeconds() const {
     392            0 :         return STEPS2TIME(getEventTime());
     393              :     }
     394              : 
     395              :     /// @brief get the last headway time in seconds
     396            0 :     inline double getLastHeadwaySeconds() const {
     397            0 :         return STEPS2TIME(myLastHeadway);
     398              :     }
     399              : 
     400              :     /// @brief get the earliest entry time in seconds
     401            0 :     inline double getEntryBlockTimeSeconds() const {
     402              :         SUMOTime t = SUMOTime_MAX;
     403            0 :         for (const Queue& q : myQueues) {
     404              :             t = MIN2(t, q.getEntryBlockTime());
     405              :         }
     406            0 :         return STEPS2TIME(t);
     407              :     }
     408              : 
     409              :     /// @brief Get the waiting time for vehicles in all queues
     410              :     double getWaitingSeconds() const;
     411              : 
     412              :     /// @name State saving/loading
     413              :     /// @{
     414              : 
     415              :     /** @brief Saves the state of this segment into the given stream
     416              :      *
     417              :      * Some internal values which must be restored are saved as well as ids of
     418              :      *  the vehicles stored in internal queues and the last departures of connected
     419              :      *  edges.
     420              :      *
     421              :      * @param[in, filled] out The (possibly binary) device to write the state into
     422              :      * @todo What about throwing an IOError?
     423              :      */
     424              :     void saveState(OutputDevice& out) const;
     425              : 
     426              :     /** @brief Remove all vehicles before quick-loading state */
     427              :     void clearState();
     428              : 
     429              :     /** @brief Loads the state of this segment with the given parameters
     430              :      *
     431              :      * This method is called for every internal que the segment has.
     432              :      *  Every vehicle is retrieved from the given MSVehicleControl and added to this
     433              :      *  segment. Then, the internal queues that store vehicles dependant to their next
     434              :      *  edge are filled the same way. Then, the departure of last vehicles onto the next
     435              :      *  edge are restored.
     436              :      *
     437              :      * @param[in] vehs The vehicles for the current que
     438              :      * @param[in] blockTime The time the last vehicle left the que
     439              :      * @param[in] queIdx The index of the current que
     440              :      * @todo What about throwing an IOError?
     441              :      * @todo What about throwing an error if something else fails (a vehicle can not be referenced)?
     442              :      */
     443              :     void loadState(const std::vector<SUMOVehicle*>& vehs, const SUMOTime blockTime, const SUMOTime entryBlockTime, const int queIdx);
     444              :     /// @}
     445              : 
     446              : 
     447              :     /** @brief returns all vehicles (for debugging)
     448              :      */
     449              :     std::vector<const MEVehicle*> getVehicles() const;
     450              : 
     451              :     /** @brief returns flow based on headway
     452              :      * @note: returns magic number 10000 when headway cannot be computed
     453              :      */
     454              :     double getFlow() const;
     455              : 
     456              :     /// @brief whether the given segment is 0 or encodes vaporization
     457              :     static inline bool isInvalid(const MESegment* segment) {
     458     65244682 :         return segment == nullptr || segment == &myVaporizationTarget;
     459              :     }
     460              : 
     461              :     /// @brief return a time after earliestEntry at which a vehicle may be inserted at full speed
     462              :     SUMOTime getNextInsertionTime(SUMOTime earliestEntry) const;
     463              : 
     464              :     /// @brief return the remaining physical space on this segment
     465              :     inline int remainingVehicleCapacity(const double vehLength) const {
     466              :         int cap = 0;
     467       153230 :         for (const Queue& q : myQueues) {
     468        77080 :             if (q.getOccupancy() == 0. && myQueueCapacity < vehLength) {
     469              :                 // even small segments can hold at least one vehicle
     470            0 :                 cap += 1;
     471              :             } else {
     472        77080 :                 cap += (int)((myQueueCapacity - q.getOccupancy()) / vehLength);
     473              :             }
     474              :         }
     475              :         return cap;
     476              :     }
     477              : 
     478              :     /// @brief return the minimum headway-time with which vehicles may enter or leave this segment
     479              :     inline SUMOTime getMinimumHeadwayTime() const {
     480        76150 :         return myTau_ff;
     481              :     }
     482              : 
     483              :     /// @brief add this lanes MoveReminders to the given vehicle
     484              :     void addReminders(MEVehicle* veh) const;
     485              : 
     486              :     /** @brief Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0)
     487              :      * @param[in] veh The vehicle in question
     488              :      * @return The time penalty
     489              :      */
     490              :     SUMOTime getLinkPenalty(const MEVehicle* veh) const;
     491              : 
     492              :     /// @brief called when permissions change due to Rerouter or TraCI
     493              :     void updatePermissions();
     494              : 
     495              :     /// @brief whether the traffic light should use normal junction control despite penalty options
     496              :     void overrideTLSPenalty() {
     497          132 :         myTLSPenalty = false;
     498          132 :     }
     499              : 
     500              :     /// @brief convert net time gap (leader back to follower front) to gross time gap (leader front to follower front)
     501              :     inline SUMOTime getMinTauWithVehLength(double lengthWithGap, double vehicleTau) const {
     502      1720841 :         return (SUMOTime)((double)myTau_ff * vehicleTau + lengthWithGap * myTau_length);
     503              :     }
     504              : 
     505              :     /// @brief like getMinTauWithVehLength but using the jam-state dependent net time gap of the given queue (as in getMeanSpeed)
     506              :     inline SUMOTime getTauWithVehLength(int qIdx, double lengthWithGap, double vehicleTau) const {
     507              :         assert(qIdx >= 0 && qIdx < (int)myQueues.size());
     508         5746 :         const SUMOTime tau = myQueues[qIdx].getOccupancy() < myJamThreshold ? myTau_ff : myTau_jf;
     509              :         return tauWithVehLength(tau, lengthWithGap, vehicleTau);
     510              :     }
     511              : 
     512              : protected:
     513              :     bool overtake();
     514              : 
     515              :     void setSpeedForQueue(double newSpeed, SUMOTime currentTime,
     516              :                           SUMOTime blockTime, const std::vector<MEVehicle*>& vehs);
     517              : 
     518              :     /** @brief compute the new arrival time when switching speed
     519              :      */
     520              :     SUMOTime newArrival(const MEVehicle* const v, double newSpeed, SUMOTime currentTime);
     521              : 
     522              :     /// @brief whether a leader in any queue is blocked
     523              :     bool hasBlockedLeader() const;
     524              : 
     525              :     /** @brief compute a value for myJamThreshold
     526              :      * if jamThresh is negative, compute a value which allows free flow at mySpeed
     527              :      * interpret jamThresh as the relative occupation at which jam starts
     528              :      */
     529              :     void recomputeJamThreshold(double jamThresh);
     530              : 
     531              :     /// @brief compute jam threshold for the given speed and jam-threshold option
     532              :     double jamThresholdForSpeed(double speed, double jamThresh) const;
     533              : 
     534              :     /// @brief whether the given link may be passed because the option meso-junction-control.limited is set
     535              :     bool limitedControlOverride(const MSLink* link) const;
     536              : 
     537              :     /// @brief convert net time gap (leader back to follower front) to gross time gap (leader front to follower front)
     538              :     inline SUMOTime tauWithVehLength(SUMOTime tau, double lengthWithGap, double vehicleTau) const {
     539    231128097 :         return (SUMOTime)((double)tau * vehicleTau + lengthWithGap * myTau_length);
     540              :     }
     541              : 
     542              :     SUMOTime getTauJJ(double nextQueueSize, double nextQueueCapacity, double nextJamThreshold) const;
     543              : 
     544              :     /// @brief compute current headway depending on traffic state
     545              :     virtual SUMOTime computeHeadway(Queue& q, const Queue& qNext, const MESegment* const next, const MEVehicle* veh) const;
     546              : 
     547              :     /// @brief check jam-avoidance constraints during insertion
     548              :     virtual bool hasSpaceForInsertion(const Queue& q, int qIdx, double newOccupancy, SUMOTime entryTime) const;
     549              : 
     550              : protected:
     551              :     /// @brief The microsim edge this segment belongs to
     552              :     const MSEdge& myEdge;
     553              : 
     554              :     /// @brief The next segment of this edge, 0 if this is the last segment of this edge
     555              :     MESegment* myNextSegment;
     556              : 
     557              :     /// @brief The segment's length
     558              :     const double myLength;
     559              : 
     560              :     /// @brief Running number of the segment in the edge
     561              :     const int myIndex;
     562              : 
     563              :     /// @name Model constants that may be reset once via additional file
     564              :     /// @{
     565              : 
     566              :     /// @brief The time headway parameters, see the Eissfeldt thesis
     567              :     SUMOTime myTau_ff, myTau_fj, myTau_jf, myTau_jj;
     568              : 
     569              :     /// @brief Whether tls penalty is enabled
     570              :     bool myTLSPenalty;
     571              : 
     572              :     /// @brief penalty for minor links
     573              :     bool myCheckMinorPenalty; // for legacy compatibility (#7802, 7804)
     574              :     SUMOTime myMinorPenalty;
     575              : 
     576              :     /// @brief Whether junction control is enabled
     577              :     bool myJunctionControl;
     578              : 
     579              :     /// @brief Whether overtaking is permitted on this segment
     580              :     bool myOvertaking;
     581              :     /// @}
     582              : 
     583              :     /// @brief Headway parameter for computing gross time headyway from net time headway, length and edge speed
     584              :     double myTau_length;
     585              : 
     586              :     /// @brief The number of lanes represented by the queue * the length of the lane
     587              :     double myCapacity = 0.;
     588              : 
     589              :     /// @brief The number of lanes represented by the queue * the length of the lane
     590              :     double myQueueCapacity = 0.;
     591              : 
     592              :     /// @brief The space (in m) which needs to be occupied before the segment is considered jammed
     593              :     double myJamThreshold;
     594              : 
     595              :     /// @brief The car queues. Vehicles are inserted in the front and removed in the back
     596              :     std::vector<Queue> myQueues;
     597              : 
     598              :     /// @brief The cached value for the number of vehicles
     599              :     int myNumVehicles;
     600              : 
     601              :     /// @brief The follower edge to allowed que index mapping for multi queue segments
     602              :     std::map<const MSEdge*, int> myFollowerMap;
     603              : 
     604              :     /// @brief the last headway
     605              :     SUMOTime myLastHeadway;
     606              : 
     607              :     /* @brief segment for signifying vaporization. This segment has invalid
     608              :      * data and should only be used as a unique pointer */
     609              :     static MSEdge myDummyParent;
     610              :     static MESegment myVaporizationTarget;
     611              : 
     612              :     /// @brief the mean speed on this segment. Updated at event time or on demand
     613              :     mutable double myMeanSpeed;
     614              : 
     615              :     /// @brief the time at which myMeanSpeed was last updated
     616              :     mutable SUMOTime myLastMeanSpeedUpdate;
     617              : 
     618              : private:
     619              :     /// @brief Invalidated copy constructor.
     620              :     MESegment(const MESegment&);
     621              : 
     622              :     /// @brief Invalidated assignment operator.
     623              :     MESegment& operator=(const MESegment&);
     624              : 
     625              :     /// @brief constructor for dummy segment
     626              :     MESegment(const std::string& id);
     627              : };
        

Generated by: LCOV version 2.0-1