dsh-plc-decode 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -1,30 +1,42 @@
1
1
  # dsh-plc-decode
2
2
 
3
+ <img src="assets/icon-180.png" width="96" align="right" alt="dsh-plc-decode">
4
+
3
5
  [中文](README.md) | **English**
4
6
 
5
- Read PLC project files directly inside [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH). The plugin detects the format from the file header, decodes the project into readable reports and structured data, and provides project diffing, address audits, element-level read/write analysis and ladder-logic reconstruction.
7
+ Read PLC project files directly inside [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH): the plugin detects the format from the file header, decodes the project into readable reports and structured data, and provides project diffing, address audits, element-level read/write analysis and ladder-logic reconstruction. The same plugin row also covers HMI projects: screens, controls, tags and addresses; for Weintek EasyBuilder Pro it reads the compiled output of the project and decodes screens, text objects, alarm events and text-library entries.
6
8
 
7
9
  **Read-only**: project files are parsed, never modified.
8
10
 
9
- ## Supported formats
11
+ ## Supported files
10
12
 
11
13
  | Header | Format | Decoder |
12
14
  |---|---|---|
13
15
  | `50 4B 03 04` (ZIP) | CoDeSys V3.5 / LeadSysStudio `.project` (incl. Leadshine) | Bundled Python script: unpack → string table → restore POU ST sources |
14
- | `57 01 01 00` | Delta WPLSoft / ISPSoft `.dvp` | Bundled Python script: structure / section comments / device comments / instruction table |
15
- | `53 48 33 00` (SH3) | Siemens S7-200 SMART `.smart` | Embedded Node decoder: blocks / instruction records / operands / user & system symbol tables |
16
+ | `57 01 01 00` | Delta WPLSoft / ISPSoft `.dvp` | Bundled Python script: file structure / section comments / device comments / instruction table |
17
+ | `53 48 33 00` (SH3) | Siemens S7-200 SMART `.smart` | Embedded Node decoder: blocks / instruction records / operands / user and system symbol tables |
16
18
  | `44 45 4D 00` (DEM) | Siemens S7-200 SMART `.smartlib` | Embedded Node decoder: library variables and comment stream |
17
19
 
18
- > Leadshine LeadSysStudio saves CoDeSys-format `.project` files, so they decode through the same path: ST sources go to `pous/<POU>.txt`, and `/codesys-check` runs an equivalent compile check (struct members, array bounds, calls, address uniqueness, undeclared symbols).
20
+ > Leadshine LeadSysStudio saves CoDeSys-format `.project` files; they decode through the same path: ST sources go to `pous/<POU>.txt`, and `/codesys-check` runs an equivalent compile check (struct members, array bounds, calls, address uniqueness, undeclared symbols).
21
+
22
+ ### HMI projects
23
+
24
+ | File | Brand | Decoded |
25
+ |---|---|---|
26
+ | `.hmismart` | Siemens WinCC flexible SMART (Smart Line) | Screens / objects / texts / devices; the sibling `{{GUID}}.data` files yield tag names, control names, binding candidates and the type table |
27
+ | `.fsprj` or a folder containing `HMI\Frame` | Flexem FStudio | Screens / controls / control addresses (from `HMI\System\fs2.s3db` and `Bin\fshmi.bin`) |
28
+ | `.nbp` | Omron NB-Designer | Screens / controls / addresses (XML) |
29
+ | `.mcp` / `.mcgs` | MCGS / LSTP Studio | Screens / tags / alarms / strategies (Access database) |
30
+ | `.emtp` / `.exob` | Weintek EasyBuilder Pro | Screens / text objects / alarm events / text library (the `.emtp` body is encrypted; the plugin reads the compiled `.exob` of the same project) |
19
31
 
20
32
  ## Install
21
33
 
22
34
  Prerequisites:
23
35
 
24
- - DSH desktop app (the plugin runs inside DSH; Node version follows DSH);
36
+ - DSH desktop app (the plugin runs inside DSH; the Node version follows DSH);
25
37
  - Python 3.9+ on `PATH` for `.project` / `.dvp` (standard library only, no `pip install`);
26
- - Python is not needed for `.smart` / `.smartlib`.
27
- - Compatible with the DSH 0.2.1 line (alpha / rc / stable); 0.3 and later are not guaranteed.
38
+ - Python is not needed for `.smart` / `.smartlib`;
39
+ - requires DSH >= 0.2.1-alpha.3; verified on 0.2.1-alpha.3 and 0.2.2-rc.1, later versions untested.
28
40
 
