06-21-2017 03:04 PM
I am trying to create a deadband zone(maybe stability zone is correct terminology) that the output will enter into the zone and hold the valve(keep it from moving) until the PV goes either above or below the zone. Once the PV goes beyond the zone, either above or below, I want the valve to kick back on to bring it back into the zone, and hold again. Basically, I do not want to wear the valve out by constantly keeping it adjusting to the SP. By holding the valve in this zone, I want to be able to extend the life of the valve over time.
06-21-2017 04:05 PM
Take a look at a VI I posted in this older thread.
http://forums.ni.com/t5/LabVIEW/refrigerator-temperature-control/m-p/1096003#M484777
It was for temperature control, but the concept is the same. You may have to invert the action depending on whether you need to turn on the valve when something goes high, or need to turn it on when something goes low.
06-21-2017 04:48 PM
Expanding on what RavensFan said, this will provide you with the state of the tank level with the Goldilocks principle: Too High, Too Low, or Just Right
06-21-2017 05:50 PM
I was not 100% sure what your algorithm is. It sounds like you want to have the valve wide open when it hits the low level and not shut off until it hits the full tank level. And vice versa: valve closes and stays closed until it hits the low level.
That is a little different then a deadzone. My mistake. You don't need the three states in my snippet. RavensFan algorithm is the one to use: 2 states ON/Off with the feedback node from the previous state to determine the present state of the valve.
06-22-2017 07:58 AM
Thanks guys. I was looking for a function block for this but if I have more trouble I will post my code.
06-22-2017 08:20 AM
In your example, what is the output in this case? Don't I want my output to be my valve position?
06-22-2017 08:39 AM
You said your valve was On/Off. The output is a boolean.
If you need your valve to be something that is position control (e.g. 0-100% open) then you should look at PID control.
06-22-2017 08:45 AM
I have already created the PID control for it. But instead of turning off, we want the valve to hold position. Somewhere between 0 and 100 percent. I do not care what position the valve is only that it stops overcorrecting to maintain setpoint. This is to ensure a longer lifespan of the valve. That was my mistake in saying on/off. The position of the valve holds, but it doesn't move as long as we are within the range we want. Because right now, it simply keeps adjusting to maintain the exact setpoint. This is ok but will wear the valve out overtime.
06-22-2017 08:50 AM
Use a similar subVI that has shift registers, but make sure the output does not change unless the requested output has a large enough difference from the last output.
You could also put some timer mechanism in there so that periodically it updates the output anyway.
Another thing you could do is put a filter on the setpoint output.
06-29-2017 07:45 AM
I ended up using boolean logic to achieve what I needed. Basically using an SR flip flop to hold valve position and when PV is outside our zone then we do a reset