Comparing the previous value of channel with the current value of same channel

Forum Home Forums Understanding the Software Using Formulas Comparing the previous value of channel with the current value of same channel

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2976
    Avatarmitesh
    Participant

    Hi,

    I want compare previous value of channel-1 with the current value of channel-1.. and after comparison i want to store the highest value.

    (pre_data_cha1 > cur_data_cha1) ? pre_data_cha1 : cur_data_cha1

    #2977
    MikhailMikhail
    Moderator

    Hi,

    Val() > Cnl ? Val() : Cnl

    • This reply was modified 2 years, 6 months ago by MikhailMikhail.
    #2984
    Avatarmitesh
    Participant

    Thank you Mikhail 🙂

    #3000
    Avatarmitesh
    Participant

    Hello Mikhail,

    I want compare previous value of channel-1 with the current value of channel-1.. and after comparison i want to store the highest value.

    (pre_data_cha1 > cur_data_cha1) ? pre_data_cha1 : cur_data_cha1. I got answer for this by your reply Val() > Cnl ? Val() : Cnl.

    now i want to save that highest value in excel sheet with time. how to show time in excel sheet.

    #3002
    MikhailMikhail
    Moderator

    Hi,

    If you need to save a time when value is maximum, you need additional channel and more complex formula. Something like that:

      double GetMax(int timeCnl)
      {
        if (Val() > Cnl)
        { return Val(); }
        else 
        { 
          SetVal(timeCnl, EncodeDate(DateTime.Now));
          return Cnl; 
        }
      }
    

    You should read about Elastic Report: http://doc.rapidscada.net/content/en/modules/plg-elastic-report.html
    The demo is here http://demo.rapidscada.net/plugins/ElasticReport/ElasticRep.aspx?reportID=101

    In case of questions about Elastic Report, create a new topic.

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