Dynamical system model
Loading...
Searching...
No Matches
dsm::SpireStreet< Id, Size > Class Template Reference

The SpireStreet class represents a street which is able to count agent flows in both input and output. More...

#include <Street.hpp>

Inheritance diagram for dsm::SpireStreet< Id, Size >:
dsm::Street< Id, Size >

Public Member Functions

 SpireStreet (Id id, const Street< Id, Size > &street)
 Construct a new SpireStreet object starting from an existing street.
 
 SpireStreet (Id id, Size capacity, double len, std::pair< Id, Id > nodePair)
 Construct a new SpireStreet object.
 
 SpireStreet (Id id, Size capacity, double len, double maxSpeed, std::pair< Id, Id > nodePair)
 Construct a new SpireStreet object.
 
void addAgent (Id agentId) override
 Add an agent to the street's queue.
 
Size inputCounts (bool resetValue=false)
 Get the input counts of the street.
 
Size outputCounts (bool resetValue=false)
 Get the output counts of the street.
 
int meanFlow ()
 Get the mean flow of the street.
 
std::optional< Id > dequeue () override
 Remove an agent from the street's queue.
 
bool isSpire () const override
 Check if the street is a spire.
 
- Public Member Functions inherited from dsm::Street< Id, Size >
 Street (Id id, const Street< Id, Size > &)
 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.
 
void setId (Id id)
 Set the street's id.
 
void setCapacity (Size capacity)
 Set the street's capacity.
 
void setTransportCapacity (Size capacity)
 Set the street's transport capacity.
 
void setLength (double len)
 Set the street's length.
 
void setQueue (dsm::queue< Size > queue)
 Set the street's queue.
 
void setNodePair (Id node1, Id node2)
 Set the street's node pair.
 
void setNodePair (const Node< Id, Size > &node1, const Node< Id, Size > &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.
 
Id id () const
 Get the street's id.
 
Size capacity () const
 Get the street's capacity.
 
Size 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 () const
 Get the street's queue.
 
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 () const
 Get the street's density in $m^{-1}$.
 
double normDensity () const
 Get the street's normalized density.
 
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.
 
void enqueue (Id agentId)
 Add an agent to the street's queue.
 

Detailed Description

template<typename Id, typename Size>
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
class dsm::SpireStreet< Id, Size >

The SpireStreet class represents a street which is able to count agent flows in both input and output.

Template Parameters
IdThe type of the street's id
SizeThe type of the street's capacity

Constructor & Destructor Documentation

◆ SpireStreet() [1/3]

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
dsm::SpireStreet< Id, Size >::SpireStreet ( Id id,
const Street< Id, Size > & street )

Construct a new SpireStreet object starting from an existing street.

Parameters
idThe street's id
streetThe existing street

◆ SpireStreet() [2/3]

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
dsm::SpireStreet< Id, Size >::SpireStreet ( Id id,
Size capacity,
double len,
std::pair< Id, Id > nodePair )

Construct a new SpireStreet object.

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

◆ SpireStreet() [3/3]

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
dsm::SpireStreet< Id, Size >::SpireStreet ( Id id,
Size capacity,
double len,
double maxSpeed,
std::pair< Id, Id > nodePair )

Construct a new SpireStreet object.

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

Member Function Documentation

◆ addAgent()

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
void dsm::SpireStreet< Id, Size >::addAgent ( Id agentId)
overridevirtual

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

Reimplemented from dsm::Street< Id, Size >.

◆ dequeue()

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
std::optional< Id > dsm::SpireStreet< Id, Size >::dequeue ( )
overridevirtual

Remove an agent from the street's queue.

Returns
std::optional<Id> The id of the agent removed from the street's queue

Reimplemented from dsm::Street< Id, Size >.

◆ inputCounts()

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
Size dsm::SpireStreet< Id, Size >::inputCounts ( bool resetValue = false)

Get the input counts of the street.

Parameters
resetValueIf true, the counter is reset to 0 together with the output counter.
Returns
Size The input counts of the street

◆ isSpire()

template<typename Id , typename Size >
bool dsm::SpireStreet< Id, Size >::isSpire ( ) const
inlineoverridevirtual

Check if the street is a spire.

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

Reimplemented from dsm::Street< Id, Size >.

◆ meanFlow()

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
int dsm::SpireStreet< Id, Size >::meanFlow ( )

Get the mean flow of the street.

Returns
int The flow of the street, i.e. the difference between input and output flows

Once the flow is retrieved, bothh the input and output flows are reset to 0. Notice that this flow is positive iff the input flow is greater than the output flow.

◆ outputCounts()

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
Size dsm::SpireStreet< Id, Size >::outputCounts ( bool resetValue = false)

Get the output counts of the street.

Parameters
resetValueIf true, the counter is reset to 0 together with the input counter.
Returns
Size The output counts of the street

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