Dynamical system model
Loading...
Searching...
No Matches
dsm::Street Class Reference

The Street class represents a street in the network. More...

#include <Street.hpp>

Inheritance diagram for dsm::Street:
dsm::SpireStreet

Public Member Functions

 Street (Id id, const Street &)
 Construct a new Street object starting from an existing street.
 
 Street (Id id, std::pair< Id, Id > nodePair)
 Construct a new Street object.
 
 Street (Id id, Size capacity, double len, std::pair< Id, Id > nodePair)
 Construct a new Street object.
 
 Street (Id id, Size capacity, double len, double maxSpeed, std::pair< Id, Id > nodePair)
 Construct a new Street object.
 
 Street (Id id, Size capacity, double len, double maxSpeed, std::pair< Id, Id > nodePair, int16_t nLanes, std::string const &name=std::string())
 Construct a new Street object.
 
void setId (Id id)
 Set the street's id.
 
void setCapacity (Size capacity)
 Set the street's capacity.
 
void setTransportCapacity (int16_t capacity)
 Set the street's transport capacity.
 
void setLength (double len)
 Set the street's length.
 
void setQueue (dsm::queue< Size > queue, size_t index)
 Set the street's queue.
 
void setNodePair (Id node1, Id node2)
 Set the street's node pair.
 
void setNodePair (const Node &node1, const Node &node2)
 Set the street's node pair.
 
void setNodePair (std::pair< Id, Id > pair)
 Set the street's node pair.
 
void setMaxSpeed (double speed)
 Set the street's speed limit.
 
void setAngle (std::pair< double, double > srcNode, std::pair< double, double > dstNode)
 Set the street's angle.
 
void setAngle (double angle)
 Set the street's angle.
 
void setNLanes (const int16_t nLanes)
 Set the street's number of lanes.
 
Id id () const
 Get the street's id.
 
Size capacity () const
 Get the street's capacity.
 
int16_t transportCapacity () const
 Get the street's transport capacity.
 
double length () const
 Get the street's length.
 
const std::set< Id > & waitingAgents () const
 Get the street's waiting agents.
 
const dsm::queue< Size > & queue (size_t index) const
 Get the street's queue.
 
const std::vector< dsm::queue< Size > > & exitQueues () const
 Get the street's queues.
 
const std::pair< Id, Id > & nodePair () const
 Get the street's node pair.
 
Size nAgents () const
 Get the number of agents on the street.
 
double density (bool normalized=false) const
 Get the street's density in $m^{-1}$ or in $a.u.$, if normalized.
 
bool isFull () const
 Check if the street is full.
 
double maxSpeed () const
 Get the street's speed limit.
 
double angle () const
 Get the street's angle.
 
int16_t nLanes () const
 Get the street's number of lanes.
 
std::string_view name () const
 Get the street's name.
 
Size nExitingAgents () const
 Get the number of agents on all queues.
 
double deltaAngle (double const previousStreetAngle) const
 Get the delta angle between the street and the previous street, normalized between -pi and pi.
 
virtual void addAgent (Id agentId)
 
void enqueue (Id agentId, size_t index)
 Add an agent to the street's queue.
 
virtual std::optional< Id > dequeue (size_t index)
 Remove an agent from the street's queue.
 
virtual bool isSpire () const
 Check if the street is a spire.
 

Detailed Description

The Street class represents a street in the network.

Template Parameters
Id,Thetype of the street's id. It must be an unsigned integral type.
Size,Thetype of the street's capacity. It must be an unsigned integral type.

Constructor & Destructor Documentation

◆ Street() [1/5]

dsm::Street::Street ( Id id,
const Street & street )

Construct a new Street object starting from an existing street.

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

Parameters
StreetThe existing street
idThe new street's id

◆ Street() [2/5]

dsm::Street::Street ( Id id,
std::pair< Id, Id > nodePair )

Construct a new Street object.

Parameters
idThe street's id
nodePairThe street's node pair

◆ Street() [3/5]

dsm::Street::Street ( Id id,
Size capacity,
double len,
std::pair< Id, Id > nodePair )

Construct a new Street object.

The default capacity is 1, the default length is 1, and the default speed limit is 50 km/h, i.e. 13.8888888889 m/s.

Parameters
idThe street's id
capacityThe street's capacity
lenThe street's length
nodePairThe street's node pair

◆ Street() [4/5]

dsm::Street::Street ( Id id,
Size capacity,
double len,
double maxSpeed,
std::pair< Id, Id > nodePair )

Construct a new Street object.

The default speed limit is 50 km/h, i.e. 13.8888888889 m/s.

Parameters
idThe street's id
capacityThe street's capacity
lenThe street's length
maxSpeedThe street's speed limit
nodePairThe street's node pair

◆ Street() [5/5]

dsm::Street::Street ( Id id,
Size capacity,
double len,
double maxSpeed,
std::pair< Id, Id > nodePair,
int16_t nLanes,
std::string const & name = std::string() )

Construct a new Street object.

The default speed limit is 50 km/h, i.e. 13.8888888889 m/s.

Parameters
idThe street's id
capacityThe street's capacity
lenThe street's length
lanesThe street's number of lanes
maxSpeedThe street's speed limit
nodePairThe street's node pair
nameThe street's name (default is "")

Member Function Documentation

◆ addAgent()

void dsm::Street::addAgent ( Id agentId)
virtual

Reimplemented in dsm::SpireStreet.

◆ angle()

double dsm::Street::angle ( ) const
inline

Get the street's angle.

Returns
double The street's angle

◆ capacity()

Size dsm::Street::capacity ( ) const
inline

Get the street's capacity.

