App-30
IM 04L51B01-01EN
Example3:ResetWhenthePulseSumValueExceedsaCertainValue
Reset the sum value when the pulse sum value exceeds a specified value (reset value) and
carry over the value exceeding the reset value to the sum after the reset.
Count the number of resets and calculate the total sum value up to that point.
0 0 1 1 1 2 2
Number of pulses
per scan interval
Sum value
Reset count
Pulse input
Time
Reset value
(Resets the value below the reset value)
(Sum)
0001
K001
A001
A002
Scan interval
Expression
Assign the computation channel and set the expression. Set the span lower/upper limit and
unit according to the application.
Channel Expression Description
A001 ((A002+0001).GE.K001)+A001 Pulse sum value reset count
A002 CARRY(K001):TLOG.SUM(0001) Pulse sum value
A003 K001+A001+A002 Total sum value
Constant Description
K001 The reset value. The sum value is reset when this value is exceeded.
Channel A001: Reset Count
Calculates the number of times the pulse sum value is reset.
The expression “((A002+0001).GE.K001)” is set to 1 when “the previous pulse sum value
(A002) + the current pulse count (0001)” is greater than the reset value (K001). Otherwise,
the expression is set to 0.
The value of channel A001 is incremented when the pulse sum value exceeds the reset
value.
Channel A002: Pulse Sum Value
Calculates the pulse sum value.
Under normal conditions, the pulse sum value TLOG.SUM (0001) is calculated. When the
pulse sum value is greater than or equal to the reset value (K001), the pulse sum value is
set to the amount exceeding K001.
Channel A003: Total Sum Value
Multiplies the reset value (K001) by the reset count (A001) and adds the pulse sum value
(A002) to derive the total sum value.
Note
• The computation is performed in order from the channel with the smallest channel number
in one scan interval. If the channel number in the expression is greater than or equal to the
channel number in which the expression is assigned, the previous computed result (previous
value) is used for the channel in the expression.
• If the pulse input value of the scan interval is greater than the reset value, correct computation
cannot be achieved.
Appendix 7ComputationExamplesUsingPulseInput