A sample template is provided to create analog or digital alarm tags and trend tags. The template shown below specifies the rules for generating Citect SCADA Alarm and Trend tags from a Unity SpeedLink device/database, for the import and/or synchronization of variable tags.
Note: You will need to modify this template to suit your particular requirements. Refer to TagGen XML Template for more information.
For each Unity Database variable tag with the text "VJA" in the custom field imported in to Citect SCADA of type "DIGITAL", this file will generate a linked Digital Alarm Tag within Citect SCADA (digalm.dbf) with the name <variablename>_ALARM.
For each Unity Database variable tag with the text "VJA" in the custom field imported in to Citect SCADA not of type "DIGITAL" and not of type "STRING", this file will generate a linked Analogue Alarm Tag within Citect SCADA (anaalm.dbf) with the name <variablename>_ALARM.
For each Unity Database variable tag with the text "VJT" in the custom field imported in to Citect SCADA, this file will generate a linked Trend Tag within Citect SCADA (trend.dbf
) with the name <variablename>_TREND. This example file does not enter values for any of the other Trend tag properties.
<?xml version="1.0"?>
<template desc="Default SpeedLink Unity Pro TagGen template">
<param name="parameter">
<string name="IODevice" desc="SpeedLink necessary parameter, it will be set to the given I/O Device name by the system."></string>
</param>
<input name="variable" file="variable.dbf" desc="Load variable tags for the specified I/ O Device">
<field name="name"></field>
<field name="type"></field>
<field name="unit" load="true">{parameter.IODevice}</field>
<field name="custom"></field>
<array name="taginfo">{ToProperty('{custom}', '=', ';')}</array>
<string name="alarminfo">{variable.taginfo[VJA]}</string>
<string name="trendinfo">{variable.taginfo[VJT]}</string>
</input>
<output name="digalm" file="digalm.dbf" filter="'{variable.alarminfo}=VJA' AND '{variable.type}=DIGITAL'" desc="Generate digital alarm tags from input digital variable tags">
<field name="tag">{variable.name}_ALARM</field>
<field name="name">{variable.name}_ALARM</field>
<field name="var_a" key="true">{variable.name}</field>
<field name="taggenlink" load="true">{parameter.IODevice}</field>
</output>
<output name="anaalm" file="anaalm.dbf" filter="'{variable.alarminfo}=VJA' AND '{variable.type}=NOT DIGITAL' AND '{variable.type}=NOT STRING'" desc="Generate analog alarms from input analog variable tags">
<field name="tag">{variable.name}_ALARM</field>
<field name="name">{variable.name}_ALARM</field>
<field name="var" key="true">{variable.name}</field>
<field name="taggenlink" load="true">{parameter.IODevice}</field>
</output>
<output name="trend" file="trend.dbf" filter="'{variable.trendinfo}=VJT'" desc="Generate trend tags from input variable tags">
<field name="name">{variable.name}_TREND</field>
<field name="expr" key="true">{variable.name}</field>
<field name="taggenlink" load="true">{parameter.IODevice}</field>
</output>
</template>
Simple Wildcard Example
The following example shows how an empty string variable called "wildcard" can be used as a wildcard pattern to load a set of data from a variable database. The string variable is substituted for a "* " wildcard character when the xml file is processed. The example below loads data where the names of variable tags contain the word "Tank".
<input name="variable" file="variable.dbf">
<string name="wildcard"></string>
<!-- Loading set of data where string contains the word "Tank" -->
<field name="name" load="true">{wildcard}Tank{wildcard}</field>
<field name="unit"></field>
<field name="custom"></field>
</input>
Sample Analog Alarm Example
The following example specifies the rules for generating Citect SCADA Analog Alarm Tags and setting the high-high limit attribute, based on the engineering scale of the linked variable Tag.
For each Unity Database variable tag with the text "VJA" in the custom field imported in to Citect SCADA not of type "DIGITAL" and not of type "STRING", this file will generate a linked Analog Alarm Tag within Citect SCADA (anaalm.dbf) with the name <variablename>_ALARM, with the following properties:
In this example, only analog alarms for integer variables will have the limit set.
<?xml version="1.0" encoding="utf-8"?>
<template>
<param name="parameter">
<string name="IODevice"></string>
<string name="Divisor"></string>
</param>
<input name="variable" file="variable.dbf">
<field name="name"></field>
<field name="type" ></field>
<field name="unit" load="true">{parameter.IODevice}</field>
<field name="eng_zero"></string>
<field name="eng_full"></string>
<field name="custom"></field>
<!-- customstring field may contain "VJA;VJT;VJC" -->
<array name="taginfo">{ToProperty('{custom}', '=', ';')}</array>
<string name="alarminfo">{variable.taginfo[VJA]}</string>
</input>
<!-- output section -->
<output name="anaalm" file="anaalm.dbf" filter="'{variable.alarminfo}=VJA' AND '{variable.type}=INT'">
<field name="tag">{variable.name}_ALARM</field>
<field name="name">{variable.name}_ALARM</field>
<field name="var" key="true">{variable.name}</field>
<field name="taggenlink" load="true">{parameter.IODevice}</field>
<calculator name="highh" >({variable.eng_full}-{variable.eng_zero})/ {parameter.Divisor} </calculator>
<field name="highhigh">{highh}</field>
</output>
</template>
Published June 2018