LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Acquisition for a set time interval

Hey! I'm a Labview student, new to this software.

 

I've made a program that continously acquires data from a waveform generator for a set time interval (which can be adjusted as required) and then writes the data to a spreadsheet if needed (new data in new columns).

 

I was somehow able to run the program and achieve the desired outcome, but I'm sure that there are a lot of silly things that I did 😄

 

Would someone please help me optimize the program, it would be very helpful for me to learn more 🙂

 

(I'm attaching the VI here)

 

Thanks in advance,

Akash 🙂

0 Kudos
Message 1 of 7
(3,359 Views)

Here are things to either never do or very rarely do:

  • Never (!!) use Frame Sequences.  In LabVIEW 2016, they don't even appear on the Structures Palette (though I understand they are still available for those who insist on really bad habits).
  • (Almost) never use Local Variables.  In most cases, it makes it difficult to see what's going on.
  • Don't use Indicators that you don't "need" (Current Time, Set Time, dt, Array(1), Array).  If you need to watch something during execution for debugging purposes, use a Probe.  And if you don't know about Probes, use LabVIEW Help, search for Probe, and look at the Debugging Techniques entry.

On the other side, a good practice is to use sub-VIs to "hide the details", making your code "fit on a single screen" (so it can be visually grasped without needing 12 monitors or lots of mouse scrolling).  

 

Bob Schor

Message 2 of 7
(3,319 Views)

Hey Bob,

Thanks a lot for your suggestions 🙂

But if you say that Frame sequences and local variables are not to be used often (or at all), then in this case, how do I write my program in such a way that I get the code to execute in a particular sequence and get the desired outcome? Do you have any suggestions for that?

0 Kudos
Message 3 of 7
(3,318 Views)

Is using "Queues" a solution to avoid Local variables in my exmaple??

0 Kudos
Message 4 of 7
(3,292 Views)

@akash90 wrote:

Hey Bob,

Thanks a lot for your suggestions 🙂

But if you say that Frame sequences and local variables are not to be used often (or at all), then in this case, how do I write my program in such a way that I get the code to execute in a particular sequence and get the desired outcome? Do you have any suggestions for that?


State Machine.

 

And for single loops, keep your data in Shift Registers.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 7
(3,281 Views)

I'll explore more about State Machines and try to implement it in my program (and bug you guys again if I have some problem with that 😄 ).

 

Thanks for the suggestion 🙂

0 Kudos
Message 6 of 7
(3,278 Views)

Hey guys,

 

I'm attaching the VI that I've made using State machine structure (the sub VI for the folder and file name is also attached along with the state machine diagram to explain what exactly I am trying to do)

 

In this VI, I'm having a couple of problems:

 

Firstly, the Timer is running in a multiple of 100 ms (on defining a buffer of 0.1 seconds), as a result of which I'm not getting the exact number of values everytime. For example, if I set the Timer at 2000 ms, the recording ON time runs anywhere from 2000 to 2099 ms not giving me the exact number of data points that I desire. For a period of 2000 ms, I should be getting 5120 values of Y, but sometimes I get only 4864 instead. How can I solve that issue?

 

Secondly, I am getting the column headings of "Time" and "Samples" for the first iteration in the logged file, but not for the next iterations. I'm sure that the solution for that would be simple enough, but I'm not able to figure it out. Any ideas about that?

 

Thanks in advance 🙂

Download All
0 Kudos
Message 7 of 7
(3,254 Views)