|TwinCAT PLC Library: IO Functions|
Requirements under NT4, Win2K, WinXP, WinXP embedded:
Requirements under Windows CE:
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 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 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|
|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.|
Not all UPS devices are able to deliver status infomation. Some devices can´t deliver e.g BatteryLifeTime or BatteryReplace-Status.
Online data with status information of UPS:
|Development environment||Target system type||UPS hardware||PLC libraries to include|
|TwinCAT v2.8.0, Build > 745
TwinCAT v2.9.0, Build > 945
( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib are included automatically )