LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronous Time Averaging from a data file

First, I am not a programmer. I have a background in vibration and frequency analysis on paper machines. I sometimes collect data from a Labview based QCS system and analyze it. 

I need to make Labview perform an automated function and struggling with this. I am limited to version 6.1 as that is what our system has been running on for several years. Example: I have a spreadsheet or text file that has an array of 1000 elements. I need to read the first X number of elements, example 100 elements, and write it to another spreadsheet or text file. I need to read each subsequent block of elements and write them to the second spreadsheet or text file on the next line or column and do this until the entire first file has been read. I am basically trying to do a time synchronous average of sections of an array. Example: if I know the sample rate the data was taken at and a rotating component is running at a certain frequency, I will know the number of elements that would equate to one revolution. Each line item of the second file would one revolution of data elements. Every attempt has failed. 

0 Kudos
Message 1 of 12
(1,955 Views)

@elwgreen wrote:

First, I am not a programmer. I have a background in vibration and frequency analysis on paper machines. I sometimes collect data from a Labview based QCS system and analyze it. 

I need to make Labview perform an automated function and struggling with this. I am limited to version 6.1 as that is what our system has been running on for several years. Example: I have a spreadsheet or text file that has an array of 1000 elements. I need to read the first X number of elements, example 100 elements, and write it to another spreadsheet or text file. I need to read each subsequent block of elements and write them to the second spreadsheet or text file on the next line or column and do this until the entire first file has been read. I am basically trying to do a time synchronous average of sections of an array. Example: if I know the sample rate the data was taken at and a rotating component is running at a certain frequency, I will know the number of elements that would equate to one revolution. Each line item of the second file would one revolution of data elements. Every attempt has failed. 


LabVIEW 6.1? Oh my it has been a long long time but...

 

I don't think the Excel report toolkit was part of 6.1 unless you purchased it separately, but that dose not matter as I never used it anyway. So I would first save any Excel files as a (tab delimited) text file or csv so LabVIEW can open them with the old "Read From Spreadsheet" VI (I think that's what it was called) and write them with "Write to Spreadsheet file"

 

From there it sounds like a bunch of array manipulation and we would have to see some code to get an idea where you are having the most trouble.

 

Attach your code, and some sample data to test with. 

========================
=== Engineer Ambiguously ===
========================
Message 2 of 12
(1,924 Views)

You have the black signal. And you want to break it up into the rainbow of signals:

 

Cycle Based Subsets.png

 

Here's what the code looks like in LabVIEW

 

Subset by Cycle.png

 

This code works well for constant speed machinery which I bet applies to your rollers. 

 

LabVIEW 6.1 - 20 years is a good run! I believe the above functions were available in 6.1. 

 

You can do as much as all of the time synchronous averaging in LabVIEW, or you can get the data to Excel as fast as possible and leverage the spreadsheet features - your choice along that spectrum. I agree with RTSLVU that a delimited file is probably the best way to transfer data between LabVIEW and Excel. Post your code when you have an update. 

Doug
NI Sound and Vibration
Message 3 of 12
(1,898 Views)

Without knowing how much data you have, nor much about the data itself, I'm offering the following comments based on what you've said:

  • You are not a programmer.  I assume you are largely unfamiliar with LabVIEW programming.
  • You are using LabVIEW 6.1, released almost 20 years ago (April 12, 2001).
  • Your data are in "Excel" files.
  • The manipulation you want to do is to take a single WorkSheet with, say, 1000 data points, create additional WorkSheets with subsets of the data (say, 100 points/WorkSheet), and do some simple analysis on each WorkSheet (such as averaging across all of the rows, i.e. if there are 40 columns and 30 of them are numeric, computing a Result Row with the average values of each of those 30 numeric columns).

I assume that there is no one available who knows LabVIEW.

 

Question #1 -- are these "Excel" files what I'll call "true" Excel files, with the (proprietary) extension .xls or .xlsx?  If the answer is "Yes", then you'll either need the Report Generation Toolkit, an Add-on product that you might not have, or you'll need to use Excel to convert your data to a Text file, possibly in the Comma-Separated Value format which has the .csv extension, and which Microsoft "kindly" confuses LabVIEW users by assigning these files an icon that strongly suggests Microsoft Excel.  Text files (including .csv) can easily be read and parsed into 2D Arrays of strings (or numbers, if you are careful) by LabVIEW.

 

Question #2 -- do you have to do a lot of these files?  If there are a "manageable number" (you decide), why not just use Excel to create the additional WorkSheets for you (methods can easily be found on the Web) and do (in Excel, with a Formula) whatever data manipulation you need.

 

This isn't a difficult problem to solve with LabVIEW, but I certainly don't have familiarity with LabVIEW 6.1 (my first version was 7.0, and we did have the Report Generation Toolkit, which was quite primitive and "clunky" in those days -- it is much better now!).  It sounds, however, that you don't have the resources (or justification for spending) to get a current LabVIEW license and develop (or hire) LabVIEW experience.

 

Bob Schor

0 Kudos
Message 4 of 12
(1,873 Views)

Note that in my previous snippet, you will replace the waveform generation VI with code to read the data file and build the waveform.

Doug
NI Sound and Vibration
0 Kudos
Message 5 of 12
(1,861 Views)

I appreciate the assistance. I am not sure I was clear in my description. I want to extract segments of a spreadsheet array and move the segments into another spreadsheet file side by side or if transposed, from top down.

Alternatively, if the segments could all be averaged together and result array written to a spreadsheet file it would achieve the same result. 

 

I am trying to use your example and struggling with one issue. Can't seem to get the output of the spreadsheet file into the Y input of the Build Waveform. 

 

 

0 Kudos
Message 6 of 12
(1,832 Views)

Actually I get what I want from Excel without Labview but since I am not a programmer, I do this manually. I create a spreadsheet based sync pulse signal using the same sample rate and align it to the side of the column of data. I then manually grab blocks of data between the text pulses, cut and paste them side by side to the right. I then average them and get the results. The problem is some of these files are huge and it can take a very long time to get the results. I don't know VBA and barely know my away around Labview. 

0 Kudos
Message 7 of 12
(1,830 Views)

It is extremely difficult, and very frustrating for us, when a Poster asks for help and refuses to (a) attach a sample data file (when part of the problem involves reading and processing a particular type of data file) and (b) refuses to attach LabVIEW code (not a "picture" of LabVIEW code -- a picture of a 1000-line Matlab program listing is not the same as a Matlab program).

 

If you are willing to attach a data file, tell us what criteria you want to use to decide when/where/how to break up the file (i.e. "every 10 lines" or "when 15 minutes of data have been collected"), and give us some idea what you want done with the "isolated" lines (such as "Make separate files with a suffix _01, _02, etc."), we could easily explain how you could use the LabVIEW File I/O functions, along with String Processing and Array Handling, to achieve what you want.  If you want us to critique your LabVIEW code, attach the code (no more "pictures of code", please).

 

Bob Schor 

0 Kudos
Message 8 of 12
(1,815 Views)

My code is broken because I haven't determined how to make one connection. I have attached the VI and the text file. The read from spreadsheet file gives two options. One is first row and the other all rows. The "all rows" don't want to connect to the Build Waveform subvi. The file is quite long. 500,000 samples. There is a 4.45hz frequency in this file. This would mean that I need to take 224.72 samples, rounded up to 225 in blocks until the file has been read and parsed. I usually take the data from the measurement system at 1000hz. The frequencies will vary depending on the machine speed and which rotating component is causing the variation. I just want to grab sample blocks of data, in this case 225, and move them side by side or on top of each other line by line so I can average them in Excel or in Labview but that may be asking too much. I really do appreciate any help I can get. 

Download All
0 Kudos
Message 9 of 12
(1,802 Views)

Is "Tach Frequency" the 4.45Hz? Do you want to specify it (with a Control) or calculate it (with the Single Tone Information VI)?

cbutcher_0-1617114138334.png

 

Here's a rewritten example showing the method that I think you're looking for - it produces the following graph (although with so many iterations, it's fairly unclear... but you could do averaging with this etc.

cbutcher_1-1617114184111.png

 

I can't upload the VI, because I don't have anything that will save to 6.1, but hopefully you can see the nodes.

The red X is just because the VI was since updated, but the "old" version is still in LabVIEW.

The node immediately following that is "Index Array", and I'm also using "Array Size" a little further along.

 


GCentral
0 Kudos
Message 10 of 12
(1,792 Views)