#Current amplification factors
import math
#variable declaration
deltaIB=50.0 #in uA
deltaIC=1.0 #in mA
#Calculations
deltaIC=deltaIC*10**3 #in uA
Beta=deltaIC/deltaIB #unitless
Alfa=Beta/(1+Beta) #unittless
#Result
print("Current Amplification Factor,Beta :%.0f"%Beta)
print("Current Amplification Factor,Alfa :%.3f or 20/21"%(Alfa))
#Value of IE
import math
#variable Declaration
IB=25.0 #in uA
Beta=40.0 #unitless
#Calculations
IC=Beta*IB #in uA
IE=IB+IC #in uA
#Result
print("The value of IE : %.0f micro Ampere"%IE)
#Change in collector current
import math
#variable declaration
alfa=0.98 #unitless
deltaIB=0.2 #in mA
#calculations
Beta=alfa/(1-alfa) #unitless
deltaIC=Beta*deltaIB #in mA
#result
print("Change in collector curent :%.0f mA "% (deltaIC))
#nput current in CE and CB configuration
import math
#variable declaration
Beta=45 #unitless
RL=1.0 #in kOhm
deltaVCE=1 #in volt
#calculation
#(i)
IC=deltaVCE/(RL*1000) #in Ampere
#Formula : Beta=deltaIC/deltaIB
IB=IC/Beta #in Ampere
#(ii)
IC=deltaVCE/(RL*1000) #in Ampere
#Formula : Beta=deltaIC/deltaIB
IE=IB+IC #in Ampere
#result
print("Part (i) : CE coniguration\n")
print("Input Base Current, IB in mA :%.3f "%(IB*10**3))
print("\nPart (ii) : CB coniguration\n")
print("Input Emitter Current, IE in mA :%.3f "%(IE*10**3))
#Current gain and base current
import math
#variable declaration
Ileakage=12.5 #in uA
ICBO=12.5 #in uA
IE=2 #in mA
IC=1.97 #in mA
#calculation
#Formula : IC=alfa*IE+ICBO
alfa=(IC-ICBO/10**3)/IE #unitless
IB=IE-IC #in mA
#result
print("Current Gain : %.3f"%(math.floor(alfa*1000)/1000))
print("Base current in mA : %.2f"%IB)
#Input resistance of transistor
import math
#variable declaration
deltaVBE=200.0 #in mVolt
deltaIB=100 #in uA
#calculations
ri=deltaVBE*10**-3/(deltaIB*10**-6) #in Ohm
#Result
print("Input resistane of transistor in kohm :%.0f"%(ri/1000))
#Dynamic input resistance
import math
#variable declaration
deltaVEB=200.0 #in mVolt
deltaIE=5.0 #in mA
#calculation
ri=deltaVEB*10**-3/(deltaIE*10**-3) #in Ohm
#Result
print("Input resistane of transistor in Ohm :%.0f"%ri)
#Current gain input resistance and voltage gain
import math
#variable declaration
Ri=500.0 #in Ohm
RL=1.0 #in kOhm
hie=1.0 #in kOhm
hre=2.0*10**-4 #unitless
hfe=50.0 #unitless
hoe=25.0 #micro mho
#Calculations
#Part (a) :
Ai=-hfe/(1+hoe*10**-6*RL*10**3) #unitless
#Part (b) :
Rin=(hie*10**3)-(hre*hfe/((hoe*10**-6)+1/(RL*10**3))) #in Ohm
#Part (c) :
Av=Ai*RL*10**3/Ri #unitless
#Result
print("(a)\nCurrent Gain :%.1f "%Ai)
print("(b)\nInput Resistance in Ohm :%.2f"%Rin)
print("(c)\nVoltage Gain :%.1f "%Av)
#Collector emitter saturation voltage
import math
#variable declaration
alfaF=0.99 #unitless
alfaR=0.20 #unitless
IC=1.0 #in mA
IB=50.0 #in micro Ampere
T=300 #in kelvin
k=1.38*10**-23 #Boltzman constant
e=1.6*10**-19 #in cooulamb
#Calculation
Vth=k*T/e #in Volt
VCEsat=Vth*math.log(((IC*10**-3*(1-alfaR)+IB*10**-6)*alfaF)/((alfaF*IB*10**-6-(1-alfaF)*IC*10**-3)*alfaR))
#Result
print("Collector-Emitter saturation voltage in volt :%.3f"%VCEsat)
#Relative size of collector junction
import math
#variable declaration
IES=10**-14 #in A
alfaF=1 #unitless
alfaR=0.1 #unitless
#Calculations
#Formula : alfaF*IES=alfaR*ICS
ICS=(alfaF/alfaR)*IES #in Ampere
RelativeSize=ICS/IES #unitless
BetaR=alfaR/(1-alfaR) #unitless
#Result
print("Collector base junction saturation current in Ampere : %.1f * 10^-12"%(ICS*10**12))
print("\nCollector is %.0f times larger in size than emitter"%RelativeSize)
print("\nValue of BetaR :%.2f "%BetaR)
#DC load line and operating point
import math
#variable declaration
Beta=100 #unitless
VCC=6 #in volt
RB=530 #in kOhm
RC=2 #in kOhm
VBE=0.7 #in volt(For Si)
#Part (i)
IC1=0 #in A
VCE1=VCC-IC1*RC #in volt
#If VCE=0 #in volt
VCE2=0 #in volt
IC2=VCC/RC #in Ampere
################------------PLOT------------#############
t = arange(0.0001,6 , 0.0005)
t2 = arange(0.0001, 4, 0.0005)
a=arange(0.001,1,0.0005)
x=(4*a)/a
plot(t2,1*t2/t2,'--')
plot(x,a,'--')
plot(t,(3-0.5*t),'b')
text(4,1.1,'Q(4,1)')
text(0.1,3.05,'A')
text(6.05,0.1,'B')
xlabel('VCE(in volts)')
ylabel('IC(in mA)')
title('DC load line')
#########---------------------------------------##########
#Formula : VCC=VBE+IB*RB
IB=(VCC-VBE)/(RB*10**3) #in Ampere
IC=Beta*IB;#in Ampere
VCE=VCC-IC*RC*10**3 #in volt
print("Q point coordinates are :");
print("IC=%.1f mA and VCE=%.1f Volt."%((IC*10**3),(VCE)))
#RB and new value of IC
import math
#variable declaration
Beta=100.0 #unitless
IC=1.0 #in mA
VCC=12.0 #in volt
VBE=0.3 #in volt(For Ge)
#calculation
#Part (i)
IB=IC/Beta #in mA
#Formula : VCC=VBE+IB*RB
RB=(VCC-VBE)/(IB*10**-3) #in Ampere
#part (ii)
Beta=50 #unitless
IB=(VCC-VBE)/RB #in Ampere
IC=Beta*IB #in Ampere
#Result
print("Resistance RB in kOhm : %.0f"%(RB/10**3))
print("Zero signal IC in mA:%.1f"%(IC*10**3))
#Set the operating point
import math
print("To set the required operating point, value of RB will be find out.")
#variable declaration
IC=1.0 #in mA
VCE=8.0 #in volt
Beta=100.0 #unitless
VCC=12.0 #in volt
VBE=0.3 #in volt(For Ge)
#calculation
#Part (i)
RC=(VCC-VCE)/(IC*10**-3) #in ohm
IB=IC/Beta #in mA
RB=(VCC-VBE-Beta*(IB*10**-3)*RC)/(IB*10**-3) #in Ohm
#Part (ii)
Beta=50 #unitless
IB=(VCC-VBE)/(RB+Beta*RC) #in mA
IC=Beta*IB #in Ampere
VCE=VCC-IC*RC #in volt
#Result
print("Value of RB in kOhm : %.0f"%(RB/1000))
print("New operating point is %.1f V,%.1f mA"%(VCE,IC*10**3))
#Value of IC
import math
#variable declaration
R1=50.0 #in kohm
R2=10.0 #in kohm
RE=1.0 #in kohm
VCC=12.0 #in volt
#calaculation
#Part (i)
VBE=0.1 #in volt
VBBdash=(R2/(R1+R2))*VCC #in volt
IC1=(VBBdash-VBE)/(RE*1000) #in mA
#Part (ii)
VBE=0.3 #in volt
IC2=(VBBdash-VBE)/(RE*1000) #in mA
#result
print("At VBE=0.1V, Value of IC in mA : %.1f"%(IC1*1000))
print("At VBE=0.3V, Value of IC in mA : %.1f"%(IC2*1000))
#Operating point and stability factor
import math
#variable declaration
R1=10.0 #in kohm
R2=5.0 #in kohm
RE=2.0 #in kohm
RC=1.0 #in kohm
VCC=12.0 #in volt
Beta=100.0 #unitless
VBE=0.7 #in volt
#calculation
#Part (i)
#Formula : VBE=VBBdash-IB*RBdash-IE*RE
VBBdash=(R2/(R1+R2))*VCC #in volt
IE=(VBBdash-VBE)/(RE*10**3) #in Ampere
IC=IE #in mA
#Formula : VCC=IC*RC+VCE+IE*RE
VCE=VCC-IC*RC*10**3-IE*RE*10**3 #in Volt
#Part (ii)
RBdash=(R1*R2/(R1+R2)) #in kOhm
S=(Beta+1)/(1+Beta*(RE/(RBdash+RE)))
#Result
print("IB is ver small : VBE=VBBdash-IE*RE")
print("As base current is very small IC=IE\n")
print("Operating point is %.3f V, %.3f mA\n"%(VCE,IC*10**3))
print("Staility factor S is : %.2f"%(S))
#IC and VCE
import math
#variable declaration
R1=200.0 #in kohm
R2=100.0 #in kohm
RE=1.0 #in kohm
RC=1.0 #in kohm
VCC=9.0 #in volt
he=2.0 #in kohm
hfe=100.0 #unitless
hoe=0.0 #unitless
hre=0.0 #unitless
VBE=0.7 #in volt(For Si)
#Calculation
#Part (i)
RB=R1*R2/(R1+R2) #in kohm
VBBdash=(R2/(R1+R2))*VCC #in volt
#Applying Kirchoff Law
IB=(VBBdash-VBE)/(RB*10**3+RE*10**3*(1+hfe)) #in Ampere
IC=hfe*IB #in Ampere
#Part (ii)
#Applying Kirchoff Law
VCE=VCC-IC*RC*10**3-RE*1063*IB*(hfe+1) #in volt
#Result
print("Value of IC in mA : %.2f"%(IC*10**3))
print("VCE in volt :%.3f"%VCE)
#Note : Ans of VCE is wrong in the book as VCC=10 V has been taken instead of 9 volt.
#Region of Q point
import math
#variable declaration
RB=50.0 #in kohm
RC=3.0 #in kohm
VCC=10.0 #in volt
VEE=5.0 #in volt
hfe=100.0 #unitless
VCEsat=0.2 #in volt
VBEsat=0.8 #in volt
VBEactive=0.7 #in volt
VBE=0.7 #in volt(For Si)
#Calculations
#Applying : Kirchoff 2nd Law : VEE-RB*IB-VBE=0
IB=(VEE-VBE)/(RB*10**3) #in Ampere
IC=hfe*IB #in Ampere
#Applying Kirchoff 2nd Law to collector-emitter loop: VCC-IC*RC-VCB-VBEactive=0
VCB=VCC-IC*RC*10**3-VBEactive #in volt:
IB=(VEE-VBEsat)/(RB*10**3) #in Ampere
IC=(VCC-VCEsat)/(RC*10**3);
#result
print("Collector to base voltage, VCB :%.1fV"%VCB)
print("\nThis shows that the base collector junction is forward biased. This implies that the transistor is in saturation region.")
print("\nValue of IB in mA :%.3f"%(IB*10**3))
print("\nValue of IC in mA :%.2f"%(IC*10**3))
#Voltage across RE
import math
#variable declaration
VCC=20.0 #in volt
VBE=0.7 #in volt(For Si)
Beta=50.0 #unitless
RE=200.0 #in ohm
R1=60.0 #in kohm
R2=30.0 #in kohm
#calculation
V2=VCC*R2/(R1+R2) #in volt
VEO=V2-VBE #in volt
#result
print("Voltage across RE in volt : %.2f"%VEO)