Buildings.Fluid.Actuators.Valves.Examples

Collection of models that illustrate model use and test models

Information

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

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

Package Content

Name Description
Buildings.Fluid.Actuators.Valves.Examples.ThreeWayValves ThreeWayValves Three way valves with different opening characteristics
Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvePressureIndependent TwoWayValvePressureIndependent Two way valves with pressure independent opening characteristic
Buildings.Fluid.Actuators.Valves.Examples.TwoWayValveTable TwoWayValveTable Two way valve with nonlinear opening characteristics based on a table
Buildings.Fluid.Actuators.Valves.Examples.TwoWayValves TwoWayValves Two way valves with different opening characteristics
Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesMotor TwoWayValvesMotor Two way valves with different opening characteristics and motor
Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesTable TwoWayValvesTable Two way valve with linear opening characteristics

Buildings.Fluid.Actuators.Valves.Examples.ThreeWayValves Buildings.Fluid.Actuators.Valves.Examples.ThreeWayValves

Three way valves with different opening characteristics

Buildings.Fluid.Actuators.Valves.Examples.ThreeWayValves

Information

Test model for three way valves. Note that the leakage flow rate has been set to a large value and the rangeability to a small value for better visualization of the valve characteristics. To use common values, use the default values.

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

Modelica definition

model ThreeWayValves "Three way valves with different opening characteristics" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium in the component"; Buildings.Fluid.Actuators.Valves.ThreeWayLinear valLin( redeclare package Medium = Medium, l={0.05,0.05}, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Valve model, linear opening characteristics"; Modelica.Blocks.Sources.Ramp y( height=1, duration=1, offset=0) "Control signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, nPorts=2, use_p_in=true, T=313.15) "Boundary condition for flow source"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=2, use_p_in=true, T=313.15) "Boundary condition for flow sink"; Modelica.Blocks.Sources.Constant PSin(k=3E5); Modelica.Blocks.Sources.Constant PSou(k=306000); Actuators.Valves.ThreeWayEqualPercentageLinear valEquPerLin( l={0.05,0.05}, redeclare package Medium = Medium, R=10, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Buildings.Fluid.Sources.Boundary_pT ret( redeclare package Medium = Medium, nPorts=2, use_p_in=true, T=303.15) "Boundary condition for flow sink"; equation connect(y.y, valLin.y); connect(PSin.y, sin.p_in); connect(y.y, valEquPerLin.y); connect(sou.ports[1], valLin.port_1); connect(sou.ports[2], valEquPerLin.port_1); connect(valLin.port_2, sin.ports[1]); connect(valEquPerLin.port_2, sin.ports[2]); connect(PSou.y, ret.p_in); connect(ret.ports[1], valLin.port_3); connect(ret.ports[2], valEquPerLin.port_3); connect(PSou.y, sou.p_in); end ThreeWayValves;

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvePressureIndependent Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvePressureIndependent

Two way valves with pressure independent opening characteristic

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvePressureIndependent

Information

Test model for pressure independent valves. Note that the leakage at full mass flow rate (l2) has been set to a large value for better visualization of the valve characteristics. To use common values, use the default values.

The parameter filterOpening is set to false, as this model is used to plot the flow at different opening signals without taking into account the travel time of the actuator.

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

Modelica definition

model TwoWayValvePressureIndependent "Two way valves with pressure independent opening characteristic" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Modelica.Blocks.Sources.Ramp y( height=1, duration=1, offset=0) "Control signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, use_p_in=true, T=293.15, nPorts=3) "Boundary condition for flow source"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, p(displayUnit="Pa") = 3E5, T=293.15, nPorts=3) "Boundary condition for flow sink"; TwoWayPressureIndependent valInd( redeclare package Medium = Medium, m_flow_nominal=1, CvData=Buildings.Fluid.Types.CvTypes.OpPoint, use_inputFilter=false, l=0.05, from_dp=true, dpFixed_nominal=0, l2=0.1, dpValve_nominal=10000) "Pressure independent valve"; Modelica.Blocks.Sources.Ramp dp( duration=1, startTime=1, offset=303000, height=12000) "Pressure ramp"; TwoWayPressureIndependent valIndDpFix( redeclare package Medium = Medium, m_flow_nominal=1, CvData=Buildings.Fluid.Types.CvTypes.OpPoint, use_inputFilter=false, l=0.05, dpFixed_nominal=5000, from_dp=true, l2=0.1, dpValve_nominal=10000) "Pressure independent valve using dp_Fixed_nominal"; TwoWayPressureIndependent valIndFromMflow( redeclare package Medium = Medium, m_flow_nominal=1, CvData=Buildings.Fluid.Types.CvTypes.OpPoint, use_inputFilter=false, l=0.05, from_dp=false, dpFixed_nominal=0, l2=0.1, dpValve_nominal=10000) "Pressure independent valve using from_dp = false"; equation connect(valInd.y, y.y); connect(sou.ports[1], valInd.port_a); connect(valInd.port_b, sin.ports[1]); connect(dp.y, sou.p_in); connect(valIndDpFix.port_a, sou.ports[2]); connect(valIndDpFix.port_b, sin.ports[2]); connect(valIndFromMflow.port_a, sou.ports[3]); connect(valIndFromMflow.port_b, sin.ports[3]); connect(y.y, valIndDpFix.y); connect(y.y, valIndFromMflow.y); end TwoWayValvePressureIndependent;

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValveTable Buildings.Fluid.Actuators.Valves.Examples.TwoWayValveTable

Two way valve with nonlinear opening characteristics based on a table

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValveTable

Information

Test model for a two way valve in which a table is used to specify the opening characteristics. The valve has the following opening characteristics, which is taken from a test case of the IEA EBC Annex 60 project.

y 0 0.1667 0.3333 0.5 0.6667 1
Kv 0 0.19 0.35 0.45 0.5 0.65

The Kv value is the volume flow rate in m3/h at a pressure difference of 1 bar. Hence, the Kv value of the fully open valve is Kv=0.65.

Plotting the variables kv.y versus y.y shows that the valve reproduces the Kv values shown in the above table.

image

The parameter filterOpening is set to false, as this model is used to plot the flow at different opening signals without taking into account the travel time of the actuator.

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

Parameters

TypeNameDefaultDescription
GenericdatValdatVal( y={0,0.1667,0.3333...Valve characteristics

Modelica definition

model TwoWayValveTable "Two way valve with nonlinear opening characteristics based on a table" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium"; Modelica.Blocks.Sources.Ramp y( height=1, duration=1, offset=0) "Control signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, use_p_in=false, p(displayUnit="Pa") = 306000, T=293.15, nPorts=1) "Boundary condition for flow source"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, p(displayUnit="Pa") = 3E5, T=293.15, nPorts=1) "Boundary condition for flow sink"; Valves.TwoWayTable valTab( redeclare package Medium = Medium, use_inputFilter=false, from_dp=true, flowCharacteristics=datVal, CvData=Buildings.Fluid.Types.CvTypes.Kv, Kv=0.65, m_flow_nominal=0.04) "Valve model with opening characteristics based on a table"; parameter Data.Generic datVal( y={0,0.1667,0.3333,0.5,0.6667,1}, phi={0, 0.19, 0.35, 0.45, 0.5, 0.65}/0.65) "Valve characteristics"; Modelica.Blocks.Math.UnitConversions.To_bar to_bar; Sensors.RelativePressure senRelPre(redeclare package Medium = Medium) "Pressure differential sensor"; Sensors.VolumeFlowRate senVolFlo(redeclare package Medium = Medium, m_flow_nominal=0.04) "Volume flow rate sensor"; Modelica.Blocks.Math.Sqrt sqrt1; Modelica.Blocks.Math.Gain to_m3_h(k=3600) "Conversion to m3/h"; Modelica.Blocks.Math.Division kv "Kv-value"; equation connect(y.y,valTab. y); connect(sou.ports[1], senVolFlo.port_a); connect(senVolFlo.port_b, valTab.port_a); connect(valTab.port_a, senRelPre.port_a); connect(valTab.port_b, senRelPre.port_b); connect(valTab.port_b, sin.ports[1]); connect(to_bar.u, senRelPre.p_rel); connect(sqrt1.u, to_bar.y); connect(senVolFlo.V_flow, to_m3_h.u); connect(to_m3_h.y,kv. u1); connect(sqrt1.y,kv. u2); end TwoWayValveTable;

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValves Buildings.Fluid.Actuators.Valves.Examples.TwoWayValves

