Disclosure of Invention
In order to improve the temperature compensation efficiency of a crystal oscillator, the application provides a temperature compensation method and device of the crystal oscillator, a storage medium and electronic equipment.
In a first aspect of the present application, a method for compensating the temperature of a crystal oscillator is provided, which specifically includes:
Acquiring first temperature frequency data corresponding to at least one target crystal oscillator in the same batch of crystal oscillators, wherein the first temperature frequency data comprises different temperatures in a preset temperature interval and output frequencies of the corresponding target crystal oscillators at the different temperatures;
Obtaining corresponding three-dimensional data based on the first temperature frequency data of each target crystal oscillator, and fitting to obtain a three-dimensional curved surface equation based on each three-dimensional data, wherein the three-dimensional data comprises data of the corresponding target crystal oscillator in three dimensions of temperature, corresponding output frequency and process factors, and the process factors represent the influence degree of process deviation on the temperature frequency characteristics of the target crystal oscillator;
acquiring at least one group of second temperature frequency data of the crystal oscillator to be compensated, and obtaining a temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated based on the second temperature frequency data and the three-dimensional curve equation, wherein the second temperature frequency data comprise a single temperature in the preset temperature interval and the output frequency of the crystal oscillator to be compensated corresponding to the single temperature, the independent variable of the temperature frequency two-dimensional curve equation is temperature, and the dependent variable is the output frequency corresponding to the crystal oscillator to be compensated;
and carrying out temperature compensation on the crystal oscillator to be compensated based on the temperature frequency two-dimensional curve equation.
By adopting the technical scheme, the first temperature frequency data corresponding to at least one target crystal oscillator is acquired, the first temperature frequency data of each target crystal oscillator is fused into the corresponding process factor dimension data, the two-dimensional data of the output frequency and the temperature are expanded to the three-dimensional data, and then the three-dimensional data are fitted to obtain a three-dimensional curved surface equation, so that the influence of the process deviation on the output frequency deviation is taken into consideration. Further, the second temperature frequency data of the crystal oscillator to be compensated is substituted into the three-dimensional curved surface equation, the dimension is reduced to the temperature frequency two-dimensional curve equation, and the temperature compensation processing is performed specifically by means of reducing the dimension to the two-dimensional curve equation based on the three-dimensional curved surface equation, so that the change curve of the output frequency of the crystal oscillator to be compensated along with the temperature can be determined without measuring more temperature frequency data, the output frequency of the crystal oscillator to be compensated at different temperatures can be accurately determined according to the temperature frequency two-dimensional curve equation, and the temperature compensation processing is performed specifically, thereby improving the temperature compensation efficiency of the crystal oscillator.
Optionally, the obtaining corresponding three-dimensional data based on the first temperature frequency data of each target crystal oscillator specifically includes:
Determining a corresponding first change curve according to the first temperature frequency data of each target crystal oscillator, wherein the first change curve is a change curve of the output frequency of the corresponding target crystal oscillator along with the temperature;
Selecting a first target temperature interval from the preset temperature intervals, and extracting the slope of a part of curves corresponding to the first target temperature interval in each first change curve, wherein the linearity degree of each first change curve in the first target temperature interval is highest;
normalizing each slope to obtain a first process factor of a corresponding target crystal oscillator;
and determining different temperatures in the preset temperature interval and the first process factor of each target crystal oscillator as independent variables, and determining the output frequency of the corresponding target crystal oscillator at different temperatures as the dependent variables to obtain corresponding three-dimensional data.
By adopting the technical scheme, the first change curve corresponding to each target crystal oscillator in the first target temperature interval has the highest linearity, and the slope of the part curve corresponding to the first target temperature interval in each first change curve can intuitively reflect the influence of process deviation on the temperature frequency characteristic of each target crystal oscillator, so that the first process factor of each target crystal oscillator is determined according to the slope. And finally, the first process factor of each target crystal oscillator is fused into the two-dimensional data of the corresponding temperature frequency, and the two-dimensional data are expanded into three-dimensional data, so that the subsequent determination of a three-dimensional curved surface equation is facilitated.
Optionally, the obtaining a temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated based on the second temperature frequency data and the three-dimensional curve equation specifically includes:
Substituting each second temperature frequency data into the three-dimensional curved surface equation based on a least square method, and determining a target process factor corresponding to the crystal oscillator to be compensated;
substituting the target process factor into the three-dimensional curved surface equation to obtain a temperature frequency two-dimensional curved surface equation corresponding to the crystal oscillator to be compensated.
By adopting the technical scheme, the second temperature frequency data is substituted into the three-dimensional curved surface equation, meanwhile, the target process factor corresponding to the crystal oscillator to be compensated is determined based on the least square method, and then the target process factor is substituted into the three-dimensional curved surface equation to obtain the temperature frequency two-dimensional curve equation after dimension reduction, so that the temperature frequency two-dimensional curve equation of the crystal oscillator to be compensated can be rapidly determined by measuring the output frequency data of fewer temperature points, and the subsequent temperature compensation can be conveniently and more efficiently performed according to the temperature frequency two-dimensional curve equation.
Optionally, the method further comprises:
Acquiring at least one group of third temperature frequency data after the temperature compensation of the crystal oscillator to be compensated;
Based on the third temperature frequency data, a corresponding second change curve is obtained, the second change curve is fitted with a preset reference change curve, and a first integral fitting rate is obtained, wherein the reference change curve is a curve of temperature-compensated output frequency changing along with temperature;
If the first overall fitting rate does not exceed a preset fitting rate threshold, selecting a second target temperature interval and a third target temperature interval from the preset temperature interval, wherein the temperature in the second target temperature interval is lower than the temperature in the first target temperature interval, and the temperature in the third target temperature interval is higher than the first target temperature interval;
Calculating a first fitting rate of the reference change curve and the second change curve in the first target temperature interval, calculating a second fitting rate of the reference change curve and the second change curve in the second target temperature interval, calculating a third fitting rate of the reference change curve and the second change curve in the third target temperature interval, and adjusting the three-dimensional curved equation according to the first fitting rate, the second fitting rate and the third fitting rate to re-perform temperature compensation on the crystal oscillator to be compensated.
By adopting the technical scheme, if the first integral fitting rate does not exceed the fitting rate threshold, the effect of temperature compensation of the crystal oscillator to be compensated is poor according to the temperature frequency two-dimensional curve equation, and the deviation of the output frequency is still larger. Further, the fitting rate of the reference change curve and the second change curve in the first target temperature interval, the second target temperature interval and the third target temperature interval is determined, so that the temperature compensation effect of the current temperature compensation in different temperature intervals is reflected. And finally, based on the first fitting rate, the second fitting rate and the third fitting rate, the three-dimensional curved surface equation is adjusted, so that the compensation effect of the re-temperature compensation in each temperature interval is ensured to be good as much as possible.
Optionally, the adjusting the three-dimensional curved surface equation according to the first fitting rate, the second fitting rate and the third fitting rate to re-perform temperature compensation on the crystal oscillator to be compensated specifically includes:
when the second fitting rate and the third fitting rate do not exceed the fitting rate threshold and the first fitting rate exceeds the fitting rate threshold, determining a first weight and a second weight according to the proportional relation between the second fitting rate and the third fitting rate, wherein the sum of the weights of the first weight and the second weight is 1, and the larger the second fitting rate is, the smaller the corresponding first weight is;
For the same first change curve, determining a corresponding second process factor according to a corresponding partial curve in the second target temperature interval, and determining a corresponding third process factor according to a corresponding partial curve in the third target temperature interval;
Summing the product of the first weight and the second process factor and the product of the second weight and the third process factor to obtain a weighted sum result, and performing weighted sum on the weighted sum result and the first process factor of the same first change curve to obtain a brand new process factor of the corresponding target crystal oscillator;
and adjusting the three-dimensional curved surface equation according to the brand new process factors of the target crystal oscillators.
By adopting the technical scheme, when the second fitting rate and the third fitting rate do not exceed the fitting rate threshold and the first fitting rate exceeds the fitting rate threshold, the fact that the determined first process factor is poor in accuracy and rationality by using part of curves of the first target temperature interval is explained, and the first process factor needs to be adjusted is needed, then the proportional relation between the second fitting rate and the third fitting rate is determined, so that the effect of compensating the output frequency of the crystal oscillator to be compensated in the second target temperature interval and the third target temperature interval is reflected when temperature compensation is carried out based on a three-dimensional curved surface equation, and further, the second process factor and the third process factor are weighted and summed through the first weight and the second weight, and a weighted summation result is obtained. And finally, carrying out weighted summation on the first process factors and weighted summation results of the same first change curve to obtain brand new process factors of each target crystal oscillator, and adjusting the three-dimensional curved surface equation so as to finally improve the effect of re-temperature compensation.
Optionally, the method further comprises:
acquiring at least one group of fourth temperature frequency data after the temperature compensation of the crystal oscillator to be compensated;
Based on the fourth temperature frequency data, a corresponding third change curve is obtained, the third change curve is fitted with a preset reference change curve, and a second overall fitting rate is obtained, wherein the reference change curve is a curve of temperature-dependent output frequency with temperature compensation meeting requirements;
If the second overall fitting rate does not exceed the preset fitting rate threshold, determining at least one target output frequency based on a target part curve in the third change curve, wherein the fitting rate of the target part curve and a corresponding part curve in the reference change curve exceeds the preset fitting rate threshold;
And carrying out temperature compensation on the crystal oscillator to be compensated again based on each target output frequency and the three-dimensional curved surface equation.
By adopting the technical scheme, if the second integral fitting rate does not exceed the preset fitting rate threshold value, the fact that the similarity between the third change curve and the reference change curve is poor is indicated, further, the fact that the effect of temperature compensation is carried out on the crystal oscillator to be compensated according to a temperature frequency two-dimensional curve equation is indicated to be poor, the deviation of output frequency is still large, then at least one target output frequency, namely the output frequency with small deviation, is determined based on a target part curve in the third change curve, finally, the change condition of the output frequency of the crystal oscillator to be compensated along with the temperature is determined again accurately according to the target output frequency and the three-dimensional curve equation, and further, the temperature compensation with better effect is achieved.
Optionally, the performing temperature compensation on the crystal oscillator to be compensated again based on each target output frequency and the three-dimensional curved surface equation specifically includes:
averaging the target output frequencies to obtain proper output frequencies, substituting the proper output frequencies into the three-dimensional curved surface equation to obtain a target two-dimensional curve equation, wherein the target two-dimensional curve equation is a curve of the process factor of the crystal oscillator to be compensated along with the temperature;
Performing linear fitting on the target two-dimensional curve to obtain a constant function parallel to an x-axis, and determining a final process factor corresponding to the crystal oscillator to be compensated according to the constant function;
substituting the final process factor into the three-dimensional curved surface equation to obtain a final temperature frequency two-dimensional curved surface equation corresponding to the crystal oscillator to be compensated;
And carrying out temperature compensation on the crystal oscillator to be compensated again based on the final temperature frequency two-dimensional curve equation.
By adopting the technical scheme, the proper output frequency is substituted into the three-dimensional curved surface equation to obtain the target two-dimensional curved surface equation, namely, the change curve of the process factor of the crystal oscillator to be compensated along with the temperature. Therefore, the change condition of the process factor of the crystal oscillator to be compensated along with the temperature is determined when the temperature compensation effect is good and the output frequency offset is small. Further, the target two-dimensional curve equation is subjected to linear fitting to obtain a constant function parallel to the x axis, so that the final process factor is finally determined, and the output frequency offset of the crystal oscillator to be compensated in more temperatures is smaller. And finally substituting the final process factor into a three-dimensional curved surface equation, and reducing the dimension to obtain a final temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated, namely, a change curve of the output frequency of the crystal oscillator to be compensated along with the temperature. Further, based on the final temperature frequency two-dimensional curve equation, the temperature compensation is performed on the crystal oscillator to be compensated again, and the temperature compensation effect is improved.
In a second aspect of the present application, there is provided a crystal oscillator temperature compensation apparatus, comprising:
the data acquisition module is used for acquiring first temperature frequency data corresponding to at least one target crystal oscillator in the same batch of crystal oscillators, wherein the first temperature frequency data comprises different temperatures in a preset temperature interval and output frequencies of the corresponding target crystal oscillators at the different temperatures;
The curve fitting module is used for obtaining corresponding three-dimensional data based on the first temperature frequency data of each target crystal oscillator, fitting to obtain a three-dimensional curve equation based on each three-dimensional data, wherein the three-dimensional data comprises data of the corresponding target crystal oscillator in three dimensions of temperature, corresponding output frequency and process factors, and the process factors represent the influence degree of process deviation on the temperature frequency characteristics of the target crystal oscillator;
The curve determining module is used for obtaining at least one group of second temperature frequency data of the crystal oscillator to be compensated, obtaining a temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated based on the second temperature frequency data and the three-dimensional curved surface equation, wherein the second temperature frequency data comprise a single temperature in the preset temperature interval and the output frequency of the crystal oscillator to be compensated corresponding to the single temperature, the independent variable of the temperature frequency two-dimensional curve equation is temperature, and the dependent variable is the output frequency corresponding to the crystal oscillator to be compensated;
And the temperature compensation module is used for carrying out temperature compensation on the crystal oscillator to be compensated based on the temperature frequency two-dimensional curve equation.
By adopting the technical scheme, the data acquisition module acquires the first temperature frequency data of the target crystal oscillator, the curve fitting module fits to obtain a three-dimensional curve equation based on each three-dimensional data, the curve determining module obtains a temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated according to each second temperature frequency data and the three-dimensional curve equation, and finally the temperature compensation module compensates the temperature of the crystal oscillator to be compensated based on the temperature frequency two-dimensional curve equation.
In a third aspect of the application there is provided a computer readable storage medium having a computer program stored therein, which when loaded and executed by a processor performs the method steps of any of the first aspects.
In a fourth aspect of the present application, there is provided an electronic device, comprising:
A processor, a memory and a computer program stored in the memory and capable of running on the processor, the processor being configured to load and execute the computer program stored in the memory to cause the electronic device to perform the method according to any one of the first aspects.
In summary, the method has at least one of the following beneficial technical effects that the first temperature frequency data of each target crystal oscillator are fused into the corresponding process factor dimension data, the two-dimensional data of the output frequency and the temperature are expanded to three-dimensional data, and then the three-dimensional data are fitted to obtain a three-dimensional curved surface equation, so that the influence of process deviation on the output frequency deviation is taken into consideration better. Further, the second temperature frequency data of the crystal oscillator to be compensated is substituted into the three-dimensional curved surface equation, the dimension is reduced to the temperature frequency two-dimensional curve equation, and the temperature compensation processing is performed specifically by means of reducing the dimension to the two-dimensional curve equation based on the three-dimensional curved surface equation, so that the change curve of the output frequency of the crystal oscillator to be compensated along with the temperature can be determined without measuring more temperature frequency data, the output frequency of the crystal oscillator to be compensated at different temperatures can be accurately determined according to the temperature frequency two-dimensional curve equation, and the temperature compensation processing is performed specifically, thereby improving the temperature compensation efficiency of the crystal oscillator.
Detailed Description
In order to make the technical solutions in the present specification better understood by those skilled in the art, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only some embodiments of the present application, not all embodiments.
In describing embodiments of the present application, words such as "exemplary," "such as" or "for example" are used to mean serving as examples, illustrations or explanations. Any embodiment or design described herein as "illustrative," "such as" or "for example" is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "illustratively," "such as" or "for example," etc., is intended to present related concepts in a concrete fashion.
In the description of the embodiment of the present application, the term "and/or" is merely an association relationship describing the association object, and indicates that three relationships may exist, for example, a and/or B, and may indicate that a exists alone, B exists alone, and both a and B exist. In addition, unless otherwise indicated, the term "plurality" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals. Furthermore, 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 implicitly indicating an indicated technical feature. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
Referring to fig. 1, an embodiment of the present application discloses a flow chart of a method for compensating the temperature of a crystal oscillator, which can be implemented by a computer program or can be run on a crystal oscillator temperature compensation device based on von neumann system. The computer program can be integrated in an application or can be run as a stand-alone tool class application, and specifically comprises:
S101, acquiring first temperature frequency data corresponding to at least one target crystal oscillator in the same batch of crystal oscillators.
Specifically, in the embodiment of the present application, the first temperature frequency data refers to different temperatures in a preset temperature interval and output frequencies of a single target crystal oscillator at the different temperatures. The output frequency of the target crystal oscillator refers to the frequency of the periodic clock signal generated by the target crystal oscillator, and once the output frequency deviates, the output frequency can have various effects on the clock signal, so that when the crystal oscillator is used as a main clock source, the system time sequence accuracy of an electronic system applying the crystal oscillator is poor. The target crystal oscillator is a crystal oscillator which is randomly sampled in the crystal oscillators produced in the same production batch to measure the output frequency at different temperatures. The preset temperature interval is-50 ℃ to 100 ℃, and different temperatures corresponding to different output frequencies of the target crystal oscillator can be-50 ℃, 24 ℃, 26 ℃, 50 ℃ and 100 ℃, and in other embodiments, other more temperatures can be adopted.
One possible way to obtain the first temperature frequency data is to place the target crystal oscillators in an incubator, adjust the temperature of the incubator to different temperatures in a preset range interval, and then obtain the output frequencies corresponding to the target crystal oscillators at different temperatures in the preset temperature interval of each target crystal oscillator through a frequency meter or an oscilloscope connected with the target crystal oscillators. This is the prior art and will not be described in detail here.
S102, obtaining corresponding three-dimensional data based on first temperature frequency data of each target crystal oscillator, and fitting to obtain a three-dimensional curved surface equation based on each three-dimensional data, wherein the three-dimensional data comprises data of the corresponding target crystal oscillator in three dimensions of temperature, corresponding output frequency and process factors.
Specifically, in the embodiment of the application, the process factor characterizes the influence degree of the process deviation on the deviation of the temperature frequency characteristic of the target crystal oscillator, and the process deviation refers to the AT cut angle deviation of the target crystal oscillator, namely, the included angle between the cutting surface and the main axis of the quartz crystal deviates from the ideal standard angle of 35 degrees 15' in the cutting process. Such deviations can have a significant impact on the performance of the target crystal oscillator, including stability of the output frequency. The temperature frequency characteristic is a characteristic in which the output frequency of the crystal oscillator changes when the ambient temperature changes. The larger the process factor, the larger the offset in the crystal oscillator output frequency when the temperature remains unchanged. After the first temperature frequency data are determined, a corresponding first change curve is drawn by a preset MATLAB tool according to the single target crystal oscillator and based on the corresponding first temperature frequency data, wherein the first change curve is a change curve of the output frequency of the corresponding target crystal oscillator along with temperature. Further, a first target temperature interval is selected from the preset temperature interval, the first target temperature interval is 0-50 ℃, the intermediate temperature interval of the target crystal oscillators is represented, the linearity degree of the first change curve corresponding to each target crystal oscillator in the first target temperature interval is highest, namely, part of the curve of the first change curve corresponding to each target crystal oscillator in the first target temperature interval is closest to a straight line. Further, first temperature frequency data of each target crystal oscillator in the first target temperature interval are selected, data fitting is carried out through two Python libraries NumPy and SciPy, a first-order function of output frequency of each target crystal oscillator in the first target temperature interval along with temperature change is obtained, k values in the first-order function are determined to be corresponding slopes, namely slopes of partial curves corresponding to the first target temperature interval in each first change curve, and therefore influences of process deviation on temperature frequency characteristics of each target crystal oscillator are reflected intuitively.
Further, the slope of a part of curves in a first target temperature interval in the first change curve of each target crystal oscillator is normalized to obtain a first process factor corresponding to each target crystal oscillator, so that the error of the process factor of each target crystal oscillator is reduced. One possible normalization method is to normalize each slope by a preset OmicShare Tools tool to finally obtain a corresponding first process factor. Finally, determining different temperatures (different temperatures in the first temperature frequency data) in a preset temperature interval and the first process factor of each target crystal oscillator as independent variables, determining the output frequency of the corresponding target crystal oscillator at different temperatures as dependent variables, and determining the data of the three dimensions (temperature, corresponding output frequency and process factor) as three-dimensional data of each target crystal oscillator, so that the first temperature frequency data (two-dimensional data) of each target crystal oscillator is expanded into three-dimensional data.
Further, based on three-dimensional data of each target crystal oscillator, a corresponding three-dimensional curved surface equation is obtained through fitting by a curve fitting tool box (cftool) in a MATLAB tool, so that corresponding change conditions of output frequency of the crystal oscillator when temperature and process factors change are better described.
S103, at least one group of second temperature frequency data of the crystal oscillator to be compensated is obtained, and a temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated is obtained based on the second temperature frequency data and the three-dimensional curve equation.
Specifically, after the three-dimensional curved surface equation corresponding to the crystal oscillator is determined, at least one set of second temperature frequency data of the crystal oscillator to be compensated is obtained, and the obtaining manner may refer to step S101, which is not described herein again. The crystal oscillator to be compensated refers to a crystal oscillator which needs to be subjected to temperature compensation at present, and the second temperature frequency data comprise a single temperature in a preset temperature interval and the output frequency of the crystal oscillator to be compensated at the single temperature. Further, substituting the second temperature frequency data into the three-dimensional curved surface equation, determining a target process factor corresponding to the crystal oscillator to be compensated based on a least square method, substituting the target process factor into the three-dimensional curved surface equation to obtain a temperature frequency two-dimensional curve equation after dimension reduction, and accordingly determining the temperature frequency two-dimensional curve equation of the crystal oscillator to be compensated rapidly by measuring output frequency data of fewer temperature points. The independent variable of the temperature frequency two-dimensional curve equation is temperature, and the dependent variable is output frequency corresponding to the crystal oscillator to be compensated. In addition, by the least square method, a curved surface equation describing a three-dimensional space can be converted into a two-dimensional curved surface equation involving only two variables.
And S104, carrying out temperature compensation on the crystal oscillator to be compensated based on a temperature frequency two-dimensional curve equation.
Specifically, after a temperature frequency two-dimensional curve equation of the crystal oscillator to be compensated is adopted, the current ambient temperature is obtained through a preset temperature sensor, then the current ambient temperature is substituted into the temperature frequency two-dimensional curve equation to obtain the uncompensated actual output frequency of the crystal oscillator to be compensated, then the nominal frequency is subtracted from the actual output frequency to obtain a frequency compensation value, and finally the frequency compensation value is written into a preset compensation register, so that the effect of temperature compensation of the crystal oscillator to be compensated is achieved. The compensation register is a storage unit which is built in the crystal oscillator control circuit to be compensated and is used for storing the frequency compensation value and adjusting the output frequency so as to counteract the influence caused by temperature change. This is the prior art and will not be described in detail here.
In other embodiments, at least one set of third temperature frequency data after temperature compensation of the crystal oscillator to be compensated is obtained, where the third temperature frequency data includes a single temperature of the crystal oscillator to be compensated after temperature compensation in a preset temperature interval and a corresponding output frequency. And drawing a corresponding second change curve, namely, a change curve of the output frequency of the crystal oscillator to be compensated with temperature after temperature compensation, based on the third temperature frequency data by using a MATLAB tool. And fitting the second change curve with a preset reference change curve to obtain a first integral fitting rate, wherein the reference change curve is a curve of which the output frequency meets the requirement of temperature compensation along with the temperature change. If the first overall fitting rate does not exceed the fitting rate threshold, which indicates that the effect of temperature compensation of the crystal oscillator to be compensated is poor according to the temperature frequency two-dimensional curve equation, and the deviation of the output frequency is still large, selecting a second target temperature interval and a third target temperature interval from preset temperature intervals, wherein the temperature in the second target temperature interval is lower than the temperature in the first target temperature interval, and the temperature in the third target temperature interval is higher than the first target temperature interval. The second target temperature range is-50 ℃ to-30 ℃ and can be understood as a low temperature range of the crystal oscillator, and the second target temperature range is 80 ℃ to 100 ℃ and can be understood as a high temperature range of the crystal oscillator.
Further, a first fitting rate of the reference change curve and the second change curve in the first target temperature interval, a second fitting rate of the reference change curve and the second change curve in the second target temperature interval, and a third fitting rate of the reference change curve and the second change curve in the third target temperature interval are determined through a MATLAB tool. And then, according to the first fitting rate, the second fitting rate and the third fitting rate, the three-dimensional curved surface equation is adjusted to carry out temperature compensation on the crystal oscillator to be compensated again, and one implementation mode is that the first fitting rate, the second fitting rate and the third fitting rate are respectively compared with a fitting rate threshold, when the second fitting rate and the third fitting rate do not exceed the fitting rate threshold and the first fitting rate exceeds the fitting rate threshold, the fact that a part of curves of a first target temperature interval are used is explained, the accuracy and the rationality of a determined first process factor are poor, the first process factor is required to be adjusted, and then the proportional relation between the second fitting rate and the third fitting rate is determined, so that the effect of compensating the output frequency of the crystal oscillator to be compensated in the second target temperature interval and the third target temperature interval is reflected when the temperature compensation is carried out based on the three-dimensional curved surface equation. According to the proportional relation, a first weight and a second weight are determined, the larger the second fitting rate is, the smaller the corresponding first weight is, and the larger the weight is, the worse the corresponding output frequency compensation effect is. The sum of the first weight and the second weight is 1, and the ratio relationship is 3:2, for example, the first weight is 0.4, and the second weight is 0.6, which indicates that the output frequency compensation effect of the second target temperature interval is better than the output frequency compensation effect of the third target temperature interval.
Further, for the same first change curve, according to the partial curve thereof in the second target temperature interval, the corresponding slope is extracted and the corresponding second process factor is determined, and according to the partial curve thereof in the third target temperature interval, the corresponding slope is extracted and the corresponding third process factor is determined, and the detailed description is omitted herein, referring to step S102. Further, the product of the first weight and the second process factor and the product of the second weight and the third process factor are summed to obtain a weighted summation result. Further, the first process factor and the weighted summation result of the same first variation curve are weighted summed. The method comprises the steps of calculating a total first temperature difference between a second target temperature interval and a third target temperature interval, determining weights corresponding to a weighted summation result and a first process factor according to the proportion of the first temperature difference to the second temperature difference between the first target temperature interval, wherein the larger the first temperature difference is, the larger the weight corresponding to the weighted summation result is, and the larger the second temperature difference is, the larger the weight of the first process factor is. Thus, the brand new process factors of the corresponding target crystal oscillators are determined more accurately.
Further, different temperatures in a preset temperature interval, brand-new process factors of each target crystal oscillator and output frequencies of the corresponding target crystal oscillators at different temperatures are determined to be three-dimensional data, and a brand-new three-dimensional curved surface equation is obtained by re-fitting, so that adjustment of the three-dimensional curved surface equation is realized. And finally, obtaining a brand-new temperature frequency two-dimensional curve equation based on the brand-new three-dimensional curve equation, and carrying out temperature compensation on the crystal oscillator to be compensated again. See steps S103-S104, and are not described in detail herein.
Referring to fig. 2, another embodiment of the present application discloses a flow chart of a method for temperature compensation of a crystal oscillator, which can be implemented by a computer program or can be run on a crystal oscillator temperature compensation device based on von neumann system. The computer program can be integrated in an application or can be run as a stand-alone tool class application, and specifically comprises:
S201, first temperature frequency data corresponding to at least one target crystal oscillator in the same batch of crystal oscillators is obtained.
S202, obtaining corresponding three-dimensional data based on first temperature frequency data of each target crystal oscillator, and fitting to obtain a three-dimensional curved surface equation based on each three-dimensional data, wherein the three-dimensional data comprises data of the corresponding target crystal oscillator in three dimensions of temperature, corresponding output frequency and process factors.
S203, at least one group of second temperature frequency data of the crystal oscillator to be compensated is obtained, and a temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated is obtained based on the second temperature frequency data and the three-dimensional curve equation.
S204, carrying out temperature compensation on the crystal oscillator to be compensated based on a temperature frequency two-dimensional curve equation.
Specifically, refer to steps S101-S104, which are not described herein.
S205, at least one group of fourth temperature frequency data of the crystal oscillator to be compensated after temperature compensation is obtained.
S206, based on the fourth temperature frequency data, obtaining a corresponding third change curve, fitting the third change curve with a preset reference change curve to obtain a second integral fitting rate, wherein the reference change curve is a curve of the output frequency changing along with the temperature, and the temperature compensation of the curve meets the requirement.
S207, if the second overall fitting rate does not exceed the preset fitting rate threshold, determining at least one target output frequency based on the target part curve in the third change curve, wherein the fitting rate of the corresponding part curve in the target part curve and the reference change curve exceeds the preset fitting rate threshold.
And S208, carrying out temperature compensation on the crystal oscillator to be compensated again based on each target output frequency and the three-dimensional curved surface equation.
Specifically, at least one set of fourth temperature frequency data of the crystal oscillator to be compensated after temperature compensation is obtained, and the obtaining manner may refer to step S101, which is not described herein. The fourth temperature frequency data comprise the single temperature of the crystal oscillator to be compensated after temperature compensation in a preset temperature interval and the corresponding output frequency. And performing curve fitting through a curve fitting tool box (cftool) in the MATLAB tool based on the fourth temperature frequency data to obtain a corresponding third change curve, wherein the third change curve is a change curve of the output frequency of the crystal oscillator to be compensated after temperature compensation along with the temperature. Further, fitting the third change curve with a preset reference change curve through a MATLAB tool to obtain a second overall fitting rate, wherein the reference change curve is a curve of temperature-compensation-compliant output frequency changing along with temperature, and the temperature-compensation-compliant requirement means that the output frequency of each temperature in a preset temperature interval after temperature compensation is within a reasonable frequency range.
Further, if the second overall fitting rate does not exceed the preset fitting rate threshold value, it is indicated that the similarity between the third change curve and the reference change curve is poor, and further it is indicated that the effect of performing temperature compensation on the crystal oscillator to be compensated is poor and the deviation of the output frequency is still large according to the temperature frequency two-dimensional curve equation, then at least one target output frequency is determined based on the target partial curve in the third change curve. And finally, inputting at least one temperature point in the sub-temperature interval corresponding to the target part curve to a third change curve to obtain at least one target output frequency, namely, an output frequency which is smaller along with temperature deviation.
Further, the target output frequencies are averaged to obtain a proper output frequency, and then the proper output frequency is substituted into a three-dimensional curved surface equation to obtain a target two-dimensional curved surface equation with only two variables of a process factor and temperature, namely, a change curve of the process factor of the crystal oscillator to be compensated along with the temperature. Therefore, the change condition of the process factor of the crystal oscillator to be compensated along with the temperature is determined when the temperature compensation effect is good and the output frequency offset is small. Further, a linear fit is performed by a curve fitting tool box (cftool) in MATLAB to the target two-dimensional curve equation, resulting in a constant function f (x) =c parallel to the x-axis, c representing a constant, which may be f (x) =20, for example. Further, the constant value in the constant function is determined as the final process factor of the crystal oscillator to be compensated, i.e. the value around which the corresponding process factor fluctuates in case the output frequency offset is small. Determining it as the final process factor helps to make the output frequency offset of the crystal oscillator to be compensated smaller in more temperatures. And finally, substituting the final process factor into a three-dimensional curved surface equation, and reducing the dimension based on a least square method to obtain a final temperature frequency two-dimensional curve equation corresponding to the crystal oscillator to be compensated, namely, a curve of the output frequency of the crystal oscillator to be compensated along with the temperature. Further, based on the final temperature-frequency two-dimensional curve equation, the temperature compensation is performed on the crystal oscillator to be compensated again, and in particular, reference may be made to step S104, which is not described herein.
The implementation principle of the temperature compensation method of the crystal oscillator is that the first temperature frequency data of each target crystal oscillator are fused into corresponding process factor dimension data, two-dimensional data of output frequency and temperature are expanded into three-dimensional data, and then the three-dimensional data are fitted to obtain a three-dimensional curved surface equation, so that the influence of process deviation on output frequency deviation is taken into consideration. Further, the second temperature frequency data of the crystal oscillator to be compensated is substituted into the three-dimensional curved surface equation, the dimension is reduced to the temperature frequency two-dimensional curve equation, and the temperature compensation processing is performed specifically by means of reducing the dimension to the two-dimensional curve equation based on the three-dimensional curved surface equation, so that the change curve of the output frequency of the crystal oscillator to be compensated along with the temperature can be determined without measuring more temperature frequency data, the output frequency of the crystal oscillator to be compensated at different temperatures can be accurately determined according to the temperature frequency two-dimensional curve equation, and the temperature compensation processing is performed specifically, thereby improving the temperature compensation efficiency of the crystal oscillator.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Fig. 3 is a schematic structural diagram of a temperature compensation device for a crystal oscillator according to an embodiment of the application. The application to a crystal oscillator temperature compensation device may be implemented as all or part of the device by software, hardware, or a combination of both. The device comprises a data acquisition module 11, a curve fitting module 12, a curve determining module 13 and a temperature compensation module 14.
The data acquisition module 11 is configured to acquire first temperature frequency data corresponding to at least one target crystal oscillator in the same batch of crystal oscillators, where the first temperature frequency data includes different temperatures in a preset temperature interval and output frequencies of the target crystal oscillators corresponding to the different temperatures;
The surface fitting module 12 is configured to obtain corresponding three-dimensional data based on the first temperature frequency data of each target crystal oscillator, and fit to obtain a three-dimensional surface equation based on each three-dimensional data, where the three-dimensional data includes data of the corresponding target crystal oscillator in three dimensions of temperature, corresponding output frequency and process factors, and the process factors characterize the influence degree of process deviation on the temperature frequency characteristics of the target crystal oscillator;
The curve determining module 13 is configured to obtain at least one set of second temperature frequency data of the crystal oscillator to be compensated, and obtain a two-dimensional temperature frequency curve equation corresponding to the crystal oscillator to be compensated based on the second temperature frequency data and the three-dimensional curved surface equation, where the second temperature frequency data includes a single temperature in a preset temperature interval and an output frequency of the crystal oscillator to be compensated corresponding to the single temperature, an independent variable of the two-dimensional temperature frequency curve equation is temperature, and a dependent variable is an output frequency corresponding to the crystal oscillator to be compensated;
The temperature compensation module 14 is used for performing temperature compensation on the crystal oscillator to be compensated based on a temperature frequency two-dimensional curve equation.
Optionally, the surface fitting module 12 is specifically configured to:
Determining a corresponding first change curve according to the first temperature frequency data of each target crystal oscillator, wherein the first change curve is a change curve of the output frequency of the corresponding target crystal oscillator along with the temperature;
Selecting a first target temperature interval from preset temperature intervals, extracting the slope of a part of curves corresponding to the first target temperature interval in each first change curve, wherein the linearity degree of each first change curve in the first target temperature interval is highest;
Normalizing each slope to obtain a first process factor of a corresponding target crystal oscillator;
And determining different temperatures in a preset temperature interval and a first process factor of each target crystal oscillator as independent variables, and determining output frequencies of the corresponding target crystal oscillators at different temperatures as independent variables to obtain corresponding three-dimensional data.
Optionally, the curve determining module 13 is specifically configured to:
Substituting the second temperature frequency data into a three-dimensional curved surface equation based on a least square method, and determining a target process factor corresponding to the crystal oscillator to be compensated;
substituting the target process factors into the three-dimensional curved surface equation to obtain a temperature frequency two-dimensional curved surface equation corresponding to the crystal oscillator to be compensated.
Optionally, as shown in fig. 4, the apparatus further includes a first compensation module 15, specifically configured to:
Acquiring at least one group of third temperature frequency data of the crystal oscillator to be compensated after temperature compensation;
Based on the third temperature frequency data, a corresponding second change curve is obtained, the second change curve is fitted with a preset reference change curve, a first integral fitting rate is obtained, and the reference change curve is a curve of temperature-compensated output frequency changing along with temperature;
if the first overall fitting rate does not exceed the preset fitting rate threshold, selecting a second target temperature interval and a third target temperature interval from the preset temperature interval, wherein the temperature in the second target temperature interval is lower than the temperature in the first target temperature interval, and the temperature in the third target temperature interval is higher than the first target temperature interval;
Calculating a first fitting rate of the reference change curve and the second change curve in the first target temperature interval, calculating a second fitting rate of the reference change curve and the second change curve in the second target temperature interval, calculating a third fitting rate of the reference change curve and the second change curve in the third target temperature interval, and adjusting the three-dimensional curved surface equation according to the first fitting rate, the second fitting rate and the third fitting rate so as to re-compensate the temperature of the crystal oscillator to be compensated.
Optionally, the first compensation module 15 is specifically configured to:
When the second fitting rate and the third fitting rate do not exceed the fitting rate threshold and the first fitting rate exceeds the fitting rate threshold, determining a first weight and a second weight according to the proportional relation between the second fitting rate and the third fitting rate, wherein the sum of the weights of the first weight and the second weight is 1, and the larger the second fitting rate is, the smaller the corresponding first weight is;
For the same first change curve, determining a corresponding second process factor according to a corresponding partial curve in a second target temperature interval, and determining a corresponding third process factor according to a corresponding partial curve in a third target temperature interval;
Summing the product of the first weight and the second process factor and the product of the second weight and the third process factor to obtain a weighted sum result, and carrying out weighted sum on the weighted sum result and the first process factor of the same first change curve to obtain a brand new process factor of the corresponding target crystal oscillator;
and adjusting the three-dimensional curved surface equation according to the brand new process factors of each target crystal oscillator.
Optionally, the apparatus further comprises a second compensation module 16, in particular for:
acquiring at least one group of fourth temperature frequency data of the crystal oscillator to be compensated after temperature compensation;
Based on the fourth temperature frequency data, a corresponding third change curve is obtained, the third change curve is fitted with a preset reference change curve, a second overall fitting rate is obtained, and the reference change curve is a curve of temperature-compensated output frequency changing along with temperature;
If the second overall fitting rate does not exceed the preset fitting rate threshold, determining at least one target output frequency based on a target part curve in the third change curve, wherein the fitting rate of the target part curve and a corresponding part curve in the reference change curve exceeds the preset fitting rate threshold;
And re-performing temperature compensation on the crystal oscillator to be compensated based on each target output frequency and the three-dimensional curved surface equation.
Optionally, the second compensation module 16 is specifically configured to:
averaging the target output frequencies to obtain an appropriate output frequency, substituting the appropriate output frequency into a three-dimensional curved surface equation to obtain a target two-dimensional curve equation, wherein the target two-dimensional curve equation is a change curve of a process factor of the crystal oscillator to be compensated along with temperature;
performing linear fitting on the target two-dimensional curve to obtain a constant function parallel to the x-axis, and determining a final process factor corresponding to the crystal oscillator to be compensated according to the constant function;
substituting the final process factor into a three-dimensional curved surface equation to obtain a final temperature frequency two-dimensional curved surface equation corresponding to the crystal oscillator to be compensated;
and re-performing temperature compensation on the crystal oscillator to be compensated based on the final temperature frequency two-dimensional curve equation.
It should be noted that, when the crystal oscillator temperature compensation device provided in the above embodiment performs the crystal oscillator temperature compensation method, only the division of the above functional modules is used for illustration, and in practical application, the above functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the embodiment of the present invention provides a crystal oscillator temperature compensation device and a crystal oscillator temperature compensation method, which belong to the same concept, and the implementation process is detailed in the method embodiment, and will not be described herein again.
The embodiment of the application also discloses a computer readable storage medium, and the computer readable storage medium stores a computer program, wherein the computer program adopts the crystal oscillator temperature compensation method of the embodiment when being executed by a processor.
The computer program may be stored in a computer readable medium, where the computer program includes computer program code, where the computer program code may be in a source code form, an object code form, an executable file form, or some middleware form, etc., and the computer readable medium includes any entity or device capable of carrying the computer program code, a recording medium, a usb disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a Random Access Memory (RAM), an electrical carrier signal, a telecommunication signal, a software distribution medium, etc., where the computer readable medium includes, but is not limited to, the above components.
The crystal oscillator temperature compensation method of the embodiment is stored in the computer readable storage medium through the computer readable storage medium, and is loaded and executed on a processor, so that the storage and the application of the method are convenient.
The embodiment of the application also discloses an electronic device, wherein a computer program is stored in a computer readable storage medium, and when the computer program is loaded and executed by a processor, the crystal oscillator temperature compensation method is adopted.
The electronic device may be an electronic device such as a desktop computer, a notebook computer, or a cloud server, and the electronic device includes, but is not limited to, a processor and a memory, for example, the electronic device may further include an input/output device, a network access device, a bus, and the like.
The processor may be a Central Processing Unit (CPU), or of course, according to actual use, other general purpose processors, digital Signal Processors (DSP), application Specific Integrated Circuits (ASIC), ready-made programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., and the general purpose processor may be a microprocessor or any conventional processor, etc., which is not limited in this respect.
The memory may be an internal storage unit of the electronic device, for example, a hard disk or a memory of the electronic device, or may be an external storage device of the electronic device, for example, a plug-in hard disk, a Smart Memory Card (SMC), a secure digital card (SD), or a flash memory card (FC) provided on the electronic device, or the like, and may be a combination of the internal storage unit of the electronic device and the external storage device, where the memory is used to store a computer program and other programs and data required by the electronic device, and the memory may be used to temporarily store data that has been output or is to be output, which is not limited by the present application.
The crystal oscillator temperature compensation method of the embodiment is stored in the memory of the electronic device through the electronic device, and is loaded and executed on the processor of the electronic device, so that the crystal oscillator temperature compensation method is convenient to use.
The foregoing is merely exemplary embodiments of the present disclosure and is not intended to limit the scope of the present disclosure. That is, equivalent changes and modifications are contemplated by the teachings of this disclosure, which fall within the scope of the present disclosure. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a scope and spirit of the disclosure being indicated by the claims.