Skip to main content

Sensirions public algorithms to calculate VOC and NOx gas indices.

Project description

Sensirion’s Gas Index Algorithm software provides a VOC and an NOx Index output signal calculated from the SGP40/41 raw signal inputs SRAW_VOC and SRAW_NOX. Note: for SGP40, only SRAW_VOC is available. This algorithm enables robust detection of ambient changes of VOCs and NOx with minimal sensor-to-sensor variation. The algorithm is based on a statistical gain-offset normalization and adapts both parameters constantly applying an exponentially decaying function of the learned parameters to be able to adapt to changing environments.

For the VOC Index output, the software must be instanced as VOC Algorithm while for the NOx Index output, the software must be instanced as NOx Algorithm. It is important to feed the raw signals to the corresponding algorithm (i.e., SRAW_VOC to the VOC Algorithm and SRAW_NOX to the NOx Algorithm) at a constant sampling interval which must coincide with the sampling interval that is used to read out the raw signals from the SGP40/41 sensor. The default sampling interval applied in the algorithm is 1 s. In case, a different sampling interval should be used the definition of the sampling interval in the h.file of the algorithm must be changed, too.

The algorithm calculates the VOC and NOx Index signals recursively from a single raw tick value of SRAW_VOC and SRAW_NOX, respectively, which are both measured by the SGP40/41 sensor at each time step, as well as internal states that are updated at each time step. These internal states are most importantly the recursively estimated mean and variance of the corresponding SRAW signal as well as some additional internal states such as uptime and other counters. After estimating the states, the algorithm converts the raw signals in ticks into either VOC or NOx Index, respectively, and applies an adaptive low-pass filter.

Install

pip install sensirion-gas-index-algorithm

Recommended usage is within a virtualenv.

Usage VOC Algorithm

from sensirion_gas_index_algorithm.voc_algorithm import VocAlgorithm

voc_algorithm = VocAlgorithm()
s_voc_raw = 27000  # read out from SGP41
for _ in range(100):
    voc_index = voc_algorithm.process(s_voc_raw)
    print(voc_index)

Usage NOx Algorithm

from sensirion_gas_index_algorithm.nox_algorithm import NoxAlgorithm

nox_algorithm = NoxAlgorithm()
s_nox_raw = 18000  # read out from SGP41
for _ in range(100):
    nox_index = nox_algorithm.process(s_voc_raw)
    print(nox_index)

CHANGELOG

3.2.1

  • Use floating point version of Gas Index Algorithm

3.2.0

  • Add low power examples

  • Allow chaning of sampling interval

3.1.0

  • Add VOC gas index algorithm version 3.1.0

  • Add NOx gas index algorithm version 3.1.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sensirion-gas-index-algorithm-3.2.2.tar.gz (49.4 kB view hashes)

Uploaded Source

Built Distribution

sensirion_gas_index_algorithm-3.2.2-cp38-cp38-win_amd64.whl (43.0 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page