Simulink timer subsystem example
This is the Readme.txt file for the Simulink timer subsystem example.
The timer is a Simulink implementation of a (simulation) timer that can be armed
by sending it a 1-pulse ping signal to 'ping input'.
A single-pulse input initiates an elapsed time calculation that is subsequently
compared to a desired timer duration. The boolean result of this comparison
provides the timer state output.
A 1-pulse ping can be generated with the change detect block that looks for
any difference in it's input signal.
The timer is armed when a 1-pulse ping is detected which begins an elapsed
time calculation. Elapsed time is compared to the desired timer duration
and the timer state is held high while t_elapsed <= t_timer_duration.
Inside the timer subsystem is a 'triggered capture-and-hold' block that captures
the current simulation time when a high is detected on the ping input signal.
This timer subsystem has been tested on Matlab R2016b and R2018a and a close
variant of this subsystem has been used as far back as 2004.
The soft real time subsystem shown in the screenshot is not included in this
single-file release but is freely avaialable under the MathWorks File Exchange
entry titled "Soft Real Time Block for Pacing Simulink Simulations" at:
https://www.mathworks.com/matlabcentral/fileexchange/67520-soft-real-time-block-for-pacing-simulink-simulations
There is no requirement for the soft real time subsystem for this timer to work
but running in soft real time helps illustrate how the timer subsystem works with
the manual switch blocks.
Alternatively the native Simulink 'Pace' block also helps run the system at a
manageable pace for clear demonstration using the manual switch block.
----------------------------------------------------------------------------------
Marc Compere, comperem@gmail.com
created : 12 Jun 2018
modified: 12 Jun 2018
Cite As
Marc Compere (2024). Simulink timer subsystem example (https://www.mathworks.com/matlabcentral/fileexchange/67712-simulink-timer-subsystem-example), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |