I am working with Opal-RT (with Matlab R2011a) to implement a Microgrid controller using a S-function in C language. The simulation works very well in Simulink environment, where I am using .mexw32 for compilation. However, the following error apears when I try to build the model into the target (i.e. Opal RT):
ntox86-g++-3.3.5: sfunc_teste2.o: No such file or directory
The name of the .c file that my S-function calls is sfunc_teste2.c . The full error is in the attached file. It seems that Opal-RT cannot find the .c files, even though they are in the same directory of all my project file. How can I send all dependant .c/.h of my S-function to Opal-RT? Is it possible to use S-function without using .tlc files in Opal-RT?

 채택된 답변

Clay Walker
Clay Walker 2019년 9월 12일

2 개 추천

From my experience, if the model simulates correctly in Simulink, then it is usually an RT-Lab issue.
When you compile the model on the target, you need to move all required .c/.h files to the target prior to compilation. The way to do this is by opening the model in RT-Lab, opening the "Files" tab, click Add, then add your sfunc_teste2.c file. Make sure its "Before compilation".
RT-LAB_model_files_tab.png

댓글 수: 3

Thank you for your answer. I followed your instructions and I achieved to compile the project with sucess.
I have another issue. I would like to use external libraries. To be more specific, I would like to add the library CPLEX and Eigen. Do you know how to add an external library into OPAL-RT? Is it in the same way?
I don't have any experience with that, but in theory it should be similar. Your first step would be to get it working on your desktop using S-functions. Then you should be able to install the library to the target PC. One thing to note is, at least for us, the target is a linux computer so the library will need to have a linux binary. I wish I could help you more, but I haven't really used external libraries like these.
Thank you so much for your answer Clay! It helped me compile my model.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

릴리스

R2011a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by