☰
DLMS/COSEM 蓝皮书解读(三十九):S-FSK MAC synchronization timeouts(class_id = 52)—— S-FSK 同步过程的一张“超时参数表“
2026/10/20 2:05:22 网站建设 项目流程

DLMS/COSEM 蓝皮书解读(三十九):S-FSK MAC synchronization timeouts(class_id = 52)—— S-FSK 同步过程的一张"超时参数表":搜索/确认/未寻址/帧错误

系列说明:本系列基于 DLMS UA《Blue Book(蓝皮书)第 16 版 · 第 2 部分》,一个接口类一篇。第 37/38 篇讲了 S-FSK 的 Phy&MAC 参数和"发起方",里面多次提到"同步(synchronization)"“搜索发起方(search initiator)”“time-out-not-addressed”。本篇就把这些时间参数一次性讲清:同步过程里各个阶段到底等多久。

上篇回顾:第 38 篇的reset_NEW_not_synchronized会把表打回未配置态,而"未配置态怎么被回收/重新同步"正由本篇的超时参数控制。第 37 篇的search_initiator_threshold决定"能不能快同步",本篇的search_initiator_timeout决定"慢搜索最多搜多久"——两篇互补。


0. 为什么需要这个类 —— PLC 同步是会"掉"的,得有计时器兜底

S-FSK 是主从、靠"听到发起方帧"来同步的。现实里会出各种状况:发起方信号太弱搜不到、刚同步上却收到坏帧、表长期没被单播寻址(可能被遗忘)。如果没有计时器,一台"卡住"的表永远恢复不了。本类就是 4 个超时计时器的配置对象,让设备能在异常时自动失同步、自动回未配置态、等待重新被发现。

蓝皮书原文(S-FSK MAC synchronization timeouts, Overview):
“An instance of the ‘S-FSK MAC synchronization timeouts’ IC stores the timeouts related to the synchronization process.”


1. 类蓝图

S-FSK MAC synchronization timeouts 0…n class_id = 52, version = 0
属性静态/动态数据类型MinMaxDefShort name单位
logical_namestaticoctet-string———x—
search_initiator_timeoutstaticlong-unsigned———x + 0x08秒
synchronization_confirmation_timeoutstaticlong-unsigned———x + 0x10秒
time_out_not_addressedstaticlong-unsigned———x + 0x18分钟
time_out_frame_not_OKstaticlong-unsigned———x + 0x20秒

Specific methods:无方法(m/o 表为空)。

⚠️单位陷阱:三个超时是"秒",唯独time_out_not_addressed是"分钟"。这是本类最容易写错/读错的地方。


2. 属性逐条解读

2.1 logical_name

蓝皮书原文:"Identifies the ‘S-FSK synchronization timeouts’ object instance."
示例 OBIS:0.0.26.2.0.255(非蓝皮书原文)。

2.2 search_initiator_timeout(秒)

蓝皮书原文:"This timeout supports the intelligent search initiator function. It defines the value of the time, expressed in seconds, during which the server system is searching for the initiator with the strongest signal."

蓝皮书原文(行为):“During this timeout, all initiators, which may be heard by the servers, are expected to talk. After the expiry of this timeout, the server will accept a Register request from the initiator having provided the strongest signal and it will be locked to that initiator.”/“If the value of the timeout is equal to 0, this means that the feature is not used.”

蓝皮书原文(重启动时机):“The timeout is started at the beginning of the Search Initiator Phase, when the server receives the first frame with a valid initiator MAC address. The timeout is restarted when the Search Initiator Phase is over and the server locks on the initiator. During the Check Initiator Phase, it is restarted on the reception of each valid frame.”

要点:这是"智能搜索发起方"阶段的时长——在此期间所有能听到的发起方都发言,超时后锁定信号最强的那个。

2.3 synchronization_confirmation_timeout(秒)

蓝皮书原文:"Defines the value of the time, expressed in seconds, after which a server system which just gets frame synchronized (detection of a data path equal to AAAA54C7 hex) will automatically lose its frame synchronization if the MAC sublayer does not identify a valid MAC frame."

蓝皮书原文:“A value equal to 0 is equivalent to cancel the use of the related synchronization_confirmation_timeout counter.”

要点:刚"帧同步"(检测到物理层数据路径AAAA54C7)后,如果短时间内 MAC 子层没认出合法 MAC 帧,就自动失同步——让"同步到错误物理帧"的设备快速掉回搜索态。

2.4 time_out_not_addressed(分钟)

蓝皮书原文:"Defines the time, in minutes, after which a server system that has not been individually addressed: returns to the non configured state (UNC: MAC-address equals NEW-address)... loses its active initiator..."

蓝皮书原文(为什么需要):“Because broadcast addresses are not individual system addresses, the timer associated with the time-out-not-addressed delay ensures that a forgotten system will sooner or later return to the unconfigured state. It will be then discovered again.”/“A forgotten system is a system, which has not been individually addressed for more than the ‘time-out-not-addressed’ amount of time.”

蓝皮书原文:“A value equal to 0 is equivalent to cancel the use of the related time-out-not-addressed counter.”

要点:这是"遗忘回收"机制——一台长期只收到广播、没被单播寻址的表,超过这个时间就回未配置态,丢掉 active initiator,等待被重新发现。单位是分钟,不是秒。

2.5 time_out_frame_not_OK(秒)

蓝皮书原文:"Defines the time, in seconds, after which a server system that has not received a properly formed MAC frame (incorrect NS field, inconsistent number of received sub frames, false Cyclic Redundancy Code checking) loses its frame synchronization."

蓝皮书原文:“A value equal to 0 is equivalent to cancel the use of the related time-out-frame-not-OK counter.”

要点:连续一段时间收不到"格式正确的 MAC 帧"(NS 字段错、子帧数不一致、CRC 错),就失同步。


3. 方法

该类无方法。四个超时都是SET配置属性;值改了立即影响 MAC 子层计时器行为。


4. 【实战举例】

示例 1:典型超时配置(示例值,非蓝皮书原文)

属性示例值说明
search_initiator_timeout30(秒)搜索发起方最多 30 秒
synchronization_confirmation_timeout5(秒)帧同步后 5 秒无合法 MAC 帧就掉
time_out_not_addressed1440(分钟=24 小时)一天没被单播寻址就回未配置
time_out_frame_not_OK60(秒)60 秒收不到好帧就失同步

说明:以上为工程示意值,蓝皮书未给定缺省值(原文:“The default value of this variable should be specified in the implementation specifications.”),实际以设备/项目配套规范为准。

示例 2:"被遗忘的表"如何被回收(时序)

表已同步到 DCU-A,但 DCU-A 故障/撤走 → 表只收到广播,无人单播寻址 → time_out_not_addressed 计时(分钟级)到期 ├─ 回未配置态(mac_address = NEW,联动第 37 篇) ├─ active_initiator 置默认(MAC=NO-BODY, L_SAP=0, system_title=全0,联动第 38 篇) └─ 重新进入"可被搜索/注册"状态,等新 DCU 来认领

示例 3:Search Initiator Phase 的智能搜索

表复位 → 收到第一个带合法发起方 MAC 的帧 → search_initiator_timeout 启动(如 30s) → 期间 DCU-A、DCU-B、DCU-C 都发言(各自信号强度不同) → 超时到 → 锁定信号最强的 DCU-B → 进入 Check Initiator Phase → 之后每收到合法帧,search_initiator_timeout 重启(保持锁定)

配合第 37 篇search_initiator_threshold:若某发起方信号 ≥ 阈值,可走"快速同步"跳过完整搜索。

示例 4:Fast synchronization 的触发条件

蓝皮书原文:“A Fast synchronization may be performed if the level of initiator signal >= Search-Initiator-Threshold and one of the MAC addresses (Source or Destination) is an Initiator MAC address.”
即:表紧挨着 DCU(或已锁定该 DCU 的中继)且信号够强时,直接锁定,不必走完整 30 秒搜索——这是"邻站即同步"的工程现实。

示例 5:把某个超时"关掉"

把time_out_frame_not_OK设为0→ 等价于"取消该计时器"(原文明确:“A value equal to 0 is equivalent to cancel the use of the related … counter”)。调试时关掉某计时器可观察设备是否因此卡死,定位故障环节。

示例 6:单位换算坑(分钟 vs 秒)

time_out_not_addressed = 60在第 37/38 篇语境里你可能以为是"60 秒",但它是分钟=1 小时。若误当成秒,设备会每分钟回未配置态,通信剧烈抖动。解析/配置时务必区分单位列。

示例 7:四个超时的"单位与触发后果"一览(工程对照)

