Formulas check '-'

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

This topic contains 5 replies, has 3 voices, and was last updated by Mikhail Mikhail 4 months, 1 week ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5659
    Avatar
    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
    Avatar
    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
    Avatar
    manjey73
    Participant

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

    #5669
    Mikhail
    Mikhail
    Moderator

    Hi,

    if (CnlStat > 0) …

    #5673
    Avatar
    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
    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

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.