|
Autopysta
|
A simple car-following model with a predefined trajectory. More...
#include <example_car.h>
Public Member Functions | |
| example_car (std::vector< point * > t) | |
Constructor for the example_car model. | |
| double | accel (point *leader, point *follower, params *q) override |
| Computes the acceleration of the follower vehicle. | |
| double | equil_spcg (double vl, double vf, params *q) override |
| Computes the equilibrium spacing between vehicles. | |
| double | wave_speed (point *leader, point *follower, params *q) override |
| Computes the wave speed of a traffic disturbance. | |
| double | free_flow_speed (params *q) override |
| Returns the free-flow speed of the model. | |
| point * | new_point (generalized_trajectory *leader, trajectory *follower, params *p=(params *) nullptr) override |
| Retrieves the next point in the predefined trajectory. | |
Public Member Functions inherited from model | |
| virtual void | validate_parameters (params *p=nullptr) |
| Validate the model parameters. | |
| virtual point * | new_point (point *leader, point *follower, params *p=nullptr) |
| Compute the next point for a vehicle. | |
Additional Inherited Members | |
Public Attributes inherited from model | |
| params * | pars |
| Parameters for the car-following model. | |
Protected Member Functions inherited from model | |
A simple car-following model with a predefined trajectory.
The example_car class models vehicle behavior based on a predefined trajectory of points. This class demonstrates basic car-following dynamics by returning points sequentially from its trajectory.
| example_car::example_car | ( | std::vector< point * > | t | ) |
Constructor for the example_car model.
Initializes the car with a predefined trajectory of points.
| t | A vector of points representing the trajectory of the vehicle over time. |
Computes the acceleration of the follower vehicle.
This function returns a default value of 0 for acceleration, as the model does not implement dynamic acceleration behavior. It simply follows the predefined trajectory.
| leader | A pointer to the leader vehicle's current point (can be nullptr if no leader). |
| follower | A pointer to the follower vehicle's current point. |
| q | Model-specific parameters. |
0. Implements model.
|
overridevirtual |
Computes the equilibrium spacing between vehicles.
This function returns 0, as the equilibrium spacing is not dynamically calculated in this model.
| vl | The velocity of the leader vehicle. |
| vf | The velocity of the follower vehicle. |
| q | Model-specific parameters. |
0. Implements model.
|
overridevirtual |
Returns the free-flow speed of the model.
The method returns 0 for free-flow speed in this example model.
| q | Model-specific parameters. |
0. Implements model.
|
overridevirtual |
Retrieves the next point in the predefined trajectory.
This method returns the next point in the predefined trajectory, removing it from the queue. It does not compute new positions or velocities.
| leader | A pointer to the leader vehicle's trajectory (can be nullptr if no leader). |
| follower | A pointer to the follower vehicle's trajectory. |
| p | Model-specific parameters (optional). |
Reimplemented from model.
Computes the wave speed of a traffic disturbance.
This method returns 0, as wave speed calculation is not implemented in this example model.
| leader | A pointer to the leader vehicle's point. |
| follower | A pointer to the follower vehicle's point. |
| q | Model-specific parameters. |
0. Implements model.