This package contains examples for the use of models that can be found in Buildings.Fluid.Sources.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Name | Description |
---|---|
PrescribedExtraPropertyFlow | |
Outside | Test model for source and sink with outside weather data |
model PrescribedExtraPropertyFlow extends Modelica.Icons.Example; package Medium = Buildings.Media.GasesPTDecoupled.SimpleAir(extraPropertiesNames={"CO2"}); // package Medium = Buildings.Media.GasesPTDecoupled.SimpleAir;MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, nPorts=1, V=100) "Mixing volume"; PrescribedExtraPropertyFlowRate sou(redeclare package Medium = Medium, use_m_flow_in=true); Modelica.Blocks.Sources.Step step( startTime=0.5, height=-2, offset=2); FixedResistances.FixedResistanceDpM res( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, nPorts=1, V=100) "Mixing volume"; PrescribedExtraPropertyFlowRate sou1( redeclare package Medium = Medium, use_m_flow_in=true); Buildings.Utilities.Diagnostics.AssertEquality assEqu(threShold=1E-4) "Assert that both volumes have the same concentration"; Modelica.Blocks.Sources.RealExpression reaExp(y=vol.mC[1]); Modelica.Blocks.Sources.RealExpression reaExp1(y=vol1.mC[1]); MixingVolumes.MixingVolume vol2( redeclare package Medium = Medium, nPorts=2, p_start=Medium.p_default, V=100) "Mixing volume"; MixingVolumes.MixingVolume vol3( redeclare package Medium = Medium, nPorts=2, p_start=Medium.p_default, V=100) "Mixing volume"; Buildings.Fluid.FixedResistances.SplitterFixedResistanceDpM spl( redeclare package Medium = Medium, m_flow_nominal={1,1,1}, dp_nominal={1,1,1}, from_dp=false); Buildings.Utilities.Diagnostics.AssertEquality assEqu1( threShold=1E-4) "Assert that both volumes have the same concentration"; Modelica.Blocks.Sources.RealExpression reaExp2(y=vol2.mC[1]); Modelica.Blocks.Sources.RealExpression reaExp3(y=vol3.mC[1]); MixingVolumes.MixingVolume vol4( redeclare package Medium = Medium, nPorts=3, p_start=Medium.p_default, V=100) "Mixing volume"; PrescribedExtraPropertyFlowRate sou2( redeclare package Medium = Medium, use_m_flow_in=true); Buildings.Fluid.Sources.Boundary_pT bou( redeclare package Medium = Medium, p=101325, nPorts=1, T=293.15); Buildings.Fluid.Sources.Boundary_pT bou1( redeclare package Medium = Medium, nPorts=2, p=101320, T=293.15); FixedResistances.FixedResistanceDpM res1( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; FixedResistances.FixedResistanceDpM res2( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; FixedResistances.FixedResistanceDpM res3( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; inner Modelica.Fluid.System system; equationconnect(reaExp.y, assEqu.u1); connect(reaExp1.y, assEqu.u2); connect(reaExp2.y, assEqu1.u1); connect(reaExp3.y, assEqu1.u2); connect(vol4.ports[2], spl.port_3); connect(spl.port_1, vol2.ports[1]); connect(spl.port_2, vol3.ports[1]); connect(res2.port_a, vol3.ports[2]); connect(res1.port_a, vol2.ports[2]); connect(res3.port_b, vol4.ports[3]); connect(res1.port_b, bou1.ports[1]); connect(res2.port_b, bou1.ports[2]); connect(bou.ports[1], res3.port_a); connect(sou.ports, vol.ports); connect(sou1.ports[1], res.port_a); connect(res.port_b, vol1.ports[1]); connect(sou2.ports[1], vol4.ports[1]); connect(step.y, sou.m_flow_in); connect(step.y, sou1.m_flow_in); connect(step.y, sou2.m_flow_in); end PrescribedExtraPropertyFlow;
model Outside "Test model for source and sink with outside weather data" extends Modelica.Icons.Example; package Medium = Buildings.Media.GasesConstantDensity.MoistAirUnsaturated "Medium model for air";Buildings.Fluid.Sources.Outside bou(redeclare package Medium = Medium, nPorts= 1) "Model with outside conditions"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= "Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"); MassFlowSource_T sin(redeclare package Medium = Medium, m_flow=-1, nPorts=1) "Sink"; Sensors.TemperatureTwoPort senTem(redeclare package Medium = Medium, m_flow_nominal=1) "Temperature sensor"; Sensors.RelativeHumidityTwoPort senRelHum(redeclare package Medium = Medium, m_flow_nominal=1); Sensors.MassFractionTwoPort senMasFra(redeclare package Medium = Medium, m_flow_nominal=1) "Sensor for mass fraction of water"; equationconnect(weaDat.weaBus, bou.weaBus); connect(senTem.port_b, sin.ports[1]); connect(senRelHum.port_a, bou.ports[1]); connect(senRelHum.port_b, senMasFra.port_a); connect(senMasFra.port_b, senTem.port_a); end Outside;