1-second UPS (persistent data)
CX52x0
56
Version: 1.0
8.3
FB_S_UPS_BAPI
The function block FB_S_UPS_BAPI can be used on devices with 1-second UPS and with BIOS-API from
version v1.15, in order to control the 1-second UPS from the PLC.
When the function block is first called, the data for accessing the 1-second UPS are determined via BIOS-
API. This process takes several cycles. This is followed by cyclic testing for power failure. When the
persistent data are written next, the access data for the PLC are saved persistently, so that during
subsequent boot operations the check for power failures can take place immediately after the PLC start.
In the event of a power failure the charge state of the 1-second UPS is checked every 50 ms, every 200 ms
if voltage is present and the capacity is less than 90%, and every second if voltage is present and the
capacity is more than 90%. This also takes place via BIOS-API access.
In the event of a power failure the function block FB_S_UPS_BAPI can be used to save the persistent data
and/or execute a quick shutdown, depending on the selected mode. The default input values of the
FB_S_UPS_BAPI should be retained.
The 1-second UPS does not have sufficient capacity for bridging power failures. Only the Compact Flash/
CFast card/Micro SD can be used for data storage, in view of the fact that the UPS capacity is not sufficient
for operating a hard disk.
The 1-second UPS can be used only for a few seconds in the event of a power failure in order, to save
persistent data. The data must be saved in the fast “persistent mode” “SPDM_2PASS”, even though this can
lead to real-time violations. Make sure you configure adequate router memory for saving the persistent data.
Regardless of the mode and therefore irrespective of whether data were saved or a quick shutdown was
performed, the UPS switches off the mainboard after the capacitors have been discharged, even if the
voltage has returned in the meantime.
NOTE
Loss of data
If other applications or the PLC keep further files open or write to them, file errors may occur if the 1-second
UPS switches off the controller.
Function block modes
A QuickShutdown is performed automatically in the eSUPS_WrPersistData_Shutdown mode (standard
setting) after the storage of the persistent data.
In the eSUPS_WrPersistData_NoShutdown mode only the persistent data are saved, no QuickShutdown is
performed.
In eSUPS_ImmediateShutdown mode a quick shutdown is executed immediately, without saving data.
In the eSUPS_CheckPowerStatus mode only a check is performed as to whether a power failure has
occurred. If this is the case, the function block only switches back to the PowerOK state after the expiry of
tRecoverTime (10s).
VAR_INPUT
VAR_INPUT
sNetID : T_AmsNetId:= ''; (* '' = local netid *)
iPLCPort : UINT := 0; (* PLC Runtime System for writing persistent data *)
tTimeout : TIME := DEFAULT_ADS_TIMEOUT; (* ADS Timeout *)
eUpsMode : E_S_UPS_Mode := eSUPS_WrPersistData_Shutdown; (* UPS mode (w/
wo writing persistent data, w/wo shutdown) *)
ePersistentMode : E_PersistentMode := SPDM_2PASS; (* mode for writing persistent data *)