# hil **Repository Path**: imzack/hil ## Basic Information - **Project Name**: hil - **Description**: 凡猫hil模拟器。主要是模仿dspace,NI 工具链来进行开发。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-19 - **Last Updated**: 2026-02-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # HIL Workspace (ControlDesk + Plant Model + AutomationDesk) 这个仓库是一个完整的 HIL(Hardware-in-the-Loop)测试工作空间,包含控制端、3D 被测对象可视化、以及自动化测试工作台。 ## 核心模块 ### 1) HIL ControlDesk 路径:`apps/controldesk` - Python + PyQt5 桌面控制台 - 管理信号、场景、故障注入 - 对外提供 WebSocket/XIL 能力(依赖运行模式) ### 2) Plant Model 路径:`apps/plant_model` - Electron + React + Three.js - 3D 车辆与仪表可视化 - 与 HIL 状态实时联动 ### 3) AutomationDesk 路径:`apps/automationdesk` - Electron + React + TypeScript - Campaign Tree(后端驱动)+ 拓扑/列表视图 - XIL 脚本编辑与运行 - 场景描述转 XIL(本地规则 + Kimi 2.5) - 在设置页配置 Kimi Token(中国区 API) - 点击“生成脚本”可调用 AI 生成 XIL - 结果会做 XIL 语法规范化和校验,失败自动回退本地规则 --- ## 目录结构 ```text /Users/zyzhao/worksuite/hil/ ├── apps/ │ ├── controldesk/ # HIL 控制中心(Python) │ ├── plant_model/ # 3D 仪表盘(Electron + React) │ └── automationdesk/ # 自动化测试工作台(Electron + React) ├── core/ │ └── hil_core/ # HIL 核心模型/调度 ├── services/ │ └── xil_server/ # XIL 服务 ├── shared/ │ └── communication/ # 协议和信号 SSOT(signals.yaml) ├── scripts/ │ ├── sh/ # macOS/Linux 启动脚本 │ └── windows/ # Windows 启动脚本 ├── docs/ └── assets/ ``` --- ## 环境要求 - Python 3.9+ - Node.js 18+ - npm 9+ --- ## 快速启动 ### 方式 A:一键启动(推荐) macOS/Linux: ```bash ./scripts/sh/start_all.sh ``` Windows: ```bat scripts\windows\start_all.bat ``` ### 方式 B:按模块启动 #### 1. ControlDesk ```bash cd apps/controldesk pip install -r requirements.txt PYTHONPATH=../../core:../.. python3 main.py ``` #### 2. Plant Model macOS/Linux: ```bash cd apps/plant_model npm install npm run electron:dev ``` Windows: ```bat cd apps\plant_model npm install npm run electron:dev:win ``` #### 3. AutomationDesk ```bash cd apps/automationdesk npm install npm run dev ``` --- ## AutomationDesk:Kimi 2.5 场景转 XIL 1. 打开左侧设置页(齿轮) 2. 在 **AI** 分组填入 `Kimi 2.5 API Token(中国区)` 3. 在“场景描述”输入测试场景 4. 点击“生成脚本” 当前接入的中国区 API 端点: - `https://api.moonshot.cn/v1/chat/completions` 说明: - Electron 环境下通过主进程代理调用 API,避免浏览器侧跨域问题。 - 生成结果会进行 XIL 语法校验,仅允许 `init/start/stop/set/get/wait/load_experiment`。 --- ## 常用脚本 ### 根目录脚本 - `scripts/sh/start_all.sh` - `scripts/sh/start_hil.sh` - `scripts/sh/start_dashboard.sh` - `scripts/sh/start_automationdesk.sh` - `scripts/sh/start_xil.sh` - `scripts/windows/start_all.bat` - `scripts/windows/start_controldesk.bat` - `scripts/windows/start_automationdesk.bat` ### AutomationDesk(apps/automationdesk) - `npm run dev` - `npm run build` - `npm run test:phase1-smoke` - `npm run test:phase2-smoke` - `npm run test:phase3-smoke` --- ## 端口说明(默认) - Plant Model 状态通道:`ws://127.0.0.1:8765` - XIL 通道:`ws://127.0.0.1:8790` - AutomationDesk dev server:`http://localhost:5173` --- ## 文档导航 - 快速开始:`docs/getting-started/quickstart.md` - ControlDesk:`apps/controldesk/README.md` - Plant Model:`apps/plant_model/README.md` - 脚本接口:`docs/user-manual/scripting-api.md` - Campaign API(前端契约草案):`apps/automationdesk/docs/campaign-tree.openapi.yaml` --- ## 贡献约定 - `shared/communication/signals.yaml` 是信号命名唯一事实源(SSOT)。 - 新增信号或字段时,需要同步更新上下游映射与文档。 ## License MIT