Training simulation platform component interaction method based on interface registration
Through the method based on interface registration, the problem of low communication efficiency between traditional cross-software processes is solved, and the interaction between components of the training simulation platform is efficient, robust and safe. It adapts to different network scenarios and improves communication efficiency and management capabilities. .
Patent Information
- Application Number
- CN202311326887.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-12
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2043-10-12
AI Technical Summary
Traditional cross-software inter-process communication is inefficient and susceptible to network bandwidth and network speed stability. Especially in training simulation platforms, component interaction needs to be simple, efficient and robust. Existing technology cannot meet the needs of different communication scenarios.
Adopt the training simulation platform component interaction method based on interface registration, realize local and remote interface calls through single-process integrated conversion, interface function encapsulation, component interface hierarchical registration, interface query and monitoring, and ensure the security of interface calls through permission token management .
It simplifies the communication process for developers, improves communication efficiency and robustness, supports the adaptation of different network scenarios, realizes efficient management and permission control of inter-process interfaces, and ensures the timeliness and convenience of data collaborative processing.
Smart Images

Figure CN117389683B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of training simulation, and more specifically, to a training simulation platform component interaction method based on interface registration. Background Art
[0002] Traditionally, local or remote transmission and processing of business collaboration data between cross-software processes often requires the use of network communication methods such as TCP point-to-point communication. The data producer sends the generated data to be processed to the data processor, and the data processor returns the data in the same form after processing the data. Specifically, this process requires a series of processes such as establishing network connections, assembling packages, unpacking packages, and interface parsing. The timeliness of communication is limited by network bandwidth and is prone to packet loss. When data has one-to-many requirements, it often requires the use of communication methods such as data buses to meet them.
[0003] Currently, commonly used means of cross-software inter-process communication include point-to-point communication methods such as TCP and UDP, as well as many-to-many data subscription and distribution communication methods completed with the help of bus middleware such as DDS and ZMQ. User software needs to add all of the above communication library files to the code at the same time to meet the communication needs of different scenarios. The communication interfaces agreed in different communication library files are different, so users need to make distinctions and adaptations in the code. The communication efficiency during the application process is affected by the network bandwidth and network speed stability. In addition, in the training simulation platform, the interaction between platform components should be simple, efficient, and stable, especially to cope with network speed fluctuations. It needs to have strong robustness. To this end, it is necessary to develop a training simulation platform component interaction method based on interface registration. Summary of the invention
[0004] The purpose of the present invention is to provide a training simulation platform component interaction method based on interface registration to overcome the defects of the prior art.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0006] The training simulation platform component interaction method based on interface registration includes the following steps:
[0007] S1. Component integration conversion: the software processes of both communicating parties use the single-process integration method of the simulation platform to realize the integration conversion from process to thread, so that the platform can manage the interface in a unified manner (including interface registration, interface query, interface monitoring, etc.);
[0008] S2, interface function encapsulation: the communicating parties encapsulate the communication services they provide to the outside world into function interfaces, which are convenient for other components to call;
[0009] S3, component public interface registration, the communicating parties call the interface registration function provided by the platform interface management component of the simulation platform, register the interface pointer and identification number of their own function, and the platform interface management component saves the interface pointer and identification number of the registrant;
[0010] S4. Component interface hierarchical registration. The communication interface publisher publishes the interface according to the functional scope of the interface it provides, and registers its own function interface pointer, identification number and calling scope to the platform interface management group to achieve the purpose of limiting the scope of interface use. The interface registration method limits the scope of interface call, declares whether the interface is a local interface or a remote interface, and limits the situation of interface call through the interface scope;
[0011] S5. Component interface query: the caller can query various local and remote service interfaces registered on the platform through the platform interface management component, and can obtain the interface class information to be called through the interface query function;
[0012] S6, local interface call, the caller sends an interface call application to the platform. If the interface management component finds that the interface is provided by a local component, the local interface call is started. First, the platform management component is used to start the interface component that provides the service, and then the platform interface management component is used to call the local component interface, and finally the call result is returned to the caller;
[0013] S7, remote interface call, if the interface management component finds that the interface meets the remote interface call, the remote interface call is started, first using the platform management component to start the interface component that provides remote interface access, then the remote interface is called through the platform interface management component, and finally the call is taken over and returned to the caller;
[0014] S8. Interface information monitoring and recording: monitor and record interface calls through the interface management module of the simulation platform, and record the call information of each interface through monitoring.
[0015] Furthermore, in step S3: the registration of the private interface needs to be bound with the interface identifier and the authority token, and the token design adopts a plain text mode, and the token is generated in the form of a module identifier plus an interface name.
[0016] Furthermore, the plug-in level interface in the hierarchical registration of the function interface in step S4 adopts a management key token.
[0017] Furthermore, the interface structure information obtained in step S5 includes specific interface function pointers, interface input parameters and interface return value information.
[0018] Furthermore, the step S6 specifically includes:
[0019] S60, the caller queries the interface;
[0020] S61, the platform interface management module returns an interface function pointer;
[0021] S62, the caller provides interface input parameters and calls the interface;
[0022] S63, the called party executes the called function;
[0023] S64. The function return value is fed back to the caller.
[0024] Furthermore, the key verification process in the calling process of step S6 is implemented by the interface management component of the simulation platform, wherein the caller of the private interface needs to produce a corresponding interface token to have the authority to call the interface, and unauthorized calling requests will be denied access.
[0025] Furthermore, the step S7 specifically includes:
[0026] S70, the interface caller performs an interface query according to the interface identification number. If it is a local interface, the process proceeds to step S6 to perform a local interface call. If it is a remote interface, the process proceeds to step S71;
[0027] S71, the remote interface management component queries the interface information and feeds back the interface information, the local interface management component creates a mirror function structure, encapsulates the function pointer address of the remote function to be called, input parameter information and the mirror function pointer address into a mirror structure, wherein the mirror function is a mirror function template variable created by the local interface management component;
[0028] S72. After the caller calls the mirror function pointer and inputs parameter information, the mirror function packages the input parameter information and the actual function pointer address. The local interface management component transmits the data to the interface management component of the remote training simulation platform through the local training simulation platform, and waits for the result to be returned. After the interface management component of the remote training simulation platform receives the packaged interface call information, it directly calls the local target interface according to the function pointer address and parameter information therein. After the call is completed, the data is returned to the interface management component where the caller is located. After receiving the interface call result, the interface management component returns it to the caller of the mirror function.
[0029] Furthermore, the interface query in step S71 uses a local interface management component to manage interface information, and a remote interface management component to synchronize interface registration information.
[0030] Compared with the prior art, the advantages of the present invention are: (1) the present invention supports both local data interaction and remote data interaction. The usage processes of the two interaction modes are the same for the communication users, and the specific differences are adapted by the training simulation platform. The advantage of this is that for developers, the simulation training platform helps developers shield the complex communication environment. Developers do not need to spend extra energy to pay attention to the differences in communication channels. The entire communication route is transparent and simple for developers and can meet different network communication scenarios; (2) the present invention, with the help of a self-developed training simulation platform, is based on the training simulation platform's requirements for interface service and flexible adaptability of component communication, innovates single-process integration methods, and carries out hierarchical interface registration and debugging. The research on interface token permissions and other aspects has made breakthroughs in key technologies such as interface permission management and inter-process interface calling, and has formed core modules such as platform interface management and token permission management, which can support users to register different interfaces of software modules to the simulation platform with different access levels for interface callers to call, and more efficiently improve the platform's management capabilities of interface permissions and calling processes; (3) For communication components, sampling this method can enable the communicating parties to achieve data interoperability like memory sharing, and ensure the timeliness and convenience of collaborative processing of business data in the process of processing training simulation platform tasks. At the same time, it provides a means of interface service for communication components, and further realizes the business expansion of the communication process through dynamic registration and combination of interfaces. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only 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.
[0032] Figure 1 It is a flow chart of the training simulation platform component interaction method based on interface registration of the present invention.
[0033] Figure 2 This is a flowchart of interface hierarchical registration in the present invention.
[0034] Figure 3 It is a flow chart of the local interface calling process in the present invention.
[0035] Figure 4 It is a flow chart of remote interface calling in the present invention.
[0036] Figure 5 It is a flow chart of the interface calling process in the present invention.
[0037] Figure 6It is a flow chart for realizing the communication of the training simulation platform interface in the present invention.
[0038] Figure 7 This is a diagram showing the effect of implementing interface registration and publishing in the present invention.
[0039] Figure 8 This is a diagram showing the effect of implementing interface monitoring in the present invention. DETAILED DESCRIPTION
[0040] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making a clearer and more definite definition of the protection scope of the present invention.
[0041] The principle of the present invention is: by means of the function call design idea of memory sharing, relying on the existing simulation platform, the communication between software processes is converted into the platform module communication of the thread unit granularity, and the communication speed of the two communicating parties can be significantly improved through the memory interface call method, and it can adapt to different scenarios of point-to-point communication and many-to-many communication at the same time. In order to improve the security and accuracy of communication, shield the interference of interface calls, and reduce the risk of memory attacks, the interface information provided by the two communicating parties to the outside needs to be bound to the permission token. Only after the permission token authentication can the interface be accessed and called. In order to distinguish the scope requirements of interface calls, two levels of interface registration methods are designed: platform level and private level. Among them, once the platform-level interface is registered, it is allowed to be called by all software modules in the platform without permission approval. It belongs to the public service class interface, and the private-level interface can only be called by the software modules allowed within the scope of permission. The interface management mechanism of the simulation platform is responsible for obtaining interface code pointers, interface provider ecological monitoring, providing interface unified query classes, and permission token verification.
[0042] See also Figure 1-Figure 6 As shown, this embodiment discloses a training simulation platform component interaction method based on interface registration, comprising the following steps:
[0043] Step S1: The software processes of the two communicating parties use the single process integration method of the simulation platform to realize the integrated conversion from process to thread.
[0044] Step S2: interface encapsulation: both communicating parties encapsulate the communication services they provide to the outside world into a function interface.
[0045] Step S3, interface registration. The communicating parties call the interface registration function provided by the platform interface management component of the simulation platform, register the interface pointer and identification number of their own function, and the platform interface management component saves the interface pointer and identification number of the registrant for subsequent query and call by the caller.
[0046] Among them, the registration of private-level interfaces needs to be bound to the interface identifier and the permission token. The token design can be in plain text to generate the token based on the module identifier plus the interface name.
[0047] Step S4, hierarchical registration of component interfaces. The communication interface publisher publishes the interface according to the functional scope of the interface it provides, and registers its own function interface pointer, identification number and calling scope to the platform interface management group to achieve the purpose of limiting the scope of interface use. This interface registration method limits the scope of interface call use, such as Figure 2 shown.
[0048] Step S5, interface query: After the interface registration is completed, the interface caller determines the identification number of the interface provider to be called and obtains the interface class information to be called through the interface query function of the platform interface management component. The obtained interface structure information includes the specific interface function pointer, interface input parameters and interface return value information.
[0049] Step S6: local interface call. The caller sends an interface call request to the platform. If the interface management component finds that the interface is provided by a local component, the local interface call is started. First, the platform management component is used to start the interface component that provides the service. Then, the platform interface management component is used to call the local component interface. Finally, the call result is returned to the caller. Figure 3 As shown in the figure, the stand-alone interface calling process specifically includes:
[0050] Step S60: The caller queries the interface;
[0051] Step S61, the platform interface management module returns an interface function pointer;
[0052] Step S62: The caller provides interface input parameters and calls the interface;
[0053] Step S63: the called party executes the called function;
[0054] Step S64: The function return value is fed back to the caller.
[0055] Specifically, the key verification process during the calling process is implemented by the interface management component of the simulation platform, in which the caller of the private interface must produce the corresponding interface token to have the authority to call the interface, and unauthorized calling requests will be denied access.
[0056] Step S7, remote interface call, the interface call and data interaction between the two remote communication parties need to rely on the communication means of the training simulation platform itself, which is different from the local interface call in that, first, the registered interface information needs to be synchronized in the interface management component of the training simulation platform on different remote computers, second, the interface conversion during function pointer call, and third, the data transmission between platforms, such as Figure 4 As shown, the remote interface call process includes:
[0057] Step S70: The interface caller performs an interface query based on the interface identification number. If it is a local interface, it proceeds to step S6 to perform a single-machine interface call. If it is a remote interface, it proceeds to step S71.
[0058] Step S71, the remote interface management component queries the interface information and feeds back the interface information. The local interface management component creates a mirror function structure to encapsulate the function pointer address, input parameter information and mirror function pointer address of the remote function to be called into a mirror structure, where the mirror function is a mirror function template variable created by the local interface management component. The interface query uses the local interface management component to manage the interface information, and the remote interface management component synchronizes the interface registration information.
[0059] Step S72, after the caller calls the mirror function pointer and inputs parameter information, the mirror function packages the input parameter information and the actual function pointer address, and the local interface management component transmits the data to the interface management component of the remote training simulation platform through the local training simulation platform, and waits for the result to be returned. After the interface management component of the remote training simulation platform receives the packaged interface call information, it directly calls the local target interface according to the function pointer address and parameter information therein, and after the call is completed, the data is returned to the interface management component where the caller is located. After receiving the interface call result, the interface management component returns it to the caller of the mirror function.
[0060] Step S8: Monitor and record the remote interface calls through the interface management module of the simulation platform as the audit basis for the interface security. Figure 5 As shown, the communication process is as follows Figure 6 shown.
[0061] The present invention relies on a training simulation platform, and utilizes the platform's componentization and interface registration mechanism to encapsulate the data interaction requirements of both parties in inter-process communication into an interface, and completes the data interaction between the two parties in communication through interface calls. The routing addressing and data forwarding processes of the interface calls are completed by the simulation platform. The entire data link building process is transparent to both parties in communication, which simplifies the data interaction process. The following Table 1 shows the performance comparison between the communication means of the present invention and other communication means. It can be seen that the present invention does not build a link, but has reliable transmission. It is not affected by bandwidth in a single machine, but is affected by bandwidth in a remote machine, and can achieve one-to-many or many-to-many communication. Finally, the platform component can register and uninstall the interface through the platform. During the registration and uninstallation process, it is necessary to declare information such as the interface name and interface ID. The user can view the interface information in all components through the platform, and can monitor and manage the interface in real time. The specific implementation is as follows: Figure 7 and Figure 8 shown.
[0062] Table 1
[0063]
[0064] Although the embodiments of the present invention are described in conjunction with the accompanying drawings, the patent owner may make various variations or modifications within the scope of the appended claims. As long as they do not exceed the protection scope described in the claims of the present invention, they should be within the protection scope of the present invention.
Claims
1. A training simulation platform component interaction method based on interface registration, characterized in that: The following steps are involved: S1. Component integration conversion: the software processes of both communicating parties use the single-process integration method of the simulation platform to realize the integration conversion from process to thread, so that the platform can manage the interface in a unified manner; S2, interface function encapsulation: the communicating parties encapsulate the communication services they provide to the outside world into function interfaces, which are convenient for other components to call; S3, component public interface registration, the communicating parties call the interface registration function provided by the platform interface management component of the simulation platform, register the interface pointer and identification number of their own function, and the platform interface management component saves the interface pointer and identification number of the registrant; S4. Component interface hierarchical registration. The communication interface publisher publishes the interface according to the functional scope of the interface it provides, and registers its own function interface pointer, identification number and calling scope to the platform interface management group to achieve the purpose of limiting the scope of interface use. The interface registration method limits the scope of interface call, declares whether the interface is a local interface or a remote interface, and limits the situation of interface call through the interface scope; S5. Component interface query: the caller can query various local and remote service interfaces registered on the platform through the platform interface management component, and can obtain the interface class information to be called through the interface query function; S6, local interface call, the caller sends an interface call application to the platform. If the interface management component finds that the interface is provided by a local component, the local interface call is started. First, the platform management component is used to start the interface component that provides the service, and then the platform interface management component is used to call the local component interface, and finally the call result is returned to the caller; S7, remote interface call, if the interface management component finds that the interface meets the remote interface call, the remote interface call is started, first using the platform management component to start the interface component that provides remote interface access, then the remote interface is called through the platform interface management component, and finally the call is taken over and returned to the caller; S8. Interface information monitoring and recording: monitor and record interface calls through the interface management module of the simulation platform, and record the call information of each interface through monitoring.
2. The training simulation platform component interaction method based on interface registration according to claim 1 is characterized in that: In step S3: the registration of the private interface needs to be bound with the interface identifier and the authority token. The token design adopts a plain text mode and generates the token in the form of module identifier plus interface name.
3. The training simulation platform component interaction method based on interface registration according to claim 1, characterized in that: The step S4 uses a management key token to register the plug-in level interface in the hierarchical registration of the component interface.
4. The training simulation platform component interaction method based on interface registration according to claim 1 is characterized in that: The interface structure information obtained in step S5 includes a specific interface function pointer, interface input parameters and interface return value information.
5. The training simulation platform component interaction method based on interface registration according to claim 1, characterized in that: The step S6 specifically includes: S60, the caller queries the interface; S61, the platform interface management module returns an interface function pointer; S62, the caller provides interface input parameters and calls the interface; S63, the called party executes the called function; S64. The function return value is fed back to the caller.
6. The training simulation platform component interaction method based on interface registration according to claim 1 is characterized in that: The step S7 specifically includes: S70, the interface caller performs an interface query according to the interface identification number. If it is a local interface, the process proceeds to step S6 to perform a local interface call. If it is a remote interface, the process proceeds to step S71; S71, the remote interface management component queries the interface information and feeds back the interface information, the local interface management component creates a mirror function structure, encapsulates the function pointer address of the remote function to be called, input parameter information and the mirror function pointer address into a mirror structure, wherein the mirror function is a mirror function template variable created by the local interface management component; S72. After the caller calls the mirror function pointer and inputs parameter information, the mirror function packages the input parameter information and the actual function pointer address. The local interface management component transmits the data to the interface management component of the remote training simulation platform through the local training simulation platform, and waits for the result to be returned. After the interface management component of the remote training simulation platform receives the packaged interface call information, it directly calls the local target interface according to the function pointer address and parameter information therein. After the call is completed, the data is returned to the interface management component where the caller is located. After receiving the interface call result, the interface management component returns it to the caller of the mirror function.
7. The training simulation platform component interaction method based on interface registration according to claim 6 is characterized in that: The interface query in step S71 uses a local interface management component to manage interface information, and a remote interface management component to synchronize interface registration information.
