How to implement automatic alarm function for target flow switch?