Method and system for dynamic switching of data sources of soft and hard panels of flight simulator based on shared memory

Through shared memory and dynamic thread pooling technology, the variable-level precise switching of the flight simulator data source is achieved, solving the problems of high latency, waste of resources and high maintenance costs in the existing technology, and improving the system response speed and maintenance efficiency.

CN120316170BActive Publication Date: 2025-09-02CHINA SOUTHERN TECHNOLOGY (GUANGDONG HENGQIN) CO LTD

Patent Information

Application Number
CN202510771488.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-11
Publication Date
2025-09-02
Estimated Expiration
2045-06-11

AI Technical Summary

Technical Problem

The existing flight simulator data source switching technology cannot realize independent control of a single signal variable, resulting in the risk of misoperation; the polling detection mechanism causes high latency in high variable scenarios, and the fixed threading architecture causes the risk of resource waste and data loss; the new equipment needs to be recompiled to drive, resulting in a long hardware adaptation cycle and high maintenance costs.

Method used

Using a shared memory-based method, by building database relationship-bound tables and dynamic thread pools, we can achieve variable-level precise switching, reduce data transmission overhead, dynamically adjust the number of threads, and use zero-copy data transmission technology to improve data synchronization efficiency and system response speed.

Benefits of technology

It realizes variable-level accurate data source switching, reduces switching delay, improves system response speed and maintenance efficiency, and reduces hardware adaptation cycle and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120316170B_ABST
    Figure CN120316170B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of data processing, and specifically relates to a method and system for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory. The method aims to solve the problems of high latency, waste of resources, risk of data loss, and high maintenance costs in the prior art. The present invention comprises the following steps: constructing a database relationship binding table; establishing a corresponding data structure; initializing shared memory and updating variable addresses; associating data structures and defining data source switch parameters; activating a source switching judgment thread and a working thread; running a module to cause the soft and hard panels to write data according to the switch state; and releasing resources upon exit. The present invention achieves variable-level precise switching, avoids redundant switching through database binding tables and state variables; uses shared memory technology to improve data synchronization efficiency and system stability; uses dynamic thread management to reduce switching delays and improve response performance; and simultaneously improves simulator fault diagnosis and maintenance efficiency, reducing debugging time and costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of data processing, and in particular relates to a method and system for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory. Background Art

[0002] The existing flight simulator data source switching technology generally adopts the following solutions:

[0003] Integrated switching architecture: switch the data source of the entire panel through hardware jumpers or configuration files

[0004] Polling detection mechanism: Periodically traverses all variable states, with response time usually in milliseconds. Static thread allocation: A fixed number of worker threads handle data source switching requests.

[0005] (1) Coarse-grained operation restrictions

[0006] Independent control of individual signal variables is impossible. Switching requires synchronous modification of the entire panel's data source, leading to the risk of misoperation. For example, when only the sensor data of a particular instrument needs to be changed, the existing system still requires switching the entire joystick's input source.

[0007] (2) Synchronization delay problem

[0008] When polling is used to detect state changes, the system response time increases linearly when the number of variables exceeds 100,000. Actual measurement data shows that the state update delay can reach over 200ms in a scenario with 500,000 variables.

[0009] (3) Waste of resources

[0010] The fixed thread architecture has a CPU idle rate of 30%-50% under light load, and thread blocking may occur during sudden switching requests, resulting in data loss.

[0011] (4) High maintenance costs

[0012] Every time a new device is added, the underlying driver needs to be recompiled, and the hardware adaptation cycle is as long as 2-3 weeks, which cannot meet the needs of rapid iteration.

[0013] Based on this, the present invention proposes a method and system for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory. Summary of the Invention

[0014] In order to solve the above-mentioned problems in the prior art, namely, the coarse-grained overall switching architecture makes it impossible to achieve independent control of a single variable, the polling detection mechanism causes high latency (up to 200ms in a scenario with 500,000 variables), the fixed thread architecture causes resource waste (30%-50% CPU idle rate under light load) and the risk of data loss during sudden requests, and the need to recompile drivers for newly added devices, resulting in a long hardware adaptation cycle (2-3 weeks) and high maintenance costs, the present invention provides a method and system for dynamic switching of data sources for soft and hard panels of a flight simulator based on shared memory.

