user documentation v2.1 y may 2013 - siemens ag · not apply in the case of mandatory liability,...

41
Applikationen & Tools Answers for industry. Cover WinAC IP Driver V2 User documentation V2.1 May 2013

Upload: buidang

Post on 10-May-2018

223 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

Applikationen & Tools

Answers for industry.

Cover

WinAC

IP Driver V2 User documentation

V2.1 May 2013

Page 2: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

2 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Industry Automation and Drives Technologies Service & Support Portal This article is taken from the Service Portal of Siemens AG, Industry Automation and Drives Technologies. The following link takes you directly to the download page of this document. http://support.automation.siemens.com/WW/view/en/48354110 If you have any questions concerning this document please e-mail us to the following address: [email protected]

Page 3: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 3

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

s

SIMATIC WinAC IP Driver V2

Foreword 1

Basic information 2

Overview 3

Setup 4

The User Interface 5

Example project in Step7 V5

6 Example project in Step7 V11 (TIA-Portal)

7 Parameterization of connections

8 Tipps for solving problems

9

Error codes 10

History 11

Page 4: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

Warranty and Liability

4 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Warranty and Liability Note The Application Examples are not binding and do not claim to be complete

regarding the circuits shown, equipping and any eventuality. The Application Examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These application examples do not relieve you of the responsibility to use safe practices in application, installation, operation and maintenance. When using these Application Examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these Application Examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications – e.g. Catalogs – the contents of the other documents have priority.

We do not accept any liability for the information contained in this document.

Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (“wesentliche Vertragspflichten”). The damages for a breach of a substantial contractual obligation are, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment. Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of Siemens Industry Sector.

Page 5: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

Table of Contents

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 5

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Table of Contents Warranty and Liability .............................................................................................. 4 1 Foreword ......................................................................................................... 6 2 Basic information ........................................................................................... 7

2.1 Objective ........................................................................................... 7 2.2 Reference System ............................................................................. 7

3 Overview ......................................................................................................... 8

3.1 Scope of Functions ............................................................................ 8 4 Setup ............................................................................................................... 9

4.1 Quickstart Step7 V5 ........................................................................... 9 4.2 Quickstart Step7 V11/12 (TIA Portal) ................................................. 9 4.3 Settings in the Operating System ..................................................... 10 4.3.1 Adjustment for Cable Break Recognition .......................................... 10 4.3.2 Keepalive ........................................................................................ 10

5 The User Interface ........................................................................................ 12

5.1 Initialisation FB 621 - TINIT_WINAC ................................................ 13 5.2 Establish connection with FB651 - TCON_WINAC ........................... 14 5.2.1 The TCON_WINAC parameter „ID“ .................................................. 14 5.2.2 TCP/IP native - TCON_WINAC parameter „Port number“ ................. 15 5.2.3 ISO on TCP – port number 102........................................................ 15 5.3 Disconnect with FB661 - TDISCON_WINAC .................................... 16 5.4 Send data with FB631 - TSEND_WINAC ......................................... 16 5.5 Receive data with FB641 - TRCV_WINAC ....................................... 16 5.5.1 The TRCV_WINAC parameter LEN ................................................. 17 5.5.2 Data consistency / accuracy when receiving .................................... 18 5.6 Send data with FB671 - TUSEND_WINAC ....................................... 18 5.7 Receive data with FB681 - TURCV_WINAC .................................... 19

6 Example project in Step7 V5 ........................................................................ 20 7 Example project in Step7 V11/V12 (TIA-Portal) ........................................... 22 8 Parameterization of connections ................................................................. 23

8.1 Parameterization with Open Communication Wizard (Step7 V5.5) ............................................................................................... 23

8.2 Parameterization using TIA-Portal.................................................... 24 8.2.1 Invoke TCON block for accessing connection parameters ................ 24 8.2.2 Manually Parameterization of Connection-UDTs .............................. 26 8.2.3 Connect and Disconnect .................................................................. 26 8.3 Examples for parameterization......................................................... 27 8.3.1 WinAC with two TCP/IP Client for two separate servers ................... 27 8.3.2 WinAC with two TCP/IP clients for one server PC ............................ 29 8.3.3 WinAC as TCP/IP server with two clients ......................................... 31 8.3.4 WinAC with UDP communication ..................................................... 32

9 Tipps for solving problems .......................................................................... 33 10 Error codes ................................................................................................... 35

10.1 Error codes of WinAC ODK 4.1 ........................................................ 35 10.2 Additional error information .............................................................. 36

11 History .......................................................................................................... 41

Page 6: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

1 Foreword

6 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

1 Foreword Objective of the application

This document describes the WinAC IP Driver V2 software for the user.

Page 7: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

2 Basic information

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 7

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

2 Basic information 2.1 Objective

Since WinAC RTX version 2008 TCP/IP and UDP communication is supported. WinAC RTX 2010 introduced ISO-on-TCP, too. There are some requirements requiring the usage of an additional communication driver: Open User Communication over a second (Windows) Ethernet interface

(WinAC supports only one Ethernet interface) PC with not supported Ethernet chipset Communication with local installed windows application (e.g. “localhost”) More than 32 connections

