Loading [MathJax]/extensions/tex2jax.js
Dynamical system model
All Classes Namespaces Files Functions Pages
dsm::Road Class Referenceabstract
Inheritance diagram for dsm::Road:
dsm::Edge dsm::Street dsm::SpireStreet dsm::StochasticStreet dsm::StochasticSpireStreet

Public Member Functions

 Road (Id id, std::pair< Id, Id > nodePair, double length=m_meanVehicleLength, double maxSpeed=13.8888888889, int nLanes=1, std::string name=std::string(), std::vector< std::pair< double, double > > geometry={}, std::optional< int > capacity=std::nullopt, double transportCapacity=1.)
 Construct a new Road object.
 
void setMaxSpeed (double speed)
 Set the maximum speed, in meters per second (default is 50 km/h)
 
void setPriority (int priority)
 Set the road's priority.
 
void addForbiddenTurn (Id roadId)
 Add a road id to the forbidden turns.
 
void setForbiddenTurns (std::set< Id > const &forbiddenTurns)
 Replace the road's forbidden turns with the given set.
 
double length () const
 Get the length, in meters.
 
double maxSpeed () const
 Get the maximum speed, in meters per second.
 
int nLanes () const
 Get the number of lanes.
 
std::string name () const
 Get the name.
 
int priority () const
 Get the priority.
 
std::set< Id > const & forbiddenTurns () const
 Get the road's forbidden turns.
 
Direction turnDirection (double const &previousStreetAngle) const
 Get the road's turn direction given the previous road angle.
 
virtual int nAgents () const =0
 
virtual int nMovingAgents () const =0
 
virtual double nExitingAgents (Direction direction, bool normalizeOnNLanes) const =0
 
virtual double density (bool normalized=false) const =0
 
- Public Member Functions inherited from dsm::Edge
 Edge (Id id, std::pair< Id, Id > nodePair, int capacity=1, double transportCapacity=1., std::vector< std::pair< double, double > > geometry={})
 Construct a new Edge object.
 
 Edge (Edge &&)=default
 
 Edge (const Edge &)=delete
 
void resetId (Id newId)
 
void setCapacity (int capacity)
 
void setTransportCapacity (double capacity)
 
void setGeometry (std::vector< std::pair< double, double > > geometry)
 
Id id () const
 Get the edge's id.
 
Id source () const
 Get the edge's source node id.
 
Id target () const
 Get the edge's target node id.
 
std::pair< Id, Id > const & nodePair () const
 Get the edge's node pair.
 
std::vector< std::pair< double, double > > const & geometry () const
 
int capacity () const
 Get the edge's capacity, in number of agents.
 
double transportCapacity () const
 Get the edge's transport capacity, in number of agents.
 
double angle () const
 Get the edge's angle, in radians, between the source and target nodes.
 
virtual bool isFull () const =0
 
double deltaAngle (double const previousEdgeAngle) const
 

Static Public Member Functions

static void setMeanVehicleLength (double meanVehicleLength)
 Set the mean vehicle length, in meters (default is 5)
 
static double meanVehicleLength ()
 Get the mean vehicle length.
 

Protected Attributes

double m_length
 
double m_maxSpeed
 
int m_nLanes
 
std::string m_name
 
int m_priority
 
std::set< Id > m_forbiddenTurns
 
- Protected Attributes inherited from dsm::Edge
std::vector< std::pair< double, double > > m_geometry
 
Id m_id
 
std::pair< Id, Id > m_nodePair
 
int m_capacity
 
double m_transportCapacity
 
double m_angle
 

Static Protected Attributes

static double m_meanVehicleLength
 

Additional Inherited Members

- Protected Member Functions inherited from dsm::Edge
void m_setAngle (std::pair< double, double > srcNodeCoordinates, std::pair< double, double > dstNodeCoordinates)
 

Constructor & Destructor Documentation

◆ Road()

