FB_WeeklyTimeSwitch

FB_WeeklyTimeSwitch 1:

The two parameters tSwitchOnTime and tSwitchOffTime define a time period during which the output bOutput is to be active. If the timer is only to apply on certain days of the week, this can be set via the inputs bSunday, bMonday, ..., bSaturday. Several time channels can be switched by creating several instances of the function block. Each instance is responsible for one time channel.

VAR_INPUT

bEnable           : BOOL;
tCurrentDateTime  : DATE_AND_TIME;
tSwitchOnTime     : TOD;
tSwitchOffTime    : TOD;
bSunday           : BOOL;
bMonday           : BOOL;
bTuesday          : BOOL;
bWednesday        : BOOL;
bThursday         : BOOL;
bFriday           : BOOL;
bSaturday         : BOOL;

bEnable: Function block enable.

tCurrentDateTime: current date and time.

tSwitchOnTime: switch-on time.

tSwitchOffTime: switch-off time.

bSunday: consider timer on Sundays.

bMonday: consider timer on Mondays.

bTuesday: consider timer on Tuesdays.

bWednesday: consider timer on Wednesdays.

bThursday: consider timer on Thursdays.

bFriday: consider timer on Fridays.

bSaturday: consider timer on Saturdays.

VAR_OUTPUT

bOutput           : BOOL;
bEdgeOn           : BOOL;
bEdgeOff          : BOOL;

bOutput: output becomes TRUE if the current time is between the switch-on time and the switch-off time.

bEdgeOn: the output is set to TRUE for one PLC cycle when the time channel becomes active.

bEdgeOff: the output is set to TRUE for one PLC cycle when the time channel becomes deactivated.

Example

In the following example, the blinds are to be raised at 6.30 a.m. at weekends and lowered at 7.00 p.m. The two timer outputs bEdgeOn and bEdgeOff are linked to the inputs bUp and bDown of the blind function block. The pulses from the outputs then trigger raising or lowering of the blinds at the specified time.

FB_WeeklyTimeSwitch 2:

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4020.32

Tc2_BABasic from v3.1.0.0