The WinAC IP Driver V2 provides native TCP/IP, UDP as well as ISO on TCP communication of WinAC over a Windows Ethernet interface to other communication partners. The used interface is FBs 63-66 (TSEND, TRCV, TCON, TDISCON) which we are familiar from S7 applications (CPU 317-2 PN/DP, CPU 400). Difference ist only FB Number and Name ((TSEND_WINAC, TRCV_WINAC, TCON_WINAC, TDISCON_WINAC). The connection types 11h - TCP/IP native, 12h – ISO on TCP and 13h – UDP are supported.

2.2 Reference System

The described application in this user documentation is based on the following reference system: Microbox IPC427D with Windows Embedded Standard 7 WinAC RTX 2010 (V4.6) TIA Portal V12

Page 8: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

3 Overview

8 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

3 Overview 3.1 Scope of Functions

WinAC IP V2 provides TCP/IP communication functionality as the active part (client) as well as the passive part (server). Both variants may also be utilised together. Figure 3-1 Communication possibilities with WinAC IP V2

WinAC

Uebersicht01.vsd

Server 1

Server 2

Client 1

Client 2

Client

Client

Client

Server

Server

ID 1

ID 2

ID 3

ID 4

ID 5

One unique ID must be allocated to each connection. 32 connections are supported in the current version of the WinAC-IP-driver which contain IDs 1..32. Irrespective whether the connection has been arranged as client or server (active / passive connection), sending as well as receiving are possible via the connection (ID) once the connection is established. The connection type UDP is optimized for speed. In contrast to the TCP/IP based types for UDP all commands are executed synchronously. E.g. when calling TUSEND the data is given to the Windows socket directly.

Page 9: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

4 Setup

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 9

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

4 Setup 4.1 Quickstart Step7 V5

Carry out the following steps to start up WinAC IP V2 on Step7 V5. Copy the DLL WinLC_IP_TCOM.DLL into the system32 directory (setup.bat) Make possible adjustment for cable break recognition and keepalive (see 0) Copy components from the demo project into the user project:

- FBs 621-681 including their instance DBs DB621-681 - UDT 65 and DB1 (derived from UDT 65) - SFBs 65001 and 65002

Configure connections in DB1 (derived from UDT 65) (When using Open Communication Wizard, see chapter 8.1 on page 23 the DB2 has to be updated according the generated UDT)

Call FB621 TINIT_WINAC with the right local IP address Call FB651 TCON_WINAC with configuration Once connection is established send / receive data with FB631 / FB641

(TCP/IP based) or FB67 / FB68 (UDP)

4.2 Quickstart Step7 V11/12 (TIA Portal)

Carry out the following steps to start up WinAC IP V2 on Step7 V11 (TIA Portal). Copy the DLL WinLC_IP_TCOM.DLL into the system32 directory (setup.bat) Make possible adjustment for cable break recognition and keepalive (see 0) Copy components from the demo project into the user project:

- FBs 621-681 including their instance DBs DB621-681 - UDTs from the “PLC data types” folder - data blocks DB1 and DB2

Configure connections in DB1 (CON_DEF) Helpful hints for configuring connection can be found in chapter 8.2 “Parameterization using TIA-Portal”.

Call FB621 TINIT_WINAC with the right local IP address Call FB651 TCON_WINAC with configuration Once a connection is established send / receive data with FB631 / FB641

(TCP/IP based) or FB67 / FB68 (UDP)

NOTE WinAC-IP-V2 DLL requires DLL msvcrt.dll. It is included in the standard image of the Simatic Microbox IPC427C. When using a different PC configuration it may need installing.

NOTE On Windows 7 make sure you run “setup.bat” in Admin-Mode

Page 10: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

4 Setup

10 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

4.3 Settings in the Operating System

Some settings of the operating system (Windows XP) regarding the Ethernet communication have importance for the WinAC IP driver.

4.3.1 Adjustment for Cable Break Recognition

When using a wired ethernet connection (e.g. RJ45), Windows recognises when the connection has been interrupted (cable break or pulled the plug).

Note This cable break recognition works only for the local RJ45 plug. If the cable is broken behind a switch, it will not be recognized by this functionality.

This information, however, is not automatically forwarded to the Windows socket and thus to the WinAC IP driver.

Adjustment in Registry This functionality is controlled via an entry in the registry: Under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters you find parameter DisableDHCPMediaSense. When this parameter exists and when it is set to 1, the information on a seperate TCP/IP connection is not forwarded to the Windows socket and thus not to the WinAC IP driver either. The exact functionality of this registry entry is described in the Microsoft Knowledge Base ID D239924.

Meaning of the parameter under Simatic NET This value is deliberately set to 1 by Simatic NET: When DHCP is used for the allocation of IP addresses, plugging in / unplugging of the cable could result in obtaining a new IP address. As a consequence, however, the configuration of a Simatic project would no longer be correct. For this reason this function has been deactivated by Simatic NET via this flag (this has the following side effect: TCP/IP applications are no longer notified of a cable break.) If static IP addresses are used in an application or if fixed IP addresses are allocated to specific MAC addresses in the DHCP server there should be no problem when setting this registry entry to 0.

4.3.2 Keepalive

The operating system can automatically check an Ethernet connection with keepalive telegrams. In that way a failure will be recognized along the communication path (also behind switches). For this functionality there are two important entries in the registry: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\ Parameters

Page 11: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

4 Setup

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 11

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

DWORD – “KeepAliveTime” - wait before sending keep alive packets (default: 2

hours - 7,200,000 milliseconds) in [milliseconds]

DWORD – “KeepAliveInterval” - time between retransmissions of keepalives, once the KeepAliveTime has expired (default: 1 second - 1000 milliseconds) in [milliseconds] If you set the first parameter to 10000 (decimal) the system will check the connection after 10 seconds without communication.

Page 12: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

12 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

5 The User Interface When WinAC IP V2 was developed, importance was attached to almost exact re-creation of the known FBs 63-68 (TSEND, TRCV, TCON, TDISCON, TUSEND, TURCV). Parameterisation of the connections is carried out with structures of type UDT 65 TCON_PAR and UDT 66 TADDR_PAR defined.

Attention When using the WinAC IP driver you may not use the FB63 – FB68 from the Standard Library! You must use the same-named FBs from the provided demonstration project!

In addition to these FBs there is a further FB 621 TINIT_WINAC. For the documentation of the FBs 63-68 as well as UDT 65, 66 of WinAC IP V2 please refer to the Simatic manager. Over and above the interfaces of the FBs important information can be found in the instance DBs. There is the constraint that at the moment: WinAC IP V2 supports connection types 11h - TCP/IP native, 12h – ISO on TCP and 13h – UDP. An additional recommended documentation is the manual “System and Standard Functions for S7-300/400”, chapter “Open Communication via Industrial Ethernet”. Link: http://support.automation.siemens.com/WW/view/en/1214574. In distinction to the T-function blocks from the standard library the instance data blocks of the function blocks from the WinAC IP driver contain some additional information.

Attention The FBs of WinAC IP V2 require their own instance DBs. These FBs are not multi-instance capable!

Note The numbers of the FBs/DBs 621-681 may be changed freely by the user. Please ensure that the correct numbers of the instance DBs are transferred to FB TINIT_WINAC.

The T-function blocks have a REQ or EN_R input. If this input is not set to “true” the output values are reseted. You have to latch possible returned error codes, like done in the example project.

Page 13: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 13

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

5.1 Initialisation FB 621 - TINIT_WINAC

Attention In the current version of the driver the number of TINIT_WINAC has to be changed from 62 to 621 to prevent a collision with the UDT FBs.

This FB initialises the ODK-DLL. It must be called once (e.g. in OB100). The remaining FBs of the WinAC-IP driver can only be used after calling TINIT_WINAC. Because the connection is realized independent from the IE General, TINIT_WINAC is used to define the local IP address (Ethernet port) for the communication.

Interface Table 5-1 Parameter of FB TINIT_WINAC

Parameter In/Out Type Description

IP_ADDR In DWord Local IP address of the Ethernet port to be used by the driver *1)

DB_TSEND In Block_DB instance DB of TSEND_WINAC DB_TRCV In Block_DB instance DB of TRCV_WINAC DB_TCON In Block_DB instance DB of TCON_WINAC DB_TDISCON In Block_DB instance DB of TDISCON_WINAC DB_TUSEND In Block_DB instance DB of TUSEND_WINAC DB_TURCV In Block_DB instance DB of TURCV_WINAC ERROR Out Bool Error occured STATUS Out Word State of the call (analyse if bit ERROR is

set)

*1) If the IP driver is used on a PC with more than one Ethernet port, the driver has to know wich ethernet port is to used. The local IP address to use is defined with the parameter IP_ADDR. The IP address is given as DWORD: 149.246.247.49 DW#16#95F6F731

Note If the PC only has one ethernet port, the parameter IP_ADDR can have the value 0 (Null).

Page 14: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

14 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Return value Beside the single return value STATUS of the interface of FB TINIT_WINAC, there are more information stored in the instance DB of the FB. E.g you can see the DLL version of the driver ( "IDB_TINIT_WINAC".C_IF.DLL_VERSION ). The last digit of this value marks the version Debug (D) or Release (A). Table 5-2 Examples for driver DLL versions

"IDB_TINIT_WINAC".C_IF.DLL_VERSION DLL-Version

DW#16#0001991D V 1.9.9.1 Debug DW#16#0002010A V 2.0.1.0 Release

5.2 Establish connection with FB651 - TCON_WINAC

This FB is well documented in the Simatic Manager help (standard library communication blocks) and in the manual “System and Standard Functions for S7-300/400”, chapter “Open Communication via Industrial Ethernet”. Additional the instance DB of TCON_WINAC includes further information in case of an error ( "IDB TCON_WINAC".C_IF.STATUS_IP_ZINFO ). The values are explained in chapter 10.2 „Additional error information “.

Note The function block TCON_WINAC has to be called for every connection with bit REQ = TRUE until the connection is established (DONE without error). First after this the call of the other function blocks TSEND_WINAC / TRCV_WINAC / TDISCON_WINAC makes sense.

5.2.1 The TCON_WINAC parameter „ID“

The TCON_WINAC from the standard library allows values for ID from 1H up to 999H. The TCON_WINAC of WinAC IP driver only allows the values 1D – 32D. The reason is the specific implementation.

Attention Differing to the documentation of TCON_WINAC of the standard library for the WinAC IP driver only values 1D up to 32D are valid for the parameter “ID”.

This parameter of the FB TCON_WINAC must match the ID of the connection parameterization (UDT65).

Page 15: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 15

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

5.2.2 TCP/IP native - TCON_WINAC parameter „Port number“

When using TCP/IP native, a portnumber must be defined as part of UDT65 TCON_PAR for local_tsap_id – local portnumber rem_tsap_id – remote portnumber

The concrete parametrisation depends on the projected connection: is it a client (active) or server (passive) connection. For servers you must define the port number! Normally the port number of client is not defined by user. The operating system assigns a free port number to the client side automatically. Sometimes it can be useful to define a port number fort he client side too. E.g. it simplifies the client identification on the server side.

Note The TCP/IP specification defines: a specific combinatino of port and IP address must stay in state „TIME_WAIT“ for 2xMSL (about 4 min).

That means when using a fixed port on client side it can take about 4 minutes till the connection can re-established after a connection lost.

5.2.3 ISO on TCP – port number 102

Note If the WinAC works as ISO on TCP server (passive connection) there could be disturbance of the communication to the engineering system (PG).

