Main Content


Class: Advisor.authoring.CompositeConstraint
Package: Advisor.authoring

Add constraint to composite constraint


Specify a constraint ID to add to a composite constraint.


addConstraintID(ID_1) specifies a constraint ID ID_1 that the Model Advisor checks as part of a CompositeConstraint object.

Input Arguments

expand all

To create root constraint objects that you can specify as part of a composite constraint, use these classes:

  • Advisor.authoring.PositiveBlockParameterConstraint

  • Advisor.authoring.NegativeBlockParameterConstraint

  • Advisor.authoring.PositiveBlockTypeConstraint

  • Advisor.authoring.NegativeBlockTypeConstraint


expand all

These commands specify a composite constraint for Multiport Switch blocks:

Create three PositiveBlockParameter constraint objects.

c1 = Advisor.authoring.PositiveBlockParameterConstraint(); 
c1.ID = 'ID_A1'; 
c1.BlockType = 'MultiPortSwitch'; 
c1.ParameterName = 'DataPortOrder'; 
c1.SupportedParameterValues = {'Specify indices'}; 
c1.ValueOperator = 'eq'; 

c2 = Advisor.authoring.PositiveBlockParameterConstraint(); 
c2.ID = 'ID_A2'; 
c2.BlockType = 'MultiPortSwitch'; 
c2.ParameterName = 'DataPortForDefault'; 
c2.SupportedParameterValues = {'Additional data port'}; 
c2.ValueOperator = 'eq'; 

c3 = Advisor.authoring.PositiveBlockParameterConstraint(); 
c3.ID = 'ID_A3'; 
c3.BlockType = 'MultiPortSwitch'; 
c3.ParameterName = 'DiagnosticForDefault'; 
c3.SupportedParameterValues = {'None'}; 
c3.ValueOperator = 'eq'; 

Use the addPreRequisiteConstraintID method to make c1 a prerequisite to checking constraints c2 and c3.


Create a composite constraint that specifies that if a Rate Transition block does not meet both constraints c2 and c3, the block is in violation of this check.

CC = Advisor.authoring.CompositeConstraint(); 
CC.CompositeOperator = 'and'; 

Version History

Introduced in R2018a