Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline Valentino  
#1 Posted : 19 November 2020 03:56:19(UTC)
Valentino

Rank: Newbie

Groups: Registered
Joined: 13/11/2020(UTC)
Posts: 3
Man
Mexico

Hello guys Victory


I made a worksheet to calculate the theoretical stages of a binary distillation column using the McCabe method, however, when making the McCabe graph, the program takes a long time to do it, can anyone help me? sometimes it takes almost 27 minutes to solve it Thank you Help smilie



I'm new using "SMath Studio" so I don't know if the procedure I'm using is the right one. Well, what I do is use the same method that I use in "Mathcad Prime 6" and mathcad makes that graph in less than a second and SMath in 5 - 27 minutes Dance Search


files:

SMath Studio
Mc Cabe Valentino 2020.sm (186kb) downloaded 7 time(s).

Mathcad Prime 6
McCabe Mathcad Prime 6.pdf (534kb) downloaded 6 time(s).


Edited by user 19 November 2020 04:11:41(UTC)  | Reason: Not specified

Offline Razonar  
#2 Posted : 19 November 2020 07:22:39(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 545
Uruguay

Was thanked: 310 time(s) in 195 post(s)
Hi. A couple of issues. First, SMath needs sometimes an eval() function for speed up calculations, because SMath carry the entire definition for an expression, and not just the numerical value, like in Mathcad. Second, solve works for simple cases, for more complex cases you have the plugin "Nonlinear Solvers". In the attached I substitute solve() by Broyden(), but you can choose another from there, or try to use al_nleqsolve, which is something not less than magic in some cases.

Broyden it's a numerical solver, and like any other the guess value it's part of the solution. I take the previous value x(i-1) as guess for x(i), but don't know if it's the better choice. Even the sateges in the modified SMath file are 13 and in Mathcad 12, the pinch point seems the same, more or less, based in the Mathcad plot.

Two more notes: usually, solvers needs unnasigned variables. You can ensure that with Clear. Also in SMath you can't call composite functions like in mathcad with the function name. That's means in your case that the actual definition for McCabe.ER(f,g) it's "wrong", and the correct one it's "McCabe.ER(f(1),g(1))" and then you can call it with "ans = McCabe.ER(f(x#),g(x#))".

Mc Cabe Valentino 2020.sm (189kb) downloaded 12 time(s).
Mc Cabe Valentino 2020.pdf (707kb) downloaded 11 time(s).

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 19/11/2020(UTC)
Offline Valentino  
#3 Posted : 19 November 2020 13:54:55(UTC)
Valentino

Rank: Newbie

Groups: Registered
Joined: 13/11/2020(UTC)
Posts: 3
Man
Mexico

Originally Posted by: Razonar Go to Quoted Post
Hi. A couple of issues. First, SMath needs sometimes an eval() function for speed up calculations, because SMath carry the entire definition for an expression, and not just the numerical value, like in Mathcad. Second, solve works for simple cases, for more complex cases you have the plugin "Nonlinear Solvers". In the attached I substitute solve() by Broyden(), but you can choose another from there, or try to use al_nleqsolve, which is something not less than magic in some cases.

Broyden it's a numerical solver, and like any other the guess value it's part of the solution. I take the previous value x(i-1) as guess for x(i), but don't know if it's the better choice. Even the sateges in the modified SMath file are 13 and in Mathcad 12, the pinch point seems the same, more or less, based in the Mathcad plot.

Two more notes: usually, solvers needs unnasigned variables. You can ensure that with Clear. Also in SMath you can't call composite functions like in mathcad with the function name. That's means in your case that the actual definition for McCabe.ER(f,g) it's "wrong", and the correct one it's "McCabe.ER(f(1),g(1))" and then you can call it with "ans = McCabe.ER(f(x#),g(x#))".

Mc Cabe Valentino 2020.sm (189kb) downloaded 12 time(s).
Mc Cabe Valentino 2020.pdf (707kb) downloaded 11 time(s).

Best regards.
Alvaro.




Alvaro Muchas Gracias Biggrin

Friend, thanks, I had no idea about "Non-linear Solvers" I really liked this solution. OK Oh my



But there is a problem, when "q = 0" the food line or q-Line is drawn in the opposite direction using "Non Linear Solvers"

I found a solution without having the "Non-Linear Solvers" It is very simple. You only have to create a matrix that groups each value that conforms to the function, that is, "X = [X1, X2, X3, ... X11]" = [Y1, Y2, Y3, ... Y11] "in this way, the computer can calculate it in 25 seconds and not in 27 minutes. The only one but is that it still takes 25 seconds, I would like it to do it in 5 seconds.

Thank you very much for answering my question Clap





files

Benzene - Water.pdf (762kb) downloaded 8 time(s).
Mc Cabe Valentino without NLS.sm (207kb) downloaded 8 time(s).
Offline Razonar  
#4 Posted : 19 November 2020 22:36:04(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 545
Uruguay

Was thanked: 310 time(s) in 195 post(s)
Hola Valentino.

Originally Posted by: Valentino Go to Quoted Post


