CN103631983A - Method and system for simulating tactical data messages - Google Patents

Method and system for simulating tactical data messages Download PDF

Info

Publication number
CN103631983A
CN103631983A CN201310360834.9A CN201310360834A CN103631983A CN 103631983 A CN103631983 A CN 103631983A CN 201310360834 A CN201310360834 A CN 201310360834A CN 103631983 A CN103631983 A CN 103631983A
Authority
CN
China
Prior art keywords
data
item
type
judgement
yes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201310360834.9A
Other languages
Chinese (zh)
Other versions
CN103631983B (en
Inventor
毕学军
肖庆
王小振
刘娟
金丽亚
王琼
张扬
杨朝红
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Academy of Armored Forces Engineering of PLA
Original Assignee
Academy of Armored Forces Engineering of PLA
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Academy of Armored Forces Engineering of PLA filed Critical Academy of Armored Forces Engineering of PLA
Priority to CN201310360834.9A priority Critical patent/CN103631983B/en
Publication of CN103631983A publication Critical patent/CN103631983A/en
Application granted granted Critical
Publication of CN103631983B publication Critical patent/CN103631983B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Machine Translation (AREA)

Abstract

The invention provides a method and system for simulating tactical data messages. The method for simulating the tactical data messages comprises the steps that A, message structural description information and data element dictionary information are edited according to tactical data message standards, and are stored in a database; B, the inner dependency relation of the message structural description information in the database is analyzed to generate the quoting depths of inner structures of the message structural description information; C, according to the sequence of the inner structure quoting depths from large to small, the source codes of the structural definition, the encoding and decoding, the editing interface and the data element dictionary transformation of the tactical data messages are generated; D, the simulation program of the tactical data messages is obtained by utilizing the source codes of the structural definition, the encoding and decoding, the editing interface and the data element dictionary transformation of the tactical data messages in a compiling mode; E, the tactical data messages are generated by utilizing the simulation program of the tactical data messages in a simulation mode and are sent to actual equipment software. Through the method and system for simulating the tactical data messages, the simulation program of the tactical data messages can be automatically generated, and the efficiency and the automation degree of simulating and generating the tactical data messages are improved.

Description

A kind of tactics data message analogy method and system
Technical field
The present invention relates to digital simulation field, be specifically related to a kind of tactics data message analogy method and system.
Background technology
Along with the fast development of modern military Command Information System, need information category and the quantity of transmission increasing.Tactics data message is to be in the limited battlefield surroundings of communication bandwidth the information such as nearly real-time Transmission commander controls, Situation Awareness, the message format of, variable-length that represent, that have certain organized formats by modes such as plaintext, coding or ciphers.Current, tactics data message is as the carrier of battle field information, become under many services and arms combined operation condition, to implement Tactics-level and command collaborative basic support.The performance of tactics data message fighting efficiency depends on tactics data command system and the robotization of message is resolved and represent, and requires packet sending and receiving both sides reaching an agreement property on the syntax and semantics of message to understand, and objectively needs tactics data message standard to ensure.Current my army has formulated relevant tactics data message standard, for the tactics data message Interchange Format between prescribed equipment.In theory, as long as according to corresponding tactics data message standard, assemble the message data of the form that meets the requirements, and adopt the host-host protocol consistent with actual equipment can realize the simulation of tactics data message.
Therefore the general process of realizing the simulation of tactics data message is: first, according to tactics data message standard, write tactics data message organization definition and codec code; Secondly, write data element dictionary transcode and message editing interface code; Finally, compiling produces message simulator program.Common method is to complete said process by hand-coding program code at present.Hand-coding message simulator program, the low and correctness of efficiency and automaticity is difficult to guarantee.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of message simulator method and system, can realize the automatic generation of tactics data message simulator program, promotes efficiency and automaticity that simulation generates tactics data message.For realizing goal of the invention, technical scheme of the present invention is achieved in that
1, a tactics data message analogy method, the method comprises:
A, according to tactics data message standard compliation message structure descriptor and data element dictionary information, and message structure descriptor and data element dictionary information are left in database, tactics data message structure descriptor is divided into a series of data item, relation of interdependence between data item is defined as: if data item B has directly or indirectly been quoted in the definition of data item A, claim data item A to rely on data item B;
The inside dependence of message structure descriptor in B, analytical database, generate the degree of depth of quoting of message structure descriptor inner structure, it is the degree of depth of quoting of data item, its computing method are: for certain data item A, judge whether A is quoted by other data item, if the result of judgement is yes, the maximal value that the degree of depth equals the data item degree of depth of all references A of quoting of A adds 1, otherwise the degree of depth of quoting of A equals 1;
C, according to inner structure, quote degree of depth order from big to small, generate the source code of tactics data message organization definition, encoding and decoding, editing interface and data element dictionary conversion;
D, the compilation of source code of utilizing tactics data message organization definition, encoding and decoding, editing interface and data element dictionary to change obtain tactics data message simulator program;
E, utilize tactics data message simulator program simulation generate tactics data message and send to actual equipment software.
In technique scheme, described steps A specifically comprises:
A1, data item are divided into elementary item and group item, and elementary item can not be divided again, and group item is formed by other data item combinations;
A2, data element dictionary information is divided into enumeration type, character string type and value type;
A3, according to tactics data message standard compliation elementary item information, group item information, enumeration type data element dictionary information, character string type data element dictionary information and value type data element dictionary information;
A4, the elementary item information editting, group item information, enumeration type data element dictionary information, character string type data element dictionary information and value type data element dictionary information are left in database table respectively.
In technique scheme, described step B specifically comprises:
Dependence between B1, analysis tactics data message data item;
B2, judge between data item, whether there be interdepend (being that A relies on B and B relies on A), if the result of judgement be yes, report that tactics data message structure describes wrong and return, otherwise perform step B3;
B3, generate the degree of depth of quoting of tactics data message data item.
In technique scheme, described step C specifically comprises:
C1, data item is sorted according to the degree of depth order from big to small of quoting generating in step B3;
C2, according to the order sequencing in C1, from database, read each data item information, and generate the organization definition source code of each data item;
C3, generate the encoding and decoding source code of each data item;
C4, generate the editing interface source code of each data item;
C5, from database, read each data element dictionary information, and generate the source code of each data element dictionary conversion;
In technique scheme, described step C2 specifically comprises:
C2.1, according to the order sequencing in C1, from database, reading a data item is current data item;
C2.2, judge whether current data item is elementary item, if the result of judgement is yes, perform step C2.3, no person performs step C2.8;
C2.3, judge whether the data type of current data item is integer, if the result of judgement be yes, perform step C2.4, otherwise perform step C2.7;
C2.4, judge that whether the data length of current data item surpasses 32 bits, if the result of judgement be yes, performs step C2.5, otherwise performs step C2.6;
The data type of C2.5, definite statement is long long, execution step C2.9;
The data type of C2.6, definite statement is Unsigned long, execution step C2.9;
The data type of C2.7, definite statement is string, execution step C2.9;
The data type of C2.8, definite statement is strUct;
C2.9, judge whether current data item is option, if the result of judgement be yes, perform step C2.10, otherwise perform step C2.11;
C2.10, statement data type basis on increase optional packaging type;
C2.11, judge that whether currentitem is can duplicate keys, if the result of judgement is yes, performs step C2.12, otherwise performs step 2.13;
C2.12, on the data type basis of statement, increasing can repeated packing type;
The complete structure definition source code of C2.13, generated data item.
C2.14, judge whether also to exist untreated data item, if the result of judgement be yes, return to step C2.1, otherwise end.
In technique scheme, described step C3 specifically comprises:
C3.1, generated data length are no more than data encoding and the data decode function definition of 32 bit integers;
C3.2, generated data length surpass data encoding and the data decode function definition of 32 bit integers;
Data encoding and the data decode function definition of C3.3, generation character string type;
C3.4, the data encoding that generates optional type and data decode function definition;
C3.5, generate can repeat type data encoding and data decode function definition;
C3.6, according to the order sequencing in C1, from database, reading a data item is current data item;
C3.7, judge whether current data item is elementary item, if the result of judgement is yes, perform step C3.9, no person performs step C3.8;
C3.8, the data encoding that generates non-elementary item and data decode function definition;
C3.9, judge whether also to exist untreated data item, if the result of judgement be yes, return to step C3.6, otherwise end.
In technique scheme, described step C3.8 specifically comprises:
C3.8.1, the subitem for the treatment of combination item successively;
C3.8.2, judge whether subitem is elementary item, if the result of judgement is yes, perform step C3.8.3, no person performs step C3.8.12;
C3.8.3, judge whether subitem is optional, if the result of judgement is yes, perform step C3.8.4, no person performs step C3.8.5;
C3.8.4, the data encoding that generates optional type subitem and data decode function call code, execution step C3.8.13;
C3.8.5, judge whether subitem is to repeat, if the result of judgement is yes, perform step C3.8.6, no person performs step C3.8.7;
C3.8.6, the data encoding that generates optional type subitem and data decode function call code, execution step C3.8.13;
C3.8.7, judge whether the type of subitem is integer, if the result of judgement be yes, perform step C3.8.8, otherwise perform step C3.8.11;
C3.8.8, judge that whether the data length of subitem surpasses 32 bits, if the result of judgement be yes, performs step C3.8.9, otherwise performs step C3.8.10;
C3.8.9, generated data length surpass data encoding and the data decode function call code of 32 bit integer subitems, execution step C3.8.13;
C3.8.10, generated data length are no more than data encoding and the data decode function call code of 32 bit integer subitems, execution step C3.8.13;
Data encoding and the data decode function call code of C3.8.11, generation character string type subitem, execution step C3.8.13;
Data encoding and the data decode function definition of C3.8.12, recursive generation combination subitem;
C3.8.13, judge whether also to exist untreated subitem, if the result of judgement be yes, return to step C3.8.1, otherwise end.
In technique scheme, described step C4 specifically comprises:
C4.1, according to the order sequencing in C1, from database, reading a data item is current data item;
C4.2, judge whether current data item is elementary item, if the result of judgement is yes, perform step C4.3, no person performs step C4.4;
The editing interface code of C4.3, generation elementary item;
The editing interface code of C4.4, recursive generation group item;
C4.5, judge whether also to exist untreated data item, if the result of judgement be yes, return to step C4.1, otherwise end.
In technique scheme, described step C4.3 specifically comprises:
C4.3.1, judge whether data element dictionary type corresponding to elementary item is value type, if the result of judgement be yes, perform step C4.3.2, otherwise perform step C4.3.3;
C4.3.2, generate the editing interface code of value type, and to limit input range be the scope of stipulating in data element dictionary information, finish;
C4.3.3, judge whether data element dictionary type corresponding to elementary item is enumeration type, if the result of judgement be yes, perform step C4.3.4, otherwise perform step C4.3.5;
The editing interface code of C4.3.4, generation enumeration type, finishes;
C4.3.5, generate the editing interface code of character string type, and to limit character string maximum length be the length of stipulating in data element dictionary information, finish;
In technique scheme, described step C5 specifically comprises:
C5.1, process each data element dictionary information successively;
C5.2, judge whether current data element dictionary information is enumeration type, if the result of judgement be yes, perform step C5.3, otherwise perform step C5.4;
C5.3, generation enumeration type data dictionary transcode, execution step C5.7;
C5.4, judge whether current data element dictionary information is value type, if the result of judgement be yes, perform step C5.5, otherwise perform step C5.6;
C5.5, generation value type data dictionary transcode, execution step C5.7;
C5.6, generation character string type data dictionary transcode, execution step C5.7;
C5.7, judge whether also to exist untreated data element dictionary information, if the result of judgement be yes, return to step C5.1, otherwise end.
Tactics data message analogy method provided by the invention and system, by tactics data message structure descriptor and data element dictionary information are left in database, dependence between the tactics data message structure descriptor inner structure in analytical database, generate the degree of depth of quoting of tactics data message structure descriptor inner structure, according to tactics data message structure descriptor inner structure, quote degree of depth order from big to small, generate tactics data message organization definition, encoding and decoding, the source code of editing interface and data element dictionary conversion, so, realized the automatic generation of tactics data message simulator program, efficiency and the automaticity of simulation generation tactics data messages have greatly been improved.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of tactics data message analogy method of the present invention;
Fig. 2 is that in the present invention, message structure is described and data element dictionary information warehouse-in schematic flow sheet;
Fig. 3 is data item analysis and quote degree of depth product process schematic diagram in the present invention;
Fig. 4 is the schematic flow sheet that in the present invention, code generates automatically;
Fig. 5 is data item organization definition code product process schematic diagram in the present invention;
Fig. 6 is coding/decoding function code product process schematic diagram in the present invention;
Fig. 7 is group item codec code product process schematic diagram in the present invention.
Fig. 8 is inediting of the present invention interface code product process schematic diagram.
Fig. 9 is elementary item editing interface code product process schematic diagram in the present invention.
Figure 10 is data element dictionary transcode product process schematic diagram in the present invention.
Embodiment
The tactics data message form of the tactics data message standard code of current my army is all variable message format.Variable message format adapts to the thought of " sending as required ", according to the needs assembling of certain transmission and transmission message, its message content has adopted the structure of variable-length, concrete length determines by the information content, adopted simultaneously option, can duplicate keys, the technology such as data element dictionary shortens message length as far as possible.The field and the Optional Field (or field groups) that are mainly reflected in necessary appearance that variable message format message length is variable.In variable message format message, whether certain field or field groups there is (being included in message), by FPI (Field Presence Indicator, there is indicator in field), FRI (Field Recurrence Indicator, field repetition indicator), GPI (Group Presence Indicator, there is indicator in group) and 4 indicators of GRI (Group Recurrence Indicator, group repeat indicator) determine.Above-mentioned 4 indicators only account for 1 bit in actual message.FPI and GPI are that the corresponding field of 1 expression and group occur in message, otherwise this field or group do not occur; FRI and GRI represent respectively whether field or group repeat, and are mainly used in identifying the data of a plurality of same types, and FRI and GRI are still identical field or field groups after 1 expression.
When variable message format message data is encoded in final physical, each field represents by binary eight hytes, and each message is encoded separately.The least significant bit (LSB) of each field is placed in eight hytes still on uncoded least significant bit (LSB), and the next least significant bit (LSB) of field is arranged in the eight hyte next ones still on uncoded least significant bit (LSB).Before all bits of encoded of field complete, if there are eight hytes to be filled, by continuing remaining bit to carry out the coding of next eight hytes, from first field and eight hytes, constantly repeat, until the coding of all fields is completed.When coding, data field can be divided into binary data field and character data field, and binary data field is represented by one or more bits, the actual physics numerical value of its this field of value representation.Character data field is comprised of the character of some 8 bits, value (00000000) for the end mark of character field 2represent.
On the other hand, variable message format message also shortens message length by data element dictionary as far as possible.Data element dictionary is for being converted to corresponding logical value by the physical values of message field (MFLD).Data element dictionary comprises three basic forms of it: enumeration type, numeric type and character string type.Data of enumeration type element dictionary is converted to enumeration type in logic by binary physical values, as: by (00) of physical values 2corresponding " reconnaissance plane ", by (01) of physical values 2corresponding " bomber ", by (10) of physical values 2corresponding " fighter plane ", by (11) of physical values 2corresponding " early warning plane ".Numeric type data element dictionary is converted to integer or floating type in logic by binary physical values, as: by (00) of physical values 2correspondence 0.01, by (01) of physical values 2correspondence 0.02, by (10) of physical values 2correspondence 0.03, by (11) of physical values 2corresponding 0.04.Numeric type data dictionary, when having stipulated the corresponding numeric type logical value of scale-of-two physical values, has in fact also been stipulated the legal range of numeric type logical value.Character string data element dictionary stipulates that the physical values of current field is character data field, has also stipulated the maximum length of character string.
For the These characteristics of tactics data message, the invention provides a kind of tactics data message analogy method, can realize the automatic generation of tactics data message simulator program, promote efficiency and automaticity that simulation generates tactics data message.Below in conjunction with drawings and the specific embodiments, the present invention will be further described in detail.
Fig. 1 is the overall procedure schematic diagram of tactics data message analogy method of the present invention, as shown in Figure 1, comprises the following steps:
Step 1, according to tactics data message standard compliation message structure descriptor and data element dictionary information, and message structure descriptor and data element dictionary information are left in database;
The inside dependence of message structure descriptor in step 2, analytical database, generates the degree of depth of quoting of message structure descriptor inner structure;
Step 3, according to inner structure, quote degree of depth order from big to small, generate the source code of tactics data message organization definition, encoding and decoding, editing interface and data element dictionary conversion;
Step 4, the compilation of source code of utilizing tactics data message organization definition, encoding and decoding, editing interface and data element dictionary to change obtain tactics data message simulator program;
Step 5, utilize tactics data message simulator program simulation generate tactics data message and send to actual equipment software.
Step 1 is concrete as Fig. 2, comprises the following steps:
Step 1.1, tactics data message structure descriptor is divided into a series of data item, data item is divided into elementary item and group item, and elementary item can not be divided again, and group item is formed by other data item combinations;
Elementary field in elementary item corresponding variable message format message, the group in group item corresponding variable message format message.
Step 1.2, data element dictionary information is divided into enumeration type, character string type and value type;
Step 1.3, according to tactics data message standard compliation elementary item information, group item information, enumeration type data element dictionary information, character string type data element dictionary information and value type data element dictionary information;
First by the information of all elementary items of interface typing, comprise the English name, Chinese, description, type, reference identification (unique), data length (bitwise) of elementary item etc.; Secondly, the subitem comprising by the mode editor's group item pulling and the specifying information of each subitem, each subitem information comprises: Chinese, name variable (producing variable name while defining for generating structure), description, elementary item reference identification, can multiplicity, optional sign etc. whether; Finally, by all data element dictionary information of interface typing, enumeration type data element dictionary information comprises: elementary item reference identification, physical values, logical value etc., character string type data element dictionary information comprises elementary item reference identification, string length etc., and value type data element dictionary information comprises: elementary item reference identification, sequence number, physics initial value, physics stop value, logic initial value, logic stop value, logical value type (integer or floating type) etc.
Step 1.4, the elementary item information editting, group item information, enumeration type data element dictionary information, character string type data element dictionary information and value type data element dictionary information are left in database table respectively.
In database, set up 5 tables of data for depositing above-mentioned information, Dataltem table is used for depositing elementary item and group item self descriptor, DataField table is used for depositing subitem information, EnumDict table is used for depositing enumeration type data element dictionary information, StringDict table is used for depositing character string type data element dictionary information, and NumDict table is used for depositing value type data element dictionary information.
Step 2 is concrete as Fig. 3, comprises the following steps:
Dependence between step 2.1, analysis tactics data message data item, wherein the relation of interdependence between tactics data message data item is defined as: if data item B has directly or indirectly been quoted in the definition of data item A, claim data item A to rely on data item B;
Dependence between data item has determined follow-up generation data item organization definition and coding/decoding function source code survey order relation.For example: suppose that certain message standard code " ageing item " is comprised of " start time group item " and " end time group item ", wherein the combination of start time group item and end time again respectively by elementary item " time ", " dividing ", " second " form." ageing item " relies on start time group item " and " end time group item "; when generating structure definition source code, should first generate the organization definition source code of " start time group item " and " end time group item ", the organization definition source code of regeneration " ageing item ":
Figure BSA0000094035070000111
Step 2.2, judge between data item, whether there be interdepend (being that A relies on B and B relies on A), if the result of judgement be yes, report that tactics data message structure describes wrong and return, otherwise perform step B3;
Step 2.3, generate the degree of depth of quoting of tactics data message data item, its computing method are: for certain data item A, judge whether A is quoted by other data item, if the result of judgement is yes, the maximal value that the degree of depth equals the data item degree of depth of all references A of quoting of A adds 1, otherwise the degree of depth of quoting of A equals 1.
After the judgement of step 2.2, can between specified data item, there is not the situation of interdepending, between data item, do not have the relation of mutually quoting.According to quoting depth computing method, if easily draw data item B reference data item A, B's quotes the degree of depth of quoting that the degree of depth is less than A.If therefore all data item are sorted from big to small according to quoting the degree of depth, before the item that can guarantee to be cited comes referenced items.
Step 3 is concrete as Fig. 4, comprises the following steps:
Step 3.1, data item is sorted according to the degree of depth order from big to small of quoting generating in step 2.3;
Step 3.2, according to the order sequencing in step 3.1, from database, read each data item information, and generate the organization definition source code of each data item;
Step 3.3, generate the encoding and decoding source code of each data item;
Step 3.4, generate the editing interface source code of each data item;
Step 3.5, from database, read each data element dictionary information, and generate the source code of each data element dictionary conversion;
Step 3.2 is concrete as Fig. 5, comprises the following steps:
Step 3.2.1, according to the order sequencing in step 3.1, from database, reading a data item is current data item;
Step 3.2.2, judge whether current data item is elementary item, if the result of judgement is yes, perform step 3.2.3, no person performs step 3.2.8;
Step 3.2.3, judge whether the data type of current data item is integer, if the result of judgement be yes, perform step 3.2.4, otherwise perform step 3.2.7;
Step 3.2.4, judge that whether the data length of current data item surpasses 32 bits, if the result of judgement be yes, performs step 3.2.5, otherwise performs step 3.2.6;
The data type of step 3.2.5, definite statement is long long, execution step 3.2.9;
The data type of step 3.2.6, definite statement is Unsigned long, execution step 3.2.9;
The data type of step 3.2.7, definite statement is string, execution step 3.2.9;
The data type of step 3.2.8, definite statement is struct;
Step 3.2.9, judge whether current data item is option, if the result of judgement be yes, perform step 3.2.10, otherwise perform step 3.2.11;
Step 3.2.10, statement data type basis on increase optional packaging type;
Optional packaging type adopts the form of following template class to define:
Figure BSA0000094035070000121
For example, for certain optional data item, its elementary item type is unsigned long, and the optional packaging type finally obtaining is: OptField < unsigned long >.
Step 3.2.11, judge that whether currentitem is can duplicate keys, if the result of judgement is yes, performs step C2.12, otherwise performs step 2.13;
Step 3.2.12, on the data type basis of statement, increasing can repeated packing type;
Can repeated packing type adopt std::vector to describe, for example, for certain data item repeatably, its elementary item type is unsigned long, and what finally obtain can repeated packing type be: std::vector < unsigned long >.
The complete structure definition source code of step 3.2.13, generated data item.
The organization definition source code of complete data item is comprised of datatype declarations and variable name.Datatype declarations determined by abovementioned steps, and the name variable field of variable name in database D ataField table determines.
Step 3.2.14, judge whether also to exist untreated data item, if the result of judgement be yes, return to step 3.2.1, otherwise end.
Step 3.3 is concrete as Fig. 6, comprises the following steps:
Step 3.3.1, generated data length are no more than data encoding and the data decode function definition of 32 bit integers;
It is as follows that data length is no more than data encoding and the data decode function interface of 32 bit integers:
int pack(unsigned char*buf,int buflen,int offset,const unsigned long&v,int bits);
Buf is data buffer address, bUflen data buffer length, and offset is coding start address, and v is data item physical values, and bits is data item length (bit number), and rreturn value is end-of-encode address.
int unpack(unsigned char*buf,int buflen,int offset unsigned long &v,int bits);
Buf is data buffer address, buflen data buffer length, and offset is decoding start address, and v is data item physical values, and bits is data item length (bit number), and rreturn value is decoding end address.
Step 3.3.2, generated data length surpass data encoding and the data decode function definition of 32 bit integers;
Data length is as follows over data encoding and the data decode function interface of 32 bit integers:
int pack(unsigned char*buf,int buflen,int offset,const long long &v,int bits);
int unpack(unsigned char*buf,int buflen,int offset long long&v,int bits);
Data encoding and the data decode function definition of step 3.3.3, generation character string type;
The data encoding of character string type and data decode function interface are as follows:
int pack(unsigned char*buf,int buflen,int offset,const std::string &v,int bits);
int unpack(unsigned char*buf,int buflen,int offset,std::string&v,int bits)
Step 3.3.4, the data encoding that generates optional type and data decode function definition;
The data encoding of optional type and data decode function interface are as follows:
template<typename T>
int pack(unsigned char*buf,int buflen,int offset,const OptField<T>&v,int bits);
template<typename T>
int unpack(unsigned char*buf,int buflen,int offset,OptField<T>&v,int bits);
Step 3.3.5, generate can repeat type data encoding and data decode function definition;
Data encoding and data decode function interface that can repeat type be as follows:
template<typename T>
int pack(unsigned char*buf,int buflen,int offset,const std::vector<T>&v,int bits);
template<typename T>
int unpack(unsigned char*buf,int buflen,int offset,std::vector<T>&v,int bits);
Step 3.3.6, according to the order sequencing in step 3.1, from database, reading a data item is current data item;
Step 3.3.7, judge whether current data item is elementary item, if the result of judgement is yes, perform step 3.3.9, no person performs step 3.3.8;
Step 3.3.8, the data encoding that generates non-elementary item and data decode function definition;
Step 3.3.9, judge whether also to exist untreated data item, if the result of judgement be yes, return to step 3.3.6, otherwise end.
Step 3.3.8 is concrete as Fig. 7, comprises the following steps:
Step 3.3.8.1, the subitem for the treatment of combination item successively;
Step 3.3.8.2, judge whether subitem is elementary item, if the result of judgement is yes, perform step 3.3.8.3, no person performs step 3.3.8.12;
Step 3.3.8.3, judge whether subitem is optional, if the result of judgement is yes, perform step 3.3.8.4, no person performs step 3.3.8.5;
Step 3.3.8.4, the data encoding that generates optional type subitem and data decode function call code, execution step 3.3.8.13;
Step 3.3.8.5, judge whether subitem is to repeat, if the result of judgement is yes, perform step 3.3.8.6, no person performs step 3.3.8.7;
Step 3.3.8.6, the data encoding that generates optional type subitem and data decode function call code, execution step 3.3.8.13;
Step 3.3.8.7, judge whether the type of subitem is integer, if the result of judgement be yes, perform step 3.3.8.8, otherwise perform step 3.3.8.11;
Step 3.3.8.8, judge that whether the data length of subitem surpasses 32 bits, if the result of judgement be yes, performs step 3.3.8.9, otherwise performs step 3.3.8.10;
Step 3.3.8.9, generated data length surpass data encoding and the data decode function call code of 32 bit integer subitems, execution step 3.3.8.13;
Step 3.3.8.10, generated data length are no more than data encoding and the data decode function call code of 32 bit integer subitems, execution step 3.3.8.13;
Data encoding and the data decode function call code of step 3.3.8.11, generation character string type subitem, execution step 3.3.8.13;
Data encoding and the data decode function definition of step 3.3.8.12, recursive generation combination subitem;
Step 3.3.8.13, judge whether also to exist untreated subitem, if the result of judgement be yes, return to step 3.3.8.1, otherwise end.
The code and decode function declaration of group item is by following two grand realizations:
#define DECLARE_PACK(TYPENAME)、
int pack(unsigned char*buf,int buflen,int offset,##TYPENAME &v,int bits);
#define DECLARE_UNPACK(TYPENAME)\
int unpack(unsigned char*buf,int buflen,int offset,##TYPENAME&v,int bits);
Its coding/decoding function defines by following four grand realizations:
Figure BSA0000094035070000161
Take aforementioned " ageing item " be example, final coding/decoding function statement and the definition code generating is as follows:
DECLARE_PACK(const G_Time)
DECLARE_UNPACK(G_Time)
BEGIN_PACK(const G_Time)
PACK_FIELD(begintime,0)
PACK_FIELD(endtime,0)
END_PACK()
BEGIN_UNPACK(G_Time)
UNPACK_FIELD(begintime,0)
UNPACK_FIELD(endtime,0)
END_UNPACK()
Step 3.4 is concrete as Fig. 8, comprises the following steps:
Step 3.4.1, according to the order sequencing in step 3.1, from database, reading a data item is current data item;
Step 3.4.2, judge whether current data item is elementary item, if the result of judgement is yes, perform step 3.4.3, no person performs step 3.4.4;
The editing interface code of step 3.4.3, generation elementary item;
The editing interface code of step 3.4.4, recursive generation group item;
Step 3.4.5, judge whether also to exist untreated data item, if the result of judgement be yes, return to step 3.4.1, otherwise end.
Step 3.4.3 is concrete as Fig. 9, comprises the following steps:
Step 3.4.3.1, judge whether data element dictionary type corresponding to elementary item is value type, if the result of judgement be yes, perform step 3.4.3.2, otherwise perform step 3.4.3.3;
Step 3.4.3.2, generate the editing interface code of value type, and to limit input range be the scope of stipulating in data element dictionary information, finish;
Step 3.4.3.3, judge whether data element dictionary type corresponding to elementary item is enumeration type, if the result of judgement be yes, perform step 3.4.3.4, otherwise perform step 3.4.3.5;
The editing interface code of step 3.4.3.4, generation enumeration type, finishes;
Step 3.4.3.5, generate the editing interface code of character string type, and to limit character string maximum length be the length of stipulating in data element dictionary information, finish;
Step 3.5 is concrete as Figure 10, comprises the following steps:
Step 3.5.1, process each data element dictionary information successively;
Step 3.5.2, judge whether current data element dictionary information is enumeration type, if the result of judgement be yes, perform step 3.5.3, otherwise perform step 3.5.4;
Step 3.5.3, generation enumeration type data dictionary transcode, execution step 3.5.7;
Step 3.5.4, judge whether current data element dictionary information is value type, if the result of judgement be yes, perform step 3.5.5, otherwise perform step 3.5.6;
Step 3.5.5, generation value type data dictionary transcode, execution step 3.5.7;
Step 3.5.6, generation character string type data dictionary transcode, execution step 3.5.7;
Step 3.5.7, judge whether also to exist untreated data element dictionary information, if the result of judgement be yes, return to step 3.5.1, otherwise end.
The form that first data dictionary transcode is character string by physical values unified representation, is then converted to logical value by character string, or logical value is converted to character string.Data dictionary transfer function interface is as follows:
bool_XX_strtoval(const std::string&str,unsigned long&val);
bool_XX_valtostr(const unsigned long&val,std::string&str)。

Claims (10)

1. a tactics data message analogy method, is characterized in that, the method comprises:
A, according to tactics data message standard compliation message structure descriptor and data element dictionary information, and message structure descriptor and data element dictionary information are left in database, tactics data message structure descriptor is divided into a series of data item, relation of interdependence between data item is defined as: if data item B has directly or indirectly been quoted in the definition of data item A, claim data item A to rely on data item B;
The inside dependence of message structure descriptor in B, analytical database, generate the degree of depth of quoting of message structure descriptor inner structure, it is the degree of depth of quoting of data item, its computing method are: for certain data item A, judge whether A is quoted by other data item, if the result of judgement is yes, the maximal value that the degree of depth equals the data item degree of depth of all references A of quoting of A adds 1, otherwise the degree of depth of quoting of A equals 1;
C, according to inner structure, quote degree of depth order from big to small, generate the source code of tactics data message organization definition, encoding and decoding, editing interface and data element dictionary conversion;
D, the compilation of source code of utilizing tactics data message organization definition, encoding and decoding, editing interface and data element dictionary to change obtain tactics data message simulator program;
E, utilize tactics data message simulator program simulation generate tactics data message and send to actual equipment software.
2. tactics data message analogy method according to claim 1, is characterized in that, described steps A comprises:
A1, data item are divided into elementary item and group item, and elementary item can not be divided again, and group item is formed by other data item combinations;
A2, data element dictionary information is divided into enumeration type, character string type and value type;
A3, according to tactics data message standard compliation elementary item information, group item information, enumeration type data element dictionary information, character string type data element dictionary information and value type data element dictionary information;
A4, the elementary item information editting, group item information, enumeration type data element dictionary information, character string type data element dictionary information and value type data element dictionary information are left in database table respectively.
3. tactics data message analogy method according to claim 1, is characterized in that, described step B comprises:
Dependence between B1, analysis tactics data message data item;
B2, judge between data item whether exist and interdepend, if the result of judgement be yes, report that tactics data message structure describes wrong and return, otherwise perform step B3;
B3, generate the degree of depth of quoting of tactics data message data item.
4. according to the tactics data message analogy method described in claim 1 or 3, it is characterized in that, described step C comprises:
C1, data item is sorted according to the degree of depth order from big to small of quoting generating in step B3;
C2, according to the order sequencing in C1, from database, read each data item information, and generate the organization definition source code of each data item;
C3, generate the encoding and decoding source code of each data item;
C4, generate the editing interface source code of each data item;
C5, from database, read each data element dictionary information, and generate the source code of each data element dictionary conversion.
5. tactics data message analogy method according to claim 4, is characterized in that, described step C2 comprises:
C2.1, according to the order sequencing in C1, from database, reading a data item is current data item;
C2.2, judge whether current data item is elementary item, if the result of judgement is yes, perform step C2.3, no person performs step C2.8;
C2.3, judge whether the data type of current data item is integer, if the result of judgement be yes, perform step C2.4, otherwise perform step C2.7;
C2.4, judge that whether the data length of current data item surpasses 32 bits, if the result of judgement be yes, performs step C2.5, otherwise performs step C2.6;
The data type of C2.5, definite statement is long long, execution step C2.9;
The data type of C2.6, definite statement is Unsigned long, execution step C2.9;
The data type of C2.7, definite statement is string, execution step C2.9;
The data type of C2.8, definite statement is strUct;
C2.9, judge whether current data item is option, if the result of judgement be yes, perform step C2.10, otherwise perform step C2.11;
C2.10, statement data type basis on increase optional packaging type;
C2.11, judge that whether currentitem is can duplicate keys, if the result of judgement is yes, performs step C2.12, otherwise performs step 2.13;
C2.12, on the data type basis of statement, increasing can repeated packing type;
The complete structure definition source code of C2.13, generated data item.
C2.14, judge whether also to exist untreated data item, if the result of judgement be yes, return to step C2.1, otherwise end.
6. tactics data message analogy method according to claim 4, is characterized in that, described step C3 comprises:
C3.1, generated data length are no more than data encoding and the data decode function definition of 32 bit integers;
C3.2, generated data length surpass data encoding and the data decode function definition of 32 bit integers;
Data encoding and the data decode function definition of C3.3, generation character string type;
C3.4, the data encoding that generates optional type and data decode function definition;
C3.5, generate can repeat type data encoding and data decode function definition;
C3.6, according to the order sequencing in C1, from database, reading a data item is current data item;
C3.7, judge whether current data item is elementary item, if the result of judgement is yes, perform step C3.9, no person performs step C3.8;
C3.8, the data encoding that generates non-elementary item and data decode function definition;
C3.9, judge whether also to exist untreated data item, if the result of judgement be yes, return to step C3.6, otherwise end.
7. tactics data message analogy method according to claim 6, is characterized in that, described step C3.8 comprises:
C3.8.1, the subitem for the treatment of combination item successively;
C3.8.2, judge whether subitem is elementary item, if the result of judgement is yes, perform step C3.8.3, no person performs step C3.8.12;
C3.8.3, judge whether subitem is optional, if the result of judgement is yes, perform step C3.8.4, no person performs step C3.8.5;
C3.8.4, the data encoding that generates optional type subitem and data decode function call code, execution step C3.8.13;
C3.8.5, judge whether subitem is to repeat, if the result of judgement is yes, perform step C3.8.6, no person performs step C3.8.7;
C3.8.6, the data encoding that generates optional type subitem and data decode function call code, execution step C3.8.13;
C3.8.7, judge whether the type of subitem is integer, if the result of judgement be yes, perform step C3.8.8, otherwise perform step C3.8.11;
C3.8.8, judge that whether the data length of subitem surpasses 32 bits, if the result of judgement be yes, performs step C3.8.9, otherwise performs step C3.8.10;
C3.8.9, generated data length surpass data encoding and the data decode function call code of 32 bit integer subitems, execution step C3.8.13;
C3.8.10, generated data length are no more than data encoding and the data decode function call code of 32 bit integer subitems, execution step C3.8.13;
Data encoding and the data decode function call code of C3.8.11, generation character string type subitem, execution step C3.8.13;
Data encoding and the data decode function definition of C3.8.12, recursive generation combination subitem;
C3.8.13, judge whether also to exist untreated subitem, if the result of judgement be yes, return to step C3.8.1, otherwise end.
8. tactics data message analogy method according to claim 4, is characterized in that, described step C4 comprises:
C4.1, according to the order sequencing in C1, from database, reading a data item is current data item;
C4.2, judge whether current data item is elementary item, if the result of judgement is yes, perform step C4.3, no person performs step C4.4;
The editing interface code of C4.3, generation elementary item;
The editing interface code of C4.4, recursive generation group item;
C4.5, judge whether also to exist untreated data item, if the result of judgement be yes, return to step C4.1, otherwise end.
9. tactics data message analogy method according to claim 8, is characterized in that, described step C4.3 comprises:
C4.3.1, judge whether data element dictionary type corresponding to elementary item is value type, if the result of judgement be yes, perform step C4.3.2, otherwise perform step C4.3.3;
C4.3.2, generate the editing interface code of value type, and to limit input range be the scope of stipulating in data element dictionary information, finish;
C4.3.3, judge whether data element dictionary type corresponding to elementary item is enumeration type, if the result of judgement be yes, perform step C4.3.4, otherwise perform step C4.3.5;
The editing interface code of C4.3.4, generation enumeration type, finishes;
C4.3.5, generate the editing interface code of character string type, and to limit character string maximum length be the length of stipulating in data element dictionary information, finish.
10. tactics data message analogy method according to claim 4, is characterized in that, described step C5 comprises:
C5.1, process each data element dictionary information successively;
C5.2, judge whether current data element dictionary information is enumeration type, if the result of judgement be yes, perform step C5.3, otherwise perform step C5.4;
C5.3, generation enumeration type data dictionary transcode, execution step C5.7;
C5.4, judge whether current data element dictionary information is value type, if the result of judgement be yes, perform step C5.5, otherwise perform step C5.6;
C5.5, generation value type data dictionary transcode, execution step C5.7;
C5.6, generation character string type data dictionary transcode, execution step C5.7;
C5.7, judge whether also to exist untreated data element dictionary information, if the result of judgement be yes, return to step C5.1, otherwise end.
CN201310360834.9A 2013-08-19 2013-08-19 A kind of tactical data message analogy method and system Expired - Fee Related CN103631983B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310360834.9A CN103631983B (en) 2013-08-19 2013-08-19 A kind of tactical data message analogy method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310360834.9A CN103631983B (en) 2013-08-19 2013-08-19 A kind of tactical data message analogy method and system

Publications (2)

Publication Number Publication Date
CN103631983A true CN103631983A (en) 2014-03-12
CN103631983B CN103631983B (en) 2016-10-05

Family

ID=50213023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310360834.9A Expired - Fee Related CN103631983B (en) 2013-08-19 2013-08-19 A kind of tactical data message analogy method and system

Country Status (1)

Country Link
CN (1) CN103631983B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317809A (en) * 2014-09-24 2015-01-28 中国人民解放军装甲兵工程学院 Data interaction converter of command information system and fight simulation system
CN107870736A (en) * 2016-09-28 2018-04-03 龙芯中科技术有限公司 Support the method and device more than 4GB nandflash
CN109889553A (en) * 2019-04-18 2019-06-14 中国电子科技集团公司第二十九研究所 A kind of structuring message self-adaptive conversion method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5487147A (en) * 1991-09-05 1996-01-23 International Business Machines Corporation Generation of error messages and error recovery for an LL(1) parser
CN101425079A (en) * 2008-11-29 2009-05-06 中兴通讯股份有限公司 NV data processing method and apparatus
CN102270223A (en) * 2011-06-22 2011-12-07 中兴通讯股份有限公司 Method and device for generating message decoding library, and message decoding method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5487147A (en) * 1991-09-05 1996-01-23 International Business Machines Corporation Generation of error messages and error recovery for an LL(1) parser
CN101425079A (en) * 2008-11-29 2009-05-06 中兴通讯股份有限公司 NV data processing method and apparatus
CN102270223A (en) * 2011-06-22 2011-12-07 中兴通讯股份有限公司 Method and device for generating message decoding library, and message decoding method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘洁 等: "战术数据报文通用描述模型设计", 《电讯技术》, vol. 51, no. 11, 30 November 2011 (2011-11-30) *
盛庆博: "报文管理与编解码技术研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 07, 15 July 2012 (2012-07-15) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317809A (en) * 2014-09-24 2015-01-28 中国人民解放军装甲兵工程学院 Data interaction converter of command information system and fight simulation system
CN107870736A (en) * 2016-09-28 2018-04-03 龙芯中科技术有限公司 Support the method and device more than 4GB nandflash
CN107870736B (en) * 2016-09-28 2021-08-10 龙芯中科技术股份有限公司 Method and device for supporting non-linear flash memory larger than 4GB
CN109889553A (en) * 2019-04-18 2019-06-14 中国电子科技集团公司第二十九研究所 A kind of structuring message self-adaptive conversion method and device
CN109889553B (en) * 2019-04-18 2021-07-13 中国电子科技集团公司第二十九研究所 Structured message self-adaptive conversion method and device

Also Published As

Publication number Publication date
CN103631983B (en) 2016-10-05

Similar Documents

Publication Publication Date Title
WO2016029801A1 (en) Encoding and decoding method, encoding device and decoding device
CN109460219B (en) Method for quickly serializing interface control file
CN106970820A (en) Code storage method and code storage
US20110219357A1 (en) Compressing source code written in a scripting language
CN105072130B (en) A kind of ASN.1 decoders code automatic generation method
CN109522008B (en) Intelligent contract construction method for block chain
CN103582883A (en) Improved encoding and decoding of variable-length data with group formats
CN106713357A (en) Universal network protocol analysis method
KR20010078015A (en) Data compression apparatus, database system, data communication system, data compression method, storage medium and program transmission apparatus
US11178212B2 (en) Compressing and transmitting structured information
CN103400173A (en) Generating method and reading method of two-dimensional code containing private information
CN101553779B (en) Migration apparatus which convert application program of mainframe system into application program of open system and method for thereof
CN106407201A (en) Data processing method and apparatus
CN108415894B (en) Report data initialization method and device, computer equipment and storage medium
KR101770292B1 (en) Computer-executable model reverse engineering method and apparatus performing the same
CN105302915B (en) The high-performance data processing system calculated based on memory
CN113778449A (en) Avionics interface data adaptation conversion system
CN112269566B (en) Script generation processing method, device, equipment and system
CN103631983A (en) Method and system for simulating tactical data messages
CN105550535A (en) Encoding method for rapidly encoding gene character sequence into binary sequence
CN103731154A (en) Data compression algorithm based on semantic analysis
CN105335156B (en) A kind of method and system of java object serialization
CN103729523A (en) Automatic verification method orienting to parameterization system
CN114065269B (en) Method for generating and analyzing bindless heterogeneous token and storage medium
CN103246671A (en) Processing method and device for abstract syntax notation files

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20161005

Termination date: 20170819