Calling a Method

When you have defined the method declaration, you can reference the methods in your program. Referencing is also referred to as 'calling'.

To reference a method, use the following format within the ST program:

<Method name in program> (<method value>);

Where <Method name in program> is the name of the method that you defined in the METHOD declaration. This is not the name of the method as it appears in the ClearSCADA database schema—it is the name you allocated to the method.

<method value> is the value that you want the method to invoke. If there are multiple values, you need to separate each value with a comma, and if there are no values then you need to enter ().

 

To set a point to have a value of 35.6 use the Override method as follows:

Override (35.6);

To active the alarms feature use the EnableAlarms method:

EnableAlarms();

As it has no values (it activates the alarm feature for an item), the () is entered.

The following illustrates how to use the PromoteOS method:

PromoteOS (900, 3600, TRUE);

This means that the PromoteOS method has 3 arguments—900 is the interval, 3600 is the duration, and TRUE sets the outstation to perform a One Shot immediately.

In the METHOD declaration for the PromoteOS method, the PromoteOS value definition has to include value types for each of the values:

METHOD

PromoteDialOut AT %M(PSTNOS.PSTN.PromoteDialOut):DINT,DINT,BOOL;

END_METHOD

The DINT, DINT, and BOOL definition set the 3 arguments (the interval and duration are DINTs and the immediate One Shot argument is a Boolean).

The path for the PSTNOS database item includes the PSTN aggregate aswell as the PromoteDialOut method. For methods that are associated with arguments rather than the database item, you need to define the method in this format:

<Method name in program> AT %M(<Name of database item>.<Name of aggregate>.<Name of method in ClearSCADA Database>):<value type>,<value type>, <value type>;

You only need to add <value type> for each argument for the method.


Disclaimer

ClearSCADA 2017 R3