feat: 完成 issue #21 点位字典 CSV schema 增加协议(protocol)维度

This commit is contained in:
2026-08-04 15:59:32 +08:00
parent 098125164d
commit cc7c7330cc
29 changed files with 131 additions and 27 deletions
+4 -3
View File
@@ -21,9 +21,9 @@
edge-gateway/
├── config/gateway.example.yaml # 采集配置外置示例(模板参数化)
├── point_dict/ # 点位字典:CSV schema + 导入 + 自动校验
│ ├── schema.py # 字段定义与约束(对齐 PRD 5.1 字段表)
│ ├── schema.py # 字段定义与约束(对齐 PRD 5.1 字段表 + issue #21 协议维度)
│ ├── loader.py # CSV → 内存模型
│ └── validator.py # 校验:缺失字段 / 量纲 / 重复点号 / 采样率
│ └── validator.py # 校验:缺失字段 / 量纲 / 重复点号 / 采样率 / 协议
├── drivers/ # 协议可插拔驱动(只读)
│ ├── base.py # 驱动抽象基类(唯一入口 read_points)
│ ├── opcua_driver.py # OPC UA(和利时 DCS 等)
@@ -61,7 +61,8 @@ python -m unittest discover -s tests
## 模板化说明(换行业只改配置,不改代码)
- 点位范围 / 采样率 / 量纲:由**点位字典 CSV** 驱动(模板 → 行业点位集)。
- 点位范围 / 采样率 / 量纲 / 协议:由**点位字典 CSV** 驱动(模板 → 行业点位集)。
协议列(可选)提供点位级协议覆盖;留空则按 `gateway.yaml` drivers 段前缀路由。
- 协议选型与连接参数:由 `gateway.yaml` 的 `drivers` 段驱动(模板 → 行业协议栈)。
- Kafka topic 命名:`{template}.{device}.points`,随配置模板变化。
- 新增协议:实现 `drivers/base.py` 的 `Driver` 子类并注册即可,引擎与上行链路零改动。