.Buildings.Fluid.Examples.Performance.Example6

Information

This example, together with Buildings.Fluid.Examples.Performance.Example7, illustrates the overhead generated by divisions by parameters. See Jorissen et al. (2015) for a complementary discussion.

Running the following commands allows comparing the CPU times of the two models, disregarding as much as possible the influence of the integrator:

simulateModel("Buildings.Fluid.Examples.PerformanceExamples.Example6", stopTime=100, numberOfIntervals=1, method="Rkfix4", fixedstepsize=0.001, resultFile="Example6");
simulateModel("Buildings.Fluid.Examples.PerformanceExamples.Example7", stopTime=100, numberOfIntervals=1, method="Rkfix4", fixedstepsize=0.001, resultFile="Example7");

Comparing the CPU times indicates a speed improvement of 56%. This difference almost disappears when adding annotation(Evaluate=true) to R and C.

In dsmodel.c we find:

DynamicsSection
W_[2] = divmacro(X_[0]-X_[1],"T[1]-T[2]",DP_[0],"R");
F_[0] = divmacro(W_[1]-W_[2],"Q_flow[1]-Q_flow[2]",DP_[1],"C");

This suggests that the parameter division needs to be handled during each function evaluation, probably causing the increased overhead.

The following command allows comparing the CPU times objectively.

simulateModel("Buildings.Fluid.Examples.Performance.Example6", stopTime=100, numberOfIntervals=1, method="Euler", fixedstepsize=0.001, resultFile="Example6");

See Jorissen et al. (2015) for a discussion.

References

Revisions


Generated at 2024-04-18T18:15:58Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos