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

This topic contains 4 replies, has 2 voices, and was last updated by Mikhail Mikhail 1 year, 2 months ago.

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

    mitesh
    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
    Mikhail
    Mikhail
    Moderator

    Hi,

    Val() > Cnl ? Val() : Cnl

    • This reply was modified 1 year, 2 months ago by Mikhail Mikhail.
    #2984

    mitesh
    Participant

    Thank you Mikhail 🙂

    #3000

    mitesh
    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
    Mikhail
    Mikhail
    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.