[minor] added an option to get warn thresholds for PowBox channels from corresponding parameters, added warn state annotations to html figures
This commit is contained in:
parent
c621b31f6e
commit
f41f24f626
@ -8,7 +8,8 @@ networks_blacklist: [] # exclude these networks
|
|||||||
interval: 60 # Perform checks every x seconds
|
interval: 60 # Perform checks every x seconds
|
||||||
n_track: 360 # wait n_track * intervals before performing an action (i.e. send mail/end highlight status)
|
n_track: 360 # wait n_track * intervals before performing an action (i.e. send mail/end highlight status)
|
||||||
timespan: 3 # Check data of the recent x days
|
timespan: 3 # Check data of the recent x days
|
||||||
verbosity: 0 # verbosity flag
|
verbosity: 0 # verbosity flag for program console output (not logging)
|
||||||
|
logging_level: WARN # set logging level (info, warning, debug)
|
||||||
track_changes: True # tracks all changes since GUI startup by text highlighting (GUI only)
|
track_changes: True # tracks all changes since GUI startup by text highlighting (GUI only)
|
||||||
warn_count: False # show number of warnings and errors in table
|
warn_count: False # show number of warnings and errors in table
|
||||||
min_sample: 5 # minimum samples for raising Warn/FAIL
|
min_sample: 5 # minimum samples for raising Warn/FAIL
|
||||||
@ -55,6 +56,7 @@ THRESHOLDS:
|
|||||||
# For each channel a factor 'unit' for unit conversion (e.g. to SI) can be provided, as well as a 'name'
|
# For each channel a factor 'unit' for unit conversion (e.g. to SI) can be provided, as well as a 'name'
|
||||||
# and 'ticks' [ymin, ymax, ystep] for plotting.
|
# and 'ticks' [ymin, ymax, ystep] for plotting.
|
||||||
# 'warn' and 'fail' plot horizontal lines in corresponding colors (can be str in TRESHOLDS, int/float or iterable)
|
# 'warn' and 'fail' plot horizontal lines in corresponding colors (can be str in TRESHOLDS, int/float or iterable)
|
||||||
|
# keyword "pb_SOH2" or "pb_SOH3" can be used to extract warning values from above POWBOX parameter definition
|
||||||
#
|
#
|
||||||
# 'transform' can be provided for plotting to perform arithmetic operations in given order, e.g.:
|
# 'transform' can be provided for plotting to perform arithmetic operations in given order, e.g.:
|
||||||
# transform: - ["*", 20]
|
# transform: - ["*", 20]
|
||||||
@ -73,12 +75,12 @@ CHANNELS:
|
|||||||
unit: 1e-6
|
unit: 1e-6
|
||||||
name: "PowBox 230V/12V (V)"
|
name: "PowBox 230V/12V (V)"
|
||||||
ticks: [0, 5, 1]
|
ticks: [0, 5, 1]
|
||||||
warn: [2, 3, 4, 4.5, 5]
|
warn: "pb_SOH2"
|
||||||
EX3:
|
EX3:
|
||||||
unit: 1e-6
|
unit: 1e-6
|
||||||
name: "PowBox Router/Charger (V)"
|
name: "PowBox Router/Charger (V)"
|
||||||
ticks: [0, 5, 1]
|
ticks: [0, 5, 1]
|
||||||
warn: [2, 2.5, 3, 4, 5]
|
warn: "pb_SOH3"
|
||||||
VEI:
|
VEI:
|
||||||
unit: 1e-3
|
unit: 1e-3
|
||||||
name: "Datalogger (V)"
|
name: "Datalogger (V)"
|
||||||
@ -121,6 +123,7 @@ add_links:
|
|||||||
# for example: slmon: {"URL": "path/{nw}_{st}.html", "text": "link"}
|
# for example: slmon: {"URL": "path/{nw}_{st}.html", "text": "link"}
|
||||||
slmon: {"URL": "../slmon/{nw}_{st}.html", "text": "show"}
|
slmon: {"URL": "../slmon/{nw}_{st}.html", "text": "show"}
|
||||||
24h-plot: {"URL": "../scheli/{nw}/{st}.png", "text": "plot"}
|
24h-plot: {"URL": "../scheli/{nw}/{st}.png", "text": "plot"}
|
||||||
|
ppsd: {"URL": "../ppsd/{nw}.{st}.html", "text": "show"}
|
||||||
|
|
||||||
# add station-independent links below html table (list items separated with -)
|
# add station-independent links below html table (list items separated with -)
|
||||||
add_global_links:
|
add_global_links:
|
||||||
|
26
utils.py
26
utils.py
@ -234,6 +234,10 @@ def plot_axis_thresholds(fig, parameters):
|
|||||||
|
|
||||||
def plot_threshold_lines(fig, channel_threshold_list, parameters, **kwargs):
|
def plot_threshold_lines(fig, channel_threshold_list, parameters, **kwargs):
|
||||||
for channel_thresholds, ax in zip(channel_threshold_list, fig.axes):
|
for channel_thresholds, ax in zip(channel_threshold_list, fig.axes):
|
||||||
|
if channel_thresholds in ['pb_SOH2', 'pb_SOH3']:
|
||||||
|
annotate_voltage_states(ax, parameters, channel_thresholds)
|
||||||
|
channel_thresholds = get_warn_states_pbox(channel_thresholds, parameters)
|
||||||
|
|
||||||
if not channel_thresholds:
|
if not channel_thresholds:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -245,3 +249,25 @@ def plot_threshold_lines(fig, channel_threshold_list, parameters, **kwargs):
|
|||||||
warn_thresh = parameters.get('THRESHOLDS').get(warn_thresh)
|
warn_thresh = parameters.get('THRESHOLDS').get(warn_thresh)
|
||||||
if isinstance(warn_thresh, (float, int)):
|
if isinstance(warn_thresh, (float, int)):
|
||||||
ax.axhline(warn_thresh, **kwargs)
|
ax.axhline(warn_thresh, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def get_warn_states_pbox(soh_key: str, parameters: dict) -> list:
|
||||||
|
pb_dict = parameters.get('POWBOX').get(soh_key)
|
||||||
|
if not pb_dict:
|
||||||
|
return []
|
||||||
|
return [key for key in pb_dict.keys() if key > 1]
|
||||||
|
|
||||||
|
|
||||||
|
def annotate_voltage_states(ax, parameters, pb_key):
|
||||||
|
for voltage, voltage_dict in parameters.get('POWBOX').get(pb_key).items():
|
||||||
|
if float(voltage) < 1:
|
||||||
|
continue
|
||||||
|
out_string = ''
|
||||||
|
for key, val in voltage_dict.items():
|
||||||
|
if val != 'OK':
|
||||||
|
if out_string:
|
||||||
|
out_string += ' | '
|
||||||
|
out_string += f'{key}: {val}'
|
||||||
|
|
||||||
|
ax.annotate(out_string, (ax.get_xlim()[-1], voltage), color='0.8', fontsize='xx-small',
|
||||||
|
horizontalalignment='right')
|
||||||
|
Loading…
Reference in New Issue
Block a user