Skip to content

Commit

Permalink
Preliminary BWR Functionality (#1)
Browse files Browse the repository at this point in the history
* BWR functionality addition

Adds the ability to pump distilled water directly into a reactor core and get steam.
Efficiency (configurable) currently set at 2x compared to LHE 5x
Maximum output per reactor set at around 600 HU/s, based on the size of the output buffer tank.

* Update FluidList.java

* applied spotless

---------

Co-authored-by: RecursivePineapple <recursive_pineapple@proton.me>
  • Loading branch information
funions123 and RecursivePineapple authored Oct 15, 2024
1 parent bc4de91 commit 0401120
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ public class Config {
public static double MOX_EU_COEFFICIENT = 4;
public static int REACTOR_EU_MULTIPLIER = 100;
public static int FLUID_NUKE_HU_MULTIPLIER = 2;
// 1 HU converts this/160 mb of distilled water to this mb of steam
// ex: 600 HU/s converts 1200mb/s of distilled water to 192000mb/s of steam
// BWRs are limited by the size of the reactor output buffer and this value
// which currently puts maximum power at just over 600 HU/s
public static int BWR_STEAM_PER_HU_MULTIPLIER = 320;
public static int COOLANT_SPECIFIC_HEAT = 1;
public static int NAQ_COOLANT_SPECIFIC_HEAT = 8;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@

public class FluidList {

public static final String DISTILLED_WATER_NAME = "distilled_water";
public static final String COOLANT_NAME = "nh_coolant";
public static final String HOT_COOLANT_NAME = "nh_hot_coolant";
public static final String PSEUDO_LIQUID_NAQUADAH_NAME = "pseudo_liquid_naquadah";
public static final String HOT_PSEUDO_LIQUID_NAQUADAH_NAME = "hot_pseudo_liquid_naquadah";

public static final Fluid DISTILLED_WATER = new Fluid(DISTILLED_WATER_NAME);
public static final Fluid COOLANT = new Fluid(COOLANT_NAME);
public static final Fluid HOT_COOLANT = new Fluid(HOT_COOLANT_NAME);
public static final Fluid PSEUDO_LIQUID_NAQUADAH = new Fluid(PSEUDO_LIQUID_NAQUADAH_NAME);
public static final Fluid HOT_PSEUDO_LIQUID_NAQUADAH = new Fluid(HOT_PSEUDO_LIQUID_NAQUADAH_NAME);

public static void registerFluids() {
FluidRegistry.registerFluid(DISTILLED_WATER);

FluidRegistry.registerFluid(COOLANT);

HOT_COOLANT.setTemperature(273 + 200);
Expand All @@ -43,6 +46,7 @@ public static void registerContainers() {
registerCell(HOT_COOLANT, 1);
registerCell(PSEUDO_LIQUID_NAQUADAH, 2);
registerCell(HOT_PSEUDO_LIQUID_NAQUADAH, 3);
registerCell(DISTILLED_WATER, 4);
}

private static void registerCell(Fluid fluid, int metadata) {
Expand All @@ -59,6 +63,8 @@ public static void registerCoolants() {
FluidRegistry.getFluid("ic2hotcoolant"),
Config.COOLANT_SPECIFIC_HEAT);

CoolantRegistry.registerCoolant(DISTILLED_WATER, FluidRegistry.getFluid("steam"), 1);

CoolantRegistry
.registerCoolant(PSEUDO_LIQUID_NAQUADAH, HOT_PSEUDO_LIQUID_NAQUADAH, Config.NAQ_COOLANT_SPECIFIC_HEAT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public void register() {
@SubscribeEvent
public void registerIcons(TextureStitchEvent.Pre event) {
if (event.map.getTextureType() == 0) {
FluidList.DISTILLED_WATER.setIcons(
event.map.registerIcon(NuclearHorizons.MODID + ":distilled_water_still"),
event.map.registerIcon(NuclearHorizons.MODID + ":distilled_water_flow"));

FluidList.COOLANT.setIcons(
event.map.registerIcon(NuclearHorizons.MODID + ":coolant_still"),
event.map.registerIcon(NuclearHorizons.MODID + ":coolant_flow"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public class MetaCellItem extends Item {

private IIcon[] icons = new IIcon[4];
private IIcon[] icons = new IIcon[5];

public MetaCellItem() {
setUnlocalizedName("metacell");
Expand All @@ -35,6 +35,7 @@ public void registerIcons(IIconRegister register) {
icons[1] = register.registerIcon(NuclearHorizons.MODID + ":cellHotCoolant");
icons[2] = register.registerIcon(NuclearHorizons.MODID + ":cellPseudoLiquidNaquadah");
icons[3] = register.registerIcon(NuclearHorizons.MODID + ":cellHotPseudoLiquidNaquadah");
icons[4] = register.registerIcon(NuclearHorizons.MODID + ":cellDistilledWater");
}

@Override
Expand All @@ -53,6 +54,7 @@ public String getUnlocalizedName(ItemStack stack) {
case 1 -> "item.cell_hot_coolant";
case 2 -> "item.cell_pseudo_liquid_naquadah";
case 3 -> "item.cell_hot_pseudo_liquid_naquadah";
case 4 -> "item.cell_distilled_water";
default -> "item.invalid_cell";
};
}
Expand All @@ -66,6 +68,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List<String> li
case 1 -> I18n.format("item.cell_hot_coolant.tooltip");
case 2 -> I18n.format("item.cell_pseudo_liquid_naquadah.tooltip", Config.NAQ_COOLANT_SPECIFIC_HEAT);
case 3 -> I18n.format("item.cell_hot_pseudo_liquid_naquadah.tooltip");
case 4 -> I18n.format("item.cell_distilled_water");
default -> "";
});
}
Expand All @@ -76,5 +79,6 @@ public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> subItems) {
subItems.add(new ItemStack(this, 1, 1));
subItems.add(new ItemStack(this, 1, 2));
subItems.add(new ItemStack(this, 1, 3));
subItems.add(new ItemStack(this, 1, 4));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ public class TileReactorCore extends TileEntity

Coolant coolantCache;
FluidTank coolantTank = new FluidTank(10_000);
FluidTank hotCoolantTank = new FluidTank(10_000);
// change for testing distilled water->steam conversion
// since so much steam is produced per HU, you need a large output buffer to capture useful
// steam/s production
FluidTank hotCoolantTank = new FluidTank(200_000);

private ArrayList<IReactorBlock> reactorBlocks = new ArrayList<>();

Expand Down Expand Up @@ -1040,12 +1043,35 @@ public int addAirHeat(int airHeat) {
this.coolantTank.getFluidAmount(),
this.hotCoolantTank.getCapacity() - this.hotCoolantTank.getFluidAmount());

int consumedCoolant = Math.min(roundedHeat / coolantCache.specificHeatCapacity, heatableCoolant);
int consumedCoolant;
// BWR
if (this.coolantCache.cold.getName()
.equals("distilled_water")) {
consumedCoolant = Math.min(
roundedHeat / (coolantCache.specificHeatCapacity),
Math.min(
this.coolantTank.getFluidAmount(),
(this.hotCoolantTank.getCapacity() - this.hotCoolantTank.getFluidAmount())
/ Config.BWR_STEAM_PER_HU_MULTIPLIER));
}
// conventional coolants
else {
consumedCoolant = Math.min(roundedHeat / coolantCache.specificHeatCapacity, heatableCoolant);
}
this.roundedHeat -= consumedCoolant * coolantCache.specificHeatCapacity;
this.addedHeat += consumedCoolant * coolantCache.specificHeatCapacity;

this.coolantTank.drain(consumedCoolant, true);
this.hotCoolantTank.fill(new FluidStack(coolantCache.hot, consumedCoolant), true);
// for BWRs, convert distilled water to a configured amount of steam instead of the same quantity of hot
// coolant
if (this.coolantCache.cold.getName()
.equals("distilled_water")) {
this.coolantTank.drain(consumedCoolant, true);
this.hotCoolantTank
.fill(new FluidStack(coolantCache.hot, consumedCoolant * Config.BWR_STEAM_PER_HU_MULTIPLIER), true);
} else {
this.coolantTank.drain(consumedCoolant, true);
this.hotCoolantTank.fill(new FluidStack(coolantCache.hot, consumedCoolant), true);
}

return 0;
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/nuclear_horizons/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ tile.reactor_redstone_port.name=Reactor Redstone Port
tile.reactor_thermal_sensor.name=Reactor Thermal Sensor
tile.reactor_simulator.name=Reactor Simulator

tile.distilled_water.name=Distilled Water

tile.nh_coolant.name=Coolant
tile.nh_hot_coolant.name=Hot Coolant

Expand Down Expand Up @@ -48,6 +50,7 @@ item.reactorPlatingExplosive.name=Containment Reactor Plating
item.debugHeatAbsorber.name=Creative Heat Absorber
item.reactorPlatingHeatDebug.name=Creative Reactor Plating

item.cell_distilled_water.name=Distilled Water Cell
item.cell_coolant.name=Coolant Cell
item.cell_hot_coolant.name=Hot Coolant Cell
item.cell_pseudo_liquid_naquadah.name=Pseudo-Crystalline Naquadah Cell
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation": {
"frametime": 2
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation": {
"frametime": 2
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0401120

Please sign in to comment.