Install
openclaw skills install @paudyyin/codesys-toolkitAutomate CODESYS/InoProShop PLC programming �� project generation, POU export/patching, compile c...
openclaw skills install @paudyyin/codesys-toolkitCODESYS/InoProShop PLC 自动编程工具集,实现�?AI 生成代码�?PLC 工程的完整闭环�?
| 型号 | 容器类型 | 说明 |
|---|---|---|
| AM600 | Application (IEC) | 高端控制�? |
| H5U | Application (IEC) | 中端控制�? |
| AM522 | 任意 IEC 容器 | 经济型控制器 |
| TT | 任意 IEC 容器 | 文本终端 |
| 工具 | 语言 | 功能 |
|---|---|---|
env_setup.ps1 | PowerShell | 环境检测:自动发现 InoProShop.exe、Profile,缓存到 env.json |
run_script.ps1 | PowerShell | 统一启动器:杀旧进程→启动→tail日志→摘�? |
dialog_monitor.ps1 | PowerShell+C# | 对话框监控:WinEvent Hook 零轮询检测弹�? |
export_pou.py | IronPython | POU 导出:递归遍历→st/ 目录→镜像文件夹结构 |
generator_runner.py | IronPython | 工程生成:模板→创建 POU/GVL/DUT→挂�?Task→编�? |
patch_pou.py | IronPython | POU 补丁:增量更新(快照 diff)→覆写→编�? |
check_compile.py | IronPython | 编译检查:触发编译→轮询→解析错误/警告 |
list_devices.py | IronPython | 设备枚举:列出所有可用控制器型号 |
. "skills\codesys-toolkit\scripts\tools\env_setup.ps1"
# 自动检�?InoProShop.exe 路径�?Profile
# 结果写入 references\env.json
{
"exe": "C:\\InoProShop\\InoProShop.exe",
"profile": "InoProShop(V1.9.0.1)",
"skill_dir": "D:\\path\\to\\codesys-toolkit",
"workspace_dir": "D:\\path\\to\\project_workspace",
"template": "D:\\path\\to\\template.project",
"patch_target": "D:\\path\\to\\target.project",
"extra_libraries": "SysCom, 3.3.2.50 (System)"
}
.\scripts\tools\run_script.ps1 export
# �?.project 中的所�?POU/GVL/DUT 导出�?st/ 目录
# 生成 .committed.json 快照(用于后续增量补丁)
�?st/ 目录下编�?.st 文件(单文件格式:声明区+实现区合并)
.\scripts\tools\run_script.ps1 patch
# 自动检�?st/ 中变更的文件(对�?.committed.json�?# 只补丁变更的 POU,保存并编译
.\scripts\tools\run_script.ps1 check
# 触发编译,轮询等待完成,解析错误/警告�?```
### 7. 从模板生成新工程
```powershell
.\scripts\tools\run_script.ps1 generate
# 复制模板→创�?POU/GVL/DUT→挂�?Task→编�?```
## 单文�?POU 格式
所�?POU 使用单文件格式(声明�?实现区合并到一�?.st 文件):
```structured-text
FUNCTION_BLOCK FB_Motor
VAR
bStart : BOOL;
bRunning : BOOL;
END_VAR
// 实现�?IF bStart THEN
bRunning := TRUE;
ELSE
bRunning := FALSE;
END_IF
END_FUNCTION_BLOCK
| 类型 | 后缀 | 示例 |
|---|---|---|
| POU (FB/Program/Function) | .st | FB_Motor.st |
| Action | .act.st | ACT_Init.act.st |
| GVL | .st (�?VAR_GLOBAL 开�? | GVL_Config.st |
| DUT Structure | .st (�?TYPE...STRUCT 开�? | DUT_State.st |
| DUT Enum | .st (�?TYPE...ENUM 开�? | ENUM_Mode.st |
st/
├── 程序/
�? ├── P_Main.st <- Program POU
�? └── P_Main/
�? └── ACT_Init.act.st <- Action (在父 POU 同名子目�?
├── FB功能�?
�? ├── FB_Motor.st
�? └── FB_Cylinder.st
├── GVL/
�? └── GVL_Config.st
└── DUT/
└── DUT_State.st
{
"程序/P_Main.st": "a1b2c3d4e5f6...",
"FB功能�?FB_Motor.st": "f6e5d4c3b2a1..."
}
export_pou.py 导出后写�?.committed.json(基线)patch_pou.py 对比当前 MD5 vs 基线.committed.jsondialog_monitor.ps1 使用 WinEvent Hook 零轮询检�?InoProShop 弹窗�?
EVENT_OBJECT_SHOW 事件#32770 类(标准对话框)| 错误 | 原因 | 解决 |
|---|---|---|
InoProShop.exe not found | 未安装或路径未检�? | 运行 env_setup.ps1 |
IEC container not found | 工程结构异常 | 检�?.project 文件 |
workspace_dir 未设置 | env.json 配置缺失 | 手动编辑 env.json |
ObjectNameNotUniqueExceptionEx | POU 名称冲突 | 删除 st/ 中的重复文件 |
所有日志写�?<workspace_dir>/log/ 目录�?
export_pou_log.txtpatch_pou_log.txtcheck_compile_log.txtgenerator_runner_log.txtlist_devices_log.txtunicode()、codecs.open() �?Python 2 语法-NoKill 可跳过)本工具集基于美的集团智能装备研究�?CODESYS 自动编程项目,由李冉(Li Ran)开发,尹德斌(Paudy)整合为独立 skill�?
原始仓库:https://git.midea.com/DEP-IMRC/IIET/auto/auto-rd-group/2026/mra0626c15-plc/skills/codesys-auto-programmer