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.
Files changed (132) hide show
  1. powertrain_build/__init__.py +40 -40
  2. powertrain_build/__main__.py +6 -6
  3. powertrain_build/a2l.py +582 -582
  4. powertrain_build/a2l_merge.py +650 -650
  5. powertrain_build/a2l_templates.py +717 -717
  6. powertrain_build/build.py +985 -985
  7. powertrain_build/build_defs.py +309 -309
  8. powertrain_build/build_proj_config.py +690 -690
  9. powertrain_build/check_interface.py +575 -575
  10. powertrain_build/cli.py +141 -141
  11. powertrain_build/config.py +542 -542
  12. powertrain_build/core.py +395 -395
  13. powertrain_build/core_dummy.py +343 -343
  14. powertrain_build/create_conversion_table.py +73 -73
  15. powertrain_build/dids.py +916 -916
  16. powertrain_build/dummy.py +157 -157
  17. powertrain_build/dummy_spm.py +252 -252
  18. powertrain_build/environmentcheck.py +52 -52
  19. powertrain_build/ext_dbg.py +255 -255
  20. powertrain_build/ext_var.py +327 -327
  21. powertrain_build/feature_configs.py +301 -301
  22. powertrain_build/gen_allsysteminfo.py +227 -227
  23. powertrain_build/gen_label_split.py +449 -449
  24. powertrain_build/handcode_replacer.py +124 -124
  25. powertrain_build/html_report.py +133 -133
  26. powertrain_build/interface/__init__.py +4 -4
  27. powertrain_build/interface/application.py +511 -511
  28. powertrain_build/interface/base.py +500 -500
  29. powertrain_build/interface/csp_api.py +490 -490
  30. powertrain_build/interface/device_proxy.py +677 -677
  31. powertrain_build/interface/ems.py +67 -67
  32. powertrain_build/interface/export_global_vars.py +121 -121
  33. powertrain_build/interface/generate_adapters.py +132 -132
  34. powertrain_build/interface/generate_hi_interface.py +87 -87
  35. powertrain_build/interface/generate_service.py +69 -69
  36. powertrain_build/interface/generate_wrappers.py +147 -147
  37. powertrain_build/interface/generation_utils.py +142 -142
  38. powertrain_build/interface/hal.py +194 -194
  39. powertrain_build/interface/model_yaml_verification.py +348 -348
  40. powertrain_build/interface/service.py +296 -296
  41. powertrain_build/interface/simulink.py +249 -249
  42. powertrain_build/interface/update_call_sources.py +180 -180
  43. powertrain_build/interface/update_model_yaml.py +186 -186
  44. powertrain_build/interface/zone_controller.py +362 -362
  45. powertrain_build/lib/__init__.py +4 -4
  46. powertrain_build/lib/helper_functions.py +127 -127
  47. powertrain_build/lib/logger.py +55 -55
  48. powertrain_build/matlab_scripts/CodeGen/BuildAutomationPyBuild.m +78 -78
  49. powertrain_build/matlab_scripts/CodeGen/Generate_A2L.m +154 -154
  50. powertrain_build/matlab_scripts/CodeGen/generateTLUnit.m +239 -239
  51. powertrain_build/matlab_scripts/CodeGen/getAsilClassification.m +28 -28
  52. powertrain_build/matlab_scripts/CodeGen/modelConfiguredForTL.m +28 -28
  53. powertrain_build/matlab_scripts/CodeGen/moveDefOutports.m +88 -88
  54. powertrain_build/matlab_scripts/CodeGen/parseCalMeasData.m +410 -410
  55. powertrain_build/matlab_scripts/CodeGen/parseCoreIdentifiers.m +139 -139
  56. powertrain_build/matlab_scripts/CodeGen/parseDIDs.m +141 -141
  57. powertrain_build/matlab_scripts/CodeGen/parseInPorts.m +106 -106
  58. powertrain_build/matlab_scripts/CodeGen/parseIncludeConfigs.m +25 -25
  59. powertrain_build/matlab_scripts/CodeGen/parseModelInfo.m +38 -38
  60. powertrain_build/matlab_scripts/CodeGen/parseNVM.m +81 -81
  61. powertrain_build/matlab_scripts/CodeGen/parseOutPorts.m +120 -120
  62. powertrain_build/matlab_scripts/CodeGen/parsePreProcBlks.m +23 -23
  63. powertrain_build/matlab_scripts/CodeGen/struct2JSON.m +128 -128
  64. powertrain_build/matlab_scripts/CodeGen/updateCodeSwConfig.m +31 -31
  65. powertrain_build/matlab_scripts/Init_PyBuild.m +91 -91
  66. powertrain_build/matlab_scripts/__init__.py +2 -2
  67. powertrain_build/matlab_scripts/helperFunctions/Get_Full_Name.m +46 -46
  68. powertrain_build/matlab_scripts/helperFunctions/Get_SrcLines.m +12 -12
  69. powertrain_build/matlab_scripts/helperFunctions/Init_Models.m +78 -78
  70. powertrain_build/matlab_scripts/helperFunctions/Init_Projects.m +67 -67
  71. powertrain_build/matlab_scripts/helperFunctions/Read_Units.m +34 -34
  72. powertrain_build/matlab_scripts/helperFunctions/SetProjectTimeSamples.m +26 -26
  73. powertrain_build/matlab_scripts/helperFunctions/Strip_Suffix.m +16 -16
  74. powertrain_build/matlab_scripts/helperFunctions/followLink.m +118 -118
  75. powertrain_build/matlab_scripts/helperFunctions/getCodeSwitches.m +50 -50
  76. powertrain_build/matlab_scripts/helperFunctions/getConsumerBlocks.m +30 -30
  77. powertrain_build/matlab_scripts/helperFunctions/getDefBlock.m +39 -39
  78. powertrain_build/matlab_scripts/helperFunctions/getDefOutport.m +58 -58
  79. powertrain_build/matlab_scripts/helperFunctions/getDstBlocks.m +19 -19
  80. powertrain_build/matlab_scripts/helperFunctions/getDstLines.m +13 -13
  81. powertrain_build/matlab_scripts/helperFunctions/getInterfaceSignals.m +37 -37
  82. powertrain_build/matlab_scripts/helperFunctions/getName.m +37 -37
  83. powertrain_build/matlab_scripts/helperFunctions/getPath.m +6 -6
  84. powertrain_build/matlab_scripts/helperFunctions/getProperValue.m +21 -21
  85. powertrain_build/matlab_scripts/helperFunctions/getSrcBlocks.m +19 -19
  86. powertrain_build/matlab_scripts/helperFunctions/getSrcLines.m +13 -13
  87. powertrain_build/matlab_scripts/helperFunctions/loadLibraries.m +10 -10
  88. powertrain_build/matlab_scripts/helperFunctions/loadjson.m +6 -6
  89. powertrain_build/matlab_scripts/helperFunctions/modifyEnumStructField.m +21 -21
  90. powertrain_build/matlab_scripts/helperFunctions/removeConfigDuplicates.m +31 -31
  91. powertrain_build/matlab_scripts/helperFunctions/sortSystemByClass.m +26 -26
  92. powertrain_build/matlab_scripts/helperFunctions/tl_getfast.m +89 -89
  93. powertrain_build/matlab_scripts/helperFunctions/topLevelSystem.m +20 -20
  94. powertrain_build/matlab_scripts/helperFunctions/updateModels.m +131 -131
  95. powertrain_build/memory_section.py +224 -224
  96. powertrain_build/nvm_def.py +729 -729
  97. powertrain_build/problem_logger.py +86 -86
  98. powertrain_build/pt_matlab.py +430 -430
  99. powertrain_build/pt_win32.py +144 -144
  100. powertrain_build/replace_compu_tab_ref.py +105 -105
  101. powertrain_build/rte_dummy.py +254 -254
  102. powertrain_build/sched_funcs.py +209 -207
  103. powertrain_build/signal.py +7 -7
  104. powertrain_build/signal_if_html_rep.py +221 -221
  105. powertrain_build/signal_if_html_rep_all.py +302 -302
  106. powertrain_build/signal_incons_html_rep.py +180 -180
  107. powertrain_build/signal_incons_html_rep_all.py +366 -366
  108. powertrain_build/signal_incons_html_rep_base.py +168 -168
  109. powertrain_build/signal_inconsistency_check.py +641 -641
  110. powertrain_build/signal_interfaces.py +864 -864
  111. powertrain_build/templates/Index_SigCheck_All.html +22 -22
  112. powertrain_build/templates/Index_SigIf_All.html +19 -19
  113. powertrain_build/types.py +218 -218
  114. powertrain_build/unit_configs.py +419 -419
  115. powertrain_build/user_defined_types.py +660 -660
  116. powertrain_build/versioncheck.py +66 -66
  117. powertrain_build/wrapper.py +512 -512
  118. powertrain_build/xlrd_csv.py +87 -87
  119. powertrain_build/zone_controller/__init__.py +4 -4
  120. powertrain_build/zone_controller/calibration.py +176 -176
  121. powertrain_build/zone_controller/composition_yaml.py +880 -878
  122. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/METADATA +100 -100
  123. powertrain_build-1.13.3.dev3.dist-info/RECORD +130 -0
  124. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/WHEEL +1 -1
  125. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/LICENSE +202 -202
  126. powertrain_build-1.13.3.dev3.dist-info/pbr.json +1 -0
  127. powertrain_build-1.13.1.dist-info/RECORD +0 -130
  128. powertrain_build-1.13.1.dist-info/pbr.json +0 -1
  129. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/entry_points.txt +0 -0
  130. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/AUTHORS +0 -0
  131. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/NOTICE +0 -0
  132. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/top_level.txt +0 -0
