Dynamic fault simulation device and method based on configuration file
By establishing a fault coding library and a dynamic fault object pool, combined with XML configuration files and linked list data structures, the problem of fragmented fault types and insufficient flexibility of the existing fault simulation system is solved, and standardized coding and dynamic management of fault types are realized. Improves the flexibility and reusability of the simulation system.
Patent Information
- Application Number
- CN202410596671.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-08-30
AI Technical Summary
It is difficult for existing fault simulation systems to independently define fault content, fault types are not systematic, and it is difficult to dynamically simulate multiple faults under different working conditions. They lack flexibility and reusability, and cannot effectively reproduce fault scenarios and cover typical fault scenarios.
By establishing a fault coding library, common fault types are stored and uniformly coded. XML configuration files are used to store fault type information. The dynamic fault object pool uses a linked list data structure to store fault objects. The fault management module includes command listening, working condition inspection, and signal. The reset and fault generation module implements dynamic management of fault objects and standardized injection of signals.
It achieves standardized coding and dynamic management of fault types, improves the flexibility and comprehensiveness of the simulation system, avoids repeated iterative modifications of program code, and enhances the reusability and scalability of the fault simulation system.
Smart Images

Figure CN118567933A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer simulation, and in particular to a dynamic fault simulation device and method based on a configuration file. Background Art
[0002] Computer simulation technology has been widely used in many industries. In the process of R&D and design, it is especially necessary to verify the robustness and robustness of the object being developed. At the same time, an open and flexible fault injection method is needed to facilitate the evaluation and improvement of the object being developed. In addition, when using some simulation training products, it is necessary to cultivate the operator's ability to handle faults, which creates a demand for fault simulation systems.
[0003] However, most of the existing fault simulation systems are only aimed at single scenarios such as R&D or marketing. It is difficult for users to independently define the fault content. There are problems such as coupling with environmental systems, unsystematic fault types, difficulty in dynamically simulating multiple faults under different working conditions, and lack of flexibility and reusability. These problems are not conducive to reproducing fault scenarios in fault injection and covering typical fault scenarios.
[0004] Based on this technical background, the present invention studies a dynamic fault simulation device and method based on configuration files. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention proposes a dynamic fault simulation device and method based on a configuration file. The device establishes a fault coding library, stores common fault types and uniformly encodes the fault types, so that typical fault types can be encoded and libraryed in a standardized form, which is convenient for finding different fault types and injecting them according to different scenarios during simulation.
[0006] In order to achieve the above object, the present invention provides a first aspect of a dynamic fault simulation device based on a configuration file, comprising:
[0007] The data storage module includes a fault coding library, a dynamic fault object pool and a fault signal pool, wherein the fault coding library is used to store common fault types and uniformly encode the fault types, the dynamic fault object pool is used to dynamically store fault objects, and the fault signal pool is used to store fault signals;
[0008] The fault management module includes an instruction listening module, a working condition checking module, a signal resetting module and a fault generating module, wherein the instruction listening module is used to inject and delete the dynamic fault object according to the received external instruction, the working condition checking module is used to control the dynamic fault object, the signal resetting module is used to reset the fault signal to the original signal, and the fault generating module is used to generate an error signal and send the error signal to the fault signal pool.
[0009] A second aspect of the present invention provides a method performed in the above-mentioned device, comprising:
[0010] Using the fault coding library to store common fault types and uniformly encode the fault types, using the dynamic fault object pool to dynamically store fault objects, and using the fault signal pool to store fault signals;
[0011] The command listening module is used to inject and delete the dynamic fault object according to the received external command, the working condition inspection module is used to control the dynamic fault object, the signal reset module is used to reset the fault signal to the original signal, the fault generation module is used to generate an error signal, and the error signal is sent to the fault signal pool.
[0012] The technical effects of the present invention include:
[0013] (1) The dynamic fault simulation device based on configuration files proposed in the present invention establishes a fault coding library to store common fault types and uniformly encode the fault types, so that typical fault types can be encoded and built in a standardized form, which is convenient for finding different fault types and injecting them according to different scenarios during simulation.
[0014] (2) The dynamic fault simulation device based on configuration files proposed in the present invention uses XML configuration files to store fault type information. New fault types are added by creating new XML files to cover various scenarios. At the same time, the fault type information is stored in the XML configuration files to decouple the fault information from the simulation system program. Different types of fault simulations can be achieved by only selecting, modifying or creating new XML files, thereby avoiding repeated iterative modifications of the program code.
[0015] (3) The present invention proposes a dynamic fault simulation device based on a configuration file. The dynamic fault object pool uses a linked list data structure to store fault objects, so that the simulation system can simulate multiple different fault types under different working conditions at the same time, and dynamically manage the fault objects in the object pool to perform opening, closing, injection, and deletion operations, so that the system can cover various complex fault types, thereby improving the comprehensiveness and flexibility of the system.
[0016] (4) In the dynamic fault simulation device based on the configuration file proposed in the present invention, the fault generation module generates error signals of different mathematical forms according to the fault information and sends them to the corresponding variables in the fault signal pool. In this process, the information representing the mathematical form of the error signal is decoupled from the information representing the type of the fault signal variable. The error signals of different mathematical forms can be injected into any fault signal variable by using a combination of finite information, thereby improving the reusability and scalability of the fault simulation system.
[0017] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The above and other objects, features and advantages of the present invention will become more apparent through a more detailed description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present invention.
[0019] Figure 1 The schematic diagram is a schematic diagram of the architecture of a specific implementation of the dynamic fault simulation device based on configuration files proposed by the present invention.
[0020] Figure 2 This is a schematic diagram illustrating the content definition of a data storage module of a fault configuration file in a specific implementation manner of the dynamic fault simulation device based on configuration files proposed by the present invention.
[0021] Figure 3 The present invention provides a schematic diagram of the instruction monitoring and execution flow in a specific implementation of the dynamic fault simulation device based on configuration files.
[0022] Figure 4 This is a schematic diagram of the fault management and implementation flow in a specific implementation of the dynamic fault simulation device based on configuration files proposed by the present invention.
[0023] Figure 5 This is a schematic diagram of mapping a fault code library and a dynamic fault object pool in a specific implementation of the dynamic fault simulation device based on configuration files proposed by the present invention. DETAILED DESCRIPTION
[0024] The preferred embodiments of the present invention will be described in more detail below. Although the preferred embodiments of the present invention are described below, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0025] In the present invention, unless otherwise specified, the directional words used, such as "upper and lower", generally refer to the upper and lower parts of the device in normal use, and "inside and outside" refer to the outline of the device. In addition, the terms "first, second, third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first, second, third" may explicitly or implicitly include one or more of the features. In the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined.
[0026] The present invention provides a dynamic fault simulation device based on a configuration file, such as Figure 1As shown, including:
[0027] The data storage module includes a fault coding library, a dynamic fault object pool and a fault signal pool. The fault coding library is used to store common fault types and uniformly encode the fault types. The dynamic fault object pool is used to dynamically store fault objects. The fault signal pool is used to store fault signals.
[0028] The fault management module includes an instruction listening module, a working condition inspection module, a signal reset module and a fault generation module. The instruction listening module is used to inject and delete dynamic fault objects according to received external instructions. The working condition inspection module is used to control the dynamic fault objects. The signal reset module is used to reset the fault signal to the original signal. The fault generation module is used to generate an error signal and send the error signal to the fault signal pool.
[0029] In the present invention, by establishing a fault coding library, common fault types are stored and uniformly coded, typical fault types can be coded and libraryed in a standardized form, which is convenient for finding and injecting different fault types according to different scenarios during simulation.
[0030] According to the present invention, storing common fault types and uniformly encoding the fault types includes:
[0031] Detailed information of common fault types is stored in the form of XML configuration files to form a fault type library, and the XML configuration files are uniformly encoded based on standard digital encoding rules.
[0032] According to the present invention, storing dynamic fault objects is to dynamically store fault objects in the form of a linked list data structure.
[0033] According to the present invention, injecting and deleting dynamic fault objects according to received external instructions includes:
[0034] Interact with external programs through the network and receive instructions sent by external programs;
[0035] When the instruction is injection, the corresponding XML configuration file in the fault type library is read according to the fault code in the instruction, the corresponding fault object is created according to the detailed information of the fault type in the XML configuration file, and the fault object is injected into the dynamic fault object pool;
[0036] When the instruction is to delete, the corresponding fault object in the dynamic fault object pool is deleted according to the fault code in the instruction.
[0037] In the present invention, an XML configuration file is used to store fault type information, and new fault types are added by creating a new XML file to cover various scenarios. At the same time, the XML configuration file is used to store fault type information so that the fault information is decoupled from the simulation system program. Different types of fault simulations can be achieved by only selecting, modifying or creating a new XML file, thereby avoiding repeated iterative modifications of the program code.
[0038] Preferably, controlling the dynamic fault object includes:
[0039] Traverse the fault objects in the dynamic fault object pool in real time, and open, close, time and delete the corresponding fault objects according to the working conditions.
[0040] According to the present invention, generating an error signal and sending the error signal to a fault signal pool comprises:
[0041] The fault objects in the dynamic fault object pool are traversed in real time. For the fault objects in the open state, corresponding error signals are generated according to the fault information in the fault objects, and the error signals are sent to the fault signal pool.
[0042] Preferably, each fault signal in the fault signal pool is generated by superimposing an original signal and an error signal;
[0043] The original signal is the true value of the original signal reset and generated by the signal reset module, and the error signal is the error signal received from the fault generation module.
[0044] In the present invention, the dynamic fault object pool uses a linked list data structure to store fault objects, so that the simulation system can simultaneously simulate multiple different fault types under different working conditions, and dynamically manage the fault objects in the object pool, perform opening, closing, injection, and deletion operations, so that the system can cover various complex fault types, thereby improving the comprehensiveness and flexibility of the system.
[0045] In the present invention, the fault generation module generates error signals in different mathematical forms based on fault information and sends them to corresponding variables in the fault signal pool. In this process, the information representing the mathematical form of the error signal and the information representing the type of the fault signal variable are decoupled. Error signals in different mathematical forms can be injected into any fault signal variable by using a combination of finite information, thereby improving the reusability and scalability of the fault simulation system.
[0046] The present invention also provides a method carried out in the above-mentioned device, comprising:
[0047] Use the fault coding library to store common fault types and uniformly encode the fault types, use the dynamic fault object pool to dynamically store fault objects, and use the fault signal pool to store fault signals;
[0048] The command listening module is used to inject and delete dynamic fault objects according to the received external commands, the working condition inspection module is used to control the dynamic fault objects, the signal reset module is used to reset the fault signal to the original signal, the fault generation module is used to generate an error signal, and the error signal is sent to the fault signal pool.
[0049] According to the present invention, storing common fault types and uniformly encoding the fault types includes:
[0050] Detailed information of common fault types is stored in the form of XML configuration files to form a fault type library, and the XML configuration files are uniformly encoded based on standard digital encoding rules;
[0051] Storing dynamic fault objects is to dynamically store fault objects in the form of a linked list data structure;
[0052] Receiving external instructions to inject and delete dynamic fault objects includes:
[0053] Interact with external programs through the network and receive instructions sent by external programs;
[0054] When the instruction is injection, the corresponding XML configuration file in the fault type library is read according to the fault code in the instruction, the corresponding fault object is created according to the detailed information of the fault type in the XML configuration file, and the fault object is injected into the dynamic fault object pool;
[0055] When the instruction is to delete, the corresponding fault object in the dynamic fault object pool is deleted according to the fault code in the instruction.
[0056] According to the present invention, controlling a dynamic fault object comprises:
[0057] Traverse the fault objects in the dynamic fault object pool in real time, and open, close, time and delete the corresponding fault objects according to the working conditions;
[0058] Generating an error signal and sending the error signal to a fault signal pool includes:
[0059] Traverse the fault objects in the dynamic fault object pool in real time, generate corresponding error signals according to the fault information in the fault objects for the fault objects in the open state, and send the error signals to the fault signal pool;
[0060] Each fault signal in the fault signal pool is generated by superimposing the original signal and the error signal;
[0061] The original signal is the true value of the original signal reset and generated by the signal reset module, and the error signal is the error signal received from the fault generation module.
[0062] The present invention will be described in more detail below through specific examples.
[0063] Example 1
[0064] like Figure 1 As shown, this embodiment provides a dynamic fault simulation device based on a configuration file, including a data storage module 1 and a fault management module 2;
[0065] The data storage module 1 includes a fault code library 3, a dynamic fault object pool 4 and a fault signal pool 5;
[0066] The fault management module 2 includes a command monitoring module 6, a working condition checking module 7, a signal resetting module 8 and a fault generating module 9;
[0067] like Figure 2 As shown, each local XML configuration file corresponds to a fault object. The fault object content includes the fault occurrence time and fault occurrence content. The fault occurrence time defines the triggering condition of the fault and the time domain information of the fault occurrence. The fault occurrence content defines the specific manifestation of the fault object.
[0068] As shown in Table 1, the naming of the fault library consists of 5 groups of identification codes composed of 9 digits, which are used to distinguish the working condition, working condition identification code, fault type, fault parameter, and fault form; the local configuration file with the same 9-digit name corresponding to the 9-digit fault code in the read and delete instructions, that is, each fault object corresponds to a unique 9-digit code;
[0069] Table 1 Naming rules of fault library
[0070]
[0071] In this embodiment, the working principle of the dynamic fault simulation device based on the configuration file is:
[0072] In the loop of one thread, the instruction listening module 6 continuously accesses the fault coding library 3 and the dynamic fault object pool 4 according to the external program instructions, and injects and deletes the fault objects; at the same time, in the loop of another thread, first, the operating condition checking module 7 opens, closes, times and deletes each fault object in the fault object pool 4 according to the operating conditions, then the signal resetting module 8 resets the original signal in the fault signal pool 5 to the detected original signal true value, and then the fault generating module 9 traverses each object in the dynamic fault object pool 4 that is in the open state, and generates a corresponding error signal and sends it to the fault signal pool 5 to generate a fault signal.
[0073] like Figure 3As shown, in one thread, the instruction listening module 6 continuously receives instructions issued by an external program through the network in a loop. After identifying the instruction category, if the instruction is to inject a fault object, the fault code library 3 in the memory is accessed by reading the local configuration file corresponding to the fault code in the instruction, the fault information in the configuration file is read, and a new fault object is dynamically established based on the information, and the new fault object is added to the dynamic fault object pool 4 by returning a pointer; if the instruction is to delete a fault object, the dynamic fault object pool in the memory is accessed, and the fault object corresponding to the fault code in the instruction is searched in the object pool, and it is deleted from the object pool;
[0074] like Figure 4 As shown, after the local configuration file in the fault code library 3 is injected into the memory and stored in the dynamic fault object pool 4 in the form of a linked list, the information stored in the read file corresponds to the information stored in the injected fault object, and the arrangement order of the fault objects in the linked list has nothing to do with the configuration file encoding;
[0075] like Figure 5 As shown, in another thread, in each loop, the working condition checking module 7 first accesses the dynamic fault object pool 4 in the memory, traverses all the fault objects therein, and opens, closes, times, and deletes each fault object according to the current environmental information, aircraft status information, and working condition information in the fault object; then, the signal resetting module 8 resets the original signal in the fault signal pool 4 to the detected original signal true value; then, the fault generating module 9 accesses the dynamic fault object pool 4 in the memory, traverses all the fault objects in the open state, generates a corresponding error signal according to the fault type information in the fault object, and sends it to the fault signal pool 5 to generate a fault signal.
[0076] The dynamic fault simulation device based on the configuration file in this embodiment establishes a fault coding library, stores common fault types and uniformly encodes the fault types, so that typical fault types can be encoded and libraryed in a standardized form, which is convenient for finding different fault types and injecting them according to different scenarios during simulation.
[0077] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. A dynamic fault simulation device based on a configuration file, characterized in that: include: The data storage module includes a fault coding library, a dynamic fault object pool and a fault signal pool, wherein the fault coding library is used to store common fault types and uniformly encode the fault types, the dynamic fault object pool is used to dynamically store fault objects, and the fault signal pool is used to store fault signals; The fault management module includes an instruction listening module, a working condition checking module, a signal resetting module and a fault generating module, wherein the instruction listening module is used to inject and delete the dynamic fault object according to the received external instruction, the working condition checking module is used to control the dynamic fault object, the signal resetting module is used to reset the fault signal to the original signal, and the fault generating module is used to generate an error signal and send the error signal to the fault signal pool.
2. The device according to claim 1, characterized in that Storing common fault types and uniformly coding the fault types includes: Detailed information of common fault types is stored in the form of XML configuration files to form a fault type library, and the XML configuration files are uniformly encoded based on standard digital encoding rules.
3. The device according to claim 1, characterized in that Storing dynamic fault objects is to dynamically store the fault objects in the form of a linked list data structure.
4. The device according to claim 2, characterized in that Injecting and deleting the dynamic fault object according to the received external instruction includes: Interact with external programs through the network and receive instructions sent by external programs; When the instruction is injection, according to the fault code in the instruction, the corresponding XML configuration file in the fault type library is read, the corresponding fault object is established according to the detailed information of the fault type in the XML configuration file, and the fault object is injected into the dynamic fault object pool; When the instruction is to delete, the corresponding fault object in the dynamic fault object pool is deleted according to the fault code in the instruction.
5. The device according to claim 1, characterized in that Controlling the dynamic fault object includes: The fault objects in the dynamic fault object pool are traversed in real time, and corresponding fault objects are opened, closed, timed and deleted according to working conditions.
6. The device according to claim 1, characterized in that Generating an error signal and sending the error signal to the fault signal pool includes: The fault objects in the dynamic fault object pool are traversed in real time, and for the fault objects in the open state, corresponding error signals are generated according to the fault information in the fault objects, and the error signals are sent to the fault signal pool.
7. The device according to claim 1, characterized in that Each fault signal in the fault signal pool is generated by superimposing an original signal and an error signal; The original signal is the original signal true value reset and generated by the signal resetting module, and the error signal is the error signal received from the fault generating module.
8. A method carried out in the device according to any one of claims 1 to 7, characterized in that: include: Using the fault coding library to store common fault types and uniformly encode the fault types, using the dynamic fault object pool to dynamically store fault objects, and using the fault signal pool to store fault signals; The command listening module is used to inject and delete the dynamic fault object according to the received external command, the working condition inspection module is used to control the dynamic fault object, the signal reset module is used to reset the fault signal to the original signal, the fault generation module is used to generate an error signal, and the error signal is sent to the fault signal pool.
9. The method according to claim 8, characterized in that Storing common fault types and uniformly coding the fault types includes: Storing detailed information of common fault types in the form of XML configuration files to form a fault type library, and uniformly encoding the XML configuration files based on standard digital encoding rules; Storing dynamic fault objects is to dynamically store fault objects in the form of a linked list data structure; Receiving external instructions to inject and delete the dynamic fault object includes: Interact with external programs through the network and receive instructions sent by external programs; When the instruction is injection, according to the fault code in the instruction, the corresponding XML configuration file in the fault type library is read, the corresponding fault object is established according to the detailed information of the fault type in the XML configuration file, and the fault object is injected into the dynamic fault object pool; When the instruction is to delete, the corresponding fault object in the dynamic fault object pool is deleted according to the fault code in the instruction.
10. The method according to claim 8, characterized in that Controlling the dynamic fault object includes: Traversing the fault objects in the dynamic fault object pool in real time, and opening, closing, timing and deleting the corresponding fault objects according to the working conditions; Generating an error signal and sending the error signal to the fault signal pool includes: Traversing the fault objects in the dynamic fault object pool in real time, generating corresponding error signals according to the fault information in the fault objects for the fault objects in the open state, and sending the error signals to the fault signal pool; Each fault signal in the fault signal pool is generated by superimposing an original signal and an error signal; The original signal is the original signal true value reset and generated by the signal resetting module, and the error signal is the error signal received from the fault generating module.
Citation Information
Cited By
Test case generation method and system based on big language model and rule collaboration
CN121387759A
