CN111930749A - Thermocouple potential data storage method and query method - Google Patents

Thermocouple potential data storage method and query method Download PDF

Info

Publication number
CN111930749A
CN111930749A CN202010832260.0A CN202010832260A CN111930749A CN 111930749 A CN111930749 A CN 111930749A CN 202010832260 A CN202010832260 A CN 202010832260A CN 111930749 A CN111930749 A CN 111930749A
Authority
CN
China
Prior art keywords
value
potential
temperature
data
difference value
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.)
Pending
Application number
CN202010832260.0A
Other languages
Chinese (zh)
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.)
Xiamen Anthone Electronics Co ltd
Original Assignee
Xiamen Anthone Electronics 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 Xiamen Anthone Electronics Co ltd filed Critical Xiamen Anthone Electronics Co ltd
Priority to CN202010832260.0A priority Critical patent/CN111930749A/en
Publication of CN111930749A publication Critical patent/CN111930749A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation

Abstract

The invention particularly relates to a thermocouple potential data storage method and a query method, wherein the data storage method comprises the following steps: dividing each temperature value in the graduation table into a plurality of temperature intervals in sequence; extracting temperature values and corresponding potential values of endpoints of all temperature intervals, and correspondingly generating a basic data table; for each temperature interval, generating an auxiliary array corresponding to the temperature interval according to the potential difference value corresponding to each temperature value; extracting an auxiliary array corresponding to each temperature interval, and correspondingly generating an auxiliary data table; and respectively storing the generated basic data table and the auxiliary data table. The invention also correspondingly discloses a thermocouple potential data query method. The thermocouple potential data storage method and the thermocouple potential data query method can ensure the data compression and recovery effect, effectively reduce the query calculation amount, and give consideration to the query precision and the query efficiency of the potential value and the temperature value.

Description

