The Historical Logging System from Wonderware® InTouch ™ has changed with Version 5.1 and has been enhanced. This Tech Note explains how the new historical logging works and this system can be optimized to achieve a good overall performance.
There are now two files, instead of one, for the improved historical logger of Wonderware InTouch 5.1. The first file is similar to the .LOG file, which is a binary file that contains the historically written data (but this file is now extended to .LGH). The second file is the new index file (.IDX) which has the same name as the .LGH file. As an aid to understanding the new historical logging, simply think of a filing cabinet that contains many drawers filled with file folders where the files are stored. (See also the figure below). The .LGH file is the filing cabinet. The .IDX file is a kind of tabular notebook that points to the cabinet and works as a table of contents for this cabinet. The drawers in the filing cabinet have labels with a time stamp and the notebook (.IDX) contains entries that point to these drawers with their respective time stamps.
Wonderware InTouch 5.1 History Logging System
In the previous versions of Wonderware InTouch, finding the data in the .LOG file was as follows: the search was started in the first drawer and then each file folder was searched, followed by the next drawer until the required data was found. When further data was needed, the logging system had to go back to the first drawer and the search then began again in the entire file cabinet! This can be very time-consuming, especially if the file cabinet contains many drawers, which must be searched.
From Wonderware InTouch 5.1, finding the data looks as follows: if the system needs data with a special time stamp from the .LGH file, InTouch looks in the table of contents of the notebook (the .IDX file) and selects the nearest time stamp entry. Then, instead of starting with the first drawer, InTouch goes directly to this specific drawer (with the closest time stamp) and then continues to the data that is needed. If data is to be found with different timestamps, InTouch returns to the notebook and finds the drawer with the closest time stamp and starts the search in this drawer.
With the new .IDX file, retrieving or reading the historical data from the .LGH file is more efficient and faster in Wonderware InTouch 5.1. In the following section, there is an explanation for a feature named “Milestones”, which allows you to optimize the performance of historical logging.
What are Milestones?
Let us take the example with the filing cabinet and name the time stamps on the “Milestones” drawers. Milestones are entries in the .LGH file and these are always entered at a straight time interval. This means that if you set the time interval “Milestone” to three minutes, Wonderware InTouch will create a milestone in the .LGH file every three minutes. The .IDX file contains entries that point to each milestone in the .LGH file. The milestone can have the following values: 1,2,3,4,5,6,10,12,15,20,30 or 60 minutes (i.e., a value which is divisible by 60). For example, if you set the Milestone to 11 minutes, the historical logging system will select the closest value that is acceptable. (By default, the milestone value is set to five minutes).
The value of the milestone is defined by the following entry in the INTOUCH.INI file under the [InTouch] section:
Where x is the number of minutes from one to 60. Make sure that the file INTOUCH.INI is in the directory of your application.
Note: If the .IDX and .LGH files were created by Wonderware InTouch, you can not immediately change the value for the milestone. If you re-define the value for the Milestone or re-define it, this change will not take effect until the next .IDX and .LGH files are generated (usually at 12 o’clock midnight); or as long as you do not delete the current .IDX and .LGH files and restart the WindowViewer and re-create these files.
What value should you choose for the milestone?
The value you select for the milestone can effectively improve the performance of historical logging. As a rule of thumb for the optimal milestone value, set the value to the number of minutes that it would take to write 300 values of a single variable into the .LGH file. For example, if you expect the value of the variable to change every second, it would take 300 seconds or five minutes to write the 300 entries to the .LGH file. Therefore, you should set the value for the best performance milestone to five minutes. In another example, if you think the value changes every six seconds, it would take 1800 seconds or 30 minutes to write the 300 entries to the .LGH file. Consequently, a milestone of 30 minutes would be recommended.
In order to determine the optimal value of the Milestone, you may have to experiment with it, but always remember that when changing the MilestoneInterval parameter, the .IDX and .LGH files must be created again before the new milestone can take effect. So, the smaller the value for the milestone, the greater will be the .LGH file.
Note: You will notice the improvements in Wonderware InTouch 5.1 or higher in particular if you have data for a long period of time read from the .LGH file or displayed at runtime in the Trend Wizard. (e.g., data for four hours or more).
New data buffering feature
Another feature of the new historical logging of Wonderware InTouch 5.1 is data buffering. By default, this data buffer is set to five minutes. That is, when e.g. If your computer has a power outage, you will lose maximum data from the last five minutes cached in the data buffer, but the .LGH file is still in order and can be reused after voltage recovery.
The size of the data buffer is defined by the following entry in the INTOUCH.INI file under the [InTouch] section:
Where x is the number of minutes from one to 60. Make sure that the file INTOUCH.INI is in the directory of your application. The historical data is then written from the data buffer to the .LGH file according to the values for the parameters FlushInterval or MilestoneInterval (which is the least of the two values). Note that reducing the FlushInterval parameter will reduce the performance of historical logging and your system’s overall performance.
Conversion of older .LOG files by version 5.1
If you want to convert a .LOG file created with an older version of Wonderware InTouch (versions 5.0b and older), the file is automatically converted when the application is updated to version 5.1. But note that the conversion of the .LOG file can be very time-consuming! It may take up to an hour for a 32Mb file – but this is also dependent on your hardware configuration.
Wonderware Technical Support recommends that you reserve double the amount of .LOG file space on your hard drive before you begin converting to version 5.1 of your application. Wonderware Technical Support recommends the following three other steps before you begin to convert the application and the .LOG file: Backup, Backup, and Backup. You should always create a backup of your application before converting it to version 5.1 or higher, since errors can occur during each conversion (for example, hardware problems), power failures, and other unpredictable situations.
The new Historical Logging System from Wonderware InTouch 5.1 has remarkably improved the performance, mainly thanks to the new format of the .LGH file in connection with the new index file .IDX. The new historical logging system also has the Milestone feature, which allows you to optimize the performance individually (for each application). However, it is important that you know how often your application data is written to the .LGH file in order to set the MilestoneInterval optimally. With the new Historical Logging System and the Milestone feature, you have the ability to read data faster than any previous Wonderware InTouch version.