Clock7d2Ch

Clock7d2Ch (FB)

FUNCTION_BLOCK Clock7d2Ch

Short description

Time switch with 7 weekdays, two on/off times each and a binary overall output. The operating mode (on period or off period) can be defined per weekday. Typical application: Definition of night/day operation of a zone temperature control

Representation

Interfaces

Inputs

Name
Data type
Value range
Initial value
Function

xEn

BOOL

Enable input

Outputs

Name
Data type
Value range
Initial value
Function

xActive

BOOL

Display of active switching periods

todActivatedFrom

TOD

On time 1 of the current weekday

todActivatedTo

TOD

Off time 2 of the current weekday

Setpoints / Parameters

Name
Data type
Value range
Initial value
Function

todMonFrom1

TOD

TOD#07:00

On time 1 - Monday

todMonTo1

TOD

TOD#12:00

Off time 1 - Monday

todMonFrom2

TOD

TOD#12:00

On time 2 - Monday

todMonTo2

TOD

TOD#18:00

Off time 2 - Monday

xMonMode

BOOL

TRUE

Mode - switching periods - Monday

todTueFrom1

TOD

TOD#07:00

On time 1 - Tuesday

todTueTo1

TOD

TOD#12:00

Off time 1 - Tuesday

todTueFrom2

TOD

TOD#12:00

On time 2 - Tuesday

todTueTo2

TOD

TOD#18:00

Off time 2 - Tuesday

xTueMode

BOOL

TRUE

Mode - switching periods - Tuesday

todWedFrom1

TOD

TOD#07:00

On time 1 - Wednesday

todWedTo1

TOD

TOD#12:00

Off time 1 - Wednesday

todWedFrom2

TOD

TOD#12:00

On time 2 - Wednesday

todWedTo2

TOD

TOD#18:00

Off time 2 - Wednesday

xWedMode

BOOL

TRUE

Mode - switching periods - Wednesday

todThuFrom1

TOD

TOD#07:00

On time 1 - Thursday

todThuTo1

TOD

TOD#12:00

Off time 1 - Thursday

todThuFrom2

TOD

TOD#12:00

On time 2 - Thursday

todThuTo2

TOD

TOD#18:00

Off time 2 - Thursday

xThuMode

BOOL

TRUE

Mode - switching periods - Thursday

todFriFrom1

TOD

TOD#07:00

On time 1 - Friday

todFriTo1

TOD

TOD#12:00

Off time 1 - Friday

todFriFrom2

TOD

TOD#12:00

On time 2 - Friday

todFriTo2

TOD

TOD#18:00

Off time 2 - Friday

xFriMode

BOOL

TRUE

Mode - switching periods - Friday

todSatFrom1

TOD

TOD#07:00

On time 1 - Saturday

todSatTo1

TOD

TOD#12:00

Off time 1 - Saturday

todSatFrom2

TOD

TOD#12:00

On time 2 - Saturday

todSatTo2

TOD

TOD#18:00

Off time 2 - Saturday

xSatMode

BOOL

TRUE

Mode - switching periods - Saturday

todSunFrom1

TOD

TOD#07:00

On time 1 - Sunday

todSunTo1

TOD

TOD#12:00

Off time 1 - Sunday

todSunFrom2

TOD

TOD#12:00

On time 2 - Sunday

todSunTo2

TOD

TOD#18:00

Off time 2 - Sunday

xSunMode

BOOL

TRUE

Mode - switching periods - Sunday

sNotice

STRING

‘Notice’

Designation - time switch

Function description

General

Weekdays 1 - 7 (Monday … Sunday, XXX = Mon, Tue, Wed, Thu, Fri, Sat, Sun)

Each of the seven weekdays has two separate switching periods assigned (switching period 1, switching period 2).

Each switching period 1 is defined by adjustable data (on time 1 todXXXTimeFrom1 and off time 1 todXXXTimeTo1) defined. Each switching period 2 is defined by adjustable data (on time 2 todXXXTimeFrom2 and off time 2 todXXXTimeTo2) defined. In addition, an operating mode (xXXXMode) can be set per weekday.

If off time 1 is before on time 1, then for the evaluation off time 1 is set to the value of on time 1. If on time 2 is before off time 1, then for the evaluation on time 2 is set to the value of off time 1. If off time 2 is before on time 2, then for the evaluation off time 2 is set to the value of on time 2.

A switching period is active if the current time on weekday XXX is within the switching periods of weekday XXX ( xXXXMode = TRUE ). A switching period is active if the current time on weekday XXX is outside the switching periods of weekday XXX ( xXXXMode = FALSE ).

Special case 1: on time 1 = on time 2 = off time 1 = off time 2 = TOD#00:00

When an on period is active ( xXXXMode = TRUE ) the switching period is not active for the whole day. When an off period is active ( xXXXMode = FALSE ) the switching period is active all day.\

Special case 2: on time 1 = on time 2 = off time 1 = off time 2 = TOD#23:59

When an on period is active ( xXXXMode = TRUE ) the switching period is active all day. When an off period is active ( xXXXMode = FALSE ) the switching period is not active all day.\

