Application of first and second laws of thermodynamics to turbo machines