powertrain-build 1.13.1__py3-none-any.whl → 1.13.3.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- powertrain_build/__init__.py +40 -40
- powertrain_build/__main__.py +6 -6
- powertrain_build/a2l.py +582 -582
- powertrain_build/a2l_merge.py +650 -650
- powertrain_build/a2l_templates.py +717 -717
- powertrain_build/build.py +985 -985
- powertrain_build/build_defs.py +309 -309
- powertrain_build/build_proj_config.py +690 -690
- powertrain_build/check_interface.py +575 -575
- powertrain_build/cli.py +141 -141
- powertrain_build/config.py +542 -542
- powertrain_build/core.py +395 -395
- powertrain_build/core_dummy.py +343 -343
- powertrain_build/create_conversion_table.py +73 -73
- powertrain_build/dids.py +916 -916
- powertrain_build/dummy.py +157 -157
- powertrain_build/dummy_spm.py +252 -252
- powertrain_build/environmentcheck.py +52 -52
- powertrain_build/ext_dbg.py +255 -255
- powertrain_build/ext_var.py +327 -327
- powertrain_build/feature_configs.py +301 -301
- powertrain_build/gen_allsysteminfo.py +227 -227
- powertrain_build/gen_label_split.py +449 -449
- powertrain_build/handcode_replacer.py +124 -124
- powertrain_build/html_report.py +133 -133
- powertrain_build/interface/__init__.py +4 -4
- powertrain_build/interface/application.py +511 -511
- powertrain_build/interface/base.py +500 -500
- powertrain_build/interface/csp_api.py +490 -490
- powertrain_build/interface/device_proxy.py +677 -677
- powertrain_build/interface/ems.py +67 -67
- powertrain_build/interface/export_global_vars.py +121 -121
- powertrain_build/interface/generate_adapters.py +132 -132
- powertrain_build/interface/generate_hi_interface.py +87 -87
- powertrain_build/interface/generate_service.py +69 -69
- powertrain_build/interface/generate_wrappers.py +147 -147
- powertrain_build/interface/generation_utils.py +142 -142
- powertrain_build/interface/hal.py +194 -194
- powertrain_build/interface/model_yaml_verification.py +348 -348
- powertrain_build/interface/service.py +296 -296
- powertrain_build/interface/simulink.py +249 -249
- powertrain_build/interface/update_call_sources.py +180 -180
- powertrain_build/interface/update_model_yaml.py +186 -186
- powertrain_build/interface/zone_controller.py +362 -362
- powertrain_build/lib/__init__.py +4 -4
- powertrain_build/lib/helper_functions.py +127 -127
- powertrain_build/lib/logger.py +55 -55
- powertrain_build/matlab_scripts/CodeGen/BuildAutomationPyBuild.m +78 -78
- powertrain_build/matlab_scripts/CodeGen/Generate_A2L.m +154 -154
- powertrain_build/matlab_scripts/CodeGen/generateTLUnit.m +239 -239
- powertrain_build/matlab_scripts/CodeGen/getAsilClassification.m +28 -28
- powertrain_build/matlab_scripts/CodeGen/modelConfiguredForTL.m +28 -28
- powertrain_build/matlab_scripts/CodeGen/moveDefOutports.m +88 -88
- powertrain_build/matlab_scripts/CodeGen/parseCalMeasData.m +410 -410
- powertrain_build/matlab_scripts/CodeGen/parseCoreIdentifiers.m +139 -139
- powertrain_build/matlab_scripts/CodeGen/parseDIDs.m +141 -141
- powertrain_build/matlab_scripts/CodeGen/parseInPorts.m +106 -106
- powertrain_build/matlab_scripts/CodeGen/parseIncludeConfigs.m +25 -25
- powertrain_build/matlab_scripts/CodeGen/parseModelInfo.m +38 -38
- powertrain_build/matlab_scripts/CodeGen/parseNVM.m +81 -81
- powertrain_build/matlab_scripts/CodeGen/parseOutPorts.m +120 -120
- powertrain_build/matlab_scripts/CodeGen/parsePreProcBlks.m +23 -23
- powertrain_build/matlab_scripts/CodeGen/struct2JSON.m +128 -128
- powertrain_build/matlab_scripts/CodeGen/updateCodeSwConfig.m +31 -31
- powertrain_build/matlab_scripts/Init_PyBuild.m +91 -91
- powertrain_build/matlab_scripts/__init__.py +2 -2
- powertrain_build/matlab_scripts/helperFunctions/Get_Full_Name.m +46 -46
- powertrain_build/matlab_scripts/helperFunctions/Get_SrcLines.m +12 -12
- powertrain_build/matlab_scripts/helperFunctions/Init_Models.m +78 -78
- powertrain_build/matlab_scripts/helperFunctions/Init_Projects.m +67 -67
- powertrain_build/matlab_scripts/helperFunctions/Read_Units.m +34 -34
- powertrain_build/matlab_scripts/helperFunctions/SetProjectTimeSamples.m +26 -26
- powertrain_build/matlab_scripts/helperFunctions/Strip_Suffix.m +16 -16
- powertrain_build/matlab_scripts/helperFunctions/followLink.m +118 -118
- powertrain_build/matlab_scripts/helperFunctions/getCodeSwitches.m +50 -50
- powertrain_build/matlab_scripts/helperFunctions/getConsumerBlocks.m +30 -30
- powertrain_build/matlab_scripts/helperFunctions/getDefBlock.m +39 -39
- powertrain_build/matlab_scripts/helperFunctions/getDefOutport.m +58 -58
- powertrain_build/matlab_scripts/helperFunctions/getDstBlocks.m +19 -19
- powertrain_build/matlab_scripts/helperFunctions/getDstLines.m +13 -13
- powertrain_build/matlab_scripts/helperFunctions/getInterfaceSignals.m +37 -37
- powertrain_build/matlab_scripts/helperFunctions/getName.m +37 -37
- powertrain_build/matlab_scripts/helperFunctions/getPath.m +6 -6
- powertrain_build/matlab_scripts/helperFunctions/getProperValue.m +21 -21
- powertrain_build/matlab_scripts/helperFunctions/getSrcBlocks.m +19 -19
- powertrain_build/matlab_scripts/helperFunctions/getSrcLines.m +13 -13
- powertrain_build/matlab_scripts/helperFunctions/loadLibraries.m +10 -10
- powertrain_build/matlab_scripts/helperFunctions/loadjson.m +6 -6
- powertrain_build/matlab_scripts/helperFunctions/modifyEnumStructField.m +21 -21
- powertrain_build/matlab_scripts/helperFunctions/removeConfigDuplicates.m +31 -31
- powertrain_build/matlab_scripts/helperFunctions/sortSystemByClass.m +26 -26
- powertrain_build/matlab_scripts/helperFunctions/tl_getfast.m +89 -89
- powertrain_build/matlab_scripts/helperFunctions/topLevelSystem.m +20 -20
- powertrain_build/matlab_scripts/helperFunctions/updateModels.m +131 -131
- powertrain_build/memory_section.py +224 -224
- powertrain_build/nvm_def.py +729 -729
- powertrain_build/problem_logger.py +86 -86
- powertrain_build/pt_matlab.py +430 -430
- powertrain_build/pt_win32.py +144 -144
- powertrain_build/replace_compu_tab_ref.py +105 -105
- powertrain_build/rte_dummy.py +254 -254
- powertrain_build/sched_funcs.py +209 -207
- powertrain_build/signal.py +7 -7
- powertrain_build/signal_if_html_rep.py +221 -221
- powertrain_build/signal_if_html_rep_all.py +302 -302
- powertrain_build/signal_incons_html_rep.py +180 -180
- powertrain_build/signal_incons_html_rep_all.py +366 -366
- powertrain_build/signal_incons_html_rep_base.py +168 -168
- powertrain_build/signal_inconsistency_check.py +641 -641
- powertrain_build/signal_interfaces.py +864 -864
- powertrain_build/templates/Index_SigCheck_All.html +22 -22
- powertrain_build/templates/Index_SigIf_All.html +19 -19
- powertrain_build/types.py +218 -218
- powertrain_build/unit_configs.py +419 -419
- powertrain_build/user_defined_types.py +660 -660
- powertrain_build/versioncheck.py +66 -66
- powertrain_build/wrapper.py +512 -512
- powertrain_build/xlrd_csv.py +87 -87
- powertrain_build/zone_controller/__init__.py +4 -4
- powertrain_build/zone_controller/calibration.py +176 -176
- powertrain_build/zone_controller/composition_yaml.py +880 -878
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/METADATA +100 -100
- powertrain_build-1.13.3.dev3.dist-info/RECORD +130 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/WHEEL +1 -1
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/LICENSE +202 -202
- powertrain_build-1.13.3.dev3.dist-info/pbr.json +1 -0
- powertrain_build-1.13.1.dist-info/RECORD +0 -130
- powertrain_build-1.13.1.dist-info/pbr.json +0 -1
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/entry_points.txt +0 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/AUTHORS +0 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/NOTICE +0 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/top_level.txt +0 -0
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function apiData = parseCoreIdentifiers(model)
|
|
5
|
-
% parseCoreIdentifiers Find all Core Identifier blocks in model
|
|
6
|
-
% returns a structs with identifier information
|
|
7
|
-
%
|
|
8
|
-
% See also parseModelInfo
|
|
9
|
-
|
|
10
|
-
apiData = struct();
|
|
11
|
-
% Which types of identifier shall be search for
|
|
12
|
-
id_names = {'Events', 'IUMPR', 'FIDs', 'Ranking', 'TstId','TstId','Ranking'};
|
|
13
|
-
idFilenames = {'CoreIdNameDefinition_EventIDs.csv',
|
|
14
|
-
'CoreIdNameDefinition_IUMPR.csv',
|
|
15
|
-
'CoreIdNameDefinition_FunctionIDs.csv',
|
|
16
|
-
'CoreIdNameDefinition_Ranking.csv',
|
|
17
|
-
'CoreIdNameDefinition_Mode$06.csv',
|
|
18
|
-
'CoreIdNameDefinition_Mode$06.csv',
|
|
19
|
-
'CoreIdNameDefinition_Ranking.csv'};
|
|
20
|
-
id_names2Filenames = containers.Map(id_names, idFilenames);
|
|
21
|
-
% The name of the blocks using the above identifiers
|
|
22
|
-
blk_names = {'^Dem_SetEvent.*', '^Dem_RepIUMPR.*', '^FiM_GetFunction.*', ...
|
|
23
|
-
'^bdcore_RVLG_SetRV.*', '^bdsrv_S06_SetTestResult.*', ...
|
|
24
|
-
'^(Vcc|Dem)_SetDTR', '^(Vcc|Vc)_SetRanking'};
|
|
25
|
-
% Which port of the block is the identifier connected to
|
|
26
|
-
blk_port_nbr = [1,1,1,1,1,1,1];
|
|
27
|
-
%which block data shall be stored per block.
|
|
28
|
-
info = {'description', 'type', 'unit', 'offset', 'lsb', 'min', 'max', 'class'};
|
|
29
|
-
|
|
30
|
-
for blk_type_idx=1:length(id_names)
|
|
31
|
-
% remove name search once all Core blocks are replaced with ones
|
|
32
|
-
% with correct mask names!
|
|
33
|
-
name_search = find_system(model, 'FindAll', 'on', 'RegExp', 'on', 'LookUnderMasks', 'all', 'blocktype', 'SubSystem', 'Name', blk_names{blk_type_idx});
|
|
34
|
-
msk_search = find_system(model, 'FindAll', 'on', 'RegExp', 'on', 'LookUnderMasks', 'all', 'MaskType', blk_names{blk_type_idx});
|
|
35
|
-
search = union(name_search, msk_search);
|
|
36
|
-
if ~isfield(apiData, id_names{blk_type_idx})
|
|
37
|
-
apiData.(id_names{blk_type_idx}) = struct();
|
|
38
|
-
end
|
|
39
|
-
for i=1:length(search)
|
|
40
|
-
%Find source block for EventID
|
|
41
|
-
ports = get_param(search(i), 'PortHandles');
|
|
42
|
-
l_h = get(ports.Inport(blk_port_nbr(blk_type_idx)), 'line');
|
|
43
|
-
blk_h = get_param(l_h,'SrcBlockHandle');
|
|
44
|
-
block_name = get_blk_name(model, blk_h);
|
|
45
|
-
if ~isempty(block_name)
|
|
46
|
-
%TODO: g�r API_blk till en cell array av structar
|
|
47
|
-
api_blk_tmp = [get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')];
|
|
48
|
-
tmpStruct.path = api_blk_tmp;
|
|
49
|
-
tmpStruct.config = getCodeSwitches(api_blk_tmp);
|
|
50
|
-
if isfield(apiData.(id_names{blk_type_idx}), block_name)
|
|
51
|
-
apiData.(id_names{blk_type_idx}).(block_name).API_blk = [apiData.(id_names{blk_type_idx}).(block_name).API_blk ...
|
|
52
|
-
tmpStruct];
|
|
53
|
-
else
|
|
54
|
-
%APIData.(id_names{blk_type_idx}).(block_name) = struct();
|
|
55
|
-
apiData.(id_names{blk_type_idx}).(block_name).API_blk{1} = tmpStruct;
|
|
56
|
-
end
|
|
57
|
-
%Get targetlink block data
|
|
58
|
-
apiData.(id_names{blk_type_idx}).(block_name).blk_name = get(blk_h, 'name');
|
|
59
|
-
apiData.(id_names{blk_type_idx}).(block_name).subsystem = get(blk_h, 'parent');
|
|
60
|
-
apiData.(id_names{blk_type_idx}).(block_name).API_blk_type = get(search(i), 'MaskType');
|
|
61
|
-
for idx=1:length(info)
|
|
62
|
-
if strcmp(info{idx}, 'description')
|
|
63
|
-
apiData.(id_names{blk_type_idx}).(block_name).(info{idx}) = getCsvDescription(block_name, id_names2Filenames(id_names{blk_type_idx}));
|
|
64
|
-
else
|
|
65
|
-
apiData.(id_names{blk_type_idx}).(block_name).(info{idx}) = chkNan(tl_get(blk_h, ['output.' info{idx}]));
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
else
|
|
69
|
-
disp(['Warning: model ' model ' contains illegal identifier blocks']);
|
|
70
|
-
if isfield(apiData.(id_names{blk_type_idx}), 'IllegalBlk')
|
|
71
|
-
apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk = [apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk...
|
|
72
|
-
{[get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')]}];
|
|
73
|
-
else
|
|
74
|
-
apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk = [get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')];
|
|
75
|
-
end
|
|
76
|
-
apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk_type = get(search(i), 'MaskType');
|
|
77
|
-
apiData.(id_names{blk_type_idx}).IllegalBlk.description = ['Illegal block ID!: ' get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')];
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
function blk_name = get_blk_name(model, block_h)
|
|
84
|
-
type = get_param(block_h,'MaskType');
|
|
85
|
-
if ~isempty(strfind(type,'NamedConstant'))
|
|
86
|
-
blk_name_tmp = get_param(block_h,'MaskValues');
|
|
87
|
-
blk_name = blk_name_tmp{1};
|
|
88
|
-
elseif ~isempty(strfind(type,'From'))
|
|
89
|
-
blk_tag = get_param(block_h,'GotoTag');
|
|
90
|
-
blk_to = find_system(model, 'FindAll', 'on', 'LookUnderMasks', 'all', 'BlockType', 'Goto', 'GotoTag', blk_tag);
|
|
91
|
-
ports = get_param(blk_to, 'PortHandles');
|
|
92
|
-
l_h = get(ports.Inport(1), 'line');
|
|
93
|
-
blk_h = get_param(l_h,'SrcBlockHandle');
|
|
94
|
-
blk_name = get_blk_name(model, blk_h);
|
|
95
|
-
else
|
|
96
|
-
o_name = tl_get(block_h,'output.name');
|
|
97
|
-
if ~isempty(o_name )
|
|
98
|
-
[tok mat] = regexp(model ,'(.+?)_Tmp$', 'tokens');
|
|
99
|
-
if mat > 0
|
|
100
|
-
model_tmp = tok{1};
|
|
101
|
-
else
|
|
102
|
-
model_tmp = model;
|
|
103
|
-
end
|
|
104
|
-
tmp_name = regexprep(o_name, '\$N', model_tmp);
|
|
105
|
-
blk_name = regexprep(tmp_name, '\$B', get(block_h,'name'));
|
|
106
|
-
else
|
|
107
|
-
blk_name = '';
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
function res = chkNan(value)
|
|
113
|
-
% Function which replaces NaN or empty fields with '-'
|
|
114
|
-
if ~ischar(value)
|
|
115
|
-
if isnan(value)
|
|
116
|
-
res = '-';
|
|
117
|
-
elseif isempty(value)
|
|
118
|
-
res = '-';
|
|
119
|
-
else
|
|
120
|
-
res = num2str(value);
|
|
121
|
-
end
|
|
122
|
-
else
|
|
123
|
-
res = value;
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
function description = getCsvDescription(blockName, filename)
|
|
128
|
-
% getCsvDescription Get description parametres from CSV files.
|
|
129
|
-
txt = readtable(filename);
|
|
130
|
-
% Using table column names is unsafe as the first row can become the
|
|
131
|
-
% column names. Eg. txt.Var1 can become txt.Models.
|
|
132
|
-
% Using columns instead.
|
|
133
|
-
blockNameColumn = 2;
|
|
134
|
-
descriptionColumn = 3;
|
|
135
|
-
description = txt{strcmp(txt{:, blockNameColumn}, blockName), descriptionColumn};
|
|
136
|
-
if isempty(description)
|
|
137
|
-
description = 'Description missing';
|
|
138
|
-
end
|
|
139
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function apiData = parseCoreIdentifiers(model)
|
|
5
|
+
% parseCoreIdentifiers Find all Core Identifier blocks in model
|
|
6
|
+
% returns a structs with identifier information
|
|
7
|
+
%
|
|
8
|
+
% See also parseModelInfo
|
|
9
|
+
|
|
10
|
+
apiData = struct();
|
|
11
|
+
% Which types of identifier shall be search for
|
|
12
|
+
id_names = {'Events', 'IUMPR', 'FIDs', 'Ranking', 'TstId','TstId','Ranking'};
|
|
13
|
+
idFilenames = {'CoreIdNameDefinition_EventIDs.csv',
|
|
14
|
+
'CoreIdNameDefinition_IUMPR.csv',
|
|
15
|
+
'CoreIdNameDefinition_FunctionIDs.csv',
|
|
16
|
+
'CoreIdNameDefinition_Ranking.csv',
|
|
17
|
+
'CoreIdNameDefinition_Mode$06.csv',
|
|
18
|
+
'CoreIdNameDefinition_Mode$06.csv',
|
|
19
|
+
'CoreIdNameDefinition_Ranking.csv'};
|
|
20
|
+
id_names2Filenames = containers.Map(id_names, idFilenames);
|
|
21
|
+
% The name of the blocks using the above identifiers
|
|
22
|
+
blk_names = {'^Dem_SetEvent.*', '^Dem_RepIUMPR.*', '^FiM_GetFunction.*', ...
|
|
23
|
+
'^bdcore_RVLG_SetRV.*', '^bdsrv_S06_SetTestResult.*', ...
|
|
24
|
+
'^(Vcc|Dem)_SetDTR', '^(Vcc|Vc)_SetRanking'};
|
|
25
|
+
% Which port of the block is the identifier connected to
|
|
26
|
+
blk_port_nbr = [1,1,1,1,1,1,1];
|
|
27
|
+
%which block data shall be stored per block.
|
|
28
|
+
info = {'description', 'type', 'unit', 'offset', 'lsb', 'min', 'max', 'class'};
|
|
29
|
+
|
|
30
|
+
for blk_type_idx=1:length(id_names)
|
|
31
|
+
% remove name search once all Core blocks are replaced with ones
|
|
32
|
+
% with correct mask names!
|
|
33
|
+
name_search = find_system(model, 'FindAll', 'on', 'RegExp', 'on', 'LookUnderMasks', 'all', 'blocktype', 'SubSystem', 'Name', blk_names{blk_type_idx});
|
|
34
|
+
msk_search = find_system(model, 'FindAll', 'on', 'RegExp', 'on', 'LookUnderMasks', 'all', 'MaskType', blk_names{blk_type_idx});
|
|
35
|
+
search = union(name_search, msk_search);
|
|
36
|
+
if ~isfield(apiData, id_names{blk_type_idx})
|
|
37
|
+
apiData.(id_names{blk_type_idx}) = struct();
|
|
38
|
+
end
|
|
39
|
+
for i=1:length(search)
|
|
40
|
+
%Find source block for EventID
|
|
41
|
+
ports = get_param(search(i), 'PortHandles');
|
|
42
|
+
l_h = get(ports.Inport(blk_port_nbr(blk_type_idx)), 'line');
|
|
43
|
+
blk_h = get_param(l_h,'SrcBlockHandle');
|
|
44
|
+
block_name = get_blk_name(model, blk_h);
|
|
45
|
+
if ~isempty(block_name)
|
|
46
|
+
%TODO: g�r API_blk till en cell array av structar
|
|
47
|
+
api_blk_tmp = [get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')];
|
|
48
|
+
tmpStruct.path = api_blk_tmp;
|
|
49
|
+
tmpStruct.config = getCodeSwitches(api_blk_tmp);
|
|
50
|
+
if isfield(apiData.(id_names{blk_type_idx}), block_name)
|
|
51
|
+
apiData.(id_names{blk_type_idx}).(block_name).API_blk = [apiData.(id_names{blk_type_idx}).(block_name).API_blk ...
|
|
52
|
+
tmpStruct];
|
|
53
|
+
else
|
|
54
|
+
%APIData.(id_names{blk_type_idx}).(block_name) = struct();
|
|
55
|
+
apiData.(id_names{blk_type_idx}).(block_name).API_blk{1} = tmpStruct;
|
|
56
|
+
end
|
|
57
|
+
%Get targetlink block data
|
|
58
|
+
apiData.(id_names{blk_type_idx}).(block_name).blk_name = get(blk_h, 'name');
|
|
59
|
+
apiData.(id_names{blk_type_idx}).(block_name).subsystem = get(blk_h, 'parent');
|
|
60
|
+
apiData.(id_names{blk_type_idx}).(block_name).API_blk_type = get(search(i), 'MaskType');
|
|
61
|
+
for idx=1:length(info)
|
|
62
|
+
if strcmp(info{idx}, 'description')
|
|
63
|
+
apiData.(id_names{blk_type_idx}).(block_name).(info{idx}) = getCsvDescription(block_name, id_names2Filenames(id_names{blk_type_idx}));
|
|
64
|
+
else
|
|
65
|
+
apiData.(id_names{blk_type_idx}).(block_name).(info{idx}) = chkNan(tl_get(blk_h, ['output.' info{idx}]));
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
else
|
|
69
|
+
disp(['Warning: model ' model ' contains illegal identifier blocks']);
|
|
70
|
+
if isfield(apiData.(id_names{blk_type_idx}), 'IllegalBlk')
|
|
71
|
+
apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk = [apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk...
|
|
72
|
+
{[get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')]}];
|
|
73
|
+
else
|
|
74
|
+
apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk = [get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')];
|
|
75
|
+
end
|
|
76
|
+
apiData.(id_names{blk_type_idx}).IllegalBlk.API_blk_type = get(search(i), 'MaskType');
|
|
77
|
+
apiData.(id_names{blk_type_idx}).IllegalBlk.description = ['Illegal block ID!: ' get_param(search(i), 'Parent') '/' get_param(search(i), 'Name')];
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
function blk_name = get_blk_name(model, block_h)
|
|
84
|
+
type = get_param(block_h,'MaskType');
|
|
85
|
+
if ~isempty(strfind(type,'NamedConstant'))
|
|
86
|
+
blk_name_tmp = get_param(block_h,'MaskValues');
|
|
87
|
+
blk_name = blk_name_tmp{1};
|
|
88
|
+
elseif ~isempty(strfind(type,'From'))
|
|
89
|
+
blk_tag = get_param(block_h,'GotoTag');
|
|
90
|
+
blk_to = find_system(model, 'FindAll', 'on', 'LookUnderMasks', 'all', 'BlockType', 'Goto', 'GotoTag', blk_tag);
|
|
91
|
+
ports = get_param(blk_to, 'PortHandles');
|
|
92
|
+
l_h = get(ports.Inport(1), 'line');
|
|
93
|
+
blk_h = get_param(l_h,'SrcBlockHandle');
|
|
94
|
+
blk_name = get_blk_name(model, blk_h);
|
|
95
|
+
else
|
|
96
|
+
o_name = tl_get(block_h,'output.name');
|
|
97
|
+
if ~isempty(o_name )
|
|
98
|
+
[tok mat] = regexp(model ,'(.+?)_Tmp$', 'tokens');
|
|
99
|
+
if mat > 0
|
|
100
|
+
model_tmp = tok{1};
|
|
101
|
+
else
|
|
102
|
+
model_tmp = model;
|
|
103
|
+
end
|
|
104
|
+
tmp_name = regexprep(o_name, '\$N', model_tmp);
|
|
105
|
+
blk_name = regexprep(tmp_name, '\$B', get(block_h,'name'));
|
|
106
|
+
else
|
|
107
|
+
blk_name = '';
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
function res = chkNan(value)
|
|
113
|
+
% Function which replaces NaN or empty fields with '-'
|
|
114
|
+
if ~ischar(value)
|
|
115
|
+
if isnan(value)
|
|
116
|
+
res = '-';
|
|
117
|
+
elseif isempty(value)
|
|
118
|
+
res = '-';
|
|
119
|
+
else
|
|
120
|
+
res = num2str(value);
|
|
121
|
+
end
|
|
122
|
+
else
|
|
123
|
+
res = value;
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
function description = getCsvDescription(blockName, filename)
|
|
128
|
+
% getCsvDescription Get description parametres from CSV files.
|
|
129
|
+
txt = readtable(filename);
|
|
130
|
+
% Using table column names is unsafe as the first row can become the
|
|
131
|
+
% column names. Eg. txt.Var1 can become txt.Models.
|
|
132
|
+
% Using columns instead.
|
|
133
|
+
blockNameColumn = 2;
|
|
134
|
+
descriptionColumn = 3;
|
|
135
|
+
description = txt{strcmp(txt{:, blockNameColumn}, blockName), descriptionColumn};
|
|
136
|
+
if isempty(description)
|
|
137
|
+
description = 'Description missing';
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function DID = parseDIDs(model_in)
|
|
5
|
-
% parseDIDs find all DID blocks in model
|
|
6
|
-
% returns a cell array with structs with DID information
|
|
7
|
-
%
|
|
8
|
-
% See also parseModelInfo
|
|
9
|
-
DIDs_h = find_system(model_in, 'FindAll', 'on', 'LookUnderMasks', 'all', 'MaskType', 'DID');
|
|
10
|
-
DID = struct();
|
|
11
|
-
if ~isempty(DIDs_h)
|
|
12
|
-
model = getTLModelName(model_in);
|
|
13
|
-
outp_h = find_system(model_in, 'findall', 'on', 'lookundermasks', 'on', 'MaskType', 'TL_Outport');
|
|
14
|
-
for i=1:length(DIDs_h)
|
|
15
|
-
ports = get(DIDs_h(i), 'PortHandles');
|
|
16
|
-
configs = getCodeSwitches(DIDs_h(i));
|
|
17
|
-
l_h = get(ports.Inport, 'line');
|
|
18
|
-
%Check if the signal is a propagated name
|
|
19
|
-
%and find the original signal if it is
|
|
20
|
-
tmp_sig_name = get(l_h, 'name');
|
|
21
|
-
if isempty(tmp_sig_name)
|
|
22
|
-
sp_h = get(l_h, 'SrcPortHandle');
|
|
23
|
-
tmp_sig_name = get(sp_h, 'PropagatedSignals');
|
|
24
|
-
if isempty(tmp_sig_name)
|
|
25
|
-
disp(['No signal name for block <a href = "matlab:Hilite_This_System(''' Get_Path(DIDs_h(i))...
|
|
26
|
-
''')">' Get_Path(DIDs_h(i)) '</a>'])
|
|
27
|
-
continue
|
|
28
|
-
end
|
|
29
|
-
ln_h_tmp = find_system(model_in, 'findall', 'on', 'lookundermasks', 'on', ...
|
|
30
|
-
'type','line','name', tmp_sig_name);
|
|
31
|
-
%Get one of the lines, as all have the same source block
|
|
32
|
-
if length(ln_h_tmp) > 1
|
|
33
|
-
ln_h = ln_h_tmp(1);
|
|
34
|
-
else
|
|
35
|
-
ln_h = ln_h_tmp;
|
|
36
|
-
end
|
|
37
|
-
else
|
|
38
|
-
ln_h = l_h;
|
|
39
|
-
end
|
|
40
|
-
%find if there is a TL-outport with the signal name and it is
|
|
41
|
-
% not a deafult port - if so use that port as the definition for the DID.
|
|
42
|
-
found_outp_h = 0;
|
|
43
|
-
for j=1:length(outp_h)
|
|
44
|
-
oph = get(outp_h(j), 'PortHandles');
|
|
45
|
-
opl_h = get(oph.Inport, 'line');
|
|
46
|
-
sig_outp_name = get(opl_h, 'name');
|
|
47
|
-
if isempty(sig_outp_name)
|
|
48
|
-
opp_h = get(opl_h, 'SrcPortHandle');
|
|
49
|
-
sig_outp_name = get(opp_h, 'PropagatedSignals');
|
|
50
|
-
end
|
|
51
|
-
if strcmp(tmp_sig_name,sig_outp_name)
|
|
52
|
-
found_outp_h = outp_h(j);
|
|
53
|
-
break
|
|
54
|
-
else
|
|
55
|
-
found_outp_h = 0;
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
if found_outp_h ~= 0
|
|
60
|
-
sig_name = sig_outp_name;
|
|
61
|
-
blk_name = [get(found_outp_h,'Parent') '/' get(found_outp_h,'Name')];
|
|
62
|
-
sig_disc = tl_get(found_outp_h, 'output.description');
|
|
63
|
-
data_type = tl_get(found_outp_h, 'output.type');
|
|
64
|
-
unit = tl_get(found_outp_h, 'output.unit');
|
|
65
|
-
offset = tl_get(found_outp_h, 'output.offset');
|
|
66
|
-
lsb = tl_get(found_outp_h, 'output.lsb');
|
|
67
|
-
min_v = tl_get(found_outp_h, 'output.min');
|
|
68
|
-
max_v = tl_get(found_outp_h, 'output.max');
|
|
69
|
-
tlclass = tl_get(found_outp_h, 'output.class');
|
|
70
|
-
else
|
|
71
|
-
%find TL-output name and expand the macro to a signal name
|
|
72
|
-
src_blk_h = get(ln_h,'SrcBlockHandle');
|
|
73
|
-
if strcmp(get_param(src_blk_h, 'MaskType'), 'TL_DataStoreRead')
|
|
74
|
-
parent = get(src_blk_h, 'Parent');
|
|
75
|
-
ds_name = tl_get(src_blk_h, 'Datastorename');
|
|
76
|
-
data_str = sprintf('.*?''name'',''%s''', ds_name);
|
|
77
|
-
src_blk_h = find_system(parent, 'findall', 'on', 'lookundermasks', 'on', ...
|
|
78
|
-
'RegExp', 'on', 'MaskType', 'TL_DataStoreMemory', ...
|
|
79
|
-
'data', data_str);
|
|
80
|
-
end
|
|
81
|
-
tl_outp_name = tl_get(src_blk_h, 'output.name');
|
|
82
|
-
if isempty(tl_outp_name) % the upstream block has no tl.outputs (e.g. ports replaced by constants by scripts)
|
|
83
|
-
continue
|
|
84
|
-
end
|
|
85
|
-
% ToDo: add a check that no $B or $S is in the TL-name!
|
|
86
|
-
% Remove _Tmp suffix from the model name
|
|
87
|
-
[tok mat] = regexp(model ,'(.+?)_Tmp$', 'tokens');
|
|
88
|
-
if mat > 0
|
|
89
|
-
model_tmp = tok{1};
|
|
90
|
-
else
|
|
91
|
-
model_tmp = model;
|
|
92
|
-
end
|
|
93
|
-
tmp_name = regexprep(tl_outp_name, '\$N', model_tmp);
|
|
94
|
-
sig_name = regexprep(tmp_name, '\$L', get(ln_h,'name'));
|
|
95
|
-
%Store DID info in a struct
|
|
96
|
-
blk_name = [get(src_blk_h,'Parent') '/' get(src_blk_h,'Name')];
|
|
97
|
-
data_type = tl_get(src_blk_h, 'output.type');
|
|
98
|
-
sig_disc = tl_get(src_blk_h, 'output.description');
|
|
99
|
-
unit = tl_get(src_blk_h, 'output.unit');
|
|
100
|
-
offset = tl_get(src_blk_h, 'output.offset');
|
|
101
|
-
lsb = tl_get(src_blk_h, 'output.lsb');
|
|
102
|
-
min_v = tl_get(src_blk_h, 'output.min');
|
|
103
|
-
max_v = tl_get(src_blk_h, 'output.max');
|
|
104
|
-
tlclass = tl_get(src_blk_h, 'output.class');
|
|
105
|
-
end
|
|
106
|
-
if strcmp('default', tlclass)
|
|
107
|
-
disp(['Block creating signal has default class <a href = "matlab:Hilite_This_System(''' Get_Path(DIDs_h(i))...
|
|
108
|
-
''')">' Get_Path(DIDs_h(i)) '</a>'])
|
|
109
|
-
else
|
|
110
|
-
tmpDID = struct();
|
|
111
|
-
tmpDID.handle = blk_name;
|
|
112
|
-
tmpDID.name = sig_name;
|
|
113
|
-
tmpDID.configs = configs;
|
|
114
|
-
tmpDID.description = sig_disc;
|
|
115
|
-
tmpDID.type = data_type;
|
|
116
|
-
tmpDID.unit = unit;
|
|
117
|
-
tmpDID.offset = offset;
|
|
118
|
-
tmpDID.lsb = lsb;
|
|
119
|
-
tmpDID.min = chkNan(min_v);
|
|
120
|
-
tmpDID.max = chkNan(max_v);
|
|
121
|
-
tmpDID.class = tlclass;
|
|
122
|
-
DID.(tmpDID.name) = tmpDID;
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
function res = chkNan(value)
|
|
129
|
-
% Function which replaces NaN or empty fields with '-'
|
|
130
|
-
if ~ischar(value)
|
|
131
|
-
if isnan(value)
|
|
132
|
-
res = '-';
|
|
133
|
-
elseif isempty(value)
|
|
134
|
-
res = '-';
|
|
135
|
-
else
|
|
136
|
-
res = num2str(value);
|
|
137
|
-
end
|
|
138
|
-
else
|
|
139
|
-
res = value;
|
|
140
|
-
end
|
|
141
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function DID = parseDIDs(model_in)
|
|
5
|
+
% parseDIDs find all DID blocks in model
|
|
6
|
+
% returns a cell array with structs with DID information
|
|
7
|
+
%
|
|
8
|
+
% See also parseModelInfo
|
|
9
|
+
DIDs_h = find_system(model_in, 'FindAll', 'on', 'LookUnderMasks', 'all', 'MaskType', 'DID');
|
|
10
|
+
DID = struct();
|
|
11
|
+
if ~isempty(DIDs_h)
|
|
12
|
+
model = getTLModelName(model_in);
|
|
13
|
+
outp_h = find_system(model_in, 'findall', 'on', 'lookundermasks', 'on', 'MaskType', 'TL_Outport');
|
|
14
|
+
for i=1:length(DIDs_h)
|
|
15
|
+
ports = get(DIDs_h(i), 'PortHandles');
|
|
16
|
+
configs = getCodeSwitches(DIDs_h(i));
|
|
17
|
+
l_h = get(ports.Inport, 'line');
|
|
18
|
+
%Check if the signal is a propagated name
|
|
19
|
+
%and find the original signal if it is
|
|
20
|
+
tmp_sig_name = get(l_h, 'name');
|
|
21
|
+
if isempty(tmp_sig_name)
|
|
22
|
+
sp_h = get(l_h, 'SrcPortHandle');
|
|
23
|
+
tmp_sig_name = get(sp_h, 'PropagatedSignals');
|
|
24
|
+
if isempty(tmp_sig_name)
|
|
25
|
+
disp(['No signal name for block <a href = "matlab:Hilite_This_System(''' Get_Path(DIDs_h(i))...
|
|
26
|
+
''')">' Get_Path(DIDs_h(i)) '</a>'])
|
|
27
|
+
continue
|
|
28
|
+
end
|
|
29
|
+
ln_h_tmp = find_system(model_in, 'findall', 'on', 'lookundermasks', 'on', ...
|
|
30
|
+
'type','line','name', tmp_sig_name);
|
|
31
|
+
%Get one of the lines, as all have the same source block
|
|
32
|
+
if length(ln_h_tmp) > 1
|
|
33
|
+
ln_h = ln_h_tmp(1);
|
|
34
|
+
else
|
|
35
|
+
ln_h = ln_h_tmp;
|
|
36
|
+
end
|
|
37
|
+
else
|
|
38
|
+
ln_h = l_h;
|
|
39
|
+
end
|
|
40
|
+
%find if there is a TL-outport with the signal name and it is
|
|
41
|
+
% not a deafult port - if so use that port as the definition for the DID.
|
|
42
|
+
found_outp_h = 0;
|
|
43
|
+
for j=1:length(outp_h)
|
|
44
|
+
oph = get(outp_h(j), 'PortHandles');
|
|
45
|
+
opl_h = get(oph.Inport, 'line');
|
|
46
|
+
sig_outp_name = get(opl_h, 'name');
|
|
47
|
+
if isempty(sig_outp_name)
|
|
48
|
+
opp_h = get(opl_h, 'SrcPortHandle');
|
|
49
|
+
sig_outp_name = get(opp_h, 'PropagatedSignals');
|
|
50
|
+
end
|
|
51
|
+
if strcmp(tmp_sig_name,sig_outp_name)
|
|
52
|
+
found_outp_h = outp_h(j);
|
|
53
|
+
break
|
|
54
|
+
else
|
|
55
|
+
found_outp_h = 0;
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if found_outp_h ~= 0
|
|
60
|
+
sig_name = sig_outp_name;
|
|
61
|
+
blk_name = [get(found_outp_h,'Parent') '/' get(found_outp_h,'Name')];
|
|
62
|
+
sig_disc = tl_get(found_outp_h, 'output.description');
|
|
63
|
+
data_type = tl_get(found_outp_h, 'output.type');
|
|
64
|
+
unit = tl_get(found_outp_h, 'output.unit');
|
|
65
|
+
offset = tl_get(found_outp_h, 'output.offset');
|
|
66
|
+
lsb = tl_get(found_outp_h, 'output.lsb');
|
|
67
|
+
min_v = tl_get(found_outp_h, 'output.min');
|
|
68
|
+
max_v = tl_get(found_outp_h, 'output.max');
|
|
69
|
+
tlclass = tl_get(found_outp_h, 'output.class');
|
|
70
|
+
else
|
|
71
|
+
%find TL-output name and expand the macro to a signal name
|
|
72
|
+
src_blk_h = get(ln_h,'SrcBlockHandle');
|
|
73
|
+
if strcmp(get_param(src_blk_h, 'MaskType'), 'TL_DataStoreRead')
|
|
74
|
+
parent = get(src_blk_h, 'Parent');
|
|
75
|
+
ds_name = tl_get(src_blk_h, 'Datastorename');
|
|
76
|
+
data_str = sprintf('.*?''name'',''%s''', ds_name);
|
|
77
|
+
src_blk_h = find_system(parent, 'findall', 'on', 'lookundermasks', 'on', ...
|
|
78
|
+
'RegExp', 'on', 'MaskType', 'TL_DataStoreMemory', ...
|
|
79
|
+
'data', data_str);
|
|
80
|
+
end
|
|
81
|
+
tl_outp_name = tl_get(src_blk_h, 'output.name');
|
|
82
|
+
if isempty(tl_outp_name) % the upstream block has no tl.outputs (e.g. ports replaced by constants by scripts)
|
|
83
|
+
continue
|
|
84
|
+
end
|
|
85
|
+
% ToDo: add a check that no $B or $S is in the TL-name!
|
|
86
|
+
% Remove _Tmp suffix from the model name
|
|
87
|
+
[tok mat] = regexp(model ,'(.+?)_Tmp$', 'tokens');
|
|
88
|
+
if mat > 0
|
|
89
|
+
model_tmp = tok{1};
|
|
90
|
+
else
|
|
91
|
+
model_tmp = model;
|
|
92
|
+
end
|
|
93
|
+
tmp_name = regexprep(tl_outp_name, '\$N', model_tmp);
|
|
94
|
+
sig_name = regexprep(tmp_name, '\$L', get(ln_h,'name'));
|
|
95
|
+
%Store DID info in a struct
|
|
96
|
+
blk_name = [get(src_blk_h,'Parent') '/' get(src_blk_h,'Name')];
|
|
97
|
+
data_type = tl_get(src_blk_h, 'output.type');
|
|
98
|
+
sig_disc = tl_get(src_blk_h, 'output.description');
|
|
99
|
+
unit = tl_get(src_blk_h, 'output.unit');
|
|
100
|
+
offset = tl_get(src_blk_h, 'output.offset');
|
|
101
|
+
lsb = tl_get(src_blk_h, 'output.lsb');
|
|
102
|
+
min_v = tl_get(src_blk_h, 'output.min');
|
|
103
|
+
max_v = tl_get(src_blk_h, 'output.max');
|
|
104
|
+
tlclass = tl_get(src_blk_h, 'output.class');
|
|
105
|
+
end
|
|
106
|
+
if strcmp('default', tlclass)
|
|
107
|
+
disp(['Block creating signal has default class <a href = "matlab:Hilite_This_System(''' Get_Path(DIDs_h(i))...
|
|
108
|
+
''')">' Get_Path(DIDs_h(i)) '</a>'])
|
|
109
|
+
else
|
|
110
|
+
tmpDID = struct();
|
|
111
|
+
tmpDID.handle = blk_name;
|
|
112
|
+
tmpDID.name = sig_name;
|
|
113
|
+
tmpDID.configs = configs;
|
|
114
|
+
tmpDID.description = sig_disc;
|
|
115
|
+
tmpDID.type = data_type;
|
|
116
|
+
tmpDID.unit = unit;
|
|
117
|
+
tmpDID.offset = offset;
|
|
118
|
+
tmpDID.lsb = lsb;
|
|
119
|
+
tmpDID.min = chkNan(min_v);
|
|
120
|
+
tmpDID.max = chkNan(max_v);
|
|
121
|
+
tmpDID.class = tlclass;
|
|
122
|
+
DID.(tmpDID.name) = tmpDID;
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
function res = chkNan(value)
|
|
129
|
+
% Function which replaces NaN or empty fields with '-'
|
|
130
|
+
if ~ischar(value)
|
|
131
|
+
if isnan(value)
|
|
132
|
+
res = '-';
|
|
133
|
+
elseif isempty(value)
|
|
134
|
+
res = '-';
|
|
135
|
+
else
|
|
136
|
+
res = num2str(value);
|
|
137
|
+
end
|
|
138
|
+
else
|
|
139
|
+
res = value;
|
|
140
|
+
end
|
|
141
|
+
end
|