MATLAB Answers

Neural Network for PID adaptive parameters

5 views (last 30 days)
Denis Emanuel Pop
Denis Emanuel Pop on 30 Apr 2021
Hello everybody!
I have a recursive Neural Network that takes as input 4 signals: refference, error, current command and output and returns as output: Kp, Ki and Kd parameters for a PID, this is where the recursivity comes in as those 3 parameters from the output will be used to compute the current command which is fed back to the network.
This will be done in Simulink and for the neural network I will use a Matlab function that takes those inputs, trains the network continuously and then gives me back the PID parameters.
Now, I have some issues with that. How do I feed in the inputs for the neural network? One idea was to use an array with 4 lines, for each input and with each iteration to add the current values for error, refference and so on after the last column in the array.
For example, I'm at the 3rd iteration in Simulink, and the last values for my array are as follows: [20 19.5 2 0.5; 20 17 11 3] (1st row-refference, 2nd row-error and so on). And this being the 3rd iteration it will compute some other values, let's say that refference changes to 15, error is now 10, command is 10 and output is 5, those values will be added in the end+1 column of my array and the new array will be [20 19.5 2 0.5; 20 17 11 3; 15 10 10 5].
Now, in my function, this array will be used as an input for a neural network to train. With each iteration the array becomes larger. No problem, it doesn't require that much processing power because it only adds 4 elements to an array. My concern is with the training process. Because at each iteration I will have to feed in a larger array than the iteration before that and train the network again. How do I make it do the training in real time without having to use the 'train' function at every step?
And my second problem comes with the performance function. I want to use the mean squarred error for performance measurement, but I want my network to use the mean squarred error of my second input (the error of the system, refference - output) as its performance function, because in the end I want to have an error of 0, meaning that the refference and output of the system are equal. That's the error I want to minimize.
Thank you!

Answers (0)

Community Treasure Hunt

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

Start Hunting!