Traffic Flow Dynamics Model
|
#include <Street.hpp>
Public Member Functions | |
Street (int, int, double, int) | |
Create a new Street object. More... | |
int | getOrigin () const noexcept |
Get the origin node index. More... | |
int | getDestination () const noexcept |
Get the destination node index. More... | |
int | getIndex () const noexcept |
Get the index of the street. More... | |
double | getLength () const noexcept |
Get the length of the street. More... | |
bool | isFull () const noexcept |
Tells if the street is full. More... | |
void | setNLanes (int) |
Set the number of lanes. More... | |
int | getNLanes () const noexcept |
int | getNVehicles () const noexcept |
Get the number of vehicles on the street. More... | |
void | setVMax (double) |
Set the maximum velocity. More... | |
double | getInputVelocity () const noexcept |
get instant input velocity for the street More... | |
double | getVMax () const noexcept |
Get the maximum velocity. More... | |
double | getDensity () const noexcept |
get instant density for the street (in percentage) More... | |
double | getVehicleDensity () const noexcept |
get instant vehicle density for the stree More... | |
void | addVehicle (std::shared_ptr< Vehicle >) |
add a vehicle to the street More... | |
void | remVehicle () |
remove a vehicle from the street More... | |
Street class.
This class is used to represent a street. It contains the source and destination nodes, the length, the maximum capacity, the number of vehicles on the street, the number of lanes, the maximum velocity and the index of the street.
Street::Street | ( | int | src, |
int | dst, | ||
double | length, | ||
int | index | ||
) |
Create a new Street object.
src | The source node. |
dst | The destination node. |
length | The length of the street. |
index | The index of the street. |
std::invalid_argument | If at least one of the parameters is negative. |
void Street::addVehicle | ( | std::shared_ptr< Vehicle > | vehicle | ) |
add a vehicle to the street
Add a vehicle to the street. Adds a vehicle to the street and changes the vehicle's parameters.
vehicle | The vehicle to add. |
|
noexcept |
get instant density for the street (in percentage)
Get the density of the street.
|
noexcept |
Get the destination node index.
|
noexcept |
Get the index of the street.
|
noexcept |
get instant input velocity for the street
Get the input velocity.
Get the entering velocity of a new vehicle based on the instant vehicle density of this street. The used formula is \(v(t) = v_{max}\left( 1 - k\frac{\rho(t)}{\rho_{max}} \right)\)
|
noexcept |
Get the length of the street.
|
noexcept |
Get the number of vehicles on the street.
|
noexcept |
Get the origin node index.
|
noexcept |
get instant vehicle density for the stree
Get the vehicle density of the street.
|
noexcept |
Get the maximum velocity.
|
noexcept |
Tells if the street is full.
void Street::remVehicle | ( | ) |
remove a vehicle from the street
Remove a vehicle from the street. Removes a vehicle from the street and changes the vehicle's parameters.
std::runtime_error | If the number of vehicles is negative. |
void Street::setNLanes | ( | int | n | ) |
Set the number of lanes.
nLanes | The number of lanes. |
std::invalid_argument | If the number of lanes is not positive. |
void Street::setVMax | ( | double | v | ) |
Set the maximum velocity.
vMax | The maximum velocity. |
std::invalid_argument | If the maximum velocity is negative. |