How do you manage error handling and recovery states in PLC-based control logic for Kpi Solutions deployments?