当前位置:网站首页>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 .
边栏推荐
- 张丽俊:穿透不确定性要靠四个“不变”
- Httprunnermanager installation (III) - configuring myql Database & initialization data under Linux
- C language - Blue Bridge Cup - promised score
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
- [unity3d] GUI control
- Spherical lens and cylindrical lens
- RobotFramework入门(三)WebUI自动化之百度搜索
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
- Yyds dry inventory comparison of several database storage engines
- Taobao focus map layout practice
猜你喜欢

Reset nodejs of the system

Network Security Learning - Web vulnerabilities (Part 1)

【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用

Microservice registration and discovery
![[Chongqing Guangdong education] higher mathematics I reference materials of Southwest Petroleum University](/img/0f/520242492524522c887b6576463566.jpg)
[Chongqing Guangdong education] higher mathematics I reference materials of Southwest Petroleum University

Shell script updates stored procedure to database
![[network security interview question] - how to penetrate the test file directory through](/img/48/be645442c8ff4cc5417c115963b217.jpg)
[network security interview question] - how to penetrate the test file directory through
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23](/img/72/a80ee7ee7b967b0afa6018070d03c9.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23

Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22](/img/e0/21367eeaeca10c0a2f2aab3a4fa1fb.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22
随机推荐
ReferenceError: primordials is not defined错误解决
C # create self host webservice
CobaltStrike-4.4-K8修改版安装使用教程
技术分享 | undo 太大了怎么办
MySQL winter vacation self-study 2022 11 (7)
微服务间通信
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21
[network security interview question] - how to penetrate the test file directory through
Fault analysis | analysis of an example of MySQL running out of host memory
RobotFramework入门(二)appUI自动化之app启动
Qt发布exe软件及修改exe应用程序图标
Universal crud interface
PMP practice once a day | don't get lost in the exam -7.5
Rust language -- iterators and closures
Spherical lens and cylindrical lens
一个复制也能玩出花来
Bigder: I felt good about the 34/100 interview, but I didn't receive the admission
建模规范:命名规范
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 16
有沒有sqlcdc監控多張錶 再關聯後 sink到另外一張錶的案例啊?全部在 mysql中操作