Hello,

I am a mechanical engineering student and I want to build a program like that:


Code:
ZStandard:ClrHome:ClrDraw:AxesOff:ExprOff:CoordOff:FnOff


Output(1,1,"Programado por:")
Output(2,1,"Carlos P. Fontes")
Output(3,2,"Eng-a Mecanica")
Output(4,6,"ISEC")
Output(5,6,"Data:")
Output(6,4,"07/02/2017")
Output(7,3,"Mec. Fluidos")
Output(8,4,"V.Beta-1.0")
Pause

Lbl 0
Menu("M.Fluidos ISEC","Sair",99,"Inputos",1,"Reynolds",2,"P.Hidrostatica",15,"Caudal",16

Lbl 1:ClrHome:ClrDraw
Input "Comprimento AB",A
Input "Comprimento BC",B
Input "Comprimento CD",C
Input "diametro AB",D
Input "diametro BC",E
Input "diametro CD",F
Input "Caudal de ref em m/s",G
Input "% de caudal [0a1]",H
Input "Rugosidade epsilon",I
Input "Somatorio dos KS AB",J
Input "Somatorio dos KS BC",Q
Input "Somatorio dos KS CD",R
Input "Densidade do fluido",K
Input "Viscosidade absoluta",L
Disp "Comprimento AB"
Disp "Velocidade=",((G*H)/3600)/((D/2)^2)*pi->M
Disp "Reynolds=",(M*D*K)/L->N
Disp "epsilon/d=",(I/D)->O
Disp "lambda=",0.0055*[1+((20000*O)+(10^6)/N)^(1/3)]->P
Disp "KT=",(((P*A)/D)+J)->S
Disp "K'=",((8*S)/((pi)^2)*(D^4)*9,81)->T
Disp "VALORES COMP AB"
Disp "Velocidade=",(20/3600)/((E/2)^2)*pi->U
Disp "Reynolds=",(K*U*E)/L->V
Disp "epsilon/d=",0.15/E->X
Disp "lambda=",0.0055*[1+((20000*X)+(10^6)/V)^(1/3)]->Y
Pause
Disp "K'="
Disp "KT="
Disp "VALORES COMP AB"
Disp "Velocidade="
Disp "Reynolds="
Disp "epsilon/d="
Disp "lambda="
Disp "K'="
Disp "KT="

Pause :Goto 0


Lbl 99:ClrHome:ClrDraw:AxesOn:ExprOn:CoordOn:FnOn :ZStandard:Output(1,1,"")


This program is incomplete, it s just an example of what I want to do...

I want to ask for the inputs of:
In each lenght AB, BC and CD
ask for
Lenght
Diameter
Reference Rate m3 per hour
Density
Absolute viscosity
Roughness
Sum of K(Charge losses)
H0
Percentage of rate
And for each lenght calculate, and shows all values onto the calcs:
Velocity=(Reference rate/3600)/Pipe area
Reynolds=(Density*velocity*Diameter)/Absolute viscosity
Relative roughness=Roughness/Diameter
Lambda=0.0055*((20000+Relative roufhness)+10^6/Reynolds))^1/3))
KT=((Lambda*Lenght)/Diameter)+Sum of K
K'=(8*KT)/(Pi^2)*Diameter^4)*9,81

And then show one equation:

Hi=H0+((K'AB+K'BC)*Q^2)+K'CD*(Percentage*Q)^2

And thats it, and if possible show the values in a table like this


And I think its all

Sorry for my English, I am from Portugal...

Best Regards
That code looks well on its way to accomplishing what you want to do. Did you write it?

As for putting formulas and results in a table like your screenshot, judging by the length of some cells (λ is especially problematic), it might be better to do it one transposed row at a time on the graph screen, each separated by a Pause and ClrDraw. I'll crank one out for you if you give me an hour.
THX Weregoose
A few small inconsistencies arose in your variable definitions both in and out of your code, and again in what your image is describing – which, I am wondering if that was written (or transcribed) by you, a professor, textbook, etc. I'm trying to piece a lot of this together with independent research, and pointing at the true authoritative piece tells me which of these contenders the end code should reflect.

Attempting to boil this down as much possible, could you verify whether or not the following set of variables/formulas is workable (and correct)? (Here, the subscript "_i" is an index representing each of the three lengths simultaneously. This should take care of the running out of variables that you were about to hit.) And I've had no luck verifying the final Hi= formula. What is it called?

Inputs:

Code:
Lengths          L_i
Diameters        D_i
Ref.Flow         R
% Flow Rates     F_i
Pipe Roughness   E
Sums of K-vals   S_i
Fluid Density    P
Abs.Viscosity    M

Outputs:

Code:
Velocities       V_i = ((R * F_i) / 3600)) / (π * (D_i / 2)^2)
Reynolds         N_i = (P * D_i * V_i) / M
Rltv.Roughness   O_i = E / D_i
Lambda           Y_i = 0.0055 * (1 + ((20000 * O_i) + (10^6 / N_i))^(1/3) )
KT               T_i = ((Y_i * L_i) / D_i) + S_i
K'               G_i = (8 * T_i) / (π^2 * D_i^4 * 9.81)


Edit: See if this is to your liking: WGHYDRLC.8xp

It assumes these inputs were given beforehand:

Lengths: {4,9,3→L
Diameters: {.05,.04,.04→D
Ref.Flow: 20→R
% Flow Rates: {1,1,.5→F
Pipe Roughness: .00015→E
Sums of K-vals: {5.4,5.6,3→S
Fluid Density: 1000→P
Abs.Viscosity: .001→M

...and then it loosely reconstructs the table from your image, including the computational bits.

Next, let's knock out that final equation. Example inputs and outputs, please?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement