FB_DailyScheduler

Function block for triggering actions every nth day of the year.

FB_DailyScheduler 1:

FB_DailyScheduler 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;
eStartEnd        : ENUM;
stStartEnd       : TIMESTRUCT;
stSystemtime     : TIMESTRUCT;

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

uiBegin: Start value for the day counter. May be within the range 1 to 365. Example: uiPeriodicity = 5, uiBegin = 2: Switching events on 2 Jan., 7 Jan. 12 Jan. etc. - uiPeriodicity = 3, uiBegin = 1: Switching events on 1 Jan., 4 Jan. 7 Jan. etc.

eStartEnd: Selection of start/end definition.

TYPE E_StartEnd : ( eSTARTTIME_ENDTIME := 1, eSTARTTIME_DURATION := 2, eSTARTTIME_ENDEVENT := 3, eSTARTEVENT_ENDTIME := 4, eSTARTEVENT_DURATION := 5, eSTARTEVENT_ENDEVENT := 6 ); END_TYPE

eSTARTTIME_ENDTIME: Selection of start/end time. If the start time is equal or greater the end time, the end is allocated to the next day.

eSTARTTIME_DURATION: Selection of start time/duration.

eSTARTTIME_ENDEVENT: Selection of start time/end event.

eSTARTEVENT_ENDTIME: Selection of start event/end time. If the start time is equal or greater the end time, the end is allocated to the next day.

eSTARTEVENT_DURATION: Selection of start event/duration.

eSTARTEVENT_ENDEVENT: Selection of start event/end event.

stStartEnd: Structure with the parameters defining the start and end. Unused variables are ignored internally, e.g. the duration for the selection of start/end time.

TYPE ST_StartEnd : STRUCT todStartTime : TOD; bStartEvent : BOOL; tDuration : TIME; todEndTime : TOD; bEndEvent : BOOL; END_STRUCT END_TYPE

todStartTime: Start time.

bStartEvent: Start event

tDuration: Switching duration.

todEndTime: End time.

bEndEvent: End event.

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 used to detect 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.