cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Accessing Functions in DLL from Mathca

GastonMathijsse
1-Newbie

Accessing Functions in DLL from Mathca

We have an application within Excel which calculates gasproperties of gascompositions. This is done by creating DLL from old legacy code in Fortran 77 and a so-called wrapper DLL in Delphi.
In the excel sheet you can then calculate gasproperties like molweight, k, z, cp and cv.
I really am a newbie on this DLL stuff and don't understand how it is done but it works great.

Is it possible to use the same DLL under Matcad and what should I do to actually use the functions?

Any info on this subject would be helpfull.
5 REPLIES 5

Your *.DLL, it does what ? It does the applicable maths. Then extract these applicable maths and plug them as function(s) in Mathcad, then zap the *.DLL. Engineering maths that aren't visible in formula are no maths. Those properties, they come from formulas, why do you have to retrieve them from obscure, not visible intermediate fornication ? They come from books/handbooks, take them from there and plug in Mathcad.

jmG

M14's Help menu's 3rd entry is Developer's Reference, which contains information about how to incorporate DLLs.

TTFN,
Eden

You cannot use the same DLL. Mathcd has a specific interface for DLL provided functions, and that is not the same as Excel's interface.

You can use the same technique, but you would have to write a Mathcad specific wrapper function to create a Mathcad specific DLL.

An alternative would be to embed an Excel component that accesses the Excel DLL and then use that to do the calculations.
__________________
� � � � Tom Gutman

Thanks Tom that is the clear answer I need.
Next step is to find a collegua who is into writing wrapper DLL because for me that is one step too far. As non IT-specialist the Developer Instruction scared me off a little bit. But maybe I should go through it step by step.

@jmg
The DLL contains functions to calculate gasproperties through chosen Equations of State like BWRS, LKP and RKS. From now Excel you give an array of the composition of the gas with temperature and pressure and you recieve back proerties like Cp,k,z, h, s etc.
Rewriting and validating these routines from handbooks as you implied will take considerable efforts and is therefore not prefered.


Thanks for the reponses from you all.


frummeltje

On 9/10/2009 3:03:15 AM, Frummeltje wrote:
>Thanks Tom that is the clear
>answer I need.
>Next step is to find a
>collegua who is into writing
>wrapper DLL because for me
>that is one step too far. As
>non IT-specialist the
>Developer Instruction scared
>me off a little bit. But maybe
>I should go through it step by
>step.
>
>@jmg
>The DLL contains functions to
>calculate gasproperties
>through chosen Equations of
>State like BWRS, LKP and RKS.
>From now Excel you give an
>array of the composition of
>the gas with temperature and
>pressure and you recieve back
>proerties like Cp,k,z, h, s
>etc.
>Rewriting and validating these
>routines from handbooks as you
>implied will take considerable
>efforts and is therefore not
>prefered.
>
>
>Thanks for the reponses from
>you all.
>
>
>frummeltje

They are not toooo hard to write. If you already have existing working code then that is a great help.

I am currently writing a dll for wavelets and finite impulse response stuff, so you may see a few posts.

The manual to look for is 'hidden' under help as "Developers reference". It includes a section on wrapping FORTRAN code as well.

As a first step, just use Tom's method for embedding your existing excel. There are simple routines for stuffing the values into excel from mathcad, and getting the values back, depending on how you want to do things.


Philip Oakley
Top Tags