-
Notifications
You must be signed in to change notification settings - Fork 1
/
gas_mixer.ic10
61 lines (51 loc) · 1.3 KB
/
gas_mixer.ic10
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
# Gas-mixing script. Needs two source-tanks and an
# output tank, a gas-mixer, a (turbo) volume pump,
# and a Kit (Button, moment type) to trigger purge.
# Gas mixer ratio is manually set!
alias TankA d0
alias TankB d1
alias TankOut d2
alias Mixer d3
alias Pump d4
alias Button d5
alias TankAPress r0
alias TankBPress r1
alias TankOutPress r2
alias TankAOk r3
alias TankBOk r4
alias TankOutOk r5
alias MixerRun r6
alias PurgeActivate r7
define PRESS_IN_MIN 500 # 500kPa
define PRESS_OUT_MAX 2000 # 2MPa
# Sets purge pump to max output
l TankAPress Pump Maximum
s Pump Setting TankAPress
start:
yield
s Pump On 0 # Ensures purge pump is off
# Checks is purge is activated
l PurgeActivate Button Setting
bgtz PurgeActivate purge
# Loads tank pressures
l TankAPress TankA Pressure
l TankBPress TankB Pressure
l TankOutPress TankOut Pressure
# Checks if pressures are within tolerances
sgt TankAOk TankAPress PRESS_IN_MIN
sgt TankBOk TankBPress PRESS_IN_MIN
slt TankOutOk TankOutPress PRESS_OUT_MAX
and MixerRun TankAOk TankBOk
and MixerRun TankOutOk MixerRun
# Activates mixer if all is ok
s Mixer On MixerRun
j start
purge:
yield
s Mixer On 0 # Turns mixer off
# Gets output tank pressure
l TankOutPress TankOut Pressure
s Pump On 1 # Activates purge pump
# Runs pump until tank is empty
bgtz TankOutPress purge
j start