Products & Services Solutions Academia Support User Community Company

Learn more about xPC Target   

Scope (xPC) (xPC Target Scope) - Scope (xPC) (xPC Target Scope block)

Library

xPC Target Library for Misc.

Description

For information about this block, see Adding an xPC Target Scope Block and Entering Parameters for an xPC Target Scope Block of the xPC Target Getting Started Guide.

There are three types of scopes, target, host, and file. The xPC Target Scope block dialog changes depending on which scope type (Scope type) you select. By default, the scope dialog displays the scope of type Target dialog. The following sections describe the parameters depending on the scope type:

Scope of Type Target Block Parameters

Scope number

Contains a unique number to identify the scope that is displayed. This number is incremented each time you add a new xPC Target Scope block. Normally, you do not want to edit this value.

This number identifies the xPC Target Scope block and the scope screen on the host or target computer.

Scope type

From the list, select Target if it is not already selected.

The updated dialog box displays.

Start scope when application starts

Select this check box to start a scope when the target application is downloaded and started. The scope window opens automatically.

Scope mode

From the list, select one of the following:

  • Numerical — Displays the data numerically.

  • Graphical redraw — Displays a cycle of data continuously without any scrolling (refreshing the entire plot).

  • Graphical sliding — Like graphical rolling mode. This mode displays the older data on the right side of the scope and the newer data on the left side of the scope. A vertical line separates the two types of data.

  • Graphical rolling — Displays running data continuously scrolling from left to right across the scope (similar behavior to oscilloscopes).

If you have a scope type of Target and a scope mode of Numerical, the scope block dialog adds a Numerical format box to the dialog. You can define the display format for the data. If you choose not to complete the Numerical format box, the xPC Target software displays the signal using the default format of %15.6f. This format is a floating point one, with no label.

Numerical format

If you have a scope type of Target and a scope mode of Numerical, the scope block dialog adds a Numerical format box to the dialog. Enter a label and associated numeric format type in which to display signals. By default, the entry format is the floating point %15.6f. The Numerical format box takes entries of the format:

'[LabelN] [%width.precisiontype] [LabelX]'

where

LabelN is the label for the signal. You can use a different label for each signal or the same label for each signal. This argument is optional.

width is the minimum number of characters to offset from the left of the screen or label. This argument is optional.

precision is the maximum number of decimal points for the signal value. This argument is optional.

type is the data type for the signal format. You can use one or more of the following types:

Type

Description

%e or %E

Exponential format using e or E

%f

Floating point

%g

Signed value printed in f or e format depending on which is smaller

%G

Signed value printed in f or E format depending on which is smaller

LabelX is a second label for the signal. You can use a different label for each signal or the same label for each signal. This argument is optional.

Enclose the contents of the Numerical format field in quotation marks.

For example

'Foo %15.2f end'

For a whole integer signal value, enter 0 for the precision value. For example

'Foo1 %15.0f end'

For a multiple format entries, delimit each entry with a comma and surround the entire string with a pair of quotes. For example

'Foo2 %15.6f end,Foo3 %15.6f end2'

You can have multiple Numerical format entries, separated by a comma. If you enter one entry, that entry applies to each signal (scalar expansion). If you enter fewer label entries than signals, the first entry applies to the first signal, the second entry applies to the second signal, and so forth, and the last entry is scalar expanded for the remaining signals. If you have two entries and one signal, the xPC Target software ignores the second label entry and applies the first entry. You can enter as many format entries as you have signals for the scope.

Grid

Select this check box to display grid lines on the scope. Note that this parameter is only applicable for scopes of type Target and scope modes of type Graphical redraw, Graphical sliding, and Graphical rolling.

Y-Axis limits

Enter a row vector with two elements where the first element is the lower limit of the y-axis and the second element is the upper limit. If you enter 0 for both elements, then the scaling is set to auto. Note that this parameter is only applicable for scopes of type Target and scope modes of type Graphical redraw, Graphical sliding, and Graphical rolling.

Number of samples

Enter the number of values to be acquired in a data package.

If you select a Scope mode of Graphical redraw, this parameter specifies the number of values to be acquired before the graph is redrawn.

If you select a Trigger mode other than FreeRun, this parameter can specify the number of samples to be acquired before the next trigger event.

If you select a Scope mode of Numerical, the block updates the output every Number of samples.

Number of pre/post samples

Enter the number of samples to save or skip. Specify a value less than 0 to save this number of samples before a trigger event. Specify a value greater than 0 to skip this number of samples after the trigger event before data acquisition begins.

Decimation

Enter a value to collect data at each sample time (1) or to collect data at less than every sample time (2 or greater).

Trigger mode

From the list, select either FreeRun, Software Triggering, Signal Triggering, or Scope Triggering.

If you select FreeRun or Software Triggering, you do not need to specify anything else.

If you select Signal Triggering, then in the Trigger signal box, enter the index of a signal. In the Trigger level box, enter a value for the signal to cross before triggering. From the Trigger slope list, select either, rising, or falling. You do not need to specify the Trigger scope number.

If you select Scope Triggering, then in the Trigger scope number box, enter the scope number of a Scope block. If you use this trigger mode, you must also add a second Scope block to your Simulink model. You do not need to specify the Trigger signal.

