What is the best way to build a model of automated system with neural network in Simulink (Matlab)?

倾然丶 夕夏残阳落幕 提交于 2020-12-12 12:18:10


I'm tring to build a model contating neural network in Simulink. My idea is to compose a model which includes a controlled object (electrical drive), PID controller and NN block for fine-tuning of the PID controller. NN training is provided for to be the reinforcement learning. NN calculates the koefficients of the PID controller, then it receives the feedback from the output of the object and calcucales the koefficients for the next cycle to minimize the static error.

I've build the model without NN successfully.

Now I'm triyng to add the NN block, and it puts me getting in stuck. 1). What type of block should I use to create NN? Are there pre-set blocks in Simulink for NN (in which I have to only set number of layers and neurons and finctions of activation and loss?) Or the only way is to build NN from zero?

2). As I know variables in workspace are updated only after end of modeling. If I want to change parameters of a block in runtime I need to use S-function block and 'set_param' function in it. So is it the only way to transfer object output to NN block? Or may be there a possibility for automative transfer in runtime (like between PID controller and controlled object)? Or may be someone has a better concept for making such a model in Simulink (or even in another Matlab toolbox)?

Any thoughts and links appiriciate. Thanks in advance. P.S. Model of the drive I took from http://pnu.edu.ru/media/ejournal/articles-2017/TGU_8_217.pdf