Accelerating Battery Charging Simulations with Altair romAI - Part 2

RSGarciarivas
RSGarciarivas
Altair Employee
edited February 6 in Altair HyperWorks

Data Preparation and Format Conversion

Now that I have all the simulation results from the DOE, they need to be formatted specifically for romAI, which requires a single CSV file with time in the first column, followed by all training signals (inputs, outputs, and states) in subsequent columns. This file contains data from all simulations, one after the other.

I automated this data merging process using Altair Compose. The script I developed performs several key operations:

  • File collection: Function getAllFiles recursively searches through directories to find all PSIM simulation result files (*.smv extension). Results from the DOE get created in a different directory for each run.
  • Dataset Split: The script randomly splits the data into two sets:
    • Train/test dataset (80% of the runs) for ROM training
    • Validation dataset (20% of the runs) for testing the ROM with unseen data
  • Data processing and export: For each simulation file, the script:
  1. Reads the PSIM results
  2. Extracts relevant signals (time, reference current, battery current, battery voltage, switching frequency)
  3. Creates validation plots for visual inspection
  4. Writes the data to a single CSV file in romAI's required format

This OML script (the main language used in Compose) is particularly useful because it handles the entire workflow automatically, from locating simulation files to generating properly formatted datasets, while also providing visual verification of the data through plots, saving lots of time if any change is needed.

This is the full script:

Creating the Reduced Order Model in romAI Director

The ROM development process in romAI Director follows three distinct phases, each serving a crucial purpose in ensuring model accuracy and efficiency:

  • Signal pre-processing

In this tab of romAI Director you can remove unwanted high-frequency content and noise that could interfere with training. In this specific case, a power converter’s output will always contain ripples which, on a systems simulation, are not important.

Signal relevance analysis can also be done here. It is useful for identifying input/output relationships in the dataset.

  • Neural network and training configuration

In this tab inputs, outputs and states of the ROM are defined, as well as the architecture of the neural network it will use, i.e., activation function, number of hidden layers and neurons per layer, as well as the training parameters, i.e., number of epochs, train/test split ratio, etc.

Auto Exploration is a feature in romAI in which a user can train multiple models with different combinations of activation function, hidden layers, and number of neurons. This is relevant in many cases for comparing different models and identifying the best.

Once these parameters have been defined, the ROM is trained from here.

  • Model post-processing

Once the ROM has been trained, its performance metrics can be reviewed in the post-processor tab. The ROM can be validated fully on the dataset’s simulations or on previously unseen simulations, as I did. Different models can also be compared here. This plot shows how the trained ROM performs on some of the simulations from the validation dataset:

This video demonstrates the complete workflow in romAI Director, showing how these phases come together in practice.

Performance Validation and Benchmarking

Once the ROM is ready, it is crucial to validate on a longer timespan simulation and compare both accuracy and simulation speed with the high-fidelity model from which it was built.

I performed this validation in Altair Twin Activate, where both the PSIM model and the ROM can be placed side by side in a block diagram.

I conducted two validation simulations:

  • Speed Benchmark

Simulation time: 20 seconds

Scenario: Gradual reference current increase

Results:

ROM: 0.21 seconds execution time

High-fidelity model: 46 minutes execution time

Speed improvement factor: ~13,000x

  • Accuracy Test

Simulation time: 200 milliseconds

Scenario: Reference current changes at fixed times

Purpose: Validate output accuracy against the original model

This plot demonstrates the remarkable accuracy of the ROM, showing nearly identical behavior to the high-fidelity model while achieving significant computational efficiency gains:

Next Steps

I hope this guide helps you leverage romAI for your own battery charging applications. The workflow shown here is merely the first step in multiple, much more complex, use cases. You can take this further in several ways:

  • Extend this approach to more aggressive control strategies while incorporating initial transient behaviors into the ROM.
  • Create a ROM accounting for thermal losses.
  • Integrate the ROM into multi-converter simulations.

Go ahead and leverage this on your own! You can find all relevant files attached here.

Remember to reach out for support if needed from your Altair One account.

If you haven't yet, check the first part of this guide here.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.