83 bool multiQueue,
bool junctionControl,
87 typedef std::vector<MEVehicle*>
Queue;
399 SUMOTime blockTime,
const std::vector<MEVehicle*>& vehs);
size_t numQueues() const
return the number of queues
static MESegment myVaporizationTarget
const unsigned int myIndex
Running number of the segment in the edge.
SUMOReal getFlow() const
returns flow based on headway
std::vector< MEVehicle * > Queue
const SUMOReal myCapacity
The number of lanes * the length.
std::vector< const MEVehicle * > getVehicles() const
returns all vehicles (for debugging)
A vehicle from the mesoscopic point of view.
MESegment(const std::string &id, const MSEdge &parent, MESegment *next, SUMOReal length, SUMOReal speed, unsigned int idx, SUMOTime tauff, SUMOTime taufj, SUMOTime taujf, SUMOTime taujj, SUMOReal jamThresh, bool multiQueue, bool junctionControl, SUMOReal lengthGeometryFactor)
constructor
MEVehicle * removeCar(MEVehicle *v, SUMOTime leaveTime, MESegment *next)
Removes the given car from the edge's que.
bool initialise(MEVehicle *veh, SUMOTime time)
Inserts (emits) vehicle into the segment.
bool limitedControlOverride(const MSLink *link) const
whether the given link may be passed because the option meso-junction-control.limited is set ...
SUMOTime myEntryBlockTime
static const SUMOReal DO_NOT_PATCH_JAM_THRESHOLD
std::vector< MSMoveReminder * > myDetectorData
The data collection for all kinds of detectors.
SUMOReal myOccupancy
The occupied space (in m) on the segment.
SUMOReal getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
SUMOTime getEntryBlockTime() const
return the next time at which a vehicle my enter this segment
SUMOTime newArrival(const MEVehicle *const v, SUMOReal newSpeed, SUMOTime currentTime)
compute the new arrival time when switching speed
unsigned int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
void setSpeedForQueue(SUMOReal newSpeed, SUMOTime currentTime, SUMOTime blockTime, const std::vector< MEVehicle * > &vehs)
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Queues myCarQues
The car queues. Vehicles are inserted in the front and removed in the back.
void setEntryBlockTime(SUMOTime entryBlockTime)
set the next time at which a vehicle my enter this segment
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
A road/street connecting two junctions.
const Queue & getQueue(size_t index) const
Returns the cars in the queue with the given index for visualization.
const SUMOReal myHeadwayCapacity
The capacity of the segment in number of cars, used only in time headway calculation This parameter h...
void receive(MEVehicle *veh, SUMOTime time, bool isDepart=false, bool afterTeleport=false)
Adds the vehicle to the segment, adapting its parameters.
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
void writeVehicles(OutputDevice &of) const
MESegment & operator=(const MESegment &)
Invalidated assignment operator.
SUMOTime myLastMeanSpeedUpdate
the time at which myMeanSpeed was last updated
bool free() const
return whether this segment is considered free as opposed to jammed
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
void loadState(std::vector< std::string > &vehIDs, MSVehicleControl &vc, const SUMOTime blockTime, const unsigned int queIdx)
Loads the state of this segment with the given parameters.
SUMOReal getLength() const
Returns the length of the segment in meters.
static MSEdge myDummyParent
SUMOTime getMinimumHeadwayTime() const
return the minimum headway-time with which vehicles may enter or leave this segment ...
size_t getCarNumber() const
Returns the total number of cars on the segment.
void updateDetectorsOnLeave(MEVehicle *v, SUMOTime currentTime, MESegment *next)
Updates data of all detectors for a leaving vehicle.
SUMOTime getTimeHeadway(bool predecessorIsFree)
const SUMOReal myLength
The segment's length.
void addDetector(MSMoveReminder *data)
Adds a data collector for a detector to this segment.
Something on a lane to be noticed about vehicle movement.
bool vaporizeAnyCar(SUMOTime currentTime)
tries to remove any car from this segment
SUMOReal myJamThreshold
The space (in m) which needs to be occupied before the segment is considered jammed.
SUMOReal jamThresholdForSpeed(SUMOReal speed) const
compute jam threshold for the given speed
void removeDetector(MSMoveReminder *data)
Removes a data collector for a detector from this segment.
Base class for objects which have an id.
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
SUMOTime getTLSPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a tls-controlled link (if using gMesoTLSPenalty > 0) ...
const MSEdge & myEdge
The microsim edge this segment belongs to.
void setSpeed(SUMOReal newSpeed, SUMOTime currentTime, SUMOReal jamThresh=DO_NOT_PATCH_JAM_THRESHOLD)
reset mySpeed and patch the speed of all vehicles in it. Also set/recompute myJamThreshold ...
const bool myTLSPenalty
Whether tls penalty is enabled.
MESegment * myNextSegment
The next segment of this edge, 0 if this is the last segment of this edge.
SUMOReal getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
SUMOTime getEventTime() const
Returns the (planned) time at which the next vehicle leaves this segment.
A single mesoscopic segment (cell)
bool hasSpaceFor(const MEVehicle *veh, SUMOTime entryTime, bool init=false) const
Returns whether the given vehicle would still fit into the segment.
const bool myJunctionControl
Whether junction control is enabled.
unsigned int remainingVehicleCapacity(const SUMOReal vehLength) const
return the remaining physical space on this segment
const SUMOReal myLengthGeometryFactor
std::map< const MSEdge *, std::vector< size_t > > myFollowerMap
The follower edge to que index mapping for multi queue segments.
SUMOReal getBruttoOccupancy() const
Returns the occupany of the segment (the sum of the vehicle lengths + minGaps)
Static storage of an output device and its base (abstract) implementation.
void saveState(OutputDevice &out)
Saves the state of this segment into the given stream.
SUMOTime getNextInsertionTime(SUMOTime earliestEntry) const
return a time after earliestEntry at which a vehicle may be inserted at full speed ...
std::vector< SUMOTime > myBlockTimes
The block times.
The class responsible for building and deletion of vehicles.
void prepareDetectorForWriting(MSMoveReminder &data)
Updates data of a detector for all vehicle queues.
void send(MEVehicle *veh, MESegment *next, SUMOTime time)
Removes the vehicle from the segment, adapting its parameters.
SUMOReal myMeanSpeed
the mean speed on this segment. Updated at event time or on demand
const SUMOTime myTau_ff
The time headway parameters, see the Eissfeldt thesis.
std::vector< Queue > Queues
void addReminders(MEVehicle *veh) const
add this lanes MoveReminders to the given vehicle
SUMOReal getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
SUMOReal getLengthGeometryFactor() const
return precomputed geometrical length / myLength
SUMOReal getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
void recomputeJamThreshold(SUMOReal jamThresh)
compute a value for myJamThreshold if jamThresh is negative, compute a value which allows free flow a...