2e9272cc8a
引入成熟 IEC 60870-5-104 子站的只读子集(App/protocol/iec60870,28 个源文件 按原字节复制,UPSTREAM.sha256 记录来源,兼容补丁保留全部断言与容量),在其上 装配单属主共享核心(Start/Poll/Stop/Get_Status),并把标准 DTU 演示点表全量 接入为唯一真源。 - iec104_core:threadless 推进,poll 零等待,通知/交互/COV 扫描全部有界; 生命周期区分失败启动待重试、重复启动拒绝、断线保固化 RAM。 - iec104_dtu_table / iec104_source:标准 DTU 全点表注册,无数据源的点读 0, 遥控只做模拟状态可读回,不触碰实际出口。 - iec104_sim:仅窗口与独立服务模式起真实 TCP,无头黄金模式保持确定性假统计。 - test/host/iec104_dtu:独立真实 TCP 11 项、传输层 10 项、生命周期与借用负例。 验证:lvgl_sim 真实 TCP 11/11、传输 10/10,UI 像素回归未回退;AC5 单 TU 编译 0 错误 0 诊断。板端尚未切换:完整库闭包 RAM 超 92% 门禁净增预算 25730B, 结论为停止转实施,记录在 IEC104_MCU最小可行性验证.md。旧实现与 board 服务 保持原样,未提交 MDK 工程改动,未烧板。
68 lines
10 KiB
Markdown
68 lines
10 KiB
Markdown
# Independent IEC104 DTU acceptance matrix
|
|
|
|
## Oracle and scope
|
|
|
|
Read-only reference: `IEC60870-Slave/examples/iec104_dtu_profile.h`, `iec104_example_points.h`, and `iec104_slave_example.c`. Tests do not import the implementation model or compare two model views. Profile numeric counts are checked against independently parsed rows; runtime ranges below are traced to the original runtime, not guessed from the replacement.
|
|
|
|
- SP: profile 59 IOAs, 0x0001..0x0041 excluding 0x002c..0x0031.
|
|
- DP: runtime 16 IOAs 0x1001..0x1010 (`EXAMPLE_DOUBLE_COUNT`, GI/Read).
|
|
- Measurements: profile 30 IOAs 0x4001..0x401e, GI Type13.
|
|
- Energy: profile four metadata rows; runtime `EXAMPLE_COUNTER_COUNT=8` exposes 0x6401..0x6408 (not four). Counter interrogation is independent of GI.
|
|
- Step and bitstring: runtime eight each at 0x1201 and 0x1301; Read only, not GI.
|
|
- Commands: profile 19 plus runtime step eight, setpoint30 and bitstring eight. Some extension command forms are disabled by original default policy; visibility is not permission.
|
|
- Standard parameters: runtime 120, four groups of30 at 0x8601+group*0x20. Group0 first4 Type111, remainder Type110; groups1/2 Type111; group3 Type112. GI includes these.
|
|
- Remote parameters: profile430 metadata entries,345 configured readable in SN0;85 unconfigured remain metadata-only per Lead clarification. SN1..4 action parameters only (original model reports88). Never infer a fixed296 total.
|
|
- Example diagnostic aliases (scope pending, not silently equated to standard product points):41 measurement source aliases 0x9601..0x962c excluding0x961c..0x961e;93 digital aliases0x9141..0x919d;16 pulse aliases0xb100..0xb10f. Source: original `Example_Read_Point` lines3063..3081. Retained in oracle inventory but excluded from first standard acceptance run pending Lead scope decision.
|
|
- Original demo nonzero initial observations are NOT acceptance values: source-less visible observations must start at zero. Configured parameters retain typed configured values. Do not erase quality flags or real protection lockout.
|
|
|
|
## Tests and independent observations
|
|
|
|
Measured status: `ci-artifacts/iec104-tests/tcp-final/report.json` records 11/11 PASS on the frozen `lvgl_sim.exe` SHA256 `d2285bbc68ce4353c814dbcc455a2083b56e81fc54bf88081402e821c6a92833`. Exact GI225 includes parameter value/QPM checks; CI8 uses original default Type206; Read121 checks zero/IV or SB plus CP56 legality; remote345 compares independent original typed defaults. The run includes area changes, preset/read unchanged/commit/read changed/cancel, disconnected stage invalidation, committed RAM retained across TCP reconnect, UInt16777217 precision, unknown/unconfigured addresses, malformed typed values, APDU255, split/coalesced streams, causal SBO state/feedback and rejected-command invariance, full device time and progression, unchanged host clock, and 30-second monotonic SBO expiry. Normal pre-START TESTFR and illegal pre-START I-frame close are distinct assertions. Source/transport/core probes record 10/10 PASS in `transport-final/report.json`; these are separately linked migrated production sources, not old-library binaries.
|
|
|
|
Remaining unverified: malformed GI CA/IOA/QOI combinations; inbound APDU overlimit close; wrong TLV declared length on product TCP; every one of the 65 command entries and default-disabled extension permissions; nonzero measurement deadband reference stability; Spontaneous negative time_kind; injected Close/Destroy/GetStatus cleanup failures (no supported fixture injection); atomic platform apply rejection after validation; mapped-UShort callback overflow/fraction (no reachable mapped UShort entry). TCP tests terminate the process, so normal finite-deadline shutdown and UI are separately owned simulator evidence. The 11-case TCP suite is not an assertion that all commands/features were exhaustively tested. Diagnostic aliases150 are deliberately excluded by Lead scope decision and must return unknown rather than fabricated zero success.
|
|
|
|
Initialization contract frozen by Lead after data/core review: observations are zero with IV; step/bit simulation is zero with SB. Parameters are configuration, not sampled observations: preserve original legal typed defaults and read-only mappings. This is the chosen integration contract, not a quotation of the original user wording. Committed values survive ordinary TCP reconnect in RAM; reconnect discards selections/stages; explicit service initialization restores defaults; no persistence is claimed.
|
|
|
|
The table below is the overall design matrix; only the measured status above is a coverage claim. Items listed as remaining unverified are not passes.
|
|
|
|
| Behavior | Positive evidence | Negative/boundary evidence |
|
|
|---|---|---|
|
|
| STARTDT, STOPDT, TESTFR | Exact U confirmations | Business before START rejected/no publication |
|
|
| GI | ACTCON, complete exact SP/DP/YC/standard-parameter set, no duplicates, ACTTERM | Bad CA/IOA/QOI; PN asserted separately |
|
|
| Read | Each runtime readable IOA independently requested and decoded | Unknown address COT47 PN1 |
|
|
| Parameters200/201 | Switch area then read current/min/max | Invalid area rejected, current unchanged |
|
|
| Parameters202 | Exact configured IOA/tag/value set vs source profile; count/length/SN/PI | Unknown and unconfigured address, incorrect tag/length, NaN |
|
|
| Parameters203 | Read baseline -> preset -> read unchanged -> solidify -> read changed -> restore | Execute without preset; preset/cancel/read unchanged; disconnected stage cannot execute |
|
|
| SBO | Select -> execute -> ACTCON/ACTTERM -> state feedback/readback | Execute first, wrong state, different IOA, repeated execute, timeout, reconnect |
|
|
| Simulation safety | Feedback and action log; source audit confirms no physical output call | No claim of physical safety from socket-send success alone |
|
|
| Clock | Deliberate device-clock offset, response + subsequent event CP56/clock diagnostic | Host wall-minus-monotonic unchanged; SBO timeout still monotonic |
|
|
| TCP stream | Split start/header/body, concatenated frames, reconnect sequence reset | Complete255-byte APDU/length253/ASDU249; reject overlimit; service-side short write via separately linked Net stub |
|
|
| UI | Same executable hash used for TCP and independent golden tests | No golden updates to hide regression |
|
|
|
|
## Evidence rules
|
|
|
|
Every request/response frame is retained as hex with monotonic timestamps. Each decoded object is written with IOA/type/value. Report failures, timeouts and missing observability as failures or explicit unverified items, never passes. Record executable hash and reference hashes. Existing `test/host/iec104`, `iec104_serv`, and master RX tests remain untouched. After code settles, run corresponding unit-test hooks or `scripts/ci_local.py`; Keil and simulator builds are coordinated with the build owner, not launched concurrently.
|
|
|
|
## Reproduction and toolchain
|
|
|
|
Run from the repository root:
|
|
|
|
```text
|
|
python -B test/host/iec104_dtu/run_unit_test.py
|
|
python -B test/host/iec104_dtu/run_tcp_test.py --exe simulator/build/Debug/lvgl_sim.exe --output ci-artifacts/iec104-tests/tcp-rerun
|
|
python -B test/host/iec104_dtu/run_transport_test.py --output ci-artifacts/iec104-tests/transport-rerun
|
|
python -B test/host/iec104_dtu/run_transport_test.py --only core_lifecycle --output ci-artifacts/iec104-tests/lifecycle-rerun
|
|
python -B test/host/iec104_dtu/run_transport_test.py --only source_binding --output ci-artifacts/iec104-tests/source-rerun
|
|
python -B test/host/iec104_dtu/run_transport_test.py --only vendor_boundary --output ci-artifacts/iec104-tests/boundary-rerun
|
|
```
|
|
|
|
TCP requires Python standard library and the final same-UI simulator binary; use a distinct `--port` when tests run concurrently. Transport/probes require MSVC x64 and Windows SDK, discovered by existing `test/host/common/unit_test_harness.py::locate_toolchain` (standard VS installation directories, no `vcvars` or `vswhere` invocation). Explicit `DTU_MSVC_CL` and `DTU_WINDOWS_KITS_ROOT` overrides obey that shared harness contract. Compiler path, command, source SHA256 and per-fixture build/run logs are retained. `/W3 /WX /std:c11 /utf-8` are used without warning suppression. Idle upstream fixture has a checked size_t-to-uint32 conversion in its generated artifact copy; report preserves upstream and adapted hashes. Original library and old host tests are not edited. Preserved legacy runners were actually executed: IEC104179/179 and IEC104 SERV37/37 PASS, combined command exit0; summary `ci-artifacts/iec104-tests/legacy-regression.txt` records existing compiler warnings, so this is not a zero-warning legacy-build claim.
|
|
|
|
The self-test runner only tests the independent decoder/oracle (7 tests), not product acceptance. Existing total host discovery sees `run_unit_test.py`; real TCP and MSVC transport runners are explicit acceptance entrypoints, NOT yet registered as automatic CI coverage gates. New firmware registration/Keil build and existing host coverage gates are separately owned; this file does not claim CI/coverage/dual-target registration passed. No old tests were deleted to hide regressions.
|
|
|
|
Oracle corrections retained with failures: QPM is `{1,3,4,2}` from original enum, not group+1; original CI defaults to Type206, not15; pre-START I-frame is FATAL close per original Link; wrong-IOA EXEC does not clear a prior selection, so reselecting without cancellation invokes duplicate-select rejection. The genuine product Read Type1/3 compatibility defect was separately repaired to Type30/31 CP56 before the final binary. Earlier failing snapshots remain in artifacts.
|
|
|
|
## Requested simulator CLI
|
|
|
|
Current user-authorized basic contract: `lvgl_sim.exe --iec104 --iec104-headless --iec104-port N --iec104-duration S`; bind `0.0.0.0` to listen on all local IPv4 interfaces, READY after bind, finite lifetime. The test client still defaults to `127.0.0.1` for local acceptance. The historical `d2285bbc...c6a92833` 11-case results above were measured over loopback before this bind-address change; they do not establish external-IP or LAN reachability of the new binary. New wildcard-listen and address/handshake evidence will be recorded separately after simulator/reviewer verification; a connection from the same host to its LAN IPv4 is not proof of access from another LAN device. Lead rejected a production send-chunk switch: server-side short-write/WOULD_BLOCK must use a separately linked Net stub, while real TCP split covers inbound reconstruction. Device time is independently readable with Type103/COT5. Action counters/source audit are required for the no-physical-DO claim. No hardware, macro changes, commit or push.
|