In [9]:

```
from __future__ import division
from numpy import pi
from math import sqrt
# Given data
R_L = 1000 # in ohm
N2byN1= 4
Vi= '10*sin(omega*t)'
# V2= N2byN1*V1
# V2= 40*sin(omega*t)
Vm= N2byN1*10 # in V
V_Lav= Vm/pi # in V
print "The average load voltage = %0.2f volts" %V_Lav
Im= Vm/R_L # in A
I_dc= Im/pi # in A
I_av = I_dc # in A
I_av= I_av*10**3 # in mA
print "Average load current = %0.2f mA" %I_av
V_Lrms = Vm/2 # in V
print "RMS load voltage = %0.f V" %V_Lrms
I_rms = V_Lrms/R_L # in A
I_rms= I_rms*10**3 # in mA
print "RMS load current = %0.f mA" %I_rms
Eta = I_av**2/I_rms**2*100 # in %
print "Efficiency = %0.2f %%" %Eta
V2rms= Vm/sqrt(2) # in V
TUF = ((I_av )**2)/(V2rms*I_rms)*100 # in %
print "Transformer utilization factor = %0.2f %%" %TUF
Gamma= sqrt(V_Lrms**2-I_av**2)/V_Lav*100
print "Ripple factor = %0.f %%" %round(Gamma)
```

In [10]:

```
# Given data
R_L = 1 # in K ohm
R_L = R_L * 10**3 # in ohm
V_m = 15 # in V
V_i = '15*sin(314*t)'
I_m= V_m/R_L # in A
I_dc = I_m/pi # in A
I_dc = I_dc * 10**3 # in mA
print "Average current through the diode = %0.2f mA" %I_dc
I_drms = V_m/(2*R_L)
I_drms = I_drms * 10**3 # in mA
print "RMS current = %0.1f mA" %I_drms
I_m = V_m/R_L
I_m = I_m*10**3 # in mA
print "Peak diode current = %0.f mA" %I_m
PIV = 2*V_m # in V
print "Peak inverse voltage = %0.f V" %PIV
```

In [11]:

```
# Given data
R1 = 2.2*10**3 # in ohm
R2 = 4.7*10**3 # in ohm
R_AB = (R1*R2)/(R1+R2) # in ohm
Vi = 20 # in V
V_o = (Vi * R_AB)/(R_AB+R1) # in V
PIV= Vi # in volts
print "The output voltage = %0.1f V" %V_o
print "Peak inverse voltage = %0.f volts" %PIV
```

In [23]:

```
from math import cos
# Given data
V_in = 10 # in V
R1 = 2000 # in ohm
R2 = 2000 # in ohm
V_o = V_in * (R1/(R1+R2) ) # in V
# Vdc= 5/(T/2)*integrate('sin(omega*t)','t',0,T/2) and omega*T= 2*pi, So
Vdc= -5/pi*(cos(pi)-cos(0)) # in V
print "The value of Vdc = %0.3f volts" %Vdc
PIV= V_in/2 # in V
print "The PIV value = %0.f volts" %PIV
```

In [27]:

```
# Given data
V_in = 10 # in V
R_L = 2000 # in ohm
R1 = 100 # in ohm
V_R= 0.7 # in V
V_o = V_in * ( (R_L)/(R1+R_L) ) # in V
print "The peak magnitude of the positive output voltage = %0.2f V" %V_o
Vo=-V_R # in V
print "The peak magnitude of the negative output voltage = %0.1f V" %Vo
```

In [28]:

```
# Given data
V=240 # in V
R= 1 # in kΩ
R=R*10**3 # in Ω
Vsrms= V/4 # in V
Vm= sqrt(2)*Vsrms # in V
V_Ldc= -Vm/pi # in V
print "The value of average load voltage = %0.f volts" %V_Ldc
```

In [32]:

```
# Given data
V = 220 # in V
f=50 # in Hz
N2byN1=1/4
R_L = 1 # in kohm
R_L= R_L*10**3 # in ohm
V_o = 220 # in V
V_s = N2byN1*V_o # in V
V_m = sqrt(2) * V_s # in V
V_Ldc = (2*V_m)/pi # in V
print "Average load output voltage = %0.2f V" %V_Ldc
P_dc = (V_Ldc)**2/R_L # in W
print "DC power delivered to load = %0.2f watt" %P_dc
PIV = V_m # in V
print "Peak inverse Voltage = %0.2f V" %PIV
f_o = 2*f # in Hz
print "Output frequency = %0.f Hz" %f_o
```

In [34]:

```
# Given data
R_L = 20 # in ohm
I_Ldc = 100 # in mA
R2 = 1 # in ohm
R_F = 0.5 # in ohm
I_m = (pi * I_Ldc)/2 # in mA
V_m = I_m*10**-3*(R2+R_F+R_L) # in V
V_srms = V_m/sqrt(2) # in V
print "RMS value of secondary signal voltage = %0.1f V" %V_srms
P_Ldc = (I_Ldc*10**-3)**2*R_L # in Watt
print "power delivered to load = %0.1f Watt" %P_Ldc
PIV = 2*V_m # in V
print "Peal inverse voltage = %0.2f V" %PIV
P_ac = (V_m)**2/(2*(R2+R_F+R_L)) # in Watt
print "Input power = %0.3f Watt" %P_ac
Eta = P_Ldc/P_ac*100 # in %
print "Conversion efficiency = %0.2f %%" %Eta
```

