ConfigureTag - Apply new configuration to a tag

Help Contents

Introduction

The ConfigureTag function block applies new configuration to a Database Tag.

Parameters

Parameter Type Direction Description
REQ BOOL R_EDGE Input A rising edge triggers the configuration change.
TAGNAME WSTRING Input The full name of the database tag to configure.
CONFIG STRING Input The new configuration to apply to the database tag.
BUSY BOOL Output Set to TRUE while the configuration change is in progress.
REQID UDINT Output A unique identifier associated with the configuration change.
DONE BOOL Output Set to TRUE for 1 execution after the configuration change has completed.
ERROR BOOL Output Set to TRUE if there was an error executing the configuration change.
ERRORMSG WSTRING Output If ERROR is TRUE, the reason why the configuration change failed.

CONFIG Parameter

The CONFIG input parameter is the configuration change to apply to the tag. This is a STRING value that can set 1 or more configuration properties in one operation. The syntax of the CONFIG input parameter is:

config-parameter ::= { property-and-value }

property-and-value ::= property ':=' value

property ::= <The name of the configuration property>

value ::=IEC 61131-3 Literal

The following example shows an appropriate value to configure the URL property of a URL Scanner Tag:

URL:='https://www.example.com/web-server-request'

Remarks

Once the configuration change begins, additional requests from the input signal REQ are ignored until the configuration change completes.

These timing diagrams show the relationship of the REQ, BUSY, DONE, and ERROR signals processing two requests. The first request completes with an error, the second request completes normally:

        +--------+     +-+ +------+
  REQ   |        |     | | |      |
      --+        +-----+ +-+      +------

        +------+       +------+
 BUSY   |      |       |      |
      --+      +-------+      +----------

               ++             ++
 DONE          ||             ||
      ---------++-------------++---------

               +-------+
ERROR          |       |
      ---------+       +-----------------

The BUSY signal is TRUE while the configuration change is in progress. The DONE signal is TRUE for 1 execution after the completion of the configuration change.

Examples

  1. Configure the URL property of a URL Scanner Tag before starting a refresh of the tag:
    Program Main
        Var
            (* Timer to trigger the action every 5 minutes *)
            ScanTimer : TON;
            
            (* A function block to configure the URL Scanner Tag *)
            ConfigureURLScanner : ConfigureTag;
            
            (* A function block to trigger a refresh of the URL scanner Tag *)
            RefreshURLScanner : TagRefresh;
        
            (* The latest URL *)
            URL : STRING;	
        End_Var
    
        Var_Temp
            (* Temporary variables used to calculate the URL *)
            URLTimestamp : DATE_AND_TIME;
    
            (* URL scanner tag name *)
            URLScannerTagName : WSTRING;
        End_Var
            
        (* Process the scan timer.  Interval = 5 minutes *)
        ScanTimer( IN:= NOT ScanTimer.Q, PT:=T#5m );
    
        (* Optimization: Only build the URL when we need to *)	
        IF ScanTimer.Q THEN
            
            (* Get the current time *)
            URLTimestamp := SYS_GET_TIMESTAMP();
            
            (* Construct the URL based on the current time *)
            URL := CONCAT( 
                'https://www.example.com/GetResults_',
                FORMAT_DATE_TIME( URLTimestamp, 'yyyyMMddHHmm'),
                '.json' );
        END_IF
        
        (* Use a tag reference to get the URL Scanner tag name.
           This ensures the tag name is correctly refactored when tags are renamed or moved *)
        URLScannerTagName := %".URL Scanner.FullName";
        
        (* Function block to configure the URL property of the URL Scanner Tag
           Triggered when the ScanTimer completes *)
        ConfigureURLScanner( 
            REQ:=ScanTimer.Q,
            TAGNAME:=URLScannerTagName,
            CONFIG:=CONCAT("URL:='",URL,"'"));
        
        (* Function block to refresh the URL Scanner Tag
           Triggered when the URL Scanner tag has been configured *)
        RefreshURLScanner(
            REQ:=ConfigureURLScanner.DONE,
            TAGNAME:=URLScannerTagName );
    
    End_Program
    

Further Information

Database Function Blocks

To learn about other database function blocks.

Elementary Data Types

To learn about the different types supported by Fernhill SCADA.

Core Driver

To learn about other features of the Core Driver.

ConfigureTag Function

For a function to provide the equivalent feature in an Operator Action.

Glossary

For the meaning of terms used in Fernhill SCADA.