A Contemporary Design Process for Single-Phase Voltage Source Inverter Control Systems

This paper presents an overview of contemporary voltage source inverter control system design. Design begins with the theoretical considerations that lead to the creation of the system’s differential control law. This stage does not include scaling coefficients for the output voltage, output current, and filter inductor current. Following this, the inverter is modelled in MATLAB’s Simulink environment with an appropriate load and control system. If the resultant simulation provides satisfactory results, a hybrid system consisting of MATLAB’s Simulink and dSpace libraries with the MicroLabBox device is used to interface the simulation with an experimental hardware model in real-time. This allows the hardware plant and measuring traces to be validated. ControlDesk is used to scale the relevant coefficients. During the final stage of the design process, a microprocessor is programmed to control the inverter according to the dSpace simulation results. This requires new scaling values. Throughout every stage of the design process, too high a value of the modulation index disables the reduction of output voltage distortions. This paper details the entire design process for both single-input and multi-input control systems, explaining the scaling process and the required software. Such a modern design process ensures the shortest time between conceptualization and the final product.


Introduction
The design of a voltage source inverter (VSI) control system begins with a theoretical description of the differential control law that governs the system. The control system should then be verified via simulation (the standard approach is to use MATLAB's Simulink environment) before finally being implemented on the microprocessor or FPGA system of the experimental VSI. Continuous control laws require further discretization so better is to use the discrete control laws at the beginning. Following validation of the experimental VSI, the final product can be realized. Ideally, this approach is fast and effective. However, following theoretical calculations the output voltage, output current, and filter inductor current scaling factors remain undetermined. These factors all affect the coefficients within the control law. The scaling of voltages and currents in simulation is straightforward. The reference voltage amplitude is defined as unity, and all voltage and current measurements are divided by the input DC voltage. Contemporary design methodologies feature one additional step. Via a MicroLabBox-RTI1202 real-time interface hardware, the dSpace software (including libraries) can be used to drive the experimental VSI using the Simulink model. Throughout all stages of the design process, too high a value of the modulation index disables output voltage distortions from being reduced. The pulse-width modulation (PWM) modulator can become saturated during dynamic increases of the load [1]. However, a modulation index that is too low decreases the efficiency of the VSI. To strike a balance, the modulation index is set to 60% throughout this paper. The literature contains many examples of the use of dSpace with different real-time interfaces in power electronic systems [2][3][4]. However, this paper demonstrates the entire process by which dSpace is used with a real-time hardware interface during the design process of a VSI. When using MicroLabBox the scaling process is similar to that of the final microprocessor controller, because the voltage and currents are amplified within the experimental VSI device and the hardware VSI plant is controlled. Furthermore, the reference sinusoidal waveform amplitude that corresponds to a modulation index of 100% depends on the PWM modulation scheme [5][6][7]. The reference waveform amplitude takes the value of unity for the Simulink modulator, and 0.5 for the dSpace modulator used for the first modulation scheme in this paper. When subject to microprocessor control, the amplitude depends on the quotient of the PWM unit comparator input frequency and the switching frequency (in the presented experiment it is 1640). The final step of the design process is the implementation of the controller on the microprocessor. Other than when using Simulink, this requires further scaling of the current versus voltage measurements. The scaling process requires dedicated software: dSpace requires ControlDesk; microprocessor control requires dedicated PC software that can support data exchange with the inverter via a USB port. An additional problem is the evaluation of a Bode plot of the measurement traces [8,9]. This is typically modelled within a frequency range lower than the resonant frequency of the output filter as a simple delay, with one switching period for the amplifiers and one switching period for the PWM modulator [10].
The objective of this paper is to provide a detailed account of the contemporary design of VSI control systems. This process will be demonstrated using two examples. The first example is a simple single input single output (SISO) control system that uses the discretized coefficient diagram method (CDM) [10][11][12][13][14][15][16], requiring only a single input variable: output voltage. The second example is a more complex multiple input single output (MISO) control system using passivity-based control (PBC) [10][11][12][17][18][19][20], with measurements of the output voltage, output current, and inductor current. Specifically, this paper uses improved PBC v2 (IPBC2) [10]. Figure 1 presents the entire VSI controller design process, from the theoretical description to the final product. This includes the use of MATLAB's Simulink environment, the combination of dSpace and ControlDesk via a MicroLabBox-RTI1202 real-time interface, Keil µVision C++, dedicated PC software written in C#, and the experimental model with a STM32F407VG microprocessor. The novelty of the paper is: 1.
Presentation of the full process of design-from a theoretical background, through the simulation, using real time interface (RTI) and dSpace libraries up to the final stage of the design process-programming the microprocessor that will control the VSI. Using real time interface creates design much more flexible.

2.
Definition of requirements of the design process final success: The control law should be realized in a similar way in all the stages of the design process. It means that in the simulation the input controller data and supply of the reference waveform was measured using a sample time equal to the switching period. The PWM modulator should have the sample time equal to the period of the waveform on the input of the microprocessor PWM unit comparator (the much higher frequency than the switching frequency).
The real time interface and the microprocessor should use the same software architecture based on interrupts (trigger events in case of the RTI) from the PWM modulator.
The scaling procedure is crucial because wrong scaling changes the control law coefficients. In none of the referred papers [2][3][4] concerning the RTI usage, the scaling procedure of voltages and currents is presented. In [3] where the RTI-MicroLabBox and dSpace software was used there is nothing about using ControlDesk-the software that enables scaling.
Scaling the microprocessor controller requires data transfer from the PC and using specialized software to visualize the measured values scaled in units of the analog-to-digital converter used in the microprocessor. The scaling procedure depends on the ratio of the PWM modulator comparator input frequency and the switching frequency. It is described in detail in the presented paper. This paper will be useful for engineers and researchers who design VSIs, by presenting them the novel suite of design tools and techniques that are required, in addition to instructions on their application. Using RTI (MicroLabBox with dSpace) makes the design process more flexible and faster.
Sections 2-5 present the design process for SISO CDM control, and Sections 6-9 present the design process for MISO PBC control. The control results are presented and compared using the total harmonic distortion (THD) of the VSI output voltage for a nonlinear rectifier RC load with power factor PF = 0.7. Figure 2 shows a VSI with a SISO controller. The output current is treated as an independent disturbance or the state variable, with the same result in both cases [11,16,[20][21][22][23][24].

Theoretical Background of SISO CDM Control Materials
The novelty of the paper is: 1. Presentation of the full process of design-from a theoretical background, through the simulation, using real time interface (RTI) and dSpace libraries up to the final stage of the design process-programming the microprocessor that will control the VSI. Using real time interface creates design much more flexible. 2. Definition of requirements of the design process final success: (a) The control law should be realized in a similar way in all the stages of the design process. It means that in the simulation the input controller data and supply of the reference waveform was measured using a sample time equal to the switching period. The PWM modulator should have the sample time equal to the period of the waveform on the input of the microprocessor PWM unit comparator (the much higher frequency than the switching frequency). (b) The real time interface and the microprocessor should use the same software architecture based on interrupts (trigger events in case of the RTI) from the PWM modulator. (c) The scaling procedure is crucial because wrong scaling changes the control law coefficients. In none of the referred papers [2][3][4] concerning the RTI usage, the scaling procedure of voltages and currents is presented. In [3] where the RTI-MicroLabBox and dSpace software was used there is nothing about using Con-trolDesk-the software that enables scaling.
Scaling the microprocessor controller requires data transfer from the PC and using specialized software to visualize the measured values scaled in units of the analog-to-digital converter used in the microprocessor. The scaling procedure depends on the ratio of the PWM modulator comparator input frequency and the switching frequency. It is described in detail in the presented paper. This paper will be useful for engineers and researchers who design VSIs, by presenting them the novel suite of design tools and techniques that are required, in addition to instructions on their application. Using RTI (MicroLabBox with dSpace) makes the design process more flexible and faster.
Sections 2-5 present the design process for SISO CDM control, and Sections 6-9 present the design process for MISO PBC control. The control results are presented and compared using the total harmonic distortion (THD) of the VSI output voltage for a nonlinear rectifier RC load with power factor PF = 0.7. Figure 2 shows a VSI with a SISO controller. The output current is treated as an independent disturbance or the state variable, with the same result in both cases [11,16,[20][21][22][23][24].   One of the simplest control designs is Manabe's CDM controller [13,14,16], which uses T, S, and R polynomials. In its most basic form, the coefficients of the closed-loop characteristic equation are calculated from Manabe standard form. These coefficients provide the control for the time constant τ of the closed-loop system. The output voltage of a closed loop system with the output current treated as an independent disturbance is given by (1):

Theoretical Background of SISO CDM Control Materials
where N(s) contains all the loop delays. The characteristic equation of a closed-loop system is given by (2): To calculate the controller parameters, a model of the inverter plant is required [6]. For this paper, the inverter plant was modelled as an output L F C F filter described by the assigned state variables (3): and the state Equation (4): where matrix A and B are given by (5): The state Equation (4) are solved during a single k-th switching period T s , for double edge three-level PWM, with a switching-on time period T ONk . The solution of the state space equations depends on the type of modulation-double edge, three-level modulation was chosen as the most suitable for a four-transistor bridge. Some schemes of this type of modulation are presented in [5][6][7]. This paper uses the first presented scheme, as this is most appropriate for instantaneous control. An overview of the scheme is shown in Figure 3. The advantages of this controller include the possibility of controlling output voltage when crossing zero, and an output switching frequency double that of the transistor switching frequency.
One of the simplest control designs is Manabe's CDM controller [13,14,16], which uses T, S, and R polynomials. In its most basic form, the coefficients of the closed-loop characteristic equation are calculated from Manabe standard form. These coefficients provide the control for the time constant τ of the closed-loop system. The output voltage of a closed loop system with the output current treated as an independent disturbance is given by (1): where N(s) contains all the loop delays. The characteristic equation of a closed-loop system is given by (2): To calculate the controller parameters, a model of the inverter plant is required [6]. For this paper, the inverter plant was modelled as an output LFCF filter described by the assigned state variables (3): and the state Equation (4): where matrix A and B are given by (5): The state Equations (4) are solved during a single k-th switching period Ts, for double edge three-level PWM, with a switching-on time period TONk. The solution of the state space equations depends on the type of modulation-double edge, three-level modulation was chosen as the most suitable for a four-transistor bridge. Some schemes of this type of modulation are presented in [5][6][7]. This paper uses the first presented scheme, as this is most appropriate for instantaneous control. An overview of the scheme is shown in Figure 3. The advantages of this controller include the possibility of controlling output voltage when crossing zero, and an output switching frequency double that of the transistor switching frequency.   Each transistor within the two legs of the H-bridge is switched with frequency f s . However, the final switching frequency of the output waveform is 2f s , due to the current flowing through the pairs of switches connected in series: S 1 and S 4 or S 3 and S 2 . This results in two output pulses during a single switching period. Within the modulation scheme the control of the switches can be described analytically as (6)-(9): S 3 : where T ON is the switching on time during a single switching period T s = 1/f s , and k = 0 . . . (f s /f m −1) and f s /f m is an integer. Solving the state space equations provides the exponential function x k+1 of T ONk , which can then be linearized [6]. This gives the discrete linear state Equation (10): where the state matrix A D and the state matrix G D are given by (11), (12): with coefficients φ ij (13) and g i1 (14): For a double edge PWM and a digital modulator implementing all the required loop delays, the VSI gain is given by (15): where (16): For a system that is subject to a disturbance, the degrees of R and S are greater than or equal to n − 1, where n is the degree of D. The second degree of S and the second degree of R are given by (17): The underlying objective of CDM control is to obtain the s i and r i coefficients are thereby solve the Diophantine Equation (18): which can be written as (19): where the p zi coefficients are assigned from the Manabe standard form, and it was assumed that r 0 = p 0 = 1. The coefficients p i of the fifth degree of Manabe standard form for a continuous system are given by where τ is the time constant of a closed-loop system. For f s = 25,600 Hz, satisfactory experimental results were obtained with τ = 5.5T s . Lower values of τ lead to output voltage oscillations; higher values of τ lead to poorer control. Via the zero-order hold method and a discretization cycle of T s = 1/25,600 s, the MATLAB c2d function was used to obtain a discrete-time transfer function (20): For τ = 5.5T s (T s = 1/25,600 s), The accurate calculation of T(z −1 ) = t 0 enables v OUT = v REF to be maintained in the steady state (21): The experimental model used the following parameters: L F = 2 mH, C F = 51 µF, R se = 1 Ω, and f s = 25,600 Hz. Using these values, and with τ = 5.5T s , the solutions of Equation (19) are The coefficient t 0 can be adjusted individually and is multiplied by the modulation index M. This should always be less than unity to allow for the rapid increase of the voltage in the input of the output filter. The difference control law for CDM control is given by (22): which contains no scaling coefficient. The scaling coefficients will be further incorporated into Equation (22).

MATLAB's Simulink Simulation of SISO CDM Control
As shown in Figure 4, the controller was modelled in the Simulink environment of MATLAB R2021b. The Simulink model was tested with the calculated scaling coefficients. The simulation results are shown in Figure 5. The scaling coefficient is simply 1/V DC , because the reference sinusoidal waveform sin(2π50t) has a unity amplitude. The PWM modulator unit has an input range of ±1. The output voltage measuring trace is modelled as a single switching period delay [10], with the PWM modulator contributing an additional delay of T s . The most demanding test load is the nonlinear rectifier RC load (Figure 5c,d present it for R = 100 Ω, C = 430 µF, when PF = 0.7). This is defined by the EN 62040 standard [25] as the most common load for an uninterruptible power supply with an output power of less than 3 kW. Figure 5a,b show a less demanding nonlinear load with R = 100 Ω and C = 100 µF.  (Figure 5a,c). The CDM controller was tested using a relatively low modulation index of M = 0.6 to prevent the saturation of the modulator that can occur for higher values of M. The same value will be used throughout this paper.

Interfacing MATLAB's Simulink and dSpace Simulation of the SISO CDM Controller with the Experimental Model
Following initial simulations in Simulink, the MicroLabBox RTI1202 real-time interface was used to interface dSpace simulation blocks with the experimental model. To this end, the dSpace RTI1202 FPGA and dSpace RTI Electric Motor Control Blockset libraries were used. The compiled simulation was automatically loaded onto the Micro-LabBox FPGA to provide high speed data conversion and computation with little time delay. The simulation should be designed to imitate the microprocessor procedure as closely as possible. The microprocessor control software used an infinite main loop (defined using while (1)), with the "watchdog" and all functions are handled by PWM interrupts which fetch the analogue-to-digital converter (ADC) values of the output voltage. In the dSpace simulation, the interrupts are represented by Trigger line 1 events from an EMC Multichannel PWM block, which are handled by an ADC Class 1 Hardware Interrupt block. This Hardware Interrupt (HWINT) block is connected to the input port of the Function-Call Subsystem, which contains all the components of the inverter control blocks, including the EMC Multichannel PWM block and the ADC Class 1 block. The sample time of each of these blocks is inherited from the PWM block triggering event. In a similar manner to the microprocessor software, the switching frequency is the input of the PWM block.

Interfacing MATLAB's Simulink and dSpace Simulation of the SISO CDM Controller with the Experimental Model
Following initial simulations in Simulink, the MicroLabBox RTI1202 real-time interface was used to interface dSpace simulation blocks with the experimental model. To this end, the dSpace RTI1202 FPGA and dSpace RTI Electric Motor Control Blockset libraries were used. The compiled simulation was automatically loaded onto the MicroLabBox FPGA to provide high speed data conversion and computation with little time delay. The simulation should be designed to imitate the microprocessor procedure as closely as possible. The microprocessor control software used an infinite main loop (defined using while (1)), with the "watchdog" and all functions are handled by PWM interrupts which fetch the analogueto-digital converter (ADC) values of the output voltage. In the dSpace simulation, the interrupts are represented by Trigger line 1 events from an EMC Multichannel PWM block, which are handled by an ADC Class 1 Hardware Interrupt block. This Hardware Interrupt (HWINT) block is connected to the input port of the Function-Call Subsystem, which contains all the components of the inverter control blocks, including the EMC Multichannel PWM block and the ADC Class 1 block. The sample time of each of these blocks is inherited from the PWM block triggering event. In a similar manner to the microprocessor software, the switching frequency is the input of the PWM block.
Once loaded with the control software, MicroLabBox can drive the experimental inverter using four DIO Class 1 3.3 V digital outputs, operating on channels 1-4. Micro-LabBox receives the measured output voltage via the ADC Class 1 channel 1, with a single conversion (−10-+10 V input range) following the trigger event from the PWM block. The PWM block is configured to drive a block of four transistors with inverting signals for the low transistors. A 500 ns dead time is implemented for the experimental inverter. For the case of inverted channels set as active, the block automatically reserves the same number of channels for inverted signals as specified for non-inverted signals. The first inverted channel is channel 3, corresponding to S 2 in Figure 3. The second inverted channel is channel 4, corresponding to S 4 in Figure 3. The PWM block inputs take values in the range 0-1. Hence, the input waveforms are sinusoidal with an amplitude of 0.5, shifted mutually 180 degrees in phase and both raised 0.5 with zero level. The generation of the two shifted strings for the PWM block inputs is presented in Figure 6. The measured output voltage waveforms are visualized via ControlDesk, which is part of the dSpace software package. The output voltage is scaled by using the Time Plotter feature of ControlDesk to compare two waveforms. For an open loop system and a nominal resistance load of 50 Ω, the measured output voltage should be given by the reference waveform 0.5sin(2π50t). Once these waveforms have been equalized, by changing the gain of the output voltage, the output voltage gain value is set as a scaling coefficient. The measuring trace can reverse the sign of the signal (in the experimental model), so the sign must be set correctly. With a modulation index of M = 0.6, it was found an output voltage scaling coefficient of −2.

Implementation of the CDM Controller in the VSI Microprocessor
The final step of the design process was to implement the validated controller on the STM32F407VG microprocessor. The microprocessor code was written in Keil μVision 5 C++. As described in Section 4, the main function of the code consists of an infinite loop, with functions called by an event handler that waits for PWM unit interrupts. Hence, the control process is identical to that provided by MicroLabBox. However, the two approaches differ in terms of the scaling of the output voltage measuring trace. The dedicated PC application that handles data transmission, data visualization, and communication with the microprocessor-controlled inverter via USB port was written in C#. The purpose of this application is analogous to the role played by the ControlDesk software for the MicroLabBox controlled system. However, in the older solutions, it was possible to use the digital-to-analogue converter implemented in the microprocessor to visualize on the oscilloscope the internal waveforms from the microprocessor without the dedicated PC software. The reference voltage takes the form 0.5fCOMPmax/fssin(2π50t), where fCOMPmax is the maximum frequency on the input of the PWM unit comparator and fs is the switching frequency. Hence, the peak-to-peak amplitude of the reference voltage is given by fCOMPmax/fs. For the experimental inverter, fCOMPmax/fs = 84 MHz/25,600 Hz ≈ 3281. Therefore, the maximum amplitude of the reference waveform was 1640. The 13-bit (12 bits plus the sign) ADC controller allowed measurement in the range −4095-4095. Using the visualization provided by the PC application, the hardware gain of the voltage measurement trace was adjusted to a nominal output voltage amplitude of 3000 units-Greater than the reference amplitude of 1640 units. This provided more accurate measurement across the entire ADC range. Finally, the voltage gain scaling coefficient gv should be 1640/3000. Again, a modulation index of M = 0.6 was used. Figure 8 shows the output current and voltage and inductor current waveforms when using microprocessor control, in addition to an image of the experimental setup.

Implementation of the CDM Controller in the VSI Microprocessor
The final step of the design process was to implement the validated controller on the STM32F407VG microprocessor. The microprocessor code was written in Keil µVision 5 C++. As described in Section 4, the main function of the code consists of an infinite loop, with functions called by an event handler that waits for PWM unit interrupts. Hence, the control process is identical to that provided by MicroLabBox. However, the two approaches differ in terms of the scaling of the output voltage measuring trace. The dedicated PC application that handles data transmission, data visualization, and communication with the microprocessor-controlled inverter via USB port was written in C#. The purpose of this application is analogous to the role played by the ControlDesk software for the MicroLabBox controlled system. However, in the older solutions, it was possible to use the digital-toanalogue converter implemented in the microprocessor to visualize on the oscilloscope the internal waveforms from the microprocessor without the dedicated PC software. The reference voltage takes the form 0.5f COMPmax /f s sin(2π50t), where f COMPmax is the maximum frequency on the input of the PWM unit comparator and f s is the switching frequency. Hence, the peak-to-peak amplitude of the reference voltage is given by f COMPmax /f s . For the experimental inverter, f COMPmax /f s = 84 MHz/25,600 Hz ≈ 3281. Therefore, the maximum amplitude of the reference waveform was 1640. The 13-bit (12 bits plus the sign) ADC controller allowed measurement in the range −4095-4095. Using the visualization provided by the PC application, the hardware gain of the voltage measurement trace was adjusted to a nominal output voltage amplitude of 3000 units-Greater than the reference amplitude of 1640 units. This provided more accurate measurement across the entire ADC range. Finally, the voltage gain scaling coefficient g v should be 1640/3000. Again, a modulation index of M = 0.6 was used. Figure 8 shows the output current and voltage and inductor current waveforms when using microprocessor control, in addition to an image of the experimental setup.

Theoretical Background of MISO PCB Control
Without direct measurement of the output current (an independent disturbance), SISO control is unable to precisely control the output voltage in the case of large, rapid changes in the output current for a standard [25] nonlinear rectifier RC load. This functionality is provided by MISO PCB control. For IPBC2, the output voltage, output current, and inductor current are input variables of the controller. Figure 9 models the control of a VSI by MISO. It was shown in [10] that each of the experimental model's measurement traces can be approximately modelled as a single switching period delay. For the described system, this delay had a value of 39 μs. The additional delay is implemented by the PWM modulator, with the data stored in its registers during the kth period controlling the width of the pulses during the k+1th period. Two different MISO PBC controllers were tested: one that did not account for the double switching period delay, and one that made a simplified prediction of the state variables in subsequent periods using the discrete model of a VSI [12]. There was no noticeable difference between the two controllers in terms of the quality of the VSI output voltage at a relatively high switching frequency of fs = 25,600 Hz, and with CF = 50 μF. The simplified approach is sufficient for the presentation of the VSI control design methodology.

Theoretical Background of MISO PCB Control
Without direct measurement of the output current (an independent disturbance), SISO control is unable to precisely control the output voltage in the case of large, rapid changes in the output current for a standard [25] nonlinear rectifier RC load. This functionality is provided by MISO PCB control. For IPBC2, the output voltage, output current, and inductor current are input variables of the controller. Figure 9 models the control of a VSI by MISO. It was shown in [10] that each of the experimental model's measurement traces can be approximately modelled as a single switching period delay. For the described system, this delay had a value of 39 µs. The additional delay is implemented by the PWM modulator, with the data stored in its registers during the kth period controlling the width of the pulses during the k+1th period. Two different MISO PBC controllers were tested: one that did not account for the double switching period delay, and one that made a simplified prediction of the state variables in subsequent periods using the discrete model of a VSI [12]. There was no noticeable difference between the two controllers in terms of the quality of the VSI output voltage at a relatively high switching frequency of f s = 25,600 Hz, and with C F = 50 µF. The simplified approach is sufficient for the presentation of the VSI control design methodology. The load current i OUT is treated as the independent disturbance and is modelled as the current source. The load current iOUT is treated as the independent disturbance and is modelled as the current source. The central principle of PBC is that the system is stable if it is passive. The system is passive if the energy supplied to it exceeds the stored energy. Energy is stored within two non-dissipative components-The filter coil and the filter capacitor. The energy stored within a system is described by the Hamiltonian function H(x) (also known as the Lyapunov function [18]). The Hamiltonian function of the error vector e is (23): where The equilibrium of a closed-loop system is asymptotically stable [19] if H(e) has a minimum at x = xref (25): The system is passive if the time derivative of H(e) is negative (26): The control law of IPBC2 for single-phase inverters is based on the control law for interconnection and damping assignment PBC (IDAPBC) [17,19,20]. The equation for a closed loop PBC system is given by (27): The equation for an open loop system is given by (28): The IPBC2 control law is given by the difference between the closed loop and open loop Equation (29): The central principle of PBC is that the system is stable if it is passive. The system is passive if the energy supplied to it exceeds the stored energy. Energy is stored within two non-dissipative components-The filter coil and the filter capacitor. The energy stored within a system is described by the Hamiltonian function H(x) (also known as the Lyapunov function [18]). The Hamiltonian function of the error vector e is (23): where The equilibrium of a closed-loop system is asymptotically stable [19] if H(e) has a minimum at x = x ref (25): The system is passive if the time derivative of H(e) is negative (26): The control law of IPBC2 for single-phase inverters is based on the control law for interconnection and damping assignment PBC (IDAPBC) [17,19,20]. The equation for a closed loop PBC system is given by (27): The equation for an open loop system is given by (28): The IPBC2 control law is given by the difference between the closed loop and open loop Equation (29): The interconnection matrix J, the damping matrix R, and the PBC controller matrix R a , are defined as (30): where R i is the current error gain, K v is the voltage error conductive gain, and R LFe is the serial equivalent resistance of the inverter. The final form of the IPBC2 control law is then given by (31) and (32): Now consider a difference control law for a single-phase VSI with a PBC that is easy to implement using microprocessor control (33) and (34): This difference control law (Equations (33) and (34)) is used throughout the development of the MISO PCB controller, including MATLAB's Simulink simulations, the MicroLabBox interfaced dSpace simulations, and the microprocessor control of the VSI.
The values R LFe + R i and K v should be positive. This allows the closed loop IPBC system [10,11] to have roots λ 1,2 with negative real components (35): The real components of these roots are always negative for positive values R LFe + R i and K v . As such, this condition does not provide any upper bounds for current and voltage gains. The higher the gains, the greater the convergence of the error tracking. However, excessively high IPBC2 gain values can cause oscillations of the VSI output voltage. Such oscillations occur when the control voltage increases more quickly than the width of the PWM pulses can change. This creates a saturation-like effect within the control loop. The higher the switching frequency, the higher the speed of the PWM modulator, and hence the maximum acceptable gains [11]. The fastest change in modulation during a single switching period T s is V DC (V DC /T s ). At all times, the delay of the modulator is omitted. During a single sampling period, the approximation d(v OUTref )/dt ≈ 0 can be made. Therefore, from Equation (34) it was obtained (36), (37) and (39): Correspondingly, from Equation (33) it obtained (39) and (40): During a single switching cycle, for R LOAD >> 1/(2πf s C F ), the following approximations (41), (42) can be made: From Equation (43) it was obtained the upper boundary conditions on the gains R i and K v (43): Equation (43) demonstrates the influence of switching frequency f s = 1/T s on the maximum values of the gains R i and K v . Figure 10 demonstrates the mutual relationship between the two gain values. In accordance with Figure 10b, throughout this paper safe gain values of R i = 15 Ω and K v = 0.3 1/Ω are used.
During a single switching cycle, for RLOAD >> 1/(2πfsCF), the following approximations (41), (42) can be made: From Equation (43) it was obtained the upper boundary conditions on the gains Ri and Kv (43): Equation (43) Figure 11 presents the Simulink simulation model. The THD is very low, with the MISO-PBC controller (33), and (34) perfectly damping disturbances in the output voltage. The modulation coefficient is less than unity to allow the control voltage to increase. The results of the simulation are ideal; the quantity of THD present is almost negligible. This is a result of using the currents as controller inputs. The scaling coefficient for each of the output voltage, output current, and inductor current is simply 1/VDC. The modulation index is M = 0.6.  Figure 11 presents the Simulink simulation model. The THD is very low, with the MISO-PBC controller (33), and (34) perfectly damping disturbances in the output voltage. The modulation coefficient is less than unity to allow the control voltage to increase. The results of the simulation are ideal; the quantity of THD present is almost negligible. This is a result of using the currents as controller inputs. The scaling coefficient for each of the output voltage, output current, and inductor current is simply 1/V DC . The modulation index is M = 0.6.  Figure 12a shows the combined Simulink and dSpace models. Shown in Figure 12c, three independent ADCs are used for the output voltage, the output current, and the inductor current. Each ADC is triggered by PWM events. The gain values of Ri = 15 Ω and Kv = 0.3 1/Ω are the same as the Simulink model ( Figure 11). The modulation index is M = 0.6. However, new scaling of the three measured signals is required. For open loop control with a load of nominal resistance 50 Ω and minimum output capacitance of CF = 1 μF, which ensures that currents IOUT and ILF are approximately equal at the 50 Hz harmonic, the voltage and current traces should have sufficient amplification that they are equal to the reference voltage. The amplification includes the gain of the experimental model measuring traces. The reference voltage is given by 0.5sin(2π50t), as shown in Figure 12b.

Interfacing MATLAB's Simulink and dSpace Simulation of the MISO PBC Controller with the Experimental Model
Note that although the figure shows an amplitude of 0.45, the maximum amplitude is 0.5. Finally, the current values are divided by the value of RNOM: 50 Ω in the presented case. Experimental model measurements [10] show that the delay of the measuring traces and the PWM modulator at fs = 25,600 Hz can be omitted when designing the controller. Con-trolDesk software (Figure 12b) was used to tune the scaling coefficients of the measuring  Figure 12a shows the combined Simulink and dSpace models. Shown in Figure 12c, three independent ADCs are used for the output voltage, the output current, and the inductor current. Each ADC is triggered by PWM events. The gain values of R i = 15 Ω and K v = 0.3 1/Ω are the same as the Simulink model ( Figure 11). The modulation index is M = 0.6. However, new scaling of the three measured signals is required. For open loop control with a load of nominal resistance 50 Ω and minimum output capacitance of C F = 1 µF, which ensures that currents I OUT and I LF are approximately equal at the 50 Hz harmonic, the voltage and current traces should have sufficient amplification that they are equal to the reference voltage. The amplification includes the gain of the experimental model measuring traces. The reference voltage is given by 0.5sin(2π50t), as shown in Figure 12b. Note that although the figure shows an amplitude of 0.45, the maximum amplitude is 0.5. Finally, the current values are divided by the value of R NOM : 50 Ω in the presented case. Experimental model measurements [10] show that the delay of the measuring traces and the PWM modulator at f s = 25,600 Hz can be omitted when designing the controller. ControlDesk software (Figure 12b) was used to tune the scaling coefficients of the measuring traces. The final gain values were −2 for output voltage, 2.65/50 for output current, and 2.60/50 for inductor current.    Figure 13 shows the distortions in the output voltage of the VSI when controlled by MicroLabBox. Unlike for SISO-CDM control (Figure 7), the current waveforms are shaped accurately. This is due to MISO control of the output and inductor currents.

Implementation of the MISO PBC Controller in the VSI Microprocessor
The STM32F407VG microprocessor was chosen due to its fast clock speed of 168 MHz, in addition to its 84 MHz maximum PWM comparator input frequency. The microprocessor is capable of floating point hardware operation and has three independent ADCs that can be simultaneously used to measure the output voltage, output current, and inductor current. The amplitude of the reference voltage is 0.5fCOMPmax/fs = 0.5 × 84 MHz/25600 ≈ 1640. The ADCs obtain measurements in the range −4095-4095. During scaling the system should function under open loop control, with a small output capacitance of CF = 1 μF and a nominal resistive load of 50 Ω. When using the dedicated PC application to transmit data from the VSI the output voltage is hardware adjusted to 3000 units. Hence, the voltage scaling coefficient is 1640/3000 = 0.547. The current values vary, and as such, they are tuned to a lower value of 2000, from within the −4095-4095 range. With a resistive load of 50 Ω, the current scaling coefficient is (1640/2000)/50 = 0.0164. The modulation index is M = 0.6. Figure 14 shows the scaling of voltage measurements, in addition to the measured output voltage and current of the VSI. Control of the current substantially affects the shape of the current waveforms, and reduces distortion of the output voltage. (a)

Implementation of the MISO PBC Controller in the VSI Microprocessor
The STM32F407VG microprocessor was chosen due to its fast clock speed of 168 MHz, in addition to its 84 MHz maximum PWM comparator input frequency. The microprocessor is capable of floating point hardware operation and has three independent ADCs that can be simultaneously used to measure the output voltage, output current, and inductor current. The amplitude of the reference voltage is 0.5f COMPmax /f s = 0.5 × 84 MHz/25600 ≈ 1640. The ADCs obtain measurements in the range −4095-4095. During scaling the system should function under open loop control, with a small output capacitance of C F = 1 µF and a nominal resistive load of 50 Ω. When using the dedicated PC application to transmit data from the VSI the output voltage is hardware adjusted to 3000 units. Hence, the voltage scaling coefficient is 1640/3000 = 0.547. The current values vary, and as such, they are tuned to a lower value of 2000, from within the −4095-4095 range. With a resistive load of 50 Ω, the current scaling coefficient is (1640/2000)/50 = 0.0164. The modulation index is M = 0.6. Figure 14 shows the scaling of voltage measurements, in addition to the measured output voltage and current of the VSI. Control of the current substantially affects the shape of the current waveforms, and reduces distortion of the output voltage.

Implementation of the MISO PBC Controller in the VSI Microprocessor
The STM32F407VG microprocessor was chosen due to its fast clock speed of 168 MHz, in addition to its 84 MHz maximum PWM comparator input frequency. The microprocessor is capable of floating point hardware operation and has three independent ADCs that can be simultaneously used to measure the output voltage, output current, and inductor current. The amplitude of the reference voltage is 0.5fCOMPmax/fs = 0.5 × 84 MHz/25600 ≈ 1640. The ADCs obtain measurements in the range −4095-4095. During scaling the system should function under open loop control, with a small output capacitance of CF = 1 μF and a nominal resistive load of 50 Ω. When using the dedicated PC application to transmit data from the VSI the output voltage is hardware adjusted to 3000 units. Hence, the voltage scaling coefficient is 1640/3000 = 0.547. The current values vary, and as such, they are tuned to a lower value of 2000, from within the −4095-4095 range. With a resistive load of 50 Ω, the current scaling coefficient is (1640/2000)/50 = 0.0164. The modulation index is M = 0.6. Figure 14 shows the scaling of voltage measurements, in addition to the measured output voltage and current of the VSI. Control of the current substantially affects the shape of the current waveforms, and reduces distortion of the output voltage.

Results
The hardware model presented above used the MATLAB's Simulink 2021b and dSpace Release 2021b along with ControlDesk v.7.5 for MicroLabBox real-time interface 1202, or Keil μVision 5 for STM32F407VG microprocessor control, and a dedicated PC application for USB data exchange that was developed in-house using Microsoft Visual Studio C++ 2019. This hardware model, together with a MicroLabBox RTI1202 real-time interface, were used in the design process of two different VSI controllers: one SISO control system and one MISO control system. The results of using these controllers were evaluated by measuring the THD of the output voltage of the simulated or experimental VSI, when subject to a standard (EN62040) nonlinear rectifier RC load with R = 100 Ω, C = 100 μF, or C = 430 μF, and PF = 0.7. The modulation index was reduced to M = 0.6 to prevent the modulator from being saturated by rapid increases in the load current. The control procedures of both the real-time interface and the microprocessor were called by PWM block interrupts. For both control systems, the fully simulated system provided better results (lower THD) than the systems that utilized the experimental VSI. One reason for this could be an inaccurate discrete model of the inverter plant within the control design. The CDM control was based upon this model, with linearized functions of the output voltage, output current, inductor current, and duty ratio. Another possible reason could be the approximation of the measuring traces using only the delay values.
Despite lower performance than the simulated system, the results of the experimental system were satisfactory, and exceeded the requirements of EN 62040-3. Measuring both the output and inductor current allows the MISO controller to accurately shape the output current waveform. This study demonstrates the importance of the precise scaling of voltages and currents. The scaling values differed across each stage of the design procedure and required different procedures at each stage to tune them accurately. This included the use of dedicated software when working with the experimental model controlled by a microprocessor. The relatively low modulation index is important to avoid saturation and enable a faster increase of the inductor current in case of a rapid increase in the load current increase. To this end, the product of the modulation index and the filter inductor inductance should be limited. Table 1 summarizes the findings for each system. The results of the MicroLabBox and microprocessor control procedures are very similar, with a difference in THD of less than 1%.

Results
The hardware model presented above used the MATLAB's Simulink 2021b and dSpace Release 2021b along with ControlDesk v.7.5 for MicroLabBox real-time interface 1202, or Keil µVision 5 for STM32F407VG microprocessor control, and a dedicated PC application for USB data exchange that was developed in-house using Microsoft Visual Studio C++ 2019. This hardware model, together with a MicroLabBox RTI1202 real-time interface, were used in the design process of two different VSI controllers: one SISO control system and one MISO control system. The results of using these controllers were evaluated by measuring the THD of the output voltage of the simulated or experimental VSI, when subject to a standard (EN62040) nonlinear rectifier RC load with R = 100 Ω, C = 100 µF, or C = 430 µF, and PF = 0.7. The modulation index was reduced to M = 0.6 to prevent the modulator from being saturated by rapid increases in the load current. The control procedures of both the real-time interface and the microprocessor were called by PWM block interrupts. For both control systems, the fully simulated system provided better results (lower THD) than the systems that utilized the experimental VSI. One reason for this could be an inaccurate discrete model of the inverter plant within the control design. The CDM control was based upon this model, with linearized functions of the output voltage, output current, inductor current, and duty ratio. Another possible reason could be the approximation of the measuring traces using only the delay values.
Despite lower performance than the simulated system, the results of the experimental system were satisfactory, and exceeded the requirements of EN 62040-3. Measuring both the output and inductor current allows the MISO controller to accurately shape the output current waveform. This study demonstrates the importance of the precise scaling of voltages and currents. The scaling values differed across each stage of the design procedure and required different procedures at each stage to tune them accurately. This included the use of dedicated software when working with the experimental model controlled by a microprocessor. The relatively low modulation index is important to avoid saturation and enable a faster increase of the inductor current in case of a rapid increase in the load current increase. To this end, the product of the modulation index and the filter inductor inductance should be limited. Table 1 summarizes the findings for each system. The results of the MicroLabBox and microprocessor control procedures are very similar, with a difference in THD of less than 1%.

Conclusions
This paper detailed the four stages of VSI control system design ( Figure 1): development of the theoretical background, modelling, and simulation of the system using MATLAB's Simulink, control of the experimental VSI using dSpace via a MicroLabBox real-time interface, and implementation of the control system on a STM32F407VG microprocessor for direct control of the experimental VSI. Two control systems were used to demonstrate this process: SISO CDM and MISO PBC. The motivation behind the described design process is the assumption that the differential control laws are consistent throughout each stage of development. Control of the MicroLabBox and the microprocessor is based on PWM block interrupts, with the control procedures called once during each switching period. This approach is feasible as the differential control law obtained from the theory is the same for both simulation and hardware implementation. The primary differences between each stage of the design process are the values of the voltage and current scaling coefficients. These values should be precisely tuned for each stage as the coefficients of the control law would be changed by wrongly scaling. ControlDesk was used to tune the MicroLabBox scaling. Scaling of the microprocessor-based system required dedicated software that enabled data transfer from the hardware. This data transfer to PCB was achieved via USB, with the dedicated software working as a digital oscilloscope scaled in the microprocessor ADC units (Figure 14a). The value of the modulation index is very important during each stage of the design process; an excessively large value can cause saturation of the modulator in the case of rapid increases in load current. Lower values of the product of the modulation index and the filter inductor inductance provide faster changes in the inductor current.