Make heat generator not lose energy when below ambient temperature, and use the Carnot Engine equations for efficiency.

This commit is contained in:
Ben Spiers 2014-12-22 20:10:01 +00:00
parent 8a4aaff44a
commit 3544addf20

View file

@ -405,9 +405,14 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu
@Override
public double[] simulateHeat()
{
double workDone = getTemp()*thermalEfficiency;
transferHeatTo(-workDone);
setEnergy(getEnergy() + workDone);
if(getTemp() > 0)
{
double carnotEfficiency = getTemp() / (getTemp() + IHeatTransfer.AMBIENT_TEMP);
double heatLost = thermalEfficiency * getTemp();
double workDone = heatLost * carnotEfficiency;
transferHeatTo(-heatLost);
setEnergy(getEnergy() + workDone);
}
return HeatUtils.simulate(this, Coord4D.get(this), worldObj);
}