×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 25533776, Entry date: 05/13/2015
(8)
Rate

How do you export as a CSV file process values displayed in WinCC Online Trend Control?

  • Entry
  • Associated product(s)
The WinCC Online Trend Control permits you to export as a CSV file the trends shown in the Control at runtime for the time slot shown there.

There is a brief description of this function in the WinCC Information System under
"Working with WinCC > Archiving Process Values > Output of Process Values > Process Value Output in Process Pictures > Process Value Output in Trend Form in Process Pictures > Operation in Runtime > Operation of Online Trend Control in Runtime", as well as in theWinCC V6.2 manual, and in the WinCC V7 manual -Working with WinCC.
 

Online Trend Control before WinCC V7

  1. Data Export
    Enable the "Save report" function in the toolbar of the Online Trend Control. You can do this either when configuring in the configuration dialog of the Online Trend Control or at Runtime via the "Parameterize" function.
    Stop updating of the Online Trend Control to be able to run the "Save report" function.
    Now select the "Save report" function to export the data.
     

    Fig. 01
     
  2. "Name and path of the CSV file"
    The CSV file is created in the "Export > Tag Logging" sub-folder of the WinCC project folder. The file name is made up of the window title for the control and the time stamp:

    "<Caption>_<LocalTime>.csv"

    • <Caption>
      The title of the window is a property of the "WinCC Online Trend Control", which is assigned parameters in the "Properties of WinCC Online Trend Control" dialog box, in the "General" tab, in the "Window title" input field. This property can be assigned during configuration in the Graphics Designer or in runtime. The name "Caption" can be used in order to dynamize this property.

      If the property "Caption" (window title) is not assigned, it contains a blank string or if the property "Caption" contains nothing but blank spaces, the "WinCC_OnlineTrendCtrl" string is used in the file name instead of the title of the window. Whether or not the window title is to be displayed in Runtime ("Display" property for the window title) has no bearing on the file name of the export file.
    • <LocalTime>
      The file name includes the computer's local time at which the "Save report" function was executed.
       
  3. Interpretation of data in the CSV file
    The screenshot below contains an extract from the export file.

      

    Fig. 02
     

    The export file is divided into three sections. Each section starts off with a line (header) which describes the individual columns. The structure of the individual sections is described below:
     

    Section 1 - General information about the trend window
    The first section contains the general information:

    • "Trend Name"
      The "Trend Name" value contains the title of the WinCC Online Trend Control ("Caption" property). If this property is not used, the string "WinCC_OnlineTrendCtrl_" is entered here.
    • "Number of Curves"
      The "Number of Curves" value shows how many trends' values have been exported by the Online Trend Control.
      Note
      The values of trends that are hidden in the WinCC Online Trend Control display are not exported. They are not taken into consideration in the "Number of Curves" value.
    • "DateFrom"
      The "DateFrom" value contains the date and time for the commencement of the data export.
      Note
      If there are multiple trends with separate time axes displayed in the WinCC Online Trend Control, the trends may have different starting times. In this case the oldest starting time is displayed.
    • "DateTo"
      The "DateTo" value contains the date and time for the end of the data export.
      Notes
      If there are multiple trends with separate time axes displayed in the WinCC Online Trend Control, the trends may have different end times. In this case the most recent end time is displayed.
      The time details correspond to the UTC time.
       

    Section 2 - General information about the trends
    The second section contains general information about the individual trends:

    • "Pen Number"
      The "Pen Number" value contains the serial number of a trend.
    • "Pen Name"
      The "Pen Name" value contains the name of a trend. The name of a trend can be configured in the "Properties of WinCC Online Trend Controls" dialog box, in the "Trends" tab, in the "Name" input field. The "Name" property for a trend can also be generated dynamically via the property "Name".
    • "Minimum"
      "Minimum" contains the minimum value for an exported trend.
      Note
      If the displayed trends for a "WinCC Online Trend Control" are exported, then using the "Zoom" function, "Minimum" does not relate to the excerpt of the zoomed range, but rather to the excerpt of the unzoomed time range.
    • "Maximum"
      "Maximum" contains the maximum value for an exported trend.
      Note
      If the displayed trends for a "WinCC Online Trend Control" are exported, then using the "Zoom" function, "Maximum" does not relate to the excerpt of the zoomed range, but rather to the excerpt of the unzoomed time range.
       

    Section 3 - Exported trend values
    The third section contains the exported values from the trends:

    • "Pen Number"
      "Pen Number" contains the number of the trend to which the exported value relates.
    • "Date"
      The "Date" value contains the date and time for an exported value.
    • "Value"
      "Value" contains the process value which is archived.
       

    Notes

  • Section 2 contains the correlation between the trend number ("Pen Number") and trend name ("Pen Name"). In order to enable a unique interpretation of data, it makes sense to record the name of a measuring point in the trend name.
  • The exported values are sorted in ascending order on the basis of "Pen Number" and "Date". They are sorted first by "Pen Number" and then by "Date".
  • The time details correspond to the UTC time.
  • The runtime database is accessed in order to export the archived data:
    • If certain values are not displayed in the WinCC Online Trend Control because they lie outside the configured range of the Y-axis, these values are exported correctly.
    • No values are exported which are displayed through interpolation in the WinCC Online Trend Control.
       

