Main Content

Simulink Real-Time App Generator

Generate instrument panel app to interact with target computer and real-time application running on target computer

Since R2022a

Description

Simulink® Real-Time™ App Generator helps you generate an instrument panel app that interacts with the Speedgoat® target computer and real-time application running on the target computer. You can select signals and parameters in your model to represent as instrument panel controls and configure the controls before generating the app.

To use the Simulink Real-Time App Generator, open the App Generator from the Real-Time tab in the Simulink Editor or open the App Generator from the MATLAB® or Simulink Apps tab.

Use the App Generator for these tasks:

  • Open a model file SLX or real-time application file MLDATX, and create an instrument panel app.

  • Select signals and parameters to add to an instrument panel app.

  • Configure controls for instrument panel app.

  • Validate instrument bindings against real-time application MLDATX file.

  • Create instrument panel app.

  • Save an App Generator session file MAT, and open it in a future App Generator session.

By using the parts of the Simulink Real-Time App Generator, you can instrument signals and parameters from your real-time application, binding them to controls in a generated instrument panel. The generator lets you configure options for generating the instrument panel and configure the properties of the instrument panel controls. Use these parts of the App Generator to configure and generate an instrument panel:

Designer Toolstrip Operations

The App Generator controls on the Designer toolstrip let you add, remove, edit, and validate signal and parameter bindings between the real-time application to controls in the generated instrument panel app.

ControlsApp Generator Operations

Use the Layout button to open the Layout Options dialog box. From this dialog box, you can add or remove tabs in the generated app. Also, this dialog box lets you select grid usage for layout and choose whether the tabs open as windows in the generated app.

The Layout Options tab lets you create or remove tab from the generated app.

Use the Options button pull down menu to configure options for instrument panel app generation. The options include:

  • Toolstrip — Provide target computer controls at top of instrument panel.

  • Menu — Provide target computer controls in a menu on the instrument panel.

  • Status bar — Add status bar to the instrument panel.

  • TET Monitor — Add task execution time monitor to the instrument panel.

  • Instrumented signals — Include a plot of instrumented signals on a set of axes in the instrument panel. When you enable this option, all instrumented signals are included on a single axes. This all-signals axes control is not configurable. You also can add axes controls for individual signals. The individual-signal axes controls are configurable in the property panel. See Property Panel Operations.

    Instrumented nonvirtual bus signals are not included on the axes generated by the Instrumented signals option. You can add individual axes for nonvirtual bus signals.

  • Dashboard blocks — Import dashboard blocks from model to the instrument panel.

  • Use Grid Layout — Arrange components using grids on the instrument panel.

  • Callback — Process signals before displaying on the instrument panel.

  • Configure Components — Configure options for Simulink Real-Time App Designer components and select name for instrument panel app.

  • Settings — Enable automatic validation of instrument-to-control bindings during app generation.

Use the Target Events button to add callback code for target computer events. The App Generator adds the callback code for events when generating the app, and you can edit the callback code further by using the Code View in the App Designer. For more information, see Add Callbacks for Target Computer Events.

Use the Add From Model button to open a model in bind mode and use the model to select signals and parameters for the generated instrument panel. The App Generator Bind Mode message box remains active until you close bind mode for the model in the Simulink Editor.

When you select a single signal or a parameter from the Bindings tab, you can highlight that selected item in the model. If you select a workspace variable from the Bindings tab, clicking the Highlight in Model button opens the model base workspace in Model Explorer.

When you select multiple signals or parameters from the Bindings tab, you can use the Mass Edit button to edit the instrument binding configurations for the selected items. You can change the control type, change the control name, select whether to make the control name unique, and change tab placement of the control in the generated app.

The Mass Edit button properties editor lets you edit properties for multiple controls.

Use the Remove button to delete the selected instrument bindings from the Bindings tab for instrument panel generation.

For the real-time application MLDATX file, use the Validate button to check the instrument binding configurations in the Bindings tab. If the MLDATX file is not available, the App Generator issues an error.

Use the Generate App button to create an App Designer instrument panel for the real-time application by using the instrument binding configurations from the Bindings tab and by using the selected instrument panel options from the Options button.

After generating an App Designer instrument panel MLAPP file, you can update instrument bindings with their controls to the instrument panel. To use the Update App button:

  1. Add or remove signals or parameters on the Bindings tab.

  2. Click the Update App button and select the MLAPP file for the instrument panel to which you would like to update the control.

During the update, you have access to consider changes to all of the app bindings for updating the app. You can add bindings, remove bindings, or change the control type for bindings in the app.

Tip

The Update App workflow helps you add or remove instrument bindings with their controls to a generated instrument panel. This approach lets you add to a generated instrument panel that you have customized in App Designer.

Signals and Parameters Pane Operations

The Signals and Parameters pane helps you instrument the signals, parameters, and data in a real-time application. The tree hierarchy in the pane divides into Model and External Data, Named Signals, and the real-time application model signals and parameters. To add signals, parameters, or data to the instrument panel, select items from the Signals And Parameters pane, and click the Add selected button.

At the top of this pane, the filter box and filter options help you search for signals and parameters. The figure shows a search for signals in the slrt_ex_sf_car model that contain the text torque.

You can filter the display in the Signals And Parameters pane.

Bindings Tab Operations

When you select a signal, parameter, or variable in the Bindings tab, the Parameter or Signal configuration pane opens. This pane lets you configure the App Designer control in the instrument panel for the selected item. If you select multiple signals or parameters, you can use the Mass Edit button to configure the controls for the group of selected items.

Property Panel Operations

When you select a signal, parameter, or variable in the Bindings tab, the Parameter or Signal property panel opens. This panel lets you configure the App Designer control in the instrument panel for the selected item. You can change the displayed fields in the Parameter or Signal property panel by using the selection for the Control Type field.

About MLDATX and SLX Files

You can develop an instrument panel app in the App Generator from a model SLX file (if you start the App Generator from the Real-Time tab in the Simulink Editor) or from a real-time application MLDATX file. It is recommended that you develop the instrument panel based on the MLDATX file, because—when developing from the MLDATX file—the App Generator only lists the signals and parameters that are present in the generated code. If you develop the instrument panel based on the SLX file, the App Generator can list more signals than are present in the generated code. These signals include virtual signals and signals to Scope blocks.

Generate an App Designer app by using the Simulink Real-Time App Generator.

Open the Simulink Real-Time App Generator App

From the Simulink Editor, in the Real-Time tab, select Review Results > App Generator. Or, in the MATLAB Command Window, type:

slrtAppGenerator

If you open the App Generator from a model, the App Generator populates the Signals and Parameters pane with information from the model.

Examples

expand all

This example shows how to configure instrument panel controls for signals and parameter, then create an instrument panel app by using the App Generator. This example uses example model slrt_ex_osc.

  1. Open example model slrt_ex_osc. In the MATLAB Command Window, type:

    openExample('slrealtime/SlrtAddIOBlocksToSimulinkModelExample', ...
        'supportingFile','slrt_ex_osc.slx')
  2. Build the model, creating a real-time application file MLDATX.

  3. Open the Simulink Real-Time App Generator. In the Real-Time tab, select Review Results > App Generator.

  4. To create an instrument panel from the real-time application file MLDATX, select New > New, click No to remove the current session, and select the MLDATX file. For information about the difference between developing an instrument panel from a model SLX file or a real-time application MLDATX file, see About MLDATX and SLX Files.

  5. Add signals and parameters to the instrument panel app. From the Signals and Parameters pane, select the Amplitude parameter, the Frequency parameter, and the XfrFnc signal. Click the Add Selection button.

  6. Configure each control by clicking on its Control Type entry and editing the selections for the control. This figure shows a possible configuration for this instrument panel.

    By editing the Control Type, you select the app interface for a signal or parameter in the generated app.

  7. To create the instrument panel app, click the Generate App button.

    After creating the app, you can open it in App Designer to further customize the instrument panel.

    The App Generator adds controls to your instrument panel that let the panel interface with the real-time application. These controls include the target computer selector, connect button, load application button, start/stop button, stop time field, and system log. Any instrumented signals from the model are added in an axis component. For more information, see Create App Designer Instrument Panels by Using App Generator.

    You also can create or modify apps in App Designer by adding Simulink Real-Time components and controls. For more information, see Create App Designer Instrument Panels by Using Simulink Real-Time Components.

Related Examples

Parameters

No parameters are available for this application.

Programmatic Use

slrtAppGenerator opens the Simulink Real-Time App Generator. Operations that the Simulink Real-Time App Generator UI adds to an instrument panel app correspond App Designer controls that are customized for your real-time application. For more information about these controls, see slrealtime.ui Properties.

Version History

Introduced in R2022a

expand all