Building large scale models for industrial systems requires incorporating the real-world behavior of the system inside the mathematical model. In order to achieve this, models need to be calibrated based on collected experimental data. Calibrating models to data, however, is difficult due to the behavioral complexity of the models and the challenges that are brought in by the data, such as noise, partial observability or sparsity of the measurements.
For instance, consider a typical optimization problem: when trying to fit a model to data, the “loss”(a measure of how far the model is from the data) may have multiple local minima. A local minimum is the point where the optimizer may get stuck, leaving a subpar solution. This challenge becomes apparent in high-dimensional systems, where the loss landscape is convoluted with many valleys and peaks.
JuliaSim Model Optimizer
JuliaSimModelOptimizer.jl has been designed to address this challenge. It offers various strategies to traverse complex loss landscapes and avoid local minima. In their JuliaCon session this year, Sathvik Bhagavan and Sebastian Micluța-Câmpeanu, spoke about Robust Calibration of Industrial HVAC and Battery Systems.
They explored techniques like Single Shooting, Multiple Shooting, Collocation and Prediction Error Method exemplified on HVAC and Battery systems and demonstrated how they can help avoid local minima during calibration procedures. To show the robustness of the results, they compared the loss landscape surfaces corresponding to naive calibration approaches, such as Single Shooting with more advanced ones, such as Multiple Shooting and Prediction Error Method in order to show how they smooth out the loss landscape, making the optimization problem easier to solve.
ModelingToolkit.jl provides a scalable and performant way of building large scale models for industrial systems due to its advanced symbolic manipulation techniques and its acasual nature.
The JuliaSim Model Library includes high performance, composable, domain specific tools for industrial systems. JuliaSim-HVAC is one such component, which can be used to describe refrigeration, air conditioning systems etc. Additionally, JuliaSim-Batteries can be used to design and simulate electrochemical models of large battery packs.
Robust Calibration Techniques
At JuliaCon 2024, the presenters showcased the capabilities of JuliaSimModelOptimizer, with particular focus on its strengths for parameter estimation and model optimization. JuliaSimModelOptimizer is an offering from JuliaHub designed for parameter estimation and model optimization, ensuring that models align with real-world data.
The problem it tackles is the complexity of fitting high-dimensional models to data. When working with intricate models, calibrating them to match real-world data can be challenging, especially due to local minima in the optimization process. If an optimizer starts at the wrong point, it can get stuck in a local minimum, failing to reach the global minimum one aims for.
One approach to avoid this is by using "multiple shooting," where a trajectory is split into smaller segments. Each segment is optimized separately, which helps avoid getting stuck in local minima. Ensuring continuity between these segments can be done either by applying constraints in the optimizer or using a penalty function. Over time, this method helps the segments converge and form a continuous, optimized solution.
Another powerful method is the Prediction Error Method (PEM), which smooths the loss landscape. Instead of having many local minima, it transforms the loss function to a more manageable shape, making it easier for the optimizer to find the global minimum. This is crucial in systems with many variables and complex models.
JuliaSim and ModelingToolkit.jl
One of the key advantages here is JuliaSim, a cloud-based platform for model-based design. JuliaSim integrates JuliaSim Model Optimizer for seamless parameter estimation and allows users to drag and drop components to build models and perform analyses directly within the interface.
With JuliaSim, you can easily upload datasets, specify variables, and select the optimizer type and loss functions. The optimization runs in the cloud, allowing you to leave the process running without the need to keep your system active. Results can then be plotted, and calibrated parameters are displayed once the optimization is complete.
For their example, they used Optimizer on an HVAC model—a vapor compression cycle, looking for parameters like the correlation between pressure drop and flow rate, which are difficult to measure directly. The goal is to find these values by calibrating the model to match experimental data. By using experimental data and the prediction error method, the Optimizer adjusted the model to match the data and provide more accurate results.
JuliaSimModelOptimizer works seamlessly with models built using ModelingToolkit, leveraging the SciML ecosystem. Users can define experiments, specify parameters to optimize, and set bounds. The Optimizer supports multiple calibration algorithms, including single and multiple shooting, each with its own configurations.
When comparing single shooting to multiple shooting with PEM, multiple shooting often yields better results, especially in complex systems with noisy data. By breaking the problem into smaller segments, the Optimizer can handle the challenges of complex loss surfaces more effectively.
You can watch the full presentation here.