Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).
Name | Description |
---|---|
FixedResistance | |
FixedResistancesParallel | |
Resistances | Test of multiple resistances |
SplitterFixedResistanceDpM |
model FixedResistance import Buildings; package Medium = Buildings.Media.ConstantPropertyLiquidWater; Modelica.Blocks.Sources.Constant PAtm(k=101325); Modelica.Blocks.Sources.Ramp P( duration=1, height=20, offset=101315); Buildings.Fluids.FixedResistances.FixedResistanceDpM res1( redeclare package Medium = Medium, from_dp=true, m0_flow=5, dp0=10); Modelica_Fluid.Sources.Boundary_pT sou1( redeclare package Medium = Medium, use_p_in=true, T=293.15, nPorts=3); Modelica_Fluid.Sources.Boundary_pT sin1( redeclare package Medium = Medium, T=283.15, use_p_in=true, nPorts=3); Buildings.Fluids.FixedResistances.FixedResistanceDpM res2( redeclare package Medium = Medium, from_dp=true, m0_flow=5, dp0=10, use_dh=true); Buildings.Fluids.FixedResistances.FixedResistanceDpM res3( redeclare package Medium = Medium, from_dp=true, m0_flow=5, dp0=10, use_dh=true); FixedResistances.LosslessPipe pipCon(redeclare package Medium = Medium) "Lossless pipe connection"; Modelica_Fluid.Sensors.MassFlowRate masFlo2(redeclare package Medium = Medium) "Mass flow rate sensor"; Modelica_Fluid.Sensors.MassFlowRate masFlo3(redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Utilities.Diagnostics.AssertEquality assEqu(threShold=1E-4, message= "Inputs differ, check that lossless pipe is correctly implemented.") "Assert equality of the two mass flow rates"; inner Modelica_Fluid.System system; equation connect(res2.port_b, masFlo2.port_a); connect(res3.port_b, masFlo3.port_a); connect(masFlo3.port_b, pipCon.port_a); connect(P.y, sou1.p_in); connect(sou1.ports[1], res1.port_a); connect(sin1.ports[1], res1.port_b); connect(masFlo3.m_flow, assEqu.u1); connect(masFlo2.m_flow, assEqu.u2); connect(PAtm.y, sin1.p_in); connect(sou1.ports[2], res2.port_a); connect(sou1.ports[3], res3.port_a); connect(sin1.ports[2], masFlo2.port_b); connect(sin1.ports[3], pipCon.port_b); end FixedResistance;
model FixedResistancesParallel import Buildings; package Medium = Buildings.Media.ConstantPropertyLiquidWater; Modelica.Blocks.Sources.Constant PAtm(k=101325); Modelica.Blocks.Sources.Ramp P( duration=1, height=20, offset=101315); Buildings.Fluids.FixedResistances.FixedResistanceDpM res1( redeclare package Medium = Medium, m0_flow=5, dp0=10, deltaM=0.3, linearized=false, from_dp=false); Modelica_Fluid.Sources.Boundary_pT sou1( redeclare package Medium = Medium, T=293.15, nPorts=2, use_p_in=true); Modelica_Fluid.Sources.Boundary_pT sin1( redeclare package Medium = Medium, T=283.15, nPorts=2, use_p_in=true); Buildings.Fluids.FixedResistances.FixedResistanceDpM res2( redeclare package Medium = Medium, m0_flow=5, dp0=10, deltaM=0.3, linearized=false, from_dp=false); Modelica_Fluid.Sensors.MassFlowRate masFlo2(redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Utilities.Diagnostics.AssertEquality assEqu(threShold=1E-4, message= "Inputs differ, check that lossless pipe is correctly implemented.") "Assert equality of the two mass flow rates"; Modelica_Fluid.Sensors.MassFlowRate masFlo1(redeclare package Medium = Medium) "Mass flow rate sensor"; inner Modelica_Fluid.System system(p_ambient=101325); equation connect(PAtm.y, sin1.p_in); connect(P.y, sou1.p_in); connect(res2.port_b, masFlo2.port_a); connect(res1.port_b, masFlo1.port_a); connect(sou1.ports[1], res1.port_a); connect(sou1.ports[2], res2.port_a); connect(sin1.ports[1], masFlo1.port_b); connect(sin1.ports[2], masFlo2.port_b); connect(masFlo2.m_flow, assEqu.u1); connect(masFlo1.m_flow, assEqu.u2); end FixedResistancesParallel;
Type | Name | Default | Description |
---|---|---|---|
Pressure | dp0 | 5 | Nominal pressure drop for each resistance [Pa] |
Integer | nRes | 3 | Number of resistances |
model Resistances "Test of multiple resistances" package Medium = Modelica.Media.Air.SimpleAir; Modelica.Blocks.Sources.Constant PAtm(k=101325); parameter Modelica.SIunits.Pressure dp0 = 5 "Nominal pressure drop for each resistance"; Modelica.Blocks.Sources.Ramp P( duration=1, height=2*dp0*nRes, offset=101325 - dp0*nRes); Modelica_Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 20, use_p_in=true, nPorts=1); Modelica_Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 10, use_p_in=true, nPorts=1); parameter Integer nRes( min=2) = 3 "Number of resistances"; Buildings.Fluids.FixedResistances.FixedResistanceDpM[ nRes] res( redeclare each package Medium = Medium, each dp0=dp0, each from_dp = false, each m0_flow=2); inner Modelica_Fluid.System system(p_ambient=101325); equation for i in 1:nRes-1 loop connect(res[i].port_b, res[i+1].port_a); end for; connect(PAtm.y, sin.p_in); connect(P.y, sou.p_in); connect(sin.ports[1], res[nRes].port_b); connect(sou.ports[1], res[1].port_a); end Resistances;
model SplitterFixedResistanceDpM package Medium = Modelica.Media.Air.SimpleAir; Buildings.Fluids.FixedResistances.SplitterFixedResistanceDpM spl( m0_flow={1,2,3}, dp0={5,10,15}, dh={1,2,3}, redeclare package Medium = Medium) "Splitter"; Modelica_Fluid.Sources.Boundary_pT bou1( redeclare package Medium = Medium, T=273.15 + 10, use_p_in=true, nPorts=1); Modelica_Fluid.Sources.Boundary_pT bou2( redeclare package Medium = Medium, T=273.15 + 20, use_p_in=true, nPorts=1); Modelica_Fluid.Sources.Boundary_pT bou3( redeclare package Medium = Medium, T=273.15 + 30, use_p_in=true, nPorts=1); Modelica.Blocks.Sources.Constant P2(k=101325); Modelica.Blocks.Sources.Ramp P1( offset=101320, height=10, duration=0.5); Modelica.Blocks.Sources.Ramp P3( offset=101320, height=10, duration=0.5, startTime=0.5); inner Modelica_Fluid.System system(p_ambient=101325); equation connect(P1.y, bou1.p_in); connect(P2.y, bou2.p_in); connect(bou3.p_in, P3.y); connect(bou1.ports[1], spl.port_1); connect(bou3.ports[1], spl.port_3); connect(spl.port_2, bou2.ports[1]); end SplitterFixedResistanceDpM;