# Design of Accurate Association System of QR Code Information for Cigarette Sorting

Authors: Chen Hao; Wei Taicheng; Zhu Haoran
Journal: Mobile Information Systems
 (2022)

---

## Abstract

This study employs the EIQ analysis approach to quantitatively examine the real order data of the cigarette distribution center in an effort to further increase the efficiency of cigarette sorting and distribution. To further increase the accuracy and efficiency of sorting labor, a sorting system based on QR code information and an accurate identification algorithm is proposed with the use of statistical data and the associated planning scheme. According to the system simulation findings, the sorting efficiency of the system’s sorting line is 18570 pieces per hour. However, by adding packing equipment, the efficiency of the system can be raised by 61.55 percent and can reach 30000 pieces per hour. Additionally, it confirms the viability of the system design. The two-dimensional code’ properties determine which global threshold method the binarization algorithm chooses. The two-dimensional code’ coding principle is investigated, and a two-dimensional code decoding algorithm is developed. The results of the experiment indicate that the decoding algorithm can fulfill these requirements.


---

## Body

## 1. Introduction

In recent years, the competition in China’s tobacco industry has become more and more fierce. Especially after joining Wyo, the competition in the tobacco industry is not only for the domestic market. Facing the strong challenges from international tobacco giants, the competition in the tobacco industry has undergone great changes. The main focus of tobacco titans is on how to succeed in the severe market rivalry through effective logistical services. How to complete the cigarette sorting task more quickly and affordably considering such internal and external circumstances is not only a requirement of the state tobacco monopoly administration but also a crucial factor that should be considered when optimizing the cigarette sorting system.This study uses the EIQ analysis method to analyze the order data of a city based cigarette distribution center to provide a decision-making basis for the planning and design of a cigarette sorting system, and it selects the sorting mode and strategy of the sorting system based on the results of the order data analysis.


## 2. Literature Review

According to the idea of time delay and comprehensively considering the work efficiency of sorting operation and sorting packaging, a dynamic time window design and judgment method to eliminate the waiting time and block demand imbalance caused by the batch imbalance of time windows is proposed, which ensures the continuity and balance of the picking system [1]. In the research on order sorting strategy, it is proposed that the method for determining the sorting strategy should be divided into two steps. First, all orders are divided into five categories, and then, the sorting strategy suitable for each type of order is determined through computer simulation [2]. Hassoun and others used a genetic algorithm to study order batching to minimize the walking distance of sorting [3]. Semenov and others studied the batch strategy of orders with data mining technology [4].Hewage and others discussed the order picking optimization problem of multiple rows of shelves and multiple lanes on the basis of giving the operation principles and warehouse structure parameters in advance. Using the highest picking efficiency as the aim function, multiple order batch picking procedures were created. An order addition batch approach and a weighted postponed batch strategy are included. Using the idea of weighting, the priority assignment of orders with varying degrees of urgency according to postponed processing is explained. The simulation analysis utilizes a small sample of wood harboring fungi. The conclusion demonstrates that the batch processing technique requires fewer computational resources and can satisfy the needs of small batch order picking [5]; Kvon and others discussed the picking operation optimization of automatic three-dimensional warehouses in the form of multiple lanes, selected the case that a single stacker has a dwell point in multiple lanes for discussion, and established the corresponding model. Taking the shortest access time as the objective function, an improved ant colony algorithm is proposed, and the pheromone volatilization coefficient is adaptively adjusted to achieve a compromise between the global search ability of the algorithm and the convergence speed of the algorithm. To verify the effectiveness of the algorithm, a small sample containing 10 orders is used for simulation analysis. The conclusion shows that the convergence and global search ability of the algorithm are better than the unadjusted ant colony algorithm [6]; Ronzhina and others combined the heuristic algorithm with the genetic algorithm to consider the optimization problem of single machine access strategy in multiroadway [7]; Meng and others discussed the fixed shelf picking optimization problem of an automatic warehouse with multi roadway and single machine structure and combined niche theory with a genetic algorithm, the algorithm adopts natural number coding, uses sharing function to make the population show diversity, and adds local disturbance operation and improved crossover and mutation operation, trying to improve the global optimization ability of the algorithm [8]; Wu and others put forward an improved ant colony algorithm based on the rotating shelf automatic three-dimensional warehouse as the research object. They believe that the improved ant colony algorithm can quickly find the optimal goods by picking a path, and the solution quality is high and the calculation time is short [9].This study examines the current state of express sorting based on the available research, develops a system for automatically extracting information from QR codes on express sheets, sorts the express in accordance with the information, and chooses and enhances each step in the QR code recognition algorithm process in light of the unique challenges that express sorting presents. The main work is as follows: the current situation of the existing express sorting system is studied. Aiming at the problems of low efficiency and a high error rate in manual sorting, a set of express sorting systems based on QR code recognition technology has been designed. The system has the characteristics of no manual assistance, independent acquisition of express QR code images, strong adaptability to the environment, and low cost. In this study, the algorithm flow of two-dimensional code recognition is designed, in which the weighted average method is selected according to the complex background in the express sorting system.


## 3. Sorting System Based on QR Code Information Recognition

### 3.1. System Design

The express sorting system connects five parts: control equipment, conveying equipment, information collection equipment, classification equipment, and sorting crossing through communication technology. Sometimes, it must cooperate with manual assistance to form a complete express sorting system [10, 11]. An automatic sorting system mainly has two characteristics: high sorting efficiency and low sorting error rate.The express automatic sorting system based on QR code recognition technology is composed of a sorting area, control equipment, conveying equipment, image acquisition system, sorting equipment, and sorting crossing, as shown in Figure1 [12]. The unloaded express is stacked in the unloading area and then enters the sorting area through the conveying equipment. The express is sorted into a queue and then enters the image acquisition system.Figure 1
Block diagram of the automatic express sorting system.At this time, if you directly enter the image acquisition system, you cannot complete the collection of express images one by one. The schematic diagram is shown in Figure2. The small blue block in the figure represents express delivery. After sorting in the sorting area, the express delivery placed disorderly in the unloading area can become a neat column and enter the image acquisition system [13, 14].Figure 2
Schematic diagram of finishing area.The overall flowchart of the express sorting system based on QR code recognition is shown in Figure3, which can be divided into two parts: software and hardware [15]. In terms of hardware, first, unload the express to the unloading area, then select the express that cannot enter the sorting system according to the requirements of the sorting system, and then enter the sorting structure, sort the express into a queue, pass through the image acquisition system in turn, and then enter the sorting equipment.Figure 3
Flowchart of the automatic express sorting system.


### 3.2. Image Acquisition System

#### 3.2.1. Design of the Image Acquisition System

Figure4 is the flowchart of the image acquisition system. The image acquisition system collects the QR code image on one side of the express through image processing and manipulator control [16, 17].Figure 4
Flowchart of the image acquisition system.


#### 3.2.2. Hardware Selection of the Image Acquisition System

Image acquisition equipment is the core part of an image acquisition system, which is composed of a light source, a camera, and an image acquisition card [18]. It is vital to consider if there are any express surface sheets with smooth surfaces that may reflect light when illuminated, resulting in the direct reflection of light to the camera, while choosing the configuration of LED lights in the express automatic sorting system. This will cause the reflected light to take the place of that portion of the information. Common light source types are shown in Figure 5.Figure 5
Schematic diagram of four common light source categories.
(a)(b)(c)(d)The image acquisition system is an important part of the express automatic sorting system, and the industrial camera is a key part of the image acquisition system. Its specific function is to collect and output an image of the target object [19, 20]. The structure of CCD is relatively complex. The biggest difference between CCD and CMOS is that CMOS is the charge signal in the unit of point, while CCD is the current signal in the unit of behavior. The comparison of performance parameters between CCD and CMOS is shown in Table 1.Table 1
Performance comparison between CCD and CMOS.
CategoryCCDCMOSDynamic range3000:1500:1UniformityGoodBadIntegration degreeLowHighSignal-to-noise ratioHighLowISO sensitivityHighLowThe sorting equipment often used in the express automatic sorting system includes inclined guide wheel types, cross belt types, scraper types, and turnover plate types. As can be seen from Table2, the cross-belt sorting equipment is very suitable for express sorting. However, because the structure of the cross-belt sorting equipment is too complex, each cross-belt car needs an independent motor and control system, and the overall cost is too high [21].Table 2
Principle and characteristics of sorting equipment.
Sorting mechanism typeSystem principlePerformance characteristicsScraper typePush the scraper to send the express out once the products have arrived at the selected location.Low price and simple installation; wide range, mainly nonfragile products; with large space requirements, only one-way sorting is allowedCross belt typeThe main conveying system moves each “trolley” to the specified position, and the “trolley” receiving the command rotates the belt in the cross direction to send the express.Applicable to all kinds of small and unshaped express delivery; it can be sorted on the left and right sides, and there are many sorting outlets; horizontal or vertical circulation;Inclined guide wheel typeChange the travel direction of the express by changing the direction of the guide wheel.Small impact force, suitable for classification of fragile products. More exits to save space; small impact force, suitable for classification of fragile products; it is suitable for flat bottom goods such as cartons.Flip typeThe main conveying system moves each “trolley” to the specified position, and the “trolley” receiving the command tilts to the cross direction to make the express slide out.Reliable and durable, easy to maintain; fragile goods cannot be sorted; it is applicable to the sorting of large quantities of products.


### 3.3. QR Code Processing Algorithm in the Sorting System

#### 3.3.1. Two-Dimensional Code Identification Process in the Sorting System

The problems, such as a small amount of wear on QR codes, can be solved by the fault-tolerant mechanism of QR codes. The QR code recognition process in the express automatic sorting system is shown in Figure6 [22].Figure 6
QR code image recognition process in the sorting system.


#### 3.3.2. QR Code Image Preprocessing

The conversion of a color image into a grayscale version is known as grayscale image processing. The grayscale approach can decrease the amount of image data, decrease the number of operations, and increase the effectiveness of operations. Generally, the following three methods can be used for graying [23].First, the formula means method: take the arithmetic mean ofR, G, and b values of all pixels in the original image as the gray value of the corresponding points, and the calculation formula is shown in the following formula.(1)Gary=R+G+B3.The second is the maximum value method: it takes the maximum values ofR, G, and B of all pixel points in the original image as the gray value of the corresponding points, and the calculation formula is shown in the following formula.(2)Gary=MaxR,G,B.Furthermore, it is the weighted average method: when calculating the average value ofR, G, and B, the weight of each value is also considered. The calculation formula is shown in formula (3). WR, WG, and WB represent the weights of R, G, and B, respectively. This method aims to achieve the best graying effect. The weights of the three values were 0.299, 0.587, and 0.114, respectively.(3)Gary=WR⋅R+WG⋅G+WB⋅BWR+WG+WB.The objective evaluation indexes of images mainly include peak signal-to-noise ratio PSNR and edge-preserving index EPI. PSNR is an index used to measure the degree of image distortion.(4)PSNR=10×log102n−12MSE.EPI indicates the ability of the corresponding filtering method to maintain the edges in the horizontal and vertical directions of the image after the image is processed by different filtering methods. The larger EPI is, the better the edge retention ability of the filtering method is. EPIH represents the edge retention ability of the filtering method for the image in the horizontal direction, and its calculation formula is shown in equation (5). EPIV represents the edge retention ability of the filtering method for the image in the vertical direction, and its calculation formula is shown in equation 3.6. Iy represents the image after filtering, and I represents the standard image [24].(5)EPIH=∑i∑jIyi,j+1−Iyi,j∑i∑jIi,j+1−Ii,j,EPIV=∑i∑jIyi+1,j−Iyi,j∑i∑jIi+1,j−Ii,j.By analyzing the data in Table3, it can be seen that the peak signal-to-noise ratio of the median filter is greater than the mean filter, and the edge preservation index is also greater than the mean filter, that is, the median filter has a better edge preservation ability for the two-dimensional code image than the mean filter.Table 3
Comparison of objective evaluation indexes of image filtering.
Image objective evaluation indexRSNREPIHEPIVMean filtering76.50840.55350.5377Median filtering82.01870.63250.6120Finding the distortion control point precisely is essential to the distortion correction procedure, and doing so calls for accurate detection of the QR code’s edge. The precise algorithm flow looks like this. First, the Otsu algorithm is used to obtain the optimal threshold, which is used as the high thresholdT0 of the Canny algorithm. The idea of the Otsu algorithm is to divide all pixel areas in the target image into two different areas, namely, foreground and background. Then, through the formula, the interclass variance of the background and foreground reaches the maximum threshold, that is, the best threshold for image edge detection [25]. Let their segmentation threshold be T, the total number of pixels in the image is N, the number of pixels in the foreground in the image is N1, and the number of pixels in the background in the image is N2. The proportion of foreground and background pixels to the total number of pixels is w1 and w2, respectively, the average gray value is u1 and u2, respectively, and the total average gray value of the image is u. The following formula holds.(6)w1=N1N,w2=N2N,w1+w2=1,u=w1×u1+w2×u2,g=w1×u1−u2+w2×u2−u2.The maximum interclass variance can be obtained from the above formula:(7)g=w1w2u1−u22.The final step in the distortion correction process is a spatial transformation. Assuming that the original image of the QR code isfx,y and the distorted image is gx′,y′, the mapping relationship from gx′,y′ to fx,y is determined according to the spatial transformation function shown in (8) and (9), and the correction operation of the distorted image of the QR code is completed.(8)x=sx′,y′=k1x′+k2y′+k3,(9)y=tx′,y′=k4x′+k5y′+k6.Then find all the intersections of the straight line and get the four vertex coordinates of the upper left corner, upper right corner, lower left corner, and lower right corner of the original image, which arex1,y1,x2,y2,x3,y3,x4,y4, respectively. Then, determine the width and height after distortion correction through the vertex coordinates, as shown in the following equations.(10)A=x1−x22+y1−y22,(11)B=x1−x32+y1−y32,where A and B, respectively, represent the width and height of the corrected figure. The four new vertices of the corrected QR code are derived from the original vertices, and equations (12)–(15) are the calculation formulas of the new vertex coordinates.(12)x1′=x1,y1′=y1,(13)x2′=x1,y2′=y1+A.(14)x3′=x1+B,y3′=y1,(15)x4′=x1+B,y4′=y1+A.By substituting the coordinates of the original vertex and the new vertex into (8) and (9), the six coefficients in the equation can be obtained, and then, the spatial transformation function can be obtained.


## 3.1. System Design

The express sorting system connects five parts: control equipment, conveying equipment, information collection equipment, classification equipment, and sorting crossing through communication technology. Sometimes, it must cooperate with manual assistance to form a complete express sorting system [10, 11]. An automatic sorting system mainly has two characteristics: high sorting efficiency and low sorting error rate.The express automatic sorting system based on QR code recognition technology is composed of a sorting area, control equipment, conveying equipment, image acquisition system, sorting equipment, and sorting crossing, as shown in Figure1 [12]. The unloaded express is stacked in the unloading area and then enters the sorting area through the conveying equipment. The express is sorted into a queue and then enters the image acquisition system.Figure 1
Block diagram of the automatic express sorting system.At this time, if you directly enter the image acquisition system, you cannot complete the collection of express images one by one. The schematic diagram is shown in Figure2. The small blue block in the figure represents express delivery. After sorting in the sorting area, the express delivery placed disorderly in the unloading area can become a neat column and enter the image acquisition system [13, 14].Figure 2
Schematic diagram of finishing area.The overall flowchart of the express sorting system based on QR code recognition is shown in Figure3, which can be divided into two parts: software and hardware [15]. In terms of hardware, first, unload the express to the unloading area, then select the express that cannot enter the sorting system according to the requirements of the sorting system, and then enter the sorting structure, sort the express into a queue, pass through the image acquisition system in turn, and then enter the sorting equipment.Figure 3
Flowchart of the automatic express sorting system.


## 3.2. Image Acquisition System

### 3.2.1. Design of the Image Acquisition System

Figure4 is the flowchart of the image acquisition system. The image acquisition system collects the QR code image on one side of the express through image processing and manipulator control [16, 17].Figure 4
Flowchart of the image acquisition system.


### 3.2.2. Hardware Selection of the Image Acquisition System

