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?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (1)
Krishna Zanwar
le 25 Fév 2019
1 vote
The "base rate smaller than 1 ms" error message appears when the code generation target is set to GRT (Generic Real-Time) or ERT (Embedded Real-Time) in response to a Windows threading bug- when the base rate of the model is very fast, the timer in the generated code will not be able to issue an interrupt, and the generated executable will hang.
Since this issue only applies to GRT, ERT, and IDELINK targets, you should still be able to build an executable using SLRT. To change your model to use the SLRT target, please use the following steps:
1. Open the Configuration Parameters window in your model.
2. Select 'Code Generation' on the left, then for the 'System target file' parameter, click the 'Browse...' button.
3. In the pop-up that appears, select 'slrt.tlc (Simulink Real-Time)' and click OK.
4. Repeat steps 1-3 for each of the referenced models you are using.
After following these steps, your model will be set up to build for the SLRT target. Please note that for SLRT, you can only have one periodic trigger, so you will need to edit the concurrent execution options for your model to use one instead of two.
2 commentaires
shi chen
le 21 Mar 2019
The code generated by slrt is not complete, there is no main function?
Qing Liu
le 3 Déc 2019
It does not make any sense to demand time step size bigger than 1ms. For many high-performance embeded system and RTOS, the minimum time step can be much smaller than 1ms.
Catégories
En savoir plus sur Deployment, Integration, and Supported Hardware dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!