Sie sind auf Seite 1von 24

Data Communication with Industrial Ethernet

SIMATIC S7
Siemens AG 2008. All rights reserved.

Date:
File:

18.09.2009
PRO3_08E.1

Contents

SITRAIN Training for


Automation and Industrial Solutions

Page

Objectives ........................................................................................................................................
Subnets in SIMATIC .........................................................................................................................
Communication Services for SIMATIC ............................................................................................
Industrial Ethernet An Overview ....................................................................................................
Ethernet CP Communications Services ............................................................................................
Functions and Services ....................................................................................................................
Definition of Terms ...........................................................................................................................
Structure of the IP Address (Internet Address) ..................................................................................
Integrating an Ethernet CP in the Hardware Configuration ................................................................
Assigning Parameters to the Ethernet Interface ................................................................................
Loading the Configuration Data ........................................................................................................
Communication Connections ............................................................................................................
Creating/Inserting a New Connection ................................................................................................
Connection Properties ......................................................................................................................
Functions for Data Transfer ..............................................................................................................
SIMATIC_NET_CP Library ...............................................................................................................
Communications Structure ...............................................................................................................
Communications Structure ...............................................................................................................
Exercise 1: Configuring a CP and Assigning Parameters to It ...........................................................
Exercise 2: Creating/Inserting an ISO-on-TCP Connection ...............................................................
Exercise 3: Assigning Parameters to the ISO-on-TCP Connection ...................................................
Exercise 4 : Expanding the S7 and Operator Panel Program ............................................................
Exercise 5: Communication via ISO-on-TCP Connection ..................................................................

SITRAIN Training for


Automation and Industrial Solutions

Page 1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

ST-PRO3
Industrial Ethernet

Objectives

At the end of the chapter the participant will ...

SIMATIC S7
Siemens AG 2008. All rights reserved.

SITRAIN Training for


Automation and Industrial Solutions

...

have received an overview of the most important basics


of Industrial Ethernet

be able to assign parameters to an Ethernet


communications module and network it

be able to program the SEND/RECV user interface

Date:
File:

18.09.2009
PRO3_08E.2

Page 2

SITRAIN Training for


Automation and Industrial Solutions

ST-PRO3
Industrial Ethernet

Subnets in SIMATIC

PG 720

OPs

PC, OS

PG

MPI Network
Industrial Ethernet
Point to Point

PROFIBUS

SIMATIC S5

S7-400

M7-400

S7-300

Cell Level

-SINUMERIK, RCM
-TI 505
-Other PLC

PROFIBUS-DP

Field Level

DP/AS-I Link
ET 200C

ET 200B/L
ASI (Actuator Sensor Interface)
AS-I
Submodule

AS-I Power Supply

AS-I
Level

Field device with AS-I ASIC Sensors and Actuators

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.3

SITRAIN Training for


Automation and Industrial Solutions

Overview

SIEMENS offers the following subnets, depending on the different requirements


for the communication tasks in the cell area (non-time critical) or in the field level
(time critical).

MPI

The MPI subnet is designed for tasks in the cell area. The MPI is the multi-point
capable interface in SIMATIC S7.
It is designed as the PG interface, that is, for the connection of PGs
(commissioning and test) and OPs (operator interface). Beyond that, the MPI
subnet can also be used to network a few CPUs.

Industrial Ethernet

Industrial Ethernet is the network for the management level and the cell level in
the open, manufacturer independent communication system of SIMATIC.
Industrial Ethernet is designed for the non-time critical transmission of larger
amounts of data and offers the possibility of connecting to location crossing
networks via Gateways.

PROFIBUS

PROFIBUS is the network for the cell and field area in the open, manufacturer
independent communication system of SIMATIC. There are two versions each
with their own characteristics:
in the cell area as PROFIBUS for the non-time critical communication
between equal, intelligent nodes.
as field bus PROFIBUS DP for time critical, cyclical data exchange between
intelligent masters and field devices.

PtP-Connection

Point-to-Point connections are mainly used for the non-time critical data
exchange between two stations or for the connection of devices, such as OPs,
printers, bar code readers, magnetic card readers etc. to a station.

AS-Interface

The Actuator-Sensor-Interface is a subnet for the lowest process level in PLC


systems. With its help, binary sensors and actuators can be networked.

SITRAIN Training for


Automation and Industrial Solutions

Page 3

ST-PRO3
Industrial Ethernet

Global Data
PG and HMI Functions
S7 Basic Comm.
S7 Expanded Communication

FDL

Comm. Conf.
Standards

SIMATIC S7
Communication

Communication Services for SIMATIC

TCP/ISO-on-TCP

Open
Communic.

UDP
FMS

SIMATIC S7

S7 Communication

FDL (SDA)
ISO-Transport
TCP, ISO-on-TCP
UDP

FMS

MAP

DP

Profibus

Date:
File:

Siemens AG 2008. All rights reserved.

Global Data

MAP 3.0

DP
MPI

Services

ISO Transport

18.09.2009
PRO3_08E.4

Ethernet

SITRAIN Training for


Automation and Industrial Solutions

A communications service describes communications functions with defined


performance characteristics, such as exchanging data, controlling devices,
monitoring devices, and loading programs.
GD (Global Data in the network) for cyclical data exchange of small amounts of
data (in S7-400 additionally event-driven).
These communication utilities are optimized for the communication of S7 PLCs,
PGs/PCs and OP/TDs (Text-Displays) in the SIMATIC S7 connection.
PG functions; a PG can be connected without configured connection.
HMI functions; an OP can be connected without a configured connection.
Basic communication is implemented with SFCs that are contained in the
CPUs operating system. (SFC communication runs without configured
connection).
Expanded communication takes place via configured connections with the
help of SFBs (S7-400 Client/Server; S7- 300 only Server).
For the safe data transfer of average amounts of data between SIMATIC S7 and
S5. Corresponds to Layer 2 Fieldbus Data Link (FDL) for Profibus.
Is used for the safe data transfer of average to larger amounts of data from
SIMATIC S7 to PCs or non-Siemens systems using Industrial Ethernet
networks. The FDL, ISO, TCP , ISO-on-TCP and UDP utilities are made
available on the CPU using the functions AG-SEND/RECV or
AG-LSEND/LRECV.
Fieldbus Message Specification (FMS) makes the object-oriented
communication between intelligent partners as well as field devices possible.
Utilities supported by FMS (variables, domain services, etc.) are specified in EN
50170 Vol. 2.
Originally developed by the American automobile company General Motors, this
protocol is for object-oriented communication between PLC systems (MAP=
Manufacturer Automation Protocol).
The DP (Distributed I/O) protocol is specially optimized for the time-critical, dataoriented communication from intelligent control units (DP Masters) to field
devices (EN 50170 Vol. 3).

SITRAIN Training for


Automation and Industrial Solutions

Page 4

ST-PRO3
Industrial Ethernet

Industrial Ethernet An Overview

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.5

SITRAIN Training for


Automation and Industrial Solutions

Overview

One of the most important industrial communication networks in the field of


SIMATIC NET is Industrial Ethernet (IE). Industrial Ethernet is a
communication network using basic band transmission technology according
to the international IEEE 802.3 standard with CSMA/CD (Carrier Sense with
collision detection) access procedure.
Networking takes place at a transmission speed of 10/100 MBit/s using fiberoptic cable or shielded 2-wire cables (Industrial Twisted Pair ITP). In the open,
manufacturer-independent communications system of SIMATIC, Industrial
Ethernet represents the network system for the production control and cell
levels.
Industrial Ethernet is suitable for fast data transmission of large amounts of
data and by using gateways and routers provides cross-location networking.

SIMATIC S7

For communication using Industrial Ethernet in the SIMATIC environment


there are different possibilities available that are typically identified as
communication types, depending on the requirement.
The spectrum ranges from the generally valid Standard Protocols that are
found in S5-compatible communication up to the user-friendly S7
communications mechanisms adapted for SIMATIC components. The TCP/IP
and UDP standardized protocols as well as special protocols for industry
automation such as ISO Transport and ISO-on-TCP connections are used.
For the diverse Ethernet communications processors (CP) there is a series of
communications types available in SIMATIC depending on the type.

SITRAIN Training for


Automation and Industrial Solutions

Page 5

ST-PRO3
Industrial Ethernet

Ethernet CP Communications Services

PG/OP communication
S7 communication
S5-compatible
communication

PROFINET communication

Via the protocols


- ISO
- TCP/IP ( RFC 1006)
With SEND /RECEIVE interface
via protocols
- ISO-Transport
- ISO-on-TCP (TCP/IP with RFC 1006)
- TCP UDP - E-Mail
With FETCH/WRITE services via
protocols
-ISO-Transport, -ISO-on-TCP
-TCP
Via the protocols
-TCP

HTML process control


via web browser

Via the protocols


- HTML/ IP protocol

File management and file


access via FTP

Via the protocols


- FTP/ IP protocol

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.6

SITRAIN Training for


Automation and Industrial Solutions

PG/OP

The PG/OP communication is used for loading programs and configuration


data, for carrying out test and diagnostic functions as well as for monitoring
and control of a system using HMI systems.

S7 Communication

The S7 communication forms a simple and efficient interface between


SIMATIC S7 stations and the PG/PC using communication function blocks.

S5compatible

The SEND/RECEIVE interface enables program-controlled communication


using a configured connection from SIMATIC S7 to SIMATIC S7, SIMATIC S5
and to the PC/PG.

IT Functions

Features of IT communication are the sending of e-mails, the monitoring of


device data and process data (HTML process control) and FTP functions (File
Transfer Protocol) for file management as well as accesses to data blocks in
the CPU (Client and Server function).

PROFINET

PROFINET is a standard of the PROFIBUS user organization (PNO) that


defines a cross-manufacturer communications and engineering model. An
S7-300 station equipped with a PROFINETcapable CP can be
interconnected in SIMATIC iMap as a PROFINET component.

SITRAIN Training for


Automation and Industrial Solutions

Page 6

ST-PRO3
Industrial Ethernet

Functions and Services


S7 Connections
Connection type that can be configured in all S7/M7 devices. The SFBs BSEND/BRCV are
used. Acknowledgement takes place.
S7 Connections, high-MTBF
Like S7 connections; however limited to S7-H-CPUs as well as SIMATIC PC stations (such
as, OPC-Server).
ISO Transport Connection
The ISO transport connection is suitable for large amounts of data because of "Data
Blocking". Transmission via "Send/Receive" as well as "Fetch and Write".
ISO-on-TCP Connection
The ISO-on-TCP connection conforms to the TCP/IP Standard with the expansion of RFC
1006 according to Layer 4 of the ISO Reference Model. Transmission can take place via
"Send/Receive" as well as "Fetch and Write". Receipt of data is confirmed through an
acknowledgement.
TCP Connection
The TCP connection conforms to the TCP/IP Standard. Data transmission takes place via
"Send/Receive" as well as "Fetch and Write".
UDP Connection
The UDP connection (User Datagram Protocol) enables unsecured transmission of
continuous data blocks between two nodes.
SIMATIC S7
Siemens AG 2008. All rights reserved.

Date:
File:

18.09.2009
PRO3_08E.7

SITRAIN Training for


Automation and Industrial Solutions

General

For connection configuration with STEP 7 (NetPro tool), you can explicitly select the
suitable connection type.

ISO-on-TCP

ISO-on-TCP is meant for secured cross-network data transmission. The ISO-onTCP protocol corresponds to the TCP Standard with the RFC 1006 addendum which
enables the transfer of data blocks. The advantage is that the transmission security
is very high due to automatic repetition and automatic block test mechanisms. For
communication between SIMATIC devices, the use of ISO-on-TCP connections is
recommended. Of course, both partners must fulfill the RFC 1006 Standard.
The communications partner confirms the data receipt using the SEND/RECEIVE
interface.

TCP/IP

The TCP connection is also called TCP-native or TCP/IP connection. With the TCP
connections and the SEND/RECEIVE interface, the Ethernet-CP supports the
socket interface (such as, winsocket.dll) to TCP/IP which is available on almost
every end system (PC or other system). TCP/IP connections should be used for the
connection to other systems if these do not support the RFC 1006 protocol
addendum.

ISO Transport The ISO protocol is, according to the ISO 8073 standard, an open protocol for
secured data transmission using configured connections. ISO Transport is
transmitted exclusively using Industrial Ethernet and is optimized for use on the
production level.
UDP

UDP is meant for simple, cross-network data transmission without


acknowledgement. Through UDP connections, broadcast and multicast telegrams
can also be sent.

SITRAIN Training for


Automation and Industrial Solutions

Page 7

ST-PRO3
Industrial Ethernet

Definition of Terms

IP = 192.168.0.3

MAC = 08-00-06-01-CA-FE
Subnet mask = 255.255.255.0

IP = 192.168.0.2
MAC = 08-00-06-01-AD-AC
Subnet mask = 255.255.255.0

Computer 1 would like to build up a connection to Computer 2:


1.

ARP query to all (MAC broadcast) from Computer 1:


Who has IP address 192.168.0.2?

2.

ARP answer from Computer 2:


The MAC address to 192.168.0.2 is 08-00-06-01-AD-AC.

3.

The connection can be built up.

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.8

SITRAIN Training for


Automation and Industrial Solutions

ARP

To determine the Ethernet address of the receiver, the IP driver makes use of
the ARP protocol structure (Address Resolution Protocol).
In every TCP/IP-capable computer there is such an ARP table in which the
assignment of IP address to Ethernet address exists.

MAC Address

Since all stations are connected to the same bus cable, it is necessary for
targeted addressing that every participant has its own address through which it
is then accessible in the network.
For this, every Ethernet interface has been assigned a fixed and world-wide
unique address by is manufacturer. This address is called hardware or MAC
address (Media Access Control). It is stored on the network card and is used for
unique identification in the local network. Manufacturer cooperation ensures that
the address is unique world-wide.

DHCP

DHCP (Dynamic host configuration protocol) is a protocol developed by


Microsoft for the dynamic assignment of IP addresses.
Each computer or CP in the network requires its own IP address. Insofar as a
DHCP server is set up, it automatically assigns querying computers in the
network addresses out of a defined IP address pool. A computer sends an
address request and then is assigned its IP address from the DHCP server. No
fixed addresses have to be assigned which considerably reduces the
configuration effort for a network.

Subnet Mask

With the subnet mask, the division of the IP address into network and computer
address is carried out. Furthermore, a network can be further divided into
subnets with the subnet mask. As a result, a part of the computer address is
used as the subnet(work) address. That way, networks can be flexibly adapted
to organizational and physical factors.

SITRAIN Training for


Automation and Industrial Solutions

Page 8

ST-PRO3
Industrial Ethernet

Structure of the IP Address (Internet Address)

Addresses of Type A

(for a few subnets, but many


stations per subnet)

b31

b0

Version

Subnet

Station address

Addresses of Type B

(for a fair number of


subnets and stations)
b0

b31
Version

10

Subnet

Addresses of Type C

Station address

(for many subnets, but only a few


stations per subnet)
b0

b31
Version

110

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

IP Address

18.09.2009
PRO3_08E.9

SITRAIN Training for


Automation and Industrial Solutions

Each computer that is connected to the Internet has an IP address.


It is usually specified in the Dottet Quad Notation or Standard Dot Notation.
The 32 bit long IP address is represented in 4 decimal numbers that are
separated by a period: for example, 192.168.111.100.
Internet addresses are not assigned to a computer, rather to the network
interfaces that a computer has in different networks. The IP address consists of
three parts:

the network ID or network classs A, B or C


Network Address or Net ID
System address or local address or Host ID

Type A:
Type B:
Type C:
Type D:
Type E:
Note

Station
address

Subnet

127 networks, 24 bit Host ID:


16,383 networks, 16 bit Host ID:
approx. 2 million networks, 8 bit Host ID:
Multicast:
Reserved:

0 - 127.H.H.H
128 - 191.N.H.H
192 - 223.N.N.H
224-239.M.M.M
240-255.R.R.R

The network with the number 127 can not be used (loopback interface of IP
implementation: 127.0.0.1 = localhost).
Host IDs whose bits are all set to 0 or 1 are reserved for special functions, such
as, broadcasting, and therefore may not be assigned.
Carefully check the assignment of the IP addresses, if necessary, with the
support of the DV administration.

SITRAIN Training for


Automation and Industrial Solutions

Page 9

ST-PRO3
Industrial Ethernet

Integrating an Ethernet CP in the Hardware Configuration

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.10

SITRAIN Training for


Automation and Industrial Solutions

Task

The communication processors (CP) are configured and assigned


parameters in the Hardware Configuration just like all other modules. The
CPs are interconnected to a functioning network by means of IE cables and a
switch / hub or ESM module (Electrical Switch Module).

What to Do

The following configuration steps are necessary:


1.
2.
3.
4.

commission Ethernet CPs with STEP 7,


load configuration data in the participating target systems,
configure communications services and load them,
program SEND / RECEIVE interface

To be able to connect the SIMATIC stations to an Ethernet subnet, create a


