# Discrete-Time Design of Dual Internal Model-Based Repetitive Control Systems
## 4 Proposed Dual Internal Model-Based RC (DIMRC)
### Stability of the Plug-In RC System  
In this subsection, we develop a sufficient stability condition for the closed-loop system regulated by plug-in DIMRC. The sensitivity function of the plug-in DIMRC system shown in Figure 2 is given by  
\[\frac{E(z)}{R(z)} =\frac{1}{1+\{1+C_{d}(z)\}C(z)P(z)} \tag{22}\] \[=\frac{1-\mathcal{S}_{d}(z)}{1+P(z)C(z)-[1+P(z)C(z)]\mathcal{S}_{ d}(z)+P(z)C(z)F(z)\mathcal{S}_{d}(z)}. \tag{23}\]  
Equation (23) can be factorized to  
\[\frac{E(z)}{R(z)}=\frac{1-\mathcal{S}_{d}(z)}{[1+P(z)C(z)]\Big{[}1-\mathcal{ S}_{d}(z)+\{\frac{P(z)C(z)}{1+P(z)C(z)}\}F(z)\mathcal{S}_{d}(z)\Big{]}} \tag{24}\]  
Let define the closed-loop plant model \(P_{c}(z)\) as follows:  
\[P_{c}(z)=\frac{P(z)C(z)}{1+P(z)C(z)}. \tag{25}\]  
The sensitivity function (24) can be further derived to  
\[\frac{E(z)}{R(z)}=\frac{1-\mathcal{S}_{d}(z)}{[1+P(z)C(z)][1-\{1-P_{c}(z)F(z) \}\mathcal{S}_{d}(z)]}. \tag{26}\]  
This leads to the following characteristic equation (CE):  
\[\text{CE:}\quad[1+P(z)C(z)][1-\{1-P_{c}(z)F(z)\}\mathcal{S}_{d}(z)]=0. \tag{27}\]  
Based on (27), the closed-loop DIMRC system in Figure 2 is internally stable if the following two conditions are fulfilled:  
1. The first factor \([1+P(z)C(z)]\) in (27) has stable roots. This also implies that the closed-loop plant model \(P_{c}(z)\) in (25) is a stable transfer function.
2. The second factor \([1-\{1-P_{c}(z)F(z)\}\mathcal{S}_{d}(z)]\) in (27) has stable roots. Following the work in [13], the stability of the second part can be assured by \[\left\|\{1-P_{c}(z)F(z)\}\mathcal{S}_{d}(z)\right\|_{\infty}\leq\left\|1-P_{c }(z)F(z)\right\|_{\infty}\left\|\mathcal{S}_{d}(z)\right\|_{\infty}<1.\] (28) Here, the notation \(\left\|\mathcal{T}_{f}(z)\right\|_{\infty}\) corresponds to the \(H_{\infty}\)-norm infinity of the transfer function \(\mathcal{T}_{f}(z)\), which can be defined as the peak of the magnitude response of \(\mathcal{T}_{f}(z)\) for all frequency components.  
Based on Assumption 1 and picking the conventional controller \(C(z)\), \(P_{c}(z)\) can be computed. Meanwhile, \(\mathcal{S}_{d}(z)\) can be calculated by using Assumption 2, and by choosing the q-filters \(q_{r}(z)\) and \(q_{r}(z)\). Finally, the stabilizing controller \(F(z)\) can be designed to satisfy the condition (28). It has been mentioned before that several works addressing stabilizing controller design methods can be found in [26; 27; 28; 29; 30; 31]. Here, we omit the discussion about the stabilizing controller design as we focus on the internal model structure, the controller structure and realization, and the stability of the plug-in DIMRC system.  
To summarize, the proposed design is accomplished according to the following steps:  
1. Obtain the open-loop plant model \(P(z)\) (2).
2. Pick the conventional controller \(C(z)\), ensuring a stable \(P_{c}(z)\) (25).
3. Obtain the reference frequency \(f_{r}\) and disturbance frequency \(f_{v}\) to calculate the integer numbers \(N_{r}\) (5) and \(N_{v}\) (10).
4. Pick the q-filters \(q_{r}(z)\) and \(q_{v}(z)\) according to (6) and (7).
5. Choose the order of HOMRC \(m\), and determine the weights based on (12) and (13).  
Construct the \(\mathcal{S}_{d}(z)\) by using (21).
* Determine the stabilizing controller \(\Gamma(z)\) satisfying (28).
* Synthesize the complete controller according to (17).
* Realize the controller based on Figure 3 for causal \(F(z)\), and Figure 5 for non-causal \(F(z)\).