How to reset Channel Value on re-boot?

Forum Home Forums Understanding the Software How to reset Channel Value on re-boot?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #17287
    CCKOH
    Participant

    Hi Manjey / Mikhail,

    I need to reset the channel value to 0 every time the SCADA server is rebooted. I have configured the channel as follows:

    Channel Type: Calculated/output
    Object: Enterprise
    Device: Simulator
    Formula
    In: Stat() > 0 ? Data() : NewData(0, 1)
    Out: SetVal(CnlNum, Cmd)

    However, the channel value does not reset to 0 when I reboot the computer or restart the SCADA server. Instead, it retains the value I entered through the command window. Do you have any suggestions on how to ensure that the channel value is reset to 0 upon rebooting the computer or restarting the SCADA server?

    #17289
    Mikhail
    Moderator

    Hi,
    Try the following:
    In the Scripts table, insert
    SetData(101, 0, 1);
    into InitScripts() which is a record #1.
    Let me know it it works or not. I haven’t tested it.

    #17290
    Mikhail
    Moderator

    101 is a channel to reset.

    #17293
    CCKOH
    Participant

    Hi Mikhail,

    Thank you for your prompt reply.
    Unfortunately, the method is not working.
    I also tried using SetVal(109, 0), but that is not working either.
    Additionally, I moved the code to FinalizeScripts(), but that is still not working.

    #17294
    manjey73
    Participant

    Doesn’t the absence of an input formula lead to this result?

    #17295
    CCKOH
    Participant

    Hi Manjey,

    I’m need to use the input formula to get the sensor reading for my calculation.
    When the system is shutdown, the calculation results need to be reset.

    Regards,
    CC Koh

    #17296
    Mikhail
    Moderator

    Hi,
    Try another solution.
    In the Scripts table, declare a variable:
    public double MyVal = double.NaN;

    In the input formula of the channel use:
    MyVal

    Variables are not stored in archives.

    #17297
    Mikhail
    Moderator

    So set the channel, the output formula would be SetTempData()

    public double SetTempData()
    {
      MyVal = CmdVal;
      return CmdVal;
    }
    #17301
    CCKOH
    Participant

    Hi Mikhail,

    Thank you very much for your help, this method is working perfectly.

    #17304
    Mikhail
    Moderator

    🙂

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