Sil - mil compare for simulink model
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Giuseppe Rocca
il 30 Gen 2015
Commentato: Phani Teja
il 30 Apr 2019
Dear Sir or Madam, I would like to compare sil and mil trace on the same simulink model using Embedded Coder. So I want to simulate first the model with double precision and then with the fixed precision that I have choosen without update, at ever modification, two different modules. I have worked in Magneti Marelli where Target Link is used and this modality is possible. Can I do the same with Real Time Workshop? Best regards, Giuseppe
0 Commenti
Risposta accettata
Andy Bartlett
il 2 Apr 2015
Hi Giuseppe,
Allowing the idealized floating point behavior to be compared with fixed-point behavior is a key feature of Fixed-Point Designer.
Fixed-Point Designer makes this easy using a feature called Data Type Override. Data Type Override allows all the data types under a model (or under a subsystem) to be changed to Doubles or Singles.
When Data Type Override is ON, ALL model actions will use the overridden types instead of the originally specified types. This allows the FULL capabilities of Model Based Design tools to be applied to the idealized (floating point doubles) version of the model. Data Type Override applies to all simulation modes including: Normal, Accelerator, ..., SIL, PIL, and external. Data Type Override also applies to code generation and to verification. The independence of Data Type Override from other actions on a model provides many capabilities. For example, Simulink Design Verifier can be used to analyze both the original fixed-point model and the idealized double model simply by switching Data Type Override off or on.
TargetLink has a different design where the data types used are tied to the simulation mode. Roughly speaking, in TargetLink, MIL mode means simulation with doubles while SIL mode or PIL mode means simulation in fixed-point.
If you are a former TargetLink user, it is good to clarify how the terms MIL, SIL, and PIL map to Simulink and Embedded Coder. The term MIL is not meaningful for Simulink or Embedded Coder. In Embedded Coder, SIL and PIL are designed to provide easy and efficient code verification. Embedded Coder does not tie data type selection to SIL and PIL. Simulink provides the flexibility to use fixed-point data types in any model action or overrride those types to double in any model action.
To turn Data Type Over on, use the command line or the Fixed-Point Tool. Command line set_param(bdroot,'DataTypeOverride','Double') % ON set_param(bdroot,'DataTypeOverride','UseLocalSettings') % OFF
Or for graphical interface
1) From you model's Analysis menu open Fixed-Point Tool (FPT)
2) In the tree on the left side of FPT, make sure the model node is selected.
3) In the right side of FPT in bounding box labelled 'Settings for selected system' set Data Type Override to Double for ON or Use local settings for off.
4) Click apply button.
5) Hint: look back at FPT's tree. If you see (dbl) next to the model's name, then Data Type Override is ON and set to Double.
The following video shows data type override used to improve the choice of fixed-point types.
Best Regards
Andy Bartlett
1 Commento
Phani Teja
il 30 Apr 2019
Thank you for your answer Andy :)
I would like to add one more point to your answer to get the same behaviour of simulink with respect to the Targetlink debugging method.
In Targetlink we have Sink block to store the MIL and SIL results for different simulations , Similar to that we can use Simulink data inspector with Data type override feature(Fixed point tool) to store the simulations , Comparisons for effective debugging process.
Più risposte (3)
Jason Moore
il 6 Feb 2015
Yes, it is a common workflow in Simulink to compare simulation runs in MIL against a SIL run. To accomplish this one of the best methods is to use Simulink Data Inspector . One method to do this is use a model reference with a test harness and then switch the simulation mode for the model reference into Software in the Loop mode. Then when you run the simulation, code will be built into an executable file and run. The results will show up in Simulink Data Inspector and you can then compare the various simulation runs.
0 Commenti
Vedere anche
Categorie
Scopri di più su Test Model Components in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!