Development of an open source-based manufacturing execution system (MES): industry 4.0 enabling technology for small and medium-sized enterprises

The companies’ production systems have been transformed by industry 4.0 technologies, therefore increasing their sophistication. Vertical integration, one of industry 4.0 pillars, is filling the gap between lean manufacturing and industry 4.0 through manufacturing execution systems (MES), that aid in process control and improvement through data analysis. As a contribution to enterprises migration towards industry 4.0, this work aims to develop a MES based on open source technologies and functional characteristics similar to those systems available on the market, although the system developed aims at small and medium enterprises. In order to do so, the technologies and software available on the market were assessed against characteristics defined as important in the evaluation of similar systems. The MES developed through the use of open source technologies resulted in 76.22% of characteristics similar to other systems, besides having a sale price up to 55.3% lower than other commercial systems. OpMES, the developed system, was successfully implemented in a company whose production process is complex due to the high level of customization of the product.


I. INTRODUCTION
Industry 4.0 has brought a new concept to companies that is changing manufacturing processes, business models and results. Technical advances are incorporated by them increasing productivity, flexibility, production speed, mass customization, which results in greater quality and productivity to enterprises [1,2]. An important factor in the implementation of industry 4.0 is the data collection and analysis for real-time decision making, so the company becomes more flexible and improves its processes based on evaluation of immediate situation data, therefore optimizing production [3,1].
The market competitiveness has created new challenges, leading companies to seek fundamental solutions in quality, performance and agility in their processes and products, hence, the manufacturing execution system (MES) has been indispensable to assist them in this process. The system brings together the company's planning and production, providing access to information displayed in graphics, that enables to monitor and analyze production, as well as products and equipment status, making it possible to trace its use which leads to idleness minimization. The MES function is to manage resources, improve equipment usage through data trend and historic analysis [5]. Industry 4.0 has brought advanced information and communication systems to companies, but to implement them it is necessary for processes to function efficiently. In this context, lean production systems are fundamental for processes implementation where there is no waste and the standards are well defined, with these two as pillars of industry 4.0, that is, vertical and horizontal integration assists the improvement of these processes [6]. The problems faced by manufacturing companies during lean implementation and integration can be solved through the use of technologies that are part of industry 4.0, one of them is MES, which fits into a vertical integration of information that helps to control and improve during reduction processes of non-value-added activities, also called waste. The MES fills a gap in the integration between industry 4.0 and lean manufacturing, that is, by implementing industry 4.0 companies will become lean because of the need to have well-defined processes [7,4]. Thus, it is highlighted the importance of developing open source MES, which tends to have a reduced price, especially for small and medium companies that do not have the resources to acquire closed systems.
Given the presented context, this work addresses the development and implementation of a manufacturing execution system through the use of C and PHP programming languages, open source hardware and software, enabling industry 4.0. A data collector with Wi-Fi network, a web interface and database were developed to store the information for later analysis in dashboards.
This article is organized as follows: Section 2 presents the fundamental theoretical references for the characterization of this research based on industry 4.0, MES, lean, OEE and technologies relevant to its development. Section 3 describes material and methods presenting the evaluation of the available resources in the market, comparing its characteristics to define the development requirements, also describes how the development of the OpMES, its structuring and cost were planned. Section 4 presents the OpMES implementation results during its testing. Finally, Section 5 presents the final conclusions and recommendations for future researches.

II. THEORETICAL BACKGROUND
A. Industry 4.0 The industrial production is inserted in a paradigm of a new change based on the advanced digitalization that combines internet and future technologies, hence combining objects, machines and intelligent products, thus in such scenario the product will be able to control its own factory process allowing mass customized production [8]. In this environment, humans and machines will use technologies that allow them to work collaboratively, so for the most part of work intelligent machines will be able to help, using speech recognition, computer vision and machine learning [9,10].
Intelligent manufacturing will be fully integrated into the product development lifecycle through information and communication technologies, science and intelligent manufacturing technologies that encompass design, manufacturing, management, testing and integration. Autonomous sensors, adaptive models of decision making, intelligent devices, analysis, cognition, control and execution of human, mechanical, material and environmental aspects compose the manufacturing life cycle [11]. In addition to generating opportunities, globalization creates challenges for industries by forcing companies to market new and more individual products, increasing productivity and flexibility, which forces companies to improve their performance to meet mass customization. The technological basis for an evolution in the industry is through the use of digitized processes with open bases for industrial hardware and software foreseeing a comprehensive technology of distributed production and embedded controllers [12].
The industry 4.0 basis is made by nine fundamental pillars described as: Intelligent Robots; Simulation; Systems Vertical and Horizontal Integration; Industrial Internet of Things; Cyber Security; Big data; Cloud Computing; Additive Manufacturing; and Augmented Reality [2]. The production environment will be influenced by industry 4.0, therefore manufacturing industries will incorporate the great majority of the concepts above highlighted, with the most significant changes being in the operations execution and in the production planning, where production real-time planning will be allowed along with a dynamic optimization, as well as systems featuring human-machine interaction [7].

B. Manufacturing Execution System (MES)
The manufacturing execution systems (MES) can be defined as a system that performs the integration between the planning layer and the production layer of a company, therefore supporting factory floor processes and integrating with others systems within a company, making companies more flexible, reconfigurable and appropriate [13]. The MES arises through the need for a system that assists managers' decisions, including better planning, support for process improvements, better staff and talent management, lower production costs, and reduction of manual data entry [14].
Every MES presents characteristics like operation composition, functions and results, because these characteristics greatly define the component efficiency. In installed systems, the client rarely requires all the features and they are not necessarily present in the installed modules [15].
According to Martin Naedele et al. in [14] one of the most important factors in a controlled process is the measurement collection of various processes, based on which a manufacturing MES supports ten functional areas such as: work management, resource allocation and status, dispatching production units, product tracking and source, quality management, performance analysis, process management, operations, document control and maintenance management.
The information efficiency contained in a MES strongly depends on the user who informs the data, once the system does not control or change the production operations, but through the data generates indexes that allows the company to make decisions.

C. Lean manufacturing metrics in the context of the 4th industrial revolution
The lean concept, which is also known as the Toyota Production System (TPS), is based on the elimination of waste and lean thinking, which can be translated as to do more with less, reducing human effort, equipment, time and space, that at the same time offer the customer exactly what is wanted. The consistent and complete elimination of waste by increasing production efficiency is the main goal of TPS, therefore lean thinking aims at giving immediate feedback on actions to turn waste into value. Even though it originates from manufacturing environments, lean can be applied universally [16,17]. The rising integration of information and communication technologies can unite industry 4.0 to lean production, which by having a leaner process supports industry 4.0 more easily, proposing an acceleration in the shift to the 4th industrial revolution [18].
With the evolution of technology and the emergence of the industry 4.0 the production systems experienced a strong influence in their development. Efficiency is directly connected to these production systems, with the former depending on each machine productivity and the system control. For the evaluation of activities within the manufacturing, performance indicators are used [19].
One of the main performance indicators is the overall equipment effectiveness (OEE), which is based on the multiplication of three parameters associated to equipment, availability, performance and quality [20]. Used as a tool in total productive maintenance (TPM), OEE is the key performance indicator for all organizations committed to eliminating waste [21].
Equipment availability ( 1 ) is associated to manufacturing interruptions, and it is a relationship between operating time and planned operating time [20]. The equation to calculate availability was adapted from Seiichi Nakajima in [22], and it is defined as in which TP represents planned time and TI represents inactive time.
The second indicator is performance ( 2 ) that measures the equipment theoretical processing speed in relation to real processing speed [20], that is calculated as follows in which QP represents the processed quantity, TCT represents the theoretical cycle time and TO represents operational time, also adapted from Seiichi Nakajima in [22]. The third and last parameter is the quality rate ( 3 ) that measures manufacturing quality waste relating the real production quantity to the planned production quantity [20], and it is defined by in which QP represents processed quantity and QD is the defective quantity, that was adapted from Seiichi Nakajima in [22]. Among the advantages of OEE in relation to other indicators, what stands out the most is the unification of three separate parameters into a single indicator, considering the overall performance of an equipment [20]. The fundamental equation for the calculation of OEE was adapted from Seiichi Nakajima in [22], being defined as: (4) The overall equipment efficiency (OEE) calculated through equation (4) shows the equipment efficiency, according to the equipment's programmed operation time [23].

