FB_ALY_Energy_AX5xxx

The Energy AX5xxx module is suitable for energy monitoring of servo drives from the AX5xxx series. The input data is averaged over a configurable interval and then calculated. To ensure that the required input data is available, it must be added to the process image.

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_Energy_AX5xxx
VAR_INPUT
    bPersistent: BOOL;
END_VAR
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    fElectricalPower: LREAL;
    fMechanicalPower: LREAL;
    fBrakingPower: LREAL;
    fElectricalEnergy: LREAL;
END_VAR

FB_ALY_Energy_AX5xxx 1: Inputs

Name

Type

Description

bPersistent

BOOL

If the value is TRUE, the internal data is stored persistently.

FB_ALY_Energy_AX5xxx 2: Outputs

Name

Type

Description

ipResultMessage

I_TcMessage

Contains more detailed information on the current return value. For this special interface pointer, it is ensured internally that it is always valid/assigned.

bError

BOOL

The 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.

fElectricalPower

LREAL

Electrical power in watts.

fMechanicalPower

LREAL

Mechanical power in watts.

fBrakingPower

LREAL

Braking power in watts.

fElectricalEnergy

LREAL

Electrical energy in watt-hours.

FB_ALY_Energy_AX5xxx 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.

Reset()

Local

Resets all internal states or the calculations performed so far.

SetChannelValue()

Local

Method for passing values to the algorithm.

Sample

VAR
    fbEnergy : FB_ALY_Energy_AX5xxx;
    fbSystemTime : FB_ALY_GetSystemTime;
    fSampleRate : LREAL := 1000.0;
    tInterval : LTIME := LTIME#1S;
    nPeakTorque : DINT := 1000;
    bConfigure : BOOL := TRUE;
    nInDcBusVoltage : UINT;
    nInDcBusCurrent : DINT;
    nInVelocityFeedbackValue : DINT;
    nInTorqueFeedbackValue : INT;
    nInInternalBrakingResistorPower : UINT;
    nInExternalBrakingResistorPower : UINT;
END_VAR
// Get current system time
fbSystemTime.Call();

// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;

    fbEnergy.Configure(fSampleRate, tInterval, nPeakTorque);
END_IF

// Call algorithm
fbEnergy.SetChannelValue(1, nInDcBusVoltage);
fbEnergy.SetChannelValue(2, nInDcBusCurrent);
fbEnergy.SetChannelValue(3, nInVelocityFeedbackValue);
fbEnergy.SetChannelValue(4, nInTorqueFeedbackValue);
fbEnergy.SetChannelValue(5, nInInternalBrakingResistorPower);
fbEnergy.SetChannelValue(6, nInExternalBrakingResistorPower);
fbEnergy.Call(fbSystemTime.tSystemTime);

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics