From eb36a2d9470cd73f41f36259e639e26efbaaf6b2 Mon Sep 17 00:00:00 2001 From: Jonas Bengtsson Date: Sun, 4 Oct 2026 14:15:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/tasks.json | 104 ++++++++++++++++++++++++++++++++++++++++++ config/pump_node.yaml | 19 ++++---- 2 files changed, 113 insertions(+), 10 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5a92f35..edf2036 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1202,6 +1202,110 @@ ], "isBackground": false, "problemMatcher": [] + }, + { + "label": "wago-sim: pytest dnd", + "type": "shell", + "command": ".venv\\Scripts\\python.exe", + "args": [ + "-m", + "pytest", + "tests", + "-q", + "--tb=short" + ], + "isBackground": false, + "problemMatcher": [] + }, + { + "label": "wago-sim: serve dnd", + "type": "shell", + "command": ".venv\\Scripts\\python.exe", + "args": [ + "-m", + "wago_sim.cli", + "serve", + "--node", + "config/pump_node.yaml", + "--host", + "127.0.0.1", + "--port", + "5020", + "--web-port", + "8088" + ], + "isBackground": true, + "problemMatcher": [] + }, + { + "label": "kill ports dnd", + "type": "shell", + "command": ".venv\\Scripts\\python.exe", + "args": [ + "-c", + "import subprocess; subprocess.run(['powershell','-NoProfile','-Command','Get-NetTCPConnection -LocalPort 5020,8088 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object { Stop-Process -Id $_ -Force }'], capture_output=True); print('killed')" + ], + "isBackground": false, + "problemMatcher": [] + }, + { + "label": "wago-sim: serve dnd2", + "type": "shell", + "command": ".venv\\Scripts\\python.exe", + "args": [ + "-m", + "wago_sim.cli", + "serve", + "--node", + "config/pump_node.yaml", + "--host", + "127.0.0.1", + "--port", + "5020", + "--web-port", + "8088" + ], + "isBackground": true, + "problemMatcher": [] + }, + { + "label": "wago-sim: pytest dnd final", + "type": "shell", + "command": ".venv\\Scripts\\python.exe", + "args": [ + "-m", + "pytest", + "tests", + "-q", + "--tb=short" + ], + "isBackground": false, + "problemMatcher": [] + }, + { + "label": "stop dnd serve", + "type": "shell", + "command": ".venv\\Scripts\\python.exe", + "args": [ + "-c", + "import subprocess; subprocess.run(['powershell','-NoProfile','-Command','Get-NetTCPConnection -LocalPort 5020,8088 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object { Stop-Process -Id $_ -Force }'], capture_output=True); print('stopped')" + ], + "isBackground": false, + "problemMatcher": [] + }, + { + "label": "wago-sim: pytest spec-only", + "type": "shell", + "command": ".venv\\Scripts\\python.exe", + "args": [ + "-m", + "pytest", + "tests", + "-q", + "--tb=short" + ], + "isBackground": false, + "problemMatcher": [] } ] } \ No newline at end of file diff --git a/config/pump_node.yaml b/config/pump_node.yaml index 7e2444e..7231ee0 100644 --- a/config/pump_node.yaml +++ b/config/pump_node.yaml @@ -1,19 +1,18 @@ -# Virtual WAGO node configuration — saved from the web UI (SAVE CONFIG) +# Virtual WAGO node configuration — pump station FAT bench # Simulated device: WAGO 750-362 Modbus TCP coupler -# Edit by hand or via the UI; comments are not preserved on UI saves. -name: pump_node +# I/O codes number modules per type (DI0, DO0, AI0, AO0 — FR-4.3.11 v1.5) +name: pump_station_node coupler: 750-362 modules: - - "750-1405" # 16-channel DI 24VDC - - "750-430" # 8-channel DI 24VDC - - "750-530" # 8-channel DO 24VDC - - "750-1516" # 16-channel DO 24VDC - - "750-467" # 2-channel AI 4-20mA - - "750-554" # 2-channel AO 4-20mA + - "750-430" # 8-channel digital input 24VDC + - "750-1405" # 16-channel digital input 24VDC + - "750-530" # 8-channel digital output 24VDC + - "750-1516" # 16-channel digital output 24VDC + - "750-467" # 2-channel analog input 4-20mA + - "750-554" # 2-channel analog output 4-20mA # Application names for module channels (I/O code -> name) channel_names: AO0.0: speed_setpoint DI0.0: start_button - DI1.0: test