12-03-2009 08:52 AM
hey everybody.
can anybody help me creating a vi with the following requirements:
Our hardware works like this:
cDAQ9172
· We have a relay that turns on a digital input in labview when the viridian controller wants to turn the pump on . Lets call that INPUT_1 (module 9421 i.e. channel 1)
· We have a second relay that sends power to the solar pump when a digital output in labview is turned on. Lets call that OUTPUT_1 (module 9472 i.e. channel 1)
· We have an impulse flowmeter (1 pulse per litre of flow) in the solar circulation. Lets call that INPUT_2 cDAQ module (module 9421 i.e. channel 2)
What we need from Labview code is:
1. 1. Set-up a variable (integer) to count solar pump start attempts. Lets call it COUNT. Set COUNT=0
2. 2. When INPUT_1 goes from LOW to HIGH labview turn on OUTPUT _1
3. 3. Count the pulses from INPUT_2
4. 4. If no pulses after 10 seconds, turn off OUTPUT_1 and increment COUNT. If some pulses from INPUT_2, keep OUTPUT_1 on until INPUT_1 goes low then go back to step 1.
5. 5. If count =3, raise an error message and hold OUTPUT_1 off.
6. 6. If count <3, wait 10 seconds and switch on OUTPUT_1
7. 7. If INPUT_1 goes low, go to step 1
8. 8. Go to step 4
I would appreciate any help.
Thank you
12-03-2009 09:07 AM
12-03-2009 09:39 AM
12-04-2009 08:54 AM
Hey,
In addition to the examples included in LabVIEW found in Help > Find Examples..., there are also many community examples available in the NI Developer zone here: http://zone.ni.com
Alternatively, you can contact an Alliance Member who can write your program for you, to find an Alliance Members please visit http://www.ni.com/alliance/
Kind regards,
12-04-2009 09:45 AM
Thanks for all answers.
I have created a vi. It does work for one attempt only. I wanted it in case there is pulse on 9421 channel 0 then turn on output 9472 channel 0, if no there is no pulse then wait 10 secs and then try again until 3 attempts. i f after 3 attemps still no pulse turn off Output 9472....
I got stuck as my vi works when there is a pulse but when there is no pulse it just turns off output 9472 channel 0 without waiting and attempting again for 3 times.
If you can help please do. I'd appreciate
Thanks
12-04-2009 01:27 PM
The fundamental problem you have is that your process definition is not complete. For instance, you say in step 2 "When INPUT_1 goes from LOW to HIGH labview turn on OUTPUT _1" OK ... Does this mean you're supposed to sit there and wait for this event to happen? If you are supposed to sit there and wait, how long do you wait? Indefinitely? If it's LOW, do you then go to step 3, or do you go to step 3 regardless? It seems based on step 4, that the assumption is that OUTPUT_1 was turned on previously.
The other fundamental problem you have is that you are trying to turn a pretzel into a pancake. The process you have is a perfect example of a state machine, but you are trying to implement it using a flat architecture. This just becomes cumbersome.
You also have a couple of needless operations in your code. See attached figures.