--- name: evolv-ot-edge-plc-integration description: Engineer OT edge connectivity and PLC interoperability for EVOLV. Use when implementing or reviewing OPC UA/Modbus and similar integrations, namespace/tag mapping, quality/timestamp semantics, retry/reconnect behavior, and deterministic command/feedback contracts at the edge. --- # EVOLV OT Edge PLC Integration ## Mission Deliver reliable, deterministic edge protocol integration between EVOLV Node-RED nodes and PLC/SCADA systems. ## Harness Execution Contract - Start from current integration topology, topic contracts, and protocol endpoints. - Define invariants before edits: - command/feedback contracts remain deterministic - reconnect/retry behavior is bounded and observable - quality/timestamp semantics are preserved end-to-end - Validate with connection-loss and recovery evidence. ## Scope - Edge/connector nodes (existing and new) - Topic mapping code in `nodes/*/src/` - Admin endpoints/config for connector behavior and credentials ## Workflow 1. Map PLC tags/NodeIds/registers to EVOLV message contracts. 2. Define write acknowledgement and feedback confirmation rules. 3. Implement reconnect/backoff/session handling. 4. Enforce quality, timestamp, and stale-value semantics. 5. Verify failover behavior and command idempotency. ## Standards - Never assume connection continuity; model transient faults explicitly. - Keep protocol mappings versioned and auditable. - Separate transport errors from process-state errors. - Ensure secure defaults align with OT/IT security skill. ## Test Expectations Cover: - disconnect/reconnect and session re-establish paths - duplicate/late/out-of-order message handling - read/write mapping correctness and unit conversion - safe behavior under degraded quality or timeout ## Deliverables Return: - integration contract map (protocol <-> topic/payload) - retry/recovery strategy and limits - changed files/tests with failure-injection evidence - operational rollout risks and mitigations Decision interview triggers: - command authority or handshake behavior changes - protocol mapping breaks requiring migration - timeout/retry strategy changes affecting availability/safety