Bus & Data

Generate Bus Object for Bus Creators

Button: Generate bus object

This function creates bus objects (Simulink.Bus) for the selected Bus Creator blocks. Each output line of the selected Bus Creator blocks must have a line name, and that name is used as the bus object name.

After you click the button, a dialog appears:

SimDolphin Screenshot

Bus Generation Methods

Code Generation Options

Here, you can configure various bus object properties.

Select Data Source

You can choose where to save the newly generated bus objects. If the model is linked to a data dictionary, you can select the main dictionary or any referenced dictionary. If the model has access to the base workspace, you can also select the base workspace.

Examples

Generate bus objects by compiling the model:

SimDolphin Screenshot

Generate bus objects by checking resolved signals:

SimDolphin Screenshot
Button: Link bus signals

This function connects a Bus Selector’s named bus signals to the matching input ports of one or more selected downstream Subsystem or Model Reference blocks.

How to use: Select one Bus Selector and one or more Subsystem or Model Reference blocks, then click the button. The tool traces the Bus Selector upstream until it finds a Bus Creator or a resolved Simulink.Bus object, retrieves the bus’s element names, and routes each named element line to the same-named input port on every selected downstream block.

Requirements:

Example

SimDolphin Screenshot

Data Dictionary Functions

Button: Open data dictionary

This button opens a menu for data dictionary functions. It is available in MATLAB R2016a and later versions.

The menu currently provides two functions:

These options are available only when there are unsaved changes in any of the open data dictionaries.

Run Simulation, Generate MDF

Button: Run simulation, generate MDF

This function simulates the model shown in the active Simulink editor and writes the logged signals to an MDF file. Open the model you want to run and enable logging for the signals you need before clicking the button. Nothing needs to be selected.

How to use:

  1. Click the button. A Run simulation dialog shows the name of the model about to run and its stop time. You can type a different stop time; it is used for this run only and is not written back to the model. Click Run to start, or Cancel to stop here.
Run simulation dialog showing the model name, stop time and Run button
  1. While the simulation runs, the button turns into a stop button. Click it again to stop the simulation early. You are then asked whether to Discard the partial data or Continue with it.
  2. When the simulation is over, the Simulation Data window opens with the logged signals.

Check the model name and stop time before starting the simulation.

View Signal Values

Picking signals here is for viewing only: the MDF file always contains every logged signal.

Simulation data window with available signals, signals selected for viewing and MDF export options

Export to MDF

Click Export to MDF and choose the file name and the MDF version in the save dialog. The default is the model name in the model folder. Three versions are available:

If you cancel the save dialog, you return to the window with your choices kept.

Generate Signal Editor from MDF Files

Button: Generate signal editor from MDF files

This function reads signals from a measurement file (.mdf, .dat or .mf4) and builds a Signal Editor block that plays them back into a model. The selected signal data is saved to a MAT file, which the Signal Editor block reads.

Choose one measurement file at a time. What happens after you select it depends on the blocks selected in Simulink: Model blocks with unconnected inports open a mapping table; otherwise, you pick the channels by hand. Channels whose groups contain no recorded samples are omitted from the list.

Feed the Inports of Model Blocks

Select one or more Model (model reference) blocks with unconnected input ports, then click the button. Here is an example of a Model block being selected. This function only searches for unconnected inports.

Selected Model Block
MDF channel mapping table with exact matches, amber partial matches and an unmapped array element

The tool creates a subsystem containing the Signal Editor to the left of the selected blocks. A Bus Selector connects its output to the model inports, and each signal is converted to the data type the referenced model expects.

Generated Signal Editor subsystem and Bus Selector connected to a Model block

If at least one element of an inport has a channel, the tool builds the whole inport. Any unmapped elements of that bus or array are fed by Ground blocks and listed in a note inside the generated subsystem. In the example above, arr[1] is grounded. An inport with no channels selected at all stays unconnected; an inport that already has a line keeps its existing connection.

Generated Signal Editor subsystem and Bus Selector connected to a Model block

Inports with the same name share a signal, even across different Model blocks. If two models use the same inport name for different signals, data types, or dimensions, the function stops and reports the conflict.

Pick Signals by Hand

  1. Leave the block selection empty and click the button, then choose the MDF file. This mode also opens if the selection contains no Model block with an unconnected inport.
  2. Type in the filter box to narrow the channel list. The heading shows the number of visible channels out of the total.
  3. Select the channels you need on the left and click the right arrow to add them to Selected signals to generate Signal Editor. Select a channel on the right and click the left arrow to remove it. Multiple channels can be transferred together; the up and down arrows move one selected entry within the picked list.
  4. Click OK, which becomes available once at least one channel is picked, and choose where to save the MAT file.
MDF signal picker with recorded channels on the left and chosen channels on the right

A new untitled model opens with a subsystem containing the Signal Editor, data type conversions, and a Bus Creator. In this mode, the generated signals are sorted by channel name so related bus elements stay together. Save the model and keep the MAT file at the location used when it was created: the Signal Editor reads its data from that file. Canceling the MAT-file save dialog creates no subsystem or model.