coder.asap2.Group
Description
Create a group object to view characteristics and measurements together and export it to an ASAP2 file.
Creation
creates a group
object. You can use the object to define list of characteristic, measurements, subgroups to
the group and export it to an ASAP2 file.groupObj
= coder.asap2.Group
Properties
Name
— Group name
character vector | string scalar
Specify a name for the custom group.
Example:
"CustomGroup_1"
LongIdentifier
— Group description
character vector | string scalar
Specify comments and description of the group.
Example:
"Description of the group"
RefCharacteristic
— Array of characteristics
array of parameter names
Specify the list of parameters referred in the group.
Example:
["Parameter1", "Parameter2"]
RefMeasurement
— Array of measurements
array of signal names
Specify the list of signals referred in the group.
Example:
["Signal1", "Signal2"]
Root
— Group hierarchy
true | false
Specifies the root of the group's hierarchy.
Example:
1
SubGroup
— Array of groups
array of group names
Specify the list of sub groups referred in the group.
Example:
["Subgroup1", "Subgroup2"]
CustomData
— Additional description
character vector | string scalar
Specify any additional description that needs to be populated in the group.
Example:
"additional information"
Examples
Create and Add Custom Group
Add, update, filter, find, and remove ECU descriptions for groups in an ASAP2 file.
Open and Build Example Model
Open the example model ASAP2Demo
open_system("ASAP2Demo");
Build the model.
slbuild("ASAP2Demo");
### Searching for referenced models in model 'ASAP2Demo'. ### Found 1 model reference targets to update. ### Starting serial model reference code generation build. ### Successfully updated the model reference code generation target for: ASAP2DemoModelRef ### Starting build procedure for: ASAP2Demo ### Successful completion of build procedure for: ASAP2Demo Build Summary Model reference code generation targets: Model Build Reason Status Build Duration ============================================================================================================ ASAP2DemoModelRef Target (ASAP2DemoModelRef.c) did not exist. Code generated and compiled. 0h 0m 7.9136s Top model targets: Model Build Reason Status Build Duration ============================================================================================================ ASAP2Demo Information cache folder or artifacts were missing. Code generated and compiled. 0h 0m 16.702s 2 of 2 models built (0 models already up to date) Build duration: 0h 0m 26.501s
Create the ECU description object for the model.
descObj = coder.asap2.getEcuDescriptions("ASAP2Demo");
Get the list of available groups in the description object.
find(descObj,"Group")
ans = 1x2 string
"ASAP2Demo" "ASAP2Demo_ASAP2DemoModelRef_ASAP2DemoModelRef"
Filter the groups and get a list of groups that has Root
set to true
.
find(descObj,"Group",Root=true)
ans = "ASAP2Demo"
Create and Add Custom Group
To add a new group to the ASAP2 file, create a custom group.
GroupObj_GR1 = coder.asap2.Group; GroupObj_GR1.Name = 'CustomGroup_1'; GroupObj_GR1.LongIdentifier = 'New test group'; GroupObj_GR1.RefCharacteristic = ["ydata3", "ydata4"]; GroupObj_GR1.RefMeasurement = ["ASAP2Demo_Y.Out3", "ASAP2Demo_Y.Out3"]; GroupObj_GR1.Root = true;
Add the custom group to the ECU description object.
add(descObj,GroupObj_GR1);
Get Group Properties
Get the properties of newly added group by using this command.
get(descObj,"Group","CustomGroup_1")
ans = Group with properties: Name: 'CustomGroup_1' LongIdentifier: 'New test group' RefCharacteristic: ["ydata3" "ydata4"] RefMeasurement: ["ASAP2Demo_Y.Out3" "ASAP2Demo_Y.Out3"] Root: 1 SubGroup: [1x0 string] CustomData: [1x0 string]
Update Group Properties
To modify a property of the group, use set function. Update the LongIdentifier field of the group.
set(descObj,"Group","CustomGroup_1",LongIdentifier="Group 1 new long identifier")
Generate the ASAP2 file using the updated ECU description object and verify that the ASAP2 file contains the group CustomGroup_1.
coder.asap2.export("ASAP2Demo",CustomEcuDescriptions=descObj);
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
Delete Group
Remove the newly added group from the description object.
delete(descObj,"Group","CustomGroup_1");
Version History
Introduced in R2023b
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)