Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Creating Mappings (Simulation Interface Toolkit)

LabVIEW 2010 Simulation Interface Toolkit Help

Edition Date: June 2010

Part Number: 371504F-01

»View Product Info
Download Help (Windows Only)

The block diagram code of the host VI contains mappings that connect LabVIEW controls to model parameters and LabVIEW indicators to model signals. You can create mappings using the SIT Connection Manager dialog box. To access this dialog box, launch LabVIEW and select Tools�SIT Connection Manager.

Parameters and Workspace Variables

When you map a control directly to a model parameter, the parameter itself is updated with the value of the control. When you map a control to a workspace variable, the variable is updated, as well as all parameters that are dependent on it. Thus, one workspace variable can effectively tune multiple model parameters. For a given model, you can choose to map to either model parameters or workspace variables. To use workspace variables, you must inline the model parameters, and then specify which workspace variables you want to use.

Complete the following steps to inline model parameters:

  1. Launch The MathWorks, Inc. Simulink� application software and load the model that contains the parameters you want to inline.
  2. Launch the Simulation Parameters dialog box:
    1. For The MathWorks, Inc. MATLAB� application software release 13, select Simulation�Simulation parameters to launch the Simulation Parameters dialog box.
    2. For the MATLAB� application software release 14 and later, select Simulation�Configuration parameters to launch the Configuration Parameters dialog box.
  3. Display the Inline parameters field:
    1. For the MATLAB� application software release 13, click the Advanced tab.
    2. For the MATLAB� application software release 14 and later, click the Optimization item in the configuration tree on the left.
  4. Select Inline parameters, and click the Configure button.
  5. Select the appropriate variable(s) in the Source list.
  6. Click the Add to Table� button.
  7. Click the Apply button, and then click the OK button.
  8. Click the OK button to return to the model.
Tip�� Click the Help button in the Simulation Parameters or Configuration Parameters dialog box to launch the MATLAB� help and find additional information about this process.
Note��When you build a model into a DLL using the The MathWorks, Inc. Real-Time Workshop�, some types of expressions may not be tunable. Refer to the Tunable Expression Limitations section in The MathWorks, Inc. Real-Time Workshop� documentation for more information.

You can create mappings using a one-to-one relationship or a one-to-many relationship. The following figure shows a one-to-one relationship, mapping to model parameters:

In the previous figure, the Sine Wave Amplitude control of the host VI manipulates the amplitude parameter of the Sine Wave block in the model. The same relationship applies to the rest of the controls and parameters. You also can map one host VI control to multiple parameters and one indicator to multiple signals. The following figure shows this one-to-many relationship, mapping from model signals:

In the previous figure, All My Signals displays all the signals in the model. To define a one-to-many relationship, press the Ctrl key while clicking on multiple parameters or signals.

You can map controls to workspace variables to update all the model parameters which are dependent on them:

If the host VI is not running, you can use the SIT Connection Manager dialog box to modify mappings and generate new block diagram code. If the host VI is running, you must use the Remap Controls and Indicators dialog box to modify mappings.

Valid Mappings

The following list describes the front panel controls and indicators you can use in a host VI and the valid mappings you can make to each control or indicator.

  • Array—You can map array objects to any vector or matrix value in The MathWorks, Inc. Simulink application software. The objects in the array must be a supported object from this list.
  • Boolean—You can map Boolean objects to any scalar value in the Simulink application software. Boolean controls encode FALSE as 0 and TRUE as 1. Boolean indicators display 0 as FALSE and any nonzero value as TRUE.
  • String—You can map string objects to any Simulink data type. A Simulink vector or matrix appears as a tab-delimited string.
  • Numeric, Enum, Ring, Combo Box, Color Box, Radio Buttons Control—You can map these objects to any scalar value in the Simulink application software.
  • Knob, Dial, Meter, Gauge—You can map these objects to any scalar value in the Simulink application software. If you enable multiple needles on an object, you can map the object to a vector.
  • Slider, Tank, Thermometer—You can map these objects to any scalar value in the Simulink application software. If you enable multiple sliders on an object, you can map the object to a vector.
    Note��By default, the LabVIEW Simulation Interface Toolkit does not automatically adjust the scale range of knobs and sliders. LabVIEW Simulation Interface Toolkit can automatically adjust the scale range based on the initial value of the parameter in the Simulink application software. You can enable this autoscaling by placing a checkmark in the Autoscale Controls checkbox on the Mappings tab of the SIT Connection Manager dialog box.
  • Intensity Chart, Intensity Graph—You can map these objects only to a two-dimensional matrix in the Simulink application software.
  • Waveform Graph—You can map waveform graphs only to a one-dimensional vector or two-dimensional matrix in the Simulink application software.
  • XY Graph—You can map XY graphs to any two scalar values in the Simulink application software. When you create the mapping, click the signal you want to associate with the x value. Then press the <Ctrl> key and click the signal you want to associate with the y value.
    Note��The Simulation Interface Toolkit converts Express XY graphs into regular XY graphs.
  • Waveform Chart—You can map waveform charts to any scalar, vector, or matrix signal in the Simulink application software.

The Simulation Interface Toolkit does not support mappings to parameters or signals that have three or more dimensions.

Fixing Invalid Mappings

Mappings typically become invalid if the Simulation Interface Toolkit cannot communicate with a model parameter or signal correctly. Additionally, certain simulation options you set in the Simulink application software can cause mappings to become invalid. The following sections provide information about fixing invalid mappings.

Models or Host VIs with Broken Mappings

If you create a mapping, generate block diagram code for the host VI, and change the model or front panel in a way that breaks the mapping, the block diagram code of the host VI still references the mapping. To avoid errors, you must launch the SIT Connection Manager dialog box, remove or change any erroneous mappings, and generate new block diagram code.

Models Using Signal Storage Reuse, Block Reduction Optimization, or Virtual Blocks

Mappings might appear invalid if the model uses either Signal Storage Reuse or Block Reduction Optimization. These items are options you can set in the Simulink application software to reduce the memory footprint of the model. Disabling these options for the entire model makes all signals available for probing but increases the memory footprint of the model. You can mark individual signals as test points to maintain a reduced memory footprint while keeping certain signals available for probing. To make this change, load the model in the Simulink application software and perform the following actions:

For The MathWorks, Inc. MATLAB application software release 13, right-click a signal and select Signal properties from the shortcut menu. Place a checkmark in the SimulinkGlobal(Test Point) checkbox and click the OK button to save changes.

For the MATLAB application software release 14 and later, right-click a signal and select Signal properties from the shortcut menu. Click the Logging and accessibility tab, place a checkmark in the Test point checkbox, and click the OK button to save changes.

Note��If you previously converted this model to a model DLL, you must convert the model to a model DLL again after marking signals as test points.

Similarly, you might not be able to probe signals from Virtual Blocks such as Mux, Demux, Bus Selector, and so on. Marking signals from these blocks as test points makes the signals available for probing.

Refer to the Simulink documentation for information about Signal Storage Reuse, Block Reduction Optimization, Virtual Blocks, and test points.

Models Using Inline Parameters

You might not be able to manipulate model parameters if that model uses the Inline parameters option in the Simulink application software. This option writes a constant value to each model parameter. You must launch the Simulink application software and disable this option so the Simulation Interface Toolkit can manipulate the model parameters. Alternatively, you can mark the variables as tunable as described in the Parameters and Workspace Variables section above.

Refer to the Simulink documentation for information about inline parameters.

Models Containing Linked or Masked Subsystems

You can create mappings to parameters and signals of masked subsystems. However, if a subsystem is linked, or linked and masked, any mappings to parameters and signals of that subsystem appear invalid. Refer to the Simulink documentation for information about linked and masked subsystems.

Subsystems without Parameters or Signals

If a model contains a subsystem that does not have any parameters or signals, that subsystem appears in the model tree when you create mappings. However, you cannot create mappings to/from that subsystem.

WAS THIS ARTICLE HELPFUL?

Not Helpful