1-second UPS (persistent data)
CX52x0
57
Version: 1.0
tRecoverTime : TIME := T#10s; (* ON time to recover from short power failure in mode eSUPS_Wr
PersistData_NoShutdown/eSUPS_CheckPowerStatus *)
END_VAR
sNetID
: AmsNetID of the controller (type: T_AmsNetID)
iPLCPort
: Port number of the PLC runtime system (851 for the first PLC runtime system, 852 for the second
PLC runtime system, …). If no port number is specified, iPLCPort is 0. The function block then automatically
determines the port of the PLC runtime system.
tTimeout
: Timeout for writing of the persistent data or the quick shutdown.
eUpsMode
: Defines whether persistent data are to be written and whether a quick shutdown is to be
executed. The default value is eSUPS_WrPersistData_Shutdown, i.e. a quick shutdown is executed
automatically once the persistent data have been saved. (Type: E_S_UPS_Mode)
ePersistentMode
: Mode for the writing of the persistent data. Default value is SPDM_2PASS.
tRecoverTime
: Time after which the UPS returns to PowerOK state in UPS modes without quick shutdown.
The tRecoverTime must be greater than the maximum charging time of the UPS, otherwise the UPS may
discharge too much in the event of short, consecutive power failures, which could result in the charge being
insufficient for storing the persistent data.
VAR_OUTPUT
VAR_OUTPUT
bPowerFailDetect : BOOL; (* TRUE while powerfailure is detected *)
eState : E_S_UPS_State; (* current ups state *)
nCapacity : BYTE; (* actual capacity of UPS *)
bBusy : BOOL; (* TRUE: function block is busy *)
bError : BOOL; (* FALSE: function block has error *)
nErrID : UDINT; (* FB error ID *)
END_VAR
bPowerFailDetect
: TRUE during power failure. FALSE if the supply voltage is present.
eState
: Internal state of the function block (type: E_S_UPS_State)
nCapacity
: Current charge state of the capacitors in percent (0..100%)
bBusy:
TRUE, as long as the function block is active.
bError:
FALSE if an error has occurred.
nErrID:
Error number
Requirements
Development environment
Target platform
PLC libraries to include
TwinCAT v3.1 B4020.32
Platforms that support the BIOS
API from v1.15
Tc2_SUPS
8.4
Mode and status of the function block
E_S_UPS_Mode
With the mode selected in the function block you can specify what should happen in the case of a power
failure.
eSUPS_WrPersistData_Shutdown: Writing of persistent data and then a QuickShutdown
eSUPS_WrPersistData_NoShutdown: Only writing of the persistent data (no QuickShutdown)
eSUPS_ImmediateShutdown: Only QuickShutdown (no writing of persistent data)
eSUPS_CheckPowerStatus: Only check status (neither writing of persistent data nor a QuickShutdown)