Hey PaulS
The comments explains the functionality as well. Apologies if I didn't get straight to the point. I've got a 23" display so my comments all fit in the the screen. Apologies if it's too long but it helps me understand everything as well. Will use a new line next time.
Back to the question.
I'm measuring distance by means of a ping sensor. The application is a sump that fills constantly with water. The measurement might be in percentages or values depending on the user. I've got a conversion function that already takes care of that part. You want to prevent the sump from over flowing so once it reaches a set setpoint one of the pumps switches on to start pumping the water from the sump to another location. If the 1st pump that switches on fails to pump the water away and the level increases to the second setpoint, i.e. the fail-safe setpoint then the second pump must switch on to drain the sump as this is an indication that the initial pump is blocked up or is broken.
You also want to alternate between the two pumps so as to increase the lifespan of the pumps itself and to increase the time between maintenance appointments. Let me know if it still isn't clear enough or if there are any questions.
Dirk