×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 850338, Entry date: 07/27/2015
(14)
Rate

How do you export and reimport WinCC Runtime data?

  • Entry
  • Associated product(s)
You want to export WinCC Runtime data to a "txt" or "csv" file, read the file into another system, restore the data from an earlier point in time or edit in Excel.
In WinCC V7.2 and higher you export/import the Runtime data via the Configuration Studio.
Detailed information about this is available in the manual at the following links:
Import and Export of Tags
Import and Export of Messages
A sample application is available as a video in Entry 74509647under "SIMATIC WinCC V7.2 - Configuration Studio" or on YouTube

Description
This entry shows how to proceed using C and VB scripts. In the example we only show the processing of "64-bit floating point numbers" (integer "Int" in the TIA portal). Simply change the programming for the data types, number of tags and tag names for your own project.

The following tags were configured in WinCC for the example:

  • TagA, TagB, TagC, TagD, TagE - floating-point number 64-bit IEEE 754 (integer "Int" in the TIA Portal)
  • Filename - text tag 8-bit font ("String" in the TIA Portal)

Please always assign the complete path to the WinCC tag "Filename", for example: "C:/Temp/FileA.csv"

You can download the sample scripts here to make things easier.

Registration required scripte_readwritefile.zip (2.2 KB)
 

No.Description
1Read data from WinCC and write it to a file (VB script)
 


Fig. 01
 

Note the following when composing the string to be written to the file:

  • Separate the values with a semicolon ';'.
  • Use the function "WriteLine" (automatically inserts the endline character).

When reading ".csv" files, "Microsoft Excel" uses the semicolon for "New Column" and endline for "New Line".

2Read file and write data to WinCC (VB script)
 


Fig. 02
 

With this script you must remember to convert the character stream into the correct data format after splitting. Here, in the example: CStr() and CDbl()

3Read data from WinCC and write it to a file (C script)
 


Fig. 03
 

Note the following when composing the string to be written to the file:

  • Separate the values with a semicolon ';'.
  • Insert the endline character '\n'.
  • Change the decimal sign from point '.' to comma ',' (German standard C works with the point as decimal symbol). If you are working with the English default settings, you do not need to do this.
4Read file and write data to WinCC (C script)
 


Fig. 04
 

Pay attention here too to the correct type conversion. sscanf(strValue, "%lf", &dVal);

5The result in this example is the following ".csv" file
Opened with "Notepad":
 


Fig. 05
 

Opened with "Excel":
 


Fig. 06
 

WinCC Runtime:
 


Fig. 07

Download for TIA portal users (V13 SP1)
You can download a library here with a sample picture for easy testing.

Registration required Import_Export_V13_SP1.zip (794.0 KB)


Fig. 08

Additional Keywords
Save WinCC Runtime, Runtime data