Back

Topic

[KB496]Running SCADA Basic functions

Tags: Scada Basic, Scripting

14 years ago
By RM
Options
Print
Applies to:

PcVue all versions


Summary:

This article describes the sequence in which SCADA Basic functions are run when called simultaneously from different sources (via a button, action or cyclic event)


Details:

 

Situation
SCADA Basic behavior
When a SCADA Basic function is running without a DELAY instruction:

If another function of the same program requests to be run.

The function is put in a queue.

If a function of another program requests to be executed.

The function is put in a queue.

When a SCADA Basic function is running with a DELAY instruction:

The Delay instruction blocks the function that is running and transfers execution to the next function in the queue.

If a function of the same program requests to be run.

This function is not run and the request is discarded.

If a function of another program requests to be run.

The function is queued; so if it is at top of the queue it is run at once.


Edit 30/03/2022:

To replace the DELAY statement, you need to split your function into 2 functions. Here is an example, FunctionWithoutDelayInside and Function2 are replacirg FunctionWithDelayInside :

Sub FunctionWithDelayInside() 

    MyVar = 2 ; 

    DELAY(1) ; 

    Print(MyVar) ; 

End Sub 

 

Sub FunctionWithoutDelayInside() 

    MyVar = 2 ; 

    Cyclic(“ADDPROG”, 1, “PROGLOADED.SCB”, “”, “Function2”);‘Function2 will start in 1 second 

End Sub 

 

Sub Function2() 

    Cyclic(“DEL_EX”, 1, “PROGLOADED.SCB”, “”, “Function2” );‘Important to delete this Cyclic 

    Print(MyVar) ; 

End Sub 


Created on: 02 Sep 2011 Last update: 13 May 2024