State information

Here you can find the different ways to access the UPS status information from your application.

Control panel Power Options state information

State information 1:

The Power Options dialog in the Control Panel shows the status of the external power supply and the remaining battery capacity.

State information 2:

 

Control panel UPS Configuration state information

Newer image includes simple control panel configuration applet. The dialog shows actual UPS configuration and state information.

It allows the configuration of max. time (seconds or minutes) on batteries before critical alarm. The UPS driver will issue a critical alarm after the set time, and will shut down the PC. The critical alarm may, however, be issued earlier if the battery capacity is exhausted

 

State information 3:

 

State information 4:

 

Status information at the Beckhoff UPS Configuration dialog:

Vendor: UPS vendor name.

Model: UPS/Power supply model string.

 

Current power source: Current power source. Permitted values: ONLINE, OFFLINE; BACKUP POWER, UNKNOWN.

Battery charge status: Current battery charge state. Permitted values: HIGH, LOW, CRITICAL, NO BATTERY, CHARGING, UNKNOWN.

Battery load level: Current percental battery charge state [%].

Estimated UPS runtime: Estimated/calculated remaining battery runtime.

Temperature: Temperature of UPS electronic circuit.

Voltage: Charge or discharge voltage [mV]

Current: Charge or discharge current [mA].

Flags: Additional information implemented in the dialog version >= 1.0.3. Permitted values (may occur simultaneously):

Power fail counter: Power fail counter. Implemented in the dialog version >= 1.0.3. Counts the power fails starting at device reset.

 

Max. time on battery before critical alarm: Max. time on battery before critical alarm. The UPS driver will issue a critical alarm after the set time and will shut down the PC. The critical alarm may, however, be issued earlier if the battery capacity is exhausted.

 

About: Shows dialog version information.

 

Windows CE API state information

Windows CE applications can access the UPS status information cyclically via the GetSystemPowerStatusEx2 API function call.

DWORD GetSystemPowerStatusEx2(
  PSYSTEM_POWER_STATUS_EX2 pSystemPowerStatusEx2,
  DWORD dwLen, 
  BOOL fUpdate
);

 

typedef struct _SYSTEM_POWER_STATUS_EX2 {
  BYTE ACLineStatus;
  BYTE BatteryFlag;
  BYTE BatteryLifePercent;
  BYTE Reserved1;
  DWORD BatteryLifeTime;
  DWORD BatteryFullLifeTime;
  BYTE Reserved2;
  BYTE BackupBatteryFlag;
  BYTE BackupBatteryLifePercent;
  BYTE Reserved3;
  DWORD BackupBatteryLifeTime;
  DWORD BackupBatteryFullLifeTime;
  DWORD BatteryVoltage;
  DWORD BatteryCurrent;
  DWORD BatteryAverageCurrent;
  DWORD BatteryAverageInterval;
  DWORD BatterymAHourConsumed;
  DWORD BatteryTemperature;
  DWORD BackupBatteryVoltage;
  BYTE BatteryChemistry;
  //  Add any extra information after the BatteryChemistry member.
} SYSTEM_POWER_STATUS_EX2, *PSYSTEM_POWER_STATUS_EX2, *LPSYSTEM_POWER_STATUS_EX2;

 

Please note that not all parameters are supported by the Beckhoff UPS. The main member variables include:

ACLineStatus: Status of the external power supply.

BatteryLifePercent: Battery charge status in percent.

BatteryLifeTime: Remaining battery capacity.

Further information about this API function can be found in the Microsoft online documentation.

State information in the TwinCAT PLC

State information 5:

A TwinCAT PLC application can access the UPS status information in read mode via function block FB_GetUPSStatus. Detailed documentation of the function block can be found here: FB_GetUPSStatus.