## 4 Description of the Approach
### Integration of Preventive and Reactive Measures in the Production Schedule
Thus, the optimization problem consists of an energy-optimal production schedule as input that can be generated using different approaches, e.g., those described in Section 2.1. In addition, the measures of the chosen risk treatment path need to be scheduled to create the risk-treated production plans. In order to meet the logistical goals and to avoid delays, the end times of the jobs scheduled in the energy-oriented PPC are fixed and block the workstations for the scheduling of measures in these time periods. Usually, when creating an energy-oriented production plan, a cost-optimal result is sought after the variable price forecasts. The electricity demand planned and procured in this way should be consumed within tolerances in order to avoid high penalties. As part of the risk treatment, price fluctuations in the markets are no longer of central importance, as the plan is already generated, but the time-dependent penalties for deviations from the originally purchased electricity consumption have to be focused on now. Thus, the objective function of the optimization problem minimizes the quantity deviation cost (QDC) \(QDC_{t}\) for each time unit \(t\) that arises from a deviation of the actual energy consumption from the forecasted load profile \(\Delta powv_{t}\). The QDC is substituted by the forecast for reBAP, which stands for \"regelzoneniber-greifender einheitlicher Bilanavaspliehesmergiew\" and assigns a uniform price to the balancing energy that was necessary in the past. The reBAP is calculated in retrospect for every quarter-hour of a day. If no suitable forecasts are available for the reBAP, intra-day market forecasts can also be used, as the amount gives an impression of the energy availability and the demand and thus the level of the penalty costs caused by deviations. The objective of the optimization is to minimize the QDC, which arises due to the deviations from the planned load profile. This is shown in the target function with the deviation \(\Delta powv_{t}\) and the \(QDC_{t}\) at the respective point in time \(t\). \[\textit{Mintize}\ \sum_{t\in T}(\Delta powv_{t}\cdot QDC_{t}) \tag{17}\]  
To ensure logistic targets are met, a job must start early enough to not miss any due dates:  
\[start_{ks}\leq end_{ks}-duration_{ks},\ \forall i\in I,\ k\in K\, \tag{18}\]  
where \(start_{ks}\) describes the start time of job k on working station \(s\) and \(end_{ks}\) the due date of the job \(k\) on station \(s\). The duration of job \(k\) on station \(s\) is described by \(duration_{ks}\). To calculate the actual energy consumption \(cons_{t}\), the binary \(x_{kit}\), that is, one if job k is allocated to workstation \(s\) in time unit t and zero otherwise, is multiplied by the workstation and job-specific power consumption \(Power_{ks}\):  
\[cons_{t}=\sum_{i=1}^{m}\sum_{k=1}^{l}Power_{ks}\cdot x_{kst},\ \forall t\in T \tag{19}\]  
Additionally, it must be ensured that the measure integration does not lead to the peak loads being exceeded; thus, the total consumption \(cons_{t}\) must be smaller than the maximum allowed peak load \(Peak_{max}\) for every time unit  
\[cons_{t}\ \leq\ Peak_{max},\ \forall\ t\in T. \tag{20}\]  
Finally, the deviation in energy consumption is calculated as the total consumption minus the planned consumption \(Power_{t}^{planned}\). \[\Delta powv_{t}=cons_{t}-Power_{t}^{planned},\ \forall t\in T \tag{21}\]  
The optimization is performed twice--once to generate the modified production schedule and once to generate the backup plan. Figure 5 depicts schematically how the optimization improves the handling of disruptions. In the above production schedule without prior risk treatment, a disruption leads to a spontaneous decision to post-process. This leads to the annual maximum load being exceeded, as shown in the adjacent diagram of the load profile. With the risk treatment shown in the lower area of Figure 5, the possible disruption is considered in advance with a backup plan, containing reactive measures for the case of the occurrence of the fault.