I need to control 4 pumps in relation to the rate that the level of a tank is reducing.

This could be solved with a derivative but there should be a better solution for an 8-bit humble PIC.

There is a rate variable that the user sets, 4 outputs (to the pumps) and a sensor for the current water level.

If the rate the tanks empties is small then one pump operates. If this rate increases then another pump up to four contribute to fill the tank.

Thanks
Ioannis