Reference
Tag grammar rules
The exact rules of a grammar profile, its fields, pattern modes, named parts, suffix roles, function codes, limits and the order profiles are tried in.
A
A worked example
Section titled “A worked example”The built-in profile ISA-5.1 reads the demo tag 41-TI-1008.PV like this:
| Part | Value | Pattern in ISA-5.1 |
|---|---|---|
| Area | 41 |
[0-9]{1,4} |
| Function | TI |
[A-Z]{1,5} |
| Loop | 1008 |
[0-9]{1,6}[A-Z]? |
| Suffix | .PV |
(?:[./][A-Za-z][A-Za-z0-9_]{0,15}){1,3} |
From that, Beltr fills in the tag’s Function code TI, its Area 41 and its Loop 41-TI-1008. The suffix PV has the role pv, the measured value of the loop. The function code TI starts with T, which the profile maps to temperature, so the quantity from the name is temperature.
The fields of a profile
Section titled “The fields of a profile”A profile is a JSON object of at most 16 KiB. Copy profile JSON and Paste profile JSON… in Catalog › Grammar use this format.
| Field | What it holds | Rules |
|---|---|---|
profile_id |
The profile’s ID (Profile ID) | Lower-case letters, digits, ., _ and -, starting with a letter or a digit; at most 64 characters |
name |
Profile name | 1 to 100 characters |
mode |
Pattern mode: parts (Named parts) or expression (Expression) |
Required |
parts |
One pattern per part: plant, system, area, function, loop, suffix |
Used in parts mode; each pattern 1 to 500 characters |
expression |
One pattern for the whole name | Used in expression mode; 1 to 500 characters |
suffix_roles |
Suffix → role, such as "PV": "pv" |
See Suffix roles |
function_codes |
Function code → quantities, such as "TT": ["temperature"] |
See Function codes |
Any other field is refused.
Patterns
Section titled “Patterns”Patterns are regular expressions without look-around and without back-references. A pattern always has to match the whole name.
Named parts. Each part has its own pattern. Beltr joins them in this order: Plant, System and Area, each optional and each followed by an optional separator (-, _, . or a space), then Function, then Loop, then an optional Suffix. A profile needs a Function or a Loop part. A part’s pattern may not contain ^, $, \A, \z or a named group; Beltr adds those itself.
Expression. One pattern for the whole name, with named groups for the parts: (?P<area>…), (?P<function>…) and so on. The names are plant, system, area, function, loop and suffix, and function or loop must be one of them. A pattern that could match an empty name is refused.
Names longer than 512 characters are never read.
Suffix roles
Section titled “Suffix roles”A suffix role says which tag of a loop is which: pv the measured value, sp the setpoint, op the output and mode the mode. Write them as Suffix roles (suffix=role, one per line), such as PV=pv.
- The leading
.,/,-or_of a suffix is ignored, and so is case:.pvandPVmatchPV. - A suffix matches when it is the whole suffix, or its last segment after
.or/. - When several suffixes match, the longest wins.
- A profile has at most 32 suffix roles, each suffix at most 32 characters, and a suffix in the list may not start with
.,/,-or_.
Tags whose names are the same up to the suffix, with suffixes of different roles, form one loop.
Function codes
Section titled “Function codes”Function codes map the start of a function code to the quantities it suggests, written as Function codes (CODE=quantity,quantity, one per line), such as TT=temperature.
- “The longest code that starts the function wins. CODE= with nothing after it means no guess.”
- A profile has at most 128 codes. A code is 1 to 8 upper-case letters or digits and names up to 4 quantities.
- The quantities are
conductivity,current,density,energy,flow_mass,flow_volume,length,mass,power,pressure,ratio,rotation,speed,temperature,timeandvoltage.
Order and fallbacks
Section titled “Order and fallbacks”One profile is active. Up to three fallbacks follow it in order. Each name is read by the active profile first, then by each fallback in turn; the first profile that reads the name wins.
- If the active profile cannot be used, Beltr reads names with ISA-5.1. A fallback that cannot be used is skipped.
- No grammar reads no name. It takes no fallbacks and cannot be a fallback.
- A workspace keeps up to 20 profiles of its own besides the built-in ones.
The preview
Section titled “The preview”The preview runs the profile over up to 200 of your tags. A pattern that takes longer than 100 milliseconds on them is stopped: “This pattern took too long on the sample and was stopped. Simplify it.”
What a reparse changes
Section titled “What a reparse changes”A reparse reads the names again with the current profiles and writes the tag’s function code, the quantity from the name, the area and the loop. When a name gives an area code the workspace does not have yet, Beltr adds an area named “Area” and the code, such as Area 41.
The built-in profiles
Section titled “The built-in profiles”| ID | Name | What it reads |
|---|---|---|
isa-5.1 |
ISA-5.1 | Names such as 41-MT-1001.PV: area of 1 to 4 digits, function of 1 to 5 letters, loop of 1 to 6 digits with an optional letter, optional suffix. Active in a new workspace. |
kks |
KKS | Power-plant identifiers: optional plant number, system code, two-letter function, three-digit loop with an optional letter, optional suffix. Never active until you choose it. |
none |
No grammar | No name. For a site whose names follow no rule. |
The suffix roles of ISA-5.1 and KKS are the same: PV and PV.CV are pv; SP, SV and SP.CV are sp; OP, OUT, MV and OUT.CV are op; MODE and MODE.ACTUAL are mode. The built-in profiles are read-only; use Duplicate to edit to start your own from one.