CN114993501A - NTC temperature sensor calibration method based on edge calculation - Google Patents
NTC temperature sensor calibration method based on edge calculation Download PDFInfo
- Publication number
- CN114993501A CN114993501A CN202210619485.7A CN202210619485A CN114993501A CN 114993501 A CN114993501 A CN 114993501A CN 202210619485 A CN202210619485 A CN 202210619485A CN 114993501 A CN114993501 A CN 114993501A
- Authority
- CN
- China
- Prior art keywords
- calibration
- temperature
- temperature sensor
- data
- time cost
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01K—MEASURING TEMPERATURE; MEASURING QUANTITY OF HEAT; THERMALLY-SENSITIVE ELEMENTS NOT OTHERWISE PROVIDED FOR
- G01K7/00—Measuring temperature based on the use of electric or magnetic elements directly sensitive to heat ; Power supply therefor, e.g. using thermoelectric elements
- G01K7/16—Measuring temperature based on the use of electric or magnetic elements directly sensitive to heat ; Power supply therefor, e.g. using thermoelectric elements using resistive elements
- G01K7/22—Measuring temperature based on the use of electric or magnetic elements directly sensitive to heat ; Power supply therefor, e.g. using thermoelectric elements using resistive elements the element being a non-linear resistance, e.g. thermistor
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01K—MEASURING TEMPERATURE; MEASURING QUANTITY OF HEAT; THERMALLY-SENSITIVE ELEMENTS NOT OTHERWISE PROVIDED FOR
- G01K15/00—Testing or calibrating of thermometers
- G01K15/005—Calibration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/11—Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/12—Computing arrangements based on biological models using genetic models
- G06N3/126—Evolutionary algorithms, e.g. genetic algorithms or genetic programming
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biophysics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Computational Mathematics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Software Systems (AREA)
- Evolutionary Biology (AREA)
- General Engineering & Computer Science (AREA)
- Biomedical Technology (AREA)
- Nonlinear Science (AREA)
- General Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- Physiology (AREA)
- Computational Linguistics (AREA)
- Operations Research (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- Artificial Intelligence (AREA)
- Algebra (AREA)
- Databases & Information Systems (AREA)
- Genetics & Genomics (AREA)
- Arrangements For Transmission Of Measured Signals (AREA)
Abstract
Description
技术领域technical field
本发明涉及温度校准与测量技术领域,尤其涉及一种利用边缘计算技术对NTC温度传感器进行校准的方法。The invention relates to the technical field of temperature calibration and measurement, in particular to a method for calibrating an NTC temperature sensor using edge computing technology.
背景技术Background technique
传统的温度校准方式即实验室校准,是客户将自己的待校温度计周期性的运送到上级计量校准机构,校准专业人员在环境可控的校准实验室中将其与高等级的标准铂电阻进行测量比对,校准后的温度计再运送回相关客户单位,同时签署校准证书并发送到相关客户单位。这种传统方式具有校准周期长、不确定度高、管理难度大、效率低等缺点,最终会对现代化工业的正常生产进度造成一定的影响。The traditional method of temperature calibration is laboratory calibration, in which the customer periodically transports his thermometer to be calibrated to the higher-level measurement and calibration institution, and the calibration professional performs the calibration with the high-grade standard platinum resistance in the environment-controlled calibration laboratory. After measurement and comparison, the calibrated thermometer is shipped back to the relevant customer unit, and the calibration certificate is signed and sent to the relevant customer unit. This traditional method has shortcomings such as long calibration period, high uncertainty, difficult management, and low efficiency, which will eventually have a certain impact on the normal production progress of modern industries.
针对上述问题,本发明采用边缘计算技术,在设备的边缘端完成与标准器的数据拟合并建立误差补偿模型,在软件层面减少温度传感器测温时的误差。In view of the above problems, the present invention adopts edge computing technology to complete the data fitting with the standard device at the edge of the device and establish an error compensation model, thereby reducing the temperature measurement error of the temperature sensor at the software level.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于针对传统温度传感器校准方式校准周期长、管理难度大、效率低等缺点,提出一种基于边缘计算的NTC温度传感器校准方法。The purpose of the present invention is to propose an edge computing-based NTC temperature sensor calibration method for the shortcomings of the traditional temperature sensor calibration method, such as long calibration period, difficult management, and low efficiency.
本发明的目的是通过以下技术方案来实现的:一种基于边缘计算的NTC温度传感器校准方法,该方法包括如下步骤:步骤1:在校准现场部署边缘计算网络;The object of the present invention is achieved through the following technical solutions: a method for calibrating an NTC temperature sensor based on edge computing, the method comprises the following steps: Step 1: deploying an edge computing network at the calibration site;
步骤2:在校准流程开始后,设备端将待校准的NTC温度传感器与标准器的包含检测指标的温度数据通过TCP/IP协议发送至边缘节点;Step 2: After the calibration process starts, the device sends the temperature data including the detection index of the NTC temperature sensor to be calibrated and the standard device to the edge node through the TCP/IP protocol;
步骤3:边缘节点解析接收的数据Step 3: The edge node parses the received data
步骤4:在边缘节点通过遗传算法来选择校准的最佳特征点;Step 4: Select the best feature point for calibration by genetic algorithm at the edge node;
步骤5:根据步骤4得到的特征点并进行拟合分析,在特征点处将待校准的NTC温度传感器与标准器进行标定,通过标定数据来准确计算温度传感器特征点的测量温度;Step 5: According to the feature points obtained in step 4 and carry out fitting analysis, the NTC temperature sensor to be calibrated and the standard device are calibrated at the feature points, and the measured temperature of the feature points of the temperature sensor is accurately calculated by the calibration data;
步骤6:边缘节点利用MQTT协议将校准数据及校准结果北向发送至云端实现校准记录的云存储,同时利用TCP/IP协议将特征函数南向发送至设备端完成校准。Step 6: The edge node uses the MQTT protocol to send the calibration data and calibration results north to the cloud to realize cloud storage of calibration records, and uses the TCP/IP protocol to send the feature function south to the device to complete the calibration.
进一步地,所述步骤2中包含的检测指标具体为电阻、温度、时间戳、设备编号和环境温度。Further, the detection indicators included in the step 2 are specifically resistance, temperature, time stamp, device number and ambient temperature.
进一步地,所述步骤4中为了减少校准所花费的时间成本,采用遗传算法选择最优特征点进行标定,获得最优特征点的具体步骤如下:Further, in the step 4, in order to reduce the time cost of calibration, the genetic algorithm is used to select the optimal feature point for calibration, and the specific steps for obtaining the optimal feature point are as follows:
(4.1)基因的建立与特征点的选取:将设备端发送的每一个温度数据抽象为基因,定义xq表示第q个测试点是否为特征点,当xq=1时表示第q号测试点被入选为特征值点,反之当xq=0时表示第q号测试点不入选为特征值点;(4.1) Gene establishment and feature point selection: abstract each temperature data sent by the device as a gene, define x q to indicate whether the q-th test point is a feature point, and when x q = 1, it means the q-th test The point is selected as the eigenvalue point, otherwise when x q = 0, it means that the qth test point is not selected as the eigenvalue point;
(4.2)适应度函数的定义:基于给定的优化目标,利用适应度函数来测量种群中染色体的质量;由于决策的目标是降低总时间成本,选择适应度函数为度量染色体的总时间成本Ctotal的平方倒数, (4.2) Definition of fitness function: Based on the given optimization objective, the fitness function is used to measure the quality of chromosomes in the population; since the goal of decision-making is to reduce the total time cost, the fitness function is selected to measure the total time cost of chromosomes C Reciprocal square of total ,
(4.2.1)单次测量时间成本:测量一个温度值所需要的时间成本,记为Cq;(4.2.1) Time cost of single measurement: the time cost required to measure a temperature value, denoted as C q ;
(4.2.2)标定误差时间成本:(4.2.2) Time cost of calibration error:
符号cj单点误差对应的时间成本值。其中i表示传感器编号,j表示测试点,Ti,表示实际温度值,表示传感器读数;The time cost value corresponding to the single point error of the symbol c j . where i represents the sensor number, j represents the test point, T i represents the actual temperature value, Indicates the sensor reading;
单个样本本体的标定误差时间成本用计算;The time cost of calibration error for a single sample ontology is calculate;
(4.2.3)样本个体标定时间成本:样本个体的标定时间成本Ci是单体测定时间成本与误差标定时间成本之和;(4.2.3) Calibration time cost of individual sample: the calibration time cost C i of individual sample is the sum of the time cost of individual measurement and the time cost of error calibration;
Ci=Cs+Cq·ni C i =C s +C q · ni
ni表示对该样本个体标定过程中的测定点数目;n i represents the number of measurement points in the calibration process of the sample individual;
(4.2.4)总成本:总成本Ctotal为所有个体的标定时间成本的平均值,M为样本总数;(4.2.4) Total cost: the total cost C total is the average value of the calibration time cost of all individuals, and M is the total number of samples;
(4.3)交叉运算:使用模拟的二元交叉,从亲本p1和p2中计算后代c1和c2;通过在[0,1)中选择一个随机数u,计算后代的参数后代可以表示为 (4.3) Crossover operation: Calculate the offspring c1 and c2 from the parents p1 and p2 using a simulated binary crossover; calculate the parameters of the offspring by selecting a random number u in [0,1) The descendants can be expressed as
(4.4)变异运算:为模拟遗传过程,如果一个个体要发生变异,那么该个体的每个特征都要乘以一个范围内的随机数[1-mrgnge,1+mrange],mrange作为一个乘法因子根据每个特征独立计算,根据收敛的程度,mrange∈[0.01,0.3,通过轮盘选择法从当前种群中选择出10%的优秀个体进入下一代的迭代中去,使优秀个体能够最大限度保留下来;(4.4) Mutation operation: In order to simulate the genetic process, if an individual is to mutate, each characteristic of the individual must be multiplied by a random number within a range [1-m rgnge , 1+m range ], and m range is used as the A multiplicative factor is independently calculated according to each feature. According to the degree of convergence, m range ∈ [0.01, 0.3, 10% of the outstanding individuals are selected from the current population by the roulette selection method and enter the next iteration to make the outstanding individuals can be preserved as much as possible;
(4.5)终止条件:超出以下范围,遗传迭代终止:(4.5) Termination condition: beyond the following range, the genetic iteration terminates:
σ2(ri)为第i个温度特征点ri方差,σ2(Wi)为第i个特征点组合Wi的方差,cov(ri-rj)为特征点i,j协方差,为最小输入温度,为最大输入温度。σ 2 (ri ) is the variance of the i -th temperature feature point ri, σ 2 (W i ) is the variance of the i - th feature point combination Wi, cov(ri -r j ) is the feature point i, j coordinator variance, is the minimum input temperature, is the maximum input temperature.
进一步地,所述步骤5中,选择Steinhart-Hart算法的三阶多项式拟合公式对温度数据进行拟合分析,具体如下:Further, in the step 5, the third-order polynomial fitting formula of the Steinhart-Hart algorithm is selected to perform fitting analysis on the temperature data, as follows:
选取对NTC热敏电阻的RT表数据进行曲线拟合的三阶多项式拟合公式: 其中T为开式温标,单位为K,R为电阻,单位为KΩ,A,B,C为常数系数;通过分析误差平方和即有:Select the third-order polynomial fitting formula for curve fitting of the RT table data of the NTC thermistor: Where T is the open temperature scale, the unit is K, R is the resistance, the unit is KΩ, A, B, C are constant coefficients; by analyzing the sum of squares of errors That is:
式中,Ri为第i个电阻,Ti为Ri匹配的温度值;常量使用ai,替代并带入多项式拟合公式,获得常数矩阵:In the formula, R i is the ith resistance, and T i is the temperature value matched by R i ; the constant is replaced by a i, and brought into the polynomial fitting formula to obtain the constant matrix:
可知拟合公式的常数系数:The constant coefficients of the fitting formula can be known:
A=(a23^2*b1-a12*a23*b3+a13*a22*b3-a13*a23*b2+a12*a33*b2-a22*a33*b1)/(a33*a12^2-2*a12*a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)A=(a23^2*b1-a12*a23*b3+a13*a22*b3-a13*a23*b2+a12*a33*b2-a22*a33*b1)/(a33*a12^2-2*a12 *a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)
B=(a13^2*b2-a12*a13*b3+a11*a23*b3-a13*a23*b1-a11*a33*b2+a12*a33*b1)/(a33*a12^2-2*a12*a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)B=(a13^2*b2-a12*a13*b3+a11*a23*b3-a13*a23*b1-a11*a33*b2+a12*a33*b1)/(a33*a12^2-2*a12 *a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)
C=(a12^2*b3-a12*a13*b2-a11*a22*b3+a11*a23*b2-a12*a23*b1+a13*a22*b1)/(a33*a12^2-2*a12*a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)C=(a12^2*b3-a12*a13*b2-a11*a22*b3+a11*a23*b2-a12*a23*b1+a13*a22*b1)/(a33*a12^2-2*a12 *a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)
从而计算得出在某一阻值下的温度标准值。Thereby, the temperature standard value under a certain resistance value is calculated.
进一步地,所述步骤5中边缘网关基于曲线拟合的三阶多项式拟合公式计算特征点的温度并进行二次校验,将通过二次校验的校准结果发送至云端服务器以及将校准后的曲线拟合的三阶多项式拟合公式发送至设备端,将未通过二次校验的结果进行本地记录同时报上云端。Further, in the step 5, the edge gateway calculates the temperature of the feature point based on the third-order polynomial fitting formula of curve fitting and performs secondary verification, sends the calibration result that has passed the secondary verification to the cloud server, and sends the calibration result after the calibration. The third-order polynomial fitting formula of the curve fitting is sent to the device, and the results that fail the secondary verification are recorded locally and reported to the cloud at the same time.
进一步地,边缘网关二次校验需要同时满足如下两个规则,具体为:Further, the secondary verification of the edge gateway needs to satisfy the following two rules at the same time, specifically:
规则1:复查温度校准过程边缘网关接收设备端上报的历史数据是否在检测指标的既定范围内,如果数据值不在既定范围内,则视为校验不通过;Rule 1: During the temperature calibration process, check whether the historical data reported by the edge gateway receiving device is within the predetermined range of the detection index. If the data value is not within the predetermined range, the verification is deemed to have failed;
规则2:利用曲线拟合的三阶多项式拟合公式计算残差及标准差,如果残差及标准差超过云端服务器设定的区间范围,则视为校验不通过。Rule 2: Use the third-order polynomial fitting formula of curve fitting to calculate residuals and standard deviations. If the residuals and standard deviations exceed the interval range set by the cloud server, the verification will be regarded as failing.
本发明的有益效果:Beneficial effects of the present invention:
本申请的一种基于边缘计算的NTC温度传感器校准方法,相比于传统校准方式,可以大大缩短校准所需要的周期。Compared with the traditional calibration method, a method for calibrating an NTC temperature sensor based on edge computing of the present application can greatly shorten the period required for calibration.
本申请的一种基于边缘计算的NTC温度传感器校准方法,校准的主要流程全部在边缘端进行,设备端不需要将所有的参数发送至云端,有效节省了云服务器的带宽消耗,减少云端的计算压力。A method for calibrating an NTC temperature sensor based on edge computing of the present application, the main process of calibration is all performed on the edge, and the device does not need to send all parameters to the cloud, which effectively saves the bandwidth consumption of the cloud server and reduces cloud computing. pressure.
本申请的一种基于边缘计算的NTC温度传感器校准方法,能够有效提高NTC温度传感器的精度和准确率。A method for calibrating an NTC temperature sensor based on edge computing of the present application can effectively improve the precision and accuracy of the NTC temperature sensor.
附图说明Description of drawings
图1为本发明的方法流程图。FIG. 1 is a flow chart of the method of the present invention.
具体实施方式Detailed ways
以下结合附图对本发明具体实施方式作进一步详细说明。The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
在如图1所示,本申请提出了一种基于边缘计算的NTC温度传感器校准方法,首先,边缘节点通过TCP/IP协议获取设备端NTC温度传感器的实时数据,基于遗传算法选择最优特征点进行标定,同时于特征点进行基于Steinhart-Hart算法的温度数据拟合分析,其次,将校准后的温度模型通过TCP/IP协议更新至设备端,同时将校准结果发送至云服务器,实现边缘网关的南北向通信,完成在边缘端的温度传感器的校准。具体步骤如下:As shown in Figure 1, this application proposes an edge computing-based NTC temperature sensor calibration method. First, the edge node obtains the real-time data of the device-side NTC temperature sensor through the TCP/IP protocol, and selects the optimal feature point based on the genetic algorithm. Calibration is performed, and temperature data fitting analysis based on the Steinhart-Hart algorithm is performed at the feature points. Secondly, the calibrated temperature model is updated to the device through the TCP/IP protocol, and the calibration results are sent to the cloud server to realize the edge gateway. The north-south communication completes the calibration of the temperature sensor at the edge. Specific steps are as follows:
步骤1、在需要进行设备校准的校准现场部署一个边缘计算网络。Step 1. Deploy an edge computing network at the calibration site where equipment calibration is required.
具体来说,边缘计算网络由边缘计算节点与设备节点构成。边缘节点的部署利用容器技术,在不同类型的设备中,搭建无差别的边缘计算节点,边缘节点的载体可以是Windows、MacOS或Linux设备等具有一定计算能力的设备。每个温度传感器为一个具有无线通讯能力的设备节点,通过特定的通信协议与边缘节点一同构成边缘计算网络。Specifically, an edge computing network consists of edge computing nodes and device nodes. The deployment of edge nodes uses container technology to build indiscriminate edge computing nodes in different types of devices. The carrier of edge nodes can be devices with certain computing capabilities such as Windows, MacOS, or Linux devices. Each temperature sensor is a device node with wireless communication capability, and forms an edge computing network together with edge nodes through a specific communication protocol.
所述边缘计算节点的数量根据实际需求可以选择一个或多个。One or more of the edge computing nodes can be selected according to actual requirements.
具体来说,假设待校设备数量大且时间紧迫性大,因此如果单个的边缘计算节点存在计算压力时,可以动态增加边缘计算节点的数量,进行多边缘计算节点的并行运算,提高校准效率。Specifically, it is assumed that the number of devices to be calibrated is large and the time is urgent. Therefore, if a single edge computing node is under computational pressure, the number of edge computing nodes can be dynamically increased to perform parallel operations on multiple edge computing nodes to improve calibration efficiency.
步骤2、所述设备端包括一个或多个标准器和多个待校准设备,所述待校准设备为待校准的NTC温度传感器,设备端可以对校准时的需要上报至边缘节点的包含检测指标的温度数据进行采集,每个所述的设备端将采集到的包含检测指标的温度数据按照既定的时间间隔发送至所述边缘计算节点。Step 2, the device end includes one or more standards and a plurality of devices to be calibrated, the device to be calibrated is the NTC temperature sensor to be calibrated, and the device end can report to the edge node the inclusion detection indicators that need to be calibrated. The temperature data collected is collected, and each device terminal sends the collected temperature data including detection indicators to the edge computing node at a predetermined time interval.
举例来说,设备端通过TCP/IP协议将采集到的温度、电阻值、时间戳、设备编号和环境温度发送至边缘节点,其中设备编号和环境温度只需在校准过程开始前发送一次即可,温度、电阻值、时间戳按照5秒一次的频率上传至边缘节点。For example, the device sends the collected temperature, resistance value, timestamp, device ID, and ambient temperature to the edge node through the TCP/IP protocol, where the device ID and ambient temperature only need to be sent once before the calibration process starts. , the temperature, resistance value, and timestamp are uploaded to the edge node at a frequency of every 5 seconds.
步骤3、边缘节点解析上报的json格式数据并暂存至本地redis数据库,存储一周后清楚本地数据库数据,释放边缘节点的存储空间,并且方便短期的追溯。具体来说,数据库中的设备以设备编号作为主键,用来区分不同设备上报的温度、电阻等数据。设备以是否完成校准作为状态位,当设备完成校准后,数据库自动删除该设备编号下的数据以保证数据库清洁度;未完成校准的设备端数据在数据库中保留24小时,超出时间限制后数据库自动清理数据。Step 3. The edge node parses the reported json format data and temporarily stores it in the local redis database. After a week of storage, the local database data is clear, freeing the storage space of the edge node and facilitating short-term traceability. Specifically, the devices in the database use the device number as the primary key to distinguish data such as temperature and resistance reported by different devices. The device takes whether the calibration is completed as the status bit. When the device completes the calibration, the database automatically deletes the data under the device number to ensure the cleanliness of the database; the data on the device side that has not been calibrated is retained in the database for 24 hours. After the time limit is exceeded, the database automatically Clean data.
步骤4、在边缘节点通过遗传算法来选择校准的最佳特征点。Step 4. Select the best feature point for calibration by genetic algorithm at the edge node.
具体来说,对于大规模制造的测温模块,由于各个传感器之间存在差异,输入-输出特性具有明显的非线性,且个体差异性比较大,在进行校准时,如果对每个特征点进行标定,时间成本会大大增加,因此在选择特征点进行拟合时,效果与选取的数据之间存在某种制约关系,故使用遗传算法,在不改变拟合效果的前提下,对特征点进行选取,从而得到效率高成本低且拟合效果好的解决方案。具体过程如下:Specifically, for mass-produced temperature measurement modules, due to the differences between sensors, the input-output characteristics have obvious nonlinearity, and the individual differences are relatively large. Calibration will greatly increase the time cost. Therefore, when selecting feature points for fitting, there is a certain restrictive relationship between the effect and the selected data. Therefore, the genetic algorithm is used to perform the feature points on the premise of not changing the fitting effect. selection, so as to obtain a solution with high efficiency, low cost and good fitting effect. The specific process is as follows:
(4.1)基因的建立与特征点的选取:将设备端发送的每一个温度数据抽象为基因,定义xq表示第q个测试点是否为特征点,当xq=1时表示第q号测试点被入选为特征值点,反之当xq=0时表示第q号测试点不入选为特征值点;(4.1) Gene establishment and feature point selection: abstract each temperature data sent by the device as a gene, define x q to indicate whether the q-th test point is a feature point, and when x q = 1, it means the q-th test The point is selected as the eigenvalue point, otherwise when x q = 0, it means that the qth test point is not selected as the eigenvalue point;
(4.2)适应度函数的定义:基于给定的优化目标,利用适应度函数来测量种群中染色体的质量;由于决策的目标是降低总时间成本,选择适应度函数为度量染色体的总时间成本Ctotal的平方倒数, (4.2) Definition of fitness function: Based on the given optimization objective, the fitness function is used to measure the quality of chromosomes in the population; since the goal of decision-making is to reduce the total time cost, the fitness function is selected to measure the total time cost of chromosomes C Reciprocal square of total ,
(4.2.1)单次测量时间成本:测量一个温度值所需要的时间成本,记为Cq=50;(4.2.1) Time cost of single measurement: the time cost required to measure a temperature value, denoted as C q =50;
(4.2.2)标定误差时间成本:(4.2.2) Time cost of calibration error:
符号cj单点误差对应的时间成本值。其中i表示传感器编号,j表示测试点,Ti,j表示实际温度值,表示传感器读数;The time cost value corresponding to the single point error of the symbol c j . where i is the sensor number, j is the test point, T i,j is the actual temperature value, Indicates the sensor reading;
单个样本本体的标定误差时间成本用计算;The time cost of calibration error for a single sample ontology is calculate;
(4.2.3)样本个体标定时间成本:样本个体的标定时间成本Ci是单体测定时间成本与误差标定时间成本之和;(4.2.3) Calibration time cost of individual sample: the calibration time cost C i of individual sample is the sum of the time cost of individual measurement and the time cost of error calibration;
Ci=Cs+Cq·ni C i =C s +C q · ni
ni表示对该样本个体标定过程中的测定点数目;n i represents the number of measurement points in the calibration process of the sample individual;
(4.2.4)总成本:总成本Ctotal为所有个体的标定时间成本的平均值,M为样本总数;(4.2.4) Total cost: the total cost C total is the average value of the calibration time cost of all individuals, and M is the total number of samples;
(4.3)交叉运算:使用模拟的二元交叉,从亲本p1和p2中计算后代c1和c2;通过在[0,1)中选择一个随机数u,计算后代的参数后代可以表示为 (4.3) Crossover operation: Calculate the offspring c1 and c2 from the parents p1 and p2 using a simulated binary crossover; calculate the parameters of the offspring by selecting a random number u in [0,1) The descendants can be expressed as
(4.4)变异运算:为模拟遗传过程,如果一个个体要发生变异,那么该个体的每个特征都要乘以一个范围内的随机数[1-mrange,1+mrange],mrange作为一个乘法因子根据每个特征独立计算,根据收敛的程度,mrange∈[0.01,0.3,通过轮盘选择法从当前种群中选择出10%的优秀个体进入下一代的迭代中去,使优秀个体能够最大限度保留下来;(4.4) Mutation operation: In order to simulate the genetic process, if an individual is to mutate, each characteristic of the individual must be multiplied by a random number in a range [1-m range , 1+m range ], and m range is used as the A multiplicative factor is independently calculated according to each feature. According to the degree of convergence, m range ∈ [0.01, 0.3, 10% of the outstanding individuals are selected from the current population by the roulette selection method and enter the next iteration to make the outstanding individuals can be preserved as much as possible;
(4.5)终止条件:超出以下范围,遗传迭代终止:(4.5) Termination condition: beyond the following range, the genetic iteration terminates:
σ2(ri)为第i个温度特征点ri方差,σ2(Wi)为第i个特征点组合Wi的方差,cov(ri-rj)为特征点i,j协方差,为最小输入温度,为最大输入温度。σ 2 (ri ) is the variance of the i -th temperature feature point ri, σ 2 (W i ) is the variance of the i - th feature point combination Wi, cov(ri -r j ) is the feature point i, j coordinator variance, is the minimum input temperature, is the maximum input temperature.
举例来说,当选择的温度特征点为6个时,对应的总成本Ctotal为350±10,所花费的时间为350±100s;当特征点为5个时,对应的成本为260±10,所花费的时间为600±100s,次数时间增加是因为遗传算法去选择特征点的时候迭代的次数变多。总成本基本上接近选择的特征点数量乘以单次测量时间成本。For example, when the selected temperature feature points are 6, the corresponding total cost C total is 350±10, and the time spent is 350±100s; when there are 5 feature points, the corresponding cost is 260±10 , the time spent is 600±100s, and the increase in the number of times is because the number of iterations increases when the genetic algorithm selects feature points. The total cost is basically close to the number of feature points selected multiplied by the time cost per measurement.
步骤5、通过由遗传算法得出的温度特征点,在特征点处将待校准设备与标准器的温度-电阻值变化曲线进行拟合,通过拟合得到的温度模型来准确计算温度传感器特征点的测量温度。选择Steinhart-Hart算法的三阶多项式拟合公式对温度数据进行拟合分析,具体如下:Step 5. Fit the temperature-resistance value change curve of the device to be calibrated and the standard at the characteristic points through the temperature characteristic points obtained by the genetic algorithm, and accurately calculate the characteristic points of the temperature sensor through the temperature model obtained by fitting. measured temperature. Select the third-order polynomial fitting formula of the Steinhart-Hart algorithm to fit and analyze the temperature data, as follows:
选取对NTC热敏电阻的RT表数据进行曲线拟合的三阶多项式拟合公式: 其中T为开式温标,单位为K,R为电阻,单位为KΩ,A,B,C为常数系数;通过分析误差平方和即有:Select the third-order polynomial fitting formula for curve fitting of the RT table data of the NTC thermistor: Where T is the open temperature scale, the unit is K, R is the resistance, the unit is KΩ, A, B, C are constant coefficients; by analyzing the sum of squares of errors That is:
式中,Ri为第i个电阻,Ti为Ri匹配的温度值;常量使用ai,替代并带入多项式拟合公式,获得常数矩阵:In the formula, R i is the ith resistance, and T i is the temperature value matched by R i ; the constant is replaced by a i, and brought into the polynomial fitting formula to obtain the constant matrix:
可知拟合公式的常数系数:The constant coefficients of the fitting formula can be known:
A=(a23^2*b1-a12*a23*b3+a13*a22*b3-a13*a23*b2+a12*a33*b2-a22*a33*b1)/(a33*a12^2-2*a12*a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)A=(a23^2*b1-a12*a23*b3+a13*a22*b3-a13*a23*b2+a12*a33*b2-a22*a33*b1)/(a33*a12^2-2*a12 *a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)
B=(a13^2*b2-a12*a13*b3+a11*a23*b3-a13*a23*b1-a11*a33*b2+a12*a33*b1)/(a33*a12^2-2*a12*a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)B=(a13^2*b2-a12*a13*b3+a11*a23*b3-a13*a23*b1-a11*a33*b2+a12*a33*b1)/(a33*a12^2-2*a12 *a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)
C=(a12^2*b3-a12*a13*b2-a11*a22*b3+a11*a23*b2-a12*a23*b1+a13*a22*b1)/(a33*a12^2-2*a12*a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)C=(a12^2*b3-a12*a13*b2-a11*a22*b3+a11*a23*b2-a12*a23*b1+a13*a22*b1)/(a33*a12^2-2*a12 *a13*a23+a22*a13^2+a11*a23^2-a11*a22*a33)
从而计算得出在某一阻值下的温度标准值。Thereby, the temperature standard value under a certain resistance value is calculated.
边缘网关基于曲线拟合的三阶多项式拟合公式计算特征点的温度并进行二次校验,将通过二次校验的校准结果发送至云端服务器以及将校准后的曲线拟合的三阶多项式拟合公式发送至设备端,将未通过二次校验的结果进行本地记录同时报上云端。The edge gateway calculates the temperature of the feature points based on the third-order polynomial fitting formula of curve fitting and performs secondary verification, sends the calibration results that pass the secondary verification to the cloud server, and fits the calibrated curve to the third-order polynomial. The fitting formula is sent to the device, and the results that fail the secondary verification are recorded locally and reported to the cloud at the same time.
边缘网关二次校验需要同时满足如下两个规则,具体为:The edge gateway secondary verification needs to meet the following two rules at the same time, specifically:
规则1:复查温度校准过程边缘网关接收设备端上报的历史数据是否在检测指标的既定范围内,如果数据值不在既定范围内,则视为校验不通过;Rule 1: During the temperature calibration process, check whether the historical data reported by the edge gateway receiving device is within the predetermined range of the detection index. If the data value is not within the predetermined range, the verification is deemed to have failed;
规则2:利用曲线拟合的三阶多项式拟合公式计算残差及标准差,如果残差及标准差超过云端服务器设定的区间范围,则视为校验不通过。该实例采用的操作系统为Linux,边缘端使用的开发语言为go1.17,设备端使用的开发语言为C语言,以树莓派4B作为边缘节点,内存为4GB。对设备端上报的数据通过遗传算法,选择以下6个点进行拟合。结果表明。经过校准后,残差控制在±1mK的范围内,标准差为0.0049℃,校准效果良好。Rule 2: Use the third-order polynomial fitting formula of curve fitting to calculate residuals and standard deviations. If the residuals and standard deviations exceed the interval range set by the cloud server, the verification will be regarded as failing. The operating system used in this instance is Linux, the development language used on the edge side is go1.17, and the development language used on the device side is C language. The Raspberry Pi 4B is used as the edge node, and the memory is 4GB. The following 6 points are selected to fit the data reported by the device through the genetic algorithm. the result shows. After calibration, the residual error is controlled within the range of ±1mK, the standard deviation is 0.0049℃, and the calibration effect is good.
表1校准前后数据分析Table 1 Data analysis before and after calibration
步骤6:边缘节点利用MQTT协议将校准数据及校准结果发送至云端实现校准记录的云存储,同时利用TCP/IP协议将特征函数发送至设备端完成校准。Step 6: The edge node uses the MQTT protocol to send the calibration data and calibration results to the cloud to realize cloud storage of calibration records, and uses the TCP/IP protocol to send the characteristic function to the device to complete the calibration.
上述实施例用来解释说明本发明,而不是对本发明进行限制,在本发明的精神和权利要求的保护范围内,对本发明作出的任何修改和改变,都落入本发明的保护范围。The above-mentioned embodiments are used to explain the present invention, rather than limit the present invention. Within the spirit of the present invention and the protection scope of the claims, any modifications and changes made to the present invention all fall into the protection scope of the present invention.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210619485.7A CN114993501A (en) | 2022-05-31 | 2022-05-31 | NTC temperature sensor calibration method based on edge calculation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210619485.7A CN114993501A (en) | 2022-05-31 | 2022-05-31 | NTC temperature sensor calibration method based on edge calculation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114993501A true CN114993501A (en) | 2022-09-02 |
Family
ID=83031258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210619485.7A Pending CN114993501A (en) | 2022-05-31 | 2022-05-31 | NTC temperature sensor calibration method based on edge calculation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114993501A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117553938A (en) * | 2024-01-11 | 2024-02-13 | 南京市计量监督检测院 | Error correction method for temperature secondary instrument in high-low temperature environment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105588667A (en) * | 2015-12-18 | 2016-05-18 | 上海市计量测试技术研究院 | High-precision thermistor thermometer calibrating device |
CN107121218A (en) * | 2017-06-30 | 2017-09-01 | 国家海洋局第海洋研究所 | A kind of one-touch air-temperature sensor calibration system |
CN111510500A (en) * | 2020-04-21 | 2020-08-07 | 江苏卓易信息科技股份有限公司 | Water quality monitoring data calibration method based on edge calculation |
CN111886482A (en) * | 2018-03-22 | 2020-11-03 | 赫尔辛基大学 | Sensor calibration |
CN112665655A (en) * | 2021-01-12 | 2021-04-16 | 中国计量大学 | Glass window heat preservation system standard device on-site calibration instrument based on Internet of things |
-
2022
- 2022-05-31 CN CN202210619485.7A patent/CN114993501A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105588667A (en) * | 2015-12-18 | 2016-05-18 | 上海市计量测试技术研究院 | High-precision thermistor thermometer calibrating device |
CN107121218A (en) * | 2017-06-30 | 2017-09-01 | 国家海洋局第海洋研究所 | A kind of one-touch air-temperature sensor calibration system |
CN111886482A (en) * | 2018-03-22 | 2020-11-03 | 赫尔辛基大学 | Sensor calibration |
CN111510500A (en) * | 2020-04-21 | 2020-08-07 | 江苏卓易信息科技股份有限公司 | Water quality monitoring data calibration method based on edge calculation |
CN112665655A (en) * | 2021-01-12 | 2021-04-16 | 中国计量大学 | Glass window heat preservation system standard device on-site calibration instrument based on Internet of things |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117553938A (en) * | 2024-01-11 | 2024-02-13 | 南京市计量监督检测院 | Error correction method for temperature secondary instrument in high-low temperature environment |
CN117553938B (en) * | 2024-01-11 | 2024-03-19 | 南京市计量监督检测院 | Error correction method for temperature secondary instrument in high-low temperature environment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN118898206B (en) | Data acquisition processing method and system based on digital twin platform | |
US10739741B2 (en) | Systems and methods for detecting changes in energy usage in a building | |
US10261485B2 (en) | Systems and methods for detecting changes in energy usage in a building | |
CN113219130B (en) | Calibration method and test platform of multi-parameter gas sensor | |
US10120004B1 (en) | Power consumption analyzing server and power consumption analyzing method thereof | |
CN109767061B (en) | A method and device for evaluating the failure rate of an electric energy meter | |
CN113687176B (en) | Deep neural network-based power consumption abnormity detection method and system | |
CN111510500A (en) | Water quality monitoring data calibration method based on edge calculation | |
CN110865260A (en) | A method for monitoring and evaluating the actual state of MOV based on outlier detection | |
CN104236615A (en) | Intelligent sensor self-correcting method | |
CN107885928A (en) | Consider the stepstress acceleration Degradation Reliability analysis method of measurement error | |
CN115902647A (en) | A battery state intelligent monitoring method | |
CN118211103B (en) | Data correction method for ocean temperature and salt depth sensor | |
CN114993501A (en) | NTC temperature sensor calibration method based on edge calculation | |
CN110442911A (en) | A kind of higher-dimension complication system Uncertainty Analysis Method based on statistical machine learning | |
CN114091344A (en) | Power transmission line risk assessment model training method and device based on data coupling | |
CN119182473B (en) | A method and system for fitting element errors of millimeter wave array antenna | |
CN112765787B (en) | Degradation modeling and service life prediction method considering performance index clustering in dynamic environment | |
CN118801885A (en) | An automatic calibration method for analog quantity modules | |
CN117540159A (en) | Fault detection method and device for extra-high voltage converter transformer | |
CN114879126A (en) | A method, device and equipment for calibrating a terminal for precise electricity regulation and control | |
CN117131977A (en) | A method for dividing the runoff forecast sample set based on the minimum misjudgment risk criterion | |
CN106767773B (en) | A method and device for constructing an indoor geomagnetic reference map | |
CN116381503A (en) | Fuel Cell Electrochemical Impedance Spectroscopy Estimation Method for Water Management Fault Diagnosis | |
CN106412811A (en) | Sensor network data fusion method based on data uniformity weighting |
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 |