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 inside it 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 Flow control system block diagram
Flow control algorithm
Taking into account factors such as the nonlinearity of the pneumatic pump's gas pumping process, the knowledge of human experts and heuristic rules for solving problems are used to construct an expert controller, thereby realizing intelligent control of the flow rate and ensuring the stability of the pneumatic pump's gas supply.
1 Introduction to Intelligent PID Control Based on Expert System
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 calculates the control quantity based on the system error using proportion, integration and differentiation. 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 and perform continuous control like analog 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 problem of amplitude oscillation. If KP is too large, the amplitude of the amplitude oscillation will be large, but the oscillation frequency will be small, and the system will take a long time to stabilize. KI is used to solve the problem of action response speed. If KI is too large, the response speed will be slow, and vice versa. KD is used to eliminate static errors. Generally, the KD setting is relatively small and has little impact on the system.
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 valves
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 valves have been used since the late 1960s. They were originally used in hydraulic control systems. With the development of single-chip microcomputers and integrated circuits, they have 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 and spring force on the valve core 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.
Software Part
1 PWM Wave Generation
The design uses the single-chip microcomputer atmega32 to generate PWM signals. The PWM mode of the atmega32 timer/counter can be divided into two categories: fast PWM and frequency (phase) adjustment PWM. This design uses the fast PWM mode. Fast PWM can obtain a relatively high frequency PWM output, which has a relatively fast response and is therefore highly real-time. 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 the PWM, and the value of the compare match register determines the size of the duty cycle. The control register settings of the 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, working in inverted pwm mode*/
TCCR1B=0x0A; // 10-bit fast pwm mode
TCNT1H=0x00; // start at 0
TCNT1L=0x00;
2 Control system program flow
The flow chart of its 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 controller mathematical model, the corresponding controller calculation formula is selected for PID operation to complete the intelligent control of 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, Matlab software is used for simulation to prove the feasibility of the system.
Previous article:500W output wind turbine charging circuit
Next article:A brief discussion on wind energy technology in the wind power industry
- Popular Resources
- Popular amplifiers
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- 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
- 555 classic circuit diagram: 555 simple delay circuit diagram
- [Sipeed LicheeRV 86 Panel Review] 7. fbviewer and ts_test command test
- HyperLynx High-Speed Circuit Design and Simulation (III) Termination Resistance Experiment
- TUSB9261 -- USB3.0 to SATA interface bridge chip programming guide
- How about the Qinheng RISC-V core CH32V103 microcontroller?
- Transformer Isolation Switch
- Dual Limit Comparator (Window Comparator) Circuit
- If you urinate on a 380V high voltage wire (live electricity), will you be electrocuted? Will urine become a conductor and carry electricity, giving you an electric shock?
- Please help me find the schematic diagram, thank you very much
- msp430f5529 capture plus serial port source code