Design of Gas Flow Control
System This system is based on the AVR series atmega32 microcontroller. By setting the PWM control register of atmega32 to generate a PWM wave with adjustable pulse width, the input voltage of the proportional solenoid valve is modulated, thereby realizing variable control of gas flow. The microcontroller collects the actual flow signal through the average velocity tube flowmeter, and uses the digital PID algorithm to modify the value of the PWM control register according to the signal, thereby achieving precise variable control. In order to prevent external interference signals from entering the control system, photoelectric isolation is used between the microcontroller and the average velocity tube to improve the reliability of the system.
The gas flow rate is monitored by an average velocity tube flowmeter, which is a differential pressure flowmeter, which is developed from a single-point velocity measurement pitot tube. Based on the energy conservation principle of fluid mechanics and following Bernoulli's law, a proportional solenoid valve is used to control the gas flow rate. Human-computer dialogue is achieved through a 4×4 keyboard and a 128×64 LCD module, which is convenient for user operation. The system structure is shown in Figure 1.
Figure 1 Block diagram of flow control system
The flow control algorithm
takes into account factors such as the nonlinearity of the pneumatic pump's pumping process and uses the knowledge of human experts and heuristic rules for solving problems to construct an expert controller, thereby achieving intelligent control of the flow and ensuring the stability of the pneumatic pump's air supply.
1 Introduction to Intelligent PID Control Based on Expert System
The expert system mainly consists of five parts: knowledge base, database, inference engine, interpretation part and knowledge acquisition part. The controlled object of this system has relatively large nonlinearity, hysteresis and other characteristics. Considering the requirements for its control performance, reliability and real-time performance, the expert system is simplified, no human-computer natural language dialogue is set, and the knowledge base and rule set are reduced. Therefore, the expert system becomes an expert controller, so that the expert system can be implemented on the controller.
The intelligent PID controller based on the expert system is shown in Figure 2. The expert knowledge base is formed by recording the PID parameters corresponding to the characteristics of the controlled object under various working conditions in the database based on the experience and knowledge of skilled operators or experts; the database stores the input and output signals and given signals of the controlled object (that is, the deviation and the rate of change of the deviation are obtained); the logic reasoning engine takes out the actual operation data from the database, selects the appropriate parameters from the expert knowledge base according to the given reasoning mechanism, and realizes the parameter self-tuning PID control.
Figure 2 Principle diagram of expert PID controller
2 Expert PID control of flow
In military industrial production, when we do not fully understand a system and the controlled object, or the structure and parameters of the controlled object cannot be fully mastered, or an accurate mathematical model cannot be obtained, it is often most convenient to use PID control technology. The PID algorithm has become one of the main technologies of industrial control due to its simple structure, good stability, reliable operation, high speed and convenience. The PID controller uses the proportion, integration and differentiation to calculate the control quantity according to the system error. The structure and parameters of the system controller must be determined through experience and on-site debugging.
The control law of the analog PID controller is:
(1)
where KP is the proportional coefficient, TI is the integral constant, TD is the differential constant, and u0 is the control constant.
Since the single-chip microcomputer control is a sampling control, it can only calculate the control quantity according to the deviation value at the sampling time, and cannot continuously output the control quantity like analog control for continuous control; and the amount of data processed by the single-chip microcomputer is limited. Taking into account the system, the incremental PID control is adopted, and its formula is:
u(k)=u(k-1)+Δu(k) (2)
Δu(k)=KP[e(k)-e(k-1)]+KIe(k) +KD[e(k)-2e(k-1)+e(k-2)] (3) The
gas flow value is used as the given value of the air pump after proportional conversion, and the flow of the air pump is controlled by the output of the PID controller. e(k) is the deviation between the given flow of the air pump and the actual measured value; e(k-1) is the error value at the previous moment; and e(k-2) is the error value at the previous sampling moment. KP is used to solve the amplitude oscillation. If KP is too large, the amplitude oscillation will be large, but the oscillation frequency will be small, and the system will take a long time to reach stability. KI is used to solve the speed of action response. If KI is too large, the response speed will be slow, and vice versa. KD is used to eliminate static errors. Generally, KD is set to a relatively small value, and has a relatively small impact on the system. [page]
Due to the particularity of gas flow measurement and the nonlinear, time-varying, and hysteresis characteristics of the gas control process, the above PID control algorithm cannot achieve satisfactory results, so the expert control rule is used for compensation control. According to the deviation of the gas pump and its rate of change, the controller proposed in this paper is designed according to the following 6 situations:
① When |e(k)|>M1 (amplitude of PWM wave), it means that the absolute value of the error is already very large. Regardless of the error change trend, the output of the controller should be considered to be the maximum (or minimum) output to achieve rapid adjustment of the error and reduce the absolute value of the error at the maximum speed.
Δu(k)=Δumax or Δu(k)= -Δumax (4)
At this time, the system is equivalent to implementing open-loop control.
② When e(k)·Δe(k)≥0, the error changes in the direction of increasing absolute value, or the error is constant and does not change. If |e(k)|>M2 (the set error limit) at this time, it means that the error is also large. It can be considered that the controller implements a stronger control action to achieve the change of the absolute value of the error in the direction of decreasing and quickly reducing the absolute value of the error. The output of the regulator can be
Δu(k)=KI{KP[e(k)-e(k-1)]+KIe(k)+KD[e(k)-2e(k-1)+e(k-2)]} (KI>1) (5)
Hardware Part Figure 3 PWM control system block diagram 2 Proportional solenoid valve Figure 4 Single-stage proportional solenoid valve Figure 5 Flow control flow diagram Figure 6 PID subroutine block diagram Figure 7 Simulation results Conclusion
If |e(k)|
③When e(k)·Δe(k)<0, Δe(k)·Δe(k-1)>0 or e(k)=0, it means that the error is decreasing or has reached a balanced state. At this time, we can consider keeping the output of the controller unchanged, and the output is
Δu(k)=0 (6)
④ When e(k)·Δe(k)<0, Δe(k)·Δe(k-1)<0, the error is at an extreme value and the system oscillates. If the absolute value of the error is large at this time, that is, |e(k)|≥M2, a stronger control action is adopted.
Δu(k)=K2KPe(k) (K2<1) (7)
Otherwise, a weaker control action is considered.
Δu(k)=K3KPe(k) (K3<1) (8)
⑤ When |e(k)|<ε, ε is an arbitrarily small positive number, which can be 0.001. At this time, the error is very small, and it is considered to add an integral link to reduce the steady-state error. The control algorithm is the ordinary proportional plus integral control
Δu(k)=KP[e(k)-e(k-1)] +KIe(k) (9)
⑥When e(k)=0, it means that the system has reached a balanced state, and the current control amount can be considered to be maintained unchanged. Debugging found that when the error reaches the control accuracy requirement, the current control amount can be maintained unchanged, thereby avoiding small-scale fluctuations and making the controlled object stabilize faster.
In summary, the control law of the system regulator is actually equivalent to a variable structure PID controller. Different control laws are selected according to the error and the error change so that the system can quickly reach the given flow value.
1 PWM Control Principle
The PWM control power output stage is a switch type structure with low power consumption. In the power drive amplifier circuit, the voltage signal of the PWM output needs to be converted into a current control signal of the proportional electromagnet. Therefore, a high-power field effect transistor IRF540 can be used, which can provide a sufficiently large current to drive the proportional electromagnet equivalent coil of the proportional valve. By adjusting the PWM wave of the single-chip microcomputer, the duty cycle of the solenoid valve input voltage can be adjusted, thereby realizing the adjustment of the flow rate.
PWM control system is a nonlinear and discontinuous control system. Its control principle is: first set an expected value for the controlled parameter, then compare the parameter with the measured actual value to obtain an error signal, and then compare the error signal with a triangular wave signal through a comparator. When the error signal is greater than the triangular wave signal, a pulse is output, otherwise no output. Therefore, the comparator outputs a series of rectangular waves with equal amplitude and unequal width, and its pulse width is linearly related to the error signal. According to this principle, the pulse output by the PWM controller is used to trigger the switch, and the switch triggers the actuator, which acts according to the time of the pulse width, thereby achieving the purpose of automatic control parameters.
In Figure 3, the output u(t) of the PWM controller is
In the formula, M is the amplitude of the PWM wave; T is the pulse period of PWM; Tk is the sampling time of the PWM wave, k=0, 1, 2, 3, ...; b is the proportional coefficient.
Proportional solenoid valve has been used since the late 1960s. It was originally used in hydraulic control systems. With the development of single-chip microcomputers and integrated circuits, it has gradually been applied to the flow control of various gases. The working principle of the proportional electromagnet is as follows: after the coil is energized, magnetic flux is generated inside the yoke and the armature, and electromagnetic attraction is generated, which attracts the armature to the yoke. At the same time, the spring on the armature is compressed. When the electromagnetic force on the armature and the spring force are balanced, the armature stops moving. When the armature of the proportional electromagnet moves, the air gap remains constant, that is, the armature is within the effective stroke range, and the suction force of the electromagnet is proportional to the current of the coil within the effective stroke range. At present, the proportional solenoid valves used for process control are all single-stage valves, which are not much different from ordinary single-stage solenoid valves, as shown in Figure 4. After the control signal enters the controller for amplification, a certain voltage is added to both ends of the proportional solenoid coil, which is converted into a certain current signal to drive the armature (i.e. the valve core) to open. After the electromagnetic force on the valve core and the spring force are balanced, the valve opening remains unchanged; when the input signal changes, the valve opening also changes, thereby achieving the purpose of controlling the required parameters. [page]
Software part
1 PWM wave generation
design uses single-chip microcomputer atmega32 to generate PWM signal. The PWM mode of atmega32 timer/counter can be divided into two categories: fast PWM and frequency (phase) adjustment PWM. This design uses fast PWM mode. Fast PWM can get a relatively high frequency PWM output, which has a relatively fast response and thus has high real-time performance. At this time, the counter only works in a one-way forward counting mode. The upper limit value of the counter determines the frequency of PWM, and the value of the comparison match register determines the size of the duty cycle. The control register settings of fast PWM mode are as follows:
//Output port initialization
PORTD=0x44;
DDRD=0x20;
//T/C1 initialization
TCCR1A=0xC3; /*OC1A outputs high level when compare match, clears ICP falling edge capture when at top value,
clock 1/8 division (tentative), that is, works in inverted PWM mode*/
TCCR1B=0x0A; //10-bit fast PWM mode
TCNT1H=0x00; //start at 0
TCNT1L=0x00;
2 Program flow of the control system
The flow chart of the control program is shown in Figure 5.
3 PID subroutine flow
The range of system error e(k) and error change rate Δe(k) is defined as e(k), e(k)={NB, NM, NS, O, PS, PM, PB}, and each element represents the flow difference and the flow difference change rate. According to different quantitative values of e(k), Δe(k) and the mathematical model of the controller, the corresponding controller calculation formula is selected for PID operation, thereby completing the intelligent control of the flow. The PID subroutine calculation flow of the expert PID control algorithm is shown in Figure 6.
Simulation under Matlab
Matlab is an analysis and simulation software for control systems. It can be used to simulate control systems easily and accurately. In order to verify the reliability of the digital PID algorithm, the incremental digital PID algorithm was simulated using the simulink component under Matlab6.5. The simulation results are shown in Figure 7. The simulation results show that the use of PID to modulate the PWM square wave has good dynamics and stability, thus proving the feasibility of the gas flow control system.
This design uses Siemens' dedicated PID module, which greatly simplifies the program. At the same time, the graphical programming method is used to make the program more intuitive and the interactive interface more friendly. The digital PID algorithm is combined with the PWM function of the AVR microcontroller to realize the control of gas flow. The PWM signal is used to control the size of the proportional solenoid valve opening to achieve continuous control of the flow and reduce hysteresis. At the same time, the incremental digital PID algorithm is used to adjust and realize closed-loop control, making the system adjustment more accurate and stable. In addition, the simulation is carried out using Matlab software to prove the feasibility of the system.
Previous article:Battery pack balancing circuit based on LTC68021 lithium battery pack management chip
Next article:Design of matrix keyboard based on ARM and its linux driver implementation
- Popular Resources
- Popular amplifiers
- ATmega16 MCU C language programming classic example (Chen Zhongping)
- Introduction to Artificial Intelligence and Robotics (Murphy)
- Chip Manufacturing: A Practical Tutorial on Semiconductor Process Technology (Sixth Edition)
- Microcontroller Principles and Applications Tutorial (2nd Edition) (Zhang Yuanliang)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Reprint] Summary of Zynq7010 NAND startup
- Free sharing of LDO and DCDC basic principle explanation video
- No response when controlling GPIO in user mode?
- Logistics POS machine with serial port expansion IC
- EEWORLD University Hall----Live Replay: Infineon system solutions make electric motorcycle design more reliable and efficient!
- EEWORLD University Hall----Live Replay: ADI's smoke detector integrated solution based on ADPD188BI
- How to use 4G base stations and 5G base stations in rural areas
- EEWORLD University Hall----Live Replay: Fujitsu Empowers Automotive Electronics Technology Transformation
- Fault Detection of Small Signal Analog Amplifier Circuit
- MSP430G2553 MCU Programming Experience