FB_CXSimpleUps

FB_CXSimpleUps 1:

The function block FB_CXSimpleUps can be used on the CX1000 or the CX1020 to handle the UPS CX1190-UPS from the PLC. In this case the UPS settings in the TwinCAT System Manager have to be deactivated.

FB_CXSimpleUps 2:

VAR_INPUT

VAR_INPUT
    bDIPDisable     : BOOL;
    iDischargeLevel : USINT;
    tDelay          : TIME;
END_VAR

bDIPDisable: If TRUE, then the orientation of the '1-2-3..8-9-0' switch on the UPS is ignored, in this case the iDischargeLevel is used instead.

iDischargeLevel: Discharge Switch Off Level: 0 = 100% (Maximum Discharge), 9 = 90%, 8 = 80%, ..., 2 = 20%, 1 = 10% (Minimum Discharge).

tDelay: Holding time, time before the Shutdown is executed. This time is used to overcome short power outages (up to 10s) without shutdown. Once the holding time is elapsed, the FB finishes the holding period and waits internally for additional 2.5s. If the power has returned by then, the FB continues with normal run mode, otherwise the powerfail shutdown is executed. If the power returns during or after the shutdown, then the CX reboots after discharging and recharging the UPS.

VAR_OUTPUT

VAR_OUTPUT
    bPowerFailure       : BOOL;
    bShutdownActive     : BOOL;
    bUpsReady           : BOOL;
    b24VInOK            : BOOL;
    bHolding            : BOOL;
    tTimeUntilShutdown  : TIME;
    eUpsState           : E_UPS_STATE;
END_VAR

bPowerFailure: Gets TRUE, if a power failure of the power supply is detected, gets FALSE, if the power supply is restored.

bShutdownActive: Gets TRUE, if a Stop or Shutdown is being executed.

bUpsReady: Gets TRUE, if the UPS supplies the voltage.

b24VInOK: Gets TRUE, if the power supply supplies the UPS with 24V.

bHolding: Gets TRUE, if a power failure of the power supply is detected, and the holding time has not yet elapsed.

tTimeUntilShotdown: Shows the time until the system shuts down after a power fault.

eUpsState: Shows the status of the UPS [UNDEF | CHARGING | CHARGED | DISCHARGE | DISCHARGE_RESTART | OUTPUT_OFF | OVERLOAD].

VAR_CONFIG

VAR_CONFIG
    Ii24VState AT %I*       : BYTE;
    IiChargeState AT %I*    : USINT;
    QiControl AT %Q*        : BYTE;
    QiDIPControl AT %Q*     : USINT;
END_VAR

Ii24VState: Needs to be linked to input '24V State', see picture above.

IiChargeState: Needs to be linked to input 'Charge State', see picture above.

QiControl: Needs to be linked to output 'Contol', see picture above.

QiDIPControl: Needs to be linked to output 'DIP Ctrl', see picture above.