Stationeers

Stationeers

Not enough ratings
Centrifuge Startup
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
241.807 KB
20 May @ 3:26pm
1 Change Note ( view )

Subscribe to download
Centrifuge Startup

Description
Starts up any centrifuge fuel mix.​

This logic code uses some maths and stuff to start up a combustion centrifuge. Export to the chip and slot it on a combustion centrifuge and it should start it up, open it up automatically when it gets full, and ramp up again. It should also be capable of attempting to restart it up should it error out.

Pin Assignments
d0 - LED Console for displaying the reagents in the centrifuge. (Optional)

If you dont want to use the LED console on d0, you can comment out lines 2 and 91. (the ones that use d0 and cd1)

Warning: I havent fixed it to not have a false start with nitrous fuel after it has finished ejecting all reagents. It will fully stress out once but after the stress event the Centrifuge would purge enough gases out to let it start up safely the next time.

Code:
#CC Startup#
alias CC db
alias cd1 d0

alias comb r15
alias Throt r14
alias Lim r13
alias PInc r12
alias PDec r11
alias str r10
alias PTar r9 #1.3 nonstressed, 0.5 stressed
alias TimerA r8
alias TimerB r7
alias dRPM r6
alias prevRPM r5
alias CCMode r4

define SLim 75 #75% stress limit
define UpdateDelay 4
move CCMode 0
move Throt 0
move Lim 0
main:
l r0 CC Error
l r3 CC Reagents
l str CC Stress
bnez r0 ejection
beqz CCMode rampup
beq CCMode 1 end
beq CCMode 2 eject
beq CCMode 3 Stressed
rampup:
l comb CC RatioVolatiles
snez comb comb
bgt str 99 Stressed
l Throt CC Throttle
l Lim CC CombustionLimiter
l r0 CC Temperature
div PInc r0 5000
mul PInc PInc 12

l r0 CC Rpm
mul PDec r0 0.0099
sub dRPM r0 prevRPM
move prevRPM r0

slt r1 str SLim
select PTar r1 1.3 0.5
sub r0 PInc PDec #Gets current rate of change projection
beqzal comb startup
bltzal dRPM startup2
blt r0 PTar increaselimit
bgt r0 PTar decreaselimit
j end
startup2:
bgt prevRPM 250 ra
startup:
move Throt 10
move TimerB 0
j end

increaselimit:
move TimerB 0
add TimerA TimerA 1
blt TimerA UpdateDelay end
brnez Throt 2
move Throt 10
move TimerA 0
add Lim Lim 10
bgtal Lim 100 increaseThrot
j end

increaseThrot:
beq Throt 100 runningmode
add Throt Throt 10
move Lim 50
j ra

decreaselimit:
move TimerA 0
add TimerB TimerB 1
blt TimerB UpdateDelay end
move TimerB 0
sub Lim Lim 10
bgez Lim end
move Lim 0
blt str 20 end
sub Throt Throt 10
j end

end:
s cd1 Setting r3
s CC Throttle Throt
s CC CombustionLimiter Lim
yield
j main

runningmode:
move CCMode 1
j end
ejection:
move CCMode 2

eject:
l r0 CC Rpm
slt r0 r0 20
s CC Open r0
move Throt 0
move Lim 0
l r0 CC Reagents
bgt r0 5 end
move CCMode 0
s CC Open 0
j end

Stressed:
move CCMode 3
move Throt 0
move Lim 0
bnez str end
move CCMode 0
j end