95 struct VehPosition :
public std::binary_function < const MSVehicle*, SUMOReal, bool > {
108 bool downstream =
true) :
126 return !(*
this == other);
208 void addNeigh(
const std::string&
id);
275 bool recheckNextLanes,
615 return (
int)
myDict.size();
622 static void insertIDs(std::vector<std::string>& into);
629 template<
class RTREE>
630 static void fill(RTREE& into);
642 const MSLane& succLinkSource,
643 const std::vector<MSLane*>& conts);
648 bool isLinkEnd(MSLinkCont::const_iterator& i)
const;
741 std::pair<MSVehicle* const, SUMOReal>
getLeader(
const MSVehicle* veh,
const SUMOReal vehPos,
const std::vector<MSLane*>& bestLaneConts,
SUMOReal dist = -1,
bool checkTmpVehicles =
false)
const;
766 SUMOReal speed,
const MSVehicle& veh,
const std::vector<MSLane*>& bestLaneConts)
const;
996 const MSLane::VehCont::iterator& at,
1002 std::set<const MSVehicle*, SUMOVehicle::ComparatorIdLess>& toRemove,
1003 std::set<const MSVehicle*>& toTeleport)
const;
1008 std::set<const MSVehicle*, SUMOVehicle::ComparatorIdLess>& toRemove,
1009 std::set<const MSVehicle*>& toTeleport)
const;
int getRightmostSublane() const
int getNumericalID() const
Returns this lane's numerical id.
const std::map< SUMOVehicleClass, SUMOReal > * myRestrictions
The vClass speed restrictions for this lane.
void loadState(std::vector< std::string > &vehIDs, MSVehicleControl &vc)
Loads the state of this segment with the given parameters.
SVCPermissions myPermissions
The vClass permissions for this lane.
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
saves leader/follower vehicles and their distances relative to an ego vehicle
MSEdge & getEdge() const
Returns the lane's edge.
int getPartialVehicleNumber() const
Returns the number of vehicles partially on this lane (for which this lane is not responsible) ...
Representation of a vehicle in the micro simulation.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
void resetPermissions(long transientID)
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
SUMOReal getWaitingSeconds() const
Returns the overall waiting time on this lane.
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
static bool teleportOnCollision()
static const long CHANGE_PERMISSIONS_GUI
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
int myI2
index for myPartialVehicles
std::pair< MSVehicle *const, SUMOReal > getOppositeFollower(const MSVehicle *ego) const
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
static void fill(RTREE &into)
Fills the given RTree with lane instances.
SUMOReal getLength() const
Returns the lane's length.
std::vector< IncomingLaneInfo > myIncomingLanes
int myI2End
end index for myPartialVehicles
void setLength(SUMOReal val)
Sets a new length for the lane (used by TraCI only)
void addLink(MSLink *link)
Delayed initialization.
int myIndex
The lane index.
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
SUMOTime myLeaderInfoTime
time step for which myLeaderInfo was last updated
MSVehicle * getFirstFullVehicle() const
returns the first vehicle for which this lane is responsible or 0
Notification
Definition of a vehicle state.
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
bool operator==(AnyVehicleIterator const &other) const
const MSEdge *const myEdge
SUMOReal getWidth() const
Returns the lane's width.
SUMOReal getMaximumBrakeDist() const
compute maximum braking distance on this lane
void addIncomingLane(MSLane *lane, MSLink *viaLink)
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
by_connections_to_sorter(const MSEdge *const e)
constructor
static void initCollisionOptions(const OptionsCont &oc)
Realises dumping the complete network state.
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
SUMOReal getCenterOnEdge() const
void leftByLaneChange(MSVehicle *v)
void getLeadersOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle *ego, const std::vector< MSLane * > &bestLaneConts, MSLeaderDistanceInfo &result) const
Returns the immediate leaders and the distance to them (as getLeaderOnConsecutive but for the sublane...
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
std::map< long, SVCPermissions > myPermissionChanges
virtual SUMOReal getMaxSpeed() const =0
Returns the vehicle's maximum speed.
void addNeigh(const std::string &id)
Adds a neighbor to this lane.
bool operator()(const IncomingLaneInfo &ili) const
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
std::pair< MSVehicle *const, SUMOReal > getCriticalLeader(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh) const
Returns the most dangerous leader and the distance to him.
const SUMOReal myWidth
Lane width [m].
by_connections_to_sorter & operator=(const by_connections_to_sorter &)
bool freeInsertion(MSVehicle &veh, SUMOReal speed, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Tries to insert the given vehicle on any place.
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
static bool myCheckJunctionCollisions
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
SUMOReal myMaxSpeed
Lane-wide speedlimit [m/s].
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
int myI1End
end index for myVehicles
int myDirection
index delta
PositionVector myShape
The shape of the lane.
MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle *ego, bool allSublanes) const
return the sublane followers with the largest missing rear gap among all predecessor lanes (within di...
bool myDownstream
iteration direction
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Performs lane changing of vehicles.
std::vector< std::string > myNeighs
void setMaxSpeed(SUMOReal val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
static CollisionAction myCollisionAction
the action to take on collisions
std::map< std::string, MSLane * > DictType
definition of the static dictionary type
bool lastInsertion(MSVehicle &veh, SUMOReal mspeed)
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
static DictType myDict
Static dictionary to associate string-ids with objects.
virtual SUMOReal getChosenSpeedFactor() const =0
void addApproachingLane(MSLane *lane, bool warnMultiCon)
Performs lane changing of vehicles.
A road/street connecting two junctions.
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle's access class.
SUMOReal myRightSideOnEdge
the combined width of all lanes with lower index on myEdge
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
Allows to store the object; used as context while traveling the rtree in TraCI.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
std::pair< MSVehicle *const, SUMOReal > getLeaderOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh, const std::vector< MSLane * > &bestLaneConts) const
Returns the immediate leader and the distance to him.
const MSVehicle * operator*()
static int dictSize()
Returns the number of stored lanes.
Export the queueing length in front of a junction (very experimental!)
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane
SUMOReal getMissingRearGap(SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel) const
return by how much further the leader must be inserted to avoid rear end collisions ...
SUMOReal basePos(const MSVehicle &veh) const
departure position where the vehicle fits fully onto the lane (if possible)
const MSEdge *const myEdge
Representation of a vehicle.
void add(const MSLane *const l) const
Adds the given object to the container.
friend class AnyVehicleIterator
SUMOReal getDepartSpeed(const MSVehicle &veh, bool &patchSpeed)
Sorts vehicles by their position (descending)
A point in 2D or 3D with translation and scaling methods.
SVCPermissions myOriginalPermissions
The original vClass permissions for this lane (before temporary modifications)
void enteredByLaneChange(MSVehicle *v)
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, SUMOReal latOffset, SUMOReal minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
edge_finder & operator=(const edge_finder &)
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
MSLane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, int index)
Constructor.
int myRightmostSublane
the index of the rightmost sublane of this lane on myEdge
MSLane * myLogicalPredecessorLane
Something on a lane to be noticed about vehicle movement.
SUMOReal myLength
Lane length [m].
bool empty() const
Returns true if there is not a single vehicle on the lane.
bool operator!=(AnyVehicleIterator const &other) const
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
virtual SUMOReal setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
SUMOReal getLengthGeometryFactor() const
return shape.length() / myLength
int getIndex() const
Returns the lane's index.
An upper class for objects with additional parameters.
void handleCollisionBetween(SUMOTime timestep, const std::string &stage, const MSVehicle *collider, const MSVehicle *victim, SUMOReal gap, SUMOReal latGap, std::set< const MSVehicle *, SUMOVehicle::ComparatorIdLess > &toRemove, std::set< const MSVehicle * > &toTeleport) const
take action upon collision
void setRightSideOnEdge(SUMOReal value, int rightmostSublane)
std::map< MSEdge *, std::vector< MSLane * > > myApproachingLanes
std::vector< MSVehicle * > VehCont
Container for vehicles.
Base class for objects which have an id.
int myNumericalID
Unique numerical ID (set on reading by netload)
std::vector< MSMoveReminder * > myMoveReminders
This lane's move reminder.
SUMOReal safeInsertionSpeed(const MSVehicle *veh, const MSLeaderInfo &leaders, SUMOReal speed)
return the maximum safe speed for insertion behind leaders (a negative value indicates that safe inse...
const SUMOReal myLengthGeometryFactor
precomputed myShape.length / myLength
AnyVehicleIterator & operator++()
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat=0)
Inserts the given vehicle at the given position.
void sortPartialVehicles()
sorts myPartialVehicles
void setPermissions(SVCPermissions permissions, long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
SUMOReal getPMxEmissions() const
Returns the sum of last step PMx emissions.
The vehicle has departed (was inserted into the network)
int myI1
index for myVehicles
bool detectCollisionBetween(SUMOTime timestep, const std::string &stage, const MSVehicle *collider, const MSVehicle *victim, std::set< const MSVehicle *, SUMOVehicle::ComparatorIdLess > &toRemove, std::set< const MSVehicle * > &toTeleport) const
detect whether there is a collision between the two vehicles
bool operator()(const MSVehicle *cmp, SUMOReal pos) const
compares vehicle position to the detector position
std::pair< MSVehicle *const, SUMOReal > getOppositeLeader(const MSVehicle *ego, SUMOReal dist) const
SUMOReal myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
static void clear()
Clears the dictionary.
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
MSEdge *const myEdge
The lane's edge, for routing only.
const MSVehicle * operator->()
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
const MSLane * myLane
the lane that is being iterated
bool checkFailure(MSVehicle *aVehicle, SUMOReal &speed, SUMOReal &dist, const SUMOReal nspeed, const bool patchSpeed, const std::string errorMsg) const
MSVehicle * getPartialBehind(const MSVehicle *ego) const
A storage for options typed value containers)
bool isApproachedFrom(MSEdge *const edge)
const MSLeaderInfo & getFirstVehicleInformation(const MSVehicle *ego, SUMOReal latOffset, bool onlyFrontOnLane, SUMOReal maxPos=std::numeric_limits< SUMOReal >::max(), bool allowCached=true) const
analogue to getLastVehicleInformation but in the upstream direction
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction ...
MSLane & operator=(const MSLane &)
invalidated assignment operator
void saveState(OutputDevice &out)
Saves the state of this lane into the given stream.
MSLeaderInfo myLeaderInfo
leaders on all sublanes as seen by approaching vehicles (cached)
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal getOppositePos(SUMOReal pos) const
return the corresponding position on the opposite lane
void visit(const TraCIServerAPI_Lane::StoringVisitor &cont) const
Callback for visiting the lane when traversing an RTree.
Static storage of an output device and its base (abstract) implementation.
bool nextIsMyVehicles() const
MSLeaderInfo myFollowerInfo
followers on all sublanes as seen by vehicles on consecutive lanes (cached)
virtual ~MSLane()
Destructor.
SUMOReal myNettoVehicleLengthSum
The current length of all vehicles on this lane, excluding their minGaps.
bool isInsertionSuccess(MSVehicle *vehicle, SUMOReal speed, SUMOReal pos, SUMOReal posLat, bool recheckNextLanes, MSMoveReminder::Notification notification)
Tries to insert the given vehicle with the given state (speed and pos)
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
The class responsible for building and deletion of vehicles.
std::pair< MSVehicle *const, SUMOReal > getFollower(const MSVehicle *ego, SUMOReal egoPos, SUMOReal dist) const
Find follower vehicle for the given ego vehicle (which may be on the opposite direction lane) ...
MSLeaderInfo myLeaderInfoTmp
VehCont myVehBuffer
Buffer for vehicles that moved from their previous lane onto this one. Integrated after all vehicles ...
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
static const long CHANGE_PERMISSIONS_PERMANENT
AnyVehicleIterator(const MSLane *lane, int i1, int i2, const int i1End, const int i2End, bool downstream=true)
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
SUMOReal interpolateGeometryPosToLanePos(SUMOReal geometryPos) const
SUMOReal getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
virtual bool executeMovements(SUMOTime t, std::vector< MSLane * > &lanesWithVehiclesToIntegrate)
Executes planned vehicle movements with regards to right-of-way.
SUMOTime myFollowerInfoTime
time step for which myFollowerInfo was last updated
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction ...
Representation of a lane in the micro simulation.
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction ...
int getCrossingIndex() const
return the index of the link to the next crossing if this is walkingArea, else -1 ...
std::pair< MSVehicle *const, SUMOReal > getFollowerOnConsecutive(SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel, SUMOReal dist=-1) const
return the follower with the largest missing rear gap among all predecessor lanes (within dist) ...
std::pair< MSVehicle *const, SUMOReal > getLeader(const MSVehicle *veh, const SUMOReal vehPos, const std::vector< MSLane * > &bestLaneConts, SUMOReal dist=-1, bool checkTmpVehicles=false) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
virtual bool appropriate(const MSVehicle *veh)
virtual void planMovements(const SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
SUMOReal getRightSideOnEdge() const
vehicle_position_sorter(const MSLane *lane)
Constructor.
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction ...
vehicle_natural_position_sorter(const MSLane *lane)
Constructor.