Commit 831856fb authored by Simone Liuzzo's avatar Simone Liuzzo
Browse files

response in m/rad, introduced calibration of kickers

parent 2cb36d42
......@@ -13,6 +13,12 @@ classdef InjBumpClosure < RingControl %& GridScan
attr_K3
attr_K4
calibK1
calibK2
calibK3
calibK4
calibbump
ModelRM
end
......@@ -37,12 +43,21 @@ classdef InjBumpClosure < RingControl %& GridScan
case 'esrf-sr'
attr_bump = 'sr/ps-bump/inj/Amplitude';
attr_K1 = 'sr/ps-k1/1/Current';
attr_K2 = 'sr/ps-k1/1/Current';
attr_K3 = 'sr/ps-k1/1/Current';
attr_K4 = 'sr/ps-k1/1/Current';
obj.attr_bump = 'sr/ps-bump/inj/Amplitude';
obj.attr_K1 = 'sr/ps-k1/1/Current';
obj.attr_K2 = 'sr/ps-k1/1/Current';
obj.attr_K3 = 'sr/ps-k1/1/Current';
obj.attr_K4 = 'sr/ps-k1/1/Current';
obj.calibK1 = obj.kick(5,1)/1775 ;% [rad]/A
obj.calibK2 = obj.kick(5,2)/1518 ;% [rad]/A
obj.calibK3 = obj.kick(5,3)/1512 ;% [rad]/A
obj.calibK4 = obj.kick(5,4)/1769 ;% [rad]/A
obj.calibbump = 1e-3; %
b = load('/users/beamdyn/dev/commissioningtools/@InjBumpClosure/InjBumpESRF-SR_RM.mat');
obj.ModelRM = b.ModelRM;
otherwise
error('only esrf-sr allowed')
......
......@@ -41,7 +41,7 @@ if ~simulator
deltak = 1e-4; % rad
deltabump = 1e-3;
else
deltak = 100; % A
deltak = 1e-4; % A
deltabump = 1e-3; % m
end
......@@ -59,7 +59,7 @@ ModelRM.TrajBump{1} = [];
ik = 1;
s = tango.Attribute(obj.K1);
s0 = s.value; % initial value
s.set = s0 + deltak;
s.set = s0 + deltak./obj.calibK1;
pause(waitPStime);
......@@ -75,7 +75,7 @@ rmv(:,ik) = (t(2,:) - t0(2,:))./deltak;
ik = 2;
s = tango.Attribute(obj.K2);
s0 = s.value; % initial value
s.set = s0 + deltak;
s.set = s0 + deltak./obj.calibK2;
pause(waitPStime);
......@@ -92,7 +92,7 @@ rmv(:,ik) = (t(2,:) - t0(2,:))./deltak;
ik = 3;
s = tango.Attribute(obj.K3);
s0 = s.value; % initial value
s.set = s0 + deltak;
s.set = s0 + deltak./obj.calibK3;
pause(waitPStime);
......@@ -107,7 +107,7 @@ rmv(:,ik) = (t(2,:) - t0(2,:))./deltak;
ik = 4;
s = tango.Attribute(obj.K4);
s0 = s.value; % initial value
s.set = s0 + deltak;
s.set = s0 + deltak./obj.calibK4;
pause(waitPStime);
......@@ -129,7 +129,7 @@ obj.ModelRM = ModelRM; %temporary store of ModelRM
s = tango.Attribute(obj.bump);
s0 = s.value; % initial value
s.set = s0 + deltabump;
s.set = s0 + deltabump./obj.calibbump;
pause(waitPStime);
......@@ -137,8 +137,8 @@ t = obj.measuretrajectory;
s.set = s0 ;
rmh(:,ik) = (t(1,:) - t0(1,:))./deltak; % m/rad
rmv(:,ik) = (t(2,:) - t0(2,:))./deltak;
rmh(:,ik) = (t(1,:) - t0(1,:))./deltabump; % m/mm
rmv(:,ik) = (t(2,:) - t0(2,:))./deltabump;
ModelRM.TrajBump{1} = rmh;
......
......@@ -328,11 +328,14 @@ while ~stopped
disp('H PLANE');
end
% get initial corrector values
K0 = [k1.set;k2.set;k3.set;k4.set;];
bump0 = bump.set;
% get initial corrector values (rad)
K0 = [k1.set*obj.calibK1;...
k2.set*obj.calibK2;...
k3.set*obj.calibK3;....
k4.set*obj.calibK4;];
bump0 = bump.set*obj.calibbump;
% restrict RM to usable correctors
RespH=[RMK(usebpm,:);RMbump(usebpm,:)];
......@@ -410,11 +413,12 @@ while ~stopped
disp(dch);
disp('CORRECTION UNSET')
% k1.set = dch(1);
% k2.set = dch(2);
% k3.set = dch(3);
% k4.set = dch(4);
% bump.set = dch(5);
% disp('set correction in A');
% k1.set = dch(1)./obj.calibK1;
% k2.set = dch(2)./obj.calibK2;
% k3.set = dch(3)./obj.calibK3;
% k4.set = dch(4)./obj.calibK4;
% bump.set = dch(5)./obj.calibbump;
if printouttext
disp('correcting trajectory'); end
......@@ -722,8 +726,8 @@ selbpm = true(1,length(indBPM)*obj.nturns);
if length(selbpm)<=size(obj.ModelRM.TrajK{1},1)
RMK = obj.ModelRM.TrajK{1}(selbpm,:);
RMbump = obj.ModelRM.TrajBPM{1}(selbpm,:);
RMK = obj.ModelRM.TrajK{1}(selbpm,:); % m/rad
RMbump = obj.ModelRM.TrajBPM{1}(selbpm,:); % m/mm
else
warning(['RM too small.'...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment