An on-board single-chip microcomputer fault diagnosis method
By writing the fault equation model into a binary file in XML format and burning it into the Flash memory of the airborne microcontroller, the problem of the lack of operating system and storage space of the airborne microcontroller is solved, and the recursive operation of the fault equation and memory optimization are realized.
Patent Information
- Application Number
- CN202411810152.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-12-10
AI Technical Summary
Traditional fault equation models are difficult to deploy in airborne microcontrollers because airborne microcontrollers lack operating systems and file systems, have limited storage space, and strictly separate fault equations from fault variables, making recursive logical operations impossible.
The fault equation model is written as a binary file in XML format and burned into the Flash memory of the airborne microcontroller. Fault diagnosis is performed through a preset program, and a large array is used to simulate memory allocation to realize the cascade operation of the fault equation.
The fault equation system was deployed on an airborne microcontroller without an operating system and file system, reducing memory space requirements and supporting recursive logic operations of fault equations.
Smart Images

Figure CN119829315B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of airborne computer software technology, and more specifically to a method for diagnosing faults in airborne microcontrollers. Background Technology
[0002] Aircraft fault diagnosis and health management (PHM) technology is a major component of airborne computer maintenance. Fault equations are an important part of PHM, which can perform calculations on simple fault identification results based on predefined logic to obtain higher-level and more complex logical identification results, supporting the PHM system in executing more complex response logic.
[0003] Traditional fault equation modeling often stores the model files in a file system, such as an SQL database, and loads them into memory at startup. However, this method is difficult to apply to airborne microcontrollers for the following three reasons:
[0004] First, airborne microcontrollers do not have an operating system or a file system, and therefore cannot store fault equation models in the form of files in the file system.
[0005] Second, airborne microcontrollers have extremely limited storage space and computing power, making it impossible to run database management software such as SQLite, and therefore it is impossible to use databases on airborne microcontrollers.
[0006] Third, the memory space of the airborne microcontroller is also extremely limited. If the fault equation model file is loaded into memory, it will put a great burden on the memory.
[0007] In addition, traditional fault equation models have the following two drawbacks:
[0008] First, fault equations and fault variables are strictly distinguished. The values of fault variables are provided from the outside, while the values of fault equations come only from logical operations between fault variables and cannot be the result of logical operations on other fault equations.
[0009] Second, recursion is prohibited in embedded development, but a change in one fault variable in a fault equation will cause all associated fault equations to change, and the logic is recursive. Summary of the Invention
[0010] In view of this, embodiments of this application provide an airborne microcontroller fault diagnosis method to solve the technical problem that fault equation systems are difficult to deploy on airborne microcontrollers in the prior art.
[0011] This application provides the following technical solution: a method for diagnosing airborne microcontroller faults, comprising:
[0012] Define the fault equation model file for the airborne microcontroller;
[0013] The fault equation model file is written in XML format, the XML model file is saved as a binary file to generate a fault model binary file, and the fault model binary file is burned into the Flash of the airborne microcontroller.
[0014] The fault model binary file is executed by a preset program in the microcontroller to obtain the fault diagnosis results of the airborne microcontroller.
[0015] According to one embodiment of this application, the fault diagnosis model file includes a fault equation model logical structure, which includes a data source equation association list, a number of fault equations, and a fault equation information array.
[0016] The data source equation association list includes: the equation ID of all fault equations under each data source, and the fault equation information array includes the equation name, equation ID, data source, position in the data source, equation length, equation expression, and association equation list for each fault equation.
[0017] According to one embodiment of this application, the fault diagnosis model file further includes a fault equation model storage structure, which includes: a data source information list, a number of equations, an address of the fault equation information list, a data pool, a data source associated equation list, and a fault equation information list.
[0018] According to one embodiment of this application, the fault model binary file is executed by a preset program in the microcontroller to obtain the airborne microcontroller fault diagnosis result, including:
[0019] Read the fault model binary file from Flash, construct a complete fault equation model, and complete the initialization of the fault equation model;
[0020] The corresponding value of the specified fault equation is obtained from the external source based on the data source and its location.
[0021] The fault equation expression is analyzed and calculated to obtain its value.
[0022] According to one embodiment of this application, the fault model binary file is executed by a preset program in a microcontroller to obtain the airborne microcontroller fault diagnosis result, and the method further includes:
[0023] After obtaining the value of the fault equation, update the value of the current fault equation according to the equation ID of the fault equation, and update the values of all other fault equations related to the fault equation in a recursive manner by simulating a queue.
[0024] According to one embodiment of this application, the fault model binary file is executed by a preset program in the microcontroller to obtain the fault diagnosis result of the airborne microcontroller. The method further includes: reading the list of associated equations of the fault equation from the fault equation model file according to the data source number of the fault equation, traversing all associated fault equations, and updating the values of all associated fault equations under the data source.
[0025] Compared with the prior art, the beneficial effects that can be achieved by at least one of the above-mentioned technical solutions adopted in the embodiments of this specification include at least the following: The embodiments of this invention propose a fault equation system for airborne microcontrollers without an operating system and file system, separates the static part and dynamic part of the fault equation system, and introduces a method of simulating memory allocation in a large array, which greatly reduces the memory space required by the fault equation system, making it suitable for airborne microcontrollers with limited storage space and no operating system and file system, and unifies the fault variables and fault equations in the traditional fault equation system into a fault equation, realizing the cascading of fault equations. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart illustrating the airborne microcontroller fault diagnosis method according to an embodiment of the present invention;
[0028] Figure 2 This is a logical structure diagram of the fault equation model provided in an embodiment of the present invention;
[0029] Figure 3 This is a diagram of the fault equation model storage structure provided in an embodiment of the present invention;
[0030] Figure 4 This is a flowchart of the fault equation model file generation program provided in an embodiment of the present invention;
[0031] Figure 5 This is a flowchart of the fault equation system expression calculation program provided in an embodiment of the present invention;
[0032] Figure 6 This is a flowchart of the fault equation system data update procedure provided in an embodiment of the present invention; Detailed Implementation
[0033] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0034] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. This application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0035] like Figure 1 As shown, this embodiment of the invention provides a method for diagnosing faults in an airborne microcontroller, comprising the following steps:
[0036] S1. Define the fault equation model file for the airborne microcontroller;
[0037] S2. Write the fault equation model file in XML format, save the XML model file as a binary file, generate a fault model binary file, and burn the fault model binary file into the Flash of the airborne microcontroller.
[0038] S3. Execute the fault model binary file through the preset program in the microcontroller to obtain the fault diagnosis result of the airborne microcontroller.
[0039] In this embodiment, the fault diagnosis model file includes a fault equation model logical structure and a fault equation model storage structure.
[0040] The logical structure of the fault equation model defines the contents of the fault equation model, including the list of related equations of the data source, the number of fault equations, and the fault equation information array. Each element of the fault equation information array is the static information of a fault equation, including the fault equation name, fault equation ID, data source, position in the data source, equation length, equation expression, and list of related equations.
[0041] The fault equation model storage structure defines how the fault equation model is stored in the file. The storage structure includes a list of data source information, the number of associated equations for each data source, and the position of the list of associated equations for each data source in the data pool.
[0042] Number of equations, i.e., the total number of fault equations;
[0043] The address of the fault equation information list, i.e., the location of the fault equation information list in the data pool;
[0044] The data pool simulates memory allocation in the form of a large array, providing storage space for data such as the list of data source association equations and the list of fault equation information.
[0045] The fault equation information list is stored in the data pool. It contains a fault equation information structure for each equation. The fault equation information structure includes the equation name, equation ID, data source, position in the data source, equation length, equation expression address, number of associated equations, and address of the associated equation list. The equation expression and the associated equation list are stored independently in the data pool, and their positions are recorded in the fault equation information structure.
[0046] The data source is associated with a list of equations, which is stored in the data pool and contains the IDs of all fault equations under that data source.
[0047] The system architecture implementing this method includes a fault equation model logical structure, a fault equation model storage structure, a fault equation model file generation program, and an airborne microcontroller fault equation system program. The airborne microcontroller fault equation system program includes a fault equation system initialization program, a fault equation system data source reading program, a fault equation system expression calculation program, a fault equation system data update program, and a fault equation system specified data source data update program.
[0048] Among them, the fault equation model logical structure unifies the fault variables and fault equations in the traditional fault equation system into fault equations, and has the function of fault equation cascading.
[0049] The fault equation model storage structure significantly reduces the model's storage space and memory space requirements by separating the static and dynamic parts and introducing a large array to simulate memory allocation.
[0050] The fault equation model file generation program generates a fault equation model file that conforms to the fault equation model storage structure based on the fault equation model description file in XML format.
[0051] The airborne microcontroller fault equation system program can construct a complete fault equation model based on the fault equation model file and run the fault equation system on the airborne microcontroller.
[0052] Furthermore, the airborne microcontroller fault equation system program includes:
[0053] The fault equation system initialization program reads the fault equation model file from Flash, constructs a complete fault equation model, and completes the initialization of the fault equation model.
[0054] The fault equation system data source reading program retrieves the value of a specified fault equation from an external source based on the data source and its location.
[0055] A fault equation system expression calculation program that parses fault equation expressions and calculates their values;
[0056] The fault equation system data update program updates the value of the current fault equation based on the input fault equation ID, and uses a queue to simulate recursion to update the values of all fault equations whose values are related to this equation.
[0057] The fault equation system specifies a data source update procedure that updates all data sources to the value of the fault equation for that data source based on the input data source number.
[0058] The embodiments of the present invention will be further described below with reference to the accompanying drawings. An airborne microcontroller fault equation system of the present invention is implemented according to the following steps:
[0059] Step 1: Define the logical structure of the fault equation. For example... Figure 2 As shown, the logical structure of a fault equation should include all static information about that fault equation, including: equation name, equation ID, data source, position within the data source, equation length, equation expression, and a list of associated equations. The equation name is a string representing the name of the fault equation. The equation ID is a unique identifier for the fault equation, indicating its position within the fault equation model. The data source serves two purposes: first, it indicates whether the value of the fault equation comes from an external data source or from operations between other fault equations; second, when the equation's value comes from an external data source, it specifies which data source the equation's data originates from. The position within the data source indicates which data point the equation's data originates from within that data source, and is only valid when the value comes from an external data source. The equation length is only valid for equations whose values come from operations between other fault equations, and is the length of the fault equation's expression. The equation expression is only valid for equations whose values come from operations between other fault equations; it is an array, and its suffix expression indicates how the equation's value is derived through logical operations between other equations. The list of associated equations is an array where each element is the ID of another equation whose equation expression includes this equation.
[0060] The fault equation model file, i.e., the static part of the fault equation model burned into Flash memory, should contain all the initialization information of the fault equation model, such as... Figure 2As shown, the fault equation model file consists of three parts: a list of data source information, the number of fault equations, and a list of fault equations. The data source information list is a list where each element is a structure representing a data source, containing the number of fault equations under that data source and a list of their IDs. The number of fault equations indicates the total number of fault equations in this fault equation model. The list of fault equations is the core of the fault equation model file; each element represents a fault equation and contains all the information for that fault equation.
[0061] Step 2, define the storage structure of the fault equation model file. The storage structure of the fault equation model file is as follows: Figure 3 As shown. To save limited memory space, the fault equation model structure is directly saved as a binary file so that the onboard microcontroller can directly use the fault equation model in the built-in Flash, eliminating the step of "reading the model from Flash to memory". Since the number, length, and number of associated equations are variable, it is not advisable to use a fixed-size array to store the equations. Generally, a dynamic memory allocation method should be used, allocating space after determining the array size, with the model structure only storing a pointer to the first element of the array. However, the location where the fault equation model file is burned into Flash is not fixed, and the address of the fault equation model in Flash cannot be determined in advance, making it impossible to directly use pointers. Therefore, a large array is used to simulate memory allocation for the fault equation model. A large array, called the "data pool," is defined in the fault equation model structure. During the generation of the fault equation model file, when storage space needs to be allocated, an unallocated space is found in the data pool, and its position in the data pool is returned to the program that needs the storage space. In the fault equation model, the lists of associated equations, fault equation information, fault equation associated equations, and fault equation expressions from each data source are all stored using the data pool method. The fault equation model structure directly stores data including a list of data source information, the number of equations, and the address of the fault equation information list. Each element of the data source information list contains complete information about a data source, including the number of equations in the data source, the address of the data source equation list (which is the position of the data source equation list in the data pool), and the equation IDs of all fault equations associated with a specified data source. The fault equation information list address is the position of the fault equation information list in the data pool. Each element of the fault equation information list contains complete information about a single fault equation, including the equation ID, equation name, equation length, data source, position within the data source, expression address, number of associated equations, and the address of the associated equation list. The expression address is the position of the fault equation expression in the data pool, and the associated equation list address is the position of the associated equation list in the data pool.
[0062] Step 3: Compile the information for the fault equation model to be built into an XML file. The logical structure of the XML file is a tree structure, with the fault equation model as the root node. Each fault equation is a child node of the root node. The information for each fault equation includes: equation name, equation ID, data source, position in the data source, and equation expression. The equation length and the list of associated equations do not need to be written here.
[0063] Step 4: Write a program to generate fault equation model files, which will convert the model's XML file into a binary file. For example... Figure 4 As shown, the program reads fault equation model information in XML file format and generates a fault equation model file with the storage structure described in step 3. First, the XML is parsed into an XML tree. Then, all fault equations are traversed, calculating the total number of fault equations, the total number of data sources, and the fault equations under each data source. This information is written into the fault equation model structure, recording the length of each equation and its associated equations. Then, all fault equations are traversed again, and the equation name, equation ID, data source, position within the data source, equation expression, equation length, and list of associated equations for each equation are written into the fault equation model structure. Finally, the fault equation model structure is saved as a bin file.
[0064] Step 5: Burn the generated fault equation model bin file into the Flash memory of the airborne microcontroller.
[0065] Step 6: Execute the fault model binary file using the preset program in the microcontroller to obtain the airborne microcontroller fault diagnosis results, specifically including:
[0066] (1) Write the fault equation system initialization program. This program reads the fault equation model file and initializes the fault equation model according to the file. First, it stores a fault equation model structure pointer, pointing to the address of the fault equation model file in Flash. Then, it reads the fault equation model file and obtains information such as the number of equations. Next, it allocates a space in memory to store the dynamic part of the fault equation model. The dynamic part of the fault equation model only includes the values of the fault equations, so it only needs to create an array based on the total number of fault equations, with the i-th element of the array being the current value of the fault equation with ID i. Finally, it initializes all equation values to 0, where 0 represents no fault.
[0067] (2) Write a data source reading program for the fault equation modeling system. The program takes a data source number and a location within the data source as input. Based on the data source number, the program determines where to retrieve the data, and based on the location within the data source, it determines which position of the data source the required data belongs to. The specific implementation of this program depends on the specific application scenario and the specific hardware.
[0068] (3) Write a program to calculate the system expression of the fault equation. For example... Figure 5 As shown, the program takes an equation ID as input and outputs the latest value of that equation after computation. First, it locates the fault equation structure in the fault equation model and determines whether the equation's value comes from logical operations of other equations based on its data source. If so, it continues; otherwise, it exits with an error. Then, it creates a new computation stack to perform the equation expression computation. Next, it reads the elements of the equation expression sequentially. If the read element is an equation ID, it retrieves the current value of the equation based on the equation ID and adds it to the computation stack. If the read element is an operator, it retrieves several elements from the top of the computation stack, performs the corresponding operation based on the operator type, and adds the result to the computation stack. After the expression is fully read, the value of the top element of the stack is the result of the expression computation, which is then returned.
[0069] (4) Write a fault equation system data update program. For example... Figure 6 As shown, the input to this program is the fault equation ID. The program updates the value of the fault equation corresponding to that ID and also updates the values of all fault equations whose values are related to that fault equation. First, a queue is created to store equation IDs, and the ID of the current equation is added to it. Then, a loop is entered until the queue is empty: the equation ID at the head of the queue is retrieved. If its data source is an external data source, its latest value is obtained through a data source reading program; if its data source is a logical operation of other equations, its latest value is calculated through an expression calculation program. Then, the latest value is compared with the current value. If the value has not changed, the current loop ends; if the value has changed, the current value of the equation is updated, and the list of related equations is traversed, adding all the IDs of related equations to the queue. This loop continues until the queue is empty.
[0070] (6) Write a data update procedure for the fault equation system's specified data source. This procedure takes the data source number as input and updates the values of all fault equations whose data source is that data source. First, read the list of associated equations for that data source from the fault equation model structure. Then, iterate through all associated equations and update their values using the data update procedure.
[0071] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An on-board single-chip microcomputer failure diagnosis method characterized by comprising: The method comprises the following steps: defining a fault equation model file of an on-board single-chip microcomputer; writing the fault equation model file in XML format, saving the model file in XML format as a binary file, generating a fault model binary file, and writing the fault model binary file to the Flash of the on-board single-chip microcomputer; executing the fault model binary file through a preset program in the single-chip microcomputer to obtain a fault diagnosis result of the on-board single-chip microcomputer; the fault equation model file comprises a fault equation model logical structure, and the fault equation model logical structure comprises a data source equation association list, a fault equation number, and a fault equation information array; the data source equation association list comprises equation IDs of all fault equations under each data source, and the fault equation information array comprises an equation name, an equation ID, a data source, a position in the data source, an equation length, an equation expression, and an associated equation list of each fault equation; the fault equation model file further comprises a fault equation model storage structure, and the fault equation model storage structure comprises a data source information list, an equation number, a fault equation information list address, a data pool, a data source associated equation list, and a fault equation information list; executing the fault model binary file through the preset program in the single-chip microcomputer to obtain the fault diagnosis result of the on-board single-chip microcomputer, comprising: reading the fault model binary file from the Flash, constructing a complete fault equation model, and completing initialization of the fault equation model; obtaining corresponding values of specified fault equations from the outside according to data sources and positions in the data sources; analyzing a fault equation expression and performing calculation to obtain a value of the fault equation; executing the fault model binary file through the preset program in the single-chip microcomputer to obtain the fault diagnosis result of the on-board single-chip microcomputer, further comprising: after obtaining the value of the fault equation, updating the value of the current fault equation according to the equation ID of the fault equation, and updating values of all remaining fault equations related to the fault equation in a queue simulation recursive manner.
2. The method according to claim 1, wherein executing the fault model binary file through the preset program in the single-chip microcomputer to obtain the fault diagnosis result of the on-board single-chip microcomputer, further comprising: reading an associated equation list of the data source from the fault equation model file according to a data source number of the fault equation, traversing all associated fault equations, and updating values of all associated fault equations under the data source.
Citation Information
Patent Citations
On-line fault diagnosis device and on-line fault diagnosis method of simple-type environmental control system
CN101697078A
Single-chip microcomputer fault diagnosis board card and method
CN112213980A