Improved with short-circuit evaluation
This commit is contained in:
parent
ce235261d0
commit
422b525caf
140
filtration.ic10
140
filtration.ic10
@ -9,21 +9,20 @@
|
||||
alias filtration db
|
||||
alias diode d0 # Optional
|
||||
|
||||
alias filterLeft r0
|
||||
alias filterRight r1
|
||||
alias filterMin r2
|
||||
alias filterMax r3
|
||||
alias filterRemain r4
|
||||
alias filterLight r5
|
||||
alias filterHash r6
|
||||
alias filterMols r7
|
||||
alias filterActive r8
|
||||
alias inTemperature r9
|
||||
alias inMolsCheck r10
|
||||
alias inMolsCompare r11
|
||||
alias totalMols r12
|
||||
alias outPressure r13
|
||||
alias purgeActive r14
|
||||
alias FilterLeft r0
|
||||
alias FilterRight r1
|
||||
alias FilterMin r2
|
||||
alias FilterMax r3
|
||||
alias FilterRemain r4
|
||||
alias FilterLight r5
|
||||
alias FilterHash r6
|
||||
alias FilterMols r7
|
||||
alias FilterActive r8
|
||||
alias InTemperature r9
|
||||
alias InMolsCheck r10
|
||||
alias InMolsCompare r11
|
||||
alias TotalMols r12
|
||||
alias OutPressure r13
|
||||
|
||||
define MAXPRESSURE 58000 # Storage pressure kPa
|
||||
define INPUTAMOUNT 2 # Moles to activate
|
||||
@ -32,77 +31,78 @@ define MAXTEMPERATURE 313.15 # 40C
|
||||
start:
|
||||
yield
|
||||
|
||||
# Check filters and set diodes
|
||||
ls filterLeft filtration 0 Quantity
|
||||
ls filterRight filtration 1 Quantity
|
||||
or filterActive filterLeft filterRight
|
||||
min filterMin filterLeft filterRight
|
||||
seqz filterLight filterMin
|
||||
bdseal diode slideActivate
|
||||
max filterMax filterLeft filterRight
|
||||
select filterRemain filterMin filterMin filterMax
|
||||
div filterRemain filterRemain 100
|
||||
bdseal diode slideSetting
|
||||
|
||||
# Check storage pressure
|
||||
l outPressure filtration PressureOutput
|
||||
slt outPressure outPressure MAXPRESSURE
|
||||
and filterActive filterActive outPressure
|
||||
l OutPressure filtration PressureOutput
|
||||
slt FilterActive OutPressure MAXPRESSURE
|
||||
beqz FilterActive filteronoff
|
||||
|
||||
# Check temperature
|
||||
l inTemperature filtration TemperatureInput
|
||||
bgt inTemperature MAXTEMPERATURE start
|
||||
l InTemperature filtration TemperatureInput
|
||||
slt FilterActive InTemperature MAXTEMPERATURE
|
||||
beqz FilterActive filteronoff
|
||||
|
||||
# Check filters and set diodes
|
||||
ls FilterLeft filtration 0 Quantity
|
||||
ls FilterRight filtration 1 Quantity
|
||||
or FilterActive FilterLeft FilterRight
|
||||
min FilterMin FilterLeft FilterRight
|
||||
seqz FilterLight FilterMin
|
||||
bdseal diode slideActivate
|
||||
max FilterMax FilterLeft FilterRight
|
||||
select FilterRemain FilterMin FilterMin FilterMax
|
||||
div FilterRemain FilterRemain 100
|
||||
bdseal diode slideSetting
|
||||
|
||||
# Check filters and available gas
|
||||
l totalMols filtration TotalMolesInput
|
||||
ls filterHash filtration 0 PrefabHash
|
||||
l TotalMols filtration TotalMolesInput
|
||||
ls FilterHash filtration 0 PrefabHash
|
||||
jal checkfilter
|
||||
move inMolsCompare inMolsCheck
|
||||
ls filterHash filtration 1 PrefabHash
|
||||
move InMolsCompare InMolsCheck
|
||||
ls FilterHash filtration 1 PrefabHash
|
||||
jal checkfilter
|
||||
max filterMols inMolsCheck inMolsCompare
|
||||
mul totalMols totalMols filterMols
|
||||
sgt totalMols totalMols INPUTAMOUNT
|
||||
and filterActive filterActive totalMols
|
||||
#Activate filtration if required
|
||||
s filtration Mode filterActive
|
||||
max FilterMols InMolsCheck InMolsCompare
|
||||
mul TotalMols TotalMols FilterMols
|
||||
sgt FilterActive TotalMols INPUTAMOUNT
|
||||
|
||||
filteronoff:
|
||||
s filtration Mode FilterActive
|
||||
j start
|
||||
|
||||
slideActivate:
|
||||
s diode On filterLight
|
||||
s diode On FilterLight
|
||||
j ra
|
||||
|
||||
slideSetting:
|
||||
s diode Setting filterRemain
|
||||
s diode Setting FilterRemain
|
||||
j ra
|
||||
|
||||
checkfilter:
|
||||
l inMolsCheck filtration RatioOxygenInput
|
||||
beq filterHash -1067319543 ra
|
||||
beq filterHash -1217998945 ra
|
||||
beq filterHash -721824748 ra
|
||||
l inMolsCheck filtration RatioNitrogenInput
|
||||
beq filterHash -632657357 ra
|
||||
beq filterHash -1387439451 ra
|
||||
beq filterHash 632853248 ra
|
||||
l inMolsCheck filtration RatioCarbonDioxideInput
|
||||
beq filterHash 416897318 ra
|
||||
beq filterHash 1876847024 ra
|
||||
beq filterHash 1635000764 ra
|
||||
l inMolsCheck filtration RatioVolatilesInput
|
||||
beq filterHash 1037507240 ra
|
||||
beq filterHash 1255156286 ra
|
||||
beq filterHash 15011598 ra
|
||||
l inMolsCheck filtration RatioPollutantInput
|
||||
beq filterHash 63677771 ra
|
||||
beq filterHash 1959564765 ra
|
||||
beq filterHash 1915566057 ra
|
||||
l inMolsCheck filtration RatioNitrousOxideInput
|
||||
beq filterHash 1824284061 ra
|
||||
beq filterHash 465267979 ra
|
||||
beq filterHash -1247674305 ra
|
||||
move inMolsCheck 0
|
||||
beqz filterHash ra
|
||||
l InMolsCheck filtration RatioOxygenInput
|
||||
beq FilterHash -1067319543 ra
|
||||
beq FilterHash -1217998945 ra
|
||||
beq FilterHash -721824748 ra
|
||||
l InMolsCheck filtration RatioNitrogenInput
|
||||
beq FilterHash -632657357 ra
|
||||
beq FilterHash -1387439451 ra
|
||||
beq FilterHash 632853248 ra
|
||||
l InMolsCheck filtration RatioCarbonDioxideInput
|
||||
beq FilterHash 416897318 ra
|
||||
beq FilterHash 1876847024 ra
|
||||
beq FilterHash 1635000764 ra
|
||||
l InMolsCheck filtration RatioVolatilesInput
|
||||
beq FilterHash 1037507240 ra
|
||||
beq FilterHash 1255156286 ra
|
||||
beq FilterHash 15011598 ra
|
||||
l InMolsCheck filtration RatioPollutantInput
|
||||
beq FilterHash 63677771 ra
|
||||
beq FilterHash 1959564765 ra
|
||||
beq FilterHash 1915566057 ra
|
||||
l InMolsCheck filtration RatioNitrousOxideInput
|
||||
beq FilterHash 1824284061 ra
|
||||
beq FilterHash 465267979 ra
|
||||
beq FilterHash -1247674305 ra
|
||||
move InMolsCheck 0
|
||||
beqz FilterHash ra
|
||||
|
||||
#if you are still here then it is an error so end
|
||||
s filtration On 0
|
||||
|
Loading…
Reference in New Issue
Block a user