Automatic control of cleaning processes