3 twincat plc ups interface, 1 function_block fb_getupsstatus – BECKHOFF CX2100­09x4 User Manual

Page 68

Advertising
background image

Commissioning

5.3

TwinCAT PLC UPS interface

5.3.1

FUNCTION_BLOCK FB_GetUPSStatus

Fig. 1: FB_GetUpsStatus

Requirements under NT4, Win2K, WinXP, WinXP embedded: 

• The Beckhoff UPS software components are installed (additional tab under Control Panel­>Energy

Options­>Beckhoff UPS Configuration );.

• The UPS has been configurated with the Windows UPS service ( Control Panel­>Energy Options­

>UPS ) or the Beckhoff Shell extension ( Control Panel­>Energy Options­>Beckhoff UPS
Configuration
 ). Further information about the UPS configuration can be found in the considering
documentation.

Requirements under Windows CE:

• Beckhoff CE devices with 24 V UPS service are delivered with a special Beckhoff Battery Driver for

Windows CE. The driver is included in the standard CE Image. No further configuration settings are
required.

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

ST_UPSStatus [

}

 70]

CX2100­09x4

68

Version 1.1

Advertising