FB_PadeDelay (Function Block)

Approximates a transport delay (dead time) using a second-order Padé approximation.

The continuous-time transfer function is:

\[G(s) = \frac{1 - \frac{L}{2}s + \frac{L^2}{12}s^2}{1 + \frac{L}{2}s + \frac{L^2}{12}s^2}\]

where \(L\) is DelayTime in seconds. The approximation is discretised using the Tustin (bilinear) method with frequency pre-warping.

The output initially moves in the opposite direction to the input before settling at the correct delayed value. This is a known characteristic of Padé approximations and not a bug.

A delay of LTIME#0 passes the input through unchanged.

Note

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

Extends: FB_SisoComponent

Properties

DelayTime

Type: LTIME

Gets or sets the approximate transport delay.

This is the time between a change in the input and when that change appears at the output. Longer values produce a more sluggish, harder-to-control process. A value of LTIME#0 passes the input through unchanged.

Note that the Padé approximation causes the output to initially move in the opposite direction to the input. This effect is more pronounced for longer delays relative to the cycle time.

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)

tDelayTime

LTIME

Approximate transport delay.

Run

Advances the Padé delay by one time step.

Note

Must be called once per cycle on a single PLC task. If the measured cycle time is zero or DelayTime is LTIME#0 the input passes through unchanged.