Contenuto principale

getAssociatedModel

R2026b

Retrieve name of model fault

Since R2023b

Description

name = getAssociatedModel(fault) returns the name of the model that contains the fault, fault.

example

name = getAssociatedModel(conditional) returns the name of the model that contains the conditional, conditional.

example

Examples

collapse all

Open a model with a block that supports fault modeling.

openExample("simscape_shared/SimpleMotorArmatureWindingFaultExample")

Add a fault to the DC Motor block.

myFault = Simulink.fault.addFault(...
"SimpleMotorArmatureWindingFault/DC Motor/Armature winding");

Retrieve the name of the model that contains the fault.

myBehaviorModel = getAssociatedModel(myFault)
myBehaviorModel =

    'SimpleMotorArmatureWindingFault'

Open a model with a block that supports fault modeling.

openExample("simscape_shared/SimpleMotorArmatureWindingFaultExample")

Add a conditional named myConditional with the expression y1 >= 0.

faultConditional = Simulink.fault.addConditional(...
"SimpleMotorArmatureWindingFault","myConditional","y1 >= 0");

Retrieve the name of the model that contains the conditional.

myModel = getAssociatedModel(faultConditional)
myModel =

    'SimpleMotorArmatureWindingFault'

Input Arguments

collapse all

Fault, specified as a Fault object.

Conditional, specified as a Conditional object.

Output Arguments

collapse all

Name of the model that contains the fault or conditional, returned as a character vector.

Version History

Introduced in R2023b

See Also

Objects

Functions