Abstract: This paper introduces a computer-controlled valve inspection system, which uses an industrial computer to control 10 valve inspection devices. This system fundamentally changes the traditional manual inspection method, greatly improving valve inspection accuracy and work efficiency, and also solves the safety problems of manual inspection operators due to high pressure. Keywords: Valve inspection, Computer measurement and control, Visual C++ Introduction Valves, as a component of industrial automation systems, are widely used in petroleum, chemical, power plant, metallurgy, and environmental protection industries. Valves have a wide range of applications and are numerous in oil fields; therefore, valve inspection is of great significance to the safe and efficient production of oil fields. To improve the original valve inspection system and enhance the automation level and inspection accuracy, a petroleum university and an oil field jointly developed a computer measurement and control system. The performance indicators before and after the upgrade are as follows: pressure error decreased from 12-20% to no more than 5%; pressure response speed decreased from 15 seconds for large valves to no more than 9 seconds, and from 17 seconds for small valves to no more than 13 seconds; pressure overshoot decreased from 20% to no more than 5%; and the pressure holding time error decreased from approximately 10 seconds to less than 1 second. The comparison shows that this system has advantages such as high detection accuracy, high efficiency, and saving manpower and resources. It has functions such as data storage and printing, as well as browsing and printing historical data. Computer Testing Process The entire inspection process is as follows: The operator places the valve on the test bench and then leaves; pressure is regulated by an electric regulating valve; when the given pressure equals the actual pressure, the pressure holding test begins; the computer automatically times the pressure holding period according to the set time; after the pressure holding period ends, the industrial control computer controls the solenoid valve to release pressure; the on-site personnel remove the tested valve and make a preliminary judgment on its quality, and then, together with the computer operator, judge the valve quality based on the real-time display and historical data. Thus, in this entire process, only the installation and removal of the tested valve requires manual operation; the rest of the testing process is fully automated. Pressure control uses intelligent control, with small overshoot and stable pressure. Test data is automatically saved according to the valve type, valve model, test type, nominal diameter, etc., entered by the operator. When the stored data reaches the set maximum quantity, the operator is prompted whether to delete, move, or print the historical records. Two-valve detection and control system schematic diagram The entire measurement and control system is divided into ten detection lines, which can be operated independently or simultaneously. Each detection line consists of an electric valve, a solenoid valve, and a pressure sensor. The host computer is an Advantech industrial computer, which offers high reliability and cost-effectiveness. The control principle block diagram of the entire system is shown in Figure 1 (the thick black lines in the figure represent the liquid flow lines, except for the pressure sensor already indicated; the thick black arrows indicate the direction of fluid flow; and the thin lines represent control lines). [align=center] Figure 1 Valve computer detection system diagram (only the control part is shown)[/align] The schematic diagram of any one of the detection lines is shown in Figure 2 (the A/D board in the figure acquires the 4-20mA signal from the pressure sensor; the D/A board outputs a 4-20mA analog signal to the electric regulating valve; and the industrial computer provides a 0 or 5V switching signal to the solenoid valve through the control board). [align=center]Figure 2 Schematic diagram of a single measurement and control system[/align] The structural diagram of a single detection line system is shown in Figure 3: [align=center]Figure 3 Structural diagram of a single detection device system[/align] This system adopts pressure closed-loop control. The output signal of the pressure sensor is a standard signal (4-20mA current signal) directly provided to the A/D board. The industrial control computer calculates the pressure signal based on the feedback pressure signal, and then adjusts the output signal (D/A) to provide to the electric regulating valve. The pressure of the measured valve is adjusted by the opening of the electric regulating valve. The electric regulating valve itself has position closed-loop control and speed closed-loop control. Therefore, the entire measurement and control system actually constitutes a three-closed-loop control system. The measurement and control system software only needs to determine the system working status based on the pressure to complete the various functions of the system. Software of the three-measurement and control system 1. The system software is developed using Microsoft's Visual C++ 6.0. Visual C++ is one of the world's best object-oriented programming environments and has been well received and welcomed since its release. Its interface is beautiful and its functions are powerful, enabling the development of various 32-bit applications for Windows 95, Windows 98, and Windows NT. It uses an MFC application framework as its programming method, integrating the code and resource editor, compiler, linker, debugger, AppWizard, ClassWizard, Browser, and other functions provided by the programming environment, along with practical tools for different programming stages, improving programming efficiency and making programming work simpler and more efficient. Using its integrated development environment, the application structure can be viewed through a view; the completed application interface is shown in Figure 4 below. [align=center] Figure 4 Application software interface of the pressure measurement and control system[/align] 2. Program Application Interface Description: The window includes the entire valve testing process and specific test bench valve information and status prompts; data browsing, storage, and printing; it can display the pressure status of the valve being tested in real time and also view the historical records of valves previously tested; test bench information can be displayed separately. If the current valve is being tested, the operator can select the test bench information prompt in the lower left corner to view the information of other test benches; if the tested valve has a leak or other fault, or if there is a problem with the water circuit, such as abnormal pressure testing or inability to maintain pressure, a "beep" alarm will sound; the system can only work normally after all parameters are set correctly. If any parameters are not set, an alarm message will appear. If the test bench number is not filled in, the system cannot start working and will emit a "beep" alarm sound. Other options can be left blank, and the stored data uses default values: the default value for test type is sealing test, the default value for valve type is stop valve, the default value for number of tests is 1, the default value for valve model is J11T-16, the default value for test pressure is 2.4MPa, the default value for nominal diameter is DN50, and the default value for pressure holding time is 6 seconds. 3. The main program flowchart of the software is shown in Figure 5. The controller uses the PID algorithm and is implemented as a separate class. [align=center] Figure 5 Main Program Flowchart[/align] IV. Experimental Results and Conclusions of the System After a period of field application, the following conclusions can be drawn: Using computer control significantly improves the accuracy and efficiency of control, saving labor. Intelligent control eliminates the need for a precise mathematical model of the controlled object, resulting in superior control performance indicators. The following tables show the pressure variation over time, as shown in Tables 1-1 to 1-4: Table 1-1: Units 1# to 4#, commonly used pressure rating is 4 MPa (Pressure unit: MPa, Time unit: s) Table 1-2: Units 7# to 10#, commonly used pressure rating is 2.5 MPa (Pressure unit: MPa, Time unit: s) Table 1-3: Unit 5#, commonly used pressure rating is 2.5 MPa (Pressure unit: MPa, Time unit: s) Table 1-4: Unit 6#, commonly used pressure rating is 2.5 MPa (Pressure unit: MPa, Time unit: s) Analysis of Test Results: The results in Tables 1-1 to 1-4 show that, due to the significant categorization of valve detection pressures, intelligent control can meet the requirements. When the collected pressure equals or exceeds the given pressure within a short time frame, pressure holding begins. The test results show that in some valve test benches, the pressure continues to rise after pressure holding, while in others the pressure decreases. This is due to mechanical issues with the electric valves. However, overall, the pressure control is relatively accurate, the transition process is relatively fast, and it can meet the predetermined indicators, thus having promotional value. References: 1. Feng Yong et al. Modern Computer Numerical Control Systems. Beijing: Machinery Industry Press, 1996. 2. Hou Junjie. MFC Made Easy. Wuhan: Huazhong University of Science and Technology Press, 1998, 4. 3. Wang Jianping et al. Visual C++ 6.0 Programming. Beijing: Science Press, 2000. 4. Zhang Naiyao et al. Neural Networks and Fuzzy Control. Beijing: Tsinghua University Press, 1998.