Rule Group for SCVALV example
- Last UpdatedNov 28, 2024
- 4 minute read
This next example illustrates a rule group for schematic valves. The source type shown below restricts this rule group to being applied where the source object is of type SCVALV.

This rule group has a number of nested rule groups. The first has a Condition that applies when the source object has a valid SPRE, denoted by being not equal to Nulref.

Here is the Condition:
SPRE OF source NE 'Nulref'
This rule group has a Create Action that specifies the type of object to be created during a Build operation, in this case based on the attribute GTYPE of the source object.

One of the accompanying Assign Actions copies the attribute SPRE from the source object.

The second nested rule group has a Condition that applies it when the source object does not have a valid SPRE, denoted by being equal to Nulref.

Here is the Condition:
SPRE of source EQ 'Nulref'
This rule group has a further nested Rule Group that defines it as applying to source elements with particular GTYPE values.

Here is the Condition:
GTYPE OF source EQ ‘VALV’ OR GTYPE OF source EQ ‘VFWA’ OR GTYPE OF source EQ ‘VTWA’
This rule group also has a Create Action that specifies the type of object to be created during a Build operation, again based on the attribute GTYPE of the source object.

The Create Action has a Selector which will be used during a Build operation to select the object from the pipe specification. It will also be compared with a severity level of warning. Each Selector has a Question and Answer. This Selector takes the STYPE from the source object’s SCSTYP attribute.

The next Rule Group has a condition that tests for a Check Valve using the SCSTYP attribute of the SCVALV.

This is accompanied by a Report Action that will output an error message in the Compare report if the flow direction is reversed.

Here is the Condition:
ARRI OF source EQ ARRI OF target AND LEAV OF source EQ LEAV OF target
Note:
The values of ARRIVE and LEAVE are checked only for bore compatibility between the
schematic and 3D elements unless a specific rule such as this one is defined.
A Report Action is used when the check required includes an expression based on 3D data, whereas an Assign Rule compares the whole value of a 3D attribute to an expression based on schematic data. The following example uses a Report Action to check a substring of a pipe name. In this example the PIPE name follows the convention Size-Fluid-Area-LineNumber and the SCPLIN name follows the convention Unit-Size-Fluid-Spec-LineNumber. To compare the Fluid requires a Report Action with Condition:
before(after(name of target, '-'), '-') eq before(after(after(name of source, '-'), '-'), '-')
An appropriate Mismatch Report would be ‘Fluid code does not match’. If the condition evaluates false, then this message will be output in the report. Note that there is no output if it evaluates true.