subnet in your project. It is advisable to create the subnet before you
configure the stations since the assignment of the SIMATIC stations then
essentially takes place automatically. To do so, select the options Insert
Subnet Industrial Ethernet in the SIMATIC Manager.
Result

A new subnet Ethernet (1) is then created in the project. All SIMATIC stations
existing in the project can be connected to this subnet.
If you prefer a graphic network display, select the network object Ethernet(1)
and open this object by double-clicking on it.

SITRAIN Training for


Automation and Industrial Solutions

Page 10

ST-PRO3
Industrial Ethernet

Assigning Parameters to the Ethernet Interface

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.11

SITRAIN Training for


Automation and Industrial Solutions

General

When you use the TCP/IP Protocol, the MAC address as well as the IP
parameters are displayed. The default values can be changed accordingly.
ISO and/or IP Protocol must be explicitly selected.
In addition, a Router with its IP address can also be configured.

What to Do

1. Select the following MAC and IP addresses:


- for Station 1: 08-00-06-01-74-10;
- for Station 2: 08-00-06-01-74-20;
- for Station 1: 192.168.111.101; Subnet mask:
255.255.255.0
- for Station 2: 192.168.111.105; Subnet mask:
255.255.255.0
2. Select the desired subnet type Ethernet(1) from the Subnet list.
Important: Both stations must be connected to the same Ethernet.
3. Make sure you confirm your entries with OK since only then does the
networking with its properties take place. The CP is now configured as the
network node for the associated S7 station.
4. Save and compile your configuration.

Note

All steps must be repeated for each station.

SITRAIN Training for


Automation and Industrial Solutions

Page 11

ST-PRO3
Industrial Ethernet

Loading the Configuration Data


Procedure for downloading the configuration data:
1. In the Windows Control Panel, open the "Set PG/PC Interface"
dialog box
2. Set the PG/PC interface according to the CPs on your PG and
according to the bus connection (interface parameter settings
used).
You will find additional detailed information in the Online - Help.
3. Set the CPU to the STOP state.
4. Select the menu options
PLC Download... or
PLC Upload...
STEP 7 will then display dialog boxes to guide you through the
procedure.
SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

Principle

18.09.2009
PRO3_08E.12

SITRAIN Training for


Automation and Industrial Solutions

The project data of the Ethernet CP is loaded from the hardware


configuration. All configuration data of the S7 station is loaded. The data of
the connection configuration must be transferred separately.
You can use the MPI connection for loading the configuration data or for the
first-time assignment of a MAC address (node initialization).
As of STEP7 V5.3, after successful node initialization you can also use the
PGs IE interface for loading the configuration data.

Type of Connection

You can load the configuration data into the S7 station using the MPI
connection or the Ethernet. Prerequisite for loading using Ethernet is the node
initialization.

Node Initialization

In the so-called "node initialization", you initially supply the Ethernet CP with a
MAC address or an Internet address.
The node initialization is only possible using the MPI connection.

SITRAIN Training for


Automation and Industrial Solutions

Page 12

ST-PRO3
Industrial Ethernet

Communication Connections

SIMATIC S7 station
with Ethernet CP

Ethernet node

send

communication
connection

receive

receive
send

Ethernet node
send

communication
connection

receive

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

Connections

18.09.2009
PRO3_08E.13

receive
send

SITRAIN Training for


Automation and Industrial Solutions

A communication connection permits program-controlled communication with


the following properties between two nodes on the Industrial Ethernet:
-

The data transfer is bidirectional. That is, data can be sent and received at
the same time via the connection.
Both nodes have equal rights. That is, either node can initiate Send or
Receive activities as events demand.
The address of the communication partner is specified by configuration.
Exception: In the case of a "free UDP connection", the address is
specified at the FC interface in the user program.

General

The way the Ethernet CP works for a communication connection is to send


and receive data through the Ethernet and to exchange data with the user
program in the S7 CPU.

Note

All stations outside of the STEP 7 project must be configured with dummy
objects such as, "SIMATIC S5" or "Other Station". Or, the Partner type is
"Unspecified" when you create the connection.

SITRAIN Training for


Automation and Industrial Solutions

Page 13

ST-PRO3
Industrial Ethernet

Creating/Inserting a New Connection

Double-click

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.14

SITRAIN Training for


Automation and Industrial Solutions

Creating/Inserting a
Connection

ISO-on-TCP connections to other stations can also be created if the other


station is not stored in the same project. In the dialog shown (above) to create
the connection, you simply select "unspecified" as the connection partner.

What to Do

1. In the SIMATIC Manager, select the menu options Options Configure


Network. The NetPro configuration window is then displayed. As an
alternative, you can double-click (the created) Ethernet(1).
2. Select the CPU as connection-capable module and in the lower window of
the Connection Table select an empty line in which you enter the new
connection.
3. With a double-click on the empty line or by using the menu options Insert
New Connection..., insert the required ISO-on-TCP connection.
4. In the dialog that pops up, select your connection partner and the type of
connection.

SITRAIN Training for


Automation and Industrial Solutions

Page 14

ST-PRO3
Industrial Ethernet

Connection Properties

SIMATIC S7
Siemens AG 2008. All rights reserved.

Attributes

Date:
File:

18.09.2009
PRO3_08E.15

SITRAIN Training for


Automation and Industrial Solutions

You should pay attention to the following connection properties:


Local ID:
Is identical to the value in the connection list
Name:
Suggested name, plus connection number suffix. Can be changed by
the user as required (max. 24 characters).
Via CP:

If there are several CPs of the same type in the station that are all
connected to the same subnet, you can select the one you want to use
for the connection by clicking the Route... button.

Active connection establishment By default, the connection establishment is active.


In the case of an unspecified connection, the
connection is established passively.
ON: Connection is established actively
Off: Connection is established by partner
Block Parameters
ID
To identify the connection this block call parameter must be entered
when the FC is called in the user program.
LADDR
TSAP

To identify the connection this block call parameter must be entered


when the FC is called in the user program.
Transport Service Access Point, is used for the logical identification of
a connection (default values can be used here).

Loading

After saving and compiling the connection configuration, both stations have to be
loaded. To do so, select the station with an existing Ethernet or MPI connection. Use
the menu options PLC Download to Current Project to now load the two stations.

Result

Both SIMATIC stations are connected to one another through a working ISO-onTCP connection.

SITRAIN Training for


Automation and Industrial Solutions

Page 15

ST-PRO3
Industrial Ethernet

Functions for Data Transfer

The FC blocks are supplied with the NCM S7-Ethernet configuration tool
(SIMATIC_NET_CP Library).
The following table shows the default block numbers.
You can change the block numbers if you wish.

Function

Symbolic Name

Explanation

FC5

AG_SEND

Send data <= 240 bytes

FC6

AG_RECV

Receive data <= 240 bytes

FC7

AG_LOCK

Disable Fetch/Write data


exchange

FC8

AG_UNLOCK

Enable Fetch/Write data


exchange once more

FC50

AG_LSEND

Send data up to 8192 bytes

FC60

AG_LRECV

Rec. data up to 8192 bytes

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

Note

18.09.2009
PRO3_08E.16

SITRAIN Training for


Automation and Industrial Solutions

For data transmission using TCP/IP Connections, you can only use the
functions
FC 50 "AG_LSEND",
FC 60 "AG_LRECV"
regardless of the amount of data to be transferred.
The earlier differentiation between FC 5 "AG_SEND" and FC 50
"AG_LSEND" as well as FC 6 "AG_RECV" and FC 60 "AG_LRECV" is no
longer valid as of block version V 4.1. As of this version, FC 5 and FC 6 are
also capable of processing long send and receive requests.

SITRAIN Training for


Automation and Industrial Solutions

Page 16

ST-PRO3
Industrial Ethernet

SIMATIC_NET_CP Library

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

General

18.09.2009
PRO3_08E.17

SITRAIN Training for


Automation and Industrial Solutions

Different FCs have to be used for S7-300 and S7-400.


As well, there are also different block versions with possibly deviating behavior.
Please pay attention to the version identifications in the subdirectories in the
SIMATIC_NET_CP Blocks Library as well as to the version identifiers of the
blocks themselves.

AG_SEND

The block passes the user data from the specified user data area to the
Ethernet CP. The Ethernet CP independently triggers the transfer to the partner
station.

AG_RECV

The block accepts the user data received from the partner station in the user
data area specified in the call.

User Program

The user program triggers the transfer of the user data areas through the FC
block calls and monitors their execution by evaluating the return values.
The execution of the request is confirmed either positively or negatively in the
Done/NDR and Error Bit as well as Status Word of the respective block. Based
on the outputs of these three parameters, conclusions can be drawn on the
connection status.

Note

You will find help and exact explanation of all parameters, interconnections and
outputs of the respective blocks in the Online Help.

SITRAIN Training for


Automation and Industrial Solutions

Page 17

ST-PRO3
Industrial Ethernet

Communications Structure
An ISO-on-TCP connection between 2 automation devices
Station LEFT
CPU 1

CP 1
MAC: 08-00-06-01-74-10

Sending and Receiving


using a TSAP

TSAP
ID

1
FC
LSEND

Station RIGHT

Example of a
connection

CPU 2

MAC: 08-00-06-01-74-20

TSAP

1
SEND

CP 2

1
DATA

RECEIVE

ID

FC
LRECV

Acknowledgement
ID

1
FC
LRECV

1
RECEIVE

1
SEND

IP Address:

IP Address:

192.168.0.3

192.168.0.2

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

Structure

DATA
Acknowledgement

18.09.2009
PRO3_08E.18

ID

FC
LSEND

SITRAIN Training for


Automation and Industrial Solutions

The slide shows a schematic of the complete structure of data transmission


using a logical connection between two SIMATIC stations.
This connection can be used for reciprocal data exchange (duplex operation).
The logical TSAP connection endpoints (local or remote) uniquely
characterize a connection channel between two communication partners.
The user program assigns the send and receive data to the correct
connection block on the CP using the connection ID.

SITRAIN Training for


Automation and Industrial Solutions

Page 18

ST-PRO3
Industrial Ethernet

Task Description: Exchange of Recipe Data


WinCC flexible Runtime: R e c i p e__L
Screen: own recipe
Screen: partner recipe

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

WinCC flexible Runtime: R e c i p e__R


Screen: own recipe
Screen: partner recipe

18.09.2009
PRO3_08E.19

SITRAIN Training for


Automation and Industrial Solutions

Function Up Till Now Up until now, only your own parts data record is created, displayed and
transferred into your "own" controller with the operator panel (WinCC-flexible Runtime) in the screen "Recipe". The individual values of the recipe are also
displayed in the Start screen (see slide above).
Task

Now the function of the operator panel is to be expanded so that the "Other
Recipe" of the partner station is displayed on your operator panel. For this, a
recipe view is to be created on the operator panel that displays the "Other
Recipe" of the other station (see slide).
The two stations are to exchange the current parts data records amongst
themselves, that is, the "Own Recipe" sends and the "Other Recipe" receives.

Note

Basically, the OPs could access their own controller and the controller of the
partner station directly and read out the data directly. The task could therefore
be solved without the explicit configuration of a communication.
For the exercise though, it is to be implemented with an Ethernet connection and
then with S7 communication.

SITRAIN Training for


Automation and Industrial Solutions

Page 19

ST-PRO3
Industrial Ethernet

Exercise 1: Configuring a CP and Assigning Parameters to It

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.20

SITRAIN Training for


Automation and Industrial Solutions

Task

You are to configure the communications processor of your training unit and
assign parameters to it as shown in the slide.

What to Do

1. Integrate the CP in your HW-Config as shown in the slide. You will find the
CP in the HW Catalog under
SIMATIC 300 CP-300 Industrial Ethernet CP343-1
2. Parameterize the CP as shown in the slide
Make the following arrangements with your partner group:
the IP addresses of both CPs must begin with 192.168.0. .., only the
last digit must be different, for example:
CP LEFT: 192.168.0.3
and CP RIGHT: 192.168.0.2
the subnet masks of both CPs must be identical: 255.255.255.0
Station LEFT: active connection build up, Station RIGHT not!
3. Save and compile the hardware configuration and download it in your station.

SITRAIN Training for


Automation and Industrial Solutions

Page 20

ST-PRO3
Industrial Ethernet

Exercise 2: Creating/Inserting an ISO-on-TCP Connection

Double-click

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.21

SITRAIN Training for


Automation and Industrial Solutions

Task

So that you dont have to load the hardware station of your partner group into
your own project, create an ISO-on-TCP connection to a station that is not
stored in your project. For this, select "unspecified" station as the connection
partner in the Connection dialog.

What to Do

1. In the SIMATIC Manager, start the NETPRO application by double-clicking


