CN109596684A - A kind of detection of gas with multiple constituents device and method based on RS485 network - Google Patents

A kind of detection of gas with multiple constituents device and method based on RS485 network Download PDF

Info

Publication number
CN109596684A
CN109596684A CN201910039660.3A CN201910039660A CN109596684A CN 109596684 A CN109596684 A CN 109596684A CN 201910039660 A CN201910039660 A CN 201910039660A CN 109596684 A CN109596684 A CN 109596684A
Authority
CN
China
Prior art keywords
gas
data
value
neural network
output
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910039660.3A
Other languages
Chinese (zh)
Other versions
CN109596684B (en
Inventor
马贺平
李会军
周怡
白烨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Heaven And Earth Remote Sensing Technology Co Ltd
Original Assignee
Suzhou Heaven And Earth Remote Sensing Technology 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 Suzhou Heaven And Earth Remote Sensing Technology Co Ltd filed Critical Suzhou Heaven And Earth Remote Sensing Technology Co Ltd
Priority to CN201910039660.3A priority Critical patent/CN109596684B/en
Publication of CN109596684A publication Critical patent/CN109596684A/en
Application granted granted Critical
Publication of CN109596684B publication Critical patent/CN109596684B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N27/00Investigating or analysing materials by the use of electric, electrochemical, or magnetic means
    • G01N27/26Investigating or analysing materials by the use of electric, electrochemical, or magnetic means by investigating electrochemical variables; by using electrolysis or electrophoresis
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06NCOMPUTER SYSTEMS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computer systems based on biological models
    • G06N3/02Computer systems based on biological models using neural network models
    • G06N3/04Architectures, e.g. interconnection topology
    • G06N3/0472Architectures, e.g. interconnection topology using probabilistic elements, e.g. p-rams, stochastic processors
    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C17/00Arrangements for transmitting signals characterised by the use of a wireless electrical link
    • G08C17/02Arrangements for transmitting signals characterised by the use of a wireless electrical link using a radio link
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. local area networks [LAN], wide area networks [WAN]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. local area networks [LAN], wide area networks [WAN]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40228Modbus

Abstract

The invention discloses a kind of detection of gas with multiple constituents device and methods based on RS485 network, including multiple gas sensors, MAX485 interface module, MCU controller, YL-500IL wireless data transmission module, the USART1 interface of MCU controller is connect with MAX485 interface module, the USART2 interface of MCU controller is connect with YL-500IL wireless data transmission module, MAX485 interface module is connect with RS485 bus, multiple parallel carries of gas sensor are in RS485 bus, circuit in the MAX485 interface module uses automatic transceiving circuit, for realizing the transmitted in both directions of information flow.The present invention can guarantee that the data of multicomponent gas sensor acquisition will not mutually be interfered, while can carry out stable wireless transmission to the data of acquisition.

Description

A kind of detection of gas with multiple constituents device and method based on RS485 network
Technical field
The present invention relates to a kind of detection of gas with multiple constituents device and method, specifically a kind of multiple groups based on RS485 network Divide gas-detecting device and method.
Background technique
Since some special screnes need while detecting the content of multiple gases, and it can be transmitted and be examined by wireless remote The gas information of survey.Such as: scene of fire, toxic and harmful gas leak scene etc. have the place of security threat to personnel.At this A little places, safe and efficient, reliable detection of gas with multiple constituents equipment will have big advantage.Currently, detection single kind Gas sensor has very much, such as: CITY, Alphasense, Honeywell etc..But each sensor only has detection single The function of one gas content, there is presently no the Integrated Solutions of multiple gases sensor.Additionally, due to existing electrochemical gas Sensor will appear interference when measuring multicomponent gas, so, develop a kind of efficient, reliable, quick multicomponent gas biography Sensor Integrated Solution is particularly important.
And realize the measurement and wireless transmission of multicomponent gas content, it is primarily present both sides problem: 1) multicomponent gas It avoids interfering with each other when body sensor networks are built and later data handles;2) how the collected data of gas sensor carry out Stable wireless transmission.
Summary of the invention
The multicomponent gas inspection based on RS485 network that in view of the above existing problems in the prior art, the present invention provides a kind of Device and method is surveyed, can guarantee that the data of multicomponent gas sensor acquisition will not mutually be interfered, while can be to the data of acquisition Carry out stable wireless transmission.
To achieve the goals above, the technical solution adopted by the present invention is that: a kind of multicomponent gas based on RS485 network Detection device, including multiple gas sensors, MAX485 interface module, MCU controller, YL-500IL wireless data transmission module, MCU The USART1 interface of controller is connect with MAX485 interface module, and the USART2 interface and YL-500IL of MCU controller are without line number Transmission module connection, MAX485 interface module are connect with RS485 bus, and multiple parallel carries of gas sensor are in RS485 bus.
Further, the circuit in the MAX485 interface module uses automatic transceiving circuit, for realizing the double of information flow To transmission.
Further, the gas sensor is 8.
A kind of detection of gas with multiple constituents method based on RS485 network, specific steps are as follows:
A, gas sensor network is built based on RS485;
B, resolution ratio, address and the check code of 8 gas sensors are set;Ground station control system instructs modified address It is wirelessly sent to YL-500IL wireless data transmission module, and passes to MCU controller, after MCU controller receives instruction, according to finger It enables content successively send unlock instruction and modification data command to each gas sensor in sequence, completes each gas sensing It modifies the address of device;
Ground station control system will modify resolution ratio instruction and be wirelessly sent to YL-500IL wireless data transmission module, and pass to MCU controller after MCU controller receives instruction, is successively sent to each gas sensor in sequence according to command content Unlock instruction and modification data command complete the resolution ratio modification of each gas sensor;The data frame of above-mentioned each instruction is equal There are two the CRC16 check codes of byte for band;
C, when carrying out detection of gas with multiple constituents, MCU controller waits the times according to modified 8 gas sensor addresses It is spaced to send to MAX485 module and reads data command, MAX485 module passes 8 gases using Modbus-RTU communications protocol Sensor interrupts the data frame for receiving each gas sensor and returning by the serial ports free time, and data frame is passed to MCU controller; Untreated data are sent the data to ground station control system by YL-500IL wireless data transmission module by last MCU controller System;
D, ground station control system receive after data according to the selected gas with various sensor of different application scene into Then the gas concentration value that each sensor measures is calculated according to built data model in row data modeling;
E, the data obtained in step D are filtered by Kalman filtering algorithm, are finally obtained filtered Actual gas concentration value.
Further, scene of fire gaseous detection applications scene, specific process are as follows: used 8 are selected in the step D A gas sensor is respectively as follows: methane, ammonia, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride;
Due to there is the gas of above 8 kinds of components in the scene, cross one another influence, therefore each sensing between various gases The correspondence gas concentration of device measurement is clearly inaccuracy;It, can be to known 8 kinds of gas in the case where securing gas component The sample of concentration measures, and is modeled by gas concentration of the linear neural network to each component;
If linear neural network algorithm haves three layers altogether, respectively input layer, middle layer and output layer;Input layer is respectively first Alkane, ammonia, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride, the measured value of totally 8 gas sensors, output layer Respectively methane, ammonia, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride, the concentration value of totally 8 kinds of gas, intermediate Layer is the adjustment layer of input layer, which is that multivariate regression linearly inputs, and it is as follows that formula is arranged in middle layer:
In formula (1): I meets 0≤x1+x2+L+x8≤2;x1、x2、L、x8The respectively number of combinations of integer 0;
By above-mentioned 8 kinds of gas sensor variable Xs1,X2,L,X8Instead of according to formula (1), multicomponent gas sensing data One-dimensional matrix is arranged in blending algorithm middle layer:
X45×1For 45 × 1 matrix,Methane, ammonia, L, hydrogen fluoride are respectively indicated, totally 8 kinds of gas The concentration measurement of body, middle layer to the weight matrix between output layer are W8×45, determine the power between middle layer and output layer After value W, the sensor sample value of real-time measurement calculates step using linear neural network and obtains concentration output;
The nominal data of every kind of gas takes 7 groups respectively, i.e., to 78Group data, according to formula (2), (3) by marked gas concentration, Measure gas concentration normalization.
In formulaFor m-th of sample neural network output, input normalized value;Xim、PmFor m-th of sample i-th The input of a sensor, output calibration value;Xmax、Xmin, Pmax、PminFor sensor input is maximum, minimum value, output is maximum, most Small calibration value;
According to 8 kinds of gas sensor data blending algorithm structures, linear neural network is organized into following formula:
C8×1=W8×45X45×1 (4)
X in formula (4)i(i=1,2, L, 45) can be by the data in table 1 according to one-dimensional matrix X45×1It can be calculated;wi,j(i= 1,2;J=1,2, L, 45) it is linear neural network weight;ci(i=1,2, L, 8) is that neural network estimates 8 kinds of gas concentrations Evaluation;
Evaluated error are as follows:
esti m(k)=Pi m-Ci m(k) (5)
Weight tune updates:
In formula: Ci m(k) the output estimation value of m-th of sample of neural network is walked for kth;Pi mIt is defeated for m-th of sample of calibration point Enter the desired output of value and i-th of neural network output;esti mIt (k) is evaluated error, kth step neural network output is estimated The difference of evaluation and desired output;wij(k) when being walked for kth, j-th of connection weight;ηijFor Studying factors;Its selection influences To the stability and convergence rate of iteration.
The learning procedure of neural network is: designed linear neural network is used, it will be in standard sample database As the input of network,As the output desired value of network, according to formula (5), (6) training wi,j (i=1,2;J=1,2, L, 45), the initial value of weight chooses the random number between (- 1,1);By the input in standard sample database Output data is sequentially brought into neural network, by successive ignition with new weight, until the estimated value of neural network output valve Error mean square value is lower than setting value, and learning process terminates at this time;Weight is that neural network reads data fusion coefficients, in order to guarantee Convergence rate and stability, in learning process, Studying factors ηij(i=1,2;J=1,2, L, 45) it is taken as parameter, become from 0.95 To 0.4;Gas concentration measurement model is obtained in turn, wherein W known to weight matrix8×45, input X45×1For (prediction) square to be measured Battle array, model expression such as formula (4);
Finally, according to formula (3) renormalization to get arrive true gas concentration.
Further, the specific filtering of the step E are as follows:
Since the carbonomonoxide concentration rule that changes with time is similar to normal distribution, the data that step D is obtained Carry out normal distribution fitting:
Kalman filtering processing is Linear system model, is fitted with second order polynomial to above-mentioned data, obtains outlet Property expression formula;
SCO=at2+bt+c (8)
In formula: a, b, c are the datum obtained according to different application scene;
According to Kalman filtering algorithm, it is necessary first to determine state difference equation and its measurement mapped out of linear system Equation.
Xt=AXt-1+BUt-1+Wt-1 (9)
Zt=HXt+Vt (10)
X: the state vector of system;
A: transition matrix;
U: system input;
B: the matrix of state is converted the input into;
W: system noise;
Z: measured value;
H: the transition matrix of state variable to measured value;
V: measurement noise
State vector X is defined according to formula (8), (9), (10)t, A, B, U:
U=[- 0.0010096]
For gas sensor measured value, that is, gas concentration, therefore obtain Z, H:
Z=[zk]
H=[1 0]
For the system noise W and measurement noise V in state equation, it is assumed that obey following multivariate Gaussian distribution, and W, V It is independent from each other;Wherein Q, R are the covariance matrix of noise variance, and Q, R can be obtained according to measurement sample statistics analysis;
P (w)~N (0, Q)
P (v)~N (0, R)
The step of above-mentioned model is carried out Kalman filtering is as follows:
Wherein P is estimated valueWith true value xkCovariance matrix;Loop iteration is multiple, i.e., after acquisition Kalman filtering Gas concentration value.
Compared with prior art, the present invention uses gas sensor, MAX485 interface module, MCU controller, YL-500IL Wireless data transmission module combines mode, is based on the multiple electrochemical gas sensors of RS485 system integrating, logical by Modbus-RTU Letter mode is written and read sensor, to be effectively reduced the occupancy of MCU resource, while using CRC16 check code in number According to being verified in transmission process, it is ensured that read the accuracy of data.Sensor is carried out according further to different application scene Modeling, and Kalman filtering is carried out to the data of reading, to improve the reliability of sensor measurement data.Pass through no line number Transmission data, to improve the flexibility ratio that module uses.
Detailed description of the invention
Fig. 1 is electric principle connection figure of the invention;
Fig. 2 is work flow diagram of the invention;
Fig. 3 is 8 kinds of gas sensor data blending algorithm structural schematic diagrams in the present invention.
Specific embodiment
The present invention will be further described below.
As shown, a kind of detection of gas with multiple constituents device based on RS485 network, including multiple gas sensors, MAX485 interface module, MCU controller, YL-500IL wireless data transmission module, USART1 interface and the MAX485 of MCU controller connect The connection of mouth mold block, the USART2 interface of MCU controller connect with YL-500IL wireless data transmission module, MAX485 interface module and The connection of RS485 bus, multiple parallel carries of gas sensor are in RS485 bus.
Further, the circuit in the MAX485 interface module uses automatic transceiving circuit, for realizing the double of information flow To transmission.
Further, the gas sensor is 8.
A kind of detection of gas with multiple constituents method based on RS485 network, specific steps are as follows:
A, gas sensor network is built based on RS485, and data modeling is carried out to a variety of different application scenes;
B, resolution ratio, address and the check code of 8 gas sensors are set;Ground station control system instructs modified address It is wirelessly sent to YL-500IL wireless data transmission module, and passes to MCU controller, after MCU controller receives instruction, according to finger It enables content successively send unlock instruction and modification data command to each gas sensor in sequence, completes each gas sensing It modifies the address of device;
Table 1 sends unlock instruction
0x00 0x06 0x00 0x11 0x00 0x18 0xD8 0x14
General modified address Modify command word Address H Address L Data H is written Data L is written CRC16 CRC16
Table 2 sends modification data
0x00 0x06 0x00 0x13 0x00 0x03 0x39 0xDF
General modified address Modify command word Address H Address L Data H is written Data L is written CRC16 CRC16
Ground station control system will modify resolution ratio instruction and be wirelessly sent to YL-500IL wireless data transmission module, and pass to MCU controller after MCU controller receives instruction, is successively sent to each gas sensor in sequence according to command content Unlock instruction and modification data command complete the resolution ratio modification of each gas sensor;The data frame of above-mentioned each instruction is equal There are two the CRC16 check codes of byte for band;
Table 3 sends unlock instruction
0x01 0x06 0x00 0x11 0x00 0x18 0xD9 0xC5
Device address Modify command word Address H Address L Data H is written Data L is written CRC16 CRC16
Table 4 sends modification data
0x01 0x06 0x00 0x1E 0x00 0x01 0x28 0x0C
Device address Modify command word Address H Address L Data H is written Data L is written CRC16 CRC16
Note: module can be stablized in 30s after modification resolution ratio, and the use pattern of dynamic modification resolution ratio is please after the modification 30s reads data.Dynamic modification resolution ratio is used in the case where high concentrations of gas range is unable to reach.
C, when carrying out detection of gas with multiple constituents, MCU controller waits the times according to modified 8 gas sensor addresses It is spaced to send to MAX485 module and reads data command, MAX485 module passes 8 gases using Modbus-RTU communications protocol Sensor interrupts the data frame for receiving each gas sensor and returning by the serial ports free time, and data frame is passed to MCU controller; Untreated data are sent the data to ground station control system by YL-500IL wireless data transmission module by last MCU controller System;
Read gas sensor data:
Table 5 reads data command
0x01 0x03 0x00 0x00 0x00 0x01 0x84 0x0A
Serial communication address Reading order word Initial address H Initial address L Length H Length L CRC16 CRC16
6 sensor of table replys data
0x01 0x03 0x02 0x00 0x08 0xB9 0x82
Serial communication address Reading order word Data length Data H Data L CRC16 CRC16
Data H, L are the hexadecimal data of two bytes in table 6, and decimal value combination resolution ratio can be obtained by Gas concentration value.Such as: resolution ratio 0.1, gas concentration data value are 0x0008, it can be deduced that gas concentration value is 0.8ppm。
Read gas sensor resolution ratio:
Table 7 reads resolution ratio instruction
0x01 0x03 0x00 0x1E 0x00 0x01 0xE4 0x0C
Serial communication address Reading order word Initial address H Initial address L Length H Length L CRC16 CRC16
8 sensor replying instruction of table
0x01 0x03 0x02 0x00 0x03 0xF8 0x45
Serial communication address Reading order word Data length Data H Data L CRC16 CRC16
The data of two bytes of data H, L are written in table 8, decimal value indicates the accurate decimal of sensor resolution Point digit.Such as: 0x0003, decimal value 1, expression are accurate to 3 decimals after decimal point, i.e. resolution ratio is 0.001.
Read gas sensor temperature data:
The instruction of 9 read through model temperature of table
0x01 0x03 0x00 0x01 0x00 0x01 0xD5 0xCA
Serial communication address Reading order word Initial address H Initial address L Length H Length L CRC16 CRC16
The instruction of 10 sensor recovery temperature of table
0x01 0x03 0x02 0x00 0x14 0xB8 0x4B
Serial communication address Reading order word Data length Data H Data L CRC16 CRC16
The data of two bytes of data H, L in table 10, decimal value indicate sensor temperature.Such as: 0x0014, ten Binary value is 20, indicates that temperature is 20 DEG C.
D, ground station control system receive after data according to the selected gas with various sensor of different application scene into Then the gas concentration value that each sensor measures is calculated according to built data model in row data modeling;In the step D Select scene of fire gaseous detection applications scene, specific process are as follows: used 8 gas sensors are respectively as follows: methane, ammonia Gas, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride;
Due to there is the gas of above 8 kinds of components in the scene, cross one another influence, therefore each sensing between various gases The correspondence gas concentration of device measurement is clearly inaccuracy;It, can be to known 8 kinds of gas in the case where securing gas component The sample of concentration measures, and is modeled by gas concentration of the linear neural network to each component;
If linear neural network algorithm haves three layers altogether, respectively input layer, middle layer and output layer;Input layer is respectively first Alkane, ammonia, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride, the measured value of totally 8 gas sensors, output layer Respectively methane, ammonia, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride, the concentration value of totally 8 kinds of gas, intermediate Layer is the adjustment layer of input layer, which is that multivariate regression linearly inputs, and it is as follows that formula is arranged in middle layer:
In formula (1): I meets 0≤x1+x2+L+x8≤2;x1、x2、L、x8The respectively number of combinations of integer 0;
By above-mentioned 8 kinds of gas sensor variable Xs1,X2,L,X8Instead of according to formula (1), multicomponent gas sensing data One-dimensional matrix is arranged in blending algorithm middle layer:
X45×1For 45 × 1 matrix,Methane, ammonia, L, hydrogen fluoride are respectively indicated, totally 8 kinds of gas The concentration measurement of body, middle layer to the weight matrix between output layer are W8×45, determine the power between middle layer and output layer After value W, the sensor sample value of real-time measurement calculates step using linear neural network and obtains concentration output;
The nominal data of every kind of gas takes 7 groups respectively, i.e., to 78Group data, according to formula (2), (3) by marked gas concentration, Gas concentration normalization is measured, as shown in table 1.
In formulaFor m-th of sample neural network output, input normalized value;Xim、PmFor m-th of sample i-th The input of a sensor, output calibration value;Xmax、Xmin, Pmax、PminFor sensor input is maximum, minimum value, output is maximum, most Small calibration value;
1 neural network input and output standard sample database of table
According to the 8 of Fig. 3 gas sensor data blending algorithm structures, linear neural network is organized into following formula:
C8×1=W8×45X45×1 (4)
X in formula (4)i(i=1,2, L, 45) can be by the data in table 1 according to one-dimensional matrix X45×1It can be calculated;wi,j(i= 1,2;J=1,2, L, 45) it is linear neural network weight;ci(i=1,2, L, 8) is that neural network estimates 8 kinds of gas concentrations Evaluation;
Evaluated error are as follows:
esti m(k)=Pi m-Ci m(k) (5)
Weight tune updates:
In formula: Ci m(k) the output estimation value of m-th of sample of neural network is walked for kth;Pi mIt is defeated for m-th of sample of calibration point Enter the desired output of value and i-th of neural network output;esti mIt (k) is evaluated error, kth step neural network output is estimated The difference of evaluation and desired output;wij(k) when being walked for kth, j-th of connection weight;ηijFor Studying factors;Its selection influences To the stability and convergence rate of iteration.
The learning procedure of neural network is:, will be in 1 Plays sample database of table using linear neural network designed by Fig. 1 's As the input of network,As the output desired value of network, according to formula (5), (6) training wi,j(i=1,2;J=1,2, L, 45), the initial value of weight chooses the random number between (- 1,1);By standard Inputoutput data in sample database is sequentially brought into neural network, by successive ignition with new weight, until neural network The estimate error mean-square value of output valve is lower than setting value, and learning process terminates at this time;Weight is that neural network reading data are melted Collaboration number, in order to guarantee convergence rate and stability, in learning process, Studying factors ηij(i=1,2;J=1,2, L, 45) it takes For parameter, 0.4 is changed to from 0.95;Gas concentration measurement model is obtained in turn, wherein W known to weight matrix8×45, input X45×1For (prediction) matrix to be measured, model expression such as formula (4);
Finally, according to formula (3) renormalization to get arrive true gas concentration.
E, the data obtained in step (4) are filtered by Kalman filtering algorithm, after finally obtaining filtering Actual gas concentration value;The specific filtering of the step E are as follows:
Since the carbonomonoxide concentration rule that changes with time is similar to normal distribution, the data that step D is obtained Carry out normal distribution fitting:
Kalman filtering processing is Linear system model, is fitted with second order polynomial to above-mentioned data, obtains outlet Property expression formula;
SCO=at2+bt+c (8)
In formula: a, b, c are the datum obtained according to different application scene;
According to Kalman filtering algorithm, it is necessary first to determine state difference equation and its measurement mapped out of linear system Equation.
Xt=AXt-1+BUt-1+Wt-1 (9)
Zt=HXt+Vt (10)
X: the state vector of system;
A: transition matrix;
U: system input;
B: the matrix of state is converted the input into;
W: system noise;
Z: measured value;
H: the transition matrix of state variable to measured value;
V: measurement noise
State vector X is defined according to formula (8), (9), (10)t, A, B, U:
U=[- 0.0010096]
For gas sensor measured value, that is, gas concentration, therefore obtain Z, H:
Z=[zk]
H=[1 0]
For the system noise W and measurement noise V in state equation, it is assumed that obey following multivariate Gaussian distribution, and W, V It is independent from each other;Wherein Q, R are the covariance matrix of noise variance, and Q, R can be obtained according to measurement sample statistics analysis;
P (w)~N (0, Q)
P (v)~N (0, R)
The step of above-mentioned model is carried out Kalman filtering is as follows:
Wherein P is estimated valueWith true value xkCovariance matrix;Loop iteration is multiple, i.e., after acquisition Kalman filtering Gas concentration value.

Claims (6)

1. a kind of detection of gas with multiple constituents device based on RS485 network, which is characterized in that including multiple gas sensors, MAX485 interface module, MCU controller, YL-500IL wireless data transmission module, USART1 interface and the MAX485 of MCU controller connect The connection of mouth mold block, the USART2 interface of MCU controller connect with YL-500IL wireless data transmission module, MAX485 interface module and The connection of RS485 bus, multiple parallel carries of gas sensor are in RS485 bus.
2. a kind of detection of gas with multiple constituents device based on RS485 network according to claim 1, which is characterized in that institute The circuit in MAX485 interface module is stated using automatic transceiving circuit, for realizing the transmitted in both directions of information flow.
3. a kind of detection of gas with multiple constituents device based on RS485 network according to claim 1, which is characterized in that institute Stating gas sensor is 8.
4. a kind of detection of gas with multiple constituents method according to claim 1 based on RS485 network, which is characterized in that tool Body step are as follows:
A, gas sensor network is built based on RS485;
B, resolution ratio, address and the check code of 8 gas sensors are set;Ground station control system instructs modified address wireless It is sent to YL-500IL wireless data transmission module, and passes to MCU controller, after MCU controller receives instruction, according in instruction Hold and successively send unlock instruction and modification data command to each gas sensor in sequence, completes each gas sensor Address modification;
Ground station control system will modify resolution ratio instruction and be wirelessly sent to YL-500IL wireless data transmission module, and pass to MCU Controller after MCU controller receives instruction, successively sends unlock to each gas sensor in sequence according to command content Instruction and modification data command, complete the resolution ratio modification of each gas sensor;The data frame of above-mentioned each instruction has The CRC16 check code of two bytes;
C, when carrying out detection of gas with multiple constituents, MCU controller is according to modified 8 gas sensor addresses, constant duration It is sent to MAX485 module and reads data command, MAX485 module is using Modbus-RTU communications protocol to 8 gas sensors The data frame for receiving each gas sensor and returning is interrupted by the serial ports free time, and data frame is passed into MCU controller;Finally Untreated data are sent the data to ground station control system by YL-500IL wireless data transmission module by MCU controller;
D, ground station control system is counted after receiving data according to the selected gas with various sensor of different application scene According to modeling, the gas concentration value that each sensor measures then is calculated according to built data model;
E, the data obtained in step D are filtered by Kalman filtering algorithm, are finally obtained filtered true Gas concentration value.
5. the detection of gas with multiple constituents method according to claim 4 based on RS485 network, which is characterized in that the step Scene of fire gaseous detection applications scene, specific process are as follows: used 8 gas sensors are respectively as follows: first are selected in rapid D Alkane, ammonia, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride;
It is modeled by gas concentration of the linear neural network to each component;
If linear neural network algorithm haves three layers altogether, respectively input layer, middle layer and output layer;Input layer is respectively methane, ammonia Gas, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride, the measured value of totally 8 gas sensors, output layer are respectively Methane, ammonia, carbon monoxide, chlorine, benzene, hydrogen sulfide, hydrogen chloride, hydrogen fluoride, the concentration value of totally 8 kinds of gas, middle layer are defeated Enter the adjustment layer of layer, which is that multivariate regression linearly inputs, and it is as follows that formula is arranged in middle layer:
In formula (1): I meets 0≤x1+x2+L+x8≤2;x1、x2、L、x8The respectively number of combinations of integer 0;
By above-mentioned 8 kinds of gas sensor variable Xs1,X2,L,X8Instead of according to formula (1), multicomponent gas Data Fusion of Sensor One-dimensional matrix is arranged in algorithm middle layer:
X45×1For 45 × 1 matrix,L、Methane, ammonia, L, hydrogen fluoride are respectively indicated, totally 8 kinds of gas is dense Measured value is spent, middle layer to the weight matrix between output layer is W8×45, after determining the weight W between middle layer and output layer, The sensor sample value of real-time measurement calculates step using linear neural network and obtains concentration output;
The nominal data of every kind of gas takes 7 groups respectively, i.e., to 78Group data, according to formula (2), (3) by marked gas concentration, measurement Gas concentration normalization;
In formulaFor m-th of sample neural network output, input normalized value;Xim、PmIt is passed for m-th i-th of sample The input of sensor, output calibration value;Xmax、Xmin, Pmax、PminFor sensor input maximum, minimum value, output maximum, most small tenon Definite value;
According to 8 gas sensor data blending algorithm structures, linear neural network is organized into following formula:
C8×1=W8×45X45×1(4)
X in formula (4)i(i=1,2, L, 45) can be by the data in table 1 according to one-dimensional matrix X45× 1 can be calculated;wi,j(i=1, 2;J=1,2, L, 45) it is linear neural network weight;ci(i=1,2, L, 8) is estimation of the neural network to 8 kinds of gas concentrations Value;
Evaluated error are as follows:
esti m(k)=Pi m-Ci m(k)(5)
Weight tune updates:
In formula: Ci m(k) the output estimation value of m-th of sample of neural network is walked for kth;Pi mFor m-th of sample input value of calibration point, It is also the desired output of i-th of neural network output;esti m(k) be evaluated error, kth walk neural network output estimation value with The difference of desired output;wij(k) when being walked for kth, j-th of connection weight;ηijFor Studying factors;
The learning procedure of neural network is: designed linear neural network is used, it will be in standard sample databaseL、As the input of network,L、As the output desired value of network, according to formula (5), (6) training wi,j(i= 1,2;J=1,2, L, 45), the initial value of weight chooses the random number between (- 1,1);By the input and output in standard sample database Data are sequentially brought into neural network, by successive ignition with new weight, until the estimate error of neural network output valve Mean-square value is lower than setting value, and learning process terminates at this time;Weight is that neural network reads data fusion coefficients, in learning process In, Studying factors ηij(i=1,2;J=1,2, L, 45) it is taken as parameter, 0.4 is changed to from 0.95;And then obtain gas concentration measurement Model, wherein W known to weight matrix8×45, input X45×1For moment matrix to be measured, model expression such as formula (4);
Finally, according to formula (3) renormalization to get arrive true gas concentration.
6. the detection of gas with multiple constituents method according to claim 4 based on RS485 network, which is characterized in that the step The specific filtering of rapid E are as follows:
Since the carbonomonoxide concentration rule that changes with time is similar to normal distribution, the data that step D is obtained are carried out Normal distribution fitting:
Above-mentioned data are fitted with second order polynomial, obtain linear representation;
SCO=at2+bt+c(8)
In formula: a, b, c are the datum obtained according to different application scene;
According to Kalman filtering algorithm, it is necessary first to determine state difference equation and its measurement side mapped out of linear system Journey.
Xt=AXt-1+BUt-1+Wt-1(9)
Zt=HXt+Vt(10)
X: the state vector of system;
A: transition matrix;
U: system input;
B: the matrix of state is converted the input into;
W: system noise;
Z: measured value;
H: the transition matrix of state variable to measured value;
V: measurement noise
State vector X is defined according to formula (8), (9), (10)t, A, B, U:
U=[- 0.0010096]
For gas sensor measured value, that is, gas concentration, therefore obtain Z, H:
Z=[zk]
H=[1 0]
For the system noise W and measurement noise V in state equation, it is assumed that obey following multivariate Gaussian distribution, and W, V are phases It is mutually independent;Wherein Q, R are the covariance matrix of noise variance, and Q, R can be obtained according to measurement sample statistics analysis;
P (w)~N (0, Q)
P (v)~N (0, R)
The step of above-mentioned model is carried out Kalman filtering is as follows:
Wherein P is estimated valueWith true value xkCovariance matrix;Loop iteration is multiple, i.e. gas after acquisition Kalman filtering Bulk concentration value.
CN201910039660.3A 2019-01-16 2019-01-16 Multi-component gas detection device and method based on RS485 network Active CN109596684B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910039660.3A CN109596684B (en) 2019-01-16 2019-01-16 Multi-component gas detection device and method based on RS485 network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910039660.3A CN109596684B (en) 2019-01-16 2019-01-16 Multi-component gas detection device and method based on RS485 network

Publications (2)

Publication Number Publication Date
CN109596684A true CN109596684A (en) 2019-04-09
CN109596684B CN109596684B (en) 2021-02-05

Family

ID=65966072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910039660.3A Active CN109596684B (en) 2019-01-16 2019-01-16 Multi-component gas detection device and method based on RS485 network

Country Status (1)

Country Link
CN (1) CN109596684B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110133410A (en) * 2019-05-31 2019-08-16 国网河北省电力有限公司石家庄供电分公司 Diagnosis Method of Transformer Faults and system based on Fuzzy C-Means Cluster Algorithm

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106706862A (en) * 2017-02-23 2017-05-24 北京工业大学 In-car pollution gas monitoring device based on GSM (Global System for Mobile Communications) communication technology
CN106780085A (en) * 2016-12-12 2017-05-31 山东华福智慧能源科技有限公司 Safe and intelligent poultry cultivation greenhouse system and method
CN207964706U (en) * 2018-03-20 2018-10-12 苏州天地衡遥感科技有限公司 Unmanned plane multicomponent gas sensing system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106780085A (en) * 2016-12-12 2017-05-31 山东华福智慧能源科技有限公司 Safe and intelligent poultry cultivation greenhouse system and method
CN106706862A (en) * 2017-02-23 2017-05-24 北京工业大学 In-car pollution gas monitoring device based on GSM (Global System for Mobile Communications) communication technology
CN207964706U (en) * 2018-03-20 2018-10-12 苏州天地衡遥感科技有限公司 Unmanned plane multicomponent gas sensing system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
卢冠钟: "《船舶电气与自动化(下册:船舶自动化)》", 31 March 2014, 大连海事大学出版社 *
邓鹏 等: "基于RS485通信的远程数据采集与控制系统设计", 《无线互联科技》 *
韩世进 等: "基于RS-485的多路数据采集系统", 《现代电子技术》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110133410A (en) * 2019-05-31 2019-08-16 国网河北省电力有限公司石家庄供电分公司 Diagnosis Method of Transformer Faults and system based on Fuzzy C-Means Cluster Algorithm

