Need help working from home with your Bentley software? We're here to help - click here
This document explains in which way the format of a tag number and pipeline annotation is defined and configured. Mostly a tag number consists of several different values which are concatenated often by using separating characters such as hyphens, dots or slashes.
In this example the Imperial workspace is used.
This area is an associated item. That means that the value for the plant area is not locally stored with the instrument. The Plant Area is a separate object that is associated to the instrument
A tag number consisting of several concatenated values is defined in OpenPlant PID by using a calculated expression. This calculated expression is defined in a custom attribute. Below is an example of a Calculated Expression. The definition is located in the supplemental schema in the project's schema folder. A supplemental schema acts like an overly of another schema, in this case the OpenPlant schema. The parametric instrument has the class INSTRUMENT from the OpenPlant schema as base class. Therefore the corresponding project specific definitions are located in the supplemental schema of this project.
If you'd open the schema file in an editor the resulting XML is
<CalculatedECPropertySpecification xmlns="Bentley_Standard_CustomAttributes.01.02"> <ECExpression>this.GetRelatedInstance("PLANT_AREA_HAS_NAMED_ITEM:1:PLANT_AREA, NAME:?").NAME & "- " & this.DEVICE_TYPE_CODE & "-" & this.NUMBER</ECExpression> <FailureValue>Device</FailureValue> <ParserRegularExpression>^[?\w]*-(?<DEVICE_TYPE_CODE>[\w]*)-(?<NUMBER>[\w]*)|(?<NUMBER>[\w]*) </ParserRegularExpression> <IsDefaultValueOnly>False</IsDefaultValueOnly> <RequiredSymbolSets /></CalculatedECPropertySpecification>
The tag number definition of the instruments is
this.GetRelatedInstance("PLANT_AREA_HAS_NAMED_ITEM:1:PLANT_AREA, NAME:?").NAME & "-" & this.DEVICE_TYPE_CODE & "-" & this.NUMBER
The expression's sections and their meaning:
To add he value of a property of the same object:
this.[Object Property Name]
To add a value of a property from a related object:
this.GetRelatedInstance("[Relationship Name]:1:[Source Object Name], [Source Property Name]:?").[Target Property Name]
The failure value is part of the error message in case the ec expression could not be resolved. It should indicate the component type where the error occurred. It is recommended to use the class name as failure value
The parser regular expression uses Perl-style regular expression patterns. You can find a desctiption on those expressions on this external web site: Regular Expression HOWTO
This expression is used to parse back the tag number to its separate values. With this expression you can type in a tag number manually in the Businesskey field and the values are parsed back to the separate values.
Required to start
The parsing expression
Inteprete the first part of the tag number as alphanumeric string until the 1st hyphen. Display a ? if no value is selected
Look for literal – value.
Allocate all characters after the first hyphen and before the second hyphen to the DEVICE_TYPE_CODE property
Blank or empty ParserRegularExpression
When the ParserRegularExpression is blank, the tag number becomes readonly, only the tag parts can be modified. Also the Tag Number dialog [...] access from the Element Info becomes disabled.
An associated item cannot be parsed back. Since it is not existing as a local property a new value of an associated item, such as the AREA of the instrument business key you can't type in a value for the area and hope that it gets assigned no matter if the value is existing as an AREA object or not.
2. No cascading use of GetRelatedInstance
The value that is accessed via a relationship using GetRelatedInstance cannot be a calculated value itself