当前位置:网站首页>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 .
边栏推荐
- Communication between microservices
- Rust language -- iterators and closures
- 07 单件(Singleton)模式
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
- 微服务间通信
- CSP numeric sort
- Reverse repackaging of wechat applet
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
- 淘宝焦点图布局实战
猜你喜欢
微软语音合成助手 v1.3 文本转语音工具,真实语音AI生成器
Shell script updates stored procedure to database
力扣今日题-729. 我的日程安排表 I
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22
Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
[network security interview question] - how to penetrate the test file directory through
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14
High number_ Vector algebra_ Unit vector_ Angle between vector and coordinate axis
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
微服务注册与发现
随机推荐
Pat 1046 shortest distance (20 points) simulation
Single instance mode of encapsulating PDO with PHP in spare time
How to read excel, PDF and JSON files in R language?
[unity3d] GUI control
What should we pay attention to when using the built-in tool to check the health status in gbase 8C database?
微服务间通信
1. Dynamic parameters of function: *args, **kwargs
[ruoyi] enable Mini navigation bar
Httprunnermanager installation (III) - configuring myql Database & initialization data under Linux
MySQL winter vacation self-study 2022 11 (5)
[Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
Differences and usage scenarios between TCP and UDP
球面透镜与柱面透镜
原型图设计
Solution: attributeerror: 'STR' object has no attribute 'decode‘
Is there a completely independent localization database technology
Apt installation ZABBIX
Spherical lens and cylindrical lens
Rust language -- iterators and closures
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.3 linear algebra_ Learning thinking and exercise answers