xPC Target    

Entering the Real-Time Workshop Parameters

You enter the simulation and real-time run parameters in the Simulation Parameters dialog box. These parameters give information to Real-Time Workshop on how to build the target application from your Simulink model.

After you load a Simulink model and boot the target PC, you can enter the simulation parameters. This procedure uses the Simulink model xpc_osc2.mdl as an example and assumes you have already loaded that model. See Simulink Model.

  1. In the MATLAB Command Window, type
  1. MATLAB loads the oscillator model and displays the Simulink block diagram, as shown below.

  1. In the Simulink window, and from the Simulation menu, click Parameters. In the Simulation Parameters dialog box, click the Real-Time Workshop tab.
  1. The Real-Time Workshop pane opens.

  1. Click the Browse button.
  1. The System Target File Browser opens.

  1. From the list, select xpctarget.tlc xPC Target. Click OK.
  1. The system target file xpctarget.tlc, the template makefile xpc_default_tmf, and the make command make_rtw are automatically entered into the page. The Real-Time Workshop pane should now look like the figure shown below.

  1. From the Category list, select xPC Target code generation options.
  1. The Real-Time Workshop pane opens to the options page.

  1. From the Mode list, select either Real-Time or Freerun. The option Freerun is similar to a simulation, but with the generated code. It runs the target application as fast as it can. However, unlike a simulation, the Freerun mode of xPC Target does not support variable step solvers.
  2. Select the Log Task Execution Time check box to log task execution times to the target object property tg.TETlog.
  1. The task execution time is the time in seconds to complete calculations for the model equations and post outputs during each sample interval.

  1. In the Signal Logging Buffer Size in Doubles box, enter the maximum number of sample points to save before wrapping. This buffer includes the time, states, outputs, and task execution time logs.
  2. From the Real-Time Interrupt Source list, select a source. The default value is Timer.

  3. From the Category list, select xPC Target code generation options (cont.).
  1. The Real-Time Workshop pane opens to the options page.

  1. In the Name of xPC Target object box, enter the name of the target object created by the build process. The default target object name is tg.
  2. Select the External mode check box. The build process adds code to the target application to communicate with your Simulink model for parameter tuning.
  1. The options pane should now look similar to the figure shown below.

  1. Click OK.
  2. From the File menu, click Save as. Enter a filename. For example, enter xpc_osc3 and then click OK.

Your next task is to create (build) the target application. See Building and Downloading the Target Application.


  Troubleshooting the Boot Process Building and Downloading the Target Application