Internal variable set to zero on Switchover or power failure

HI All,

In one of my projects, we found that the internal variable defined inside an Action or calculation block are set to zero in case of switchover or power failure.

Is there any way to avoid this ?

Thanks for your suggestions...

Senthilkrishnan 

  • No. Interval variables declared in CALC expressions are not passed to the Standby controller and will initialize to 0.0 unless you initialize them.

    The SYSTAT function in DeltaV allows you to determine if the CALC or ACT block is executing for the first time following a download or switchover:

    'OUT1' := sysstat('$sysstat_opts:Switchover')

    You can use this in an If Statement to do a one time initialization of the internal variables.

    In order to initialize them you also have to store the values in Module parameters. The Module parameters will be updated to the standby controller.

    Any internal variables that are use to preserve a value for use on the next execution of the module need to be written to a module parameter and initialized. You can choose to initialize the variable every scan of the expression and in that case you do not need to use the SYSSTAT function. If you only wish to initialize on a restart after switchover, you can do that.

    Unless the internal value is initializing to a constant, I would lean to having the expression initialize every scan. Even though the internal value will still be holding the correct value, and does not need to be initialized, your logic will be identical to that of your initial logic after switchover.

    If you initialize every scan, it is possible that the module parameter could be modified online by a user write or other module logic, which would overwrite the last value stored and cause the internal value to be manually initialized to a different value. This may be desirable or completely unacceptable. To prevent any tampering with the initialized value, use the Sysstat methond. That way your expression will always overwrite any "tampering" on each scan of the module and the parameter is only used following a switchover or a partial download for that matter.

    Andre Dicaire

  • In reply to Andre Dicaire:

    Thanks Andre for the detailed information...

    There are some internal variables like count and other which needs to have the value on last scan, so I will initialize them on switchover or power failure ...

    Just one query on this... Will the the same sysstat('$sysstat_opts:Switchover') expression can be used in case of power failure ?
  • In reply to Senthilkrishnan M:

    In case of power failure to both controllers of a redundant pair, it will show up as a download as it downloads the configuration from cold restart memory after powering back up if configured. If only a single controller loses power in a redundant pair, then it will perform a switchover to the one that has power. In either case, there's not anything different you can do specifically on power failure.