Professional Documents
Culture Documents
LABSHEET 3 - SN PID Controller PDF
LABSHEET 3 - SN PID Controller PDF
LABSHEET 3 - SN PID Controller PDF
A. Teori Singkat
1. Neural PID Control
PID Intelligent Control Based on Single Neuron Network Single Neuron Adaptive Intelligent PID
Controller consists of single neurons with self-learning and self-adaptive ability, not only simple
structure, but it can also adapt to environmental changes and has strong robustness. Dalam single neuron,
there are several typical learning rules, including:
(1) Unsupervised Hebb learning rules
Hebb learning is a kind of related learning. The basic idea is that if two neurons are activated at the
same time, the connection strength between them is enhanced with them. The product of the
excitation is proportional to O, which represents the activation value of neuron i, Oj represents the
activation value of neuron j, and we represents the connection weight of neuron i and neuron j, then
the Hebb learning rule can be expressed as:
Dw ij (k ) = ho j (k )oi (k ) (1)
The activation value, w, represents the connection weight of neuron i and neuron j, then the Hebb
learning rule can be expressed as: Dm /(k)= ho(k)o(k), where h is learning rate.
(2) Supervised Delta learning rules
In the Hebb learning rules, the signal is introduced, that is, O is replaced by the desired output d,
and the difference between the actual output and the actual output constitutes the Delta learning
rule with supervised learning;
rin
x1 Yout
x2 u
PID + PLANT
-
x3 -1
Z
The single neuron adaptive controller is adaptive by adjusting the weighting coefficients. The adjustment
is implemented according to the supervised Hebb learning rules. Control algorithm and learning
algorithm are self-organizing function, weight coefficient
3
u ( k ) = u ( k − 1) + K wi ( k ) xi ( k )
(4)
i =1
3
w i (k ) = w i (k ) / w i (k ) (5)
i =1
w1 ( k ) = w1 ( k − 1) + P z ( k ) u ( k ) x1 ( k )
w2 ( k ) = w2 ( k − 1) + I z ( k ) u ( k ) x2 ( k ) (6)
w3 ( k ) = w3 ( k − 1) + D z ( k ) u ( k ) x3 ( k )
where,
x1 (k ) = e(k );
x 2 (k ) = e(k ) − e(k − 1);
x 3 (k ) = D2e(k ) = e(k ) − 2e(k − 1) + e(k − 2);
z(k ) = e(k ) .
where ηP, ηI, ηD are the proportional, the integral, and the differential learning rate. K is the proportional
coefficient of the neuron, K for the ratio P, the integral I, and the differential D, respectively. The
learning rate are different value, so that different weight coefficients are adjusted separately. The faster
the better, but the overshoot are large, and may even make the system unstable. To ensure the stability
of the system, the choose K value is too small, which makes the selection of the system's fast K value
very important. The larger K is, the K value must be reduced. When the controlled object delay is
increased, the performance is worse.
After adopting the above improved algorithm, the online correction of the weight coefficient is not
completely based on the neural network learning principle, but is based on practical experience.
The input command is a square wave signal: rin(k)=0.5*sign(sin(2*2*pi*k*ts)), the sampling time is
1 mS (ts=0.001), and the four control laws are used for single neuron PID control, i.e. unsupervised
Hebb learning rule, supervised Delta learning rules, supervised Hebb learning rules, and improved Hebb
learning rule. The tracking results are shown in Figure 2 ~ Figure 5.
B. Program
%Single Neural Adaptive PID Controller
clear all;
close all;
x=[0,0,0]';
xiteP=0.40;
xiteI=0.35;
xiteD=0.40;
error_1=0;
error_2=0;
FAKULTAS TEKNIK
UNIVERSITAS NEGERI YOGYAKARTA
LABSHEET PRAKTIKUM KENDALI CERDAS
No. : 03 Revisi : 02 Kamis 17092020 Hal. 5 dari 6 hal.
Sem.:5 Single Neural PID Control 4 x 50 menit
y_1=0;y_2=0;y_3=0;
u_1=0;u_2=0;u_3=0;
ts=0.001;
for k=1:1:1000
time(k)=k*ts;
rin(k)=0.5*sign(sin(2*2*pi*k*ts));
yout(k)=0.368*y_1+0.26*y_2+0.1*u_1+0.632*u_2;
error(k)=rin(k)-yout(k);
x(1)=error(k)-error_1; %P
x(2)=error(k); %I
x(3)=error(k)-2*error_1+error_2; %D
wadd(k)=abs(wkp(k))+abs(wki(k))+abs(wkd(k));
w11(k)=wkp(k)/wadd(k);
w22(k)=wki(k)/wadd(k);
w33(k)=wkd(k)/wadd(k);
w=[w11(k),w22(k),w33(k)];
if u(k)>10
u(k)=10;
end
if u(k)<-10
u(k)=-10;
FAKULTAS TEKNIK
UNIVERSITAS NEGERI YOGYAKARTA
LABSHEET PRAKTIKUM KENDALI CERDAS
No. : 03 Revisi : 02 Kamis 17092020 Hal. 6 dari 6 hal.
Sem.:5 Single Neural PID Control 4 x 50 menit
end
error_2=error_1;
error_1=error(k);
u_3=u_2;
u_2=u_1;
u_1=u(k);
y_3=y_2;
y_2=y_1;
y_1=yout(k);
wkp_1=wkp(k);
wkd_1=wkd(k);
wki_1=wki(k);
end
figure(1);
plot(time,rin,'b',time,yout,'r');
xlabel('time(s)');ylabel('rin,yout');
figure(2);
plot(time,error,'r');
xlabel('time(s)');ylabel('error');
figure(3);
plot(time,u,'r');
xlabel('time(s)');ylabel('u');
C. Tugas Praktikum
1. Tulislah program sebagaimana pada percobaan diatas, dan lakukan eksekusi, amati hasilnya.
2. Ubahlah/modifikasi junlah learningnya, amati hasilnya
3. Lakukan Perubahan persamaan plant menjadi gelombang sinus, amati hasilnya
4. Lakukan perubahan/modifikasi nilai besaran PID menjadi Neural PI controller, amati hasilnya.
5. Lakukan perubahan transfer function PLANT menjadi y(k) = 0.5y (k-1) + 0.12 y(k-2) + 0.004
u(k-1) + 0.23 u(k-2)., Amati yang terjadi dan tunjukan perubahan outputnya.
6. Jelaskan apa yang dimaksud learning pada Neural Network, dan diantara ke-empat learning pada
program tersebut diatas, mana yang hasil outputnya terbaik.