mc


!cp ~/NetBeansProjects/MPipeline/dist/MPipeline.jar .
!cp -r ~/NetBeansProjects/MPipeline/dist/lib .


javaaddpath(fullfile(pwd, 'MPipeline.jar'));

%%


wb = LTPDAworkbench;

wb.newPipeline('SSM pipeline');

% Build simulation

% constructor
wb.addBlock('DFACS', ssm.getInfo, 0, 0);
wb.uploadPlist('DFACS', plist('built-in', 'DFACS_5_Science_Mode_1_All_Optical_Readouts', ...
  'dim', 1, ...
  'withParams', true));

% set name
wb.addBlock('set DFACS name', ssm.getInfo('setName'), 150, 0);
wb.connectBlocks('DFACS', 1, 'set DFACS name', 1);

% add simulate block
wb.addBlock('simulate DFACS', ssm.getInfo('simulate'), 250,100);

pl = plist('aos variable names', {'rx1_H1_Ifo_delayed'}, 'aos', 'PORT_1', ...
  'return outputs', {'fx_mps_c'});
 
wb.uploadPlist('simulate DFACS', pl);

% connect output of setname to input of simulate
wb.connectBlocks('set DFACS name', 1, 'simulate DFACS', 1);
 
% make noise AO
wb.addBlock('noise AO', ao.getInfo, 0, 200);
wb.uploadPlist('noise AO', plist('tsfcn', '1e-3*randn(size(t))', 'fs', 10, 'nsecs', 1000));

% connect noise AO to port 1 of simulate
wb.connectBlocks('noise AO', 1, 'simulate DFACS', 2);

% measure TF
wb.addBlock('tf', ao.getInfo('ltfe'), 400,100);

% connect output of simulate to input of TF
wb.connectBlocks('simulate DFACS', 1, 'tf', 1)
% connect output of AO to input of TF
wb.connectBlocks('noise AO', 1, 'tf', 2)

% add iPlot
wb.addBlock('view', ao.getInfo('iplot'), 500,100);
wb.connectBlocks('tf', 1, 'view', 1)

return

wb.runPipeline

save(wb, 'ssmtest.lwb')

%% 
mc


wb = LTPDAworkbench('ssmtest.lwb')
wb.runPipeline






