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