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::Road dsm::Edge dsm::SpireStreet dsm::StochasticStreet dsm::StochasticSpireStreet

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, double length=Road::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 Street object.
 
void setQueue (dsm::queue< Size > queue, size_t index)
 Set the street's queue.
 
std::vector< Id > const & movingAgents () 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.
 
int nAgents () const final
 Get the number of agents on the street.
 
double density (bool normalized=false) const final
 Get the street's density in $m^{-1}$ or in $a.u.$, if normalized.
 
bool isFull () const final
 Check if the street is full.
 
int nMovingAgents () const override
 
int nExitingAgents () const final
 Get the number of agents on all queues.
 
std::vector< Direction > const & laneMapping () const
 
void addAgent (Id agentId) override
 
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.
 
virtual bool isStochastic () const
 
- Public Member Functions inherited from dsm::Road
 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.
 
- 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.
 
double deltaAngle (double const previousEdgeAngle) const
 

Static Public Member Functions

static void setMeanVehicleLength (double meanVehicleLength)
 Set the mean vehicle length.
 
- Static Public Member Functions inherited from dsm::Road
static void setMeanVehicleLength (double meanVehicleLength)
 Set the mean vehicle length, in meters (default is 5)
 
static double meanVehicleLength ()
 Get the mean vehicle length.
 

Additional Inherited Members

- Protected Attributes inherited from dsm::Road
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 inherited from dsm::Road
static double m_meanVehicleLength
 

Detailed Description

The Street class represents a street in the network.

Constructor & Destructor Documentation

◆ Street() [1/2]

dsm::Street::Street ( Id id,
const 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/2]

dsm::Street::Street ( Id id,
std::pair< Id, Id > nodePair,
double length = Road::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 Street object.

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

Member Function Documentation

◆ addAgent()

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

Implements dsm::Road.

◆ density()

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

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

Implements dsm::Road.

◆ dequeue()

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

Remove an agent from the street's queue.

Reimplemented in dsm::SpireStreet, and dsm::StochasticSpireStreet.

◆ 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

◆ isFull()

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

Check if the street is full.

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

Implements dsm::Edge.

◆ 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, and dsm::StochasticSpireStreet.

◆ movingAgents()

std::vector< Id > const & dsm::Street::movingAgents ( ) const

Get the street's waiting agents.

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

◆ nAgents()

int dsm::Street::nAgents ( ) const
finalvirtual

Get the number of agents on the street.

Returns
Size, The number of agents on the street

Implements dsm::Road.

◆ nExitingAgents()

int dsm::Street::nExitingAgents ( ) const
finalvirtual

Get the number of agents on all queues.

Returns
Size The number of agents on all queues

Implements dsm::Road.

◆ nMovingAgents()

int dsm::Street::nMovingAgents ( ) const
inlineoverridevirtual

Implements dsm::Road.

◆ 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

◆ setMeanVehicleLength()

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

Set the mean vehicle length.

Parameters
meanVehicleLengthThe mean vehicle length
Exceptions
std::invalid_argumentIf the mean vehicle length is negative

◆ setQueue()

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

Set the street's queue.

Parameters
queueThe street's queue

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