hschir Posted July 25, 2011 Share Posted July 25, 2011 I want to be able to determine how many seconds a pump has been running for in order to determine how much water it has delivered to a vessel, given that it delivers at a rate of 1 Litre per second? Any ideas? Link to comment Share on other sites More sharing options...
AzeoTech Posted July 26, 2011 Share Posted July 26, 2011 Sure, just store the time when you turn the pump on: pump = 1 // turn pump on global pumpStartTime = systime() Then, the run time on the pump is simply: systime() - pumpStartTime Of course its only valid when pump == 1 Link to comment Share on other sites More sharing options...
hschir Posted July 26, 2011 Author Share Posted July 26, 2011 Thanks, I want to turn the pump on based on an alarm from a Davis Vantage Pro 2 weather station for daily sunrise time and then turn off based on an alarm from a water level sensor. I guess then that the script should read (something like) ; global pumpStartTime = sunriseAlarm What else do you suppose I need to do? I suppose also that I need to know the best way for the pump channel to respond to the sequence. Any suggestions about this would save me tearing my hair out more than necessary. I have done C programming in past (about 20 years ago) so I'm a bit slow of the mark at this stage - I apologise for that - but any assistance is greatly appreciated - Link to comment Share on other sites More sharing options...
AzeoTech Posted July 27, 2011 Share Posted July 27, 2011 No, you are going down the wrong path. pumpStartTime should always be set to systime(), as it is simply a recording of the time when the pump is turned on. I'm assuming sunriseAlarm is a channel from the Davis unit that goes to 1 when its sunrise. If so, go to the event of sunriseAlarm and put something like: if (sunriseAlarm[0] && !sunriseAlarm[1]) pump = 1 global pumpStartTime = systime() endif Link to comment Share on other sites More sharing options...
hschir Posted August 8, 2011 Author Share Posted August 8, 2011 Thanks - that should do it Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.