Time-optimal control of n-tank system