A circuit fault self-detection system, method and storage medium
By designing a circuit fault self-test system in the intelligent control system, and using the analog-to-digital conversion values of the reference voltage circuit and the sensor signal amplification circuit to determine the fault, the problem of sampled data is solved, ensuring the safety and data accuracy of the main control circuit.
Patent Information
- Application Number
- CN202210727158.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2042-06-24
AI Technical Summary
In intelligent control systems, distortion of data collected by the sampling sensor may lead to erroneous control of the main control circuit, or even serious damage, especially when the signal processing-related circuits fail.
A circuit failure self-test system is designed, including the main control circuit, reference voltage circuit, sensor signal amplification circuit and processor. The reference voltage is provided through the reference voltage circuit, and the sensor signal amplification circuit converts it into analog-to-digital conversion value. The processor Determine whether the reference voltage circuit and sensor signal amplification circuit are faulty and ensure the accuracy of the sampled data.
Effectively detect and prevent signal processing circuit failures, protect the main control circuit from damage, and ensure the accuracy of sampling sensor data and the safety of the circuit.
Smart Images

Figure CN115144727B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of fault detection, and in particular to a circuit fault self-detection system, method and storage medium. Background Art
[0002] In intelligent control systems, it is necessary to sense changes in the controlled object through changes in hardware circuit sampling sensors to achieve closed-loop control of the controlled object. For example, in the current closed-loop control of the motor, the current detected by the sampling sensor is compared with the expected control current to control the motor current and control the motor.
[0003] The inventors believe that in the process of sampling circuit information of the sampling sensor, if the related circuits for sampling or signal processing fail, the data collected by the sampling sensor will be distorted. The distorted sampling data will cause errors in the control of the main control circuit, and in severe cases may even cause serious damage to the main control circuit. Summary of the invention
[0004] In order to detect the relevant circuits for signal processing in a timely manner when a fault occurs and protect the main control circuit from being damaged, the present application provides a circuit fault self-detection system, method and storage medium.
[0005] The present application provides a circuit fault self-detection system that adopts the following technical solution:
[0006] A circuit fault self-checking system comprises a main control circuit, a reference voltage circuit, a sensor signal amplifying circuit and a processor;
[0007] The reference voltage circuit is connected to the sensor signal amplifying circuit, the main control circuit is connected to the sensor signal amplifying circuit, and the processor is connected to the sensor signal amplifying circuit;
[0008] The reference voltage circuit is used to provide a reference voltage for the sensor signal amplifying circuit, the sensor signal amplifying circuit is used to convert the reference voltage into an analog-to-digital conversion value, and the processor is used to determine whether the sensor signal amplifying circuit and the reference voltage circuit are faulty based on the analog-to-digital conversion value.
[0009] By adopting the above technical solution, the main control circuit is the circuit that needs to be protected, usually the driving circuit or control circuit of a certain device. The reference voltage circuit provides a reference voltage for the sensor signal amplification circuit. The sensor signal amplification circuit is connected to the main control circuit and the reference voltage circuit. The sensor signal amplification circuit is used to convert the reference voltage into an analog-to-digital conversion value. The processor determines whether the reference voltage circuit or the sensor signal amplification circuit is faulty based on the analog-to-digital conversion value, ensuring that the data collected by the sampling sensor of the main control circuit is correct and protecting the main control circuit from damage.
[0010] Optionally, the reference voltage circuit includes:
[0011] Resistor R1, resistor R2 and resistor R3, wherein the resistor R1 is connected in series with the resistor R2, the resistance value of the resistor R1 is equal to the resistance value of the resistor R2, the resistor R1 is externally connected to a power supply, the resistor R2 is grounded, one end of the resistor R3 is connected to the common end of the resistor R1 and the resistor R2, and the other end is connected to the non-inverting input end of the operational amplifier, and the output end of the operational amplifier is connected to the inverting input end of the operational amplifier.
[0012] By adopting the above technical solution, the resistor R1 in the reference voltage circuit is connected to an external power supply. When the external power supply is powered, the voltage input to the operational amplifier depends on the resistance values of the resistor R1 and the resistor R2. The voltage of the external power supply is output as a reference voltage through the operational amplifier. The reference voltage can be easily obtained using the reference voltage circuit.
[0013] Optionally, the sensor signal amplification circuit includes:
[0014] Resistor R5, resistor R6, resistor R7, resistor R8, a second operational amplifier and an analog-to-digital converter, wherein one end of the resistor R5 is grounded and the other end is connected in series to the resistor R6, the other end of the resistor R6 is connected to the output end of the second operational amplifier, the output end of the second operational amplifier is connected to the input end of the analog-to-digital converter, the inverting input end of the second operational amplifier is connected between the resistor R5 and the resistor R6, the resistor R7 is connected between the reference voltage circuit and the non-inverting input end of the second operational amplifier, and the resistor R8 is connected between the main control circuit and the non-inverting input end of the second operational amplifier.
[0015] By adopting the above technical solution, the sensor signal amplification circuit is connected to the reference voltage circuit, and the reference voltage output by the reference voltage circuit is converted into an analog-to-digital conversion value through analog-to-digital conversion. When the main control circuit is turned off, the analog-to-digital conversion value is transmitted to the processor for collecting the analog-to-digital conversion value so that the processor can determine whether the related circuits for signal processing are faulty based on the analog-to-digital conversion value.
[0016] In a second aspect, the present application provides a circuit fault self-detection method, which adopts the following technical solution.
[0017] A circuit fault self-checking method is applied to a circuit fault self-checking system, wherein the circuit fault self-checking system comprises a processor, a main control circuit, a reference voltage circuit and a sensor signal amplifying circuit, and the specific steps include:
[0018] Turn off the main control circuit;
[0019] The sensor signal amplifying circuit converts the reference voltage of the reference voltage circuit into N+M analog-to-digital conversion values through N+M analog-to-digital conversions;
[0020] The sensor signal amplifying circuit sends the N+M analog-to-digital conversion values to the processor;
[0021] The processor calculates the difference between the analog-to-digital conversion value and the analog-to-digital standard value to obtain the absolute value of the analog-to-digital offset value;
[0022] The processor determines whether the absolute value of the modulus offset value is greater than the abnormal flat deviation value;
[0023] If the absolute value of the analog-to-digital offset value is less than or equal to the abnormal flat deviation value, perform N+1 analog-to-digital conversions, and save the absolute value of the analog-to-digital offset value as a valid analog-to-digital conversion value;
[0024] Determine whether the N+1 times of analog-to-digital conversion is greater than the number of analog-to-digital conversion completions;
[0025] If the N+1 times of analog-to-digital conversion is greater than the number of analog-to-digital conversion completions, obtaining an average value of the valid analog-to-digital conversion values based on the valid analog-to-digital conversion values;
[0026] The processor determines whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the valid analog-to-digital conversion value;
[0027] Wherein, the reference voltage circuit is connected to the sensor signal amplifying circuit, the main control circuit is connected to the sensor signal amplifying circuit, and the processor is connected to the sensor signal amplifying circuit;
[0028] The reference voltage circuit is used to provide a reference voltage for the sensor signal amplifying circuit, the sensor signal amplifying circuit is used to convert the reference voltage into an analog-to-digital conversion value, and the processor is used to determine whether the sensor signal amplifying circuit and the reference voltage circuit are faulty based on the analog-to-digital conversion value.
[0029] By adopting the above technical solution, when the main control circuit is turned off, the sensor signal circuit converts the reference voltage generated by the reference circuit into an analog-to-digital conversion value, and sets the number of conversions to N times, so that N analog-to-digital conversion values can be obtained, and the N analog-to-digital conversion values are transmitted to the processor, the processor processes the digital conversion value, the processor compares the analog-to-digital conversion value with the analog-to-digital standard value, obtains the absolute value of the analog-to-digital offset value, the processor determines whether the analog-to-digital offset value is greater than the abnormal flat deviation value, and when it is less than or equal to the abnormal flat deviation value, saves the absolute value of the analog-to-digital offset value as the effective analog-to-digital conversion value, and determines whether the number of analog-to-digital conversions currently performed is greater than the set number of analog-to-digital conversions. When it is greater than the number of analog-to-digital conversions, no analog-to-digital conversion is performed, and the average value of the absolute value of the effective analog-to-digital offset value is obtained based on the collected effective analog-to-digital conversion values. The sensor signal amplification circuit or the reference voltage circuit is judged to be faulty based on the average value of the absolute value of the analog-to-digital offset value. Based on the collected analog-to-digital conversion values, valid analog-to-digital conversion values that meet the requirements are screened out, and whether the sensor signal amplification circuit or the reference voltage circuit is faulty is determined based on whether the size of the valid analog-to-digital conversion value is greater than the set value, thereby ensuring the accuracy of the data collected by the sampling sensor of the main control circuit and protecting the main control circuit from damage.
[0030] Optionally, it also includes the number of abnormal analog-to-digital conversions M:
[0031] If the absolute value of the analog-to-digital offset value is greater than the abnormal flat deviation value, the abnormal analog-to-digital conversion number M=M+1, and when the absolute value of the analog-to-digital offset value is not compared with the abnormal flat deviation value, the analog-to-digital conversion number is in an initial state;
[0032] Determining whether the abnormal analog-to-digital conversion number is greater than the abnormal analog-to-digital conversion standard number;
[0033] If the abnormal analog-to-digital conversion times are greater than the abnormal analog-to-digital conversion standard times, the circuit is abnormally faulty;
[0034] The M <N。
[0035] By adopting the above technical solution, in the collected analog-to-digital conversion value, if the absolute value of the analog-to-digital offset value is greater than the abnormal deviation value, it proves that the analog-to-digital conversion value is abnormal, and the number of abnormal analog-to-digital conversions is recorded. Whenever there is an abnormal analog-to-digital conversion value, the number of abnormal analog-to-digital conversions is increased by 1. Within the set number of analog-to-digital conversions, if the number of abnormal analog-to-digital conversions reaches the standard number of abnormal analog-to-digital conversions, it proves that the electromagnetic interference in the environment where the main control circuit is located is large, and it is prevented as much as possible that the data collected by the sampling sensor is incorrect due to electromagnetic interference, which affects the main control circuit.
[0036] Optionally, obtaining an average value of the absolute value of the modulus offset value based on the absolute value of the modulus offset value includes:
[0037] Get N valid analog-to-digital conversion values;
[0038] Based on the N valid analog-to-digital conversion values, an average value of the absolute values of the analog-to-digital offset values is calculated.
[0039] By adopting the above technical solution, after the external power supply is connected and the main control circuit is turned off, a total of N+M analog-to-digital conversions are performed, among which there are M abnormal analog-to-digital conversion values and N valid analog-to-digital conversion values. The average value of the N valid analog-to-digital conversion values is calculated to obtain the average value of the absolute value of the analog-to-digital offset value.
[0040] Optionally, determining whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the effective analog-to-digital conversion value includes:
[0041] Determine whether the average value of the valid analog-to-digital conversion value is greater than the maximum analog-to-digital conversion offset value;
[0042] If the average value of the effective analog-to-digital conversion value is greater than the maximum analog-to-digital conversion offset value, a circuit abnormality fault is obtained;
[0043] If the average value of the valid analog-to-digital conversion values is less than or equal to the maximum analog-to-digital conversion offset value, the circuit is normal.
[0044] By adopting the above technical solution, if the average value of the effective analog-to-digital conversion value is greater than the maximum offset value of the analog-to-digital conversion, the circuit is abnormally faulty; if the average value of the effective analog-to-digital conversion value is less than or equal to the maximum offset value of the analog-to-digital conversion, the circuit is normal. The effective analog-to-digital conversion value represents the error of the circuit components, such as the resistance value error of the resistor, and the average value of the effective analog-to-digital conversion value represents whether all the components in the circuit are normal. When the resistance error of the components within the circuit is met, if the average value of the effective analog-to-digital conversion value is still beyond the set range, it means that the circuit components are faulty, and the sampling signal is inaccurate due to the failure of the circuit components, which damages the main control circuit as much as possible.
[0045] Optionally, before converting to N analog-to-digital conversion values, the following is also included:
[0046] Parameters are initialized, the parameters including the analog-to-digital conversion value, the number of analog-to-digital conversions, the valid analog-to-digital conversion value, and the number of abnormal analog-to-digital conversions.
[0047] By adopting the above technical solution, the purpose of parameter initialization is to eliminate the data left over from the previous test and prevent the previous data from affecting this test.
[0048] In a third aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:
[0049] A computer-readable storage medium stores a computer program, and when the computer program is loaded and executed by a processor, the above-mentioned circuit fault self-detection method is adopted.
[0050] By adopting the above technical solution, a computer program is generated from the above circuit fault self-detection method and stored in a computer-readable storage medium so as to be loaded and executed by a processor. The computer-readable storage medium facilitates the reading and storage of the computer program.
[0051] In summary, this application includes the following beneficial technical effects:
[0052] When the main control circuit is turned off, the sensor signal circuit converts the reference voltage generated by the reference circuit into an analog-to-digital conversion value, and sets the number of conversions to N times, so that N analog-to-digital conversion values can be obtained, and the N analog-to-digital conversion values are transmitted to the processor, and the processor processes the digital conversion value. The processor compares the analog-to-digital conversion value with the analog-to-digital standard value to obtain the absolute value of the analog-to-digital offset value. The processor determines whether the analog-to-digital offset value is greater than the abnormal flat deviation value, and when it is less than or equal to the abnormal flat deviation value, the processor saves the absolute value of the analog-to-digital offset value as the valid analog-to-digital conversion value, and determines whether the current number of analog-to-digital conversions is greater than the set number of analog-to-digital conversions. When it is greater than the number of analog-to-digital conversions, no analog-to-digital conversion is performed. According to the collected valid analog-to-digital conversion values, the average value of the absolute value of the valid analog-to-digital offset value is obtained, and the sensor signal amplification circuit or the reference voltage circuit is judged whether it is faulty according to the average value of the absolute value of the analog-to-digital offset value. Based on the collected analog-to-digital conversion values, valid analog-to-digital conversion values that meet the requirements are screened out, and whether the sensor signal amplification circuit or the reference voltage circuit is faulty is determined based on whether the size of the valid analog-to-digital conversion value is greater than the set value, thereby ensuring the accuracy of the data collected by the sampling sensor of the main control circuit and protecting the main control circuit from damage. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 This is an overall structural diagram of a circuit fault self-checking system according to an embodiment of the present application;
[0054] Figure 2 is a circuit diagram of a reference voltage circuit according to an embodiment of the present application;
[0055] Figure 3 is a circuit diagram of a sensor signal amplifying circuit according to an embodiment of the present application;
[0056] Figure 4 This is a method flow chart of a circuit fault self-detection method according to an embodiment of the present application;
[0057] Figure 5is a flow chart of a method for obtaining an average value of the absolute value of the modulus offset value based on the absolute value of the modulus offset in the present application;
[0058] Figure 6 It is a flow chart of a method for determining whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the effective analog-to-digital conversion value according to an embodiment of the present application. DETAILED DESCRIPTION
[0059] The present application is further described in detail below in conjunction with all the accompanying drawings.
[0060] The present application embodiment discloses a circuit fault self-detection system, referring to Figure 1 ,include:
[0061] Main control circuit, reference voltage circuit, sensor signal amplification circuit and processor.
[0062] Specifically, the main control circuit is a circuit that needs to be protected, usually a control circuit, such as a circuit used to control the magnitude of the motor current in a current closed-loop control system of a motor; the reference voltage circuit is connected to an external power supply to provide a reference voltage for the sensor signal amplification circuit, and the sensor signal amplification circuit converts the reference voltage into an analog-to-digital conversion value.
[0063] Reference Figure 2 The reference voltage circuit includes: a resistor R1, a resistor R2 and a resistor R3, wherein the resistor R1 is connected in series with the resistor R2, the resistance value of the resistor R1 is equal to the resistance value of the resistor R2, the resistor R1 is externally connected to a power supply, the resistor R2 is grounded, one end of the resistor R3 is connected to the common end of the resistor R1 and the resistor R2, and the other end is connected to the non-inverting input end of the operational amplifier, and the output end of the operational amplifier is connected to the inverting input end of the operational amplifier.
[0064] Specifically, in the reference voltage circuit, the resistance values of the resistor R1 and the resistor R2 are equal. If the external voltage of the resistor R1 is Vcc, since the resistance values of the resistor R1 and the resistor R2 are equal, the voltage flowing into the non-inverting input of the operational amplifier is 0.5Vcc.
[0065] Reference Figure 3The sensor signal amplification circuit includes: a resistor R5, a resistor R6, a resistor R7, a resistor R8, a second operational amplifier and an analog-to-digital converter, wherein one end of the resistor R5 is grounded, and the other end is connected in series to the resistor R6, the other end of the resistor R6 is connected to the output end of the second operational amplifier, the output end of the second operational amplifier is connected to the input end of the analog-to-digital converter, the inverting input end of the second operational amplifier is connected between the resistor R5 and the resistor R6, the non-inverting input end of the second operational amplifier is connected in series with the resistor R7 and the resistor R8, the resistor R7 is connected between the reference voltage circuit and the non-inverting input end of the second operational amplifier, the resistor R8 is connected between the main control circuit and the non-inverting input end of the second operational amplifier, and the analog-to-digital converter in this embodiment uses a 12-bit analog-to-digital converter, which can convert the current into a digital value of 0~212.
[0066] Reference Figure 1 In this embodiment, the main control circuit is illustrated by a motor current closed-loop control loop, including: a resistor R4, a mosfet tube, a load diode and a sampling sensor. The resistor R4 is externally connected to a control signal, and the other end is connected to the base of the mosfet. The collector of the mosfet is connected to the load, and the emitter of the mosfet is connected to the sampling sensor. A diode is connected in parallel between the collector and the emitter of the mosfet, and the anode of the diode is connected to the current sensor, and the cathode is connected to the load. The resistor R8 of the sensor signal amplification circuit is connected to the anode of the diode.
[0067] The reference voltage circuit is connected to the sensor signal amplifying circuit, the main control circuit is connected to the sensor signal amplifying circuit, and the processor is connected to the sensor signal amplifying circuit.
[0068] Specifically, the processor may be an MCU chip.
[0069] The reference voltage circuit is used to provide a reference voltage for the sensor signal amplifying circuit, the sensor signal amplifying circuit is used to convert the reference voltage into an analog-to-digital conversion value, and the processor is used to determine whether the sensor signal circuit and the reference voltage circuit are faulty based on the analog-to-digital conversion value.
[0070] Specifically, the voltage outputted from the output terminal of the reference voltage is defined as the reference voltage Vref. When R1 = R2 for generating the reference voltage, Vref = Vcc / 2.
[0071] When all components of the signal processing circuit are normal and the main control circuit is not working, the current flowing through the current sensor is zero. The input signal of the analog-to-digital converter is Vcc / 2. At this time, the digital value output by the analog-to-digital converter is 211=2048.
[0072] When the main control circuit is not working, that is, the current flowing through the current sensor is zero, but if any device in the signal processing circuit is abnormal at this time, the input signal of the analog-to-digital converter will not be equal to Vcc / 2, and the digital value output by the analog-to-digital converter will no longer be 2048.
[0073] For example, when the main control circuit is not working, when R1 that generates the reference voltage is open, Vref=Vcc, the digital value output by the analog-to-digital converter will be 212=4096; when R1 is short-circuited, Vref=0, the digital value output by the analog-to-digital converter will be 0; when R1 is poorly soldered or wrong, R1≠R2, Vref≠Vcc / 2, the digital value output by the analog-to-digital converter will not be 211=2048.
[0074] Therefore, when the processor obtains the analog-to-digital conversion value, it can determine whether the components of the reference voltage circuit or the sensor signal amplification circuit and whether the circuit loop between them is abnormal based on the data of the analog-to-digital conversion value.
[0075] The implementation principle of a circuit fault self-detection system in an embodiment of the present application is as follows: the main control circuit is a circuit that needs to be protected, usually a driving circuit or a control circuit of a certain device, the reference voltage circuit provides a reference voltage for the sensor signal amplification circuit, the sensor signal amplification circuit is connected to the main control circuit and the reference voltage circuit, the sensor signal amplification circuit is used to convert the reference voltage into an analog-to-digital conversion value, and the processor determines whether the reference voltage circuit or the sensor signal amplification circuit is faulty based on the analog-to-digital conversion value, thereby ensuring that the data collected by the sampling sensor of the main control circuit is correct and protecting the main control circuit from damage.
[0076] A circuit fault self-checking system is described in detail above. A circuit fault self-checking method applied to the circuit fault self-checking system is described in detail below. The circuit fault self-checking system includes a processor, a main control circuit, a reference voltage circuit and a sensor signal amplification circuit.
[0077] Wherein, the reference voltage circuit is connected to the sensor signal amplifying circuit, the main control circuit is connected to the sensor signal amplifying circuit, and the processor is connected to the sensor signal amplifying circuit;
[0078] The reference voltage circuit is used to provide a reference voltage for the sensor signal amplifying circuit, the sensor signal amplifying circuit is used to convert the reference voltage into an analog-to-digital conversion value, and the processor is used to determine whether the sensor signal amplifying circuit and the reference voltage circuit are faulty based on the analog-to-digital conversion value.
[0079] Reference Figure 4 , a circuit fault self-detection method, comprising:
[0080] S100, turn off the main control circuit.
[0081] Specifically, when the main control circuit is turned off and all circuit loops and components are normal, the analog-to-digital conversion value is 2048.
[0082] S110. The sensor signal amplifying circuit converts the reference voltage of the reference voltage circuit into N analog-to-digital conversion values through N analog-to-digital conversions.
[0083] Specifically, the analog-to-digital conversion value is obtained by converting the current flowing into the analog-to-digital converter into the analog-to-digital conversion value through the analog-to-digital converter, and the analog-to-digital conversion value is between 0 and 212.
[0084] S120. The sensor signal amplifying circuit sends the N analog-to-digital conversion values to the processor.
[0085] S130. The processor calculates a difference between the analog-to-digital conversion value and an analog-to-digital standard value to obtain an absolute value of an analog-to-digital offset value.
[0086] Specifically, the analog-to-digital standard value is the analog-to-digital conversion value measured when the circuit loop of the reference voltage circuit and the sensor signal amplification circuit and the components of the circuit are normal. In this embodiment, a 12-bit analog-to-digital converter is used, and the analog-to-digital standard value is 2048. The analog-to-digital offset value is due to the possible error in the resistance value of the components in the circuit, such as the resistance value of the resistor, and the voltage outputted by the output terminal of the operational amplifier of the reference voltage circuit will not be the standard Vcc / 2.
[0087] S140. The processor determines whether the absolute value of the modulus offset value is greater than the abnormal flat deviation value.
[0088] Specifically, the abnormal level deviation value is the maximum allowed error value. The setting of the abnormal level deviation value is different according to different use environments and different circuits.
[0089] S150. If the absolute value of the analog-to-digital offset value is less than or equal to the abnormal flat deviation value, perform N+1 analog-to-digital conversions, and save the absolute value of the analog-to-digital offset value as a valid analog-to-digital conversion value.
[0090] Specifically, when the absolute value of the analog-to-digital offset value is less than or equal to the abnormal flat deviation value, it indicates that the analog-to-digital conversion value measured at this time is within the allowable error range and is a valid analog-to-digital conversion value, so the valid analog-to-digital conversion value is saved.
[0091] S160, determining whether the N+1 times of analog-to-digital conversion is greater than the number of analog-to-digital conversion completions.
[0092] Specifically, the number of analog-to-digital conversion ends is the set number of analog-to-digital conversions. In the process of continuous analog-to-digital conversion, the number of analog-to-digital conversions increases by one each time an analog-to-digital conversion is performed. In computers, for the convenience of calculation, the number is usually set to a power of 2, such as 32 or 64 times. No matter how many analog-to-digital conversions are performed, the process will not end until the number of analog-to-digital conversion end times is collected.
[0093] S170: If the N+1 analog-to-digital conversions are greater than the number of analog-to-digital conversion completions, obtain an average value of the valid analog-to-digital conversion values based on the valid analog-to-digital conversion values.
[0094] Specifically, after the analog-to-digital conversion is completed, the effective analog-to-digital conversion value average value will be saved. The significance of the effective analog-to-digital conversion value average value is to determine whether the overall circuit is within the allowable error range to prevent the situation where a single analog-to-digital conversion value meets the requirements but the overall error is too large.
[0095] S180. The processor determines whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the effective analog-to-digital conversion value.
[0096] Specifically, if the average value of the effective analog-to-digital conversion value is greater than the set allowable error value of the entire circuit, it is determined that the reference voltage circuit or the signal amplification circuit has a fault.
[0097] The embodiment of the present application provides a circuit fault self-checking method, and the real-time principle of the circuit fault self-checking system is as follows: when the main control circuit is turned off, the sensor signal circuit converts the reference voltage generated by the reference circuit into an analog-to-digital conversion value, and sets the number of conversions to N times, so that N analog-to-digital conversion values can be obtained, and the N analog-to-digital conversion values are transmitted to the processor, the processor processes the digital conversion value, the processor compares the analog-to-digital conversion value with the analog-to-digital standard value, obtains the absolute value of the analog-to-digital offset value, the processor determines whether the analog-to-digital offset value is greater than the abnormal flat deviation value, and when it is less than or equal to the abnormal flat deviation value, saves the absolute value of the analog-to-digital offset value as the effective analog-to-digital conversion value, and determines whether the number of analog-to-digital conversions currently performed is greater than the set number of analog-to-digital conversions. When it is greater than the number of analog-to-digital conversions, no analog-to-digital conversion is performed, and the average value of the absolute value of the effective analog-to-digital offset value is obtained based on the collected effective analog-to-digital conversion values, and determines whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the absolute value of the analog-to-digital offset value. Based on the collected analog-to-digital conversion values, valid analog-to-digital conversion values that meet the requirements are screened out, and whether the sensor signal amplification circuit or the reference voltage circuit is faulty is determined based on whether the size of the valid analog-to-digital conversion value is greater than the set value, thereby ensuring the accuracy of the data collected by the sampling sensor of the main control circuit and protecting the main control circuit from damage.
[0098] When the absolute value of the analog-to-digital offset is greater than the abnormal flat deviation value, how to judge whether the circuit related to signal processing is normal.
[0099] Also includes the number of abnormal analog-to-digital conversions M:
[0100] S200. If the absolute value of the analog-to-digital offset value is greater than the abnormal average deviation value, the abnormal analog-to-digital conversion number M=M+1. When the absolute value of the analog-to-digital offset value is not compared with the abnormal average deviation value, the analog-to-digital conversion number is in an initial state.
[0101] Specifically, when the absolute value of the calculated analog-to-digital offset value is greater than the abnormal deviation value, it proves that the analog-to-digital conversion value is abnormal, and the number of abnormalities is recorded. Initially, the number of abnormalities is 0. The abnormal analog-to-digital conversion value is to eliminate the damage to the main control circuit caused by inaccurate data collected by the sampling sensor in harsh environments, such as environments with strong electromagnetic interference.
[0102] S210, determining whether the abnormal analog-to-digital conversion times are greater than the abnormal analog-to-digital conversion standard times.
[0103] Specifically, the standard number of abnormal analog-to-digital conversions is a set maximum number of abnormal analog-to-digital conversion values allowed.
[0104] S220: If the number of abnormal analog-to-digital conversions is greater than the standard number of abnormal analog-to-digital conversions, the reference voltage circuit or the sensor signal amplification circuit is faulty.
[0105] Specifically, when the number of abnormal analog-to-digital conversions is too high, the reference voltage circuit or the sensor signal amplification circuit fails, and the main control circuit needs to be controlled not to start to prevent damage to the main control circuit.
[0106] The implementation principle of the absolute value of the analog-to-digital offset value being greater than the abnormal flat deviation value in the embodiment of the present application is as follows: in the collected analog-to-digital conversion value, if the absolute value of the analog-to-digital offset value is greater than the abnormal flat deviation value, it is proved that the analog-to-digital conversion value is abnormal, and the number of abnormal analog-to-digital conversions is recorded. Whenever there is an abnormal analog-to-digital conversion value, the number of abnormal analog-to-digital conversions is increased by 1. Within the set number of analog-to-digital conversions, if the number of abnormal analog-to-digital conversions reaches the standard number of abnormal analog-to-digital conversions, it is proved that the electromagnetic interference in the environment where the main control circuit is located is very large, and it is prevented as much as possible that the data collected by the sampling sensor is incorrect due to electromagnetic interference, which affects the main control circuit.
[0107] exist Figure 4 In step S170 of the embodiment shown in the figure, the effective analog-to-digital conversion value is obtained by obtaining the average value of the effective analog-to-digital conversion value. Figure 5 The illustrated embodiment is described in detail.
[0108] Reference Figure 5 , obtaining the average value of the absolute value of the modulus offset value based on the absolute value of the modulus offset value comprises:
[0109] S300 , obtaining N+M valid analog-to-digital conversion values.
[0110] Specifically, N+M analog-to-digital conversions are performed to obtain N valid analog-to-digital conversion values, and M abnormal analog-to-digital conversion values. The valid analog-to-digital conversion values are used to eliminate errors caused by circuit components themselves.
[0111] S310: Calculate an average value of the absolute values of the analog-to-digital offset values based on the N valid analog-to-digital conversion values.
[0112] Specifically, the average value of the absolute value of the analog-to-digital offset value is used to determine whether the components of the entire circuit are normal. After excluding the resistance error and electromagnetic interference of the components themselves, if the average value of the absolute value of the analog-to-digital offset value is still abnormal, then there is a fault in the components within the circuit.
[0113] The implementation principle of obtaining the average value of the absolute value of the analog-to-digital offset value based on the absolute value of the analog-to-digital offset described in the embodiment of the present application is: after the external power supply is connected and the main control circuit is turned off, a total of N+M analog-to-digital conversions are performed, among which there are M abnormal analog-to-digital conversion values and N valid analog-to-digital conversion values. The average value of the N valid analog-to-digital conversion values is calculated to obtain the average value of the absolute value of the analog-to-digital offset value.
[0114] exist Figure 4 In step S180 of the embodiment shown in the figure, based on the average value of the effective analog-to-digital conversion value, it is determined whether the sensor signal amplification circuit or the reference voltage circuit is faulty. How to determine whether the circuit is faulty is specifically determined by Figure 6 The illustrated embodiment is described in detail.
[0115] Reference Figure 6 , the determining whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the effective analog-to-digital conversion value comprises:
[0116] S400: Determine whether the average value of the valid analog-to-digital conversion value is greater than the maximum analog-to-digital conversion offset value.
[0117] Specifically, when the maximum error value of the average value of the valid analog-to-digital conversion values allowed in the circuit set by the maximum analog-to-digital conversion offset value exceeds the maximum analog-to-digital conversion offset value, a fault may have occurred in the circuit or components between the circuits. When the average value of the valid analog-to-digital conversion values is greater than the maximum analog-to-digital conversion offset value, step S710 is executed; otherwise, step S720 is executed.
[0118] S410: If the average value of the effective analog-to-digital conversion value is greater than the maximum analog-to-digital conversion offset value, a circuit abnormality fault is obtained.
[0119] S420: If the average value of the valid analog-to-digital conversion values is less than or equal to the maximum analog-to-digital conversion offset value, the circuit is normal.
[0120] The implementation principle of the embodiment of the present application for determining whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the effective analog-to-digital conversion value is as follows: if the average value of the effective analog-to-digital conversion value is greater than the maximum offset value of the analog-to-digital conversion, the circuit is abnormally faulty; if the average value of the effective analog-to-digital conversion value is less than or equal to the maximum offset value of the analog-to-digital conversion, the circuit is normal; the effective analog-to-digital conversion value represents the error of the circuit components, such as the resistance error of the resistor, and the average value of the effective analog-to-digital conversion value represents whether all components in the circuit are normal. When the resistance error of the components within the circuit is met, if the average value of the effective analog-to-digital conversion value is still beyond the set range, it represents a circuit component fault, and the sampling signal is inaccurate due to the failure of the circuit components, which damages the main control circuit as much as possible.
[0121] Before converting to N analog-to-digital conversion values, it also includes:
[0122] Parameters are initialized, the parameters including the analog-to-digital conversion value, the number of analog-to-digital conversions, the valid analog-to-digital conversion value, and the number of abnormal analog-to-digital conversions.
[0123] Specifically, the purpose of parameter initialization is to prevent the previous legacy data from affecting the circuit fault self-detection. For example, if the number of abnormal analog-to-digital conversions is not cleared, the current number of abnormal analog-to-digital conversions will be reduced. Parameter initialization specifically includes clearing the abnormal analog-to-digital conversion number and the analog-to-digital conversion number, and clearing the analog-to-digital conversion value and the valid analog-to-digital conversion value.
[0124] The embodiment of the present application further discloses a computer-readable storage medium, and the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, a circuit fault self-detection method in the above embodiment is adopted.
[0125] Among them, the computer program can be stored in a computer-readable medium, the computer program includes computer program code, the computer program code can be in the form of source code, object code, executable file or certain middleware, etc. The computer-readable medium includes any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the computer-readable medium includes but is not limited to the above-mentioned components.
[0126] Among them, through this computer-readable storage medium, a circuit fault self-detection method in the above embodiment is stored in a computer-readable storage medium, and is loaded and executed on a processor to facilitate the storage and application of the above method.
[0127] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.
Claims
1. A circuit fault self-detection method, characterized in that: Applied to a circuit fault self-checking system, the circuit fault self-checking system includes a processor, a main control circuit, a reference voltage circuit and a sensor signal amplification circuit, and the specific steps include: Turn off the main control circuit; The sensor signal amplifying circuit converts the reference voltage of the reference voltage circuit into N+M analog-to-digital conversion values through N+M analog-to-digital conversions; The sensor signal amplifying circuit sends the N+M analog-to-digital conversion values to the processor; The processor calculates the difference between the analog-to-digital conversion value and the analog-to-digital standard value to obtain the absolute value of the analog-to-digital offset value; The processor determines whether the absolute value of the modulus offset value is greater than the abnormal flat deviation value; If the absolute value of the analog-to-digital offset value is less than or equal to the abnormal flat deviation value, perform N+1 analog-to-digital conversions, and save the absolute value of the analog-to-digital offset value as a valid analog-to-digital conversion value; Determine whether the N+1 times of analog-to-digital conversion is greater than the number of analog-to-digital conversion completions; If the N+1 times of analog-to-digital conversion is greater than the number of analog-to-digital conversion completions, obtaining an average value of the valid analog-to-digital conversion values based on the valid analog-to-digital conversion values; The processor determines whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the valid analog-to-digital conversion value; Wherein, the reference voltage circuit is connected to the sensor signal amplifying circuit, the main control circuit is connected to the sensor signal amplifying circuit, and the processor is connected to the sensor signal amplifying circuit; The reference voltage circuit is used to provide a reference voltage for the sensor signal amplifying circuit, the sensor signal amplifying circuit is used to convert the reference voltage into an analog-to-digital conversion value, and the processor is used to determine whether the sensor signal amplifying circuit and the reference voltage circuit are faulty based on the analog-to-digital conversion value.
2. A circuit fault self-detection method according to claim 1, characterized in that: Also includes the number of abnormal analog-to-digital conversions M: If the absolute value of the analog-to-digital offset value is greater than the abnormal flat deviation value, the abnormal analog-to-digital conversion number M=M+1, and when the absolute value of the analog-to-digital offset value is not compared with the abnormal flat deviation value, the analog-to-digital conversion number is in an initial state; Determining whether the abnormal analog-to-digital conversion number is greater than the abnormal analog-to-digital conversion standard number; If the abnormal analog-to-digital conversion number is greater than the abnormal analog-to-digital conversion standard number, the reference voltage circuit or the sensor signal amplification circuit is faulty.
3. A circuit fault self-detection method according to claim 2, characterized in that: The obtaining, based on the absolute value of the modulus offset value, an average value of the absolute value of the modulus offset value comprises: Get N valid analog-to-digital conversion values; Based on the N valid analog-to-digital conversion values, an average value of the absolute values of the analog-to-digital offset values is calculated.
4. A circuit fault self-detection method according to claim 1, characterized in that: The determining whether the sensor signal amplification circuit or the reference voltage circuit is faulty based on the average value of the effective analog-to-digital conversion value comprises: Determine whether the average value of the valid analog-to-digital conversion value is greater than the maximum analog-to-digital conversion offset value; If the average value of the effective analog-to-digital conversion value is greater than the maximum analog-to-digital conversion offset value, a circuit abnormality fault is obtained; If the average value of the valid analog-to-digital conversion values is less than or equal to the maximum analog-to-digital conversion offset value, the circuit is normal.
5. A circuit fault self-detection method according to claim 1, characterized in that: Before converting to N analog-to-digital conversion values, it also includes: Parameters are initialized, the parameters including the analog-to-digital conversion value, the number of analog-to-digital conversions, the valid analog-to-digital conversion value, and the number of abnormal analog-to-digital conversions.
6. A circuit fault self-detection method according to claim 1, characterized in that: The reference voltage circuit comprises: Resistor R1, resistor R2 and resistor R3, wherein the resistor R1 is connected in series with the resistor R2, the resistance value of the resistor R1 is equal to the resistance value of the resistor R2, the resistor R1 is externally connected to a power supply, the resistor R2 is grounded, one end of the resistor R3 is connected to the common end of the resistor R1 and the resistor R2, and the other end is connected to the non-inverting input end of the operational amplifier, and the output end of the operational amplifier is connected to the inverting input end of the operational amplifier.
7. A circuit fault self-detection method according to claim 1, characterized in that: The sensor signal amplification circuit comprises: Resistor R5, resistor R6, resistor R7, resistor R8, a second operational amplifier and an analog-to-digital converter, wherein one end of the resistor R5 is grounded and the other end is connected in series to the resistor R6, the other end of the resistor R6 is connected to the output end of the second operational amplifier, the output end of the second operational amplifier is connected to the input end of the analog-to-digital converter, the inverting input end of the second operational amplifier is connected between the resistor R5 and the resistor R6, the resistor R7 is connected between the reference voltage circuit and the non-inverting input end of the second operational amplifier, and the resistor R8 is connected between the main control circuit and the non-inverting input end of the second operational amplifier.
8. A computer-readable storage medium having a computer program stored therein, characterized in that: When the computer program is loaded and executed by a processor, the method according to any one of claims 1 to 5 is adopted.
