stationeers_ic10/heating_cooling.ic10

87 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

alias GasSensor d0
2021-11-10 16:29:01 +00:00
# d1= Logic Switch, Dial variant (Max=30)
alias Thermostat d1
2022-11-18 14:34:10 +00:00
# d2 = Console, LED Display variant, optional
alias TempDisplay d2
# d3 = Wall Cooler
alias WallCooler d3
2021-11-10 16:29:01 +00:00
alias CurrentTemp r0
alias TargetTemp r1
2022-11-18 14:34:10 +00:00
alias MinTemp r2
alias MaxTemp r3
alias CoolingActive r4
alias HeatingActive r5
alias Cooler r6
2023-04-01 14:48:01 +00:00
define HEATER 24258244
define TEMPCONVERT 273.15
2022-11-18 14:34:10 +00:00
define VARIANCE 2
l Cooler WallCooler PrefabHash
start:
yield
# establish min- and max-temps to registry
l TargetTemp Thermostat Setting
2022-11-18 14:34:10 +00:00
sub MinTemp TargetTemp VARIANCE
add MaxTemp TargetTemp VARIANCE
2021-11-15 13:32:10 +00:00
# get current temperature
jal temp_read
2021-11-10 16:29:01 +00:00
# update display
2022-10-23 11:05:50 +00:00
bdseal TempDisplay display
2021-11-10 16:29:01 +00:00
# compare current temp to max/min temp and
# initiate cooling or heating if needed
bgt CurrentTemp MaxTemp cooling
blt CurrentTemp MinTemp heating
j start
temp_read:
l CurrentTemp GasSensor Temperature
sub CurrentTemp CurrentTemp TEMPCONVERT
j ra
2021-11-10 16:29:01 +00:00
display:
s TempDisplay Setting CurrentTemp
2021-11-10 16:29:01 +00:00
j ra
2021-11-10 16:29:01 +00:00
cooling:
2021-11-10 17:52:25 +00:00
yield
jal temp_read
# test if coolers need to be on or not
sgt CoolingActive CurrentTemp TargetTemp
2022-10-23 11:05:50 +00:00
# update display
bdseal TempDisplay display
2021-11-10 16:29:01 +00:00
# send state to coolers
sb Cooler On CoolingActive
bgtz CoolingActive cooling
2023-04-01 14:48:01 +00:00
# Turn off wall-coolers when done
sb Cooler On CoolingActive
j start
heating:
2021-11-10 17:52:25 +00:00
yield
jal temp_read
# test if heaters need to be on or not
slt HeatingActive CurrentTemp TargetTemp
2022-10-23 11:05:50 +00:00
# update display
bdseal TempDisplay display
2021-11-10 16:29:01 +00:00
# send state to heaters
2023-04-01 14:48:01 +00:00
sb HEATER On HeatingActive
bgtz HeatingActive heating
2023-04-01 14:48:01 +00:00
# Turn off wall-heaters when done
sb HEATER On HeatingActive
j start