Text this: Development of a nonlinear predictive control algorithm and its application to flotation