LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a DD:MM:YY HH:MM:SS column into a spreadsheet file next to recorded data

Hi

I'm pretty new to labVIEW and I'm using it for one of my projects at University, I have gotten a little stuck and have search through the forums, but everything I have found seem to be too complicated for what I need.

I have set up a VI that uses peak count to determine the number of times a proximity sensor picks up movement. I then need to record this data in a spreadsheet or text file, (anything that can be read), in a format similar to this:

 

20.02.10 11:45:03 1

20.02.10 11:45:04 0 

20.02.10 11:45:05 0 

20.02.10 11:45:06 0 

20.02.10 11:45:07 0 

20.02.10 11:45:08 0

20.02.10 11:45:09 1

 etc.

 

The data from the proximity sensor is either 0 or 1 depending whether the sensor has detected movement or not. The sensor will be attached to a tipping bucket rain gauge so I know how many times the bucket has tipped and when it tipped.

 

I will attach my VI asap but any suggestions (even if it means starting again) will be very useful.

 

Thank You in advance

 

Ben (Civil Engineering MEng Undergrad.) 

 

NB - I'm using Labview version 8.6 

Message Edited by esuhfz on 02-20-2010 06:09 AM
0 Kudos
Message 1 of 6
(3,621 Views)

Use the Write to Spreadsheet File function and set it to write out strings.

 

If you still have questions, then please post your VI so we can see what isn't working for you.

0 Kudos
Message 2 of 6
(3,606 Views)

Esuhfz,

Here is a VI you may be interested in. Its a quick and dirty vi that takes in two doubles, and logs them to a file with a date/timestamp.

 

The data to log can be converted from a double to an I8 or I32 by changing the convert to string function to fit your needs. If you only need one data input, you can remove the second input and just readjust the concatenate string function. You can also play around with the format date/time stamp to match what your looking for.

 

I've included the two VI's you'll need and the example log file.

 

If you have any questions, please let me know. Good Luck!

 

-Joe

 

0 Kudos
Message 3 of 6
(3,589 Views)

Hey,

Thanks for your help so far. I thought I would upload the VI so that you could see what I was attempting to create.

Do suggest other methods/arrangments, Im a novice with this program.

Thanks once again

 

Ben

0 Kudos
Message 4 of 6
(3,557 Views)

Ben,

I've added some comments to your VI and I have a few more questions about what you are trying to

accomplish with your VI. Please take a look and get back to me.

 

I see that you have the loop condition control (stop sign) of the while
loop tied to the stopped function of the analog input. how many times do you want to the
loop to execute? I've changed things around a bit to include a manual stop button, a specific
loop execution count and the tied in the stopped function of the DAQ assistant.

Is there ever a condition where you would have a negative value from your peak detect function?
I am not sure why you have the absolute value function in there.

It looks as if you are summing the signals each time throug  the loop and writing them to a seperate file.
Is this correct?

Can you please explain to me a little more about what your trying to get this function to do? Do you need seperate files?
How does your sensor work? Is there a way to dump the accumulated rain between samples? Is it a float style sensor?

Thanks,
-Joe
 

Message 5 of 6
(3,538 Views)

Joe,

 

I want to eventually plot the values recorded on a graph of, rainfall (mm) against time (hrs), I therefore placed it all in a loop so that every hour it would record the value to a spreadsheet and then this spreadsheet data could be manipulated at published.

The loop I initially put for a shorter amount of time for testing purposes but in the end it would need to write the files every 3600 seconds.

All the readings I want in one file in the format explained later on in my reply, therefore I want to append the readings and I selected this in one of the settings.

 

Is there ever a condition where you would have a negative value from your peak detect function?

No I will never have a negative reading – so the absolute value could be removed.

 

It looks as if you are summing the signals each time through the loop and writing them to a separate file. Is this correct?

I did originally have a summation but this is no longer needed. My basic/initial aim is to record the date and time the bucket tips (explained later on in the reply)

 

Can you please explain to me a little more about what you’re trying to get this function to do? Do you need separate files?

No I do not need separate files, I am attempting to write into a spreadsheet or other file type:

      DDMMYY in the first column

      HH:MM:SS in the second column

      Sensor reading in the third column – this reading will either be 0 or 1 depending if the sensor detected anything in that corresponding second.

I therefore want the spreadsheet to look similar to this:

     230210      10:19:00      0 (therefore no rain detected by the tipping bucket rain gauge)

     230210      10:19:01      0 Ditto

     230210      10:19:02      1 Bucket tipped setting off sensor

 

How does your sensor work? Is there a way to dump the accumulated rain between samples? Is it a float style sensor?

The rain gauge is a tipping bucket rain gauge, (http://en.wikipedia.org/wiki/Rain_gauge). I have mounted the sensor within the rain gauge and it will act like the reed switch in this diagram; http://www.google.co.uk/imgres?imgurl=http://www.weathershack.com/images/tipping-bucket-rain-gauge.g....

 

Every time the bucket tips the centre of the bucket passes the proximity sensor, creating a peak – hence the peak count, this peak is always higher than 0.02. I have set that due to back noise the sensor creating peaks that were counted this resolved this problem so it now only counts peaks when the buckets passes the sensor.

 

I hope this helps and many thanks you don’t know how much it means to me to finally get somewhere with this part of my project! Also thank you for your suggestions on standard file name formats etc I will change these aswell.

 

Kind Regards

 

Ben

0 Kudos
Message 6 of 6
(3,512 Views)