The Simulink® product does not simulate asynchronous task behavior. Although you can specify a task priority for an asynchronous task represented in a model with the Task Sync block, the priority setting is for code generation purposes only and is not honored during simulation.
You can use the Asynchronous Task Specification block to specify an asynchronous function-call input to a model reference. However, you must convert the Async Interrupt and Function-Call blocks into a subsystem and then convert the subsystem into a model reference.
Following is an example with step-by-step instructions for conversion.
Convert the Async Interrupt and Count blocks into a subsystem. Select both blocks and right-click Count. From the menu, select Subsystem & Model Reference > Create Subsystem from Selection.
To prepare for converting the new subsystem to a Model block, set the following configuration parameters in the top model. Open the Configuration Parameters dialog box.
Under Diagnostics, navigate to the Sample Time pane. Then set model
configuration parameter Multitask rate transition to
error and Multitask conditionally executed
Under Diagnostics, navigate to the
Connectivity pane. Set parameter Bus signal treated
as vector to
error. Also set
Context-dependent inputs to
Under Diagnostics, navigate to the Data
Validity pane and set parameter Multitask data
Set model configuration parameter Underspecified initialization
If your model is large or complex, run the Model Advisor checks in the folder Migrating to Simplified Initialization Mode Overview (Simulink) and make the suggested changes.
Convert the subsystem to an atomic subsystem. Select the subsystem block parameter Treat as atomic unit.
Convert the subsystem to a Model block. Right-click the subsystem and select Subsystem & Model Reference > Convert Subsystem to > Referenced Model. A window opens with a model reference block inside of it.
Replace the subsystem in the top model with the new model reference block.
Move the Async Interrupt block from the model reference to the top model, before the model reference block.
Insert an Asynchronous Task Specification block in the model reference. Set the priority of the Asynchronous Task Specification block. (For more information on setting the priority, see Asynchronous Task Specification.)
In the model reference, double-click the input port to open its Source Block Parameters dialog box. In the Signal Attributes tab, select the Output function call parameter. Click OK.
Save your model and then update the diagram to verify your settings.