Simulator networking interface code generation method and device, equipment and medium

By disassembling the nested structure in the target interface definition language file, generating the simulator data interface code and docking code, the cumbersome problems of manual definition and docking in the existing technology are solved, and development efficiency is improved and human errors are reduced.

CN119512512AActive Publication Date: 2025-02-25BEIJING BLUESKY AVIATION TECH CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

The existing DDS-based simulator networking technology requires manual dual definition of data on the simulator state, resulting in cumbersome and inefficient development process, and human factors 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, reduces human factors and realizes automated interface definition and docking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512512A_ABST
    Figure CN119512512A_ABST
Patent Text Reader

Abstract

The invention provides a simulator networking interface code generation method and device, equipment and a medium, and the method comprises the steps: disassembling a nested structure body in a target interface definition language file, and obtaining the information of the disassembled structure body; 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 a simulator network data definition rule; and generating a 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. According to the method, networking between the data distribution service and the simulator can be achieved, manual interface definition and butt joint do not need to be manually conducted in the whole process, the development speed and development efficiency of networking between the data distribution service and the simulator are improved, and human factor errors caused by manual interface processing are effectively avoided.
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 in particular 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 used to connect multiple simulators to ensure low latency and high reliability of data transmission, thereby creating conditions for simulator flight formation training and collaborative combat simulation, and improving the realism and training effect of flight simulation. 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 simulators.

[0003] However, the simulator networking technology based on DDS has shortcomings in data definition. Among them, due to the huge amount of simulator status data, it is usually necessary to manually double-define the same physical quantity in the DDS corresponding interface definition language (Interface Definition Language File, IDL) file and the simulator simulation network, resulting in a cumbersome and inefficient development process. In addition, when implementing the mapping of the DDS data interface and the simulator simulation data, it is also necessary to manually connect the data of the same physical quantity, which is time-consuming and has a high connection error rate.

[0004] In summary, the networking interface definition and docking of the above-mentioned DDS-based simulator networking technology 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 error factors caused by manual interface processing. Summary of the invention

[0005] The present invention provides a simulator networking interface code generation method, device, equipment and medium, which are used to solve the problem that the networking interface definition and docking of the simulator networking technology based on DDS in the prior art require manual participation, which makes the development speed of the networking between DDS and the simulator slow and the development efficiency low, and there are defects of human error caused by manual interface processing. By generating simulator data interface code based on nested structures in a 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, which improves the development speed and efficiency of the networking between the data distribution service and the simulator, and effectively avoids human error caused by manual interface processing.

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

[0007] The nested structures in the target interface definition language file are disassembled to obtain the disassembled structure information.

[0008] A first interface control document corresponding to the data distribution service network is generated according to the disassembled structural information.

[0009] A second interface control document corresponding to the simulator network is generated according to the first interface control document and the simulator network data definition rule.

[0010] The simulator networking interface code is generated 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 a simulator networking interface code generation method provided by the present invention, the nested structures in the target interface definition language file are disassembled to obtain the disassembled structure information, including: parsing the file content in the interface definition language file to obtain multiple first structures and structure definitions corresponding to the multiple first structures, each structure definition is a first key-value pair, and the first key-value pair is used to store relevant information of the corresponding first structure; based on all relevant information, the multiple first structures are expanded to obtain nested structures; based on the nested structures and the preset output file, the target interface definition language file is determined; the nested structures in the target interface definition language file are disassembled to obtain the disassembled structure information.

[0012] According to a simulator networking interface code generation method provided by the present invention, 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; based on the disassembled structure information, a first interface control document corresponding to a data distribution service network is generated, including: traversing a plurality of first structures, for a current first structure, when the first publish-subscribe type parameter corresponding to the current first structure satisfies a first condition, if the first interaction identification parameter corresponding to the current first structure satisfies a second condition, then the current first structure is retained; reading a target interface definition language file, obtaining first structure names and first structure contents corresponding to each of all retained first structures; and generating a first interface control document corresponding to the data distribution service network based on 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 retained first structures.

[0013] According to a simulator networking interface code generation method provided by the present invention, each first structure content includes a first variable name, and a first interface control document corresponding to a data distribution service network is generated according to the first publish-subscribe type parameter, the first interactive flag parameter, the first structure name and the first structure content corresponding to each of the reserved first structures, including: generating an initial first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interactive flag parameter, the first structure name and the first structure content corresponding to each of the reserved first structures; determining a target variable name 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 name including at least one second variable name; determining a second structure corresponding to each of the at least one second variable name, and writing the second publish-subscribe type parameter, the second interactive flag parameter, the second structure name and the second structure content corresponding to each of the at least one second structure into the initial first interface control document to obtain a first interface control document, wherein each second structure content includes a corresponding second variable name.

[0014] According to a simulator networking interface code generation method provided by the present invention, 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; according to the first interface control document and the simulator network data definition rule, a second interface control document corresponding to the simulator network is generated, including: according to the simulator network data definition rule, 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 target data corresponding to the simulator network; according to all first variable types and all second variable types, and the variable type of the simulator network data, a second key-value pair is determined; all first publish-subscribe type parameters and all second publish-subscribe type parameters are reversely mapped with the publish-subscribe type parameters of the simulator network data to obtain a reverse mapping result; according to all first interaction flag parameters and all second interaction flag parameters, an interrupt type attribute and an interrupt request name corresponding to the simulator network data are generated; according to the target data, the second key-value pair, the reverse mapping result, the interrupt type attribute and the interrupt request name, a second interface control document corresponding to the simulator network is generated.

[0015] According to a simulator networking interface code generation method provided by the present invention, 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; 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 is generated, including: according to the data distribution service data definition rule and the simulator network data definition rule, 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, the simulator state data interface definition code is generated; 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 annotations, all second variable annotations, and the topic name of the simulator network in the second interface control document, the simulator state data interface publish-subscribe code is generated; based on all first interactive flag parameters, all second interactive flag parameters, the topic name, the interrupt type attribute and the interrupt request name in the second interface control document, the interactive data interrupt registration code is generated.

[0016] According to a method for generating simulator networking interface code provided by the present invention, when the simulator networking interface code includes a docking code, the docking code includes: a data distribution service status subscription data mapping code, a data distribution service status publishing data mapping code, and a data distribution service interactive data interruption trigger 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 is generated, including: according to the data distribution service data definition rules and the simulator network data definition rules, based on all first interactive flag parameters, all second interactive flag parameters, all first variable names and all second variable names in the second interface control document, generating a data distribution service status subscription data mapping code and a data distribution service status publishing data mapping code; based on all first interactive flag parameters, all second interactive flag parameters, the subject name of the simulator network, the interruption type attribute and the interruption request name in the second interface control document, generating a data distribution service interactive data interruption trigger code.

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

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

[0019] The first generating module is used to generate a 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 a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rule.

