How can I solve multiple equations? (Pipeline Design)

조회 수: 3 (최근 30일)
Ahmed Mohamed Mansoor
Ahmed Mohamed Mansoor 2021년 6월 12일
편집: dpb 2021년 6월 15일
I need to Isolate out just calulate 't' from these equations.
The rest of the values are all given. But the equations are all connected to one another. and I just need to only find out what the value 't' is.
Pc = 1.324
specified minimum yield strength, = 448
v = 0.3
E=2.1*10^5
D = 304.8 mm (12 inches)
Pipe ovality, δ = I believe an if condition is enough to just extract out the values 0.75 or 1.0 based on the size of D
Note: Ignore Dmin and Dmax in this
Can anyone please help me with this? Thank you
  댓글 수: 1
dpb
dpb 2021년 6월 13일
Write a function to compute Pc, then use fsolve to find the critical t at which Pc - Pc_target =0

댓글을 달려면 로그인하십시오.

채택된 답변

dpb
dpb 2021년 6월 13일
편집: dpb 2021년 6월 15일
function Pc=pipelineExternalPC(d,t,sy)
% Usage:
% Pc=pipelineExternalPC(d,t,sy)
%
% returns Pc, pipeline external collapse pressure(MPa) for pipe
% diameter and wall thickness; d, t in inches for specified minimum
% yield strength, sy (MPa)
E=207E3; % Young's modulus, steel (MPa)
nu=0.30; % Poisson's ratio
ovality=(0.75+0.25*(d>=20))/100; % ovality correction factor
D=25.4*d; t=25.4*t; % convert dimensions to mm
tOD=t/D; % thickness/diameter ratio
d=ovality/tOD; % diameter to thickness ratio
g=@(r,d)(sqrt(1-d*d)-d)*sqrt(1+r*r)/sqrt(1+r*r*sqrt(1+d*d)-d*d);
Pe=2*E*tOD^3/(1.4*(1-nu*nu)*(1-tOD)^2);
Py=2*sy*tOD;
r=Py/Pe;
Pc=g(r,d)*Py*Pe/hypot(Py,Pe);
end
Now write an anonymous function to solve for the specific condition given the constraints...
>> fn=@(t)pipelineExternalPC(12,t,448)-1.324
fn =
function_handle with value:
@(t)pipelineExternalPC(12,t,448)-1.324
>> fsolve(fn,0.25)
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
ans =
0.2576
>> pipelineExternalPC(12,ans,448)
ans =
1.3240
>>
NB: The result is in inches, the input dimensions units presumed in writing the function.
  댓글 수: 2
Ahmed Mohamed Mansoor
Ahmed Mohamed Mansoor 2021년 6월 13일
편집: Ahmed Mohamed Mansoor 2021년 6월 13일
Thank you so much!!!! this worked. I changed it a little bit to work with my code and there were some tiny mistakes.
This is what it looks like now.
function Pc=pipelineExternalPC(Di,E,nu,Do,t,YS)
% Usage:
% Pc=pipelineExternalPC(d,t,sy)
%
% returns Pc, pipeline external collapse pressure(MPa) for pipe
% diameter and wall thickness; d, t in inches for specified minimum
% yield strength, sy (MPa)
ovality=(1.-0.25*(Di<20)); % ovality correction factor
tOD=t/Do; % thickness/diameter ratio
d=ovality/tOD; % diameter to thickness ratio
g=@(r,d)((sqrt(1+d*d)-d)*sqrt(1+r*r))/(sqrt(1+r*r*(sqrt(1+d*d)-d)^2));
Pe=(2*E*tOD^3)/(1.4*(1-nu*nu)*(1-tOD)^2);
Py=2*YS*tOD;
r=Py/Pe;
Pc=g(r,d)*Py*Pe/hypot(Py,Pe);
end
and now my call function looks like this
fn=@(t)pipelineExternalPC(Di,E,nu,Do,t,YS)-P_c;
t_pc = fsolve(fn,0.1);
Thank you for the help and support.
dpb
dpb 2021년 6월 15일
편집: dpb 2021년 6월 15일
ovality=(1.-0.25*(Di<20)); % ovality correction factor
You did catch the inverted logic test for size to use 1% for larger diameter pipes; good catch.
I decided the better form would be to write as
ovality=(0.75+0.25*(Di>=20)); % ovality correction factor
to add 1/4% for the larger diameter instead of taking it off the smaller. Seems to read better; make more sense to the humans; the computer doesn't care! :)
However, the above introduced a mistake by not converting the percentage to absolute numbers.
It's defined explicitly as the ratio
[Dmax-Dmin]/Dnominal --> [Dmax-Dmin]/{[Dmin+Dmax]/2} ==> 2*[Dmax-Dmin]/[Dmin+Dmax]
which is absolute ratio; expressed in % it's 100X that number.
NB: that the formula in the reference is missing the factor of two for the nominal divisor if computed from actual pipe measurements.
But, you've introduced a factor of 100 too large a value by removing the divisor from the numbers entered as percentages in the function.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Control System Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by