modelExample1v1
Extends from Buildings.Fluid.Examples.Performance.BaseClasses.Example1 (Example 1 partial model).
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("Buildings.Fluid.Examples.Performance.Example1v1(allowFlowReversal.k=true, from_dp.k=false)", stopTime=10000, numberOfIntervals=10, method="dassl", resultFile="Example1v1");
simulateModel("Buildings.Fluid.Examples.Performance.Example1v2(from_dp.k=true, allowFlowReversal.k=true)", stopTime=10000, numberOfIntervals=10, method="dassl", resultFile="Example1v2");
simulateModel("Buildings.Fluid.Examples.Performance.Example1v1(allowFlowReversal.k=false, from_dp.k=false)", stopTime=10000, numberOfIntervals=10, method="dassl", resultFile="Example1v1");
simulateModel("Buildings.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.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | m_flow_nominal (from Example1) | 0.1 | Gain value multiplied with input signal |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Buildings.Fluid.Sources.Boundary_pT | bou (from Example1) | Boundary for pressure boundary condition | |
| Fluid.Movers.FlowControlled_m_flow | pump (from Example1) | Pump model with unidirectional flow | |
| Buildings.Fluid.HeatExchangers.Heater_T | hea (from Example1) | Heater | |
| Modelica.Blocks.Sources.Pulse | pulse (from Example1) | Pulse input | |
| Modelica.Blocks.Math.Gain | gain (from Example1) | Gain for m_flow_nominal | |
| Buildings.Fluid.Actuators.Valves.ThreeWayLinear | val (from Example1) | Three way valve with constant input | |
| Modelica.Blocks.Sources.Constant | const (from Example1) | Constant valve set point | |
| Modelica.Blocks.Sources.BooleanConstant | allowFlowReversal (from Example1) | Block for setting allowFlowReversal in components | |
| Buildings.Fluid.FixedResistances.PressureDrop | res (from Example1) | Fluid resistance for splitting flow | |
| Modelica.Blocks.Sources.IntegerConstant | nRes (from Example1) | Number of parallel branches | |
| Modelica.Blocks.Sources.BooleanConstant | from_dp (from Example1) | Block for setting from_dp in res |
Revisions
-
July 14, 2015, by Michael Wetter:
Revised documentation. -
April 17, 2015, by Filip Jorissen:
First implementation.