D. Technologies that allow MES development
The breakthrough in IoT (Internet of Things) technologies in recent years is exponential, many of them aimed at improving human life and advanced automation. The study areas are focused on several segments such as houses, cities, farms, agriculture, industry, roads, parking lots, transportation and many other areas, leaving everything more and more connected and intelligent [24]. The productivity and profitability of companies are improving due to the implementation of IoT in their business models and processes, thus helping them to make more assertive decisions [25].
In most cases, manufacturing companies uses IoT to monitor and diagnose operations as to ensure processes quality, reliability and safety, therefore reducing the likelihood of product and process failures [24]. With the help of IoT it is possible to collect information in real time in different parts of the value chain, so data collection becomes efficient, fast and flexible [26].
One of the onboard processing and storage hardware that is used in open source IoT development is the NodeMCU, which was developed by Espressif that makes a System on Chip (SoC) called the ESP8266. In addition to being extremely economical, it has Wi-Fi and through the moon scripting language can simplify the programming and execution of programs. Besides, it also has an ESP-12E, CP2102 module and USB connector for power. This module was selected because it is low price and can be directly integrated with specific actuators and devices through its programmable GPIOs and also use the Arduino programming environment [27,28,29].
XAMPP is a non-profit Apache Friends distribution that allows one to have an Apache web server that contains PHP, Maria DB (equivalent to MySql), and Perl. It is distributed to Windows, Linux and OS X as a compilation of free software (comparable to a Linux distribution), being free and free to be copied under the terms of the General Public License GNU [30]. The PHP programming language Hypertext Preprocessor mentioned above is open source with wide use, this programming language is suitable for web development and it can be merged within the HTML code. Its syntax resembles C, Java and Perl, and can be easily understood, but its main objective is to enable the development of pages that will be dynamically and quickly generated [31]. Created in 1995, web server software named Apache maintains its commitment to open development and is one of the influencers of open source. Open source software offers many benefits, including reduced cost, and its quality benefits those who adhere to a high development speed and business advantage [32]. MariaDB is a fast and robust database, developed by the original creators of MySQL and guaranteed to be a database with structured information being an evolved MySQL substitute. It is considered one of the most popular databases in the world, provided by its developers to remain open source, providing a SQL (Structure Query Language) interface to access data [33].

III. MATERIALS AND METHODS
This work aims at the development of a low cost manufacturing execution system (MES), by searching for components and open source technologies that allow its development while maintaining the minimum possible of the main characteristics of a MES.

A. Requirements and resources evaluation
To define the requirements for the MES development, some important parameters present in a MES were selected, through an evaluation between two MES systems available in the market. The sale price of the systems consists of the sum of the price of software and collectors divided by the quantities budgeted, product A has a sale price of R$ 4.953,90, and product B has a sale price of R$ 5.666,67, in no system was added the monthly fee charged. The development was divided in two parts, one contemplates the data collector, the other contemplates the software provided by the companies, both have basic products, intermediate and advanced, but the comparison was made with the basic products supplied by them.
The characteristics desired for the data collector were selected with the intention of keeping low costs, but meeting the minimum possible of what is present in the systems available in the market. As shown in TABLE I, it was selected for the data collector features such as: connection to the 2.4 GHz Wi-Fi network and buttons for user interaction, with the buttons limited to 18 and two leds were added to inform the user if the appointment is open or closed. Based on these definitions, hardware evaluations were performed for the development of the data collector.

  
Barcode reader input

  
The evaluated systems software is usually proprietary, that is, it is developed by the company, however in the proposed MES the intention is to bring the important information that others software generate, but by using third party software it is possible to minimize development costs.

  
Among all the characteristics described above it was selected that system and database installation can be performed either on a server or on a computer (desktop); it was defined that the software and database are local and not on the cloud and that machine appointments can be customized. The main reports and graphs, such as stop and production appointments in the machines, indexes of appointment occurrences, availability, performance, quality and OEE calculation, production orders produced report, manufacturing orders and parts produced report and rework report were maintained, and to carry out the calculation of all of them, it was proposed to use Microsoft Excel software in direct connection with the database. In order to carry out the registration of manufacturing orders, it was proposed the development of a software that facilitates the user's use at the time of the registration, for that was used the language PHP that is a language for open source web development.

B. Development
Development was divided in four stages, first the data collector development as well as all its preparation for the network connection and data sending, after the web interface was developed for the registries and reports of manufacturing orders and server scripts for data inclusion and updating, in the third step an apache web server and a MariaDB database (equivalent to Mysql) were implemented, where the tables were created to receive data from the collectors and web interfaces and finally the connection was made with the database and the assembly of results reports and graphs.

