# Protocol Mapping Configuration UI Design ## Overview This document outlines the comprehensive UI design for configuring database-to-protocol mappings through the dashboard interface, supporting Modbus, OPC UA, and other industrial protocols. ## 🎯 Design Goals - **Intuitive**: Easy for both technical and non-technical users - **Visual**: Clear representation of database-to-protocol data flow - **Configurable**: Flexible mapping configuration without code changes - **Validated**: Real-time conflict detection and validation - **Scalable**: Support for multiple stations, pumps, and protocols - **Protocol-Agnostic**: Unified interface for Modbus, OPC UA, and other protocols ## πŸ—οΈ Architecture ### Data Flow ``` Database Sources β†’ Mapping Configuration β†’ Protocol Endpoints ↓ ↓ ↓ pump_plans.speed_hz β†’ Setpoint mapping β†’ Modbus: Holding register 40001 pumps.status_code β†’ Status mapping β†’ OPC UA: ns=2;s=Station.Pump.Status safety.flags β†’ Safety mapping β†’ Modbus: Coil register 0 flow_meters.rate β†’ Flow mapping β†’ OPC UA: ns=2;s=Station.Flow.Rate ``` ### Component Structure ```javascript ``` ## πŸ“‹ UI Components ### 1. Main Dashboard Layout ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ PROTOCOL MAPPING CONFIGURATION β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ [Protocols] [Stations] [Pumps] [Mapping View] [Templates] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### 2. Visual Protocol Mapping View #### **Layout**: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ PROTOCOL MAPPING β”‚ β”‚ PUMP LIST β”‚ β”‚ β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ # β”‚ DATA TYPE β”‚ DB SOURCE β”‚ ADDRESS β”‚ β”‚ β”‚ STATION_001 β”‚ β”‚ β”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”œβ”€ PUMP_001 β”‚ β”‚ β”‚ 0 β”‚ Setpoint β”‚ speed_hz β”‚ 40001 β”‚ β”‚ β”‚ β”œβ”€ PUMP_002 β”‚ β”‚ β”‚ 1 β”‚ Status β”‚ status_code β”‚ 40002 β”‚ β”‚ β”‚ β”œβ”€ PUMP_003 β”‚ β”‚ β”‚ 2 β”‚ Power β”‚ power_kw β”‚ 40003 β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 3 β”‚ Level β”‚ level_m β”‚ 40004 β”‚ β”‚ β”‚ STATION_002 β”‚ β”‚ β”‚ 4 β”‚ Flow β”‚ flow_m3h β”‚ 40005 β”‚ β”‚ β”‚ β”œβ”€ PUMP_004 β”‚ β”‚ β”‚ 5 β”‚ Safety β”‚ safety_flag β”‚ 40006 β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### 3. Multi-Protocol Configuration Form #### **Modal/Form Layout**: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ CONFIGURE PROTOCOL MAPPING β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Protocol: [Modbus TCP β–Ό] [OPC UA β–Ό] [Custom Protocol] β”‚ β”‚ β”‚ β”‚ Station: [STATION_001 β–Ό] Pump: [PUMP_001 β–Ό] β”‚ β”‚ β”‚ β”‚ Data Type: [Setpoint β–Ό] Protocol Address: β”‚ β”‚ β”‚ β”‚ MODBUS: [40001] (Holding Register) β”‚ β”‚ OPC UA: [ns=2;s=Station.Pump.Setpoint] β”‚ β”‚ β”‚ β”‚ Database Source: β”‚ β”‚ [●] pump_plans.suggested_speed_hz β”‚ β”‚ [ ] pumps.default_setpoint_hz β”‚ β”‚ [ ] Custom SQL: [___________________________] β”‚ β”‚ β”‚ β”‚ Data Transformation: β”‚ β”‚ [●] Direct value [ ] Scale: [Γ—10] [Γ·10] β”‚ β”‚ [ ] Offset: [+___] [ ] Clamp: [min___] [max___] β”‚ β”‚ β”‚ β”‚ Validation: βœ… No conflicts detected β”‚ β”‚ β”‚ β”‚ [SAVE MAPPING] [TEST MAPPING] [CANCEL] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### 4. Protocol-Specific Address Configuration #### **Modbus Configuration**: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ MODBUS ADDRESS CONFIGURATION β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Register Type: [● Holding β—‹ Input β—‹ Coil β—‹ Discrete] β”‚ β”‚ β”‚ β”‚ Address: [40001] β”‚ β”‚ Size: [1 register] β”‚ β”‚ Data Type: [16-bit integer] β”‚ β”‚ β”‚ β”‚ Byte Order: [Big Endian] [Little Endian] β”‚ β”‚ Word Order: [High Word First] [Low Word First] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` #### **OPC UA Configuration**: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ OPC UA NODE CONFIGURATION β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Node ID: [ns=2;s=Station.Pump.Setpoint] β”‚ β”‚ β”‚ β”‚ Namespace: [2] β”‚ β”‚ Browse Name: [Setpoint] β”‚ β”‚ Display Name: [Pump Setpoint] β”‚ β”‚ β”‚ β”‚ Data Type: [Double] [Float] [Int32] [Int16] [Boolean] β”‚ β”‚ Access Level: [CurrentRead] [CurrentWrite] [HistoryRead] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### 5. Drag & Drop Interface #### **Visual Design**: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ DATABASE β”‚ β”‚ MAPPING β”‚ β”‚ PROTOCOL β”‚ β”‚ SOURCES β”‚ β”‚ WORKSPACE β”‚ β”‚ ENDPOINTS β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ pump_plans β”‚ β”‚ β”‚ β”‚ Setpoint β”‚ β”‚ β”‚ β”‚ Modbus β”‚ β”‚ β”‚ β”‚ speed_hz │──────▢│ speed_hz │──────▢│ 40001 β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ pumps β”‚ β”‚ β”‚ β”‚ Status β”‚ β”‚ β”‚ β”‚ OPC UA β”‚ β”‚ β”‚ β”‚ status │──────▢│ status_code │──────▢│ ns=2;s=... β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ safety β”‚ β”‚ β”‚ β”‚ Safety β”‚ β”‚ β”‚ β”‚ Modbus β”‚ β”‚ β”‚ β”‚ flags │──────▢│ safety_flag │──────▢│ Coil 0 β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### 6. Real-time Preview Panel #### **Layout**: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ REAL-TIME PREVIEW β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Database Value β”‚ Transform β”‚ Protocol β”‚ Current Value β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 42.3 Hz β”‚ Γ—10 β†’ β”‚ Modbus 40001β”‚ 423 β”‚ β”‚ Running β”‚ Direct β”‚ OPC UA Node β”‚ 1 β”‚ β”‚ 15.2 kW β”‚ Direct β”‚ Modbus 40003β”‚ 15 β”‚ β”‚ 2.1 m β”‚ Γ—100 β†’ β”‚ OPC UA Node β”‚ 210 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### 7. Protocol-Specific Templates #### **Template Gallery**: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ PROTOCOL TEMPLATES β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Modbus Standard β”‚ OPC UA Standard β”‚ Custom Template β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β€’ Holding Regs β”‚ β€’ Analog Items β”‚ β€’ Import from file β”‚ β”‚ β€’ Input Regs β”‚ β€’ Digital Items β”‚ β€’ Export current β”‚ β”‚ β€’ Coils β”‚ β€’ Complex Types β”‚ β€’ Save as template β”‚ β”‚ β€’ Discrete β”‚ β€’ Methods β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ [APPLY] β”‚ [APPLY] β”‚ [CREATE] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ”§ Technical Implementation ### Data Models ```typescript interface ProtocolMapping { id: string; protocolType: 'modbus_tcp' | 'opcua' | 'custom'; stationId: string; pumpId: string; dataType: 'setpoint' | 'status' | 'power' | 'flow' | 'level' | 'safety'; protocolAddress: string; // Register address or OPC UA node dbSource: string; transformation: TransformationRule[]; // Protocol-specific properties modbusConfig?: { registerType: 'holding' | 'input' | 'coil' | 'discrete'; size: number; dataType: 'int16' | 'int32' | 'float' | 'boolean'; byteOrder: 'big_endian' | 'little_endian'; }; opcuaConfig?: { namespace: number; browseName: string; displayName: string; dataType: string; accessLevel: string[]; }; } interface TransformationRule { type: 'scale' | 'offset' | 'clamp' | 'round'; parameters: any; } ``` ### API Endpoints ``` GET /api/v1/dashboard/protocol-mappings POST /api/v1/dashboard/protocol-mappings PUT /api/v1/dashboard/protocol-mappings/{id} DELETE /api/v1/dashboard/protocol-mappings/{id} POST /api/v1/dashboard/protocol-mappings/validate POST /api/v1/dashboard/protocol-mappings/test GET /api/v1/dashboard/protocol-mappings/templates POST /api/v1/dashboard/protocol-mappings/import GET /api/v1/dashboard/protocol-mappings/export # Protocol-specific endpoints GET /api/v1/dashboard/protocol-mappings/modbus GET /api/v1/dashboard/protocol-mappings/opcua POST /api/v1/dashboard/protocol-mappings/modbus/discover POST /api/v1/dashboard/protocol-mappings/opcua/browse ``` ### Integration Points #### 1. Configuration Manager Integration ```python class ConfigurationManager: def __init__(self): self.protocol_mappings: List[ProtocolMapping] = [] def add_protocol_mapping(self, mapping: ProtocolMapping) -> bool: # Validate and add mapping pass def get_protocol_mappings(self, protocol_type: str = None, station_id: str = None, pump_id: str = None) -> List[ProtocolMapping]: # Filter mappings by protocol/station/pump pass ``` #### 2. Protocol Server Integration ```python # Modbus Server Integration class ModbusServer: def __init__(self, configuration_manager: ConfigurationManager): self.configuration_manager = configuration_manager async def _update_registers(self): modbus_mappings = self.configuration_manager.get_protocol_mappings('modbus_tcp') for mapping in modbus_mappings: value = self._get_database_value(mapping.dbSource) transformed_value = self._apply_transformations(value, mapping.transformation) self._write_register(mapping.protocolAddress, transformed_value, mapping.modbusConfig.registerType) # OPC UA Server Integration class OPCUAServer: def __init__(self, configuration_manager: ConfigurationManager): self.configuration_manager = configuration_manager async def update_nodes(self): opcua_mappings = self.configuration_manager.get_protocol_mappings('opcua') for mapping in opcua_mappings: value = self._get_database_value(mapping.dbSource) transformed_value = self._apply_transformations(value, mapping.transformation) await self._write_node(mapping.protocolAddress, transformed_value) ``` ## 🎨 Visual Design System ### Color Scheme by Protocol - **Modbus**: Blue (#2563eb) - **OPC UA**: Green (#16a34a) - **Custom Protocols**: Purple (#9333ea) - **Success**: Green (#16a34a) - **Warning**: Yellow (#d97706) - **Error**: Red (#dc2626) ### Icons - πŸ”Œ Modbus - 🌐 OPC UA - βš™οΈ Custom Protocol - βœ… Valid mapping - ⚠️ Warning - ❌ Error - πŸ”„ Active/live data - πŸ“Š Data preview ## πŸ” Validation Rules ### Protocol-Specific Validation #### Modbus Validation: - Register addresses: 0-65535 - Address ranges must not overlap - Data type compatibility with register type - Valid byte/word order combinations #### OPC UA Validation: - Valid Node ID format - Namespace exists and accessible - Data type compatibility - Access level permissions ### Cross-Protocol Validation - Database source must exist and be accessible - Transformation rules must be valid - No duplicate mappings for same data point ## πŸ“Š Performance Considerations ### Protocol-Specific Optimizations - **Modbus**: Batch register writes for efficiency - **OPC UA**: Use subscription model for frequent updates - **All**: Cache transformed values and mapping configurations ## πŸ”’ Security Considerations ### Protocol Security - **Modbus**: Validate register access permissions - **OPC UA**: Certificate-based authentication - **All**: Role-based access to mapping configuration ## πŸš€ Implementation Phases ### Phase 1: Core Protocol Mapping - Basic mapping configuration for all protocols - Protocol-specific address configuration - Real-time preview and validation - Integration with existing protocol servers ### Phase 2: Enhanced Features - Drag & drop interface - Protocol templates - Bulk operations - Advanced transformations ### Phase 3: Advanced Features - Protocol discovery and auto-configuration - Mobile responsiveness - Performance optimizations - Advanced security features ## πŸ“ Testing Strategy ### Protocol-Specific Testing - **Modbus**: Register read/write operations, address validation - **OPC UA**: Node browsing, data type conversion, security - **Cross-Protocol**: Data consistency, transformation accuracy ## πŸ“š Documentation ### Protocol-Specific Guides - Modbus Mapping Configuration Guide - OPC UA Node Configuration Guide - Custom Protocol Integration Guide --- *This document provides the comprehensive design for the Protocol Mapping UI, supporting multiple industrial protocols with a unified interface.*