Buildings.Fluid.Examples

Example models integrating multiple components

Information

This package contains advanced examples for the use of models that can be found in Buildings.Fluid.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Buildings.Fluid.Examples.ResistanceVolumeFlowReversal ResistanceVolumeFlowReversal System demonstrating impact of allowFlowReversal on number/size of non-linear systems
Buildings.Fluid.Examples.FlowSystem FlowSystem  
Buildings.Fluid.Examples.Performance Performance Package of examples that demonstrate computation speed performance

Buildings.Fluid.Examples.ResistanceVolumeFlowReversal Buildings.Fluid.Examples.ResistanceVolumeFlowReversal

System demonstrating impact of allowFlowReversal on number/size of non-linear systems

Buildings.Fluid.Examples.ResistanceVolumeFlowReversal

Information

This model demonstrates the impact of the allowFlowReversal parameter on the size of nonlinear systems of equations. The user can change the parameter value in the allowFlowReversal block and rerun the simulation. The results are also demonstrated below for nRes.k = 10, which is the number of parallel branches containing one pressure drop element and one mixing volume each.

This model was created to demonstrate the influence of a new implementation of Buildings.Fluid.Interfaces.ConservationEquation. The old implementation used the actualStream() function whereas the new implementation uses the semiLinear() function. This change allows Dymola to exploit knowledge about the min and max attributes of m_flow. When Dymola knows in which way the medium will flow, nonlinear systems can be simplified or completely removed. This is illustrated by the results below. See issue 216 for a discussion.

Note that Dymola 2015FD01 can only reliably solve the last case. For the other two cases the Newton solver of the nonlinear system does not converge.

These results were generated using Dymola 2015FD01 64 bit on Ubuntu 14.04 and with Evaluate=false.

ResistanceVolumeFlowReversal = true

Sizes of nonlinear systems of equations: {6, 11, 56}
Sizes after manipulation of the nonlinear systems: {1, 9, 12}

ResistanceVolumeFlowReversal = false

Old implementation

Sizes of nonlinear systems of equations: {6, 11, 44}
Sizes after manipulation of the nonlinear systems: {1, 9, 11}

New implementation

Sizes of nonlinear systems of equations: {6, 11, 4}
Sizes after manipulation of the nonlinear systems: {1, 9, 1}

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Realm_flow_nominal0.1Gain value multiplied with input signal

Modelica definition

model ResistanceVolumeFlowReversal "System demonstrating impact of allowFlowReversal on number/size of non-linear systems" extends Modelica.Icons.Example; package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater; parameter Real m_flow_nominal=0.1 "Gain value multiplied with input signal"; Buildings.Fluid.Sources.Boundary_pT bou( redeclare package Medium = Medium, nPorts=1) "Boundary for pressure boundary condition"; Movers.FlowControlled_m_flow pump( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, use_inputFilter=false, allowFlowReversal=allowFlowReversal.k, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, nominalValuesDefineDefaultPressureCurve=true) "Pump model with unidirectional flow"; Buildings.Fluid.HeatExchangers.Heater_T hea( redeclare package Medium = Medium, dp_nominal=1000, QMax_flow=1000, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, allowFlowReversal=allowFlowReversal.k) "Heater"; Modelica.Blocks.Sources.Pulse pulse(period=1000) "Pulse input"; Modelica.Blocks.Math.Gain gain(k=m_flow_nominal) "Gain for m_flow_nominal"; Buildings.Fluid.Actuators.Valves.ThreeWayLinear val( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, dpValve_nominal=1000, l={0.002,0.002}, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Three way valve with constant input"; Modelica.Blocks.Sources.Constant const(k=0.5) "Constant valve set point"; Modelica.Blocks.Sources.BooleanConstant allowFlowReversal(k=false) "Block for setting allowFlowReversal in components"; Buildings.Fluid.FixedResistances.PressureDrop[nRes.k] res( redeclare package Medium = Medium, each allowFlowReversal=allowFlowReversal.k, each m_flow_nominal=m_flow_nominal/nRes.k, each dp_nominal=1000) "Fluid resistance for splitting flow"; Modelica.Blocks.Sources.IntegerConstant nRes(k=10) "Number of parallel branches"; Delays.DelayFirstOrder[nRes.k] vol( redeclare each package Medium = Medium, each m_flow_nominal=m_flow_nominal/nRes.k, each nPorts=2, each energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, each allowFlowReversal=true) "Mixing volumes for enthalpy circuit"; equation connect(bou.ports[1],hea. port_a); connect(pulse.y,hea. TSet); connect(pump.m_flow_in, gain.y); connect(gain.u,pulse. y); connect(hea.port_b,val. port_1); connect(val.port_2, pump.port_a); connect(const.y,val. y); connect(val.port_3,hea. port_a); for i in 1:nRes.k loop connect(pump.port_b, res[i].port_a); connect(res[i].port_b, vol[i].ports[1]); connect(vol[i].ports[2], val.port_3); end for; end ResistanceVolumeFlowReversal;