Defining Condition Section

Objective

After completing this lesson, you will be able to control the execution of a constraint

Constraint Condition Section

The figure gives an overview of the Condition section.

The Condition section acts as a prerequisite or a trigger. Its role is to define the specific circumstances under which the main logic of the constraint - the Restriction section - should be evaluated.

Additionally, the Condition section can filter the objects defined in the declaration of the Object section, as well as the combinations between them when more than one object is selected.

In simple terms, the Condition section answers the question: "Should the rules in this constraint be applied right now?" If the condition is met, the constraint is executed. If not, the constraint remains dormant and does nothing.

Control Constraint Processing

The Condition section allows for more precise control, ensuring that rules are only applied when relevant, often after the user has provided specific input.

The figure summarizes the common syntax of the condition part.

As its name implies, the CONDITION section is used to define a specific condition that must be met.

All standard conditional syntax is supported.

The figure shows how the syntax for specified and not specified can be used in the various types of object dependencies.

The syntax element SPECIFIED is a conditional function used within dependency logic to determine if a value has been assigned to a characteristic.

Conversely, NOT SPECIFIED is used to verify that a characteristic has not yet been assigned a value.

SPECIFIED and NOT SPECIFIED return a boolean result (true or false).

You can use the syntax elements SPECIFIED and NOT SPECIFIED in all conditional dependencies.

Hint

By its nature, a constraint is only executed when a change is made to the domain of at least one of its characteristics, such as a value assignment or a domain restriction. The NOT SPECIFIED state does not constitute such a change. Therefore, NOT SPECIFIED cannot be used in the Condition Section of a constraint.

Assignments and restrictions using <> operator in combination with NOT SPECIFIED conditions can be done by using procedures.

The figure shows a syntax example of how a constraint is applied only to matching instances via a simple comparison condition.

Filtering of Instances

By default, a constraint is executed for all objects in the exploded BOM that match the Objects declaration and for which the Condition holds.

When you declare multiple variables in the OBJECTS section, the system’s goal is to be completely thorough. It doesn’t assume you are looking for different objects. Instead, it generates every possible combination of instances that fit the declaration.

The CONDITION section acts as a filter, testing all the object combinations generated by the OBJECTS section. Only the combinations that are TRUE for the condition are passed on to the main rule in the RESTRICTIONS section for processing by:

  • Instance Comparison
  • Instance Value Comparison
The figure shows a syntax example of how a constraint can be applied on multiple instances of the same class only to specific instance combinations .

The purpose of instance comparison is to distinguish whether two objects refer to one and the same instance or to two completely different instances.

When an instance comparison evaluates to TRUE, it means the specific combination of objects being tested has met the required criteria. The main rule defined in RESTRICTIONS will be executed on this specific pair or group of instances.

Hint

Using a special system variable like $root adds another dimension to instance comparison.

Code Snippet
12345678
Objects: Forklift is_a (300)T_FCL80. Condition: Forklift <> $Root. Restriction: ...

The condition forklift <> $root will be TRUE only if the forklift is a sub-component within a larger assembly or bundle. It will be FALSE if the forklift itself is the main product being configured.

The figure shows how, with multiple instances, the constraint is applied only to those instance combinations for which a defined value correlation of the instances' characteristics is satisfied.

Filtering by instance value comparison is a technique for making decisions based on an object’s specific characteristics - such as its power - rather than its identity alone.

The statement Motor1.T_FC001 = Motor2.T_FC001 in the CONDITION performs the value comparison for the characteristic T_FC001. For each generated pair of motors, the system takes the following steps:

  • access the value of the T_FC001 attribute for the instance assigned to Motor1.
  • access the value of the T_FC001 attribute for the instance assigned to Motor2.
  • condition is TRUE only if these two values are identical.
The figure shows how instances can be combined in a constraint using the part-of and subpart-of syntax.

PART_OF is a syntax element used within the Condtion section to verify the structural relationship between two objects. It essentially asks the question: "Is the first object a direct component of the second object?"

Both PART_OF and SUBPART_OF are functions used in the Condition section to verify structural relationships between objects within a Bill of Materials (BOM). They act as filters to ensure your rules apply only to logically connected components.

The key difference is the depth of the relationship they check.

It is also possible to reference a specific BOM item position by using an optional argument as shown in the code example:

  • PART_OF (direct relationship): checks only one level deep in the product hierarchy
  • SUBPART_OF (nested relationship): checks all levels deep in the product hierarchy
Code Snippet
123456789
Objects: Forklift is_a(300)T_FCL80, Motor is_a(300)T_CL_MOTOR. Condtion: PART_OF(Motor, Forklift, '0010'). Restriction: ...