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 |
ResistanceVolumeFlowReversal
|
System demonstrating impact of allowFlowReversal on number/size of non-linear systems |
SimpleHouse
|
Illustrative example of a simple heating, ventilation and room model |
Performance
|
Package of examples that demonstrate computation speed performance |
System demonstrating impact of allowFlowReversal on number/size of non-linear systems
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.ConservationEquationcode.
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 reliable 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
Type | Name | Default | Description |
Real | m_flow_nominal | 0.1 | Gain value multiplied with input signal |
Modelica definition
model ResistanceVolumeFlowReversal
extends Modelica.Icons.Example;
package Medium =
Modelica.Media.Water.ConstantPropertyLiquidWater;
parameter Real m_flow_nominal=0.1 ;
Buildings.Fluid.Sources.Boundary_pT bou(
redeclare package Medium = Medium,
nPorts=1) ;
Movers.FlowControlled_m_flow pump(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal,
filteredSpeed=false,
allowFlowReversal=allowFlowReversal.k,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
nominalValuesDefineDefaultPressureCurve=true) ;
Buildings.Fluid.HeatExchangers.HeaterCooler_T hea(
redeclare package Medium = Medium,
dp_nominal=1000,
Q_flow_maxHeat=1000,
Q_flow_maxCool=0,
m_flow_nominal=m_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
allowFlowReversal=allowFlowReversal.k) ;
Modelica.Blocks.Sources.Pulse pulse(period=1000) ;
Modelica.Blocks.Math.Gain gain(k=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) ;
Modelica.Blocks.Sources.Constant const(k=0.5) ;
Modelica.Blocks.Sources.BooleanConstant allowFlowReversal(k=false) ;
Buildings.Fluid.FixedResistances.FixedResistanceDpM[nRes.k] res(
redeclare package Medium = Medium,
each allowFlowReversal=allowFlowReversal.k,
each m_flow_nominal=m_flow_nominal,
each dp_nominal=1000) ;
Modelica.Blocks.Sources.IntegerConstant nRes(k=10) ;
Delays.DelayFirstOrder[nRes.k] vol(
redeclare each package Medium = Medium,
each m_flow_nominal=m_flow_nominal,
each nPorts=2,
each energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
each massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
each allowFlowReversal=true) ;
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;
Illustrative example of a simple heating, ventilation and room model
Information
This model contains a simple model of a house
with a heating system, ventilation and weather boundary conditions.
It servers as a demonstration case of how the Buildings
library can be used.
This model was demonstrated at the joint Annex 60 and
IBPSA-NVL meeting in Leuven on 18 September 2015.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
Area | A_wall | 100 | Wall area [m2] |
Volume | V_zone | A_wall*3 | Wall area [m3] |
MassFlowRate | m_flow_nominal | 3*rad.m_flow_nominal | Nominal mass flow rate [kg/s] |
PressureDifference | dp_nominal | 200 | Pressure drop at nominal mass flow rate [Pa] |
Boolean | allowFlowReversal | false | = false because flow will not reverse in these circuits |
Connectors
Type | Name | Description |
Bus | weaBus1 | Weather data bus |
Modelica definition
model SimpleHouse
extends Modelica.Icons.Example;
package MediumAir =
Buildings.Media.Air;
package MediumWater =
Buildings.Media.Water;
parameter Modelica.SIunits.Area A_wall = 100 ;
parameter Modelica.SIunits.Volume V_zone = A_wall*3 ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal=3*rad.m_flow_nominal ;
parameter Modelica.SIunits.PressureDifference dp_nominal=200 ;
parameter Boolean allowFlowReversal=false ;
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor walCap(C=10*A_wall*0.1
*1000*1000, T(fixed=true)) ;
MixingVolumes.MixingVolume zone(
redeclare package Medium = MediumAir,
V=V_zone,
nPorts=2,
m_flow_nominal=0.01,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) ;
Modelica.Thermal.HeatTransfer.Components.ThermalResistor convRes(R=1/2/A_wall) ;
HeatExchangers.Radiators.RadiatorEN442_2 rad(
redeclare package Medium = MediumWater,
Q_flow_nominal=3000,
T_a_nominal=273.15 + 70,
T_b_nominal=273.15 + 50,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
allowFlowReversal=allowFlowReversal) ;
Sources.Boundary_pT bouAir(
redeclare package Medium = MediumAir, nPorts=2,
T=273.15 + 10) ;
Sources.Boundary_pT bouWat(
redeclare package Medium = MediumWater, nPorts=1) ;
BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos") ;
BoundaryConditions.WeatherData.Bus weaBus1 ;
Modelica.Thermal.HeatTransfer.Components.ThermalResistor wallRes(R=0.25/
A_wall/0.04) ;
Buildings.HeatTransfer.Sources.PrescribedTemperature Tout ;
HeatExchangers.HeaterCooler_u hea(
redeclare package Medium = MediumWater,
m_flow_nominal=m_flow_nominal,
dp_nominal=1000,
Q_flow_nominal=5000,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
allowFlowReversal=allowFlowReversal);
Movers.FlowControlled_m_flow pump2(
redeclare package Medium = MediumWater,
filteredSpeed=false,
m_flow_nominal=m_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
allowFlowReversal=allowFlowReversal,
nominalValuesDefineDefaultPressureCurve=true);
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTemZonAir ;
Actuators.Dampers.VAVBoxExponential vavDam(
redeclare package Medium = MediumAir,
m_flow_nominal=0.01,
dp_nominal=dp_nominal,
from_dp=true) ;
Movers.FlowControlled_dp fan2(
redeclare package Medium = MediumAir,
m_flow_nominal=0.01,
dp_nominal=dp_nominal,
filteredSpeed=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
nominalValuesDefineDefaultPressureCurve=true) ;
Modelica.Blocks.Logical.Hysteresis hysAir(uLow=273.15 + 22, uHigh=273.15 + 24) ;
Modelica.Blocks.Math.BooleanToReal booleanToReal(realTrue=0, realFalse=1) ;
Buildings.HeatTransfer.Sources.PrescribedHeatFlow window ;
HeatExchangers.ConstantEffectiveness hexRec(
redeclare package Medium1 = MediumAir,
redeclare package Medium2 = MediumAir,
m1_flow_nominal=0.01,
m2_flow_nominal=0.01,
eps=0.85,
dp1_nominal=0,
dp2_nominal=0) ;
Modelica.Blocks.Logical.Hysteresis hysRad(uLow=273.15 + 20, uHigh=273.15 + 22) ;
Modelica.Blocks.Math.BooleanToReal booleanToReal1 ;
Modelica.Blocks.Logical.Not not1 ;
Modelica.Blocks.Sources.Constant const_m_flow(k=m_flow_nominal) ;
Modelica.Blocks.Sources.Constant const_dp(k=200) ;
equation
connect(convRes.port_b, walCap.port);
connect(convRes.port_a, zone.heatPort);
connect(weaDat.weaBus, weaBus1);
connect(wallRes.port_b, walCap.port);
connect(Tout.T, weaBus1.TDryBul);
connect(Tout.port, wallRes.port_a);
connect(hea.port_b, rad.port_a);
connect(bouWat.ports[1], hea.port_a);
connect(rad.port_b, pump2.port_a);
connect(senTemZonAir.port, zone.heatPort);
connect(vavDam.port_b, fan2.port_a);
connect(vavDam.port_a, bouAir.ports[2]);
connect(hysAir.y, booleanToReal.u);
connect(booleanToReal.y, vavDam.y);
connect(window.port, walCap.port);
connect(window.Q_flow, weaBus1.HGloHor);
connect(bouAir.ports[1], hexRec.port_b1);
connect(hexRec.port_a1, zone.ports[1]);
connect(fan2.port_b, hexRec.port_a2);
connect(hexRec.port_b2, zone.ports[2]);
connect(rad.heatPortCon, zone.heatPort);
connect(rad.heatPortRad, walCap.port);
connect(hysAir.u, senTemZonAir.T);
connect(hysRad.u, hysAir.u);
connect(not1.y, booleanToReal1.u);
connect(not1.u, hysRad.y);
connect(booleanToReal1.y, hea.u);
connect(hea.port_a, pump2.port_b);
connect(const_m_flow.y, pump2.m_flow_in);
connect(const_dp.y, fan2.dp_in);
end SimpleHouse;
http://simulationresearch.lbl.gov/modelica