Main Content

sdo.requirements.RelationalConstraint class

Package: sdo.requirements
Superclasses:

Impose relational constraint on pair of variables

Description

Use the sdo.requirements.RelationalConstraint object to impose a relational constraint on a pair of variables in a Simulink® model. The variables can be any parameters in your model. You create the requirement object, and specify the type of relation you want between the elements of the two variables. For example, for two variables var1 and var2, you can specify that each element of var1 be greater than the corresponding element of var2.

You can use the requirement object as an input to your cost function and use the evalRequirement command to evaluate if your test data satisfies the specified requirement. You can then use the cost function and sdo.optimize to perform response optimization, subject to satisfaction of the specified requirement. If you are performing sensitivity analysis, after you generate parameter samples, you can use the cost function and sdo.evaluate to evaluate the requirement for each generated sample.

Construction

requirement = sdo.requirements.RelationalConstraint creates an sdo.requirements.RelationalConstraint requirement object and assigns default values to its properties. Use dot notation to customize the properties. Use the evalRequirement command to evaluate if test data satisfies the specified requirement.

requirement = sdo.requirements.RelationalConstraint(Name,Value) creates the requirement object with additional options specified by one or more Name,Value pair arguments. Name is a property name and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Input Arguments

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Use Name,Value arguments to specify properties of the requirement object during object creation. For example, requirement = sdo.requirements.RelationalConstraint('Type','>') creates an sdo.requirements.RelationalConstraint object and specifies that each data element in the first variable is strictly greater than the corresponding element in the second variable.

Properties

expand all

Requirement description, specified as a character vector.

Example: 'Requirement 1 for myModel.'

Data Types: char

Name of requirement, specified as a character vector.

Example: 'Requirement1'

Data Types: char

Relation type between the elements of the two variables, specified as one of the following:

  • '<' — Each data element in the first variable is less than the corresponding element in the second variable.

  • '<=' — Each data element in the first variable is less than or equal to the corresponding element in the second variable.

  • '>' — Each data element in the first variable is greater than the corresponding element in the second variable.

  • '>=' — Each data element in the first variable is greater than or equal to the corresponding element in the second variable.

  • '==' — Each data element in the first variable is equal to the corresponding element in the second variable.

  • '~=' — Each data element in the first variable is not equal to the corresponding element in the second variable.

Data Types: char

Methods

copyCopy design requirement
getGet design requirement property values
setSet design requirement property values
evalRequirementEvaluate design requirement

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects.

Examples

collapse all

Create a requirement object with default properties to define the relation between two variables.

Requirement = sdo.requirements.RelationalConstraint;

Specify that the elements of the first variable be greater than the elements of the second variable.

Requirement.Type = '>';

You can now use the evalRequirement command to evaluate whether test data from two variables satisfy the requirement.

Create a requirement object, and specify the relation between two variables in your model.

Requirement = sdo.requirements.RelationalConstraint('Type','==');

The elements of the first variable are required to be equal to the corresponding elements of the second variable.

Version History

Introduced in R2016b

See Also