Autopysta
Loading...
Searching...
No Matches
simulation.h
Go to the documentation of this file.
1
14#ifndef SIMULATION_H
15#define SIMULATION_H
16
17// class creator; Should this be here? Why?
18
19#include <iostream>
20#include <vector>
21#include <list>
22#include <typeinfo>
23#include "point.h"
24#include "trajectory.h"
25#include "params.h"
26#include "model.h"
27#include "vehicle.h"
28#include "creator.h"
30#include "geometry.h"
31#include "clock.h"
32#include "misc.h"
33#include "results.h"
34#include <string.h>
35#include "Exception.h"
36#include "random_generator.h"
37
38using namespace std;
39using namespace Geometry;
40
49private:
50 lcm* _lcm;
51 double T;
52 geometry* highway_geometry;
53 vector<creator*> ccss;
54 int timestep = 0;
55 int total_steps;
56 int n_external_vehs = 0;
57 vector<vehicle*> all;
58 vector<list<road_object*>*> porpistas;
59 int ncreators;
60 int nxpistas;
61 fixed_object* merge_end;
62 bool initialized = false;
63
72 void append_vehicle(road_object* new_vehicle);
73
83 void append_vehicles(vector<vehicle*> vehicles, int lane);
84
92 void insert_vehicle(road_object* v);
93
104 int get_current(vector<list<road_object*>::iterator>, vector<list<road_object*>::iterator>);
105
112 void initial_state();
113
122 void overwrite_constructors(vector<creator*> creators);
123
124public:
134 simulation(lcm* d, double T, geometry* g, creator* c, double _dt);
135
146 simulation(lcm* d, double T, geometry* g, vector<creator*> creators, vehicle* veh, double dt);
147
158 simulation(lcm* d, double T, geometry* g, vector<creator*> creators, vector<vehicle*> vehs, double dt);
159
169
176};
177
178#endif
Represents the geometry of a highway segment in the simulation.
Definition geometry.h:25
Base class for generating vehicles in a traffic simulation.
Definition creator.h:33
Class representing a fixed object on the road.
Definition vehicle.h:209
Abstract class for lane-changing models.
Definition model.h:129
The results class manages and processes simulation results.
Definition results.h:25
Abstract base class representing any object on the road.
Definition vehicle.h:29
The simulation class manages a traffic simulation over time.
Definition simulation.h:48
simulation(lcm *d, double T, geometry *g, creator *c, double _dt)
Constructs a simulation with a common creator for all lanes.
results * run()
Runs the simulation.
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.
~simulation()
Destructor for the simulation.
Class representing a moving vehicle on the road.
Definition vehicle.h:67
File for the clock class definition (short description).
Defines the creator class for generating vehicles in traffic simulations.
Defines the fixed_demand_creator class for generating vehicles at a fixed rate.
Defines the geometry class for managing highway segment properties.
Header file containing miscellaneous utility functions and classes.
File for the model and lcm classes definitions (short description).
File for the params and params_cust classes definitions (short description).
File for the point class definition.
Provides utilities for generating random numbers using various probability distributions.
Defines the results and Box classes for managing simulation results.
Contains definitions for the generalized_trajectory, static_trajectory, and trajectory classes.
Defines the road_object, vehicle, and fixed_object classes used to represent objects on the road.