# Using Python for the Simulation of a Closed-Loop PI Controller for a Buck Converter
## 2 Simulation of the Open-Loop Operation
### Open-Loop Simulation
\begin{split}\langle\mathrm{i}_{\mathrm{L}}\rangle=\frac{ \mathrm{V}_{\mathrm{O}}}{\mathrm{R}}=\frac{\Delta\mathrm{i}_{\mathrm{L} \mathrm{O}}}{2}=\frac{\mathrm{V}_{\mathrm{in}}-\mathrm{V}_{\mathrm{O}}}{2 \times\mathrm{L}_{\mathrm{critical}}\times\mathrm{f}}\times\mathrm{D}\\ \Rightarrow\mathrm{L}_{\mathrm{critical}}=\frac{1-\mathrm{D}}{2 \times\mathrm{f}}\times\mathrm{R}\end{split}  \tag{10}\]  
In DCM, the relationship obtained in Equation (7) no longer holds, which makes the control system more complex. If the converter operates in CCM, as the circuit under analysis, it is usual to specify a limit to the ripple value of \(\mathrm{i}_{\mathrm{L}}\) (\(\Delta\mathrm{i}_{\mathrm{Max}}\)). In this case, Equation (5) can be used. Following this, the passive components of the converter power section will be chosen considering Equations (5), (7) and (9). For this purpose, the following specifications (Table 1) will be used. At first, it is important to calculate the duty cycle; so using Equation (7), it is possible to compute \(\mathrm{D}\):  
\[\mathrm{D}=\frac{\mathrm{V}_{\mathrm{O}}}{\mathrm{V}_{\mathrm{in}}}=\frac{5}{ 19}\cong 0.26\]  
The inductor ripple will be greater when the load current is minimum. Thus, the minimum \(\mathrm{L}\) value can be computed as follows, using Equation (5):  
\[\mathrm{L}=\frac{\mathrm{V}_{\mathrm{O}}}{\Delta\mathrm{i}_{\mathrm{L}}\times \mathrm{f}}\times(1-\mathrm{D})\Rightarrow\left\{ \begin{array}{l}\mathrm{L}> \frac{5}{\Delta\mathrm{i}_{\mathrm{L}}\times 100\mathrm{K}}\times(1-0.26)\\ \Delta\mathrm{i}_{\mathrm{L}}=0.4\times\mathrm{I}_{\mathrm{O}}=0.4\times\frac{ \mathrm{min}(\mathrm{P}_{\mathrm{O}})}{\mathrm{V}_{\mathrm{O}}}=0.4\end{array}  \right.\Rightarrow\mathrm{L}>92.5\;\mathrm{\mu H}\]  
Finally, it is possible to calculate \(\mathrm{C}\) through Equation (9):  
\[\mathrm{C}>\frac{5\times(1-0.26)}{8\times(92.5\mathrm{\mu})\times(100\mathrm{k} )^{2}\times(5\mathrm{m})}=100\;\mathrm{\mu F}\]  
Considering the above conditions, the component tolerance and a safety margin, it was decided to choose the following passive elements:  
\[\mathrm{L}=200\;\mathrm{\mu H}\;\mathrm{and}\;\mathrm{C}=220\;\mathrm{\mu F}\]  
Since the capacitance value is relatively high, an Alcap capacitor was chosen. As the ESR value of a 220 \(\mathrm{\mu F}\) Alcap is in the order of 0.2 \(\mathrm{\Omega}\) at 1 kHz [26], it is possible to conclude that the output voltage ripple will be essentially the result of the ESR:  
\[\Delta\mathrm{v}_{\mathrm{O}}\cong\mathrm{ESR}\times\Delta\mathrm{i}_{ \mathrm{L}}\cong 0.2\times\Delta\mathrm{i}_{\mathrm{L}} \tag{11}\] \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Input** & **Output** & **Load Range** & \begin{tabular}{c} **Output** \\ **Voltage** \\ **Ripple (\(\Delta\mathrm{v}_{\mathrm{O}}\))** \\ \end{tabular} & \
\begin{tabular}{c} **Induct** \\ **Ripple (\(\Delta\mathrm{v}_{\mathrm{O}}\))** \\ **Current (\(\Delta\mathrm{i}_{\mathrm{L}}\))** \\ \end{tabular} &
\begin{tabular}{c} **Operating** \\ **Frequency** \\ \end{tabular} \\ \hline
19 V & 5 V & 5 W to 50 W & 5 mV & 40\% of \(\mathrm{I}_{\mathrm{O}}\) & 100 kHz \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Power section specifications.