## 3 Materials and Methods
### Assessment of the Transformation from Industry 3.0 to 4.0 According to RAMI
#### 3.5.2 RAMI 4.0: Hierarchical Levels in Implementation  
The hierarchical levels of RAMI 4.0, ranging from 'Product' to 'Connection with the Outside World', were associated with the elements and structures of the implemented system:  
Product level: In the implementation, this level is reflected in the products manufactured and stored in station (D). The inventory management and the data of each product (position, status) are handled locally and in the cloud, allowing an automated stock management. Field device level: Using sensors, actuators, PLC 57-300 control devices and ESP32 multi-agents integrated in an IoT network, key signals from stations are captured in the plant. These data are transmitted to the MES to enable real-time production decisions. Control unit level: Represented by the MES and the FCS nodes, this level is crucial for the control and monitoring of operations. The MFC distributes tasks to the FCS nodes, which execute image processing algorithms and mathematical calculations, and then report the status to the MES. Dedicating a part of the Raspberry Pi 4 B processor to FC operations optimizes performance and avoids interference in the overall plant management. Station level: This includes the production stations (A, B, C, D and E) and the operations coordinated by the MES. For example, the quality control station uses computer vision algorithms for product inspection, which are managed and synchronized from the MFC. Work center level: The MES manages and coordinates production operations at the work center level, enabling overall supervision of the production process. Enterprise level: This level is materialized in the connection to the cloud, where the web services, the MQTT broker and the MySQL database are hosted. The MES receives and processes orders from this cloud, while Node-RED orchestrates the integration with the services. Thus, the company can monitor and control production operations, managing orders and stock remotely. Connected world level: Cloud services (MySQL, MQTT) and the IoT network connect the plant with external partners, facilitating real-time collaboration through network infrastructure and data sharing in the cloud. This level allows the plant to be connected to a global partner network, achieving real-time interoperability and collaboration, but without spanning the entire product lifecycle. By contextualizing the layers and levels of RAMI 4.0 in terms of the implemented project, it becomes evident how this work is structured and operates according to the principles of referential models, facilitating the interoperability, flexibility and advanced automation characteristics of Industry 4.0, because the work performed aligns with the reference model framework by integrating its layers of assets, integration, communication, information and functionality to form an advanced MES in Industry 4.0. To synthesize the information, a tabulation of the above contextualization was made to identify the penetration of implementation in the reference model, in areas where implementation is substantially met, partially covered and with minimal or limited implementation (see Table 2). Despite the coherence and integration of technologies based on RAMI 4.0 for this industrial transformation. The implementation performed focuses on real-time production and operation, leaving some layers and levels of the RAMI 4.0 model not fully addressed. The production and service function layers do not cover after-sales service management or additional product functions, as the focus of the project is operational. Likewise, the lifecycle and value stream layer is limited to the in-plant production phase, not including the design, development or recycling stages. Finally, the business layer is of limited use, as the focus of the project is on technical implementation rather than strategic alignment. Despite these omissions, it can be stated that the implementation follows the principles of RAMI4.0, and its structure was used as a basis for creating an advanced Industry 4.0 architecture.