This is an automated archive made by the Lemmit Bot.
The original was posted on /r/stationeers by /u/DemonicTemptation on 2023-09-24 22:39:26.
Hi! New to MIPS, and could use some advice. This is my first attempt at making a code from scratch but have experience with edits. The basic concept is to create a hysteresis between 279k and 297k
The purpose of the code is to turn a condenser (d1) off when the temperature dips below 279K (R0) to prevent freezing, then turn it back on when the temperature reaches 297K (R1). Right now however it just turns on the condenser and doesn’t stop till the water freezes in the pipes.
alias pipetemp d0 #Pipe Analyzer
alias cond d1 #Condenser
alias lowt r0 #Low temp Limit
alias hight r1 #High temp limit
alias curt r2 #Current temperature
define r0 279
define r1 297
Main:
l curt pipetemp Temperature # read analyzer and write to current temperature
sle r3 lowt curt # If at or below low temp, output 1 to R3,otherwise 0
s cond On r3 # Set Condenser value 1/0, on/off
beqz r3 Temptoolow # If R3 = 0, jump to branch Temptoolow
yield
j Main # Otherwise, return to main
Temptoolow:
sgt r3 curt hight # If current temp is >= high temp, set r3 to 1
s cond On r3 # Set Condenser value 1/0, on/off
beqz r3 Temptoolow # If temp still too low (0 value), return to temptoolow
yield
j Main # If temp good, return to main branch
Further details: This connects to my base cooling system (venus) and gives my cooling an extra boost while keeping water in other parts at a stable temperature and filtering impurity out of water. Thanks for the help!
Edit:
Corrected code to (comments on changes):
alias pipetemp d0
alias cond d1
alias lowt r0
alias hight r1
alias curt r2
define lowt 279 # (defined alias not r1/r2)
define hight 297
Main:
l curt pipetemp Temperature
sle r3 lowt curt
s cond On r3
bnez r3 Temptoolow #changed bqez to bnez
yield
j Main
Temptoolow:
sgt r3 curt hight
seqz r3 r3 #invert 1 to 0
s cond On r3
beqz r3 Temptoolow
yield
j Main
After the changes the condenser turns off in my pipe-to-liquid system before the liquid gets too cold, then turns back on again once the liquid has warmed up again.
Thanks for all the answers and help~ Upvotes all around and a great testament to this game’s awesome community!