succd: add additional safety interlocks
This commit is contained in:
parent
f7752922c2
commit
d3391b28ec
3 changed files with 66 additions and 3 deletions
|
|
@ -17,7 +17,10 @@ type daemon struct {
|
|||
// Pirani gauge.
|
||||
adcPirani adc
|
||||
|
||||
failsafe bool
|
||||
lastPressures ringbuffer
|
||||
|
||||
failsafe bool
|
||||
highPressure bool
|
||||
|
||||
gpioDiffusionPump gpio
|
||||
gpioRoughingPump gpio
|
||||
|
|
@ -122,7 +125,15 @@ func (d *daemon) processOnce(_ context.Context) error {
|
|||
d.aboveRough.process(float64(mbar))
|
||||
d.aboveHigh.process(float64(mbar))
|
||||
|
||||
if mbar < 4e-6 {
|
||||
d.lastPressures.AddValue(mbar)
|
||||
|
||||
// max rate of 1.0 in 500 ms because ringbuffer holds 5 values
|
||||
if d.lastPressures.MaxMinDiff() > 1.0 {
|
||||
if !d.failsafe {
|
||||
d.failsafe = true
|
||||
klog.Errorf("Pressure changed too fast; entering failsafe mode")
|
||||
}
|
||||
} else if mbar < 4e-6 {
|
||||
// Unrealistic result, Pirani probe probably disconnected. Failsafe mode.
|
||||
if !d.failsafe {
|
||||
d.failsafe = true
|
||||
|
|
@ -131,13 +142,30 @@ func (d *daemon) processOnce(_ context.Context) error {
|
|||
} else {
|
||||
if d.failsafe {
|
||||
d.failsafe = false
|
||||
klog.Infof("Pirani probe has been reconnected; quitting failsafe mode")
|
||||
klog.Infof("Values are plausible again; quitting failsafe mode")
|
||||
}
|
||||
}
|
||||
|
||||
if mbar >= 1e-1 {
|
||||
if !d.highPressure {
|
||||
d.highPressure = true
|
||||
klog.Errorf("Pressure is too high; enabling diffusion pump lockout")
|
||||
}
|
||||
} else {
|
||||
if d.highPressure {
|
||||
d.highPressure = false
|
||||
klog.Infof("Pressure is low enough for diffusion pump operation; quitting diffusion pump lockout")
|
||||
}
|
||||
}
|
||||
|
||||
if d.failsafe {
|
||||
d.aboveRough.output = true
|
||||
d.aboveHigh.output = true
|
||||
d.dpOn = false
|
||||
}
|
||||
|
||||
if d.highPressure {
|
||||
d.dpOn = false
|
||||
}
|
||||
|
||||
// Update relay outputs.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue