Decompressing gas whilst driving a turbine - where does the energy come from? Here's the situation: a friend is working on a civil engineering project to make some equipment to decompress liquefied natural gas before pumping to households.  I don't know what the proper term for this bit of kit is calld but I will call it the decompresser
Apparently what happens in these stations is that the gas is decompressed and because the gas cools down during expansion, it has to be heated back to something like room temperature before going on its way through the gas pipes to homes.  They do this by burning kerosene.
Now my friend says that they have designed a new decompresser that, in order to be more energy efficient, will generate electricity by decompressing the gas through a turbine.  
It is a long time since I did any related physics but the simpleton-scientist-thought-process that I have going on in my head is something like the following: -


*

*if the pressurised gas is having to do work turning the turbine, then this energy has to come from somewhere 

*thus the temperature of the resulting de-pressurized gas will be lower.  

*Because the temperature of the gas is lower, they would have to put more energy than they would have done to reheat the gas and they would not have any net energy gain.  They would have electricity but they would be burning an equivalent amount of kerosene. 


Now assuming that these civil engineers know a thing or two about thermodynamics, I readily admit that my thinking is wrong.  I would very much appreciate it if someone could put me right on whether or not they can generate electricity as well as have the gas come out at the same temperature and pressure and could they not just have used the extra kerosene to generate the same amount of electricity (ignoring the various differing efficiencies of energy conversion that are going on).
PS.
Because I am clueless as to the actual answer, I will be relying heavily on the upvoting of + comments about the answers when it comes to marking an answer as the right 1!  
 A: I don't think you have a problem with thermo. The lower pressure gas will come out at a lower temperature. However heat is pretty common and cheap in the environment, so I suspect they simply plan to use free environmental heat to reheat the gas to nearly ambient temperature.  The energy in the first place came from the compression process (work = pressure times change in volume). The compressed gas was initially hot, but this heat was likely lost during storage by conduction through its container. The PV work done on the gas is stored as both kinetic energy (moving gas molecules), and internal energy within the molecules themselves. In any case, some of this work can be recovered during re-expansion, but whenever energy is transferred via non-adiabatic processes (heat flow) potential work is lost (i.e. system entropy increased).
A: Ideal gas law:
$$ PV = n R T $$
Assuming that the depressurization is an isothermal process then $T_1 = T_2 = T$ and $P_1 V_1 = P_2 V_2$, with $1$ and $2$ denoting the quantities before and after the depressurization respectively.
Work done is given by $ W = \int P dV$. For constant temperature $ P = nRT/V$, thus
$$ W = nRT \int_{V_1}^{V_2} dV/V = nRT \, \ln(V_1/V_2) $$
As long as the system is well-insulated the work done by the gas during depressurization should drive the turbine without an appreciable drop in temperature. Of course, the devil lies in the details!
A: If I undestood the situation correctly, the gas loses temperature during the decompression (hence expansion) accordingly to the law: 
$$PV=nRT$$
it produces work hence losing energy.
then, apparently, you need to re-heat the gas at room temperature before pumping it in the gas pipes; i guess for technical reason (pumping a gas at a certaing pressure into pipes with a temperature too low can cause damages when the temperature get higher [due to insolation or stuff like that] thus incrementing the pressure inside the pipes).. in order to do that they burn kerosene.. 
so energetically speaking their balance in negative since during the decompression they lose, in the surrounding, the heat lost by the expanding gas. Then they burn stuff to reheat the same gas.. for this reason i think they are using the heat lost by the decompressing gas to generate electricity (hence energy) that they can partly use to reheat at room temperature the gas that needs to be pumped into the pipes.
Quite certainly (efficiency is a bitch..) their energy balance will be less than zero anyway, but less negative than with the less efficient decompressor..
A: It can definitely generate energy and it's a cool idea!
The basic principle of a heat engine is that it moves heat between two heat baths. The requirement is that the two heat baths have different temperatures. This is called the Carnot cycle. See the wiki article:
http://en.wikipedia.org/wiki/Carnot_cycle
The usual situation is that one heat bath is at ambient (room, say) temperature while the other is heated but it works even better the other way.
The maximum theoretical efficiency of a Carnot engine is given by:
$1 - T_C/T_H$
where $T_C$ and $T_H$ are the cold and hot temperatures, in degrees Kelvin.
Suppose you had a source of air at the temperature of boiling water. This could be from an industrial cooling process. That is 373K, a 73C increase from room temp which is around 300K, so the efficiency is about $1-300/373 = 20\%$.
Now suppose you had a source of cold air at around 73C lower than room temp (i.e. about -46C or -51F). Even though you're still working with a 73C difference in heat bath temperatures the efficiency rises to $1-227/300 = 24\%$.
The "inefficient" part of the cycle will be the movement of heat from hot to cold without the performance of work. But since that's what they wanted to do anyway, in a certain sense this is a rare example of a 100% efficient process (i.e. compared to how they used to do it).
