Dynamical system model
Loading...
Searching...
No Matches
dsm::SpireStreet Class 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:
dsm::Street

Public Member Functions

 SpireStreet (Id id, const Street &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 (size_t index) override
 Remove an agent from the street's queue.
 
bool isSpire () const final
 Check if the street is a spire.
 
- Public Member Functions inherited from dsm::Street
 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.
 
void enqueue (Id agentId, size_t index)
 Add an agent to the street's queue.
 

Detailed Description

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]

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

Construct a new SpireStreet object starting from an existing street.

Parameters
idThe street's id
streetThe existing street

◆ SpireStreet() [2/3]

dsm::SpireStreet::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]

dsm::SpireStreet::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()

void dsm::SpireStreet::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.

◆ dequeue()

std::optional< Id > dsm::SpireStreet::dequeue ( size_t index)
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.

◆ inputCounts()

Size dsm::SpireStreet::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()

bool dsm::SpireStreet::isSpire ( ) const
inlinefinalvirtual

Check if the street is a spire.

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

Reimplemented from dsm::Street.

◆ meanFlow()

int dsm::SpireStreet::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()

Size dsm::SpireStreet::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 files: