FB_SoEReadMotorTemperature

FB_SoEReadMotorTemperature 1:

With the function block FB_SoEReadMotorTemperature the temperature of the motor (S-0-0383) can be read. If the motor does not contain a temperature sensor, this is 0.0, i.e. 0.0 °C.

FB_SoEReadMotorTemperature 2: Inputs

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

Name

Type

Description

NetId

T_AmsNetID

String which contains the AMS Network ID of the PC (type: T_AmsNetId).

Execute

BOOL

The function block is enabled via a positive edge at this input.

Timeout

TIME

Maximum time allowed for the execution of the function block.

FB_SoEReadMotorTemperature 3: Inputs/outputs

VAR_IN_OUT
   Axis : AXIS_REF;
END_VAR

Name

Type

Description

Axis

AXIS_REF

Axis data structure that unambiguously addresses an axis in the system. Among other parameters it contains the current axis status, including position, velocity or error state.

FB_SoEReadMotorTemperature 4: Outputs

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

Name

Type

Description

Busy

BOOL

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

Error

BOOL

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

AdsErrId

UINT

In the case of a set Error output returns the ADS error code of the last executed command.

SercosErrId

UINT

In the case of a set Error output returns the Sercos error of the last executed command.

MotorTemperature

REAL

Returns the motor temperature (e.g. 30.5 corresponds to 30.5 °C). If the motor does not contain a temperature sensor, this is 0.0, i.e. 0.0 °C.

Attributes

DWORD

Returns the attributes of the Sercos parameter.

Sample

fbReadMotorTemp  : FB_SoEReadMotorTemperature;
ReadMotorTemp    : BOOL;
MotorTemperature : REAL;
(* NcAxis *)
Axis             : AXIS_REF; 

IF ReadMotorTemp THEN
 fbReadMotorTemp(
    Axis            := Axis,
    Execute         := TRUE,
    Timeout         := DEFAULT_ADS_TIMEOUT,
    MotorTemperature => MotorTemperature
 );
 IF NOT fbReadMotorTemp.Busy THEN
    fbReadMotorTemp(Axis := Axis, Execute := FALSE);
    ReadMotorTemp := FALSE;
 END_IF
END_IF