TIme Above a Certain voltage


Recommended Posts

I am continuing to build my weather station using Labjack U3 and DAQFactory. All is going well but the current project is to record sunshine hours. I am able to record the voltage that the device outputs, and I know that above a certain voltage then 'official' sunshine is being recorded. However, I need to know if there is a way to total the amount of time spent above that voltage, so i can record the number of hours of sunshine?

I should mention that I restart the program each day at 0900z to reset all the counters.

Thanks for your help.

Best wishes

Mike

Link to comment
Share on other sites

Sure, create a global variable to store that total and initialize it to 0 in the morning. Let's say you call it "DaylightTotal". Then, in the event for the sunshine channel with the voltage you are looking at, you'd put (assuming that channel is called "sunshine", and its light out when its > 3):

if (sunshine[0] > 3)

DayLightTotal += sunshine.time[0] - sunshine.time[1]

endif

Now Daylighttotal will have the number of seconds that sunshine is > 3.

Note that you can probably reset all your counters without restarting...

Link to comment
Share on other sites

  • 4 weeks later...

Sorry for the delay in replying, work gets in the way of these things. I have done as you have suggested and all seems to be working well, although i do have a -ve sign in front of the result.

I am also working on resetting the counters by 'button' pressing. I have managed to get one working, but at the moment the others are being a bit elusive and either do not respond or cause errors. I have even tried running the startup script by button and that doesn't succeed either. However, that is a work in progress, my main aim is to get the sensors online. just the temperature sensors to go now and also to try and add on a 1-wire barometer. Then it is complete.

Thank you for your help. Without it I would not have got nowhere near this stage.

Best wishes

Mike

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.