1 | function createcylecurvefull(varargin); |
---|
2 | % INPUTS |
---|
3 | %1. Family |
---|
4 | |
---|
5 | DisplayFlag = 1; |
---|
6 | |
---|
7 | % Parse input options |
---|
8 | InputFlags = {}; |
---|
9 | for 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 |
---|
17 | end |
---|
18 | |
---|
19 | %% Load Golden Magnet parameters |
---|
20 | |
---|
21 | FileName = getfamilydata('OpsData', 'LatticeFile'); |
---|
22 | DirectoryName = getfamilydata('Directory', 'OpsData'); |
---|
23 | cnf=load([DirectoryName FileName]); |
---|
24 | %% Setpoints values |
---|
25 | Setpoint = cnf.ConfigSetpoint; |
---|
26 | |
---|
27 | Family = varargin{1}; |
---|
28 | |
---|
29 | [FamilyIndex, AO] = isfamily(Family); |
---|
30 | if isempty(FamilyIndex) |
---|
31 | error('Unknown Family'); |
---|
32 | end |
---|
33 | |
---|
34 | % create cycling family name |
---|
35 | CycleFamily = ['Cycle' Family]; |
---|
36 | [CycleIndex, CycleAO] = isfamily(CycleFamily); |
---|
37 | |
---|
38 | %% Family switchyard |
---|
39 | Inom = Setpoint.(Family).Data; |
---|
40 | if (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 |
---|
60 | else |
---|
61 | error('Unknown Cycling Family') |
---|
62 | end |
---|
63 | |
---|
64 | end |
---|
65 | |
---|
66 | function curve = makecurve(Inom,Imax,MagnetType) |
---|
67 | |
---|
68 | switch 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] ]; |
---|
78 | end |
---|
79 | end |
---|
80 | |
---|