Quantcast

Documentation Center

  • Trial Software
  • Product Updates

nts

Determine fixed-point data type

Syntax

nts
nts({'block',PORT})
nts({line-handle})
nts({gsl})

Description

nts opens the NumericTypeScope window. To connect to a signal in a Simulink® model, select the signal and then, in the NumericTypeScope window, select File > Connect to Simulink Signal.

The NumericTypeScope suggests a fixed-point data type in the form of a numerictype object based on the dynamic range of the input data and the criteria that you specify in the Bit Allocation Panel. The scope allows you to visualize the dynamic range of data in the form of a log2 histogram. It displays the data values on the X-axis and the number or percentage of occurrences on the Y-axis. Each bin in the histogram corresponds to a bit in a word. For example, 20 corresponds to the first integer bit in the binary word, 2-1 corresponds to the first fractional bit in the binary word.

nts({'block',PORT}) opens the NumericTypeScope window and connects the scope to the signal output from block on output port with index PORT. If the block has more than one output port, you must specify the port index. The scope cannot connect to more than one output port.

nts({line-handle}) opens the NumericTypeScope window and connects the scope to the Simulink signal which has the line handle specified in line-handle.

nts({gsl}) opens the NumericTypeScope window and connects the scope to the currently selected Simulink signal. You must select a signal in a Simulink model first, otherwise the scope opens with no signal selected.

Input Arguments

block

Full path to the specified block.

line-handle

Handle of the Simulink signal that you want to view with the scope. To get the handle of the currently selected signal, at the MATLAB® command line, enter nts({gsl}).

PORT

Index of the output port that you want to view with the scope. If the block has more than one output port, you must specify the index. The scope cannot connect to more than one output port.

The NumericTypeScope Window

The NumericTypeScope opens with the default toolbars displayed at the top of the window and the dialog panels to the right.

Toolbars

By default the scope displays a toolbar that provides these options:

ButtonAction
New NumericTypeScope.
Connect to Simulink signal. The scope connects to the currently selected signal. If a block with only one output port is selected and the Connect scope on selection of is set to Signal lines or blocks, connects to the output port of the selected block. For more information, see Sources Pane.

After connecting the scope to a signal in a Simulink model, the scope displays an additional toolbar with the following options:

ButtonAction
Stop simulation
Start simulation
Simulate one step
Snapshot. Freezes the display so that you can examine the results. To reenable display refreshing, click the button again.
Highlight Simulink signal.
Persistent. By default, the scope makes a persistent connection to the selected signal. If you want to view different signals during the simulation, click this button to make a floating connection. You can then select any signal in the model and the scope displays it.

Dialog Boxes and Panels

Configuration Dialog Box

Use the NumericTypeScope configuration dialog box to control the behavior and appearance of the scope window.

To open the Configuration dialog box, from the scope main menu, select File > Configuration > Edit, or, with the scope as your active window, press the N key.

For information about each pane, see Core Pane and Sources Pane.

To save configuration settings for future use, select File > Configuration > Save as. The configuration settings you save become the default configuration settings for the NumericTypeScope.

    Caution   Before saving your own set of configuration settings in the matlab/toolbox/fixpoint folder, save a backup copy of the default configuration settings in another location. If you do not save a backup copy of the default configuration settings, you cannot restore these settings at a later time.

To save your configuration settings for future use, save them in the matlab/toolbox/fixpoint folder with the file name NumericTypeScopeSL.cfg. You can re-save your configuration settings at anytime, but you must save them in this folder with this filename.

Core Pane

The Core pane controls the general settings of the scope.

To open the Core:General UI Options dialog box, select General UI and then click Options.

  • Display the full source path in the title bar—Select this check box to display the full path to the selected block in the model. Otherwise, the scope displays only the block name.

  • Open message log—Control when the Message Log window opens. The Message log window helps you debug issues with the scope. Choose to open the Message Log window for any of these conditions:

    • for any new messages

    • for warn/fail messages

    • only for fail messages

    • manually

    The option defaults to for warn/fail messages.

    You can open the Message Log at any time by selecting Help > Message Log or by pressing Ctrl+M. The Message Log dialog box provides a system level record of loaded configuration settings and registered extensions. The Message Log displays summaries and details of each message, and you can filter the display of messages by Type and Category.

    • Type—Select the type of messages to display in the Message Log. You can select All, Info, Warn, or Fail. Type defaults to All.

    • Category—Select the category of messages to display in the Message Log. You can select All, Configuration, or Extension. The scope uses Configuration messages to indicate when new configuration files are loaded, and Extension messages to indicate when components are registered. Category defaults to All.

