Timers
System target files that support the real-time model (rtModel
) data
structure provide efficient time computation services for blocks that
request absolute or elapsed time. Absolute time is
the time interval from the start of program execution to the time when the
function that includes code for a block that uses absolute time starts
executing. Elapsed time is the time interval between
two consecutive executions of a block. See Timer Representation and Computation for more information
about how the code generator represents and uses timers.
Topics
- Timer Representation and Computation
Representation of timers in models and generated code.
- Generate Code for Elapsed Time Counter
Generate code for an elapsed time counter.
- Optimize Memory Usage and Prevent Overflows for Time Counters
You can optimize the amount of memory that the code generator allocates for time counters and prevent time counter overflows.
- Optimize Memory Usage for Time Counters
Optimize memory that the code generator allocates for an elapsed time counter.
- Access Timers Programmatically
Gain access to timers to use in S-functions for simulation and code generation.
- Specify Clock Resolution Used by Target Environment Clock
How to specify the clock resolution that is used by a target environment clock.
- Improve Accuracy of Time Values Read by Generated Entry-Point Functions
Improve the accuracy of time values read by generated entry-point functions by configuring the model clock resolution.
- Configure Timer Service Interfaces
Configure timer services for export functions. (Since R2022b)
- Generate C Timer Service Interface Code for Component Deployment
This example shows how to generate calls to target platform timer service functions to get the value of the target environment function clock tick. (Since R2022b)