Retain Variable

Forum Home Forums Understanding the Software Retain Variable

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5480
    Avatarscadarapid
    Participant

    Hi,
    I use modbus protocol.
    I have noticed when the communication of device and Rapid Scada have loss, the value of devices become zero and it will show on the graphic on the web that the device is off but I need to hold the old value until the communication come back and check it again to show the true status.

    if the communication have loss, How can we hold the old value until the communication come back.

    Thank you so much.

    #5482
    MikhailMikhail
    Moderator

    Hi,

    When communication lost, you should get — in a screen. Why you get zero?

    How can we hold the old value until the communication come back.

    Try the formula: Cnl > 0 ? Cnl : Val()
    But this is a bad approach because an operator will be deceived in this situation.

    #5484
    Avatarscadarapid
    Participant

    Thank you so much.

    #6187
    AvatarSGG
    Participant

    Hello Mikhail,

    i use modbus protocol to communication over GPRS to my remote devices which include a master and a slave device.

    i want to retain values (of the slave devices) after a temporary loss of communication on the rapid scada interface. This retained values should only change after communication is established and the actual value is polled.

    you suggested the use of a formula ” Cnl > 0 ? Cnl : Val() ” in post #5482 BUT i already have formulas in most of the channels.

    How do i combine my formula with your suggested formula to resolve my issue or is there any other solution?

    #6188
    AvatarSGG
    Participant

    Hello Mikhail,

    sequel to my previous post #6187

    I was able to come up with a solution to retain the last polled value when there’s a temporary loss in communication. i created another input channel to retain the value using formula
    (Val(810) > 0 ? SetData(840, Val(810),114) : SetData(840,Val(840),103))

    Now I have a new question. how do i create a timestamp for that retained value so that an operator will be able to know how current the display values are?

    Thanks.

    #6189
    MikhailMikhail
    Moderator

    Hi,
    For the both questions:
    You could create a new formula in the Formulas table. Something like that:

    double UpdateTime(double val, int timeCnlNum)
    {
      SetVal(timeCnlNum, EncodeDate(DateTime.Now));
      return val;
    }

    and use it for example
    Stat > 0 ? UpdateTime(Cnl * 100 + 1, 1001) : Val()
    The formulas are not tested.

    #6190
    AvatarSGG
    Participant

    Hello,
    Thanks for your formula in post #6189, it gave me direction on the actual formula to use.

    Now another issue arose. when i open a table on the web, i see an error that says
    “Error updating hourly data”.This error occurs only in this table, other tables are okay.

    I searched the forum for possible solutions but nothing. The link below is a screenshot of the error page, i also clicked F12 to open the console for error log.

    https://drive.google.com/open?id=1qZPN28KPX8ExPyxQXJ_Iyi45tF-pV8Ux

    Please, how do i solve this?

    #6191
    MikhailMikhail
    Moderator

    Hello,

    For the question that is not related to the current topic, please create a new topic.

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