• Not Answered

VBA code used in DeltaV Operate Scheduler not working as expected.

Hi,

I create an Event Based Entry in DeltaV Scheduler to perform de the following action:

  • Based on a threshold for a process condition, DVSYS.STATION/ALERT_TCA_GLOBAL.F_CV = 1, which is being evaluated While True, with a time interval of 10 minutes.
  • the Event Based Entry has to open an specific DeltaV Operate picture as a Popup, which is used as Process Abnormal Condition Alert, which provides instructions to the Plant Operator.

In order to display the Picture a VBA script is used in the Event Based Entry:

  • frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

This VBA Script woks fine however, some Plant Operators drag and drop the the Popup Picture to the bottom of the Screen in order to hide it, even though the picture has a closed icon available on it, and the Process Abnormal Condition is present (it is not a false alarm).

So when the Process Abnormal Condition is no longer present they forget to close the Popup Picture because was hidden at the bottom of the screen, the when the Abnormal Condition is present again the Operators claim that the Popup Picture was not display by DeltaV Operate, and the reason is that the Popup Picture is still  opened and hidden at the bottom of the screen so that the VBA Script it is not programmed to tackle with this issue.

Therefore I want to improve the VBA Script so that when the Event Based Entry is activated again:

  • Check (verify) if the Popup is already opened (hidden at the bottom of the screen) and if that is the case closed it first, and then reopen it again.
  • If the Popup is not already opened just open it

In order to achive this I came up with the following VBA Script, however it does not work as expected:

Private Sub ALERT_TCA_GLOBAL_WhileTrue()
On Error GoTo ErrHandler

LINE 1:     If frsIsPicOpen("D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf") Then

LINE 2A:     frsExpertClosePic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf"

LINE 2B:     frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

LINE 3:     ElseIf frsIsPicOpen("D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf") = False Then

LINE 4:     frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

LINE 5:     End If

LINE 6:     frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

Exit Sub
ErrHandler:
       frsHandleError
End Sub

The previous VBA Script works as intended for the case in which the Popup was already opened and then close it (see script LINE 1, and LINE 2A), but fails to reopen the Popup Picture again (see script LINE 2B and LINE 6). It seems that LINE 2B is not executed, and LINE 6 is also not executed after the IF sentence ends.

The previous VBA Script works as intended for the case  in which the Popup was not opened previously and then opens it as required (see script LINE 3, and LINE 4).

I also tried using a SELECT CASE script instead of IF sentence:

LINE 1:     Select Case frsIsPicOpen("D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf")

LINE 2:     Case False

    frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

LINE 3:     Case True

    LINE 3A:     frsExpertClosePic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf"

    LINE 3B:     frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

LINE 4:     Case Else

    frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

End Select

LINE 5:     frsOpenPic "D:\DeltaV\DVData\Graphics-iFIX\Pic\SI_ALERT_ABN_CND.grf", "", 250, 500, ""

This VBA Script works as intended for the case in which the Popup was already opened and then close it (see script LINE 3, and LINE 3A), but fails to reopen the Popup Picture again (see script LINE 3B and LINE 5). It seems that LINE 3B is not executed, and LINE 5 is also not executed after the SELECT ends.

The VBA Script works as intended for the case  in which the Popup was not opened previously and then opens it as required (see script LINE 2).

I will appreciate any suggestions to solve this issue. Thanks in Advanced.

Regards,

Marcos Moreno