LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control program timing sequence

I have written a control and data acq program which performs calls to 5 FieldPoint relays in a certain sequence separated by one or more seconds in time.  To separate the calls to the relays in time, I am using using a case structure which throws the relay after the elapsed time is greater than 1 second; the next relay is thrown after another second, and so on (see attached picture- please note that in picture, the "FieldPoint write" VI appears as a ? since I opened the program on an computer without the FieldPoint libraries; the VIs do work on the lab computer).
So, my question is this:  Is there a better (more efficient, more elegant, more accepted) way to separate these calls in time and maitain the proper sequence?  Thanks for any help or suggestions.
0 Kudos
Message 1 of 8
(4,633 Views)
this is a vi using time loop to do the same thing (i think...)
Message 2 of 8
(4,629 Views)

Have a look at this for a much simpler approach - a loop with a 1s wait. The arrays on the left side are auto-indexed into the loop and determine the number of times the loop will run. Also note that to read a boolean, you can simply feed a boolean into the Type input of the FP Read VI.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

 


___________________
Try to take over the world!
0 Kudos
Message 3 of 8
(4,604 Views)
ttlove, this is just what I needed.  It really simplifies the program.  Thanks!
0 Kudos
Message 4 of 8
(4,599 Views)
another great suggestion.  what I like about this one is that I could easily vary the delay times (for different loops) by using conditional statements wired to the index of the for loop.  Thank you.
0 Kudos
Message 5 of 8
(4,599 Views)
do you know how one could modify this program so that each loop runs for a different length of time (dt)?
0 Kudos
Message 6 of 8
(4,591 Views)
this is another approach. pretty strait forward.
0 Kudos
Message 7 of 8
(4,577 Views)

You don't need to use conditions. You can simply have the times in an array outside the loop and wire the array into the loop like the other 2 arrays. The big advantage about something like this is that if you need to make a change, it affects all the loops at the same time.

One important point that wasn't shown in my example is error handling. At the very least you should have an indicator coming out of the FP Read VI so you can see when there is an error. More advanced methods include stopping the loop, alerting the user or doing something else.


___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(4,565 Views)