Introduction
Car is an object defined in car_model.py that consumes a self, m, Crr, CdA, max_force, speed_min_ms, speed_max_ms
//fix later
To know:
...
...
Dataframe values
With a Car object, we can generate the following:
The force required for the car to accelerate to a certain velocity , using the
force_req()
methodThe maximum velocity of the car at a certain point in the elevation map, using the
max_velocity()
methodThe energy used by the car to move through the course with the given elevation map and velocity profile , using the
energy_used()
method
The object initialization
Initializing the object requires 7 parameters,
self
:6 parameters (excluding self
)
m
: Mass of the car, defaulted to 720kg
Crr
: Rolling resistance coefficient of the car, defaulted to 0.0015
CdA
: Drag coefficient of the car, defaulted to 0.15
max_force
: Max force of the car’s motors, defaulted to 100N
speed_min_ms
: Minimum speed to travel, defaulted to 15m/s
speed_max_ms
:
...
Minimum speed to travel, defaulted to 45m/s
All values instance variables to be used in functions below, as well as
Code Block |
---|
g = 9.81 # Acceleration due to gravity in m/s^2
rho = 1.225 # Density of air at room temperature |
as static variable constants.
Functions
The force_req()
...
Creates a Car object.
...
function
Parameters
v
: (Numbers) final velocity of the car to accelerate to, (m/s)vwind
: (Numbers) velocity of the wind relative to the car, (m/s)v_old
: (Numbers) initial velocity of the car, (m/s)theta
: (Numbers) angle that must be climbed (radians) personally don’t understand why “climb” matters and not just angle of elevationtimestep
: (Numbers) Time between measurements, (s)usually calculated
dist / ((v + old_v)/2)
,dist
being the distance between two points in elevation profile,e_profile
. v
Returns
Fmotor
: (Numbers) Force of motors required to achieve the movement specified by the parameter (N)
Calculations
Code Block |
---|
Fa = self.m * (v - v_old) / timestep
Fmotor = Fa + Ffric + Fdrag + Fg |
mass of car * change in velocity
The max_velocity()
...
function
Consumes a string, filename
, and saves a csv of the interpolated route as <filename>.csv
in current directory
The energy_used()
...
function
Consumes a string, filename
, and saves a csv of the interpolated route as <filename>.csv
in current directory
...