Control of the cooling system in heavy vehicles, with the objective to minimise energy consumption, is studied. Control actuators are electrically driven cooling fan and water pump, and the electrical generator. The problem is posed as a constrained optimal control problem with feedforward from measurable external variables. The design is based on a simplified model derived from physical principles. It is evaluated through simulations with external variables collected from measurements. The results show that significant energy savings can be obtained.