summaryrefslogtreecommitdiff
path: root/Generation_Of_Electrical_Energy_by_B._R._Gupta/Chapter10.ipynb
blob: cdaa827acc5bd25a58208031708ce1f28972ba93 (plain)
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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
{
 "metadata": {
  "name": "",
  "signature": "sha256:b75473f9f4345efd6ca0ec6782f30e07c9e95389ed3851945260a1b3129ea6b2"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ch-10, Economic Operations of Steam Plants"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.2 Page 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mp=250     #from example 10.1\n",
      "def unit1(p1):\n",
      "    ic=0.2*p1+30\n",
      "    return ic\n",
      "def unit2(p2):\n",
      "    ic=0.15*p2+40\n",
      "    return ic\n",
      "mil=20\n",
      "ttt=225\n",
      "def un(ic):\n",
      "    p1=(ic-30)/0.2\n",
      "    p2=(ic-40)/0.15\n",
      "    return [p1, p2]\n",
      "from numpy import arange\n",
      "for x in arange(40,61,5):\n",
      "    [e,r]=un(x)\n",
      "    if ttt==e+r:\n",
      "        print \"for the same incremental costs unit1 should supply %dMW and unit 2 shold supply %dMW,for equal sharing each unit should supply %3.1fMW\"%(e,r,ttt/2)\n",
      "        break\n",
      "    \n",
      "\n",
      "opo=ttt/2\n",
      "from sympy.mpmath import quad\n",
      "u1=quad(unit1,[opo,e])\n",
      "u2=quad(unit2,[r,opo])\n",
      "uuu=(u1+u2)*8760\n",
      "print \"\\nyearly extra cost is (%3.2f-%3.2f)8760 =%dper year\"%(u1,u2,uuu)\n",
      "print \"\\nthis if the load is equally shared by the two units an extra cost of Rs.%d will be incurred.in other words economic loading would result in saving of Rs.%dper year\"%(uuu,uuu)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for the same incremental costs unit1 should supply 125MW and unit 2 shold supply 100MW,for equal sharing each unit should supply 112.0MW\n",
        "\n",
        "yearly extra cost is (698.10-670.80)8760 =11991564per year\n",
        "\n",
        "this if the load is equally shared by the two units an extra cost of Rs.11991564 will be incurred.in other words economic loading would result in saving of Rs.11991564per year\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.3 Page 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def unit1(p1):\n",
      "    ic=0.2*p1+30\n",
      "    return ic\n",
      "def unit2(p2):\n",
      "    ic=0.15*p2+40\n",
      "    return ic\n",
      "tol=400\n",
      "pd=50\n",
      "u1c=5\n",
      "u2c=1/0.15#from example10_1\n",
      "p1pd=u1c/(u1c+u2c)\n",
      "p2pd=u2c/(u1c+u2c)\n",
      "pi=p1pd*pd\n",
      "pt=p2pd*pd\n",
      "print \"p1=%1.5fMW\\np2=%1.5fMW\"%(pi,pt)\n",
      "p11=pi+tol/2\n",
      "p22=pt+tol/2\n",
      "up1=unit1(p11)\n",
      "up2=unit2(p22)\n",
      "print \"\\nthe total load on 2 units would be %3.2fMW and %3.2fMW respectevily. it is easy to check that incremental cost will be same for two units at these loading.\\n incremental cost of unit1 is %3.2fRs.MW,\\n incremantal cost of unit 2 is %3.2fRs./MW\"%(p11,p22,up1,up2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "p1=21.42857MW\n",
        "p2=28.57143MW\n",
        "\n",
        "the total load on 2 units would be 221.43MW and 228.57MW respectevily. it is easy to check that incremental cost will be same for two units at these loading.\n",
        " incremental cost of unit1 is 74.29Rs.MW,\n",
        " incremantal cost of unit 2 is 74.29Rs./MW\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example10.5 Page 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "i1=0.8\n",
      "i2=1.0\n",
      "l1=complex(0.04,0.12)\n",
      "l2=complex(0.03,0.1)\n",
      "l3=complex(0.03,0.12)\n",
      "vl=1\n",
      "\n",
      "i3=i1+i2\n",
      "v1=vl+i3*(l1)+i1*(l2)\n",
      "v2=vl+i3*(l1)+i2*(l3)\n",
      "p1=(i1*v1).real\n",
      "p2=(i2*v2).real\n",
      "cos1=(v1).real/abs(v1)\n",
      "cos2=(v2).real/abs(v2)\n",
      "b11=abs(((l1).real+(l2).real)/(v1**2*cos1**2))\n",
      "b22=abs(((l1).real+(l3).real)/(v2**2*cos2**2))\n",
      "b12=abs(((l1).real/(v1*v2*cos1*cos2)))\n",
      "pl=(p1**2)*b11+(p2**2)*b22+2*p1*p2*b12\n",
      "print \"i1+i3=%dpu\\nv1=%1.3f+%1.3fp.u\\nv2=%1.3f+%1.3fp.u\\np1=%1.3fp.u\\np2=%1.3fp.u\\ncos(ph1)=%1.3f\\ncos(ph2)=%1.3f\\nb11=%1.5fp.u\\nb22=%1.5fp.u\\nb12=%1.5fp.u\\npl=%1.6fp.u\"%(i3,v1.real,(v1).imag,v2.real,(v2).imag,p1,p2,cos1,cos2,b11,b22,b12,pl)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i1+i3=1pu\n",
        "v1=1.096+0.296p.u\n",
        "v2=1.102+0.336p.u\n",
        "p1=0.877p.u\n",
        "p2=1.102p.u\n",
        "cos(ph1)=0.965\n",
        "cos(ph2)=0.957\n",
        "b11=0.05827p.u\n",
        "b22=0.05764p.u\n",
        "b12=0.03312p.u\n",
        "pl=0.178800p.u\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example10.7 Page 206"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import atan, cos\n",
      "za=complex(0.03,0.09)\n",
      "zb=complex(0.1,0.3)\n",
      "zc=complex(0.03,0.09)\n",
      "zd=complex(0.04,0.12)\n",
      "ze=complex(0.04,0.12)\n",
      "ia=complex(1.5,-0.4)\n",
      "ib=complex(0.5,-0.2)\n",
      "ic=complex(1,-0.1)\n",
      "id=complex(1,-0.2)\n",
      "ie=complex(1.5,-0.3)\n",
      "il1=.4\n",
      "il2=.6\n",
      "na1=1 ;nb1=0.6; nc1=0; nd1=.4; ne1=.6\n",
      "na2=0 ;nb2=-0.4; nc2=1 ;nd2=.4; ne2=.6\n",
      "vl=1\n",
      "#some thing is messed\n",
      "v1=vl+za*ia\n",
      "v2=vl-zb*ib+zc*ic\n",
      "a1=atan((ia).imag/(ia).real)\n",
      "a2=atan((ic).imag/(ic).real)\n",
      "cosa=cos(a1-a2)\n",
      "cosph1=cos(atan((v1).imag/(v1).real)-a1)\n",
      "cosph2=cos(atan((v2).imag/(v2).real)-a2)\n",
      "b11=(na1**2*(za).real+nb1**2*(zb).real+nc1**2*(zc).real+nd1**2*(zd).real+ne1**2*(ze).real)/(abs(v1)**2*cosph1)\n",
      "b22=(na2**2*(za).real+nb2**2*(zb).real+nc2**2*(zc).real+nd2**2*(zd).real+ne2**2*(ze).real)/((abs(v2)**2)*cosph2)\n",
      "bb12=(abs(v1)*abs(v2)*cosph1*cosph2)\n",
      "ab12=(na2*na1*(za).real+nb2*nb1*(zb).real+nc1*nc2*(zc).real+nd2*nd1*(zd).real+ne2*ne1*0.03)\n",
      "b12=cosa*ab12/bb12\n",
      "print \"bus voltages at 2 buses are \\nv1=%1.3f+i%1.3f,\\nv2=%1.3f+i%1.3f\"%((v1).real,(v1).imag,(v2).real,(v2).imag)\n",
      "print \"\\nloss coffecients are \\nb11=%1.5fp.u\\nb22=%1.5fp.u\\nb12=%1.5fp.u \\n\"%(b11,b22,b12)\n",
      "print \"loss coffecients in actual values is \\nb11=%eM(W)-1\\nb22=%eM(W)-1\\nb12=%eM(W)-1\\n\"%(b11/100,b22/100,b12/100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "bus voltages at 2 buses are \n",
        "v1=1.081+i0.123,\n",
        "v2=0.929+i-0.043\n",
        "\n",
        "loss coffecients are \n",
        "b11=0.07877p.u\n",
        "b22=0.07735p.u\n",
        "b12=-0.00714p.u \n",
        "\n",
        "loss coffecients in actual values is \n",
        "b11=7.877236e-04M(W)-1\n",
        "b22=7.734557e-04M(W)-1\n",
        "b12=-7.136298e-05M(W)-1\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.8 Page 207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "r1=22 ;r2=30 ;q1=0.2 ;q2=0.15\n",
      "b22=0; b12=0 ;p1=100 ;pl=15#transmission losses are 0\n",
      "b11=pl/(p1)**2\n",
      "def power(x): #mathematical computation\n",
      "    p1=(x-r1)/(q1+2*b11*x)\n",
      "    p2=(x-r2)/q2\n",
      "    return [p1, p2]\n",
      "[a,b]=power(60)\n",
      "print \"l1=1/(1-%.3f*p1)\\nl2=[1/(1-0)]=1\\ngiven lamda=60\\nsince ic1*l1=lamda  ic2*l2=lamda\\ntotal load=%dMW\"%(b11*2,a+b-(b11*a**2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "l1=1/(1-0.000*p1)\n",
        "l2=[1/(1-0)]=1\n",
        "given lamda=60\n",
        "since ic1*l1=lamda  ic2*l2=lamda\n",
        "total load=390MW\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.9 Page 208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "r1=22 ;r2=30 ;q1=0.2 ;q2=0.15\n",
      "b22=0; b12=0 ;p1=100 ;pl=15#transmission losses are 0\n",
      "b11=pl/(p1)**2\n",
      "def power(x): #mathematical computation\n",
      "    p1=(x-r1)/(q1+2*b11*x)\n",
      "    p2=(x-r2)/q2\n",
      "    return [p1,p2]\n",
      "[a,b]=power(60)\n",
      "pt=a+b-(b11*a**2)\n",
      "from sympy.mpmath import quad\n",
      "#z=quad('q1*u+r1','u',a,161.80)\n",
      "z=quad(lambda u:q1*u+r1,[a,161.80])\n",
      "#y=quad('q2*v+r2','v',b,162.5)\n",
      "y=quad(lambda v:q2*v+r2,[b,162.5])\n",
      "m=z+y\n",
      "print \"net change in cost =Rs.%dper hour\"%(m)\n",
      "print \"\\nthus scheduling the generation by taking transmission losses into account would mean a saving of Rs.%dper hour in fuel cost\"%(m)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "net change in cost =Rs.-3757per hour\n",
        "\n",
        "thus scheduling the generation by taking transmission losses into account would mean a saving of Rs.-3757per hour in fuel cost\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.10 Page 208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "b11=0.001\n",
      "b12=-0.0005\n",
      "b22=0.0024\n",
      "q1=0.08\n",
      "r1=16\n",
      "q2=0.08\n",
      "r2=12\n",
      "lamda=20\n",
      "\n",
      "p2=0\n",
      "for x in range(1,5):\n",
      "    p1=(1-(r1/lamda)-(2*p2*b12))/((q1/lamda)+2*b11)\n",
      "    p2=(1-(r2/lamda)-(2*p1*b12))/((q2/lamda)+2*b22)\n",
      "\n",
      "pl=b11*p1**2+2*b12*p1*p2+b22*p2**2\n",
      "pr=p1+p2-pl\n",
      "print \"p1=%2.1fMW,p2=%2.1fMW\\npl=%1.1fMW\\npower recevied %2.1fMW\"%(p1,p2,pl,pr)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "p1=189.2MW,p2=135.1MW\n",
        "pl=54.1MW\n",
        "power recevied 270.3MW\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.11 Page 209"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a1=561 ;b1=7.92 ;c1=0.001562\n",
      "a2=310 ;b2=7.85 ;c2=0.00194\n",
      "ce=c1*c2/(c1+c2)\n",
      "print \"ce=%e\"%(ce)\n",
      "be=((b1/c1)+(b2/c2))*ce\n",
      "print \"be=%1.4f\"%(be)\n",
      "ae=a1-((b1**2)/4*c1)+a2-((b2**2)/4*c2)+((be**2)/4*ce)\n",
      "print \"ae=%3.3f \\ncost characteristics of composite unit for demand pt is \\nct=%3.3f+%1.4f*p1+%ep1**2\"%(ae,ae,be,ce)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ce=8.652998e-04\n",
        "be=7.8888\n",
        "ae=870.959 \n",
        "cost characteristics of composite unit for demand pt is \n",
        "ct=870.959+7.8888*p1+8.652998e-04p1**2\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.12 Page 210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a1=7700 ;b1=52.8 ;c1=5.5*10**-3\n",
      "a2=2500; b2=15 ;c2=0.05#given eqution\n",
      "plo=200 ;pup=800\n",
      "ct=1000\n",
      "l=[500,900,1200,500] ;t=[6, 16 ,20 ,24]#from given graph\n",
      "def cost(y):\n",
      "    p1=(2*c2*y-(b1-b2))/(2*(c1+c2))\n",
      "    p2=y-p1\n",
      "    return [p1,p2]\n",
      "ma=max(l)\n",
      "mi=min(l)\n",
      "for x in range(0,3):\n",
      "    [e ,g]=cost(l[x])\n",
      "    if e<plo or g<plo or e>pup or g>pup:\n",
      "        if e<plo or g<plo:\n",
      "            v=min(e,g)\n",
      "            [u for u, j in enumerate((e,g)) if j == v]\n",
      "    if u==0:\n",
      "        e=plo\n",
      "        g=l(x)-e\n",
      "    else:\n",
      "        g=plo\n",
      "        e=l[x]-g\n",
      "    \n",
      "    \n",
      "print \"\\np1=%3.2fMW\\tp2=%3.2fMW\"%(e,g)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "p1=1000.00MW\tp2=200.00MW\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.13 Page 211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a1=2000 ;b1=20 ;c1=0.05; p1=350; p2=550\n",
      "a2=2750 ;b2=26 ;c2=0.03091\n",
      "def cost(a,b,c,p):\n",
      "    co=a+b*p+c*p**2\n",
      "    return co\n",
      "print \"(a)\"\n",
      "toco=cost(a1,b1,c1,p1)+cost(a2,b2,c2,p2)\n",
      "print \"total cost when each system supplies its own load Rs%.3f per hour\"%(toco)\n",
      "l=p1+p2\n",
      "p11=(b2-b1+2*c2*l)/(2*(c1+c2))\n",
      "p22=l-p11\n",
      "totco=cost(a1,b1,c1,p11)+cost(a2,b2,c2,p22)\n",
      "sav=toco-totco\n",
      "tilo=p11-p1\n",
      "print \"(b)\"\n",
      "print \"\\n total cost when load is supplied in economic load dispatch method Rs%d per hour \\n saving %.3f \\n tie line load %.3f MW\"%(totco,sav,tilo)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "total cost when each system supplies its own load Rs41525.275 per hour\n",
        "(b)\n",
        "\n",
        " total cost when load is supplied in economic load dispatch method Rs41447 per hour \n",
        " saving 77.277 \n",
        " tie line load 30.905 MW\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example10.14 Page 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a1=5000 ;b1=450 ;c1=0.5 #for system 1 \n",
      "e1=0.02 ;e2=-0.02#error\n",
      "a1c=a1*(1-e1); b1c=b1*(1-e1) ;c1c=c1*(1-e1)\n",
      "a2c=a1*(1-e2) ;b2c=b1*(1-e2) ;c2c=c1*(1-e2)\n",
      "tl=200\n",
      "def cost(a,b,c,p):\n",
      "    co=a+b*p+c*p**2\n",
      "    return co\n",
      "p11=(b2c-b1c+2*c2c*tl)/(2*(c1c+c2c))\n",
      "p22=tl-p11\n",
      "totco=cost(a1c,b1c,c1c,p11)+cost(a2c,b2c,c2c,p22)\n",
      "print \"\\npower at station 1 is %dMW \\t power at station 2 is %dMW \\n total cost on economic critieria method Rs%d per hour\"%(p11,p22,totco)\n",
      "tocoe=cost(a1c,b1c,c1c,tl/2)+cost(a2c,b2c,c2c,tl/2)\n",
      "eop=tocoe-totco\n",
      "print \"\\nextra operating cost due to erroneous scheduling Rs.%d per hour\"%(eop)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "power at station 1 is 111MW \t power at station 2 is 89MW \n",
        " total cost on economic critieria method Rs109879 per hour\n",
        "\n",
        "extra operating cost due to erroneous scheduling Rs.121 per hour\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.16 Page 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "ia=32 ;ib=32 ;ic=1.68; f=10**5\n",
      "wt=18; rt=24-wt\n",
      "p=30\n",
      "def inpu(a,b,c,f,t,p):\n",
      "    In=(a+b*p+c*p**2)*f*t\n",
      "    return In\n",
      "hi1=inpu(ia,ib,ic,f,wt,p); hi2=inpu(ia,ib,ic,f,rt,p/2)\n",
      "print \"(a)\"\n",
      "print \"for full load condition for %d hours is %ekj \\n for half load condition for%d s %ekj \\n total load %ekj\"%(wt,hi1,rt,hi2,hi1+hi2)\n",
      "print \"(b)\"\n",
      "te=p*wt+(p/2)*rt\n",
      "ul=te/24\n",
      "hin=inpu(ia,ib,ic,f,24,ul)\n",
      "sav=hi1+hi2-hin\n",
      "savp=sav/(te*1000)\n",
      "print \"\\n total energy produced\\t%dMW \\n unifor load\\t%dMW \\n heat input under uniform load condition %ekj \\n saving in heat energy %ekj \\n saving in heat energy per kWh %dkj/kWh\"%(te,ul,hin,sav,savp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "for full load condition for 18 hours is 4.507200e+09kj \n",
        " for half load condition for6 s 5.340000e+08kj \n",
        " total load 5.041200e+09kj\n",
        "(b)\n",
        "\n",
        " total energy produced\t630MW \n",
        " unifor load\t26MW \n",
        " heat input under uniform load condition 4.799232e+09kj \n",
        " saving in heat energy 2.419680e+08kj \n",
        " saving in heat energy per kWh 384kj/kWh\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 10.17 Page 216"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "a1=450 ;b1=6.5 ;c1=0.0013\n",
      "a2=300 ;b2=7.8 ;c2=0.0019\n",
      "a3=80 ;b3=8.1 ;c3=0.005\n",
      "tl=800#total load\n",
      "ma = [600, 400, 200]\n",
      "mi = [100, 50, 50]\n",
      "d=np.mat([[1 ,1, 1] ,[2*c1, -2*c2, 0], [0, -2*c2, 2*c3]])\n",
      "p=np.mat([[tl], [(b2-b1)], [(b2-b3)]]) \n",
      "pp=(d**-1)*p #matrix inversion method\n",
      "print \"\\nloads on generaating station by economic creatirian method isp1=%fMW,p2=%fMW,p3=%fMW\"%(pp[0],pp[1],pp[2])\n",
      "for i in range(0,3):\n",
      "    if pp[i]<mi[i]:\n",
      "        pp[i]=mi[i]\n",
      "    \n",
      "    if pp[i]>mi[i]:\n",
      "        pp[i]=ma[i]\n",
      "    \n",
      "\n",
      "pp[1] = tl-pp[0] - pp[2]\n",
      "print \"\\nloads on generating station under critical conditions p1=%dMW p2=%dMW p3=%dMW\"%(pp[0],pp[1],pp[2])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "loads on generaating station by economic creatirian method isp1=669.734705MW,p2=116.134272MW,p3=14.131023MW\n",
        "\n",
        "loads on generating station under critical conditions p1=600MW p2=150MW p3=50MW\n"
       ]
      }
     ],
     "prompt_number": 25
    }
   ],
   "metadata": {}
  }
 ]
}