Dynamical system model
|
The Street class represents a street in the network. More...
#include <Street.hpp>
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 or in , 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. | |
The Street class represents a street in the network.
Id,The | type of the street's id. It must be an unsigned integral type. |
Size,The | type of the street's capacity. It must be an unsigned integral type. |
dsm::Street::Street | ( | Id | id, |
const Street & | street ) |
dsm::Street::Street | ( | Id | id, |
std::pair< Id, Id > | nodePair ) |
Construct a new Street object.
id | The street's id |
nodePair | The street's node pair |
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.
id | The street's id |
capacity | The street's capacity |
len | The street's length |
nodePair | The street's node pair |
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.
id | The street's id |
capacity | The street's capacity |
len | The street's length |
maxSpeed | The street's speed limit |
nodePair | The street's node pair |
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.
id | The street's id |
capacity | The street's capacity |
len | The street's length |
lanes | The street's number of lanes |
maxSpeed | The street's speed limit |
nodePair | The street's node pair |
name | The street's name (default is "") |
|
virtual |
Reimplemented in dsm::SpireStreet.
|
inline |
Get the street's angle.
|
inline |
Get the street's capacity.
double dsm::Street::deltaAngle | ( | double const | previousStreetAngle | ) | const |
Get the delta angle between the street and the previous street, normalized between -pi and pi.
previousStreetAngle | The angle of the previous street |
double dsm::Street::density | ( | bool | normalized = false | ) | const |
Get the street's density in or in , if normalized.
normalized | If true, the street's density is normalized by the street's capacity |
|
virtual |
Remove an agent from the street's queue.
Reimplemented in dsm::SpireStreet.
void dsm::Street::enqueue | ( | Id | agentId, |
size_t | index ) |
Add an agent to the street's queue.
agentId | The id of the agent to add to the street's queue |
std::runtime_error | If the street's queue is full |
|
inline |
Get the street's queues.
|
inline |
Get the street's id.
|
inline |
Check if the street is full.
|
inlinevirtual |
Check if the street is a spire.
Reimplemented in dsm::SpireStreet.
|
inline |
Get the street's length.
|
inline |
Get the street's speed limit.
Size dsm::Street::nAgents | ( | ) | const |
Get the number of agents on the street.
|
inline |
Get the street's name.
Size dsm::Street::nExitingAgents | ( | ) | const |
Get the number of agents on all queues.
|
inline |
Get the street's number of lanes.
|
inline |
Get the street's node pair.
|
inline |
Get the street's queue.
void dsm::Street::setAngle | ( | double | angle | ) |
Set the street's angle.
angle | The street's angle |
std::invalid_argument | If the angle is negative or greater than 2 * pi |
void dsm::Street::setAngle | ( | std::pair< double, double > | srcNode, |
std::pair< double, double > | dstNode ) |
Set the street's angle.
srcNode | The source node of the street |
dstNode | The destination node of the street |
|
inline |
Set the street's capacity.
capacity | The street's capacity |
|
inline |
Set the street's id.
id | The street's id |
void dsm::Street::setLength | ( | double | len | ) |
Set the street's length.
len | The street's length |
std::invalid_argument,If | the length is negative |
void dsm::Street::setMaxSpeed | ( | double | speed | ) |
Set the street's speed limit.
speed | The street's speed limit |
std::invalid_argument,If | the speed is negative |
void dsm::Street::setNLanes | ( | const int16_t | nLanes | ) |
Set the street's number of lanes.
nLanes | The street's number of lanes |
std::invalid_argument | If the number of lanes is 0 |
Set the street's node pair.
node1 | The source node of the street |
node2 | The destination node of the street |
|
inline |
Set the street's node pair.
node1 | The source node of the street |
node2 | The destination node of the street |
|
inline |
Set the street's node pair.
pair | The street's node pair |
|
inline |
Set the street's queue.
queue | The street's queue |
|
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.
capacity | The street's transport capacity |
|
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.
|
inline |
Get the street's waiting agents.