## 2 Materials and Methods
### Platform  
This work proposes an architecture to implement a customizable cloud-based platform that can be used in different complex manufacturing environments, such as the one shown in Figure 6, and be instantiated in different cloud providers. The platform should be capable of interoperating different tools at different complexity levels and should be divided into two big groups of functionalities, one group that runs on the local shop floor and another intended to be running at the cloud level (Figure 7). **Shop-floor level:** Within the factory, an integration layer will be deployed capable of connecting all the hardware (sensors, machines, stations, etc.) and existing software tools (MES, SCADA, etc.) with new tools capable of dealing with new functionalities and the integration with the cloud level. **Cloud level:** The cloud level of the platform is responsible for receiving and storing all the data from the different actors of the system (factories, suppliers, transporters, customers, products, etc.) and allowing the integration of software tools, enabling macro-level optimization, such as the energy footprint of products, resource allocation, etc. This platform aims to represent vertical integration and horizontal integration. As a requirement for this, the architecture for this platform should include middleware inside each factory that is responsible for vertical integration, enables the integration of any type of software tool (MES, data analytics, simulation, etc. ), and uses the defined standard interfaces. The data generated by one tool should be available to be consulted by any other tool, with these tools being present at the launch of the system or added afterward. For instance, a new scheduling optimizer tool could be coupled with a traditional scheduling tool but with the ability to read the maintenance logs from a machine, use it as a Key Performance Indicator (KPI), and allocate resources based on the maintenance prediction  
Figure 7: Platform example that enumerates some of the potential stakeholders with a focus on middleware between local (EDGE or FOG) and cloud. for that specific machine. Even if not present at launch, this new tool should be able to be deployed and connected without any intervention on the platform. The middleware should also be responsible for storing the current system state and keeping it available to the cloud tools if they require it on a publish/subscribe basis. The cloud level of this platform will be responsible for connecting different factory middleware systems and other actors within the value chain. This service-oriented approach allows easy, scalable, and adaptable solutions that can be easily customized and deployed across different cloud providers. The security of the information flowing on the platform should be performed through a secure mechanism such as blockchain technology. An added mechanism for tracking and tracing the flow of information should also be available. This platform is designed to be applied to micro-factories, to tackle the challenges mentioned before by I4.0. In the beginning, most of the micro-factories focused on downscaling manufacturing systems to produce micro-products [26]. However, the concept of micro-factories refers to a reconfigurable and modular green manufacturing system that consists of compact and highly mobile facilities with small dimensions and high precision to respond to flexibility requirements [26; 27; 28]. Because of the small scale and flexibility in the mechanical structure, micro-factories can provide many benefits and increase the effectiveness of the manufacturing industry. With this kind of platform, and the accessibility of the information, it is possible to apply dynamic pricing of the products, by sharing the micro-factories' net workload and precisely tracking the carbon footprint for each item used as raw materials for supplying the micro-factories. Regarding the supply chain, this platform opens the door for a circular economy where suppliers that recycle materials can be chosen as priorities.