Formulas check '-'

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

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5659
    Avatarscadarapid
    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
    Avatarscadarapid
    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
    Avatarmanjey73
    Participant

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

    #5669
    MikhailMikhail
    Moderator

    Hi,

    if (CnlStat > 0) …

    #5673
    Avatarscadarapid
    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
    MikhailMikhail
    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
    Avatarkumajaya
    Participant

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

    #6971
    MikhailMikhail
    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.