Guy on Simulink

Simulink & Model-Based Design

Creating Your Own Check Valve for the Simscape Gas domain

Posted by Guy Rouleau,

Some time ago, I wrote a blog post about how to implement a custom valve for the Simscape Hydraulic domain. Today I am happy to welcome guest bloggers Erin McGarrity and Ruth-Anne Marchant who will describe how to implement a similar check valve, but for the Simscape Gas domain.

The Problem

Check valves are a pretty common element in pneumatic circuits, but the Simscape Gas library does not currently have one (We are working on that, it will come soon). How would you create such a valve using the base components?

Let's begin by putting together a test harness model for our check valve. In the following model, we have two Reservoir blocks connected by pipes and a pressure source on the left side. Without a check valve, the flow would go back-and-forth based on the signal from the Sine Wave block.

Check Valve test harness

With the Check Valve, we want to allow flow in only one direction, so the response, as seen in the Simscape Results Explorer, would look like the following:

Check Valve response

Custom Check Valve Subsystem

Let's see what we have inside the Check Valve Subsystem. In this subsystem, we first use a Pressure & Temperature Sensor (G) block to measures the pressure drop across the Valve between ports A and B. We pass this pressure to a PS Lookup Table (1D) block, which then generates the opening area of a Variable Local Restriction (G) block.

Check Valve subsystem

Valve Parameterization

To parameterize the Lookup Table, we need to define the opening area as a function of the pressure difference across the valve. For this example, let's say we want our check valve to have a cracking pressure of 10kPa, and a maximum opening pressure of 40 kPa, at which the maximum opening would be 5 mm^2. This would look like:

Pressure Area relationship

Based on that information, we can parameterize the orifice:

Valve Parameters

and the Lookup Table:

Lookup Table Parameters

Valve Dynamics

Finally, we insert a first order delay to prevent the valve from “teleporting” from position to position as the pressure changes. Looking inside the OpeningDelay Subsystem we see how to accomplish this:

Opening Delay

In this Subsystem, there is a PS Gain block which is labeled “Time Constant.” The value in this block sets the amount of delay the system imposes by its inverse, for example specifying a value of 10 results in a delay of 0.1 second.

Running the simulation and looking at the Simscape Results Explorer will show results as displayed above.

Increasing the Gain in the PS Gain block in the OpeningDelay subsystem to 1 makes the valve slower to respond (1 second) and produces the following:

Opening Delay longer

As can be seen from the plot, there is a small leakage backward as the valve closes. This could represent a valve with a weak spring or resistance to closure.

Conclusion

This blog post describes one way to implement a check valve for the Simscape Gas library. There could be many others, depending on your coding preferences, and the level of accuracy your application needs.

For example, we could have implemented a similar check valve using the Simscape language. We could also have modeled the mechanical part of the valve using blocks from the Simscape mechanical domain, like masses, springs and dampers.

Let us know in the comments below if you would like us to write more about other possible ways to implement valves in Simscape.

Add A Comment

Your email address will not be published. Required fields are marked *

*

Preview: hide