{"id":26600,"date":"2024-03-21T13:15:24","date_gmt":"2024-03-21T13:15:24","guid":{"rendered":"https:\/\/imperix.com\/doc\/?p=26600"},"modified":"2025-12-18T10:35:56","modified_gmt":"2025-12-18T10:35:56","slug":"finite-control-set-mpc","status":"publish","type":"post","link":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc","title":{"rendered":"Finite control set MPC for a voltage-controlled inverter"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-right-text counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Working-principle\" >Working principle<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Discrete-plant-model\" >Discrete plant model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Cost-function-for-finite-control-set-MPC\" >Cost function for finite control set MPC<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Reference-tracking\" >Reference tracking<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Common-mode-current-minimization\" >Common mode current minimization<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Algorithm-implementation\" >Algorithm implementation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Experimental-setup\" >Experimental setup<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#CPU-implementation\" >CPU implementation<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Simulink-model\" >Simulink model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Validation-results\" >Validation results<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#FPGA-implementation\" >FPGA implementation<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Vivado-project\" >Vivado project<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Simulink-model-2\" >Simulink model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Validation-results-2\" >Validation results<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\/#References\" >References<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>This article introduces an example of Finite Control Set Model Predictive Control (FCS-MPC) for an LCL-filtered voltage-controlled inverter. The proposed control implementation is derived from [1], with an extension to minimize the output common-mode current. This is notably relevant when an EMC filter is required, such as when the inverter is connected to the grid (instead of a passive load).<\/p>\n\n\n\n<p>After the introduction to the MPC working principle and plant modeling, the control algorithm is described and two implementations are provided: a full-CPU implementation, as well as an FPGA-based version. Both versions are validated experimentally and briefly discussed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Working-principle\"><\/span>Working principle<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The idea behind any MPC implementation can be summarized as follows: if the behavior of the plant can be predicted, it is possible to select the best control input based on estimated forecasts. Therefore, given a set of possible control inputs (or <em>candidates<\/em>), the MPC includes two steps: the prediction, for each candidate, of the future state (based on the plant model), and then the selection of the best candidate.<\/p>\n\n\n\n<p>The plant behavior is most often expressed as a linear state-space representation \\(\\dot{x}=Ax+Bu\\), from which a discretized state-space model \\(x_{k+1}=A_d x_k+B_d u_k\\) can be derived through exact discretization. The selection of the best candidate then requires the formulation of an objective (or cost) function \\(g\\), in which the minimized quantities may be adapted depending on the desired dynamics.<\/p>\n\n\n\n<p>With a finite set of candidates, the future state is usually estimated for each of them. From this forecast, the associated cost can be easily derived, such that the best candidate (lowest cost) can be identified at the end of the process. When the output can be any value within a given interval (infinite set of candidates), both steps are considered at once: the cost function is expressed as a function of the state-space model and then minimized through an exact optimization or using a solver.<\/p>\n\n\n\n<p>With a suitable plant model, it is theoretically possible to predict states for a large number of sampling periods and sequentially apply the candidates corresponding to the best sequence. However, because of unavoidable disturbances, noise, and potential modeling approximations, only the first element of the sequence is usually applied, and the best sequence is computed again at the next time step to improve the control robustness. The number of anticipated values is called the horizon \\(N\\). In this example, the horizon is kept to 1.<\/p>\n\n\n\n<p>A further introduction to MPC is given in <a href=\"https:\/\/imperix.com\/doc\/implementation\/model-predictive-control\">TN161 &#8211; Introduction to Model Predictive Control<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Discrete-plant-model\"><\/span>Discrete plant model<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The considered circuit is depicted in Fig. 1. Components marked in gray are ignored for the moment. They will be considered when introducing the extension in the next section.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"358\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/Three-phase-inverter-LCL-and-Rload_v2_hq-1024x358.png\" alt=\"Two-level LCL-filtered inverter controlled by a Finite Control Set inverter\" class=\"wp-image-26318\" style=\"width:682px;height:238px\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/Three-phase-inverter-LCL-and-Rload_v2_hq-1024x358.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/Three-phase-inverter-LCL-and-Rload_v2_hq-300x105.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/Three-phase-inverter-LCL-and-Rload_v2_hq-768x268.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/Three-phase-inverter-LCL-and-Rload_v2_hq-1536x537.png 1536w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/Three-phase-inverter-LCL-and-Rload_v2_hq.png 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Fig. 1 &#8211; Two-level LCL-filtered inverter used to validate the proposed Finite Control Set MPC algorithm<\/figcaption><\/figure>\n<\/div>\n\n\n<p>The equations describing the plant dynamics are as follows:<\/p>\n\n\n\n<p id=\"block-99974b2b-ec6d-4408-8fc6-bac72d2ae376\">$$\\begin{align*}<br>\\frac{di_{i}}{dt}&amp;=\\frac{1}{L_1}\\left(v_{i}-R_1i_{i}-v_{c}\\right)           &amp;  \\frac{dv_{c}}{dt}&amp;=\\frac{i_{i}-i_{o}}{C_{f}}              &amp;  \\frac{di_{o}}{dt}&amp;=\\frac{1}{L_2}\\left(v_{c}-R_2i_{o}-v_{o}\\right)<br>\\end{align*}$$<\/p>\n\n\n\n<p>where \\(i_{i}\\) and \\(i_{o}\\) are the inverter and load currents, and \\(v_{o}\\), \\(v_{c}\\), \\(v_{i}\\) the load, capacitor and inverter voltages. These variables are represented by their complex vectors in the \u03b1\u03b2 frame. For instance, the inverter-side current in the \u03b1\u03b2-frame is:<\/p>\n\n\n\n<p>$$i_{i}=i_{i\\alpha}+ji_{i\\beta}=\\frac23\\left(i_{ia}+a\\cdot i_{ib}+a^2\\cdot i_{ic}\\right)$$<\/p>\n\n\n\n<p>where \\(a=e^{j2\\pi\/3}\\). The inverter-side voltage can then be expressed in terms of the switching states of each phase \\(S_{a}\\), \\(S_{b}\\), and \\(S_{c}\\):<\/p>\n\n\n\n<p>$$v_{i}=\\frac23V_{dc}\\left(S_{a}+aS_{b}+a^2S_{c}\\right)$$ <\/p>\n\n\n\n<p>Since the load current<strong> <\/strong>\\(i_{o}\\) can be measured, there&#8217;s no need to use the third equation (system dynamics), allowing the reduction of the prediction model, represented in a state-space form as:<\/p>\n\n\n\n<p>$$\\dot{x}=Ax(t)+Bu(t)=\\left[\\begin{matrix}-\\frac{R1}{L1} &amp; -\\frac{1}{L1}\\\\\\frac{1}{C_{f}} &amp; 0\\end{matrix}\\right]\\left\\lbrack\\begin{matrix}i_{i}\\\\v_{c}\\end{matrix}\\right\\rbrack+\\left[\\begin{matrix}\\frac{1}{L1} &amp; 0\\\\0 &amp; -\\frac{1}{C_{f}}\\end{matrix}\\right]\\left\\lbrack\\begin{matrix}v_{i}\\\\ i_{o}\\end{matrix}\\right\\rbrack$$<\/p>\n\n\n\n<p>where \\(x\\left(t\\right)=\\left[i_{i} \\ \\  v_{c}\\right]^{T}\\) and \\(u\\left(t\\right)=\\left[v_{i} \\ \\  i_{o}\\right]^{T}\\) are the state and input vectors, respectively.<\/p>\n\n\n\n<p>The discretized state-space model of the system is then:<\/p>\n\n\n\n<p>$$\\left[\\begin{matrix}i_{i,k+1}\\\\ v_{c,k+1}\\end{matrix}\\right]=A_{d}\\left[\\begin{matrix}i_{i,k}\\\\ v_{c,k}\\end{matrix}\\right]+B_{d}\\left[\\begin{matrix}v_{i,k}\\\\ i_{o,k}\\end{matrix}\\right]=e_{}^{AT_{s}}\\left[\\begin{matrix}i_{i,k}\\\\ v_{c,k}\\end{matrix}\\right]+\\int_0^{T_{s}}e^{A\ud835\udf0f}Bd\ud835\udf0f\\left[\\begin{matrix}v_{i,k}\\\\ i_{o,k}\\end{matrix}\\right]$$<\/p>\n\n\n\n<p>where \\(A_{d}\\) and \\(B_{d}\\) are obtained through exact discretization. This can be typically achieved during code generation using the <code>expm<\/code> Matlab command, which computes the matrix exponential using a scaling and squaring algorithm with a Pade approximation [3] :<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\"><span class=\"hljs-comment\">% Symbolic Math Toolbox required<\/span>\nAd = expm(A*Ts); \nBd = (integral(@(Ts) expm(A.*Ts),<span class=\"hljs-number\">0<\/span>,Ts, <span class=\"hljs-string\">'ArrayValued'<\/span>, <span class=\"hljs-built_in\">true<\/span>))*B;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-predictive-voltage-control\"><span class=\"ez-toc-section\" id=\"Cost-function-for-finite-control-set-MPC\"><\/span>Cost function for finite control set MPC<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Reference-tracking\"><\/span>Reference tracking<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The considered control aims at controlling the line-to-line voltages across the \\(C_f\\) capacitors. Since the capacitor voltage dynamics are mainly determined by the inverter-side currents, the control method proposed in [1] consists of delaying the desired voltage reference and transforming it into a current reference. Doing so, authors assume that voltages and currents are designed at grid frequency, and are thus slowly varying in comparison to the controller&#8217;s sampling frequency (i.e. \\(i_{o,k+2}^{*}\\approx i_{o,k}\\) and \\(v_{i,k+2}^{*}\\approx v_{i,k+1}\\)). Although this assumption could be questioned for \\(v^{*}_{i,k}\\), the corresponding implementation shows good performance.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">In real-world applications, the computation time is generally not negligible and should be taken into account when estimating the system state(s). In this example, with a sampling frequency of 100kHz, the computation time is assumed to be almost one full sampling period. A common prediction step is therefore applied to all candidates from \\(k\\) to \\(k+1\\). The system state is then predicted for each candidate from \\(k+1\\) to \\(k+2\\).<\/div>\n\n\n\n<p>Using the discrete state-space model and the coefficients of matrices \\(A_{d}\\) and \\(B_{d}\\), the prediction of the capacitors voltage in the \u03b1\u03b2-frame is:<\/p>\n\n\n\n<p>$$v_{c,k+3}=A_{d,10}i_{i,k+2}+A_{d,11}v_{c,k+2}+B_{d,10}v_{i,k+2}+B_{d,11}i_{o,k+2}$$<\/p>\n\n\n\n<p>The inverter-side current reference can be derived as:<\/p>\n\n\n\n<p>$$i_{i,k+2}^{\\star}=\\frac{v_{c,k+3}^{\\star}-A_{d,11}v_{c,k+2}-B_{d,10}v_{i,k+2}-B_{d,11}i_{o,k+2}}{A_{d,10}}$$<\/p>\n\n\n\n<p>where \\(i_{i,k+2}\\), \\(v_{c,k+2}\\) are forecasts obtained by application of the system&#8217;s model and \\(i_{o,k+2}^{*}\\approx i_{o,k}\\) and \\(v_{i,k+2}^{*}\\approx v_{i,k+1}\\) are the best available estimates for \\(i_{o,k+2}\\) and \\(v_{i,k+2}\\).<\/p>\n\n\n\n<p>In this example, the objective function uses a quadratic norm and is designed only for current tracking:<\/p>\n\n\n\n<p>$$g=\\left(i_{i\\alpha,k+2}^{\\star}-i_{i\\alpha,k+2}^{}\\right)^2+\\left(i_{i\\beta,k+2}^{\\star}-i_{i\\beta,k+2}^{}\\right)^2$$<\/p>\n\n\n\n<p>where \\(i_{\u03b1,k+2}^{\\star}\\), \\(i_{\u03b2,k+2}^{\\star}\\) and \\(i_{\u03b1,k+2}\\), \\(i_{\u03b2,k+2}\\) are the current reference and prediction at sampling instant \\(k+2\\).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Common-mode-current-minimization\"><\/span>Common mode current minimization<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Besides the reference tracking strategy of [1], this example proposes to leverage the remaining degree of freedom to reduce the common mode current at the inverter output. This has several benefits, namely the possibility to use the inverter with an EMC filter &#8211; often required when connected to the grid &#8211; and the reduction of the maximal peak current in the inverter modules.<\/p>\n\n\n\n<p>To this aim, the circuit of Fig. 1 is slightly modified and gray-marked components are now considered. A \\(C_{fb}\\) feedback capacitor is added, creating a feedback path between the midpoint of the capacitive filter and the DC bus midpoint. An EMC filter is also added and can be modelized by an additional \\(C_{EMC}\\) capacitive filter.<\/p>\n\n\n\n<p>In differential mode, the system derived in the previous section still holds, except that \\(C_f+C_{\\text{EMC}}\\) should be considered instead of \\(C_f\\), because both capacitive filters are now seen in parallel. The feedback path does not affect the differential-mode behavior.<\/p>\n\n\n\n<p>In common mode, the obtained model (not explicitly derived here) is almost the same as in differential mode, where the only difference is that \\(\\left(1\/C_f+1\/C_{fb}\\right)^{-1}\\) should now be considered instead of \\(C_f\\). This defines the common-mode model \\(x_{0,k+1}=A^0_{d} x_{0,k}+B^0_{d} u_{0,k}\\) and makes it possible to forecast the common-mode voltage \\(v_{i0,k+2}\\) and current \\(i_{i0,k+2}\\).<\/p>\n\n\n\n<p>The common-mode current \\(i_{i0,k+2}\\) is then penalized through an additional term appended to the cost function, leading to:<\/p>\n\n\n\n<p>$$g = \\left(i_{i\\alpha,k+2}^{\\star}-i_{i\\alpha,k+2}^{}\\right)^2+\\left(i_{i\\beta,k+2}^{\\star}-i_{i\\beta,k+2}^{}\\right)^2\\,+K\\cdot i_{i0,k+2}^2$$<\/p>\n\n\n\n<p>where \\(K=50\\) has shown good performance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-description-of-the-finite-control-set-mpc-algorithm\"><span class=\"ez-toc-section\" id=\"Algorithm-implementation\"><\/span>Algorithm implementation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The control routine of the proposed Finite Control Set MPC algorithm can be synthesized as follows:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Get the measured quantities (ii, vc, io, Vdc) from the ADC at instant k;<\/li>\n\n\n\n<li>Considering that the control routine computation time corresponds to one period and that the new optimal state will thus be applied just before the next iteration, get an estimate of ii and vc at instant k+1;<\/li>\n\n\n\n<li>For each candidate:\n<ul class=\"wp-block-list\">\n<li>Get an estimate of ii and vc at instant k+2;<\/li>\n\n\n\n<li>Get an estimate of ii_ref at instant k+2;<\/li>\n\n\n\n<li>Compute the candidate&#8217;s cost;<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Select the best candidate (lowest cost) and apply it.<\/li>\n<\/ol>\n\n\n\n<p>The algorithm is implemented in C and embedded within the Simulink environment via a <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/sfg\/what-is-an-s-function.html\">S-Function<\/a> block. More information about S-Functions can be found in <a href=\"https:\/\/imperix.com\/doc\/help\/s-functions-c-code-simulink-integration\">PN153<\/a>.<\/p>\n\n\n<style>.kt-accordion-id26600_1e4ea0-12 .kt-accordion-inner-wrap{column-gap:var(--global-kb-gap-md, 2rem);row-gap:1px;}.kt-accordion-id26600_1e4ea0-12 .kt-accordion-panel-inner{border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent;border-left:2px solid transparent;border-top-left-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:2px;background:#ffffff;padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px;}.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header{border-top:2px solid #f2f2f2;border-right:2px solid #f2f2f2;border-bottom:2px solid #f2f2f2;border-left:2px solid #f2f2f2;border-top-left-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:2px;background:#ffffff;font-size:16px;line-height:24px;letter-spacing:0px;font-weight:bold;text-transform:none;color:var(--global-palette3, #1A202C);padding-top:12px;padding-right:10px;padding-bottom:8px;padding-left:16px;}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle )  > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap .kt-blocks-accordion-icon-trigger:after, .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle )  > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap .kt-blocks-accordion-icon-trigger:before{background:var(--global-palette3, #1A202C);}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-blocks-accordion-icon-trigger{background:var(--global-palette3, #1A202C);}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-blocks-accordion-icon-trigger:after, .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-blocks-accordion-icon-trigger:before{background:#ffffff;}.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header:hover, \n\t\t\t\tbody:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12 .kt-blocks-accordion-header:focus-visible{color:#444444;background:#ffffff;border-top:2px solid #eeeeee;border-right:2px solid #eeeeee;border-bottom:2px solid #eeeeee;border-left:2px solid #eeeeee;}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle ) .kt-accordion-header-wrap .kt-blocks-accordion-header:hover .kt-blocks-accordion-icon-trigger:after, .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle ) .kt-accordion-header-wrap .kt-blocks-accordion-header:hover .kt-blocks-accordion-icon-trigger:before, body:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle ) .kt-blocks-accordion--visible .kt-blocks-accordion-icon-trigger:after, body:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle ) .kt-blocks-accordion-header:focus-visible .kt-blocks-accordion-icon-trigger:before{background:#444444;}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-accordion-header-wrap .kt-blocks-accordion-header:hover .kt-blocks-accordion-icon-trigger, body:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-accordion-header-wrap .kt-blocks-accordion-header:focus-visible .kt-blocks-accordion-icon-trigger{background:#444444;}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-accordion-header-wrap .kt-blocks-accordion-header:hover .kt-blocks-accordion-icon-trigger:after, .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-accordion-header-wrap .kt-blocks-accordion-header:hover .kt-blocks-accordion-icon-trigger:before, body:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-accordion-header-wrap .kt-blocks-accordion-header:focus-visible .kt-blocks-accordion-icon-trigger:after, body:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-accordion-header-wrap .kt-blocks-accordion-header:focus-visible .kt-blocks-accordion-icon-trigger:before{background:#ffffff;}.kt-accordion-id26600_1e4ea0-12 .kt-accordion-header-wrap .kt-blocks-accordion-header:focus-visible,\n\t\t\t\t.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header.kt-accordion-panel-active{color:var(--global-palette3, #1A202C);background:var(--global-palette9, #ffffff);border-top:2px solid var(--global-palette6, #718096);border-right:2px solid var(--global-palette6, #718096);border-bottom:2px solid var(--global-palette6, #718096);border-left:2px solid var(--global-palette6, #718096);}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle )  > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header.kt-accordion-panel-active .kt-blocks-accordion-icon-trigger:after, .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basiccircle ):not( .kt-accodion-icon-style-xclosecircle ):not( .kt-accodion-icon-style-arrowcircle )  > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header.kt-accordion-panel-active .kt-blocks-accordion-icon-trigger:before{background:var(--global-palette3, #1A202C);}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-blocks-accordion-header.kt-accordion-panel-active .kt-blocks-accordion-icon-trigger{background:var(--global-palette3, #1A202C);}.kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-blocks-accordion-header.kt-accordion-panel-active .kt-blocks-accordion-icon-trigger:after, .kt-accordion-id26600_1e4ea0-12:not( .kt-accodion-icon-style-basic ):not( .kt-accodion-icon-style-xclose ):not( .kt-accodion-icon-style-arrow ) .kt-blocks-accordion-header.kt-accordion-panel-active .kt-blocks-accordion-icon-trigger:before{background:var(--global-palette9, #ffffff);}@media all and (max-width: 1024px){.kt-accordion-id26600_1e4ea0-12 .kt-accordion-panel-inner{border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent;border-left:2px solid transparent;}}@media all and (max-width: 1024px){.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header{border-top:2px solid #f2f2f2;border-right:2px solid #f2f2f2;border-bottom:2px solid #f2f2f2;border-left:2px solid #f2f2f2;}}@media all and (max-width: 1024px){.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header:hover, \n\t\t\t\tbody:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12 .kt-blocks-accordion-header:focus-visible{border-top:2px solid #eeeeee;border-right:2px solid #eeeeee;border-bottom:2px solid #eeeeee;border-left:2px solid #eeeeee;}}@media all and (max-width: 1024px){.kt-accordion-id26600_1e4ea0-12 .kt-accordion-header-wrap .kt-blocks-accordion-header:focus-visible,\n\t\t\t\t.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header.kt-accordion-panel-active{border-top:2px solid var(--global-palette6, #718096);border-right:2px solid var(--global-palette6, #718096);border-bottom:2px solid var(--global-palette6, #718096);border-left:2px solid var(--global-palette6, #718096);}}@media all and (max-width: 767px){.kt-accordion-id26600_1e4ea0-12 .kt-accordion-inner-wrap{display:block;}.kt-accordion-id26600_1e4ea0-12 .kt-accordion-inner-wrap .kt-accordion-pane:not(:first-child){margin-top:1px;}.kt-accordion-id26600_1e4ea0-12 .kt-accordion-panel-inner{border-top:2px solid transparent;border-right:2px solid transparent;border-bottom:2px solid transparent;border-left:2px solid transparent;}.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header{border-top:2px solid #f2f2f2;border-right:2px solid #f2f2f2;border-bottom:2px solid #f2f2f2;border-left:2px solid #f2f2f2;}.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header:hover, \n\t\t\t\tbody:not(.hide-focus-outline) .kt-accordion-id26600_1e4ea0-12 .kt-blocks-accordion-header:focus-visible{border-top:2px solid #eeeeee;border-right:2px solid #eeeeee;border-bottom:2px solid #eeeeee;border-left:2px solid #eeeeee;}.kt-accordion-id26600_1e4ea0-12 .kt-accordion-header-wrap .kt-blocks-accordion-header:focus-visible,\n\t\t\t\t.kt-accordion-id26600_1e4ea0-12 > .kt-accordion-inner-wrap > .wp-block-kadence-pane > .kt-accordion-header-wrap > .kt-blocks-accordion-header.kt-accordion-panel-active{border-top:2px solid var(--global-palette6, #718096);border-right:2px solid var(--global-palette6, #718096);border-bottom:2px solid var(--global-palette6, #718096);border-left:2px solid var(--global-palette6, #718096);}}<\/style>\n<div class=\"wp-block-kadence-accordion alignnone\"><div class=\"kt-accordion-wrap kt-accordion-id26600_1e4ea0-12 kt-accordion-has-4-panes kt-active-pane-0 kt-accordion-block kt-pane-header-alignment-left kt-accodion-icon-style-arrow kt-accodion-icon-side-left\" style=\"max-width:none\"><div class=\"kt-accordion-inner-wrap\" data-allow-multiple-open=\"false\" data-start-open=\"none\">\n<div class=\"wp-block-kadence-pane kt-accordion-pane kt-accordion-pane-4 kt-pane26600_495e8e-4b\"><div class=\"kt-accordion-header-wrap\"><button class=\"kt-blocks-accordion-header kt-acccordion-button-label-show\" type=\"button\"><span class=\"kt-blocks-accordion-title-wrap\"><span class=\"kt-blocks-accordion-title\"><strong>C script<\/strong> (for S-Function block)<\/span><\/span><span class=\"kt-blocks-accordion-icon-trigger\"><\/span><\/button><\/div><div class=\"kt-accordion-panel kt-accordion-panel-hidden\"><div class=\"kt-accordion-panel-inner\"><pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"C++\" data-shcb-language-slug=\"cpp\"><span><code class=\"hljs language-cpp\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">float<\/span> <span class=\"hljs-title\">simulate_state<\/span><span class=\"hljs-params\">(\n    <span class=\"hljs-keyword\">const<\/span> <span class=\"hljs-keyword\">float<\/span> sw&#091;<span class=\"hljs-number\">3<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> Vdc,\n    <span class=\"hljs-keyword\">float<\/span> IO&#091;<span class=\"hljs-number\">2<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> Vref&#091;<span class=\"hljs-number\">3<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> ii_k1&#091;<span class=\"hljs-number\">3<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> vc_k1&#091;<span class=\"hljs-number\">3<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> Ad&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> Bd&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> Ad0&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>],\n    <span class=\"hljs-keyword\">float<\/span> Bd0&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>],\n    <span class=\"hljs-keyword\">int<\/span> mode)<\/span> <\/span>{\n\n    <span class=\"hljs-keyword\">float<\/span> vi_k1&#091;<span class=\"hljs-number\">3<\/span>];\n    <span class=\"hljs-keyword\">float<\/span> ii_k2&#091;<span class=\"hljs-number\">3<\/span>];\n    <span class=\"hljs-keyword\">float<\/span> vc_k2&#091;<span class=\"hljs-number\">3<\/span>];\n    <span class=\"hljs-keyword\">float<\/span> iiref_k2&#091;<span class=\"hljs-number\">3<\/span>];\n\n    <span class=\"hljs-keyword\">float<\/span> cost = <span class=\"hljs-number\">0<\/span>;\n\n    <span class=\"hljs-comment\">\/\/ 2nd-step calculations for the alpha\/beta-components<\/span>\n    <span class=\"hljs-keyword\">for<\/span>(<span class=\"hljs-keyword\">int<\/span> i=<span class=\"hljs-number\">0<\/span>;i&lt;<span class=\"hljs-number\">2<\/span>;i++) {\n        vi_k1&#091;i] = Vdc*sw&#091;i];\n\n        ii_k2&#091;i] = Ad&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*ii_k1&#091;i] + Ad&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*vc_k1&#091;i] + Bd&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k1&#091;i] + Bd&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;i];\n        vc_k2&#091;i] = Ad&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*ii_k1&#091;i] + Ad&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*vc_k1&#091;i] + Bd&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k1&#091;i] + Bd&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;i];\n\n        iiref_k2&#091;i] = (Vref&#091;i] - Ad&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*vc_k2&#091;i] - Bd&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k1&#091;i] - Bd&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;i]) \/ Ad&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>];\n\n        cost += (iiref_k2&#091;i]-ii_k2&#091;i])*(iiref_k2&#091;i]-ii_k2&#091;i]);\n    }\n\n    <span class=\"hljs-comment\">\/\/ 2nd-step calculations for the 0-component<\/span>\n    <span class=\"hljs-keyword\">if<\/span> (mode==<span class=\"hljs-number\">1<\/span>) {\n        vi_k1&#091;<span class=\"hljs-number\">2<\/span>] = Vdc*sw&#091;<span class=\"hljs-number\">2<\/span>]-Vdc\/<span class=\"hljs-number\">2<\/span>;\n\n        ii_k2&#091;<span class=\"hljs-number\">2<\/span>] = Ad0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*ii_k1&#091;<span class=\"hljs-number\">2<\/span>] + Ad0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*vc_k1&#091;<span class=\"hljs-number\">2<\/span>] + Bd0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k1&#091;<span class=\"hljs-number\">2<\/span>] + Bd0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;<span class=\"hljs-number\">2<\/span>];\n    \n        cost += <span class=\"hljs-number\">50<\/span>*ii_k2&#091;<span class=\"hljs-number\">2<\/span>]*ii_k2&#091;<span class=\"hljs-number\">2<\/span>];\n    }\n\n    <span class=\"hljs-keyword\">return<\/span> cost;\n}\n\n<span class=\"hljs-comment\">\/\/ (...)<\/span>\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">void<\/span> <span class=\"hljs-title\">MPC_Outputs_wrapper<\/span><span class=\"hljs-params\">(<span class=\"hljs-keyword\">const<\/span> real32_T *Vdc_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *ii_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *vc_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *io_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *vref_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *Ad_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *Bd_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *Ad0_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> real32_T *Bd0_ptr,\n                         <span class=\"hljs-keyword\">const<\/span> int32_T *mode_ptr,\n                         uint32_T *out)<\/span> <\/span>{\n\n    <span class=\"hljs-keyword\">float<\/span> Vdc = *Vdc_ptr;\n    <span class=\"hljs-keyword\">float<\/span> *IM = (<span class=\"hljs-keyword\">float<\/span>*)ii_ptr;\n    <span class=\"hljs-keyword\">float<\/span> *V = (<span class=\"hljs-keyword\">float<\/span>*)vc_ptr;\n    <span class=\"hljs-keyword\">float<\/span> *IO = (<span class=\"hljs-keyword\">float<\/span>*)io_ptr;\n    <span class=\"hljs-keyword\">float<\/span> *Vref = (<span class=\"hljs-keyword\">float<\/span>*)vref_ptr;\n    <span class=\"hljs-keyword\">float<\/span> Ad&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>] = {{Ad_ptr&#091;<span class=\"hljs-number\">0<\/span>], Ad_ptr&#091;<span class=\"hljs-number\">2<\/span>]},{Ad_ptr&#091;<span class=\"hljs-number\">1<\/span>], Ad_ptr&#091;<span class=\"hljs-number\">3<\/span>]}};\n    <span class=\"hljs-keyword\">float<\/span> Bd&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>] = {{Bd_ptr&#091;<span class=\"hljs-number\">0<\/span>], Bd_ptr&#091;<span class=\"hljs-number\">2<\/span>]},{Bd_ptr&#091;<span class=\"hljs-number\">1<\/span>], Bd_ptr&#091;<span class=\"hljs-number\">3<\/span>]}};\n    <span class=\"hljs-keyword\">float<\/span> Ad0&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>] = {{Ad0_ptr&#091;<span class=\"hljs-number\">0<\/span>], Ad0_ptr&#091;<span class=\"hljs-number\">2<\/span>]},{Ad0_ptr&#091;<span class=\"hljs-number\">1<\/span>], Ad0_ptr&#091;<span class=\"hljs-number\">3<\/span>]}};\n    <span class=\"hljs-keyword\">float<\/span> Bd0&#091;<span class=\"hljs-number\">2<\/span>]&#091;<span class=\"hljs-number\">2<\/span>] = {{Bd0_ptr&#091;<span class=\"hljs-number\">0<\/span>], Bd0_ptr&#091;<span class=\"hljs-number\">2<\/span>]},{Bd0_ptr&#091;<span class=\"hljs-number\">1<\/span>], Bd0_ptr&#091;<span class=\"hljs-number\">3<\/span>]}};\n    <span class=\"hljs-keyword\">int<\/span> mode = *mode_ptr;\n    \n    <span class=\"hljs-comment\">\/\/ constants<\/span>\n    <span class=\"hljs-keyword\">const<\/span> <span class=\"hljs-keyword\">float<\/span> _1_3 = <span class=\"hljs-number\">0.33333333<\/span>;\n    <span class=\"hljs-keyword\">const<\/span> <span class=\"hljs-keyword\">float<\/span> _2_3 = <span class=\"hljs-number\">0.66666667<\/span>;\n    <span class=\"hljs-keyword\">const<\/span> <span class=\"hljs-keyword\">float<\/span> _sqrt3_3 = <span class=\"hljs-number\">0.57735027<\/span>;\n\n    <span class=\"hljs-comment\">\/\/ possible switching states<\/span>\n    <span class=\"hljs-comment\">\/\/ leg_a = LSB, leg_c = MSB<\/span>\n    <span class=\"hljs-keyword\">const<\/span> <span class=\"hljs-keyword\">unsigned<\/span> <span class=\"hljs-keyword\">int<\/span> states&#091;<span class=\"hljs-number\">8<\/span>] = {<span class=\"hljs-number\">0b000<\/span>, <span class=\"hljs-number\">0b001<\/span>, <span class=\"hljs-number\">0b011<\/span>, <span class=\"hljs-number\">0b010<\/span>, <span class=\"hljs-number\">0b110<\/span>, <span class=\"hljs-number\">0b100<\/span>, <span class=\"hljs-number\">0b101<\/span>, <span class=\"hljs-number\">0b111<\/span>};\n\n    <span class=\"hljs-comment\">\/\/ normalized alpha\/beta\/0-components at the output of the inverter<\/span>\n    <span class=\"hljs-comment\">\/\/ corresponding to the switching states of states&#091;7]<\/span>\n    <span class=\"hljs-keyword\">const<\/span> <span class=\"hljs-keyword\">float<\/span> sw&#091;<span class=\"hljs-number\">8<\/span>]&#091;<span class=\"hljs-number\">3<\/span>] =\n        {{<span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">0<\/span>}, {_2_3, <span class=\"hljs-number\">0<\/span>, _1_3}, {_1_3, _sqrt3_3, _2_3}, {-_1_3, _sqrt3_3, _1_3}, {-_2_3, <span class=\"hljs-number\">0<\/span>, _2_3}, {-_1_3, -_sqrt3_3, _1_3}, {_1_3, -_sqrt3_3, _2_3}, {<span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">1<\/span>}};\n\n    <span class=\"hljs-comment\">\/\/ current state<\/span>\n    <span class=\"hljs-keyword\">static<\/span> <span class=\"hljs-keyword\">int<\/span> x_k = <span class=\"hljs-number\">0<\/span>;\n\n    <span class=\"hljs-comment\">\/\/ start of 1st step<\/span>\n    <span class=\"hljs-keyword\">float<\/span> vi_k&#091;<span class=\"hljs-number\">3<\/span>];\n    <span class=\"hljs-keyword\">float<\/span> ii_k1&#091;<span class=\"hljs-number\">3<\/span>];\n    <span class=\"hljs-keyword\">float<\/span> vc_k1&#091;<span class=\"hljs-number\">3<\/span>];\n\n    <span class=\"hljs-comment\">\/\/ 1st-step calculations for the alpha\/beta-components<\/span>\n    <span class=\"hljs-keyword\">for<\/span>(<span class=\"hljs-keyword\">int<\/span> i=<span class=\"hljs-number\">0<\/span>;i&lt;<span class=\"hljs-number\">2<\/span>;i++) {\n        vi_k&#091;i] = Vdc*sw&#091;x_k]&#091;i];\n    }\n\n    <span class=\"hljs-keyword\">for<\/span>(<span class=\"hljs-keyword\">int<\/span> i=<span class=\"hljs-number\">0<\/span>;i&lt;<span class=\"hljs-number\">2<\/span>;i++) {\n        ii_k1&#091;i] = Ad&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*IM&#091;i] + Ad&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*V&#091;i] + Bd&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k&#091;i] + Bd&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;i];\n        vc_k1&#091;i] = Ad&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*IM&#091;i] + Ad&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*V&#091;i] + Bd&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k&#091;i] + Bd&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;i];\n    }\n\n    <span class=\"hljs-comment\">\/\/ 1st-step calculations for the 0-component<\/span>\n    <span class=\"hljs-keyword\">if<\/span> (mode==<span class=\"hljs-number\">1<\/span>) {\n        vi_k&#091;<span class=\"hljs-number\">2<\/span>] = Vdc*sw&#091;x_k]&#091;<span class=\"hljs-number\">2<\/span>]-Vdc\/<span class=\"hljs-number\">2<\/span>;\n    \n        ii_k1&#091;<span class=\"hljs-number\">2<\/span>] = Ad0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*IM&#091;<span class=\"hljs-number\">2<\/span>] + Ad0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*V&#091;<span class=\"hljs-number\">2<\/span>] + Bd0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k&#091;<span class=\"hljs-number\">2<\/span>] + Bd0&#091;<span class=\"hljs-number\">0<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;<span class=\"hljs-number\">2<\/span>];\n        vc_k1&#091;<span class=\"hljs-number\">2<\/span>] = Ad0&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*IM&#091;<span class=\"hljs-number\">2<\/span>] + Ad0&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*V&#091;<span class=\"hljs-number\">2<\/span>] + Bd0&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">0<\/span>]*vi_k&#091;<span class=\"hljs-number\">2<\/span>] + Bd0&#091;<span class=\"hljs-number\">1<\/span>]&#091;<span class=\"hljs-number\">1<\/span>]*IO&#091;<span class=\"hljs-number\">2<\/span>];\n    }\n\n    <span class=\"hljs-comment\">\/\/ start of 2nd step<\/span>\n    <span class=\"hljs-keyword\">float<\/span> g;\n    <span class=\"hljs-keyword\">float<\/span> min_g = <span class=\"hljs-number\">1e18<\/span>;\n    <span class=\"hljs-keyword\">int<\/span> min_ind = <span class=\"hljs-number\">0<\/span>;\n\n    <span class=\"hljs-comment\">\/\/ simulation of all possible states and identification of the optimal one<\/span>\n    <span class=\"hljs-keyword\">for<\/span> (<span class=\"hljs-keyword\">int<\/span> i=<span class=\"hljs-number\">0<\/span>; i&lt;<span class=\"hljs-number\">8<\/span>; i++) {\n        g = simulate_state(sw&#091;i], Vdc, IO, Vref, ii_k1, vc_k1, Ad, Bd, Ad0, Bd0, mode);\n\n        <span class=\"hljs-keyword\">if<\/span> (g &lt; min_g) {\n            min_g = g;\n            min_ind = i;\n        }\n    }\n\n    <span class=\"hljs-comment\">\/\/ update of state and out<\/span>\n    x_k = min_ind;\n    *out = states&#091;x_k];\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">C++<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">cpp<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre><\/div><\/div><\/div>\n<\/div><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-software-resources\"><span class=\"ez-toc-section\" id=\"Experimental-setup\"><\/span>Experimental setup<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-warning\" role=\"alert\">Before performing any experiments, it is recommended to read the safety guidelines for working in the lab provided <a href=\"https:\/\/imperix.com\/doc\/implementation\/safety-and-protection-in-the-lab\">here<\/a>.<\/div>\n\n\n\n<p>The suggested setup, used to validate the proposed finite control set MPC implementation, includes the following imperix products :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/imperix.com\/products\/control\/rapid-prototyping-controller\/\">Programmable controller<\/a> (B-Box RCP)<\/li>\n\n\n\n<li><a href=\"https:\/\/imperix.com\/software\/acg-sdk\" target=\"_blank\" rel=\"noreferrer noopener\">ACG SDK toolbox<\/a> for automated generation of the controller code from Simulink<\/li>\n\n\n\n<li>3x <a href=\"https:\/\/imperix.com\/products\/power\/sic-power-module\/\" target=\"_blank\" rel=\"noreferrer noopener\">PEB8024 modules<\/a> (mounted e.g. in <a href=\"https:\/\/imperix.com\/products\/power\/rack-material\/\" target=\"_blank\" rel=\"noreferrer noopener\">type A or type C rack<\/a>)<\/li>\n\n\n\n<li>1x <a href=\"https:\/\/imperix.com\/products\/power\/filter-box\/\">passive filters rack<\/a> or:\n<ul class=\"wp-block-list\">\n<li>6x 2.2mH inductors (L1, L2)<\/li>\n\n\n\n<li>3x 10\u00b5F capacitors (Cf)<\/li>\n\n\n\n<li>3x 3.3uF capacitors (EMC)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>3x <a href=\"https:\/\/imperix.com\/products\/control\/accessories\/#sensors\" target=\"_blank\" rel=\"noreferrer noopener\">DIN 800V<\/a> voltage sensors<\/li>\n\n\n\n<li>3x <a href=\"https:\/\/imperix.com\/products\/control\/accessories\/#sensors\" target=\"_blank\" rel=\"noreferrer noopener\">DIN 50A<\/a> current sensors<\/li>\n<\/ul>\n\n\n\n<p>and additional components :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1x DC power supply<\/li>\n\n\n\n<li>1x 1uF capacitors (Cfb)<\/li>\n\n\n\n<li>3x 30\u03a9 power resistors<\/li>\n<\/ul>\n\n\n\n<p>The system parameters of the chosen case study are given in the following table :<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th class=\"has-text-align-center\" data-align=\"center\"><strong>Parameter<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Value<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Unit<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Description<\/strong><\/th><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>Fs<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">100<\/td><td class=\"has-text-align-center\" data-align=\"center\">kHz<\/td><td class=\"has-text-align-center\" data-align=\"center\">Sampling frequency<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>Cf<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">10<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u00b5F<\/td><td class=\"has-text-align-center\" data-align=\"center\">LCL filter capacitances<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>R1, R2<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">0.022<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u03a9<\/td><td class=\"has-text-align-center\" data-align=\"center\">Inductors parasitic resistance<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>L1<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">2.2<\/td><td class=\"has-text-align-center\" data-align=\"center\">mH<\/td><td class=\"has-text-align-center\" data-align=\"center\">Inverter-side LCL filter inductors<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>L2<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">2.2<\/td><td class=\"has-text-align-center\" data-align=\"center\">mH<\/td><td class=\"has-text-align-center\" data-align=\"center\">Load-side LCL filter inductors<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>EMC<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">3.3<\/td><td class=\"has-text-align-center\" data-align=\"center\">uF<\/td><td class=\"has-text-align-center\" data-align=\"center\">EMC filter capacitances<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>Vdc<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">800<\/td><td class=\"has-text-align-center\" data-align=\"center\">V<\/td><td class=\"has-text-align-center\" data-align=\"center\">DC-link voltage<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><em>Rload<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">30<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u03a9<\/td><td class=\"has-text-align-center\" data-align=\"center\">Load resistances<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">System parameters<\/figcaption><\/figure>\n\n\n\n<p>To prevent any damage, the hardware protection thresholds of the B-Box RCP front panel must be correctly configured. The suggested values are gathered in the table below. More information can be found in <a href=\"https:\/\/imperix.com\/doc\/help\/analog-front-end-configuration-on-b-box-rcp\">PN105<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th class=\"has-text-align-center\" data-align=\"center\"><strong>Channel<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Signal<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Sensor<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Min \/ Max<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\">Sensor<br><strong>Sensitivity<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Gain<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Limit High<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>Limit Low<\/strong><\/th><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">0,1,2<\/td><td class=\"has-text-align-center\" data-align=\"center\"><em>ii<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">PEB 8024 (current)<\/td><td class=\"has-text-align-center\" data-align=\"center\">-22.5\/ 22.5 [A]<\/td><td class=\"has-text-align-center\" data-align=\"center\">50 [mV\/A]<\/td><td class=\"has-text-align-center\" data-align=\"center\">x8<\/td><td class=\"has-text-align-center\" data-align=\"center\">9.0<\/td><td class=\"has-text-align-center\" data-align=\"center\">-9.0<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">5,6,7<\/td><td class=\"has-text-align-center\" data-align=\"center\"><em>vc<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">DIN 800V<\/td><td class=\"has-text-align-center\" data-align=\"center\">-400\/ 400 [V]<\/td><td class=\"has-text-align-center\" data-align=\"center\">2.46 [mV\/V]<\/td><td class=\"has-text-align-center\" data-align=\"center\">x8<\/td><td class=\"has-text-align-center\" data-align=\"center\">8.4<\/td><td class=\"has-text-align-center\" data-align=\"center\">-8.4<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">8<\/td><td class=\"has-text-align-center\" data-align=\"center\"><em>Vdc<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">PEB 8024 (voltage)<\/td><td class=\"has-text-align-center\" data-align=\"center\">0 \/ 800 [V]<\/td><td class=\"has-text-align-center\" data-align=\"center\">4.99 [mV\/V]<\/td><td class=\"has-text-align-center\" data-align=\"center\">x2<\/td><td class=\"has-text-align-center\" data-align=\"center\">8.3<\/td><td class=\"has-text-align-center\" data-align=\"center\">-0.3<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">13,14,15<\/td><td class=\"has-text-align-center\" data-align=\"center\"><em>io<\/em><\/td><td class=\"has-text-align-center\" data-align=\"center\">DIN 50A<\/td><td class=\"has-text-align-center\" data-align=\"center\">-8.5\/ 8.5 [A]<\/td><td class=\"has-text-align-center\" data-align=\"center\">99 [mV\/A]<\/td><td class=\"has-text-align-center\" data-align=\"center\">x4<\/td><td class=\"has-text-align-center\" data-align=\"center\">3.4<\/td><td class=\"has-text-align-center\" data-align=\"center\">-3.4<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">B-Box front panel configuration &#8211; small margins are included in the limits<\/figcaption><\/figure>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">When sampling at 100kHz, the switching frequency is at most 50kHz, explaining the 22.5 A rating for the PEB8024 modules (cf. <a href=\"https:\/\/imperix.com\/wp-content\/uploads\/document\/PEB8024.pdf\">datasheet<\/a>).<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"CPU-implementation\"><\/span>CPU implementation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Simulink-model\"><\/span>Simulink model<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The Simulink model can be downloaded here below. It uses the imperix <a href=\"https:\/\/imperix.com\/software\/acg-sdk\/simulink\/\" target=\"_blank\" rel=\"noreferrer noopener\">ACG SDK<\/a> and can both simulate the behavior of the system (offline simulation) and generate code for real-time execution on a <a href=\"https:\/\/imperix.com\/products\/control\/bbox\" target=\"_blank\" rel=\"noreferrer noopener\">B-Box RCP<\/a>. <\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-file aligncenter\"><a href=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_MPC_voltage_controlled_inverter_CPU.zip\" class=\"wp-block-file__button wp-element-button\" download>Download <strong>TN162_MPC_voltage_controlled_inverter_CPU<\/strong><\/a><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"601\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink-1024x601.png\" alt=\"Simulink model for the proposed Finite Control Set MPC algorithm (FPGA)\" class=\"wp-image-26251\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink-1024x601.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink-300x176.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink-768x450.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink.png 1468w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Fig. 2 &#8211; Simulink model (CPU)<\/figcaption><\/figure>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">More information about the integration of C code in Simulink via the <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/sfg\/what-is-an-s-function.html\">S-Function<\/a> block can be found in <a href=\"https:\/\/imperix.com\/doc\/help\/integrating-c-or-matlab-code-acg-sdk\">Integrating C or MATLAB code into ACG SDK<\/a>.<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Validation-results\"><\/span>Validation results<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>To assess the transient performance of the control, the capacitor voltage reference is set to 250V at t=0, 100V at t=50ms, and subsequently to 330V at t=100ms.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"620\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_CPU-1024x620.png\" alt=\"Reference tracking with the proposed algorithm (CPU)\" class=\"wp-image-26284\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_CPU-1024x620.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_CPU-300x182.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_CPU-768x465.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_CPU.png 1439w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Fig. 3 \u2013 Reference tracking using Cockpit (CPU)<\/figcaption><\/figure>\n\n\n\n<p>The control algorithm correctly tracks the reference step change, confirming its proper operation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"FPGA-implementation\"><\/span>FPGA implementation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vivado-project\"><\/span>Vivado project<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The Vivado project can be downloaded here below, along with the corresponding Simulink model and additional files. The C files used to generate the IP via Vitis HLS, as described in <a href=\"https:\/\/imperix.com\/doc\/help\/xilinx-vitis-hls\">PN164<\/a>, can be found in <em>\/vitis_hls\/[ip name]\/src\/<\/em>.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-file aligncenter\"><a href=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_MPC_voltage_controlled_inverter_FPGA.zip\" class=\"wp-block-file__button wp-element-button\" download>Download <strong>TN162_MPC_voltage_controlled_inverter_FPGA<\/strong><\/a><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"755\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Vivado_project_view-1024x755.png\" alt=\"\" class=\"wp-image-26715\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Vivado_project_view-1024x755.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Vivado_project_view-300x221.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Vivado_project_view-768x566.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Vivado_project_view-1536x1132.png 1536w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Vivado_project_view-2048x1509.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Fig. 4 &#8211; Vivado project (available as PDF in the .zip archive)<\/figcaption><\/figure>\n\n\n\n<p>The data is propagating as AXIS streams, ensuring that the Finite Control Set MPC algorithm is executed at the sampling frequency. The <strong>AXIS broadcasters<\/strong> are receiving the gains from the Simulink model and dispatching them to the <strong>adc_gain <\/strong>blocks to apply them to the raw data. The \u03b1\u03b2-frame projection is then obtained at the output of the <strong>abc_ab0 <\/strong>blocks, before being fed to the <strong>mpc<\/strong>.<\/p>\n\n\n\n<p>The 3-bit output of the Finite Control Set MPC is cast within a 32-bit vector in the <strong>output_valid <\/strong>block and provided to the <strong>IX <\/strong>IP to be applied. The <strong>sw_frequ_meas<\/strong> block measures the actual switching frequency of the first phase with a 1-kHz resolution.<\/p>\n\n\n\n<p>The common-mode current minimization can be ignored by setting the <em>mode<\/em> parameter to 0 (instead of 1, by default), resulting in a reference tracking in the \u03b1\u03b2-frame only.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">The <em>pwm_output_observer<\/em> signal is used to observe the switching states in Cockpit. However, this is only possible when the CPU is running as fast as the FPGA (i.e. when the interrupt frequency is equal to the sampling frequency).<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Simulink-model-2\"><\/span>Simulink model<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The Simulink model required to use Cockpit and communicate with the FPGA is available in the .zip archive of the previous section. Additional information about the communication between the CPU and the FPGA can be found in <a href=\"https:\/\/imperix.com\/doc\/help\/getting-started-with-fpga-control-development#h-exchanging-data-using-m_axis_cpu2fpga-and-s_axis_fpga2cpu\">Getting started with FPGA control development<\/a>. An example of how to compute the gains is available in <a href=\"https:\/\/imperix.com\/doc\/software\/analog-data-acquisition#h-example-of-use\">ADC \u2013 Analog data acquisition<\/a>.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"712\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink_FPGA-1024x712.png\" alt=\"Simulink model for the proposed Finite Control Set MPC algorithm (FPGA)\" class=\"wp-image-26286\" style=\"width:675px;height:469px\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink_FPGA-1024x712.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink_FPGA-300x208.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink_FPGA-768x534.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Simulink_FPGA.png 1167w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Fig. 5 &#8211; Simulink model (FPGA)<\/figcaption><\/figure>\n<\/div>\n\n\n<p>The switching frequency (computed in the FPGA) is available as <em>sw_frequ<\/em>. This signal is updated every 1ms and has a 1-kHz resolution. The switching states are available as <em>state_{a,b,c}<\/em>. They require the CPU interrupt frequency to be equal to the sampling frequency to be shown correctly.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">The <em>activate<\/em> variable makes it possible to enable\/disable the PWM output, which is useful when using the Trigger or Transient tools of Cockpit.<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Validation-results-2\"><\/span>Validation results<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>To assess the transient performance of the control, the capacitor voltage reference is set to 250V at t=0, 100V at t=50ms, and subsequently to 330V at t=100ms.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"619\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_FPGA-1024x619.png\" alt=\"Reference tracking with the proposed algorithm (FPGA)\" class=\"wp-image-26285\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_FPGA-1024x619.png 1024w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_FPGA-300x181.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_FPGA-768x464.png 768w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_Cockpit_FPGA.png 1436w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Fig. 6 \u2013 Reference tracking using Cockpit (FPGA)<\/figcaption><\/figure>\n\n\n\n<p>The control algorithm correctly tracks the reference step change, confirming its proper operation.<\/p>\n\n\n\n<p>A zoom on the corresponding transient response is shown in Fig. 7, where the reference voltage amplitude is increased from 100V to 330V at t=100ms. The maximal reference slope is limited in the software to avoid high currents in the inverter modules. The rate limit is set to \u00b1330V\/ms. Even with this limitation, the setpoint is reached in less than 2% of the fundamental period (400us vs. 20ms).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"450\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_capacitor_voltage_reference.png\" alt=\"Transient response of the proposed Finite Control Set MPC controller\" class=\"wp-image-26521\" style=\"width:-158px;height:-91px\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_capacitor_voltage_reference.png 780w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_capacitor_voltage_reference-300x173.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/TN162_capacitor_voltage_reference-768x443.png 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><figcaption class=\"wp-element-caption\">Fig. 7 &#8211; Transient response of the proposed Finite Control Set MPC controller<\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The validation results of Fig. 3 and 6 show that the behavior of the Finite Control Set MPC is the same for the CPU and FPGA versions of the controller, both executed with a sampling frequency of 100kHz. The transient response is also particularly fast, as shown in Fig. 7, where the setpoint is reached in less than 2% of the fundamental period.<\/p>\n\n\n\n<p>Furthermore, the provided results show that the CPU-based implementation is exactly equivalent to its FPGA-based counterpart. As such, engineers are truly free to choose the implementation option of their liking. On one hand,  using the FPGA for the execution of the Finite Control Set MPC algorithms could be preferred as it spares CPU resources for other tasks. On the other hand, the CPU-based approach is significantly quicker and easier to implement and validate.<\/p>\n\n\n\n<p>Finally, it is also worth noting that further investigations on that topic (not displayed here) revealed that increasing the sampling frequency doesn&#8217;t necessarily reduce the current ripple, or significantly improve the control dynamics. Indeed, although simulation results are slightly better at 150kHz, laboratory tests done at 120 and 150kHz showed that this is not the case in practice. <\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">As provided, the FPGA implementation supports a sampling rate of up to 625kHz. However, to truly leverage such a high frequency, it would required to generate the reference voltage at the same rate, i.e. directly in the FPGA. For now, this is not the case.<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-references\"><span class=\"ez-toc-section\" id=\"References\"><\/span>References<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/ieeexplore.ieee.org\/document\/9082665\" target=\"_blank\" rel=\"noreferrer noopener\">[1]<\/a> H. A. Young, V. A. Marin, C. Pesce, and J. Rodriguez, &#8220;Simple Finite Control Set Model Predictive Control of Grid-Forming Inverters With LCL Filters,&#8221; in <em>IEEE Access<\/em>, April 2020.<\/p>\n\n\n\n<p><a href=\"https:\/\/ieeexplore.ieee.org\/book\/6198919\" target=\"_blank\" rel=\"noreferrer noopener\">[2]<\/a> J. Rodr\u00edguez and P. Cort\u00e9s, <em>Predictive Control of Power Converters and Electrical Drives<\/em>, Wiley, 2012.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.bing.com\/ck\/a?!&amp;&amp;p=8359138c1ce5f7e9JmltdHM9MTcwNTg4MTYwMCZpZ3VpZD0xYzYyOGI1ZC1mM2U4LTY0NGYtMjIxZC05ODIyZjI0YjY1YTcmaW5zaWQ9NTI0NA&amp;ptn=3&amp;ver=2&amp;hsh=3&amp;fclid=1c628b5d-f3e8-644f-221d-9822f24b65a7&amp;psq=A+new+scaling+and+squaring+algorithm+for+the+matrix+exponential%2c%e2%80%9d+SIAM&amp;u=a1aHR0cHM6Ly9lcHJpbnRzLm1hdGhzLm1hbmNoZXN0ZXIuYWMudWsvMTMwMC8xL2NvdmVyZWQvTUlNU19lcDIwMDlfOS5wZGY&amp;ntb=1\" target=\"_blank\" rel=\"noreferrer noopener\">[3]<\/a> A. Al-Mohy and N. Higham, &#8220;A New Scaling and Squaring Algorithm for the Matrix Exponential&#8221;, in <em>SIAM Journal on Matrix Analysis and Applications<\/em>, Vol. 31, 2009.<\/p>\n\n\n\n<p><a href=\"https:\/\/ieeexplore.ieee.org\/document\/8016597\" target=\"_blank\" rel=\"noreferrer noopener\">[4]<\/a> T. Dragi\u010devi\u0107, &#8220;Model Predictive Control of Power Converters for Robust and Fast Operation of AC Microgrids,&#8221; in <em>IEEE Trans. of Power Electronics<\/em>, July 2018.<\/p>\n\n\n\n<p><a href=\"https:\/\/ieeexplore.ieee.org\/document\/5771558\" target=\"_blank\" rel=\"noreferrer noopener\">[5]<\/a> P. Cortes, J. Rodriguez, C. Silva and A. Flores, &#8220;Delay Compensation in Model Predictive Current Control of a Three-Phase Inverter,&#8221; in <em>IEEE Trans. of Power Electronics<\/em>, Feb. 2012.<\/p>\n\n\n\n<p><a href=\"https:\/\/ieeexplore.ieee.org\/document\/9180048\" target=\"_blank\" rel=\"noreferrer noopener\">[6]<\/a> P. Karamanakos, E. Liegmann, T. Geyer and R. Kennel, &#8220;Model Predictive Control of Power Electronic Systems: Methods, Results, and Challenges,&#8221; in <em><em>IEEE Open Journal of Industry Applications<\/em>, <\/em>Vol. 1,&nbsp;2020.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article introduces an example of Finite Control Set Model Predictive Control (FCS-MPC) for an LCL-filtered voltage-controlled inverter. The proposed control implementation is derived from&#8230;<\/p>\n","protected":false},"author":17,"featured_media":28699,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"default","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[4],"tags":[],"software-environments":[105,106,103],"provided-results":[108],"related-products":[50,32,92,166,51,112,111,110],"guidedreadings":[],"tutorials":[],"user-manuals":[],"coauthors":[82,81],"class_list":["post-26600","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-implementation","software-environments-c-plus-plus","software-environments-fpga","software-environments-matlab","provided-results-experimental","related-products-acg-sdk","related-products-b-box-rcp","related-products-b-box-micro","related-products-b-box-rcp-3-0","related-products-cpp-sdk","related-products-peb","related-products-pm","related-products-tpi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Finite control set MPC for a voltage-controlled inverter - imperix<\/title>\n<meta name=\"description\" content=\"Finite Control Set Model Predictive Control for an LCL-filtered voltage-controlled inverter, with minimum output common-mode current.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Finite control set MPC for a voltage-controlled inverter - imperix\" \/>\n<meta property=\"og:description\" content=\"Finite Control Set Model Predictive Control for an LCL-filtered voltage-controlled inverter, with minimum output common-mode current.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc\" \/>\n<meta property=\"og:site_name\" content=\"imperix\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-21T13:15:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-18T10:35:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/3_2_ratio_TN162_2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Fran\u00e7ois Ledent, Daniel Blardone\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fran\u00e7ois Ledent, Daniel Blardone\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc\"},\"author\":{\"name\":\"Fran\u00e7ois Ledent\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/person\\\/1a0c3f44c7b64b1fd38dec245646aa8c\"},\"headline\":\"Finite control set MPC for a voltage-controlled inverter\",\"datePublished\":\"2024-03-21T13:15:24+00:00\",\"dateModified\":\"2025-12-18T10:35:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc\"},\"wordCount\":3045,\"publisher\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/3_2_ratio_TN162_2.png\",\"articleSection\":[\"Technical notes\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc\",\"name\":\"Finite control set MPC for a voltage-controlled inverter - imperix\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/3_2_ratio_TN162_2.png\",\"datePublished\":\"2024-03-21T13:15:24+00:00\",\"dateModified\":\"2025-12-18T10:35:56+00:00\",\"description\":\"Finite Control Set Model Predictive Control for an LCL-filtered voltage-controlled inverter, with minimum output common-mode current.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc#primaryimage\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/3_2_ratio_TN162_2.png\",\"contentUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/3_2_ratio_TN162_2.png\",\"width\":450,\"height\":300},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/implementation\\\/finite-control-set-mpc#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Knowledge base\",\"item\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Technical notes\",\"item\":\"https:\\\/\\\/imperix.com\\\/doc\\\/category\\\/implementation\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Finite control set MPC for a voltage-controlled inverter\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#website\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\",\"name\":\"imperix\",\"description\":\"power electronics\",\"publisher\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/imperix.com\\\/doc\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\",\"name\":\"imperix\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/imperix_logo.png\",\"contentUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/imperix_logo.png\",\"width\":350,\"height\":120,\"caption\":\"imperix\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/person\\\/1a0c3f44c7b64b1fd38dec245646aa8c\",\"name\":\"Fran\u00e7ois Ledent\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2021b1358e31ad6f0aa701e6470e41e82025de794c9a6b2014338cbea729454b?s=96&d=mm&r=g6a16fb4ee9f5452cba63eb2a62f66a0f\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2021b1358e31ad6f0aa701e6470e41e82025de794c9a6b2014338cbea729454b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2021b1358e31ad6f0aa701e6470e41e82025de794c9a6b2014338cbea729454b?s=96&d=mm&r=g\",\"caption\":\"Fran\u00e7ois Ledent\"},\"description\":\"Fran\u00e7ois is an electrical engineer working mainly on power applications and low-level FPGA developments. On the knowledge base, he is the author of several articles on a broad range of applications.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/francois-ledent\\\/\"],\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/author\\\/ledent\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Finite control set MPC for a voltage-controlled inverter - imperix","description":"Finite Control Set Model Predictive Control for an LCL-filtered voltage-controlled inverter, with minimum output common-mode current.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc","og_locale":"en_US","og_type":"article","og_title":"Finite control set MPC for a voltage-controlled inverter - imperix","og_description":"Finite Control Set Model Predictive Control for an LCL-filtered voltage-controlled inverter, with minimum output common-mode current.","og_url":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc","og_site_name":"imperix","article_published_time":"2024-03-21T13:15:24+00:00","article_modified_time":"2025-12-18T10:35:56+00:00","og_image":[{"width":450,"height":300,"url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/3_2_ratio_TN162_2.png","type":"image\/png"}],"author":"Fran\u00e7ois Ledent, Daniel Blardone","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Fran\u00e7ois Ledent, Daniel Blardone","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc#article","isPartOf":{"@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc"},"author":{"name":"Fran\u00e7ois Ledent","@id":"https:\/\/imperix.com\/doc\/#\/schema\/person\/1a0c3f44c7b64b1fd38dec245646aa8c"},"headline":"Finite control set MPC for a voltage-controlled inverter","datePublished":"2024-03-21T13:15:24+00:00","dateModified":"2025-12-18T10:35:56+00:00","mainEntityOfPage":{"@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc"},"wordCount":3045,"publisher":{"@id":"https:\/\/imperix.com\/doc\/#organization"},"image":{"@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc#primaryimage"},"thumbnailUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/3_2_ratio_TN162_2.png","articleSection":["Technical notes"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc","url":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc","name":"Finite control set MPC for a voltage-controlled inverter - imperix","isPartOf":{"@id":"https:\/\/imperix.com\/doc\/#website"},"primaryImageOfPage":{"@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc#primaryimage"},"image":{"@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc#primaryimage"},"thumbnailUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/3_2_ratio_TN162_2.png","datePublished":"2024-03-21T13:15:24+00:00","dateModified":"2025-12-18T10:35:56+00:00","description":"Finite Control Set Model Predictive Control for an LCL-filtered voltage-controlled inverter, with minimum output common-mode current.","breadcrumb":{"@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc#primaryimage","url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/3_2_ratio_TN162_2.png","contentUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2024\/03\/3_2_ratio_TN162_2.png","width":450,"height":300},{"@type":"BreadcrumbList","@id":"https:\/\/imperix.com\/doc\/implementation\/finite-control-set-mpc#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Knowledge base","item":"https:\/\/imperix.com\/doc\/"},{"@type":"ListItem","position":2,"name":"Technical notes","item":"https:\/\/imperix.com\/doc\/category\/implementation"},{"@type":"ListItem","position":3,"name":"Finite control set MPC for a voltage-controlled inverter"}]},{"@type":"WebSite","@id":"https:\/\/imperix.com\/doc\/#website","url":"https:\/\/imperix.com\/doc\/","name":"imperix","description":"power electronics","publisher":{"@id":"https:\/\/imperix.com\/doc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/imperix.com\/doc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/imperix.com\/doc\/#organization","name":"imperix","url":"https:\/\/imperix.com\/doc\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/imperix.com\/doc\/#\/schema\/logo\/image\/","url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/imperix_logo.png","contentUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/imperix_logo.png","width":350,"height":120,"caption":"imperix"},"image":{"@id":"https:\/\/imperix.com\/doc\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/imperix.com\/doc\/#\/schema\/person\/1a0c3f44c7b64b1fd38dec245646aa8c","name":"Fran\u00e7ois Ledent","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2021b1358e31ad6f0aa701e6470e41e82025de794c9a6b2014338cbea729454b?s=96&d=mm&r=g6a16fb4ee9f5452cba63eb2a62f66a0f","url":"https:\/\/secure.gravatar.com\/avatar\/2021b1358e31ad6f0aa701e6470e41e82025de794c9a6b2014338cbea729454b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2021b1358e31ad6f0aa701e6470e41e82025de794c9a6b2014338cbea729454b?s=96&d=mm&r=g","caption":"Fran\u00e7ois Ledent"},"description":"Fran\u00e7ois is an electrical engineer working mainly on power applications and low-level FPGA developments. On the knowledge base, he is the author of several articles on a broad range of applications.","sameAs":["https:\/\/www.linkedin.com\/in\/francois-ledent\/"],"url":"https:\/\/imperix.com\/doc\/author\/ledent"}]}},"_links":{"self":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/26600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/comments?post=26600"}],"version-history":[{"count":41,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/26600\/revisions"}],"predecessor-version":[{"id":39180,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/26600\/revisions\/39180"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/media\/28699"}],"wp:attachment":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/media?parent=26600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/categories?post=26600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/tags?post=26600"},{"taxonomy":"software-environments","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/software-environments?post=26600"},{"taxonomy":"provided-results","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/provided-results?post=26600"},{"taxonomy":"related-products","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/related-products?post=26600"},{"taxonomy":"guidedreadings","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/guidedreadings?post=26600"},{"taxonomy":"tutorials","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/tutorials?post=26600"},{"taxonomy":"user-manuals","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/user-manuals?post=26600"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/coauthors?post=26600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}