Method, apparatus, device, and medium for generating simulator network interface code

By disassembling the nested structure in the target interface definition language file and generating the simulator data interface code and docking code, the problem of cumbersome development process of DDS-based simulator networking technology and errors in human factors is solved, and the development speed and efficiency are improved.

CN119512512BActive Publication Date: 2025-06-27BEIJING BLUESKY AVIATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411127647.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2025-06-27
Estimated Expiration
2044-08-16

AI Technical Summary

Technical Problem

The DDS-based simulator networking technology has shortcomings in data definition, resulting in cumbersome development process, inefficient efficiency, and human errors.

Method used

By disassembling the nested structure in the target interface definition language file, generating the simulator data interface code and the docking code of the simulator data interface and the data distribution service data interface, the networking between the data distribution service and the simulator is realized, and manual interface definition and docking are avoided.

Benefits of technology

It improves the development speed and development efficiency of networking between data distribution services and simulators, and effectively avoids human factors errors caused by manual interface processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512512B_ABST
    Figure CN119512512B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, equipment and medium for generating simulator networking interface code. The method includes: disassembling nested structures in a target interface definition language file to obtain disassembled structure information; generating a first interface control document corresponding to a data distribution service network according to the disassembled structure information; generating a second interface control document corresponding to a simulator network according to the first interface control document and simulator network data definition rules; generating simulator networking interface code according to data distribution service data definition rules, simulator network data definition rules and the second interface control document. This method can realize networking between a data distribution service and a simulator. The whole process does not require manual interface definition and docking, improving the development speed and efficiency of networking between the data distribution service and the simulator, and effectively avoiding human factor errors caused by manual interface processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of code generation, and particularly to a method, device, equipment and medium for generating simulator networking interface code. Background Art

[0002] In the networking operation of flight simulators, distributed communication technology is usually adopted to connect multiple simulators to ensure low latency and high reliability of data transmission, thereby creating conditions for simulator flight formation training and cooperative combat simulation, and improving the realism and training effect of flight simulation. The simulator networking technology based on Data Distribution Service (DDS) uses the Real-Time Publish-Subscribe (RTPS) protocol as the communication basis to achieve communication with the simulator.

[0003] However, the simulator networking technology based on DDS has deficiencies in data definition. Among them, due to the large amount of simulator state data, it is usually necessary to manually define the same physical quantity twice in the Interface Definition Language File (IDL) file corresponding to DDS and the simulator simulation network, resulting in a cumbersome development process and low efficiency. In addition, when implementing the mapping between the DDS data interface and the simulator simulation data, it is also necessary to manually dock the data of the same physical quantity, resulting in a long time consumption and a high docking error rate.

[0004] In summary, the networking interface definition and docking of the above-mentioned simulator networking technology based on DDS require manual participation, which makes the development speed of networking between DDS and the simulator slow and the development efficiency low, and there are human factor errors caused by manual interface processing. Summary of the Invention

[0005] The present invention provides a method, device, equipment and medium for generating simulator networking interface code, which is used to solve the defect that the networking interface definition and docking of the existing simulator networking technology based on DDS require manual participation, resulting in slow development speed and low development efficiency of networking between DDS and the simulator, and there are human factor errors caused by manual interface processing. By generating simulator data interface code based on the nested structure in the target interface definition language file, and the docking code between the simulator data interface and the data distribution service data interface, the networking between the data distribution service and the simulator can be realized. The whole process does not require manual interface definition and docking, improves the development speed and development efficiency of networking between the data distribution service and the simulator, and effectively avoids human factor errors caused by manual interface processing.

[0006] The present invention provides a method for generating simulator networking interface code, including the following steps.

[0007] Decompose the nested structures in the target interface definition language file to obtain the decomposed structure information.

[0008] Generate a first interface control document corresponding to the data distribution service network according to the decomposed structure information.

[0009] Generate a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules.

[0010] Generate simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. The simulator networking interface code includes: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface.

[0011] According to the method for generating simulator networking interface code provided by the present invention, decomposing the nested structures in the target interface definition language file to obtain the decomposed structure information includes: parsing the file content in the interface definition language file to obtain a plurality of first structures and the structure definitions corresponding to the plurality of first structures respectively, each structure definition being a first key-value pair for storing relevant information of the corresponding first structure; expanding the plurality of first structures according to all relevant information to obtain nested structures; determining the target interface definition language file according to the nested structures and a preset output file; decomposing the nested structures in the target interface definition language file to obtain the decomposed structure information.

[0012] According to the method for generating simulator networking interface code provided by the present invention, the decomposed structure information includes: first publish-subscribe type parameters and first interaction flag parameters corresponding to the plurality of first structures respectively; generating a first interface control document corresponding to the data distribution service network according to the decomposed structure information includes: traversing the plurality of first structures, for the current first structure, when the first publish-subscribe type parameter corresponding to the current first structure meets the first condition, if the first interaction identification parameter corresponding to the current first structure meets the second condition, then retain the current first structure; reading the target interface definition language file to obtain the first structure names and first structure contents corresponding to all the retained first structures respectively; generating a first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameters, first interaction flag parameters, first structure names, and first structure contents corresponding to all the retained first structures respectively.

[0013] A method for generating simulator network interface code according to the present invention, the content of each first structure includes a first variable name. According to all the reserved first structure's corresponding first publish-subscribe type parameters, first interaction flag parameters, first structure name, and first structure content, a first interface control document corresponding to the data distribution service network is generated, including: generating an initial first interface control document corresponding to the data distribution service network according to all the reserved first structure's corresponding first publish-subscribe type parameters, first interaction flag parameters, first structure name, and first structure content; determining, from all the second variable names in the original data distribution service interface control file, target variable names that are different from all the first variable names in the initial first interface control document, where the target variable names include at least one second variable name; determining the second structures corresponding to at least one second variable name, and writing the corresponding second publish-subscribe type parameters, second interaction flag parameters, second structure name, and second structure content of at least one second structure into the initial first interface control document to obtain the first interface control document, and the content of each second structure includes the corresponding second variable name.

[0014] A method for generating simulator network interface code according to the present invention, the content of each first structure includes a first variable type and a first variable comment; the content of each second structure includes a second variable type and a second variable comment; according to the first interface control document and the simulator network data definition rules, a second interface control document corresponding to the simulator network is generated, including: determining, according to the simulator network data definition rules, all the first structure names, all the first variable names, all the first variable comments, all the second structure names, all the second variable names, and all the second variable comments as the target data corresponding to the simulator network; determining the second key-value pairs according to all the first variable types and all the second variable types, and the variable types of the simulator network data; performing reverse mapping on all the first publish-subscribe type parameters and all the second publish-subscribe type parameters with the publish-subscribe type parameters of the simulator network data to obtain the reverse mapping result; generating an interrupt type attribute and an interrupt request name corresponding to the simulator network data according to all the first interaction flag parameters and all the second interaction flag parameters; generating a second interface control document corresponding to the simulator network according to the target data, the second key-value pairs, the reverse mapping result, the interrupt type attribute, and the interrupt request name.

[0015] A method for generating simulator networking interface code provided by the present invention. When the simulator networking interface code includes simulator data interface code, the simulator data interface code includes: simulator status data interface definition code, simulator status data interface publish-subscribe code, and interaction data interruption registration code. The simulator networking interface code is generated according to the data distribution service data definition rules, simulator network data definition rules, and the second interface control document, including: based on the data distribution service data definition rules and simulator network data definition rules, and based on all first variable types, all second variable types, all first publish-subscribe type parameters, second publish-subscribe type parameters, all first variable names, and second variable names in the second interface control document, generating the simulator status data interface definition code; based on all first variable names, all second variable names, all first variable types, all second variable types, all first publish-subscribe type parameters, second publish-subscribe type parameters, all first variable comments, all second variable comments, and the topic name of the simulator network in the second interface control document, generating the simulator status data interface publish-subscribe code; based on all first interaction flag parameters, all second interaction flag parameters, topic name, interruption type attribute, and interruption request name in the second interface control document, generating the interaction data interruption registration code.

[0016] A method for generating simulator networking interface code provided by the present invention. When the simulator networking interface code includes docking code, the docking code includes: data distribution service status subscription data mapping code, data distribution service status publish data mapping code, and data distribution service interaction data interruption trigger code. The simulator networking interface code is generated according to the data distribution service data definition rules, simulator network data definition rules, and the second interface control document, including: based on the data distribution service data definition rules and simulator network data definition rules, and based on all first interaction flag parameters, all second interaction flag parameters, all first variable names, and all second variable names in the second interface control document, generating the data distribution service status subscription data mapping code and the data distribution service status publish data mapping code; based on all first interaction flag parameters, all second interaction flag parameters, the topic name of the simulator network, interruption type attribute, and interruption request name in the second interface control document, generating the data distribution service interaction data interruption trigger code.

[0017] The present invention also provides a simulator networking interface code generation device, including the following modules.

[0018] The structure disassembling module is used to disassemble the nested structures in the target interface definition language file to obtain the disassembled structure information.

[0019] The first generation module is used to generate the first interface control document corresponding to the data distribution service network according to the disassembled structure information.

[0020] The second generation module is used to generate the second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules.

[0021] The code generation module is used to generate the simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. The simulator networking interface code includes: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface.

[0022] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the simulator networking interface code generation method as described in any one of the above.

[0023] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the simulator networking interface code generation method as described in any one of the above.

[0024] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the simulator networking interface code generation method as described in any one of the above.

[0025] The simulator networking interface code generation method, device, equipment, and medium provided by the present invention disassemble the nested structure in the target interface definition language file to obtain the disassembled structure information; generate the first interface control document corresponding to the data distribution service network according to the disassembled structure information; generate the second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules; generate the simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. The simulator networking interface code includes: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface. The technical solution of the present invention can realize the networking between the data distribution service and the simulator by generating the simulator data interface code and the docking code between the simulator data interface and the data distribution service data interface based on the nested structure in the target interface definition language file. The whole process does not require manual interface definition and docking, improves the development speed and efficiency of the networking between the data distribution service and the simulator, and effectively avoids human factor errors caused by manual interface processing. Description of the Drawings

[0026] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0027] Figure 1 It is a schematic flowchart of the method for generating the simulator networking interface code provided by the present invention.

[0028] Figure 2 It is a schematic code diagram of the undissected interface definition language file provided by the present invention.

[0029] Figure 3 It is a schematic code diagram of the dissected target interface definition language file provided by the present invention.

[0030] Figure 4 It is a schematic diagram of the first interface control document provided by the present invention.

[0031] Figure 5 It is a schematic diagram of the second interface control document provided by the present invention.

[0032] Figure 6 It is a schematic diagram of the simulator status data interface definition code provided by the present invention.

[0033] Figure 7 It is a schematic diagram of the simulator status data interface publish-subscribe code provided by the present invention.

[0034] Figure 8 It is a schematic diagram of the interactive data interruption registration code provided by the present invention.

[0035] Figure 9 It is a schematic diagram of the data distribution service status subscription data mapping code and the data distribution service status publish data mapping code provided by the present invention.

[0036] Figure 10 It is a schematic diagram of the data distribution service interactive data interruption trigger code provided by the present invention.

[0037] Figure 11 It is a schematic structural diagram of the simulator networking interface code generation device provided by the present invention.

[0038] Figure 12 It is a schematic structural diagram of the electronic device provided by the present invention. Detailed implementation manners

[0039] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without creative efforts fall within the protection scope of the present invention.

[0040] It should be noted that the execution subject involved in the embodiments of the present invention may be a simulator networking interface code generation device or an electronic device. Optionally, the electronic device may include: a computer, a mobile terminal, a wearable device, etc.

[0041] The embodiments of the present invention will be further described below by taking an electronic device as an example.

[0042] Figure 1 is a flowchart of the simulator networking interface code generation method provided by the present invention. As Figure 1 shown, the method includes the following steps 101-step 104.

[0043] Step 101: Decompose the nested structure in the target interface definition language file to obtain the decomposed structure information.

[0044] In some embodiments, decomposing the nested structure in the target interface definition language file to obtain the decomposed structure information may include: parsing the file content in the interface definition language file to obtain multiple first structures and the structure definitions corresponding to the multiple first structures respectively. Each structure definition is a first key-value pair, and the first key-value pair is used to store the relevant information of the corresponding first structure; expanding the multiple first structures according to all the relevant information to obtain a nested structure; determining the target interface definition language file according to the nested structure and a preset output file; decomposing the nested structure in the target interface definition language file to obtain the decomposed structure information.

[0045] Among them, the interface definition language file is used for DDS to define IDL structure data for DDS network exchange. Optionally, the IDL structure data may include: three parts such as Topic theme (structure name), data type, and data variable name.

[0046] The relevant information of the first structure includes: structure name and structure fields. The structure fields include: field name and field type. It should be noted that in the first key-value pair corresponding to the first structure, the key and value in the first key-value pair are used as a dictionary respectively. The former is used to store the structure name, and the latter is used to store the structure fields.

[0047] In the process of determining the disassembled structure information, first, obtain the Interface Definition Language (IDL) file, and use the IDL file as the input file. Parse the content of the IDL file through regular expressions, that is, use the file path corresponding to the IDL file (idl_filename) as a parameter, open and read all the content in the IDL file to obtain multiple first-level structures and the structure definitions corresponding to each of the multiple first-level structures. Then, based on all the structure definitions, recursively expand the structure names corresponding to the specified multiple first-level structures according to all the stored relevant information (such as structure names and structure fields) to obtain nested structures. If the field type of a first-level structure is another first-level structure, then this nested first-level structure will also be expanded. The result of the expansion is a more detailed structure definition, where the nested fields are replaced by their specific field definitions, and a prefix is added in front of the field names to maintain uniqueness. After that, use the output file path corresponding to the preset output file (excel_filename) and the content of the expanded nested structure as parameters, and write the content of the expanded nested structure into the specified preset output file to determine the target IDL file. Finally, disassemble the nested structures in the target IDL file to obtain the disassembled structure information, eliminating the need for manual disassembly of the final structure information, improving the accuracy of the structure information and making it easier to understand.

[0048] Exemplarily, Figure 2 is a schematic code diagram of the un-disassembled IDL file provided by the present invention, as Figure 2 shown, the code represents the un-disassembled IDL file. Figure 3 is a schematic code diagram of the disassembled target IDL file provided by the present invention, as Figure 3 shown, the code represents the disassembled target IDL file.

[0049] It should be noted that the file path corresponding to the IDL file, the content of the expanded nested structure, and the file path corresponding to the preset output file can be used as the IDL input information.

[0050] In addition, when using DDS for simulator distributed network communication, it is very common and important to define nested structures in the target interface definition language file with multiple levels of nesting. Because in complex distributed systems, data structures often have different levels of complexity. By using nested structures, these complex data structures can be effectively organized and managed, and data management and access can be simplified in a hierarchical manner. Moreover, the interface design of nested structures is conducive to modularization and reuse. Different structures can be designed as independent modules and then reused through nesting in other structures, reducing the need for duplicate code. The data models in the real world are often hierarchical, containing multiple levels of nested relationships. By defining the structure information with multiple levels of nesting in the IDL file, the data structures in the real world can be more accurately simulated, making data exchange more intuitive and natural.

[0051] In the simulator emulation network, the interface variables between different emulation systems exist as individual entities. To avoid manually redefining physical quantities with the same physical meaning when connecting to the DDS network in the simulator network, it is necessary to fully expand the nested structures during the DDS network interface definition and then map the basic type variables of the independent DDS network after expansion to the simulator network data.

[0052] Step 102: Generate the first interface control document corresponding to the data distribution service network according to the disassembled structure information.

[0053] Specifically, process the disassembled structure information, parse the structure information, and insert the parsed results and supplementary information into the corresponding first interface control document. The header names and header meanings of the first interface control document are shown in Table 1.

[0054] Table 1

[0055]

[0056] In some embodiments, the disassembled structure information includes: the first publish-subscribe type parameters and the first interaction flag parameters corresponding to each of the multiple first structures; according to the disassembled structure information, generating a first interface control document corresponding to the data distribution service network may include: traversing the multiple first structures, for the current first structure, when the first publish-subscribe type parameter corresponding to the current first structure meets the first condition, if the first interaction identification parameter corresponding to the current first structure meets the second condition, then retain the current first structure; reading the target interface definition language file to obtain the first structure names and the first structure contents corresponding to all the retained first structures; generating a first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameters, the first interaction flag parameters, the first structure names and the first structure contents corresponding to all the retained first structures.

[0057] In this step, the first condition is to preset whether the value of the first publish-subscribe type parameter corresponding to the current first structure is "Pub" or "Sub"; the second condition is to preset whether the value of the first interaction identification parameter corresponding to the current first structure is "true" or "false". The first structure content includes the first variable name.

[0058] In the process of determining the first interface control document, traverse the multiple first structures. For the current first structure, determine whether the first publish-subscribe type parameter corresponding to the current first structure (i.e., the pub_sub_type parameter) meets the first condition. When it is determined that the value of the pub_sub_type parameter is not "Pub" or "Sub", it is determined that the first publish-subscribe type parameter does not meet the first condition, and an error message indicating that the first publish-subscribe type parameter corresponding to the current first structure does not meet the first condition is output; when it is determined that the value of the pub_sub_type parameter is "Pub" or "Sub", it is determined that the first publish-subscribe type parameter meets the first condition. At the same time, fill the pub_sub_type parameter with DDS_PubSub, and continue to determine whether the first interaction identification parameter corresponding to the current first structure (i.e., the is_interaction parameter) meets the second condition.

[0059] When it is determined that the value of the is_interaction parameter is not "true" or "false", it is determined that the first interaction identifier parameter does not meet the second condition, and an error message indicating that the first interaction identifier parameter corresponding to the current first structure does not meet the second condition is output; when it is determined that the value of the is_interaction parameter is "true" or "false", it is determined that the first interaction identifier parameter meets the second condition. At the same time, the is_interaction parameter is filled into IS_Interaction, and the current first structure is retained.

[0060] At this time, after traversing multiple first structures, at least one first structure has been retained. Then, the variable definition lines of the structures in the target interface definition language file are read using regular expressions, and the first structure names and first structure contents corresponding to all the retained first structures are obtained. Among them, all the first structure names are used to fill DDS_Topic, and all the first structure contents are used to fill DDS_Variable, DDS_Type, and DDS_Comments; according to the first publish-subscribe type parameters, first interaction flag parameters, first structure names, and first structure contents corresponding to all the retained first structures, the first interface control document corresponding to the data distribution service network is generated (as shown in Table 1).

[0061] Exemplarily, Figure 4 is a schematic diagram of the first interface control document provided by the present invention, as Figure 4 shown. The first interface control document includes DDS_Variable, DDS_Type, DDS_Topic, DDS_PubSub, DDS_Comments, and IS_Interaction, as well as the filling information corresponding to DDS_Variable, DDS_Type, DDS_Topic, DDS_PubSub, DDS_Comments, and IS_Interaction respectively.

[0062] Optionally, each first structure content includes: a first variable name, a first variable type, and a first variable comment.

[0063] Among them, the first variable name is used to fill DDS_Variable; the first variable type is used to fill DDS_Type; the first variable comment is used to fill DDS_Comments.

[0064] In one embodiment, according to the first publish-subscribe type parameters, first interaction flag parameters, first structure names, and first structure contents respectively corresponding to all the retained first structures, a first interface control document corresponding to the data distribution service network is generated, supplementary information is obtained, and the supplementary information is supplemented into the first interface control document.

[0065] Among them, the supplementary information contains the relevant information of other structures in the original data distribution service interface control file except the first structure. The original data distribution service interface control file is a preset interface control file, including various relevant information respectively corresponding to various structures. For example, it may include publish-subscribe type parameters, interaction flag parameters, structure names, structure contents, network variable descriptions, etc.; the original data distribution service interface control file may be an Excel file, and this embodiment does not limit this.

[0066] Specifically, according to the first publish-subscribe type parameters, first interaction flag parameters, first structure names, and first structure contents respectively corresponding to all the retained first structures, a first interface control document corresponding to the data distribution service network is generated. Since the data in this first interface control document is not complete, at this time, the supplementary information can be determined from the original data distribution service interface control file, and the supplementary information is supplemented into the first interface control document to improve the first interface control document and enhance the completeness of the first interface control document.

[0067] In some embodiments, each first structure content includes a first variable name. Generating a first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameters, first interaction flag parameters, first structure names, and first structure contents respectively corresponding to all the retained first structures may include: generating an initial first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameters, first interaction flag parameters, first structure names, and first structure contents respectively corresponding to all the retained first structures; determining, from all the second variable names in the original data distribution service interface control file, target variable names that are different from all the first variable names in the initial first interface control document, where the target variable names include at least one second variable name; determining the second structures respectively corresponding to at least one second variable name, and writing the second publish-subscribe type parameters, second interaction flag parameters, second structure names, and second structure contents respectively corresponding to at least one second structure into the initial first interface control document to obtain the first interface control document, and each second structure content includes the corresponding second variable name.

[0068] In the process of determining the first interface control document, first, based on the first publish-subscribe type parameters, first interaction flag parameters, first structure name, and first structure content corresponding to each of the retained first structures, an initial first interface control document corresponding to the data distribution service network is generated. At this time, since the data in the initial first interface control document is determined based on the target interface definition language file, the initial first interface control document is not comprehensive enough. Therefore, in order to improve the comprehensiveness of the initial first interface document, the original data distribution service interface control file can be loaded, and the supplementary information can be determined by comparing the data carried by the initial first interface document and the original data distribution service interface control document. Specifically, traverse each line in the original data distribution service interface control file, and determine the target variable names that are different from all the first variable names in the initial first interface control document from all the second variable names in the original data distribution service interface control file. The target variable names include at least one second variable name. At this time, all the second variable names can be saved in the existing_variables set.

[0069] Then, determine the second structures corresponding to at least one second variable name respectively. Among them, the relevant information corresponding to all the second structures can be the above supplementary information. Then, write the second publish-subscribe type parameters, second interaction flag parameters, second structure name, and second structure content corresponding to each of these second structures into the initial first interface control document to obtain the first interface control document. Each second structure content includes the corresponding second variable name. The corresponding relationship between the table header and the inserted content of the finally obtained first interface control document is shown in Table 2 below.

[0070] Table 2

[0071]

[0072] The first interface control document determined in the above entire process provides a clear and standardized material basis for the efficient development of work such as proofreading and debugging of the DDS network interface.

[0073] Step 103: Generate a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules.

[0074] In this step, each first structure content includes a first variable type and a first variable comment; each second structure content includes a second variable type and a second variable comment.

[0075] Specifically, after determining the first interface control document, generate a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules. The table header name and table header meaning of the second interface control document are shown in Table 3.

[0076] Table 3

[0077]

[0078] Exemplarily, Figure 5 is a schematic diagram of the second interface control document provided by the present invention. As Figure 5 shown, the first interface control document includes SDN_Topic, SDN_Variable, SDN_Unit, SDN_Scope, SDN_Comments, SDN_Type, SDN_PubSub, SDN_Queue, and SDN_RequestName, as well as the filling information corresponding to SDN_Topic, SDN_Variable, SDN_Unit, SDN_Scope, SDN_Comments, SDN_Type, SDN_PubSub, SDN_Queue, and SDN_RequestName respectively. SDN_Unit represents the unit, SDN_RequestName represents the parameter name, and SDN_Scope represents the label.

[0079] In some embodiments, according to the first interface control document and the simulator network data definition rule, generating the second interface control document corresponding to the simulator network may include: according to the simulator network data definition rule, determining all the first structure names, all the first variable names, all the first variable comments, all the second structure names, all the second variable names, and all the second variable comments as the target data corresponding to the simulator network; determining the second key-value pairs according to all the first variable types, all the second variable types, and the variable types of the simulator network data; performing inverse mapping on all the first publish-subscribe type parameters and all the second publish-subscribe type parameters with the publish-subscribe type parameters of the simulator network data to obtain the inverse mapping result; generating the interrupt type attribute and the interrupt request name corresponding to the simulator network data according to all the first interaction flag parameters and all the second interaction flag parameters; and generating the second interface control document corresponding to the simulator network according to the target data, the second key-value pairs, the inverse mapping result, the interrupt type attribute, and the interrupt request name.

[0080] Among them, the simulator network data definition rule defines a reliable, high-performance, and scalable data exchange mechanism for data-intensive real-time applications.

[0081] In the process of determining the second interface control document, according to the simulator network data definition rules, combined with the data in the first interface control document, the second interface control document corresponding to the simulator network is generated. Specifically, since all the structure names in the first interface control document (i.e., all the first structure names and all the second structure names) are the same as those in the second interface control document, all the first structure names and all the second structure names are directly filled into DDS_Variable in the same record; similarly, all the first variable names and all the second variable names are directly filled into DDS_Topic in the same record, and all the first variable comments and all the second variable comments are filled into DDS_Comments in the same record. The filled DDS_Variable, DDS_Topic, and DDS_Comments are the target data.

[0082] Then, define the mapping dictionary from the basic data types of IDL structures to the simulator network data types (i.e., the second key-value pair). That is, according to all the variable types in the first interface control document (i.e., all the first variable types and all the second variable types), and the variable types of the simulator network data, determine the second key-value pair. Specifically, use DDS_Type as the Key of the mapping dictionary, and the simulator network data type as the Value, and fill SDN_Type as the Value corresponding to the Key of DDS_Type. Exemplarily, the second key-value pair is shown in Table 4.

[0083] Table 4

[0084]

[0085] After determining the second key-value pair, since all the publish-subscribe type parameters in the first interface control document (i.e., all the first publish-subscribe type parameters and all the second publish-subscribe type parameters) have an inverse mapping relationship with the publish-subscribe type parameters of the simulator network data, all the first publish-subscribe type parameters and all the second publish-subscribe type parameters can be inversely mapped with the publish-subscribe type parameters of the simulator network data to obtain the inverse mapping result. For example: when DDS_PubSub is Pub, SDN_PubSub is Sub; when DDS_PubSub is Sub, SDN_PubSub is Pub.

