Processing math: 100%
Dynamical system model
All Classes Namespaces Files Functions Pages
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 dsm::Counter dsm::Road dsm::Edge

Public Member Functions

 SpireStreet (Street &&street)
 
 SpireStreet (SpireStreet &&)=default
 
 SpireStreet (SpireStreet const &)=delete
 
void addAgent (std::unique_ptr< Agent > pAgent) final
 Add an agent to the street's queue.
 
int meanFlow ()
 Get the mean flow of the street.
 
std::unique_ptr< Agentdequeue (size_t index) final
 Remove an agent from the street's queue.
 
bool isSpire () const final
 Check if the street is a spire.
 
 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::vector< std::pair< double, double > > geometry={}, std::optional< int > capacity=std::nullopt, double transportCapacity=1.)
 Construct a new Street object.
 
 Street (Street &&)=default
 
 Street (Street const &)=delete
 
- Public Member Functions inherited from 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::vector< std::pair< double, double > > geometry={}, std::optional< int > capacity=std::nullopt, double transportCapacity=1.)
 Construct a new Street object.
 
 Street (Street &&)=default
 
 Street (Street const &)=delete
 
void setLaneMapping (std::vector< Direction > const &laneMapping)
 Set the street's lane mapping.
 
void setQueue (dsm::queue< std::unique_ptr< Agent > > queue, size_t index)
 Set the street's queue.
 
const dsm::queue< std::unique_ptr< Agent > > & queue (size_t const &index) const
 Get the street's queue.
 
std::vector< dsm::queue< std::unique_ptr< Agent > > > const & 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.
 
dsm::priority_queue< std::unique_ptr< Agent >, std::vector< std::unique_ptr< Agent > >, AgentComparator > & movingAgents ()
 
int nMovingAgents () const override
 Get the number of of moving agents, i.e. agents not yet enqueued.
 
double nExitingAgents (Direction direction=Direction::ANY, bool normalizeOnNLanes=false) const final
 Get the number of agents on all queues for a given direction.
 
std::vector< Direction > const & laneMapping () const
 
void enqueue (size_t const &queueId)
 Add an agent to the street's queue.
 
virtual bool isStochastic () const
 
- Public Member Functions inherited from 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::vector< std::pair< double, double > > geometry={}, std::optional< int > capacity=std::nullopt, double transportCapacity=1.)
 Construct a new Road object.
 
void setMaxSpeed (double speed)
 Set the maximum speed, in meters per second (default is 50 km/h)
 
void setPriority (int priority)
 Set the road's priority.
 
void addForbiddenTurn (Id roadId)
 Add a road id to the forbidden turns.
 
void setForbiddenTurns (std::set< Id > const &forbiddenTurns)
 Replace the road's forbidden turns with the given set.
 
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.
 
int priority () const
 Get the priority.
 
std::set< Id > const & forbiddenTurns () const
 Get the road's forbidden turns.
 
Direction turnDirection (double const &previousStreetAngle) const
 Get the road's turn direction given the previous road angle.
 
- Public Member Functions inherited from dsm::Edge
 Edge (Id id, std::pair< Id, Id > nodePair, int capacity=1, double transportCapacity=1., std::vector< std::pair< double, double > > geometry={})
 Construct a new Edge object.
 
 Edge (Edge &&)=default
 
 Edge (const Edge &)=delete
 
void resetId (Id newId)
 
void setCapacity (int capacity)
 
void setTransportCapacity (double capacity)
 
void setGeometry (std::vector< std::pair< double, double > > geometry)
 
Id id () const
 Get the edge's id.
 
Id source () const
 Get the edge's source node id.
 
Id target () const
 Get the edge's target node id.
 
std::pair< Id, Id > const & nodePair () const
 Get the edge's node pair.
 
std::vector< std::pair< double, double > > const & geometry () const
 
int capacity () const
 Get the edge's capacity, in number of agents.
 
double 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 target nodes.
 
double deltaAngle (double const previousEdgeAngle) const
 
- Public Member Functions inherited from dsm::Counter
void setCode (Id const code)
 
void increaseInputCounter ()
 Increase the input counter by one.
 
void increaseOutputCounter ()
 Increase the output counter by one.
 
Id code () const
 
int inputCounts (bool reset=true)
 Get the number of input counts registered.
 
int outputCounts (bool reset=true)
 Get the number of output counts registered.
 

Additional Inherited Members

- Static Public Member Functions inherited from dsm::Street
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.
 
- Protected Member Functions inherited from dsm::Edge
void m_setAngle (std::pair< double, double > srcNodeCoordinates, std::pair< double, double > dstNodeCoordinates)
 
- Protected Attributes inherited from dsm::Road
double m_length
 
double m_maxSpeed
 
int m_nLanes
 
std::string m_name
 
int m_priority
 
std::set< Id > m_forbiddenTurns
 
- Protected Attributes inherited from dsm::Edge
std::vector< std::pair< double, double > > m_geometry
 
Id m_id
 
std::pair< Id, Id > m_nodePair
 
int m_capacity
 
double m_transportCapacity
 
double m_angle
 
- Protected Attributes inherited from dsm::Counter
Id m_code
 
std::pair< int, int > m_counters = {0, 0}
 
- Static Protected Attributes inherited from dsm::Road
static double m_meanVehicleLength
 

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

Member Function Documentation

◆ addAgent()

void dsm::SpireStreet::addAgent ( std::unique_ptr< Agent > pAgent)
finalvirtual

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::unique_ptr< Agent > dsm::SpireStreet::dequeue ( size_t index)
finalvirtual

Remove an agent from the street's queue.

Returns
Id The id of the agent removed from the street's queue

Reimplemented from dsm::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.

◆ Street()

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::vector< std::pair< double, double > > geometry = {},
std::optional< int > capacity = std::nullopt,
double 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)

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