XLINK 500/100 Operations & Maintenance Manual page # 186
@TASK
def alarm_in_setup_change():
setup_write("!M1 meas interval", "00:01:00")
setup_write("!M2 meas interval", "00:01:00")
setup_write("!TX3 scheduled interval", "00:05:00")
It is expected that a second script be setup to trigger when the system goes out of alarm; it
would restore the measurement and transmission intervals.
@TASK
def alarm_out_setup_change():
setup_write("!M1 meas interval", "00:10:00")
setup_write("!M2 meas interval", "00:10:00")
setup_write("!TX3 scheduled interval", "01:00:00")
19.3.5.
Trigger Sampler Script Example
This script task has the job of triggering a sampler once certain conditions are met. It will write a
log entry every time it triggers. It is expected that the script be run on a schedule.
@TASK
def trigger_sampler():
"""Checks last readings of M1 and M2. If readings meet
conditions, sampler is triggered via a digital output"""
if (measure(1).value > 32.5):
if (measure(2).value < 13.9):
# trigger sampler by pulsing output for 500ms
output_control('OUTPUT1', True)
utime.sleep(0.5)
output_control('OUTPUT1', False)
# write a log entry
reading = Reading(label="Triggered", time=utime.time())
reading.write_log()
19.4.
Scripts Management
Please use LinkComm to send a new script file to the station
. LinkComm’s Script tab provides all
the needed features to manage the script file.
Please note that the station holds only one script file. That file may have any number of
functions.
Every script file must include the sl3 module. To the top of each script, add
from sl3 import *
The traditional workflow to setup scripts in:
Run LinkComm and connect to the station
Go to LinkComm’s Script tab
Open an existing script file or paste in the script
Verify that the expected functions are listed by LinkComm
Press the Test Script button and verify the script works
Setup a measurement that will use the script:
Go to the measurement tab
Proceed to setup the measurement(s) to interface to the sensors