PID for fixed distance
9 次查看(过去 30 天)
显示 更早的评论
Hello everyone, I attach here my model of a car moving towards that must maintain a fixed distance of 100m from the car in front of it. I have drawn all the schemes which seem to be correct. I have a signal reference that must be followed with a constant error, but I'm not able to understand why I have divergence between the reference signal and the actual position of my vehicle, whichever value of the gains I use, from the smallest to the largest.
I really hope someone could help me. Thank you very much!
0 个评论
回答(1 个)
Sam Chak
2022-11-9
I think your control design part is okay. But the divergence issue is probably related to the way you setup the simulation (Error – 100). Thus, I have made a super simple model (ignoring the aerodynamics and frictions) in this example.
The Auto-Cruise Control Car should follow the Reference, which is the trajectory of the "Car-in-front – 100".
% Super Simple Car motion model
J = 1000;
s = tf('s');
Gp = minreal(1/(J*s^2))
% Super Simple PID Controller
Gc = pid(0, 0, 500, 0.5)
Gcl = minreal(feedback(Gc*Gp, 1))
Amp = 50;
Tp = 300; % 1 cycle period
Tf = 300; % final time simulation (5 minutes)
Ts = 0.1; % sampling time interval
[u, t] = gensig('sine', Tp, Tf, Ts); % standard sine wave generation
Car = Amp*u + 150; % Car in front of your vehicle
Ref = Car - 100; % Reference for Auto-Cruise Control Car
y = lsim(Gcl, Ref, t);
plot(t, Car, t, y, 'linewidth', 1.5), grid on, xlabel('t'), ylabel('Position of Vehicles')
legend('Car-in-front', 'Auto-Cruiser', 'location', 'best', 'FontSize', 14)
error = Car - y; % relative distance of Car-in-front ahead of your vehicle
plot(t, error, 'linewidth', 1.5), grid on, xlabel('t, sec'), ylabel('Relative Distance, m')
title('ACC Car attempts to maintain a relative distance of 100 m')
By the way, in your 1st question, have you identified the cause of the problem (fuzzy controller) based on the given advice?
You can update the progress, or close it if your problem solved. Thanks.
3 个评论
Sam Chak
2022-11-9
I'm unsure, but it seems that inside the feedback loop, you keep on injecting "–100" into error (relative distance between Car-in-front and your ACC car).
Try modifying your Simulink model such that the blocks work like these functions:
Car = trajectory; % Car in front of your vehicle
Ref = Car - 100; % Reference for Auto-Cruise Control Car
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!