In [4]:

```
P_L=20; # Average power (W)
R_L=8; # Load resistance (ohm)
V_o=math.sqrt(2*P_L*R_L);
print round(V_o,1),"= Supply voltage required (V)"
V_CC=23; # We select this voltage (V)
I_o=V_o/R_L;
print round(I_o,2),"= Peak current drawn from each supply (A)"
P_Sav=V_CC*I_o/math.pi; # P_S+ = P_S- = P_Sav
P_S=P_Sav+P_Sav; # Total supply power
print round(P_S,1),"= The total power supply (W)"
n=P_L/P_S; # n is power conversion efficiency
print round(n*100)," = Power conversion efficiency %"
P_DPmax=V_CC**2/(math.pi**2*R_L);
P_DNmax=P_DPmax;
print round(P_DPmax,1),"= Maximun power dissipated in each transistor (W)"
```

In [7]:

```
# Consider Class AB Amplifier
V_CC=15; # (V)
R_L=100; # (ohm)
v_O=-10; # Amplitude of sinusoidal output voltage (V)
I_S=10**-13; # (A)
V_T=25*10**-3; # (V)
B=50; # Beta value
i_Lmax=10/(0.1*10**3); # Maximum current through Q_N (A)
# Implies max base curent in Q_N is approximately 2mA
I_BIAS=3*10**-3; # We select I_BIAS=3mA in order to maintain a minimum of 1mA through the diodes
I_Q=9*10**-3; # The area ratio of 3 yeilds quiescent current of 9mA
P_DQ=2*V_CC*I_Q;
print round(P_DQ*1000),"= Quiescent power dissipation (mW)"
#For v_O=0V base current of Q_N is 9/51=0.18 mA
# Leaves a current of 3-0.18=2.83mA to flow through the diodes
I_S= (10**-13)/3; # Diodes have I_S = (1*10**-13)/3
V_BB=2*V_T*math.log((2.83*10**-3)/I_S);
print round(V_BB,2),"= V_BB (V) for v_O = 0V"
# For v_O=+10V, current through the diodes will decrease to 1mA
V_BB=2*V_T*math.log((1*10**-3)/I_S);
print round(V_BB,2),"= V_BB (V) for v_O = +10V"
# For v_O=-10V , Q_N will conduct very small current thus base current is negligible
# All of the I_BIAS(3mA) flows through the diodes
V_BB=2*V_T*math.log((3*10**-3)/I_S);
print round(V_BB,2),"= V_BB (V) for v_O = -10V"
```

In [10]:

```
V_T=25*10**-3; # (V)
I_S=10**-14; # (A)
I_Q=2*10**-3; # Required quiescent current (A)
# We select I_BIAS=3mA which is divided between I_R and I_C1
# Thus we select I_R=0.5mA and I_C1=2.5mA
V_BB=2*V_T*math.log(I_Q/10**-13);
print round(V_BB,2),"=V_BB (V)"
I_R=0.5*10**-3;
R1plusR2=V_BB/I_R; # R1plusR2 = R_1+R_2
I_C1=2.5*10**-3;
V_BE1=V_T*math.log(I_C1/I_S);
print round(V_BE1,2),"= V_BE1 (V)"
R_1=V_BE1/I_R;
print round(R_1/1000,2),"R_1 (Kohm)"
R_2=R1plusR2-R_1;
print round(R_2/1000,2),"R_2 (Kohm)"
```

In [11]:

```
# Consider BJT with following specifications
P_D0=2; # Maximum power dissipation (W)
T_A0=25.0; # Ambient temperature (degree celcius)
T_Jmax=150.0; # maximum junction temperature (degree celcius)
# 14.4a
theta_JA=(T_Jmax-T_A0)/P_D0; # Thermal resistance
print theta_JA,"is The thermal resistance (degree celsius/W)"
# 14.4b
T_A=50.0; # (degree celcius)
P_Dmax=(T_Jmax-T_A)/theta_JA;
print P_Dmax,"is Maximum power that can be dissipated at an ambient temperature of 50 degree celsius (W)"
# 14.4c
T_A=25.0; # (degree celcius)
P_D=1; # (W)
T_J=T_A+theta_JA*P_D;
print T_J,"is Junction temperature (degree celcius) if the device is operating at T_A=25 degree celsius and is dissipating 1W"
```

In [16]:

```
# Consider a BJT with following specifications
T_Jmax=150; # (degree celcius)
T_A=50; # (degree celcius)
# 14.5a
theta_JA=62.5; # (degree celcius/W)
P_Dmax=(T_Jmax-T_A)/theta_JA;
print round(P_Dmax,2),"is The maximum power (W) that can be dissipated safely by the transistor when operated in free air"
#14.5b
theta_CS=0.5; # (degree celcius/W)
theta_SA=4; # (degree celcius/W)
theta_JC=3.12; # (degree celcius/W)
theta_JA=theta_JC+theta_CS+theta_SA;
P_Dmax=(T_Jmax-T_A)/theta_JA
print round(P_Dmax,1),"is The maximum power (W) that can be dissipated safely by the transistor when operated at an ambient temperature of 50 degree celcius but with a heat sink for which theta_CS= 0.5 (degree celcius/W) and theta_SA = 4 (degree celcius/W) (W)"
# 14.5c
theta_CA=0 # since infinite heat sink
P_Dmax=(T_Jmax-T_A)/theta_JC;
print round(P_Dmax),"is The maximum power (W) that can be dissipated safely if an infinite heat sink is used and T_A=50 (degree celcius)"
```