How to Write Custom Simulink Data Type Rules in MATLAB
Simulink models often begin life using purely double-precision data. As the fidelity of the model increases to include specifications of the embedded system it will be deployed on, more floating-point and fixed-point data types are often needed. Manually specifying all these data types for optimal numerical performance and system efficiency while continuing to evolve the design is time consuming and error prone.
Data type automation aims to reduce this cost. You can save time, reduce effort, apply policies, and maintain correctness by adding rules to the model to ensure data types match across signals. Construct signals with the right properties so they produce errors when your rules are violated.
This document explains how you can write your own data type rules as MATLAB functions and integrate them into your Simulink model’s data type propagation process.
Writing your own rule is the highest level of customization and requires the most expertise and resources. There are a few simpler alternatives you should consider first. Simpler out-of-the-box methods may be more compatible with the entire MathWorks tool chain (such as verification and validation products), while highly customized methods may not be completely understood by such tools.
This document describes solutions for automating data type rules in order of increasing complexity. The first section contains simple and widely capable methods. The second contains advanced techniques requiring a greater level of investment.
1. Simple techniques
a. Back-propagation
b. The Data Type Duplicate block
c. The Signal Specification block
2. More sophisticated and custom techniques
a. The Data Type Propagation block
b. Mask-controlled data type rules
c. MATLAB-authored custom data type rules
The licenses required for the demonstration models in this document are Simulink and Fixed-Point Designer. The models were tested with R2018a and may work with some earlier releases as well.
引用格式
Alexander Carmeli (2024). How to Write Custom Simulink Data Type Rules in MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/67888-how-to-write-custom-simulink-data-type-rules-in-matlab), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
- Code Generation > Embedded Coder > Architecture and Component Design > Standards, Guidelines, and Block Usage >
- FPGA, ASIC, and SoC Development >
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!R2018a models/
R2018a models/
版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |