MATLAB: How can you generate a C code with embedded coder from a simulink model with a cycle time/period (sample time) shorter than 1 ms

concurrent executionEmbedded Codermulticoremultitaskperiodsimulink codertrigger

I have a simple simulink model same as the example rtwdemo_concurrent_execution (MathWorks Model Concurrent Execution for Symmetric Multicore CPU Platforms). When I change the sample time and the period time of this model from 1 (original value in the sample model) to 0.0001 and try to build the model and creat a C-Code, simulink shows the following error:
How can I make a smaller "Period" time?

Best Answer

A tricky method : manually modify the tlc file( <MATLAB_ROOT>/rtw/c/tlc/mw/ertwinthread.tlc )
comment out lines 773-780 (as follow) from
773 %if ((period * 1000) < 1)
774 %if LibIsDeploymentDiagram()

775 %assign errormsg = "The periodic trigger %<LibGetTriggerName(ehIdx)> of model %<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the periodic trigger by increasing the rate in the model."

776 %else

777 %assign errormsg = "%<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the model."

778 %endif


779 %exit %<errormsg>

780 %endif
to this
773 /%%if ((period * 1000) < 1)
774 %if LibIsDeploymentDiagram()
775 %assign errormsg = "The periodic trigger %<LibGetTriggerName(ehIdx)> of model %<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the periodic trigger by increasing the rate in the model."
776 %else
777 %assign errormsg = "%<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the model."
778 %endif
779 %exit %<errormsg>
780 %endif%/
and the Code Generation process will skip the check of the time step greater than 1ms.