<< 点击显示目录 >> 主页 exOS使用助手 > exOS Automation Help > Diagnose > Function blocks > ExTargetClockDeviation |
功能块
参数
输入/输出 |
参数 |
数据类型 |
说明 |
---|---|---|---|
IN |
ExTargetLink |
REFERENCE TO ExTargetLink |
连接至 exOS 目标配置。 |
IN |
Enable |
BOOL |
只要该输入被设置,功能块就处于激活状态。 |
OUT |
Active |
BOOL |
功能块激活。 |
OUT |
Error |
BOOL |
执行过程中发生错误。 |
OUT |
StatusID |
DINT |
状态信息。 |
OUT |
DeviationPerHour |
DINT |
exOS 目标器每小时的时钟偏差(微秒)。 |
该功能块只需一个参数,即 exOS 目标配置生成的全局配置链接地址(包含目标名称)
ExTargetClockDeviation_0(ExTargetLink := ADR(gTarget_0), Enable := TRUE);
有关 StatusID 输出,请参阅 功能块 StatusID。
对于需要精确同步 NETTIME 的应用程序,可以测量 Linux 和 AR 运行时时钟之间的偏差,并将其输入 exOS 目标器配置(仅在 XML 配置文件中)。
<Property ID="DeviationPerHourUsec" Value="100000" /> <Property ID="DeviationPerHourUsec" Value="100000" />
DMR 中的时间同步 使用一个 "保护时间",在该时间内,需要从 AR 收到精确的 NETTIME 信息,系统才能 "同步"(ExDataConnection 或 ExSyncInfo 功能块 中 的PrecisionReached )。在此期间,如果 AR 发送了不精确的 NETTIME 信息,Linux DMR会 使用自己的单调时钟推断下一个 NETTIME 值。
然而,由于 Linux 中使用的单调时钟基准会偏离 AR 中的 NETTIME,因此系统需要调整 "保护时间",使该时钟偏差仍符合 exOS 目标配置中设置的配置 精度 。
系统默认 的每小时偏差设置 为 100000us(这是一个保守值)。这样 ,在精度 为 100us的情况下, "保护时间 "为 4 秒 。 对于时间敏感型应用,测量这一偏差是合理的,因为偏差越小,同步越精确。
对于仿真目标 (ArSim),保护时间不是根据偏差计算出来的,而是设置为 30 秒的固定值。
Function Block
Parameters
I/O |
Parameter |
Data type |
Description |
IN |
ExTargetLink |
REFERENCE TO ExTargetLink |
Connection to exOS Target configuration. |
IN |
Enable |
BOOL |
The function block is active as long as this input is set. |
OUT |
Active |
BOOL |
Function block active. |
OUT |
Error |
BOOL |
Error occurred during execution. |
OUT |
StatusID |
DINT |
Status information. |
OUT |
DeviationPerHour |
DINT |
Clock deviation of the exOS Target per hour in microseconds. |
The function block only takes one parameter, which is the address to the global configuration link generated by the exOS Target configuration (with the name of the target)
ExTargetClockDeviation_0(ExTargetLink := ADR(gTarget_0), Enable := TRUE);
For the StatusID output, please refer to the Function block StatusIDs.
For applications that require precise NETTIME synchronization, the deviation between the Linux and Automation Runtime clocks can be measured and entered in the exOS Target configuration (only in the XML configuration file).
<Property ID="DeviationPerHourUsec" Value="100000" />
The Time synchronization in the DMR uses a "guard time" within which a precise NETTIME message needs to arrive from Automation Runtime for the system to be "synchronized" (PrecisionReached in the ExDataConnection or ExSyncInfo function block). During this time, if unprecise NETTIME messages arrive from AR, the Linux DMR extrapolates its next NETTIME value using its own monotonic clock.
As the monotonic clock base used in Linux is however drifting from the NETTIME in AR, the system needs to adjust the "guard time" so that this clock deviation still meets the configured Precision set in the exOS Target configuration.
The default system setting for DeviationPerHour is 100000us (which is a conservative value). This results in a "guard time" of 4 seconds using a Precision of 100us. It makes sense to measure this deviation for time-sensitive applications, because a smaller deviation would allow for a more precise synchronization.
For simulation targets (ArSim) the guard time is not calculated from the deviation, but set to a fixed value of 30 seconds.