The electric engine cooling system, where the coolant pump and the radiator fan are driven by electric motors, admits advanced control methods to decrease auxiliary energy consumption. Recent publications show the fuel saving potential of optimal control strategies for the electric cooling system through offline simulations. These strategies often assume full knowledge of the drive cycle and compute the optimal control sequence by expensive global optimization methods. In reality, the full drive cycle is unknown during driving and global optimization not directly applicable on resource-constrained truck electronic control units. This paper reports state-of-the-art engineering achievements of exploiting vehicular onboard prediction for a limited time horizon and minimizing the auxiliary energy consumption of the electric cooling system through real-time optimization. The prediction and optimization are integrated into a model predictive controller (MPC), which is implemented on a dSPACE MicroAutoBox and tested on a truck on a public road. Systematic simulations show that the new method reduces fuel consumption of a 40-tonne truck by 0.36% and a 60-tonne truck by 0.69% in a real drive cycle compared to a base-line controller. The reductions on auxiliary fuel consumption for the 40-tonne and 60-tonne trucks are about 26% and 38%, respectively. Truck experiments validate the consistency between simulations and experiments and confirm the real-time feasibility of the MPC controller.