embayweather Posted March 4, 2012 Share Posted March 4, 2012 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 More sharing options...
AzeoTech Posted March 5, 2012 Share Posted March 5, 2012 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 More sharing options...
embayweather Posted March 31, 2012 Author Share Posted March 31, 2012 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.