Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCDDS-core
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SPC
SCDDS
SCDDS-core
Commits
f0cd9d43
Commit
f0cd9d43
authored
1 year ago
by
Timo Ravensbergen
Browse files
Options
Downloads
Patches
Plain Diff
New feature in SCDconf_setConf to allow an optional custom workspace name
parent
78843f58
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/functions/SCDconf_setConf.m
+14
-13
14 additions, 13 deletions
src/functions/SCDconf_setConf.m
with
14 additions
and
13 deletions
src/functions/SCDconf_setConf.m
+
14
−
13
View file @
f0cd9d43
function
SCDconf_setConf
(
conf
,
sourcedd
)
function
SCDconf_setConf
(
conf
,
sourcedd
,
exportname
)
% SCDconf_setConf(conf,sourcefile)
% conf: 'SIM', 'CODE' or use custom conf name
% sourcedd: source data dictionary containing configurations (Default: configurations_container.sldd)
...
...
@@ -10,6 +10,12 @@ function SCDconf_setConf(conf,sourcedd)
% [ SCDDS - Simulink Control Development & Deployment Suite ] Copyright SPC-EPFL Lausanne 2022.
% Distributed under the terms of the GNU Lesser General Public License, LGPL-3.0-only.
arguments
conf
string
sourcedd
string
=
'configurations_container.sldd'
exportname
string
=
'configurationSettings'
end
switch
lower
(
conf
)
case
'sim'
confName
=
'configurationSettingsSIM'
;
...
...
@@ -19,35 +25,30 @@ switch lower(conf)
confName
=
conf
;
% custom input
end
if
nargin
==
2
fname_src
=
sourcedd
;
else
fname_src
=
'configurations_container.sldd'
;
% dd file name
end
assert
(
~
isempty
(
which
(
fname_src
)),
'%s not in path?'
,
fname_src
);
fprintf
(
'Retrieving %s from %s, '
,
confName
,
fname_src
)
assert
(
~
isempty
(
which
(
sourcedd
)),
'%s not in path?'
,
sourcedd
);
fprintf
(
'Retrieving %s from %s, '
,
confName
,
sourcedd
)
fprintf
(
'setting it as configurationSettings in base workspace\n'
);
dd_src
=
Simulink
.
data
.
dictionary
.
open
(
fname_src
);
dd_src
=
Simulink
.
data
.
dictionary
.
open
(
sourcedd
);
confSection
=
getSection
(
dd_src
,
'Configurations'
);
assert
(
confSection
.
exist
(
confName
),
'%s does not exist in %s'
,
confName
,
fname_src
);
assert
(
confSection
.
exist
(
confName
),
'%s does not exist in %s'
,
confName
,
sourcedd
);
conf
=
confSection
.
getEntry
(
confName
);
configurationSettings
=
conf
.
getValue
;
%% Set it in target file
% Change name to universal name
configurationSettings
.
Name
=
'configurationSettings'
;
configurationSettings
.
Name
=
exportname
;
% set custom src - later make this a class
thisdir
=
fileparts
(
mfilename
(
'fullpath'
));
includeDir
=
fullfile
(
thisdir
,
'..'
,
'..'
,
'codegen'
);
configurationSettings
.
set_param
(
'CustomInclude'
,
includeDir
)
assignin
(
'base'
,
'configurationSettings'
,
configurationSettings
)
assignin
(
'base'
,
exportname
,
configurationSettings
)
%% Create empty configurations.sldd temporarily while algo dds need it
if
~
exist
(
'configurations.sldd'
,
'file'
)
dir_target
=
fileparts
(
which
(
fname_src
));
% target dir as source dir
dir_target
=
fileparts
(
which
(
sourcedd
));
% target dir as source dir
handle
=
Simulink
.
data
.
dictionary
.
create
(
fullfile
(
dir_target
,
'configurations.sldd'
));
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment