Calculate the difference from the rotary counter value and obtain the integrated value as a result. For example, for a rotary counter that can range from 0 to 9999, specify 9999 as the max (maximum value).
example)
As an example, we will explain how to obtain the integrated value from an automatic counting counter.
To calculate the accumulated value, the range of the ring counter (e.g., 0 to 9999), the history of changes in the ring counter value (how much it changed from and to), and the current accumulated value (the accumulated value calculated previously) are used.
Specifically, first, save the change in the value of the accumulating counter as history data in an array. If the range of the ring counter is 0 to 9999, and the history data of the accumulating counter has changed to 10, 20, 30, and 40, and the previously calculated accumulated value was 1000, specify it as follows.
Math.AddingUp(1000,c(10,20,30,40),9999)
The result is 1000+(40-10), which is 1030.
|