Closed-loop system identification
7 views (last 30 days)
Show older comments
Husni Rois Ali
on 16 Aug 2018
Commented: Husni Rois Ali
on 18 Aug 2018

Hi All
Just curious if anyone has any experience on this. Supposed I have a system which is perturbed through "disturbance", normally a random signal, and I can measure u and y. Is it theoretically possible to identify G1(s) or other equivalent model (linear or nonlinear)? what should I do?
I have tried several methods available in system identification toolbox and consider directly u and y as if it is from an open-loop system, but so far the results are not good. Just think that it may have something to do with the fact that the system operates in feedback (?)
Any help is appreciated
Thanks you
0 Comments
Accepted Answer
Aquatris
on 16 Aug 2018
Assuming you can add excitation signal to u, and with large enough excitation signal magnitude, you can identify G1 without knowing G2. Here is how (assuming SISO but can be extended to MIMO);
You design an excitation signal e (sine sweep or PRBS) and add it to u. The transfer function from e to u and e to y is;
u(s)/e(s) = 1/(1+G1(s)*G2(s)) = H(s)
y(s)/e(s) = G1(s)/(1+G1(s)*G2(s)) = T(s)
Frequency response data for these two transfer functions, H(s) and T(s) can be calculated using Fourier transform of the signals since they are measured. From here you can simply do;
G1(s) = T(s)/H(s)
This would give you an FRD. Then, you can fit a model to the FRD.
This process requires careful selection of the excitation signal to allow necessary inversions. Also e(s) should be designed such that the system response is dominated by e(s) not the disturbance.
Here is an example code. G1 is a spring-mass system. G2 is PID controller. There are no disturbances or noise in measurements in the code, but you can add and play around to see their effects.
% mass-spring parameters
k = 10; % [N/m]
m = 2; % [kg]
% system equation of motion
% xd = Ax + Bu
% y = Cx + Du
A = [0 1;
-k/m 0];
B = [0
1/m];
C = [1 0];
D = 0;
G1 = ss(A,B,C,D); % marginally stable open loop
% input is force, output is position
% controller
Kp = 10; Ki = 8; Kd = 5; % parameters to be tuned
s = tf('s');
G2 = Kp + Ki/s + Kd*s;
% closed loop systems
H = feedback(1,G1*G2); % output for u
T = feedback(G1,G2); % output for y
% define time
dt = 0.001;
t = 0:dt:15-dt;
L = length(t);
f = 1/dt*(0:(L/2))/L; % frequency for fft
% impulse excitation signal design
e = zeros(length(t),1);
e(11:15) = 1;
% fft of excitation signal
Y = fft(e);
P2 = (Y/L);
P1 = P2(1:L/2+1,:);
P1(2:end-1,:) = 2*P1(2:end-1,:);
P1_input = P1;
% simulate response of the system
[u,t2] = lsim(H,e,t) ; % u measurement
[y,t2] = lsim(T,e,t) ; % y measurement
% fft of y signal
Y = fft(y);
P2 = (Y/L);
P1 = P2(1:L/2+1,:);
P1(2:end-1,:) = 2*P1(2:end-1,:);
P1_y = P1;
T_frd = P1_y./P1_input; % FRD of T
% fft of u signal
Y = fft(u);
P2 = (Y/L);
P1 = P2(1:L/2+1,:);
P1(2:end-1,:) = 2*P1(2:end-1,:);
P1_u = P1;
H_frd = P1_u./P1_input; % FRD of H
% calcualte FRD for G1
G1_frd = T_frd./H_frd;
%compare real system to calcualted FRD
[mag,phase] = bode(G1,f*2*pi);
loglog(f,squeeze(mag),f ,abs(G1_frd),'r--')
xlabel('frequency [Hz]')
ylabel('Magnitude [abs]')
3 Comments
More Answers (0)
See Also
Categories
Find more on Transform Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!