- Enhanced OPC UA server with realistic pump simulation
- Enhanced Modbus server with simulated industrial data
- Updated SCADA API endpoints to query actual protocol servers
- Added realistic signal data based on actual stations and pumps
- Improved SCADA configuration with real device mapping
- Enhanced OPC UA server with node caching and performance monitoring
- Optimized Modbus TCP server with connection pooling and industrial features
- Enhanced REST API with OpenAPI documentation, response caching, and compression
- Protocol-specific security enhancements and performance optimizations
- Added comprehensive performance monitoring across all protocols
- Created 23 unit tests for protocol enhancements
- All 220 tests passing (100% success rate)
- Updated documentation and implementation plan
Features implemented:
- NodeCache for OPC UA server with TTL and LRU eviction
- ConnectionPool for Modbus TCP server with connection limits
- ResponseCache for REST API with configurable TTL
- Performance monitoring with get_protocol_performance_status()
- Enhanced security integration across all protocols
- OpenAPI documentation with security schemes
- Compression middleware for REST API
- Rate limiting and access control for Modbus
- Comprehensive error handling and resource management
- Fixed dictionary iteration bugs in both OPC UA and Modbus servers
- Fixed enum vs string parameter mismatches in audit logging
- Fixed parameter naming issues (details -> event_data)
- Removed invalid defer_start parameter from Modbus server
- Implemented proper task cancellation for Modbus server stop
- Both servers now start and stop successfully
- All 197 tests passing
Co-authored-by: openhands <openhands@all-hands.dev>
- Enhanced OPC UA Server with certificate-based authentication, RBAC, and security event logging
- Enhanced Modbus TCP Server with IP-based access control, rate limiting, and security monitoring
- Completed REST API security integration with setpoint write operations and security status endpoint
- Created comprehensive protocol security integration tests (8/8 tests passing)
- All 197 tests passing across the entire codebase
Security Features Implemented:
- OPC UA: Certificate authentication, client tracking, RBAC node access control
- Modbus TCP: IP filtering, rate limiting, security monitoring, security registers
- REST API: Setpoint write operations with authorization, security status endpoint
- Cross-protocol: Shared security manager and audit logger integration
## Summary
This commit completes Phase 3 of the Calejo Control Adapter by implementing:
### New Components:
1. **SetpointManager** - Core component that calculates setpoints from optimization plans with safety integration
2. **Setpoint Calculators** - Three calculator types for different control strategies:
- DirectSpeedCalculator (direct speed control)
- LevelControlledCalculator (level-based control with feedback)
- PowerControlledCalculator (power-based control with feedback)
3. **Multi-Protocol Servers** - Three protocol interfaces for SCADA systems:
- REST API Server (FastAPI with emergency stop endpoints)
- OPC UA Server (asyncua-based OPC UA interface)
- Modbus TCP Server (pymodbus-based Modbus interface)
### Integration:
- **Safety Framework Integration** - SetpointManager integrates with all safety components
- **Main Application** - Updated main application with all Phase 3 components
- **Comprehensive Testing** - 15 new unit tests for SetpointManager and calculators
### Key Features:
- **Safety Priority Hierarchy**: Emergency stop > Failsafe mode > Normal operation
- **Multi-Channel Protocol Support**: REST, OPC UA, and Modbus simultaneously
- **Real-Time Setpoint Updates**: Background tasks update protocol interfaces every 5 seconds
- **Comprehensive Error Handling**: Graceful degradation and fallback mechanisms
### Test Status:
- **110 unit tests passing** (100% success rate)
- **15 new Phase 3 tests** covering all new components
- **All safety framework tests** still passing
### Architecture:
The Phase 3 implementation provides the complete control loop:
1. **Input**: Optimization plans from Calejo Optimize
2. **Processing**: Setpoint calculation with safety enforcement
3. **Output**: Multi-protocol exposure to SCADA systems
4. **Safety**: Multi-layer protection with emergency stop and failsafe modes
**Status**: ✅ **COMPLETED AND READY FOR PRODUCTION**
Co-authored-by: openhands <openhands@all-hands.dev>