The real-time data base based on opc server in the boiler control is realized device and the data in real time update method that data in real time is upgraded
Technical field
The present invention relates to a kind of data control method.
Background technology
Real-time data base is to solve data storage and the data sharing between the upper computer software in the industrial processes.Its key property is that storage speed is fast, stresses the time consistency of data.
Since real-time data base be with data storage in internal memory, storage speed approximately is 100 times of traditional database, even higher.In commercial production, just can store slave computer so rapidly and catch the data of coming, unlikelyly cause losing of data.Each data of real-time data base all have strict time response, and this can be as accurate as the ms level, and traditional database is not accomplished.
The consistance of data is that each operation of value all has strict time restriction, and perfect process transfer is arranged in the database, guarantees the time response of data storage and visit.And the various operations in traditional data storehouse are that when to accomplish in a sense be unforeseen, when visiting data maybe since the bigger long time that needs of load of system just can return.
Be accompanied by the compression of data during real-time data base storage data, in identical storage space, can store more data.
In boiler control, slave computer is more, and sensor return data amount is big, and real-time has requirement, so can not use the traditional data storehouse.
Relate to operations such as slave computer and host computer coordination, data sharing, instruction execution in the process control, contain the intermediate data layer, promptly real-time data base is very necessary.Real-time data base is in the status of data core in industrial process control.
Now large-scale real-time data base product is more, and cost an arm and a leg (with 100,000 even 1,000,000 notes) mainly are to cooperate quick high capacity data record, unloading.And for general industrial control, such as boiler control, practical, the cheap real-time data base of function but seldom, but it has vast market.
OPC is a kind of data interaction agreement, based on the COM technology.Comprise opc server and OPC client in the OPC technology.The OPC client can be visited the data of opc server, perhaps revises data wherein.This data access has good real-time, supports a plurality of clients to visit simultaneously.In Industry Control, being widely used, is the agreement that a kind of various device manufacturer observes simultaneously.
Be divided into opc server and OPC client to OPC in the OPC technology, an opc server can connect a plurality of OPC clients, walks abreast between the OPC client, and data write to read also with data and walk abreast.Now general way is on the market, develops an opc server separately, and as an OPC client, other upper computer softwares all are a kind of clients with real-time data base, and host computer fetches data in the real-time data base will pass through double OPC interface protocol.System redundant more, the unified difficulty of sequential is also bigger.
The opc server exploitation has three kinds of methods, 1) use the rapid-result storehouse of opc server, shortcoming is a function singleness, lacks dirigibility, is difficult to upgrading, revises the relative program function.2) use relevant software development kit, shortcoming is to rely on kit, and function expansibility is not strong.3) use the COM exploitation, directly use the api function of bottom, this method is the most flexible, characteristics such as grasp COM internal technology details that can be deep enough, and all functions that can use the OPC agreement to be provided need not rely on other dynamic link libraries.COM is the abbreviation of Component Object Model, is the basis of all OLE mechanism.The present invention just is to use the opc server of COM exploitation.
Summary of the invention
The objective of the invention is problem, provide the real-time data base in a kind of boiler control to realize the device and method that data in real time is upgraded based on opc server for the real time data database data quick storage that solves the opc server in a kind of boiler control.
The real-time data base based on opc server in the boiler control is realized the device that data in real time is upgraded, and it comprises real-time data base and a plurality of slave computer of host computer, built-in opc server;
Host computer is connected through the OPC interface with the real-time data base of built-in opc server, and the real-time data base of built-in opc server is connected with a plurality of slave computers through communication bus.
Each slave computer contains read-write zone bit, CRC check position, the address bit of slave computer and the data value information of slave computer to the real-time data base data packets for transmission of built-in opc server.
Described data bus is a serial RS8 communication bus.
Described slave computer is sensor or topworks.
Described host computer is the monitoring software system.
The real-time data base based on opc server in the boiler control is realized the realization data in real time update method of the device of data in real time renewal, and it is realized according to following steps:
The real-time data base of step 1, at first built-in opc server is set up a temporary table Tmp table for each slave computer according to its mailing address, and the table name of this temporary table Tmp table is TmpXXX, wherein the mailing address of the corresponding slave computer of XXX; Include two data item in the temporary table Tmp table: [GetDataTime] and [FieldVal], the data that [FieldVal] expression slave computer is uploaded, the time that [FieldVal] obtained in [GetDataTime] expression;
The real-time data base of step 2, built-in opc server uses map table storage last data constantly, and these data comprise bit address item and data value two association that slave computer returns;
Step 3, when slave computer sends data to the real-time data base of built-in opc server, the rapid data that carries out real-time data base inserts and the opc server Data Update, its method is:
The real-time data base of step 3 one, built-in opc server receives the data that slave computer is gathered, and the data of this transmission are judged, judges whether the data of this transmission satisfy CRC check and communication bus protocol, if satisfy, then execution in step three or two; If do not satisfy, then execution in step three or three;
Real-time data base is according to the data value and the address of these data of protocol analysis in the real-time data base of step 3 two, built-in opc server, and the data value of a last moment data compares in showing with map simultaneously, and this relatively is divided into two kinds of situation:
One, if these data are digital datas, relatively whether this data value is identical with the data value that a last moment map is stored in showing, if; Then, the real-time data base of built-in opc server is not stored these data, if not; Then, deposit in the temporary table Tmp table of this slave computer;
Two, if these data are analog datas, relatively whether the set initial threshold of these data is identical, if then, real-time data base is not stored these data, if not, then, deposits in the temporary table Tmp table of this slave computer;
The real-time data base of built-in opc server upgrades the map table and turns back to step 3 one then;
The real-time data base notice slave computer of step 3 three, built-in opc server resends data, judges whether to overflow time and maximum number of times of transmission less than setting.
The data in real time update method based on opc server in the boiler control comprises seven tables: digital data table, analog data table, title-address table, temporary table, alarm logging table, system log table and unloading information record sheet in the real-time data base described in the step 3;
The data item that comprises in the digital data table has: the initial value of global address, the mode bit of whether preserving these data, zone bit and the system reset of the offset address of the digital data of gathering of the title of the slave computer of collection digital data, the first address of digital data that slave computer is gathered, slave computer, the digital data of gathering of slave computer;
The data item that comprises in the analog data table has: title, the first address of analog data that slave computer is gathered, the offset address of analog data that slave computer is gathered, the global address of analog data that slave computer is gathered, the mode bit of whether preserving this data initial value, the range of analog data that slave computer is gathered and the AD figure place of analog data that slave computer is gathered of gathering the slave computer of analog data;
The data item that title-address table comprises has: the types of variables of the first address of the title of slave computer, slave computer institute image data, the global address of slave computer institute image data, slave computer institute image data and the tag number of slave computer institute image data;
The data item that temporary table Tmp table comprises has: [GetDataTime] and [FieldVal], the two represents time and the array value that obtains data respectively, and data value is meant analog quantity and the digital quantity value that obtains through decoding;
The data item that the alarm logging table comprises has: the slave computer title of the time of warning, warning duration, warning and the zone bit of whether dealing with problems;
System log table: system's operation starting time and system accumulated running time;
Unloading information record sheet: system's unloading start time, unloading concluding time, unloading historical data library name and unloading database table name.
Title-address table in the described real-time data base is to be generated automatically by analog data table and digital data table; After generation should be shown; Variable first address to this table sorts from low to high earlier; On this basis the types of variables of this table is sorted from low to high then, form the table of data according to title, first address classification.
Real-time data base among the present invention is to adopt the unified time thread, according to the value of sequence change indexed variable.
Advantage of the present invention is:
1, we are made in opc server in the real-time data base; Saved the interface that both is separately also needed a heavy OPC agreement; Make system more succinctly promptly reduce the hardware resource of system, while opc server and database, slave computer are got in touch more tight, make data transfer more flexible.If as an OPC client, other upper computer softwares all are a kind of clients with real-time data base, host computer fetches data in the real-time data base will pass through double OPC interface protocol.System redundant more, the unified difficulty of sequential is also bigger.
2, the rapid data of the real-time data base that adopts of the present invention inserts and opc server Data Update algorithm has reduced the redundancy of program; Dwindled program's memory space, practiced thrift hardware resource, realization that can be ingenious, succinct is only stored last data updated to the assurance of data quick storage and real-time: Map table; Data volume is little; Seek rate is fast, is used for when current data is inserted, doing data relatively, the initial stage of data is compressed play an important role.The data that TMP table storage compress through the initial stage (can be compressed into 101 etc. such as digital quantity 10 00 01), the structure of TMP table very simply has only data item time and data value, makes things convenient for the rapid data insertion to operate, and reduces system delay.And, search conveniently through overall unique address (uniqueadd) name table name.Operation to the TMP table is in system's free time operation, at this moment can be in other table of database with the data conversion storage in the TMP, and perhaps further compression deposits in the historical data base (conventional hard database).
3, the design of database table make data insertion and search more succinctly, the operating process to data above cooperating can improve the database data operating efficiency.
4, the easy design configuration personnel operation of OPC label.Make and dispose configuration software by operating personnel's alignment sensor rapidly.
5, software is whole independent, does not need other Runtime Libraries, uses the COM technological development, all functions that can use the OPC agreement to be provided.
6, rational Software Architecture Design, the programming system resource occupation is little, and maintainable good, function is scalable.
Description of drawings
Fig. 1 is the structural representation of apparatus of the present invention;
Fig. 2 is that the rapid data of real-time data base inserts synoptic diagram;
Fig. 3 is the rapid data insertion of real-time data base and the method flow diagram of opc server Data Update;
Fig. 4 is that the rapid data of original real-time data base inserts the algorithm flow chart with the employing of opc server Data Update;
Fig. 5 is the structural drawing of the title-address table in the real-time data base of the present invention.
Embodiment
Embodiment one: below in conjunction with Fig. 1 this embodiment is described.
The real-time data base based on opc server in the boiler control is realized the device that data in real time is upgraded, and it comprises real-time data base 2 and a plurality of slave computer 3 of host computer 1, built-in opc server;
Host computer 1 is connected through the OPC interface with the real-time data base 2 of built-in opc server, and the real-time data base 2 of built-in opc server is connected with a plurality of slave computers 3 through communication bus.
Embodiment two: below in conjunction with Fig. 1 this embodiment is described, this embodiment is for to the further specifying of embodiment one,
The real-time data base based on opc server in the boiler control is realized the device that data in real time is upgraded, and each slave computer 3 contains read-write zone bit, CRC check position, the address bit of slave computer 3 and the data value information of slave computer 3 to real-time data base 2 data packets for transmission of built-in opc server.
Embodiment three: below in conjunction with Fig. 1 this embodiment is described, this embodiment is for to the further specifying of embodiment one,
The real-time data base based on opc server in the boiler control is realized the device that data in real time is upgraded, and described data bus 4 is serial RS485 communication bus.
Embodiment four: below in conjunction with Fig. 1 this embodiment is described, this embodiment is for to the further specifying of embodiment one,
The real-time data base based on opc server in the boiler control is realized the device that data in real time is upgraded, and described slave computer 3 is sensor or topworks.
Embodiment five: below in conjunction with Fig. 1 this embodiment is described, this embodiment is the method for application implementation mode one device,
Described host computer (1) is the monitoring software system.
Embodiment six: below in conjunction with Fig. 2, Fig. 3 and Fig. 5 this embodiment is described, this embodiment is the method for application implementation mode one device,
The real-time data base based on opc server in the boiler control is realized the realization data in real time update method of the device of data in real time renewal, it is characterized in that it is realized according to following steps:
The real-time data base 2 of step 1, at first built-in opc server is set up a temporary table Tmp table for each slave computer 3 according to its mailing address, and the table name of this temporary table Tmp table is TmpXXX, wherein the mailing address of the corresponding slave computer 3 of XXX; Include two data item in the temporary table Tmp table: [GetDataTime] and [FieldVal], the data that [FieldVal] expression slave computer is uploaded, the time that [FieldVal] obtained in [GetDataTime] expression;
The real-time data base 2 of step 2, built-in opc server uses map table storage last data constantly, and these data comprise 32 bit address items and data value two association that slave computer 3 returns;
Step 3, when slave computer 3 sends data to the real-time data base 2 of built-in opc server, the rapid data that carries out real-time data base inserts and the opc server Data Update, its method is:
The real-time data base 2 of step 3 one, built-in opc server receives the data that slave computer 3 is gathered, and the data of this transmission are judged, judges whether the data of this transmission satisfy CRC check and communication bus protocol, if satisfy, then execution in step three or two; If do not satisfy, then execution in step three or three;
Real-time data base is according to the data value and the address of these data of protocol analysis in the real-time data base 2 of step 3 two, built-in opc server, and the data value of a last moment data compares in showing with map simultaneously, and this relatively is divided into two kinds of situation:
One, if these data are digital datas, relatively whether this data value is identical with the data value that a last moment map is stored in showing, if; Then, 2 pairs of these data of the real-time data base of built-in opc server are not stored, if not; Then, deposit in the temporary table Tmp table of this slave computer 3;
Two, if these data are analog datas, relatively whether the set initial threshold of these data is identical, if then, 2 pairs of these data of real-time data base are not stored, if not, then, deposits in the temporary table Tmp table of this slave computer 3;
The real-time data base 2 of built-in opc server upgrades the map table and turns back to step 3 one then;
The real-time data base 2 notice slave computers of step 3 three, built-in opc server resend data, judge whether to overflow time and maximum number of times of transmission less than setting.
Embodiment seven: this embodiment is for to the further specifying of embodiment six,
Data in real time update method in the boiler control based on opc server; It is characterized in that, comprise seven tables in the real-time data base described in the step 3: digital data table, analog data table, title-address table, temporary table, alarm logging table, system log table and unloading information record sheet;
The data item that comprises in the digital data table has: the initial value of global address, the mode bit of whether preserving these data, zone bit and the system reset of the offset address of the digital data of gathering of the title of the slave computer 3 of collection digital data, the first address of slave computer 3 digital data of gathering, slave computer 3, the digital data of gathering of slave computer 3;
The data item that comprises in the analog data table has: title, the first address of slave computer 3 analog data of gathering, the offset address of slave computer 3 analog data of gathering, the global address of slave computer 3 analog data of gathering, the mode bit of whether preserving this data initial value, the range of slave computer 3 analog data of gathering and the AD figure place of slave computer 3 analog data of gathering of gathering the slave computer 3 of analog data;
The data item that title-address table comprises has: the types of variables of the first address of the title of slave computer 3,3 image data of slave computer, the global address of 3 image data of slave computer, 3 image data of slave computer and the tag number of 3 image data of slave computer;
The data item that temporary table Tmp table comprises has: [GetDataTime] and [FieldVal], the two represents time and the array value that obtains data respectively, and data value is meant analog quantity and the digital quantity value that obtains through decoding;
The data item that the alarm logging table comprises has: slave computer 3 titles of the time of warning, warning duration, warning and the zone bit of whether dealing with problems;
System log table: system's operation starting time and system accumulated running time;
Unloading information record sheet: system's unloading start time, unloading concluding time, unloading historical data library name and unloading database table name.
Embodiment eight: this embodiment is for to the further specifying of embodiment six,
The real-time data base based on opc server in the boiler control is realized the data in real time update method; Title-address table in the described real-time data base is to be generated automatically by analog data table and digital data table; After generation should be shown; Earlier the variable first address to this table sorts from low to high, on this basis the types of variables of this table is sorted from low to high then, forms the table of data according to title, first address classification.
Embodiment nine: this embodiment is for to the further specifying of embodiment six,
The real-time data base based on opc server in the boiler control is realized the data in real time update method, and real-time data base adopts the unified time thread, according to the value of sequence change indexed variable.
The present invention is not limited to above-mentioned embodiment, can also be the reasonable combination of technical characterictic described in above-mentioned each embodiment.