29
41
  ```sh
30
42
  dsh plugin --profile web add github:taoziliyouchong/dsh-plc-decode
@@ -38,48 +50,124 @@ Restart DSH afterwards. The plugin has no npm runtime dependencies.
38
50
 
39
51
  | Tool | Purpose |
40
52
  |---|---|
41
- | `plc-decode` | Unified entry: detect the four formats and dispatch; args `file`, optional `outDir` |
53
+ | `plc-decode` | Unified entry: detect the four PLC formats and dispatch; args `file`, optional `outDir` |
42
54
  | `smart-pou-structure` | Internal structure of one POU: interface parameters (L-area address + type), box-level instruction chain, call sites and arguments |
43
- | `smart-lad` | Ladder reconstruction: per block/network LAD instruction sequence (LD/A/O/AN/ON, EU/ED, LPS/LRD/LPP, coils, comparisons, instruction-box placeholders) |
55
+ | `smart-lad` | Ladder reconstruction: per block and network, the LAD instruction sequence (LD/A/O/AN/ON, EU/ED, LPS/LRD/LPP, coils, comparisons, instruction-box placeholders) |
44
56
  | `smart-ladder-elements` | Element-level read/write judgement for one address (or a batch) |
45
57
  | `smart-net-trace` | Network trace: elements, write coils, boxes and constants in offset order |
46
58
  | `smart-box-pins` | Box pin table: pin name = actual argument for library call boxes (MBUS_CTRL, MBUS_MSG, TON, CTU, MOV_*, …) |
47
- | `smart-pin-dump` | Byte-level location: all occurrences of an address, or operand records in an offset range |
48
- | `smart-var-usage` | Variable audit: all references, overlapping byte forms, write-point judgement |
49
- | `smart-free-space` | Address usage and free ranges: pick new addresses when extending a program |
59
+ | `smart-pin-dump` | Byte-level location: all occurrences of an address, or the operand records inside an offset range |
60
+ | `smart-var-usage` | Variable audit: all references, other address forms over the same bytes, write-point judgement |
61
+ | `smart-free-space` | Address usage and free ranges: pick new addresses before extending a program |
50
62
  | `smart-conflict` | Address conflicts: overlaps (real / suspected / registered only) and fragmented free space |
51
63
  | `smart-diff-project` | SMART project diff: block list, call chain, I/O references, symbol table |
52
64
  | `codesys-diff-project` | CoDeSys project diff: POU list, real logic changes, whitespace, string table, object table |
65
+ | `hmi-decode` | HMI unified entry: identifies `.hmismart` / `.fsprj` / `.nbp` / `.mcp` / `.emtp` / `.exob` and processes it |
66
+ | `hmi-diff-project` | HMI project diff for two `.hmismart` files: start screen, screen records, screen names, companion files |
67
+ | `ebpro-decode` | Weintek EasyBuilder Pro: decode screens / text objects / alarm events / text library from the compiled `.exob` |
68
+ | `ladder-auto` | Auto ladder: read a `.smart` project and render box-style text ladders per block/network (`block`, `net`) |
69
+ | `ladder-dvp` | Delta `.dvp` → text ladder, optionally limited to a line range |
70
+ | `ladder-from-stl` | Statement list (STL) → text ladder plus a mechanical explanation per network |
71
+ | `ladder-render` | Render a network description (spec JSON) into the fixed text-ladder layout |
53
72
 
54
73
  ### Slash commands
55
74
 
56
- `/plc-decode`, `/codesys-read`, `/dvp-read`, `/smart-read`, `/codesys-check`, `/codesys-diff`, `/smart-diff`, `/smart-free-space`, `/smart-conflict`, `/smart-ladder`, `/smart-lad`.
75
+ | Command | Purpose |
76
+ |---|---|
77
+ | `/plc-decode <file> [outDir]` | Unified decode entry |
78
+ | `/plc-archive` | Show the effective archive root, the default target and how to change it |
79
+ | `/codesys-read <project>` | Decode a `.project` (ST sources + report) or a `.dvp` (report) |
80
+ | `/dvp-read <project>` | Delta DVP structure and instruction-table report |
81
+ | `/smart-read <.smart/.smartlib> [outDir]` | Decode a SMART project or library |
82
+ | `/codesys-check <project>` | Decode a `.project`, then run an equivalent static compile check |
83
+ | `/codesys-diff <old> <new>` | CoDeSys project diff |
84
+ | `/smart-diff <old> <new>` | SMART project diff |
85
+ | `/smart-free-space <.smart>` | Address usage and free ranges |
86
+ | `/smart-conflict <.smart>` | Address conflict audit |
87
+ | `/smart-ladder <.smart> [address]` | Element-level read/write judgement |
88
+ | `/smart-lad <.smart> [block] [network]` | Ladder reconstruction (LAD instruction sequence) |
89
+ | `/hmi-decode <.hmismart / .fsprj / .nbp / .mcp / .emtp / .exob> [outDir]` | HMI project decode |
90
+ | `/hmi-diff <old .hmismart> <new .hmismart>` | HMI project diff |
91
+ | `/ladder on\|off\|status` | Ladder switch (off by default; takes effect immediately) |
92
+ | `/ladder-auto <.smart> [block] [net] [out.txt]` | Render a `.smart` project |
93
+ | `/ladder-dvp <.dvp> [from] [to] [out.txt]` | Render a `.dvp` project |
94
+ | `/ladder-stl <stl.txt> [out.txt]` | Statement list → ladder + explanation |
95
+ | `/ladder-spec <spec.json> [out.txt]` | Render a spec JSON |
96
+ | `/plc-calibrate <format> <bytes or cmd:XX> <name> [note]` | Record an unresolved byte/opcode in the calibration table; later decodes use the name |
57
97
 
58
98
  ## Output
59
99
 
60
- Decoded files go to `解码归档/<project folder name>/` (the literal folder name is Chinese for "decode archive"; it lives in the current workspace). Use `outDir` to override.
100
+ By default the plugin writes to `解码归档/<project folder name>/` in the **workspace** (the folder name is used rather than the file name, so same-named projects in different folders do not overwrite each other; when one folder holds several project files, `<folder>_<file>` is used). Pass `outDir` to override.
101
+
102
+ | Format | Main files |
103
+ |---|---|
104
+ | `.project` | `00-索引.md` (read this first), `pous/<POU>.txt` (ST sources), `工程内容报告.md`, `全部字符串.txt`, `对象表.md`, `项目树.md` |
105
+ | `.dvp` | `00-索引.md`, `解码报告.md` (structure / section comments / device comments / instruction table) |
106
+ | `.smart` / `.smartlib` | `00-目录.md` (read this first), `解码报告.md`, `程序.lad`, `元素记录.tsv`, `符号地址.tsv`, `分析.md`, `记录.json`, `字符串全录.txt` |
107
+ | `.hmismart` | `10-画面.tsv`, `11-元件.tsv`, `12-文本.tsv`, `13-设备.tsv`, `20-变量.data.tsv`, `21-控件.data.tsv`, `23-控件绑定.data.tsv`, `24-类型表.tsv` |
108
+ | `.fsprj` | `画面.tsv`, `控件.tsv`, `控件地址.tsv`, `变量.tsv` |
109
+ | `.nbp` / `.mcp` | `解码报告.md` plus screen/control (or tag/alarm/strategy) JSON |
110
+ | `.emtp` / `.exob` | `HMI解码/HMI解码报告.md` + `00-格式说明.md`, `10-画面.tsv`, `11-文字对象.tsv`, `12-报警事件.tsv`, `13-文字库.tsv`, `08-统计.json` |
111
+
112
+ ### Ladder rendering (off by default)
61
113
 
62
- - `.project` → `00-索引.md`, `pous/<POU>.txt`, `工程内容报告.md`, `全部字符串.txt`, `对象表.md`, `项目树.md`
63
- - `.dvp` → `00-索引.md`, `解码报告.md`
64
- - `.smart` / `.smartlib` → `00-目录.md`, `解码报告.md`, `程序.lad`, `元素记录.tsv`, `符号地址.tsv`, `分析.md`, `记录.json`, `字符串全录.txt`
114
+ Ladder tools are disabled by default so a plain decode does not add another set of tools:
65
115
 
66
- The smart decoder writes a source fingerprint (size + mtime) into the report and `记录.json`; re-check it after the project is edited.
116
+ - Turn on: `/ladder on` (immediate, no restart); off: `/ladder off`; status: `/ladder status`
117
+ - Or set `config: { ladder: true }` on this plugin's row in the profile `cordis.patch.yml` as the initial state
118
+ - While disabled, the ladder tools answer with a one-line hint; decoding is unaffected
119
+ - The first three decodes append a hint that ladder diagrams are available (1/3, 2/3, 3/3), then it stops; switch state and the counter live in `$DSH_HOME/ladder-state.json`
67
120
 
68
- ## Limitations
121
+ ### Changing the archive root (no code change)
69
122
 
70
- - HMI projects (`.hmismart`, `.fsprj`, `.nbp`, `.mcp`) are decoded by the same plugin row: screens / controls / tags / addresses, tables written to `解码归档/<project>/`. Control-to-tag references in `.hmismart` are partial (only same-segment and UUID hits); the rest is reported as "未解出".
71
- - Pin-level arguments of library call boxes (Slave / RW / Addr / Count / DataPtr) cannot be decoded; the tools say so instead of guessing.
123
+ Add `archiveDir` to this plugin's row in the profile `cordis.patch.yml` (`$DSH_HOME/profiles/<profile>/cordis.patch.yml`):
124
+
125
+ `archiveDir` is the archive **root**: a relative path resolves against the current session workspace, an absolute path is used as is; the default is `解码归档`. Restart DSH after changing it; `/plc-archive` shows the effective value, and `outDir` overrides it for a single run.
126
+
127
+ The smart `记录.json` is the input of the analysis tools (address usage, variable usage, …) and also the marker that identifies a decoded directory. The report header carries a **source fingerprint** (file size + mtime); re-check it after the project changes.
128
+
129
+ ## Known limits
130
+
131
+ - HMI projects: `.hmismart` carries only the template skeleton — real screens and controls live in the sibling `{{GUID}}.data` (ES2RT stream). Tag names and control names can be decoded; control-to-tag references are recovered only for same-segment co-occurrence and UUID hits, the rest is reported as undecoded. Without tags, a FStudio project keeps control addresses only in the action table of `Bin\fshmi.bin`. MCGS decoding needs a sample to verify against.
132
+ - Weintek EasyBuilder Pro: the `.emtp` body is compressed and encrypted, so only the compiled `.exob` of the same project can be read; the tables reflect the project **at compile time** (recompile first if the project changed). The compiled output carries only the source language, no translations. Screen membership is inferred from object-stream segments; x/y/w/h in the tables are text-box metrics, not screen coordinates.
133
+ - Pin-level arguments of library call boxes (e.g. Slave / RW / Addr / Count / DataPtr of MBUS_MSG) cannot be decoded; the tools say so instead of guessing.
72
134
  - Encrypted or specially compressed projects may fail to decode; the decoder reports an error rather than a half-true result.
73
135
  - Ladder series/parallel topology is reconstructed from instruction records (validated network-by-network against official STL exports); library call regions without standard box headers are not covered.
74
- - Inferred instruction names are marked with `?`; undecoded names keep their raw form `??xx`.
136
+ - Inferred instruction names are marked with `?`; undecoded names keep the raw form `??xx`.
75
137
 
76
138
  ## Development
77
139
 
78
140
  ```sh
