How to adapt C-language S-function to Opal-RT?
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Daniela Yamashita
el 20 de Ag. de 2019
Comentada: Jesus Alejandro Verduzco
el 1 de Abr. de 2021
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 comentarios
Respuesta aceptada
Clay Walker
el 12 de Sept. de 2019
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".
3 comentarios
Clay Walker
el 19 de Sept. de 2019
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.
Jesus Alejandro Verduzco
el 1 de Abr. de 2021
Thank you so much for your answer Clay! It helped me compile my model.
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!