-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwaste-storage-controller.ic10
More file actions
89 lines (86 loc) · 1.41 KB
/
waste-storage-controller.ic10
File metadata and controls
89 lines (86 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# waste recirculation controller for filters
alias Waste d0
alias PumpIn d1
alias InPA d2
alias PumpOut d3
alias OutPA d4
alias InMax r13
alias OutMax r14
define IN_TARGET 40000
define IN_LOW 38000
define STORAGE_MIN 10
define STORAGE_MAX 55000
define OUT_HIGH 10000
define OUT_LOW 50
define PUMP_MAX 100
init:
s InPA On 1
s InPA Lock 1
s PumpIn On 0
s PumpIn Setting 0
s PumpIn Lock 1
s OutPA On 1
s OutPA Lock 1
s PumpOut On 0
s PumpOut Setting 0
s PumpOut Lock 1
l InMax PumpIn Maximum
bnez InMax haveInMax
j safe_off
haveInMax:
l OutMax PumpOut Maximum
bnez OutMax haveOutMax
j safe_off
haveOutMax:
main:
yield
bdns Waste safe_off
bdns PumpIn safe_off
bdns InPA safe_off
bdns PumpOut safe_off
bdns OutPA safe_off
l r0 Waste Pressure
l r1 InPA Pressure
l r2 OutPA Pressure
sge r8 r2 OUT_HIGH
# intake management
sle r6 r0 STORAGE_MIN
sge r7 r1 IN_TARGET
or r6 r6 r7
sge r7 r0 STORAGE_MAX
or r6 r6 r7
or r6 r6 r8
bnez r6 intake_off
slt r3 r1 IN_LOW
sgt r4 r0 STORAGE_MIN
slt r5 r0 STORAGE_MAX
and r3 r3 r4
and r3 r3 r5
bnez r3 intake_on
j intake_off
intake_on:
s PumpIn Setting InMax
s PumpIn On 1
j exhaust_logic
intake_off:
s PumpIn On 0
s PumpIn Setting 0
# exhaust purge
exhaust_logic:
sle r6 r2 OUT_LOW
bnez r6 exhaust_off
s PumpOut Setting OutMax
s PumpOut On 1
j main
exhaust_off:
s PumpOut On 0
s PumpOut Setting 0
j main
safe_off:
s PumpIn On 0
s PumpIn Setting 0
s PumpOut On 0
s PumpOut Setting 0
s InPA On 1
s OutPA On 1
j main