Also Published As

Publication number Publication date
CN109596684B (en) 2021-02-05

Similar Documents

Publication Publication Date Title
CN106714110B (en) Wi-Fi position fingerprint map automatic construction method and system
CN107396322B (en) Indoor positioning method based on path matching and coding-decoding cyclic neural network
CN104182642B (en) A kind of fault detection method based on rarefaction representation
CN107219924B (en) A kind of aerial gesture identification method based on inertial sensor
CN104793651B (en) The ammonia spraying amount control method of SNCR flue gas denitrification systems in manufacture of cement
CN106405007B (en) The new calibration method of gas sensor, particulate matter sensors
CN109596684A (en) A kind of detection of gas with multiple constituents device and method based on RS485 network
CN109030566B (en) Laboratory gas leakage diagnosis device and method
CN101706882A (en) Embedded platform based neural network model online training method
CN109918718A (en) Unmanned plane during flying method for evaluating quality, device, storage medium and electronic equipment
CN108171259A (en) A kind of wisdom tip water quality monitoring system and method based on NB-IoT
CN108256238A (en) A kind of optic fiber grating wavelength demodulation method and device based on deep learning
CN110009245A (en) Indoor air quality prediction technique, device and electronic equipment neural network based
CN109060023B (en) Data quality control method and system for micro environment monitoring
CN106092053A (en) A kind of robot resetting system and localization method thereof
CN106310472B (en) Ventilator calibrator (-ter) unit and ventilator calibration system
CN108225996A (en) Mine operation personnel respiration dust Cumulative chase leaks computational methods and test system
CN110967728A (en) Gridding area multi-mode neutron dose monitoring method
CN107506862A (en) A kind of online real-time estimate system and method for grinding particle size based on Internet of Things
CN109781934A (en) Processing unit, processing method, computer readable storage medium and the environment sensor system of environmental sensor detection data
CN108446531A (en) Receptor Si and Al reconstructing method based on actual measurement derived components spectrum and Source apportionment
CN106767807B (en) Pedestrian step length comprehensive measurement method based on height and motion characteristics
CN110059355B (en) Leakage source positioning method and device based on concentration time sequence and computer equipment
CN107945804A (en) Task management and measurer data extraction system and its method based on speech recognition
CN108289127A (en) A kind of Internet of things system for Medical Devices comprehensively monitoring

Legal Events

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