FB_GetUPSStatus

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_UPS status structure are valid (no error occurred during the last reading cycle).

bError: this output is set if an error occurred when executing the function.

nErrId: supplies the ADS error number or the command-specific error code (table) when the bError output is set.

stStatus: structure with the status information of the UPS.

Error Codes

Error description

0x0000

No error

0x8001

UPS configuration error. It is possible that the UPS is not configured correctly or that no UPS is configured at all.

0x8002

Communication error. Communication with the UPS was interrupted. 

0x8003

Error during the reading of the status data.

 

FB_GetUPSStatus 2:

Not every UPS device can supply all the status information.  Some devices, for example, cannot supply the BatteryLifeTime or BatteryReplace status.

Example for a call in FBD:

Online data with status information of UPS:

FB_GetUPSStatus 3:

Requirements

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