
SecondsUPS
eUpsMode:E_S_UPS_Mode:=eSUPS_WrPersistData_Shutdown;(*UPSmode(w/wowritingpersistent
data,w/woshutdown)*)
ePersistentMode:E_PersistentMode:=SPDM_2PASS;(*modeforwritingpersistentdata*)
tRecoverTime:TIME:=T#10s;(*ONtimetorecoverfromshortpowerfailureinmode
eSUPS_WrPersistData_NoShutdown/eSUPS_CheckPowerStatus*)
END_VAR
E_S_UPS_Mode
sNetID:AmsNetIDofthecontroller.
iPLCPort:PortnumberofthePLCruntimesystem(AMSPORT_R0_PLC_RTS1=801,
AMSPORT_R0_PLC_RTS2=811,AMSPORT_R0_PLC_RTS3=821,AMSPORT_R0_PLC_RTS4=831).
iUPSPort:PortnumberviawhichtheUPSstatusisread(standardvalueis16#4A8).
tTimeout:TimeoutfortheexecutionoftheQuickShutdown.
eUpsMode:TheeUpsModedefineswhetherpersistentdataaretobewrittenandwhethera
QuickShutdownistobeperformed.
StandardvalueiseSUPS_WrPersistData_Shutdown,i.e.withwritingofthepersistentdataandthen
QuickShutdown.SeeE_S_UPS_Mode.
ePersistentMode:Modeforthewritingofthepersistentdata.StandardvalueisSPDM_2PASS.
tRecoverTime:TimeafterwhichtheUPSrevertstothePowerOKstatusinthecaseofUPSmodeswithout
shutdown.
ThetRecoverTimemustbesomewhatlongerthanthemaximumholdingtimeoftheUPS,sincetheUPS
switchesoffevenwhenthevoltagereturns.
VAR_OUTPUT
VAR_OUTPUT
bPowerFailDetect:BOOL;(*TRUEwhilepowerfailureisdetected*)
eState:E_S_UPS_State;(*currentupsstate*)
END_VAR
E_S_UPS_State
bPowerFailDetect:Trueduringthepowerfailure;Falseifthesupplyvoltageispresent.
eState:Internalstateofthefunctionblock,forvaluesseeE_S_UPS_State.
VAR_GLOBAL
VAR_GLOBAL
eGlobalSUpsState:E_S_UPS_State;(*currentupsstate*)
END_VAR
E_S_UPS_State
eGlobalUpsState:InternalstateofthefunctionblockasaglobalcopyoftheVAR_OUTPUTeState;for
valuesseeE_S_UPS_State.
Prerequisites
Developmentenvironment Targetplat
form
Hardware PLClibrariestoinclude
TwinCATv2.11R3Build2047orhigher
TwinCAT3.1Build4018orhigher
PC(i386) SecondsUPS TcSUPS_CX51x0.Lib
CX51x0 23Version1.0
Commenti su questo manuale