Execution domain specification allows you to set a model and its subsystems and referenced models to simulate as discrete-time or data-driven systems. Use this setting to separate the discrete dynamics from the rest of its dynamics, for example, in the design of a deployable controller for a plant that is modeled with continuous-time dynamics.
To simulate a computationally intensive signal processing or multirate signal processing system, you can also assign a dataflow domain. Dataflow domains simulate using a model of computation synchronous dataflow, which is data-driven and statically scheduled. For more information, see Dataflow Domain (DSP System Toolbox).
You can create subsystems that maintain their discrete execution domain irrespective of their environment. By constraining a subsystem to be discrete, you can increase reusability of your subsystem as a component. To improve code generation, this specification reduces unnecessary update methods, reduces major time step checks, and increases reusability of generated code.
The domain specification badge indicates the execution domain computed to a model or subsystem when you update the model diagram. You can toggle the visibility of the domain specification badge by turning on the Sample Time Display. For more information on visualizing sample time, see View Sample Time Information. The badge is visible at the bottom left corner of the Simulink® Editor.
The model below shows a discrete Sine Wave block whose rate is reduced by the Rate Transition block before driving the Gain block.
Observe that the model receives the Discrete execution domain because its contents are all discrete.
You can also toggle the visibility of the badge by enabling or disabling the Set Domain Specification parameter in the Execution tab of the Property Inspector.
You can instruct Simulink to assign the execution domain (along with the allowed sample times) via the Property Inspector.
Deduce from contents Let Simulink assign the execution domain based on the contents of the
Discrete Constrain all blocks in a subsystem to
Dataflow Simulate a computationally-intensive
signal processing or multi-rate signal processing system. This setting
requires the DSP System
When you update the model diagram or simulate the model, the badge displays the computed execution domain for the model component. There are three execution domains in Simulink:
Dataflow Dataflow domains simulate using computation synchronous dataflow, which is data-driven and statically scheduled. This execution domain requires the DSP System Toolbox. For more information, see Specifying Dataflow Domains (DSP System Toolbox).
Other Blocks are not strictly discrete.
Subsystems that receive the Other execution domain include:
Subsystems with a mixture of continuous and discrete sample times.
Subsystems with Asynchronous Sample Time.
If a subsystem has continuous, variable, fixed-in-minor step, Constant Sample Time, or a mixture of sample times, you can use the badge to enable or disable domain specification. The subsystem still receives the Other time domain.
The domain specification badge is not actionable when the currently selected subsystem or model is a linked block, inside a library block, or a conditionally executed subsystem that receives the Other domain. To change the execution domain of a linked library block, break the link to the parent library block. See Disable or Break Links to Library Blocks.
You can set the domain specification per subsystem and at the root level of the model using the Execution tab of the Property Inspector. To enable the Property Inspector for the model, on the Modeling tab, under Design, click Property Inspector, or press Ctrl+Shift+I on your keyboard. If the domain specification badge is displayed, you can also open the Execution settings in the Property Inspector by clicking the badge. See Domain Specification Badge.
Select the Set Execution Domain check box. You can now specify the Domain.
Changing the domain specification at the root level of the model does not change the setting for its child subsystems.
You can also enable this setting from the command line using
set_param to set the
Once enabled, the default setting for the Domain parameter is
Deduce from contents. When you update the diagram, the
execution domain is deduced from the characteristics of the blocks in the currently open
subsystem. For example, a system that has only discrete blocks is in the
Discrete execution domain. See Types of Execution Domains.
The badge shows the current specification setting. If you set the subsystem domain to
Deduce from contents, the badge text displays
Deduce until you update the diagram. Once you update the model
diagram, the badge shows the computed execution domain, as described in Types of Execution Domains. When you enable
Set domain specification and Domain is set
Deduce from Contents, Simulink computes the execution domain of the currently focused subsystem based on
the blocks and sample times inside the subsystem.
To set the Domain parameter from the command line, use
set_param to change
'Discrete'. You can
also get the computed execution domain after you update the diagram using the
CompiledExecutionDomain parameter of the subsystem.
This model shows how to specify execution domains for the constituent subsystems of a model. The model has a discrete cruise controller subsystem that tracks the reference speed set in the Desired Speed block. A car dynamics subsystem models the continuous-time dynamics of the car.
Notice that the discrete cruise controller of the model has a hybrid sample time due to the presence of a continuous-time signal from the output of the car dynamics at the input port of the controller.
To enforce discrete-time execution of the controller, select the subsystem and open the Execution tab of the Property Inspector by clicking on the Domain badge at the bottom-left corner of the Simulink Editor.
Enable the Set execution domain parameter and set Domain to
Discrete. Update the model diagram or simulate the model.
Note that the discrete cruise controller subsystem is now discrete.
You can also set the execution domain of the car dynamics to
Deduce from Contents. The car dynamics subsystem receives the Hybrid sample time and the Other execution domain. If you wish, set the Sample Time parameter of the Inport block in this subsystem to 0.