#finding Ic,Pload,Pq,Ibase,Rbase
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vs=28.0;#V
Vi=5.0;#V
Rl=15.0;#ohm
Vc=.8;#V
b=20.0;
#calculation
Ic=(Vs-Vc)/Rl;
Pl=Ic**2*Rl;
Pq=Ic*Vc;
Ib=Ic/b*1000;
Rb=(Vi-.6)/Ib;
#result
print "collector current is",round(Ic,2), "A"
print "load power is",round(Pl,2), "W"
print "transistor power is",round(Pq,2), "W"
print "least value of base current is",round(Ib,2), "mA"
print "max value of base resistance is",round(Rb*100,2), "ohm"
print ('thus pick Rb=33ohm')
#finding Pload,Pq,Iload,resistances
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vd=28.0;#V
f=100.0;#frequency
I=50.0;#current
Rl1=560.0;
Vp=2.4;
Ib=500.0;#microAmp
D=.5;#duty cycle
#calculation
Rl=(Vd-.3)/I;
Rb=(Vp-.9)/Ib;
Vl=Vd-.3;
Ip=Vl/Rl1;
Pl=D*Vl*Ip;
Pq=D*Ip*.3;
#result
print "load resistance is",round(Rl*1000), "ohm"
print('thus pick Rl=560ohm')
print "max value of Rb is",round(Rb*1000,2),"kohm"
print('thus pick Rb=2.2kohm')
print "load current is",round(Ip*1000,2), "mA"
print "load power is",round(Pl*1000,2), "mW"
print "power delivered is",round(Pq*1000,2), "mW"
#finding time of rise
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
C=640.0;#capacitor
R1=560.0;#load resistance
R2=3.3;#kohm
#calculation
t1=2.2*R1*C;
t2=2.2*R2*C;
#result
print "time of rise is",round(t1/1000,2), "ns"
print "time of rise is",round(t2/1000,2), "microsec"
#finding Rpick up,time of rise
#initialisation of variable
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
Vol=0.7;
Iol=40.0/1000;#current
Rpullup1=680.0;
C=640.0;
Epullup=28.0;
#for plotting
x=[0, .1, 1.9, 4.1, 5, 5.1, 5.3, 5.6, 6.0, 9.3];
y=[27.8, .1, .1, .1, .1, 5, 13.5, 21.0, 27.0, 27.8];
#calculation
Rpullup=(Epullup-Vol)/Iol;
trise=2.2*Rpullup1*C;
plt.plot(x,y,'r');
plt.xlabel ('time(mus)')
plt.ylabel ('Vout')
plt.title ('Vout vs time')
#result
print "resistance is",round(Rpullup,2), "ohm"
print('pick up resistance=680 ohm');
print "rise time is",round(trise/1000,2), "ns"
#finding worst case resistance and power characteristics
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
R1=.11;#resistance
Vd=28.0;#voltage
R2=6.0;#ohm
D=.4;#duty cycle
Q=62.0;
#calculation
Ro=2.6*R1;
Ip=Vd/(R2+Ro);
Vl=Ip*R2;
Pl=D*Vl*Ip;
Vq=Ip*Ro;
Pq=D*Vq*Ip;
T=40+round(Pq*10)/10*Q;
#result
print "worst case resistance is",round(Ro,3), "ohm"
print "load current is",round(Ip,2),"A"
print "load voltage is",round(Vl,2), "V"
print "load power is",round(Pl,2), "W"
print "drop voltage is",round(Vq,2), "V"
print "power is",round(Pq*10,2)/10, "W"
print "temperature is",round(T,2), "deg.C"
#finding voltage
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
L=10.0;#inductor
I=4.5;#current
t=300.0#time
#calculation
V=L*I/t;
#result
print "voltage is",round(V*1000,2), "V"
#finding resistance and power characteristics
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Rl=12.0;#load resistance
V1=.8;#voltage
V2=2.4;#voltage
D=.8;#duty cycle
Tj=150.0;#degreeC
Ta=40.0;#degreeC
Vd=28.0;
Vo=.7;
I=40.0;#mA;
R1=330;
R2=360;
Vn1=28;
Vn2=.7;
#calculation
k=(Vd-Vo)/I;
Vg=R2*Vd/(R1+R2)+Vn2;
Vgs=Vg-Vd;
Vl=Vd*Rl/(Rl+.57);
Il=Vl/Rl;
Pl=D*Vl*Il;
Vq=Il*.57;
Pq=D*Vq*Il;
Q=(Tj-Ta)/Pq-3.7;
#result
print "R1+R2 is",round(k*1000,2), "ohm"
print('pick R1=330ohm & R2=360ohm as they divide Vd setting 8V<Vg<18V')
print "node voltage for V1 is",round(Vn1,2),"V"
print "node voltage for V2 is",round(Vn2,2), "V"
print "gate voltage is",round(Vg,2), "V"
print "gate & source diff is",round(Vgs,2), "V"
print "load voltage is",round(Vl,3), "V"
print "load current is",round(Il,2), "A"
print "load power is",round(Pl,2), "W"
print "Pq is",round(Pq,2), "W"
print "thermal resistance is",round(Q,2), "degreeC/W"
#finding time
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
I=40.0;#current
Q=44.0;#nC
#calculation
t=Q/I;
#result
print "time is",round(t,2), "micro s"
#finding different voltages and power
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Rl=15.0;#load resistance
D=.85;#duty cycle
Ts=60.0;#degreeC
Vd=28.0;#voltage
R1=.375;
R2=.2;
#calculation
I=Vd/(R1+R2+Rl);
Vl1=I*Rl;
P=D*Vl*I;
Vh=I*R1;
Ph=D*Vh*I;
Vl=I*R2;
Pl=D*Vl*I;
Pic=Ph+Pl;
Pic=1.56;
Tj=150;
Ta=60;
Q=(Tj-Ta)/Pic-2.2;
#result
print "current is",round(I,2), "A"
print "load voltage is",round(Vl1,2), "V"
print "power is",round(P,2), "W"
print "high side voltage is",round(Vh,2), "V"
print "high side power is",round(Ph,2), "W"
print "low side voltage is",round(Vl,2), "V"
print "low side power is",round(Pl,2), "W"
print "IC power is",round(Pic,2), "W"
print "thermal resistance is",round(Q,2), "degreeC/W"