@@ -1,91 +1,91 @@
1
- % Copyright 2024 Volvo Car Corporation
2
- % Licensed under Apache 2.0.
3
-
4
- function [Models, Projects, QuantityUnitList] = Init_PyBuild(interactiveMode)
5
- % Default is interactiveMode
6
- if ~exist('interactiveMode', 'var')
7
- interactiveMode = true;
8
- end
9
- disp('Starting Init_Pybuild')
10
- Clear_Base();
11
- Remove_Old_Paths();
12
- a = mfilename('fullpath');
13
- b = mfilename;
14
- fileFolder = a(1:length(a)-length(b));
15
- cd(fileFolder);
16
- cd('..'); % To remove .. from the path to folders we can change directory first
17
- Add_Paths(pwd);
18
-
19
- % Find dd file and set it as the project file
20
- addpath('ConfigDocuments');
21
- dd_file = dir('ConfigDocuments/*.dd');
22
- dsdd_manage_project('SetProjectFile', dd_file(1).name);
23
-
24
- tl_pref('set', 'projectfileautosave', 'off');
25
- % Init Pybuild
26
- disp('Initializing powertrain-build')
27
- Models = Init_Models('Models');
28
- Projects = Init_Projects('Projects', Models);
29
- QuantityUnitList = Read_Units();
30
-
31
- % Start the GUI
32
- if interactiveMode
33
- disp('Starting GUI')
34
- evalin('base', 'global Vc');
35
- PyBuild_Manager(Models, Projects, QuantityUnitList);
36
- end
37
-
38
- % declare global variables for dependency scripts
39
- % used by powermill_cli to be remove later
40
- global ModelsInfo
41
- global ProjectInfo
42
- ProjectInfo = Projects;
43
- ModelsInfo = Models;
44
-
45
- end
46
-
47
- function Clear_Base()
48
- %CLEAR_BASE Clear workspace, close systems, close figures, clear command.
49
- clearvars -global all
50
- clear all;
51
- close all;
52
- bdclose all;
53
- end
54
-
55
- function Remove_Old_Paths()
56
- %REMOVE_OLD_PATHS() Remove old folder paths from Matlab path, which are used in this script
57
- AllPaths = path;
58
- LineBreaks = strfind(AllPaths,';');
59
-
60
- for i = 1:length(LineBreaks)
61
- if i == 1
62
- CurrentPath = AllPaths(1:LineBreaks(1)-1);
63
- else
64
- CurrentPath = AllPaths(LineBreaks(i-1)+1:LineBreaks(i)-1);
65
- end
66
- if contains(CurrentPath, '/ConfigDocuments') ||...
67
- contains(CurrentPath, '/Documents') ||...
68
- contains(CurrentPath, '/matlab-scripts/') ||...
69
- contains(CurrentPath, '/pytools/') ||...
70
- contains(CurrentPath, '/Script/')
71
- rmpath(CurrentPath)
72
- end
73
- end
74
- end
75
-
76
- function Add_Paths(RepoRootFolder)
77
- % Add required folder paths
78
- disp(['Adding paths from ' RepoRootFolder])
79
- ConfigDocumentsFolder = [RepoRootFolder '/ConfigDocuments'];
80
- DocumentsFolder = [RepoRootFolder '/Documents'];
81
- ModelsFolder = [RepoRootFolder '/Models'];
82
- MatlabScriptsFolder = [RepoRootFolder '/matlab-scripts'];
83
- ScriptFolder = [RepoRootFolder '/Script'];
84
- addpath(ConfigDocumentsFolder);
85
- addpath(DocumentsFolder);
86
- addpath(ModelsFolder);
87
- addpath([ModelsFolder '/Common']);
88
- addpath([ModelsFolder '/Common/VcEnumDefinitions']);
89
- addpath(genpath(MatlabScriptsFolder));
90
- addpath(genpath(ScriptFolder));
91
- end
1
+ % Copyright 2024 Volvo Car Corporation
2
+ % Licensed under Apache 2.0.
3
+
4
+ function [Models, Projects, QuantityUnitList] = Init_PyBuild(interactiveMode)
5
+ % Default is interactiveMode
6
+ if ~exist('interactiveMode', 'var')
7
+ interactiveMode = true;
8
+ end
9
+ disp('Starting Init_Pybuild')
10
+ Clear_Base();
11
+ Remove_Old_Paths();
12
+ a = mfilename('fullpath');
13
+ b = mfilename;
14
+ fileFolder = a(1:length(a)-length(b));
15
+ cd(fileFolder);
16
+ cd('..'); % To remove .. from the path to folders we can change directory first
17
+ Add_Paths(pwd);
18
+
19
+ % Find dd file and set it as the project file
20
+ addpath('ConfigDocuments');
21
+ dd_file = dir('ConfigDocuments/*.dd');
22
+ dsdd_manage_project('SetProjectFile', dd_file(1).name);
23
+
24
+ tl_pref('set', 'projectfileautosave', 'off');
25
+ % Init Pybuild
26
+ disp('Initializing powertrain-build')
27
+ Models = Init_Models('Models');
28
+ Projects = Init_Projects('Projects', Models);
29
+ QuantityUnitList = Read_Units();
30
+
31
+ % Start the GUI
32
+ if interactiveMode
33
+ disp('Starting GUI')
34
+ evalin('base', 'global Vc');
35
+ PyBuild_Manager(Models, Projects, QuantityUnitList);
36
+ end
37
+
38
+ % declare global variables for dependency scripts
39
+ % used by powermill_cli to be remove later
40
+ global ModelsInfo
41
+ global ProjectInfo
42
+ ProjectInfo = Projects;
43
+ ModelsInfo = Models;
44
+
45
+ end
46
+
47
+ function Clear_Base()
48
+ %CLEAR_BASE Clear workspace, close systems, close figures, clear command.
49
+ clearvars -global all
50
+ clear all;
51
+ close all;
52
+ bdclose all;
53
+ end
54
+
55
+ function Remove_Old_Paths()
56
+ %REMOVE_OLD_PATHS() Remove old folder paths from Matlab path, which are used in this script
57
+ AllPaths = path;
58
+ LineBreaks = strfind(AllPaths,';');
59
+
60
+ for i = 1:length(LineBreaks)
61
+ if i == 1
62
+ CurrentPath = AllPaths(1:LineBreaks(1)-1);
63
+ else
64
+ CurrentPath = AllPaths(LineBreaks(i-1)+1:LineBreaks(i)-1);
65
+ end
66
+ if contains(CurrentPath, '/ConfigDocuments') ||...
67
+ contains(CurrentPath, '/Documents') ||...
68
+ contains(CurrentPath, '/matlab-scripts/') ||...
69
+ contains(CurrentPath, '/pytools/') ||...
70
+ contains(CurrentPath, '/Script/')
71
+ rmpath(CurrentPath)
72
+ end
73
+ end
74
+ end
75
+
76
+ function Add_Paths(RepoRootFolder)
77
+ % Add required folder paths
78
+ disp(['Adding paths from ' RepoRootFolder])
79
+ ConfigDocumentsFolder = [RepoRootFolder '/ConfigDocuments'];
80
+ DocumentsFolder = [RepoRootFolder '/Documents'];
81
+ ModelsFolder = [RepoRootFolder '/Models'];
82
+ MatlabScriptsFolder = [RepoRootFolder '/matlab-scripts'];
83
+ ScriptFolder = [RepoRootFolder '/Script'];
84
+ addpath(ConfigDocumentsFolder);
85
+ addpath(DocumentsFolder);
86
+ addpath(ModelsFolder);
87
+ addpath([ModelsFolder '/Common']);
88
+ addpath([ModelsFolder '/Common/VcEnumDefinitions']);
89
+ addpath(genpath(MatlabScriptsFolder));
90
+ addpath(genpath(ScriptFolder));
91
+ end
@@ -1,2 +1,2 @@
1
- # Copyright 2024 Volvo Car Corporation
2
- # Licensed under Apache 2.0.
1
+ # Copyright 2024 Volvo Car Corporation
2
+ # Licensed under Apache 2.0.
@@ -1,46 +1,46 @@
1
- % Copyright 2024 Volvo Car Corporation
2
- % Licensed under Apache 2.0.
3
-
4
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
- %% File name: Get_full_Name
6
- %% Author: Johan Backmark
7
- %% Date: 2008/04/24
8
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9
- %% Description: This tl_get takes in a Macro and returns the whole code
10
- %% name
11
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12
-
13
-
14
- function Macro = Get_Full_Name(Handle,Macro,TLSystem)
15
-
16
- if ~isempty(findstr(Macro,'$L'))
17
- %get_param(Handle,'masktype')
18
- if ismember(get_param(Handle,'masktype'),{'TL_Outport', 'TL_BusOutport'})
19
- Line=Get_SrcLines(Handle);
20
- LineName=get(Line,'name');
21
- if isempty(LineName)
22
- SrcPortHandle = get(Line,'SrcPortHandle');
23
-
24
- if SrcPortHandle ~= -1
25
- LineName=get(SrcPortHandle,'PropagatedSignals');
26
- else
27
- error(['Outport cannot follow source line "' get_param(Handle, 'Name') '" in model "' get_param(Handle, 'Parent') '"']);
28
- end
29
- end
30
- Macro=strrep(Macro,'$L',LineName);
31
- else
32
- Macro=strrep(Macro,'$L',get(getDstLines(Handle),'name'));
33
- end
34
- end
35
-
36
- if ~isempty(findstr(Macro,'$N'))
37
- Macro=strrep(Macro,'$N',TLSystem);
38
- end
39
- if ~isempty(findstr(Macro,'$B'))
40
- Macro=strrep(Macro,'$B',get_param(Handle,'name'));
41
- end
42
- if ~isempty(findstr(Macro,'$S'))
43
- Parent=get_param(Handle,'Parent');
44
- Backslash=strfind(Parent,'/');
45
- Macro=strrep(Macro,'$S',Parent(Backslash(end)+1:end));
46
- end
1
+ % Copyright 2024 Volvo Car Corporation
2
+ % Licensed under Apache 2.0.
3
+
4
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
+ %% File name: Get_full_Name
6
+ %% Author: Johan Backmark
7
+ %% Date: 2008/04/24
8
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9
+ %% Description: This tl_get takes in a Macro and returns the whole code
10
+ %% name
11
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12
+
13
+
14
+ function Macro = Get_Full_Name(Handle,Macro,TLSystem)
15
+
16
+ if ~isempty(findstr(Macro,'$L'))
17
+ %get_param(Handle,'masktype')
18
+ if ismember(get_param(Handle,'masktype'),{'TL_Outport', 'TL_BusOutport'})
19
+ Line=Get_SrcLines(Handle);
20
+ LineName=get(Line,'name');
21
+ if isempty(LineName)
22
+ SrcPortHandle = get(Line,'SrcPortHandle');
23
+
24
+ if SrcPortHandle ~= -1
25
+ LineName=get(SrcPortHandle,'PropagatedSignals');
26
+ else
27
+ error(['Outport cannot follow source line "' get_param(Handle, 'Name') '" in model "' get_param(Handle, 'Parent') '"']);
28
+ end
29
+ end
30
+ Macro=strrep(Macro,'$L',LineName);
31
+ else
32
+ Macro=strrep(Macro,'$L',get(getDstLines(Handle),'name'));
33
+ end
34
+ end
35
+
36
+ if ~isempty(findstr(Macro,'$N'))
37
+ Macro=strrep(Macro,'$N',TLSystem);
38
+ end
39
+ if ~isempty(findstr(Macro,'$B'))
40
+ Macro=strrep(Macro,'$B',get_param(Handle,'name'));
41
+ end
42
+ if ~isempty(findstr(Macro,'$S'))
43
+ Parent=get_param(Handle,'Parent');
44
+ Backslash=strfind(Parent,'/');
45
+ Macro=strrep(Macro,'$S',Parent(Backslash(end)+1:end));
46
+ end
@@ -1,12 +1,12 @@
1
- % Copyright 2024 Volvo Car Corporation
2
- % Licensed under Apache 2.0.
3
-
4
- function SrcLines = Get_SrcLines(Block)
5
- Tmp = get_param(Block, 'linehandles');
6
-
7
- if isfield(Tmp, 'Inport')
8
- SrcLines = Tmp.Inport;
9
- else
10
- SrcLines = [];
11
- end
12
- end
1
+ % Copyright 2024 Volvo Car Corporation
2
+ % Licensed under Apache 2.0.
3
+
4
+ function SrcLines = Get_SrcLines(Block)
5
+ Tmp = get_param(Block, 'linehandles');
6
+
7
+ if isfield(Tmp, 'Inport')
8
+ SrcLines = Tmp.Inport;
9
+ else
10
+ SrcLines = [];
11
+ end
12
+ end
@@ -1,78 +1,78 @@
1
- % Copyright 2024 Volvo Car Corporation
2
- % Licensed under Apache 2.0.
3
-
4
- function [Models] = Init_Models(modelsFolder)
5
- Models = struct;
6
- SspFolders = dir(modelsFolder);
7
- for SspEntry=SspFolders'
8
- SspName = SspEntry.name;
9
- if SspName(1) == '.'
10
- continue
11
- end
12
- if ~SspEntry.isdir
13
- continue
14
- end
15
- Models = FindSspModels([SspEntry.folder '/' SspEntry.name], Models, SspEntry.name);
16
- end
17
- end
18
-
19
- function Models = FindSspModels(sspDirectory, Models, SspName)
20
- SspDirContent = dir([sspDirectory '/Vc*']);
21
- for ModelDir=SspDirContent'
22
- if ~ModelDir.isdir
23
- continue
24
- end
25
- ModelFiles = FindModelFiles(sspDirectory, ModelDir.name);
26
- if ~isempty(fieldnames(ModelFiles))
27
- Models.(ModelDir.name) = ModelFiles;
28
- Models.(ModelDir.name).Ssp = SspName;
29
- end
30
- end
31
- end
32
-
33
- function ModelInfo = FindModelFiles(sspDirectory, modelName)
34
- % Search for all available files in directoryName
35
- % Add model path from release folder selected in ReleaseSwitch
36
- ModelDirContent = dir([sspDirectory '/' modelName]);
37
- ModelInfo = struct;
38
- for ModelDirEntry = ModelDirContent'
39
- ModelFileName = ModelDirEntry.name;
40
- fullPath = [ModelDirEntry.folder filesep ModelDirEntry.name];
41
- if strcmp(ModelDirEntry.name, [modelName '.mdl'])
42
- % Model file found
43
- ModelInfo.modelFilePath = fullPath;
44
- elseif strcmp(ModelDirEntry.name, [modelName '_par.m'])
45
- % par file found
46
- ModelInfo.parFilePath = fullPath;
47
- % Do nothing, m file found
48
- elseif strcmp(ModelDirEntry.name, [modelName '_sgp.xml'])
49
- ModelInfo.sgpFilePath = fullPath;
50
- elseif ModelDirEntry.isdir
51
- % Model folder found
52
- if strcmp(ModelDirEntry.name, 'matlab_src')
53
- ModelInfo.matlabSrcPath = fullPath;
54
- elseif strcmp(ModelDirEntry.name, 'c_src')
55
- ModelInfo.cSrcFiles = FindCSourceFiles(fullPath);
56
- end
57
- end
58
- end
59
- % Add system name
60
- if ~isempty(fieldnames(ModelInfo))
61
- ModelInfo.SystemName = Strip_Suffix(modelName);
62
- ModelInfo.FullModelName = modelName;
63
- % Getting the tl_subsystem for all models is too slow. Do it when
64
- % needed.
65
- % Stub for the time being
66
- ModelInfo.CurrentSystem = false;
67
- end
68
- end
69
-
70
- function cSrcFiles = FindCSourceFiles(cSrcPath)
71
- cSrcFiles = {};
72
- cSrcDirFiles = dir(cSrcPath);
73
- for cSrcFile = cSrcDirFiles'
74
- if ~isempty(regexpi(cSrcFile.name, '\.(c|h|a2l)', 'match'))
75
- cSrcFiles{end+1} = [cSrcFile.folder '/' cSrcFile.name];
76
- end
77
- end
78
- end
1
+ % Copyright 2024 Volvo Car Corporation
2
+ % Licensed under Apache 2.0.
3
+
4
+ function [Models] = Init_Models(modelsFolder)
5
+ Models = struct;
6
+ SspFolders = dir(modelsFolder);
7
+ for SspEntry=SspFolders'
8
+ SspName = SspEntry.name;
9
+ if SspName(1) == '.'
10
+ continue
11
+ end
12
+ if ~SspEntry.isdir
13
+ continue
14
+ end
15
+ Models = FindSspModels([SspEntry.folder '/' SspEntry.name], Models, SspEntry.name);
16
+ end
17
+ end
18
+
19
+ function Models = FindSspModels(sspDirectory, Models, SspName)
20
+ SspDirContent = dir([sspDirectory '/Vc*']);
21
+ for ModelDir=SspDirContent'
22
+ if ~ModelDir.isdir
23
+ continue
24
+ end
25
+ ModelFiles = FindModelFiles(sspDirectory, ModelDir.name);
26
+ if ~isempty(fieldnames(ModelFiles))
27
+ Models.(ModelDir.name) = ModelFiles;
28
+ Models.(ModelDir.name).Ssp = SspName;
29
+ end
30
+ end
31
+ end
32
+
33
+ function ModelInfo = FindModelFiles(sspDirectory, modelName)
34
+ % Search for all available files in directoryName
35
+ % Add model path from release folder selected in ReleaseSwitch
36
+ ModelDirContent = dir([sspDirectory '/' modelName]);
37
+ ModelInfo = struct;
38
+ for ModelDirEntry = ModelDirContent'
39
+ ModelFileName = ModelDirEntry.name;
40
+ fullPath = [ModelDirEntry.folder filesep ModelDirEntry.name];
41
+ if strcmp(ModelDirEntry.name, [modelName '.mdl'])
42
+ % Model file found
43
+ ModelInfo.modelFilePath = fullPath;
44
+ elseif strcmp(ModelDirEntry.name, [modelName '_par.m'])
45
+ % par file found
46
+ ModelInfo.parFilePath = fullPath;
47
+ % Do nothing, m file found
48
+ elseif strcmp(ModelDirEntry.name, [modelName '_sgp.xml'])
49
+ ModelInfo.sgpFilePath = fullPath;
50
+ elseif ModelDirEntry.isdir
51
+ % Model folder found
52
+ if strcmp(ModelDirEntry.name, 'matlab_src')
53
+ ModelInfo.matlabSrcPath = fullPath;
54
+ elseif strcmp(ModelDirEntry.name, 'c_src')
55
+ ModelInfo.cSrcFiles = FindCSourceFiles(fullPath);
56
+ end
57
+ end
58
+ end
59
+ % Add system name
60
+ if ~isempty(fieldnames(ModelInfo))
61
+ ModelInfo.SystemName = Strip_Suffix(modelName);
62
+ ModelInfo.FullModelName = modelName;
63
+ % Getting the tl_subsystem for all models is too slow. Do it when
64
+ % needed.
65
+ % Stub for the time being
66
+ ModelInfo.CurrentSystem = false;
67
+ end
68
+ end
69
+
70
+ function cSrcFiles = FindCSourceFiles(cSrcPath)
71
+ cSrcFiles = {};
72
+ cSrcDirFiles = dir(cSrcPath);
73
+ for cSrcFile = cSrcDirFiles'
74
+ if ~isempty(regexpi(cSrcFile.name, '\.(c|h|a2l)', 'match'))
75
+ cSrcFiles{end+1} = [cSrcFile.folder '/' cSrcFile.name];
76
+ end
77
+ end
78
+ end
@@ -1,67 +1,67 @@
1
- % Copyright 2024 Volvo Car Corporation
2
- % Licensed under Apache 2.0.
3
-
4
- function ProjectInfo = Init_Projects(projectsPath, Models, ProjectInfo, baseName)
5
- % INIT_PROJECTS Initialize projects related information.
6
- if nargin < 3
7
- ProjectInfo = struct;
8
- end
9
- if nargin < 4
10
- baseName = '';
11
- end
12
-
13
- configFilePath = 'ConfigDocuments/matlab_script_config/PyBuild_config.json';
14
- if isfile(configFilePath)
15
- projectNameConfig = loadjson(configFilePath);
16
- gitNames = fieldnames(projectNameConfig.project_name_replacements);
17
- svnNames = cellfun(@(x)(projectNameConfig.project_name_replacements.(x)), gitNames, 'UniformOutput', 0);
18
- else
19
- warning('Found no config file: %s.', configFilePath)
20
- gitNames = {};
21
- svnNames = {};
22
- end
23
-
24
- projectFolders = dir(projectsPath);
25
- for ProjectItem = projectFolders'
26
- if ~ProjectItem.isdir
27
- continue
28
- end
29
- if strcmp(ProjectItem.name(1),'.')
30
- continue
31
- end
32
- if endsWith(ProjectItem.folder, {'CSP', 'ZC'}) && strcmp(ProjectItem.name, 'ConfigDocuments')
33
- % Added a ConfigDocuments folder here. Not a project
34
- continue
35
- end
36
- if ismember(ProjectItem.name, {'CSP', 'ZC'})
37
- ProjectInfo = Init_Projects([ProjectItem.folder '/' ProjectItem.name], Models, ProjectInfo, [ProjectItem.name '_']);
38
- continue
39
- end
40
- projectName = [baseName ProjectItem.name];
41
- ProjectInfo.(projectName).Name = projectName;
42
- ProjectInfo.(projectName).InterfaceName = replace(projectName, gitNames, svnNames);
43
- ProjectInfo.(projectName).RootFolder = fullfile([ProjectItem.folder '/' ProjectItem.name]);
44
- ProjectInfo.(projectName).OutputFolder = fullfile([ProjectInfo.(projectName).RootFolder '/output']);
45
- ProjectInfo.(projectName).ConfigFile = fullfile([ProjectInfo.(projectName).RootFolder '/ProjectCfg.json']);
46
- ProjectInfo.(projectName).ProjectConfig = loadjson(ProjectInfo.(projectName).ConfigFile);
47
- ProjectInfo.(projectName).RasterFile = fullfile([ProjectInfo.(projectName).RootFolder '/conf.local/rasters.json']);
48
- ProjectInfo.(projectName).MaxRefreshRate = loadjson(ProjectInfo.(projectName).RasterFile);
49
- ProjectInfo.(projectName).IncludedFunctions = SetProjectTimeSamples(ProjectInfo.(projectName).MaxRefreshRate, Models);
50
- % Below should not be needed in the long run
51
- ProjectInfo.(projectName).A2lFileName = Get_A2L_File_Name(ProjectInfo.(projectName).ConfigFile); % Used for LabelSplit
52
- ProjectInfo.(projectName).NewCoreIF = true; % All projectd have "the new Core I/F". Used in checkscripts
53
- ProjectInfo.(projectName).CMT_enabled = true; % Used in checkscripts and labelsplit
54
- ProjectInfo.(projectName).CMT_required = true; % Used in checkscripts and labelsplit
55
- ProjectInfo.(projectName).IncludeVccSpVersion = true;
56
- ProjectInfo.(projectName).UseNVMStruct = true;
57
- ProjectInfo.(projectName).UpdateNVMStruct = true;
58
- end
59
- end
60
-
61
- function a2LFileName = Get_A2L_File_Name(ConfigFile)
62
- %GETA2LFILENAME Get the correct A2L file name of a given project.
63
- ProjectConfig = loadjson(ConfigFile);
64
- fullName = ProjectConfig.ProjectInfo.a2LFileName;
65
- name_parts = strsplit(fullName, '.');
66
- a2LFileName = name_parts{1};
67
- end
1
+ % Copyright 2024 Volvo Car Corporation
2
+ % Licensed under Apache 2.0.
3
+
4
+ function ProjectInfo = Init_Projects(projectsPath, Models, ProjectInfo, baseName)
5
+ % INIT_PROJECTS Initialize projects related information.
6
+ if nargin < 3
7
+ ProjectInfo = struct;
8
+ end
9
+ if nargin < 4
10
+ baseName = '';
11
+ end
12
+
13
+ configFilePath = 'ConfigDocuments/matlab_script_config/PyBuild_config.json';
14
+ if isfile(configFilePath)
15
+ projectNameConfig = loadjson(configFilePath);
16
+ gitNames = fieldnames(projectNameConfig.project_name_replacements);
17
+ svnNames = cellfun(@(x)(projectNameConfig.project_name_replacements.(x)), gitNames, 'UniformOutput', 0);
18
+ else
19
+ warning('Found no config file: %s.', configFilePath)
20
+ gitNames = {};
21
+ svnNames = {};
22
+ end
23
+
24
+ projectFolders = dir(projectsPath);
25
+ for ProjectItem = projectFolders'
26
+ if ~ProjectItem.isdir
27
+ continue
28
+ end
29
+ if strcmp(ProjectItem.name(1),'.')
30
+ continue
31
+ end
32
+ if endsWith(ProjectItem.folder, {'CSP', 'ZC'}) && strcmp(ProjectItem.name, 'ConfigDocuments')
33
+ % Added a ConfigDocuments folder here. Not a project
34
+ continue
35
+ end
36
+ if ismember(ProjectItem.name, {'CSP', 'ZC'})
37
+ ProjectInfo = Init_Projects([ProjectItem.folder '/' ProjectItem.name], Models, ProjectInfo, [ProjectItem.name '_']);
38
+ continue
39
+ end
40
+ projectName = [baseName ProjectItem.name];
41
+ ProjectInfo.(projectName).Name = projectName;
42
+ ProjectInfo.(projectName).InterfaceName = replace(projectName, gitNames, svnNames);
43
+ ProjectInfo.(projectName).RootFolder = fullfile([ProjectItem.folder '/' ProjectItem.name]);
44
+ ProjectInfo.(projectName).OutputFolder = fullfile([ProjectInfo.(projectName).RootFolder '/output']);
45
+ ProjectInfo.(projectName).ConfigFile = fullfile([ProjectInfo.(projectName).RootFolder '/ProjectCfg.json']);
46
+ ProjectInfo.(projectName).ProjectConfig = loadjson(ProjectInfo.(projectName).ConfigFile);
47
+ ProjectInfo.(projectName).RasterFile = fullfile([ProjectInfo.(projectName).RootFolder '/conf.local/rasters.json']);
48
+ ProjectInfo.(projectName).MaxRefreshRate = loadjson(ProjectInfo.(projectName).RasterFile);
49
+ ProjectInfo.(projectName).IncludedFunctions = SetProjectTimeSamples(ProjectInfo.(projectName).MaxRefreshRate, Models);
50
+ % Below should not be needed in the long run
51
+ ProjectInfo.(projectName).A2lFileName = Get_A2L_File_Name(ProjectInfo.(projectName).ConfigFile); % Used for LabelSplit
52
+ ProjectInfo.(projectName).NewCoreIF = true; % All projectd have "the new Core I/F". Used in checkscripts
53
+ ProjectInfo.(projectName).CMT_enabled = true; % Used in checkscripts and labelsplit
54
+ ProjectInfo.(projectName).CMT_required = true; % Used in checkscripts and labelsplit
55
+ ProjectInfo.(projectName).IncludeVccSpVersion = true;
56
+ ProjectInfo.(projectName).UseNVMStruct = true;
57
+ ProjectInfo.(projectName).UpdateNVMStruct = true;
58
+ end
59
+ end
60
+
61
+ function a2LFileName = Get_A2L_File_Name(ConfigFile)
62
+ %GETA2LFILENAME Get the correct A2L file name of a given project.
63
+ ProjectConfig = loadjson(ConfigFile);
64
+ fullName = ProjectConfig.ProjectInfo.a2LFileName;
65
+ name_parts = strsplit(fullName, '.');
66
+ a2LFileName = name_parts{1};
67
+ end