66 typedef std::map<const MSLane*, std::pair<double, double> >
LaneCoverageInfo;
94 struct VehPosition :
public std::binary_function < const MSVehicle*, double, bool > {
117 bool downstream =
true) :
125 myDownstream(downstream),
126 myDirection(downstream ? 1 : -1) {
130 return (myI1 == other.
myI1 131 && myI2 == other.
myI2 132 && myI3 == other.
myI3 139 return !(*
this == other);
151 bool nextIsMyVehicles()
const;
200 MSLane(
const std::string&
id,
double maxSpeed,
double length,
MSEdge*
const edge,
226 void addNeigh(
const std::string&
id);
293 bool recheckNextLanes,
297 bool checkFailure(
const MSVehicle* aVehicle,
double& speed,
double& dist,
const double nspeed,
const bool patchSpeed,
const std::string errorMsg)
const;
692 return (
int)
myDict.size();
699 static void insertIDs(std::vector<std::string>& into);
706 template<
class RTREE>
707 static void fill(RTREE& into);
719 const MSLane& succLinkSource,
720 const std::vector<MSLane*>& conts);
725 bool isLinkEnd(MSLinkCont::const_iterator& i)
const;
809 bool allSublanes,
double searchDist = -1,
bool ignoreMinorLinks =
false)
const;
826 std::pair<MSVehicle* const, double>
getLeader(
const MSVehicle* veh,
const double vehPos,
const std::vector<MSLane*>& bestLaneConts,
double dist = -1,
bool checkTmpVehicles =
false)
const;
851 double speed,
const MSVehicle& veh,
const std::vector<MSLane*>& bestLaneConts)
const;
894 std::set<MSVehicle*>
getSurroundingVehicles(
double startPos,
double downstreamDist,
double upstreamDist, std::shared_ptr<LaneCoverageInfo> checkedLanes)
const;
902 std::vector<const MSJunction*>
getUpcomingJunctions(
double pos,
double range,
const std::vector<MSLane*>& contLanes)
const;
904 std::vector<const MSLink*>
getUpcomingLinks(
double pos,
double range,
const std::vector<MSLane*>& contLanes)
const;
1073 std::pair<MSVehicle* const, double>
getFollower(
const MSVehicle* ego,
double egoPos,
double dist,
bool ignoreMinorLinks)
const;
1159 const MSLane::VehCont::iterator& at,
1164 SUMOTime timestep,
const std::string& stage);
1168 std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1169 std::set<const MSVehicle*>& toTeleport)
const;
1173 double gap,
double latGap,
1174 std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1175 std::set<const MSVehicle*>& toTeleport)
const;
void detectPedestrianJunctionCollision(const MSVehicle *collider, const PositionVector &colliderBoundary, const MSLane *foeLane, SUMOTime timestep, const std::string &stage)
detect whether a vehicle collids with pedestrians on the junction
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
std::pair< MSVehicle *const, double > getFollower(const MSVehicle *ego, double egoPos, double dist, bool ignoreMinorLinks) const
Find follower vehicle for the given ego vehicle (which may be on the opposite direction lane) ...
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
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 ...
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
saves leader/follower vehicles and their distances relative to an ego vehicle
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
MSVehicle * getFirstFullVehicle() const
returns the first vehicle for which this lane is responsible or 0
bool detectCollisionBetween(SUMOTime timestep, const std::string &stage, MSVehicle *collider, MSVehicle *victim, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toRemove, std::set< const MSVehicle *> &toTeleport) const
detect whether there is a collision between the two vehicles
MSLane(const std::string &id, double maxSpeed, double length, MSEdge *const edge, int numericalID, const PositionVector &shape, double width, SVCPermissions permissions, int index, bool isRampAccel)
Constructor.
void sortManeuverReservations()
sorts myManeuverReservations
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
std::set< MSVehicle * > getSurroundingVehicles(double startPos, double downstreamDist, double upstreamDist, std::shared_ptr< LaneCoverageInfo > checkedLanes) const
Returns all vehicles closer than downstreamDist along the along the road network starting on the give...
void updateLeaderInfo(const MSVehicle *veh, VehCont::reverse_iterator &vehPart, VehCont::reverse_iterator &vehRes, MSLeaderInfo &ahead) const
This updates the MSLeaderInfo argument with respect to the given MSVehicle. All leader-vehicles on th...
Sorts lanes (IncomingLaneInfos) by their priority or, if this doesn't apply, wrt. the angle differenc...
virtual void removeParking(MSVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
std::pair< MSVehicle *const, double > getOppositeLeader(const MSVehicle *ego, double dist, bool oppositeDir) const
std::map< const MSLane *, std::pair< double, double > > LaneCoverageInfo
Coverage info.
static bool teleportOnCollision()
static const long CHANGE_PERMISSIONS_GUI
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
bool checkFailure(const MSVehicle *aVehicle, double &speed, double &dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const
int myI2
index for myPartialVehicles
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
bool isInsertionSuccess(MSVehicle *vehicle, double speed, double pos, double posLat, bool recheckNextLanes, MSMoveReminder::Notification notification)
Tries to insert the given vehicle with the given state (speed and pos)
static void fill(RTREE &into)
Fills the given RTree with lane instances.
double getMaximumBrakeDist() const
compute maximum braking distance on this lane
void setMaxSpeed(double val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
std::vector< IncomingLaneInfo > myIncomingLanes
All direct predecessor lanes.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
int myI2End
end index for myPartialVehicles
std::vector< const MSJunction * > getUpcomingJunctions(double pos, double range, const std::vector< MSLane *> &contLanes) const
Returns all upcoming junctions within given range along the given (non-internal) continuation lanes m...
void addLink(MSLink *link)
Delayed initialization.
MSLane * myCanonicalPredecessorLane
Similar to LogicalPredecessorLane,.
int myIndex
The lane index.
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
static double myCollisionMinGapFactor
SUMOTime myLeaderInfoTime
time step for which myLeaderInfo was last updated
bool needsCollisionCheck() const
short-circut collision check if nothing changed since the last check
bool operator()(const MSVehicle *cmp, double pos) const
compares vehicle position to the detector position
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane...
static SUMOTime myCollisionStopTime
Notification
Definition of a vehicle state.
virtual void resetManeuverReservation(MSVehicle *v)
Unregisters a vehicle, which previously registered for maneuvering into this lane.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
double myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
const MSEdge *const myEdge
std::map< long long, SVCPermissions > myPermissionChanges
void addIncomingLane(MSLane *lane, MSLink *viaLink)
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
void visit(const LaneStoringVisitor &cont) const
Callback for visiting the lane when traversing an RTree.
std::set< MSVehicle * > getVehiclesInRange(double a, double b) const
Returns all vehicles on the lane overlapping with the interval [a,b].
double getLength() const
Returns the lane's length.
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.
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
MSLink * getLinkTo(const MSLane *) const
returns the link to the given lane or 0, if it is not connected
void leftByLaneChange(MSVehicle *v)
MSLane * getCanonicalPredecessorLane() const
void addNeigh(const std::string &id)
Adds a neighbor to this lane.
const std::vector< MSMoveReminder *> & getMoveReminders() const
Return the list of this lane's move reminders.
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
static bool myCheckJunctionCollisions
virtual void setManeuverReservation(MSVehicle *v)
Registers the lane change intentions (towards this lane) for the given vehicle.
double getWidth() const
Returns the lane's width.
int myI1End
end index for myVehicles
int myDirection
index delta
PositionVector myShape
The shape of the lane.
int myI3
index for myTmpVehicles
MSLane * getCanonicalSuccessorLane() const
std::set< const MSVehicle * > myParkingVehicles
void getLeadersOnConsecutive(double dist, double seen, double 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...
bool myDownstream
iteration direction
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
void requireCollisionCheck()
require another collision check due to relevant changes in the simulation
Performs lane changing of vehicles.
std::vector< std::string > myNeighs
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
static CollisionAction getCollisionAction()
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.
Sorts lanes (their origin link) by the priority of their noninternal target edges or...
void addApproachingLane(MSLane *lane, bool warnMultiCon)
Performs lane changing of vehicles.
A road/street connecting two junctions.
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle's access class.
double getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
double myLength
Lane length [m].
int getIndex() const
Returns the lane's index.
void resetPermissions(long long transientID)
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
void setPermissions(SVCPermissions permissions, long long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else 0.
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.
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
const bool myIsRampAccel
whether this lane is an acceleration lane
const MSEdge *const myEdge
Representation of a vehicle.
friend class AnyVehicleIterator
void setLength(double val)
Sets a new length for the lane (used by TraCI only)
double interpolateGeometryPosToLanePos(double geometryPos) const
Sorts vehicles by their position (descending)
double myRightSideOnEdge
the combined width of all lanes with lower index on myEdge
A point in 2D or 3D with translation and scaling methods.
double getCenterOnEdge() const
bool lastInsertion(MSVehicle &veh, double mspeed, double posLat, bool patchSpeed)
inserts vehicle as close as possible to the last vehicle on this lane (or at the end of the lane if t...
SVCPermissions myOriginalPermissions
The original vClass permissions for this lane (before temporary modifications)
void enteredByLaneChange(MSVehicle *v)
virtual void setJunctionApproaches(const SUMOTime t)
Register junction approaches for all vehicles after velocities have been planned. ...
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, double latOffset, double minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
const std::map< SUMOVehicleClass, double > * myRestrictions
The vClass speed restrictions for this lane.
bool checkForPedestrians(const MSVehicle *aVehicle, double &speed, double &dist, double pos, bool patchSpeed) const
check whether pedestrians on this lane interfere with vehicle insertion
std::pair< MSVehicle *const, double > getOppositeFollower(const MSVehicle *ego) const
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
double safeInsertionSpeed(const MSVehicle *veh, double seen, const MSLeaderInfo &leaders, double speed)
return the maximum safe speed for insertion behind leaders (a negative value indicates that safe inse...
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Sorts edges by their angle relative to the given edge (straight comes first)
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
void setStopOffsets(std::map< SVCPermissions, double > stopOffsets)
Set vehicle class specific stopOffsets.
void add(const MSLane *const l) const
Adds the given object to the container.
MSVehicle * getPartialBehind(const MSVehicle *ego) const
virtual bool isSelected() const
whether this lane is selected in the GUI
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 ...
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.
std::pair< MSVehicle *const, double > getLeader(const MSVehicle *veh, const double vehPos, const std::vector< MSLane *> &bestLaneConts, double dist=-1, bool checkTmpVehicles=false) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
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.
const std::vector< std::pair< const MSLane *, const MSEdge * > > getOutgoingViaLanes() const
get the list of outgoing lanes
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 void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
An upper class for objects with additional parameters.
double getHCEmissions() const
Returns the sum of last step HC emissions.
virtual double getChosenSpeedFactor() const =0
std::map< MSEdge *, std::vector< MSLane * > > myApproachingLanes
All direct internal and direct (disregarding internal predecessors) non-internal predecessor lanes of...
std::vector< MSVehicle * > VehCont
Container for vehicles.
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane *> &conts)
const std::map< SVCPermissions, double > & getStopOffsets() const
Returns vehicle class specific stopOffsets.
Base class for objects which have an id.
std::map< SVCPermissions, double > myStopOffsets
int myNumericalID
Unique numerical ID (set on reading by netload)
std::vector< MSMoveReminder *> myMoveReminders
This lane's move reminder.
VehCont myManeuverReservations
The vehicles which registered maneuvering into the lane within their current action step...
virtual double getMaxSpeed() const =0
Returns the vehicle's maximum speed.
const MSLane *const myLane
double getRightSideOnEdge() const
MSLeaderInfo getPartialBeyond() const
get all vehicles that are inlapping from consecutive edges
void initRestrictions()
initialized vClass-specific speed limits
double getLengthGeometryFactor() const
return shape.length() / myLength
AnyVehicleIterator(const MSLane *lane, int i1, int i2, int i3, const int i1End, const int i2End, const int i3End, bool downstream=true)
int getRightmostSublane() const
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
void sortPartialVehicles()
sorts myPartialVehicles
bool freeInsertion(MSVehicle &veh, double speed, double posLat, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Tries to insert the given vehicle on any place.
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
The vehicle has departed (was inserted into the network)
double getCOEmissions() const
Returns the sum of last step CO emissions.
std::pair< MSVehicle *const, double > getLeaderOnConsecutive(double dist, double seen, double speed, const MSVehicle &veh, const std::vector< MSLane *> &bestLaneConts) const
Returns the immediate leader and the distance to him.
int myI1
index for myVehicles
double getOppositePos(double pos) const
return the corresponding position on the opposite lane
bool operator()(const IncomingLaneInfo &ili) const
static void clear()
Clears the dictionary.
const MSLane * getFirstInternalInConnection(double &offset) const
Returns 0 if the lane is not internal. Otherwise the first part of the connection (sequence of intern...
int myI3End
end index for myTmpVehicles
MSEdge *const myEdge
The lane's edge, for routing only.
const MSVehicle * operator->()
const MSLane * myLane
the lane that is being iterated
A storage for options typed value containers)
double interpolateLanePosToGeometryPos(double lanePos) const
void handleCollisionBetween(SUMOTime timestep, const std::string &stage, MSVehicle *collider, MSVehicle *victim, double gap, double latGap, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toRemove, std::set< const MSVehicle *> &toTeleport) const
take action upon collision
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
bool isApproachedFrom(MSEdge *const edge)
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
double getStopOffset(const MSVehicle *veh) const
Returns vehicle class specific stopOffset for the vehicle.
std::pair< MSVehicle *const, double > getCriticalLeader(double dist, double seen, double speed, const MSVehicle &veh) const
Returns the most dangerous leader and the distance to him.
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction ...
const MSLeaderInfo & getFirstVehicleInformation(const MSVehicle *ego, double latOffset, bool onlyFrontOnLane, double maxPos=std::numeric_limits< double >::max(), bool allowCached=true) const
analogue to getLastVehicleInformation but in the upstream direction
bool allowsVehicleClass(SUMOVehicleClass vclass) const
MSLane & operator=(const MSLane &)
invalidated assignment operator
const std::set< const MSVehicle * > & getParkingVehicles() const
retrieve the parking vehicles (see GUIParkingArea)
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 MSLane *const myLane
MSLane * myCanonicalSuccessorLane
Main successor lane,.
Static storage of an output device and its base (abstract) implementation.
double myNettoVehicleLengthSum
The current length of all vehicles on this lane, excluding their minGaps.
double getMeanSpeed() const
Returns the mean speed on this lane.
MSLeaderInfo myFollowerInfo
followers on all sublanes as seen by vehicles on consecutive lanes (cached)
virtual ~MSLane()
Destructor.
void addParking(MSVehicle *veh)
add parking vehicle. This should only used during state loading
The class responsible for building and deletion of vehicles.
double getMissingRearGap(const MSVehicle *leader, double backOffset, double leaderSpeed) const
return by how much further the leader must be inserted to avoid rear end collisions ...
const double myLengthGeometryFactor
precomputed myShape.length / myLength
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 ...
double getDepartPosLat(const MSVehicle &veh)
static const long CHANGE_PERMISSIONS_PERMANENT
MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle *ego, double backOffset, bool allSublanes, double searchDist=-1, bool ignoreMinorLinks=false) const
return the sublane followers with the largest missing rear gap among all predecessor lanes (within di...
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.
double myMaxSpeed
Lane-wide speedlimit [m/s].
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Representation of a lane in the micro simulation.
std::vector< const MSLink * > getUpcomingLinks(double pos, double range, const std::vector< MSLane *> &contLanes) const
Returns all upcoming junctions within given range along the given (non-internal) continuation lanes m...
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
bool myNeedsCollisionCheck
whether a collision check is currently needed
const double myWidth
Lane width [m].
void setRightSideOnEdge(double value, int rightmostSublane)
bool isAccelLane() const
return whether this lane is an acceleration lane
virtual void incorporateVehicle(MSVehicle *veh, double pos, double speed, double 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 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.
double getDepartSpeed(const MSVehicle &veh, bool &patchSpeed)