Wolfram Computation Meets Knowledge

Valve Example

Drag-in ComponentsDefine Ramp Parameters
Define Tank ParametersConnect and Simulate
Define Valve ParametersAnalyze

In this part, you will use a valve to control the flow between two tanks.

1.gif

Model to check the flow between tanks that are connected by a valve.

Drag-in Components

Create a new model and drag the following components from the Modelica standard library:

Define Tank Parameters

The same parameters will be used for both tanks. Only the initial value of the level of the fluid will be different.

height: Total height of the tank. Change level_start (in the Initialization tab) of tank1 to 10 m and tank2 to 1 m.

crossArea: Define cross-sectional area of the tank.

Medium (This parameter cannot be left blank.) Select a fluid from the drop-down menu, e.g. Extension of the StandardWater package.

Ports: This refers to the outlet of the tank to which other components can be connected.

nPorts: In this example, as you want to connect only to the ambient, set the nPorts to 1.

use_portsData: Set use_portsData to true.

portsData: Provide the portsData as a list, which means they need to be specified using curly braces {}. It takes a function as an argument. The function is Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(). You can open the function (type Modelica.Fluid.Vessels.BaseClasses.VesselPortsData in the search field in the Class Browser) and check the inputs:

3.gif

You can define diameter, height and other parameters. For this example, set the port height to 1 m and diameter to 0.3 m. Use the defaults for zeta_out and zeta_in. The input to the portsData should look like this: {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.3,height=1)}

4.gif

Define Valve Parameters

Medium: Select a fluid from the drop-down menu, e.g. Extension of the StandardWater package.

valveCharacteristic: Choose a valve characteristic. Using the default setting (linear) should work for most cases.

CvData:Use a flow coefficient for the valve. Cv (US) flow coefficient is typically used.

Cv: Set the Cv value. For a ball valve of size 10 inch (150 rating), Cv value is 15771.

dp_nominal:Set nominal pressure drop across the valve.

m_flow_nominal: Set nominal mass flow rate through the valve.

filteredOpening: Set it to true to improve the numerics.

5.gif

Define Ramp Parameters

height: Here, height is used as the normalized opening value of the valve. Set the height of the ramp.

duration: Set the duration for the ramp to reach the desired height from its initial value.

startTime: Set start time.

6.gif

Connect and Simulate

Connect the ports of the tanks and the ramp to the valve:

7.gif

Provide a simulation time in the Experiment Setup and simulate:

8.gif

Analyze

Plot the mass flow rate through the valve and the levels of the tank. Mass flow rate through the valve can be plotted using the following variable: valveIncompressible1.m_flow.

9.gif

Flow of water starts at two seconds when the ramp signal starts. Water flows from tank with higher height (tank 1) to the tank with lower height (tank 2).