Specification-defined illuminance regulator

This module implements the illuminance regulator defined in the Bluetooth® mesh model specification.

The regulator operates in a compile time configurable update interval between 10 and 100 ms. The interval can be configured through the CONFIG_BT_MESH_LIGHT_CTRL_REG_SPEC_INTERVAL option.

For each step, the regulator:

  1. Calculates the integral of the error since the last step.

  2. Adds the integral to an internal sum.

  3. Multiplies this sum by an integral coefficient.

  4. Summarizes the sum with the raw difference multiplied by a proportional coefficient.

The error, the regulator coefficients, and the internal sum, are represented as 32-bit floating point values. The resulting output level is represented as an unsigned 16-bit integer.

To reduce noise, the regulator has a configurable accuracy property which allows it to ignore errors smaller than the configured accuracy (represented as a percentage of the light level).

API documentation

Header file: include/bluetooth/mesh/light_ctrl_reg_spec.h
Source file: subsys/bluetooth/mesh/light_ctrl_reg_spec.c
group bt_mesh_light_ctrl_reg_spec

Specification-defined illuminance regulator.

Defines

BT_MESH_LIGHT_CTRL_REG_SPEC_INIT

Initialization macro for Specification-defined illuminance regulator.

struct bt_mesh_light_ctrl_reg_spec
#include <light_ctrl_reg_spec.h>

Specification-defined illuminance regulator context.

Public Members

struct bt_mesh_light_ctrl_reg reg

Common regulator context.

struct k_work_delayable timer

Regulator step timer.

float i

Internal integral sum.

bool enabled

Regulator enabled flag.