[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 the docking code between the simulator data interface and the data distribution service data interface.

[0022] The present invention also provides 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, any of the above-mentioned simulator networking interface code generation methods is implemented.

[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 any of the above-mentioned simulator networking interface code generation methods.

[0024] The present invention also provides a computer program product, including a computer program, which implements any of the above-mentioned simulator networking interface code generation methods when executed by a processor.

[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 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, and the simulator networking interface code includes: 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 by generating the 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 whole process does not require manual interface definition and docking, which improves the development speed and efficiency of the networking between the data distribution service and the simulator, and effectively avoids human error caused by manual interface processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 It is a flow chart of the simulator networking interface code generation method provided by the present invention.

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

[0029] Figure 3 It is a code schematic diagram of the disassembled 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 state data interface definition code provided by the present invention.

[0033] Figure 7 It is a schematic diagram of the simulator state data interface publishing and subscription 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] Fig. 9 It is a schematic diagram of the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code provided by the present invention.

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

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

[0038] Fig.12 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

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

[0041] The embodiment of the present invention is further described below by taking an electronic device as an example.

[0042] Figure 1 It is a flow chart of the simulator networking interface code generation method provided by the present invention, such as Figure 1 As shown, the method includes the following steps 101 to 104.

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

[0044] In some embodiments, disassembling a nested structure in a target interface definition language file to obtain disassembled structure information may include: parsing the file content in 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 of the corresponding first structure; expanding the plurality of first structures according to all relevant information to obtain a nested structure; determining a target interface definition language file according to the nested structure and a preset output file; and disassembling the nested structure in the target interface definition language file to obtain disassembled structure information.

[0045] The interface definition language file is used by DDS to define the IDL structure data exchanged by the DDS network. Optionally, the IDL structure data may include three parts: Topic (structure name), data type and data variable name.

[0046] The relevant information of the first structure includes: a structure name and a structure field, and the structure field includes: a field name and a 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 respectively used as a dictionary, the former is used to store the structure name, and the latter is used to store the structure field.

[0047] In the process of determining the disassembled structure information, firstly, an interface definition language file is obtained, and the interface definition language file is used as an input file, and the file content in the interface definition language file is parsed by a regular expression, that is, the file path (idl_filename) corresponding to the interface definition language file is used as a parameter, and the entire content in the interface definition language file is opened and read to obtain a plurality of first structures and structure definitions corresponding to each of the plurality of first structures; then, based on all structure definitions, according to all stored relevant information (such as structure names and structure fields), the structure names corresponding to each of the plurality of first structures are recursively expanded to obtain a nested structure, and if the fields of the first structure If the type is another first structure, then this nested first structure will also be expanded. The result of the expansion is a more detailed structure definition, in which the nested fields are defined by their specific fields, and a prefix is ​​added before the field name to maintain uniqueness; then, the output file path (excel_filename) corresponding to the preset output file and the content of the expanded nested body are taken as parameters, and the content of the expanded nested body is written into the specified preset output file to determine the target interface definition language file; finally, the nested structure in the target interface definition language file is disassembled to obtain the disassembled structure information, without the need to manually disassemble the final structure information, which improves the accuracy of the structure information and is easy to understand.

[0048] For example, Figure 2 is a code schematic diagram of an undisassembled interface definition language file provided by the present invention, such as Figure 2 As shown, the code represents the undisassembled interface definition language file. Figure 3 is a schematic diagram of the code of the target interface definition language file after disassembly provided by the present invention, such as Figure 3 As shown, the code represents the disassembled target interface definition language file.

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

[0050] In addition, when using DDS for simulator distributed networking communication, it is very common and important to define nested structures in the target interface definition language file that contain multiple layers 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. And the interface design of nested structures is conducive to modularization and reuse. Different structures can be designed as independent modules, and then reused in other structures through nesting, reducing the need for duplicate code. The data models of the real world are often hierarchical and contain multiple layers of nested relationships. By defining structure information containing multiple layers of nesting in the IDL file, the data structure of the real world can be simulated more accurately, making data exchange more intuitive and natural.

[0051] In the simulator simulation network, the interface variables between different simulation systems exist as separate individuals. In order to achieve the goal of no longer manually redefining physical quantities with the same physical meaning when connecting to DDS in the simulator network, it is necessary to fully expand the nested structure when defining the DDS network interface, and then map the basic type variables of the independent DDS network after expansion to the simulator network data.

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

[0053] Specifically, the disassembled structure information is processed, the structure information is parsed, and the parsed result and the supplementary information are inserted into the corresponding first interface control document. The header name and header meaning of the first interface control document are shown in Table 1.

[0054] Table 1

[0055] In some embodiments, the disassembled structure information includes: a first publish-subscribe type parameter and a first interaction flag parameter corresponding to each of the multiple first structures; generating a first interface control document corresponding to the data distribution service network based on the disassembled structure information may include: traversing multiple first structures, for the current first structure, when the first publish-subscribe type parameter corresponding to the current first structure satisfies the first condition, if the first interaction identification parameter corresponding to the current first structure satisfies the second condition, then retaining the current first structure; reading the target interface definition language file to obtain the first structure names and first structure contents corresponding to each of the retained first structures; generating the first interface control document corresponding to the data distribution service network based on 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.

[0056] In this step, the first condition is to determine 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 determine whether the value of the first interaction identifier parameter corresponding to the current first structure is "true" or "false". The first structure content includes the first variable name.

[0057] In the process of determining the first interface control document, multiple first structures are traversed, and for the current first structure, it is determined whether the first publish-subscribe type parameter (i.e., pub_sub_type parameter) corresponding to the current first structure 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, and at the same time, the pub_sub_type parameter is filled with DDS_PubSub, and it is continued to be determined whether the first interaction identification parameter (i.e., is_interaction parameter) corresponding to the current first structure meets the second condition.

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

[0059] At this point, after traversing multiple first structures, at least one first structure has been retained. Then, a regular expression is used to read the variable definition line of the structure in the target interface definition language file to obtain the first structure names and first structure contents corresponding to all the retained first structures, wherein all the first structure names are used to fill in DDS_Topic, and all the first structure contents are used to fill in 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, a first interface control document corresponding to the data distribution service network is generated (as shown in Table 1).

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

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

[0062] 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.

[0063] In one embodiment, a first interface control document corresponding to the data distribution service network is generated based on 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 retained first structures, and supplementary information is obtained and added to the first interface control document.

[0064] The supplementary information contains relevant information of other structures except the first structure in the original data distribution service interface control file. The original data distribution service interface control file is a pre-set interface control file, including various relevant information corresponding to various structures, such as publishing and subscription type parameters, interaction flag parameters, structure name, structure content and network variable description, etc. The original data distribution service interface control file can be, for example, an Excel file, which is not limited in this embodiment.

[0065] Specifically, a first interface control document corresponding to the data distribution service network is generated 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 retained first structures. Since the data in the first interface control document is not complete, supplementary information can be determined from the original data distribution service interface control document and added to the first interface control document to improve the first interface control document and enhance the completeness of the first interface control document.

[0066] In some embodiments, the content of each first structure 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 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 parameter, the first interaction flag parameter, the first structure name and the first structure content corresponding to each of the retained first structures; determining a target variable name 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 name including at least one second variable name; determining a second structure corresponding to each of the at least one second variable name, and writing 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 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.

[0067] In the process of determining the first interface control document, the initial first interface control document corresponding to the data distribution service network is first generated 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. 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 is determined by comparing the data carried by the initial first interface document and the original data distribution service interface control document. Specifically, each line in the original data distribution service interface control file is traversed, and from all the second variable names in the original data distribution service interface control file, a target variable name different from all the first variable names in the initial first interface control document is determined, and the target variable name includes at least one second variable name. At this time, all the second variable names can be saved in the existing_variables collection.

[0068] Then, determine the second structure corresponding to at least one second variable name, wherein the relevant information corresponding to all the second structures can be the above-mentioned supplementary information, and then write the second publish-subscribe type parameter, second interaction flag parameter, second structure name and second structure content corresponding to all the 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. The correspondence between the header and the inserted content of the final first interface control document is shown in Table 2 below.

[0069] Table 2

[0070] The first interface control document determined by the above whole process provides a clear and standardized material basis for the efficient implementation of DDS network interface proofreading, debugging and other work.

[0071] 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 rule.

[0072] In this step, 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.

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

[0074] Table 3

[0075] For example, Figure 5 is a schematic diagram of a second interface control document provided by the present invention, such as Figure 5 As 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. SDN_Unit indicates the unit, SDN_RequestName indicates the parameter name, and SDN_Scope indicates the label.

[0076] In some embodiments, 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 may include: determining 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 according to the simulator network data definition rules; determining 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; reverse mapping 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; generating 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; generating 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.

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

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

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

[0080] Table 4

[0081] 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 a reverse 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 reverse mapped with the publish-subscribe type parameters of the simulator network data to obtain a reverse mapping result. For example: when DDS_PubSub is Pub, SDN_PubSub is Sub; when DDS_PubSub is Sub, SDN_PubSub is Pub.

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

[0083] Table 5

[0084] The above-mentioned whole process can form a complete, clear and standardized second interface control document, laying a foundation for the efficient implementation of simulator data interface proofreading, debugging and other work.

[0085] Step 104, 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 the docking code between the simulator data interface and the data distribution service data interface.

[0086] 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. The corresponding class behaviors are to subscribe to data from the simulator network and publish data to the simulator network.

[0087] In some embodiments, when the simulator networking interface code includes the simulator data interface code, the simulator data interface code includes: simulator status data interface definition code, simulator status data interface publish-subscribe code and interactive data interrupt registration code; generating 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 may include the following implementation methods.

[0088] Implementation method 1: According to the data distribution service data definition rules and the simulator network data definition rules, 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, generate the simulator state data interface definition code.

[0089] In this step, the simulator state data interface definition code is used to define certain quantities that are required.

[0090] Exemplarily, load the determined second interface control file, read 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, and then, according to the type of the second publish-subscribe type parameter, splice the contents of the second publish-subscribe type parameter and the second variable name into a simulator publishing interface according to the simulator network data definition rules, and define the string inputs_members and the string outputs_members of the subscription 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 a 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 a new member variable definition string outputs_members before the end position. Finally, write the content of the new interface definition added in the simulator network interface back to the head file, thereby generating the simulator state data interface definition code.

[0091] For example, Figure 6 It is a schematic diagram of the simulator state data interface definition code provided by the present invention, such as Figure 6 As shown, the simulator status data interface definition code is displayed.

[0092] Implementation method 2: Generate the 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 annotations, all second variable annotations, and the topic name of the simulator network in the second interface control document.

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

[0094] Exemplarily, first load the second interface control document, read 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, and then, according to the types of all first variable names and all second variable names, splice 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 content of the topic name of the simulator network into a subscription code string subscribes_str and a publishing 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, 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 publishing code string publish_str before the end position. Finally, the content of the added subscription / publishing code string is written back to the cpp file to generate the simulator state data interface definition code. The whole process can automatically generate the simulator state data interface definition code to avoid manual repeated definition.

[0095] For example, Figure 7 It is a schematic diagram of the simulator state data interface publishing and subscription code provided by the present invention, such as Figure 7 As shown, the simulator status data interface publishing and subscription code is shown.

[0096] Implementation method 3: Generate an interactive data interruption registration 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.

[0097] In this step, the interactive data interrupt registration code has an interrupt handling mechanism, which is suitable for handling special situations.

[0098] Exemplarily, first load the second interface control document, read all the first interaction flag parameters, all the second interaction flag parameters, the subject 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 subject name, the interrupt type attribute and the interrupt request name into the interrupt registration code string register_str according to the simulator network interrupt registration rules. Then open and read the SdnIO.cpp file, and modify its content. Locate the end position of the release function in the SdnIO.cpp file, and insert the interrupt registration code register_str before the end position. Finally, write the content of the added interrupt registration code string back to the cpp file to generate the interactive data interrupt registration code.

[0099] For example, Figure 8 is a schematic diagram of the interactive data interrupt registration code provided by the present invention, such as Figure 8 As shown, the interactive data interrupt registration code is shown.

[0100] In some embodiments, when the simulator networking interface code includes a docking code, the docking code includes: a data distribution service status subscription data mapping code, a data distribution service status publishing data mapping code, and a data distribution service interactive data interruption trigger code. Generating 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 includes: generating the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code based on all the first interactive flag parameters, all the second interactive flag parameters, all the first variable names, and all the 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; generating the data distribution service interactive data interruption trigger code based on all the first interactive flag parameters, all the second interactive flag parameters, the subject name of the simulator network, the interruption type attribute, and the interruption request name in the second interface control document, may include the following implementation methods.

[0101] 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 code and the data distribution service status publishing data mapping code.

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

[0103] 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, and then determine whether the data is an interactive data type based on the values ​​of all the first interaction flag parameters and all the second interaction flag parameters. If the value is true, perform the DDS interactive data interrupt trigger code generation operation. If it is false, it is status data, and the string mapSubscribe_Str assigned to the member variable pointed to by the SdnOutputs class object needs to be spliced ​​according to the DDS value rule. Then open and read the cpp file of the DDSSubscriber class and modify its content. Locate the data validity code position in the data update listener on_data_available function in the DDSSubscriber class program, and add the string mapSubscribe_Str to the function body judged to be valid. Finally, write the content of the string for adding the status subscription data mapping code back to the cpp file, thereby generating the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code.

[0104] The advantage of this setting is that the data distribution service status subscription data mapping code and the data distribution service status release data mapping code are automatically generated without manual docking, thus avoiding laborious manual operations and human errors that may occur during the interface docking process.

[0105] For example, Fig. 9 Schematic diagram of the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code provided by the present invention, such as Fig. 9 As shown, the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code are shown.

[0106] Implementation method 2: Generate a data distribution service interactive data interrupt trigger code based on all first interaction flag parameters, all second interaction flag parameters, the subject name of the simulator network, the interrupt type attribute and the interrupt request name in the second interface control document.

[0107] 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 an interactive data type based on the values ​​of all the first interaction flag parameters and all the second interaction flag parameters. If the value is true, it is necessary to splice the interactive data interruption trigger code string interaction_Str according to the interruption logic trigger rule and the DDS value rule. Then open and read the cpp file of the DDSSubscriber class and modify its content. Locate the data validity code position in the data update listener on_data_available function in the DDSSubscriber class program, and add the string interaction_Str to the function body that is judged to be valid. Finally, write the content of the added interactive data interruption trigger code string back to the cpp file to generate the data distribution service interactive data interruption trigger code.

[0108] For example, Fig.10 Schematic diagram of the data distribution service interactive data interruption trigger code provided by the present invention, such as Fig.10 The data distribution service interactive data interrupt trigger code is shown in the figure. The data distribution service interactive 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 interrupt. Among them, the interrupt request definition carries the interrupt request name (i.e. interrupt name)

[0109] 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, and the simulator networking interface code includes: simulator data interface code, and the docking code between the simulator data interface and the data distribution service data interface. The technical scheme of the present invention can realize the networking between the data distribution service and the simulator by generating the 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 whole process does not require manual interface definition and docking, which improves the development speed and efficiency of the networking between the data distribution service and the simulator, and effectively avoids the human error caused by manual interface processing.

[0110] The simulator networking interface code generating device provided by the present invention is described below. The simulator networking interface code generating device described below and the simulator networking interface code generating method described above can be referenced to each other.

[0111] Fig.11 It is a structural diagram of the simulator networking interface code generation device provided by the present invention, such as Fig.11 As shown, the simulator networking interface code generation device 1100 includes the following structure disassembly module 1101, a first generation module 1102, a second generation module 1103 and a code generation module 1104.

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

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

[0114] The second generating 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 rule.

[0115] The code generation module 1104 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 the docking code between the simulator data interface and the data distribution service data interface.

[0116] In one embodiment, the structure disassembly module 1101 is specifically used to: parse the file content in the interface definition language file to obtain multiple first structures and structure definitions corresponding to the multiple first structures, each structure definition is a first key-value pair, and the first key-value pair is used to store relevant information of the corresponding first structure; according to all relevant information, the multiple first structures are expanded to obtain nested structures; according to the nested structures and the preset output file, the target interface definition language file is determined; the nested structures in the target interface definition language file are disassembled to obtain the disassembled structure information.

[0117] In one implementation, the disassembled structure information includes: a first publish-subscribe type parameter and a first interaction flag parameter corresponding to each of the plurality of first structures.

[0118] In one embodiment, the first generation module 1102 is specifically used 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 if the first interaction identification 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 all the retained first structures; and generate a first interface control document corresponding to the data distribution service network according to the first publish-subscribe type parameter, the first interaction identification parameter, the first structure name and the first structure content corresponding to all the retained first structures.

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

[0120] 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 parameters, first interaction flag parameters, first structure names and first structure contents corresponding to all the retained first structures, and is specifically used to: generate 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 corresponding to all the retained first structures; determine a target variable name 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 name including at least one second variable name; determine a second structure corresponding to at least one second variable name, and write the second publish-subscribe type parameters, second interaction flag parameters, second structure names and second structure contents corresponding to at least one second structure into the initial first interface control document to obtain a first interface control document, and each second structure content includes a corresponding second variable name.

[0121] In one embodiment, 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.

[0122] In one embodiment, the second generation module 1103 is specifically used to: 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 according to the simulator network data definition rules; determine the second key-value pair according to all first variable types and all second variable types, and the variable type of the simulator network data; reverse 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.

[0123] In one implementation, when 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 publishing and subscription code, and interactive data interrupt registration code.

[0124] In one embodiment, the code generation module 1104 generates simulator networking interface code according to data distribution service data definition rules, simulator network data definition rules and second interface control document, and is specifically used to: generate simulator state 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 data distribution service data definition rules and simulator network data definition rules; generate simulator state 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 annotations, all second variable annotations, and the topic name of the simulator network in the second interface control document; generate interactive data interrupt registration code based on all first interaction flag parameters, all second interaction flag parameters, topic name, interrupt type attribute and interrupt request name in the second interface control document.

[0125] In one embodiment, when the simulator networking interface code includes a docking code, the docking code includes: a data distribution service status subscription data mapping code, a data distribution service status publishing data mapping code, and a data distribution service interaction data interruption triggering code.

[0126] In one embodiment, the code generation module 1104 generates a 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, and is specifically used to: generate a data distribution service status subscription data mapping code and a data distribution service status publishing data mapping code 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 according to the data distribution service data definition rules and the simulator network data definition rules; generate a data distribution service interaction data interruption trigger code based on all first interaction flag parameters, all second interaction flag parameters, the simulator network's topic name, the interruption type attribute and the interruption request name in the second interface control document.

[0127] Fig.12 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Fig.12As shown, the electronic device may include: a processor 1210, a communication interface 1220, a memory 1230 and a communication bus 1240, wherein the processor 1210, the communication interface 1220 and the memory 1230 communicate with each other through the communication bus 1240. The processor 1210 may call the logic instructions in the memory 1230 to execute the simulator networking interface code generation method, the method comprising: disassembling the nested structure in the target interface definition language file to obtain the disassembled structure information; generating a first interface control document corresponding to the data distribution service network according to the disassembled structure 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 rule; generating a 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 comprising: a simulator data interface code, and a docking code between the simulator data interface and the data distribution service data interface.

[0128] In addition, the logic instructions in the above-mentioned memory 1230 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0129] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program 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 methods, which includes: disassembling the nested structure in the target interface definition language file to obtain the disassembled structure information; generating a first interface control document corresponding to the data distribution service network based on the disassembled structure information; generating a second interface control document corresponding to the simulator network based on the first interface control document and the simulator network data definition rules; generating a simulator networking interface code based on the data distribution service data definition rules, the simulator network data definition rules and the second interface control document, the simulator networking interface code including: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface.

[0130] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the simulator networking interface code generation method provided by the above-mentioned methods. The method includes: disassembling the nested structures in the target interface definition language file to obtain the disassembled structure information; generating a first interface control document corresponding to the data distribution service network according to the disassembled structure 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 a 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 including: simulator data interface code, and docking code between the simulator data interface and the data distribution service data interface.

[0131] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0132] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for 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.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions 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; Generate a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rule; 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 is generated, and 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.

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 2, characterized in that: The disassembled structure information includes: the first publish-subscribe type parameter and the first interaction flag parameter corresponding to each of the plurality of first structures; and 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 a current first structure, if a first publish-subscribe type parameter corresponding to the current first structure satisfies a first condition, and if a first interaction identifier parameter corresponding to the current first structure satisfies a second condition, retaining the current first structure; Read the target interface definition language file to obtain first structure names and first structure contents corresponding to all retained first structures; A first interface control document corresponding to the data distribution service network is generated 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.

4. The simulator networking interface code generation method according to claim 3, 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.

5. The simulator networking interface code generation method according to claim 4, characterized in that: The contents of each first structure include a first variable type and a first variable annotation; the contents of each second structure include a second variable type and a second variable annotation; the second interface control document corresponding to the simulator network is generated according to the first interface control document and the simulator network data definition rule, including: According to the simulator network data definition rule, 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 are determined as target data corresponding to the simulator network; Determining 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; Reverse mapping 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 the first interaction flag parameters and all the second interaction flag parameters; A second interface control document corresponding to the simulator network is generated according to the target data, the second key-value pair, the reverse mapping result, the interrupt type attribute and the interrupt request name.

6. The simulator networking interface code generation method according to claim 5, characterized in that: 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 publishing and subscription code and 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, including: Generate 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 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 publish-subscribe 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 comments, all the second variable comments, and the topic name of the simulator network in the second interface control document; The interactive data interruption registration code is generated 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.

7. The simulator networking interface code generation method according to claim 5, characterized in that: 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 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, including: Generate the data distribution service status subscription data mapping code and the data distribution service status publishing data mapping code according to the data distribution service data definition rule and the simulator network data definition rule, 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; The data distribution service interactive data interruption trigger code is generated 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.

8. 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 generating module, used for generating a first interface control document corresponding to the data distribution service network according to the disassembled structure information; A second generating module, used for generating a second interface control document corresponding to the simulator network according to the first interface control document and the simulator network data definition rule; A code generation module 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.

9. 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 7 is implemented.

10. 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 7 is implemented.

Citation Information

Patent Citations

  • Cloud side cooperation system and cloud side cooperation method based on native container technology

    CN112559133A

  • Code generation method, device and equipment based on chip clock tree prototype graph

    CN115373685A

  • Vehicle interface test method, device and equipment and storage medium

    CN115982043A

  • Method, device and equipment for generating server code of page

    CN117215580A

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

    CN119182675A

Cited By

  • Automatic conversion method for data structure of vehicle communication system and computing equipment

    CN121187596A