[0015] In a first aspect of the present invention, a method for dynamically switching data sources of a flight simulator's soft and hard panels based on shared memory is provided. The method comprises the following steps:

[0016] A method for dynamically switching data sources of a flight simulator soft and hard panel based on shared memory, the method comprising the following steps:

[0017] Step S1, constructing a database relationship binding table, including a simulator variable information table, a variable state parameter and simulation variable binding table, a soft panel variable and simulation variable binding table, and a hardware device and simulation variable binding table;

[0018] Step S2, establishing a corresponding data structure based on the database relationship binding table;

[0019] Step S3, initialize the shared memory, create a shared memory area according to the information of each variable in the simulator, and update the address information of all variables in the memory;

[0020] Step S4, associating the data structure in step S2 with the simulation variable ID and the variable name to generate an internal data structure; defining a data source type switch parameter in the internal data structure, and setting a pointer to the memory address of the data source type switch parameter in the soft panel variable binding structure and the hardware device variable binding structure;

[0021] Step S5: Create and activate a source switching judgment thread and a data source switching work thread;

[0022] Step S6, running the data source switching module so that the soft panel processing module and the hardware signal processing module determine whether to write the data into the shared memory according to the source switch state;

[0023] Step S7: When exiting the data source switching module, all threads are stopped and memory resources are released.

[0024] Furthermore, the simulator variable information table includes variable ID, variable name, data type, shared memory name, memory address and system;

[0025] The variable state parameter and simulation variable binding table associates the state variable ID with the simulation variable ID;

[0026] The soft panel variable and simulation variable binding table associates the soft panel variable ID with the simulation variable ID;

[0027] The hardware device and simulation variable binding table includes a device ID, a channel ID and a simulation variable ID.

[0028] Furthermore, the data structure in step S2 includes a variable information structure, a soft panel variable binding structure, a hardware device variable binding structure, a variable state parameter and a simulation variable binding structure.

[0029] Furthermore, the variable information structure stores fields of the simulator variable information table;

[0030] The soft panel variable binding structure stores the binding relationship between the soft panel variable ID and the simulation variable ID;

[0031] The hardware device variable binding structure stores the binding relationship between the device ID, the channel ID and the simulation variable ID;

[0032] The variable state parameter and simulation variable binding structure stores the association relationship between the state variable ID and the simulation variable ID.

[0033] Furthermore, a shared memory area is created based on the information of each variable in the simulator, and the address information of all variables in the memory is updated, specifically:

[0034] The shared memory area is created according to the shared memory name in the simulator variable information table;

[0035] The shared memory address is updated based on the actual physical address of the shared memory created.

[0036] Furthermore, the data source type switch parameter is a Boolean flag, which is used to identify the current signal source type.

[0037] Furthermore, the source switching judgment thread is used to monitor the state variable changes of the data source type in the shared memory in real time and trigger a data source switching request;

[0038] The source switching judgment thread monitors the state variables of the data source type in the shared memory at a fixed frequency, and activates the working thread through an event when the state changes;

[0039] The data source switching worker thread processes the source switch state update of the specified simulation variable according to the dynamically calculated number of threads;

[0040] The number of the data source switching working threads is dynamically calculated based on the total number of variables and the number of variables processed by a single thread, and is used to update the source switch status of the simulation variables in parallel.

[0041] Furthermore, when the soft panel processing module or the hardware signal processing module writes data into the shared memory, if the current source switch type matches the module itself, the data is updated to the simulation variable address of the shared memory; if the current source switch type does not match the module itself, the update is skipped and the next cycle is entered.

[0042] Furthermore, the method further includes at least one of the following after step S7:

[0043] Mapping the soft panel address and the hardware device address to the same memory space through dual-binding address mapping; and / or

[0044] Use a dynamic thread pool scheduling algorithm to adjust the number of worker threads based on system load; and / or

[0045] Zero-copy data transfer is achieved through memory barrier synchronization technology.

[0046] Another aspect of the present invention provides a system for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory, and a method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory. The system includes:

[0047] A binding table construction module is configured to construct a database relationship binding table, including a simulator variable information table, a variable state parameter and simulation variable binding table, a soft panel variable and simulation variable binding table, and a hardware device and simulation variable binding table;

[0048] A data structure establishment module configured to establish a corresponding data structure based on the database relationship binding table;

[0049] An initialization module is configured to initialize the shared memory, create a shared memory area according to the information of each variable in the simulator, and update the address information of all variables in the memory;

[0050] a data association integration module configured to associate the data structures in the data structure establishment module with the simulation variable ID and the variable name to generate an internal data structure; define a data source type switch parameter in the internal data structure, and set a pointer in the soft panel variable binding structure and the hardware device variable binding structure to point to the memory address of the data source type switch parameter;

[0051] A thread initialization module is configured to create and activate a source switching judgment thread and a data source switching working thread;

[0052] a shared memory data writing module configured to run the data source switching module so that the soft panel processing module and the hardware signal processing module determine whether to write data into the shared memory according to the source switch state;

[0053] The resource release module is configured to stop all threads and release memory resources when exiting the data source switching module.

[0054] Beneficial effects of the present invention:

[0055] Variable-level precise switching: By binding database relational tables and corresponding Boolean state variables, data source switching accurate to the variable level is achieved, avoiding unnecessary data source switching and improving the accuracy and efficiency of data processing.

[0056] Efficient data synchronization: Using shared memory for data synchronization reduces data transmission overhead, improves the speed and stability of data synchronization, and ensures the real-time performance and reliability of the system.

[0057] Reduce switching delay: By dynamically creating data source switching work threads, parallel processing is achieved, effectively reducing data switching delay and improving system response speed and performance.

[0058] Improve maintenance efficiency: This method has important application value in the fault diagnosis, maintenance and equipment debugging of real / simulated components in the simulator cockpit. It can improve fault diagnosis and maintenance efficiency and save debugging time and costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Other features, objects and advantages of the present application will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0060] Figure 1 This is an overall flow chart of a method for dynamically switching data sources of a flight simulator's soft and hard panels based on shared memory according to the present invention;

[0061] Figure 2 It is a schematic diagram of whether data is written into the shared memory in a method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory of the present invention;

[0062] Figure 3 The present invention is a schematic diagram of a data switching process of a flight simulator soft and hard panel data source dynamic switching system based on shared memory. DETAILED DESCRIPTION

[0063] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.

[0064] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0065] A first embodiment of the present invention provides a method for dynamically switching data sources of a flight simulator's soft and hard panels based on shared memory, the method comprising the following steps:

[0066] Step S1, constructing a database relationship binding table, including a simulator variable information table, a variable state parameter and simulation variable binding table, a soft panel variable and simulation variable binding table, and a hardware device and simulation variable binding table;

[0067] Step S2, establishing a corresponding data structure based on the database relationship binding table;

[0068] Step S3, initialize the shared memory, create a shared memory area according to the information of each variable in the simulator, and update the address information of all variables in the memory;

[0069] Step S4, associating the data structure in step S2 with the simulation variable ID and the variable name to generate an internal data structure; defining a data source type switch parameter in the internal data structure, and setting a pointer to the memory address of the data source type switch parameter in the soft panel variable binding structure and the hardware device variable binding structure;

[0070] Step S5: Create and activate a source switching judgment thread and a data source switching work thread;

[0071] Step S6, running the data source switching module so that the soft panel processing module and the hardware signal processing module determine whether to write the data into the shared memory according to the source switch state;

[0072] Step S7: When exiting the data source switching module, all threads are stopped and memory resources are released.

[0073] In order to more clearly illustrate the method for dynamically switching data sources of a flight simulator soft and hard panel based on shared memory of the present invention, the following is combined with Figure 1 Each step in the embodiment of the present invention is described in detail as follows:

[0074] Step S1, constructing a database relationship binding table, including a simulator variable information table, a variable state parameter and simulation variable binding table, a soft panel variable and simulation variable binding table, and a hardware device and simulation variable binding table;

[0075] In this embodiment, in order to achieve accurate binding of the virtual cockpit soft panel and the signal variables of the onboard hardware devices and support variable-level data source switching, the following database relationship binding table is constructed:

[0076] Simulator Variable Information Table: This table records detailed information about various variables in the simulator system, including the variable ID, variable name, variable data type, shared memory name, address within shared memory, and the system to which the variable belongs. This table includes a set of global variables for storing all parameter variables required for simulator simulation. Additionally, a set of Boolean state variables is provided for hardware signals or virtual soft panel variables collected through the interface system. Virtual soft panel signals are stored in a specific shared memory area, and signal acquisition is performed using a memory copy method.

