LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Logger Timing and Event Recording Issue

Hello all,

 

I’ve only been using LabView for a week or two, so I’m pretty green and everything that I’ve done so far is by learning from my mistakes, however I have a few issues that are eluding me so I thought I’d post here to get some help. I think my lack of knowledge is the main stumbling block, so please go gently! I have a basic program up and running that is attached.

 

Here’s some background:

I have a requirement to test the output of four electronic devices during a test. A lack of output from the device indicates that the device under test has failed and the elapsed time from when the test started should be recorded. The output from the devices is a +3.3V logic signal (DC level). The test will be extended in the future to incorporate more channels, but for now four will be use to keep things simple (and utilise existing hardware).  The test system will run for approximately 3000 hrs (~125 days) continuously (so any timer roll-over etc should be accounted for). Due to the nature and length of the test, the timing resolution of the system can be to the nearest second.

 

LabView Requirements:

-          Monitor four analogue channels (+3.3V DC)

 

-          Detect when signal falls below a prescribed threshold (say +2.5V DC, but make the level selectable)

-          Plot all four waveforms

-          Indicate a ‘faulty’ channel using a Boolean indicator

-          Display elapsed time (since test starts or since VI first run). One Sec resolution.

-          Log to file the elapsed time when a channel falls below the selected threshold. TDMS or Excel file output.

 

Equipment:

-          cDAQ-9178 Compact DAQ backplane

-          NI-9229 Analogue card

 

Issues:

 

The first issue is with the timing of the program. I’m not sure how to implement this correctly. I could use the Tic command, but I’m not sure how to display the data. I’ve tried using other methods but the time always starts from Friday, 12:00, 1st Jan 1904. I’m guessing that this is an epoc/reference start time and anything time derived from this should be accounted for?

 

Second issue is with the logging of data. I’m not sure how to add in a condition that says ‘If threshold <2.5 then log to file data and time etc’ for each analogue channel. Maybe a switch statement is required to test for this condition? Still not entirely sure how to setup the TDMS logging in order to do this? At the moment I'm getting all of the data, when I only want and event occuring on each channel.

 

Any help would be hugely appreciated!

0 Kudos
Message 1 of 12
(2,794 Views)

1. Change your DAQmx Read to output an array of waveforms.  Specifically, use the Analog->Multiple Channels->Multiple Samples->1D Waveforms (Samples).  This is important since waveforms contain the timing information as well as the sample data.  Your 2D Array has none of that timing information.  This will fix all of your chart and math issues.

 

2. No need for the Wait function.  Your loop rate will be determined by the DAQmx Read.  By default, you have a sample rate of 1000Hz and each read will read 1000 samples.  So this will cause your loop rate to be 1Hz.

 

3. As far as only logging the transitions, you will need a case structure.


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 2 of 12
(2,766 Views)

Thanks crossrulze, that's fixed  whole heap of issues. 

Is there a more elegant way of doing the timing? I'd like to implement a stopwatch function that starts a timer going a the push of a button. The elapsed time is displayed and any drops in threshold synced to that time?

0 Kudos
Message 3 of 12
(2,762 Views)

I was thinking of scrapping TDMS and going along the lines of using the Get Date/Time in seconds vi to create a time stamp and passing this into an array with the trigger information (see attached) and passing it into a Write Delimited Spreadsheet vi. It sort of works but the 'Runtime' value is negative and the excel file outputs an odd value with it (presumably it's the double of Jan 1st 1904...).

 

EDIT: The forum wont let me attach a file?...

0 Kudos
Message 4 of 12
(2,754 Views)

Here's an image of what I'm describing above:

 

ExcelFileLogging.jpg

0 Kudos
Message 5 of 12
(2,742 Views)

@CrashEd wrote:

It sort of works but the 'Runtime' value is negative and the excel file outputs an odd value with it (presumably it's the double of Jan 1st 1904...)..


That is because you have your inputs swapped on your subtraction.  It should be Current Time - Start Time.

 

What I would do is get the start time and then subtract from the times coming from the threshold detectors and put those in the spreadsheet file.


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
0 Kudos
Message 6 of 12
(2,734 Views)

I think my little "State Machine Example" will be a good fit here, as I made it to to teach a colleague how to properly do long term data collection. We do not use any NI DAQ hardware ($$$) so I can't help with the DAQ portion but it this is a good programing architecture to learn and you might pick up a few tricks.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 12
(2,724 Views)

 

What I would do is get the start time and then subtract from the times coming from the threshold detectors and put those in the spreadsheet file.


Yes, this sounds like a good idea, although I'm not sure I know how to bundle the data together and feed it into the spreadsheet vi. I've tried a few things but it's eluding me so far!

wrote:

I think my little "State Machine Example" will be a good fit here, as I made it to to teach a colleague how to properly do long term data collection. We do not use any NI DAQ hardware ($$$) so I can't help with the DAQ portion but it this is a good programing architecture to learn and you might pick up a few tricks.

 


Thanks - I'll take look. It looks similar to what I want to achieve.

0 Kudos
Message 8 of 12
(2,711 Views)

Well, I'm totally stumped. I can't seem to get data logging to an excel file when the trigger level falls below a certain point (it logs continuously). On a plus side the timing seems to be sorted now.

 

0 Kudos
Message 9 of 12
(2,695 Views)

As you are beginning to see a "One Big Loop" program architecture is not going to cut it.

 

Time to learn a simple yet scalable program architecture like a State Machine.  

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 12
(2,685 Views)