LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Binary file of unknown formats

Hello everybody,

I posted a message earlier today but unfortunately I missed to give more details about my problem. I am sorry about that. I am a new user of LabView so I still have many things to learn. What I am trying to do is use LabView (8.2) to read a file that was created by UVP Monitor, V3.0 (*.mfprof file).

 

This package saves fluid velocity information. There are 65 channels that form a velocity profile in a pipe. Also, there are 4096 velocity profiles, each velocity profile was captured at a time rate of 9 ms. I don’t know what is the format of these values.

At present, I obtain a text file from UVP Monitor, then process the data using FORTRAN and finally plot the results. I want to avoid this and read the UVP file, process, analyze and plot the data using only LabView. I want to read individual experimental parameters as well as the bulk of the data. In this way the user has different options to choose from before processing and plotting the results. I actually built a VI that processes and plots the text files and it runs great.

 

The problem I am facing now is that I want to read the UVP file but I have no information about the structure of it. I am assuming it is a binary file but that is all I can say about it.

The header and footer seem to be in text format, that is all I can read; however, the body of the file I am not yet able to read.

The information from the file is sent to the type cast function. Then I set a string indicator in the “Normal” option in Properties. I can read the header and footer but not the body of the file; for the body of the file all I can see is characters of the type

“C¾ Ü Qþ  X@ “. One of the other options, Password, seems to provide an output of just the characters that were originally written, but then again, I can not read the characters because it is only asterisks and I can not copy them onto a word processor either.

I have tried other options as well, such as Variant to flattened string and flattened string to variant, flatten to string and unflatten from string. Unfortunately none of them worked.

 

I am attaching the VI I wrote and a sample UVP file , I would appreciate if someone could explain to me how to deal with  complex binary files in LabView and share an example with me if possible.

Regards,

Roberto

 

Download All
0 Kudos
Message 1 of 16
(5,870 Views)
Hi Roberto,

65*4096*4 (bytes per value) = 1064960 bytes - slightly less than size of your file... So probably the velocity is written in 4 byte entities. But from a first look those 4 byte entities don't seem to be IEE754/SGL coded Smiley Sad

Maybe it's easier when you look into the FORTRAN source code and search for routines which load or parse the data file! Can you attach the FORTRAN code? Maybe someone else is able to read it Smiley Wink

It's also a good idea to show also the resulting (human readable) data to have an idea what the encoding scheme may be!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 16
(5,863 Views)

Thank you for your reply Gerd,

I actually have a text file with the velocity values, channel number and the time value. It looks like there is mor than one format. This is also making it difficult for me to figure out how to extract the information.

I use the FORTRAN program to read the text file. I don't know if it is possible to attach the FORTRAN program though. I am hoping someone has faced a problem like this before so he/she can give me a hint as to how to approach this problem.

Regards,

Roberto

0 Kudos
Message 3 of 16
(5,843 Views)
I could not find an obvious pattern and offset (tried to read with various single byte offsets (because of the text header it is not clear that the binary data is properly aligned). Are you sure the binary data is just one dataype?
 
Just paste the relevant FORTRAN code into a text file and attach it. Shouldn't be more than a couple of lines.
Basically, we need the header size, footer size, binary data size, and how the binary data is read.
 
Thanks.
 
Message 4 of 16
(5,838 Views)
OK, there is quite a distinct pattern. Here is my wild guess:
  1. 104byte header
  2. 2d I32 array (little endian!) at 69x4096 elements
  3. The first four numbers of each row are some kind of row header: 0:  always zero, 1: always twenty, 2: linear ramp from 0 to  368550000, 3: zero.
  4. rest of file is footer.

Here's an intensity graph of the first 500 rows read as above:

 

Message Edited by altenbach on 04-26-2007 07:57 PM

0 Kudos
Message 5 of 16
(5,832 Views)
OK, here's a quick draft how you could do it in LabVIEW. Modify as needed, e.g. slice out the interesting columns, etc.
 
The header has some binary data that may, or may not, mean something useful.
 
See if the data "looks" about right. 🙂
 

Message Edited by altenbach on 04-26-2007 08:13 PM

Message Edited by altenbach on 04-26-2007 08:15 PM

Download All
Message 6 of 16
(5,827 Views)

Thanks a lot for this Altenbach,

The numbers always 0 and always 20 look a little weird. However, the ramp from 0 to 368550000 may be the time interval. The intensity graph does seem right. In the upper half of it there is something that appears to be the liquid gas interface. This looks like a good indication that the file is being read well. 

Thanks again for your help.

Sincerely,

Roberto

 

 

 

 


0 Kudos
Message 7 of 16
(5,811 Views)

Thanks again Altenbach,

The third column is in deed the time interval. In the text file there are 65 channels plus the profile number and the time interval. In this output there are 68 columns though. Also, the raw velocity profiles look too high, from the text file one can see that they range from -128 to 127, and the space resolution is not present. Anyway, this is much better than all I had been able to read from this file before. I will continue modifying until I can get it right.

I am adding a text file. I should have done it before. I didn't think about it. Sorry.

Again, thank you for all you assistance.

Roberto  

0 Kudos
Message 8 of 16
(5,808 Views)


@Roberto83 wrote:
In this output there are 68 columns though.

There are 69 columns (numbered 0..68) minus the first four columns leaves us with 65 data columns for the channels. Right? Looks OK!

I saw the "range from -128 to 127" in the footer but in this case I8 would be sufficient and the file is ~4 times too large. Maybe they use some fixed-point implementation where you need to divide the number by some integer power of two. Is the data file the exact same data as in the binary file?


 

Message 9 of 16
(5,804 Views)

Yes, you are right, that leaves 65 columns for the channels, sorry about that.

I think the text file contains less information than the binary file. UVP monitor allows the user to choose from several options; i.e., export raw valocity and echo information, velocity and echo information, channels histogram, power spactrum and cross correlation data. So the text file I attached before before contains only raw valocity information and echo information. This is the data I need to carry out my analysis.

Roberto

 

0 Kudos
Message 10 of 16
(5,795 Views)