[0077] Variable state parameter and simulation variable binding table: This table establishes the association between the state variable ID and the simulation variable ID, providing a basis for determining the data source of the simulation variable according to the change of the state variable when the data source is switched.

[0078] Soft panel variable and simulation variable binding table: This table associates the soft panel variable ID with the simulation variable ID, and clarifies the correspondence between the soft panel signal and the simulation variable.

[0079] Hardware Device and Simulation Variable Binding Table: Contains the device ID, channel ID, and simulation variable ID, and is used to establish binding relationships between hardware device signals and simulation variables. Binding hardware devices and simulation variables may involve multiple table associations; only key attributes are listed here.

[0080] Based on the actual configuration and requirements of the simulator equipment, complete the data binding work of the above tables to ensure accurate association between signal variables.

[0081] In practical applications, the simulator variable information table, variable state parameter and simulation variable binding table, soft panel variable and simulation variable binding table, and hardware device and simulation variable binding table are first designed and created based on the simulator system's functional requirements and hardware configuration. Then, based on the specific circumstances of the actual simulator equipment, the relevant information for each signal variable is accurately entered into the corresponding table to complete the data binding process. For example, signal variables on the virtual cockpit soft panel are bound to corresponding simulation variables, and signal variables on onboard hardware devices are bound to corresponding simulation variables. A corresponding Boolean state variable is defined for each signal variable.

[0082] Step S2, establishing a corresponding data structure based on the database relationship binding table;

[0083] The data structure in this embodiment includes a variable information structure, a soft panel variable binding structure, a hardware device variable binding structure, a variable state parameter and a simulation variable binding structure.

[0084] The variable information structure stores the fields of the simulator variable information table; specifically, it is used to store various information in the simulator variable information table, such as variable ID, variable name, data type, etc., to provide a basis for subsequent data processing and operations.

[0085] The soft panel variable binding structure stores the binding relationship between the soft panel variable ID and the simulation variable ID, which facilitates rapid positioning and access to related data.

[0086] The hardware device variable binding structure stores the binding relationship between the device ID, the channel ID and the simulation variable ID, and supports the association operation between the hardware device signal and the simulation variable.

[0087] The variable state parameter and simulation variable binding structure stores the association relationship between the state variable ID and the simulation variable ID, providing data support for the logical judgment of data source switching.

[0088] When the system starts, these data structures are initialized, the data in the database are read into the corresponding data structures, and a shared memory is created based on the information of each variable in the simulator, and the address information of all variables in the memory is initialized.

[0089] Step S3, initialize the shared memory, create a shared memory area according to the information of each variable in the simulator, and update the address information of all variables in the memory;

[0090] Specifically:

[0091] The shared memory area is created according to the shared memory name in the simulator variable information table;

[0092] The shared memory address is updated based on the actual physical address of the shared memory created.

[0093] In this embodiment, since the data source switching function module is part of the interface system software and all functions are implemented based on shared memory, the shared memory of all variables needs to be initialized during the system startup phase. The specific operations are as follows:

[0094] Create corresponding shared memory areas based on the information of each variable in the simulator.

[0095] According to the actual shared memory address created, the address information of all variables in the memory is updated to ensure accurate storage and access of data.

[0096] Step S4, associating the data structure in step S2 with the simulation variable ID and the variable name to generate an internal data structure; defining a data source type switch parameter in the internal data structure, and setting a pointer to the memory address of the data source type switch parameter in the soft panel variable binding structure and the hardware device variable binding structure;

[0097] The data source type switch parameter is a Boolean flag, which is used to identify the current signal source type.

[0098] In this embodiment, the interface system calls the initialization function of the data source switching module and passes in the variable information structure, the soft panel variable binding structure, the hardware device variable binding structure, and the simulation mechanism configuration information. The following operations are performed within the function:

[0099] According to the simulation structure information, the relationship information between the variable state parameters and the simulation variables is read, and the variable state parameters and the simulation variable binding structure are initialized.

[0100] Create an internal data structure to associate and integrate the variable information structure, soft panel variable binding structure, hardware device variable binding structure, variable status parameters and simulation variable binding structure through key information such as simulation variable ID and variable name in each table.

[0101] A variable's data source type switch parameter is defined in the internal data structure. This parameter is used to store the input source type of the current variable (soft panel or hardware device) and serves as the core control parameter for data source switching.

[0102] A pointer type parameter is set in the soft panel variable binding structure and the hardware device variable binding structure to point to the memory address of the data source type switch, so that the software and hardware signal processing modules in the interface system can obtain the current data source type switch value in real time through the memory address, laying the foundation for subsequent data source switching operations.

[0103] The interface system calls the initialization function of the data source switching module, passing in relevant parameters to perform data association and thread initialization. During this data association and integration process, the various data structures are associated using simulation variable IDs and variable names, creating an internal data structure. The data source type switch parameters for the variables are defined, and pointers are set in the soft panel variable binding structure and the hardware device variable binding structure to point to the memory address of the switch. During thread initialization, a source switching judgment thread and a data source switching worker thread are created, responsible for monitoring the data source switching status and updating the source switch status, respectively.

[0104] When all initialization work is completed, the interface system calls the run function of the source switching module to activate the suspended thread. When writing data, the soft panel processing module and the hardware signal processing module determine whether to update the data to the shared memory based on the value of the source switching switch.

[0105] Step S5: Create and activate a source switching judgment thread and a data source switching work thread;

[0106] The source switching judgment thread is used to monitor the state variable changes of the data source type in the shared memory in real time and trigger a data source switching request;

[0107] The source switching judgment thread monitors the state variables of the data source type in the shared memory at a fixed frequency, and activates the working thread through an event when the state changes;

[0108] The data source switching worker thread processes the source switch state update of the specified simulation variable according to the dynamically calculated number of threads;

[0109] The number of the data source switching working threads is dynamically calculated based on the total number of variables and the number of variables processed by a single thread, and is used to update the source switch status of the simulation variables in parallel.

[0110] The source switching judgment thread is the only one that exists, monitoring the state variables related to the data source type in the instructor's console in shared memory at a fixed frequency in real time. When the user selects the entire panel or a specific signal variable on the instructor's console to set the data signal to switch, the instructor's console software updates the state variable value of the data source type (indicating whether the data source type is a soft panel input or a hardware device input) and sets the state parameter variable of the simulation variable to be switched in shared memory to True. When the source switching judgment thread detects a change in the state variable value of the data source type, it notifies the instructor via the corresponding parameter that the request has been received. Upon receipt, the instructor resets the state variable value of the data source type. The thread then compares the state variable value of the data source type with the previous data source switch state. If there is a difference, the data source switch request is activated, the current data source state is saved and updated, and the worker thread is activated via an event.

[0111] The number of data source switching worker threads is dynamically calculated and created based on the number of variables processed by each thread and the total number of variables. The worker threads, acting as events, wait for the judgment thread to wake up and are responsible for updating the data source type switch status of the specified simulation variable. Specifically, they assign source switches to each variable in the soft and hard panel's variable binding table based on the state of the Boolean state variable corresponding to each signal variable and the requested data source type. Because the corresponding variables in the soft and hard panel's variable binding table are associated with the memory address of the data source type switch, the relevant modules can directly obtain status updates, reducing data switching latency and enabling parallel processing.

[0112] Step S6, running the data source switching module so that the soft panel processing module and the hardware signal processing module determine whether to write the data into the shared memory according to the source switch state;

[0113] See also Figure 2 After all initialization work is completed, the interface system calls the run function of the source switching module, activates the suspended thread, and starts the workflow of the data source switching module. At this time, when the soft panel processing module or the hardware signal processing module writes data to the shared memory, if the current source switch type matches the module itself, the data is updated to the simulation variable address of the shared memory; if the current source switch type does not match the module itself, the update is skipped and the next cycle begins.

[0114] Step S7: When exiting the data source switching module, all threads are stopped and memory resources are released.

[0115] The method further includes at least one of the following after step S7:

[0116] Mapping the soft panel address and the hardware device address to the same memory space through dual-binding address mapping; and / or

[0117] Use a dynamic thread pool scheduling algorithm to adjust the number of worker threads based on system load; and / or

[0118] Zero-copy data transfer is achieved through memory barrier synchronization technology.

[0119] Although the various steps in the above embodiment are described in the above-mentioned order, those skilled in the art will understand that in order to achieve the effect of this embodiment, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in a reverse order. These simple changes are within the scope of protection of the present invention.