1) Data collector
For the development of the collector an evaluation was made about the necessary characteristics of the embedded hardware to be used in the apparatus, in this evaluation some of the open source hardware available in the market to maintain the prerequisites defined in the elaboration preserving the lowest possible cost were included. The selection of the hardware included three different boards, Raspberry pi zero w, Raspberry pi 3 and NodeMCU (Esp8266) cards were evaluated, all of them could meet this project, each one with its peculiarities. The NodeMCU (Esp8266) shown in Fig. 1 was selected for the project because its cost and size was better than the others, taking into account the necessary characteristics. Because it is open source, the hardware programming interface does not need to be the default moon language, and can be replaced by the Arduino interface. In the project the Arduino interface was used due to familiarity with the programming environment, the logic that was implemented can be visualized in Fig. 2, which demonstrates the logical operation of the notebook collector. Among the evaluated hardware, all options would need an auxiliary board for buttons coupling. After the hardware definition, a design of a printed circuit board was done to couple the embedded hardware with 18 buttons for appointments digital input and two indicators indicating open (red) and closed (green). Since the NodeMCU does not have enough digital inputs to supply the 18 buttons and two led lights, the board has been developed based on the strategy of triggering door combinations, i.e. each button activates two NPN transistors in key configuration, and each transistor fires one port, two ports being triggered at the same time at each click of the button, increasing the number of ports available through the drive combinations. Fig. 3 shows the circuit used in one of the buttons. The input signal from the attached board comes from the NodeMCU itself. Fig. 3: Drive Connection diagram The transistor Q1 and Q2 shown in Fig. 3 are composed of three terminals, collector (C), base (B) and emitter (E), in the key configuration, the base (B) of the transistor is polarized to switch between saturation and the cut. When the switch (S1) is open, the current at the base (B) of the transistor is 0V, therefore the current in the collector drops to 0V and with no current in the resistor of 1K the voltage of the VCC goes to output 1 and 2. When the (S1) is closed the current arrives at the base (B) of the transistor, saturating the transistor and taking output 1 and 2 at 0V [34].
The wrapping that supports the board was developed in a CAD software and printed on a 3D printer, because the cost of developing an injection matrix is very high compared to 3D printing. The prototype shown in Fig. 4 demonstrates the design in CAD.

Fig. 4: Collector wrapping
The complete data collector consists of a printed circuit board, a NodeMCU, eighteen buttons in ABS, a wrap to place the board also in ABS, four screws to fasten the board in the box, eighteen labels that describe the notes and a cable. All components can be viewed in Fig. 5.

Fig. 5: Data Collector Components
2) Interface web in PHP and server scripts The software for recording and reporting production orders, along with the two scripts that perform the inclusion and update of the data in the database, were designed combining the PHP and HTML language. The web interface shown in Fig. 6, includes the registration of manufacturing orders and it is possible to see the daily registered orders report and change some record if wrong informed. The data reported are used in the calculation of availability, performance and OEE. On the other hand, the scripts are triggered by the collector via HTTP protocol, where the collector sends the method that the files will be sent, the URL with the file and the data to execute and the protocol version used by the client. To add the data to the database, the script that includes the data in the database receives the information from the collector's point and from there, searches the date and time on the server, adds which machine sent it, and the time-based server, including the data in the bank. The script that performs the time update is triggered by the collector and searches the last record in the database table to update the end time of the specified machine's point. The logical operation of the scripts can be seen in Fig. 7.

3) Web Server and database
The XAMPP distribution was selected for the project because it is an open distribution and contains an Apache web server, PHP and a MariaDB database (equivalent to Mysql database), XAMPP was installed and set on a physical Windows server where two tables to store machine data were created. Each table stores a data type, one for the machines stopping data that comes from the collector and another one to store the production orders data that comes from the register in the web interface.

4) Reports assembly
For data compilation and analysis, some spreadsheets were built using Microsoft Excel software, which contains graphs and pivot tables that connect directly to the database in order to generate reports in dashboard format. Some reports were created to perform the calculation of availability, performance and OEE, so that the calculations were based on equations (1), (2) and (4) respectively, as well as general appointments graphs, stop notes, production orders, index of appointments occurrence and evolution of OEE during the month graphs. For future improvements in OpMES the aim is to develop a web interface for analysis and generation of real-time report of all this data obtained through dashboards.

