MATLAB Answers

How can I run a Simulink model with a C S-Function on a Simulink Real-Time PC?

7 views (last 30 days)
Mikhail Katliar
Mikhail Katliar on 28 May 2018
Answered: Jon Lobo on 3 Jul 2018
I have a Simulink model with an S-Function Builder block in it. The S-Function Builder block defines a custom Outputs function and includes 2 extra C files which implement necessary functionality. I can successfully build the code for the Simulink Real-Time target, and it gets deployed on the Simulink Real-Time PC. However, after deployment, I see the following message in red in the bottom-right corner of the Real-Time PC screen:
To run the generated code outside the MATLAB environment, use the packNGo function.
I can build a .zip-file with the packNGo function, however I have no idea what to do with it and how to deploy it on the Real-Time PC.
How can I run a model with some custom C code on a Simulink Real-Time PC?
The build log and the project files are attached.

  0 Comments

Sign in to comment.

Answers (1)

Jon Lobo
Jon Lobo on 3 Jul 2018
Hi Mikhail,
I took a look at your example. It looks like you did everything right. The only issue is that you are using the UDP Send block from the DSP Systems Toolbox. This is not supported in Simulink Real-Time.
I was able to find this by using SimulinkRealTime.utils.getConsoleLog to see the line above "To Run the generated code outside the MATLAB environment...". The line above reads "Error: Could not open library: networkdevice.dll'.
Once I removed that block and used the UDP Send from Simulink Real-Time the application worked.

  0 Comments

Sign in to comment.


Translated by