CN117709206A - Thermistor RT model fitting method and device, electronic equipment and storage medium - Google Patents

Thermistor RT model fitting method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117709206A
CN117709206A CN202410160572.XA CN202410160572A CN117709206A CN 117709206 A CN117709206 A CN 117709206A CN 202410160572 A CN202410160572 A CN 202410160572A CN 117709206 A CN117709206 A CN 117709206A
Authority
CN
China
Prior art keywords
thermistor
model
target
fitting
prediction error
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410160572.XA
Other languages
Chinese (zh)
Other versions
CN117709206B (en
Inventor
戴兵
吴梓峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Senweier Technology Development Co ltd
Original Assignee
Shenzhen Senweier Technology Development Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Senweier Technology Development Co ltd filed Critical Shenzhen Senweier Technology Development Co ltd
Priority to CN202410160572.XA priority Critical patent/CN117709206B/en
Publication of CN117709206A publication Critical patent/CN117709206A/en
Application granted granted Critical
Publication of CN117709206B publication Critical patent/CN117709206B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Thermistors And Varistors (AREA)

Abstract

The application relates to the technical field of Internet and provides a thermistor RT model fitting method, a thermistor RT model fitting device, electronic equipment and a storage medium. According to the method, a thermistor temperature data set comprising a plurality of resistor temperature data pairs is divided into a training set and a verification set according to interval coefficient values, then circulation traversing is started from a first polynomial order in a polynomial order set to a last polynomial order, fitting is conducted on a target polynomial order traversed each time on the basis of the training set, a thermistor RT model of the target polynomial order is obtained, verification is conducted on each thermistor RT model on the basis of the verification set, an average prediction error value set is obtained, and therefore the target thermistor RT model is obtained from a plurality of thermistor RT models according to the average prediction error value set. The method and the device can improve the fitting accuracy of the thermistor RT model.

Description

Thermistor RT model fitting method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of internet, in particular to a thermistor RT model fitting method, a thermistor RT model fitting device, electronic equipment and a storage medium.
Background
A thermistor is a sensor resistor whose resistance value changes with a change in temperature. Positive temperature coefficient thermistors (Positive Temperature Coefficient thermistor, PTC thermistors) and negative temperature coefficient thermistors (Negative Temperature Coefficient thermistor, NTC thermistors) are classified according to temperature coefficients. The resistance value of the positive temperature coefficient thermistor increases with an increase in temperature, and the resistance value of the negative temperature coefficient thermistor decreases with an increase in temperature.
In the prior art, resistance-temperature (i.e., RT) data of a group of thermistors are substituted into a fitting polynomial, fitting coefficients of the polynomial are obtained, a thermistor RT model is obtained, and the technical problem of inaccurate prediction caused by large fitting errors exists in the model.
Disclosure of Invention
In view of this, the application provides a thermistor RT model fitting method, device, electronic equipment and storage medium, which are used for solving the technical problem of inaccurate prediction caused by large fitting error.
A first aspect of the present application provides a thermistor RT model fitting method, the method comprising:
dividing a thermistor temperature data set into a training set and a verification set according to the interval coefficient value, wherein the thermistor temperature data set comprises a plurality of resistor temperature data pairs;
Acquiring a polynomial order set, and starting circulation from the first polynomial order in the polynomial order set to traverse until the last polynomial order;
fitting the target polynomial order obtained by each traversal based on the training set to obtain a thermistor RT model of the target polynomial order;
verifying each thermistor RT model based on the verification set to obtain an average prediction error value set;
and acquiring a target thermistor RT model from a plurality of thermistor RT models according to the average prediction error value set.
In an alternative embodiment, the partitioning of the thermistor temperature data set into a training set and a validation set according to the interval coefficient value includes:
acquiring a first data volume of the thermistor temperature data set;
calculating a second data volume of the verification set according to the interval coefficient value and the first data volume;
sequentially acquiring resistance temperature data pairs of the second data amount from the thermistor temperature data set according to the interval coefficient value, and determining the acquired resistance temperature data pairs of the second data amount as the verification set;
and determining resistance temperature data pairs in the thermistor temperature data sets except the verification set as the training set.
In an alternative embodiment, the calculating the second data amount of the verification set according to the interval coefficient value and the first data amount includes:
calculating a quotient of the interval coefficient value and the first data volume;
judging whether the quotient is an integer or not;
when the quotient is an integer, taking the quotient as a second data amount of the verification set;
and when the quotient is not an integer, rounding down the quotient to obtain an integer value, and taking the integer as a second data quantity of the verification set.
In an alternative embodiment, said validating each of said thermistor RT models based on said validation set, obtaining a set of average prediction error values comprises:
inputting each thermistor in the verification set into the thermistor RT model for calculation aiming at each thermistor RT model to obtain a corresponding predicted temperature;
calculating to obtain a prediction error value set based on the temperature in the verification set and the corresponding prediction temperature;
calculating an average prediction error value based on the prediction error value set;
and obtaining the average prediction error value set based on the average prediction error value corresponding to each thermistor RT model.
In an alternative embodiment, said obtaining a target thermistor RT model from a plurality of said thermistor RT models based on said set of average prediction error values comprises:
acquiring the smallest average prediction error value in the average prediction error value set;
and acquiring a thermistor RT model corresponding to the minimum average prediction error value from a plurality of thermistor RT models, and taking the thermistor RT model as the target thermistor RT model.
In an alternative embodiment, the fitting based on the training set to obtain the thermistor RT model of the target polynomial order includes:
obtaining a target least square function corresponding to the target polynomial order;
and performing least square function fitting based on the training set by using the target least square function to obtain the thermistor RT model with the target polynomial order.
In an alternative embodiment, the method further comprises:
responding to an input instruction of a target resistor, and inputting the target resistor into the target thermistor RT model to obtain a temperature corresponding to the target resistor; and/or
And responding to an input instruction of a target temperature, inputting the target temperature into the target thermistor RT model, and obtaining a resistor corresponding to the target temperature.
A second aspect of the present application provides a thermistor RT model fitting device, the device comprising:
the division module is used for dividing the thermistor temperature data set into a training set and a verification set according to the interval coefficient value, and the thermistor temperature data set comprises a plurality of resistor temperature data pairs.
And the traversing module is used for acquiring a polynomial order set, and starting to circularly traverse from the first polynomial order to the last polynomial order in the polynomial order set.
And the fitting module is used for fitting one target polynomial order traversed each time based on the training set to obtain a thermistor RT model of the target polynomial order.
And the verification module is used for verifying each thermistor RT model based on the verification set to obtain an average prediction error value set.
And the determining module is used for acquiring a target thermistor RT model from a plurality of thermistor RT models according to the average prediction error value set.
A third aspect of the present application provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the thermistor RT model fitting method when executing the computer program.
A fourth aspect of the present application provides a computer readable storage medium having stored thereon a computer program which when executed performs the steps of the thermistor RT model fitting method.
According to the method, a thermistor temperature data set comprising a plurality of resistor temperature data pairs is divided into a training set and a verification set according to interval coefficient values, then circulation traversing is started from a first polynomial order in a polynomial order set to a last polynomial order, fitting is conducted on a target polynomial order traversed each time on the basis of the training set, a thermistor RT model of the target polynomial order is obtained, verification is conducted on each thermistor RT model on the basis of the verification set, an average prediction error value set is obtained, and therefore the target thermistor RT model is obtained from a plurality of thermistor RT models according to the average prediction error value set. The method and the device can improve the fitting accuracy of the thermistor RT model.
Drawings
FIG. 1 is a flow chart of a prior art thermistor RT model fitting method;
FIG. 2 is a flow chart of a method for fitting a thermistor RT model according to an embodiment of the present application;
FIG. 3 is a schematic diagram of 2-level fitting data provided in an embodiment of the present application;
FIG. 4 is a schematic diagram of 3-level fitting data provided in an embodiment of the present application;
FIG. 5 is a schematic diagram of 4-level fitting data provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of 5-level fitting data provided by an embodiment of the present application;
FIG. 7 is a schematic diagram of 6-level fitting data provided in an embodiment of the present application;
FIG. 8 is a schematic representation of 7-level fitting data provided in an embodiment of the present application;
FIG. 9 is a functional block diagram of a thermistor RT model fitting apparatus according to an embodiment of the present application;
fig. 10 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The terminology used in the following embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of this application, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates to the contrary. It should also be understood that the term "and/or" as used in this application is intended to encompass any or all possible combinations of one or more of the listed items.
The terms "first," "second," and the like, are used below for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature, and in the description of embodiments of the present application, unless otherwise indicated, the meaning of "a plurality" is two or more.
Referring to fig. 1, a flowchart of a thermistor RT model fitting method provided in the prior art is shown.
In the prior art, the fitting coefficients of the polynomials are obtained by substituting the resistance-temperature (i.e., RT) data of a set of thermistors into the fitting polynomials.
The method has certain defects, the highest order item of the unknown polynomial is more in fitting times, the polynomial curve is over-fitted, the data is separated from reality, and the final data is separated from sample data due to less fitting times. Moreover, the excessive fitting times can cause excessive operand, all sample data are taken out to fit the curve, the obtained polynomial cannot be verified, the predicted value of the curve on the sample data performs well, but the curve does not perform well when being far away from the sample data.
In order to solve the technical problems in the prior art, embodiments of the present application provide a method, an apparatus, an electronic device, and a storage medium for fitting a thermistor RT model.
Fig. 2 is a flowchart of a thermistor RT model fitting method provided in an embodiment of the present application, where the thermistor RT model fitting method is performed by an electronic device, and the thermistor RT model fitting method specifically includes the following steps.
S21, dividing the thermistor temperature data set into a training set and a verification set according to the interval coefficient value, wherein the thermistor temperature data set comprises a plurality of resistor temperature data pairs.
In order to obtain the optimal thermistor RT model by fitting, thermistor temperature data sets are collected in advance, fitting with different orders is performed based on the thermistor temperature data sets, a plurality of thermistor RT models are obtained, and the optimal thermistor RT model is determined from the plurality of thermistor RT models.
The thermistor temperature data set is a data set composed of a plurality of resistor temperature data pairs, and elements in the thermistor temperature data set can be data pairs composed of resistor values in specific actual observation and temperature values corresponding to the resistor values. The pair of resistance temperature data is expressed as (resistance, temperature).
The interval coefficient value is used to divide the thermistor temperature data set into a training set and a validation set. The interval coefficient value is generally set or modified according to the data amount of the thermistor temperature data set, and may be set larger if the data amount of the thermistor temperature data set is larger, and smaller if the data amount of the thermistor temperature data set is smaller. Preferably, the interval coefficient value is set to 5.
In an alternative embodiment, the partitioning of the thermistor temperature data set into a training set and a validation set according to the interval coefficient value includes:
acquiring a first data volume of the thermistor temperature data set;
calculating a second data volume of the verification set according to the interval coefficient value and the first data volume;
sequentially acquiring resistance temperature data pairs of the second data amount from the thermistor temperature data set according to the interval coefficient value, and determining the acquired resistance temperature data pairs of the second data amount as the verification set;
and determining resistance temperature data pairs in the thermistor temperature data sets except the verification set as the training set.
The first data amount is the data size of the thermistor temperature data set, i.e. the number of pairs of resistance temperature data included in the thermistor temperature data set. Illustratively, it is assumed that the thermistor temperature dataset includes the following pairs of resistance temperature data: (5470, -10), (5184, -9), (4915, -8), then the first data volume of the thermistor temperature data set is 3.
And determining the number of the resistance temperature data pairs divided into the verification set according to the interval coefficient value and the first data quantity, and determining the number of the resistance temperature data pairs divided into the verification set as a second data quantity. And firstly acquiring resistance temperature data pairs corresponding to element marks and interval coefficient values from a thermistor temperature data set, then acquiring one resistance temperature data pair at intervals by taking the firstly acquired resistance temperature data pair as a starting point, determining the acquired resistance temperature data pair as a verification set until the number of the acquired resistance temperature data pairs is a second data amount, removing the resistance temperature data pair in the verification set from the thermistor temperature data set, and determining the rest resistance temperature data pair as the training set. The training set is a data set for fitting to obtain the thermistor RT model, and the aim of the training set is to enable the thermistor RT model to have enough generalization capability and to reasonably predict new and unseen data. The validation set is a data set for evaluating the generalization performance of the thermistor RT model and performing hyper-parameter adjustment, and the performance of the thermistor RT model on unseen data is validated by using the validation set, thereby avoiding overfitting.
In the above-mentioned alternative embodiment, the second data amount of the verification set is calculated by the first data amount of the thermistor temperature data set and the preset interval coefficient value, and the resistance temperature data pair of the second data amount is sequentially obtained from the thermistor temperature data set according to the interval coefficient value, so as to obtain the verification set, ensure the stability and the variability of the training set, facilitate the follow-up thermistor RT model obtained based on fitting of the training set to have better opportunity to learn the stability characteristics about the data in the training set, and improve the generalization capability of the thermistor RT model; further, by calculating the second data amount of the validation set based on the first data amount and the interval coefficient value, the size of the validation set can be determined adaptively to a degree such that sufficient data is contained in the validation set to effectively evaluate the performance of the thermistor RT model.
In an alternative embodiment, the calculating the second data amount of the verification set according to the interval coefficient value and the first data amount includes:
calculating a quotient of the interval coefficient value and the first data volume;
Judging whether the quotient is an integer or not;
when the quotient is an integer, taking the quotient as a second data amount of the verification set;
and when the quotient is not an integer, rounding down the quotient to obtain an integer value, and taking the integer as a second data quantity of the verification set.
Dividing the first data volume by the interval coefficient value to obtain a quotient, determining the obtained quotient as the second data volume of the verification set if the quotient is an integer, rounding down the obtained quotient if the quotient is not an integer, and determining the integer value obtained after rounding down as the second data volume of the verification set. The second data amount refers to the number of resistance temperature data pairs contained in the verification set. The round down is an operation of converting a real number to a maximum integer not exceeding it, which can be handled by a round down function, which ensures that the data divided into the validation set does not exceed the range of the thermistor temperature data set.
The first data amount of the thermistor temperature data set is L, the interval coefficient value is K, and the second data amount of the verification set is L1=L/K, wherein L/K is rounded. If l=20 and k=3, then l1=6 after rounding down since 20/3 is not an integer. That is, the verification set V is 6 in size, with 6 elements inside. It is assumed that the 3,6,9, 12, 15, 18 th elements are sequentially acquired from the thermistor temperature dataset according to the interval coefficient value as the verification set V. Other data is divided into training set Tr, which is L-L1 in size.
Illustratively, assuming a spacing coefficient value of 2, the thermistor temperature data set includes: (5470, -10), (5184, -9), (4915, -8), (4661, -7), (3241,0), (3079,1), (2926,2) the first data amount is 7 and the second data amount is 3, the validation set is (5184, -9), (4661, -7), (3079,1), the training set is (5470, -10), (4915, -8), (3241,0), (2926,2).
S22, acquiring a polynomial order set, and starting to circularly traverse from the first polynomial order to the last polynomial order in the polynomial order set.
Polynomial order refers to the degree of the highest power in the polynomial. The polynomial order set consists of the highest degree of the polynomials, defining the highest degree of the training model. The degree of the highest power of the polynomial order is controlled in a reasonable range, too small degree can cause that the sample data are too many to fit, too large degree can cause that the fitting is too large, the data are separated from reality, and the operand is too large.
The loop traverses from the first polynomial degree in the polynomial set to the last polynomial degree. And determining polynomial order values when the model is fitted each time according to element values in the polynomial order set in each cycle traversal, and performing model fitting when the corresponding order is carried out according to the order values.
For example, assume that the set of preset polynomial orders is {2,3,4,5,6,7}, where 2 represents the polynomial order 2 and 5 represents the polynomial order 5, the first polynomial order 2 in the set of polynomial orders is traversed and obtained first, then the second polynomial order 3 is traversed and obtained in turn, the third polynomial order 4 is obtained, the fourth polynomial order 5 is obtained, the fifth polynomial order 6 is obtained, and stopping when traversing to the last polynomial order 7.
S23, fitting is conducted on the basis of the training set aiming at one target polynomial order traversed each time, and a thermistor RT model of the target polynomial order is obtained.
The electronic device may store a plurality of polynomials in advance, where each polynomial corresponds to a polynomial order, and polynomials corresponding to different polynomials have different orders. The target polynomial degree is the element value currently traversed when traversing the polynomial degree set.
And obtaining a polynomial corresponding to the target polynomial order after traversing each time, and fitting the polynomial by using the training set, so that the target polynomial obtained by fitting can capture the variation trend of resistance and temperature as much as possible, thereby better reflecting the relation between the resistance and the temperature, and taking the target polynomial obtained by fitting as a thermistor RT model.
For example, assuming that the polynomial order set is traversed for the first time, and the first polynomial order 2 is obtained from the polynomial order set, a 2-order polynomial is obtained, and the 2-order polynomial is fitted based on the training set to obtain a target 2-order polynomial, wherein the target 2-order polynomial corresponds to a thermistor RT model; traversing the polynomial order set for the second time, obtaining a second polynomial order 3 from the polynomial order set, obtaining a 3-order polynomial, fitting the 3-order polynomial based on the training set to obtain a target 3-order polynomial, wherein the target 3-order polynomial corresponds to a thermistor RT model; traversing the polynomial order set for the third time, obtaining a third polynomial order 4 from the polynomial order set, obtaining a 4-order polynomial, fitting the 4-order polynomial based on the training set to obtain a target 4-order polynomial, wherein the target 4-order polynomial corresponds to a thermistor RT model; and by the method, until the last polynomial in the polynomial order set is traversed to 7, obtaining 7-order polynomials, and fitting the 7-order polynomials based on the training set to obtain a target 7-order polynomial, wherein the target 7-order polynomial corresponds to a thermistor RT model.
In an alternative embodiment, the fitting based on the training set to obtain the thermistor RT model of the target polynomial order includes:
obtaining a target least square function corresponding to the target polynomial order;
and performing least square function fitting based on the training set by using the target least square function to obtain the thermistor RT model with the target polynomial order.
The least squares method is a mathematical optimization technique that finds the best functional match of the data by minimizing the sum of squares of the errors. And obtaining a least square function corresponding to a certain order according to a common least square solver, and determining the least square function as a target least square function. A common least squares solver such as the lsqcurvefit function.
And fitting the resistance temperature data in the training set with the least square function, and determining coefficients of variables of the target least square function of the target polynomial order to obtain the thermistor RT model of the target polynomial order. Each order determines a thermistor RT model of the target order.
In the above optional implementation manner, the model with a good fitting effect on the training set under the given polynomial order can be obtained by using the least square method for fitting, so that the accuracy of the model is improved, and the model can be better adapted to the change in the real world; by learning the target least squares function from the training set, the model may have a certain adaptability and generalization capability, can cope with unseen data, and performs well in practical applications.
And S24, verifying each thermistor RT model based on the verification set to obtain an average prediction error value set.
And verifying the thermistor RT model corresponding to any polynomial order based on the verification set to obtain a predicted value of the verification set, calculating an error between the predicted value and the actual value of the verification set to obtain a predicted error value set, and averaging the predicted error value set to obtain an average predicted error value. And the thermistor RT model corresponding to each polynomial order corresponds to one average prediction error value, and all the average prediction error values are combined to obtain an average prediction error value set. That is, the average prediction error value set is composed of average prediction error values corresponding to all orders.
In an alternative embodiment, said validating each of said thermistor RT models based on said validation set, obtaining a set of average prediction error values comprises:
inputting each thermistor in the verification set into the thermistor RT model for calculation aiming at each thermistor RT model to obtain a corresponding predicted temperature;
calculating to obtain a prediction error value set based on the temperature in the verification set and the corresponding prediction temperature;
Calculating an average prediction error value based on the prediction error value set;
and obtaining the average prediction error value set based on the average prediction error value corresponding to each thermistor RT model.
If the difference between the predicted temperature fitted by the thermistor RT model and the corresponding actual temperature is smaller, the more accurate fitting of the thermistor RT model is indicated, and the stronger the performance of the thermistor RT model is; if the difference between the predicted temperature fitted by the thermistor RT model and the corresponding actual temperature is larger, the more inaccurate the thermistor RT model is fitted, the worse the performance of the thermistor RT model is.
And traversing all resistance temperature data pairs in the verification set for a certain thermistor RT model, inputting the resistance in each resistance temperature data pair into the thermistor RT model, predicting the thermistor RT model based on the input resistance, and outputting the predicted temperature. And calculating an error value between the temperature in the resistance temperature data pair and the corresponding predicted temperature to obtain a corresponding predicted error value of the resistance temperature data pair. And calculating the average value of all the prediction error values to obtain an average prediction error value.
Illustratively, the hypothetical validation set includes 11 pairs of resistance temperature data: (5470-10), (5184-9), (4915-8), (4661-7), (3241,0), (3079,1), (2926,2), (2782,3), (797, 30), (764, 31), (731, 32),
inputting the resistors in the 11 resistor temperature data pairs into a thermistor RT model corresponding to the order 2, wherein the obtained predicted temperatures are respectively-16, -12, -10, -9.8, -2.3, 1, 1.5, 2.1, 28, 29 and 30, the set of predicted error values is {6,3,2,2.8,2.3,0,0.5,0.9,8,2,2}, and the corresponding average predicted error value is 2.68; inputting the resistors in the 11 resistor temperature data pairs into a thermistor RT model corresponding to an order 3, wherein the obtained predicted temperatures are respectively-12, -11.3, -9.8, -4.3, 0.8, 1.3, 2.4, 3.6, 30.8, 31.4 and 32.3, the set of predicted error values is {2,2.3,1.8,2.7,0.8,0.3,0.4,0.6,0.8,0.4,0.3}, and the corresponding average predicted error value is 1.12; inputting the resistors in the 11 resistor temperature data pairs into a thermistor RT model corresponding to the order 4, wherein the obtained prediction temperatures are respectively-10.1, -9.2, -7.8, -6.9, 0.1, 1.1, 2.3, 3.1, 30.1, 31 and 31.9, the prediction error value set is {0.1,0.2,0.2,0.1,0.1,0.1,0.3,0.1,0.1,0,0.1}, and the corresponding average prediction error value is 0.12; the average prediction error value set is {2.68,1.12,0.12} according to all the average prediction error values.
The polynomial order, the corresponding average prediction error value and the thermistor RT model are recorded into a mapping table, so that the target thermistor RT model can be conveniently and rapidly obtained according to the average prediction error value.
S25, acquiring a target thermistor RT model from a plurality of thermistor RT models according to the average prediction error value set.
After the average prediction error value set is obtained, which one of the plurality of thermistor RT models is optimal may be determined according to the average prediction error value set, and the determined optimal thermistor RT model is used as the target thermistor RT model.
In an alternative embodiment, said obtaining a target thermistor RT model from a plurality of said thermistor RT models based on said set of average prediction error values comprises:
acquiring the smallest average prediction error value in the average prediction error value set;
and acquiring a thermistor RT model corresponding to the minimum average prediction error value from a plurality of thermistor RT models, and taking the thermistor RT model as the target thermistor RT model.
The target thermistor RT model is a resistance temperature model corresponding to the element with the smallest average prediction error value set, namely the resistance temperature model corresponding to the element with the smallest average prediction error value set.
The average prediction error values in the set of average prediction error values may be ordered in ascending or descending order. If the elements in the set of average prediction error values are sorted in ascending order, the first average prediction error value in the set is the smallest average prediction error value. If the elements in the set of average prediction error values are ordered in descending order, the last average prediction error value in the set is the smallest average prediction error value. The average prediction error values in the average prediction error set may be ranked using a ranking algorithm, which may include, but is not limited to: bubbling ordering, selection ordering, insertion ordering, quick ordering, merging ordering, etc.
In an alternative embodiment, the obtaining the target thermistor RT model from the plurality of thermistor RT models according to the average prediction error value set may further include: according to the difference between the average prediction error value corresponding to the previous polynomial order and the average prediction error value corresponding to the next polynomial order, when the difference between the average prediction error value corresponding to the previous polynomial order and the average prediction error value corresponding to the next polynomial order is smaller than a preset difference threshold, the average prediction error values corresponding to the thermistor RT model fitted in the front and the back twice are indicated to be very similar, and then the calculated amount is only increased by the fitting and the condition of overfitting is caused. Therefore, the thermistor RT model corresponding to the previous polynomial order may be selected as the target thermistor RT model. The thermistor RT model corresponding to the order of the last polynomial can also be selected as the target thermistor RT model.
The method described in the embodiments of the present application is illustrated below, assuming a thermistor temperature dataset a:61; interval coefficient value K:8, 8; polynomial order set {2,3,4,5,6,7}, maximum polynomial order M:7, the fitting process of the thermistor RT model is as follows. In the following table, "predicted value" means a predicted temperature, and "average error" means an average predicted error value.
As shown in fig. 3, the first polynomial degree 2 is obtained from the polynomial degree set for fitting. The corresponding least squares function cfun (x) =p1×x2+p2×x+p3, p1= 0.03068, p2= -2.721, p3=52.62.
As shown in fig. 4, the second polynomial order 3 is obtained from the polynomial order set for fitting. The corresponding least squares function cfun (x) =p1 x 3 + p2 x 2 + p3 x + p4, p1= -0.001017, p2= 0.1133, p3= -4.498, p4=61.22.
As shown in fig. 5, the fitting data is obtained by obtaining the third polynomial degree 4 from the polynomial degree set. The corresponding least squares function cfun (x) =p1×xρ4+p2×xρ3+p3×xρ2+p4×x+p5, p1= 3.623e-05, p2= -0.005048, p3= 0.2586, p4= -6.379, p5=67.94.
As shown in fig. 6, the fourth polynomial degree 5 is obtained from the polynomial degree set for fitting. The corresponding least squares function cfun (x) =p1×χ ζ5+p2×χ ζ4+p3×χ ζ3+p4×χ ζ2+p5×x+p6, p1= -1.416e-06, p2= 0.0002367, p3= -0.01525, p4= 0.4834, p5= -8.421, p6= 73.71.
As shown in fig. 7, the data of the fifth polynomial degree 6 is obtained from the polynomial degree set for fitting. The corresponding least squares function cfun (x) =p1×xζ6+p2×xζ5+p3×x4xχ+p5×χ+p2+p6×p7, p1= 5.543e-08, p2= -1.086e-05, p3= 0.0008524, p4= -0.03448, p5= 0.7787, p6= -10.46, p7=78.47.
As shown in fig. 8, the data of the sixth polynomial degree 7 is obtained from the polynomial degree set for fitting. The corresponding least squares function cfun (x) =p1×7+p2×6+p3×5+p4×4+p5×3+p6×2+p7×8, p1= -2.287e-09, p2= 5.142e-07, p3= -4.766e-05, p4= 0.00236, p5= -0.06794, p6=1.171, p7= -12.65, p8= 82.87.
From this, it can be seen that the average error corresponding to the 6 th order (0.1435) is similar to the average error corresponding to the 7 th order (0.1488), and the fitting is only performed in a way that the calculated amount is increased and the fitting is performed. Finally, a polynomial function cfun (x) =p1×xζ6+p2×xζ5+p3×xζ4+p4×χ ζ3+5xζ2+p6×x+p7 is selected from 6-level fitting. The conditions of over-fitting and under-fitting can be avoided, the fit model can be guaranteed to be related to the real condition through the verification set, and the calculated amount is in a controllable range.
In an alternative embodiment, the method further comprises:
responding to an input instruction of a target resistor, and inputting the target resistor into the target thermistor RT model to obtain a temperature corresponding to the target resistor; and/or
And responding to an input instruction of a target temperature, inputting the target temperature into the target thermistor RT model, and obtaining a resistor corresponding to the target temperature.
The target thermistor RT model establishes a mapping relationship between resistance and temperature. When receiving an input instruction of a target resistor, inputting the target resistor into a target thermistor RT model, and calculating through the thermistor RT model to obtain a temperature corresponding to the target resistor, thereby realizing actual prediction of the temperature. When receiving an input instruction of a target temperature, inputting the target temperature into a target thermistor RT model, and calculating through the thermistor RT model to obtain a resistor corresponding to the target temperature so as to realize actual prediction of the resistor.
According to the method, for the thermistor temperature data pairs, a plurality of thermistor RT models are established through polynomial fitting, and an optimal thermistor RT model is selected by using a verification set, so that the generalization capability and the prediction accuracy of the thermistor RT models are improved. Through a plurality of polynomial orders, the problem of poor generalization capability caused by overfitting due to overhigh single polynomial order is avoided, and the problem of underfilling caused by overlow single polynomial order is avoided, so that data are separated from sample data; a relative balance position is found between the operand and the accuracy through a plurality of polynomial orders; and verifying each thermistor RT model by using a verification set, calculating an average prediction error value, measuring the prediction capability of the thermistor RT model based on the average prediction error value, and providing objective comparison for polynomials of different orders, so that a target thermistor RT model can be obtained under a given polynomial order set.
Fig. 9 is a functional block diagram of a thermistor RT model fitting device according to an embodiment of the application.
In some embodiments, the thermistor RT model fitting means 30 may comprise a plurality of functional modules consisting of computer program segments. The computer program of the various program segments in the thermistor RT model fitting means 30 may be stored in a memory of the thermistor RT model fitting means and executed by at least one processor to perform (see fig. 2 for details) the functions of the thermistor RT model fitting method.
In this embodiment, the thermistor RT model fitting device 30 can be divided into a plurality of functional modules according to the functions it performs. The functional module may include: a partitioning module 301, a traversing module 302, a fitting module 303, a verification module 304, a determination module 305, and a response module 306.
The module referred to in the present invention refers to a series of computer program segments capable of being executed by at least one processor and of performing a fixed function, stored in a memory.
The dividing module 301 is configured to divide a thermistor temperature data set into a training set and a verification set according to the interval coefficient value, where the thermistor temperature data set includes a plurality of resistor temperature data pairs.
The traversing module 302 is configured to obtain a polynomial degree set, and cycle through from a first polynomial degree in the polynomial degree set to a last polynomial degree.
The fitting module 303 is configured to perform fitting on the basis of the training set for one target polynomial order traversed each time, so as to obtain a thermistor RT model of the target polynomial order.
The verification module 304 is configured to verify each thermistor RT model based on the verification set to obtain an average prediction error value set.
The determining module 305 is configured to obtain a target thermistor RT model from a plurality of thermistor RT models according to the average prediction error value set.
The response module 306 responds to an input instruction of a target resistor, and inputs the target resistor into the target thermistor RT model to obtain a temperature corresponding to the target resistor; and/or responding to an input instruction of a target temperature, and inputting the target temperature into the target thermistor RT model to obtain a resistor corresponding to the target temperature.
It should be understood that the various modifications and embodiments of the method for fitting a thermistor RT model provided in the foregoing embodiments are equally applicable to the apparatus for fitting a thermistor RT model in this embodiment, and those skilled in the art will be aware of the implementation procedure of the apparatus for fitting a thermistor RT model in this embodiment through the foregoing detailed description of the method for fitting a thermistor RT model, which is not described in detail herein for brevity of description.
The embodiment of the application also provides electronic equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes all or part of steps of the thermistor RT model fitting method when executing the computer program.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application. In the preferred embodiment of the present application, the electronic device 4 comprises a memory 41, at least one processor 42, at least one communication bus 43.
It will be appreciated by those skilled in the art that the configuration of the electronic device shown in fig. 10 is not limiting of the embodiments of the present application, and may be a bus-type configuration or a star-type configuration, and may include more or less other hardware or a different arrangement of components than those illustrated.
In some embodiments, the electronic device 4 is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit, a programmable gate array, a digital processor, an embedded device, and the like. The electronic device 4 may also include a client device, which includes, but is not limited to, any electronic product that can interact with a client by way of a keyboard, mouse, remote control, touch pad, or voice control device, such as a personal computer, tablet, smart phone, digital camera, etc.
In some embodiments, the memory 41 has stored therein a computer program which, when executed by the at least one processor 42, performs all or part of the steps in the thermistor RT model fitting method as described. The Memory 41 includes Read-Only Memory (ROM), programmable Read-Only Memory (PROM), erasable programmable Read-Only Memory (EPROM), one-time programmable Read-Only Memory (One-time Programmable Read-Only Memory, OTPROM), electrically erasable rewritable Read-Only Memory (EEPROM), compact disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM) or other optical disc Memory, magnetic tape Memory, or any other medium that can be used for computer-readable storage or carrying data. Further, the computer-readable storage medium mainly includes a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like.
In some embodiments, the at least one processor 42 is a Control Unit (Control Unit) of the electronic device 4, connects the various components of the entire electronic device 4 using various interfaces and lines, and performs various functions of the electronic device 4 and processes data by running or executing programs or modules stored in the memory 41, and invoking data stored in the memory 41. For example, the at least one processor 42, when executing the computer program stored in the memory, implements all or part of the steps of the thermistor RT model fitting method described in embodiments of the present application; or to implement all or part of the functions of the thermistor RT model fitting method. The at least one processor 42 may be comprised of integrated circuits, such as a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functionality, including one or more central processing units (Central Processing Unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like.
In some embodiments, the at least one communication bus 43 is arranged to enable connected communication between the memory 41 and the at least one processor 42 or the like. Although not shown, the electronic device 4 may further include a power source (such as a battery) for powering the various components, and preferably the power source may be logically connected to the at least one processor 42 via a power management device, such that functions of managing charging, discharging, and power consumption are performed by the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 4 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
The integrated units implemented in the form of software functional modules described above may be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium that includes instructions for causing a processor (processor) to perform portions of the methods described in various embodiments of the present application.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application.

Claims (10)

1. A thermistor RT model fitting method, the method comprising:
dividing a thermistor temperature data set into a training set and a verification set according to the interval coefficient value, wherein the thermistor temperature data set comprises a plurality of resistor temperature data pairs;
acquiring a polynomial order set, and starting circulation from the first polynomial order in the polynomial order set to traverse until the last polynomial order;
fitting the target polynomial order obtained by each traversal based on the training set to obtain a thermistor RT model of the target polynomial order;
verifying each thermistor RT model based on the verification set to obtain an average prediction error value set;
and acquiring a target thermistor RT model from a plurality of thermistor RT models according to the average prediction error value set.
2. The method of claim 1, wherein the dividing the thermistor temperature dataset into a training set and a validation set according to the interval coefficient value comprises:
acquiring a first data volume of the thermistor temperature data set;
calculating a second data volume of the verification set according to the interval coefficient value and the first data volume;
Sequentially acquiring resistance temperature data pairs of the second data amount from the thermistor temperature data set according to the interval coefficient value, and determining the acquired resistance temperature data pairs of the second data amount as the verification set;
and determining resistance temperature data pairs in the thermistor temperature data sets except the verification set as the training set.
3. The method of claim 2, wherein calculating a second data amount of the validation set from the interval coefficient value and the first data amount comprises:
calculating a quotient of the interval coefficient value and the first data volume;
judging whether the quotient is an integer or not;
when the quotient is an integer, taking the quotient as a second data amount of the verification set;
and when the quotient is not an integer, rounding down the quotient to obtain an integer value, and taking the integer as a second data quantity of the verification set.
4. The method of claim 1, wherein validating each of the thermistor RT models based on the validation set to obtain a set of average prediction error values comprises:
Inputting each thermistor in the verification set into the thermistor RT model for calculation aiming at each thermistor RT model to obtain a corresponding predicted temperature;
calculating to obtain a prediction error value set based on the temperature in the verification set and the corresponding prediction temperature;
calculating an average prediction error value based on the prediction error value set;
and obtaining the average prediction error value set based on the average prediction error value corresponding to each thermistor RT model.
5. The method of claim 4, wherein said obtaining a target thermistor RT model from a plurality of said thermistor RT models based on said average set of prediction error values comprises:
acquiring the smallest average prediction error value in the average prediction error value set;
and acquiring a thermistor RT model corresponding to the minimum average prediction error value from a plurality of thermistor RT models, and taking the thermistor RT model as the target thermistor RT model.
6. The method of fitting a thermistor RT model according to any of claims 1-5, wherein the fitting based on the training set to obtain the target polynomial order thermistor RT model comprises:
Obtaining a target least square function corresponding to the target polynomial order;
and performing least square function fitting based on the training set by using the target least square function to obtain the thermistor RT model with the target polynomial order.
7. The thermistor RT model fitting method of claim 6, further comprising:
responding to an input instruction of a target resistor, and inputting the target resistor into the target thermistor RT model to obtain a temperature corresponding to the target resistor; and/or
And responding to an input instruction of a target temperature, inputting the target temperature into the target thermistor RT model, and obtaining a resistor corresponding to the target temperature.
8. A thermistor RT model fitting device, the device comprising:
the division module is used for dividing the thermistor temperature data set into a training set and a verification set according to the interval coefficient value, wherein the thermistor temperature data set comprises a plurality of resistor temperature data pairs;
the traversing module is used for acquiring a polynomial order set, and starting to circularly traverse from the first polynomial order to the last polynomial order in the polynomial order set;
The fitting module is used for fitting one target polynomial order traversed each time based on the training set to obtain a thermistor RT model of the target polynomial order;
the verification module is used for verifying each thermistor RT model based on the verification set to obtain an average prediction error value set;
and the determining module is used for acquiring a target thermistor RT model from a plurality of thermistor RT models according to the average prediction error value set.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the thermistor RT model fitting method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the thermistor RT model fitting method according to any of claims 1 to 7.
CN202410160572.XA 2024-02-05 2024-02-05 Thermistor RT model fitting method and device, electronic equipment and storage medium Active CN117709206B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410160572.XA CN117709206B (en) 2024-02-05 2024-02-05 Thermistor RT model fitting method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410160572.XA CN117709206B (en) 2024-02-05 2024-02-05 Thermistor RT model fitting method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117709206A true CN117709206A (en) 2024-03-15
CN117709206B CN117709206B (en) 2024-05-28

Family

ID=90146568

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410160572.XA Active CN117709206B (en) 2024-02-05 2024-02-05 Thermistor RT model fitting method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117709206B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010004236A1 (en) * 1999-05-17 2001-06-21 Letkomiller Joseph Michael Response adjustable temperature sensor for transponder
US20200089830A1 (en) * 2018-09-14 2020-03-19 Synopsys, Inc. Elmore Delay Time (EDT)-Based Resistance Model

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010004236A1 (en) * 1999-05-17 2001-06-21 Letkomiller Joseph Michael Response adjustable temperature sensor for transponder
US20200089830A1 (en) * 2018-09-14 2020-03-19 Synopsys, Inc. Elmore Delay Time (EDT)-Based Resistance Model

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘颖 等: "不同曲线拟合方式对NTC热敏电阻测温精度的影响", 中国测试, vol. 44, no. 1, 31 December 2018 (2018-12-31), pages 200 - 204 *
孙斌 等: "NTC热敏电阻特性曲线的拟合方法研究", 《中国计量学院学报》, vol. 23, no. 1, 30 March 2012 (2012-03-30), pages 75 *

Also Published As

Publication number Publication date
CN117709206B (en) 2024-05-28

Similar Documents

Publication Publication Date Title
US11163853B2 (en) Sensor design support apparatus, sensor design support method and non-transitory computer readable medium
EP1946133B1 (en) Battery analysis system for determining quantity of cells of a battery
JP6246357B2 (en) Building management apparatus, wide area management system, data acquisition method, and program
TWI663510B (en) Equipment maintenance forecasting system and operation method thereof
WO2012145616A2 (en) Predictive modeling
CN112204581A (en) Learning device, deduction device, method and program
US11509550B2 (en) Cooperative learning system and monitoring system
WO2020175084A1 (en) Operation evaluation device, operation evaluation method, and program
BR102019015321A2 (en) AUTOMATIC COST ESTIMATE OF TWO CONNECTIONS FOR AUTOMATIC SPARE PARTS MANUFACTURING
US10354192B2 (en) Recommender system for exploratory data analysis
CN110795324B (en) Data processing method and device
CN109660964B (en) Communication method, device, equipment and computer readable medium of sensor
WO2022179235A1 (en) Cleaning robot control method and apparatus, cleaning robot, and storage medium
CN117709206B (en) Thermistor RT model fitting method and device, electronic equipment and storage medium
CN108345791B (en) Processor security detection method, system and detection device
CN115168159A (en) Abnormality detection method, abnormality detection device, electronic apparatus, and storage medium
CN116359735A (en) Battery parameter identification method, device, equipment and storage medium
CN114694355A (en) Remote early warning method and system
CN113311336A (en) Battery cell level capacity evaluation method and device and electronic equipment
CN111755125B (en) Method, device, medium and electronic equipment for analyzing patient measurement index
JP2020163300A (en) Management system of water treatment apparatus
CN116646911B (en) Current sharing distribution method and system applied to digital power supply parallel mode
JP7297339B2 (en) BATTERY STATE DETERMINATION METHOD AND BATTERY STATE DETERMINATION DEVICE
CN117218180A (en) Door and window automatic measurement method, system, device and storage medium
KR101726069B1 (en) Apparatus and Method for managing/estimating process effort inter a performance indicator

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant