Automotive fault code filtering method, device, vehicle, and medium based on a single counter
Patent Information
- Application Number
- CN202611185468.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-06
- Publication Date
- 2026-09-01
AI Technical Summary
[0005]本申请提供了基于单计数器的汽车故障码滤波方法、装置、车辆及介质,以解决现有技术中基于单次滤波实现故障确认的方式,存在准确率低及稳定性差的技术问题
本申请提供的基于单计数器的汽车故障码滤波方法,利用同一目标计数器进行分时复用,实现双重滤波功能,更有利于节省计数器资源;根据上一状态与当前状态进行故障时段分析,通过进行一重滤波计数与第一阈值进行比较能够确认故障是否发生,实现故障的一重滤波,提高故障状态的确定性与稳定性;此外,在对故障是否发生进行一重确认后,进一步考虑到故障状态的持续性,以保证故障产生的处理措施能有充分的时间执行,避免处理过程中断,还利用目标计数器进行二重滤波计数,结合第二阈值判断故障是否消除,从而确定故障的持续性,进一步提高了故障状态的准确性与稳定性,更有利于维修人员对整车故障状态的快速定位,及时提醒用户保障安全。
Smart Images

Figure CN122672503A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle control technology, and in particular to a method, device, vehicle, and medium for filtering automotive fault codes based on a single counter. Background Technology
[0002] Diagnostic Trouble Codes (DTCs) are standardized codes generated by a vehicle's electronic control unit (ECU) when it detects an abnormality or malfunction. These codes help repair personnel or technicians quickly locate and diagnose vehicle faults. To facilitate rapid identification of vehicle malfunctions by repair personnel or to promptly alert users for safety reasons, diagnostic capabilities for vehicle abnormalities and malfunctions are essential in domain controllers.
[0003] However, interference and signal jitter can affect system stability. Existing technologies propose filtering fault occurrences, using single-pass filtering to achieve a stable state. However, these technologies only consider verifying the validity of the fault code and do not confirm the sustained validity of maintaining the fault state. This still carries the risk of fault jitter and sudden changes, interrupting the fault handling process. For example, if a fault is determined to be occurring after filtering and a power-down process is underway, a momentary jitter could cause the single-pass filtering to determine that the fault condition is not met, instantly restoring the fault and immediately terminating the power-down process, posing a safety hazard.
[0004] It is evident that the existing technology for fault confirmation based on single-pass filtering suffers from low accuracy and poor stability. Summary of the Invention
[0005] This application provides a method, device, vehicle, and medium for filtering automotive fault codes based on a single counter, in order to solve the technical problems of low accuracy and poor stability in the existing method of fault confirmation based on single filtering.
[0006] According to one aspect of the embodiments of this application, this application provides a vehicle fault code filtering method based on a single counter. The method includes: obtaining the previous state and the current state of a fault cache; when the previous state is fault-free and the current state is faulty, performing a first-level filtering count to confirm the occurrence of a fault on a target counter until the count value of the first-level filtering count reaches a first threshold, and confirming the occurrence of a fault; when the previous state is faulty and the current state is fault-free, performing a second-level filtering count to confirm the elimination of a fault on the target counter until the count value of the second-level filtering count reaches a second threshold, and confirming the elimination of a fault.
[0007] Optionally, the step of performing a first-stage filtering count to confirm the occurrence of a fault on the target counter when the previous state was fault-free and the current state is faulty, until the count value of the first-stage filtering count reaches a first threshold, includes: determining that the current state is a fault confirmation period when the previous state was fault-free and the current state is faulty; performing a first-stage filtering count on the target counter during the fault confirmation period to obtain a first count value, and retrieving the first threshold from a preset full fault threshold mapping table based on the fault confirmation ID; comparing the first count value with the first threshold; confirming a fault if the first count value reaches the first threshold; and performing an increment operation on the first count value based on the target counter if the first count value does not reach the first threshold and the current state is the same as the previous state.
[0008] Optionally, the step of performing a double-filtered count to confirm fault elimination on the target counter when the previous state was faulty and the current state is fault-free, until the count value of the double-filtered count reaches a second threshold, and then confirming fault elimination, includes: when the previous state was faulty and the current state is fault-free, determining that the current state is a fault elimination confirmation period; during the fault elimination confirmation period, performing a double-filtered count on the target counter to obtain a second count value, and retrieving the second threshold from a preset full fault threshold mapping table based on the fault confirmation ID; comparing the second count value with the second threshold; if the second count value reaches the second threshold, then confirming fault elimination; if the second count value does not reach the second threshold, and the current state is the same as the previous state, then performing a second count value accumulation operation based on the target counter.
[0009] Optionally, when the previous state was faulty and the current state is fault-free, a double-filtered counting to confirm fault elimination is performed on the target counter until the count value of the double-filtered count reaches a second threshold. After confirming fault elimination, the method includes: obtaining the previous state filtering result of the fault cache; and temporarily latching the fault state based on the fault occurrence confirmation result and the fault elimination confirmation result in the current state, combined with the current state and the previous state filtering result.
[0010] Optionally, the step of temporarily latching the fault state based on the fault occurrence confirmation result and fault elimination confirmation result in the current state, combined with the filtering result of the previous state, includes: if the fault occurrence confirmation result and the current state indicate a fault, then temporarily latching the output fault confirmation state indicating a fault; if the fault elimination confirmation result and the current state indicate fault elimination, then temporarily latching the output fault elimination state indicating fault elimination; if the fault occurrence confirmation result is not confirmed or the fault elimination confirmation result is not confirmed, then maintaining the latching of the filtering result of the previous state obtained from the fault buffer.
[0011] Optionally, before performing time-division multiplexing based on the same target counter, counting fault codes during the fault occurrence confirmation period to obtain a first count value confirming whether a fault has occurred, and counting fault codes during the fault clearance confirmation period to obtain a second count value confirming whether a fault has been cleared, the method further includes: assigning an independent fault ID to each communication fault, configuring different fault thresholds accordingly, wherein different fault thresholds correspond to different configuration parameters; and generating the preset full fault threshold mapping table based on each fault ID and the fault threshold.
[0012] Optionally, after comparing the first count value with the first threshold, or comparing the second count value with the second threshold, the method further includes: if the first count value reaches the first threshold or the second count value reaches the second threshold, and the previous state is different from the current state, then the target counter performs a counting rule conversion, and the count value is cleared to zero.
[0013] According to another aspect of the embodiments of this application, this application provides an automotive fault code filtering device based on a single counter. The device includes: a data acquisition module, used to acquire the previous state and the current state of a fault cache; a fault occurrence confirmation module, used to perform a first-level filtering count to confirm the occurrence of a fault on a target counter when the previous state is fault-free and the current state is faulty, until the count value of the first-level filtering count reaches a first threshold, and then confirm the occurrence of a fault; and a fault elimination confirmation module, used to perform a second-level filtering count to confirm the elimination of a fault on the target counter when the previous state is faulty and the current state is fault-free, until the count value of the second-level filtering count reaches a second threshold, and then confirm the elimination of a fault.
[0014] According to another aspect of the embodiments of this application, this application provides a vehicle, including: a domain controller, a memory, and a network interface. The memory stores machine-readable instructions executable by the domain controller. When the electronic device is running, the domain controller communicates with the memory through the network interface, and the domain controller executes the machine-readable instructions to perform the steps of the single-counter-based automotive fault code filtering method.
[0015] According to another aspect of the embodiments of this application, this application provides a storage medium having domain controller executable program code that causes the domain controller to perform the steps of the single-counter-based automotive fault code filtering method.
[0016] Compared with related technologies, the technical solutions provided in this application have the following advantages: The automotive fault code filtering method based on a single counter provided in this application utilizes the same target counter for time-division multiplexing to achieve dual filtering functionality, which is more conducive to saving counter resources. It analyzes the fault period based on the previous and current states, and confirms whether a fault has occurred by comparing the first-level filtered count with a first threshold, thus achieving first-level filtering and improving the certainty and stability of the fault state. Furthermore, after first-level confirmation of fault occurrence, it further considers the persistence of the fault state to ensure sufficient time for handling measures and avoid interruptions in the handling process. It also utilizes a second-level filtered count using the target counter, combined with a second threshold, to determine whether the fault has been eliminated, thereby determining the persistence of the fault. This further improves the accuracy and stability of the fault state, making it easier for maintenance personnel to quickly locate the fault status of the entire vehicle and promptly remind users to ensure safety. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without any creative effort.
[0018] Figure 1 The flowchart illustrates an optional automotive fault code filtering method based on a single counter, according to an embodiment of this application. Figure 2 This is a timing diagram of an optional target counter according to an embodiment of this application; Figure 3This is a timing diagram after filtering according to an optional single-counter-based automotive fault code filtering method provided in an embodiment of this application; Figure 4 This is a timing diagram of a target counter for an optional single-stage filtering count according to an embodiment of this application; Figure 5 This is a timing diagram of a target counter for an optional double-filtered counting method according to an embodiment of this application; Figure 6 This is a timing diagram for an optional temporary latching of fault states according to an embodiment of this application; Figure 7 This is a structural diagram of an optional automotive fault code filtering device based on a single counter, according to an embodiment of this application. Figure 8 This is a schematic diagram of an optional electronic device structure provided in an embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] To address the problems mentioned in the background art, according to one aspect of the embodiments of this application, an embodiment of a vehicle fault code filtering method based on a single counter is provided.
[0021] It should be noted that the vehicle fault code filtering method based on a single counter provided in this application is generally executed by a controller and / or terminal device, and correspondingly, the vehicle fault code filtering device based on a single counter is generally installed in the controller / terminal device.
[0022] like Figure 1 As shown, Figure 1 This is a flowchart illustrating a single-counter-based automotive fault code filtering method provided in an embodiment of the present invention. Taking the single-counter-based automotive fault code filtering method executed by a controller as an example, the single-counter-based automotive fault code filtering method includes the following steps: Step S102: Obtain the previous state and current state of the fault cache.
[0023] Among these methods, real-time generated statuses, historical statuses, filtered results, count values, and other data can be cached for easy retrieval without consuming excessive storage resources.
[0024] In this embodiment, to reduce workload and conserve computing resources, the task is in a silent state when there is no fault. It is necessary to compare the previous state with the current state in a temporary fault cache. If both the previous and current states are fault-free, it indicates a stable and normal state, and no computing resources need to be allocated for the fault. Conversely, if either the previous or current state has a temporary fault, it indicates a fault determination state, requiring confirmation of whether a fault has occurred or confirmation of fault resolution.
[0025] In some examples, at the front end of the vehicle fault code, there is a separate logic to determine whether the fault condition is met. If the condition is met, a fault occurs, and then it enters the double filtering stage. When filtering the fault code status, only two states, 0 or 1, are received. 0 indicates that the preceding fault condition is not met, i.e., there is no fault; 1 indicates that the preceding fault condition is met, i.e., there is a fault. For filtering with only two discrete states, the goal is to debouncing and eliminate instantaneous glitches and noise; therefore, amplitude limiting debouncing filtering is selected.
[0026] Step S104: If the previous state was fault-free and the current state is faulty, perform a first-level filtering count to confirm the fault for the target counter until the count value of the first-level filtering count reaches the first threshold, then confirm the fault.
[0027] In the first-level filtering process, a target counter is used to determine whether a fault has definitely occurred. A first threshold N is set for determining whether a fault has occurred. When the received current state is 1 and the previous state is 0, it indicates that a fault is occurring and all preceding fault conditions have been met. The target counter starts counting, incrementing the count by 1 for each consecutive received state 1; if a state 0 is received, the count is immediately reset to zero. If the count reaches the first threshold N, the fault is determined to have occurred. When the count reaches the first threshold N, if the current state is 1, the count value N is maintained; if the current state is 0, the counter is reset to zero.
[0028] Step S106: If the previous state was faulty and the current state is fault-free, perform double-filter counting to confirm fault elimination on the target counter until the count value of the double-filter count reaches the second threshold, then confirm fault elimination.
[0029] In the double filtering process, the target counter is used to determine whether the fault has been stably eliminated, excluding brief periods of fault-free operation due to interference, signal jitter, etc. A second threshold M is set to determine whether the fault has been eliminated, where N and M can be equal or unequal. Since the vehicle rarely experiences faults under default conditions, and the current fault state is mostly 0, to reduce the frequency of target counter usage, if the fault has never received a fault state 1 during vehicle startup, the target counter does not need to be activated. Counting begins when a fault state 1 has been received in the past and the current fault state is 0. Each consecutive receipt of a state 0 increments the count by 1; if a state 1 is received, the count is immediately reset to zero. If the double filtering count reaches the second threshold M, the fault is considered stably eliminated. When the double filtering count reaches the second threshold M and the current state is 0, the target counter maintains the count value M; if the current state is 1, the target counter is reset to zero.
[0030] Combination Figure 2 As shown, Figure 2 This embodiment provides an optional target counter timing diagram. In the 0s-2s phase, the current state (current fault state) is 0, indicating no fault, and neither counting nor filtering occurs. At 2s, the current state changes from 0 to 1, entering the first-stage filtering count accumulation. At 4s, the first threshold N is reached, confirming a fault, and this is maintained until the 5th second, after which the counter is reset, and the current state changes from 0 to 1, entering the second-stage filtering count. In the 5s-6s phase, the current state changes from 1 to 0, and the second-stage filtering count accumulation begins. At the 6th second, the second threshold M is reached, confirming the fault is eliminated, and this is maintained until the 7th second, after which the current state changes from 0 to 1, the counter is reset, and the system switches to first-stage filtering count. In the 7s-8s phase, the current state is 1, but the first-stage filtering count value has not reached the first threshold N, indicating no fault or fault elimination. In the 8s-10s phase, the current state changes from 1 to 0, entering the second-stage filtering count, and the count reaches the second threshold M, indicating fault elimination. During the 10s-12s phase, the system switches to first-level filter counting accumulation, and the count value reaches the first threshold N in the 12th second, confirming a fault. Finally, by combining the first filter count and the second filter count, the following is obtained: Figure 2 The counting rules of a single counter in the system.
[0031] Combination Figure 3 As shown, Figure 3 This is a timing diagram showing the filtered result of an optional single-counter-based automotive fault code filtering method provided in this embodiment. After performing primary and secondary filtering on the output current fault status, the results are: 0s~4s no fault, 4s~6s fault confirmed, and 6s~12s fault confirmed cleared.
[0032] To more clearly illustrate the single-counter-based automotive fault code filtering method, an example is provided of its application in a domain controller to diagnose whether communication node messages with the BMS (Battery Management System) have been lost. First, determining whether a fault has definitely occurred requires a first-level filtering process. For example, continuous monitoring of node message loss for 2000ms is needed to determine if a communication loss fault has actually occurred. The loss duration can be converted into a target counter value to determine the corresponding first threshold N, for example, a counting method of 1 time / second. Further, if the fault is determined to have actually occurred, the fault state needs to be latched to prevent accidental elimination of the fault due to interference. To confirm whether the fault has been eliminated, a second-level filtering process is required. For example, continuous monitoring of node message recovery (i.e., no communication loss for 1000ms) is needed to determine if the fault has been confirmed as eliminated or is in a fault-free state. By employing double filtering, the safety hazards caused by immediately eliminating faults without filtering after receiving instantaneous messages and resuming communication can be avoided. For example, when a fault occurs, the vehicle may be controlled to lower the high voltage; after the fault is cleared, the high voltage may be restored. However, due to signal interference or software instability, the fault state may repeatedly switch between faulty and fault-free states, resulting in the vehicle repeatedly raising and lowering the high voltage. Therefore, by using double filtering based on this method, the stability and determinism of the state can be guaranteed, thereby avoiding the aforementioned safety hazards.
[0033] In this embodiment of the invention, based on the characteristic that a fault is either 1 or 0, it is impossible for the results of confirming and eliminating a fault to occur simultaneously. Utilizing mutual exclusion, time-division multiplexing is performed based on the same target counter to achieve a dual filtering function, which is more conducive to saving counter resources. Fault period analysis is performed based on the previous and current states. By performing a first-level filtered count and comparing it with a first threshold, it is possible to confirm whether a fault has occurred, achieving first-level filtering of the fault and improving the certainty and stability of the fault state. Furthermore, after first-level confirmation of whether a fault has occurred, the persistence of the fault state is further considered to ensure that the handling measures for the fault have sufficient time to be executed and to avoid interruptions in the handling process. A second-level filtered count is also performed using the target counter, combined with a second threshold to determine whether the fault has been eliminated, thereby determining the persistence of the fault. This further improves the accuracy and stability of the fault state, making it easier for maintenance personnel to quickly locate the fault state of the entire vehicle and promptly remind users to ensure safety.
[0034] In some alternative embodiments, step S104 includes: S1041, if the previous state was fault-free and the current state is faulty, it is determined that the current state is in the fault confirmation period. S1042, during the fault occurrence confirmation period, perform a first-stage filtering count on the target counter to obtain a first count value, and retrieve the first threshold from a preset full fault threshold mapping table based on the fault confirmation ID; S1043, compare the first count value with the first threshold; S1044, If the first count value reaches the first threshold, a fault is confirmed to have occurred; S1045, if the first count value has not reached the first threshold and the current state is the same as the previous state, then the first count value accumulation operation is performed based on the target counter.
[0035] Since the primary and secondary filtering counts share the same target counter, determining whether the target counter is in primary or secondary filtering requires comparing the previous and current states of the fault buffer. If the two states are not equal, it indicates a change in the filtering rules, and the system enters a different filtering count. The full fault threshold mapping table can be pre-configured to retrieve the corresponding fault type threshold based on the fault ID, including setting thresholds for fault occurrence confirmation and fault clearance confirmation for different faults. Each fault type is configured with a corresponding fault ID, including a fault confirmation ID and a fault clearance ID, to achieve a one-to-one mapping with the threshold.
[0036] Combination Figure 4 As shown, Figure 4 This is a timing diagram of a target counter for an optional single-stage filtering count, provided in an embodiment of the present invention. A current state of 0 indicates no fault; a current state of 1 indicates a fault. Figure 4 In this process, the current state is defined as the 2s-3s period, and the current state is 1. The previous state corresponds to the 1s-2s period and is 0. At this point, the condition that the previous state was fault-free and the current state is faulty is satisfied. Therefore, it is determined that the current state is in the fault confirmation period, which is used to confirm whether the fault has actually occurred.
[0037] Furthermore, combined Figure 4 As shown, a first-stage filtered counting is performed using a target counter. The target counter begins counting upon entering the fault confirmation period. After each count, it is compared with a first threshold N to confirm whether the first threshold has been reached. Counting starts from 2 seconds. Each consecutive receipt of a state 1 indicates that the first count value has been incremented by 1, corresponding to the 2-4 second period. At 4 seconds, the first count value reaches the first threshold N, at which point a fault is confirmed. For example, if communication loss is confirmed by counting once per second, from 2 seconds to 4 seconds, the fault duration is confirmed as 2 seconds, the cumulative count is 2, and the first threshold is 2, thus confirming communication loss. Subsequently, the count value N is maintained from 4 seconds to 5 seconds. After 5 seconds, the current state is 0, at which point the target counter is reset to zero, and the process switches to a second-stage filtered counting.
[0038] In this embodiment, a first count value is obtained through a first-stage filtering count, and the first count value is compared with a first threshold. When the first count value reaches the first threshold, the fault is confirmed to have occurred and a first-stage filtering is performed, so that the fault status is further confirmed, avoiding the instability of the status caused by instantaneous interference and signal jitter, and improving the accuracy and stability of the fault status.
[0039] In some alternative embodiments, step S106 includes: S1061, if the previous state was faulty and the current state is faultless, it is determined that the current state is in the fault clearance confirmation period. S1062, during the fault elimination confirmation period, perform double filtering counting on the target counter to obtain a second count value, and retrieve the second threshold from the preset full fault threshold mapping table based on the fault confirmation ID; S1063, compare the second count value with the second threshold; S1064, If the second count value reaches the second threshold, then the fault is confirmed to be eliminated; S1065, if the second count value has not reached the second threshold and the current state is the same as the previous state, then the second count value accumulation operation is performed based on the target counter.
[0040] Combination Figure 5 As shown, Figure 5 This is a timing diagram of a target counter for an optional double-filtered counting method provided in an embodiment of the present invention. Figure 5 In the process, the state is 1 from 2s to 5s and 0 from 5s to 7s. At this time, the condition that the previous state was faulty and the current state is fault-free is met during the 5s to 7s period, which is the fault clearance confirmation period. The fault clearance confirmation period is used to confirm whether the fault has been cleared.
[0041] Furthermore, combined Figure 5 As shown, a double-filtered counting process is performed using a target counter. The target counter begins counting during the fault clearance confirmation period. After each count, it is compared with the second threshold M to confirm whether the second threshold M has been reached. Counting begins from the 5th second. Each consecutive receipt of a state 0 increments the first count value by 1, corresponding to the 5s~6s phase. At the 6th second, the second count value reaches the second threshold M, confirming fault clearance. The count value M is maintained for the subsequent 6s~7s. After the 7th second, the current state is 1, at which point the target counter is reset to zero, and the first-stage filtering count begins. After the first and second filtering, the final filtered output is as follows: Figure 3 As shown.
[0042] In this embodiment, after confirming whether a fault has occurred, the persistence of the fault state is further considered to ensure that the handling measures for the fault have sufficient time to be executed and to avoid interruption in the handling process. The target counter is further used for double filtering and counting, and the second count value and the second threshold are combined to determine whether the fault has been eliminated. This further confirms the persistence of the fault state and avoids the instability of the state caused by instantaneous interference and signal jitter. This further improves the accuracy and stability of the fault state and is more conducive to the maintenance personnel to quickly locate the fault state of the whole vehicle and promptly remind users to ensure safety.
[0043] In some alternative embodiments, after step S106, the method further includes: S108, obtain the previous state filtering result of the fault buffer; S110, based on the fault occurrence confirmation result and fault elimination confirmation result in the current state, and combined with the filtering result of the current state and the previous state, the fault state is temporarily latched.
[0044] In this embodiment, a temporary latch function is provided to store the fault states of fault codes, including fault states that need to be temporarily stored during fault condition determination and filtering. This stored state is used to control the vehicle to execute corresponding fault handling measures. For example, when the BMS communication loss fault state is determined to be 1, high-voltage processing is performed; when the motor fault state is determined to be 1, vehicle power is limited, etc. This state needs to be maintained during software operation and should not be cleared or changed due to instantaneous changes in fault conditions. However, when the vehicle is powered off or the software is restarted, this stored state needs to be cleared. To achieve the above state storage, a storage area or latch is typically used. However, storage based on a storage area involves allocating a fixed storage area in the hardware. When a fault is confirmed by the first-level filtering, fault state 1 is written to the storage area, and a count value is maintained until the fault is eliminated by the second-level filtering, at which point fault state 0 is written, and the count value is flushed. This method consumes hardware storage resources.
[0045] As shown in Table 1, latch-based storage utilizes an integrated, encapsulated software module latch. The latch's function is to use the first-level filtering result as the first input and the second-level filtering result as the second input to latch the result. It uses the upper limit of the counter count as the threshold T. When the first-level filtering count reaches the threshold T, the first input = 1, the second input = 0, and the output fault state 1 is latched. During this period, if the current fault jitter causes the first-level filtering to be cleared, as long as the fault clearance condition is not met (i.e., the second-level filtering count is not full T), the first input = 0, the second input = 0, and the output fault state remains the previous state 1. Only when the second-level filtering count reaches full T, the first input = 0, the second input = 1, and the output state 0 is then released, and the fault is cleared. Similarly, fault state 0 can also be latched using the first input = 0 and the second input = 0. However, latches are mainly used in hardware design. When adapted to software design, they can lead to high complexity. Furthermore, the case where the first and second inputs are both 1 will not occur in the working condition of this method, which will result in redundant computing resources and waste.
[0046] Table 1 Function Table of Latch
[0047] Furthermore, based on the above problems, in this embodiment, the fault state is temporarily latched according to the fault occurrence confirmation result and the fault elimination confirmation result in the current state, combined with the filtering result of the current state and the previous state. This not only better adapts to the latching rules of a single counter, but also eliminates the need to allocate a separate storage area and avoids using a high-complexity latch.
[0048] The previous state filtering result is the state after the previous state has undergone one or two filtering steps, including state 0 and state 1. The fault occurrence confirmation result indicates whether a fault has occurred, and the fault elimination confirmation result indicates whether a fault has been eliminated. If a fault has occurred or been eliminated, R=1 is output, and the fault buffer count is not updated; if a fault has not yet been confirmed to have occurred or been eliminated, R=0 is output (the target counter's count has not reached the first or second threshold).
[0049] Furthermore, based on the current state, the filtering results of the previous state, the fault occurrence confirmation results, and the fault elimination confirmation results, the final fault state is latched, which includes the fault determination state and the fault elimination state.
[0050] In this embodiment, the fault state is temporarily latched based on the fault occurrence confirmation result and fault elimination confirmation result in the current state, combined with the filtering result of the current state and the previous state. This not only better adapts to the latching rules of a single counter, but also eliminates the need to allocate a separate storage area and avoids using a high-complexity latch, thus saving storage resources and reducing the complexity of the software structure.
[0051] In some alternative embodiments, step S110 includes: S1101, if the fault confirmation result and the current state indicate that there is a fault, then the output fault confirmation state indicating that there is a fault is temporarily latched. S1102, if the fault elimination confirmation result and the current state indicate that the fault has been eliminated, then the output fault elimination state representing the fault elimination is temporarily latched. S1103, if the fault occurrence confirmation result is not confirmed or the fault elimination confirmation result is not confirmed, then the previous state filtering result obtained from the fault cache is latched.
[0052] Combination Figure 6 As shown, Figure 6 This is a timing diagram for an optional fault state temporary latch provided in an embodiment of the present invention. The functions to be implemented by the temporary latch include: when the first-level filter count reaches N (at the 4th second), outputting a fault state R=1 (fault present); when the output fault state R=1 and the current state is 1, the temporary latch outputs a fault state, and after the current state is temporarily cleared and changes to 0 (5s~6s), the fault output remains 1 until the second-level filter count reaches M (at the 6th second), at which point the output fault state is 0, and the fault is cleared; when the output fault state is 0 and the current state is 0, the latch outputs a fault-free state, a temporary fault occurs, and after the state changes to 1 (7s~8s), the fault output remains 0 until the first-level filter count reaches N, and this cycle repeats.
[0053] Furthermore, based on the aforementioned temporary storage function, the truth table in Table 2 below is obtained through analysis.
[0054] Table 2 Truth table for latches
[0055] Furthermore, based on Table 2, we can analyze that: when the target counter reaches the corresponding threshold, R=1. If the current state = 1, it indicates that in the first filtering process, the first count value has reached the first threshold N. At this time, the fault confirmation state 1 (filter output value) should be output and latched. If the current fault state = 0, it indicates that in the second filtering process, the second count value has reached the second threshold M. At this time, the fault clearance state 0 should be output and latched.
[0056] Furthermore, when the target counter has not reached its upper limit, the output R=0, indicating that the fault occurrence confirmation result or the fault clearance confirmation result has not been confirmed. In this case, the latched fault state should be maintained, that is, the output value in the fault buffer should be used to determine the filtering result of the previous state. If the filtering result of the previous state is fault confirmation state 1, then the current filtered output value remains 1 and is latched, indicating that a fault has been confirmed. Figure 6 During the 5s-6s phase, if the previous state's filtering result was fault clearance state 0, then the current filtering output value remains 0 and is latched, indicating that no fault has occurred or that any faults that occurred have been stably cleared. Figure 6 The 7s~8s phase.
[0057] In this embodiment, if a fault is confirmed to have occurred or has been cleared, the filtered output value is directly output and temporarily latched. If a fault has not yet been confirmed to have occurred or has not yet been cleared, the current output value is directly synchronized and cached with the previous state filtering result in the fault cache. This approach does not require allocating a new storage area or using a complex latch, thus reducing storage resource consumption and software complexity.
[0058] In some alternative embodiments, prior to step S102, the method further includes: S100, assign an independent fault ID to each communication fault, and configure different fault thresholds accordingly, wherein the configuration parameters corresponding to different fault thresholds are different; S101, Generate the preset full fault threshold mapping table based on each fault ID and the fault threshold.
[0059] This system can pre-assign individual thresholds to each fault, including a first threshold to determine if a fault has occurred and a second threshold to determine if the fault has been cleared. It can also include thresholds for other faults. Different faults consider different influencing parameters, and each fault requires a different threshold range because different faults require varying degrees of filtering. Furthermore, if the fault strategy changes subsequently, modifying any threshold will not affect the results of other counters, increasing the flexibility of function implementation. For example, to determine whether an important message sent from a motor to the central domain controller is correct, it is necessary to diagnose important message loss or verification faults. Due to the direct connection of transceiver hardware and the influence of acquisition accuracy, the raw communication state received by the underlying hardware is very susceptible to interference, thus requiring filtering to ensure the fault is accurate and stable. As another example, determining the confirmation threshold for a message loss fault requires considering how long the message loss will last and how much it will affect motor control functions, thus using fault determination to restrict the motor or other functions. Similarly, determining the clearing threshold for a message loss fault requires considering the safety response time after the fault occurs and the time required for stable message output before the relevant functions can be restarted normally. Similarly, message correctness is divided into errors such as loss and verification. The algorithms used to judge loss and verification errors are different, and the time thresholds required are also different.
[0060] In this embodiment, the threshold for all faults is large and complex. To address this, a full fault threshold mapping table is set up, and a unique fault ID is assigned to each fault. When a faulty process is invoked, the corresponding threshold is retrieved based on the fault ID, and then the subsequent filtering process is initiated.
[0061] In this embodiment, by using a preset fault threshold mapping table, when a faulty process is invoked, the corresponding threshold can be quickly retrieved based on the fault ID. This allows for the rapid provision of different thresholds for different faults, making the system more targeted and facilitating accurate threshold judgment. It also avoids the problem of low judgment accuracy caused by setting a single threshold in a one-size-fits-all manner.
[0062] In some optional embodiments, after comparing the first count value with the first threshold, or comparing the second count value with the second threshold, the method further includes: If the first count value reaches the first threshold or the second count value reaches the second threshold, and the previous state is different from the current state, then the target counter performs a counting rule conversion and the count value is cleared to zero.
[0063] Combination Figure 6As shown, when the first count value reaches the first threshold N, or the second count value reaches the second threshold M, the state changes, including changing from the previous state 1 to the current state 0, and from the previous state 0 to the current state 1. After the state change, the filtering process changes, and the corresponding counting rules also change accordingly. Therefore, the target counter is reset to zero, and the next round of counting begins. Thus, a dual filtering function is achieved based on a single target counter.
[0064] According to another aspect of the embodiments of this application, such as Figure 7 As shown, corresponding to the single-counter-based automotive fault code filtering method in the above embodiments, this embodiment provides a single-counter-based automotive fault code filtering device, the device comprising: The data acquisition module 701 is used to acquire the previous and current states of the fault cache; The fault confirmation module 703 is used to perform a first-stage filtering count to confirm the occurrence of a fault on the target counter when the previous state was fault-free and the current state is faulty, until the count value of the first-stage filtering count reaches a first threshold, and then confirm the occurrence of a fault. The fault elimination confirmation module 705 is used to perform a double-filtered count to confirm fault elimination on the target counter when the previous state was faulty and the current state is fault-free, until the count value of the double-filtered count reaches a second threshold, and then confirm that the fault has been eliminated.
[0065] It should be noted that in this embodiment, the data acquisition module 701 can be used to execute step S102 in this application embodiment, the fault occurrence confirmation module 703 in this embodiment can be used to execute step S104 in this application embodiment, and the fault elimination confirmation module 705 in this embodiment can be used to execute step S106 in this application embodiment.
[0066] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of the device, can operate in situations such as... Figure 1 The hardware environment shown can be implemented either through software or through hardware.
[0067] Optionally, the fault occurrence confirmation module 703 is specifically configured to: determine that the current state is a fault occurrence confirmation period when the previous state is fault-free and the current state is faulty; during the fault occurrence confirmation period, perform a first-stage filtering count on the target counter to obtain a first count value, and retrieve the first threshold from a preset full fault threshold mapping table based on the fault confirmation ID; compare the first count value with the first threshold; if the first count value reaches the first threshold, confirm that a fault has occurred; if the first count value does not reach the first threshold and the current state is the same as the previous state, perform an increment operation on the first count value based on the target counter.
[0068] Optionally, the fault clearance confirmation module 705 includes: determining that the current state is a fault clearance confirmation period when the previous state is faulty and the current state is fault-free; performing double filtering counting on the target counter during the fault clearance confirmation period to obtain a second count value, and retrieving the second threshold from a preset full fault threshold mapping table based on the fault confirmation ID; comparing the second count value with the second threshold; confirming fault clearance if the second count value reaches the second threshold; and performing a second count value accumulation operation based on the target counter if the second count value does not reach the second threshold and the current state is the same as the previous state.
[0069] Optionally, the device further includes: a filtering result acquisition module, used to acquire the filtering result of the previous state of the fault buffer; and a latching module, used to temporarily latch the fault state based on the fault occurrence confirmation result and fault elimination confirmation result in the current state, combined with the filtering result of the current state and the previous state.
[0070] Optionally, the latching module is specifically configured to: if the fault occurrence confirmation result and the current state indicate a fault, temporarily latch the output fault confirmation state indicating a fault; if the fault elimination confirmation result and the current state indicate fault elimination, temporarily latch the output fault elimination state indicating fault elimination; if the fault occurrence confirmation result is not confirmed or the fault elimination confirmation result is not confirmed, maintain latching the previous state filtering result obtained from the fault buffer.
[0071] Optionally, the device further includes: an ID configuration module, used to assign an independent fault ID to each communication fault and configure different fault thresholds, wherein the configuration parameters corresponding to different fault thresholds are different; and a mapping table construction module, used to generate the preset full fault threshold mapping table based on each fault ID and the fault threshold.
[0072] Optionally, the fault occurrence confirmation module or the fault elimination confirmation module is further configured to: if the first count value reaches the first threshold or the second count value reaches the second threshold, and the previous state is different from the current state, then the counting rule executed by the target counter is changed, and the count value is cleared to zero.
[0073] It should be noted that the suffixes such as module, submodule, and subunit used to represent elements in the above-described device are only for the purpose of illustrative purposes and have no specific meaning in themselves. Therefore, they can be used in combination.
[0074] According to another aspect of the embodiments of this application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A domain controller of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the single-counter-based automotive fault code filtering method in any of the above embodiments.
[0075] According to another aspect of the embodiments of this application, this application also provides a vehicle, such as Figure 8 As shown, the device includes a memory 801, a domain controller 803, and a network interface 805. The memory 801 stores a computer program that can run on the domain controller 803. The memory 801 and the domain controller 803 communicate through the network interface 805 and a communication bus 807. When the electronic device is running, the domain controller 803 communicates with the memory 801 through the network interface 805. When the domain controller 803 executes the computer program, it implements the steps of the above-described single-counter-based automotive fault code filtering method.
[0076] The memory and domain controller in the aforementioned electronic device communicate with each other via a communication bus and communication interface. The communication bus can be a PCI bus (Peripheral Component Interconnect Standard) or an extended industry standard EISA bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. The memory can include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory can also be at least one storage device located remotely from the aforementioned domain controller. The aforementioned domain controller can be a general-purpose controller, including a central controller (CPU), a network controller (NP), etc.; it can also be a digital signal controller (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0077] It is understood that the embodiments described herein can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits, digital signal domain controllers, digital signal processing devices, microdomain controllers, and other electronic units or combinations thereof for performing the functions described herein. For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. Software code can be stored in memory and executed via a domain controller.
[0078] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, or a combination of computer software and electronic hardware. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0079] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or other forms.
[0080] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, the functional units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0081] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0082] It should be noted that, in this document, relational terms such as first, second, etc., are used only to distinguish one entity or operation from another entity or operation. The terms include, encompass, or any other variations thereof are 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 elements inherent to such process, method, article, or apparatus.
[0083] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for filtering automotive fault codes based on a single counter, characterized in that, The method includes: Get the previous and current states of the fault cache; If the previous state was fault-free and the current state is faulty, perform a first-level filtering count to confirm the fault for the target counter until the count value of the first-level filtering count reaches the first threshold, then confirm the fault. If the previous state was faulty and the current state is fault-free, perform double-filter counting to confirm fault elimination on the target counter until the count value of the double-filter count reaches the second threshold, then confirm fault elimination. Here, confirming fault elimination means that the fault that occurred in the previous state is confirmed to be eliminated when the current state is fault-free and the count value of the double-filter count reaches the second threshold.
2. The method according to claim 1, characterized in that, When the previous state was fault-free and the current state is faulty, performing a first-level filtered counting to confirm the fault on the target counter until the count value of the first-level filtered count reaches a first threshold, then confirming the fault includes: If the previous state was fault-free and the current state is faulty, it is determined that the current period is the fault confirmation period. During the fault confirmation period, a first-level filtered count is performed on the target counter to obtain a first count value, and the first threshold is retrieved from a preset full fault threshold mapping table based on the fault confirmation ID. The first count value is compared with the first threshold; If the first count value reaches the first threshold, a fault is confirmed to have occurred; If the first count value has not reached the first threshold, and the current state is the same as the previous state, then the first count value is incremented based on the target counter.
3. The method according to claim 2, characterized in that, When the previous state was faulty and the current state is fault-free, the target counter is subjected to a double-filtered counting process to confirm fault clearance until the count value of the double-filtered count reaches a second threshold, at which point the fault clearance is confirmed. This includes: If the previous state was faulty and the current state is fault-free, it is determined that the current period is the fault clearance confirmation period. During the fault clearance confirmation period, double filtering counting is performed on the target counter to obtain a second count value, and the second threshold is retrieved from the preset full fault threshold mapping table based on the fault confirmation ID; The second count value is compared with the second threshold; If the second count value reaches the second threshold, the fault is confirmed to be eliminated; If the second count value does not reach the second threshold, and the current state is the same as the previous state, then the second count value accumulation operation is performed based on the target counter.
4. The method according to claim 1, characterized in that, In the case where the previous state was faulty and the current state is fault-free, a double-filtered counting process is performed on the target counter to confirm fault clearance until the count value of the double-filtered count reaches a second threshold. After confirming fault clearance, the method includes: Retrieve the previous state filtering result of the fault cache; Based on the fault occurrence confirmation result and fault elimination confirmation result in the current state, and combined with the filtering result of the current state and the previous state, the fault state is temporarily latched.
5. The method according to claim 4, characterized in that, The step of temporarily latching the fault state based on the fault occurrence confirmation result and fault elimination confirmation result in the current state, combined with the filtering result of the current state and the previous state, includes: If the fault confirmation result and the current state indicate that there is a fault, then the output fault confirmation state indicating that there is a fault is temporarily latched. If the fault elimination confirmation result and the current state indicate that the fault has been eliminated, then the output fault elimination state representing the fault elimination is temporarily latched. If the fault occurrence confirmation result is not confirmed or the fault elimination confirmation result is not confirmed, then the previous state filtering result obtained from the fault cache is latched.
6. The method according to any one of claims 2 or 3, characterized in that, The method further includes obtaining the preset full fault threshold mapping table in the following manner: Each communication failure is assigned a unique fault ID, and each fault threshold is configured differently, with different configuration parameters corresponding to different fault thresholds; The preset full fault threshold mapping table is generated based on each fault ID and the fault threshold.
7. The method according to claim 3, characterized in that, After comparing the first count value with the first threshold, or comparing the second count value with the second threshold, the method further includes: If the first count value reaches the first threshold or the second count value reaches the second threshold, and the previous state is different from the current state, then the target counter performs a counting rule conversion and the count value is cleared to zero.
8. A vehicle fault code filtering device based on a single counter, characterized in that, The device includes: The data acquisition module is used to acquire the previous and current states of the fault cache. The fault confirmation module is used to perform a first-stage filtering count to confirm the occurrence of a fault on the target counter when the previous state was fault-free and the current state is faulty, until the count value of the first-stage filtering count reaches the first threshold, and then confirm the occurrence of a fault. The fault elimination confirmation module is used to perform a double-filtered count to confirm fault elimination on the target counter when the previous state was faulty and the current state is fault-free, until the count value of the double-filtered count reaches a second threshold, and then confirm that the fault has been eliminated.
9. A vehicle comprising: The electronic device comprises a domain controller, a memory, and a network interface, wherein the memory stores machine-readable instructions executable by the domain controller, characterized in that: when the electronic device is running, the domain controller communicates with the memory via the network interface, and the domain controller executes the machine-readable instructions to perform the steps of the single-counter-based automotive fault code filtering method as described in any one of claims 1 to 7.
10. A storage medium having domain controller-executable program code, characterized in that, The program code causes the domain controller to execute the steps of the single-counter-based automotive fault code filtering method according to any one of claims 1 to 7.