This example shows how to control the currents in a grid-tied inverter system. The Optimal controller subsystem implements an observer-based linear quadratic regulator strategy. To ensure zero steady state error, this example uses the observer as an alternative to the integral action. SPST switches connect the three-phase inverter to the grid. The switches are open at the beginning of the simulation to allow synchronization. At 0.15 seconds, the inverter is connected to the grid. Then, at 0.2 seconds the inverter increases the active power supplied to the grid. The Scopes subsystem contains scopes that allow you to see the simulation results. The inverter is implemented using Ideal Semiconductor Switch blocks. If you have a license for HDL Coder™, you can generate VHDL code for an FPGA using the Simscape™ HDL Workflow Advisor.
The plot below shows the synchronization voltage, inverter and grid currents, and inverter active and reactive power.