Main Content

Simulink Real-Time App Generator

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

Description

Simulink® Real-Time™ App Generator helps you generate an instrument panel app that interacts with the 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 and 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.

  • Create instrument panel app.

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

Image of Simulink Real-Time App Generator

Open the Simulink Real-Time App Generator

From the Simulink Editor, in the Real-Time tab, select Review Results > App Generator. Or, from 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.

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

open_system(fullfile(matlabroot,'toolbox',...
    'slrealtime','examples','slrt_ex_osc'))

Build the model, creating a real-time application file MLDATX.

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

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 the Tip About MLDATX and SLX Files..

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 to panel button.

Image of Add to panel button

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.

Image of App Generator

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 Simulink Real-Time Components.

Tip 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.

This example shows how to open a real-time application in the App Generator, add signals and parameters to an instrument panel app from the real-time application, and add signals and parameters to the instrument panel app from the model that corresponds to the real-time application..

Open the App Generator. In the MATLAB Command Window, type:

slrtAppGenerator

To create a new instrument panel app, click the New button and select the real-time application file slrt_ex_osc.mldatx. You created this file in Configure Instrument Panel Controls and Create App.

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 to panel button.

Image of Add to panel button

To add signals and parameters from the model that corresponds to the real-time application, click the Add From Model button.

The App Generator opens the model and puts the model in bind mode for signal and parameter selection. For more information about bind mode, see Add Instruments to Real-Time Application from Simulink Model.

To return to the App Generator, close bind mode in the model.

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

Related Examples

Programmatic Use

expand all

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.

Version History

Introduced in R2022a