95 struct VehPosition :
public std::binary_function < const MSVehicle*, SUMOReal, bool > {
108 bool downstream =
true) :
114 myDownstream(downstream),
115 myDirection(downstream ? 1 : -1) {
119 return (myI1 == other.
myI1 120 && myI2 == other.
myI2 126 return !(*
this == other);
138 bool nextIsMyVehicles()
const;
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;
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
SUMOReal getOppositePos(SUMOReal pos) const
return the corresponding position on the opposite lane
SUMOReal getWidth() const
Returns the lane's width.
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.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
SUMOReal getLength() const
Returns the lane's length.
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
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.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
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
MSVehicle * getFirstFullVehicle() const
returns the first vehicle for which this lane is responsible or 0
void resetPermissions(long transientID)
SUMOReal getPMxEmissions() const
Returns the sum of last step PMx emissions.
bool checkFailure(MSVehicle *aVehicle, SUMOReal &speed, SUMOReal &dist, const SUMOReal nspeed, const bool patchSpeed, const std::string errorMsg) const
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
bool operator()(const MSVehicle *cmp, SUMOReal pos) const
compares vehicle position to the detector position
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
static void fill(RTREE &into)
Fills the given RTree with lane instances.
SUMOReal getCenterOnEdge() const
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
Notification
Definition of a vehicle state.
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
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
const MSEdge *const myEdge
void addIncomingLane(MSLane *lane, MSLink *viaLink)
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
const PositionVector & getShape() const
Returns this lane's shape.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
static void initCollisionOptions(const OptionsCont &oc)
Realises dumping the complete network state.
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...
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
void leftByLaneChange(MSVehicle *v)
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.
std::pair< MSVehicle *const, SUMOReal > getOppositeLeader(const MSVehicle *ego, SUMOReal dist) const
const std::vector< MSMoveReminder *> & getMoveReminders() const
Return the list of this lane's move reminders.
const SUMOReal myWidth
Lane width [m].
bool freeInsertion(MSVehicle &veh, SUMOReal speed, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Tries to insert the given vehicle on any place.
SUMOReal interpolateGeometryPosToLanePos(SUMOReal geometryPos) const
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
static bool myCheckJunctionCollisions
SUMOReal myMaxSpeed
Lane-wide speedlimit [m/s].
int myI1End
end index for myVehicles
int myDirection
index delta
PositionVector myShape
The shape of the lane.
bool myDownstream
iteration direction
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
Performs lane changing of vehicles.
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
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.
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
int getNumericalID() const
Returns this lane's numerical id.
std::map< std::string, MSLane *> DictType
definition of the static dictionary type
SUMOReal getMaximumBrakeDist() const
compute maximum braking distance on this lane
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.
int getPartialVehicleNumber() const
Returns the number of vehicles partially on this lane (for which this lane is not responsible) ...
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.
SUMOReal getLengthGeometryFactor() const
return shape.length() / myLength
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
int getIndex() const
Returns the lane's index.
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
Allows to store the object; used as context while traveling the rtree in TraCI.
static int dictSize()
Returns the number of stored lanes.
int getCrossingIndex() const
return the index of the link to the next crossing if this is walkingArea, else -1 ...
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.
const MSEdge *const myEdge
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
Representation of a vehicle.
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.
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
SVCPermissions myOriginalPermissions
The original vClass permissions for this lane (before temporary modifications)
void enteredByLaneChange(MSVehicle *v)
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.
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.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
SUMOReal basePos(const MSVehicle &veh) const
departure position where the vehicle fits fully onto the lane (if possible)
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
MSVehicle * getPartialBehind(const MSVehicle *ego) const
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction ...
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction ...
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) ...
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane
virtual bool executeMovements(SUMOTime t, std::vector< MSLane *> &lanesWithVehiclesToIntegrate)
Executes planned vehicle movements with regards to right-of-way.
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].
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction ...
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
An upper class for objects with additional parameters.
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
void setRightSideOnEdge(SUMOReal value, int rightmostSublane)
std::map< MSEdge *, std::vector< MSLane * > > myApproachingLanes
std::vector< MSVehicle * > VehCont
Container for vehicles.
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
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane *> &conts)
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.
MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle *ego, bool allSublanes) const
return the sublane followers with the largest missing rear gap among all predecessor lanes (within di...
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
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...
SUMOReal getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
SUMOReal getMissingRearGap(SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel) const
return by how much further the leader must be inserted to avoid rear end collisions ...
const SUMOReal myLengthGeometryFactor
precomputed myShape.length / myLength
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat=0)
Inserts the given vehicle at the given position.
int getRightmostSublane() const
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
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...
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
The vehicle has departed (was inserted into the network)
int myI1
index for myVehicles
bool operator()(const IncomingLaneInfo &ili) const
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
SUMOReal myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
static void clear()
Clears the dictionary.
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, SUMOReal latOffset, SUMOReal minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
void visit(const TraCIServerAPI_Lane::StoringVisitor &cont) const
Callback for visiting the lane when traversing an RTree.
MSEdge *const myEdge
The lane's edge, for routing only.
const MSVehicle * operator->()
Point2D< point_type > operator*(mul_type val, const Point2D< point_type > pt)
const MSLane * myLane
the lane that is being iterated
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
A storage for options typed value containers)
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
bool isApproachedFrom(MSEdge *const edge)
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction ...
bool allowsVehicleClass(SUMOVehicleClass vclass) const
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)
Static storage of an output device and its base (abstract) implementation.
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)
The class responsible for building and deletion of vehicles.
MSLeaderInfo myLeaderInfoTmp
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
VehCont myVehBuffer
Buffer for vehicles that moved from their previous lane onto this one. Integrated after all vehicles ...
static const long CHANGE_PERMISSIONS_PERMANENT
AnyVehicleIterator(const MSLane *lane, int i1, int i2, const int i1End, const int i2End, bool downstream=true)
bool empty() const
Returns true if there is not a single vehicle on the lane.
SUMOTime myFollowerInfoTime
time step for which myFollowerInfo was last updated
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
SUMOReal getRightSideOnEdge() const
void add(const MSLane *const l) const
Adds the given object to the container.
Representation of a lane in the micro simulation.
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) ...
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
std::pair< MSVehicle *const, SUMOReal > getOppositeFollower(const MSVehicle *ego) const
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...
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
vehicle_position_sorter(const MSLane *lane)
Constructor.
vehicle_natural_position_sorter(const MSLane *lane)
Constructor.