FB_WeeklyScheduler

FB_WeeklyScheduler 1:

Function block for triggering actions on certain weekdays in each n-th week of the year.

FB_WeeklyScheduler 2:

The function block triggers switching when the switching time is passed. Subsequent modification of the switching events or the time is therefore not permitted.

VAR_INPUT

uiPeriodicity     : UINT;
uiBegin           : UINT;
arrActiveWeekday  : ARRAY[0..6] OF BOOL;
eStartEnd         : E_StartEnd;
stStartEnd        : ST_StartEnd;
stSystemtime      : TIMESTRUCT;

uiPeriodicity: Periodicity or interval. May be within the range 1...52.

uiBegin: Starting value for the week. May be within the range 1...52.

Example1:
uiPeriodicity = 5,
uiBegin = 2: Switching events in week 2, week 7, week 12 etc.

Example 2:
uiPeriodicity = 3,

uiBegin = 1: Switching events in week 1, week 4, week 7 etc.

arrActiveWeekday: Day of the week on which switching is to take place - arrActiveWeekday[0] => Sunday .. arrActiveWeekday[6] => Saturday. Multiple selections are possible.

eStartEnd: Selection of the start/end definition (see E_StartEnd).

stStartEnd: Structure with the parameters defining the start and end. Unused variables, for example the duration for the selection of start/end time, are ignored internally (see ST_StartEnd).

stSystemtime: Current time in TIMESTRUCT format. It is important to count every second.

VAR_OUTPUT

bOut              : BOOL;
bTriggerOn        : BOOL;
bNoEventNextYear  : BOOL;
bError            : BOOL;
nErrorId          : UDINT;

bOut: Control output that is switched on or off by the start and end event.

bTriggerOn: Trigger output for switch-on events. This output is intended for logging switch-on events. If two switch-on events occur consecutively they would not be detected via the control output bOut, since this output would remain TRUE. See also time overlaps in the overview.

bNoEventNextYear: No day matching the parameterization was found within the next 366 days.

bError: This output is set to TRUE if the parameterization is faulty. The command-specific error code is contained in nErrorId. Reset to FALSE once the parameterization is correct.

nErrorId: Contains the command-specific error code. Reset to 0 once the parameterization is correct. See Error codes.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4020.32

Tc2_BABasic from v3.1.0.0