LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting duplicate (x10) readings from the "format date time string" function to the "TDSM write"

Solved!
Go to solution
Hey folks!
I've got my first labview task. I'm very unexperienced with the software so note that the solution could be something obvious I've overlooked.
 
I've attached the VI (drive link) for you to try yourself. You have to input runtime (10-20s) and frequency (200-500ms) on the front panel. Also you have to choose an empty tdms file as a path, also in the front panel.
 
My problem before this is finished, is that the time and date is repeated an average of 10 times before it continues (shown in picture). The time/date should only sample and write 1 time before it "moves on" sampling and writing the data values.
 
 
NB: I'm aware that the DAQ assistant does the logging automatically, but it's insufficient for this project.
Download All
0 Kudos
Message 1 of 11
(356 Views)

Hi boyy,

 


@Labviewboyy69420 wrote:
 
My problem before this is finished, is that the time and date is repeated an average of 10 times before it continues (shown in picture). The time/date should only sample and write 1 time before it "moves on" sampling and writing the data values.

You are writing the same timestamp to the TDMS file several times inside the loop.

And this loop may iterate very fast several times due to those autoindexing inputs - faster than the clock will update. (Especially as you write only 3 digits for milliseconds…)

 


@Labviewboyy69420 wrote:

Please attach all files directly to your message in this forum!

Most people refuse to open 3rd party download links, many people are prohibited from opening such 3rd party download links (due to company firewalls)…

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
Message 2 of 11
(328 Views)

What is the point having a For Loop that only does 1 iteration?

 

Cfl1apture.PNG

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 11
(305 Views)

The additional FOR loop was sort of a last effort to try and control the data flow, since I suspected that it sampled a timestamp per channel reading. To elaborate: there are 10 channels of boolean data and there is an average of 10x copied of each timestamp. The way I’ve designed it (without the additional FOR loop) is to have 1 timestamp for each data smaple of all 10 channels in the DAQassistant.

0 Kudos
Message 4 of 11
(278 Views)

The additional FOR loop was sort of a last effort to try and control the data flow, since I suspected that it sampled a timestamp per channel reading. To elaborate: there are 10 channels of boolean data and there is an average of 10x copied of each timestamp. The way I’ve designed it (without the additional FOR loop) is to have 1 timestamp for each data smaple of all 10 channels in the DAQassistant.

0 Kudos
Message 5 of 11
(288 Views)

Hi, I expanded the millis and it's still identical, It writes the same stamp 10 times and not 10 different timestamps. I'm fairly certain of this.

0 Kudos
Message 6 of 11
(265 Views)

I never used TDMS files, however I guess you should write the timestamp only once for each iteration of the While Loop, since the acquisition timestamp is actually the same for all 10 channels.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 7 of 11
(251 Views)
Solution
Accepted by topic author Labviewboyy69420

After some of the feedback and just trying different things I solved it by: Having a foor-loop with N=1 for time (since the timestamp is to be sampled once, then a for-loop with N=10 for the samples, since one stream of boolean values have 10 channels.

 

Thanks to all for your input!

0 Kudos
Message 8 of 11
(217 Views)

Hi boyy,

 


@Labviewboyy69420 wrote:

Having a foor-loop with N=1 for time (since the timestamp is to be sampled once, then a for-loop with N=10 for the samples, since one stream of boolean values have 10 channels.


Two comments:

  1. A FOR loop set to iterate just once is most often Rube-Goldberg...
  2. You don't need to set the iteration count (N) when you employ autoindexing of input arrays...
Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 9 of 11
(202 Views)

1. The first for loop might be unnecessary.

 

2. I don’t need to for the loop to funtion. But aestetically on the spreadsheet, this isolates the timestamp sampling from the boolean sampling and results in a single timestamp for all 10 channels per reading (loop count).

0 Kudos
Message 10 of 11
(196 Views)