Describe the principles underlying the operation of internal combustion engines. Discuss the thermodynamic cycles (such as Otto and Diesel cycles) involved in converting chemical energy into mechanical work. Explain how factors like compression ratio, air-fuel mixture, and ignition timing influence engine performance and efficiency.