当前位置:网站首页>2837xd 代码生成——总结篇
2837xd 代码生成——总结篇
2022-07-02 06:35:00 【Quikk】
2837xd 代码生成——总结篇
代码生成是一个很庞大的体制,花了好久大致理清楚了调理。本文也会就之前没有提到的Simulink Coder进行实测解释用法。
1 代码生成的产生
代码生成技术的产生是近年来,不断流行的MBD(model basic design)进行催生演化出来的重要的环节。目前越来越多的算法需要通过CAE进行分析,然后开发产品。如何能够快速将设计的model转变成产品成为了软件工程师攻克的主要方向之一,如果能够从模型直接生成代码会减少很多不必要的人力和物力对底层的重复开发。
2 代码生成流程
代码生成技术在现阶段主要分程:1)需求分析 2)模型设计 3)仿真验证 4)转换为产品
需求分析这里不做详细解释,不是现阶段的研究重点。
模型设计主要是根据需求进行建模,仿真和验证算法是否符合需求。
仿真验证主要分为SIL(软件在环)、PIL(处理器在环)、HIL(硬件在环)三大块进行测试。
1)SIL主要负责验证model仿真和生成的代码运算结果在PC端进行验证是否结果一致。
2)PIL是指将生成的代码烧写到处理器设备(DSP、ARM等),然后将运算结果进行回传到PC端,PC端将其运算结果和model的仿真结果进行对比检验是否有误差。
3)HIL是利用更加复杂的外部硬件,进行模拟被控制对象。控制器使用DSP或ARM烧录好程序。观测外部硬件是否能够达到期望效果。这一步完成后,证明所设计的控制器能够较好的完成控制任务。下一步就能上实物平台进行实物实验了。
3 代码生成的一点补充
详细的代码生成已经在前面的文章进行了摸索式前进。还有一块内容是Simulink提供了官方的库Simulink Coder进行兼容添加自己的已经写好的文件。这一方面可以很好的提供某些模块没有涉及到的功能进行代码使用,同时可以进行兼容已经是验证过的c语言算法。
Simulink Coder库中有一个Custom Code,其中包含若个库文件:

这里摘录一段官方文档的表格:官方链接

其中主要我感觉有实际作用的是,下面做了测试发现:
1)System Initialize:不管是模块内部还是顶层模块上的System Initialize模块。都只在系统初始化函数中执行一次。
2)Model Source:会在生成的.c文件的对应部位加入所写的代码,一般是函数的声明与实现部分。
3)Model Header:会在生成的.h文件的对应部位加入所写的代码,一般是函数的定义、数据类型的定义。
4)System Updata与System Output:都会在步长函数中每个步长都会执行,Output中代码段会先于Updata进行执行。放在哪个模块就会在哪个模块的函数部分进行执行。Ouput的header和body都会在该子模块的最开始加入代码,即先于模块执行,Output的bottom会在该子模块的结尾加入代码,即执行完模块后执行。而Updata模块会在子模块内容都执行完毕之后(包括Output的bottom执行完毕)分别执行header、body、bottom处的代码。
5)System Start与System Enable: System Start会在初始化函数的开头加入代码,不管放置在哪都只执行一次。System Enable初始化函数的结尾处加入代码,不管放置在哪都只执行一次。
边栏推荐
- Activity的创建和跳转
- Solutions to Chinese garbled code in CMD window
- 微服务实战|声明式服务调用OpenFeign实践
- What is the function of laravel facade
- Alibaba / popular JSON parsing open source project fastjson2
- Mysql 多列IN操作
- Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method
- 知识点很细(代码有注释)数构(C语言)——第三章、栈和队列
- C语言之二进制与十进制
- Knife4j 2. Solution to the problem of file control without selection when uploading x version files
猜你喜欢

How to use PHP spoole to implement millisecond scheduled tasks

深入剖析JVM是如何执行Hello World的

Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)

Solutions to Chinese garbled code in CMD window

MySQL事务

Beats (filebeat, metricbeat), kibana, logstack tutorial of elastic stack

Chrome视频下载插件–Video Downloader for Chrome

Microservice practice | Eureka registration center and cluster construction

Watermelon book -- Chapter 6 Support vector machine (SVM)

Matplotlib swordsman line - first acquaintance with Matplotlib
随机推荐
微服务实战|原生态实现服务的发现与调用
Chrome video download Plug-in – video downloader for Chrome
自定義Redis連接池
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
Thinkphp5 how to determine whether a table exists
Amq6126 problem solving ideas
What are the waiting methods of selenium
Read Day5 30 minutes before going to bed every day_ All key values in the map, how to obtain all value values
How to install PHP in CentOS
Double non undergraduate students enter the factory, while I am still quietly climbing trees at the bottom (Part 1)
每天睡前30分钟阅读Day5_Map中全部Key值,全部Value值获取方式
别找了,Chrome浏览器必装插件都在这了
在SQL注入中,为什么union联合查询,id必须等于0
Solutions to Chinese garbled code in CMD window
Insight into cloud native | microservices and microservice architecture
西瓜书--第五章.神经网络
破茧|一文说透什么是真正的云原生
Bold prediction: it will become the core player of 5g
Timed thread pool implements request merging
分享一篇博客(水一篇博客)