Clear Filters
Clear Filters

Pragmas in SIL simulation

3 views (last 30 days)
Thomas Becker
Thomas Becker on 13 Feb 2018
Answered: Thomas Becker on 25 Jun 2018
Hello,
we have to insert pragmas for adaptive values and parameters; that works well and the generated code looks fine.
But what's with SIL simulation using a Model (reference) block? How are pragmas treated during compiling for host PC simulation?
Or is it always necessary to encapusulate our pragmas in #ifndef / #ifdef directives?
Thanks a lot, Thomas

Answers (2)

shou wang
shou wang on 25 Jun 2018
I am doing the same thing,I do not know howto do.

Thomas Becker
Thomas Becker on 25 Jun 2018
Hi,
in the meantime I've got a friendly answer from MathWorks support:
"In general, SIL and PIL modes try to closely emulate the deployed behavior of the code. As a result, there are no specific mechanisms to ignore directives for this mode as there would be for other simulation modes. While you may use the "coder.target" function to distinguish behavior for other code generation targets, this is not the case for SIL. As such, to ensure that the pragmas are ignored for this simulation mode, the most direct way would be to utilize the conditional macros (#ifdef TARGET_DIAB_COMPILER) as you described."

Community Treasure Hunt

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

Start Hunting!