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
e4154648
Commit
e4154648
authored
3 years ago
by
Federico Felici
Browse files
Options
Downloads
Patches
Plain Diff
Add logic for parent algorithms
In case algorithm inherits data dicationary objects from another algorithm
parent
153fccc6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/classes/SCDclass_algo.m
+22
-3
22 additions, 3 deletions
code/classes/SCDclass_algo.m
with
22 additions
and
3 deletions
code/classes/SCDclass_algo.m
+
22
−
3
View file @
e4154648
...
...
@@ -18,6 +18,7 @@ classdef SCDclass_algo
buslist
% list of buses and their sources
modelslx
% slx model file name
folder
% folder containing algorithm
parentalgos
% algorithms on which this algo depends
end
methods
...
...
@@ -190,7 +191,11 @@ classdef SCDclass_algo
fprintf
(
'\n'
);
end
%% Parent algo getter and setter
function
obj
=
addparentalgo
(
obj
,
parentalgo
)
assert
(
isa
(
parentalgo
,
'SCDclass_algo'
),
'parent algorithm must be SCDclass_algo object'
)
obj
.
parentalgos
{
end
+
1
}
=
parentalgo
;
end
%% Data dictionary setter and getter
function
obj
=
setdatadictionary
(
obj
,
datadict
)
...
...
@@ -493,7 +498,7 @@ classdef SCDclass_algo
end
%% Initializations
function
setup
dd
(
obj
)
function
init
dd
(
obj
)
% setup data dictionary
% generate data dictionary if it does not exist yet
...
...
@@ -514,6 +519,19 @@ classdef SCDclass_algo
% add referenced data dictionaries
obj
.
addrefdd
end
function
callparentinits
(
obj
)
for
ii
=
1
:
numel
(
obj
.
parentalgos
)
parentalgo
=
obj
.
parentalgos
{
ii
};
% if ~isempty(which(parentalgo.getdatadictionary))
% fprintf('%s is present, not rerunning %s init\n',...
% parentalgo.getdatadictionary,parentalgo.getname)
% else
fprintf
(
'running inits for parent algorithm %s\n'
,
parentalgo
.
getname
);
parentalgo
.
init
;
% end
end
end
function
callinits
(
obj
)
for
ii
=
1
:
numel
(
obj
.
stdinits
)
...
...
@@ -580,8 +598,9 @@ classdef SCDclass_algo
%% generic operation methods
function
init
(
obj
)
SCDconf_setConf
(
'SIM'
);
obj
.
callparentinits
;
obj
.
callinits
;
% call generic algorithm init functions
obj
.
setup
dd
;
% setup data dictionary
obj
.
init
dd
;
% setup data dictionary
end
function
setup
(
obj
)
...
...
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