[0086] Further, based on all the first interaction flag parameters and all the second interaction flag parameters, generate the interrupt type attribute and interrupt request name corresponding to the simulator network data. Specifically, during the process of setting the default interrupt type attribute, determine whether the attribute of the recorded IS_Interaction field is true. If it is true, it indicates that the IS_Interaction field is interaction - type data, and the default interrupt handling type needs to be set to "Default"; at the same time, further construct the interrupt request name. When it is determined that the attribute of the IS_Interaction field is true, it means that the IS_Interaction field is interaction - type data, and the default interrupt request name needs to be set. The naming rule for the interrupt request name is: "Send_" + SDN_Variable + "_Request". After the above - mentioned steps of processing, the corresponding relationship between the inserted content of the header data of the second interface control document is shown in Table 5 below.

[0087] Table 5

[0088]

[0089] The above - mentioned whole process can form a complete, clear, and standardized second interface control document, laying a foundation for the efficient development of work such as simulator data interface verification and debugging.

[0090] Step 104: According to the data distribution service data definition rule, the simulator network data definition rule, and the second interface control document, generate the simulator networking interface code. The simulator networking interface code includes: the simulator data interface code, and the docking code between the simulator data interface and the data distribution service data interface.

[0091] In this step, the simulator data interface code is applied to the simulator interface. The simulator interface is divided into a subscription interface class SdnInputs and a publishing interface class SdnOutputs, and the corresponding class behaviors are subscribing to data from the simulator network and publishing data to the simulator network respectively.

[0092] In some embodiments, when the simulator networking interface code includes the simulator data interface code, the simulator data interface code includes: the simulator status data interface definition code, the simulator status data interface publish - subscribe code, and the interaction data interrupt registration code; according to the data distribution service data definition rule, the simulator network data definition rule, and the second interface control document, generating the simulator networking interface code can include the following implementation methods.

[0093] Implementation method 1: Based on the data distribution service data definition rules and the simulator network data definition rules, generate the simulator status data interface definition code based on all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameter, all the first variable names, and the second variable names in the second interface control document.

[0094] In this step, the simulator status data interface definition code is used to define certain quantities.

[0095] Exemplarily, load the determined second interface control file, read all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameter, all the first variable names, and the second variable names, and then according to the type of the second publish-subscribe type parameter, splice the content of the second publish-subscribe type parameter and the second variable name into the simulator publish interface according to the simulator network data definition rules, define the string inputs_members and the string outputs_members for subscribing interface variable definition. Then open the SdnIO.h file through the standard library file and modify its content. Locate the end position of the SdnInputs class definition in the SdnIO.h file, insert the new member variable definition string inputs_members before the end position, locate the end position of the SdnOutputs class definition in the SdnIO.h file, and insert the new member variable definition string outputs_members before the end position. Finally, write the content of the new interface definition added to the simulator network interface back to the header file, thereby generating the simulator status data interface definition code.

[0096] Exemplarily, Figure 6 is a schematic diagram of the simulator status data interface definition code provided by the present invention. As Figure 6 shown, it shows the simulator status data interface definition code.

[0097] Implementation method 2: Based on all the first variable names, all the second variable names, all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameter, all the first variable annotations, all the second variable annotations in the second interface control document, and the topic name of the simulator network, generate the simulator status data interface publish-subscribe code.

[0098] In this step, the simulator status data interface publish-subscribe code is used to determine that a certain quantity defined needs to be obtained from somewhere.

[0099] Exemplarily, first load the second interface control document, read all the first variable names, all the second variable names, all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameter, all the first variable comments, all the second variable comments, and the topic name of the simulator network. Then, according to the types of all the first variable names and all the second variable names, splice the contents of all the first variable names, all the second variable names, all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameter, all the first variable comments, all the second variable comments, and the topic name of the simulator network into a subscription code string subscribes_str and a publish code string publish_str according to the data distribution service data definition rules. Then open the SdnIO.cpp file and modify its content. Locate the end position of the subscription function in the SdnIO.cpp file, and insert the interface subscription code string subscribes_str before the end position. Locate the end position of the publish function in the SdnIO.cpp file, and insert the interface publish code string publish_str before the end position. Finally, write the content of the added subscription / publish code string back to the cpp file, thereby generating the simulator status data interface definition code. The whole process can automatically generate the simulator status data interface definition code, avoiding manual repeated definition.

[0100] Exemplarily, Figure 7 is a schematic diagram of the publish-subscribe code of the simulator status data interface provided by the present invention, as Figure 7 shown, which shows the publish-subscribe code of the simulator status data interface.

[0101] Implementation method 3: Generate the interaction data interruption registration code based on all the first interaction flag parameters, all the second interaction flag parameters, the topic name, the interruption type attribute, and the interruption request name in the second interface control document.

[0102] In this step, the interaction data interruption registration code has an interruption handling mechanism, which is adapted to the handling of special situations.

[0103] Exemplarily, first load the second interface control document, read all the first interaction flag parameters, all the second interaction flag parameters, the topic name, the interrupt type attribute, and the interrupt request name in the second interface control document, and then perform the following operations according to the values of all the first interaction flag parameters and all the second interaction flag parameters. If the values of all the first interaction flag parameters and all the second interaction flag parameters are true, splice the contents of the topic name, the interrupt type attribute, and the interrupt request name into an interrupt registration code string regsister_str according to the simulator network interruption registration rules. Then open and read the SdnIO.cpp file and modify its content. Locate the end position of the publishing function in the SdnIO.cpp file and insert the interrupt registration code regsister_str before the end position. Finally, write the content with the added interrupt registration code string back to the cpp file, thereby generating the interaction data interrupt registration code.

[0104] Exemplarily, Figure 8 is a schematic diagram of the interaction data interrupt registration code provided by the present invention. As Figure 8 shown, it shows the interaction data interrupt registration code.

[0105] In some embodiments, when the simulator networking interface code includes docking codes, the docking codes include: data distribution service status subscription data mapping codes, data distribution service status publishing data mapping codes, and data distribution service interaction data interruption trigger codes. According to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document, generate the simulator networking interface code, including: according to the data distribution service data definition rules and the simulator network data definition rules, based on all the first interaction flag parameters, all the second interaction flag parameters, all the first variable names, and all the second variable names in the second interface control document, generate the data distribution service status subscription data mapping codes and the data distribution service status publishing data mapping codes; based on all the first interaction flag parameters, all the second interaction flag parameters, the topic name of the simulator network, the interrupt type attribute, and the interrupt request name in the second interface control document, generate the data distribution service interaction data interruption trigger code, which may include the following implementation methods.

[0106] Implementation method 1: According to the data distribution service data definition rules and the simulator network data definition rules, based on all the first interaction flag parameters, all the second interaction flag parameters, all the first variable names, and all the second variable names in the second interface control document, generate the data distribution service status subscription data mapping codes and the data distribution service status publishing data mapping codes.

[0107] In this step, the data distribution service status subscription data mapping code is used to subscribe to the status data of other simulators by an individual simulator. When the subscribed data is received, DDS will automatically trigger the listening function. In the listening function, the updated value of the subscribed variable is retrieved and assigned to the member variable value pointed to by the SdnOutputs class object, thus completing the mapping of DDS network subscribed data to simulator network data. The data distribution service status publication data mapping code is used to send the status information of an individual simulator to the data in the DDS network, and this data is written to the DDS network at a fixed frequency in each simulation cycle of the simulator program.

[0108] Exemplarily, first, load the second interface control document, read all the first interaction flag parameters, all the second interaction flag parameters, all the first variable names, and all the second variable names in the second interface control document. Then, determine whether the data is of the interaction data type according to the values of all the first interaction flag parameters and all the second interaction flag parameters. If its value is true, perform the operation of generating the DDS interaction data interruption trigger code. If it is false, it is status data, and the string mapSubscribe_Str for assigning values to the member variables pointed to by the SdnOutputs class object needs to be concatenated according to the DDS value-taking rule. Then, open and read the cpp file of the DDSSubscriber class and modify its content. Locate the position of the data validity code in the data update listening on_data_available function in the DDSSubscriber class program, and add the string mapSubscribe_Str to the function body where the judgment is valid. Finally, write back the content with the added status subscription data mapping code string to the cpp file, thereby generating the data distribution service status subscription data mapping code and the data distribution service status publication data mapping code.

[0109] The advantage of such a setting is that the data distribution service status subscription data mapping code and the data distribution service status publication data mapping code are automatically generated, eliminating the need for manual docking and avoiding human factor errors that may occur during the laborious manual operation and interface docking process.

[0110] Exemplarily, Figure 9 is a schematic diagram of the data distribution service status subscription data mapping code and the data distribution service status publication data mapping code provided by the present invention, as Figure 9 shown, which shows the data distribution service status subscription data mapping code and the data distribution service status publication data mapping code.

[0111] Implementation method 2: Generate the DDS interaction data interruption trigger code based on all the first interaction flag parameters, all the second interaction flag parameters, the topic name of the simulator network, the interruption type attribute, and the interruption request name in the second interface control document.

[0112] Exemplarily, load the second interface control document, read all the first interaction flag parameters and all the second interaction flag parameters in the second interface control document, and determine whether the data is of the interaction data type according to the values of all the first interaction flag parameters and all the second interaction flag parameters. If its value is true, then according to the interrupt logic trigger rule and the DDS value-taking rule, splice the interaction data interrupt trigger code string interaction_Str. Then open and read the cpp file of the DDSSubscriber class, and modify its content. Locate the position of the data validity code in the on_data_available function for data update listening in the DDSSubscriber class program, and add the string interaction_Str to the function body where it is judged to be valid. Finally, write back the content with the added interaction data interrupt trigger code string to the cpp file, thereby generating the data distribution service interaction data interrupt trigger code.

[0113] Exemplarily, Figure 10 is a schematic diagram of the data distribution service interaction data interrupt trigger code provided by the present invention, as Figure 10 shown, which shows the data distribution service interaction data interrupt trigger code. The data distribution service interaction data interrupt trigger code includes interrupt request definition, interrupt data definition and assignment, adding interrupt source information (interrupt request name), type information (i.e., interrupt type attribute), and sending an interrupt. Among them, the interrupt request definition carries the interrupt request name (i.e., the interrupt name)

[0114] The simulator networking interface code generation method, device, equipment and medium provided by the present invention disassemble the nested structure in the target interface definition language file to obtain the disassembled structure information; generate the first interface control document corresponding to the data distribution service network according to the disassembled structure information; generate the second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rule; generate the simulator networking interface code according to the data distribution service data definition rule, the simulator network data definition rule and the second interface control document. The simulator networking interface code includes: the simulator data interface code and the docking code between the simulator data interface and the data distribution service data interface. The technical solution of the present invention can realize the networking between the data distribution service and the simulator through the generated simulator data interface code and the docking code between the simulator data interface and the data distribution service data interface based on the nested structure in the target interface definition language file. The whole process does not require manual interface definition and docking, improves the development speed and development efficiency of the networking between the data distribution service and the simulator, and effectively avoids the human factor errors caused by manual interface processing.

[0115] The simulator networking interface code generation device provided by the present invention will be described below. The simulator networking interface code generation device described below can be correspondingly referred to the simulator networking interface code generation method described above.

[0116] Figure 11 is a schematic structural diagram of the simulator networking interface code generation device provided by the present invention, as Figure 11 shown, the simulator networking interface code generation device 1100 includes the following structure disassembling module 1101, first generation module 1102, second generation module 1103 and code generation module 1104.

[0117] The structure disassembling module 1101 is used to disassemble the nested structures in the target interface definition language file to obtain the disassembled structure information.

[0118] The first generation module 1102 is used to generate a first interface control document corresponding to the data distribution service network according to the disassembled structure information.

[0119] The second generation module 1103 is used to generate a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules.

[0120] The code generation module 1104 is used to generate simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules and the second interface control document. The simulator networking interface code includes: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface.

[0121] In an embodiment, the structure disassembling module 1101 is specifically used to: parse the file content in the interface definition language file to obtain a plurality of first structures and the structure definitions corresponding to each of the plurality of first structures. Each structure definition is a first key-value pair, and the first key-value pair is used to store the relevant information of the corresponding first structure; expand the plurality of first structures according to all the relevant information to obtain nested structures; determine the target interface definition language file according to the nested structures and a preset output file; disassemble the nested structures in the target interface definition language file to obtain the disassembled structure information.

[0122] In an embodiment, the disassembled structure information includes: first publish-subscribe type parameters and first interaction flag parameters corresponding to each of the plurality of first structures.

[0123] In one embodiment, the first generation module 1102 is specifically configured to: traverse multiple first structures, and for the current first structure, if the first publish-subscribe type parameter corresponding to the current first structure satisfies the first condition and the first interaction identification parameter corresponding to the current first structure satisfies the second condition, retain the current first structure; read the target interface definition language file to obtain the first structure name and the first structure content corresponding to each of the retained first structures; generate a first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interaction flag parameter, the first structure name, and the first structure content corresponding to each of the retained first structures.

[0124] In one embodiment, each first structure content includes a first variable name.

[0125] In one embodiment, the first generation module 1102 generates a first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interaction flag parameter, the first structure name, and the first structure content corresponding to each of the retained first structures, and is specifically configured to: generate an initial first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interaction flag parameter, the first structure name, and the first structure content corresponding to each of the retained first structures; determine, from all the second variable names in the original data distribution service interface control file, target variable names that are different from all the first variable names in the initial first interface control document, where the target variable names include at least one second variable name; determine the second structures corresponding to at least one second variable name, and write the second publish-subscribe type parameter, the second interaction flag parameter, the second structure name, and the second structure content corresponding to each of the at least one second structures into the initial first interface control document to obtain the first interface control document, and each second structure content includes the corresponding second variable name.

[0126] In one embodiment, each first structure content includes a first variable type and a first variable comment; each second structure content includes a second variable type and a second variable comment.

[0127] In one embodiment, the second generation module 1103 is specifically configured to: determine all first structure names, all first variable names, all first variable comments, all second structure names, all second variable names, and all second variable comments as target data corresponding to the simulator network according to the simulator network data definition rules; determine second key-value pairs according to all first variable types, all second variable types, and the variable types of the simulator network data; perform reverse mapping on all first publish-subscribe type parameters and all second publish-subscribe type parameters with the publish-subscribe type parameters of the simulator network data to obtain a reverse mapping result; generate an interrupt type attribute and an interrupt request name corresponding to the simulator network data according to all first interaction flag parameters and all second interaction flag parameters; and generate a second interface control document corresponding to the simulator network according to the target data, the second key-value pairs, the reverse mapping result, the interrupt type attribute, and the interrupt request name.

[0128] In one embodiment, when the simulator networking interface code includes simulator data interface code, the simulator data interface code includes: simulator status data interface definition code, simulator status data interface publish-subscribe code, and interaction data interrupt registration code.

[0129] In one embodiment, the code generation module 1104 generates simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. Specifically, it is configured to: generate simulator status data interface definition code based on all first variable types, all second variable types, all first publish-subscribe type parameters, second publish-subscribe type parameters, all first variable names, and second variable names in the second interface control document according to the data distribution service data definition rules and the simulator network data definition rules; generate simulator status data interface publish-subscribe code based on all first variable names, all second variable names, all first variable types, all second variable types, all first publish-subscribe type parameters, second publish-subscribe type parameters, all first variable comments, all second variable comments, and the topic name of the simulator network; and generate interaction data interrupt registration code based on all first interaction flag parameters, all second interaction flag parameters, the topic name, the interrupt type attribute, and the interrupt request name in the second interface control document.

[0130] In one embodiment, when the simulator networking interface code includes docking code, the docking code includes: data distribution service status subscription data mapping code, data distribution service status publish data mapping code, and data distribution service interaction data interrupt trigger code.

[0131] In one embodiment, the code generation module 1104 generates simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. Specifically, it is configured to: based on the data distribution service data definition rules and the simulator network data definition rules, generate data distribution service status subscription data mapping code and data distribution service status publication data mapping code based on all the first interaction flag parameters, all the second interaction flag parameters, all the first variable names, and all the second variable names in the second interface control document; and generate data distribution service interaction data interruption trigger code based on all the first interaction flag parameters, all the second interaction flag parameters, the topic name of the simulator network, the interruption type attribute, and the interruption request name in the second interface control document.

[0132] Figure 12 is a schematic structural diagram of the electronic device provided by the present invention. As Figure 12 shown, the electronic device may include: a processor 1210, a communications interface 1220, a memory 1230, and a communication bus 1240. Among them, the processor 1210, the communications interface 1220, and the memory 1230 communicate with each other through the communication bus 1240. The processor 1210 can call the logical instructions in the memory 1230 to execute the simulator networking interface code generation method, which includes: disassembling the nested structure body in the target interface definition language file to obtain the disassembled structure body information; generating a first interface control document corresponding to the data distribution service network according to the disassembled structure body information; generating a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules; and generating simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. The simulator networking interface code includes: simulator data interface code and docking code for the simulator data interface and the data distribution service data interface.

[0133] In addition, when the logical instructions in the above-mentioned memory 1230 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods according to the various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs that can store program codes.

[0134] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the simulator networking interface code generation method provided by the above-mentioned various methods. The method includes: disassembling the nested structure body in the target interface definition language file to obtain the disassembled structure body information; generating a first interface control document corresponding to the data distribution service network according to the disassembled structure body information; generating a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules; generating simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. The simulator networking interface code includes: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface.

[0135] In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it realizes the execution of the simulator networking interface code generation method provided by the above-mentioned various methods. The method includes: disassembling the nested structure body in the target interface definition language file to obtain the disassembled structure body information; generating a first interface control document corresponding to the data distribution service network according to the disassembled structure body information; generating a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules; generating simulator networking interface code according to the data distribution service data definition rules, the simulator network data definition rules, and the second interface control document. The simulator networking interface code includes: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface.

[0136] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.

[0137] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features. These modifications or replacements 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 the present invention.

Claims

1. A method for generating simulator networking interface code, characterized in that: include: Deconstruct the nested structure in the target interface definition language file to obtain the deconstructed structure information; Generate a first interface control document corresponding to the data distribution service network according to the disassembled structure information; wherein the disassembled structure information includes: first publish-subscribe type parameters and first interaction flag parameters corresponding to each of the multiple first structures; generating the first interface control document corresponding to the data distribution service network according to the disassembled structure information includes: traversing the multiple first structures, for the current first structure, if the first publish-subscribe type parameter corresponding to the current first structure satisfies the first condition, and if the first interaction flag parameter corresponding to the current first structure satisfies the second condition, then retain the current first structure; read the target interface definition language file to obtain the first structure names and first structure contents corresponding to each of the retained first structures; generate the first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameters, first interaction flag parameters, first structure names and first structure contents corresponding to each of the retained first structures; Generate a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules; wherein each first structure content includes a first variable type and a first variable annotation; each second structure content includes a second variable type and a second variable annotation; the generating the second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules comprises: according to the simulator network data definition rules, determine all first structure names, all first variable names, all first variable annotations, all second structure names, all second variable names and all second variable annotations as target data corresponding to the simulator network; determine a second key-value pair according to all first variable types and all second variable types, and the variable type of the simulator network data; reversely map all first publish-subscribe type parameters and all second publish-subscribe type parameters with the publish-subscribe type parameters of the simulator network data to obtain a reverse mapping result; generate an interrupt type attribute and an interrupt request name corresponding to the simulator network data according to all first interaction flag parameters and all second interaction flag parameters; generate a second interface control document corresponding to the simulator network according to the target data, the second key-value pair, the reverse mapping result, the interrupt type attribute and the interrupt request name; Generate simulator networking interface code according to data distribution service data definition rules, the simulator network data definition rules and the second interface control document, the simulator networking interface code includes: simulator data interface code, and docking code between simulator data interface and data distribution service data interface; wherein, in the case where the simulator networking interface code includes the simulator data interface code, the simulator data interface code includes: simulator state data interface definition code, simulator state data interface publish-subscribe code and interactive data interrupt registration code; the simulator networking interface code is generated according to data distribution service data definition rules, the simulator network data definition rules and the second interface control document, including: according to the data distribution service data definition rules and the simulator network data definition rules, based on all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameters, all the first variable names and the second variable names in the second interface control document, generate the simulator state data interface definition code; based on all the first variable names, all the second variable names, all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameters, all the first variable annotations, all the second variable comments, annotation, and the topic name of the simulator network, generate the simulator status data interface publish-subscribe code; based on the all first interaction flag parameters, the all second interaction flag parameters, the topic name, the interruption type attribute and the interruption request name in the second interface control document, generate the interactive data interruption registration code; in the case where the simulator networking interface code includes the docking code, the docking code includes: data distribution service status subscription data mapping code, data distribution service status publishing data mapping code, and data distribution service interactive data interruption trigger code; the data distribution service data definition rules, the simulator network data definition rules and the second interface control document, generates simulator networking interface code, including: according to the data distribution service data definition rules and the simulator network data definition rules, based on all the first interaction flag parameters, all the second interaction flag parameters, all the first variable names and all the second variable names in the second interface control document, generate the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code; based on all the first interaction flag parameters, all the second interaction flag parameters, the subject name of the simulator network, the interruption type attribute and the interruption request name in the second interface control document, generate the data distribution service interaction data interruption trigger code.

