Analog comparator

Short description

The output is set and reset depending on the difference Ax – Ay and on two configurable thresholds.

Connection

Description

Inputs Ax, Ay

Inputs Ax, Ay are two analog signals from the followings:

  • AI1 to AI8 (*)

  • AM1 to AM6 (if 0BA6), AM1 to AM16 (if 0BA7), or AM1 to AM64 (if 0BA8)

  • NAI1 to NAI32 (if 0BA7 or 0BA8)

  • AQ1 and AQ2 (if 0BA7), or AQ1 to AQ8 (if 0BA8)

  • NAQ1 to NAQ16 (if 0BA7 or 0BA8)

  • The block number of a function with analog output

Parameter

Gain

Range of values: -10.00 to 10.00

Offset
Range of values: -10000 to 10000

On: On threshold
Range of values: -20000 to 20000

Off: Off threshold
Range of values: -20000 to 20000

p: Number of decimals
Range of values: 0, 1, 2, 3

Output Q

Q is set or reset depending on the set thresholds.

* AI1 to AI8: 0 to 10 V corresponds with 0 to 1000 (internal value).

0BA4:

A: Gain

Range of values: 0.00 to 10.00

 

0BA0-0BA3:
The following parameters apply:

G : Gain in [%]
Range of values: 0% to 1000%

O : Offset
Range of values: -999 to 999

delta : Threshold

Q is set to 1 when the difference Ax-Ay exceeds the threshold.

Parameters On and Off

The on threshold On and the off threshold Off can be provided by the actual value of another already-programmed function:

  • Analog threshold trigger: Ax

  • Analog amplifier: Ax

  • Analog multiplexer: AQ

  • Analog ramp: AQ

  • Mathematic instruction: AQ

  • PI controller: AQ

  • Up/Down counter: Cnt

For the 0BA7 and later version devices, you can additionally use the actual values of the following already-programmed functions:

  • On-delay: Ta

  • Off-delay: Ta

  • On-/off-delay: Ta

  • Retentive on-delay: Ta

  • Wiping relay(pulse output): Ta

  • Edge triggered wiping relay: Ta

  • Asynchronous pulse generator: Ta

  • Stairway light switch: Ta

  • Multiple function switch: Ta

  • Stopwatch: AQ

  • Analog filter: AQ

  • Average value: AQ

  • Max/Min: AQ

  • Threshold trigger: Fre

You select the required function by the block number.

Parameter p (number of decimals)

Parameter p applies only to Ax, Ay, Delta, On and Off values displayed in a message text.

Parameter p does not apply to the comparison of on and off values. (The compare function ignores the decimal point.)

Timing diagram

Description of the function

The function reads the value of the signal at the analog input Ax.

This value is multiplied by the value of parameter A (gain). Parameter B (offset) is added to the product, hence

(Ax * gain) + offset = Actual value Ax.

(Ay * gain) + offset = Actual value Ay.

Output Q is set or reset depending on the difference of the actual values Ax – Ay and the set thresholds. See the following calculation rule.

Calculation rule

  • If threshold On ≥ threshold Off, then:
    Q = 1, if (actual value Ax - actual value Ay) > On
    Q = 0, if (actual value Ax - actual value Ay) ≤ Off.

  • If threshold On < threshold Off, then Q = 1, then:
    On ≤ (actual value Ax - actual value Ay) < Off.

0BA2, 0BA3:

The following functions/calculation rules apply:

The function adds the relevant specified offset to the analog values Ax and Ay. The sum is multiplied with the value of the gain parameter. The difference is formed from both calculated values.

Output Q is set if this difference between these values exceeds the threshold you have configured under delta.

Calculation rule:
Q = 1, if:
((Ax + offset) * gain) - ((Ay + offset)*gain) > threshold delta
Q is reset to 0 when the threshold reaches or drops below delta.

Reducing the input sensitivity of the analog comparator

You can delay the output of the analog comparator selectively by means of the "on delay" and "off delay" SFBs. By doing so, you determine that output Q is only set if the input trigger length Trg (= output of the analog comparator) exceeds the defined on delay time.

This way you can set a virtual hysteresis, which renders the input less sensitive to short changes.

Particular characteristics to be noted when configuring

For help on analog block parameters, refer to the Analog value processing section.

Overview