I need to capture time taken by vehicle when velocity comes to zero after braking application by using following script.

2 次查看(过去 30 天)

I need to capture time taken by vehicle when velocity comes to zero after braking application by using following script.
clc
clear

l = 2.5; % wheelbase
ldis = 0.55; % lr/l
lr = ldis*l; % CG distance from the rear axle
lf = l - lr; % CG distance from the front axle
h = 0.55; % CG height of the total vehicle
rw = 0.3; % radius of the wheel
tw = 3; % radius to width ratio of the wheels
Mb = 960; % unsprung mass
Mwr = 20; % mass of rear axle
Mwf = 20; % mass of front axle
M = Mb + (Mwr + Mwf); % total vehicle mass
hb = (M*h - (Mwr + Mwf)*rw)/Mb - rw; % CG height of the vehicle body above the wheel centerw
Iwr = 0.5*Mwr*rw^2; % Moment of Inertia of rear axle
Iwf = 0.5*Mwf*rw^2; % Moment of Inertia of front axle
g = 9.81; % acceleration due to gravity
I = Iwr;

t_in = 1; % Step time
T_in = -306; % Final Value
t_brake = 36; % Step time

mu = 0.3; % coefficient of static friction

Kf_opt = [lr + l*I/(M*rw^2) + mu*(h - 2*I/(M*rw))]/[l*(1 + 2*I/(M*rw^2))];
Kf_app = 0.3;
accRearslip = mu*lf*g./[l*(1 - Kf_app) + mu*h + (I/(M*rw^2))*(l*(1 - 2*Kf_app) - 2*mu*rw)];
accFrontslip = mu*lr*g./[l*Kf_app - mu*h + (I/(M*rw^2))*(l*(2*Kf_app-1) - 2*mu*rw)];
acc_slip = min(abs(accRearslip), abs(accFrontslip));
T_opt = (M*rw^2 + 2*I)*acc_slip/rw;

T_app = 300;

if Kf_app > Kf_opt
T_sat = mu*g*[(rw*M)*(lf/l) + I/rw + mu*M*rw*(rw - h)/l]/[(1 - Kf_app + mu*(rw/l))];
if T_app <= T_opt
acc = rw*T_app/(M*rw^2 + 2*I);
alpha_f = acc/rw;
alpha_r = acc/rw;
Nf = (1/l)*(M*g*lr + M*acc*h + 2*I*acc/rw);
Nr = (1/l)*(M*g*lf - M*acc*h - 2*I*acc/rw);
Ff = (1/rw)*(Kf_app*T_app - I*acc/rw);
Fr = (1/rw)*((1-Kf_app)*T_app - I*acc/rw);

else if T_app <= abs(T_sat)
acc = [(mu*rw*M*g)*(lr/l) + T_app*(1 - Kf_app - mu*rw/l)]/[rw*M + I/rw + mu*M*rw*(h - rw)/l]; %may change

alpha_f = [T_app - (M*rw + (I/rw))*acc]/I;
alpha_r = acc/rw;
Nf = (1/l)*(M*g*lr + M*acc*h + I*alpha_f + I*acc/rw);
Nr = (1/l)*(M*g*lf - M*acc*h - I*alpha_f - I*acc/rw);
Ff = mu*Nf;
Fr = acc*M - Ff;
else
acc = mu*g;
A = [I*(1 - mu*rw/l), -mu*rw*I/l; mu*rw*I/l, I*(1 + mu*rw/l)];
alpha = inv(A)*[mu*rw*M*(acc*h/l - g*lr/l) + Kf_app*T_app; (1 - Kf_app)*T_app - mu*rw*M*(acc*h/l + g*lf/l)]; %may change
alpha_f = alpha(1,1);
alpha_r = alpha(2,1);
Nf = (1/l)*(M*g*lr + M*acc*h + I*alpha_f + I*alpha_r);
Nr = (1/l)*(M*g*lf - M*acc*h - I*alpha_f - I*alpha_r);
Ff = mu*Nf;
Fr = mu*Nr
end
end
else