Returns
Size, The street's capacity

◆ deltaAngle()

double dsm::Street::deltaAngle ( double const previousStreetAngle) const

Get the delta angle between the street and the previous street, normalized between -pi and pi.

Parameters
previousStreetAngleThe angle of the previous street
Returns
double The delta angle between the street and the previous street

◆ density()

double dsm::Street::density ( bool normalized = false) const

Get the street's density in $m^{-1}$ or in $a.u.$, if normalized.

Parameters
normalizedIf true, the street's density is normalized by the street's capacity
Returns
double, The street's density

◆ dequeue()

std::optional< Id > dsm::Street::dequeue ( size_t index)
virtual

Remove an agent from the street's queue.

Reimplemented in dsm::SpireStreet.

◆ enqueue()

void dsm::Street::enqueue ( Id agentId,
size_t index )

Add an agent to the street's queue.

Parameters
agentIdThe id of the agent to add to the street's queue
Exceptions
std::runtime_errorIf the street's queue is full

◆ exitQueues()

const std::vector< dsm::queue< Size > > & dsm::Street::exitQueues ( ) const
inline

Get the street's queues.

Returns
std::vector<dsm::queue<Size>> The street's queues

◆ id()

Id dsm::Street::id ( ) const
inline

Get the street's id.

Returns
Id, The street's id

◆ isFull()

bool dsm::Street::isFull ( ) const
inline

Check if the street is full.

Returns
bool, True if the street is full, false otherwise

◆ isSpire()

virtual bool dsm::Street::isSpire ( ) const
inlinevirtual

Check if the street is a spire.

Returns
bool True if the street is a spire, false otherwise

Reimplemented in dsm::SpireStreet.

◆ length()

double dsm::Street::length ( ) const
inline

Get the street's length.

Returns
double, The street's length

◆ maxSpeed()

double dsm::Street::maxSpeed ( ) const
inline

Get the street's speed limit.

Returns
double, The street's speed limit

◆ nAgents()

Size dsm::Street::nAgents ( ) const

Get the number of agents on the street.

Returns
Size, The number of agents on the street

◆ name()

std::string_view dsm::Street::name ( ) const
inline

Get the street's name.

Returns
std::string_view The street's name

◆ nExitingAgents()

Size dsm::Street::nExitingAgents ( ) const

Get the number of agents on all queues.

Returns
Size The number of agents on all queues

◆ nLanes()

int16_t dsm::Street::nLanes ( ) const
inline

Get the street's number of lanes.

Returns
int16_t The street's number of lanes

◆ nodePair()

const std::pair< Id, Id > & dsm::Street::nodePair ( ) const
inline

Get the street's node pair.

Returns
std::pair<Id, Id>, The street's node pair

◆ queue()

const dsm::queue< Size > & dsm::Street::queue ( size_t index) const
inline

Get the street's queue.

Returns
dsm::queue<Size>, The street's queue

◆ setAngle() [1/2]

void dsm::Street::setAngle ( double angle)

Set the street's angle.

Parameters
angleThe street's angle
Exceptions
std::invalid_argumentIf the angle is negative or greater than 2 * pi

◆ setAngle() [2/2]

void dsm::Street::setAngle ( std::pair< double, double > srcNode,
std::pair< double, double > dstNode )

Set the street's angle.

Parameters
srcNodeThe source node of the street
dstNodeThe destination node of the street

◆ setCapacity()

void dsm::Street::setCapacity ( Size capacity)
inline

Set the street's capacity.

Parameters
capacityThe street's capacity

◆ setId()

void dsm::Street::setId ( Id id)
inline

Set the street's id.

Parameters
idThe street's id

◆ setLength()

void dsm::Street::setLength ( double len)

Set the street's length.

Parameters
lenThe street's length
Exceptions
std::invalid_argument,Ifthe length is negative

◆ setMaxSpeed()

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

Set the street's speed limit.

Parameters
speedThe street's speed limit
Exceptions
std::invalid_argument,Ifthe speed is negative

◆ setNLanes()

void dsm::Street::setNLanes ( const int16_t nLanes)

Set the street's number of lanes.

Parameters
nLanesThe street's number of lanes
Exceptions
std::invalid_argumentIf the number of lanes is 0

◆ setNodePair() [1/3]

void dsm::Street::setNodePair ( const Node & node1,
const Node & node2 )
inline

Set the street's node pair.

Parameters
node1The source node of the street
node2The destination node of the street

◆ setNodePair() [2/3]

void dsm::Street::setNodePair ( Id node1,
Id node2 )
inline

Set the street's node pair.

Parameters
node1The source node of the street
node2The destination node of the street

◆ setNodePair() [3/3]

void dsm::Street::setNodePair ( std::pair< Id, Id > pair)
inline

Set the street's node pair.

Parameters
pairThe street's node pair

◆ setQueue()

void dsm::Street::setQueue ( dsm::queue< Size > queue,
size_t index )
inline

Set the street's queue.

Parameters
queueThe street's queue

◆ setTransportCapacity()

void dsm::Street::setTransportCapacity ( int16_t capacity)
inline

Set the street's transport capacity.

The transport capacity is the maximum number of agents that can traverse the street in a time step.

Parameters
capacityThe street's transport capacity

◆ transportCapacity()

int16_t dsm::Street::transportCapacity ( ) const
inline

Get the street's transport capacity.

The transport capacity is the maximum number of agents that can traverse the street in a time step.

Returns
Size, The street's transport capacity

◆ waitingAgents()

const std::set< Id > & dsm::Street::waitingAgents ( ) const
inline

Get the street's waiting agents.

Returns
std::set<Id>, The street's waiting agents

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