FB_ALY_ImpulseFactor

The algorithm Impulse Factor calculates the signal feature of the same name from the input values. The output value is calculated from the ratio of the peak value of the input signal to the mean value of the input signal.

FB_ALY_ImpulseFactor 1:

The number of input data to be included in the calculation and the type of calculation can be configured.

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_ImpulseFactor
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
END_VAR

FB_ALY_ImpulseFactor 2: Outputs

Name

Type

Description

ipResultMessage

I_TcMessage

Contains more detailed information on the current return value. This special interface pointer is internally secured so that it is always valid/assigned.

bError

BOOL

This output is TRUE if an error occurs.

bNewResult

BOOL

When a new result has been calculated, the output is TRUE.

bConfigured

BOOL

Displays TRUE when the function block is successfully configured.

FB_ALY_ImpulseFactor 3: Methods

Name

Definition location

Description

Call()

Local

Method for calculating the outputs for a specific configuration.

Configure()

Local

General configuration of the algorithm with its parameterized conditions. The configuration is identical for all channels.

FB_init()

Local

Initializes the number of input channels.

Reset()

Local

Resets all internal states or the calculations performed so far.

SetChannelValue()

Local

Method for passing values to the algorithm.

GetChannelOutputValue()

Local

Method for receiving values from different output channels.

Sample

VAR
    fbImpulseFactor : FB_ALY_ImpulseFactor(nNumChannels := 1);
    eWindowMode : E_ALY_WindowMode := E_ALY_WindowMode.FixWindow;
    nWindowSize : UDINT := 100;
    bConfigure : BOOL := TRUE;
    fInput : LREAL;
    fImpulseFactor : LREAL;
END_VAR
// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;
    fbImpulseFactor.Configure(eWindowMode, nWindowSize);
END_IF

// Call algorithm
fbImpulseFactor.SetChannelValue(1, fInput);
fbImpulseFactor.Call();
fbImpulseFactor.GetChannelOutputValue(1, fImpulseFactor);

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics