LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Storing sensor data from rs232 port

I have a problem trying to figure out how to store data that I receive from a temperature and oxygen sensor on the rs232 port.

The data I receive is a ascii string, I have seperated the strings and numbers, by using "scan from string", and now I need to store the different values and also display them in a graph or something. 

 

I have manage to write to a text file and read from it, but dont feel this is the best way.  This is a sensor thats going to be logging for quite some time. 

 

At the moment I'm looking into TDMS file, but not sure about that either, have also thought about using a sql database??

So I need some help figureing out the best solution for me.  And it must be easy to create reports and graphs.

 

And I'm not  experienced in labview, so I'm trying to keep it simple.  I use Labview 8.6  🙂

0 Kudos
Message 1 of 4
(2,865 Views)
Text files, binary files, databases are all easy and suitable, but we can't
tell you what is best. Especially without any details (how long, how fast,
how much, what reports, what graphs etc).

I'd forget about your inexperience for a minute, and think about what the
best solution is.

Then, post a question about how to implement that. Or do a LabVIEW basics
course...

Regards,

Wiebe.


Message 2 of 4
(2,823 Views)

a little bit more detailed..lets see, the string from the sensor is like this "MEASUREMENT   3835    619 Oxygen:     213.07 Saturation:     104.49 Temperature:      28.08" 

So I need to store the numbers 213.07 , 104.49 and 28.08 .  And I've manage to take these numbers out from the string.  So now I need to store and display these data.

The sensor is going to be logging every 5 second, but I need only to store every 4-5 minutes.  The sensor is also going to be logging for years.  And I need a 2D graph that shows a time line and the values at that time.  I also want to scale the timeline to see hours, days, weeks..

 

So I'm looking for the best way to store these data, TDMS, MySQL, ACCESS, TEXT or something else??

 

 

0 Kudos
Message 3 of 4
(2,793 Views)
For 4 years, logging 100 bytes 12 times per hour (every 5 minutes), your
file will still be only 40 MB.

I'd read my data and concatenate the ASCII data to my file. Make a large
buffer, and at the startup of the program load the file and put the parsed
data into a binary array buffer (because over several years, the system will
crash a few times). You can do this streaming, so you don't need to fit the
entire file in memory. This buffer is still large, but smaller then 40 MB,
since binary data is smaller then ASCII data. Something like 26 MB. When
adding to the file, also replace the data in the buffer. Keep a pointer of
the current element. All this data will fit in memory just fine.

To display the data, you'll have to interleave the data. So you have to make
functions in the buffer to get interleaved data if the range is getting too
large. You can make several ranges.

If you don't want to be limited to a certain number of years, you can adjust
the system a little. Make a new file for each year. When the user changes
the scale of the chart, read in the necessary files, and put them in a
buffer (if they aren't in memory already). You'd put the interleaved data in
the buffer, so the buffer will never be really big.

Of course, you can do the exact same thing with TDMS files, or even with
databases. But getting interleaved data from a database can be difficult.

It's not beginner stuff, but it's not very hard. I'd would worry about
keeping the rest of the system running for years though. If you're running
Linux, you might have a change.

Regards,

Wiebe.




0 Kudos
Message 4 of 4
(2,782 Views)