# Enhancing Production Efficiency Through Digital Twin Simulation Scheduling
## 2 Materials and Methods
\[f_{\rm s}=\sum_{s=0}^{\rm s}S_{SPK}\;\times\;k_{SPK}-S_{NPK}\;\times\;k_{NPK}+S_{ OK}\;\times\;k_{OK}-S_{NOK}\;\times\;k_{NOK}-S_{PS}\;\times\;k_{PS}-S_{TD}\; \times\;k_{TD}-S_{CV}\;\times\;k_{CV} \tag{4}\]  
where  
\(f_{\rm s}\)--the sanction assigned to the given schedule based on non-compliance with the required indicators;  
\(S_{SPK}\)--the fulfilment of the required number of pieces of the given order;  
\(k_{SPK}\)--the coefficient when the required number of pieces of a given order is fulfilled [EUR];  
\(S_{NPK}\)--the failure to fulfil the required number of pieces of the given order;  
\(k_{NPK}\)--the coefficient of the failure to obtain the required quantity of pieces of the given order [EUR];  
\(S_{OK}\)--a product with the required quality;  
\(k_{OK}\)--the coefficient assigned to the product with the required quality [EUR];  
\(S_{NOK}\)--a product with undesirable quality;  
\(k_{NOK}\)--the coefficient assigned to a product with undesirable quality [EUR];  
\(S_{PS}\)--the number of performed alignments of the production equipment;  
\(k_{PS}\)--the coefficient assigned to the performed alignments of the production equipment [EUR];  
\(S_{TD}\)--the number of orders completed by the completion date;  
\(k_{TD}\)--the coefficient assigned to the orders completed by the completion date [EUR];  
\(S_{V}\)--the mean lifetime of a given order;  
\(k_{V}\)--the coefficient assigned according to the running time of the given order [EUR]. To connect the simulation module to other parts of the system, we suggest using one of the following available methods or a combination of them:  
* Dynamic data exchange (DDE);
* ActiveX;
* ODBC;
* SQLite. To simplify the control of the entire scheduling system, a communication and control interface is used, namely the so-called \"FRONTEND\" application, which is a connecting element between the real production system, the database, and the simulation model. The application itself is the platform where the user comes into direct contact with the scheduling system and manages it. This means that the process of data analysis and the simulation itself take place in the background, and the user is only concerned with setting the initial parameters. All links between the individual parts of the system are shown in Figure 4. The content of the communication and control application is as follows:  
* The control menu;
* A 3D view of the current state of the production system;
* Insights into the level of fulfilment of production requirements;
* A key performance indicator (KPI) monitor;
* An alarm system--a key element that determines the need for a new schedule;
* Remote control elements of the simulation model. The proposed digital twin architecture has a modular nature, which allows its generalizability and portability to various production environments, especially to custom production with high product variability. The modularity of the system ensures that individual modules (e.g., data, simulation, prioritization, or communication) can be adapted to the specific requirements of other companies by simply adjusting the parameters and configuring the sensors or integration protocols used. However, its portability may be limited by the availability and accuracy of sensor technologies in other production environments. In the case of moving the system to other industries, it may be necessary to adjust the configuration of the RTLS devices, adjust specific parameters of the prioritization rules, or verify the compatibility of the data interfaces with existing systems in the new environment. In order to ensure better reproducibility, the integration of the modules and control mechanisms is described in more detail as follows. Each module communicates via clearly defined data interfaces, while standardized ODBC protocols are used, which allow direct integration with commonly available database systems (e.g., MySQL). The connection between the modules is implemented via a central server, which serves as the control node of the entire system.