FB_ExtendedStateObserver (Function Block)

Estimates the process output and total disturbance for use in an Active Disturbance Rejection Controller (ADRC).

The observer tracks two states:

  • Z1 estimate of the process output.

  • Z2 estimate of the total disturbance, including unmodelled dynamics, nonlinearities, and external disturbances.

The observer gain is derived from Wo and b0. A higher Wo tracks disturbances faster but amplifies sensor noise.

Note

The block is FINAL and must be instantiated, not extended. Use FB_init to set fWo and fB0 at declaration time.

Extends: FB_SoComponent

Properties

B0

Type: LREAL

Gets or sets the estimated plant gain (b0).

This is the ratio of how much the output changes per unit of control signal. For example, if a 10% heater output raises the temperature at 2°C/s, then b0 = 0.2. This does not need to be exact because the observer treats inaccuracies as part of the disturbance and cancels them.

InputU

Type: LREAL

Gets or sets the control signal from the previous cycle.

Set this to the controller output before calling Run().

InputY

Type: LREAL

Gets or sets the measured process output.

Set this to the feedback value before calling Run().

Wo

Type: LREAL

Gets or sets the observer bandwidth in rad/s.

Controls how quickly the observer tracks the process output and disturbances. Typically set to 3–10 times Wc. A value of 10 means the observer reacts roughly 10 times faster than the controller.

Too high amplifies sensor noise and risks numerical instability, for a 10ms task cycle, keep Wo below 100 rad/s. Too low and disturbances are not rejected fast enough.

Z1

Type: LREAL

Gets the estimated process output.

Z2

Type: LREAL

Gets the estimated total disturbance.

A large value indicates significant unmodelled dynamics or external disturbance acting on the process.

Methods

FB_init

Inputs

Name

Type

Description

bInitRetains

BOOL

if TRUE, the retain variables are initialized (warm start / cold start)

bInCopyCode

BOOL

if TRUE, the instance afterwards gets moved into the copy code (online change)

fWo

LREAL

Observer bandwidth in rad/s.

fB0

LREAL

Estimated plant gain.

Reset

Clears the observer state. Z1 and Z2 are set to zero.

Run

Advances the observer by one time step.

Note

Must be called once per cycle on a single PLC task. If the measured cycle time is zero the method returns early without updating the state.

Uses Forward Euler discretisation. For stability, ensure Wo satisfies Wo \* T < 1 where T is the task cycle time in seconds. For a 10ms task, Wo should not exceed 100 rad/s.