Carnot heat engine

A Carnot heat engine is a theoretical engine that operates on the Carnot cycle. The basic model for this engine was developed by Nicolas Léonard Sadi Carnot in 1824. The Carnot engine model was graphically expanded by Benoît Paul Émile Clapeyron in 1834 and mathematically explored by Rudolf Clausius in 1857, work that led to the fundamental thermodynamic concept of entropy.
Every thermodynamic system exists in a particular state. A thermodynamic cycle occurs when a system is taken through a series of different states, and finally returned to its initial state. In the process of going through this cycle, the system may perform work on its surroundings, thereby acting as a heat engine.
A heat engine acts by transferring energy from a warm region to a cool region of space and, in the process, converting some of that energy to mechanical work. The cycle may also be reversed. The system may be worked upon by an external force, and in the process, it can transfer thermal energy from a cooler system to a warmer one, thereby acting as a refrigerator or heat pump rather than a heat engine.
Carnot's diagram.
In the adjacent diagram, from Carnot's 1824 work, "Reflections on the Motive Power of Fire", there are "two bodies "A" and "B", kept each at a constant temperature, that of "A" being higher than that of "B". These two bodies to which we can give, or from which we can remove the heat without causing their temperatures to vary, exercise the functions of two unlimited reservoirs of caloric. We will call the first the furnace and the second the refrigerator.” Carnot then explains how we can obtain motive power, i.e., “work”, by carrying a certain quantity of heat from body "A" to body "B".
It also acts as a cooler and hence can also act as a Refrigerator.
Modern diagram.
The previous image shows the original piston-and-cylinder diagram used by Carnot in discussing his ideal engines. The figure at right shows a block diagram of a generic heat engine, such as the Carnot engine. In the diagram, the “working body” (system), a term introduced by Clausius in 1850, can be any fluid or vapor body through which heat "Q" can be introduced or transmitted to produce work. Carnot had postulated that the fluid body could be any substance capable of expansion, such as vapor of water, vapor of alcohol, vapor of mercury, a permanent gas, or air, etc. Although, in these early years, engines came in a number of configurations, typically "Q"H was supplied by a boiler, wherein water was boiled over a furnace; "Q"C was typically supplied by a stream of cold flowing water in the form of a condenser located on a separate part of the engine. The output work, "W", represents the movement of the piston as it is used to turn a crank-arm, which in turn was typically used to power a pulley so as to lift water out of flooded salt mines. Carnot defined work as “weight lifted through a height”.
Carnot cycle.
The Carnot cycle when acting as a heat engine consists of the following steps:
Carnot's theorem.
Carnot's theorem is a formal statement of this fact: "No engine operating between two heat reservoirs can be more efficient than a Carnot engine operating between the same reservoirs."
formula_3
Explanation 
This maximum efficiency formula_4 is defined as above:
A corollary to Carnot's theorem states that: All reversible engines operating between the same heat reservoirs are equally efficient.
It is easily shown that the efficiency is maximum when the entire cyclic process is a reversible process. This means the total entropy of the net system (the entropies of the hot furnace, the "working fluid" of the Heat engine, and the cold sink) remains constant when the "working fluid" completes one cycle and returns to its original state. (In the general case, the total entropy of this combined system would increase in a general irreversible process).
Since the "working fluid" comes back to the same state after one cycle, and entropy of the system is a state function; the change in entropy of the "working fluid" system is 0. Thus, it implies that the total entropy change of the furnace and sink is zero, for the process to be reversible and the efficiency of the engine to be maximum. This derivation is carried out in the next section.
The coefficient of performance (COP) of the heat engine is the reciprocal of its efficiency.
Efficiency of real heat engines.
For a real heat engine, the total thermodynamic process is generally irreversible. The working fluid is brought back to its initial state after one cycle, and thus the change of entropy of the fluid system is 0, but the sum of the entropy changes in the hot and cold reservoir in this one cyclical process is greater than 0.
The internal energy of the fluid is also a state variable, so its total change in one cycle is 0. So the total work done by the system , is equal to the heat put into the system formula_5 minus the heat taken out formula_9.
For real engines, sections 1 and 3 of the Carnot Cycle; in which heat is absorbed by the "working fluid" from the hot reservoir, and released by it to the cold reservoir, respectively; no longer remain ideally reversible, and there is a temperature differential between the temperature of the reservoir and the temperature of the fluid while heat exchange takes place.
During heat transfer from the hot reservoir at formula_10 to the fluid, the fluid would have a slightly lower temperature than formula_10, and the process for the fluid may not necessarily remain isothermal. 
Let formula_12 be the total entropy change of the fluid in the process of intake of heat.
where the temperature of the fluid is always slightly lesser than formula_10, in this process.
So, one would get:
Similarly, at the time of heat injection from the fluid to the cold reservoir one would have, for the magnitude of total entropy change formula_14 of the fluid in the process of expelling heat:
where, during this process of transfer of heat to the cold reservoir, the temperature of the fluid is always slightly greater than formula_15.
We have only considered the magnitude of the entropy change here. Since the total change of entropy of the fluid system for the cyclic process is 0, we must have
The previous three equations combine to give:
Equations () and () combine to give
Hence,
where formula_16 is the efficiency of the real engine, and formula_4 is the efficiency of the Carnot engine working between the same two reservoirs at the temperatures formula_10 and formula_15. For the Carnot engine, the entire process is 'reversible', and Equation () is an equality.
Hence, the efficiency of the real engine is always less than the ideal Carnot engine.
Equation () signifies that the total entropy of the total system (the two reservoirs + fluid) increases for the real engine, because the entropy gain of the cold reservoir as formula_20 flows into it at the fixed temperature formula_15, is greater than the entropy loss of the hot reservoir as formula_22 leaves it at its fixed temperature formula_10. The inequality in Equation () is essentially the statement of the Clausius theorem.
According to the second theorem, "The efficiency of the Carnot engine is independent of the nature of the working substance".