Working with Historical Data

Historical Data can be analysed with the Analytics Workbench or the Analytics Service Tool. To see your recorded data, you need the TwinCAT Target Browser.

Selection of data from the TwinCAT Target Browser

The historical data can be pulled directly from the Target Browser to an input of an analysis algorithm.

1. First, you need to click TcAnalytics in the left corner of Target Browser. There you can see your configured broker, which lists live and historical data from your various devices. This should look like the following figure.
Working with Historical Data 1:
2. Go to the historical stream you created and select the recording to be analyzed. All your records are listed in the Record window on the right. The last recording is selected by default.
Working with Historical Data 2:
3. When you record live, the time range of the recording is updated every few seconds. The entire time range of a recording is used by default. You can also edit the start and end time to analyze your desired data area. This can be done with a slider, text fields or in a graphical calendar view. If you click on the symbol to the right of the text fields, the calendar view will be displayed.
Working with Historical Data 3:
4. After these steps, you can drag and drop a symbol to an input of an algorithm just as you do with the symbols of the live data.
Working with Historical Data 4:
A new input source for your historical stream is then generated and can be displayed in the Solution Explorer of your Visual Studio®. First, the dragged symbol and a timestamp of the current device time are listed under this stream. Also new drawn symbols of this stream are listed there.

Analyse your historical data in the Analytics Configurator

To analyse your historical data press on the Start Analytics button. In contrast to analysing live data, a green progress bar appears. The speed of your analysis depends on your record length, the amount and size of your symbols as well as on your broadband speed to the broker. The analysis stops automatically when the progress bar ends. The results will remain visible.

Working with Historical Data 5:

Analysis of your historical data in your Analytics Runtime

You can provide the configuration with your historical data to an Analytics Runtime (PLC). In addition to the historical data, the live data is also analyzed. This allows you to switch between them and not lose live data by streaming historical data. The reason for this is that they are separated into two different tasks. The start of the analysis of historical data must be triggered.

Working with Historical Data 6:

Computing time for historical data

Unlike the Analytics Configurator, the analysis of historical data in the PLC takes a similar amount of time as the original recording of the data. Depending on the packet size and the set sampling rate, the processing of the data can be shortened compared to the recording. However, cycle overruns due to excessively large packets must be taken into account.


Main differences of the folder structure in the created PLC project:

Working with Historical Data 7:

Notice

Implementation of the logic in your TwinCAT HMI

The preparation and writing of values in your PLC are for testing purposes. It is recommended to implement this and other logic in the PLC code with interactions from your TwinCAT HMI application if required.

You can start historical data analysis by triggering bGetHistoricalData in stCtrl_T1. The cancellation takes place by triggering bCancelHistoricalData.
This can be done in the MAIN_Analytics_Historical file as shown in the following figure:

Working with Historical Data 8:

To switch between live and historical data results for your HMI dashboard, you can set the bHistorical symbol in the AnalyticsHMI GVL. With this option, you do not need any additional controls to display historical data (of course, you can also use your own controls for historical data). The analysis of the live data is not interrupted by calling up some historical data. After viewing the historical data, you can switch back to the current live results. This change only affects the variables in your GVL.

Working with Historical Data 9: