FB_Clamp (Function Block)

Clamps the input signal to the range [Minimum, Maximum].

Any input below Minimum is set to Minimum. Any input above Maximum is set to Maximum. Inputs within the range pass through unchanged.

Note

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

Extends: FB_SisoComponent

Properties

Maximum

Type: LREAL

Gets or sets the upper clamp bound.

Internally clamped to be greater than or equal to Minimum. Set this before Minimum to ensure the guard applies correctly.

Minimum

Type: LREAL

Gets or sets the lower clamp bound.

Internally clamped to be less than or equal to Maximum. Set Maximum before this property to ensure the guard applies correctly.

Residual

Type: LREAL

Gets the difference between the unclamped input and the clamped output. Zero when the input is within [Minimum, Maximum].

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)

fMaximum

LREAL

Upper clamp bound.

fMinimum

LREAL

Lower clamp bound.

Run

Clamps the current input to [Minimum, Maximum].