Tutorial: Create a Reduced-Order Model (ROM) of a Mass Spring Damper System using Machine Learning

Create a ROM of a dynamic system using romAI.

Attention: Available only with romAI extension.

Prerequisites for this Tutorial

The Altair romAI extension is required for this tutorial. It can be enabled at File > Extension Manager > romAI.

Files for This Tutorial

TrainingDataset.csv; mkc_linear.scm

A finished version of the built models in the tutorials along with any files required to complete the tutorials are available at this location: <installation_directory>/ tutorial_models/Modeling and Simulation/romAI.
Copy these files and paste them in a local directory, because the root tutorial directory is write-protected and should not be changed.

Overview

Altair romAI is a no-code application that uses machine learning techniques, such as multilayer perceptron (MLP), and classical systems theory for Reduced-Order Model (ROM) generation and system identification. romAI supports linear, nonlinear, static, and dynamic systems.

Given an arbitrary physical problem that is modeled with an arbitrary software, the goal of romAI is to transform the problem into a ROM block that contains:

  • Inputs and outputs
  • State variables
  • Characteristic parameters

For detailed information about romAI, its technology, and other uses, refer to File > Help in the romAI Director dialog box.

The romAI eLearning explains the tool in detail with short videos.

The model covered in this tutorial is a mass-spring-damper system, shown in the figure below.

The goal is to generate a ROM of this dynamic system, based on simulation data. After the training, a block will represent this system with its inputs, outputs, and states.

This is an example of how to use romAI to generate ROMs using simulation data. The workflow consists of four steps and can be applied to complex simulations and test data as well:
  1. Preprocessing
  2. Training
  3. Evaluation
  4. Deployment

Preprocessing

The data that will be used for training must be saved as a .CSV or a .MAT dataset file to be imported into romAI Director.

The Pre-Processor lets you select variables to appear on the Builder tab, in addition to automatically plotting them. This is useful as not all variables in the data set might be used for training the algorithm.

If the dataset is based on timeseries, you can apply a low-pass filter to each signal by setting the cut-off frequency.

  1. Open Modeling > romAI Director, and then open the Pre-Processor tab.
  2. Click the Import Dataset for testing icon, and select the dataset TrainingDataset.csv.
  3. Select the desired variables to be used in the Builder.

Training

The Builder tab simplifies the training process. First, select a directory to write the outputs with the romAI name. Then, select the inputs, outputs, and system states along with the settings parameters.

Since the variables were already exported from the Pre-Processor, the Builder parameters can be easily set.

  1. Set the output directory.

    A subfolder is created inside this folder. Enter a name in the romAI Name field.

  2. Define inputs, outputs, and states.
  3. Set physical constraints.

    If state variables exist, you can add physical constraints. It is possible for one state variable to be the derivative of another, and the romAI application can consider this to produce a better ROM.

  4. Select the model type and training parameters.

    Because this is a linear system, the settings are simpler and there is no need to specify model architecture parameters in detail.

    In this case, 20% of the dataset is used for model validation and 80% for training.

    The optimization algorithm runs for 10 epochs (iterations).

  5. Click the Start Training icon.

Evaluation

The Post-Processor tab allows for easy visualization and evaluation of the trained ROM. It opens automatically after model training.

The initial plot shows Loss Metrics, which is a constant value representing the error made by the trained romAI model during testing. The loss is a fixed value that represents the error made by the trained romAI model when predicting during testing. Analysis of this plot lets you draw the following conclusions:
  • A lower training error indicates a more accurate ROM
  • If the training and test loss are similar, then the training has converged.
Additionally, it is possible to visualize the accuracy check plot. The romAI model's predictions for the selected output are shown on the y-axis, while the targets for the same output are shown on the x-axis. The degree of alignment between the predictions and targets is indicated by the number of blue points that fall on the red y = x curve. The romAI model's predictions for the selected output are displayed on the y-axis, while the targets for the same output are shown on the x-axis.

If romAI is used to generate dynamic ROMs, it is important to have a tool that can easily perform preliminary time simulations to assess the accuracy of the transient behavior after the romAI model has been trained.

The Time Simulation tab is designed to perform time simulations in a single step. Click the Import Dataset for testing icon and select a dataset file.

A time simulation is initiated, and upon successful completion, the plot is updated.

The plot shows the following:
  • Based on the inputs and initial state conditions in the dataset file, the romAI model produces the dynamic results (blue line).
  • The target time history (green line).

Deployment

It is now time to utilize the trained algorithm in the Twin Activate environment.

  1. From the Palette Browser, select romAI > romAI
  2. Drag the block into the modeling window and double-click it.
  3. Select the directory that was previously chosen, and the block automatically updates based on the selected romAI model.

    Use the input/output ports to connect the romAI block to other blocks.

    The model mkc_linear.scm can be used to validate the new romAI model. However, before replacing the original romAI model with the new, save this Twin Activate file locally, to avoid changing the original file.

    Finally, validate the model using the new romAI.