auto_sampler_eight_triggers Automated sampler program triggers on multiple varied conditions.

Sampler is triggered on multiple, user-settable factors including

  • Eight different turbidity triggers
  • Rapid changes to stage
  • Rainfall

Script also computes rainfall during the last 24 hours

A Sat/XLink setup is associated with this module: auto_samper_eight_triggers_setup.txt


Test routine

auto_sampler_eight_triggers.differential_reading(meas_label, period_sec, allow_negative)

Computes the difference between the most recent reading of the specified measurement, and an older reading of the same measurement. Routine reads the log looking for the older reading.

  • meas_label (str) – the label of the measurement in question
  • period_sec (int) – how long ago the old reading was made in seconds
  • allow_negative (bool) – should a negative difference be allowed? set to False for rain accumulation

the difference between the two readings

Return type:



Routine checks the last stage reading and returns True if there is enough water to trigger the sampler.


Returns the Value associated with the Label of the general purpose setting.

Parameters:label (str) – the user set label of the general purpose setting
Returns:the value of the general purpose setting
Return type:float

Function triggers the sampler. Intended to be manually triggered to ensure sampler is working.


Function triggers sampler on a user set schedule


Routine is associated with the stage measurement. If the stage changes rapidly, we want to trigger the sampler


Checks the current and previous turbidity readings against the threshold Must be called by @MEASUREMENT function

Parameters:current_turbidity (float) – the current turbidity reading
Returns:True if the threshold has been crossed
Return type:bool

Returns the value of the threshold associated with the index.


Moves to the next relevant turbidity threshold It may skip thresholds if the current turbidity value is right Changes the ascending/descending quality if appropriate

Wraps threshold_move_low, allowing us to skip multiple thresholds at once

Parameters:current_turbidity (float) – current turbidity value

Moves to the next relevant turbidity threshold It may skip thresholds if the current turbidity value is right Changes the ascending/descending quality if appropriate

Return type:

Resets the global threshold values


This is traditionally hooked into the turbidity measurement. If the stage is high enough, check the two most recent readings

of this measurement.

If both cross the relevant threshold, the sampler may be triggered.


Call to attempt to trigger the sampler. Certain conditions may prevent the triggering.

Returns:True if sampler was triggered.

Triggers the sampler immediately and logs it.


Adds diagnostic info to the script status

auto_sampler_eight_triggers.min_time_between_samples = 7200

General Purpose Variable Access Please ensure SL3 firmware version 8.26 or newer This script expects the following gp variables:

Threshold 1 Threshold 2 Threshold 3 Threshold 4 Threshold 5 Threshold 6 Threshold 7 Threshold 8 Threshold Reset Rapid Up Rapid Down Rain 24h Rain 2h Stage Limit

The Threshold 1-8 values must be such that they are increasing up to a peak point after which they are decreasing. E.g. [1.1, 2.1, 3.1, 4.1, 3.2, 2.2, 1.2]