FB_BARStairwellAutomatic

FB_BARStairwellAutomatic 1:

Function block for a stairwell light circuit.

The function block knows 3 different modes, which can be set via the input uiLightCtrlMode:

The stairwell control is active in automatic mode (uiLightCtrlMode=0) . A positive edge on bSwitch initially only switches the light on (output bOn). A negative edge starts the holding time generator. If the holding time uiHoldTime [s] has expired, a flash sequence with a number of flash pulses programmable by uiNumberPulses begins as a warning of the impending switch-off. These pulses have an on-time of uiPulseTimeOn [ms] and an off-time of uiPulseTimeOff [ms].

FB_BARStairwellAutomatic 2:

The sequence can be restarted at any time:

FB_BARStairwellAutomatic 3:

The bSwitch input has no function in the manual modes: the output value bOn is set constantly to TRUE if uiLightCtrlMode=1 and constantly to FALSE if uiLightCtrlMode=2.

FB_BARStairwellAutomatic 4:

Manual mode

Changing to manual mode resets any lighting sequence that had started up to that point.

VAR_INPUT

eDataSecurityType   : E_HVACDataSecurityType;
uiLightCtrlMode     : UINT;
bSwitch             : BOOL;

eDataSecurityType: If eDataSecurityType:= eHVACDataSecurityType_Persistent, the persistent VAR_IN_OUT variables of the function block are stored in the flash of the computer if a value changes. For this to work, the function block FB_HVACPersistentDataHandling must be instanced once in the main program, which is called cyclically. Otherwise the instanced FB is not released internally.

A change of value can be initiated by the building management system, a local operating device or via a write access from TwinCAT. When the computer is restarted the saved data are automatically read back from the flash into the RAM.

Application example: example_persistent.zip

If eDataSecurityType:= eHVACDataSecurityType_Idle the persistently declared variables are not saved in a fail-safe manner.

Notice

A cyclically changing variable must never be linked with the IN_OUT variable of a function block, if eDataSecurityType:= eHVACDataSecurityType_Persistent. It would lead to early wear of the flash memory.

uiLightCtrlMode: Operation mode.

bSwitch:  A rising edge switches the light on in automatic mode (uiLightCtrlMode=0), a falling edge starts the holding time generator. This input has no function in manual operation mode (uiLightCtrlMode=1 or 2).

VAR_OUTPUT

lrDimValue          : LREAL;
bOn                 : BOOL;
uiRemainingHoldTime : UINT;
bError              : BOOL;
udiErrorId          : UDINT;

lrDimValue: In order to keep this function the same as the other light user functions, a light output value exists here too in the form of a floating point number in percent, even though the light is only switched on or off. This means: light off: lrDimValue = 0.0, light on: lrDimValue = 100.0.

bOn: Switch output for the lighting.

uiRemainingTimeHold: Remaining holding time in seconds. If the light is off or if manual operation mode is active, then this output is "0". With a rising edge on bSwitch in automatic mode, this output initially indicates the complete number of seconds of the holding time (uiHoldTime), in order to illustrate the countdown of the holding time, starting with a falling edge on bSwitch. This output is 0 as long as no countdown of the time is taking place.

bError: This output is switched to TRUE if the parameters entered are erroneous.

udiErrorId: Contains the error code if the values entered should be erroneous. See Error codes.

VAR_IN_OUT

uiHoldTime      : UINT;
uiPulseTimeOn   : UINT;
uiPulseTimeOff  : UINT;
uiNumberPulses  : UINT;

In order for the registered parameters to be retained beyond a controller failure, it is necessary to declare them as In-Out variables. A reference variable is then assigned to them in the program. Each change of the value of these reference variables is persistently stored in the function block and written back to the reference variable following a controller failure and restart. If the parameters were only to be defined as input variables, they would not be able to write a reference variable.
Application example: example_persistent.zip.

uiHoldTime: Holding time [s] of the stairwell controller after a falling edge on bSwitch.

uiPulseTimeOn: ON-time of the early warning pulses in milliseconds.

uiPulseTimeOff: OFF-time of the early warning pulses in milliseconds.

uiNumberPulses: Number of early warning pulses.

Requirements

Development environment

required library

required function

TwinCAT 3.1 build 4022.16 or higher

Tc2_HVAC V3.3.1.0

TF8000 | TC3 HVAC V1.0.0.0