Thermocouple potential data storage method and query method
Technical Field
The invention relates to the technical field of industrial measurement, in particular to a thermocouple potential data storage method and a thermocouple potential data query method.
Background
In the case of products with thermocouples for measuring temperature, a common procedure is to query the corresponding temperature values in a time-series chart on the basis of the measured electrical parameters (potential values). Taking an S-type thermocouple as an example, the graduation table comprises temperature values of-50 to 1768, and 1819 pieces of potential data are included. The potential data are positive and negative, and the potential value of part of the thermocouples exceeds the range of-32767 to 32768, so that the indexing table storage of the thermocouples is stored in a long integral mode, and the occupied storage space is 1819 × 4-7276 bytes, which is about 7.1K storage space. However, the acquisition equipment of the thermocouple is generally a single-chip microcomputer system, and the storage space of the single-chip microcomputer system is limited, and is generally 4-64K, so that the degree distribution table needs to be compressed.
The existing compression method is to extract the feature points of each degree table, store them in the memory of MCU, and then make linear calculation through these feature points, so as to obtain the corresponding temperature value, and the extracted feature points can be more or less, and can be adjusted according to the memory space of MCU, thus achieving the purpose of data compression. The existing method for extracting the feature points can effectively compress data, but because each score is not a regular curve, errors can be introduced into the estimation and calculation of any formula, and the accuracy in querying the score is affected. To this end, chinese patent publication No. CN100498250C discloses "a method for compressing data of a thermocouple and thermal resistance graduation table stored in a memory", which includes: 1) performing first difference on the thermocouple and the thermal resistance indexing table; 2) performing a second difference on the indexing table obtained by the first difference; 3) adding the number of the grids of each row to the indexing table obtained by the second difference, carrying out binary replacement, and then carrying out hexadecimal replacement; 4) merging every two hexadecimal numbers in the obtained table into a byte; 5) the compressed table data is stored in the memory.
The compression method for storing thermocouple and thermal resistance graduation table data in the memory in the prior art is also a thermocouple potential data storage method, and compresses and stores data in a graduation table in a stepping and difference mode to obtain table data, and can restore original data of the graduation table according to the table data when inquiring the data so as to improve data inquiry and measurement accuracy. However, when the table stored by the existing potential data storage method is used for inquiring the potential value and the temperature value, the original data of the graduation table needs to be back-calculated and restored according to the table, and then the potential value and the temperature value are inquired from the restored original data (namely, the original inquiry step of the graduation table). Therefore, how to provide a thermocouple potential data storage method which can ensure the effects of data compression and recovery and effectively reduce the query calculation amount is an urgent problem to be solved so as to take account of the query accuracy and query efficiency of potential values and temperature values.
Disclosure of Invention
Aiming at the defects of the prior art, the technical problems to be solved by the invention are as follows: how to provide a thermocouple potential data storage method which can ensure the effects of data compression and recovery and can effectively reduce the query calculation amount so as to take account of the query precision and the query efficiency of potential values and temperature values.
In order to solve the technical problems, the invention adopts the following technical scheme:
the thermocouple potential data storage method comprises the following steps:
step A: dividing each temperature value in the graduation table into a plurality of temperature intervals in sequence;
and B: extracting temperature values and corresponding potential values of endpoints of all temperature intervals, and correspondingly generating a basic data table;
and C: for each temperature interval, calculating to obtain an electric potential difference value corresponding to each temperature value according to the difference value between the electric potential values corresponding to the adjacent temperature values in the temperature interval, and generating an auxiliary array corresponding to the temperature interval according to the electric potential difference value corresponding to each temperature value;
step D: extracting an auxiliary array corresponding to each temperature interval, and correspondingly generating an auxiliary data table;
step E: and respectively storing the generated basic data table and the auxiliary data table.
In the actual storage process, when storing potential data, all data in the original score table are stored by being divided into a basic data table and an auxiliary data table, and only potential difference values corresponding to various temperature values are stored in the auxiliary data table, and the potential difference values of the thermocouple are much smaller than the potential values (for example, the potential value of an S-type thermocouple can reach 32768uV at most, and the potential difference values corresponding to 10 degrees adjacent to all thermocouples can not exceed 4000uV), so that potential value data can be effectively compressed; when the potential value and the temperature value are inquired, the potential value corresponding to each temperature value can be restored in a hundred percent according to the potential value in the basic data table and the potential difference value in the auxiliary data table, and the restored potential value data can not be distorted, so that the restoration effect of the potential data can be ensured, and the inquiry accuracy of the potential value and the temperature value can be ensured.
In addition, the basic data table and the auxiliary data table obtained by the data storage method in the scheme include the following steps when inquiring the potential value and the temperature value: after the target potential value is obtained, a temperature interval where the target potential value is located is searched and determined from the basic data table, then a corresponding auxiliary array is extracted from the auxiliary data table according to the determined temperature interval, potential values corresponding to all temperature values in the temperature interval are restored according to the auxiliary array, and finally the target potential value and the potential values corresponding to all temperature values in the temperature interval are compared, so that the temperature value corresponding to the target potential value can be obtained through query. Now, taking the S-type thermocouple as an example (which includes 1819 pieces of potential data), each adjacent full ten-degree temperature value is taken as a temperature interval for explanation: 1) when the potential value and the temperature value are directly inquired by adopting the original graduation table, 1819 times of inquiry calculation (theoretically, the maximum comparison times) are needed; 2) when the table obtained by the existing storage method is used for inquiring the potential value and the temperature value, all data are required to be restored firstly, then inquiry calculation is carried out, and the maximum operation amount is that 1819 times of data restoration and 1819 times of data direct comparison or 11 times of binary search comparison is required; 3) when the potential value and the temperature value are inquired in the scheme, the first step of determining that the temperature interval is only 182 data (the inquiry calculation amount of the first step is 10 times less because the temperature value of ten degrees is rounded to establish the temperature interval), the maximum times are directly compared 183 times, the maximum times of binary search are compared 8 times, the potential value reduction of the second step needs 10 times of reduction calculation (ten temperature values in one temperature interval are to be calculated), the potential value comparison of the third step needs 10 times of direct comparison or 4 times of binary search comparison, namely, 10 times of data reduction and 12 times of inquiry calculation are needed in the worst case when the potential value and the temperature value are inquired in the scheme. Therefore, the inquiring calculation amount of the scheme when inquiring the potential value and the temperature value is far smaller than that of the existing data compression storage method and that of the original score, so that the inquiring efficiency of the potential value and the temperature value can be effectively improved.
Preferably, in the step a, the temperature interval of the score table is divided into one temperature interval every ten degrees of temperature value. For example, the temperature value of-50 ℃ to-40 ℃ is a temperature range, the temperature value of-40 ℃ to-30 ℃ is a temperature range, the temperature value of-30 ℃ to-20 ℃ is a temperature range …, and the like.
In the actual storage process, the scheme takes the adjacent temperature values of the whole ten degrees as a temperature interval, which is beneficial to dividing and classifying temperature value data and is also beneficial to calculating and storing potential values.
Preferably, in the step C, when calculating the potential difference value corresponding to the temperature value, the method includes the following steps: and taking the potential difference value corresponding to the larger temperature value of the two adjacent temperature values as a subtracted number, taking the potential difference value corresponding to the smaller temperature value of the two adjacent temperature values as a subtracted number for subtraction, and taking the calculated difference value as the potential difference value corresponding to the larger temperature value of the two adjacent temperature values.
In the actual storage process, the potential value data is increased along with the increase of the temperature value, so that the potential difference value can be a positive number by subtracting a relatively small value from a relatively large value in the potential values corresponding to two adjacent temperature values, the potential difference value can be converted into a binary system or a hexadecimal system, the subsequent calculation and storage of the auxiliary array can be conveniently carried out, and the storage requirement of the single chip microcomputer system can be met.
Preferably, in the step C, when the auxiliary array of the temperature range is generated, the method includes the following steps: firstly, determining a minimum potential difference value; then, calculating compensation difference values corresponding to the temperature values according to the minimum potential difference value and the potential difference values corresponding to the temperature values; and finally, generating an auxiliary array corresponding to the temperature interval according to the minimum potential difference value and the compensation difference value corresponding to each temperature value.
In the actual storage process, in order to further compress the memory of the potential value data, the scheme performs further stepping and difference calculation on the potential difference value, so that the potential value can be represented by two data of the minimum potential difference value and the compensation difference value (the potential value can be reduced by back calculation subsequently); taking an S-type thermocouple as an example (the compensation difference value of the S-type thermocouple does not exceed 3uV), the size of the original score in the memory is 1819 × 4-7276 bytes, and the size of the basic data table and the auxiliary data table calculated in the scheme in the memory is 183 × 2 × 4-1464 bytes, so that the compression rate of the data storage method by the scheme reaches nearly eighty percent, and the compression effect of the potential data can be improved; and the compensation difference value and the minimum potential difference value corresponding to each temperature value can reduce the potential value by one hundred percent, so that the query accuracy of the potential value and the temperature value can be ensured.
Preferably, in the step C, when calculating the compensation difference corresponding to the temperature value, the method includes the following steps: and taking the potential difference value corresponding to the temperature value as a subtracted number, taking the minimum potential difference value as a subtracted number for subtraction, and taking the calculated difference value as a compensation difference value corresponding to the temperature value.
In the actual storage process, the compensation difference value obtained by calculation in the subtraction mode can be a positive number, which is beneficial to converting the potential difference value into a binary system or a hexadecimal system so as to conveniently calculate and store the subsequent auxiliary array and meet the storage requirement of the single chip microcomputer system.
In step C, when the auxiliary array corresponding to the temperature interval is generated in step C, the minimum potential difference value in the temperature interval is correspondingly converted into the minimum potential difference value data of four-digit multiple times multiplied by eight-digit basic number in hexadecimal format. For example, if the minimum potential difference is 400uV, the value of the minimum potential difference data converted into the hexadecimal format after converting the minimum potential difference into 2 × 200 is 0x2c 8.
The applicant finds in practical research that the minimum difference value in each ten-degree temperature value of each type of thermocouple is not more than 4000, so that the minimum potential difference value is converted into the minimum potential difference value data of four-digit multiple eight-digit basic number, the method can effectively adapt to each type of thermocouple, and the storage requirement of a single chip microcomputer system can be met.
Preferably, in step C, when the auxiliary array corresponding to the temperature interval is generated, the compensation difference corresponding to each temperature value in the temperature interval is correspondingly converted into two-bit compensation difference data in binary format, the two-bit compensation difference data corresponding to each temperature value is arranged from high to low, and the two-bit compensation difference data corresponding to each arranged temperature value is converted into twenty-bit compensation difference group data in hexadecimal format. In the scheme, nine compensation difference values are left in each temperature interval except for the end point value, the two-bit compensation difference value data converted into the binary format are 18-bit numbers, at the moment, the end point temperature value and the corresponding potential value of the next temperature interval can be selected to be recorded with the temperature interval, and the corresponding compensation difference value is obtained through calculation so as to form 20-bit compensation difference value group data; or the first two bits of the compensated difference group data may be replaced with 00.
The applicant finds in practical research that the compensation difference value of each type of thermocouple does not exceed 3uV, so that the two-bit data in the binary format can effectively represent the compensation difference value, and meanwhile, the compensation difference value group data in the hexadecimal format can well meet the storage requirement of the single chip microcomputer system.
Preferably, in step C, when the auxiliary array corresponding to the temperature interval is generated, the minimum potential difference value data and the compensation difference value data in the hexadecimal format are combined into the thirty-two bit auxiliary array in the hexadecimal format. In this scheme, the auxiliary array is represented as: 0xABCDEFGH, wherein A represents a four-bit multiple, BCDEF represents twenty-bit compensation difference value group data, and GH represents an eight-bit base number.
In the actual storage process, after the minimum potential difference value data and the compensation difference value group data are combined, the association between the minimum potential difference value and the compensation difference value in the same temperature interval can be established, so that the minimum potential difference value and the compensation difference value of the auxiliary array can be quickly extracted when the potential value and the temperature value are inquired, and the inquiry efficiency of the potential value and the temperature value can be improved; and the data in the hexadecimal format can well meet the storage requirement of the single chip microcomputer system.
The invention further discloses a thermocouple potential data query method based on the above scheme, which is implemented based on the thermocouple potential data storage method, and comprises the following steps when querying a potential value and a temperature value:
the method comprises the following steps: acquiring a target potential value, and searching a temperature interval in which the target potential value is determined from a basic data table;
step two: extracting a corresponding auxiliary array from the auxiliary data table according to the determined temperature interval;
step three: sequentially restoring original potential values corresponding to all temperature values in the temperature interval according to the minimum potential difference value in the auxiliary array and the compensation difference value corresponding to all temperature values;
step four: and comparing the target potential value with the original potential values corresponding to the temperature values in the temperature interval to obtain the original potential value corresponding to the target potential value in a matching manner, and inquiring to obtain the temperature value corresponding to the target potential value.
In the actual storage process, the S-type thermocouple is taken as an example (which includes 1819 pieces of potential data), and every adjacent full ten-degree temperature value is taken as a temperature interval for explanation: 1) when the potential value and the temperature value are directly inquired by adopting the original graduation table, 1819 times of inquiry calculation (theoretically, the maximum comparison times) are needed; 2) when the table obtained by the existing storage method is used for inquiring the potential value and the temperature value, all data are required to be restored firstly, then inquiry calculation is carried out, and the maximum operation amount is that 1819 times of data restoration and 1819 times of data direct comparison or 11 times of binary search comparison is required; 3) when the potential value and the temperature value are inquired in the scheme, the first step of determining that the temperature interval is only 182 data (the inquiry calculation amount of the first step is 10 times less because the temperature value of ten degrees is rounded to establish the temperature interval), the maximum times are directly compared 183 times, the maximum times of binary search are compared 8 times, the potential value reduction of the second step needs 10 times of reduction calculation (ten temperature values in one temperature interval are to be calculated), the potential value comparison of the third step needs 10 times of direct comparison or 4 times of binary search comparison, namely, 10 times of data reduction and 12 times of inquiry calculation are needed in the worst case when the potential value and the temperature value are inquired in the scheme. Therefore, the inquiring calculation amount of the scheme when inquiring the potential value and the temperature value is far smaller than that of the existing data compression storage method and that of the original score, so that the inquiring efficiency of the potential value and the temperature value can be effectively improved.
Preferably, in the first step, the temperature range of the target potential value is searched from the basic data table by a binary search method. The worst-case comparison times for the binary search method are log2(n +1), with an expected time complexity of O (log2 n).
In the actual storage process, the potential values in the scheme are orderly discharged, so that the temperature interval where the target potential value is located can be quickly and effectively searched by adopting a binary search method, and the search efficiency of the potential value and the temperature value is favorably and auxiliarily improved.
Preferably, in the third step, the minimum potential difference value is obtained through the corresponding auxiliary array, then the minimum potential difference value is added according to the potential value corresponding to the temperature value of the end point of the temperature interval, and then the corresponding compensation difference values are sequentially added, so that the original potential value corresponding to each temperature value in the temperature area is restored.
In the actual storage process, the original potential values corresponding to the temperature values can be accurately and quickly restored by the method, so that the subsequent accurate searching for the temperature values is facilitated, and the inquiring efficiency and accuracy of the potential values and the temperature values can be improved.
Preferably, in the fourth step, if the original potential value corresponding to the target potential value is not obtained by matching, the temperature value corresponding to the target potential value is calculated by the following formula:
t=t1+n(t2-t1) Wherein t represents a temperature value corresponding to the target potential value, and t1Representing an original potential value v adjacent to and smaller than the target potential value1Corresponding temperature value, t2Representing an original potential value v adjacent to and larger than the target potential value2Corresponding temperatureA value, n, represents a target potential value at v1And v is2The ratio of (A) to (B);
wherein the target potential value is v1And v2The proportion n of (A) is calculated according to the following formula:
Figure BDA0002638414760000061
wherein v represents a target potential value, v1Representing an original potential value, v, adjacent to and smaller than the target potential value2Representing an original potential value that is adjacent to and larger than the target potential value.
Taking the target potential value of 270uV as an example, the adjacent and smaller original potential value is 267uV (corresponding to a temperature value of 45 ℃), and the adjacent and larger original potential value is 273uV (corresponding to a temperature value of 46 ℃), then it can be calculated by the following formula:
1) calculating a target potential value at t1And t is2The proportion of (A) is as follows:
Figure BDA0002638414760000062
2) calculating a temperature value corresponding to the target potential value: t is t1+n(t2-t1)=45+0.5*(46-45)=45.5℃。
In the actual storage process, if the original potential value corresponding to the target potential value is not obtained through matching, the temperature value corresponding to the target potential value is obtained through calculation by the two-point linear interpolation method, and the calculated temperature value can be associated with the target potential value, namely, the inquiry accuracy of the potential value and the temperature value can be improved.
Drawings
For purposes of promoting a better understanding of the objects, aspects and advantages of the invention, reference will now be made in detail to the present invention as illustrated in the accompanying drawings, in which:
FIG. 1 is a logic diagram of a method for storing thermocouple potential data according to a first embodiment;
FIG. 2 is a table diagram of basic data for an S-type thermocouple obtained by the potentiometric data storage method of the present invention;
FIG. 3 is a table illustrating auxiliary data for an S-type thermocouple obtained by the potentiometric data storage method of the present invention;
fig. 4 is a logic block diagram of a thermocouple potential data query method in the second embodiment.
Detailed Description
The following is further detailed by the specific embodiments:
the first embodiment is as follows:
the embodiment discloses a thermocouple potential data storage method.
As shown in fig. 1: the thermocouple potential data storage method comprises the following steps:
the thermocouple potential data storage method comprises the following steps:
step A: dividing each temperature value in the graduation table into a plurality of temperature intervals in sequence;
and B: extracting temperature values and corresponding potential values of endpoints of all temperature intervals, and correspondingly generating a basic data table;
and C: for each temperature interval, calculating to obtain an electric potential difference value corresponding to each temperature value according to the difference value between the electric potential values corresponding to the adjacent temperature values in the temperature interval, and generating an auxiliary array corresponding to the temperature interval according to the electric potential difference value corresponding to each temperature value;
step D: extracting an auxiliary array corresponding to each temperature interval, and correspondingly generating an auxiliary data table;
step E: and respectively storing the generated basic data table and the auxiliary data table.
In the actual storage process, when storing potential data, all data in the original score table are stored by being divided into a basic data table and an auxiliary data table, and only potential difference values corresponding to various temperature values are stored in the auxiliary data table, and the potential difference values of the thermocouple are much smaller than the potential values (for example, the potential value of an S-type thermocouple can reach 32768uV at most, and the potential difference values corresponding to 10 degrees adjacent to all thermocouples can not exceed 4000uV), so that potential value data can be effectively compressed; when the potential value and the temperature value are inquired, the potential value corresponding to each temperature value can be restored in a hundred percent according to the potential value in the basic data table and the potential difference value in the auxiliary data table, and the restored potential value data can not be distorted, so that the restoration effect of the potential data can be ensured, and the inquiry accuracy of the potential value and the temperature value can be ensured.
In addition, the basic data table and the auxiliary data table obtained by the data storage method in the present embodiment include the following steps when inquiring the potential value and the temperature value: after the target potential value is obtained, a temperature interval where the target potential value is located is searched and determined from the basic data table, then a corresponding auxiliary array is extracted from the auxiliary data table according to the determined temperature interval, potential values corresponding to all temperature values in the temperature interval are restored according to the auxiliary array, and finally the target potential value and the potential values corresponding to all temperature values in the temperature interval are compared, so that the temperature value corresponding to the target potential value can be obtained through query. Now, taking the S-type thermocouple as an example (which includes 1819 pieces of potential data), each adjacent full ten-degree temperature value is taken as a temperature interval for explanation: 1) when the potential value and the temperature value are directly inquired by adopting the original graduation table, 1819 times of inquiry calculation (theoretically, the maximum comparison times) are needed; 2) when the table obtained by the existing storage method is used for inquiring the potential value and the temperature value, all data are required to be restored firstly, then inquiry calculation is carried out, and the maximum operation amount is that 1819 times of data restoration and 1819 times of data direct comparison or 11 times of binary search comparison is required; 3) when the potential value and the temperature value are queried in this embodiment, the first step determines that the temperature interval is only 182 data (since a temperature interval is established by taking an integral ten-degree temperature value, the query calculation amount of the first step is 10 times smaller), the maximum number of times is directly compared 183 times, the maximum number of times of binary search is compared 8 times, 10 times of reduction calculation (ten temperature values are to be calculated in one temperature interval) are required for reducing the potential value in the second step, 10 times of direct comparison or 4 times of binary search comparison is required for comparing the potential value in the third step, that is, 10 times of data reduction +12 times of query calculation are required in the worst case when the potential value and the temperature value are queried in this embodiment. Therefore, the query calculation amount of the embodiment when querying the potential value and the temperature value is far smaller than that of the existing data compression storage method and that of the original score, so that the query efficiency of the potential value and the temperature value can be effectively improved.
In a specific implementation process, in the step a, the temperature interval of the score is divided into one temperature interval every ten degrees of temperature values. For example, the temperature value of-50 ℃ to-40 ℃ is a temperature range, the temperature value of-40 ℃ to-30 ℃ is a temperature range, the temperature value of-30 ℃ to-20 ℃ is a temperature range …, and the like.
In the actual storage process, the adjacent temperature values of the whole ten degrees are taken as a temperature interval, so that the division and the classification of the temperature value data are facilitated, and the calculation and the storage of the potential value are also facilitated.
In a specific implementation process, in the step C, when calculating the potential difference value corresponding to the temperature value, the method includes the following steps: and taking the potential difference value corresponding to the larger temperature value of the two adjacent temperature values as a subtracted number, taking the potential difference value corresponding to the smaller temperature value of the two adjacent temperature values as a subtracted number for subtraction, and taking the calculated difference value as the potential difference value corresponding to the larger temperature value of the two adjacent temperature values.
In the actual storage process, the electric potential value data is increased along with the increase of the temperature value, so that the electric potential difference value can be a positive number by subtracting a relatively small value from a relatively large value in the electric potential values corresponding to two adjacent temperature values, which is beneficial to converting the electric potential difference value into a binary system or a hexadecimal system, so that the subsequent calculation and storage of the auxiliary array can be conveniently carried out, and the storage requirement of the single chip microcomputer system can be met.
In the specific implementation process, in the step C, when the auxiliary array of the temperature interval is generated, the method includes the following steps: firstly, determining a minimum potential difference value; then, calculating compensation difference values corresponding to the temperature values according to the minimum potential difference value and the potential difference values corresponding to the temperature values; and finally, generating an auxiliary array corresponding to the temperature interval according to the minimum potential difference value and the compensation difference value corresponding to each temperature value.
In the actual storage process, in order to further compress the memory of the potential value data, the embodiment performs further stepping and difference calculation on the potential difference value, so that the potential value can be represented by two data of the minimum potential difference value and the compensation difference value (the potential value can be subsequently restored by back calculation); taking the S-type thermocouple as an example (the compensation difference value of the S-type thermocouple does not exceed 3uV), the size of the original score in the memory is 1819 × 4-7276 bytes, while the size of the basic data table and the auxiliary data table calculated in this embodiment in the memory is 183 × 2 × 4-1464 bytes, which shows that the compression rate of the data storage method according to this embodiment reaches nearly eighty percent, so that the compression effect of the potential data can be improved; and the compensation difference value and the minimum potential difference value corresponding to each temperature value can reduce the potential value by one hundred percent, so that the query accuracy of the potential value and the temperature value can be ensured.
In a specific implementation process, when calculating the compensation difference corresponding to the temperature value in step C, the method includes the following steps: and taking the potential difference value corresponding to the temperature value as a subtracted number, taking the minimum potential difference value as a subtracted number for subtraction, and taking the calculated difference value as a compensation difference value corresponding to the temperature value.
In the actual storage process, the compensation difference value obtained by calculation in the subtraction mode can be a positive number, which is beneficial to converting the potential difference value into a binary system or a hexadecimal system so as to conveniently calculate and store the subsequent auxiliary array and meet the storage requirement of the single chip microcomputer system.
In the specific implementation process, in the step C, when the auxiliary array corresponding to the temperature interval is generated, the minimum potential difference value in the temperature interval is correspondingly converted into the minimum potential difference value data of the four-digit multiple times multiplied by the eight-digit basic number in the hexadecimal format. For example, if the minimum potential difference is 400uV, the value of the minimum potential difference data converted into the hexadecimal format after converting the minimum potential difference into 2 × 200 is 0x2c 8. In this embodiment, when the minimum difference is not an even number, the minimum difference is subtracted by one, and the compensation difference is added by one.
The applicant finds in practical research that the minimum difference value in each ten-degree temperature value of each type of thermocouple is not more than 4000, so that the minimum potential difference value is converted into the minimum potential difference value data of four-digit multiple eight-digit basic number, the method can effectively adapt to each type of thermocouple, and the storage requirement of a single chip microcomputer system can be met.
In the specific implementation process, in step C, when the auxiliary array corresponding to the temperature interval is generated, the compensation difference values corresponding to the temperature values in the temperature interval are correspondingly converted into two-bit compensation difference value data in a binary format, the two-bit compensation difference value data corresponding to the temperature values are arranged from high to low, and the two-bit compensation difference value data corresponding to the arranged temperature values are converted into twenty-bit compensation difference value group data in a hexadecimal format. In the scheme, nine compensation difference values are left in each temperature interval except for the end point value, the two-bit compensation difference value data converted into the binary format are 18-bit numbers, at the moment, the end point temperature value and the corresponding potential value of the next temperature interval can be selected to be recorded with the temperature interval, and the corresponding compensation difference value is obtained through calculation so as to form 20-bit compensation difference value group data; or the first two bits of the compensated difference group data may be replaced with 00.
The applicant finds in practical research that the compensation difference value of each type of thermocouple does not exceed 3uV, so that the two-bit data in the binary format can effectively represent the compensation difference value, and meanwhile, the compensation difference value group data in the hexadecimal format can well meet the storage requirement of the single chip microcomputer system.
In the specific implementation process, in the step C, when the auxiliary array corresponding to the temperature interval is generated, the minimum potential difference value data and the compensation difference value data in the hexadecimal format are combined into the thirty-two bit auxiliary array in the hexadecimal format. In this embodiment, the auxiliary array is represented as: 0xABCDEFGH, wherein A represents a four-bit multiple, BCDEF represents twenty-bit compensation difference value group data, and GH represents an eight-bit base number.
In the actual storage process, after the minimum potential difference value data and the compensation difference value group data are combined, the association between the minimum potential difference value and the compensation difference value in the same temperature interval can be established, so that the minimum potential difference value and the compensation difference value of the auxiliary array can be quickly extracted when the potential value and the temperature value are inquired, and the inquiry efficiency of the potential value and the temperature value can be improved; and the data in the hexadecimal format can well meet the storage requirement of the single chip microcomputer system.
In addition, in this embodiment, the following description is made by taking an S-type thermocouple as an example:
the corresponding potential values of the S-type thermocouple at 40-50 ℃ are as follows:
Figure BDA0002638414760000091
in this embodiment, the end point value of the next temperature interval (50 ℃ -59 ℃) is recorded in the temperature interval of 40 ℃ -49 ℃, which is convenient for calculating the temperature value between 49 ℃ and 50 ℃.
1) When the basic data table is established, the endpoint 40 ℃ of the temperature range of 40-49 ℃ and the corresponding potential value 235uV are extracted to be generated into the basic data table.
2) When the auxiliary data table is established:
1. calculating to obtain the potential difference value corresponding to each temperature value, and obtaining the following table:
Figure BDA0002638414760000092
2. determining +6 as the minimum potential difference value, and calculating the compensation difference value corresponding to each temperature value, wherein the compensation difference value is as follows:
Figure BDA0002638414760000101
3. the minimum potential difference value data converted into the hexadecimal format is 0x 006; and correspondingly converting the compensation difference value into two-bit compensation difference value data in a binary format, and arranging the two-bit compensation difference value data corresponding to each temperature value from high to low as: 01000001000100000100, the compensation difference value group data converted into hexadecimal format is 0x41104, and finally the potential difference value data and the compensation difference value group data are combined to obtain the auxiliary array of 0x 04110406.
3) And sequentially calculating the auxiliary arrays of all the temperature intervals according to the calculation steps so as to establish an auxiliary data table of the S-type thermocouple. And the basic data table and the supplementary data table for establishing the completed S-type thermocouple are shown in fig. 2 and 3.
Example two:
the embodiment discloses a thermocouple potential data query method on the basis of the first embodiment.
As shown in fig. 4: the thermocouple potential data query method is implemented based on the thermocouple potential data storage method in the first embodiment, and when querying the potential value and the temperature value, the method comprises the following steps of:
the method comprises the following steps: acquiring a target potential value, and searching a temperature interval in which the target potential value is determined from a basic data table;
step two: extracting a corresponding auxiliary array from the auxiliary data table according to the determined temperature interval;
step three: sequentially restoring original potential values corresponding to all temperature values in the temperature interval according to the minimum potential difference value in the auxiliary array and the compensation difference value corresponding to all temperature values;
step four: and comparing the target potential value with the original potential values corresponding to the temperature values in the temperature interval to obtain the original potential value corresponding to the target potential value in a matching manner, and inquiring to obtain the temperature value corresponding to the target potential value.
In the actual storage process, the S-type thermocouple is taken as an example (which includes 1819 pieces of potential data), and every adjacent full ten-degree temperature value is taken as a temperature interval for explanation: 1) when the potential value and the temperature value are directly inquired by adopting the original graduation table, 1819 times of inquiry calculation (theoretically, the maximum comparison times) are needed; 2) when the table obtained by the existing storage method is used for inquiring the potential value and the temperature value, all data are required to be restored firstly, then inquiry calculation is carried out, and the maximum operation amount is that 1819 times of data restoration and 1819 times of data direct comparison or 11 times of binary search comparison is required; 3) when the potential value and the temperature value are queried in this embodiment, the first step determines that the temperature interval is only 182 data (since a temperature interval is established by taking an integral ten-degree temperature value, the query calculation amount of the first step is 10 times smaller), the maximum number of times is directly compared 183 times, the maximum number of times of binary search is compared 8 times, 10 times of reduction calculation (ten temperature values are to be calculated in one temperature interval) are required for reducing the potential value in the second step, 10 times of direct comparison or 4 times of binary search comparison is required for comparing the potential value in the third step, that is, 10 times of data reduction +12 times of query calculation are required in the worst case when the potential value and the temperature value are queried in this embodiment. Therefore, the query calculation amount of the embodiment when querying the potential value and the temperature value is far smaller than that of the existing data compression storage method and that of the original score, so that the query efficiency of the potential value and the temperature value can be effectively improved.
In the specific implementation process, in the step one, the temperature interval of the target potential value is searched from the basic data table through a binary search method. In this embodiment, the worst-case comparison times of the binary search method are log2(n +1), and the expected time complexity is O (log2 n).
In the actual storage process, the potential values in the embodiment are orderly discharged, so that the temperature interval where the target potential value is located can be quickly and effectively searched by adopting a binary search method, and the search efficiency of the potential value and the temperature value is favorably improved in an auxiliary manner.
In the third step, the minimum potential difference value is obtained through the corresponding auxiliary array, then the minimum potential difference value is added according to the potential value corresponding to the temperature value of the end point of the temperature interval, and then the corresponding compensation difference values are sequentially added, so that the original potential value corresponding to each temperature value in the temperature area is restored.
In the actual storage process, the original potential values corresponding to the temperature values can be accurately and quickly restored by the method, so that the subsequent accurate searching for the temperature values is facilitated, and the inquiring efficiency and accuracy of the potential values and the temperature values can be improved.
In the specific implementation process, in the fourth step, if the original potential value corresponding to the target potential value is not obtained through matching, the temperature value corresponding to the target potential value is calculated through the following formula:
t=t1+n(t2-t1) Wherein t represents a target powerTemperature value, t, corresponding to potential value1Representing an original potential value v adjacent to and smaller than the target potential value1Corresponding temperature value, t2Representing an original potential value v adjacent to and larger than the target potential value2Corresponding temperature value, n represents the target potential value at v1And v2The ratio of (1) to (2);
wherein the target potential value is v1And v2The proportion n of (A) is calculated according to the following formula:
Figure BDA0002638414760000111
wherein v represents a target potential value, v1Representing an original potential value, v, adjacent to and smaller than the target potential value2Representing an original potential value that is adjacent to and larger than the target potential value.
Taking the target potential value as 270uV as an example, the adjacent and smaller original potential value is 267uV (corresponding to a temperature value of 45 ℃), and the adjacent and larger original potential value is 273uV (corresponding to a temperature value of 46 ℃), then it can be calculated by the following formula:
1) calculating a target potential value at t1And t is2The proportion of (A) is as follows:
Figure BDA0002638414760000112
2) calculating a temperature value corresponding to the target potential value: t is t1+n(t2-t1)=45+0.5*(46-45)=45.5℃。
In the actual storage process, if the original potential value corresponding to the target potential value is not obtained through matching, the temperature value corresponding to the target potential value is obtained through calculation by the two-point linear interpolation method, and the calculated temperature value can be associated with the target potential value, namely, the inquiry accuracy of the potential value and the temperature value can be improved.
The foregoing is merely an example of the present invention, and common general knowledge in the field of known specific structures and characteristics is not described herein in any greater extent than that known in the art at the filing date or prior to the priority date of the application, so that those skilled in the art can now appreciate that all of the above-described techniques in this field and have the ability to apply routine experimentation before this date can be combined with one or more of the present teachings to complete and implement the present invention, and that certain typical known structures or known methods do not pose any impediments to the implementation of the present invention by those skilled in the art. It should be noted that, for those skilled in the art, without departing from the structure of the present invention, several changes and modifications can be made, which should also be regarded as the protection scope of the present invention, and these will not affect the effect of the implementation of the present invention and the practicability of the patent. The scope of the claims of the present application shall be determined by the contents of the claims, and the description of the embodiments and the like in the specification shall be used to explain the contents of the claims.

