Programming
CX8030 / CX8031 51Version: 1.6
VAR_INPUT
VAR_INPUT
sNetID:T_AmsNetId:='';(*''=localnetid*)
iPLCPort:UINT:=AMSPORT_R0_PLC_RTS1;(*PLCRuntimeSystemforwritingpersis-
tentdata*)
iUPSPort:UINT:=16#4A8;(*PortforreadingPowerStateofUPS,dafault16#4A8*)
tTimeout:TIME:=DEFAULT_ADS_TIMEOUT;(*ADSTimeout*)
eUpsMode:E_S_UPS_Mode:=eSUPS_WrPersistData_Shutdown;(*UPSmode(w/wowritingpersis-
tentdata,w/woshutdown)*)
ePersistentMode:E_PersistentMode:=SPDM_2PASS;(*modeforwritingpersistentdata*)
tRecoverTime:TIME:=T#10s;(*ONtimetorecoverfromshortpowerfail-
ureinmodeeSUPS_WrPersistData_NoShutdown/eSUPS_CheckPowerStatus*)
END_VAR
E_S_UPS_Mode
sNetID : AmsNetID of the controller.
iPLCPort : Port number of the PLC runtime system (AMSPORT_R0_PLC_RTS1 = 801,
AMSPORT_R0_PLC_RTS2 = 811, AMSPORT_R0_PLC_RTS3 = 821, AMSPORT_R0_PLC_RTS4 = 831).
iUPSPort : Port number via which the UPS status is read (standard value is 16#4A8).
tTimeout : Timeout for the execution of the QuickShutdown.
eUpsMode: The eUpsMode defines whether persistent data are to be written and whether a
QuickShutdown is to be performed.
Standard value is eSUPS_WrPersistData_Shutdown, i.e. with writing of the
persistent data and then QuickShutdown. See E_S_UPS_Mode.
ePersistentMode: Mode for the writing of the persistent data. Standard value is SPDM_2PASS.
SPDM_2PASS, all persistent data are saved at once, which can lead to the cycle
time being exceeded.
SPDM_VAR_BOOST, here, each persistent variable is written separately; if there is
a large amount of persistent data this can accordingly take many cycles. This is not recommended as some
data may be lost if the time of the seconds UPS is not sufficient.
tRecoverTime: Time after which the UPS reverts to the PowerOK status in the case of UPS modes
without shutdown.
The tRecoverTime must be somewhat longer than the maximum holding time of the
UPS, since the UPS switches off even when the voltage returns.
VAR_OUTPUT
VAR_OUTPUT
bPowerFailDetect:BOOL;(*TRUEwhilepowerfailureisdetected*)
eState:E_S_UPS_State;(*currentupsstate*)
END_VAR
E_S_UPS_State
bPowerFailDetect: True during the power failure; False if the supply voltage is present.
eState : Internal state of the function block, for values see E_S_UPS_State.
VAR_GLOBAL
VAR_GLOBAL
eGlobalSUpsState:E_S_UPS_State;(*currentupsstate*)
END_VAR
E_S_UPS_State
eGlobalUpsState: Internal state of the function block as a global copy of the VAR_OUTPUT eState; for
values see E_S_UPS_State.