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.
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}
AllowFlowReversal = false
and from_dp = false
Sizes of nonlinear systems of equations: {6, 21}
Sizes after manipulation of the nonlinear systems: {1, 19}
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.