**Code! Code! Code!**

**
People are always asking me for code related to the multilevel inverters and
capacitor voltage balancing. I have tried to explain this in publications,
but it is really more of a discrete decision control and it is impossible to
create a nice block diagram. So now, I am just placing code on this site.
Below is some code. More will be coming later.**

**2007-11-29 - Three-level
Mathcad Calculation sheet.**

I created a Mathcad calculation sheet for a three-level inverter because of some questions some people asked me about average currents. Then, it grew into a sheet where you can put in the load current, power factor, switching frequency, fundamental frequency, modulation index, and dc voltage. The sheet shows the load waveforms and voltages and currents of the individual transistors and diodes. The switching and conduction losses are also calculated. Here is the Mathcad sheet.

If you just want to see what it looks like, here is a .pdf.

Note: Pages are split in the .pdf file because some of the graphs span two pages.

**2007-02-26 - The flying capacitor
inverter in Matlab Simulink.**

Here is code for the flying capacitor inverter created by Jing Huang. The capacitor voltage balancing is included and described in the paper which is also below

Extended Operation of Flying Capacitor Multilevel Inverters.pdf

Flying Capacitor in Matlab Simulink.zip

**2007-02-26 - The flying capacitor inverter simulated
using the Advanced Continuous Simulation Language (ACSL).**

Some years ago, I wrote a monograph on multilevel inverters which is available below. It started out with simulations of 2-level, 3-level, 5-level, and 9-level flying capacitor inverters with capacitor voltage balancing. I had actually written a n-level version which this is based on. Below is the code. Even though it is in a language that is not used by many engineers, the algorithm is visible in the simulation macros.

Operation and Design of Multilevel Inverters.pdf