Design Model-Reference Neural Controller in Simulink

The neural model reference control architecture uses two neural networks: a controller network and a plant model network, as shown in the following figure. The plant model is identified first, and then the controller is trained so that the plant output follows the reference model output.

The following figure shows the details of the neural network plant model and the neural network controller as they are implemented in the Neural Network Toolbox™ software. Each network has two layers, and you can select the number of neurons to use in the hidden layers. There are three sets of controller inputs:

  • Delayed reference inputs

  • Delayed controller outputs

  • Delayed plant outputs

For each of these inputs, you can select the number of delayed values to use. Typically, the number of delays increases with the order of the plant. There are two sets of inputs to the neural network plant model:

  • Delayed controller outputs

  • Delayed plant outputs

As with the controller, you can set the number of delays. The next section shows how you can set the parameters.

Use the Model Reference Controller Block

This section shows how the neural network controller is trained. The first step is to copy the Model Reference Control block from the Neural Network Toolbox blockset to Simulink® Editor. See the Simulink documentation if you are not sure how to do this. This step is skipped in the following example.

An example model is provided with the Neural Network Toolbox software to show the use of the model reference controller. In this example, the objective is to control the movement of a simple, single-link robot arm, as shown in the following figure:

The equation of motion for the arm is

d2ϕdt2=10sinϕ2dϕdt+u

where ϕ is the angle of the arm, and u is the torque supplied by the DC motor.

The objective is to train the controller so that the arm tracks the reference model

d2yrdt2=9yr6dyrdt+9r

where yr is the output of the reference model, and r is the input reference signal.

This example uses a neural network controller with a 5-13-1 architecture. The inputs to the controller consist of two delayed reference inputs, two delayed plant outputs, and one delayed controller output. A sampling interval of 0.05 seconds is used.

To run this example:

  1. Start MATLAB®.

  2. Type mrefrobotarm in the MATLAB Command Window. This command opens the Simulink Editor with the Model Reference Control block already in the model.

  3. Double-click the Model Reference Control block. This opens the following window for training the model reference controller.

  4. The next step would normally be to click Plant Identification, which opens the Plant Identification window. You would then train the plant model. Because the Plant Identification window is identical to the one used with the previous controllers, that process is omitted here.

  5. Click Generate Training Data. The program starts generating the data for training the controller. After the data is generated, the following window appears.

  6. Click Accept Data. Return to the Model Reference Control window and click Train Controller. The program presents one segment of data to the network and trains the network for a specified number of iterations (five in this case). This process continues, one segment at a time, until the entire training set has been presented to the network. Controller training can be significantly more time consuming than plant model training. This is because the controller must be trained using dynamic backpropagation (see [HaJe99]). After the training is complete, the response of the resulting closed loop system is displayed, as in the following figure.

  7. Go back to the Model Reference Control window. If the performance of the controller is not accurate, then you can select Train Controller again, which continues the controller training with the same data set. If you would like to use a new data set to continue training, select Generate Data or Import Data before you select Train Controller. (Be sure that Use Current Weights is selected if you want to continue training with the same weights.) It might also be necessary to retrain the plant model. If the plant model is not accurate, it can affect the controller training. For this example, the controller should be accurate enough, so select OK. This loads the controller weights into the Simulink model.

  8. Return to the Simulink Editor and start the simulation by choosing the menu option Simulation > Run. As the simulation runs, the plant output and the reference signal are displayed, as in the following figure.

Was this topic helpful?