当前位置:网站首页>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 .
边栏推荐
- C language - Blue Bridge Cup - promised score
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14
- 米家、涂鸦、Hilink、智汀等生态哪家强?5大主流智能品牌分析
- Looking at the trend of sequence modeling of recommended systems in 2022 from the top paper
- Thinking on Architecture Design (under continuous updating)
- Accident index statistics
- A doctor's 22 years in Huawei
- Installation and use tutorial of cobaltstrike-4.4-k8 modified version
- 1. Dynamic parameters of function: *args, **kwargs
- Taobao focus map layout practice
猜你喜欢
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
CobaltStrike-4.4-K8修改版安装使用教程
[Chongqing Guangdong education] higher mathematics I reference materials of Southwest Petroleum University
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
建模规范:命名规范
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 19
Pure QT version of Chinese chess: realize two-man, man-machine and network games
[Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
淘宝焦点图布局实战
随机推荐
力扣今日題-729. 我的日程安排錶 I
Bigder: I felt good about the 34/100 interview, but I didn't receive the admission
2345文件粉碎,文件强力删除工具无捆绑纯净提取版
主数据管理理论与实践
Yyds dry inventory comparison of several database storage engines
07 单件(Singleton)模式
4. File modification
Communication between microservices
Redis skip table
C language - Blue Bridge Cup - promised score
Looking at the trend of sequence modeling of recommended systems in 2022 from the top paper
ReferenceError: primordials is not defined错误解决
【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
Prototype design
2345 file shredding, powerful file deletion tool, unbound pure extract version
Apt installation ZABBIX
【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
Is there a completely independent localization database technology
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21
Microservice registration and discovery