FB_SoEAX5000ReadActMainVoltage_ByDriveRef

FB_SoEAX5000ReadActMainVoltage_ByDriveRef 1:

The current peak value of the mains voltage for the AX5000 (P-0-0200) can be read with the FB_SoEAX5000ReadActMainVoltage_ByDriveRef function block.

FB_SoEAX5000ReadActMainVoltage_ByDriveRef 2: Inputs

VAR_INPUT
    stDriveRef : ST_DriveRef; 
    bExecute   : BOOL; 
    tTimeout   : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

Name

Type

Description

stDriveRef

ST_DriveRef

Reference to the drive. The reference to the drive can be linked directly to the PLC in the System Manager. To do this, an instance of the structure ST_PlcDriveRef must be allocated and the NetID must be converted from the byte array into a string (Type: ST_DriveRef).

bExecute

BOOL

The function block is activated by a positive edge at this input.

tTimeout

TIME

Maximum time allowed for the execution of the function block.

FB_SoEAX5000ReadActMainVoltage_ByDriveRef 3: Outputs

VAR_OUTPUT
    bBusy              : BOOL;
    bError             : BOOL;
    iAdsErrId          : UINT;
    iSercosErrId       : UINT;
    dwAttribute        : DWORD;
    fActualMainVoltage : REAL;
END_VAR

Name

Type

Description

bBusy

BOOL

This output is set when the function block is activated, and remains set until feedback is received.

bError

BOOL

This output is set after the bBusy output has been reset when an error occurs in the transmission of the command.

iAdsErrId

UINT

Returns the ADS error code of the last executed command when the bError output is set.

iSercosErrId

UINT

Returns the Sercos error of the last executed command in the event of a set bError output.

dwAttribute

DWORD

Returns the attributes of the Sercos parameter.

fActualMainVoltage

REAL

Returns the peak value of the current mains voltage of the AX5000 (e.g. 303.0 corresponds to 303.0 V).

Sample

fbReadActMainVoltage : FB_SoEAX5000ReadActMainVoltage_ByDriveRef;
bReadActMainVoltage  : BOOL;
fActualMainVoltage   : REAL;
stPlcDriveRef AT %I* : ST_PlcDriveRef;
stDriveRef : ST_DriveRef;

IF bInit THEN
    stDriveRef.sNetId := F_CreateAmsNetId(stPlcDriveRef.aNetId);
    stDriveRef.nSlaveAddr := stPlcDriveRef.nSlaveAddr;
    stDriveRef.nDriveNo   := stPlcDriveRef.nDriveNo;
    stDriveRef.nDriveType := stPlcDriveRef.nDriveType;
    IF (stDriveRef.sNetId <> '') AND(stDriveRef.nSlaveAddr <> 0)THEN
        bInit := FALSE;
    END_IF
END_IF

IF bReadActMainVoltage AND NOT bInit
   THEN fbReadActMainVoltage(
        stDriveRef := stDriveRef,
        bExecute := TRUE,
        tTimeout := DEFAULT_ADS_TIMEOUT,
        fActualMainVoltage=>fActualMainVoltage
       );
   IF NOT fbReadActMainVoltage.bBusy THEN
       fbReadActMainVoltage(stDriveRef := stDriveRef, bExecute := FALSE);
       bReadActMainVoltage := FALSE;
   END_IF
END_IF