mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-21 03:56:47 +01:00
Reagent cooled atmo machines (#18178)
* reagent based cooling for heaters and coolers * UI and wiki * some adjustments and fixes coolant tanks lol * adds coolant tank to cargo --------- Co-authored-by: C.L. <killer65311@gmail.com>
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
//TODO: Put this under a common parent type with heaters to cut down on the copypasta
|
||||
#define FREEZER_PERF_MULT 2.5
|
||||
#define REAGENT_COOLING_CONSUMED 0.1
|
||||
#define REAGENT_COOLING_MINMOD 0.15
|
||||
#define REAGENT_COOLING_MAXMOD 5
|
||||
|
||||
/obj/machinery/atmospherics/unary/freezer
|
||||
name = "gas cooling system"
|
||||
desc = "Cools gas when connected to pipe network"
|
||||
desc = "Cools gas when connected to pipe network. Can be filled by hose with coolant to increase efficiency."
|
||||
icon = 'icons/obj/Cryogenic2_vr.dmi'
|
||||
icon_state = "freezer_0"
|
||||
density = TRUE
|
||||
@@ -20,10 +23,14 @@
|
||||
|
||||
var/set_temperature = T20C // Thermostat
|
||||
var/cooling = 0
|
||||
var/reagent_cooling = 0
|
||||
|
||||
/obj/machinery/atmospherics/unary/freezer/Initialize(mapload)
|
||||
. = ..()
|
||||
default_apply_parts()
|
||||
create_reagents(120)
|
||||
AddComponent(/datum/component/hose_connector/input)
|
||||
AddComponent(/datum/component/hose_connector/output)
|
||||
|
||||
/obj/machinery/atmospherics/unary/freezer/atmos_init()
|
||||
if(node)
|
||||
@@ -75,6 +82,10 @@
|
||||
data["targetGasTemperature"] = round(set_temperature)
|
||||
data["powerSetting"] = power_setting
|
||||
|
||||
data["reagentVolume"] = reagents.total_volume
|
||||
data["reagentMaximum"] = reagents.maximum_volume
|
||||
data["reagentPower"] = reagent_cooling
|
||||
|
||||
var/temp_class = "good"
|
||||
if(air_contents.temperature > (T0C - 20))
|
||||
temp_class = "bad"
|
||||
@@ -108,6 +119,7 @@
|
||||
/obj/machinery/atmospherics/unary/freezer/process()
|
||||
..()
|
||||
|
||||
reagent_cooling = 1 + (reagents.machine_cooling_power(reagents) / reagents.maximum_volume)
|
||||
if(stat & (NOPOWER|BROKEN) || !use_power)
|
||||
cooling = 0
|
||||
update_icon()
|
||||
@@ -123,6 +135,10 @@
|
||||
var/cop = FREEZER_PERF_MULT * air_contents.temperature/heatsink_temperature //heatpump coefficient of performance from thermodynamics -> power used = heat_transfer/cop
|
||||
heat_transfer = min(heat_transfer, cop * power_rating) //limit heat transfer by available power
|
||||
|
||||
// Process coolant
|
||||
heat_transfer *= CLAMP(reagent_cooling,REAGENT_COOLING_MINMOD,REAGENT_COOLING_MAXMOD)
|
||||
reagents.remove_any(REAGENT_COOLING_CONSUMED)
|
||||
|
||||
var/removed = -air_contents.add_thermal_energy(-heat_transfer) //remove the heat
|
||||
if(debug)
|
||||
visible_message("[src]: Removing [removed] W.")
|
||||
@@ -174,4 +190,7 @@
|
||||
if(panel_open)
|
||||
. += "The maintenance hatch is open."
|
||||
|
||||
#undef REAGENT_COOLING_MINMOD
|
||||
#undef REAGENT_COOLING_MAXMOD
|
||||
#undef REAGENT_COOLING_CONSUMED
|
||||
#undef FREEZER_PERF_MULT
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
//TODO: Put this under a common parent type with freezers to cut down on the copypasta
|
||||
#define HEATER_PERF_MULT 2.5
|
||||
#define REAGENT_COOLING_CONSUMED 0.1
|
||||
#define REAGENT_COOLING_MINMOD 0.15
|
||||
#define REAGENT_COOLING_MAXMOD 5
|
||||
|
||||
/obj/machinery/atmospherics/unary/heater
|
||||
name = "gas heating system"
|
||||
desc = "Heats gas when connected to a pipe network"
|
||||
desc = "Heats gas when connected to a pipe network. Can be filled by hose with coolant to increase efficiency."
|
||||
icon = 'icons/obj/Cryogenic2_vr.dmi'
|
||||
icon_state = "heater_0"
|
||||
density = TRUE
|
||||
@@ -14,16 +17,21 @@
|
||||
|
||||
var/max_temperature = T20C + 680
|
||||
var/internal_volume = 600 //L
|
||||
var/heating_efficiency = 1
|
||||
|
||||
var/max_power_rating = 20000 //power rating when the usage is turned up to 100
|
||||
var/power_setting = 100
|
||||
|
||||
var/set_temperature = T20C //thermostat
|
||||
var/heating = 0 //mainly for icon updates
|
||||
var/reagent_cooling = 0
|
||||
|
||||
/obj/machinery/atmospherics/unary/heater/Initialize(mapload)
|
||||
. = ..()
|
||||
default_apply_parts()
|
||||
create_reagents(120)
|
||||
AddComponent(/datum/component/hose_connector/input)
|
||||
AddComponent(/datum/component/hose_connector/output)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heater/atmos_init()
|
||||
if(node)
|
||||
@@ -58,15 +66,19 @@
|
||||
/obj/machinery/atmospherics/unary/heater/process()
|
||||
..()
|
||||
|
||||
reagent_cooling = 1 + (reagents.machine_cooling_power(reagents) / reagents.maximum_volume)
|
||||
if(stat & (NOPOWER|BROKEN) || !use_power)
|
||||
heating = 0
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(network && air_contents.total_moles && air_contents.temperature < set_temperature)
|
||||
air_contents.add_thermal_energy(power_rating * HEATER_PERF_MULT)
|
||||
air_contents.add_thermal_energy(power_rating * CLAMP(reagent_cooling,REAGENT_COOLING_MINMOD,REAGENT_COOLING_MAXMOD) * HEATER_PERF_MULT * heating_efficiency)
|
||||
use_power(power_rating)
|
||||
|
||||
// Process coolant
|
||||
reagents.remove_any(REAGENT_COOLING_CONSUMED)
|
||||
|
||||
heating = 1
|
||||
network.update = 1
|
||||
else
|
||||
@@ -97,6 +109,10 @@
|
||||
data["targetGasTemperature"] = round(set_temperature)
|
||||
data["powerSetting"] = power_setting
|
||||
|
||||
data["reagentVolume"] = reagents.total_volume
|
||||
data["reagentMaximum"] = reagents.maximum_volume
|
||||
data["reagentPower"] = reagent_cooling
|
||||
|
||||
var/temp_class = "average"
|
||||
if(air_contents.temperature > (T20C+40))
|
||||
temp_class = "bad"
|
||||
@@ -130,16 +146,21 @@
|
||||
..()
|
||||
var/cap_rating = 0
|
||||
var/bin_rating = 0
|
||||
var/laser_rating = 0
|
||||
|
||||
for(var/obj/item/stock_parts/P in component_parts)
|
||||
if(istype(P, /obj/item/stock_parts/capacitor))
|
||||
cap_rating += P.rating
|
||||
if(istype(P, /obj/item/stock_parts/matter_bin))
|
||||
bin_rating += P.rating
|
||||
if(istype(P, /obj/item/stock_parts/micro_laser))
|
||||
laser_rating += (P.rating * 0.25)
|
||||
|
||||
|
||||
max_power_rating = initial(max_power_rating) * cap_rating / 2
|
||||
max_temperature = max(initial(max_temperature) - T20C, 0) * ((bin_rating * 4 + cap_rating) / 5) + T20C
|
||||
air_contents.volume = max(initial(internal_volume) - 200, 0) + 200 * bin_rating
|
||||
heating_efficiency = max(initial(heating_efficiency), (laser_rating-1))
|
||||
set_power_level(power_setting)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heater/proc/set_power_level(var/new_power_setting)
|
||||
@@ -161,4 +182,7 @@
|
||||
if(panel_open)
|
||||
. += "The maintenance hatch is open."
|
||||
|
||||
#undef REAGENT_COOLING_MINMOD
|
||||
#undef REAGENT_COOLING_MAXMOD
|
||||
#undef REAGENT_COOLING_CONSUMED
|
||||
#undef HEATER_PERF_MULT
|
||||
|
||||
Reference in New Issue
Block a user