Model repeated equipment as types
This page is for the engineer who has more than a few devices of one kind. The two projects built so far moved from hand-made tags to tag types (UDTs) and instances, and the rules below are what held up. The mechanics are in Tag types; a worked example is Model a motor as a tag type.
One instance per device, named like the device
- Name the instance after the PLC's block or object. In the NIRO project each motor became an instance named after its data block without the
_DBsuffix (C01_Exhaust_FanforC01_Exhaust_Fan_DB), because the types build their node ids from{InstanceName}_DB. An instance then needs no parameter for its node, and a list of instances reads like the PLC's block list. - Give the
IDparameter the default{InstanceName}. Set it on an instance only when the node does not follow the name. - Describe the instance. The description feeds
{Description}in alarm names, so a type's alarm reads "C01 Exhaust fan: Drive fault" with nothing to override. - Keep the PLC's names in tag paths where screens and scripts refer to them, so a path means the same thing in the PLC, the HMI export and the gateway. The NIRO page keeps the PLC address as the HMI tag name and, at load, finds where that tag lives now: on the instance named after the block when there is one, otherwise on the raw block. Moving devices into instances needed no rebuild of the page.
Put in a parameter what differs, write in what is shared
A parameter is for a value that differs between devices of the type. The AllWaves import compares each field's unit and format across the devices of a structure: one that is the same everywhere is written into the member, and one that differs becomes a parameter (Unit, Format, a second pair Unit2, Format2 when two groups of fields differ) with the most common value as its default.
| Put in a parameter | Write into the type |
|---|---|
The server (OPCUA) and the node (ID) | Member names, kinds and node suffixes |
| A unit or format that varies between devices | A unit or format every device shares |
A label the alarm text uses (Label, default {InstanceName}) | Alarm conditions and severities that apply to all |
A type with many parameters is a sign that two types were merged. When devices differ in the members they have, make a parent and a child type, below.
Extend a type for a variant
A variant adds to a base: MotorStartStop extends Motor in the AllWaves types, so a start/stop motor has every member of a motor and its own. A child changes an inherited member with a sparse patch (overrides), such as another node, and keeps the rest following the parent. A screen parameter of type Motor accepts an instance of the child, so one faceplate fits both.
Use a parent when the members at the same path mean the same thing. Use a nested type member when the other type's members belong under a prefix (Temp.Value). See Inheritance and Nested type members.
One structure, one type
Where the PLC holds a device as one structure, let the type read it through a root member with derived members for the fields, and let a sub-device be a nested type. See One OPC UA tag per structure.
Alarms on the type
Define an alarm once on the member of the type, with {Description} or {Label} in its name, and let every instance inherit it. Override on an instance only what differs there: alarmOverrides changes single fields of single alarms and the rest still follows the type, while an alarms key replaces the whole list for that instance.
The NIRO motors show both sides. The first import copied each motor's ten bit alarms onto its instance as overrides, which made the alarms live but kept each motor's list on the motor. A later step put the alarm texts onto the types and left on each instance only what it changes. Start with the type.
What stays a plain tag
Not everything needs a type. In AllWaves, the 119 tags that no device owns stayed single OPC UA tags with their 13 alarms. A type pays off when several devices share a layout, or when one device's fields are read through one structure.
A tag that belongs with an instance but is not in its type (a speed button on one motor, an extra status) is an added tag: it belongs to the instance, moves, copies and is deleted with it, and survives an edit of the type. See Tags added to an instance.
Where things live
- A provider per project. AllWaves lives in the provider
aw: its tags are[aw]scale.devices.measures.AM300i, its types are in[aw]Devices. Two projects on one gateway keep their own paths. See Tag providers. - Types in a folder of their own (
Devicesabove), so the type list reads as a catalog. - Edit the type, not the member tag. A member's configuration is resolved from the type, so an edit to the type reaches every instance and an edit on one member tag is an override of that one instance, marked with a dot in the dashboard. Reset overrides you did not mean to keep.
Check what you made
After a change to a type, open one instance of each type and check the member tags: the values, the quality, and the alarms marked inherited. A tag whose placeholder shows as {Name} in a binding was not resolved: the parameter has no value and no default, or the name is misspelled. The gateway leaves an unanswered placeholder as typed so that the mistake is visible.