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,34 +1,34 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function Data = Read_Units()
|
|
5
|
-
% READ_UNITS Reads and return table in SPM_Units.xls sheet
|
|
6
|
-
% This function reads using xlsxread 'basic' mode, which does not require
|
|
7
|
-
% excel automation to run, i.e. it should never crash a server.
|
|
8
|
-
|
|
9
|
-
% Turn off warning due to using xlsread in 'basic' mode
|
|
10
|
-
wState = warning('off', 'MATLAB:xlsread:Mode');
|
|
11
|
-
|
|
12
|
-
ex = [];
|
|
13
|
-
try
|
|
14
|
-
[~, rawData] = xlsread('SPM_Units', 'Sheet1', '', 'basic');
|
|
15
|
-
catch ex
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
% Restore warnings and re-raise possible errors
|
|
19
|
-
warning(wState);
|
|
20
|
-
if ~isempty(ex)
|
|
21
|
-
rethrow(ex);
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
% Find data columns
|
|
25
|
-
[rHead, cAbbr] = find(strcmp(rawData, 'Abbreviation'), 1);
|
|
26
|
-
[~, cMean] = find(strcmp(rawData, 'Meaning'), 1);
|
|
27
|
-
[~, cUnit] = find(cellfun(@any, strfind(rawData, 'Unit')), 1); % contains 'Unit'
|
|
28
|
-
|
|
29
|
-
% Find start of data: first value in abbreviation column
|
|
30
|
-
rData = rHead + find(cellfun(@any, rawData(rHead+1:end,cAbbr)), 1);
|
|
31
|
-
|
|
32
|
-
% Return data structure as cell array
|
|
33
|
-
Data = strtrim(rawData(rData:end, [cAbbr, cMean, cUnit]));
|
|
34
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function Data = Read_Units()
|
|
5
|
+
% READ_UNITS Reads and return table in SPM_Units.xls sheet
|
|
6
|
+
% This function reads using xlsxread 'basic' mode, which does not require
|
|
7
|
+
% excel automation to run, i.e. it should never crash a server.
|
|
8
|
+
|
|
9
|
+
% Turn off warning due to using xlsread in 'basic' mode
|
|
10
|
+
wState = warning('off', 'MATLAB:xlsread:Mode');
|
|
11
|
+
|
|
12
|
+
ex = [];
|
|
13
|
+
try
|
|
14
|
+
[~, rawData] = xlsread('SPM_Units', 'Sheet1', '', 'basic');
|
|
15
|
+
catch ex
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
% Restore warnings and re-raise possible errors
|
|
19
|
+
warning(wState);
|
|
20
|
+
if ~isempty(ex)
|
|
21
|
+
rethrow(ex);
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
% Find data columns
|
|
25
|
+
[rHead, cAbbr] = find(strcmp(rawData, 'Abbreviation'), 1);
|
|
26
|
+
[~, cMean] = find(strcmp(rawData, 'Meaning'), 1);
|
|
27
|
+
[~, cUnit] = find(cellfun(@any, strfind(rawData, 'Unit')), 1); % contains 'Unit'
|
|
28
|
+
|
|
29
|
+
% Find start of data: first value in abbreviation column
|
|
30
|
+
rData = rHead + find(cellfun(@any, rawData(rHead+1:end,cAbbr)), 1);
|
|
31
|
+
|
|
32
|
+
% Return data structure as cell array
|
|
33
|
+
Data = strtrim(rawData(rData:end, [cAbbr, cMean, cUnit]));
|
|
34
|
+
end
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function IncludedFunctions = SetProjectTimeSamples(MaxRefreshRate, Models)
|
|
5
|
-
validModels = fieldnames(Models);
|
|
6
|
-
includedModels = {};
|
|
7
|
-
fields = fieldnames(MaxRefreshRate);
|
|
8
|
-
ts = struct;
|
|
9
|
-
for field = fields'
|
|
10
|
-
if strcmp(field{1}, 'SampleTimes')
|
|
11
|
-
continue
|
|
12
|
-
else
|
|
13
|
-
rasterName = field{1};
|
|
14
|
-
end
|
|
15
|
-
raster = MaxRefreshRate.(rasterName);
|
|
16
|
-
for included_function = raster'
|
|
17
|
-
if ismember(included_function, validModels)
|
|
18
|
-
includedModels{end+1,1} = included_function{1};
|
|
19
|
-
ts.(included_function{1}) = MaxRefreshRate.SampleTimes.(rasterName);
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
IncludedFunctions = struct();
|
|
24
|
-
for included_model = unique(includedModels)'
|
|
25
|
-
IncludedFunctions.(included_model{1}) = struct;
|
|
26
|
-
IncludedFunctions.(included_model{1}).ts = ts.(included_model{1});
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function IncludedFunctions = SetProjectTimeSamples(MaxRefreshRate, Models)
|
|
5
|
+
validModels = fieldnames(Models);
|
|
6
|
+
includedModels = {};
|
|
7
|
+
fields = fieldnames(MaxRefreshRate);
|
|
8
|
+
ts = struct;
|
|
9
|
+
for field = fields'
|
|
10
|
+
if strcmp(field{1}, 'SampleTimes')
|
|
11
|
+
continue
|
|
12
|
+
else
|
|
13
|
+
rasterName = field{1};
|
|
14
|
+
end
|
|
15
|
+
raster = MaxRefreshRate.(rasterName);
|
|
16
|
+
for included_function = raster'
|
|
17
|
+
if ismember(included_function, validModels)
|
|
18
|
+
includedModels{end+1,1} = included_function{1};
|
|
19
|
+
ts.(included_function{1}) = MaxRefreshRate.SampleTimes.(rasterName);
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
IncludedFunctions = struct();
|
|
24
|
+
for included_model = unique(includedModels)'
|
|
25
|
+
IncludedFunctions.(included_model{1}) = struct;
|
|
26
|
+
IncludedFunctions.(included_model{1}).ts = ts.(included_model{1});
|
|
27
27
|
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function result = Strip_Suffix(fileName)
|
|
5
|
-
% Some file names have a version suffix, remove that first
|
|
6
|
-
underscoreIndex = strfind(fileName, '__');
|
|
7
|
-
if isempty(underscoreIndex)
|
|
8
|
-
result = fileName;
|
|
9
|
-
else
|
|
10
|
-
if strcmp(version('-release'),'2011b')
|
|
11
|
-
result = fileName(1:underscoreIndex-1);
|
|
12
|
-
else
|
|
13
|
-
result = extractBefore(fileName,underscoreIndex);
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function result = Strip_Suffix(fileName)
|
|
5
|
+
% Some file names have a version suffix, remove that first
|
|
6
|
+
underscoreIndex = strfind(fileName, '__');
|
|
7
|
+
if isempty(underscoreIndex)
|
|
8
|
+
result = fileName;
|
|
9
|
+
else
|
|
10
|
+
if strcmp(version('-release'),'2011b')
|
|
11
|
+
result = fileName(1:underscoreIndex-1);
|
|
12
|
+
else
|
|
13
|
+
result = extractBefore(fileName,underscoreIndex);
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function [res_blk, res_ports] = followLink(startBlock, startPort)
|
|
5
|
-
% Follow the links until a block is found
|
|
6
|
-
% or multiple paths are encountered
|
|
7
|
-
if nargin == 1
|
|
8
|
-
tmpDstBlock = getDstBlocks(startBlock);
|
|
9
|
-
tmpPort = get(getDstLines(startBlock), 'DstPortHandle');
|
|
10
|
-
if iscell(tmpPort)
|
|
11
|
-
tmpPort = vertcat(tmpPort{:});
|
|
12
|
-
end
|
|
13
|
-
else
|
|
14
|
-
tmpDstBlock = startBlock;
|
|
15
|
-
tmpPort = startPort;
|
|
16
|
-
end
|
|
17
|
-
while 1
|
|
18
|
-
%% Check for invalid handle
|
|
19
|
-
if tmpDstBlock < 0
|
|
20
|
-
disp(['Warning: Port not connected: ' ...
|
|
21
|
-
getPath(startBlock)])
|
|
22
|
-
res_blk = -1;
|
|
23
|
-
res_ports = -1;
|
|
24
|
-
break;
|
|
25
|
-
%% If multiple links were found
|
|
26
|
-
elseif length(tmpDstBlock) > 1
|
|
27
|
-
res_blk = tmpDstBlock;
|
|
28
|
-
res_ports = tmpPort;
|
|
29
|
-
break;
|
|
30
|
-
%% If the block is a inport
|
|
31
|
-
elseif strcmp(get_param(tmpDstBlock, 'blocktype'), 'Inport')
|
|
32
|
-
tmp=get_param(get_param(tmpDstBlock,'parent'), 'linehandles');
|
|
33
|
-
tmpPort=get_param(tmp.Inport(str2num(get_param(tmpDstBlock,'port'))), 'srcporthandle');
|
|
34
|
-
tmpDstBlock=get_param(tmp.Inport(str2num(get_param(tmpDstBlock,'port'))), 'srcblockhandle');
|
|
35
|
-
%% If the block is a outport
|
|
36
|
-
elseif strcmp(get_param(tmpDstBlock, 'blocktype'), 'Outport')
|
|
37
|
-
tmpParent=get_param(tmpDstBlock, 'parent');
|
|
38
|
-
% If were about to exit a block with an action port. Stop!
|
|
39
|
-
ph=get_param(tmpParent, 'PortHandles');
|
|
40
|
-
if ~isempty(ph.Ifaction) || ~isempty(ph.Enable)
|
|
41
|
-
res_blk = tmpDstBlock;
|
|
42
|
-
res_ports = tmpPort;
|
|
43
|
-
break;
|
|
44
|
-
end
|
|
45
|
-
tmp=get_param(tmpParent, 'linehandles');
|
|
46
|
-
tmpOutport = tmp.Outport(str2num(get_param(tmpDstBlock, 'port')));
|
|
47
|
-
if tmpOutport < 0
|
|
48
|
-
% Not connected. Stop!
|
|
49
|
-
res_blk = tmpDstBlock;
|
|
50
|
-
res_ports = tmpPort;
|
|
51
|
-
break;
|
|
52
|
-
end
|
|
53
|
-
tmpPort=get_param(tmpOutport, 'dstporthandle');
|
|
54
|
-
tmpDstBlock=get_param(tmpOutport, 'dstblockhandle');
|
|
55
|
-
%% If the block is a From-block
|
|
56
|
-
elseif strcmp(get_param(tmpDstBlock, 'blocktype'), 'Goto')
|
|
57
|
-
From=find_system(get_param(tmpDstBlock, 'parent'),'lookundermasks', ...
|
|
58
|
-
'on','searchdepth',1,'Findall','on', 'blocktype', ...
|
|
59
|
-
'From','GotoTag', get_param(tmpDstBlock,'GotoTag'));
|
|
60
|
-
if length(From > 0)
|
|
61
|
-
tmp=get_param(From, 'linehandles');
|
|
62
|
-
tmpLen = length(tmp);
|
|
63
|
-
%hanterar att det finns flera from block!!!
|
|
64
|
-
if tmpLen > 1
|
|
65
|
-
tmpPort = [];
|
|
66
|
-
tmpDstBlock = [];
|
|
67
|
-
for i=1:tmpLen
|
|
68
|
-
tmpPort = [tmpPort; get_param(tmp{i}.Outport, 'dstporthandle')];
|
|
69
|
-
tmpDstBlock = [tmpDstBlock; get_param(tmp{i}.Outport, 'dstblockhandle')];
|
|
70
|
-
end
|
|
71
|
-
else
|
|
72
|
-
tmpPort=get_param(tmp.Outport, 'dstporthandle');
|
|
73
|
-
tmpDstBlock=get_param(tmp.Outport, 'dstblockhandle');
|
|
74
|
-
end
|
|
75
|
-
else
|
|
76
|
-
disp(['Warning: Goto-block, without from here:' ...
|
|
77
|
-
getPath(tmpDstBlock)])
|
|
78
|
-
res_blk = -1;
|
|
79
|
-
res_ports = -1;
|
|
80
|
-
break;
|
|
81
|
-
end
|
|
82
|
-
%% If non masked subsystem
|
|
83
|
-
elseif checkSubsystem(tmpDstBlock) && ~strcmp(get(tmpPort,'PortType'), 'enable')
|
|
84
|
-
% kolla om subsystemet är maskat, eller om inporten är en enable port,
|
|
85
|
-
% om så är fallet hantera som ett vanligt block
|
|
86
|
-
inport=find_system(tmpDstBlock,'lookundermasks','on', ...
|
|
87
|
-
'searchdepth', 1, 'FindAll', 'on', ...
|
|
88
|
-
'blocktype','Inport', ...
|
|
89
|
-
'port', num2str(get(tmpPort,'PortNumber')));
|
|
90
|
-
tmpPort=get_param(getDstLines(inport), 'dstporthandle');
|
|
91
|
-
tmpDstBlock=getDstBlocks(inport);
|
|
92
|
-
else
|
|
93
|
-
res_blk = tmpDstBlock;
|
|
94
|
-
res_ports = tmpPort;
|
|
95
|
-
break;
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
function follow = checkSubsystem(block)
|
|
101
|
-
% checkSubsystem returns a bool
|
|
102
|
-
% true if followLink should continue inside the subsystem
|
|
103
|
-
% false if followLink should not continue inside the subsystem
|
|
104
|
-
follow = false;
|
|
105
|
-
% If the block is not a SubSystem, stop.
|
|
106
|
-
if strcmp(get_param(block,'blocktype'), 'SubSystem')
|
|
107
|
-
if isempty(get_param(block,'MaskType'))
|
|
108
|
-
% If the block is not masked, continue
|
|
109
|
-
follow = true;
|
|
110
|
-
else
|
|
111
|
-
blockFields = fields(get(block));
|
|
112
|
-
if ismember('FollowLinks', blockFields)
|
|
113
|
-
% If the block is masked, but has FollowLinks property
|
|
114
|
-
% 'on': continue
|
|
115
|
-
follow = strcmp(get_param(block,'FollowLinks'), 'on');
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function [res_blk, res_ports] = followLink(startBlock, startPort)
|
|
5
|
+
% Follow the links until a block is found
|
|
6
|
+
% or multiple paths are encountered
|
|
7
|
+
if nargin == 1
|
|
8
|
+
tmpDstBlock = getDstBlocks(startBlock);
|
|
9
|
+
tmpPort = get(getDstLines(startBlock), 'DstPortHandle');
|
|
10
|
+
if iscell(tmpPort)
|
|
11
|
+
tmpPort = vertcat(tmpPort{:});
|
|
12
|
+
end
|
|
13
|
+
else
|
|
14
|
+
tmpDstBlock = startBlock;
|
|
15
|
+
tmpPort = startPort;
|
|
16
|
+
end
|
|
17
|
+
while 1
|
|
18
|
+
%% Check for invalid handle
|
|
19
|
+
if tmpDstBlock < 0
|
|
20
|
+
disp(['Warning: Port not connected: ' ...
|
|
21
|
+
getPath(startBlock)])
|
|
22
|
+
res_blk = -1;
|
|
23
|
+
res_ports = -1;
|
|
24
|
+
break;
|
|
25
|
+
%% If multiple links were found
|
|
26
|
+
elseif length(tmpDstBlock) > 1
|
|
27
|
+
res_blk = tmpDstBlock;
|
|
28
|
+
res_ports = tmpPort;
|
|
29
|
+
break;
|
|
30
|
+
%% If the block is a inport
|
|
31
|
+
elseif strcmp(get_param(tmpDstBlock, 'blocktype'), 'Inport')
|
|
32
|
+
tmp=get_param(get_param(tmpDstBlock,'parent'), 'linehandles');
|
|
33
|
+
tmpPort=get_param(tmp.Inport(str2num(get_param(tmpDstBlock,'port'))), 'srcporthandle');
|
|
34
|
+
tmpDstBlock=get_param(tmp.Inport(str2num(get_param(tmpDstBlock,'port'))), 'srcblockhandle');
|
|
35
|
+
%% If the block is a outport
|
|
36
|
+
elseif strcmp(get_param(tmpDstBlock, 'blocktype'), 'Outport')
|
|
37
|
+
tmpParent=get_param(tmpDstBlock, 'parent');
|
|
38
|
+
% If were about to exit a block with an action port. Stop!
|
|
39
|
+
ph=get_param(tmpParent, 'PortHandles');
|
|
40
|
+
if ~isempty(ph.Ifaction) || ~isempty(ph.Enable)
|
|
41
|
+
res_blk = tmpDstBlock;
|
|
42
|
+
res_ports = tmpPort;
|
|
43
|
+
break;
|
|
44
|
+
end
|
|
45
|
+
tmp=get_param(tmpParent, 'linehandles');
|
|
46
|
+
tmpOutport = tmp.Outport(str2num(get_param(tmpDstBlock, 'port')));
|
|
47
|
+
if tmpOutport < 0
|
|
48
|
+
% Not connected. Stop!
|
|
49
|
+
res_blk = tmpDstBlock;
|
|
50
|
+
res_ports = tmpPort;
|
|
51
|
+
break;
|
|
52
|
+
end
|
|
53
|
+
tmpPort=get_param(tmpOutport, 'dstporthandle');
|
|
54
|
+
tmpDstBlock=get_param(tmpOutport, 'dstblockhandle');
|
|
55
|
+
%% If the block is a From-block
|
|
56
|
+
elseif strcmp(get_param(tmpDstBlock, 'blocktype'), 'Goto')
|
|
57
|
+
From=find_system(get_param(tmpDstBlock, 'parent'),'lookundermasks', ...
|
|
58
|
+
'on','searchdepth',1,'Findall','on', 'blocktype', ...
|
|
59
|
+
'From','GotoTag', get_param(tmpDstBlock,'GotoTag'));
|
|
60
|
+
if length(From > 0)
|
|
61
|
+
tmp=get_param(From, 'linehandles');
|
|
62
|
+
tmpLen = length(tmp);
|
|
63
|
+
%hanterar att det finns flera from block!!!
|
|
64
|
+
if tmpLen > 1
|
|
65
|
+
tmpPort = [];
|
|
66
|
+
tmpDstBlock = [];
|
|
67
|
+
for i=1:tmpLen
|
|
68
|
+
tmpPort = [tmpPort; get_param(tmp{i}.Outport, 'dstporthandle')];
|
|
69
|
+
tmpDstBlock = [tmpDstBlock; get_param(tmp{i}.Outport, 'dstblockhandle')];
|
|
70
|
+
end
|
|
71
|
+
else
|
|
72
|
+
tmpPort=get_param(tmp.Outport, 'dstporthandle');
|
|
73
|
+
tmpDstBlock=get_param(tmp.Outport, 'dstblockhandle');
|
|
74
|
+
end
|
|
75
|
+
else
|
|
76
|
+
disp(['Warning: Goto-block, without from here:' ...
|
|
77
|
+
getPath(tmpDstBlock)])
|
|
78
|
+
res_blk = -1;
|
|
79
|
+
res_ports = -1;
|
|
80
|
+
break;
|
|
81
|
+
end
|
|
82
|
+
%% If non masked subsystem
|
|
83
|
+
elseif checkSubsystem(tmpDstBlock) && ~strcmp(get(tmpPort,'PortType'), 'enable')
|
|
84
|
+
% kolla om subsystemet är maskat, eller om inporten är en enable port,
|
|
85
|
+
% om så är fallet hantera som ett vanligt block
|
|
86
|
+
inport=find_system(tmpDstBlock,'lookundermasks','on', ...
|
|
87
|
+
'searchdepth', 1, 'FindAll', 'on', ...
|
|
88
|
+
'blocktype','Inport', ...
|
|
89
|
+
'port', num2str(get(tmpPort,'PortNumber')));
|
|
90
|
+
tmpPort=get_param(getDstLines(inport), 'dstporthandle');
|
|
91
|
+
tmpDstBlock=getDstBlocks(inport);
|
|
92
|
+
else
|
|
93
|
+
res_blk = tmpDstBlock;
|
|
94
|
+
res_ports = tmpPort;
|
|
95
|
+
break;
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
function follow = checkSubsystem(block)
|
|
101
|
+
% checkSubsystem returns a bool
|
|
102
|
+
% true if followLink should continue inside the subsystem
|
|
103
|
+
% false if followLink should not continue inside the subsystem
|
|
104
|
+
follow = false;
|
|
105
|
+
% If the block is not a SubSystem, stop.
|
|
106
|
+
if strcmp(get_param(block,'blocktype'), 'SubSystem')
|
|
107
|
+
if isempty(get_param(block,'MaskType'))
|
|
108
|
+
% If the block is not masked, continue
|
|
109
|
+
follow = true;
|
|
110
|
+
else
|
|
111
|
+
blockFields = fields(get(block));
|
|
112
|
+
if ismember('FollowLinks', blockFields)
|
|
113
|
+
% If the block is masked, but has FollowLinks property
|
|
114
|
+
% 'on': continue
|
|
115
|
+
follow = strcmp(get_param(block,'FollowLinks'), 'on');
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
119
|
end
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function out = getCodeSwitches(handle, in)
|
|
5
|
-
% recursivly find if there are any configuration switches affecting
|
|
6
|
-
% the block "handle"
|
|
7
|
-
if nargin == 1
|
|
8
|
-
in = {};
|
|
9
|
-
end
|
|
10
|
-
parent = get_param(handle, 'Parent');
|
|
11
|
-
if ~isempty(strfind(parent, '/'))
|
|
12
|
-
ph = get_param(parent, 'PortHandles');
|
|
13
|
-
if ~isempty(ph.Ifaction)
|
|
14
|
-
l=get_param(ph.Ifaction,'Line');
|
|
15
|
-
sbh=get_param(l,'SrcBlockHandle');
|
|
16
|
-
sbp=get_param(l,'SrcPort');
|
|
17
|
-
%hilite_system(sbh);
|
|
18
|
-
mt=get_param(sbh,'MaskType');
|
|
19
|
-
if strcmp(mt,'TL_PreProcessorIf')
|
|
20
|
-
ports = get_param(sbh, 'PortHandles');
|
|
21
|
-
l=get_param(ports.Inport, 'Line');
|
|
22
|
-
blk = get_param(l, 'SrcBlockHandle');
|
|
23
|
-
if strcmp(get_param(blk, 'BlockType'), 'Inport')
|
|
24
|
-
tmp=get_param(get_param(blk, 'Parent'), 'LineHandles');
|
|
25
|
-
blk=get_param(tmp.Inport(str2num(get_param(blk, 'Port'))), 'SrcBlockHandle');
|
|
26
|
-
end
|
|
27
|
-
if_exp = tl_get(sbh, 'ifexpression');
|
|
28
|
-
if str2num(sbp)==2
|
|
29
|
-
if_exp = ['!(' if_exp ')'];
|
|
30
|
-
end
|
|
31
|
-
exp = strrep(if_exp,'u1',get_param(blk, 'const_name'));
|
|
32
|
-
in = [in; exp];
|
|
33
|
-
end
|
|
34
|
-
elseif ~isempty(ph.Enable)
|
|
35
|
-
l=get_param(ph.Enable,'Line');
|
|
36
|
-
sbh=get_param(l,'SrcBlockHandle');
|
|
37
|
-
mt=get_param(sbh,'MaskType');
|
|
38
|
-
if strcmp(mt,'PreProcessorName')
|
|
39
|
-
exp = get_param(sbh, 'const_name');
|
|
40
|
-
in = [in; exp];
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
in = getCodeSwitches(parent, in);
|
|
44
|
-
end
|
|
45
|
-
if length(in) > 0
|
|
46
|
-
out = in;
|
|
47
|
-
else
|
|
48
|
-
out = {'all'};
|
|
49
|
-
end
|
|
50
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function out = getCodeSwitches(handle, in)
|
|
5
|
+
% recursivly find if there are any configuration switches affecting
|
|
6
|
+
% the block "handle"
|
|
7
|
+
if nargin == 1
|
|
8
|
+
in = {};
|
|
9
|
+
end
|
|
10
|
+
parent = get_param(handle, 'Parent');
|
|
11
|
+
if ~isempty(strfind(parent, '/'))
|
|
12
|
+
ph = get_param(parent, 'PortHandles');
|
|
13
|
+
if ~isempty(ph.Ifaction)
|
|
14
|
+
l=get_param(ph.Ifaction,'Line');
|
|
15
|
+
sbh=get_param(l,'SrcBlockHandle');
|
|
16
|
+
sbp=get_param(l,'SrcPort');
|
|
17
|
+
%hilite_system(sbh);
|
|
18
|
+
mt=get_param(sbh,'MaskType');
|
|
19
|
+
if strcmp(mt,'TL_PreProcessorIf')
|
|
20
|
+
ports = get_param(sbh, 'PortHandles');
|
|
21
|
+
l=get_param(ports.Inport, 'Line');
|
|
22
|
+
blk = get_param(l, 'SrcBlockHandle');
|
|
23
|
+
if strcmp(get_param(blk, 'BlockType'), 'Inport')
|
|
24
|
+
tmp=get_param(get_param(blk, 'Parent'), 'LineHandles');
|
|
25
|
+
blk=get_param(tmp.Inport(str2num(get_param(blk, 'Port'))), 'SrcBlockHandle');
|
|
26
|
+
end
|
|
27
|
+
if_exp = tl_get(sbh, 'ifexpression');
|
|
28
|
+
if str2num(sbp)==2
|
|
29
|
+
if_exp = ['!(' if_exp ')'];
|
|
30
|
+
end
|
|
31
|
+
exp = strrep(if_exp,'u1',get_param(blk, 'const_name'));
|
|
32
|
+
in = [in; exp];
|
|
33
|
+
end
|
|
34
|
+
elseif ~isempty(ph.Enable)
|
|
35
|
+
l=get_param(ph.Enable,'Line');
|
|
36
|
+
sbh=get_param(l,'SrcBlockHandle');
|
|
37
|
+
mt=get_param(sbh,'MaskType');
|
|
38
|
+
if strcmp(mt,'PreProcessorName')
|
|
39
|
+
exp = get_param(sbh, 'const_name');
|
|
40
|
+
in = [in; exp];
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
in = getCodeSwitches(parent, in);
|
|
44
|
+
end
|
|
45
|
+
if length(in) > 0
|
|
46
|
+
out = in;
|
|
47
|
+
else
|
|
48
|
+
out = {'all'};
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function dstBlocks = getConsumerBlocks(startBlock, port)
|
|
5
|
-
%% Find the blocks where the Input port variable are consumed
|
|
6
|
-
%% Returns an array with blockids
|
|
7
|
-
|
|
8
|
-
%Only use handles in this function
|
|
9
|
-
if ischar(startBlock)
|
|
10
|
-
startBlock = get_param(startBlock,'Handle');
|
|
11
|
-
end
|
|
12
|
-
dstBlocks = [];
|
|
13
|
-
if nargin == 1
|
|
14
|
-
%in = [];
|
|
15
|
-
[dstBlks, dstPorts] = followLink(startBlock);
|
|
16
|
-
else
|
|
17
|
-
[dstBlks, dstPorts] = followLink(startBlock, port);
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
dstBlksLen = length(dstBlks);
|
|
21
|
-
if dstBlksLen > 1
|
|
22
|
-
for i=1:dstBlksLen
|
|
23
|
-
res = getConsumerBlocks(dstBlks(i), dstPorts(i));
|
|
24
|
-
dstBlocks = [dstBlocks res];
|
|
25
|
-
end
|
|
26
|
-
% only add a dst block if they exists.
|
|
27
|
-
elseif dstBlks > 0
|
|
28
|
-
dstBlocks = dstBlks;
|
|
29
|
-
end
|
|
30
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function dstBlocks = getConsumerBlocks(startBlock, port)
|
|
5
|
+
%% Find the blocks where the Input port variable are consumed
|
|
6
|
+
%% Returns an array with blockids
|
|
7
|
+
|
|
8
|
+
%Only use handles in this function
|
|
9
|
+
if ischar(startBlock)
|
|
10
|
+
startBlock = get_param(startBlock,'Handle');
|
|
11
|
+
end
|
|
12
|
+
dstBlocks = [];
|
|
13
|
+
if nargin == 1
|
|
14
|
+
%in = [];
|
|
15
|
+
[dstBlks, dstPorts] = followLink(startBlock);
|
|
16
|
+
else
|
|
17
|
+
[dstBlks, dstPorts] = followLink(startBlock, port);
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
dstBlksLen = length(dstBlks);
|
|
21
|
+
if dstBlksLen > 1
|
|
22
|
+
for i=1:dstBlksLen
|
|
23
|
+
res = getConsumerBlocks(dstBlks(i), dstPorts(i));
|
|
24
|
+
dstBlocks = [dstBlocks res];
|
|
25
|
+
end
|
|
26
|
+
% only add a dst block if they exists.
|
|
27
|
+
elseif dstBlks > 0
|
|
28
|
+
dstBlocks = dstBlks;
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
% Copyright 2024 Volvo Car Corporation
|
|
2
|
-
% Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
function tmpSrcBlock = getDefBlock(varargin)
|
|
5
|
-
%% Find the blocks where the input variables are defined
|
|
6
|
-
if length(varargin) == 1
|
|
7
|
-
startBlock = varargin{1};
|
|
8
|
-
tmpSrcBlock = getSrcBlocks(startBlock);
|
|
9
|
-
tmpPort = get(getSrcLines(startBlock),'srcporthandle');
|
|
10
|
-
elseif length(varargin) == 2
|
|
11
|
-
tmpSrcBlock = varargin{1};
|
|
12
|
-
tmpPort = varargin{2};
|
|
13
|
-
else
|
|
14
|
-
error('Wrong number of input arguments')
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
while 1
|
|
18
|
-
%% If the block is a inport, but not a TL-port
|
|
19
|
-
if strcmp(get_param(tmpSrcBlock,'blocktype'),'Inport') && isempty(get_param(tmpSrcBlock,'MaskType'))
|
|
20
|
-
tmp=get_param(get_param(tmpSrcBlock,'parent'),'linehandles');
|
|
21
|
-
tmpPort=get_param(tmp.Inport(str2num(get_param(tmpSrcBlock,'port'))),'srcporthandle');
|
|
22
|
-
tmpSrcBlock=get_param(tmp.Inport(str2num(get_param(tmpSrcBlock,'port'))),'srcblockhandle');
|
|
23
|
-
|
|
24
|
-
%% If the block is a From-block
|
|
25
|
-
elseif strcmp(get_param(tmpSrcBlock,'blocktype'),'From')
|
|
26
|
-
goto=find_system(get_param(tmpSrcBlock,'parent'),'lookundermasks','on','searchdepth',1,'blocktype','Goto','GotoTag',get_param(tmpSrcBlock,'GotoTag'));
|
|
27
|
-
tmp=get_param(goto{1},'linehandles');
|
|
28
|
-
tmpPort=get_param(tmp.Inport,'srcporthandle');
|
|
29
|
-
tmpSrcBlock=get_param(tmp.Inport,'srcblockhandle');
|
|
30
|
-
|
|
31
|
-
%% If subsystem
|
|
32
|
-
elseif strcmp(get_param(tmpSrcBlock,'blocktype'),'SubSystem')
|
|
33
|
-
outport=find_system(tmpSrcBlock,'followlinks', 'on', 'lookundermasks','on','searchdepth',1,'blocktype','Outport','port', num2str(get(tmpPort,'PortNumber')));
|
|
34
|
-
tmpPort=get_param(getSrcLines(outport),'srcporthandle');
|
|
35
|
-
tmpSrcBlock=getSrcBlocks(outport);
|
|
36
|
-
else
|
|
37
|
-
break
|
|
38
|
-
end
|
|
39
|
-
end
|
|
1
|
+
% Copyright 2024 Volvo Car Corporation
|
|
2
|
+
% Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
function tmpSrcBlock = getDefBlock(varargin)
|
|
5
|
+
%% Find the blocks where the input variables are defined
|
|
6
|
+
if length(varargin) == 1
|
|
7
|
+
startBlock = varargin{1};
|
|
8
|
+
tmpSrcBlock = getSrcBlocks(startBlock);
|
|
9
|
+
tmpPort = get(getSrcLines(startBlock),'srcporthandle');
|
|
10
|
+
elseif length(varargin) == 2
|
|
11
|
+
tmpSrcBlock = varargin{1};
|
|
12
|
+
tmpPort = varargin{2};
|
|
13
|
+
else
|
|
14
|
+
error('Wrong number of input arguments')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
while 1
|
|
18
|
+
%% If the block is a inport, but not a TL-port
|
|
19
|
+
if strcmp(get_param(tmpSrcBlock,'blocktype'),'Inport') && isempty(get_param(tmpSrcBlock,'MaskType'))
|
|
20
|
+
tmp=get_param(get_param(tmpSrcBlock,'parent'),'linehandles');
|
|
21
|
+
tmpPort=get_param(tmp.Inport(str2num(get_param(tmpSrcBlock,'port'))),'srcporthandle');
|
|
22
|
+
tmpSrcBlock=get_param(tmp.Inport(str2num(get_param(tmpSrcBlock,'port'))),'srcblockhandle');
|
|
23
|
+
|
|
24
|
+
%% If the block is a From-block
|
|
25
|
+
elseif strcmp(get_param(tmpSrcBlock,'blocktype'),'From')
|
|
26
|
+
goto=find_system(get_param(tmpSrcBlock,'parent'),'lookundermasks','on','searchdepth',1,'blocktype','Goto','GotoTag',get_param(tmpSrcBlock,'GotoTag'));
|
|
27
|
+
tmp=get_param(goto{1},'linehandles');
|
|
28
|
+
tmpPort=get_param(tmp.Inport,'srcporthandle');
|
|
29
|
+
tmpSrcBlock=get_param(tmp.Inport,'srcblockhandle');
|
|
30
|
+
|
|
31
|
+
%% If subsystem
|
|
32
|
+
elseif strcmp(get_param(tmpSrcBlock,'blocktype'),'SubSystem')
|
|
33
|
+
outport=find_system(tmpSrcBlock,'followlinks', 'on', 'lookundermasks','on','searchdepth',1,'blocktype','Outport','port', num2str(get(tmpPort,'PortNumber')));
|
|
34
|
+
tmpPort=get_param(getSrcLines(outport),'srcporthandle');
|
|
35
|
+
tmpSrcBlock=getSrcBlocks(outport);
|
|
36
|
+
else
|
|
37
|
+
break
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
40
|
end
|