Traffic Flow Dynamics Model
Street.hpp
1 #ifndef STREET_HPP
2 #define STREET_HPP
3 
5 
10 
11 #include "Vehicle.hpp"
12 #include <memory>
13 
14 class Street {
15 private:
16  double _length; // length of the street
17  int _maxCapacity; // maximum capacity of vehicles
18  int _nVehicles; // number of vehicles on the street
19  uint16_t _src; // source node
20  uint16_t _dst; // destination node
21  int _nLanes; // number of lanes
22  double _vMax; // max velocity for that street
23  int _index; // index of the street (it's used to identify the street)
24  static double _avgLength; // average length of a vehicle, if < 0 then there's
25  // no limit on the capacity
26  static double _vMin; // minimum velocity
27 
28 public:
29  Street(int, int, double, int); // src, dst, length, index
30  ~Street() = default;
31 
32  int getOrigin() const noexcept;
33  int getDestination() const noexcept;
34  int getIndex() const noexcept;
35  double getLength() const noexcept;
36  bool isFull() const noexcept;
37  void setNLanes(int);
38  int getNLanes() const noexcept;
39  int getNVehicles() const noexcept;
40  void setVMax(double);
41  double getInputVelocity()
42  const noexcept;
43  double getVMax() const noexcept;
44  double getDensity()
45  const noexcept;
46  double getVehicleDensity()
47  const noexcept;
48  void addVehicle(std::shared_ptr<Vehicle>);
49  void remVehicle();
50 };
51 
52 #endif
Street class.
Definition: Street.hpp:14
void setNLanes(int)
Set the number of lanes.
Definition: Street.cpp:68
double getVehicleDensity() const noexcept
get instant vehicle density for the stree
Definition: Street.cpp:108
void addVehicle(std::shared_ptr< Vehicle >)
add a vehicle to the street
Definition: Street.cpp:114
int getNVehicles() const noexcept
Get the number of vehicles on the street.
Definition: Street.cpp:76
Street(int, int, double, int)
Create a new Street object.
Definition: Street.cpp:15
double getInputVelocity() const noexcept
get instant input velocity for the street
Definition: Street.cpp:94
int getIndex() const noexcept
Get the index of the street.
Definition: Street.cpp:56
double getVMax() const noexcept
Get the maximum velocity.
Definition: Street.cpp:101
bool isFull() const noexcept
Tells if the street is full.
Definition: Street.cpp:62
double getDensity() const noexcept
get instant density for the street (in percentage)
Definition: Street.cpp:103
double getLength() const noexcept
Get the length of the street.
Definition: Street.cpp:59
void setVMax(double)
Set the maximum velocity.
Definition: Street.cpp:80
void remVehicle()
remove a vehicle from the street
Definition: Street.cpp:124
int getOrigin() const noexcept
Get the origin node index.
Definition: Street.cpp:50
int getDestination() const noexcept
Get the destination node index.
Definition: Street.cpp:53