xPC Target    

Control with MATLAB Commands

You run your target application in real time to observe the behavior of your model with generated code.

After xPC Target downloads your target application to the target PC, you can run the target application. This procedure uses the Simulink model xpcosc.mdl as an example, and assumes you have created and downloaded the target application for that model. The default name of the target object is tg.

  1. In the MATLAB window, type

    The target application starts running on the target PC. In the MATLAB window, the status of the target object changes from stopped to running.

    On the target PC screen, the Simulation line changes from stopped to running and the AverageTET line periodically updates with a new value.

  1. In the MATLAB window, type

    The target application stops running.

xPC Target allows you to change many properties and parameters without rebuilding your target application. Two of these properties are stop time and sample time.

After you build a target application, but before you start running the application you can change the sample time. You can change the stop time before you start the target application or while it is running.

  1. Change the stop time. For example, to change the stop time to 1000 seconds, type either
  2. Change the sample time. For example, to change the sample time to 0.01 seconds, type either

    Although you can change the sample time in between different runs, you can only change the sample time without rebuilding the target application under certain circumstances.

If you choose a sample time that is too small, a CPU overload can occur. If a CPU overload occurs, the target object property CPU Overload changes to detected. In that case, change the Fixed step size in the Solver property sheet to a larger value.


 Controlling the Target Application Signal Monitoring