Main Content

addPreRequisiteConstraintID

Class: Advisor.authoring.PositiveBlockParameterConstraint, Advisor.authoring.NegativeBlockParameterConstraint, Advisor.authoring.PositiveModelParameterConstraint, Advisor.authoring.NegativeModelParameterConstraint, Advisor.authoring.PositiveBlockTypeConstraint, Advisor.authoring.NegativeBlockTypeConstraint
Namespace: Advisor.authoring

Check a prerequisite constraint object before the actual constraint object

Description

Specify a constraint as a prerequisite to a constraint object. The Model Advisor checks the prerequisite constraint before checking the actual constraint object.

example

addPreRequisiteConstraintID(ID_1) specifies a prerequisite constraint ID ID_1 that the Model Advisor checks before checking the actual constraint object.

Input Arguments

expand all

To create constraint objects that you can specify as prerequisite constraints, use these classes:

  • Advisor.authoring.PositiveBlockParameterConstraint

  • Advisor.authoring.NegativeBlockParameterConstraint

  • Advisor.authoring.PositiveModelParameterConstraint

  • Advisor.authoring.NegativeModelParameterConstraint

  • Advisor.authoring.PositiveBlockTypeConstraint

  • Advisor.authoring.NegativeBlockTypeConstraint

Examples

expand all

Specify a constraint on a Gain block. Specify this constraint as a prerequisite for a constraint on a Constant block.

Use the PositiveBlockParameterConstraint class to create a constraint on the Gain parameter of a Gain block.

c1=Advisor.authoring.PositiveBlockParameterConstraint;
c1.ID='ID_1';
c1.BlockType='Gain';
c1.ParameterName='Gain';
c1.SupportedParameterValues={'0','5'};
c1.ValueOperator='range';

Use the NegativeBlockParameterConstraint class to create a negative constraint on the Value parameter of a Constant block.

c2=Advisor.authoring.NegativeBlockParameterConstraint;
c2.ID='ID_2';
c2.BlockType='Constant';
c2.ParameterName='Value';
c2.UnsupportedParameterValues={'5'};
c2.ValueOperator='lt';

Use the AddPreRequisiteConstraintID method to specify the Gain block constraint as a prerequisite to the Constant block constraint.

c2.addPreRequisiteConstraintID('ID_1');

The Model Advisor does not check the Constant block constraint unless the Gain parameter has a value between 0 and 5.

Version History

Introduced in R2018a