## 3 The Self-Tuning Algorithm of Control Penalty Factor  
Based on the above presented considerations, the self-tuning algorithm of the control penalty factor (\(\rho\)) considers two possible switching values \(\rho_{0}\) and \(\rho_{1}\). The question that needs to be answered is: what are the conditions to switch \(\rho\) from one value to another? Thus, two switching conditions are required to be set:  
The condition for switching from the low value \(\rho_{0}\) to the high value \(\rho_{1}\);  
The return condition, for switching from the high value \(\rho_{1}\) to the low value \(\rho_{0}\). Also, related to these two possible values of \(\rho\), another question that requires an answer is: which of the two values of \(\rho\) is chosen as a fixed value for the steady-state regime (undisturbed regime)? The answer is the lower value \(\rho_{0}\), which provides the best performance for small disturbances, while stabilizing the control system. Thus, the switch to the high value \(\rho_{1}\) triggers only when a major disturbance occurs. Starting with the assumption that the disturbance is not measurable, the only variable indicating their random action is the controlled output error. In other words, the activation of this switching mechanism is triggered based on the output error value. Obviously, a high error indicates a stronger disturbance and a lower error indicates a weaker disturbance. In this last case, a low value of \(\rho\) (\(\rho_{0}\)) can provide both stabilization and good performance of the control system. If the output error exceeds a certain set threshold, the system stabilization requires a higher value of \(\rho\) (\(\rho_{1}\)), in order to strongly penalize the excessive control. However, by keeping this high value (\(\rho_{1}\)) set a too long time period can excessively penalize the control, which becomes too weak to ensure the control system stability [16; 17]. Therefore, both a too long-time strong control and a too weak control can destabilize the control system if it is severely disturbed. The compromise solution is to set a small constant value for \(\rho\) (\(\rho_{0}\)) in steady-state regime, respectively, when the error exceeds a certain threshold, to switch to a high value (\(\rho_{1}\)) for a limited time period. This limited time period should last until the output error drops below another certain set threshold, thus avoiding the destabilization of the control system. Obviously, it becomes imperative to find and set these switching thresholds of the control penalty factor between these two imposed values (\(\rho_{0}\), \(\rho_{1}\)). A viable solution requires a sudden (sharp) change of \(\rho\) to the maximum level \(\rho=0.1\) (at the critical time moment when a high disturbance occurs) for an efficient control penalty and, implicitly, for a control system stabilization. A logic algorithm based on a sharp hysteresis loop (with two switching levels) can implement such a tuning strategy (see Figure 1). Such a simple and efficient algorithm requires finding the appropriate level values \(\rho_{0}\) and \(\rho_{1}\) and, obviously, the error thresholds \(e1\) and \(e2\) where the control penalty factor (\(\rho\)) switches between these two levels (\(\rho_{0}\), \(\rho_{1}\)). One of the goals of the case studies presented below is to find these proper parameters values (levels \(\rho_{0}\)/ \(\rho_{1}\); thresholds \(e1\)/\(e2\)--see Figure 1) in order to implement, test and validate the proposed control strategy, integrating a tuning algorithm based on a sharp hysteresis loop. Taking into consideration such proposed real-time self-tuning mechanism of the control penalty factor, the general structure of the minimum variance control system is presented in Figure 2. It can be seen in this figure that the controlled output error (terminal voltage error) is the input of the hysteresis block, which is the core of the proposed self-tuning algorithm.