#Caption:Design RC ramp generator
import math
V=5.#Output voltage(in volts)
Vs=15.#Supply voltage(in volts)
R=100.#Load resistance(in kilo ohm)
v=3.#Amplitude of triggering pulse(in volts)
vb=0.5#Bse voltage(in volts)
p=1.2#Pulse width(in ms)
t=0.1#Time interval(in ms)
vbe=0.7#Base emitter voltage(in volts)
E=0.2#Initial voltage(in volts)
e=5.#Final voltage(in volts)
hfe=50.
Il=V/R
I1=100.*Il/1000.
R1=(Vs-V)/(I1*1000.)
C1=p/(R1*math.log((Vs-E)/(Vs-e)))
Ic=10.*I1
Ib=Ic/hfe
Rb=(Vs-vbe)/(Ib*1000.)
Vbb=v-vbe-vb
I=(Vs+v)/Rb
C2=I*p/Vbb
print '%s %.1f %s %.f %s %.1f %s %.2f' %('Components required to design circuit are resistances \nRb(in kilo ohm)=',Rb,'\nR1(in kilo ohm)=',R1,'\nCapacitors \nC1(in micro farad)=',C1,'\nC2(in micro farad)=',C2)
#Caption:Design a linear ramp generator
V=5.#Output voltage(in volts)
Vcc=15.#Supply voltage(in volts)
Vce2=3.#Voltage(in volts)
C1=1.#Capacitance(in micro fard)
t=1.#pulse width(in ms)
Vbe=0.7#Base emitter voltage(in volts)
V3=Vcc-Vce2-5
Ic=C1*V/t
R3=V3/Ic
Vb=V3+Vbe
I1=Ic/10.
R1=Vb/I1
i1=Vb/R1
V2=Vcc-Vb
R2=V2/I1
print '%s %.1f %s %.1f %s %.1f %s %.f' %('Components required to design the circuit are resistors \nR1(in kilo ohm)=',13.4,'\nR2(in kilo ohm)=',R2,'\nR3(in kilo ohm)=',R3,'\ncapacitance C1(in micro farad)=',C1)
#Caption:Determine Rsmax,Rsmin,and minimum drain source voltage
I=2.#Drain Current(in mA)
Vgsm=3.#Maximum gate source voltage(in volts)
Vgsn=0.5#Minimum gate source voltage(in volts)
V=6.#Peak voltage(in volts)
Rs1=Vgsm/I
Rs2=Vgsn*1000./I
Vds=V-Vgsm+1.
print '%s %.1f %s %.f %s %.f' %('Required resistances Rsmax(in kilo ohm)=',Rs1,'\nRsmin(in ohm)=',Rs2,'\ndrain source voltage(in volts)=',Vds)
#Caption:Design a UJT relaxation oscillator and find peak to peak output amplitude
import math
Vbb=20.#Supply voltage(in volts)
f=5.#Frequency(in khz)
Veb=3.#Fringe Voltage(in volts)
Ip=2.#Fringe current(in micro ampere)
Iv=1.#Emitter current(in mA)
n=0.75
Vp=3.7+(n*Vbb)
R1x=(Vbb-Vp)/Ip
R1n=(Vbb-Veb)/Iv
t=1000./f
C1=t*1443./(R1n*(math.log((Vbb-Veb)/(Vbb-Vp))))
E=Vp-Veb
print '%s %.1f %s %.f %s %.f' %('Peak to peak voltage(in volts)=',E,'\nComponents for circuit are \nresistor(in kilo ohm)=',R1n,'\ncapacitance(in pf)=',C1)
#Caption:Design a transistor bootstrap ramp generator
V=8.#Amplitude of output voltage(in volts)
Vd=0.7#Forward diode voltage(in volts)
Vce=0.2#Saturated collector emitter voltage(in volts)
t=1.#Interval between pulses(in ms)
Vt=3.#Triggering voltage(in volts)
E=15.#Supply voltage(in volts)
vbe=0.7#Base emitter voltage(in volts)
vb=0.5#Bse voltage(in volts)
hfe=100.
R=1.#Load resistor(in kilo ohm)
Ie1=E/R
Ie2=(V-(-E))/R
Ib1=Ie1/hfe
Ib2=Ie2/hfe
Ibc=Ib2-Ib1
I1=100.*Ibc/1000.
C1=I1*t*1000./V
Vr1=E-Vd-Vce
R1=Vr1/I1
Vc3=E/100.
C3=I1*t*1000./Vc3
Il=V/R
I1=100.*Il/1000.
Ic=10.*I1
Ib=Ic/hfe
Rb=(E-vbe)/(Ib*12.5)
Vbb=V-vbe-vb
I=(E+Vt)/Rb
C2=I*t/Vbb
print '%s %.1f %s %.f %s %.2f %s %.f' %('Circuit components are \nresistor Rb(in kilo ohm)=',Rb,'\ncapacitances \nC1(in micro farad)=',C1,'\nC2(in micro farad)=',C2,'\nC3(in micro farad)=',C3)
#Caption:Calculate drain current
V=5.#Output peak voltage(in volts)
p=1.#Pulse width(in ms)
s=50.#Space width(in micro sec)
C=0.03#Capacitance(in micro farad)
Vp=6.#Gate source voltage(in volts)
I1=C*V*1000./p
Vi=Vp+1.
R1=Vi/I1
Id=I1*p/s
print '%s %.f' %('Drain current(in mA)=',Id)
#Caption:Design a pulse generator using 8038 IC
p=200.#Pulse width(in micro sec)
f=1.#Pulse repetition frequency(in khz)
V=10.#Output voltage(in volts)
I=1.#Maximum current(in mA)
T=1000./f
t2=T-p
Ib=I*p/t2
Ra=V/(5.*I)
C=0.6*p/(Ra*1000.)
Rb=2.*V/(5.*(I+Ib))
Rl=V/I
print '%s %.3f %s %.f %s %.1f %s %.f' %('Circuit components are \nCapacitance(in micro farad)=',C,'\nResistances Rl(in kilo ohm)=',Rl,'\nRb(in kilo ohm)=',Rb,'\nRa(in kilo ohm)=',Ra)
#Caption:Calculate output maximum and minimum frequencies
V=15.#Supply voltage(in volts)
Imin=10.#Minimum current(in micro ampere)
Imax=1.#Maximum current(in mA)
C=3600.#Capacitor(in pF)
Rmax=V/(10.*Imin)
Rmin=V/(10.*Imax)
fmin=0.151*10.**6./(C*Rmax)
fmax=0.15*10.**6./(C*Rmin)
print '%s %.f %s %.f' %('minimum frequency(in hz)=',fmin,'\nMaximum frequency(in khz)=',fmax)