SIMULATION OPTIMIZATION IN DOSING PROCESS CONTROL SYSTEM IN REAL TIME IN A FREE AND OPEN-SOURCE SOFTWARE

The purpose of this work is to implement an on-line control system able to adjust the production in real time applying a simulation model with algorithmic optimization and data transfer for a programmable logic controller. The Solver tool of the Excel software was integrated into a simulation software used to find the optimal dosing of input aggregates in a Hot Mix Asphalt process. Tests were carried out in different scenarios; the results demonstrated that the proposed control was effective, leading to a possible improvement in the quality of the product, enabling it to be kept within the specifications desired for most of the time. Besides, the proposed solution appeared to be simple and accessible for small companies as it applies the Excel software and a free and open-source discrete event simulation software.


INTRODUCTION
In a work about simulation optimization in the Industry 4.0 era, Xu et al. (2016) mentioned that a new era of industrialization has emerged. The increase in productivity has been the focus of all previous industrial revolutions, starting with the invention of the steam engine in the first Industrial Revolution, continuing with the Taylorism, automation, and computerizing, driven by the production industries themselves. According to Oesterreich (2016) and Schuh (2015), the term Industry 4.0 comprises various technologies that allow the development of automated and digital manufacturing. analysis to predict the effect of changes in existing systems or to help estimate the performance of projects in the design phase.
In the pursuit of the highest productivity, these changes in the system have to be more and more accurate, seeking the highest performance of it. For this reason, the simulation can be employed together with optimization techniques, which search for improved configurations of the system with respect to the performance measurement. Usually, algorithms that are used to search for consecutive approximations in pursuit of the best solution are applied. The most used algorithms are gradient-based, random search algorithms, evolutionary algorithms, mathematical programmingbased approaches and statistical search techniques (Fu et al., 2000). These algorithms can execute modifications in the process in real time. The simulation optimization in real time allows the process to continuously adapt to the disruptions and variations in the input, keeping the quality and requirements of the final product throughout the process.
According to what was exposed, the objective of this work is to implement and test the integration between a discrete event simulation software, a Programmable Logic Controller (PLC), and optimization in real time. The main issue of the work is the combined solution of the possibility of optimizing a process applying the Solver of Microsoft Excel software and the simulation model, which can also actuate in a control system in real time. That is, the optimization searches for the optimal point of adjustment of the process that can be tested with the simulation model and that can also communicate at the same time with the control system of the process.

PROBLEM DEFINITION
The continuous search for the improvement of the processes in the Industry 4.0 era and the growth of automated systems have caused an increase in the efficiency of the control systems in real time of the process to guarantee the final product quality. This standardization in the product specifications increases the productivity and reduces different types of costs inherent to the processes, improving the results for the companies.
Dosing processes are used in several industrial applications, such as pharmaceuticals, chemicals, food industries, and civil construction. In these kinds of processes, each manufacturing step contributes significantly to the final quality of the product. Thus, a strict control of all production process is necessary so that the quality specifications of the final product are met (Imole et al., 2016). The correct dosing of soluble powder in the beverage manufacturing process, for example, is the first step to guarantee a final quality product (Imole et al., 2016). In the Hot Mix Asphalt (HMA) production, approached in this work, the aggregate corresponds approximately to 95% of the weight of the asphalt concrete, while the asphalt binder, the 5% left (Christensen, 2010). Therefore, the dosing of these input aggregates has an expressive importance in the quality control of this product.
The common practice of quality control in the asphalt industry uses offline methods. The sample is removed from the production process and sent to laboratory analysis to verify if the characteristics of the product are in accordance with the Job Mix Formula (JMF). Usually, the result of this analysis takes approximately two hours to complete. If the result presents a problem with the product, an operator must take corrective actions. However, this delay generates a product with low quality and several inherent costs. Considering that a typical process of asphalt production has a production rate of 300 tons/hour, this method of offline quality control can generate a waste of about 600 tons of material (Kabadurmus et al., 2010), or this product of poor quality may be used in roads and, in a short time, deteriorates. Figure 1 demonstrates the typical flow of analyses of Hot Mix Asphalt processes. In the same way, other processes similar to the one presented in Figure 1 can be found in various industrial plants. Therefore, the improvement solutions for this process can be applied to other similar systems. A Discrete Event Simulation (DES) simulates the gradation values of the aggregates in the system used in this work. These values are sent to a spreadsheet (explained in subsequent sections), in which the optimal proportion of the combination of aggregates is calculated. The PLC receives these values and sends input and output signal of bins, as described in to Figure 2. Thus, a process control in real time can be carried out, continuously monitoring the process parameter to be controlled and acting correctively, when necessary, in the actuators that modify the process characteristics.

