Save value after reset and accumulate that value overtime
I want to start machine and reset at some point and save that value to "x", when it resets it starts again at 0 and the x value accumulates over time (Past value + current Value)... how can i achieve this.
Your requirements are not clear on what are the inputs and all. I assume that there are inputs for start, reset and real value(flow) that need to be accumulated. I think of the below logics.
(* flow rate to flow value *)
flowValue := Xvalue * scan time in sec / 3600;
if (start and not reset or running) then
running := true;
accumulation := accumulation + flowValue; (* if not flow then replace it with XValue*)
elsif (reset and running) then
lastValue := accumulation;
running := false;
accumulation := 0.0;