Safe operation of a furnace using model-predictive control