Neural Network Toolbox Previous page   Next Page

Using the Model Reference Controller Block

This section demonstrates 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 your model window. See your Simulink documentation if you are not sure how to do this. This step is skipped in the following demonstration.

A demo model is provided with the Neural Network Toolbox to demonstrate the model reference controller. In this demo, 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

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

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

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

This demo 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 demo, follow these steps.

  1. Start MATLAB.
  2. Run the demo model by typing mrefrobotarm in the MATLAB command window. This command starts Simulink and creates the following model window. The Model Reference Control block has already been placed in the model.

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

  4. The next step would normally be to select Plant Identification, which opens the Plant Identification window. You would then train the plant model. Since the Plant Identification window is identical to the one used with the previous controllers, we won't go through that process here.
  5. Select Generate Data. The program then starts generating the data for training the controller. After the data is generated, the following window appears.

  6. Select Accept Data. Return to the Model Reference Control window and select 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, the 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 may also be necessary to retrain the plant model. If the plant model is not accurate, it can affect the controller training. For this demonstration, the controller should be accurate enough, so select OK. This loads the controller weights into the Simulink model.
  8. Return to the Simulink model and start the simulation by selecting the Start command from the Simulation menu. As the simulation runs, the plant output and the reference signal are displayed, as in the following figure.


Previous page  Model Reference Control Importing and Exporting Next page

© 1994-2005 The MathWorks, Inc.