[0120] See also Figure 3 The second embodiment of the present invention provides a system for dynamically switching data sources of a flight simulator's soft and hard panels based on shared memory. The system is based on a method for dynamically switching data sources of a flight simulator's soft and hard panels based on shared memory according to the first embodiment. The system includes:

[0121] A binding table construction module is configured to construct a database relationship binding table, including a simulator variable information table, a variable state parameter and simulation variable binding table, a soft panel variable and simulation variable binding table, and a hardware device and simulation variable binding table;

[0122] A data structure establishment module configured to establish a corresponding data structure based on the database relationship binding table;

[0123] An initialization module is configured to initialize the shared memory, create a shared memory area according to the information of each variable in the simulator, and update the address information of all variables in the memory;

[0124] a data association integration module configured to associate the data structures in the data structure establishment module with the simulation variable ID and the variable name to generate an internal data structure; define a data source type switch parameter in the internal data structure, and set a pointer in the soft panel variable binding structure and the hardware device variable binding structure to point to the memory address of the data source type switch parameter;

[0125] A thread initialization module is configured to create and activate a source switching judgment thread and a data source switching working thread;

[0126] a shared memory data writing module configured to run the data source switching module so that the soft panel processing module and the hardware signal processing module determine whether to write data into the shared memory according to the source switch state;

[0127] The resource release module is configured to stop all threads and release memory resources when exiting the data source switching module.

[0128] In this embodiment, the data structure establishment module and the initialization module together constitute a core submodule, which is connected to the initialization module and the thread pool controller for reading and operating data structures and managing threads.

[0129] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process and related instructions of the system described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0130] It should be noted that the above embodiment provides a shared memory-based flight simulator soft and hard panel data source dynamic switching system, which is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the modules or steps in the embodiments of the present invention can be further decomposed or combined. For example, the modules in the above embodiments can be combined into one module or further divided into multiple sub-modules to complete all or part of the functions described above. The names of the modules and steps involved in the embodiments of the present invention are only for the purpose of distinguishing the modules or steps and are not to be regarded as improper limitations on the present invention.

[0131] An electronic device according to a third embodiment of the present invention includes:

[0132] at least one processor; and

[0133] a memory communicatively connected to at least one of the processors; wherein,

[0134] The memory stores instructions that can be executed by the processor, and the instructions are used to be executed by the processor to implement the above-mentioned method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory.

[0135] A computer-readable storage medium according to a fourth embodiment of the present invention stores computer instructions, which are used to be executed by the computer to implement the above-mentioned method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory.

[0136] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes and related instructions of the storage device and processing device described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0137] Those skilled in the art should be able to appreciate that the modules and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two, and the programs corresponding to the software modules and method steps can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the art. In order to clearly illustrate the interchangeability of electronic hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in electronic hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0138] The terms "first", "second", etc. are used to distinguish similar objects, rather than to describe or indicate a particular order or sequence.

[0139] The term "comprise" or any other similar term is intended to cover non-exclusive inclusion such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed or inherent to such process, method, article, or apparatus.

[0140] Thus far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will fall within the scope of protection of the present invention.

Claims

1. A method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory, characterized in that: The method comprises the following steps: Step S1, constructing a database relationship binding table, including a simulator variable information table, a variable state parameter and simulation variable binding table, a soft panel variable and simulation variable binding table, and a hardware device and simulation variable binding table; Step S2, establishing a corresponding data structure based on the database relationship binding table; Step S3, initialize the shared memory, create a shared memory area according to the information of each variable in the simulator, and update the address information of all variables in the memory; Step S4, associating the data structure in step S2 with the simulation variable ID and the variable name to generate an internal data structure; defining a data source type switch parameter in the internal data structure, and setting a pointer to the memory address of the data source type switch parameter in the soft panel variable binding structure and the hardware device variable binding structure; Step S5: Create and activate a source switching judgment thread and a data source switching work thread; Step S6, running the data source switching module so that the soft panel processing module and the hardware signal processing module determine whether to write the data into the shared memory according to the source switch state; Step S7: When exiting the data source switching module, all threads are stopped and memory resources are released.

2. The method for dynamically switching data sources of a flight simulator soft and hard panels based on shared memory according to claim 1, characterized in that: The simulator variable information table includes variable ID, variable name, data type, shared memory name, memory address and system; The variable state parameter and simulation variable binding table associates the state variable ID with the simulation variable ID; The soft panel variable and simulation variable binding table associates the soft panel variable ID with the simulation variable ID; The hardware device and simulation variable binding table includes a device ID, a channel ID and a simulation variable ID.

3. The method for dynamically switching data sources of a flight simulator soft and hard panels based on shared memory according to claim 1, characterized in that: The data structure in step S2 includes a variable information structure, a soft panel variable binding structure, a hardware device variable binding structure, a variable state parameter and a simulation variable binding structure.

4. The method for dynamically switching data sources of a flight simulator soft and hard panels based on shared memory according to claim 3, characterized in that: The variable information structure stores fields of the simulator variable information table; The soft panel variable binding structure stores the binding relationship between the soft panel variable ID and the simulation variable ID; The hardware device variable binding structure stores the binding relationship between the device ID, the channel ID and the simulation variable ID; The variable state parameter and simulation variable binding structure stores the association relationship between the state variable ID and the simulation variable ID.

5. The method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory according to claim 3, characterized in that: Create a shared memory area based on the information of each variable in the simulator and update the address information of all variables in the memory, specifically: The shared memory area is created according to the shared memory name in the simulator variable information table; The shared memory address is updated based on the actual physical address of the shared memory created.

6. The method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory according to claim 1, characterized in that: The data source type switch parameter is a Boolean flag used to identify the current signal source type.

7. The method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory according to claim 1, characterized in that: The source switching judgment thread is used to monitor the state variable changes of the data source type in the shared memory in real time and trigger a data source switching request; The source switching judgment thread monitors the state variables of the data source type in the shared memory at a fixed frequency, and activates the working thread through an event when the state changes; The data source switching worker thread processes the source switch state update of the specified simulation variable according to the dynamically calculated number of threads; The number of the data source switching working threads is dynamically calculated based on the total number of variables and the number of variables processed by a single thread, and is used to update the source switch status of the simulation variables in parallel.

8. The method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory according to claim 1, characterized in that: When the soft panel processing module or the hardware signal processing module writes data to the shared memory, if the current source switch type matches the module itself, the data is updated to the simulation variable address of the shared memory; if the current source switch type does not match the module itself, the update is skipped and the next cycle is entered.

9. The method for dynamically switching data sources of soft and hard panels of a flight simulator based on shared memory according to claim 1, characterized in that: The method further includes at least one of the following after step S7: Mapping the soft panel address and the hardware device address to the same memory space through dual-binding address mapping; and / or Use a dynamic thread pool scheduling algorithm to adjust the number of worker threads based on system load; and / or Zero-copy data transfer is achieved through memory barrier synchronization technology.

10. A flight simulator soft and hard panel data source dynamic switching system based on shared memory, based on a flight simulator soft and hard panel data source dynamic switching method based on shared memory according to any one of claims 1 to 9, characterized in that: The system includes: A binding table construction module is configured to construct a database relationship binding table, including a simulator variable information table, a variable state parameter and simulation variable binding table, a soft panel variable and simulation variable binding table, and a hardware device and simulation variable binding table; A data structure establishment module configured to establish a corresponding data structure based on the database relationship binding table; An initialization module is configured to initialize the shared memory, create a shared memory area according to the information of each variable in the simulator, and update the address information of all variables in the memory; a data association integration module configured to associate the data structures in the data structure establishment module with the simulation variable ID and the variable name to generate an internal data structure; define a data source type switch parameter in the internal data structure, and set a pointer in the soft panel variable binding structure and the hardware device variable binding structure to point to the memory address of the data source type switch parameter; A thread initialization module is configured to create and activate a source switching judgment thread and a data source switching working thread; a shared memory data writing module configured to run the data source switching module so that the soft panel processing module and the hardware signal processing module determine whether to write data into the shared memory according to the source switch state; The resource release module is configured to stop all threads and release memory resources when exiting the data source switching module.

Citation Information

Patent Citations

  • Flight maintenance simulator distributed communication resource integration method

    CN115509146A

  • Data source dynamic switching method, device and equipment

    CN116401300A

Cited By

  • Running state-oriented memory fault risk assessment and adaptive diagnosis method and system

    CN121807452A

  • Runtime-oriented memory fault risk assessment and adaptive diagnosis method and system

    CN121807452B