THERMODYNAMICS APPLIED TO HEAT ENGINES