# Servo System Control of Turntable Lipstick-Filling Machine Based on Particle Swarm Optimization

Authors: Xiangqiang Zhong; Wenbo Tao; Lingling Zou; Huaian Yang; Shunyu Yao
Journal: Advances in Materials Science and Engineering
 (2022)

---

## Abstract

In order to improve the production quality of the lipstick-filling machines and the performance of the equipment, the structure of a turntable lipstick-filling machine was designed and the servo control was optimized, considering the known production defects. First, based on the lipstick-filling process, the structure of the turntable lipstick-filling machine was designed. Regarding the bubble problem in lipstick filling, an elastic connecting rod vibration device was designed. Based on the principle of PMSM and a position servo system, a mathematical model of the lipstick-filling servo system was established, the system transfer function was calculated and its dynamic performance was analyzed. Combined with the transfer function, the lipstick-filling servo system PID control and particle swarm optimization PID control simulation models were built. The system adjustment timets was 0.7 s under particle swarm optimization. Finally, a prototype was built to verify the simulation optimization results. The experimental results demonstrate that the qualified rate of lipstick filling, under the particle swarm optimization PID control implementation, is 97%, indicating that the particle swarm algorithm is quite applicable and has an economic impact by improving the accuracy and stability of the lipstick-filling servo system.


---

## Body

## 1. Introduction

The filling machine is a generic type of mechanical equipment used to quantitatively inject liquid material into containers and repack finished products. The rapid development of the global economy raises people’s demand for products that can improve the quality of life, setting high requirements for more stable control and precise positioning of filling equipment to achieve the production purpose of excellence [1, 2]. Therefore, the design level of the position servo system becomes the key to establishing whether the filling machine is advanced or not.Due to the development of new control theory and digital technology, the application of servo control systems in displacement control grows more mature. Traditional management has been gradually replaced and the basis of modern industrial control has been established. It is widely used in elevator control, tank turret displacement control, missile angular displacement control, etc [3]. For example, the UK’s Renishaw XR20-W wireless rotary shaft calibration device can achieve a resolution of 0.1 angle/s and ultra-high measurement accuracy of ±one angle/s. A 19-bit assembled three-stage induction has been developed by the Shenyang Institute of Automation, at the Chinese Academy of Sciences. Experiments show that the maximum division interval error of the zero position is ±0.75 angle/s, while the encoder’s resolution is ±0.3 angle/s [4]. In view of the research in the servo system displacement control optimization strategy domain, Hu of the Harbin University of Technology adds a diagonal recurrent neural network algorithm to the traditional PID control. This algorithm is executable online, making it possible to adjust the PID controller parameters in real-time [5, 6].Wu et al. [7] used the particle swarm optimization algorithm to optimize the PID controller parameters of battery charging. The experimental results show that the battery charging efficiency is significantly improved. Chen and Huang [8] used the particle swarm optimization algorithm to obtain the global solution of the optimization problem, thus addressing the PID controller parameter tuning issue.Aiming at the problems of low production quality, poor stability, substandard filling accuracy, rough modeling, and insufficient intelligence of filling equipment, this paper focuses on the structural design and optimization of the lipstick-filling machine, the servo control system, and control algorithm optimization. An elastic connecting rod vibration device is proposed to solve the problem of lipstick-filling bubbles. Aiming at the demand for high precision and fast response, the mathematical model of the filling servo system is built based on PMSM as the main control object. In view of the shortcomings of traditional PID parameter tuning, the particle swarm optimization algorithm is introduced, to optimize the PID controller parameters in an effort to achieve better results. Experiments show that the particle swarm optimization control strategy can improve the stability and filling accuracy of the lipstick-filling system.


## 2. Structure Design and Optimization of Turntable Lipstick-Filling Machine

### 2.1. Production Process in a Lipstick-Filling System

This system serves the goal of lipstick quantitative filling production, which combined with the lipstick filling principle and filling process puts forward a design scheme of a highly efficient turntable lipstick filling machine (Figure1).Figure 1
Structure layout of turntable lipstick-filling machine.The structure of the turntable lipstick filling machine includes a silica mold turntable, mold conveying device, pipe clamping device, barrel, filling valve, pretemperature return device, cooling tank, rotating cover device, and a lifting mechanism, which cooperates with various cylinders and motors to complete the full-automatic lipstick-filling task.Compared to the traditional lipstick filling machine, the proposed improvement on its operation is mainly as follows: the processes of a complete sequence, such as preheating, injection, cooling, rewarming, cooling, and demolding of the die for lipstick production, are distributed along a circle to make the structure more compact. Moreover, the filling valve can fill four lipsticks at a time, while the silica supply mode of the filling system is rotary and continuous. In addition, the production of lipstick of different specifications can be achieved by simply changing the mold. Manual removal is replaced by the robotic manipulator, while the whole machine is controlled and managed by pneumatic logic controller, combined with a human-computer interface [9]. Compared to the traditional filling machines, the proposed equipment shows some improvement in flexibility, production efficiency, and intelligence.


### 2.2. Structure Design of Turntable Lipstick-Filling Machine

The production process, along with the overall structure of the new turntable lipstick-filling machine is shown in Figure2.Figure 2
Turntable type lipstick-filling machine overall structure. (1) Capping system; (2) mold table; (3) pipe clamping system; (4) injection system; (5) prereturn temperature system; and (6) main turntable.The production process of the turntable lipstick filling machine is divided into three modules: filling, demolding, and capping. The preheating, injection, and return temperature systems are part of the filling module; the central turntable and pipe clamping system belong to the demolding module, while the capping system belongs to the capping module. If the turntable lipstick-filling machine is divided into modules, the transmission and control systems, the body structure and the aforementioned three working modules together constitute the complete structure of the lipstick-filling machine [10].


### 2.3. Design of Vibration Device for Turntable Lipstick-Filling Machine

#### 2.3.1. Analysis of the Bubble Problem

In the actual filling production process of lipstick, a small number of pits are formed on the surface after cooling and forming. This occurs because bubbles are mixed in during filling, while the remaining bubbles cannot be discharged resulting in remaining gas holes after the lipstick cools, contributing to an unattractive final product. The main reason is usually due to improper setting of material temperature or excessive filling speed. In the actual production process, the preheating and the material temperature are usually increased, in order to reduce the bubbles occurrence. However, many lipsticks on the market contain active ingredients, which cannot be heated up blindly. The way to quickly determine the optimal temperature depends heavily on the working experience of the operator.Considering that the bubble is attached to the inner wall of the silica mold, this study uses the fast vibration method to force the drop to detach from the inner wall and float up to the liquid surface under the effect of the density difference. Thus, the problem of the gas hole is solved, saving the temperature debugging link and significantly improving the economy and work efficiency.


#### 2.3.2. Elastic Connecting Rod Vibration Device

According to the bubble solution, a vibrating body is used, embracing the silica mold and generating high-speed micro amplitude vibration. The vibration displacement is controlled within 2.4 mm and the vibration frequency is about 60 Hz, in order to ensure a good defoaming effect. The structure of the elastic connecting rod-type vibration device is shown in Figure3. It is a double-mass vibration device, which is mainly composed of the excitation device, the working mass, the balance mass, the main vibration spring, the frame, and the swing bar [2, 11].Figure 3
Elastic connecting rod vibration device.The model is imported into Adams, where constraints, loads, and drives are added. The rotational speed of the movement is 20000 d/s, the simulation time is 0.5 s, and the number of steps is 250. Τhe working mass is forced to vibrate under the simple harmonic excitation with a vibration period of 0.018 s, causing a displacement, as shown in Figure4. The simulation results show that the displacement difference in the X direction is 2.125 mm, while in the Y direction is 1.1 mm. The vibration displacement of the working mass is described in the following equation, proving to be less than 2.4 mm, while the periodic vibration is stable and reliable meeting the design requirements:(1)S=sx2+sy2=2.39mm.Figure 4
Vibration displacement of a working plastid. (a) Displacement of a working plastid in thex direction. (b) Displacement of a working plastid in the y direction.
(a)(b)


## 2.1. Production Process in a Lipstick-Filling System

This system serves the goal of lipstick quantitative filling production, which combined with the lipstick filling principle and filling process puts forward a design scheme of a highly efficient turntable lipstick filling machine (Figure1).Figure 1
Structure layout of turntable lipstick-filling machine.The structure of the turntable lipstick filling machine includes a silica mold turntable, mold conveying device, pipe clamping device, barrel, filling valve, pretemperature return device, cooling tank, rotating cover device, and a lifting mechanism, which cooperates with various cylinders and motors to complete the full-automatic lipstick-filling task.Compared to the traditional lipstick filling machine, the proposed improvement on its operation is mainly as follows: the processes of a complete sequence, such as preheating, injection, cooling, rewarming, cooling, and demolding of the die for lipstick production, are distributed along a circle to make the structure more compact. Moreover, the filling valve can fill four lipsticks at a time, while the silica supply mode of the filling system is rotary and continuous. In addition, the production of lipstick of different specifications can be achieved by simply changing the mold. Manual removal is replaced by the robotic manipulator, while the whole machine is controlled and managed by pneumatic logic controller, combined with a human-computer interface [9]. Compared to the traditional filling machines, the proposed equipment shows some improvement in flexibility, production efficiency, and intelligence.


## 2.2. Structure Design of Turntable Lipstick-Filling Machine

The production process, along with the overall structure of the new turntable lipstick-filling machine is shown in Figure2.Figure 2
Turntable type lipstick-filling machine overall structure. (1) Capping system; (2) mold table; (3) pipe clamping system; (4) injection system; (5) prereturn temperature system; and (6) main turntable.The production process of the turntable lipstick filling machine is divided into three modules: filling, demolding, and capping. The preheating, injection, and return temperature systems are part of the filling module; the central turntable and pipe clamping system belong to the demolding module, while the capping system belongs to the capping module. If the turntable lipstick-filling machine is divided into modules, the transmission and control systems, the body structure and the aforementioned three working modules together constitute the complete structure of the lipstick-filling machine [10].


## 2.3. Design of Vibration Device for Turntable Lipstick-Filling Machine

### 2.3.1. Analysis of the Bubble Problem

In the actual filling production process of lipstick, a small number of pits are formed on the surface after cooling and forming. This occurs because bubbles are mixed in during filling, while the remaining bubbles cannot be discharged resulting in remaining gas holes after the lipstick cools, contributing to an unattractive final product. The main reason is usually due to improper setting of material temperature or excessive filling speed. In the actual production process, the preheating and the material temperature are usually increased, in order to reduce the bubbles occurrence. However, many lipsticks on the market contain active ingredients, which cannot be heated up blindly. The way to quickly determine the optimal temperature depends heavily on the working experience of the operator.Considering that the bubble is attached to the inner wall of the silica mold, this study uses the fast vibration method to force the drop to detach from the inner wall and float up to the liquid surface under the effect of the density difference. Thus, the problem of the gas hole is solved, saving the temperature debugging link and significantly improving the economy and work efficiency.


### 2.3.2. Elastic Connecting Rod Vibration Device

According to the bubble solution, a vibrating body is used, embracing the silica mold and generating high-speed micro amplitude vibration. The vibration displacement is controlled within 2.4 mm and the vibration frequency is about 60 Hz, in order to ensure a good defoaming effect. The structure of the elastic connecting rod-type vibration device is shown in Figure3. It is a double-mass vibration device, which is mainly composed of the excitation device, the working mass, the balance mass, the main vibration spring, the frame, and the swing bar [2, 11].Figure 3
Elastic connecting rod vibration device.The model is imported into Adams, where constraints, loads, and drives are added. The rotational speed of the movement is 20000 d/s, the simulation time is 0.5 s, and the number of steps is 250. Τhe working mass is forced to vibrate under the simple harmonic excitation with a vibration period of 0.018 s, causing a displacement, as shown in Figure4. The simulation results show that the displacement difference in the X direction is 2.125 mm, while in the Y direction is 1.1 mm. The vibration displacement of the working mass is described in the following equation, proving to be less than 2.4 mm, while the periodic vibration is stable and reliable meeting the design requirements:(1)S=sx2+sy2=2.39mm.Figure 4
Vibration displacement of a working plastid. (a) Displacement of a working plastid in thex direction. (b) Displacement of a working plastid in the y direction.
(a)(b)


## 2.3.1. Analysis of the Bubble Problem

In the actual filling production process of lipstick, a small number of pits are formed on the surface after cooling and forming. This occurs because bubbles are mixed in during filling, while the remaining bubbles cannot be discharged resulting in remaining gas holes after the lipstick cools, contributing to an unattractive final product. The main reason is usually due to improper setting of material temperature or excessive filling speed. In the actual production process, the preheating and the material temperature are usually increased, in order to reduce the bubbles occurrence. However, many lipsticks on the market contain active ingredients, which cannot be heated up blindly. The way to quickly determine the optimal temperature depends heavily on the working experience of the operator.Considering that the bubble is attached to the inner wall of the silica mold, this study uses the fast vibration method to force the drop to detach from the inner wall and float up to the liquid surface under the effect of the density difference. Thus, the problem of the gas hole is solved, saving the temperature debugging link and significantly improving the economy and work efficiency.


## 2.3.2. Elastic Connecting Rod Vibration Device

According to the bubble solution, a vibrating body is used, embracing the silica mold and generating high-speed micro amplitude vibration. The vibration displacement is controlled within 2.4 mm and the vibration frequency is about 60 Hz, in order to ensure a good defoaming effect. The structure of the elastic connecting rod-type vibration device is shown in Figure3. It is a double-mass vibration device, which is mainly composed of the excitation device, the working mass, the balance mass, the main vibration spring, the frame, and the swing bar [2, 11].Figure 3
Elastic connecting rod vibration device.The model is imported into Adams, where constraints, loads, and drives are added. The rotational speed of the movement is 20000 d/s, the simulation time is 0.5 s, and the number of steps is 250. Τhe working mass is forced to vibrate under the simple harmonic excitation with a vibration period of 0.018 s, causing a displacement, as shown in Figure4. The simulation results show that the displacement difference in the X direction is 2.125 mm, while in the Y direction is 1.1 mm. The vibration displacement of the working mass is described in the following equation, proving to be less than 2.4 mm, while the periodic vibration is stable and reliable meeting the design requirements:(1)S=sx2+sy2=2.39mm.Figure 4
Vibration displacement of a working plastid. (a) Displacement of a working plastid in thex direction. (b) Displacement of a working plastid in the y direction.
(a)(b)


## 3. The Characteristic Analysis of Lipstick-Filling Servo System Based on PMSM

### 3.1. Servo Motor Selection

Information about the parameters of the lipstick-filling servo system is listed in Table1 based on the structure and investigation of the designed lipstick-filling machine.Table 1
Lipstick-filling servo system parameters.
Feeding speed of filling pistonV0Feed per cyclelPositioning timet0Operation cycletfQuality of sports mechanismMDrive efficiencyηFriction coefficientμBall screw leadPBBall screw diameterDBBall screw lengthLB30000 mm/min150 mm1 s1.5 s40 kg0.80.410 mm20 mm300 mmAccording to Table1, the servo motor HG-KN43J-S100 is a suitable candidate, while the servo driver MR-JE-40B can be used to realize high-precision filling control.


### 3.2. Theoretical Analysis of PMSM

In order to describe the steady and dynamic performance of the PMSM system, the DQ axis rotation coordinates system is introduced [12] (fixed to rotor).The voltage equation of PMSM, defined in the DQ axis rotation coordinates system is as follows:(2)uq=Rsiq+pψq+ωrψd,(3)ud=Rsid+pψd−ωrψq.PMSM electromagnetic torque current and motion equation are as follows:(4)Tem=pnψfiq+Ld−Lqidiq,(5)Tem=TL+Bωm+Jpωm.The PMSM mathematical model is composed of voltage equations (2) and (3), the electromagnetic torque equation (4), and the motion equation (5). The mathematical model contains the product term of the mechanical angular velocity ωm and the current components id and iq, which indicates that there is a mutual interference and coupling between variables, so the model is nonlinear meaning the electromagnetic torque cannot realize the linearization control. It cannot achieve a high-performance control effect [13].According to the analysis of the PMSM mathematical model, the control of motor output torque is ultimately attributed to the management ofd and q current components, realized by voltage control. The aforementioned high-performance control requirements are achieved by using the current feedback vector decoupling control to disengage the id and iq components.By default, the air gap magnetic field of PMSM is uniformly distributed, that isLd = Lq = La, so the torque equation is as follows:(6)Tem=pnψfiq.According to (6), the electromagnetic torque has a positive linear correlation with the q-axis current component but is independent of the d-axis current component. The copper loss will rise with the existence of d axis current component, so the current control method of id=0 is adopted [14].In the servo system, it is necessary to quickly and accurately control the torque of the servo motor, so the feedback control of the current is quite essential. The given input command currentid∗,iq∗ and feedback current id,iq are subtracted by the voltage type inverter, while the difference is the input to the current controller Gi. The voltage components ud,uq in the DQ coordinates system are obtained as follows:(7)ud=Giid∗−id,uq=Giiq∗−iq.Combining equations (7) with (2) and (3), the current feedback decoupling control block diagram is derived, as shown in Figure 5. The id=0 control scheme can learn the approximate decoupling control of PMSM, in dynamic and static states so as to realize fast and high-precision torque control.Figure 5
Current feedback decoupling control block diagram.


### 3.3. Mathematical Model of Lipstick-Filling Servo System

In the case where the vector direction in the armature current vector control is the same as theq-axis direction (id=0), the voltage and torque equations are sorted out again as follows:(8)ud=−ωrLaiq,uq=Rsiq+Ladiqdt+Ef,Tem=pnψfiq,(9)uq−Ef=Rsiq+Ladiqdt=Rsiq+Tadiqdt.Laplace transforms the current in (9) as follows:(10)IqsUqs−Efs=KaTas+1,where, pnLa is the PMSM electrical time constant and Gis is reciprocal of the armature winding resistance.Substituting the electromagnetic torque equation into the motor motion equation yields the following:(11)pnψfiq=TL+Jdωmdt.LetpnψfKe (PMSM EMF constant). By simplifying equation (11) and using Laplace transformation on ωm, the following relation is derived:(12)ωmsiqs−iLs=1Js/Ke.SubstitutingEfωmKe into equation (12) can derive the transfer function between induced electromotive force and current (excluding viscous friction damping coefficient).(13)Esiqs−iLs=1Js/KeKe.Based on equation (13), the dynamic structure diagram of PMSM is shown in Figure 6.Figure 6
PMSM dynamic structure diagram.The open-loop transfer function can be obtained from the graph in Figure6.(14)GMs=KaKeJsTas+1=KMsTas+1,where, Ka, Ke, and J are all known quantities.Based on the servo system structure, the structure diagram of the lipstick-filling servo system, with PMSM acting as the actuator, is established, as shown in Figure7.Figure 7
Servo structure diagram of the lipstick-filling system.The transfer function of each link of the lipstick-filling servo system is approximately obtained, while their integration leads to the transfer function of the whole system [15].(15)Gs=KsTas+1,where, K=KdKMKL, Kd is the transfer function of the power conversion link and KL is the transmission function of the screw drive link. Combining the parameters of the servo motor and servo driver, the values Ta = 0.25 and KM = 0.08 can be obtained. The specific transfer function is approximately obtained by analyzing the actual working conditions.(16)Gs=26s2+4s.


### 3.4. Dynamic Performance Analysis of the Servo System

In order to analyze the performance of the lipstick-filling servo system and determine whether it can meet the needs of the subsequent simulation, the dynamic performance of the transfer function is analyzed. Considering the step signal of the system as the input, the Simulink module of MATLAB is used to build the simulation model of the step response of the system, producing the system response curve, as shown in Figure8. It is evident that the step response is a curve starting at the initial value of 0, followed by an initial oscillation and converging to a constant value. The steady-state error id is 0, the transient process is steady, and the regulating time is 3 s. Overall analysis shows that the system is stable exhibiting high accuracy and quick response.Figure 8
Step response curve of the servo system transfer function.


## 3.1. Servo Motor Selection

Information about the parameters of the lipstick-filling servo system is listed in Table1 based on the structure and investigation of the designed lipstick-filling machine.Table 1
Lipstick-filling servo system parameters.
Feeding speed of filling pistonV0Feed per cyclelPositioning timet0Operation cycletfQuality of sports mechanismMDrive efficiencyηFriction coefficientμBall screw leadPBBall screw diameterDBBall screw lengthLB30000 mm/min150 mm1 s1.5 s40 kg0.80.410 mm20 mm300 mmAccording to Table1, the servo motor HG-KN43J-S100 is a suitable candidate, while the servo driver MR-JE-40B can be used to realize high-precision filling control.


## 3.2. Theoretical Analysis of PMSM

In order to describe the steady and dynamic performance of the PMSM system, the DQ axis rotation coordinates system is introduced [12] (fixed to rotor).The voltage equation of PMSM, defined in the DQ axis rotation coordinates system is as follows:(2)uq=Rsiq+pψq+ωrψd,(3)ud=Rsid+pψd−ωrψq.PMSM electromagnetic torque current and motion equation are as follows:(4)Tem=pnψfiq+Ld−Lqidiq,(5)Tem=TL+Bωm+Jpωm.The PMSM mathematical model is composed of voltage equations (2) and (3), the electromagnetic torque equation (4), and the motion equation (5). The mathematical model contains the product term of the mechanical angular velocity ωm and the current components id and iq, which indicates that there is a mutual interference and coupling between variables, so the model is nonlinear meaning the electromagnetic torque cannot realize the linearization control. It cannot achieve a high-performance control effect [13].According to the analysis of the PMSM mathematical model, the control of motor output torque is ultimately attributed to the management ofd and q current components, realized by voltage control. The aforementioned high-performance control requirements are achieved by using the current feedback vector decoupling control to disengage the id and iq components.By default, the air gap magnetic field of PMSM is uniformly distributed, that isLd = Lq = La, so the torque equation is as follows:(6)Tem=pnψfiq.According to (6), the electromagnetic torque has a positive linear correlation with the q-axis current component but is independent of the d-axis current component. The copper loss will rise with the existence of d axis current component, so the current control method of id=0 is adopted [14].In the servo system, it is necessary to quickly and accurately control the torque of the servo motor, so the feedback control of the current is quite essential. The given input command currentid∗,iq∗ and feedback current id,iq are subtracted by the voltage type inverter, while the difference is the input to the current controller Gi. The voltage components ud,uq in the DQ coordinates system are obtained as follows:(7)ud=Giid∗−id,uq=Giiq∗−iq.Combining equations (7) with (2) and (3), the current feedback decoupling control block diagram is derived, as shown in Figure 5. The id=0 control scheme can learn the approximate decoupling control of PMSM, in dynamic and static states so as to realize fast and high-precision torque control.Figure 5
Current feedback decoupling control block diagram.


## 3.3. Mathematical Model of Lipstick-Filling Servo System

In the case where the vector direction in the armature current vector control is the same as theq-axis direction (id=0), the voltage and torque equations are sorted out again as follows:(8)ud=−ωrLaiq,uq=Rsiq+Ladiqdt+Ef,Tem=pnψfiq,(9)uq−Ef=Rsiq+Ladiqdt=Rsiq+Tadiqdt.Laplace transforms the current in (9) as follows:(10)IqsUqs−Efs=KaTas+1,where, pnLa is the PMSM electrical time constant and Gis is reciprocal of the armature winding resistance.Substituting the electromagnetic torque equation into the motor motion equation yields the following:(11)pnψfiq=TL+Jdωmdt.LetpnψfKe (PMSM EMF constant). By simplifying equation (11) and using Laplace transformation on ωm, the following relation is derived:(12)ωmsiqs−iLs=1Js/Ke.SubstitutingEfωmKe into equation (12) can derive the transfer function between induced electromotive force and current (excluding viscous friction damping coefficient).(13)Esiqs−iLs=1Js/KeKe.Based on equation (13), the dynamic structure diagram of PMSM is shown in Figure 6.Figure 6
PMSM dynamic structure diagram.The open-loop transfer function can be obtained from the graph in Figure6.(14)GMs=KaKeJsTas+1=KMsTas+1,where, Ka, Ke, and J are all known quantities.Based on the servo system structure, the structure diagram of the lipstick-filling servo system, with PMSM acting as the actuator, is established, as shown in Figure7.Figure 7
Servo structure diagram of the lipstick-filling system.The transfer function of each link of the lipstick-filling servo system is approximately obtained, while their integration leads to the transfer function of the whole system [15].(15)Gs=KsTas+1,where, K=KdKMKL, Kd is the transfer function of the power conversion link and KL is the transmission function of the screw drive link. Combining the parameters of the servo motor and servo driver, the values Ta = 0.25 and KM = 0.08 can be obtained. The specific transfer function is approximately obtained by analyzing the actual working conditions.(16)Gs=26s2+4s.


## 3.4. Dynamic Performance Analysis of the Servo System

In order to analyze the performance of the lipstick-filling servo system and determine whether it can meet the needs of the subsequent simulation, the dynamic performance of the transfer function is analyzed. Considering the step signal of the system as the input, the Simulink module of MATLAB is used to build the simulation model of the step response of the system, producing the system response curve, as shown in Figure8. It is evident that the step response is a curve starting at the initial value of 0, followed by an initial oscillation and converging to a constant value. The steady-state error id is 0, the transient process is steady, and the regulating time is 3 s. Overall analysis shows that the system is stable exhibiting high accuracy and quick response.Figure 8
Step response curve of the servo system transfer function.


## 4. PID Control of the Lipstick-Filling Servo System Based on PSO

### 4.1. Traditional PID Control Strategy

PID controller is widely used in generic industrial control scenarios because of its advantages of simple reliability and strong robustness [16]. In this study, closed-loop feedback control is adopted, while the control structure diagram of its servo system is shown in Figure 9. The controller compares the expected setting value rt to the actual measured displacement feedback value yt of the grating ruler, deriving a deviation et, which acts as the basis for the PID controller to adjust the PMSM actuator to realize the precise control of the piston rod displacement and control the filling amount of lipstick material.Figure 9
PID control structure diagram of the filling servo system.


### 4.2. PID Control Strategy Based on PSO

PID parameter optimization is to set and adjust the parametersKP, KI, and KD in each sampling period. From the optimization point of view, based on PSO-PID parameter optimization, each particle corresponds to a group of PID parameters, whereas the most appropriate PID parameter value is found through iteration within the range of this group of parameters so that the control system can meet the design requirements [17, 18]. Based on the basic particle swarm optimization algorithm [19], the inertia weight ω is introduced, to obtain the velocity update formula of the standard particle swarm optimization algorithm as follows:(17)Vit+1=ωVit+c1r1pit−xit+c2r2pgt−xit.ω represents the influence of particle velocity at time “t” on particle velocity at time (t + 1), which is the inheritance of previous particle velocity; ω is positively correlated with particle global search ability and negatively correlated with particle local search ability [20].The structure diagram of PSO-PID parameter optimization control is illustrated in Figure10.Figure 10
Structure diagram of PSO-PID parameter optimization control.The system performance evaluation index is input, acting as the fitness function of the PSO algorithm. In every iteration, the fitness values, corresponding to all particles, are calculated, while the individual optimal and optimal global particles are determined and selected. At the end of the iteration, the position of the optimal global particle is taken as the optimal PID parameter [21].The aforementioned system performance evaluation index (fitness function value) adopts the ITAE performance index as the fitness function in this paper.(18)J=ITAE=∫0∞tetdt.The smaller theJ value is, the closer the corresponding particles are to the global optimal solution position, so the fitness function gradually decreases, as the number of iterations progresses. The widely used PID parameters, obtained from the easy-to-implement ITAE evaluation index, can ensure that the system shows good stability, rapid response and small overshoot.The PSO-PID parameter optimization process is shown in Figure11.Figure 11
PSO-PID parameter optimization process.


### 4.3. Analysis of Simulation Results

In order to verify the effectiveness of the PSO-PID control strategy in improving the performance of the lipstick filling servo system, a PID control system simulation model is built in the Simulink simulation environment as shown in Figure12. Considering the transfer function of the lipstick-filling servo system as the controlled object, the PSO realization program is designed, based on MATLAB, and the PID control system simulation model is built, based on Simulink, with the step signal of the system as the input, the sampling period at 0.001 s, while the PID parameter optimization simulation operation is realized by combining the PSO program.Figure 12
Simulink models of the PID control system.The traditional PID controller adopts the engineering tuning method to determine the parameters. The unit step response of the system as illustrated in Figure13 shows that under the traditional PID control, the system regulation time ts is about 2.2 s, and the maximum overshoot σP% is 58%, which inhibits the effective tracking of the system.Figure 13
Incremental PID step response curve.The parameter settings of PSO-PID are as follows: particle swarm size is initialized at 100; search space range betweenKP, KI, and KD is 0, 10; the dimension of space is 3, maxIter = 100, learning factors c1 =  c2 = 1.5, vmax = 1, vmin = −1, minFit = 0.01.After 100 iterations, PSO-PID parametersKP, KI, and KD are 4.2, 10, and 0.284, respectively. Its performance index ITAE convergence curve is shown in Figure 14, while the adaptive value is 0.048. PSO-PID controller shows good searchability and convergence speed. The unit step response curve, obtained after PSO-PID parameters calculation, is illustrated in Figure 15. PSO-PID control strategy reduces the system regulation time ts to 0.7 s, while the maximum overshoot σP% is 35%, which shows that the particle swarm optimization strategy leads to a faster system response and better control quality than the traditional PID control. It meets the control requirements of fast, accurate, and stable, while it improves the stability and filling accuracy of the lipstick-filling system.Figure 14
ITAE convergence curve of the PSO-PID performance index.Figure 15
PSO-PID step response curve.


## 4.1. Traditional PID Control Strategy

PID controller is widely used in generic industrial control scenarios because of its advantages of simple reliability and strong robustness [16]. In this study, closed-loop feedback control is adopted, while the control structure diagram of its servo system is shown in Figure 9. The controller compares the expected setting value rt to the actual measured displacement feedback value yt of the grating ruler, deriving a deviation et, which acts as the basis for the PID controller to adjust the PMSM actuator to realize the precise control of the piston rod displacement and control the filling amount of lipstick material.Figure 9
PID control structure diagram of the filling servo system.


## 4.2. PID Control Strategy Based on PSO

PID parameter optimization is to set and adjust the parametersKP, KI, and KD in each sampling period. From the optimization point of view, based on PSO-PID parameter optimization, each particle corresponds to a group of PID parameters, whereas the most appropriate PID parameter value is found through iteration within the range of this group of parameters so that the control system can meet the design requirements [17, 18]. Based on the basic particle swarm optimization algorithm [19], the inertia weight ω is introduced, to obtain the velocity update formula of the standard particle swarm optimization algorithm as follows:(17)Vit+1=ωVit+c1r1pit−xit+c2r2pgt−xit.ω represents the influence of particle velocity at time “t” on particle velocity at time (t + 1), which is the inheritance of previous particle velocity; ω is positively correlated with particle global search ability and negatively correlated with particle local search ability [20].The structure diagram of PSO-PID parameter optimization control is illustrated in Figure10.Figure 10
Structure diagram of PSO-PID parameter optimization control.The system performance evaluation index is input, acting as the fitness function of the PSO algorithm. In every iteration, the fitness values, corresponding to all particles, are calculated, while the individual optimal and optimal global particles are determined and selected. At the end of the iteration, the position of the optimal global particle is taken as the optimal PID parameter [21].The aforementioned system performance evaluation index (fitness function value) adopts the ITAE performance index as the fitness function in this paper.(18)J=ITAE=∫0∞tetdt.The smaller theJ value is, the closer the corresponding particles are to the global optimal solution position, so the fitness function gradually decreases, as the number of iterations progresses. The widely used PID parameters, obtained from the easy-to-implement ITAE evaluation index, can ensure that the system shows good stability, rapid response and small overshoot.The PSO-PID parameter optimization process is shown in Figure11.Figure 11
PSO-PID parameter optimization process.


## 4.3. Analysis of Simulation Results

In order to verify the effectiveness of the PSO-PID control strategy in improving the performance of the lipstick filling servo system, a PID control system simulation model is built in the Simulink simulation environment as shown in Figure12. Considering the transfer function of the lipstick-filling servo system as the controlled object, the PSO realization program is designed, based on MATLAB, and the PID control system simulation model is built, based on Simulink, with the step signal of the system as the input, the sampling period at 0.001 s, while the PID parameter optimization simulation operation is realized by combining the PSO program.Figure 12
Simulink models of the PID control system.The traditional PID controller adopts the engineering tuning method to determine the parameters. The unit step response of the system as illustrated in Figure13 shows that under the traditional PID control, the system regulation time ts is about 2.2 s, and the maximum overshoot σP% is 58%, which inhibits the effective tracking of the system.Figure 13
Incremental PID step response curve.The parameter settings of PSO-PID are as follows: particle swarm size is initialized at 100; search space range betweenKP, KI, and KD is 0, 10; the dimension of space is 3, maxIter = 100, learning factors c1 =  c2 = 1.5, vmax = 1, vmin = −1, minFit = 0.01.After 100 iterations, PSO-PID parametersKP, KI, and KD are 4.2, 10, and 0.284, respectively. Its performance index ITAE convergence curve is shown in Figure 14, while the adaptive value is 0.048. PSO-PID controller shows good searchability and convergence speed. The unit step response curve, obtained after PSO-PID parameters calculation, is illustrated in Figure 15. PSO-PID control strategy reduces the system regulation time ts to 0.7 s, while the maximum overshoot σP% is 35%, which shows that the particle swarm optimization strategy leads to a faster system response and better control quality than the traditional PID control. It meets the control requirements of fast, accurate, and stable, while it improves the stability and filling accuracy of the lipstick-filling system.Figure 14
ITAE convergence curve of the PSO-PID performance index.Figure 15
PSO-PID step response curve.


## 5. Prototype Experiment of Lipstick-Filling Machine

The prototype of the filling servo system is shown in Figure16.Figure 16
Filling servo system prototype.In this experiment, at 22°C constant room temperature, with no electromagnetic interference and no dust, the lipstick-filling task, under the traditional PID control and the PSO-PID control strategy is realized using the rotary table type lipstick-filling prototype. The whole production process of lipstick from material heating, filling, cooling, demolding, and capping to finished product is completed, while the filling effect is characterized by the weight of the sample material body and whether the detected filling accuracy meets the error limit requirement of±100mg [22].The traditional PID control strategy is adopted in the filling experiment of the prototype. After 30 minutes of stable operation, 12 unformed lipstick samples of 3 g, 4.5 g, and 5 g lipstick-filling specifications are randomly sampled for testing. Figure17 shows the lipstick samples to be tested. The experimental results are listed in Table 2.Figure 17
Lipstick samples to be tested.Table 2
Experimental data of traditional PID control strategy adopted on the prototype.
Numbering123456789101112Filling volume 3 g2.842.953.053.023.043.062.973.052.993.142.903.09Compliance×√√√√√√√√×√√Filling volume 4.5 g4.584.574.414.544.384.594.424.544.424.444.534.41Compliance√√√√×√√√√√√√Filling volume 5 g5.084.914.955.094.905.094.915.095.064.935.144.90Compliance√√√√√√√√√√×√According to the experimental data in Table2, in 3 filling volume cases, the maximum error value of filling the net content of 36 lipstick casings is 160 mg, while the qualified rate is only 89%.Under the same experimental conditions, the lipstick-filling experiment was carried out under the PSO-PID control strategy. Then, 12 samples were randomly checked, regarding lipstick filling specifications of 3 g, 4.5 g, and 5 g, producing the experimental results listed in Table3.Table 3
Experimental data of the PSO-PID control strategy.
Numbering123456789101112Filling volumea (g)2.982.963.043.073.012.963.053.022.923.042.913.05Compliance√√√√√√√√√√√√Filling volumeb (g)4.564.554.554.534.464.484.544.514.434.614.544.49Compliance√√√√√√√√√×√√Filling volumec (g)5.054.964.935.084.995.024.965.055.074.985.064.99Compliance√√√√√√√√√√√√According to the experimental data in Table3, in 3 filling volume cases, the filling qualification rate of 36 lipsticks is 97%, basically meeting the ±100mg net content error requirement of product quality inspection.


## 6. Conclusion

According to the strict requirements of modern filling production for precision and stability and based on the advanced lipstick production process, a turntable lipstick-filling machine is designed and a solution for the bubble effect, featuring an elastic connecting rod type vibration device, is presented. According to the simulation results, the vibration displacement of the working mass is 2.39 mm, which meets the design requirements. Based on PMSM, the mathematical model of the lipstick-filling servo system is built, the transfer function of the lipstick-filling servo system is obtained, while the simulation model of the system step response is made, showing adjustment timets at 3 s. The Simulink simulation model is built under the control strategy of traditional PID and PSO-PID. The simulation results show that the system regulation time ts is about 2.2 s, and the maximum overshoot σP% is 58% under the traditional PID. Under the PSO-PID control, ts is 0.7 s and the maximum overshoot σP% is 35%. This result shows a faster system response than one of the traditional PID control schemes. In the experiment on lipstick-filling, the qualified rate of the traditional PID control is only 89%, whereas the respective rate of the PSO-PID control is 97%. The turntable lipstick-filling machine, based on particle swarm optimization, can meet the production requirements of high precision and high stability.



---

*Source: 8968510-2022-12-03.xml*