How to improve the simulation time in a comprehensive Simulink battery model?

7 visualizaciones (últimos 30 días)
Hello,
In my Simulink model I want to simulate a battery pack with about 5000 individual cells. These should differ slightly from each other, which is why I use the generic battery model from Simscape for each cell (I don't have the license for Simscape Battery). Now it is not surprising that the simulation time is very high with this number. However, since the blocks are repeated with serial and parallel connection, I tried to improve the simulation time with Scalable Compilation (Referenced Subsystems) according to the following instructions:
https://de.mathworks.com/help/simscape/ug/prepare-your-model-for-scalable-compilation.html
Contrary to expectations, this worsened the simulation time.
Is there another way to simulate such an extensive model in a reasonable time? I would be very grateful for any suggestions.

Respuesta aceptada

Saurav
Saurav el 23 de Abr. de 2024
Hey Dan,
As I can understand that you are trying to simulate a battery pack with around 5000 individual cells using the “Generic battery model” from Simscape and are facing the issue of high simulation time.
Simulating a large battery pack using the Simscape generic battery model can indeed lead to significant challenges in terms of simulation time and computational resources. Also, using Referenced Subsystems for Scalable Compilation helps reduce compilation time for models that consist of a pattern of repeated components by compiling a repeated component once and then reusing these compilation artifacts, but Scalable Compilation only improves compilation performance; it does not reduce the simulation time of the model. Please refer to the following documentation to learn more about Scalable Compilation:
Here are some workarounds to enhance your simulation speed:
  • Activating ‘Accelerator’ or ‘Rapid Accelerator’ modes in Simulink can notably increase simulation efficiency without the need to modify your model. These modes can be enabled by navigating to the ‘Simulation’ tab and selecting either ‘Accelerator’ or ‘Rapid Accelerator’ from the options under the ‘Simulate’ section.
  • Switching from a variable-step to a fixed-step solver could potentially speed up your simulation. While this may affect accuracy, choosing the maximum step size that still preserves the required accuracy for your project is advisable.
  • Experiment with the different solvers available in Simulink. Some solvers may offer better performance for your specific model configuration. You can adjust the ‘Type’ and ‘Solver’ under the ‘Solver’ section found in Model Configuration Parameters (Ctrl+E) within the Modeling tab to experiment with various solver options.
  • Leveraging MATLAB's Parallel Computing Toolbox allows for the distribution of simulation tasks across multiple processors or GPUs, enhancing speed, especially for Simscape simulations which support parallel execution.
  • Use Simulink Profiler to identify the parts of your model that are most time-consuming and focus your optimization efforts there.
For additional insights, refer to the following documentations:
  1. Ways to optimize performance of Simulink models:
2. Choosing an appropriate Simulation Mode:
I hope that helps!

Más respuestas (0)

Categorías

Más información sobre Creating Custom Components and Libraries en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by