Six diodes turn three-phase AC into DC, the inductor smooths the current, and the capacitor bank holds the bus steady.
Switch on Main Power to charge the capacitor bank.
Each PWM pulse gates one IGBT, puts the DC bus across the motor coils, and builds the current that turns the field.
C firmware sketch using the simulation’s own switching rule. Highlights are live.