Tables
With tables, TouchWin provides two very practical objects for displaying and editing data in table form. The Common Grid and Data Grid objects are very similar. They have the following setting options:
Object
Defines the data source as the start tab for the table contents. Only consecutive registers can be displayed in a table.
Common
All Records defines the total number of rows shown, Page Records the number of rows per page. With the event buttons, which we already know from the trends, you can scroll through the table using Previous Page and Next Page.
Auto Field creates a column with automatic numbering if desired. Static Field creates a column that can be freely described as a description of the data record. For example, if we read out the registers PSW 1000 to 1002 in the memory and the fill levels for tanks 1 to 3 are stored there, we can enter the three texts Tank 1, Tank 2 and Tank 3 in the Static Field. The fill levels are then displayed one below the other.
Column
Here you can add various data columns to your data set. In our example, if we store not only the fill levels but also a product number in the memory, we can insert it here. For example, if PSW1000 and PSW 1001 contain the fill level and product number for tank 1, PSW1002 and PSW 1003 contain the information for tank 2 and PSW 1004 and PSW 1005 for tank 3, we can easily display this in a table with two data columns, fill level and product number.
There is a difference here between Common Grid and Data Grid. Common Grid allows entry in a cell, which is not possible in Data Grid. Data Grid allows the display of a column with a time stamp, this function is missing in Common Grid.
Tables for displaying values from trends
In Chapter 6, we looked at trends, in particular the historical trend. The historical trend has a pointer that can be used to navigate in the trend. The current value is stored in a register that we define in the trend configuration. We can easily display this value with a data grid table. To do this, we create a data grid that points to the register of the current value. In addition to the existing column with the value, we add a column of the data type Time. If we now move the pointer in the trend using the event button (Previous Item and Next Item), the respective value is displayed with a timestamp.
Data logging
In addition to trends, two separate functions are available in TouchWin for logging data. Trends have the option of logging values and saving them in registers in a ring buffer. This function is also available without a trend as Sample Save and Sample Export.
Sample Save
Data can be logged here in a memory area as a ring buffer. The various variables to be logged are added under Object. Under Pick, we define the logging cycle in seconds and specify whether a timestamp should also be saved under Man. Control allows logging to be activated and deactivated per bit.
Export Sample Data
The invisible Export Sample Data object is used to write the values from variables to a CSV file. The logging cycle is specified under Common; manual logging (feel pick) via trigger bit is also possible. Storage Size specifies after how many recorded values should be written to the file. The variables for logging are configured in the Sample tab. The name of the CSV file is specified in the Destination tab. In the case of a fixed name, the data is overwritten. The CSV files can be numbered consecutively dynamically. Save specifies the cache of the object. Date Time defines the format of the timestamp and various bits for controlling and status feedback of the object can be configured in Export Control.