SIMulation Workbench Preference GUI

SIMulation Workbench® provides a variety of options called preferences for customizing the user workflow and SimWB RTDB creation and code generation options.

Contents

SIMulation Workbench Preferences GUI

General Preferences

Preference Usage

Remember RTDB Creator and Code Generator tab settings

Specifies how to remember the last settings used for these tabs in the MLToolkit GUI. Specify as one of the following:

  • Default - Use default settings.
  • Model-specific - Use settings on a per-model basis. That is, remember the settings for these tabs for each model. The software creates a file, named .simwbToolkitpref.modelname.xml, which is placed in the same folder as the model. This file contains the settings for the model. When you close the MLToolkit GUI and the Simulink model and reopen both, the software will use this file to specify the settings for the RTDB Creator and Code Generator tabs.
  • Last session - Use settings from the previous session for the current session. The software saves these settings in the file .simwbToolkitpref.xml. This file is located in the directory specified by simwbprefdir.

RTDB Generation Preferences

Preference Usage

Custom RTDB variable prefix

Enter a custom prefix for RTDB variable names. This option is useful if there are blocks in the Simulink® model with names the same as C language keywords (const, int, double). Adding a custom prefix helps prevent build errors. If the Hierarchical RTDB variable names is also selected the custom prefix is added to each element in the hierarchical structure.

This option does not apply to the toRTDB/fromRTDB blocks available in the simwbSfunlib block library.

Hierarchical RTDB variable names

Creates the names as a hierachical structure based on the Simulink.BlockPath. The hierarchical names are generated in the modelname.subsystemname.blockname format. If the Custom RTDB variable prefix is also selected then the names are generated in the modelname.prefixsubsystemname.prefixblockname format.

Display duplicate RTDB variables

Select if you want the automatic RTDB creation tool to display information on blocks which will potentially map to the same RTDB variable.

Error if duplicate RTDB variables

Select if you want the automatic RTDB creation tool and the code generation tool to error if it finds blocks which will potentially map to the same RTDB variable. If this option is not selected, the blocks which map to the same RTDB variable will be ignored and will not be present in the generated RTDB or the generated code.
Note:Suppose the name of a source/sink block selected for RTDB creation or code generation clashes with the variable name specified for a toRTDB/fromRTDB block. In this case, MLToolkit will throw an error, regardless of whether the Error if duplicate RTDB variables is selected or not.

Error if no blocks map to RTDB variables

Select if you want the automatic RTDB creation tool to error if no blocks in the model map to RTDB variables. If this option is not selected, an empty signal.db file is uploaded to the real-time host and warning is displayed on the screen.

Append RTDB variables as AIO or DIO

Select if you want to change the point type of RTDB variable to AIO or DIO while appending the RTDB. If the RTDB variable already exists with type AI or DI and the new point type is AO or DO then if this option is selected, the RTDB will be appended with the point type AIO or DIO. This option is used when sharing data between two Simulink® models. The output of one model will be connected to the input of the other model via a shared AIO or DIO RTDB variable. For this option to work, the output of one model and the input of the other model should have the same name, data type, and the number of elements.

Generate list of blocks that map to RTDB variables

Select to obtain a report of all the blocks in your model that map to RTDB variables. When you generate SimWB-compliant code for your model, the software replaces each block included in the report with a toRTDB/fromRTDB block. By default, this option is unchecked.
For more information about the report, see Generate List of Blocks that MAP to RTDB Variables.

Do not convert dots in RTDB variables to underscores

Select if you want the dots in the block names to become a hierarchical RTDB. For example, if an input port with name Car.Speed is set to map to RTDB, this option will create an RTDB variable 'Car.Speed'. Previously, we used to convert that to 'Car_Speed'.

Code Generation Preferences

Preference Usage

RTWCAPISignals

Exports the Simulink signals in the generated code. In the case of Referenced models, ensure that this setting is manually set for all the referenced models.

Generate list of blocks that map to RTDB variables

Select to obtain a report of all the blocks in your model that map to RTDB variables. When you generate SimWB-compliant code for your model, the software replaces each block included in the report with a toRTDB/fromRTDB block. You must place the signal.db file for the model in the folder. By default, this option is unchecked.
For more information about the report, see Generate List of Blocks that MAP to RTDB Variables.

Allow sharing of variables across models

Select to allow block parameters of type Simulink.Parameter with StorageClass set to ImportedExternPointer to be shared amongst multiple Simulink models. Only those block parameters used by models that reside in MATLAB base workspace that match the specified regexp are shared in Simulation Workbench.

For more information on how to create objects of type Simulink.Parameter, see documentation on Simulink.Parameter.

Open SIMulation Workbench Preferences GUI

To access and set preferences:
  1. In Simulink, select SimWB -> Preferences.
  2. From the left pane of the Preferences dialog, select one of the options.
  3. Change settings in the right pane of the Preferences dialog box.
  4. Click Apply or OK.
Preferences take effect immediately.

Where SimWB Stores Preferences

SimWB stores the preferences and last used Toolkit settings in the .simwbToolkitpref.xml file. To see a full path to where the .simwbToolkitpref.xml file is located, type simwbprefdir in the MATLAB command window. If you specify the RTDB Creator and Code Generator tab settings option as Model-specific, the software stores these settings in the .simwbToolkitpref.modelname.xml file, which is located in the same directory as the model.

Effects of Changing Preferences

When you change preferences using the SimWB Preferences GUI, it updates and saves the relevant preferences file. When you change settings in the MLToolkit GUI, and close the model associated with the Toolkit GUI, it updates and saves the relevant preferences file.

Effects of Installing and Un-installing on the Preferences Folder

Installing MLToolkit has no effect on the preferences folder or model-specific preferences file(s). That is, SimWB creates, checks, copies, and writes to the preferences file(s) when you start up MLToolkit GUI or the SimWB Preferences GUI, not when you install it.

Programmatic Alternative

Open the SimWB Preferences dialog box using the simwbprefsgui function. For more information about this function, type help simwbprefsgui.