Time switch based on the S7-300/400 CPUs with simple HMI
system including radio-controlled clock connection
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
Warranty, Liability and Support
We accept no liability for information contained in this document.
We do not accept liability, whatever the legal basis, for any damages
arising from the use of examples, notes, programs, configuration and
performance data etc. described in this document, except where we are
obliged to by the German Product Liability Act or in cases of willful damage
or gross negligence, injury to life, body or health, breach of guarantee for
the condition of products or items assumed by us, fraudulent concealment
of a defect or breach of a substantial contractual obligation. However,
claims arising from a breach of a condition which goes to the root of the
contract shall be limited to the foreseeable damage which is intrinsic to the
contract, unless caused by intent or gross negligence or based on
mandatory liability for injury of life, body or health. The above conditions are
not meant to change the burden of proof to the detriment of the user.
The application examples do not purport to cover all details or variations in
equipment, nor do they provide for every possible contingency. They are
not customer-specific solutions. They are only intended to provide support
for typical tasks. You are responsible for ensuring that the described
products are used correctly. These application examples do not relieve you
of the responsibility to use sound practices in application, installation,
operation and maintenance. By using this application example you accept
that Siemens is not liable for any damages except for those specified in the
above liability clause. We reserve the right to make changes in these
application examples at any time without prior notice. If there are any
deviations between the recommendations provided in this application
example and other Siemens publications – e.g. Catalogs – the contents of
the other documents have priority.
contents. You will learn about the components
used (standard hardware and software and
newly developed software).
The basic function data illustrate the powerful
performance of this application.
Part A2 gives you a detailed description of the
A2
function processes of the hardware and
software components. Read this part if you
want to know what the functions do and how
the solution components interact.
Part B takes you step by step through
B
installation and start-up of the application.
Part C is of interest if you want to take the
C
software and expand or adapt it to your set-up.
Note
You can skip this part if
you only want to test the
application using step-bystep instructions.
Rev. B - final 19.07.2002 3/84
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
Table of Contents
Part A1 : Application Description................................................................................ 7
1 Illustrate the performance of the entire applicationThe Automation
Problem - An Overview..............................................................................
9 Changes in the STEP 7 Programs............................................................... 77
9.1 What to do if a second time switch of the same type is needed?................... 77
9.2 How can I get several switch-on/off times into one time switch block?........... 78
9.3 What to do if more holidays or special days are needed?.............................. 79
9.4 How can I save on Instance DBs?..................................................................80
Appendix: Connection of the SICLOCK radio clock ............................................... 81
Rev. B - final 19.07.2002 5/84
A
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
Preamble
Many systems in automation technology (e.g. in the field of Heating,
Ventilation & Air Conditioning) require a control dependent on time of the
day and day of the week. Apart from the time dependent control of certain
processes, a monitoring and control function is also necessary for these
time switch functions.
We take an everyday automation problem (see chapter 1) and present all
required solution elements individually. The solution consists of standard SIMATIC components plus the software blocks developed especially for
this application. The blocks are designed so that they can be used directly
for concrete problems or they can be adjusted to an individual task by
simple expansion/reduction.
This application offers a convenient and quick way to implement the "Time
switch" key function. A HMI interface is provided allowing the operator to
control the application.
... Delive re d with th e a pplicatio n
Rev. B - final 19.07.2002 6/84
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
Part A1 : Application Description
Objectives of Part A1
Part A1 of this document provides the reader with information on the
following topics:
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
1 Illustrate the performance of the entire applicationThe
Automation Problem - An Overview
Precise time tuning is necessary in many fields. Even in household
technology for example, systems must work dependent on time of the day
or day of the week. One possible solution for this problem are electrical and
mechanical time switches. The following figure shows examples for
electrical time switches:
These are all hardware clocks which enable solving the time switching
problem for example in the field of household technology. These clocks are
readily available in many DIY superstores. Operating the devices is so
simple that a layperson can use this clock easily.
Apart from these “primitive applications”, time-dependent controls are also
required in large areas of automation technology. Some “professional
applications” are illustrated in the following table.
Rev. B - final 19.07.2002 8/84
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
Table 1-1 Application examples for professional time switches
Application Illustration
Greenhouse control:
Watering and lighting systems of a greenhouse must
be controlled.
Lighting control:
Lighting systems are automatically controlled in
A block in the S7-CPU, which sets an output dependent of absolute time or
which after a certain event lets a parameterized length of time pass, is
required for the temporal design of these or similar processes.
The absolute switch-on and switch-off times for these processes must be
configurable at a HMI system and subsequently be available in the S7CPU. Furthermore, it should be possible to parameterize a certain length of
time which will pass dependent on a start event (relative time).
The S7-CPU and the HMI system are connected via MPI.
In our example the absolute switch-on and switch-off times are entered at
the HMI system and subsequently compared with the absolute system time
of the S7-CPU.
Note
The block principally also functions without HMI interface. Parameterization can be
made directly at the input parameters.
Additionaly, the possibility of optionally connecting a radio-controlled clock
to the automation system should be offered. This clock is supposed to
synchronize the system time with the official time and to conduct the
changeover from summer time to winter time and the other way round.
Rev. B - final 19.07.2002 10/84
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
This application was realized with the SIPLUS radio clock. Alternatively the
SICLOCK radio clock can be used. This alternative is dealt with in detail in
the appendix.
In case you do not want to use a radio-controlled clock the summer/ winter
time changeover is automatically conducted at the officially fixed dates by a
special function block which is delivered with this application. In this case
the system time can certainly not be synchronized with the official time.
Basic data of the requirement
The requirements by the automation problem on the S7-CPU and the HMI
interface are listed below:
- One-day, seven-day, one-month, one-year time switches
- Relative time switch
- Summer/wintertime changeover
- Holiday recognition
- Connection with radio-controlled clock
• Respectively one switch-on and one switch-off time can be
parameterized for the time switches (one-day, seven-day, one-month,
one-year and relative time switch).
• Resetting the time switches must be simple.
HMI Interface
User interface for the application for
• Input for current switch-on and switch-off times
• Controlling the sample application:
Starting / resetting time switches
• Display of current time switch status (on/off)
• Button for selecting mode of summer / winter time changeover: via radio-
controlled clock or via function block (delivered with the application)
Rev. B - final 19.07.2002 11/84
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
2 Automation Solution
The automation problem described in chapter 1 can be solved with
standard hardware and software components (SIEMENS) plus the user's
own customized software.
The SIMATIC S7, together with a monitoring and control unit (SIMATIC
OP/TP), is useful for executing the automation task.
Based on the used standard HW/SW components, as well as the compiled
application software, data are exchanged between S7-CPU and HMI
system via an MPI bus system.
Both the diagrams below give you an overview of all the components
involved. Figure 2-1 shows you the standard components. Connecting the
HVAC devices to the S7-CPU via the distributed I/O was not looked into in
this application, and is thus only outlined schematically. Figure 2-2 shows
you the user software developed for this application.
Solving the task described in chapter 1 requires several blocks (see
Chapter 2.1) for time-dependent setting or resetting of an output. In our
solution the block parameter are input via an HMI-system (see
Chapter 2.2).
However, the parameters can also be input directly at the block.
The application contains function blocks for absolute and relative time
switch functions (clocks). Each clock has only one setting option
(corresponding to a “cam”), i.e. only respectively one switch-on and one
switch-off time can be entered at a block. This way of handling has many
advantages:
• The function blocks are kept very fine-granular. This enables ideal usage
of the storage requirements of the S7-CPU.
• Flexible application of the blocks.
• Simple parameterization of the blocks.
Rev. B - final 19.07.2002 13/84
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
Furthermore, the application contains additional functions such as
summer/winter time changeover as well as taking holidays into
consideration.
The additional function „Summer/winter time changeover“ is conducted by
default by the FB103 „summer_winter“. Optionally this changeover can also
be controlled by means of a radio-controlled clock. In this case a digital
input module is necessary (i.e. SM321), as two digital inputs are required in
order to receive the data sent from the clock module.
For each absolute or relative clock (corresponds to a function call of a
function block) a view is used in the HMI system.
This block can detect a time range within 7 days, e.g. each Tuesday
from 8 o’clock p.m. to Friday 6 o‘clock a.m.. These switch times are
repeated on a weekly basis.
Note:
It is also possible to repeat a switch time daily from Monday to Friday.
So 12:00 a.m.Sa 11:59:59 p.m.
Di, 8:00 p.m.
Fr, 6:00 a.m.
Fig 2-5 Time range seven-day time switch
One-month time switch:
This block can detect a time range within 31 days, e.g. each month from
rd
the 3
r
3
, 12 o’clock p.m. to the 7th 21 o‘clock p.m..
s
1
12:00 a.m.
, 12:00 p.m.7th , 9:00 p.m.
s
31
11:59:59 p.m.
Fig 2-6 Time range one-month time switch
Rev. B - final 19.07.2002 15/84
t
:00 a.m.
t
h
h
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
One-year time switch
This block can detect a time range within 365 days, e.g. from April 13
8 o’clock a.m. to September 28
s
1
Jan.
12
t
13
May, 8:0028
Fig 2-7 Time range one-year time switch
2.1.2 Relative time function
Relative time switch:
The clock is activated on a start signal and remains active until the
parameterized time interval has elapsed.
The clock changes the absolute system time in the S7-CPU by plus or
minus one hour, depending on whether the time changeover is from
winter to summer time, or from summer to winter time.
For this changeover there are two alternatives:
1. Radio-controlled changeover (for this alternative you have to use the
radio-controlled clock shown in figure 2-1):
The system time is being synchronized after the clock connected to
the system has sent the changeover signal.
Rev. B - final 19.07.2002 16/84
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
2. Program controlled changeover:
The system time is being adjusted at the officially fixed dates by
means of a function block which is included in this application.
•Holiday/special day recognition:
Data for holidays and special days are stored in a DB in the format
day/month/year. The block checks whether a day in this DB coincides
with this current date, and sets an output to 1. Otherwise, the output is 0.
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
2.2 Controlling and monitoring
The HMI system used in this case is an OP3 or alternatively a TP170A.
Only a short overview is given here on operation. A detailed description on
operation is given in Chapter 6.
The HMI page contains a view on each block in the S7-CPU. Inputs for the
respective block are made via this view. The variables in the HMI system
are connected with the correct memory space in the S7-CPU, so that inputs
are at the correct location and can be evaluated in the S7 program.
Note
Information on setting the time in the HMI system via the S7-CPU or for setting the
S7-clock via the HMI system are given on the
[ProductSupportPages] under Entry ID 944136 (OP3) or Entry ID 2383397
(TP170A).
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
HMI with OP3
The OP3 is a text-based display of the lower performance range. A
maximum of 2 lines at 20 characters each can be operated and monitored
at once on the device.
An example (one-day time switch) of the HMI interface at OP3 is illustrated
below.
The upper section of the illustration gives the input parameter, the lower
section the output parameter.
Fig. 2-9 HMI interface for the one-day time switch at the OP3
Enable Clock:
The parameter is used for enabling or disabling the clock.
Reset Output:
The Reset parameter is used for resetting the output of the clock when
problems occur.
Rev. B - final 19.07.2002 19/84
p
Warranty, Liability and Support
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
HMI with TP170A
The TP170A is a WindowsCE device of the lower performance range. A
graphical user interface of 12 cm x 8 cm can be used for controlling and
monitoring.
An example (one-day time switch) of the HMI interface at TP170A is
illustrated below.
Time switch based on the S7-300/400 CPUs with simple HMI system including radio-controlled clock connection
2.4 Application software components required and their "product features"
This application was produced using the following application software components:
Table 2-2 STEP 7 application software
Serial No. Name Function description Technical data Ambient Conditions
1 Day (FB120)
2 Week (FB121)
3 Month (FB122)
4 Year (FB123)
The FB “DAY” checks, whether the current system time in the S7 CPU
is within the parameterized time range at the input parameters of the
block. If this is the case, the output is set to “1”. Otherwise the output is
“0”.
The FB “Week” checks, whether current system time and current day of
the week in the S7 CPU are within the parameterized time range at the
input parameters of the block. If this is the case, the output is set to “1”.
Otherwise the output is “0”.
The FB “Month” checks, whether current system time and current day in
the month in the S7 CPU are within the parameterized time range at the
input parameters of the block. If this is the case, the output is set to “1”.
Otherwise the output is “0”.
The FB “Year” checks, whether current system time and current date in
the S7 CPU are within the parameterized time range at the input
parameters of the block. If this is the case, the output is set to “1”.
Otherwise the output is “0”.
Time switch based on the S7-300/400 CPUs with simple HMI system including radio-controlled clock connection
Serial No. Name Function description Technical data Ambient Conditions
5 Relative (FB124)
The FB “Relative” sets the output to “1”, if at the input “Enable” a
positive edge is identified. The output stays on “1” until the
parameterized time has elapse.
Additionally it can be parameterized, whether the parameterized time
restarts at any positive edge, or whether only the first edge change is
reacted to.
6 Summer_winter (FB103)
The FB “Summer_winter” changes the current system time in the S7CPU by plus or minus 1 hour, depending on whether the time
changeover has occurred from winter to summer or from summer to
winter time
– Language STL
– Storage
requirements:
598 bytes
– Instance DB: DB124
58 bytes
– Language STL
– Storage
requirements:
382 bytes
– S7-CPU
– OB1
– S7-CPU
– OB1
– Instance DB: DB103
44 bytes
7 Holidays (FC100)
The FC “Holidays” checks whether a date stored in this checked DB
coincides with the current system date in the S7-CPU and sets its
output to “1” accordingly.
– Language STL
– Storage
requirements:
– S7-CPU
– OB1
310 bytes
Rev. B - final 19.07.2002 24/84
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
2.5 Installation with simple setup
The entire application software available for downloading has been
compressed in the “timefunc.exe” file. Copy the “timefunctions.exe“ file to a
separate folder and launch by double clicking on it. The project is
automatically extracted into the specified path including all respective subdirectories. Subsequently the extracted STEP7 project can be opened with
the SIMATIC Manager.
The project contains both ProTool projects for OP3 and TP170A. They can
be opened by double click in the SIMATIC Manager, providing ProTool has
been installed on the computer.
The hardware components for the S7 station may have to be adjusted in
the STEP7 project (if you are using different hardware components from
those given here) and is then be loaded into the S7 CPU.
Rev. B - final 19.07.2002 25/84
Time switch based on the S7-300/400 CPUs with simple HMI system
including radio-controlled clock connection
3 Basic performance data
The basic data for the S7 blocks are available in the following table: