Consider a system that takes excess air (assume it to be an ideal gas, $Cp = \frac{7}{2} R$) from a power plant stack at $370 \rm K$ (typo in figure) and $2$ bar and compresses it to 20 bar adiabatically and reversibly. Since the air will heat as it compresses, we can send the outlet to a Carnot engine, and produce enough work to power the compressor by rejecting the heat to the water below a frozen at $273 \rm K$. The temperature of the expelled air is $275 \rm K$ We still have compressed air at $20$ bar coming out of the Carnot engine to use elsewhere! Free energy.
This cannot be possible. So, which law is being violated in this system?
Since the compressor is adiabatic and reversible, we know that $Q = 0 \implies \Delta S= 0$. From the adiabatic relations, we know that the temperature in the outlet of the compressor is $714.36 \rm K$. The work done by the compressor is a flow work given by $$\int V \rm d P = \frac{\gamma}{\gamma - 1} RT_1 \Bigg(\Big(\frac{P_2}{P_1} ^{\frac{\gamma -1}{\gamma}} -1\Big)\Bigg) = 4097.89 J$$
Onto the Carnot engine. We know that $T_{hot} = 614.36 \rm K$ and $T_{cold} = 275 \rm K$. Using the theorem of Clausius for a Carnot engine, $\frac{Q_{hot}}{T_{hot}} + \frac{Q_{cold}}{T_{cold}} = 0$.
We know that $Q_{cold} = C_p\Delta T = 12784.9 J$.
Plugging this value into the theorem of Clausius, $Q_{hot} = 33451.9 J$.
Using $Q_{hot} = Q_{cold} + W_{C}$, we get the work done by the system is $20667.9J$.
Hence, the reversible adiabatic compressor is getting more work done on it and it is doing less work than it is getting. So this violates the first law, right? Does it also violate the second law?
Any advice would be appreciated.