Manufacturing Execution Systems for the Food and Beverage Industry: A Model-Driven Approach

: Manufacturing Execution Systems (MES) are process-oriented information-technology (IT) solutions for collecting and managing information from manufacturing processes. Due to the individual programming e ﬀ ort and the complex integration with other manufacturing systems, though the food and beverage manufacturers can beneﬁt from the MES, its implementation is not widespread in this industry. To simplify the implementation and engineering process, the concept of model-driven engineering (MDE) is considered as a solution. However, a feasible model-driven approach for MES engineering has not been established, not to mention for the food and beverage industry. This paper presents an approach for the automatic MES generation according to the MDE concept providing MES functions that are relevant to the food and beverage manufacturing processes primarily. It consists of necessary phases to cover the whole engineering process of the MES. Based on the application of the presented approach to the brewing process in a brewhouse, the feasibility and practicality of this approach were proven.


Introduction
Information-technology (IT) systems have been used to improve production processes and are indispensable for manufacturing firms seeking to remain competitive in the global market [1]. To utilize the potential for improvement, manufacturing processes on the shop floor should not be ignored. With the increasing flexibility of processes and the diversification of products, the traditional operational IT systems (e.g., Enterprise Resource Planning (ERP)), are not able to react in real-time to meet the requirements of improvements on the shop floor. Manufacturing Execution Systems (MES) are process-oriented software systems that manage and analyze real-time information in the manufacturing processes. On one hand, MES implement production plans from systems on the enterprise-level in operative details to the production area. On the other hand, they provide essential key performance indicators, including specific energy consumption and machine efficiency metrics, to the enterprise for making business decisions and for the improvement of the manufacturing performance. The implementation of MES raises the transparency of manufacturing processes so that product quality and workflow efficiency can be optimized. Although the sectors in the food and beverage industry can benefit from MES, the special characteristics of the manufacturing processes and the lack of human, material, and financial resources have hindered their investment into MES implementation, in which considered efforts for programming, customizing, and integrating are indispensable to deal with the high complexity of MES, owing to the wide range of functions required to control the shop floor processes and the communications with intra-and extra-systems [2,3].
Using code-centric technologies to develop such a complex system requires a herculean effort [4]. An essential factor behind the development is the wide conceptual gap between the implementation

The Food and Beverage Industry
Three different types of the production process can be found in the food and beverage industry [23]: batch process for the production of finite quantities of material by subjecting quantities of input materials; continuous process for the continuous material flow through processing equipment; discrete process for the production of units moving between processing stations. The differences of the food and beverage industry from the other manufacturing industries can be summarized as [24][25][26]: (i) the splitting and mixing lots lead to a combination of divergent processes with convergent processes in the production; (ii) production yields are uncertain as the property of materials is changing over time; (iii) products or semi-finished products are recycled during the production process; (iv) final products have a limited shelf-life and deteriorate over time.
To ensure the quality and safety of the final products, the transparency through the production must be enhanced to achieve efficient process management, which can be supported by the MES, as the MES is connected to the shop floor and serves as the center delivering critical process information to the co-systems [27]. Though researchers have analyzed the factors that can influence the choice of consumers for food and beverage [28], the price remains the most critical factor [29]. Due to the lowprofit margins, sectors in the food and beverage industry, for reasonable pricing of the final products, have paid more attention to reduce the energy consumption and enhance the production efficiency [30]. By understanding the consumption of energy resources globally, the MES can contribute to managing and reducing energy consumption in the manufacturing processes [31]. MES can also support the application of lean principles, as it provides real-time information to fees and/or validate the lean processes to improve the efficiency of the production [32]. To satisfy the diverse demands of the consumers, the variety of food and beverage products is growing in the market [33]. By the continuous introduction of new products, the traditional ones can lose their viability in an unpredictable way [34]. The manufacturers have to shift their production strategy from make-tostock to make-to-order to improve production flexibility, scheduling timeliness, and further to react to the product dynamics. The MES is considered as the basis for scheduling in the process industry, as the information form the whole enterprise, such as the order delivery time, the use of processing materials, and the machine availability, must be coupled to generate the production plans [35,36]. In the new industrial automation environment, owing to its essential role as information center for data

The Food and Beverage Industry
Three different types of the production process can be found in the food and beverage industry [23]: batch process for the production of finite quantities of material by subjecting quantities of input materials; continuous process for the continuous material flow through processing equipment; discrete process for the production of units moving between processing stations. The differences of the food and beverage industry from the other manufacturing industries can be summarized as [24][25][26]: (i) the splitting and mixing lots lead to a combination of divergent processes with convergent processes in the production; (ii) production yields are uncertain as the property of materials is changing over time; (iii) products or semi-finished products are recycled during the production process; (iv) final products have a limited shelf-life and deteriorate over time.
To ensure the quality and safety of the final products, the transparency through the production must be enhanced to achieve efficient process management, which can be supported by the MES, as the MES is connected to the shop floor and serves as the center delivering critical process information to the co-systems [27]. Though researchers have analyzed the factors that can influence the choice of consumers for food and beverage [28], the price remains the most critical factor [29]. Due to the low-profit margins, sectors in the food and beverage industry, for reasonable pricing of the final products, have paid more attention to reduce the energy consumption and enhance the production efficiency [30]. By understanding the consumption of energy resources globally, the MES can contribute to managing and reducing energy consumption in the manufacturing processes [31]. MES can also support the application of lean principles, as it provides real-time information to fees and/or validate the lean processes to improve the efficiency of the production [32]. To satisfy the diverse demands of the consumers, the variety of food and beverage products is growing in the market [33]. By the continuous introduction of new products, the traditional ones can lose their viability in an unpredictable way [34]. The manufacturers have to shift their production strategy from make-to-stock to make-to-order to improve production flexibility, scheduling timeliness, and further to react to the product dynamics. The MES is considered as the basis for scheduling in the process industry, as the information form the whole enterprise, such as the order delivery time, the use of processing materials, and the machine availability, must be coupled to generate the production plans [35,36]. In the new industrial automation environment, owing to its essential role as information center for data processing and providing between the enterprise level and the automation layer, the modern technologies, such as Industry 4.0, cyber-physical systems, and digital factory, are enabled by the MES to optimize the food and beverage manufacturing processes [37,38].

MDE for Production Management Systems
To promote the reusability and to reduce the complexity of the software development process, the concept of MDE has been researched and used in a wide range of industrial applications [39], such as business imaging systems, electric systems for telecommunications, and robot operating systems [40,41]. For the development of control systems, Alvarez et al. [42] developed a model-driven approach named MeiA, which has integrated methods and techniques within the automation discipline, provided more accessible verification procedures and structured designs, and improved productivity by means of model reuse and code generation. In the area of business process management, the MDE proposed a set of methodologies, which can bridge the gap between business analysts and software developers [43]. Blal and Leshob [44] proposed a model-driven method to generate and specify services of service-oriented systems from business models expressed by Business Process Model and Notation (BPMN), a standardized graphical specification language for business process modeling and automation [45]. Due to the support of the modular engineering process, management of heterogeneity and complexity, reusability of design artifacts, MDE should not be waived to enable technologies of Industry 4.0 [46]. An MDE framework (MDE4IoT) was introduced in [47] to generate Internet of Things (IoT) systems supporting the modeling of Things and self-adaptation of connected systems. Leal et al. [48] developed a model-driven approach (smartHMI4I4) providing reusable Application Programming Interface (API) and widgets as a global framework to guide the HMI design and generation for different devices across Industry 4.0 application scenarios. Binder et al. [49] proposed a model-driven system development process integrating RAMI 4.0 to provide a common basis for the development of Industry 4.0 systems reducing the complexity of engineering processes and heterogeneity of platforms and toolsets.
For production management systems, some MDE approaches have already been established. For the implementation of an ERP system, a model-driven approach was proposed using the MDA framework by Dugerdil and Gaillard [50]. They defined a UML profile to model the business process in the level of ERP and used models to describe the transformation. In their approach, the ERP system was already implemented as a toolbox including different functional components. Instead of code generation, the components can be enabled or disabled to fulfill the requirements of the business process. A modeling approach that uses a state chart for describing and simulating the sequence of operation in MES was presented in [51]. However, the focus was on the modeling and simulation phase, and it lacked further steps for generating an operational system. Oliveira et al. [52] proposed an interpretive MDE approach for enterprise applications and compared the productivity, profitability, and return on investment (ROI) between the generative and interpretive MDE approaches based on its application to development of ERP systems. In this research, though the MDE concept has been implemented, the used modeling language, models and their specifications, and the transformation between them were not clarified. For the MES, an approach according to the MDA development method was presented by Mizuoka and Koga [53], in which the UML and XML Metadata Interchange (XMI) were used for modeling and platforms transforming. The application scenario of this approach was not declared, and it was also mentioned that the UML as a general modeling language may not be suitable for modeling MES [54], because the MES modeling is related to the target business process and requires interdisciplinary information from the co-workers of different departments, who may have different views on the same production processes [55].
The MES Modeling Language (MES-ML) was developed as a modeling language for the interdisciplinary specification of MES [56]. For the generation of operational MES according to the MDE concept, the metamodel of MES-ML was extended [57]. With this extension, the components of MES (plants, processes, MES functions, and reports) and their connections could be modeled completely, and the extended MES-ML was validated with a modeling example, which proved the feasibility of this language for the MDE of MES. However, it lacked an explanation of the steps that are needed to represent the information in the model and for the transformation between different models for automatic MES generation. The concept of model-driven engineering for MES by using the extended MES-ML was proposed first in 2017 [58]. Chen et al. [59] proposed in 2018 a model-driven approach for MES with more details, which consisted of three steps, modeling, specifying, and generating. Their research focused on the step of modeling with extended MES-ML that was integrated, in which libraries for predefined modeling elements were introduced. The feasibility and the necessity of the predefined modeling elements were also evaluated and proven by their research so that the basis for the model-driven engineering of MES was established. However, details of the latter steps, including specifying and generating, were not clarified.

Requirements on the Approach
Conventionally, seven phases are necessary to implement the MES in a manufacturing enterprise [60]: basic determination for determining the MES project scope and content; preplanning for analyzing the business, production processes, and the MES functions; basic planning for evaluating and drafting the MES concept and recommendation; realization planning for mapping the MES in detail; implementation for installing and integrating the hardware and software; commissioning for testing the MES software and training the users; completion for compiling the final report and drafting project accounting. The specific business and manufacturing processes must be considered in each phase to be executed, therefore, the MES must be adopted with considerable customizing and programming effort, which is cost-intensive and error-prone [61,62].
Based on the facts that more than 99% of the enterprises in the food and beverage industry are small-and medium-sized enterprises [63], and few rudiments of MES are specifically designed to fulfill the requirements from the food and beverage industry with relatively low programming and customizing effort, and further low cost, the MES implementation in the food and beverage is hindered by the unavailability of the resources from the side of the end-users and the lack of methods to reduce the implementation complexity from the side of the MES providers. Chen and Voigt [64] analyzed the barriers for the MES implementation in the food and beverage industry combined with their characteristics, and proposed solutions to deal with the barriers, i.e., the use of standardized information model for the information exchange in the whole enterprise to reduce the integrating effort, the service-oriented architecture for dividing the MES functions in independent services to achieve higher reusability, and the model-driven concept for engineering the MES to reduce the programming and customizing effort. Therefore, the requirements that should be fulfilled by the presented approach are defined as: The manufacturers in the food and beverage industry need support from the MES to face the challenges of reducing energy consumption, increasing production efficiency, improving production flexibility, and remaining competitive. Therefore, the model-driven approach should be able to represent the MES functions required by the manufacturing enterprises in the food and beverage industry, such as energy management, KPIs calculation, production scheduling, and predictive maintenance. Furthermore, considering the limited available resources of the food and beverage manufacturing enterprises, the approach should be able to lower the programming and customizing efforts during the engineering process. -Requirement 3 (R3): Capability of data flow. To implement the developed model-driven approach in different application scenarios without redefining the information interface, a consistent communication standard between the shop floor level and MES level should be supported. Additionally, a standardized communication interface should be used for data exchange to ensure the portability of the modeling elements, which are predefined and to be reused. -Requirement 4 (R4): Automatic adoption of the generated MES. The model-driven approach should not be defined to serve definite application scenarios but could be applied to fulfill various demands on the MES from different domains. Thus, the basic elements that were used to establish the MES model must be defined neutrally. Due to the flexible sequence of the basic elements and further the information flow, the MES that modeled with the basic elements should be generated dynamically, so that it can be adopted automatically to each specific application scenario.

