User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
108
Example - Flow Totalisation
The following example shows how to accumulate a flow volume from a flowrate analog input. For this
example, the flowrate engineering units are 4-20mA=0-100 L/s. Each second, the number of litres that have
flowed (FlowLastSec, #R10) is calculated by dividing the analog input by 32760 (the raw analog input range)
and then multiplying by 100 (the high limit of the engineering units). This number of litres is then added to the
FlowTdy(L) total (#R11). When FlowTdy(L) equals or exceeds 1000 litres, it is rolled over into another
register FlowTdy(kL) (#R12).
Calculate Flow Totals (Calculated from 0-100L/s)
DoEvery1Sec FlowLastSec
#YTICK.SEC #AI14.2 ┐│
├─────┤ ├────────────────────────────────────────────────────────┬┤* 100 ├┤
│└/ 32760 ┘│
FlowTdy(L)
│┌ #R11 ┐│
└┤= #R11 ├┤
+ #R10 ┘│
FlowTdy(L) FlowTdy(kL)
#R11 #R12
├─────[]────────────────────────────────────────────────────────┬────(Inc)────┤
1000
FlowTdy(L)
│┌ #R11 ┐│
└┤= #R11 ├┤
- 1000 ┘│
Figure: Flow Totalisation
Example - Rolling Totals Over At Midnight
When the real time clock reaches midnight, or the RTU detects that the day has changed, a 12AMRollover
flag can be set. This flag stays true for 1 ladder scan and can be used to roll over totals at midnight.
Manage Daily Rollover Flag (Set At Midnight)
New Day? 12AMRollover
#YDAY #R100.4
├──[CHANGE]───────────────────────────────────────────────────────────( )─────┤
Figure: 12AM Rollover Flag
The example shown below rolls over P1 StartsTdy by copying the total to P1 StartsYes register and then
resetting P1 StartsTdy to zero. Note: a number of rollovers can be combined into a single Multi-Copy block.
Rollover Totals At Midnight
12AMRollover P1 StartsYes
#R100.4 #R5
├─────┤ ├────────────────────────────────────────────────────────┬───(Copy)────┤
#R4
P1 StartsTdy
#R4
└───(Copy)────┤
0
Figure: Rolling Over Totals At Midnight