Lapack in Simulink Real-Time Desktop
6 ビュー (過去 30 日間)
古いコメントを表示
Is the LAPACK library included in the Simulink Real-Time Desktop?
More specifically, I built a C S-function to integrate\ a large dynamical system having form:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1214898/image.png)
Unfortunately, I cannot invert the matrix A analytically because large. The solution was to solve the linear system for
inside the S-function by using the LAPACK function dgesv. I was able to generate the mex file of the S-function for the standard simulation mode in Simulink, in particular by including the mwlapack library in the mex compilation flags.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1214903/image.png)
Now, I would like to try the Simulink Real-Time Desktop. The code generation and building works, but at the end I had the following error
Error occurred while executing External Mode MEX-file 'sldrtext': Error loading real-time image: undefined symbol "dgesv_"
My thinking was that I have to include the LAPACK library. I tried to include mwlapack in the Simulink libraries but it does not work (library not found in search directories).
0 件のコメント
回答 (1 件)
Jan Houska
2022 年 12 月 2 日
Hi Stefano,
to be able to use some library with Simulink Desktop Real-Time, the library must be available in source form (C or C++) and the library code must be compilable for real-time operation. I don't think this is the case with LAPACK and I'm afraid LAPACK will not be usable for creating real-time code.
At this point, you have two options. Either you can use Simulink Desktop Real-Time in Connected IO mode. In this mode, your Simulink model runs uncompiled, your S-function runs as-is, and I/O operations are performed by Simulink Desktop Real-Time blocks. While the overall performance is not as high as with compiled code, it may work very well if the sample rate of the model is not too high. This is probably what I'd try first.
Or, you can also rewrite your set of equations to a Simulink model using no S-function or LAPACK - just using the integrators, gains, nonlinearities, etc. If your model follows the equation you have outlined, this should be possible, but, depending on the complexity and size of the model, it may be a lot of work. However, your model will then be compilable and will be able to run with the highest performance available.
Good Luck, Jan
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Target Computer Setup についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!