0001 function varargout = synchro_injecteur8_rafale(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 gui_Singleton = 1;
0035 gui_State = struct('gui_Name', mfilename, ...
0036 'gui_Singleton', gui_Singleton, ...
0037 'gui_OpeningFcn', @synchro_injecteur8_rafale_OpeningFcn, ...
0038 'gui_OutputFcn', @synchro_injecteur8_rafale_OutputFcn, ...
0039 'gui_LayoutFcn', [] , ...
0040 'gui_Callback', []);
0041 if nargin && ischar(varargin{1})
0042 gui_State.gui_Callback = str2func(varargin{1});
0043 end
0044
0045 if nargout
0046 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0047 else
0048 gui_mainfcn(gui_State, varargin{:});
0049 end
0050
0051
0052
0053
0054 function synchro_injecteur8_rafale_OpeningFcn(hObject, eventdata, handles, varargin)
0055
0056
0057
0058
0059
0060
0061
0062 handles.output = hObject;
0063
0064
0065 fprintf('Liste devices annexes \n');
0066
0067
0068 name={'ANS/DG/DCCT-CTRL','LT1/DG/MC','BOO-C01/DG/DCCT',...
0069 'ANS/DG/PUB-FillingMode', 'ANS/FC/INJ_COND'};
0070 for i=1:4
0071 try
0072 txt=tango_command_inout2(name{2},'State');
0073
0074
0075 catch
0076 txt='bug_device';
0077 end
0078 fprintf('%s : %s \n',name{i},txt);
0079 end
0080
0081
0082 if isdeployed
0083 cd(getenv('MLROOT'));
0084 setpathsoleil('Booster');
0085 end
0086
0087
0088
0089
0090 Directory = [getfamilydata('Directory','DataRoot') '../Boosterdata/Datatemp'];
0091 handles.Directory=Directory;
0092
0093
0094
0095 DirName = getfamilydata('Directory', 'Synchro');
0096 handles.DirName=DirName;
0097
0098
0099 FileName = [DirName 'synchro_offset_lin'];
0100 fprintf('Laurent:%s\n', FileName');
0101 load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
0102 set(handles.inj_offset,'String',num2str(inj_offset));
0103 set(handles.ext_offset,'String',num2str(ext_offset));
0104 set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
0105
0106 handles.lin_fin_step=0.090;
0107 handles.one_bunch=2.84/handles.lin_fin_step;
0108
0109
0110 handles.periode = 10;
0111 set(handles.periode_edit,'String',num2str(handles.periode));
0112 set(handles.edit_Ncycle,'String',num2str(1));
0113 set(handles.edit_Ncoup,'String',1.0);
0114
0115
0116 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprStepDelay');
0117 clk1=temp.value(1);
0118 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
0119 clk2=temp.value(1);
0120
0121
0122 jump=int32([0 39 26 13]);
0123 handles.clk_spare =jump + int32(clk1);
0124 handles.clk_soft=jump + int32(clk2);
0125 handles.quart=1;
0126
0127
0128 bunch=[1];
0129 [dtour,dpaquet]=bucketnumber(bunch);
0130 offset_linac=lin_fin/handles.lin_fin_step;
0131 bjump=handles.one_bunch;
0132 dpaquet=dpaquet*bjump+offset_linac;
0133 handles.table=int32([length(bunch) dtour dpaquet]);
0134 handles.table0=handles.table;
0135 handles.bunch=bunch;
0136
0137 handles.mode = 'Mode=???';
0138 set(handles.edit_filling_relecture_tables,'Enable','off');
0139 set(handles.edit_filling_relecture_bunch,'Enable','off');
0140
0141
0142
0143
0144
0145 test_modes(handles);
0146
0147
0148
0149 handles.event0 =int32(0);
0150 handles.event00=int32(100);
0151
0152
0153 set(handles.panel_bpm,'Visible','off');
0154 set(handles.uipanel_kicker_machine,'Visible','off');
0155
0156
0157 handles.txt_inj= ' INJECTION AUTOMATIQUE EN COURS ';
0158 handles.txt_noinj=' INJECTION INTERDITE ';
0159
0160
0161 tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(0))
0162 tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(0))
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174 timer2=timer('StartDelay',1,...
0175 'ExecutionMode','fixedRate','Period',3,'TasksToExecute',Inf);
0176 timer2.TimerFcn = {@fonction_alex2, hObject,eventdata, handles};
0177 setappdata(handles.figure1,'Timer2',timer2);
0178
0179
0180 timer1=timer('StartDelay',1,...
0181 'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
0182 timer1.TimerFcn = {@fonction_alex1, hObject,eventdata, handles};
0183 setappdata(handles.figure1,'Timer1',timer1);
0184
0185
0186 h = uibuttongroup('visible','off','Position',[0.7275 0.72 0.125 0.145],...
0187 'Title','','TitlePosition','centertop',...
0188 'BackgroundColor',[1 0.3 0 ]);
0189 u1 = uicontrol('Style','Radio','String',' OFF','Tag','radiobutton1',...
0190 'pos',[05 85 55 25],'parent',h,'HandleVisibility','off',...
0191 'BackgroundColor',[1 0.3 0 ]);
0192 u2 = uicontrol('Style','Radio','String',' Laps :','Tag','radiobutton2',...
0193 'pos',[05 45 55 25],'parent',h,'HandleVisibility','off',...
0194 'BackgroundColor',[1 0.3 0 ]);
0195 u3 = uicontrol('Style','Radio','String',' Imin :','Tag','radiobutton3',...
0196 'pos',[05 05 55 25],'parent',h,'HandleVisibility','off',...
0197 'BackgroundColor',[1 0.3 0 ]);
0198
0199 set(h,'SelectionChangeFcn',...
0200 {@uibuttongroup_SelectionChangeFcn,handles});
0201
0202 handles.off = u1;
0203 handles.on1 = u2;
0204 handles.on2 = u3;
0205
0206 set(h,'SelectedObject',u1);
0207 set(h,'Visible','on');
0208
0209
0210 set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer1,handles.figure1});
0211 set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer2,handles.figure1});
0212
0213
0214
0215 guidata(hObject, handles);
0216
0217
0218
0219
0220
0221
0222 function varargout = synchro_injecteur8_rafale_OutputFcn(hObject, eventdata, handles)
0223
0224
0225
0226
0227
0228
0229 varargout{1} = handles.output;
0230
0231
0232
0233 function boo_alim_dipole_Callback(hObject, eventdata, handles)
0234
0235
0236
0237
0238
0239
0240
0241 delay=str2double(get(hObject,'String'));
0242 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay',delay);
0243
0244
0245 function boo_alim_dipole_CreateFcn(hObject, eventdata, handles)
0246
0247
0248
0249
0250
0251
0252 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0253 set(hObject,'BackgroundColor','white');
0254 end
0255
0256
0257 function boo_alim_qf_Callback(hObject, eventdata, handles)
0258
0259
0260
0261
0262
0263
0264
0265 delay=str2double(get(hObject,'String'));
0266 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay',delay);
0267
0268
0269 function boo_alim_qf_CreateFcn(hObject, eventdata, handles)
0270
0271
0272
0273
0274
0275
0276 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0277 set(hObject,'BackgroundColor','white');
0278 end
0279
0280
0281
0282 function boo_alim_qd_Callback(hObject, eventdata, handles)
0283
0284
0285
0286
0287
0288
0289
0290 delay=str2double(get(hObject,'String'));
0291 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay',delay);
0292
0293
0294 function boo_alim_qd_CreateFcn(hObject, eventdata, handles)
0295
0296
0297
0298
0299
0300
0301 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0302 set(hObject,'BackgroundColor','white');
0303 end
0304
0305
0306
0307 function boo_alim_sf_Callback(hObject, eventdata, handles)
0308
0309
0310
0311
0312
0313
0314
0315 delay=str2double(get(hObject,'String'));
0316 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfTimeDelay',delay);
0317
0318
0319 function boo_alim_sf_CreateFcn(hObject, eventdata, handles)
0320
0321
0322
0323
0324
0325
0326 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0327 set(hObject,'BackgroundColor','white');
0328 end
0329
0330
0331
0332 function boo_alim_sd_Callback(hObject, eventdata, handles)
0333
0334
0335
0336
0337
0338
0339
0340 delay=str2double(get(hObject,'String'));
0341 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdTimeDelay',delay);
0342
0343
0344
0345 function boo_alim_sd_CreateFcn(hObject, eventdata, handles)
0346
0347
0348
0349
0350
0351
0352 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0353 set(hObject,'BackgroundColor','white');
0354 end
0355
0356
0357
0358 function boo_rf_Callback(hObject, eventdata, handles)
0359
0360
0361
0362
0363
0364
0365
0366 delay=str2double(get(hObject,'String'));
0367 tango_write_attribute2('BOO/SY/LOCAL.RF.1', 'rfTimeDelay',delay);
0368
0369
0370 function boo_rf_CreateFcn(hObject, eventdata, handles)
0371
0372
0373
0374
0375
0376
0377 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0378 set(hObject,'BackgroundColor','white');
0379 end
0380
0381
0382
0383 function lin_canon_lpm_Callback(hObject, eventdata, handles)
0384
0385
0386
0387
0388
0389
0390
0391 inj_offset=str2double(get(handles.inj_offset,'String'));
0392 delay=str2double(get(hObject,'String'))+inj_offset;
0393 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay',delay);
0394
0395
0396
0397 function lin_canon_lpm_CreateFcn(hObject, eventdata, handles)
0398
0399
0400
0401
0402
0403
0404 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0405 set(hObject,'BackgroundColor','white');
0406 end
0407
0408
0409
0410 function lt1_emittance_Callback(hObject, eventdata, handles)
0411
0412
0413
0414
0415
0416
0417 inj_offset=str2double(get(handles.inj_offset,'String'));
0418 delay=str2double(get(hObject,'String'))+inj_offset;
0419 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay',delay);
0420
0421
0422 function lt1_emittance_CreateFcn(hObject, eventdata, handles)
0423
0424
0425
0426
0427
0428
0429 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0430 set(hObject,'BackgroundColor','white');
0431 end
0432
0433
0434
0435 function lt1_MC1_Callback(hObject, eventdata, handles)
0436
0437
0438
0439
0440
0441
0442 inj_offset=str2double(get(handles.inj_offset,'String'));
0443 delay=str2double(get(hObject,'String'))+inj_offset;
0444 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay',delay);
0445
0446
0447 function lt1_MC1_CreateFcn(hObject, eventdata, handles)
0448
0449
0450
0451
0452
0453
0454 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0455 set(hObject,'BackgroundColor','white');
0456 end
0457
0458
0459
0460 function lt1_MC2_Callback(hObject, eventdata, handles)
0461
0462
0463
0464
0465
0466
0467 inj_offset=str2double(get(handles.inj_offset,'String'));
0468 delay=str2double(get(hObject,'String'))+inj_offset;
0469 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay',delay);
0470
0471
0472 function lt1_MC2_CreateFcn(hObject, eventdata, handles)
0473
0474
0475
0476
0477
0478
0479 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0480 set(hObject,'BackgroundColor','white');
0481 end
0482
0483
0484
0485 function lt1_osc_Callback(hObject, eventdata, handles)
0486
0487
0488
0489
0490
0491
0492 inj_offset=str2double(get(handles.inj_offset,'String'));
0493 delay=str2double(get(hObject,'String'))+inj_offset;
0494 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay',delay);
0495
0496
0497
0498 function lt1_osc_CreateFcn(hObject, eventdata, handles)
0499
0500
0501
0502
0503
0504
0505 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0506 set(hObject,'BackgroundColor','white');
0507 end
0508
0509
0510
0511 function sdc1_Callback(hObject, eventdata, handles)
0512
0513
0514
0515
0516
0517
0518 inj_offset=str2double(get(handles.inj_offset,'String'));
0519 delay=str2double(get(hObject,'String'))+inj_offset;
0520 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay',delay);
0521
0522
0523 function sdc1_CreateFcn(hObject, eventdata, handles)
0524
0525
0526
0527
0528
0529
0530 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0531 set(hObject,'BackgroundColor','white');
0532 end
0533
0534
0535
0536 function boo_inj_septum_Callback(hObject, eventdata, handles)
0537
0538
0539
0540
0541
0542
0543 inj_offset=str2double(get(handles.inj_offset,'String'));
0544 delay=str2double(get(hObject,'String'))+inj_offset;
0545 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay',delay);
0546
0547
0548 function boo_inj_septum_CreateFcn(hObject, eventdata, handles)
0549
0550
0551
0552
0553
0554
0555 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0556 set(hObject,'BackgroundColor','white');
0557 end
0558
0559
0560
0561 function boo_inj_kicker_Callback(hObject, eventdata, handles)
0562
0563
0564
0565
0566
0567
0568 inj_offset=str2double(get(handles.inj_offset,'String'));
0569 delay=str2double(get(hObject,'String'))+inj_offset;
0570 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay',delay);
0571
0572
0573 function boo_inj_kicker_CreateFcn(hObject, eventdata, handles)
0574
0575
0576
0577
0578
0579
0580 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0581 set(hObject,'BackgroundColor','white');
0582 end
0583
0584
0585
0586 function boo_bpm_Callback(hObject, eventdata, handles)
0587
0588
0589
0590
0591
0592
0593
0594 inj_offset=str2double(get(handles.inj_offset,'String'));
0595 delay=str2double(get(hObject,'String'))+inj_offset;
0596 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay',delay);
0597 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigTimeDelay',delay);
0598 tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigTimeDelay',delay);
0599 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigTimeDelay',delay);
0600
0601
0602
0603 function boo_bpm_CreateFcn(hObject, eventdata, handles)
0604
0605
0606
0607
0608
0609
0610 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0611 set(hObject,'BackgroundColor','white');
0612 end
0613
0614
0615
0616 function boo_nod_Callback(hObject, eventdata, handles)
0617
0618
0619
0620
0621
0622
0623 inj_offset=str2double(get(handles.inj_offset,'String'));
0624 delay=str2double(get(hObject,'String'))+inj_offset;
0625 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay',delay);
0626
0627
0628 function boo_nod_CreateFcn(hObject, eventdata, handles)
0629
0630
0631
0632
0633
0634
0635 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0636 set(hObject,'BackgroundColor','white');
0637 end
0638
0639
0640
0641 function boo_dcct_Callback(hObject, eventdata, handles)
0642
0643
0644
0645
0646
0647
0648 inj_offset=str2double(get(handles.inj_offset,'String'));
0649 delay=str2double(get(hObject,'String'))+inj_offset;
0650 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTimeDelay',delay);
0651
0652
0653 function boo_dcct_CreateFcn(hObject, eventdata, handles)
0654
0655
0656
0657
0658
0659
0660 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0661 set(hObject,'BackgroundColor','white');
0662 end
0663
0664
0665
0666 function lin_canon_spm_fin_Callback(hObject, eventdata, handles)
0667
0668
0669
0670
0671
0672
0673
0674 inj_offset=str2double(get(handles.inj_offset,'String'));
0675 ext_offset=str2double(get(handles.ext_offset,'String'));
0676 lin_fin =str2double(get(handles.lin_canon_spm_fin,'String'));
0677
0678
0679 FileName = [handles.DirName 'synchro_offset_lin'];
0680 save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
0681
0682
0683 function lin_canon_spm_fin_CreateFcn(hObject, eventdata, handles)
0684
0685
0686
0687
0688
0689
0690 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0691 set(hObject,'BackgroundColor','white');
0692 end
0693
0694
0695
0696 function central_spare_Callback(hObject, eventdata, handles)
0697
0698
0699
0700
0701
0702
0703
0704 delay=str2double(get(hObject,'String'));
0705 tango_write_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay',delay);
0706
0707
0708 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
0709 if (temp.value(1)==2)
0710
0711 elseif (temp.value(1)==5)
0712 dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
0713 inj_offset=str2double(get(handles.inj_offset,'String'));
0714 dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
0715 delay=dt.value(1)-dt1.value(1)+inj_offset;
0716 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
0717 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
0718 set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
0719 end
0720
0721
0722 function central_spare_CreateFcn(hObject, eventdata, handles)
0723
0724
0725
0726
0727
0728
0729 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0730 set(hObject,'BackgroundColor','white');
0731 end
0732
0733
0734
0735 function central_inj_Callback(hObject, eventdata, handles)
0736
0737
0738
0739
0740
0741
0742
0743 delay=str2double(get(hObject,'String'));
0744 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay',delay);
0745
0746
0747 function central_inj_CreateFcn(hObject, eventdata, handles)
0748
0749
0750
0751
0752
0753
0754 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0755 set(hObject,'BackgroundColor','white');
0756 end
0757
0758
0759
0760
0761 function central_soft_Callback(hObject, eventdata, handles)
0762
0763
0764
0765
0766
0767
0768
0769 delay=str2double(get(hObject,'String'));
0770 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay',delay);
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793 function central_soft_CreateFcn(hObject, eventdata, handles)
0794
0795
0796
0797
0798
0799
0800 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0801 set(hObject,'BackgroundColor','white');
0802 end
0803
0804
0805
0806 function button_acquisition_nooffset_Callback(hObject, eventdata, handles)
0807
0808
0809
0810
0811 test_modes(handles);
0812
0813
0814 set(handles.inj_offset,'Enable','off');
0815 set(handles.sdc1,'Enable','off');
0816 set(handles.lin_canon_lpm,'Enable','off');
0817 set(handles.lin_canon_spm,'Enable','off');
0818 set(handles.lin_canon_spm_fin,'Enable','off');
0819 set(handles.lin_alim,'Enable','off');
0820 set(handles.boo_bpm,'Enable','off');
0821 set(handles.lt1_emittance,'Enable','off');
0822 set(handles.lt1_MC1,'Enable','off');
0823 set(handles.lt1_MC2,'Enable','off');
0824 set(handles.lt1_osc,'Enable','off');
0825 set(handles.boo_dcct,'Enable','off');
0826 set(handles.boo_nod,'Enable','off');
0827 set(handles.boo_inj_septum,'Enable','off');
0828 set(handles.boo_inj_kicker,'Enable','off');
0829 set(handles.boo_alim_dipole,'Enable','off');
0830 set(handles.boo_alim_qf,'Enable','off');
0831 set(handles.boo_alim_qd,'Enable','off');
0832 set(handles.boo_alim_sf,'Enable','off');
0833 set(handles.boo_alim_sd,'Enable','off');
0834 set(handles.boo_rf,'Enable','off');
0835 set(handles.boo_mrsv,'Enable','off');
0836 set(handles.lin_modulateur,'Enable','off');
0837 set(handles.ext_offset,'Enable','off');
0838 set(handles.boo_ext_dof,'Enable','off');
0839 set(handles.boo_ext_sept_p,'Enable','off');
0840 set(handles.boo_ext_sept_a,'Enable','off');
0841 set(handles.boo_ext_kicker,'Enable','off');
0842 set(handles.sdc2,'Enable','off');
0843 set(handles.lt2_emittance,'Enable','off');
0844 set(handles.lt2_osc,'Enable','off');
0845 set(handles.lt2_bpm,'Enable','off');
0846 set(handles.ans_inj_k1,'Enable','off');
0847 set(handles.ans_inj_k2,'Enable','off');
0848 set(handles.ans_inj_k3,'Enable','off');
0849 set(handles.ans_inj_k4,'Enable','off');
0850 set(handles.ans_inj_sept_p,'Enable','off');
0851 set(handles.ans_inj_sept_a,'Enable','off');
0852 set(handles.ans_bpm,'Enable','off');
0853 set(handles.ans_dcct,'Enable','off');
0854 set(handles.ans_nod,'Enable','off');
0855 set(handles.ans_bpm_c01,'Enable','off');
0856 set(handles.ans_bpm_c02,'Enable','off');
0857 set(handles.ans_bpm_c03,'Enable','off');
0858 set(handles.ans_bpm_c04,'Enable','off');
0859 set(handles.ans_bpm_c05,'Enable','off');
0860 set(handles.ans_bpm_c06,'Enable','off');
0861 set(handles.ans_bpm_c07,'Enable','off');
0862 set(handles.ans_bpm_c08,'Enable','off');
0863 set(handles.ans_bpm_c09,'Enable','off');
0864 set(handles.ans_bpm_c10,'Enable','off');
0865 set(handles.ans_bpm_c11,'Enable','off');
0866 set(handles.ans_bpm_c12,'Enable','off');
0867 set(handles.ans_bpm_c13,'Enable','off');
0868 set(handles.ans_bpm_c14,'Enable','off');
0869 set(handles.ans_bpm_c15,'Enable','off');
0870 set(handles.ans_bpm_c16,'Enable','off');
0871
0872 get_synchro_delay_nooffset(handles)
0873 n=1;
0874
0875 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'libre.1TimeDelay');
0876 try txt=num2str(temp.value(n)); catch txt='Bug device' ; end
0877 set(handles.lin_alim,'String',txt);
0878
0879 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceTimeDelay');
0880 try ;txt=num2str(temp.value(n)); catch txt=bug_device ; end
0881 set(handles.boo_mrsv,'String',txt);
0882
0883 temp=tango_read_attribute2('ANS-C14/SY/LOCAL.DG.1', 'perteTimeDelay');
0884 try ;txt=num2str(temp.value(n)); catch txt=bug_device ; end
0885 set(handles.ans_nod,'String',txt);
0886
0887
0888
0889 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
0890 if (temp.value(n)==2)
0891
0892 elseif (temp.value(n)==5)
0893
0894 end
0895
0896
0897 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
0898 offset=temp.value(1)*52;
0899 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
0900 n=temp.value;
0901 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
0902 table=temp.value(1:n)-offset;
0903 set(handles.edit_filling_relecture_tables,'String',['T=' , num2str(table)]);
0904
0905
0906
0907
0908 function button_acquisition_delay_Callback(hObject, eventdata, handles)
0909
0910
0911
0912 bug_device='Bug device';
0913
0914 test_modes(handles);
0915
0916 set(handles.inj_offset,'Enable','on');
0917 set(handles.sdc1,'Enable','on');
0918 set(handles.lin_canon_lpm,'Enable','on');
0919 set(handles.lin_canon_spm,'Enable','on');
0920 set(handles.lin_canon_spm_fin,'Enable','on');
0921 set(handles.lin_alim,'Enable','on');
0922 set(handles.boo_bpm,'Enable','on');
0923 set(handles.lt1_emittance,'Enable','on');
0924 set(handles.lt1_MC1,'Enable','on');
0925 set(handles.lt1_MC2,'Enable','on');
0926 set(handles.lt1_osc,'Enable','on');
0927 set(handles.boo_dcct,'Enable','on');
0928 set(handles.boo_nod,'Enable','on');
0929 set(handles.boo_inj_septum,'Enable','on');
0930 set(handles.boo_inj_kicker,'Enable','on');
0931 set(handles.boo_alim_dipole,'Enable','on');
0932 set(handles.boo_alim_qf,'Enable','on');
0933 set(handles.boo_alim_qd,'Enable','on');
0934 set(handles.boo_alim_sf,'Enable','on');
0935 set(handles.boo_alim_sd,'Enable','on');
0936 set(handles.boo_rf,'Enable','on');
0937 set(handles.boo_mrsv,'Enable','on');
0938 set(handles.lin_modulateur,'Enable','on');
0939 set(handles.ext_offset,'Enable','on');
0940 set(handles.boo_ext_dof,'Enable','on');
0941 set(handles.boo_ext_sept_p,'Enable','on');
0942 set(handles.boo_ext_sept_a,'Enable','on');
0943 set(handles.boo_ext_kicker,'Enable','on');
0944 set(handles.sdc2,'Enable','on');
0945 set(handles.lt2_emittance,'Enable','on');
0946 set(handles.lt2_osc,'Enable','on');
0947 set(handles.lt2_bpm,'Enable','on');
0948 set(handles.ans_inj_k1,'Enable','on');
0949 set(handles.ans_inj_k2,'Enable','on');
0950 set(handles.ans_inj_k3,'Enable','on');
0951 set(handles.ans_inj_k4,'Enable','on');
0952 set(handles.ans_inj_sept_p,'Enable','on');
0953 set(handles.ans_inj_sept_a,'Enable','on');
0954 set(handles.ans_bpm,'Enable','on');
0955 set(handles.ans_dcct,'Enable','on');
0956 set(handles.ans_nod,'Enable','on');
0957 set(handles.ans_bpm_c01,'Enable','on');
0958 set(handles.ans_bpm_c02,'Enable','on');
0959 set(handles.ans_bpm_c03,'Enable','on');
0960 set(handles.ans_bpm_c04,'Enable','on');
0961 set(handles.ans_bpm_c05,'Enable','on');
0962 set(handles.ans_bpm_c06,'Enable','on');
0963 set(handles.ans_bpm_c07,'Enable','on');
0964 set(handles.ans_bpm_c08,'Enable','on');
0965 set(handles.ans_bpm_c09,'Enable','on');
0966 set(handles.ans_bpm_c10,'Enable','on');
0967 set(handles.ans_bpm_c11,'Enable','on');
0968 set(handles.ans_bpm_c12,'Enable','on');
0969 set(handles.ans_bpm_c13,'Enable','on');
0970 set(handles.ans_bpm_c14,'Enable','on');
0971 set(handles.ans_bpm_c15,'Enable','on');
0972 set(handles.ans_bpm_c16,'Enable','on');
0973 set(handles.ans_k_pc,'Enable','on');
0974 set(handles.ans_k_h,'Enable','on');
0975 set(handles.ans_k_v,'Enable','on');
0976
0977
0978
0979 FileName = [handles.DirName 'synchro_offset_lin'];
0980 load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
0981 set(handles.inj_offset,'String',num2str(inj_offset));
0982 set(handles.ext_offset,'String',num2str(ext_offset));
0983 set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
0984
0985 get_synchro_delay(handles)
0986 n=1;
0987 ext_offset=str2double(get(handles.ext_offset,'String'));
0988 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay');
0989 set(handles.central_pc,'String',num2str(temp.value(n)));
0990
0991 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'libre.1TimeDelay');
0992 try txt=num2str(temp.value(n)); catch txt='Bug device' ; end
0993 set(handles.lin_alim,'String',txt);
0994
0995 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceTimeDelay');
0996 try ;txt=num2str(temp.value(n)-ext_offset); catch txt=bug_device ; end
0997 set(handles.boo_mrsv,'String',txt);
0998
0999 temp=tango_read_attribute2('ANS-C14/SY/LOCAL.DG.1', 'perteTimeDelay');
1000 try ;txt=num2str(temp.value(n)-ext_offset); catch txt=bug_device ; end
1001 set(handles.ans_nod,'String',txt);
1002
1003
1004
1005 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
1006 if (temp.value(n)==2)
1007
1008 elseif (temp.value(n)==5)
1009
1010 end
1011
1012
1013
1014
1015 offset_linac=10*lin_fin;
1016 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
1017 n=temp.value;
1018 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
1019 table_ext=temp.value(1:n);
1020 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
1021 table_linac=(temp.value(1:n)-offset_linac)/28;
1022 table=[];
1023 for i=1:n
1024 table=[table ' ' '(' num2str([table_ext(i)]) ' ' num2str([table_linac(i)]) ')'];
1025 end
1026 set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
1027 set(handles.edit_filling_relecture_bunch, 'String','??');
1028
1029
1030
1031
1032 function button_injection_soft_Callback(hObject, eventdata, handles)
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051 [r1,r2]=fire_injection(handles);
1052
1053
1054
1055
1056 [flag]=check_boo_synchro;
1057 if flag==1 && r1> 20
1058 set(handles.central_inj,'Backgroundcolor', [1 0 0]);
1059 else
1060 set(handles.central_inj,'Backgroundcolor', [1 1 1]);
1061 end
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073 test_modes(handles);
1074
1075 function periode_edit_Callback(hObject, eventdata, handles)
1076
1077
1078
1079
1080
1081
1082
1083 val_multishot = get(handles.on1,'Value');
1084
1085 if val_multishot
1086 errordlg('positionner le trigger a OFF !','Attention');
1087 return
1088 else
1089 periode = str2double(get(hObject,'String'));
1090
1091
1092 timer1=timer('StartDelay',1,...
1093 'ExecutionMode','fixedRate','Period',periode,'TasksToExecute',Inf);
1094 timer1.TimerFcn = {@fonction_alex1, hObject,eventdata, handles};
1095 setappdata(handles.figure1,'Timer1',timer1);
1096
1097
1098 guidata(hObject, handles);
1099
1100
1101
1102 end
1103
1104
1105
1106
1107 function periode_edit_CreateFcn(hObject, eventdata, handles)
1108
1109
1110
1111
1112
1113
1114 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1115 set(hObject,'BackgroundColor','white');
1116 end
1117
1118 function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles)
1119
1120
1121
1122
1123
1124 timer1 = getappdata(handles.figure1,'Timer1');
1125 timer2 = getappdata(handles.figure1,'Timer2');
1126
1127
1128
1129 switch get(get(hObject,'SelectedObject'),'Tag')
1130 case 'radiobutton1'
1131
1132 stop(timer1);
1133 stop(timer2);
1134 set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1135 test_modes(handles);
1136 tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(0))
1137 tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(0))
1138 case 'radiobutton2'
1139
1140 start(timer1);
1141 set(handles.edit_modes,'String',handles.txt_inj);
1142 tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(1))
1143 case 'radiobutton3'
1144
1145 temp=tango_read_attribute2('ANS/DG/DCCT-CTRL','current');anscur=temp.value;
1146 if (anscur>1.)
1147 start(timer2);
1148 set(handles.edit_modes,'String',handles.txt_inj);
1149 tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(1))
1150 else
1151
1152 end
1153 end
1154
1155
1156 function fonction_alex1(arg1,arg2,hObject,eventdata,handles)
1157
1158
1159
1160
1161 color=get(handles.uipanel6,'Backgroundcolor');
1162 if color==[1 0.3 0]
1163 set(handles.uipanel6,'Backgroundcolor', [1 0.3 1]);
1164 elseif color==[1 0.3 1]
1165 set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1166 end
1167
1168 button_injection_soft_Callback(hObject,eventdata,handles)
1169
1170
1171 function fonction_alex2(arg1,arg2,hObject,eventdata,handles)
1172
1173
1174
1175
1176
1177 temp=tango_read_attribute2('ANS/DG/DCCT-CTRL','current');anscur=temp.value;
1178 set(handles.edit_courant_total,'String', num2str(anscur,'%5.2f'));
1179 Imin=str2double(get(handles.edit_Imin,'String'));
1180
1181 color=get(handles.uipanel6,'Backgroundcolor');
1182 if color==[1 0.3 0]
1183 set(handles.uipanel6,'Backgroundcolor', [1 0.3 1]);
1184 elseif color==[1 0.3 1]
1185 set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1186 end
1187
1188
1189 if (anscur>Imin)
1190
1191
1192 tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(1))
1193 else
1194
1195
1196
1197 button_injection_soft_Callback(hObject, eventdata, handles)
1198 end
1199
1200
1201
1202
1203 function Closinggui(obj, event, handles, figure1)
1204
1205
1206 answer = questdlg('Fermer softsynchro ?',...
1207 'Exit softsynchro',...
1208 'Yes','No','Yes');
1209
1210 switch answer
1211 case 'Yes'
1212 delete(handles);
1213 delete(figure1);
1214 otherwise
1215 disp('Closing aborted')
1216 end
1217
1218
1219
1220
1221 function button_softmoins_Callback(hObject, eventdata, handles)
1222
1223
1224
1225 tt=0.6;
1226
1227 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1228 step=temp.value(1)-52;
1229 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',step);
1230 pause(2*tt)
1231
1232
1233 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1234 if (temp.value(1)==2)
1235 pause(tt)
1236 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1237 set(handles.central_soft,'String',num2str(temp.value(1)));
1238 elseif (temp.value(1)==5)
1239 dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1240 inj_offset=str2double(get(handles.inj_offset,'String'));
1241 dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
1242 delay=dt.value(1)-dt1.value(1)+inj_offset;
1243 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1244
1245 pause(tt)
1246
1247 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1248 set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1249 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1250 set(handles.central_soft,'String',num2str(temp.value(1)));
1251 end
1252
1253
1254
1255
1256 function button_softplus_Callback(hObject, eventdata, handles)
1257
1258
1259
1260 tt=0.6;
1261
1262 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1263 step=temp.value(1)+52;
1264 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',step);
1265 pause(2*tt)
1266
1267
1268 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1269 if (temp.value(1)==2)
1270 pause(tt)
1271
1272 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1273 set(handles.central_soft,'String',num2str(temp.value(1)));
1274 elseif (temp.value(1)==5)
1275 dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1276 inj_offset=str2double(get(handles.inj_offset,'String'));
1277 dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
1278 delay=dt.value(1)-dt1.value(1)+inj_offset;
1279 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1280
1281 pause(tt)
1282
1283 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1284 set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1285 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1286 set(handles.central_soft,'String',num2str(temp.value(1)));
1287 end
1288
1289
1290
1291
1292 function button_injmoins_Callback(hObject, eventdata, handles)
1293
1294
1295
1296 tt=0.6;
1297
1298 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay');
1299 step=temp.value(1)-52;
1300 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',step);
1301 pause(2*tt)
1302
1303
1304 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1305 if (temp.value(1)==5)
1306 pause(tt)
1307
1308 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1309 set(handles.central_inj,'String',num2str(temp.value(1)));
1310 elseif (temp.value(1)==2)
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1323 set(handles.central_inj,'String',num2str(temp.value(1)));
1324 end
1325
1326
1327
1328 function button_injplus_Callback(hObject, eventdata, handles)
1329
1330
1331
1332 tt=0.6;
1333
1334 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay');
1335 step=temp.value(1)+52;
1336 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',step);
1337 pause(2*tt)
1338
1339
1340 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1341 if (temp.value(1)==5)
1342 pause(tt)
1343
1344 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1345 set(handles.central_inj,'String',num2str(temp.value(1)));
1346 elseif (temp.value(1)==2)
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1359 set(handles.central_inj,'String',num2str(temp.value(1)));
1360 end
1361
1362
1363
1364
1365
1366
1367 function boo_ext_sept_p_Callback(hObject, eventdata, handles)
1368
1369
1370
1371
1372
1373
1374 ext_offset=str2double(get(handles.ext_offset,'String'));
1375 delay=str2double(get(hObject,'String'))+ext_offset;
1376 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
1377
1378
1379 function boo_ext_sept_p_CreateFcn(hObject, eventdata, handles)
1380
1381
1382
1383
1384
1385
1386 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1387 set(hObject,'BackgroundColor','white');
1388 end
1389
1390
1391 function boo_ext_dof_Callback(hObject, eventdata, handles)
1392
1393
1394
1395
1396
1397
1398 ext_offset=str2double(get(handles.ext_offset,'String'));
1399 delay=str2double(get(hObject,'String'))+ext_offset;
1400 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
1401
1402
1403 function boo_ext_dof_CreateFcn(hObject, eventdata, handles)
1404
1405
1406
1407
1408
1409
1410 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1411 set(hObject,'BackgroundColor','white');
1412 end
1413
1414
1415 function boo_ext_sept_a_Callback(hObject, eventdata, handles)
1416
1417
1418
1419
1420
1421
1422 ext_offset=str2double(get(handles.ext_offset,'String'));
1423 delay=str2double(get(hObject,'String'))+ext_offset;
1424 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
1425
1426
1427 function boo_ext_sept_a_CreateFcn(hObject, eventdata, handles)
1428
1429
1430
1431
1432
1433
1434 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1435 set(hObject,'BackgroundColor','white');
1436 end
1437
1438
1439
1440 function boo_ext_kicker_Callback(hObject, eventdata, handles)
1441
1442
1443
1444
1445
1446
1447 ext_offset=str2double(get(handles.ext_offset,'String'));
1448 delay=str2double(get(hObject,'String'))+ext_offset;
1449 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
1450
1451
1452
1453 function boo_ext_kicker_CreateFcn(hObject, eventdata, handles)
1454
1455
1456
1457
1458
1459
1460 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1461 set(hObject,'BackgroundColor','white');
1462 end
1463
1464
1465
1466 function ans_inj_sept_p_Callback(hObject, eventdata, handles)
1467
1468
1469
1470
1471
1472
1473
1474 ext_offset=str2double(get(handles.ext_offset,'String'));
1475 delay=str2double(get(hObject,'String'))+ext_offset;
1476 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
1477
1478
1479 function ans_inj_sept_p_CreateFcn(hObject, eventdata, handles)
1480
1481
1482
1483
1484
1485
1486 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1487 set(hObject,'BackgroundColor','white');
1488 end
1489
1490
1491
1492 function ans_inj_sept_a_Callback(hObject, eventdata, handles)
1493
1494
1495
1496
1497
1498
1499
1500 ext_offset=str2double(get(handles.ext_offset,'String'));
1501 delay=str2double(get(hObject,'String'))+ext_offset;
1502 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
1503
1504
1505 function ans_inj_sept_a_CreateFcn(hObject, eventdata, handles)
1506
1507
1508
1509
1510
1511
1512 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1513 set(hObject,'BackgroundColor','white');
1514 end
1515
1516
1517
1518 function ans_inj_k1_Callback(hObject, eventdata, handles)
1519
1520
1521
1522
1523
1524
1525
1526 ext_offset=str2double(get(handles.ext_offset,'String'));
1527 delay=str2double(get(hObject,'String'))+ext_offset;
1528 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
1529
1530
1531
1532
1533 function ans_inj_k1_CreateFcn(hObject, eventdata, handles)
1534
1535
1536
1537
1538
1539
1540 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1541 set(hObject,'BackgroundColor','white');
1542 end
1543
1544
1545
1546 function ans_inj_k2_Callback(hObject, eventdata, handles)
1547
1548
1549
1550
1551
1552
1553
1554 ext_offset=str2double(get(handles.ext_offset,'String'));
1555 delay=str2double(get(hObject,'String'))+ext_offset;
1556 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
1557
1558
1559 function ans_inj_k2_CreateFcn(hObject, eventdata, handles)
1560
1561
1562
1563
1564
1565
1566 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1567 set(hObject,'BackgroundColor','white');
1568 end
1569
1570
1571
1572 function ans_inj_k3_Callback(hObject, eventdata, handles)
1573
1574
1575
1576
1577
1578
1579
1580 ext_offset=str2double(get(handles.ext_offset,'String'));
1581 delay=str2double(get(hObject,'String'))+ext_offset;
1582 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
1583
1584
1585 function ans_inj_k3_CreateFcn(hObject, eventdata, handles)
1586
1587
1588
1589
1590
1591
1592 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1593 set(hObject,'BackgroundColor','white');
1594 end
1595
1596
1597
1598 function ans_inj_k4_Callback(hObject, eventdata, handles)
1599
1600
1601
1602
1603
1604
1605
1606 ext_offset=str2double(get(handles.ext_offset,'String'));
1607 delay=str2double(get(hObject,'String'))+ext_offset;
1608 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
1609
1610
1611 function ans_inj_k4_CreateFcn(hObject, eventdata, handles)
1612
1613
1614
1615
1616
1617
1618 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1619 set(hObject,'BackgroundColor','white');
1620 end
1621
1622
1623
1624 function ans_dcct_Callback(hObject, eventdata, handles)
1625
1626
1627
1628
1629
1630
1631
1632 ext_offset=str2double(get(handles.ext_offset,'String'));
1633 delay=str2double(get(hObject,'String'))+ext_offset;
1634 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctTimeDelay',delay);
1635
1636
1637
1638 function ans_dcct_CreateFcn(hObject, eventdata, handles)
1639
1640
1641
1642
1643
1644
1645 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1646 set(hObject,'BackgroundColor','white');
1647 end
1648
1649
1650
1651 function ans_bpm_Callback(hObject, eventdata, handles)
1652
1653
1654
1655
1656
1657
1658
1659 ext_offset=str2double(get(handles.ext_offset,'String'));
1660 delay=str2double(get(hObject,'String'))+ext_offset;
1661 tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1662 tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1663 tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1664 tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1665 tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1666 tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1667 tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1668 tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1669 tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1670 tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1671 tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1672 tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1673 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1674 tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1675 tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1676 tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1677
1678
1679
1680
1681 function ans_bpm_CreateFcn(hObject, eventdata, handles)
1682
1683
1684
1685
1686
1687
1688 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1689 set(hObject,'BackgroundColor','white');
1690 end
1691
1692
1693
1694 function central_ext_Callback(hObject, eventdata, handles)
1695
1696
1697
1698
1699
1700
1701
1702
1703 delay=str2double(get(hObject,'String'));
1704 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue',delay);
1705
1706
1707 function central_ext_CreateFcn(hObject, eventdata, handles)
1708
1709
1710
1711
1712
1713
1714 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1715 set(hObject,'BackgroundColor','white');
1716 end
1717
1718
1719
1720 function central_soft1_Callback(hObject, eventdata, handles)
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731 function central_soft1_CreateFcn(hObject, eventdata, handles)
1732
1733
1734
1735
1736
1737
1738 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1739 set(hObject,'BackgroundColor','white');
1740 end
1741
1742
1743
1744 function button_extmoins_Callback(hObject, eventdata, handles)
1745
1746
1747
1748
1749 dclk=10;
1750 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1751 step=temp.value(1)-dclk;
1752 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',int32(step));
1753 temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
1754 set(handles.central_ext,'String',num2str(temp.value(1)));
1755
1756
1757 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay');boo=temp.value(1);
1758 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay',double(boo-dclk*52*184/2));
1759 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay');ans=temp.value(1);
1760 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay',double(ans-dclk*52*184/2))
1761
1762
1763 function button_extplus_Callback(hObject, eventdata, handles)
1764
1765
1766
1767
1768 dclk=10;
1769 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1770 step=temp.value(1)+dclk;
1771 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',int32(step));
1772 temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
1773 set(handles.central_ext,'String',num2str(temp.value(1)));
1774
1775
1776 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay');boo=temp.value(1);
1777 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay',double(boo+dclk*52*184/2));
1778 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay');ans=temp.value(1);
1779 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay',double(ans+dclk*52*184/2))
1780
1781 function sdc2_Callback(hObject, eventdata, handles)
1782
1783
1784
1785
1786
1787
1788 ext_offset=str2double(get(handles.ext_offset,'String'));
1789 delay=str2double(get(hObject,'String'))+ext_offset;
1790 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
1791
1792
1793 function sdc2_CreateFcn(hObject, eventdata, handles)
1794
1795
1796
1797
1798
1799
1800 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1801 set(hObject,'BackgroundColor','white');
1802 end
1803
1804
1805
1806 function lt2_emittance_Callback(hObject, eventdata, handles)
1807
1808
1809
1810
1811
1812
1813 ext_offset=str2double(get(handles.ext_offset,'String'));
1814 delay=str2double(get(hObject,'String'))+ext_offset;
1815 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
1816 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceTimeDelay',delay);
1817
1818
1819
1820 function lt2_emittance_CreateFcn(hObject, eventdata, handles)
1821
1822
1823
1824
1825
1826
1827 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1828 set(hObject,'BackgroundColor','white');
1829 end
1830
1831
1832
1833 function lt2_bpm_Callback(hObject, eventdata, handles)
1834
1835
1836
1837
1838
1839
1840 ext_offset=str2double(get(handles.ext_offset,'String'));
1841 delay=str2double(get(hObject,'String'))+ext_offset;
1842 tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1843
1844
1845 function lt2_bpm_CreateFcn(hObject, eventdata, handles)
1846
1847
1848
1849
1850
1851
1852 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1853 set(hObject,'BackgroundColor','white');
1854 end
1855
1856
1857
1858 function lt2_osc_Callback(hObject, eventdata, handles)
1859
1860
1861
1862
1863
1864
1865 ext_offset=str2double(get(handles.ext_offset,'String'));
1866 delay=str2double(get(hObject,'String'))+ext_offset;
1867 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
1868
1869
1870 function lt2_osc_CreateFcn(hObject, eventdata, handles)
1871
1872
1873
1874
1875
1876
1877 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1878 set(hObject,'BackgroundColor','white');
1879 end
1880
1881
1882
1883 function lin_modulateur_Callback(hObject, eventdata, handles)
1884
1885
1886
1887
1888
1889
1890 inj_offset=str2double(get(handles.inj_offset,'String'));
1891 delay=str2double(get(hObject,'String'))+inj_offset;
1892 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1893
1894
1895 function lin_modulateur_CreateFcn(hObject, eventdata, handles)
1896
1897
1898
1899
1900
1901
1902 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1903 set(hObject,'BackgroundColor','white');
1904 end
1905
1906
1907
1908 function inj_offset_Callback(hObject, eventdata, handles)
1909
1910
1911
1912
1913
1914
1915
1916 inj_offset=str2double(get(hObject,'String'));
1917 ext_offset=str2double(get(handles.ext_offset,'String'));
1918 lin_fin =str2double(get(handles.lin_canon_spm_fin,'String'));
1919
1920 FileName = [handles.DirName 'synchro_offset_lin'];
1921 save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin')
1922
1923
1924 delay=str2double(get(handles.lin_canon_lpm,'String'))+inj_offset;
1925 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay',delay);
1926
1927 delay=str2double(get(handles.lin_canon_spm,'String'))+inj_offset;
1928 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay',delay);
1929
1930 delay=str2double(get(handles.lin_modulateur,'String'))+inj_offset;
1931 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1932
1933 delay=str2double(get(handles.sdc1,'String'))+inj_offset;
1934 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay',delay);
1935
1936
1937
1938 delay=str2double(get(handles.lt1_MC2,'String'))+inj_offset;
1939 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay',delay);
1940
1941 delay=str2double(get(handles.lt1_MC1,'String'))+inj_offset;
1942 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay',delay);
1943
1944 delay=str2double(get(handles.lt1_emittance,'String'))+inj_offset;
1945 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay',delay);
1946
1947 delay=str2double(get(handles.lt1_osc,'String'))+inj_offset;
1948 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay',delay);
1949
1950
1951
1952 delay=str2double(get(handles.boo_inj_septum,'String'))+inj_offset;
1953 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay',delay);
1954
1955 delay=str2double(get(handles.boo_inj_kicker,'String'))+inj_offset;
1956 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay',delay);
1957
1958 delay=str2double(get(handles.boo_bpm,'String'))+inj_offset;
1959 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay',delay);
1960 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigTimeDelay',delay);
1961 tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigTimeDelay',delay);
1962 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigTimeDelay',delay);
1963
1964
1965 delay=str2double(get(handles.boo_nod,'String'))+inj_offset;
1966 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay',delay);
1967
1968
1969
1970
1971
1972
1973
1974 function inj_offset_CreateFcn(hObject, eventdata, handles)
1975
1976
1977
1978
1979
1980
1981 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1982 set(hObject,'BackgroundColor','white');
1983 end
1984
1985
1986
1987 function ext_offset_Callback(hObject, eventdata, handles)
1988
1989
1990
1991
1992
1993
1994
1995 ext_offset=str2double(get(hObject,'String'));
1996 inj_offset=str2double(get(handles.inj_offset,'String'));
1997 lin_fin =str2double(get(handles.lin_canon_spm_fin,'String'));
1998
1999
2000 FileName = [handles.DirName 'synchro_offset_lin'];
2001 save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
2002
2003
2004
2005 delay=str2double(get(handles.boo_ext_dof,'String'))+ext_offset;
2006 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
2007
2008 delay=str2double(get(handles.boo_ext_sept_p,'String'))+ext_offset;
2009 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
2010
2011 delay=str2double(get(handles.boo_ext_sept_a,'String'))+ext_offset;
2012 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
2013
2014 delay=str2double(get(handles.boo_ext_kicker,'String'))+ext_offset;
2015 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
2016
2017 delay=str2double(get(handles.sdc2,'String'))+ext_offset;
2018 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
2019
2020
2021 delay=str2double(get(handles.lt2_bpm,'String'))+ext_offset;
2022 tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
2023
2024 delay=str2double(get(handles.lt2_osc,'String'))+ext_offset;
2025 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
2026
2027 delay=str2double(get(handles.lt2_emittance,'String'))+ext_offset;
2028 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
2029
2030
2031
2032 delay=str2double(get(handles.ans_inj_sept_a,'String'))+ext_offset;
2033 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
2034
2035 delay=str2double(get(handles.ans_inj_sept_p,'String'))+ext_offset;
2036 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
2037
2038 delay=str2double(get(handles.ans_inj_k1,'String'))+ext_offset;
2039 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
2040
2041 delay=str2double(get(handles.ans_inj_k2,'String'))+ext_offset;
2042 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
2043
2044 delay=str2double(get(handles.ans_inj_k3,'String'))+ext_offset;
2045 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
2046
2047 delay=str2double(get(handles.ans_inj_k4,'String'))+ext_offset;
2048 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
2049
2050
2051
2052
2053 function ext_offset_CreateFcn(hObject, eventdata, handles)
2054
2055
2056
2057
2058
2059
2060 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2061 set(hObject,'BackgroundColor','white');
2062 end
2063
2064
2065
2066 function button_acquisition_address_Callback(hObject, eventdata, handles)
2067
2068
2069
2070
2071 test_modes(handles);
2072
2073
2074 set(handles.inj_offset,'Enable','off');
2075 set(handles.sdc1,'Enable','off');
2076 set(handles.lin_canon_lpm,'Enable','off');
2077 set(handles.lin_canon_spm,'Enable','off');
2078 set(handles.lin_canon_spm_fin,'Enable','off');
2079 set(handles.lin_alim,'Enable','off');
2080 set(handles.boo_bpm,'Enable','off');
2081 set(handles.lt1_emittance,'Enable','off');
2082 set(handles.lt1_MC1,'Enable','off');
2083 set(handles.lt1_MC2,'Enable','off');
2084 set(handles.lt1_osc,'Enable','off');
2085 set(handles.boo_dcct,'Enable','off');
2086 set(handles.boo_nod,'Enable','off');
2087 set(handles.boo_inj_septum,'Enable','off');
2088 set(handles.boo_inj_kicker,'Enable','off');
2089 set(handles.boo_alim_dipole,'Enable','off');
2090 set(handles.boo_alim_qf,'Enable','off');
2091 set(handles.boo_alim_qd,'Enable','off');
2092 set(handles.boo_alim_sf,'Enable','off');
2093 set(handles.boo_alim_sd,'Enable','off');
2094 set(handles.boo_rf,'Enable','off');
2095 set(handles.boo_mrsv,'Enable','off');
2096 set(handles.lin_modulateur,'Enable','off');
2097 set(handles.ext_offset,'Enable','off');
2098 set(handles.boo_ext_dof,'Enable','off');
2099 set(handles.boo_ext_sept_p,'Enable','off');
2100 set(handles.boo_ext_sept_a,'Enable','off');
2101 set(handles.boo_ext_kicker,'Enable','off');
2102 set(handles.sdc2,'Enable','off');
2103 set(handles.lt2_emittance,'Enable','off');
2104 set(handles.lt2_osc,'Enable','off');
2105 set(handles.lt2_bpm,'Enable','off');
2106 set(handles.ans_inj_k1,'Enable','off');
2107 set(handles.ans_inj_k2,'Enable','off');
2108 set(handles.ans_inj_k3,'Enable','off');
2109 set(handles.ans_inj_k4,'Enable','off');
2110 set(handles.ans_inj_sept_p,'Enable','off');
2111 set(handles.ans_inj_sept_a,'Enable','off');
2112 set(handles.ans_bpm,'Enable','off');
2113 set(handles.ans_dcct,'Enable','off');
2114 set(handles.ans_nod,'Enable','off');
2115 set(handles.ans_bpm_c01,'Enable','off');
2116 set(handles.ans_bpm_c02,'Enable','off');
2117 set(handles.ans_bpm_c03,'Enable','off');
2118 set(handles.ans_bpm_c04,'Enable','off');
2119 set(handles.ans_bpm_c05,'Enable','off');
2120 set(handles.ans_bpm_c06,'Enable','off');
2121 set(handles.ans_bpm_c07,'Enable','off');
2122 set(handles.ans_bpm_c08,'Enable','off');
2123 set(handles.ans_bpm_c09,'Enable','off');
2124 set(handles.ans_bpm_c10,'Enable','off');
2125 set(handles.ans_bpm_c11,'Enable','off');
2126 set(handles.ans_bpm_c12,'Enable','off');
2127 set(handles.ans_bpm_c13,'Enable','off');
2128 set(handles.ans_bpm_c14,'Enable','off');
2129 set(handles.ans_bpm_c15,'Enable','off');
2130 set(handles.ans_bpm_c16,'Enable','off');
2131
2132
2133
2134 FileName = [handles.DirName 'synchro_offset_lin'];
2135 load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
2136 set(handles.inj_offset,'String',num2str(inj_offset));
2137 set(handles.ext_offset,'String',num2str(ext_offset));
2138 set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
2139
2140 get_synchro_address(handles)
2141 n=1;
2142 temp=tango_read_attribute2('LT1/SY/LOCAL.DG.1', 'libre.1Event');
2143 try txt=num2str(temp.value(n)); catch txt='Bug device' ; end
2144 set(handles.lin_alim,'String',txt);
2145
2146 temp=tango_read_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceEvent');
2147 try ;txt=num2str(temp.value(n)); catch txt=bug_device ; end
2148 set(handles.boo_mrsv,'String',txt);
2149
2150 temp=tango_read_attribute2('ANS-C14/SY/LOCAL.DG.1', 'perteEvent');
2151 try ;txt=num2str(temp.value(n)); catch txt=bug_device ; end
2152 set(handles.ans_nod,'String',txt);
2153
2154
2155
2156 function button_offinj_moins_Callback(hObject, eventdata, handles)
2157
2158
2159
2160
2161 temp=str2double(get(handles.inj_offset,'String'));
2162 step=temp-52*0.52243;
2163 set(handles.inj_offset,'String',step);
2164 inj_offset_Callback(handles.inj_offset, eventdata, handles);
2165
2166
2167 function button_offinj_plus_Callback(hObject, eventdata, handles)
2168
2169
2170
2171
2172 temp=str2double(get(handles.inj_offset,'String'));
2173 step=temp+52*0.52243;
2174 set(handles.inj_offset,'String',step);
2175 inj_offset_Callback(handles.inj_offset, eventdata, handles);
2176
2177
2178 function button_offext_moins_Callback(hObject, eventdata, handles)
2179
2180
2181
2182
2183 temp=str2double(get(handles.ext_offset,'String'));
2184 step=temp-52*0.52243;
2185 set(handles.ext_offset,'String',step);
2186 ext_offset_Callback(handles.ext_offset, eventdata, handles);
2187
2188
2189 function button_offext_plus_Callback(hObject, eventdata, handles)
2190
2191
2192
2193
2194 temp=str2double(get(handles.ext_offset,'String'));
2195 step=temp+52*0.52243;
2196 set(handles.ext_offset,'String',step);
2197 ext_offset_Callback(handles.ext_offset, eventdata, handles);
2198
2199
2200
2201 function button_bpm_Callback(hObject, eventdata, handles)
2202
2203
2204
2205
2206
2207
2208 bpm=get(hObject,'Value');
2209
2210 if (bpm==0)
2211 set(handles.panel_bpm,'Visible','off');
2212 elseif (bpm==1)
2213 set(handles.panel_bpm,'Visible','on');
2214 end
2215
2216
2217
2218 function ans_bpm_c01_Callback(hObject, eventdata, handles)
2219
2220
2221
2222
2223
2224
2225
2226 ext_offset=str2double(get(handles.ext_offset,'String'));
2227 delay=str2double(get(hObject,'String'))+ext_offset;
2228 tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
2229
2230
2231 function ans_bpm_c01_CreateFcn(hObject, eventdata, handles)
2232
2233
2234
2235
2236
2237
2238 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2239 set(hObject,'BackgroundColor','white');
2240 end
2241
2242
2243 function ans_bpm_c02_Callback(hObject, eventdata, handles)
2244
2245
2246
2247
2248
2249
2250 ext_offset=str2double(get(handles.ext_offset,'String'));
2251 delay=str2double(get(hObject,'String'))+ext_offset;
2252 tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2253
2254
2255
2256 function ans_bpm_c02_CreateFcn(hObject, eventdata, handles)
2257
2258
2259
2260
2261
2262
2263 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2264 set(hObject,'BackgroundColor','white');
2265 end
2266
2267
2268
2269 function ans_bpm_c03_Callback(hObject, eventdata, handles)
2270
2271
2272
2273
2274
2275
2276 ext_offset=str2double(get(handles.ext_offset,'String'));
2277 delay=str2double(get(hObject,'String'))+ext_offset;
2278 tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2279
2280
2281
2282 function ans_bpm_c03_CreateFcn(hObject, eventdata, handles)
2283
2284
2285
2286
2287
2288
2289 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2290 set(hObject,'BackgroundColor','white');
2291 end
2292
2293
2294
2295 function ans_bpm_c04_Callback(hObject, eventdata, handles)
2296
2297
2298
2299
2300
2301
2302 ext_offset=str2double(get(handles.ext_offset,'String'));
2303 delay=str2double(get(hObject,'String'))+ext_offset;
2304 tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2305
2306
2307
2308 function ans_bpm_c04_CreateFcn(hObject, eventdata, handles)
2309
2310
2311
2312
2313
2314
2315 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2316 set(hObject,'BackgroundColor','white');
2317 end
2318
2319
2320
2321 function ans_bpm_c05_Callback(hObject, eventdata, handles)
2322
2323
2324
2325
2326
2327
2328 ext_offset=str2double(get(handles.ext_offset,'String'));
2329 delay=str2double(get(hObject,'String'))+ext_offset;
2330 tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2331
2332
2333
2334 function ans_bpm_c05_CreateFcn(hObject, eventdata, handles)
2335
2336
2337
2338
2339
2340
2341 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2342 set(hObject,'BackgroundColor','white');
2343 end
2344
2345
2346
2347 function ans_bpm_c06_Callback(hObject, eventdata, handles)
2348
2349
2350
2351
2352
2353
2354 ext_offset=str2double(get(handles.ext_offset,'String'));
2355 delay=str2double(get(hObject,'String'))+ext_offset;
2356 tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2357
2358
2359
2360 function ans_bpm_c06_CreateFcn(hObject, eventdata, handles)
2361
2362
2363
2364
2365
2366
2367 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2368 set(hObject,'BackgroundColor','white');
2369 end
2370
2371
2372
2373 function ans_bpm_c07_Callback(hObject, eventdata, handles)
2374
2375
2376
2377
2378
2379
2380 ext_offset=str2double(get(handles.ext_offset,'String'));
2381 delay=str2double(get(hObject,'String'))+ext_offset;
2382 tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2383
2384
2385
2386 function ans_bpm_c07_CreateFcn(hObject, eventdata, handles)
2387
2388
2389
2390
2391
2392
2393 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2394 set(hObject,'BackgroundColor','white');
2395 end
2396
2397
2398
2399 function ans_bpm_c08_Callback(hObject, eventdata, handles)
2400
2401
2402
2403
2404
2405
2406 ext_offset=str2double(get(handles.ext_offset,'String'));
2407 delay=str2double(get(hObject,'String'))+ext_offset;
2408 tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2409
2410
2411
2412 function ans_bpm_c08_CreateFcn(hObject, eventdata, handles)
2413
2414
2415
2416
2417
2418
2419 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2420 set(hObject,'BackgroundColor','white');
2421 end
2422
2423
2424
2425 function ans_bpm_c09_Callback(hObject, eventdata, handles)
2426
2427
2428
2429
2430
2431
2432 ext_offset=str2double(get(handles.ext_offset,'String'));
2433 delay=str2double(get(hObject,'String'))+ext_offset;
2434 tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2435
2436
2437
2438 function ans_bpm_c09_CreateFcn(hObject, eventdata, handles)
2439
2440
2441
2442
2443
2444
2445 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2446 set(hObject,'BackgroundColor','white');
2447 end
2448
2449
2450
2451 function ans_bpm_c10_Callback(hObject, eventdata, handles)
2452
2453
2454
2455
2456
2457
2458 ext_offset=str2double(get(handles.ext_offset,'String'));
2459 delay=str2double(get(hObject,'String'))+ext_offset;
2460 tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2461
2462
2463
2464 function ans_bpm_c10_CreateFcn(hObject, eventdata, handles)
2465
2466
2467
2468
2469
2470
2471 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2472 set(hObject,'BackgroundColor','white');
2473 end
2474
2475
2476
2477 function ans_bpm_c11_Callback(hObject, eventdata, handles)
2478
2479
2480
2481
2482
2483
2484 ext_offset=str2double(get(handles.ext_offset,'String'));
2485 delay=str2double(get(hObject,'String'))+ext_offset;
2486 tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2487
2488
2489
2490 function ans_bpm_c11_CreateFcn(hObject, eventdata, handles)
2491
2492
2493
2494
2495
2496
2497 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2498 set(hObject,'BackgroundColor','white');
2499 end
2500
2501
2502
2503 function ans_bpm_c12_Callback(hObject, eventdata, handles)
2504
2505
2506
2507
2508
2509
2510 ext_offset=str2double(get(handles.ext_offset,'String'));
2511 delay=str2double(get(hObject,'String'))+ext_offset;
2512 tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2513
2514
2515
2516 function ans_bpm_c12_CreateFcn(hObject, eventdata, handles)
2517
2518
2519
2520
2521
2522
2523 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2524 set(hObject,'BackgroundColor','white');
2525 end
2526
2527
2528
2529 function ans_bpm_c13_Callback(hObject, eventdata, handles)
2530
2531
2532
2533
2534
2535
2536 ext_offset=str2double(get(handles.ext_offset,'String'));
2537 delay=str2double(get(hObject,'String'))+ext_offset;
2538 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2539
2540
2541
2542 function ans_bpm_c13_CreateFcn(hObject, eventdata, handles)
2543
2544
2545
2546
2547
2548
2549 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2550 set(hObject,'BackgroundColor','white');
2551 end
2552
2553
2554
2555 function ans_bpm_c14_Callback(hObject, eventdata, handles)
2556
2557
2558
2559
2560
2561
2562 ext_offset=str2double(get(handles.ext_offset,'String'));
2563 delay=str2double(get(hObject,'String'))+ext_offset;
2564 tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2565
2566
2567
2568 function ans_bpm_c14_CreateFcn(hObject, eventdata, handles)
2569
2570
2571
2572
2573
2574
2575 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2576 set(hObject,'BackgroundColor','white');
2577 end
2578
2579
2580
2581 function ans_bpm_c15_Callback(hObject, eventdata, handles)
2582
2583
2584
2585
2586
2587
2588 ext_offset=str2double(get(handles.ext_offset,'String'));
2589 delay=str2double(get(hObject,'String'))+ext_offset;
2590 tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2591
2592
2593
2594 function ans_bpm_c15_CreateFcn(hObject, eventdata, handles)
2595
2596
2597
2598
2599
2600
2601 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2602 set(hObject,'BackgroundColor','white');
2603 end
2604
2605
2606
2607 function ans_bpm_c16_Callback(hObject, eventdata, handles)
2608
2609
2610
2611
2612
2613
2614 ext_offset=str2double(get(handles.ext_offset,'String'));
2615 delay=str2double(get(hObject,'String'))+ext_offset;
2616 tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2617
2618
2619
2620 function ans_bpm_c16_CreateFcn(hObject, eventdata, handles)
2621
2622
2623
2624
2625
2626
2627 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2628 set(hObject,'BackgroundColor','white');
2629 end
2630
2631
2632
2633 function edit_filling_relecture_tables_Callback(hObject, eventdata, handles)
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643 function edit_filling_relecture_tables_CreateFcn(hObject, eventdata, handles)
2644
2645
2646
2647
2648
2649
2650 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2651 set(hObject,'BackgroundColor','white');
2652 end
2653
2654
2655
2656 function edit_filling_relecture_bunch_Callback(hObject, eventdata, handles)
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666 function edit_filling_relecture_bunch_CreateFcn(hObject, eventdata, handles)
2667
2668
2669
2670
2671
2672
2673 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2674 set(hObject,'BackgroundColor','white');
2675 end
2676
2677
2678
2679 function edit_filling_entrer_bunch_Callback(hObject, eventdata, handles)
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691 function edit_filling_entrer_bunch_CreateFcn(hObject, eventdata, handles)
2692
2693
2694
2695
2696
2697
2698 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2699 set(hObject,'BackgroundColor','white');
2700 end
2701
2702
2703
2704 function button_update_Callback(hObject, eventdata, handles)
2705
2706
2707
2708
2709 do_update
2710
2711
2712 function button_acquisition_trigstatus_Callback(hObject, eventdata, handles)
2713
2714
2715
2716
2717 test_modes(handles);
2718
2719 set(handles.inj_offset,'Enable','off');
2720 set(handles.sdc1,'Enable','off');
2721 set(handles.lin_canon_lpm,'Enable','off');
2722 set(handles.lin_canon_spm,'Enable','off');
2723 set(handles.lin_canon_spm_fin,'Enable','off');
2724 set(handles.lin_alim,'Enable','off');
2725 set(handles.boo_bpm,'Enable','off');
2726 set(handles.lt1_emittance,'Enable','off');
2727 set(handles.lt1_MC1,'Enable','off');
2728 set(handles.lt1_MC2,'Enable','off');
2729 set(handles.lt1_osc,'Enable','off');
2730 set(handles.boo_dcct,'Enable','off');
2731 set(handles.boo_nod,'Enable','off');
2732 set(handles.boo_inj_septum,'Enable','off');
2733 set(handles.boo_inj_kicker,'Enable','off');
2734 set(handles.boo_alim_dipole,'Enable','off');
2735 set(handles.boo_alim_qf,'Enable','off');
2736 set(handles.boo_alim_qd,'Enable','off');
2737 set(handles.boo_alim_sf,'Enable','off');
2738 set(handles.boo_alim_sd,'Enable','off');
2739 set(handles.boo_rf,'Enable','off');
2740 set(handles.boo_mrsv,'Enable','off');
2741 set(handles.lin_modulateur,'Enable','off');
2742 set(handles.ext_offset,'Enable','off');
2743 set(handles.boo_ext_dof,'Enable','off');
2744 set(handles.boo_ext_sept_p,'Enable','off');
2745 set(handles.boo_ext_sept_a,'Enable','off');
2746 set(handles.boo_ext_kicker,'Enable','off');
2747 set(handles.sdc2,'Enable','off');
2748 set(handles.lt2_emittance,'Enable','off');
2749 set(handles.lt2_osc,'Enable','off');
2750 set(handles.lt2_bpm,'Enable','off');
2751 set(handles.ans_inj_k1,'Enable','off');
2752 set(handles.ans_inj_k2,'Enable','off');
2753 set(handles.ans_inj_k3,'Enable','off');
2754 set(handles.ans_inj_k4,'Enable','off');
2755 set(handles.ans_inj_sept_p,'Enable','off');
2756 set(handles.ans_inj_sept_a,'Enable','off');
2757 set(handles.ans_bpm,'Enable','off');
2758 set(handles.ans_dcct,'Enable','off');
2759 set(handles.ans_bpm_c01,'Enable','off');
2760 set(handles.ans_bpm_c02,'Enable','off');
2761 set(handles.ans_bpm_c03,'Enable','off');
2762 set(handles.ans_bpm_c04,'Enable','off');
2763 set(handles.ans_bpm_c05,'Enable','off');
2764 set(handles.ans_bpm_c06,'Enable','off');
2765 set(handles.ans_bpm_c07,'Enable','off');
2766 set(handles.ans_bpm_c08,'Enable','off');
2767 set(handles.ans_bpm_c09,'Enable','off');
2768 set(handles.ans_bpm_c10,'Enable','off');
2769 set(handles.ans_bpm_c11,'Enable','off');
2770 set(handles.ans_bpm_c12,'Enable','off');
2771 set(handles.ans_bpm_c13,'Enable','off');
2772 set(handles.ans_bpm_c14,'Enable','off');
2773 set(handles.ans_bpm_c15,'Enable','off');
2774 set(handles.ans_bpm_c16,'Enable','off');
2775
2776 get_synchro_trigstatus(handles)
2777
2778
2779
2780 function togglebutton2_Callback(hObject, eventdata, handles)
2781
2782
2783
2784
2785
2786
2787
2788
2789 function listbox_fillingmode_Callback(hObject, eventdata, handles)
2790
2791
2792
2793
2794
2795
2796 pattern=get(hObject,'String');
2797 mode=get(hObject,'Value');
2798 fprintf('***************************************************\n')
2799 fprintf('Mode de remplissage sélectionné : %s\n',pattern{mode})
2800 fprintf('***************************************************\n')
2801
2802
2803
2804 quart=[1 105 209 313];
2805 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
2806 offset_ext=temp.value(1)*52;
2807 offset_linac=str2double(get(handles.lin_canon_spm_fin,'String')) ;
2808 offset_linac=offset_linac/handles.lin_fin_step;
2809 bjump=handles.one_bunch;
2810
2811
2812 if (mode<=4)
2813 bunch=quart(mode);
2814 fillingmode='1/4';
2815 elseif (mode>4)&&(mode<=7)
2816 bunch=quart(1:(mode-3));
2817 if mode==5 ; fillingmode='1/2'; end
2818 if mode==6 ; fillingmode='3/4'; end
2819 if mode==7 ; fillingmode='4/4'; end
2820 elseif (mode==8)
2821 bunch=[365];
2822
2823 fillingmode='3/4';
2824 elseif (mode==9)
2825 bunch=[1];
2826 fillingmode='1 bunch';
2827 elseif (mode==10)
2828 bunch=[0:7]*52+1;
2829 fillingmode='8 bunches';
2830 elseif (mode==11)
2831
2832 fillingmode='16 bunches';
2833
2834 bunch=[1:25];
2835
2836 bunch=[bunch ([1:25]+1*32)];
2837 bunch=[bunch ([1:25]+2*32)];
2838 bunch=[bunch ([1:25]+3*32)];
2839 bunch=[bunch ([1:25]+4*32)];
2840 bunch=[bunch ([1:25]+5*32)];
2841 bunch=[bunch ([1:25]+6*32)];
2842 bunch=[bunch ([1:25]+7*32)];
2843 bunch=[bunch ([1:25]+8*32)];
2844 bunch=[bunch ([1:25]+9*32)];
2845 bunch=[bunch ([1:25]+10*32)];
2846 bunch=[bunch ([1:25]+11*32)];
2847 bunch=[bunch ([1:25]+12*32)];
2848
2849 elseif (mode==12)
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862 bunch=[0 2 4 6]*52+1;
2863 fillingmode='LPM 8 pulses';
2864
2865
2866
2867
2868 elseif (mode==13)
2869
2870
2871
2872
2873
2874
2875
2876
2877 bunch=[1 3 5 7]*52+1 + 8;
2878 fillingmode='LPM 8 pulses';
2879 end
2880
2881
2882 tango_write_attribute2('ANS/DG/PUB-FillingMode', 'fillingMode',fillingmode)
2883
2884
2885 Ncoup=length(bunch);
2886 boucle=int16(str2double(get(handles.edit_Ncycle,'String')));
2887 if Ncoup>=1
2888 set(handles.edit_Ncoup,'String',num2str(Ncoup));
2889 tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2890 end
2891
2892
2893 [dtour,dpaquet]=bucketnumber(bunch);
2894 dpaquet=dpaquet*bjump+offset_linac;
2895 table=int32([length(bunch) dtour dpaquet]);
2896 handles.table=table;
2897 handles.bunch=bunch;
2898
2899
2900 FileName = [handles.DirName 'table.mat'];
2901 save(FileName, 'table');
2902
2903 modeinj='togglebutton_3Hz';
2904 if strcmp(modeinj,'togglebutton_soft')
2905 table=handles.table0;
2906 tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
2907
2908 elseif strcmp(modeinj,'togglebutton_3Hz')
2909 tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
2910 pause(1);
2911 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
2912 n=temp.value;
2913 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
2914 table_ext=temp.value(1:n);
2915 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
2916 table_linac=(temp.value(1:n)-offset_linac)/bjump;
2917 table=[];
2918 for i=1:n
2919 table=[table ' ' '(' num2str([table_ext(i)]) ' ' num2str([table_linac(i)]) ')'];
2920 end
2921 end
2922
2923 set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
2924 set(handles.edit_filling_relecture_bunch, 'String',[num2str(bunch)]);
2925
2926
2927 guidata(hObject, handles);
2928
2929
2930
2931 function listbox_fillingmode_CreateFcn(hObject, eventdata, handles)
2932
2933
2934
2935
2936
2937
2938 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2939 set(hObject,'BackgroundColor','white');
2940 end
2941
2942
2943
2944 function button_fix_Callback(hObject, eventdata, handles)
2945
2946
2947
2948
2949 [clk_spare,clk_soft]=fix_quart;
2950 handles.clk_spare =clk_spare;
2951 handles.clk_soft=clk_soft;
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963 guidata(hObject, handles);
2964
2965
2966
2967 function edit_Ncycle_Callback(hObject, eventdata, handles)
2968
2969
2970
2971
2972
2973
2974 boucle=str2double(get(hObject,'String'));
2975 Ncoup=str2double(get(handles.edit_Ncoup,'String'));
2976 tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2977
2978
2979 function edit_Ncycle_CreateFcn(hObject, eventdata, handles)
2980
2981
2982
2983
2984
2985
2986 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2987 set(hObject,'BackgroundColor','white');
2988 end
2989
2990
2991
2992 function edit_Ncoup_Callback(hObject, eventdata, handles)
2993
2994
2995
2996
2997
2998
2999 Ncoup=str2double(get(hObject,'String'));
3000 boucle=str2double(get(handles.edit_Ncycle,'String'));
3001 tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
3002
3003
3004 function edit_Ncoup_CreateFcn(hObject, eventdata, handles)
3005
3006
3007
3008
3009
3010
3011 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3012 set(hObject,'BackgroundColor','white');
3013 end
3014
3015
3016
3017 function edit_qlt1_Callback(hObject, eventdata, handles)
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027 function edit_qlt1_CreateFcn(hObject, eventdata, handles)
3028
3029
3030
3031
3032
3033
3034 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3035 set(hObject,'BackgroundColor','white');
3036 end
3037
3038
3039
3040 function edit_iboo_Callback(hObject, eventdata, handles)
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050 function edit_iboo_CreateFcn(hObject, eventdata, handles)
3051
3052
3053
3054
3055
3056
3057 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3058 set(hObject,'BackgroundColor','white');
3059 end
3060
3061
3062
3063 function edit_dians_Callback(hObject, eventdata, handles)
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073 function edit_dians_CreateFcn(hObject, eventdata, handles)
3074
3075
3076
3077
3078
3079
3080 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3081 set(hObject,'BackgroundColor','white');
3082 end
3083
3084
3085
3086 function edit_rlt1_Callback(hObject, eventdata, handles)
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096 function edit_rlt1_CreateFcn(hObject, eventdata, handles)
3097
3098
3099
3100
3101
3102
3103 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3104 set(hObject,'BackgroundColor','white');
3105 end
3106
3107
3108
3109 function edit_rboo_Callback(hObject, eventdata, handles)
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119 function edit_rboo_CreateFcn(hObject, eventdata, handles)
3120
3121
3122
3123
3124
3125
3126 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3127 set(hObject,'BackgroundColor','white');
3128 end
3129
3130
3131
3132 function edit_rans_Callback(hObject, eventdata, handles)
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142 function edit_rans_CreateFcn(hObject, eventdata, handles)
3143
3144
3145
3146
3147
3148
3149 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3150 set(hObject,'BackgroundColor','white');
3151 end
3152
3153
3154
3155 function edit_dians1_Callback(hObject, eventdata, handles)
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165 function edit_dians1_CreateFcn(hObject, eventdata, handles)
3166
3167
3168
3169
3170
3171
3172 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3173 set(hObject,'BackgroundColor','white');
3174 end
3175
3176
3177
3178 function edit_cycle_Callback(hObject, eventdata, handles)
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188 function edit_cycle_CreateFcn(hObject, eventdata, handles)
3189
3190
3191
3192
3193
3194
3195 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3196 set(hObject,'BackgroundColor','white');
3197 end
3198
3199
3200
3201 function edit_courant_total_Callback(hObject, eventdata, handles)
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211 function edit_courant_total_CreateFcn(hObject, eventdata, handles)
3212
3213
3214
3215
3216
3217
3218 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3219 set(hObject,'BackgroundColor','white');
3220 end
3221
3222
3223
3224 function lin_canon_spm_Callback(hObject, eventdata, handles)
3225
3226
3227
3228
3229
3230
3231
3232 inj_offset=str2double(get(handles.inj_offset,'String'));
3233 delay=str2double(get(hObject,'String'))+inj_offset;
3234 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay',delay);
3235
3236
3237
3238 function lin_canon_spm_CreateFcn(hObject, eventdata, handles)
3239
3240
3241
3242
3243
3244
3245 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3246 set(hObject,'BackgroundColor','white');
3247 end
3248
3249
3250 function uipanel_mode_CreateFcn(hObject, eventdata, handles)
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317 function edit_filling_entrer_bunch1_Callback(hObject, eventdata, handles)
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329 function edit_filling_entrer_bunch1_CreateFcn(hObject, eventdata, handles)
3330
3331
3332
3333
3334
3335
3336 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3337 set(hObject,'BackgroundColor','white');
3338 end
3339
3340
3341
3342 function edit_Imin_Callback(hObject, eventdata, handles)
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352 function edit_Imin_CreateFcn(hObject, eventdata, handles)
3353
3354
3355
3356
3357
3358
3359 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3360 set(hObject,'BackgroundColor','white');
3361 end
3362
3363
3364
3365 function uipanel_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
3366
3367
3368
3369
3370
3371
3372
3373 mode=get(get(handles.uipanel_spm_mode,'SelectedObject'),'Tag');
3374
3375 switch mode
3376 case 'spm_mode_1'
3377 display('spm_mode_1')
3378 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(1));
3379 case 'spm_mode_2'
3380 display('spm_mode_2')
3381 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(2));
3382 case 'spm_mode_2p'
3383 display('spm_mode_2p')
3384 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(3));
3385 case 'spm_mode_3'
3386 display('spm_mode_3')
3387 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(4));
3388 end
3389
3390 test_modes(handles);
3391
3392
3393 function uipanel_lpm_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
3394
3395
3396
3397
3398
3399 mode=get(get(handles.uipanel_lpm_spm_mode,'SelectedObject'),'Tag');
3400
3401 modeinj='togglebutton_3Hz';
3402 event0=int32(0);
3403 if strcmp(modeinj,'togglebutton_soft')
3404 event=int32(5);
3405 elseif strcmp(modeinj,'togglebutton_3Hz')
3406 event=int32(2);
3407 else
3408
3409 end
3410
3411 switch mode
3412 case 'no_mode'
3413 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event0);
3414 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event0);
3415
3416 case 'lpm_mode'
3417 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event);
3418 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event0);
3419
3420
3421
3422
3423 case 'spm_mode'
3424 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event0);
3425 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event);
3426
3427
3428
3429
3430 end
3431 test_modes(handles);
3432
3433
3434
3435
3436
3437
3438
3439 function uipanel_central_mode_SelectionChangeFcn(hObject, eventdata, handles)
3440
3441
3442
3443
3444 mode=get(get(handles.uipanel_central_mode,'SelectedObject'),'Tag');
3445
3446 modeinj='togglebutton_3Hz';
3447
3448 h='Yes';
3449 if strcmp(mode,'continuous_mode')
3450 if strcmp(modeinj,'togglebutton_3Hz')
3451 h = questdlg('Attention, déclenchement continu des équipements sur adresses 1 2 3');
3452 end
3453 end
3454
3455 if strcmp(h,'Yes')
3456 switch mode
3457 case 'burst_mode'
3458 tango_command_inout2('ANS/SY/CENTRAL', 'SetBurstMode');
3459 case 'continuous_mode'
3460 tango_command_inout2('ANS/SY/CENTRAL', 'SetContinuousMode');
3461 end
3462 end
3463 pause(1)
3464 test_modes(handles);
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481 function [etat]=test_central_mode(handles)
3482
3483 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'currentMode');
3484 mode=temp.value;
3485 h=get(handles.uipanel_central_mode);
3486 switch mode
3487 case 'BURST'
3488 set(handles.uipanel_central_mode,'SelectedObject',h.Children(2))
3489 etat='Rafale';
3490 case 'CONTINUOUS'
3491 set(handles.uipanel_central_mode,'SelectedObject',h.Children(1))
3492 etat='Continu';
3493 end
3494
3495 function [etat]=test_injection_mode(handles)
3496
3497
3498 etat='3Hz';
3499
3500
3501 function [etat]=test_lpm_spm_mode(handles)
3502
3503 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
3504 modelpm=temp.value(1);
3505 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent');
3506 modespm=temp.value(1);
3507 h=get(handles.uipanel_lpm_spm_mode);
3508 if (modelpm==5)&(modespm==0) | (modelpm==2)&(modespm==0)
3509 set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(2))
3510 etat='LPM';
3511 elseif (modelpm==0)&(modespm==5) | (modelpm==0)&(modespm==2)
3512 set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(1))
3513 etat='SPM';
3514 else
3515 set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(3))
3516 etat='NONE';
3517 end
3518
3519 function [etat]=test_spm_mode(handles)
3520
3521 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'mode');
3522 mode=temp.value(1);
3523 h=get(handles.uipanel_spm_mode);
3524 select=h.Children(5-mode);
3525 set(handles.uipanel_spm_mode,'SelectedObject',select)
3526 etat=num2str(5-mode);
3527
3528 function [etat]=test_cond_inj(handles)
3529
3530 try temp=tango_read_attribute2('ANS/FC/INJ_COND', 'COND_INJ');
3531 val=temp.value; catch val=1 ; end; if val~=0 ; val=1; end;
3532 if (val==1)
3533 etat='TIR AUTORISE';
3534 else
3535 etat='TIR NON AUTORISE';
3536 end
3537
3538
3539 function test_modes(handles)
3540
3541 [etat_central]=test_central_mode(handles);
3542
3543 [etat_injection]=test_injection_mode(handles);
3544
3545 [etat_linac]=test_lpm_spm_mode(handles);
3546
3547 [etat_linac_spm]=test_spm_mode(handles);
3548
3549
3550
3551
3552
3553
3554 txt=['CENTRAL : ',etat_central,' # INJECTION : ',etat_injection,' # LINAC : ',etat_linac];
3555 set(handles.edit_modes,'String',txt)
3556
3557
3558
3559 function edit_modes_Callback(hObject, eventdata, handles)
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569 function edit_modes_CreateFcn(hObject, eventdata, handles)
3570
3571
3572
3573
3574
3575
3576 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3577 set(hObject,'BackgroundColor','white');
3578 end
3579
3580 function ans_k_pc_Callback(hObject, eventdata, handles)
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590 function ans_k_pc_CreateFcn(hObject, eventdata, handles)
3591
3592
3593
3594
3595
3596
3597 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3598 set(hObject,'BackgroundColor','white');
3599 end
3600
3601
3602
3603 function ans_k_h_Callback(hObject, eventdata, handles)
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613 function ans_k_h_CreateFcn(hObject, eventdata, handles)
3614
3615
3616
3617
3618
3619
3620 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3621 set(hObject,'BackgroundColor','white');
3622 end
3623
3624
3625
3626 function ans_k_v_Callback(hObject, eventdata, handles)
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636 function ans_k_v_CreateFcn(hObject, eventdata, handles)
3637
3638
3639
3640
3641
3642
3643 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3644 set(hObject,'BackgroundColor','white');
3645 end
3646
3647
3648
3649 function button_kicker_Callback(hObject, eventdata, handles)
3650
3651
3652
3653
3654
3655
3656 bpm=get(hObject,'Value');
3657
3658 if (bpm==0)
3659 set(handles.uipanel_kicker_machine,'Visible','off');
3660 elseif (bpm==1)
3661 set(handles.uipanel_kicker_machine,'Visible','on');
3662 end
3663
3664
3665
3666 function button_save_golden_soft_Callback(hObject, eventdata, handles)
3667
3668
3669
3670 h = questdlg('Attention, sauvegarde nouvelle golden !!!');
3671
3672 if strcmp(h,'Yes')
3673
3674 DirName=handles.DirName;
3675 [timing]=get_synchro_rafale(DirName);
3676
3677 file='golden_rafale_soft.mat';
3678
3679 Directory=handles.Directory;
3680 pwdold = pwd;
3681 cd(Directory);
3682 save(file, 'timing');
3683 cd(pwdold);
3684
3685 end
3686
3687
3688
3689 function button_load_golden_soft_Callback(hObject, eventdata, handles)
3690
3691
3692
3693
3694 set(handles.button_injection_soft,'Enable','Off')
3695 set(handles.edit_modes,'String','Please WAIT !!!!')
3696 Directory=handles.Directory;
3697 DirName=handles.DirName;
3698 file='golden_rafale_soft.mat';
3699 load_synchro_rafale(Directory,file,DirName)
3700 set(handles.button_injection_soft,'Enable','On')
3701 test_modes(handles);
3702
3703
3704
3705 function button_load_golden_3Hz_Callback(hObject, eventdata, handles)
3706
3707
3708
3709
3710 [etat_central]=test_central_mode(handles);
3711 h='Yes';
3712 if strcmp(etat_central,'Continu')
3713 h = questdlg('Attention, Trigger en mode continu');
3714 end
3715 if strcmp(h,'Yes')
3716 set(handles.button_injection_soft,'Enable','Off')
3717 set(handles.edit_modes,'String','Please WAIT !!!!')
3718 Directory=handles.Directory;
3719 DirName=handles.DirName;
3720 file='golden_rafale_3Hz.mat';
3721 load_synchro_rafale(Directory,file,DirName)
3722 set(handles.button_injection_soft,'Enable','On')
3723 test_modes(handles);
3724 end
3725
3726
3727 function button_save_golden_3Hz_Callback(hObject, eventdata, handles)
3728
3729
3730
3731 h = questdlg('Attention, sauvegarde nouvelle golden !!!');
3732
3733 if strcmp(h,'Yes')
3734
3735 DirName=handles.DirName;
3736 [timing]=get_synchro_rafale(DirName);
3737
3738 file='golden_rafale_3Hz.mat';
3739
3740 Directory=handles.Directory;
3741 pwdold = pwd;
3742 cd(Directory);
3743 save(file, 'timing');
3744 cd(pwdold);
3745
3746 end
3747
3748
3749 function button_load_golden_3Hz_66MeV_Callback(hObject, eventdata, handles)
3750
3751
3752
3753 [etat_central]=test_central_mode(handles);
3754 h='Yes';
3755 if strcmp(etat_central,'Continu')
3756 h = questdlg('Attention, Trigger en mode continu');
3757 end
3758 if strcmp(h,'Yes')
3759 set(handles.button_injection_soft,'Enable','Off')
3760 set(handles.edit_modes,'String','Please WAIT !!!!')
3761 Directory=handles.Directory;
3762 DirName=handles.DirName;
3763 file='golden_rafale_3Hz_66MeV.mat';
3764 load_synchro_rafale(Directory,file,DirName)
3765 set(handles.button_injection_soft,'Enable','On')
3766 test_modes(handles);
3767 end
3768
3769
3770
3771 function button_save_golden_66MeV_Callback(hObject, eventdata, handles)
3772
3773
3774
3775 h = questdlg('Attention, sauvegarde nouvelle golden 66 MeV!!!');
3776
3777 if strcmp(h,'Yes')
3778
3779 DirName=handles.DirName;
3780 [timing]=get_synchro_rafale(DirName);
3781
3782 file='golden_rafale_3Hz_66MeV.mat';
3783
3784 Directory=handles.Directory;
3785 pwdold = pwd;
3786 cd(Directory);
3787 save(file, 'timing');
3788 cd(pwdold);
3789
3790 end
3791
3792
3793
3794 function boo_mrsv_Callback(hObject, eventdata, handles)
3795
3796
3797
3798
3799
3800
3801
3802 ext_offset=str2double(get(handles.ext_offset,'String'));
3803 delay=str2double(get(hObject,'String'))+ext_offset;
3804 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceTimeDelay',delay);
3805
3806
3807 function boo_mrsv_CreateFcn(hObject, eventdata, handles)
3808
3809
3810
3811
3812
3813
3814 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3815 set(hObject,'BackgroundColor','white');
3816 end
3817
3818
3819
3820 function central_pc_Callback(hObject, eventdata, handles)
3821
3822
3823
3824
3825
3826
3827
3828
3829 delay=str2double(get(hObject,'String'));
3830 tango_write_attribute2('ANS/SY/CENTRAL', 'TPcTimeDelay',delay);
3831
3832
3833
3834 function central_pc_CreateFcn(hObject, eventdata, handles)
3835
3836
3837
3838
3839
3840
3841 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3842 set(hObject,'BackgroundColor','white');
3843 end
3844
3845
3846
3847 function lin_alim_Callback(hObject, eventdata, handles)
3848
3849
3850
3851
3852
3853
3854
3855
3856 delay=str2double(get(hObject,'String'));
3857 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'libre.1TimeDelay',delay);
3858
3859
3860
3861 function lin_alim_CreateFcn(hObject, eventdata, handles)
3862
3863
3864
3865
3866
3867
3868 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3869 set(hObject,'BackgroundColor','white');
3870 end
3871
3872
3873
3874 function ans_nod_Callback(hObject, eventdata, handles)
3875
3876
3877
3878
3879
3880
3881
3882 ext_offset=str2double(get(handles.ext_offset,'String'));
3883 delay=str2double(get(hObject,'String'))+ext_offset;
3884 tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'perteTimeDelay',delay);
3885
3886
3887
3888 function ans_nod_CreateFcn(hObject, eventdata, handles)
3889
3890
3891
3892
3893
3894
3895 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3896 set(hObject,'BackgroundColor','white');
3897 end
3898
3899