<<

applied sciences

Article An Indirect Measurement Method for Gas Consumption of a Diaphragm Gas Meter Based on Gas Pressure Signal Detection

Zhao Han , Xiaoli Wang *, Baochen Jiang and Xiaopeng Chen

School of Mechanical, Electrical and Information Engineering, Shandong University, Weihai 264209, China; [email protected] (Z.H.); [email protected] (B.J.); [email protected] (X.C.) * Correspondence: [email protected]; Tel.: +86-138-6302-6640

 Received: 19 March 2019; Accepted: 31 May 2019; Published: 18 June 2019 

Featured Application: This indirect measurement method can be utilized to improve the remote meter reading technology for gas meter.

Abstract: At present, the remote meter reading problem for a large number of existing domestic diaphragm gas meters has not been reliably solved. The diaphragm gas meter uses a physical structure to measure gas consumption, so the main problem of remote meter reading is the digitization of gas consumption. Although it is possible to digitize the consumption data by modifying the internal structure of the gas meter or adding sensors, thereby realizing the function of remote meter reading, the modification process is complicated, the modification cost is high, and manual meter reading can only be used for the existing diaphragm gas meters. For this reason, this paper proposes an indirect measurement method of gas consumption based on gas pressure signal detection. The method can digitalize the metering results of the mechanical diaphragm gas meter and develop a state detection function by analyzing the pressure signal of the outlet of the meter without modifying the internal structure of a meter, thus addressing the key difficulties in the construction of a gas meter remote meter reading system. The experimental results show that this method has small calculation error and high reliability.

Keywords: remote meter reading; diaphragm gas meter; gas pressure signal detection; digitization

1. Introduction With the rapid development of modern computer technology and communication technology, the remote intelligent collection of domestic gas meter, water meter, electric energy meter and thermal energy meter information has become a major priority. The remote meter reading scheme has obvious technological advancement and economic advantages, while the traditional artificial way to check meters has many drawbacks and cannot meet the requirements of the new form. The remote meter reading system can transmit the data displayed on the user’s gas meter to the server of the gas company in a timely manner [1]. Currently, the remote meter reading system is widely used in developed countries. Mechanical diaphragm gas meters are still widely used. Digitizing the gas measurement results of the existing gas meters has the following advantages. Firstly, using an intelligent meter reading method instead of the traditional manual meter reading method can greatly reduce the cost of labor. Secondly, the digital gas metering terminal can monitor the state of the user’s gas usage in real time, thereby facilitating remote control. Thirdly, the intelligent gas meter can improve the safety of users’ gas equipment and reduce the accident rate of gas leakage. In addition, the digital measurement

Appl. Sci. 2019, 9, 2475; doi:10.3390/app9122475 www.mdpi.com/journal/applsci Appl. Sci. 2019, 9, 2475 2 of 14 results can be adjusted according to and pressure to improve the accuracy of measurement results. At present, there are a large number of traditional mechanical diaphragm gas meters in the user market, which makes it difficult to install and popularize intelligent gas management equipment. Scholars in China and abroad have put forward some intelligent management schemes for diaphragm gas meters, among which the transformation of the meter body can be mainly classified as adding image processing equipment and changing the internal structure. Cai Shun studies a remote control gas meter reading system based on ZigBee wireless communication technology and digital image recognition technology [2]. In this scheme, the sensor node takes a picture of the gas meter using a CMOS camera, and sends it to the sink node through a multi-hop ZigBee network in the residential area. Similar to the above method, Kun Wang studies a remote gas meter reading system based on a wireless communication technology named LoRa [3]. This scheme mainly includes a machine vision system and a wireless communication system. The former refers to acquiring the image information of the dial of a diaphragm gas meter, and then obtaining the value by using image processing. The latter involves using the LoRa module to send the gas consumption data to the server. Although these methods have high credibility and do not require changing the existing gas meter and gas pipelines, they demand high levels of the image transmission and processing algorithm’s efficiency and the computer hardware used to process pictures. Ying Xie utilizes the M-Bus networks and GPRS wireless transmission technology to achieve remote control and transmission of data using the gas meter [4]. In the paper, the author mounts the nonmetallic-metal rotating wheel on the character wheel. The MSP430FW427 generates the excitation signal to the LC circuit to produce damped oscillation. When the inductor is in the nonmetallic film, the damping attenuation becomes smaller, while when the inductor is not in the nonmetallic film, it becomes larger. Finally, the rotation of the character wheel is recognized by detecting the status of the inductor. The biggest drawback of this retrofit method is that the diaphragm gas meter needs to be disassembled and reconstructed. M.Tewolde studies the intelligent meter reading scheme based on AC-250 film gas meter produced by the American Meter Company [5]. The scheme involves installing the Omega FMA3340 high-precision airflow meter and pressure detecting device at the gas outlet of the diaphragm gas meter, and then adding an optical encoder to the gas meter gear to obtain the rotation parameters. This method can achieve high-precision gas metering and gas leakage monitoring, but the method is carried out in an ideal experimental environment without considering the actual gas network pressure fluctuations and noise. In addition, the retrofit of the solution is costly and requires the disassembly of the gas meter. In general, intelligent management schemes for existing diaphragm gas meter have complicated transformation steps and high costs, and are not suitable for the existing large number of conventional membrane gas meters. In view of the above problems, this paper proposes an indirect gas measurement method by analyzing the working principle of the automatic gas meter and the pressure value of the gas outlet. The method can realize the digital transformation of the gas consumption data with high reliability, low cost and easy implementation without requiring any modification or disassembly of the meter. The rest of this paper is organized as follows. In Section2, some related principles about diaphragm gas meter are presented. Section3 introduces the gas consumption measurement method proposed in the paper and the associated key technologies. Section4 analyzes the rationality of this method. Section5 illustrates the experimental process and results. Conclusions are presented in Section6.

2. Related Theory

2.1. Working Principle of Diaphragm Gas Meter The gas meter is mainly composed of a movable diaphragm, measuring chamber, rotating and connecting lever. The chamber is composed of left and right measuring chambers. Each measuring chamber is divided into two small measuring chambers by the diaphragm. Within the meter there are four small measuring chambers with the same structure. The diaphragm can expand and contract with the filling and discharging of the gas, and the two chambers separated by the diaphragm have Appl. Sci. 2019, 9, 2475x FOR PEER REVIEW 33 of of 1415

and contract with the filling and discharging of the gas, and the two chambers separated by the thediaphragm opposite have states the of opposite intake and states exhaust. of intake The rotatingand exhaust. valve The installed rotating above valve the installed metering above chamber the ismetering connected chamber with theis connected diaphragm with through the diaphragm a linkage th rod,rough so thata linkage the inlet rod, and so that outlet the of inlet the and meter outlet are connectedof the meter alternately. are connected When alternately. a chamber When is switched a chambe fromr is intakeswitched state from to outflowintake state state, to theoutflow other state, side ofthe the other chamber side of is the forced chamber to reciprocate. is forced to This reciproc periodicate. This alternating periodic movement alternating is movement passed through is passed the mechanicalthrough the linkagemechanical device, linkage and thedevice, gas consumptionand the gas consumption is recorded [ 6is– 8recorded]. [6–8]. 2.2. Indirect Calculation of Gas Consumption 2.2. Indirect Calculation of Gas Consumption Because the working state of the internal mechanism of the diaphragm gas meter shows periodic Because the working state of the internal mechanism of the diaphragm gas meter shows periodic variation characteristics, the gas pressure at the outlet will also produce periodic fluctuations of variation characteristics, the gas pressure at the outlet will also produce periodic fluctuations of increased and reduced pressure. The gas pressure waveform at the outlet of a diaphragm gas meter increased and reduced pressure. The gas pressure waveform at the outlet of a diaphragm gas meter at a fixed exhaust rate detected by the Omega PX409 high-precision gas pressure sensor (Omega at a fixed exhaust rate detected by the Omega PX409 high-precision gas pressure sensor (Omega Engineering Inc., Norwalk, CT, USA) is shown in Figure1. Engineering Inc., Norwalk, CT, USA) is shown in Figure 1.

Figure 1. The gas pressure waveform at the outlet of a diaphragm gas meter.

The Figure1 1 indicates indicates thatthat thethe gasgas pressurepressure willwill periodicallyperiodically shiftshift upup andand down,down, andand thethe pressurepressure will fluctuatefluctuate greatly over a long period of time du duee to the pressure disturbance of the pipe pipe network. network. Because the periodic fluctuation fluctuation of the gas pressure at the outlet is caused by the reciprocatingreciprocating movement of the diaphragm in the internal chamberchamber of the gas meter, thethe relationshiprelationship between the T T pressure signal period 𝑇s and and thethe timetime 𝑇vrequired required for for the the fixed fixed volume volumeto to bebe dischargeddischarged byby thethe gas meter can be expressed by Ts = Tv. (1) 𝑇 =𝑇. (1) When the intake is fixed and the running time of the diaphragm gas meter is t, the gas throughput When thet intake is fixed and the running time of the diaphragm gas meter is 𝑡 , the gas is equal to T fixed volume gas discharged by the diaphragm gas meter, and the volume can be throughput iss equal to fixed volume gas discharged by the diaphragm gas meter, and the volume calculated by t can be calculated by V = C , (2) × Ts 𝑉=𝐶× , (2) where C is the fixed gas capacity of the diaphragm gas meter, usually 1.2 dm3 in China; t is the use timewhere of 𝐶 the isgas the underfixed gas a fixed capacity intake; of Tthes is diaphragm the periodic gas value meter, of theusually pressure 1.2dm signal in China; of the outlet𝑡 is the of use the gastime meter; of the Vgasis under the volume a fixed of intake; the gas 𝑇 discharged is the periodic from thevalue meter. of the pressure signal of the outlet of the gas meter; 𝑉 is the volume of the gas discharged from the meter.

3. An Indirect Measurement Method for Gas Consumption Appl. Sci. 2019, 9, 2475 4 of 14

Appl. Sci. 2019, 9, x FOR PEER REVIEW 4 of 15 3. An Indirect Measurement Method for Gas Consumption 3.1. MeasuringAppl. Sci. 2019 Process, 9, x FOR PEER REVIEW 4 of 15 3.1. Measuring Process Figure3.1. Measuring 2 shows Process that the indirect calculation process of gas consumption mainly consists of five mainFigure steps,2 showswhich thatare thethe indirect ignition calculation detection, process gas pressure of gas consumption data collection, mainly removal consists of fivepressure main Figure 2 shows that the indirect calculation process of gas consumption mainly consists of five fluctuationsteps,main which steps, of are the thewhich pipe ignition arenetwork the detection, ignition and firedetection, gas transition pressure gas datapressurepoint collection, detection, data collection, removal the detection removal of pressure of pressureweak fluctuation signal periods,of thefluctuation pipe and network the ofcorrection the and pipe fire accordingnetwork transition and to point gasfire tempertransition detection,ature point the and detectiondetection, pressure. ofthe The weak detection detailed signal of process periods,weak signal is and shown the incorrection Figureperiods, 3. according and the correction to gas temperature according to and gas pressure.temperature The and detailed pressure. process The detailed is shown process in Figureis shown3. in Figure 3.

Gas pressure data Detect fire transition points and Ignition detection Gas pressure data Detect fire transition points and Ignition detection collection remove pipe network fluctuations collection remove pipe network fluctuations

Correction by gas Correction by gas Period detection Period detection temperaturetemperature and and pressurepressure

FigureFigure 2. TheThe 2. The block block block diagram diagram of of indirect indirect calculation of of gas gas consumption. consumption.

BEGINBEGIN

Flow velocity N Flow velocity Ignition detection N detection module Ignition detection detection module of heat source of heat source Y Record the Yjump value Recordof gas the flow jump sensor value of gas flow sensor

Temperature and pressure DPS310 detection Temperature and pressure DPS310 detection Detect pressure N jump point DPS310 Detect pressure N DPS310 jump pointY

The data lengthY value satisfies the requirement N The data length value satisfies the requirementY Pipe network N fluctuation removal Y Pipe network Period extraction fluctuation removal

Calculate gas Y PeriodThe extraction extraction cycle consumption is reasonable

Calculate gas Y The extractionN cycle consumption isApproximate reasonable Flow velocity measurement of detection module of heat source gas consumptionN Approximate Flow velocity Correction by gas detection module temperaturemeasurement and pressure of gas consumption of heat source Flow velocity N Turn off the fire detection module Correction by gas of heat source temperature andY pressure END Flow velocity N Turn off the fire detection module FigureFigure 3. The3. The gas gas consumption consumption indirect measurement measurement process. process.of heat source Y END

Figure 3. The gas consumption indirect measurement process. Appl.Appl. Sci.Sci.2019 2019,,9 9,, 2475 x FOR PEER REVIEW 5 ofof 1415

As is shown in Figure 3, firstly, the system detects the firing state by means of the flow velocity As is shown in Figure3, firstly, the system detects the firing state by means of the flow velocity detection module of heat source type. When the user turn on a , the flow rate of the internal detection module of heat source type. When the user turn on a gas stove, thedm flow rate of the internal combustion gas in the pipeline is raised from the static state to 0.1–0.15 3 instantly, and the flow dm combustion gas in the pipeline is raised from the static state to 0.1–0.15 s instantly, and the flow sensorsensor will will produce produce a a sharp sharp jump jump along along the the rising rising edge. edge. The The jump jump value valu ofe of the the rising rising edge edge is similaris similar to theto the gas gas velocity velocity in a singlein a single stove stove with highwith fire, high so fire the, valueso the of value the rising of the edge rising is recorded edge is asrecorded a reference as a forreference the flow for velocity the flow interval. velocity When interval. the When firing the state firing is detected, state is thedetected gas temperature, the gas temperature and pressure and arepressure continuously are continuously detected by detected DPS310 gasby DPS310 temperature gas temperature and pressure and sensor pressure (Infineon sensor Technologies, (Infineon Neubiberg,Technologies, Germany), Neubiberg, and Germany), the sampling and frequency the samplin is 6g times frequency per second. is 6 times The per user’s second. fire conversion The user's operationfire conversion is detected operation through is detected pressure through jump. Whenpressure the jump. fire conversion When the operationfire conversion is detected, operation if the is arraydetected, length if the meets array the length requirements meets the of requirements period extraction, of period the pressure extraction, baseline the pressure drift of baseline the pressure drift arrayof the pipeline pressure network array pipeline will be netw fittedork and will filtered. be fitted Afterwards, and filtered. the Afterwards, pressure signal the pressure obtained signal after filteringobtained the after baseline filtering will the be extractedbaseline will and be verified extracted by an and average verified magnitude by an average different magnitude function (AMDF)different algorithmfunction (AMDF) [9]. However, algorithm if the [9]. length However, of the if array the leng doesth not of the meet array the requirementdoes not meet of the period requirement extraction, of anperiod approximate extraction, gas an measurement approximate gas is obtained measurement by the is recorded obtained value by the of recorded the velocity value sensor. of the velocity Finally, whensensor. the Finally, fire is turnedwhen the off, fire the gasis turned temperature off, the and gas pressure temperature are corrected and pressure and the are data corrected are uploaded and the todata the are gas uploaded management to the terminal gas management through the terminal DSP (Digital through Signal the Processor), DSP (Digital and Signal the gas Processor), consumption and meteringthe gas consumption process is over. metering process is over.

3.2.3.2. KeyKey TechnologiesTechnologies

3.2.1.3.2.1. IgnitionIgnition andand FireFire ooffff Detection Detection TheThe operationoperation ofof ignitingigniting andand turningturning ooffff needs needs toto bebe detecteddetected byby a a gas gas velocity velocity sensor. sensor. TheThe samplingsampling rate rate of of the the sensor sensor is is set set to to 6 times6 times per per second. second. Before Before the the user user executes executes the ignitingthe igniting action, action, the outputthe output A/D A/D voltage voltage of the of velocitythe velocity sensor sensor module module is stable is stable in a in certain a certain range range and and the signalthe signal has has no obviousno obvious jump. jump. At thisAt this time, time, the the reference reference value valueVc of𝑉 the of sensorthe sensor shutting shutting off fireoff fire velocity velocity should should be recorded.be recorded. When When the user the executesuser executes the igniting the igniting operation, operation, the gas velocitythe gas of velocity the outlet of ofthe the outlet diaphragm of the gasdiaphragm meter increases gas meter instantaneously, increases instantaneously, and the output and signal the output of the flowsignal velocity of the sensorflow velocity clearly sensor shifts upward.clearly shifts The outputupward. waveforms The output of the waveforms flow velocity of the sensor flow in velocity the state sensor of multiple in the ignition state of operation multiple andignition maximum operation fire inand a stovemaximum are shown fire in in a Figurestove are4. shown in Figure 4.

FigureFigure 4.4. TheThe outputoutput waveformswaveforms ofof thethe flowflow velocityvelocity sensor.sensor.

Usually,Usually, when when the the user user uses uses a a gas gas stove, stove, the the ignitionignitionstove stoveknob knobis ispressed presseddown downto to increaseincreasethe the gasgas outputoutput of of the the gas gas cooker. cooker. Tests Tests on on 11 11 di ffdifferenterent brands brands of domesticof domestic natural gas stoves stoves show show that that the Appl. Sci. 2019, 9, 2475 6 of 14

Appl. Sci. 2019, 9, x FOR PEER REVIEW 6 of 15 difference between gas flow rate Vo and Vc in this case is about 1.1 times of that VB1 when the fire is at thethe maximumdifference levelbetween in a gas stove, flow which rate is𝑉 shown and 𝑉 as in this case is about 1.1 times of that 𝑉B1 when the fire is at the maximum level in a stove, which is shown as Vo Vc − = V . (3) =𝑉B1. 1.1. B1 (3) WhenWhen thethe ignitingigniting operation operation is is detected, detected, the the peak peak value value near near the the igniting igniting jump jump is extracted is extracted as the as referencethe reference value value of the of gasthe flowgas flow velocity velocity in a in single a single stove stove of maximum of maximum fire. fire. When When the the user user turns turns off theoff the fire, fire, the valuethe value of the of flowthe flow velocity velocity sensor sens willor will quickly quickly fall backfall back to the to vicinitythe vicinity of V ofc. Therefore,𝑉. Therefore, the otheff-fire off-fire operation operation can be can detected be detected by comparing by comparing the output the output value Vvalueof the 𝑉 flow of the velocity flow velocity sensor with sensorVc.

Thewith process 𝑉. The of process igniting of andigniting turning and o turningff fire detection off fire detection is shown is in shown Figure 5in. Figure 5.

BEGIN

Read the output value of the velocity sensor VF and store it in the array VFLOW

The average value of the VFLOW array is used as the reference value of the Voff

Retain the most recent The update value is VF’ and two VF values, leaving compared with the original valu e VF the remaining data zero

N VF’-VF > 400

Y Save the peak value in VFLOW to Vpress

Calculate the reference value of flow velocity when the fire is maximum in a single stove: Vsi nglestove = Vpress* 0.91

The update value is VF’and compared with the original value Voff

N VF’- Voff < 35

Y Detection of user turn off the fire

END

Figure 5. The flowflow chart of igniting and turning ooffff firefire detection.detection.

3.2.2.3.2.2. Removal of Pipe Network Fluctuation InIn thisthis paper,paper, aa baselinebaseline driftdrift noisenoise removalremoval methodmethod basedbased onon timetime domaindomain featurefeature extractionextraction isis proposed.proposed. The principle of this method is to obtain the baseline of the signal by curvecurve fittingfitting ofof thethe extractedextracted pressurepressure fluctuation fluctuation characteristic characteristic line segmentline segment of the pipelineof the network,pipeline andnetwork, then subtracting and then thesubtracting original signalthe original from thesignal calculated from the baseline calculated to achieve baseline baseline to achieve noise baseline removal. noise This removal. algorithm This is algorithm is simple in operation and is different from the median filtering method, which needs to adjust the filter window width according to the signal period. The method is less affected by the Appl. Sci. 2019, 9, 2475 7 of 14

Appl. Sci. 2019, 9, x FOR PEER REVIEW 7 of 15 simple in operation and is different from the median filtering method, which needs to adjust the filter windowperiod of width the original according signal. to the The signal processed period. signal The methodretains the is less effective affected periodic by the periodsignal components of the original in signal.the gas The pressure processed signal, signal and retains can reduce the effective the seriou periodics distortion signal components of the signal in thewhen gas pressureeliminating signal, the andbaseline can reducedrift. the serious distortion of the signal when eliminating the baseline drift. TheThe algorithmalgorithm isis mainlymainly divideddivided intointo twotwo parts:parts: thethe firstfirst part is detecting the time-domain featurefeature lineline segment,segment, thethe secondsecond partpart isis thethe medianmedian filterfilter ofof thethe featurefeature lineline segmentsegment toto getget thethe baseline,baseline, subtractingsubtracting thethe baselinebaseline curvecurve fromfrom thethe originaloriginal signalsignal toto getget thethe signalsignal withoutwithout thethe baselinebaseline drift.drift. TheThe flowflow chartchart ofof thethe algorithmalgorithm isis shownshown inin FigureFigure6 .6.

BEGIN

Input the pressure signal of the outlet of diaphragm gas meter: INPUT

Calculate the mean value of the first to twenty points of the sequence as the initial reference value of the trajectory sequence: REF = mean(INPUT(1:20))

i = 1

N INPUT(i)-REF > 7

Y Maintain trajectory Update trajectory sequence sequence values: values: BASE(i) = INPUT(i) BASE(i) = REF

Updating the reference value of trajectory sequence: REF = INPUT(i)

i=i+1

Y i<=length(INPUT) N

Perform 50-point median filtering on the trajectory Gas pipe network low sequence BASE: frequency noise baseline BASE = smooth(BASE,50)

Subtract the original pressure signal from the baseline Waveform after removing sequence to remove the pipe network pressure baseline noise signal: fluctuation FINAL = INPUT-BASE

END

FigureFigure 6.6. TheThe flowflow chartchart ofof removingremoving thethe pipepipe networknetwork fluctuation.fluctuation.

Appl. Sci. 2019, 9, 2475 8 of 14 Appl. Sci. 2019, 9, x FOR PEER REVIEW 8 of 15

3.2.3. Fire Fire State State Changing Changing Detection Detection When the the user user adjusts adjusts the the fire fire knob knob of ofthe the gas gas stove, stove, the the gas gas flow flow velocity velocity in the in gas the pipeline gas pipeline will jumpwill jump and andthe gas the gaspressure pressure will will fluctuate fluctuate steeply. steeply. Figure Figure 7 7shows shows the the fire fire state state changing detectiondetection resultsresults for four different different situations. The The fluctuation fluctuation range range of of the the pressure pressure signal signal caused caused by by the user adjusting the gas fire fire power is usually 50 Pa~300 Pa, so the identification identification of the user’suser's adjusting adjusting fire fire action can be realized by detecting the jump of pr pressureessure output value of the DPS310 sensor. The test resultsresults show show that that the the pressure pressure of of the the outlet of of th thee gas meter fluctuates fluctuates about 40 40 Pa Pa when the user adjusts the fire fire minimally. However, the peak and valley values of the periodic periodic signal signal waveforms waveforms are are between 10 Pa and 50 Pa, so it is necessary to set th thee characteristic limit conditions to distinguish the jumpjump of of the the fire fire conversion from the jump of periodicperiodic signal. The The flow flow chart chart of of the fire fire conversion point recognition algorithm is shown in Figure8 8..

(a) (b)

(c) (d)

Figure 7. The detectingFigure result 7. ofThe the detecting fire conversion result of points. the fire ( aconversion) The first situationpoints. with 6 large degree fire conversions; (b) The second situation with 5 large degree fire conversions; (c) The third situation with 4 small degree fire conversions; (d) The fourth situation with 2 small degree fire conversions. Appl. Sci. 2019, 9, 2475 9 of 14 Appl. Sci. 2019, 9, x FOR PEER REVIEW 9 of 15

BEGIN

DPS310 sensor reads pressure value of gas outlet of gas meter

N Generate pressure jump above 25 Pa

Y Calculate the average value of M1 from the first 5 points to the first 3 points of the jump time

Calculate the mean M2 from 3 to 5 after the jump time

Y |M1-M2|>=25 Pa N

The jump is only the local Fire conversion fluctuation of periodic signals

END

Figure 8. TheThe flow flow chart chart of fire fire conversi conversionon point recognition algorithm.

As depicted in Figure 88,, ifif thethe absoluteabsolute valuevalue ofof thethe didifferencefference between the pressure value of the current sampling point and the previous point is greater than 25 Pa, it will temporarily be regarded as a a fire fire conversion conversion point. point. However, However, in inorder order to toavoid avoid the the judgment judgment error error due due to the to noise the noise signal, signal, this methodthis method judges judges the difference the difference between between the mean the mean value valueof the of first the 5 firstpoints 5 points to the tofirst the 3 firstpoints 3 pointsof the aboveof the conversion above conversion point and point the andmean the value mean of valuethe last of 3 thepoints last to 3 the points last to5 points the last of 5that points conversion of that point.conversion point.

3.2.4. Signal Signal Period Period Detection Method Based on AMDF The conventional AMDF is defineddefined as [[10]:10]: 𝐷(𝜏)X = ∑|Nτ 1 𝑥(𝑛)−𝑥(𝑛+𝜏) | D(τ) = − − x(n) x(n + τ) ,, (4) n=0 − where 𝑥(𝑛) are the frames of input signal whose length is N, 𝜏 is the lag number. where𝐷(𝜏)x(n )hasare the the same frames characteristic of input signal of whosethe period length with is Nthe, τ originalis the lag signal, number. and there are notches D(τ) has the same characteristic of the period with the original signal, and there are notches located in the position of 𝑇 and its multiple where 𝑇 is the period of the periodic or quasi periodic originallocated insignal. the position Therefore, of T thep and period its multiple of the us whereeful signalTp is the can period be determined of the periodic by calculating or quasi periodic𝐷(𝜏) to findoriginal the signal.position Therefore, of the highest the period notch of (except the useful for the signal zero can position). be determined by calculating D(τ) to find the positionIn order of to the accurately highest extract notch (except the periodic for the charac zero position).teristics of the signal, the window length should at leastIn orderbe longer to accurately than two extract complete the periodicsignal periods: characteristics if the period of the signal,is N, the the sampling window lengthlength shouldof the signalat least should be longer be greater than two than complete 2N, and signal the corresponding periods: if the periodgas pressure is N, the periodic sampling signal length should of the be signalmore thanshould 2.4 be dm greater. In order than to2N ensure, and thethe correspondingimplementation gas of pressureAMDF in periodic the limited signal hardware should storage be more space, than 3 it2.4 isdm usually. In ordernecessary to ensure to segment the implementation the long-term of si AMDFgnal. This in thesystem limited truncates hardware the storagedata according space, it to is theusually fire conversion necessary to point. segment In addition, the long-term when signal.the number This systemof signal truncates sampling the points data accordingexceeds 3600 to thepoints fire inconversion a fixed fire point. state In(a sampling addition, frequency when the numberof 6 time ofs per signal second sampling and a signal points duration exceeds 3600of 600 points seconds), in a thefixed program fire state will (a sampling force the frequency execution of cycle 6 times extracti per secondon. The and peak a signal amplitude duration of ofAMDF 600 s), will the decrease program willwith force the increase the execution of the cyclelag time extraction. [11]. Therefore, The peak this amplitude paper divides of AMDF the will AM decreaseDF value with by the number increase of overlapping the lag time points [11]. Therefore, to suppress this this paper downward divides tr theend, AMDF and reciprocates value by the the number non-zero of amplitude overlapping to pointsconvert to the suppress valley thispoint downward to the peak trend, value. and reciprocates the non-zero amplitude to convert the valley point to the peak value. Appl. Sci. 2019, 9, 2475 10 of 14

3.2.5. Correction by Gas Temperature and Pressure Diaphragm gas meters are measured by the volume of gas, but the volume is compressed or expanded by the influence of pressure and temperature [12]. For gas companies in China, the standard temperature of gas is 293 K and the pressure is 101.325 KPa. Therefore, it makes sense to correct the gas volume based on the gas temperature and pressure. The compression factor is used in the project to describe the state of the gas, which is described as [13]: pV = nZRT, (5) where p is the absolute pressure of the gas, V is the volume of the gas, n is the amount of the substance, Z is the compression factor, R is the general gas constant, T is the thermodynamic temperature of the gas. For natural gas in the metered state and the same amount of natural gas in the standard state, the volume conversion Equation (6) can be obtained according to Equation (5), which can be represented as:

p T0 Zn V0 = V, (6) p0 · T ·Zg · where V is the volume of the gas under the metered state, V0 is the volume under the standard state, Z and Z are the compression factors in the working state and the standard state respectively, Zn can g n Zg be expressed by the symbol K. The pressure in urban gas pipeline belongs to the low pressure range, the compression factor has little change, so K can be considered as 1 [14]. Therefore, the Equation (6) can be simplified to the following: p T0 V0 = V, (7) p0 · T · pT where 0 is defined as the volume correction factor in this paper. p0T

4. Rationality Test of the Proposed Measurement Method The flow range of household gas stove is usually 0.005 m3/h to 0.87 m3/h, and the operation cycle time range corresponding to the discharge of 1.2 dm3 fixed volume gas is about 90 s to 5 s. Therefore, when the extraction period exceeds this range, the calculation error can be judged. In addition to the above conditions, the system will judge the flow velocity range according to the rough output value of the gas flow velocity sensor. For the period extraction results beyond the normal range of the flow velocity range and the unbelievable signal segment in the period extraction process, the gas consumption will be approximately measured according to the output value of the gas flow velocity sensor. The output value of the gas flow velocity sensor during the use of a household gas stove is shown in Figure9. Record the output value of the flow velocity sensor in the off-fire state is Vc, the peak value of the igniting jump is Vo, and then calculate the value VB1 in the maximum fire state in a signal stove according to Equation (3). The flow velocity of the maximum fire of double stove is approximately 2 times that of the VB1. Therefore, the velocity output value can be divided into 4 intervals, as shown in Table1. Taking the signal segment a in Figure9 as an example, firstly, the period extraction algorithm is used to extract the signal period. When the extraction results do not meet the reasonable judgment conditions, the approximate calculation of gas consumption is carried out according to Table1. Appl. Sci. 2019, 9, 2475 11 of 14 Appl. Sci. 2019, 9, x FOR PEER REVIEW 11 of 15

Figure 9. TheThe output output value value of of gas gas flow flow velocity sensor and its corresponding signal period interval.

Table 1. Signal periodic rationality test and approximate value of period. Record the output value of the flow velocity sensor in the off-fire state is 𝑉, the peak value of the igniting jump is𝑉 , and then calculateConfidence the Intervals value 𝑉 for in Periodic the maximumApproximate fire state Value in ofa signal Period stove Velocity Output Value S B1 according to Equation (3). The flow velocityExtraction of th Resultse maximumL(s) fire of double stoveN(s) is approximately 2 V times that of the0 < S𝑉B1.Therefore,B1 the velocity output15 < L

When the deviationTable 1. Signal between periodic the calculation rationality test period and approximate value and the value current of period. flow velocity interval signal period value is too large, it isConfidence determined Intervals as a calculation for error and the gas consumption is Approximate Value of calculatedVelocity according Output to the Value approximate S flowPeriodic velocity Extraction sensor output value. The method can compensate Period N(s) for the shortcomings of the low accuracy ofResults the flow L(s) velocity sensor, and at the same time greatly reduce the measurement𝑉 deviation caused by the period extraction error. Usually, the period extraction 0< 𝑆 ≤ 15<𝐿<90 65 error is caused by a shorter2 signal length, that is, less than 5 complete periods of consuming 6 dm3 of 𝑉 gas. This error would<𝑆≤𝑉 not have a major impact10<𝐿<75 on the overall gas consumption27.5 metering. After the gas 2 consumption is approximately calculated, the cumulative error caused by the long-term operation of 𝑉 <𝑆≤ 5<𝐿<40 12.5 the system can be reduced. 3𝑉 <𝑆≤𝑉 𝐿<15 7.5 5. System Test 4

WhenThe test the environment deviation between of the system the calculation mainly includes period value gas equipment and the current laboratory flow andvelocity user’s interval home signalenvironment. period value The test is too system large, mainly it is determined consists of as a gasa calculation pipeline, diaphragmerror and the gas gas meter, consumption indirect gas is calculatedconsumption according metering to terminal, the approximate indoor gas flow safety ve valvelocity and sensor domestic output gas value. stove. The users’method homes can compensateare located infor di thefferent shortcomings floors between of the the low 1st accuracy and 22th of floors. the flow Diaphragm velocity sensor, gas meters and at of the diff sameerent timebrands greatly and specificationsreduce the measurement are tested and deviation used. In caused the laboratory by the period test environment extraction error. of gas Usually, equipment, the periodthe inlet extraction of the gas error pipeline is caused is equipped by a shorter with asignal high precisionlength, that gas is, flowmeter, less than 5 which complete can controlperiods the of consumingsystem parameters 6 dm3 of precisely gas. This under error the would condition not have of large a ma flow.jor impact In addition, on the two overall or four gas household consumption gas metering.cookers can After be extendedthe gas consumption to the end of is the approximatel gas pipeliney calculated, through the the two-way cumulative pipe, error so as caused to realize by the 3 long-termsystem experimental operation of test the of system the diaphragm can be reduced. gas meter under the limit flow velocity (2.5 m /h). The gas consumption indirect metering device test system is shown in Figure 10. 5. System Test The test environment of the system mainly includes gas equipment laboratory and user's home environment. The test system mainly consists of a gas pipeline, diaphragm gas meter, indirect gas Appl. Sci. 2019, 9, x FOR PEER REVIEW 12 of 15

consumption metering terminal, indoor gas safety valve and domestic gas stove. The users' homes are located in different floors between the 1st and 22th floors. Diaphragm gas meters of different brands and specifications are tested and used. In the laboratory test environment of gas equipment, the inlet of the gas pipeline is equipped with a high precision gas flowmeter, which can control the system parameters precisely under the condition of large flow. In addition, two or four household gas cookers can be extended to the end of the gas pipeline through the two-way pipe, so as to realize Appl. Sci.the2019 system, 9, 2475 experimental test of the diaphragm gas meter under the limit flow velocity (2.5 m3/h). The12 of 14 gas consumption indirect metering device test system is shown in Figure 10.

FigureFigure 10. 10.The The systemsystem for indirect indirect metering. metering.

