0001 function varargout = synchro_injecteur7_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_injecteur7_rafale_OpeningFcn, ...
0038 'gui_OutputFcn', @synchro_injecteur7_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_injecteur7_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.141 0.37 0.11 0.14],...
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_injecteur7_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.boo_bpm,'Enable','off');
0820 set(handles.lt1_emittance,'Enable','off');
0821 set(handles.lt1_MC1,'Enable','off');
0822 set(handles.lt1_MC2,'Enable','off');
0823 set(handles.lt1_osc,'Enable','off');
0824 set(handles.boo_dcct,'Enable','off');
0825 set(handles.boo_nod,'Enable','off');
0826 set(handles.boo_inj_septum,'Enable','off');
0827 set(handles.boo_inj_kicker,'Enable','off');
0828 set(handles.boo_alim_dipole,'Enable','off');
0829 set(handles.boo_alim_qf,'Enable','off');
0830 set(handles.boo_alim_qd,'Enable','off');
0831 set(handles.boo_alim_sf,'Enable','off');
0832 set(handles.boo_alim_sd,'Enable','off');
0833 set(handles.boo_rf,'Enable','off');
0834 set(handles.lin_modulateur,'Enable','off');
0835 set(handles.ext_offset,'Enable','off');
0836 set(handles.boo_ext_dof,'Enable','off');
0837 set(handles.boo_ext_sept_p,'Enable','off');
0838 set(handles.boo_ext_sept_a,'Enable','off');
0839 set(handles.boo_ext_kicker,'Enable','off');
0840 set(handles.sdc2,'Enable','off');
0841 set(handles.lt2_emittance,'Enable','off');
0842 set(handles.lt2_osc,'Enable','off');
0843 set(handles.lt2_bpm,'Enable','off');
0844 set(handles.ans_inj_k1,'Enable','off');
0845 set(handles.ans_inj_k2,'Enable','off');
0846 set(handles.ans_inj_k3,'Enable','off');
0847 set(handles.ans_inj_k4,'Enable','off');
0848 set(handles.ans_inj_sept_p,'Enable','off');
0849 set(handles.ans_inj_sept_a,'Enable','off');
0850 set(handles.ans_bpm,'Enable','off');
0851 set(handles.ans_dcct,'Enable','off');
0852 set(handles.ans_bpm_c01,'Enable','off');
0853 set(handles.ans_bpm_c02,'Enable','off');
0854 set(handles.ans_bpm_c03,'Enable','off');
0855 set(handles.ans_bpm_c04,'Enable','off');
0856 set(handles.ans_bpm_c05,'Enable','off');
0857 set(handles.ans_bpm_c06,'Enable','off');
0858 set(handles.ans_bpm_c07,'Enable','off');
0859 set(handles.ans_bpm_c08,'Enable','off');
0860 set(handles.ans_bpm_c09,'Enable','off');
0861 set(handles.ans_bpm_c10,'Enable','off');
0862 set(handles.ans_bpm_c11,'Enable','off');
0863 set(handles.ans_bpm_c12,'Enable','off');
0864 set(handles.ans_bpm_c13,'Enable','off');
0865 set(handles.ans_bpm_c14,'Enable','off');
0866 set(handles.ans_bpm_c15,'Enable','off');
0867 set(handles.ans_bpm_c16,'Enable','off');
0868
0869 get_synchro_delay_nooffset(handles)
0870 n=1;
0871
0872
0873 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
0874 if (temp.value(n)==2)
0875
0876 elseif (temp.value(n)==5)
0877
0878 end
0879
0880
0881 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
0882 offset=temp.value(1)*52;
0883 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
0884 n=temp.value;
0885 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
0886 table=temp.value(1:n)-offset;
0887 set(handles.edit_filling_relecture_tables,'String',['T=' , num2str(table)]);
0888
0889
0890
0891
0892 function button_acquisition_delay_Callback(hObject, eventdata, handles)
0893
0894
0895
0896 bug_device='Bug device';
0897
0898 test_modes(handles);
0899
0900 set(handles.inj_offset,'Enable','on');
0901 set(handles.sdc1,'Enable','on');
0902 set(handles.lin_canon_lpm,'Enable','on');
0903 set(handles.lin_canon_spm,'Enable','on');
0904 set(handles.lin_canon_spm_fin,'Enable','on');
0905 set(handles.boo_bpm,'Enable','on');
0906 set(handles.lt1_emittance,'Enable','on');
0907 set(handles.lt1_MC1,'Enable','on');
0908 set(handles.lt1_MC2,'Enable','on');
0909 set(handles.lt1_osc,'Enable','on');
0910 set(handles.boo_dcct,'Enable','on');
0911 set(handles.boo_nod,'Enable','on');
0912 set(handles.boo_inj_septum,'Enable','on');
0913 set(handles.boo_inj_kicker,'Enable','on');
0914 set(handles.boo_alim_dipole,'Enable','on');
0915 set(handles.boo_alim_qf,'Enable','on');
0916 set(handles.boo_alim_qd,'Enable','on');
0917 set(handles.boo_alim_sf,'Enable','on');
0918 set(handles.boo_alim_sd,'Enable','on');
0919 set(handles.boo_rf,'Enable','on');
0920 set(handles.lin_modulateur,'Enable','on');
0921 set(handles.ext_offset,'Enable','on');
0922 set(handles.boo_ext_dof,'Enable','on');
0923 set(handles.boo_ext_sept_p,'Enable','on');
0924 set(handles.boo_ext_sept_a,'Enable','on');
0925 set(handles.boo_ext_kicker,'Enable','on');
0926 set(handles.sdc2,'Enable','on');
0927 set(handles.lt2_emittance,'Enable','on');
0928 set(handles.lt2_osc,'Enable','on');
0929 set(handles.lt2_bpm,'Enable','on');
0930 set(handles.ans_inj_k1,'Enable','on');
0931 set(handles.ans_inj_k2,'Enable','on');
0932 set(handles.ans_inj_k3,'Enable','on');
0933 set(handles.ans_inj_k4,'Enable','on');
0934 set(handles.ans_inj_sept_p,'Enable','on');
0935 set(handles.ans_inj_sept_a,'Enable','on');
0936 set(handles.ans_bpm,'Enable','on');
0937 set(handles.ans_dcct,'Enable','on');
0938 set(handles.ans_bpm_c01,'Enable','on');
0939 set(handles.ans_bpm_c02,'Enable','on');
0940 set(handles.ans_bpm_c03,'Enable','on');
0941 set(handles.ans_bpm_c04,'Enable','on');
0942 set(handles.ans_bpm_c05,'Enable','on');
0943 set(handles.ans_bpm_c06,'Enable','on');
0944 set(handles.ans_bpm_c07,'Enable','on');
0945 set(handles.ans_bpm_c08,'Enable','on');
0946 set(handles.ans_bpm_c09,'Enable','on');
0947 set(handles.ans_bpm_c10,'Enable','on');
0948 set(handles.ans_bpm_c11,'Enable','on');
0949 set(handles.ans_bpm_c12,'Enable','on');
0950 set(handles.ans_bpm_c13,'Enable','on');
0951 set(handles.ans_bpm_c14,'Enable','on');
0952 set(handles.ans_bpm_c15,'Enable','on');
0953 set(handles.ans_bpm_c16,'Enable','on');
0954 set(handles.ans_k_pc,'Enable','on');
0955 set(handles.ans_k_h,'Enable','on');
0956 set(handles.ans_k_v,'Enable','on');
0957
0958
0959
0960 FileName = [handles.DirName 'synchro_offset_lin'];
0961 load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
0962 set(handles.inj_offset,'String',num2str(inj_offset));
0963 set(handles.ext_offset,'String',num2str(ext_offset));
0964 set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
0965
0966 get_synchro_delay(handles)
0967 n=1;
0968
0969 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
0970 if (temp.value(n)==2)
0971
0972 elseif (temp.value(n)==5)
0973
0974 end
0975
0976
0977
0978
0979 offset_linac=10*lin_fin;
0980 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
0981 n=temp.value;
0982 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
0983 table_ext=temp.value(1:n);
0984 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
0985 table_linac=(temp.value(1:n)-offset_linac)/28;
0986 table=[];
0987 for i=1:n
0988 table=[table ' ' '(' num2str([table_ext(i)]) ' ' num2str([table_linac(i)]) ')'];
0989 end
0990 set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
0991 set(handles.edit_filling_relecture_bunch, 'String','??');
0992
0993
0994
0995
0996 function button_injection_soft_Callback(hObject, eventdata, handles)
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015 [r1,r2]=fire_injection(handles);
1016
1017
1018
1019
1020 [flag]=check_boo_synchro;
1021 if flag==1 && r1> 20
1022 set(handles.central_inj,'Backgroundcolor', [1 0 0]);
1023 else
1024 set(handles.central_inj,'Backgroundcolor', [1 1 1]);
1025 end
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037 test_modes(handles);
1038
1039 function periode_edit_Callback(hObject, eventdata, handles)
1040
1041
1042
1043
1044
1045
1046
1047 val_multishot = get(handles.on1,'Value');
1048
1049 if val_multishot
1050 errordlg('positionner le trigger a OFF !','Attention');
1051 return
1052 else
1053 periode = str2double(get(hObject,'String'));
1054
1055
1056 timer1=timer('StartDelay',1,...
1057 'ExecutionMode','fixedRate','Period',periode,'TasksToExecute',Inf);
1058 timer1.TimerFcn = {@fonction_alex1, hObject,eventdata, handles};
1059 setappdata(handles.figure1,'Timer1',timer1);
1060
1061
1062 guidata(hObject, handles);
1063
1064
1065
1066 end
1067
1068
1069
1070
1071 function periode_edit_CreateFcn(hObject, eventdata, handles)
1072
1073
1074
1075
1076
1077
1078 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1079 set(hObject,'BackgroundColor','white');
1080 end
1081
1082 function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles)
1083
1084
1085
1086
1087
1088 timer1 = getappdata(handles.figure1,'Timer1');
1089 timer2 = getappdata(handles.figure1,'Timer2');
1090
1091
1092
1093 switch get(get(hObject,'SelectedObject'),'Tag')
1094 case 'radiobutton1'
1095
1096 stop(timer1);
1097 stop(timer2);
1098 set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1099 test_modes(handles);
1100 tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(0))
1101 tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(0))
1102 case 'radiobutton2'
1103
1104 start(timer1);
1105 set(handles.edit_modes,'String',handles.txt_inj);
1106 tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(1))
1107 case 'radiobutton3'
1108
1109 temp=tango_read_attribute2('ANS/DG/DCCT-CTRL','current');anscur=temp.value;
1110 if (anscur>1.)
1111 start(timer2);
1112 set(handles.edit_modes,'String',handles.txt_inj);
1113 tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(1))
1114 else
1115
1116 end
1117 end
1118
1119
1120 function fonction_alex1(arg1,arg2,hObject,eventdata,handles)
1121
1122
1123
1124
1125 color=get(handles.uipanel6,'Backgroundcolor');
1126 if color==[1 0.3 0]
1127 set(handles.uipanel6,'Backgroundcolor', [1 0.3 1]);
1128 elseif color==[1 0.3 1]
1129 set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1130 end
1131
1132 button_injection_soft_Callback(hObject,eventdata,handles)
1133
1134
1135 function fonction_alex2(arg1,arg2,hObject,eventdata,handles)
1136
1137
1138
1139
1140
1141 temp=tango_read_attribute2('ANS/DG/DCCT-CTRL','current');anscur=temp.value;
1142 set(handles.edit_courant_total,'String', num2str(anscur,'%5.2f'));
1143 Imin=str2double(get(handles.edit_Imin,'String'));
1144
1145 color=get(handles.uipanel6,'Backgroundcolor');
1146 if color==[1 0.3 0]
1147 set(handles.uipanel6,'Backgroundcolor', [1 0.3 1]);
1148 elseif color==[1 0.3 1]
1149 set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1150 end
1151
1152
1153 if (anscur>Imin)
1154
1155
1156 tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(1))
1157 else
1158
1159
1160
1161 button_injection_soft_Callback(hObject, eventdata, handles)
1162 end
1163
1164
1165
1166
1167 function Closinggui(obj, event, handles, figure1)
1168
1169
1170 answer = questdlg('Fermer softsynchro ?',...
1171 'Exit softsynchro',...
1172 'Yes','No','Yes');
1173
1174 switch answer
1175 case 'Yes'
1176 delete(handles);
1177 delete(figure1);
1178 otherwise
1179 disp('Closing aborted')
1180 end
1181
1182
1183
1184
1185 function button_softmoins_Callback(hObject, eventdata, handles)
1186
1187
1188
1189 tt=0.6;
1190
1191 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1192 step=temp.value(1)-52;
1193 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',step);
1194 pause(2*tt)
1195
1196
1197 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1198 if (temp.value(1)==2)
1199 pause(tt)
1200 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1201 set(handles.central_soft,'String',num2str(temp.value(1)));
1202 elseif (temp.value(1)==5)
1203 dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1204 inj_offset=str2double(get(handles.inj_offset,'String'));
1205 dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
1206 delay=dt.value(1)-dt1.value(1)+inj_offset;
1207 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1208
1209 pause(tt)
1210
1211 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1212 set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1213 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1214 set(handles.central_soft,'String',num2str(temp.value(1)));
1215 end
1216
1217
1218
1219
1220 function button_softplus_Callback(hObject, eventdata, handles)
1221
1222
1223
1224 tt=0.6;
1225
1226 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1227 step=temp.value(1)+52;
1228 tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',step);
1229 pause(2*tt)
1230
1231
1232 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1233 if (temp.value(1)==2)
1234 pause(tt)
1235
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_injmoins_Callback(hObject, eventdata, handles)
1257
1258
1259
1260 tt=0.6;
1261
1262 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay');
1263 step=temp.value(1)-52;
1264 tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',step);
1265 pause(2*tt)
1266
1267
1268 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1269 if (temp.value(1)==5)
1270 pause(tt)
1271
1272 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1273 set(handles.central_inj,'String',num2str(temp.value(1)));
1274 elseif (temp.value(1)==2)
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1287 set(handles.central_inj,'String',num2str(temp.value(1)));
1288 end
1289
1290
1291
1292 function button_injplus_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
1329
1330
1331 function boo_ext_sept_p_Callback(hObject, eventdata, handles)
1332
1333
1334
1335
1336
1337
1338 ext_offset=str2double(get(handles.ext_offset,'String'));
1339 delay=str2double(get(hObject,'String'))+ext_offset;
1340 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
1341
1342
1343 function boo_ext_sept_p_CreateFcn(hObject, eventdata, handles)
1344
1345
1346
1347
1348
1349
1350 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1351 set(hObject,'BackgroundColor','white');
1352 end
1353
1354
1355 function boo_ext_dof_Callback(hObject, eventdata, handles)
1356
1357
1358
1359
1360
1361
1362 ext_offset=str2double(get(handles.ext_offset,'String'));
1363 delay=str2double(get(hObject,'String'))+ext_offset;
1364 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
1365
1366
1367 function boo_ext_dof_CreateFcn(hObject, eventdata, handles)
1368
1369
1370
1371
1372
1373
1374 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1375 set(hObject,'BackgroundColor','white');
1376 end
1377
1378
1379 function boo_ext_sept_a_Callback(hObject, eventdata, handles)
1380
1381
1382
1383
1384
1385
1386 ext_offset=str2double(get(handles.ext_offset,'String'));
1387 delay=str2double(get(hObject,'String'))+ext_offset;
1388 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
1389
1390
1391 function boo_ext_sept_a_CreateFcn(hObject, eventdata, handles)
1392
1393
1394
1395
1396
1397
1398 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1399 set(hObject,'BackgroundColor','white');
1400 end
1401
1402
1403
1404 function boo_ext_kicker_Callback(hObject, eventdata, handles)
1405
1406
1407
1408
1409
1410
1411 ext_offset=str2double(get(handles.ext_offset,'String'));
1412 delay=str2double(get(hObject,'String'))+ext_offset;
1413 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
1414
1415
1416
1417 function boo_ext_kicker_CreateFcn(hObject, eventdata, handles)
1418
1419
1420
1421
1422
1423
1424 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1425 set(hObject,'BackgroundColor','white');
1426 end
1427
1428
1429
1430 function ans_inj_sept_p_Callback(hObject, eventdata, handles)
1431
1432
1433
1434
1435
1436
1437
1438 ext_offset=str2double(get(handles.ext_offset,'String'));
1439 delay=str2double(get(hObject,'String'))+ext_offset;
1440 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
1441
1442
1443 function ans_inj_sept_p_CreateFcn(hObject, eventdata, handles)
1444
1445
1446
1447
1448
1449
1450 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1451 set(hObject,'BackgroundColor','white');
1452 end
1453
1454
1455
1456 function ans_inj_sept_a_Callback(hObject, eventdata, handles)
1457
1458
1459
1460
1461
1462
1463
1464 ext_offset=str2double(get(handles.ext_offset,'String'));
1465 delay=str2double(get(hObject,'String'))+ext_offset;
1466 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
1467
1468
1469 function ans_inj_sept_a_CreateFcn(hObject, eventdata, handles)
1470
1471
1472
1473
1474
1475
1476 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1477 set(hObject,'BackgroundColor','white');
1478 end
1479
1480
1481
1482 function ans_inj_k1_Callback(hObject, eventdata, handles)
1483
1484
1485
1486
1487
1488
1489
1490 ext_offset=str2double(get(handles.ext_offset,'String'));
1491 delay=str2double(get(hObject,'String'))+ext_offset;
1492 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
1493
1494
1495
1496
1497 function ans_inj_k1_CreateFcn(hObject, eventdata, handles)
1498
1499
1500
1501
1502
1503
1504 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1505 set(hObject,'BackgroundColor','white');
1506 end
1507
1508
1509
1510 function ans_inj_k2_Callback(hObject, eventdata, handles)
1511
1512
1513
1514
1515
1516
1517
1518 ext_offset=str2double(get(handles.ext_offset,'String'));
1519 delay=str2double(get(hObject,'String'))+ext_offset;
1520 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
1521
1522
1523 function ans_inj_k2_CreateFcn(hObject, eventdata, handles)
1524
1525
1526
1527
1528
1529
1530 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1531 set(hObject,'BackgroundColor','white');
1532 end
1533
1534
1535
1536 function ans_inj_k3_Callback(hObject, eventdata, handles)
1537
1538
1539
1540
1541
1542
1543
1544 ext_offset=str2double(get(handles.ext_offset,'String'));
1545 delay=str2double(get(hObject,'String'))+ext_offset;
1546 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
1547
1548
1549 function ans_inj_k3_CreateFcn(hObject, eventdata, handles)
1550
1551
1552
1553
1554
1555
1556 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1557 set(hObject,'BackgroundColor','white');
1558 end
1559
1560
1561
1562 function ans_inj_k4_Callback(hObject, eventdata, handles)
1563
1564
1565
1566
1567
1568
1569
1570 ext_offset=str2double(get(handles.ext_offset,'String'));
1571 delay=str2double(get(hObject,'String'))+ext_offset;
1572 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
1573
1574
1575 function ans_inj_k4_CreateFcn(hObject, eventdata, handles)
1576
1577
1578
1579
1580
1581
1582 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1583 set(hObject,'BackgroundColor','white');
1584 end
1585
1586
1587
1588 function ans_dcct_Callback(hObject, eventdata, handles)
1589
1590
1591
1592
1593
1594
1595
1596 ext_offset=str2double(get(handles.ext_offset,'String'));
1597 delay=str2double(get(hObject,'String'))+ext_offset;
1598 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctTimeDelay',delay);
1599
1600
1601
1602 function ans_dcct_CreateFcn(hObject, eventdata, handles)
1603
1604
1605
1606
1607
1608
1609 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1610 set(hObject,'BackgroundColor','white');
1611 end
1612
1613
1614
1615 function ans_bpm_Callback(hObject, eventdata, handles)
1616
1617
1618
1619
1620
1621
1622
1623 ext_offset=str2double(get(handles.ext_offset,'String'));
1624 delay=str2double(get(hObject,'String'))+ext_offset;
1625 tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1626 tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1627 tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1628 tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1629 tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1630 tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1631 tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1632 tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1633 tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1634 tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1635 tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1636 tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1637 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1638 tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1639 tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1640 tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1641
1642
1643
1644
1645 function ans_bpm_CreateFcn(hObject, eventdata, handles)
1646
1647
1648
1649
1650
1651
1652 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1653 set(hObject,'BackgroundColor','white');
1654 end
1655
1656
1657
1658 function central_ext_Callback(hObject, eventdata, handles)
1659
1660
1661
1662
1663
1664
1665
1666
1667 delay=str2double(get(hObject,'String'));
1668 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue',delay);
1669
1670
1671 function central_ext_CreateFcn(hObject, eventdata, handles)
1672
1673
1674
1675
1676
1677
1678 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1679 set(hObject,'BackgroundColor','white');
1680 end
1681
1682
1683
1684 function central_soft1_Callback(hObject, eventdata, handles)
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695 function central_soft1_CreateFcn(hObject, eventdata, handles)
1696
1697
1698
1699
1700
1701
1702 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1703 set(hObject,'BackgroundColor','white');
1704 end
1705
1706
1707
1708 function button_extmoins_Callback(hObject, eventdata, handles)
1709
1710
1711
1712
1713 dclk=10;
1714 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1715 step=temp.value(1)-dclk;
1716 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',int32(step));
1717 temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
1718 set(handles.central_ext,'String',num2str(temp.value(1)));
1719
1720
1721 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay');boo=temp.value(1);
1722 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay',double(boo-dclk*52*184/2));
1723 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay');ans=temp.value(1);
1724 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay',double(ans-dclk*52*184/2))
1725
1726
1727 function button_extplus_Callback(hObject, eventdata, handles)
1728
1729
1730
1731
1732 dclk=10;
1733 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1734 step=temp.value(1)+dclk;
1735 tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',int32(step));
1736 temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
1737 set(handles.central_ext,'String',num2str(temp.value(1)));
1738
1739
1740 temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay');boo=temp.value(1);
1741 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay',double(boo+dclk*52*184/2));
1742 temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay');ans=temp.value(1);
1743 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay',double(ans+dclk*52*184/2))
1744
1745 function sdc2_Callback(hObject, eventdata, handles)
1746
1747
1748
1749
1750
1751
1752 ext_offset=str2double(get(handles.ext_offset,'String'));
1753 delay=str2double(get(hObject,'String'))+ext_offset;
1754 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
1755
1756
1757 function sdc2_CreateFcn(hObject, eventdata, handles)
1758
1759
1760
1761
1762
1763
1764 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1765 set(hObject,'BackgroundColor','white');
1766 end
1767
1768
1769
1770 function lt2_emittance_Callback(hObject, eventdata, handles)
1771
1772
1773
1774
1775
1776
1777 ext_offset=str2double(get(handles.ext_offset,'String'));
1778 delay=str2double(get(hObject,'String'))+ext_offset;
1779 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
1780 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceTimeDelay',delay);
1781
1782
1783
1784 function lt2_emittance_CreateFcn(hObject, eventdata, handles)
1785
1786
1787
1788
1789
1790
1791 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1792 set(hObject,'BackgroundColor','white');
1793 end
1794
1795
1796
1797 function lt2_bpm_Callback(hObject, eventdata, handles)
1798
1799
1800
1801
1802
1803
1804 ext_offset=str2double(get(handles.ext_offset,'String'));
1805 delay=str2double(get(hObject,'String'))+ext_offset;
1806 tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1807
1808
1809 function lt2_bpm_CreateFcn(hObject, eventdata, handles)
1810
1811
1812
1813
1814
1815
1816 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1817 set(hObject,'BackgroundColor','white');
1818 end
1819
1820
1821
1822 function lt2_osc_Callback(hObject, eventdata, handles)
1823
1824
1825
1826
1827
1828
1829 ext_offset=str2double(get(handles.ext_offset,'String'));
1830 delay=str2double(get(hObject,'String'))+ext_offset;
1831 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
1832
1833
1834 function lt2_osc_CreateFcn(hObject, eventdata, handles)
1835
1836
1837
1838
1839
1840
1841 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1842 set(hObject,'BackgroundColor','white');
1843 end
1844
1845
1846
1847 function lin_modulateur_Callback(hObject, eventdata, handles)
1848
1849
1850
1851
1852
1853
1854 inj_offset=str2double(get(handles.inj_offset,'String'));
1855 delay=str2double(get(hObject,'String'))+inj_offset;
1856 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1857
1858
1859 function lin_modulateur_CreateFcn(hObject, eventdata, handles)
1860
1861
1862
1863
1864
1865
1866 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1867 set(hObject,'BackgroundColor','white');
1868 end
1869
1870
1871
1872 function inj_offset_Callback(hObject, eventdata, handles)
1873
1874
1875
1876
1877
1878
1879
1880 inj_offset=str2double(get(hObject,'String'));
1881 ext_offset=str2double(get(handles.ext_offset,'String'));
1882 lin_fin =str2double(get(handles.lin_canon_spm_fin,'String'));
1883
1884 FileName = [handles.DirName 'synchro_offset_lin'];
1885 save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin')
1886
1887
1888 delay=str2double(get(handles.lin_canon_lpm,'String'))+inj_offset;
1889 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay',delay);
1890
1891 delay=str2double(get(handles.lin_canon_spm,'String'))+inj_offset;
1892 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay',delay);
1893
1894 delay=str2double(get(handles.lin_modulateur,'String'))+inj_offset;
1895 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1896
1897 delay=str2double(get(handles.sdc1,'String'))+inj_offset;
1898 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay',delay);
1899
1900
1901
1902 delay=str2double(get(handles.lt1_MC2,'String'))+inj_offset;
1903 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay',delay);
1904
1905 delay=str2double(get(handles.lt1_MC1,'String'))+inj_offset;
1906 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay',delay);
1907
1908 delay=str2double(get(handles.lt1_emittance,'String'))+inj_offset;
1909 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay',delay);
1910
1911 delay=str2double(get(handles.lt1_osc,'String'))+inj_offset;
1912 tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay',delay);
1913
1914
1915
1916 delay=str2double(get(handles.boo_inj_septum,'String'))+inj_offset;
1917 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay',delay);
1918
1919 delay=str2double(get(handles.boo_inj_kicker,'String'))+inj_offset;
1920 tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay',delay);
1921
1922 delay=str2double(get(handles.boo_bpm,'String'))+inj_offset;
1923 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay',delay);
1924 tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigTimeDelay',delay);
1925 tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigTimeDelay',delay);
1926 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigTimeDelay',delay);
1927
1928
1929 delay=str2double(get(handles.boo_nod,'String'))+inj_offset;
1930 tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay',delay);
1931
1932
1933
1934
1935
1936
1937
1938 function inj_offset_CreateFcn(hObject, eventdata, handles)
1939
1940
1941
1942
1943
1944
1945 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1946 set(hObject,'BackgroundColor','white');
1947 end
1948
1949
1950
1951 function ext_offset_Callback(hObject, eventdata, handles)
1952
1953
1954
1955
1956
1957
1958
1959 ext_offset=str2double(get(hObject,'String'));
1960 inj_offset=str2double(get(handles.inj_offset,'String'));
1961 lin_fin =str2double(get(handles.lin_canon_spm_fin,'String'));
1962
1963
1964 FileName = [handles.DirName 'synchro_offset_lin'];
1965 save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
1966
1967
1968
1969 delay=str2double(get(handles.boo_ext_dof,'String'))+ext_offset;
1970 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
1971
1972 delay=str2double(get(handles.boo_ext_sept_p,'String'))+ext_offset;
1973 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
1974
1975 delay=str2double(get(handles.boo_ext_sept_a,'String'))+ext_offset;
1976 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
1977
1978 delay=str2double(get(handles.boo_ext_kicker,'String'))+ext_offset;
1979 tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
1980
1981 delay=str2double(get(handles.sdc2,'String'))+ext_offset;
1982 tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
1983
1984
1985 delay=str2double(get(handles.lt2_bpm,'String'))+ext_offset;
1986 tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1987
1988 delay=str2double(get(handles.lt2_osc,'String'))+ext_offset;
1989 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
1990
1991 delay=str2double(get(handles.lt2_emittance,'String'))+ext_offset;
1992 tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
1993
1994
1995
1996 delay=str2double(get(handles.ans_inj_sept_a,'String'))+ext_offset;
1997 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
1998
1999 delay=str2double(get(handles.ans_inj_sept_p,'String'))+ext_offset;
2000 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
2001
2002 delay=str2double(get(handles.ans_inj_k1,'String'))+ext_offset;
2003 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
2004
2005 delay=str2double(get(handles.ans_inj_k2,'String'))+ext_offset;
2006 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
2007
2008 delay=str2double(get(handles.ans_inj_k3,'String'))+ext_offset;
2009 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
2010
2011 delay=str2double(get(handles.ans_inj_k4,'String'))+ext_offset;
2012 tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
2013
2014
2015
2016
2017 function ext_offset_CreateFcn(hObject, eventdata, handles)
2018
2019
2020
2021
2022
2023
2024 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2025 set(hObject,'BackgroundColor','white');
2026 end
2027
2028
2029
2030 function button_acquisition_address_Callback(hObject, eventdata, handles)
2031
2032
2033
2034
2035 test_modes(handles);
2036
2037
2038 set(handles.inj_offset,'Enable','off');
2039 set(handles.sdc1,'Enable','off');
2040 set(handles.lin_canon_lpm,'Enable','off');
2041 set(handles.lin_canon_spm,'Enable','off');
2042 set(handles.lin_canon_spm_fin,'Enable','off');
2043 set(handles.boo_bpm,'Enable','off');
2044 set(handles.lt1_emittance,'Enable','off');
2045 set(handles.lt1_MC1,'Enable','off');
2046 set(handles.lt1_MC2,'Enable','off');
2047 set(handles.lt1_osc,'Enable','off');
2048 set(handles.boo_dcct,'Enable','off');
2049 set(handles.boo_nod,'Enable','off');
2050 set(handles.boo_inj_septum,'Enable','off');
2051 set(handles.boo_inj_kicker,'Enable','off');
2052 set(handles.boo_alim_dipole,'Enable','off');
2053 set(handles.boo_alim_qf,'Enable','off');
2054 set(handles.boo_alim_qd,'Enable','off');
2055 set(handles.boo_alim_sf,'Enable','off');
2056 set(handles.boo_alim_sd,'Enable','off');
2057 set(handles.boo_rf,'Enable','off');
2058 set(handles.lin_modulateur,'Enable','off');
2059 set(handles.ext_offset,'Enable','off');
2060 set(handles.boo_ext_dof,'Enable','off');
2061 set(handles.boo_ext_sept_p,'Enable','off');
2062 set(handles.boo_ext_sept_a,'Enable','off');
2063 set(handles.boo_ext_kicker,'Enable','off');
2064 set(handles.sdc2,'Enable','off');
2065 set(handles.lt2_emittance,'Enable','off');
2066 set(handles.lt2_osc,'Enable','off');
2067 set(handles.lt2_bpm,'Enable','off');
2068 set(handles.ans_inj_k1,'Enable','off');
2069 set(handles.ans_inj_k2,'Enable','off');
2070 set(handles.ans_inj_k3,'Enable','off');
2071 set(handles.ans_inj_k4,'Enable','off');
2072 set(handles.ans_inj_sept_p,'Enable','off');
2073 set(handles.ans_inj_sept_a,'Enable','off');
2074 set(handles.ans_bpm,'Enable','off');
2075 set(handles.ans_dcct,'Enable','off');
2076 set(handles.ans_bpm_c01,'Enable','off');
2077 set(handles.ans_bpm_c02,'Enable','off');
2078 set(handles.ans_bpm_c03,'Enable','off');
2079 set(handles.ans_bpm_c04,'Enable','off');
2080 set(handles.ans_bpm_c05,'Enable','off');
2081 set(handles.ans_bpm_c06,'Enable','off');
2082 set(handles.ans_bpm_c07,'Enable','off');
2083 set(handles.ans_bpm_c08,'Enable','off');
2084 set(handles.ans_bpm_c09,'Enable','off');
2085 set(handles.ans_bpm_c10,'Enable','off');
2086 set(handles.ans_bpm_c11,'Enable','off');
2087 set(handles.ans_bpm_c12,'Enable','off');
2088 set(handles.ans_bpm_c13,'Enable','off');
2089 set(handles.ans_bpm_c14,'Enable','off');
2090 set(handles.ans_bpm_c15,'Enable','off');
2091 set(handles.ans_bpm_c16,'Enable','off');
2092
2093
2094
2095 FileName = [handles.DirName 'synchro_offset_lin'];
2096 load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
2097 set(handles.inj_offset,'String',num2str(inj_offset));
2098 set(handles.ext_offset,'String',num2str(ext_offset));
2099 set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
2100
2101 get_synchro_address(handles)
2102
2103
2104
2105 function button_offinj_moins_Callback(hObject, eventdata, handles)
2106
2107
2108
2109
2110 temp=str2double(get(handles.inj_offset,'String'));
2111 step=temp-52*0.52243;
2112 set(handles.inj_offset,'String',step);
2113 inj_offset_Callback(handles.inj_offset, eventdata, handles);
2114
2115
2116 function button_offinj_plus_Callback(hObject, eventdata, handles)
2117
2118
2119
2120
2121 temp=str2double(get(handles.inj_offset,'String'));
2122 step=temp+52*0.52243;
2123 set(handles.inj_offset,'String',step);
2124 inj_offset_Callback(handles.inj_offset, eventdata, handles);
2125
2126
2127 function button_offext_moins_Callback(hObject, eventdata, handles)
2128
2129
2130
2131
2132 temp=str2double(get(handles.ext_offset,'String'));
2133 step=temp-52*0.52243;
2134 set(handles.ext_offset,'String',step);
2135 ext_offset_Callback(handles.ext_offset, eventdata, handles);
2136
2137
2138 function button_offext_plus_Callback(hObject, eventdata, handles)
2139
2140
2141
2142
2143 temp=str2double(get(handles.ext_offset,'String'));
2144 step=temp+52*0.52243;
2145 set(handles.ext_offset,'String',step);
2146 ext_offset_Callback(handles.ext_offset, eventdata, handles);
2147
2148
2149
2150 function button_bpm_Callback(hObject, eventdata, handles)
2151
2152
2153
2154
2155
2156
2157 bpm=get(hObject,'Value');
2158
2159 if (bpm==0)
2160 set(handles.panel_bpm,'Visible','off');
2161 elseif (bpm==1)
2162 set(handles.panel_bpm,'Visible','on');
2163 end
2164
2165
2166
2167 function ans_bpm_c01_Callback(hObject, eventdata, handles)
2168
2169
2170
2171
2172
2173
2174
2175 ext_offset=str2double(get(handles.ext_offset,'String'));
2176 delay=str2double(get(hObject,'String'))+ext_offset;
2177 tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
2178
2179
2180 function ans_bpm_c01_CreateFcn(hObject, eventdata, handles)
2181
2182
2183
2184
2185
2186
2187 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2188 set(hObject,'BackgroundColor','white');
2189 end
2190
2191
2192 function ans_bpm_c02_Callback(hObject, eventdata, handles)
2193
2194
2195
2196
2197
2198
2199 ext_offset=str2double(get(handles.ext_offset,'String'));
2200 delay=str2double(get(hObject,'String'))+ext_offset;
2201 tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2202
2203
2204
2205 function ans_bpm_c02_CreateFcn(hObject, eventdata, handles)
2206
2207
2208
2209
2210
2211
2212 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2213 set(hObject,'BackgroundColor','white');
2214 end
2215
2216
2217
2218 function ans_bpm_c03_Callback(hObject, eventdata, handles)
2219
2220
2221
2222
2223
2224
2225 ext_offset=str2double(get(handles.ext_offset,'String'));
2226 delay=str2double(get(hObject,'String'))+ext_offset;
2227 tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2228
2229
2230
2231 function ans_bpm_c03_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
2244 function ans_bpm_c04_Callback(hObject, eventdata, handles)
2245
2246
2247
2248
2249
2250
2251 ext_offset=str2double(get(handles.ext_offset,'String'));
2252 delay=str2double(get(hObject,'String'))+ext_offset;
2253 tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2254
2255
2256
2257 function ans_bpm_c04_CreateFcn(hObject, eventdata, handles)
2258
2259
2260
2261
2262
2263
2264 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2265 set(hObject,'BackgroundColor','white');
2266 end
2267
2268
2269
2270 function ans_bpm_c05_Callback(hObject, eventdata, handles)
2271
2272
2273
2274
2275
2276
2277 ext_offset=str2double(get(handles.ext_offset,'String'));
2278 delay=str2double(get(hObject,'String'))+ext_offset;
2279 tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2280
2281
2282
2283 function ans_bpm_c05_CreateFcn(hObject, eventdata, handles)
2284
2285
2286
2287
2288
2289
2290 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2291 set(hObject,'BackgroundColor','white');
2292 end
2293
2294
2295
2296 function ans_bpm_c06_Callback(hObject, eventdata, handles)
2297
2298
2299
2300
2301
2302
2303 ext_offset=str2double(get(handles.ext_offset,'String'));
2304 delay=str2double(get(hObject,'String'))+ext_offset;
2305 tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2306
2307
2308
2309 function ans_bpm_c06_CreateFcn(hObject, eventdata, handles)
2310
2311
2312
2313
2314
2315
2316 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2317 set(hObject,'BackgroundColor','white');
2318 end
2319
2320
2321
2322 function ans_bpm_c07_Callback(hObject, eventdata, handles)
2323
2324
2325
2326
2327
2328
2329 ext_offset=str2double(get(handles.ext_offset,'String'));
2330 delay=str2double(get(hObject,'String'))+ext_offset;
2331 tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2332
2333
2334
2335 function ans_bpm_c07_CreateFcn(hObject, eventdata, handles)
2336
2337
2338
2339
2340
2341
2342 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2343 set(hObject,'BackgroundColor','white');
2344 end
2345
2346
2347
2348 function ans_bpm_c08_Callback(hObject, eventdata, handles)
2349
2350
2351
2352
2353
2354
2355 ext_offset=str2double(get(handles.ext_offset,'String'));
2356 delay=str2double(get(hObject,'String'))+ext_offset;
2357 tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2358
2359
2360
2361 function ans_bpm_c08_CreateFcn(hObject, eventdata, handles)
2362
2363
2364
2365
2366
2367
2368 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2369 set(hObject,'BackgroundColor','white');
2370 end
2371
2372
2373
2374 function ans_bpm_c09_Callback(hObject, eventdata, handles)
2375
2376
2377
2378
2379
2380
2381 ext_offset=str2double(get(handles.ext_offset,'String'));
2382 delay=str2double(get(hObject,'String'))+ext_offset;
2383 tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2384
2385
2386
2387 function ans_bpm_c09_CreateFcn(hObject, eventdata, handles)
2388
2389
2390
2391
2392
2393
2394 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2395 set(hObject,'BackgroundColor','white');
2396 end
2397
2398
2399
2400 function ans_bpm_c10_Callback(hObject, eventdata, handles)
2401
2402
2403
2404
2405
2406
2407 ext_offset=str2double(get(handles.ext_offset,'String'));
2408 delay=str2double(get(hObject,'String'))+ext_offset;
2409 tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2410
2411
2412
2413 function ans_bpm_c10_CreateFcn(hObject, eventdata, handles)
2414
2415
2416
2417
2418
2419
2420 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2421 set(hObject,'BackgroundColor','white');
2422 end
2423
2424
2425
2426 function ans_bpm_c11_Callback(hObject, eventdata, handles)
2427
2428
2429
2430
2431
2432
2433 ext_offset=str2double(get(handles.ext_offset,'String'));
2434 delay=str2double(get(hObject,'String'))+ext_offset;
2435 tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2436
2437
2438
2439 function ans_bpm_c11_CreateFcn(hObject, eventdata, handles)
2440
2441
2442
2443
2444
2445
2446 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2447 set(hObject,'BackgroundColor','white');
2448 end
2449
2450
2451
2452 function ans_bpm_c12_Callback(hObject, eventdata, handles)
2453
2454
2455
2456
2457
2458
2459 ext_offset=str2double(get(handles.ext_offset,'String'));
2460 delay=str2double(get(hObject,'String'))+ext_offset;
2461 tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2462
2463
2464
2465 function ans_bpm_c12_CreateFcn(hObject, eventdata, handles)
2466
2467
2468
2469
2470
2471
2472 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2473 set(hObject,'BackgroundColor','white');
2474 end
2475
2476
2477
2478 function ans_bpm_c13_Callback(hObject, eventdata, handles)
2479
2480
2481
2482
2483
2484
2485 ext_offset=str2double(get(handles.ext_offset,'String'));
2486 delay=str2double(get(hObject,'String'))+ext_offset;
2487 tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2488
2489
2490
2491 function ans_bpm_c13_CreateFcn(hObject, eventdata, handles)
2492
2493
2494
2495
2496
2497
2498 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2499 set(hObject,'BackgroundColor','white');
2500 end
2501
2502
2503
2504 function ans_bpm_c14_Callback(hObject, eventdata, handles)
2505
2506
2507
2508
2509
2510
2511 ext_offset=str2double(get(handles.ext_offset,'String'));
2512 delay=str2double(get(hObject,'String'))+ext_offset;
2513 tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2514
2515
2516
2517 function ans_bpm_c14_CreateFcn(hObject, eventdata, handles)
2518
2519
2520
2521
2522
2523
2524 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2525 set(hObject,'BackgroundColor','white');
2526 end
2527
2528
2529
2530 function ans_bpm_c15_Callback(hObject, eventdata, handles)
2531
2532
2533
2534
2535
2536
2537 ext_offset=str2double(get(handles.ext_offset,'String'));
2538 delay=str2double(get(hObject,'String'))+ext_offset;
2539 tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2540
2541
2542
2543 function ans_bpm_c15_CreateFcn(hObject, eventdata, handles)
2544
2545
2546
2547
2548
2549
2550 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2551 set(hObject,'BackgroundColor','white');
2552 end
2553
2554
2555
2556 function ans_bpm_c16_Callback(hObject, eventdata, handles)
2557
2558
2559
2560
2561
2562
2563 ext_offset=str2double(get(handles.ext_offset,'String'));
2564 delay=str2double(get(hObject,'String'))+ext_offset;
2565 tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2566
2567
2568
2569 function ans_bpm_c16_CreateFcn(hObject, eventdata, handles)
2570
2571
2572
2573
2574
2575
2576 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2577 set(hObject,'BackgroundColor','white');
2578 end
2579
2580
2581
2582 function edit_filling_relecture_tables_Callback(hObject, eventdata, handles)
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592 function edit_filling_relecture_tables_CreateFcn(hObject, eventdata, handles)
2593
2594
2595
2596
2597
2598
2599 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2600 set(hObject,'BackgroundColor','white');
2601 end
2602
2603
2604
2605 function edit_filling_relecture_bunch_Callback(hObject, eventdata, handles)
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615 function edit_filling_relecture_bunch_CreateFcn(hObject, eventdata, handles)
2616
2617
2618
2619
2620
2621
2622 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2623 set(hObject,'BackgroundColor','white');
2624 end
2625
2626
2627
2628 function edit_filling_entrer_bunch_Callback(hObject, eventdata, handles)
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640 function edit_filling_entrer_bunch_CreateFcn(hObject, eventdata, handles)
2641
2642
2643
2644
2645
2646
2647 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2648 set(hObject,'BackgroundColor','white');
2649 end
2650
2651
2652
2653 function button_update_Callback(hObject, eventdata, handles)
2654
2655
2656
2657
2658 do_update
2659
2660
2661 function button_acquisition_trigstatus_Callback(hObject, eventdata, handles)
2662
2663
2664
2665
2666 test_modes(handles);
2667
2668 set(handles.inj_offset,'Enable','off');
2669 set(handles.sdc1,'Enable','off');
2670 set(handles.lin_canon_lpm,'Enable','off');
2671 set(handles.boo_bpm,'Enable','off');
2672 set(handles.lt1_emittance,'Enable','off');
2673 set(handles.lt1_MC1,'Enable','off');
2674 set(handles.lt1_MC2,'Enable','off');
2675 set(handles.lt1_osc,'Enable','off');
2676 set(handles.boo_dcct,'Enable','off');
2677 set(handles.boo_nod,'Enable','off');
2678 set(handles.boo_inj_septum,'Enable','off');
2679 set(handles.boo_inj_kicker,'Enable','off');
2680 set(handles.boo_alim_dipole,'Enable','off');
2681 set(handles.boo_alim_qf,'Enable','off');
2682 set(handles.boo_alim_qd,'Enable','off');
2683 set(handles.boo_alim_sf,'Enable','off');
2684 set(handles.boo_alim_sd,'Enable','off');
2685 set(handles.boo_rf,'Enable','off');
2686 set(handles.lin_modulateur,'Enable','off');
2687 set(handles.ext_offset,'Enable','off');
2688 set(handles.boo_ext_dof,'Enable','off');
2689 set(handles.boo_ext_sept_p,'Enable','off');
2690 set(handles.boo_ext_sept_a,'Enable','off');
2691 set(handles.boo_ext_kicker,'Enable','off');
2692 set(handles.sdc2,'Enable','off');
2693 set(handles.lt2_emittance,'Enable','off');
2694 set(handles.lt2_osc,'Enable','off');
2695 set(handles.lt2_bpm,'Enable','off');
2696 set(handles.ans_inj_k1,'Enable','off');
2697 set(handles.ans_inj_k2,'Enable','off');
2698 set(handles.ans_inj_k3,'Enable','off');
2699 set(handles.ans_inj_k4,'Enable','off');
2700 set(handles.ans_inj_sept_p,'Enable','off');
2701 set(handles.ans_inj_sept_a,'Enable','off');
2702 set(handles.ans_bpm,'Enable','off');
2703 set(handles.ans_dcct,'Enable','off');
2704 set(handles.ans_bpm_c01,'Enable','off');
2705 set(handles.ans_bpm_c02,'Enable','off');
2706 set(handles.ans_bpm_c03,'Enable','off');
2707 set(handles.ans_bpm_c04,'Enable','off');
2708 set(handles.ans_bpm_c05,'Enable','off');
2709 set(handles.ans_bpm_c06,'Enable','off');
2710 set(handles.ans_bpm_c07,'Enable','off');
2711 set(handles.ans_bpm_c08,'Enable','off');
2712 set(handles.ans_bpm_c09,'Enable','off');
2713 set(handles.ans_bpm_c10,'Enable','off');
2714 set(handles.ans_bpm_c11,'Enable','off');
2715 set(handles.ans_bpm_c12,'Enable','off');
2716 set(handles.ans_bpm_c13,'Enable','off');
2717 set(handles.ans_bpm_c14,'Enable','off');
2718 set(handles.ans_bpm_c15,'Enable','off');
2719 set(handles.ans_bpm_c16,'Enable','off');
2720
2721 get_synchro_trigstatus(handles)
2722
2723
2724
2725 function togglebutton2_Callback(hObject, eventdata, handles)
2726
2727
2728
2729
2730
2731
2732
2733
2734 function listbox_fillingmode_Callback(hObject, eventdata, handles)
2735
2736
2737
2738
2739
2740
2741 pattern=get(hObject,'String');
2742 mode=get(hObject,'Value');
2743 fprintf('***************************************************\n')
2744 fprintf('Mode de remplissage sélectionné : %s\n',pattern{mode})
2745 fprintf('***************************************************\n')
2746
2747
2748
2749 quart=[1 105 209 313];
2750 temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
2751 offset_ext=temp.value(1)*52;
2752 offset_linac=str2double(get(handles.lin_canon_spm_fin,'String')) ;
2753 offset_linac=offset_linac/handles.lin_fin_step;
2754 bjump=handles.one_bunch;
2755
2756
2757 if (mode<=4)
2758 bunch=quart(mode);
2759 fillingmode='1/4';
2760 elseif (mode>4)&&(mode<=7)
2761 bunch=quart(1:(mode-3));
2762 if mode==5 ; fillingmode='1/2'; end
2763 if mode==6 ; fillingmode='3/4'; end
2764 if mode==7 ; fillingmode='4/4'; end
2765 elseif (mode==8)
2766 bunch=[365];
2767
2768 fillingmode='3/4';
2769 elseif (mode==9)
2770 bunch=[1];
2771 fillingmode='1 bunch';
2772 elseif (mode==10)
2773 bunch=[0:7]*52+1;
2774 fillingmode='8 bunches';
2775 elseif (mode==11)
2776 bunch=[0:15]*26+1;
2777 fillingmode='16 bunches';
2778 elseif (mode==12)
2779 bunch=str2num(get(handles.edit_filling_entrer_bunch,'String'));
2780 if isempty(bunch)
2781 set(handles.edit_filling_entrer_bunch,'String','Bug format');
2782 end
2783 fillingmode='Few bunches';
2784 elseif (mode==13)
2785 paq=str2num(get(handles.edit_filling_entrer_bunch1,'String'));
2786 if (length(paq) == 2)
2787 bunch=paq(1):paq(2);
2788 else
2789 set(handles.edit_filling_entrer_bunch1,'String','Bug format')
2790 end
2791 fillingmode='Few bunches';
2792 end
2793
2794
2795 tango_write_attribute2('ANS/DG/PUB-FillingMode', 'fillingMode',fillingmode)
2796
2797
2798 Ncoup=length(bunch);
2799 boucle=int16(str2double(get(handles.edit_Ncycle,'String')));
2800 if Ncoup>=1
2801 set(handles.edit_Ncoup,'String',num2str(Ncoup));
2802 tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2803 end
2804
2805
2806 [dtour,dpaquet]=bucketnumber(bunch);
2807 dpaquet=dpaquet*bjump+offset_linac;
2808 table=int32([length(bunch) dtour dpaquet]);
2809 handles.table=table;
2810 handles.bunch=bunch;
2811
2812
2813 FileName = [handles.DirName 'table.mat'];
2814 save(FileName, 'table');
2815
2816 modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
2817 if strcmp(modeinj,'togglebutton_soft')
2818 table=handles.table0;
2819 tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
2820
2821 elseif strcmp(modeinj,'togglebutton_3Hz')
2822 tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
2823 pause(1);
2824 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
2825 n=temp.value;
2826 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
2827 table_ext=temp.value(1:n);
2828 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
2829 table_linac=(temp.value(1:n)-offset_linac)/bjump;
2830 table=[];
2831 for i=1:n
2832 table=[table ' ' '(' num2str([table_ext(i)]) ' ' num2str([table_linac(i)]) ')'];
2833 end
2834 end
2835
2836 set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
2837 set(handles.edit_filling_relecture_bunch, 'String',[num2str(bunch)]);
2838
2839
2840 guidata(hObject, handles);
2841
2842
2843
2844 function listbox_fillingmode_CreateFcn(hObject, eventdata, handles)
2845
2846
2847
2848
2849
2850
2851 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2852 set(hObject,'BackgroundColor','white');
2853 end
2854
2855
2856
2857 function button_fix_Callback(hObject, eventdata, handles)
2858
2859
2860
2861
2862 [clk_spare,clk_soft]=fix_quart;
2863 handles.clk_spare =clk_spare;
2864 handles.clk_soft=clk_soft;
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876 guidata(hObject, handles);
2877
2878
2879
2880 function edit_Ncycle_Callback(hObject, eventdata, handles)
2881
2882
2883
2884
2885
2886
2887 boucle=str2double(get(hObject,'String'));
2888 Ncoup=str2double(get(handles.edit_Ncoup,'String'));
2889 tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2890
2891
2892 function edit_Ncycle_CreateFcn(hObject, eventdata, handles)
2893
2894
2895
2896
2897
2898
2899 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2900 set(hObject,'BackgroundColor','white');
2901 end
2902
2903
2904
2905 function edit_Ncoup_Callback(hObject, eventdata, handles)
2906
2907
2908
2909
2910
2911
2912 Ncoup=str2double(get(hObject,'String'));
2913 boucle=str2double(get(handles.edit_Ncycle,'String'));
2914 tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2915
2916
2917 function edit_Ncoup_CreateFcn(hObject, eventdata, handles)
2918
2919
2920
2921
2922
2923
2924 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2925 set(hObject,'BackgroundColor','white');
2926 end
2927
2928
2929
2930 function edit_qlt1_Callback(hObject, eventdata, handles)
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940 function edit_qlt1_CreateFcn(hObject, eventdata, handles)
2941
2942
2943
2944
2945
2946
2947 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2948 set(hObject,'BackgroundColor','white');
2949 end
2950
2951
2952
2953 function edit_iboo_Callback(hObject, eventdata, handles)
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963 function edit_iboo_CreateFcn(hObject, eventdata, handles)
2964
2965
2966
2967
2968
2969
2970 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2971 set(hObject,'BackgroundColor','white');
2972 end
2973
2974
2975
2976 function edit_dians_Callback(hObject, eventdata, handles)
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986 function edit_dians_CreateFcn(hObject, eventdata, handles)
2987
2988
2989
2990
2991
2992
2993 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2994 set(hObject,'BackgroundColor','white');
2995 end
2996
2997
2998
2999 function edit_rlt1_Callback(hObject, eventdata, handles)
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009 function edit_rlt1_CreateFcn(hObject, eventdata, handles)
3010
3011
3012
3013
3014
3015
3016 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3017 set(hObject,'BackgroundColor','white');
3018 end
3019
3020
3021
3022 function edit_rboo_Callback(hObject, eventdata, handles)
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032 function edit_rboo_CreateFcn(hObject, eventdata, handles)
3033
3034
3035
3036
3037
3038
3039 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3040 set(hObject,'BackgroundColor','white');
3041 end
3042
3043
3044
3045 function edit_rans_Callback(hObject, eventdata, handles)
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055 function edit_rans_CreateFcn(hObject, eventdata, handles)
3056
3057
3058
3059
3060
3061
3062 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3063 set(hObject,'BackgroundColor','white');
3064 end
3065
3066
3067
3068 function edit_dians1_Callback(hObject, eventdata, handles)
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078 function edit_dians1_CreateFcn(hObject, eventdata, handles)
3079
3080
3081
3082
3083
3084
3085 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3086 set(hObject,'BackgroundColor','white');
3087 end
3088
3089
3090
3091 function edit_cycle_Callback(hObject, eventdata, handles)
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101 function edit_cycle_CreateFcn(hObject, eventdata, handles)
3102
3103
3104
3105
3106
3107
3108 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3109 set(hObject,'BackgroundColor','white');
3110 end
3111
3112
3113
3114 function edit_courant_total_Callback(hObject, eventdata, handles)
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124 function edit_courant_total_CreateFcn(hObject, eventdata, handles)
3125
3126
3127
3128
3129
3130
3131 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3132 set(hObject,'BackgroundColor','white');
3133 end
3134
3135
3136
3137 function lin_canon_spm_Callback(hObject, eventdata, handles)
3138
3139
3140
3141
3142
3143
3144
3145 inj_offset=str2double(get(handles.inj_offset,'String'));
3146 delay=str2double(get(hObject,'String'))+inj_offset;
3147 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay',delay);
3148
3149
3150
3151 function lin_canon_spm_CreateFcn(hObject, eventdata, handles)
3152
3153
3154
3155
3156
3157
3158 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3159 set(hObject,'BackgroundColor','white');
3160 end
3161
3162
3163 function uipanel_mode_CreateFcn(hObject, eventdata, handles)
3164
3165
3166
3167
3168
3169
3170 function uipanel_mode_SelectionChangeFcn(hObject, eventdata, handles)
3171
3172
3173
3174
3175 set(handles.button_injection_soft,'Enable','Off')
3176 set(handles.edit_modes,'String','Please WAIT !!!!')
3177 mode=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3178
3179 switch mode
3180 case 'togglebutton_soft'
3181
3182
3183 Directory=handles.Directory;
3184 DirName=handles.DirName;
3185 file='golden_rafale_soft.mat';
3186 load_synchro_rafale(Directory,file,DirName)
3187
3188
3189
3190 r=(1-0.0004);
3191 try
3192 temp=tango_read_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage');boo=temp.value(2)*r
3193 tango_write_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage',boo);
3194 temp=tango_read_attribute2('ANS-C01/EP/AL_SEP_A','voltage');ans=temp.value(2)*r
3195 tango_write_attribute2('ANS-C01/EP/AL_SEP_A','voltage',ans);
3196 catch
3197 display('Erreur ajustement tension septa passif')
3198 end
3199 set(handles.edit_Ncoup,'Enable','off');
3200 tango_command_inout('ANS/SY/CENTRAL','SetTables',handles.table0);
3201
3202 case 'togglebutton_3Hz'
3203
3204
3205 Directory=handles.Directory;
3206 DirName=handles.DirName;
3207 file='golden_rafale_3Hz.mat';
3208 load_synchro_rafale(Directory,file,DirName)
3209
3210
3211 r=(1+0.0004);
3212 try
3213 temp=tango_read_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage');boo=temp.value(2)*r
3214 tango_write_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage',boo);
3215 temp=tango_read_attribute2('ANS-C01/EP/AL_SEP_A','voltage'); ans=temp.value(2)*r
3216 tango_write_attribute2('ANS-C01/EP/AL_SEP_A','voltage',ans);
3217 catch
3218 display('Erreur ajustement tension septa passif')
3219 end
3220 set(handles.edit_Ncoup,'Enable','on');
3221 tango_command_inout('ANS/SY/CENTRAL','SetTables',handles.table);
3222 end
3223
3224 set(handles.button_injection_soft,'Enable','On')
3225 test_modes(handles);
3226 display('ok change address')
3227
3228
3229
3230 function edit_filling_entrer_bunch1_Callback(hObject, eventdata, handles)
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242 function edit_filling_entrer_bunch1_CreateFcn(hObject, eventdata, handles)
3243
3244
3245
3246
3247
3248
3249 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3250 set(hObject,'BackgroundColor','white');
3251 end
3252
3253
3254
3255 function edit_Imin_Callback(hObject, eventdata, handles)
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265 function edit_Imin_CreateFcn(hObject, eventdata, handles)
3266
3267
3268
3269
3270
3271
3272 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3273 set(hObject,'BackgroundColor','white');
3274 end
3275
3276
3277
3278 function uipanel_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
3279
3280
3281
3282
3283
3284
3285
3286 mode=get(get(handles.uipanel_spm_mode,'SelectedObject'),'Tag');
3287
3288 switch mode
3289 case 'spm_mode_1'
3290 display('spm_mode_1')
3291 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(1));
3292 case 'spm_mode_2'
3293 display('spm_mode_2')
3294 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(2));
3295 case 'spm_mode_2p'
3296 display('spm_mode_2p')
3297 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(3));
3298 case 'spm_mode_3'
3299 display('spm_mode_3')
3300 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(4));
3301 end
3302
3303 test_modes(handles);
3304
3305
3306 function uipanel_lpm_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
3307
3308
3309
3310
3311
3312 mode=get(get(handles.uipanel_lpm_spm_mode,'SelectedObject'),'Tag');
3313 modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3314 event0=int32(0);
3315 if strcmp(modeinj,'togglebutton_soft')
3316 event=int32(5);
3317 elseif strcmp(modeinj,'togglebutton_3Hz')
3318 event=int32(2);
3319 else
3320
3321 end
3322
3323 switch mode
3324 case 'no_mode'
3325 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event0);
3326 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event0);
3327
3328 case 'lpm_mode'
3329 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event);
3330 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event0);
3331
3332
3333
3334
3335 case 'spm_mode'
3336 tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event0);
3337 tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event);
3338
3339
3340
3341
3342 end
3343 test_modes(handles);
3344
3345
3346
3347
3348
3349
3350
3351 function uipanel_central_mode_SelectionChangeFcn(hObject, eventdata, handles)
3352
3353
3354
3355
3356 mode=get(get(handles.uipanel_central_mode,'SelectedObject'),'Tag');
3357 modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3358
3359 h='Yes';
3360 if strcmp(mode,'continuous_mode')
3361 if strcmp(modeinj,'togglebutton_3Hz')
3362 h = questdlg('Attention, déclenchement continu des équipements sur adresses 1 2 3');
3363 end
3364 end
3365
3366 if strcmp(h,'Yes')
3367 switch mode
3368 case 'burst_mode'
3369 tango_command_inout2('ANS/SY/CENTRAL', 'SetBurstMode');
3370 case 'continuous_mode'
3371 tango_command_inout2('ANS/SY/CENTRAL', 'SetContinuousMode');
3372 end
3373 end
3374 pause(1)
3375 test_modes(handles);
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392 function [etat]=test_central_mode(handles)
3393
3394 temp=tango_read_attribute2('ANS/SY/CENTRAL', 'currentMode');
3395 mode=temp.value;
3396 h=get(handles.uipanel_central_mode);
3397 switch mode
3398 case 'BURST'
3399 set(handles.uipanel_central_mode,'SelectedObject',h.Children(2))
3400 etat='Rafale';
3401 case 'CONTINUOUS'
3402 set(handles.uipanel_central_mode,'SelectedObject',h.Children(1))
3403 etat='Continu';
3404 end
3405
3406 function [etat]=test_injection_mode(handles)
3407
3408
3409 temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
3410 mode=temp.value(1);
3411 h=get(handles.uipanel_mode);
3412 if mode==2
3413 set(handles.uipanel_mode,'SelectedObject',h.Children(1))
3414 etat='3Hz';
3415 elseif mode==5
3416 set(handles.uipanel_mode,'SelectedObject',h.Children(2))
3417 etat='Soft';
3418 else
3419 set(handles.uipanel_mode,'SelectedObject',[])
3420 etat='??';
3421 end
3422
3423
3424 function [etat]=test_lpm_spm_mode(handles)
3425
3426 temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
3427 modelpm=temp.value(1);
3428 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent');
3429 modespm=temp.value(1);
3430 h=get(handles.uipanel_lpm_spm_mode);
3431 if (modelpm==5)&(modespm==0) | (modelpm==2)&(modespm==0)
3432 set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(2))
3433 etat='LPM';
3434 elseif (modelpm==0)&(modespm==5) | (modelpm==0)&(modespm==2)
3435 set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(1))
3436 etat='SPM';
3437 else
3438 set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(3))
3439 etat='NONE';
3440 end
3441
3442 function [etat]=test_spm_mode(handles)
3443
3444 temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'mode');
3445 mode=temp.value(1);
3446 h=get(handles.uipanel_spm_mode);
3447 select=h.Children(5-mode);
3448 set(handles.uipanel_spm_mode,'SelectedObject',select)
3449 etat=num2str(5-mode);
3450
3451 function [etat]=test_cond_inj(handles)
3452
3453 try temp=tango_read_attribute2('ANS/FC/INJ_COND', 'COND_INJ');
3454 val=temp.value; catch val=1 ; end; if val~=0 ; val=1; end;
3455 if (val==1)
3456 etat='TIR AUTORISE';
3457 else
3458 etat='TIR NON AUTORISE';
3459 end
3460
3461
3462
3463
3464 function test_modes(handles)
3465
3466 [etat_central]=test_central_mode(handles);
3467
3468 [etat_injection]=test_injection_mode(handles);
3469
3470 [etat_linac]=test_lpm_spm_mode(handles);
3471
3472 [etat_linac_spm]=test_spm_mode(handles);
3473
3474
3475
3476
3477
3478
3479 txt=['CENTRAL : ',etat_central,' # INJECTION : ',etat_injection,' # LINAC : ',etat_linac];
3480 set(handles.edit_modes,'String',txt)
3481
3482
3483
3484 function edit_modes_Callback(hObject, eventdata, handles)
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494 function edit_modes_CreateFcn(hObject, eventdata, handles)
3495
3496
3497
3498
3499
3500
3501 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3502 set(hObject,'BackgroundColor','white');
3503 end
3504
3505 function ans_k_pc_Callback(hObject, eventdata, handles)
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515 function ans_k_pc_CreateFcn(hObject, eventdata, handles)
3516
3517
3518
3519
3520
3521
3522 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3523 set(hObject,'BackgroundColor','white');
3524 end
3525
3526
3527
3528 function ans_k_h_Callback(hObject, eventdata, handles)
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538 function ans_k_h_CreateFcn(hObject, eventdata, handles)
3539
3540
3541
3542
3543
3544
3545 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3546 set(hObject,'BackgroundColor','white');
3547 end
3548
3549
3550
3551 function ans_k_v_Callback(hObject, eventdata, handles)
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561 function ans_k_v_CreateFcn(hObject, eventdata, handles)
3562
3563
3564
3565
3566
3567
3568 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3569 set(hObject,'BackgroundColor','white');
3570 end
3571
3572
3573
3574 function button_kicker_Callback(hObject, eventdata, handles)
3575
3576
3577
3578
3579
3580
3581 bpm=get(hObject,'Value');
3582
3583 if (bpm==0)
3584 set(handles.uipanel_kicker_machine,'Visible','off');
3585 elseif (bpm==1)
3586 set(handles.uipanel_kicker_machine,'Visible','on');
3587 end
3588
3589
3590
3591 function button_save_golden_soft_Callback(hObject, eventdata, handles)
3592
3593
3594
3595 h = questdlg('Attention, sauvegarde nouvelle golden !!!');
3596
3597 if strcmp(h,'Yes')
3598
3599 DirName=handles.DirName;
3600 [timing]=get_synchro_rafale(DirName);
3601
3602 file='golden_rafale_soft.mat';
3603
3604 Directory=handles.Directory;
3605 pwdold = pwd;
3606 cd(Directory);
3607 save(file, 'timing');
3608 cd(pwdold);
3609
3610 end
3611
3612
3613
3614 function button_load_golden_soft_Callback(hObject, eventdata, handles)
3615
3616
3617
3618
3619 set(handles.button_injection_soft,'Enable','Off')
3620 set(handles.edit_modes,'String','Please WAIT !!!!')
3621 Directory=handles.Directory;
3622 DirName=handles.DirName;
3623 file='golden_rafale_soft.mat';
3624 load_synchro_rafale(Directory,file,DirName)
3625 set(handles.button_injection_soft,'Enable','On')
3626 test_modes(handles);
3627
3628
3629
3630 function button_load_golden_3Hz_Callback(hObject, eventdata, handles)
3631
3632
3633
3634
3635 [etat_central]=test_central_mode(handles);
3636 h='Yes';
3637 if strcmp(etat_central,'Continu')
3638 h = questdlg('Attention, Trigger en mode continu');
3639 end
3640 if strcmp(h,'Yes')
3641 set(handles.button_injection_soft,'Enable','Off')
3642 set(handles.edit_modes,'String','Please WAIT !!!!')
3643 Directory=handles.Directory;
3644 DirName=handles.DirName;
3645 file='golden_rafale_3Hz.mat';
3646 load_synchro_rafale(Directory,file,DirName)
3647 set(handles.button_injection_soft,'Enable','On')
3648 test_modes(handles);
3649 end
3650
3651
3652 function button_save_golden_3Hz_Callback(hObject, eventdata, handles)
3653
3654
3655
3656 h = questdlg('Attention, sauvegarde nouvelle golden !!!');
3657
3658 if strcmp(h,'Yes')
3659
3660 DirName=handles.DirName;
3661 [timing]=get_synchro_rafale(DirName);
3662
3663 file='golden_rafale_3Hz.mat';
3664
3665 Directory=handles.Directory;
3666 pwdold = pwd;
3667 cd(Directory);
3668 save(file, 'timing');
3669 cd(pwdold);
3670
3671 end
3672
3673
3674 function button_load_golden_3Hz_66MeV_Callback(hObject, eventdata, handles)
3675
3676
3677
3678 [etat_central]=test_central_mode(handles);
3679 h='Yes';
3680 if strcmp(etat_central,'Continu')
3681 h = questdlg('Attention, Trigger en mode continu');
3682 end
3683 if strcmp(h,'Yes')
3684 set(handles.button_injection_soft,'Enable','Off')
3685 set(handles.edit_modes,'String','Please WAIT !!!!')
3686 Directory=handles.Directory;
3687 DirName=handles.DirName;
3688 file='golden_rafale_3Hz_66MeV.mat';
3689 load_synchro_rafale(Directory,file,DirName)
3690 set(handles.button_injection_soft,'Enable','On')
3691 test_modes(handles);
3692 end
3693
3694
3695
3696 function button_save_golden_66MeV_Callback(hObject, eventdata, handles)
3697
3698
3699
3700 h = questdlg('Attention, sauvegarde nouvelle golden 66 MeV!!!');
3701
3702 if strcmp(h,'Yes')
3703
3704 DirName=handles.DirName;
3705 [timing]=get_synchro_rafale(DirName);
3706
3707 file='golden_rafale_3Hz_66MeV.mat';
3708
3709 Directory=handles.Directory;
3710 pwdold = pwd;
3711 cd(Directory);
3712 save(file, 'timing');
3713 cd(pwdold);
3714
3715 end
3716