API Documentation

VOC Algorithm

VocAlgorithm

class sensirion_gas_index_algorithm.voc_algorithm.VocAlgorithm(sampling_interval: int = 1.0)[source]
__init__(sampling_interval: int = 1.0)[source]
set_states(state0, state1)[source]

Set previously retrieved algorithm states to resume operation after a short interruption, skipping initial learning phase. This feature should not be used after interruptions of more than 10 minutes. Call this once after init() and the optional set_tuning_parameters(), if desired. Otherwise, the algorithm will start with initial learning phase.

Parameters
  • state0 – State0 to be restored

  • state1 – State1 to be restored

get_states()[source]

Get current algorithm states. Retrieved values can be used in set_states() to resume operation after a short interruption, skipping initial learning phase. This feature can only be used after at least 3 hours of continuous operation.

Return type

tuple

Returns

  • state0

  • state1

get_sampling_interval()

Get the sampling interval used by the algorithm.

Returns

The sampling interval in seconds

get_tuning_parameters()

Get tuning parameters. See set_tuning_parameters for a documentation of the parameters.

Note

The parameters learning_time_gain_hours and std_initial can be ignored for the NOx gas index algorithm.

Return type

tuple

Returns

  • index_offset

  • learning_time_offset_hours

  • learning_time_gain_hours

  • gating_max_duration_minutes

  • std_initial

  • gain_factor

get_version()

Get the version of the engine.

init(sampling_interval: int = 1.0)

Re-initialize / reset the engine.

process(s_sgp: int)

Feed the engine and return compensated value.

Parameters

s_sgp – Raw signal (ticks) from SGP sensor as integer

Returns

Compensated index

set_tuning_parameters(index_offset: int, learning_time_offset_hours: int, learning_time_gain_hours: int, gating_max_duration_minutes: int, std_initial: int, gain_factor: int)

Set parameters to customize the algorithm. Call this once after init(), if desired. Otherwise, the default values will be used.

Parameters
  • index_offset – Index representing typical (average) conditions. (Range: 1..250; Default: 100 for VOC 1 for NOx)

  • learning_time_offset_hours – Time constant to estimate the offset from the history in hours. Past events will be forgotten after about twice the learning time. (Range: 1..1000 [hours]; Default 12 [hours])

  • learning_time_gain_hours – Time constant to estimate the gain from the history in hours. Past events will be forgotten after about twice the learning time. (Range: 1..1000 [hours]; Default 12 [hours])

  • gating_max_duration_minutes – Maximum duration of gating (freeze of estimator during high VOC index signal). Set to 0 to disable gating (Range: 1..3000 [minutes]; Default: 180 for VOC and 720 for NOx)

  • std_initial – Initial estimate for standard deviation. Lower value boosts events during initial learning period, but may result in larger device-to-device variations. (Range: 10..5000; Default: 50)

  • gain_factor – Factor to amplify or to attenuate the Index output. (Range: 1..1000; Default 230)

Note

The parameters learning_time_gain_hours and std_initial have no effect for the NOx gas index algorithm.

NOx Algorithm

NoxAlgorithm

class sensirion_gas_index_algorithm.nox_algorithm.NoxAlgorithm[source]
__init__()[source]
get_sampling_interval()

Get the sampling interval used by the algorithm.

Returns

The sampling interval in seconds

get_tuning_parameters()

Get tuning parameters. See set_tuning_parameters for a documentation of the parameters.

Note

The parameters learning_time_gain_hours and std_initial can be ignored for the NOx gas index algorithm.

Return type

tuple

Returns

  • index_offset

  • learning_time_offset_hours

  • learning_time_gain_hours

  • gating_max_duration_minutes

  • std_initial

  • gain_factor

get_version()

Get the version of the engine.

init(sampling_interval: int = 1.0)

Re-initialize / reset the engine.

process(s_sgp: int)

Feed the engine and return compensated value.

Parameters

s_sgp – Raw signal (ticks) from SGP sensor as integer

