Implementation of Iterative Learning Control in Matlab/Simulink

조회 수: 17 (최근 30일)
Nitish Katal
Nitish Katal 2013년 1월 23일
댓글: Harsh 2022년 9월 16일
Hey, am working on the development of an Iterative Learning Controller for a simple transfer function (Initially Low Order), Can anyone help in getting started with the implementation of ILC in Simulink using Matlab fucntions.??

답변 (5개)

John Sam
John Sam 2018년 11월 25일
Hi,
Has anyone been able to implement ILC in Matlab?
Can someone please share the code of an example simulation.
Thank you.

Mark Sherstan
Mark Sherstan 2018년 12월 12일
This question is a little outdated but has lots of views so I wanted to provide an answer. Here is an example that should push people in the right direction for an open loop ILC MATLAB function. Changing the function to closed loop only requires providing feedback as with any basic control loop.
Start off with some made up transfer function and sampling time and then convert it into discrete time.
Ts = 0.01;
num = [100];
den = [1 120];
sysc = tf(num,den);
sysd = c2d(sysc,Ts,'ZOH');
I am assuming that the cycle repeats every second and follows the peaks 5 - 2 - 4 - 5 - 0 which are evenly spaced apart. This is my refernce signal. Initial conditions are 0, with no pure time delay, and the relative degree is 1 (which can be confirmed above). Running the function below will create a plot of the error, input and output. As the iteration count grows the input and output are adjusted by the learning matrix L (has a coeffcient of 0.95 in this example) so that error eventually goes to zero after 10 or so itterations. Give it a run and try for yourself!
function [ ] = ILC(sysd,Ts)
% Get state space values for ILC
[Ad Bd Cd Dd] = ssdata(sysd);
% Initial condition x0, time range t - assume 1 second, pure time delay n0, relative
% degree r, and matrix size N
x0 = 0;
t = 0:Ts:1;
n0 = 0;
r = 1;
N = length(t);
% Define input vector U and reference J - Refernce = input for this example
Rj = [5*ones(1,20) 2*ones(1,20) 4*ones(1,20) 5*ones(1,20) 0*ones(1,21)]';
U = Rj;
% G0 not formulated as initial condition is 0
% Formulate G
Gvec = zeros(N,1);
rVec = ((r-1):(N-n0-1))';
for ii = 1:length(rVec)
ApowVec = Ad^rVec(ii);
Gvec(ii) = Cd*ApowVec*Bd;
end
G = tril(toeplitz(Gvec));
% Set up ILC
jmax = 15;
l0 = 0.95; L = l0 * eye(N,N);
q0 = 1.00; Q = q0 * eye(N,N);
Uj = zeros(N,1); Ujold = Uj;
Ej = zeros(N,1); Ejold = Ej;
% Run ILC and plot the response for each iteration
for ii = 1:jmax
Uj = Q*Ujold + L*Ejold;
Yj = G*Uj;
Ej = Rj - Yj; Ej(1) = 0;
Ejold = Ej;
Ujold = Uj;
plotter(ii,t,Ej,Yj,Uj,Rj,U)
end
end
function [] = plotter(ii,t,Ej,Yj,Uj,Rj,U)
figure(1)
% Plot the error Ej of the current itteration
subplot(1,3,1);
plot(t,Ej,'LineWidth',1.5);
title('Error, Ej','FontSize',16);
ylabel('Error Response','FontSize',16);
ylim([-5 5])
% Plot the input Uj of the current itteration
subplot(1,3,2);
plot(t,Uj,t,U,'-k','LineWidth',1.5);
title({['Iteration: ', num2str(ii)],'Input, Uj'},'FontSize',16);
xlabel('Time (s)','FontSize',16);
ylabel('Input Response','FontSize',16);
ylim([0 7])
% Plot the output Yj of the current itteration
subplot(1,3,3);
plot(t,Yj,t,Rj,'-k','LineWidth',1.5);
title('Output, Yj','FontSize',16);
ylabel('Output Response','FontSize',16);
ylim([0 7])
pause(0.5);
end
  댓글 수: 2
mazin alseadi
mazin alseadi 2020년 11월 3일
Dear Mr. Mark Sherstan
Please could you kindly send me this codes as a m files , and if you developed it then I will be more thankful !
With respect and appreciate
Harsh
Harsh 2022년 9월 16일
Thanks @Mark Sherstan. Exactly what I needed to start with learning (pun intended) ILC

댓글을 달려면 로그인하십시오.


Rachmad Setiawan
Rachmad Setiawan 2015년 1월 28일
I want to make an ILC software in Delphi. But I want to make simulation with simulink first. I don't know what I have to do ? Would you mind giving me an explanation

Kim MinSung
Kim MinSung 2019년 4월 14일
May I have a question?
What is a reference about the code mentioned above?
If you answer the reference, it could be more helpful information.

George Bujgoi
George Bujgoi 2020년 9월 29일
no

카테고리

Help CenterFile Exchange에서 Automotive Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by