Two way valves with different opening characteristics

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValves

Information

Test model for two way valves. Note that the leakage flow rate has been set to a large value and the rangeability to a small value for better visualization of the valve characteristics. To use common values, use the default values.

The parameter filterOpening is set to false, as this model is used to plot the flow at different opening signals without taking into account the travel time of the actuator.

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

Modelica definition

model TwoWayValves "Two way valves with different opening characteristics" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Buildings.Fluid.Actuators.Valves.TwoWayLinear valLin( redeclare package Medium = Medium, l=0.05, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000) "Valve model, linear opening characteristics"; Modelica.Blocks.Sources.Ramp y( height=1, duration=1, offset=0) "Control signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, nPorts=5, use_p_in=false, p(displayUnit="Pa") = 306000, T=293.15) "Boundary condition for flow source"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=5, p(displayUnit="Pa") = 3E5, T=293.15) "Boundary condition for flow sink"; Buildings.Fluid.Actuators.Valves.TwoWayQuickOpening valQui( redeclare package Medium = Medium, l=0.05, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000) "Valve model, quick opening characteristics"; Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage valEqu( redeclare package Medium = Medium, l=0.05, R=10, delta0=0.1, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000) "Valve model, equal percentage opening characteristics"; TwoWayPressureIndependent valInd( redeclare package Medium = Medium, m_flow_nominal=1, CvData=Buildings.Fluid.Types.CvTypes.OpPoint, dpValve_nominal=10000, use_inputFilter=false, l=0.05, l2=0.01); TwoWayPolynomial valPol( c={0,0.5304,-0.7698,1.2278}, l=0.05, m_flow_nominal=1, dpValve_nominal=10000, use_inputFilter=false, redeclare package Medium = Medium, CvData=Buildings.Fluid.Types.CvTypes.OpPoint) "Valve with polynomial opening characteristic"; equation connect(y.y, valLin.y); connect(y.y, valQui.y); connect(y.y, valEqu.y); connect(sou.ports[1], valLin.port_a); connect(valQui.port_a, sou.ports[2]); connect(valEqu.port_a, sou.ports[3]); connect(valLin.port_b, sin.ports[1]); connect(valQui.port_b, sin.ports[2]); connect(valEqu.port_b, sin.ports[3]); connect(valInd.y, y.y); connect(valInd.port_b, sin.ports[4]); connect(valInd.port_a, sou.ports[4]); connect(valPol.port_b, sin.ports[5]); connect(valPol.port_a, sou.ports[5]); connect(valPol.y, y.y); end TwoWayValves;

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesMotor Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesMotor

Two way valves with different opening characteristics and motor

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesMotor

Information

Test model for two way valves. Note that the leakage flow rate has been set to a large value and the rangeability to a small value for better visualization of the valve characteristics. To use common values, use the default values.

All valves are connected to a model of a motor with hysteresis. A more efficient implementation that approximates a motor but lacks hysteresis would be to set the valve parameter use_inputFilter=true instead of using the motor model.

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

Modelica definition