To open the Core:Source UI Options dialog box, select General UI and then click Options.

  • Keyboard commands respect source playback modes—Has no effect. The following table shows the keyboard shortcut mapping. You cannot disable this mapping.

    ActionKeyboard Shortcut
    Open new NumericTypeScopeInsert
    Change configurationN
    Display keyboard helpK
    Play simulationP
    Pause simulationSpace
    Stop simulationS
    Step forwardRight arrow, Page down

  • Recently used sources list—Sets the maximum number of recently used sources displayed under the Files menu option.

Sources Pane

The Sources pane controls how the scope connects to Simulink. You cannot disable the Simulink source.

To open the Sources:Simulink Options dialog box, select the Sources tab and then click Options.

  • Load Simulink model if not open—When selected, if you specify a signal in a Simulink model that is not currently open, the scope opens the model.

  • Connect scope on selection of—Connects the scope only when you select signal lines or when you select signal lines or blocks. If you select Signal lines or blocks, the scope cannot connect to blocks that have more than one output port.

Dialog Panels

Bit Allocation Panel

The scope Bit Allocation panel provides options for specifying data type criteria. Adjust these criteria to observe the effect on suggested numerictype. For streaming data, the suggested numerictype adjusts over time in order to continue to satisfy the specified criteria.

You can:

  • Specify a known word length and signedness and, using Specify constraint, add additional constraints such as the maximum number of occurrences outside range or the smallest value that the suggested data type must represent.

  • Specify Integer length and Fraction length constraints so that the scope suggests an appropriate word length.

  • Set the Signedness and Word length to Auto so that the scope suggests values for these parameters.

  • Enable Graphical control and use the cursors on either side of the binary point to adjust the fraction length and observe the effect on the suggested numerictype on the input data. For example, you can see the number of values that are outside range, below precision, or both. You can also view representable minimum and maximum values of the changed suggested data type.

  • Specify extra bits for either the fraction length or the integer length. The extra bits act as a safety margin to minimize the risk of overflow and precision loss.

Legend

The scope Legend panel informs you which colors the scope uses to indicate values. These colors represent values that are outside range, in range, or below precision when displayed in the scope.

Resulting Type

The Resulting Type panel describes the fixed-point data type as defined by scope settings. By manipulating the visual display (via the Bit Allocation panel or with the cursors), you can change the data type specification.

The Data Details section displays the percentage of values that fall outside range or below precision with the numerictype object located at the top of this panel. SQNR (Signal Quantization Noise Ratio) varies depending on the signal. If the parameter has no value, then there is not enough data to calculate the SQNR. When scope information or the numerictype changes, the SQNR resets.

The Type Details section provides details about the fixed-point data type. You can copy the numerictype specification by right-clicking the Resulting Type pane and then selecting Copy numerictype.

Input Data

The Input Data panel provides statistical information about the values currently displayed in the NumericScopeType.

Examples

expand all

Connect a NumericTypeScope to a signal in a Simulink model

Open a NumericTypeScope window and connect to a signal.

Open the model.

fxpdemo_approx

Open a NumericTypeScope.

nts

In the fxpdemo_approx model, select the yEven signal.

In the NumericTypeScope window, select File > Connect to Simulink Signal.

Run the simulation to view the dynamic range of the output. The NumericTypeScope suggests a data type for the output.

Connect a NumericTypeScope to a block output port

Connect a NumericTypeScope to a block output port and view the dynamic range of block output.

Specify the block path and name and the output port number.

blk='fxpdemo_approx/Even';
nts({blk,1})

Run the simulation to view the dynamic range of the output. The NumericTypeScope suggests a data type for the output.

Specify a Simulink signal to display

Connect a NumericTypeScope to a signal selected in a model.

Open the model.

fxpdemo_approx

In the fxpdemo_approx model, select the yEven signal.

Open a NumericTypeScope, specifying the line handle of the selected signal.

nts({gsl})

More About

expand all

Tips

  • Use the NumericTypeScope to help you identify any values that are outside range or below precision based on the current data type.

    When the information is available, the scope indicates values that are outside range, below precision, and in range of the data type by color-coding the histogram bars as follows:

    • Blue — Histogram bin contains values that are in range of the current data type.

    • Red — Histogram bin contains values that are outside range in the current data type.

    • Yellow — Histogram bin contains values that are below precision in the current data type.

  • Select View > Vertical Units to select whether to display values as a percentage or as an actual count.

  • Use the View > Bring All NumericTypeScope Windows Forward menu option to manage your NumericTypeScope windows. Selecting this option or pressing Ctrl+F brings all NumericTypeScope windows into view.

See Also

| |

Was this topic helpful?