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,106 +1,106 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function inPorts = parseInPorts(root_subsystem)
|
|
5
|
-
% parseInPorts Parse which block data shall be stored per block.
|
|
6
|
-
%
|
|
7
|
-
% See also parseModelInfo
|
|
8
|
-
|
|
9
|
-
% TODO: Some models have more tha one inport per variable. Should we
|
|
10
|
-
% check for this?
|
|
11
|
-
inPorts = struct();
|
|
12
|
-
info = {'description', 'type', 'unit', 'offset', 'lsb', 'min', 'max', 'class', 'width'};
|
|
13
|
-
|
|
14
|
-
normalInPorts = parseTLInPorts(root_subsystem, info);
|
|
15
|
-
normalFields = fieldnames(normalInPorts);
|
|
16
|
-
for idx = 1:length(normalFields)
|
|
17
|
-
inPorts.(normalFields{idx}) = normalInPorts.(normalFields{idx});
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
busInPorts = parseTLBusInPorts(root_subsystem, info);
|
|
21
|
-
busFields = fieldnames(busInPorts);
|
|
22
|
-
for idx = 1:length(busFields)
|
|
23
|
-
inPorts.(busFields{idx}) = busInPorts.(busFields{idx});
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
function inPorts = parseTLInPorts(root_subsystem, info)
|
|
28
|
-
in_ports = find_system(root_subsystem, 'FindAll', 'on', 'SearchDepth', 1, 'MaskType', 'TL_Inport');
|
|
29
|
-
inPorts = struct();
|
|
30
|
-
tmpInport = struct();
|
|
31
|
-
for i=1:length(in_ports)
|
|
32
|
-
inp = in_ports(i);
|
|
33
|
-
consumerBlks = getConsumerBlocks(inp);
|
|
34
|
-
codeSwTmp = {};
|
|
35
|
-
for j=1:length(consumerBlks)
|
|
36
|
-
consBlk = consumerBlks(j);
|
|
37
|
-
codeSwTmp{j} = getCodeSwitches(consBlk);
|
|
38
|
-
end
|
|
39
|
-
%TODO: Do a better reduction of code switch logics right now only duplicates are removed.
|
|
40
|
-
codeSw = removeConfigDuplicates(codeSwTmp);
|
|
41
|
-
tmpInport.handle = getPath(inp);
|
|
42
|
-
tmpInport.name = strtrim(getName(inp));
|
|
43
|
-
tmpInport.configs = codeSw;
|
|
44
|
-
for idx=1:length(info)
|
|
45
|
-
tmpValue = tl_get(inp, ['output.' info{idx}]);
|
|
46
|
-
tmpInport.(info{idx}) = getProperValue(inp, tmpValue);
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
tmpInport = modifyEnumStructField(tmpInport);
|
|
50
|
-
|
|
51
|
-
if strcmp(tmpInport.name, fields(inPorts))
|
|
52
|
-
printf('Warning: inport %s is already defined', tmpInport.name);
|
|
53
|
-
printf(' signal will not be added again to the input signal');
|
|
54
|
-
else
|
|
55
|
-
inPorts.(tmpInport.name) = tmpInport;
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
function busInPorts = parseTLBusInPorts(root_subsystem, info)
|
|
61
|
-
foundBusInPorts = find_system(root_subsystem, 'FindAll', 'on', 'SearchDepth', 1, 'MaskType', 'TL_BusInport');
|
|
62
|
-
busInPorts = struct();
|
|
63
|
-
tmpInport = struct();
|
|
64
|
-
for idx=1:length(foundBusInPorts)
|
|
65
|
-
inp = foundBusInPorts(idx);
|
|
66
|
-
for idy = 1:tl_get(inp, 'numoutputs')
|
|
67
|
-
tmpInport.handle = getPath(inp);
|
|
68
|
-
tmpInport.name = tl_get(inp, ['output(' num2str(idy) ').signalname']);
|
|
69
|
-
tmpInport.configs = getBusConfig(inp);
|
|
70
|
-
for idz=1:length(info)
|
|
71
|
-
tmpValue = tl_get(inp, ['output(' num2str(idy) ').' info{idz}]);
|
|
72
|
-
tmpInport.(info{idz}) = getProperValue(inp, tmpValue);
|
|
73
|
-
end
|
|
74
|
-
% TODO Fix later, cannot set width in TL_BusInport:s due to "matrix unified output".
|
|
75
|
-
tmpInport.width = 1;
|
|
76
|
-
|
|
77
|
-
tmpInport = modifyEnumStructField(tmpInport);
|
|
78
|
-
|
|
79
|
-
busParts = split(tmpInport.name, '.');
|
|
80
|
-
if ~ismember(busParts{1}, fields(busInPorts))
|
|
81
|
-
busInPorts.(busParts{1}) = struct();
|
|
82
|
-
busInPorts.(busParts{1}).(busParts{2}) = tmpInport;
|
|
83
|
-
elseif ~ismember(busParts{2}, fields(busInPorts.(busParts{1})))
|
|
84
|
-
busInPorts.(busParts{1}).(busParts{2}) = tmpInport;
|
|
85
|
-
else
|
|
86
|
-
printf('Warning: inport %s is already defined', tmpInport.name);
|
|
87
|
-
printf(' signal will not be added again to the input signal');
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
function busConfig = getBusConfig(inp)
|
|
94
|
-
consumerBlks = getConsumerBlocks(inp);
|
|
95
|
-
codeSwTmp = {};
|
|
96
|
-
for idx=1:length(consumerBlks)
|
|
97
|
-
consBlk = consumerBlks(idx);
|
|
98
|
-
codeSwTmp{idx} = getCodeSwitches(consBlk);
|
|
99
|
-
end
|
|
100
|
-
%TODO: Do a better reduction of code switch logics right now only duplicates are removed.
|
|
101
|
-
busConfig = removeConfigDuplicates(codeSwTmp);
|
|
102
|
-
isValidConfig = iscell(busConfig) && length(busConfig) == 1 && strcmp(busConfig{1}, 'all');
|
|
103
|
-
if ~isValidConfig
|
|
104
|
-
error('Code switching bus inports is currently not supported. All bus inport destinations must be active.')
|
|
105
|
-
end
|
|
106
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function inPorts = parseInPorts(root_subsystem)
|
|
5
|
+
% parseInPorts Parse which block data shall be stored per block.
|
|
6
|
+
%
|
|
7
|
+
% See also parseModelInfo
|
|
8
|
+
|
|
9
|
+
% TODO: Some models have more tha one inport per variable. Should we
|
|
10
|
+
% check for this?
|
|
11
|
+
inPorts = struct();
|
|
12
|
+
info = {'description', 'type', 'unit', 'offset', 'lsb', 'min', 'max', 'class', 'width'};
|
|
13
|
+
|
|
14
|
+
normalInPorts = parseTLInPorts(root_subsystem, info);
|
|
15
|
+
normalFields = fieldnames(normalInPorts);
|
|
16
|
+
for idx = 1:length(normalFields)
|
|
17
|
+
inPorts.(normalFields{idx}) = normalInPorts.(normalFields{idx});
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
busInPorts = parseTLBusInPorts(root_subsystem, info);
|
|
21
|
+
busFields = fieldnames(busInPorts);
|
|
22
|
+
for idx = 1:length(busFields)
|
|
23
|
+
inPorts.(busFields{idx}) = busInPorts.(busFields{idx});
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
function inPorts = parseTLInPorts(root_subsystem, info)
|
|
28
|
+
in_ports = find_system(root_subsystem, 'FindAll', 'on', 'SearchDepth', 1, 'MaskType', 'TL_Inport');
|
|
29
|
+
inPorts = struct();
|
|
30
|
+
tmpInport = struct();
|
|
31
|
+
for i=1:length(in_ports)
|
|
32
|
+
inp = in_ports(i);
|
|
33
|
+
consumerBlks = getConsumerBlocks(inp);
|
|
34
|
+
codeSwTmp = {};
|
|
35
|
+
for j=1:length(consumerBlks)
|
|
36
|
+
consBlk = consumerBlks(j);
|
|
37
|
+
codeSwTmp{j} = getCodeSwitches(consBlk);
|
|
38
|
+
end
|
|
39
|
+
%TODO: Do a better reduction of code switch logics right now only duplicates are removed.
|
|
40
|
+
codeSw = removeConfigDuplicates(codeSwTmp);
|
|
41
|
+
tmpInport.handle = getPath(inp);
|
|
42
|
+
tmpInport.name = strtrim(getName(inp));
|
|
43
|
+
tmpInport.configs = codeSw;
|
|
44
|
+
for idx=1:length(info)
|
|
45
|
+
tmpValue = tl_get(inp, ['output.' info{idx}]);
|
|
46
|
+
tmpInport.(info{idx}) = getProperValue(inp, tmpValue);
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
tmpInport = modifyEnumStructField(tmpInport);
|
|
50
|
+
|
|
51
|
+
if strcmp(tmpInport.name, fields(inPorts))
|
|
52
|
+
printf('Warning: inport %s is already defined', tmpInport.name);
|
|
53
|
+
printf(' signal will not be added again to the input signal');
|
|
54
|
+
else
|
|
55
|
+
inPorts.(tmpInport.name) = tmpInport;
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
function busInPorts = parseTLBusInPorts(root_subsystem, info)
|
|
61
|
+
foundBusInPorts = find_system(root_subsystem, 'FindAll', 'on', 'SearchDepth', 1, 'MaskType', 'TL_BusInport');
|
|
62
|
+
busInPorts = struct();
|
|
63
|
+
tmpInport = struct();
|
|
64
|
+
for idx=1:length(foundBusInPorts)
|
|
65
|
+
inp = foundBusInPorts(idx);
|
|
66
|
+
for idy = 1:tl_get(inp, 'numoutputs')
|
|
67
|
+
tmpInport.handle = getPath(inp);
|
|
68
|
+
tmpInport.name = tl_get(inp, ['output(' num2str(idy) ').signalname']);
|
|
69
|
+
tmpInport.configs = getBusConfig(inp);
|
|
70
|
+
for idz=1:length(info)
|
|
71
|
+
tmpValue = tl_get(inp, ['output(' num2str(idy) ').' info{idz}]);
|
|
72
|
+
tmpInport.(info{idz}) = getProperValue(inp, tmpValue);
|
|
73
|
+
end
|
|
74
|
+
% TODO Fix later, cannot set width in TL_BusInport:s due to "matrix unified output".
|
|
75
|
+
tmpInport.width = 1;
|
|
76
|
+
|
|
77
|
+
tmpInport = modifyEnumStructField(tmpInport);
|
|
78
|
+
|
|
79
|
+
busParts = split(tmpInport.name, '.');
|
|
80
|
+
if ~ismember(busParts{1}, fields(busInPorts))
|
|
81
|
+
busInPorts.(busParts{1}) = struct();
|
|
82
|
+
busInPorts.(busParts{1}).(busParts{2}) = tmpInport;
|
|
83
|
+
elseif ~ismember(busParts{2}, fields(busInPorts.(busParts{1})))
|
|
84
|
+
busInPorts.(busParts{1}).(busParts{2}) = tmpInport;
|
|
85
|
+
else
|
|
86
|
+
printf('Warning: inport %s is already defined', tmpInport.name);
|
|
87
|
+
printf(' signal will not be added again to the input signal');
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
function busConfig = getBusConfig(inp)
|
|
94
|
+
consumerBlks = getConsumerBlocks(inp);
|
|
95
|
+
codeSwTmp = {};
|
|
96
|
+
for idx=1:length(consumerBlks)
|
|
97
|
+
consBlk = consumerBlks(idx);
|
|
98
|
+
codeSwTmp{idx} = getCodeSwitches(consBlk);
|
|
99
|
+
end
|
|
100
|
+
%TODO: Do a better reduction of code switch logics right now only duplicates are removed.
|
|
101
|
+
busConfig = removeConfigDuplicates(codeSwTmp);
|
|
102
|
+
isValidConfig = iscell(busConfig) && length(busConfig) == 1 && strcmp(busConfig{1}, 'all');
|
|
103
|
+
if ~isValidConfig
|
|
104
|
+
error('Code switching bus inports is currently not supported. All bus inport destinations must be active.')
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function includeConfigs = parseIncludeConfigs(model, cfgFolder)
|
|
5
|
-
% parseIncludeConfigs Create include section for configs
|
|
6
|
-
%
|
|
7
|
-
% Look in the config folder for related configs.
|
|
8
|
-
% This is used for models with handwritten c-code,
|
|
9
|
-
% where the c-code handles nvm-signals, calibration, etc.
|
|
10
|
-
%
|
|
11
|
-
% See also parseModelInfo
|
|
12
|
-
includeConfigs = {};
|
|
13
|
-
if nargin<1
|
|
14
|
-
return
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
json_files = dir([cfgFolder '/config_*.json']);
|
|
18
|
-
for json_file=json_files'
|
|
19
|
-
if strcmp(['config_' model '.json'], json_file.name)
|
|
20
|
-
continue
|
|
21
|
-
end
|
|
22
|
-
include_start = length('config_') + 1;
|
|
23
|
-
include_end = length('.json');
|
|
24
|
-
includeConfigs{end+1} = json_file.name(include_start:end-include_end);
|
|
25
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function includeConfigs = parseIncludeConfigs(model, cfgFolder)
|
|
5
|
+
% parseIncludeConfigs Create include section for configs
|
|
6
|
+
%
|
|
7
|
+
% Look in the config folder for related configs.
|
|
8
|
+
% This is used for models with handwritten c-code,
|
|
9
|
+
% where the c-code handles nvm-signals, calibration, etc.
|
|
10
|
+
%
|
|
11
|
+
% See also parseModelInfo
|
|
12
|
+
includeConfigs = {};
|
|
13
|
+
if nargin<1
|
|
14
|
+
return
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
json_files = dir([cfgFolder '/config_*.json']);
|
|
18
|
+
for json_file=json_files'
|
|
19
|
+
if strcmp(['config_' model '.json'], json_file.name)
|
|
20
|
+
continue
|
|
21
|
+
end
|
|
22
|
+
include_start = length('config_') + 1;
|
|
23
|
+
include_end = length('.json');
|
|
24
|
+
includeConfigs{end+1} = json_file.name(include_start:end-include_end);
|
|
25
|
+
end
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function [ output_args ] = parseModelInfo(rootFolder, model, cfgFolder)
|
|
5
|
-
% parseModelInfo Extract unit-config data from model
|
|
6
|
-
%
|
|
7
|
-
% Parse the model and create a structure that can be used to create
|
|
8
|
-
% a config file for the model.
|
|
9
|
-
%
|
|
10
|
-
% See also parseIncludeConfigs parseOutPorts parseInPorts parseCoreIdentifiers
|
|
11
|
-
% parseDIDs parseNVM parsePreProcBlks parseCalMeasData
|
|
12
|
-
|
|
13
|
-
tic;
|
|
14
|
-
load_system(model)
|
|
15
|
-
% Trigger "update model" command.
|
|
16
|
-
% This was added as a workaround for an inconsistent model.
|
|
17
|
-
% TODO: Check if it is still needed.
|
|
18
|
-
% set_param(model, 'SimulationCommand', 'Update');
|
|
19
|
-
%
|
|
20
|
-
root_subsystem = topLevelSystem(model);
|
|
21
|
-
output_args = struct();
|
|
22
|
-
|
|
23
|
-
% Version below should match the "config_version" of PyBuild, major must match.
|
|
24
|
-
% If they don't match, this script (and more?) may require updates.
|
|
25
|
-
output_args.version = '0.2.1';
|
|
26
|
-
output_args.includes = parseIncludeConfigs(model, cfgFolder);
|
|
27
|
-
output_args.integrity_level = getAsilClassification(rootFolder, model);
|
|
28
|
-
output_args.outports = parseOutPorts(root_subsystem);
|
|
29
|
-
output_args.inports = parseInPorts(root_subsystem);
|
|
30
|
-
output_args.core = parseCoreIdentifiers(model);
|
|
31
|
-
output_args.dids = parseDIDs(model);
|
|
32
|
-
output_args.nvm = parseNVM(model);
|
|
33
|
-
output_args.pre_procs = parsePreProcBlks(model);
|
|
34
|
-
tmp=parseCalMeasData(model);
|
|
35
|
-
output_args.local_vars = tmp.local_vars;
|
|
36
|
-
output_args.calib_consts = tmp.calib_consts;
|
|
37
|
-
toc
|
|
38
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function [ output_args ] = parseModelInfo(rootFolder, model, cfgFolder)
|
|
5
|
+
% parseModelInfo Extract unit-config data from model
|
|
6
|
+
%
|
|
7
|
+
% Parse the model and create a structure that can be used to create
|
|
8
|
+
% a config file for the model.
|
|
9
|
+
%
|
|
10
|
+
% See also parseIncludeConfigs parseOutPorts parseInPorts parseCoreIdentifiers
|
|
11
|
+
% parseDIDs parseNVM parsePreProcBlks parseCalMeasData
|
|
12
|
+
|
|
13
|
+
tic;
|
|
14
|
+
load_system(model)
|
|
15
|
+
% Trigger "update model" command.
|
|
16
|
+
% This was added as a workaround for an inconsistent model.
|
|
17
|
+
% TODO: Check if it is still needed.
|
|
18
|
+
% set_param(model, 'SimulationCommand', 'Update');
|
|
19
|
+
%
|
|
20
|
+
root_subsystem = topLevelSystem(model);
|
|
21
|
+
output_args = struct();
|
|
22
|
+
|
|
23
|
+
% Version below should match the "config_version" of PyBuild, major must match.
|
|
24
|
+
% If they don't match, this script (and more?) may require updates.
|
|
25
|
+
output_args.version = '0.2.1';
|
|
26
|
+
output_args.includes = parseIncludeConfigs(model, cfgFolder);
|
|
27
|
+
output_args.integrity_level = getAsilClassification(rootFolder, model);
|
|
28
|
+
output_args.outports = parseOutPorts(root_subsystem);
|
|
29
|
+
output_args.inports = parseInPorts(root_subsystem);
|
|
30
|
+
output_args.core = parseCoreIdentifiers(model);
|
|
31
|
+
output_args.dids = parseDIDs(model);
|
|
32
|
+
output_args.nvm = parseNVM(model);
|
|
33
|
+
output_args.pre_procs = parsePreProcBlks(model);
|
|
34
|
+
tmp=parseCalMeasData(model);
|
|
35
|
+
output_args.local_vars = tmp.local_vars;
|
|
36
|
+
output_args.calib_consts = tmp.calib_consts;
|
|
37
|
+
toc
|
|
38
|
+
end
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function nvm = parseNVM(model)
|
|
5
|
-
% parseNVM Parse all the NVM-ram blocks used in the model
|
|
6
|
-
% and return a struct with which ram-cells there are, and in
|
|
7
|
-
% which configurations they are present
|
|
8
|
-
%
|
|
9
|
-
% See also parseModelInfo
|
|
10
|
-
|
|
11
|
-
%TODO: add looking for NVM class in stateflow!!
|
|
12
|
-
|
|
13
|
-
outp_and_data_stores = find_system(model, 'FindAll', 'on', 'LookUnderMasks', 'all', ...
|
|
14
|
-
'RegExp', 'On', 'MaskType', 'TL_DataStoreMemory|TL_Outport');
|
|
15
|
-
unit_delays = find_system(model, 'FindAll', 'on', 'LookUnderMasks', 'all', ...
|
|
16
|
-
'RegExp', 'On', 'MaskType', 'TL_UnitDelay');
|
|
17
|
-
|
|
18
|
-
nvm = struct();
|
|
19
|
-
for i=1:length(outp_and_data_stores)
|
|
20
|
-
dstore_h = outp_and_data_stores(i);
|
|
21
|
-
class = tl_get(dstore_h,'output.class');
|
|
22
|
-
name = tl_get(dstore_h,'output.name');
|
|
23
|
-
if ~isempty(regexp(class, 'CVC_DISP_NVM(_P){0,1}', 'tokens'))
|
|
24
|
-
nvm = getParams(dstore_h, class, name, nvm);
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
for i=1:length(unit_delays)
|
|
28
|
-
udel_h = unit_delays(i);
|
|
29
|
-
class_tmp = tl_get(udel_h, 'output.class');
|
|
30
|
-
state = tl_get(udel_h, 'state.class');
|
|
31
|
-
if ~isempty(regexp(class_tmp, 'CVC_DISP_NVM(_P){0,1}', 'tokens'))
|
|
32
|
-
class = class_tmp;
|
|
33
|
-
name = tl_get(udel_h, 'output.name');
|
|
34
|
-
elseif ~isempty(state) && ~isempty(regexp(state, 'CVC_DISP_NVM(_P){0,1}', 'tokens'))
|
|
35
|
-
class = state;
|
|
36
|
-
name = tl_get(udel_h, 'state.name');
|
|
37
|
-
else
|
|
38
|
-
class = '';
|
|
39
|
-
end
|
|
40
|
-
if ~isempty(class)
|
|
41
|
-
nvm = getParams(udel_h, class, name, nvm);
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
function nvm = getParams(blk_handle, class, name, nvm)
|
|
47
|
-
info = {'description', 'type', 'unit', 'offset', 'lsb', 'min', 'max', 'width'};
|
|
48
|
-
tmpNvm = struct();
|
|
49
|
-
tmpNvm.handle = getPath(blk_handle);
|
|
50
|
-
tmpNvm.name = getName(blk_handle, name);
|
|
51
|
-
config = getCodeSwitches(blk_handle);
|
|
52
|
-
if ismember(tmpNvm.name, fields(nvm))
|
|
53
|
-
% Merge new configs with old
|
|
54
|
-
tmpConfigs = nvm.(tmpNvm.name).configs;
|
|
55
|
-
tmpConfigs{end+1} = config;
|
|
56
|
-
tmpNvm.configs = removeConfigDuplicates(tmpConfigs);
|
|
57
|
-
else
|
|
58
|
-
% Always require nvm configs to be formatted in or+and+expression syntax
|
|
59
|
-
tmpNvm.configs = {config};
|
|
60
|
-
end
|
|
61
|
-
tmpNvm.class = class;
|
|
62
|
-
for idx=1:length(info)
|
|
63
|
-
tmpNvm.(info{idx}) = chkNan(tl_get(blk_handle, ['output.' info{idx}]));
|
|
64
|
-
end
|
|
65
|
-
% Overwrite potential old nvm block with new configs
|
|
66
|
-
nvm.(tmpNvm.name) = tmpNvm;
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
function res = chkNan(value)
|
|
70
|
-
% Function which replaces NaN or empty fields with '-'
|
|
71
|
-
if ~ischar(value)
|
|
72
|
-
if isnan(value)
|
|
73
|
-
res = '-';
|
|
74
|
-
elseif isempty(value)
|
|
75
|
-
res = '-';
|
|
76
|
-
else
|
|
77
|
-
res = num2str(value);
|
|
78
|
-
end
|
|
79
|
-
else
|
|
80
|
-
res = value;
|
|
81
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function nvm = parseNVM(model)
|
|
5
|
+
% parseNVM Parse all the NVM-ram blocks used in the model
|
|
6
|
+
% and return a struct with which ram-cells there are, and in
|
|
7
|
+
% which configurations they are present
|
|
8
|
+
%
|
|
9
|
+
% See also parseModelInfo
|
|
10
|
+
|
|
11
|
+
%TODO: add looking for NVM class in stateflow!!
|
|
12
|
+
|
|
13
|
+
outp_and_data_stores = find_system(model, 'FindAll', 'on', 'LookUnderMasks', 'all', ...
|
|
14
|
+
'RegExp', 'On', 'MaskType', 'TL_DataStoreMemory|TL_Outport');
|
|
15
|
+
unit_delays = find_system(model, 'FindAll', 'on', 'LookUnderMasks', 'all', ...
|
|
16
|
+
'RegExp', 'On', 'MaskType', 'TL_UnitDelay');
|
|
17
|
+
|
|
18
|
+
nvm = struct();
|
|
19
|
+
for i=1:length(outp_and_data_stores)
|
|
20
|
+
dstore_h = outp_and_data_stores(i);
|
|
21
|
+
class = tl_get(dstore_h,'output.class');
|
|
22
|
+
name = tl_get(dstore_h,'output.name');
|
|
23
|
+
if ~isempty(regexp(class, 'CVC_DISP_NVM(_P){0,1}', 'tokens'))
|
|
24
|
+
nvm = getParams(dstore_h, class, name, nvm);
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
for i=1:length(unit_delays)
|
|
28
|
+
udel_h = unit_delays(i);
|
|
29
|
+
class_tmp = tl_get(udel_h, 'output.class');
|
|
30
|
+
state = tl_get(udel_h, 'state.class');
|
|
31
|
+
if ~isempty(regexp(class_tmp, 'CVC_DISP_NVM(_P){0,1}', 'tokens'))
|
|
32
|
+
class = class_tmp;
|
|
33
|
+
name = tl_get(udel_h, 'output.name');
|
|
34
|
+
elseif ~isempty(state) && ~isempty(regexp(state, 'CVC_DISP_NVM(_P){0,1}', 'tokens'))
|
|
35
|
+
class = state;
|
|
36
|
+
name = tl_get(udel_h, 'state.name');
|
|
37
|
+
else
|
|
38
|
+
class = '';
|
|
39
|
+
end
|
|
40
|
+
if ~isempty(class)
|
|
41
|
+
nvm = getParams(udel_h, class, name, nvm);
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
function nvm = getParams(blk_handle, class, name, nvm)
|
|
47
|
+
info = {'description', 'type', 'unit', 'offset', 'lsb', 'min', 'max', 'width'};
|
|
48
|
+
tmpNvm = struct();
|
|
49
|
+
tmpNvm.handle = getPath(blk_handle);
|
|
50
|
+
tmpNvm.name = getName(blk_handle, name);
|
|
51
|
+
config = getCodeSwitches(blk_handle);
|
|
52
|
+
if ismember(tmpNvm.name, fields(nvm))
|
|
53
|
+
% Merge new configs with old
|
|
54
|
+
tmpConfigs = nvm.(tmpNvm.name).configs;
|
|
55
|
+
tmpConfigs{end+1} = config;
|
|
56
|
+
tmpNvm.configs = removeConfigDuplicates(tmpConfigs);
|
|
57
|
+
else
|
|
58
|
+
% Always require nvm configs to be formatted in or+and+expression syntax
|
|
59
|
+
tmpNvm.configs = {config};
|
|
60
|
+
end
|
|
61
|
+
tmpNvm.class = class;
|
|
62
|
+
for idx=1:length(info)
|
|
63
|
+
tmpNvm.(info{idx}) = chkNan(tl_get(blk_handle, ['output.' info{idx}]));
|
|
64
|
+
end
|
|
65
|
+
% Overwrite potential old nvm block with new configs
|
|
66
|
+
nvm.(tmpNvm.name) = tmpNvm;
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
function res = chkNan(value)
|
|
70
|
+
% Function which replaces NaN or empty fields with '-'
|
|
71
|
+
if ~ischar(value)
|
|
72
|
+
if isnan(value)
|
|
73
|
+
res = '-';
|
|
74
|
+
elseif isempty(value)
|
|
75
|
+
res = '-';
|
|
76
|
+
else
|
|
77
|
+
res = num2str(value);
|
|
78
|
+
end
|
|
79
|
+
else
|
|
80
|
+
res = value;
|
|
81
|
+
end
|
|
82
82
|
end
|