Electronic – 3-Phase Inverter simulation

brushless-dc-motorinverterltspice

I'm trying to simulate a 3-phase inverter for BLDC(PMSM) in LTSpice. The problem is that drain current is way too high and also phase voltage isn't right.

enter image description here
enter image description here
**New image
enter image description here
*One leg

If I put one source(48V) I get spikes as drain current(green) instead of rectangle signal, blue signal is drain-source voltage:
Blue line is drain-source voltage
Here are phase currents:
enter image description here
If I put two sources then I get rectangle but is way too high(3.5kA):
enter image description here
Here are phase currents:
enter image description here
Here are phase to phase voltage(blue) and voltage on one phase(green):
enter image description here

To get SPWM I compare sine wave and triangle wave, for other two phases I change Phi to 120 and 240. Also I have dead time circuit and that works fine.

It works the same even with or without back-EMF. I tried changing Rm and Lm parameters but nothing changes.Rm=1 Ohm, Lm=0.5 mH. I tried adding ground but it doesnt work either.

UPDATE1: Thanks to everyone.
I realized that I need to bootstrap MOSFETs. Now I'm trying to make driver with bootstrap capacitor and pnp and npn as seen in some datasheets/forums but it doesn't work for 3 phases(uploaded new pictures). I don't know what's wrong.
Tried with/without ground but it doesn't help.
Is it better to just include gate driver model?
I just need it for simulation to measure currents, voltages etc.

Best Answer

Here is a basic simulation of a inverter and the U15II kv80 T-motor:

bldc 36n42p kv80

The torque is not modelled so the current is the maximum possible. This does not affect the simulation. The only input of the simulation is the duty. Here is the waveform of the phase A:

enter image description here

The netlist:

  • C:\Users\fobi\Documents\esc\control\sqpwm_m_emf_bas_31.asc
V1 vs 0 {Vp} Rser=1m
R1 N009 a {Rm}
R2 N010 b {Rm}
R3 N011 c {Rm}
L1 bmfa N009 {Ls}
L2 bmfb N010 {Ls}
L3 bmfc N011 {Ls}
R4 pin 0 10Meg
R5 a ea1 20k
R6 0 ea1 2k
C1 ea1 0 {Cbf}
R9 b eb1 20k
R10 0 eb1 2k
C2 eb1 0 {Cbf}
R13 c ec1 20k
R14 0 ec1 2k
C3 ec1 0 {Cbf}
V6 vdd 0 5
R24 cs1 0 0.3m
R17 vs N004 20k
C4 N004 0 10p
R20 half N004 1k
R28 N015 N013 20
R30 N014 N013 20
R32 N012 N013 20
V2 bmfa pin SINE(0 {em} {fre})
V3 bmfb pin SINE(0 {em} {fre} 0 0 120)
V4 bmfc pin SINE(0 {em} {fre} 0 0 240)
R36 ea1 ref 20k
R37 eb1 ref 20k
R38 ec1 ref 20k
S1 a vs sa1 0 M
S2 cs1 a sa0 0 M
S3 b vs sb1 0 M
S4 cs2 b sb0 0 M
S5 c vs sc1 0 M
S6 cs3 c sc0 0 M
D1 a vs D
D2 b vs D
D3 c vs D
D4 cs1 a D
D5 cs2 b D
D6 cs3 c D
C6 ref 0 {Cbf}
C7 N012 a 10n
C8 N014 b 10n
C9 N015 c 10n
R7 cs2 0 0.3m
R8 cs3 0 0.3m
R11 a ea0 20k
R15 b eb0 20k
R18 c ec0 20k
D7 ec0 vdd D
D8 eb0 vdd D
D9 ea0 vdd D
R12 0 half 1k
V5 pwm0 0 PULSE(0 1 0 1p 1p {duty*Tm} {Tm})
B1 b30 0 V=delay(V(b1),{dt})
B2 c30 0 V=delay(V(c1),{dt})
B3 a30 0 V=delay(V(a1),{dt})
A1 0 c30 0 a30n 0 0 sa0 0 AND vhigh = vh
A2 a30 0 0 0 0 a30n 0 0 BUF vhigh = vh
A3 0 c30n pwm0 a30 0 0 sa1 0 AND vhigh = vh
A4 0 a30 0 b30n 0 0 sb0 0 AND vhigh = vh
A5 0 a30n pwm0 b30 0 0 sb1 0 AND vhigh = vh
A6 0 b30 0 c30n 0 0 sc0 0 AND vhigh = vh
A7 0 b30n pwm0 c30 0 0 sc1 0 AND vhigh = vh
A8 b30 0 0 0 0 b30n 0 0 BUF vhigh = vh
A9 c30 0 0 0 0 c30n 0 0 BUF vhigh = vh
B4 a1 0 V={vh}*sgn(V(bmfa,pin))
B5 c1 0 V={vh}*sgn(V(bmfc,pin))
B6 b1 0 V={vh}*sgn(V(bmfb,pin))
A11 pwm0 0 0 0 0 pwm1 0 0 BUF vhigh = vh
V7 period 0 {Tp}
.model D D
.lib C:\Program Files (x86)\LTC\LTspiceIV\lib\cmp\standard.dio
.tran 0 {4*Tp} 0 200n
K1 L1 L2 L3 0.9
.param Rm = 20m
.param Ls = 20u
.param duty = 0.5 ; ***
; .param Tp = (120/pol)/Vp/duty/Kv
.param Tp = 1/{fre}
.param Vp = 50 ; input voltage
.param Tm = 20u ; pwm period
.param Cbf=220p
.param em = kl*Vp*Duty/2
.param fre = em*Kv*pol/120*2
.model M SW(Ron=1m Roff=1Meg Vt=0.5 Vh=0.1)
.param Kv = 80
.param pol = 42
* Dividers
* Reference
* Motor
* Bridge
.param kl = 1 ; load
.param dt = Tp/12 ; 30 deg delay
* Timers
* Decoder
.param vh = 1
* BEMF detector
.measure duty
.backanno
.end