Products & Services Solutions Academia Support User Community Company

Learn more about xPC Target   

Software Environment

Introduction

The software environment is a place to design, build, and test a target application in nonreal time and real time. It also includes communication between the host and target computers.

Host-Target Communication

Whether using a serial connection (RS-232) or a network connection (TCP/IP), information is exchanged between the host PC and target PC. This information includes

Rapid Prototyping Process

Design and build a target application on a host PC, and then run and test the target application on a target PC. xPC Target functions include control of the target application, acquisition of signal data, and tuning of parameters while running in real time.

The rapid prototyping process includes the following tasks:

  1. Create a Simulink or Stateflow model — You create block diagrams in Simulink using simple drag-and-drop operations, and then you enter values for the block parameters and select sample rates. If you use continuous-time components, you also need to select an integration algorithm.

  2. Simulate the model in nonreal time — Simulink uses a computed time vector to step the model. After the outputs are computed for a given time value, Simulink immediately repeats the computations for the next time value. This process is repeated until it reaches the stop time.

      Note   Because this computed time vector is not connected to a hardware clock, the outputs are calculated in nonreal time as fast as your computer can run. The time to run a simulation can differ significantly from real time.

  3. Create an executable target application — The Real-Time Workshop, Stateflow Coder, xPC Target products, and a C compiler, create the target application that runs on the target PC. This real-time application uses the initial parameters from the Simulink model that were available at the time of code generation.

  4. Execute the target application in real time — The target PC is booted using an xPC Target boot disk or network boot image that loads the xPC Target real-time kernel. After booting the target PC, you can build and download a real-time application.

    The xPC Target software uses real-time resources on the target PC hardware. Based on your selected sample rate, the xPC Target software uses interrupts to step the model at the proper rate. With each new interrupt, the target application computes all the block outputs from your model.

  5. Acquire signals — Acquire signal data using xPC Target scopes. xPC Target software supports 10 scopes for scopes of type target, 8 scopes of type file, and an infinite number of scopes of type host, as long as the target PC resources can support them.

    Scopes created by xPC Target Scope blocks acquire data according to Simulink sample time rules. This includes non-regular execution, such as if the scope is in an enabled or triggered subsystem. Note that scopes created dynamically (from the MATLAB Command Window or the API) sample at the base rate, irrespective of the sample time of their signals.

    You can create xPC Target scopes and acquire data from the target application by

    • xPC Target — Use the xPC Target Remote Control Tool and Scope Manager windows to create scopes, and use the Simulink viewer to add signals.

    • MATLAB — Enter commands in the MATLAB Command Window.

    • Simulink — Add xPC Target Scope blocks to your Simulink model.

        Note   xPC Target software does not support normal Simulink Scope blocks in external mode. Instead, use xPC Target Scope blocks.

    • Target PC — Use commands in the target PC command window.

    • Web browser — Use the xPC Target Web browser interface.

    • Simulink GUI — Add blocks to a Simulink user interface model with xPC Target From blocks. See Graphical User Interfaces in the xPC Target User's Guide documentation for details.

  6. Tune parameters — You can tune parameters by

    • xPC Target GUI — Use the xPC Target Remote Control Tool and Simulink viewer to change parameters.

    • MATLAB interface — Enter commands in the MATLAB window.

    • Simulink interface —- Use your Simulink model with external mode.

    • Target PC — Use commands in the target PC command window.

    • Web browser — Use the xPC Target Web browser interface.

    • Simulink GUI —- Add blocks to a Simulink user interface model with xPC Target To blocks. See Graphical User Interfaces in the xPC Target User's Guide for details.

The xPC Target Embedded Option Product

Often, control system and digital signal processing applications are developed for use in production where a limited number of deployed systems is required. Whether you deploy one or a hundred systems, the xPC Target Embedded Option software provides a convenient approach that allows you to implement your system on low-cost PC hardware.

When you have completed developing and testing, you can use the target application as a real-time system that runs on a dedicated target PC without needing to connect to the host computer.

The xPC Target Embedded Option product has one mode of operation, StandAlone. In this case, the target PC boots into the Microsoft DOS environment, starts the DOS program xpcboot.com from autoexec.bat, and then starts the kernel from xpcboot.com:

When using Boot Floppy or CD Boot, you do not need DOS environment to load and run the xPC Target kernel. DOSLoader mode, like StandAlone mode, boots the target PC into DOS, starts the DOS program xpcboot.com from autoexec.bat, and then starts the kernel from xpcboot.com.

For more information on the xPC Target Embedded Option product, see Embedded Option in the xPC Target User's Guide.

StandAlone Mode

StandAlone mode combines the target application with the kernel and boots them together on the target PC from a hard disk drive or flash memory. The host PC does not have to be connected to the target PC.

  1. Select StandAlone mode from the Configuration node in the xPC Target Hierarchy pane of the xPC Target Explorer tool.

  2. Build a kernel/target application.

  3. Copy DOS system files, utilities, kernel/application files, and helper files to the target PC hard drive or flash memory.

  4. Boot the target PC.

    When you boot the target PC, the target PC loads DOS environment, which then calls the xPC Target autoexec.bat file to start the xPC Target kernel (*.rtb) and associated target application. If you set up the boot device to run the xPC Target autoexec.bat file upon startup, the target application starts executing as soon as possible. The xPC Target application executes entirely in protected mode using the 32-bit flat memory model.

For more information on the xPC Target Embedded Option product, see Embedded Option in the xPC Target User's Guide.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS