50#define DEFAULT_VEH_LENGTH_WITH_GAP (SUMOVTypeParameter::getDefault().length + SUMOVTypeParameter::getDefault().minGap)
56#define DEBUG_COND (myEdge.isSelected())
57#define DEBUG_COND2(obj) ((obj != 0 && (obj)->isSelected()))
70 const double length,
const double speed,
72 const bool multiQueue,
74 MESegment(id, parent, next, length, speed, idx, multiQueue, edgeType),
111 gapTimes.insert(gapTimes.begin(), time +
MAX2((
SUMOTime)0, waveTime - remainderTime));
122 for (
int qIdx = 0; qIdx < (int)
myQueues.size(); qIdx++) {
130 SUMOTime unblockTime = gapTimes.back();
139 auto it = gapTimes.rbegin();
140 while (it != gapTimes.rend() && *it <= time +
myTau_ff) {
144 if (it == gapTimes.rend()) {
172 while (!gapTimes.empty() && gapTimes.back() <= time) {
175 return (
int)gapTimes.size();
183 if (!gapTimes.empty() &&
myJamGapTimes[qIdx] >= gapTimes.back()) {
#define DEFAULT_VEH_LENGTH_WITH_GAP
constexpr SUMOTime TIME2STEPS(double x)
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
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
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...
MELSegment(const std::string &id, const MSEdge &parent, MESegment *next, const double length, const double speed, const int idx, const bool multiQueue, const MesoEdgeType &edgeType)
constructor
std::vector< SUMOTime > myJamGapTimes
upstream arrival time of the latest gap left by a queued vehicle (for each queue, -1 if there is none...
std::vector< SUMOTime > GapTimes
upstream arrival times of traveling gaps between cars (for each queue)
const double myJamLength
the length of a segment filled with jammed (default) vehicles
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
void setEntryBlockTime(SUMOTime entryBlockTime)
set the next time at which a vehicle may enter this queue
double getOccupancy() const
SUMOTime getEntryBlockTime() const
return the next time at which a vehicle may enter this queue
A single mesoscopic segment (cell)
double myQueueCapacity
The number of lanes represented by the queue * the length of the lane.
SUMOTime tauWithVehLength(SUMOTime tau, double lengthWithGap, double vehicleTau) const
convert net time gap (leader back to follower front) to gross time gap (leader front to follower fron...
SUMOTime myTau_ff
The time headway parameters, see the Eissfeldt thesis.
std::vector< Queue > myQueues
The car queues. Vehicles are inserted in the front and removed in the back.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
virtual void send(MEVehicle *veh, MESegment *const next, const int nextQIdx, SUMOTime time, const MSMoveReminder::Notification reason)
Removes the vehicle from the segment, adapting its parameters.
const double myLength
The segment's length.
const MSEdge & myEdge
The microsim edge this segment belongs to.
bool myTLSPenalty
Whether tls penalty is enabled.
A vehicle from the mesoscopic point of view.
SUMOTime getWaitingTime(const bool accumulated=false) const
Returns the duration for which the vehicle was blocked.
SUMOTime getQueuingTimeLoss() const
Returns the time lost compare to free flow.
int getQueIndex() const
Returns the index of the que the vehicle is in.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
A road/street connecting two junctions.
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is returned; should pr...
bool isTLSControlled() const
double getGreenFraction() const
Returns the average proportion of green time to cycle time.
Notification
Definition of a vehicle state.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
std::vector< std::string > getVector()
return vector of strings
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter,...
edge type specific meso parameters