07-29-2014 02:00 AM
Hi Everyone,
So I have two issues with this program (I am fairly new to Labview and have been struggling).
1.) I am obtaining data from two different DAQs, the task is started in the for loop and the aquistion is done in the timed loop. I want to get data once a second and then after one minute, it is averaged and written to an external file. As it is set up, after a while of running it begins to lag and starts taking data about once every three seconds, even though the timed loop is set to complete once a second. Why is it doing this? Do I need to change the outer for loop to a timed loop as well that executes every one minute? It just seems strange that it would begin to get slower and slower, as a rate of 1 hz is slow already.
2.) And the other issue is that all the waveform charts inside the timed loop do not graph anything! the numeric indicators are working, and the Y axis scales itself on the chart, but nothing is plotted and the x axis does not scale itself. I am aware there is no time stamp, as I have not worked that in anywhere to start the charts at, but why would it not be graphing at all?
Thank you, and any help is much appreciated!!
-Lori
07-29-2014 03:07 AM
Lori,
bigger is not always better. In fact, regarding LV code, bigger is bad.
When reworking the VI, please follow the following recommendations:
- Never use STOP. This is a function i would like to delete from LV as it serves no real purpose other than confusing newcomers to LV.
- Please keep the front panel in gray scale as recommended by usability heuristics. OK, Mint is not the ugliest color, stil it is somehow... distracting.
- There is absolutely no need for a timed loop. In fact, it can create issues, esp. if you pack many thing in it like you do. Revert it to a standard while loop and use a single Wait (ms) primitive for timing with 1000 as parameter.
- Try not to use dynamic datatype. It enforces you to use cast functions a lot which are close to unnecessary and convolute your code.
- Try to improve your wiring. Data sources are left, sinks are right, wires ought to go straight without unnecessary crossings and bends.
- Your for loops in the timed loop are redundant and the purpose is not clear. Please use subVIs to reduce redundant code. Also evaluate the purpose of the loops.
- You cannot gracefully stop your VI. Use a proper state machine for implementation instead of your obscore "STOP" methodology.
- Error handling is quite sporadic. Please make sure that you have proper implemention and error wiring.
These are the most obvious issues in my eyes for a first draft. Please incorporate them, you should learn quite a bit about LV while doing so.
Norbert