T_sat = mu*g*[(rw*M)*(lr/l) + I/rw - mu*M*rw*(rw - h)/l]/[Kf_app - mu*(rw/l)];
if T_app <= T_opt
acc = rw*T_app/(M*rw^2 + 2*I);
alpha_f = acc/rw;
alpha_r = acc/rw;
Nf = (1/l)*(M*g*lr + M*acc*h + 2*I*acc/rw);
Nr = (1/l)*(M*g*lf - M*acc*h - 2*I*acc/rw);
Ff = (1/rw)*(Kf_app*T_app - I*acc/rw);
Fr = (1/rw)*((1-Kf_app)*T_app - I*acc/rw);
else if T_app <= abs(T_sat)
acc = [T_app*(Kf_app + mu*rw/l) + (mu*rw*M*g)*(lf/l)]/[rw*M + I/rw - mu*M*rw*(h - rw)/l]; %may change
alpha_f = acc/rw;
alpha_r = [T_app - (M*rw + (I/rw))*acc]/I;
Nf = (1/l)*(M*g*lr + M*acc*h + I*acc/rw + I*alpha_r);
Nr = (1/l)*(M*g*lf - M*acc*h - I*acc/rw - I*alpha_r);
Fr = mu*Nr;
Ff = acc*M - Fr;
else
acc = mu*g;
A = [I*(1 - mu*rw/l), -mu*rw*I/l; mu*rw*I/l, I*(1 + mu*rw/l)];
alpha = inv(A)*[mu*rw*M*(acc*h/l - g*lr/l) + Kf_app*T_app; (1 - Kf_app)*T_app - mu*rw*M*(acc*h/l + g*lf/l)]; %may change
alpha_f = alpha(1,1);
alpha_r = alpha(2,1);
Nf = (1/l)*(M*g*lr + M*acc*h + I*alpha_f + I*alpha_r);
Nr = (1/l)*(M*g*lf - M*acc*h - I*alpha_f - I*alpha_r);
Ff = mu*Nf;
Fr = mu*Nr;
end
end
end

slip_f = (rw*alpha_f - acc)/(rw*alpha_f);
slip_r = (rw*alpha_r - acc)/(rw*alpha_r);

回答(1 个)

Zinea
Zinea 2024-10-1
Hi @UDAY,
To capture the time taken for a vehicle to come to a complete stop after the application of brakes, the dynamics of the vehicle under braking conditions needs to be simulated. The script provided by you calculates various parameters related to braking, but it does not explicitly simulate the vehicle’s velocity over time or calculate the stopping time.
The following lines may be added in the script after the initialization of variables to simulate the vehicle’s deceleration and calculate the time taken to stop:
% Initial conditions
v_initial = 20; % initial velocity in m/s
v = v_initial; % velocity of the vehicle
time = 0; % time in seconds
dt = 0.01; % time step in seconds
% Calculate optimal braking parameters
Kf_opt = (lr + l * I / (M * rw^2) + mu * (h - 2 * I / (M * rw))) / (l * (1 + 2 * I / (M * rw^2)));
Kf_app = 0.3;
accRearslip = mu * lf * g / (l * (1 - Kf_app) + mu * h + (I / (M * rw^2)) * (l * (1 - 2 * Kf_app) - 2 * mu * rw));
accFrontslip = mu * lr * g / (l * Kf_app - mu * h + (I / (M * rw^2)) * (l * (2 * Kf_app - 1) - 2 * mu * rw));
acc_slip = min(abs(accRearslip), abs(accFrontslip));
T_opt = (M * rw^2 + 2 * I) * acc_slip / rw;
% Determine acceleration due to braking
if T_app <= T_opt
acc = rw * T_app / (M * rw^2 + 2 * I);
else
acc = mu * g; % Maximum braking force
end
% Simulate braking process
while v > 0
v = v - acc * dt; % Update velocity
time = time + dt; % Update time
end
fprintf('Time taken to stop: %.2f seconds\n', time);
Hope this helps resolve the query!

类别

Help CenterFile Exchange 中查找有关 Vehicle Calibration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by