FB_BA_RampLmt

FB_BA_RampLmt 1:

The function block FB_BA_RampLmt limits the increase or decrease speed of an input signal.
As fIn rises, the output fOut is limited to the slope of (fHi-fLo)/nTiUp.
When fIn decreases, the output fOut is limited to the slope of (fHi-fLo)/nTiDwn.

When the function block is activated (rising edge on bEn), the function block output fOut is initially set equal to the input fIn before it begins to track fIn. If the function block is not active (bEn = FALSE), then fOut = 0.

FB_BA_RampLmt 2:

fLo must be less than fHi. If fLo is greater than fHi, fLo is limited to fHi. According to the calculation shown, this means that the output fOut immediately follows the input fIn.
If the nTiUp or nTiDwn times are set to 0, this is handled internally, and the fOut output follows the fIn input immediately.

FB_BA_RampLmt 3:

Syntax

FUNCTION_BLOCK FB_BA_RampLmt
VAR_INPUT
  bEn            : BOOL;
  fIn            : REAL;
  bSync          : BOOL;
  fSync          : REAL;
  fHi            : REAL;
  fLo            : REAL;
  nTiUp          : UDINT;
  nTiDwn         : UDINT;
END_VAR
VAR_OUTPUT
  fOut           : REAL;
END_VAR

FB_BA_RampLmt 4: Inputs

Name

Type

Description

bEn

BOOL

Function block enable; when a rising edge occurs, fOut is set to fIn. If bEn is FALSE, then fOut = 0.0.

fIn

REAL

Input value of the ramp function

bSync

BOOL

When a rising edge is applied to bSync, the output is set to fSync, so that in the next cycle, the system ramps up or down from this value.

This functionality is enabled only if the function block is also enabled in the same cycle using bEn.

fSync

REAL

Value to which the output is synchronized using bSync.

fHi

REAL

Upper interpolation point for calculating the ramps

fLo

REAL

Lower interpolation point for calculating the ramps. fHi must be greater than fLo; otherwise an error is output!

nTiUp

UDINT

Rise time [s].

nTiDwn

UDINT

Fall time [s].

FB_BA_RampLmt 5: Outputs

Name

Type

Description

fOut

REAL

Output signal, slope-limited through the ramps.