01-26-2010 09:14 PM
Here is an example that I think does most of what you are looking for. I didn't use the Elapsed Time function - there are many ways to do this.
I set the main loop delay to 1 second so you can see what is happening easier. Also the "60 sec" wait time is settable (also for testing).
Note the use of a type defined enum for the states. This is important because you can change the type define and have it reflected in all of the places where it is used.
Also note the use of a cluster to keep the indicator values. This makes the block diagram cleaner.
01-27-2010 02:23 PM
Thanks to everyone for all the help! I've now got some code that I can use, but I really do want to try and use the Elapsed Time Express VI. I only have one problem... it works perfectly when I first run the program but as I continue to run the program (let it run) and thus cycle up and down in pressure, the Elapsed Time function is not waiting for the correct amount of time to elapse before providing a "True" Value in the "Time Has Elapsed" Boolean.
This code should work as follows:
Start the program with pressure under 30 - this turns on the "isAdsorberRunning" and "pre adsorber" lights, waits 10 seconds, and turns on the "3 way" and post- 3 way" lights. After all 4 lights are on, begin toggling the pressure up. When you hit 60 it turns off all the lights. Now, toggle pressure back down again. I would like for the program to again, turn on the "isAdsorberRunning" and "pre adsorber" lights, wait 10 seconds, and turn on the "3 way" and post- 3 way" lights - but you can see this is not the behavior it produces.
If anyone knows what I'm missing please help me! Also, can anyone help me figure out how to produce the behavior I want?
As always thanks in advance.
01-27-2010 06:08 PM
I would like for the program to again, turn on the "isAdsorberRunning" and "pre adsorber" lights, wait 10 seconds, and turn on the "3 way" and post- 3 way" lights - but you can see this is not the behavior it produces.
What are you seeing? and when you toggle the pressure back down, how low are you going?
By defualt the Elapsed Time Express VI will not reset itself everytime it reaches the target time. You may want to reset the start time when you want to start waiting for 10 seconds again.
01-27-2010 07:13 PM
What I see is that it waits the 10 seconds only the very first time the express VI is ran - other times through it waits like a fraction of a second, or maybe one or two seconds and then passes a true value to the Time has Elapsed Boolean. When I toggle the pressure back down I only go as low as 27-29.
I've set my Time Target to 10 seconds. The help says the Time Target "Specifies how much time must elapse before the Time has Elapsed Boolean is set to TRUE." I don't understand why it only waits the 10 seconds the very first time.
Please describe how to reset the start time when I want to start waiting for 10 seconds again - I don't think I understand this part and that this will help.
Take a look at the code that I attached above... what am I missing??