modelPartialTwoWayValve
Extends from Buildings.Fluid.BaseClasses.PartialResistance (Partial model for a hydraulic resistance), Buildings.Fluid.Actuators.BaseClasses.ValveParameters (Model with parameters for valves), Buildings.Fluid.Actuators.BaseClasses.ActuatorSignal (Partial model that implements the filtered opening for valves and dampers).
Information
Partial model for a two way valve. This is the base model for valves with different opening characteristics, such as linear, equal percentage, quick opening or pressure-independent.
To prevent the derivative d/dP (m_flow) to be infinite near
the origin, this model linearizes the pressure drop versus flow relation
ship. The region in which it is linearized is parameterized by
m_turbulent_flow = deltaM * m_flow_nominal
Because the parameterization contains Kv_SI, the values for
deltaM and dp_nominal need not be changed if the valve size
changes.
In contrast to the model in
Modelica.Fluid, this model uses the parameter Kv_SI,
which is the flow coefficient in SI units, i.e.,
it is the ratio between mass flow rate in kg/s and square root
of pressure drop in Pa.
Options
This model allows different parameterization of the flow resistance. The different parameterizations are described in Buildings.Fluid.Actuators.BaseClasses.ValveParameters.
Implementation
The two way valve models are implemented using this partial model, as opposed to using different functions for the valve opening characteristics, because each valve opening characteristics has different parameters.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | homotopyInitialization (from PartialResistance) | true | = true, use homotopy method |
| Modelica.Units.SI.MassFlowRate | m_flow_turbulent (from PartialResistance) | Turbulent flow if |m_flow| >= m_flow_turbulent | |
| Real | l | 0.0001 | Valve leakage, l=Kv(y=0)/Kv(y=1) |
| Real | kFixed | if dpFixed_nominal > Modelica.Constants.eps then m_flow_nominal/sqrt(dpFixed_nominal) else 0 | Flow coefficient of fixed resistance that may be in series with valve, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2). |
| Assumptions | |||
| Boolean | allowFlowReversal (from PartialTwoPort) | true | = false to simplify equations, assuming, but not enforcing, no flow reversal |
| Nominal condition | |||
| Modelica.Units.SI.MassFlowRate | m_flow_nominal (from PartialTwoPortInterface) | Nominal mass flow rate | |
| Modelica.Units.SI.PressureDifference | dp_nominal (from PartialResistance) | Pressure drop at nominal mass flow rate | |
| Modelica.Units.SI.PressureDifference | dpValve_nominal (from ValveParameters) | Nominal pressure drop of fully open valve, used if CvData=Buildings.Fluid.Types.CvTypes.OpPoint | |
| Modelica.Units.SI.PressureDifference | dpFixed_nominal | 0 | Pressure drop of pipe and other resistances that are in series |
| Advanced | |||
| Modelica.Units.SI.MassFlowRate | m_flow_small (from PartialTwoPortInterface) | 1E-4*abs(m_flow_nominal) | Small mass flow rate for regularization of zero flow |
| Boolean | from_dp (from PartialResistance) | false | = true, use m_flow = f(dp) else dp = f(m_flow) |
| Real | n (from PartialResistance) | 2 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| Boolean | linearized (from PartialResistance) | false | = true, use linear relation between m_flow and dp for any flow rate |
| Advanced › Diagnostics | |||
| Boolean | show_T (from PartialTwoPortInterface) | false | = true, if actual temperature at port is computed |
| Flow Coefficient | |||
| Buildings.Fluid.Types.CvTypes | CvData (from ValveParameters) | Buildings.Fluid.Types.CvTypes.OpPoint | Selection of flow coefficient |
| Real | Kv (from ValveParameters) | Kv (metric) flow coefficient [m3/h/(bar)^(1/2)] | |
| Real | Cv (from ValveParameters) | Cv (US) flow coefficient [USG/min/(psi)^(1/2)] | |
| Modelica.Units.SI.Area | Av (from ValveParameters) | Av (metric) flow coefficient | |
| Pressure-flow linearization | |||
| Real | deltaM (from ValveParameters) | 0.02 | Fraction of nominal flow rate where linearization starts, if y=1 |
| Advanced › Nominal condition | |||
| Modelica.Units.SI.Density | rhoStd (from ValveParameters) | Inlet density for which valve coefficients are defined | |
| Dynamics › Actuator position | |||
| Boolean | use_strokeTime (from ActuatorSignal) | true | Set to true to continuously open and close valve using strokeTime |
| Modelica.Units.SI.Time | strokeTime (from ActuatorSignal) | 120 | Time needed to fully open or close actuator |
| Modelica.Blocks.Types.Init | init (from ActuatorSignal) | Modelica.Blocks.Types.Init.InitialOutput | Type of initialization (no init/steady state/initial state/initial output) |
| Real | y_start (from ActuatorSignal) | 1 | Initial position of actuator |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Fluid.Interfaces.FluidPort_a | port_a (from PartialTwoPort) | Fluid connector a (positive design flow direction is from port_a to port_b) | |
| Modelica.Fluid.Interfaces.FluidPort_b | port_b (from PartialTwoPort) | Fluid connector b (positive design flow direction is from port_a to port_b) | |
| Modelica.Blocks.Interfaces.RealInput | y (from ActuatorSignal) | Actuator position (0: closed, 1: open) | |
| Modelica.Blocks.Interfaces.RealOutput | y_actual (from ActuatorSignal) | Actual actuator position |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.MassFlowRate | m_flow (from PartialTwoPortInterface) | port_a.m_flow | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) |
| Modelica.Units.SI.PressureDifference | dp (from PartialTwoPortInterface) | port_a.p - port_b.p | Pressure difference between port_a and port_b |
| Medium.ThermodynamicState | sta_a (from PartialTwoPortInterface) | if allowFlowReversal then Medium.setState_phX(port_a.p, noEvent(actualStream(port_a.h_outflow)), noEvent(actualStream(port_a.Xi_outflow))) else Medium.setState_phX(port_a.p, noEvent(inStream(port_a.h_outflow)), noEvent(inStream(port_a.Xi_outflow))) | Medium properties in port_a |
| Medium.ThermodynamicState | sta_b (from PartialTwoPortInterface) | if allowFlowReversal then Medium.setState_phX(port_b.p, noEvent(actualStream(port_b.h_outflow)), noEvent(actualStream(port_b.Xi_outflow))) else Medium.setState_phX(port_b.p, noEvent(port_b.h_outflow), noEvent(port_b.Xi_outflow)) | Medium properties in port_b |
| Real | phi | Ratio actual to nominal mass flow rate of valve, phi=Kv(y)/Kv(y=1) | |
| Real | kVal | Flow coefficient of valve, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2). | |
| Real | k | Flow coefficient of valve and pipe in series, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2). |
Revisions
-
March 31, 2026, by Michael Wetter:
Corrected unit propagation error that causes Dymola 2026x to not show certain units.
See #2100. -
January 19, 2026, by Jelger Jansen:
Added unit 1 to parameterkValto avoid FMU unit errors.
This is for #2074. -
April 2, 2020, by Filip Jorissen:
Added model name in assert message.
This is for #1334. -
February 21, 2020, by Michael Wetter:
Changed icon to display its operating stage.
This is for #1294. -
November 9, 2019, by Filip Jorissen:
Removed assert forphi>-0.2since the valve control input is now lower limited to zero. See issue 1223. -
October 25, 2019, by Jianjun Hu:
Improved icon graphics annotation. This is for #1225. -
March 24, 2017, by Michael Wetter:
RenamedfilteredInputtouse_inputFilter.
This is for #665. -
November 16, 2017, by Michael Wetter:
Relaxed assertion onphi.
This is for #592. -
October 27, 2016, by Filip Jorissen:
Added assert forphi > 0. This fixes a bug that caused valves to behave like pumps for negative control signals. This is for #558. -
April 23, 2016, by Michael Wetter:
Changed test in assertion fromdpFixed_nominal > -Modelica.Constants.smalltodpFixed_nominal > -Modelica.Constants.eps. Otherwise, JModelica evaluates it astruein Buildings.Fluid.Actuators.Valves.Examples.TwoWayValves. See also https://trac.jmodelica.org/ticket/4932. This is for Buildings, issue 510. -
January 22, 2016, by Michael Wetter:
Corrected type declaration of pressure difference. This is for #404. -
January 29, 2015, by Filip Jorissen:
Moved the governing equations to PartialTwoWayValveKv in order to be able to extend from this partial in TwoWayPressureIndependent -
August 8, 2014, by Michael Wetter:
Reformulated the computation ofkto make the model work in OpenModelica. -
April 4, 2014, by Michael Wetter:
Added keywordinputto variablephito require models that extend this model to provide a binding equation. This is done to use the same modeling concept as is used for example in Buildings.Fluid.Interfaces.StaticTwoPortHeatMassExchanger. -
March 27, 2014 by Michael Wetter:
Revised model for implementation of new valve model that computes the flow function based on a table. -
March 20, 2013, by Michael Wetter:
Setdp(nominal=6000)as the previous formulation gives an error during model check in Dymola 2014. The reason is that the previous formulation useddpValve_nominal, which is not known at translation time. -
February 28, 2013, by Michael Wetter:
Reformulated assignment of parameters. Removed default value fordpValve_nominal, as this parameter has the attributefixed=falsefor some values ofCvData. In this case, assigning a value is not allowed. Changed assignment of nominal attribute ofdpto avoid assigning a non-literal value. -
February 20, 2012 by Michael Wetter:
Renamed parameterdp_nominaltodpValve_nominal, and added new parameterdpFixed_nominal. See Buildings.Fluid.Actuators.UsersGuide. -
January 16, 2012 by Michael Wetter:
To simplify object inheritance tree, revised base classesBuildings.Fluid.BaseClasses.PartialResistance,Buildings.Fluid.Actuators.BaseClasses.PartialTwoWayValve,Buildings.Fluid.Actuators.BaseClasses.PartialDamperExponential,Buildings.Fluid.Actuators.BaseClasses.PartialActuatorand modelBuildings.Fluid.FixedResistances.PressureDrop. -
August 12, 2011 by Michael Wetter:
Addedassertstatement to preventl=0due to the implementation of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow. -
April 4, 2011 by Michael Wetter:
Revised implementation to use new base class for actuators. -
February 18, 2009 by Michael Wetter:
Implemented parameterization of flow coefficient as inModelica.Fluid. -
August 15, 2008 by Michael Wetter:
Set valve leakage to nonzero value. -
June 3, 2008 by Michael Wetter:
First implementation.