A method for data exchange between an artillery information processing system and a bus.
By defining a data exchange protocol and using a hash table, automatic data exchange between the artillery information processing system and the bus is achieved, which solves the R&D pressure and high coupling problems caused by frequent adjustments to the communication protocol and improves the system's scalability and software reliability.
Patent Information
- Application Number
- CN202411378797.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-09-30
AI Technical Summary
The communication protocol between the artillery information processing system and the bus needs to be frequently adjusted, resulting in a cumbersome workload for developing data encoding and decoding programs, excessive coupling between the system and the bus, and poor scalability.
Define the data exchange protocol between the artillery information processing system and the bus, record the relationship between the protocol and the bus through a database, and use a hash table to realize the automatic reception and transmission of data between the system and the bus, thus shielding the hardware and software differences of heterogeneous buses.
It realizes the universalization of data exchange between the system and the bus, reduces the research and development pressure of data encoding and decoding programs, reduces system coupling, and improves software reliability.
Smart Images

Figure CN119449899B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more specifically to a data exchange method between an artillery information processing system and a bus. Background Technology
[0002] In the design and development of artillery information processing systems, a communication protocol between the system and the bus needs to be formulated based on the weapon system's operational procedures and requirements. Researchers then develop data encoding and decoding programs based on this protocol. However, with frequent changes in weapon system requirements and continuous optimization of operational procedures, the communication protocol between the system and the bus also needs to be adjusted accordingly. This results in a tedious and heavy workload for researchers in developing and debugging data encoding and decoding programs. Furthermore, when the artillery information processing system interacts with different types of buses, it needs to go through the corresponding bus interface, leading to excessive coupling between the entire system and the bus and poor scalability. Summary of the Invention
[0003] The purpose of this invention is to provide a data exchange method between an artillery information processing system and a bus, which meets the data exchange requirements between the artillery information processing system and the bus, while reducing system coupling.
[0004] To achieve the above objectives, the present invention employs the following technical solution:
[0005] A method for data exchange between an artillery information processing system and a bus includes:
[0006] Step 1: Define the data exchange protocol between the artillery information processing system and the bus; a data exchange protocol includes multiple sub-protocol frames, and each sub-protocol frame consists of multiple fields with specific meanings;
[0007] Step 2: Input the exchange protocol into the database, and construct a data exchange protocol and bus relationship table and an exchange protocol relationship table. The data exchange protocol and bus relationship table records the correspondence between the data exchange protocol and bus that has been entered into the database and the table names in the database. The exchange protocol relationship table records the specific content of all fields of different sub-protocol frames in the data exchange protocol.
[0008] Step 3: Based on the bus type, query the data exchange protocol and bus relationship table to find the data exchange protocol that is in use, and obtain the name of the exchange protocol relationship table corresponding to the data exchange protocol.
[0009] Step 4: Based on the name of the found exchange protocol relationship table, link it to the corresponding exchange protocol relationship table in the database, and allocate corresponding memory space for different message types according to the number of sub-protocol frames in the table.
[0010] Step 5: Based on the exchange protocol relationship table, first classify the different fields in the table according to the message type, and then, based on the frame identifier, put all fields belonging to the same sub-protocol frame into the memory space corresponding to the message type to form the exchange protocol data structure.
[0011] Step 6: Associate the positions of all fields in memory space of the message type "send message" of the sub-protocol frame in the exchange protocol relationship table with the frame identifier of the sub-protocol frame to construct a lookup table corresponding to the send message association relationship;
[0012] Step 7: Establish a hash table. Take the frame identifier of the sub-protocol frame with the message type of sending message as the input parameter, calculate the hash value through the hash function as its storage location in the hash table, and store the frame identifier and the position index of the frame identifier in the memory space corresponding to the corresponding message type in the storage location.
[0013] Step 8: From the exchange protocol relationship table, find the memory space location corresponding to all fields of the sub-protocol frames of the sent and received messages, then allocate corresponding storage space for each storage location in the memory space and name it with the name of the storage location.
[0014] Furthermore, when data from the bus needs to be written to the memory space of the artillery information processing system, the data receiving and processing flow is initiated:
[0015] The artillery information processing system reads data frames from the bus and obtains the frame identifier. Then, it uses the frame identifier as an input parameter and calculates the hash value using a hash function. Based on the hash value, it retrieves the position index in the memory space corresponding to the frame identifier from the hash table. Then, based on the position index, it sequentially parses the data blocks of the fields corresponding to the frame identifier from the corresponding data exchange structure and writes the parsed data into the storage space corresponding to the field in the memory space.
[0016] Furthermore, when the artillery information processing system needs to send updated data from its memory space to the bus, it enters the data transmission processing flow:
[0017] After the value of the field corresponding to the sub-protocol frame in the memory space of the artillery information processing system is updated, the updated data is read, and then the frame identifier corresponding to the storage location is found according to the lookup table corresponding to the sent message association. Then, the exchange protocol data structure corresponding to the sub-protocol frame is found in the memory space according to the frame identifier. The data content in the storage location is converted into bus format data and then sent to the bus.
[0018] Furthermore, the sub-protocol frame includes message name, message type, frame identifier, message length, sequence number, byte placeholder, data type, field name, and key name, wherein:
[0019] The message name indicates the name of the sub-protocol frame message; the message type indicates whether the frame message is received from the bus (i.e., a receive message) or sent to the bus (i.e., a send message); the frame identifier indicates the data identifier of the frame, used to distinguish different sub-protocol frames; the message length indicates how many bytes of valid data the sub-protocol frame has; the sequence number indicates the order of the fields in the sub-protocol frame; the byte placeholder indicates how many bytes the field has; the data type indicates the specific data type of the field; the field name indicates the meaning of the field; and the key name indicates the storage location of the field in memory space.
[0020] Furthermore, in the data exchange protocol and bus relationship table:
[0021] bus_name represents the name of the data exchange protocol, used to distinguish different data exchange protocols; bus_type represents the type of the bus; table_name represents the name of the exchange protocol relationship table in the database; using indicates whether the data exchange protocol is used.
[0022] Furthermore, in the exchange protocol relationship table:
[0023] `rule_id` represents the primary key of a record, used to distinguish different fields of the entered sub-protocol frame; `frame_id` is the frame identifier of the sub-protocol frame; `field_sn` indicates the order of the field in the sub-protocol frame; `field_type` indicates the data type of the field; `field_len` indicates the byte length of the field; `pack_set` is the message type, indicating whether the field belongs to a receive message or a send message; `key` indicates the location of the data in the memory space corresponding to the field.
[0024] Furthermore, in the memory space corresponding to the received or sent message, the frame identifier of the sub-protocol frame is placed at memory space location index 0, and all fields of the sub-protocol frame are arranged in order according to the field order; each field, its corresponding byte length, and its position in the memory space form a data block, thereby forming the exchange protocol data structure.
[0025] A data exchange system includes an artillery information processing system and a bus; the exchange system uses a data exchange method between the artillery information processing system and the bus to exchange data.
[0026] Compared with the prior art, the present invention has the following technical features:
[0027] This invention enables automatic reception and transmission of data, achieving universal data exchange between the system and the bus. Researchers only need to re-enter the adjusted protocol into the database, effectively reducing the development pressure of data encoding and decoding programs. Simultaneously, this method achieves data interaction between the system and the bus through a data center. Users can directly access the data center to complete data interaction with the bus, thereby shielding users from the hardware and software differences of heterogeneous buses, reducing system coupling, and improving software reliability. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the data exchange method architecture of the present invention;
[0029] Figure 2 For data exchange protocol data structures;
[0030] Figure 3 This is a schematic diagram of the storage structure for frame identifiers in a hash table. Detailed Implementation
[0031] See attached Figure 1 This invention provides a data exchange method between an artillery information processing system and a bus, comprising the following steps:
[0032] Step 1: Define the data exchange protocol between the artillery information processing system and the CAN bus. A data exchange protocol includes multiple sub-protocol frames, each of which consists of multiple fields with specific meanings, including message name, message type, frame identifier, message length, sequence number, byte placeholder, data type, field name, and key name, as shown in Table 1.
[0033] Table 1. Examples of data exchange protocols between the artillery information processing system and the CAN bus.
[0034]
[0035] Among them, "Message Name" represents the name of the protocol frame message; "Message Type" indicates that the frame message is a message received from the bus, i.e., a receive message, or a message sent to the bus, i.e., a send message; "Frame Identifier" represents the data identifier of the frame, used to distinguish different sub-protocol frames; "Message Length" indicates how many bytes of valid data the sub-protocol frame has; "Sequence Number" indicates the order of this field in the sub-protocol frame; "Byte Placeholder" indicates how many bytes the field has; "Data Type" indicates the specific data type of the field; "Field Name" indicates the meaning of the field; and "Key Name" indicates the storage location of the field in the data center, which is the memory space in the artillery information processing system that stores all data.
[0036] For example, the "Diagnosis Report" message is a received message, consisting of three fields: "Diagnosis Unit", "Diagnosis Result", and "Report Time". The "Photoelectric Mode" message is a sent message, consisting of six fields: "Message Time", "Photoelectric Mode", "Automatic Tracking", "Emit Laser", "Automatic Focusing", and "Resolution".
[0037] Step 2: Enter the data exchange protocol between the artillery information processing system and the CAN bus in Step 1 into the database, forming relationship tables as shown in Table 2 and Table 3. Table 2 is the data exchange protocol and bus relationship table, which records the correspondence between the data exchange protocol entered into the database and the bus and table names in the database; Table 3 is the exchange protocol relationship table, which records the specific content of all fields of different sub-protocol frames in the data exchange protocol.
[0038] Table 2. Relationship between Data Exchange Protocols and Buses
[0039] bus_name bus_type table_name using Exchange Protocol 1 CAN tbl_2023 1
[0040] Table 3. Exchange Protocol Relationship Table for Exchange Protocol 1 (tbl_2023)
[0041] rule_id frame_id field_sn field_type field_len pack_set key 20232526 0x08f00010 1 uint8 1 0 zddt 20232527 0x08f00010 2 uint8 1 0 zdjg 20232528 0x08f00010 3 uint8 1 0 sbsk 20232529 0x04100020 1 uint8 1 1 bwsk 20232530 0x04100020 2 uint8 1 1 gdms 20232531 0x04100020 3 uint8 1 1 zdgz 20232532 0x04100020 4 uint8 1 1 fsjg 20232533 0x04100020 5 uint8 1 1 zdtj 20232534 0x04100020 6 uint8 1 1 fbl
[0042] In Table 2, "bus_name" represents the name of the data exchange protocol. In this embodiment, for the exchange protocol in Table 1, its value is "bus protocol 1", which means the name of the data exchange protocol between the artillery information processing system and this bus, used to distinguish different data exchange protocols; "bus_type" represents the type of the bus, used to distinguish different types of buses; for example, if the value is "CAN", it means that the bus is a CAN bus; "table_name" represents the name of the exchange protocol relationship table in the database, for example, if the value is "tbl_2023", it means that the relationship table corresponding to the data exchange protocol in the database is named "tbl_2023", used to look up the relationship table of the data exchange protocol in the database; "using" indicates whether the data exchange protocol is used, its value is "1", which means that the data exchange protocol is used, and if the value is "0", it is not used.
[0043] In Table 3, "rule_id" represents the primary key of a row record, used to distinguish different fields of the entered sub-protocol frame; "frame_id" is the frame identifier of the sub-protocol frame; "field_sn" indicates the field order, which is the order of the field in the sub-protocol frame, and its value is "1", "2", etc., which means that the field is in the first and second order in the sub-protocol frame, respectively; "field_type" indicates the data type of the field; "field_len" indicates the byte length of the field, that is, how many bytes it occupies; "pack_set" is the message type, indicating whether the field belongs to a receive message or a send message, with a value of "0" indicating a receive message and a value of "1" indicating a send message; "key" indicates the location of the data of the field in the memory space.
[0044] Step 3: Based on the bus type, query the data exchange protocol and bus relationship table (i.e., Table 2) to find the data exchange protocol that is in use, and obtain the name of the exchange protocol relationship table corresponding to that data exchange protocol.
[0045] For example, based on Table 2, if communication with CAN is required, then according to the condition that bus_type equals "CAN" and using equals "1", the name of the exchange protocol relationship table corresponding to the data exchange protocol is found in the data exchange protocol and bus relationship table, which is "tbl_2023".
[0046] Step 4: Based on the name of the found exchange protocol relationship table, link it to the corresponding exchange protocol relationship table in the database, and allocate corresponding memory space for different message types according to the number of sub-protocol frames in the table.
[0047] Step 5: Based on the contents of the exchange protocol relationship table, first classify the different fields in the table into received messages and sent messages according to the message type "pack_set" being "0" or "1"; then, based on the frame identifier, put all fields belonging to the same sub-protocol frame into the memory space corresponding to "received message" or "sent message".
[0048] In the memory space corresponding to the "receive message" or "send message", the frame identifier of the sub-protocol frame is placed at memory space location index 0. All fields of the sub-protocol frame are arranged in order according to the field order. Each field, its corresponding byte length, and its position in the memory space form a data block, thus forming the exchange protocol data structure.
[0049] See Figure 2The given data structure is as follows: "type" corresponds to "field_type" in Table 3, "len" corresponds to "field_len" in Table 3, and "key" corresponds to "key" in Table 3. In this memory space, the data exchange protocol of the received message represented by frame identifier 0x08f00010 is stored at the memory space location index 0 of the received message, and the data exchange protocol of the sent message represented by frame identifier 0x04100020 is stored at the memory space location index 0 of the sent message.
[0050] Step 6: Associate the positions of all fields in memory space of the sub-protocol frame whose message type is "send message" with the frame identifier of the sub-protocol frame in the exchange protocol relationship table to construct a lookup table corresponding to the send message association relationship, as shown in Table 4. In this table, the corresponding frame identifier can be found by the position of the field in memory, i.e., the key value.
[0051] Table 4. Lookup Table for Corresponding Relationships of Sent Messages
[0052]
[0053] Step 7: Establish a hash table. Using the frame identifier of the sub-protocol frame (message type: sent message) as input parameter, calculate the hash value using a hash function. This hash value will be used as the storage location in the hash table. Then, store the frame identifier and its position index in the memory space corresponding to the message type (as determined in Step 5) in the specified storage location. Figure 3 As shown.
[0054] For example, using the received message frame identifier 0x08f00010 in the data exchange protocol in Table 3 as the input parameter, the hash function is selected as the division remainder method, i.e., H(k) = kmodp, p ≤ m, where H(k) represents the hash value obtained after hashing k, k is the input parameter, i.e., the frame identifier, mod represents the modulo operation, p is the modulus, which is usually a prime number or a large integer, and m is the length of the hash table; when different input parameters produce the same hash value, a collision occurs, which can be resolved by using the chaining method (zipper method).
[0055] Here, 0x08f00010 is used as the input parameter, i.e., the value of k, p is 13, m is 13, and the hash value is 3 after calculation by the hash function H(k). That is, the frame identifier 0x08f00010 and its corresponding data exchange protocol data structure are stored at position 3 in the hash table at position 0, which is the position index 0 in the memory space shown in step 5.
[0056] Step 8: From the exchange protocol relationship table, find the key corresponding to all fields of the sub-protocol frames of the sent and received messages, then allocate corresponding storage space for each key in memory space and name it with the key.
[0057] When data from the CAN bus needs to be written to the memory space of the artillery information processing system, the receiving data processing flow is initiated; when data updates from the memory space of the artillery information processing system need to be sent to the CAN bus, the sending data processing flow is initiated.
[0058] The data receiving and processing procedure is as follows:
[0059] The artillery information processing system reads data frames from the CAN bus and obtains the frame identifier, such as 0x08f00010. Then, using the frame identifier as an input parameter, it calculates the hash value using the hash function selected in step 7. Based on the hash value, it retrieves the position index 0 in the memory space corresponding to the frame identifier from the hash table. Then, based on this position index, it sequentially parses the data blocks of the fields corresponding to the frame identifier from the corresponding data exchange structure and writes the parsed data to the storage space corresponding to the field in the memory space. For example, the parsed data is written to the storage space corresponding to zddt, zdjg, and sbsk.
[0060] The data transmission processing procedure is as follows:
[0061] After the storage locations corresponding to the fields of the sub-protocol frames in the memory space of the artillery information processing system, namely the values of keys such as bwsk, gdms, zdgz, fsjg, zdtj, and fbl, are updated (i.e., the information of the fields changes), the updated data is read. Then, according to the lookup table corresponding to the transmission message association established in step 6, the frame identifier 0x04100020 corresponding to the key at the storage location is searched. Then, according to the frame identifier, the exchange protocol data structure corresponding to the sub-protocol frame is found in the memory space of step 5. The values of keys such as bwsk, gdms, zdgz, fsjg, zdtj, and fbl are converted into CAN bus format data and then sent to the CAN bus.
[0062] The data exchange method provided by this invention enables automatic reception and transmission of data information, achieving universality of data transmission and reception between the system and the bus. Researchers only need to re-enter the adjusted protocol into the database, effectively reducing the development pressure of data encoding and decoding programs. Simultaneously, this method achieves data interaction between the system and the bus through a data center. Users can directly access the data center to complete data interaction with the bus, thereby shielding users from the hardware and software differences of heterogeneous buses, reducing system coupling, and improving software reliability.
[0063] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A data exchange method between an artillery information processing system and a bus, characterized in that, include: Step 1: Define the data exchange protocol between the artillery information processing system and the bus; a data exchange protocol includes multiple sub-protocol frames, and each sub-protocol frame consists of multiple fields with specific meanings; Step 2: Enter the exchange protocol into the database, construct a data exchange protocol and bus relationship table and an exchange protocol relationship table. The data exchange protocol and bus relationship table records the correspondence between the data exchange protocol and bus that has been entered into the database and the table names in the database. The exchange protocol relationship table records the specific content of all fields of different sub-protocol frames in the data exchange protocol. Step 3: Based on the bus type, query the data exchange protocol and bus relationship table to find the data exchange protocol that is in use, and obtain the name of the exchange protocol relationship table corresponding to the data exchange protocol. Step 4: Based on the name of the found exchange protocol relationship table, link it to the corresponding exchange protocol relationship table in the database, and allocate corresponding memory space for different message types according to the number of sub-protocol frames in the table. Step 5: Based on the exchange protocol relationship table, first classify the different fields in the table according to the message type, and then, based on the frame identifier, put all fields belonging to the same sub-protocol frame into the memory space corresponding to the message type to form the exchange protocol data structure. Step 6: Associate the positions of all fields in memory space of the message type "send message" of the sub-protocol frame in the exchange protocol relationship table with the frame identifier of the sub-protocol frame to construct a lookup table corresponding to the send message association relationship; Step 7: Establish a hash table. Take the frame identifier of the sub-protocol frame with the message type of sending message as the input parameter, calculate the hash value through the hash function as its storage location in the hash table, and store the frame identifier and the position index of the frame identifier in the memory space corresponding to the corresponding message type in the storage location. Step 8: From the exchange protocol relationship table, find the memory space location corresponding to all fields of the sub-protocol frames of the sent and received messages, then allocate corresponding storage space for each storage location in the memory space and name it with the name of the storage location.
2. The data exchange method between the artillery information processing system and the bus according to claim 1, characterized in that, When data from the bus needs to be written to the memory space of the artillery information processing system, the data receiving and processing flow begins: The artillery information processing system reads data frames from the bus and obtains the frame identifier. Then, it uses the frame identifier as an input parameter and calculates the hash value using a hash function. Based on the hash value, it retrieves the position index in the memory space corresponding to the frame identifier from the hash table. Then, based on the position index, it sequentially parses the data blocks of the fields corresponding to the frame identifier from the corresponding data exchange structure and writes the parsed data into the storage space corresponding to the field in the memory space.
3. The data exchange method between the artillery information processing system and the bus according to claim 1, characterized in that, When the artillery information processing system needs to send updated data from its memory space to the bus, it enters the data transmission processing flow: After the value of the field corresponding to the sub-protocol frame in the memory space of the artillery information processing system is updated, the updated data is read, and then the frame identifier corresponding to the storage location is found according to the lookup table corresponding to the sent message association. Then, the exchange protocol data structure corresponding to the sub-protocol frame is found in the memory space according to the frame identifier. The data content in the storage location is converted into bus format data and then sent to the bus.
4. The data exchange method between the artillery information processing system and the bus according to claim 1, characterized in that, The sub-protocol frame includes message name, message type, frame identifier, message length, sequence number, byte placeholders, data type, field name, and key name, wherein: The message name indicates the name of the sub-protocol frame message; the message type indicates whether the frame message is received from the bus (i.e., a receive message) or sent to the bus (i.e., a send message); the frame identifier indicates the data identifier of the frame, used to distinguish different sub-protocol frames; the message length indicates how many bytes of valid data the sub-protocol frame has; the sequence number indicates the order of the fields in the sub-protocol frame; the byte placeholder indicates how many bytes the field has; the data type indicates the specific data type of the field; the field name indicates the meaning of the field; and the key name indicates the storage location of the field in memory space.
5. The data exchange method between the artillery information processing system and the bus according to claim 1, characterized in that, In the data exchange protocol and bus relationship table: bus_name represents the name of the data exchange protocol, used to distinguish different data exchange protocols; bus_type represents the type of the bus; "table_name" represents the name of the exchange protocol relationship table in the database; using indicates whether the data exchange protocol is used.
6. The data exchange method between the artillery information processing system and the bus according to claim 1, characterized in that, In the exchange protocol relationship table: `rule_id` represents the primary key of a record, used to distinguish different fields of the entered sub-protocol frame; `frame_id` is the frame identifier of the sub-protocol frame; `field_sn` indicates the order of the field in the sub-protocol frame; `field_type` indicates the data type of the field; `field_len` indicates the byte length of the field; `pack_set` is the message type, indicating whether the field belongs to a receive message or a send message; `key` indicates the location of the data in the memory space corresponding to the field.
7. The data exchange method between the artillery information processing system and the bus according to claim 1, characterized in that, In the memory space corresponding to the received or sent message, the frame identifier of the sub-protocol frame is placed at memory space location index 0. All fields of the sub-protocol frame are arranged in order of field order. Each field, its corresponding byte length, and its position in memory space form a data block, thus forming the exchange protocol data structure.
8. A data exchange system, comprising an artillery information processing system and a bus; characterized in that, The exchange system uses the data exchange method between the artillery information processing system and the bus as described in any one of claims 1-7 to exchange data.
Citation Information
Patent Citations
Multi-protocol data interaction method applied to information control system of launch vehicle
CN107154948A
A multi-protocol communication switching controller based on a user-defined switching strategy
CN109831434A