Annex C: Neural PID Control System Code
%Single Neural Adaptive PID Controller Codeclear all;close all;%Initialize key variables% Neuron statesx = [0,0,0]’;xP = 300.001;xI = 0.85;xD = 0.25;% Neuron weightswkp_1 = 0.50;wki_1 = 0.50;wkd_1 = 0.50;error_1 = 0;error_2 = 0;refValue = 356;y_1 = 0;y_2 = 0;y_3 = 0;u_1 = 0;u_2 = 0;u_3 = 0;%load n4s1load model%convert idss model to ssH = ss(n4s1);%take “measured” channelplant = tf(H(1) + H(2));ts = H.Ts;%get direct form coefficients to use `direct form 1` in loopb = plant.num{1};a = plant.den{1};%%%%%%%%%%%%%%%%%% First run executes based on SNPID %%%%%%%%%%%%%%%%%for k = 1:15000 time(k) = k*ts; if k< = 5000 % Reference rin(k) = 356.0;168 elseif k< = 10000 rin(k) = 200; else rin(k) = 50; end try u(k) ...
Get Real-Time Rendering now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.