Defining Constraints

Objectives

After completing this lesson, you will be able to:
  • Define your own constraints.
  • edit formulas and tables.

Constraints: OBJECTS-Part

The OBJECTS part is optional. It can be omitted if only the three instances $self, $parent, and $root are to be addressed and no variables are required.

Watch the following video, which explains the declaration of objects.

In the step, Maintain object keys, you define which fields are used to specify an object. You also enter the field name of the key field. The material number key field is referred to by formal parameter NR. An object key can consist of several partial keys, as is the case for documents:

(Document)(017)(TYPE = 'DRW', VERSION = '00', PART = '000', NR = 'D4545')

For the class type, enter the class type of the class to which the object is assigned. If the object is not assigned to a class, do not enter a class type. However, you must enter empty parentheses as a place holder.

(Material)()(NR = 'MAT-A')

Constraints: Variables

The following figure shows you the variable definition in the object part.

Diagram illustrating object declarations for class, material, and instance using variables X, Y, and Z, with a sidebar showing a forklift icon and specifications.

Defining Variables

If you use a class to refer to an object, you use the expression IS_A to define a variable: X IS_A (300) T_FC00.

If you refer to an object using the object key, and do not enter a class, you use the expression IS_OBJECT to define a variable: Y IS_OBJECT (Material)(300)(NR=T-FC00).

Variables for the $self, $part, and $root instances are defined using the keyword AS: Z AS $SELF

If you use the object key to refer to an object, you must define a variable. If you use a class or an instance to refer to an object, defining a variable is optional.

You can enter a ? to make your variables easier to identify: ?X IS_A (300) T_FC00.

The variables referred to in a constraint must already be known when you create a constraint.

Constraint – Example without variables:

Code Snippet
1234
OBJECTS: (300)T_FC498 , (300)T_FC598 . CONDITION: (300)T_FC598.T_FC004 specified . RESTRICTION: (300)T_FC598.t_FC003 = (300)T_FC498.t_FC022 .

Constraint – Example with variables:

Code Snippet
1234
OOBJECTS: ?carr is_a (300)T_FC498 , ?cab is_a (300)T_FC598 . CONDITION: ?cab.T_FC004 specified . RESTRICTION: ?cab.t_FC003 = ?carr.t_FC022.

Constraint – Example with characteristic variables:

Code Snippet
123456
OBJECTS: (300)T_FC498 where wheels = T_FC022 , (300)T_FC598 where seat = T_FC003 ; back = T_FC004 . CONDITION: specified back . RESTRICTION: seat = wheels.

The following figure shows you variable examples in the object part.

The image compares two scenarios: one without variables and one with variables, detailing objects, conditions, and restrictions for a drive and lift. The version without variables uses specific terms, while the variable version uses letters A, T, and H to represent type of drive, tonnage capacity, and mast height, respectively.

Advantages of variables:

  • Self-explanatory names

  • Easier to maintain subsequent sections of constraint

  • Less code

It's entirely up to you whether you use variables or not. Variables are an option for supporting modeling. Characteristic variables can be used in conjunction with object variables and class variables.

Restrictions

Watch the following video explaining the Restrictions part of a Constraint.

In the RESTRICTIONS section of a constraint, you can also call tables that you defined previously. This makes a constraint a powerful tool, since you can replace a large number of preconditions by using a table call in a constraint.

You can also use tables to restrict the allowed range of values. For example, you can use a table call to define the value combinations for the mass height and drive type. If you refer to a table in a constraint, only the value combinations defined in the table are valid. Under LO-VC, you must use restrictable characteristics and the INFERENCES part for this.

Constraints: Examples

Restriction

The image shows two tables detailing forklift specifications, conditions, and restrictions, along with tree diagrams illustrating object classifications for drive and lift. The tables list attributes such as type of drive, tonnage capacity, mast height, and performance, with conditions for diesel engines.

The constraint returns an inconsistency if the RESTRICTIONS section is not true. The RESTRICTIONS section can also infer a value for the printer software in the first example, and for the two characteristics of the class node in the second example.

Constraints can hide values of a restrictable characteristic that are not allowed. To do this, under LO-VC, the constraint must contain restrictable characteristics and an inferences part. Under AVC, this always happens.

Condition

In the CONDITION section, you specify when the constraint is processed. A constraint is only processed if the condition section is true. The syntax of a condition is similar to the syntax of a precondition or selection condition. However, the following differences apply:

TYPE_OF is not allowed in constraints.

You can use variables for objects, classes, and characteristics.

You can use logical expressions of any complexity, including nested disjunctions and conjunctions (AND, OR, and parentheses).

In addition, you can use the expressions PART_OF and SUBPART_OF. PART_OF checks whether a material or document is in the BOM of another material or document. SUBPART_OF checks the same thing across multiple levels of the BOM.

In the condition section and in IF conditions in the restrictions section, statements such as the following are false if the characteristic has no value assigned: =.

The functioning of such statements is the same as in preconditions and selection conditions.

The following figure shows you an example of a condition section.

Two blocks outline conditions and restrictions related to objects labeled Drive and Lift, with parameters like type of drive, tonnage capacity, and mast height. The first block specifies that for diesel drives, mast height is restricted if tonnage is specified, while the second block indicates conditions based on specific tonnage and mast height values.

Constraints with (LO-VC) and without (AVC) Inferences

Text describing conditions and prerequisites for inferring a value for any characteristic variable in the restriction section, with a blue oval labeled only LO-VC.

The inferences section can only contain characteristic variables.

If you use a table call or a function call, the relevant access keys must be defined there (value assignment alternative of a table or function).

If you use arithmetical expressions, it must be possible to interpret a variable.

Constraints with Formula and with (LO-VC) and without (AVC) Inferences

Watch the following video, and understand the definition of Constraints with formulas and inferences.

Create a Constraint: A Simple Example

Within a single level configuration, a required value assignment has to be defined with a constraint.

Watch the following simulation and understand the creation of a Constraint.

Create a Constraint in a Multilevel Configuration with Additional Modeling Steps (Optional)

The configurable forklift is to be assigned another configurable component. A multilevel configuration should be possible. A constraint is used to compare the evaluation of the header configuration and the component configuration.

Watch the following simulation, and understand the creation of a constraint in a multilevel environment. A material and class creation takes place and also the change of an existing BOM.

Log in to track your progress & complete quizzes