Commit 09dc7f1c authored by Simone Liuzzo's avatar Simone Liuzzo

selection of simulator file

parent 23dee20c
......@@ -45,11 +45,14 @@ switch machine
% key names in ebs.model for poinhole cameras
at_pinhole_names = {'pinholeD01', 'pinholeD17', 'pinholeD27', 'pinholeID07', 'pinholeID25'};
simulatordevname = 'sys/ringsimulator/ebs';
case 'sy'
latticemodel = sy.model;
simulatordevname ='';
case 'tl2'
latticemodel = tl2.model;
simulatordevname ='';
otherwise
error('Input must be one of the ollowing: ''ebs'', ''sy'', ''tl2'',')
end
......@@ -105,24 +108,47 @@ disp('Properties of pinhole cameras are updated')
sl = 2.0 * latticemodel.getfieldvalue(idx, 'Length'); % get straigth sections length
% set properties of orbit device (computes angle and position at IDs)
devorb = tango.Device('sr/sources/all');
% data = zip(labels, [d for d in iddata.T] + [bmdata.flatten(), sr.emith, sr.emitv, sl])
devorb.id_Hbeta = iddata(:,1);
devorb.id_Halpha = iddata(:,2);
devorb.id_Heta = iddata(:,3);
devorb.id_HetaPrime = iddata(:,4);
devorb.id_Vbeta = iddata(:,5);
devorb.id_Valpha = iddata(:,6);
devorb.d_Vbeta = bmdata(:,1);
devorb.ref_H_emit = latticemodel.emith;
devorb.ref_V_emit = latticemodel.emitv;
devorb.straight_section_length = sl;
devorb.Init();
% set model in simulator.
try
devorb = tango.Device('sr/sources/all');
% data = zip(labels, [d for d in iddata.T] + [bmdata.flatten(), sr.emith, sr.emitv, sl])
devorb.id_Hbeta = iddata(:,1);
devorb.id_Halpha = iddata(:,2);
devorb.id_Heta = iddata(:,3);
devorb.id_HetaPrime = iddata(:,4);
devorb.id_Vbeta = iddata(:,5);
devorb.id_Valpha = iddata(:,6);
devorb.d_Vbeta = bmdata(:,1);
devorb.ref_H_emit = latticemodel.emith;
devorb.ref_V_emit = latticemodel.emitv;
devorb.straight_section_length = sl;
devorb.Init();
catch err
disp(err);
disp('No devices for ID virtual BPM position, angle and emittance growth')
end
% set model in simulator.
if ~isempty(simulatordevname)
p = tango.Device(simulatordevname); % get pinhole device name from lattice model.
% prompt to simulator file selection
cursimufile = p.get_property('RingFile');
simulatorfile = uigetfile(fullfile(directory,'theory'),...
['Present simulator file is: ' cursimufile{1}]);
[~,na,~]=fileparts(simulatorfile); % remoe .mat
p.set_property('RingFile',fullfile(directory,'theory',na));
reset_ebs_simu;
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment