“Gas flow meters are the most commonly used instrumentation equipment. The bell-type gas flow standard device uses air as the medium to verify, calibrate and detect the gas flow meter. It is mainly used for the verification, calibration and type evaluation of gas flow meters such as velocity type, positive displacement type and differential pressure type, and can also be used for the research work of gas flow measurement. In this paper, based on C8051F350 single chip microcomputer, the existing bell device is modified, and a gas flow meter detector is designed.
Gas flow meters are the most commonly used instrumentation equipment. The bell-type gas flow standard device uses air as the medium to verify, calibrate and detect the gas flow meter. It is mainly used for the verification, calibration and type evaluation of gas flow meters such as velocity type, positive displacement type and differential pressure type, and can also be used for the research work of gas flow measurement. In this paper, based on C8051F350 single chip microcomputer, the existing bell device is modified, and a gas flow meter detector is designed.
Overview of Gas Flow Meter Verification Technology
At present, the verification methods of gas flowmeters can be broadly divided into two types: direct measurement and indirect measurement.
The direct measurement method is to use the actual fluid for metrological verification, which is specifically defined as using a standard device (standard flowmeter or measuring instrument) in series with the measured flowmeter, and by comparing the cumulative flow value of the fluid measured by the two, the measured flowmeter is obtained. Methods of measuring errors in flowmeters. The real flow detection method has the characteristics that the verification environment is consistent with the working condition environment, the flow value is accurate and reliable, and it truly reflects the measurement characteristics of the measured flowmeter. The real flow detection method can be divided into offline real flow detection and online real flow detection. Off-line real flow detection is mainly carried out in the laboratory, that is, the flowmeter under test is connected in series with the flow standard device in the laboratory, and the measurement error of the flowmeter is measured under laboratory reference conditions. The measurement is accurate, but its measurement characteristics under working conditions are ignored. On-line real flow detection is to install the standard flowmeter on the reserved verification pipeline behind the measured flowmeter, use the actual fluid for measurement, and obtain the actual working condition error through on-site online detection.
The indirect measurement method is a method to indirectly obtain the indication value error of the measured flowmeter by measuring several physical quantities related to the flow value and calculating the errors of several related physical quantities.
Principle of gas flow meter detector
How the bell device works
Bell jar type gas flow standard device is one of the main forms of gas flow standard device. When the pressure is not high (generally less than 10kPa) and the flow rate is not large, it is relatively simple to use it to verify the flowmeter. The device can be divided into exhaust type and intake type according to the direction of airflow. Its characteristics are: ①It is suitable for testing gas flowmeters with low pressure and small flow; ②In the exhaust device, the gas pressure flowing through the tested flowmeter is very low, close to atmospheric pressure, and the gas humidity is very high, which is suitable for The result of the verification will have an impact, so humidity correction must be made; ③The air inlet device needs a dry and stable gas source to ensure that the dryness of the gas used for verification meets the specified requirements, and to ensure that the air pressure, temperature and flow of the test pipe section are constant. This makes it more difficult to build an air-inlet device than an exhaust-type device; ④ Since the internal pressure of the bell only depends on its own gravity, the gravity of the counterweight, the buoyancy of the liquid and the pulling force of the compensation mechanism, whether it is an exhaust-type device Or the intake type, the internal pressure is unchanged.
The standard volume of the bell is obtained by measuring the displacement of the bell, and the automatic measurement of the displacement of the bell is an important part of the detector (bell device). The grating ruler is a high-precision displacement measuring element, which has been widely used in the fields of precision instruments and high-precision precision machining. volume. The principle of the detector is that when the bell jar descends, the gas in the bell jar flows through the flowmeter under test through the connecting pipeline, and at the same time when the bell jar descends, the height of the bell jar is converted into a pulse signal by the grating ruler, which is regulated by the hardware interface circuit. Then, it is sent to the computer, and the computer will convert it into standard gas volume or volume flow through calculation processing such as compensation and correction. In addition, the calibrated detector is provided with a baffle plate and a photoelectric sensor. The volume between the two baffle plates of the bell is fixed. The time that the baffle plates pass through the photoelectric sensor can be measured, and the standard volume of the exhaust gas can also be obtained. or volume flow. Comparing the measured value with the volume or flow indicated by the flowmeter under test, the basic error of the flowmeter under test can be obtained.
Flow calculation formula
In the measurement time t, the volume of gas discharged from the bell is VS, then the volume flow through the calibrated flowmeter
In formula (1), PS, TS, ZS are the absolute pressure (Pa), thermodynamic temperature (K) and gas compressibility in the bell jar, respectively; Pm, Tm, Zm are the absolute pressure (Pa) before the flowmeter, Thermodynamic temperature (K) and gas compressibility; Vs is the volume of gas discharged from the bell under PS and TS states (m3); Vm is the volume of gas discharged from the bell at Pm and Tm (m3); t is Measurement time (s).
Comparing (qv) s with the displayed value (qv) m of the calibrated flowmeter, the relative error of the calibrated flowmeter indication value can be calculated as:
For the velocity type flowmeter, the meter coefficient of the flowmeter is calibrated by the standard volume discharged by the bell device and the number of pulses output by the calibrated flowmeter.
Basic structure of gas flow meter detector
The gas flow meter detector takes C8051F350 microcontroller as the core to monitor all the measured values. Its basic structure is shown in Figure 1.
Figure 1 Structure diagram of gas flow meter detector
In order to ensure that the difference between the air temperature in the bell jar and the liquid temperature in the liquid tank meets the specified requirements, the temperature of the detector should be strictly controlled, so five temperature sampling points are set up, and a temperature and humidity sensor is added to monitor the on-site verification environment. All the signals monitored by the detector are as follows: ①The bell, the five-way temperature includes the temperature of the top of the hood, the temperature of the upper, middle and lower parts of the hood, and the temperature of the liquid; ②The flowmeter to be tested, the temperature, pressure, differential pressure, analog temperature before the flowmeter is verified Flowmeter signal; ③ Environment, room temperature, humidity; ④ Pulse signal, bell scale, baffle, limit, pulse flowmeter signal.
Hardware Design of Gas Flow Meter Detector
The hardware part of the gas flow meter detector is composed of circuits such as single-chip microcomputer, communication, valve control and voltage conversion. It is controlled by a computer to complete various verification instructions, and realize functions such as real-time data acquisition and high-precision timing.
Introduction to C8051F350 MCU
The detector uses C8051F350 microcontroller as the control core. It is a highly integrated mixed-signal system-on-chip microcontroller that integrates PGA, ADC, DAC and other rich on-chip resources, and has low power consumption, high resolution, small package, High cost performance and other advantages, it is an ideal choice for high-precision measurement applications. The input and output of the single-chip signal are shown in Figure 2.
Functional characteristics of C8051F350 MCU: ①70% of the instructions are executed in 1 or 2 system clock cycles, so when the system speed is required, the system clock frequency can be reduced, thereby reducing system power consumption; ②PGA can be amplified by 1~128 times, It is suitable for direct measurement of small signals; ③ 8-channel 24-bit ADC, its nonlinearity can reach 0.0015%, which ensures the high precision of the system; ④ 8kB on-chip FLASH memory ensures enough code space, which can be used for the linear correction program of the sensor, and can One of the sectors (512 bytes) is used as non-volatile memory to store the system calibration parameters; Internal RAM, which can be used to store a large amount of data required for linearization operations; ⑦ Programmable counter/timer array, which can realize 16-bit PWM, and can realize D/A conversion with simple peripheral circuits; ⑧ 32-pin LQFP package, saving PCB area, It can be used for miniaturized products; ⑨The on-chip debugging circuit provides full-speed, non-intrusive in-system debugging to ensure easy development.
The C8051F350 chip can be connected to four types of oscillator circuits. In the design, crystal is selected as the external oscillator source. In order to facilitate the baud rate setting, Y1 shown in Figure 2 is 22.1184MHz. The C8051F350 chip has a total of 17 digital I/O ports, of which P2.0/C2D is used for JTAG debugging, and the remaining 16 ports have the following functions after hardware connection and crossbar switch configuration: P0.0 grating ruler input pulse count; P0 .2. P0.3 is connected to external crystal oscillator; P0.4, P0.5 serial communication; P0.6 bell baffle, limit signal (INT0 interrupt); P0.7 flowmeter pulse signal (INT1 interrupt); P1. 0 button (power-on reset); P1.1, P1.2 microcontroller read baffle and limit signal; P1.4 controls CD4053; P1.5~P1.7 controls 74HC595, P0.1, P1.3 are free.
Figure 2 C8051F350 MCU interface diagram
Detector signal acquisition
The flow signals output by pressure, temperature sensors and some gas flow meters are current signals (4mA~20mA). Considering the ADC input range, a 100Ω precision resistor can be used to convert the current signal into a corresponding 0.4V~2V voltage signal.
The C8051F350 single-chip microcomputer has 8 channels of 24-bit programmable AD converters, and the analog quantity to be converted in the detector has 16 channels. In order to solve the problem of insufficient channels, the bidirectional analog switch CD4053 can be used.
Set the ADC to use the internal reference voltage. After zero calibration and slope calibration, the ADC output is the initial value when 4mA is input, and the full-scale value when 20mA is input. Read the high 16 bits of the AD conversion result and send it to the computer, and the computer calculates the corresponding value according to the linear interpolation table provided by each transmitter.
Gas flow meter signal adjustment circuit
The gas flow meter signal is output in pulse mode, part of the output is a standard pulse signal (TTL level), and the other part is a high-level signal between 3V and 30V. Therefore, a comparator is used to design an input pulse adjustment circuit to simplify the circuit. The adjustment circuit can identify the two parts of the pulse signal and convert the high-level signal into TTL level. The flowmeter signal adjustment circuit is shown in Figure 3, and f2 is the input of the flow pulse. Set the reference voltage V2, when the input is lower than the reference voltage, the output GND=0V; when the input voltage is higher than the reference voltage, the comparator output voltage Vcc=5V. The signal output by the comparator, after photoelectric isolation and power amplification, is input to the P0.7 pin of the microcontroller.
Figure 3 Flowmeter signal adjustment circuit diagram
Multi-channel solenoid valve control circuit
According to the verification procedure and the flow meter range, multiple verification flow points need to be set during verification. Take 10 flow verification points between 0.5m3/h~128m3/h, corresponding to 10 solenoid valves to control the flow, manually input the required flow value when calibrating, and the computer will automatically turn on the corresponding solenoid valve according to the flow value corresponding to the solenoid valve. valve or solenoid valve combination.
The detector uses C8051F350 single-chip microcomputer to perform the opening and closing of the solenoid valve and control the blower. In order to minimize the occupation of the I/O port of the single-chip microcomputer, the 74HC595 chip is introduced. As shown in Figure 4, the serial port multi-way valve control circuit is designed. The 74HC595 contains 8-bit serial-in, serial/parallel-out shift registers and 8-bit tri-state output latches. Connect the Q7 of the first 74HC595 to the SER of the second, and the microcontroller only needs to control the three pins of SER, SRCLK and RCLK of the first 74HC595, so that the opening and closing of the multi-way valve and fan can be controlled. .
Hardware Design of Gas Flowmeter Detector Based on C8051F350 MCU
Figure 4 Multi-way valve control circuit diagram
Software Design of Gas Flow Meter Detector
The software design of the gas flow meter detector adopts Delphi programming technology, processes the data sent by the lower computer, obtains the verification result, and saves the verification data in the SQL SERVER database system. The controller part of the detector system is responsible for collecting data and executing instructions, and completes the design of the verification interface, the design of the database and the processing of data on the computer.
Controller part software design
As shown in Figure 5, part of the software design of the controller includes the design of A/D sampling module, communication module, timing module and counting module.
Hardware Design of Gas Flowmeter Detector Based on C8051F350 MCU
Figure 5 Controller program flow chart
(1) Counting and timing
The gas flow meter detector counts the bell baffle pulse, the flow meter output pulse and the grating ruler pulse in an interrupted manner. At the same time, the detector should time the standard time, and should generate 1s interrupt, and generate baud rate during communication. The C8051F350 microcontroller can meet the counting and timing requirements. It has a programmable counter array (PCA). The PCA is set to count the input pulse. In most cases, it only needs to control its start and stop, and then read the count value. T0 is used to count the pulse signal of the detected flowmeter; T1 is the serial communication baud rate generator; T2 is used for standard time timing and 1s timing.
The communication between C8051F350 microcontroller and computer adopts RS-232C serial port, and the set baud rate is 115200bps. In actual communication, the effective instructions sent by the computer are compiled into a group of codes, and after the microcontroller executes the commands, the returned data contains another group of codes corresponding to this operation. In this way, the program of the host computer and the single-chip microcomputer can be written at the same time, and can be combined and used like a puzzle after writing; and the data format is agreed, and the command can be changed by modifying the code of the data format on the host computer.
(3) Verification method
The relevant verification parameters are set on the computer by the verification personnel and sent to the single-chip microcomputer through the serial port. The verification process is shown in Figure 6. First, lift the bell to the designated position, and start the test after setting the test method and parameters. The verification methods that have been realized are: ①The bell jar constant volume method: mainly verifies the pulse output flowmeter, and calibrates the meter coefficient of the flowmeter; ②The flowmeter constant volume method: mainly verifies the standard flow pulse signal output flowmeter, and adopts the flow comparison method , calibrate the relative error of the flowmeter; ③Analog verification method: similar to method ①, using baffles to determine the volume, control the acquisition of the analog quantity of the flowmeter by the number of starting and ending baffles and perform A/D conversion, sampling once per 1s ;④Manual mode: Similar to mode ②, it mainly verifies the flowmeter of manual reading, and the verifier controls the start and end of timing and grating pulse count.
In the process of calibrating various flowmeters, the single-chip microcomputer collects sensor data such as pressure and temperature every 1s, and simultaneously reads the number of grating ruler pulses corresponding to the displacement of the bell, the number of baffles passed by the bell, and the number of output pulses of the flowmeter, etc. The data is sent to the computer for Display and flow value compensation calculation. When the bell jar falls to the bottom, it stops for 3s, and then the computer sends a command to raise the bell jar to lift the bell jar for the next check.
Computer part software design
The computer is mainly used to set the flowmeter verification parameters, analyze and calculate the verification error and manage the data.
(1) Computer functional modules
The tester uses Delphi program to design and develop user interface, and uses SQL Server database to manage verification data. The functional modules of the computer include system parameter setting, data acquisition and processing, data query, data modification, verification report printing and verification personnel management modules.
(2) Computer data processing
The data processing method varies with the verification method. Taking the verification method ① as an example, calculate the meter coefficient and error of the flowmeter according to the following formula, and first determine the meter coefficient ki of each flow verification point.
In the formula, ki is the meter coefficient of the i-th flow verification point, m-3; Nij is the cumulative pulse number of the j-th verification of the flow meter at the i-th flow verification point; Vij is the j-th verification bell of the i-th flow verification point The volume of the bell, that is, the constant volume of the bell at different verification points, is input before the verification, m3; PS and Tm are the average absolute pressures at the bell and the flowmeter during the verification time, Pa; TS and Tm are at the bell and the average temperature value of the flowmeter, °C. The meter coefficient k of the flowmeter can be calculated as:
The linearity of the flowmeter is
Then it can be concluded that the basic error of the flowmeter is:
where is the systematic error of the bell device, which is determined after the measurement department has passed the verification.
(1) Set permissions
The personnel who log in to the software have different permissions. The highest authority is the system administrator with all permissions. The administrator can generate operators and debuggers with different permissions or other customized personnel. The operator’s authority is to detect the instrument, call the detection record, etc., and its authority is designated by the system administrator; the debugger’s authority is to modify the internal settings of the software, set the system data, etc.
(2) Set system parameters
After the system is set up, some corresponding system parameters must be set to ensure the normal operation of the detector and the high detection accuracy of the instrument, including:
①Bell jar meter coefficient: It means that each single pulse in the pulses issued by the rotary encoder represents the volume of gas discharged from the bell jar. It is a fixed parameter of the bell and needs to be calibrated once a year. This coefficient must be set in the detection software, otherwise the flowmeter under test cannot be detected.
②The meter coefficient of the flowmeter: it means that each single pulse in the pulses issued by the flowmeter represents the volume of the gas flowing through the flowmeter, and the unit is liters per pulse (L/N). It is entered before detection and must also be set, which can be set as a flowmeter fixed parameter or variable parameter.
③Condition of the standard condition: it is the standard condition of the gas, that is, the atmospheric pressure is 101.325kPa and the temperature is 293.15K (20℃).
④ Stabilization time after the bell jar is lifted to the specified height: After the bell jar is lifted, it will vibrate in the process of rising and stopping in a short time. By setting the stabilization time, the bell jar is stabilized to reduce the system error. The larger this parameter is set, the smaller the bell jar shakes, and the better the detection effect, but it will also reduce the detection efficiency.
⑤ The number of stable pulses at the beginning of the descent of the bell jar detection: The bell jar goes through the stationary and descending process during the descending stage, and will vibrate at the beginning of the descent. Reduce the jitter and reduce the system error. The larger this parameter is set, the smaller the bell jar shakes, and the better the detection effect, but it will also reduce the detection efficiency.
⑥ Number of descending pulses after the detection: After the bell jar is detected, the descending of the bell jar cannot be stopped immediately, and the pulse counting must be stopped first, and then the bell jar can be stopped. This parameter is set to satisfy the requirement to stop the pulse count first, and then stop the bell. The parameter setting should not be too large, and it is enough to ensure that the detection stop and the bell stop stop time are staggered.
3) Set the verification certificate format
Including setting paper size, font size, text position, etc.
Gas flow meters are often used in production and life, and their accuracy is closely related to the safety of the entire production and life. Facing the growing demand for flow meter verification and testing, it is very important to improve the working efficiency and accuracy level of testing instruments. In this paper, C8051F350 single-chip microcomputer is used as the control core, the bell jar device is improved, the precision grating ruler is installed as the bell jar displacement sensing element, and multi-channel sensors are added to design a gas flow meter detector. The detector is controlled by the data acquisition of the single-chip microcomputer, which improves the reliability and accuracy of the collected data; the detector is simple in composition and easy to maintain; in the verification process, the detector completely controls the detection process and calculates the verification results, which improves the detection accuracy. , with general applicability.