January 1, 2021

#25 - SCADA Ignition using Templates

An important property of Ignition and SCADA is the use of Templates. One of the main functions of the Templates is to optimize the use of objects of the same type, avoiding repetition of the copy-paste type that yields difficult maintenance and debugging. In addition, the update of the template automatically propagates to the instances in the project.

There are several template formats and we will see some of them in this post:

Static Template : 
  • static project objects, such as buttons with or without a function.
  • no parameters are passed.

Examples: Button to go to a specific page using a Script (Home Button), Button to go to the next / previous page, etc.

Template Indirect Tag : 
  • connection between the template and the project is made through a parameter created in the template block. This parameter will dynamically point out the desired instances in the project. The configuration of the tempalte properties is done in the Custom Properties of the template.
  • Typical applications are indexed objects such as Motor 100, Motor 101, Motor 102, Sensor 1, Sensor 2, Sensor 3, etc. In these cases, the Template's Custom Property is an INT-type index. 
In the Customizers > Custom Properties of the template, configure the index (motor index INT) to dynamically connect the template :

The created parameter will appear in the Template properties > Template Parameters:

Make the graphic part of the template with Label, LED display, HOA button, etc.

Dynamically connect the properties marked above with the project:
  • Label with the name of the engine: Text > Property > Expression and concatenating the text with the parameterized index: "Motor " + {MotorTemplate.motorIndex}

        LED Display: Value > Tag > Indirect Tag:                                      [default]_SIM_Dairy_plant_/Overview/Motor {1}/Amps
        References: Ref.#1
        with Property Path: MotorTemplate.motorIndex

    HOA Button (Manual, Off, Automatic): MouserOver Text, Control Value and Indicator Value> Tag> Indirect Tag
        [default]_SIM_Dairy_plant_/Overview/Motor {1}/HOA
        References: Ref.#1
        with Property Path: MotorTemplate.motorIndex

Engine color according to status :  Fill Paint> Tag> Indirect Tag

In this example we have 8 engines. One way to automatically add these engines dynamically to the screen is to use the Template Repeater function , from Containers. After adding Template Repeater on the screen, parameterize according to the project:

Parameterize the Template by clicking on Behavior> Template Path
Template Parameters: Dataset Editor: motorIndex


Then, check that the option with Full Read/Write gateway communication allowed is selected, which will allow you to write in the tags the value selected in the HOA button.

No comments:

Post a Comment