LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie Questions on Labview


dsb@NI wrote:

After targeting your code to my hardware, I am able to run without any additional modifications and without seeing any errors. Sooo, I think you are close. Since this appears to be a performance issue at this point, try these easy steps:

  • Increase the number of read/write samples from 2000 to 20000 (this will make your loop time nominally 100 ms).
  • Log all the waveforms to TDMS. Prove that you can do the experiment. Prove that you are getting expected data by reading and reviewing the data files.

After the easy stuff is complete, you may be able to call the code 'good enough'. 

 

P.S. I don't think I have been forceful enough with respect to the logging...
Stop trying to write to 5 different text files in a loop that is struggling to keep up. Writing these text files is the slowest part of your code and gates your code performance. Your writing to disk code is also the messiest part of your code and makes the whole diagram harder to read and debug.


Fair enough, and thank you for reviewing the code and providing additional suggestions. Glad to know I'm close! I'm working on figuring out how to convert from TDMS to CSV or txt, which should remedy some of the issues.

0 Kudos
Message 31 of 35
(140 Views)

jecunningham@vt.edu wrote:

Fair enough, and thank you for reviewing the code and providing additional suggestions. Glad to know I'm close! I'm working on figuring out how to convert from TDMS to CSV or txt, which should remedy some of the issues.

There's a TDMS plugin for Excel, else you can do a "Read TDMS and save as CSV" afterwards when timing isn't an issue.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 32 of 35
(106 Views)

@Yamaeda wrote:

jecunningham@vt.edu wrote:

Fair enough, and thank you for reviewing the code and providing additional suggestions. Glad to know I'm close! I'm working on figuring out how to convert from TDMS to CSV or txt, which should remedy some of the issues.

There's a TDMS plugin for Excel, else you can do a "Read TDMS and save as CSV" afterwards when timing isn't an issue.


I actually found a similar function for MatLab, which just came out in the most recent update. It made conversion MUCH easier than doing it in LabVIEW.

0 Kudos
Message 33 of 35
(47 Views)

dsb@NI wrote:

After targeting your code to my hardware, I am able to run without any additional modifications and without seeing any errors. Sooo, I think you are close. Since this appears to be a performance issue at this point, try these easy steps:

  • Increase the number of read/write samples from 2000 to 20000 (this will make your loop time nominally 100 ms).
  • Log all the waveforms to TDMS. Prove that you can do the experiment. Prove that you are getting expected data by reading and reviewing the data files.

After the easy stuff is complete, you may be able to call the code 'good enough'. 

 

P.S. I don't think I have been forceful enough with respect to the logging...
Stop trying to write to 5 different text files in a loop that is struggling to keep up. Writing these text files is the slowest part of your code and gates your code performance. Your writing to disk code is also the messiest part of your code and makes the whole diagram harder to read and debug.


Hi Doug,

I think I've figured some things out using TDMS logging and then converting with MATLAB. I've also been able to create separate logging and AO VIs, and will be trying everything out in the lab later today. Will let you all know how it goes and if I experience any issues!

 

Thanks again for the support,

Joseph

0 Kudos
Message 34 of 35
(46 Views)

I've run into some new (and exciting?) problems with my application. Instead of attempting to run a single monolithic program to both generate outputs and monitor data, I have created two separate programs. The program monitoring AI0:3 seems to be working as intended. However, the VI I have created to generate my sine wave excitations is showing some strange behavior. A brief description of the program and its intended outputs is as follows:

 

1) Prior to the loop, a buffer of the same size as the data packets generated in the loop is filled with an initial sine wave generation.

2) within the loop, additional sine waves are generated, but with the starting phase input to the generator.

3) The loop runs until the stop button is pressed.

4) The VI (SineGenV2.vi) is intended to create a continuous, phase-matched sine wave excitation at the specified frequencies, magnitudes, sample rates, and per-sample data levels. SineConfig.vi is a slightly modified version of Simulate Signal.vi allowing configuration of sample rate and per-channel samples.

 

Currently, the program appears to generate data at the desired rate. However, the outputs don't seem to match my expectations. I have monitored the output from my USB-6451 DAQ using channel AI3 and Voltage4InTDMS.vi (via a PCB I've constructed for the purpose). I assumed that the issues lay with the "reset signal" inputs of the SineConfig.vi's within the loop. I attempted to both the T (AO0OutFullT.png, AO0OutCycT.png) and F (AO0OutFullF.png, AO0OutCycF.png) settings, with the results pictured. I have used a MatLab file to convert from TDMS (using the new tdmsread() functionaliry). With this method, I get the closest results to what I desire when I use F on the in-loop sine vi "reset signal", but these are still not pure sine waves at the frequency I've specified.

 

It looks like the choppiness may come from a phase reset within the program somewhere. I've also tried fiddling with the phase inputs, but have only achieved similar results. I'm uncertain why these sub-peaks (pictured in ...CycF.png) seem to repeat in sets of 4. Could this be an artifact of how waveforms are stored in TDMS? If so, how might I remedy this issue so I can generate continuous sine waves?

 

I've tried a number of methods, using various sine wave generation and phase matching techniques, but none of them give me the continuous sine wave I need for my work.

 

Any help you can provide is much appreciated!

 

Sincerely,

Joseph

0 Kudos
Message 35 of 35
(18 Views)