79
- npm run check # syntax check
80
- npm run smoke # load the plugin and verify registrations (12 tools / 11 commands)
81
- npm run smoke -- <project> # decode one real project end-to-end
82
- npm pack --dry-run # inspect package contents
141
+ npm run check # syntax check
142
+ npm run smoke # load the plugin and verify registrations (19 tools / 20 commands)
143
+ npm run smoke -- <project> # additionally decode one real project end-to-end
144
+ npm pack --dry-run # inspect package contents (node_modules and publish/ must not be inside)
145
+ ```
146
+
147
+ ## Structure
148
+
149
+ ```
150
+ index.js plugin entry: tool and command registration, format dispatch, SMART decoder
151
+ hmi.js HMI decoding module (tools/commands/skill registration, called by index.js)
152
+ ladder.js ladder rendering module (off by default, /ladder on; called by index.js)
153
+ assets/decode-pack.mjs decoded-output writer (indexes, tables, records)
154
+ assets/smart-lad.mjs ladder reconstruction script (used by smart-lad)
155
+ assets/smart-net-trace.mjs network trace script (used by smart-net-trace)
156
+ assets/codesys-tools/ CoDeSys / DVP decoding Python scripts (standard library only)
157
+ assets/hmismart-decode.mjs Siemens .hmismart decoder (structure tables + .data names/bindings)
158
+ assets/hmismart-report.mjs .hmismart human-readable report (screens/tags/connections)
159
+ assets/hmismart-diff.mjs .hmismart project diff
160
+ assets/fstudio-tables.py FStudio screen / control / control-address tables
161
+ assets/fstudio_i18n.py FStudio element-text scan (per language slot)
162
+ assets/hmi-decode-workflow.md HMI reading workflow (skill text)
163
+ assets/nb-decode.mjs Omron NB-Designer decoder
164
+ assets/mcgs-decode.mjs MCGS / LSTP decoder
165
+ assets/ebpro-decode.mjs Weintek EasyBuilder Pro decoder (from .exob)
166
+ assets/ladder-render.mjs text-ladder renderer (used by ladder-render)
167
+ assets/stl-to-ladder.mjs STL → ladder (used by ladder-from-stl)
168
+ assets/smart-ladder-auto.mjs .smart auto renderer (used by ladder-auto)
169
+ assets/dvp-ladder.mjs .dvp auto renderer (used by ladder-dvp)
170
+ scripts/smoke.mjs smoke test
83
171
  ```
84
172
 
85
173
  ## Feedback
package/README.md CHANGED
@@ -2,166 +2,143 @@
2
2
 
3
3
  <img src="assets/icon-180.png" width="96" align="right" alt="dsh-plc-decode">
4
4
 
5
- **中文** | [English](README.en.md)
5
+ **涓枃** | [English](README.en.md)
6
6
 
7
- 在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)里直接读 PLC 工程文件:按文件头自动识别格式,把工程解成可读报告与结构化数据,再基于解码结果做新旧对比、地址体检、元素级读/写判定与连线还原。同一插件行里也承接触摸屏(HMI)工程:画面、控件、变量与地址。
8
-
9
- **只读**:解析工程文件,不改动原文件。
10
-
11
- ## 支持的工程文件
12
-
13
- | 文件头 | 格式 | 解码方式 |
7
+ 鍦?[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)锛圖SH锛夐噷鐩存帴璇?PLC 宸ョ▼鏂囦欢锛氭寜鏂囦欢澶磋嚜鍔ㄨ瘑鍒牸寮忥紝鎶婂伐绋嬭В鎴愬彲璇绘姤鍛婁笌缁撴瀯鍖栨暟鎹紝鍐嶅熀浜庤В鐮佺粨鏋滃仛鏂版棫瀵规瘮銆佸湴鍧€浣撴銆佸厓绱犵骇璇?鍐欏垽瀹氫笌杩炵嚎杩樺師銆傚悓涓€鎻掍欢琛岄噷涔熸壙鎺ヨЕ鎽稿睆锛圚MI锛夊伐绋嬶細鐢婚潰銆佹帶浠躲€佸彉閲忎笌鍦板潃锛涘▉绾堕€?EasyBuilder Pro 宸ョ▼璇诲悓宸ョ▼鐨勭紪璇戜骇鐗╋紝瑙e嚭鐢婚潰銆佹枃瀛楀璞°€佹姤璀︿簨浠朵笌鏂囧瓧搴撴潯鐩€?
8
+ **鍙**锛氳В鏋愬伐绋嬫枃浠讹紝涓嶆敼鍔ㄥ師鏂囦欢銆?
9
+ ## 鏀寔鐨勫伐绋嬫枃浠?
10
+ | 鏂囦欢澶?| 鏍煎紡 | 瑙g爜鏂瑰紡 |
14
11
  |---|---|---|
15
- | `50 4B 03 04`(ZIP) | CoDeSys V3.5 / LeadSysStudio `.project`(含雷赛) | 自带 Python 脚本:解包 → 字符串表 → 逐对象恢复 POU ST 源码 |
16
- | `57 01 01 00` | 台达 WPLSoft / ISPSoft `.dvp` | 自带 Python 脚本:文件结构 / 段落注释 / 设备注释 / 指令表反汇编 |
17
- | `53 48 33 00`(SH3) | 西门子 S7-200 SMART `.smart` 工程 | 内嵌 Node 解码器:块 / 指令记录 / 操作数 / 用户与系统符号表 |
18
- | `44 45 4D 00`(DEM) | 西门子 S7-200 SMART `.smartlib` 库 | 内嵌 Node 解码器:库变量与注释流 |
19
-
20
- > 雷赛(Leadshine)用 LeadSysStudio 保存的 `.project` 与 CoDeSys 同格式,走同一条解码链:ST 源码导出到 `pous/<POU>.txt`,可用 `/codesys-check` 做等价编译校验(结构体成员、数组下标、调用存在性、地址唯一、未声明符号)。
21
-
22
- ### 触摸屏(HMI)工程
23
-
24
- | 文件 | 品牌 | 解出 |
12
+ | `50 4B 03 04`锛圸IP锛?| CoDeSys V3.5 / LeadSysStudio `.project`锛堝惈闆疯禌锛?| 鑷甫 Python 鑴氭湰锛氳В鍖?鈫?瀛楃涓茶〃 鈫?閫愬璞℃仮澶?POU ST 婧愮爜 |
13
+ | `57 01 01 00` | 鍙拌揪 WPLSoft / ISPSoft `.dvp` | 鑷甫 Python 鑴氭湰锛氭枃浠剁粨鏋?/ 娈佃惤娉ㄩ噴 / 璁惧娉ㄩ噴 / 鎸囦护琛ㄥ弽姹囩紪 |
14
+ | `53 48 33 00`锛圫H3锛?| 瑗块棬瀛?S7-200 SMART `.smart` 宸ョ▼ | 鍐呭祵 Node 瑙g爜鍣細鍧?/ 鎸囦护璁板綍 / 鎿嶄綔鏁?/ 鐢ㄦ埛涓庣郴缁熺鍙疯〃 |
15
+ | `44 45 4D 00`锛圖EM锛?| 瑗块棬瀛?S7-200 SMART `.smartlib` 搴?| 鍐呭祵 Node 瑙g爜鍣細搴撳彉閲忎笌娉ㄩ噴娴?|
16
+
17
+ > 闆疯禌锛圠eadshine锛夌敤 LeadSysStudio 淇濆瓨鐨?`.project` 涓?CoDeSys 鍚屾牸寮忥紝璧板悓涓€鏉¤В鐮侀摼锛歋T 婧愮爜瀵煎嚭鍒?`pous/<POU>.txt`锛屽彲鐢?`/codesys-check` 鍋氱瓑浠风紪璇戞牎楠岋紙缁撴瀯浣撴垚鍛樸€佹暟缁勪笅鏍囥€佽皟鐢ㄥ瓨鍦ㄦ€с€佸湴鍧€鍞竴銆佹湭澹版槑绗﹀彿锛夈€?
18
+ ### 瑙︽懜灞忥紙HMI锛夊伐绋?
19
+ | 鏂囦欢 | 鍝佺墝 | 瑙e嚭 |
25
20
  |---|---|---|
26
- | `.hmismart` | 西门子 WinCC flexible SMART(Smart Line 屏) | 画面 / 元件 / 文本 / 设备表;旁系 `{{GUID}}.data` 里解变量名、控件名、绑定候选、类型表 |
27
- | `.fsprj` 或含 `HMI\Frame` 的目录 | 繁易 FStudio / Flexem | 画面 / 控件 / 控件地址(读 `HMI\System\fs2.s3db` 与 `Bin\fshmi.bin`) |
28
- | `.nbp` | 欧姆龙 NB-Designer | 画面 / 控件 / 地址(XML 直读) |
29
- | `.mcp` / `.mcgs` | 昆仑通态 MCGS / LSTP Studio | 画面 / 变量 / 报警 / 策略(Access 库) |
30
-
31
- ## 安装
32
-
33
- 前提:
34
-
35
- - DSH 桌面端(插件运行在 DSH 内,Node 版本跟随 DSH);
36
- - 解码 `.project` / `.dvp` 需要 Python 3.9+ 在 `PATH` 里(只用标准库,无需 pip 安装);
37
- - 解码 `.smart` / `.smartlib` 不需要 Python。
38
- - 兼容 DSH 0.2.1 系列(alpha / rc / 正式版均可);0.3 起不保证。
39
-
40
- 从 GitHub 安装:
41
-
21
+ | `.hmismart` | 瑗块棬瀛?WinCC flexible SMART锛圫mart Line 灞忥級 | 鐢婚潰 / 鍏冧欢 / 鏂囨湰 / 璁惧琛紱鏃佺郴 `{{GUID}}.data` 閲岃В鍙橀噺鍚嶃€佹帶浠跺悕銆佺粦瀹氬€欓€夈€佺被鍨嬭〃 |
22
+ | `.fsprj` 鎴栧惈 `HMI\Frame` 鐨勭洰褰?| 绻佹槗 FStudio / Flexem | 鐢婚潰 / 鎺т欢 / 鎺т欢鍦板潃锛堣 `HMI\System\fs2.s3db` 涓?`Bin\fshmi.bin`锛?|
23
+ | `.nbp` | 娆у榫?NB-Designer | 鐢婚潰 / 鎺т欢 / 鍦板潃锛圶ML 鐩磋锛?|
24
+ | `.mcp` / `.mcgs` | 鏄嗕粦閫氭€?MCGS / LSTP Studio | 鐢婚潰 / 鍙橀噺 / 鎶ヨ / 绛栫暐锛圓ccess 搴擄級 |
25
+ | `.emtp` / `.exob` | 濞佺憾閫?EasyBuilder Pro | 鐢婚潰 / 鏂囧瓧瀵硅薄 / 鎶ヨ浜嬩欢 / 鏂囧瓧搴擄紙`.emtp` 鏈綋鍔犲瘑璇讳笉鍔紝璇诲悓宸ョ▼缂栬瘧浜х墿 `.exob`锛?|
26
+
27
+ ## 瀹夎
28
+
29
+ 鍓嶆彁锛?
30
+ - DSH 妗岄潰绔紙鎻掍欢杩愯鍦?DSH 鍐咃紝Node 鐗堟湰璺熼殢 DSH锛夛紱
31
+ - 瑙g爜 `.project` / `.dvp` 闇€瑕?Python 3.9+ 鍦?`PATH` 閲岋紙鍙敤鏍囧噯搴擄紝鏃犻渶 pip 瀹夎锛夛紱
32
+ - 瑙g爜 `.smart` / `.smartlib` 涓嶉渶瑕?Python銆?- 瑕佹眰 DSH >= 0.2.1-alpha.3锛涘疄娴?0.2.1-alpha.3銆?.2.2-rc.1锛屾洿楂樼増鏈湭楠岃瘉銆?
33
+ 浠?GitHub 瀹夎锛?
42
34
  ```sh
