06-27-2012 02:54 PM - edited 06-27-2012 02:54 PM
I prepared a vi that reads a table from txt file and find the desired values corresponding independent two variables by interpolation-attached. This via reads the txt file for each calculation. I wonder that is this process slow or enough for me. Becasue I add this via to a daq vi and I send measurement values from this via to the interpolation.vi. I acquired samples once in a sec. Or is this more convenient to read the txt once and after writing values to arrays and use these arrays as a constant (Right click array-->Data Operation-->Make current value default) in the vi? Which one is faster? And also, I wonder that instead of reading from txt file, is it a good way to convert my values in txt to binary data and read this binary values by vi? Last thing, how can I learn a vi program run-spend time?
06-27-2012 02:59 PM
I would read your file one time and initialize your values. I would then pass those initialized values to the subVI that is doing your DAQ stuff. File i/o is very slow (in computer terms) and should be avoided in time critical VIs. I WOULD NOT paste these as a constant. That would be very inflexible and difficult to maintain. There are a variety of ways you can pass the initialized data through your code. You could wire it directly or use action engines. If you are ambitious you could use LVOOP. Either way, hardcoded constants are not a very good approach.
06-27-2012 04:53 PM
@newbieeng wrote:
Last thing, how can I learn a vi program run-spend time?
Reordering your words a bit... Are you asking how to measure how long it takes to run your VI? You can do this with a sequence structure (one of the few reasonable uses for them): in the first frame put a "Tick Count" or "Get Date/Time in Seconds" function. In the next frame put your code. In the last frame, put the same function that you placed in the first frame. Subtract the time value in the first frame from the value in the last frame; the difference is the time it took to run your VI in milliseconds or seconds (depending on which time function you used).
Another option is the VI Profiler, under Tools -> Performance and Memory. Open that window, click "Start," run your code, and click "Stop." It will report how much time it took to run your VI along with other timing information.
06-28-2012 07:55 AM - edited 06-28-2012 07:56 AM
@nathand wrote:
@newbieeng wrote:
Last thing, how can I learn a vi program run-spend time?
Reordering your words a bit... Are you asking how to measure how long it takes to run your VI? You can do this with a sequence structure (one of the few reasonable uses for them): in the first frame put a "Tick Count" or "Get Date/Time in Seconds" function. In the next frame put your code. In the last frame, put the same function that you placed in the first frame. Subtract the time value in the first frame from the value in the last frame; the difference is the time it took to run your VI in milliseconds or seconds (depending on which time function you used).
Another option is the VI Profiler, under Tools -> Performance and Memory. Open that window, click "Start," run your code, and click "Stop." It will report how much time it took to run your VI along with other timing information.
Thank you nathand. I am sorry for usage of wrong order. I tried your suggestion and it works great. The first vi takes 4-6 msec. And the second one takes just 0 msec because it does not calculate anything, including just constant values.