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
26b91de5
Commit
26b91de5
authored
3 years ago
by
Federico Felici
Browse files
Options
Downloads
Patches
Plain Diff
More class method comments and remove useless ones
parent
5586c83e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
code/classes/SCDclass_expcode.m
+2
-1
2 additions, 1 deletion
code/classes/SCDclass_expcode.m
code/classes/SCDclass_node.m
+10
-37
10 additions, 37 deletions
code/classes/SCDclass_node.m
with
12 additions
and
38 deletions
code/classes/SCDclass_expcode.m
+
2
−
1
View file @
26b91de5
...
@@ -315,7 +315,7 @@ classdef SCDclass_expcode
...
@@ -315,7 +315,7 @@ classdef SCDclass_expcode
'set node number and node property do not match while setting node %s'
,
nodenr
)
'set node number and node property do not match while setting node %s'
,
nodenr
)
obj
.
nodes
{
node
.
nodenr
}
=
node
;
obj
.
nodes
{
node
.
nodenr
}
=
node
;
%
process
data dic
a
tionaries, mds objects, init functions etc
%
Make lists of
data dictionaries, mds objects, init functions etc
% that come with this node.
% that come with this node.
% wrapper algorithms
% wrapper algorithms
...
@@ -344,6 +344,7 @@ classdef SCDclass_expcode
...
@@ -344,6 +344,7 @@ classdef SCDclass_expcode
obj
.
nodes
{
nodenr
}
.
wrapper
{
cpunr
}
.
wrapperObj
.
printinfo
;
obj
.
nodes
{
nodenr
}
.
wrapper
{
cpunr
}
.
wrapperObj
.
printinfo
;
return
return
elseif
nargin
==
2
elseif
nargin
==
2
if
isempty
(
obj
.
nodes
{
nodenr
});
fprintf
(
'no node %d defined\n'
,
nodenr
);
end
obj
.
nodes
{
nodenr
}
.
printinfo
;
obj
.
nodes
{
nodenr
}
.
printinfo
;
return
return
end
end
...
...
This diff is collapsed.
Click to expand it.
code/classes/SCDclass_node.m
+
10
−
37
View file @
26b91de5
...
@@ -26,17 +26,24 @@ classdef SCDclass_node < SCDclass_component
...
@@ -26,17 +26,24 @@ classdef SCDclass_node < SCDclass_component
methods
methods
function
obj
=
SCDclass_node
(
nodenr
)
function
obj
=
SCDclass_node
(
nodenr
)
% constructor
name
=
sprintf
(
'SCD_rtc_%02d'
,
nodenr
);
name
=
sprintf
(
'SCD_rtc_%02d'
,
nodenr
);
obj
.
nodenr
=
nodenr
;
obj
.
nodenr
=
nodenr
;
obj
.
name
=
name
;
obj
.
name
=
name
;
obj
.
algos
=
[];
obj
.
algos
=
[];
obj
.
ddname
=
[
name
,
'.sldd'
];
obj
.
ddname
=
[
name
,
'.sldd'
];
obj
.
mdlname
=
[
name
,
'.slx'
];
obj
.
mdlname
=
[
name
,
'.slx'
];
% get node-specific configurations
obj
=
defaultnodeconfig
(
obj
,
nodenr
);
obj
=
defaultnodeconfig
(
obj
,
nodenr
);
end
end
function
obj
=
addwrapper
(
obj
,
wrapperObj
,
cpunr
,
varalgo
,
isactive
)
function
obj
=
addwrapper
(
obj
,
wrapperObj
,
cpunr
,
varalgo
,
isactive
)
% add wrapper to a node at a given cpunumber
% varalgo is the variant subsystem number used to select this wrapper
% isactive (true by default) sets whether the addition of the wrapper
% also sets the cpu to be active;
% by default, activate CPU when adding a wrapper
% by default, activate CPU when adding a wrapper
if
nargin
==
4
,
isactive
=
true
;
end
if
nargin
==
4
,
isactive
=
true
;
end
...
@@ -56,7 +63,7 @@ classdef SCDclass_node < SCDclass_component
...
@@ -56,7 +63,7 @@ classdef SCDclass_node < SCDclass_component
end
end
function
node
=
defaultnodeconfig
(
node
,
nodenr
)
function
node
=
defaultnodeconfig
(
node
,
nodenr
)
%
[general part]
%
Default configuration for nodes
switch
nodenr
switch
nodenr
case
1
case
1
node
.
ncpu
=
1
;
node
.
ncpu
=
1
;
...
@@ -189,45 +196,11 @@ classdef SCDclass_node < SCDclass_component
...
@@ -189,45 +196,11 @@ classdef SCDclass_node < SCDclass_component
end
end
function
obj
=
setactive
(
obj
,
value
)
function
obj
=
setactive
(
obj
,
value
)
% set the node to be active
assert
(
islogical
(
value
),
'value must be boolean'
)
assert
(
islogical
(
value
),
'value must be boolean'
)
obj
.
active
=
value
;
obj
.
active
=
value
;
end
end
function
linknodedd
(
obj
,
node
)
% link node data dictionary to main expcode object data dicationary
assert
(
isa
(
node
,
'SCDclass_node'
),
'node must be an SCDclass_node object'
)
ddObj
=
Simulink
.
data
.
dictionary
.
open
(
obj
.
ddname
);
prefix
=
'SCD_rtc'
;
% already linked sources
prevsources
=
ddObj
.
DataSources
;
prevsources_nodes
=
prevsources
(
startsWith
(
prevsources
,
prefix
));
% make algo data dictionary list list
reqsources
=
node
.
ddname
;
% removing unnecessary ones
for
ii
=
1
:
numel
(
prevsources_nodes
)
mysource
=
prevsources_nodes
{
ii
};
if
~
contains
(
reqsources
,
mysource
)
obj
.
printlog
(
'Removing algorithm data source %s from %s'
,
mysource
,
obj
.
ddname
);
ddObj
.
removeDataSource
(
prevsources_nodes
{
ii
})
end
end
% add new ones not yet present
mysource
=
reqsources
;
assert
(
startsWith
(
mysource
,
prefix
),
...
'attempting to add algo dd: %s that does not start with
''
%s
''
-aborting'
,
prefix
,
mysource
);
if
contains
(
prevsources
,
mysource
)
obj
.
printlog
(
'Not adding node data source %s - already exists'
,
mysource
);
else
obj
.
printlog
(
'Adding node data source %s to %s'
,
mysource
,
obj
.
ddname
);
ddObj
.
addDataSource
(
mysource
);
end
end
function
updatetemplatetp
(
obj
)
function
updatetemplatetp
(
obj
)
% update wrapper algos
% update wrapper algos
for
ii
=
1
:
numel
(
obj
.
wrappers
)
for
ii
=
1
:
numel
(
obj
.
wrappers
)
...
...
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