诊断 — 错误案例
以下部分介绍可能的错误案例以及如何根据诊断值处理这些错误:
超过了应用程序的循环时间
如果执行时间超过循环时间或接近超过设定的循环时间,则可能会触发周期超时的诊断。
在以下示例中,应用程序任务的执行时间明显短于设定的周期时间。由于应用程序任务的优先级低于 Time Provider 接收任务,因此收到的每个包都会中断该任务,这也会影响执行时间。通信任务的优先级最低,并且始终在应用程序任务之后处理。
![]() |
诊断值 IEC execution time 显示系统上应用程序任务的最小、最大和平均执行时间。这应该大大少于应用程序设定的循环时间。
在 CODESYS Safe Control,则使用本地时间戳和时间提供者时间戳监控周期时间,如果超过周期时间超过 5%,则将引发以下异常错误之一:
Exception ID: 0x40000065: Exception channel 1: Plausibility check of the local timestamp interval: <interval of local timestamp> to the cycle time: <cycle time> (Deviation: <deviation>, Deviation tolerance: <maximum allowed deviation>)
Exception ID: 0x40000066: Exception channel 1: Plausibility check of the remote timestamp interval: <interval of the remote timestamp> to the cycle time: <cycle time> (Deviation tolerance: <maximum allowed deviation>)
应用程序任务延迟
如果应用程序任务的执行延迟,例如由于优先级较高的任务而延迟,则可能会触发周期超时的诊断。
![]() |
诊断值 IEC task jitter 显示系统上应用程序任务的最小、最大和平均任务抖动。该值应尽可能小,以便应用程序任务的执行时间尽可能接近预期的时间。
在 CODESYS Safe Control,使用本地时间戳和时间提供者时间戳监控周期时间。如果执行延迟超过循环时间的 5%,则将引发以下异常之一:
Exception ID: 0x40000065: Exception channel 1: Plausibility check of the local timestamp interval: <interval of local timestamp> to the cycle time: < cycle time> (Deviation: <deviation>, Deviation tolerance: <maximum allowed deviation>)
Exception ID: 0x40000066: Exception channel 1: Plausibility check of the remote timestamp interval: <interval of remote timestamp> to the cycle time: <cycle time> (Deviation tolerance: <maximum allowed deviation>)
时间提供者套餐的延迟
时间提供程序包的延迟可能发生在系统的不同位置:
延迟调用时间提供者。
时间提供程序包在传输过程中出现延迟。
时间提供者接收任务延迟。
在监视时 CODESYS Safe Control,这三种情况都会导致以下异常错误:
Exception ID: 0x40000067: Exception channel 1: Plausibility check of remote timestamp interval: <interval of remote timestamp> to local timestamp interval: <interval of local timestamp> (Deviation: <deviation>, Deviation tolerance: <maximum allowed deviation>)
这包括监控自上次收到包裹以来的间隔之间的差异。
诊断值 TP sample interval 显示自上次收到包裹以来经过的最小、最大和平均时间间隔。这是使用本地时间戳来衡量的,该时间戳是在每次收到时间提供程序包时确定的。诊断值 TP remote interval 显示相同的时间间隔,但这是使用收到的时间提供程序包中的时间戳来测量的。
理想情况下,这些值只能略有不同。
假设传输恒定,则传输时间在时间测量中抵消。
![]() |
延迟执行时间提供器
如果时间提供器的执行延迟,则远程间隔将延长为恒定的传输时间(ttx)。这体现在诊断值的增加或高度波动 TP remote interval。
也不是传输时间 (ttx) 也没有其他因素 CODESYS Safe Control 会对该值产生影响,因为该值仅根据存储在时间提供程序包中的时间戳进行计算。
越均匀和恒定 TP remote interval 值为,时间提供器运行的可靠性越高。
Time Provider 包的延迟传输
如果时间提供者包在传输时出现延迟,那么 Local Interval 扩展为持续执行时间提供器。这体现在诊断值的增加上 TP local interval。
这包括网络传输路径和时间提供者接收任务的正确调度。 Local Interval 使用本地时间戳计算,本地时间戳是在收到时间提供程序包后立即确定的。
不均衡且波动很大 TP local interval 诊断值表示时间提供者接收任务的传输或优先级划分存在问题 CODESYS Safe Control。


