function obj = algoobj_template()

%% Doublets SPC controller algorithm
obj = SCDclass_algo('algo_template');

%% Timing of the algorithm
obj=obj.settiming(-1,1e-3,1.0);

%% Fixed parameters init functions 
obj=obj.addfpinitfcn('algo_template_loadfp','algo_template_fp');

%% Tunable parameters structure name
obj=obj.addtunparamstruct('algo_template_tp', @()algo_template_loadtp(), false);

%% Tunable parameters
parshot=10;
obj=obj.addparameter(SCDclass_mdsparnumeric('kb1','enable'          ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot)); 
obj=obj.addparameter(SCDclass_mdsparnumeric('ks1','gain'            ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot)); 
obj=obj.addparameter(SCDclass_mdsparnumeric('ks2','refmodel.gain'   ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));
obj=obj.addparameter(SCDclass_mdsparnumeric('kv1','rowvect'         ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));
obj=obj.addparameter(SCDclass_mdsparnumeric('kv2','colvect'         ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));
obj=obj.addparameter(SCDclass_mdsparnumeric('km1','matrix'          ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));

%% 2nd tunable parameters structure/parameters
obj=obj.addtunparamstruct('algo_template_tp2', @()algo_template_loadtp(), false);
obj=obj.addparameter(SCDclass_mdsparnumeric('kb1','enable'          ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot)); 


%% Wavegens
obj=obj.addwavegenbasetruct('algo_template_inbus1');
obj=obj.addwavegen(SCDclass_mdswgsigsingle( 'ai.ch001','signal1'        ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));
obj=obj.addwavegen(SCDclass_mdswgsigsingle( 'ai.ch002','signal2'        ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));

%% 2nd wavegen base structure/signals
obj=obj.addwavegenbasetruct('algo_template_inbus2');
obj=obj.addwavegen(SCDclass_mdswgsigsingle( 'ai.ch003','signal1'        ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));
obj=obj.addwavegen(SCDclass_mdswgsigsingle( 'ai.ch004','signal2'        ,'srcsrv','spcpc171.epfl.ch','srctree','martetest','shot',parshot));


%% Buses
obj = obj.addbus('algo_template_inBus', 'algo_template_inBus_def' );
obj = obj.addbus('algo_template_outBus', 'algo_template_outBus_def' );
 % function handle that returns cell arays of buses and busnames to be
 % registered
obj = obj.addbus('',@() algo_template_signal_buses());

%% Tasks

%% Print (optional)
obj.printinfo;

end