i am currently trying to implement a synthetic variable with calculates the volume measured by a flowmeter. The flowmeter gives me the flowrate, so liters/second. From that i want to calculate the volume. My approach is to discretly integrate the flowrate as follows:
delta_t=flow_rate.timestamp-shift(flow_rate.timestamp,-1) previous_flow=shift(flow_rate,-1) volume=volume+previous_flow*delta_t
When is the expression of the synthetic variable call/calculated? Because it would need to be only when there is a new data point coming in. And the variable volume would need to be a variable which is safed overe the iterations.