[4] | 1 | function Set_and_Check_Libera_config_for_USERS |
---|
| 2 | % |
---|
| 3 | % See Also Set_and_Check_Libera_config_for_FMA |
---|
| 4 | |
---|
| 5 | % Création d'un groupe tango |
---|
| 6 | %bpms_group=tango_group_create2('bpms'); |
---|
| 7 | bpms_group=family2tangogroup('BPMx'); |
---|
| 8 | dev_list=family2tangodev('BPMx'); |
---|
| 9 | for i=1:size(dev_list,1), |
---|
| 10 | tango_group_add(bpms_group,dev_list{i}); |
---|
| 11 | end |
---|
| 12 | tango_group_ping(bpms_group); |
---|
| 13 | |
---|
| 14 | % liste des paramÚtres libera |
---|
| 15 | SAEnabled=uint8(1); |
---|
| 16 | Switches=int16(255); |
---|
| 17 | SwitchingDelay=int32(0); |
---|
| 18 | DSCMode=int16(2); |
---|
| 19 | AGCEnabled=uint8(1); |
---|
| 20 | TimePhase=int32(0); |
---|
| 21 | CompensateTune=uint8(1); |
---|
| 22 | ExternalSwitching=uint8(1); |
---|
| 23 | OffsetTune=int32(220); |
---|
| 24 | MCPLLStatus=1; |
---|
| 25 | HasMAFSupport=0; |
---|
| 26 | UseLiberaSAData=uint8(1); |
---|
| 27 | normalBufferSize = int32(1026); |
---|
| 28 | |
---|
| 29 | % lecture de la configuration actuelle des liberas |
---|
| 30 | attr_list={'DDBufferSize','SAEnabled','Switches','SwitchingDelay','DSCMode','AGCEnabled','TimePhase', ... |
---|
| 31 | 'CompensateTune','ExternalSwitching','OffsetTune','UseLiberaSAData','MCPLLStatus','HasMAFSupport'}; |
---|
| 32 | nominal_values_array={normalBufferSize SAEnabled Switches SwitchingDelay DSCMode AGCEnabled TimePhase ... |
---|
| 33 | CompensateTune ExternalSwitching OffsetTune UseLiberaSAData MCPLLStatus HasMAFSupport}; |
---|
| 34 | result=tango_group_read_attributes2(bpms_group,attr_list); |
---|
| 35 | |
---|
| 36 | fprintf('\n'); |
---|
| 37 | fprintf('\n'); |
---|
| 38 | fprintf('***********************************************************************\n'); |
---|
| 39 | fprintf('Vérification de la configuration des Libéras pour les runs utilisateurs\n'); |
---|
| 40 | fprintf('***********************************************************************\n'); |
---|
| 41 | |
---|
| 42 | MAF_installed=0; |
---|
| 43 | MC_not_locked=0; |
---|
| 44 | erreurs=0; |
---|
| 45 | for j=1:1:size(attr_list,2) |
---|
| 46 | for i=1:length(dev_list), |
---|
| 47 | if result.dev_replies(i).attr_values(j).value(1)~=nominal_values_array{j} |
---|
| 48 | fprintf('L attribut %s est mal configuré sur le BPM: %s, %d au lieu de %d \n', ... |
---|
| 49 | result.dev_replies(i).attr_values(j).attr_name, ... |
---|
| 50 | result.dev_replies(i).dev_name, ... |
---|
| 51 | result.dev_replies(i).attr_values(j).value(1), ... |
---|
| 52 | nominal_values_array{j}); |
---|
| 53 | |
---|
| 54 | if isequal(attr_list(j),{'MCPLLStatus'}) |
---|
| 55 | MC_not_locked=MC_not_locked+1; |
---|
| 56 | else if isequal(attr_list(j),{'HasMAFSupport'}) |
---|
| 57 | MAF_installed=MAF_installed+1; |
---|
| 58 | else |
---|
| 59 | erreurs=erreurs+1; |
---|
| 60 | end |
---|
| 61 | end |
---|
| 62 | end |
---|
| 63 | end |
---|
| 64 | end |
---|
| 65 | if erreurs==0 & MAF_installed==0 & MC_not_locked==0 |
---|
| 66 | fprintf('Les Libéras sont bien configurés\n'); |
---|
| 67 | else |
---|
| 68 | if erreurs~=0 |
---|
| 69 | fprintf('%d attributs sont mal configurés \n',erreurs); |
---|
| 70 | reply = input('voulez-vous appliquer la configuration nominale? Y/N [Y]: ', 's'); |
---|
| 71 | if isempty(reply) |
---|
| 72 | reply = 'Y'; |
---|
| 73 | end |
---|
| 74 | if reply == 'Y' |
---|
| 75 | for j=1:1:size(attr_list,2)-2 |
---|
| 76 | tango_group_write_attribute2(bpms_group,attr_list{j},nominal_values_array{j}); |
---|
| 77 | end |
---|
| 78 | end |
---|
| 79 | end |
---|
| 80 | if MC_not_locked~=0 |
---|
| 81 | fprintf('%d Libéras ne recoivent pas la Machine Clock \n',MC_not_locked); |
---|
| 82 | end |
---|
| 83 | if MAF_installed~=0 |
---|
| 84 | fprintf('%d Libéras ont le filtre MAF installé ce n est pas compatible avec les runs utilisateurs \n',MC_not_locked); |
---|
| 85 | end |
---|
| 86 | |
---|
| 87 | end |
---|
| 88 | %tango_group_kill(bpms_group) |
---|
| 89 | |
---|