|
Autopysta
|
The simulation class manages a traffic simulation over time.
More...
#include <simulation.h>
Public Member Functions | |
| simulation (lcm *d, double T, geometry *g, creator *c, double _dt) | |
| Constructs a simulation with a common creator for all lanes. | |
| simulation (lcm *d, double T, geometry *g, vector< creator * > creators, vehicle *veh, double dt) | |
| Constructs a simulation with specific creators for each lane. | |
| simulation (lcm *d, double T, geometry *g, vector< creator * > creators, vector< vehicle * > vehs, double dt) | |
| Constructs a simulation with specific creators and vehicles. | |
| results * | run () |
| Runs the simulation. | |
| ~simulation () | |
| Destructor for the simulation. | |
The simulation class manages a traffic simulation over time.
This class controls the creation of vehicles, their movement, lane changes, and interactions on a highway-like scenario. It updates vehicle states in discrete time steps.
Constructs a simulation with a common creator for all lanes.
| d | Lane-changing model. |
| T | Total simulation time. |
| g | Highway geometry. |
| c | Vehicle creator for all lanes. |
| dt | Time step for the simulation. |
| simulation::simulation | ( | lcm * | d, |
| double | T, | ||
| geometry * | g, | ||
| vector< creator * > | creators, | ||
| vehicle * | veh, | ||
| double | dt ) |
Constructs a simulation with specific creators for each lane.
| d | Lane-changing model. |
| T | Total simulation time. |
| g | Highway geometry. |
| creators | A list of vehicle creators for each lane. |
| veh | A specific vehicle to insert into the simulation. |
| dt | Time step for the simulation. |
| simulation::simulation | ( | lcm * | d, |
| double | T, | ||
| geometry * | g, | ||
| vector< creator * > | creators, | ||
| vector< vehicle * > | vehs, | ||
| double | dt ) |
Constructs a simulation with specific creators and vehicles.
| d | Lane-changing model. |
| T | Total simulation time. |
| g | Highway geometry. |
| creators | A list of vehicle creators for each lane. |
| vehs | A list of pre-existing vehicles to insert into the simulation. |
| dt | Time step for the simulation. |
| simulation::~simulation | ( | ) |
Destructor for the simulation.
Cleans up all dynamically allocated memory used by the simulation.
| results * simulation::run | ( | ) |
Runs the simulation.
This method runs the simulation, advancing the simulation state step by step until completion.
results object containing the simulation results.