Text this: Real-Time Resonance Detection and Active Damping in Energy Recovery Railways Applications