Claims (10)

1. The thermocouple potential data storage method is characterized by comprising the following steps:
step A: dividing each temperature value in the graduation table into a plurality of temperature intervals in sequence;
and B: extracting temperature values and corresponding potential values of endpoints of all temperature intervals, and correspondingly generating a basic data table;
and C: for each temperature interval, calculating to obtain an electric potential difference value corresponding to each temperature value according to the difference value between the electric potential values corresponding to the adjacent temperature values in the temperature interval, and generating an auxiliary array corresponding to the temperature interval according to the electric potential difference value corresponding to each temperature value;
step D: extracting an auxiliary array corresponding to each temperature interval, and correspondingly generating an auxiliary data table;
step E: and respectively storing the generated basic data table and the auxiliary data table.
2. The thermocouple potential data storage method of claim 1, wherein: in the step A, the temperature interval of the score table is divided into one temperature interval by every ten-degree temperature value.
3. The thermocouple potential data storage method of claim 1, wherein: in the step C, when calculating the potential difference value corresponding to the temperature value, the method includes the following steps: and taking the potential difference value corresponding to the larger temperature value of the two adjacent temperature values as a subtracted number, taking the potential difference value corresponding to the smaller temperature value of the two adjacent temperature values as a subtracted number for subtraction, and taking the calculated difference value as the potential difference value corresponding to the larger temperature value of the two adjacent temperature values.
4. The thermocouple potential data storage method of claim 1, wherein: in step C, when generating the auxiliary array of the temperature interval, the method includes the following steps: firstly, determining a minimum potential difference value; then, calculating compensation difference values corresponding to the temperature values according to the minimum potential difference value and the potential difference values corresponding to the temperature values; and finally, generating an auxiliary array corresponding to the temperature interval according to the minimum potential difference value and the compensation difference value corresponding to each temperature value.
5. The thermocouple potential data storage method of claim 4, wherein: in step C, when calculating the compensation difference corresponding to the temperature value, the method includes the following steps: and taking the potential difference value corresponding to the temperature value as a subtracted number, taking the minimum potential difference value as a subtracted number for subtraction, and taking the calculated difference value as a compensation difference value corresponding to the temperature value.
6. The thermocouple potential data storage method of claim 4, wherein: and step C, when the auxiliary array corresponding to the temperature interval is generated, correspondingly converting the minimum potential difference value in the temperature interval into minimum potential difference value data of four-digit multiple times multiplied by eight-digit basic number in a hexadecimal format.
7. A thermocouple potential data storage method according to claim 6 wherein: in step C, when the auxiliary array corresponding to the temperature interval is generated, the compensation difference values corresponding to the temperature values in the temperature interval are correspondingly converted into two-bit compensation difference value data in a binary format, the two-bit compensation difference value data corresponding to the temperature values are arranged from high to low, and the two-bit compensation difference value data corresponding to the arranged temperature values are converted into twenty-bit compensation difference value group data in a hexadecimal format.
8. A thermocouple potential data storage method according to claim 7 wherein: and step C, when the auxiliary array corresponding to the temperature interval is generated, combining the minimum potential difference value data and the compensation difference value data in the hexadecimal format into a thirty-two-bit auxiliary array in the hexadecimal format.
9. Thermocouple potential data query method, characterized in that, implemented based on the thermocouple potential data storage method of claim 4, in querying the potential values and temperature values, it comprises the following steps:
the method comprises the following steps: acquiring a target potential value, and searching a temperature interval in which the target potential value is determined from a basic data table;
step two: extracting a corresponding auxiliary array from the auxiliary data table according to the determined temperature interval;
step three: sequentially restoring original potential values corresponding to all temperature values in the temperature interval according to the minimum potential difference value in the auxiliary array and the compensation difference value corresponding to all temperature values;
step four: and comparing the target potential value with the original potential values corresponding to the temperature values in the temperature interval to obtain the original potential value corresponding to the target potential value in a matching manner, and inquiring to obtain the temperature value corresponding to the target potential value.
10. The thermocouple potential data query method of claim 9, wherein: in the first step, a temperature interval of a target potential value is searched from a basic data table through a binary search method;
in the third step, the minimum potential difference value is obtained through the corresponding auxiliary array, then the minimum potential difference value is added according to the potential value corresponding to the temperature value of the end point of the temperature interval, and then the corresponding compensation difference value is sequentially added, so that the original potential value corresponding to each temperature value in the temperature area is restored;
in the fourth step, if the original potential value corresponding to the target potential value is not obtained through matching, the temperature value corresponding to the target potential value is calculated through the following formula:
t=t1+n(t2-t1) Wherein t represents a temperature value corresponding to the target potential value, and t1Representing an original potential value v adjacent to and smaller than the target potential value1Corresponding temperature value, t2Representing an original potential value v adjacent to and larger than the target potential value2Corresponding temperature value, n represents the target potential value at v1And v2The ratio of (1) to (2);
wherein the target potential value is v1And v2The proportion n of (A) is calculated according to the following formula:
Figure FDA0002638414750000021
wherein v represents a target potential value, v1Representing an original potential value, v, adjacent to and smaller than the target potential value2Representing an original potential value that is adjacent to and larger than the target potential value.
CN202010832260.0A 2020-08-18 2020-08-18 Thermocouple potential data storage method and query method Pending CN111930749A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010832260.0A CN111930749A (en) 2020-08-18 2020-08-18 Thermocouple potential data storage method and query method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010832260.0A CN111930749A (en) 2020-08-18 2020-08-18 Thermocouple potential data storage method and query method

Publications (1)

Publication Number Publication Date
CN111930749A true CN111930749A (en) 2020-11-13

Family

ID=73305429

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010832260.0A Pending CN111930749A (en) 2020-08-18 2020-08-18 Thermocouple potential data storage method and query method

Country Status (1)

Country Link
CN (1) CN111930749A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010044703A1 (en) * 2000-03-29 2001-11-22 Kiwamu Yoda Calculation device and method therefor
CN107655940A (en) * 2017-09-18 2018-02-02 国网重庆市电力公司电力科学研究院 A kind of Transformer Winding wood properly test equipment and system
CN108808621A (en) * 2017-05-05 2018-11-13 韦伯-斯蒂芬产品有限公司 Wireless control and status monitoring for the electric oven with current protecting circuit
CN108917964A (en) * 2018-05-31 2018-11-30 北京广利核系统工程有限公司 A kind of thermocouple and temperature conversion method based on FPGA

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010044703A1 (en) * 2000-03-29 2001-11-22 Kiwamu Yoda Calculation device and method therefor
CN108808621A (en) * 2017-05-05 2018-11-13 韦伯-斯蒂芬产品有限公司 Wireless control and status monitoring for the electric oven with current protecting circuit
CN107655940A (en) * 2017-09-18 2018-02-02 国网重庆市电力公司电力科学研究院 A kind of Transformer Winding wood properly test equipment and system
CN108917964A (en) * 2018-05-31 2018-11-30 北京广利核系统工程有限公司 A kind of thermocouple and temperature conversion method based on FPGA

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
方建淳: "微机应用中热电偶线性化的最佳方法", 《自动化与仪表》 *

