Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MELSegment.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-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/****************************************************************************/
18// A LTM (LIFT)-model segment
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <deque>
24#include "MESegment.h"
25
26
27// ===========================================================================
28// class declarations
29// ===========================================================================
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
38class MELSegment : public MESegment {
39public:
40
41
42public:
53 MELSegment(const std::string& id,
54 const MSEdge& parent, MESegment* next,
55 const double length, const double speed,
56 const int idx,
57 const bool multiQueue,
58 const MesoEdgeType& edgeType);
59
67 void send(MEVehicle* veh, MESegment* const next, const int nextQIdx, SUMOTime time, const MSMoveReminder::Notification reason) override;
68
70 void updateEntryBlockTime(SUMOTime time) override;
71
73 std::string getQueueExtraState(int qIdx) const override;
74 void loadQueueExtraState(int qIdx, const std::string& state, SUMOTime offset) override;
75
76protected:
78 SUMOTime computeHeadway(Queue& q, const Queue& qNext, const MESegment* const next, const MEVehicle* veh) const override;
79
81 bool hasSpaceForInsertion(const Queue& q, int qIdx, double newOccupancy, SUMOTime entryTime) const override;
82
84 bool hasTravelingGaps(int qIdx, SUMOTime time) const override;
85
86private:
88 int numTravelingGaps(int qIdx, SUMOTime time) const;
89
91 const double myJamLength;
92
94 // @note: could be slightly faster as a double-index ring-buffer
95 typedef std::vector<SUMOTime> GapTimes;
96 std::vector<GapTimes> myGapTimes;
97
99 std::vector<SUMOTime> myJamGapTimes;
100
101private:
104
107
109 MELSegment(const std::string& id);
110};
long long int SUMOTime
Definition GUI.h:36
A single mesoscopic segment (cell)
Definition MELSegment.h:38
void loadQueueExtraState(int qIdx, const std::string &state, SUMOTime offset) override
void send(MEVehicle *veh, MESegment *const next, const int nextQIdx, SUMOTime time, const MSMoveReminder::Notification reason) override
Removes the vehicle from the segment, adapting its parameters.
MELSegment(const std::string &id)
constructor for dummy segment
void updateEntryBlockTime(SUMOTime time) override
update entry blockTime for all queues
bool hasSpaceForInsertion(const Queue &q, int qIdx, double newOccupancy, SUMOTime entryTime) const override
check jam-avoidance constraints during insertion
std::vector< GapTimes > myGapTimes
Definition MELSegment.h:96
bool hasTravelingGaps(int qIdx, SUMOTime time) const override
whether space vacated by vehicles that left the given queue has not yet reached the upstream end
int numTravelingGaps(int qIdx, SUMOTime time) const
discard gaps that reached the upstream end until the given time and return the number of remaining ga...
std::vector< SUMOTime > myJamGapTimes
upstream arrival time of the latest gap left by a queued vehicle (for each queue, -1 if there is none...
Definition MELSegment.h:99
MELSegment(const MELSegment &)
Invalidated copy constructor.
MELSegment & operator=(const MELSegment &)
Invalidated assignment operator.
std::vector< SUMOTime > GapTimes
upstream arrival times of traveling gaps between cars (for each queue)
Definition MELSegment.h:95
const double myJamLength
the length of a segment filled with jammed (default) vehicles
Definition MELSegment.h:91
std::string getQueueExtraState(int qIdx) const override
the gap times of the given queue for saving / loading
SUMOTime computeHeadway(Queue &q, const Queue &qNext, const MESegment *const next, const MEVehicle *veh) const override
compute current headway depending on traffic state
A single mesoscopic segment (cell)
Definition MESegment.h:50
A vehicle from the mesoscopic point of view.
Definition MEVehicle.h:42
A road/street connecting two junctions.
Definition MSEdge.h:78
Notification
Definition of a vehicle state.
edge type specific meso parameters
Definition MESegment.h:58