model TwoWayValvesMotor "Two way valves with different opening characteristics and motor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Buildings.Fluid.Actuators.Valves.TwoWayLinear valLin( redeclare package Medium = Medium, l=0.05, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000) "Valve model, linear opening characteristics"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, nPorts=4, use_p_in=true, T=293.15) "Boundary condition for flow source"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=4, use_p_in=true, T=293.15) "Boundary condition for flow sink"; Modelica.Blocks.Sources.Constant PSin(k=3E5); Modelica.Blocks.Sources.Constant PSou(k=306000); Buildings.Fluid.Actuators.Valves.TwoWayQuickOpening valQui( redeclare package Medium = Medium, l=0.05, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000) "Valve model, quick opening characteristics"; Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage valEqu( redeclare package Medium = Medium, l=0.05, R=10, delta0=0.1, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000) "Valve model, equal percentage opening characteristics"; Modelica.Blocks.Sources.TimeTable ySet(table=[0,0; 60,0; 60,1; 120,1; 180,0.5; 240,0.5; 300,0; 360,0; 360,0.25; 420,0.25; 480,1; 540,1.5; 600,-0.25]) "Set point for actuator"; Actuators.Motors.IdealMotor mot( tOpe=60) "Motor model"; TwoWayPressureIndependent valInd( redeclare package Medium = Medium, m_flow_nominal=1, CvData=Buildings.Fluid.Types.CvTypes.OpPoint, dpValve_nominal=10000, use_inputFilter=false, l=0.05, l2=0.01); equation connect(PSin.y, sin.p_in); connect(PSou.y, sou.p_in); connect(ySet.y, mot.u); connect(mot.y, valEqu.y); connect(mot.y, valQui.y); connect(mot.y, valLin.y); connect(sou.ports[1], valLin.port_a); connect(sou.ports[2], valQui.port_a); connect(sou.ports[3], valEqu.port_a); connect(valLin.port_b, sin.ports[1]); connect(valQui.port_b, sin.ports[2]); connect(valEqu.port_b, sin.ports[3]); connect(valInd.port_a, sou.ports[4]); connect(valInd.port_b, sin.ports[4]); connect(valInd.y, valEqu.y); end TwoWayValvesMotor;

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesTable Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesTable

Two way valve with linear opening characteristics

Buildings.Fluid.Actuators.Valves.Examples.TwoWayValvesTable

Information

Test model for two way valves. The instance valTab has a linear opening characteristics based on a table, while valLin also has a linear opening characteristics that is directly implemented in the model. For practical applications in which valves with linear opening characteristics are used, one should use valLin rather than valTab as valLin is a more efficient implementation.

This test demonstrates that both valves have, as expected, the same mass flow rate for the whole range of the opening signal.

The parameter filterOpening is set to false, as this model is used to plot the flow at different opening signals without taking into account the travel time of the actuator.

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

Modelica definition

model TwoWayValvesTable "Two way valve with linear opening characteristics" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium"; Modelica.Blocks.Sources.Ramp y( height=1, duration=1, offset=0) "Control signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, nPorts=2, use_p_in=false, p(displayUnit="Pa") = 306000, T=293.15) "Boundary condition for flow source"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=2, p(displayUnit="Pa") = 3E5, T=293.15) "Boundary condition for flow sink"; Valves.TwoWayTable valTab( redeclare package Medium = Medium, m_flow_nominal=2, use_inputFilter=false, dpValve_nominal=6000, flowCharacteristics=Buildings.Fluid.Actuators.Valves.Data.Linear(), from_dp=true) "Valve model with opening characteristics based on a table"; TwoWayLinear valLin( use_inputFilter=false, redeclare package Medium = Medium, l=0.0001, m_flow_nominal=2, dpValve_nominal=6000, from_dp=true) "Valve model with linear opening characteristics"; equation connect(y.y,valTab. y); connect(valTab.port_a, sou.ports[1]); connect(valTab.port_b, sin.ports[1]); connect(valLin.y, y.y); connect(sou.ports[2], valLin.port_a); connect(valLin.port_b, sin.ports[2]); end TwoWayValvesTable;