dsm::Road::Road ( Id id,
std::pair< Id, Id > nodePair,
double length = m_meanVehicleLength,
double maxSpeed = 13.8888888889,
int nLanes = 1,
std::string name = std::string(),
std::vector< std::pair< double, double > > geometry = {},
std::optional< int > capacity = std::nullopt,
double transportCapacity = 1. )

Construct a new Road object.

Parameters
idThe road's id
nodePairThe road's node pair
lengthThe road's length, in meters (default is the mean vehicle length)
nLanesThe road's number of lanes (default is 1)
maxSpeedThe road's speed limit, in m/s (default is 50 km/h)
nameThe road's name (default is an empty string)
capacityThe road's capacity (default is the maximum number of vehicles that can fit in the road)
transportCapacityThe road's transport capacity (default is 1)

Member Function Documentation

◆ addForbiddenTurn()

void dsm::Road::addForbiddenTurn ( Id roadId)

Add a road id to the forbidden turns.

Parameters
roadIdThe road id to add

◆ density()

virtual double dsm::Road::density ( bool normalized = false) const
pure virtual

Implemented in dsm::Street.

◆ forbiddenTurns()

std::set< Id > const & dsm::Road::forbiddenTurns ( ) const

Get the road's forbidden turns.

Returns
std::set<Id> The road's forbidden turns

The forbidden turns are the road ids that are not allowed to be used by the agents when they are on the road.

◆ length()

double dsm::Road::length ( ) const

Get the length, in meters.

Returns
double The length, in meters

◆ maxSpeed()

double dsm::Road::maxSpeed ( ) const

Get the maximum speed, in meters per second.

Returns
double The maximum speed, in meters per second

◆ meanVehicleLength()

static double dsm::Road::meanVehicleLength ( )
static

Get the mean vehicle length.

Returns
double The mean vehicle length

◆ nAgents()

virtual int dsm::Road::nAgents ( ) const
pure virtual

Implemented in dsm::Street.

◆ name()

std::string dsm::Road::name ( ) const

Get the name.

Returns
std::string The name

◆ nExitingAgents()

virtual double dsm::Road::nExitingAgents ( Direction direction,
bool normalizeOnNLanes ) const
pure virtual

Implemented in dsm::Street.

◆ nLanes()

int dsm::Road::nLanes ( ) const

Get the number of lanes.

Returns
int The number of lanes

◆ nMovingAgents()

virtual int dsm::Road::nMovingAgents ( ) const
pure virtual

Implemented in dsm::Street.

◆ priority()

int dsm::Road::priority ( ) const

Get the priority.

Returns
int The priority

◆ setForbiddenTurns()

void dsm::Road::setForbiddenTurns ( std::set< Id > const & forbiddenTurns)

Replace the road's forbidden turns with the given set.

Parameters
forbiddenTurnsThe set of forbidden turns

◆ setMaxSpeed()

void dsm::Road::setMaxSpeed ( double speed)

Set the maximum speed, in meters per second (default is 50 km/h)

Parameters
speedThe maximum speed
Exceptions
std::invalid_argumentIf the speed is less or equal to 0

◆ setMeanVehicleLength()

static void dsm::Road::setMeanVehicleLength ( double meanVehicleLength)
static

Set the mean vehicle length, in meters (default is 5)

Parameters
meanVehicleLengthThe mean vehicle length
Exceptions
std::invalid_argumentIf the mean vehicle length is less or equal to 0

◆ setPriority()

void dsm::Road::setPriority ( int priority)

Set the road's priority.

Parameters
priorityThe road's priority

◆ turnDirection()

Direction dsm::Road::turnDirection ( double const & previousStreetAngle) const

Get the road's turn direction given the previous road angle.

Parameters
previousStreetAngleThe angle of the previous road
Returns
Direction The turn direction

The turn direction is the direction that the agent must take when it is on the road. The possible values are:

  • UTURN (abs of delta is greater than pi)
  • STRAIGHT (abs of delta is less than pi /8)
  • RIGHT (delta is negative and not covered by the above conditions)
  • LEFT (delta is positive and not covered by the above conditions)

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