Professional Documents
Culture Documents
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.
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
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.
SIMATIC
Windows Task Scheduler
S7-1500
Siemens AG 2019 All rights reserved
UploadServiceData.exe
API
SIMATIC Automation Tool ET 200SP CPU
S7-1200
(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
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
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.
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
Table 2-2
No. Action
1. Open the "Network and Sharing Center" by searching for it using the Windows 10
icon.
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
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.
Table 2-4
No. Action
1. Select the control and open the "Properties..." by right-clicking.
protocol”.
Enter the IP address and control subnet mask. (Figure 2-1).
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. .
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.
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
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
No. Action
3. This will open the "Create Basic Task Wizard".
Assign a name.
Click on "Next >".
Siemens AG 2019 All rights reserved
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
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
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
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.
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".
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".
2.4 Operation
2.4.1 Manual Upload of the service data
5. Call the console application with the required arguments (see Table 2-1):
UploadServiceData.exe 0 IP 192.168.0.1 c:\MyServiceData full
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).
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
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.
No. Action
5. Open one of the packed service data containers.
Open the file "ASLog.txt".
Note: The size of the diagnostic buffer varies depending on the controller used.
In this case, please check whether you have installed the version of the
Siemens AG 2019 All rights reserved
If the license for the SIMATIC Automation Tool is missing, the application
"UploadServiceData.exe" returns the "ErrorCode = NoSATLicensePresent":
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).
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".
No. Action
3. The created C# project will then open.
Open the "References" in the " Project Folders Explorer".
Right-click to select "Add reference...".
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
7. The reference is then listed in the " Project Folders Explorer ".
No. Action
9. Create a new platform.
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):
No. Action
13. Open the properties of your Visual Studio project.
14.
Siemens AG 2019 All rights reserved
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.
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):
Start/Stop
WRONG No
NUMBER OF Arguments Number of
ARGUMENTS arguments
!!! = 4 || 5
Yes
IP MAC
2nd argument
4 5
Arguments
?
Password = 5.
No password
Argument
Start/Stop
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
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
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