from __future__ import division
#Given data
bita= 50
R1= 1 # in kΩ
R1= R1*10**3 #in Ω
R2= 300 # in Ω
R3= 360 # in Ω
R4= 640 # in Ω
V1= 10 # in V
V2= 20 # in V
I_B1=19.2*10**-3 # in A
I_L= 1 #in A
V_Z= 5.6 # in V
V_B= R4*V1/(R3+R4) #in V
V_BE2= V_B-V_Z # in V
V_A= V1-V_BE2 # in V
print "Part (i) :-"
print " The value of V_A = %0.1f volt" %V_A
print " The value of V_B = %0.1f volt" %V_B
# Part (ii)
I1= V1/(R3+R4) # in A
#I1= .01*10**-3 # in A
I2= (V2-V_A)/R2 # in A
I_C2= I2-I_B1 # in A
I_B1= (I1+I_L)/(1+bita) # in A
print "\nPart (ii) :-"
print " The base current of T1 = %0.1f mA" %(I_B1*10**3)
I_C2= I2-I_B1 # in A
I_E2= I_C2 # in A
print " The emitter current of T2 = %0.1f mA" %(I_E2*10**3)
# part (iii)
I3= (V2-V_Z)/R1 # in A
I_Z= I3+I_E2 # in A
print "\nPart (iii) :-"
print " Current through zener diode = %0.1f mA" %(I_Z*10**3)
V_CE= V2-V1 # in V
I_C1= bita*I_B1 # in A
T1= V_CE*I_C1 # in W
print " Power dissipation = %0.1f watt" %T1
#Given data
bita= 100
R1= 1 # in kΩ
R1= R1*10**3 #in Ω
R2= 300 # in Ω
R3= 360 # in Ω
R4= 640 # in Ω
V1= 10 # in V
V2= 20 # in V
I_B1=19.2*10**-3 # in A
I_L= 1 #in A
V_Z= 5.6 # in V
V_B= R4*V1/(R3+R4) #in V
V_BE2= V_B-V_Z # in V
V_A= V1-V_BE2 # in V
print "Part (i) :-"
print " The value of V_A = %0.1f volt" %V_A
print " The value of V_B = %0.1f volt" %V_B
# Part (ii)
I1= V1/(R3+R4) # in A
#I1= .01*10**-3 # in A
I2= (V2-V_A)/R2 # in A
I_C2= I2-I_B1 # in A
I_B1= (I1+I_L)/(1+bita) # in A
print "\nPart (ii) :-"
print " The base current of T1 = %0.f mA" %(I_B1*10**3)
I_C2= I2-I_B1 # in A
I_E2= I_C2 # in A
print " The emitter current of T2 = %0.1f mA" %(I_E2*10**3)
# part (iii)
I3= (V2-V_Z)/R1 # in A
I_Z= I3+I_E2 # in A
print "\nPart (iii) :-"
print " Current through zener diode = %0.1f mA" %(I_Z*10**3)
V_CE= V2-V1 # in V
I_C1= bita*I_B1 # in A
T1= V_CE*I_C1 # in W
print " Power dissipation = %0.1f watt" %T1
# Note: In the part (iv), the wrong value of I_B1 and bita is putted, these two value is putted of the Example 7.1
# (i.e. I_B1= 19.8 mA and bita= 50) whereas in this example the value of bita is given 100 and the value of
# of I_B1 is calculated as 10 mA. So the answer of the last part of this example is wrong.
#Given data
bita= 50
R1= 1 # in kΩ
R1= R1*10**3 #in Ω
R2= 500 # in Ω
R3= 400 # in Ω
R4= 600 # in Ω
V1= 10 # in V
V2= 20 # in V
I_B1=19.2*10**-3 # in A
I_L= 1 #in A
V_Z= 5 # in V
V_B= R4*V1/(R3+R4) #in V
V_BE2= V_B-V_Z # in V
V_A= V1-V_BE2 # in V
print "Part (i) :-"
print " The value of V_A = %0.f volt" %V_A
print " The value of V_B = %0.f volt" %V_B
# Part (ii)
I1= V1/(R3+R4) # in A
#I1= .01*10**-3 # in A
I2= (V2-V_A)/R2 # in A
#I2= .042
I_C2= I2-I_B1 # in A
I_B1= (I1+I_L)/(1+bita) # in A
print "Part (ii) :-"
print " The base current of T1 = %0.1f mA" %(I_B1*10**3)
I_C2= I2-I_B1 # in A
I_E2= I_C2 # in A
print " The emitter current of T2 = %0.1f mA" %(I_E2*10**3)
# part (iii)
I3= (V2-V_Z)/R1 # in A
I_Z= I3+I_E2 # in A
print "Part (iii) :-"
print " Current through zener diode = %0.f mA" %(I_Z*10**3)
V_CE= V2-V1 # in V
I_C1= bita*I_B1 # in A
T1= V_CE*I_C1 # in W
print " Power dissipation = %0.f watt" %T1
# Note: In the book, there is a calculation error to evaluate the value of
# I2 ( (20-9)/500 = 42 mA is wrong, correct value is 22 mA) So the answer is wrong
#Given data
Vmin= 2.2 # in V
Vmax= 4.0 # in V
I= 11 # in mA
I= I*10**-3 #in A
Resistance= Vmin/I # in Ω
Current = Vmax/Resistance # in A
print " The value of resistance = %0.f Ω" %Resistance
print " The value of current = %0.f mA" %(Current*10**3)
#Given data
V1= 6.2 # in V
V2= 0.6 # in V
V3= 0.6 # in V
Vout= V1-V2-V3 # in V
print " The output voltage = %0.1f volts" %Vout