COUNT('Expression', 'Level*', 'Hysteresis*', 'EdgeType*', 'Reset*')

Arguments

'Expression'

Signal (digital or analog) that supplies the meter pulse

'Level*'

Specification of the level value

If ‘Expression’ is a digital signal: Level = 0.5

If ‘Expression’ is an analog signal: Level = Tolerance value

'Hysteresis'

Specification of a hysteresis band

If ‘Expression’ is a digital signal: Hysteresis = 0

If ‘Expression’ is an analog signal: Hysteresis = Permitted value fluctuation about ‘Level’ without it being counted again

'EdgeType*'

Indication of whether rising, falling, or rising and falling edges should be counted

'EdgeType' <0

Only falling edges (leaving hysteresis band in negative direction)

'EdgeType' >0

Only rising edges (leaving hysteresis band in positive direction)

'EdgeType' = 0

Falling and rising edges

'Reset'

Optional digital parameter that can be used to reset the counter. ‘Reset’ can also be an expression itself.

'Reset' > 0

Counter is reset

'Reset' = 0

Counter value is retained / continues to count (default)

Description

The function counts the crossings of 'Expression' through 'Level'. The 'Hysteresis' parameter can be used to define a tolerance band which is above and below 'Level' by equal amounts. Only complete crossings through the tolerance band are counted. The 'EdgeType' parameter determines which kind of edges are counted. The 'Reset' parameter is used to reset the counter value to 0. 'Reset' can also be formulated as an expression.

Example

Calculation of strip length by counting meter pulses

COUNT ([meter pulse], 0.5, 0, 0, Oneshot([tracking_ID]))

Each time the digital signal [meter pulse] changes from TRUE to FALSE or from FALSE to TRUE, the counter is incremented by 1. The counter value corresponds to the length in meters. If the tracking ID changes (= new tracked part), the OneShot expression returns the value TRUE for one cycle and thus resets the counter to zero.

The figure shows the example in the expression builder.