diff --git a/succbone/succd/index.html b/succbone/succd/index.html index 6be0c1d..a26db5d 100644 --- a/succbone/succd/index.html +++ b/succbone/succd/index.html @@ -5,11 +5,12 @@ @@ -68,7 +59,19 @@ td > span {

succd

nothing more permanent than a temporary solution

-
+

+ + + + + + + + + + +
Pirani GaugeVoltage{{ .Pirani.Volts }}
Pressure{{ .Pirani.Mbar }}
+ @@ -93,19 +96,6 @@ td > span {
Thresholds
- - - - - - - - - - -
Pirani GaugeVoltage{{ .Pirani.Volts }}
Pressure{{ .Pirani.Mbar }}
- - @@ -132,14 +122,13 @@ td > span { - +
ControlStatus OK Load......
- -

- -

-
+

+

+ +

{{ .System.Hostname }} | load: {{ .System.Load }} | pprof | metrics | ws ping: diff --git a/succbone/succd/main.go b/succbone/succd/main.go index 4a39d11..23427b6 100644 --- a/succbone/succd/main.go +++ b/succbone/succd/main.go @@ -11,21 +11,17 @@ import ( ) var ( - flagFake bool - flagListenHTTP string - flagPressureThresholdRough = ScientificNotationValue(1e-1) - flagPressureThresholdRoughHysteresis = ScientificNotationValue(2e-2) - flagPressureThresholdHigh = ScientificNotationValue(1e-4) - flagPressureThresholdHighHysteresis = ScientificNotationValue(2e-5) + flagFake bool + flagListenHTTP string + flagPressureThresholdRough = ScientificNotationValue(1e-1) + flagPressureThresholdHigh = ScientificNotationValue(1e-4) ) func main() { flag.BoolVar(&flagFake, "fake", false, "Enable fake mode which allows to run succd for tests outside the succbone") flag.StringVar(&flagListenHTTP, "listen_http", ":8080", "Address at which to listen for HTTP requests") flag.TextVar(&flagPressureThresholdRough, "pressure_threshold_rough", &flagPressureThresholdRough, "Threshold for opening up diffusion pump (mbar)") - flag.TextVar(&flagPressureThresholdRoughHysteresis, "pressure_threshold_rough_hysteresis", &flagPressureThresholdRoughHysteresis, "+-Hysteresis for rough threshold (mbar)") flag.TextVar(&flagPressureThresholdHigh, "pressure_threshold_high", &flagPressureThresholdHigh, "Threshold for enabling high voltage circuits (mbar)") - flag.TextVar(&flagPressureThresholdHighHysteresis, "pressure_threshold_high_hysteresis", &flagPressureThresholdHighHysteresis, "+-Hysteresis for high threshold (mbar)") flag.Parse() ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt) @@ -36,9 +32,7 @@ func main() { d.daemonState.piraniVolts100.limit = 100 d.aboveRough.threshold = float64(flagPressureThresholdRough) - d.aboveRough.hysteresis = float64(flagPressureThresholdRoughHysteresis) d.aboveHigh.threshold = float64(flagPressureThresholdHigh) - d.aboveHigh.hysteresis = float64(flagPressureThresholdHighHysteresis) if flagFake { klog.Infof("Starting with fake peripherals") d.adcPirani = &fakeADC{} diff --git a/succbone/succd/process_blocks.go b/succbone/succd/process_blocks.go index ae1294d..0b37193 100644 --- a/succbone/succd/process_blocks.go +++ b/succbone/succd/process_blocks.go @@ -30,20 +30,13 @@ type thresholdOutput struct { debounce time.Time // threshold is the setpoint of the block. threshold float64 - // hysteresis around the process setpoint (min/max is threshold +- hysteresis) - hysteresis float64 } func (t *thresholdOutput) process(value float64) { if time.Now().Before(t.debounce) { return } - new := t.output - if t.output { - new = value > (t.threshold - t.hysteresis) - } else { - new = value > (t.threshold + t.hysteresis) - } + new := value > t.threshold if new != t.output { t.output = new t.debounce = time.Now().Add(time.Second * 5) diff --git a/succbone/succd/process_blocks_test.go b/succbone/succd/process_blocks_test.go index 24b75f6..4dd028c 100644 --- a/succbone/succd/process_blocks_test.go +++ b/succbone/succd/process_blocks_test.go @@ -26,37 +26,20 @@ func TestMomentaryOutput(t *testing.T) { func TestThresholdOutput(t *testing.T) { to := thresholdOutput{ - threshold: 1, - hysteresis: 0.2, + threshold: 1, } - to.process(0.7) + to.process(0) if to.output { t.Fatalf("output shouldn't have triggered") } - to.process(1) - if to.output { - t.Fatalf("output shouldn't have triggered") - } - to.process(1.3) + to.process(2) if !to.output { t.Fatalf("output should have triggered") } - to.process(1) - if !to.output { - t.Fatalf("output should have triggered") - } - to.process(0.7) + to.process(0) if !to.output { t.Fatalf("output should have triggered (in debounce)") } - - // let debounce timeout pass - time.Sleep(time.Second * 6) - - to.process(0.7) - if to.output { - t.Fatalf("output shouldn't have triggered") - } } func TestRingbufferInput(t *testing.T) {