主要内容

Copying Faults

Since R2025a

You can copy faults that you define in a model or library. You copy faults by copying the blocks that contain faults. To copy a fault:

  1. Cut or copy the block.

    • Cut the block — Right-click the block, click the arrow , and then click the Cut button , or click the block and press Ctrl+X.

    • Copy the block — Right-click the model element, click the arrow , and click the Copy button or click the block and press Ctrl+C.

  2. Paste the block. Right-click the Simulink® model canvas, click the arrow , and click the Paste button or click the model canvas and press Ctrl+V.

Pasting the block duplicates the block, the faults assigned to the block ports, and the fault behavior. For more information on fault behaviors, see Define Fault Behaviors.

An animated GIF. The user selects a Sine Wave block that has a fault, They access the context menu, select Copy, and exit the context menu. They then point to an area to the left of the block, access the context menu again, and click Paste.

You can copy the fault into the same or a different model. Depending on whether you paste the fault in the same or a different model, Simulink Fault Analyzer™ saves the fault in one of these ways:

  • Copying faults into the same model — Simulink Fault Analyzer also adds the fault behavior to the fault model assigned to the original fault.

  • Copying faults into a different same model — If the faults in each model use only one fault model, or if one of the models does not have faults, Simulink Fault Analyzer copies the fault behavior in the existing fault model. If the faults in each model use more than one fault model, Simulink Fault Analyzer asks you to select the fault model before copying the fault.

Copy Faults into Referenced Models

You can copy faults into referenced models. When you copy a block into an instance of a referenced model:

  • The original referenced model updates to include the copied block and faults.

  • Simulink Fault Analyzer duplicates the copied block across other instances of the referenced model, but does not copy the faults. To copy the faults to the other instances of the referenced model, resynchronize the fault information files. In the Fault Analyzer tab, in the Prepare Faults section, click Resync Faults.

To add a fault to a single instance of a referenced model, access it from the top model, then define the faults. See Manage Faults in Referenced Models.

Copy Faults from Model Libraries

You can add faults to libraries, and copy the library blocks into your models. Like standard Simulink models, libraries use a unique fault information file. To add a library block that has faults to a model, copy and paste the block or drag it into the model. The Fault Table pane in your model includes the copied faults.

An animated GIF. The user has a library and a model open. The user copies the library block on the left over to the model on the right three times. The user then expands the Fault Table pane to display the three faults that they copied.

If you add faults to a library after adding the linked library block to the model, you can synchronize faults from library blocks into the parent model (since R2026a). For more information, see Synchronize Faults from Multiple Instances of a Linked Library Block.

See Also

Topics