| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
The sample times of a Model block are the sample times of the model that it references. If the referenced model must run at specific rates, the model specifies the required rates. Otherwise, the referenced model inherits its sample time from the parent model.
Without the ability to inherit sample times, a Model block could not be placed in a triggered, function call, or iterator subsystem. Additionally, allowing a Model block to inherit sample time maximizes its reuse potential. For example, a model might fix the data types and dimensions of all its input and output signals, but could be reused with different sample times, for example, discrete at 0.1, discrete at 0.2, triggered, and so on.
A referenced model inherits its sample time if and only if the model:
Does not have any continuous states.
Specifies a fixed-step solver and the Fixed-step size is auto.
Contains no blocks that specify sample times (other than inherited or constant).
Does not contain any S-functions that use their specific sample time internally.
Has only one sample time (not counting constant and triggered sample time) after sample time propagation.
Does not contain any blocks, including Stateflow charts, that use absolute time, as listed in Blocks That Depend on Absolute Time.
Does not contain any blocks whose outputs depend on inherited sample time, as listed in Blocks Whose Outputs Depend on Inherited Sample Time.
You can use a referenced model that inherits its sample time anywhere in a parent model. By contrast, you cannot use a referenced model that has intrinsic sample times in a triggered, function call, or iterator subsystem. To avoid rate transition errors, you must ensure that blocks connected to a referenced model with intrinsic samples times operate at the same rates as the referenced model.
To determine whether a referenced model can inherit its sample time, set the Periodic sample time constraint on the Solver configuration parameters dialog pane to Ensure sample time independent. If the model is unable to inherit sample times, this setting causes Simulink to display an error message when building the model. See Periodic sample time constraint for more about this option.
To determine the intrinsic sample time of a referenced model, or the fastest intrinsic sample time for multirate referenced models:
Update the model that references the model
Select a Model block within the parent model
Enter the following at the MATLAB command line:
get_param(gcb, 'CompiledSampleTime')
The following Simulink blocks depend on absolute time, and therefore preclude a referenced model from inheriting sample time:
Discrete-Time Integrator (only when used in triggered subsystems)
Sine Wave (only when the Sine type parameter is set to Time-based)
Stateflow (only when the chart uses the reserved word t to reference time)
To Workspace (only when logging to StructureWithTime format)
Some blocks other than Simulink blocks may depend on absolute time. See the documentation for the blocksets that you use.
Using a block whose output depends on an inherited sample time in a referenced model can cause simulation to produce unexpected or erroneous results. For this reason, when building a submodel that does not need to run at a specified rate, Simulink checks whether the model contains any blocks, including any S-Function blocks, whose outputs are functions of the inherited simulation time. If so, Simulink specifies a default sample time and displays an error if you have set the Periodic sample time constraint on the Solver configuration parameters dialog pane to Ensure sample time independent. See Periodic sample time constraint for more about this option.
The outputs of the following built-in blocks depend on inherited sample time, and therefore preclude a referenced model from inheriting its sample time from the parent model:
From Workspace (if it has input data that contains time)
Probe (if probing sample time)
Simulink assumes that the output of an S-function does not depend on inherited sample time unless the S-function explicitly declares the contrary. See Writing S-Functions for information on how to create S-functions that declare whether their output depends on their inherited sample time.
To avoid simulation errors with referenced models that inherit their sample time, do not include S-functions in the referenced models that fail to declare whether their output depends on their inherited sample time. By default, Simulink warns you if your model contains such blocks when you update or simulate the model. See Unspecified inheritability of sample time for details.
![]() | Protecting Referenced Models | Refreshing Model Blocks | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |