Dynamical system model
Loading...
Searching...
No Matches
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, const Road &)
 Construct a new Road object starting from an existing 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::optional< int > capacity=std::nullopt, int transportCapacity=1)
 Construct a new Road object.
 
void setMaxSpeed (double speed)
 Set the maximum speed, in meters per second (default is 50 km/h)
 
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.
 
virtual void addAgent (Id agentId)=0
 
virtual int nAgents () const =0
 
virtual int nMovingAgents () const =0
 
virtual int nExitingAgents () 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, int transportCapacity=1, double angle=0.0)
 Construct a new Edge object.
 
void setCapacity (int capacity)
 
void setTransportCapacity (int capacity)
 
void setAngle (std::pair< double, double > srcNodeCoordinates, std::pair< double, double > dstNodeCoordinates)
 
Id id () const
 Get the edge's id.
 
Id u () const
 Get the edge's source node id.
 
Id v () const
 Get the edge's destination node id.
 
std::pair< Id, Id > const & nodePair () const
 Get the edge's node pair.
 
int capacity () const
 Get the edge's capacity, in number of agents.
 
int 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 destination 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
 
- Protected Attributes inherited from dsm::Edge
Id m_id
 
std::pair< Id, Id > m_nodePair
 
int m_capacity
 
int m_transportCapacity
 
double m_angle
 

Static Protected Attributes

static double m_meanVehicleLength
 

Constructor & Destructor Documentation

◆ Road() [1/2]

dsm::Road::Road ( Id id,
const Road &  )

Construct a new Road object starting from an existing road.

The new road has different id but same capacity, length, speed limit, and node pair as the existing road.

Parameters
RoadThe existing road
idThe new road's id

◆ Road() [2/2]

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::optional< int > capacity = std::nullopt,
int 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

◆ addAgent()

virtual void dsm::Road::addAgent ( Id agentId)
pure virtual

◆ density()

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

Implemented in dsm::Street.

◆ 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 int dsm::Road::nExitingAgents ( ) const
pure virtual

Implemented in dsm::Street.

◆ nLanes()

int dsm::Road::nLanes ( ) const

Get the number of lanes.

Returns
int The number of lanes

◆ 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

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