summaryrefslogtreecommitdiff
path: root/Electronic_Devices_by_T_L_Floyd/2-diode_applications.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Electronic_Devices_by_T_L_Floyd/2-diode_applications.ipynb')
-rw-r--r--Electronic_Devices_by_T_L_Floyd/2-diode_applications.ipynb519
1 files changed, 519 insertions, 0 deletions
diff --git a/Electronic_Devices_by_T_L_Floyd/2-diode_applications.ipynb b/Electronic_Devices_by_T_L_Floyd/2-diode_applications.ipynb
new file mode 100644
index 0000000..456a028
--- /dev/null
+++ b/Electronic_Devices_by_T_L_Floyd/2-diode_applications.ipynb
@@ -0,0 +1,519 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 2: diode applications"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.10: Negative_diode_limiter.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.10\n",
+"//let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n",
+"f=1; //Frequency is 1Hz\n",
+"T=1/f;\n",
+"R_1=100; //Resistances in ohms\n",
+"R_L=1000; //Load\n",
+"V_p_in=10; //Peak input voltage\n",
+"V_th=0.7; //knee voltage of diode\n",
+"clf();\n",
+"V_p_out=V_p_in*(R_L/(R_L+R_1)); //peak output voltage\n",
+"disp(V_p_out,'peak output voltage in volts')\n",
+"//let n be double the number of cycles of output shown in graph\n",
+"for n=0:1:6\n",
+" t=T.*n/2:0.0005:T.*(n+1)/2 //time for each half cycle\n",
+" V_in=V_p_in*sin(2*%pi*f.*t);\n",
+" Vout=V_in*(R_L/(R_L+R_1));\n",
+" if modulo(n,2)==0 then //positive half, diode reverse biased\n",
+" y=Vout;\n",
+" else //negative half, diode forward biased\n",
+" a=bool2s(Vout<-0.7); //puts zero to elements for which diode will conduct\n",
+" b=bool2s(Vout>-0.7);\n",
+" y=-V_th*a+b.*Vout;\n",
+" end\n",
+" plot(t,y)\n",
+" end\n",
+"xtitle('Negative limiter graph')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.11: Posiive_Negative_Limiter.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.11\n",
+"//let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n",
+"f=1; //Frequency is 1Hz\n",
+"T=1/f;\n",
+"V_p_in=10; //Peak input voltage\n",
+"V_th=0.7; //knee voltage of diode\n",
+"clf();\n",
+"//let n be double the number of cycles of output shown in graph\n",
+"for n=0:1:8\n",
+" t=T.*n/2:0.0005:T.*(n+1)/2 //time for each half cycle\n",
+" V_in=V_p_in*sin(2*%pi*f.*t);\n",
+" Vout=V_in;\n",
+" if modulo(n,2)==0 then //positive half,D1 conducts till V_in=5.7V\n",
+" a=bool2s(Vout<5.7); \n",
+" b=bool2s(Vout>5.7); \n",
+" y=a.*Vout+5.7*b; //output follows input till 5.7V then is constant at 5.7V\n",
+" else //negative half, D2 conducts till V_in=-5.7V\n",
+" a=bool2s(Vout<-5.7); \n",
+" b=bool2s(Vout>-5.7);\n",
+" y=-5.7*a+b.*Vout; //output follows input till -5.7V then stays constant at -5.7V\n",
+" end\n",
+" plot(t,y,'r')\n",
+" \n",
+" plot(t,V_in,'-.')\n",
+" end\n",
+" hl=legend(['output','input']);\n",
+" xtitle('Positive and Negative diode limiter')\n",
+" disp('max output voltage is 5.7V')\n",
+" disp('min output voltage is -5.7V')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.12: Positive_diode_limiter.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.12\n",
+"//Positive diode limiter\n",
+"//Let input wave be V_in=V_p_in*sin(2*%pi*f*t)\n",
+"f=1; //let frequency be 1Hz\n",
+"T=1/f;\n",
+"V_p_in=18; //peak input voltage is 18V\n",
+"V_supply=12;\n",
+"R2=100;\n",
+"R3=220; //resistances in ohms\n",
+"V_bias=V_supply*(R3/(R2+R3));\n",
+"V=V_bias+0.7; //waveform clipped at V\n",
+"clf();\n",
+"//let n be double the number of cycles of output wave shown in graph\n",
+"for n=0:1:8\n",
+" t=n*T/2:0.0005:T.*(n+1)/2;\n",
+" V_in=V_p_in*sin(2*%pi*f.*t);\n",
+" Vout=V_in;\n",
+" if modulo(n,2)==0 then //positive half, diode conucts till V\n",
+" a=bool2s(Vout<V);\n",
+" b=bool2s(Vout>V);\n",
+" y=a.*Vout+V*b;\n",
+" else //negative half cycle, output follows input\n",
+" y=Vout;\n",
+" end\n",
+" plot(t,y)\n",
+"end\n",
+"xtitle('Positive diode limiter graph')\n",
+"disp(V,'diode limiting the voltage at this voltage')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.13: Negative_Clamper.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.13\n",
+"//Negative Clamping circuit\n",
+"//let input voltage be V_in=V_p_in*sin(2*%pi*f*t)\n",
+"f=1; //let frequency be 1Hz\n",
+"T=1/f;\n",
+"V_p_in=24;\n",
+"V_DC=-(V_p_in-0.7); //DC level added to output\n",
+"disp(V_DC,'V_DC in volts= ')\n",
+"for n=0:1:8\n",
+" t=n*T/2:0.0005:T.*(n+1)/2;\n",
+" V_in=V_p_in*sin(2*%pi*f.*t);\n",
+" Vout=V_DC+V_in;\n",
+" plot(t,Vout)\n",
+"end\n",
+"xtitle('Negative clipper graph')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.1: Average_value_half_wave_rectifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.1\n",
+"//Average value of half wave rectifier\n",
+"V_p=50; //Peak value is 50V\n",
+"V_avg=V_p/%pi;\n",
+"disp(V_avg,'average value of half wave rectifier in volts')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.2_a: half_wave_rectifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example-2.2(a)\n",
+"//let V_in=5*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz\n",
+"f=1;\n",
+"V_p_in=5;\n",
+"V_pout=V_p_in-0.7;;\n",
+"disp(V_pout,'half wave rectifier output in volts')\n",
+"t_d=(asin(0.7/V_p_in))/(2*%pi*f)\n",
+"//t_d is the time till which diode will be reverse biased ie, till it reaches knee voltage\n",
+"T=1/f;\n",
+"clf();\n",
+"//let n be double the number of cycles of output shown in graph\n",
+"for n=0:1:8\n",
+" t=T.*n/2:0.0005:T.*(n+1)/2 //time for each half cycle\n",
+" if modulo(n,2)==0 then //positive half cycle, diode is forward biased\n",
+" V_in=V_p_in*sin(2*%pi*f.*t)\n",
+" Vout=V_in-0.7 //0.7 is knee voltage of diode\n",
+" a=bool2s(Vout>0) //replace elements of Vout by 0 till input is 0.7\n",
+" y=a.*Vout\n",
+" else //negative half cycle, diode is reverse biased\n",
+" [p,q]=size(t);\n",
+" y=zeros(p,q);\n",
+" end\n",
+" plot(t,y)\n",
+"end\n",
+"xtitle('half wave rectifier output')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.2_b: half_wave_rectifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example-2.2(b)\n",
+"//let V_in=100*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz\n",
+"f=1;\n",
+"T=1/f;\n",
+"V_p_in=100;\n",
+"V_pout=(V_p_in-0.7);\n",
+"disp(V_pout,'output of half wave rectifier in volts')\n",
+"t_d=(asin(0.7/V_p_in))/(2*%pi*f) \n",
+"//t_d is the time till which diode will be reverse biased ie, till it reaches knee voltage\n",
+"clf();\n",
+"//let n be double the number of cycles of output shown in graph\n",
+"for n=0:1:7\n",
+" t=T.*n/2:0.0005:T.*(n+1)/2 // time for each half cycle\n",
+" if modulo(n,2)==0 then //positive half cycle\n",
+" V_in=V_p_in*sin(2*%pi*f.*t)\n",
+" Vout=V_in-0.7 //0.7 is knee voltage of diode\n",
+" a=bool2s(Vout>0) //replace elements of Vout by 0 till input is 0.7\n",
+" y=a.*Vout\n",
+" else //negative half cycle\n",
+" [p,q]=size(t);\n",
+" y=zeros(p,q);\n",
+" end\n",
+" plot(t,y)\n",
+"end\n",
+"xtitle('half wave rectifier output')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.3: Rectifier_peak_value.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.3\n",
+"V_p_in=156; //Peak input voltage\n",
+"V_p_pri=156; //Peak voltage of primary of transformer\n",
+"n=1/2; //Turn ratio is 2:1\n",
+"V_p_sec=n*V_p_pri;\n",
+"V_p_out=(V_p_sec-0.7);\n",
+"disp(V_p_out,'peak output voltage of half wave rectifier in volts') //Peak output voltage"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.4: Average_value_full_wave_rectifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.4\n",
+"//Average value of output of full wave rectifier\n",
+"V_p=15; //Peak voltage\n",
+"V_avg=(2*V_p)/%pi;\n",
+"disp(V_avg,'Average value of output of full wave rectifier in volts') //Result"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.5: PIV_full_wave.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.5\n",
+"//Assume frequency of input to be 1Hz\n",
+"f=1;\n",
+"T=1/f;\n",
+"V_p_pri=100; //Peak voltage across primary winding\n",
+"n=1/2; //tun ratio is 2:1\n",
+"V_p_sec=n*V_p_pri;\n",
+"V_sec=V_p_sec/2; //voltage across each secondary is half the total voltage\n",
+"clf();\n",
+"subplot(121)\n",
+"xtitle('voltage across each secondary')\n",
+"t=0:0.0005:2;\n",
+"x=V_sec*sin(2*%pi*f.*t);\n",
+"plot(t,x)\n",
+"subplot(122)\n",
+"xtitle('voltage across load')\n",
+"//let n be double the number of cycles of output shown in graph\n",
+"for n=0:1:4\n",
+" t=n.*T/2:0.0005:(n+1).*(T/2);\n",
+"V_pout=V_sec-0.7;\n",
+"V=V_pout*sin(2*%pi*f.*t)\n",
+"a=bool2s(V*(-1)^n>0);\n",
+"y=(-1)^n.*a.*V;\n",
+"plot(t,y)\n",
+"end\n",
+"disp(V_pout,'full wave rectifier output voltage')\n",
+"PIV=2*V_pout+0.7;\n",
+"disp(PIV,'PIV in volts')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.6: Bridge_Rectifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex-2.6\n",
+"V_rms=12; //rms secondary voltage\n",
+"V_p_sec=sqrt(2)*V_rms; //peak secondary voltage\n",
+"V_th=0.7; //knee voltage of diode\n",
+"V_p_out=V_p_sec-2*V_th; //in one cycle, 2 diodes conduct\n",
+"PIV=V_p_out+V_th; //applying KVL\n",
+"disp('Peak output voltage in volts= ');\n",
+"disp(V_p_out);\n",
+"disp('PIV across each diode in volts= ');\n",
+"disp(PIV)"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.7: Ripple_Bridge_rectifier.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.7\n",
+"R_l=2200; //load resistance in Ohm\n",
+"C=50*10^-6; //capacitance in Farad\n",
+"V_rms=115; //rms of primary\n",
+"V_p_pri=sqrt(2)*V_rms; //peak voltage across primary\n",
+"n=0.1; //turn ratio is 10:1\n",
+"V_p_sec=n*V_p_pri; //primary voltage across secondary\n",
+"V_p_rect=V_p_sec-1.4 //unfiltered peak rectified voltage\n",
+"//we subtract 1.4 because in each cycle 2 diodes conduct & 2 do not\n",
+"f=120; //frequency of full wave rectified voltage\n",
+"V_r_pp=(1/(f*R_l*C))*V_p_rect; //peak to peak ripple voltage\n",
+"V_DC=(1-(1/(2*f*R_l*C)))*V_p_rect;\n",
+"r=V_r_pp/V_DC;\n",
+"disp(r,'Ripple factor')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.8: Voltage_Regulator.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.8\n",
+"V_REF=1.25; //in volts\n",
+"V_R1=V_REF;\n",
+"R1=220; //in ohms\n",
+"I_ADJ=50*10^-6 //in amperes\n",
+"// MAX VALUE OF R2=5000 Ohms\n",
+"//V_out=V_REF*(1+(R2/R1))+I_ADJ*R2\n",
+"R2_min=0;\n",
+"V_out_min=V_REF*(1+(R2_min/R1))+I_ADJ*R2_min;\n",
+"R2_max=5000;\n",
+"V_out_max=V_REF*(1+(R2_max/R1))+I_ADJ*R2_max;\n",
+"disp(V_out_min,'minimum output voltage in volts');\n",
+"disp(V_out_max,'maximum output voltage in volts');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.9: Load_regulation_percentage.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Ex2.9\n",
+"V_NL=5.18 //No load output voltage\n",
+"V_FL=5.15 //Full load output voltage\n",
+"load_reg=((V_NL-V_FL)/V_FL)*100 //In percentage\n",
+"disp('load regulation percent= ')\n",
+"disp(load_reg)"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}