## 3 Case Study: Design and Implementation of the Photovoltaic Control System
### Optimization of the Photovoltaic Control System  
According to the proposed prototyping flow, both the sequential and combinational parts of the concurrent control system are the subject of optimization. Firstly, the redundant expressions and possible number of flip-flops are minimized and reduced. The minimization process is presented for the registers representing places \(p_{99},\ p_{100},\) and \(p_{101}.\) The original equations that describe the concurrent control system are as follows:  
\[ \begin{array}{l}t_{98}=p_{99}\\ p_{99}\gets p_{99}\ \overline{t_{98}}\ +t_{95}\end{array}  \tag{7}\]  
However, inserting \(t_{98}\) into the equation of \(p_{99},\) we obtain the following:  
\[ \begin{array}{l}p_{99}\gets p_{99}\ \overline{p_{99}}\ +t_{95}\\ p_{99}\leftarrow\ t_{95}\end{array}  \tag{8}\]  
Furthermore, the original equations are the following:  
\[ \begin{array}{l}t_{100}=p_{100}\ \underline{pw_{8}}\\ t_{101}=p_{100}\ \overline{pw_{8}}\\ p_{100}\gets p_{100}\ \overline{t_{100}}\ \overline{t_{101}}\ +t_{95}\end{array}  \tag{9}\]Inserting \(t_{100}\) and \(t_{101}\) into \(p_{100}\), we obtain the following:  
\[ \begin{array}{l}p_{100}\gets p_{100}(\overline{p_{100}}+\overline{pw_{8}})( \overline{p_{100}}+\overline{pw_{8}})+t_{95}\\ p_{100}\gets p_{100}\ \ (\overline{p_{100}}+\overline{p_{100}}\ pw_{8}+\overline{pw_{8}}\ \overline{p_{100}}+0)+\ t_{95}\\ p_{100}\gets t_{95}\\ \end{array}  \tag{10}\]  
Finally, the original equations of \(p_{101}\) are the following:  
\[ \begin{array}{l}t_{104}=p_{101}\ tp_{8}\\ t_{105}=p_{101}\ tp_{8}\\ p_{101}\gets p_{101}\ t_{104}\ \ \overline{t_{105}}\ +t_{95}\\ \end{array}  \tag{11}\]  
Inserting \(t_{104}\) and \(t_{105}\) into \(p_{101}\), we obtain the following:  
\[ \begin{array}{l}p_{101}\gets p_{101}\ \left(\overline{p_{101}}+\overline{ tp_{8}}\ \right)\ (\overline{p_{101}}+\overline{tp_{8}})\ +t_{95}\\ p_{101}\gets p_{101}\ \left(\overline{p_{101}}+\overline{p_{101}}\ tp_{8}+ \overline{tp_{8}}\ \overline{p_{101}}+0\right)+t_{95}\\ p_{101}\gets t_{95}\\ \end{array}  \tag{12}\]  
As it is shown, places \(p_{99}\), \(p_{100}\), and \(p_{101}\) can be merged and replaced by the single flip-flop. The final result is achieved by algebraic transformations. However, the algorithm applies BDDs, where the function representation is canonical, and the equivalence of the presented flip-flops can be immediately checked. Moving on to the optimization of the combinational part, we will follow the _status_e_ signals, while the complete description of the whole system is presented in Appendix A (Listings A1-A4). Firstly, the logical equation is decomposed according to the procedure shown in Section 2.3 and combined with finding common subfunctions. The resulting description is shown in Listing 7. There are bound functions \(g_{0}\), \(\ldots\), \(g_{5}\) which are arguments of the logic function _status_e[0]_, \(\ldots\), _status_e[3]_. Let us underline that the number of arguments of each decomposed function does not exceed 5. This means that they can be implemented in the single LUT 5 (a five-input LUT) blocks. Figure 11 shows a schematic of the decomposed functions. Note that functions \(g_{2}\), \(\ldots\), \(g_{5}\) are used only once, which means that their outputs are connected only to one input of another LUT. However, \(g_{0}\) and \(g_{1}\) functions are arguments of several other functions. This means that they are shared among the other functions. Such sharing is essential in the decomposition process and may lead to the significant reduction in the utilized FPGA resources. Figure 11: Logical functions _status_e_ after the decomposition (functions \(g\) are highlighted). However, in order to validate the functionality before the physical implementation, the designed system is simulated within the Vivado environment. Figure 13 shows the results of validation. Based on the stimulated input signals, adequate output signals are obtained. Let us underline that the achieved results confirm the assumptions and thus the proper functionality of the photovoltaic system.