12-11-2012 12:46 PM
Search on your pc!
LabVIEW>Help>Find Examples. Then go to Hardware Input and Output>DAQmx>Digital Generation.There is also, of course, the DAQ Assistant which pretty much walks you through such a simple task.
You also need to know how much current the relay requires to turn on. You may need an amplifier/relay driver (i.e. ULN series).
12-11-2012 12:56 PM
The specifications for the relay is:
Normally open type
Voltage: 5VDC
Coil resistance: 250 ohms
Contact Rating: 0.5A at 125VAC
Nominal current: 20mA
Not sure how we would know if we need an amp or not? We have an LOGOSOL DC Servo Amplifier laying around that we could use, if needed?
12-11-2012 02:11 PM
We got the relay working - Thank you.
We are putting the relay into the NI CB-68LP terminal breakout board into pins 14 (for +5v) and pin 18 (for digital ground) for the first relay (for the first valve).
And then pin 8 (for +5v) and pin 13 (for digital ground) for the second relay (for the second valve).
We got the valves opening and closing with our relays, the only problem now is coding the VI for these valves, we want to use some type of PID block to control the valves, what PID block do you recommend we use, from the PID control toolbox. There is 8 different types of PID blocks, but what is the best block to use for this application?
And once we figure out the PID block, what is would be our inputs and outputs to this block?
We are getting values for the height of the water level and the percentage.
Thank you.
12-11-2012 03:26 PM
Like any other control system, the choice of controller or control algorithm depends on the charactersitics of the "plant." In your case the plant is the group of buckets and the solenoid valves. The flow rates into and out of the middle bucket (which probably vary somewhat according to the depth of the water) will determine the timing requirements for the controller. It also depends on how fast the setpoint can change and your requirements on tracking errors, overshoot, and so on.
Lynn
12-11-2012 03:38 PM
12-11-2012 03:41 PM
I do not have the PID toolkit so I cannot help directly.
Lynn
12-11-2012 04:03 PM
12-11-2012 05:54 PM - edited 12-11-2012 05:58 PM
One electrical suggestion: put a flyback diode in the circuit. It may not be necessary in your system depending on the electrical characteristics, but it's good general practice (I'm a chemical, not electrical, engineer so I tend to take the better-safe-than-sorry approach on such things).
I don't think you want PID control here. PID works well when the output is analog or continuously variable; a solenoid valve is either on or off. You could use a PWM (pulse-width modulation) signal to turn the solenoid on and off rapidly, making it approximate a variable valve, but this probably won't be good for both the valve and the relay unless they're designed for continuous cycling.
Are you sure that simple on-off control won't be sufficient for your application? Turn on the valve when the level drops too low, turn it off when the level reaches the setpoint (or slightly below it, to compensate for any additional volume left in the pipe after the valve closes). You'll probably want some hysteresis - the valve should open at a lower level than where it closes to avoid excessive cycling right around the setpoint.
EDIT: by the way, why do you say there are 8 PID blocks? There are only two that you might care about: PID, and PID Advanced. If you're not that familiar with them, you only care about the first. Maybe you'd try the auto-tuning version. The rest are auxiliary functions, not control algorithms. Read the help and the PID Toolkit manual.
12-11-2012 06:05 PM
Very helpful response! So you are saying the best way to go about it this, is do not use a PID loop....I was thinking about just using some if/else type structure (case-structures, I think is what it's called in LabVIEW).
Something on the lines of: If I want 50% water in the bucket.
- First it will check the water level in the bucket
- Then depending if it is over the specified value (of 50%), if ther e is more than 50% water in the bucket, the second valve (draining valve) will be turned on to remove the water until the bucket gets to a 50% level and then it will shut off.
- And if it level in the desired bucket is less than 50% the first valve (the valve controlling the bucket filled with water) will be turned on to add more water into the desired bucket until 50% is reached.
Does that sound simple enough? Or do you see any issues with this? Is there a way we can do this easier with one of the PID blocks? I tried reading up on the help context and looked up alot of YouTube videos, but not really sure how to use the blocks for my application?
Thank you again for your response!
12-11-2012 06:24 PM
Yes, that's pretty much right. How tightly do you need to control the level? Also, why would you ever overshoot - is there some additional source that could fill the tank other than the one that you control, or are you thinking that you might suddenly decrease the desired level? You should be able to set up the control such that you never overshoot by much.
I would make the algorithm a little more complex, adding hysteresis. Say you want 50% and can tolerate a 2% error, you would let the level drop until it reaches 48% and then fill until it reaches 52%. This avoids the valve rapidly turning on and off right around 50%. I would only use the valve that releases liquid when you're dramatically over the desired level, and add some logic to make sure that you're never emptying and filling simultaneously.
I would also do an experiment to see how much liquid continues to flow into the bucket after you close the filling valve, and take that into account when you set up the control limits. If you know that you'll get another 1% of the volume after the valve shuts off, then set the limit 1% lower than you want. If the volume of pipe between the valve and bucket is short, then you can skip this step.