C. System and cost structure
OpMES was developed based on the user's digital data entry, where the user uses the collector connected to the network via Wi-Fi to open and close an appointment, so the collector sends the data to the server where a PHP script does the inclusion or update in the database. The user also uses a web interface to inform the production order that is currently running. Finally, managers and supervisors perform the analysis of data availability, performance, quality and OEE by compiling the data in dashboards developed in Excel software. The complete diagram of the OpMES is shown in Fig. 8. The OpMES cost was divided into 5 parts: components used in printed circuit board, contracted services, accessories, development, assembly, installation and training. The total cost was calculated based on the programming hours used for script development, web interface, database and service configuration, collector firmware, assembly of the spreadsheets connected to the database, and collector assembly. The unit cost for a complete system with a collector was realized adding up the hours of total development and divided by 80 units and after it was added to the cost of the collector, so each added collector already has built in the development cost for a unit. The detailed cost of each item is shown in TABLE III. Based on the presented cost, it was elaborated a strategy to obtain the OpMES selling price and come to a common base based on the systems available on the market, as to make a comparison around the selling price. In order to calculate taxes applied to the product, it was proposed that this kind of system be sold by companies that feature national SIMPLES tax system, so the taxes calculation is unified.
Assuming that the percentages incident on the selling price of the products are respectively; 7.8% according to SIMLES national taxes, 20% administrative cost and 35% profit margin, the total incident would be 62.8%. In order to calculate the index that will be applied to the cost of the product and to realize the formation of the sale price, the divisor factor is calculated in which it decreases from the total that would be 100% the incident percentage, that is, in the case it would be 62.8%, resulting in the value of 0.3720. From this value the multiplier factor is calculated, dividing 1 by the divisor factor, resulting in a multiplier factor of 2.6882, applying this factor to the cost is obtained the sale value of the product of R$ 2.533,41. This value is significantly lower than commercial MES evaluated, which does not use open source technology.

IV. RESULTS
The development and implementation of OpMES took place in a planned furniture industry, the company offers its customers the customization by milimetes within the limit of 150 mm up to 2750 mm in length and 150 mm up to 1830 mm in width, varying the thicknesses between 6 mm, 15 mm, 18 mm, 25 mm and 42 mm and offering a carton of 24 patterns of different colors. In addition to the wood customization, it is possible to choose aluminum doors with glass or wood, and a diversity of accessories, all with a delivery time of 5 working days from the order release.
The combination of possibilities that the company offers to its customers generates a high complexity in the production system, a need that demands industry 4.0 technologies to be adequately served. On average, 350 sheets of wood of the most varied combinations of parts, colors and thickness are optimized and divided among 3 cutting machines available in the company. The cutting sector today is the company's bottleneck due to the high patterns exchange on the machines. The developed and implemented OpMES is in fact an enabling technology for intelligent manufacturing and with control and decision made in real time, it is able to show machines efficiency, availability and performance through graphs and reports, being able to generate a better result from the results rapid analysis. Fig. 9 illustrates the OpMES installed in one of the company's cutting machines.

Fig. 9: System installed in a machine
The data are reported by the machine operator and stored on the internal server, this information is compiled in the Excel software, and the stop, production, general and occurrences charts are generated, as shown in Fig. 10. In the sequence, according to Fig. 11, a graph of machines availability, performance and OEE monthly evolution is generated. The company where it was implemented chose to calculate the OEE quality factor in a different way, calculating by group of machines outside the OpMES and not each individual machine integrated in the OpMES, in order not to affect the OEE calculation the quality was considered 100% in the equipment.  Based on the comparison against two similar systems already available on the market, it was possible to develop a MES that features 76.22% of the main characteristics, however in the comparative selling price the developed OpMES price is 48.9% lower product A and 55, 3% lower than product B, this result is mainly due to the use of open source technologies.
This article main objective was reached through the evaluation and the study using the above mentioned open based tools, integrated and interconnected for its development and implementation, performing calculations based on theories. The research shows that it is possible to develop and implement simple solutions, but with large contributions within the companies themselves, gradually migrating them to the industry 4.0. Managers will be able to visualize more effective measures through the reports and make more assertive decisions in the production process in real time.
For future work, it is mentioned the development of a program to generate reports and graphics in the PHP language, and to be able to integrate with what has already been developed and no longer in third-party software. It is also suggested the study of the connection possibility to the machine to obtain more accurate data and even the transmission of the programs to their machines via MES software.