The method of Data Format Transform between heterogeneous database system
Technical field
The present invention relates to the method for Data Format Transform between heterogeneous database system, belong to field of computer technology.
Background technology
The production run Quality Monitoring Control System of steel production industry is the quality management platform based on the exploitation of PI real-time dataBase system, and it is the bridge that factory's bottom control network is connected with tension management infosystem.Analyze data and first need Data Source, PI real-time dataBase system provides the support to OPC, and this has the system of open OPC standard interface can realize data acquisition easily for those.And for there is no the special instrument system (such as IBA database) of OPC standard interface, how to realize the data sharing between heterogeneous database system, just there is the problem that data among heterogeneous databases exchanges.
Summary of the invention
Technical matters to be solved by this invention is to provide the method for Data Format Transform between a kind of heterogeneous database system, the file storing directory of IBA database is monitored with fixed cycle, data in IBA database are converted to the text formatting that PI real time data bank interface PI-BATCHFile interface can identify, be written in PI real-time data base, and the file after translates data formats is moved to output directory from working directory, realize the data sharing between heterogeneous database system.
For solving the problems of the technologies described above, the technical scheme designed by the present invention comprises the following steps:
I, set up network communication between IBA database and interface message processor (IMP) and PI real-time data base, the station number of write PI real-time data base after definition conversion;
II, interface message processor (IMP) installed derive the hardware unit that in IBA database, PDA file is required, and by the data in the PDA file needing in IBA database to gather temporally pattern collection period is set, set up data acquisition masterplate;
III, arrange in IBAdatcoordinator software and read file directory that in IBA database, PDA file is deposited and derive the file directory that text deposits, by the hardware unit that PDA file in IBAdatcoordinator software and derivation IBA database is required, read the PDA file in IBA database successively, the data that need gather change into text in a time-sequential manner according to the order of the data acquisition masterplate set up in Step II, leave in the file on interface message processor (IMP), and be A file by this file folder definition; Text file format with the collection period set in data acquisition masterplate as the time interval, apportion display image data, namely first of text acquisition time is classified as, second is classified as the value of first data acquisition target at corresponding time point, 3rd is classified as the value of second data acquisition target at corresponding time point, the like, until last data acquisition object;
The installation directory of IV, establishment IBA database file conversion function service routine, under copying files to this catalogue of establishment, the file that IBA database file conversion function service routine uses comprises:
Convertto_pibf.ini: system environments configuration file;
The executable program of Convertto_pibf.exe:IBA database file conversion function.
The executable program of InputUtil.exe: registration Convertto_pibf.exe to Windows service managerZ-HU;
V, Convertto_pibf.exe coupling system environment profile Convertto_pibf.ini, A file is monitored with the form fixed cycle of windows service, the text that PI-batchflie interface text being converted to real-time data base PI can identify, definitive document is moved to output directory, and this output directory is defined as B file;
PI-Batchflie interface interface routine, by the data of B file Chinese version file write PI real-time data base, can realize the collection of IBA database data.
The method of Data Format Transform between heterogeneous database system of the present invention, take VB.NET as developing instrument, the interface software of soft and hardware device and PI real-time data base is derived in conjunction with IBA database data, achieve the Data Format Transform between IBA server and PI real-time data base, providing a kind of optional method for gathering IBA database data, the Data Format Transform between other heterogeneous databases also being had to the meaning of reference.
Accompanying drawing explanation
What Fig. 1 illustrated is that IBA server data gathers masterplate.
Fig. 2 signal be the data layout of the text that IBA server is derived according to data acquisition masterplate.
What Fig. 3 illustrated is file transform function service routine system environments configuration file.
What Fig. 4 illustrated is the text data layout after conversion.
Embodiment
Below in conjunction with accompanying drawing embodiment, the present invention is further detailed explanation.
The specific embodiment of the present invention, for certain IBA database, illustrates that the concrete operation step of Data Format Transform between IBA database and PI real-time data base is as follows:
1, before Data Format Transform, following work completes:
Network communication between IBA database and interface message processor (IMP) and PI real-time data base is normal;
The station number of write PI real-time data base after defined conversion.(here with TAG0, TAG1, TAG2, TAG3 for example)
2, the hardware unit that in derivation IBA database, PDA file is required is installed on interface message processor (IMP), and the data acquisition masterplate set up as shown in Figure 1, wherein suppose the data of the corresponding TAG0 of channel number 1:7, the data of the corresponding TAG1 of 4:30, the data of the corresponding TAG2 of channel number 4:31, the data of the corresponding TAG3 of channel number 5:16, SIZE and MODE can be used for the sampling period (i.e. collection period) that setting data gathers, and in this embodiment, collection period is temporal mode.
3, arrange in IBAdatcoordinator software and read file directory that in IBA database, PDA file is deposited and derive the file directory that text deposits, by the hardware unit that PDA file in IBAdatcoordinator software and derivation IBA database is required, read the PDA file in IBA database successively, the data that need gather change into text in a time-sequential manner according to the order of data acquisition masterplate, leave in (this file folder definition is A file) in a file of interface message processor (IMP); Text file format is shown in Fig. 2.What wherein first row was corresponding is acquisition time, can find out that text is the data derived according to time series.What secondary series was corresponding is the data of storing in IBA database in passage 1:7, in like manner the 3rd row, the 4th row, and the 5th row are corresponding is respectively channel number 4:30 in IBA database, the data of 4:31,5:16 storage.
4, create the installation directory of IBA database file conversion function service routine, the file that this IBA database file conversion function service routine uses comprises:
ConvertTo_pibf.ini: system environments configuration file, service routine is run the parameter used and is set by this configuration file, comprise IBA database PDA convert file storing path, the storing path of the text that the PI-batchflie interface interface of the real-time data base PI of generation can identify after transforming, the work station point title of the PI corresponding with the image data that the data acquisition masterplate set up in Step II sets, service routine reads the time interval of IBA database PDA convert file;
ConvertTo_pibf.exe: service routine installation file, the i.e. executable program of IBA database file conversion function.
The executable program of InputUtil.exe: registration ConvertTo_PiBF.exe to Windows service managerZ-HU.
By above-mentioned file copy under the installation directory created, the configuration file of configuration system environments as shown in Figure 3.
5, Convertto_pibf.exe (this program is that developing instrument is worked out with VB.NET) coupling system environment profile ConvertTo_pibf.ini, A file is monitored with the form fixed cycle of windows service, the text that PI-batchflie interface text being converted to real-time data base PI can identify, moves to output directory (referred to as B) by definitive document.The text data layout that PI-batchflie interface can identify as shown in Figure 4.
The data (data layout after conversion is shown in Fig. 4) of B file Chinese version file write in PI real-time data base by PI-Batchflie interface interface routine, achieve the collection of IBA database data.