Real-time control of combined water quantity and quality in open channels by