当前位置:网站首页>2837xd code generation - Summary
2837xd code generation - Summary
2022-07-02 09:37:00 【Quikk】
2837xd Code generation —— Conclusion
Code generation is a huge system , It took a long time to sort out the conditioning . This article will also focus on what was not mentioned before Simulink Coder Conduct actual measurement and explain usage .
1 Code generation
The emergence of code generation technology is in recent years , Increasingly popular MBD(model basic design) It is an important part of birth and evolution . At present, more and more algorithms need to pass CAE Analyze , Then develop products . How to quickly design model Transforming into products has become one of the main directions for software engineers , If you can generate code directly from the model, you will reduce a lot of unnecessary human and material resources to the repeated development of the bottom .
2 Code generation process
At this stage, code generation technology is mainly divided into stages :1) Demand analysis 2) Model design 3) Simulation verification 4) Convert to product
Demand analysis is not explained in detail here , It is not the focus of research at this stage .
Model design is mainly based on demand modeling , Simulate and verify whether the algorithm meets the requirements .
Simulation verification is mainly divided into SIL( Software in the loop )、PIL( Processor in loop )、HIL( Hardware in the loop ) Three blocks are tested .
1)SIL Mainly responsible for verifying model The simulation and generated code operation results are in PC Verify whether the results are consistent .
2)PIL It refers to burning the generated code to the processor device (DSP、ARM etc. ), Then the operation result is returned to PC End ,PC The end combines its operation result with model The simulation results are compared to check whether there is error .
3)HIL Is to utilize more complex external hardware , Simulate the controlled object . Controller use DSP or ARM Burn the program . Observe whether the external hardware can achieve the desired effect . After this step is completed , It is proved that the designed controller can better complete the control task . The next step is to go to the physical platform for physical experiments .
3 A little supplement to code generation
Detailed code generation has been groping forward in the previous article . Another piece of content is Simulink Provides the official library Simulink Coder Add your own written files for compatibility . On the one hand, it can provide functions that are not involved in some modules for code use , At the same time, compatibility has been verified c Language algorithms .
Simulink Coder There is one in the library Custom Code, It contains several library files :

Here is a table excerpted from an official document : The official link

The main thing that I feel has practical effect is , The following test findings :
1)System Initialize: Whether inside the module or on the top module System Initialize modular . It is only executed once in the system initialization function .
2)Model Source: Will be generated in .c Add the written code to the corresponding part of the document , Generally, it is the declaration and implementation of functions .
3)Model Header: Will be generated in .h Add the written code to the corresponding part of the document , Generally, it is the definition of function 、 Definition of data type .
4)System Updata And System Output: In the step function, each step will be executed ,Output The code segment in will precede Updata To perform . The function part of which module will be executed in which module .Ouput Of header and body Will add code at the beginning of the sub module , That is, execute before the module ,Output Of bottom Code will be added at the end of the sub module , That is, execute after executing the module . and Updata The module will execute all the sub module contents ( Include Output Of bottom completion of enforcement ) Separately header、body、bottom Code at .
5)System Start And System Enable: System Start Code will be added at the beginning of the initialization function , No matter where it is placed, it is only executed once .System Enable Add code at the end of the initialization function , No matter where it is placed, it is only executed once .
边栏推荐
猜你喜欢

西瓜书--第六章.支持向量机(SVM)

Mysql默认事务隔离级别及行锁

2837xd 代码生成——总结篇

Bold prediction: it will become the core player of 5g

Chrome浏览器标签管理插件–OneTab

Matplotlib swordsman - a stylist who can draw without tools and code

Idea view bytecode configuration
![[go practical basis] how to verify request parameters in gin](/img/de/50db131d6993e5d955e3416c667c4c.png)
[go practical basis] how to verify request parameters in gin

Chrome浏览器插件-Fatkun安装和介绍

Chrome browser plug-in fatkun installation and introduction
随机推荐
Enterprise level SaaS CRM implementation
BugkuCTF-web16(备份是个好习惯)
Attributes of classfile
Microservice practice | fuse hytrix initial experience
c语言编程题
JDBC review
Chrome浏览器插件-Fatkun安装和介绍
Hystrix implements request consolidation
View the port of the application published by was
告别996,IDEA中必装插件有哪些?
分布式锁的这三种实现方式,如何在效率和正确性之间选择?
Knife4j 2.X版本文件上传无选择文件控件问题解决
在SQL注入中,为什么union联合查询,id必须等于0
cmake的命令-官方文档
保存视频 opencv::VideoWriter
VIM操作命令大全
破茧|一文说透什么是真正的云原生
ClassFile - Attributes - Code
Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer
Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)