on any network you like (such as, MPI)
2. Select your CPU as connection-capable module and in the lower window of
the Connection Table select an empty line in which you enter the new
connection.
3. Double-click on the empty line to get the connection dialog or activate the
menu
Insert New Connection..., to insert the required ISO-on-TCP connection.
4. In the dialog that pops up, select your connection partner and the type of
connection.

SITRAIN Training for


Automation and Industrial Solutions

Page 21

ST-PRO3
Industrial Ethernet

Exercise 3: Assigning Parameters to the ISO-on-TCP Connection

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

What to Do

18.09.2009
PRO3_08E.22

SITRAIN Training for


Automation and Industrial Solutions

Use the parameters which are shown in the slide.


Make sure, that one of the two involved communication partner is responsible
for the "Active connection establishment" and the other one not.

SITRAIN Training for


Automation and Industrial Solutions

Page 22

ST-PRO3
Industrial Ethernet

Exercise 4 : Expanding the S7 and Operator Panel Program


WinCC flexible Runtime: R e c i p e__L
Screen: own recipe
Screen: partner recipe

WinCC flexible Runtime: R e c i p e__L


Screen: own recipe
Screen: partner recipe

ISO-on-TCP
Connection

SIMATIC S7

Date:
File:

Siemens AG 2008. All rights reserved.

18.09.2009
PRO3_08E.23

SITRAIN Training for


Automation and Industrial Solutions

Function Up Till Now With the OP, your own parts data records are transferred directly into the
Instance DB "DB_FB-OP" (DB99), that is, into the OUT parameter #Parts_Data
of the function block "FB-OP" (FB99) using the screen "Own Recipe". Through
this OUT parameter, the current parts data record is then passed on to FB-Line".
Task

On both CPUs, the DB99 instance data block of FB99 is to be used as the
interface for the exchange of recipes.
The OP writes the "Own Recipe" as usual in the variable, that is, the OUT
parameter #Parts_Data. The OP reads the "Other Recipe" from the (STAT)
variable #Other_Data that is to be newly created in FB99 (and that is also
automatically created in the instance DB 99). Each OP still only accesses the
DB99 of its "own" CPU, not that of the "other" CPU.

What to Do

Make the following program changes in the S7 programs of both controllers:


1. In FB99, create the new STAT variable #Other_Data
(The FB99 program will then be expanded in the following exercise)
2. Update the call of FB99 in OB1 and in the process also regenerate the
instance DB99 so that the new STAT variable #Other_Data is also included
in the instance DB.
3. In both WinCC flexible projects (LEFT and RIGHT) create the recipe "Other
Data" and connect their entries with the components of the STAT variable
#Other_Data in the instance DB99 of your own controller.
4. In the screen "Other Recipe", program a recipe view that only allows you to
read out the other recipe, not download it.

SITRAIN Training for


Automation and Industrial Solutions

Page 23

ST-PRO3
Industrial Ethernet

Exercise 5: Communication via ISO-on-TCP Connection


S t a t i o n

LEFT

S t a t i o n

FB99

FB99

"AG_SEND" (FC 5)
ACT

RIGHT

"AG_SEND" (FC 5)
ACT

DONE

ID

ERROR

LADDR

STATUS

ISO-on-TCP

SEND
LEN

DONE

ID

ERROR

LADDR

STATUS

SEND
LEN

"AG_RECV" (FC 6)
ID

"AG_RECV" (FC 6)

NDR
ERROR

LADDR
RECV

ID

Connection

RECV

STATUS
LEN

SIMATIC S7

NDR
ERROR
STATUS
LEN

Date:
File:

Siemens AG 2008. All rights reserved.

LADDR

18.09.2009
PRO3_08E.24

SITRAIN Training for


Automation and Industrial Solutions

Task

To exchange the parts data records via the ISO-on-TCP connection, the
standard blocks "AG_SEND" (FC 5) and "AG_RECV" (FC 6) must now be
integrated in the S7 program.
The blocks are included in the "SIMATIC_NET_CP" "CP 300" library.

What to Do

1. Program the calls of the "AG_SEND" (FC 5) and "AG_RECV" (FC 6)


standard blocks in FB99.
The recipe data is to sent every 100ms via the IN parameter "ACT" of the
"AG_SEND" (FC9) block. For this, use the flashing frequency memory bit
M10.0.
2. Check the function on the operator panel, that is, with the Runtime of
WinCC flexible.

SITRAIN Training for


Automation and Industrial Solutions

Page 24

ST-PRO3
Industrial Ethernet