Prerequisite for using the function block Clock7d2Ch

For correct operation the use of the function block TimeRead2 is required.\

On periods

Off periods

Enable input xEn

xEn

xActive

todActivatedFrom

todActivatedTo

Note

FALSE

FALSE

unchanged

unchanged

FB disabled

TRUE

State depending on the weekday, the time and the switching periods

On time of switching period 1 of the current weekday

Off time of switching period 2 of the current weekday

FB enabled

Display output xActive

The display output xActive takes the state TRUE if, with enable input active (xEn = TRUE) the time on weekday XXX is within switching period 1 or switching period 2 of weekday XXX (xXXXMode = TRUE, on period). The display output xActive takes the state TRUE if, with enable input active (xEn = TRUE) the time on weekday XXX is outside switching period 1 or switching period 2 of weekday XXX (xXXXMode = FALSE, off period). In all other cases the display output xActive takes the state FALSE.

xEn

xActive

Switching periods XXX

xXXXMode - XXX

Note

FALSE

FALSE

X

X

FB disabled

TRUE

FALSE

FALSE

TRUE

On periods not active

TRUE

TRUE

TRUE

TRUE

On periods active

TRUE

TRUE

FALSE

FALSE

Off periods not active

TRUE

FALSE

TRUE

FALSE

Off periods active

On time of the switching periods of the current weekday todActivatedFrom

This output permanently shows the on time of switching period 1 of the current weekday if the enable input (xEn = TRUE) is active. In all other situations it is not changed. In special cases 1 and 2 the value TOD#00:00 is always displayed.

Off time of the switching periods of the current weekday todActivatedTo

This output permanently shows the off time of switching period 2 of the current weekday if the enable input (xEn = TRUE) is active. In all other situations it is not changed. In special case 1 the value TOD#00:00 is always displayed, in special case 2 the value TOD#23:59 is displayed.

Visualization

Representation

Visu-Element interfaces

Name
Data type
Type
Initial value
Function

FB_Clock7d2Ch

Clock7d2Ch

VAR_IN_OUT

Enter FB Clock7d2Ch here e.g. PRG.Clock7d2Ch

Note: VAR_IN_OUT interfaces must be assigned, VAR_INPUT are optional.

CODESYS

InOut:

Scope
Name
Type
Initial

Input

xEn

BOOL

Input Const

todMonFrom1

TOD

TIME_OF_DAY#7:0

Input Const

todMonTo1

TOD

TIME_OF_DAY#12:0

Input Const

todMonFrom2

TOD

TIME_OF_DAY#12:0

Input Const

todMonTo2

TOD

TIME_OF_DAY#18:0

Input Const

xMonMode

BOOL

TRUE

Input Const

todTueFrom1

TOD

TIME_OF_DAY#7:0

Input Const

todTueTo1

TOD

TIME_OF_DAY#12:0

Input Const

todTueFrom2

TOD

TIME_OF_DAY#12:0

Input Const

todTueTo2

TOD

TIME_OF_DAY#18:0

Input Const

xTueMode

BOOL

TRUE

Input Const

todWedFrom1

TOD

TIME_OF_DAY#7:0

Input Const

todWedTo1

TOD

TIME_OF_DAY#12:0

Input Const

todWedFrom2

TOD

TIME_OF_DAY#12:0

Input Const

todWedTo2

TOD

TIME_OF_DAY#18:0

Input Const

xWedMode

BOOL

TRUE

Input Const

todThuFrom1

TOD

TIME_OF_DAY#7:0

Input Const

todThuTo1

TOD

TIME_OF_DAY#12:0

Input Const

todThuFrom2

TOD

TIME_OF_DAY#12:0

Input Const

todThuTo2

TOD

TIME_OF_DAY#18:0

Input Const

xThuMode

BOOL

TRUE

Input Const

todFriFrom1

TOD

TIME_OF_DAY#7:0

Input Const

todFriTo1

TOD

TIME_OF_DAY#12:0

Input Const

todFriFrom2

TOD

TIME_OF_DAY#12:0

Input Const

todFriTo2

TOD

TIME_OF_DAY#18:0

Input Const

xFriMode

BOOL

TRUE

Input Const

todSatFrom1

TOD

TIME_OF_DAY#7:0

Input Const

todSatTo1

TOD

TIME_OF_DAY#12:0

Input Const

todSatFrom2

TOD

TIME_OF_DAY#12:0

Input Const

todSatTo2

TOD

TIME_OF_DAY#18:0

Input Const

xSatMode

BOOL

TRUE

Input Const

todSunFrom1

TOD

TIME_OF_DAY#7:0

Input Const

todSunTo1

TOD

TIME_OF_DAY#12:0

Input Const

todSunFrom2

TOD

TIME_OF_DAY#12:0

Input Const

todSunTo2

TOD

TIME_OF_DAY#18:0

Input Const

xSunMode

BOOL

TRUE

Input Const

sNotice

STRING

‘Notice’

Output

xActive

BOOL

Output

todActivatedFrom

TOD

Output

todActivatedTo

TOD

Last updated