Autopysta
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1
13#ifndef MODEL_H
14#define MODEL_H
15
16#define PICK(x,y) (((x)==nullptr)?(y):(x))
17
18#include "point.h"
19#include "trajectory.h"
20#include "params.h"
21#include "clock.h"
22#include "Exception.h"
23
30class model {
31protected:
44 virtual double accel(point* leader, point* follower, params* p) = 0;
45
46public:
48
57 virtual void validate_parameters(params* p = nullptr);
58
70 virtual double equil_spcg(double vl, double vf, params* p = nullptr) = 0;
71
83 virtual double wave_speed(point* leader, point* follower, params *p) = 0;
84
94 virtual double free_flow_speed(params* p = nullptr) = 0;
95
107 virtual point* new_point(point* leader, point* follower, params* p = nullptr);
108
120 virtual point* new_point(generalized_trajectory* leader, trajectory* follower, params* p = nullptr);
121};
122
129class lcm {
130protected:
133
148 virtual bool is_lch_possible(point* leader, point* follower, point* new_leader, point* new_follower, model* cfpars, params* lcmpars) = 0;
149
150public:
165 virtual bool lch_left(point* leader, point* follower, point* new_leader, point* new_follower, model* cfpars = nullptr, params* lcmpars = nullptr) = 0;
166
181 virtual bool lch_right(point* leader, point* follower, point* new_leader, point* new_follower, model* cfpars = nullptr, params* lcmpars = nullptr) = 0;
182};
183
184#endif
185
Base class for different types of trajectories.
Definition trajectory.h:26
Abstract class for lane-changing models.
Definition model.h:129
virtual bool lch_left(point *leader, point *follower, point *new_leader, point *new_follower, model *cfpars=nullptr, params *lcmpars=nullptr)=0
Determine if the vehicle should change lanes to the left.
model * _cf
Car-following model used in conjunction with lane-changing decisions.
Definition model.h:131
params * _lcpars
Lane-changing model parameters.
Definition model.h:132
virtual bool is_lch_possible(point *leader, point *follower, point *new_leader, point *new_follower, model *cfpars, params *lcmpars)=0
Check if a lane change is possible.
virtual bool lch_right(point *leader, point *follower, point *new_leader, point *new_follower, model *cfpars=nullptr, params *lcmpars=nullptr)=0
Determine if the vehicle should change lanes to the right.
Abstract car-following model class.
Definition model.h:30
virtual point * new_point(point *leader, point *follower, params *p=nullptr)
Compute the next point for a vehicle.
params * pars
Parameters for the car-following model.
Definition model.h:47
virtual double free_flow_speed(params *p=nullptr)=0
Get the free-flow speed of the model.
virtual void validate_parameters(params *p=nullptr)
Validate the model parameters.
virtual double wave_speed(point *leader, point *follower, params *p)=0
Compute the wave speed of a traffic flow disturbance.
virtual point * new_point(generalized_trajectory *leader, trajectory *follower, params *p=nullptr)
Compute the next point for a vehicle using trajectories.
virtual double equil_spcg(double vl, double vf, params *p=nullptr)=0
Compute the equilibrium spacing between vehicles.
virtual double accel(point *leader, point *follower, params *p)=0
Compute a vehicle's acceleration based on its leader.
Base class for car-following model parameters.
Definition params.h:24
Represents a point in time for a vehicle in a traffic simulation.
Definition point.h:23
Represents a dynamic trajectory of a moving object.
Definition trajectory.h:59
File for the clock class definition (short description).
File for the params and params_cust classes definitions (short description).
File for the point class definition.
Contains definitions for the generalized_trajectory, static_trajectory, and trajectory classes.