From ed5b10e750db90779121a58638919ed1c219c098 Mon Sep 17 00:00:00 2001 From: LordME <58342752+TheLordME@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:18:46 +0200 Subject: [PATCH 1/3] Makes TEG Circulator bidirectional --- .../components/binary_devices/circulator.dm | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index 0ff8e57082fc..ecd51de0c523 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -34,28 +34,34 @@ /obj/machinery/atmospherics/component/binary/circulator/Initialize(mapload) . = ..() - desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]." air1.volume = 400 + air2.volume = 400 /obj/machinery/atmospherics/component/binary/circulator/proc/return_transfer_air() var/datum/gas_mixture/removed if(anchored && !(machine_stat & BROKEN) && network1) - var/input_starting_pressure = air1.return_pressure() - var/output_starting_pressure = air2.return_pressure() - last_pressure_delta = max(input_starting_pressure - output_starting_pressure - 5, 0) + var/datum/gas_mixture/input_air + var/datum/gas_mixture/output_air + if(air1.return_pressure() > air2.return_pressure()) + input_air = air1 + output_air = air2 + else + input_air = air2 + output_air = air1 + last_pressure_delta = max(input_air.return_pressure() - output_air.return_pressure(), 0) //only circulate air if there is a pressure difference (plus 5kPa kinetic, 10kPa static friction) - if(air1.temperature > 0 && last_pressure_delta > 5) + if(input_air.temperature > 0 && last_pressure_delta > 5) //Calculate necessary moles to transfer using PV = nRT - recent_moles_transferred = (last_pressure_delta*network1.volume/(air1.temperature * R_IDEAL_GAS_EQUATION))/3 //uses the volume of the whole network, not just itself - volume_capacity_used = min( (last_pressure_delta*network1.volume/3)/(input_starting_pressure*air1.volume) , 1) //how much of the gas in the input air volume is consumed + recent_moles_transferred = (last_pressure_delta*network1.volume/(input_air.temperature * R_IDEAL_GAS_EQUATION))/3 //uses the volume of the whole network, not just itself + volume_capacity_used = min( (last_pressure_delta*network1.volume/3)/(input_air.return_pressure()*input_air.volume) , 1) //how much of the gas in the input air volume is consumed //Calculate energy generated from kinetic turbine - stored_energy += 1/ADIABATIC_EXPONENT * min(last_pressure_delta * network1.volume , input_starting_pressure*air1.volume) * (1 - volume_ratio**ADIABATIC_EXPONENT) * kinetic_efficiency + stored_energy += 1/ADIABATIC_EXPONENT * min(last_pressure_delta * network1.volume , input_air.return_pressure()*input_air.volume) * (1 - volume_ratio**ADIABATIC_EXPONENT) * kinetic_efficiency //Actually transfer the gas - removed = air1.remove(recent_moles_transferred) + removed = input_air.remove(recent_moles_transferred) if(removed) last_heat_capacity = removed.heat_capacity() last_temperature = removed.temperature From b73f6aef1106e8ff3089f8f9cf2f9e654334ba60 Mon Sep 17 00:00:00 2001 From: LordME <58342752+TheLordME@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:43:13 +0200 Subject: [PATCH 2/3] update pressure_delta calc --- .../machinery/components/binary_devices/circulator.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index ecd51de0c523..6d4c9155e9e8 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -48,10 +48,10 @@ else input_air = air2 output_air = air1 - last_pressure_delta = max(input_air.return_pressure() - output_air.return_pressure(), 0) + last_pressure_delta = max(input_air.return_pressure() - output_air.return_pressure() - 5, 0) //only circulate air if there is a pressure difference (plus 5kPa kinetic, 10kPa static friction) - if(input_air.temperature > 0 && last_pressure_delta > 5) + if(input_air.temperature > 0 && last_pressure_delta > 10) //Calculate necessary moles to transfer using PV = nRT recent_moles_transferred = (last_pressure_delta*network1.volume/(input_air.temperature * R_IDEAL_GAS_EQUATION))/3 //uses the volume of the whole network, not just itself From 426cbd2bb90572a075f74d95902748b13014cf91 Mon Sep 17 00:00:00 2001 From: LordME <58342752+TheLordME@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:43:39 +0200 Subject: [PATCH 3/3] update TEG default powerrating --- code/modules/power/generator.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 30b91be24149..a356364c5055 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -10,7 +10,7 @@ GLOBAL_LIST_EMPTY(all_turbines) use_power = USE_POWER_IDLE idle_power_usage = 100 //Watts, I hope. Just enough to do the computer and display things. - var/max_power = 500000 + var/max_power = 5 MEGAWATTS var/thermal_efficiency = 0.65 var/obj/machinery/atmospherics/component/binary/circulator/circ1