Skip to content
Snippets Groups Projects
Commit e4154648 authored by Federico Felici's avatar Federico Felici
Browse files

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
......@@ -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 setupdd(obj)
function initdd(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.setupdd; % setup data dictionary
obj.initdd; % setup data dictionary
end
function setup(obj)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment