.IDEAS.Examples.Tutorial.DetailedHouse.DetailedHouse10

Speeding up the code

Information

The previous examples present a rather good computational performance. However, the computation time can significantly increase for larger simulation time due to frequent on/off switching of the heat pump. This effect causes a lot of fast transients that force the solver to take small steps, which takes a lot of time.

Fortunately, many tricks can be used to speed up the solver. The fundamental principle is to remove small time constants from the problem. The example in IDEAS.Examples.Tutorial.DetailedHouse.DetailedHouse10 implements changes that cause the simulation to become almost 3 times faster. By systematically removing fast time constants, the solver can be switched to a simpler method, such as Euler integration, with a fixed time step of 20 seconds.

It is important to note the trade-off between computation time and simulation accuracy when choosing an integration method. While the Euler method is generally much faster than implicit solvers such as Dassl, it is also less accurate, especially for stiff or highly dynamic systems. Using smaller Euler time steps increases simulation accuracy but also increases computation time, whereas larger time steps decrease computation time at the expense of accuracy. Therefore, careful consideration is needed when selecting the solver and time step size, balancing the need for speed and the desired level of accuracy in the simulation results.

These are modest improvements since this small example model behaves rather well. However, for large models, the difference in computation time when using Euler integration can become a factor 1000. The modifications however require a bit of knowledge about solvers and the models that you are using, including some of the more advanced parameters. To learn more about this, we refer to [1, 2, 3].

References

    [1] F. Jorissen, M. Wetter, and L. Helsen. Simulation Speed Analysis and Improvements of Modelica Models for Building Energy Simulation. In 11th International Modelica Conference, Paris, 2015. doi: 10.3384/ecp1511859
    [2] F. Jorissen, M. Wetter, and L. Helsen. Simplifications for hydronic system models in Modelica. Journal of Building Performance Simulation, 11:6, 639-654, 2018. doi: 10.1080/19401493.2017.1421263
    [3] F. Jorissen. Toolchain for Optimal Control and Design of Energy Systems in Buildings. PhD Thesis, KU Leuven, 2018.

Revisions


Generated at 2026-04-15T18:18:36Z by OpenModelicaOpenModelica 1.26.3 using GenerateDoc.mos