Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Modular multilevel converter: submodules, balancing and the circulating current

A modular multilevel converter (MMC) builds its output from many small steps instead of two big ones. Each phase leg has two arms, and each arm is a stack of identical submodules, a capacitor with two switches, that are inserted or bypassed one by one. The output has many levels and a low distortion with a slow switching rate. The price is control: the capacitors must stay at the same voltage, and the two arms exchange a current of their own, the circulating current. You open the mmcInverter example, read its arms and its controller, then follow the arm currents, the circulating current, the four submodule capacitor voltages, the output levels and the distortion. Last, you switch the circulating-current controller off and see what it was doing. About 30 minutes.

Pictures: a numbered red box is what you click or read, ▶ Run is a button, File › Open Example a menu path, ⌘⇧Y a key (⌘ is Cmd on a Mac, Ctrl elsewhere).

1. Open the example

Step 1 of 15 · about 1 min

Choose File › Open Example › Inverters › MMC inverter leg.

The File menu open at Open Example, Inverters, MMC inverter leg, marked 1 to 4

  1. File.
  2. Open Example.
  3. Inverters.
  4. MMC inverter leg.

2. Read the power stage

Step 2 of 15 · about 1 min

One phase leg stands between two 200 V sources, a 400 V bus with its middle at ground. The upper arm hangs from the positive rail, the lower arm from the negative rail, and the load takes the middle point ac of the leg back to ground. The rails and the signals iu, il, mu and ml are drawn as labels, so the leg is one short column.

The power stage: the two DC sources, the upper arm with its inductor, the middle point, the lower arm, and the load, marked 1 to 8

  1. Vp: the upper 200 V source; Vn below it is the lower one. Together they are the 400 V bus.
  2. AmU: an ammeter in the upper arm. Its output is the arm current iu; AmL gives il in the lower arm.
  3. AU: the upper arm, four submodules in series. AL is the lower arm. The label mu brings the arm its insertion index: 0 bypasses every submodule, 1 inserts all four.
  4. LU: a 5 mH arm inductor. LL is the lower one. The arms must have them: they limit the current between two stacks of capacitors that are never at exactly the same voltage.
  5. AmLoad: the load current iload, taken at the middle point ac.
  6. RL: a 10 Ω load resistor, with LO, 10 mH, in series to ground.
  7. AmL: the lower arm's current il.
  8. AL: the lower arm, a copy of AU.

The upper arm inserts a share mu = (1 − 0.8·sin ωt)/2 of its submodules and the lower arm ml = (1 + 0.8·sin ωt)/2: while one arm inserts more, the other inserts fewer, so the two always insert four between them. The leg puts 0.8 · 400 V / 2 = 160 V peak at 50 Hz across the load.

3. Read one arm

Step 3 of 15 · about 1 min

Click AU on the schematic. Its parameters are in Properties.

The properties of the arm AU: submodules, capacitance, starting voltage and carrier frequency, marked 1 to 4

  1. Submodules in series in the arm: n is 4.
  2. Capacitance of each submodule: c is 2 mF.
  3. Voltage of each submodule capacitor: v0 is 100 V, the bus divided by n, so the capacitors start at their working voltage.
  4. Carrier frequency: fc is 1 kHz. The four submodules switch with carriers shifted by a quarter of a period each, so the arm steps at an apparent 4 kHz.

With level switched, the arm is built from its parts when you run: for every submodule an upper switch to the capacitor and a lower switch that bypasses it. An mmcBalance block (the library part MMC Submodule Selection) sits inside the arm. It reads the insertion index, the arm current and the four capacitor voltages, and it decides how many submodules are inserted and which ones. Step 9 shows its output.

4. Read the control

Step 4 of 15 · about 1 min

The control sits below the power stage. The two arms get the same sine references, and one small loop adds a correction to both.

The control: the circulating current from the two arm currents, a band-pass, a gain, the two references and their mixers, marked 1 to 5

  1. Sum: adds the two arm currents iu and il; Half halves the sum. The result icirc = (iu + il)/2 is the circulating current: the part of the current that goes through both arms and not through the load.
  2. Bp: a band-pass at 100 Hz, twice the output frequency. It keeps the second harmonic of the circulating current and drops its DC part.
  3. Kc: a gain kc of 0.025. The result dm is added to both arm references. For the circulating current this is a resistance of kc · 400 V = 10 Ω, and it acts at 100 Hz only. The DC part and the output are not touched.
  4. RefU: the upper arm's sine reference, 0.5 + 0.4·sin(ωt + 180°); RefL is the lower one.
  5. MixU: adds dm to the reference and gives mu; MixL gives ml.

5. Run it and read the output

Step 5 of 15 · about 1 min

Click ▶ Run. The scope shows the voltage v(ac) at the middle point on the top axis and the load current iload below it.

