Graphics Reference
In-Depth Information
Annex C: Neural PID
Control System Code
%Single Neural Adaptive PID Controller Code
clear all;
close all;
%Initialize key variables
% Neuron states
x = [0,0,0]';
xP = 300.001;
xI = 0.85;
xD = 0.25;
% Neuron weights
wkp_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 n4s1
load model
%convert idss model to ss
H = ss(n4s1);
%take “measured” channel
plant = tf(H(1) + H(2));
ts = H.Ts;
%get direct form coefficients to use `direct form 1` in loop
b = 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;
163
 
Search WWH ::




Custom Search