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.
How to calculate cumulative change in value only if certain condition is true
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.time).value; return my.vaiue + difference;