Brake Torque Calculator V2
This MATLAB code calculates the theoretical braking torque required to decelerate the car at a given target deceleration and angle of incline.
MATLAB Code:
%% NEED TO INSTALL MATLAB'S SYMBOLIC MATH TOOLBOX FOR THIS TO WORK
% clears the console
clc;
% knowns
g = 9.81; % gravity, m/s^2
a_target = 4.91; % target deceleration, m/s^2, + or - (doesn't matter)
m_c = 220; % chassis mass, kg
m_f = 20; % front wheel mass, kg
m_r = 45; % rear wheel mass, kg
a = 1.14; % hor. dist. from CoG to front axle
b = 0.76; % hor. dist. from CoG to rear axle
h = 0.475; % ver. dist. from wheel base to CoG
r_r = 0.5584; % rear wheel radius
r_f = 0.5584; % front wheel radius
I_r = 100773510.65 / (1000^3); % rear wheel polar moment of inertia
I_f = 104637711.6 / (1000^3); % front wheel polar moment of inertia
mu = 0.7; % coefficient of friction, tires to dry pavement
theta_deg = 5; % angle of incline (degrees)
theta_rad = theta_deg * pi()/180;
% equation variables that will be solved for
syms F_fc_x...
F_fc_y...
F_rc_x...
F_rc_y...
F_f_f...
F_f_r...
F_N_f...
F_N_r...
T
% rear wheel eqns
eqn1 = -m_r .* abs(a_target) == F_rc_x - F_f_r + (m_r .* g .* sin(theta_rad));
eqn2 = m_r .* g .* cos(theta_rad) == F_N_r + F_rc_y;
eqn3 = -(F_f_r .* r_r) == (I_r .* abs(a_target)) ./ r_r;
% front wheel eqns
eqn4 = -m_f .* abs(a_target) == -F_fc_x - F_f_f + (m_f .* g .* sin(theta_rad));
eqn5 = m_f .* g .* cos(theta_rad) == F_N_f - F_fc_y;
eqn6 = I_f .* abs(a_target) == -(F_f_f .* r_f) + T;
% chassis eqns
eqn7 = -m_c .* abs(a_target) == F_fc_x - F_rc_x + (m_c .* g .* sin(theta_rad));
eqn8 = m_c .* g .* cos(theta_rad) == F_fc_y - F_rc_y;
eqn9 = (F_fc_y .* a) + (F_rc_y .* b) + (F_fc_x .* h) - (F_rc_x .* h) == 0;
% eqn9 = m_c .* abs(a_target) .* h == -(m_c .* g .* b) + (F_fc_y .* (a + b));
% NOTE: can use either equation for eqn9, only difference is where the sum
% of moments is taken about - no impact on solution
% matrix for eqns in system
eqns = [eqn1; eqn2; eqn3; eqn4; eqn5; eqn6; eqn7; eqn8; eqn9];
% matrix for system variables
vars = [F_fc_x; F_fc_y; F_rc_x; F_rc_y; F_f_f; F_f_r; F_N_f; F_N_r; T];
% converts to a proper 'Ax = B' matrix (necessary for solving this way)
[M,V] = equationsToMatrix(eqns,vars);
% solves the matrix and returns a vector named X that holds the solved
% variables
X = linsolve(M,V);
% prints each value (each is stored as an element in X) to the console
fprintf("F_fc_x: %.2f N\n", X(1));
fprintf("F_fc_y: %.2f N\n", X(2));
fprintf("F_rc_x: %.2f N\n", X(3));
fprintf("F_rc_y: %.2f N\n", X(4));
fprintf("F_f_f: %.2f N\n", X(5));
fprintf("F_f_r: %.2f N\n", X(6));
fprintf("F_N_f: %.2f N\n", X(7));
fprintf("F_N_r: %.2f N\n", X(8));
fprintf("T: %.2f Nm\n", X(9));
fprintf("F_f_f_max: %.2f\n", mu*X(7));
fprintf("F_f_r_max: %.2f\n", mu*X(8));
See the below PDF for the FBDs and equations that were used to develop the above code.