The userThe user cooking cooking process process involves involves one one oror moremore gas use use states, states, including including single single stove stove and anddouble double stoves in the use of various fire states, a long-term use process (the gas dosage is greater than 6 dm3), stoves in the use of various fire states, a long-term use process (the gas dosage is greater than 6 dm3), and a short-term use process (the gas dosage is less than 6 dm3). The process also includes a variety and a short-term use process (the gas dosage is less than 6 dm3). The process also includes a variety of of unconventional operating conditions, such as multiple igniting operations due to fire failure, unconventionalfrequent fire operating adjustments conditions, and minimal such fire as adjust multiplements. igniting Each group operations of experiments due to fire is failure,a complete frequent fire adjustmentsfamily cooking and process. minimal The fire test adjustments. site is distributed Each over group different of experiments floors and test is a times, complete including family peak cooking process.gas use The and test non-peak site is distributed gas use periods. over diAccordingfferent floors to the andexperimental test times, results, including the maximum peak gas error use and non-peakrate of gas the usetest periods.group is 7.88%. According The gas to consumption the experimental is 4357.56 results, dm3 in the all the maximum experiments, error and rate the of the test groupcalculated is 7.88%. measurement The gas value consumption is 4420.64 dm is 4357.563. The cumulative dm3 in all error the rate experiments, is 1.45%. The and gas the metering calculated measurementtest results value of household is 4420.64 cooking dm3. The process cumulative are show errorn in rateTable is 2. 1.45%. The single The gasgroup metering of experimental test results of householderrors cookingare mainly process caused are by shownthe approximate in Table2 .gas The metering single group signal ofsection experimental and the user's errors igniting are mainly operation. However, due to the positive and negative error rate, the statistical average can further caused by the approximate gas metering signal section and the user’s igniting operation. However, due reduce the system error rate. to the positiveBecause and the negative test time error is winter, rate, thethe statisticalgas temperat averageure is low can and further the static reduce pressure the system of the error gas rate. pipeline is 2000–3000 Pa higher than the standard atmospheric pressure, it is necessary to multiply the measured valueTable by 2. theGas corresponding metering test temperatur results of thee-pressure household correction cooking coefficient process. to get the gas measurement valueGas Temperature under the standardPipe static condition.Correction Figure 11 showsCode Disk the numeriResultcal ofcomparison of gas Number Error Rate volume before and after(◦C) correctingPressure by the (Pa) temperatureFactor and pressure.Value (L) Calculation (L) As1 shown in the 3.79 Figure 11, the 104,608gas metering valu 1.09e of the diaphragm 72 gas meter 70.54 in winter2.03% is lower − 2 12.76 105,176 1.06 50.4 49.58 1.63% than the gas volume of the standard condition, and the pipe pressure is higher than the− standard 3 7.86 104,726 1.08 108.1 107.59 0.47% − atmospheric4 pressure. 7.99 The gas volume 104,689 temperature 1.08 and pressure 164.16 correction 176.72 method used 7.65% in this paper can5 reduce the 7.93 measurement 104,661 error caused by 1.08 ambient temperat 97.2ure or 101.16 pipeline pressure 4.07% to a certain 6extent. This group 7.83 of experiments 105,207 verify the 1.08accuracy and 12.1 validity of the 12.17 indirect gas 0.58% metering 7 7.74 105,098 1.08 45.6 46.02 0.92% functions8 and the correction 7.69 function 105,124 of the gas volume 1.08 temperature 100.8 and pressure. 94.08 6.67% − 9 6.59 105,404 1.09 36.3 35.72 1.60% − 10 6.52 105,395 1.09 67.3 62.30 7.43% − 11 6.51 105,387 1.09 211.7 217.82 2.89% 12 6.61 105,356 1.09 147.4 159.01 7.88% 13 6.67 105,360 1.09 257 255.65 0.53% − 14 6.7 105,330 1.09 178.5 185.38 3.85% 15 3.76 105,294 1.10 160.2 164.34 2.58% 16 3.81 105,272 1.10 206.3 214.25 3.85% 17 3.89 105,277 1.10 370.7 372.47 0.48% 18 3.97 104,495 1.09 581 606.21 4.34% 19 1.72 104,312 1.10 325 321.49 1.08% − 20 1.6 104,289 1.10 138.5 140.20 1.23% 21 1.74 104,267 1.10 252.7 249.98 1.08% − 22 2.89 104,161 1.09 311.6 309.88 0.55% − 23 2.96 104,157 1.09 415.5 420.16 1.12% 24 2.84 103,995 1.09 47.5 47.94 0.93% SUM 4357.56 4420.64 1.45% Appl. Sci. 2019, 9, x FOR PEER REVIEW 13 of 15

Table 2. Gas metering test results of the household cooking process.

Gas Result of Pipe static Correction Code Disk Error Number Temperature Calculation Pressure (Pa) Factor Value (L) Rate (°C) (L) 1 3.79 104608 1.09 72 70.54 −2.03% 2 12.76 105176 1.06 50.4 49.58 −1.63% 3 7.86 104726 1.08 108.1 107.59 −0.47% 4 7.99 104689 1.08 164.16 176.72 7.65% 5 7.93 104661 1.08 97.2 101.16 4.07% 6 7.83 105207 1.08 12.1 12.17 0.58% 7 7.74 105098 1.08 45.6 46.02 0.92% 8 7.69 105124 1.08 100.8 94.08 −6.67% 9 6.59 105404 1.09 36.3 35.72 −1.60% 10 6.52 105395 1.09 67.3 62.30 −7.43% 11 6.51 105387 1.09 211.7 217.82 2.89% 12 6.61 105356 1.09 147.4 159.01 7.88% 13 6.67 105360 1.09 257 255.65 −0.53% 14 6.7 105330 1.09 178.5 185.38 3.85% 15 3.76 105294 1.10 160.2 164.34 2.58% 16 3.81 105272 1.10 206.3 214.25 3.85% 17 3.89 105277 1.10 370.7 372.47 0.48% 18 3.97 104495 1.09 581 606.21 4.34% Appl.19 Sci. 2019, 9, 2475 1.72 104312 1.10 325 321.49 −1.08%13 of 14 20 1.6 104289 1.10 138.5 140.20 1.23% 21Because the test1.74 time is winter,104267 the gas temperature1.10 is low252.7 and the static249.98 pressure of− the1.08% gas pipeline22 is 2000–30002.89 Pa higher than104161 the standard1.09 atmospheric 311.6 pressure, it is necessary309.88 to multiply−0.55% the23 measured value2.96 by the corresponding104157 temperature-pressure1.09 415.5 correction coe420.16fficient to get the1.12% gas measurement24 value2.84 under the standard103995 condition. Figure1.09 11 shows47.5 the numerical47.94 comparison 0.93% of gas volume before and after correctingSUM by the temperature and pressure.4357.56 4420.64 1.45%

Figure 11. TheThe numerical numerical comparison comparison of ofgas gas volume volume before before and and after after correcting correcting by temperature by temperature and andpressure. pressure.

As shown in the Figure 11, the gas metering value of the diaphragm gas meter in winter is lower than the gas volume of the standard condition, and the pipe pressure is higher than the standard atmospheric pressure. The gas volume temperature and pressure correction method used in this paper can reduce the measurement error caused by ambient temperature or pipeline pressure to a certain extent. This group of experiments verify the accuracy and validity of the indirect gas metering functions and the correction function of the gas volume temperature and pressure.

6. Conclusions At present, there are still a large number of mechanical gas meters or IC (Integrated Circuit) card gas meters in the household gas charging system. The main method of charging for gas usage is through manual meter reading, which has the shortcomings of high cost and low efficiency. The key difficulty in building an intelligent home gas management platform is the digitalization of a large number of existing mechanical diaphragm gas meters. In this study, an additional device is designed, which is installed at the back end of the outlet of the diaphragm gas meter and the front end of the gas appliance. It can obtain the indirect measurement of gas, real-time monitoring of the gas temperature, pipeline pressure, and service state without any disassembly and modification inside the gas meter, thus solving the key problems of household gas safety management. In addition, various functions of indirect gas metering device, such as signal acquisition, gas metering and temperature and pressure correction, are tested and analyzed. Finally, the gas volume before and after the temperature-pressure correction is compared and analyzed. The experiment proves that the system can realize the functions proposed in the design stage and can also make the gas indirect measurement function more credible.

Author Contributions: Conceptualization, X.W. and B.J.; methodology, Z.H. and X.C.; software, Z.H.; validation, X.W. and B.J.; investigation, Z.H.; data curation, X.C.; writing—original draft preparation, X.C.; writing—review and editing, Z.H.; project administration, X.W. and B.J. Appl. Sci. 2019, 9, 2475 14 of 14

Funding: The research received no external funding. Acknowledgments: We gratefully acknowledge the technical assistance of DL850E ScopeCorder. Conflicts of Interest: The authors declare no conflict of interest.

References

1. Landolsi, T.; Hassan, M.H.; Ezzeddine, M.; Abdelsalam, M.; Baseet, M. An IoT-Based Smart Utility Meter. In Proceedings of the 2nd International Conference on Smart Grid and Smart Cities (ICSGSC), Kuala Lumpur, Malaysia, 12–14 August 2018. 2. Cai, S.; Zhang, S.F.; Huang, D.; Yu, S.F. Remote gas meter reading system based on zigbee networks. In Proceedings of the Spring World Congress on Engineering and Technology, Xi’an, China, 27–30 May 2012. 3. Wang, K. Application of wireless sensor network based on LoRa in city gas meter reading. Int. J. Online Eng. 2017, 13, 104–115. [CrossRef] 4. Xie, Y. Development of the remote record and control of gas meter based on M-Bus networks. In Proceedings of the 4th International Conference on Digital Manufacturing and Automation, Qingdao, China, 29–30 June 2013. 5. Tewolde, M.; Fritch, J.C.; Longtin, J.P. High-resolution meter reading technique for appliance gas usage monitoring for the smart grid. In Proceedings of the 8th International Conference and Expo on Emerging Technologies for a Smarter World, Hauppauge, NY, USA, 2–3 November 2011. 6. Wiratama, F.I.; Syaifuddin, M.; Wibowo, I.K.; Ardilla, F.; Purnomo, A. Gas billing system based on on diaphragm gas meter with email notification. In Proceedings of the International Electronics Symposium on Knowledge Creation and Intelligent Computing (IES-KCIC), Bali, Indonesia, 29–30 October 2018. 7. Ficco, G. Metrological performance of diaphragm gas meters in distribution networks. Flow. Meas. Instrum. 2014, 37, 65–72. [CrossRef] 8. Crabtree, G.M. Fundamental principles of diaphragm displacement meters. In Proceedings of the International School of Hydrocarbon Measurement, Norman, OK, USA, 21–23 May 1991. 9. Kumar, S.; Singh, K.S.; Bhattacharya, S. Performance evaluation of a ACF-AMDF based pitch detection scheme in real-time. Int. J. Speech Technol. 2015, 18, 521–527. [CrossRef] 10. Zong, Y.; Zeng, Y.M.; Zhang, M.; Li, P.C. Modified AMDF pitch detection algorithm based on trend analysis. J. Vib. Shock. 2014, 33, 35–39. 11. Erden, R.; Alkar, A.Z.; Cetin, A.E. Contact-free measurement of respiratory rate using infrared and vibration sensors. Infrared Phys. Technol. 2015, 73, 88–94. [CrossRef] 12. Qin, C.K.; Gao, D.Y. Calculation of natural gas compression factor and volume measurement. Nat. Gas Ind. 2003, 23, 130–132. (In Chinese) 13. Qin, C.K.; Gao, D.Y. Calculation of volume-correction coefficient of natural gas. Tongji Daxue Xuebao 2004, 32, 27–30. (In Chinese) 14. Li, C.H.; Dai, J.M.; Li, C.W.; Chen, S.R. Discussion on compressibility factor correction in gas flow measurement. Nat. Gas Ind. 2004, 24, S124–S127, 18–19. (In Chinese)

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).