Required Variables and Constants

The following variable, constant and submodule declarations must be part of every tag template:

    { Variables }
[
  Root                { Set to individual instance of this module };
  Value (5)           { Scaled value for this point.              };

   { The next block of constants defines the offset into the parameter list,
     starting from 0, for each of the parameters }
  Constant #Name        = 0;
  Constant #Area        = 1;
  Constant #Description = 2;
  Constant #HelpKey     = 3;
  Constant #Property1   = 4;
  Constant #Property2   = 5;
  { etc. for all parameters }

  Refresh Module      { Subroutine which will be called by the
                        tag parameter configuration tools to
                        notify this tag when on-line changes to the
                        parameters are made.                        }
  Constant NumTagFiles = 16;
]

Root

A variable named "Root" must be defined and must contain the instance of this module as its value. Root will be used to identify the individual instances of the module. This is required to allow the parameter editing tools to access the parameters of the tag.

Value

All type templates have a variable named Value, even if that type does not have a publicly accessible value. Value must be declared with a class type indicating the data type. (See: Variable Class Definitions.) The possible classes for Value are:

  • Class 0 - Disabled Declaring Value without a class type and leaving the stored value as Invalid will achieve the same result.
  • Class 1 - Bit
  • Class 2 - Unsigned byte
  • Class 3 - 16-bit integer
  • Class 4 - 32-bit integer
  • Class 5 - Double precision floating point
  • Class 6 - Text

The actual value to be stored within this variable must be set in a script, not in steady-state.

If the tag template provides the option of a manual value or an external value, then care must be taken to use that value whenever it is set. This is the role of The Refresh Module.

Parameter Constants

A numbered constant must be assigned for each of the declared parameters. These will be in the same order that the parameters were declared.

Refresh Submodule

Tags typically have several submodules, but only the Refresh submodule is mandatory. The Refresh subroutine will be launched by the tag's initialization state and will be called every time that the tag's data changes.

NumTagFiles

Recommended but not strictly mandatory as a default value of 64 will be assigned if this constant is missing. The value of NumTagFiles determines the number of tag files that are used to store all of the instances of this particular type. For example, the tag instances for the Analog Status tag type are randomly distributed between 256 files.

There is a trade-off between application start-up performance (faster with fewer tag files) and online tag editing performance (faster with fewer tags per file, hence faster with more tag files). In general, you will get good online-editing performance with up to 1000 tags/file. Therefore, since NumTagFiles in the Analog Status tag is set at 256 files, an application should have good online editing performance with up to 256,000 of these tags.

After the first instance of a tag has been created, any and all changes to NumTagFiles in the template will be ignored.