Solution: At 20kHz, there is a MOSFET switching occurrence every 25 microseconds (a switch on every 50 microseconds, and a switch off every 50
microseconds). Therefore, the ratio of switching time to total time is 1/25 = 0.04. The power dissipation when switching is (12v / 2) x (40A / 2) = 120
Watts. Therefore the average switching loss is 120W x 0.04 = 4.8 Watts.
This problem seems to me very confusing. For example, it must be specified if the MOSFET is driving a resistive or an inductive load, but for any of the two cases it is quite silly to say that voltage and current will remain constant at half value during switching. We know that switching is an event of finite duration, so the situation described can't happen: otherwise voltage would pass from zero to half to full supply value instantly, and then viceversa.
First of all, switching events are located at 50us one from each other just because the duty-cycle is 50% (if the "half voltage" is related to the output voltage of the chopped supply).
Then, typical situation in switched mode power supplies is when a strongly inductive load (L/R >> 1/fsw) is switched by a MOSFET. I'll slightly change the problem, just to make it more useful.
A MOSFET switches an inductive load (with antiparallel inductance). Vsupply is 12V, average current is 20A, switching frequency is 20kHz and transition time is 1us, rdson is 1Ohm. Calculate losses.
^Vsupply
|
o------
| |
C ---
L C /_\
C |
| |
< |
R > |
< |
| |
o------
|
__|
|_ Q
|
_|_
///
The equivalent circuit which usally is analyzed for this case is an ideal current generator (constant current source) with a diode in antiparallel and in series with the MOSFET, all between Vsupply and ground. This is because we suppose inductance to force its current to remain almost constant (at the average value) during switching.
^Vsupply
|
o------
| |
IL | ---
| (--) /_\
\/ | |
| |
o------
|
__|
|_ Q
|
_|_
///
When the MOSFET is OFF, all current will flow through the diode, clamping Vd at Vsupply.
During switching (let's analyze the OFF to ON transient, so rising gate for an N-MOSFET), Vds will start at Vsupply and remain constant at Vsupply until the diode stops conducting (which means until MOSFET current linearly reaches inductor current value). Then Vds will linearly go to nearly zero (rdson*IL), while current on the MOSFET remains constant. This is one of the simplest approximation of the switching event.
Vgs^
| Vdrive
| /
| _____/
| /
| /
| Vth/
| ____/
|
Vds^
|
| Vsupply__
| \
| \
| \
| 0 \____
|
Id ^
|
| IL _________________
| /
| /
| 0_____/
|
^
PWR|
|Vsupply*IL
| ^ t1: Vgs reaches Vth, current starts to flow through MOSFET, but part of IL still passes through
| / \ the diode, so Vd is clamped at Vsupply
| / \ t2: the MOSFET conducts all the current, and rapidly reduces its equivalent resistance, since
| 0_____/ \__________ gate reaches its final value (high level from driver or MCU output) and rdson remains constant.
t1 t2
Since from t1 to t2 there will be 1us, energy dissipated by the MOSFET at each switching is the area of the PWR triangle (Vds(t)*Id(t)), which is Esw = (t2-t1) * Vsupply*IL. For each period there will be two transitions, so average power due to switching is PWRav = 2*Esw / Tsw = (t2-t1) * Vsupply*IL * fsw = 1u * 12 * 20 * 20k = 4.8W. This is because we negliged rdson*IL voltage (<<Vsupply), which is usually acceptable (otherwise, MOSFET is used as a linear device instead of switching).
The rising time of current extends from the time when Vgs reaches threshold (Vth) to the time Vgs enters Milller zone (flat "plateau" zone on Vgs). There Vds starts to go down.
I found also this link:
http://www.irf.com/technical-info/appnotes/mosfet.pdf.
Now something about coils. I have to select the the inductance but what about the current that is passing through them, are there like resistors that have power ratings?
For choosing the inductor there are many factors to take into account: thermal resistive dissipation is one of those, but there are some losses related to magnetic effects (hysteresis and eddy currents). A strong effect is saturation, which puts a very heavy constraint to maximum current*inductance = flux. You always have to include ripple losses and peak values. To calculate ripple, just consider that inductance current rises with a slope equal to VL/L (VL = voltage across inductor), and assume input and output voltages are constant (you will add some capacitors there). So IL maximum excursion during a period will be (Vin-Vout)/L* max_dutycycle.
Usually, magnetic core producers explain how and give some tools to calculate inductor characteristics given your constraints, but this is a difficult matter.