But there is a problem, when "q = 0" the food line or q-Line is drawn in the opposite direction using "Non Linear Solvers"



Yes, Broyden it's unstable in your case. As I understand, q = 1 – (TF–Tbp)/(Tdp–Tbp) and given that y = q/(q-1)*x-z/(q-1), so for q = 0 you have an horizontal slope line of saturated vapor feed, for q = 1 a saturated liquid feed with a slope of the feed line is infinity (vertical), a mixture of liquid and vapor for 0 < q < 1, subcooled liquid for q > 1 and superheated vapor for q < 0. So, It could be hard to test for every cases.

Originally Posted by: Valentino Go to Quoted Post

I found a solution without having the "Non-Linear Solvers" It is very simple. You only have to create a matrix that groups each value that conforms to the function, that is, "X = [X1, X2, X3, ... X11]" = [Y1, Y2, Y3, ... Y11] "in this way, the computer can calculate it in 25 seconds and not in 27 minutes. The only one but is that it still takes 25 seconds, I would like it to do it in 5 seconds.


Great! I attach some few notes, but your works looks complete.

Mc Cabe Valentino without NLS.sm (215kb) downloaded 8 time(s).

Saludos a México!
Alvaro.

PD: Maybe you could be interested in use CoolProp in SMath: https://en.smath.com/for...98_CoolProp-Wrapper.aspx

Edited by user 19 November 2020 22:41:12(UTC)  | Reason: Adding coolprop link

Offline Valentino  
#5 Posted : 22 November 2020 19:47:16(UTC)
Valentino

Rank: Newbie

Groups: Registered
Joined: 13/11/2020(UTC)
Posts: 3
Man
Mexico

Originally Posted by: Jean Giraud Go to Quoted Post
Thanks for the *.PDF from which the system was recovered.
If you have interest in Thiele inverse interpolation, please let me know.
My Smath repository of applied projects is immense, but many tutorial style.
Cheers ... Jean

Thiele McCabe.sm (113kb) downloaded 7 time(s).



Hi Jean Thank you
Friend thanks for taking the time and solving the worksheet. however my Smath Studio 0.99 does not allow me to see the solution



I leave my file already corrected, I added a database to it.



McCabe Thiele - Valentino para Destilacion.sm (455kb) downloaded 7 time(s).
Offline Jean Giraud  
#6 Posted : 22 November 2020 23:50:40(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 4,872
Canada

Was thanked: 801 time(s) in 635 post(s)
Originally Posted by: Valentino Go to Quoted Post
Friend thanks for taking the time and solving the worksheet.
However my Smath Studio 0.99 does not allow me to see the solution

Hola Amigo, there are several walls between us.
1. SS 6179 does not open latest SS. Grand experts have not doctored "Wrong Format"
2. Latest SS freaks the SS 6179 code [length collaboration wrt Hanski project].
3. Your snippets are so small, no software can recuperate.
Open that short version and make *.PDF of the first red complain.
It runs in 9 s [SS 6179, Win.7 1.66 GHz].
I you wish, easy to open the collapsed areas, make/attach PDF.
That may help you to simulate the codes..
Thanks for this superb insight to McCabe-Thiele ... Jean

Thiele McCabe Short.sm (105kb) downloaded 5 time(s).
Offline Jean Giraud  
#7 Posted : 23 November 2020 16:24:11(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 4,872
Canada

Was thanked: 801 time(s) in 635 post(s)
Hola Valentino,
Read first Thiele-McCabe Short. BTW, Thorval Thiele is in my bag for years.
But, couldn't find anything about McCabe, except guess he was from Scotland.
Then visit Thiele minimalist classroom. If you have interest getting more
wrt your project for instance Cf(x) in reduced J_Frac, please let me know.
Thanks again for this most useful/educative project.
Thiele is for advanced Engineering stuff. I got it from F.B. Hildebrand,
made it work in pocket calculator(s) around 1990, then Excel, then Mathcad.
Carlos contribution is recent in Smath. More generally, I use my original.
Cheers, take care ... Jean

Thiele_3 Automatic [on error Carlos].sm (87kb) downloaded 7 time(s).
Thiele McCabe Short.sm (110kb) downloaded 8 time(s).
Offline Jean Giraud  
#8 Posted : 25 November 2020 17:07:37(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 4,872
Canada

Was thanked: 801 time(s) in 635 post(s)
... this document is complete wrt your demo project.
Added in collapsed the topic about casual glitches.
Still attempting to compact the code of the Tray System.
Your last comment/suggestion ? ... Jean

Thiele McCabe Short.sm (164kb) downloaded 5 time(s).
Offline Jean Giraud  
#9 Posted : 25 November 2020 20:36:04(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 4,872
Canada

Was thanked: 801 time(s) in 635 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
Still attempting to compact the code of the Tray System.

Added this missing link tray-stage system Companion.
Superb classroom Engineering demo project ... ended as given.
Thanks Valentino ... Jean

Thiele McCabe Short Companion.sm (124kb) downloaded 6 time(s).

The Companion is not installed where it should be, exercise for the user.
It could be compacted, that would complicate for Smath not too familiar.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.