• 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

    Unsolved How to calculate cumulative change in value only if certain condition is true

    Scripting general Discussion
    2
    2
    1.4k
    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.
    • G
      gourav saini
      last edited by gourav saini

      Hi all,
      I have a process where different solvents are added to a single vessel via actuator valves. The total weight inside the vessel is captured from a load cell.
      I want to create application where total amount of each solvent added to vessel is captured.
      For that I want to log the total amount of weight increment in the vessel when the valve is open.
      But I am not able to create a meta script point where total increment in weight when valve is in open condition is captured.

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

        Hi gourav,

        It sounds like you want a numeric Meta point something like this...

        //valve is the boolean point controlling the valve, updating ontext, logging on change
        //total is the numeric point measuring the weight in the vessel
        if(valve.value || my.time > valve.lastValue().time) return "no value"; //we'll not be logging here... set data type exception to ignore!
        //Okay, valve just closed
        var values = valve.last(2);
        var difference = total.value - total.pointValueBefore(values[1].time).value;
        return my.vaiue + difference;
        1 Reply Last reply Reply Quote 0
        • First post
          Last post