Mathcad Custom Functions

Mathcad Custom Functions - This plugin will help you to connect Mathcad custom functions - Messages

#101 Posted: 2/20/2021 5:55:23 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Show mcadefi.log content from plugin folder (%appdata%\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\x.x.x.x) when the program is running.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Martin_B 5/22/2021 7:42:00 AM
#102 Posted: 2/20/2021 8:30:39 PM
GerardLardner

GerardLardner

4 likes in 34 posts.

Group: User

Hi Uni,

Thanks for posting so quickly. So that's where the logfile resides; I either had forgotten or never knew; I also didn't know it exists only while SMath is running.

Here is the contents of mcadefi.log:

20.02.2021 23:26:42 [INFO ] [Plugin.Initialize()] OS: Microsoft Windows NT 6.2.9200.0
20.02.2021 23:26:42 [INFO ] [Plugin.Initialize()] .Net: 4.0.30319.42000
20.02.2021 23:26:42 [INFO ] [Plugin.Initialize()] 32-bit
20.02.2021 23:26:42 [INFO ] [Plugin.Initialize()] EFI for SMath Studio, version 1.0.7165.40625, 14-Aug-2019 22:34:10
20.02.2021 23:26:42 [INFO ] [Plugin.Initialize()] Psi(1) - ( z ) Digamma function for complex z
20.02.2021 23:26:42 [INFO ] [Plugin.Initialize()] kronecker(2) - ( M,N ) Kronecker product of a square matrix M and a square matrix N
20.02.2021 23:26:42 [INFO ] [Plugin.Initialize()] Successfully. 2 function(s) loaded.
#103 Posted: 2/21/2021 1:51:21 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Plugin mcadefi loads user libraries located in userefi folder. You have to copy the same library there, which is located in the Mathcad userefi folder.
Also show userefi\efi.txt content when the program is running.
Russia ☭ forever, Viacheslav N. Mezentsev
#104 Posted: 2/21/2021 2:22:52 PM
GerardLardner

GerardLardner

4 likes in 34 posts.

Group: User

OK. I had wspmcad.dll and XSteam_V2.6b.dll in C:\Program Files (x86)\SMath Studio\plugins\, now moved to C:\Program Files (x86)\SMath Studio\plugins\userefi. This is the resulting userefi\efi.txt:

Quote

21.02.2021 17:18:51 [INFO ] [LoadLibraries] begin:
21.02.2021 17:18:51 [INFO ] [CreateUserFunction] [DIGAMMA.DLL] Psi( z ) Digamma function for complex z
21.02.2021 17:18:51 [INFO ] [LoadLibraries] C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\DIGAMMA.DLL loaded.
21.02.2021 17:18:51 [INFO ] [CreateUserFunction] [KRONECKR.DLL] kronecker( M,N ) Kronecker product of a square matrix M and a square matrix N
21.02.2021 17:18:51 [INFO ] [LoadLibraries] C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\KRONECKR.DLL loaded.
21.02.2021 17:18:51 [INFO ] [LoadLibraries] end.



No sign of either WaterSteamPro or X-Steam being loaded.

Another oddity has arisen last night, since I started to try to get WaterSteamPro and X-Steam working in SMathStudio. Occasionally SMath fails to start, complaining about a succession of functions not being found ("The specified module could not be found"). Usually, if I kill SMathStudio using Task Manager, it will start correctly next try.
#105 Posted: 2/21/2021 2:41:48 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

You are not surprised that the paths you specify are different from those described by the program?

Plugins by default use the folder specified in the log file:
C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\

And the specified userefi folder must be one:

C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\

In the Mathcad this folder is located in the same place as the program but this is due to compatibility. In our case this folder should be located in the place where the plugin itself is installed. An exception may be the portable version of the program.

You must copy your files to this path:

%appdata%\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\

If the plugin is updated, you need to manually copy your libraries to a new location: \plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\x.x.x.x\userefi\
Russia ☭ forever, Viacheslav N. Mezentsev
#106 Posted: 2/21/2021 5:01:39 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

No sign of either WaterSteamPro or X-Steam being loaded.


Revisit this document. Most of it dates back before my Mathcad 8 Pro.
Sure, Mathcad helped a lot for better publishing. That stuff is what
I need for Process Control & Instrumentation. At this point, if you
need more: attach the data set ... for some suite.
Never heard of "X-Steam".
CoolProp dates back 8 years ago in Smath.
It didn't work much for Radovan [plenty of red].
Can't retrieve that old stuff from the Forum, that seemingly truncates.
Sorry Gerard: can't help more.

Inst_IAPWS region 1 MostUsed.sm (265 KiB) downloaded 33 time(s).

#107 Posted: 2/21/2021 8:37:29 PM
GerardLardner

GerardLardner

4 likes in 34 posts.

Group: User

Thank you, Uni. It is much clearer now, and WaterSteamPro is now working in SMathStudio.

I have still not got X-Steam working in SMathStudio. I don't really need it but some clients ask me to use it.

The efi.txt file now looks like this (I have deleted a lot of lines related to KRONECKER and WatersteanPro, leaving just the first [CreateUserFunction] line of each block). Can you see any reason why the mcadefi is not loading the UserFunctions from X-Steam?

Quote

21.02.2021 23:27:46 [INFO ] [LoadLibraries] begin:
21.02.2021 23:27:46 [INFO ] [CreateUserFunction] [DIGAMMA.DLL] Psi( z ) Digamma function for complex z
21.02.2021 23:27:46 [INFO ] [LoadLibraries] C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\DIGAMMA.DLL loaded.
21.02.2021 23:27:46 [INFO ] [CreateUserFunction] [KRONECKR.DLL] kronecker( M,N ) Kronecker product of a square matrix M and a square matrix N
21.02.2021 23:27:46 [INFO ] [LoadLibraries] C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\KRONECKR.DLL loaded.
21.02.2021 23:27:46 [INFO ] [CreateUserFunction] [mathlib.dll] H1v( v,z ) Hankel function of real order v and complex argument z (1st kind). Argument z must be nonzero and is considered in the cut plane -pi < arg(z) <= pi.
... (72 lines deleted)
21.02.2021 23:27:46 [INFO ] [LoadLibraries] C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\mathlib.dll loaded.
21.02.2021 23:27:46 [INFO ] [CreateUserFunction] [wspmcad.dll] wspSURFTENT(...)
... (369 lines deleted)
21.02.2021 23:27:46 [INFO ] [LoadLibraries] C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\wspmcad.dll loaded.
21.02.2021 23:27:46 [INFO ] [LoadLibraries] C:\Users\glard\AppData\Roaming\SMath\extensions\plugins\91a20d24-c30b-4774-9b1b-4d502a80420f\1.0.7165.40625\userefi\XSteam_V2.6b.dll loaded.
21.02.2021 23:27:46 [INFO ] [LoadLibraries] end.


#108 Posted: 2/21/2021 8:53:15 PM
GerardLardner

GerardLardner

4 likes in 34 posts.

Group: User

Wrote

Never heard of "X-Steam".



Thank you Jean. Actually, CoolProp works OK in SMath for me.

As I noted in the message above, I don't like to use X-Steam but somethimes I have to. X-Steam was an add-in for Excel, Matlab, Scilab and OpenOffice created in the early 2000s by a Swedish engineer, Magnus Holmgren; it was originally, I think, distributed as VBA macro for Excel. It's been pretty much abandonware since 2011 (when the website registration expired), with the last release being in 2006. Holmgren said he would put it on Sourceforge but he never did; I guess he simply retired. Someone else has created an archive of the downloadable files, including a dll version, at https://github.com/KurtJacobson/XSteam. One of the 'features' about it I don't like is that the base units for pressure and temperature are bar (abs) and °C; it is limited to temperatures above 0°C. As I say, I will only use it if I have to check a client's spreadsheet, where they have used it, or occasionally when I have to share a spreadsheet with someone who does not have WaterSteamPro or other common steam tables and I need to include steam tables in it.
#109 Posted: 2/21/2021 9:08:07 PM
GerardLardner

GerardLardner

4 likes in 34 posts.

Group: User

Wrote

Another oddity has arisen last night, since I started to try to get WaterSteamPro and X-Steam working in SMathStudio. Occasionally SMath fails to start, complaining about a succession of functions not being found ("The specified module could not be found"). Usually, if I kill SMathStudio using Task Manager, it will start correctly next try.



I forgot to mention, since following Uni's guidance below, this problem also seems to have been resolved.
#110 Posted: 2/22/2021 12:16:20 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote


As I noted in the message above, I don't like to use X-Steam but somethimes I have to. X-Steam was an add-in for Excel, Matlab, Scilab and OpenOffice created in the early 2000s by a Swedish engineer, Magnus Holmgren; it was originally, I think, distributed as VBA macro for Excel.



Hello. I have used it. It had a very good reception in Mexico, Cuba, Spain, Uruguay and other Latin American countries. But the version that I remember was only for Excel. The dll that appears in your list may be for Excel, via some xsteam.xla; I don't remember a version from where that you could use it directly in Mathcad. The way to use it in Mathcad was to use the Excel component in Mathcad, and it was an Excel worksheet with xsteam.xla as reference that called the XSteam dll.

There are programs that analyze which modules are exported in a dll, as well as what the dependency is. In case it can be called from Mathcad, you should see a dependency to mcdefi.dll from xsteam.dll. If you upload xsteam.dll as a zip file I or Viacheslav (uni) or many others here can tell you if it is a dll for Excel or for Mathcad. The SMath plugin can only invoke dlls for Mathcad.

You can see also this post: https://en.smath.com/forum/yaf_postsm9156_Built-in-Thermodynamic--and-other--Tables.aspx

Best regards.
Alvaro.
#111 Posted: 2/22/2021 12:54:36 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Yes XSteam do not work because it is not a mathcad userefi dll, but I can make a plugin from it:

https://github.com/KurtJacobson/XSteam
Russia ☭ forever, Viacheslav N. Mezentsev
#112 Posted: 2/22/2021 1:33:47 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Ok, now I remember. Previously, I included examples of its use in the archive with the plugin and these tables were there. But you need two files. One file is the library itself with functions, and the second is a plugin for Mathcad. I have attached the missing library in the archive. Don't lose it.

XSteam.zip (4 MiB) downloaded 59 time(s).
XSteam.sm (31 KiB) downloaded 51 time(s).
XSteam.pdf (73 KiB) downloaded 57 time(s).

Click to enlarge
Russia ☭ forever, Viacheslav N. Mezentsev
#113 Posted: 2/22/2021 6:08:23 AM
GerardLardner

GerardLardner

4 likes in 34 posts.

Group: User

Wrote

Ok, now I remember. Previously, I included examples of its use in the archive with the plugin and these tables were there. But you need two files. One file is the library itself with functions, and the second is a plugin for Mathcad. I have attached the missing library in the archive. Don't lose it.

XSteam.zip (4 MiB) downloaded 59 time(s).
XSteam.sm (31 KiB) downloaded 51 time(s).
XSteam.pdf (73 KiB) downloaded 57 time(s).



Thank you very much.
#114 Posted: 5/22/2021 6:44:13 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

SMath Studio compatibility

Plugin updated.

Changes:

- 64-bit support added;
- refactored.

It is possible to use user libraries for the Mathcad Prime 6+ (64-bit). This is CoolProp 6.4.1 64-bit for Prime 6.0.

File not found. File not found.

Links:

1. CoolProp's download directory
2. CoolProp Wrapper for MathCAD Prime 3.x or later (64-bit)
3. SMath Studio CoolProp Wrapper
Russia ☭ forever, Viacheslav N. Mezentsev
2 users liked this post
churichuro 5/22/2021 12:53:00 PM, sergio 5/22/2021 6:46:00 AM
#115 Posted: 5/27/2021 11:45:49 AM
Igor Skarine

Igor Skarine

14 likes in 97 posts.

Group: User

Hi uni,
Could you please re-build this ancient msvc60 project as 64-bit extension, if you have time of course.
msvc60-remez2_dll.7z (10 KiB) downloaded 40 time(s).
Unfortunately I'm not a programmer, but 63years old hardware developer.
Best regards
1 users liked this post
Вячеслав Мезенцев 5/27/2021 12:29:00 PM
#116 Posted: 5/27/2021 12:28:38 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

I will rewrite the code in c# and add it to the FIR Filter Design plugin. I hope it will not lose speed and accuracy.
Russia ☭ forever, Viacheslav N. Mezentsev
#117 Posted: 11/17/2021 5:36:02 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Wrote

Hi uni,
Could you please re-build this ancient msvc60 project as 64-bit extension, if you have time of course.
msvc60-remez2_dll.7z (10 KiB) downloaded 40 time(s).
Unfortunately I'm not a programmer, but 63years old hardware developer.
Best regards


Wrote

I will rewrite the code in c# and add it to the FIR Filter Design plugin. I hope it will not lose speed and accuracy.


Done. See here.

Please check.

Click to enlarge

remez2 example.sm (18 KiB) downloaded 58 time(s).
remez2 example.pdf (118 KiB) downloaded 45 time(s).
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Igor Skarine 11/25/2021 9:56:00 AM
#118 Posted: 12/30/2021 8:07:13 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

SMath Studio compatibility

Plugin updated.

Changes:

- plugin renamed from mcadefi to MathcadCustomFunctions;
- version changed to 1.1.*;
- restructured and totally refactored.

Links:

1. About Custom Functions.
Russia ☭ forever, Viacheslav N. Mezentsev
2 users liked this post
sergio 12/31/2021 5:58:00 AM, NDTM Amarasekera 12/31/2021 6:06:00 AM
  • New Posts New Posts
  • No New Posts No New Posts