• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Convert pulse flow meter to litre p/hour or positive flow or not

    User help
    2
    6
    2.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • danD
      dan
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by phildunlap

        If I understand you correctly...

        p1 = status point (virtual or script point, or use this whole thing as a meta point)
        p2 - pulse counter

        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(true);
        else 
          p1.set(false);
        1 Reply Last reply Reply Quote 0
        • danD
          dan
          last edited by

          Thanks for that Phil, I'll give that a go and will report back.

          Cheers
          Dan

          1 Reply Last reply Reply Quote 0
          • danD
            dan
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • phildunlapP
              phildunlap
              last edited by phildunlap

              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);
              1 Reply Last reply Reply Quote 0
              • danD
                dan
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post