Main Content

Convert Asynchronous Subsystem to a Referenced Model

You can specify an asynchronous function-call input to a referenced model. However, to do so, you must convert the Async Interrupt and Function-Call blocks into a subsystem and then convert the subsystem into a referenced model. This example shows how to convert an asynchronous subsystem to a referenced model.

Open Example Model

Open the example model AsyncSubsysToRefModelConversion.


Convert Async Interrupt and Count Blocks to a Subsystem

  1. Select the Async Interrupt and Count blocks.

  2. Right-click the Count block.

  3. From the menu, select Create Subsystem from Selection.

Check Model Configuration Parameter Settings

Confirm that the model is configured with these model configuration parameter settings:

  • Multitask data transfer is set to error.

  • Multitask conditionally executed subsystem is set to error.

  • Underspecified initialization detection is set to Simplified.

For a model that is large or complex, run the Model Advisor checks in the folder Migrating to Simplified Initialization Mode Overview and make the suggested changes.

Convert Subsystem to an Atomic Subsystem

  1. Open Block Parameters dialog box for the subsystem.

  2. On the Main tab, select the block parameter Treat as atomic unit.

Convert Subsystem to a Referenced Model

  1. Right-click the subsystem.

  2. Select Subsystem & Model Reference > Convert to > Referenced Model.

  3. In the Model Reference Conversion Advisor, click Convert. The advisor converts the subsystem and replaces the Subsystem block with the Model block.

  4. Set model configuration parameter Fixed-step size (fundamental sample time) to 1/300 so that it matches the setting of that parameter for the top model.

Move Async Interrupt Block to Top Model

Move the Async Interrupt block from the referenced model to the top model. Place the block between the Variant Source and Model blocks.

Add Asynchronous Task Specification Block to Reference Model

  1. In the referenced model, insert an Asynchronous Task Specification block.

  2. Set the Task priority parameter of the Asynchronous Task Specification block. For this example, the priority is set to 10. For more information on setting the priority, see Asynchronous Task Specification.

Adjust Block Parameters of Inport Block in Referenced Model

  1. In the referenced model, for the Inport block, open the Block Parameters dialog box.

  2. On the Signal Attributes tab, select the Output function call parameter.

  3. On the Execution tab, set Sample time to -1 (inherited). Click OK.

  4. Set the model configuration parameter Fixed-step size (fundamental sample time) to 1/300. Click OK.

  5. Save the model changes.

Verify Model Configuration

  1. Save the top model.

  2. Update the model diagram.

Related Information