SwitchTimeS

SwitchTimeS (FB)

FUNCTION_BLOCK SwitchTimeS

Short description

Switch clock with 5 adjustable time periods and binary output. Each time period is defined by an on-time / off-time and a date.

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 time periods

todActivatedFrom

TOD

On time of the last active time period of the current day

todActivatedTo

TOD

Off time of the last active time period of the current day

Setpoints / Parameters

Name
Data type
Value range
Initial value
Function

datCH1_Date

DATE

DATE#2022-01-01

Date of time period 1

todCH1_TimeFrom

TOD

TOD#07:00

On time of time period 1

todCH1_TimeTo

TOD

TOD#12:00

Off time of time period 1

xCH1_Mode

BOOL

TRUE

Display mode for time period 1

sCH1_Notice

STRING

‘Notice’

Text for time period 1

datCH2_Date

DATE

DATE#2022-01-01

Date of time period 2

todCH2_TimeFrom

TOD

TOD#07:00

On time of time period 2

todCH2_TimeTo

TOD

TOD#12:00

Off time of time period 2

xCH2_Mode

BOOL

TRUE

Display mode for time period 2

sCH2_Notice

STRING

‘Notice’

Text for time period 2

datCH3_Date

DATE

DATE#2022-01-01

Date of time period 3

todCH3_TimeFrom

TOD

TOD#07:00

On time of time period 3

todCH3_TimeTo

TOD

TOD#12:00

Off time of time period 3

xCH3_Mode

BOOL

TRUE

Display mode for time period 3

sCH3_Notice

STRING

‘Notice’

Text for time period 3

datCH4_Date

DATE

DATE#2022-01-01

Date of time period 4

todCH4_TimeFrom

TOD

TOD#07:00

On time of time period 4

todCH4_TimeTo

TOD

TOD#12:00

Off time of time period 4

xCH4_Mode

BOOL

TRUE

Display mode for time period 4

sCH4_Notice

STRING

‘Notice’

Text for time period 4

datCH5_Date

DATE

DATE#2022-01-01

Date of time period 5

todCH5_TimeFrom

TOD

TOD#07:00

On time of time period 5

todCH5_TimeTo

TOD

TOD#12:00

Off time of time period 5

xCH5_Mode

BOOL

TRUE

Display mode for time period 5

sCH5_Notice

STRING

‘Notice’

Text for time period 5

Function description

General

The current time (date / time) is continuously compared with the 5 defined time periods. The display output xActive assumes the state TRUE if, with the enable input active (xEn = TRUE) at least one of the 5 time periods is active.

Prerequisite for using the function block SwitchTimeS

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

Enable input xEn

xEn

xActive

todActivatedFrom

todActivatedTo

Note

FALSE

FALSE

unchanged

unchanged

FB disabled

TRUE

State dependent on the 5 time periods

On time of the last active time period of the current day

Off time of the last active time period of the current day

FB enabled

Display output xActive

The display output assumes the state TRUE if, with the enable input active (xEn = TRUE) at least one of the 5 time periods is active.

xActive

xEn

Time period 1

Time period 2

Time period 3

Time period 4

Time period 5

Note

FALSE

FALSE

X

X

X

X

X

FB disabled

FALSE

TRUE

FALSE

FALSE

FALSE

FALSE

FALSE

No time period active

TRUE

TRUE

FALSE

FALSE

TRUE

FALSE

FALSE

At least one time period active

On time of the last active time period of the current day todActivatedFrom

This display output assumes the value of the on-time of the last active time period if, with the enable input active (xEn = TRUE) the date of the current time matches the date of the time period. In all other situations it is not changed.

Off time of the last active time period of the current day todActivatedTo

This display output assumes the value of the off-time of the last active time period if, with the enable input active (xEn = TRUE) the date of the current time matches the date of time period 5. In all other situations it is not changed.

Time periods 1 - 5 (X = 1 .. 5)

Each time period is defined by adjustable data (on-time todCHX_TimeFrom, off-time todCHX_TimeTo and date datCHX_Date) defined In addition, an operating mode (xCHX_Mode) as well as a descriptive text (sCHX_Notice) can be set. If the off-time is before the on-time, then for the check the off-time is set to the value of the on-time. A time period is active if the current date matches the date of the time period and the time is within the time period (xCHX_Mode = TRUE). A time period is active if the current date matches the date of the time period and the time is outside the time period (xCHX_Mode = FALSE).

Visualization

Representation

Interfaces Visu element

Name
Data type
Type
Initial value
Function

FB_SwitchTimeS

SwitchTimeS

VAR_IN_OUT

Enter FB SwitchTimeS here e.g. PRG.SwitchTimeS

BMS_Active

BOOL

VAR_INPUT

BMS (Building Management System) GLT (building management technology). If BMS_Active = TRUE the input / editing of the clocks is disabled because they can then only be set via the BMS. Times can then only be viewed.

DisableInput

BOOL

VAR_INPUT

DisableInput = TRUE clock times of the weekly clocks can only be viewed and not edited./// - BMS (Building Management System) GLT (building management technology). If BMS_Active = TRUE the input / editing of the clocks is disabled because they can then only be set via the BMS. Times can then only be viewed.

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

CODESYS

InOut:

Scope
Name
Type
Initial

Input

xEn

BOOL

Input Const

datCH1_Date

DATE

DATE#2022-1-1

Input Const

todCH1_TimeFrom

TOD

TIME_OF_DAY#7:0

Input Const

todCH1_TimeTo

TOD

TIME_OF_DAY#12:0

Input Const

xCH1_Mode

BOOL

TRUE

Input Const

sCH1_Notice

STRING

‘Notice’

Input Const

datCH2_Date

DATE

DATE#2022-1-1

Input Const

todCH2_TimeFrom

TOD

TIME_OF_DAY#7:0

Input Const

todCH2_TimeTo

TOD

TIME_OF_DAY#12:0

Input Const

xCH2_Mode

BOOL

TRUE

Input Const

sCH2_Notice

STRING

‘Notice’

Input Const

datCH3_Date

DATE

DATE#2022-1-1

Input Const

todCH3_TimeFrom

TOD

TIME_OF_DAY#7:0

Input Const

todCH3_TimeTo

TOD

TIME_OF_DAY#12:0

Input Const

xCH3_Mode

BOOL

TRUE

Input Const

sCH3_Notice

STRING

‘Notice’

Input Const

datCH4_Date

DATE

DATE#2022-1-1

Input Const

todCH4_TimeFrom

TOD

TIME_OF_DAY#7:0

Input Const

todCH4_TimeTo

TOD

TIME_OF_DAY#12:0

Input Const

xCH4_Mode

BOOL

TRUE

Input Const

sCH4_Notice

STRING

‘Notice’

Input Const

datCH5_Date

DATE

DATE#2022-1-1

Input Const

todCH5_TimeFrom

TOD

TIME_OF_DAY#7:0

Input Const

todCH5_TimeTo

TOD

TIME_OF_DAY#12:0

Input Const

xCH5_Mode

BOOL

TRUE

Input Const

sCH5_Notice

STRING

‘Notice’

Output

xActive

BOOL

Output

todActivatedFrom

TOD

Output

todActivatedTo

TOD

Last updated