## 5 Discussion  
This study implements the RAMI 4.0 framework to facilitate the transition from Industry 3.0 to Industry 4.0, highlighting the effectiveness of technologies such as fog computing and MES in real-time production management and resilience to connection failures. The results obtained, such as order response times and workload orchestration efficiency, demonstrate that the referential model is not only applicable in simulated or controlled environments but can be effectively adapted to real plants in SMEs with limited resources. Compared to previous studies, this research on Industry 4.0 shows a clear advantage in simplifying technology integration in the context of SMEs by applying the reference model framework to optimize scalability and flexibility. In the reviewed approaches, common limitations are observed, such as the high dependence on robust infrastructure, the complexity of implementation in small companies and the high cost of integration with advanced technologies. This study has demonstrated how the use of fog computing (FC) in combination with a hybrid multi-level MES enables efficient orchestration of real-time tasks, distributing workloads without the need for expensive infrastructure. The present implementation goes beyond the integration of MESs, as it also focuses on the optimization of communication and the resilience of the system to internet service failures, aspects often ignored in Industry 4.0 studies for SMEs. The integration of control devices (such as fog nodes) with applied AI for real-time image identification and segmentation is a distinctive contribution to this research. While previous studies were limited to proposing integration architectures, this work evaluates the orchestration of distributed workloads, prioritizing plant performance and thermal stability of processing nodes in the execution of CPU-intensive processes, as shown in Figure 7.  
While previous studies applied RAMI 4.0 mainly in proof-of-concept or simulated environments, this work implements the architecture in a real plant, providing performance data on CPU usage, connection times and MES-cloud communication. Studies by [34; 36] highlighted the lack of standardized methodologies and limitations in integration with existing systems, problems that this research addresses by coordinating between fog nodes and integrating legacy technologies. Performance in managing and orchestrating multi-level MES-FC processes in an industrial environment was also evaluated. Reconnection data between the MES and the cloud, with times of 1.5 to 1.7 s in case of outages, as well as stock update times (0.35 to 1.3 s), demonstrate an operational information flow in the face of connectivity failures. Comparatively, other studies, such as those by [35; 43], report difficulties in interoperability with legacy systems and challenges in real-time data updates between MES and slave fog nodes, problems that this implementation has solved through the use of MQTT and Node-RED. Furthermore, the approach was intended to convey the use of accessible tools, such as Node-RED and local databases, which ensure constant connectivity and monitoring capability, reducing latency and avoiding total dependence on the cloud. By employing technologies that maximize interoperability (e.g., MQTT and IoT communication protocols), the research improves the adaptability of manufacturing systems without sacrificing efficiency or significantly increasing operational costs, offering a more accessible and effective model for small industries transitioning to Industry 4.0. In other words, this study is nuanced in its ability to adapt to the specific context of SMEs, providing them with tools that drive flexible and scalable production in line with the RAMI 4.0 model, thus addressing several of the limitations observed in previous studies. The main contribution of this study is its applied approach, which shows how an SME can use the referential model to scale up to Industry 4.0 in a gradual, efficient and cost-effective way.