-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathsim_fiction_compensation.m
More file actions
24 lines (18 loc) · 922 Bytes
/
sim_fiction_compensation.m
File metadata and controls
24 lines (18 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function xdot = sim_fiction_compensation(~, q, M, Fs, Fc, sigma_0, sigma_1, sigma_2, vs, xd,Kp,Ki,Kv,k)
e = q(1) - xd;
% Estimator
% In reality, Fc, Fs, sigma_0, sigma_1 and sigma_2 will not be known
% exactly, thus, their values will be different with Table I. However,
% here we use similar values as in Table I
zdot_tilde = q(2) - ( (q(5)*abs(q(2))*sigma_0) / (Fc+(Fs-Fc)*exp(-(q(2)/vs)^2)) ) -k*e;
F_tilde = sigma_0*q(5) + sigma_1 * zdot_tilde + sigma_2*q(2);
u = -Kv*q(2)-Kp*e-Ki*q(4) + F_tilde; % the input here is a step function, second derivative of xd is zero
zdot = q(2) - ( (q(3)*abs(q(2))*sigma_0) / (Fc+(Fs-Fc)*exp(-(q(2)/vs)^2)) );
F = sigma_0*q(3) + sigma_1 * zdot + sigma_2*q(2);
qdot_1 = q(2);
qdot_2 = (u - F) / M;
qdot_3 = zdot;
qdot_4 = e;
qdot_5 = zdot_tilde;
xdot = [qdot_1 ; qdot_2; qdot_3; qdot_4; qdot_5];
end