# Artificial Intelligence-Based Controller for DC-DC Flyback Converter
## 2 Modeling of Flyback Converter
The energy stored in the magnetizing inductance \(L_{M}\) is transferred to the load and output capacitor. The state conditions for Mode 2 are:  
\[\frac{dl_{LM}}{dt}=-\frac{n^{2}I_{LM}RR_{C}}{L_{M}(R+R_{C})}-\frac{nRV_{C}}{L_ {M}(R+R_{C})}-\frac{nV_{D}}{L_{M}} \tag{10}\]  
\[\frac{dV_{C}}{dt}=\frac{nI_{LM}R}{C(R+R_{C})}-\frac{V_{C}}{C(R+R_{C})} \tag{11}\]  
\[V_{O}=\frac{nRR_{C}}{R+R_{C}}I_{LM}+\frac{R}{R+R_{C}}V_{C} \tag{12}\]\[I_{S}=0 \tag{13}\]  
where \(n\) is the turn ratio of the transformer. Thus, the state-space representation for Mode 2 is as follows:  
\[\left[ \begin{array}{c}\frac{dI_{LM}}{d!}\\ \frac{d!}{d!}\\ \frac{dR}{d!}\end{array} \right]=\left[ \begin{array}{cc}-\frac{n^{2}RR_{C}}{L_ {M}+R_{C}}&-\frac{nR}{L_{M}(R+R_{C})}\\ \frac{nR}{C(R+R_{C})}&-\frac{n}{C(R+R_{C})}\end{array} \right]\left[ \begin{array} []{c}I_{LM}\\ V_{C}\end{array} \right]+\left[ \begin{array}{cc}0&-\frac{n}{L_{M}}\\ 0&0\end{array} \right]\left[ \begin{array}{c}E\\ V_{D}\end{array} \right] \tag{14}\]  
\[\left[ \begin{array}{c}I_{S}\\ V_{O}\end{array} \right]=\left[ \begin{array}{cc}0&0\\ \frac{nRR_{C}}{R+R_{C}}&\frac{R}{R+R_{C}}\end{array} \right]\left[ \begin{array} []{c}I_{LM}\\ V_{C}\end{array} \right]+\left[ \begin{array}{cc}0&0\\ 0&0\end{array} \right]\left[ \begin{array}{c}E\\ V_{D}\end{array} \right] \tag{15}\]  
Now, the state-space averaged model for CCM can be written as [5]:  
\[\left[ \begin{array}{c}\frac{dI_{LM}}{d!}\\ \frac{d!}{d!}\\ \frac{d!}{d!}\\ \end{array} \right]=\left[ \begin{array}{cc}-\frac{R_{C}}{L_{M}}S_{1}-\frac{n^ {2}RR_{C}}{L_{M}(R+R_{C})}S_{2}&-\frac{nR}{L_{M}(R+R_{C})}S_{2}\\ \frac{nR}{C(R+R_{C})}S_{2}&-\frac{n}{C(R+R_{C})}\end{array} \right]\left[ \begin{array}{c}I_{LM}\\ V_{C}\end{array} \right] \tag{16}\]  
\[\left[ \begin{array}{c}I_{S}\\ V_{O}\end{array} \right]=\left[ \begin{array}{cc}0&0\\ \frac{nRR_{C}}{R+R_{C}}S_{2}&\frac{R}{R+R_{C}}\end{array} \right]\left[ \begin{array} []{c}I_{LM}\\ V_{C}\end{array} \right] \tag{17}\]  
Leading towards the derivation of the transfer function, the small-signal model was employed to approximate the behavior of the FC model. In the state-space model (SSM), state variables and control input are comprised of DC and AC quantities. Capital subscripts represent DC steady-state values, and small subscripts represent AC perturbations. \[i_{LM}=I_{LM}+i_{lm} \tag{18}\]  
\[v_{O}=V_{O}+v_{o} \tag{19}\]  
\[D=\Delta+d \tag{20}\]  
Inserting the above quantities into the state-space averaged model (SSAM) and hence taking Laplace transforms results in the voltage transfer function expressed in Equation (21). \[H_{v_{o}}(s)=\frac{v_{o}}{d}=\frac{\left(-\frac{EL_{M}\Delta}{n(1-\Delta)^{2}} s+ER\right)}{(L_{M}RC)s^{2}+\left(L_{M}\right)s+\left(Rn^{2}(1-\Delta)^{2}\right)} \tag{21}\]  
The negative sign in the numerator with the term's' indicates that it is a non-minimum phase system, i.e., it has a right half plane zero (RHPZ). **3. Design of FC with Specifications**  
Let us consider the efficiency of FC to be 90%. \[E_{LM}=\frac{1}{2}L_{M}\Big{(}I_{LM_{\max}}-I_{LM_{\min}}\Big{)}^{2} \tag{22}\]  
\[P_{out}=\frac{1}{2}L_{M}\Big{(}I_{LM_{\max}}-I_{LM_{\min}}\Big{)}^{2}\times f_ {S}\times\eta \tag{23}\]  
For a 90% efficiency, \(\eta=0.9\). \[\eta=\frac{P_{out}}{P_{in}}\text{ and }P_{in}=\frac{P_{out}}{0.9}=1.11P_{out} \tag{24}\]\[P_{out}=\frac{{V_{O}}^{2}}{R} \tag{25}\]  
Substituting Equation (25) into Equation (24) gives Equation (26). \[P_{in}=1.11\times\frac{{V_{O}}^{2}}{R}=\frac{\frac{1}{2}{L_{M}}{\left({I_{LM_{ \text{max}}}-I_{LM_{\text{min}}}}\right)}^{2}}{T_{S}} \tag{26}\]  
where \(\eta\) is the practical efficiency of the design, \(I_{LM_{\text{max}}}\) and \(I_{LM_{\text{min}}}\) are the maximum and minimum magnitudes of current \(I_{LM}\), respectively, and \(T_{S}\) is the reciprocal of \(f_{S}\).