主要内容

Export Models from Experiment Manager into Simulink

After training models in Experiment Manager, you can export a trained model into Simulink® to use as a reduced order model (ROM). For information on training ROMs, see Train ROM.

To export a model into Simulink, select the model in the experiment results table and on the Experiment Manager tab, click Export and then click Generate ROM Simulink Block. The app opens an unsaved Simulink model and generates a trainingOutput.mat file in the current working folder. The Simulink model consists of these elements:

  • ROM inputs specified using Inport blocks.

  • ROM parameters specified using Constant blocks.

  • A ROM_Block subsystem that contains the exported model. The subsystem includes all necessary blocks with prepopulated parameters.

  • ROM outputs specified using Outport blocks.

The inputs to the ROM_Block subsystem are the ROM inputs and parameters. The outputs from the subsystem are the ROM outputs.

Simulink model showing the ROM inputs, ROM_Block subsystem, and ROM outputs.

You can use this model as a ROM by integrating it into a larger Simulink model.

The contents of the ROM_Block subsystem and the trainingOutput.mat file depend on the type of model you export.

Model TypetrainingOutput.mat ContentsROM_Block Contents
Nonlinear ARX
  • Linear model used to train the nonlinear autoregressive with exogenous inputs (ARX) model

  • ROM parameter values

  • SampleRate hyperparameter value

  • TrainingMSE and TestMSE values

  • Mux block that combine multiple input signals, if any

  • Demux block that separate multiple output signals if any

  • Nonlinear ARX Model (System Identification Toolbox) block that uses the trained nonlinear ARX model exported to the MATLAB® workspace

The ROM_Block subsystem showing the input, the Nonlinear ARX Model block, and the output. The Block Parameters dialog box of the Nonlinear ARX Model block highlighting the Model parameter is also shown.

Neural State Space
  • Normalization values for both ROM inputs and outputs

  • ROM parameter values

  • SampleRate hyperparameter value

  • TrainingMSE and TestMSE values

  • Mux block that combine multiple input signals, if any.

  • Demux block that separate multiple output signals if any.

  • Normalize subsystem, which normalizes the inputs, and Denormalize subsystem, which denormalizes the outputs. These subsystems use the normalization values from the trainingOutput.mat file.

  • Neural State-Space Model (System Identification Toolbox) block that uses the trained neural state-space model exported to the MATLAB workspace.

  • Selector block that selects only the output and excludes all lagged inputs.

The ROM_Block subsystem showing the inputs, the Mux block, the Normalize subsystem, the Neural State Space Model block, the Selector block, the Denormalize subsystem, and the output. The Block Parameters dialog box of the Neural State Space Model block highlighting the Model parameter is also shown.

Cascade-Correlation
  • Linear model used to train the cascade-correlation model

  • ROM parameter values

  • SampleRate hyperparameter value

  • TrainingMSE and TestMSE values

  • Mux block that combine multiple input signals, if any

  • Demux block that separate multiple output signals if any

  • Nonlinear ARX Model block that uses the nonlinear ARX model containing the cascade-correlation network exported to the MATLAB workspace

The ROM_Block subsystem showing the input, the Nonlinear ARX Model block, and the output. The Block Parameters dialog box of the Nonlinear ARX Model block highlighting the Model parameter is also shown.

LSTM Network
  • Trained long short-term memory (LSTM) network structure, stored as a dlnetwork (Deep Learning Toolbox) object

  • Normalization values for both ROM inputs and outputs

  • ROM parameter values

  • SampleRate hyperparameter value

  • Mux block that combine multiple input signals, if any.

  • Demux block that separate multiple output signals if any.

  • Normalize subsystem, which normalizes the inputs, and Denormalize subsystem, which denormalizes the outputs. These subsystems use the normalization values from the trainingOutput.mat file.

  • Stateful Predict (Deep Learning Toolbox) block that specifies the file path to trainingOutput.mat and uses the trained LSTM network in that file.

  • Data Type Conversion blocks that convert the input to the Stateful Predict block to the single data type and the output from the Stateful Predict block back to the double data type.

The ROM_Block subsystem showing the inputs, the Mux block, the Normalize subsystem, the Data Type Conversion blocks, the Stateful Predict block, the Denormalize subsystem, and the output. The Block Parameters dialog box of the Stateful Predict Model block highlighting the File path parameter is also shown.

MLP Network
  • Trained MLP network structure, stored as a dlnetwork (Deep Learning Toolbox) object

  • Normalization values for both ROM inputs and outputs

  • ROM parameter values

  • TrainingMSE and TestMSE values

  • Mux block that combine multiple input signals, if any.

  • Demux block that separate multiple output signals if any.

  • Normalize subsystem, which normalizes the inputs, and Denormalize subsystem, which denormalizes the outputs. These subsystems use the normalization values from the trainingOutput.mat file.

  • Predict (Deep Learning Toolbox) block that specifies the file path to trainingOutput.mat and uses the trained MLP network in that file.

  • Data Type Conversion blocks that convert the input to the Predict block to the single data type and the output from the Predict block back to the double data type.

The ROM_Block subsystem showing the inputs, the Mux block, the Normalize subsystem, the Data Type Conversion blocks, the Predict block, the Denormalize subsystem, and the output. The Block Parameters dialog box of the Predict Model block highlighting the File path parameter is also shown.

Gridded Interpolant (For static ROMs only)
  • Trained gridded interpolant model structure, stored as a griddedInterpolant object

  • ROM parameter values

  • TrainingMSE value

  • output names

  • Mux block that combines multiple input signals.

  • An n-D Lookup Table block for each output. These blocks use the property values of the griddedInterpolant object stored in the trainingOutput.mat file.

The ROM_Block subsystem showing the inputs, the Mux block, the n-D Lookup Table blocks, and the outputs.

The way the app handles exporting models into Simulink differs depending on the model type.

  • When you export a Neural State Space model into Simulink, the app also exports the trained neural state-space model to the MATLAB workspace as an idNeuralStateSpace (System Identification Toolbox) object.

  • When you export a Nonlinear ARX model into Simulink, the app also exports the trained nonlinear ARX model to the MATLAB workspace as an idnlarx (System Identification Toolbox) object.

  • When you export a Cascade-Correlation model into Simulink, the app also exports the trained nonlinear ARX model that uses the trained cascade-correlation network to the MATLAB workspace as an idnlarx (System Identification Toolbox) object.

  • For both Nonlinear ARX and Cascade-Correlation models, ROM_Block does not contain the Normalize and Denormalize subsystems. The Nonlinear ARX Model block normalizes the inputs and denormalizes the outputs.

  • When you export a Gridded Interpolant model into Simulink, the extrapolation or interpolation method can change.

    • If the interpolation method of the model is "nearest", then the app converts the extrapolation method to "nearest".

    • If the extrapolation method of the model is "spline" and the interpolation method is not "nearest", then the app converts the interpolation method to "spline".

    If the interpolation or extrapolation method of the model is "makima", then you cannot export the model into Simulink.

  • You cannot export a Scattered Interpolant model into Simulink.

Instead of exporting the trained model directly into Simulink, you can also export the model into the MATLAB workspace. For more information, see these examples:

See Also

Apps

Objects

Topics