SIEMENS - FTP S7-1x00 (v3.0)

January 13, 2018 | Author: Jorge Andril | Category: File Transfer Protocol, User (Computing), Areas Of Computer Science, Computer Architecture, Software
Share Embed Donate


Short Description

FTP Client in S7-1200 and S7-1500...

Description

FTP Data Exchange between FTP Server and SIMATIC S7-1200 / S7-1500 SIMATIC S7-1200, SIMATIC S7-1500, FTP server https://support.industry.siemens.com/cs/ww/en/view/81367009

Siemens Industry Online Support

Warranty and Liability

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.

 Siemens AG 2017 All rights reserved

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 the Siemens AG. Security information

Siemens provides products and solutions with industrial security functions that support the secure operation of plants, systems, machines and networks. In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions only form one element of such a concept. Customer is responsible to prevent unauthorized access to its plants, systems, machines and networks. Systems, machines and components should only be connected to the enterprise network or the internet if and to the extent necessary and with appropriate security measures (e.g. use of firewalls and network segmentation) in place. Additionally, Siemens’ guidance on appropriate security measures should be taken into account. For more information about industrial security, please visit http://www.siemens.com/industrialsecurity. Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly recommends to apply product updates as soon as available and to always use the latest product versions. Use of product versions that are no longer supported, and failure to apply latest updates may increase customer’s exposure to cyber threats. To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under http://www.siemens.com/industrialsecurity.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

2

Table of Contents

Table of Contents Warranty and Liability ................................................................................................. 2 1

Introduction ........................................................................................................ 4 1.1 1.2 1.3

2

Engineering ........................................................................................................ 9 2.1 2.2 2.3 2.4 2.5

3

Interface description "Ftp1X00Cmd" .................................................... 9 Configuring the FTP server ................................................................ 10 Integration into the user project .......................................................... 14 Operating "Ftp1X00Cmd" ................................................................... 18 Error handling of "Ftp1X00Cmd" ........................................................ 20

Valuable Information ....................................................................................... 21 3.1 3.2

4

Overview............................................................................................... 4 Mode of Operation ................................................................................ 6 Components used ................................................................................ 8

Basics ................................................................................................. 21 Alternative solutions ........................................................................... 22

Annex ................................................................................................................ 23 Service and support ........................................................................... 23 Links and literature ............................................................................. 24 Change documentation ...................................................................... 24

 Siemens AG 2017 All rights reserved

4.1 4.2 4.3

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

3

1 Introduction

1

Introduction

1.1

Overview

Initial situation The common File Transfer Protocol (FTP) offers you the opportunity to store data on server systems. FTP supports almost all server and operator systems. All controllers of the product families S7-300, S7-400 and S7-1500 support the FTP communication via special communication processors (CPs). This application example shows you how a S7-1200 or S7-1500 can also use the FTP communication without a special CP with certain FTP servers on the basis of the open user communication (TCON, TSEND, TRCV and TDISCON).

Note

The function of this application example can only be guaranteed with the FTP servers tested.

Overview of the application example

 Siemens AG 2017 All rights reserved

The following figure provides an overview of the automation task. Figure 1-1

Integration of the S7-1200 / S7-1500 into the existing FTP environment

FTP server

FTP

PROFINET IE

+ S7-1500 S7-300 with CP 343-1

S7-400 with CP 443-1

Standard solution

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

S7-1500 with CP 1543-1

S7-1200

ET 200SP CPU

Solution without CP

4

1 Introduction Description In many projects and on many systems it is necessary to exchange process data between controllers and servers/PCs, so that it can also be worked with the incoming data outside of the control level. This is made possible by standardized protocols. FTP is a simple protocol which works according to the client-server principle and fulfills this task. So far, users who used a S7-300, S7-400 or S7-1500 could only exchange process data with a CP via FTP using a FTP server. In this application example, S7-1200 and S7-1500 are integrated into the existing FTP environment without communication processor. Advantages The solution presented here offers the following advantages: Simple and easy to understand FTP communication with an S7-1200 or S71500 via the "Ftp1X00Cmd" block.



The command set of the block corresponds to that of the FTP communication via S7-300, S7-400 or S7-1500 controllers with CP.

The FTP function block delivered with this application example exclusively fulfills FTP client functions.

Note  Siemens AG 2017 All rights reserved



Comparing the most important FTP features in the SIMATIC S7 environment The following table lists the different options how you can use the FTP in the SIMATIC S7 environment. Table 1-1 FTP feature

S7-300 or S7-400 (CP 343-1 / 443-1)

S7-1500 (CP 1543-1)

S7-1200 and S7-1500 (FB "Ftp1X00Cmd")







10/20

32

4

   

   

   

FTP server Number of parallel client connections FTP active FTP passive FTPS Full S7-FTP command set

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

5

1 Introduction

1.2

Mode of Operation

Display of mode of operation of the "Ftp1X00Cmd" block The following figure shows the mode of operation, the structure and states of the "Ftp1X00Cmd" function block. Figure 1-2 1

Data entry

2

Connect

3

Connection establishment

Control connection

faulty

faulty

Disconnect

8

Disconnecting

9

Not Connected

10

Done

11

Disconnecting

17

 Siemens AG 2017 All rights reserved

Error; 7 error status 4

User Authentication

5

Send types

12

Execute

13

Send mode

14

Send command

15

Connection establishment

faulty

Connected 6

Data connection faulty

Error; error status

faulty

faulty

Data transfer 16

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

6

1 Introduction Description of the positions The following table describes the different positions of figure 1-2. Table 1-2

 Siemens AG 2017 All rights reserved

No.

Action

Description

1.

Storing connection data in DB

The following connection data is specified by the user: Server IP address; hardware ID of the interface used; username; password; file name; FTP mode; FTP command; FTP data; connection ID of controller connection (the ID and the ID+1 are each required per "Ftp1X00Cmd”).

2.

Click connect

The user initiates the connection to the controller.

3.

Establishing the connection to the controller

The controller connection (port 21) to the FTP server is established.

4.

User authentication

The FTP client logs on with the user data specified by the user (username, password).

5.

Send types to server

The type of the file to be transferred is send to the FTP server.

6.

Connected set

The controller connection is now ready. FTP jobs can now be carried out (no 12) up until the controller connection is closed.

7.

Error set; output error status

An error occurred while processing. The error-specific status is output (see chapter 2.5)

8.

Reset connect

The user initiates termination from the controller connection.

9.

Terminate controller connection

The controller connection (port 21) to the FTP server is terminated.

10.

Reset connected

The controller connection is terminated.

11.

Done set

The connection establishment or the triggered job has been executed.

12.

Click execute

The user initiates the execution of a FTP job.

13.

Send mode to server

The mode selected by the user (active, passive) is sent to the FTP server.

14.

Send FTP command to server.

The FTP command selected by the user is sent to the FTP server. The following options are available: STORE (save data) APPEND (attach data) RETRIEVE (fetch data) DELETE (delete file)

15.

Establishing the data connection

The data connection (FTP active: Port 20) is established to the FTP server.

16.

Data transfer from or to server

Either storage of data on the FTP server or the assigned area on the controller (FTP client)

17.

Terminate data connection

The data connection (FTP active: Port 20) to the FTP server is terminated.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

7

1 Introduction

1.3

Components used

Hardware components for data exchange with S7-1200 The following table shows what components have been used for the application example for the solution with S7-1200 and S7-1500. Table 1-3 Component

Numbe r

Article number

Note

SIMATIC S7-1200 CPU 1214C DC/DC/DC

1

6ES7 214-1AG310XB0

Alternatively, any other SIMATIC S7-1200 as of firmware V4.0 can also be used.

SIMATIC S7-1500 CPU 1513-1 PN

1

6ES7 513-1AL01-0AB0

Alternatively, any other SIMATIC S7-1500 or ET 200SP CPU as of firmware V1.0 can also be used.

 Siemens AG 2017 All rights reserved

Software components The following table shows what software components have been used for the application example. Table 1-4 Component

Qty.

Article number

Note

STEP 7 PROFESSIONAL V14 SP1

1

6ES7 822-1AA02-0YA5

Alternatively, a smaller package is also possible.

FileZilla server V0.9.46

1

Freeware (GPL)

The download link to FileZilla Server is available in chapter 4.2: \4\

Projects and documentation This application example consists of the following components: Table 1-5 Component

File name

Project

81367009_FTP_S7_ 1X00_PROJ_V2_0.zip

Documentation

81367009_FTP_S7_ 1X00_DOKU_V2_0_en.pdf

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

Note This zip file contains the STEP 7 project of the example project for S7-1500 and S7-1200. This document.

8

2 Engineering

2

Engineering

2.1

Interface description "Ftp1X00Cmd"

Function description The "Ftp1X00Cmd" FTP function block maps the FTP and hence enables the actual FTP communication based on the open user communication. It can perform the following FTP commands: 

CONNECT (connect und log in)



DISCONNECT (disconnect and log out)



STORE (save data)



APPEND (attach data)



RETRIEVE (fetch data)



DELETE (delete file)

Block interface The following figure shows the interfaces of the "Ftp1X00Cmd" function block. Figure 2-1: Ftp1X00Cmd

 Siemens AG 2017 All rights reserved

Ftp1X00Cmd Bool

connect

connected

Bool

Bool

execute

done

Bool

Word

connectionId

busy

Bool

Bool

ftpActiveMode

error

Bool

status

Word

Int

ftpCmd

String

username

String

password

String

filename ftpData

Variant

connectionData

TCON_IP_v4

Variant TCON_IP_v4

The following table describes the interfaces of the "Ftp1X00Cmd" function block. Table 2-1: Parameters of Ftp1X00Cmd Name

P type

Data type

Comment

connect

IN

Bool

TRUE = controller connection to FTP server is connected FALSE = controller connection is separated

execute

IN

Bool

FTP job trigger at positive edge

connectionId

IN

Word

Freely selectable connection ID of the TCP connections. NOTICE: ID and ID+1 are reserved. These are unique throughout the project.

ftpActiveMode

IN

Bool

FALSE = passive FTP mode TRUE = active FTP mode

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

9

2 Engineering Name

 Siemens AG 2017 All rights reserved

Note

P type

Data type

Comment

ftpCmd

IN

Int

2 = STORE, 3 = RETRIEVE, 4 = DELETE, 6 = APPEND

username

IN

String

Username of a user of the FTP server

password

IN

String

User password of the FTP server

filename

IN

String

File name for FTP communication

connected

OUT

Bool

TRUE = controller connection is connected FALSE = controller connection is separated

done

OUT

Bool

TRUE = job completed

busy

OUT

Bool

TRUE = job in progress

error

OUT

Bool

TRUE = error occurred

status

OUT

Word

Outputs the current job status in form of a HEX code

ftpData

IN_OUT

Variant

User data for FTP communication

connectionData

IN_OUT

TCON_IP_v4

Data for the connection to FTP server (IP address, hardware ID of interface used)

The output values "done" and "error" are only pending for one cycle if "connect" and "execute" are not set.

Function chart The following function chart shows how the output parameters respond in dependence to the input parameters. Figure 2-2

connect (manually)

execute (manually)

connected pending for one more cycle

done busy error Data transfer of user-defined structures

The function block "Ftp1X00Cmd" provides at input "data" an Array of Bytes. With the system function Serialize, you can copy defined user data (PLC data types) to "Data" of the data block "ftpData". You can find a detailed description of the system function Serialized in the TIA Portal Online Help. on cycle active

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

10

2 Engineering

2.2 Note

Configuring the FTP server For this application example the configuration of the FTP server is shown on the example of the FileZilla server. For different FTP servers the required configuration steps may also differ. Function block "Ftp1X00Cmd" cannot be used with any FTP server. The function is only guaranteed and tested with the following FTP servers: SIMATIC CP, Filezilla and JanaServer.

Installation The following instructions show you how to install the FileZilla server. Table 2-2

 Siemens AG 2017 All rights reserved

No.

Note

Action

Remark

1.

Download the FileZilla server.

The download link to FileZilla Server is available in chapter 4.2. This program is recommended for the application example since it is easy to operate and structured in a very functional way.

2.

Install the FTP server software on your server.

Follow the instructions of the program.

Make sure you have the latest FileZilla server version.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

11

2 Engineering

Configuration The table below shows you the required steps for the configuration of the FileZilla server. If another FTP server software is used, their manuals need to be followed for commissioning. It is important to create a user with password and full access to the files in its root directory for the application example to work properly. Table 2-3 No.

Action

1.

Start the FileZilla server interface on your FTP server and click on “OK”. You are logged into the interface. Here, you could track any of the actions running on the server.

2.

Click on “Edit” in the menu bar and then on “Settings” to get to the server settings.

Screen

 Siemens AG 2017 All rights reserved

All of your desired settings can be made here, for example the maximum number of users and when the ftp server disconnects from the ftp client ("Connection timeout"). For this application example you can use the default settings. Confirm with “OK”. 3.

Click on “Edit” in the menu bar and then on “Users” to get to the user management. Select the “General” page and click on “Add”. Enter an FTP user name in the field, for example, “ftp_user”. Confirm with “OK”.

4.

Enable the “Password” checkbox and enter the password in the field next to it, for example, “ftp_user”.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

12

2 Engineering No. 5.

Action

Screen

Select the “Shared folders” page, and in the “Shared folders” section you click on “Add”. In the now opened Explorer, navigate to the folder you wish to use as FTP root directory for the created user. Select the folder (for example, a previously created folder: "FTP_Server") and confirm using "OK". Enable the “Read”, “Write”, “Delete” and “Append” checkboxes in “Files”. If you want to generate new folder structures and directories, enable the "Create", "Delete", "List" and "+Subdirs" checkboxes in "Directories". Confirm using “OK” again.

 Siemens AG 2017 All rights reserved

6.

Make sure that the server is online: The online icon must be enabled. Now you have created an FTP user with password, root directory, and all of the required rights. The FTP server is now ready for the application example and for processing user requests.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

13

2 Engineering

2.3

Integration into the user project When assigning your devices’ IP addresses, make sure that the CPU that works as FTP client and the FTP server are located in the same subnet and each IP address is only assigned once within the subnet.

Note

Prerequisites The following prerequisites apply for the use of the application example: 

S7-1200 as of firmware V4.0



S7-1500 as of firmware V1.0



Compatible FTP server has been configured

Restrictions

 Siemens AG 2017 All rights reserved

The following restrictions apply for this application example.

Note



The application example works only with the tested FTP servers and as of the software version tested.



Only four FTP users can be connected at the same time from a controller to a FTP server.



FTPS functionality cannot be integrated.



With a S7-1500 a maximum of 65536 bytes can be sent and with a S7-1200 a maximum of 8192 bytes can be sent.



For non-optimized access the lower or upper limits of arrays are at -32768 or 32767.



For optimized access the lower or upper limits of arrays are at -2,147,483,648 or 2,147,483,647.



For S7-1200 and S7-1500 the maximum size of data to be received depends on the maximum size of the reception memory of the CPU.

This note applies to S7-1500-CPUs For a block with the "Optimized block access" property, an element of the Bool data type requires a storage area of 1 byte. The same is the case for arrays of Bool:

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

14

2 Engineering Integrating project components into the user project Copy the following project components into your TIA Portal project using drag-anddrop: 

"Ftp1X00Cmd" function block



"ftpData" data block



"Watch Table"



The "PLC tags" from "Default tag table [60]"

It is recommended to work with the "Reference projects" view here. The following table shows you how to proceed. Table 2-4

 Siemens AG 2017 All rights reserved

No.

Action

1.

Open the view by enabling the "Reference projects" checkbox in "View".

2.

Open the example project included in the "Reference projects" view.

3.

Now you can copy the following project components into your TIA Portal project using drag-and-drop:  "Ftp1X00Cmd" function block

4.



"ftpData" data block



"Watch Table"



The "PLC tags" from "Default tag table [60]"

Screen or description

"81367009_FTP_S7_1X00_PROJ_V2_0.zip"

Call the "Ftp1X00Cmd" block in your cyclic organization block and interconnect the block as described in the following subchapter.

Note

Working with a second TIA Portal instance requires more system resources than the "reference projects" view.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

15

2 Engineering

Interconnecting fixed parameters of the "Ftp1X00Cmd" block Before you are using the "Ftp1X00Cmd" block for the FTP communication, the following parameters have to be interconnected: 

"connectionID"



"username",



"password",



"filename",



"ftpData"



"connectionData"

Interconnect the parameters as described in the interface description chapter. In order to control the block you also have to interconnect the inputs "connect", "execute", "ftpCmd" and "ftpActiveMode". In the application example, these inputs are interconnected with "PLC tags". The tags used are listed in the tag table included. The following figure shows the call of the "Ftp1X00Cmd" block in the application example.

 Siemens AG 2017 All rights reserved

Figure 2-3

Note

The interconnection of the parameters described here is the basic requirement for the operation of the block. Without an interconnection, a controller connection to the FTP server cannot be established. The specified user has to be created on the server side in order to be able to establish the connection.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

16

2 Engineering

Data transfer of user-defined structures With the "Ftp1X00Cmd" block, you cannot only send or receive an array of bytes or characters but also specific data types or independent structures (data type "STRUCT"). To do this, some adjustments have to be made on the SCL code of "Ftp1X00Cmd". The following table explains what you have to change on the SCL code. Table 2-5

 Siemens AG 2017 All rights reserved

No.

Note

Action

Description

1.

Interconnect the "DATA" INOUT parameter of the "InstTrcvDataConn" multi instance in code row 737 with the "ftpData" INOUT parameter of the "Ftp1X00Cmd" block.

The data received on the data connection is now no longer saved in a data buffer but is directly transferred to the "ftpData" INOUT parameter.

2.

Comment out the code rows 405 to 420.

Since the data is directly transferred to “ftpData”, the data buffer no longer has to be copied.

3.

Interconnect the "ftpData" INOUT parameter of the "Ftp1X00Cmd" block with the structure used by you.

The structure attached by you is now used for sending ("STORE"/"APPEND" command) and receiving ("RETRIEVE" command).

If you adjust the code, a maximum of 8192 bytes can be received by "Ftp1X00Cmd".

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

17

2 Engineering

2.4 Note

Operating "Ftp1X00Cmd" The prerequisite for successful operation is that the FTP server is compatible with the "Ftp1X00Cmd" block and that it has been configured as described in chapter 2.2.

Description of the operation of the "Ftp1X00Cmd" block The "Ftp1X00Cmd" block is mainly controlled via the inputs "connect", "execute", "ftpCmd" and "ftpActiveMode". This is where the "connect" input, controls the connection establishment and termination of the controller connection to the FTP server. As long as data is exchanged it has to remain "connect" TRUE. If "connect" is set to FALSE the termination of the controller connection starts and the user connected to the FTP server is logged out. The FTP command for data transmission (2=STORE, 3=RETRIEVE, 4=DELETE, 6=APPEND) is specified using the "ftpCmd" input. The transfer mode (TRUE=active, FALSE=passive) is specified using the "ftpActiveMode" mode.

 Siemens AG 2017 All rights reserved

As soon as the controller has a controller connection to the FTP server (output "connected"=TRUE), a FTP mode is set, a valid FTP command has been selected and a valid file name/path specified, you can process FTP commands with a positive edge on the "execute" input. The following figure is to illustrate the dependencies of the inputs and outputs of the "Ftp1X00Cmd" block. Figure 2-4 username

password

connecti onId

connect

connecti onData

Successful?

No

error

Yes done

connected

filename

ftpMode

ftpCmd

ftpData

execute

error

No Successful?

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

Yes

done

18

2 Engineering Description of the tag table included The project of the application example includes a tag table. The tag table is explained below. The following figure shows the tag table. Figure 2-5

1 2 3 4 5

The following table describes the tag table. Table 2-6

 Siemens AG 2017 All rights reserved

No.

Tag

Function

1.

varConnect

If this tag is set, the controller connection is established and the user specified on the "username" input is logged in to the FTP server, using the password specified on the "password" input. If the tag is reset, the controller connection is established and the user is logged out.

2.

varExecute

The job for FTP data transmission is started if there is a positive edge.

3.

varFtpMode

This is where the FTP mode for the data transmission is specified.

4.

varFtpCmd

Here, the FTP command is specified.

5.

varDone varBusy varError varConnected varStatus

Status area: The tags reflect the status of the "Ftp1X00Cmd" block. This is where you can see whether the controller connection is connected and whether the block is error free or with what specific error it was run.

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

19

2 Engineering

2.5

Error handling of "Ftp1X00Cmd" The "Ftp1X00Cmd" block catches some errors of the OUC blocks and changes received FTP reply codes in HEX codes. These status messages are output at the "status" output.

HEX code status messages The following table describes a part of the possible status messages of the "Ftp1X00Cmd" block. Table 2-7 done

busy

error

status

Description

X

0

X

0100

Job completed successfully. Because of the behavior of TDISCON while disconnection, the Data connection has been terminated.

X

7001

Control connection is connecting.

X

7002

Control connection is disconnecting

 Siemens AG 2017 All rights reserved

X

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

Job completed successfully without error

7003

FTP command is executed.

X

8D11

Controller connection not connected; data connection cannot be opened

X

8D26

Data connection cannot be opened

X

8D27

Data connection not terminated properly; with some servers, data still arrives and therefore there is still a data transfer.

X

8D28

FTP server Timeout

X

8D81

File not found

X

8DF1

Timeout of watchdog timer (5s)

X

8DF2

Unknown reply code

X

8DF3

Unknown command

X

8F60

Invalid user data

X

8F62

Action aborted; data connection will be terminated

X

8F69

Connection attempt to existing connection

20

3 Valuable Information

3

Valuable Information

3.1

Basics

FTP general FTP was developed to exchange data between a client and a server. Furthermore, it is designed for managing directories via remote access. In the world of automation technology, FTP is a useful protocol to easily exchange data. There are two modes for FTP communication: 

active FTP



passive FTP

FTP active

 Siemens AG 2017 All rights reserved

In this mode, the FTP client opens a random port (>1023) and sends it and its own IP address to the FTP server using a special command (PORT or EPRT). By default, the command is sent to port 21 of the FTP server. Port 21 of the server has to be open or forwarded in the firewall of the server; otherwise no communication will be established. When data transfer is requested, the FTP server initiates a data connection to the transferred IP address and FTP server port 20. The active mode is used when the FTP server is located behind a firewall, since the data connection is initiated from the FTP server outwards and is therefore not blocked by the firewall. Hence, the FTP server reacts actively. The figure below illustrates the active FTP communication on the example of the RETRIEVE command. Figure 3-1

Active FTP communication (RETRIEVE command)

FTP-Client Port X

FTP server Port X

Controller port 21

Data port 20

Expects controller connection

Expects data connection Opens data connection

Closes data connction after data transfer

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

21

3 Valuable Information FTP passive In this mode, the FTP client sends a PASV or EPASV command to port 21 of the FTP server. The FTP server then opens a random port and transmits this port number to the FTP client together with its IP address. For the data transfer, the FTP client now initiates a TCP connection to the IP address sent by the FTP server and the port. If the FTP client is located behind a firewall, the passive mode is used. The stateful packet inspection normally always allows outgoing data packets in the firewall. Hence, the FTP server reacts passively. The figure below illustrates the passive FTP communication on the example of the RETRIEVE command: Figure 3-2

Passive FTP communication (RETRIEVE command) FTP client

FTP server

Port X

Port X

Controller port 21

Data port X

 Siemens AG 2017 All rights reserved

Expects controller connection

Expects data connection Opens data connection

Closes data connection after data transfer

3.2

Alternative solutions Alternatively to the solution described here, the FTP functionality can also be integrated with a different hardware into the S7 world. The following table lists alternative solutions with a link to the respective application example. Table 3-1 Solution

Link

FTP communication S71500 and CP 1543-1

https://support.industry.siemens.com/cs/ww/en/view/103550797

FTP communication with S7-300/400 and CPx43-1 Advanced

https://support.industry.siemens.com/cs/ww/en/view/21605954

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

22

4 Annex

4

Annex

4.1

Service and support

Industry Online Support Do you have any questions or need support? Siemens Industry Online Support offers access to our entire service and support know-how as well as to our services. Siemens Industry Online Support is the central address for information on our products, solutions and services. Product information, manuals, downloads, FAQs and application examples – all information is accessible with just a few mouse clicks at https://support.industry.siemens.com Technical Support Siemens Industry's Technical Support offers quick and competent support regarding all technical queries with numerous tailor-made offers – from basic support right up to individual support contracts.

 Siemens AG 2017 All rights reserved

Please address your requests to the Technical Support via the web form: www.siemens.en/industry/supportrequest Service offer Our service offer comprises, among other things, the following services: 

Product Training



Plant Data Services



Spare Parts Services



Repair Services



On Site and Maintenance Services



Retrofit and Modernization Services



Service Programs and Agreements

Detailed information on our service offer is available in the Service Catalog: https://support.industry.siemens.com/cs/sc Industry Online Support app Thanks to the "Siemens Industry Online Support" app, you will get optimum support even when you are on the move. The app is available for Apple iOS, Android and Windows Phone. https://support.industry.siemens.com/cs/ww/en/sc/2067

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

23

4 Annex

4.2

Links and literature Table 4-1 No.

4.3

Topic

\1\

Siemens Industry Online Support https://support.industry.siemens.com

\2\

Link to the entry page of the application example https://support.industry.siemens.com/cs/ww/en/view/81367009

\3\

STEP 7 V14 SP1 manual https://support.industry.siemens.com/cs/ww/en/view/109747136

\4\

FileZilla server https://filezilla-project.org/download.php?type=server

\5\

Programming Styleguide https://support.industry.siemens.com/cs/ww/en/view/109478084

Change documentation

 Siemens AG 2017 All rights reserved

Table 4-2 Version

Date

V1.0

10/2013

First version

V2.0

05/2015

Adding the FTP client functionality for S7-1500 and Migration to TIA Portal V13 SP1, updating the used OUC library

V3.0

07/2017

Migration to TIA Portal V14 SP1 Complete revision of the "Ftp1X00Cmd" block according to the Programming Styleguide

FTP Communication S7-1200 S7-1500 Entry ID: 81367009, V3.0, 07/2017

Modifications

24

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF