## 2 Proposed Smart Factory Methods and Methodology
### Manufacturing Execution System Component  
To meet the requirements of HMLV production, an MES needs to provide integration functions that enable it to adapt the production quickly and improve the production output. Figure 5: Example of modeling for a collaborative assembly task. One pool named “assembly” is used to contain all the steps concerning the process. Afterwards, two lanes, “ROBOT” (in green) and “operator” (in pink), are used to depict the actions that each actor should perform for the collaborative task. Finally, passive resources complementary to the actions (in orange) are connected to the different actions. This representation allows one to identify all resources (robot, operator, transmission gear, gripper, and motor holder) involved in a unique process (assembly). Moreover, the unfolding of the different actions is clearly assigned to each actor (e.g., the operator needs to perform reach, grasp, and clip). In this case, an MES for dealing with production changes in the context of a collaborative application was created. The MES had to integrate its capabilities to receive a **process definition** in the form of a BPMN file, process the BPMN file to extract the necessary resources involved in the process, query the available resources, and insert a production order as a **process** once the available resources had been mapped to the **process**. Hence, through these steps, the MES acts as a system and parametrizes the received BPMN to make it executable. To satisfy these requirements, the internal architecture of the MES is based on a database, following the specifications of the top-level logical data architecture within SHOP4 CF [32]. This top-level logical data architecture is visualized in Figure 6.  
Using this architecture, the MES parses a BPMN file and create database entities, which reflect the BPMN content. This is achieved by creating entities in the MES database that are mapped to the BPMN artifacts. For sake of clarity, an example based on the BPMN process (as shown in Figure 5) is given here. Starting from the top level, initially, the assembly pool was mapped to the MES as a **process definition**, considering that it represents an entire process. Secondly, the different activities both for the robot and the operator were mapped to several entities of the **task definition**, representing all the activities that the **process definition** contains. To highlight this relationship, each **task definition** was assigned to a **process definition** in the MES database. Finally, the different resources (operator, robot, gripper, transmission gear, and motor holder) were mapped into the MES database with the **resource specification** entity. Due to the connection of the activities to the different resources, this cardinality was maintained by linking the **resource specification** entities with the **task definition** entities. Through this mapping, it was possible to represent the BPMN content in a structured format. After parsing the information, the MES then leaves to a user the possibility of initiating a production order based on a **process definition**. To do so, the MES must first collect the available **resources** by querying all the entities marked as \"available\" in the database, and then display the ones matching the types defined in the **resource specifications**. Through this procedure, the user could then specify which resources to assign for the order according to capabilities (e.g., [PERSON] operator, UR 10 robot, [PERSON] two-finger jaw gripper) and then finally send the order for clearance through the risk analysis component. This is possible through the interaction of the MES and the RA via the FIWARE context broker, as shown by the sequence diagram in Figure 7.  
Figure 6: Top-level logical data architecture used in SHOP4 CF [32]. The notation used is based on the UML and defines the cardinality between the different data models. This architecture is used to structure the MES database.