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
a45f09b0
Commit
a45f09b0
authored
3 years ago
by
Federico Felici
Browse files
Options
Downloads
Patches
Plain Diff
Various cleanups
parent
73aa7ed1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
code/classes/SCDclass_algo.m
+6
-4
6 additions, 4 deletions
code/classes/SCDclass_algo.m
code/classes/SCDclass_mdsobjcontainer.m
+31
-36
31 additions, 36 deletions
code/classes/SCDclass_mdsobjcontainer.m
code/classes/SCDclass_mdspar.m
+3
-10
3 additions, 10 deletions
code/classes/SCDclass_mdspar.m
with
40 additions
and
50 deletions
code/classes/SCDclass_algo.m
+
6
−
4
View file @
a45f09b0
...
...
@@ -496,10 +496,12 @@ classdef SCDclass_algo
end
function
obj
=
addwavegen
(
obj
,
wavegen
)
for
ii
=
1
:
numel
(
wavegen
)
wavegen
(
ii
)
=
wavegen
(
ii
)
.
bind
(
obj
.
modelname
,
obj
.
datadictionary
,
obj
.
timing
);
end
obj
.
mdscontainer
=
obj
.
mdscontainer
.
addwavegen
(
wavegen
);
% bind wavegen to modelname, dd and algo timing
for
ii
=
1
:
numel
(
wavegen
)
wavegen
(
ii
)
=
wavegen
(
ii
)
.
bind
(
obj
.
modelname
,
obj
.
datadictionary
,
obj
.
timing
);
end
% add to algo's mds object container
obj
.
mdscontainer
=
obj
.
mdscontainer
.
addwavegen
(
wavegen
);
end
function
obj
=
printwavegens
(
obj
)
...
...
This diff is collapsed.
Click to expand it.
code/classes/SCDclass_mdsobjcontainer.m
+
31
−
36
View file @
a45f09b0
...
...
@@ -37,13 +37,13 @@ classdef SCDclass_mdsobjcontainer
end
function
obj
=
actualizeparameters
(
obj
,
shot
)
% actualize the parameters
o
n the
gove
data dictionary,
% actualize the parameters
i
n the data dictionary,
% naive version with a mds acces for every parameter
for
ii
=
1
:
obj
.
getnumparams
if
(
strcmp
(
obj
.
modeltoactualize
,
'all'
)
)
if
strcmp
(
obj
.
modeltoactualize
,
'all'
)
obj
.
mdsparams
(
ii
)
.
actualizedata
(
shot
);
else
if
(
strcmp
(
obj
.
modeltoactualize
,
obj
.
mdsparams
(
ii
)
.
getmodelname
)
)
if
strcmp
(
obj
.
modeltoactualize
,
obj
.
mdsparams
(
ii
)
.
getmodelname
)
obj
.
mdsparams
(
ii
)
.
actualizedata
(
shot
);
end
end
...
...
@@ -56,36 +56,29 @@ classdef SCDclass_mdsobjcontainer
end
function
obj
=
setwavegenbasestruct
(
obj
,
basestruct
)
if
obj
.
getnumwavegens
>
0
for
ii
=
1
:
obj
.
getnumwavegens
obj
.
mdswavegens
(
ii
)
=
obj
.
mdswavegens
(
ii
)
.
setbasestruct
(
basestruct
);
end
end
for
ii
=
1
:
obj
.
getnumwavegens
obj
.
mdswavegens
(
ii
)
=
obj
.
mdswavegens
(
ii
)
.
setbasestruct
(
basestruct
);
end
end
function
obj
=
printwavegens
(
obj
)
% prints the wavegen list
if
obj
.
getnumwavegens
>
0
for
ii
=
1
:
obj
.
getnumwavegens
obj
.
mdswavegens
(
ii
)
.
printinfo
();
end
end
for
ii
=
1
:
obj
.
getnumwavegens
obj
.
mdswavegens
(
ii
)
.
printinfo
();
end
end
function
obj
=
actualizewavegens
(
obj
,
shot
)
% actualize the wavegen waves timeseries
% naive version, a mds connection is called for every object
if
obj
.
getnumwavegens
>
0
for
ii
=
1
:
obj
.
getnumwavegens
if
(
strcmp
(
obj
.
modeltoactualize
,
'all'
))
obj
.
mdswavegens
(
ii
)
.
actualizedata
(
shot
);
else
if
(
strcmp
(
obj
.
modeltoactualize
,
obj
.
mdswavegens
(
ii
)
.
getmodelname
))
obj
.
mdswavegens
(
ii
)
.
actualizedata
(
shot
);
end
end
end
% actualize the wavegen waves timeseries
% naive version, a mds connection is called for every object
for
ii
=
1
:
obj
.
getnumwavegens
if
(
strcmp
(
obj
.
modeltoactualize
,
'all'
))
obj
.
mdswavegens
(
ii
)
.
actualizedata
(
shot
);
else
if
(
strcmp
(
obj
.
modeltoactualize
,
obj
.
mdswavegens
(
ii
)
.
getmodelname
))
obj
.
mdswavegens
(
ii
)
.
actualizedata
(
shot
);
end
end
end
end
function
obj
=
cleanwavegens
(
obj
)
...
...
@@ -99,26 +92,28 @@ classdef SCDclass_mdsobjcontainer
end
function
obj
=
importmdsparams
(
obj
,
source
)
% parameters i
mport
%
import mds
parameters i
nto this container from another source
numparamstoimport
=
source
.
getnumparams
;
paramstoimport
=
source
.
mdsparams
;
exclusionlist
=
false
(
size
(
paramstoimport
));
if
~
isempty
(
obj
.
mdsparams
)
destparamlist
=
obj
.
mdsparams
.
gettargetparam
;
% existing destination parameter names
for
ii
=
1
:
numparamstoimport
targetparam
=
paramstoimport
(
ii
)
.
gettargetparam
;
if
ismember
(
destparamlist
,
targetparam
)
% exclusion list of parameters already imported that shuold not
% be imported again.
exclusionlist
=
false
(
size
(
paramstoimport
));
% init
if
~
isempty
(
obj
.
mdsparams
)
% if there are already model params in the destination
destparamlist
=
obj
.
mdsparams
.
getmodelparam
;
% existing parameter names in destination
for
ii
=
1
:
numparamstoimport
% loop over params to import
my_modelparam
=
paramstoimport
(
ii
)
.
getmodelparam
;
if
ismember
(
destparamlist
,
my_modelparam
)
warning
(
'SCDclass_mdsobjcontainer:importmdsobjects'
,
...
'An mds object driving
''
%s
''
is already present in the destination expcode, skipping!'
,
...
target
param
);
my_model
param
);
exclusionlist
(
ii
)
=
true
;
end
end
end
%
add
non-excluded parameters
%
import
non-excluded
source
parameters
into parameter list
obj
=
obj
.
addparameter
(
paramstoimport
(
~
exclusionlist
));
end
...
...
This diff is collapsed.
Click to expand it.
code/classes/SCDclass_mdspar.m
+
3
−
10
View file @
a45f09b0
...
...
@@ -13,7 +13,6 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous
tdiexprused
% TDI expression actually used
%tdiexprmarte % TDI expression actually used converted to MARTe cfg convections
modelparam
% Full expansion of the model target parameter (modeltpstruct+modeltargetpar)
modelparammarte
% Full expansion of the model target oarameter (modeltpstruct+modeltargetpar) with marte separators
modeltpstruct
% target tunable parameter structure, if left empty it will be filled once binding to an algorithm
modeltargetpar
% Model parameter w/o tunable parameters structure
value
% value of the parameter
...
...
@@ -193,7 +192,6 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous
obj
.
tdiexprused
=
obj
.
tdiexprshot
;
end
obj
.
modelparam
=
[
obj
.
modeltpstruct
'.'
obj
.
modeltargetpar
];
obj
.
modelparammarte
=
strrep
(
obj
.
modelparam
,
obj
.
matlabseparator
,
obj
.
marteseparator
);
end
function
obj
=
actualizetdiexpr
(
obj
,
shot
)
...
...
@@ -242,7 +240,6 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous
obj
.
modeltpstruct
=
structname
;
end
obj
.
modelparam
=
[
obj
.
modeltpstruct
'.'
obj
.
modeltargetpar
];
obj
.
modelparammarte
=
strrep
(
obj
.
modelparam
,
obj
.
matlabseparator
,
obj
.
marteseparator
);
end
function
obj
=
setmodelname
(
obj
,
modelname
)
...
...
@@ -257,7 +254,7 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous
end
methods
(
Sealed
)
% works for heterogeneous class arrays
function
out
=
get
target
param
(
obj
)
function
out
=
get
model
param
(
obj
)
if
numel
(
obj
)
==
1
out
=
obj
.
modelparam
;
else
...
...
@@ -266,11 +263,8 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous
end
function
out
=
gettargetparammarte
(
obj
)
if
numel
(
obj
)
==
1
out
=
obj
.
modelparammarte
;
else
out
=
{
obj
.
modelparammarte
}
'
;
end
% convert model param list into version with marte separators
out
=
strrep
(
obj
.
modelparam
,
obj
.
matlabseparator
,
obj
.
marteseparator
);
end
function
obj
=
bind
(
obj
,
modelname
,
datadictionary
,
exportedtp
)
...
...
@@ -286,7 +280,6 @@ classdef SCDclass_mdspar < matlab.mixin.Heterogeneous
function
entrystring
=
genMARTe2entrycommon
(
obj
,
shot
)
obj
=
obj
.
actualizetdiexpr
(
shot
);
%entrystring = sprintf('+%-50s = { Class=%-30s Path=%-40s',obj.gettargetparammarte,obj.marteclassname,obj.tdiexprused);
entrystring
=
sprintf
(
'+%-50s = { Class=%-30s Path=%-40s'
,
obj
.
gettargetparammarte
,
obj
.
marteclassname
,
obj
.
genMARTe2MDStdiexpression
);
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