FUNCTION_BLOCK FB_SoEReadDcBusVoltage

FUNCTION_BLOCK FB_SoEReadDcBusVoltage 1:

The functionblock FB_SoEReadDcBusVoltage can be used to read the DC-Bus-Voltage of the amplifier (S-0-0380).  

VAR_INPUT

VAR_INPUT
    NetId   : T_AmsNetId := '';
    Execute : BOOL;
    Timeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

NetId: A string containing the AMS network identifier of the PC.

Execute: The block is activated by a rising edge at this input.

Timeout: Maximum time allowed for the execution of the function block.

VAR_IN_OUT

VAR_IN_OUT
    Axis : AXIS_REF; (* Axis reference *)
END_VAR

Axis: Axis structure (see TcMC2.lib).

VAR_OUTPUT

VAR_OUTPUT
    Busy          : BOOL;
    Error         : BOOL;
    AdsErrId      : UINT;
    SercosErrId   : UINT;
    DcBusVoltage  : REAL;
    Attribute     : DWORD;
END_VAR

Busy: This output is set when the function block is activated and remains set until an acknowledgement is received.

Error: This output is set up after the bBusy output has been reset if there has been an error in transmission of the command.

AdsErrId: Supplies the ADS error code associated with the most recently executed command if the bError output is set.

SercosErrId: Supplies the Sercos error code associated with the most recently executed command if the bError output is set.

Attribute: Supplies the Sercos parameter attribute.

DcBusVoltage: Supplies the DC-Bus-Voltage (i.e. 294.0 means 294.0V).

Sample

fbReadDcBusVoltage : FB_SoEReadDcBusVoltage;
ReadDcBusVoltage   : BOOL;
DcBusVoltage       : REAL;

(* NcAxis *)
Axis            : AXIS_REF;
IF ReadDcBusVoltage THEN
    fbReadDcBusVoltage(
        Axis     := Axis,
        Execute  := TRUE,
        Timeout  := DEFAULT_ADS_TIMEOUT,
        DcBusVoltage=>DcBusVoltage
    );
    IF NOT fbReadDcBusVoltage.Busy THEN
        fbReadDcBusVoltage(Axis:= Axis, Execute := FALSE);
        ReadDcBusVoltage :=FALSE;
    END_IF
END_IF