Tag classes are a useful way to define the properties of JSup [JSup tag|tags].
Tag classes are organized in a '''hierarchical tree structure''' where a class inherits, adds and overrides the properties of its ancestors.
= Why tag classes =
Even if you have not to assign particular properties to a tag, it is a good practice to assign every [JSup tag|tag] to a tag class:
* It's a way to categorize [JSup tag|tags] and to explain their meaning / usage.
* If you later have to assign properties to a category of [JSup tag|tags] it will be a matter of seconds.
* It's a way put [JSup tag|tags] in groups that [JavaCode] can access at runtime. For example to create [JSup scheduler tasks|tasks] for the [JSup scheduler].
= Class properties =
[img:///img/JSup/tagClassDialog.png|right|margin=10|]
* '''Name''': Must be as descriptive as possible because this will be the only info displayed in [JSup Tag dialog|Tag Dialog] (to see the ''parentage'' the tree combo button must be opened). The name must be unique within the parent class.
* '''Description''': Only for later reference.
* '''Path to''': a read only property that can be copied to be used in [JavaCode] to access the tag class (getTagClass( String path ) static method.
* '''Numeric '''tags properties - These properties will affect numeric [JSup tag|tags] only:
* '''Unite of measure''': specify the default UM of the tags (see [JSup UM support]).
* '''Initial numeric value''': Enter the value the tag will assume when the [JSup application|application] starts and no [JSup Retentive tags|retentive] value is available.
* '''Change dead band''': since tag processing is driven by change events, you can limit the minimum [JSup tag|tag] value variation that will be considered a change. For changes lesser than the given dead band no elaboration will be performed (no screen update, no [JSup Code|code] calculation, no [JSup tag alarms|alarm] status update, etc).
* '''Bit field''': see [JSup tag bit fields].
* '''Value min-max''': you can limit the range the belonging [JSup tag|tags] value can assume. If a value greater than the given maximum value is written to the tag, then the tag value will be the maximum; If a value lesser than the given minimum value is written to the tag, then the tag value will be the minimum.
* '''I/O raw value min-max''': the range of the value read from and writter to remote I/O device (via [IOHook|I/O hook]). These values (with ''Value min-max'' or the defaults if none) cause a tag value scaling on read/writes. If raw min-max are not specified or are the same of tag value min-max (or type default if none), then the tag is not scaled on read/write.
* '''Out of range action''': the behavior when out of raw range values are read, if not specified the behavior for parent class will be used, otherwise:
* ''Force in range'': if the raw value is less than the raw min, the raw min is considered instead of the read value.
* ''Ignore value'': the value out of range is discarded and the [JSup tag|tag] value is not changed.
* ''Read error'': the value out of range is discarded and the [JSup tag|tag] value is not changed and the [JSup Channels|channel] read is considered not successful (''End read tag'', if any, is set to false).
* '''Trend''' options:
* '''Trend scale''': A default scale (min max) when a [JSup tag|tag] is added to a [JSup Trend|trend].
* '''Trend color''': A default color used when a [JSup tag|tag] of this class is added to a [JSup Trend|trend]. If the given color is already used in the trend than a different one will be automatically chosen.
* Data '''logging''' options:
* '''Data log dead band''': as the ''Change dead band'', but to limit the data logging. Only changes lesser than the ''Data log dead band'' will not be considered to write a new record for the tag.
* '''Max data log rate''': a different way to limit the frequency tag values will be written. If you enter a value (in milliseconds) than no more than a record every given ms will be written for a tag belonging to the class.
* '''Type of data log''': When you limit the log rate (with the previous parameter), you can chose what kind of summary will be written for the tag:
* Max: only the maximum value from the previous record will be written.
* Min: only the minimum value from the previous record will be written.
* Mean: the mean value from the previous record will be written.
* All: Min/Mean/Max value from the previous record will be all written.
* '''String''' tags properties:
* '''Initial numeric value''': Enter the value the tag will assume when the [JSup application|application] starts and no [JSup Retentive tags|retentive] value is available.
* Max (or fix) '''length''': the meaning depends of the [JSup Tag type|type] of the [JSup tag|tags]:
* ''String'': it will be the maximum length of such tags.
* ''FLString'': it will be the fixed length of such tags.
* Default '''property values''': enter the values (even localized) for the default properties for [JSup tag|tags] belonging to this class (see [JSup Using tag properties|Using tag properties]).
[img:///img/JSup/tagCustomProperties.png|right|margin=10|]
= Custom tag properties =
Many tag class properties can be specified directly by a tag using its own properties in the [JSup Tag dialog|Tag Dialog].
Use the '''buttons''' of the ''Custumize tag class settings'' to define custom tag class properties for the tag.
The fact that a [JSup Tag classes|Tag Class] property is customized within the tag properties is shown by the corresponding button (see the ''Initial value'' button on the right).