11-01-2016 07:40 PM
Hi All,
I'm brand new to the forum and somewhat new to LabVIEW. I'm curious if I could ask for some input on the best way to optimally structure the attached vi. I have also attached the sub-vi for reference.
I can see a few ways to change this around but don't have a solid understanding of how that would affect what's going on under the hood - hence why I came to the experts!
Thank you for your time,
Adam
11-01-2016 08:13 PM
First, in Heat Test, the framed sequence is totally unnecessary (except to fill space and make it harder to arrange your code) -- everything is (appropriately) serialized by the Error Line Running Through It.
On the other hand, the "floating" parallel loop above it is curious. What in the world is it doing there, totally disconnected for the rest of the code? I don't get it -- it seems to be "out of place" (or simply "inscrutable").
I notice that ACL CC1 TC, which is called often, opens a VISA connection, does some I/O, then closes the connection. Open, I/O, Close, Open, I/O, Close. Why so many Opens and Closes? Why not open once before you start looping, then close when you're all done?
Bob Schor
11-02-2016 11:26 AM
Hi Bob,
Thank you very much for your prompt feedback. I have taken your first two tips of advice as both of those somehwat inscrutable complications were caused by me trying to organize the code visually in an easy to understand manner.
On your third comment, I understand that opening and closing a waste of computation time. The Sub VI was developed as a way to make it easier for me to write and read a visa command in various situations or various other VIs. Is it highly beneficial to avoid performing this kind of wasteful computations?
Thanks again,
Adam
11-02-2016 11:58 AM
B-locks wrote: Is it highly beneficial to avoid performing this kind of wasteful computations?
YES!!!
There are a lot of things that could go wrong when closing and recofiguring a port (missed messages, synchronization issues, bus hardware setup, etc). Not to mention it takes time, sometimes a lot of time, relatively.
11-02-2016 12:27 PM
@crossrulz wrote:
B-locks wrote: Is it highly beneficial to avoid performing this kind of wasteful computations?YES!!!
There are a lot of things that could go wrong when closing and recofiguring a port (missed messages, synchronization issues, bus hardware setup, etc). Not to mention it takes time, sometimes a lot of time, relatively.
To the point that you will probably spend more time configuring than communicating! (Maybe even orders of magnitude more time.)
11-02-2016 05:17 PM
Thanks all for the input!
Taking your quick tips, I have removed the Sub VIs, minimized the number of Open and Close communications (for VISA and DAQmx), and run a profile of the performance and memory.
It appears that the Optimized VI runs for a total time of 62.5 milliseconds while the original runs for 343.8 milliseconds - almost six times and definitely an order of magnitude! I have attached the Original VI, Sub VI, Optimized VI, and an excel sheet with the data.
Now that we've moved beyond that issue, I feel as if my method for running the separate commands can also be optimized in some way.
I appreciate any and all input, thanks!