Press "Enter" to skip to content

Script – Introduction (Events, Tags, SCADA, etc…)

Scripts are used in the LAquis SCADA to create specific process or applications accessing objects, tags, databases and reporting. The used language is specific to LAquis SCADA.

Main Events:

The scripts are executed inside the events. For example, OnClick (when a object is clicked), OnAfterUpdate (when the tags are uptaded), etc…

When an aplication is executed, then this are the main events that are executed, in this order:

OnStart: When the application is started.

OnGroup: When each group of tags is updated.

OnAfterUpdate: When all tags are updated.

OnFinish: When the application is finished.

Inside that loop, the event OnClick is executed when each object on the screen is clicked.

 

Tags in script:

 

There is several ways to access the tag. Simple way: to read or write a tag, type the tag name inside the script. If the color of the variable turns green, so this means that the tag exists.

Write a value to a tag. Example:

Tag1 = 32

The value 32 is set to the Tag1.

Read a tag value. Examples:

x = Tag1

Tag1 value is transfered to x variable.

 

The advanced way is tag(“tagname”) if it is a number, tag$(“tagname”) if it is a string text.

 

Example of a script inside OnClick:

 

1 – Select an object.

2 – Click on the Script tab.

3 – Select the event OnClick if it is not selected.

4 – Type the script.

5 – Press button Apply.

In the above example, when the button is clicked in runtime, then the tags Tag1, Tag2 and Tag3 are set with that values 32, 1 and 7.

 

Tags in script with group of tags:

Options:

1 – Type the tag with the name of the group with dot or underline, examples:

Group1.Tag1 = 32

Group1_Tag1 = 32

2 – Just type the tag name if the object is associated to a group or if you are using the OnGroup event:

Tag1 = 32

 

Example of script inside OnClick with group of tags:

1 – Select an object.

2 – Associate this object to any tag of a group.

3 – Click on the Script tab.

4 – Select the event OnClick if it is not selected, and type the script.

 

 

Example of the OnGroup event:

This event is executed when after each group of tags is updated. Just type the script with the tag names without the group, and this script is executed to each group.

 

In the above example, to each group, if the tag3 is greater than tag1 then tag2 is set to 1, if not, tag2 is set to 0.

The event is executed to each group there.