- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Usage of Modelica.Math.Matrices?
Usage of Modelica.Math.Matrices?
Usage of Modelica.Math.Matrices?
Hi,
I have been trying to use the Matrices library within OMnotebook, so far without any success. Matrices.eigenValues with the following code:
class testeig
import Modelica.Math.Matrices;
Real A[3,3] = [1,2,3;3,4,5;2,1,4];
Real [3,3] eval;
Real [3,2] vals;
algorithm
(vals,eval):=Matrices.eigenValues(A);
end testeig;
When simulating I only got error messages. On Kubuntu
record SimulationResult
resultFile = "",
messages = "Simulation failed for model: testeig
[/usr/lib/omlibrary/msl31//Modelica/Math/package.mo:2089:7-2089:79:readonly] Error: Wrong type or wrong number of arguments to zeros(size(A, 1), size(A, 1))'.
(in component <NO COMPONENT>)
[/usr/lib/omlibrary/msl31//Modelica/Math/package.mo:1225:8-1225:81:readonly] Error: Class LAPACK.dgeev_eigenValues not found in scope Modelica.Math.Matrices.eigenValues (looking for a function or record).
Error: Error occured while flattening model testeig
",
timeFrontend = 0.0,
timeBackend = 0.0,
timeSimCode = 0.0,
timeTemplates = 0.0,
timeCompile = 0.0,
timeSimulation = 0.0,
timeTotal = 0.0
end SimulationResult;
and on Windows XP:
record SimulationResult
resultFile = "",
messages = "Simulation failed for model: testeig
end SimulationResult;
What changes do I have to make to get it working?
Calling the function in the equation block is also not working.
Thanks!
asd
Re: Usage of Modelica.Math.Matrices?
- sjoelund.se
- 1700 Posts
Re: Usage of Modelica.Math.Matrices?
Hi,
I Have tried to use Modelica.Math.Matrices.solve(), but it doesn't seem to work (although the same code runs perfectly in Dymola). This is what I get:
Error: Error building simulator. Buildlog: The syntax of the command is incorrec
t.
g++ -I. -o Fourier_case2D.test3.exe Fourier_case2D.test3.cpp \"-LC:/OpenModelic
a1.7.0/lib/omlibrary/msl31/Resources/Library/mingw32\" \"-LC:/OpenModelica1.7.0/
lib/omlibrary/msl31/Resources/Library/win32\" \"-LC:/OpenModelica1.7.0/lib/omlib
rary/msl31/Resources/Library\" -llapack-mingw -ltmglib-mingw -lblas-mingw -lf2c
-lModelicaExternalC -lsim -linteractive -I\"C:/OpenModelica1.7.0//include/omc\
" -O3 -falign-functions -msse2 -mfpmath=sse -lsendData -lQtNetwork-mingw -lQtC
ore-mingw -lQtGui-mingw -luuid -lole32 -lws2_32 -L\"C:/OpenModelica1.7.0//lib/om
c\" -lc_runtime -lregex -Wl,-Bstatic -lf2c -Wl,-Bdynamic Fourier_case2D.test3_re
cords.c
In file included from Fourier_case2D.test3.cpp:8:
Fourier_case2D.test3_functions.h:67: error: declaration of C function `void dges
v_(const int*, int*, double*, const int*, int*, double*, const int*, int*)' conf
licts with
C:/OpenModelica1.7.0//include/omc/matrix.h:47: error: previous declaration `int
dgesv_(integer*, integer*, doublereal*, integer*, integer*, doublereal*, integer
*, integer*)' here
\\MinGW\\bin\\mingw32-make: *** [Fourier_case2D.test3] Error 1
",
timeFrontend = 0.0,
timeBackend = 0.0,
timeSimCode = 0.0,
timeTemplates = 0.0,
timeCompile = 0.0,
timeSimulation = 0.0,
timeTotal = 0.0
end SimulationResult;
I use OpenModelica 1.7.0.
Do you have any idea what I am doing wrong?
Grtz
Ruben
Re: Usage of Modelica.Math.Matrices?
You're doing nothing wrong. We had a name collision between our own dgesv_ and the one in Marices.LAPACK.
I now (hopefully) solved it in a new build:
http://build.openmodelica.org/omc/build … ly-builds/
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Usage of Modelica.Math.Matrices?