Cleans up air alarm cooling, limits temp to TCMB

This commit is contained in:
mwerezak
2014-07-11 14:49:23 -04:00
parent db29d172f5
commit b23b4dd7ce
2 changed files with 8 additions and 7 deletions

View File

@@ -152,8 +152,8 @@ What are the archived variables for?
var/heat_capacity = heat_capacity()
temperature += thermal_energy/heat_capacity
if (temperature < 0)
temperature = 0
if (temperature < TCMB)
temperature = TCMB
return (temperature - old_temperature)*heat_capacity

View File

@@ -210,12 +210,13 @@
//Assume the heat is being pumped into the hull which is fixed at 20 C
//none of this is really proper thermodynamics but whatever
//heat transfer is limited by the max amount of power the heat pump can put out, which lets say is also MAX_ENERGY_CHANGE
heat_transfer = min(heat_transfer, gas.temperature/T20C*MAX_ENERGY_CHANGE)
var/energy_used = heat_transfer * T20C/gas.temperature
var/cop = gas.temperature/T20C //coefficient of performance -> power used = heat_transfer/cop
gas.add_thermal_energy(-heat_transfer)
use_power(energy_used * 1.1, ENVIRON) //heat pump inefficiencies
heat_transfer = min(heat_transfer, cop * MAX_ENERGY_CHANGE) //this ensures that we don't use more than MAX_ENERGY_CHANGE amount of power - the machine can only do so much cooling
heat_transfer = -gas.add_thermal_energy(-heat_transfer) //get the actual heat transfer
use_power(heat_transfer / cop, ENVIRON)
environment.merge(gas)