Approach for the Model-Driven Engineering of MES
This section presents each phase of the model-driven approach in detail, i.e., the analyzing phase, the modeling phase, the specifying phase, the generating phase, and the application phase ( Figure 2). To implement the developed model-driven approach in different application scenarios without redefining the information interface, a consistent communication standard between the shop floor level and MES level should be supported. Additionally, a standardized communication interface should be used for data exchange to ensure the portability of the modeling elements, which are predefined and to be reused. -Requirement 4 (R4): Automatic adoption of the generated MES.
The model-driven approach should not be defined to serve definite application scenarios but could be applied to fulfill various demands on the MES from different domains. Thus, the basic elements that were used to establish the MES model must be defined neutrally. Due to the flexible sequence of the basic elements and further the information flow, the MES that modeled with the basic elements should be generated dynamically, so that it can be adopted automatically to each specific application scenario.

Approach for the Model-Driven Engineering of MES
This section presents each phase of the model-driven approach in detail, i.e., the analyzing phase, the modeling phase, the specifying phase, the generating phase, and the application phase ( Figure 2).  To ensure the consistency of data flow in the horizontal transformation from model to the operable system, as well as in the vertical integration between the automation level and enterprise level, "Weihenstephan Standards (WS)" [65] are integrated in this approach, which are widely used in the food and beverage industry. The WS is a standard information model that defines a universal communication interface for the communication between different process control systems and the MES. With WS, the processing of the machine and process data could be consistently defined for the MES functions. To ensure the portability of models, WS is used as the primary information model through the whole approach. The following sections present the engineering processes, the tasks, and the related tools of each phase.

Analyzing Phase
As the preliminary study before the modeling phase, the actual state of the production plant and its processes with their acquirable data sources, the demands on the MES functions, and the desired MES reports should be analyzed. This phase is addressed primarily at the end-users. The main concepts and entities of the domain are analyzed. Multiple co-workers (end-users with internal and/or external solution analysts) with different focuses and working backgrounds must work together to figure out the proper MES functions as well as the information flow among departments in a completed MES [56]. The results of this phase are textual specification sheets indicating the actual stand of the production state (technical systems and production processes), the available data sources from the production, the required functions, and the desired report of the MES.

Modeling Phase
At the modeling phase, the MES that fulfill the demands in the first phase must be modeled, based on the results of the analyzing phase. The extended MES Modeling Language (MES-ML) is a formal modeling language and was proven to be suitable for modeling the MES with a model-driven concept [57]. An editor that supports the extended MES-ML can assist the modeling process. The output of the modeling phase is a completed graphical model of the MES containing the necessary information for the transformation and generation in the later phases.
In the extended MES-ML, the plant model is structured as a tree diagram with six hierarchy levels to present the technical systems that are inspired by the ISA-95 [15,57], i.e., factory, area, plant, line, machine, and aggregate. Under each technical element in the hierarchy level, data points can be assigned to indicate the data that can be provided. The process can be modeled with three hierarchy levels with an increasing grade of detail; namely, process, process stage, and process operation, which are defined in ISA-88 as the first three levels in the process model [23]. To model the MES function, a series of basic functions were defined to compose the final MES function. The report is modeled with its name and the report elements belong to it. The data from the technical systems and the processes are the inputs, and the results of the MES functions are outputs of the reports. Each report element can display the information in a certain manner, such as text, table, or diagram, and is connected to an MES function providing the related outputs. Figure 3 presents the metamodel of the extended MES-ML for modeling the four components.
It should be noted that to ensure the independence and generality of each model, the connections between the models are established by the mapping function provided by the report model. Although the necessary data from technical elements and/or processes to be processed by the MES functions are modeled, the sources of them are not fixed in the modeling phase. In other words, for any technical elements and processes, which can provide the related data, the appropriate MES functions can be executed, i.e., the reusability can be ensured by the division of the data from the MES functions. By defining the inputs and outputs of the reports, the connections among the plant model, process model, and the MES function model are firstly established.

Specifying Phase
Following the modeling phase, taking the graphical MES model as the input, an MES specification as the output of the specifying phase is filled. The primary task of this phase is to transform the information from the graphical models into a format that software can utilize. The database tables are the platform for the MES specification. Different tables related to the four models in the modeling phase are defined to represent the information in the graphical model. In this phase, the transformation process is a mapping process, as the structure, content, and the relationship of the tables were defined as a one-to-one mapping of the extended MES-ML metamodel. This phase can be performed automatically by using a mapping tool that knows the relationship between the metamodel of the extended MES-ML and the database tables.
In the following, the related logical entity-relationship diagrams (ERD) of the database are presented using Crow's Foot Notation. As the technical systems are modeled using different hierarchies and the data points for collection can be assigned to each element in the plant model (according to the meta model of MES-ML), two tables named "Location" and "LocationDataPoint" are used to describe the plant model (Figure 4, left). The table "Location" contains attributes that are identical to the hierarchy level of the plant metamodel with factory, area, plant, line, machine, and aggregate being used to present the modeling elements on each hierarchy. The table "LocationDataPoint" presents the data points on each element. The types and descriptions of the data points can also be found with the attributes "DataPointType" and "DataPointDescription". Besides that, the attribute named "LocationLink" is made to indicate the relationship between a specific data point and its host element. Similar to the plant model, the information in the process model can be represented with two tables named "Process" and "ProcessDataPoint" (Figure 4, right). The name of the modeling elements on each hierarchy level in the process model can be found in the "Process" table. The type of the used process data points and their link to the process element can be described with the attributes "DataPointType" and "ProcessLink." Another table to indicate the correlation between the plant model and the process model is also defined (Figure 4, middle). By using the two attributes "ProcessLink" and "LocationLink" in the "LocationProcess" table, the link between the processes and technical systems can be found.

Specifying Phase
Following the modeling phase, taking the graphical MES model as the input, an MES specification as the output of the specifying phase is filled. The primary task of this phase is to transform the information from the graphical models into a format that software can utilize. The database tables are the platform for the MES specification. Different tables related to the four models in the modeling phase are defined to represent the information in the graphical model. In this phase, the transformation process is a mapping process, as the structure, content, and the relationship of the tables were defined as a one-to-one mapping of the extended MES-ML metamodel. This phase can be performed automatically by using a mapping tool that knows the relationship between the metamodel of the extended MES-ML and the database tables.
In the following, the related logical entity-relationship diagrams (ERD) of the database are presented using Crow's Foot Notation. As the technical systems are modeled using different hierarchies and the data points for collection can be assigned to each element in the plant model (according to the meta model of MES-ML), two tables named "Location" and "LocationDataPoint" are used to describe the plant model (Figure 4, left). The table "Location" contains attributes that are identical to the hierarchy level of the plant metamodel with factory, area, plant, line, machine, and aggregate being used to present the modeling elements on each hierarchy. The table "LocationDataPoint" presents the data points on each element. The types and descriptions of the data points can also be found with the attributes "DataPointType" and "DataPointDescription". Besides that, the attribute named "LocationLink" is made to indicate the relationship between a specific data point and its host element. Similar to the plant model, the information in the process model can be represented with two tables named "Process" and "ProcessDataPoint" (Figure 4, right). The name of the modeling elements on each hierarchy level in the process model can be found in the "Process" table. The type of the used process data points and their link to the process element can be described with the attributes "DataPointType" and "ProcessLink." Another table to indicate the correlation between the plant model and the process model is also defined (Figure 4, middle). By using the two attributes "ProcessLink" and "LocationLink" in the "LocationProcess" table, the link between the processes and technical systems can be found. As the MES functions are composed of the basic functions, there are six tables to represent the information from the basic functions, MES functions, and the logical relationship between them. On the right side of Figure 5, the basic functions used to compose the MES functions and their input parameters are described in the tables named "BasicFunction" and "BasicFunctionInput." On the left side are the tables named "MESFunction" and "MESFunctionParameter" to represent the name of the MES function and the necessary attributes of the total input and output parameters to realize this MES function, such as the "Direction" to differentiate the input (Direction = 1) and output (Direction = 0) parameters. The two tables in the middle, namely the "MESFunctionInstance" and "MESFunctionInstanceParameter," serve as bridges in the specification for the MES function model to indicate on one side, the affiliation between the basic functions and the MES functions and on the other side, the assignment of the input and output parameters of the MES functions to the input parameters of the basic functions. The information in the report model can be transformed using the four tables that are shown in Figure 6. The table "Report" contains the name and the type of report. As a report can contain several report elements to present the results of different MES functions, and each MES function needs different data sources from the plant model and/or process model, the tables "ReportElement" and "ReportInput" are defined. The table "ReportElementOutput" is responsible for establishing the link between the report elements and the MES functions. As the MES functions are composed of the basic functions, there are six tables to represent the information from the basic functions, MES functions, and the logical relationship between them. On the right side of Figure 5, the basic functions used to compose the MES functions and their input parameters are described in the tables named "BasicFunction" and "BasicFunctionInput." On the left side are the tables named "MESFunction" and "MESFunctionParameter" to represent the name of the MES function and the necessary attributes of the total input and output parameters to realize this MES function, such as the "Direction" to differentiate the input (Direction = 1) and output (Direction = 0) parameters. The two tables in the middle, namely the "MESFunctionInstance" and "MESFunctionInstanceParameter," serve as bridges in the specification for the MES function model to indicate on one side, the affiliation between the basic functions and the MES functions and on the other side, the assignment of the input and output parameters of the MES functions to the input parameters of the basic functions.  As the MES functions are composed of the basic functions, there are six tables to represent the information from the basic functions, MES functions, and the logical relationship between them. On the right side of Figure 5, the basic functions used to compose the MES functions and their input parameters are described in the tables named "BasicFunction" and "BasicFunctionInput." On the left side are the tables named "MESFunction" and "MESFunctionParameter" to represent the name of the MES function and the necessary attributes of the total input and output parameters to realize this MES function, such as the "Direction" to differentiate the input (Direction = 1) and output (Direction = 0) parameters. The two tables in the middle, namely the "MESFunctionInstance" and "MESFunctionInstanceParameter," serve as bridges in the specification for the MES function model to indicate on one side, the affiliation between the basic functions and the MES functions and on the other side, the assignment of the input and output parameters of the MES functions to the input parameters of the basic functions. The information in the report model can be transformed using the four tables that are shown in Figure 6. The table "Report" contains the name and the type of report. As a report can contain several report elements to present the results of different MES functions, and each MES function needs different data sources from the plant model and/or process model, the tables "ReportElement" and "ReportInput" are defined. The table "ReportElementOutput" is responsible for establishing the link between the report elements and the MES functions. The information in the report model can be transformed using the four tables that are shown in Figure 6. The table "Report" contains the name and the type of report. As a report can contain several report elements to present the results of different MES functions, and each MES function needs different data sources from the plant model and/or process model, the tables "ReportElement" and "ReportInput" are defined. The table "ReportElementOutput" is responsible for establishing the link between the report elements and the MES functions.

Generating Phase
In this phase, based on the MES specification, MES with the demanded functions (without specific values for input parameters) is generated automatically with the help of a generator. The generator has two components, the front-end and the back-end. The front-end is a graphical user interface for the end-user to parameterize the inputs of the MES. The back-end, which realizes the data processing of the MES, can be divided into two parts, i.e., a toolbox and a connection finder.
The design of the graphical user interface is dynamically dependent on the MES specification. It contains two areas; input area and output area. In the input area, the input parameters are listed, and the values of input parameters are ready to be chosen and/or modified by the end-user. After the MES functions have processed the data according to the given values of input parameters, the results are assigned as the values of output parameters, shown in the output area (Figure 7).

Generating Phase
In this phase, based on the MES specification, MES with the demanded functions (without specific values for input parameters) is generated automatically with the help of a generator. The generator has two components, the front-end and the back-end. The front-end is a graphical user interface for the end-user to parameterize the inputs of the MES. The back-end, which realizes the data processing of the MES, can be divided into two parts, i.e., a toolbox and a connection finder.
The design of the graphical user interface is dynamically dependent on the MES specification. It contains two areas; input area and output area. In the input area, the input parameters are listed, and the values of input parameters are ready to be chosen and/or modified by the end-user. After the MES functions have processed the data according to the given values of input parameters, the results are assigned as the values of output parameters, shown in the output area (Figure 7).

Generating Phase
In this phase, based on the MES specification, MES with the demanded functions (without specific values for input parameters) is generated automatically with the help of a generator. The generator has two components, the front-end and the back-end. The front-end is a graphical user interface for the end-user to parameterize the inputs of the MES. The back-end, which realizes the data processing of the MES, can be divided into two parts, i.e., a toolbox and a connection finder.
The design of the graphical user interface is dynamically dependent on the MES specification. It contains two areas; input area and output area. In the input area, the input parameters are listed, and the values of input parameters are ready to be chosen and/or modified by the end-user. After the MES functions have processed the data according to the given values of input parameters, the results are assigned as the values of output parameters, shown in the output area (Figure 7). For the model-driven engineering of the software system that must be individualized, the MDA framework resembles the best practices: the first design of the business process is to be implemented and then processed with parameterization [50]. In this sense, the necessary MES functions are already implemented in the generating phase, while the specific sources of data (input parameters) that must proceed are not defined. This concept was proposed for the customization of ERP using a model-driven approach: there is no component to be generated or removed, but to be enabled/disabled. What needs to be generated is the constraints information for the parameterization to configure the system [50]. In the modeling and specification phases, no real function is implemented, but a description for the inputs and outputs of the functions, as well as the name of the basic functions and their connections with each other. The basic functions for data processing are defined in [59] and were firstly implemented as executable procedures in the toolbox. The connection finder that can invoke the basic functions from the toolbox is responsible for reproducing the sequence flow of basic functions to ensure the correct order of value passing among the basic functions ( Figure 8).
Electronics 2020, 11, x FOR PEER REVIEW 11 of 21 For the model-driven engineering of the software system that must be individualized, the MDA framework resembles the best practices: the first design of the business process is to be implemented and then processed with parameterization [50]. In this sense, the necessary MES functions are already implemented in the generating phase, while the specific sources of data (input parameters) that must proceed are not defined. This concept was proposed for the customization of ERP using a modeldriven approach: there is no component to be generated or removed, but to be enabled/disabled. What needs to be generated is the constraints information for the parameterization to configure the system [50]. In the modeling and specification phases, no real function is implemented, but a description for the inputs and outputs of the functions, as well as the name of the basic functions and their connections with each other. The basic functions for data processing are defined in [59] and were firstly implemented as executable procedures in the toolbox. The connection finder that can invoke the basic functions from the toolbox is responsible for reproducing the sequence flow of basic functions to ensure the correct order of value passing among the basic functions ( Figure 8).

Application Phase
In the application phase, according to real business processes, the demands on the MES and the inputs are parameterized by the end-user so that the desired specific MES can be created. Generally, the data processing can be divided into four steps. First, retrieving the needed basic functions from the toolbox; secondly, assigning the input parameters from the input area to the basic functions; thirdly, processing the input parameters using the modeled sequence of basic functions and fourthly, showing the results as parameters in the output area of the graphical user interface.

Use Case: Energy Management for the Beer Brewing Process
As mentioned in Section 2.1, the most demanded MES functions are the functions that can support the improvement of the production efficiency, tracking and tracing, and energy consumption [66]. Chen et al. [59] also defined the modeling elements to manage energy consumption and analyze production efficiency that is relevant to the food and beverage industry. Based on their results, to

Application Phase
In the application phase, according to real business processes, the demands on the MES and the inputs are parameterized by the end-user so that the desired specific MES can be created. Generally, the data processing can be divided into four steps. First, retrieving the needed basic functions from the toolbox; secondly, assigning the input parameters from the input area to the basic functions; thirdly, processing the input parameters using the modeled sequence of basic functions and fourthly, showing the results as parameters in the output area of the graphical user interface.

Use Case: Energy Management for the Beer Brewing Process
As mentioned in Section 2.1, the most demanded MES functions are the functions that can support the improvement of the production efficiency, tracking and tracing, and energy consumption [66].
Chen et al. [59] also defined the modeling elements to manage energy consumption and analyze production efficiency that is relevant to the food and beverage industry. Based on their results, to evaluate the feasibility of the presented approach and the achievement of the requirements defined in Section 3, the approach was applied to the traditional brewing process in a fictitious brewhouse. This brewhouse provides the basis of the technical systems and production process that the generated MES is built for, and data for processing. The brewing process was chosen as it is a representative production type (batch process) in the food and beverage industry. Figure 9 illustrates the traditional brewing process in the brewhouse.
Electronics 2020, 11, x FOR PEER REVIEW 12 of 21 evaluate the feasibility of the presented approach and the achievement of the requirements defined in Section 3, the approach was applied to the traditional brewing process in a fictitious brewhouse. This brewhouse provides the basis of the technical systems and production process that the generated MES is built for, and data for processing. The brewing process was chosen as it is a representative production type (batch process) in the food and beverage industry. Figure 9 illustrates the traditional brewing process in the brewhouse. In the brewhouse, to produce the wort for fermentation, malted barley, water, and hops are needed as raw materials. The malt and water are mixed and heated to specific temperature for extracting in the mash tun. The separation of the liquid phase (wort) from the grains is performed in the lauter tun. The wort kettle boils the wort together with hops for their sterilization and isomerization. Solid particles in wort, such as hops and proteins, are precipitated and separated at the bottom of the whirlpool. After that, the wort is cooled down and is ready for fermentation and storage in the fermentation room [67].

Analyzing the Demands and Actual State
As the brewhouse is the main energy consumer of the whole brewery, namely 38% of total energy consumption [68,69], and the energy used in a brewhouse can be divided into two primary units, thermal energy, and electrical energy, each for 10.2-11.4 kWh/hl (hectoliter) SB (sales beer) and 0.84-2.3 kWh/hl SB in average [70,71], the targeted MES should focus on the management of the thermal energy in this use case. The wort kettle and the mash tun are the consumers of the thermal energy in the brewhouse, taking the share of 77.1% and 22.9% [70]. According to the data above, the consumption data of the brewery with a designed annual beer production volume of 200,000 hl are shown in Table 1. The consumption data with the data point defined in WS (WS_Cons_Steam) were stored in a database for the period from 2019.01.01 00:00:00 to 2019.12.31 23:59:59.

Modeling the MES
The components in this use case were modeled in an editor that supports the extended MES-ML presented in [57,58]. The modeling elements that were defined in [59] were used. The production line in the brewery includes the mash tun, lauter tun, wort kettle, whirlpool, and heat exchanger. As mentioned above, the related data points for the energy data were assigned to the technical systems in the plant model. Figure 10 shows the model of the technical systems with a detailed view of the data point assigned to the mash tun. In the brewhouse, to produce the wort for fermentation, malted barley, water, and hops are needed as raw materials. The malt and water are mixed and heated to specific temperature for extracting in the mash tun. The separation of the liquid phase (wort) from the grains is performed in the lauter tun. The wort kettle boils the wort together with hops for their sterilization and isomerization. Solid particles in wort, such as hops and proteins, are precipitated and separated at the bottom of the whirlpool. After that, the wort is cooled down and is ready for fermentation and storage in the fermentation room [67].

Analyzing the Demands and Actual State
As the brewhouse is the main energy consumer of the whole brewery, namely 38% of total energy consumption [68,69], and the energy used in a brewhouse can be divided into two primary units, thermal energy, and electrical energy, each for 10.2-11.4 kWh/hl (hectoliter) SB (sales beer) and 0.84-2.3 kWh/hl SB in average [70,71], the targeted MES should focus on the management of the thermal energy in this use case. The wort kettle and the mash tun are the consumers of the thermal energy in the brewhouse, taking the share of 77.1% and 22.9% [70]. According to the data above, the consumption data of the brewery with a designed annual beer production volume of 200,000 hl are shown in Table 1. The consumption data with the data point defined in WS (WS_Cons_Steam) were stored in a database for the period from 1 January 2019 00:00:00 to 31 December 2019 23:59:59.

Modeling the MES
The components in this use case were modeled in an editor that supports the extended MES-ML presented in [57,58]. The modeling elements that were defined in [59] were used. The production line in the brewery includes the mash tun, lauter tun, wort kettle, whirlpool, and heat exchanger. As mentioned above, the related data points for the energy data were assigned to the technical systems in the plant model. Figure 10 shows the model of the technical systems with a detailed view of the data point assigned to the mash tun. The overall process of wort production in the brewery was described at the hierarchy level of process. This process was presented in greater detail at the process stage hierarchy level. Each element in the process stage was modeled with more details at the process operation hierarchy level. Figure 11 shows the resulted process model. In this use case, two MES functions were modeled: energy consumption of a specified machine in a given period of time, and the sum of the energy consumption of two machines in a given period of time. Figure 12 shows the model for the second MES function, which was made up of two basic functions named "EnergyConsumptionCalculation" to calculate the energy consumption of a machine in a given period of time, and "Sum(x_1, x_2)" to sum the two consumption values. For the automatic generation of the desired MES functions, these two basic functions should be implemented in the toolbox of the generator. The overall process of wort production in the brewery was described at the hierarchy level of process. This process was presented in greater detail at the process stage hierarchy level. Each element in the process stage was modeled with more details at the process operation hierarchy level. Figure 11 shows the resulted process model. The overall process of wort production in the brewery was described at the hierarchy level of process. This process was presented in greater detail at the process stage hierarchy level. Each element in the process stage was modeled with more details at the process operation hierarchy level. Figure 11 shows the resulted process model. In this use case, two MES functions were modeled: energy consumption of a specified machine in a given period of time, and the sum of the energy consumption of two machines in a given period of time. Figure 12 shows the model for the second MES function, which was made up of two basic functions named "EnergyConsumptionCalculation" to calculate the energy consumption of a machine in a given period of time, and "Sum(x_1, x_2)" to sum the two consumption values. For the automatic generation of the desired MES functions, these two basic functions should be implemented in the toolbox of the generator. In this use case, two MES functions were modeled: energy consumption of a specified machine in a given period of time, and the sum of the energy consumption of two machines in a given period of time. Figure 12 shows the model for the second MES function, which was made up of two basic functions named "EnergyConsumptionCalculation" to calculate the energy consumption of a machine in a given period of time, and "Sum(x_1, x_2)" to sum the two consumption values. For the automatic generation of the desired MES functions, these two basic functions should be implemented in the toolbox of the generator.  Figure 13 shows the related report element for the MES function "Energy Consumption of 2 Machines." The results of the MES function, namely the energy consumption of machine 1, the energy consumption of machine 2, and the total energy consumption, were considered as the outputs of the final report in text form.

Specifying the Information from the Graphical Model
After the components of the MES were modeled, they were transformed into the database tables of the specification by the mapping function of the editor used in Section 5.2. As an example, to clarify   Figure 13 shows the related report element for the MES function "Energy Consumption of 2 Machines." The results of the MES function, namely the energy consumption of machine 1, the energy consumption of machine 2, and the total energy consumption, were considered as the outputs of the final report in text form.

Specifying the Information from the Graphical Model
After the components of the MES were modeled, they were transformed into the database tables of the specification by the mapping function of the editor used in Section 5.2. As an example, to clarify Element in the report model related to the MES function for calculating the energy consumption.

Specifying the Information from the Graphical Model
After the components of the MES were modeled, they were transformed into the database tables of the specification by the mapping function of the editor used in Section 5.2. As an example, to clarify the data structure of the specification, Tables 2 and 3 present the specification for the used basic functions and the description of their input parameters in the database tables named "BasicFunction" and "BasicFunctionInput".  From the two tables we can reproduce the information. To compose the MES functions in this MES, two basic functions are needed, namely the "EnergyConsumptionCalculation" and "Sum(x_1, x_2)"; the first basic function ("Key" = 1 in Table 2) has three input parameters named "StartTime," "EndTime," and "EnergyDataPoint" ("BasicFunctionLink" = 1 in Table 3); the second basic function ("Key" = 2 in Table 2) has two input parameters named "x_1" and "x_2" ("BasicFunctionLink" = 2 in Table 3).

Generating the MES
Visual C# in Microsoft Visual Studio was chosen as the platform for the generator in this use case. For data processing, the implemented basic functions have access to the energy consumption database. Figure 14 presents the user interface of the generator at the beginning (left) and the report to be parameterized that was generated based on the specification (right). The input area contained text boxes to modify the values of input parameters. The output area was designed to indicate the energy consumption of each machine and their total consumption. To generate the user interface with input and output area, and to insert the parameters/components in each area, the information in tables named "MESFunction" and "MESFunctionParameter" should be utilized by the front-end of the generator.
Electronics 2020, 11, x FOR PEER REVIEW 15 of 21 the data structure of the specification, Table 2 and Table 3 present the specification for the used basic functions and the description of their input parameters in the database tables named "BasicFunction" and "BasicFunctionInput".  From the two tables we can reproduce the information. To compose the MES functions in this MES, two basic functions are needed, namely the "EnergyConsumptionCalculation" and "Sum(x_1, x_2)"; the first basic function ("Key" = 1 in Table 2) has three input parameters named "StartTime," "EndTime," and "EnergyDataPoint" ("BasicFunctionLink" = 1 in Table 3); the second basic function ("Key" = 2 in Table 2) has two input parameters named "x_1" and "x_2" ("BasicFunctionLink" = 2 in Table 3).

Generating the MES
Visual C# in Microsoft Visual Studio was chosen as the platform for the generator in this use case. For data processing, the implemented basic functions have access to the energy consumption database. Figure 14 presents the user interface of the generator at the beginning (left) and the report to be parameterized that was generated based on the specification (right). The input area contained text boxes to modify the values of input parameters. The output area was designed to indicate the energy consumption of each machine and their total consumption. To generate the user interface with input and output area, and to insert the parameters/components in each area, the information in tables named "MESFunction" and "MESFunctionParameter" should be utilized by the front-end of the generator.

Application of the MES
At the application phase, the input parameters were modified by the end-users according to their specific demands on the MES. As the mash tun and the wort kettle are the main thermal energy consumers, the input parameters of the generated MES were modified to calculate the thermal energy consumption of the two machines for a given period of time. Figure 15 illustrates the modified input area (left) and the results after data processing in the output area (right) pertaining to these two machines. The information in tables "BasicFunction", "BasicFunctionInput", "MESFunctionInstance", "MESFunctionParameter", and "MESFunctionInstanceParameter" was read by the back-end of the generator to invoke the procedures of the basic functions and pass the values between them.

Application of the MES
At the application phase, the input parameters were modified by the end-users according to their specific demands on the MES. As the mash tun and the wort kettle are the main thermal energy consumers, the input parameters of the generated MES were modified to calculate the thermal energy consumption of the two machines for a given period of time. Figure 15 illustrates the modified input area (left) and the results after data processing in the output area (right) pertaining to these two machines.
The information in tables "BasicFunction", "BasicFunctionInput", "MESFunctionInstance", "MESFunctionParameter", and "MESFunctionInstanceParameter" was read by the back-end of the generator to invoke the procedures of the basic functions and pass the values between them.