In [35]:

```
# Given data
V_dc = 12 # in V
R_L = 500 # in ohm
R_F = 25 # in ohm
I_dc = V_dc/R_L # in A
V_m = I_dc * pi * (R_L+R_F) # in V
V_rms = V_m/sqrt(2) # in V
V = V_rms # in V
print "The voltage = %0.f V" %round(V)
```

In [36]:

```
# Given data
V_dc = 100 # in V
V_m = (V_dc*pi)/2 # in V
PIV = 2*V_m # in V
print "Peak inverse voltage for center tapped FWR = %0.2f V" %PIV
PIV1 = V_m # in V
print "Peak inverse voltage for bridge type FWR = %0.2f V" %PIV1
```

In [38]:

```
# Given data
V_Gamma = 0.7 # in V
R_f = 0 # in ohm
V_rms = 120 # in V
V_max = sqrt(2)*V_rms # in V
R_L = 1 # in K ohm
R_L = R_L * 10**3 # in ohm
I_max = (V_max - (2*V_Gamma))/R_L # in A
I_dc = (2*I_max)/pi # in mA
V_dc = I_dc * R_L # in V
print "The dc voltage available at the load = %0.2f V" %V_dc
PIV = V_max # in V
print "Peak inverse voltage = %0.1f V" %PIV
print "Maximum current through diode = %0.1f mA" %(I_max*10**3)
P_max = V_Gamma * I_max # in W
print "Diode power rating = %0.2f mW" %(P_max*10**3)
```

In [39]:

```
# Given data
V1 = 10 # in V
V2 = 0.7 # in V
V3 = V2 # in V
V = V1-V2-V3 # in V
R1 = 1 # in ohm
R2 = 48 # in ohm
R3 = 1 # in ohm
R = R1+R2+R3 # in ohm
I = V/R # in A
I = I * 10**3 # in mA
print "Current = %0.f mA" %I
```

In [41]:

```
# Given data
V_m = 50 # in V
r_f = 20 # in ohm
R_L = 800 # in ohm
I_m = V_m/(R_L+r_f) # in A
I_m = I_m * 10**3 # in mA
print "The value of Im = %0.f mA" %round(I_m)
I_dc = I_m/pi # in mA
print "The value of I_dc = %0.1f mA" %I_dc
I_rms = I_m/2 # in mA
print "The value of Irms = %0.1f mA" %I_rms
P_ac = (I_rms * 10**-3)**2 * (r_f + R_L) # in Watt
print "AC power input = %0.3f Watt" %P_ac
V_dc = I_dc * 10**-3*R_L # in V
print "DC output voltage = %0.2f V" %V_dc
P_dc = (I_dc * 10**-3)**2 * (r_f + R_L) # in Watt
Eta = (P_dc/P_ac)*100 # in %
print "The efficiency of rectification = %0.1f %%" %Eta
# Note: There is calculation error to evaluate the ac power input (i.e. P_ac), so the value of Eta is also wrong
```

In [44]:

```
# Given data
R_L = 1 # in K ohm
R_L = R_L * 10**3 # in ohm
r_d = 10 # in ohm
V_m = 220 # in V
I_m = V_m/(r_d+R_L) # in A
print "Peak value of current = %0.2f A" %I_m
I_dc = (2*I_m)/pi # in A
print "DC value of current = %0.2f A" %I_dc
Irms= I_m/sqrt(2) # in A
r_f = sqrt((Irms/I_dc)**2-1)*100 # in %
print "Ripple factor = %0.1f %%" %r_f
Eta = (I_dc)**2 * R_L/((Irms)**2*(R_L+r_d))*100 # in %
print "Rectification efficiency = %0.1f %%" %Eta
```

In [45]:

```
# Given data
V_s = 12 # in V
R_L = 5.1 # in k ohm
R_L = R_L * 10**3 # in ohm
R_s = 1 # in K ohm
R_s = R_s * 10**3 # in ohm
V_L = (V_s*R_L)/(R_s+R_L) # in V
print "Peak load voltage = %0.f V" %V_L
```

In [46]:

```
# Given data
V_s = 10 # in V
R_L = 100 # in ohm
I_L = V_s/R_L # in A
print "The load current during posotive half cycle = %0.1f A" %I_L
I_D2 = 0 # in A
R2 = R_L # in ohm
I_L1 = -(V_s)/(R2+R_L) # in A
print "The load current during negative half cycle = %0.2f A" %I_L1
```

In [47]:

```
# Given data
V_m = 50 # in V
V_dc = (2*V_m)/pi # in V
print "The dc voltage = %0.2f V" %V_dc
```

In [48]:

```
# Given data
R1 = 1.1 # in K ohm
R2 = 2.2 # in K ohm
Vi= 170 # in V
V_o = (Vi*R1)/(R1+R2) # in V
print "The output voltage = %0.2f V" %V_o
V_dc = (2*V_o)/pi # in V
print "The dc voltage = %0.2f V" %V_dc
```