clear,clc,clfformat longQ=3.3;%gamma=8.43 kN/m3 = 859.62076503 Kg/m3 (*1000/9.81)
rouh=859.62076503;g=9.81;Gamma=(rouh.*g);Zs=0;Ze=0;L=1285000;Ks=(0.000045);Er=(1.*10.^-8);viscosity=(3.83.*10.^-3);% material grade X70
strength= 482000000;%API 5L
Do=[1.016 1.06682 1.1176 1.1684 1.2192]V=((4.*Q)./(pi.*Do.^2))Re=(V.*Do./viscosity)Fo=0.01;for I=0:1:10^6; Fn=(1./(-4.*log10((Ks./(3.71.*Do))+((1.26)./(Re.*sqrt(Fo)))))).^2; E=abs((Fn-Fo)/Fn); if E<=Er; Fn=Fn(end),display(E),break, end if E>Er; Fo=Fn; endendHloss=((Fn.*L.*Q.^2)./(12.*Do.^5))Hpump=Hloss+Ze-Zs%calculating Hloss every 100000M
HLC=1:128500:1285000;for i=1:1:length(HLC); HlossN=((Fn.*HLC(i).*Q.^2)./(12.*Do.^5)) TEL(i,:)=(Hpump-HlossN+Zs) HGL(i,:)=(TEL(i,:)-((V.^2)./(2.*g))) Pe=Gamma.*(HGL-Ze); T=((Pe(i).*Do)./(2.*strength))endfor ii=1:1:length(Do) subplot(3,3,ii), plot(HLC,TEL(:,ii),HLC,HGL(:,ii)) xlabel('HLC') ylabel('HGL & TEL')end
MATLAB: Shouldn’t there be two parallel lines on the plot
plot
Best Answer