Returns

Compensated index

set_tuning_parameters(index_offset: int, learning_time_offset_hours: int, learning_time_gain_hours: int, gating_max_duration_minutes: int, std_initial: int, gain_factor: int)

Set parameters to customize the algorithm. Call this once after init(), if desired. Otherwise, the default values will be used.

Parameters
  • index_offset – Index representing typical (average) conditions. (Range: 1..250; Default: 100 for VOC 1 for NOx)

  • learning_time_offset_hours – Time constant to estimate the offset from the history in hours. Past events will be forgotten after about twice the learning time. (Range: 1..1000 [hours]; Default 12 [hours])

  • learning_time_gain_hours – Time constant to estimate the gain from the history in hours. Past events will be forgotten after about twice the learning time. (Range: 1..1000 [hours]; Default 12 [hours])

  • gating_max_duration_minutes – Maximum duration of gating (freeze of estimator during high VOC index signal). Set to 0 to disable gating (Range: 1..3000 [minutes]; Default: 180 for VOC and 720 for NOx)

  • std_initial – Initial estimate for standard deviation. Lower value boosts events during initial learning period, but may result in larger device-to-device variations. (Range: 10..5000; Default: 50)

  • gain_factor – Factor to amplify or to attenuate the Index output. (Range: 1..1000; Default 230)

Note

The parameters learning_time_gain_hours and std_initial have no effect for the NOx gas index algorithm.

Base Gas Index Algorithm

GasIndexAlgorithm

class sensirion_gas_index_algorithm.gas_index_algorithm.GasIndexAlgorithm(algorithm_type: int, sampling_interval: int = 1.0)[source]
__init__(algorithm_type: int, sampling_interval: int = 1.0)[source]
get_version()[source]

Get the version of the engine.

init(sampling_interval: int = 1.0)[source]

Re-initialize / reset the engine.

get_tuning_parameters()[source]

Get tuning parameters. See set_tuning_parameters for a documentation of the parameters.

Note

The parameters learning_time_gain_hours and std_initial can be ignored for the NOx gas index algorithm.

Return type

tuple

Returns

  • index_offset

  • learning_time_offset_hours

  • learning_time_gain_hours

  • gating_max_duration_minutes

  • std_initial

  • gain_factor

set_tuning_parameters(index_offset: int, learning_time_offset_hours: int, learning_time_gain_hours: int, gating_max_duration_minutes: int, std_initial: int, gain_factor: int)[source]

Set parameters to customize the algorithm. Call this once after init(), if desired. Otherwise, the default values will be used.

Parameters
  • index_offset – Index representing typical (average) conditions. (Range: 1..250; Default: 100 for VOC 1 for NOx)

  • learning_time_offset_hours – Time constant to estimate the offset from the history in hours. Past events will be forgotten after about twice the learning time. (Range: 1..1000 [hours]; Default 12 [hours])

  • learning_time_gain_hours – Time constant to estimate the gain from the history in hours. Past events will be forgotten after about twice the learning time. (Range: 1..1000 [hours]; Default 12 [hours])

  • gating_max_duration_minutes – Maximum duration of gating (freeze of estimator during high VOC index signal). Set to 0 to disable gating (Range: 1..3000 [minutes]; Default: 180 for VOC and 720 for NOx)

  • std_initial – Initial estimate for standard deviation. Lower value boosts events during initial learning period, but may result in larger device-to-device variations. (Range: 10..5000; Default: 50)

  • gain_factor – Factor to amplify or to attenuate the Index output. (Range: 1..1000; Default 230)

Note

The parameters learning_time_gain_hours and std_initial have no effect for the NOx gas index algorithm.

get_sampling_interval()[source]

Get the sampling interval used by the algorithm.

Returns

The sampling interval in seconds

process(s_sgp: int)[source]

Feed the engine and return compensated value.

Parameters

s_sgp – Raw signal (ticks) from SGP sensor as integer

Returns

Compensated index