McCabe - Thiele Binary Distillation

McCabe - Thiele Binary Distillation - McCabe code takes a long time to calculate - Сообщения

#1 Опубликовано: 18.11.2020 21:56:19
Erick Valentino

Erick Valentino

7 сообщений из 28 понравились пользователям.

Группа: User

Hello guys


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



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


files:

SMath Studio
Mc Cabe Valentino 2020.sm (185 КиБ) скачан 94 раз(а).

Mathcad Prime 6
McCabe Mathcad Prime 6.pdf (533 КиБ) скачан 92 раз(а).

[albumimg]1618[/albumimg]
[albumimg]1619[/albumimg]
#2 Опубликовано: 19.11.2020 01:22:39
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

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 (188 КиБ) скачан 74 раз(а).
Mc Cabe Valentino 2020.pdf (706 КиБ) скачан 74 раз(а).

Best regards.
Alvaro.
1 пользователям понравился этот пост
Erick Valentino 19.11.2020 06:36:00
#3 Опубликовано: 19.11.2020 07:54:55
Erick Valentino

Erick Valentino

7 сообщений из 28 понравились пользователям.

Группа: User

Wrote

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 (188 КиБ) скачан 74 раз(а).
Mc Cabe Valentino 2020.pdf (706 КиБ) скачан 74 раз(а).

Best regards.
Alvaro.





Alvaro Muchas Gracias

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



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


[albumimg]1620[/albumimg]
[albumimg]1621[/albumimg]

files

Benzene - Water.pdf (761 КиБ) скачан 51 раз(а).
Mc Cabe Valentino without NLS.sm (206 КиБ) скачан 50 раз(а).
#4 Опубликовано: 19.11.2020 16:36:04
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hola Valentino.

Wrote



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.

Wrote


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 (214 КиБ) скачан 57 раз(а).

Saludos a México!
Alvaro.

PD: Maybe you could be interested in use CoolProp in SMath: https://en.smath.com/forum/yaf_postst7398_CoolProp-Wrapper.aspx
#5 Опубликовано: 22.11.2020 13:47:16
Erick Valentino

Erick Valentino

7 сообщений из 28 понравились пользователям.

Группа: User

Wrote

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 (112 КиБ) скачан 42 раз(а).




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

[albumimg]1622[/albumimg][albumimg]1623[/albumimg]

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

[albumimg]1624[/albumimg]

McCabe Thiele - Valentino para Destilacion.sm (454 КиБ) скачан 64 раз(а).
#6 Опубликовано: 22.11.2020 17:50:40
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

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 (104 КиБ) скачан 51 раз(а).
#7 Опубликовано: 23.11.2020 10:24:11
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

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 (86 КиБ) скачан 56 раз(а).
Thiele McCabe Short.sm (109 КиБ) скачан 53 раз(а).
#8 Опубликовано: 25.11.2020 11:07:37
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

... 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 (163 КиБ) скачан 52 раз(а).
#9 Опубликовано: 25.11.2020 14:36:04
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

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 (123 КиБ) скачан 68 раз(а).

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.
#10 Опубликовано: 05.12.2020 01:31:04
Erick Valentino

Erick Valentino

7 сообщений из 28 понравились пользователям.

Группа: User

Wrote

Wrote

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 (123 КиБ) скачан 68 раз(а).

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.



Friend, thank you very much, even though my Smath Studio cannot fully resolve the document you share.

[albumimg]1627[/albumimg]

However create an executable with a database (700 compounds). I hope it is useful for someone in the community. Do you know where you could put it in this community?

[albumimg]1626[/albumimg]

SMATH STUDIO 0.99
McCabe Thiele - 700 Compuestos.sm (561 КиБ) скачан 89 раз(а).

.EXE (ZIP)
McCabe Thiele - 700 Compuestos.7z (1 МиБ) скачан 81 раз(а).
1 пользователям понравился этот пост
Alvaro Diaz Falconi 07.12.2020 19:46:00
#11 Опубликовано: 07.12.2020 19:55:09
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Wrote

...
However create an executable with a database (700 compounds). I hope it is useful for someone in the community. Do you know where you could put it in this community?

[albumimg]1626[/albumimg]

SMATH STUDIO 0.99
McCabe Thiele - 700 Compuestos.sm (561 КиБ) скачан 89 раз(а).

.EXE (ZIP)
McCabe Thiele - 700 Compuestos.7z (1 МиБ) скачан 81 раз(а).



Hola Valentino. Excelente trabajo. De momento no hay foros divididos por ingeniería, pero pienso que el mejor lugar es el foro correspondiente a "Samples". Quizás alguien más pueda recomendar algun otro lugar mejor para tu trabajo.

Hi Valentino. Excellent work. At the moment there are no forums divided by engineering, but I think the best place is the forum corresponding to "Samples". maybe someone else can recommend a better place for your work. Maybe someone else can recommend a better place for your work.

Best regards.
Alvaro.
#12 Опубликовано: 07.12.2020 21:24:22
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

What is that joke *.EXE zip ?
Expose the all document, make *.PDF, for the all community quick visit.
I'm still waiting your *.PDF of my document that you declared red.
From distillation columns to distillation columns, Heavy Water ends
in a 2 m high column ~ 2 " diameter Dupont Patent secret.
#13 Опубликовано: 07.12.2020 23:21:38
Erick Valentino

Erick Valentino

7 сообщений из 28 понравились пользователям.

Группа: User

Wrote

What is that joke *.EXE zip ?
Expose the all document, make *.PDF, for the all community quick visit.
I'm still waiting your *.PDF of my document that you declared red.
From distillation columns to distillation columns, Heavy Water ends
in a 2 m high column ~ 2 " diameter Dupont Patent secret.



hello friend I hope you are very well

Regarding the .EXE, this page does not allow me to upload this type of files, so I uploaded it as ZIP or 7Z, the Smath Studio allows saving it as executable and it is the one I uploaded on this page.

Document not fully resolved PDF
Thiele McCabe Short-1.pdf (418 КиБ) скачан 58 раз(а).

McCabe 700 Document PDF Compounds, resolution in 3 seconds
McCabe Thiele - 700 Compuestos Erick Valentino.pdf (620 КиБ) скачан 65 раз(а).


Antoine's Constants Document PDF
CA.pdf (2 МиБ) скачан 50 раз(а).
#14 Опубликовано: 08.12.2020 10:52:36
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

Document not fully resolved PDF


Slanted maths are just horror
Please run this version stripped of some notes from my small laptop.
Why it does not plot in your system ? If red plot, what does it says ?
Make sure you close PC, open PC and only Smath and this document.
Wait and read from You ... Jean

McCabe4Bug.PNG

Thiele McCabe Companion MERITAS.sm (76 КиБ) скачан 38 раз(а).
#15 Опубликовано: 08.12.2020 12:38:14
overlord

overlord

552 сообщений из 1332 понравились пользователям.

Группа: Moderator

Jean, for Cfr(K;X;x) function, had to change equal sign "=" to ":=" on your previous document.
I have no idea why a definition on your build is represented as numeric equal on latest builds.
It was giving red dots on build 7632 but now everything is fine.
Everything is calculated and plotted, no more red dots.

Regards

2020-12-08_15-15.png

2020-12-08_15-14.png
#16 Опубликовано: 08.12.2020 14:54:03
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

Jean, for Cfr(K;X;x) function, had to change equal sign "=" to ":=" on your previous document.
I have no idea why a definition on your build is represented as numeric equal on latest builds.
It was giving red dots on build 7632 but now everything is fine.
Everything is calculated and plotted, no more red dots.


Thanks Collab for the Smath Community. What a crucifying bug !!!

#17 Опубликовано: 09.12.2020 10:47:40
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

... here is the answer.
As put in evidence, latest SS does not recast
Probably, very many documents that use the "recast" technique will turn red
on revisit after latest SS update ... not only mines.
I don't want to believe the "recast" code has been voluntarily removed.
For users, a bug is a bug that the concerned file or else.
Thanks overlord for pointing the failure. Take care ... Jean.

Thiele Latest SS Bug.PNG
#18 Опубликовано: 10.12.2020 16:07:56
CBG

CBG

77 сообщений из 312 понравились пользователям.

Группа: User

Changing the subscript zero to 1 in Jean's file resolves the inconsistency, for some unknown reason SS 6139 accepts the value zero in the "for" function.

Best Regards

Carlos

Thiele_7632.png

Thiele McCabe Companion MERITAS_V7632.sm (77 КиБ) скачан 65 раз(а).
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений