particulates_sampler - bruno-beloff/scs_dev GitHub Wiki

docs > software repositories > scs_dev > commands > environmental sampling


DESCRIPTION

The particulates_sampler utility reads a set of values from the Alphasense optical particle counter (OPC). The reported values are:

  • per - the period of time between the previous reading and this reading
  • pm1, pm2p5, pm10 - particulate densities of PM1, PM2.5 and PM10 in ug/m3
  • bins - the particle count, for particles of increasing size
  • mtf1, mtf3, mtf5, mtf7 - time taken for particle movement between system points
  • sht.hmd, sht.tmp - humidity and temperature at point of sampling (OPC-N3 only)

The particulates_sampler utility operates by launching a background process. This OPCMonitor process reads the OPC values at specified intervals (which may be different from the intervals used by the parent process). In addition, the process power cycles the OPC if its laser safety control has tripped.

The scs_mfr/opc_conf utility is used to specify the OPC model, background process sampling time, and OPC control power saving mode.

When the particulates_sampler utility starts, it power cycles the OPC. When the utility stops, it stops operations on the OPC, and stops the OPC fan.

The particulates_sampler writes its output to stdout. As for all sensing utilities, the output format is a JSON document with fields for:

  • tag - the unique tag of the device (if the system ID is set)
  • src - a source identifier ("N2" or "N3")
  • rec - the recording datetime in ISO 8601 format
  • val - a value field containing the sensed values
  • exg - data interpretations, as specified by opc_conf.py

Command-line options allow for single-shot reading, multiple readings with specified time intervals, or readings controlled by an independent scheduling process via a Unix semaphore.

If any errors are detected while the OPC is running, these are logged. the log can be interrogated using the scs_mfr/opc_error_log utility.

SYNOPSIS

particulates_sampler.py [-n NAME] [{ -s SEMAPHORE | -i INTERVAL [-c SAMPLES] }] [{ -v | -d }]

Options
--version show program's version number and exit
-h, --help show this help message and exit
-n NAME, --name=NAME the name of the sampler configuration
-s SEMAPHORE, --semaphore=SEMAPHORE sampling controlled by SEMAPHORE
-i INTERVAL, --interval=INTERVAL sampling interval in seconds
-n SAMPLES, --samples=SAMPLES number of samples (1 if interval not specified)
-v, --verbose report narrative to stderr
-d, --debug report detailed narrative to stderr

EXAMPLES

./particulates_sampler.py -v -s scs-particulates

FILES

~/SCS/conf/opc_conf.json
~/SCS/conf/schedule.json
~/SCS/conf/system_id.json
~/SCS/log/opc_error_log.csv

DOCUMENT EXAMPLE - v0

{"rec": "2021-10-11T11:06:57Z", "tag": "scs-bgx-431", "src": "N3", "val": {"per": 4.1, "pm1": 1.7, "pm2p5": 6.3, "pm10": 24.1, "bin": [106, 31, 25, 5, 9, 5, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "mtf1": 34, "mtf3": 34, "mtf5": 43, "mtf7": 48, "sfr": 3.66, "sht": {"hmd": 37.3, "tmp": 23.8}}, "exg": {"rn20": {"pm1": 3.6, "pm2p5": 5.5, "pm10": 27.1}}}

DOCUMENT EXAMPLE - v2

{"rec": "2021-10-11T11:11:14Z", "tag": "scs-be2-3", "ver": 2.0, "src": "N3", "val": {"per": 4.1, "pm1": 0.7, "pm2p5": 3.2, "pm10": 33.3, "bin": [50, 24, 6, 2, 4, 2, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "mtf1": 29, "mtf3": 32, "mtf5": 19, "mtf7": 54, "sfr": 3.73, "sht": {"hmd": 43.6, "tmp": 25.6}}, "exg": {"src": "rn20", "val": {"pm1": 1.5, "pm2p5": 6.4, "pm10": 58.7}}}

SEE ALSO

scs_dev/interface_power
scs_dev/scheduler

scs_mfr/opc_conf
scs_mfr/opc_error_log
scs_mfr/opc_firmware_conf
scs_mfr/opc_version
scs_mfr/pmx_model_conf
scs_mfr/schedule
scs_mfr/system_id

BUGS

The particulates_sampler utility is not process-safe - it should therefore be run by only one process at a time.

RESOURCES

Data formats/Topic: particulates
ISO 8601