Formulas check '-'

Forum Home Forums Understanding the Software Using Formulas Formulas check '-'

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5659
    scadarapid
    Participant

    Hi.
    Can I use formula to check “-” value when the communication has lost.
    I use modbusRTU and I have a sensor which is discrete input register.
    When the communication has lost, I have noticed that my sensor value became “-” so, i need to check if my sensor has lost communication my output should be equal 150.

    public double check(double sensor)
    {
    double output = sensor;
    if( sensor == null ){
    return output = 150;
    }
    return output;
    }

    Thank you so much.

    #5661
    scadarapid
    Participant

    I use this formula but it does not work. when the communication has lost the output value become zero. but i need it to become 150.

    Thank you so much.

    #5662
    manjey73
    Participant

    Look for formulas to check the signal status on the forum or try to change the formula to double.NaN

    #5669
    Mikhail
    Moderator

    Hi,

    if (CnlStat > 0) …

    #5673
    scadarapid
    Participant

    I use this formula to hold the old value and it works.

    Stat(2001) > 0 ? inputtest(Val(2001), Val(4003), Val(4002)) : Cnl

    Thank you so much

    #5677
    Mikhail
    Moderator

    Take into account that
    CnlStat – the status that was just received from Communicator
    Stat(N) – the current status of an input channel before receiving new status

    #6969
    kumajaya
    Participant

    Can we just have an option to hold last valid value?

    #6971
    Mikhail
    Moderator

    Can we just have an option to hold last valid value?

    Formula would be like
    CnlStat > 0 ? Cnl : Val(); CnlStat > 0 ? CnlStat : Stat()

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.