43
35
  dsh plugin --profile web add github:taoziliyouchong/dsh-plc-decode
44
36
  ```
45
37
 
46
- 装完重启 DSH。本插件没有 npm 运行时依赖。
47
-
48
- ## 使用
38
+ 瑁呭畬閲嶅惎 DSH銆傛湰鎻掍欢娌℃湁 npm 杩愯鏃朵緷璧栥€?
39
+ ## 浣跨敤
49
40
 
50
- ### 工具(模型自动调用)
41
+ ### 宸ュ叿锛堟ā鍨嬭嚜鍔ㄨ皟鐢級
51
42
 
52
- | 工具 | 用途 |
43
+ | 宸ュ叿 | 鐢ㄩ€?|
53
44
  |---|---|
54
- | `plc-decode` | 统一入口:按文件头识别四格式并分发解码,参数 `file` + 可选 `outDir` |
55
- | `smart-pou-structure` | 某子程序的内部结构:接口参数(L 区地址 + 类型)、盒级指令链、调用点实参 |
56
- | `smart-lad` | 连线还原:按块、按网络打印 LAD 指令序列(LD/A/O/AN/ON、EU/ED、LPS/LRD/LPP、线圈、比较、指令盒占位) |
57
- | `smart-ladder-elements` | 元素级读/写判定:某地址(可一批)的每个落点是触点(读)还是写 |
58
- | `smart-net-trace` | 网络级轨迹:给偏移区间,按顺序列出触点 / 写元件 / 指令盒 / 常数 |
59
- | `smart-box-pins` | 盒级引脚表:库调用盒(MBUS_CTRL、MBUS_MSG、TON、CTU、MOV_* 等)的「引脚名 = 实参」 |
60
- | `smart-pin-dump` | 字节级定位:某地址的全部出现位置,或某偏移区间内的操作数记录 |
61
- | `smart-var-usage` | 变量使用体检:某地址的全部引用点、共用字节的其它地址形式、写入点判定 |
62
- | `smart-free-space` | 地址占用与空闲段:加功能前选新地址(有符号名的、预留坑都不动) |
63
- | `smart-conflict` | 地址冲突体检:重叠冲突(真冲突 / 疑似 / 仅登记)+ 连续空间被切碎 |
64
- | `smart-diff-project` | SMART 新旧工程对比:块清单、主程序调用链、I-O 引用、符号表差异 |
65
- | `codesys-diff-project` | CoDeSys 新旧工程对比:POU 清单、真实逻辑变化区段、空白差异、字符串表、对象表 |
66
- | `hmi-decode` | 触摸屏统一入口:按文件识别 `.hmismart` / `.fsprj` / `.nbp` / `.mcp` 并解码 |
67
- | `hmi-diff-project` | 新旧 `.hmismart` 对比:起始画面、画面表、画面名、配套文件 |
68
- | `fstudio-scan-texts` | 繁易工程元件文本扫描(按语种槽) |
69
- | `fstudio-i18n` | 繁易多语言对照表与文本库导入表 |
70
- | `fstudio-retag` | 已导出文本库表换语种列 |
71
- | `wincc-text-i18n` | WinCC 项目文本三件套(Screens / Others / Messages)翻译与回写 |
72
-
73
- ### 斜杠命令(人直接执行)
74
-
75
- | 命令 | 用途 |
45
+ | `plc-decode` | 缁熶竴鍏ュ彛锛氭寜鏂囦欢澶磋瘑鍒洓鏍煎紡骞跺垎鍙戣В鐮侊紝鍙傛暟 `file` + 鍙€?`outDir` |
46
+ | `smart-pou-structure` | 鏌愬瓙绋嬪簭鐨勫唴閮ㄧ粨鏋勶細鎺ュ彛鍙傛暟锛圠 鍖哄湴鍧€ + 绫诲瀷锛夈€佺洅绾ф寚浠ら摼銆佽皟鐢ㄧ偣瀹炲弬 |
47
+ | `smart-lad` | 杩炵嚎杩樺師锛氭寜鍧椼€佹寜缃戠粶鎵撳嵃 LAD 鎸囦护搴忓垪锛圠D/A/O/AN/ON銆丒U/ED銆丩PS/LRD/LPP銆佺嚎鍦堛€佹瘮杈冦€佹寚浠ょ洅鍗犱綅锛?|
48
+ | `smart-ladder-elements` | 鍏冪礌绾ц/鍐欏垽瀹氾細鏌愬湴鍧€锛堝彲涓€鎵癸級鐨勬瘡涓惤鐐规槸瑙︾偣锛堣锛夎繕鏄啓 |
49
+ | `smart-net-trace` | 缃戠粶绾ц建杩癸細缁欏亸绉诲尯闂达紝鎸夐『搴忓垪鍑鸿Е鐐?/ 鍐欏厓浠?/ 鎸囦护鐩?/ 甯告暟 |
50
+ | `smart-box-pins` | 鐩掔骇寮曡剼琛細搴撹皟鐢ㄧ洅锛圡BUS_CTRL銆丮BUS_MSG銆乀ON銆丆TU銆丮OV_* 绛夛級鐨勩€屽紩鑴氬悕 = 瀹炲弬銆?|
51
+ | `smart-pin-dump` | 瀛楄妭绾у畾浣嶏細鏌愬湴鍧€鐨勫叏閮ㄥ嚭鐜颁綅缃紝鎴栨煇鍋忕Щ鍖洪棿鍐呯殑鎿嶄綔鏁拌褰?|
52
+ | `smart-var-usage` | 鍙橀噺浣跨敤浣撴锛氭煇鍦板潃鐨勫叏閮ㄥ紩鐢ㄧ偣銆佸叡鐢ㄥ瓧鑺傜殑鍏跺畠鍦板潃褰㈠紡銆佸啓鍏ョ偣鍒ゅ畾 |
53
+ | `smart-free-space` | 鍦板潃鍗犵敤涓庣┖闂叉锛氬姞鍔熻兘鍓嶉€夋柊鍦板潃锛堟湁绗﹀彿鍚嶇殑銆侀鐣欏潙閮戒笉鍔級 |
54
+ | `smart-conflict` | 鍦板潃鍐茬獊浣撴锛氶噸鍙犲啿绐侊紙鐪熷啿绐?/ 鐤戜技 / 浠呯櫥璁帮級+ 杩炵画绌洪棿琚垏纰?|
55
+ | `smart-diff-project` | SMART 鏂版棫宸ョ▼瀵规瘮锛氬潡娓呭崟銆佷富绋嬪簭璋冪敤閾俱€両-O 寮曠敤銆佺鍙疯〃宸紓 |
56
+ | `codesys-diff-project` | CoDeSys 鏂版棫宸ョ▼瀵规瘮锛歅OU 娓呭崟銆佺湡瀹為€昏緫鍙樺寲鍖烘銆佺┖鐧藉樊寮傘€佸瓧绗︿覆琛ㄣ€佸璞¤〃 |
57
+ | `hmi-decode` | 瑙︽懜灞忕粺涓€鍏ュ彛锛氭寜鏂囦欢璇嗗埆 `.hmismart` / `.fsprj` / `.nbp` / `.mcp` / `.emtp` / `.exob` 骞跺鐞?|
58
+ | `hmi-diff-project` | 鏂版棫 `.hmismart` 瀵规瘮锛氳捣濮嬬敾闈€佺敾闈㈣〃銆佺敾闈㈠悕銆侀厤濂楁枃浠?|
59
+ | `ebpro-decode` | 濞佺憾閫?EBpro锛氳缂栬瘧浜х墿 `.exob` 瑙g爜鐢婚潰 / 鏂囧瓧瀵硅薄 / 鎶ヨ浜嬩欢 / 鏂囧瓧搴擄紙鍑?HMI瑙g爜鎶ュ憡.md 涓?4 寮?tsv锛?|
60
+ | `ladder-auto` | 鑷姩鐢绘褰㈠浘锛氱洿鎺ヨ `.smart`锛屾寜鍧?缃戠粶鐢熸垚鐩掑紡鏂囧瓧姊舰鍥撅紙鍙寚瀹?`block` / `net`锛?|
61
+ | `ladder-dvp` | 鍙拌揪 `.dvp` 鐩存帴鍑虹洅寮忔枃瀛楁褰㈠浘锛堝彲鎸夎鍙疯寖鍥达級 |
62
+ | `ladder-from-stl` | 璇彞琛紙STL锛夆啋 鏂囧瓧姊舰鍥?+ 鏈烘璁茶В |
63
+ | `ladder-render` | 鎶婄綉缁滄弿杩帮紙spec锛夋覆鏌撴垚鍥哄畾鐗堝紡鐨勬枃瀛楁褰㈠浘 |
64
+
65
+ ### 鏂滄潬鍛戒护锛堜汉鐩存帴鎵ц锛?
66
+ | 鍛戒护 | 鐢ㄩ€?|
76
67
  |---|---|
77
- | `/plc-decode <文件> [输出目录]` | 统一解码入口 |
78
- | `/plc-archive` | 查看当前生效的解码归档根目录、默认落点与改配置的方法 |
79
- | `/codesys-read <工程>` | 解码 `.project`(ST 源码 + 报告)或 `.dvp`(解码报告) |
80
- | `/dvp-read <工程>` | 台达 DVP 结构与指令表报告 |
81
- | `/smart-read <.smart/.smartlib> [输出目录]` | SMART 工程 / 库解码 |
82
- | `/codesys-check <工程>` | 解码 `.project` 后做等价编译静态校验(结构体 / 调用 / 地址唯一 / 未声明符号) |
83
- | `/codesys-diff <旧> <新>` | CoDeSys 新旧对比 |
84
- | `/smart-diff <旧> <新>` | SMART 新旧对比 |
85
- | `/smart-free-space <.smart>` | 地址占用与空闲段 |
86
- | `/smart-conflict <.smart>` | 地址冲突体检 |
87
- | `/smart-ladder <.smart> [地址]` | 元素级读/写判定 |
88
- | `/smart-lad <.smart> [块名] [网络号]` | 连线还原(LAD 指令序列) |
89
- | `/hmi-decode <.hmismart / .fsprj / .nbp / .mcp> [输出目录]` | 触摸屏工程解码 |
90
- | `/hmi-diff <旧 .hmismart> <新 .hmismart>` | 触摸屏新旧对比 |
91
- | `/fstudio-retag <TextLib 表> <词典> [输出]` | 文本库表换语种列 |
92
-
93
- ## 输出位置
94
-
95
- 默认写到**工作区**的 `解码归档/<工程所在文件夹名>/`(用文件夹名而不是工程文件名,避免不同文件夹里的同名工程互相覆盖;同一文件夹里有多个工程文件时用 `文件夹名_工程名`)。也可以在工具参数里用 `outDir` 指定。
96
-
97
- | 格式 | 主要产物 |
68
+ | `/plc-decode <鏂囦欢> [杈撳嚭鐩綍]` | 缁熶竴瑙g爜鍏ュ彛 |
69
+ | `/plc-archive` | 鏌ョ湅褰撳墠鐢熸晥鐨勮В鐮佸綊妗f牴鐩綍銆侀粯璁よ惤鐐逛笌鏀归厤缃殑鏂规硶 |
70
+ | `/codesys-read <宸ョ▼>` | 瑙g爜 `.project`锛圫T 婧愮爜 + 鎶ュ憡锛夋垨 `.dvp`锛堣В鐮佹姤鍛婏級 |
71
+ | `/dvp-read <宸ョ▼>` | 鍙拌揪 DVP 缁撴瀯涓庢寚浠よ〃鎶ュ憡 |
72
+ | `/smart-read <.smart/.smartlib> [杈撳嚭鐩綍]` | SMART 宸ョ▼ / 搴撹В鐮?|
73
+ | `/codesys-check <宸ョ▼>` | 瑙g爜 `.project` 鍚庡仛绛変环缂栬瘧闈欐€佹牎楠岋紙缁撴瀯浣?/ 璋冪敤 / 鍦板潃鍞竴 / 鏈0鏄庣鍙凤級 |
74
+ | `/codesys-diff <鏃? <鏂?` | CoDeSys 鏂版棫瀵规瘮 |
75
+ | `/smart-diff <鏃? <鏂?` | SMART 鏂版棫瀵规瘮 |
76
+ | `/smart-free-space <.smart>` | 鍦板潃鍗犵敤涓庣┖闂叉 |
77
+ | `/smart-conflict <.smart>` | 鍦板潃鍐茬獊浣撴 |
78
+ | `/smart-ladder <.smart> [鍦板潃]` | 鍏冪礌绾ц/鍐欏垽瀹?|
79
+ | `/smart-lad <.smart> [鍧楀悕] [缃戠粶鍙穄` | 杩炵嚎杩樺師锛圠AD 鎸囦护搴忓垪锛?|
80
+ | `/hmi-decode <.hmismart / .fsprj / .nbp / .mcp / .emtp / .exob> [杈撳嚭鐩綍]` | 瑙︽懜灞忓伐绋嬭В鐮?|
81
+ | `/hmi-diff <鏃?.hmismart> <鏂?.hmismart>` | 瑙︽懜灞忔柊鏃у姣?|
82
+ | `/ladder on\|off\|status` | 姊舰鍥惧姛鑳藉紑鍏筹紙榛樿鍏抽棴锛屽紑鍚悗绔嬪嵆鐢熸晥锛?|
83
+ | `/ladder-auto <.smart> [鍧楀悕] [缃戠粶鍙穄 [杈撳嚭.txt]` | `.smart` 鑷姩鍑烘褰㈠浘 |
84
+ | `/ladder-dvp <.dvp> [璧疯] [姝㈣] [杈撳嚭.txt]` | `.dvp` 鑷姩鍑烘褰㈠浘 |
85
+ | `/ladder-stl <璇彞琛?txt> [杈撳嚭.txt]` | 璇彞琛ㄦ垚鍥?+ 璁茶В |
86
+ | `/ladder-spec <spec.json> [杈撳嚭.txt]` | 鎸?spec 娓叉煋鏂囧瓧姊舰鍥?|
87
+ | `/plc-calibrate <鏍煎紡> <瀛楄妭鎴?cmd:XX> <鍚嶅瓧> [澶囨敞]` | 鎶婅В涓嶅嚭鐨勫瓧鑺?鍔熻兘鐮佽杩涙牎鍑嗚〃锛涗互鍚庡悓鏍峰瓧鑺傜洿鎺ュ嚭鍚嶅瓧 |
88
+
89
+ ## 杈撳嚭浣嶇疆
90
+
91
+ 榛樿鍐欏埌**宸ヤ綔鍖?*鐨?`瑙g爜褰掓。/<宸ョ▼鎵€鍦ㄦ枃浠跺す鍚?/`锛堢敤鏂囦欢澶瑰悕鑰屼笉鏄伐绋嬫枃浠跺悕锛岄伩鍏嶄笉鍚屾枃浠跺す閲岀殑鍚屽悕宸ョ▼浜掔浉瑕嗙洊锛涘悓涓€鏂囦欢澶归噷鏈夊涓伐绋嬫枃浠舵椂鐢?`鏂囦欢澶瑰悕_宸ョ▼鍚峘锛夈€備篃鍙互鍦ㄥ伐鍏峰弬鏁伴噷鐢?`outDir` 鎸囧畾銆?
92
+ | 鏍煎紡 | 涓昏浜х墿 |
98
93
  |---|---|
99
- | `.project` | `00-索引.md`(先读这份)、`pous/<POU>.txt`(ST 源码)、`工程内容报告.md`、`全部字符串.txt`、`对象表.md`、`项目树.md` |
100
- | `.dvp` | `00-索引.md`、`解码报告.md`(结构 / 段落注释 / 设备注释 / 指令表)、可选 `程序解读.md` |
101
- | `.smart` / `.smartlib` | `00-目录.md`(先读这份)、`解码报告.md`、`程序.lad`、`元素记录.tsv`、`符号地址.tsv`、`分析.md`、`记录.json`、`字符串全录.txt` |
102
- | `.hmismart` | `10-画面.tsv`、`11-元件.tsv`、`12-文本.tsv`、`13-设备.tsv`、`20-变量.data.tsv`、`21-控件.data.tsv`、`23-控件绑定.data.tsv`、`24-类型表.tsv` |
103
- | `.fsprj` | `画面.tsv`、`控件.tsv`、`控件地址.tsv`、`变量.tsv` |
104
- | `.nbp` / `.mcp` | `解码报告.md` + 画面/控件(或变量/报警/策略)JSON |
105
-
106
- ### 改归档地址(不用改代码)
107
-
108
- 在 DSH profile 的 `cordis.patch.yml`(`$DSH_HOME/profiles/<profile>/cordis.patch.yml`)末尾加这几行:
109
-
110
- ```yaml
111
- - id: dsh-plc-decode
112
- name: dsh-plc-decode
113
- config:
114
- archiveDir: D:/plc/解码归档
115
- ```
94
+ | `.project` | `00-绱㈠紩.md`锛堝厛璇昏繖浠斤級銆乣pous/<POU>.txt`锛圫T 婧愮爜锛夈€乣宸ョ▼鍐呭鎶ュ憡.md`銆乣鍏ㄩ儴瀛楃涓?txt`銆乣瀵硅薄琛?md`銆乣椤圭洰鏍?md` |
95
+ | `.dvp` | `00-绱㈠紩.md`銆乣瑙g爜鎶ュ憡.md`锛堢粨鏋?/ 娈佃惤娉ㄩ噴 / 璁惧娉ㄩ噴 / 鎸囦护琛級銆佸彲閫?`绋嬪簭瑙h.md` |
96
+ | `.smart` / `.smartlib` | `00-鐩綍.md`锛堝厛璇昏繖浠斤級銆乣瑙g爜鎶ュ憡.md`銆乣绋嬪簭.lad`銆乣鍏冪礌璁板綍.tsv`銆乣绗﹀彿鍦板潃.tsv`銆乣鍒嗘瀽.md`銆乣璁板綍.json`銆乣瀛楃涓插叏褰?txt` |
97
+ | `.hmismart` | `10-鐢婚潰.tsv`銆乣11-鍏冧欢.tsv`銆乣12-鏂囨湰.tsv`銆乣13-璁惧.tsv`銆乣20-鍙橀噺.data.tsv`銆乣21-鎺т欢.data.tsv`銆乣23-鎺т欢缁戝畾.data.tsv`銆乣24-绫诲瀷琛?tsv` |
98
+ | `.fsprj` | `鐢婚潰.tsv`銆乣鎺т欢.tsv`銆乣鎺т欢鍦板潃.tsv`銆乣鍙橀噺.tsv` |
99
+ | `.nbp` / `.mcp` | `瑙g爜鎶ュ憡.md` + 鐢婚潰/鎺т欢锛堟垨鍙橀噺/鎶ヨ/绛栫暐锛塉SON |
100
+ | `.emtp` / `.exob` | `HMI瑙g爜/HMI瑙g爜鎶ュ憡.md` + `00-鏍煎紡璇存槑.md` / `10-鐢婚潰.tsv` / `11-鏂囧瓧瀵硅薄.tsv` / `12-鎶ヨ浜嬩欢.tsv` / `13-鏂囧瓧搴?tsv` / `08-缁熻.json` |
116
101
 
117
- `archiveDir` 是归档**根目录**:相对路径按当前会话工作区解析,绝对路径原样使用;默认 `解码归档`。改完重启 dsh 生效,`/plc-archive` 可随时查看当前生效值;只想改一次就在解码时传 `outDir`。
102
+ ### 姊舰鍥撅紙榛樿鍏抽棴锛?
103
+ 姊舰鍥惧伐鍏烽粯璁や笉寮€鍚紝閬垮厤姣忔瑙g爜閮藉涓€鎵瑰伐鍏蜂笌鎻愮ず锛?
104
+ - 寮€锛歚/ladder on`锛堢珛鍗崇敓鏁堬紝涓嶇敤閲嶅惎锛夛紱鍏筹細`/ladder off`锛涚湅鐘舵€侊細`/ladder status`
105
+ - 涔熷彲浠ュ湪 profile 鐨?`cordis.patch.yml` 閲岀粰鏈彃浠惰鍐?`config: { ladder: true }` 浣滀负鍒濆鐘舵€?- 鍏抽棴鏃惰皟鐢ㄦ褰㈠浘宸ュ叿鍙洖涓€琛屽紑鍚彁绀猴紱瑙g爜浜х墿鐓у父
106
+ - 鍓嶄笁娆¤В鐮佷細鍦ㄧ粨鏋滄湯灏炬彁绀恒€岃繖涓伐绋嬪彲浠ュ嚭姊舰鍥俱€嶏紙绗?1/3銆?/3銆?/3 娆★級锛屼箣鍚庝笉鍐嶆彁绀猴紱寮€鍏充笌鎻愮ず璁℃暟璁板湪 `$DSH_HOME/ladder-state.json`
118
107
 
119
- `.smart` 的 `记录.json` 同时是各分析工具(地址占用、变量使用等)的输入,也是识别「已解码目录」的凭据;解码报告头部带**源文件指纹**(文件大小 + 修改时间),工程换版本后先核对指纹再用旧报告。
108
+ ### 鏀瑰綊妗e湴鍧€锛堜笉鐢ㄦ敼浠g爜锛?
109
+ 鍦?DSH profile 鐨?`cordis.patch.yml`锛坄$DSH_HOME/profiles/<profile>/cordis.patch.yml`锛夋湯灏剧粰鏈彃浠堕偅涓€琛屽姞 config锛堝彧鍐?`archiveDir`锛氬綊妗f牴鐩綍锛夛細
120
110
 
121
- ## 已知边界
122
111
 
123
- - 触摸屏工程:`.hmismart` 里只有模板骨架,真实画面与控件在旁系 `{{GUID}}.data`(ES2RT 序列化流),变量名与控件名能解,控件到变量的引用只解出同段共现与 UUID 命中那部分,其余标「未解出」;繁易工程若没建变量,控件地址只在 `Bin\fshmi.bin` 的动作表里;昆仑通态工程需本机有 `.mcp` 样本才能验证。
124
- - 库块调用区(如 MBUS_MSG 的 Slave / RW / Addr / Count / DataPtr)的引脚级实参解不出,工具会明确说明,不猜。
125
- - 加密或特殊压缩的工程可能解不出;解码器会报错而不是给出半真结果。
126
- - `.smart` 的串/并联拓扑由指令记录还原,已用官方导出的 STL 逐网络回归验证;库调用区(无标准盒头)不在覆盖范围内。
127
- - 指令名带 `?`(如 `?DRVI`)是推断名,报告末尾有推断对照表;`??xx` 是未定名,保持原样。
112
+ `archiveDir` 鏄綊妗?*鏍圭洰褰?*锛氱浉瀵硅矾寰勬寜褰撳墠浼氳瘽宸ヤ綔鍖鸿В鏋愶紝缁濆璺緞鍘熸牱浣跨敤锛涢粯璁?`瑙g爜褰掓。`銆傛敼瀹岄噸鍚?dsh 鐢熸晥锛宍/plc-archive` 鍙殢鏃舵煡鐪嬪綋鍓嶇敓鏁堝€硷紱鍙兂鏀逛竴娆″氨鍦ㄨВ鐮佹椂浼?`outDir`銆?
113
+ `.smart` 鐨?`璁板綍.json` 鍚屾椂鏄悇鍒嗘瀽宸ュ叿锛堝湴鍧€鍗犵敤銆佸彉閲忎娇鐢ㄧ瓑锛夌殑杈撳叆锛屼篃鏄瘑鍒€屽凡瑙g爜鐩綍銆嶇殑鍑嵁锛涜В鐮佹姤鍛婂ご閮ㄥ甫**婧愭枃浠舵寚绾?*锛堟枃浠跺ぇ灏?+ 淇敼鏃堕棿锛夛紝宸ョ▼鎹㈢増鏈悗鍏堟牳瀵规寚绾瑰啀鐢ㄦ棫鎶ュ憡銆?
114
+ ## 宸茬煡杈圭晫
128
115
 
129
- ## 开发与自检
116
+ - 瑙︽懜灞忓伐绋嬶細`.hmismart` 閲屽彧鏈夋ā鏉块鏋讹紝鐪熷疄鐢婚潰涓庢帶浠跺湪鏃佺郴 `{{GUID}}.data`锛圗S2RT 搴忓垪鍖栨祦锛夛紝鍙橀噺鍚嶄笌鎺т欢鍚嶈兘瑙o紝鎺т欢鍒板彉閲忕殑寮曠敤鍙В鍑哄悓娈靛叡鐜颁笌 UUID 鍛戒腑閭i儴鍒嗭紝鍏朵綑鏍囥€屾湭瑙e嚭銆嶏紱绻佹槗宸ョ▼鑻ユ病寤哄彉閲忥紝鎺т欢鍦板潃鍙湪 `Bin\fshmi.bin` 鐨勫姩浣滆〃閲岋紱鏄嗕粦閫氭€佸伐绋嬮渶鏈満鏈?`.mcp` 鏍锋湰鎵嶈兘楠岃瘉銆?- 濞佺憾閫?EasyBuilder Pro锛歚.emtp` 鏈綋鍘嬬缉+鍔犲瘑锛岃涓嶅嚭缁撴瀯锛屽彧鑳藉彇鍚屽伐绋嬬紪璇戜骇鐗?`.exob`锛涜〃鍙嶆槧**缂栬瘧閭d竴鍒?*鐨勫伐绋嬶紙宸ョ▼鏀硅繃娌¢噸鏂扮紪璇戝氨鍏堢紪璇戝啀璺戯級銆傜紪璇戜骇鐗╅噷鍙湁婧愯瑷€銆佹病鏈夎瘧鏂囥€傜敾闈㈠綊灞炴寜瀵硅薄娴佸垎娈垫帹瀹氾紝琛ㄩ噷鐨?x/y/w/h 鏄瓧涓插妗嗗害閲忎笉鏄敾闈㈠潗鏍囥€?- 搴撳潡璋冪敤鍖猴紙濡?MBUS_MSG 鐨?Slave / RW / Addr / Count / DataPtr锛夌殑寮曡剼绾у疄鍙傝В涓嶅嚭锛屽伐鍏蜂細鏄庣‘璇存槑锛屼笉鐚溿€?- 鍔犲瘑鎴栫壒娈婂帇缂╃殑宸ョ▼鍙兘瑙d笉鍑猴紱瑙g爜鍣ㄤ細鎶ラ敊鑰屼笉鏄粰鍑哄崐鐪熺粨鏋溿€?- `.smart` 鐨勪覆/骞惰仈鎷撴墤鐢辨寚浠よ褰曡繕鍘燂紝宸茬敤瀹樻柟瀵煎嚭鐨?STL 閫愮綉缁滃洖褰掗獙璇侊紱搴撹皟鐢ㄥ尯锛堟棤鏍囧噯鐩掑ご锛変笉鍦ㄨ鐩栬寖鍥村唴銆?- 鎸囦护鍚嶅甫 `?`锛堝 `?DRVI`锛夋槸鎺ㄦ柇鍚嶏紝鎶ュ憡鏈熬鏈夋帹鏂鐓ц〃锛沗??xx` 鏄湭瀹氬悕锛屼繚鎸佸師鏍枫€?
117
+ ## 寮€鍙戜笌鑷
130
118
 
131
119
  ```sh
132
- npm run check # 语法检查
133
- npm run smoke # 装载插件 + 核对注册面(工具 18 个 / 命令 15 个)
134
- npm run smoke -- <工程文件> # 额外对一个真实工程跑端到端解码,核对产物落盘
135
- npm pack --dry-run # 看包里内容(node_modules、publish/ 不应进包)
136
- ```
120
+ npm run check # 璇硶妫€鏌?npm run smoke # 瑁呰浇鎻掍欢 + 鏍稿娉ㄥ唽闈紙宸ュ叿 19 涓?/ 鍛戒护 20 涓級
121
+ npm run smoke -- <宸ョ▼鏂囦欢> # 棰濆瀵逛竴涓湡瀹炲伐绋嬭窇绔埌绔В鐮侊紝鏍稿浜х墿钀界洏
122
+ npm pack --dry-run # 鐪嬪寘閲屽唴瀹癸紙node_modules銆乸ublish/ 涓嶅簲杩涘寘锛?```
137
123
 
138
- ## 目录结构
124
+ ## 鐩綍缁撴瀯
139
125
 
140
126
  ```
141
- index.js 插件入口:工具与命令注册、四格式分发、SMART 解码器
142
- hmi.js 触摸屏解码模块(工具/命令/技能注册,由 index.js 调用)
143
- invariant.js 伴随插件:登记包名所有权
144
- assets/decode-pack.mjs 解码产物落盘(索引/目录/表格/记录)
145
- assets/smart-lad.mjs 连线还原脚本(由 smart-lad 工具调用)
146
- assets/smart-net-trace.mjs 网络轨迹脚本(由 smart-net-trace 工具调用)
147
- assets/codesys-tools/ CoDeSys / DVP 解码 Python 脚本(只用标准库)
148
- assets/hmismart-decode.mjs 西门子 .hmismart 解码器(结构表 + .data 名字/绑定/类型表)
149
- assets/hmismart-diff.mjs .hmismart 新旧对比
150
- assets/fstudio-tables.py 繁易画面 / 控件 / 控件地址表
151
- assets/nb-decode.mjs 欧姆龙 NB-Designer 解码器
152
- assets/mcgs-decode.mjs 昆仑通态 MCGS / LSTP 解码器
153
- scripts/smoke.mjs 冒烟测试
127
+ index.js 鎻掍欢鍏ュ彛锛氬伐鍏蜂笌鍛戒护娉ㄥ唽銆佸洓鏍煎紡鍒嗗彂銆丼MART 瑙g爜鍣?hmi.js 瑙︽懜灞忚В鐮佹ā鍧楋紙宸ュ叿/鍛戒护/鎶€鑳芥敞鍐岋紝鐢?index.js 璋冪敤锛?ladder.js 姊舰鍥炬覆鏌?鑷姩鎴愬浘妯″潡锛堥粯璁ゅ叧闂紝/ladder on 鎵撳紑锛岀敱 index.js 璋冪敤锛?assets/decode-pack.mjs 瑙g爜浜х墿钀界洏锛堢储寮?鐩綍/琛ㄦ牸/璁板綍锛?assets/smart-lad.mjs 杩炵嚎杩樺師鑴氭湰锛堢敱 smart-lad 宸ュ叿璋冪敤锛?assets/smart-net-trace.mjs 缃戠粶杞ㄨ抗鑴氭湰锛堢敱 smart-net-trace 宸ュ叿璋冪敤锛?assets/codesys-tools/ CoDeSys / DVP 瑙g爜 Python 鑴氭湰锛堝彧鐢ㄦ爣鍑嗗簱锛?assets/hmismart-decode.mjs 瑗块棬瀛?.hmismart 瑙g爜鍣紙缁撴瀯琛?+ .data 鍚嶅瓧/缁戝畾/绫诲瀷琛級
128
+ assets/hmismart-report.mjs .hmismart 浜鸿鎶ュ憡锛堢敾闈?鍙橀噺/杩炴帴/鍏冧欢鍒嗙被锛?assets/hmismart-diff.mjs .hmismart 鏂版棫瀵规瘮
129
+ assets/fstudio-tables.py 绻佹槗鐢婚潰 / 鎺т欢 / 鎺т欢鍦板潃琛?assets/fstudio_i18n.py 绻佹槗鍏冧欢鏂囨湰鎵弿锛堟寜璇鍒嗘Ы锛?assets/hmi-decode-workflow.md 瑙︽懜灞忚鍙栧伐浣滄祦锛堟妧鑳芥鏂囷級
130
+ assets/ladder-workflow.md 梯形图技能(排版规范、自动成图、交付前自检)
131
+ assets/nb-decode.mjs 娆у榫?NB-Designer 瑙g爜鍣?assets/mcgs-decode.mjs 鏄嗕粦閫氭€?MCGS / LSTP 瑙g爜鍣?assets/ebpro-decode.mjs 濞佺憾閫?EBpro 瑙g爜锛堣 .exob锛氱敾闈?/ 鏂囧瓧瀵硅薄 / 鎶ヨ浜嬩欢 / 鏂囧瓧搴擄級
132
+ assets/ladder-render.mjs 鏂囧瓧姊舰鍥炬覆鏌撳櫒锛堝浐瀹氱増寮忥紝鐢?ladder-render 璋冪敤锛?assets/stl-to-ladder.mjs 璇彞琛ㄨ浆姊舰鍥撅紙鐢?ladder-from-stl 璋冪敤锛?assets/smart-ladder-auto.mjs .smart 鑷姩鎴愬浘锛堢敱 ladder-auto 璋冪敤锛?assets/dvp-ladder.mjs .dvp 鑷姩鎴愬浘锛堢敱 ladder-dvp 璋冪敤锛?scripts/smoke.mjs 鍐掔儫娴嬭瘯
154
133
  ```
155
134
 
156
- ## 反馈
157
-
158
- 插件有问题,按这个顺序:
159
-
160
- 1. 开 Issue:https://github.com/taoziliyouchong/dsh-plc-decode/issues —— 能留痕、能搜历史,别人也可能已经遇过;
161
- 2. 急着问或不想开 Issue,QQ 号:**2171960697**(加好友请注明装的是哪个插件)。
135
+ ## 鍙嶉
162
136
 
163
- 反馈时带上:DSH 版本、插件版本、报错原文、截图。少一样多半要再问一轮。
137
+ 鎻掍欢鏈夐棶棰橈紝鎸夎繖涓『搴忥細
164
138
 
165
- ## 许可
139
+ 1. 寮€ Issue锛歨ttps://github.com/taoziliyouchong/dsh-plc-decode/issues 鈥斺€?鑳界暀鐥曘€佽兘鎼滃巻鍙诧紝鍒汉涔熷彲鑳藉凡缁忛亣杩囷紱
140
+ 2. 鎬ョ潃闂垨涓嶆兂寮€ Issue锛孮Q 鍙凤細**2171960697**锛堝姞濂藉弸璇锋敞鏄庤鐨勬槸鍝釜鎻掍欢锛夈€?
141
+ 鍙嶉鏃跺甫涓婏細DSH 鐗堟湰銆佹彃浠剁増鏈€佹姤閿欏師鏂囥€佹埅鍥俱€傚皯涓€鏍峰鍗婅鍐嶉棶涓€杞€?
142
+ ## 璁稿彲
166
143
 
167
144
  MIT