“IF” Formula in channels

Forum Home Forums Understanding the Software Using Formulas “IF” Formula in channels

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #16754
    rapidscadaaks
    Participant

    Hi

    Is it possible to use “if” formula in channels? If so, please assist in syntax.

    Thanks

    #16758
    Mikhail
    Moderator

    Hi,
    For example
    Cnl > 100 ? 1 : 0

    #16765
    rapidscadaaks
    Participant

    Thanks for the tip. Please advise how to use data of 2 channels for returning 1 or 0

    Many thanks in advance

    #16773
    Mikhail
    Moderator

    > how to use data of 2 channels for returning 1 or 0
    Could you provide an example as text?

    #16956
    rapidscadaaks
    Participant

    Hi
    I wanted guidance for the following example :
    Channel AA is having value of 0 or 1
    Channel BB is having a value between 0 and 4
    I would like Channel CC to return 1 if Channel AA is 1 and Channel BB is <=2 or >=3.5 else 0

    Thanks in advance

    #16957
    rapidscadaaks
    Participant

    I created a Calculated Channel and observed that (||) works but (&&) does not work. Please guide

    Thanks

    #16959
    Mikhail
    Moderator

    Hi,
    Both || and && work for boolean expressions.
    For more info, check the error in ScadaServer.log.

    #16964
    rapidscadaaks
    Participant

    Please guide for the following example:
    Channel AA is having value of 0 or 1 coming from a script which mentions “double”
    Channel BB is having a value between 0 and 4
    I would like Channel CC to return 1 if Channel AA is 1 and Channel BB is <=2 or >=3.5 else 0

    Thanks in advance

    #16984
    Mikhail
    Moderator

    Hi,

    Channel CC formula could be
    Cnl(101) == 1 && (Cnl(102) <= 2 || Cnl(102) >= 3.5) ? 1 : 0
    101 is AA.
    102 is BB.
    Not tested.

    #16988
    rapidscadaaks
    Participant

    Thanks Mikhail for your revert which is extremely helpful.
    Just one question : what is the difference between using Cnl(101) and Val(101) ?

    #16998
    Mikhail
    Moderator

    Cnl(101) is a mistake, use Val(101).

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