source: MML/trunk/machine/SOLEIL/common/cycling/createcyclecurvefull.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 2.0 KB
Line 
1function createcylecurvefull(varargin);
2% INPUTS
3%1. Family
4
5DisplayFlag = 1;
6
7% Parse input options
8InputFlags = {};
9for i = length(varargin):-1:1
10    if strcmpi(varargin{i},'Display')
11        DisplayFlag = 1;
12        varargin(i) = [];
13    elseif strcmpi(varargin{i},'NoDisplay')
14        DisplayFlag = 0;
15        varargin(i) = [];
16    end
17end
18
19%% Load Golden Magnet parameters
20
21FileName = getfamilydata('OpsData', 'LatticeFile');
22DirectoryName = getfamilydata('Directory', 'OpsData');
23cnf=load([DirectoryName FileName]);
24%% Setpoints values
25Setpoint = cnf.ConfigSetpoint;
26
27Family = varargin{1};
28
29[FamilyIndex, AO] = isfamily(Family);
30if isempty(FamilyIndex)
31    error('Unknown Family');
32end
33
34% create cycling family name
35CycleFamily = ['Cycle' Family];
36[CycleIndex, CycleAO] = isfamily(CycleFamily);
37
38%% Family switchyard
39Inom = Setpoint.(Family).Data;
40if (ismemberof(CycleFamily,'Cyclage'))
41     for k = 1:tango_group_size(CycleAO.GroupId)
42        %% PAS BEAU --  utiliser le mml pour etre sur de la correspondance
43        CycleAO.Inom(k) = cnf.ConfigSetpoint.(Family).Data(k);
44        %% create cycling curve
45        curve = makecurve(CycleAO.Inom(k),CycleAO.Imax(k),Family)
46        %% upload cycling curve
47        if DisplayFlag
48            fprintf(1,'device : Inom = %f Imax= %f \n', ...
49                CycleAO.Inom(k), CycleAO.Imax(k));
50            plotcyclecurve(curve);
51        end
52        reply = input('Apply to Dserver new cycling curve ? (y/n)','s');
53        switch lower(reply)
54            case {'Y','Yes'}
55                setcyclecurve(CycleFamily,curve);
56            otherwise
57                disp('Parameter not set to dserver')
58        end
59    end
60else
61    error('Unknown Cycling Family')
62end
63
64end
65
66function curve = makecurve(Inom,Imax,MagnetType)
67
68switch MagnetType
69    case {'BEND','QP','CH','CV'}
70        curve = [[0 10]
71            [Imax 180]
72            [0.95*Inom 180]
73            [1.05*Inom 180]
74            [0.95*Inom 180]
75            [1.05*Inom 180]
76            [0.95*Inom 180]
77            [Inom 180] ];
78end
79end
80
Note: See TracBrowser for help on using the repository browser.