auto_sampler_eight_triggers Automated sampler program triggers on multiple varied conditions.

auto_sampler_eight_triggers.py

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

auto_sampler_eight_triggers.auto_eight_test(debug_out=False)

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.

Parameters:
  • 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
Returns:

the difference between the two readings

Return type:

float

auto_sampler_eight_triggers.enough_water()

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

auto_sampler_eight_triggers.general_read_value(label)

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
auto_sampler_eight_triggers.manual_sampler()

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

auto_sampler_eight_triggers.periodic_sampler()

Function triggers sampler on a user set schedule

auto_sampler_eight_triggers.precip_24_hour(inval)
auto_sampler_eight_triggers.precip_2_hour(inval)
auto_sampler_eight_triggers.stage_sampling(stage)

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

auto_sampler_eight_triggers.threshold_check(current_turbidity)

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
auto_sampler_eight_triggers.threshold_get_value(indexi)

Returns the value of the threshold associated with the index.

auto_sampler_eight_triggers.threshold_move(current_turbidity)

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
auto_sampler_eight_triggers.threshold_move_low(current_turbidity)

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

Parameters:current_turbidity
Returns:
Return type:
auto_sampler_eight_triggers.threshold_reset()

Resets the global threshold values

auto_sampler_eight_triggers.threshold_sampler(turbidity)

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.

auto_sampler_eight_triggers.trigger_sampler()

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

Returns:True if sampler was triggered.
auto_sampler_eight_triggers.trigger_sampler_master()

Triggers the sampler immediately and logs it.

auto_sampler_eight_triggers.update_status()

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]