Stageproject Atlas Copco — Modbus TCP Simulatie
Tijdens mijn stage bij Atlas Copco ontwikkelde ik Simulator_Chef v1, een geautomatiseerd testplatform voor Modbus TCP. Het systeem simuleert een volledige industriële PLC, schrijft testwaarden naar alle measurement points, en verifieert automatisch de correctheid van data op drie niveaus: Simulator, SBP Client en Cloud.
De volledige dataketen en verificatie-pipeline:
Translation File (JSON) → CLI Menu → Modbus Simulator → SBP Client → Cloud
Python → PyModbus → Async TCP Server/Client
Het platform valideert onder andere:
- de correctheid van geschreven vs. gelezen Modbus registerwaarden;
- expected value berekening via een volledige functieketen (scale, offset, combine, bit_cp);
- endianness verificatie (B2B, L2L, B2L, L2B) voor 32-bit registers;
- BIT_CP en B16 bit-positie logica inclusief inversie;
- unit conversies (°C→K, bar→Pa, mbar→Pa);
- cloud data doorvoer en upload rule timing via de Coiote API.
Alle testresultaten worden gestructureerd opgeslagen in CSV-rapporten en JSON-verificatiebestanden. Het systeem ondersteunt meerdere upload rule configuraties en biedt een interactief CLI-menu voor volledige configuratie zonder code-aanpassingen.
Het project is verpakt als standalone executable (Simulator_Chef.exe) via PyInstaller,
inclusief alle afhankelijkheden, SSL-certificaten en configuratiebestanden — klaar voor deployment
op elke Windows-machine zonder Python-installatie.
[13:03:14.055] [INFO] Waiting for SBP connection...
[13:03:14.083] [INFO] Triggering SBP connection refresh (SBP_CONE_SIM)...
Connection to SBP
--- (-_-) OK! let the magic begin! (-_-)---
[13:03:19.123] [INFO] Connection detected! Resuming in 4s..
_ _ _ _ _ _ _ _ _ _
(o> (o> (o> (o> (o> (o> (o> (o> (o> (o>
//\ //\ //\ //\ //\ //\ //\ //\ //\ //\
V_/_ V_/_ V_/_ V_/_ V_/_ V_/_ V_/_ V_/_ V_/_ V_/_
[13:03:23.189] [INFO] Starting background client fetch thread...
[13:03:23.189] [INFO] Loading JSON config directly: C:\Users\
Modulaire Simulatie Architectuur
Ontwerp en implementatie van een volledig modulair Modbus TCP testplatform met 15+ Python-modules: orchestrator, mapper, calculator, test runner, report generator en verificatie pipeline.
Interactief CLI Menu & Configuratie
Volledig interactief command-line menu met persistente configuratie (JSON save/load), 5 upload rule modes, VIP menu met SSH/SCP push functionaliteit naar de SBP.
Drie-Niveau Verificatie Pipeline
Automatische vergelijking op drie niveaus: SIM↔SBP (Modbus TCP), SBP↔Cloud (Coiote API), en multi-stage cloud verificatie met upload rule timing validatie.
MPCalculator: Expected Value Engine
Berekening van expected values via een volledige validatieketen: scale, offset, combine (S32/F32), bit_cp, inversie en VMP operaties (add/sub/prod/div). Simuleert exact de SBP client functieketen.
Setup & Deployment
PyInstaller packaging als standalone executable. Automatische netwerkconfiguratie, vereisten-check en guided setup — klaar voor deployment op elke Windows-machine zonder Python-installatie.
Coiote Cloud Verificatie
Automatische multi-stage cloud verificatie via de Coiote IoT API. Device ID validatie, API mode selectie (BULK/PER_MP), en geconsolideerde rapporten met per-stage tracking.
Het Operationele Eindresultaat
Het platform test alle measurement points volledig automatisch, genereert gestructureerde rapporten en valideert data-integriteit van simulator tot cloud — in één commando.
Realisatie-Stappenplan
1. Analyse & Protocol Studie
Studie van het Modbus TCP protocol, register adres ranges (Coil, Discrete Input, Input/Holding Register), datatypes (S16, U32, F32, BIT_CP, B16) en endianness varianten. Analyse van de SBP JSON-configuratie structuur.
2. Modulair Framework Ontwerp
Ontwerp van een modulaire architectuur met 15+ Python-modules: orchestrator, connection manager, MP mapper, test runner, report generator, data generator, bit logic engine en expected value calculator.
3. Simulatie & Verificatie Engine
Implementatie van de PyModbus async client/server, conflict detectie (SHARED_ADDRESS), collision handling, en een drie-niveau verificatie pipeline: SIM↔SBP, SBP↔Cloud, en multi-stage cloud verificatie.
4. CLI Menu & Automatisering
Ontwikkeling van een interactief CLI-menu met configuratie persistentie, 5 upload rule modes, SSH/SCP push functionaliteit, en volledige pipeline automatisering — van test tot cloud verificatie in één run.
5. Packaging & Documentatie
PyInstaller packaging als standalone executable met alle dependencies. Volledige technische documentatie, handover dossier en changelog. Release builder voor geautomatiseerde distributie.
6. Test Fase & Demo
Live testing met alle measurement points op echte SBP hardware. Demo-presentaties aan development engineers, iteratieve bugfixes op basis van real-world feedback (S32 combine bug, conflict detectie, latency issues). Validatie van de volledige pipeline: simulatie → verificatie → cloud.
De kracht van dit project lag in het combineren van diepgaande protocol-kennis met software engineering — resulterend in een testplatform dat alle measurement points volledig automatisch kan valideren van simulator tot cloud.
╔══════════════════════════════════════════════════════════════════════╗
║ MODBUS SIMULATOR — SETUP INFO ║
╚══════════════════════════════════════════════════════════════════════╝
REQUIRED TOOLS:
──────────────────────────────────────────────────────────────────────
1. Modbus_Simulator_v2.2.0.exe (or v1)
→ Desktop simulator with REST API + WebSocket interface
2. SBP Commissioning Tool (version ≥ 1.8)
→ For configuring the SBP device
NETWORK CONFIGURATION:
──────────────────────────────────────────────────────────────────────
The PC, Simulator, and SBP device must be on the same subnet.
If you use the default settings, set your network adapter to:
Static IP: 192.168.100.40
┌──────────────────┐ ┌─────────────────────────────┐ ┌────────────────────────┐
│ PC │ │ SIMULATOR │ │ SBP DEVICE (TCP) │
│ 192.168.100.40 │◄──►│ 192.168.100.40 : port 502 │◄──►│ 192.168.100.40 : 502 │
└──────────────────┘ └─────────────────────────────┘ └────────────────────────┘
IMPORTANT:
──────────────────────────────────────────────────────────────────────
When the register/translation file is changed in the simulator,
it must also be updated in the SBP via the Commissioning Tool.
_
(o> Dont open de Live SBP Commissioning Tool View upload measurements you kan do thes after the test run.
//\
V_/_
Press Enter to continue...
╔══════════════════════════════════════════════════════════════╗
║ MODBUS SIMULATOR — MAIN MENU ║
╚══════════════════════════════════════════════════════════════╝
──────────────────────────────────────────────────────────────
Translation File : 2026.json
Network : 192.168.100.40 : 502
Iterations : 1
Bit Mode : ALTERNATING
Report Base Dir : .../Simulator_Chef_v1/ReportSIM&SBP
──────────────────────────────────────────────────────────────
[1] Network Settings
[2] Select Translation File
[3] Test Settings
[4] Report Settings
[S] START TEST
[Q] Quit
Select [1/2/3/4/S/Q]: █
═══ TEST SETTINGS ═══
────────────────────────────────
[1] Test Iterations = 1
[2] Bit Value Mode = ALTERNATING
[3] Max Tests/Category = 180
[4] Keep Connection (min)= 400
[5] Troubleshooting Mode = OFF
[6] Fetch SBP Client Logs= ON
[7] Auto Verify SIM<>SBP= ON
[8] Skip Unknown Rules = OFF
[9] Relative Tolerance = OFF
[10] Auto Cloud Verify = ON (PER_MP)
[11] Test per Upload Mode= ALL
Edit setting [1-11/Enter]: █
────────────────────────────────
CONFIRMATION REQUIRED
Translation file : 2026.json
Device IP : 192.168.100.40
Port : 502
Send modes
Base mode : (Fast Mode Vis)
Cloud Verify : ON
Device ID : WCnxBf...NDgVPQ
Is the SBP configured with
this same register file,
IP, port and send modes?
[Y/N]: █
════════════════════════════════════════════════════════════
COIOTE CLOUD VERIFICATION — CONSOLIDATED REPORT
════════════════════════════════════════════════════════════
Source: Verify_SBPvsSIM_2026-03-16_10-25-56.json
Stages: 4
SOURCE DATA OVERVIEW (Verify_SBPvsSIM)
────────────────────────────────────────────────────────────
Total Tested: 110
SBP Matches: 109
SBP Missing: 0
SBP Mismatches: 0
Success Rate: 100.0%
STAGE 1: Short Term (0-10 min)
Timestamp: 2026-03-16_10-40-57
──────────────────────────────────────────────────
MPs checked: 109/109
Found in cloud: 109
Match: 107
Mismatch: 2
Missing: 0
Rule compliant: 11
Rule violations: 98
STAGE 3: 1 Hour Check
Timestamp: 2026-03-16_11-25-56
MPs TABLE (per-stage cloud status)
────────────────────────────────────────────────────────────────────────────────────────────────────────────
MP Expected Upload Rule @short @mid @1hour @final Final
──────────────────────────────────────────────────────────────────────────────────────────────────────────
507 11140.0 5 SEC (On Change) MATCH - - - MATCH
509 91900.0 0 SEC (On Change) MATCH - - - MATCH █
CLIENT MATCHED vs CLOUD — Short Term (0-10 min) (152 MPs)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
MP Expected SBP Cloud Upload Rule Bit Pos Sim Time SBP Time Update (UTC) Upload (CET) SBP Cloud
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
**** 1400000.0 1400000.0 1400000.0 5 SEC (On Change) - 22:27:27 2026-03-11 22:27:27 2026-03-11T21:27:27.00 2026-03-11 22:27:27 OK MATCH
**** 3200000.0 3200000.0 3200000.0 5 SEC (On Change) - 22:27:27 2026-03-11 22:27:32 2026-03-11T21:27:32.00 2026-03-11 22:27:32 OK MATCH
**** 2200000.0 2200000.0 2200000.0 5 SEC (On Change) - 22:27:27 2026-03-11 22:27:32 2026-03-11T21:27:32.00 2026-03-11 22:27:32 OK MATCH
**** 5000000.0 5000000.0 5000000.0 5 SEC (On Change) - 22:27:27 2026-03-11 22:27:32 2026-03-11T21:27:32.00 2026-03-11 22:27:32 OK MATCH