CONTROL SYSTEM IN REAL TIME
It can be noticed, in the area highlighted in Figure 2, that a DES software can simulate the values of gradation of those aggregates. The simulation of these values allows running tests in different scenarios giving more flexibility to the system.   During the operation, the system continuously verifies if it is under control. We assume a system out of control when the granulation of one of the sieves is out of specification limits of the JMF. As the entities are created, according to the interval of time of discretization, it is also verified if the final product is in the control parameters according to this pre-defined time. The time interval in which the entities are created in this simulation was of 1 minute.
If the block of the final product is within the parameters of the process control, then it is not necessary to change the mixture. However, if the final product is out of specifications, corrective actions are taken. These actions are considered as changes in the opening percentages of the aggregate bins in order to reoptimize the mixture.
As opening for the optimization system, the current granulation values of each sieve are read from Ururau and written in Excel. After the optimization model reoptimizes the mixture by giving new percentage values to the aggregates, these values are read from Excel and written back to Ururau, and the simulation continues with the new values of the mixture. The simulation continues until it gets the value of ten hours, which means one day of production.

INTEGRATION OF SIMULATION MODEL WITH PLC AND EXCEL
The Ururau software was design to have the capacity to exchange information with PLCs and Excel software. This interaction allows a greater flexibility within the system; it may use the simulation to assist in the testing of other systems. Therefore, Ururau exchanges information with Excel applying the Java API (Application Programming Interface) Apache POI, which operates various file formats based on Office Open XML and Microsoft's OLE 2 Compound Document format (OLE2) patterns.
Note, in Figure 4, that the Worksheet communicates directly with Ururau software, using "Read/Write" block, which can store Excel information such as internal Ururau variables. This simulation software is also able to run VBA macros in Worksheet. All Information in the Excel can be sent to the PLC by using the Assign block, which applies the OPC Interface to alter the values in Tag Database of PLC. It was also developed a "Read/Write" block and a "Run Macro" block in the development environment of Ururau so that the user can read and write information in Excel cells and run macros in VBA (Visual Basic for Applications) code. Figure 5 represents these blocks.
The "Read/Write in Sheet" block is used to read values of the spreadsheet and store them as variable in Ururau or write Ururau variables in Excel cells. The user has to define the variable names, select if the variable will be read or written in Excel (if the box in the "Write to File?" column is unchecked, Ururau will be able to read the value of the cell and if it is checked, Ururau will be able to write in cell), define the cell in the spreadsheet that will be manipulated and inform the path where the file is in the computer. In the "Run Macro", the user has to report the name of the macro developed in Excel and the path where the file is located in the computer. Figure 4 also shows that in order that the VBA macros are run, a parameterized VBS (Visual Basic Script) code file was used, which is executed by Ururau in Java where it opens Excel, runs the desired macro and saves the file keeping the values updated.
The information of the simulation is sent to the PLC using the "Assign" block by the integration of Ururau with the OPC server with the OPC Utgard client. Available at (http:// openscada.org/projects/utgard). This OPC client is part of the OpenSCADA software; however, it can be used regardless of the platform. The Utgard is 100% pure JAVA OPC Client API and Open Source.
It was used the Rockwell Automation RSEmulate 5000 emulator, which simulates the behavior of a real PLC and communicates with the Ururau by means of its OPC Communication Driver RsLinx.

SIMULATION MODEL
The construction of the simulation models followed the methodology proposed by Banks et al. (2010), in which the next steps were taken: formulation of the problem; definition of the objective and overall project plan; elaboration of the conceptual model; data collection; translation of the conceptual model; verification; validation; experimentation; execution and analysis. The verification and validation of the models also followed the steps suggested by Sargent (2013).
The simulation was used to vary the values of gradation of aggregates according to the system proposed, which allows testing and commissioning of the system with large economy and flexibility. Changing the parameters in the project can be very costly, and simulation permits the process to be tested using different scenarios, enabling adjustments in the control and deep analysis of the process. A Free Open Source Software (FOSS) for the DES called Ururau was used. Full description of the language used in Ururau is available at https://bitbucket.org/ururau/ururau (Peixoto, 2017).
The software was applied to generate the trend curves of the gradation of the aggregates, send information to Excel and communicate with the PLC (Programmable Logic Controller) and with the supervisory system. The simulation can be followed in real time by the supervisory system developed in the Factory Talk View SE of Rockwell Automation Company, generating graphics in real time and enabling commands, such as Reset of counters. That is illustrated in Figure 6. All simulation parameters are described in Appendix A. When some sieve is out of control, the signal light "Out of control" will turn red. This indicator is controlled by the PLC with comparison blocks that monitor if the values are within the control parameters. As well as the "Counter out of control" counters (that count the number of times each sieve was out of control), the "Time out of control" (that count the time each sieve was out of control) and "Total Time out of control" (that counts the total time the system was out of control) are monitored in real time by the PLC. This information can be visualized at the bottom right of the Figure. The bar graphs with bin openings of each bin and their respective values are generated by the Solver optimization that calculates the optimal percentage of opening of each bin when the system is out of control and can also be visualized at the top left of the Figure.  The element E1 (Create) creates entities every 1 minute in the simulation. The elements L1 (Hold), A1 (Assign) and A23 (Assign) form a set, in which the next entity created by the element E1 is only released after the previous entity has passed by all elements of the simulation. That is, the entities pass through the simulation elements, one at a time. The structure of OR, A2, A3, A4 and A5 (Assigns) is used to generate a trend function that describes a possible change in aggregate gradation over time. The trend function applied in the work is the alternating step function, according to Figure 8.
The trend function increases and decreases by 33.33% the variables over time around its mean in the interval of every two hours simulated during the entire simulation. The elements from A6 to A21 (Assigns) generate the normal curves of each aggregate gradation multiplied by the trend function. The RW1 (Read/Write in Excel) element writes the values of aggregate gradation generated in Excel. The RM1 (Run Macro in Excel) activates the macro that will update the calculations of the Excel, and then the RW2 will read the updated and calculated values of the spreadsheet.
The A22 has the function of totalizing the sieves deviation. Structure C1 up to C35 has the function of communicating all needed values with the PLC. The OR, RM2, RW3, R1, and R2 structure has the function of verifying whether there is any sieve out of control. If there is one or more out of control, then the RM2 will activate the Solver that will calculate the proportions of Bin openings to optimize the mixture. These values are read from Excel by the element RW3, and the R1 will count how many times the mixture was optimized. The R2 element counts how many times the mixture was under control and optimization was not necessary.

INPUT DATA AND PARAMETERS
At the same time, the model works with a spreadsheet in a MS Excel file. In this file, there are the inputs of the simulation models. Zhang (2014) reported that The U.S. National Center for Asphalt Technology provides the input data for testing the system. These data are commonly observed in operations of asphalt plants and specifications and limits of typical mixture projects.
The data consist of three parts (according to Tables 1 and 2). The first part is the mean and pattern deviation of the granulation of each sieve for the five silos. A process simplification will only consider the most influent sieves instead of all eight sieves that are commonly used. The four most influent sieves are 3/8", No. 8,No.30 and No.200. The values of mean and standard deviation of the sieve granulation are expressed in material percentage that will pass by each of them and are shown at the top of Table 1. The second part is the Mixing Process and the upper and lower tolerance limits for each specification or production, which are presented in the last lines of Table 1 and indicate tolerance values for more or less (±) acceptable of the goal of Mixing Project. The initial percentages of the Mixing Project and the upper and lower limits of the five silos of cold inputs are demonstrated in Table 2. The percentage of each silo during the production has to be within its upper and lower limits, and this restricts the procedure of process optimization.

OPTIMIZATION MODEL
When the system is out of control, the optimization process is initiated. The data of the process simulated by the Ururau are sent to an Excel spreadsheet, and then the Solver is initiated to find the optimal solution for the system. The aim of the optimization is to minimize the total deviation between the mixture gradation and the gradation predicted in the Job Mix Formula in all sieves.
All the restrictions of the process depend on the JMF required. The optimization algorithm was adapted from Kabadurmus et al. (2010) and is defined as follows: where i is each cold feed bins, j is each sieves, D j is the total deviation.
The decision variable of the model is: • Weight percentage of the total mixture from the bins (x i ).
The parameters are: • Gradation measurements from bins (g i j ); • Target levels (by JMF) for % passing the sieves (n j ); • Upper and lower limit of specification % of passing through the sieves (r max j , r min j ); • Upper and lower limit for % of weigh coming from each silo (s max i , s min i ).

COMPUTATIONAL EXPERIENCE AND RESULTS
The simulation was tested in various scenarios, combining variations in input gradation and specification limits, comparing the process efficiency without the Solver and with the Solver optimization. The control limits applied are the Specification Limit Tolerance and Product Limit Tolerance, described in Table 1. When the product was out of these limits, they were considered out of control. Two cases for the variations in the input gradation were employed: Low Variation (described in Table 1) and High Variation (the values of Table 1 multiplied by 1.5). The results were obtained by a single simulation round equivalent to 10 hours (600 minutes) simulated, corresponding to one working day in a typical HMA production plant.
The results are in the HMI software generating graphics and showing the immediate values of the variables according to Figure 9.
As specified by Figure 9, the gradation values of each sieve can be historically observed by means of the graphics generated by the supervisory system. This resource allows observing the behavior of the system over time and all changes of Bin openings when the system is out of control. It can also be seen the results by the report generated by the Ururau software that, at the end of the simulation round, creates a detailed report of the simulation and its variables. An example of a part of this report is in Figure 10.
Notice that, in Figure 10, the report presented by the Ururau software also has relevant information, such as the means of gradations of each sieve, total cumulative deviation and counters, which indicate how many times the Solver was initiated during the simulation. The analysis of the results is based on the time out of control and on the total cumulative deviation. The time out of control corresponds to how long the system, simulated in minutes, was out of the Control Limit when the maximum is 600 minutes (10 hours of simulation time). The Ururau software calculates the value of the total cumulative deviation. In every cycle of the simulation (every one minute simulated), the Ururau obtains the value of the sum of the deviation percentages of each sieve in relation to the JMF target (Equation 1) and totalizes it with the value of the previous cycle.  The results are summarized in Table 3. According to Table 3, the optimization obtained a better result with the Production Limit Tolerance, which is more limited than the Specification Limit Tolerance, presenting an improvement of 92.65% in the time out of control when compared to No Control System Strategy. However, the optimization did not prove to be effective when the system presented a high variation in its input aggregates, in comparison with the system that has a lower variation, activating the solver more frequently and generating instabilities in the system.
In all situations tested, the optimization strategy with the solver presented a reduction both in the time out of control and in the total cumulative deviation. This result demonstrates the validity and the effectiveness of the system proposed.

CONCLUDING REMARKS
This work describes a real time on-line control of dosing input aggregates for hot mix asphalt production. The free and open source discrete event simulation software Ururau was applied to simulate the process, exchange data and manipulate spreadsheets in the Excel software. The Solver was used to optimize the mixture in real time. One of the main difficulties in the dosing processes is the variety in its inputs and the capacity of rapidly identifying and correcting this deviation. The system presented proved to be effective in this correction during the production, guaranteeing a standardization and an increase of quality in the final product.
The application for hot mix asphalt process proved itself efficient; however, this principle may also be applied to other input dosing processes. Knowing the variables, curves, and restrictions of the processes, this system shows flexibility and safety as it allows logic tests, commissioning and adjustments in the control system, with no damage to the real system, besides the code of the Ururau software is open, enabling the user to adapt the software to his/her preference and carry out a series of tests.
The aim of this new simulation software is to disseminate, use and understand discrete event simulation in Brazil, allowing the users to be in contact with this specific software for simulation, developing his/her abilities and having the possibility to know the internal conception of the software structure.