Set Up and Configure Simulink Real-Time

For this tutorial, you must have this configuration:

  • Single PCI bus target computer

  • Network target computer boot method

You must have installed and configured a C compiler as part of your Simulink® Real-Time™ installation. If not, see Command-Line C Compiler Configuration.

Configure Link Between Development and Target Computers

To run a Simulink Real-Time model on a target computer, you must connect the development and target computers in a network.

The target network settings values are representative only. Consult your network administrator for actual values. For more on network configuration, see PCI Bus Ethernet Setup.

  1. Open a Simulink Real-Time model by creating a model from the Simulink start page. In the MATLAB Command Window, type:

    simulink

    Select the Simulink Real-Time template from the start page and create the exampleSlrtApp model. Or, in the Command Window, use the Simulink.createFromTemplate command.

  2. In the Simulink Editor, open the Target Computer Manager. In the Real-Time tab, from the targets list, click Target Computer Manager.

  3. From the Target Computers list, select the target computer node.

    • To add a node representing another target computer, in the Targets pane, click the Add target button.

    • To remove a node representing a target computer, select the node and click the Remove target button.

  4. From the Advanced settings list, set IP address to the IP address for your target computer (for example, Speedgoat target machines are preconfigured to address 192.168.7.1).

  5. Set Subnet mask to the subnet mask address of your LAN (for example, 255.255.255.0).

  6. Set Port (optional) to a value greater than 20000 and less than 65536. This property is set by default to 22222, a value higher than the reserved area (telnet, ftp, and so on).

  7. If a gateway is required, set Gateway (optional) to the gateway required to access the target computer. This property is set by default to 255.255.255.255, which means that you do not use a gateway to connect to your target computer. If you connect your computers with a crossover cable, leave this property as 255.255.255.255.

    If you communicate with the target computer from within your LAN, do not change the default setting. If you communicate from a development computer within a LAN different from your target computer, define a gateway and enter its IP address here. In particular, create a gateway if you access the target computer via the Internet.

  8. Select Ethernet bus PCI. All Speedgoat target machines use bus type PCI.

  9. Select Ethernet driver Auto (default). This setting depends on type of Speedgoat target machine. The information is provided in the Speedgoat documentation and is available in the label attached to the target machine.

The Target Computer Manager window looks like this figure.

Configure Target Settings

To run a Simulink Real-Time model on a target computer, you must configure the target settings.

  1. Open a Simulink Real-Time model by creating a model from the Simulink start page. In the MATLAB Command Window, type:

    simulink

    Select the Simulink Real-Time template from the start page and create the exampleSlrtApp model. Or, in the Command Window, use the Simulink.createFromTemplate command.

  2. In the Simulink Editor, open the Target Computer Manager. In the Real-Time tab, from the targets list, click Target Computer Manager.

  3. In the Target Computers list, select the target computer node.

    • To add a node representing another target computer, in the Targets pane, click the Add target button.

    • To remove a node representing a target computer, select the node and click the Remove target button.

  4. From the Advanced settings list, execute the following target computer settings as required:

    • USB Support — If you want to use a USB port on the target computer, for example, to connect a USB keyboard, leave this check box selected. Otherwise, clear it.

    • Graphics mode — If you want to display information, such as a target scope, in graphic format, leave this check box selected. If you want to display information as text, clear it.

The Target Computer Manager window looks like this figure.

Configure Boot Configuration

To run a Simulink Real-Time model on a target computer, you must configure the target computer boot method. For more on boot methods, see Target Computer Boot Methods.

  1. Open a Simulink Real-Time model by creating a model from the Simulink start page. In the MATLAB Command Window, type:

    simulink

    Select the Simulink Real-Time template from the start page and create the exampleSlrtApp model. Or, in the Command Window, use the Simulink.createFromTemplate command.

  2. In the Simulink Editor, open the Target Computer Manager. In the Real-Time tab, from the targets list, click Target Computer Manager.

  3. In the Target Computers list, select the target computer node.

    • To add a node representing another target computer, in the Targets pane, click the Add target button.

    • To remove a node representing a target computer, select the node and click the Remove target button.

  4. Expand the list.

  5. To clear the MAC address, from the Advanced settings list, delete the value in the MAC address box.

    If you clear the MAC address, the next time the target computer starts, by default, the software automatically obtains the MAC addresses of accessible target computers. The software displays them for confirmation in the Simulink Real-Time Network Boot dialog box.

  6. To enter the MAC address of the target computer manually, in the MAC address box, enter the address in the format xx:xx:xx:xx:xx:xx.

    The next time the target computer starts, the software selects and starts the target computer that matches this MAC address. The Simulink Real-Time Network Boot dialog box does not open.

  7. Click Create boot disk.

    The software creates and starts a network boot server process on the development computer. You see a minimized icon () in the bottom right system tray on the development computer.

The Target Computer Manager window looks like this figure.

Run the Confidence Test

Validate the setup and configuration by running the confidence test.

  1. Create a network boot image and restart the target computer. See Network Boot Method.

  2. In the current folder window, select a folder outside the MATLAB® root folder.

  3. In the MATLAB Command Window, type slrttest.

    MATLAB executes the test script for the default target computer and displays messages indicating whether the test passed or failed.

    ### Simulink Real-Time Test Suite 
    ### Host-Target interface is: TcpIp
    ### Test 1, Ping target computer 'TargetPC1' using system ping: ... OK
    ### Test 2, Ping target computer 'TargetPC1' using SLRTPINGTARGET: ... OK
    ### Test 3, Software reboot the target computer 'TargetPC1': ........... OK
    ### Test 4, Build and download a Simulink Real-Time application using model ...
        slrttestmdl to target computer 'TargetPC1': ... OK
    ### Test 5, Check host-target command communications with 'TargetPC1': ... OK
    ### Test 6, Download a pre-built Simulink Real-Time application to target ...
        computer 'TargetPC1': ... OK
    ### Test 7, Execute the Simulink Real-Time application for 0.2s: ... OK
    ### Test 8, Upload logged data and compare with simulation results: ... OK
    ### Test Suite successfully finished
  4. Evaluate the results.

    • If the tests return OK, you are ready to build and download a real-time application to the target computer.

    • If one or more tests return FAILED, see Troubleshooting in Simulink Real-Time.

Related Topics