VB=10 #breakover voltage(V)
Vin=15 #input voltage(V)
R=100.0 #resistance (Ohm)
I1=1000*Vin/R #diode current ideally(mA)
I2=1000*(Vin-0.7)/R #diode current with second approx.(mA)
I3=1000*(Vin-0.9)/R #diode current more accurately(mA)
print 'Diode current ideally ID1 = ',I1,'mA'
print 'Diode current with second approx. ID2 = ',I2,'mA'
print 'Diode current more accurately ID3 = ',I3,'mA'
Ih=4*10**-3 #holding current(mA)
R=100.0 #resistance (Ohm)
Vs=15 #input voltage (V)
Vin=0.7+(Ih*R) #new input voltage(V)
print 'New input voltage Vin = ',Vin,'V'
R=2.0*10**3 #resistance (Ohm)
C=0.02*10**-6 #capacitance (F)
VB=10 #breakdown voltage(V)
RC=R*C #Time constant(s)
T=0.2*RC #period (s)
f=T**-1 #frequency(Hz)
print 'time constant RC = ',RC*10**6,'us'
print 'Period T = ',T*10**6,'us'
print 'Frequency = ',f/1000,'KHz'
It=7*10**-3 #trigger current(mA)
R1=100.0 #resistance (Ohm)
R2=1*10**3 #resistance (Ohm)
Vt=0.75 #trigger voltage (V)
Ih=6*10**-3 #holding current(mA)
Vin=Vt+(It*R2) #minimum input voltage(V)
VCC=0.7+(Ih*R1) #supply voltage for turning of SCR(V)
print 'Minimum input voltage Vin = ',Vin,'V'
print 'supply voltage for turning of SCR VCC = ',VCC,'V'
IGT=200*10**-6 #trigger current(mA)
VGT=1 #trigger voltage(V)
R1=900.0 #resistance (Ohm)
R2=100.0 #resistance (Ohm)
C=0.2*10**-6 #capacitance (F)
Vt=0.75 #trigger voltage (V)
Ih=6*10**-3 #holding current(mA)
R=1*10**3 #Resistance (Ohm)
RTH=R1*R2/(R1+R2) #Thevenin resistance (Ohm)
Vin=VGT+(IGT*RTH) #input voltage needed to trigger(V)
Vp=10*Vin #Output voltage at SCR firing point(V)
RC=C*(R/2) #time constant (s)
T=RC*0.2 #period (s)
f=1/T #frequency (Hz)
print 'peak output voltage Vpeak = ',Vp,'V'
print 'time constant RC = ',RC*10**6,'us'
print 'Period T = ',T*10**6,'us'
print 'Frequency = ',f/1000,'KHz'
Vz=5.6 #breakdown voltage(V)
VGT1=0.75 #trigger voltage (V)
VGT2=1.5 #worst case maximum trigger voltage(V)
Vz2=6.16 #break down voltage with 10% tolerance (V)
VCC1=Vz+VGT1 #supply voltage(V)
VCC2=VGT2+Vz2 #Over voltage (V)
print 'supply voltage VCC1 = ',VCC1,'V'
print 'supply over voltage VCC2 = ',VCC2,'V'
import math # This will import math module
C=0.1*10**-6 #capacitance (F)
f=60 #frequency (Hz)
R=26*10**3 #resistance(KOhm)
Vm=120 #input ac voltage(V)
XC=(2*math.pi*f*C)**-1 #capacitive reactance(Ohm)
ZT=((R**2)+(XC**2))**0.5 #impedance (Ohm)
thetaz=math.atan2(-XC,R)*180/math.pi #angle (deg)
IC=Vm/ZT #Current through C(A)
VC=IC*XC #voltage across C(V)
thetac=180+thetaz #conduction angle(deg)
print 'Capacitor reactance XC = ',round((XC/1000),2),'KOhm'
print 'impedance ZT = ',round((ZT/1000),2),'KOhm'
print 'firing angle = ',round(thetaz,2),'deg'
print 'Current through C, IC = ',round((IC*1000),2),'mA'
print 'voltage across C, VC = ',round(VC,2),'V'
print 'conduction angle = ',round(thetac,2),'deg'
C=1*10**-6 #capacitance (F)
R1=22.0 #resistance (Ohm)
R2=82*10**3 #resistance(KOhm)
Vs=75 #input voltage(V)
I=Vs/R1 #current through 22Ohm resistor (A)
print 'current through 22Ohm resistor I = ',round(I,2),'A'
Vdb=32.0 #diac break down voltage (V)
VTT=1 #triac trigger voltage(V)
Vin=VTT+Vdb #input voltage for triggering triac
print 'input voltage for triggering triac vin = ',Vin,'V'