Constraints
A constraint definition defines a logical condition, and a constraint usage applies this condition in different contexts, enabling the reuse of the constraint definition throughout the system. The constraint usage is satisfied when its expression evaluates to true, and violated when it does not.
Creating constraint usage and definition elements
Creating constraint usage and definition elements via the Textual Editor
To create constraint usage and definition elements via the Textual Editor
- In the Textual Editor, place the cursor where you want to create the element and declare the keyword:
- constraint def for a constraint definition.
- constraint for a constraint usage.
- Specify the element name.
- Specify the constraint (expression, attributes, etc.) in the element's body.
- Click the Synchronize button.
constraint def MassLimit { // constraint definition
attribute mass : MassValue;
attribute massLimit : MassValue;
mass <= massLimit
}
part vehicle {
attribute massActual : MassValue;
attribute massRequired : MassValue;
constraint massConstraint { massActual <= massRequired } // named constraint usage
constraint { massActual <= massRequired } // unnamed constraint usage
}
Creating constraint usage and definition elements via the Create Element command
To create constraint usage and definition elements via the Create Element command
In the Containment tree, right-click an element, and in the shortcut menu, click Create Element.
- In the Create Element dialog, select one of the following:
- constraint def to create a constraint definition element.
- constraint to create a constraint usage element.
- Name the element.
- Specify the constraint (expression, attributes, etc.).
Creating constraint usage and definition elements via the view palette
To create constraint usage and definition elements via the view palette
- In the view palette, under the Requirements/Constraints group, click one of the following:
- The constraint def button to create a constraint definition element.
- The constraint button to create a constraint usage element.
- Click in the view pane where you want to create the constraint.
- Specify the constraint (expression, attributes, etc.).
Auto-creating constraint definition elements via the Extract Definition commands
To auto-create constraint definition elements via the Extract Definition commands
- See the Extract Definition and Usage page.