CN103499374B - A kind of ultrasound wave dynamic liquid level detection method based on neutral net and system - Google Patents
A kind of ultrasound wave dynamic liquid level detection method based on neutral net and system Download PDFInfo
- Publication number
- CN103499374B CN103499374B CN201310401468.7A CN201310401468A CN103499374B CN 103499374 B CN103499374 B CN 103499374B CN 201310401468 A CN201310401468 A CN 201310401468A CN 103499374 B CN103499374 B CN 103499374B
- Authority
- CN
- China
- Prior art keywords
- circuit
- ultrasonic
- neutral net
- signal
- liquid level
- 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.)
- Expired - Fee Related
Links
- 239000007788 liquid Substances 0.000 title claims abstract description 60
- 238000001514 detection method Methods 0.000 title claims abstract description 46
- 230000007935 neutral effect Effects 0.000 title claims 20
- 238000002604 ultrasonography Methods 0.000 title claims 14
- 238000013178 mathematical model Methods 0.000 claims abstract description 13
- 238000000034 method Methods 0.000 claims description 17
- 238000012549 training Methods 0.000 claims description 16
- 239000000523 sample Substances 0.000 claims description 14
- 230000003321 amplification Effects 0.000 claims description 13
- 238000003199 nucleic acid amplification method Methods 0.000 claims description 13
- 230000006870 function Effects 0.000 claims description 6
- 230000002093 peripheral effect Effects 0.000 claims description 6
- 239000013078 crystal Substances 0.000 claims description 3
- 239000004973 liquid crystal related substance Substances 0.000 claims description 3
- 230000000052 comparative effect Effects 0.000 claims 2
- 230000005284 excitation Effects 0.000 claims 2
- 238000000605 extraction Methods 0.000 claims 2
- 239000011435 rock Substances 0.000 claims 2
- 230000001960 triggered effect Effects 0.000 claims 2
- NBIIXXVUZAFLBC-UHFFFAOYSA-N Phosphoric acid Chemical compound OP(O)(O)=O NBIIXXVUZAFLBC-UHFFFAOYSA-N 0.000 claims 1
- 239000012530 fluid Substances 0.000 claims 1
- 238000013528 artificial neural network Methods 0.000 abstract description 46
- 238000012544 monitoring process Methods 0.000 description 8
- 230000003750 conditioning effect Effects 0.000 description 4
- 238000005259 measurement Methods 0.000 description 4
- 238000012360 testing method Methods 0.000 description 4
- 210000002569 neuron Anatomy 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- XEEYBQQBJWHFJM-UHFFFAOYSA-N Iron Chemical compound [Fe] XEEYBQQBJWHFJM-UHFFFAOYSA-N 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000008054 signal transmission Effects 0.000 description 2
- 230000004936 stimulating effect Effects 0.000 description 2
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 229910052742 iron Inorganic materials 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Landscapes
- Measurement Of Levels Of Liquids Or Fluent Solid Materials (AREA)
- Measurement Of Velocity Or Position Using Acoustic Or Ultrasonic Waves (AREA)
Abstract
本发明公开了一种基于神经网络的超声波动态液位检测方法,包括:单片机向超声波传感器发送控制信号,同时启动定时器开始计时和产生脉冲超声波;三个超声波传感器将回波信号转化为电压信号,并将该电压信号发送到前置放大电路,经前置放大电路放大后的电压信号发送给超声波接收检波电路,实现对高频输入信号的包络检波;接收比较电路将经包络检波电路检波后的电压信号和系统设置的参考电压进行比较,根据比较结果输出数字信号,当外部中断控制口接收到有效下降沿后,单片机产生中断,记录当前时刻的定时器值,将平均值和晃动梯度作为神经网络所需的输入参量,将这两个参量发送给已训练好的神经网络数学模型,获得经神经网络的输出值。
The invention discloses an ultrasonic dynamic liquid level detection method based on a neural network, comprising: a single-chip microcomputer sends a control signal to an ultrasonic sensor, and simultaneously starts a timer to start timing and generate pulsed ultrasonic waves; three ultrasonic sensors convert echo signals into voltage signals , and send the voltage signal to the preamplifier circuit, and the voltage signal amplified by the preamplifier circuit is sent to the ultrasonic receiving and detecting circuit to realize the envelope detection of the high-frequency input signal; the receiving comparison circuit will pass the envelope detecting circuit The detected voltage signal is compared with the reference voltage set by the system, and a digital signal is output according to the comparison result. When the external interrupt control port receives a valid falling edge, the single-chip microcomputer generates an interrupt, records the timer value at the current moment, and converts the average value and vibration The gradient is used as the input parameter required by the neural network, and these two parameters are sent to the trained neural network mathematical model to obtain the output value of the neural network.
Description
技术领域technical field
本发明涉及一种检测领域,尤其涉及一种基于神经网络的超声波动态液位检测方法和系统。The invention relates to a detection field, in particular to an ultrasonic dynamic liquid level detection method and system based on a neural network.
背景技术Background technique
液体在运输过程中会产生明显的晃动,对液体的液位的实时动态监测一直是一个技术难题,至今没有得到很好的解决。The liquid will visibly slosh during transportation, and the real-time dynamic monitoring of the liquid level has always been a technical problem, which has not been well solved so far.
现有技术中,存在多种在对运输过程中的液位进行检测的方法,例如:一种基于单超声传感器的动态液位监测方法,该方法通过采集长时窗内的超声回波波达时刻,再运用小波滤波方法平滑回波信号提取的波达时刻曲线,结合运动物体的运动加速度、环境温度等参数,利用支持向量机技术对运动状态和模式进行了分类和识别,并且得到了动态液位值。但是,该方法也存在不足之处,首先,超声传感器安装在罐体上方,超声波在空气中传播声能衰减大,不利于测量;其次,要想得到准确的液位参数,监测时间窗较长,实时性变差。In the prior art, there are many methods for detecting the liquid level in the transportation process, for example: a dynamic liquid level monitoring method based on a single ultrasonic sensor. Then use the wavelet filter method to smooth the time-of-arrival curve extracted from the echo signal, combine the motion acceleration of the moving object, the ambient temperature and other parameters, use the support vector machine technology to classify and identify the motion state and mode, and get the dynamic level value. However, this method also has shortcomings. First, the ultrasonic sensor is installed above the tank, and the sound energy attenuation of the ultrasonic wave in the air is large, which is not conducive to measurement; secondly, in order to obtain accurate liquid level parameters, the monitoring time window is long. Real-time performance deteriorates.
现有技术中,还存在另外一种声纳储油罐液位动态监测系统,该系统采用主动声纳技术原理,由计算机控制传感器从罐顶固定法兰下端发出声纳波顺着传输钢缆下传,根据油水不同的理化特性声纳会反馈不同的数值,采集的数据发送到采集模块,基于RS485协议与上位机通讯,实现实时在线监测与分析,并显示动态液位值。该系统也存在不足之处,首先,该系统设计复杂、集成度低不利于携带;其次,声纳探头安装在灌顶,声能衰减较大。In the prior art, there is another dynamic monitoring system for the liquid level of sonar oil storage tanks. This system adopts the principle of active sonar technology, and the computer controls the sensor to emit sonar waves from the lower end of the tank roof fixing flange along the transmission cable. Downlink, according to the different physical and chemical characteristics of oil and water, the sonar will feed back different values, and the collected data will be sent to the acquisition module, and communicate with the host computer based on the RS485 protocol to realize real-time online monitoring and analysis, and display the dynamic liquid level value. The system also has shortcomings. First, the system is complex in design and low in integration, which is not conducive to portability; second, the sonar probe is installed on the roof, and the sound energy attenuation is relatively large.
发明内容Contents of the invention
为了克服目前液体在运输过程中液位检测准确度不高,容易产生较大误差的问题,本发明提出了一种基于神经网络的超声波动态液位检测方法和系统。In order to overcome the problem that the accuracy of liquid level detection during liquid transportation is not high and large errors are easily generated, the present invention proposes an ultrasonic dynamic liquid level detection method and system based on a neural network.
一种基于神经网络的超声波动态液位检测方法,包括:步骤1:单片机利用超声波发射电路向三个超声波传感器发送控制信号,同时启动定时器开始计时和激励三路超声波发射电路产生脉冲超声波;步骤2:超声波遇液面后反射,三个超声波传感器分别接收到反射后的回波信号后,并将回波信号转化为电压信号,并将该电压信号发送到前置放大电路,步骤3:前置放大电路接收了电压信号后,经前置放大电路放大后的电压信号发送给超声波接收检波电路,实现对高频输入信号的包络检波;步骤4:将经包络检波电路检波后的电压信号发送给接收比较电路,接收比较电路将经包络检波电路检波后的电压信号和系统设置的参考电压进行比较,根据比较结果输出数字信号,并将输出信号经反相器反向后送给单片机的外部中断控制口,外部中断控制口设为跳变触发,当外部中断控制口接收到有效下降沿后,单片机产生中断,记录当前时刻的定时器值,单片机中断三次后定时器停止计时;步骤5:通过计算三次记录的定时器值的平均值和晃动梯度,其中晃动梯度为三次测得时最大值与最小值的差值,将平均值和晃动梯度作为神经网络所需的输入参量,将这两个参量发送给已训练好的神经网络数学模型,并获得经神经网络的输出值,输出值为当前时刻的液位值。An ultrasonic dynamic liquid level detection method based on a neural network, comprising: Step 1: the single-chip microcomputer utilizes an ultrasonic transmitting circuit to send control signals to three ultrasonic sensors, and simultaneously starts a timer to start timing and excites the three-way ultrasonic transmitting circuit to generate pulsed ultrasonic waves; 2: The ultrasonic wave is reflected after meeting the liquid surface, and the three ultrasonic sensors respectively receive the reflected echo signal, convert the echo signal into a voltage signal, and send the voltage signal to the preamplifier circuit, step 3: before After the preamplifier circuit receives the voltage signal, the voltage signal amplified by the preamplifier circuit is sent to the ultrasonic receiving and detecting circuit to realize the envelope detection of the high frequency input signal; step 4: the voltage detected by the envelope detecting circuit The signal is sent to the receiving comparison circuit, and the receiving comparison circuit compares the voltage signal detected by the envelope detection circuit with the reference voltage set by the system, outputs a digital signal according to the comparison result, and sends the output signal to The external interrupt control port of the single-chip microcomputer, the external interrupt control port is set as a jump trigger, when the external interrupt control port receives a valid falling edge, the single-chip microcomputer generates an interrupt, records the timer value at the current moment, and the timer stops timing after the single-chip microcomputer interrupts three times; Step 5: By calculating the average value and shaking gradient of the timer values recorded three times, wherein the shaking gradient is the difference between the maximum value and the minimum value during the three measurements, the average value and shaking gradient are used as the input parameters required by the neural network, Send these two parameters to the trained neural network mathematical model, and obtain the output value through the neural network, the output value is the liquid level value at the current moment.
进一步的,上述基于神经网络的超声波动态液位检测方法,还包括:神经网络的数学模型的误差函数为:Further, the above-mentioned ultrasonic dynamic liquid level detection method based on the neural network also includes: the error function of the mathematical model of the neural network is:
其中,N为训练样本数,y(t)为t时刻BP神经网络输出,yd(t)为t时刻期望输出值;用BP算法训练神经网络时,调整网络的连接权值,其调整表达式为:Among them, N is the number of training samples, y(t) is the output of the BP neural network at time t, and y d (t) is the expected output value at time t; when using the BP algorithm to train the neural network, adjust the connection weight of the network, and its adjustment expression The formula is:
其中,w(t)为t时刻的神经网络的连接权值,w(t+1)为(t+1)时刻神经网络的连接权值,E(t)为t时刻神经网络的均方误差,η为学习速率。Among them, w(t) is the connection weight of the neural network at time t, w(t+1) is the connection weight of the neural network at time (t+1), and E(t) is the mean square error of the neural network at time t , η is the learning rate.
进一步的,上述基于神经网络的超声波动态液位检测方法,采用三个超声波传感器组成阵列结构,同步激励发射脉冲超声波,利用定长时窗内接收的回波信号包络提取瞬时液面反射点的时延信息。Further, the above-mentioned ultrasonic dynamic liquid level detection method based on neural network adopts three ultrasonic sensors to form an array structure, synchronously stimulates and emits pulsed ultrasonic waves, and uses the envelope of echo signals received in a fixed-length time window to extract the instantaneous liquid surface reflection point. Latency information.
一种基于神经网络的超声波动态液位检测系统,包括:单片机、调理电路和三个超声波传感器;其中,单片机用于加载了神经网络的数学模型,基于神经网络的数学模型控制和处理超声波动态液位检测;调理电路包括了超声波发射电路、超声波接收前置放大电路、超声波接收信号放大电路、超声波接收检波电路、超声波接收比较电路和单片机外围电路六部分组成,超声波发射电路用于产生脉冲超声波,由单片机控制实现三路同时发射信号,产生与超声波传感器探头频率相近的高压脉冲,激励超声传感器同时发射脉冲超声波;超声波接收前置放大电路由电荷放大器组成,实现与超声接收换能器的阻抗匹配;超声波接收信号放大电路由两级反相放大器组成,实现对微弱超声回波电压信号的放大;超声波接收检波电路由二极管峰值包络检波电路组成,实现对高频输入电压信号的包络检波;超声波接收比较电路将经包络检波电路检波后的电压信号和系统设置的参考电压进行比较,根据比较结果输出数字信号,并将输出信号经反相器反向后送给单片机的外部中断控制口,外部中断控制口设为跳变触发,当外部中断控制口接收到有效下降沿后,单片机产生中断,记录当前时刻的定时器值,单片机中断三次后定时器停止计时;单片机外围电路由晶振电路、复位电路、液晶显示电路组成,共同构成动态液位检测的核心控制部分。An ultrasonic dynamic liquid level detection system based on a neural network, including: a single-chip microcomputer, a conditioning circuit and three ultrasonic sensors; wherein, the single-chip microcomputer is used to load the mathematical model of the neural network, and the mathematical model based on the neural network controls and processes the ultrasonic dynamic liquid level. Bit detection; the conditioning circuit includes six parts: ultrasonic transmitting circuit, ultrasonic receiving preamplifier circuit, ultrasonic receiving signal amplifier circuit, ultrasonic receiving detection circuit, ultrasonic receiving comparison circuit and single-chip peripheral circuit. The ultrasonic transmitting circuit is used to generate pulsed ultrasonic waves. It is controlled by a single-chip microcomputer to realize three-way simultaneous transmission of signals, generating high-voltage pulses with a frequency similar to that of the ultrasonic sensor probe, and stimulating the ultrasonic sensor to transmit pulsed ultrasonic waves at the same time; the ultrasonic receiving preamplifier circuit is composed of a charge amplifier to achieve impedance matching with the ultrasonic receiving transducer The ultrasonic receiving signal amplifying circuit is composed of two-stage inverting amplifiers, which realize the amplification of the weak ultrasonic echo voltage signal; the ultrasonic receiving and detecting circuit is composed of a diode peak envelope detecting circuit, which realizes the envelope detecting of the high-frequency input voltage signal; The ultrasonic receiving comparison circuit compares the voltage signal detected by the envelope detection circuit with the reference voltage set by the system, outputs a digital signal according to the comparison result, and sends the output signal to the external interrupt control port of the microcontroller after being reversed by the inverter , the external interrupt control port is set as a jump trigger, when the external interrupt control port receives a valid falling edge, the microcontroller generates an interrupt, records the timer value at the current moment, and the timer stops timing after the microcontroller interrupts three times; the peripheral circuit of the microcontroller is composed of a crystal oscillator circuit , reset circuit, and liquid crystal display circuit, which together constitute the core control part of dynamic liquid level detection.
进一步的,上述系统加载的神经网络的数学模型的误差函数为:Further, the error function of the mathematical model of the neural network loaded by the above system is:
其中,N为训练样本数,y(t)为t时刻BP神经网络输出,yd(t)为t时刻期望输出值;Among them, N is the number of training samples, y(t) is the output of BP neural network at time t, and y d (t) is the expected output value at time t;
用BP算法训练神经网络时,调整网络的连接权值,其调整表达式为:When using the BP algorithm to train the neural network, adjust the connection weight of the network, and the adjustment expression is:
其中,w(t)为t时刻的神经网络的连接权值,w(t+1)为(t+1)时刻神经网络的连接权值,E(t)为t时刻神经网络的均方误差,η为学习速率。Among them, w(t) is the connection weight of the neural network at time t, w(t+1) is the connection weight of the neural network at time (t+1), and E(t) is the mean square error of the neural network at time t , η is the learning rate.
进一步的,上述系统采用三个超声波传感器组成阵列结构,同步激励发射脉冲超声波,利用定长时窗内接收的回波信号包络提取瞬时液面反射点的时延信息。Furthermore, the above system uses three ultrasonic sensors to form an array structure, synchronously stimulates and emits pulsed ultrasonic waves, and uses the envelope of echo signals received in a fixed-length time window to extract time-delay information of instantaneous liquid surface reflection points.
进一步的,上述系统中单片机是AT89S52单片机。Further, the single-chip microcomputer in the above-mentioned system is an AT89S52 single-chip microcomputer.
综合上述两个技术方案,本发明提出的一种基于神经网络的超声波动态液位检测方法和系统,可以实现动态检测液位。Combining the above two technical solutions, the present invention proposes an ultrasonic dynamic liquid level detection method and system based on a neural network, which can realize dynamic liquid level detection.
附图说明Description of drawings
图1为本发明实施例中超声波传感器布阵示意图;Fig. 1 is a schematic diagram of an array of ultrasonic sensors in an embodiment of the present invention;
图2为本发明实施例中检测方法原理示意图;Fig. 2 is the principle schematic diagram of detection method in the embodiment of the present invention;
图3为本发明实施例中一组超声传感器回波信号;Fig. 3 is a group of ultrasonic sensor echo signals in the embodiment of the present invention;
图4为本发明实施例中训练误差曲线;Fig. 4 is the training error curve in the embodiment of the present invention;
图5为本发明实施例中神经网络的检测结果。Fig. 5 is the detection result of the neural network in the embodiment of the present invention.
具体实施方式detailed description
下面结合附图对本发明的技术方案进行详细说明:The technical scheme of the present invention is described in detail below in conjunction with accompanying drawing:
首先,介绍一下BP神经网络,BP神经网络又称为误差反向传播神经网络,在BP网络中,信号是前向传播的,误差是反向传播的。在前向传播过程中,输入信号经输入层、隐含层,逐层处理,并传向输出层。信号在输出层如果不能得到期望的输出,则转入反向传播过程,将误差值逐层反向传送,并修正各层连接权值。对于给定的一组训练样本,不断用一个模式训练网络,重复前向传播和误差反向传播过程,直至网络输出误差小于给定值为止。BP算法沿着梯度的反方向改变权值和偏差。定义误差函数为:First, introduce the BP neural network. The BP neural network is also called the error backpropagation neural network. In the BP network, the signal is propagated forward, and the error is propagated backward. In the process of forward propagation, the input signal is processed layer by layer through the input layer and the hidden layer, and then transmitted to the output layer. If the signal cannot get the expected output at the output layer, it will be transferred to the back propagation process, and the error value will be reversed layer by layer, and the connection weights of each layer will be corrected. For a given set of training samples, the network is continuously trained with a pattern, and the process of forward propagation and error back propagation is repeated until the network output error is less than a given value. The BP algorithm changes the weights and biases along the opposite direction of the gradient. Define the error function as:
其中,N为训练样本数,y(t)为t时刻BP神经网络输出,yd(t)为t时刻期望输出值。Among them, N is the number of training samples, y(t) is the output of BP neural network at time t, and y d (t) is the expected output value at time t.
用BP算法训练网络时,调整网络的连接权值,其调整表达式为:When using the BP algorithm to train the network, adjust the connection weight of the network, and the adjustment expression is:
其中,w(t)为t时刻的神经网络的连接权值,w(t+1)为(t+1)时刻神经网络的连接权值,E(t)为t时刻神经网络的均方误差,η学习速率。Among them, w(t) is the connection weight of the neural network at time t, w(t+1) is the connection weight of the neural network at time (t+1), and E(t) is the mean square error of the neural network at time t , η learning rate.
误差反传的BP算法是一个较为简单且实用的学习算法,标准的BP算法通常学习收敛速度较慢,而且容易陷入局部最小。The BP algorithm of error backpropagation is a relatively simple and practical learning algorithm. The standard BP algorithm usually has a slow learning convergence speed and is easy to fall into a local minimum.
下面介绍本发明的超声波动态液位检测方法,如图1所示,本发明提出了一种基于神经网络的超声波动态液位检测方法,包括:Introduce the ultrasonic dynamic liquid level detection method of the present invention below, as shown in Figure 1, the present invention proposes a kind of ultrasonic dynamic liquid level detection method based on neural network, comprising:
本发明实施例中采用三个超声传感器组成的阵列对动态液位进行监测,传感器阵列布设如图1所示。其中O为容器底部中心位置,A、B、C为三个超声波传感器的探头,a、b、c为和超声波传感器A、B、C所对应的液面反射点。In the embodiment of the present invention, an array composed of three ultrasonic sensors is used to monitor the dynamic liquid level, and the layout of the sensor array is shown in FIG. 1 . Among them, O is the center position of the bottom of the container, A, B, and C are the probes of the three ultrasonic sensors, and a, b, and c are the liquid surface reflection points corresponding to the ultrasonic sensors A, B, and C.
本发明实施了中的超声波动态液位检测的系统如图2所示,包括了单片机、调理电路和三个超声波传感器A、B、C。其中单片机可以是AT89S52单片机,用于控制和处理超声波动态液位检测。调理电路包括了超声波发射电路、超声波接收前置放大电路、超声波接收信号放大电路、超声波接收检波电路、超声波接收比较电路和单片机外围电路六部分组成,具体的:超声波发射电路用于产生脉冲超声波,由单片机控制实现三路同时发射信号,产生与超声波传感器探头频率相近的高压脉冲,激励超声传感器同时发射脉冲超声波;超声波接收前置放大电路由电荷放大器组成,实现与超声接收换能器的阻抗匹配;超声波接收信号放大电路由两级反相放大器组成,实现对微弱超声回波信号的放大;超声波接收检波电路由二极管峰值包络检波电路组成,实现对高频输入信号的包络检波;超声波接收比较电路将经包络检波电路检波后的脉冲信号和系统设置的参考电压进行比较,比较器将输出数字信号1或0,比较器的输出信号经反相器反向后送给单片机的外部中断控制口P3.2;单片机外围电路由晶振电路、复位电路、液晶显示电路组成,共同构成动态液位检测的核心控制部分。The system of ultrasonic dynamic liquid level detection in the implementation of the present invention is shown in Figure 2, which includes a single-chip microcomputer, a conditioning circuit and three ultrasonic sensors A, B, and C. Wherein the single-chip microcomputer may be AT89S52 single-chip microcomputer, which is used for controlling and processing ultrasonic dynamic liquid level detection. The conditioning circuit consists of six parts: ultrasonic transmitting circuit, ultrasonic receiving preamplifier circuit, ultrasonic receiving signal amplifier circuit, ultrasonic receiving detection circuit, ultrasonic receiving comparison circuit and single-chip peripheral circuit. Specifically: the ultrasonic transmitting circuit is used to generate pulsed ultrasonic waves, It is controlled by a single-chip microcomputer to realize three-way simultaneous transmission of signals, generating high-voltage pulses with a frequency similar to that of the ultrasonic sensor probe, and stimulating the ultrasonic sensor to transmit pulsed ultrasonic waves at the same time; the ultrasonic receiving preamplifier circuit is composed of a charge amplifier to achieve impedance matching with the ultrasonic receiving transducer ;The ultrasonic receiving signal amplification circuit is composed of two-stage inverting amplifiers, which realize the amplification of weak ultrasonic echo signals; The comparison circuit compares the pulse signal detected by the envelope detection circuit with the reference voltage set by the system, the comparator will output a digital signal 1 or 0, and the output signal of the comparator is reversed by the inverter and then sent to the external interrupt of the microcontroller Control port P3.2; the peripheral circuit of the single-chip microcomputer is composed of crystal oscillator circuit, reset circuit and liquid crystal display circuit, which together constitute the core control part of dynamic liquid level detection.
上述基于神经网络的超声波动态液位检测方法原理如下:检测时,三个超声波传感器A、B、C同时发射脉冲超声波,但由于三个超声波传感器的探头所对应的液位高度不同,所以,每个超声传感器接收到的回波时刻也不同,根据每个超声波传感器接收到的回波信号可以分别计算得到这三个探头的声波信号来回所用时间,然后计算得到每一个超声波传感器的探头所对应的液位高度,并选取这三个探头离液面的液位高度的平均值与晃动梯度作为特征参数,用以训练BP神经网络,得到动态液位的数学模型,然后将该模型应用于实时动态液位的监测中。由于三个探头分别布置于以容器底部中心为原点三个象限内,无论液体怎样晃动,三个探头测量的液位总有一个最大值和最小值,而最大值与最小值之差即可确定液体的晃动梯度。The principle of the above-mentioned ultrasonic dynamic liquid level detection method based on neural network is as follows: during detection, the three ultrasonic sensors A, B, and C emit pulsed ultrasonic waves at the same time, but since the liquid level heights corresponding to the probes of the three ultrasonic sensors are different, each The echo time received by each ultrasonic sensor is also different. According to the echo signal received by each ultrasonic sensor, the time used for the sound wave signal of the three probes to go back and forth can be calculated separately, and then the time corresponding to the probe of each ultrasonic sensor can be calculated. The liquid level height, and select the average value of the liquid level height of the three probes from the liquid surface and the sloshing gradient as the characteristic parameters to train the BP neural network to obtain the mathematical model of the dynamic liquid level, and then apply the model to the real-time dynamic liquid level monitoring. Since the three probes are respectively arranged in three quadrants with the center of the bottom of the container as the origin, no matter how the liquid shakes, the liquid level measured by the three probes always has a maximum value and a minimum value, and the difference between the maximum value and the minimum value can be determined Liquid sloshing gradient.
具体的基于神经网络的超声波动态液位检测过程如下:The specific process of ultrasonic dynamic liquid level detection based on neural network is as follows:
步骤1:单片机利用超声波发射电路向三个超声波传感器发送控制信号,同时启动定时器开始计时和激励三路超声波发射电路产生脉冲超声波;Step 1: The single-chip microcomputer uses the ultrasonic transmitting circuit to send control signals to the three ultrasonic sensors, and at the same time starts the timer to start timing and stimulates the three-way ultrasonic transmitting circuit to generate pulsed ultrasonic waves;
步骤2:超声波遇液面后反射,三个超声波传感器分别接收到反射后的回波信号后,并将回波信号转化为电压信号,并将该电压信号发送到前置放大电路;Step 2: The ultrasonic waves are reflected after meeting the liquid surface, and the three ultrasonic sensors respectively receive the reflected echo signals, convert the echo signals into voltage signals, and send the voltage signals to the preamplifier circuit;
步骤3:前置放大电路接收了电压信号后,经前置放大电路放大后的电压信号发送给超声波接收检波电路,实现对高频输入信号的包络检波;Step 3: After the pre-amplification circuit receives the voltage signal, the voltage signal amplified by the pre-amplification circuit is sent to the ultrasonic receiving and detecting circuit to realize the envelope detection of the high-frequency input signal;
步骤4:将经包络检波电路检波后的电压信号发送给接收比较电路,接收比较电路将经包络检波电路检波后的电压信号和系统设置的参考电压进行比较,根据比较结果输出数字信号,并将输出信号经反相器反向后送给单片机的外部中断控制口,外部中断控制口设为跳变触发,当外部中断控制口接收到有效下降沿后,单片机产生中断,记录当前时刻的定时器值,单片机中断三次后定时器停止计时;Step 4: Send the voltage signal detected by the envelope detection circuit to the receiving comparison circuit, and the receiving comparison circuit compares the voltage signal detected by the envelope detection circuit with the reference voltage set by the system, and outputs a digital signal according to the comparison result, And the output signal is reversed by the inverter and then sent to the external interrupt control port of the single chip microcomputer. The external interrupt control port is set as a jump trigger. When the external interrupt control port receives a valid falling edge, the single chip microcomputer generates an interrupt and records the current time. Timer value, the timer stops counting after the microcontroller is interrupted three times;
步骤5:通过计算三次记录的定时器值的平均值和晃动梯度,其中晃动梯度为三次测得时最大值与最小值的差值,将平均值和晃动梯度作为神经网络所需的输入参量,将这两个参量发送给已训练好的神经网络数学模型,并获得经神经网络的输出值,输出值为当前时刻的液位值。然后不断循环上述过程,系统便能实现对晃动液体进行实时动态地监测。本系统也可实现对静态液位的监测。静态液体晃动梯度小,接近为零,此时取三点测量的平均值作为静态液位值。Step 5: By calculating the average value and shaking gradient of the timer values recorded three times, wherein the shaking gradient is the difference between the maximum value and the minimum value during the three measurements, the average value and shaking gradient are used as the input parameters required by the neural network, Send these two parameters to the trained neural network mathematical model, and obtain the output value through the neural network, the output value is the liquid level value at the current moment. Then, the above-mentioned process is continuously circulated, and the system can realize real-time dynamic monitoring of the sloshing liquid. This system can also realize the monitoring of the static liquid level. The gradient of static liquid sloshing is small, close to zero, and the average value of three-point measurements is taken as the static liquid level value.
在本发明具体实施例中,优选的,超声波传感器均采用收发一体式,探头频率为1MHz。在实验室条件下,用手晃动铁罐中的水模拟液体在运输过程中的晃动,图3为实验中测得的三个超声波探头测量晃动液体时的不同回波信号,其中(a)、(b)、(c)分别为传感器A、B、C测得的回波信号。实施时,将液位从2cm到50cm测得的100组数据作为训练样本,在该范围内抽取十组数据作为测试样本。In a specific embodiment of the present invention, preferably, the ultrasonic sensors all adopt a transceiver-integrated type, and the probe frequency is 1 MHz. Under laboratory conditions, shake the water in the iron tank by hand to simulate the sloshing of the liquid during transportation. Figure 3 shows the different echo signals of the three ultrasonic probes measured in the experiment when the sloshing liquid is measured, where (a), (b), (c) are the echo signals measured by sensors A, B, and C respectively. During implementation, 100 sets of data measured from the liquid level from 2cm to 50cm are used as training samples, and ten sets of data are drawn within this range as test samples.
本发明实施例中的BP神经网络有两个输入参量,一个输出参量,则将BP网络的输入层设为2个神经元,隐含层设为一层,输出层为1个神经元。实施时设定神经网络的均方误差为1×10-5,学习速率为0.05,最大训练步数为500。通过实验可知当隐含层神经元个数为8时,训练次数最少,因此,选择2×8×1的网络进行训练。网络隐含层的传递函数为tansig,输出层为purelin。为使网络能够快速收敛,采用Levenberg-Marquardt的学习算法。由图4可知,网络经过90次训练后,网络的均方误差满足设计要求,网络停止训练。The BP neural network in the embodiment of the present invention has two input parameters and one output parameter, then the input layer of the BP network is set as 2 neurons, the hidden layer is set as one layer, and the output layer is 1 neuron. During implementation, the mean square error of the neural network is set to 1×10 -5 , the learning rate is 0.05, and the maximum number of training steps is 500. It can be seen from experiments that when the number of neurons in the hidden layer is 8, the number of training times is the least. Therefore, a network of 2×8×1 is selected for training. The transfer function of the hidden layer of the network is tansig, and the output layer is purelin. In order to make the network converge quickly, the learning algorithm of Levenberg-Marquardt is adopted. It can be seen from Figure 4 that after the network has been trained for 90 times, the mean square error of the network meets the design requirements, and the network stops training.
将10组测试样本输入训练好的BP神经网络,测试结果如图5所示。由图5可知,测试样本的总体相对误差较小,网络输出的准确性较高,且输出结果稳定。虽然网络训练时需要一定的时间,但网络训练好后,实际应用时所需时间极短,系统完全可以实现对动态液位进行监测。Input 10 groups of test samples into the trained BP neural network, and the test results are shown in Figure 5. It can be seen from Figure 5 that the overall relative error of the test sample is small, the accuracy of the network output is high, and the output result is stable. Although the network training takes a certain amount of time, after the network training is completed, the time required for practical application is extremely short, and the system can completely monitor the dynamic liquid level.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310401468.7A CN103499374B (en) | 2013-09-05 | 2013-09-05 | A kind of ultrasound wave dynamic liquid level detection method based on neutral net and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310401468.7A CN103499374B (en) | 2013-09-05 | 2013-09-05 | A kind of ultrasound wave dynamic liquid level detection method based on neutral net and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103499374A CN103499374A (en) | 2014-01-08 |
CN103499374B true CN103499374B (en) | 2016-06-15 |
Family
ID=49864605
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310401468.7A Expired - Fee Related CN103499374B (en) | 2013-09-05 | 2013-09-05 | A kind of ultrasound wave dynamic liquid level detection method based on neutral net and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103499374B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102023106819A1 (en) | 2023-03-17 | 2024-09-19 | Endress+Hauser SE+Co. KG | Determination of filling material properties |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104149720B (en) * | 2014-09-01 | 2016-03-09 | 江苏大学 | Vehicle liquid level accurate measurements under a kind of complex working condition and response at different level method |
CN105241524B (en) * | 2015-10-26 | 2018-03-20 | 河海大学常州校区 | A kind of city flood warning system and method based on radial basis function neural network model |
CN106992819B (en) * | 2017-04-10 | 2022-12-16 | 杭州戬威科技有限公司 | Ultrasonic signal excitation, control, reception, conditioning and communication system |
CN107506798B (en) * | 2017-08-31 | 2020-07-10 | 四创科技有限公司 | Water level monitoring method based on image recognition |
CN107796488B (en) * | 2017-11-16 | 2019-12-24 | 西安交通大学 | A liquid level sloshing test bench based on a motion platform and an ultrasonic liquid level sensor |
CN113325273A (en) * | 2020-02-28 | 2021-08-31 | 西门子股份公司 | Arc fault detection method and device |
CN111351518A (en) * | 2020-03-17 | 2020-06-30 | 交通运输部公路科学研究所 | Intelligent sensing equipment and method for safety of highway bridge structure |
CN111580570B (en) * | 2020-05-28 | 2023-03-17 | 爱瑟福信息科技(上海)有限公司 | Container liquid level monitoring method and system |
CN111982207A (en) * | 2020-09-17 | 2020-11-24 | 西安多普多信息科技有限公司 | Tank car liquid temperature sensor based on artificial neural network algorithm and method thereof |
CN112325981B (en) * | 2020-11-03 | 2023-12-26 | 常州市鼎兴电子有限公司 | Optimal matching parameter design method for inductive liquid level sensor |
CN113566929A (en) * | 2021-09-27 | 2021-10-29 | 山东西王食品有限公司 | Oil tank liquid level ultrasonic measurement method, system, terminal and storage medium based on LSTM |
CN115122642B (en) * | 2022-05-31 | 2024-11-01 | 深圳市纵维立方科技有限公司 | Fault detection method in 3D printing, 3D printer and equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE4014990A1 (en) * | 1990-05-10 | 1991-11-14 | Herbert Prof Dr Zott | Liquid lever measurement arrangement - uses ultrasonic pulse reflection from surface and transition time measurement for use with moving or static liquid e.g. in vehicle fuel tank |
CN1441896A (en) * | 2000-07-13 | 2003-09-10 | 西蒙兹精密产品公司 | Liquid gauging apparatus using time delay neural network |
CN1761859A (en) * | 2003-01-28 | 2006-04-19 | 波音公司 | Ultrasonic fuel-gauging system |
CN101246034A (en) * | 2008-03-07 | 2008-08-20 | 厦门大学 | Acoustic Level Alarms for Reservoir Tanks |
-
2013
- 2013-09-05 CN CN201310401468.7A patent/CN103499374B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE4014990A1 (en) * | 1990-05-10 | 1991-11-14 | Herbert Prof Dr Zott | Liquid lever measurement arrangement - uses ultrasonic pulse reflection from surface and transition time measurement for use with moving or static liquid e.g. in vehicle fuel tank |
CN1441896A (en) * | 2000-07-13 | 2003-09-10 | 西蒙兹精密产品公司 | Liquid gauging apparatus using time delay neural network |
CN1761859A (en) * | 2003-01-28 | 2006-04-19 | 波音公司 | Ultrasonic fuel-gauging system |
CN101246034A (en) * | 2008-03-07 | 2008-08-20 | 厦门大学 | Acoustic Level Alarms for Reservoir Tanks |
Non-Patent Citations (1)
Title |
---|
基于ARM的油罐车油位测量系统的设计与研究;杨洪军;《中国优秀硕士学位论文全文数据库 工程科技I辑》;20120115;全文 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102023106819A1 (en) | 2023-03-17 | 2024-09-19 | Endress+Hauser SE+Co. KG | Determination of filling material properties |
Also Published As
Publication number | Publication date |
---|---|
CN103499374A (en) | 2014-01-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103499374B (en) | A kind of ultrasound wave dynamic liquid level detection method based on neutral net and system | |
CN110186546B (en) | A free-field broadband calibration method for hydrophone sensitivity based on pink noise | |
CN100545591C (en) | Be used to measure the system and method for bin capacity | |
CN102944608B (en) | Device and method for ultrasonic testing of corrugated pipe duck grouting compactness | |
CN105092430B (en) | A kind of grain graininess measurement apparatus and method based on diverging ultrasonic attenuation | |
CN101881832B (en) | Method and device for measuring object position by ultrasonic wave | |
CN103163324A (en) | Detecting system and measuring method of three-dimensional ultrasonic wind speed temperature of wind power plant | |
CN108344802A (en) | A kind of no reference signal Active Lamb Wave damage intelligent locating method | |
CN109323968B (en) | Calibration system and method applied to dust cloud cluster concentration field distribution | |
EP4092402B1 (en) | Device and method for rapidly detecting blood viscosity based on ultrasonic guided waves of micro-fine metal pipe | |
CN103018481A (en) | Three-dimensional ultrasonic wind meter with temperature correction and measurement method thereof | |
CN103969639B (en) | The signal processing system of five wave beam fish detectors and signal processing method thereof | |
CN103490754A (en) | Ultrasonic signal with large time bandwidth product and ultrasonic signal pulse compression method and system | |
CN100395547C (en) | Concrete pouring pile quality inspection system | |
CN105004413A (en) | Acoustic propagation path comprehensive speed measuring method and apparatus for underwater target positioning | |
CN105842477A (en) | Current surveying method by means of acoustic Doppler current meter | |
CN103591975A (en) | Ultrasonic wave sensor index detection method and device | |
CN108802189A (en) | A kind of sound detecting pipe bending velocity of sound correcting device and method | |
CN103075981B (en) | A kind of ultrasonic thickness test method | |
CN101828929A (en) | Vector measurement method of Doppler blood flow velocity by utilizing apparent displacement | |
CN102841343A (en) | Echo sounding apparatus calibration system based on industrial computer and calibration method | |
CN103454643A (en) | Method for accurately measuring constant sound pressure FSK ultrasonic wave transition time | |
CN106371098B (en) | One kind having free decaying vibration ultrasonic ranging system frequency inflection point method of discrimination | |
CN101936953B (en) | Pipeline delay-based system and method for measuring concentrations of components of fruit juice sugar | |
CN201698020U (en) | Ultrasonic device for measuring the position of objects |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160615 Termination date: 20170905 |
|
CF01 | Termination of patent right due to non-payment of annual fee |