2. The simulator networking interface code generation method according to claim 1, characterized in that: The step of disassembling the nested structure in the target interface definition language file to obtain disassembled structure information includes: Parsing the file content of the interface definition language file to obtain a plurality of first structures and structure definitions corresponding to the plurality of first structures, each structure definition being a first key-value pair, and the first key-value pair being used to store relevant information corresponding to the first structure; According to all relevant information, the multiple first structures are expanded to obtain a nested structure; Determining the target interface definition language file according to the nested structure and the preset output file; The nested structure in the target interface definition language file is disassembled to obtain the disassembled structure information.

3. The simulator networking interface code generation method according to claim 1, characterized in that: Each first structure content includes a first variable name, and generating a first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interaction flag parameter, the first structure name and the first structure content corresponding to each of the reserved first structures includes: Generate an initial first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interaction flag parameter, the first structure name and the first structure content corresponding to each of all the retained first structures; Determine, from all second variable names in the original data distribution service interface control document, a target variable name that is different from all first variable names in the initial first interface control document, wherein the target variable name includes at least one second variable name; Determine the second structure corresponding to each of the at least one second variable names, and write the second publish-subscribe type parameter, second interaction flag parameter, second structure name and second structure content corresponding to each of the at least one second structure into the initial first interface control document to obtain the first interface control document, wherein each second structure content includes the corresponding second variable name.

4. A simulator networking interface code generation device, characterized in that: include: The structure disassembly module is used to disassemble the nested structure in the target interface definition language file to obtain the disassembled structure information; A first generation module is used to generate a first interface control document corresponding to a data distribution service network according to the disassembled structure information; wherein the disassembled structure information includes: a first publish-subscribe type parameter and a first interaction flag parameter corresponding to each of a plurality of first structures; the generating of the first interface control document corresponding to the data distribution service network according to the disassembled structure information includes: traversing the plurality of first structures, for a current first structure, if the first publish-subscribe type parameter corresponding to the current first structure satisfies a first condition, and if the first interaction flag parameter corresponding to the current first structure satisfies a second condition, then retaining the current first structure; reading the target interface definition language file to obtain the first structure name and the first structure content corresponding to each of all the retained first structures; generating the first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interaction flag parameter, the first structure name and the first structure content corresponding to each of all the retained first structures; The second generation module is used to generate a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules; wherein each first structure content includes a first variable type and a first variable comment; each second structure content includes a second variable type and a second variable comment; the second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rules is generated, including: according to the simulator network data definition rules, all first structure names, all first variable names, all first variable comments, all second structure names, all second variable names and all second variable comments are determined as the simulation The target data corresponding to the simulator network; according to all the first variable types and all the second variable types, and the variable type of the simulator network data, determine the second key-value pair; reversely map all the first publish-subscribe type parameters and all the second publish-subscribe type parameters with the publish-subscribe type parameters of the simulator network data to obtain a reverse mapping result; according to all the first interaction flag parameters and all the second interaction flag parameters, generate the interruption type attribute and the interruption request name corresponding to the simulator network data; according to the target data, the second key-value pair, the reverse mapping result, the interruption type attribute and the interruption request name, generate the second interface control document corresponding to the simulator network; A code generation module is used to generate a simulator networking interface code according to a data distribution service data definition rule, the simulator network data definition rule and the second interface control document, the simulator networking interface code including: a simulator data interface code, and a docking code between the simulator data interface and the data distribution service data interface; wherein, in the case where the simulator networking interface code includes the simulator data interface code, the simulator data interface code includes: a simulator status data interface definition code, a simulator status data interface publishing and subscription code and an interactive data interrupt registration code; the simulator networking interface code is generated according to the data distribution service data definition rule, the simulator network data definition rule and the second interface control document. The simulator network interface code comprises: generating the simulator state data interface definition code according to the data distribution service data definition rule and the simulator network data definition rule, based on the second interface control document, all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameters, all the first variable names and the second variable names, and generating the simulator state data interface definition code; generating the simulator state data interface definition code according to the data distribution service data definition rule and the simulator network data definition rule, based on the second interface control document, all the first variable names, all the second variable names, all the first variable types, all the second variable types, all the first publish-subscribe type parameters, the second publish-subscribe type parameters, all the first variable annotations, and all the second variable names. The second variable annotation, and the topic name of the simulator network, generate the simulator status data interface publish-subscribe code; based on the all first interaction flag parameters, the all second interaction flag parameters, the topic name, the interruption type attribute and the interruption request name in the second interface control document, generate the interactive data interruption registration code; in the case where the simulator networking interface code includes the docking code, the docking code includes: data distribution service status subscription data mapping code, data distribution service status publishing data mapping code, and data distribution service interactive data interruption trigger code; the data distribution service data definition rules, the simulator network data definition rules and the second interface Control document, generate simulator networking interface code, including: according to the data distribution service data definition rules and the simulator network data definition rules, based on all the first interaction flag parameters, all the second interaction flag parameters, all the first variable names and all the second variable names in the second interface control document, generate the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code; based on all the first interaction flag parameters, all the second interaction flag parameters, the subject name of the simulator network, the interruption type attribute and the interruption request name in the second interface control document, generate the data distribution service interaction data interruption trigger code.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the simulator networking interface code generation method according to any one of claims 1 to 3 is implemented.

6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the simulator networking interface code generation method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Simulator networking method, system and device based on data distribution service and medium

    CN119182675A