Evaluation
In this use case on the brewing process in a brewhouse, after the requirements were analyzed, the MES for the management of the energy consumption was modeled using the modeling language, the extended MES-ML. This graphical model was transformed automatically into a specification in a series of predefined database tables. The information in the original model was reproduced by the specification resulting in the basis that was utilized by the MES generator. On one hand, the generator created a user interface based on the plant model, process model, and report model to establish communication between the end-user and the software. On the other hand, the internal connections of the basic functions for data processing were created with the help of the toolbox and the connection finder of the generator. As the possible input parameters/data sources can be chosen in the user interface according to the real business process, the generated solution can be parameterized specifically. Results according to the specific requirements of the business process were shown in the output area of the user interface. The mash tun and wort kettle each respectively consume 0.07 kWh/s and 0.02 kWh/s of the thermal energy in the brewhouse, which in return theoretically causes the consumption of 2268 kWh and 648 kWh in nine hours. The results calculated by the generated MES were identical to the theoretically expected values.
Based on the use case described above, and according to the requirements defined at the beginning of this paper, the presented approach can be evaluated. The model-driven approach for the engineering of the MES that was presented in Section 4 has been proven feasible by this use case, which clarifies each phase in this approach and the transformation between them (R1). The MES with the function to manage the thermal energy consumption in the brewhouse has been generated in the use case. Though the energy management is a relevant MES function for the food and beverage industry, to evaluate if other relevant MES functions in the food and beverage industry can be generated with this approach, the continuous process and the discrete process should be considered

Evaluation
In this use case on the brewing process in a brewhouse, after the requirements were analyzed, the MES for the management of the energy consumption was modeled using the modeling language, the extended MES-ML. This graphical model was transformed automatically into a specification in a series of predefined database tables. The information in the original model was reproduced by the specification resulting in the basis that was utilized by the MES generator. On one hand, the generator created a user interface based on the plant model, process model, and report model to establish communication between the end-user and the software. On the other hand, the internal connections of the basic functions for data processing were created with the help of the toolbox and the connection finder of the generator. As the possible input parameters/data sources can be chosen in the user interface according to the real business process, the generated solution can be parameterized specifically. Results according to the specific requirements of the business process were shown in the output area of the user interface. The mash tun and wort kettle each respectively consume 0.07 kWh/s and 0.02 kWh/s of the thermal energy in the brewhouse, which in return theoretically causes the consumption of 2268 kWh and 648 kWh in nine hours. The results calculated by the generated MES were identical to the theoretically expected values.
Based on the use case described above, and according to the requirements defined at the beginning of this paper, the presented approach can be evaluated. The model-driven approach for the engineering of the MES that was presented in Section 4 has been proven feasible by this use case, which clarifies each phase in this approach and the transformation between them (R1). The MES with the function to manage the thermal energy consumption in the brewhouse has been generated in the use case. Though the energy management is a relevant MES function for the food and beverage industry, to evaluate if other relevant MES functions in the food and beverage industry can be generated with this approach, the continuous process and the discrete process should be considered on one hand, as the use case focused on the batch process and the requirements, although the MES functions can be the same, the data availability, source, and processing may vary with the process type; on the other hand, more modeling elements, basic functions, and MES functions should be defined, applied, and validated with this approach. Once the solution of the MES was finished to be modeled in the modeling phase, the transformations from a graphical model to a software readable specification and the generation of an MES can be made without any other manual programming effort (R2). The WS were integrated into this approach to ensure data consistency. This offers standardized data signals for a consistent communication between the machines and MES, and ensures machine-and process-independent modeling of the MES functions as well as standardized data processing. The WS are the information basis for the whole model-driven approach, also for the further horizontal and vertical communication in the future (R3). Additionally, we have tested different application scenarios with the presented approach. It was confirmed that the MES with functions, which can be composed of the basic functions that are already implemented in the toolbox of the MES generator, can be generated automatically. In this sense, further adaption and expansion of the generated MES can be performed in the modeling phase, which reduces the customization effort, as an adopted and/or extended MES can then be generated automatically again (R4). Although two prototypes of software tools were used in the use case, i.e., the editor with mapping function to assist the modeling process and perform the mapping process, and the generator to generate the user interface and process the energy data, it must be indicated that there can be different variants of technology to realize the functionality of the used software tools, as the metamodel of the modeling language, the mapping from model to specification, and the methodology of the MES generation have been clarified in detail in Section 4.

Conclusions and Outlook
This paper presented an approach for the automatic generation of MES according to the model-driven concept with low programming and customizing effort. The presented approach has filled the theoretical gap in the research area for integrating the model-driven concept for the development of the MES, and further for other IT systems in the manufacturing enterprises. With the focus of its application, it can benefit the manufacturers in the food and beverage industry with limited flexibility to invest in conventional MES projects. The use case with the automatic generation of the MES for thermal energy management in the brewhouse has proven the feasibility and practicability of the presented approach.
Although the requirements were evaluated as fulfilled by the presented approach, as the first rudiment for the model-driven MES engineering in the food and beverage industry, there are still some limitations: (i) the use case focused on the MES function for energy management based on historical acquired data, the functions that concern the "execution" side (real-time reaction) of the MES were not considered, which can also be relevant for the food and beverage industry, such as the detailed scheduling, process management, and product tracking; (ii) the approach has not been validated with real production data, which may deliver meaningful potential areas for the improvement of the presented approach; (iii) although the standardized information model has been applied for consistent data communication, the integration of the MES with shop floor control systems and management systems on the enterprise level has not been considered in the developed approach. From the viewpoint of the software development, the prototype of the generator should be expanded and tested regarding to the computational complexity.
In future work, libraries should be enriched with more modeling elements for different application domains in the food and beverage industry to verify the interoperability of the presented approach. Additionally, the range of the predefined basic functions must be extended so that more MES functions with different focuses can be modeled and generated. Furthermore, MES functions for the execution of the process, such as dispatching production, production tracking, and detailed scheduling, should be applied with real production data for a more convincing validation of the whole approach. It is also planned to define the interface and key data for the communication between the MES, the control systems, and the enterprise management systems.