FB_LinearStateErrorFeedback (Function Block)

Computes the control output for a Linear Active Disturbance Rejection Controller (LADRC).

The control law is:

\[ \begin{align}\begin{aligned}u_0 = \omega_c \cdot (SP - z_1) + u_i\\u = \frac{u_0 - z_2}{b_0}\end{aligned}\end{align} \]

where \(u_0\) is the error feedback, \(u_i\) is the integral correction from an external integrator, \(z_2\) cancels the estimated disturbance from FB_ExtendedStateObserver, and dividing by B0 scales the output to the plant’s input range.

If B0 is zero the output is held at zero.

Note

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

Extends: FB_SoComponent

Properties

B0

Type: LREAL

Gets or sets the estimated plant gain (b0).

Must be non-zero. A value of zero disables the control output entirely. See B0 for guidance on how to estimate this value.

Integral

Type: LREAL

Gets or sets the integral correction.

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

Setpoint

Type: LREAL

Gets or sets the setpoint. This is the desired process output.

Wc

Type: LREAL

Gets or sets the controller bandwidth in rad/s.

Controls how fast the closed loop responds to setpoint changes. A higher value gives a faster response but risks overshoot and sensitivity to noise. Start with a low value and increase until the response is satisfactory.

For a process that should settle in roughly 10 seconds, a starting value of Wc = 0.5 rad/s is reasonable.

Z1

Type: LREAL

Gets or sets the estimated process output from FB_ExtendedStateObserver.

Set this to Z1 before calling Run().

Z2

Type: LREAL

Gets or sets the estimated total disturbance from FB_ExtendedStateObserver.

Set this to Z2 before calling Run().

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)

fWc

LREAL

Controller bandwidth in rad/s.

fB0

LREAL

Estimated plant gain.

Reset

Sets the output to zero.

Run

Computes the control output for the current cycle.

Note

Must be called once per cycle on a single PLC task. If b0 is zero the output is held at zero.