# Application of Modeling and Simulation in a Self-Reprogrammable Prototype of a Manufacturing System
## 4 Project Architecture  
Manufacturing systems based on Industry 4.0 concepts must be able to receive information from the sensors and mechanisms. These sensors identify actions such as processing time, failures, setups, and equipment availability, in real time. The collected data are used as input for digital tools, such as Discrete Event Simulation and DT, supporting decision making.  
Autonomous decision-making based on simulation requires that the simulation model and the production system be connected by software and devices responsible for managing production data. Figure 1 shows these connections.  
Figure 1 shows the tools used in the integration between the real and virtual systems. Each of them has specific functions, and they are discussed below:  
* Management System: It provides production sequencing. In addition, it defines manufacturing priorities for both the physical and the simulation model;
* Production system: It is a set of resources available for manufacturing products, such as workers and equipment;
* Operational data collection software: This group has Software MES (Syneco V. 2.5.15), Radio Frequency Identification (RFID), sensors, and other devices used to collect operational data from the production system, such as: operating time, failures, equipment availability, human resources availability, among others. This set of software and sensors is responsible for providing real-time data to the simulation model to keep it updated, and works in parallel with the production system;
* Virtual system: The virtual system is based on a simulation model operating in parallel with the real manufacturing system, embodying the concept of a DT. However, to enable production rescheduling after diagnosing a failure, the simulation model must meet the following requirements:
* Data input block: The simulation model requires input of management and operational data that directly influences its performance. This data is provided through the data input block, which maintains a constant connection with the data collection system. For example, if the operating time of a workstation differs from the parameters currently set in the simulation model, this updated operating time must be incorporated into the model to maintain accuracy;
* Trigger: The trigger represents a programming logic designed to detect failures in the production system and initiate the optimization process. For instance, consider a production system comprising four machines, designed to produce a specific family of products, and operating under a predefined production sequence. If one of the machines experiences a failure and becomes unavailable for a certain period, the production sequence must be recalculated. Simultaneously, information about the machine's  
Figure 1: Project integration through simulation and physical system.  
unavailability is sent to the simulation model, which receives a command to determine an optimal sequencing strategy based on the updated manufacturing conditions;
* Optimization: Following the failure signal generated by the trigger, the simulation model initiates the optimization process based on pre-established programming logic. For example, optimization could involve creating a revised production sequencing using Genetic Algorithms. This approach enables the system to account for real-time constraints and propose the most efficient course of action;
* Results: Once the optimization tool identifies the necessary corrective actions, the corresponding data is transmitted to the production management system. This ensures that the manufacturing system activities are updated to reflect the new plan. For example, a revised production sequence could be implemented to minimize production losses caused by the failure.