FUNCTION_BLOCK FB_GetUPSStatus

FUNCTION_BLOCK FB_GetUPSStatus 1:

Requirements:

a) The Beckhoff UPS software components are installed.

b) The UPS has been activated and configured. Further information about the UPS activation and configuration can be found in the considering device and UPS software documentation.

With the FB_GetUPSStatus function block the PLC can read the status of a UPS hardware. The block is level triggered, which means that the status information is only cyclically read while the bEnable input is set. To maintain system loading at a low level, the status information is only read approximately every 4.5 s. When the bValid output is set, the most recently read data is valid. The most recent read cycle was, in other words, executed without error. If an error occurs, the read cycle is repeated, and the error signal is automatically reset as soon as the cause of the error (e.g. no communication with the UPS) has been corrected.

 VAR_INPUT

VAR_INPUT
    sNetId   :T_AmsNetId;  
    nPort    :T_AmsPort;   (* 0 = Windows UPS service / Windows Battery driver  *)
 bEnable     :BOOL;
END_VAR

sNetId: It is possible here to provide the AmsNetId of the TwinCAT computer on which the function to be executed. If it is to be run on the local computer, an empty string can be entered.

nPort: ADS port number. Set this value to zero. Other port numbers are reserved for applications in future.

bEnable: If the input is set, the UPS status is read cyclically.

VAR_OUTPUT

VAR_OUTPUT
    bValid      :BOOL;
    bError      :BOOL;
    nErrId      :UDINT;
    stStatus    :ST_UPSStatus;
END_VAR

bValid: If this output is set the data in the ST_UPSStatus structure are valid (no error occurs at the last read cycle).

bError: This output is set if an error occurs by execution of the function.

nErrId: Supplies the Ads error number or a command specific error code (table) when bError output  is set.

stStatus: Structure with the status information of UPS.

Error codes

Error description

0x0000

no error

0x8001

UPS configuration error. Perhaps the UPS is not configured correctly, or no UPS is configured. 

0x8002

Communication error. The communication to the UPS has been interrupted.

0x8003

Error by reading the status data.

 

FUNCTION_BLOCK FB_GetUPSStatus 2:

Not all UPS devices are able to deliver status infomation. Some devices can´t deliver e.g BatteryLifeTime or BatteryReplace-Status

Example for a call in FBD:

Online data with status information of UPS:

FUNCTION_BLOCK FB_GetUPSStatus 3:

UPS hardware

Target system type

Development environment

PLC libraries to include

  • Beckhoff HID UPS;
  • Beckhoff BAPI v1;
  • Beckhoff P24Vxxxx;
  • Beckhoff CP903x card (PCI/ISA);
  • Beckhoff CX2100-09x4 models (e.g. CX2100-0904 or CX2100-0914 + "Smart Battery" CX2900-0192);
  • With Beckhoff Industrial PC's delivered APC UPS models supporting smart protocol and configured with Windows UPS Service;

PC or CX

TwinCAT v2.8.0, Build > 745

TwinCAT v2.9.0, Build > 945

TcIoFunctions.Lib

( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib are included automatically )

TwinCAT v3.0 and above

Tc2_IoFunctions