If choosing connection type “ISO on TCP” the TCP/IP port number is fixed. The server opens the port 102 and waits for client connect. Unfortunately the engineering software (Simatic Manager) uses this port 102 too (e.g. variable control/observe). That’s why already runs a server on port 102 on the AG (established by the IE General in the Component Configurator). If the WinAC should work as ISO on TCP server, this server process collides with the server process of the IE General using the same port 102. That’s why the WinAC should always work as ISO-on-TCP client (active connection. If the WinAC must be the ISO-on-TCP server (passive connection), there are some solutions for this issue: Using two different Ethernet ports for the ISO on TCP communication of the

WinAC and the connection of the engineering system (PG) Set WinAC to STOP before the engineering system (PG) established a

connection to the IE General. After activating e.g. “variable observe/control” the WinAC can be set to RUN.

Page 16: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

16 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

5.3 Disconnect with FB661 - TDISCON_WINAC

This FB is well documented in the Simatic Manager help (standard library communication blocks) and in the manual “System and Standard Functions for S7-300/400”, chapter “Open Communication via Industrial Ethernet”. Additional the instance DB of TDISCON_WINAC includes further information in case of an error ( "IDB TDISCON_WINAC".C_IF.STATUS_IP_ZINFO ). The values are explained in chapter 10.2 „Additional error information “.

Note The function block begins working with the rising edge of REQ. The REQ bit has to stay at 1 until DONE and/or ERROR are set.

5.4 Send data with FB631 - TSEND_WINAC

Attention TSEND_WINAC may not be used for UDP connections!

This FB is well documented in the Simatic Manager help (standard library communication blocks) and in the manual “System and Standard Functions for S7-300/400”, chapter “Open Communication via Industrial Ethernet”. Additional the instance DB of TSEND_WINAC includes further information in case of an error ( "IDB TSEND_WINAC".C_IF.STATUS_IP_ZINFO ). The values are explained in chapter 10.2 „Additional error information “.

Note The function block begins working with the rising edge of REQ. The REQ bit has to stay at 1 until DONE and/or ERROR are set.

5.5 Receive data with FB641 - TRCV_WINAC

Attention TRCV_WINAC may not be used for UDP connections!

This FB is well documented in the Simatic Manager help (standard library communication blocks) and in the manual “System and Standard Functions for S7-300/400”, chapter “Open Communication via Industrial Ethernet”. Additional the instance DB of TRCV_WINAC includes further information in case of an error ( "IDB TRCV_WINAC".C_IF.STATUS_IP_ZINFO ). The values are explained in chapter 10.2 „Additional error information “. Additional the function block TRCV_WINAC can be used to determine the actual connection state. When using the T-function blocks, you have to update the connection state manually by calling TRCV_WINAC or TSEND_WINAC. In the shipped example project the function block TRCV_WINAC is used to update the internal status bit “CONNECTED”.

Page 17: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 17

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

5.5.1 The TRCV_WINAC parameter LEN

Connection type ‘ISO on TCP’

Note For ISO on TCP this parameter should be 0!

The ISO on TCP protocol guarantees the receiving of complete telegrams. So every NDR - “new data received” signals a new complete telegram.

When using ISO on TCP and LEN not equal 0 and the received telegram is longer than LEN, an error is returned.

Connection type ‘TCP/IP native’ With this parameter you can control if the driver delivers received data immediately or if the data is buffered until the desired length of bytes is received. Is the parameter LEN set to 0, the Step7 program is informed about every received (part)package. E.g. if a telegram of 400 bytes is devided into 4 partial packets by the socket, every packet is separately signaled to the S7 program. Figure 5-1 TRCV_WINAC with LEN = 0

Is the parameter LEN set to a specific value, the S7 program is informed after complete receiving of the telegram. Figure 5-2 TRCV_WINAC with specific value for LEN

If the received telegram is longer than LEN you will get as many data with TRCV_WINAC as the value of LEN is specified. No error code is returned.

Page 18: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

18 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

5.5.2 Data consistency / accuracy when receiving

The specification for the Step7 function blocks defines the maximum telegram length (e.g. 8192 Byte for TCP/IP native). This buffer size is used for receiving data by the socket. Received data is stored internal because the TCP/IP driver works asynchronous to the WinAC. If TRCV_WINAC does not pick up the data from the driver fast enough, an internal buffer of received data is build up. This buffer must processed, e.g. even if the communication partner does not send any new data, TRCV_WINAC will signal new data received until the internal buffer is processed.

Note Pay attention to call TRCV_WINAC fast enough to avoid the build up of an internal data buffer with unmeant behavior like signal delay.

5.6 Send data with FB671 - TUSEND_WINAC

The connection type UDP is optimized for speed. In contrast to the TCP/IP based types for UDP all commands are executed synchronously. E.g. when calling TUSEND_WINAC the data is given to the Windows socket directly. On a test system (Microbox PC427B, 1 GHz) a execution time of TUSEND_WINAC of 70..120µs was determined.

Attention TUSEND_WINAC may only be used for UDP connections!

This FB is well documented in the Simatic Manager help (standard library communication blocks) and in the manual “System and Standard Functions for S7-300/400”, chapter “Open Communication via Industrial Ethernet”. Additional the instance DB of TUSEND_WINAC includes further information in case of an error ( "IDB TUSEND_WINAC".C_IF.STATUS_IP_ZINFO ). The values are explained in chapter 10.2 „Additional error information “.

Note The function block begins working with the rising edge of REQ. The REQ bit has to stay at 1 until DONE and/or ERROR are set.

Page 19: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

5 The User Interface

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 19

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

5.7 Receive data with FB681 - TURCV_WINAC

Attention TURCV_WINAC may only be used for UDP connections!

This FB is well documented in the Simatic Manager help (standard library communication blocks) and in the manual “System and Standard Functions for S7-300/400”, chapter “Open Communication via Industrial Ethernet”. Additional the instance DB of TURCV_WINAC includes further information in case of an error ( "IDB TURCV_WINAC".C_IF.STATUS_IP_ZINFO ). The values are explained in chapter 10.2 „Additional error information “. If data was received (NDR) the output ADDR contains the sender address. After the next call of TURCV_WINAC this data will be overwritten. Thus you have to process the sender address information just after the NDR flag was set. Additional the function block TURCV_WINAC can be used to determine the actual connection state. When using the T-function blocks, you have to update the connection state manually by calling TURCV_WINAC or TUSEND_WINAC. In the shipped example project the function block TURCV_WINAC is used to update the internal status bit “CONNECTED”. An important feature of UDP is: telegrams are not segmented. I.e. a sent telegram is always received in one piece. That’s why the parameter LEN should be always big enough or even set to 0. If the received telegram is longer than LEN, an error code is returned.

Note Pay attention to call TURCV_WINAC fast enough to avoid the build up of an internal data buffer with unmeant behavior like signal delay.

When using complex network structures (e.g. some routers) it is not guaranteed that the order of the received telegrams is the same as the order of the sent telegrams.

Page 20: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

6 Example project in Step7 V5

20 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

6 Example project in Step7 V5 An example project is provided to show how to use the T-blocks.

Attention For own projects you have to use the T-blocks from the example project and not from the standard library!

For the two connection types TCP/IP based (TCP/IP native and ISO-on-TCP) UDP

there are two function blocks which realize the communication by using the T-blocks. If more connections are needed, you have to call this FBs with different instance data blocks. For every connection you have to create a separate instance DB. You find the call of this FBs in the OB1. For the example all connections were parameterized by the Open Communicaiton Wizard (UDT651-656, UDT663). These UDTs are instantiated in the DB1 / DB2. If you generate / change these UDTs it is not enough to update the DB1 / DB2. You have to initialize these DBs again. By using a “Reset”-Bit (set in OB100) the instance DBs are initialized internally. Of course this project is designed as example. The used flags and data blocks may be used in a concrete customer project. Then they have to be changed. Table 6-1 Objects of the example project

Object DLL-Version

OB1 CYCL_EXC

Process the cycle flag Calling connection FBs At the end: reset the “Reset” flag

OB100 COMPLETE RESTART

Calling TINIT_WINAC Copy connection parameters from the central parameter DBs DB1/DB2 to the separate instance DBs

FB1 CON_TCP

Realized a TCP/IP based connection (TCP/IP native or ISO-on-TCP) incl. establishing connection, sending and receiving

FB2 CON_UDP

Realized an UDP based connection incl. establishing connection, sending and receiving

FB62 – FB68 T-blocks for open communication Not from standard library!

DB1 CON_DEF

Contains parameter for connections. Consists of some UDTs of type UDT65 TCON_PAR generated by the Open Communication Wizard.

DB2 ADDR_DEF

Contains parameter for remote partners of UDP. Consists of some UDTs of type UDT66 TADDR_PAR generated by the Open Communication Wizard.

DB62 – DB68 Instance DBs of the T-blocks DB101 – DB106 Instance DBs for FB1 / FB2. For every connection a single

one. UDT651 – UDT656 Connection parameters generated by the Open

Page 21: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

6 Example project in Step7 V5

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 21

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Object DLL-Version Communication Wizard

UDT663 Parameters of remote partners for UDP, generated by Open Communication Wizard

Page 22: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

7 Example project in Step7 V11/V12 (TIA-Portal)

22 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

7 Example project in Step7 V11/V12 (TIA-Portal) The example project for Step7 V11 (TIA-Portal) is based on the Step7 V5 project introduced in chapter 6 “Example project in Step7 V5”. Specific characteristics of the useage of the WinAC-IPV2 driver are described in the following sections. Configuring the connection cannot be done using the Open-Communication-Wizard. This wizard is replaced by a build-in configuration dialog in the TIA Portal V11. However, using this build-in configuration is only possible in combination with the standard communication blocks like TCON. In order to configure supplied WinAC communication blocks (e.g. TCON_WINAC), following two ways and suggested:

1. Invoke standard TCON block to gather parameters This ensures that - with help of the build-in configuration dialog - a parameter-DB is created which holds the connection configuration. Either this DB can be passed as a parameter to the WinAC communication block (e.g. TCON_WINAC), or its values can be assigned manually to the appropriate UDT.

2. Manual configuration The configuration takes place manually by entering values into the default-value-row within the appropriate UDT.

Helpful and detailed hints for this configuration can be found in chapter 8.2 “Parameterization using TIA-Portal”.

Page 23: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 23

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

8 Parameterization of connections 8.1 Parameterization with Open Communication Wizard

(Step7 V5.5)

On the support pages of the Siemens AG there is a tool for the comfortable parameterization of connections with T-function blocks: the Open Communication Wizard. http://support.automation.siemens.com/WW/view/en/25209116 This tool is recommended for parameterization of the WinAC IP V2 driver. Dialog-based you have to parameterize the connection. According to this an UDT (type UDT65 - TCON_PAR) for the connection parameters is generated. When using communication type UDP an additional UDT (type UDT66 – TADDR_PAR) for the remote communication partner is generated. This UDT have to be instantiated in your project. A manually editing of the communication parameters should be not necessary. You have to consider some things when using the Open Communication Wizard.

Parameter “Used interface” In step “connection partner” the parameter “used interface” has to be selected. This parameter is not considered by the WinAC IP driver. Thus you can choose e.g. the entry “CP 443-1 Advanced” or “Integrated (315/317, Firmware V2.5 and newer)”. With other interfaces you may got false connection parameterization (e.g. false connection type).

Parameter “TSAP-ID” for ISO-on-TCP The ISO-on-TCP specification defines for open TCP/IP function blocks the beginning of the TSAP-ID with E0h. The second byte is used for the rack number. Thus the Open Communication wizard inserts the two characters E0h 02h in the beginning of the TSAP-ID automatically when using e.g. rack number 2. The TSAP-IDs must match exactly in the projecting of both communication partners. You have to add E0h 02h in the projection of the communication partner or you have to change the TSAP-ID after finishing the Open Communication Wizard in the UDT manually.

Result is an UDT The result of the Open Communication Wizard is one or more UDTs (user defined type). Therefore you have to DB or a variable inside a DB of this generated user defined type. If you had updated an existing UDT you have to “check block consistency” for the entire project to update the new information of the UDT in all the relevant data blocks. It is recommended to let the Open Communication Wizard store the resulting UDT in the block folder of the WinAC project.

Comments in the UDT The Open Communication Wizard generates UDTs of type 65 or 66 (see standard library / communication blocks). In opposite to the UDTs of the Standard Library the elements of the generated UDTs does not have comments.

Page 24: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

24 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

.net 2.0 framework The Open Communication Wizards needs the Microsoft .NET Framework Version 2.0 installed on the PC. If not installed yet, you can download the Redistributable Package from the Microsoft web page.

8.2 Parameterization using TIA-Portal

Note The build-in connection configuration of TIA-Portal for standard communication blocks (e.g. TCON) cannot be used for WinAC communication blocks (e.g. WINAC_TCON)

Since the build-in connection configuration cannot be used readily for the WinAC IP V2 driver, a workaround is described below: With help of a temporary added TCON block from the communication library a configuration-DB is created which holds the connection parameters.

8.2.1 Invoke TCON block for accessing connection parameters

The block is located in the communication tab. Figure 7-1 Standard Communication-Blocks

Figure 8-2 Standard TCON block

By clicking on the block and selecting tab “Properties” und herein tab “Configuration” a window for configuring communication opens.

Page 25: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 25

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Figure 8-3 Configuration window for TCON block

Here the communication parameters can be adjusted. A Configuration-DB is automatically created, which contains those values. Figure 8-4 Path of created Configuration -DB

In order to assign these communication parameters, the DB’s values have to be assigned to the appropriate UDT (in this example TCP01 for a common TCP/IP connection).

Page 26: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

26 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Figure 8-5 Content of UDT TCP_01

This UDT is transferred with its appointed default-values in the CON_DEF (DB1) block automatically at restart (done in OB100). Figure 8-6 Content of CON_DEF (DB1) block

Note Within the CON_DEF (DB1) block the modified UDTs are used as types. Do those UDTs change, you have to update references via “Extras/Update Interface”.

8.2.2 Manually Parameterization of Connection-UDTs

The UDT’s values are assigned manually (e.g. TCP_01 for a TCP/IP connection). Therefore, knowledge of each field within the UDT is recommended.

8.2.3 Connect and Disconnect

Connecting and disconnecting takes place by setting Communication-Block’s REQ inputs as described in chapter 5 “The User Interface”. Controlling is possible via the provided watchtable (e.g. VAT_CON1 for TCP/IP).

Page 27: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 27

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

8.3 Examples for parameterization

A detailed documentation about the configuration of the open communication with the T-blocks can be found in the manual “System Software for S7-300/400 System and Standard Functions” in chapter 23 „Open Communication via Industrial Ethernet“. Link: http://support.automation.siemens.com/WW/view/en/1214574

8.3.1 WinAC with two TCP/IP Client for two separate servers

In this example the WinAC PC only uses one Ethernet port. That’s why there is no need to define the local IP address for the connections. Because of connection with two different servers there is no need for a specific port number on the client side. The operating system assigns the port numbers automatically to the client connections. Figure 8-7 WinAC with two clients for two separate servers

The following table shows the adequate parameterisation. Table 8-1 Parameterisation WinAC with two clients for two separate servers

Adr. Name Typ Wert Komm.

// Connection ID 1 2.0 id WORD W#16#1 Reference to this connection 4.0 connection_type BYTE B#16#11 TCP/IP native 5.0 active_est BOOL TRUE TRUE - active connection ...

12.0 local_tsap_id BYTE B#16#0 local port no. 13.0 BYTE B#16#0

... 34.0 rem_staddr BYTE B#16#95 IP Adr. remote point 35.0 BYTE B#16#F6 36.0 BYTE B#16#F7 37.0 BYTE B#16#31

...

Page 28: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

28 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Adr. Name Typ Wert Komm.

40.0 rem_tsap_id BYTE B#16#13 remote port 41.0 BYTE B#16#88

... // Connection ID 2

66.0 id WORD W#16#2 Reference to this connection 68.0 connection_type BYTE B#16#11 TCP/IP native 69.0 active_est BOOL TRUE TRUE - active connection

... 76.0 local_tsap_id BYTE B#16#0 local port no. 77.0 BYTE B#16#0

... 98.0 rem_staddr BYTE B#16#95 IP Adr. remote point 99.0 BYTE B#16#F6

100.0 BYTE B#16#F7 101.0 BYTE B#16#32

... 104.0 rem_tsap_id BYTE B#16#13 remote port 105.0 BYTE B#16#88

Page 29: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 29

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

8.3.2 WinAC with two TCP/IP clients for one server PC

In this example the WinAC PC only uses one Ethernet port. That’s why there is no need to define the local IP address for the connections. If the server wants to identify every single connection, it is useful to define a specific port number on the client side. So the identification is possible via the client port number without any specific identification telegram. Figure 8-8 WinAC with two clients for one server PC

The following table shows the adequate parameterisation. Table 8-2 Parameterisation WinAC with two clients for one server PC

Adr. Name Typ Wert Komm.

// Connection ID 1 2.0 id WORD W#16#1 Reference to this connection 4.0 connection_type BYTE B#16#11 TCP/IP native 5.0 active_est BOOL TRUE TRUE - active connection ...

12.0 local_tsap_id BYTE B#16#17 local port no. 13.0 BYTE B#16#70

... 34.0 rem_staddr BYTE B#16#95 IP Adr. remote point 35.0 BYTE B#16#F6 36.0 BYTE B#16#F7 37.0 BYTE B#16#31

... 40.0 rem_tsap_id BYTE B#16#13 remote port 41.0 BYTE B#16#88

... // Connection ID 2

66.0 id WORD W#16#2 Reference to this connection 68.0 connection_type BYTE B#16#11 TCP/IP native

Page 30: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

30 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Adr. Name Typ Wert Komm.

69.0 active_est BOOL TRUE TRUE - active connection ...

76.0 local_tsap_id BYTE B#16#17 local port no. 77.0 BYTE B#16#71

... 98.0 rem_staddr BYTE B#16#95 IP Adr. remote point 99.0 BYTE B#16#F6

100.0 BYTE B#16#F7 101.0 BYTE B#16#31

... 104.0 rem_tsap_id BYTE B#16#13 remote port 105.0 BYTE B#16#88

Page 31: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 31

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

8.3.3 WinAC as TCP/IP server with two clients

In this example the WinAC PC only uses one Ethernet port. That’s why there is no need to define the local IP address for the connections. For the server on WinAC side you must define the local port number. The clients connect to the IP and port of the server PC. If both clients run on different PCs there is no need to define the remote ports. The IP address of the clients is enough information to identify the connection. Figure 8-9 WinAC as server with two clients

The following table shows the adequate parameterisation. Table 8-3 Parameterisation WinAC as server with two clients

Adr. Name Typ Wert Komm.

// Connection ID 1 2.0 id WORD W#16#1 Reference to this connection 4.0 connection_type BYTE B#16#11 TCP/IP native 5.0 active_est BOOL FALSE FALSE - passive connection ...

12.0 local_tsap_id BYTE B#16#17 local port no. 13.0 BYTE B#16#70

... 34.0 rem_staddr BYTE B#16#95 IP Adr. remote point 35.0 BYTE B#16#F6 36.0 BYTE B#16#F7 37.0 BYTE B#16#31

... 40.0 rem_tsap_id BYTE B#16#0 remote port 41.0 BYTE B#16#0

... // Connection ID 2

Page 32: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

8 Parameterization of connections

32 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Adr. Name Typ Wert Komm.

66.0 id WORD W#16#2 Reference to this connection 68.0 connection_type BYTE B#16#11 TCP/IP native 69.0 active_est BOOL FALSE FALSE - passive connection

... 76.0 local_tsap_id BYTE B#16#17 local port no. 77.0 BYTE B#16#70

... 98.0 rem_staddr BYTE B#16#95 IP Adr. remote point 99.0 BYTE B#16#F6

100.0 BYTE B#16#F7 101.0 BYTE B#16#32

... 104.0 Rem_tsap_id BYTE B#16#0 remote port 105.0 BYTE B#16#0

8.3.4 WinAC with UDP communication

Also for UDP communication the communication channel has to be established by calling TCON_WINAC. But for UDP in the UDT65 only two parameters are relevant: ID Local port (local_tsap_id)

All other parameters are not relevant. The communication partner is defined by calling TUSEND_WINAC or identified by calling TURCV_WINAC. It is provided by a structure of type UDT66 TADD_PAR. In comparison to the TCP/IP based communication types for UDP you have to use the special FBs TUSEND_WINAC and TURCV_WINAC respectively.

Page 33: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

9 Tipps for solving problems

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 33

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

9 Tipps for solving problems If the connection is not established you can check various reasons.

Does ping work? Check if you can ping you communication partner.

Is a firewall active? Is on the local PC or the remote partner or along the communication way a firewall active? Does block this firewall the communication with the chosen port? Windows XP SP2 does have a active firewall blocking all communication by default.

Is the connection established with the desired parameters? If the connection with the communication partner is not established, the reason could be the usage of false parameters. With the netstat command it is easy to check the used connection parameters. Example: WinAC should open an UDP channel on the local IP 192.168.1.27 on port 2000. netstat -p UDP -a -n –b

...

UDP 192.168.1.27:2000 *:*

[s7wlcrtx.exe]

...

The output of netstat shows: The WinAC (s7wlcrtx.exe) has opened a UDP channel on IP 192.168.1.27 on port 2000.

Using ‘localhost’ as local IP? When using localhost (127.0.0.1) as local IP, the communication partner will not accept this address.

Does help the additional info of the instance DB of TCON_WINAC? Pleas check the value of "IDB TCON_WINAC".C_IF.STATUS_IP_ZINFO. The values are explained in chapter 10.2 „Additional error information “.

Swap client and server Try to swap client and server. If the WinAC should be server, try to use WinAC as client and the partner as Server. Perhaps you will get error information now, which will help to solve the problem. Example (1) TSAP not well configured WinAC is server TCON_WINAC stays in state 0x7002 WinAC is client internal error code 0x507 Example (2) remote IP address not well configured WinAC is server TCON_WINAC stays in state 0x7002 WinAC is client error code 0x80A7 (0x408)

Page 34: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

9 Tipps for solving problems

34 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

Unknown telegrams on Port 102 traced with Wireshark when using ISO on TCP When tracing the communication e.g. with Wireshark you can get additional telegrams on port 102. The reason is: e.g. the Simatic Manager uses this port for “Variables online” too.

Projecting communication partner with NetPro If the communication partner is e.g. a CP 343-1 you can projection this connection side with NetPro. You may not choose the WinAC as connection partner but the entry “unspecified”. You have to pay attention to the exactly matching TSAP-ID in the projecting with NetPro and the projection with the Open Communcation Wizard, especially the leading charcters E0h 02h – see also chapter 8.1 on page 23.

Bit “CONNECTED” remains active after stop of communication partner In the provided example program there is a status bit “CONNECTED”. This bit is updated after calling the four function blocks TCON_WINAC, TDISCON_WINAC, TSEND_WINAC or TRCV_WINAC. If the communication partner changes to STOP, this bit is only updated after calling TSEND_WINAC or TRCV_WINAC. A automatically update of this bit is not possible.

Page 35: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

10 Error codes

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 35

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

10 Error codes The TCP/IP driver can return three different classes of error codes: Error codes of the function blocks at the FB output STATUS corresponding to

the documentation for the FBs in the standard library in the Simatic Manager: Standard Library Communication Blocks

Error codes at the FB output STATUS corresponding the WinAC-ODK (see chapter 10.1 in this document)

Additional error information in the instance DB of the FBs C_IF.STATUS_IP_ZINFO (see chapter 10.2 in this document)

10.1 Error codes of WinAC ODK 4.1

The WinAC IP driver was developed with the WinAC ODK (Open Development Kit). This ODK can return some spezial error codes, which are returned in the output STATUS of the FBs. This special error codes are not part of the Simatic Manager documentation of the standard library function blocks. Table 10-1 WinAC ODK error messages

ODK Code (HEX)

Description

0 Success 8001 An exception occurred. 8002 Input: the ANY pointer is invalid. 8003 Input: the ANY pointer range is invalid. 8004 Output: the ANY pointer is invalid. 8005 Output: the ANY pointer range is invalid. 8006 More bytes were written into the output buffer by the extension object than

were allocated. 8007 ODK system has not been initialized: no previous call to SFB65001

(CREA_COM). 8008 The supplied handle value does not correspond to a valid extension object. 8009 More bytes were written into the input buffer by the extension object than were

allocated. 807F An internal error occurred. 80C3 Maximum number (32) of parallel jobs/instances exceeded. 8102 The call to CLSIDFromProgID failed. 8103 The call to CoInitializeEx failed. 8104 The call to CoCreateInstance failed. 8105 The library failed to load. 8106 A Windows response timeout occurred. 8107 Controller is in an invalid state for scheduling an OB. 8108 Schedule information for OB is invalid. 8109 Instance ID for SFB65001 call is invalid. 810A Controller could not load proxy DLL. 810B The WinAC controller could not create or initialize shared memory area. 810C Attempt to access unavailable option ocurred.

Page 36: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

10 Error codes

36 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

ODK Code (HEX)

Description

8201 The Execute command index could not be found 8250 No more available positions in the job list 8252 The count is invalid 8253 A data type of an item in the list is invalid 8254 The count specified is invalid 8255 A memory area of an item in the list is invalid 8256 A DB number of an item in the list is invalid 8257 A bit number of an item in the list is invalid 8258 A pBuff of an item in the list is invalid 8259 A data quantity is invalid 825A The area offset parameter is invalid for this type 825B The frequency value is invalid 825C The callback pointer is invalid 825D The job ID pointer is invalid 825E The job ID is invalid 825F Job could not be completed because address is incorrect 8260 Job could not be completed because of protection level 8261 Job could not be completed because of hardware issues 8301 Invalid Thread Execution Priority 8401 Invalid Asynchronous Event 8402 Asynchronous Processor Queue is empty 8403 Asynchronous Processor Queue is full

10.2 Additional error information

Beside of the error codes described in the Simatic Manager documentation for FB 631-661 there are some further information in case of an error. This information can help to find the reason of the problem. This data is stored in the instance DB in the variable C_IF.STATUS_IP_ZINFO. Table 10-2 Codes of additional error information

0x0000 - no error current state of connection 0x0001 - a server socket is waiting for client connect 0x0002 - a worker socket is waiting for CR 0x0003 - a client socket is waiting for worker accept 0x0004 - connection established 0x0005 - error when creating server for client 0x0006 - error when creating client socket

Page 37: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

10 Error codes

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 37

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

0x00FF - undefined state of socket errors with WinAC Handling 0x0101 - error using ODK_Read.. function 0x0102 - error using ODK_Write.. function parameter errors 0x0200 - can't read local IP address 0x0201 - UDT61 false block len 0x0202 - false ID value 0x0203 - ID value 0 0x0204 - IDs don't match 0x0205 - UDT65 connection type not supported 0x0206 - UDT65 local device ID not supported 0x0207 - UDT65 active est. for UDP only false allowed 0x0208 - UDT65 local tsap id len not supported for TCP/IP 0x0209 - UDT65 local tsap id len not supported for ISO on TCP 0x020A - UDT65 local tsap id len not supported for UDP 0x020B - UDT65 remote subnet ID len not supported 0x020C - UDT65 remote staddr len not supported for TCP 0x020D - UDT65 remote staddr len not supported for UDP 0x020E - UDT65 remote tsap_id len not supported for TCP/IP 0x020F - UDT65 remote tsap_id len not supported for ISO on TCP 0x0210 - UDT65 remote tsap_id len not supported for UDP 0x0211 - internal error processing parameters init errors 0x0300 - error creating internal event objects 0x0301 - error retriving version of DLL 0x0302 - try to add existing comm.partner 0x0303 - number of comm-partners exceeds 0x0304 - number of local servers exceeds 0x0305 - try to add comm.partner with existing ID 0x0306 - port of local server may not be 0 0x0307 - port of remote server may not be 0 0x0308 - internal error processing initialisation (1) 0x0309 - internal error processing initialisation (2) 0x030A - internal error processing initialisation (3) socket errors 0x0400 - error WSAStartup() 0x0401 - false socket version number

Page 38: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

10 Error codes

38 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

0x0402 - unknown socket type (stream, dgram, ...) 0x0403 - error creating socket with socket() 0x0404 - error setting socket options 0x0405 - error get socket options 0x0406 - error bind() 0x0407 - error bind() - local address not valid in this context (check local IP/port) 0x0408 - error connect() 0x0409 - timeout error select() 0x040A - error select() 0x040B - error recv() 0x040C - error CreateThread() for receive thread 0x040D - error ResumeThread() for receive thread 0x040E - error CreateThread() for listen thread (server) 0x040F - error ResumeThread() for listen thread (server) 0x0410 - error closesocket() 0x0411 - error switching listen mode with listen() 0x0412 - error getsockname() 0x0413 - connection lost 0x0414 - error recvfrom()

Page 39: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

10 Error codes

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 39

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

receiving errors 0x0500 - got no information for this ID 0x0501 - more receive data available than space in given buffer 0x0502 - socket receives more data than space in internal receive buffer 0x0503 - length greater than given ANY pointer 0x0504 - ANY pointer buffer size is 0 0x0505 - try receiving data from not connected client 0x0506 - unable to receive because error state of worker/client socket 0x0507 - connection closed 0x0508 - undefined receive buffer 0x0509 - TURCV_WINAC called with no UDP connection 0x050A - TRCV_WINAC called with UDP connection sending errors 0x0600 - send event for undefined comm.partner 0x0601 - error ResetEvent() for send event 0x0602 - error SetEvent() for send event 0x0603 - internal send buffer not empty (e.g. last data not send by socket) 0x0604 - try sending more data than space in internal send buffer 0x0605 - given buffer to small for complete send data 0x0606 - nothing to send in send buffer 0x0607 - undefined index value for internal comm.partner list 0x0608 - called SendData() without send data 0x0609 - error send() 0x060A - send() could not sent complete data 0x060B - WinAC interface - len does not make sense 0x060C - invalid pointer to send data buffer 0x060D - this is no error - used for mark a send command as 'initiated' 0x060E - got now socket object for send event 0x060F - UDP socket not ready for sending 0x0610 - error sendto() 0x0611 - TUSEND_WINAC called with no UDP connection 0x0612 - TSEND_WINAC called with UDP connection 0x0613 - try sending data to not connected client

Page 40: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

10 Error codes

40 WinAC IP Driver V2

V2.1, Entrys-ID: 48354110

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

ISO on TCP errors 0x0700 - invalid TPDU code used 0x0701 - false local TSAP-ID length 0x0702 - false remote TSAP-ID length 0x0703 - local TSAP-ID not defined 0x0704 - remote TSAP-ID not defined 0x0705 - got other than 'connect confirm' 0x0706 - received calling TSAP-ID length to big 0x0707 - received called TSAP-ID length to big 0x0708 - ISO on TCP connection not established 0x0709 - message too long 0x070A - other than DT tpdu received 0x070B - this operation is not supportet by 'TCP/IP native' 0x070C - no complete header received 0x070D - no complete data received 0x070E - got remote TPDU size greater than locale 0x070F - got remote (calling) TSAP length other than parametrised 0x0710 - got remote (calling) TSAP other than parametrised 0x0711 - got local TSAP length other than parametrised 0x0712 - got local TSAP other than parametrised 0x0713 - got connection request with unknown parameters 0x0714 - did not found socket object in 'unspecific worker' list 0x0715 - socket object not referenced! 0x0716 - send called with no ISO-on-TCP connection handling errors 0x0800 - try removing server object which does not exist error codes used by Step7 function blocks 0x9999 - given connection ID not in range 1..32 other 0x3FFF - could not define state

Page 41: User documentation V2.1 y May 2013 - Siemens AG · not apply in the case of mandatory liability, ... 4.1 Quickstart Step7 V5 ... x Copy components from the demo project into the user

11 History

WinAC IP Driver V2 V2.1, Entry-ID: 48354110 41

Cop

yrig

ht

Sie

men

s A

G 2

013

All

right

s re

serv

ed

11 History Table 11-1

Version Date Comments

V1.0 05-18-06 first version V1.1 06-26-06 - explanantion of parameter “LEN“ of

TRCV_WINAC - explanation of parameter “Port“ of TCON_WINAC - added parameterisation examples - explanation data consistency for TRCV_WINAC - added WinAC ODK error codes - registry entry for cable creak - described local IP for TINIT_WINAC - included hints by F. Kock

V1.2 05-09-07 - insert general notes - insert chapter ”Reference System” - change contact person on front page - adapt reference regarding export codes

V1.3 02-07-08 - added ISO on TCP functionality - complete new error codes - Hint to Open Communication Wizard - change when data receiving is too slow (big internal buffer caches data) - added tips for error diagnostics - Registry for KeepAlive

02-26-08 - added remarks from integration test (added tips for solving problems)

V1.4 04-03-08 - added UDP functionality - TINIT_WINAC with Block_DB instead of Int

V1.5 04-22-08 - add results from integration test - move chapters “Open Comm. Wizard” and “Tipps” - corrected internal error codes - description of example project

V1.6 04-22-09 - Customize on WinAC RTX 2008 - Change FB Numbers and Names

V1.7 03-30-10 - Description of REQ bits V1.8 09-30-10 - Tested with WinAC RTX 2009 V1.9 09-06-11 - New document layout from CS2

- Changes in chapter Objective (consider new functionality of WinAC RTX 2008 and higher) - Correct “old” function names (TRCV TRCV_WINAC)

V2.0 15.03.12

- Change layout to CS3 format - new chapters “Quickstart TIA portal”, “Example project with TIA portal” and “Connection parameters with TIA portal”