1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 7: Switiching Power Supplies"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.1,Page 326"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"duty cycle is 0.25\n",
"average voltage is 3.0 V\n"
]
}
],
"source": [
"#finding duty cycle and average voltage\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"T=20.0;#time\n",
"Vp=12.0;#voltage\n",
"t=5.0;\n",
"\n",
"#calculation\n",
"D=t/T;\n",
"Vd=(D*Vp);\n",
"\n",
"#result\n",
"print \"duty cycle is\",round(D,3)\n",
"print \"average voltage is\",round(Vd,3), \"V\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.2,Page 238"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"duty cycle is 42.0 %\n",
"time is 10.0 microsec\n",
"on time is 4.167 microsec\n",
"ripple current is 133.636 mA\n",
"load current is 500.0 mA\n",
"peak inductor current is 566.818 mA\n"
]
}
],
"source": [
"#finding on time ripple,load,peak inductor current\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"Vd=12.0;#voltage\n",
"Vl=5.0;#load voltage\n",
"Rl=10.0;#load resistance\n",
"f=100.0;#frequency\n",
"L=220.0;#inductor\n",
"\n",
"#calculation\n",
"D=Vl/Vd;\n",
"T=1/f;\n",
"t=D*T;\n",
"Vr=Vd-Vl;\n",
"I=Vr*round(t*10000)/10/L;\n",
"Il=Vl/Rl;\n",
"Ip=Il+I/2;\n",
"\n",
"#result\n",
"print \"duty cycle is\",round(D*100), \"%\"\n",
"print \"time is\",round(T*1000,3), \"microsec\"\n",
"print \"on time is\",round(t*10000,2)/10, \"microsec\"\n",
"print \"ripple current is\",round(I*1000,3),\"mA\"\n",
"print \"load current is\",round(Il*1000,3), \"mA\"\n",
"print \"peak inductor current is\",round(Ip*1000,3), \"mA\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.3,Page 335"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"rms current is 325.01 mA\n",
"by trapezium method\n",
"rms current is 324.04 mA\n",
"by rectangle method\n",
"\n",
" rectangle method gives good result than trapezium method\n"
]
}
],
"source": [
"#finding rms current\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"Id=500.0;#load current\n",
"i=134;#mA\n",
"D=.42;#duty cycle\n",
"\n",
"#calculation\n",
"Ip=Id+i/2;\n",
"Im=Id-i/2;\n",
"I1=((D/3)*(Ip**2+Im*Ip+Im**2))**.5;\n",
"I2=D**.5*Id;\n",
"\n",
"#result\n",
"print \"rms current is\",round(I1,2), \"mA\"\n",
"print('by trapezium method')\n",
"print \"rms current is\",round(I2,2), \"mA\"\n",
"print('by rectangle method')\n",
"print '\\n rectangle method gives good result than trapezium method'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.4,Page 336"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"voltage is 0.3 V\n",
"dissipated power is 63.0 mW\n"
]
}
],
"source": [
"#finding voltage and power\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"Vp=.3;#voltage\n",
"I=500.0;#current\n",
"D=.42;#duty cycle\n",
"T=150.0;#temperature\n",
"R=.6;#ohm\n",
"\n",
"#calculation\n",
"Vq=I*R;\n",
"Pq=D*Vq*I;\n",
"\n",
"#result\n",
"print \"voltage is\",round(Vq/1000,2), \"V\"\n",
"print \"dissipated power is\",round(Pq/1000,2), \"mW\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.5,Page 341"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"duty cycle is 42.0 %\n",
"time period is 6.667 microsec\n",
"on time is 2.778 microsec\n",
"load current is 500.0 mA\n",
"ripple current is 125.0 mA\n",
"inductor voltage is 7.0 V\n",
"inductor is 155.556 microH\n",
"inductor current is 562.5 mA\n",
"minimum capacitor current is 250.0 mA\n",
"minimum capacitor voltage is 18.0 V\n",
"Rf/Ri is 3.07\n",
"power of LM2595 is 0.33 W\n",
"thermal resistance is 210.998 degreeC/W\n"
]
}
],
"source": [
"#finding all componenets\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"R=10.0;#resistance\n",
"V1=5.0;#V\n",
"V2=12.0;#V\n",
"Ta=80.0;#degreeC\n",
"Tb=150.0;\n",
"f=150.0;#frequency\n",
"\n",
"#calculation\n",
"D=V1/V2;\n",
"T=1/f;\n",
"t=D*T;\n",
"Id=V1/R;\n",
"i=.25*Id;\n",
"Vl=V2-V1;\n",
"L=Vl*t/i;\n",
"Ip=Id+i/2;\n",
"Ic=Id/2;\n",
"Vc=1.5*V2;\n",
"K=V1/1.23-1;\n",
"P=.01*V2+D*Id*1;\n",
"Q=(Tb-Ta)/P-2.2;\n",
"\n",
"#result\n",
"print \"duty cycle is\",round(D*100), \"%\"\n",
"print \"time period is\",round(T*1000,3), \"microsec\"\n",
"print \"on time is\",round(t*1000,3), \"microsec\"\n",
"print \"load current is\",round(Id*1000,3), \"mA\"\n",
"print \"ripple current is\",round(i*1000,3), \"mA\"\n",
"print \"inductor voltage is\",round(Vl,2), \"V\"\n",
"print \"inductor is\",round(L*1000,3), \"microH\"\n",
"print \"inductor current is\",round(Ip*1000,2), \"mA\"\n",
"print \"minimum capacitor current is\",round(Ic*1000,2), \"mA\"\n",
"print \"minimum capacitor voltage is\",round(Vc,3), \"V\"\n",
"print \"Rf/Ri is\",round(K,2)\n",
"print \"power of LM2595 is\",round(P,2), \"W\"\n",
"print \"thermal resistance is\",round(Q,3), \"degreeC/W\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.6,Page 349"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"load power is 15.4 W\n",
"supply power is 17.11 W\n",
"dc current is 1.4 A\n",
"inductor current is 1.57 A\n",
"duty cycle is 0.45\n",
"inductor is 154.29 microH\n",
"transistor power is 352.8 mW\n",
"diode power is 385.0 mW\n",
"capacitor is 157.5 microF\n"
]
}
],
"source": [
"#finding different power,inductor current,inductor value\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"V1=12.0#V\n",
"V2=22.0;#V\n",
"I=.7;#A\n",
"f=100.0;#kHz\n",
"R=.4;#ohm\n",
"Vd=.5;\n",
"\n",
"#calculation\n",
"Pl=V2*I;\n",
"Ps=Pl/.9;\n",
"Id=round(Ps/V1*10)/10;\n",
"i=.25*Id;\n",
"Ip=Id+i/2;\n",
"D=round((1-V1/V2)*100)/100;\n",
"t=D/f;\n",
"L=V1*t/i;\n",
"Vp=Id*R;\n",
"Pq=D*Vp*Id;\n",
"Pd=(1-D)*.5*Id;\n",
"C=Id*t/2/20;\n",
"\n",
"#result\n",
"print \"load power is\",round(Pl,2), \"W\"\n",
"print \"supply power is\",round(Ps,2), \"W\"\n",
"print \"dc current is\",round(Id,2), \"A\"\n",
"print \"inductor current is\",round(Ip,2), \"A\"\n",
"print \"duty cycle is\",round(D,2)\n",
"print \"inductor is\",round(L*1000,2), \"microH\"\n",
"print \"transistor power is\",round(Pq*1000,2), \"mW\"\n",
"print \"diode power is\",round(Pd*100,2)*10, \"mW\"\n",
"print \"capacitor is\",round(C*1e6,2), \"microF\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.7,Page 355"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Rf/Ri is 16.886\n",
"pick Rf=22; Ri=1.3;\n",
"rms current is 1.4 A\n",
"switch power is 132.3 mW\n",
"IC power is 151.2 mW\n",
"total power is 283.5 mW\n",
"IC temperature is 98.43 degreeC\n"
]
}
],
"source": [
"#finding feedback resistor,power,current and temperature\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"V1=12.0;#V\n",
"V2=22.0;#V\n",
"I=.7;#A\n",
"Ta=80.0;#degreeC\n",
"Ps=17.1#supply power\n",
"\n",
"#calculation\n",
"K=V2/1.23-1;\n",
"Id=round(Ps/V1*10)/10;\n",
"D=round((1-(V1/V2))*100)/100;\n",
"Ir=D**.5*Id;\n",
"Ps=Ir**2*.15;\n",
"Pi=D*Id*V1/50;\n",
"P=Ps+Pi;\n",
"T=Ta+P*65;\n",
"\n",
"#result\n",
"print \"Rf/Ri is\",round(K,3)\n",
"print('pick Rf=22; Ri=1.3;')\n",
"print \"rms current is\",round(Id,2), \"A\"\n",
"print \"switch power is\",round(Ps*1000,2), \"mW\"\n",
"print \"IC power is\",round(Pi*1000,2), \"mW\"\n",
"print \"total power is\",round(P*1000,2), \"mW\"\n",
"print \"IC temperature is\",round(T,2), \"degreeC\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example 7.8,Page 359"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"maximum voltage is 18.25 V\n",
"diode voltage is 20.0 V\n",
"duty cycle is 0.34\n",
"power delivered is 5.0 W\n",
"average current is 466.67 mA\n",
"mid primary current is 1.37 A\n",
"rms current is 800.33 mA\n",
"ramp current is 480.0 mA\n",
"maximum transistor current is 1.61 A\n",
"minimum transistor current is 1.13 A\n",
"diode peak current is 2.02 A\n",
"secondary rms current is 1.23 A\n",
"capacitor is 170.0 microF\n"
]
}
],
"source": [
"#designing circuit and finding circuit parameter\n",
"\n",
"#initialisation of variable\n",
"from math import pi,tan,sqrt,sin,cos,acos,atan\n",
"V1=12.0;#V\n",
"V2=5.0;#V\n",
"Il=1.0;#load current\n",
"T=10.0;#microsec\n",
"K=1.25;#Npri/Nsec\n",
"L=85.0;#microH\n",
"\n",
"#calculation\n",
"Vq=V1+V2*K;\n",
"Vd=V1*K+V2;\n",
"D=round((K*V2)*100/(V1+K*V2))/100;\n",
"Po=V2*Il;\n",
"Pi=round(Po/.09)/10;\n",
"Id=Pi/V1;\n",
"Im=Id/D;\n",
"Ir=(Im*D**.5);\n",
"i=V1*D*T/L;\n",
"IM=Im+.24;\n",
"Imin=Im-.24;\n",
"Ip=K*IM;\n",
"Imid=Il/(1-D);\n",
"Irms=Imid*(1-D)**.5;\n",
"C=D*Il*T/20;\n",
"\n",
"#result\n",
"print \"maximum voltage is\",round(Vq,2), \"V\"\n",
"print \"diode voltage is\",round(Vd,2), \"V\"\n",
"print \"duty cycle is\",round(D,2)\n",
"print \"power delivered is\",round(Po,2), \"W\"\n",
"print \"average current is\",round(Id*1000,2), \"mA\"\n",
"print \"mid primary current is\",round(Im,2), \"A\"\n",
"print \"rms current is\",round(Ir*1000,2),\"mA\"\n",
"print \"ramp current is\",round(i*1000,2), \"mA\"\n",
"print \"maximum transistor current is\",round(IM,2),\"A\"\n",
"print \"minimum transistor current is\",round(Imin,2),\"A\"\n",
"print \"diode peak current is\",round(Ip,2), \"A\"\n",
"print \"secondary rms current is\",round(Irms,2),\"A\"\n",
"print \"capacitor is\",round(C*1000,2), \"microF\"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|