当前位置:网站首页>Modeling specifications: naming conventions
Modeling specifications: naming conventions
2022-07-06 02:49:00 【chhttty】
This paper studies MAAB Naming conventions in modeling specifications , At the same time, talk about the understanding of bloggers in combination with the actual work .
List of articles
1 Naming specification
Naming conventions are the first in MAAB Specification as defined in , It specifies the folder , Model , Variable , How should interfaces be named .
2 Naming convention content
2.1 The basic rule
1) In naming conventions , Modules can be 、 The characters used in the naming of signals can only be the following :
- The case of English letters :a-z, A-Z
- Arabic numerals :0-9
- Underline :_
2) besides , Can not be used for naming . For example, the following points must not be allowed :
- Chinese string cannot appear in path or module name , There may be an error parsing ;
- No spaces 、 A carriage return 、 Special characters such as brackets , for example JMAAB(Model).slx;
- The name must start with a letter , Cannot be numbers or underscores , for example 001_JMAABModel.slx;
- You cannot write two underscores consecutively , for example JMAAB__Model.slx;
3) String length cannot be too long , It should be less than 63;
2.2 Model Advisor Check the item
stay Matlab 2018a Of Model Advisor in , The following items can be checked on the file 、 Check the naming specification of interfaces :
Check ID | Description |
---|---|
ar_0001 | Check file names |
ar_0002 | Check folder names |
jc_0201 | Check subsystem names |
jc_0211 | Check port block names |
jc_0221 | Check character usage in signal labels |
jc_0231 | Check character usage in block names |
These check items are located in Model Advisor In the inspector :
2.3 Model Advisor Check examples
1) Create a new model , The modeling is as follows :
In the model above , There are two naming mistakes :
- 1 No. input port begins with an underscore ;
- The output signal line begins with a number ;
These two questions can be used Model Advisor Check it out .
2) Run... Above Model Advisor Check the item , The results are as follows :
Two of the inspection items on the left became Warning The exclamation mark of ,4 Article passed .
3) Click on one of them Warning, You can see exactly where the problem is in the model , And you can directly locate the past through hyperlinks ;
3 Enterprise naming conventions
It's all about MAAB Basic specification entries in the document , Very easy to understand . In the actual work of the enterprise , Based on this , Develop your own naming conventions . This can facilitate the understanding and communication of engineers . The following bloggers will give examples of how the company they have been in has done .
3.1 Detailed explanation of enterprise naming norms
1) Be good at using abbreviations of names , Shrink the model name to a few characters of fixed length , Such as below ;
In the figure , Vehicle speed control module VehicleSpeedControlModule Took four initials , Name the model VSCM.
2) For I / O interface , Information other than the meaning of the variable itself needs to be reflected ; For example, the data type is uint8 still uint16, In which module is the scope ;
For example, the speed is CAN Signal received , from CSDM Global variables output after module filtering ( use G Express Global), The physical unit is kmph( Km / h ), It can be named G_CSDM_kmph_VehSpd, Instead of directly naming it VehicleSpeed. This naming can be seen at a glance .
Variable type | Physical units | modular | describe | name |
---|---|---|---|---|
Global variables | kmph | CSDM | VehSpd | G_CSDM_kmph_VehSpd |
Quantitative standard | enum | / | GearPosition | P_enum_GearPos |
Macro definition | enum | / | ReverseGear | M_enum_ReverseGear |
Input interface | rpm | / | EngineSpeed | Get_rpm_EngineSpeed |
Output interface | Nm | / | EngineTorque | Set_Nm_EngineTorque |
In Africa Autosar In the application layer model of the architecture , Generally, the interface between models is made into global variables , The interface from the bottom layer to the application layer is Get_XXX() function , The interface from the application layer to the bottom layer is Set_XXX() function , The standard quantity or constant is done in Const Module . Based on these principles , You can formulate the naming standards of enterprises . Further more , You can also develop your own ModelAdvisor Check tools , Check whether the naming conventions in the model conform to the enterprise specifications .
3.2 Check naming conventions through scripts
MAAB Specifications can be passed Model Advisor Check , Customized naming conventions can also develop scripts by themselves , Publish to Model Advisor In the inspection item . Bloggers use a script to demonstrate how to check Constant Whether the module conforms to the standard quantity naming , Publish to Advisor The process can refer to other bloggers .
1) First , use find_system Function to search all in the model Const modular ;
% Find Constant modular
Const_Cell = find_system(gcs,'BlockType','Constant');
2) next , Loop through all arrays , Check by calling sub functions Constant Whether the value in the module is legal ;
% Cycle test Constant Value in module
for i = 1:length(Const_Cell)
Const_Path = Const_Cell{i};
Const_Value = get_param(Const_Path,'Value');
if(CheckName(Const_Value))
continue;
else
InvalidNameList{end+1} = Const_Path;
end
end
3) The called sub function determines whether the initial letter is P, And whether it contains two underscores ;
function IsValidName = CheckName(Value)
if(Value(1) ~= 'P') % Whether or not to P start
IsValidName = false;
elseif(length(strfind(Value,'_')) ~= 2) % Whether to include two underscores
IsValidName = false;
else
IsValidName = true;
end
end
Final , The whole script is as follows :
function InvalidNameList = CheckCaliName()
InvalidNameList = {};
% Find Constant modular
Const_Cell = find_system(gcs,'BlockType','Constant');
% Cycle test Constant Value in module
for i = 1:length(Const_Cell)
Const_Path = Const_Cell{i};
Const_Value = get_param(Const_Path,'Value');
if(CheckName(Const_Value))
continue;
else
InvalidNameList{end+1} = Const_Path;
end
end
end
function IsValidName = CheckName(Value)
if(Value(1) ~= 'P') % Whether or not to P start
IsValidName = false;
elseif(length(strfind(Value,'_')) ~= 2) % Whether to include two underscores
IsValidName = false;
else
IsValidName = true;
end
end
4 summary
This paper studies MAAB Naming conventions in modeling specifications , We should abide by MAAB And enterprise specifications , Name variables or signal names correctly .
边栏推荐
- [kubernetes series] learn the exposed application of kubernetes service security
- Is there a completely independent localization database technology
- C language - Blue Bridge Cup - promised score
- 07 singleton mode
- Introduction to robotframework (II) app startup of appui automation
- Software design principles
- DDoS "fire drill" service urges companies to be prepared
- 主数据管理理论与实践
- 力扣今日题-729. 我的日程安排表 I
- Redis cluster deployment based on redis5
猜你喜欢
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
Solution: attributeerror: 'STR' object has no attribute 'decode‘
1. Dynamic parameters of function: *args, **kwargs
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
Referenceerror: primordials is not defined error resolution
Blue Bridge Cup group B provincial preliminaries first question 2013 (Gauss Diary)
【若依(ruoyi)】设置主题样式
RobotFramework入门(三)WebUI自动化之百度搜索
How to accurately identify master data?
纯Qt版中国象棋:实现双人对战、人机对战及网络对战
随机推荐
Apt installation ZABBIX
Self made CA certificate and SSL certificate using OpenSSL
Data preparation
技术分享 | undo 太大了怎么办
米家、涂鸦、Hilink、智汀等生态哪家强?5大主流智能品牌分析
建模规范:命名规范
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
微软语音合成助手 v1.3 文本转语音工具,真实语音AI生成器
Microservice registration and discovery
C language - Blue Bridge Cup - promised score
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
Qt发布exe软件及修改exe应用程序图标
codeforces每日5题(均1700)-第六天
解决:AttributeError: ‘str‘ object has no attribute ‘decode‘
【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
2.12 simulation
微服务间通信
2022.02.13
【指针训练——八道题】