Pragmas in SIL simulation

3 次查看(过去 30 天)
Thomas Becker
Thomas Becker 2018-2-13
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

回答(2 个)

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

Thomas Becker
Thomas Becker 2018-6-25
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!

Translated by