The scope: v(ac) on top, iload below, both at 50 Hz, marked 1 to 2

  1. v(ac): the voltage at the middle point, a 50 Hz sine of about 117 V rms with a ripple on it. Step 11 looks at that ripple.
  2. iload: the load current, a sine of 15.4 A peak. The table says 10.7 A rms; the load takes 10 Ω · (10.7 A)² = 1.15 kW.

6. Read the arm currents and the circulating current

Step 6 of 15 · about 1 min

In the signal list tick iu, il and icirc, then give icirc its own axis: click the plot button at the end of its row (its tooltip names the plot it is on), and icirc moves to the next plot, stacked under the others.

The scope: iu and il on top, icirc below, marked 1 to 3

  1. iu: the upper arm current.
  2. il: the lower arm current. Its load part is the opposite of iu's: when one arm carries more, the other carries less.
  3. icirc: the circulating current. It starts at 0, because the capacitors start charged and the bus has not yet pushed current through the leg. It overshoots to 5.1 A and settles near 3 A with a small ripple at 100 Hz.

7. Choose a window of whole cycles

Step 7 of 15 · about 1 min

The scope folds the table away while the plots would get less than half its width, so click Measurements in the toolbar to show it. Click Cursors (Shift+C) and place the two lines at 100 ms and 200 ms: five whole cycles after the start.

The scope with two cursors; the table says between the cursors 100ms to 200ms, marked 1 to 2

  1. Cursors: shows two vertical lines and the values at each.
  2. The table's heading reads between the cursors 100ms – 200ms. Every figure below is taken over that window.

In the table, iu has a mean of 2.88 A, il 2.90 A, and icirc 2.89 A. The mean of an arm current is the DC part of the circulating current, the current that brings the power in from the bus: 400 V · 2.89 A = 1.16 kW, and the load takes 1.15 kW. On top of it each arm carries half of the load current: iu swings from −5.1 A to 10.85 A, which is 2.89 A plus or minus 7.6 A (half of the 15.1 A load current), plus the ripple. The circulating current itself moves between 2.04 A and 3.82 A, a second harmonic of 1.78 A peak to peak.

8. Read the capacitor voltages

Step 8 of 15 · about 1 min

Untick the currents and tick AU:v1, AU:v2, AU:v3 and AU:v4 on one axis, and AU:vsum on its own.

The scope: the four capacitor voltages of the upper arm on top, their sum below, marked 1 to 3

  1. AU:v1: the capacitor voltage of the first submodule of the upper arm. The traces of AU:v2 and AU:v3 lie on top of it.
  2. AU:v4: the fourth. The four means are 99.31, 99.31, 99.31 and 99.30 V, within 0.01 V of each other, and each swings 10.3 V peak to peak, from 94.8 V to 105.1 V.
  3. AU:vsum: the sum of the four, the voltage the arm can make: 397.2 V on average, 41 V peak to peak at 50 Hz. The arm gives and takes energy as the output swings, and the voltage rides up and down by 10 %.

The four traces are indistinguishable at this scale. The submodules are identical, and one that is inserted more often than the others charges and discharges more, so only the control keeps them together. The next two steps show how.

9. See which submodules are inserted

Step 9 of 15 · about 1 min

Untick the voltages and tick AU:g1 to AU:g4, each with its own axis. Choose Scope > Zoom Axis > Time Only, then click Zoom In six times.

The scope zoomed to 3 ms: the four selection signals g1 to g4, each a train of pulses, marked 1 to 2

  1. AU:g1: the output of mmcBalance for submodule 1: 1 while it is inserted, 0 while it is bypassed.
  2. AU:g4: the same for submodule 4.

No submodule stays on or off. Over the 100 ms of the window, AU:g1 to AU:g4 average 0.497, 0.495, 0.503 and 0.505: each submodule is inserted half of the time, and a submodule that has been inserted a little more than the others is bypassed next. That is the sorting: the block ranks the four capacitor voltages, and while the arm current charges the capacitors it inserts the lowest ones; while it discharges them, the highest. A submodule changes state only when the number of inserted submodules changes, not each time two voltages cross, so the switching is as slow as the modulation needs it to be.

10. See the sorting at work on the voltages

Step 10 of 15 · about 1 min

Untick the selection signals, tick AU:v1 to AU:v4 on one axis and click Autoscale Y.

The four capacitor voltages over 3 ms: staircases that rise one after the other and stay within half a volt, marked 1 to 2

  1. Autoscale Y: fits the voltage axis to the zoomed window, so the 10 V swing of step 8 becomes a 1 V window.
  2. AU:v1: each voltage is a staircase. A slope is the submodule inserted, charging or discharging with the arm current; a flat part is the submodule bypassed. The four climb in turn and cross, and at no point are two of them more than about 0.5 V apart.

11. Count the output levels

Step 11 of 15 · about 1 min

Click Show signals on the left edge of the scope window to unfold its signal list, then + (Add Math Signal) at the top of the list; type AU:g1+AU:g2+AU:g3+AU:g4 in Expression and click Add. The sum is the number of submodules inserted in the upper arm; the scope calls it math1. Put v(ac) and math1 on their own axes and zoom in four times on the time axis.

