Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, a first aspect of the invention provides a temperature compensation method.
A second aspect of the present invention is to provide a computer device.
A third aspect of the present invention is to provide a computer-readable storage medium.
A fourth aspect of the present invention is to provide a printed circuit board.
A fifth aspect of the present invention is to provide a compressor.
A sixth aspect of the invention is to provide a vehicle.
In view of this, according to a first aspect of the present invention, there is provided a temperature compensation method comprising: acquiring a data packet, wherein the data packet comprises a plurality of data pairs, each data pair comprises associated voltage and measured temperature, and the measured temperature is calculated by a voltage and voltage temperature relational expression; performing clustering calculation on the data packet to obtain a plurality of central data pairs, wherein the plurality of central data pairs form a central data pair group; fitting a voltage-temperature curve by the central data pair group; and generating a temperature compensation model according to the voltage temperature curve and the theoretical voltage temperature curve, wherein the temperature compensation model is used for compensating the measured temperature.
According to the temperature compensation method provided by the invention, through a large number of semi-physical simulation tests, digital signals (namely voltages) of the NTC temperature-sensitive resistor are collected, data are analyzed by a signal processing method, specifically a clustering method, and finally a temperature compensation model for temperature real-time monitoring is established to compensate the measured temperature, so that the detection precision of the temperature can be improved, and the printed circuit board can be protected more effectively.
In addition, according to the temperature compensation method in the above technical solution provided by the present invention, the following additional technical features may also be provided:
in the foregoing technical solution, preferably, before the operation of performing cluster calculation on the data packet, the method further includes: dividing the data packet into at least two data sub-packets including a modeling data sub-packet and a verification data sub-packet; the operation of performing cluster computation on the data packet comprises the following steps: performing clustering calculation on the modeling data sub-packets; after the operation of generating the temperature compensation model according to the voltage temperature curve and the theoretical voltage temperature curve, the method further comprises the following steps: calculating the error of the temperature compensation model by using the verification data sub-packets; and selecting or rejecting the temperature compensation model based on the condition that the error meets the preset error condition.
In the technical scheme, the data cross validation is adopted, the data packet is divided into at least two data sub-packets, at least one data sub-packet is used for modeling, at least one other data sub-packet is used for validation, the temperature compensation model is used only after the validation is passed, and the accuracy of the temperature compensation model is improved.
In any of the above technical solutions, preferably, the number of the at least two data sub-packets is at least three, and the at least two data sub-packets include at least two modeling data sub-packets and at least one verification data sub-packet; performing cluster calculation on the data packet to obtain a plurality of central data pairs, wherein the step of forming a central data pair group by the plurality of central data pairs comprises the following steps: respectively carrying out clustering calculation on at least two modeling data sub-packets to obtain at least two central data pair groups; the step of calculating the error of the temperature compensation model using the verification data sub-packets includes: and calculating errors of the corresponding temperature compensation models of the at least two central data pairs by using the at least one verification data sub-packet.
In the technical scheme, the number of the data sub-packets is specifically limited to be at least three, wherein the data sub-packets comprise at least two modeling data sub-packets and at least one verification data sub-packet, so that at least two corresponding temperature compensation models can be calculated, and one temperature compensation model is selected for subsequent real-time compensation of the measured temperature.
In any of the above solutions, preferably, the number of at least two data sub-packets is obtained according to the relative precision, the confidence level constant and the weight coefficient.
In the technical solution, parameters affecting the number of data sub-packets are specifically defined. The relative precision is determined by the precision of the NTC resistor, and for the convenience of detection, a fixed value resistor is connected in series with the NTC resistor, and the voltage of the fixed value resistor is collected, so the relative precision is determined by the precision of the NTC resistor and the fixed value resistor; reasonable test data size (i.e., number of data pairs) can be obtained in combination with the confidence level constant; on the basis, the number of the data sub-packets can be obtained by combining the weight coefficients, so that the data sub-packets can be divided reasonably, and the reliability of the generated temperature compensation model is improved.
In any of the above technical solutions, preferably, each data pair further includes a reference temperature, and before the operation of performing cluster calculation on the data packet, the method further includes: and deleting the data pair corresponding to the measured temperature based on the condition that the absolute value of the difference between the reference temperature and the measured temperature is greater than the preset value.
In the technical scheme, the data pair further comprises data of an analog temperature signal read by the thermocouple, namely reference temperature, and the reading of the thermocouple is relatively accurate and is used as reference, the measured temperature derived from voltage is compared with the reference temperature, and the data pair with overlarge difference with the reference temperature is filtered out, so that the accuracy of a temperature compensation model is improved, the detection precision of the temperature is improved, and the printed circuit board is protected more effectively.
In any of the above technical solutions, preferably, the method further includes: based on the condition that the update condition is satisfied, the temperature compensation model is updated.
In the technical scheme, along with the temperature detection, the number of the collected data pairs is gradually accumulated and increased, so that the reference data is increased, the temperature compensation model can be recalculated at a proper time to continuously improve and maintain the detection accuracy, and the printed circuit board is effectively protected.
According to a second aspect of the present invention, there is provided a computer apparatus comprising: a memory configured to store executable instructions; the processor is configured to execute the executable instructions to implement the steps of the method according to any of the above technical solutions, so as to have all technical effects of the temperature compensation method, which will not be described herein again.
According to a third aspect of the present invention, there is provided a computer-readable storage medium, having stored thereon executable instructions, which when executed by a processor, implement the steps of the method according to any of the above technical solutions, thereby achieving all the technical effects of the temperature compensation method, and the details of which are not repeated herein.
According to a fourth aspect of the present invention, there is provided a printed circuit board comprising: a memory configured to store executable instructions; the processor is configured to execute the executable instructions to implement the steps of the method according to any of the above technical solutions, so as to have all technical effects of the temperature compensation method, which will not be described herein again.
In the above technical solution, preferably, the temperature compensation device further includes an NTC resistor and a constant value resistor connected in series, and the voltage in the temperature compensation method is a voltage across the constant value resistor.
In the technical scheme, temperature measurement hardware of the printed circuit board is specifically introduced. An NTC resistor and a fixed value resistor (the precision is determined according to actual requirements) are connected in series on a 5V power supply to form an NTC signal acquisition circuit, wherein the NTC resistor is a temperature-sensitive resistor, the resistance value of the NTC resistor changes along with the temperature change, so that the change of the resistance value of the NTC resistor is reflected by outputting the voltage at two ends of the fixed value resistor, and the change of the resistance value of the NTC resistor reflects the change of the temperature, so that the temperature can be deduced by acquiring a voltage signal.
According to a fifth aspect of the present invention, there is provided a compressor, comprising the computer device according to the above technical solution, or the computer readable storage medium according to the above technical solution, or the printed circuit board according to any one of the above technical solutions, so as to have all the technical effects of the computer device, the computer readable storage medium, or the printed circuit board, which are not described herein again.
According to a sixth aspect of the present invention, there is provided a vehicle, comprising the computer device according to the above technical solution, or the computer-readable storage medium according to the above technical solution, or the printed circuit board according to any one of the above technical solutions, or the compressor according to the above technical solution, so as to have all the technical effects of the computer device, the computer-readable storage medium, the printed circuit board, or the compressor, which are not described herein again.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
Embodiments of the first aspect of the invention provide a method of temperature compensation.
FIG. 1 shows a schematic flow diagram of a temperature compensation method of one embodiment of the present invention. As shown in fig. 1, the method includes:
s102, acquiring a data packet, wherein the data packet comprises a plurality of data pairs, each data pair comprises associated voltage and measured temperature, and the measured temperature is calculated by a voltage and voltage temperature relational expression;
s104, performing clustering calculation on the data packet to obtain a plurality of central data pairs, wherein the plurality of central data pairs form a central data pair group;
s106, fitting a voltage-temperature curve by the central data pair group;
and S108, generating a temperature compensation model according to the voltage temperature curve and the theoretical voltage temperature curve, wherein the temperature compensation model is used for compensating the measured temperature.
According to the temperature compensation method provided by the invention, through a large number of semi-physical simulation tests, digital signals (namely voltages) of the NTC temperature-sensitive resistor are collected, data are analyzed by a signal processing method, specifically a clustering method, and finally a temperature compensation model for temperature real-time monitoring is established to compensate the measured temperature, so that the detection precision of the temperature can be improved, and the printed circuit board can be protected more effectively. Specifically, the temperature measurement hardware of the printed circuit board is shown in fig. 7, and comprises an NTC resistor R1 and a constant resistor R2 connected in series to output voltage
![Figure BDA0001884091970000061](https://patentimages.storage.googleapis.com/c6/c2/15/9847960d82106d/BDA0001884091970000061.png)
The calibrated voltage signal is read from the I/O of the printed circuit board, and the temperature signal, i.e. the measured temperature, is derived through the above calculation formula and the change-preventing performance of the NTC resistor R1 (as shown in fig. 8). Wherein the calibration process refers to calibrating the voltage to a constant, for example, for a voltage of 0 to 5V, corresponding to 0 to 4096, and the digital voltage signal is obtainedAnd amplifying to a numerical value between 0 and 4096 according to a linear relation to obtain an intermediate standard quantity without units and with increased numerical value, so that the calculation is convenient. When signal processing is carried out, one data pair comprises associated voltage and measured temperature, the voltage and the measured temperature are taken as a data point and are drawn in a two-dimensional coordinate system, a series of discrete points can be drawn by a data packet, a plurality of central points (namely, central data pairs) in the discrete points are found in a clustering mode to form a group of central data pair groups, and a voltage and temperature curve can be fitted. Optionally, K-mean clustering is employed, formulated as
Wherein x isn、μkRespectively representing the data pair and the central data pair, calculating mukFirstly, the initial value is substituted into the right side of equal sign to obtain correspondent L, and the mu is modifiedkDifferent L can be obtained, and the minimum value of L can be obtained to obtain muk. Determining mukThen, the voltage and temperature curve is fitted and compared with the theoretical voltage and temperature curve, so as to compensate the error, and obtain the corresponding mathematical expression, for example, for the same voltage, the temperature corresponding to the voltage and temperature curve is smaller than the temperature corresponding to the theoretical voltage and temperature curve by a certain amount, then the measured temperature derived by pushing down the voltage is reduced by the certain amount as compensation, and the mathematical expression forms the temperature compensation model.
Further, if necessary, a mapping relationship between voltage and temperature can be established according to the obtained temperature compensation model, for example, a data table with 255 elements is formed, and when the temperature compensation model is used for temperature compensation, the data table is searched by using a table lookup method only when a new voltage signal comes in, so as to obtain the corresponding temperature.
Fig. 2 shows a schematic flow diagram of a temperature compensation method according to another embodiment of the invention. As shown in fig. 2, the method includes:
s202, acquiring a data packet, wherein the data packet comprises a plurality of data pairs, each data pair comprises associated voltage and measured temperature, and the measured temperature is calculated by a voltage and voltage temperature relational expression;
s204, dividing the data packet into at least two data sub-packets including a modeling data sub-packet and a verification data sub-packet;
s206, performing clustering calculation on the modeling data sub-packets to obtain a plurality of central data pairs, wherein the plurality of central data pairs form a central data pair group;
s208, fitting a voltage-temperature curve by the central data pair group;
s210, generating a temperature compensation model according to the voltage temperature curve and the theoretical voltage temperature curve, wherein the temperature compensation model is used for compensating the measured temperature;
s212, calculating the error of the temperature compensation model by using the verification data sub-packets;
and S214, selecting or rejecting the temperature compensation model based on the condition that the error meets the preset error condition.
In the embodiment, the data cross validation is adopted, the data packet is divided into at least two data sub-packets, at least one data sub-packet is used for modeling, the other at least one data sub-packet is used for validation, and the temperature compensation model is used only after the validation is passed, so that the accuracy of the temperature compensation model is improved. Further, when the verification is not passed, the modeling data sub-packet and the verification data sub-packet are exchanged, that is, the modeling is performed by using the verification data sub-packet, and then the verification is performed by using the modeling data sub-packet, so that it can be understood that the naming of the modeling data sub-packet and the verification data sub-packet is only used for distinguishing the functional distinction of different data sub-packets in a single calculation, and the specific data sub-packet is not limited. Further, if the verification is still failed, the data sub-packet may be re-divided to repeat these steps until a verified temperature compensation model is obtained.
Fig. 3 shows a schematic flow diagram of a temperature compensation method according to a further embodiment of the invention. As shown in fig. 3, the method includes:
s302, acquiring a data packet, wherein the data packet comprises a plurality of data pairs, each data pair comprises associated voltage and measured temperature, and the measured temperature is calculated by a voltage and voltage temperature relational expression;
s304, dividing the data packet into at least three data sub-packets, including at least two modeling data sub-packets and at least one verification data sub-packet;
s306, performing cluster calculation on at least two modeling data sub-packets respectively to obtain at least two central data pair groups, wherein each central data pair group comprises a plurality of central data pairs;
s308, fitting at least two corresponding voltage temperature curves by at least two central data pairs;
s310, generating at least two corresponding temperature compensation models according to the at least two voltage temperature curves and the theoretical voltage temperature curve;
s312, calculating errors of the at least two temperature compensation models by utilizing at least one verification data sub-packet;
s314, selecting the temperature compensation model with the minimum error for compensating the measured temperature.
In this embodiment, the number of the data sub-packets is specifically limited to at least three, wherein the data sub-packets include at least two modeling data sub-packets and at least one verification data sub-packet, so that at least two corresponding temperature compensation models can be calculated, and one of the models is selected for subsequent real-time compensation of the measured temperature. Optionally, the preset error condition is that the error in this embodiment is the minimum, that is, the temperature compensation model with the minimum error is found as the final model. Of course, other preset error conditions may also be adopted, for example, a corresponding temperature compensation model with the smallest error smaller than a preset value is selected, or a voltage temperature curve with the smallest error and the whole or most of temperature values higher than the theoretical voltage temperature curve is selected to ensure that the temperature of the printed circuit board is not too high, so that the measured temperature is increased when the measured temperature is compensated, and the timeliness of cooling is ensured. The above schemes are all the design concepts of the present invention, and therefore all the schemes are within the protection scope of the present invention.
In one embodiment of the present invention, preferably, the number of the at least two data sub-packets is derived from a relative precision, which is related to the NTC resistance and the fixed-value resistance, a confidence level constant and a weight coefficient.
In this embodiment, a parameter affecting the number M of data sub-packets is specifically defined. The relative precision is determined by the precision of the NTC resistor and the fixed value resistor, reasonable test data size (namely the number of data pairs) can be obtained by combining a confidence level constant, and on the basis, the number M of the data sub-packets can be obtained by combining a weight coefficient, so that the data sub-packets can be reasonably divided, and the reliability of the generated temperature compensation model is improved. Specifically, the test data size n satisfies:
wherein r ispIs the relative accuracy, THcIs a confidence level constant, a statistical parameter, associated with a confidence level. The number M of the data sub-packets satisfies:
wherein alpha is a weight coefficient and belongs to an empirical value. In other words, the number of data sub-packets M during cross-validation depends on a combination of the test data size, confidence level, and Thompson formula.
Fig. 4 shows a schematic flow diagram of a temperature compensation method according to a further embodiment of the invention. As shown in fig. 4, the method includes:
s402, acquiring a data packet, wherein the data packet comprises a plurality of data pairs, each data pair comprises associated voltage, measured temperature and reference temperature, the measured temperature is calculated by a voltage and voltage temperature relational expression, and the reference temperature is measured by a thermocouple;
s404, deleting a data pair corresponding to the measured temperature based on the condition that the absolute value of the difference between the reference temperature and the measured temperature is greater than a preset value;
s406, performing clustering calculation on the data packet to obtain a plurality of central data pairs, wherein the plurality of central data pairs form a central data pair group;
s408, fitting a voltage-temperature curve by the central data pair group;
and S410, generating a temperature compensation model according to the voltage temperature curve and the theoretical voltage temperature curve, wherein the temperature compensation model is used for compensating the measured temperature.
In this embodiment, the data pair further includes data of an analog temperature signal read by the thermocouple, that is, a reference temperature, and since the reading of the thermocouple is relatively accurate, the data pair is used as a reference, the measured temperature derived from the voltage is compared with the reference temperature, and the data pair with an excessively large difference from the reference temperature is filtered out, which is helpful for improving the accuracy of the temperature compensation model, and further improving the detection precision of the temperature, so that the printed circuit board is protected more effectively.
In one embodiment of the present invention, preferably, the method further includes: based on the condition that the update condition is satisfied, the temperature compensation model is updated.
In this embodiment, as the temperature detection is performed, the number of the collected data pairs is gradually increased, so that the reference data is increased, and the temperature compensation model can be calculated again at an appropriate time to continuously improve and maintain the detection accuracy, so that the printed circuit board is more effectively protected. Alternatively, the update may be performed periodically or when the number of data pairs reaches a preset number.
In summary, as shown in fig. 5, in the temperature compensation method provided by the present invention, a large number of semi-physical simulation tests are performed to collect data of a digital signal (i.e., voltage) fed back by the NTC temperature-sensitive resistor and an analog signal (i.e., reference temperature) read by the thermocouple, the data is analyzed by using a signal processing method, a mapping relationship between the digital signal and the analog signal is established, and finally a temperature compensation model for real-time temperature monitoring is established to compensate the measured temperature, so that the detection accuracy of the temperature can be improved, and the printed circuit board can be protected more effectively.
As shown in fig. 6, an embodiment of the second aspect of the present invention provides a computer apparatus 10, including: a memory 102 configured to store executable instructions; the processor 104 is configured to execute the executable instructions to implement the steps of the method according to any of the above embodiments, so as to achieve all the technical effects of the temperature compensation method, which will not be described herein again. It should be noted that the main subject of the present embodiment is the computer device 10, in other words, the temperature compensation model is obtained by offline calculation of the computer device 10, and then the calculated temperature compensation model is downloaded to the chip of the printed circuit board, and when the temperature compensation model needs to be updated, the temperature compensation model is also recalculated by the computer device 10 and then downloaded to the chip of the printed circuit board.
In particular, the memory 102 may include mass storage for data or instructions. By way of example, and not limitation, memory 102 may include a Hard Disk Drive (HDD), a floppy Disk Drive, flash memory, an optical Disk, a magneto-optical Disk, tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 102 may include removable or non-removable (or fixed) media, where appropriate. The memory 102 may be internal or external to the integrated gateway disaster recovery device, where appropriate. In a particular embodiment, the memory 102 is a non-volatile solid-state memory. In particular embodiments, memory 102 includes Read Only Memory (ROM). Where appropriate, the ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), electrically rewritable ROM (EAROM), or flash memory or a combination of two or more of these.
The processor 104 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured as one or more Integrated circuits implementing embodiments of the present invention.
An embodiment of the third aspect of the present invention provides a computer-readable storage medium, on which executable instructions are stored, and when the executable instructions are executed by a processor, the steps of the method according to any of the above embodiments are implemented, so that the method has all technical effects of the temperature compensation method, and details are not repeated herein.
Computer readable storage media may include any medium that can store or transfer information. Examples of computer readable storage media include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, Radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
An embodiment of a fourth aspect of the present invention provides a printed circuit board including: a memory configured to store executable instructions; the processor is configured to execute the executable instructions to implement the steps of the method according to any of the above embodiments, so as to achieve all the technical effects of the temperature compensation method, which will not be described herein again. It should be noted that the main body of the present embodiment is the printed circuit board, in other words, the temperature compensation model is calculated on line by the printed circuit board directly using the detected data, and when the temperature compensation model needs to be updated, the printed circuit board is also updated on line by using the newly detected data.
As shown in fig. 7, in one embodiment of the present invention, the printed circuit board preferably further includes an NTC resistor R1 and a fixed resistor R2 connected in series, and the voltage in the temperature compensation method is a voltage across the fixed resistor.
In this embodiment, the temperature measurement hardware of the printed circuit board is specifically described. As shown in FIG. 7, an NTC resistor R1 and a constant resistor R2 (the accuracy is determined according to actual requirements) are connected in series to a 5V VCC power supply to form an NTC signal acquisition circuit, and modeling is performed according to the circuit diagram to obtain an output voltage
The NTC resistor R1 is a temperature-sensitive resistor, and its resistance changes with temperature (as shown in fig. 8, given by a data table), so that the change of the resistance of the NTC resistor R1 is reflected by the voltage Uo, the change of the resistance of the NTC resistor R1 reflects the change of temperature, a voltage signal is collected, and the chip calibrates the collected signal as the input of the signal. Specifically, the fixed resistance R2 is 10K Ω.
And then, carrying out theoretical temperature drift analysis on the circuit, carrying out dynamic simulation by adopting a Monte Carlo simulation method based on the fact that the deviation of the influence of the temperature on the resistance value of the NTC resistor R1 is in normal distribution, and determining the influence of the resistance value change of the NTC resistor R1 on the output voltage UOAnd ringing, thereby quantifying the temperature drift effect. Suppose that the NTC resistor R1 and the constant resistor R2 have deviations, and the deviations are normally distributed in N (0, sigma) to (0)2) The value of σ is related to the accuracy of the resistance, here 3%, and the temperature interval is 5 ℃ as given in the data sheet. Monte Carlo simulation is adopted for analysis to obtain a graph 9, wherein a continuous curve is an interference-free theoretical curve, namely Uo corresponding to different temperatures under the interference-free theoretical condition, and a discrete vertical line with a certain height is a simulation curve of normal distribution noise, namely the value range of the Uo corresponding to different temperatures under the influence of the normal distribution noise. As can be seen from fig. 9, as the temperature increases, the error of the Uo is gradually enlarged, for example, 80 ℃ corresponds to a plurality of hash points, and values of the Uo corresponding to the temperature intervals of 5 ℃ above and below overlap, so that the accuracy of temperature measurement is reduced. In addition, a clustering mode, such as K-mean clustering based on normal distribution, may be adopted only for the temperature in fig. 9 where the values of Uo overlap at the temperature interval to generate a temperature compensation model and perform temperature compensation, which is helpful to reduce the amount of computation.
In summary, the printed circuit board involves the NTC signal acquisition circuit, the establishment of a temperature compensation model (numerical calculation), the input and output of a temperature signal stream, and software and hardware for detecting the temperature in real time when performing temperature compensation.
An embodiment of the fifth aspect of the present invention provides a compressor, which includes the computer device 10 according to the foregoing embodiment, or the computer readable storage medium according to the foregoing embodiment, or the printed circuit board according to any of the foregoing embodiments, so as to have all technical effects of the computer device 10, the computer readable storage medium, or the printed circuit board, which are not described herein again.
An embodiment of a sixth aspect of the present invention provides a vehicle, including the computer device 10 according to the above-mentioned embodiment, or the computer-readable storage medium according to the above-mentioned embodiment, or the printed circuit board according to any of the above-mentioned embodiments, or the compressor according to the above-mentioned embodiments, so as to have all the technical effects of the computer device 10, or the computer-readable storage medium, or the printed circuit board, or the compressor, which are not described herein again.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.