.IBPSA.Fluid.Examples.Performance.Example5

Information

This example illustrates the impact of Modelica code formulations on the C-code.

Compare the C-code in dsmodel.c when setting the parameter efficient to true or false and when adding annotation(Evaluate=true) to the parameter efficient.

This produces:

Efficient = false and Evaluate = false

helpvar[0] = sin(Time);
F_[0] = helpvar[0]*(IF DP_[0] THEN W_[0] ELSE DP_[1]+DP_[2]+DP_[3]);

Efficient = false and Evaluate = true

helpvar[0] = sin(Time);
F_[0] = helpvar[0]*(DP_[0]+DP_[1]+DP_[2]);

Efficient = true and Evaluate = true

helpvar[0] = sin(Time);
F_[0] = helpvar[0]*W_[1];

The last option requires much less operations to be performed and is therefore more efficient.

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

References

Revisions


Generated at 2024-12-23T19:25:42Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos