• Not Answered

Analog values compared in CND Block.

Dear Engineers,

I'm fighting with a simple expression, I want to compare 2 Variables, whenn they are different OUT_D have to be 1, with 5 sec Duration time.

I've tried with  Variable1 != Variable2 (Ptintscreen) or with Variable1 <> Variable2 after download if the Value are equal the CND Block OUT_D =1....

Where is the error?

Have a nice week end

4 Replies

  • Most likely your problem is that Control Studio is rounding/truncating and the numbers are not exactly the same (i.e one is 1500.001 and the other is 1499.9998). You should considering adding a deadband when comparing two numbers to say they are "the same".

    Example Expression: ABS('^/GW_H.CV' - '^/GW_H_RM.CV') <= DEADBAND_VAL

    Where DEADBAND_VAL is a number or a parameter to allow online changes.
  • In reply to Matt Stoner:

    Thank you for the fast answer.
    I'am testing my SW on a Proplus with Simulate.
    All the values are simulated...
    I will apply your tip.
  • In reply to LostEngineer0:

    no problem, it needs to be >= if you want a true if they are "not equal"...typing faster than brain :)
    my suggestion will be true if they are "equal"
  • In reply to Matt Stoner:

    Have you considered the Comparator block? This gives you Not Equal to condition as well as Greater/Less than and such. But comparing two float values to be Not Equal (or equal) would be fruitless due to resolution.

    Consider using Absolute value with a comparison to a deadband:

    ABS(Variable1 - Variable2) > Deadband,
    where deadband can be adjusted.

    Andre Dicaire