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:

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\
Modbus Simulatie Workflow
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.

Simulator Chef Hoofdmenu
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.

Verificatie Report
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.

Upload Rule Mode Selectie
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 Info en Netwerk Configuratie
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
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.

Simulator Chef Workflow

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.

Simulator_Chef CLI — Hoofdmenu
                        
╔══════════════════════════════════════════════════════════════════════╗
║                   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
═══ 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]: █
Bevestiging
────────────────────────────────
 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]:
Verificatie Report Output
════════════════════════════════════════════════════════════ 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
PyModbus Modbus TCP Python 3.11 Coiote API CSV/JSON
Workflow: Van Config tot Cloud Verificatie
Simulator Chef Workflow Diagram
JSON Config Async I/O TCP/IP SSL/TLS REST API

Gebruikte Technologieën

De volledige tech stack die tijdens dit stageproject is ingezet

Modbus TCP TCP/IP REST API SSL/TLS SSH/SCP Python 3.11 PyModbus AsyncIO PyInstaller Coiote IoT DM JSON/CSV WebSocket CLI Design Protocol Debugging Git