计时器
支持实时模型 (rtModel
) 数据结构体的系统目标文件为需要绝对时间或已用时间的模块提供高效的计时服务。绝对时间是从程序开始执行到包含使用绝对时间的模块代码的函数开始执行的时间间隔。已用时间是模块的两次连续执行之间的时间间隔。有关代码生成器如何表示和使用计时器的详细信息,请参阅Timer Representation and Computation。
主题
- 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.
- 优化时间计数器的内存使用量
优化代码生成器为经过时间计数器分配的内存。
- 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. (自 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. (自 R2022b 起)