Online Trend Control in WinCC V7

  1. Data Export
    Activate the "Export data" function in the toolbar of the Online Trend Control. You can do this either when configuring in the configuration dialog of the Online Trend Control or at Runtime via the "Parameterize" function.
    Now select the "Export data" function to export the data.
      

    Fig. 03
     
  2. "Name and path of the CSV file"
    The CSV file is created by default in the "Export > Tag Logging" directory of the WinCC project folder. The object name of the Online Trend Control is used by default as the file name. The figure below shows the "WinCC Online Trend Control Properties" dialog.
      

    Fig. 04
     

    Here, you define the presettings for the file name, target directory etc. More information on configuring this dialog is available in the WinCC Online Help under "Working with WinCC > Archiving Process Values > Output of Process Values > Process Value Output in Process Pictures > Process Value Output in Trend Form in Process Pictures > Configuring the Online Trend Control > How to export Runtime data".

    Assuming appropriate configuration, the following dialog opens when you select the "Export data" function in Runtime. You can change the preset data in this dialog if necessary.
      


    Fig. 05
     
  3. Interpretation of data in the CSV file
    The screenshot below contains an extract from the export file.
     


    Fig. 06
     

    The export file contains two columns per trend: the time and value of the archived tag. The columns are arranged in pairs.

    The first line contains the information "<Name of trend> Time" for the time column and "<Name of trend> ValueY" for the value column of each trend.

Notes on the display of the exported data in MS Excel

  • Display limitations in MS Excel (65536 rows and 256 columns)
    Versions of Microsoft Excel prior to Microsoft Office 2007 only support the display of the first 65536 rows and a maximum of 256 columns. If you attempt to open a file which exceeds this limit, an error message appears, and the remaining rows and columns are cut off.
  • Change format to display date and time
    If an exported CSV file is displayed in Microsoft Excel, certain fields may not be displayed correctly. For example, the seconds value may be missing from times. You can change the format of the relevant cells in Microsoft Excel in order to achieve the desired effect in the display.
     

Automatic Export

You can also export archived process values automatically in CSV files. Proceed as follows.

  • Configure hotkey
    Configure a hotkey for the "Save report" or "Export data" keyboard function in the dialog box "WinCC Online Trend Control Properties", "Toolbar" tab, "Key/Key Combination" or "Hotkey" input field.
  • Trigger hotkey through action
    Configure an action which transmits the configured hotkey to the "WinCC Online Trend Control" triggered by a particular event or at a particular time. This prompts the function for exporting data to be executed.
    The figure below shows a VB script that sends the function key "F8", for example, to the "WinCC Online Trend Control".
      

    Fig. 07
Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
http://www.siemens.com/industrialsecurity.