How to Use Sample Times in Simulink
Many engineering applications require control over when the block updates and produces output. Simulink® provides a way to do this by allowing you to set the sample time or rate for discrete and hybrid systems. You can further understand and visualize sample times in the model by using annotations, colors, and the Timing Legend. Colors and annotations relate to different sample time groups existing in the model. The Timing Legend gives you an interactive way to identify rate, rate types, and rate sources, and navigate to them in the model.
Many engineering applications require control over when the block updates and produces output. Simulink provides a way to do this by allowing you to set the sample time for discrete, continuous, and multi-rate components.
This model of a fuel control system has sample times set to control when the discrete, continuous, and multi-rate components are updated.
Sample time is set as a parameter in the block dialog. You can also set the sample time value to be inherited. Setting the sample time to be inherited allows that block’s sample time to be controlled by the block it’s connected to.
You can understand and visualize sample times in the model by using annotations, colors, and the Timing Legend. Colors and annotations relate to different sample time groups existing in the model. In this model, we can see that the subsystem related to fuel rate control is discrete and the subsystem related to engine gas dynamics is multi-rate.
When we highlight the continuous rate in the model, we can identify our plant – the Engine Gas Dynamics subsystem.
But why is Engine Gas Dynamics multi-rate? It doesn’t have the second discrete rate. But it does have the first. We can now highlight the origin to learn what block is driving this rate. The highlighting helps us identify where in the model the rate is. Now that we’ve identified the block, we can decide whether we want to keep it discrete.
If I highlight the Triggered rate, I see that Fuel Rate Control subsystem contains it, yet that subsystem is not multi-rate. And triggered sample times, such as a function call being sent, are always a subset of another sample time like the discrete sample time. So, therefore, it won’t change the subsystem to multi-rate. The same thing is true for a constant sample time in a component.
Sample times are a fundamental concept in Simulink, because it is one of the main ways to control when a block updates and outputs its value. And understanding how sample times operate can help you better understand your model.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.