# JIT Production Strategy and Maintenance for Quality Deteriorating Systems
## 4 Simulation-Optimization Approach
### Simulation Model  
A combined discrete-continuous simulation model was developed and executed through the Arena simulation software, as presented in the diagram of Figure 1. The simulation model seeks to reproduce the material flow and the logic associated with the integrated production and major maintenance policy, as presented previously in Section 3. In particular, the inputs of the simulation model are defined by the control parameters \((Z_{p},B_{JIT},A_{0})\), and furthermore, the differential equations (1) and (2) are integrated continuously using the Runge-Kutta-Fehlberg method. The discrete parts of the simulation model reproduce the stochastic duration of minimal repairs and major maintenance. Regarding the continuous parts, the simulation model is complemented with a C++ subroutine that serves to instantly update the rate of defectives \(\beta(\cdot)\), using Equation (4) and the age of the machine \(a(\cdot)\). The C++ subroutine also determines the inventory \(x^{+}\) and backlog level \(x^{-}\). Both discrete and continuous parts of the model work in synchrony to reproduce the interactions and stochastic behavior of the production system. The production and major maintenance policies are performed according to the logic defined in Equations (8)-(10), and so, detection mechanisms are implemented in the simulation model to properly adjust the control rates. At the end of the simulation run, the model provides indicators to calculate the average inventory-holding and backlog cost \(IB(t)\), the quality cost \(QC(t)\), and the maintenance cost \(MC(t)\) using Equations (11)-(13), respectively. ### Simulation Model  
In order to ensure the accuracy of the simulation model, we conducted a validation analysis, where we traced a set of key indicators representative of the system behavior. In Figure 2, we present a simulation sample of the dynamics of the production system over a period of time where the control parameters were set to \(Z_{p}=20\), \(B_{IIT}=100\), and \(A_{0}=280\). From observing Figure 2, we note that at time \(t=0\), the production unit is in brand-new conditions and so there is no need to maintain safety stock, thus \(Z_{p}=0\) (see arrow 1 in Figure 2g). After that, we note the occurrence of several random failures, as in time \(t=90\), where we see the reduction of the stock level when the unit fails (see arrow 2 in Figure 2g). Failures are identified in Figure 2c, as marked by arrow 3. Then, at time \(t=160\), the unit reaches the critical age \(B_{IIT}=100\), which indicates the change of the production policy, triggering the increase of the stock level from \(Z_{p}=0\) to \(Z_{p}=20\) (see arrow 4 in Figure 2e). At this point (\(t=160\)), the stock level will progressively increase until its optimal threshold value \(Z_{p}=20\) (see arrow 5 in Figure 2g). The change of the production threshold indicates that given the accumulated effects of deterioration on the machine, mainly observed in the increase of the rate of defectives, safety stock is needed to ensure demand satisfaction with flawless parts. As the machine continues its deterioration pattern, we note that at time \(t=240\), the unit operates at rate \(d/(1-\beta(a))\) (see arrow 6 in Figure 2d) to compensate for the increase in the rate of defectives, since its level of deterioration is considerably high, as indicated by arrow 7 in Figure 2b. Then at time \(t=400\), the unit reaches the critical age \(A_{0}=280\) that triggers a major maintenance (see arrow 8 in Figure 2f). Before the conduction of such major maintenance, the production unit reaches its maximum level of deterioration, as noted by arrow 9 in Figure 2a. Additionally, we observe from arrow 10 in Figure 2g that the stock level decreases considerably, since the conduction of a major maintenance requires more time than a minimal repair. Furthermore, after the conduction of a major maintenance, we observe a considerable reduction in the rate of defectives, as shown by arrow 11 in Figure 2a.