属性单位设为 0 的含义到期后果
search_initiator_timeout秒关闭智能搜索(搜索阶段用满才锁定,关掉则跳过智能搜索)
synchronization_confirmation_timeout秒取消确认计时帧同步后不自动失同步(易卡在错帧)
time_out_not_addressed分钟取消回收表永不因"被遗忘"回未配置
time_out_frame_not_OK秒取消帧错误计时收不到好帧也不失同步

说明:单位为原文明示(三个秒、一个分钟);“设为 0 的含义"来自原文"0 = cancel the use”。后果为工程归纳。

示例 8:故障排查决策树(工程示意)

表频繁掉线(结合第 40 篇 desynchronization_listing): ├─ nb_time_out_not_addressed 高 → 表长期没被单播寻址 → 查主站轮询是否覆盖到它 ├─ nb_timeout_frame_not_OK 高 → 信道噪声大/增益不足 → 调第 37 篇 max_receiving_gain ├─ nb_physical_layer_desynchronization 高 → 物理层不稳定 → 查电力线干扰/接头 ├─ nb_wrong_initiator_desynchronization 高 → 附近有假/强干扰发起方 → 查 DCU 部署 └─ nb_write_request_desynchronization 高 → 被频繁 reset → 查第 38 篇 reset 调用来源

说明:决策树为工程示意(非蓝皮书原文),把本篇超时与第 37/38/40 篇状态机串起来用。

示例 9:调试时"临时关掉某个计时器"

现场怀疑"表是因为time_out_not_addressed太短才频繁回未配置",可临时SET time_out_not_addressed = 0(取消该计时器)观察是否还掉。确认根因后再恢复合理值。警告:生产环境长期关掉回收计时器,会让"真被遗忘的表"永远不被回收,需谨慎。

示例 10:分钟 vs 秒的换算陷阱(再强调)

time_out_not_addressed = 60是60 分钟(1 小时),不是 60 秒。若某实现把它误存为秒,设备每分钟回未配置,表现就是"每分钟断线一次、又能重新同步"——这种周期性抖动首先怀疑单位换算错。


5. 工程上容易踩的坑

  1. 单位不一致:search_initiator_timeout/synchronization_confirmation_timeout/time_out_frame_not_OK是秒,time_out_not_addressed是分钟——最容易读错。
  2. 0= 关闭该功能,不是"0 秒超时立即掉":设 0 是"取消这个计时器"。
  3. 缺省值由实现规格定:蓝皮书没给具体数字,设备手册/项目规范才给,别假设固定值。
  4. search_initiator_timeout会在多阶段重启:搜索阶段启动、锁定后重启、Check 阶段每收合法帧重启——它不是"一次性 30 秒就完"。
  5. time_out_not_addressed用"单播寻址"判断:广播帧不算单播寻址,所以纯靠广播管理的网络里,表仍会被这个计时器回收——这是设计意图(回收遗忘设备),不是 bug。
  6. 与第 37/38 篇强联动:本篇超时到期会触发mac_address=NEW(第 37 篇)和active_initiator重置(第 38 篇),排障要三篇一起看。
  7. synchronization_confirmation_timeout针对"错误物理帧":它快速丢弃"同步到噪声/错帧"的设备,值太小会导致刚同步就掉、太大则卡在错帧上。
  8. 无方法:纯配置类,别找 action;调参用SET。
  9. AAAA54C7是帧同步标志:原文给出物理层数据路径这个十六进制值,调试底层同步时可拿来比对。

6. 小结 & 下期预告

本篇要点:

  1. S-FSK MAC synchronization timeouts(52) 是 4 个同步相关超时计时器的配置对象;
  2. 三个秒级(搜索/确认/帧错误)+ 一个分钟级(未寻址);
  3. 所有超时0= 关闭该计时器;缺省值由实现规格定;
  4. 它是"遗忘设备回收"和"错误帧快速失同步"的机制来源,与第 36/37 篇状态机强联动。

下一篇(第 40 篇):S-FSK MAC counters(class_id = 53)—— 同步/失同步/中继/收发/CRC 这些过程,到底产生了多少统计计数?下一篇就是那张"运行账本":同步登记表、失同步分类账、广播帧计数、中继/发送计数、CRC 对错计数,以及一键reset清所有计数器。


参考资料:DLMS UA《Blue Book Ed.16 Part 2 – COSEM interface classes》,S-FSK MAC synchronization timeouts(class_id = 52, version = 0) 章节;文中属性、数据类型、Short name 偏移、单位与引文均与原文一致;示例中的超时值/时序为帮助理解而构造(标注"示例/非蓝皮书原文",实际以设备对象列表及项目配套规范为准)。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询