CustomizedCourse S7-1500 V1.0

Download as pdf or txt
Download as pdf or txt
You are on page 1of 68

151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.

Training Center EISAC AUTOMATION

1 Introduction to TIA Portal Dashboard

2 Built up Hardware configuration (S7-1500)

3 Data Types of PLC under TIA Portal


EISAC
Handling with Functions, Functions blocks,
AUTOMATION 4
Data Blocks
TRAINING CENTER
SIEMENS Different types of Operation
5
Blocks (OBs) and usage of them

6 TIA Portal types of Timers, Counters


TIA PORTAL
Define and use UDT (User-defined Data
Customized 7
Type)
Course
8 Analog Values linearization and calibrations

Using System Memory Bits, and System


9
clock Bits
Difference Between S7-1500 modules
10
(Output Modules)
Control the output status in case of CPU
11
Stop (in High Featured Output Modules)

12 I/O module Parameters

13 Working with PID Compact

Basic PID Compact parameters and how to


14
work with them

15 Introduction to Ring Topology

Page | 1
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

1. Introduction to TIA Portal Dashboard


TIA PORTAL
Totally Integrated Automation

1.1. One common engineering framework for manufacturing automation

STEP 7 V16 Safety V16 WinCC V16 StartDrive V16

Stand-alone software packages are limited because they lack consistency and integration.
It takes a common working environment - that is, an engineering framework - to achieve full
integration and consistency of individual products.
Advantages of a Central Engineering Framework
• Uniform operator control concept for all automation tasks with common services (for
example configuration, communication, diagnostics)
• Automatic data and project consistency
• Powerful libraries covering all automation objects
The Most Important Engineering Products are:
• SIMATIC STEP 7 for PLC programming
• SIMATIC HMI for configuring process visualization
• Start-drive for parameterizing drives

Page | 2
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

1.2. TIA Portal: Portal View and Project View

Portal View
• Task-oriented mode of working
• Fast project entry with user guidance

Project View
• Hierarchical structuring of the project
• The necessary editors open according to the task in hand
• All editors, parameters and data are found in one view

Page | 3
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

1.2.1. Layout of the Portal View:

• Portals for the different tasks


• Actions for the selected portal
• Selection window for the selected action
Portals
Access to devices, components and their connections.
Actions
Depending on the selected portal, actions are available here that can be executed in the selected
portal. Context-sensitive help is available in every portal.
Selection Window
The selection window is available in all portals. The content of the window adapts to your current
selection.

Page | 4
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

1.2.2. Layout of the Project View:

Project Navigation (Tree)


The Project tree contains all components and project data of an automation solution. All
components can be opened from there.
Working Area
The objects opened for editing are displayed in the working area. These objects include, for
example hardware components, blocks, PLC tag tables, screens of HMI devices etc. If several
objects are open at the same time; they are displayed as tabs in the task bar.
Task Cards
These provide tools for configuring/programming. The content of the Task cards depends on the
object displayed in the working area.
If a hardware station is open, the Hardware catalog, for example, is available as a Task card.
If a program block is open, there is a Task card with Instructions.
Inspector Window
Additional information on a selected object or on executed actions is displayed in the Inspector
window. The available properties of the selected objects can also be edited here (for example,
properties of screens, screen objects, tags).

Page | 5
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

The Inspector window displays all system messages from the engineering, for example, those
resulting from generating a project. This window should always be checked for any errors and
warnings after a generation is completed.
Details View
The Details view is a help window. Here, the elements of the configuration object selected in the
Project tree are displayed. These can be used in the active working area (by dragging them to the
working area using drag & drop). This enables fast access to the required objects (for example,
tags).

1.3. TIA Portal - Settings: User Interface Language

Available User Interface Languages


The user interface language of the TIA Portal can be changed during running operation. The
following languages are available:
• German
• English
• French
• Spanish
• Italian
• Russian
• Korean
• Japanese
• Chinese (simplified)
Page | 6
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

1.4. TIA Portal - Settings: Language, Storage Location, Layout

Language
The user interface language of the TIA Portal can be changed at any time without needing to
restart. The TIA Portal always starts in the language in which it was last used.

Storage Settings
Storage location for projects:
Storage location of newly created projects and their project libraries
Storage location for libraries:
Storage location for global libraries

Layout
If the layout is reset, the original window layout arrangement of the TIA Portal is restored.

Page | 7
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

2. Built up Hardware configuration (S7-1500)

2.1. Configuration of the S7-1500

Addresses of the Central S7-1500 I/O Modules


Two digital 32-channel modules are available as central I/O. These are to begin as of Address =0.
Since digital channels are also available on the distributed I/O, the analog module of the central
I/O is to begin as of Address =10.

Page | 8
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

2.2. Creating a Hardware Station

Device Configuration
With the device configuration, the user specifies the arrangement of modules in the rack.
When a new device is created, a suitable rack is also created automatically. The selected device
is inserted into the first permitted slot in the rack. Regardless of the method selected, the added
device is visible in the Device view and the Network view of the "Devices & networks" editor.

Page | 9
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

2.3. Inserting / Deleting a Module

2.3.1. Inserting a Module


A new module can also be inserted by dragging and dropping it between two modules that have
already been plugged in. To do this, the new module is dragged above and between the two
already existing modules. An insert mark then appears, via which the new module can be
inserted. All modules that have already been inserted are moved one slot to the right; if there are
too many modules, the excess modules are moved to the "area for modules not plugged in".

2.3.2. Deleting a Module


Deleted hardware components are removed from the system and assigned addresses are
released again.

Page | 10
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

2.4. Online Tools, Configuring and Parameterizing the Hardware

2.4.1. Online Tools


If it is possible to establish an online connection to the CPU, diagnostics and status information of
all modules can be called.
With CPUs that can be accessed online, the mode can also be controlled using the "Online tools"
task card and further status information (cycle time statistics and memory load) can be called.

2.4.2. Configuring and Parameterizing the Hardware


Almost all devices or components of an automation solution such as controllers or touch panels
can be assigned parameters. The parameter assignment of the devices and network settings
required for commissioning is handled using the "Devices & networks" editor.
With this, for example, all components of an Ethernet network are assigned IP addresses via
which they communicate during later operation.
But even inside the automation device, address areas of the I/O modules must be specified and
the cycle monitoring time of the CPU must be set

Page | 11
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

2.4.3. Internet Protocol


The Internet Protocol (IP) is the basis for all TCP/IP networks. It creates the so-called datagrams
(data packets specially tailored to the Internet protocol) and handles their transport within the local
subnet or their "routing" (forwarding) to other subnets.

2.4.4. IP Addresses
IP addresses are not assigned to a specific computer, but rather to the network interfaces of the
computer. A computer with several network connections (for example routers) must therefore be
assigned an IP address for each connection.
IP addresses consist of 4 bytes. With the dot notation, each byte of the IP address is expressed by
a decimal number between 0 and 255. The four decimal numbers are separated by dots

2.4.5. MAC Address


Every Ethernet interface is assigned a fixed address by the manufacturer that is unique worldwide.
This address is referred to as the hardware or MAC address (Media Access Control).
It is stored on the network card and uniquely identifies the Ethernet interface in a local network.
Cooperation among the manufacturers ensures that the address is unique worldwide.

2.4.6. Subnet Mask


The subnet mask specifies which IP addresses in the local network can be reached. It separates
the IP address into the network and device part.
Only IP addresses whose network part is the same can be reached.
For example: Subnet mask = 255.255.255.0 and IP address = 192.168.111.10 reachable IP
addresses: 192.168.111.1 to 192.168.111.254

Page | 12
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

2.5. Compiling the Hardware Configuration and Downloading it into CPU

Compiling / Downloading the Hardware Configuration


The following components of a hardware station can be compiled and downloaded:

• Hardware/Hardware configuration
Only the entire hardware configuration and parameter assignment are compiled/downloaded.

• Software (only changes)


Only the changed blocks of the user program are compiled/downloaded

• Software (rebuild all/download)


All blocks of the user program are compiled/downloaded.

• Software (reset memory reserve)


All data blocks are reset to start values (loading state). The current data in the CPU is lost,
even if a memory reserve (for loading a DB structure change with value retention) is set in the
properties of the data block.

Page | 13
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

3. Data types of PLC under TIA portal


Elementary • Bit data types
data types (BOOL, BYTE, WORD, DWORD, LWORD, CHAR)
(Up to 64 bits) • Mathematical data types
(INT, DINT, REAL, SINT, USINT, UDINT, LREAL)
• Time types
(S5TIME, TIME, DATE, TIME_OF_DAY, LTIME, LTIME_OF_DAY)
Complex • Time type (DT(DATE_AND_TIME), DTL, LDT(L_DATE_AND_TIME)
data types • Array (ARRAY)
• Structure (STRUCT)
• Character string (STRING)
User-defined • PLC data type UDT (User Defined DataType)
data types
(Longer than 32
bits)

3.1. Elementary Data Types


Elementary data types are predefined in accordance with IEC 61131-3. They always have a
length less than or equal to 64 bits and can be further processed with elementary STEP 7
instructions.

BOOL, BYTE, WORD, DWORD, CHAR


Variables of the data type BOOL consist of
one bit. Variables of the data types BYTE,
WORD,
DWORD are bit sequences of 8, 16 or 32 bits.
The individual bits are not evaluated in these
data
types. Special forms of these data types are
the BCD numbers and the count value as it is
used
in conjunction with the count function as well
as the data type CHAR which represents a
character in the ASCII code.

INT, DINT, REAL


Variables of these data types represent numbers that can be used in mathematical operations.

Extensions of INT, DINT, REAL, WORD


U - Unsigned
Variables with the extension U represent an integer without sign.
Data types: USINT, UINT, ULINT, UDINT
S - Short
Variables with the extension S represent an integer with a length of 8 bits.
Page | 14
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Data types: SINT, USINT


L - Long
Variables with the extension L represent a number with a length of 64 bits of the data type.
Data types: LWORD, LINT, ULINT, LREAL

3.2. Complex Data Types


Complex data types contain data
structures that can be made up of
elementary and/or complex data
types. Complex data types can be
used for the declaration of variables
only in global data blocks and within
blocks for the declaration of local
variables (TEMP, STAT) as well as
parameters (IN, OUT and INOUT).
Variables of complex data types
cannot be completely processed with
elementary instructions (such as, A,
O, L, T, +I) but only the individual components of the elementary data type.
Complex data types (arrays and structures) consist of groups of elementary or complex data types.
They enable you to create data types suitable for your problem with which you can structure large
quantities of data and process it symbolically.
Complex data types cannot be processed directly with STEP 7 instructions all at once. Only one
component at a time can be processed.
Complex data types are predefined. The data type DATE_AND_TIME has a length of 64 bits. The
lengths of the data types ARRAY, STRUCT and STRING are defined by the user.
Variables with complex data types can only be declared within global data blocks and as
parameters or local variables of logic blocks.

3.3. PLC Data Types


PLC data types are data types defined by you that are used as templates for declaring parameters
and variables of complex data types (e.g., structure variables). UDTs are created with the Data
Block Editor and contain a data structure that is made up of elementary and/or complex data
types. In the declaration of a variable according to data type UDTx, a structure variable is created
whose inner data structure is defined by a UDT. UDTs can be used for the declaration of variables
in global data blocks and within blocks for the declaration of local variables (TEMP, STAT) as well
as parameters (IN, OUT and INOUT).
User-defined data types represent self-defined structures. This structure is stored in UDT blocks
(UDT1 to UDT65535) and can be used as a "template" in another variable ‘s data type. You can
save typing time when you input a data block if you need the same structure several times.

Page | 15
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

4. Handling with Functions, Functions blocks, Data


Blocks

4.1. Data Blocks and their Usage


Data blocks contain variables for storing user data and accordingly occupy memory space in the
work memory of the CPU. Since the CPU program as well as HMI devices can read and write
access the data block variables (tags), data blocks are frequently also used as an "interface"
between the CPU and HMI devices.
Area of Application
You can use data blocks in different ways, depending on their contents. You differentiate between:
• Global data blocks: These contain information that all the logic blocks in the user program
can access. Often, global data blocks are also used as an interface to HMI devices (see
picture)
• Instance data blocks: These are always assigned to a particular FB. The data of these
instance DBs should only be processed by the associated FB. Instance data blocks are
dealt with in more detail in the chapter "Functions and Function Blocks".

4.2. Creating DBs


Global DBs are created either with the Program Editor or according to a previously created User-
defined
data type (UDT). Instance data blocks are generated by the Editor according to a function block.

Creating a Global Data Block

Page | 16
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Data blocks are Created in the same way as logic blocks.


In creating a data block, you can choose which type the data block is to be or what purpose it is
to serve:
• Global DB for storing global data or for creating global variables
• Instance DB or "private memory area" for a user function block or a special "instruction",

4.3. Functions (FCs)


A function (FC) contains a partial functionality of the program. It is possible to program functions
as parameter-assignable so that when the function is called it can be assigned parameters. As a
result, functions are also suited for programming frequently recurring, complex partial
functionalities such as calculations.

4.4. Function Blocks (FBs)


Basically, function blocks offer the same possibilities as functions. In addition, function blocks have
their own memory area in the form of instance data blocks. As a result, function blocks are suited
for programming frequently recurring, complex functionalities such as closed-loop control tasks.

4.4.1. Special Features


Unlike functions (FCs), function blocks (FBs) have a (recall) memory. That means that a local data
block is assigned to the function block. This data block is known as an instance data block.
When you call an FB, you also have to specify the number of the instance DB, by which it is
automatically opened.
An instance DB is used to save static variables, among other things. These local operands can
only be used in the FB, in whose declaration table they were declared. When the block is exited,
they are retained.

4.4.2. Parameters
When the function block is called, the values of the actual parameters are stored in the instance
data block. If no actual parameters were assigned to a formal parameter in a block call, then the
last value stored in the instance DB for this parameter is used in the program execution.
You can specify different actual parameters with every FB call. When the function block is exited,
the data in the data block is retained.

4.4.3. FB Advantages
• When you write a program for an FC, you must search for empty bit memory address areas
or data areas and you must maintain them yourself. The static variables of an FB, on the
other hand, are maintained by the STEP 7 software.
• When you use static variables, you avoid the risk of assigning bit memory address areas or
data areas twice (double assignment).
• Instead of the formal parameters "Stored Fault" and "Edge Memory" of the FC, you use the
static variables "Stored Fault" and "Edge Memory" in the FB. This makes the block call
simpler since the two formal parameters are dropped.

Page | 17
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

4.4.4. Parameters
When the function block is called,
the values of the actual
parameters are stored in the
instance
data block. If no actual parameters
were assigned to a formal
parameter in a block call, then the
last value stored in the instance
DB for this parameter is used in the
program execution.
You can specify different actual
parameters with every FB call.
When the function block is exited,
the data in the data block is
retained.
4.4.5. Static Variables
Unlike functions, function blocks have "static variables" (Static). These variables form the memory
of the FB since they are not stored in the L-Stack but in their own memory area, the instance DB.

Page | 18
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

5. Types of Operation Blocks (OBs)

5.1. Types of Program Blocks in TIA Portal

Blocks
The automation system provides various types of blocks in which the user program and the related
data can be stored. Depending on the requirements of the process, the program can be structured
in different blocks. You can use the entire operation set in all blocks (FB, FC and OB).

Organization Blocks (OBs)


Organization blocks (OBs) form the interface between the operating system and the user program.
The entire program can be stored in OB1 that is cyclically called by the operating system (linear
program) or the program can be divided and stored in several blocks (structured program).

Functions (FCs)
A function (FC) contains a partial functionality of the program. It is possible to program functions as
parameter-assignable so that when the function is called it can be assigned parameters. As a result,
functions are also suited for programming frequently recurring, complex partial functionalities such
as calculations.

Page | 19
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Function Blocks (FBs)


Basically, function blocks offer the same possibilities as functions. In addition, function blocks have
their own memory area in the form of instance data blocks. As a result, function blocks are suited
for programming frequently recurring, complex functionalities such as closed-loop control tasks.

5.2. Process Images

For the storage of all digital input and output states, the CPU has reserved memory areas: the
process-image input table (PII) and the process-image output table (PIQ). During program
execution, the CPU accesses these memory areas exclusively. It does not access the digital input
and output modules directly.

PII
The Process-Image Input table (PII) is the memory area in which the states of all digital inputs are
stored. At the beginning of the cycle, the digital input modules read-in to the PII. When an input is
linked, the state of this input stored in the PII is linked. This state cannot change within a cycle
since the PII is only updated or read-in at the beginning of a cycle. This guarantees that when
there are multiple queries of the input in one cycle, the same result is always supplied.

PIQ
The Process-Image Output table (PIQ) is the memory area in which the states of all digital outputs
are stored. The PIQ is output to the digital output modules at the end of the cycle.
Outputs can be assigned as well as queried in the program.
Page | 20
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

5.3. Cyclic Program Execution

Restart
When you switch on or switch from STOP --> RUN, the CPU carries out a complete restart (with
OB100). During restart, the operating system deletes all non-retentive bit memories and starts the
cycle monitoring time.

Cyclic Program Execution


Cyclic program execution occurs in an endless loop. After the execution of a program cycle is
completed, the execution of the next cycle occurs automatically. In every program cycle, the CPU
carries out the following steps.
• The CPU scans the states of the input signals and updates the process image inputs.
• The CPU sequentially processes the instructions of the user program and so works directly
with the process images, not with the inputs and outputs of the input / output modules.
• The CPU transfers the output states from the process image outputs to the output modules.

Cycle and Cycle Monitoring Time


The time that the CPU requires for the execution of the complete program cycle, is the cycle time
which is monitored for time by the CPU operating system. If the cycle time exceeds the cycle
monitoring time defined in the CPU properties by more than double, the CPU goes into the STOP
state.

Page | 21
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Using the Process Image or Deselecting it for Individual Modules


In the properties of the modules, you can select whether the input values are to be automatically
adopted in the PII or whether the output values are to be automatically written with values from the
PIQ.

Cyclic Program Execution (OB1)


The program stored in OB1 is executed cyclically, that is, after it is executed completely it is
executed again. With this cyclic program execution, the reaction time results from the execution
time for the CPU’s operating system and the sum of the command runtimes of all executed
instructions. The reaction time, that is, how fast an output can be switched in relation to an input
signal, amounts to a minimum of one time and a maximum of two times the cycle time.

5.4. Local and Global Operands

5.5. What is The Data Block

Data Blocks and their Usage


Data blocks contain variables for storing user data and accordingly occupy memory space in the
work memory of the CPU. Since the CPU program as well as HMI devices can read and write
access the data block variables (tags), data blocks are frequently also used as an "interface"
between the CPU and HMI devices.

Page | 22
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Area of Application
You can use data blocks in different ways, depending on their contents. You differentiate between:
• Global data blocks: These contain information that all the logic blocks in the user program
can access. Often, global data blocks are also used as an interface to HMI devices
• Instance data blocks: These are always assigned to a particular FB. The data of these
instance DBs should only be processed by the associated FB. Instance data blocks are
dealt with in more detail in the chapter "Functions and Function Blocks".

Creating DBs
Global DBs are created either with the Program Editor or according to a previously created user
defined
data type (UDT). Instance data blocks are generated by the Editor according to a function
block.

5.6. Startup Program


After a power recovery, or a change of operating mode (through
the CPU ‘s mode selector or through PG operation), a startup
program is carried out before the cyclic program execution. In the
startup OBs you can, for example, carry out a pre-assignment of
communication connections.

5.7. Cyclic Program Execution


The program stored in OB1 is executed cyclically, that is, after it is
executed completely it is executed again. With this cyclic program
execution, the reaction time results from the execution time for the
CPU’s operating system and the sum of the command runtimes of
all executed
instructions. The reaction time, that is, how fast an output can be
switched in relation to an input signal, amounts to a minimum of
one time and a maximum of two times the cycle time.

5.8. Periodic Program Execution


This makes it possible to interrupt the cyclic program execution at fixed intervals. With the cyclic
interrupts, an organization block (for example OB35) is executed after an adjustable time base (for
example, every 100ms) has expired. In these blocks, closed-loop control blocks with their sampling
time, for example, are called. With the time-of-day interrupts, an OB which carries out a data backup,
for example, is executed at a specific time, for example, every day at 17:00 hours (5:00 p.m.).

5.9. Event-driven Program Execution


In order to be able to react quickly to a process event, the hardware interrupt can be used. After an
event occurs, the cycle is immediately interrupted and an interrupt program is executed. With time-
delay interrupts, a freely definable event can be reacted to with a time-delay; with an error OB, the
user can influence the behavior of the controller in case there is an error.

Page | 23
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

5.10. OB Calls
Organization blocks (OBs) form the interface between the CPU’s operating system and the user
program.
Organization blocks are called exclusively by the operating system. There are various start events
(time-of-day interrupts, hardware interrupts - see picture) that each lead to the start of their
associated organization block.

5.10.1. Interrupting the Cyclic Program


When the operating system calls another OB, it interrupts the cyclic program execution because
OB1 has the lowest priority. Any other OB can therefore interrupt the main program and execute
its own program. Afterwards, OB1 resumes execution at the point of interruption.

5.10.2. Priorities
The S7-1500 CPUs support the priorities 1 (lowest priority) to 26 (highest priority).
The OBs are executed on a purely priority-driven basis. This means that when several OB
requests exist at the same time, the OB with the highest priority is executed first. When an event
occurs that has a higher priority than the currently active OB, this OB is interrupted. Events of the
same priority are executed in the order that they occur.

5.10.3. Queue
If, during the execution of an interrupt OB, a further event with the same priority occurs, this event
is placed in a queue according to its priority. The start events of a queue are processed at a later
time in the order that they occur.
The number of pending events can be limited in order to keep temporary overload situations under
control.
When, for example, the maximum number of start events for a cyclic interrupt OB is reached in the
queue, every further start event is discarded.

Page | 24
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

5.11. Time-of-day Interrupt

Time-of-Day Interrupts
Time-of-day interrupts are used for executing a certain program called in OB 10 (as an example)
either once only at a certain time or periodically (every minute, hourly, daily, weekly, monthly,
yearly) starting at that time.
Note
In addition, the time-of-day interrupts can be controlled at runtime with the following "Extended
instructions -> Interrupts":
• "SET_TINT" Set start date, time and period
• "SET_TINTL" Set start date, time and period
• "CAN_TINT" Cancel time-of-day interrupt
• "ACT_TINT" Activate time-of-day interrupt
• "QRY_TINT" Query time-of-day interrupt

Page | 25
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

5.12. Cyclic Interrupt

Cyclic Interrupt
With a cyclic interrupt, a block can be executed at fixed time intervals. The S7-1500 offers the OB
35, for example, as a cyclic interrupt OB. The default setting for its call interval is 100000μs; the
selectable range is from 500μs to 60000000μs (60sec).

Interval Time
You must make sure that the interval you specify is longer than the time required for execution.
The operating system calls OB35 at the specified time. If OB35 is still active at this time, the
operating system calls OB80 (time error).

Page | 26
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

5.13. Hardware Interrupt

Hardware Interrupt
The program execution of a hardware interrupt OB (OB40) is started as soon as a certain event
occurs.
Hardware interrupts can be triggered by various module-specific signals: For parameter-assignable
signal modules (DI, DO, AI, AO) you use the "Devices & networks" editor (Device view) to specify
which signal is to trigger the hardware interrupt.

Example
In configuring an analog input module, suitable limit values were specified in the above example.
If the measured value, then exceeds this limit, an interrupt is triggered on the CPU which causes
the program to be interrupted and OB 40 to be called for execution.

Page | 27
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

6. TIA Portal types of Timers, Counters

6.1. Counters

6.1.1. CTU: Count up

You can use the "Count up" instruction to increment the value at output CV. When the signal state
at the CU input changes from "0" to "1" (positive signal edge), the instruction is executed and the
current counter value at the CV output is incremented by one. The counter value is incremented
each time a positive signal edge is detected, until it reaches the high limit for the data type
specified at the output CV. When the high limit is reached, the signal state at the CU input no
longer has an effect on the instruction.

You can query the counter status in the Q output. The signal state at the Q output is determined
by the PV parameter. If the current counter value is greater than or equal to the value of the PV
parameter, the Q output is set to signal state "1". In all other cases, the Q output has signal state
"0".

The value at the CV output is reset to zero when the signal state at input R changes to "1". As long
as the R input has signal state "1", the signal state at the CU input has no effect on the instruction.

Page | 28
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Example

When the signal state of the "TagIn_1" operand changes from "0" to "1", the "Count up" instruction
is executed and the current counter value of the "Tag_CV" operand is incremented by one. With
each additional positive signal edge, the counter value is incremented until the high limit of the
data type (INT = 32767) is reached.

The value of the PV parameter is adopted as the limit for determining the "TagOut" output. The
"TagOut" output has signal state "1" as long as the current counter value is greater than or equal
to the value of the "Tag_PV" operand. In all other cases, the "TagOut" output has signal state "0".

6.1.2. CTD: Count down

You can use the "Count down" instruction to decrement the value at output CV. When the signal
state at the CD input changes from "0" to "1" (positive signal edge), the instruction is executed and
the current counter value at the CV output is decremented by one. Each time a positive signal
edge is detected, the counter value is decremented until it reaches the low limit of the specified
data type. When the low limit is reached, the signal state at the CD input no longer has an effect
on the instruction.

You can query the counter status in the Q output. If the current counter value is less than or equal
to zero, the Q output is set to signal state "1". In all other cases, the Q output has signal state "0".

The value at the CV output is set to the value of the PV parameter when the signal state at the LD
input changes to "1". As long as the LD input has signal state "1", the signal state at the CD input
has no effect on the instruction.

Page | 29
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Example

When the signal state of the "TagIn_1" operand changes from "0" to "1", the instruction is
executed and the value at the "Tag_CV" output is decremented by one. With each additional
positive signal edge, the counter value is decremented until the low limit of the specified data type
(INT = -32768) is reached.

The "TagOut" output has signal state "1" as long as the current counter value is less than or equal
to zero. In all other cases, the "TagOut" output has signal state "0".

Page | 30
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

6.1.3. CTUD: Count up and down

You can use the "Count up and down" instruction to increment and decrement the counter value at
the CV output. If the signal state at the CU input changes from "0" to "1" (positive signal edge), the
current counter value is incremented by one and stored at the CV output. If the signal state at the
CD input changes from "0" to "1" (positive signal edge), the counter value at the CV output is
decremented by one. If there is a positive signal edge at the CU and CD inputs in one program
cycle, the current counter value at the CV output remains unchanged.

The counter value can be incremented until it reaches the high limit of the data type specified at
the CV output. When the high limit is reached, the counter value is no longer incremented on a
positive signal edge. The counter value is no longer decremented once the low limit of the
specified data type has been reached.

When the signal state at the LD input changes to "1", the counter value at the CV output is set to
the value of the PV parameter. As long as the LD input has signal state "1", the signal state at the
CU and CD inputs has no effect on the instruction.

The counter value is set to zero when the signal state at the R input changes to "1". As long as the
R input has signal state "1", a change in the signal state of the CU, CD and LD inputs has no
effect on the "Count up and down" instruction.

You can query the status of the up counter at the QU output. If the current counter value is greater
than or equal to the value of the PV parameter, the QU output is set to signal state "1". In all other
cases, the QU output has signal state "0".

You can query the status of the down counter at the QD output. If the current counter value is less
than or equal to zero, the QD output is set to signal state "1". In all other cases, the QD output has
signal state "0".

Page | 31
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Example

If the signal state at the "TagIn_1" or "TagIn_2" input changes from "0" to "1" (positive signal
edge), the "Count up and down" instruction is executed. When there is a positive signal edge at
the "TagIn_1" input, the current counter value is incremented by one and stored at the "Tag_CV"
output. When there is a positive signal edge at the "TagIn_2" input, the counter value is
decremented by one and stored at the "Tag_CV" output. When there is a positive signal edge at
the CU input, the counter value is incremented until it reaches the high limit of 32767. If input CD
has a positive signal edge, the counter value is decremented until it reaches the low limit of INT = -
32768.

The "TagOut" output has signal state "1" as long as the current counter value is greater than or
equal to the value at the "Tag_PV" input. In all other cases, the "TagOut" output has signal state
"0".

The "TagOut_QD" output has signal state "1" as long as the current counter value is less than or
equal to zero. In all other cases, the "TagOut_QD" output has signal state "0".

6.1.4. Exercise: Counting the Transported Parts


Programming "FC_Counting" (FC18)

Task
When "P_Operation" (Q0.1) is switched on, the transported parts are to be counted and the
ACTUAL quantity is to be stored in the variable "MW_ACT" (MW20).
If the ACTUAL quantity has reached the SETPOINT quantity of 3, the indicator light "P_BayLB"
(Q3.4) shows a 1Hz flashing light. As long as this is not acknowledged via "S_BayLB" (I 3.4), the
indicator lights "P_Bay1" (Q3.1) and "P_Bay2" (Q3.2) are dark and no new part transportation can
be started.

Page | 32
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

What to Do
1- Add the new block "FC_Countsing" (FC18).
2- In "FC_Counting" (FC18), program the required functions. Use an IEC Counter to count the
parts. Pass "DB_Counter_Parts" (DB18) as the instance data block to this IEC Counter. At
the PV input, parameterize the setpoint quantity 3.
3- Program the call of "FC_Counting" (FC18) in "OB_Cycle" (OB1). Download all blocks into
the CPU and check the program function.
4- In the blocks "FC_Signal" (FC14) and "FC_ConvMotor" (FC16), program the required
lockouts with "M_ACT=SET" (M18.4).
5- Download all modified blocks into the CPU and check the program function.
6- Save your project.

Page | 33
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

6.2. TIMERS

6.2.1. TON On delay timer

The instruction is started when the result of logic operation (RLO) at input IN changes from "0" to
"1" (positive signal edge). The programmed time PT begins when the instruction starts. When the
time PT has elapsed, the output Q has the signal state "1". Output Q remains set as long as the
start input is still "1". When the signal state at the start input changes from "1" to "0", the Q output
is reset. The timer function is started again when a new positive signal edge is detected at the
start input.

The current time value can be queried at the ET output. The timer value starts at T#0s and ends
when the value of the time duration PT is reached. The ET output is reset as soon as the signal
state at the IN-input changes to "0". If the instruction is not called in the program because it is
skipped, for example, the ET output returns a constant value as soon as the time PT has expired.

Example

Page | 34
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

The timer function TON (Timer on delay, "ON Delay") is started with a rising edge at input IN. So
that the time expires, RLO must continue to be '1'. The timer function supplies a '1' signal at output
Q, as soon as the specified time (variable or constant of data type TIME) at input PT has expired

and as long as the start signal at input IN still exists. The already expired time can be queried at output
ET by passing a variable of data type TIME.

6.2.2. TOF:Off delay timer

The Q output is set when the result of logic operation (RLO) at input IN changes from "1" to "0"
(negative signal edge). When the signal state at input IN changes back to "1", the programmed
time PT starts. Output Q remains set as long as the time duration PT is running. When the PT time
duration expires, the Q output is reset. If the signal state at input IN changes to "1" before the PT
time duration expires, the timer is reset. The signal state at the output Q continues to be "1".

The current time value can be queried at the ET output. The timer value starts at T#0s and ends
when the value of the time duration PT is reached. When the PT time duration expires, the ET
output remains set to the current value until input IN changes back to "1". If input IN switches to
"1" before the duration PT has expired, the ET output is reset to the value T#0s. If the instruction is
not called in the program because it is skipped, for example, the ET output returns a constant
value as soon as the time has expired.

Example

Page | 35
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

When the signal state of the operand "Tag_Start" changes from "0" to "1", the "Tag_Status"
operand is set to signal state "1". When the signal state of the "Tag_Start" operand changes from
"1" to "0", the time programmed for the PT parameter is started. As long as the time is running, the
"Tag_Status" operand remains set to TRUE. When the time has expired, the "Tag_Status"
operand is reset to FALSE. The current time value is stored in the "Tag_ElapsedTime" operand.

6.2.3. TP Pulse timer

The instruction is started when the result of logic operation (RLO) at input IN changes from "0" to
"1" (positive signal edge). The programmed time PT begins when the instruction starts. Output Q
is set for the duration PT, regardless of the subsequent course of the input signal. While the time
PT is running, the detection of a new positive signal edge at the IN input has no influence on the
signal state at the Q output.
You can scan the current time value at the ET output. The timer value starts at T#0s and ends
when the value of the time duration PT is reached. When the time PT has elapsed and the signal
state at input IN is "0", the ET output is reset. If the instruction is not called in the program because
it is skipped, for example, the ET output returns a constant value as soon as the time PT has
expired

Page | 36
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Example

When the signal state of the "Tag_Start" operand changes from "0" to "1", the time programmed
for the PT parameter is started and the "Tag_Status" operand is set to "1". The current time value
is stored in the "Tag_ElapsedTime" operand. When the time expires, the "Tag_Status" operand is
reset to signal state "0".

Page | 37
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

6.2.4. TONR Time accumulator

The instruction "Time accumulator" is used to accumulate time values within a period set by the
parameter PT. When the signal state at the IN-input changes from "0" to "1" (positive signal edge),
the time measurement is executed and the time PT starts. While the time PT is running, the time
values are accumulated that are recorded when the IN input has signal state "1". The accumulated
time is written to the ET output and can be queried there. When the duration PT expires, the
output Q has signal state "1". The Q parameter remains set to "1", even when the signal state at
the IN-parameter changes from "1" to "0" (negative signal edge).

The R input resets the ET and Q outputs regardless of the signal state of the start input.

Example

Page | 38
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Updating the actual values in the instance data


The instance data from "Time accumulator" is updated according to the following rules:
• IN input
The "Time accumulator" instruction compares the current RLO with the RLO from the
previous query, which is saved in the IN parameter in the instance data. If the instruction
detects a change in the RLO from "0" to "1", there is a positive signal edge and the time
measurement is continued. If the instruction in the RLO detects a change from "1" to "0",
there is a negative signal edge and the time measurement is interrupted. After the "Time
accumulator" instruction has been processed, the value of the IN parameter is updated in
the instance data and is used as edge memory bit for the next query.
Note that the edge evaluation is disrupted when the actual values of the IN parameter are
written or initialized by other functions.
• PT input
The value at the PT input is written to the PT parameter in the instance data when the edge
changes at the IN input.
• R input
The signal "1" at input R resets the time measurement and blocks it. Edges at the IN input
are ignored. The signal "0" at input R enables time measurement again.
• Q and ET outputs
The actual values of the Q and ET outputs are updated in the following cases:
o When the instruction is called, if the ET or Q outputs are interconnected.
o Or At an access to Q or ET.
If the outputs are not interconnected and also not queried, the current time value at the Q
and ET outputs is not updated. The outputs are not updated, even if the instruction is
skipped in the program.
The internal parameters of the "Time accumulator" instruction are used to calculate the time
values for Q and ET. Note that the time measurement is disrupted when the actual values
of the instruction are written or initialized by other functions.

TIMERS TABLE
PARAMETER DECLARATION DATA MEMORY AREA DESCRIPTION
TYPE
IN Input BOOL I,Q,D,L,M,P,Constant Start Input
PT Input TIME I,Q,D,L,M,P,Constant Duration of Timer Setpoint
R Input BOOL I,Q,D,L,M,P,Constant Reset Input
(Only for TONR Timer)
Q Output BOOL I,Q,D,L,M,P Output for Timer Result
ET Output I,Q,D,L,M,P Current Time Value

Page | 39
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

7. Define and use UDT (User-defined Data Type)

• User-defined data types are special data structures you create yourself that you can use in the
whole S7 program once they have been defined.
• User-defined data types can be used like elementary data types or complex data types in the
variable declaration of logic blocks (FC, FB, OB) or as a data type for variables in a data block (DB).
You then have the advantage that you only need to define a special data structure once to be able
to use it as many times as you wish and assign it any number of variables.
• User-defined data types can be used as a template for creating data blocks with the same data
structure, meaning you create the structure once and then create the required data blocks by simply
assigning the user-defined data type
(Example: Recipes: The structure of the data block is always the same, only the amounts used are
different.)

7.1. Create A (UDT)


1. From Project Tree > PLC data types > Add New Data Type

At Name you can put the name of each line


Data Type: Elementary, Complex or Pre-defined UDT

Default Value:
default value to be
saved for defined
parameter.

Page | 40
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

7.2. Where Can Use the UDT


• Shared Data Blocks
As a user-defined data type you can use it in data block to define same arrangement of
parameters for frequent operation
• Instance Data Blocks
Also, it can be used for declaration of Function Block to be integrated to its instance data
block ( It can be entered in Static, or IN-Out declaration )
• Function Declaration
In this case as the function doesn’t have a data block, so user should apply a similar
assigned UDT in data block to be entered

Page | 41
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

8. Analog Values linearization and calibrations

8.1. Analog and binary signals


Binary signals can assume only 2 signal states: signal state 1 (voltage present) and signal state 0
(no voltage present). In control engineering, it is frequently necessary to read, process and output
analog signals in addition to binary signals. In contrast to binary signals, analog signals take on
any number of values within a specific range. Possible analog variables include:
● Temperature
● Pressure
● Speed
● Fill level
● pH value
Transducers
Controllers are only capable of processing analog values in the form of bit patterns. For this
purpose, transducers which can be connected to the analog module measure physical variables
such as pressure or temperature. The analog input module reads this analog value in the form of
current, voltage or resistance. To enable the CPU to process the current or voltage measured, an
integrated analog-to-digital converter in the analog input module
converts the value into a 16-bit integer value. Depending on the type of measurement, you can
use the following
● Voltage transducers
● Current transducers (2-wire transducers, 4-wire transducers)
● Resistance transducers (4-wire connection,3-wire connection,2-wire connection)
● Thermocouples
EXAMPLE
Speed is acquired using a transducer which converts the speed range of 0 to 1500 rpm to a
voltage range of 1 to 5 V. At a measured speed of 865 rpm, the transducer outputs a value
of 3.3 V.
The resulting voltage value is calculated as follows:

8.2. Measuring ranges


For the display of the measuring range, SIMATIC S7 distinguishes between the rated range, the
overrange and under range, and the overflow or underflow. This distinction allows you to
recognize whether the measured value is actually in the measuring range determined in the
technical specifications. The overflow and underflow ranges are reserved for error detection.
At a resolution of 16 bits the theoretically possible 32768 increments are distributed across a
voltage range of 11.852 V, which means that only 27648 increments are actually available for the
resolution of a measuring range of 10 V. The minimum value which can be represented is
therefore 0.3617 mV

Page | 42
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

8.3. Scaling analog values


Scaling
It is often necessary to calculate the actual process value rather than increments
(e.g., 10 V = 27648 increments) for further processing of digitalized analog values. The
conversion of a value range (e.g., -27648 to +27648 increments) to the original physical
quantity (e.g., 0 to 500 liters) is referred to as scaling.

EXAMPLE
In the example below the fill level of a tank with a capacity of 500 liters is to be measured.
The transducer used measures a voltage of -10 V with an empty tank and a voltage of +10 V
with a full tank. The analog module converts the voltage range from -10 V to +10 V into the
value range -27648 to +27648 and converts this range into the original quantity of 0 to
500 liters with the NORM-X and SCALE-X Blocks.

You can use the SCALE_ X "Scale" and NORM_X "Normalize" converters to scale analog values
Open Instructions>Basic Instructions> Conversion Operation

In the following examples it is assumed that the measuring ranges are bipolar. The integer input
value is then between -27648 and 27648.

Page | 43
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

The following values are generated by the conversion (for determining level via voltage
measurement, for example):

Integer value Measured value Phys. value


(analog value) (in the -10 -10V range)
-27648 -10.0 0.0 L
-13824 -5.0 125.0 L
0 0.0 250.0 L
13824 5.0 375.0 L
27648 10.0 500.0 L

The upper and lower limits are MAX=27648


and MIN= -27648 for normalization and
MAX=500 L and Min=0 L for scaling. Since
the input values are of the Integer data type
and the output values are scaled as Real
data type, the NORM_X function converts
the data type from Integer to Real. So, if the
Value of voltage is -5 volt then the integer
will be -13824 and the NORM should be
0.25

Page | 44
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

We take the result of NORM_X to the


SCALE_X block, we put the minimum and
maximum scaled value and we got a floating
number on the OUT of SCALE_X

So now you are fully controlled to Scale for


Analog input and Analog Output

Page | 45
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

9. Using System Memory Bits, and System clock Bits

A PLC tag is automatically created for each available system or clock memory bit.
9.1. Clock Memory (8 bits)
These are memory bits whose binary state is changed periodically by the operating system of the
CPU with a pulse-pause ratio of 1:1. The various frequencies are shown in the picture.
Clock memory (bits) are used to trigger actions periodically.
For example, to make an indicator light flash
Attention!
Clock memory (bits) are not synchronized with the CPU cycle; in other words, with long cycle
times, the state of the clock memory (bits) can change more than once within one cycle.
9.2. System Memory (4 bits)
These are memory bits that provide system status information.
• "First Scan" =1 in the first CPU cycle; otherwise =0
• "Diag Status Update" =1, if a problem exists; otherwise =0
• One static 0 and 1 memory bit each

Page | 46
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

10. Difference Between S7-1500 modules

Signal modules in S7-1500 divided into major four types with categories

1. DIGITAL INPUTS MODULES TYPES


2. DIGITAL OUTPUTS MODULES TYPES
3. ANALOG INPUTS MODULES TYPES
4. ANALOG OUTPUT MODULES TYPES

10.1. Digital Input Modules


10.1.1. Modules Types :
Basic Modules (BA)
• Digital input module grouping 16
• input delay 3.2ms

High Features Modules (HF)


• Digital input module grouping 16
• input delay 0. 05..20ms
• configurable diagnostics
Page | 47
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

• hardware interrupts
• value status
• integrated counter for channel 0 and 1
10.1.2. Module Options

10.1.3. Module Parameters:


Comparison preset to actual module
Defines the startup behavior for the case where a module in a slot does not correspond
to the configured module. This parameter applies to the CPU and to all the modules for
which no other setting was selected.
• Startup of the CPU only if compatible: In this setting a module on a configured slot
has to be compatible with the configured module.
• Startup of the CPU even if there are differences: At this setting the CPU starts up
irrespective of the type of module plugged.
For locally used modules you can configure the hardware compatibility in the parameter
"Comparison between preset module and actual module" individually for each slot. When
you change the setting of the hardware compatibility for a module, the setting made at
the CPU does not apply for this module.

Page | 48
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

10.1.4. Hardware compatibility


Compatible means that the module matches the number of inputs and output and must match with
respect to its electrical and functional properties. A compatible module must be fully able to
replace a configured module; it may be more capable, but not less capable.
In case of the "Startup of the CPU only if compatible" setting the CPU only starts up if the
configured module or a compatible module is inserted. The CPU does not start up if an
incompatible module is inserted.
Example for the "Startup of the CPU only if compatible" setting:
The input module DI 32x24VDC HF with 32 digital inputs is a compatible replacement for the input
module DI 16x24VDC HF with 16 digital inputs, because the pin assignment and all the electrical
and functional properties agree.
Example for the "Startup of the CPU even if there are differences" setting:
Instead of a configured digital input module an analog output module is plugged or no
module is present in this slot. Although the configured inputs cannot be accessed, the CPU starts
up.
Note in this case that the user program cannot function correctly, so take the appropriate
measures!
10.2. Digital Outputs Modules

10.2.1. Output modules types


Basic Modules (BA)
• grouping 8
• 4A per group
Standard Modules (ST)
• grouping 8
• 4A per group
• configurable diagnostics
• configurable substitute value for output
• isochronous mode
High Features Modules (HF)
• grouping 4
• 8A per group
• configurable diagnostics
• configurable substitute value for output
• pulse width modulation
• switching cycle counter

Page | 49
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

10.2.2. ST and HF Module Options

Reaction to CPU STOP

Three options to take the reaction in case of CPU stop (only in HF) modules
1- Shutdown: The output state goes to OFF in case of CPU Stop
2- Keep last value: The output value will not be changed since the last Peripheral output
update of the last scan cycle
3- Output substitute value 1: in this case the output will be forced ON

Page | 50
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

11. PID Compact

The "PID_Compact" technology object reads the measured process value and compares it with
the setpoint (in this example, the setpoint is set via HMI). From the resulting control deviation, the
controller calculates an output value in order to adjust the setpoint deviation or the disturbance
variable if necessary. The output value of the PID controller consists of three components:
• P component The P component of the output value is proportional to the control deviation.
• I component The I component of the output value is the integral component. This increases
as long as there is a control deviation.
• D component The D component is the differential component and increases as the rate of
change of the control deviation increases.

The "PID_Compact" technology object has the "tuning" commissioning functionality with which the
P, I and D parameters can be calculated automatically depending on the controlled system.
However, you can also specify the control parameters manually.
The automatic tuning is divided into tuning types:
1. Pretuning and
2. Fine tuning
Both types of tuning are described below.

11.1. FB "PID_Compact"
STEP 7 V15.1 supplies the technology object "PID_Compact" in version 2.3 for the S7-1200 or
version 2.4 for the S7-1500 with the installation. This function block was specially developed for
the control of proportional actuators.

Page | 51
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Page | 52
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

11.2. Configure PID controller


You can access the PID Compact block through technology from instruction tree , drag then assign a data
block

Page | 53
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Open the configuration editor by selecting the CPU -> Technology objects -> PID_Compact_1 ->
Configuration.

Page | 54
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Page | 55
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Page | 56
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Page | 57
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

11.3. Commissioning the compact controller

Page | 58
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

The PID parameters are retentively stored in the instance data module of the "PID_Compact"
compact controller. During a warm start (voltage recovery), the last values passed through are
retained. The start values are only loaded during a cold start (transfer of the project in the
operating state STOP or overall reset of the memory via MRES).

Page | 59
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

12. Network Ring Topology MRP

Automated plants often need to be in operation 24/7. Therefore, failure safety and high availability
are important, the basic requirements of many automation systems. Special media redundancy
protocols that ensure a loop-free network topology and a detection of communication interruptions
address these issues.
Redundant systems require a switching time to detect interruptions and to switch over to redundant
structures.
The requirements are met on the basis of a ring topology of the MRP (“Media Redundancy
Protocol”) extension “Media Redundancy with Planned Duplication of frames” (“MRPD”). During a
device or line failure in the ring, all other devices continue to be supplied with IO data without
interruption.

Page | 60
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

12.1. Redundancy levels of IO Devices with MRPD

With MRPD, there are several redundancy levels of an IO Device. This redundancy level indicates,
how severely real-time communication is affected in the event of a network interruption between
the IO Device and its IO Controller.
The following redundancy levels are available:
• Full media redundancy: The real-time communication is not affected, since IO Controller
and IO Device are in the same ring.
• Partial media redundancy:
– Real-time communication cannot be maintained, if there is an interruption in a non-redundant
part (line) between IO Controller and IO Device.
– The real-time communication is not affected, if there is an interruption in the redundant part
(ring).
• No media redundancy: The real-time communication is always affected, since there are no
redundant paths between IO Controller and IO Device.

The following figure shows the redundancy levels by means of a configuration example with
MRPD. The three IO Devices in the ring (2) and the switch (3) have the redundancy level “Full
redundancy”. The IO Device at the switch (4) has the redundancy level “Partial redundancy”, as
the connection to the switch is not redundant.

Page | 61
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

12.2. Configure the MRP System

Preparation
Open the TIA Portal configuration software and create a new project.
12.2.1. Implementing the devices
Add the following devices:
1. Add an S7-1500 CPU (Should Support MRP) using the project navigation. This CPU gets
the name “PLC_1”.
2. In the “Devices & networks” overview, insert two ET 200SP stations with a PROFINET
interface module (in this case 155-6 PN HS) and equip it with the desired modules (in this
case one DI module and one DO module) as well as with a server module.

12.2.2. Networking the devices


To set up an automation system, the individual hardware components must be configured,
parameterized and connected to each other.
Proceed as follows:
1. Open the device view of the CPU by double clicking “Device configuration”.
2. In the graphical view, select the “X1” interface of the CPU to be networked. The properties
of the selected interface are displayed in the inspector window.
3. Select the parameter group “Ethernet addresses” and, under “Interface networked with”,
click “Add new subnet”.

Page | 62
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Add the interface modules (in this case IM 155-6 PN HS) to the newly created network.
For both interface modules, proceed as follows:
1. Access the “Devices & Networks” overview in the project navigation.
2. At the interface module, click “Not assigned” and select the IO controller (“PLC_1”) to which
this IO device is assigned.

12.2.3. Setting the topology


To configure the ring in STEP7, you need to set the topology of the participants.
1. You are currently in the topology view.
2. Generate a ring via the port interconnections. First, interconnect the devices to a line
topology. Connect the non-occupied port of the last device in the line with the non-occupied
port of the first device.

12.2.4. Configuring the media redundancy


Configure the ring’s media redundancy.
1. Go to “Network View”.
2. Select the PROFINET IO System by clicking on the network connection.
3. In the inspector window, navigate to “Properties” > “General” > “Domain management” >
“MRP domains” to the field “Ring interconnection”.
4. In the field “Ring interconnection”, select the ring generated above. The table below
displays all PROFINET devices of the selected ring.

Page | 63
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

5. In the “MRP role” column, set the media redundancy role for the PROFINET devices.

12.2.5. Configuring IRT


For media redundancy with MRPD, IRT must be activated in the configuration. For this, Please
follow the instructions below:
1. In the network view, select an IO device.
2. In the inspector window, navigate to “Properties” > “General” > “PROFINET interface” >
“Advanced options” > “Real time settings” > “Synchronization”.
3. Change the “RT class” to “IRT”.
4.

Page | 64
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Contents
1. Introduction to TIA Portal Dashboard ..................................................................................................... 2
.1.1 One common engineering framework for manufacturing automation ............................................. 2
1.2. TIA Portal: Portal View and Project View ............................................................................................ 3
.1.2.1 Layout of the Portal View: ........................................................................................................... 4
1.2.2. Layout of the Project View:.......................................................................................................... 5
1.3. TIA Portal - Settings: User Interface Language ................................................................................... 6
1.4. TIA Portal - Settings: Language, Storage Location, Layout ................................................................. 7
2. Built up Hardware configuration (S7-1500) ............................................................................................... 8
2.1. Configuration of the S7-1500 .............................................................................................................. 8
2.2. Creating a Hardware Station ............................................................................................................... 9
2.3. Inserting / Deleting a Module ........................................................................................................... 10
2.3.1. Inserting a Module ..................................................................................................................... 10
2.3.2. Deleting a Module...................................................................................................................... 10
2.4. Online Tools, Configuring and Parameterizing the Hardware .......................................................... 11
2.4.1. Online Tools ............................................................................................................................... 11
2.4.2. Configuring and Parameterizing the Hardware ......................................................................... 11
2.4.3. Internet Protocol........................................................................................................................ 12
2.4.4. IP Addresses ............................................................................................................................... 12
2.4.5. MAC Address .............................................................................................................................. 12
2.4.6. Subnet Mask .............................................................................................................................. 12
2.5. Compiling the Hardware Configuration and Downloading it into CPU ............................................ 13
Compiling / Downloading the Hardware Configuration ........................................................................... 13
3. Data types of PLC under TIA portal .......................................................................................................... 14
3.1. Elementary Data Types ..................................................................................................................... 14
3.2. Complex Data Types .......................................................................................................................... 15
3.3. PLC Data Types .................................................................................................................................. 15
4. Handling with Functions, Functions blocks, Data Blocks ......................................................................... 16
4.1. Data Blocks and their Usage.............................................................................................................. 16
.4.2 Creating DBs ...................................................................................................................................... 16
4.3. Functions (FCs) .................................................................................................................................. 17
4.4. Function Blocks (FBs)......................................................................................................................... 17
Page | 65
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

4.4.1. Special Features ......................................................................................................................... 17


4.4.2. Parameters ................................................................................................................................. 17
4.4.3. FB Advantages ............................................................................................................................ 17
4.4.4. Parameters ................................................................................................................................. 18
4.4.5. Static Variables........................................................................................................................... 18
5. Types of Operation Blocks (OBs) .............................................................................................................. 19
5.1. Types of Program Blocks in TIA Portal .............................................................................................. 19
5.2. Process Images .................................................................................................................................. 20
5.3. Cyclic Program Execution .................................................................................................................. 21
5.4. Local and Global Operands ............................................................................................................... 22
5.5. What is The Data Block ..................................................................................................................... 22
5.6. Startup Program ................................................................................................................................ 23
5.7. Cyclic Program Execution .................................................................................................................. 23
5.8. Periodic Program Execution .............................................................................................................. 23
5.9. Event-driven Program Execution ...................................................................................................... 23
5.10. OB Calls .......................................................................................................................................... 24
5.10.1. Interrupting the Cyclic Program................................................................................................. 24
5.10.2. Priorities ..................................................................................................................................... 24
.5.10.3 Queue......................................................................................................................................... 24
5.11. Time-of-day Interrupt .................................................................................................................... 25
5.12. Cyclic Interrupt .............................................................................................................................. 26
5.13. Hardware Interrupt ....................................................................................................................... 27
6. TIA Portal types of Timers, Counters ........................................................................................................ 28
6.1. Counters ............................................................................................................................................ 28
6.1.1. CTU: Count up ............................................................................................................................ 28
6.1.2. CTD: Count down ....................................................................................................................... 29
6.1.3. CTUD: Count up and down ........................................................................................................ 31
6.1.4. Exercise: Counting the Transported Parts ................................................................................. 32
6.2. TIMERS .............................................................................................................................................. 34
6.2.1. TON On delay timer ................................................................................................................... 34
6.2.2. TOF:Off delay timer.................................................................................................................... 35
6.2.3. TP Pulse timer ............................................................................................................................ 36
6.2.4. TONR Time accumulator ............................................................................................................ 38
Page | 66
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

7. Define and use UDT (User-defined Data Type) ........................................................................................ 40


7.1. Create A (UDT)................................................................................................................................... 40
7.2. Where Can Use the UDT.................................................................................................................... 41
8. Analog Values linearization and calibrations ........................................................................................... 42
8.1. Analog and binary signals .................................................................................................................. 42
8.2. Measuring ranges .............................................................................................................................. 42
8.3. Scaling analog values......................................................................................................................... 43
9. Using System Memory Bits, and System clock Bits .................................................................................. 46
9.1. Clock Memory (8 bits) ....................................................................................................................... 46
9.2. System Memory (4 bits) .................................................................................................................... 46
10. Difference Between S7-1500 modules ................................................................................................. 47
10.1. Digital Input Modules .................................................................................................................... 47
10.1.1. Modules Types : ......................................................................................................................... 47
10.1.2. Module Options ......................................................................................................................... 48
10.1.3. Module Parameters: .................................................................................................................. 48
10.1.4. Hardware compatibility ............................................................................................................. 49
10.2. Digital Outputs Modules................................................................................................................ 49
10.2.1. Output modules types ............................................................................................................... 49
10.2.2. ST and HF Module Options ........................................................................................................ 50
11. PID Compact.......................................................................................................................................... 51
11.1. FB "PID_Compact" ......................................................................................................................... 51
11.2. Configure PID controller ................................................................................................................ 53
11.3. Commissioning the compact controller ........................................................................................ 58
12. Network Ring Topology MRP ................................................................................................................ 60
12.1. Redundancy levels of IO Devices with MRPD ................................................................................ 61
12.2. Configure the MRP System ............................................................................................................ 62
12.2.1. Implementing the devices ......................................................................................................... 62
12.2.2. Networking the devices ............................................................................................................. 62
12.2.3. Setting the topology .................................................................................................................. 63
12.2.4. Configuring the media redundancy ........................................................................................... 63
12.2.5. Configuring IRT ........................................................................................................................... 64
13. Contents ................................................................................................................................................ 65

Page | 67
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses
151 EBED STREET, KORNISH EL NILE - CAIRO - EGY.
Training Center EISAC AUTOMATION

Page | 68
Mobile: +20 120 471 7026
www.eisac-automation.com E-mail:[email protected]
Sales - Maintenance - Programming - Courses

You might also like