Doing it with some files that were made available hereOlder Mathcad file conversion What do you think?
I think better do it in Prime with units of temperature, pressure, consentrations etc
I have create on my Mathcad server some of same sheets.
Hi Valery,
About the introduction of units in the worksheet, the function Z, that calculates the equation of state roots by the polyroot function, gives as output a vector whose components have different units ( dimensionless ( compressibilities factor) and pressure unit ( fugacities )). I think a direct conversion to MathCAD prime should not be possible. correct?
Your faithfully,
Massimiliano
Massimiliano Nori написал(а):
Hi Valery,
About the introduction of units in the worksheet, the function Z, that calculates the equation of state roots by the polyroot function, gives as output a vector whose components have different units ( dimensionless ( compressibilities factor) and pressure unit ( fugacities )). I think a direct conversion to MathCAD prime should not be possible. correct?
Your faithfully,
Massimiliano
Sorry, not correct!
We can try!
Converting and Introducing the units in Mathcad Prime, the error message "this value must be a function" appears.
And more
Thank you,
Since I am in the club now, is there any singularity source in the function sum?
Massimiliano Nori wrote:
Thank you,
Since I am in the club now, is there any singularity source in the function sum?
Yes, you divide by some strange heavily nested matrices with zero values
I just stumbled upon this thread and gave it a try - I know its an old thread and probably you have found the reason for the problem already yourself.
On the other hand you did not come back to present your solution and did not close the thread.
Thank you Werner,
The MathCAD Prime code for bubble point calculation of a mixture is derived from the one in MathCAD 15. The one in MathCAD 15 is working, while I found some issues in Prime. It was suggested to use Prime because of the possibility of using unit of measurement ( However also in mathCAD 15, is it possible to use unit (?)). Why did you add "return" in the code?
The sum function should give as result a vector, the first element (0) representing the sum of molar fraction, the other (1..N) component molar fraction. it is applied to iterate on the so-called congruency relation. See attachment. It should have four arguments : 2 vectors (2x1) for molar fractions and two scalars, Pressure and Binary interaction parameter).
Currently I would like to modify the MathCAD 15 procedure introducing Huron-Vidal mixing rules instead of the classical ( Van der Waals ) one.
Yes Prime can do a little bit better with units than Mathcad (e.g. in a solve block with odesolve). It also has some other advantages, like the usage of different dimensions in one matrix, matrix editing (matrix scrolling on the other hand is just a bad joke), matrix row selector operator, Ctrl-J for programming keywords.
But the handling, usability and performance speed of Prime and its user interface is inferior. And its still missing a lot of features we are used from Mathcad. So I don't consider it ready for use for real work.
> Why did you add "return" in the code?
For debug purposes. I just wanted to see which values are in use so I let the program return those values and stop (so we do not run in the error) and as you can see you run into a kind of divison by zero, or better division by a zero inside a matrix inside a matrix ...
In Mathcad we have the "trace" command inside a program and turn on debug mode and so we could see live the content of the various variables while the program runs. Prime does not offer any debug mode.
> The sum function should give as result a vector,
Your program never reaches that line because the line before you divide by this zero matrix (fugtv[i+3)
> The problem seems to be the function Z which I haven't looked at.
You had yourself evaluated it and if you turn on showing nested matrices you can see the problem - the same as I had seen when i used that return command.
The reason you have created that nasty nested matrices is because in the definition of f1 and f2 in your program you type square brackets which creates a matrix. Always use normal parentheses!
If you correct this you still have a division by zero as fug0 and fug1 result in zero.
Reason is the high values of f0 and f1.
E.g. f0=-2.0658207*10^6 and so exp(f0) is 2.848822*10^-897175 which for Mathcads numerics is zero.
Obviously there still is something else wrong.
Thank you, Werner, I will recheck the MathCAD Prime Flowsheet, in MathCAD 15 it looks that it is working properly.
I just converted the Mathcad Worksheet into Prime format and it looks like the sheet performs flawless as in Mathcad 15 (at one point an undefined variable k is used).
So if your converted sheet does not work, i can only see reasons
1) you did not use the provided converter but converted it manually by retyping the whole sheet and made some mistakes doing so
2) You changed something in the sheet after conversion
3) you provided different data and MC15 would choke on the same data as well
Here is the converted sheet w/o modifications
Thank you, I did not have access to the converter in my Prime installation . XMCD, MCD converter not available in Prime 3.0
Next I would like to add the units in the prime version of the calculation sheet and consider other mixing rules (e.g. Huron Vidal ) for the EOS parameters.
Massimiliano Nori wrote:
Thank you, I did not have access to the converter in my Prime installation . XMCD, MCD converter not available in Prime 3.0
The conversion was done with Prime 3.0 by me. As I answered in that thread you need Mathcad 15 installed alongside your Prime version to make the converter work.
Obviously you have Mathcad installed somewhere - otherwise you would not have been able to read the worksheets in the older format.
Data fitted with PR and SRK respectively: