Data conversion flowchart
As you can see in the figure above, we will load the raw CSV file into Machbase's log table and convert it into a tag table.
Tag table creation and tag meta loading
Create TAG table as shown below and load the tag names (tag meta) stored in the CSV file at once using a tool called tagmetaimport.
As shown above, 18 tag meta information were loaded successfully.
Create table for PLC data loading
Execute the following query to create the log table.
Note that this table is a log type of table (do not get confused by file names). In Machbase, if you do not specify a separate table type, the default type of table is log.
Loading PLC data
Input the plc_tag.csv file, which contains 2 million original PLC data, using the machloader as PLC input in the log table plc_tag_table created above.
In the plc_tag.csv file, the first column is time, then V0, V1, ... Columns are divided up to C15.
Tag meta name generation rules
Now you must re-insert data in log table into the tag table in order to see the data through the Tag Analyzer.
For this, the insert-select statement will duplicate each record in the log table into the TAG table.
The name of each tag is determined as follows.
Column name of log table
Tag name values of tag table
Loading Tag table data
It's time to load the actual data into the tag table.
The following query will generate TAG data based on TAG names.
A total of 36 millions of records are created.