Store values over time for calculation
Hello, i want to calculate level difference from a container over time to calculate the flow.
What is the best way to store the measurement value from the niveau sensor for about 1 minute to calculate the delta level? I dont want to store one value every minute. I want to use the value one minute ago everytime for calculation. Is there any prefabricated block in functional designer? In Master System we used a MOVE for short time spans and used the cycle time of the function. But for longer times span there must be an other solution. I hope you know what i mean and someone can help me ...
What is the best way to store the measurement value from the niveau sensor for about 1 minute to calculate the delta level? I dont want to store one value every minute. I want to use the value one minute ago everytime for calculation. Is there any prefabricated block in functional designer? In Master System we used a MOVE for short time spans and used the cycle time of the function. But for longer times span there must be an other solution. I hope you know what i mean and someone can help me ...
Answers
Use an FIFO queue. See online builder help for examples. Make a queue with 60 places and push one value every second.
Hi,
In case you need to see the change of one analogue variable after every 1 min, you can create a very simple code, using MOVE block with EN parameter.
Connect the EN input of the block to the output of TON 1 min (output of TON_1min will be active only for 1 cycle) and the variable Level will be moved to Level_Mem variable (memory) every minute.
You can also use SUB with EN parameter and calculate the difference of Level and Level_Mem, prior to writing of the new value to Level_Mem. In this case Level_Diff will be the difference between Actual level and the level before 1 min.
See my example below:

![]()
In case you need to see the change of one analogue variable after every 1 min, you can create a very simple code, using MOVE block with EN parameter.
Connect the EN input of the block to the output of TON 1 min (output of TON_1min will be active only for 1 cycle) and the variable Level will be moved to Level_Mem variable (memory) every minute.
You can also use SUB with EN parameter and calculate the difference of Level and Level_Mem, prior to writing of the new value to Level_Mem. In this case Level_Diff will be the difference between Actual level and the level before 1 min.
See my example below:
Hi,
Since you want read Level value from IO Module of RealIO data type . You shall use the below logic to implement.
End of 60seconds, whatever value available in the IN at that instant will be moved to Out. So always u ll have 60s elapsed value at Out
At the begin of 0 seconds,

At the end of 60 seconds,

Since you want read Level value from IO Module of RealIO data type . You shall use the below logic to implement.
End of 60seconds, whatever value available in the IN at that instant will be moved to Out. So always u ll have 60s elapsed value at Out
At the begin of 0 seconds,

At the end of 60 seconds,

Add new comment