优雅论坛 >
如何优雅地搭建Simulink模型?
回复

查看: 回复:0

提问帖

如何优雅地搭建Simulink模型?

[待解决] \"收藏此主题\"

李文超123

 
 
注册:
2008-03-19
  • 0粉丝
  • 0精华
  • 634帖子
2017/1/9 更新
新版本的JMAAB对于模型架构的规定更加详细,建议阅读。
==============================================================
先看看MAAB建模规范,对于模型的层次划分、信号与模块的使用方式均有说明,对于MAAB的介绍可见Industry Standards,里面有下载链接。有兴趣的可以自己下下来看,总共136页。这个文档我打印了好几次,总是迷之遗失,然后我再打一份放在手头备用。(另一个类似的文档是SAE J670:汽车动力学术语) 
dSPACE也有一份规范叫dSPACE Modeling Guidelines 3.0,如果要用TargetLink,还是应该参考一下。
==============================================================
以下简单的说明MAAB建议相关企业强制使用的模型架构:
依据是否存在触发层,将模型架构分为TypeA和TypeB两类,主要包括顶层、触发层、结构层和数据流层顶层规定模型总体的输入输出(相当于模型的对外接口,也是在自动代码生成后与底层软件聚集成的借口),建议通过注释对实现的功能进行描述触发层通过触发子系统或函数调用子系统说明调用时序结构层说明子模块之间的关系,注意,这一层中的子模块必须是原子子系统
数据流层:这一层才是具体的计算,包括加减乘除之类的。==============================================================其他与模型可读性相关的一些规范
7.1.3. db_0042: Port block in Simulink models
In a Simulink model, the ports comply with the following rules:
? Inports should be placed on the left side of the diagram, but they can be
moved in to prevent signal crossings.
? Outports should be placed on the right side, but they can be moved in to
prevent signal crossings.
? Duplicate Inports can be used at the subsystem level if required, but should
be avoided, if possible.
o Do not use duplicate Inports at the root level.
Notes on the incorrect model
? Inport 2 should be moved in so it does not cross the feed back loop lines.
? Outport 1 should be moved to the right hand side of the diagram.


7.1.12. db_0141: Signal flow in Simulink models
? Signal flow in a model is from left to right.
? Exception: Feedback loops
? Sequential blocks or subsystems are arranged from left to right.
? Exception: Feedback loops
? Parallel blocks or subsystems are arranged from top to bottom.
7.1.13. jc_0171: Maintaining signal flow when using Goto and From blocks
Visual depiction of signal flow must be maintained between subsystems.
? Use of Goto and From blocks is allowed if:
? At least one signal line is used between connected subsystems.
? Subsystems connected in a feed-forward and feedback loop have at
least one signal line for each direction.
? Using Goto and From blocks to create buses or connect inputs to merge blocks
are exceptions to this rule.

==============================================================
懒得粘了,Mathworks公司又不给我发工资,再加几个图示意一下就完事了
if-else架构

Switch架构:

模型初始化

子系统的方向
Incorrect
if-else flow实现
 
回复本楼

太平洋汽车全新推出“太平洋车友会”;来太平洋车友会,结识志同道合的车友了解详情>>

未登录用户

只可添加一张图片,多张图片请选高级模式

高级模式
温馨提示:回复超10字可获1金币,有独特见解超30字可获3金币,灌水用户将扣除金币并锁号处理。希望广大车友共同维护论坛的友好回复氛围。
常用表情
您可能感兴趣

支付宝扫码询价
领最高888元现金红包

关闭