Está en la página 1de 19

131

:

" "Newton Raphson Method
.
Wood & Charles
Hardy Cross
.
FORTRAN
C MATLAB
.



.

.
.
132


)(1
.

:
) .(1
)(1
:

-1 :
.
-2 : .

) (1
133

Qin Qout = 0 )...................(1


hf =kiQini = 0 )..................(2
j j 1
N N N
.
) ( ) Linear Method (Wood & Charles Method

.1972

) : = (
)(1
:

h f = kQ ).........................(3
:

k = kQn 1
Q Q
: Q

. h f = kQ kQn
Hardy Cross Method

i Q0 i
134

)
)(1
( .


: Q

)Q0 = Q0i Q ..............(4


: Q Q Q0

kiQ0ni i
Q = L )...................(5
ni kiQ0ni1 i
L

Newton Raphson Method


:
f1 ( x1 , x2 ,....., xm ) = 0
f2 ( x1 , x2 ,....., xm ) = 0
.
.
.
fm ( x1 , x2 ,....., xm ) = 0
)(i = 1,2,3,...., m xi fi
)(6
:

f ( f1 , f2 ,....., fm )T , x = ( x1 , x2 ,....., xm )T , f ( x) = 0
:

(
] x[n ] = x1[n ] , x2[n ] ,....., xm[n )T

:
135

x[n +1] = x[n ] Jxi


[ n ] 1
)( )..........................(6
f x
] [n

: J

f1 f1 f1
.......
x1 x2 xm

f2 f2 f2
x1 x2 xm

J =
. . .

. . .
. . .

fm fm
........
fm
x x2 xm
1
) (6:

] u [n ] = x[n +1] x[n


:

) (
) J x[n ] u [n ] = f ( x[n ] ) .......... ..........(7

: ] u [n
] x[n +1] = u [n ] + x[n
)(8
:
136

1


H Hb
F (H ) = a
N
) Q = 0 .......... ...........(8
n

b =1
kab
1
dF ( Ha Hb n )
)( 1
= 1
) .......... ...............(9
dH
n(kab ) n

: H
)H = kQ n .................(10
: k
kp Q L D hf
4.73L
cfs ft ft Ft
C 1.85 D 4.87
10.7 L
m3 / s m m m
C 1.85 D 4.87

1986 .
.
)( :
137

:
Dimension D(2) , B(2) , S(2) , QIN(2)
QOUT=0.308
HIN=29.7
C=100
EPS=0.0000001
READ(*,*) B(I),D(I)
3 COUNTINUE
SUM1=0
8 DO 4 I=1,2
SUM1=SUM1+R
F=SUM1-QOUT
SUM2=0
Do 5 I=1, 2
A=-((HIN-HOUT)**(-0.64))/(1.85*S(I)**0.5)
SUM2=SUM2+A
5 CONTUNUE
DF=SUM2
SUM3=0
Do 6 I=1,2
QIN(I)=((HIN-HOUT)/S(I))**0.54
6 SUM3=SUM3+QIN(I)
U=ABS(QOUT-SUM3)
HOUT=HOUT-(F/DF)
IF(U.GT.EPS) GO TO 10
GO TO 8
10 DO 9 I=1,2
WRITE (*,*) QIN(I) , S(I)
CONTINUE
WRITE(*,*) HOUT , SUM3 , (QOUT-SUM3)
STOP
END
138

(8)
:

C
.
Clear
NCT=0;serror=1;Max=50;Er=0.001;n=1.85;n1=1/n;NR=1;
Na1=input('inter filename for pipes ' , 'S');
Pipe=load(na1);

P=pipe(:,1); N1=pipe(:,2);
N2=pipe(:,3);D=pipe(:,4);
L=pipe(:,5);CHW=pipe(:,6);

na2=input('inter filename for nodes ' , 'S');


nod=load(na2);
zn=nod(:,1);QN=nod(:,2);
H=nod(:,3);GL=nod(:,4);
NP=length(P);NJ=length(zn);
For I=1:NP;
K(I)=10.7*L(I)/CHW(I)^1.85*(D(I)/1000)^4.87);
End
H1=H;
For J=1:NJ
NNP=0;
For I=1:NP
If N1(I)=J
NNP=NNP+1;
JB(J,NNP)=I;
Else if N2(I)==J
End; end
NN(J)=nnp;
end;
y1=zeros(1,NJ);
while Nct<Max&serrore>Er;
serrore=0;JE=0;
for J=NR+1:NJ
JE=JE+1;
F(JE)=0;
NNP=NN(J);
for kk=1:NNp
t=JB(J,kk); I2=N2(I)
I1=N1(I); I2=N2(I);
139

AR=abs(H(I1)-H(I2));
FAC=sign(t);
F(JE)=F(JE)+FAC*(AR/K(I))^n1;
if I2>NR
I1=I1-NR;
dF(JE,I1)=dF(JE,I1)+FAC*AR^(n1-1)/(n*K(I)^n1);
end
if I2>NR;
I2=I2-NR;
dF(JE,I2)=dF(JE,I2)-FAC*AR^(n1-1)/(n*K(I)^n1);
end; end
F(JE)F(JE)-QN(J);
end
X=dF/F;
JE=0;
for J=NR+1:NJ
JE=JE+1;
DIF=X(JE);
serrore=serrore+abs(DIF);
H(J)=H(J)-DIF; end
for I=1:NP
I1=N1(I);I2=N2(I);
if H(I1)<H(I2)
N1(I)=I2; N2(I)=I1;
SS=I1; NNP=NN(SS);
for kk=1 :NNP
if abs(JB(SS,kk))==I
JB(SS,kk)=-JB(SS,kk);
end; end
SS=I2; NNP=NNS(SS);
for kk=1 : NNP
if abs(JB(SS,kk))==I
JB(SS,kk)=-JB(SS,kk);
end; end
NCT=NCT+1;
end
for I=1:NP
I1=N1(I); I2=N2(I);
DH(I); I2=N2(I);
Q(I)=(DH(I)/K(I))^0.54;
V(I)=Q(I)/(pi/4*(D(I)/1000))^2;
end

HED=H-GL;
140

PRE=9.81*Hde;
HED=H-GL;
PRE=9.81*Hde;

Ma1=[P';N1';N2';Q;DH];
Ma2=[zn';H';GL';HED';pre'];
fid=fopen('out.m',wt+');
fprintf(fid,' RESULTE FOR PIPES \n');
fprintf(fid,'______________________________ \n');
fprintf(fid,'%10s%13%10s%12s%15s\n',Pipe','from
node', 'to node' , 'Qm^3/S','head loss', m');
fprintf(fid,'________________________________ \n');
fprintf(fid,'%10d%10d%10d%15.3f\n',Mal);
fprintf(fid,'________________________________ \n');
fprintf(fid,' \n');fprintf(fid,' \n');
fprintf(fid,' RESULTE FOR nodes \n');
fprintf(fid,'________________________________ \n');

fprintf(fid,'%8s%14s%20s%16s%18s'\n',node','Head,m','Gro
und Level','Net Head',m',pressure Kpa');
fprintf(fid,'_______________________________ \n');
fprintf(fid,'%6d%15.3f%18.3f%18.3f%18.3f
\n',Ma2);
fprintf(fid,'________________________________ \n');
fprintf(fid,'serrore=%5.4f NCT=%5d'serrore,NCT);
fclose(fid);
open('out.m');
141

:

:



.
:

Q1 + Q3 = 1
Q1 + Q2 = 0.5
Q2 + Q3 = 0.5
+ k2Q2 + k3Q3 =0
1.85 1.85 1.85
k1Q1 :

+ 3Q2 5Q3 )*(= 0...........


1.85 1.85 1.85
4Q1 :
,
:
142

1 0 1 1

1 1 0 0.5
0 )**(. .......... .......... ....
1 1 0.5

4 3 5 0

1 0 0 0.54166

0 1 0 0.04166
0 0 1 0.45330

0 0 0 0
Q1 0.54166

Q = Q2 = 0.04166
Q 0.45330
3
.

k = kQn 1

k1 k1Q1 4 (0 .54166 ) 2 .3754


0 .85

k = k2 = k2 Q2 = 3(0 .04166 ) = 0 .2014
0 .85

k k Q 0.85 2 (0 .45330 ) 2 .576


3 3 3
)**( k k
:

1 0 0 0.51948

0 1 0 0.01948
0 0 1 0.48050

0 0 0 0
143

Q k
.
)*( Q
.

) (2

Q1 + Q3 = 1
Q1 + Q2 = 0.5
Q2 + Q3 = 0.5
:

Q1 = 0.7 , Q2 = 0.2 , Q3 = 0.3


1.681415
= Q = 0.164812
10.20202
:
Q1 = 0.7 0.16481 = 0.53519

Q03 = 0.3 + 0.16481 = 0.46482


:


Q0 ki Q0ni ki ni Q0ni 1

1 0.7 2.067718 5.464684


2 0.2 0.15267 1.413058
3 0.3 0.539060 3.324258
Sum 1.881415 10.20202
144

1.681415
= Q
10.20202
Q = 0.7 0.16481 = 0.53519
Q3 = 0.3 + 0.164881 = 0.464812
:

Q0 ki Q0ni ki ni Q0ni 1

1 0.53519 1.2583485 4.349740
2 0.03518 0.0061369 0.3226470
3 0.46481 -1.211805 4.8231100
Sum 0.0526759 9.495501

0.0526758
= Q = 0.0055475
9.495501

Q1 = 0.53519 0.0055475 = 0.52965

Q2 = 0.02965

Q3 = 0.4703
: Q

Q1 Q2 Q3
0.52965 0.02965 0.4703

)4(0.52965 ) + 3(0.02956 ) 5(0.47584 = 0.126 10 3


1.85 1.85 1.85

.
145


:
Q1 + Q3 1 = 0
Q1 + Q2 0.5 = 0
4Q11.85 + 3Q12.85 5Q13.85 = 0
1 0 1

( )
J Q[ 0 ] = 1 1 0
7.4Q 0.85 5.5Q 02 .85 9.25Q 03 .85
1

1 0 1

( )
J Q[ 0 ] = 1 1 0
4.3943 0.37242 4.7656

u [n] Q1 + Q3 1
1[ n ]
u = u2
[ n]
[n]
( )
, f Q =
[ n]
Q1 + Q2 0.5
1.85 1.85
u3 4Q + 3 Q 1.85
5Q
1 2 3

u1 0.00004
[n]
1 0 1
[n]
1 1 0
2u = 0
[n]
4.3943 0.37242 4.7656 u 0.114434
3
1
J 1 = adj ( J )
det ( J )

0.499935 0.039069 0
1
J = 0.499935 0.960929 0.104905
0.50006 0.039069 0.104905

146

u1 0.00004

u 2 = J 1 0
0.114434
u3

0.000019999

u [ n ] = 0.01198410
0.01198412

]Q [1] = Q[ 0] + u [ 0

0.5416

= 00297
0.4703


.
:
: : 1


0.10991030 1056.4000 17
0.37165700 175.50090 1524
20.5636500 0.4170700 0.1090760 0.305
0.406

: 2


0.0769042 1056.4000 20.56365
0.2149238 157.50090 1524
19.626990 0.2918279 0.1617210 0.305
0.406
147

: 3


0.08116580 1056.4000 19.626990
0.22683360 157.50090 1524
19.6039800 0.3079993 0.655E-006 0.305
0.406

Q1 = 0.0812 , Q2 = 0.2268 , H out = 19.603


:

:
FFP.m
Pipe on From N To N D L C

1 1 2 500 100 100
2 2 3 500 90 100
3 1 3 500 150 100

FFN.m
node Q )H (m
GL

1 1.0 1.2880 0
2 -0.5 0.0085 0
3 -0.5 1.1790 0


Pipe From node To node )Q(m^3/s )Head Losses,(m
1 1 2 0.553 2.065
2 2 3 0.053 0.024
3 1 3 0.477 2.089
148


Node )Head (m Ground level )Net Head (m

1 1.288 0 1.288
2 -0.777 0 -0.777
3 -0.801 0 -0.801
serrore=0.0000 13

:
-1 3

.
-2
.
-3
5
0.8106 10
3
0.126 10
.
149


- 1 . .
1997 .
- 2 . . : .
2001 .
- 3 . 1993 .
- 4 . 1988 .
- 5 . 2000 .
J.Douglas Faires Richard Burden - 6 : .
. .
- 7 . 1995 .
8- Mark J.Hammer (Lincoln , Nebraska ) , Warren Viessman ( University of
Florida ) , Water Supply and pollution fifth Edition , Copyright 1993 by
Harper Collins college publishers .