mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge pull request #2910 from hacker-on-steroids/turbines
attempted turbine efficiency fix
This commit is contained in:
commit
a459e274f5
@ -39,9 +39,11 @@ public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase im
|
||||
public float lastRotor;
|
||||
|
||||
public double spin = 0;
|
||||
public static double ACCELERATION = 1D / 400D;
|
||||
public static double FLYWHEEL_MAX_ENERGY = 0.5e8; //aka flywheel mass
|
||||
public long maxPower = 0;
|
||||
public long lastPowerTarget = 0;
|
||||
|
||||
public long flywheel_energy = 0;
|
||||
|
||||
private AudioWrapper audio;
|
||||
private float audioDesync;
|
||||
|
||||
@ -59,7 +61,7 @@ public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase im
|
||||
|
||||
@Override
|
||||
public void writeConfig(JsonWriter writer) throws IOException {
|
||||
writer.name("INFO").value("industrial steam turbine consumes 20% of availible steam per tick");
|
||||
writer.name("INFO").value("industrial steam turbine consumes 20% of available steam per tick");
|
||||
writer.name("I:inputTankSize").value(inputTankSize);
|
||||
writer.name("I:outputTankSize").value(outputTankSize);
|
||||
writer.name("D:efficiency").value(efficiency);
|
||||
@ -80,29 +82,17 @@ public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase im
|
||||
FT_Coolable trait = tanks[0].getTankType().getTrait(FT_Coolable.class);
|
||||
double eff = trait.getEfficiency(CoolingType.TURBINE) * getEfficiency();
|
||||
int maxOps = (int) Math.ceil((tanks[0].getMaxFill() * consumptionPercent()) / trait.amountReq);
|
||||
this.lastPowerTarget = (long) (maxOps * trait.heatEnergy * eff); // theoretical max output at full blast with this type
|
||||
double fraction = (double) steamConsumed / (double) (trait.amountReq * maxOps); // % of max steam throughput currently achieved
|
||||
this.maxPower = (long) (maxOps * trait.heatEnergy * eff);
|
||||
|
||||
if(Math.abs(spin - fraction) <= ACCELERATION) {
|
||||
this.spin = fraction;
|
||||
} else if(spin < fraction) {
|
||||
this.spin += ACCELERATION;
|
||||
} else if(spin > fraction) {
|
||||
this.spin -= ACCELERATION;
|
||||
}
|
||||
this.flywheel_energy += power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServerTick() {
|
||||
if(!operational) {
|
||||
this.spin -= ACCELERATION;
|
||||
}
|
||||
|
||||
if(this.spin <= 0) {
|
||||
this.spin = 0;
|
||||
} else {
|
||||
this.powerBuffer = (long) (this.lastPowerTarget * this.spin);
|
||||
}
|
||||
this.spin = (double) flywheel_energy / FLYWHEEL_MAX_ENERGY; //because dense steams have way lower energy output, turbines running them take a lot longer to spool up
|
||||
this.lastPowerTarget = (long) (this.spin * maxPower);
|
||||
this.flywheel_energy -= this.lastPowerTarget;
|
||||
this.powerBuffer = (long) (this.lastPowerTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user