Convert pulse flow meter to litre p/hour or positive flow or not
-
Hey Guys, long time no post...
I have a new flow meter on a water system setup I am running on Mango.
It's a pulse flow meter, I don't know how many pulses per litre at this stage but I can work that out by watching the level in the tank over a time period.
The issue I have is the digital input on my RTU (Moxa E1212) is 2 byte unsigned, and with the current resolution I have monitoring the pulses it go's over 65000 pulses rather quickly and resets back to 0 then counts again.I've got Mango reading this value, and it's accurate, however I'm basically wanting to read the value and set something to say yes the pump is running. We're not too worried about flow rates as we can work this out from the water going into the tank upstream.
Do you think it would be easiest to achieve this with some more lines in my script? I'm not sure how to write in script form the following:
if flowmeter value now is more than flowmeter value 10 seconds ago, then set value of point to 1 or if flowmeter value now is the same as flowmeter value 10 seconds ago, then set value of point to 0
Something along those lines anyway. The main issue we have is a solar pump in the system has a nice control panel on the front of it, but no external indication to tell us the pump is running :(
Regards
Dan -
If I understand you correctly...
p1 = status point (virtual or script point, or use this whole thing as a meta point)
p2 - pulse counterTOLERANCE = 5 //if you want to accept some number of pulses as a non-running prevValue = p2.ago(SECOND, 10); if ( p2.value > prevValue + TOLERANCE) p1.set(true); else if ( prevValue > p2.value && (prevValue + TOLERANCE)%65536 > p2.value ) //wrap around case p1.set(true); else p1.set(false);
-
Thanks for that Phil, I'll give that a go and will report back.
Cheers
Dan -
That worked great, thanks heaps! I changed the timing to 5 seconds as it was taking a little while for the state to change once the flow was detected.
I put a flashing green LED on the graphical view for when the pump has normal flow and a solid red LED for when it's not seeing any flow.Thanks again.
Cheers
Dan -
Not a problem!
I think I messed up the logic a little... This makes more sense, thinking about it another few minutes...
TOLERANCE = 5 //if you want to accept some number of pulses as a non-running prevValue = p2.ago(SECOND, 10); if ( p2.value > prevValue + TOLERANCE) p1.set(true); else if ( prevValue > p2.value && (prevValue + TOLERANCE)%65536 < p2.value ) //wrap around case p1.set(false); else if ( prevValue > p2.value ) p1.set(true); else p1.set(false);
-
ah ok, it's kinda working now. Thanks for the update.
I'll try the changes later and see if it makes much difference to the results?Cheers
Dan