You are on page 1of 39

Automatic loading

and archiving of
service data of a CPU
with SAT via API
Siemens
SIMATIC Automation Tool V3.1 SP2 Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109760829 Support
Legal information

Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several
components in the form of text, graphics and/or software modules. The application examples are
a free service by Siemens AG and/or a subsidiary of Siemens AG ("Siemens"). They are
non-binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute
customer-specific solutions. You yourself are responsible for the proper and safe operation of the
products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the
application examples used by technically trained personnel. Any change to the application
examples is your responsibility. Sharing the application examples with third parties or copying the
application examples or excerpts thereof is permitted only in combination with your own products.
The application examples are not required to undergo the customary tests and quality inspections
of a chargeable product; they may have functional and performance defects as well as errors. It is
your responsibility to use them in such a manner that any malfunctions that may occur do not
result in property damage or injury to persons.

Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without
limitation, liability for the usability, availability, completeness and freedom from defects of the
application examples as well as for related information, configuration and performance data and
any damage caused thereby. This shall not apply in cases of mandatory liability, for example
under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of
life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent
non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for
damages arising from a breach of material contractual obligations shall however be limited to the
 Siemens AG 2019 All rights reserved

foreseeable damage typical of the type of agreement, unless liability arises from intent or gross
negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions
do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens
against existing or future claims of third parties in this connection except where Siemens is
mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any
damage beyond the liability provisions described.

Other information
Siemens reserves the right to make changes to the application examples at any time without
notice. In case of discrepancies between the suggestions in the application examples and other
Siemens publications such as catalogs, the content of the other documentation shall have
precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.

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 constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines
and networks. Such systems, machines and components should only be connected to an
enterprise network or the Internet if and to the extent such a connection is necessary and only
when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
at: https://www.siemens.com/industrialsecurity.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 2
Table of contents

Table of contents
Legal information ......................................................................................................... 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Principle of operation............................................................................ 4
1.3 Components used ................................................................................ 5
2 Engineering ........................................................................................................ 6
2.1 Interface description ............................................................................. 6
2.2 Hardware construction ......................................................................... 7
2.3 Project planning / Configuration / Parameterization ............................. 7
2.3.1 Network connections ............................................................................ 7
2.3.2 Setting the PG/PC interface ............................................................... 10
2.3.3 CPU properties ................................................................................... 11
2.3.4 Download the project (TIA Portal) ...................................................... 13
2.3.5 Create Task Scheduler....................................................................... 15
2.4 Operation ............................................................................................ 23
2.4.1 Manual Upload of the service data ..................................................... 23
2.4.2 Automatic upload of the Service data ................................................ 25
2.5 Error handling ..................................................................................... 28
3 Useful information ........................................................................................... 30
3.1 Basics ................................................................................................. 30
 Siemens AG 2019 All rights reserved

3.2 Details on functionality ....................................................................... 36


3.3 Alternative solutions ........................................................................... 37
4 Appendix .......................................................................................................... 38
4.1 Service and support ........................................................................... 38
4.2 Links and Literature ............................................................................ 39
4.3 Change documentation ...................................................................... 39

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 3
1 Introduction

1 Introduction
1.1 Overview
With the SIMATIC Automation Tool, you can perform commissioning and service
tasks on SIMATIC S7-1200, S7-1500, ET200, HMI, SITOP devices and SIMATIC
RFID as well as MOBY Ident modules independently of the TIA portal. The
licensed tool provides an API (e.g. for automated use of the supported operations
with C#). These operations also include loading the service data of the CPU.
The service data contains among other things the diagnostic buffer entries of the
CPU.
From this you can gain knowledge about the condition of your automation system.
You can use the provided application to regularly back up the service data of your
CPU, for example to compile statistics on how often subordinate Profinet devices
deliver diagnostic messages to the controller. From this data, measures can be
defined to minimize downtimes.

1.2 Principle of operation


Figure 1-1

SIMATIC
Windows Task Scheduler
S7-1500
 Siemens AG 2019 All rights reserved

UploadServiceData.exe
API
SIMATIC Automation Tool ET 200SP CPU

S7-1200

This application example provides you with the UploadServiceData.exe application,


created with Visual Studio in the C# programming language. This is a console
application that you execute by passing arguments. The application accesses its
functions via the API of the SIMATIC Automation Tool and loads the service data of
the selected CPU (S7-1500, ET 200SP CPU or S7-1200). You can use the Task
Scheduler of the Windows operating system to define the time at which the
application is to run and thus specify the interval for automatic deduction of the
service data.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 4
1 Introduction

1.3 Components used


This application example was created with these hardware and software
components:
Table 1-1
Components Quantity Article number Note
POWER SUPPLY S7- 1 6EP1332-1SH71
1200 PM1207
CPU 1214C, DC/DC/DC, 1 6ES7214-1AG40-0XB0 Firmware V4.2.3
14DI/10DO/2AI
PC/programming device 1 With Ethernet
connection (LAN)
Ethernet cable 1 6XV1870-3QH20
TP CORD RJ45/RJ45
2M
Circuit breakers 1 5SY6116-6 1-pin B, 16A
DIN rail 1 6ES5 710-8MA11 35 mm
SIMATIC STEP 7 V15 1 6ES7822-0AA05-0YA5 Basic (only for S7-
6ES7822-1AA05-0YA5 1200)
Professional
SIMATIC Automation 1 6ES7853-1AE03-0YA5 (\3\);
Tool from V3.1 SP2 API usage requires a
 Siemens AG 2019 All rights reserved

(V03.01.02) license
.NET Framework 4.6.2 1 Required to run the
UploadServiceData.exe
file
Planning tasks (Task Part of Windows
Scheduler) operating system
Microsoft Visual Studio 1 Optional: for editing the
2015 Update 3 C# program code

This application example consists of the following components:


Table 1-2
Components File name Note
STEP 7 109760829_SAT_UploadServiceData_TiaV15_PROJ_V10.zip This zipped file
project contains the STEP 7
project.
Executable 109760829_SAT_UploadServiceData_SatV312_EXE_V10.zip This packed file
program for contains the
uploading the executable program
service data of for uploading the
the CPU service data
"UploadServiceData.
exe" in connection
with the SIMATIC
Automation Tool from
V3.1 SP2 (\3\), as
well as the source
code in C#.
Description 109760829_SAT_UploadServiceData_DOC_V10_de.pdf This document.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 5
2 Engineering

CPU password
Full access (no protection) to the CPU is required to upload the service data. If a
password has been set for this access level, it must be set to 5. Argument of the
executable file "UploadServiceData.exe" can be transferred. (Table 2-1).
The password for the access level "Full access (no protection)" of the sample CPU
is: "full".
The procedure for setting the CPU password is described in section 2.3.3.

2 Engineering
2.1 Interface description
The download "109760829_SAT_UploadServiceData.zip" (Table 1-2) contains the
console application "UploadServiceData.exe". This was created in C# using Visual
Studio 2015 Update 3 and .NET Framework V4.6.2.
The prerequisite for the executability of "UploadServiceData.exe" is an existing
license for the SIMATIC Automation Tools V3.1 SP2, (Table 1-1), which must be
installed, as well as the installation of the .NET Framework V4.6.2.
The file "UploadServiceData.exe" allows the upload of the service data of a
S7-1200/S7-1500/ET 200SP CPU with the following arguments:
Table 2-1
No. Argument Description Format
 Siemens AG 2019 All rights reserved

1. Network card The application displays a list of available "0" to "n"


number network cards. Select the list number.
2. CPU Specification of the interpretation of the "IP" or "MAC"
identification argument 3:
Should the CPU be searched via the IP or MAC
address?
3. IP address or IP address or MAC address of the CPU IP: "xxx.xxx.xxx.xxx"
MAC address (According to the argument 2 specification) MAC: "xxxxxxxxxxxx"
 The octets of the IP address must be
separated by dots (".").
 the MAC address consists of 12 characters
written to each other without separation
4. Destination Destination folder in which the service data is to e.g.: "c:\MyServiceData"
folder be stored (Must exist + Case sensitive!)
5. Password CPU password (if available): e.g.: "full" or omit if no
Password level "Full access" password has been
(Case sensitive) assigned

Note The console application runs at the Windows Command Prompt "cmd.exe". The
sequence of the argument is preset in Table 2-1. The arguments are separated
by blank spaces.

The detailed procedure for checking the function of the console application
"UploadServiceData.exe" can be found in section 2.4.1.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 6
2 Engineering

2.2 Hardware construction


The application example was tested with a S7-1200 CPU. The procedure to upload
the service data of a S7-1500 or ET 200SP CPU is identical.

Hardware installation
The following image shows the hardware construction of the application:
Figure 2-1
L1

Service PC/PG N
PE
DC24V+
DC24V-

SIMATIC
Automation
Tool SIMATIC

PM 1207 S7-1200
 Siemens AG 2019 All rights reserved

IP address 192.168.0.242 IP address 192.168.0.1


Subnet mask 255.255.255.0 Subnet mask 255.255.255.0

2.3 Project planning / Configuration / Parameterization


2.3.1 Network connections

The network card of the service PC gets a static IP address.


The configuration of this LAN connection is described below.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 7
2 Engineering

Table 2-2
No. Action
1. Open the "Network and Sharing Center" by searching for it using the Windows 10
icon.

2. Open the menu item "Change adapter settings"


 Siemens AG 2019 All rights reserved

3. The network connections are listed.


 Select your network connection.
 Right-click to open Properties.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 8
2 Engineering

No. Action
4. Under "This connection uses the following items:" select the element "Internet
Protocol Version 4 (TCP/Ipv4)" and open its properties.
 Siemens AG 2019 All rights reserved

5.  Select "Use the following IP address".


 Assign the IP address and subnet mask as shown (see Figure 2-1).
 Accept the settings with "OK".

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 9
2 Engineering

2.3.2 Setting the PG/PC interface

Table 2-3
No. Action
1. Open the Windows "Settings" via the Windows icon.

2. Search for the PG/PC interface settings and open them to set the correct access
type for STEP 7 V15.
 Siemens AG 2019 All rights reserved

3.  Select "S7ONLINE (STEP 7)" as the access point for the application
example.
 Select your network card with the extension "TCPIP.1" as used interface
parameterization.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 10
2 Engineering

2.3.3 CPU properties

The CPU properties "Ethernet addresses" and "Protection" must be individually


customized.

Table 2-4
No. Action
1. Select the control and open the "Properties..." by right-clicking.

2.  Activate the submenu "PROFINET interface > Ethernet addresses > IP


 Siemens AG 2019 All rights reserved

protocol”.
 Enter the IP address and control subnet mask. (Figure 2-1).

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 11
2 Engineering

No. Action
3. The SIMATIC Automation Tool requires the password for full access of the CPU
(if this has been assigned) in order to retrieve the service data.
 Open Settings "Access level" under "Protection & Security".
 Activate at minimum the access level "Read access".
 Open the password assignment of the access level "Full access (no
protection)" by clicking the button .

4.  Enter the password "full", confirm it and accept the settings with the button
.
 Siemens AG 2019 All rights reserved

5.
Click the OK button to apply the CPU properties. .

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 12
2 Engineering

2.3.4 Download the project (TIA Portal)

You can load your project into the CPU with the TIA Portal or via the SIMATIC
Automation Tool. The procedure for downloading via the TIA Portal is described
below:
Table 2-5
No. Action
1.  Save the project.
 Select the program folder of the S7-1200 and transfer the program to the
controller using the "Load to device" button.

2.  Select "PN/IE" as the type of PG/PC interface.


 Select your LAN card as PG/PC interface.
 Select "Show all compatible participants".
 Siemens AG 2019 All rights reserved

 Start the search with the button.

3.  Select your CPU from the list of target devices.


 Press the "Load" button.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 13
2 Engineering

No. Action
4.  Confirm the Load preview by clicking the "Load" button.

5.  You may need to enter the password for full access "full".
 Confirm the entry with "OK".
 Siemens AG 2019 All rights reserved

6.  Activate the option "Start assembly" in "Load result".


 Press the "Finish" button to complete the loading process.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 14
2 Engineering

2.3.5 Create Task Scheduler

To automatically upload the service data, a task is created on the PC/PG in


Windows task planning. This calls the console application
"UploadServiceData.exe" every 5 minutes. With this the service data of the CPU
are loaded via the API of the SIMATIC Automation Tool V3.1 SP2 and stored on
the computer (section 2.1).

Table 2-6
No. Action
1. Open the Windows Task Scheduler program by searching for it using the
Windows icon.
 Siemens AG 2019 All rights reserved

2. This opens the "Task Scheduler" overview window.


 Click on "Create basic task..." under "Actions > Task Scheduling Library" at
the top right.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 15
2 Engineering

No. Action
3. This will open the "Create Basic Task Wizard".
 Assign a name.
 Click on "Next >".
 Siemens AG 2019 All rights reserved

4.  Select the setting "Daily" under Trigger.


 Click on "Next >".

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 16
2 Engineering

No. Action
5. The current date is used as the start date.
 Input a start time.
 Click on "Next >".
 Siemens AG 2019 All rights reserved

6.  As the action, select "Start a program".


 Click on "Next >".

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 17
2 Engineering

No. Action
7. Enter the following entries in the "Start program" settings window:
 Program/script:
UploadServiceData.exe
 Adding arguments (optional):
0 IP 192.168.0.1 c:\MyServiceData full
 Start in (optional): See Table 2-7 No. 2
c:\Program Files\Siemens\Automation\SimaticAutomationTool\bin\
Click on "Next >".
 Siemens AG 2019 All rights reserved

8.  Activate the option


Click on "Finish" to open the properties for this task. (Open the Properties
dialog for this task when I click Finish).
 Click "Finish"

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 18
2 Engineering

No. Action
9.  In the "General" screen under "Security options", select the option "Run
whether user is logged on or not".
 Select the "Run with highest privileges" option.
 Under "Configure for:" select "Windows 10"
 Switch to the "Triggers" screen.
 Siemens AG 2019 All rights reserved

10. Select the created trigger entry and click on "Edit...".

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 19
2 Engineering

No. Action
11.  In "Advanced settings" activate the option "Repeat task every:"
 Select "30 minutes" as the interval and change the number to "5 minutes".
 Select "for a duration of:" "1 day"
 Activate the option
"Stop all running tasks at end of repetition duration"
 "Stop task if it runs longer than:"
 Select "4 minutes" as the time.
 Accept the settings with "OK".
 Siemens AG 2019 All rights reserved

12. Switch to the "Conditions" screen. You may need to reopen the task to do this.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 20
2 Engineering

No. Action
13.  Under "Power", select the option "Wake the computer to run this task".
 Finish the settings of the properties of the scheduled task by clicking "OK".
 Siemens AG 2019 All rights reserved

14. Due to the security option "Run whether user is logged on or not" in step 9, you
must enter the user account information assigned to perform this task and
confirm with "OK".

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 21
2 Engineering

No. Action
15. You can check this function in the "Task Scheduler Library" view.
The created tasks are listed here.
Select the task "UploadServiceData" and press the action "Run" under "Selected
Item".

The console application "UploadServiceData.exe" is now called every 5 minutes


and loads via the network card "0" (1st argument) from the CPU, which is identified
via the IP (2nd argument), with the IP address "192.168.0.1".
 Siemens AG 2019 All rights reserved

(3rd argument) and stores it in the directory "c:\MyServiceData" (4th argument).


The password for full access to the CPU is "full" (5th argument).

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 22
2 Engineering

2.4 Operation
2.4.1 Manual Upload of the service data

Proceed as follows to check the function of the console application


"UploadServiceData.exe":
Table 2-7
No. Action
1. Unpack the file "109760829_SAT_UploadServiceData_SatVxxx_EXE_Vxx.zip "
on your computer. (see Table 1-2).
2. Copy the included console application "UploadServiceData.exe" into the
installation folder of the SIMATIC Automation Tool V3.1 SP2. (Default:
"c:\Program Files\Siemens\Automation\SimaticAutomationTool\bin\").
Administrator rights may be required for this.
The folder contains the following files:
 SIMATICAutomationToolAPI.dll
 DeviceManagerClient.dll
 hmitr.dm.client.proxy.dll
 hmitr.dm.client.stub.exe
 hmitr.ipc.dll
3. Execute the file "UploadServiceData.exe" by double-clicking it.
 The console application lists the available network cards and displays the
 Siemens AG 2019 All rights reserved

error message "WRONG NUMBER OF ARGUMENTS !!!", since the


application requires the transfer of 4 or 5 arguments.
 Remember the number of the network card to be browsed.

4. Open the Command Prompt and navigate to the "UploadServiceData.exe"


console application folder:
cd c:\Program Files\Siemens\Automation\SimaticAutomationTool\bin\

5. Call the console application with the required arguments (see Table 2-1):
UploadServiceData.exe 0 IP 192.168.0.1 c:\MyServiceData full

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 23
2 Engineering

No. Action
6. The "UploadServiceData.exe" console application runs as follows:
 List of found network cards
 Output of the number of arguments:
arguments = 5
 Scan the selected network card: scan network card 0
 Search the selected IP address:
search IP address 192.168.0.1
 Check whether it is a CPU:
check if device is CPU
 Upload the service data to the specified destination folder:
upload service data to destination c:\MyServiceData
 Confirmation of successful processing
Succeeded !!!
 Siemens AG 2019 All rights reserved

7. Open the destination folder and check the existence of the uploaded service
data.

Note If you receive an error message, please check the accessibility of the CPU - for
example via the ping command in the command prompt - and check the settings
of the network card. (Section 2.3.1).

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 24
2 Engineering

2.4.2 Automatic upload of the Service data

The automatic upload is demonstrated via the Windows Task Scheduler. (see
section 2.3.5). Here the file "UploadServiceData.exe" is executed every 5 minutes
and loads the service data of the CPU (identified by the IP address) and stores it
on the PG in the folder "C:\MyServiceData". The file "UploadServiceData.exe"
accesses the API of the SIMATIC Automation Tools V3.1 SP2.

Table 2-8
No. Action
1. Open the Windows Task Scheduler program by searching for it using the
Windows icon.
 Siemens AG 2019 All rights reserved

2. The "UploadServiceData" task created in section 2.3.5 is listed in the "Task


Planning Library" under "Task Planning (Local)".
 If this task is deactivated (see column "Status"), select the task and activate
it via "Actions > Selected element".

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 25
2 Engineering

No. Action
3. When the status indicates "Ready", the task is performed every 5 minutes.
The security option "Run independently of user logon" (Table 2-6 step 9)
executes the task in the background without a console window appearing.

4.  Open the destination folder "C:\MyServiceData".


Every 5 minutes, the loaded service data is stored here in packed form under the
assigned station name and the MAC address of the CPU.
Newly saved files are counted up with name extension.
No data will be overwritten.
 Siemens AG 2019 All rights reserved

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 26
2 Engineering

No. Action
5.  Open one of the packed service data containers.
 Open the file "ASLog.txt".

6. This file contains the diagnostic buffer entries of the CPU.


Note: he description "Session authentication successful SessionID ..." indicates
the access of the SIMATIC Automation Tool to the CPU.
 Siemens AG 2019 All rights reserved

Note: The size of the diagnostic buffer varies depending on the controller used.

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 27
2 Engineering

2.5 Error handling


 If the application "UploadServiceData.exe" does not start and the error
message "UploadServiceData has stopped working" appears, this indicates the
missing installation of the compatible version of the SIMATIC Automation Tool.

In this case, please check whether you have installed the version of the
 Siemens AG 2019 All rights reserved

SIMATIC Automation Tool mentioned in Table 1-1.

 If the license for the SIMATIC Automation Tool is missing, the application
"UploadServiceData.exe" returns the "ErrorCode = NoSATLicensePresent":

Further information on "API software license and version compatibility" can be


found in the SIMATIC Automation Tool V3.1 SP2 User Manual (\4\).

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 28
2 Engineering

 If the destination folder for saving the service data does not exist or is written
incorrectly, the application "UploadServiceData.exe" returns the "ErrorCode =
InvalidFileName":

 If the service PC and the CPU are not in the same subnet, the application
"UploadServiceData.exe" returns the "ErrorCode = UnsupportedDevice":
 Siemens AG 2019 All rights reserved

Check the accessibility of the CPU e.g. via the ping command (see also
section 2.3.1).

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 29
3 Useful information

3 Useful information
3.1 Basics
The following procedure describes how to create a console application in Microsoft
Visual Studio 2015 Update 3 with access to the SIMATIC Automation Tool API:
Table 3-1
No. Action
1. Start Visual Studio and create a new project via "File > New".

2.  Select the programming language "Visual C#".


 Select the ".NET Framework 4.6.2" (\8\)
 Select "Console Application" as the template.
 Enter the project name.
 Adjust the storage location for your project.
 Confirm the entries with "OK".
 Siemens AG 2019 All rights reserved

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 30
3 Useful information

No. Action
3. The created C# project will then open.
 Open the "References" in the " Project Folders Explorer".
 Right-click to select "Add reference...".

4. The Reference Manager opens.


 Click "Browse".
 Siemens AG 2019 All rights reserved

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 31
3 Useful information

No. Action
5.  Navigate to the installation folder of the SIMATIC Automation Tool (Default:
c:\Program Files\Siemens\Automation\SimaticAutomationTool\bin\).
 Select the file "SIMATICAutomationToolAPI.dll" and add it.
 Siemens AG 2019 All rights reserved

6.  Confirm the referencing with "OK".

7. The reference is then listed in the " Project Folders Explorer ".

8.  Open the "Configuration Manager".

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 32
3 Useful information

No. Action
9.  Create a new platform.

10.  Select "x64" as platform.

11.  Close the "Configuration Manager".


 Siemens AG 2019 All rights reserved

12.  Now copy the files marked in the image from the installation folder of the
SIMATIC Automation Tool (Default: C:\Program
Files\Siemens\Automation\SimaticAutomationTool\bin\) in the folder
"…\bin\x64\Debug" of your Visual Studio project (here
C:\Users\siemens\Documents\Visual Studio
2015\Projects\UploadServiceData\UploadServiceData\bin\x64\Debug):

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 33
3 Useful information

No. Action
13.  Open the properties of your Visual Studio project.

14. 
 Siemens AG 2019 All rights reserved

Enter the arguments to be passed in the submenu "Debug" under "Start


options". (see Table 2-1):
0 IP 192.168.0.1 c:\MyServiceData full

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 34
3 Useful information

No. Action
15.  In the source file, insert the following statement as a reference to the API
namespace:
using Siemens.Automation.AutomationTool.API;
 After you have created the program code, press "Start" to test your program.

Note: The program code for the application "UploadServiceData.exe" can be


found in the packed file
"109760829_SAT_UploadServiceData_SatV312_EXE_V10.zip" as text file
"C#SourceCode.txt ". (Table 1-2).
16.  After you have finished creating the program, change from "Debug" to
"Release".
 Siemens AG 2019 All rights reserved

17.  Select "Create Project Folder" under "Create" to create the executable file.

18.  The executable file can be found in the folder "...\bin\x64\Release" of your
Visual Studio project. (here C:\Users\siemens\Documents\Visual Studio
2015\Projects\UploadServiceData\UploadServiceData\bin\x64\Release):

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 35
3 Useful information

3.2 Details on functionality


The following figure shows the flowchart of the "UploadServiceData.exe"
application:
Figure 3-1

Start/Stop

Requesting the List of network


network cards cards

WRONG No
NUMBER OF Arguments Number of
ARGUMENTS arguments
!!! = 4 || 5

Yes

Search entire card network


(1st argument)
 Siemens AG 2019 All rights reserved

IP MAC
2nd argument

Searching the Searching the


device by IP device by MAC
address address
(3rd argument) (3rd argument)

Check whether the found


device is CPU

4 5
Arguments
?

Password = 5.
No password
Argument

Retrieve service data and save


to folder
(4th argument)

Start/Stop

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 36
3 Useful information

3.3 Alternative solutions


To automatically upload service data from multiple controllers, you must create a
separate task schedule for each CPU with identification selection via IP or MAC
and assigned access password. However, if the password for the selected
controllers is identical or has not been set, you can modify the C# program code for
the "UploadServiceData.exe" application to retrieve and store the service data from
all controllers found on the network (S7-1200, S7-1500, and ET 200SP CPU). (\4\):
Iterating items in the collection
 Siemens AG 2019 All rights reserved

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 37
4 Appendix

4 Appendix
4.1 Service and support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire
service and support know-how and portfolio.
The Industry Online Support is the central address for information about our
products, solutions and services.
Product information, manuals, downloads, FAQs, application examples and videos
– all information is accessible with just a few mouse clicks:
https://support.industry.siemens.com/

Technical Support
The Technical Support of Siemens Industry provides you fast and competent
support regarding all technical queries with numerous tailor-made offers
– ranging from basic support to individual support contracts. Please send queries
to Technical Support via Web form:
https://www.siemens.com/industry/supportrequest
 Siemens AG 2019 All rights reserved

SITRAIN – Training for Industry


We support you with our globally available training courses for industry with
practical experience, innovative learning methods and a concept that’s tailored to
the customer’s specific needs.
For more information on our offered trainings and courses, as well as their
locations and dates, refer to our web page:
https://www.siemens.com/sitrain

Service offer
Our range of services includes the following:
 Plant data services
 Spare parts services
 Repair services
 On-site and maintenance services
 Retrofitting and modernization services
 Service programs and contracts
You can find detailed information on our range of services in the service catalog
web page:
https://support.industry.siemens.com/cs/sc

Industry Online Support app


You will receive optimum support wherever you are with the "Siemens Industry
Online Support" app. The app is available for Apple iOS, Android and Windows
Phone:
https://support.industry.siemens.com/cs/ww/en/sc/2067

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 38
4 Appendix

4.2 Links and Literature


Table 4-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to the article page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109760829
\3\ Download: SIMATIC Automation Tool - the commissioning and service operation
tool for SIMATIC modules
https://support.industry.siemens.com/cs/ww/en/view/98161300
\4\ Manual: SIMATIC Automation Tool V3.1 SP2 User Guide
https://support.industry.siemens.com/cs/ww/en/view/109762267
\5\ FAQ: How do you save the service data from the CPU in a file in STEP 7 (TIA
Portal) and via the web server?
https://support.industry.siemens.com/cs/ww/en/view/109750782
\6\ Application example: Process Data Acquisition and Monitoring with the SIMATIC
S7-1200 (Data Logging)
https://support.industry.siemens.com/cs/ww/en/view/64396156
\7\ Video "Mister Automation Ep9: Tips & Tricks - SIMATIC Automation Tool (SAT)"
 Siemens AG 2019 All rights reserved

https://www.youtube.com/watch?v=wIRQZl9UOEQ
\8\ Download "Microsoft .NET Framework 4.6.2 Developer Pack"
https://www.microsoft.com/en-us/download/details.aspx?id=53321

4.3 Change documentation


Table 4-2
Version Date Change
V1.0 01/2019 First version

Automatic uploading of service data with SAT via API


Entry ID: 109760829, V1.0, 01/2019 39

You might also like