MATLAB Answers

0

How to adapt C-language S-function to Opal-RT?

Asked by Daniela Yamashita on 20 Aug 2019 at 18:20
Latest activity Answered by Clay Walker on 12 Sep 2019 at 0:41
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?

  0 Comments

Sign in to comment.

Products


Release

R2011a

1 Answer

Answer by Clay Walker on 12 Sep 2019 at 0:41

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

  0 Comments

Sign in to comment.