FB_Dimmer2SwitchEco

FB_Dimmer2SwitchEco 1:

This function block is a memory-saving variant of FB_Dimmer2Switch(). It does not have the special functions "Set brightness value" and "Switch off memory function", which may not be required for many applications. Moreover, the values nOutMin and nOutMax of the FB_Dimmer2Switch() are set internally here to 0 and 32767 respectively. This output span corresponds to the display range of an analog output terminal. The tPLCCycle input is important. This time is used to calculate internally the amount by which the nOut output must be increased per cycle - that saves additional time calculations.

Operation by means of the bSwitchDimmUp and bSwitchDimmDown inputs

The light is switched on or off by a short signal at the bSwitchDimmUp or bSwitchDimmDown inputs. Dimmer mode will be activated if the signal remains for longer than tSwitchOverTime (typical recommended value: 200ms). The output signal goes to nOutMin or nOutMax. When the signal is once more removed, the output signal being generated at that time is retained. Another pulse at one of the inputs will set the output to 0.

Operation by means of the bOn and bOff inputs

The light is immediately switched on or off if a positive edge is applied to the bOn or bOff inputs. For example, for global on/off functions. The output value is set to 0 when switching off.

The memory function

In contrast to FB_Dimmer2Switch(), where the memory function can be activated or deactivated via the input bMemoryModeOn , the memory function is always active in this memory-saving version. This means that the last-set value is adopted as the brightness value when switching on. It is irrelevant, in this case, whether the light it has been switched on by means of the bOn input or one of the bSwitchDimmUp or bSwitchDimmDown inputs.

Comment on the tSwitchOverTime parameter

If a duration of 0 is specified for the parameter tSwitchOverTime, the bSwitchDimmUp and bSwitchDimmDown inputs can only be used to dim the light. Switching on and off is only possible with the bOn and bOff inputs.

VAR_INPUT

bSwitchDimmUp      : BOOL;
bSwitchDimmDown    : BOOL;
bOn                : BOOL;
bOff               : BOOL;
tSwitchOverTime    : TIME := t#500ms;
tDimmTime          : TIME := t#5s;
tPLCCycle          : TIME := t#10ms;

bSwitchDimmUp: Switches or dims the output Up.

bSwitchDimmDown: Switches or dims the output Down.

bOn: Switches the output to the last output value.

bOff: Switches the output to 0.

tSwitchOverTime: Time for switching between the light on/off and dimming functions for the bSwitchDimmUp and bSwitchDimmDown inputs.

tDimmTime: Time required for dimming to go from its minimum value to its maximum value.

tCycleDelay: Delay time, if either the minimum or maximum value is reached.

tPLCCycle: the set PLC cycle time.

VAR_OUTPUT

nOut               : UINT;
bLight             : BOOL;

nOut: analog output value.

bLight: digital output value. This is set if nOut is greater than 0.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4020.32

Tc2_BABasic from v3.1.0.0