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
83private:
85 // @note: could be slightly faster as a double-index ring-buffer
86 typedef std::vector<SUMOTime> GapTimes;
87 std::vector<GapTimes> myGapTimes;
88
89private:
92
95
97 MELSegment(const std::string& id);
98};
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:87
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:86
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