BuildingSystems.Fluid.Examples.Performance.Example1v1

# .BuildingSystems.Fluid.Examples.Performance.Example1v1

Example 1 model without mixing volume

## Information

This model demonstrates the impact of the `allowFlowReversal` and `from_dp` parameters on the sizes of nonlinear algebraic loops. The user can change the parameter value in the respective `BooleanConstant` blocks and rerun the simulation to compare the performance. The results are also demonstrated below for `nRes.k = 20`, the number of parallel branches, which contain one pressure drop element each.

These results were generated using Dymola 2015FD01 64 bit on Ubuntu 14.04.

#### Default case:

`AllowFlowReversal = true` and `from_dp = false`

Sizes of nonlinear systems of equations: {6, 21, 46}

Sizes after manipulation of the nonlinear systems: {1, 19, 22}

#### Change 1:

`AllowFlowReversal = false` and `from_dp = false`

Sizes of nonlinear systems of equations: {6, 21}

Sizes after manipulation of the nonlinear systems: {1, 19}

#### Change 2:

`AllowFlowReversal = false` and `from_dp = true`

Sizes of nonlinear systems of equations: {6, 21}

Sizes after manipulation of the nonlinear systems: {1, 1}

These changes also have a significant impact on the computational speed.

Following script can be used in Dymola to compare the CPU times. For this script to work, make sure that Dymola stores at least 4 results.

`cpuOld=OutputCPUtime;
evaluateOld=Evaluate;
OutputCPUtime:=true;
simulateModel("BuildingSystems.Fluid.Examples.Performance.Example1v1(allowFlowReversal.k=true, from_dp.k=false)", stopTime=10000, numberOfIntervals=10, method="dassl", resultFile="Example1v1");
simulateModel("BuildingSystems.Fluid.Examples.Performance.Example1v2(from_dp.k=true, allowFlowReversal.k=true)", stopTime=10000, numberOfIntervals=10, method="dassl", resultFile="Example1v2");
simulateModel("BuildingSystems.Fluid.Examples.Performance.Example1v1(allowFlowReversal.k=false, from_dp.k=false)", stopTime=10000, numberOfIntervals=10, method="dassl", resultFile="Example1v1");
simulateModel("BuildingSystems.Fluid.Examples.Performance.Example1v1(allowFlowReversal.k=false, from_dp.k=true)", stopTime=10000, numberOfIntervals=10, method="dassl", resultFile="Example1v1");
createPlot(id=1, position={15, 10, 592, 421}, range={0.0, 10000.0, -0.01, 0.35}, autoscale=false, grid=true);
plotExpression(apply(Example1v1[end-2].CPUtime), false, "Default case", 1);
plotExpression(apply(Example1v2[end].CPUtime), false, "Adding dummy states", 1);
plotExpression(apply(Example1v1[end-1].CPUtime), false, "allowFlowReversal=false", 1);
plotExpression(apply(Example1v1[end].CPUtime), false, "allowFlowReversal=false, from_dp=true", 1);
OutputCPUtime=cpuOld;
Evaluate=evaluateOld;`

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

#### References

- Filip Jorissen, Michael Wetter and Lieve Helsen.
  Simulation speed analysis and improvements of Modelica models for building energy simulation.
  Submitted: 11th Modelica Conference. Paris, France. Sep. 2015.

## Revisions

- July 14, 2015, by Michael Wetter:
  Revised documentation.
- April 17, 2015, by Filip Jorissen:
  First implementation.

Generated at 2026-05-12T20:19:03Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos