Eclipse SUMO - Simulation of Urban MObility
NBRampsComputer Class Reference

#include <NBAlgorithms_Ramps.h>

Public Member Functions

void computeRamps (NBNetBuilder &nb, OptionsCont &oc, bool mayAddOrRemove)
 
 NBRampsComputer ()
 Computes highway on-/off-ramps (if wished) More...
 

Static Public Attributes

static const std::string ADDED_ON_RAMP_EDGE
 suffix for newly generated on-ramp edges More...
 

Private Member Functions

void buildOffRamp (NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, double rampLength, bool dontSplit, bool addLanes, const std::set< NBNode *, ComparatorIdLess > &potOnRamps)
 Builds an off-ramp ending at the given node. More...
 
void buildOnRamp (NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, double rampLength, bool dontSplit, bool addLanes)
 Builds an on-ramp starting at the given node. More...
 
void moveRampRight (NBEdge *ramp, int addedLanes)
 Moves the ramp to the right, as new lanes were added. More...
 

Static Private Member Functions

static bool determinedByLaneNumber (NBEdge **potHighway, NBEdge **potRamp)
 
static bool determinedBySpeed (NBEdge **potHighway, NBEdge **potRamp)
 
static bool fulfillsRampConstraints (NBEdge *potHighway, NBEdge *potRamp, NBEdge *other, double minHighwaySpeed, double maxRampSpeed, const std::set< std::string > &noramps)
 Checks whether an on-/off-ramp can be bult here. More...
 
static void getOffRampEdges (NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
 
static void getOnRampEdges (NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
 
template<class T >
static std::string getUnusedID (const std::string &prefix, const T &objectCont)
 
static bool hasWrongMode (NBEdge *edge)
 whether the edge has a mode that does not indicate a ramp edge More...
 
static bool mayNeedOffRamp (NBNode *cur, double minHighwaySpeed, double maxRampSpeed, const std::set< std::string > &noramps)
 Determines whether the given node may be an off-ramp end. More...
 
static bool mayNeedOnRamp (NBNode *cur, double minHighwaySpeed, double maxRampSpeed, const std::set< std::string > &noramps, double minWeaveLength)
 Determines whether the given node may be an on-ramp begin. More...
 
static void patchRampGeometry (NBEdge *potRamp, NBEdge *first, NBEdge *potHighway, bool onRamp)
 shift ramp geometry to merge smoothly with the motorway More...
 

Private Attributes

std::map< NBEdge *, double > myShiftedEdges
 

Detailed Description

Definition at line 46 of file NBAlgorithms_Ramps.h.

Constructor & Destructor Documentation

◆ NBRampsComputer()

NBRampsComputer::NBRampsComputer ( )

Computes highway on-/off-ramps (if wished)

Parameters
[in,changed]nb The network builder which contains the current network representation
[in]ocThe options container

Definition at line 54 of file NBAlgorithms_Ramps.cpp.

Member Function Documentation

◆ buildOffRamp()

void NBRampsComputer::buildOffRamp ( NBNode cur,
NBNodeCont nc,
NBEdgeCont ec,
NBDistrictCont dc,
double  rampLength,
bool  dontSplit,
bool  addLanes,
const std::set< NBNode *, ComparatorIdLess > &  potOnRamps 
)
private

Builds an off-ramp ending at the given node.

Parameters
[in]curThe node at which the off-ramp shall end
[in]ncThe container of nodes
[in]ecThe container of edges
[in]dcThe container of districts
[in]rampLengthThe wished ramp length
[in]dontSplitWhether no edges shall be split
[in,filled]incremented The list of edges which lane number was already incremented

Definition at line 307 of file NBAlgorithms_Ramps.cpp.

References NBEdge::addLane2LaneConnections(), DEBUGCOND, NBEdge::getFromNode(), NBEdge::getGeometry(), NBEdge::getID(), Named::getID(), NBNode::getIncomingEdges(), NBEdge::getLoadedLength(), NBEdge::getNumLanes(), getOffRampEdges(), getOnRampEdges(), NBNode::getOutgoingEdges(), NBEdge::getStep(), NBEdge::getToNode(), getUnusedID(), NBEdgeCont::hasPostProcessConnection(), NBEdge::incLaneNo(), NBNodeCont::insert(), NBEdge::invalidateConnections(), NBEdge::isTurningDirectionAt(), NBEdge::LANES2LANES_USER, PositionVector::length(), NBEdge::markOffRamp(), MIN2(), moveRampRight(), myShiftedEdges, OFFRAMP_LOOKBACK, patchRampGeometry(), PositionVector::positionAtOffset(), NBEdgeCont::retrieve(), NBEdgeCont::splitAt(), TL, NBEdge::VALIDATED, and WRITE_WARNING.

Referenced by computeRamps().

Here is the caller graph for this function:

◆ buildOnRamp()

void NBRampsComputer::buildOnRamp ( NBNode cur,
NBNodeCont nc,
NBEdgeCont ec,
NBDistrictCont dc,
double  rampLength,
bool  dontSplit,
bool  addLanes 
)
private

Builds an on-ramp starting at the given node.

Parameters
[in]curThe node at which the on-ramp shall begin
[in]ncThe container of nodes
[in]ecThe container of edges
[in]dcThe container of districts
[in]rampLengthThe wished ramp length
[in]dontSplitWhether no edges shall be split
[in,filled]incremented The list of edges which lane number was already incremented

Definition at line 198 of file NBAlgorithms_Ramps.cpp.

References ADDED_ON_RAMP_EDGE, NBEdge::addLane2LaneConnections(), DEBUGCOND, NBEdge::getGeometry(), NBEdge::getID(), Named::getID(), NBNode::getIncomingEdges(), NBEdge::getNumLanes(), getOnRampEdges(), NBNode::getOutgoingEdges(), NBEdge::getStep(), NBEdge::getToNode(), getUnusedID(), NBEdgeCont::hasPostProcessConnection(), NBEdge::incLaneNo(), NBNodeCont::insert(), NBEdge::invalidateConnections(), NBEdge::isTurningDirectionAt(), NBEdge::LANES2LANES_USER, PositionVector::length(), MIN2(), moveRampRight(), myShiftedEdges, patchRampGeometry(), PositionVector::positionAtOffset(), NBEdgeCont::retrieve(), NBEdge::setAcceleration(), NBEdgeCont::splitAt(), TL, NBEdge::VALIDATED, and WRITE_WARNING.

Referenced by computeRamps().

Here is the caller graph for this function:

◆ computeRamps()

◆ determinedByLaneNumber()

bool NBRampsComputer::determinedByLaneNumber ( NBEdge **  potHighway,
NBEdge **  potRamp 
)
staticprivate

Definition at line 458 of file NBAlgorithms_Ramps.cpp.

References std::swap().

◆ determinedBySpeed()

bool NBRampsComputer::determinedBySpeed ( NBEdge **  potHighway,
NBEdge **  potRamp 
)
staticprivate

Definition at line 446 of file NBAlgorithms_Ramps.cpp.

References std::swap().

◆ fulfillsRampConstraints()

bool NBRampsComputer::fulfillsRampConstraints ( NBEdge potHighway,
NBEdge potRamp,
NBEdge other,
double  minHighwaySpeed,
double  maxRampSpeed,
const std::set< std::string > &  noramps 
)
staticprivate

Checks whether an on-/off-ramp can be bult here.

  • none of the participating edges must be a macroscopic connector
  • ramp+highways together must have more lanes than the continuation
  • speeds must match the defined swells
    Parameters
    [in]potHighwayThe highway part to check
    [in]potRampThe ramp part to check
    [in]otherThe successor/predecessor edge
    [in]minHighwaySpeedThe minimum speed limit a highway must have for being a highway
    [in]maxRampSpeedThe maximum speed limit a ramp must have for being a ramp
    [in]norampsEdges that shall not be treated as ramps
    Returns
    Whether a ramp can be built here

Definition at line 532 of file NBAlgorithms_Ramps.cpp.

References NBEdge::getAngleAtNode(), NBEdge::getFromNode(), NBEdge::getID(), NBEdge::getNumLanes(), NBEdge::getSpeed(), NBEdge::getToNode(), NBNode::getType(), hasWrongMode(), NBEdge::isMacroscopicConnector(), NBNode::isTrafficLight(), NBEdge::isTurningDirectionAt(), MAX3(), and NBHelpers::relAngle().

Referenced by mayNeedOffRamp(), and mayNeedOnRamp().

Here is the caller graph for this function:

◆ getOffRampEdges()

void NBRampsComputer::getOffRampEdges ( NBNode n,
NBEdge **  potHighway,
NBEdge **  potRamp,
NBEdge **  other 
)
staticprivate

Definition at line 494 of file NBAlgorithms_Ramps.cpp.

References DEBUGCOND, NBNode::getEdges(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBContHelper::nextCW(), std::swap(), and toString().

Referenced by buildOffRamp(), and mayNeedOffRamp().

Here is the caller graph for this function:

◆ getOnRampEdges()

void NBRampsComputer::getOnRampEdges ( NBNode n,
NBEdge **  potHighway,
NBEdge **  potRamp,
NBEdge **  other 
)
staticprivate

Definition at line 470 of file NBAlgorithms_Ramps.cpp.

References NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), and std::swap().

Referenced by buildOffRamp(), buildOnRamp(), and mayNeedOnRamp().

Here is the caller graph for this function:

◆ getUnusedID()

template<class T >
static std::string NBRampsComputer::getUnusedID ( const std::string &  prefix,
const T &  objectCont 
)
inlinestaticprivate

Definition at line 147 of file NBAlgorithms_Ramps.h.

References toString().

Referenced by buildOffRamp(), and buildOnRamp().

Here is the caller graph for this function:

◆ hasWrongMode()

bool NBRampsComputer::hasWrongMode ( NBEdge edge)
staticprivate

whether the edge has a mode that does not indicate a ramp edge

Definition at line 598 of file NBAlgorithms_Ramps.cpp.

References NBEdge::getNumLanes(), NBEdge::getPermissions(), SVC_BICYCLE, SVC_PASSENGER, and SVC_PEDESTRIAN.

Referenced by fulfillsRampConstraints().

Here is the caller graph for this function:

◆ mayNeedOffRamp()

bool NBRampsComputer::mayNeedOffRamp ( NBNode cur,
double  minHighwaySpeed,
double  maxRampSpeed,
const std::set< std::string > &  noramps 
)
staticprivate

Determines whether the given node may be an off-ramp end.

Parameters
[in]curThe node to check
[in]minHighwaySpeedThe minimum speed limit a highway must have for being a highway
[in]maxRampSpeedThe maximum speed limit a ramp must have for being a ramp
[in]norampsEdges that shall not be treated as ramps
Returns
Whether the node is assumed to be an off-ramp end

Definition at line 181 of file NBAlgorithms_Ramps.cpp.

References DEBUGCOND, fulfillsRampConstraints(), NBEdge::getID(), NBNode::getIncomingEdges(), getOffRampEdges(), and NBNode::getOutgoingEdges().

Referenced by computeRamps().

Here is the caller graph for this function:

◆ mayNeedOnRamp()

bool NBRampsComputer::mayNeedOnRamp ( NBNode cur,
double  minHighwaySpeed,
double  maxRampSpeed,
const std::set< std::string > &  noramps,
double  minWeaveLength 
)
staticprivate

Determines whether the given node may be an on-ramp begin.

Parameters
[in]curThe node to check
[in]minHighwaySpeedThe minimum speed limit a highway must have for being a highway
[in]maxRampSpeedThe maximum speed limit a ramp must have for being a ramp
[in]norampsEdges that shall not be treated as ramps
[in]minWeaveLengthThe minimum length for weaving areas
Returns
Whether the node is assumed to be an on-ramp begin

Definition at line 149 of file NBAlgorithms_Ramps.cpp.

References DEBUGCOND, fulfillsRampConstraints(), NBEdge::getID(), NBNode::getIncomingEdges(), NBEdge::getLength(), getOnRampEdges(), NBNode::getOutgoingEdges(), and NBEdge::getToNode().

Referenced by computeRamps().

Here is the caller graph for this function:

◆ moveRampRight()

void NBRampsComputer::moveRampRight ( NBEdge ramp,
int  addedLanes 
)
private

Moves the ramp to the right, as new lanes were added.

Parameters
[in]rampThe ramp to move
[in]addedLanesThe number of added lanes

Definition at line 425 of file NBAlgorithms_Ramps.cpp.

References CENTER, NBEdge::getGeometry(), NBEdge::getID(), NBEdge::getLaneSpreadFunction(), NBEdge::getLaneWidth(), PositionVector::move2side(), myShiftedEdges, NBEdge::setGeometry(), SUMO_const_laneWidth, TL, NBEdge::UNSPECIFIED_WIDTH, and WRITE_WARNINGF.

Referenced by buildOffRamp(), and buildOnRamp().

Here is the caller graph for this function:

◆ patchRampGeometry()

void NBRampsComputer::patchRampGeometry ( NBEdge potRamp,
NBEdge first,
NBEdge potHighway,
bool  onRamp 
)
staticprivate

shift ramp geometry to merge smoothly with the motorway

Definition at line 613 of file NBAlgorithms_Ramps.cpp.

References CENTER, NBEdge::getFromNode(), NBEdge::getGeometry(), NBEdge::getLaneShape(), NBEdge::getLaneSpreadFunction(), NBEdge::getLaneWidth(), NBEdge::getNumLanes(), NBEdge::getToNode(), NBEdge::hasDefaultGeometryEndpointAtNode(), NBEdge::hasDefaultGeometryEndpoints(), MAX2(), MIN2(), PositionVector::move2side(), NBEdge::resetLaneShapes(), RIGHT, and NBEdge::setGeometry().

Referenced by buildOffRamp(), and buildOnRamp().

Here is the caller graph for this function:

Field Documentation

◆ ADDED_ON_RAMP_EDGE

const std::string NBRampsComputer::ADDED_ON_RAMP_EDGE
static

suffix for newly generated on-ramp edges

Definition at line 57 of file NBAlgorithms_Ramps.h.

Referenced by buildOnRamp().

◆ myShiftedEdges

std::map<NBEdge*, double> NBRampsComputer::myShiftedEdges
private

Definition at line 61 of file NBAlgorithms_Ramps.h.

Referenced by buildOffRamp(), buildOnRamp(), and moveRampRight().


The documentation for this class was generated from the following files: