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;