Autopysta
Loading...
Searching...
No Matches
simulation Class Reference

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.
 
resultsrun ()
 Runs the simulation.
 
 ~simulation ()
 Destructor for the simulation.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ simulation() [1/3]

simulation::simulation ( lcm * d,
double T,
geometry * g,
creator * c,
double _dt )

Constructs a simulation with a common creator for all lanes.

Parameters
dLane-changing model.
TTotal simulation time.
gHighway geometry.
cVehicle creator for all lanes.
dtTime step for the simulation.

◆ simulation() [2/3]

simulation::simulation ( lcm * d,
double T,
geometry * g,
vector< creator * > creators,
vehicle * veh,
double dt )

Constructs a simulation with specific creators for each lane.

Parameters
dLane-changing model.
TTotal simulation time.
gHighway geometry.
creatorsA list of vehicle creators for each lane.
vehA specific vehicle to insert into the simulation.
dtTime step for the simulation.

◆ simulation() [3/3]

simulation::simulation ( lcm * d,
double T,
geometry * g,
vector< creator * > creators,
vector< vehicle * > vehs,
double dt )

Constructs a simulation with specific creators and vehicles.

Parameters
dLane-changing model.
TTotal simulation time.
gHighway geometry.
creatorsA list of vehicle creators for each lane.
vehsA list of pre-existing vehicles to insert into the simulation.
dtTime step for the simulation.

◆ ~simulation()

simulation::~simulation ( )

Destructor for the simulation.

Cleans up all dynamically allocated memory used by the simulation.

Member Function Documentation

◆ run()

results * simulation::run ( )

Runs the simulation.

This method runs the simulation, advancing the simulation state step by step until completion.

Returns
A pointer to a results object containing the simulation results.

The documentation for this class was generated from the following file: