Main Content

Import-Export Neural Network Simulink Control Systems

Import and Export Networks

The controller and plant model networks that you develop are stored within Simulink® controller blocks. At some point you might want to transfer the networks into other applications, or you might want to transfer a network from one controller block to another. You can do this by using the Import Network and Export Network menu options. The following example leads you through the export and import processes. (The NARMA-L2 window is used for this example, but the same procedure applies to all the controllers.)

  1. Repeat the first three steps of the NARMA-L2 example in Use the NARMA-L2 Controller Block. The NARMA-L2 Plant Identification window should now be open.

  2. Select File > Export Network, as shown below.

    Screenshot showing Export Network option under File menu

    This opens the following window.

    Screenshot of Export Neural Network Plant Controller Parameter dialogue box

  3. Select Export to Disk. The following window opens. Enter the file name test in the box, and select Save. This saves the controller and plant networks to disk.

    Screenshot of Export to Disk dialoge box

  4. Retrieve that data with the Import menu option. Select File > Import Network, as in the following figure.

    Screenshot of Import Network option under File menu

    This causes the following window to appear. Follow the steps indicated to retrieve the data that you previously exported. Once the data is retrieved, you can load it into the controller block by clicking OK or Apply. Notice that the window only has an entry for the plant model, even though you saved both the plant model and the controller. This is because the NARMA-L2 controller is derived directly from the plant model, so you do not need to import both networks.

    Screenshots of "Import Neural Network Plant Parameters" and "Import File" dialogue boxes

Import and Export Training Data

The data that you generate to train networks exists only in the corresponding plant identification or controller training window. You might want to save the training data to the workspace or to a disk file so that you can load it again at a later time. You might also want to combine data sets manually and then load them back into the training window. You can do this by using the Import and Export buttons. The following example leads you through the import and export processes. (The NN Predictive Control window is used for this example, but the same procedure applies to all the controllers.)

  1. Repeat the first five steps of the NN Predictive Control example in Use the Neural Network Predictive Controller Block. Then select Accept Data. The Plant Identification window should then be open, and the Import and Export buttons should be active.

  2. Click Export to open the following window.

    Screenshot of Export Data dialogue box

  3. Click Export to Disk. The following window opens. Enter the filename testdat in the box, and select Save. This saves the training data structure to disk.

    Screenshot of Export to disk dialogue box

  4. Now retrieve the data with the import command. Click Import in the Plant Identification window to open the following window. Follow the steps indicated on the following page to retrieve the data that you previously exported. Once the data is imported, you can train the neural network plant model.

    Screenshots of "Import Data" and "Import File" dialogue boxes