Description: "Collection of models that illustrate model use and test models"

- Home > Modelica

## 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
--- | ---
ThreeWayValves | Three way valves with different opening characteristics
TwoWayValvePressureIndependent | Two way valves with pressure independent opening characteristic
TwoWayValveTable | Two way valve with nonlinear opening characteristics based on a table
TwoWayValves | Two way valves with different opening characteristics
TwoWayValvesMotor | Two way valves with different opening characteristics and motor
TwoWayValvesTable | Two way valve with linear opening characteristics
ValveParameterization | Model to test and illustrate different parameterization for valves

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

Three way valves with different opening characteristics

### 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, filteredOpening=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, filteredOpening=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

Two way valves with pressure independent opening characteristic

### 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, filteredOpening=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, filteredOpening=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, filteredOpening=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

Two way valve with nonlinear opening characteristics based on a table

### 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.

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

Type | Name | Default | Description
--- | --- | --- | ---
Generic | datVal |  | 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, filteredOpening=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

Two way valves with different opening characteristics

### 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, filteredOpening=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=4, 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=4, 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, filteredOpening=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, filteredOpening=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, filteredOpening=false, l=0.05, l2=0.01); 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]); end TwoWayValves;

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

Two way valves with different opening characteristics and motor

### 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 `filteredOpening=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, filteredOpening=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, filteredOpening=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, filteredOpening=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, filteredOpening=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

Two way valve with linear opening characteristics

### 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, filteredOpening=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( filteredOpening=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;

## Buildings.Fluid.Actuators.Valves.Examples.ValveParameterization

Model to test and illustrate different parameterization for valves

### Information

Test model for two way valves. This model tests the different parameterization of the valve model. All valves have approximately the same mass flow rates. Small differences exist due to differences in the mass density that is used to compute the parameters. If the mass flow rates differ by more than 1%, then the assert blocks will terminate the simulation with an error message.

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

### Modelica definition

model ValveParameterization "Model to test and illustrate different parameterization for valves" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Buildings.Fluid.Actuators.Valves.TwoWayLinear valOPPoi( redeclare package Medium = Medium, m_flow_nominal=150/3600, CvData=Buildings.Fluid.Types.CvTypes.OpPoint, dpValve_nominal(displayUnit="kPa") = 4500, filteredOpening=false) "Valve model, linear opening characteristics"; Modelica.Blocks.Sources.Constant y(k=1) "Control signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, use_p_in=true, nPorts=3, T=293.15) "Boundary condition for flow source"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=3, use_p_in=false, p=300000, T=293.15) "Boundary condition for flow sink"; Modelica.Blocks.Sources.Ramp PSou( duration=1, offset=3E5, height=1E5); Valves.TwoWayLinear valKv( redeclare package Medium = Medium, CvData=Buildings.Fluid.Types.CvTypes.Kv, m_flow_nominal=150/3600, Kv=0.73, filteredOpening=false) "Valve model, linear opening characteristics"; Valves.TwoWayLinear valCv( redeclare package Medium = Medium, m_flow_nominal=150/3600, CvData=Buildings.Fluid.Types.CvTypes.Cv, Cv=0.84, filteredOpening=false) "Valve model, linear opening characteristics"; Buildings.Fluid.Sensors.MassFlowRate senM_flowOpPoi(redeclare package Medium = Medium); Buildings.Fluid.Sensors.MassFlowRate senM_flowKv(redeclare package Medium = Medium); Buildings.Fluid.Sensors.MassFlowRate senM_flowCv(redeclare package Medium = Medium); Buildings.Utilities.Diagnostics.AssertEquality equ1(threShold=0.01); Buildings.Utilities.Diagnostics.AssertEquality equ2(threShold=0.01); equation connect(y.y, valOPPoi.y); connect(PSou.y, sou.p_in); connect(y.y, valKv.y); connect(valKv.port_a, sou.ports[2]); connect(sou.ports[3], valCv.port_a); connect(y.y, valCv.y); connect(sou.ports[1], valOPPoi.port_a); connect(valOPPoi.port_b, senM_flowOpPoi.port_a); connect(valKv.port_b, senM_flowKv.port_a); connect(valCv.port_b, senM_flowCv.port_a); connect(senM_flowCv.port_b, sin.ports[3]); connect(senM_flowKv.port_b, sin.ports[2]); connect(senM_flowOpPoi.port_b, sin.ports[1]); connect(senM_flowOpPoi.m_flow, equ1.u1); connect(senM_flowKv.m_flow, equ1.u2); connect(senM_flowKv.m_flow, equ2.u1); connect(senM_flowCv.m_flow, equ2.u2); end ValveParameterization;