Sil - mil compare for simulink model
조회 수: 14 (최근 30일)
이전 댓글 표시
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
채택된 답변
Andy Bartlett
2015년 4월 2일
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
Phani Teja
2019년 4월 30일
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.
추가 답변 (3개)
Jason Moore
2015년 2월 6일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Test Model Components에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!