The scope over 14 ms: v(ac) rising in steps, and math1, the number of inserted submodules, falling from 4 to 1, marked 1 to 2

  1. v(ac): the output rises in steps of about 100 V, the bus divided by the four submodules, with a 4 kHz ripple around each step. Every PWM period it switches between two adjacent levels.
  2. math1: the number of inserted submodules of the upper arm, 0 to 4. Its mean over whole cycles is 2.0; the table shows a minimum of 0 and a maximum of 4. The lower arm inserts the rest, so the leg has five levels, N + 1 for N submodules.

12. Read the distortion

Step 12 of 15 · about 1 min

Zoom back to the whole run (Zoom to Fit), keep v(ac) and iload, click Measurements to show and tick THD.

The measurement picker with THD ticked, marked 1 to 2

  1. Measurements to show: the columns of the table.
  2. THD: the total harmonic distortion up to the 50th harmonic, as a share of the fundamental.

13. Compare the voltage and the current

Step 13 of 15 · about 1 min

Press Esc to close the picker.

The table with the THD column: v(ac) 0.578 %, iload 0.423 %, marked 1 to 2

  1. THD of v(ac): 0.578 % (scope.measure with the fundamental given as 50 Hz reads 0.57 %). The fundamental is 158.7 V peak, a little under the 160 V the modulation asks for.
  2. THD of iload: 0.423 %. The 10 mH load filters the output voltage further, and the 15.1 A fundamental is clean. Four submodules, a carrier of 1 kHz each and a small arm inductor are enough.

14. Keep this run and turn the circulating-current controller off

Step 14 of 15 · about 1 min

In the signal list put icirc, AU:v1 and iload on one axis each, click Keep as reference, then Dock Back on the scope. Press ⌘⇧Y to open the console and type:

circuit.variables {"set":{"kc":"0"}}

The console with the command; the reply shows kc as 0, marked 1 to 2

  1. circuit.variables sets the circuit variable kc to 0. Kc has a gain of kc, so dm is now 0 and the arm references are the plain sines. This edits the circuit; undo it to get 0.025 back.
  2. The reply lists the variable as 0.

This step turns off the balance between the two arms of the leg. The sorting inside each arm is a separate balance with its own switch, the arm's sorting parameter: set to 0, the submodules go in by index and their capacitor voltages drift apart. It stays on here.

15. Run again and compare

Step 15 of 15 · about 1 min

Type simulation.run, put the cursors at 100 ms and 200 ms again, and keep the same three signals on the scope.

The scope: the reference run light, the new run dark; icirc, AU:v1 and iload each on their own axis, marked 1 to 2

  1. icirc · Ref 1: the first run, kept as a reference and drawn lighter, with the controller on.
  2. icirc: the new run. The second harmonic is now 9.6 A peak to peak, against 1.78 A: its rms value is 2.41 A against 0.43 A, 5.6 times as much. The mean is the same 2.90 A, so the power from the bus does not change.

Scroll the measurements down: Runs lists the two runs and what changed between them (kc 25m→0).

The rest follows from the larger circulating current:

  • The capacitor voltage AU:v1 swings 17.3 V peak to peak, from 91.3 V to 108.6 V, against 10.3 V: the second harmonic of the arm current charges and discharges the capacitors at 100 Hz on top of the 50 Hz swing.
  • The arm current has an rms value of 6.83 A against 6.10 A. That is 12 % more, so the conduction loss in the arm's switches is about 25 % higher, and the arm needs bigger capacitors and bigger switches for the same load.
  • The load current has a THD of 1.35 % against 0.42 %. The arm voltages move more, and some of it reaches the output.

So an MMC has two balances. The sorting inside an arm keeps the four capacitors together (steps 8 to 10). The circulating-current controller keeps the two arms from swinging energy against each other, and it is the one you switched off here.

The same steps from a script

powercraft-cli run \
    --cmd file.openExample    --params '{"name":"mmcInverter"}' \
    --cmd simulation.run      --params '{}' \
    --cmd scope.measure       --params '{"signals":["icirc","AU:v1","AU:g1","iload","v(ac)"],"t0":"0.1","t1":"0.2","thd":{"fundamental":50}}' \
    --cmd circuit.variables   --params '{"set":{"kc":"0"}}' \
    --cmd simulation.run      --params '{}' \
    --cmd scope.measure       --params '{"signals":["icirc","AU:v1","iload"],"t0":"0.1","t1":"0.2","thd":{"fundamental":50}}'

The first scope.measure gives an icirc of 1.78 A peak to peak, an AU:v1 of 10.3 V peak to peak and a thd.iload.thdPercent of 0.42. The second gives 9.6 A, 17.3 V and 1.34 (the table's 1.35 % is the same figure with the fundamental found by the scope).

Back to the learning path.