If you want the scope to trigger on a specific sample of the other scope, enter a value in the Sample to trigger on box. The default value is 0 and indicates that the triggering scope and the triggered (current) scope start simultaneously. For more information on this field, see Triggering One Scope with Another Scope to Acquire Data in xPC Target User's Guide.

For additional information on trigger, see Advanced Data Acquisition Topics.

Scope of Type Host Block Parameters

Scope number

Contains a unique number to identify the scope that is displayed. This number is incremented each time you add a new xPC Target scope block. Normally, you do not want to edit this value.

This number identifies the xPC Target Scope block and the scope screen on the host or target computer.

Scope type

From the list, select Host.

The updated dialog box is displayed.

Start scope when application starts

Select this check box to start a scope when the target application is downloaded and started. With a scope of type target, the scope window opens automatically. With a scope of type host, you can open a host scope viewer window from xPC Target Explorer.

Number of samples

Enter the number of values to be acquired in a data package.

Number of pre/post samples

Enter the number of samples to save or skip. Specify a value less than 0 to save this number of samples before a trigger event. Specify a value greater than 0 to skip this number of samples after the trigger event before data acquisition begins.

Decimation

Enter a value to collect data at each sample time (1) or to collect data at less than every sample time (2 or greater).

Trigger Mode

From the list, select either FreeRun, Software Triggering, Signal Triggering, or Scope Triggering.

If you select FreeRun or Software Triggering, the trigger event is an automatic one. No other trigger specification is required (see trigger for further details on software trigger).

If you select Signal Triggering, then in the Trigger signal box, enter the index of a signal. In the Trigger level box, enter a value for the signal to cross before triggering. From the Trigger slope list, select either, rising, or falling. You do not need to specify scope triggering.

If you select Scope Triggering, then in the Trigger scope number box, enter the scope number of a Scope block. If you use this trigger mode, you must also add a second Scope block to your Simulink model. You do not need to specify signal triggering.

If you want the scope to trigger on a specific sample of the other scope, enter a value in the Sample to trigger on box. The default value is 0 and indicates that the triggering scope and the triggered (current) scope start simultaneously. For more information on this field, see Triggering One Scope with Another Scope to Acquire Data in the xPC Target User's Guide.

Scope of Type File Block Parameters

Scope number

Contains a unique number to identify the scope that is displayed. This number increments each time you add a new xPC Target scope block. Normally, you do not want to edit this value.

This number identifies the xPC Target Scope block and the scope screen on the host or target computer.

Scope type

From the list, select File.

The updated dialog box is displayed.

Start scope when application starts

Select the check box to start a scope when the target application is downloaded and started. The scope window opens automatically.

Number of samples

Enter the number of values to be acquired in a data package. This parameter works in conjunction with the AutoRestart check box. If the AutoRestart box is selected, the scope of type file collects data up to Number of samples, then starts over again, overwriting the buffer. If the AutoRestart box is not selected, the scope of type file collects data only up to Number of samples, then stops.

Number of pre/post samples

Enter the number of samples to save or skip. Specify a value less than 0 to save this number of samples before a trigger event. Specify a value greater than 0 to skip this number of samples after the trigger event before data acquisition begins.

Decimation

Enter a value to collect data at each sample time (1) or to collect data at less than every sample time (2 or greater).

Trigger Mode

From the list, select either FreeRun, Software Triggering, Signal Triggering, or Scope Triggering.

If you select FreeRun or Software Triggering, the trigger event is an automatic one. No external trigger specification is required.

If you select Signal Triggering, then in the Trigger signal box, enter the index of a signal. In the Trigger level box, enter a value for the signal to cross before triggering. From the Trigger slope list, select either, rising, or falling. You do not need to specify scope triggering.

If you select Scope Triggering, then in the Trigger scope number box, enter the scope number of a Scope block. If you use this trigger mode, you must also add a second Scope block to your Simulink model. You do not need to specify signal triggering.

If you want the scope to trigger on a specific sample of the other scope, enter a value in the Sample to trigger on box. The default value is 0 and indicates that the triggering scope and the triggered (current) scope start simultaneously. For more information on this field, see Triggering One Scope with Another Scope to Acquire Data in the xPC Target User's Guide.

Filename

Enter a name for the file to contain the signal data. By default, the target PC writes the signal data to a file named C:\data.dat.

Mode

From the list, select either Lazy or Commit. Both modes open a file, write signal data to the file, then close that file at the end of the session. With the Commit mode, each file write operation simultaneously updates the FAT entry for the file. This mode is slower, but the file system always knows the actual file size. With the Lazy mode, the FAT entry is updated only when the file is closed and not during each file write operation. This mode is faster, but if the system crashes before the file is closed, the file system might not know the actual file size (the file contents, however, will be intact).

WriteSize

Enter the block size, in bytes, of the data chunks. This parameter specifies that a memory buffer, of length Number of samples, writes data to the file in WriteSize chunks. By default, this parameter is 512 bytes, which is the typical disk sector size. Using a block size that is the same as the disk sector size provides optimal performance.

Number of samples

Enter the number of values to be acquired in a data package.

AutoRestart

Select this check box to enable the scope of type file to collect data up to Number of samples, then start over again, appending the new data to the end of the signal data file. Clear the AutoRestart check box to have the scope of type file collect data up to Number of samples, then stop.

  


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