DESIGN OF ELECTRONIC CONTROL GOVERNOR FOR A SINGLE CYLINDER GASOLINE ENGINE BASED ON AN INTELLIGENT SENSING ALGORITHM

At present, most large machinery and vehicle engines are electronically controlled but their electronic control systems are too expensive to be popularised and applied in small gasoline engines with relatively low prices. Therefore, small gasoline engines still use mechanical speed regulators. Mechanical speed regulators not only have the defects of inertia lag, friction resistance, inherent speed regulation and the like, but also have the disadvantage that dynamic performance and steady performance cannot be combined, which is not suitable for the increasingly improved speed regulation performance of gasoline engines. This paper describes the design of an electronically controlled intelligent governor for small gasoline engines. Starting from a low cost, it adopts the idea of “replacing part of the hardware with an intelligent sensing algorithm” and proposes an intelligent sensing algorithm scheme. It combines the “coarse tuning” of MAP and the “fine tuning” of adaptive expert PID. The system is proved experimentally and it not only overcomes the inherent defects of a mechanical governor and realises programmable speed regulation, but it also obtains good dynamic and steady performance, improves the power output of the


INTRODUCTION
The single-cylinder gasoline engine is small in size, lightweight, cheap in price and easy to use It occupies an important position in various machine tools. The engine is generally equipped with a governor, which automatically adjusts the circulating fuel supply of the engine, according to changes in the engine load, to maintain a stable engine speed. At present, governors on small gasoline engines in our country still, generally, use mechanical governors. In addition to the defects of inertia lag and large friction resistance, mechanical governors cannot have both inherent speed regulation and dynamic and steady state performance. The disadvantage is that it can no longer meet the requirements of increasing performance in gasoline engines. Japan's Honda and Yamaha have successively launched a series of permanent magnet inverter generators but they are only for inverter generator sets and cannot be applied to regular, small gasoline engines. In China, scientific research units and universities, such as Chongqing University, have developed digital electronic control governors for small gasoline engines. All control circuit board units are connected to power sources, flameout circuits, and external equipment through wire harnesses. This increases the structural complexity and manufacturing cost of gasoline engines and is only at the experimental stage; it is not yet on the market.
In order to reduce the cost, overcome the current clutter of the electro-mechanical speed control system for gasoline, and to further improve the performance requirements of small gasoline engines (Aboelela, 2018), this article uses a single-cylinder four-stroke gasoline engine as an example. The aim is to develop an electronically controlled, intelligent governor with low price, high reliability, versatility and expandability.
Engenharia Agrícola, Jaboticabal, v.40, n.4, p.495-502, jul./aug. 2020 Analysis of the electronic control characteristics of a single-cylinder gasoline engine Analysis of electro-mechanical control of single-cylinder gasoline engines Different applications of single-cylinder gasoline engines have different requirements for the index of electronic control. For example, the household gasoline generator set produced by Blackstone requires that, under various loads, the steady-state frequency fluctuation range is ±0.35Hz and the corresponding single-cylinder gasoline engine speed fluctuation range is ±21rpm/min (Alkhayat et al., 2018). Therefore, steady-state performance is a very important index requirement for a single-cylinder gasoline engine to an electronically controlled governor. In such an engine, there are often sudden load increases and load reductions during the working process. Some models in Briggs & Stratton have higher system requirements during sudden load increases and decreases, such as the sudden increase of 100% load or a sudden decrease of response time ts≤0.3s (An, 2018;Szymkowicz & Benajes, 2018). Therefore, the electronically controlled governor must meet the rapid response of speed regulation under suddenly increasing or decreasing load conditions. Under low temperatures and light loads, there will often be different degrees of travelling phenomenon. Electric control governors are required to have a good response to travelling faults and they can accurately identify and take corresponding measures to improve people's experience. In short, the requirements of the single-cylinder gasoline engine for the electronically controlled governor are a good robust performance, fast system response, and high control accuracy, i,e. "stable", "fast", and "quasi" (Gupta et al., 2018;Hu et al., 2018).

Key technical points of electronically controlled governors for single-cylinder gasoline engines
The following key technologies were identified around the requirements of the three-cylinder gasoline engine for the governor's "stable", "fast", and "quasi".
First, an adaptive expert PID algorithm. Due to the non-linear relationship between the throttle opening and output power of a single-cylinder gasoline engine, especially when the throttle opening is large, the non-linearity will become more obvious. Therefore, the general PID adjustment is difficult, to meet the requirements of a single-cylinder gasoline engine (Lee et al., 2018). This paper uses adaptive Expert PID parameter adjustment to deal with the non-linear problem between throttle opening and output power.
Second, adaptive expert PID algorithm combined with MAP.
When a single-cylinder gasoline engine is equipped with a generator set, it is required to meet the instantaneous switching between no-load and full-load conditions and the maximum and minimum values of the speed change of the gasoline engine during the switching process are limited, while the adaptive expert PID adjustment cannot meet the requirements of this working condition. In order to adapt to this sudden load increase and sudden load decrease, this paper adopts MAP adjustment . Therefore, the self-adaptive expert PID algorithm is organically combined with the MAP chart in the program design and the two adjustment modes work cooperatively without interference from each other.
Third, hunting interference program. Many manufacturers reduce the emissions of single-cylinder gasoline engines under low load conditions to reduce their emissions, resulting in leaner oil vapour concentrations at low load conditions, especially in winter, when the oil-vapour evaporation mixing ability decreases, resulting in single-cylinder gasoline engines. Gasoline engines have large cyclical fluctuations and the phenomenon of excitement and oscillation will cause the phenomenon of travelling. The program will change the phase of the control adjustment and use advanced adjustments to interfere with the oscillation of the rotational speed, thereby suppressing the occurrence of travelling.
Fourth, intelligent sensing algorithm for the operating parameters of a single-cylinder gasoline engine.
To complete the implementation of the first three key technologies, data such as the speed, cylinder temperature, power, and crankshaft phase of a single-cylinder gasoline engine must be collected in real time. Single-cylinder gasoline engines are generally used in domestic and agricultural applications that are very cost-sensitive. In low-value scenarios, it is not realistic to use expensive sensors to collect data. In order to be able to obtain the operating parameters of a single-cylinder gasoline engine, we have adopted the method of intelligently analysing the relevant operating parameters to indirectly obtain the required parameters (see Section 2 for details).

Intelligent perception algorithm and scheme design
The so-called intelligent sensing algorithm uses software algorithms to replace the direct measurement of sensors to obtain related target parameter quantities. Parameters such as crankshaft phase, cylinder head temperature, and engine load required in the design of this paper are obtained through intelligent sensing algorithms. This article takes the acquisition of crankshaft phase parameters as an example, to illustrate the implementation of the algorithm scheme.
A single-cylinder gasoline engine completes a working cycle through four strokes of intake, compression, work, and exhaust (Lin & Zhu, 2016). In this process, the piston reciprocates up and down. Each reciprocating motion is called a stroke, which completes the intake stroke, compression stroke, and work. A working cycle is completed in four strokes, the crankshaft rotates twice and the camshaft and oil pump shaft rotate once (Lu et al., 2017). Only one of the four strokes is the work stroke and the remaining three are the auxiliary strokes of the work stroke, which consumes work. Because the crankshaft rotation accelerates during the power stroke and the other three strokes are decelerate, the instantaneous working speed of the four-stroke gasoline engine is uneven.
According to the non-uniformity of the instantaneous working speed of a four-stroke gasoline engine, the piston stroke position is calibrated by measuring the rotating speed, and then the crankshaft phase is determined . This is then introduced as the crankshaft phase in the Engenharia Agrícola, Jaboticabal, v.40, n.4, p.495-502, jul./aug. 2020 intelligent sensing algorithm scheme, as shown in Fig. 1. A single-toothed signal disc is set on the crankshaft and a Hall sensor is fixed on the four-stroke gasoline engine. The Hall sensor is paired with the single-toothed signal disc. When the single-toothed signal disc rotates with the crankshaft, the Hall sensor senses the single-toothed signal. When the four-stroke gasoline engine piston is at the top dead-centre position, the angle between the Hall sensor and the signal teeth is α and the value of α is less than 180°. Starting from the piston at the top dead-centre position, the signal teeth follow the crankshaft rotation direction. If the signal tooth is opposite to the Hall sensor, then when the Hall sensor measures the signal, the crank angle of the crankshaft will be at α degrees after the piston is at top dead-centre, and the value of α will be recorded as "-". The signal tooth rotates α degrees with the crankshaft in the reverse direction of the crankshaft rotation. If the signal tooth is opposite to the Hall sensor then, when the Hall sensor measures the signal, the piston is α degrees before the top dead-centre and the value of α will be recorded as "+" (Vipavanich et al., 2018). When the four-stroke internal combustion engine is operating, the single-tooth signal transmitted by the Hall sensor to the electronic control system is defined as signal S, as shown in Fig.2. The interval between the two signals S is defined as time t and the rotational speed is calculated according to time t and defined as rotational speed n. The electronic control system program records each two adjacent signals of S as S0 and S1, so that a series of recorded signals are S0, S1, S0, S1, S0, S1, etc. Sequentially, the corresponding time t is also labelled as t0, t1, t0, t1, t0, t1, etc. The corresponding speed n is also labelled: n0, n1, n0, n1, n0, n1, n0, n1, etc. and arranged in order, as shown in Fig.3. According to the working principle of the four-stroke internal combustion engine, during one working cycle, the crankshaft rotates two revolutions, so that the electronic control system will receive a signal S0 and a signal S1 during a cycle, and the stroke position of the piston at the time of receiving the signals S0 and S1 is different. However, for a series of recorded signals S, the stroke position of the piston is the same at all signals S0, and the stroke position of the piston is the same at all signals S1. . Schematic diagram of the relationship between instantaneous speed, angular acceleration, signal S and crank angle of a single-cylinder, four-stroke gasoline engine The electronic control system calibrates the piston stroke position, i.e. it determines the stroke position of the four-stroke, internal combustion engine piston when the electronic control system receives signals S0 and S1 (as shown in Fig.3) compared to the values of n0 and n1 or the values of t0 and t1. If the value of n0 is greater than the value of n1, the corresponding t0 is smaller than the value of t1. At the time of signal S0, the four-stroke, internal combustion engine piston is at crank angle α from the top dead-centre of the exhaust. The value of α is "+". Α degree before the air top dead-centre, α value is "-", which is α degrees after exhaust top dead-centre. At the moment of signal S1, the four-stroke, internal combustion engine piston is at the crank angle position α degrees from compression top dead-centre; otherwise, t0. When the value is greater Engenharia Agrícola, Jaboticabal, v.40, n.4, p.495-502, jul./aug. 2020 than t1, at the time of signal S0, the piston of the four-stroke, internal combustion engine is at a position of crank angle α degrees from the top dead-centre of compression. Therefore, the value of the crankshaft phase is determined (

Design of Gasoline Electromechanical Speed Control System
Mathematical model and error analysis of gasoline electromechanical speed control system.
Taking the S3500 gasoline engine from Blackstone as an example, the basic parameters are shown in Table. The open-loop system model of the gasoline engine is established by using the simulink module provided in Matlab, as shown in Fig.4. The simulation results are shown in Fig.5①. Obviously, without the closed-loop adjustment of the throttle valve, as the load decreases, the rotational speed will gradually increase, and vice versa. Based on Fig.4, the general PID and adaptive expert PID algorithm is added in turn, to form a closed-loop system and run the simulation. The results are shown in Fig.5② and Fig.5③; the throttle opening can be controlled. For the purpose of controlling the engine speed, the adaptive expert PID algorithm is better than the general PID, in both dynamic and steady state performance. The Matlab simulation model of the single-cylinder, four-stroke gasoline engine adaptive expert PID control system is shown in Fig.6.    Adaptive PID FIGURE 6. Matlab simulation model of adaptive PID control system for a single-cylinder, four-stroke gasoline engine.

Hardware design of electronically controlled governor
The intelligent, electric control governor of the small gasoline engine designed in this paper is mainly composed of a detection unit, controller unit and actuator. The core of the system control uses a general-purpose STM32f103 controller (from STMicroelectronics) as the main control chip. The speed sensor uses the 2144E Hall sensor. The actuator is a 24BYJ48-025U decelerating permanent magnet stepper motor. The system block diagram is shown in Fig.7.
Working process: the Hall sensor senses the magnetic field change signal of the magnet on the flywheel of the gasoline engine and transmits it to the main control unit. The main control unit processes the relevant input signals according to the software design and outputs the corresponding action commands. The execution unit drives the throttle on the carburetor of the gasoline engine according to the command, thereby adjusting the speed and power output of the gasoline engine. The designed control circuit board is shown in Fig.8.

Software Flowchart Design of Electric Control Governor
According to the working characteristics of single cylinder gasoline engine, based on the reduction of hardware circuit, the corresponding signals and data are deeply analyzed and utilized by using the intelligent sensing technology scheme of piston stroke position introduced in this paper, and the parameters such as cylinder head temperature, crankshaft phase and load required in the program are obtained. The software flow chart of the system designed through these parameters is shown in Fig.9.

Program Design of Electric Control Governor
The main program is composed of a calling start subprogram, a protection subprogram, a PID subprogram module (Sun et al., 2016), a MAP lookup module, a timer interrupt module, a capture interrupt module, and a motor driver subprogram. The Hall sensor detects the speed signal on the crankshaft of a four-stroke gasoline engine, and determines whether to call the adaptive expert PID subroutine for adjustment or coarse map adjustment, based on the measured speed value and the perceived crankshaft phase and other parameters. If the coarse adjustment of the MAP is called for, then the protection subroutine is called first, to determine which type of current running state the engine belongs to: overspeed, overload, start, stop, or sudden change of load, etc. If the conditions that require the engine to stop are not met, then adjust it through the load and position table on the engine MAP. The output throttle opening change ΔV is sent to the motor drive subroutine and, finally, the throttle opening V and the current time t are output. In the program design, according to the parameter differences between the stable operating conditions of the engine and the special conditions, such as sudden increase or decrease in load, creatively apply MAP control ("coarse adjustment") and adaptive expert PID control ("fine adjustment") (Zhao et al., 2019). Fusion algorithms enable compatibility between the speedy, steady-state operation and fast response of throttle opening (Xie et al., 2017;Zhao et al., 2018

System experimental verification
The electronically controlled, intelligent governor housing is equipped with a throttle drive motor, sensor components, control circuit board, circuit board bracket, limit stop, wire harness, and governor cover to form an assembly. This is bolted through, connected and fixed on the Blackstone S3500 gasoline generator set, as shown in Fig.10. The comparative experimental results are shown in Fig.11. The system response of the original system, equipped with a mechanical governor is shown as the blue line I, and the system response of the electronically controlled, intelligent governor described in this article is shown as the red line II. Fig.11(a) shows the speed output of the gasoline generator set at no-load start. Obviously, the speed and steady-state performance of II is better than I, and the speed of II is stable at the target speed of 3600 r/min; I deviates from the target speed but is stable at about 3700 r/min. When the 'no-load' status is suddenly increased to 100% full load, the system response is shown in Fig.11(b). The speed of Ⅰ drops suddenly and the dynamic performance deteriorates, finally stabilising at 3480 r/min. The dynamic performance of II is good and the rotation speed is stable at about 3650 r/min. The speed of the generator set, equipped with this electronically controlled speed governor, does not decrease when it is switched from no-load to high-load operations. Its advantages are as follows: on the one hand, the output power of the gasoline engine is increased but, on the other hand, the efficiency of the generator is improved, so that the efficiency of power generation is increased from approximately 81% to 86%, which improves the power of the generator set. A comprehensive comparison of Table.1 and Fig.11 can be obtained. The electrically controlled, intelligent speed governor not only solves the inherent speed regulation problem of the mechanical speed governor but it also realises programmable speed adjustment. It also improves the dynamic and steady-state performance of the system, gives full play to the calibrated power of the generator set, and improves the power output. Under the same conditions, the power output increased from 3.5KW to 3.8KW, which means that power out has increased by nearly 10%. In addition, through multiple experiments, it was found that the fuel consumption of the electronically controlled governor was also reduced by 5% compared to the mechanical governor. At the same time, it relieves the trouble of engine travelling and improves the freedom of carburetor matching.

CONCLUSIONS
The superiority of the electronically controlled, intelligent governor designed in this paper is evident with respect to its "Micro" and "Macro" aspects. The "Micro" superiority is as follows. On the one hand, most of the parameters required for engine operation control are obtained via in-depth analysis and utilisation of corresponding signals and data in software design, thereby achieving low cost and avoiding hardware sensors or errors in the control system, caused by the failure of the hardware circuit. On the other hand, for the parameter differences between the stable operating conditions of the engine and the special conditions, such as sudden addition and sudden reduction of load, the creative application of "coarse adjustment" and "fine adjustment" blended algorithms allow compatible speeds for steady-state operations and a fast response to throttle opening. The electronically controlled, intelligent governor is finally installed directly on the gasoline engine, in the form of an assembly. The "Macro" advantage lies in solving the inherent speed regulation problem of the mechanical governor, which can run a constant speed or program. The trouble of traveling block is solved and the working stability of gasoline engine is greatly improved; it has increased the power output of the unit by 10%, reduced fuel consumption by 5%, improved sports performance under various conditions, and improved the user experience. Therefore, this electronically controlled, intelligent governor will have broad application prospects and market potential.