Similar Documents

Publication Publication Date Title
CA3165340A1 (en) Method and apparatus for storing and querying time series data, and server and storage medium thereof
US8032534B2 (en) Method and system for indexing and searching high-dimensional data using signature file
CN112953550B (en) Data compression method, electronic device and storage medium
WO2017071431A1 (en) Encoding method and device
CN105224828B (en) A kind of gene order fragment is quickly positioned with key assignments index data compression method
CN103488727B (en) Two-dimensional time-series data storage and query method based on periodic logs
CN108304409B (en) Carry-based data frequency estimation method of Sketch data structure
CN111416880A (en) IP address addressing method and device, computer storage medium and electronic equipment
CN104618361A (en) Network stream data reordering method
CN104008119A (en) One-to-many mixed string comparison method
CN110019205B (en) Data storage and restoration method and device and computer equipment
CN111930749A (en) Thermocouple potential data storage method and query method
US8909897B2 (en) Method for generating a delta for compressed data
CN102546293B (en) High speed network flow network address measuring method based on Hash bit string multiplexing
Arram et al. FPGA acceleration of reference-based compression for genomic data
CN111063394B (en) Method, system and medium for quickly searching and constructing library of species based on gene sequence
CN105447135A (en) Data search method and device
CN113078908A (en) Simple encoding and decoding method suitable for time sequence database
CN105302833A (en) Content based video retrieval mathematic model establishment method
CN112434085A (en) Roaring Bitmap-based user data statistical method
US20060155479A1 (en) Efficiently calculating scores for chains of sequence alignments
US20120245852A1 (en) Apparatus for calculating scores for chains of sequence alignments
CN114818925A (en) Method and system for filling missing value of output data of wind power plant
Ljubovic et al. Comparative study of color histograms as global feature for image retrieval
CN109840245B (en) Data query engine based on fragment storage and half-folded index

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20201113

RJ01 Rejection of invention patent application after publication