# Control principles for proportional solenoid valves

#### Just Another Sparky

Joined Dec 8, 2019
244
I'm looking at embarking on a project which will entail the use of a 3-port proportional 'flow control' type solenoid valve - one with no feedback mechanism or onboard controls. Just a 13 ohm, 0-1000mA coil which acts against a calibrated spring.

I will need to design and implement a control scheme to regulate output pressure against a dynamic setpoint. These valves are fast acting (<30ms response) but they do have some dead zone in the middle of their travel as well as inductance. My control logic will most likely be handled by a Parallax Propeller 1 8-core microcontroller.

As someone who is new to the area of high speed control loops, can anyone recommend some literature or other resources to help me get a firm grasp on the basics of embedded closed-loop control? At least enough to arrive at a working prototype that I can experiment with, learn from and refine?

If it's relevant at all, I'm looking at using an SMC VEF3121-1-02 3-port proportional valve. 'R' ("normally closed") will be connected to atmosphere, 'P' ("normally open") will be connected to my pressure source, and 'A' (the common port) will be my controlled output.

You could envision it as being very similar to this sort of a system, but where pressure is the controlled variable rather than position:

Last edited:

#### crutschow

Joined Mar 14, 2008
32,899
For digital control-loops with non-linear components or dead-zones (hysteresis?) I suggest you look at Fuzzy Logic.

PID is the most common and oldest form of feedback control for a system, which is an analog approach since only analog circuits were original available (PID, of course, can also be emulated by a digital processor).
Fuzzy logic is a digital approach, that basically uses a series of If-Then-Else statements for control, which is readily performed by a digital processor, but not by analog circuits.

Fuzzy Logic does not necessarily need a mathematical model of the system for the program to be written. PID generally does. This model can be difficult to derive for complex physical systems.
And PID compensation is predicated on the system being linear (which is seldom true in practice), while Fuzzy Logic does not.

The Fuzzy Logic program is written the way a (fast) human operator might tweak knobs or switches to control a system. It's relatively easy to understand, and it's usually obvious what needs to be tweaked to optimize the system response. That's not generally true with PID.

Here's a tutorial on it.

And here's a thread where a poster used Fuzzy Logic for a closed-loop dynamic pressure/flow control system with better success than the PID approach he was initially using.

Last edited:

#### Sensacell

Joined Jun 19, 2012
3,257
I suggest trying to build up a simple analog PID controller first, then the concepts of the digital system make far more sense.

I have designed both, the digital version is much harder to debug- (hint- add a multi-channel DAC so you can monitor digital signal values with a scope)
The key to this is to think of the variables as signals, not as numbers- beware of saturation and overflow problems.

#### crutschow

Joined Mar 14, 2008
32,899
I suggest trying to build up a simple analog PID controller first, then the concepts of the digital system make far more sense.

I have designed both, the digital version is much harder to debug
It sounds like you are referring to a digital implementation of a PID system, which indeed can be hard to understand and debug, since it emulates analog integrators (which have windup saturation and overflow problems) and differentiators.
I'm talking about a Fuzzy Logic system, which is basically unrelated to PID, and the FL digital program, consisting largely of If-Then-Else statements, is intuitively easier to understand then either an analog or digital PID controller.
Since it has no differentiators or integrators, saturation and overflow problems are also largely absent.

Last edited:

#### Just Another Sparky

Joined Dec 8, 2019
244
Just trying to get some perspective here as there doesn't really seem to be a readily available "nailed-down" definition of a 'fuzzy' controller.

Would I be accurate in the comparison that a PID controller involves purely reactive logic, whereas a 'fuzzy' controller incorporates some degree of proactive or predictive logic based on the programmer's understanding of the process' unique characteristics?

I.e. could I say that using 'if, then' statements to recognize reversal of spool travel and then compensate for it's known hysteresis characteristic by boosting/bucking the output 3% would be 'fuzzy' logic? Or similarly, estimating the spool position and skipping over most of the center dead-band (e.g the 450~550mA range) between P-A and P-R in order to improve PID responsiveness and overall performance?

Just trying to put a face to the name here.

#### crutschow

Joined Mar 14, 2008
32,899
there doesn't really seem to be a readily available "nailed-down" definition of a 'fuzzy' controller.
Did you read the tutorial reference on Fuzzy Logic that I posted.
I would think that nails it down pretty well.
Would I be accurate in the comparison that a PID controller involves purely reactive logic, whereas a 'fuzzy' controller incorporates some degree of proactive or predictive logic based on the programmer's understanding of the process' unique characteristics?
Not sure what "reactive logic" is but that's probably a reasonable difference.
could I say that using 'if, then' statements to recognize reversal of spool travel and then compensate for it's known hysteresis characteristic by boosting/bucking the output 3% would be 'fuzzy' logic? Or similarly, estimating the spool position and skipping over most of the center dead-band (e.g the 450~550mA range) between P-A and P-R in order to improve PID responsiveness and overall performance?
In general that could be considered a from of Fuzzy Logic control, but Fuzzy Logic doesn't normally include any PID integral or differential functions explicitly.
I would think mixing the two approaches would lead to a confusing and difficult to debug program.

#### Just Another Sparky

Joined Dec 8, 2019
244
I missed the links, sorry. I've had a lot on my mind lately.

I'll read up on them, thanks.

#### Sensacell

Joined Jun 19, 2012
3,257
"In 1973, Professor Lotfi Zadeh proposed the concept of linguistic or "fuzzy" variables. Think of them as linguistic objects or words, rather than numbers. The sensor input is a noun, e.g. "temperature", "displacement", "velocity", "flow", "pressure", etc. Since error is just the difference, it can be thought of the same way. The fuzzy variables themselves are adjectives that modify the variable (e.g. "large positive" error, "small positive" error ,"zero" error, "small negative" error, and "large negative" error). As a minimum, one could simply have "positive", "zero", and "negative" variables for each of the parameters. Additional ranges such as "very large" and "very small" could also be added to extend the responsiveness to exceptional or very nonlinear conditions, but aren't necessary in a basic system."

I remember FL from the eighties, seemed like just another meaningless buzzword to put on a package while trying to sell something.
The people that talked the most about it were the people that had no experience with control systems.

#### Ya’akov

Joined Jan 27, 2019
8,161
"In 1973, Professor Lotfi Zadeh proposed the concept of linguistic or "fuzzy" variables. Think of them as linguistic objects or words, rather than numbers. The sensor input is a noun, e.g. "temperature", "displacement", "velocity", "flow", "pressure", etc. Since error is just the difference, it can be thought of the same way. The fuzzy variables themselves are adjectives that modify the variable (e.g. "large positive" error, "small positive" error ,"zero" error, "small negative" error, and "large negative" error). As a minimum, one could simply have "positive", "zero", and "negative" variables for each of the parameters. Additional ranges such as "very large" and "very small" could also be added to extend the responsiveness to exceptional or very nonlinear conditions, but aren't necessary in a basic system."

I remember FL from the eighties, seemed like just another meaningless buzzword to put on a package while trying to sell something.
The people that talked the most about it were the people that had no experience with control systems.
The Japanese really like fuzzy logic and use it in cameras and rice cookers. It works quite well but its name is unfortunate since it prevented adoption by people that felt they needed "precise" answers, which, of course, fuzzy logic provides