Image acquisition equipment is the core part of an image acquisition system, which is composed of a light source, a camera, and an image acquisition card [18]. It is vital to consider if there are any express surface sheets with smooth surfaces that may reflect light when illuminated, resulting in the direct reflection of light to the camera, while choosing the configuration of LED lights in the express automatic sorting system. This will cause the reflected light to take the place of that portion of the information. Common light source types are shown in Figure 5.Figure 5
Schematic diagram of four common light source categories.
(a)(b)(c)(d)The image acquisition system is an important part of the express automatic sorting system, and the industrial camera is a key part of the image acquisition system. Its specific function is to collect and output an image of the target object [19, 20]. The structure of CCD is relatively complex. The biggest difference between CCD and CMOS is that CMOS is the charge signal in the unit of point, while CCD is the current signal in the unit of behavior. The comparison of performance parameters between CCD and CMOS is shown in Table 1.Table 1
Performance comparison between CCD and CMOS.
CategoryCCDCMOSDynamic range3000:1500:1UniformityGoodBadIntegration degreeLowHighSignal-to-noise ratioHighLowISO sensitivityHighLowThe sorting equipment often used in the express automatic sorting system includes inclined guide wheel types, cross belt types, scraper types, and turnover plate types. As can be seen from Table2, the cross-belt sorting equipment is very suitable for express sorting. However, because the structure of the cross-belt sorting equipment is too complex, each cross-belt car needs an independent motor and control system, and the overall cost is too high [21].Table 2
Principle and characteristics of sorting equipment.
Sorting mechanism typeSystem principlePerformance characteristicsScraper typePush the scraper to send the express out once the products have arrived at the selected location.Low price and simple installation; wide range, mainly nonfragile products; with large space requirements, only one-way sorting is allowedCross belt typeThe main conveying system moves each “trolley” to the specified position, and the “trolley” receiving the command rotates the belt in the cross direction to send the express.Applicable to all kinds of small and unshaped express delivery; it can be sorted on the left and right sides, and there are many sorting outlets; horizontal or vertical circulation;Inclined guide wheel typeChange the travel direction of the express by changing the direction of the guide wheel.Small impact force, suitable for classification of fragile products. More exits to save space; small impact force, suitable for classification of fragile products; it is suitable for flat bottom goods such as cartons.Flip typeThe main conveying system moves each “trolley” to the specified position, and the “trolley” receiving the command tilts to the cross direction to make the express slide out.Reliable and durable, easy to maintain; fragile goods cannot be sorted; it is applicable to the sorting of large quantities of products.


## 3.2.1. Design of the Image Acquisition System

Figure4 is the flowchart of the image acquisition system. The image acquisition system collects the QR code image on one side of the express through image processing and manipulator control [16, 17].Figure 4
Flowchart of the image acquisition system.


## 3.2.2. Hardware Selection of the Image Acquisition System

Image acquisition equipment is the core part of an image acquisition system, which is composed of a light source, a camera, and an image acquisition card [18]. It is vital to consider if there are any express surface sheets with smooth surfaces that may reflect light when illuminated, resulting in the direct reflection of light to the camera, while choosing the configuration of LED lights in the express automatic sorting system. This will cause the reflected light to take the place of that portion of the information. Common light source types are shown in Figure 5.Figure 5
Schematic diagram of four common light source categories.
(a)(b)(c)(d)The image acquisition system is an important part of the express automatic sorting system, and the industrial camera is a key part of the image acquisition system. Its specific function is to collect and output an image of the target object [19, 20]. The structure of CCD is relatively complex. The biggest difference between CCD and CMOS is that CMOS is the charge signal in the unit of point, while CCD is the current signal in the unit of behavior. The comparison of performance parameters between CCD and CMOS is shown in Table 1.Table 1
Performance comparison between CCD and CMOS.
CategoryCCDCMOSDynamic range3000:1500:1UniformityGoodBadIntegration degreeLowHighSignal-to-noise ratioHighLowISO sensitivityHighLowThe sorting equipment often used in the express automatic sorting system includes inclined guide wheel types, cross belt types, scraper types, and turnover plate types. As can be seen from Table2, the cross-belt sorting equipment is very suitable for express sorting. However, because the structure of the cross-belt sorting equipment is too complex, each cross-belt car needs an independent motor and control system, and the overall cost is too high [21].Table 2
Principle and characteristics of sorting equipment.
Sorting mechanism typeSystem principlePerformance characteristicsScraper typePush the scraper to send the express out once the products have arrived at the selected location.Low price and simple installation; wide range, mainly nonfragile products; with large space requirements, only one-way sorting is allowedCross belt typeThe main conveying system moves each “trolley” to the specified position, and the “trolley” receiving the command rotates the belt in the cross direction to send the express.Applicable to all kinds of small and unshaped express delivery; it can be sorted on the left and right sides, and there are many sorting outlets; horizontal or vertical circulation;Inclined guide wheel typeChange the travel direction of the express by changing the direction of the guide wheel.Small impact force, suitable for classification of fragile products. More exits to save space; small impact force, suitable for classification of fragile products; it is suitable for flat bottom goods such as cartons.Flip typeThe main conveying system moves each “trolley” to the specified position, and the “trolley” receiving the command tilts to the cross direction to make the express slide out.Reliable and durable, easy to maintain; fragile goods cannot be sorted; it is applicable to the sorting of large quantities of products.


## 3.3. QR Code Processing Algorithm in the Sorting System

### 3.3.1. Two-Dimensional Code Identification Process in the Sorting System

The problems, such as a small amount of wear on QR codes, can be solved by the fault-tolerant mechanism of QR codes. The QR code recognition process in the express automatic sorting system is shown in Figure6 [22].Figure 6
QR code image recognition process in the sorting system.


### 3.3.2. QR Code Image Preprocessing

The conversion of a color image into a grayscale version is known as grayscale image processing. The grayscale approach can decrease the amount of image data, decrease the number of operations, and increase the effectiveness of operations. Generally, the following three methods can be used for graying [23].First, the formula means method: take the arithmetic mean ofR, G, and b values of all pixels in the original image as the gray value of the corresponding points, and the calculation formula is shown in the following formula.(1)Gary=R+G+B3.The second is the maximum value method: it takes the maximum values ofR, G, and B of all pixel points in the original image as the gray value of the corresponding points, and the calculation formula is shown in the following formula.(2)Gary=MaxR,G,B.Furthermore, it is the weighted average method: when calculating the average value ofR, G, and B, the weight of each value is also considered. The calculation formula is shown in formula (3). WR, WG, and WB represent the weights of R, G, and B, respectively. This method aims to achieve the best graying effect. The weights of the three values were 0.299, 0.587, and 0.114, respectively.(3)Gary=WR⋅R+WG⋅G+WB⋅BWR+WG+WB.The objective evaluation indexes of images mainly include peak signal-to-noise ratio PSNR and edge-preserving index EPI. PSNR is an index used to measure the degree of image distortion.(4)PSNR=10×log102n−12MSE.EPI indicates the ability of the corresponding filtering method to maintain the edges in the horizontal and vertical directions of the image after the image is processed by different filtering methods. The larger EPI is, the better the edge retention ability of the filtering method is. EPIH represents the edge retention ability of the filtering method for the image in the horizontal direction, and its calculation formula is shown in equation (5). EPIV represents the edge retention ability of the filtering method for the image in the vertical direction, and its calculation formula is shown in equation 3.6. Iy represents the image after filtering, and I represents the standard image [24].(5)EPIH=∑i∑jIyi,j+1−Iyi,j∑i∑jIi,j+1−Ii,j,EPIV=∑i∑jIyi+1,j−Iyi,j∑i∑jIi+1,j−Ii,j.By analyzing the data in Table3, it can be seen that the peak signal-to-noise ratio of the median filter is greater than the mean filter, and the edge preservation index is also greater than the mean filter, that is, the median filter has a better edge preservation ability for the two-dimensional code image than the mean filter.Table 3
Comparison of objective evaluation indexes of image filtering.
Image objective evaluation indexRSNREPIHEPIVMean filtering76.50840.55350.5377Median filtering82.01870.63250.6120Finding the distortion control point precisely is essential to the distortion correction procedure, and doing so calls for accurate detection of the QR code’s edge. The precise algorithm flow looks like this. First, the Otsu algorithm is used to obtain the optimal threshold, which is used as the high thresholdT0 of the Canny algorithm. The idea of the Otsu algorithm is to divide all pixel areas in the target image into two different areas, namely, foreground and background. Then, through the formula, the interclass variance of the background and foreground reaches the maximum threshold, that is, the best threshold for image edge detection [25]. Let their segmentation threshold be T, the total number of pixels in the image is N, the number of pixels in the foreground in the image is N1, and the number of pixels in the background in the image is N2. The proportion of foreground and background pixels to the total number of pixels is w1 and w2, respectively, the average gray value is u1 and u2, respectively, and the total average gray value of the image is u. The following formula holds.(6)w1=N1N,w2=N2N,w1+w2=1,u=w1×u1+w2×u2,g=w1×u1−u2+w2×u2−u2.The maximum interclass variance can be obtained from the above formula:(7)g=w1w2u1−u22.The final step in the distortion correction process is a spatial transformation. Assuming that the original image of the QR code isfx,y and the distorted image is gx′,y′, the mapping relationship from gx′,y′ to fx,y is determined according to the spatial transformation function shown in (8) and (9), and the correction operation of the distorted image of the QR code is completed.(8)x=sx′,y′=k1x′+k2y′+k3,(9)y=tx′,y′=k4x′+k5y′+k6.Then find all the intersections of the straight line and get the four vertex coordinates of the upper left corner, upper right corner, lower left corner, and lower right corner of the original image, which arex1,y1,x2,y2,x3,y3,x4,y4, respectively. Then, determine the width and height after distortion correction through the vertex coordinates, as shown in the following equations.(10)A=x1−x22+y1−y22,(11)B=x1−x32+y1−y32,where A and B, respectively, represent the width and height of the corrected figure. The four new vertices of the corrected QR code are derived from the original vertices, and equations (12)–(15) are the calculation formulas of the new vertex coordinates.(12)x1′=x1,y1′=y1,(13)x2′=x1,y2′=y1+A.(14)x3′=x1+B,y3′=y1,(15)x4′=x1+B,y4′=y1+A.By substituting the coordinates of the original vertex and the new vertex into (8) and (9), the six coefficients in the equation can be obtained, and then, the spatial transformation function can be obtained.


## 3.3.1. Two-Dimensional Code Identification Process in the Sorting System

The problems, such as a small amount of wear on QR codes, can be solved by the fault-tolerant mechanism of QR codes. The QR code recognition process in the express automatic sorting system is shown in Figure6 [22].Figure 6
QR code image recognition process in the sorting system.


## 3.3.2. QR Code Image Preprocessing

The conversion of a color image into a grayscale version is known as grayscale image processing. The grayscale approach can decrease the amount of image data, decrease the number of operations, and increase the effectiveness of operations. Generally, the following three methods can be used for graying [23].First, the formula means method: take the arithmetic mean ofR, G, and b values of all pixels in the original image as the gray value of the corresponding points, and the calculation formula is shown in the following formula.(1)Gary=R+G+B3.The second is the maximum value method: it takes the maximum values ofR, G, and B of all pixel points in the original image as the gray value of the corresponding points, and the calculation formula is shown in the following formula.(2)Gary=MaxR,G,B.Furthermore, it is the weighted average method: when calculating the average value ofR, G, and B, the weight of each value is also considered. The calculation formula is shown in formula (3). WR, WG, and WB represent the weights of R, G, and B, respectively. This method aims to achieve the best graying effect. The weights of the three values were 0.299, 0.587, and 0.114, respectively.(3)Gary=WR⋅R+WG⋅G+WB⋅BWR+WG+WB.The objective evaluation indexes of images mainly include peak signal-to-noise ratio PSNR and edge-preserving index EPI. PSNR is an index used to measure the degree of image distortion.(4)PSNR=10×log102n−12MSE.EPI indicates the ability of the corresponding filtering method to maintain the edges in the horizontal and vertical directions of the image after the image is processed by different filtering methods. The larger EPI is, the better the edge retention ability of the filtering method is. EPIH represents the edge retention ability of the filtering method for the image in the horizontal direction, and its calculation formula is shown in equation (5). EPIV represents the edge retention ability of the filtering method for the image in the vertical direction, and its calculation formula is shown in equation 3.6. Iy represents the image after filtering, and I represents the standard image [24].(5)EPIH=∑i∑jIyi,j+1−Iyi,j∑i∑jIi,j+1−Ii,j,EPIV=∑i∑jIyi+1,j−Iyi,j∑i∑jIi+1,j−Ii,j.By analyzing the data in Table3, it can be seen that the peak signal-to-noise ratio of the median filter is greater than the mean filter, and the edge preservation index is also greater than the mean filter, that is, the median filter has a better edge preservation ability for the two-dimensional code image than the mean filter.Table 3
Comparison of objective evaluation indexes of image filtering.
Image objective evaluation indexRSNREPIHEPIVMean filtering76.50840.55350.5377Median filtering82.01870.63250.6120Finding the distortion control point precisely is essential to the distortion correction procedure, and doing so calls for accurate detection of the QR code’s edge. The precise algorithm flow looks like this. First, the Otsu algorithm is used to obtain the optimal threshold, which is used as the high thresholdT0 of the Canny algorithm. The idea of the Otsu algorithm is to divide all pixel areas in the target image into two different areas, namely, foreground and background. Then, through the formula, the interclass variance of the background and foreground reaches the maximum threshold, that is, the best threshold for image edge detection [25]. Let their segmentation threshold be T, the total number of pixels in the image is N, the number of pixels in the foreground in the image is N1, and the number of pixels in the background in the image is N2. The proportion of foreground and background pixels to the total number of pixels is w1 and w2, respectively, the average gray value is u1 and u2, respectively, and the total average gray value of the image is u. The following formula holds.(6)w1=N1N,w2=N2N,w1+w2=1,u=w1×u1+w2×u2,g=w1×u1−u2+w2×u2−u2.The maximum interclass variance can be obtained from the above formula:(7)g=w1w2u1−u22.The final step in the distortion correction process is a spatial transformation. Assuming that the original image of the QR code isfx,y and the distorted image is gx′,y′, the mapping relationship from gx′,y′ to fx,y is determined according to the spatial transformation function shown in (8) and (9), and the correction operation of the distorted image of the QR code is completed.(8)x=sx′,y′=k1x′+k2y′+k3,(9)y=tx′,y′=k4x′+k5y′+k6.Then find all the intersections of the straight line and get the four vertex coordinates of the upper left corner, upper right corner, lower left corner, and lower right corner of the original image, which arex1,y1,x2,y2,x3,y3,x4,y4, respectively. Then, determine the width and height after distortion correction through the vertex coordinates, as shown in the following equations.(10)A=x1−x22+y1−y22,(11)B=x1−x32+y1−y32,where A and B, respectively, represent the width and height of the corrected figure. The four new vertices of the corrected QR code are derived from the original vertices, and equations (12)–(15) are the calculation formulas of the new vertex coordinates.(12)x1′=x1,y1′=y1,(13)x2′=x1,y2′=y1+A.(14)x3′=x1+B,y3′=y1,(15)x4′=x1+B,y4′=y1+A.By substituting the coordinates of the original vertex and the new vertex into (8) and (9), the six coefficients in the equation can be obtained, and then, the spatial transformation function can be obtained.


## 4. Design Optimization of the Automatic Cigarette Sorting System

### 4.1. Operation Flow of Automatic Cigarette Sorting

The sorting business process of the automatic sorting system of the distribution center is shown in Figure7.Figure 7
Sorting business flowchart of the automatic sorting system in cigarette distribution center.The goal of the sorting equipment configuration optimization model is to reduce the total cost of sorting cigarettes; however, the values for each cigarette are independent of one another regardless of the sorter that is used. Consequently, the target function can be broken down into decreasing the sorting expense per cigarette. It can be shown from the analysis of sorting costs that the sorting costs of cigarettes in the automatic sorting system mostly consist of sorting equipment costs, site costs, and people costs for replenishment. The equipment cost is fixed for every type of cigarette, regardless of whether a horizontal sorter or vertical sorter is chosen for sorting. The equipment is the equipment purchase cost and maintenance cost allocated to the daily depreciation cost, which will not change with the change in cigarette sorting volume. In this study, the purchase cost of the two sorting equipment is different. The purchase cost of the horizontal sorter is relatively high, so the equipment depreciation cost of the horizontal sorter is higher than that of the vertical sorter. In terms of site cost, because the floor area of a single horizontal sorter is larger than that of a vertical sorter, the site cost occupied by the horizontal sorter is high. The site cost is similar to the equipment cost and is fixed, so it can be combined with the equipment cost, as shown in Figure8.Figure 8
Change trend of equipment and site cost.For a certain cigarette with a certain sorting volume, the sorting and replenishment times of the horizontal sorter are short, and the corresponding replenishment cost is low. The changing trend is shown in Figure9. It can be seen from Figure 9 that the slope of the replenishment cost straight line of the vertical sorter is greater than that of the horizontal sorter, that is, the replenishment cost of the vertical sorter per unit cigarette is higher than that of the horizontal sorter.Figure 9
Change trend of replenishment cost.


### 4.2. Equipment Configuration Results

#### 4.2.1. Data Analysis

According to the equipment quotation of an enterprise, determine the parameter values of the purchase and maintenance cost of sorting equipment that affect the cost of the sorting system, as shown in Table4.Table 4
Equipment parameter values.
ParameterValueCompanyc1310000 yuan/channell10.5m/channels12Square meterb1170Pieces/hourr1300Pieces/hourc20.810000 yuan/channell20.14M/channels20.3Square meterb225Pieces/hourr2130Pieces/hourc30.810000 yuan/Mc40.4Yuan/m2/dayc515Yuan/hourμ10%γ10Year (250 days/year)Summarize the sorting quantity of 100 orders in the cigarette distribution center on a certain day and calculate the average sorting quantity of an order, as shown in Figure10. Among them, the maximum sorting volume of single variety cigarettes is 932, and the minimum is only 3. It can be seen that the shipment volume of different cigarettes varies greatly. Therefore, it is very necessary to consider the efficiency and cost of sorting when selecting sorting equipment.Figure 10
Cigarette order data.In order to verify the rationality of equipment configuration based on the cost critical point method, this result is compared with the EIQ-ABC analysis results of cigarette orders, as shown in Table5.Table 5
Comparison of equipment configuration results.
EIQ-ABC methodCost critical point methodVertical sorter50 channels44 channelsHorizontal sorter26 channels32 channelsSorting cost9.85 million yuan8.72 million yuanIt can be concluded from the table that the sorting cost of the system is reduced from 9.85 million yuan to 8.72 million yuan by using the cost critical point method. It can not only realize the management of key cigarette brands and ensure their timely delivery but also ensure the smooth completion of the sorting operation of cigarettes with a small sorting volume and improve the utilization rate of the equipment. Additionally, a clearer configuration of the number of sorting machines may be made by contrasting the cost critical point approach with the EIQ-ABC analysis method. The sorting apparatus for each cigarette can be identified by comparing the sorting volumes of each one with those of the crucial point. Implementing this approach is fairly straightforward.


### 4.3. System Modeling and Simulation Test

#### 4.3.1. FlexSim Modeling Process

The modeling process is shown in Figure11.Figure 11
System simulation flowchart.The specific steps of the system simulation can be summarized as follows:Determining simulation objectives is the process of determining simulation objects and specific problems that will be solved by simulation. Conducting system research entails a thorough understanding of the system’s operating process and collecting system simulation operation data. To create a system model, you must first determine the basic process and relevant parameters of the system operation. System models can take the form of text expressions, flowcharts, icons, mathematical expressions, and so on. Flowcharts are commonly used for the simulation of discrete event systems. To determine the simulation algorithm, you must first determine the method for controlling the simulation model’s operation. The most common methods are event scheduling, activity scanning, and process interaction. Creating a simulation model is the process of creating a computer simulation model and writing a simulation program code. Establishing and validating the simulation model entails determining whether the model accurately reflects the reality of the system, including the operation simulation model, analyzing simulation results, and producing simulation results.


#### 4.3.2. Visual Simulation of the Automatic Cigarette Sorting System

In the complete set of automatic logistics equipment systems, the occurrence of events depends on whether the conditions for triggering events are met to adapt the Petri net model. This study adopts a simulation strategy based on a combination of the event scheduling method and the activity scanning method: the entity in the system is tested by scanning, that is, the change. Once the preconditions are met, the activity process of the entity is activated, so that the relevant events can occur, change the state of the system, and arrange the occurrence time of relevant events. In the case of time change, start the corresponding timer to make the logistics system work on the computer as in the actual production environment through the process, without setting the system simulation clock. On the basis of the preceding study, a simulation model of the automatic cigarette splitting system can be developed to visually replicate the system’s operation. Analyze and validate the model’s and system’s design scheme by using the simulation’s user-friendly platform to observe the system’s actual operation effect and to analyze and validate the model’s and system’s design logic. The statistics of each equipment’s utilization rate, idle rate, blocking rate, and other data offer the foundation for decision-making and optimization.According to the analysis of the design scheme of the sorting system, the sorting system includes four basic subsystems: cigarette replenishment, cigarette sorting, cigarette packaging, and delivery of temporary storage. The equipment of each subsystem and its corresponding relationships with the entities in the simulation system, as well as the auxiliary entities required to realize the simulation function, are shown in Tables6 to 8.Table 6
Equipment composition of the cigarette replenishment system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityUnpacking station3Resolver∗ 3 + operator ∗ 3Simple cigarette replenishment system (conveyor belt∗ 3 + sorting conveyor belt ∗ 3 + synthesizer ∗ 1 + generator ∗ 2)Replenishment trolley3 setsStacker∗ 3Trolley support (basic fixed entity)∗ 3Horizontal sorter11 smoke bins/set∗ 3 setsShelf (11 columns∗ 5 layers) ∗ 3Initial generator∗ 1Vertical sorter44 smoke bin/set∗ 1 setShelf (44 columns∗ 1 floor) ∗ 1Manual replenishment shelf + operator∗ 1 + initial generator ∗ 1Empty container recycling areaConveyor belt/empty container recovery staging areaConveyor belt∗ 3 + temporary storage area ∗ 1Empty container sorting worker (operator∗ 1)Table 7
Equipment composition of the cigarette sorting and packaging system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityThird floor main lineSorting transfer belt∗ 3Conveyor belt∗ 3 + synthesizer ∗ 3Suborder generator∗ 3Order closing station1 (three orders in one)Synthesizer∗ 1Single generator∗ 3Packer1 setSynthesizer∗ 1Table 8
Equipment composition of the delivery temporary storage system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityLabeling inspection machine2 setsProcessor∗ 2Loading and unloading operator∗ 2 + temporary storage area ∗ 2Shipment staging area6Staging area∗ 6Task actuator∗ 2Collection and analysis of the equipment parameters of a sorting system: The system data obtained according to the data are shown in Table9.Table 9
Brief analysis of system data.
StationEfficiencyManual unpacking efficiency100–150 pieces/person∗ hourTrolley replenishment efficiency145 PCS/hReplenishment efficiency of vertical tobacco silo1500–2000 cartons/hourPackaging efficiency of packaging machine22000 cartons/hourBelt running speed1 m/sThe running time unit of the simulation setting is 1, and the length unit is 1. Therefore, to achieve the efficiency shown in table, it is necessary to set the data correspondence in the FlexSim simulation model, as shown in Table10.Table 10
Simulation data analysis.
StationEfficiencyFlexSim entity parameters to be adjustedReachable efficiencyManual unpacking efficiency100–150 pieces/person∗ hourResolver processing time 0.5120 pieces/hourTrolley replenishment efficiency145 pieces (7200 cartons)/hourThe stretching speed of stacker is 30, the acceleration/deceleration is 20, and the maximum speed is 27200 cartons/hourReplenishment efficiency of vertical tobacco silo1500–2000 pieces/hourMaximum speed of replenishment operator 2. Acceleration/deceleration 1, capacity 41800 cartons/hourSorting efficiency15000–22000 cartons/hourSynthesizer processing time 517000 cartons/hourBelt running speed1 m/sBelt running speed 11 m/S


#### 4.3.3. Analysis of Operation Results of Each Business Link

Calculated from the input of the horizontal sorter:Replenishment efficiency of the trolley = (9681 + 9651 + 9573)/1.5 = 19270 pieces/hour.Calculated from the input of the vertical sorter:Manual replenishment efficiency of the vertical machine = 3294/1.5 = 2196 pieces/hour.The output of the horizontal sorter and vertical sorter is calculated as follows:Sorting efficiency of the sorting line = (7401 + 7452 + 8238 + 3204)/1.5 = 18330 pieces/hour.Through the calculation of the output of the single synthesizer:Sorting efficiency of the sorting line = 29355/1.5 = 18750 pieces/hour.The above data show that the system can achieve the expected overall efficiency.From the data listed in the table, we can see the utilization rate of each equipment. Through the system data, it is found as follows:The average utilization rate of the unpacking station of the resolver is 1.7%, but because the resolver acts as a cigarette buffer section, its utilization rate is 74.3%, and the overall utilization rate is more than 75%, which is an ideal application state.The utilization rate of the replenishment trolleys is 78%. Workers only assist in unpacking the resolver, and the vacancy rate of unpacking workers is as high as 98%. The investment of workers is fully saved.The idle rate of the four synthesizers of the three-tier sorting main line is 0%. It can be seen that the sorting equipment layer has been in a full load working state, and the sorting efficiency has reached the average value of the ideal state, i.e., 16500 pieces/hour.During the operation of the system, the blocking rate of the three suborder execution synthesizers of the three-tier sorting main line exceeds, that is, if the downstream process is smooth, the separation efficiency can continue to improve. After adding a packer, the sorting efficiency of the system can reach 30000 pieces/hour.Through the simulation of the sorting system of a tobacco distribution center in a city, it is found that the overall efficiency of the system is high, the equipment layout is reasonable, the integration is high, and the whole operation process is clearly visible. In sum up, the design scheme of the sorting system achieves the following results.The system adopts humanized design, the labor intensity of workers is greatly reduced, the number is reduced, the operation is simple, and the sorting work can be completed efficiently.The order processing was completed on the previous day, saving the processing time of the order upon arrival. The sorting line adopts the latest three-tier main line sorting and order combination technology, which greatly improves the sorting efficiency of the equipment, and the equipment efficiency operates stably at more than 15000 pieces/hour.The horizontal machine has a large smoke bin capacity, flexible scheduling, and strong adaptability to different orders; the equipment is highly integrated, and the shape is unified and coordinated. Compared with the equipment with the same sorting efficiency, the floor area is small, and the empty box is set with a fixed recycling area. The operation process in the whole sorting system is clear.


## 4.1. Operation Flow of Automatic Cigarette Sorting

The sorting business process of the automatic sorting system of the distribution center is shown in Figure7.Figure 7
Sorting business flowchart of the automatic sorting system in cigarette distribution center.The goal of the sorting equipment configuration optimization model is to reduce the total cost of sorting cigarettes; however, the values for each cigarette are independent of one another regardless of the sorter that is used. Consequently, the target function can be broken down into decreasing the sorting expense per cigarette. It can be shown from the analysis of sorting costs that the sorting costs of cigarettes in the automatic sorting system mostly consist of sorting equipment costs, site costs, and people costs for replenishment. The equipment cost is fixed for every type of cigarette, regardless of whether a horizontal sorter or vertical sorter is chosen for sorting. The equipment is the equipment purchase cost and maintenance cost allocated to the daily depreciation cost, which will not change with the change in cigarette sorting volume. In this study, the purchase cost of the two sorting equipment is different. The purchase cost of the horizontal sorter is relatively high, so the equipment depreciation cost of the horizontal sorter is higher than that of the vertical sorter. In terms of site cost, because the floor area of a single horizontal sorter is larger than that of a vertical sorter, the site cost occupied by the horizontal sorter is high. The site cost is similar to the equipment cost and is fixed, so it can be combined with the equipment cost, as shown in Figure8.Figure 8
Change trend of equipment and site cost.For a certain cigarette with a certain sorting volume, the sorting and replenishment times of the horizontal sorter are short, and the corresponding replenishment cost is low. The changing trend is shown in Figure9. It can be seen from Figure 9 that the slope of the replenishment cost straight line of the vertical sorter is greater than that of the horizontal sorter, that is, the replenishment cost of the vertical sorter per unit cigarette is higher than that of the horizontal sorter.Figure 9
Change trend of replenishment cost.


## 4.2. Equipment Configuration Results

### 4.2.1. Data Analysis

According to the equipment quotation of an enterprise, determine the parameter values of the purchase and maintenance cost of sorting equipment that affect the cost of the sorting system, as shown in Table4.Table 4
Equipment parameter values.
ParameterValueCompanyc1310000 yuan/channell10.5m/channels12Square meterb1170Pieces/hourr1300Pieces/hourc20.810000 yuan/channell20.14M/channels20.3Square meterb225Pieces/hourr2130Pieces/hourc30.810000 yuan/Mc40.4Yuan/m2/dayc515Yuan/hourμ10%γ10Year (250 days/year)Summarize the sorting quantity of 100 orders in the cigarette distribution center on a certain day and calculate the average sorting quantity of an order, as shown in Figure10. Among them, the maximum sorting volume of single variety cigarettes is 932, and the minimum is only 3. It can be seen that the shipment volume of different cigarettes varies greatly. Therefore, it is very necessary to consider the efficiency and cost of sorting when selecting sorting equipment.Figure 10
Cigarette order data.In order to verify the rationality of equipment configuration based on the cost critical point method, this result is compared with the EIQ-ABC analysis results of cigarette orders, as shown in Table5.Table 5
Comparison of equipment configuration results.
EIQ-ABC methodCost critical point methodVertical sorter50 channels44 channelsHorizontal sorter26 channels32 channelsSorting cost9.85 million yuan8.72 million yuanIt can be concluded from the table that the sorting cost of the system is reduced from 9.85 million yuan to 8.72 million yuan by using the cost critical point method. It can not only realize the management of key cigarette brands and ensure their timely delivery but also ensure the smooth completion of the sorting operation of cigarettes with a small sorting volume and improve the utilization rate of the equipment. Additionally, a clearer configuration of the number of sorting machines may be made by contrasting the cost critical point approach with the EIQ-ABC analysis method. The sorting apparatus for each cigarette can be identified by comparing the sorting volumes of each one with those of the crucial point. Implementing this approach is fairly straightforward.


## 4.2.1. Data Analysis

According to the equipment quotation of an enterprise, determine the parameter values of the purchase and maintenance cost of sorting equipment that affect the cost of the sorting system, as shown in Table4.Table 4
Equipment parameter values.
ParameterValueCompanyc1310000 yuan/channell10.5m/channels12Square meterb1170Pieces/hourr1300Pieces/hourc20.810000 yuan/channell20.14M/channels20.3Square meterb225Pieces/hourr2130Pieces/hourc30.810000 yuan/Mc40.4Yuan/m2/dayc515Yuan/hourμ10%γ10Year (250 days/year)Summarize the sorting quantity of 100 orders in the cigarette distribution center on a certain day and calculate the average sorting quantity of an order, as shown in Figure10. Among them, the maximum sorting volume of single variety cigarettes is 932, and the minimum is only 3. It can be seen that the shipment volume of different cigarettes varies greatly. Therefore, it is very necessary to consider the efficiency and cost of sorting when selecting sorting equipment.Figure 10
Cigarette order data.In order to verify the rationality of equipment configuration based on the cost critical point method, this result is compared with the EIQ-ABC analysis results of cigarette orders, as shown in Table5.Table 5
Comparison of equipment configuration results.
EIQ-ABC methodCost critical point methodVertical sorter50 channels44 channelsHorizontal sorter26 channels32 channelsSorting cost9.85 million yuan8.72 million yuanIt can be concluded from the table that the sorting cost of the system is reduced from 9.85 million yuan to 8.72 million yuan by using the cost critical point method. It can not only realize the management of key cigarette brands and ensure their timely delivery but also ensure the smooth completion of the sorting operation of cigarettes with a small sorting volume and improve the utilization rate of the equipment. Additionally, a clearer configuration of the number of sorting machines may be made by contrasting the cost critical point approach with the EIQ-ABC analysis method. The sorting apparatus for each cigarette can be identified by comparing the sorting volumes of each one with those of the crucial point. Implementing this approach is fairly straightforward.


## 4.3. System Modeling and Simulation Test

### 4.3.1. FlexSim Modeling Process

The modeling process is shown in Figure11.Figure 11
System simulation flowchart.The specific steps of the system simulation can be summarized as follows:Determining simulation objectives is the process of determining simulation objects and specific problems that will be solved by simulation. Conducting system research entails a thorough understanding of the system’s operating process and collecting system simulation operation data. To create a system model, you must first determine the basic process and relevant parameters of the system operation. System models can take the form of text expressions, flowcharts, icons, mathematical expressions, and so on. Flowcharts are commonly used for the simulation of discrete event systems. To determine the simulation algorithm, you must first determine the method for controlling the simulation model’s operation. The most common methods are event scheduling, activity scanning, and process interaction. Creating a simulation model is the process of creating a computer simulation model and writing a simulation program code. Establishing and validating the simulation model entails determining whether the model accurately reflects the reality of the system, including the operation simulation model, analyzing simulation results, and producing simulation results.


### 4.3.2. Visual Simulation of the Automatic Cigarette Sorting System

