- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Steam Table Interface using FORTRAN
Steam Table Interface using FORTRAN
Steam Table Interface using FORTRAN
We are modeling a Boiler in Modelica which requires extensive use of steam properties from Steam Table. Since the Media library is not yet supported in OpenModelica, we are trying to use the external functions in FORTRAN which can compute it.
As an initial step, we tried to check the external calling function for simple functions. We have the falling queries
1) where do we place the external fortran files?
2) What are the files required for calling external FORTRAN files? Is there any additional files to call other than the file that has the function?
3) We are trying to use the examples provided in the examples and not able to successfully implement it.
Thank you
John
Re: Steam Table Interface using FORTRAN
1. You create a .so or .a file. GCC will link using -lpackageName, so if you use annotation Library="abc", you should name your file libabc.a or libabc.so. The file should be on the linker path (same directory as the model, or /usr/local/lib for example).
2. There is no files required to call the external FORTRAN file, but you need to compile it before simulation.
3. Which examples? The examples directory doesn't contain the string FORTRAN anywhere.
From testsuite/mofiles/ExternalFunction4.mo (testcase based on MSL 2.2):
function dgetri
input Real LU[:,size(LU,1)];
input Integer pivots[size(LU,1)];
output Real inv[size(LU,1),size(LU,2)]=LU;
protected
Integer lwork=min(10,size(LU,1))*size(LU,1);
Real work[lwork];
Integer info;
external "FORTRAN 77" dgetri(size(LU,1),inv,size(LU,1),pivots,work,lwork,info) annotation (Library="Lapack");
end dgetri;
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Steam Table Interface using FORTRAN