Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).
Name | Description |
---|---|
MixingVolume | |
MixingVolumeDryAir | |
MixingVolumeInitialization | |
MixingVolumeMoistAir |
model MixingVolume import Buildings; // package Medium = Buildings.Media.IdealGases.SimpleAir; package Medium = Buildings.Media.PerfectGases.MoistAir; // package Medium = Modelica.Media.Air.MoistAir; Modelica.Blocks.Sources.Ramp P( duration=0.5, startTime=0.5, height=-10, offset=101330); Modelica_Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=293.15, use_p_in=true, nPorts=3); Modelica_Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=3, use_p_in=false, p=101325, T=283.15); Buildings.Fluids.FixedResistances.FixedResistanceDpM res1( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, V=0.1, nPorts=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res2( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res11( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res12( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Modelica_Fluid.Vessels.ClosedVolume vol( redeclare package Medium = Medium, V=0.1, nPorts=2, use_portsData=false); Buildings.Utilities.Diagnostics.AssertEquality assertEquality; Buildings.Fluids.Sensors.EnthalpyFlowRate entFloRat(redeclare package Medium = Medium) "Enthalpy flow rate"; Buildings.Fluids.Sensors.EnthalpyFlowRate entFloRat1(redeclare package Medium = Medium) "Enthalpy flow rate"; Buildings.Fluids.MixingVolumes.MixingVolumeMoistAir vol2( redeclare package Medium = Medium, V=0.1, nPorts=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res21( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res22( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Utilities.Diagnostics.AssertEquality assertEquality1; Buildings.Fluids.Sensors.EnthalpyFlowRate entFloRat2(redeclare package Medium = Medium) "Enthalpy flow rate"; Modelica.Blocks.Sources.Constant zero(k=0); Modelica.Blocks.Sources.Constant TLiq(k=283.15); inner Modelica_Fluid.System system; equation connect(P.y, sou.p_in); connect(res2.port_a, entFloRat.port_b); connect(entFloRat2.H_flow, assertEquality1.u2); connect(zero.y, vol2.mWat_flow); connect(TLiq.y, vol2.TWat); connect(sou.ports[1], res1.port_a); connect(sou.ports[2], res11.port_a); connect(sou.ports[3], res21.port_a); connect(sin.ports[1], res2.port_b); connect(sin.ports[2], res12.port_b); connect(res22.port_b, sin.ports[3]); connect(res1.port_b, vol.ports[1]); connect(vol.ports[2], entFloRat.port_a); connect(res11.port_b, vol1.ports[1]); connect(vol1.ports[2], entFloRat1.port_a); connect(res21.port_b, vol2.ports[1]); connect(vol2.ports[2], entFloRat2.port_a); connect(entFloRat2.port_b, res22.port_a); connect(entFloRat1.port_b, res12.port_a); connect(entFloRat.H_flow, assertEquality.u1); connect(entFloRat.H_flow, assertEquality1.u1); connect(entFloRat1.H_flow, assertEquality.u2); end MixingVolume;
model MixingVolumeDryAir import Buildings; package Medium = Modelica.Media.Air.SimpleAir(T_min=Modelica.SIunits.Conversions.from_degC(-50)) "Medium in the component"; Modelica.Blocks.Sources.Ramp P( height=-10, offset=101330, duration=300, startTime=150); Modelica_Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, nPorts=2, use_p_in=true, p=Medium.p_default, T=293.15); Modelica_Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, use_p_in=false, p=101325, T=283.15, nPorts=2); MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, V=0.1, nPorts=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res11( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res12( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Fluids.Sensors.EnthalpyFlowRate entFloRat1(redeclare package Medium = Medium) "Enthalpy flow rate"; Buildings.Fluids.FixedResistances.FixedResistanceDpM res21( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Fluids.FixedResistances.FixedResistanceDpM res22( redeclare each package Medium = Medium, dp_nominal=5, from_dp=true, m_flow_nominal=2); Buildings.Utilities.Diagnostics.AssertEquality assertEquality1(startTime=0); Buildings.Fluids.Sensors.EnthalpyFlowRate entFloRat2(redeclare package Medium = Medium) "Enthalpy flow rate"; Modelica.Blocks.Sources.Constant zero(k=0); Modelica.Blocks.Sources.Constant TLiq(k=283.15); inner Modelica_Fluid.System system; Buildings.Fluids.MixingVolumes.MixingVolumeDryAir vol2( redeclare package Medium = Medium, V=0.1, nPorts=2); equation connect(res12.port_a, entFloRat1.port_b); connect(res22.port_a, entFloRat2.port_b); connect(entFloRat2.H_flow, assertEquality1.u2); connect(res11.port_b, vol1.ports[1]); connect(entFloRat1.port_a, vol1.ports[2]); connect(res21.port_b, vol2.ports[1]); connect(vol2.ports[2], entFloRat2.port_a); connect(zero.y, vol2.mWat_flow); connect(TLiq.y, vol2.TWat); connect(entFloRat1.H_flow, assertEquality1.u1); connect(sou.ports[1], res11.port_a); connect(sou.ports[2], res21.port_a); connect(res12.port_b, sin.ports[1]); connect(res22.port_b, sin.ports[2]); connect(P.y, sou.p_in); end MixingVolumeDryAir;
model MixingVolumeInitialization package Medium = Modelica.Media.Air.SimpleAir; //package Medium = Buildings.Media.PerfectGases.MoistAir; //package Medium = Buildings.Media.GasesPTDecoupled.SimpleAir; Modelica_Fluid.Sources.Boundary_pT sou1(redeclare package Medium = Medium, p=101330, nPorts=1, T=293.15); Modelica_Fluid.Sources.Boundary_pT sin1(redeclare package Medium = Medium, p=101320, nPorts=1, T=293.15); Modelica_Fluid.Pipes.StaticPipe pipe1( redeclare package Medium = Medium, length=1, diameter=0.25); Modelica_Fluid.Pipes.StaticPipe pipe2( redeclare package Medium = Medium, length=1, diameter=0.25); MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, V=0.1, nPorts=2); inner Modelica_Fluid.System system; equation connect(sou1.ports[1], pipe1.port_a); connect(pipe1.port_b, vol1.ports[1]); connect(vol1.ports[2], pipe2.port_a); connect(pipe2.port_b, sin1.ports[1]); end MixingVolumeInitialization;
model MixingVolumeMoistAir import Buildings; // package Medium = Buildings.Media.PerfectGases.MoistAir; package Medium = Buildings.Media.GasesPTDecoupled.MoistAir; // package Medium = Buildings.Media.GasesPTDecoupled.MoistAirNoLiquid; Buildings.Fluids.MixingVolumes.MixingVolumeMoistAir vol1( redeclare package Medium = Medium, V=1, nPorts=2, use_HeatTransfer=true) "Volume"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TSen "Temperature sensor"; Modelica.Blocks.Sources.Constant XSet(k=0.005) "Set point for water mass fraction"; Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo; Modelica.Blocks.Sources.Constant TSet(k=273.15 + 20) "Set point for temperature"; Buildings.Utilities.Psychrometrics.VaporPressure_X humRat(use_p_in=false) "Conversion from humidity ratio to partial water vapor pressure"; Buildings.Utilities.Psychrometrics.VaporPressure_TDP dewPoi "Dew point temperature"; Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor; Modelica.Blocks.Continuous.Integrator QSen "Sensible heat transfer"; Modelica.Blocks.Continuous.Integrator QWat "Enthalpy of extracted water"; Modelica.Blocks.Sources.RealExpression HWat_flow(y=vol1.HWat_flow) "MoistAir heat flow rate"; Modelica_Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, nPorts=1, T=293.15); Modelica_Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, T=293.15); Modelica.Blocks.Continuous.LimPID PI( Ni=0.1, yMax=1000, k=1, Ti=1, Td=1, controllerType=Modelica.Blocks.Types.SimpleController.PI, wd=0); Modelica.Blocks.Continuous.LimPID PI1( Ni=0.1, Ti=1, controllerType=Modelica.Blocks.Types.SimpleController.PI, k=10, yMax=1, yMin=-1, Td=1); Modelica_Fluid.Sensors.MassFlowRate mIn_flow(redeclare package Medium = Medium); Modelica_Fluid.Sensors.MassFlowRate mOut_flow(redeclare package Medium = Medium); Modelica.Blocks.Math.Add dM_flow(k2=-1); Modelica.Blocks.Math.Gain gai(k=200); Modelica.Blocks.Math.Gain gai1(k=0.1); inner Modelica_Fluid.System system; equation connect(preHeaFlo.port, heatFlowSensor.port_a); connect(heatFlowSensor.Q_flow, QSen.u); connect(HWat_flow.y,QWat. u); connect(TSet.y, PI.u_s); connect(TSen.T, PI.u_m); connect(XSet.y, PI1.u_s); connect(mOut_flow.m_flow, dM_flow.u1); connect(mIn_flow.m_flow, dM_flow.u2); connect(gai.y, preHeaFlo.Q_flow); connect(PI1.y, gai1.u); connect(gai1.y, vol1.mWat_flow); connect(dewPoi.T, vol1.TWat); connect(vol1.XWat, PI1.u_m); connect(vol1.XWat, humRat.XWat); connect(sou.ports[1], mIn_flow.port_a); connect(mOut_flow.port_b, sin.ports[1]); connect(heatFlowSensor.port_b, vol1.heatPort); connect(TSen.port, vol1.heatPort); connect(mIn_flow.port_b, vol1.ports[1]); connect(mOut_flow.port_a, vol1.ports[2]); connect(PI.y, gai.u); connect(humRat.p_w, dewPoi.p_w); end MixingVolumeMoistAir;