In the complete set of automatic logistics equipment systems, the occurrence of events depends on whether the conditions for triggering events are met to adapt the Petri net model. This study adopts a simulation strategy based on a combination of the event scheduling method and the activity scanning method: the entity in the system is tested by scanning, that is, the change. Once the preconditions are met, the activity process of the entity is activated, so that the relevant events can occur, change the state of the system, and arrange the occurrence time of relevant events. In the case of time change, start the corresponding timer to make the logistics system work on the computer as in the actual production environment through the process, without setting the system simulation clock. On the basis of the preceding study, a simulation model of the automatic cigarette splitting system can be developed to visually replicate the system’s operation. Analyze and validate the model’s and system’s design scheme by using the simulation’s user-friendly platform to observe the system’s actual operation effect and to analyze and validate the model’s and system’s design logic. The statistics of each equipment’s utilization rate, idle rate, blocking rate, and other data offer the foundation for decision-making and optimization.According to the analysis of the design scheme of the sorting system, the sorting system includes four basic subsystems: cigarette replenishment, cigarette sorting, cigarette packaging, and delivery of temporary storage. The equipment of each subsystem and its corresponding relationships with the entities in the simulation system, as well as the auxiliary entities required to realize the simulation function, are shown in Tables6 to 8.Table 6
Equipment composition of the cigarette replenishment system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityUnpacking station3Resolver∗ 3 + operator ∗ 3Simple cigarette replenishment system (conveyor belt∗ 3 + sorting conveyor belt ∗ 3 + synthesizer ∗ 1 + generator ∗ 2)Replenishment trolley3 setsStacker∗ 3Trolley support (basic fixed entity)∗ 3Horizontal sorter11 smoke bins/set∗ 3 setsShelf (11 columns∗ 5 layers) ∗ 3Initial generator∗ 1Vertical sorter44 smoke bin/set∗ 1 setShelf (44 columns∗ 1 floor) ∗ 1Manual replenishment shelf + operator∗ 1 + initial generator ∗ 1Empty container recycling areaConveyor belt/empty container recovery staging areaConveyor belt∗ 3 + temporary storage area ∗ 1Empty container sorting worker (operator∗ 1)Table 7
Equipment composition of the cigarette sorting and packaging system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityThird floor main lineSorting transfer belt∗ 3Conveyor belt∗ 3 + synthesizer ∗ 3Suborder generator∗ 3Order closing station1 (three orders in one)Synthesizer∗ 1Single generator∗ 3Packer1 setSynthesizer∗ 1Table 8
Equipment composition of the delivery temporary storage system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityLabeling inspection machine2 setsProcessor∗ 2Loading and unloading operator∗ 2 + temporary storage area ∗ 2Shipment staging area6Staging area∗ 6Task actuator∗ 2Collection and analysis of the equipment parameters of a sorting system: The system data obtained according to the data are shown in Table9.Table 9
Brief analysis of system data.
StationEfficiencyManual unpacking efficiency100–150 pieces/person∗ hourTrolley replenishment efficiency145 PCS/hReplenishment efficiency of vertical tobacco silo1500–2000 cartons/hourPackaging efficiency of packaging machine22000 cartons/hourBelt running speed1 m/sThe running time unit of the simulation setting is 1, and the length unit is 1. Therefore, to achieve the efficiency shown in table, it is necessary to set the data correspondence in the FlexSim simulation model, as shown in Table10.Table 10
Simulation data analysis.
StationEfficiencyFlexSim entity parameters to be adjustedReachable efficiencyManual unpacking efficiency100–150 pieces/person∗ hourResolver processing time 0.5120 pieces/hourTrolley replenishment efficiency145 pieces (7200 cartons)/hourThe stretching speed of stacker is 30, the acceleration/deceleration is 20, and the maximum speed is 27200 cartons/hourReplenishment efficiency of vertical tobacco silo1500–2000 pieces/hourMaximum speed of replenishment operator 2. Acceleration/deceleration 1, capacity 41800 cartons/hourSorting efficiency15000–22000 cartons/hourSynthesizer processing time 517000 cartons/hourBelt running speed1 m/sBelt running speed 11 m/S


### 4.3.3. Analysis of Operation Results of Each Business Link

Calculated from the input of the horizontal sorter:Replenishment efficiency of the trolley = (9681 + 9651 + 9573)/1.5 = 19270 pieces/hour.Calculated from the input of the vertical sorter:Manual replenishment efficiency of the vertical machine = 3294/1.5 = 2196 pieces/hour.The output of the horizontal sorter and vertical sorter is calculated as follows:Sorting efficiency of the sorting line = (7401 + 7452 + 8238 + 3204)/1.5 = 18330 pieces/hour.Through the calculation of the output of the single synthesizer:Sorting efficiency of the sorting line = 29355/1.5 = 18750 pieces/hour.The above data show that the system can achieve the expected overall efficiency.From the data listed in the table, we can see the utilization rate of each equipment. Through the system data, it is found as follows:The average utilization rate of the unpacking station of the resolver is 1.7%, but because the resolver acts as a cigarette buffer section, its utilization rate is 74.3%, and the overall utilization rate is more than 75%, which is an ideal application state.The utilization rate of the replenishment trolleys is 78%. Workers only assist in unpacking the resolver, and the vacancy rate of unpacking workers is as high as 98%. The investment of workers is fully saved.The idle rate of the four synthesizers of the three-tier sorting main line is 0%. It can be seen that the sorting equipment layer has been in a full load working state, and the sorting efficiency has reached the average value of the ideal state, i.e., 16500 pieces/hour.During the operation of the system, the blocking rate of the three suborder execution synthesizers of the three-tier sorting main line exceeds, that is, if the downstream process is smooth, the separation efficiency can continue to improve. After adding a packer, the sorting efficiency of the system can reach 30000 pieces/hour.Through the simulation of the sorting system of a tobacco distribution center in a city, it is found that the overall efficiency of the system is high, the equipment layout is reasonable, the integration is high, and the whole operation process is clearly visible. In sum up, the design scheme of the sorting system achieves the following results.The system adopts humanized design, the labor intensity of workers is greatly reduced, the number is reduced, the operation is simple, and the sorting work can be completed efficiently.The order processing was completed on the previous day, saving the processing time of the order upon arrival. The sorting line adopts the latest three-tier main line sorting and order combination technology, which greatly improves the sorting efficiency of the equipment, and the equipment efficiency operates stably at more than 15000 pieces/hour.The horizontal machine has a large smoke bin capacity, flexible scheduling, and strong adaptability to different orders; the equipment is highly integrated, and the shape is unified and coordinated. Compared with the equipment with the same sorting efficiency, the floor area is small, and the empty box is set with a fixed recycling area. The operation process in the whole sorting system is clear.


## 4.3.1. FlexSim Modeling Process

The modeling process is shown in Figure11.Figure 11
System simulation flowchart.The specific steps of the system simulation can be summarized as follows:Determining simulation objectives is the process of determining simulation objects and specific problems that will be solved by simulation. Conducting system research entails a thorough understanding of the system’s operating process and collecting system simulation operation data. To create a system model, you must first determine the basic process and relevant parameters of the system operation. System models can take the form of text expressions, flowcharts, icons, mathematical expressions, and so on. Flowcharts are commonly used for the simulation of discrete event systems. To determine the simulation algorithm, you must first determine the method for controlling the simulation model’s operation. The most common methods are event scheduling, activity scanning, and process interaction. Creating a simulation model is the process of creating a computer simulation model and writing a simulation program code. Establishing and validating the simulation model entails determining whether the model accurately reflects the reality of the system, including the operation simulation model, analyzing simulation results, and producing simulation results.


## 4.3.2. Visual Simulation of the Automatic Cigarette Sorting System

In the complete set of automatic logistics equipment systems, the occurrence of events depends on whether the conditions for triggering events are met to adapt the Petri net model. This study adopts a simulation strategy based on a combination of the event scheduling method and the activity scanning method: the entity in the system is tested by scanning, that is, the change. Once the preconditions are met, the activity process of the entity is activated, so that the relevant events can occur, change the state of the system, and arrange the occurrence time of relevant events. In the case of time change, start the corresponding timer to make the logistics system work on the computer as in the actual production environment through the process, without setting the system simulation clock. On the basis of the preceding study, a simulation model of the automatic cigarette splitting system can be developed to visually replicate the system’s operation. Analyze and validate the model’s and system’s design scheme by using the simulation’s user-friendly platform to observe the system’s actual operation effect and to analyze and validate the model’s and system’s design logic. The statistics of each equipment’s utilization rate, idle rate, blocking rate, and other data offer the foundation for decision-making and optimization.According to the analysis of the design scheme of the sorting system, the sorting system includes four basic subsystems: cigarette replenishment, cigarette sorting, cigarette packaging, and delivery of temporary storage. The equipment of each subsystem and its corresponding relationships with the entities in the simulation system, as well as the auxiliary entities required to realize the simulation function, are shown in Tables6 to 8.Table 6
Equipment composition of the cigarette replenishment system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityUnpacking station3Resolver∗ 3 + operator ∗ 3Simple cigarette replenishment system (conveyor belt∗ 3 + sorting conveyor belt ∗ 3 + synthesizer ∗ 1 + generator ∗ 2)Replenishment trolley3 setsStacker∗ 3Trolley support (basic fixed entity)∗ 3Horizontal sorter11 smoke bins/set∗ 3 setsShelf (11 columns∗ 5 layers) ∗ 3Initial generator∗ 1Vertical sorter44 smoke bin/set∗ 1 setShelf (44 columns∗ 1 floor) ∗ 1Manual replenishment shelf + operator∗ 1 + initial generator ∗ 1Empty container recycling areaConveyor belt/empty container recovery staging areaConveyor belt∗ 3 + temporary storage area ∗ 1Empty container sorting worker (operator∗ 1)Table 7
Equipment composition of the cigarette sorting and packaging system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityThird floor main lineSorting transfer belt∗ 3Conveyor belt∗ 3 + synthesizer ∗ 3Suborder generator∗ 3Order closing station1 (three orders in one)Synthesizer∗ 1Single generator∗ 3Packer1 setSynthesizer∗ 1Table 8
Equipment composition of the delivery temporary storage system and corresponding relationship with FlexSim entity.
Equipment nameRemarksCorresponding entity in FlexSimAuxiliary need entityLabeling inspection machine2 setsProcessor∗ 2Loading and unloading operator∗ 2 + temporary storage area ∗ 2Shipment staging area6Staging area∗ 6Task actuator∗ 2Collection and analysis of the equipment parameters of a sorting system: The system data obtained according to the data are shown in Table9.Table 9
Brief analysis of system data.
StationEfficiencyManual unpacking efficiency100–150 pieces/person∗ hourTrolley replenishment efficiency145 PCS/hReplenishment efficiency of vertical tobacco silo1500–2000 cartons/hourPackaging efficiency of packaging machine22000 cartons/hourBelt running speed1 m/sThe running time unit of the simulation setting is 1, and the length unit is 1. Therefore, to achieve the efficiency shown in table, it is necessary to set the data correspondence in the FlexSim simulation model, as shown in Table10.Table 10
Simulation data analysis.
StationEfficiencyFlexSim entity parameters to be adjustedReachable efficiencyManual unpacking efficiency100–150 pieces/person∗ hourResolver processing time 0.5120 pieces/hourTrolley replenishment efficiency145 pieces (7200 cartons)/hourThe stretching speed of stacker is 30, the acceleration/deceleration is 20, and the maximum speed is 27200 cartons/hourReplenishment efficiency of vertical tobacco silo1500–2000 pieces/hourMaximum speed of replenishment operator 2. Acceleration/deceleration 1, capacity 41800 cartons/hourSorting efficiency15000–22000 cartons/hourSynthesizer processing time 517000 cartons/hourBelt running speed1 m/sBelt running speed 11 m/S


## 4.3.3. Analysis of Operation Results of Each Business Link

Calculated from the input of the horizontal sorter:Replenishment efficiency of the trolley = (9681 + 9651 + 9573)/1.5 = 19270 pieces/hour.Calculated from the input of the vertical sorter:Manual replenishment efficiency of the vertical machine = 3294/1.5 = 2196 pieces/hour.The output of the horizontal sorter and vertical sorter is calculated as follows:Sorting efficiency of the sorting line = (7401 + 7452 + 8238 + 3204)/1.5 = 18330 pieces/hour.Through the calculation of the output of the single synthesizer:Sorting efficiency of the sorting line = 29355/1.5 = 18750 pieces/hour.The above data show that the system can achieve the expected overall efficiency.From the data listed in the table, we can see the utilization rate of each equipment. Through the system data, it is found as follows:The average utilization rate of the unpacking station of the resolver is 1.7%, but because the resolver acts as a cigarette buffer section, its utilization rate is 74.3%, and the overall utilization rate is more than 75%, which is an ideal application state.The utilization rate of the replenishment trolleys is 78%. Workers only assist in unpacking the resolver, and the vacancy rate of unpacking workers is as high as 98%. The investment of workers is fully saved.The idle rate of the four synthesizers of the three-tier sorting main line is 0%. It can be seen that the sorting equipment layer has been in a full load working state, and the sorting efficiency has reached the average value of the ideal state, i.e., 16500 pieces/hour.During the operation of the system, the blocking rate of the three suborder execution synthesizers of the three-tier sorting main line exceeds, that is, if the downstream process is smooth, the separation efficiency can continue to improve. After adding a packer, the sorting efficiency of the system can reach 30000 pieces/hour.Through the simulation of the sorting system of a tobacco distribution center in a city, it is found that the overall efficiency of the system is high, the equipment layout is reasonable, the integration is high, and the whole operation process is clearly visible. In sum up, the design scheme of the sorting system achieves the following results.The system adopts humanized design, the labor intensity of workers is greatly reduced, the number is reduced, the operation is simple, and the sorting work can be completed efficiently.The order processing was completed on the previous day, saving the processing time of the order upon arrival. The sorting line adopts the latest three-tier main line sorting and order combination technology, which greatly improves the sorting efficiency of the equipment, and the equipment efficiency operates stably at more than 15000 pieces/hour.The horizontal machine has a large smoke bin capacity, flexible scheduling, and strong adaptability to different orders; the equipment is highly integrated, and the shape is unified and coordinated. Compared with the equipment with the same sorting efficiency, the floor area is small, and the empty box is set with a fixed recycling area. The operation process in the whole sorting system is clear.


## 5. Discussion

This work analyzes and studies the current situation of express sorting, designs an express sorting system based on QR code recognition without human participation, implements the automatic extraction of QR code information from the express sheet, sorts the express based on the information, and selects and improves each part of the QR code recognition algorithm process based on the particular problems encountered in express sorting. The primary work is the following: Examining the current state of the existing express sorting system. The design of an express sorting system based on QR code recognition technology is motivated by the low efficiency and high error rate of human sorting. The technology features no manual assistance, independent collection of express QR code images, great environmental adaptability, and a reasonable price. The algorithm flow of two-dimensional code recognition is designed, with the weighted average method chosen due to the complexity of the background in the express sorting system; the median filter is chosen as the filtering algorithms to address the problem of noise interference in the process of express delivery; the binarization algorithm determines the global threshold method based on the properties of the two-dimensional code; and the coding principle and decoding algorithm of the two-dimensional code are investigated. The results of the experiments indicate that the decoding algorithm meets the requirements. However, this study briefly introduces the basic knowledge of Petri net and uses Petri net to establish the designed automatic sorting model of the cigarette distribution center. Based on this model, the design scheme of the automatic sorting system is simulated with the help of FlexSim software, and the results are run and output. Through the statistics of the utilization rate, idle rate, blocking rate, and other data of each equipment, the system simulation experimental results show that the sorting efficiency of the system sorting line is 18570 pieces/hour, and after adding packaging equipment, the sorting efficiency of the system can reach 30000 pieces/hour, and the efficiency can be improved by 61.55%. The rationality of the scheme was verified.


## 6. Conclusion

Automatic cigarette sorting systems are being employed more and more frequently in the distribution of cigarettes because the intensifying automation and informationalization of tobacco logistics. Based on an in-depth analysis of the characteristics of cigarette sorting, this study uses the EIQ analysis method to analyze the distribution center’s order data to provide a decision-making framework for the planning and design of a cigarette sorting system. The sorting mode and strategy of the sorting system are chosen in accordance with the analysis results of the order data. Due to the prior qualitative analysis method’s significant subjectivity and blindness, it is challenging to consider both the effectiveness and cost of the sorting system at the same time when choosing the equipment for the split building system. To optimize the configuration of the planned sorting system equipment, this study provides an equipment configuration approach based on the sorting cost critical point method. Finally, the cigarette sorting system is simulated and examined using the simulation program. The effectiveness and viability of the design scheme are examined through the operation process and result output.



---

*Source: 2466801-2022-10-09.xml*