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

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

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

  • 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.

  • 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;