# One Step Ahead Problem

1 view (last 30 days)
DARLINGTON ETAJE on 14 Apr 2020
Hello Friends, here is the problem I am facing. My first value for RPP is fixed and I can use that to calculate the initial ChangeL, Pipelenth, WBB and Tor. But the equation for RPP comes last since it has so many variables. The challenge is that I want the first values of those variables to help calculate the second value of RPP wnich will then be used to calculate the 2nd value of those variables and then the 2nd value of those variables would be used to calculte te 3rd value of RPP and so on...till the last value of the variables are calculated from the last value of te RPP.
MW=9;
RPM=90;
E_m=0.35;
d_bit=13;
OD=10;
ID=8;
Time=(1:15700)';
t=length(Time);
iTime=1;
iHookSpeed=2;
iRPP=1;
iChangeL=(iHookSpeed-iRPP)*iTime;
iPipeLength=(iROP*iTime);
iWBB=(((OD^2)-(ID^2))*(1963500*iChangeL))/(iPipeLength);
CQS=randi(10,t,1);
SFr=(0.9402*exp((-8).*CQS)).*(((-0.8876)*log(MW))+2.998);
iSFr=SFr(1,1);
iTor=(d_bit*(iSFr*(iWBB)))/3;
HookSpeed=80;
H_S=(HookSpeed)*(((0*(1:1:t))').^0);
PipeLength=zeros(size(Time));
PipeLength(1,1)=iPipeLength;
ChangeL=zeros(size(Time));
ChangeL(1,1)=iChangeL;
WBB=zeros(size(Time));
WBB(1,1)=iWOB;
Tor=zeros(size(Time));
Tor(1,1)=iTor;
RPP=zeros(size(Time));
RPP(1,1)=iRPP;
for k=1:t
ChangeL(k)=(H_S(k)-RPP(k)).*Time(k);
PipeLength(k)=(RPP(k)*Time(k));
WBB(k)=(((OD^2)-(ID^2))*(1963500*ChangeL(k)))/(PipeLength(k));
Tor(k)=(d_bit.*(SFr(k).*(WBB(k))))/3;
RPP(k)=1./((CQS(k)/E_m)-(4.*WBB(k))/(pi*(d_bit^2))).*(((480*RPM).*Tor(k))/(d_bit^2));
end
display(RPP,Time)