Build and Download Real-Time Application

The example model, xpc_osc3, is a real-time model of a damped oscillator. You use the Simulink® Real-Time™ build process to generate C code, compile, link, and download the real-time application to the target computer.

After you enter changes in the Configuration Parameters dialog box, you can build the real-time application. By default, the build procedure downloads the real-time application to the default target computer, as designated in Simulink Real-Time Explorer. For further details on setting the target computer for a real-time application, see Simulink Real-Time Options Configuration Parameters.

  1. In the MATLAB® window, type xpc_osc3.

    MATLAB loads the oscillator model and displays the Simulink block diagram.

  2. In the Simulink window, on the toolbar, click the Build Model icon   on the toolbar.

    On the development computer, after completing a build without detecting an error, MATLAB displays lines like the following:

    ### Starting Simulink Real-Time build procedure for model: 
    . . .
    ### Successful completion of Simulink Real-Time build procedure for 
    model: xpc_osc3

    After compiling, linking, and downloading the real-time application, Simulink Real-Time creates a target object in the MATLAB workspace. The default name of the target object is tg. For more information about the target object, see Real-Time Application Objects.

    If you have a monitor connected to your target computer, the monitor screen looks like this screen.

  3. In the MATLAB window, type:


    MATLAB displays a list of properties for the target object tg.

If the software detects a error during build and download, see Troubleshooting in Simulink Real-Time.

If you accidentally download a real-time application built with a different version of the Simulink Real-Time product than the one on the target computer, the following error message appears on the target computer monitor. The download fails.

Mismatch between model and kernel versions

To prevent this version mismatch, rebuild real-time applications with each new Simulink Real-Time release.

During the build process, the Simulink Real-Time software creates a target object that represents the real-time application running on the target computer. The target object is defined by a set of properties and associated methods. You control the real-time application and computer by setting the target object properties.

Was this topic helpful?