The circuit files for this case are in these two links:circuit_files.zip circuit_files.tar.gz
This simulation needs a PLL as the inverter needs to be synchronized to the grid. To know how to simulate a PLL check out my blog post here. In the circuit files above, the control code has been removed to avoid any possible legal infringements. Check out the tutorial on how to write control code. In this post, the results will be posted.
In this case study, the control of the inverter has been implemented in the synchronously rotating reference frame. There are two separate controllers for the in-phase (d) and quadrature (q) axis. Controlling the d axis controls the in-phase (active) component of current injected by the inverter into the grid while the q axis controls the quadrature (reactive) component of current. The results posted here will show how the inverter is initially injecting only reactive power into the grid until 0.25s and after that injects only active power into the grid.
The d axis current is shown in the next figure. To be noted that the reference for the d axis current is 0 until 2.5s and is 50Amps after that. Therefore, tracking is good except for the switching ripple which is unavoidable as the inverter has only an inductor filter.
The q axis current is shown in the next figure. The reference for the q axis current is -20Amps until 2.5s and is 0Amps after that.
The three phase currents are:
Zoomed in, the jump in both the magnitude and the phase of the currents is visible.
To have a better understanding of the power injected by the inverter, the currents and voltages of a phase are plotted in the same graph. Below is the plot of the phase "a" grid voltage and inverter current.
The result shows how until 2.5s, the current lags the voltage by 90 degrees and then after that is in phase with the voltage.