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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 25 : Economic Scheduling of Hydrothermal Plants and Optimal Power Flows"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 25.1, Page No 817"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#initialisation of variables\n",
"q2=25.0\n",
"q3=25.0\n",
"q1=70-(q2+q3)\n",
"Wo=120.0\n",
"W3=50.0\n",
"Wi1=0\n",
"Wi2=0\n",
"W1=Wo+Wi1-q1\n",
"W2=W1+Wi2-q2\n",
"\n",
"#Calculations\n",
"PH1=9.81*(10**-3)*20*(1+(.5*.006*(120+100)))*(20-2)\n",
"PH2=9.81*(10**-3)*20*(1+(.5*.006*(100+75)))*(23)\t\t# Answer in the book is not Correct due to wrong calculation\n",
"PH3=9.81*(10**-3)*20*(1+(.5*.006*(75+50)))*(23)\n",
"PT1=8-PH1\n",
"PT2=12-PH2\n",
"PT3=7-PH3\n",
"L11=20+PT1\t\t\t#dFT/dPT=PT+20\n",
"L12=20+PT2\t\t\t#dF/dp=PT+20\n",
"L13=20+PT3\t\t\t#dF/dp=PT+20\n",
"#dPL/dPH=0\n",
"L31=L11\n",
"L32=L12\n",
"L33=L13\n",
"e=0.006\n",
"ho=0.1962\n",
"Rho=2\n",
"L21=L31*ho*(1+(.5*e*(2*Wo+Wi1-2*q1+Rho)))\n",
"L22=L21-L31*(.5*ho*e*(q1-Rho))-L32*(.5*ho*e*(q2-Rho))#for m=1\n",
"L23=L22-L32*(.5*ho*e*(q2-Rho))-L33*(.5*ho*e*(q3-Rho))#for m=2\n",
"G1=L22-L32*ho*(1+.5*.006*(2*100-2*25+2))\t\t#G1=dF/dq2 Answer doent match due to wrong calculation of PH2 in a book\n",
"G2=L23-L33*ho*(1+.5*.006*(2*W2+0-2*q3+Rho))\t\t#G1=dF/dq3\n",
"a=0.4\n",
"qnew2=q2-a*G1# Answer differs due to wrong calculation of PH2 in the book\n",
"qnew3=q3-a*G2\n",
"q1=120-50-(qnew2+qnew3)\n",
"\n",
"#Results\n",
"print(\"Let q2=%.0f q3=%.0f q1=%.0f\" %(q2,q3,q1))\n",
"print(\"W1=%.0f W2=%.0f\" %(W1,W2))\n",
"print(\"PH1=%.2f PH2=%.3f PH3=%.1f\" %(PH1,PH2,PH3))\n",
"print(\"Thermal generation during Three Intervals \\n PT1=%.2f PT2=%.2f PT3=%.1f\" %(PT1,PT2,PT3))\n",
"print(\"Value of L1 for the three intervals, \\n L11=%.2f L12=%.2f L13=%.1f\" %(L11,L12,L13))\n",
"print(\"Neglecting transmission losses we get\\n L11=L31 L12=L32 L13=L33\")\n",
"print(\"L21=%.3f\" %(L21))\n",
"print(\"For m=1 and 2 we get \\n L22=%.1f \\n L23=%.1f\" %(L22,L23))\n",
"print(\"Gradient Vectors \\n dF/dq2=%.2f\\n dF/dq3=%.1f\" %(G1,G2))\n",
"print(\"q2new=%.3f \\n q3new=%.1f\\n q1=%.0f\" %(qnew2,qnew3,q1))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Let q2=25 q3=25 q1=20\n",
"W1=100 W2=75\n",
"PH1=5.86 PH2=6.882 PH3=6.2\n",
"Thermal generation during Three Intervals \n",
" PT1=2.14 PT2=5.12 PT3=0.8\n",
"Value of L1 for the three intervals, \n",
" L11=22.14 L12=25.12 L13=20.8\n",
"Neglecting transmission losses we get\n",
" L11=L31 L12=L32 L13=L33\n",
"L21=6.975\n",
"For m=1 and 2 we get \n",
" L22=6.4 \n",
" L23=5.8\n",
"Gradient Vectors \n",
" dF/dq2=-0.77\n",
" dF/dq3=0.5\n",
"q2new=25.310 \n",
" q3new=24.8\n",
" q1=20\n"
]
}
],
"prompt_number": 2
}
],
"metadata": {}
}
]
}
|