From 145e93a99a80b9e935ccb65d22ae0ef5d8a37cb6 Mon Sep 17 00:00:00 2001 From: Eugene Tan Date: Fri, 12 Oct 2018 13:45:34 +1100 Subject: [PATCH] updated and added files related to Australian Synchrotron (ASP) --- machine/ASP/StorageRing/amp2k.m | 180 +- machine/ASP/StorageRing/aoinit.m | 46 +- machine/ASP/StorageRing/aspinfo.m | 76 +- machine/ASP/StorageRing/aspinit.m | 3321 +++++++-------- machine/ASP/StorageRing/aspinitRF.m | 3504 ++++++++-------- machine/ASP/StorageRing/aspinit_20061204.m | 3552 ++++++++--------- machine/ASP/StorageRing/aspinit_v5skeleton.m | 2668 ++++++------- machine/ASP/StorageRing/assr4.m | 78 +- machine/ASP/StorageRing/assr4_disp.m | 71 +- machine/ASP/StorageRing/assr4_id.m | 150 +- machine/ASP/StorageRing/assr4_modbend.m | 242 ++ machine/ASP/StorageRing/assr4_splitbends.m | 192 +- .../ASP/StorageRing/assr4_splitbends.m.bak | 258 ++ .../ASP/StorageRing/assr4_splitbends_kent.m | 490 +++ .../ASP/StorageRing/assr4_splitbends_mod.m | 386 ++ .../StorageRing/assr4_splitbends_sourcedip.m | 297 ++ machine/ASP/StorageRing/assr4_wiggler.m | 3 +- machine/ASP/StorageRing/atsummary.m | 151 - machine/ASP/StorageRing/bend2gev.m | 462 +-- .../archivedoffsets/archivedoffsets.mat | Bin 0 -> 163491 bytes .../bpm_scripts/archivedoffsets/convertfile.m | 20 + .../bpm_scripts/booster/getliberatbt.m | 171 + .../bpm_scripts/booster/plotbrdata.m | 75 + .../bpm_scripts/booster/setbr01bpm12.m | 35 + .../bpm_scripts/booster/setliberaconfig.m | 444 +++ .../bpm_scripts/functionSignatures.json | 197 + .../bpm_scripts/generatefunctionSignatures.m | 66 + .../StorageRing/bpm_scripts/getbpmaverages.m | 32 + .../StorageRing/bpm_scripts/getliberadata.m | 161 + .../StorageRing/bpm_scripts/getliberafadata.m | 145 + machine/ASP/StorageRing/bpm_scripts/mytestf.m | 4 + .../new_EPICS_conversion/srbpm_v2.m | 760 ++++ machine/ASP/StorageRing/bpm_scripts/srbpm.m | 1536 +++++++ ...ra_brilliance_bpm_form_20180720_155855.txt | 108 + machine/ASP/StorageRing/changeaspoptics.m | 268 +- machine/ASP/StorageRing/contattem1.mat | Bin 3846 -> 0 bytes machine/ASP/StorageRing/energyscale.m | 50 +- machine/ASP/StorageRing/findcells.m | 114 +- machine/ASP/StorageRing/generate_hwinit.m | 394 +- machine/ASP/StorageRing/generate_init.m | 1004 ++--- machine/ASP/StorageRing/getemit.m | 162 +- machine/ASP/StorageRing/getkey.m | 124 +- machine/ASP/StorageRing/getquad.m | 47 +- machine/ASP/StorageRing/gev2bend.m | 440 +- machine/ASP/StorageRing/insertscw.m | 46 + machine/ASP/StorageRing/k2amp.m | 176 +- machine/ASP/StorageRing/lifetime.m | 328 +- .../StorageRing/linear_fit_remove_betabeat.m | 59 +- machine/ASP/StorageRing/magnetcoefficients.m | 445 ++- machine/ASP/StorageRing/meastune.m | 382 +- machine/ASP/StorageRing/measureoffsets.m | 181 + machine/ASP/StorageRing/opticalbpmanalyse.m | 100 - machine/ASP/StorageRing/orbitdrift.mat | Bin 2307 -> 0 bytes machine/ASP/StorageRing/orbitgui.m | 6 + machine/ASP/StorageRing/plotfamilystartup.m | 96 +- machine/ASP/StorageRing/plotturnorbit.m | 26 +- machine/ASP/StorageRing/quadcenter_all.m | 306 +- machine/ASP/StorageRing/quadcenter_eugene.m | 1025 +++++ machine/ASP/StorageRing/quadcenter_manual.m | 79 + .../quadcenter_manual_non_continuous.m | 48 + machine/ASP/StorageRing/quadcenterinit.m | 477 +-- machine/ASP/StorageRing/ramp_sext_down.m | 51 + machine/ASP/StorageRing/scalekickers.m | 46 +- machine/ASP/StorageRing/scraper_app.m | 249 +- machine/ASP/StorageRing/setchromaticity.m | 166 + machine/ASP/StorageRing/setchromaticity_et.m | 73 + machine/ASP/StorageRing/setinjectionbump.m | 29 +- machine/ASP/StorageRing/setinjkicks.m | 111 +- machine/ASP/StorageRing/setkicker.m | 91 +- machine/ASP/StorageRing/setlocodata.m | 819 ++-- machine/ASP/StorageRing/setmachineconfig.m | 253 ++ machine/ASP/StorageRing/setoperationalmode.m | 1167 ++++-- machine/ASP/StorageRing/setorbitdefault.m | 332 +- machine/ASP/StorageRing/setquad.m | 46 +- machine/ASP/StorageRing/sextcenter_manual.m | 46 + machine/ASP/StorageRing/snap.m | 146 +- machine/ASP/StorageRing/srcycle.m | 271 -- machine/ASP/StorageRing/srcycle_qda.m | 145 - machine/ASP/StorageRing/srcycle_qfa.m | 145 - machine/ASP/StorageRing/srcycle_qfb.m | 145 - machine/ASP/StorageRing/srcycle_quads.m | 211 - .../StorageRing/storagering_inject_store.m | 5 +- machine/ASP/StorageRing/track_tunes.m | 142 +- .../ASP/StorageRing/track_tunes_modified.m | 240 ++ machine/ASP/StorageRing/updateatindex.m | 244 +- mml/gotoat.m | 5 +- mml/setpathasp.m | 16 +- .../at1.4.1/atintegrators/mexpassmethod.m | 2 +- 88 files changed, 19940 insertions(+), 11520 deletions(-) create mode 100644 machine/ASP/StorageRing/assr4_modbend.m create mode 100644 machine/ASP/StorageRing/assr4_splitbends.m.bak create mode 100644 machine/ASP/StorageRing/assr4_splitbends_kent.m create mode 100644 machine/ASP/StorageRing/assr4_splitbends_mod.m create mode 100644 machine/ASP/StorageRing/assr4_splitbends_sourcedip.m delete mode 100644 machine/ASP/StorageRing/atsummary.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/archivedoffsets/archivedoffsets.mat create mode 100644 machine/ASP/StorageRing/bpm_scripts/archivedoffsets/convertfile.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/booster/getliberatbt.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/booster/plotbrdata.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/booster/setbr01bpm12.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/booster/setliberaconfig.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/functionSignatures.json create mode 100644 machine/ASP/StorageRing/bpm_scripts/generatefunctionSignatures.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/getbpmaverages.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/getliberadata.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/getliberafadata.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/mytestf.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/new_EPICS_conversion/srbpm_v2.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/srbpm.m create mode 100644 machine/ASP/StorageRing/bpm_scripts/tlibera_brilliance_bpm_form_20180720_155855.txt delete mode 100644 machine/ASP/StorageRing/contattem1.mat create mode 100644 machine/ASP/StorageRing/insertscw.m create mode 100644 machine/ASP/StorageRing/measureoffsets.m delete mode 100644 machine/ASP/StorageRing/opticalbpmanalyse.m delete mode 100644 machine/ASP/StorageRing/orbitdrift.mat create mode 100644 machine/ASP/StorageRing/orbitgui.m create mode 100644 machine/ASP/StorageRing/quadcenter_eugene.m create mode 100644 machine/ASP/StorageRing/quadcenter_manual.m create mode 100644 machine/ASP/StorageRing/quadcenter_manual_non_continuous.m create mode 100644 machine/ASP/StorageRing/ramp_sext_down.m create mode 100644 machine/ASP/StorageRing/setchromaticity.m create mode 100644 machine/ASP/StorageRing/setchromaticity_et.m create mode 100644 machine/ASP/StorageRing/setmachineconfig.m create mode 100644 machine/ASP/StorageRing/sextcenter_manual.m delete mode 100644 machine/ASP/StorageRing/srcycle.m delete mode 100644 machine/ASP/StorageRing/srcycle_qda.m delete mode 100644 machine/ASP/StorageRing/srcycle_qfa.m delete mode 100644 machine/ASP/StorageRing/srcycle_qfb.m delete mode 100644 machine/ASP/StorageRing/srcycle_quads.m create mode 100644 machine/ASP/StorageRing/track_tunes_modified.m diff --git a/machine/ASP/StorageRing/amp2k.m b/machine/ASP/StorageRing/amp2k.m index 39ab0a8c..5e305e7c 100644 --- a/machine/ASP/StorageRing/amp2k.m +++ b/machine/ASP/StorageRing/amp2k.m @@ -1,90 +1,90 @@ -function k = amp2k(Family, Field, Amps, DeviceList, Energy, C, K2AmpScaleFactor) -%AMP2K - Converts amperes to simulator values -% k = amp2k(Family, Field, Amps, DeviceList, Energy, Coefficients, K2AmpScaleFactor) -% or -% k = amp2k(Family, Field, Amps, DeviceList, Energy, MagnetCoreType, K2AmpScaleFactor) -% -% Calculates the "K-value" from the coefficients (or MagnetCoreType), -% current [amps], energy, and linear scale factor -% -% For dipole: k = B / Brho -% For quadrupole: k = B'/ Brho -% For sextupole: k = B"/ Brho / 2 (to be compatible with AT) -% -% A curve vector or a MagnetCoreType string (current curves found from -% magnetcoefficents.m) can be used. Amps and Coefficients must have equal -% number of rows or one must only have one row. -% -% Energy can be anything getenergy accepts, like 'Model' or 'Online'. -% -% The K2AmpScaleFactor linearly scales the input current: Amps = Amps ./ K2AmpScaleFactor -% This can be used to account for linear calibration errors of the power supply and magnet -% -% NOTES -% 1. If energy is not an input or empty, then the energy is obtained from getenergy. -% 2. Family and Field inputs are not used but there automatically part of the hw2physics call. -% -% Original structure set up using polynomials by M. Yoon 4/8/03 -% Modified for ASP by E. Tan 31/05/2006 - -if nargin < 4 - error('At least 4 inputs required'); -end - -if nargin < 6 - C = []; -end -if isempty(C) - %[C, Leff, MagnetName] = magnetcoefficients(Family); - temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList); - C = temp{1}; -end - -if nargin < 5 - Energy = []; -end -if isempty(Energy) - Energy = getenergy; -elseif ischar(Energy) - Energy = getenergy(Energy); -end - - -% If Amps is a row vector make it a column vector -Amps = Amps(:); - -brho = getbrho(Energy); - -% Scale solution if required -if nargin >= 7 - Amps = Amps ./ K2AmpScaleFactor; -end - - - -if isstr(C) - [C, Leff, MagnetName] = magnetcoefficients(C); -end - -if any(size(C,1) ~= length(Amps)) - if length(Amps) == 1 - Amps = ones(size(C,1),1) * Amps; - elseif size(C,1) == 1 - %C = ones(size(Amps,1),1) * C; - else - error('Amps and Coefficients must have equal number of rows or one must only have one row'); - end -end - -% B, B', or B" scaled by energy. Applies to all other magnets other than -% the dipoles. The curve C is arranged such that the first half of the row -% vector contains the current data and the second half contains the B, B' -% and/or B" as a function of the current data. -splitind = size(C,2)/2; -for i = 1:length(Amps) - if size(C,1) == 1 - k(i,1) = interp1(C(1,1:splitind),C(1,splitind+1:end),Amps(i),'linear','extrap') / brho; - else - k(i,1) = interp1(C(i,1:splitind),C(i,splitind+1:end),Amps(i),'linear','extrap') / brho; - end -end +function k = amp2k(Family, Field, Amps, DeviceList, Energy, C, K2AmpScaleFactor) +%AMP2K - Converts amperes to simulator values +% k = amp2k(Family, Field, Amps, DeviceList, Energy, Coefficients, K2AmpScaleFactor) +% or +% k = amp2k(Family, Field, Amps, DeviceList, Energy, MagnetCoreType, K2AmpScaleFactor) +% +% Calculates the "K-value" from the coefficients (or MagnetCoreType), +% current [amps], energy, and linear scale factor +% +% For dipole: k = B / Brho +% For quadrupole: k = B'/ Brho +% For sextupole: k = B"/ Brho / 2 (to be compatible with AT) +% +% A curve vector or a MagnetCoreType string (current curves found from +% magnetcoefficents.m) can be used. Amps and Coefficients must have equal +% number of rows or one must only have one row. +% +% Energy can be anything getenergy accepts, like 'Model' or 'Online'. +% +% The K2AmpScaleFactor linearly scales the input current: Amps = Amps ./ K2AmpScaleFactor +% This can be used to account for linear calibration errors of the power supply and magnet +% +% NOTES +% 1. If energy is not an input or empty, then the energy is obtained from getenergy. +% 2. Family and Field inputs are not used but there automatically part of the hw2physics call. +% +% Original structure set up using polynomials by M. Yoon 4/8/03 +% Modified for ASP by E. Tan 31/05/2006 + +if nargin < 4 + error('At least 4 inputs required'); +end + +if nargin < 6 + C = []; +end +if isempty(C) + %[C, Leff, MagnetName] = magnetcoefficients(Family); + temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList); + C = temp{1}; +end + +if nargin < 5 + Energy = []; +end +if isempty(Energy) + Energy = getenergy; +elseif ischar(Energy) + Energy = getenergy(Energy); +end + + +% If Amps is a row vector make it a column vector +Amps = Amps(:); + +brho = getbrho(Energy); + +% Scale solution if required +if nargin >= 7 + Amps = Amps ./ K2AmpScaleFactor; +end + + + +if isstr(C) + [C, Leff, MagnetName] = magnetcoefficients(C); +end + +if any(size(C,1) ~= length(Amps)) + if length(Amps) == 1 + Amps = ones(size(C,1),1) * Amps; + elseif size(C,1) == 1 + %C = ones(size(Amps,1),1) * C; + else + error('Amps and Coefficients must have equal number of rows or one must only have one row'); + end +end + +% B, B', or B" scaled by energy. Applies to all other magnets other than +% the dipoles. The curve C is arranged such that the first half of the row +% vector contains the current data and the second half contains the B, B' +% and/or B" as a function of the current data. +splitind = size(C,2)/2; +for i = 1:length(Amps) + if size(C,1) == 1 + k(i,1) = interp1(C(1,1:splitind),C(1,splitind+1:end),Amps(i),'linear','extrap') / brho; + else + k(i,1) = interp1(C(i,1:splitind),C(i,splitind+1:end),Amps(i),'linear','extrap') / brho; + end +end diff --git a/machine/ASP/StorageRing/aoinit.m b/machine/ASP/StorageRing/aoinit.m index 774d5255..08c6b224 100644 --- a/machine/ASP/StorageRing/aoinit.m +++ b/machine/ASP/StorageRing/aoinit.m @@ -2,7 +2,10 @@ function aoinit(SubMachineName) %AOINIT - Initialization function for the Matlab Middle Layer (MML) -% The path does not needs to be set in Standalone mode +% The path does not needs to be set in Standalone mode. Standalone +% applications must not call addpath. If it needs to call external +% functions/libraries that may not be directly called within the files it +% needs to be "linked" when compiling. if ~isdeployed_local MMLROOT = getmmlroot; @@ -15,15 +18,15 @@ function aoinit(SubMachineName) %end % mca (since some people use mca directly) - %addpath(fullfile(MMLROOT, 'links', 'mca_asp')); + addpath(fullfile(MMLROOT, 'online', 'mca', 'mca_asp')); % orbit - addpath(fullfile(MMLROOT, 'applications', 'orbit'), '-begin'); - addpath(fullfile(MMLROOT, 'applications', 'orbit', 'asp'), '-begin'); - addpath(fullfile(MMLROOT, 'applications', 'orbit', 'lib'), '-begin'); +% addpath(fullfile(MMLROOT, 'applications', 'orbit'), '-begin'); +% addpath(fullfile(MMLROOT, 'applications', 'orbit', 'asp'), '-begin'); +% addpath(fullfile(MMLROOT, 'applications', 'orbit', 'lib'), '-begin'); % SOFB - %addpath(fullfile(MMLROOT, 'applications', 'SOFB'), '-begin'); +% addpath(fullfile(MMLROOT, 'applications', 'SOFB'), '-begin'); % Add magnet_calibration_curves addpath(fullfile(MMLROOT, 'machine', 'ASP', 'StorageRing', 'magnet_calibration_curves'),'-begin'); @@ -32,32 +35,27 @@ function aoinit(SubMachineName) addpath(fullfile(MMLROOT, 'machine', 'ASP', 'StorageRing', 'magnetcycling'),'-begin'); % BPM scripts - %addpath(fullfile(MMLROOT, 'machine', 'ASP', 'StorageRing', 'bpm_scripts'),'-begin'); + addpath(fullfile(MMLROOT, 'machine', 'ASP', 'StorageRing', 'bpm_scripts'),'-begin'); % Add measurements directory - %dirs = {'beamsize','betas','emittance','iccd','ltb','screens','stability','streakcamera','tunes'}; - %for i=1:length(dirs) - % addpath(fullfile([filesep 'asp'],'usr','measurements',dirs{i}),'-begin'); - %end +% dirs = {'beamsize','betas','emittance','iccd','ltb','screens','stability','streakcamera','tunes'}; +% for i=1:length(dirs) +% addpath(fullfile([filesep 'asp'],'usr','measurements',dirs{i}),'-begin'); +% end % Make ASP first on the path addpath(fullfile(MMLROOT, 'machine', 'ASP', 'StorageRing'),'-begin'); end - % Initialize aspinit; - - - - -function RunTimeFlag = isdeployed_local -% isdeployed is not in matlab 6.5 -V = version; -if str2num(V(1,1)) < 7 - RunTimeFlag = 0; -else - RunTimeFlag = isdeployed; -end + function RunTimeFlag = isdeployed_local + % isdeployed is not in matlab 6.5 + V = version; + if str2num(V(1,1)) < 7 + RunTimeFlag = 0; + else + RunTimeFlag = isdeployed; + end \ No newline at end of file diff --git a/machine/ASP/StorageRing/aspinfo.m b/machine/ASP/StorageRing/aspinfo.m index 093ec6cd..084f8116 100644 --- a/machine/ASP/StorageRing/aspinfo.m +++ b/machine/ASP/StorageRing/aspinfo.m @@ -1,38 +1,38 @@ -function alsinfo -%ASPINFO - Prints hypertext for useful websites and commands to the command window -% -% Written by Greg Portmann - -fprintf('\n Useful Documents\n'); - -fprintf(' Matlab Middle Layer (MML) Manual ', [getmmlroot, 'mml',filesep,'docs',filesep,'MatlabMiddleLayerManual.htm']); -fprintf(' Matlab Middle Layer (MML) Quick Reference\n', [getmmlroot, 'mml',filesep,'docs',filesep,'MiddleLayerQuickReference.htm']); - -fprintf(' Matlab Middle Layer (MML) Objects ', [getmmlroot, 'mml',filesep,'docs',filesep,'MiddleLayerObjects.htm']); -fprintf(' Matlab Middle Layer (MML) HTML Help\n', [getmmlroot, 'mml',filesep,'doc_html',filesep]); -fprintf(' Accelerator Toolbox (AT) HTML Help\n', [getmmlroot, 'at', filesep,'doc_html',filesep]); - -%fprintf('\n Useful Websites\n'); -%fprintf(' ASP Homepage '); - - -%fprintf(' ALS Week Performance Data'); -%fprintf(' ALS Data Access Facilities\n'); - -fprintf('\n Useful Commands\n'); -fprintf(' setpathmml - Sets the Matlab path for an accelerator (like ALS or Spear3)\n'); - -fprintf(' Possible ASP Middle Layers: Storage Ring, Booster, BTS, or , LTB\n' '); - -fprintf(' setoperationalmode - Change the operational mode (like 1.5 GeV or 1.9 GeV).\n'); -fprintf(' plotfamily - General purpose plotting and application launcher program\n'); -fprintf(' mmlviewer - View the MML setup variables as well as lattice files\n'); -fprintf(' setorbitgui - General SVD orbit correction application \n'); -fprintf(' setorbitbumpgui - Orbit bump application\n'); -fprintf(' Plot the Orbit w.r.t. the Golden Orbit Plot the Golden Orbit\n'); -fprintf(' Plot the Orbit w.r.t. the Offset Orbit Plot the Offset Orbit\n'); -fprintf(' Plot the BPM Response Matrix Plot the BPM Standard Deviations\n'); -fprintf(' Plot the Correctors Plot the Measured Dispersion Function\n'); -fprintf(' Online Mode Simulation Mode\n'); -fprintf(' Use All BPMs Bergoz Only BPMs\n'); -fprintf(' New Figure Window Close All Figure Windows\n'); +function alsinfo +%ASPINFO - Prints hypertext for useful websites and commands to the command window +% +% Written by Greg Portmann + +fprintf('\n Useful Documents\n'); + +fprintf(' Matlab Middle Layer (MML) Manual ', [getmmlroot, 'mml',filesep,'docs',filesep,'MatlabMiddleLayerManual.htm']); +fprintf(' Matlab Middle Layer (MML) Quick Reference\n', [getmmlroot, 'mml',filesep,'docs',filesep,'MiddleLayerQuickReference.htm']); + +fprintf(' Matlab Middle Layer (MML) Objects ', [getmmlroot, 'mml',filesep,'docs',filesep,'MiddleLayerObjects.htm']); +fprintf(' Matlab Middle Layer (MML) HTML Help\n', [getmmlroot, 'mml',filesep,'doc_html',filesep]); +fprintf(' Accelerator Toolbox (AT) HTML Help\n', [getmmlroot, 'at', filesep,'doc_html',filesep]); + +%fprintf('\n Useful Websites\n'); +%fprintf(' ASP Homepage '); + + +%fprintf(' ALS Week Performance Data'); +%fprintf(' ALS Data Access Facilities\n'); + +fprintf('\n Useful Commands\n'); +fprintf(' setpathmml - Sets the Matlab path for an accelerator (like ALS or Spear3)\n'); + +fprintf(' Possible ASP Middle Layers: Storage Ring, Booster, BTS, or , LTB\n' '); + +fprintf(' setoperationalmode - Change the operational mode (like 1.5 GeV or 1.9 GeV).\n'); +fprintf(' plotfamily - General purpose plotting and application launcher program\n'); +fprintf(' mmlviewer - View the MML setup variables as well as lattice files\n'); +fprintf(' setorbitgui - General SVD orbit correction application \n'); +fprintf(' setorbitbumpgui - Orbit bump application\n'); +fprintf(' Plot the Orbit w.r.t. the Golden Orbit Plot the Golden Orbit\n'); +fprintf(' Plot the Orbit w.r.t. the Offset Orbit Plot the Offset Orbit\n'); +fprintf(' Plot the BPM Response Matrix Plot the BPM Standard Deviations\n'); +fprintf(' Plot the Correctors Plot the Measured Dispersion Function\n'); +fprintf(' Online Mode Simulation Mode\n'); +fprintf(' Use All BPMs Bergoz Only BPMs\n'); +fprintf(' New Figure Window Close All Figure Windows\n'); diff --git a/machine/ASP/StorageRing/aspinit.m b/machine/ASP/StorageRing/aspinit.m index c9a6935b..2997cb4e 100644 --- a/machine/ASP/StorageRing/aspinit.m +++ b/machine/ASP/StorageRing/aspinit.m @@ -1,1582 +1,1739 @@ -function aspinit(OperationalMode) -% aspinit(OperationalMode) -% -% Initialize parameters for ASP control in MATLAB -% -%========================== -% Accelerator Family Fields -%========================== -% FamilyName BPMx, HCM, etc -% CommonNames Shortcut name for each element (optional) -% DeviceList [Sector, Number] -% ElementList number in list -% Position m, magnet center -% -% MONITOR FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units Physics or HW -% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% -% SETPOINT FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units hardware or physics -% HW2PhysicsFcn function handle used to convert from hardware to physics units -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% Range minsetpoint, maxsetpoint; -% Tolerance setpoint-monitor -% -%============================================= -% Accelerator Toolbox Simulation Fields -%============================================= -% ATType Quad, Sext, etc -% ATIndex index in THERING -% ATParameterGroup parameter group -% -%============ -% Family List -%============ -% BPMx BPMy - beam position monitors -% HCM VCM - corrector magnets wound into sextupoles -% BEND - gradient dipoles -% QFA QDA QFB - quadrupole magnets -% SFA SDA SDB SFB - sextupole magnets -% SQK - skew quads wound into SDA magnets -% KICK - injection kickers (DELTA type) -% RF - 4 cavities (KEK type?) -% DCCT -% Septum (Not in model yet) -% -% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 -% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 - -% === Change Log === -% Mark Boland 2004-02-12 -% Eugene Tan 2004-02-23 -% Eugene Tan 2004-12-13 -% Eugene Tan 2005-09-27 ver 4 -% Updated naming convention of the process variables, use version 4 of -% the lattice "assr4.m" where the correctors have been merged into the -% sextupoles. Made the necessary changes to updateatindex. Added skew -% quadrupoles and updated generate_init. -% Mark Boland 2006-05-27 -% Changed the BPM PVs to ...:SA_X_MONITOR and ...:SA_Y_MONITOR -% -% Mark Boland 2006-08-29 -% Changed range on HCM and VCM from - to + since the polarity of the -% correctors was physically changed in the last weeks. -% -% === Still to do === -% - kicker delays -% - BPM names and other possible PVs of interest eg. Q factor etc. -% - clean up and configure the amp2k and k2amp conversion. Control system -% designed to calculate the strengths and amp values using calc records, -% therefore we should only need to change the PV name to access for -% readback at setpoints. Only problem will be in simulation/offline mode -% where those value are not available online. How do you keep the offline -% conversion factors up to date with online vals? -% -% === Generated from === -% aspinit_v5skeleton.m - - - -% When using the compiler add a line like, "%#function " for -% for special functions that hidden in strings. - - -% Default operational mode -if nargin < 1 - OperationalMode = 1; -end - - -%============================================= -% START DEFINITION OF ACCELERATOR OBJECTS -%============================================= -fprintf(' Defining the Accelerator Objects. Objects being defined:\n') - - -% Clear previous AcceleratorObjects -setao([]); - - -Mode = 'Online'; % This gets reset in setoperationalmode - -%============================================= -%BPM data: status field designates if BPM in use -%============================================= -ntbpm=98; -AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); -AO.BPMx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMx'; 'Horizontal';}; -AO.BPMx.Monitor.Mode = Mode; -AO.BPMx.Monitor.DataType = 'Scalar'; -AO.BPMx.Monitor.Units = 'Hardware'; -AO.BPMx.Monitor.HWUnits = 'mm'; -AO.BPMx.Monitor.PhysicsUnits = 'meter'; - -AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); -AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMy'; 'Vertical';}; -AO.BPMy.Monitor.Mode = Mode; -AO.BPMy.Monitor.DataType = 'Scalar'; -AO.BPMy.Monitor.Units = 'Hardware'; -AO.BPMy.Monitor.HWUnits = 'mm'; -AO.BPMy.Monitor.PhysicsUnits = 'meter'; - -% x-name x-chname xstat y-name y-chname ystat DevList Elem -bpm={ -'1BPMx1 ' 'SR01BPM01:SA_X_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:SA_Y_MONITOR' 1 [1,1] 1 ; ... -'1BPMx2 ' 'SR01BPM02:SA_X_MONITOR' 1 '1BPMy2 ' 'SR01BPM02:SA_Y_MONITOR' 1 [1,2] 2 ; ... -'1BPMx3 ' 'SR01BPM03:SA_X_MONITOR' 1 '1BPMy3 ' 'SR01BPM03:SA_Y_MONITOR' 1 [1,3] 3 ; ... -'1BPMx4 ' 'SR01BPM04:SA_X_MONITOR' 1 '1BPMy4 ' 'SR01BPM04:SA_Y_MONITOR' 1 [1,4] 4 ; ... -'1BPMx5 ' 'SR01BPM05:SA_X_MONITOR' 1 '1BPMy5 ' 'SR01BPM05:SA_Y_MONITOR' 1 [1,5] 5 ; ... -'1BPMx6 ' 'SR01BPM06:SA_X_MONITOR' 1 '1BPMy6 ' 'SR01BPM06:SA_Y_MONITOR' 1 [1,6] 6 ; ... -'1BPMx7 ' 'SR01BPM07:SA_X_MONITOR' 1 '1BPMy7 ' 'SR01BPM07:SA_Y_MONITOR' 1 [1,7] 7 ; ... -'2BPMx1 ' 'SR02BPM01:SA_X_MONITOR' 1 '2BPMy1 ' 'SR02BPM01:SA_Y_MONITOR' 1 [2,1] 8 ; ... -'2BPMx2 ' 'SR02BPM02:SA_X_MONITOR' 1 '2BPMy2 ' 'SR02BPM02:SA_Y_MONITOR' 1 [2,2] 9 ; ... -'2BPMx3 ' 'SR02BPM03:SA_X_MONITOR' 1 '2BPMy3 ' 'SR02BPM03:SA_Y_MONITOR' 1 [2,3] 10 ; ... -'2BPMx4 ' 'SR02BPM04:SA_X_MONITOR' 1 '2BPMy4 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My5 ' 'SR09BPM05:SA_Y_MONITOR' 1 [9,5] 61 ; ... -'9BPMx6 ' 'SR09BPM06:SA_X_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:SA_Y_MONITOR' 1 [9,6] 62 ; ... -'9BPMx7 ' 'SR09BPM07:SA_X_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:SA_Y_MONITOR' 1 [9,7] 63 ; ... -'10BPMx1 ' 'SR10BPM01:SA_X_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:SA_Y_MONITOR' 1 [10,1] 64 ; ... -'10BPMx2 ' 'SR10BPM02:SA_X_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:SA_Y_MONITOR' 1 [10,2] 65 ; ... -'10BPMx3 ' 'SR10BPM03:SA_X_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:SA_Y_MONITOR' 1 [10,3] 66 ; ... -'10BPMx4 ' 'SR10BPM04:SA_X_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:SA_Y_MONITOR' 1 [10,4] 67 ; ... -'10BPMx5 ' 'SR10BPM05:SA_X_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:SA_Y_MONITOR' 1 [10,5] 68 ; ... -'10BPMx6 ' 'SR10BPM06:SA_X_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:SA_Y_MONITOR' 1 [10,6] 69 ; ... -'10BPMx7 ' 'SR10BPM07:SA_X_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:SA_Y_MONITOR' 1 [10,7] 70 ; ... -'11BPMx1 ' 'SR11BPM01:SA_X_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:SA_Y_MONITOR' 1 [11,1] 71 ; ... -'11BPMx2 ' 'SR11BPM02:SA_X_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:SA_Y_MONITOR' 1 [11,2] 72 ; ... -'11BPMx3 ' 'SR11BPM03:SA_X_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:SA_Y_MONITOR' 1 [11,3] 73 ; ... -'11BPMx4 ' 'SR11BPM04:SA_X_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:SA_Y_MONITOR' 1 [11,4] 74 ; ... -'11BPMx5 ' 'SR11BPM05:SA_X_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:SA_Y_MONITOR' 1 [11,5] 75 ; ... -'11BPMx6 ' 'SR11BPM06:SA_X_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:SA_Y_MONITOR' 1 [11,6] 76 ; ... -'11BPMx7 ' 'SR11BPM07:SA_X_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:SA_Y_MONITOR' 1 [11,7] 77 ; ... -'12BPMx1 ' 'SR12BPM01:SA_X_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:SA_Y_MONITOR' 1 [12,1] 78 ; ... -'12BPMx2 ' 'SR12BPM02:SA_X_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:SA_Y_MONITOR' 1 [12,2] 79 ; ... -'12BPMx3 ' 'SR12BPM03:SA_X_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:SA_Y_MONITOR' 1 [12,3] 80 ; ... -'12BPMx4 ' 'SR12BPM04:SA_X_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:SA_Y_MONITOR' 1 [12,4] 81 ; ... -'12BPMx5 ' 'SR12BPM05:SA_X_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:SA_Y_MONITOR' 1 [12,5] 82 ; ... -'12BPMx6 ' 'SR12BPM06:SA_X_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:SA_Y_MONITOR' 1 [12,6] 83 ; ... -'12BPMx7 ' 'SR12BPM07:SA_X_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:SA_Y_MONITOR' 1 [12,7] 84 ; ... -'13BPMx1 ' 'SR13BPM01:SA_X_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:SA_Y_MONITOR' 1 [13,1] 85 ; ... -'13BPMx2 ' 'SR13BPM02:SA_X_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:SA_Y_MONITOR' 1 [13,2] 86 ; ... -'13BPMx3 ' 'SR13BPM03:SA_X_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:SA_Y_MONITOR' 1 [13,3] 87 ; ... -'13BPMx4 ' 'SR13BPM04:SA_X_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:SA_Y_MONITOR' 1 [13,4] 88 ; ... -'13BPMx5 ' 'SR13BPM05:SA_X_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:SA_Y_MONITOR' 1 [13,5] 89 ; ... -'13BPMx6 ' 'SR13BPM06:SA_X_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:SA_Y_MONITOR' 1 [13,6] 90 ; ... -'13BPMx7 ' 'SR13BPM07:SA_X_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:SA_Y_MONITOR' 1 [13,7] 91 ; ... -'14BPMx1 ' 'SR14BPM01:SA_X_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:SA_Y_MONITOR' 1 [14,1] 92 ; ... -'14BPMx2 ' 'SR14BPM02:SA_X_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:SA_Y_MONITOR' 1 [14,2] 93 ; ... -'14BPMx3 ' 'SR14BPM03:SA_X_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:SA_Y_MONITOR' 1 [14,3] 94 ; ... -'14BPMx4 ' 'SR14BPM04:SA_X_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:SA_Y_MONITOR' 1 [14,4] 95 ; ... -'14BPMx5 ' 'SR14BPM05:SA_X_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:SA_Y_MONITOR' 1 [14,5] 96 ; ... -'14BPMx6 ' 'SR14BPM06:SA_X_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:SA_Y_MONITOR' 1 [14,6] 97 ; ... -'14BPMx7 ' 'SR14BPM07:SA_X_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:SA_Y_MONITOR' 1 [14,7] 98 ; ... -}; - -%Load fields from data block -for ii=1:size(bpm,1) -name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; -name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; -name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; -name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; -val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; - AO.BPMy.DeviceList(ii,:) = val; -val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; - AO.BPMy.ElementList(ii,:) = val; - AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1e+3; - AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1e+3; -end - - -% % Get sum value from button. Don't need handles and PV namelist as -% % parameters are the same as the 'monitor' subcategory. -% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; -% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; -% AO.BPMx.Sum.HWUnits = 'ADC Counts'; -% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; -% AO.BPMx.Sum.HW2PhysicsParams = 1; -% AO.BPMx.Sum.Physics2HWParams = 1; -% % Get q value from BPMs. Don't need handles and PV namelist. -% AO.BPMx.Q = AO.BPMx.Monitor; -% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; -% AO.BPMx.Q.HWUnits = 'mm'; -% AO.BPMx.Q.PhysicsUnits = 'meter'; -% AO.BPMx.Q.HW2PhysicsParams = 1e-3; -% AO.BPMx.Q.Physics2HWParams = 1000; -% -% % Definition above for horiz0ontal. Replicate for vertical. -% AO.BPMy.Sum = AO.BPMx.Sum; -% AO.BPMy.Q = AO.BPMx.Q; - -%=========================================================== -% Corrector data: status field designates if corrector in use -% ASP corrector coils wound into sextupoles. Not dynamic correctors. -%=========================================================== - -AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); -AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'; 'Horizontal'}; - -AO.HCM.Monitor.Mode = Mode; -AO.HCM.Monitor.DataType = 'Scalar'; -AO.HCM.Monitor.Units = 'Hardware'; -AO.HCM.Monitor.HWUnits = 'ampere'; -AO.HCM.Monitor.PhysicsUnits = 'radian'; -AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.HCM.Monitor.Physics2HWFcn = @k2amp; - -AO.HCM.Setpoint.Mode = Mode; -AO.HCM.Setpoint.DataType = 'Scalar'; -AO.HCM.Setpoint.Units = 'Hardware'; -AO.HCM.Setpoint.HWUnits = 'ampere'; -AO.HCM.Setpoint.PhysicsUnits = 'radian'; -AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.HCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian. Respmat settings below AO definitions. -% x-common x-monitor x-setpoint stat devlist elem tol -cor={ -'1HCM1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:CURRENT_SP ' 1 [1,1] 1 0.2 ; ... -'1HCM2 ' 'SR01CPS05:CURRENT_MONITOR' 'SR01CPS05:CURRENT_SP ' 1 [1,2] 2 0.2 ; ... -'1HCM3 ' 'SR01CPS09:CURRENT_MONITOR' 'SR01CPS09:CURRENT_SP ' 1 [1,3] 3 0.2 ; ... -'2HCM1 ' 'SR02CPS01:CURRENT_MONITOR' 'SR02CPS01:CURRENT_SP ' 1 [2,1] 4 0.2 ; ... -'2HCM2 ' 'SR02CPS05:CURRENT_MONITOR' 'SR02CPS05:CURRENT_SP ' 1 [2,2] 5 0.2 ; ... -'2HCM3 ' 'SR02CPS09:CURRENT_MONITOR' 'SR02CPS09:CURRENT_SP ' 1 [2,3] 6 0.2 ; ... -'3HCM1 ' 'SR03CPS01:CURRENT_MONITOR' 'SR03CPS01:CURRENT_SP ' 1 [3,1] 7 0.2 ; ... -'3HCM2 ' 'SR03CPS05:CURRENT_MONITOR' 'SR03CPS05:CURRENT_SP ' 1 [3,2] 8 0.2 ; ... -'3HCM3 ' 'SR03CPS09:CURRENT_MONITOR' 'SR03CPS09:CURRENT_SP ' 1 [3,3] 9 0.2 ; ... -'4HCM1 ' 'SR04CPS01:CURRENT_MONITOR' 'SR04CPS01:CURRENT_SP ' 1 [4,1] 10 0.2 ; ... -'4HCM2 ' 'SR04CPS05:CURRENT_MONITOR' 'SR04CPS05:CURRENT_SP ' 1 [4,2] 11 0.2 ; ... -'4HCM3 ' 'SR04CPS09:CURRENT_MONITOR' 'SR04CPS09:CURRENT_SP ' 1 [4,3] 12 0.2 ; ... -'5HCM1 ' 'SR05CPS01:CURRENT_MONITOR' 'SR05CPS01:CURRENT_SP ' 1 [5,1] 13 0.2 ; ... -'5HCM2 ' 'SR05CPS05:CURRENT_MONITOR' 'SR05CPS05:CURRENT_SP ' 1 [5,2] 14 0.2 ; ... -'5HCM3 ' 'SR05CPS09:CURRENT_MONITOR' 'SR05CPS09:CURRENT_SP ' 1 [5,3] 15 0.2 ; ... -'6HCM1 ' 'SR06CPS01:CURRENT_MONITOR' 'SR06CPS01:CURRENT_SP ' 1 [6,1] 16 0.2 ; ... -'6HCM2 ' 'SR06CPS05:CURRENT_MONITOR' 'SR06CPS05:CURRENT_SP ' 1 [6,2] 17 0.2 ; ... -'6HCM3 ' 'SR06CPS09:CURRENT_MONITOR' 'SR06CPS09:CURRENT_SP ' 1 [6,3] 18 0.2 ; ... -'7HCM1 ' 'SR07CPS01:CURRENT_MONITOR' 'SR07CPS01:CURRENT_SP ' 1 [7,1] 19 0.2 ; ... -'7HCM2 ' 'SR07CPS05:CURRENT_MONITOR' 'SR07CPS05:CURRENT_SP ' 1 [7,2] 20 0.2 ; ... -'7HCM3 ' 'SR07CPS09:CURRENT_MONITOR' 'SR07CPS09:CURRENT_SP ' 1 [7,3] 21 0.2 ; ... -'8HCM1 ' 'SR08CPS01:CURRENT_MONITOR' 'SR08CPS01:CURRENT_SP ' 1 [8,1] 22 0.2 ; ... -'8HCM2 ' 'SR08CPS05:CURRENT_MONITOR' 'SR08CPS05:CURRENT_SP ' 1 [8,2] 23 0.2 ; ... -'8HCM3 ' 'SR08CPS09:CURRENT_MONITOR' 'SR08CPS09:CURRENT_SP ' 1 [8,3] 24 0.2 ; ... -'9HCM1 ' 'SR09CPS01:CURRENT_MONITOR' 'SR09CPS01:CURRENT_SP ' 1 [9,1] 25 0.2 ; ... -'9HCM2 ' 'SR09CPS05:CURRENT_MONITOR' 'SR09CPS05:CURRENT_SP ' 1 [9,2] 26 0.2 ; ... -'9HCM3 ' 'SR09CPS09:CURRENT_MONITOR' 'SR09CPS09:CURRENT_SP ' 1 [9,3] 27 0.2 ; ... -'10HCM1 ' 'SR10CPS01:CURRENT_MONITOR' 'SR10CPS01:CURRENT_SP ' 1 [10,1] 28 0.2 ; ... -'10HCM2 ' 'SR10CPS05:CURRENT_MONITOR' 'SR10CPS05:CURRENT_SP ' 1 [10,2] 29 0.2 ; ... -'10HCM3 ' 'SR10CPS09:CURRENT_MONITOR' 'SR10CPS09:CURRENT_SP ' 1 [10,3] 30 0.2 ; ... -'11HCM1 ' 'SR11CPS01:CURRENT_MONITOR' 'SR11CPS01:CURRENT_SP ' 1 [11,1] 31 0.2 ; ... -'11HCM2 ' 'SR11CPS05:CURRENT_MONITOR' 'SR11CPS05:CURRENT_SP ' 1 [11,2] 32 0.2 ; ... -'11HCM3 ' 'SR11CPS09:CURRENT_MONITOR' 'SR11CPS09:CURRENT_SP ' 1 [11,3] 33 0.2 ; ... -'12HCM1 ' 'SR12CPS01:CURRENT_MONITOR' 'SR12CPS01:CURRENT_SP ' 1 [12,1] 34 0.2 ; ... -'12HCM2 ' 'SR12CPS05:CURRENT_MONITOR' 'SR12CPS05:CURRENT_SP ' 1 [12,2] 35 0.2 ; ... -'12HCM3 ' 'SR12CPS09:CURRENT_MONITOR' 'SR12CPS09:CURRENT_SP ' 1 [12,3] 36 0.2 ; ... -'13HCM1 ' 'SR13CPS01:CURRENT_MONITOR' 'SR13CPS01:CURRENT_SP ' 1 [13,1] 37 0.2 ; ... -'13HCM2 ' 'SR13CPS05:CURRENT_MONITOR' 'SR13CPS05:CURRENT_SP ' 1 [13,2] 38 0.2 ; ... -'13HCM3 ' 'SR13CPS09:CURRENT_MONITOR' 'SR13CPS09:CURRENT_SP ' 1 [13,3] 39 0.2 ; ... -'14HCM1 ' 'SR14CPS01:CURRENT_MONITOR' 'SR14CPS01:CURRENT_SP ' 1 [14,1] 40 0.2 ; ... -'14HCM2 ' 'SR14CPS05:CURRENT_MONITOR' 'SR14CPS05:CURRENT_SP ' 1 [14,2] 41 0.2 ; ... -'14HCM3 ' 'SR14CPS09:CURRENT_MONITOR' 'SR14CPS09:CURRENT_SP ' 1 [14,3] 42 0.2 ; ... -}; - -[C, Leff, MagnetType] = magnetcoefficients('HCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.HCM.Status(ii,1) = val; -val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; - -AO.HCM.Setpoint.Range(ii,:) = [-90 +90]; -AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); -AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'; 'Vertical'}; - -AO.VCM.Monitor.Mode = Mode; -AO.VCM.Monitor.DataType = 'Scalar'; -AO.VCM.Monitor.Units = 'Hardware'; -AO.VCM.Monitor.HWUnits = 'ampere'; -AO.VCM.Monitor.PhysicsUnits = 'radian'; -AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.VCM.Monitor.Physics2HWFcn = @k2amp; - -AO.VCM.Setpoint.Mode = Mode; -AO.VCM.Setpoint.DataType = 'Scalar'; -AO.VCM.Setpoint.Units = 'Hardware'; -AO.VCM.Setpoint.HWUnits = 'ampere'; -AO.VCM.Setpoint.PhysicsUnits = 'radian'; -AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.VCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian ** radian units converted to ampere below *** -% y-common y-monitor y-setpoint stat devlist elem -cor={ -'1VCM1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:CURRENT_SP ' 1 [1,1] 1 0.2 ; ... -'1VCM2 ' 'SR01CPS04:CURRENT_MONITOR' 'SR01CPS04:CURRENT_SP ' 1 [1,2] 2 0.2 ; ... -'1VCM3 ' 'SR01CPS06:CURRENT_MONITOR' 'SR01CPS06:CURRENT_SP ' 1 [1,3] 3 0.2 ; ... -'1VCM4 ' 'SR01CPS07:CURRENT_MONITOR' 'SR01CPS07:CURRENT_SP ' 1 [1,4] 4 0.2 ; ... -'2VCM1 ' 'SR02CPS02:CURRENT_MONITOR' 'SR02CPS02:CURRENT_SP ' 1 [2,1] 5 0.2 ; ... -'2VCM2 ' 'SR02CPS04:CURRENT_MONITOR' 'SR02CPS04:CURRENT_SP ' 1 [2,2] 6 0.2 ; ... -'2VCM3 ' 'SR02CPS06:CURRENT_MONITOR' 'SR02CPS06:CURRENT_SP ' 1 [2,3] 7 0.2 ; ... -'2VCM4 ' 'SR02CPS07:CURRENT_MONITOR' 'SR02CPS07:CURRENT_SP ' 1 [2,4] 8 0.2 ; ... -'3VCM1 ' 'SR03CPS02:CURRENT_MONITOR' 'SR03CPS02:CURRENT_SP ' 1 [3,1] 9 0.2 ; ... -'3VCM2 ' 'SR03CPS04:CURRENT_MONITOR' 'SR03CPS04:CURRENT_SP ' 1 [3,2] 10 0.2 ; ... -'3VCM3 ' 'SR03CPS06:CURRENT_MONITOR' 'SR03CPS06:CURRENT_SP ' 1 [3,3] 11 0.2 ; ... -'3VCM4 ' 'SR03CPS07:CURRENT_MONITOR' 'SR03CPS07:CURRENT_SP ' 1 [3,4] 12 0.2 ; ... -'4VCM1 ' 'SR04CPS02:CURRENT_MONITOR' 'SR04CPS02:CURRENT_SP ' 1 [4,1] 13 0.2 ; ... -'4VCM2 ' 'SR04CPS04:CURRENT_MONITOR' 'SR04CPS04:CURRENT_SP ' 1 [4,2] 14 0.2 ; ... -'4VCM3 ' 'SR04CPS06:CURRENT_MONITOR' 'SR04CPS06:CURRENT_SP ' 1 [4,3] 15 0.2 ; ... -'4VCM4 ' 'SR04CPS07:CURRENT_MONITOR' 'SR04CPS07:CURRENT_SP ' 1 [4,4] 16 0.2 ; ... -'5VCM1 ' 'SR05CPS02:CURRENT_MONITOR' 'SR05CPS02:CURRENT_SP ' 1 [5,1] 17 0.2 ; ... -'5VCM2 ' 'SR05CPS04:CURRENT_MONITOR' 'SR05CPS04:CURRENT_SP ' 1 [5,2] 18 0.2 ; ... -'5VCM3 ' 'SR05CPS06:CURRENT_MONITOR' 'SR05CPS06:CURRENT_SP ' 1 [5,3] 19 0.2 ; ... -'5VCM4 ' 'SR05CPS07:CURRENT_MONITOR' 'SR05CPS07:CURRENT_SP ' 1 [5,4] 20 0.2 ; ... -'6VCM1 ' 'SR06CPS02:CURRENT_MONITOR' 'SR06CPS02:CURRENT_SP ' 1 [6,1] 21 0.2 ; ... -'6VCM2 ' 'SR06CPS04:CURRENT_MONITOR' 'SR06CPS04:CURRENT_SP ' 1 [6,2] 22 0.2 ; ... -'6VCM3 ' 'SR06CPS06:CURRENT_MONITOR' 'SR06CPS06:CURRENT_SP ' 1 [6,3] 23 0.2 ; ... -'6VCM4 ' 'SR06CPS07:CURRENT_MONITOR' 'SR06CPS07:CURRENT_SP ' 1 [6,4] 24 0.2 ; ... -'7VCM1 ' 'SR07CPS02:CURRENT_MONITOR' 'SR07CPS02:CURRENT_SP ' 1 [7,1] 25 0.2 ; ... -'7VCM2 ' 'SR07CPS04:CURRENT_MONITOR' 'SR07CPS04:CURRENT_SP ' 1 [7,2] 26 0.2 ; ... -'7VCM3 ' 'SR07CPS06:CURRENT_MONITOR' 'SR07CPS06:CURRENT_SP ' 1 [7,3] 27 0.2 ; ... -'7VCM4 ' 'SR07CPS07:CURRENT_MONITOR' 'SR07CPS07:CURRENT_SP ' 1 [7,4] 28 0.2 ; ... -'8VCM1 ' 'SR08CPS02:CURRENT_MONITOR' 'SR08CPS02:CURRENT_SP ' 1 [8,1] 29 0.2 ; ... -'8VCM2 ' 'SR08CPS04:CURRENT_MONITOR' 'SR08CPS04:CURRENT_SP ' 1 [8,2] 30 0.2 ; ... -'8VCM3 ' 'SR08CPS06:CURRENT_MONITOR' 'SR08CPS06:CURRENT_SP ' 1 [8,3] 31 0.2 ; ... -'8VCM4 ' 'SR08CPS07:CURRENT_MONITOR' 'SR08CPS07:CURRENT_SP ' 1 [8,4] 32 0.2 ; ... -'9VCM1 ' 'SR09CPS02:CURRENT_MONITOR' 'SR09CPS02:CURRENT_SP ' 1 [9,1] 33 0.2 ; ... -'9VCM2 ' 'SR09CPS04:CURRENT_MONITOR' 'SR09CPS04:CURRENT_SP ' 1 [9,2] 34 0.2 ; ... -'9VCM3 ' 'SR09CPS06:CURRENT_MONITOR' 'SR09CPS06:CURRENT_SP ' 1 [9,3] 35 0.2 ; ... -'9VCM4 ' 'SR09CPS07:CURRENT_MONITOR' 'SR09CPS07:CURRENT_SP ' 1 [9,4] 36 0.2 ; ... -'10VCM1 ' 'SR10CPS02:CURRENT_MONITOR' 'SR10CPS02:CURRENT_SP ' 1 [10,1] 37 0.2 ; ... -'10VCM2 ' 'SR10CPS04:CURRENT_MONITOR' 'SR10CPS04:CURRENT_SP ' 1 [10,2] 38 0.2 ; ... -'10VCM3 ' 'SR10CPS06:CURRENT_MONITOR' 'SR10CPS06:CURRENT_SP ' 1 [10,3] 39 0.2 ; ... -'10VCM4 ' 'SR10CPS07:CURRENT_MONITOR' 'SR10CPS07:CURRENT_SP ' 1 [10,4] 40 0.2 ; ... -'11VCM1 ' 'SR11CPS02:CURRENT_MONITOR' 'SR11CPS02:CURRENT_SP ' 1 [11,1] 41 0.2 ; ... -'11VCM2 ' 'SR11CPS04:CURRENT_MONITOR' 'SR11CPS04:CURRENT_SP ' 1 [11,2] 42 0.2 ; ... -'11VCM3 ' 'SR11CPS06:CURRENT_MONITOR' 'SR11CPS06:CURRENT_SP ' 1 [11,3] 43 0.2 ; ... -'11VCM4 ' 'SR11CPS07:CURRENT_MONITOR' 'SR11CPS07:CURRENT_SP ' 1 [11,4] 44 0.2 ; ... -'12VCM1 ' 'SR12CPS02:CURRENT_MONITOR' 'SR12CPS02:CURRENT_SP ' 1 [12,1] 45 0.2 ; ... -'12VCM2 ' 'SR12CPS04:CURRENT_MONITOR' 'SR12CPS04:CURRENT_SP ' 1 [12,2] 46 0.2 ; ... -'12VCM3 ' 'SR12CPS06:CURRENT_MONITOR' 'SR12CPS06:CURRENT_SP ' 1 [12,3] 47 0.2 ; ... -'12VCM4 ' 'SR12CPS07:CURRENT_MONITOR' 'SR12CPS07:CURRENT_SP ' 1 [12,4] 48 0.2 ; ... -'13VCM1 ' 'SR13CPS02:CURRENT_MONITOR' 'SR13CPS02:CURRENT_SP ' 1 [13,1] 49 0.2 ; ... -'13VCM2 ' 'SR13CPS04:CURRENT_MONITOR' 'SR13CPS04:CURRENT_SP ' 1 [13,2] 50 0.2 ; ... -'13VCM3 ' 'SR13CPS06:CURRENT_MONITOR' 'SR13CPS06:CURRENT_SP ' 1 [13,3] 51 0.2 ; ... -'13VCM4 ' 'SR13CPS07:CURRENT_MONITOR' 'SR13CPS07:CURRENT_SP ' 1 [13,4] 52 0.2 ; ... -'14VCM1 ' 'SR14CPS02:CURRENT_MONITOR' 'SR14CPS02:CURRENT_SP ' 1 [14,1] 53 0.2 ; ... -'14VCM2 ' 'SR14CPS04:CURRENT_MONITOR' 'SR14CPS04:CURRENT_SP ' 1 [14,2] 54 0.2 ; ... -'14VCM3 ' 'SR14CPS06:CURRENT_MONITOR' 'SR14CPS06:CURRENT_SP ' 1 [14,3] 55 0.2 ; ... -'14VCM4 ' 'SR14CPS07:CURRENT_MONITOR' 'SR14CPS07:CURRENT_SP ' 1 [14,4] 56 0.3 ; ... -}; - -[C, Leff, MagnetType] = magnetcoefficients('VCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.VCM.Status(ii,1) = val; -val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; - -AO.VCM.Setpoint.Range(ii,:) = [-125 +125]; -AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -%============================= -% MAIN MAGNETS -%============================= - -%=========== -%Dipole data -%=========== - -% *** BEND *** -AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); -AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('BEND'); -Physics2HWParams = magnetcoefficients('BEND'); - -AO.BEND.Monitor.Mode = Mode; -AO.BEND.Monitor.DataType = 'Scalar'; -AO.BEND.Monitor.Units = 'Hardware'; -AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? -AO.BEND.Monitor.Physics2HWFcn = @gev2bend; -AO.BEND.Monitor.HWUnits = 'ampere'; -AO.BEND.Monitor.PhysicsUnits = 'energy'; - -AO.BEND.Setpoint.Mode = Mode; -AO.BEND.Setpoint.DataType = 'Scalar'; -AO.BEND.Setpoint.Units = 'Hardware'; -AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; -AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; -AO.BEND.Setpoint.HWUnits = 'ampere'; -AO.BEND.Setpoint.PhysicsUnits = 'energy'; - -% common monitor setpoint stat devlist elem scale tol -bend={ -'1BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... -'3BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(bend,1) -name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; -name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; -name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; -val =bend{ii,4}; AO.BEND.Status(ii,1) = val; -val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; -val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; -val =bend{ii,7}; % This is the scale factor -AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; - -AO.BEND.Setpoint.Range(ii,:) = [50 695]; -end - -%=============== -%Quadrupole data -%=============== - -% *** QFA *** -AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); -AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFA'); -Physics2HWParams = magnetcoefficients('QFA'); - -AO.QFA.Monitor.Mode = Mode; -AO.QFA.Monitor.DataType = 'Scalar'; -AO.QFA.Monitor.Units = 'Hardware'; -AO.QFA.Monitor.HWUnits = 'ampere'; -AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFA.Monitor.Physics2HWFcn = @k2amp; - -AO.QFA.Setpoint.Mode = Mode; -AO.QFA.Setpoint.DataType = 'Scalar'; -AO.QFA.Setpoint.Units = 'Hardware'; -AO.QFA.Setpoint.HWUnits = 'ampere'; -AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qfa={ -'1QFA1 ' 'SR01QPS01:CURRENT_MONITOR' 'SR01QPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1QFA2 ' 'SR01QPS06:CURRENT_MONITOR' 'SR01QPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2QFA1 ' 'SR02QPS01:CURRENT_MONITOR' 'SR02QPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2QFA2 ' 'SR02QPS06:CURRENT_MONITOR' 'SR02QPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... -'3QFA1 ' 'SR03QPS01:CURRENT_MONITOR' 'SR03QPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3QFA2 ' 'SR03QPS06:CURRENT_MONITOR' 'SR03QPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4QFA1 ' 'SR04QPS01:CURRENT_MONITOR' 'SR04QPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4QFA2 ' 'SR04QPS06:CURRENT_MONITOR' 'SR04QPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5QFA1 ' 'SR05QPS01:CURRENT_MONITOR' 'SR05QPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5QFA2 ' 'SR05QPS06:CURRENT_MONITOR' 'SR05QPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6QFA1 ' 'SR06QPS01:CURRENT_MONITOR' 'SR06QPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6QFA2 ' 'SR06QPS06:CURRENT_MONITOR' 'SR06QPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7QFA1 ' 'SR07QPS01:CURRENT_MONITOR' 'SR07QPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7QFA2 ' 'SR07QPS06:CURRENT_MONITOR' 'SR07QPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8QFA1 ' 'SR08QPS01:CURRENT_MONITOR' 'SR08QPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8QFA2 ' 'SR08QPS06:CURRENT_MONITOR' 'SR08QPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9QFA1 ' 'SR09QPS01:CURRENT_MONITOR' 'SR09QPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9QFA2 ' 'SR09QPS06:CURRENT_MONITOR' 'SR09QPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10QFA1 ' 'SR10QPS01:CURRENT_MONITOR' 'SR10QPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10QFA2 ' 'SR10QPS06:CURRENT_MONITOR' 'SR10QPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11QFA1 ' 'SR11QPS01:CURRENT_MONITOR' 'SR11QPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11QFA2 ' 'SR11QPS06:CURRENT_MONITOR' 'SR11QPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12QFA1 ' 'SR12QPS01:CURRENT_MONITOR' 'SR12QPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12QFA2 ' 'SR12QPS06:CURRENT_MONITOR' 'SR12QPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13QFA1 ' 'SR13QPS01:CURRENT_MONITOR' 'SR13QPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13QFA2 ' 'SR13QPS06:CURRENT_MONITOR' 'SR13QPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14QFA1 ' 'SR14QPS01:CURRENT_MONITOR' 'SR14QPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14QFA2 ' 'SR14QPS06:CURRENT_MONITOR' 'SR14QPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(qfa,1) -name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; -name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; -name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; -val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; -val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; -val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; -val =qfa{ii,7}; % This is the scale factor -AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; - -% Important! This determines the cycling range -AO.QFA.Setpoint.Range(ii,:) = [0 160]; -end - - -% *** QDA *** -AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); -AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; -HW2PhysicsParams = magnetcoefficients('QDA'); -Physics2HWParams = magnetcoefficients('QDA'); - -AO.QDA.Monitor.Mode = Mode; -AO.QDA.Monitor.DataType = 'Scalar'; -AO.QDA.Monitor.Units = 'Hardware'; -AO.QDA.Monitor.HWUnits = 'ampere'; -AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QDA.Monitor.Physics2HWFcn = @k2amp; - -AO.QDA.Setpoint.Mode = Mode; -AO.QDA.Setpoint.DataType = 'Scalar'; -AO.QDA.Setpoint.Units = 'Hardware'; -AO.QDA.Setpoint.HWUnits = 'ampere'; -AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QDA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qda={ -'1QDA1 ' 'SR01QPS02:CURRENT_MONITOR' 'SR01QPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.15 ; ... -'1QDA2 ' 'SR01QPS05:CURRENT_MONITOR' 'SR01QPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.15 ; ... -'2QDA1 ' 'SR02QPS02:CURRENT_MONITOR' 'SR02QPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.15 ; ... -'2QDA2 ' 'SR02QPS05:CURRENT_MONITOR' 'SR02QPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.15 ; ... -'3QDA1 ' 'SR03QPS02:CURRENT_MONITOR' 'SR03QPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.15 ; ... -'3QDA2 ' 'SR03QPS05:CURRENT_MONITOR' 'SR03QPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.15 ; ... -'4QDA1 ' 'SR04QPS02:CURRENT_MONITOR' 'SR04QPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.15 ; ... -'4QDA2 ' 'SR04QPS05:CURRENT_MONITOR' 'SR04QPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.15 ; ... -'5QDA1 ' 'SR05QPS02:CURRENT_MONITOR' 'SR05QPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.15 ; ... -'5QDA2 ' 'SR05QPS05:CURRENT_MONITOR' 'SR05QPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.15 ; ... -'6QDA1 ' 'SR06QPS02:CURRENT_MONITOR' 'SR06QPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.15 ; ... -'6QDA2 ' 'SR06QPS05:CURRENT_MONITOR' 'SR06QPS05:CURRENT_SP ' 1 [6,2] 12 1.0 1.00 ; ... -'7QDA1 ' 'SR07QPS02:CURRENT_MONITOR' 'SR07QPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.15 ; ... -'7QDA2 ' 'SR07QPS05:CURRENT_MONITOR' 'SR07QPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.15 ; ... -'8QDA1 ' 'SR08QPS02:CURRENT_MONITOR' 'SR08QPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.15 ; ... -'8QDA2 ' 'SR08QPS05:CURRENT_MONITOR' 'SR08QPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.15 ; ... -'9QDA1 ' 'SR09QPS02:CURRENT_MONITOR' 'SR09QPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.15 ; ... -'9QDA2 ' 'SR09QPS05:CURRENT_MONITOR' 'SR09QPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.15 ; ... -'10QDA1 ' 'SR10QPS02:CURRENT_MONITOR' 'SR10QPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.15 ; ... -'10QDA2 ' 'SR10QPS05:CURRENT_MONITOR' 'SR10QPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.15 ; ... -'11QDA1 ' 'SR11QPS02:CURRENT_MONITOR' 'SR11QPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.15 ; ... -'11QDA2 ' 'SR11QPS05:CURRENT_MONITOR' 'SR11QPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.15 ; ... -'12QDA1 ' 'SR12QPS02:CURRENT_MONITOR' 'SR12QPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.15 ; ... -'12QDA2 ' 'SR12QPS05:CURRENT_MONITOR' 'SR12QPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.15 ; ... -'13QDA1 ' 'SR13QPS02:CURRENT_MONITOR' 'SR13QPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.15 ; ... -'13QDA2 ' 'SR13QPS05:CURRENT_MONITOR' 'SR13QPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.15 ; ... -'14QDA1 ' 'SR14QPS02:CURRENT_MONITOR' 'SR14QPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.15 ; ... -'14QDA2 ' 'SR14QPS05:CURRENT_MONITOR' 'SR14QPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.15 ; ... -}; - -for ii=1:size(qda,1) -name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; -name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; -name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; -val =qda{ii,4}; AO.QDA.Status(ii,1) = val; -val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; -val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; -val =qda{ii,7}; % This is the scale factor -AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; - -% Important! This determines the cycling range -AO.QDA.Setpoint.Range(ii,:) = [0 90]; -end - - - -% *** QFB *** -AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); -AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFB'); -Physics2HWParams = magnetcoefficients('QFB'); - -AO.QFB.Monitor.Mode = Mode; -AO.QFB.Monitor.DataType = 'Scalar'; -AO.QFB.Monitor.Units = 'Hardware'; -AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFB.Monitor.Physics2HWFcn = @k2amp; -AO.QFB.Monitor.HWUnits = 'ampere'; -AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; - -AO.QFB.Setpoint.Mode = Mode; -AO.QFB.Setpoint.DataType = 'Scalar'; -AO.QFB.Setpoint.Units = 'Hardware'; -AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFB.Setpoint.Physics2HWFcn = @k2amp; -AO.QFB.Setpoint.HWUnits = 'ampere'; -AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -qfb={ -'1QFB1 ' 'SR01QPS03:CURRENT_MONITOR' 'SR01QPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.25 ; ... -'1QFB2 ' 'SR01QPS04:CURRENT_MONITOR' 'SR01QPS04:CURRENT_SP ' 1 [1,2] 2 1.0 0.25 ; ... -'2QFB1 ' 'SR02QPS03:CURRENT_MONITOR' 'SR02QPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.25 ; ... -'2QFB2 ' 'SR02QPS04:CURRENT_MONITOR' 'SR02QPS04:CURRENT_SP ' 1 [2,2] 4 1.0 0.25 ; ... -'3QFB1 ' 'SR03QPS03:CURRENT_MONITOR' 'SR03QPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.25 ; ... -'3QFB2 ' 'SR03QPS04:CURRENT_MONITOR' 'SR03QPS04:CURRENT_SP ' 1 [3,2] 6 1.0 0.25 ; ... -'4QFB1 ' 'SR04QPS03:CURRENT_MONITOR' 'SR04QPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.25 ; ... -'4QFB2 ' 'SR04QPS04:CURRENT_MONITOR' 'SR04QPS04:CURRENT_SP ' 1 [4,2] 8 1.0 0.25 ; ... -'5QFB1 ' 'SR05QPS03:CURRENT_MONITOR' 'SR05QPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.25 ; ... -'5QFB2 ' 'SR05QPS04:CURRENT_MONITOR' 'SR05QPS04:CURRENT_SP ' 1 [5,2] 10 1.0 0.25 ; ... -'6QFB1 ' 'SR06QPS03:CURRENT_MONITOR' 'SR06QPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.25 ; ... -'6QFB2 ' 'SR06QPS04:CURRENT_MONITOR' 'SR06QPS04:CURRENT_SP ' 1 [6,2] 12 1.0 0.25 ; ... -'7QFB1 ' 'SR07QPS03:CURRENT_MONITOR' 'SR07QPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.25 ; ... -'7QFB2 ' 'SR07QPS04:CURRENT_MONITOR' 'SR07QPS04:CURRENT_SP ' 1 [7,2] 14 1.0 0.25 ; ... -'8QFB1 ' 'SR08QPS03:CURRENT_MONITOR' 'SR08QPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.25 ; ... -'8QFB2 ' 'SR08QPS04:CURRENT_MONITOR' 'SR08QPS04:CURRENT_SP ' 1 [8,2] 16 1.0 0.25 ; ... -'9QFB1 ' 'SR09QPS03:CURRENT_MONITOR' 'SR09QPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.25 ; ... -'9QFB2 ' 'SR09QPS04:CURRENT_MONITOR' 'SR09QPS04:CURRENT_SP ' 1 [9,2] 18 1.0 0.25 ; ... -'10QFB1 ' 'SR10QPS03:CURRENT_MONITOR' 'SR10QPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.25 ; ... -'10QFB2 ' 'SR10QPS04:CURRENT_MONITOR' 'SR10QPS04:CURRENT_SP ' 1 [10,2] 20 1.0 0.25 ; ... -'11QFB1 ' 'SR11QPS03:CURRENT_MONITOR' 'SR11QPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.25 ; ... -'11QFB2 ' 'SR11QPS04:CURRENT_MONITOR' 'SR11QPS04:CURRENT_SP ' 1 [11,2] 22 1.0 0.25 ; ... -'12QFB1 ' 'SR12QPS03:CURRENT_MONITOR' 'SR12QPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.25 ; ... -'12QFB2 ' 'SR12QPS04:CURRENT_MONITOR' 'SR12QPS04:CURRENT_SP ' 1 [12,2] 24 1.0 0.25 ; ... -'13QFB1 ' 'SR13QPS03:CURRENT_MONITOR' 'SR13QPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.25 ; ... -'13QFB2 ' 'SR13QPS04:CURRENT_MONITOR' 'SR13QPS04:CURRENT_SP ' 1 [13,2] 26 1.0 0.25 ; ... -'14QFB1 ' 'SR14QPS03:CURRENT_MONITOR' 'SR14QPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.25 ; ... -'14QFB2 ' 'SR14QPS04:CURRENT_MONITOR' 'SR14QPS04:CURRENT_SP ' 1 [14,2] 28 1.0 0.25 ; ... -}; - -for ii=1:size(qfb,1) -name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; -name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; -name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; -val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; -val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; -val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; -val =qfb{ii,7}; % This is the scale factor -AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; - -% Important! This determines the cycling range -AO.QFB.Setpoint.Range(ii,:) = [0 160]; -end - - -%=============== -%Sextupole data -%=============== -% *** SFA *** -AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); -AO.SFA.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFA'); -Physics2HWParams = magnetcoefficients('SFA'); - -AO.SFA.Monitor.Mode = Mode; -AO.SFA.Monitor.DataType = 'Scalar'; -AO.SFA.Monitor.Units = 'Hardware'; -AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFA.Monitor.Physics2HWFcn = @k2amp; -AO.SFA.Monitor.HWUnits = 'ampere'; -AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFA.Setpoint.Mode = Mode; -AO.SFA.Setpoint.DataType = 'Scalar'; -AO.SFA.Setpoint.Units = 'Hardware'; -AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFA.Setpoint.Physics2HWFcn = @k2amp; -AO.SFA.Setpoint.HWUnits = 'ampere'; -AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfa={ -'1SFA1 ' 'SR01SPS01:CURRENT_MONITOR' 'SR01SPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.15 ; ... -'1SFA2 ' 'SR01SPS07:CURRENT_MONITOR' 'SR01SPS07:CURRENT_SP ' 1 [1,2] 2 1.0 0.15 ; ... -'2SFA1 ' 'SR02SPS01:CURRENT_MONITOR' 'SR02SPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.15 ; ... -'2SFA2 ' 'SR02SPS07:CURRENT_MONITOR' 'SR02SPS07:CURRENT_SP ' 1 [2,2] 4 1.0 0.15 ; ... -'3SFA1 ' 'SR03SPS01:CURRENT_MONITOR' 'SR03SPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.15 ; ... -'3SFA2 ' 'SR03SPS07:CURRENT_MONITOR' 'SR03SPS07:CURRENT_SP ' 1 [3,2] 6 1.0 0.15 ; ... -'4SFA1 ' 'SR04SPS01:CURRENT_MONITOR' 'SR04SPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.15 ; ... -'4SFA2 ' 'SR04SPS07:CURRENT_MONITOR' 'SR04SPS07:CURRENT_SP ' 1 [4,2] 8 1.0 0.15 ; ... -'5SFA1 ' 'SR05SPS01:CURRENT_MONITOR' 'SR05SPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.15 ; ... -'5SFA2 ' 'SR05SPS07:CURRENT_MONITOR' 'SR05SPS07:CURRENT_SP ' 1 [5,2] 10 1.0 0.15 ; ... -'6SFA1 ' 'SR06SPS01:CURRENT_MONITOR' 'SR06SPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.15 ; ... -'6SFA2 ' 'SR06SPS07:CURRENT_MONITOR' 'SR06SPS07:CURRENT_SP ' 1 [6,2] 12 1.0 0.15 ; ... -'7SFA1 ' 'SR07SPS01:CURRENT_MONITOR' 'SR07SPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.15 ; ... -'7SFA2 ' 'SR07SPS07:CURRENT_MONITOR' 'SR07SPS07:CURRENT_SP ' 1 [7,2] 14 1.0 0.15 ; ... -'8SFA1 ' 'SR08SPS01:CURRENT_MONITOR' 'SR08SPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.15 ; ... -'8SFA2 ' 'SR08SPS07:CURRENT_MONITOR' 'SR08SPS07:CURRENT_SP ' 1 [8,2] 16 1.0 0.15 ; ... -'9SFA1 ' 'SR09SPS01:CURRENT_MONITOR' 'SR09SPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.15 ; ... -'9SFA2 ' 'SR09SPS07:CURRENT_MONITOR' 'SR09SPS07:CURRENT_SP ' 1 [9,2] 18 1.0 0.15 ; ... -'10SFA1 ' 'SR10SPS01:CURRENT_MONITOR' 'SR10SPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.15 ; ... -'10SFA2 ' 'SR10SPS07:CURRENT_MONITOR' 'SR10SPS07:CURRENT_SP ' 1 [10,2] 20 1.0 0.15 ; ... -'11SFA1 ' 'SR11SPS01:CURRENT_MONITOR' 'SR11SPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.15 ; ... -'11SFA2 ' 'SR11SPS07:CURRENT_MONITOR' 'SR11SPS07:CURRENT_SP ' 1 [11,2] 22 1.0 0.15 ; ... -'12SFA1 ' 'SR12SPS01:CURRENT_MONITOR' 'SR12SPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.15 ; ... -'12SFA2 ' 'SR12SPS07:CURRENT_MONITOR' 'SR12SPS07:CURRENT_SP ' 1 [12,2] 24 1.0 0.15 ; ... -'13SFA1 ' 'SR13SPS01:CURRENT_MONITOR' 'SR13SPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.15 ; ... -'13SFA2 ' 'SR13SPS07:CURRENT_MONITOR' 'SR13SPS07:CURRENT_SP ' 1 [13,2] 26 1.0 0.15 ; ... -'14SFA1 ' 'SR14SPS01:CURRENT_MONITOR' 'SR14SPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.15 ; ... -'14SFA2 ' 'SR14SPS07:CURRENT_MONITOR' 'SR14SPS07:CURRENT_SP ' 1 [14,2] 28 1.0 0.15 ; ... -}; - -for ii=1:size(sfa,1) -name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; -name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; -name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; -val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; -val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; -val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; -val =sfa{ii,7}; % This is the scale factor -AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; - -AO.SFA.Setpoint.Range(ii,:) = [0 90]; -end - - - -% *** SDA *** -AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); -AO.SDA.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'MachineConfig'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDA'); -Physics2HWParams = magnetcoefficients('SDA'); -AO.SDA.Monitor.Mode = Mode; -AO.SDA.Monitor.DataType = 'Scalar'; -AO.SDA.Monitor.Units = 'Hardware'; -AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDA.Monitor.Physics2HWFcn = @k2amp; -AO.SDA.Monitor.HWUnits = 'ampere'; -AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDA.Setpoint.Mode = Mode; -AO.SDA.Setpoint.DataType = 'Scalar'; -AO.SDA.Setpoint.Units = 'Hardware'; -AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDA.Setpoint.Physics2HWFcn = @k2amp; -AO.SDA.Setpoint.HWUnits = 'ampere'; -AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; - - -% common monitor setpoint stat devlist elem scale tol -sda={ -'1SDA1 ' 'SR01SPS02:CURRENT_MONITOR' 'SR01SPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... -'1SDA2 ' 'SR01SPS06:CURRENT_MONITOR' 'SR01SPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... -'2SDA1 ' 'SR02SPS02:CURRENT_MONITOR' 'SR02SPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... -'2SDA2 ' 'SR02SPS06:CURRENT_MONITOR' 'SR02SPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... -'3SDA1 ' 'SR03SPS02:CURRENT_MONITOR' 'SR03SPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... -'3SDA2 ' 'SR03SPS06:CURRENT_MONITOR' 'SR03SPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... -'4SDA1 ' 'SR04SPS02:CURRENT_MONITOR' 'SR04SPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... -'4SDA2 ' 'SR04SPS06:CURRENT_MONITOR' 'SR04SPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... -'5SDA1 ' 'SR05SPS02:CURRENT_MONITOR' 'SR05SPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... -'5SDA2 ' 'SR05SPS06:CURRENT_MONITOR' 'SR05SPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... -'6SDA1 ' 'SR06SPS02:CURRENT_MONITOR' 'SR06SPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... -'6SDA2 ' 'SR06SPS06:CURRENT_MONITOR' 'SR06SPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... -'7SDA1 ' 'SR07SPS02:CURRENT_MONITOR' 'SR07SPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... -'7SDA2 ' 'SR07SPS06:CURRENT_MONITOR' 'SR07SPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... -'8SDA1 ' 'SR08SPS02:CURRENT_MONITOR' 'SR08SPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... -'8SDA2 ' 'SR08SPS06:CURRENT_MONITOR' 'SR08SPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... -'9SDA1 ' 'SR09SPS02:CURRENT_MONITOR' 'SR09SPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... -'9SDA2 ' 'SR09SPS06:CURRENT_MONITOR' 'SR09SPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... -'10SDA1 ' 'SR10SPS02:CURRENT_MONITOR' 'SR10SPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... -'10SDA2 ' 'SR10SPS06:CURRENT_MONITOR' 'SR10SPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... -'11SDA1 ' 'SR11SPS02:CURRENT_MONITOR' 'SR11SPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... -'11SDA2 ' 'SR11SPS06:CURRENT_MONITOR' 'SR11SPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... -'12SDA1 ' 'SR12SPS02:CURRENT_MONITOR' 'SR12SPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... -'12SDA2 ' 'SR12SPS06:CURRENT_MONITOR' 'SR12SPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... -'13SDA1 ' 'SR13SPS02:CURRENT_MONITOR' 'SR13SPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... -'13SDA2 ' 'SR13SPS06:CURRENT_MONITOR' 'SR13SPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... -'14SDA1 ' 'SR14SPS02:CURRENT_MONITOR' 'SR14SPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... -'14SDA2 ' 'SR14SPS06:CURRENT_MONITOR' 'SR14SPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... -}; - -for ii=1:size(sda,1) -name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; -name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; -name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; -val =sda{ii,4}; AO.SDA.Status(ii,1) = val; -val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; -val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; -val =sda{ii,7}; % This is the scale factor -AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; - -AO.SDA.Setpoint.Range(ii,:) = [0 90]; -end - - -% *** SDB *** -AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); -AO.SDB.MemberOf = {'PlotFamily'; 'SD'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDB'); -Physics2HWParams = magnetcoefficients('SDB'); -AO.SDB.Monitor.Mode = Mode; -AO.SDB.Monitor.DataType = 'Scalar'; -AO.SDB.Monitor.Units = 'Hardware'; -AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDB.Monitor.Physics2HWFcn = @k2amp; -AO.SDB.Monitor.HWUnits = 'ampere'; -AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDB.Setpoint.Mode = Mode; -AO.SDB.Setpoint.DataType = 'Scalar'; -AO.SDB.Setpoint.Units = 'Hardware'; -AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDB.Setpoint.Physics2HWFcn = @k2amp; -AO.SDB.Setpoint.HWUnits = 'ampere'; -AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sdb={ -'1SDB1 ' 'SR01SPS03:CURRENT_MONITOR' 'SR01SPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... -'1SDB2 ' 'SR01SPS05:CURRENT_MONITOR' 'SR01SPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... -'2SDB1 ' 'SR02SPS03:CURRENT_MONITOR' 'SR02SPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... -'2SDB2 ' 'SR02SPS05:CURRENT_MONITOR' 'SR02SPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... -'3SDB1 ' 'SR03SPS03:CURRENT_MONITOR' 'SR03SPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... -'3SDB2 ' 'SR03SPS05:CURRENT_MONITOR' 'SR03SPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... -'4SDB1 ' 'SR04SPS03:CURRENT_MONITOR' 'SR04SPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... -'4SDB2 ' 'SR04SPS05:CURRENT_MONITOR' 'SR04SPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... -'5SDB1 ' 'SR05SPS03:CURRENT_MONITOR' 'SR05SPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... -'5SDB2 ' 'SR05SPS05:CURRENT_MONITOR' 'SR05SPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... -'6SDB1 ' 'SR06SPS03:CURRENT_MONITOR' 'SR06SPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... -'6SDB2 ' 'SR06SPS05:CURRENT_MONITOR' 'SR06SPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... -'7SDB1 ' 'SR07SPS03:CURRENT_MONITOR' 'SR07SPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... -'7SDB2 ' 'SR07SPS05:CURRENT_MONITOR' 'SR07SPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... -'8SDB1 ' 'SR08SPS03:CURRENT_MONITOR' 'SR08SPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... -'8SDB2 ' 'SR08SPS05:CURRENT_MONITOR' 'SR08SPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... -'9SDB1 ' 'SR09SPS03:CURRENT_MONITOR' 'SR09SPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... -'9SDB2 ' 'SR09SPS05:CURRENT_MONITOR' 'SR09SPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... -'10SDB1 ' 'SR10SPS03:CURRENT_MONITOR' 'SR10SPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... -'10SDB2 ' 'SR10SPS05:CURRENT_MONITOR' 'SR10SPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... -'11SDB1 ' 'SR11SPS03:CURRENT_MONITOR' 'SR11SPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... -'11SDB2 ' 'SR11SPS05:CURRENT_MONITOR' 'SR11SPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... -'12SDB1 ' 'SR12SPS03:CURRENT_MONITOR' 'SR12SPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... -'12SDB2 ' 'SR12SPS05:CURRENT_MONITOR' 'SR12SPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... -'13SDB1 ' 'SR13SPS03:CURRENT_MONITOR' 'SR13SPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... -'13SDB2 ' 'SR13SPS05:CURRENT_MONITOR' 'SR13SPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... -'14SDB1 ' 'SR14SPS03:CURRENT_MONITOR' 'SR14SPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... -'14SDB2 ' 'SR14SPS05:CURRENT_MONITOR' 'SR14SPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... -}; - -for ii=1:size(sdb,1) -name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; -name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; -name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; -val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; -val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; -val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; -val =sdb{ii,7}; % This is the scale factor -AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; - -AO.SDB.Setpoint.Range(ii,:) = [0 80]; -end - - - -% *** SFB *** -AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); -AO.SFB.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFB'); -Physics2HWParams = magnetcoefficients('SFB'); - -AO.SFB.Monitor.Mode = Mode; -AO.SFB.Monitor.DataType = 'Scalar'; -AO.SFB.Monitor.Units = 'Hardware'; -AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFB.Monitor.Physics2HWFcn = @k2amp; -AO.SFB.Monitor.HWUnits = 'ampere'; -AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFB.Setpoint.Mode = Mode; -AO.SFB.Setpoint.DataType = 'Scalar'; -AO.SFB.Setpoint.Units = 'Hardware'; -AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFB.Setpoint.Physics2HWFcn = @k2amp; -AO.SFB.Setpoint.HWUnits = 'ampere'; -AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfb={ -'1SFB1 ' 'SR01SPS04:CURRENT_MONITOR' 'SR01SPS04:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... -'2SFB1 ' 'SR02SPS04:CURRENT_MONITOR' 'SR02SPS04:CURRENT_SP ' 1 [2,1] 2 1.0 0.2 ; ... -'3SFB1 ' 'SR03SPS04:CURRENT_MONITOR' 'SR03SPS04:CURRENT_SP ' 1 [3,1] 3 1.0 0.2 ; ... -'4SFB1 ' 'SR04SPS04:CURRENT_MONITOR' 'SR04SPS04:CURRENT_SP ' 1 [4,1] 4 1.0 0.2 ; ... -'5SFB1 ' 'SR05SPS04:CURRENT_MONITOR' 'SR05SPS04:CURRENT_SP ' 1 [5,1] 5 1.0 0.2 ; ... -'6SFB1 ' 'SR06SPS04:CURRENT_MONITOR' 'SR06SPS04:CURRENT_SP ' 1 [6,1] 6 1.0 0.2 ; ... -'7SFB1 ' 'SR07SPS04:CURRENT_MONITOR' 'SR07SPS04:CURRENT_SP ' 1 [7,1] 7 1.0 0.2 ; ... -'8SFB1 ' 'SR08SPS04:CURRENT_MONITOR' 'SR08SPS04:CURRENT_SP ' 1 [8,1] 8 1.0 0.2 ; ... -'9SFB1 ' 'SR09SPS04:CURRENT_MONITOR' 'SR09SPS04:CURRENT_SP ' 1 [9,1] 9 1.0 0.2 ; ... -'10SFB1 ' 'SR10SPS04:CURRENT_MONITOR' 'SR10SPS04:CURRENT_SP ' 1 [10,1] 10 1.0 0.2 ; ... -'11SFB1 ' 'SR11SPS04:CURRENT_MONITOR' 'SR11SPS04:CURRENT_SP ' 1 [11,1] 11 1.0 0.2 ; ... -'12SFB1 ' 'SR12SPS04:CURRENT_MONITOR' 'SR12SPS04:CURRENT_SP ' 1 [12,1] 12 1.0 0.2 ; ... -'13SFB1 ' 'SR13SPS04:CURRENT_MONITOR' 'SR13SPS04:CURRENT_SP ' 1 [13,1] 13 1.0 0.2 ; ... -'14SFB1 ' 'SR14SPS04:CURRENT_MONITOR' 'SR14SPS04:CURRENT_SP ' 1 [14,1] 14 1.0 0.2 ; ... -}; - -for ii=1:size(sfb,1) -name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; -name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; -name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; -val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; -val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; -val =sfb{ii,6}; AO.SFB.ElementLsist(ii,1) = val; -val =sfb{ii,7}; % This is the scale factor -AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; - -AO.SFB.Setpoint.Range(ii,:) = [0 60]; -end - -%=============== -%Skew Quad data -%=============== -% *** Skew quadrupoles *** 2005/09/27 Eugene -AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); -AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('SKQ'); -Physics2HWParams = magnetcoefficients('SKQ'); - -AO.SKQ.Monitor.Mode = Mode; -AO.SKQ.Monitor.DataType = 'Scalar'; -AO.SKQ.Monitor.Units = 'Hardware'; -AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; -AO.SKQ.Monitor.Physics2HWFcn = @k2amp; -AO.SKQ.Monitor.HWUnits = 'ampere'; -AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; - -AO.SKQ.Setpoint.Mode = Mode; -AO.SKQ.Setpoint.DataType = 'Scalar'; -AO.SKQ.Setpoint.Units = 'Hardware'; -AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; -AO.SKQ.Setpoint.HWUnits = 'ampere'; -AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -sq={ -'1SKQ1 ' 'SR01CPS03:CURRENT_MONITOR' 'SR01CPS03:CURRENT_SP ' 1 [1,1] 1 0.2 ; ... -'1SKQ2 ' 'SR01CPS08:CURRENT_MONITOR' 'SR01CPS08:CURRENT_SP ' 1 [1,2] 2 0.2 ; ... -'2SKQ1 ' 'SR02CPS03:CURRENT_MONITOR' 'SR02CPS03:CURRENT_SP ' 1 [2,1] 3 0.2 ; ... -'2SKQ2 ' 'SR02CPS08:CURRENT_MONITOR' 'SR02CPS08:CURRENT_SP ' 1 [2,2] 4 0.2 ; ... -'3SKQ1 ' 'SR03CPS03:CURRENT_MONITOR' 'SR03CPS03:CURRENT_SP ' 1 [3,1] 5 0.2 ; ... -'3SKQ2 ' 'SR03CPS08:CURRENT_MONITOR' 'SR03CPS08:CURRENT_SP ' 1 [3,2] 6 0.2 ; ... -'4SKQ1 ' 'SR04CPS03:CURRENT_MONITOR' 'SR04CPS03:CURRENT_SP ' 1 [4,1] 7 0.2 ; ... -'4SKQ2 ' 'SR04CPS08:CURRENT_MONITOR' 'SR04CPS08:CURRENT_SP ' 1 [4,2] 8 0.2 ; ... -'5SKQ1 ' 'SR05CPS03:CURRENT_MONITOR' 'SR05CPS03:CURRENT_SP ' 1 [5,1] 9 0.2 ; ... -'5SKQ2 ' 'SR05CPS08:CURRENT_MONITOR' 'SR05CPS08:CURRENT_SP ' 1 [5,2] 10 0.2 ; ... -'6SKQ1 ' 'SR06CPS03:CURRENT_MONITOR' 'SR06CPS03:CURRENT_SP ' 1 [6,1] 11 0.2 ; ... -'6SKQ2 ' 'SR06CPS08:CURRENT_MONITOR' 'SR06CPS08:CURRENT_SP ' 1 [6,2] 12 0.2 ; ... -'7SKQ1 ' 'SR07CPS03:CURRENT_MONITOR' 'SR07CPS03:CURRENT_SP ' 1 [7,1] 13 0.2 ; ... -'7SKQ2 ' 'SR07CPS08:CURRENT_MONITOR' 'SR07CPS08:CURRENT_SP ' 1 [7,2] 14 0.2 ; ... -'8SKQ1 ' 'SR08CPS03:CURRENT_MONITOR' 'SR08CPS03:CURRENT_SP ' 1 [8,1] 15 0.2 ; ... -'8SKQ2 ' 'SR08CPS08:CURRENT_MONITOR' 'SR08CPS08:CURRENT_SP ' 1 [8,2] 16 0.2 ; ... -'9SKQ1 ' 'SR09CPS03:CURRENT_MONITOR' 'SR09CPS03:CURRENT_SP ' 1 [9,1] 17 0.2 ; ... -'9SKQ2 ' 'SR09CPS08:CURRENT_MONITOR' 'SR09CPS08:CURRENT_SP ' 1 [9,2] 18 0.2 ; ... -'10SKQ1 ' 'SR10CPS03:CURRENT_MONITOR' 'SR10CPS03:CURRENT_SP ' 1 [10,1] 19 0.2 ; ... -'10SKQ2 ' 'SR10CPS08:CURRENT_MONITOR' 'SR10CPS08:CURRENT_SP ' 1 [10,2] 20 0.2 ; ... -'11SKQ1 ' 'SR11CPS03:CURRENT_MONITOR' 'SR11CPS03:CURRENT_SP ' 1 [11,1] 21 0.2 ; ... -'11SKQ2 ' 'SR11CPS08:CURRENT_MONITOR' 'SR11CPS08:CURRENT_SP ' 1 [11,2] 22 0.2 ; ... -'12SKQ1 ' 'SR12CPS03:CURRENT_MONITOR' 'SR12CPS03:CURRENT_SP ' 1 [12,1] 23 0.2 ; ... -'12SKQ2 ' 'SR12CPS08:CURRENT_MONITOR' 'SR12CPS08:CURRENT_SP ' 1 [12,2] 24 0.2 ; ... -'13SKQ1 ' 'SR13CPS03:CURRENT_MONITOR' 'SR13CPS03:CURRENT_SP ' 1 [13,1] 25 0.2 ; ... -'13SKQ2 ' 'SR13CPS08:CURRENT_MONITOR' 'SR13CPS08:CURRENT_SP ' 1 [13,2] 26 0.2 ; ... -'14SKQ1 ' 'SR14CPS03:CURRENT_MONITOR' 'SR14CPS03:CURRENT_SP ' 1 [14,1] 27 0.2 ; ... -'14SKQ2 ' 'SR14CPS08:CURRENT_MONITOR' 'SR14CPS08:CURRENT_SP ' 1 [14,2] 28 0.2 ; ... -}; - -for ii=1:size(sq,1) -name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; -name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; -name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; -val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; -val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; -val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; -val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; -AO.SKQ.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SKQ.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SKQ.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SKQ.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; - -AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; -end - - -%=============== -%Kicker data -%=============== -AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); -AO.KICK.MemberOf = {'Injection'; 'MachineConfig'; 'Plotfamily'; 'HCM'; 'Horizontal'}; - -AO.KICK.Monitor.Mode = Mode; -AO.KICK.Monitor.DataType = 'Scalar'; -AO.KICK.Monitor.Units = 'Hardware'; -AO.KICK.Monitor.HWUnits = 'kVolts'; -AO.KICK.Monitor.PhysicsUnits = 'mradian'; - -AO.KICK.Setpoint.Mode = Mode; -AO.KICK.Setpoint.DataType = 'Scalar'; -AO.KICK.Setpoint.Units = 'Hardware'; -AO.KICK.Setpoint.HWUnits = 'Volts'; -AO.KICK.Setpoint.PhysicsUnits = 'radian'; - -% From kicker deisgn review the kickers are rated to 4380 Amps giving 0.038 -% Tesla converting this to kickangle. Also convert voltage into amps for -% the conversion? -% -% 2780 V on the capacitor banks will create 5240 A delivered to the kicker -% magnets. -% From simulations 4380 A creates 0.038607 T over a length of 0.7 m. -% Therefore 4380 A => 2.7006 mrad. Therefore 2323.740 V => 2.7006 mrad. -% HW2PHYSICS conversion factor (kV to rad) is therefore 0.0027006/2.32374 = -% 0.00116217821271. The Ps also goes through a 1:3 transformer therefore -% the conversion factor increases by 3. Ie 0.00348653463813 -% For V to rad then 0.00000348653463813. -hw2physics_conversionfactor = 0.00000348653463813; - -% Measured -% Kicker1 100 V = 0.176 mrad -% Kicker2 100 V = -0.138 mrad -% Kicker3 100 V = -0.134 mrad -% Kicker4 100 V = 0.176 mrad - -%common monitor setpoint stat devlist elem tol -kickeramp={ -'KICK1 ' 'SR14KPS01:VOLTAGE_MONITOR' 'SR14KPS01:VOLTAGE_SP ' 1 [1,1] 1 0.10 ; ... -'KICK2 ' 'SR01KPS01:VOLTAGE_MONITOR' 'SR01KPS01:VOLTAGE_SP ' 1 [1,2] 2 0.10 ; ... -'KICK3 ' 'SR01KPS02:VOLTAGE_MONITOR' 'SR01KPS02:VOLTAGE_SP ' 1 [1,3] 3 0.10 ; ... -'KICK4 ' 'SR02KPS01:VOLTAGE_MONITOR' 'SR02KPS01:VOLTAGE_SP ' 1 [1,4] 4 0.10 ; ... -}; - -for ii=1:size(kickeramp,1) -name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; -name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; -name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; -val =kickeramp{ii,4}; AO.KICK.Status(ii,1) = val; -val =kickeramp{ii,5}; AO.KICK.DeviceList(ii,:) = val; -val =kickeramp{ii,6}; AO.KICK.ElementList(ii,1) = val; -val =kickeramp{ii,7}; AO.KICK.Setpoint.Tolerance(ii,1) = val; - -if ii==1||ii==4 - hw2physics_conversionfactor = 1.7600e-06; - AO.KICK.Monitor.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; - AO.KICK.Setpoint.Range(ii,:) = [-1300 +1300]; -else - hw2physics_conversionfactor = 1.3600e-06; - AO.KICK.Monitor.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; - AO.KICK.Setpoint.Range(ii,:) = [+1300 -1300]; -end -end - -% *** KICK Delay *** -% AO.KICK.Delay -% >> removed >> see previous versions if info needed - - -%============ -%RF System -%============ -AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); -AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; - -%-------------------------------- 4 cavity Case -%common stat devlist elem -rfcommon={ -'RF1 ' 1 [1,1] 1 ; ... -'RF2 ' 1 [1,2] 2 ; ... -'RF3 ' 1 [1,3] 3 ; ... -'RF4 ' 1 [1,4] 4 ; ... - }; - -%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance -rffreq={ -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... - }; - -% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfphase={ -'SRF1:STN:PHASE' 'SRF1:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF2:STN:PHASE' 'SRF2:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF3:STN:PHASE' 'SRF3:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF4:STN:PHASE' 'SRF4:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... - }; - -% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfvolt={ -'SRF1:STN:VOLT:CTRL ' 'SRF1:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF2:STN:VOLT:CTRL ' 'SRF2:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF3:STN:VOLT:CTRL ' 'SRF3:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF4:STN:VOLT:CTRL ' 'SRF4:STN:VOLT' 1 1 [-inf inf] inf ; ... - }; -% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance -rfpower={ -'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SRF1:KLYSDRIVFRWD:POWER' 'SRF1:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SRF2:KLYSDRIVFRWD:POWER' 'SRF2:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SRF3:KLYSDRIVFRWD:POWER' 'SRF3:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SRF4:KLYSDRIVFRWD:POWER' 'SRF4:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... - }; - -for ii=1:size(rfcommon,1) -name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; -val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; -val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; -val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; -end - -for ii=1:size(rffreq,1) -name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; -name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; -val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; - AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; -val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; - AO.RF.Setpoint.Physics2HWParams(ii,1) = val; -val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; -val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfphase,1) -name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; -name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; -val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Phase.HW2PhysicsParams(ii,1) = val; -val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Phase.Physics2HWParams(ii,1) = val; -val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; - AO.RF.Phase.Range(ii,:) = val; -val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; - AO.RF.Phase.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfvolt,1) -name=rfvolt{ii,1}; AO.RF.VoltageCtrl.ChannelNames(ii,:) = name; -name=rfvolt{ii,2}; AO.RF.Voltage.ChannelNames(ii,:) = name; -val =rfvolt{ii,3}; AO.RF.VoltageCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Voltage.HW2PhysicsParams(ii,1) = val; -val =rfvolt{ii,4}; AO.RF.VoltageCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Voltage.Physics2HWParams(ii,1) = val; -val =rfvolt{ii,5}; AO.RF.VoltageCtrl.Range(ii,:) = val; - AO.RF.Voltage.Range(ii,:) = val; -val =rfvolt{ii,6}; AO.RF.VoltageCtrl.Tolerance(ii,1) = val; - AO.RF.Voltage.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfpower,1) -name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; -name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; -name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; -val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Power.HW2PhysicsParams(ii,1) = val; - AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; -val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Power.Physics2HWParams(ii,1) = val; - AO.RF.KlysPower.Physics2HWParams(ii,1) = val; -val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; - AO.RF.Power.Range(ii,:) = val; - AO.RF.KlysPower.Range(ii,:) = val; -val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; - AO.RF.Power.Tolerance(ii,1) = val; - AO.RF.KlysPower.Tolerance(ii,1) = val; -end - -%Frequency Readback -AO.RF.Monitor.Mode = Mode; -AO.RF.Monitor.DataType = 'Scalar'; -AO.RF.Monitor.Units = 'Hardware'; -AO.RF.Monitor.HWUnits = 'Hz'; -AO.RF.Monitor.PhysicsUnits = 'Hz'; -%Frequency Setpoint -AO.RF.Setpoint.Mode = Mode; -AO.RF.Setpoint.DataType = 'Scalar'; -AO.RF.Setpoint.Units = 'Hardware'; -AO.RF.Setpoint.HWUnits = 'Hz'; -AO.RF.Setpoint.PhysicsUnits = 'Hz'; - -%Voltage control -AO.RF.VoltageCtrl.Mode = Mode; -AO.RF.VoltageCtrl.DataType = 'Scalar'; -AO.RF.VoltageCtrl.Units = 'Hardware'; -AO.RF.VoltageCtrl.HWUnits = 'Volts'; -AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; - -%Voltage monitor -AO.RF.Voltage.Mode = Mode; -AO.RF.Voltage.DataType = 'Scalar'; -AO.RF.Voltage.Units = 'Hardware'; -AO.RF.Voltage.HWUnits = 'Volts'; -AO.RF.Voltage.PhysicsUnits = 'Volts'; - -%Power Control -AO.RF.PowerCtrl.Mode = Mode; -AO.RF.PowerCtrl.DataType = 'Scalar'; -AO.RF.PowerCtrl.Units = 'Hardware'; -AO.RF.PowerCtrl.HWUnits = 'MWatts'; -AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; - -%Power Monitor -AO.RF.Power.Mode = Mode; -AO.RF.Power.DataType = 'Scalar'; -AO.RF.Power.Units = 'Hardware'; -AO.RF.Power.HWUnits = 'MWatts'; -AO.RF.Power.PhysicsUnits = 'MWatts'; - -%Klystron Forward Power -AO.RF.KlysPower.Mode = Mode; -AO.RF.KlysPower.DataType = 'Scalar'; -AO.RF.KlysPower.Units = 'Hardware'; -AO.RF.KlysPower.HWUnits = 'MWatts'; -AO.RF.KlysPower.PhysicsUnits = 'MWatts'; - -%Station Phase Control -AO.RF.PhaseCtrl.Mode = Mode; -AO.RF.PhaseCtrl.DataType = 'Scalar'; -AO.RF.PhaseCtrl.Units = 'Hardware'; -AO.RF.PhaseCtrl.HWUnits = 'Degrees'; -AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; - - -%Station Phase Monitor -AO.RF.Phase.Mode = Mode; -AO.RF.Phase.DataType = 'Scalar'; -AO.RF.Phase.Units = 'Hardware'; -AO.RF.Phase.HWUnits = 'Degrees'; -AO.RF.Phase.PhysicsUnits = 'Degrees'; - -%==== -%TUNE -%==== -AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); -AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; -AO.TUNE.CommonNames = ['xtune';'ytune']; -AO.TUNE.DeviceList = [ 1 1; 1 2]; -AO.TUNE.ElementList = [1 2]'; -AO.TUNE.Status = [1 1]'; - -AO.TUNE.Monitor.Mode = 'Special'; -AO.TUNE.Monitor.SpecialFunction = 'meastune'; -AO.TUNE.Monitor.DataType = 'Vector'; -AO.TUNE.Monitor.DataTypeIndex = [1 2]'; -AO.TUNE.Monitor.Units = 'Hardware'; -AO.TUNE.Monitor.HW2PhysicsParams = 1; -AO.TUNE.Monitor.Physics2HWParams = 1; -AO.TUNE.Monitor.HWUnits = 'fractional tune'; -AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; - - -% AO.FTx.Length.Mode = 'Special'; -% AO.FTx.Length.Units = 'Hardware'; -% AO.FTx.Length.DataType = 'Scalar'; -% AO.FTx.Length.SpecialFunction = 'getftlength'; -% AO.FTx.Length.SpecialFunctionSet = 'setftlength'; -% AO.FTx.Length.HWUnits = '32ns samples'; -% AO.FTx.Length.PhysicsUnits = '32ns samples'; -% AO.FTx.Length.HW2PhysicsParams = 1; -% AO.FTx.Length.Physics2HWParams = 1; - - -%==== -%DCCT -%==== -AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); -AO.DCCT.MemberOf = {'Diagnostics'}; -AO.DCCT.CommonNames = 'DCCT'; -AO.DCCT.DeviceList = [1 1]; -AO.DCCT.ElementList = [1]; -AO.DCCT.Status = [1]; - -AO.DCCT.Monitor.Mode = Mode; -AO.DCCT.Monitor.DataType = 'Scalar'; -AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; -AO.DCCT.Monitor.Units = 'Hardware'; -AO.DCCT.Monitor.HWUnits = 'milli-ampere'; -AO.DCCT.Monitor.PhysicsUnits = 'ampere'; -AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; -AO.DCCT.Monitor.Physics2HWParams = 1000; - - -% %================== -% %Machine Parameters -% %================== -% Removed in this version, see pervious version for more info - -%====== -%Septum -%====== -% ifam=ifam+1; -% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); -% AO.Septum.MemberOf = {'Injection'}; -% AO.Septum.Status = 1; -% -% AO.Septum.CommonNames = 'Septum '; -% AO.Septum.DeviceList = [3 1]; -% AO.Septum.ElementList = [1]; -% -% AO.Septum.Monitor.Mode = Mode; -% AO.Septum.Monitor.DataType = 'Scalar'; -% AO.Septum.Monitor.Units = 'Hardware'; -% AO.Septum.Monitor.HWUnits = 'ampere'; -% AO.Septum.Monitor.PhysicsUnits = 'radian'; -% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; -% -% AO.Septum.Setpoint.Mode = Mode; -% AO.Septum.Setpoint.DataType = 'Scalar'; -% AO.Septum.Setpoint.Units = 'Hardware'; -% AO.Septum.Setpoint.HWUnits = 'ampere'; -% AO.Septum.Setpoint.PhysicsUnits = 'radian'; -% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; -% AO.Septum.Setpoint.Range = [0, 2500]; -% AO.Septum.Setpoint.Tolerance = 100.0; -% -% AO.Septum.Monitor.HW2PhysicsParams = 1; -% AO.Septum.Monitor.Physics2HWParams = 1; -% AO.Septum.Setpoint.HW2PhysicsParams = 1; -% AO.Septum.Setpoint.Physics2HWParams = 1; - - -%==================== -%Photon Beamline Data -%==================== -% >> removed >> see previous versions if info needed - -%==================== -%BPLD Data -%==================== -% >> removed >> see previous versions if info needed - - - -% The operational mode sets the path, filenames, and other important parameters -% Run setoperationalmode after most of the AO is built so that the Units and Mode fields -% can be set in setoperationalmode -fprintf('\n'); -setao(AO); -setoperationalmode(OperationalMode); -AO = getao; - - -%%%%%%%%%%%%%%%% -% DeltaRespMat % -%%%%%%%%%%%%%%%% - -% I remove the physics2hw conversion because the physics2hw is -% is calibrated yet. - -% Set response matrix kick size in hardware units (amps) -AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', 2.0e-4*.6, AO.HCM.DeviceList); -AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', 1.0e-4*.6, AO.VCM.DeviceList); - -%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point -%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); -%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); - - -AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); -AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); -AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); - - -AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); -AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); -AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); -AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get S-positions [meters] % -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Using ...ATIndex(:,1) will accomodata for split elements where the first -% of a group of elements is put in the first column ie, if SFA is split in -% two then ATIndex will look like [2 3; 11 12; ...] where each row is a -% magnet and column represents each split. -global THERING -AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; -AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; -AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; -AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; -AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; -AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; -AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; -AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; -AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; -AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; -AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; -AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; -AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; -AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; -AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; -AO.DCCT.Position = 0; -AO.TUNE.Position = 0; - - -% Save AO -setao(AO); - - -function dispobject(AO,name) - -n = length(fieldnames(AO)); - -if n > 0 - fprintf(' %10s ',name); - if mod(n,5) == 0 - fprintf('\n'); - end -end \ No newline at end of file +function aspinit(OperationalMode) +% aspinit(OperationalMode) +% +% Initialize parameters for ASP control in MATLAB +% +%========================== +% Accelerator Family Fields +%========================== +% FamilyName BPMx, HCM, etc +% CommonNames Shortcut name for each element (optional) +% DeviceList [Sector, Number] +% ElementList number in list +% Position m, magnet center +% +% MONITOR FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units Physics or HW +% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% +% SETPOINT FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units hardware or physics +% HW2PhysicsFcn function handle used to convert from hardware to physics units +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% Range minsetpoint, maxsetpoint; +% Tolerance setpoint-monitor +% +%============================================= +% Accelerator Toolbox Simulation Fields +%============================================= +% ATType Quad, Sext, etc +% ATIndex index in THERING +% ATParameterGroup parameter group +% +%============ +% Family List +%============ +% BPMx BPMy - beam position monitors +% HCM VCM - corrector magnets wound into sextupoles +% HFC VFC - fast corrector magnets wound into sextupoles (FOFB) +% BEND - gradient dipoles +% QFA QDA QFB - quadrupole magnets +% SFA SDA SDB SFB - sextupole magnets +% SQK - skew quads wound into SDA magnets +% KICK - injection kickers (DELTA type) +% RF - 4 cavities (KEK type?) +% DCCT +% Septum (Not in model yet) +% +% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 +% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 + +% === Change Log === +% Mark Boland 2004-02-12 +% Eugene Tan 2004-02-23 +% Eugene Tan 2004-12-13 +% Eugene Tan 2005-09-27 ver 4 +% Updated naming convention of the process variables, use version 4 of +% the lattice "assr4.m" where the correctors have been merged into the +% sextupoles. Made the necessary changes to updateatindex. Added skew +% quadrupoles and updated generate_init. +% Mark Boland 2006-05-27 +% Changed the BPM PVs to ...:SA_X_MONITOR and ...:SA_Y_MONITOR +% +% Mark Boland 2006-08-29 +% Changed range on HCM and VCM from - to + since the polarity of the +% correctors was physically changed in the last weeks. +% Eugene Tan 2015-09-07 +% Set sensible limits/Range for RF frequency and voltages. +% Eugene Tan 2015-10-15 +% Added FOFB's HFC and VFC magnets + +% === Still to do === +% - kicker delays +% - BPM names and other possible PVs of interest eg. Q factor etc. +% - clean up and configure the amp2k and k2amp conversion. Control system +% designed to calculate the strengths and amp values using calc records, +% therefore we should only need to change the PV name to access for +% readback at setpoints. Only problem will be in simulation/offline mode +% where those value are not available online. How do you keep the offline +% conversion factors up to date with online vals? +% +% === Generated from === +% aspinit_v5skeleton.m + + + +% When using the compiler add a line like, "%#function " for +% for special functions that hidden in strings. + + +% Default operational mode +if nargin < 1 + OperationalMode = 2; +end + + +%============================================= +% START DEFINITION OF ACCELERATOR OBJECTS +%============================================= +fprintf(' Defining the Accelerator Objects. Objects being defined:\n') + + +% Clear previous AcceleratorObjects +setao([]); + + +Mode = 'Online'; % This gets reset in setoperationalmode + +%============================================= +%BPM data: status field designates if BPM in use +%============================================= +ntbpm=98; +AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); +AO.BPMx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMx'; 'Horizontal';}; +AO.BPMx.Monitor.Mode = Mode; +AO.BPMx.Monitor.DataType = 'Scalar'; +AO.BPMx.Monitor.Units = 'Hardware'; +AO.BPMx.Monitor.HWUnits = 'nm'; +AO.BPMx.Monitor.PhysicsUnits = 'meter'; + +AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); +AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMy'; 'Vertical';}; +AO.BPMy.Monitor.Mode = Mode; +AO.BPMy.Monitor.DataType = 'Scalar'; +AO.BPMy.Monitor.Units = 'Hardware'; +AO.BPMy.Monitor.HWUnits = 'nm'; +AO.BPMy.Monitor.PhysicsUnits = 'meter'; + +% x-name x-chname xstat y-name y-chname ystat DevList Elem +bpm={ +'1BPMx1 ' 'SR01BPM01:SA_X_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:SA_Y_MONITOR' 1 [1,1] 1 ; ... +'1BPMx2 ' 'SR01BPM02:SA_X_MONITOR' 1 '1BPMy2 ' 'SR01BPM02:SA_Y_MONITOR' 1 [1,2] 2 ; ... +'1BPMx3 ' 'SR01BPM03:SA_X_MONITOR' 1 '1BPMy3 ' 'SR01BPM03:SA_Y_MONITOR' 1 [1,3] 3 ; ... +'1BPMx4 ' 'SR01BPM04:SA_X_MONITOR' 1 '1BPMy4 ' 'SR01BPM04:SA_Y_MONITOR' 1 [1,4] 4 ; ... +'1BPMx5 ' 'SR01BPM05:SA_X_MONITOR' 1 '1BPMy5 ' 'SR01BPM05:SA_Y_MONITOR' 1 [1,5] 5 ; ... +'1BPMx6 ' 'SR01BPM06:SA_X_MONITOR' 1 '1BPMy6 ' 'SR01BPM06:SA_Y_MONITOR' 1 [1,6] 6 ; ... +'1BPMx7 ' 'SR01BPM07:SA_X_MONITOR' 1 '1BPMy7 ' 'SR01BPM07:SA_Y_MONITOR' 1 [1,7] 7 ; ... +'2BPMx1 ' 'SR02BPM01:SA_X_MONITOR' 1 '2BPMy1 ' 'SR02BPM01:SA_Y_MONITOR' 1 [2,1] 8 ; ... +'2BPMx2 ' 'SR02BPM02:SA_X_MONITOR' 1 '2BPMy2 ' 'SR02BPM02:SA_Y_MONITOR' 1 [2,2] 9 ; ... +'2BPMx3 ' 'SR02BPM03:SA_X_MONITOR' 1 '2BPMy3 ' 'SR02BPM03:SA_Y_MONITOR' 1 [2,3] 10 ; ... +'2BPMx4 ' 'SR02BPM04:SA_X_MONITOR' 1 '2BPMy4 ' 'SR02BPM04:S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M05:SA_Y_MONITOR' 1 [9,5] 61 ; ... +'9BPMx6 ' 'SR09BPM06:SA_X_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:SA_Y_MONITOR' 1 [9,6] 62 ; ... +'9BPMx7 ' 'SR09BPM07:SA_X_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:SA_Y_MONITOR' 1 [9,7] 63 ; ... +'10BPMx1 ' 'SR10BPM01:SA_X_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:SA_Y_MONITOR' 1 [10,1] 64 ; ... +'10BPMx2 ' 'SR10BPM02:SA_X_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:SA_Y_MONITOR' 1 [10,2] 65 ; ... +'10BPMx3 ' 'SR10BPM03:SA_X_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:SA_Y_MONITOR' 1 [10,3] 66 ; ... +'10BPMx4 ' 'SR10BPM04:SA_X_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:SA_Y_MONITOR' 1 [10,4] 67 ; ... +'10BPMx5 ' 'SR10BPM05:SA_X_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:SA_Y_MONITOR' 1 [10,5] 68 ; ... +'10BPMx6 ' 'SR10BPM06:SA_X_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:SA_Y_MONITOR' 1 [10,6] 69 ; ... +'10BPMx7 ' 'SR10BPM07:SA_X_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:SA_Y_MONITOR' 1 [10,7] 70 ; ... +'11BPMx1 ' 'SR11BPM01:SA_X_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:SA_Y_MONITOR' 1 [11,1] 71 ; ... +'11BPMx2 ' 'SR11BPM02:SA_X_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:SA_Y_MONITOR' 1 [11,2] 72 ; ... +'11BPMx3 ' 'SR11BPM03:SA_X_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:SA_Y_MONITOR' 1 [11,3] 73 ; ... +'11BPMx4 ' 'SR11BPM04:SA_X_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:SA_Y_MONITOR' 1 [11,4] 74 ; ... +'11BPMx5 ' 'SR11BPM05:SA_X_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:SA_Y_MONITOR' 1 [11,5] 75 ; ... +'11BPMx6 ' 'SR11BPM06:SA_X_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:SA_Y_MONITOR' 1 [11,6] 76 ; ... +'11BPMx7 ' 'SR11BPM07:SA_X_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:SA_Y_MONITOR' 1 [11,7] 77 ; ... +'12BPMx1 ' 'SR12BPM01:SA_X_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:SA_Y_MONITOR' 1 [12,1] 78 ; ... +'12BPMx2 ' 'SR12BPM02:SA_X_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:SA_Y_MONITOR' 1 [12,2] 79 ; ... +'12BPMx3 ' 'SR12BPM03:SA_X_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:SA_Y_MONITOR' 1 [12,3] 80 ; ... +'12BPMx4 ' 'SR12BPM04:SA_X_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:SA_Y_MONITOR' 1 [12,4] 81 ; ... +'12BPMx5 ' 'SR12BPM05:SA_X_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:SA_Y_MONITOR' 1 [12,5] 82 ; ... +'12BPMx6 ' 'SR12BPM06:SA_X_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:SA_Y_MONITOR' 1 [12,6] 83 ; ... +'12BPMx7 ' 'SR12BPM07:SA_X_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:SA_Y_MONITOR' 1 [12,7] 84 ; ... +'13BPMx1 ' 'SR13BPM01:SA_X_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:SA_Y_MONITOR' 1 [13,1] 85 ; ... +'13BPMx2 ' 'SR13BPM02:SA_X_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:SA_Y_MONITOR' 1 [13,2] 86 ; ... +'13BPMx3 ' 'SR13BPM03:SA_X_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:SA_Y_MONITOR' 1 [13,3] 87 ; ... +'13BPMx4 ' 'SR13BPM04:SA_X_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:SA_Y_MONITOR' 1 [13,4] 88 ; ... +'13BPMx5 ' 'SR13BPM05:SA_X_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:SA_Y_MONITOR' 1 [13,5] 89 ; ... +'13BPMx6 ' 'SR13BPM06:SA_X_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:SA_Y_MONITOR' 1 [13,6] 90 ; ... +'13BPMx7 ' 'SR13BPM07:SA_X_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:SA_Y_MONITOR' 1 [13,7] 91 ; ... +'14BPMx1 ' 'SR14BPM01:SA_X_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:SA_Y_MONITOR' 1 [14,1] 92 ; ... +'14BPMx2 ' 'SR14BPM02:SA_X_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:SA_Y_MONITOR' 1 [14,2] 93 ; ... +'14BPMx3 ' 'SR14BPM03:SA_X_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:SA_Y_MONITOR' 1 [14,3] 94 ; ... +'14BPMx4 ' 'SR14BPM04:SA_X_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:SA_Y_MONITOR' 1 [14,4] 95 ; ... +'14BPMx5 ' 'SR14BPM05:SA_X_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:SA_Y_MONITOR' 1 [14,5] 96 ; ... +'14BPMx6 ' 'SR14BPM06:SA_X_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:SA_Y_MONITOR' 1 [14,6] 97 ; ... +'14BPMx7 ' 'SR14BPM07:SA_X_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:SA_Y_MONITOR' 1 [14,7] 98 ; ... +}; +% 'diag ' 'SR15BPM01:SA_X_MONITOR' 0 'diag ' 'SR15BPM01:SA_Y_MONITOR' 0 [-1,-1] 99 ; ... +%'14BPMx7 ' 'SR01BPM08:SA_X_MONITOR' 1 '14BPMy7 ' 'SR01BPM08:SA_Y_MONITOR' 1 [14,7] 98 ; ... +%'14BPMx7 ' 'SR14BPM07:SA_X_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:SA_Y_MONITOR' 1 [14,7] 98 ; ... + +% NOTE: BPM [-1 -1] IS A DIAGNOSTIC BPM AND IS NOT TO BE PUT IN SERVICE. NOT +% PART OF ORBIT CORRECTION ETC. AND NOT IN THE MODEL PER SE. ET 18/11/2008 + +%Load fields from data block +for ii=1:size(bpm,1) +name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; +name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; +name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; +name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; +val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; + AO.BPMy.DeviceList(ii,:) = val; +val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; + AO.BPMy.ElementList(ii,:) = val; + AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-9; + AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1e+9; + AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-9; + AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1e+9; + % Placeholder for setting software offsets + AO.BPMx.Monitor.Offset(ii,:) = 0; + AO.BPMy.Monitor.Offset(ii,:) = 0; +end + + +% % Get sum value from button. Don't need handles and PV namelist as +% % parameters are the same as the 'monitor' subcategory. +% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; +% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; +% AO.BPMx.Sum.HWUnits = 'ADC Counts'; +% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; +% AO.BPMx.Sum.HW2PhysicsParams = 1; +% AO.BPMx.Sum.Physics2HWParams = 1; +% % Get q value from BPMs. Don't need handles and PV namelist. +% AO.BPMx.Q = AO.BPMx.Monitor; +% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; +% AO.BPMx.Q.HWUnits = 'mm'; +% AO.BPMx.Q.PhysicsUnits = 'meter'; +% AO.BPMx.Q.HW2PhysicsParams = 1e-3; +% AO.BPMx.Q.Physics2HWParams = 1000; +% +% % Definition above for horiz0ontal. Replicate for vertical. +% AO.BPMy.Sum = AO.BPMx.Sum; +% AO.BPMy.Q = AO.BPMx.Q; + +%=========================================================== +% Corrector data: status field designates if corrector in use +% ASP corrector coils wound into sextupoles. Not dynamic correctors. +%=========================================================== + +AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); +AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'; 'Horizontal'}; + +AO.HCM.Monitor.Mode = Mode; +AO.HCM.Monitor.DataType = 'Scalar'; +AO.HCM.Monitor.Units = 'Hardware'; +AO.HCM.Monitor.HWUnits = 'ampere'; +AO.HCM.Monitor.PhysicsUnits = 'radian'; +AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.HCM.Monitor.Physics2HWFcn = @k2amp; + +AO.HCM.Setpoint.Mode = Mode; +AO.HCM.Setpoint.DataType = 'Scalar'; +AO.HCM.Setpoint.Units = 'Hardware'; +AO.HCM.Setpoint.HWUnits = 'ampere'; +AO.HCM.Setpoint.PhysicsUnits = 'radian'; +AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.HCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian. Respmat settings below AO definitions. +% x-common x-monitor x-setpoint stat devlist elem tol +cor={ +'1HCM1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:BASE_CURRENT_SP ' 1 [1,1] 1 0.1 ; ... +'1HCM2 ' 'SR01CPS05:CURRENT_MONITOR' 'SR01CPS05:BASE_CURRENT_SP ' 1 [1,2] 2 0.1 ; ... +'1HCM3 ' 'SR01CPS09:CURRENT_MONITOR' 'SR01CPS09:BASE_CURRENT_SP ' 1 [1,3] 3 0.1 ; ... +'2HCM1 ' 'SR02CPS01:CURRENT_MONITOR' 'SR02CPS01:BASE_CURRENT_SP ' 1 [2,1] 4 0.1 ; ... +'2HCM2 ' 'SR02CPS05:CURRENT_MONITOR' 'SR02CPS05:BASE_CURRENT_SP ' 1 [2,2] 5 0.1 ; ... +'2HCM3 ' 'SR02CPS09:CURRENT_MONITOR' 'SR02CPS09:BASE_CURRENT_SP ' 1 [2,3] 6 0.1 ; ... +'3HCM1 ' 'SR03CPS01:CURRENT_MONITOR' 'SR03CPS01:BASE_CURRENT_SP ' 1 [3,1] 7 0.1 ; ... +'3HCM2 ' 'SR03CPS05:CURRENT_MONITOR' 'SR03CPS05:BASE_CURRENT_SP ' 1 [3,2] 8 0.1 ; ... +'3HCM3 ' 'SR03CPS09:CURRENT_MONITOR' 'SR03CPS09:BASE_CURRENT_SP ' 1 [3,3] 9 0.1 ; ... +'4HCM1 ' 'SR04CPS01:CURRENT_MONITOR' 'SR04CPS01:BASE_CURRENT_SP ' 1 [4,1] 10 0.1 ; ... +'4HCM2 ' 'SR04CPS05:CURRENT_MONITOR' 'SR04CPS05:BASE_CURRENT_SP ' 1 [4,2] 11 0.1 ; ... +'4HCM3 ' 'SR04CPS09:CURRENT_MONITOR' 'SR04CPS09:BASE_CURRENT_SP ' 1 [4,3] 12 0.1 ; ... +'5HCM1 ' 'SR05CPS01:CURRENT_MONITOR' 'SR05CPS01:BASE_CURRENT_SP ' 1 [5,1] 13 0.1 ; ... +'5HCM2 ' 'SR05CPS05:CURRENT_MONITOR' 'SR05CPS05:BASE_CURRENT_SP ' 1 [5,2] 14 0.1 ; ... +'5HCM3 ' 'SR05CPS09:CURRENT_MONITOR' 'SR05CPS09:BASE_CURRENT_SP ' 1 [5,3] 15 0.1 ; ... +'6HCM1 ' 'SR06CPS01:CURRENT_MONITOR' 'SR06CPS01:BASE_CURRENT_SP ' 1 [6,1] 16 0.1 ; ... +'6HCM2 ' 'SR06CPS05:CURRENT_MONITOR' 'SR06CPS05:BASE_CURRENT_SP ' 1 [6,2] 17 0.1 ; ... +'6HCM3 ' 'SR06CPS09:CURRENT_MONITOR' 'SR06CPS09:BASE_CURRENT_SP ' 1 [6,3] 18 0.1 ; ... +'7HCM1 ' 'SR07CPS01:CURRENT_MONITOR' 'SR07CPS01:BASE_CURRENT_SP ' 1 [7,1] 19 0.1 ; ... +'7HCM2 ' 'SR07CPS05:CURRENT_MONITOR' 'SR07CPS05:BASE_CURRENT_SP ' 1 [7,2] 20 0.1 ; ... +'7HCM3 ' 'SR07CPS09:CURRENT_MONITOR' 'SR07CPS09:BASE_CURRENT_SP ' 1 [7,3] 21 0.1 ; ... +'8HCM1 ' 'SR08CPS01:CURRENT_MONITOR' 'SR08CPS01:BASE_CURRENT_SP ' 1 [8,1] 22 0.1 ; ... +'8HCM2 ' 'SR08CPS05:CURRENT_MONITOR' 'SR08CPS05:BASE_CURRENT_SP ' 1 [8,2] 23 0.1 ; ... +'8HCM3 ' 'SR08CPS09:CURRENT_MONITOR' 'SR08CPS09:BASE_CURRENT_SP ' 1 [8,3] 24 0.1 ; ... +'9HCM1 ' 'SR09CPS01:CURRENT_MONITOR' 'SR09CPS01:BASE_CURRENT_SP ' 1 [9,1] 25 0.1 ; ... +'9HCM2 ' 'SR09CPS05:CURRENT_MONITOR' 'SR09CPS05:BASE_CURRENT_SP ' 1 [9,2] 26 0.1 ; ... +'9HCM3 ' 'SR09CPS09:CURRENT_MONITOR' 'SR09CPS09:BASE_CURRENT_SP ' 1 [9,3] 27 0.1 ; ... +'10HCM1 ' 'SR10CPS01:CURRENT_MONITOR' 'SR10CPS01:BASE_CURRENT_SP ' 1 [10,1] 28 0.1 ; ... +'10HCM2 ' 'SR10CPS05:CURRENT_MONITOR' 'SR10CPS05:BASE_CURRENT_SP ' 1 [10,2] 29 0.1 ; ... +'10HCM3 ' 'SR10CPS09:CURRENT_MONITOR' 'SR10CPS09:BASE_CURRENT_SP ' 1 [10,3] 30 0.1 ; ... +'11HCM1 ' 'SR11CPS01:CURRENT_MONITOR' 'SR11CPS01:BASE_CURRENT_SP ' 1 [11,1] 31 0.1 ; ... +'11HCM2 ' 'SR11CPS05:CURRENT_MONITOR' 'SR11CPS05:BASE_CURRENT_SP ' 1 [11,2] 32 0.1 ; ... +'11HCM3 ' 'SR11CPS09:CURRENT_MONITOR' 'SR11CPS09:BASE_CURRENT_SP ' 1 [11,3] 33 0.1 ; ... +'12HCM1 ' 'SR12CPS01:CURRENT_MONITOR' 'SR12CPS01:BASE_CURRENT_SP ' 1 [12,1] 34 0.1 ; ... +'12HCM2 ' 'SR12CPS05:CURRENT_MONITOR' 'SR12CPS05:BASE_CURRENT_SP ' 1 [12,2] 35 0.1 ; ... +'12HCM3 ' 'SR12CPS09:CURRENT_MONITOR' 'SR12CPS09:BASE_CURRENT_SP ' 1 [12,3] 36 0.1 ; ... +'13HCM1 ' 'SR13CPS01:CURRENT_MONITOR' 'SR13CPS01:BASE_CURRENT_SP ' 1 [13,1] 37 0.1 ; ... +'13HCM2 ' 'SR13CPS05:CURRENT_MONITOR' 'SR13CPS05:BASE_CURRENT_SP ' 1 [13,2] 38 0.1 ; ... +'13HCM3 ' 'SR13CPS09:CURRENT_MONITOR' 'SR13CPS09:BASE_CURRENT_SP ' 1 [13,3] 39 0.1 ; ... +'14HCM1 ' 'SR14CPS01:CURRENT_MONITOR' 'SR14CPS01:BASE_CURRENT_SP ' 1 [14,1] 40 0.1 ; ... +'14HCM2 ' 'SR14CPS05:CURRENT_MONITOR' 'SR14CPS05:BASE_CURRENT_SP ' 1 [14,2] 41 0.1 ; ... +'14HCM3 ' 'SR14CPS09:CURRENT_MONITOR' 'SR14CPS09:BASE_CURRENT_SP ' 1 [14,3] 42 0.1 ; ... +}; + +[C, Leff, MagnetType] = magnetcoefficients('HCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.HCM.Status(ii,1) = val; +val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; + +AO.HCM.Setpoint.Range(ii,:) = [-90 +90]; +AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + + +AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); +AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'; 'Vertical'}; + +AO.VCM.Monitor.Mode = Mode; +AO.VCM.Monitor.DataType = 'Scalar'; +AO.VCM.Monitor.Units = 'Hardware'; +AO.VCM.Monitor.HWUnits = 'ampere'; +AO.VCM.Monitor.PhysicsUnits = 'radian'; +AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.VCM.Monitor.Physics2HWFcn = @k2amp; + +AO.VCM.Setpoint.Mode = Mode; +AO.VCM.Setpoint.DataType = 'Scalar'; +AO.VCM.Setpoint.Units = 'Hardware'; +AO.VCM.Setpoint.HWUnits = 'ampere'; +AO.VCM.Setpoint.PhysicsUnits = 'radian'; +AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.VCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian ** radian units converted to ampere below *** +% y-common y-monitor y-setpoint stat devlist elem +cor={ +'1VCM1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:BASE_CURRENT_SP ' 1 [1,1] 1 0.2 ; ... +'1VCM2 ' 'SR01CPS04:CURRENT_MONITOR' 'SR01CPS04:BASE_CURRENT_SP ' 1 [1,2] 2 0.2 ; ... +'1VCM3 ' 'SR01CPS06:CURRENT_MONITOR' 'SR01CPS06:BASE_CURRENT_SP ' 1 [1,3] 3 0.2 ; ... +'1VCM4 ' 'SR01CPS07:CURRENT_MONITOR' 'SR01CPS07:BASE_CURRENT_SP ' 1 [1,4] 4 0.2 ; ... +'2VCM1 ' 'SR02CPS02:CURRENT_MONITOR' 'SR02CPS02:BASE_CURRENT_SP ' 1 [2,1] 5 0.2 ; ... +'2VCM2 ' 'SR02CPS04:CURRENT_MONITOR' 'SR02CPS04:BASE_CURRENT_SP ' 1 [2,2] 6 0.2 ; ... +'2VCM3 ' 'SR02CPS06:CURRENT_MONITOR' 'SR02CPS06:BASE_CURRENT_SP ' 1 [2,3] 7 0.2 ; ... +'2VCM4 ' 'SR02CPS07:CURRENT_MONITOR' 'SR02CPS07:BASE_CURRENT_SP ' 1 [2,4] 8 0.2 ; ... +'3VCM1 ' 'SR03CPS02:CURRENT_MONITOR' 'SR03CPS02:BASE_CURRENT_SP ' 1 [3,1] 9 0.2 ; ... +'3VCM2 ' 'SR03CPS04:CURRENT_MONITOR' 'SR03CPS04:BASE_CURRENT_SP ' 1 [3,2] 10 0.2 ; ... +'3VCM3 ' 'SR03CPS06:CURRENT_MONITOR' 'SR03CPS06:BASE_CURRENT_SP ' 1 [3,3] 11 0.2 ; ... +'3VCM4 ' 'SR03CPS07:CURRENT_MONITOR' 'SR03CPS07:BASE_CURRENT_SP ' 1 [3,4] 12 0.2 ; ... +'4VCM1 ' 'SR04CPS02:CURRENT_MONITOR' 'SR04CPS02:BASE_CURRENT_SP ' 1 [4,1] 13 0.2 ; ... +'4VCM2 ' 'SR04CPS04:CURRENT_MONITOR' 'SR04CPS04:BASE_CURRENT_SP ' 1 [4,2] 14 0.2 ; ... +'4VCM3 ' 'SR04CPS06:CURRENT_MONITOR' 'SR04CPS06:BASE_CURRENT_SP ' 1 [4,3] 15 0.2 ; ... +'4VCM4 ' 'SR04CPS07:CURRENT_MONITOR' 'SR04CPS07:BASE_CURRENT_SP ' 1 [4,4] 16 0.2 ; ... +'5VCM1 ' 'SR05CPS02:CURRENT_MONITOR' 'SR05CPS02:BASE_CURRENT_SP ' 1 [5,1] 17 0.2 ; ... +'5VCM2 ' 'SR05CPS04:CURRENT_MONITOR' 'SR05CPS04:BASE_CURRENT_SP ' 1 [5,2] 18 0.2 ; ... +'5VCM3 ' 'SR05CPS06:CURRENT_MONITOR' 'SR05CPS06:BASE_CURRENT_SP ' 1 [5,3] 19 0.2 ; ... +'5VCM4 ' 'SR05CPS07:CURRENT_MONITOR' 'SR05CPS07:BASE_CURRENT_SP ' 1 [5,4] 20 0.2 ; ... +'6VCM1 ' 'SR06CPS02:CURRENT_MONITOR' 'SR06CPS02:BASE_CURRENT_SP ' 1 [6,1] 21 0.2 ; ... +'6VCM2 ' 'SR06CPS04:CURRENT_MONITOR' 'SR06CPS04:BASE_CURRENT_SP ' 1 [6,2] 22 0.2 ; ... +'6VCM3 ' 'SR06CPS06:CURRENT_MONITOR' 'SR06CPS06:BASE_CURRENT_SP ' 1 [6,3] 23 0.2 ; ... +'6VCM4 ' 'SR06CPS07:CURRENT_MONITOR' 'SR06CPS07:BASE_CURRENT_SP ' 1 [6,4] 24 0.2 ; ... +'7VCM1 ' 'SR07CPS02:CURRENT_MONITOR' 'SR07CPS02:BASE_CURRENT_SP ' 1 [7,1] 25 0.2 ; ... +'7VCM2 ' 'SR07CPS04:CURRENT_MONITOR' 'SR07CPS04:BASE_CURRENT_SP ' 1 [7,2] 26 0.2 ; ... +'7VCM3 ' 'SR07CPS06:CURRENT_MONITOR' 'SR07CPS06:BASE_CURRENT_SP ' 1 [7,3] 27 0.2 ; ... +'7VCM4 ' 'SR07CPS07:CURRENT_MONITOR' 'SR07CPS07:BASE_CURRENT_SP ' 1 [7,4] 28 0.2 ; ... +'8VCM1 ' 'SR08CPS02:CURRENT_MONITOR' 'SR08CPS02:BASE_CURRENT_SP ' 1 [8,1] 29 0.2 ; ... +'8VCM2 ' 'SR08CPS04:CURRENT_MONITOR' 'SR08CPS04:BASE_CURRENT_SP ' 1 [8,2] 30 0.2 ; ... +'8VCM3 ' 'SR08CPS06:CURRENT_MONITOR' 'SR08CPS06:BASE_CURRENT_SP ' 1 [8,3] 31 0.2 ; ... +'8VCM4 ' 'SR08CPS07:CURRENT_MONITOR' 'SR08CPS07:BASE_CURRENT_SP ' 1 [8,4] 32 0.2 ; ... +'9VCM1 ' 'SR09CPS02:CURRENT_MONITOR' 'SR09CPS02:BASE_CURRENT_SP ' 1 [9,1] 33 0.2 ; ... +'9VCM2 ' 'SR09CPS04:CURRENT_MONITOR' 'SR09CPS04:BASE_CURRENT_SP ' 1 [9,2] 34 0.2 ; ... +'9VCM3 ' 'SR09CPS06:CURRENT_MONITOR' 'SR09CPS06:BASE_CURRENT_SP ' 1 [9,3] 35 0.2 ; ... +'9VCM4 ' 'SR09CPS07:CURRENT_MONITOR' 'SR09CPS07:BASE_CURRENT_SP ' 1 [9,4] 36 0.2 ; ... +'10VCM1 ' 'SR10CPS02:CURRENT_MONITOR' 'SR10CPS02:BASE_CURRENT_SP ' 1 [10,1] 37 0.2 ; ... +'10VCM2 ' 'SR10CPS04:CURRENT_MONITOR' 'SR10CPS04:BASE_CURRENT_SP ' 1 [10,2] 38 0.2 ; ... +'10VCM3 ' 'SR10CPS06:CURRENT_MONITOR' 'SR10CPS06:BASE_CURRENT_SP ' 1 [10,3] 39 0.2 ; ... +'10VCM4 ' 'SR10CPS07:CURRENT_MONITOR' 'SR10CPS07:BASE_CURRENT_SP ' 1 [10,4] 40 0.2 ; ... +'11VCM1 ' 'SR11CPS02:CURRENT_MONITOR' 'SR11CPS02:BASE_CURRENT_SP ' 1 [11,1] 41 0.2 ; ... +'11VCM2 ' 'SR11CPS04:CURRENT_MONITOR' 'SR11CPS04:BASE_CURRENT_SP ' 1 [11,2] 42 0.2 ; ... +'11VCM3 ' 'SR11CPS06:CURRENT_MONITOR' 'SR11CPS06:BASE_CURRENT_SP ' 1 [11,3] 43 0.2 ; ... +'11VCM4 ' 'SR11CPS07:CURRENT_MONITOR' 'SR11CPS07:BASE_CURRENT_SP ' 1 [11,4] 44 0.2 ; ... +'12VCM1 ' 'SR12CPS02:CURRENT_MONITOR' 'SR12CPS02:BASE_CURRENT_SP ' 1 [12,1] 45 0.2 ; ... +'12VCM2 ' 'SR12CPS04:CURRENT_MONITOR' 'SR12CPS04:BASE_CURRENT_SP ' 1 [12,2] 46 0.2 ; ... +'12VCM3 ' 'SR12CPS06:CURRENT_MONITOR' 'SR12CPS06:BASE_CURRENT_SP ' 1 [12,3] 47 0.2 ; ... +'12VCM4 ' 'SR12CPS07:CURRENT_MONITOR' 'SR12CPS07:BASE_CURRENT_SP ' 1 [12,4] 48 0.2 ; ... +'13VCM1 ' 'SR13CPS02:CURRENT_MONITOR' 'SR13CPS02:BASE_CURRENT_SP ' 1 [13,1] 49 0.2 ; ... +'13VCM2 ' 'SR13CPS04:CURRENT_MONITOR' 'SR13CPS04:BASE_CURRENT_SP ' 1 [13,2] 50 0.2 ; ... +'13VCM3 ' 'SR13CPS06:CURRENT_MONITOR' 'SR13CPS06:BASE_CURRENT_SP ' 1 [13,3] 51 0.2 ; ... +'13VCM4 ' 'SR13CPS07:CURRENT_MONITOR' 'SR13CPS07:BASE_CURRENT_SP ' 1 [13,4] 52 0.2 ; ... +'14VCM1 ' 'SR14CPS02:CURRENT_MONITOR' 'SR14CPS02:BASE_CURRENT_SP ' 1 [14,1] 53 0.2 ; ... +'14VCM2 ' 'SR14CPS04:CURRENT_MONITOR' 'SR14CPS04:BASE_CURRENT_SP ' 1 [14,2] 54 0.2 ; ... +'14VCM3 ' 'SR14CPS06:CURRENT_MONITOR' 'SR14CPS06:BASE_CURRENT_SP ' 1 [14,3] 55 0.2 ; ... +'14VCM4 ' 'SR14CPS07:CURRENT_MONITOR' 'SR14CPS07:BASE_CURRENT_SP ' 1 [14,4] 56 0.3 ; ... +}; + +[C, Leff, MagnetType] = magnetcoefficients('VCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.VCM.Status(ii,1) = val; +val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; + +AO.VCM.Setpoint.Range(ii,:) = [-125 +125]; +AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + +% ============================ +% Fast Corrector Magnets +% ============================ + +AO.HFC.FamilyName = 'HFC'; dispobject(AO,AO.HFC.FamilyName); +AO.HFC.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HFC'; 'Magnet'; 'Horizontal'}; + +AO.HFC.Monitor.Mode = Mode; +AO.HFC.Monitor.DataType = 'Scalar'; +AO.HFC.Monitor.Units = 'Hardware'; +AO.HFC.Monitor.HWUnits = 'ampere'; +AO.HFC.Monitor.PhysicsUnits = 'radian'; + +AO.HFC.Setpoint.Mode = Mode; +AO.HFC.Setpoint.DataType = 'Scalar'; +AO.HFC.Setpoint.Units = 'Hardware'; +AO.HFC.Setpoint.HWUnits = 'ampere'; +AO.HFC.Setpoint.PhysicsUnits = 'radian'; + +k = 16.5e-6; % rad/A +ind = 1; +for ii=1:14 + for jj=1:3 + AO.HFC.CommonNames(ind,:) = sprintf('%02dHFC%1d',ii,jj); + AO.HFC.Monitor.ChannelNames(ind,:) = sprintf('SR%02dHFC%02d:CURRENT_SP_MONITOR',ii,jj); + AO.HFC.Setpoint.ChannelNames(ind,:) = sprintf('SR%02dHFC%02d:INT_CURRENT_SP',ii,jj); + AO.HFC.Setpoint.Tolerance(ind,1) = 0.05; % 50 mA. + AO.HFC.Setpoint.Range(ind,:) = [-1 +1]; + AO.HFC.Status(ind,1) = 1; % all good for now, will remove later + AO.HFC.DeviceList(ind,:) = [ii jj]; + AO.HFC.ElementList(ind,1) = ind; + AO.HFC.Monitor.HW2PhysicsParams(ind,:) = k; + AO.HFC.Monitor.Physics2HWParams(ind,:) = 1/k; + AO.HFC.Setpoint.HW2PhysicsParams(ind,:) = k; + AO.HFC.Setpoint.Physics2HWParams(ind,:) = 1/k; + ind = ind+1; + end +end + + +AO.VFC.FamilyName = 'VFC'; dispobject(AO,AO.VFC.FamilyName); +AO.VFC.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VFC'; 'Magnet'; 'Horizontal'}; + +AO.VFC.Monitor.Mode = Mode; +AO.VFC.Monitor.DataType = 'Scalar'; +AO.VFC.Monitor.Units = 'Hardware'; +AO.VFC.Monitor.HWUnits = 'ampere'; +AO.VFC.Monitor.PhysicsUnits = 'radian'; + +AO.VFC.Setpoint.Mode = Mode; +AO.VFC.Setpoint.DataType = 'Scalar'; +AO.VFC.Setpoint.Units = 'Hardware'; +AO.VFC.Setpoint.HWUnits = 'ampere'; +AO.VFC.Setpoint.PhysicsUnits = 'radian'; + +k = 10.0e-6; % rad/A +ind = 1; +for ii=1:14 + for jj=1:3 + AO.VFC.CommonNames(ind,:) = sprintf('%02dVFC%1d',ii,jj); + AO.VFC.Monitor.ChannelNames(ind,:) = sprintf('SR%02dVFC%02d:CURRENT_SP_MONITOR',ii,jj); + AO.VFC.Setpoint.ChannelNames(ind,:) = sprintf('SR%02dVFC%02d:INT_CURRENT_SP',ii,jj); + AO.VFC.Setpoint.Tolerance(ind,1) = 0.05; % 5 mA. + AO.VFC.Status(ind,1) = 1; % all good for now, will remove later + AO.VFC.DeviceList(ind,:) = [ii jj]; + AO.VFC.ElementList(ind,1) = ind; + AO.VFC.Setpoint.Range(ind,:) = [-1 +1]; + AO.VFC.Monitor.HW2PhysicsParams(ind,:) = k; + AO.VFC.Monitor.Physics2HWParams(ind,:) = 1/k; + AO.VFC.Setpoint.HW2PhysicsParams(ind,:) = k; + AO.VFC.Setpoint.Physics2HWParams(ind,:) = 1/k; + ind = ind+1; + end +end + + +%============================= +% MAIN MAGNETS +%============================= + +%=========== +%Dipole data +%=========== + +% *** BEND *** +AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); +AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('BEND'); +Physics2HWParams = magnetcoefficients('BEND'); + +AO.BEND.Monitor.Mode = Mode; +AO.BEND.Monitor.DataType = 'Scalar'; +AO.BEND.Monitor.Units = 'Hardware'; +AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? +AO.BEND.Monitor.Physics2HWFcn = @gev2bend; +AO.BEND.Monitor.HWUnits = 'ampere'; +AO.BEND.Monitor.PhysicsUnits = 'energy'; + +AO.BEND.Setpoint.Mode = Mode; +AO.BEND.Setpoint.DataType = 'Scalar'; +AO.BEND.Setpoint.Units = 'Hardware'; +AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; +AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; +AO.BEND.Setpoint.HWUnits = 'ampere'; +AO.BEND.Setpoint.PhysicsUnits = 'energy'; + +% common monitor setpoint stat devlist elem scale tol +bend={ +'1BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... +'3BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +for ii=1:size(bend,1) +name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; +name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; +name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; +val =bend{ii,4}; AO.BEND.Status(ii,1) = val; +val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; +val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; +val =bend{ii,7}; % This is the scale factor +AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; + +AO.BEND.Setpoint.Range(ii,:) = [50 695]; +end + +%=============== +%Quadrupole data +%=============== + +% *** QFA *** +AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); +AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFA'); +Physics2HWParams = magnetcoefficients('QFA'); + +AO.QFA.Monitor.Mode = Mode; +AO.QFA.Monitor.DataType = 'Scalar'; +AO.QFA.Monitor.Units = 'Hardware'; +AO.QFA.Monitor.HWUnits = 'ampere'; +AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFA.Monitor.Physics2HWFcn = @k2amp; + +AO.QFA.Setpoint.Mode = Mode; +AO.QFA.Setpoint.DataType = 'Scalar'; +AO.QFA.Setpoint.Units = 'Hardware'; +AO.QFA.Setpoint.HWUnits = 'ampere'; +AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qfa={ +'1QFA1 ' 'SR01QPS01:CURRENT_MONITOR' 'SR01QPS01:BASE_CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1QFA2 ' 'SR01QPS06:CURRENT_MONITOR' 'SR01QPS06:BASE_CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2QFA1 ' 'SR02QPS01:CURRENT_MONITOR' 'SR02QPS01:BASE_CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2QFA2 ' 'SR02QPS06:CURRENT_MONITOR' 'SR02QPS06:BASE_CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... +'3QFA1 ' 'SR03QPS01:CURRENT_MONITOR' 'SR03QPS01:BASE_CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3QFA2 ' 'SR03QPS06:CURRENT_MONITOR' 'SR03QPS06:BASE_CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4QFA1 ' 'SR04QPS01:CURRENT_MONITOR' 'SR04QPS01:BASE_CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4QFA2 ' 'SR04QPS06:CURRENT_MONITOR' 'SR04QPS06:BASE_CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5QFA1 ' 'SR05QPS01:CURRENT_MONITOR' 'SR05QPS01:BASE_CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5QFA2 ' 'SR05QPS06:CURRENT_MONITOR' 'SR05QPS06:BASE_CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6QFA1 ' 'SR06QPS01:CURRENT_MONITOR' 'SR06QPS01:BASE_CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6QFA2 ' 'SR06QPS06:CURRENT_MONITOR' 'SR06QPS06:BASE_CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7QFA1 ' 'SR07QPS01:CURRENT_MONITOR' 'SR07QPS01:BASE_CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7QFA2 ' 'SR07QPS06:CURRENT_MONITOR' 'SR07QPS06:BASE_CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8QFA1 ' 'SR08QPS01:CURRENT_MONITOR' 'SR08QPS01:BASE_CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8QFA2 ' 'SR08QPS06:CURRENT_MONITOR' 'SR08QPS06:BASE_CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9QFA1 ' 'SR09QPS01:CURRENT_MONITOR' 'SR09QPS01:BASE_CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9QFA2 ' 'SR09QPS06:CURRENT_MONITOR' 'SR09QPS06:BASE_CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10QFA1 ' 'SR10QPS01:CURRENT_MONITOR' 'SR10QPS01:BASE_CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10QFA2 ' 'SR10QPS06:CURRENT_MONITOR' 'SR10QPS06:BASE_CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11QFA1 ' 'SR11QPS01:CURRENT_MONITOR' 'SR11QPS01:BASE_CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11QFA2 ' 'SR11QPS06:CURRENT_MONITOR' 'SR11QPS06:BASE_CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12QFA1 ' 'SR12QPS01:CURRENT_MONITOR' 'SR12QPS01:BASE_CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12QFA2 ' 'SR12QPS06:CURRENT_MONITOR' 'SR12QPS06:BASE_CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13QFA1 ' 'SR13QPS01:CURRENT_MONITOR' 'SR13QPS01:BASE_CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13QFA2 ' 'SR13QPS06:CURRENT_MONITOR' 'SR13QPS06:BASE_CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14QFA1 ' 'SR14QPS01:CURRENT_MONITOR' 'SR14QPS01:BASE_CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14QFA2 ' 'SR14QPS06:CURRENT_MONITOR' 'SR14QPS06:BASE_CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +% Calculate the individual magnet scaling factors from the LOCO run below. +%load c:/middlelayer2/middleLayer/machine/ASP/StorageRingData/User1/LOCO/2010-06-29_after_cycling_to_golden/11-22-12/locoin00.mat +%qfascale = mean(FitParameters(end).Values(1:28))./FitParameters(end).Values(1:28)*1.006893859274983; + + + +% data = load('/asp/usr/middleLayer/machine/ASP/StorageRingData/User1/LOCO/2011-03-27/18-17-53/locoin00.mat','LocoMeasData','FitParameters'); +% qfascale = + +for ii=1:size(qfa,1) +name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; +name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; +name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; +val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; +val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; +val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; +val = 1;%qfascale(ii); % This is the scale factor +AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = 1/val; +AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = 1/val; +AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; + +% Important! This determines the cycling range +AO.QFA.Setpoint.Range(ii,:) = [0 160]; +end + + +% *** QDA *** +AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); +AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; +HW2PhysicsParams = magnetcoefficients('QDA'); +Physics2HWParams = magnetcoefficients('QDA'); + +AO.QDA.Monitor.Mode = Mode; +AO.QDA.Monitor.DataType = 'Scalar'; +AO.QDA.Monitor.Units = 'Hardware'; +AO.QDA.Monitor.HWUnits = 'ampere'; +AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QDA.Monitor.Physics2HWFcn = @k2amp; + +AO.QDA.Setpoint.Mode = Mode; +AO.QDA.Setpoint.DataType = 'Scalar'; +AO.QDA.Setpoint.Units = 'Hardware'; +AO.QDA.Setpoint.HWUnits = 'ampere'; +AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QDA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qda={ +'1QDA1 ' 'SR01QPS02:CURRENT_MONITOR' 'SR01QPS02:BASE_CURRENT_SP ' 1 [1,1] 1 1.0 0.25 ; ... +'1QDA2 ' 'SR01QPS05:CURRENT_MONITOR' 'SR01QPS05:BASE_CURRENT_SP ' 1 [1,2] 2 1.0 0.25 ; ... +'2QDA1 ' 'SR02QPS02:CURRENT_MONITOR' 'SR02QPS02:BASE_CURRENT_SP ' 1 [2,1] 3 1.0 0.25 ; ... +'2QDA2 ' 'SR02QPS05:CURRENT_MONITOR' 'SR02QPS05:BASE_CURRENT_SP ' 1 [2,2] 4 1.0 0.25 ; ... +'3QDA1 ' 'SR03QPS02:CURRENT_MONITOR' 'SR03QPS02:BASE_CURRENT_SP ' 1 [3,1] 5 1.0 0.25 ; ... +'3QDA2 ' 'SR03QPS05:CURRENT_MONITOR' 'SR03QPS05:BASE_CURRENT_SP ' 1 [3,2] 6 1.0 0.25 ; ... +'4QDA1 ' 'SR04QPS02:CURRENT_MONITOR' 'SR04QPS02:BASE_CURRENT_SP ' 1 [4,1] 7 1.0 0.25 ; ... +'4QDA2 ' 'SR04QPS05:CURRENT_MONITOR' 'SR04QPS05:BASE_CURRENT_SP ' 1 [4,2] 8 1.0 0.25 ; ... +'5QDA1 ' 'SR05QPS02:CURRENT_MONITOR' 'SR05QPS02:BASE_CURRENT_SP ' 1 [5,1] 9 1.0 0.25 ; ... +'5QDA2 ' 'SR05QPS05:CURRENT_MONITOR' 'SR05QPS05:BASE_CURRENT_SP ' 1 [5,2] 10 1.0 0.25 ; ... +'6QDA1 ' 'SR06QPS02:CURRENT_MONITOR' 'SR06QPS02:BASE_CURRENT_SP ' 1 [6,1] 11 1.0 0.25 ; ... +'6QDA2 ' 'SR06QPS05:CURRENT_MONITOR' 'SR06QPS05:BASE_CURRENT_SP ' 1 [6,2] 12 1.0 1.00 ; ... +'7QDA1 ' 'SR07QPS02:CURRENT_MONITOR' 'SR07QPS02:BASE_CURRENT_SP ' 1 [7,1] 13 1.0 0.25 ; ... +'7QDA2 ' 'SR07QPS05:CURRENT_MONITOR' 'SR07QPS05:BASE_CURRENT_SP ' 1 [7,2] 14 1.0 0.25 ; ... +'8QDA1 ' 'SR08QPS02:CURRENT_MONITOR' 'SR08QPS02:BASE_CURRENT_SP ' 1 [8,1] 15 1.0 0.25 ; ... +'8QDA2 ' 'SR08QPS05:CURRENT_MONITOR' 'SR08QPS05:BASE_CURRENT_SP ' 1 [8,2] 16 1.0 0.25 ; ... +'9QDA1 ' 'SR09QPS02:CURRENT_MONITOR' 'SR09QPS02:BASE_CURRENT_SP ' 1 [9,1] 17 1.0 0.25 ; ... +'9QDA2 ' 'SR09QPS05:CURRENT_MONITOR' 'SR09QPS05:BASE_CURRENT_SP ' 1 [9,2] 18 1.0 0.25 ; ... +'10QDA1 ' 'SR10QPS02:CURRENT_MONITOR' 'SR10QPS02:BASE_CURRENT_SP ' 1 [10,1] 19 1.0 0.25 ; ... +'10QDA2 ' 'SR10QPS05:CURRENT_MONITOR' 'SR10QPS05:BASE_CURRENT_SP ' 1 [10,2] 20 1.0 0.25 ; ... +'11QDA1 ' 'SR11QPS02:CURRENT_MONITOR' 'SR11QPS02:BASE_CURRENT_SP ' 1 [11,1] 21 1.0 0.25 ; ... +'11QDA2 ' 'SR11QPS05:CURRENT_MONITOR' 'SR11QPS05:BASE_CURRENT_SP ' 1 [11,2] 22 1.0 0.25 ; ... +'12QDA1 ' 'SR12QPS02:CURRENT_MONITOR' 'SR12QPS02:BASE_CURRENT_SP ' 1 [12,1] 23 1.0 0.25 ; ... +'12QDA2 ' 'SR12QPS05:CURRENT_MONITOR' 'SR12QPS05:BASE_CURRENT_SP ' 1 [12,2] 24 1.0 0.25 ; ... +'13QDA1 ' 'SR13QPS02:CURRENT_MONITOR' 'SR13QPS02:BASE_CURRENT_SP ' 1 [13,1] 25 1.0 0.25 ; ... +'13QDA2 ' 'SR13QPS05:CURRENT_MONITOR' 'SR13QPS05:BASE_CURRENT_SP ' 1 [13,2] 26 1.0 0.25 ; ... +'14QDA1 ' 'SR14QPS02:CURRENT_MONITOR' 'SR14QPS02:BASE_CURRENT_SP ' 1 [14,1] 27 1.0 0.25 ; ... +'14QDA2 ' 'SR14QPS05:CURRENT_MONITOR' 'SR14QPS05:BASE_CURRENT_SP ' 1 [14,2] 28 1.0 0.25 ; ... +}; + +% qdascale = mean(FitParameters(end).Values(29:56))./FitParameters(end).Values(29:56); + + +for ii=1:size(qda,1) +name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; +name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; +name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; +val =qda{ii,4}; AO.QDA.Status(ii,1) = val; +val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; +val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; +val =1; %qdascale(ii); % This is the scale factor +AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = 1/val; +AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = 1/val; +AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; + +% Important! This determines the cycling range +AO.QDA.Setpoint.Range(ii,:) = [0 90]; +end + + + +% *** QFB *** +AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); +AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFB'); +Physics2HWParams = magnetcoefficients('QFB'); + +AO.QFB.Monitor.Mode = Mode; +AO.QFB.Monitor.DataType = 'Scalar'; +AO.QFB.Monitor.Units = 'Hardware'; +AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFB.Monitor.Physics2HWFcn = @k2amp; +AO.QFB.Monitor.HWUnits = 'ampere'; +AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; + +AO.QFB.Setpoint.Mode = Mode; +AO.QFB.Setpoint.DataType = 'Scalar'; +AO.QFB.Setpoint.Units = 'Hardware'; +AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFB.Setpoint.Physics2HWFcn = @k2amp; +AO.QFB.Setpoint.HWUnits = 'ampere'; +AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +qfb={ +'1QFB1 ' 'SR01QPS03:CURRENT_MONITOR' 'SR01QPS03:BASE_CURRENT_SP ' 1 [1,1] 1 1.0 0.35 ; ... +'1QFB2 ' 'SR01QPS04:CURRENT_MONITOR' 'SR01QPS04:BASE_CURRENT_SP ' 1 [1,2] 2 1.0 0.35 ; ... +'2QFB1 ' 'SR02QPS03:CURRENT_MONITOR' 'SR02QPS03:BASE_CURRENT_SP ' 1 [2,1] 3 1.0 0.35 ; ... +'2QFB2 ' 'SR02QPS04:CURRENT_MONITOR' 'SR02QPS04:BASE_CURRENT_SP ' 1 [2,2] 4 1.0 0.35 ; ... +'3QFB1 ' 'SR03QPS03:CURRENT_MONITOR' 'SR03QPS03:BASE_CURRENT_SP ' 1 [3,1] 5 1.0 0.35 ; ... +'3QFB2 ' 'SR03QPS04:CURRENT_MONITOR' 'SR03QPS04:BASE_CURRENT_SP ' 1 [3,2] 6 1.0 0.35 ; ... +'4QFB1 ' 'SR04QPS03:CURRENT_MONITOR' 'SR04QPS03:BASE_CURRENT_SP ' 1 [4,1] 7 1.0 0.35 ; ... +'4QFB2 ' 'SR04QPS04:CURRENT_MONITOR' 'SR04QPS04:BASE_CURRENT_SP ' 1 [4,2] 8 1.0 0.35 ; ... +'5QFB1 ' 'SR05QPS03:CURRENT_MONITOR' 'SR05QPS03:BASE_CURRENT_SP ' 1 [5,1] 9 1.0 0.35 ; ... +'5QFB2 ' 'SR05QPS04:CURRENT_MONITOR' 'SR05QPS04:BASE_CURRENT_SP ' 1 [5,2] 10 1.0 0.35 ; ... +'6QFB1 ' 'SR06QPS03:CURRENT_MONITOR' 'SR06QPS03:BASE_CURRENT_SP ' 1 [6,1] 11 1.0 0.35 ; ... +'6QFB2 ' 'SR06QPS04:CURRENT_MONITOR' 'SR06QPS04:BASE_CURRENT_SP ' 1 [6,2] 12 1.0 0.35 ; ... +'7QFB1 ' 'SR07QPS03:CURRENT_MONITOR' 'SR07QPS03:BASE_CURRENT_SP ' 1 [7,1] 13 1.0 0.35 ; ... +'7QFB2 ' 'SR07QPS04:CURRENT_MONITOR' 'SR07QPS04:BASE_CURRENT_SP ' 1 [7,2] 14 1.0 0.35 ; ... +'8QFB1 ' 'SR08QPS03:CURRENT_MONITOR' 'SR08QPS03:BASE_CURRENT_SP ' 1 [8,1] 15 1.0 0.35 ; ... +'8QFB2 ' 'SR08QPS04:CURRENT_MONITOR' 'SR08QPS04:BASE_CURRENT_SP ' 1 [8,2] 16 1.0 0.35 ; ... +'9QFB1 ' 'SR09QPS03:CURRENT_MONITOR' 'SR09QPS03:BASE_CURRENT_SP ' 1 [9,1] 17 1.0 0.35 ; ... +'9QFB2 ' 'SR09QPS04:CURRENT_MONITOR' 'SR09QPS04:BASE_CURRENT_SP ' 1 [9,2] 18 1.0 0.35 ; ... +'10QFB1 ' 'SR10QPS03:CURRENT_MONITOR' 'SR10QPS03:BASE_CURRENT_SP ' 1 [10,1] 19 1.0 0.35 ; ... +'10QFB2 ' 'SR10QPS04:CURRENT_MONITOR' 'SR10QPS04:BASE_CURRENT_SP ' 1 [10,2] 20 1.0 0.35 ; ... +'11QFB1 ' 'SR11QPS03:CURRENT_MONITOR' 'SR11QPS03:BASE_CURRENT_SP ' 1 [11,1] 21 1.0 0.35 ; ... +'11QFB2 ' 'SR11QPS04:CURRENT_MONITOR' 'SR11QPS04:BASE_CURRENT_SP ' 1 [11,2] 22 1.0 0.35 ; ... +'12QFB1 ' 'SR12QPS03:CURRENT_MONITOR' 'SR12QPS03:BASE_CURRENT_SP ' 1 [12,1] 23 1.0 0.35 ; ... +'12QFB2 ' 'SR12QPS04:CURRENT_MONITOR' 'SR12QPS04:BASE_CURRENT_SP ' 1 [12,2] 24 1.0 0.35 ; ... +'13QFB1 ' 'SR13QPS03:CURRENT_MONITOR' 'SR13QPS03:BASE_CURRENT_SP ' 1 [13,1] 25 1.0 0.35 ; ... +'13QFB2 ' 'SR13QPS04:CURRENT_MONITOR' 'SR13QPS04:BASE_CURRENT_SP ' 1 [13,2] 26 1.0 0.35 ; ... +'14QFB1 ' 'SR14QPS03:CURRENT_MONITOR' 'SR14QPS03:BASE_CURRENT_SP ' 1 [14,1] 27 1.0 0.35 ; ... +'14QFB2 ' 'SR14QPS04:CURRENT_MONITOR' 'SR14QPS04:BASE_CURRENT_SP ' 1 [14,2] 28 1.0 0.35 ; ... +}; + +% qfbscale = mean(FitParameters(end).Values(57:84))./FitParameters(end).Values(57:84); + +for ii=1:size(qfb,1) +name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; +name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; +name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; +val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; +val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; +val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; +val =1; %qfbscale(ii); % This is the scale factor +AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = 1/val; +AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = 1/val; +AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; + +% Important! This determines the cycling range +AO.QFB.Setpoint.Range(ii,:) = [0 160]; +end + + +%=============== +%Sextupole data +%=============== +% *** SFA *** +AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); +AO.SFA.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFA'); +Physics2HWParams = magnetcoefficients('SFA'); + +AO.SFA.Monitor.Mode = Mode; +AO.SFA.Monitor.DataType = 'Scalar'; +AO.SFA.Monitor.Units = 'Hardware'; +AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFA.Monitor.Physics2HWFcn = @k2amp; +AO.SFA.Monitor.HWUnits = 'ampere'; +AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFA.Setpoint.Mode = Mode; +AO.SFA.Setpoint.DataType = 'Scalar'; +AO.SFA.Setpoint.Units = 'Hardware'; +AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFA.Setpoint.Physics2HWFcn = @k2amp; +AO.SFA.Setpoint.HWUnits = 'ampere'; +AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfa={ +'1SFA1 ' 'SR01SPS01:CURRENT_MONITOR' 'SR01SPS01:BASE_CURRENT_SP ' 1 [1,1] 1 1.0 0.15 ; ... +'1SFA2 ' 'SR01SPS07:CURRENT_MONITOR' 'SR01SPS07:BASE_CURRENT_SP ' 1 [1,2] 2 1.0 0.15 ; ... +'2SFA1 ' 'SR02SPS01:CURRENT_MONITOR' 'SR02SPS01:BASE_CURRENT_SP ' 1 [2,1] 3 1.0 0.15 ; ... +'2SFA2 ' 'SR02SPS07:CURRENT_MONITOR' 'SR02SPS07:BASE_CURRENT_SP ' 1 [2,2] 4 1.0 0.15 ; ... +'3SFA1 ' 'SR03SPS01:CURRENT_MONITOR' 'SR03SPS01:BASE_CURRENT_SP ' 1 [3,1] 5 1.0 0.15 ; ... +'3SFA2 ' 'SR03SPS07:CURRENT_MONITOR' 'SR03SPS07:BASE_CURRENT_SP ' 1 [3,2] 6 1.0 0.15 ; ... +'4SFA1 ' 'SR04SPS01:CURRENT_MONITOR' 'SR04SPS01:BASE_CURRENT_SP ' 1 [4,1] 7 1.0 0.15 ; ... +'4SFA2 ' 'SR04SPS07:CURRENT_MONITOR' 'SR04SPS07:BASE_CURRENT_SP ' 1 [4,2] 8 1.0 0.15 ; ... +'5SFA1 ' 'SR05SPS01:CURRENT_MONITOR' 'SR05SPS01:BASE_CURRENT_SP ' 1 [5,1] 9 1.0 0.15 ; ... +'5SFA2 ' 'SR05SPS07:CURRENT_MONITOR' 'SR05SPS07:BASE_CURRENT_SP ' 1 [5,2] 10 1.0 0.15 ; ... +'6SFA1 ' 'SR06SPS01:CURRENT_MONITOR' 'SR06SPS01:BASE_CURRENT_SP ' 1 [6,1] 11 1.0 0.15 ; ... +'6SFA2 ' 'SR06SPS07:CURRENT_MONITOR' 'SR06SPS07:BASE_CURRENT_SP ' 1 [6,2] 12 1.0 0.15 ; ... +'7SFA1 ' 'SR07SPS01:CURRENT_MONITOR' 'SR07SPS01:BASE_CURRENT_SP ' 1 [7,1] 13 1.0 0.15 ; ... +'7SFA2 ' 'SR07SPS07:CURRENT_MONITOR' 'SR07SPS07:BASE_CURRENT_SP ' 1 [7,2] 14 1.0 0.15 ; ... +'8SFA1 ' 'SR08SPS01:CURRENT_MONITOR' 'SR08SPS01:BASE_CURRENT_SP ' 1 [8,1] 15 1.0 0.15 ; ... +'8SFA2 ' 'SR08SPS07:CURRENT_MONITOR' 'SR08SPS07:BASE_CURRENT_SP ' 1 [8,2] 16 1.0 0.15 ; ... +'9SFA1 ' 'SR09SPS01:CURRENT_MONITOR' 'SR09SPS01:BASE_CURRENT_SP ' 1 [9,1] 17 1.0 0.15 ; ... +'9SFA2 ' 'SR09SPS07:CURRENT_MONITOR' 'SR09SPS07:BASE_CURRENT_SP ' 1 [9,2] 18 1.0 0.15 ; ... +'10SFA1 ' 'SR10SPS01:CURRENT_MONITOR' 'SR10SPS01:BASE_CURRENT_SP ' 1 [10,1] 19 1.0 0.15 ; ... +'10SFA2 ' 'SR10SPS07:CURRENT_MONITOR' 'SR10SPS07:BASE_CURRENT_SP ' 1 [10,2] 20 1.0 0.15 ; ... +'11SFA1 ' 'SR11SPS01:CURRENT_MONITOR' 'SR11SPS01:BASE_CURRENT_SP ' 1 [11,1] 21 1.0 0.15 ; ... +'11SFA2 ' 'SR11SPS07:CURRENT_MONITOR' 'SR11SPS07:BASE_CURRENT_SP ' 1 [11,2] 22 1.0 0.15 ; ... +'12SFA1 ' 'SR12SPS01:CURRENT_MONITOR' 'SR12SPS01:BASE_CURRENT_SP ' 1 [12,1] 23 1.0 0.15 ; ... +'12SFA2 ' 'SR12SPS07:CURRENT_MONITOR' 'SR12SPS07:BASE_CURRENT_SP ' 1 [12,2] 24 1.0 0.15 ; ... +'13SFA1 ' 'SR13SPS01:CURRENT_MONITOR' 'SR13SPS01:BASE_CURRENT_SP ' 1 [13,1] 25 1.0 0.15 ; ... +'13SFA2 ' 'SR13SPS07:CURRENT_MONITOR' 'SR13SPS07:BASE_CURRENT_SP ' 1 [13,2] 26 1.0 0.15 ; ... +'14SFA1 ' 'SR14SPS01:CURRENT_MONITOR' 'SR14SPS01:BASE_CURRENT_SP ' 1 [14,1] 27 1.0 0.15 ; ... +'14SFA2 ' 'SR14SPS07:CURRENT_MONITOR' 'SR14SPS07:BASE_CURRENT_SP ' 1 [14,2] 28 1.0 0.15 ; ... +}; + +for ii=1:size(sfa,1) +name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; +name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; +name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; +val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; +val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; +val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; +val =sfa{ii,7}; % This is the scale factor +AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; + +% AO.SFA.Setpoint.Range(ii,:) = [0 90]; +AO.SFA.Setpoint.Range(ii,:) = [0 120]; +end + + + +% *** SDA *** +AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); +AO.SDA.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'MachineConfig'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDA'); +Physics2HWParams = magnetcoefficients('SDA'); +AO.SDA.Monitor.Mode = Mode; +AO.SDA.Monitor.DataType = 'Scalar'; +AO.SDA.Monitor.Units = 'Hardware'; +AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDA.Monitor.Physics2HWFcn = @k2amp; +AO.SDA.Monitor.HWUnits = 'ampere'; +AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDA.Setpoint.Mode = Mode; +AO.SDA.Setpoint.DataType = 'Scalar'; +AO.SDA.Setpoint.Units = 'Hardware'; +AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDA.Setpoint.Physics2HWFcn = @k2amp; +AO.SDA.Setpoint.HWUnits = 'ampere'; +AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; + + +% common monitor setpoint stat devlist elem scale tol +sda={ +'1SDA1 ' 'SR01SPS02:CURRENT_MONITOR' 'SR01SPS02:BASE_CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... +'1SDA2 ' 'SR01SPS06:CURRENT_MONITOR' 'SR01SPS06:BASE_CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... +'2SDA1 ' 'SR02SPS02:CURRENT_MONITOR' 'SR02SPS02:BASE_CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... +'2SDA2 ' 'SR02SPS06:CURRENT_MONITOR' 'SR02SPS06:BASE_CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... +'3SDA1 ' 'SR03SPS02:CURRENT_MONITOR' 'SR03SPS02:BASE_CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... +'3SDA2 ' 'SR03SPS06:CURRENT_MONITOR' 'SR03SPS06:BASE_CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... +'4SDA1 ' 'SR04SPS02:CURRENT_MONITOR' 'SR04SPS02:BASE_CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... +'4SDA2 ' 'SR04SPS06:CURRENT_MONITOR' 'SR04SPS06:BASE_CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... +'5SDA1 ' 'SR05SPS02:CURRENT_MONITOR' 'SR05SPS02:BASE_CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... +'5SDA2 ' 'SR05SPS06:CURRENT_MONITOR' 'SR05SPS06:BASE_CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... +'6SDA1 ' 'SR06SPS02:CURRENT_MONITOR' 'SR06SPS02:BASE_CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... +'6SDA2 ' 'SR06SPS06:CURRENT_MONITOR' 'SR06SPS06:BASE_CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... +'7SDA1 ' 'SR07SPS02:CURRENT_MONITOR' 'SR07SPS02:BASE_CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... +'7SDA2 ' 'SR07SPS06:CURRENT_MONITOR' 'SR07SPS06:BASE_CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... +'8SDA1 ' 'SR08SPS02:CURRENT_MONITOR' 'SR08SPS02:BASE_CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... +'8SDA2 ' 'SR08SPS06:CURRENT_MONITOR' 'SR08SPS06:BASE_CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... +'9SDA1 ' 'SR09SPS02:CURRENT_MONITOR' 'SR09SPS02:BASE_CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... +'9SDA2 ' 'SR09SPS06:CURRENT_MONITOR' 'SR09SPS06:BASE_CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... +'10SDA1 ' 'SR10SPS02:CURRENT_MONITOR' 'SR10SPS02:BASE_CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... +'10SDA2 ' 'SR10SPS06:CURRENT_MONITOR' 'SR10SPS06:BASE_CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... +'11SDA1 ' 'SR11SPS02:CURRENT_MONITOR' 'SR11SPS02:BASE_CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... +'11SDA2 ' 'SR11SPS06:CURRENT_MONITOR' 'SR11SPS06:BASE_CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... +'12SDA1 ' 'SR12SPS02:CURRENT_MONITOR' 'SR12SPS02:BASE_CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... +'12SDA2 ' 'SR12SPS06:CURRENT_MONITOR' 'SR12SPS06:BASE_CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... +'13SDA1 ' 'SR13SPS02:CURRENT_MONITOR' 'SR13SPS02:BASE_CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... +'13SDA2 ' 'SR13SPS06:CURRENT_MONITOR' 'SR13SPS06:BASE_CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... +'14SDA1 ' 'SR14SPS02:CURRENT_MONITOR' 'SR14SPS02:BASE_CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... +'14SDA2 ' 'SR14SPS06:CURRENT_MONITOR' 'SR14SPS06:BASE_CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... +}; + +for ii=1:size(sda,1) +name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; +name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; +name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; +val =sda{ii,4}; AO.SDA.Status(ii,1) = val; +val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; +val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; +val =sda{ii,7}; % This is the scale factor +AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; + +% AO.SDA.Setpoint.Range(ii,:) = [0 90]; +AO.SDA.Setpoint.Range(ii,:) = [0 120]; +end + + +% *** SDB *** +AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); +AO.SDB.MemberOf = {'PlotFamily'; 'SD'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDB'); +Physics2HWParams = magnetcoefficients('SDB'); +AO.SDB.Monitor.Mode = Mode; +AO.SDB.Monitor.DataType = 'Scalar'; +AO.SDB.Monitor.Units = 'Hardware'; +AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDB.Monitor.Physics2HWFcn = @k2amp; +AO.SDB.Monitor.HWUnits = 'ampere'; +AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDB.Setpoint.Mode = Mode; +AO.SDB.Setpoint.DataType = 'Scalar'; +AO.SDB.Setpoint.Units = 'Hardware'; +AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDB.Setpoint.Physics2HWFcn = @k2amp; +AO.SDB.Setpoint.HWUnits = 'ampere'; +AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sdb={ +'1SDB1 ' 'SR01SPS03:CURRENT_MONITOR' 'SR01SPS03:BASE_CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... +'1SDB2 ' 'SR01SPS05:CURRENT_MONITOR' 'SR01SPS05:BASE_CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... +'2SDB1 ' 'SR02SPS03:CURRENT_MONITOR' 'SR02SPS03:BASE_CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... +'2SDB2 ' 'SR02SPS05:CURRENT_MONITOR' 'SR02SPS05:BASE_CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... +'3SDB1 ' 'SR03SPS03:CURRENT_MONITOR' 'SR03SPS03:BASE_CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... +'3SDB2 ' 'SR03SPS05:CURRENT_MONITOR' 'SR03SPS05:BASE_CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... +'4SDB1 ' 'SR04SPS03:CURRENT_MONITOR' 'SR04SPS03:BASE_CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... +'4SDB2 ' 'SR04SPS05:CURRENT_MONITOR' 'SR04SPS05:BASE_CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... +'5SDB1 ' 'SR05SPS03:CURRENT_MONITOR' 'SR05SPS03:BASE_CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... +'5SDB2 ' 'SR05SPS05:CURRENT_MONITOR' 'SR05SPS05:BASE_CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... +'6SDB1 ' 'SR06SPS03:CURRENT_MONITOR' 'SR06SPS03:BASE_CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... +'6SDB2 ' 'SR06SPS05:CURRENT_MONITOR' 'SR06SPS05:BASE_CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... +'7SDB1 ' 'SR07SPS03:CURRENT_MONITOR' 'SR07SPS03:BASE_CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... +'7SDB2 ' 'SR07SPS05:CURRENT_MONITOR' 'SR07SPS05:BASE_CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... +'8SDB1 ' 'SR08SPS03:CURRENT_MONITOR' 'SR08SPS03:BASE_CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... +'8SDB2 ' 'SR08SPS05:CURRENT_MONITOR' 'SR08SPS05:BASE_CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... +'9SDB1 ' 'SR09SPS03:CURRENT_MONITOR' 'SR09SPS03:BASE_CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... +'9SDB2 ' 'SR09SPS05:CURRENT_MONITOR' 'SR09SPS05:BASE_CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... +'10SDB1 ' 'SR10SPS03:CURRENT_MONITOR' 'SR10SPS03:BASE_CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... +'10SDB2 ' 'SR10SPS05:CURRENT_MONITOR' 'SR10SPS05:BASE_CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... +'11SDB1 ' 'SR11SPS03:CURRENT_MONITOR' 'SR11SPS03:BASE_CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... +'11SDB2 ' 'SR11SPS05:CURRENT_MONITOR' 'SR11SPS05:BASE_CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... +'12SDB1 ' 'SR12SPS03:CURRENT_MONITOR' 'SR12SPS03:BASE_CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... +'12SDB2 ' 'SR12SPS05:CURRENT_MONITOR' 'SR12SPS05:BASE_CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... +'13SDB1 ' 'SR13SPS03:CURRENT_MONITOR' 'SR13SPS03:BASE_CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... +'13SDB2 ' 'SR13SPS05:CURRENT_MONITOR' 'SR13SPS05:BASE_CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... +'14SDB1 ' 'SR14SPS03:CURRENT_MONITOR' 'SR14SPS03:BASE_CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... +'14SDB2 ' 'SR14SPS05:CURRENT_MONITOR' 'SR14SPS05:BASE_CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... +}; + +for ii=1:size(sdb,1) +name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; +name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; +name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; +val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; +val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; +val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; +val =sdb{ii,7}; % This is the scale factor +AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; + +% AO.SDB.Setpoint.Range(ii,:) = [0 80]; +AO.SDB.Setpoint.Range(ii,:) = [0 120]; +end + + + +% *** SFB *** +AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); +AO.SFB.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFB'); +Physics2HWParams = magnetcoefficients('SFB'); + +AO.SFB.Monitor.Mode = Mode; +AO.SFB.Monitor.DataType = 'Scalar'; +AO.SFB.Monitor.Units = 'Hardware'; +AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFB.Monitor.Physics2HWFcn = @k2amp; +AO.SFB.Monitor.HWUnits = 'ampere'; +AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFB.Setpoint.Mode = Mode; +AO.SFB.Setpoint.DataType = 'Scalar'; +AO.SFB.Setpoint.Units = 'Hardware'; +AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFB.Setpoint.Physics2HWFcn = @k2amp; +AO.SFB.Setpoint.HWUnits = 'ampere'; +AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfb={ +'1SFB1 ' 'SR01SPS04:CURRENT_MONITOR' 'SR01SPS04:BASE_CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... +'2SFB1 ' 'SR02SPS04:CURRENT_MONITOR' 'SR02SPS04:BASE_CURRENT_SP ' 1 [2,1] 2 1.0 0.2 ; ... +'3SFB1 ' 'SR03SPS04:CURRENT_MONITOR' 'SR03SPS04:BASE_CURRENT_SP ' 1 [3,1] 3 1.0 0.2 ; ... +'4SFB1 ' 'SR04SPS04:CURRENT_MONITOR' 'SR04SPS04:BASE_CURRENT_SP ' 1 [4,1] 4 1.0 0.2 ; ... +'5SFB1 ' 'SR05SPS04:CURRENT_MONITOR' 'SR05SPS04:BASE_CURRENT_SP ' 1 [5,1] 5 1.0 0.2 ; ... +'6SFB1 ' 'SR06SPS04:CURRENT_MONITOR' 'SR06SPS04:BASE_CURRENT_SP ' 1 [6,1] 6 1.0 0.2 ; ... +'7SFB1 ' 'SR07SPS04:CURRENT_MONITOR' 'SR07SPS04:BASE_CURRENT_SP ' 1 [7,1] 7 1.0 0.2 ; ... +'8SFB1 ' 'SR08SPS04:CURRENT_MONITOR' 'SR08SPS04:BASE_CURRENT_SP ' 1 [8,1] 8 1.0 0.2 ; ... +'9SFB1 ' 'SR09SPS04:CURRENT_MONITOR' 'SR09SPS04:BASE_CURRENT_SP ' 1 [9,1] 9 1.0 0.2 ; ... +'10SFB1 ' 'SR10SPS04:CURRENT_MONITOR' 'SR10SPS04:BASE_CURRENT_SP ' 1 [10,1] 10 1.0 0.2 ; ... +'11SFB1 ' 'SR11SPS04:CURRENT_MONITOR' 'SR11SPS04:BASE_CURRENT_SP ' 1 [11,1] 11 1.0 0.2 ; ... +'12SFB1 ' 'SR12SPS04:CURRENT_MONITOR' 'SR12SPS04:BASE_CURRENT_SP ' 1 [12,1] 12 1.0 0.2 ; ... +'13SFB1 ' 'SR13SPS04:CURRENT_MONITOR' 'SR13SPS04:BASE_CURRENT_SP ' 1 [13,1] 13 1.0 0.2 ; ... +'14SFB1 ' 'SR14SPS04:CURRENT_MONITOR' 'SR14SPS04:BASE_CURRENT_SP ' 1 [14,1] 14 1.0 0.2 ; ... +}; + +for ii=1:size(sfb,1) +name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; +name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; +name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; +val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; +val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; +val =sfb{ii,6}; AO.SFB.ElementList(ii,1) = val; +val =sfb{ii,7}; % This is the scale factor +AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; + +% AO.SFB.Setpoint.Range(ii,:) = [0 60]; +AO.SFB.Setpoint.Range(ii,:) = [0 120]; +end + +%=============== +%Skew Quad data +%=============== +% *** Skew quadrupoles *** 2005/09/27 Eugene +AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); +AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('SKQ'); +Physics2HWParams = magnetcoefficients('SKQ'); + +AO.SKQ.Monitor.Mode = Mode; +AO.SKQ.Monitor.DataType = 'Scalar'; +AO.SKQ.Monitor.Units = 'Hardware'; +AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; +AO.SKQ.Monitor.Physics2HWFcn = @k2amp; +AO.SKQ.Monitor.HWUnits = 'ampere'; +AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; + +AO.SKQ.Setpoint.Mode = Mode; +AO.SKQ.Setpoint.DataType = 'Scalar'; +AO.SKQ.Setpoint.Units = 'Hardware'; +AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; +AO.SKQ.Setpoint.HWUnits = 'ampere'; +AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +sq={ +'1SKQ1 ' 'SR01CPS03:CURRENT_MONITOR' 'SR01CPS03:BASE_CURRENT_SP ' 1 [1,1] 1 0.2 ; ... +'1SKQ2 ' 'SR01CPS08:CURRENT_MONITOR' 'SR01CPS08:BASE_CURRENT_SP ' 1 [1,2] 2 0.2 ; ... +'2SKQ1 ' 'SR02CPS03:CURRENT_MONITOR' 'SR02CPS03:BASE_CURRENT_SP ' 1 [2,1] 3 0.2 ; ... +'2SKQ2 ' 'SR02CPS08:CURRENT_MONITOR' 'SR02CPS08:BASE_CURRENT_SP ' 1 [2,2] 4 0.2 ; ... +'3SKQ1 ' 'SR03CPS03:CURRENT_MONITOR' 'SR03CPS03:BASE_CURRENT_SP ' 1 [3,1] 5 0.2 ; ... +'3SKQ2 ' 'SR03CPS08:CURRENT_MONITOR' 'SR03CPS08:BASE_CURRENT_SP ' 1 [3,2] 6 0.2 ; ... +'4SKQ1 ' 'SR04CPS03:CURRENT_MONITOR' 'SR04CPS03:BASE_CURRENT_SP ' 1 [4,1] 7 0.2 ; ... +'4SKQ2 ' 'SR04CPS08:CURRENT_MONITOR' 'SR04CPS08:BASE_CURRENT_SP ' 1 [4,2] 8 0.2 ; ... +'5SKQ1 ' 'SR05CPS03:CURRENT_MONITOR' 'SR05CPS03:BASE_CURRENT_SP ' 1 [5,1] 9 0.2 ; ... +'5SKQ2 ' 'SR05CPS08:CURRENT_MONITOR' 'SR05CPS08:BASE_CURRENT_SP ' 1 [5,2] 10 0.2 ; ... +'6SKQ1 ' 'SR06CPS03:CURRENT_MONITOR' 'SR06CPS03:BASE_CURRENT_SP ' 1 [6,1] 11 0.2 ; ... +'6SKQ2 ' 'SR06CPS08:CURRENT_MONITOR' 'SR06CPS08:BASE_CURRENT_SP ' 1 [6,2] 12 0.2 ; ... +'7SKQ1 ' 'SR07CPS03:CURRENT_MONITOR' 'SR07CPS03:BASE_CURRENT_SP ' 1 [7,1] 13 0.2 ; ... +'7SKQ2 ' 'SR07CPS08:CURRENT_MONITOR' 'SR07CPS08:BASE_CURRENT_SP ' 1 [7,2] 14 0.2 ; ... +'8SKQ1 ' 'SR08CPS03:CURRENT_MONITOR' 'SR08CPS03:BASE_CURRENT_SP ' 1 [8,1] 15 0.2 ; ... +'8SKQ2 ' 'SR08CPS08:CURRENT_MONITOR' 'SR08CPS08:BASE_CURRENT_SP ' 1 [8,2] 16 0.2 ; ... +'9SKQ1 ' 'SR09CPS03:CURRENT_MONITOR' 'SR09CPS03:BASE_CURRENT_SP ' 1 [9,1] 17 0.2 ; ... +'9SKQ2 ' 'SR09CPS08:CURRENT_MONITOR' 'SR09CPS08:BASE_CURRENT_SP ' 1 [9,2] 18 0.2 ; ... +'10SKQ1 ' 'SR10CPS03:CURRENT_MONITOR' 'SR10CPS03:BASE_CURRENT_SP ' 1 [10,1] 19 0.2 ; ... +'10SKQ2 ' 'SR10CPS08:CURRENT_MONITOR' 'SR10CPS08:BASE_CURRENT_SP ' 1 [10,2] 20 0.2 ; ... +'11SKQ1 ' 'SR11CPS03:CURRENT_MONITOR' 'SR11CPS03:BASE_CURRENT_SP ' 1 [11,1] 21 0.2 ; ... +'11SKQ2 ' 'SR11CPS08:CURRENT_MONITOR' 'SR11CPS08:BASE_CURRENT_SP ' 1 [11,2] 22 0.2 ; ... +'12SKQ1 ' 'SR12CPS03:CURRENT_MONITOR' 'SR12CPS03:BASE_CURRENT_SP ' 1 [12,1] 23 0.2 ; ... +'12SKQ2 ' 'SR12CPS08:CURRENT_MONITOR' 'SR12CPS08:BASE_CURRENT_SP ' 1 [12,2] 24 0.2 ; ... +'13SKQ1 ' 'SR13CPS03:CURRENT_MONITOR' 'SR13CPS03:BASE_CURRENT_SP ' 1 [13,1] 25 0.2 ; ... +'13SKQ2 ' 'SR13CPS08:CURRENT_MONITOR' 'SR13CPS08:BASE_CURRENT_SP ' 1 [13,2] 26 0.2 ; ... +'14SKQ1 ' 'SR14CPS03:CURRENT_MONITOR' 'SR14CPS03:BASE_CURRENT_SP ' 1 [14,1] 27 0.2 ; ... +'14SKQ2 ' 'SR14CPS08:CURRENT_MONITOR' 'SR14CPS08:BASE_CURRENT_SP ' 1 [14,2] 28 0.2 ; ... +}; + +for ii=1:size(sq,1) +name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; +name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; +name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; +val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; +val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; +val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; +val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; +AO.SKQ.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SKQ.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SKQ.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SKQ.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; + +AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; +end + + +%=============== +%Kicker data +%=============== +AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); +AO.KICK.MemberOf = {'Injection'; 'MachineConfig'; 'Plotfamily'; 'HCM'; 'Horizontal'}; + +AO.KICK.Monitor.Mode = Mode; +AO.KICK.Monitor.DataType = 'Scalar'; +AO.KICK.Monitor.Units = 'Hardware'; +AO.KICK.Monitor.HWUnits = 'kVolts'; +AO.KICK.Monitor.PhysicsUnits = 'mradian'; + +AO.KICK.Setpoint.Mode = Mode; +AO.KICK.Setpoint.DataType = 'Scalar'; +AO.KICK.Setpoint.Units = 'Hardware'; +AO.KICK.Setpoint.HWUnits = 'Volts'; +AO.KICK.Setpoint.PhysicsUnits = 'radian'; + +AO.KICK.Delay.Mode = Mode; +AO.KICK.Delay.MemberOf = {'MachineConfig'}; +AO.KICK.Delay.DataType = 'Scalar'; +AO.KICK.Delay.Units = 'Hardware'; +AO.KICK.Delay.HWUnits = 'Second'; +AO.KICK.Delay.PhysicsUnits = 'Second'; + + +% From kicker deisgn review the kickers are rated to 4380 Amps giving 0.038 +% Tesla converting this to kickangle. Also convert voltage into amps for +% the conversion? +% +% 2780 V on the capacitor banks will create 5240 A delivered to the kicker +% magnets. +% From simulations 4380 A creates 0.038607 T over a length of 0.7 m. +% Therefore 4380 A => 2.7006 mrad. Therefore 2323.740 V => 2.7006 mrad. +% HW2PHYSICS conversion factor (kV to rad) is therefore 0.0027006/2.32374 = +% 0.00116217821271. The Ps also goes through a 1:3 transformer therefore +% the conversion factor increases by 3. Ie 0.00348653463813 +% For V to rad then 0.00000348653463813. +% hw2physics_conversionfactor = 0.00000348653463813; + +% Factory test reports give a 1200 v (1223 V average) setting on the panel +% gives 4200 A. The curve is pretty much linear up to 1000 V, after which +% it starts to taper off. Data for one of the curves is shown below. The +% conversion factor for this data is 2.1366e-6. +% v = [139 378 618 860 984 1111 1249 1396]; +% a = [420 1260 2100 2940 3360 3780 4200 4620]; +% mrad = a*0.0027006/4380; +% figure; plot(v,mrad,'.-') +% conversiontfactor = (mrad(5)-mrad(2))/(v(5) - v(2)); + +% Measured (before fixing the kicker charging unit) +% Kicker1 100 V = 0.176 mrad +% Kicker2 100 V = -0.138 mrad +% Kicker3 100 V = -0.134 mrad +% Kicker4 100 V = 0.176 mrad + +%common monitor setpoint kickerdelay stat devlist elem tol +kickeramp={ +'KICK1 ' 'SR14KPS01:VOLTAGE_MONITOR' 'SR14KPS01:VOLTAGE_SP ' 'TS01EVR06:TTL00_TIME_DELAY_SP' 1 [1,1] 1 0.10 ; ... +'KICK2 ' 'SR01KPS01:VOLTAGE_MONITOR' 'SR01KPS01:VOLTAGE_SP ' 'TS01EVR06:TTL01_TIME_DELAY_SP' 1 [1,2] 2 0.10 ; ... +'KICK3 ' 'SR01KPS02:VOLTAGE_MONITOR' 'SR01KPS02:VOLTAGE_SP ' 'TS01EVR06:TTL02_TIME_DELAY_SP' 1 [1,3] 3 0.10 ; ... +'KICK4 ' 'SR02KPS01:VOLTAGE_MONITOR' 'SR02KPS01:VOLTAGE_SP ' 'TS01EVR06:TTL03_TIME_DELAY_SP' 1 [1,4] 4 0.10 ; ... +}; + +for ii=1:size(kickeramp,1) +name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; +name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; +name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; +name=kickeramp{ii,4}; AO.KICK.Delay.ChannelNames(ii,:) = name; +val =kickeramp{ii,5}; AO.KICK.Status(ii,1) = val; +val =kickeramp{ii,6}; AO.KICK.DeviceList(ii,:) = val; +val =kickeramp{ii,7}; AO.KICK.ElementList(ii,1) = val; +val =kickeramp{ii,8}; AO.KICK.Setpoint.Tolerance(ii,1) = val; + +% changed back to one calibration value after kickers 2 and 3 had their +% charging units repaired +% Mark Boland 2007-09-17 +if ii==2 || ii==3 + isign = -1; +else + isign = 1; +end +% scaling factor 0.72 arrived by comparing measured with dynamic model +% where the kick strenght changes like a half sin function. +hw2physics_conversionfactor = isign*1.7600e-06*0.7211; +AO.KICK.Monitor.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; +AO.KICK.Monitor.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; +AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; +AO.KICK.Setpoint.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; +AO.KICK.Setpoint.Range(ii,:) = [-1300 +1300]; +AO.KICK.Delay.HW2PhysicsParams(ii,:) = 1; +AO.KICK.Delay.Physics2HWParams(ii,:) = 1; +AO.KICK.Delay.Range(ii,:) = [0 1]; +end + +% Add kick profile for dynamic modelling +% Kick profile from measured data to be used as the profile for the kickers +t = [-0.1 -0.05 0 0.4 1 2 2.5 4 4.8 5.0 5.2 5.4 6.0 7.05 7.1]*1e-6; +amp = [0 0 0 1000 3000 5500 5900 3000 -200 -400 0 50 0 0 0]; +tspline = [-0.1:0.05:7.1]*1e-6; +ampspline = spline(t,amp,tspline); +tspline = [tspline(1)-1.5e-6, tspline, tspline(end)+0.720e-6*10]; % add zeros to ends for interpolation +ampspline = [0, ampspline, 0]; + +AO.KICK.profile_t = tspline; +AO.KICK.profile_amp = ampspline/max(ampspline); % Normalise profile + + +% *** KICK Delay *** +% AO.KICK.Delay +% >> removed >> see previous versions if info needed + + +%============ +%RF System +%============ +AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); +AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +%-------------------------------- 4 cavity Case +%common stat devlist elem +rfcommon={ +'RF1 ' 1 [1,1] 1 ; ... +'RF2 ' 1 [1,2] 2 ; ... +'RF3 ' 1 [1,3] 3 ; ... +'RF4 ' 1 [1,4] 4 ; ... + }; + +% Set frequency range to be +-30kHz (dP/P = +-2.8%) about 499.674 MHz +%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance +rffreq={ +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [499.644e6 499.704e6] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [499.644e6 499.704e6] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [499.644e6 499.704e6] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [499.644e6 499.704e6] 100.0; ... + }; + +% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfphase={ +'SRF1:STN:PHASE' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... +'SRF2:STN:PHASE' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... +'SRF3:STN:PHASE' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... +'SRF4:STN:PHASE' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... + }; + +% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfvolt_sp={ +'SR06RF01CAV01:VOLTAGE_REFERENCE_SP' 754.3/677; ... +'SR06RF02CAV01:VOLTAGE_REFERENCE_SP' 748.1/664; ... +'SR07RF01CAV01:VOLTAGE_REFERENCE_SP' 753.4/687; ... +'SR07RF02CAV01:VOLTAGE_REFERENCE_SP' 754.4/698; ... + }; +rfvolt_monitor={ +'SR06RF01CAV01:VOLTAGE_MONITOR' 754.3/707.7; ... +'SR06RF02CAV01:VOLTAGE_MONITOR' 748.1/701.5; ... +'SR07RF01CAV01:VOLTAGE_MONITOR' 753.4/726.2; ... +'SR07RF02CAV01:VOLTAGE_MONITOR' 754.4/727.7; ... + }; + +% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance +rfpower={ +'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SR06RF01CAV01:FWD_MONITOR' 'SR06RF01KLY01:FWD_MONITOR' 1 1 [-inf inf] inf ; ... +'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SR06RF02CAV01:FWD_MONITOR' 'SR06RF02KLY01:FWD_MONITOR' 1 1 [-inf inf] inf ; ... +'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SR07RF01CAV01:FWD_MONITOR' 'SR07RF01KLY01:FWD_MONITOR' 1 1 [-inf inf] inf ; ... +'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SR07RF02CAV01:FWD_MONITOR' 'SR07RF02KLY01:FWD_MONITOR' 1 1 [-inf inf] inf ; ... + }; + +for ii=1:size(rfcommon,1) +name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; +val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; +val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; +val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; +end + +for ii=1:size(rffreq,1) +name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; +name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; +val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; + AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; +val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; + AO.RF.Setpoint.Physics2HWParams(ii,1) = val; +val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; +val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfphase,1) +name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; +name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; +val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Phase.HW2PhysicsParams(ii,1) = val; +val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Phase.Physics2HWParams(ii,1) = val; +val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; + AO.RF.Phase.Range(ii,:) = val; +val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; + AO.RF.Phase.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfvolt_sp,1) +AO.RF.VoltageSP.ChannelNames(ii,:) = rfvolt_sp{ii,1}; +AO.RF.Voltage.ChannelNames(ii,:) = rfvolt_monitor{ii,1}; + +AO.RF.VoltageSP.HW2PhysicsParams(ii,1) = rfvolt_sp{ii,2}; +AO.RF.Voltage.HW2PhysicsParams(ii,1) = rfvolt_monitor{ii,2}; + +AO.RF.VoltageSP.Physics2HWParams(ii,1) = 1/rfvolt_sp{ii,2}; +AO.RF.Voltage.Physics2HWParams(ii,1) = 1/rfvolt_monitor{ii,2}; + +AO.RF.VoltageSP.Range(ii,:) = [0 800]; +AO.RF.Voltage.Range(ii,:) = [0 800]; + +AO.RF.VoltageSP.Tolerance(ii,1) = 2; +AO.RF.Voltage.Tolerance(ii,1) = 2; +end + + +for ii=1:size(rfpower,1) +name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; +name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; +name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; +val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Power.HW2PhysicsParams(ii,1) = val; + AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; +val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Power.Physics2HWParams(ii,1) = val; + AO.RF.KlysPower.Physics2HWParams(ii,1) = val; +val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; + AO.RF.Power.Range(ii,:) = val; + AO.RF.KlysPower.Range(ii,:) = val; +val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; + AO.RF.Power.Tolerance(ii,1) = val; + AO.RF.KlysPower.Tolerance(ii,1) = val; +end + +%Frequency Readback +AO.RF.Monitor.Mode = Mode; +AO.RF.Monitor.DataType = 'Scalar'; +AO.RF.Monitor.Units = 'Hardware'; +AO.RF.Monitor.HWUnits = 'Hz'; +AO.RF.Monitor.PhysicsUnits = 'Hz'; +%Frequency Setpoint +AO.RF.Setpoint.Mode = Mode; +AO.RF.Setpoint.DataType = 'Scalar'; +AO.RF.Setpoint.Units = 'Hardware'; +AO.RF.Setpoint.HWUnits = 'Hz'; +AO.RF.Setpoint.PhysicsUnits = 'Hz'; + +%Voltage control +AO.RF.VoltageSP.Mode = Mode; +AO.RF.VoltageSP.DataType = 'Scalar'; +AO.RF.VoltageSP.Units = 'Hardware'; +AO.RF.VoltageSP.HWUnits = 'Volts'; +AO.RF.VoltageSP.PhysicsUnits = 'Volts'; +AO.RF.VoltageSP.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +%Voltage monitor +AO.RF.Voltage.Mode = Mode; +AO.RF.Voltage.DataType = 'Scalar'; +AO.RF.Voltage.Units = 'Hardware'; +AO.RF.Voltage.HWUnits = 'kVolts'; +AO.RF.Voltage.PhysicsUnits = 'Volts'; +AO.RF.Voltage.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +%Power Control +AO.RF.PowerCtrl.Mode = Mode; +AO.RF.PowerCtrl.DataType = 'Scalar'; +AO.RF.PowerCtrl.Units = 'Hardware'; +AO.RF.PowerCtrl.HWUnits = 'MWatts'; +AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; + +%Power Monitor +AO.RF.Power.Mode = Mode; +AO.RF.Power.DataType = 'Scalar'; +AO.RF.Power.Units = 'Hardware'; +AO.RF.Power.HWUnits = 'kWatts'; +AO.RF.Power.PhysicsUnits = 'kWatts'; +AO.RF.Power.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +%Klystron Forward Power +AO.RF.KlysPower.Mode = Mode; +AO.RF.KlysPower.DataType = 'Scalar'; +AO.RF.KlysPower.Units = 'Hardware'; +AO.RF.KlysPower.HWUnits = 'kWatts'; +AO.RF.KlysPower.PhysicsUnits = 'kWatts'; +AO.RF.KlysPower.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +%Station Phase Control +AO.RF.PhaseCtrl.Mode = Mode; +AO.RF.PhaseCtrl.DataType = 'Scalar'; +AO.RF.PhaseCtrl.Units = 'Hardware'; +AO.RF.PhaseCtrl.HWUnits = 'Degrees'; +AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; + +%Station Phase Monitor +AO.RF.Phase.Mode = Mode; +AO.RF.Phase.DataType = 'Scalar'; +AO.RF.Phase.Units = 'Hardware'; +AO.RF.Phase.HWUnits = 'Degrees'; +AO.RF.Phase.PhysicsUnits = 'Degrees'; + +%==== +%TUNE +%==== +AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); +AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; +AO.TUNE.CommonNames = ['xtune';'ytune']; +AO.TUNE.DeviceList = [ 1 1; 1 2]; +AO.TUNE.ElementList = [1 2]'; +AO.TUNE.Status = [1 1]'; + +AO.TUNE.Monitor.Mode = 'Special'; +AO.TUNE.Monitor.SpecialFunction = 'meastune'; +AO.TUNE.Monitor.DataType = 'Vector'; +AO.TUNE.Monitor.DataTypeIndex = [1 2]'; +AO.TUNE.Monitor.Units = 'Hardware'; +AO.TUNE.Monitor.HW2PhysicsParams = 1; +AO.TUNE.Monitor.Physics2HWParams = 1; +AO.TUNE.Monitor.HWUnits = 'fractional tune'; +AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; + + +%==== +%DCCT +%==== +AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); +AO.DCCT.MemberOf = {'Diagnostics'}; +AO.DCCT.CommonNames = 'DCCT'; +AO.DCCT.DeviceList = [1 1]; +AO.DCCT.ElementList = [1]; +AO.DCCT.Status = [1]; + +AO.DCCT.Monitor.Mode = Mode; +AO.DCCT.Monitor.DataType = 'Scalar'; +AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; +AO.DCCT.Monitor.Units = 'Hardware'; +AO.DCCT.Monitor.HWUnits = 'milli-ampere'; +AO.DCCT.Monitor.PhysicsUnits = 'ampere'; +AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; +AO.DCCT.Monitor.Physics2HWParams = 1000; + + +% %================== +% %Machine Parameters +% %================== +% Removed in this version, see pervious version for more info + +%====== +%Septum +%====== +% ifam=ifam+1; +% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); +% AO.Septum.MemberOf = {'Injection'}; +% AO.Septum.Status = 1; +% +% AO.Septum.CommonNames = 'Septum '; +% AO.Septum.DeviceList = [3 1]; +% AO.Septum.ElementList = [1]; +% +% AO.Septum.Monitor.Mode = Mode; +% AO.Septum.Monitor.DataType = 'Scalar'; +% AO.Septum.Monitor.Units = 'Hardware'; +% AO.Septum.Monitor.HWUnits = 'ampere'; +% AO.Septum.Monitor.PhysicsUnits = 'radian'; +% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; +% +% AO.Septum.Setpoint.Mode = Mode; +% AO.Septum.Setpoint.DataType = 'Scalar'; +% AO.Septum.Setpoint.Units = 'Hardware'; +% AO.Septum.Setpoint.HWUnits = 'ampere'; +% AO.Septum.Setpoint.PhysicsUnits = 'radian'; +% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; +% AO.Septum.Setpoint.Range = [0, 2500]; +% AO.Septum.Setpoint.Tolerance = 100.0; +% +% AO.Septum.Monitor.HW2PhysicsParams = 1; +% AO.Septum.Monitor.Physics2HWParams = 1; +% AO.Septum.Setpoint.HW2PhysicsParams = 1; +% AO.Septum.Setpoint.Physics2HWParams = 1; + + +%==================== +%Photon Beamline Data +%==================== +% >> removed >> see previous versions if info needed + +%==================== +%BPLD Data +%==================== +% >> removed >> see previous versions if info needed + +% The operational mode sets the path, filenames, and other important parameters +% Run setoperationalmode after most of the AO is built so that the Units and Mode fields +% can be set in setoperationalmode +fprintf('\n'); +setao(AO); +setoperationalmode(OperationalMode); +AO = getao; + + +%%%%%%%%%%%%%%%% +% DeltaRespMat % +%%%%%%%%%%%%%%%% + +% I remove the physics2hw conversion because the physics2hw is +% is calibrated yet. + +% Set response matrix kick size in hardware units (amps) +%AO = getao; +AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', 1.8e-5, AO.HCM.DeviceList); +AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', 0.9e-5, AO.VCM.DeviceList); +%setao(AO); +%AD = getad; +%AD.DeltaRFDisp = 500; +%setad(AD); + +AO.HFC.Setpoint.DeltaRespMat = 0.5; +AO.VFC.Setpoint.DeltaRespMat = 0.5; + +AO.KICK.Setpoint.DeltaRespMat = 50; + +%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point +%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); +%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); + + +AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); +AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); +AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); + + +AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); +AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); +AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); +AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Get S-positions [meters] % +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Using ...ATIndex(:,1) will accomodata for split elements where the first +% of a group of elements is put in the first column ie, if SFA is split in +% two then ATIndex will look like [2 3; 11 12; ...] where each row is a +% magnet and column represents each split. +global THERING +AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; +AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; +AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; +AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; +AO.HFC.Position = findspos(THERING, AO.HFC.AT.ATIndex(:,1))'; +AO.VFC.Position = findspos(THERING, AO.VFC.AT.ATIndex(:,1))'; +AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; +AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; +AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; +AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; +AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; +AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; +AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; +AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; +AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; +AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; +AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; +AO.DCCT.Position = 0; +AO.TUNE.Position = 0; + + +% Save AO +setao(AO); + + +function dispobject(AO,name) + +n = length(fieldnames(AO)); + +if n > 0 + fprintf(' %10s ',name); + if mod(n,5) == 0 + fprintf('\n'); + end +end diff --git a/machine/ASP/StorageRing/aspinitRF.m b/machine/ASP/StorageRing/aspinitRF.m index 1892891d..a8d94b3f 100644 --- a/machine/ASP/StorageRing/aspinitRF.m +++ b/machine/ASP/StorageRing/aspinitRF.m @@ -1,1753 +1,1753 @@ -function aspinit(OperationalMode) -% aspinit(OperationalMode) -% -% Initialize parameters for ASP control in MATLAB -% -%========================== -% Accelerator Family Fields -%========================== -% FamilyName BPMx, HCM, etc -% CommonNames Shortcut name for each element (optional) -% DeviceList [Sector, Number] -% ElementList number in list -% Position m, magnet center -% -% MONITOR FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units Physics or HW -% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% -% SETPOINT FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units hardware or physics -% HW2PhysicsFcn function handle used to convert from hardware to physics units -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% Range minsetpoint, maxsetpoint; -% Tolerance setpoint-monitor -% -%============================================= -% Accelerator Toolbox Simulation Fields -%============================================= -% ATType Quad, Sext, etc -% ATIndex index in THERING -% ATParameterGroup parameter group -% -%============ -% Family List -%============ -% BPMx BPMy - beam position monitors -% HCM VCM - corrector magnets wound into sextupoles -% BEND - gradient dipoles -% QFA QDA QFB - quadrupole magnets -% SFA SDA SDB SFB - sextupole magnets -% SQK - skew quads wound into SDA magnets -% KICK - injection kickers (DELTA type) -% RF - 4 cavities (KEK type?) -% DCCT -% Septum (Not in model yet) -% -% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 -% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 - -% === Change Log === -% Mark Boland 2004-02-12 -% Eugene Tan 2004-02-23 -% Eugene Tan 2004-12-13 -% Eugene Tan 2005-09-27 ver 4 -% Updated naming convention of the process variables, use version 4 of -% the lattice "assr4.m" where the correctors have been merged into the -% sextupoles. Made the necessary changes to updateatindex. Added skew -% quadrupoles and updated generate_init. -% Mark Boland 2006-05-27 -% Changed the BPM PVs to ...:SA_HPOS_MONITOR and ...:SA_VPOS_MONITOR -% -% === Still to do === -% - kicker delays -% - BPM names and other possible PVs of interest eg. Q factor etc. -% - clean up and configure the amp2k and k2amp conversion. Control system -% designed to calculate the strengths and amp values using calc records, -% therefore we should only need to change the PV name to access for -% readback at setpoints. Only problem will be in simulation/offline mode -% where those value are not available online. How do you keep the offline -% conversion factors up to date with online vals? -% -% === Generated from === -% aspinit_v5skeleton.m - -% Default operational mode -if nargin < 1 - OperationalMode = 2; -end - - -%============================================= -% START DEFINITION OF ACCELERATOR OBJECTS -%============================================= -fprintf(' Defining the Accelerator Objects. Objects being defined:\n') - - -% Clear previous AcceleratorObjects -setao([]); - - -Mode = 'Online'; % This gets reset in setoperationalmode - -%============================================= -%BPM data: status field designates if BPM in use -%============================================= -ntbpm=98; -AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); -AO.BPMx.MemberOf = {'PlotFamily';};% 'BPM'; 'Diagnostics'}; -AO.BPMx.Monitor.Mode = Mode; -AO.BPMx.Monitor.DataType = 'Scalar'; -AO.BPMx.Monitor.Units = 'Hardware'; -AO.BPMx.Monitor.HWUnits = 'mm'; -AO.BPMx.Monitor.PhysicsUnits = 'meter'; - -AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); -AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.BPMy.Monitor.Mode = Mode; -AO.BPMy.Monitor.DataType = 'Scalar'; -AO.BPMy.Monitor.Units = 'Hardware'; -AO.BPMy.Monitor.HWUnits = 'mm'; -AO.BPMy.Monitor.PhysicsUnits = 'meter'; - -% x-name x-chname xstat y-name y-chname ystat DevList Elem -bpm={ -'1BPMx1 ' 'SR01BPM01:S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2BPMx6 ' 'SR02BPM06:SA_HPOS_MONITOR' 1 '2BPMy6 ' 'SR02BPM06:SA_VPOS_MONITOR' 1 [2,6] 13 ; ... -'2BPMx7 ' 'SR02BPM07:SA_HPOS_MONITOR' 1 '2BPMy7 ' 'SR02BPM07:SA_VPOS_MONITOR' 1 [2,7] 14 ; ... -'3BPMx1 ' 'SR03BPM01:SA_HPOS_MONITOR' 1 '3BPMy1 ' 'SR03BPM01:SA_VPOS_MONITOR' 1 [3,1] 15 ; ... -'3BPMx2 ' 'SR03BPM02:SA_HPOS_MONITOR' 1 '3BPMy2 ' 'SR03BPM02:SA_VPOS_MONITOR' 1 [3,2] 16 ; ... -'3BPMx3 ' 'SR03BPM03:SA_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:SA_VPOS_MONITOR' 1 [3,3] 17 ; ... -'3BPMx4 ' 'SR03BPM04:SA_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:SA_VPOS_MONITOR' 1 [3,4] 18 ; ... -'3BPMx5 ' 'SR03BPM05:SA_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:SA_VPOS_MONITOR' 1 [3,5] 19 ; ... -'3BPMx6 ' 'SR03BPM06:SA_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:SA_VPOS_MONITOR' 1 [3,6] 20 ; ... -'3BPMx7 ' 'SR03BPM07:SA_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:SA_VPOS_MONITOR' 1 [3,7] 21 ; ... -'4BPMx1 ' 'SR04BPM01:SA_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:SA_VPOS_MONITOR' 1 [4,1] 22 ; ... -'4BPMx2 ' 'SR04BPM02:SA_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:SA_VPOS_MONITOR' 1 [4,2] 23 ; ... -'4BPMx3 ' 'SR04BPM03:SA_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:SA_VPOS_MONITOR' 1 [4,3] 24 ; ... -'4BPMx4 ' 'SR04BPM04:SA_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:SA_VPOS_MONITOR' 1 [4,4] 25 ; ... -'4BPMx5 ' 'SR04BPM05:SA_HPOS_MONITOR' 1 '4BPMy5 ' 'SR04BPM05:SA_VPOS_MONITOR' 1 [4,5] 26 ; ... -'4BPMx6 ' 'SR04BPM06:SA_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:SA_VPOS_MONITOR' 1 [4,6] 27 ; ... -'4BPMx7 ' 'SR04BPM07:SA_HPOS_MONITOR' 1 '4BPMy7 ' 'SR04BPM07:SA_VPOS_MONITOR' 1 [4,7] 28 ; ... -'5BPMx1 ' 'SR05BPM01:SA_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:SA_VPOS_MONITOR' 1 [5,1] 29 ; ... -'5BPMx2 ' 'SR05BPM02:SA_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:SA_VPOS_MONITOR' 1 [5,2] 30 ; ... -'5BPMx3 ' 'SR05BPM03:SA_HPOS_MONITOR' 1 '5BPMy3 ' 'SR05BPM03:SA_VPOS_MONITOR' 1 [5,3] 31 ; ... -'5BPMx4 ' 'SR05BPM04:SA_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:SA_VPOS_MONITOR' 1 [5,4] 32 ; ... -'5BPMx5 ' 'SR05BPM05:SA_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:SA_VPOS_MONITOR' 1 [5,5] 33 ; ... -'5BPMx6 ' 'SR05BPM06:SA_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:SA_VPOS_MONITOR' 1 [5,6] 34 ; ... -'5BPMx7 ' 'SR05BPM07:SA_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:SA_VPOS_MONITOR' 1 [5,7] 35 ; ... -'6BPMx1 ' 'SR06BPM01:SA_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:SA_VPOS_MONITOR' 1 [6,1] 36 ; ... -'6BPMx2 ' 'SR06BPM02:SA_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:SA_VPOS_MONITOR' 1 [6,2] 37 ; ... -'6BPMx3 ' 'SR06BPM03:SA_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:SA_VPOS_MONITOR' 1 [6,3] 38 ; ... -'6BPMx4 ' 'SR06BPM04:SA_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:SA_VPOS_MONITOR' 1 [6,4] 39 ; ... -'6BPMx5 ' 'SR06BPM05:SA_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:SA_VPOS_MONITOR' 1 [6,5] 40 ; ... -'6BPMx6 ' 'SR06BPM06:SA_HPOS_MONITOR' 1 '6BPMy6 ' 'SR06BPM06:SA_VPOS_MONITOR' 1 [6,6] 41 ; ... -'6BPMx7 ' 'SR06BPM07:SA_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:SA_VPOS_MONITOR' 1 [6,7] 42 ; ... -'7BPMx1 ' 'SR07BPM01:SA_HPOS_MONITOR' 1 '7BPMy1 ' 'SR07BPM01:SA_VPOS_MONITOR' 1 [7,1] 43 ; ... -'7BPMx2 ' 'SR07BPM02:SA_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:SA_VPOS_MONITOR' 1 [7,2] 44 ; ... -'7BPMx3 ' 'SR07BPM03:SA_HPOS_MONITOR' 1 '7BPMy3 ' 'SR07BPM03:SA_VPOS_MONITOR' 1 [7,3] 45 ; ... -'7BPMx4 ' 'SR07BPM04:SA_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:SA_VPOS_MONITOR' 1 [7,4] 46 ; ... -'7BPMx5 ' 'SR07BPM05:SA_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:SA_VPOS_MONITOR' 1 [7,5] 47 ; ... -'7BPMx6 ' 'SR07BPM06:SA_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:SA_VPOS_MONITOR' 1 [7,6] 48 ; ... -'7BPMx7 ' 'SR07BPM07:SA_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:SA_VPOS_MONITOR' 1 [7,7] 49 ; ... -'8BPMx1 ' 'SR08BPM01:SA_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:SA_VPOS_MONITOR' 1 [8,1] 50 ; ... -'8BPMx2 ' 'SR08BPM02:SA_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:SA_VPOS_MONITOR' 1 [8,2] 51 ; ... -'8BPMx3 ' 'SR08BPM03:SA_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:SA_VPOS_MONITOR' 1 [8,3] 52 ; ... -'8BPMx4 ' 'SR08BPM04:SA_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:SA_VPOS_MONITOR' 1 [8,4] 53 ; ... -'8BPMx5 ' 'SR08BPM05:SA_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:SA_VPOS_MONITOR' 1 [8,5] 54 ; ... -'8BPMx6 ' 'SR08BPM06:SA_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:SA_VPOS_MONITOR' 1 [8,6] 55 ; ... -'8BPMx7 ' 'SR08BPM07:SA_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:SA_VPOS_MONITOR' 1 [8,7] 56 ; ... -'9BPMx1 ' 'SR09BPM01:SA_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:SA_VPOS_MONITOR' 1 [9,1] 57 ; ... -'9BPMx2 ' 'SR09BPM02:SA_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:SA_VPOS_MONITOR' 1 [9,2] 58 ; ... -'9BPMx3 ' 'SR09BPM03:SA_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:SA_VPOS_MONITOR' 1 [9,3] 59 ; ... -'9BPMx4 ' 'SR09BPM04:SA_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:SA_VPOS_MONITOR' 1 [9,4] 60 ; ... -'9BPMx5 ' 'SR09BPM05:SA_HPOS_MONITOR' 1 '9BPMy5 ' 'SR09BPM05:SA_VPOS_MONITOR' 1 [9,5] 61 ; ... -'9BPMx6 ' 'SR09BPM06:SA_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:SA_VPOS_MONITOR' 1 [9,6] 62 ; ... -'9BPMx7 ' 'SR09BPM07:SA_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:SA_VPOS_MONITOR' 1 [9,7] 63 ; ... -'10BPMx1 ' 'SR10BPM01:SA_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:SA_VPOS_MONITOR' 1 [10,1] 64 ; ... -'10BPMx2 ' 'SR10BPM02:SA_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:SA_VPOS_MONITOR' 1 [10,2] 65 ; ... -'10BPMx3 ' 'SR10BPM03:SA_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:SA_VPOS_MONITOR' 1 [10,3] 66 ; ... -'10BPMx4 ' 'SR10BPM04:SA_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:SA_VPOS_MONITOR' 1 [10,4] 67 ; ... -'10BPMx5 ' 'SR10BPM05:SA_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:SA_VPOS_MONITOR' 1 [10,5] 68 ; ... -'10BPMx6 ' 'SR10BPM06:SA_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:SA_VPOS_MONITOR' 1 [10,6] 69 ; ... -'10BPMx7 ' 'SR10BPM07:SA_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:SA_VPOS_MONITOR' 1 [10,7] 70 ; ... -'11BPMx1 ' 'SR11BPM01:SA_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:SA_VPOS_MONITOR' 1 [11,1] 71 ; ... -'11BPMx2 ' 'SR11BPM02:SA_HPOS_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:SA_VPOS_MONITOR' 1 [11,2] 72 ; ... -'11BPMx3 ' 'SR11BPM03:SA_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:SA_VPOS_MONITOR' 1 [11,3] 73 ; ... -'11BPMx4 ' 'SR11BPM04:SA_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:SA_VPOS_MONITOR' 1 [11,4] 74 ; ... -'11BPMx5 ' 'SR11BPM05:SA_HPOS_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:SA_VPOS_MONITOR' 1 [11,5] 75 ; ... -'11BPMx6 ' 'SR11BPM06:SA_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:SA_VPOS_MONITOR' 1 [11,6] 76 ; ... -'11BPMx7 ' 'SR11BPM07:SA_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:SA_VPOS_MONITOR' 1 [11,7] 77 ; ... -'12BPMx1 ' 'SR12BPM01:SA_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:SA_VPOS_MONITOR' 1 [12,1] 78 ; ... -'12BPMx2 ' 'SR12BPM02:SA_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:SA_VPOS_MONITOR' 1 [12,2] 79 ; ... -'12BPMx3 ' 'SR12BPM03:SA_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:SA_VPOS_MONITOR' 1 [12,3] 80 ; ... -'12BPMx4 ' 'SR12BPM04:SA_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:SA_VPOS_MONITOR' 1 [12,4] 81 ; ... -'12BPMx5 ' 'SR12BPM05:SA_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:SA_VPOS_MONITOR' 1 [12,5] 82 ; ... -'12BPMx6 ' 'SR12BPM06:SA_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:SA_VPOS_MONITOR' 1 [12,6] 83 ; ... -'12BPMx7 ' 'SR12BPM07:SA_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:SA_VPOS_MONITOR' 1 [12,7] 84 ; ... -'13BPMx1 ' 'SR13BPM01:SA_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:SA_VPOS_MONITOR' 1 [13,1] 85 ; ... -'13BPMx2 ' 'SR13BPM02:SA_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:SA_VPOS_MONITOR' 1 [13,2] 86 ; ... -'13BPMx3 ' 'SR13BPM03:SA_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:SA_VPOS_MONITOR' 1 [13,3] 87 ; ... -'13BPMx4 ' 'SR13BPM04:SA_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:SA_VPOS_MONITOR' 1 [13,4] 88 ; ... -'13BPMx5 ' 'SR13BPM05:SA_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:SA_VPOS_MONITOR' 1 [13,5] 89 ; ... -'13BPMx6 ' 'SR13BPM06:SA_HPOS_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:SA_VPOS_MONITOR' 1 [13,6] 90 ; ... -'13BPMx7 ' 'SR13BPM07:SA_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:SA_VPOS_MONITOR' 1 [13,7] 91 ; ... -'14BPMx1 ' 'SR14BPM01:SA_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:SA_VPOS_MONITOR' 1 [14,1] 92 ; ... -'14BPMx2 ' 'SR14BPM02:SA_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:SA_VPOS_MONITOR' 1 [14,2] 93 ; ... -'14BPMx3 ' 'SR14BPM03:SA_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:SA_VPOS_MONITOR' 1 [14,3] 94 ; ... -'14BPMx4 ' 'SR14BPM04:SA_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:SA_VPOS_MONITOR' 1 [14,4] 95 ; ... -'14BPMx5 ' 'SR14BPM05:SA_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:SA_VPOS_MONITOR' 1 [14,5] 96 ; ... -'14BPMx6 ' 'SR14BPM06:SA_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:SA_VPOS_MONITOR' 1 [14,6] 97 ; ... -'14BPMx7 ' 'SR14BPM07:SA_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:SA_VPOS_MONITOR' 1 [14,7] 98 ; ... -}; - -%Load fields from data block -for ii=1:size(bpm,1) -name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; -name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; -name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; -name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; -val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; - AO.BPMy.DeviceList(ii,:) = val; -val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; - AO.BPMy.ElementList(ii,:) = val; - AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1000; - AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1000; -end - - -% % Get sum value from button. Don't need handles and PV namelist as -% % parameters are the same as the 'monitor' subcategory. -% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; -% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; -% AO.BPMx.Sum.HWUnits = 'ADC Counts'; -% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; -% AO.BPMx.Sum.HW2PhysicsParams = 1; -% AO.BPMx.Sum.Physics2HWParams = 1; -% % Get q value from BPMs. Don't need handles and PV namelist. -% AO.BPMx.Q = AO.BPMx.Monitor; -% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; -% AO.BPMx.Q.HWUnits = 'mm'; -% AO.BPMx.Q.PhysicsUnits = 'meter'; -% AO.BPMx.Q.HW2PhysicsParams = 1e-3; -% AO.BPMx.Q.Physics2HWParams = 1000; -% -% % Definition above for horizontal. Replicate for vertical. -% AO.BPMy.Sum = AO.BPMx.Sum; -% AO.BPMy.Q = AO.BPMx.Q; - - - -%============================================= -% First Turn BPM data from Libera -%============================================= -ntbpm=98; -AO.FTx.FamilyName = 'FTx'; dispobject(AO,AO.FTx.FamilyName); -AO.FTx.MemberOf = {'PlotFamily';};% 'BPM'; 'Diagnostics'}; -AO.FTx.Monitor.Mode = Mode; -AO.FTx.Monitor.DataType = 'Scalar'; -AO.FTx.Monitor.Units = 'Hardware'; -AO.FTx.Monitor.HWUnits = 'mm'; -AO.FTx.Monitor.PhysicsUnits = 'meter'; - -AO.FTy.FamilyName = 'FTy'; dispobject(AO,AO.FTy.FamilyName); -AO.FTy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTy.Monitor.Mode = Mode; -AO.FTy.Monitor.DataType = 'Scalar'; -AO.FTy.Monitor.Units = 'Hardware'; -AO.FTy.Monitor.HWUnits = 'mm'; -AO.FTy.Monitor.PhysicsUnits = 'meter'; - -% x-name x-chname xstat y-name y-chname ystat DevList Elem -bpm={ -'1FTx1 ' 'SR01BPM01:FT_HPOS_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:FT_VPOS_MONITOR' 1 [1,1] 1 ; ... -'1FTx2 ' 'SR01BPM02:FT_HPOS_MONITOR' 1 '1BPMy2 ' 'SR01BPM02:FT_VPOS_MONITOR' 1 [1,2] 2 ; ... -'1FTx3 ' 'SR01BPM03:FT_HPOS_MONITOR' 1 '1BPMy3 ' 'SR01BPM03:FT_VPOS_MONITOR' 1 [1,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R' 1 [3,1] 15 ; ... -'3FTx2 ' 'SR03BPM02:FT_HPOS_MONITOR' 1 '3BPMy2 ' 'SR03BPM02:FT_VPOS_MONITOR' 1 [3,2] 16 ; ... -'3FTx3 ' 'SR03BPM03:FT_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:FT_VPOS_MONITOR' 1 [3,3] 17 ; ... -'3FTx4 ' 'SR03BPM04:FT_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:FT_VPOS_MONITOR' 1 [3,4] 18 ; ... -'3FTx5 ' 'SR03BPM05:FT_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:FT_VPOS_MONITOR' 1 [3,5] 19 ; ... -'3FTx6 ' 'SR03BPM06:FT_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:FT_VPOS_MONITOR' 1 [3,6] 20 ; ... -'3FTx7 ' 'SR03BPM07:FT_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:FT_VPOS_MONITOR' 1 [3,7] 21 ; ... -'4FTx1 ' 'SR04BPM01:FT_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:FT_VPOS_MONITOR' 1 [4,1] 22 ; ... -'4FTx2 ' 'SR04BPM02:FT_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:FT_VPOS_MONITOR' 1 [4,2] 23 ; ... -'4FTx3 ' 'SR04BPM03:FT_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:FT_VPOS_MONITOR' 1 [4,3] 24 ; ... -'4FTx4 ' 'SR04BPM04:FT_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:FT_VPOS_MONITOR' 1 [4,4] 25 ; ... -'4FTx5 ' 'SR04BPM05:FT_HPOS_MONITOR' 1 '4BPMy5 ' 'SR04BPM05:FT_VPOS_MONITOR' 1 [4,5] 26 ; ... -'4FTx6 ' 'SR04BPM06:FT_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:FT_VPOS_MONITOR' 1 [4,6] 27 ; ... -'4FTx7 ' 'SR04BPM07:FT_HPOS_MONITOR' 1 '4BPMy7 ' 'SR04BPM07:FT_VPOS_MONITOR' 1 [4,7] 28 ; ... -'5FTx1 ' 'SR05BPM01:FT_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:FT_VPOS_MONITOR' 1 [5,1] 29 ; ... -'5FTx2 ' 'SR05BPM02:FT_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:FT_VPOS_MONITOR' 1 [5,2] 30 ; ... -'5FTx3 ' 'SR05BPM03:FT_HPOS_MONITOR' 1 '5BPMy3 ' 'SR05BPM03:FT_VPOS_MONITOR' 1 [5,3] 31 ; ... -'5FTx4 ' 'SR05BPM04:FT_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:FT_VPOS_MONITOR' 1 [5,4] 32 ; ... -'5FTx5 ' 'SR05BPM05:FT_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:FT_VPOS_MONITOR' 1 [5,5] 33 ; ... -'5FTx6 ' 'SR05BPM06:FT_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:FT_VPOS_MONITOR' 1 [5,6] 34 ; ... -'5FTx7 ' 'SR05BPM07:FT_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:FT_VPOS_MONITOR' 1 [5,7] 35 ; ... -'6FTx1 ' 'SR06BPM01:FT_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:FT_VPOS_MONITOR' 1 [6,1] 36 ; ... -'6FTx2 ' 'SR06BPM02:FT_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:FT_VPOS_MONITOR' 1 [6,2] 37 ; ... -'6FTx3 ' 'SR06BPM03:FT_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:FT_VPOS_MONITOR' 1 [6,3] 38 ; ... -'6FTx4 ' 'SR06BPM04:FT_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:FT_VPOS_MONITOR' 1 [6,4] 39 ; ... -'6FTx5 ' 'SR06BPM05:FT_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:FT_VPOS_MONITOR' 1 [6,5] 40 ; ... -'6FTx6 ' 'SR06BPM06:FT_HPOS_MONITOR' 1 '6BPMy6 ' 'SR06BPM06:FT_VPOS_MONITOR' 1 [6,6] 41 ; ... -'6FTx7 ' 'SR06BPM07:FT_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:FT_VPOS_MONITOR' 1 [6,7] 42 ; ... -'7FTx1 ' 'SR07BPM01:FT_HPOS_MONITOR' 1 '7BPMy1 ' 'SR07BPM01:FT_VPOS_MONITOR' 1 [7,1] 43 ; ... -'7FTx2 ' 'SR07BPM02:FT_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:FT_VPOS_MONITOR' 1 [7,2] 44 ; ... -'7FTx3 ' 'SR07BPM03:FT_HPOS_MONITOR' 1 '7BPMy3 ' 'SR07BPM03:FT_VPOS_MONITOR' 1 [7,3] 45 ; ... -'7FTx4 ' 'SR07BPM04:FT_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:FT_VPOS_MONITOR' 1 [7,4] 46 ; ... -'7FTx5 ' 'SR07BPM05:FT_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:FT_VPOS_MONITOR' 1 [7,5] 47 ; ... -'7FTx6 ' 'SR07BPM06:FT_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:FT_VPOS_MONITOR' 1 [7,6] 48 ; ... -'7FTx7 ' 'SR07BPM07:FT_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:FT_VPOS_MONITOR' 1 [7,7] 49 ; ... -'8FTx1 ' 'SR08BPM01:FT_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:FT_VPOS_MONITOR' 1 [8,1] 50 ; ... -'8FTx2 ' 'SR08BPM02:FT_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:FT_VPOS_MONITOR' 1 [8,2] 51 ; ... -'8FTx3 ' 'SR08BPM03:FT_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:FT_VPOS_MONITOR' 1 [8,3] 52 ; ... -'8FTx4 ' 'SR08BPM04:FT_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:FT_VPOS_MONITOR' 1 [8,4] 53 ; ... -'8FTx5 ' 'SR08BPM05:FT_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:FT_VPOS_MONITOR' 1 [8,5] 54 ; ... -'8FTx6 ' 'SR08BPM06:FT_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:FT_VPOS_MONITOR' 1 [8,6] 55 ; ... -'8FTx7 ' 'SR08BPM07:FT_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:FT_VPOS_MONITOR' 1 [8,7] 56 ; ... -'9FTx1 ' 'SR09BPM01:FT_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:FT_VPOS_MONITOR' 1 [9,1] 57 ; ... -'9FTx2 ' 'SR09BPM02:FT_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:FT_VPOS_MONITOR' 1 [9,2] 58 ; ... -'9FTx3 ' 'SR09BPM03:FT_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:FT_VPOS_MONITOR' 1 [9,3] 59 ; ... -'9FTx4 ' 'SR09BPM04:FT_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:FT_VPOS_MONITOR' 1 [9,4] 60 ; ... -'9FTx5 ' 'SR09BPM05:FT_HPOS_MONITOR' 1 '9BPMy5 ' 'SR09BPM05:FT_VPOS_MONITOR' 1 [9,5] 61 ; ... -'9FTx6 ' 'SR09BPM06:FT_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:FT_VPOS_MONITOR' 1 [9,6] 62 ; ... -'9FTx7 ' 'SR09BPM07:FT_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:FT_VPOS_MONITOR' 1 [9,7] 63 ; ... -'10FTx1 ' 'SR10BPM01:FT_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:FT_VPOS_MONITOR' 1 [10,1] 64 ; ... -'10FTx2 ' 'SR10BPM02:FT_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:FT_VPOS_MONITOR' 1 [10,2] 65 ; ... -'10FTx3 ' 'SR10BPM03:FT_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:FT_VPOS_MONITOR' 1 [10,3] 66 ; ... -'10FTx4 ' 'SR10BPM04:FT_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:FT_VPOS_MONITOR' 1 [10,4] 67 ; ... -'10FTx5 ' 'SR10BPM05:FT_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:FT_VPOS_MONITOR' 1 [10,5] 68 ; ... -'10FTx6 ' 'SR10BPM06:FT_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:FT_VPOS_MONITOR' 1 [10,6] 69 ; ... -'10FTx7 ' 'SR10BPM07:FT_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:FT_VPOS_MONITOR' 1 [10,7] 70 ; ... -'11FTx1 ' 'SR11BPM01:FT_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:FT_VPOS_MONITOR' 1 [11,1] 71 ; ... -'11FTx2 ' 'SR11BPM02:FT_HPOS_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:FT_VPOS_MONITOR' 1 [11,2] 72 ; ... -'11FTx3 ' 'SR11BPM03:FT_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:FT_VPOS_MONITOR' 1 [11,3] 73 ; ... -'11FTx4 ' 'SR11BPM04:FT_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:FT_VPOS_MONITOR' 1 [11,4] 74 ; ... -'11FTx5 ' 'SR11BPM05:FT_HPOS_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:FT_VPOS_MONITOR' 1 [11,5] 75 ; ... -'11FTx6 ' 'SR11BPM06:FT_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:FT_VPOS_MONITOR' 1 [11,6] 76 ; ... -'11FTx7 ' 'SR11BPM07:FT_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:FT_VPOS_MONITOR' 1 [11,7] 77 ; ... -'12FTx1 ' 'SR12BPM01:FT_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:FT_VPOS_MONITOR' 1 [12,1] 78 ; ... -'12FTx2 ' 'SR12BPM02:FT_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:FT_VPOS_MONITOR' 1 [12,2] 79 ; ... -'12FTx3 ' 'SR12BPM03:FT_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:FT_VPOS_MONITOR' 1 [12,3] 80 ; ... -'12FTx4 ' 'SR12BPM04:FT_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:FT_VPOS_MONITOR' 1 [12,4] 81 ; ... -'12FTx5 ' 'SR12BPM05:FT_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:FT_VPOS_MONITOR' 1 [12,5] 82 ; ... -'12FTx6 ' 'SR12BPM06:FT_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:FT_VPOS_MONITOR' 1 [12,6] 83 ; ... -'12FTx7 ' 'SR12BPM07:FT_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:FT_VPOS_MONITOR' 1 [12,7] 84 ; ... -'13FTx1 ' 'SR13BPM01:FT_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:FT_VPOS_MONITOR' 1 [13,1] 85 ; ... -'13FTx2 ' 'SR13BPM02:FT_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:FT_VPOS_MONITOR' 1 [13,2] 86 ; ... -'13FTx3 ' 'SR13BPM03:FT_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:FT_VPOS_MONITOR' 1 [13,3] 87 ; ... -'13FTx4 ' 'SR13BPM04:FT_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:FT_VPOS_MONITOR' 1 [13,4] 88 ; ... -'13FTx5 ' 'SR13BPM05:FT_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:FT_VPOS_MONITOR' 1 [13,5] 89 ; ... -'13FTx6 ' 'SR13BPM06:FT_HPOS_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:FT_VPOS_MONITOR' 1 [13,6] 90 ; ... -'13FTx7 ' 'SR13BPM07:FT_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:FT_VPOS_MONITOR' 1 [13,7] 91 ; ... -'14FTx1 ' 'SR14BPM01:FT_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:FT_VPOS_MONITOR' 1 [14,1] 92 ; ... -'14FTx2 ' 'SR14BPM02:FT_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:FT_VPOS_MONITOR' 1 [14,2] 93 ; ... -'14FTx3 ' 'SR14BPM03:FT_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:FT_VPOS_MONITOR' 1 [14,3] 94 ; ... -'14FTx4 ' 'SR14BPM04:FT_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:FT_VPOS_MONITOR' 1 [14,4] 95 ; ... -'14FTx5 ' 'SR14BPM05:FT_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:FT_VPOS_MONITOR' 1 [14,5] 96 ; ... -'14FTx6 ' 'SR14BPM06:FT_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:FT_VPOS_MONITOR' 1 [14,6] 97 ; ... -'14FTx7 ' 'SR14BPM07:FT_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:FT_VPOS_MONITOR' 1 [14,7] 98 ; ... -}; - -%Load fields from data block -for ii=1:size(bpm,1) -name=bpm{ii,1}; AO.FTx.CommonNames(ii,:) = name; -name=bpm{ii,2}; AO.FTx.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,3}; AO.FTx.Status(ii,:) = val; -name=bpm{ii,4}; AO.FTy.CommonNames(ii,:) = name; -name=bpm{ii,5}; AO.FTy.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,6}; AO.FTy.Status(ii,:) = val; -val =bpm{ii,7}; AO.FTx.DeviceList(ii,:) = val; - AO.FTy.DeviceList(ii,:) = val; -val =bpm{ii,8}; AO.FTx.ElementList(ii,:) = val; - AO.FTy.ElementList(ii,:) = val; - AO.FTx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.FTx.Monitor.Physics2HWParams(ii,:) = 1000; - AO.FTy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.FTy.Monitor.Physics2HWParams(ii,:) = 1000; -end -AO.FTx.Status = AO.BPMx.Status; -AO.FTy.Status = AO.BPMy.Status; - -AO.FTsum = AO.FTx; -AO.FTsum.FamilyName = 'FTsum'; dispobject(AO,AO.FTsum.FamilyName); -AO.FTsum.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTsum.Monitor.Mode = 'Special'; -AO.FTsum.Monitor.Units = 'Hardware'; -AO.FTsum.Monitor.DataType = 'Scalar'; -AO.FTsum.Monitor.SpecialFunction = 'getftsum'; -AO.FTsum.Monitor.HWUnits = 'ADC counts'; -AO.FTsum.Monitor.PhysicsUnits = 'ADC counts'; -AO.FTsum.Monitor.HW2PhysicsParams(:) = 1; -AO.FTsum.Monitor.Physics2HWParams(:) = 1; - - -% % Get sum value from button. Don't need handles and PV namelist as -% % parameters are the same as the 'monitor' subcategory. -AO.FTx.Off.Mode = 'Special'; -AO.FTx.Off.Units = 'Hardware'; -AO.FTx.Off.DataType = 'Scalar'; -AO.FTx.Off.SpecialFunction = 'getftoffset'; -AO.FTx.Off.SpecialFunctionSet = 'setftoffset'; -AO.FTx.Off.HWUnits = '32ns samples'; -AO.FTx.Off.PhysicsUnits = '32ns samples'; -AO.FTx.Off.HW2PhysicsParams = 1; -AO.FTx.Off.Physics2HWParams = 1; - -AO.FTx.Length.Mode = 'Special'; -AO.FTx.Length.Units = 'Hardware'; -AO.FTx.Length.DataType = 'Scalar'; -AO.FTx.Length.SpecialFunction = 'getftlength'; -AO.FTx.Length.SpecialFunctionSet = 'setftlength'; -AO.FTx.Length.HWUnits = '32ns samples'; -AO.FTx.Length.PhysicsUnits = '32ns samples'; -AO.FTx.Length.HW2PhysicsParams = 1; -AO.FTx.Length.Physics2HWParams = 1; - -AO.FTx.Maxadc.Mode = 'Special'; -AO.FTx.Maxadc.Units = 'Hardware'; -AO.FTx.Maxadc.DataType = 'Scalar'; -AO.FTx.Maxadc.SpecialFunction = 'getftmaxadc'; -AO.FTx.Maxadc.HWUnits = 'ADC counts'; -AO.FTx.Maxadc.PhysicsUnits = 'ADC counts'; -AO.FTx.Maxadc.HW2PhysicsParams = 1; -AO.FTx.Maxadc.Physics2HWParams = 1; - -% AO.FTx.Sum.Mode = 'Special'; -% AO.FTx.Sum.Units = 'Hardware'; -% AO.FTx.Sum.DataType = 'Scalar'; -% AO.FTx.Sum.SpecialFunction = 'getftsum'; -% AO.FTx.Sum.HWUnits = 'ADC counts'; -% AO.FTx.Sum.PhysicsUnits = 'ADC counts'; -% AO.FTx.Sum.HW2PhysicsParams = 1; -% AO.FTx.Sum.Physics2HWParams = 1; - - -%=========================================================== -% Corrector data: status field designates if corrector in use -% ASP corrector coils wound into sextupoles. Not dynamic correctors. -%=========================================================== - -AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); -AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'}; - -AO.HCM.Monitor.Mode = Mode; -AO.HCM.Monitor.DataType = 'Scalar'; -AO.HCM.Monitor.Units = 'Hardware'; -AO.HCM.Monitor.HWUnits = 'ampere'; -AO.HCM.Monitor.PhysicsUnits = 'radian'; -AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.HCM.Monitor.Physics2HWFcn = @k2amp; - -AO.HCM.Setpoint.Mode = Mode; -AO.HCM.Setpoint.DataType = 'Scalar'; -AO.HCM.Setpoint.Units = 'Hardware'; -AO.HCM.Setpoint.HWUnits = 'ampere'; -AO.HCM.Setpoint.PhysicsUnits = 'radian'; -AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.HCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian. Respmat settings below AO definitions. -% x-common x-monitor x-setpoint stat devlist elem tol -cor={ -'1HCM1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... -'1HCM2 ' 'SR01CPS05:CURRENT_MONITOR' 'SR01CPS05:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... -'1HCM3 ' 'SR01CPS09:CURRENT_MONITOR' 'SR01CPS09:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... -'2HCM1 ' 'SR02CPS01:CURRENT_MONITOR' 'SR02CPS01:CURRENT_SP ' 1 [2,1] 4 1.000 ; ... -'2HCM2 ' 'SR02CPS05:CURRENT_MONITOR' 'SR02CPS05:CURRENT_SP ' 1 [2,2] 5 1.000 ; ... -'2HCM3 ' 'SR02CPS09:CURRENT_MONITOR' 'SR02CPS09:CURRENT_SP ' 1 [2,3] 6 1.000 ; ... -'3HCM1 ' 'SR03CPS01:CURRENT_MONITOR' 'SR03CPS01:CURRENT_SP ' 1 [3,1] 7 1.000 ; ... -'3HCM2 ' 'SR03CPS05:CURRENT_MONITOR' 'SR03CPS05:CURRENT_SP ' 1 [3,2] 8 1.000 ; ... -'3HCM3 ' 'SR03CPS09:CURRENT_MONITOR' 'SR03CPS09:CURRENT_SP ' 1 [3,3] 9 1.000 ; ... -'4HCM1 ' 'SR04CPS01:CURRENT_MONITOR' 'SR04CPS01:CURRENT_SP ' 1 [4,1] 10 1.000 ; ... -'4HCM2 ' 'SR04CPS05:CURRENT_MONITOR' 'SR04CPS05:CURRENT_SP ' 1 [4,2] 11 1.000 ; ... -'4HCM3 ' 'SR04CPS09:CURRENT_MONITOR' 'SR04CPS09:CURRENT_SP ' 1 [4,3] 12 1.000 ; ... -'5HCM1 ' 'SR05CPS01:CURRENT_MONITOR' 'SR05CPS01:CURRENT_SP ' 1 [5,1] 13 1.000 ; ... -'5HCM2 ' 'SR05CPS05:CURRENT_MONITOR' 'SR05CPS05:CURRENT_SP ' 1 [5,2] 14 1.000 ; ... -'5HCM3 ' 'SR05CPS09:CURRENT_MONITOR' 'SR05CPS09:CURRENT_SP ' 1 [5,3] 15 1.000 ; ... -'6HCM1 ' 'SR06CPS01:CURRENT_MONITOR' 'SR06CPS01:CURRENT_SP ' 1 [6,1] 16 1.000 ; ... -'6HCM2 ' 'SR06CPS05:CURRENT_MONITOR' 'SR06CPS05:CURRENT_SP ' 1 [6,2] 17 1.000 ; ... -'6HCM3 ' 'SR06CPS09:CURRENT_MONITOR' 'SR06CPS09:CURRENT_SP ' 1 [6,3] 18 1.000 ; ... -'7HCM1 ' 'SR07CPS01:CURRENT_MONITOR' 'SR07CPS01:CURRENT_SP ' 1 [7,1] 19 1.000 ; ... -'7HCM2 ' 'SR07CPS05:CURRENT_MONITOR' 'SR07CPS05:CURRENT_SP ' 1 [7,2] 20 1.000 ; ... -'7HCM3 ' 'SR07CPS09:CURRENT_MONITOR' 'SR07CPS09:CURRENT_SP ' 1 [7,3] 21 1.000 ; ... -'8HCM1 ' 'SR08CPS01:CURRENT_MONITOR' 'SR08CPS01:CURRENT_SP ' 1 [8,1] 22 1.000 ; ... -'8HCM2 ' 'SR08CPS05:CURRENT_MONITOR' 'SR08CPS05:CURRENT_SP ' 1 [8,2] 23 1.000 ; ... -'8HCM3 ' 'SR08CPS09:CURRENT_MONITOR' 'SR08CPS09:CURRENT_SP ' 1 [8,3] 24 1.000 ; ... -'9HCM1 ' 'SR09CPS01:CURRENT_MONITOR' 'SR09CPS01:CURRENT_SP ' 1 [9,1] 25 1.000 ; ... -'9HCM2 ' 'SR09CPS05:CURRENT_MONITOR' 'SR09CPS05:CURRENT_SP ' 1 [9,2] 26 1.000 ; ... -'9HCM3 ' 'SR09CPS09:CURRENT_MONITOR' 'SR09CPS09:CURRENT_SP ' 1 [9,3] 27 1.000 ; ... -'10HCM1 ' 'SR10CPS01:CURRENT_MONITOR' 'SR10CPS01:CURRENT_SP ' 1 [10,1] 28 1.000 ; ... -'10HCM2 ' 'SR10CPS05:CURRENT_MONITOR' 'SR10CPS05:CURRENT_SP ' 1 [10,2] 29 1.000 ; ... -'10HCM3 ' 'SR10CPS09:CURRENT_MONITOR' 'SR10CPS09:CURRENT_SP ' 1 [10,3] 30 1.000 ; ... -'11HCM1 ' 'SR11CPS01:CURRENT_MONITOR' 'SR11CPS01:CURRENT_SP ' 1 [11,1] 31 1.000 ; ... -'11HCM2 ' 'SR11CPS05:CURRENT_MONITOR' 'SR11CPS05:CURRENT_SP ' 1 [11,2] 32 1.000 ; ... -'11HCM3 ' 'SR11CPS09:CURRENT_MONITOR' 'SR11CPS09:CURRENT_SP ' 1 [11,3] 33 1.000 ; ... -'12HCM1 ' 'SR12CPS01:CURRENT_MONITOR' 'SR12CPS01:CURRENT_SP ' 1 [12,1] 34 1.000 ; ... -'12HCM2 ' 'SR12CPS05:CURRENT_MONITOR' 'SR12CPS05:CURRENT_SP ' 1 [12,2] 35 1.000 ; ... -'12HCM3 ' 'SR12CPS09:CURRENT_MONITOR' 'SR12CPS09:CURRENT_SP ' 1 [12,3] 36 1.000 ; ... -'13HCM1 ' 'SR13CPS01:CURRENT_MONITOR' 'SR13CPS01:CURRENT_SP ' 1 [13,1] 37 1.000 ; ... -'13HCM2 ' 'SR13CPS05:CURRENT_MONITOR' 'SR13CPS05:CURRENT_SP ' 1 [13,2] 38 1.000 ; ... -'13HCM3 ' 'SR13CPS09:CURRENT_MONITOR' 'SR13CPS09:CURRENT_SP ' 1 [13,3] 39 1.000 ; ... -'14HCM1 ' 'SR14CPS01:CURRENT_MONITOR' 'SR14CPS01:CURRENT_SP ' 1 [14,1] 40 1.000 ; ... -'14HCM2 ' 'SR14CPS05:CURRENT_MONITOR' 'SR14CPS05:CURRENT_SP ' 1 [14,2] 41 1.000 ; ... -'14HCM3 ' 'SR14CPS09:CURRENT_MONITOR' 'SR14CPS09:CURRENT_SP ' 1 [14,3] 42 1.000 ; ... -}; - -[C, Leff, MagnetType] = magnetcoefficients('HCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.HCM.Status(ii,1) = val; -val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; - -AO.HCM.Setpoint.Range(ii,:) = [+90 -90]; -AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); -AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'}; - -AO.VCM.Monitor.Mode = Mode; -AO.VCM.Monitor.DataType = 'Scalar'; -AO.VCM.Monitor.Units = 'Hardware'; -AO.VCM.Monitor.HWUnits = 'ampere'; -AO.VCM.Monitor.PhysicsUnits = 'radian'; -AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.VCM.Monitor.Physics2HWFcn = @k2amp; - -AO.VCM.Setpoint.Mode = Mode; -AO.VCM.Setpoint.DataType = 'Scalar'; -AO.VCM.Setpoint.Units = 'Hardware'; -AO.VCM.Setpoint.HWUnits = 'ampere'; -AO.VCM.Setpoint.PhysicsUnits = 'radian'; -AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.VCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian ** radian units converted to ampere below *** -% y-common y-monitor y-setpoint stat devlist elem -cor={ -'1VCM1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... -'1VCM2 ' 'SR01CPS04:CURRENT_MONITOR' 'SR01CPS04:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... -'1VCM3 ' 'SR01CPS06:CURRENT_MONITOR' 'SR01CPS06:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... -'1VCM4 ' 'SR01CPS07:CURRENT_MONITOR' 'SR01CPS07:CURRENT_SP ' 1 [1,4] 4 1.000 ; ... -'2VCM1 ' 'SR02CPS02:CURRENT_MONITOR' 'SR02CPS02:CURRENT_SP ' 1 [2,1] 5 1.000 ; ... -'2VCM2 ' 'SR02CPS04:CURRENT_MONITOR' 'SR02CPS04:CURRENT_SP ' 1 [2,2] 6 1.000 ; ... -'2VCM3 ' 'SR02CPS06:CURRENT_MONITOR' 'SR02CPS06:CURRENT_SP ' 1 [2,3] 7 1.000 ; ... -'2VCM4 ' 'SR02CPS07:CURRENT_MONITOR' 'SR02CPS07:CURRENT_SP ' 1 [2,4] 8 1.000 ; ... -'3VCM1 ' 'SR03CPS02:CURRENT_MONITOR' 'SR03CPS02:CURRENT_SP ' 1 [3,1] 9 1.000 ; ... -'3VCM2 ' 'SR03CPS04:CURRENT_MONITOR' 'SR03CPS04:CURRENT_SP ' 1 [3,2] 10 1.000 ; ... -'3VCM3 ' 'SR03CPS06:CURRENT_MONITOR' 'SR03CPS06:CURRENT_SP ' 1 [3,3] 11 1.000 ; ... -'3VCM4 ' 'SR03CPS07:CURRENT_MONITOR' 'SR03CPS07:CURRENT_SP ' 1 [3,4] 12 1.000 ; ... -'4VCM1 ' 'SR04CPS02:CURRENT_MONITOR' 'SR04CPS02:CURRENT_SP ' 1 [4,1] 13 1.000 ; ... -'4VCM2 ' 'SR04CPS04:CURRENT_MONITOR' 'SR04CPS04:CURRENT_SP ' 1 [4,2] 14 1.000 ; ... -'4VCM3 ' 'SR04CPS06:CURRENT_MONITOR' 'SR04CPS06:CURRENT_SP ' 1 [4,3] 15 1.000 ; ... -'4VCM4 ' 'SR04CPS07:CURRENT_MONITOR' 'SR04CPS07:CURRENT_SP ' 1 [4,4] 16 1.000 ; ... -'5VCM1 ' 'SR05CPS02:CURRENT_MONITOR' 'SR05CPS02:CURRENT_SP ' 1 [5,1] 17 1.000 ; ... -'5VCM2 ' 'SR05CPS04:CURRENT_MONITOR' 'SR05CPS04:CURRENT_SP ' 1 [5,2] 18 1.000 ; ... -'5VCM3 ' 'SR05CPS06:CURRENT_MONITOR' 'SR05CPS06:CURRENT_SP ' 1 [5,3] 19 1.000 ; ... -'5VCM4 ' 'SR05CPS07:CURRENT_MONITOR' 'SR05CPS07:CURRENT_SP ' 1 [5,4] 20 1.000 ; ... -'6VCM1 ' 'SR06CPS02:CURRENT_MONITOR' 'SR06CPS02:CURRENT_SP ' 1 [6,1] 21 1.000 ; ... -'6VCM2 ' 'SR06CPS04:CURRENT_MONITOR' 'SR06CPS04:CURRENT_SP ' 1 [6,2] 22 1.000 ; ... -'6VCM3 ' 'SR06CPS06:CURRENT_MONITOR' 'SR06CPS06:CURRENT_SP ' 1 [6,3] 23 1.000 ; ... -'6VCM4 ' 'SR06CPS07:CURRENT_MONITOR' 'SR06CPS07:CURRENT_SP ' 1 [6,4] 24 1.000 ; ... -'7VCM1 ' 'SR07CPS02:CURRENT_MONITOR' 'SR07CPS02:CURRENT_SP ' 1 [7,1] 25 1.000 ; ... -'7VCM2 ' 'SR07CPS04:CURRENT_MONITOR' 'SR07CPS04:CURRENT_SP ' 1 [7,2] 26 1.000 ; ... -'7VCM3 ' 'SR07CPS06:CURRENT_MONITOR' 'SR07CPS06:CURRENT_SP ' 1 [7,3] 27 1.000 ; ... -'7VCM4 ' 'SR07CPS07:CURRENT_MONITOR' 'SR07CPS07:CURRENT_SP ' 1 [7,4] 28 1.000 ; ... -'8VCM1 ' 'SR08CPS02:CURRENT_MONITOR' 'SR08CPS02:CURRENT_SP ' 1 [8,1] 29 1.000 ; ... -'8VCM2 ' 'SR08CPS04:CURRENT_MONITOR' 'SR08CPS04:CURRENT_SP ' 1 [8,2] 30 1.000 ; ... -'8VCM3 ' 'SR08CPS06:CURRENT_MONITOR' 'SR08CPS06:CURRENT_SP ' 1 [8,3] 31 1.000 ; ... -'8VCM4 ' 'SR08CPS07:CURRENT_MONITOR' 'SR08CPS07:CURRENT_SP ' 1 [8,4] 32 1.000 ; ... -'9VCM1 ' 'SR09CPS02:CURRENT_MONITOR' 'SR09CPS02:CURRENT_SP ' 1 [9,1] 33 1.000 ; ... -'9VCM2 ' 'SR09CPS04:CURRENT_MONITOR' 'SR09CPS04:CURRENT_SP ' 1 [9,2] 34 1.000 ; ... -'9VCM3 ' 'SR09CPS06:CURRENT_MONITOR' 'SR09CPS06:CURRENT_SP ' 1 [9,3] 35 1.000 ; ... -'9VCM4 ' 'SR09CPS07:CURRENT_MONITOR' 'SR09CPS07:CURRENT_SP ' 1 [9,4] 36 1.000 ; ... -'10VCM1 ' 'SR10CPS02:CURRENT_MONITOR' 'SR10CPS02:CURRENT_SP ' 1 [10,1] 37 1.000 ; ... -'10VCM2 ' 'SR10CPS04:CURRENT_MONITOR' 'SR10CPS04:CURRENT_SP ' 1 [10,2] 38 1.000 ; ... -'10VCM3 ' 'SR10CPS06:CURRENT_MONITOR' 'SR10CPS06:CURRENT_SP ' 1 [10,3] 39 1.000 ; ... -'10VCM4 ' 'SR10CPS07:CURRENT_MONITOR' 'SR10CPS07:CURRENT_SP ' 1 [10,4] 40 1.000 ; ... -'11VCM1 ' 'SR11CPS02:CURRENT_MONITOR' 'SR11CPS02:CURRENT_SP ' 1 [11,1] 41 1.000 ; ... -'11VCM2 ' 'SR11CPS04:CURRENT_MONITOR' 'SR11CPS04:CURRENT_SP ' 1 [11,2] 42 1.000 ; ... -'11VCM3 ' 'SR11CPS06:CURRENT_MONITOR' 'SR11CPS06:CURRENT_SP ' 1 [11,3] 43 1.000 ; ... -'11VCM4 ' 'SR11CPS07:CURRENT_MONITOR' 'SR11CPS07:CURRENT_SP ' 1 [11,4] 44 1.000 ; ... -'12VCM1 ' 'SR12CPS02:CURRENT_MONITOR' 'SR12CPS02:CURRENT_SP ' 1 [12,1] 45 1.000 ; ... -'12VCM2 ' 'SR12CPS04:CURRENT_MONITOR' 'SR12CPS04:CURRENT_SP ' 1 [12,2] 46 1.000 ; ... -'12VCM3 ' 'SR12CPS06:CURRENT_MONITOR' 'SR12CPS06:CURRENT_SP ' 1 [12,3] 47 1.000 ; ... -'12VCM4 ' 'SR12CPS07:CURRENT_MONITOR' 'SR12CPS07:CURRENT_SP ' 1 [12,4] 48 1.000 ; ... -'13VCM1 ' 'SR13CPS02:CURRENT_MONITOR' 'SR13CPS02:CURRENT_SP ' 1 [13,1] 49 1.000 ; ... -'13VCM2 ' 'SR13CPS04:CURRENT_MONITOR' 'SR13CPS04:CURRENT_SP ' 1 [13,2] 50 1.000 ; ... -'13VCM3 ' 'SR13CPS06:CURRENT_MONITOR' 'SR13CPS06:CURRENT_SP ' 1 [13,3] 51 1.000 ; ... -'13VCM4 ' 'SR13CPS07:CURRENT_MONITOR' 'SR13CPS07:CURRENT_SP ' 1 [13,4] 52 1.000 ; ... -'14VCM1 ' 'SR14CPS02:CURRENT_MONITOR' 'SR14CPS02:CURRENT_SP ' 1 [14,1] 53 1.000 ; ... -'14VCM2 ' 'SR14CPS04:CURRENT_MONITOR' 'SR14CPS04:CURRENT_SP ' 1 [14,2] 54 1.000 ; ... -'14VCM3 ' 'SR14CPS06:CURRENT_MONITOR' 'SR14CPS06:CURRENT_SP ' 1 [14,3] 55 1.000 ; ... -'14VCM4 ' 'SR14CPS07:CURRENT_MONITOR' 'SR14CPS07:CURRENT_SP ' 1 [14,4] 56 1.000 ; ... -}; - -[C, Leff, MagnetType] = magnetcoefficients('VCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.VCM.Status(ii,1) = val; -val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; - -AO.VCM.Setpoint.Range(ii,:) = [+125 -125]; -AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -%============================= -% MAIN MAGNETS -%============================= - -%=========== -%Dipole data -%=========== - -% *** BEND *** -AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); -AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('BEND'); -Physics2HWParams = magnetcoefficients('BEND'); - -AO.BEND.Monitor.Mode = Mode; -AO.BEND.Monitor.DataType = 'Scalar'; -AO.BEND.Monitor.Units = 'Hardware'; -AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? -AO.BEND.Monitor.Physics2HWFcn = @gev2bend; -AO.BEND.Monitor.HWUnits = 'ampere'; -AO.BEND.Monitor.PhysicsUnits = 'energy'; - -AO.BEND.Setpoint.Mode = Mode; -AO.BEND.Setpoint.DataType = 'Scalar'; -AO.BEND.Setpoint.Units = 'Hardware'; -AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; -AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; -AO.BEND.Setpoint.HWUnits = 'ampere'; -AO.BEND.Setpoint.PhysicsUnits = 'energy'; - -% common monitor setpoint stat devlist elem scale tol -bend={ -'1BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.10 ; ... -'1BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,2] 2 1.0 0.10 ; ... -'2BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.10 ; ... -'2BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,2] 4 1.0 0.10 ; ... -'3BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.10 ; ... -'3BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,2] 6 1.0 0.10 ; ... -'4BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.10 ; ... -'4BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,2] 8 1.0 0.10 ; ... -'5BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.10 ; ... -'5BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,2] 10 1.0 0.10 ; ... -'6BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.10 ; ... -'6BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,2] 12 1.0 0.10 ; ... -'7BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.10 ; ... -'7BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,2] 14 1.0 0.10 ; ... -'8BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.10 ; ... -'8BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,2] 16 1.0 0.10 ; ... -'9BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.10 ; ... -'9BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,2] 18 1.0 0.10 ; ... -'10BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.10 ; ... -'10BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,2] 20 1.0 0.10 ; ... -'11BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.10 ; ... -'11BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,2] 22 1.0 0.10 ; ... -'12BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.10 ; ... -'12BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,2] 24 1.0 0.10 ; ... -'13BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.10 ; ... -'13BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,2] 26 1.0 0.10 ; ... -'14BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.10 ; ... -'14BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,2] 28 1.0 0.10 ; ... -}; - -for ii=1:size(bend,1) -name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; -name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; -name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; -val =bend{ii,4}; AO.BEND.Status(ii,1) = val; -val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; -val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; -val =bend{ii,7}; % This is the scale factor -AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; - -AO.BEND.Setpoint.Range(ii,:) = [50 695]; -end - -%=============== -%Quadrupole data -%=============== - -% *** QFA *** -AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); -AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFA'); -Physics2HWParams = magnetcoefficients('QFA'); - -AO.QFA.Monitor.Mode = Mode; -AO.QFA.Monitor.DataType = 'Scalar'; -AO.QFA.Monitor.Units = 'Hardware'; -AO.QFA.Monitor.HWUnits = 'ampere'; -AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFA.Monitor.Physics2HWFcn = @k2amp; - -AO.QFA.Setpoint.Mode = Mode; -AO.QFA.Setpoint.DataType = 'Scalar'; -AO.QFA.Setpoint.Units = 'Hardware'; -AO.QFA.Setpoint.HWUnits = 'ampere'; -AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qfa={ -'1QFA1 ' 'SR01QPS01:CURRENT_MONITOR' 'SR01QPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... -'1QFA2 ' 'SR01QPS06:CURRENT_MONITOR' 'SR01QPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... -'2QFA1 ' 'SR02QPS01:CURRENT_MONITOR' 'SR02QPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... -'2QFA2 ' 'SR02QPS06:CURRENT_MONITOR' 'SR02QPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... -'3QFA1 ' 'SR03QPS01:CURRENT_MONITOR' 'SR03QPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... -'3QFA2 ' 'SR03QPS06:CURRENT_MONITOR' 'SR03QPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... -'4QFA1 ' 'SR04QPS01:CURRENT_MONITOR' 'SR04QPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... -'4QFA2 ' 'SR04QPS06:CURRENT_MONITOR' 'SR04QPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... -'5QFA1 ' 'SR05QPS01:CURRENT_MONITOR' 'SR05QPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... -'5QFA2 ' 'SR05QPS06:CURRENT_MONITOR' 'SR05QPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... -'6QFA1 ' 'SR06QPS01:CURRENT_MONITOR' 'SR06QPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... -'6QFA2 ' 'SR06QPS06:CURRENT_MONITOR' 'SR06QPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... -'7QFA1 ' 'SR07QPS01:CURRENT_MONITOR' 'SR07QPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... -'7QFA2 ' 'SR07QPS06:CURRENT_MONITOR' 'SR07QPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... -'8QFA1 ' 'SR08QPS01:CURRENT_MONITOR' 'SR08QPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... -'8QFA2 ' 'SR08QPS06:CURRENT_MONITOR' 'SR08QPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... -'9QFA1 ' 'SR09QPS01:CURRENT_MONITOR' 'SR09QPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... -'9QFA2 ' 'SR09QPS06:CURRENT_MONITOR' 'SR09QPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... -'10QFA1 ' 'SR10QPS01:CURRENT_MONITOR' 'SR10QPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... -'10QFA2 ' 'SR10QPS06:CURRENT_MONITOR' 'SR10QPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... -'11QFA1 ' 'SR11QPS01:CURRENT_MONITOR' 'SR11QPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... -'11QFA2 ' 'SR11QPS06:CURRENT_MONITOR' 'SR11QPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... -'12QFA1 ' 'SR12QPS01:CURRENT_MONITOR' 'SR12QPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... -'12QFA2 ' 'SR12QPS06:CURRENT_MONITOR' 'SR12QPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... -'13QFA1 ' 'SR13QPS01:CURRENT_MONITOR' 'SR13QPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... -'13QFA2 ' 'SR13QPS06:CURRENT_MONITOR' 'SR13QPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... -'14QFA1 ' 'SR14QPS01:CURRENT_MONITOR' 'SR14QPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... -'14QFA2 ' 'SR14QPS06:CURRENT_MONITOR' 'SR14QPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... -}; - -for ii=1:size(qfa,1) -name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; -name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; -name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; -val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; -val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; -val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; -val =qfa{ii,7}; % This is the scale factor -AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; - -AO.QFA.Setpoint.Range(ii,:) = [0 160]; -end - - -% *** QDA *** -AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); -AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; -HW2PhysicsParams = magnetcoefficients('QDA'); -Physics2HWParams = magnetcoefficients('QDA'); - -AO.QDA.Monitor.Mode = Mode; -AO.QDA.Monitor.DataType = 'Scalar'; -AO.QDA.Monitor.Units = 'Hardware'; -AO.QDA.Monitor.HWUnits = 'ampere'; -AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QDA.Monitor.Physics2HWFcn = @k2amp; - -AO.QDA.Setpoint.Mode = Mode; -AO.QDA.Setpoint.DataType = 'Scalar'; -AO.QDA.Setpoint.Units = 'Hardware'; -AO.QDA.Setpoint.HWUnits = 'ampere'; -AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QDA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qda={ -'1QDA1 ' 'SR01QPS02:CURRENT_MONITOR' 'SR01QPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... -'1QDA2 ' 'SR01QPS05:CURRENT_MONITOR' 'SR01QPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... -'2QDA1 ' 'SR02QPS02:CURRENT_MONITOR' 'SR02QPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... -'2QDA2 ' 'SR02QPS05:CURRENT_MONITOR' 'SR02QPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... -'3QDA1 ' 'SR03QPS02:CURRENT_MONITOR' 'SR03QPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... -'3QDA2 ' 'SR03QPS05:CURRENT_MONITOR' 'SR03QPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... -'4QDA1 ' 'SR04QPS02:CURRENT_MONITOR' 'SR04QPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... -'4QDA2 ' 'SR04QPS05:CURRENT_MONITOR' 'SR04QPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... -'5QDA1 ' 'SR05QPS02:CURRENT_MONITOR' 'SR05QPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... -'5QDA2 ' 'SR05QPS05:CURRENT_MONITOR' 'SR05QPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... -'6QDA1 ' 'SR06QPS02:CURRENT_MONITOR' 'SR06QPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... -'6QDA2 ' 'SR06QPS05:CURRENT_MONITOR' 'SR06QPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... -'7QDA1 ' 'SR07QPS02:CURRENT_MONITOR' 'SR07QPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... -'7QDA2 ' 'SR07QPS05:CURRENT_MONITOR' 'SR07QPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... -'8QDA1 ' 'SR08QPS02:CURRENT_MONITOR' 'SR08QPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... -'8QDA2 ' 'SR08QPS05:CURRENT_MONITOR' 'SR08QPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... -'9QDA1 ' 'SR09QPS02:CURRENT_MONITOR' 'SR09QPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... -'9QDA2 ' 'SR09QPS05:CURRENT_MONITOR' 'SR09QPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... -'10QDA1 ' 'SR10QPS02:CURRENT_MONITOR' 'SR10QPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... -'10QDA2 ' 'SR10QPS05:CURRENT_MONITOR' 'SR10QPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... -'11QDA1 ' 'SR11QPS02:CURRENT_MONITOR' 'SR11QPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... -'11QDA2 ' 'SR11QPS05:CURRENT_MONITOR' 'SR11QPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... -'12QDA1 ' 'SR12QPS02:CURRENT_MONITOR' 'SR12QPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... -'12QDA2 ' 'SR12QPS05:CURRENT_MONITOR' 'SR12QPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... -'13QDA1 ' 'SR13QPS02:CURRENT_MONITOR' 'SR13QPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... -'13QDA2 ' 'SR13QPS05:CURRENT_MONITOR' 'SR13QPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... -'14QDA1 ' 'SR14QPS02:CURRENT_MONITOR' 'SR14QPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... -'14QDA2 ' 'SR14QPS05:CURRENT_MONITOR' 'SR14QPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... -}; - -for ii=1:size(qda,1) -name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; -name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; -name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; -val =qda{ii,4}; AO.QDA.Status(ii,1) = val; -val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; -val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; -val =qda{ii,7}; % This is the scale factor -AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; - -AO.QDA.Setpoint.Range(ii,:) = [0 90]; -end - - - -% *** QFB *** -AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); -AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFB'); -Physics2HWParams = magnetcoefficients('QFB'); - -AO.QFB.Monitor.Mode = Mode; -AO.QFB.Monitor.DataType = 'Scalar'; -AO.QFB.Monitor.Units = 'Hardware'; -AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFB.Monitor.Physics2HWFcn = @k2amp; -AO.QFB.Monitor.HWUnits = 'ampere'; -AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; - -AO.QFB.Setpoint.Mode = Mode; -AO.QFB.Setpoint.DataType = 'Scalar'; -AO.QFB.Setpoint.Units = 'Hardware'; -AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFB.Setpoint.Physics2HWFcn = @k2amp; -AO.QFB.Setpoint.HWUnits = 'ampere'; -AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -qfb={ -'1QFB1 ' 'SR01QPS03:CURRENT_MONITOR' 'SR01QPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... -'1QFB2 ' 'SR01QPS04:CURRENT_MONITOR' 'SR01QPS04:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... -'2QFB1 ' 'SR02QPS03:CURRENT_MONITOR' 'SR02QPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... -'2QFB2 ' 'SR02QPS04:CURRENT_MONITOR' 'SR02QPS04:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... -'3QFB1 ' 'SR03QPS03:CURRENT_MONITOR' 'SR03QPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... -'3QFB2 ' 'SR03QPS04:CURRENT_MONITOR' 'SR03QPS04:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... -'4QFB1 ' 'SR04QPS03:CURRENT_MONITOR' 'SR04QPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... -'4QFB2 ' 'SR04QPS04:CURRENT_MONITOR' 'SR04QPS04:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... -'5QFB1 ' 'SR05QPS03:CURRENT_MONITOR' 'SR05QPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... -'5QFB2 ' 'SR05QPS04:CURRENT_MONITOR' 'SR05QPS04:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... -'6QFB1 ' 'SR06QPS03:CURRENT_MONITOR' 'SR06QPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... -'6QFB2 ' 'SR06QPS04:CURRENT_MONITOR' 'SR06QPS04:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... -'7QFB1 ' 'SR07QPS03:CURRENT_MONITOR' 'SR07QPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... -'7QFB2 ' 'SR07QPS04:CURRENT_MONITOR' 'SR07QPS04:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... -'8QFB1 ' 'SR08QPS03:CURRENT_MONITOR' 'SR08QPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... -'8QFB2 ' 'SR08QPS04:CURRENT_MONITOR' 'SR08QPS04:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... -'9QFB1 ' 'SR09QPS03:CURRENT_MONITOR' 'SR09QPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... -'9QFB2 ' 'SR09QPS04:CURRENT_MONITOR' 'SR09QPS04:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... -'10QFB1 ' 'SR10QPS03:CURRENT_MONITOR' 'SR10QPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... -'10QFB2 ' 'SR10QPS04:CURRENT_MONITOR' 'SR10QPS04:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... -'11QFB1 ' 'SR11QPS03:CURRENT_MONITOR' 'SR11QPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... -'11QFB2 ' 'SR11QPS04:CURRENT_MONITOR' 'SR11QPS04:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... -'12QFB1 ' 'SR12QPS03:CURRENT_MONITOR' 'SR12QPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... -'12QFB2 ' 'SR12QPS04:CURRENT_MONITOR' 'SR12QPS04:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... -'13QFB1 ' 'SR13QPS03:CURRENT_MONITOR' 'SR13QPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... -'13QFB2 ' 'SR13QPS04:CURRENT_MONITOR' 'SR13QPS04:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... -'14QFB1 ' 'SR14QPS03:CURRENT_MONITOR' 'SR14QPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... -'14QFB2 ' 'SR14QPS04:CURRENT_MONITOR' 'SR14QPS04:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... -}; - -for ii=1:size(qfb,1) -name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; -name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; -name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; -val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; -val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; -val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; -val =qfb{ii,7}; % This is the scale factor -AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; - -AO.QFB.Setpoint.Range(ii,:) = [0 160]; -end - - -%=============== -%Sextupole data -%=============== -% *** SFA *** -AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); -AO.SFA.MemberOf = {'PlotFamily'; 'SF'; 'SEXT'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFA'); -Physics2HWParams = magnetcoefficients('SFA'); - -AO.SFA.Monitor.Mode = Mode; -AO.SFA.Monitor.DataType = 'Scalar'; -AO.SFA.Monitor.Units = 'Hardware'; -AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFA.Monitor.Physics2HWFcn = @k2amp; -AO.SFA.Monitor.HWUnits = 'ampere'; -AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFA.Setpoint.Mode = Mode; -AO.SFA.Setpoint.DataType = 'Scalar'; -AO.SFA.Setpoint.Units = 'Hardware'; -AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFA.Setpoint.Physics2HWFcn = @k2amp; -AO.SFA.Setpoint.HWUnits = 'ampere'; -AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfa={ -'1SFA1 ' 'SR01SPS01:CURRENT_MONITOR' 'SR01SPS01:CURRENT_SP ' 0 [1,1] 1 1.0 0.05 ; ... -'1SFA2 ' 'SR01SPS07:CURRENT_MONITOR' 'SR01SPS07:CURRENT_SP ' 0 [1,2] 2 1.0 0.05 ; ... -'2SFA1 ' 'SR02SPS01:CURRENT_MONITOR' 'SR02SPS01:CURRENT_SP ' 0 [2,1] 3 1.0 0.05 ; ... -'2SFA2 ' 'SR02SPS07:CURRENT_MONITOR' 'SR02SPS07:CURRENT_SP ' 0 [2,2] 4 1.0 0.05 ; ... -'3SFA1 ' 'SR03SPS01:CURRENT_MONITOR' 'SR03SPS01:CURRENT_SP ' 0 [3,1] 5 1.0 0.05 ; ... -'3SFA2 ' 'SR03SPS07:CURRENT_MONITOR' 'SR03SPS07:CURRENT_SP ' 0 [3,2] 6 1.0 0.05 ; ... -'4SFA1 ' 'SR04SPS01:CURRENT_MONITOR' 'SR04SPS01:CURRENT_SP ' 0 [4,1] 7 1.0 0.05 ; ... -'4SFA2 ' 'SR04SPS07:CURRENT_MONITOR' 'SR04SPS07:CURRENT_SP ' 0 [4,2] 8 1.0 0.05 ; ... -'5SFA1 ' 'SR05SPS01:CURRENT_MONITOR' 'SR05SPS01:CURRENT_SP ' 0 [5,1] 9 1.0 0.05 ; ... -'5SFA2 ' 'SR05SPS07:CURRENT_MONITOR' 'SR05SPS07:CURRENT_SP ' 0 [5,2] 10 1.0 0.05 ; ... -'6SFA1 ' 'SR06SPS01:CURRENT_MONITOR' 'SR06SPS01:CURRENT_SP ' 0 [6,1] 11 1.0 0.05 ; ... -'6SFA2 ' 'SR06SPS07:CURRENT_MONITOR' 'SR06SPS07:CURRENT_SP ' 0 [6,2] 12 1.0 0.05 ; ... -'7SFA1 ' 'SR07SPS01:CURRENT_MONITOR' 'SR07SPS01:CURRENT_SP ' 0 [7,1] 13 1.0 0.05 ; ... -'7SFA2 ' 'SR07SPS07:CURRENT_MONITOR' 'SR07SPS07:CURRENT_SP ' 1 [7,2] 14 1.0 0.05 ; ... -'8SFA1 ' 'SR08SPS01:CURRENT_MONITOR' 'SR08SPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.05 ; ... -'8SFA2 ' 'SR08SPS07:CURRENT_MONITOR' 'SR08SPS07:CURRENT_SP ' 1 [8,2] 16 1.0 0.05 ; ... -'9SFA1 ' 'SR09SPS01:CURRENT_MONITOR' 'SR09SPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.05 ; ... -'9SFA2 ' 'SR09SPS07:CURRENT_MONITOR' 'SR09SPS07:CURRENT_SP ' 1 [9,2] 18 1.0 0.05 ; ... -'10SFA1 ' 'SR10SPS01:CURRENT_MONITOR' 'SR10SPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.05 ; ... -'10SFA2 ' 'SR10SPS07:CURRENT_MONITOR' 'SR10SPS07:CURRENT_SP ' 1 [10,2] 20 1.0 0.05 ; ... -'11SFA1 ' 'SR11SPS01:CURRENT_MONITOR' 'SR11SPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.05 ; ... -'11SFA2 ' 'SR11SPS07:CURRENT_MONITOR' 'SR11SPS07:CURRENT_SP ' 1 [11,2] 22 1.0 0.05 ; ... -'12SFA1 ' 'SR12SPS01:CURRENT_MONITOR' 'SR12SPS01:CURRENT_SP ' 0 [12,1] 23 1.0 0.05 ; ... -'12SFA2 ' 'SR12SPS07:CURRENT_MONITOR' 'SR12SPS07:CURRENT_SP ' 1 [12,2] 24 1.0 0.05 ; ... -'13SFA1 ' 'SR13SPS01:CURRENT_MONITOR' 'SR13SPS01:CURRENT_SP ' 0 [13,1] 25 1.0 0.05 ; ... -'13SFA2 ' 'SR13SPS07:CURRENT_MONITOR' 'SR13SPS07:CURRENT_SP ' 0 [13,2] 26 1.0 0.05 ; ... -'14SFA1 ' 'SR14SPS01:CURRENT_MONITOR' 'SR14SPS01:CURRENT_SP ' 0 [14,1] 27 1.0 0.05 ; ... -'14SFA2 ' 'SR14SPS07:CURRENT_MONITOR' 'SR14SPS07:CURRENT_SP ' 0 [14,2] 28 1.0 0.05 ; ... -}; - -for ii=1:size(sfa,1) -name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; -name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; -name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; -val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; -val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; -val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; -val =sfa{ii,7}; % This is the scale factor -AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; - -AO.SFA.Setpoint.Range(ii,:) = [0 140]; -end - - - -% *** SDA *** -AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); -AO.SDA.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDA'); -Physics2HWParams = magnetcoefficients('SDA'); - -AO.SDA.Monitor.Mode = Mode; -AO.SDA.Monitor.DataType = 'Scalar'; -AO.SDA.Monitor.Units = 'Hardware'; -AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDA.Monitor.Physics2HWFcn = @k2amp; -AO.SDA.Monitor.HWUnits = 'ampere'; -AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDA.Setpoint.Mode = Mode; -AO.SDA.Setpoint.DataType = 'Scalar'; -AO.SDA.Setpoint.Units = 'Hardware'; -AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDA.Setpoint.Physics2HWFcn = @k2amp; -AO.SDA.Setpoint.HWUnits = 'ampere'; -AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; - - -% common monitor setpoint stat devlist elem scale tol -sda={ -'1SDA1 ' 'SR01SPS02:CURRENT_MONITOR' 'SR01SPS02:CURRENT_SP ' 0 [1,1] 1 1.0 0.05 ; ... -'1SDA2 ' 'SR01SPS06:CURRENT_MONITOR' 'SR01SPS06:CURRENT_SP ' 0 [1,2] 2 1.0 0.05 ; ... -'2SDA1 ' 'SR02SPS02:CURRENT_MONITOR' 'SR02SPS02:CURRENT_SP ' 0 [2,1] 3 1.0 0.05 ; ... -'2SDA2 ' 'SR02SPS06:CURRENT_MONITOR' 'SR02SPS06:CURRENT_SP ' 0 [2,2] 4 1.0 0.05 ; ... -'3SDA1 ' 'SR03SPS02:CURRENT_MONITOR' 'SR03SPS02:CURRENT_SP ' 0 [3,1] 5 1.0 0.05 ; ... -'3SDA2 ' 'SR03SPS06:CURRENT_MONITOR' 'SR03SPS06:CURRENT_SP ' 0 [3,2] 6 1.0 0.05 ; ... -'4SDA1 ' 'SR04SPS02:CURRENT_MONITOR' 'SR04SPS02:CURRENT_SP ' 0 [4,1] 7 1.0 0.05 ; ... -'4SDA2 ' 'SR04SPS06:CURRENT_MONITOR' 'SR04SPS06:CURRENT_SP ' 0 [4,2] 8 1.0 0.05 ; ... -'5SDA1 ' 'SR05SPS02:CURRENT_MONITOR' 'SR05SPS02:CURRENT_SP ' 0 [5,1] 9 1.0 0.05 ; ... -'5SDA2 ' 'SR05SPS06:CURRENT_MONITOR' 'SR05SPS06:CURRENT_SP ' 0 [5,2] 10 1.0 0.05 ; ... -'6SDA1 ' 'SR06SPS02:CURRENT_MONITOR' 'SR06SPS02:CURRENT_SP ' 0 [6,1] 11 1.0 0.05 ; ... -'6SDA2 ' 'SR06SPS06:CURRENT_MONITOR' 'SR06SPS06:CURRENT_SP ' 0 [6,2] 12 1.0 0.05 ; ... -'7SDA1 ' 'SR07SPS02:CURRENT_MONITOR' 'SR07SPS02:CURRENT_SP ' 0 [7,1] 13 1.0 0.05 ; ... -'7SDA2 ' 'SR07SPS06:CURRENT_MONITOR' 'SR07SPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.05 ; ... -'8SDA1 ' 'SR08SPS02:CURRENT_MONITOR' 'SR08SPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.05 ; ... -'8SDA2 ' 'SR08SPS06:CURRENT_MONITOR' 'SR08SPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.05 ; ... -'9SDA1 ' 'SR09SPS02:CURRENT_MONITOR' 'SR09SPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.05 ; ... -'9SDA2 ' 'SR09SPS06:CURRENT_MONITOR' 'SR09SPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.05 ; ... -'10SDA1 ' 'SR10SPS02:CURRENT_MONITOR' 'SR10SPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.05 ; ... -'10SDA2 ' 'SR10SPS06:CURRENT_MONITOR' 'SR10SPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.05 ; ... -'11SDA1 ' 'SR11SPS02:CURRENT_MONITOR' 'SR11SPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.05 ; ... -'11SDA2 ' 'SR11SPS06:CURRENT_MONITOR' 'SR11SPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.05 ; ... -'12SDA1 ' 'SR12SPS02:CURRENT_MONITOR' 'SR12SPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.05 ; ... -'12SDA2 ' 'SR12SPS06:CURRENT_MONITOR' 'SR12SPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.05 ; ... -'13SDA1 ' 'SR13SPS02:CURRENT_MONITOR' 'SR13SPS02:CURRENT_SP ' 0 [13,1] 25 1.0 0.05 ; ... -'13SDA2 ' 'SR13SPS06:CURRENT_MONITOR' 'SR13SPS06:CURRENT_SP ' 0 [13,2] 26 1.0 0.05 ; ... -'14SDA1 ' 'SR14SPS02:CURRENT_MONITOR' 'SR14SPS02:CURRENT_SP ' 0 [14,1] 27 1.0 0.05 ; ... -'14SDA2 ' 'SR14SPS06:CURRENT_MONITOR' 'SR14SPS06:CURRENT_SP ' 0 [14,2] 28 1.0 0.05 ; ... -}; - -for ii=1:size(sda,1) -name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; -name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; -name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; -val =sda{ii,4}; AO.SDA.Status(ii,1) = val; -val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; -val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; -val =sda{ii,7}; % This is the scale factor -AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; - -AO.SDA.Setpoint.Range(ii,:) = [0 140]; -end - - -% *** SDB *** -AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); -AO.SDB.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDB'); -Physics2HWParams = magnetcoefficients('SDB'); - -AO.SDB.Monitor.Mode = Mode; -AO.SDB.Monitor.DataType = 'Scalar'; -AO.SDB.Monitor.Units = 'Hardware'; -AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDB.Monitor.Physics2HWFcn = @k2amp; -AO.SDB.Monitor.HWUnits = 'ampere'; -AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDB.Setpoint.Mode = Mode; -AO.SDB.Setpoint.DataType = 'Scalar'; -AO.SDB.Setpoint.Units = 'Hardware'; -AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDB.Setpoint.Physics2HWFcn = @k2amp; -AO.SDB.Setpoint.HWUnits = 'ampere'; -AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sdb={ -'1SDB1 ' 'SR01SPS03:CURRENT_MONITOR' 'SR01SPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.05 ; ... -'1SDB2 ' 'SR01SPS05:CURRENT_MONITOR' 'SR01SPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.05 ; ... -'2SDB1 ' 'SR02SPS03:CURRENT_MONITOR' 'SR02SPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.05 ; ... -'2SDB2 ' 'SR02SPS05:CURRENT_MONITOR' 'SR02SPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.05 ; ... -'3SDB1 ' 'SR03SPS03:CURRENT_MONITOR' 'SR03SPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.05 ; ... -'3SDB2 ' 'SR03SPS05:CURRENT_MONITOR' 'SR03SPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.05 ; ... -'4SDB1 ' 'SR04SPS03:CURRENT_MONITOR' 'SR04SPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.05 ; ... -'4SDB2 ' 'SR04SPS05:CURRENT_MONITOR' 'SR04SPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.05 ; ... -'5SDB1 ' 'SR05SPS03:CURRENT_MONITOR' 'SR05SPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.05 ; ... -'5SDB2 ' 'SR05SPS05:CURRENT_MONITOR' 'SR05SPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.05 ; ... -'6SDB1 ' 'SR06SPS03:CURRENT_MONITOR' 'SR06SPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.05 ; ... -'6SDB2 ' 'SR06SPS05:CURRENT_MONITOR' 'SR06SPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.05 ; ... -'7SDB1 ' 'SR07SPS03:CURRENT_MONITOR' 'SR07SPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.05 ; ... -'7SDB2 ' 'SR07SPS05:CURRENT_MONITOR' 'SR07SPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.05 ; ... -'8SDB1 ' 'SR08SPS03:CURRENT_MONITOR' 'SR08SPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.05 ; ... -'8SDB2 ' 'SR08SPS05:CURRENT_MONITOR' 'SR08SPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.05 ; ... -'9SDB1 ' 'SR09SPS03:CURRENT_MONITOR' 'SR09SPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.05 ; ... -'9SDB2 ' 'SR09SPS05:CURRENT_MONITOR' 'SR09SPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.05 ; ... -'10SDB1 ' 'SR10SPS03:CURRENT_MONITOR' 'SR10SPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.05 ; ... -'10SDB2 ' 'SR10SPS05:CURRENT_MONITOR' 'SR10SPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.05 ; ... -'11SDB1 ' 'SR11SPS03:CURRENT_MONITOR' 'SR11SPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.05 ; ... -'11SDB2 ' 'SR11SPS05:CURRENT_MONITOR' 'SR11SPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.05 ; ... -'12SDB1 ' 'SR12SPS03:CURRENT_MONITOR' 'SR12SPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.05 ; ... -'12SDB2 ' 'SR12SPS05:CURRENT_MONITOR' 'SR12SPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.05 ; ... -'13SDB1 ' 'SR13SPS03:CURRENT_MONITOR' 'SR13SPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.05 ; ... -'13SDB2 ' 'SR13SPS05:CURRENT_MONITOR' 'SR13SPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.05 ; ... -'14SDB1 ' 'SR14SPS03:CURRENT_MONITOR' 'SR14SPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.05 ; ... -'14SDB2 ' 'SR14SPS05:CURRENT_MONITOR' 'SR14SPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.05 ; ... -}; - -for ii=1:size(sdb,1) -name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; -name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; -name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; -val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; -val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; -val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; -val =sdb{ii,7}; % This is the scale factor -AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; - -AO.SDB.Setpoint.Range(ii,:) = [0 140]; -end - - - -% *** SFB *** -AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); -AO.SFB.MemberOf = {'PlotFamily'; 'SF'; 'SEXT'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFB'); -Physics2HWParams = magnetcoefficients('SFB'); - -AO.SFB.Monitor.Mode = Mode; -AO.SFB.Monitor.DataType = 'Scalar'; -AO.SFB.Monitor.Units = 'Hardware'; -AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFB.Monitor.Physics2HWFcn = @k2amp; -AO.SFB.Monitor.HWUnits = 'ampere'; -AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFB.Setpoint.Mode = Mode; -AO.SFB.Setpoint.DataType = 'Scalar'; -AO.SFB.Setpoint.Units = 'Hardware'; -AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFB.Setpoint.Physics2HWFcn = @k2amp; -AO.SFB.Setpoint.HWUnits = 'ampere'; -AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfb={ -'1SFB1 ' 'SR01SPS04:CURRENT_MONITOR' 'SR01SPS04:CURRENT_SP ' 1 [1,1] 1 1.0 0.05 ; ... -'2SFB1 ' 'SR02SPS04:CURRENT_MONITOR' 'SR02SPS04:CURRENT_SP ' 1 [2,1] 2 1.0 0.05 ; ... -'3SFB1 ' 'SR03SPS04:CURRENT_MONITOR' 'SR03SPS04:CURRENT_SP ' 1 [3,1] 3 1.0 0.05 ; ... -'4SFB1 ' 'SR04SPS04:CURRENT_MONITOR' 'SR04SPS04:CURRENT_SP ' 1 [4,1] 4 1.0 0.05 ; ... -'5SFB1 ' 'SR05SPS04:CURRENT_MONITOR' 'SR05SPS04:CURRENT_SP ' 1 [5,1] 5 1.0 0.05 ; ... -'6SFB1 ' 'SR06SPS04:CURRENT_MONITOR' 'SR06SPS04:CURRENT_SP ' 1 [6,1] 6 1.0 0.05 ; ... -'7SFB1 ' 'SR07SPS04:CURRENT_MONITOR' 'SR07SPS04:CURRENT_SP ' 1 [7,1] 7 1.0 0.05 ; ... -'8SFB1 ' 'SR08SPS04:CURRENT_MONITOR' 'SR08SPS04:CURRENT_SP ' 1 [8,1] 8 1.0 0.05 ; ... -'9SFB1 ' 'SR09SPS04:CURRENT_MONITOR' 'SR09SPS04:CURRENT_SP ' 1 [9,1] 9 1.0 0.05 ; ... -'10SFB1 ' 'SR10SPS04:CURRENT_MONITOR' 'SR10SPS04:CURRENT_SP ' 1 [10,1] 10 1.0 0.05 ; ... -'11SFB1 ' 'SR11SPS04:CURRENT_MONITOR' 'SR11SPS04:CURRENT_SP ' 1 [11,1] 11 1.0 0.05 ; ... -'12SFB1 ' 'SR12SPS04:CURRENT_MONITOR' 'SR12SPS04:CURRENT_SP ' 1 [12,1] 12 1.0 0.05 ; ... -'13SFB1 ' 'SR13SPS04:CURRENT_MONITOR' 'SR13SPS04:CURRENT_SP ' 1 [13,1] 13 1.0 0.05 ; ... -'14SFB1 ' 'SR14SPS04:CURRENT_MONITOR' 'SR14SPS04:CURRENT_SP ' 1 [14,1] 14 1.0 0.05 ; ... -}; - -for ii=1:size(sfb,1) -name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; -name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; -name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; -val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; -val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; -val =sfb{ii,6}; AO.SFB.ElementLsist(ii,1) = val; -val =sfb{ii,7}; % This is the scale factor -AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; - -AO.SFB.Setpoint.Range(ii,:) = [0 140]; -end - -%=============== -%Skew Quad data -%=============== -% *** Skew quadrupoles *** 2005/09/27 Eugene -AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); -AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('SKQ'); -Physics2HWParams = magnetcoefficients('SKQ'); - -AO.SKQ.Monitor.Mode = Mode; -AO.SKQ.Monitor.DataType = 'Scalar'; -AO.SKQ.Monitor.Units = 'Hardware'; -AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; -AO.SKQ.Monitor.Physics2HWFcn = @k2amp; -AO.SKQ.Monitor.HWUnits = 'ampere'; -AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; - -AO.SKQ.Setpoint.Mode = Mode; -AO.SKQ.Setpoint.DataType = 'Scalar'; -AO.SKQ.Setpoint.Units = 'Hardware'; -AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; -AO.SKQ.Setpoint.HWUnits = 'ampere'; -AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -sq={ -'1SKQ1 ' 'SR01CPS03:CURRENT_MONITOR' 'SR01CPS03:CURRENT_SP ' 1 [1,1] 1 1 ; ... -'1SKQ2 ' 'SR01CPS08:CURRENT_MONITOR' 'SR01CPS08:CURRENT_SP ' 1 [1,2] 2 1 ; ... -'2SKQ1 ' 'SR02CPS03:CURRENT_MONITOR' 'SR02CPS03:CURRENT_SP ' 1 [2,1] 3 1 ; ... -'2SKQ2 ' 'SR02CPS08:CURRENT_MONITOR' 'SR02CPS08:CURRENT_SP ' 1 [2,2] 4 1 ; ... -'3SKQ1 ' 'SR03CPS03:CURRENT_MONITOR' 'SR03CPS03:CURRENT_SP ' 1 [3,1] 5 1 ; ... -'3SKQ2 ' 'SR03CPS08:CURRENT_MONITOR' 'SR03CPS08:CURRENT_SP ' 1 [3,2] 6 1 ; ... -'4SKQ1 ' 'SR04CPS03:CURRENT_MONITOR' 'SR04CPS03:CURRENT_SP ' 1 [4,1] 7 1 ; ... -'4SKQ2 ' 'SR04CPS08:CURRENT_MONITOR' 'SR04CPS08:CURRENT_SP ' 1 [4,2] 8 1 ; ... -'5SKQ1 ' 'SR05CPS03:CURRENT_MONITOR' 'SR05CPS03:CURRENT_SP ' 1 [5,1] 9 1 ; ... -'5SKQ2 ' 'SR05CPS08:CURRENT_MONITOR' 'SR05CPS08:CURRENT_SP ' 1 [5,2] 10 1 ; ... -'6SKQ1 ' 'SR06CPS03:CURRENT_MONITOR' 'SR06CPS03:CURRENT_SP ' 1 [6,1] 11 1 ; ... -'6SKQ2 ' 'SR06CPS08:CURRENT_MONITOR' 'SR06CPS08:CURRENT_SP ' 1 [6,2] 12 1 ; ... -'7SKQ1 ' 'SR07CPS03:CURRENT_MONITOR' 'SR07CPS03:CURRENT_SP ' 1 [7,1] 13 1 ; ... -'7SKQ2 ' 'SR07CPS08:CURRENT_MONITOR' 'SR07CPS08:CURRENT_SP ' 1 [7,2] 14 1 ; ... -'8SKQ1 ' 'SR08CPS03:CURRENT_MONITOR' 'SR08CPS03:CURRENT_SP ' 1 [8,1] 15 1 ; ... -'8SKQ2 ' 'SR08CPS08:CURRENT_MONITOR' 'SR08CPS08:CURRENT_SP ' 1 [8,2] 16 1 ; ... -'9SKQ1 ' 'SR09CPS03:CURRENT_MONITOR' 'SR09CPS03:CURRENT_SP ' 1 [9,1] 17 1 ; ... -'9SKQ2 ' 'SR09CPS08:CURRENT_MONITOR' 'SR09CPS08:CURRENT_SP ' 1 [9,2] 18 1 ; ... -'10SKQ1 ' 'SR10CPS03:CURRENT_MONITOR' 'SR10CPS03:CURRENT_SP ' 1 [10,1] 19 1 ; ... -'10SKQ2 ' 'SR10CPS08:CURRENT_MONITOR' 'SR10CPS08:CURRENT_SP ' 1 [10,2] 20 1 ; ... -'11SKQ1 ' 'SR11CPS03:CURRENT_MONITOR' 'SR11CPS03:CURRENT_SP ' 1 [11,1] 21 1 ; ... -'11SKQ2 ' 'SR11CPS08:CURRENT_MONITOR' 'SR11CPS08:CURRENT_SP ' 1 [11,2] 22 1 ; ... -'12SKQ1 ' 'SR12CPS03:CURRENT_MONITOR' 'SR12CPS03:CURRENT_SP ' 1 [12,1] 23 1 ; ... -'12SKQ2 ' 'SR12CPS08:CURRENT_MONITOR' 'SR12CPS08:CURRENT_SP ' 1 [12,2] 24 1 ; ... -'13SKQ1 ' 'SR13CPS03:CURRENT_MONITOR' 'SR13CPS03:CURRENT_SP ' 1 [13,1] 25 1 ; ... -'13SKQ2 ' 'SR13CPS08:CURRENT_MONITOR' 'SR13CPS08:CURRENT_SP ' 1 [13,2] 26 1 ; ... -'14SKQ1 ' 'SR14CPS03:CURRENT_MONITOR' 'SR14CPS03:CURRENT_SP ' 1 [14,1] 27 1 ; ... -'14SKQ2 ' 'SR14CPS08:CURRENT_MONITOR' 'SR14CPS08:CURRENT_SP ' 1 [14,2] 28 1 ; ... -}; - -for ii=1:size(sq,1) -name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; -name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; -name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; -val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; -val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; -val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; -val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; -AO.SKQ.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SKQ.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SKQ.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SKQ.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; - -AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; -end - - -%=============== -%Kicker data -%=============== -AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); -AO.KICK.MemberOf = {'Injection','MachineConfig'}; - -AO.KICK.Monitor.Mode = Mode; -AO.KICK.Monitor.DataType = 'Scalar'; -AO.KICK.Monitor.Units = 'Hardware'; -AO.KICK.Monitor.HWUnits = 'kVolts'; -AO.KICK.Monitor.PhysicsUnits = 'mradian'; - -AO.KICK.Setpoint.Mode = Mode; -AO.KICK.Setpoint.DataType = 'Scalar'; -AO.KICK.Setpoint.Units = 'Hardware'; -AO.KICK.Setpoint.HWUnits = 'Volts'; -AO.KICK.Setpoint.PhysicsUnits = 'radian'; - -% From kicker deisgn review the kickers are rated to 4380 Amps giving 0.038 -% Tesla converting this to kickangle. Also convert voltage into amps for -% the conversion? -% -% 2780 V on the capacitor banks will create 5240 A delivered to the kicker -% magnets. -% From simulations 4380 A creates 0.038607 T over a length of 0.7 m. -% Therefore 4380 A => 2.7006 mrad. Therefore 2323.740 V => 2.7006 mrad. -% HW2PHYSICS conversion factor (kV to rad) is therefore 0.0027006/2.32374 = -% 0.00116217821271. The Ps also goes through a 1:3 transformer therefore -% the conversion factor increases by 3. Ie 0.00348653463813 -% For V to rad then 0.00000348653463813. -hw2physics_conversionfactor = 0.00000348653463813; - -%common monitor setpoint stat devlist elem tol -kickeramp={ -'KICK1 ' 'SR14KPS01:VOLTAGE_MONITOR' 'SR14KPS01:VOLTAGE_SP ' 1 [1,1] 1 0.10 ; ... -'KICK2 ' 'SR01KPS01:VOLTAGE_MONITOR' 'SR01KPS01:VOLTAGE_SP ' 1 [1,2] 2 0.10 ; ... -'KICK3 ' 'SR01KPS02:VOLTAGE_MONITOR' 'SR01KPS02:VOLTAGE_SP ' 1 [1,3] 3 0.10 ; ... -'KICK4 ' 'SR02KPS01:VOLTAGE_MONITOR' 'SR02KPS01:VOLTAGE_SP ' 1 [1,4] 4 0.10 ; ... -}; - -for ii=1:size(kickeramp,1) -name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; -name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; -name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; -val =kickeramp{ii,4}; AO.KICK.Status(ii,1) = val; -val =kickeramp{ii,5}; AO.KICK.DeviceList(ii,:) = val; -val =kickeramp{ii,6}; AO.KICK.ElementList(ii,1) = val; -val =kickeramp{ii,7}; AO.KICK.Setpoint.Tolerance(ii,1) = val; - -if ii==1||ii==4 - AO.KICK.Monitor.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; - AO.KICK.Setpoint.Range(ii,:) = [-1300 +1300]; -else - AO.KICK.Monitor.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; - AO.KICK.Setpoint.Range(ii,:) = [+1300 -1300]; -end -end - -% *** KICK Delay *** -% AO.KICK.Delay -% >> removed >> see previous versions if info needed - - -%============ -%RF System -%============ -AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); -AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; - -%-------------------------------- 4 cavity Case -%common stat devlist elem -rfcommon={ -'RF1 ' 1 [1,1] 1 ; ... -'RF2 ' 1 [1,2] 2 ; ... -'RF3 ' 1 [1,3] 3 ; ... -'RF4 ' 1 [1,4] 4 ; ... - }; - -%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance -rffreq={ -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... - }; - -% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfphase={ -'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... -'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... -'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... -'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... - }; - -% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfvolt={ -'SRF1:STN:VOLT:CTRL ' 'SR06RF01CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... -'SRF2:STN:VOLT:CTRL ' 'SR06RF02CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... -'SRF3:STN:VOLT:CTRL ' 'SR07RF01CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... -'SRF4:STN:VOLT:CTRL ' 'SR07RF02CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... - }; - -% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance -% rfpower={ -% 'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SRF1:KLYSDRIVFRWD:POWER' 'SRF1:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -% 'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SRF2:KLYSDRIVFRWD:POWER' 'SRF2:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -% 'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SRF3:KLYSDRIVFRWD:POWER' 'SRF3:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -% 'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SRF4:KLYSDRIVFRWD:POWER' 'SRF4:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -% }; - -for ii=1:size(rfcommon,1) -name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; -val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; -val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; -val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; -end - -for ii=1:size(rffreq,1) -name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; -name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; -val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; - AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; -val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; - AO.RF.Setpoint.Physics2HWParams(ii,1) = val; -val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; -val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfphase,1) -name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; -name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; -val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Phase.HW2PhysicsParams(ii,1) = val; -val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Phase.Physics2HWParams(ii,1) = val; -val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; - AO.RF.Phase.Range(ii,:) = val; -val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; - AO.RF.Phase.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfvolt,1) -% name=rfvolt{ii,1}; AO.RF.VoltageCtrl.ChannelNames(ii,:) = name; -name=rfvolt{ii,2}; AO.RF.Voltage.ChannelNames(ii,:) = name; -val =rfvolt{ii,3}; % AO.RF.VoltageCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Voltage.HW2PhysicsParams(ii,1) = val; -val =rfvolt{ii,4}; % AO.RF.VoltageCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Voltage.Physics2HWParams(ii,1) = val; -val =rfvolt{ii,5}; % AO.RF.VoltageCtrl.Range(ii,:) = val; - AO.RF.Voltage.Range(ii,:) = val; -val =rfvolt{ii,6}; % AO.RF.VoltageCtrl.Tolerance(ii,1) = val; - AO.RF.Voltage.Tolerance(ii,1) = val; -end - - -% for ii=1:size(rfpower,1) -% name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; -% name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; -% name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; -% val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; -% AO.RF.Power.HW2PhysicsParams(ii,1) = val; -% AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; -% val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; -% AO.RF.Power.Physics2HWParams(ii,1) = val; -% AO.RF.KlysPower.Physics2HWParams(ii,1) = val; -% val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; -% AO.RF.Power.Range(ii,:) = val; -% AO.RF.KlysPower.Range(ii,:) = val; -% val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; -% AO.RF.Power.Tolerance(ii,1) = val; -% AO.RF.KlysPower.Tolerance(ii,1) = val; -% end - -%Frequency Readback -AO.RF.Monitor.Mode = Mode; -AO.RF.Monitor.DataType = 'Scalar'; -AO.RF.Monitor.Units = 'Hardware'; -AO.RF.Monitor.HWUnits = 'Hz'; -AO.RF.Monitor.PhysicsUnits = 'Hz'; -%Frequency Setpoint -AO.RF.Setpoint.Mode = Mode; -AO.RF.Setpoint.DataType = 'Scalar'; -AO.RF.Setpoint.Units = 'Hardware'; -AO.RF.Setpoint.HWUnits = 'Hz'; -AO.RF.Setpoint.PhysicsUnits = 'Hz'; - -%Voltage control -% AO.RF.VoltageCtrl.Mode = Mode; -% AO.RF.VoltageCtrl.DataType = 'Scalar'; -% AO.RF.VoltageCtrl.Units = 'Hardware'; -% AO.RF.VoltageCtrl.HWUnits = 'Volts'; -% AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; - -%Voltage monitor -AO.RF.Voltage.Mode = Mode; -AO.RF.Voltage.DataType = 'Scalar'; -AO.RF.Voltage.Units = 'Hardware'; -AO.RF.Voltage.HWUnits = 'Volts'; -AO.RF.Voltage.PhysicsUnits = 'Volts'; - -%Power Control -% AO.RF.PowerCtrl.Mode = Mode; -% AO.RF.PowerCtrl.DataType = 'Scalar'; -% AO.RF.PowerCtrl.Units = 'Hardware'; -% AO.RF.PowerCtrl.HWUnits = 'MWatts'; -% AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; - -%Power Monitor -AO.RF.Power.Mode = Mode; -AO.RF.Power.DataType = 'Scalar'; -AO.RF.Power.Units = 'Hardware'; -AO.RF.Power.HWUnits = 'MWatts'; -AO.RF.Power.PhysicsUnits = 'MWatts'; - -% %Klystron Forward Power -% AO.RF.KlysPower.Mode = Mode; -% AO.RF.KlysPower.DataType = 'Scalar'; -% AO.RF.KlysPower.Units = 'Hardware'; -% AO.RF.KlysPower.HWUnits = 'MWatts'; -% AO.RF.KlysPower.PhysicsUnits = 'MWatts'; - -% %Station Phase Control -% AO.RF.PhaseCtrl.Mode = Mode; -% AO.RF.PhaseCtrl.DataType = 'Scalar'; -% AO.RF.PhaseCtrl.Units = 'Hardware'; -% AO.RF.PhaseCtrl.HWUnits = 'Degrees'; -% AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; - -%Station Phase Monitor -AO.RF.Phase.Mode = Mode; -AO.RF.Phase.DataType = 'Scalar'; -AO.RF.Phase.Units = 'Hardware'; -AO.RF.Phase.HWUnits = 'Degrees'; -AO.RF.Phase.PhysicsUnits = 'Degrees'; - -%==== -%TUNE -%==== -AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); -AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; -AO.TUNE.CommonNames = ['xtune';'ytune';'stune']; -AO.TUNE.DeviceList = [ 1 1; 1 2; 1 3]; -AO.TUNE.ElementList = [1 2 3]'; -AO.TUNE.Status = [1 1 0]'; - -AO.TUNE.Monitor.Mode = Mode; -AO.TUNE.Monitor.DataType = 'Vector'; -AO.TUNE.Monitor.DataTypeIndex = [1 2 3]'; -AO.TUNE.Monitor.ChannelNames = 'MeasTune'; -AO.TUNE.Monitor.Units = 'Hardware'; -AO.TUNE.Monitor.HW2PhysicsParams = 1; -AO.TUNE.Monitor.Physics2HWParams = 1; -AO.TUNE.Monitor.HWUnits = 'fractional tune'; -AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; - - -%==== -%DCCT -%==== -AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); -AO.DCCT.MemberOf = {'Diagnostics'}; -AO.DCCT.CommonNames = 'DCCT'; -AO.DCCT.DeviceList = [1 1]; -AO.DCCT.ElementList = [1]; -AO.DCCT.Status = [1]; - -AO.DCCT.Monitor.Mode = Mode; -AO.DCCT.Monitor.DataType = 'Scalar'; -AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; -AO.DCCT.Monitor.Units = 'Hardware'; -AO.DCCT.Monitor.HWUnits = 'milli-ampere'; -AO.DCCT.Monitor.PhysicsUnits = 'ampere'; -AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; -AO.DCCT.Monitor.Physics2HWParams = 1000; - - -% %================== -% %Machine Parameters -% %================== -% Removed in this version, see pervious version for more info - -%====== -%Septum -%====== -% ifam=ifam+1; -% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); -% AO.Septum.MemberOf = {'Injection'}; -% AO.Septum.Status = 1; -% -% AO.Septum.CommonNames = 'Septum '; -% AO.Septum.DeviceList = [3 1]; -% AO.Septum.ElementList = [1]; -% -% AO.Septum.Monitor.Mode = Mode; -% AO.Septum.Monitor.DataType = 'Scalar'; -% AO.Septum.Monitor.Units = 'Hardware'; -% AO.Septum.Monitor.HWUnits = 'ampere'; -% AO.Septum.Monitor.PhysicsUnits = 'radian'; -% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; -% -% AO.Septum.Setpoint.Mode = Mode; -% AO.Septum.Setpoint.DataType = 'Scalar'; -% AO.Septum.Setpoint.Units = 'Hardware'; -% AO.Septum.Setpoint.HWUnits = 'ampere'; -% AO.Septum.Setpoint.PhysicsUnits = 'radian'; -% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; -% AO.Septum.Setpoint.Range = [0, 2500]; -% AO.Septum.Setpoint.Tolerance = 100.0; -% -% AO.Septum.Monitor.HW2PhysicsParams = 1; -% AO.Septum.Monitor.Physics2HWParams = 1; -% AO.Septum.Setpoint.HW2PhysicsParams = 1; -% AO.Septum.Setpoint.Physics2HWParams = 1; - - -%==================== -%Photon Beamline Data -%==================== -% >> removed >> see previous versions if info needed - -%==================== -%BPLD Data -%==================== -% >> removed >> see previous versions if info needed - - - -% The operational mode sets the path, filenames, and other important parameters -% Run setoperationalmode after most of the AO is built so that the Units and Mode fields -% can be set in setoperationalmode -fprintf('\n'); -setao(AO); -setoperationalmode(OperationalMode); -AO = getao; - - -%%%%%%%%%%%%%%%% -% DeltaRespMat % -%%%%%%%%%%%%%%%% - -% I remove the physics2hw conversion because the physics2hw is -% is calibrated yet. - -% Set response matrix kick size in hardware units (amps) -AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', .15e-3 / 1, AO.HCM.DeviceList); -AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', .15e-3 / 1, AO.VCM.DeviceList); - -%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point -%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); -%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); - - -AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); -AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); -AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); - - -AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); -AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); -AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); -AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get S-positions [meters] % -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Using ...ATIndex(:,1) will accomodata for split elements where the first -% of a group of elements is put in the first column ie, if SFA is split in -% two then ATIndex will look like [2 3; 11 12; ...] where each row is a -% magnet and column represents each split. -global THERING -AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; -AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; -AO.FTx.Position = findspos(THERING, AO.FTx.AT.ATIndex(:,1))'; -AO.FTy.Position = findspos(THERING, AO.FTy.AT.ATIndex(:,1))'; -AO.FTsum.Position= findspos(THERING, AO.FTsum.AT.ATIndex(:,1))'; -AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; -AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; -AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; -AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; -AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; -AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; -AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; -AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; -AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; -AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; -AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; -AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; -AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; -AO.DCCT.Position = 0; -AO.TUNE.Position = 0; - - -% Save AO -setao(AO); - - -function dispobject(AO,name) - -n = length(fieldnames(AO)); - -if n > 0 - fprintf(' %10s ',name); - if mod(n,5) == 0 - fprintf('\n'); - end +function aspinit(OperationalMode) +% aspinit(OperationalMode) +% +% Initialize parameters for ASP control in MATLAB +% +%========================== +% Accelerator Family Fields +%========================== +% FamilyName BPMx, HCM, etc +% CommonNames Shortcut name for each element (optional) +% DeviceList [Sector, Number] +% ElementList number in list +% Position m, magnet center +% +% MONITOR FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units Physics or HW +% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% +% SETPOINT FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units hardware or physics +% HW2PhysicsFcn function handle used to convert from hardware to physics units +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% Range minsetpoint, maxsetpoint; +% Tolerance setpoint-monitor +% +%============================================= +% Accelerator Toolbox Simulation Fields +%============================================= +% ATType Quad, Sext, etc +% ATIndex index in THERING +% ATParameterGroup parameter group +% +%============ +% Family List +%============ +% BPMx BPMy - beam position monitors +% HCM VCM - corrector magnets wound into sextupoles +% BEND - gradient dipoles +% QFA QDA QFB - quadrupole magnets +% SFA SDA SDB SFB - sextupole magnets +% SQK - skew quads wound into SDA magnets +% KICK - injection kickers (DELTA type) +% RF - 4 cavities (KEK type?) +% DCCT +% Septum (Not in model yet) +% +% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 +% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 + +% === Change Log === +% Mark Boland 2004-02-12 +% Eugene Tan 2004-02-23 +% Eugene Tan 2004-12-13 +% Eugene Tan 2005-09-27 ver 4 +% Updated naming convention of the process variables, use version 4 of +% the lattice "assr4.m" where the correctors have been merged into the +% sextupoles. Made the necessary changes to updateatindex. Added skew +% quadrupoles and updated generate_init. +% Mark Boland 2006-05-27 +% Changed the BPM PVs to ...:SA_HPOS_MONITOR and ...:SA_VPOS_MONITOR +% +% === Still to do === +% - kicker delays +% - BPM names and other possible PVs of interest eg. Q factor etc. +% - clean up and configure the amp2k and k2amp conversion. Control system +% designed to calculate the strengths and amp values using calc records, +% therefore we should only need to change the PV name to access for +% readback at setpoints. Only problem will be in simulation/offline mode +% where those value are not available online. How do you keep the offline +% conversion factors up to date with online vals? +% +% === Generated from === +% aspinit_v5skeleton.m + +% Default operational mode +if nargin < 1 + OperationalMode = 2; +end + + +%============================================= +% START DEFINITION OF ACCELERATOR OBJECTS +%============================================= +fprintf(' Defining the Accelerator Objects. Objects being defined:\n') + + +% Clear previous AcceleratorObjects +setao([]); + + +Mode = 'Online'; % This gets reset in setoperationalmode + +%============================================= +%BPM data: status field designates if BPM in use +%============================================= +ntbpm=98; +AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); +AO.BPMx.MemberOf = {'PlotFamily';};% 'BPM'; 'Diagnostics'}; +AO.BPMx.Monitor.Mode = Mode; +AO.BPMx.Monitor.DataType = 'Scalar'; +AO.BPMx.Monitor.Units = 'Hardware'; +AO.BPMx.Monitor.HWUnits = 'mm'; +AO.BPMx.Monitor.PhysicsUnits = 'meter'; + +AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); +AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.BPMy.Monitor.Mode = Mode; +AO.BPMy.Monitor.DataType = 'Scalar'; +AO.BPMy.Monitor.Units = 'Hardware'; +AO.BPMy.Monitor.HWUnits = 'mm'; +AO.BPMy.Monitor.PhysicsUnits = 'meter'; + +% x-name x-chname xstat y-name y-chname ystat DevList Elem +bpm={ +'1BPMx1 ' 'SR01BPM01:SA_HPOS_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:SA_VPOS_MONITOR' 1 [1,1] 1 ; ... +'1BPMx2 ' 'SR01BPM02:SA_HPOS_MONITOR' 1 '1BPMy2 ' 'SR01BPM02:SA_VPOS_MONITOR' 1 [1,2] 2 ; ... +'1BPMx3 ' 'SR01BPM03:SA_HPOS_MONITOR' 1 '1BPMy3 ' 'SR01BPM03:SA_VPOS_MONITOR' 1 [1,3] 3 ; ... +'1BPMx4 ' 'SR01BPM04:SA_HPOS_MONITOR' 1 '1BPMy4 ' 'SR01BPM04:SA_VPOS_MONITOR' 1 [1,4] 4 ; ... +'1BPMx5 ' 'SR01BPM05:SA_HPOS_MONITOR' 1 '1BPMy5 ' 'SR01BPM05:SA_VPOS_MONITOR' 1 [1,5] 5 ; ... +'1BPMx6 ' 'SR01BPM06:SA_HPOS_MONITOR' 1 '1BPMy6 ' 'SR01BPM06:SA_VPOS_MONITOR' 1 [1,6] 6 ; ... +'1BPMx7 ' 'SR01BPM07:SA_HPOS_MONITOR' 1 '1BPMy7 ' 'SR01BPM07:SA_VPOS_MONITOR' 1 [1,7] 7 ; ... +'2BPMx1 ' 'SR02BPM01:SA_HPOS_MONITOR' 1 '2BPMy1 ' 'SR02BPM01:SA_VPOS_MONITOR' 1 [2,1] 8 ; ... +'2BPMx2 ' 'SR02BPM02:SA_HPOS_MONITOR' 1 '2BPMy2 ' 'SR02BPM02:SA_VPOS_MONITOR' 1 [2,2] 9 ; ... +'2BPMx3 ' 'SR02BPM03:SA_HPOS_MONITOR' 1 '2BPMy3 ' 'SR02BPM03:SA_VPOS_MONITOR' 1 [2,3] 10 ; ... +'2BPMx4 ' 'SR02BPM04:SA_HPOS_MONITOR' 1 '2BPMy4 ' 'SR02BPM04:SA_VPOS_MONITOR' 1 [2,4] 11 ; ... +'2BPMx5 ' 'SR02BPM05:SA_HPOS_MONITOR' 1 '2BPMy5 ' 'SR02BPM05:SA_VPOS_MONITOR' 1 [2,5] 12 ; ... +'2BPMx6 ' 'SR02BPM06:SA_HPOS_MONITOR' 1 '2BPMy6 ' 'SR02BPM06:SA_VPOS_MONITOR' 1 [2,6] 13 ; ... +'2BPMx7 ' 'SR02BPM07:SA_HPOS_MONITOR' 1 '2BPMy7 ' 'SR02BPM07:SA_VPOS_MONITOR' 1 [2,7] 14 ; ... +'3BPMx1 ' 'SR03BPM01:SA_HPOS_MONITOR' 1 '3BPMy1 ' 'SR03BPM01:SA_VPOS_MONITOR' 1 [3,1] 15 ; ... +'3BPMx2 ' 'SR03BPM02:SA_HPOS_MONITOR' 1 '3BPMy2 ' 'SR03BPM02:SA_VPOS_MONITOR' 1 [3,2] 16 ; ... +'3BPMx3 ' 'SR03BPM03:SA_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:SA_VPOS_MONITOR' 1 [3,3] 17 ; ... +'3BPMx4 ' 'SR03BPM04:SA_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:SA_VPOS_MONITOR' 1 [3,4] 18 ; ... +'3BPMx5 ' 'SR03BPM05:SA_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:SA_VPOS_MONITOR' 1 [3,5] 19 ; ... +'3BPMx6 ' 'SR03BPM06:SA_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:SA_VPOS_MONITOR' 1 [3,6] 20 ; ... +'3BPMx7 ' 'SR03BPM07:SA_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:SA_VPOS_MONITOR' 1 [3,7] 21 ; ... +'4BPMx1 ' 'SR04BPM01:SA_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:SA_VPOS_MONITOR' 1 [4,1] 22 ; ... +'4BPMx2 ' 'SR04BPM02:SA_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:SA_VPOS_MONITOR' 1 [4,2] 23 ; ... +'4BPMx3 ' 'SR04BPM03:SA_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:SA_VPOS_MONITOR' 1 [4,3] 24 ; ... +'4BPMx4 ' 'SR04BPM04:SA_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:SA_VPOS_MONITOR' 1 [4,4] 25 ; ... +'4BPMx5 ' 'SR04BPM05:SA_HPOS_MONITOR' 1 '4BPMy5 ' 'SR04BPM05:SA_VPOS_MONITOR' 1 [4,5] 26 ; ... +'4BPMx6 ' 'SR04BPM06:SA_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:SA_VPOS_MONITOR' 1 [4,6] 27 ; ... +'4BPMx7 ' 'SR04BPM07:SA_HPOS_MONITOR' 1 '4BPMy7 ' 'SR04BPM07:SA_VPOS_MONITOR' 1 [4,7] 28 ; ... +'5BPMx1 ' 'SR05BPM01:SA_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:SA_VPOS_MONITOR' 1 [5,1] 29 ; ... +'5BPMx2 ' 'SR05BPM02:SA_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:SA_VPOS_MONITOR' 1 [5,2] 30 ; ... +'5BPMx3 ' 'SR05BPM03:SA_HPOS_MONITOR' 1 '5BPMy3 ' 'SR05BPM03:SA_VPOS_MONITOR' 1 [5,3] 31 ; ... +'5BPMx4 ' 'SR05BPM04:SA_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:SA_VPOS_MONITOR' 1 [5,4] 32 ; ... +'5BPMx5 ' 'SR05BPM05:SA_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:SA_VPOS_MONITOR' 1 [5,5] 33 ; ... +'5BPMx6 ' 'SR05BPM06:SA_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:SA_VPOS_MONITOR' 1 [5,6] 34 ; ... +'5BPMx7 ' 'SR05BPM07:SA_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:SA_VPOS_MONITOR' 1 [5,7] 35 ; ... +'6BPMx1 ' 'SR06BPM01:SA_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:SA_VPOS_MONITOR' 1 [6,1] 36 ; ... +'6BPMx2 ' 'SR06BPM02:SA_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:SA_VPOS_MONITOR' 1 [6,2] 37 ; ... +'6BPMx3 ' 'SR06BPM03:SA_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:SA_VPOS_MONITOR' 1 [6,3] 38 ; ... +'6BPMx4 ' 'SR06BPM04:SA_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:SA_VPOS_MONITOR' 1 [6,4] 39 ; ... +'6BPMx5 ' 'SR06BPM05:SA_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:SA_VPOS_MONITOR' 1 [6,5] 40 ; ... +'6BPMx6 ' 'SR06BPM06:SA_HPOS_MONITOR' 1 '6BPMy6 ' 'SR06BPM06:SA_VPOS_MONITOR' 1 [6,6] 41 ; ... +'6BPMx7 ' 'SR06BPM07:SA_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:SA_VPOS_MONITOR' 1 [6,7] 42 ; ... +'7BPMx1 ' 'SR07BPM01:SA_HPOS_MONITOR' 1 '7BPMy1 ' 'SR07BPM01:SA_VPOS_MONITOR' 1 [7,1] 43 ; ... +'7BPMx2 ' 'SR07BPM02:SA_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:SA_VPOS_MONITOR' 1 [7,2] 44 ; ... +'7BPMx3 ' 'SR07BPM03:SA_HPOS_MONITOR' 1 '7BPMy3 ' 'SR07BPM03:SA_VPOS_MONITOR' 1 [7,3] 45 ; ... +'7BPMx4 ' 'SR07BPM04:SA_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:SA_VPOS_MONITOR' 1 [7,4] 46 ; ... +'7BPMx5 ' 'SR07BPM05:SA_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:SA_VPOS_MONITOR' 1 [7,5] 47 ; ... +'7BPMx6 ' 'SR07BPM06:SA_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:SA_VPOS_MONITOR' 1 [7,6] 48 ; ... +'7BPMx7 ' 'SR07BPM07:SA_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:SA_VPOS_MONITOR' 1 [7,7] 49 ; ... +'8BPMx1 ' 'SR08BPM01:SA_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:SA_VPOS_MONITOR' 1 [8,1] 50 ; ... +'8BPMx2 ' 'SR08BPM02:SA_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:SA_VPOS_MONITOR' 1 [8,2] 51 ; ... +'8BPMx3 ' 'SR08BPM03:SA_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:SA_VPOS_MONITOR' 1 [8,3] 52 ; ... +'8BPMx4 ' 'SR08BPM04:SA_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:SA_VPOS_MONITOR' 1 [8,4] 53 ; ... +'8BPMx5 ' 'SR08BPM05:SA_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:SA_VPOS_MONITOR' 1 [8,5] 54 ; ... +'8BPMx6 ' 'SR08BPM06:SA_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:SA_VPOS_MONITOR' 1 [8,6] 55 ; ... +'8BPMx7 ' 'SR08BPM07:SA_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:SA_VPOS_MONITOR' 1 [8,7] 56 ; ... +'9BPMx1 ' 'SR09BPM01:SA_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:SA_VPOS_MONITOR' 1 [9,1] 57 ; ... +'9BPMx2 ' 'SR09BPM02:SA_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:SA_VPOS_MONITOR' 1 [9,2] 58 ; ... +'9BPMx3 ' 'SR09BPM03:SA_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:SA_VPOS_MONITOR' 1 [9,3] 59 ; ... +'9BPMx4 ' 'SR09BPM04:SA_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:SA_VPOS_MONITOR' 1 [9,4] 60 ; ... +'9BPMx5 ' 'SR09BPM05:SA_HPOS_MONITOR' 1 '9BPMy5 ' 'SR09BPM05:SA_VPOS_MONITOR' 1 [9,5] 61 ; ... +'9BPMx6 ' 'SR09BPM06:SA_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:SA_VPOS_MONITOR' 1 [9,6] 62 ; ... +'9BPMx7 ' 'SR09BPM07:SA_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:SA_VPOS_MONITOR' 1 [9,7] 63 ; ... +'10BPMx1 ' 'SR10BPM01:SA_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:SA_VPOS_MONITOR' 1 [10,1] 64 ; ... +'10BPMx2 ' 'SR10BPM02:SA_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:SA_VPOS_MONITOR' 1 [10,2] 65 ; ... +'10BPMx3 ' 'SR10BPM03:SA_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:SA_VPOS_MONITOR' 1 [10,3] 66 ; ... +'10BPMx4 ' 'SR10BPM04:SA_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:SA_VPOS_MONITOR' 1 [10,4] 67 ; ... +'10BPMx5 ' 'SR10BPM05:SA_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:SA_VPOS_MONITOR' 1 [10,5] 68 ; ... +'10BPMx6 ' 'SR10BPM06:SA_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:SA_VPOS_MONITOR' 1 [10,6] 69 ; ... +'10BPMx7 ' 'SR10BPM07:SA_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:SA_VPOS_MONITOR' 1 [10,7] 70 ; ... +'11BPMx1 ' 'SR11BPM01:SA_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:SA_VPOS_MONITOR' 1 [11,1] 71 ; ... +'11BPMx2 ' 'SR11BPM02:SA_HPOS_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:SA_VPOS_MONITOR' 1 [11,2] 72 ; ... +'11BPMx3 ' 'SR11BPM03:SA_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:SA_VPOS_MONITOR' 1 [11,3] 73 ; ... +'11BPMx4 ' 'SR11BPM04:SA_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:SA_VPOS_MONITOR' 1 [11,4] 74 ; ... +'11BPMx5 ' 'SR11BPM05:SA_HPOS_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:SA_VPOS_MONITOR' 1 [11,5] 75 ; ... +'11BPMx6 ' 'SR11BPM06:SA_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:SA_VPOS_MONITOR' 1 [11,6] 76 ; ... +'11BPMx7 ' 'SR11BPM07:SA_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:SA_VPOS_MONITOR' 1 [11,7] 77 ; ... +'12BPMx1 ' 'SR12BPM01:SA_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:SA_VPOS_MONITOR' 1 [12,1] 78 ; ... +'12BPMx2 ' 'SR12BPM02:SA_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:SA_VPOS_MONITOR' 1 [12,2] 79 ; ... +'12BPMx3 ' 'SR12BPM03:SA_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:SA_VPOS_MONITOR' 1 [12,3] 80 ; ... +'12BPMx4 ' 'SR12BPM04:SA_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:SA_VPOS_MONITOR' 1 [12,4] 81 ; ... +'12BPMx5 ' 'SR12BPM05:SA_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:SA_VPOS_MONITOR' 1 [12,5] 82 ; ... +'12BPMx6 ' 'SR12BPM06:SA_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:SA_VPOS_MONITOR' 1 [12,6] 83 ; ... +'12BPMx7 ' 'SR12BPM07:SA_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:SA_VPOS_MONITOR' 1 [12,7] 84 ; ... +'13BPMx1 ' 'SR13BPM01:SA_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:SA_VPOS_MONITOR' 1 [13,1] 85 ; ... +'13BPMx2 ' 'SR13BPM02:SA_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:SA_VPOS_MONITOR' 1 [13,2] 86 ; ... +'13BPMx3 ' 'SR13BPM03:SA_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:SA_VPOS_MONITOR' 1 [13,3] 87 ; ... +'13BPMx4 ' 'SR13BPM04:SA_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:SA_VPOS_MONITOR' 1 [13,4] 88 ; ... +'13BPMx5 ' 'SR13BPM05:SA_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:SA_VPOS_MONITOR' 1 [13,5] 89 ; ... +'13BPMx6 ' 'SR13BPM06:SA_HPOS_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:SA_VPOS_MONITOR' 1 [13,6] 90 ; ... +'13BPMx7 ' 'SR13BPM07:SA_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:SA_VPOS_MONITOR' 1 [13,7] 91 ; ... +'14BPMx1 ' 'SR14BPM01:SA_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:SA_VPOS_MONITOR' 1 [14,1] 92 ; ... +'14BPMx2 ' 'SR14BPM02:SA_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:SA_VPOS_MONITOR' 1 [14,2] 93 ; ... +'14BPMx3 ' 'SR14BPM03:SA_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:SA_VPOS_MONITOR' 1 [14,3] 94 ; ... +'14BPMx4 ' 'SR14BPM04:SA_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:SA_VPOS_MONITOR' 1 [14,4] 95 ; ... +'14BPMx5 ' 'SR14BPM05:SA_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:SA_VPOS_MONITOR' 1 [14,5] 96 ; ... +'14BPMx6 ' 'SR14BPM06:SA_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:SA_VPOS_MONITOR' 1 [14,6] 97 ; ... +'14BPMx7 ' 'SR14BPM07:SA_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:SA_VPOS_MONITOR' 1 [14,7] 98 ; ... +}; + +%Load fields from data block +for ii=1:size(bpm,1) +name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; +name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; +name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; +name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; +val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; + AO.BPMy.DeviceList(ii,:) = val; +val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; + AO.BPMy.ElementList(ii,:) = val; + AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1000; + AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1000; +end + + +% % Get sum value from button. Don't need handles and PV namelist as +% % parameters are the same as the 'monitor' subcategory. +% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; +% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; +% AO.BPMx.Sum.HWUnits = 'ADC Counts'; +% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; +% AO.BPMx.Sum.HW2PhysicsParams = 1; +% AO.BPMx.Sum.Physics2HWParams = 1; +% % Get q value from BPMs. Don't need handles and PV namelist. +% AO.BPMx.Q = AO.BPMx.Monitor; +% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; +% AO.BPMx.Q.HWUnits = 'mm'; +% AO.BPMx.Q.PhysicsUnits = 'meter'; +% AO.BPMx.Q.HW2PhysicsParams = 1e-3; +% AO.BPMx.Q.Physics2HWParams = 1000; +% +% % Definition above for horizontal. Replicate for vertical. +% AO.BPMy.Sum = AO.BPMx.Sum; +% AO.BPMy.Q = AO.BPMx.Q; + + + +%============================================= +% First Turn BPM data from Libera +%============================================= +ntbpm=98; +AO.FTx.FamilyName = 'FTx'; dispobject(AO,AO.FTx.FamilyName); +AO.FTx.MemberOf = {'PlotFamily';};% 'BPM'; 'Diagnostics'}; +AO.FTx.Monitor.Mode = Mode; +AO.FTx.Monitor.DataType = 'Scalar'; +AO.FTx.Monitor.Units = 'Hardware'; +AO.FTx.Monitor.HWUnits = 'mm'; +AO.FTx.Monitor.PhysicsUnits = 'meter'; + +AO.FTy.FamilyName = 'FTy'; dispobject(AO,AO.FTy.FamilyName); +AO.FTy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTy.Monitor.Mode = Mode; +AO.FTy.Monitor.DataType = 'Scalar'; +AO.FTy.Monitor.Units = 'Hardware'; +AO.FTy.Monitor.HWUnits = 'mm'; +AO.FTy.Monitor.PhysicsUnits = 'meter'; + +% x-name x-chname xstat y-name y-chname ystat DevList Elem +bpm={ +'1FTx1 ' 'SR01BPM01:FT_HPOS_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:FT_VPOS_MONITOR' 1 [1,1] 1 ; ... +'1FTx2 ' 'SR01BPM02:FT_HPOS_MONITOR' 1 '1BPMy2 ' 'SR01BPM02:FT_VPOS_MONITOR' 1 [1,2] 2 ; ... +'1FTx3 ' 'SR01BPM03:FT_HPOS_MONITOR' 1 '1BPMy3 ' 'SR01BPM03:FT_VPOS_MONITOR' 1 [1,3] 3 ; ... +'1FTx4 ' 'SR01BPM04:FT_HPOS_MONITOR' 1 '1BPMy4 ' 'SR01BPM04:FT_VPOS_MONITOR' 1 [1,4] 4 ; ... +'1FTx5 ' 'SR01BPM05:FT_HPOS_MONITOR' 1 '1BPMy5 ' 'SR01BPM05:FT_VPOS_MONITOR' 1 [1,5] 5 ; ... +'1FTx6 ' 'SR01BPM06:FT_HPOS_MONITOR' 1 '1BPMy6 ' 'SR01BPM06:FT_VPOS_MONITOR' 1 [1,6] 6 ; ... +'1FTx7 ' 'SR01BPM07:FT_HPOS_MONITOR' 1 '1BPMy7 ' 'SR01BPM07:FT_VPOS_MONITOR' 1 [1,7] 7 ; ... +'2FTx1 ' 'SR02BPM01:FT_HPOS_MONITOR' 1 '2BPMy1 ' 'SR02BPM01:FT_VPOS_MONITOR' 1 [2,1] 8 ; ... +'2FTx2 ' 'SR02BPM02:FT_HPOS_MONITOR' 1 '2BPMy2 ' 'SR02BPM02:FT_VPOS_MONITOR' 1 [2,2] 9 ; ... +'2FTx3 ' 'SR02BPM03:FT_HPOS_MONITOR' 1 '2BPMy3 ' 'SR02BPM03:FT_VPOS_MONITOR' 1 [2,3] 10 ; ... +'2FTx4 ' 'SR02BPM04:FT_HPOS_MONITOR' 1 '2BPMy4 ' 'SR02BPM04:FT_VPOS_MONITOR' 1 [2,4] 11 ; ... +'2FTx5 ' 'SR02BPM05:FT_HPOS_MONITOR' 1 '2BPMy5 ' 'SR02BPM05:FT_VPOS_MONITOR' 1 [2,5] 12 ; ... +'2FTx6 ' 'SR02BPM06:FT_HPOS_MONITOR' 1 '2BPMy6 ' 'SR02BPM06:FT_VPOS_MONITOR' 1 [2,6] 13 ; ... +'2FTx7 ' 'SR02BPM07:FT_HPOS_MONITOR' 1 '2BPMy7 ' 'SR02BPM07:FT_VPOS_MONITOR' 1 [2,7] 14 ; ... +'3FTx1 ' 'SR03BPM01:FT_HPOS_MONITOR' 1 '3BPMy1 ' 'SR03BPM01:FT_VPOS_MONITOR' 1 [3,1] 15 ; ... +'3FTx2 ' 'SR03BPM02:FT_HPOS_MONITOR' 1 '3BPMy2 ' 'SR03BPM02:FT_VPOS_MONITOR' 1 [3,2] 16 ; ... +'3FTx3 ' 'SR03BPM03:FT_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:FT_VPOS_MONITOR' 1 [3,3] 17 ; ... +'3FTx4 ' 'SR03BPM04:FT_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:FT_VPOS_MONITOR' 1 [3,4] 18 ; ... +'3FTx5 ' 'SR03BPM05:FT_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:FT_VPOS_MONITOR' 1 [3,5] 19 ; ... +'3FTx6 ' 'SR03BPM06:FT_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:FT_VPOS_MONITOR' 1 [3,6] 20 ; ... +'3FTx7 ' 'SR03BPM07:FT_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:FT_VPOS_MONITOR' 1 [3,7] 21 ; ... +'4FTx1 ' 'SR04BPM01:FT_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:FT_VPOS_MONITOR' 1 [4,1] 22 ; ... +'4FTx2 ' 'SR04BPM02:FT_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:FT_VPOS_MONITOR' 1 [4,2] 23 ; ... +'4FTx3 ' 'SR04BPM03:FT_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:FT_VPOS_MONITOR' 1 [4,3] 24 ; ... +'4FTx4 ' 'SR04BPM04:FT_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:FT_VPOS_MONITOR' 1 [4,4] 25 ; ... +'4FTx5 ' 'SR04BPM05:FT_HPOS_MONITOR' 1 '4BPMy5 ' 'SR04BPM05:FT_VPOS_MONITOR' 1 [4,5] 26 ; ... +'4FTx6 ' 'SR04BPM06:FT_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:FT_VPOS_MONITOR' 1 [4,6] 27 ; ... +'4FTx7 ' 'SR04BPM07:FT_HPOS_MONITOR' 1 '4BPMy7 ' 'SR04BPM07:FT_VPOS_MONITOR' 1 [4,7] 28 ; ... +'5FTx1 ' 'SR05BPM01:FT_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:FT_VPOS_MONITOR' 1 [5,1] 29 ; ... +'5FTx2 ' 'SR05BPM02:FT_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:FT_VPOS_MONITOR' 1 [5,2] 30 ; ... +'5FTx3 ' 'SR05BPM03:FT_HPOS_MONITOR' 1 '5BPMy3 ' 'SR05BPM03:FT_VPOS_MONITOR' 1 [5,3] 31 ; ... +'5FTx4 ' 'SR05BPM04:FT_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:FT_VPOS_MONITOR' 1 [5,4] 32 ; ... +'5FTx5 ' 'SR05BPM05:FT_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:FT_VPOS_MONITOR' 1 [5,5] 33 ; ... +'5FTx6 ' 'SR05BPM06:FT_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:FT_VPOS_MONITOR' 1 [5,6] 34 ; ... +'5FTx7 ' 'SR05BPM07:FT_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:FT_VPOS_MONITOR' 1 [5,7] 35 ; ... +'6FTx1 ' 'SR06BPM01:FT_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:FT_VPOS_MONITOR' 1 [6,1] 36 ; ... +'6FTx2 ' 'SR06BPM02:FT_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:FT_VPOS_MONITOR' 1 [6,2] 37 ; ... +'6FTx3 ' 'SR06BPM03:FT_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:FT_VPOS_MONITOR' 1 [6,3] 38 ; ... +'6FTx4 ' 'SR06BPM04:FT_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:FT_VPOS_MONITOR' 1 [6,4] 39 ; ... +'6FTx5 ' 'SR06BPM05:FT_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:FT_VPOS_MONITOR' 1 [6,5] 40 ; ... +'6FTx6 ' 'SR06BPM06:FT_HPOS_MONITOR' 1 '6BPMy6 ' 'SR06BPM06:FT_VPOS_MONITOR' 1 [6,6] 41 ; ... +'6FTx7 ' 'SR06BPM07:FT_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:FT_VPOS_MONITOR' 1 [6,7] 42 ; ... +'7FTx1 ' 'SR07BPM01:FT_HPOS_MONITOR' 1 '7BPMy1 ' 'SR07BPM01:FT_VPOS_MONITOR' 1 [7,1] 43 ; ... +'7FTx2 ' 'SR07BPM02:FT_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:FT_VPOS_MONITOR' 1 [7,2] 44 ; ... +'7FTx3 ' 'SR07BPM03:FT_HPOS_MONITOR' 1 '7BPMy3 ' 'SR07BPM03:FT_VPOS_MONITOR' 1 [7,3] 45 ; ... +'7FTx4 ' 'SR07BPM04:FT_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:FT_VPOS_MONITOR' 1 [7,4] 46 ; ... +'7FTx5 ' 'SR07BPM05:FT_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:FT_VPOS_MONITOR' 1 [7,5] 47 ; ... +'7FTx6 ' 'SR07BPM06:FT_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:FT_VPOS_MONITOR' 1 [7,6] 48 ; ... +'7FTx7 ' 'SR07BPM07:FT_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:FT_VPOS_MONITOR' 1 [7,7] 49 ; ... +'8FTx1 ' 'SR08BPM01:FT_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:FT_VPOS_MONITOR' 1 [8,1] 50 ; ... +'8FTx2 ' 'SR08BPM02:FT_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:FT_VPOS_MONITOR' 1 [8,2] 51 ; ... +'8FTx3 ' 'SR08BPM03:FT_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:FT_VPOS_MONITOR' 1 [8,3] 52 ; ... +'8FTx4 ' 'SR08BPM04:FT_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:FT_VPOS_MONITOR' 1 [8,4] 53 ; ... +'8FTx5 ' 'SR08BPM05:FT_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:FT_VPOS_MONITOR' 1 [8,5] 54 ; ... +'8FTx6 ' 'SR08BPM06:FT_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:FT_VPOS_MONITOR' 1 [8,6] 55 ; ... +'8FTx7 ' 'SR08BPM07:FT_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:FT_VPOS_MONITOR' 1 [8,7] 56 ; ... +'9FTx1 ' 'SR09BPM01:FT_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:FT_VPOS_MONITOR' 1 [9,1] 57 ; ... +'9FTx2 ' 'SR09BPM02:FT_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:FT_VPOS_MONITOR' 1 [9,2] 58 ; ... +'9FTx3 ' 'SR09BPM03:FT_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:FT_VPOS_MONITOR' 1 [9,3] 59 ; ... +'9FTx4 ' 'SR09BPM04:FT_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:FT_VPOS_MONITOR' 1 [9,4] 60 ; ... +'9FTx5 ' 'SR09BPM05:FT_HPOS_MONITOR' 1 '9BPMy5 ' 'SR09BPM05:FT_VPOS_MONITOR' 1 [9,5] 61 ; ... +'9FTx6 ' 'SR09BPM06:FT_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:FT_VPOS_MONITOR' 1 [9,6] 62 ; ... +'9FTx7 ' 'SR09BPM07:FT_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:FT_VPOS_MONITOR' 1 [9,7] 63 ; ... +'10FTx1 ' 'SR10BPM01:FT_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:FT_VPOS_MONITOR' 1 [10,1] 64 ; ... +'10FTx2 ' 'SR10BPM02:FT_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:FT_VPOS_MONITOR' 1 [10,2] 65 ; ... +'10FTx3 ' 'SR10BPM03:FT_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:FT_VPOS_MONITOR' 1 [10,3] 66 ; ... +'10FTx4 ' 'SR10BPM04:FT_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:FT_VPOS_MONITOR' 1 [10,4] 67 ; ... +'10FTx5 ' 'SR10BPM05:FT_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:FT_VPOS_MONITOR' 1 [10,5] 68 ; ... +'10FTx6 ' 'SR10BPM06:FT_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:FT_VPOS_MONITOR' 1 [10,6] 69 ; ... +'10FTx7 ' 'SR10BPM07:FT_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:FT_VPOS_MONITOR' 1 [10,7] 70 ; ... +'11FTx1 ' 'SR11BPM01:FT_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:FT_VPOS_MONITOR' 1 [11,1] 71 ; ... +'11FTx2 ' 'SR11BPM02:FT_HPOS_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:FT_VPOS_MONITOR' 1 [11,2] 72 ; ... +'11FTx3 ' 'SR11BPM03:FT_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:FT_VPOS_MONITOR' 1 [11,3] 73 ; ... +'11FTx4 ' 'SR11BPM04:FT_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:FT_VPOS_MONITOR' 1 [11,4] 74 ; ... +'11FTx5 ' 'SR11BPM05:FT_HPOS_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:FT_VPOS_MONITOR' 1 [11,5] 75 ; ... +'11FTx6 ' 'SR11BPM06:FT_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:FT_VPOS_MONITOR' 1 [11,6] 76 ; ... +'11FTx7 ' 'SR11BPM07:FT_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:FT_VPOS_MONITOR' 1 [11,7] 77 ; ... +'12FTx1 ' 'SR12BPM01:FT_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:FT_VPOS_MONITOR' 1 [12,1] 78 ; ... +'12FTx2 ' 'SR12BPM02:FT_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:FT_VPOS_MONITOR' 1 [12,2] 79 ; ... +'12FTx3 ' 'SR12BPM03:FT_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:FT_VPOS_MONITOR' 1 [12,3] 80 ; ... +'12FTx4 ' 'SR12BPM04:FT_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:FT_VPOS_MONITOR' 1 [12,4] 81 ; ... +'12FTx5 ' 'SR12BPM05:FT_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:FT_VPOS_MONITOR' 1 [12,5] 82 ; ... +'12FTx6 ' 'SR12BPM06:FT_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:FT_VPOS_MONITOR' 1 [12,6] 83 ; ... +'12FTx7 ' 'SR12BPM07:FT_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:FT_VPOS_MONITOR' 1 [12,7] 84 ; ... +'13FTx1 ' 'SR13BPM01:FT_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:FT_VPOS_MONITOR' 1 [13,1] 85 ; ... +'13FTx2 ' 'SR13BPM02:FT_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:FT_VPOS_MONITOR' 1 [13,2] 86 ; ... +'13FTx3 ' 'SR13BPM03:FT_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:FT_VPOS_MONITOR' 1 [13,3] 87 ; ... +'13FTx4 ' 'SR13BPM04:FT_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:FT_VPOS_MONITOR' 1 [13,4] 88 ; ... +'13FTx5 ' 'SR13BPM05:FT_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:FT_VPOS_MONITOR' 1 [13,5] 89 ; ... +'13FTx6 ' 'SR13BPM06:FT_HPOS_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:FT_VPOS_MONITOR' 1 [13,6] 90 ; ... +'13FTx7 ' 'SR13BPM07:FT_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:FT_VPOS_MONITOR' 1 [13,7] 91 ; ... +'14FTx1 ' 'SR14BPM01:FT_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:FT_VPOS_MONITOR' 1 [14,1] 92 ; ... +'14FTx2 ' 'SR14BPM02:FT_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:FT_VPOS_MONITOR' 1 [14,2] 93 ; ... +'14FTx3 ' 'SR14BPM03:FT_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:FT_VPOS_MONITOR' 1 [14,3] 94 ; ... +'14FTx4 ' 'SR14BPM04:FT_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:FT_VPOS_MONITOR' 1 [14,4] 95 ; ... +'14FTx5 ' 'SR14BPM05:FT_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:FT_VPOS_MONITOR' 1 [14,5] 96 ; ... +'14FTx6 ' 'SR14BPM06:FT_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:FT_VPOS_MONITOR' 1 [14,6] 97 ; ... +'14FTx7 ' 'SR14BPM07:FT_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:FT_VPOS_MONITOR' 1 [14,7] 98 ; ... +}; + +%Load fields from data block +for ii=1:size(bpm,1) +name=bpm{ii,1}; AO.FTx.CommonNames(ii,:) = name; +name=bpm{ii,2}; AO.FTx.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,3}; AO.FTx.Status(ii,:) = val; +name=bpm{ii,4}; AO.FTy.CommonNames(ii,:) = name; +name=bpm{ii,5}; AO.FTy.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,6}; AO.FTy.Status(ii,:) = val; +val =bpm{ii,7}; AO.FTx.DeviceList(ii,:) = val; + AO.FTy.DeviceList(ii,:) = val; +val =bpm{ii,8}; AO.FTx.ElementList(ii,:) = val; + AO.FTy.ElementList(ii,:) = val; + AO.FTx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.FTx.Monitor.Physics2HWParams(ii,:) = 1000; + AO.FTy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.FTy.Monitor.Physics2HWParams(ii,:) = 1000; +end +AO.FTx.Status = AO.BPMx.Status; +AO.FTy.Status = AO.BPMy.Status; + +AO.FTsum = AO.FTx; +AO.FTsum.FamilyName = 'FTsum'; dispobject(AO,AO.FTsum.FamilyName); +AO.FTsum.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTsum.Monitor.Mode = 'Special'; +AO.FTsum.Monitor.Units = 'Hardware'; +AO.FTsum.Monitor.DataType = 'Scalar'; +AO.FTsum.Monitor.SpecialFunction = 'getftsum'; +AO.FTsum.Monitor.HWUnits = 'ADC counts'; +AO.FTsum.Monitor.PhysicsUnits = 'ADC counts'; +AO.FTsum.Monitor.HW2PhysicsParams(:) = 1; +AO.FTsum.Monitor.Physics2HWParams(:) = 1; + + +% % Get sum value from button. Don't need handles and PV namelist as +% % parameters are the same as the 'monitor' subcategory. +AO.FTx.Off.Mode = 'Special'; +AO.FTx.Off.Units = 'Hardware'; +AO.FTx.Off.DataType = 'Scalar'; +AO.FTx.Off.SpecialFunction = 'getftoffset'; +AO.FTx.Off.SpecialFunctionSet = 'setftoffset'; +AO.FTx.Off.HWUnits = '32ns samples'; +AO.FTx.Off.PhysicsUnits = '32ns samples'; +AO.FTx.Off.HW2PhysicsParams = 1; +AO.FTx.Off.Physics2HWParams = 1; + +AO.FTx.Length.Mode = 'Special'; +AO.FTx.Length.Units = 'Hardware'; +AO.FTx.Length.DataType = 'Scalar'; +AO.FTx.Length.SpecialFunction = 'getftlength'; +AO.FTx.Length.SpecialFunctionSet = 'setftlength'; +AO.FTx.Length.HWUnits = '32ns samples'; +AO.FTx.Length.PhysicsUnits = '32ns samples'; +AO.FTx.Length.HW2PhysicsParams = 1; +AO.FTx.Length.Physics2HWParams = 1; + +AO.FTx.Maxadc.Mode = 'Special'; +AO.FTx.Maxadc.Units = 'Hardware'; +AO.FTx.Maxadc.DataType = 'Scalar'; +AO.FTx.Maxadc.SpecialFunction = 'getftmaxadc'; +AO.FTx.Maxadc.HWUnits = 'ADC counts'; +AO.FTx.Maxadc.PhysicsUnits = 'ADC counts'; +AO.FTx.Maxadc.HW2PhysicsParams = 1; +AO.FTx.Maxadc.Physics2HWParams = 1; + +% AO.FTx.Sum.Mode = 'Special'; +% AO.FTx.Sum.Units = 'Hardware'; +% AO.FTx.Sum.DataType = 'Scalar'; +% AO.FTx.Sum.SpecialFunction = 'getftsum'; +% AO.FTx.Sum.HWUnits = 'ADC counts'; +% AO.FTx.Sum.PhysicsUnits = 'ADC counts'; +% AO.FTx.Sum.HW2PhysicsParams = 1; +% AO.FTx.Sum.Physics2HWParams = 1; + + +%=========================================================== +% Corrector data: status field designates if corrector in use +% ASP corrector coils wound into sextupoles. Not dynamic correctors. +%=========================================================== + +AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); +AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'}; + +AO.HCM.Monitor.Mode = Mode; +AO.HCM.Monitor.DataType = 'Scalar'; +AO.HCM.Monitor.Units = 'Hardware'; +AO.HCM.Monitor.HWUnits = 'ampere'; +AO.HCM.Monitor.PhysicsUnits = 'radian'; +AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.HCM.Monitor.Physics2HWFcn = @k2amp; + +AO.HCM.Setpoint.Mode = Mode; +AO.HCM.Setpoint.DataType = 'Scalar'; +AO.HCM.Setpoint.Units = 'Hardware'; +AO.HCM.Setpoint.HWUnits = 'ampere'; +AO.HCM.Setpoint.PhysicsUnits = 'radian'; +AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.HCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian. Respmat settings below AO definitions. +% x-common x-monitor x-setpoint stat devlist elem tol +cor={ +'1HCM1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... +'1HCM2 ' 'SR01CPS05:CURRENT_MONITOR' 'SR01CPS05:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... +'1HCM3 ' 'SR01CPS09:CURRENT_MONITOR' 'SR01CPS09:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... +'2HCM1 ' 'SR02CPS01:CURRENT_MONITOR' 'SR02CPS01:CURRENT_SP ' 1 [2,1] 4 1.000 ; ... +'2HCM2 ' 'SR02CPS05:CURRENT_MONITOR' 'SR02CPS05:CURRENT_SP ' 1 [2,2] 5 1.000 ; ... +'2HCM3 ' 'SR02CPS09:CURRENT_MONITOR' 'SR02CPS09:CURRENT_SP ' 1 [2,3] 6 1.000 ; ... +'3HCM1 ' 'SR03CPS01:CURRENT_MONITOR' 'SR03CPS01:CURRENT_SP ' 1 [3,1] 7 1.000 ; ... +'3HCM2 ' 'SR03CPS05:CURRENT_MONITOR' 'SR03CPS05:CURRENT_SP ' 1 [3,2] 8 1.000 ; ... +'3HCM3 ' 'SR03CPS09:CURRENT_MONITOR' 'SR03CPS09:CURRENT_SP ' 1 [3,3] 9 1.000 ; ... +'4HCM1 ' 'SR04CPS01:CURRENT_MONITOR' 'SR04CPS01:CURRENT_SP ' 1 [4,1] 10 1.000 ; ... +'4HCM2 ' 'SR04CPS05:CURRENT_MONITOR' 'SR04CPS05:CURRENT_SP ' 1 [4,2] 11 1.000 ; ... +'4HCM3 ' 'SR04CPS09:CURRENT_MONITOR' 'SR04CPS09:CURRENT_SP ' 1 [4,3] 12 1.000 ; ... +'5HCM1 ' 'SR05CPS01:CURRENT_MONITOR' 'SR05CPS01:CURRENT_SP ' 1 [5,1] 13 1.000 ; ... +'5HCM2 ' 'SR05CPS05:CURRENT_MONITOR' 'SR05CPS05:CURRENT_SP ' 1 [5,2] 14 1.000 ; ... +'5HCM3 ' 'SR05CPS09:CURRENT_MONITOR' 'SR05CPS09:CURRENT_SP ' 1 [5,3] 15 1.000 ; ... +'6HCM1 ' 'SR06CPS01:CURRENT_MONITOR' 'SR06CPS01:CURRENT_SP ' 1 [6,1] 16 1.000 ; ... +'6HCM2 ' 'SR06CPS05:CURRENT_MONITOR' 'SR06CPS05:CURRENT_SP ' 1 [6,2] 17 1.000 ; ... +'6HCM3 ' 'SR06CPS09:CURRENT_MONITOR' 'SR06CPS09:CURRENT_SP ' 1 [6,3] 18 1.000 ; ... +'7HCM1 ' 'SR07CPS01:CURRENT_MONITOR' 'SR07CPS01:CURRENT_SP ' 1 [7,1] 19 1.000 ; ... +'7HCM2 ' 'SR07CPS05:CURRENT_MONITOR' 'SR07CPS05:CURRENT_SP ' 1 [7,2] 20 1.000 ; ... +'7HCM3 ' 'SR07CPS09:CURRENT_MONITOR' 'SR07CPS09:CURRENT_SP ' 1 [7,3] 21 1.000 ; ... +'8HCM1 ' 'SR08CPS01:CURRENT_MONITOR' 'SR08CPS01:CURRENT_SP ' 1 [8,1] 22 1.000 ; ... +'8HCM2 ' 'SR08CPS05:CURRENT_MONITOR' 'SR08CPS05:CURRENT_SP ' 1 [8,2] 23 1.000 ; ... +'8HCM3 ' 'SR08CPS09:CURRENT_MONITOR' 'SR08CPS09:CURRENT_SP ' 1 [8,3] 24 1.000 ; ... +'9HCM1 ' 'SR09CPS01:CURRENT_MONITOR' 'SR09CPS01:CURRENT_SP ' 1 [9,1] 25 1.000 ; ... +'9HCM2 ' 'SR09CPS05:CURRENT_MONITOR' 'SR09CPS05:CURRENT_SP ' 1 [9,2] 26 1.000 ; ... +'9HCM3 ' 'SR09CPS09:CURRENT_MONITOR' 'SR09CPS09:CURRENT_SP ' 1 [9,3] 27 1.000 ; ... +'10HCM1 ' 'SR10CPS01:CURRENT_MONITOR' 'SR10CPS01:CURRENT_SP ' 1 [10,1] 28 1.000 ; ... +'10HCM2 ' 'SR10CPS05:CURRENT_MONITOR' 'SR10CPS05:CURRENT_SP ' 1 [10,2] 29 1.000 ; ... +'10HCM3 ' 'SR10CPS09:CURRENT_MONITOR' 'SR10CPS09:CURRENT_SP ' 1 [10,3] 30 1.000 ; ... +'11HCM1 ' 'SR11CPS01:CURRENT_MONITOR' 'SR11CPS01:CURRENT_SP ' 1 [11,1] 31 1.000 ; ... +'11HCM2 ' 'SR11CPS05:CURRENT_MONITOR' 'SR11CPS05:CURRENT_SP ' 1 [11,2] 32 1.000 ; ... +'11HCM3 ' 'SR11CPS09:CURRENT_MONITOR' 'SR11CPS09:CURRENT_SP ' 1 [11,3] 33 1.000 ; ... +'12HCM1 ' 'SR12CPS01:CURRENT_MONITOR' 'SR12CPS01:CURRENT_SP ' 1 [12,1] 34 1.000 ; ... +'12HCM2 ' 'SR12CPS05:CURRENT_MONITOR' 'SR12CPS05:CURRENT_SP ' 1 [12,2] 35 1.000 ; ... +'12HCM3 ' 'SR12CPS09:CURRENT_MONITOR' 'SR12CPS09:CURRENT_SP ' 1 [12,3] 36 1.000 ; ... +'13HCM1 ' 'SR13CPS01:CURRENT_MONITOR' 'SR13CPS01:CURRENT_SP ' 1 [13,1] 37 1.000 ; ... +'13HCM2 ' 'SR13CPS05:CURRENT_MONITOR' 'SR13CPS05:CURRENT_SP ' 1 [13,2] 38 1.000 ; ... +'13HCM3 ' 'SR13CPS09:CURRENT_MONITOR' 'SR13CPS09:CURRENT_SP ' 1 [13,3] 39 1.000 ; ... +'14HCM1 ' 'SR14CPS01:CURRENT_MONITOR' 'SR14CPS01:CURRENT_SP ' 1 [14,1] 40 1.000 ; ... +'14HCM2 ' 'SR14CPS05:CURRENT_MONITOR' 'SR14CPS05:CURRENT_SP ' 1 [14,2] 41 1.000 ; ... +'14HCM3 ' 'SR14CPS09:CURRENT_MONITOR' 'SR14CPS09:CURRENT_SP ' 1 [14,3] 42 1.000 ; ... +}; + +[C, Leff, MagnetType] = magnetcoefficients('HCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.HCM.Status(ii,1) = val; +val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; + +AO.HCM.Setpoint.Range(ii,:) = [+90 -90]; +AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + + +AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); +AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'}; + +AO.VCM.Monitor.Mode = Mode; +AO.VCM.Monitor.DataType = 'Scalar'; +AO.VCM.Monitor.Units = 'Hardware'; +AO.VCM.Monitor.HWUnits = 'ampere'; +AO.VCM.Monitor.PhysicsUnits = 'radian'; +AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.VCM.Monitor.Physics2HWFcn = @k2amp; + +AO.VCM.Setpoint.Mode = Mode; +AO.VCM.Setpoint.DataType = 'Scalar'; +AO.VCM.Setpoint.Units = 'Hardware'; +AO.VCM.Setpoint.HWUnits = 'ampere'; +AO.VCM.Setpoint.PhysicsUnits = 'radian'; +AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.VCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian ** radian units converted to ampere below *** +% y-common y-monitor y-setpoint stat devlist elem +cor={ +'1VCM1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... +'1VCM2 ' 'SR01CPS04:CURRENT_MONITOR' 'SR01CPS04:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... +'1VCM3 ' 'SR01CPS06:CURRENT_MONITOR' 'SR01CPS06:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... +'1VCM4 ' 'SR01CPS07:CURRENT_MONITOR' 'SR01CPS07:CURRENT_SP ' 1 [1,4] 4 1.000 ; ... +'2VCM1 ' 'SR02CPS02:CURRENT_MONITOR' 'SR02CPS02:CURRENT_SP ' 1 [2,1] 5 1.000 ; ... +'2VCM2 ' 'SR02CPS04:CURRENT_MONITOR' 'SR02CPS04:CURRENT_SP ' 1 [2,2] 6 1.000 ; ... +'2VCM3 ' 'SR02CPS06:CURRENT_MONITOR' 'SR02CPS06:CURRENT_SP ' 1 [2,3] 7 1.000 ; ... +'2VCM4 ' 'SR02CPS07:CURRENT_MONITOR' 'SR02CPS07:CURRENT_SP ' 1 [2,4] 8 1.000 ; ... +'3VCM1 ' 'SR03CPS02:CURRENT_MONITOR' 'SR03CPS02:CURRENT_SP ' 1 [3,1] 9 1.000 ; ... +'3VCM2 ' 'SR03CPS04:CURRENT_MONITOR' 'SR03CPS04:CURRENT_SP ' 1 [3,2] 10 1.000 ; ... +'3VCM3 ' 'SR03CPS06:CURRENT_MONITOR' 'SR03CPS06:CURRENT_SP ' 1 [3,3] 11 1.000 ; ... +'3VCM4 ' 'SR03CPS07:CURRENT_MONITOR' 'SR03CPS07:CURRENT_SP ' 1 [3,4] 12 1.000 ; ... +'4VCM1 ' 'SR04CPS02:CURRENT_MONITOR' 'SR04CPS02:CURRENT_SP ' 1 [4,1] 13 1.000 ; ... +'4VCM2 ' 'SR04CPS04:CURRENT_MONITOR' 'SR04CPS04:CURRENT_SP ' 1 [4,2] 14 1.000 ; ... +'4VCM3 ' 'SR04CPS06:CURRENT_MONITOR' 'SR04CPS06:CURRENT_SP ' 1 [4,3] 15 1.000 ; ... +'4VCM4 ' 'SR04CPS07:CURRENT_MONITOR' 'SR04CPS07:CURRENT_SP ' 1 [4,4] 16 1.000 ; ... +'5VCM1 ' 'SR05CPS02:CURRENT_MONITOR' 'SR05CPS02:CURRENT_SP ' 1 [5,1] 17 1.000 ; ... +'5VCM2 ' 'SR05CPS04:CURRENT_MONITOR' 'SR05CPS04:CURRENT_SP ' 1 [5,2] 18 1.000 ; ... +'5VCM3 ' 'SR05CPS06:CURRENT_MONITOR' 'SR05CPS06:CURRENT_SP ' 1 [5,3] 19 1.000 ; ... +'5VCM4 ' 'SR05CPS07:CURRENT_MONITOR' 'SR05CPS07:CURRENT_SP ' 1 [5,4] 20 1.000 ; ... +'6VCM1 ' 'SR06CPS02:CURRENT_MONITOR' 'SR06CPS02:CURRENT_SP ' 1 [6,1] 21 1.000 ; ... +'6VCM2 ' 'SR06CPS04:CURRENT_MONITOR' 'SR06CPS04:CURRENT_SP ' 1 [6,2] 22 1.000 ; ... +'6VCM3 ' 'SR06CPS06:CURRENT_MONITOR' 'SR06CPS06:CURRENT_SP ' 1 [6,3] 23 1.000 ; ... +'6VCM4 ' 'SR06CPS07:CURRENT_MONITOR' 'SR06CPS07:CURRENT_SP ' 1 [6,4] 24 1.000 ; ... +'7VCM1 ' 'SR07CPS02:CURRENT_MONITOR' 'SR07CPS02:CURRENT_SP ' 1 [7,1] 25 1.000 ; ... +'7VCM2 ' 'SR07CPS04:CURRENT_MONITOR' 'SR07CPS04:CURRENT_SP ' 1 [7,2] 26 1.000 ; ... +'7VCM3 ' 'SR07CPS06:CURRENT_MONITOR' 'SR07CPS06:CURRENT_SP ' 1 [7,3] 27 1.000 ; ... +'7VCM4 ' 'SR07CPS07:CURRENT_MONITOR' 'SR07CPS07:CURRENT_SP ' 1 [7,4] 28 1.000 ; ... +'8VCM1 ' 'SR08CPS02:CURRENT_MONITOR' 'SR08CPS02:CURRENT_SP ' 1 [8,1] 29 1.000 ; ... +'8VCM2 ' 'SR08CPS04:CURRENT_MONITOR' 'SR08CPS04:CURRENT_SP ' 1 [8,2] 30 1.000 ; ... +'8VCM3 ' 'SR08CPS06:CURRENT_MONITOR' 'SR08CPS06:CURRENT_SP ' 1 [8,3] 31 1.000 ; ... +'8VCM4 ' 'SR08CPS07:CURRENT_MONITOR' 'SR08CPS07:CURRENT_SP ' 1 [8,4] 32 1.000 ; ... +'9VCM1 ' 'SR09CPS02:CURRENT_MONITOR' 'SR09CPS02:CURRENT_SP ' 1 [9,1] 33 1.000 ; ... +'9VCM2 ' 'SR09CPS04:CURRENT_MONITOR' 'SR09CPS04:CURRENT_SP ' 1 [9,2] 34 1.000 ; ... +'9VCM3 ' 'SR09CPS06:CURRENT_MONITOR' 'SR09CPS06:CURRENT_SP ' 1 [9,3] 35 1.000 ; ... +'9VCM4 ' 'SR09CPS07:CURRENT_MONITOR' 'SR09CPS07:CURRENT_SP ' 1 [9,4] 36 1.000 ; ... +'10VCM1 ' 'SR10CPS02:CURRENT_MONITOR' 'SR10CPS02:CURRENT_SP ' 1 [10,1] 37 1.000 ; ... +'10VCM2 ' 'SR10CPS04:CURRENT_MONITOR' 'SR10CPS04:CURRENT_SP ' 1 [10,2] 38 1.000 ; ... +'10VCM3 ' 'SR10CPS06:CURRENT_MONITOR' 'SR10CPS06:CURRENT_SP ' 1 [10,3] 39 1.000 ; ... +'10VCM4 ' 'SR10CPS07:CURRENT_MONITOR' 'SR10CPS07:CURRENT_SP ' 1 [10,4] 40 1.000 ; ... +'11VCM1 ' 'SR11CPS02:CURRENT_MONITOR' 'SR11CPS02:CURRENT_SP ' 1 [11,1] 41 1.000 ; ... +'11VCM2 ' 'SR11CPS04:CURRENT_MONITOR' 'SR11CPS04:CURRENT_SP ' 1 [11,2] 42 1.000 ; ... +'11VCM3 ' 'SR11CPS06:CURRENT_MONITOR' 'SR11CPS06:CURRENT_SP ' 1 [11,3] 43 1.000 ; ... +'11VCM4 ' 'SR11CPS07:CURRENT_MONITOR' 'SR11CPS07:CURRENT_SP ' 1 [11,4] 44 1.000 ; ... +'12VCM1 ' 'SR12CPS02:CURRENT_MONITOR' 'SR12CPS02:CURRENT_SP ' 1 [12,1] 45 1.000 ; ... +'12VCM2 ' 'SR12CPS04:CURRENT_MONITOR' 'SR12CPS04:CURRENT_SP ' 1 [12,2] 46 1.000 ; ... +'12VCM3 ' 'SR12CPS06:CURRENT_MONITOR' 'SR12CPS06:CURRENT_SP ' 1 [12,3] 47 1.000 ; ... +'12VCM4 ' 'SR12CPS07:CURRENT_MONITOR' 'SR12CPS07:CURRENT_SP ' 1 [12,4] 48 1.000 ; ... +'13VCM1 ' 'SR13CPS02:CURRENT_MONITOR' 'SR13CPS02:CURRENT_SP ' 1 [13,1] 49 1.000 ; ... +'13VCM2 ' 'SR13CPS04:CURRENT_MONITOR' 'SR13CPS04:CURRENT_SP ' 1 [13,2] 50 1.000 ; ... +'13VCM3 ' 'SR13CPS06:CURRENT_MONITOR' 'SR13CPS06:CURRENT_SP ' 1 [13,3] 51 1.000 ; ... +'13VCM4 ' 'SR13CPS07:CURRENT_MONITOR' 'SR13CPS07:CURRENT_SP ' 1 [13,4] 52 1.000 ; ... +'14VCM1 ' 'SR14CPS02:CURRENT_MONITOR' 'SR14CPS02:CURRENT_SP ' 1 [14,1] 53 1.000 ; ... +'14VCM2 ' 'SR14CPS04:CURRENT_MONITOR' 'SR14CPS04:CURRENT_SP ' 1 [14,2] 54 1.000 ; ... +'14VCM3 ' 'SR14CPS06:CURRENT_MONITOR' 'SR14CPS06:CURRENT_SP ' 1 [14,3] 55 1.000 ; ... +'14VCM4 ' 'SR14CPS07:CURRENT_MONITOR' 'SR14CPS07:CURRENT_SP ' 1 [14,4] 56 1.000 ; ... +}; + +[C, Leff, MagnetType] = magnetcoefficients('VCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.VCM.Status(ii,1) = val; +val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; + +AO.VCM.Setpoint.Range(ii,:) = [+125 -125]; +AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + + +%============================= +% MAIN MAGNETS +%============================= + +%=========== +%Dipole data +%=========== + +% *** BEND *** +AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); +AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('BEND'); +Physics2HWParams = magnetcoefficients('BEND'); + +AO.BEND.Monitor.Mode = Mode; +AO.BEND.Monitor.DataType = 'Scalar'; +AO.BEND.Monitor.Units = 'Hardware'; +AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? +AO.BEND.Monitor.Physics2HWFcn = @gev2bend; +AO.BEND.Monitor.HWUnits = 'ampere'; +AO.BEND.Monitor.PhysicsUnits = 'energy'; + +AO.BEND.Setpoint.Mode = Mode; +AO.BEND.Setpoint.DataType = 'Scalar'; +AO.BEND.Setpoint.Units = 'Hardware'; +AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; +AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; +AO.BEND.Setpoint.HWUnits = 'ampere'; +AO.BEND.Setpoint.PhysicsUnits = 'energy'; + +% common monitor setpoint stat devlist elem scale tol +bend={ +'1BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.10 ; ... +'1BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,2] 2 1.0 0.10 ; ... +'2BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.10 ; ... +'2BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,2] 4 1.0 0.10 ; ... +'3BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.10 ; ... +'3BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,2] 6 1.0 0.10 ; ... +'4BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.10 ; ... +'4BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,2] 8 1.0 0.10 ; ... +'5BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.10 ; ... +'5BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,2] 10 1.0 0.10 ; ... +'6BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.10 ; ... +'6BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,2] 12 1.0 0.10 ; ... +'7BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.10 ; ... +'7BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,2] 14 1.0 0.10 ; ... +'8BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.10 ; ... +'8BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,2] 16 1.0 0.10 ; ... +'9BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.10 ; ... +'9BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,2] 18 1.0 0.10 ; ... +'10BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.10 ; ... +'10BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,2] 20 1.0 0.10 ; ... +'11BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.10 ; ... +'11BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,2] 22 1.0 0.10 ; ... +'12BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.10 ; ... +'12BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,2] 24 1.0 0.10 ; ... +'13BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.10 ; ... +'13BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,2] 26 1.0 0.10 ; ... +'14BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.10 ; ... +'14BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,2] 28 1.0 0.10 ; ... +}; + +for ii=1:size(bend,1) +name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; +name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; +name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; +val =bend{ii,4}; AO.BEND.Status(ii,1) = val; +val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; +val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; +val =bend{ii,7}; % This is the scale factor +AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; + +AO.BEND.Setpoint.Range(ii,:) = [50 695]; +end + +%=============== +%Quadrupole data +%=============== + +% *** QFA *** +AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); +AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFA'); +Physics2HWParams = magnetcoefficients('QFA'); + +AO.QFA.Monitor.Mode = Mode; +AO.QFA.Monitor.DataType = 'Scalar'; +AO.QFA.Monitor.Units = 'Hardware'; +AO.QFA.Monitor.HWUnits = 'ampere'; +AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFA.Monitor.Physics2HWFcn = @k2amp; + +AO.QFA.Setpoint.Mode = Mode; +AO.QFA.Setpoint.DataType = 'Scalar'; +AO.QFA.Setpoint.Units = 'Hardware'; +AO.QFA.Setpoint.HWUnits = 'ampere'; +AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qfa={ +'1QFA1 ' 'SR01QPS01:CURRENT_MONITOR' 'SR01QPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... +'1QFA2 ' 'SR01QPS06:CURRENT_MONITOR' 'SR01QPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... +'2QFA1 ' 'SR02QPS01:CURRENT_MONITOR' 'SR02QPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... +'2QFA2 ' 'SR02QPS06:CURRENT_MONITOR' 'SR02QPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... +'3QFA1 ' 'SR03QPS01:CURRENT_MONITOR' 'SR03QPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... +'3QFA2 ' 'SR03QPS06:CURRENT_MONITOR' 'SR03QPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... +'4QFA1 ' 'SR04QPS01:CURRENT_MONITOR' 'SR04QPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... +'4QFA2 ' 'SR04QPS06:CURRENT_MONITOR' 'SR04QPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... +'5QFA1 ' 'SR05QPS01:CURRENT_MONITOR' 'SR05QPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... +'5QFA2 ' 'SR05QPS06:CURRENT_MONITOR' 'SR05QPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... +'6QFA1 ' 'SR06QPS01:CURRENT_MONITOR' 'SR06QPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... +'6QFA2 ' 'SR06QPS06:CURRENT_MONITOR' 'SR06QPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... +'7QFA1 ' 'SR07QPS01:CURRENT_MONITOR' 'SR07QPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... +'7QFA2 ' 'SR07QPS06:CURRENT_MONITOR' 'SR07QPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... +'8QFA1 ' 'SR08QPS01:CURRENT_MONITOR' 'SR08QPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... +'8QFA2 ' 'SR08QPS06:CURRENT_MONITOR' 'SR08QPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... +'9QFA1 ' 'SR09QPS01:CURRENT_MONITOR' 'SR09QPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... +'9QFA2 ' 'SR09QPS06:CURRENT_MONITOR' 'SR09QPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... +'10QFA1 ' 'SR10QPS01:CURRENT_MONITOR' 'SR10QPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... +'10QFA2 ' 'SR10QPS06:CURRENT_MONITOR' 'SR10QPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... +'11QFA1 ' 'SR11QPS01:CURRENT_MONITOR' 'SR11QPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... +'11QFA2 ' 'SR11QPS06:CURRENT_MONITOR' 'SR11QPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... +'12QFA1 ' 'SR12QPS01:CURRENT_MONITOR' 'SR12QPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... +'12QFA2 ' 'SR12QPS06:CURRENT_MONITOR' 'SR12QPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... +'13QFA1 ' 'SR13QPS01:CURRENT_MONITOR' 'SR13QPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... +'13QFA2 ' 'SR13QPS06:CURRENT_MONITOR' 'SR13QPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... +'14QFA1 ' 'SR14QPS01:CURRENT_MONITOR' 'SR14QPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... +'14QFA2 ' 'SR14QPS06:CURRENT_MONITOR' 'SR14QPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... +}; + +for ii=1:size(qfa,1) +name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; +name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; +name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; +val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; +val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; +val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; +val =qfa{ii,7}; % This is the scale factor +AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; + +AO.QFA.Setpoint.Range(ii,:) = [0 160]; +end + + +% *** QDA *** +AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); +AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; +HW2PhysicsParams = magnetcoefficients('QDA'); +Physics2HWParams = magnetcoefficients('QDA'); + +AO.QDA.Monitor.Mode = Mode; +AO.QDA.Monitor.DataType = 'Scalar'; +AO.QDA.Monitor.Units = 'Hardware'; +AO.QDA.Monitor.HWUnits = 'ampere'; +AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QDA.Monitor.Physics2HWFcn = @k2amp; + +AO.QDA.Setpoint.Mode = Mode; +AO.QDA.Setpoint.DataType = 'Scalar'; +AO.QDA.Setpoint.Units = 'Hardware'; +AO.QDA.Setpoint.HWUnits = 'ampere'; +AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QDA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qda={ +'1QDA1 ' 'SR01QPS02:CURRENT_MONITOR' 'SR01QPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... +'1QDA2 ' 'SR01QPS05:CURRENT_MONITOR' 'SR01QPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... +'2QDA1 ' 'SR02QPS02:CURRENT_MONITOR' 'SR02QPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... +'2QDA2 ' 'SR02QPS05:CURRENT_MONITOR' 'SR02QPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... +'3QDA1 ' 'SR03QPS02:CURRENT_MONITOR' 'SR03QPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... +'3QDA2 ' 'SR03QPS05:CURRENT_MONITOR' 'SR03QPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... +'4QDA1 ' 'SR04QPS02:CURRENT_MONITOR' 'SR04QPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... +'4QDA2 ' 'SR04QPS05:CURRENT_MONITOR' 'SR04QPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... +'5QDA1 ' 'SR05QPS02:CURRENT_MONITOR' 'SR05QPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... +'5QDA2 ' 'SR05QPS05:CURRENT_MONITOR' 'SR05QPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... +'6QDA1 ' 'SR06QPS02:CURRENT_MONITOR' 'SR06QPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... +'6QDA2 ' 'SR06QPS05:CURRENT_MONITOR' 'SR06QPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... +'7QDA1 ' 'SR07QPS02:CURRENT_MONITOR' 'SR07QPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... +'7QDA2 ' 'SR07QPS05:CURRENT_MONITOR' 'SR07QPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... +'8QDA1 ' 'SR08QPS02:CURRENT_MONITOR' 'SR08QPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... +'8QDA2 ' 'SR08QPS05:CURRENT_MONITOR' 'SR08QPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... +'9QDA1 ' 'SR09QPS02:CURRENT_MONITOR' 'SR09QPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... +'9QDA2 ' 'SR09QPS05:CURRENT_MONITOR' 'SR09QPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... +'10QDA1 ' 'SR10QPS02:CURRENT_MONITOR' 'SR10QPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... +'10QDA2 ' 'SR10QPS05:CURRENT_MONITOR' 'SR10QPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... +'11QDA1 ' 'SR11QPS02:CURRENT_MONITOR' 'SR11QPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... +'11QDA2 ' 'SR11QPS05:CURRENT_MONITOR' 'SR11QPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... +'12QDA1 ' 'SR12QPS02:CURRENT_MONITOR' 'SR12QPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... +'12QDA2 ' 'SR12QPS05:CURRENT_MONITOR' 'SR12QPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... +'13QDA1 ' 'SR13QPS02:CURRENT_MONITOR' 'SR13QPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... +'13QDA2 ' 'SR13QPS05:CURRENT_MONITOR' 'SR13QPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... +'14QDA1 ' 'SR14QPS02:CURRENT_MONITOR' 'SR14QPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... +'14QDA2 ' 'SR14QPS05:CURRENT_MONITOR' 'SR14QPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... +}; + +for ii=1:size(qda,1) +name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; +name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; +name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; +val =qda{ii,4}; AO.QDA.Status(ii,1) = val; +val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; +val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; +val =qda{ii,7}; % This is the scale factor +AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; + +AO.QDA.Setpoint.Range(ii,:) = [0 90]; +end + + + +% *** QFB *** +AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); +AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFB'); +Physics2HWParams = magnetcoefficients('QFB'); + +AO.QFB.Monitor.Mode = Mode; +AO.QFB.Monitor.DataType = 'Scalar'; +AO.QFB.Monitor.Units = 'Hardware'; +AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFB.Monitor.Physics2HWFcn = @k2amp; +AO.QFB.Monitor.HWUnits = 'ampere'; +AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; + +AO.QFB.Setpoint.Mode = Mode; +AO.QFB.Setpoint.DataType = 'Scalar'; +AO.QFB.Setpoint.Units = 'Hardware'; +AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFB.Setpoint.Physics2HWFcn = @k2amp; +AO.QFB.Setpoint.HWUnits = 'ampere'; +AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +qfb={ +'1QFB1 ' 'SR01QPS03:CURRENT_MONITOR' 'SR01QPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.2 ; ... +'1QFB2 ' 'SR01QPS04:CURRENT_MONITOR' 'SR01QPS04:CURRENT_SP ' 1 [1,2] 2 1.0 0.2 ; ... +'2QFB1 ' 'SR02QPS03:CURRENT_MONITOR' 'SR02QPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.2 ; ... +'2QFB2 ' 'SR02QPS04:CURRENT_MONITOR' 'SR02QPS04:CURRENT_SP ' 1 [2,2] 4 1.0 0.2 ; ... +'3QFB1 ' 'SR03QPS03:CURRENT_MONITOR' 'SR03QPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.2 ; ... +'3QFB2 ' 'SR03QPS04:CURRENT_MONITOR' 'SR03QPS04:CURRENT_SP ' 1 [3,2] 6 1.0 0.2 ; ... +'4QFB1 ' 'SR04QPS03:CURRENT_MONITOR' 'SR04QPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.2 ; ... +'4QFB2 ' 'SR04QPS04:CURRENT_MONITOR' 'SR04QPS04:CURRENT_SP ' 1 [4,2] 8 1.0 0.2 ; ... +'5QFB1 ' 'SR05QPS03:CURRENT_MONITOR' 'SR05QPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.2 ; ... +'5QFB2 ' 'SR05QPS04:CURRENT_MONITOR' 'SR05QPS04:CURRENT_SP ' 1 [5,2] 10 1.0 0.2 ; ... +'6QFB1 ' 'SR06QPS03:CURRENT_MONITOR' 'SR06QPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.2 ; ... +'6QFB2 ' 'SR06QPS04:CURRENT_MONITOR' 'SR06QPS04:CURRENT_SP ' 1 [6,2] 12 1.0 0.2 ; ... +'7QFB1 ' 'SR07QPS03:CURRENT_MONITOR' 'SR07QPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.2 ; ... +'7QFB2 ' 'SR07QPS04:CURRENT_MONITOR' 'SR07QPS04:CURRENT_SP ' 1 [7,2] 14 1.0 0.2 ; ... +'8QFB1 ' 'SR08QPS03:CURRENT_MONITOR' 'SR08QPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.2 ; ... +'8QFB2 ' 'SR08QPS04:CURRENT_MONITOR' 'SR08QPS04:CURRENT_SP ' 1 [8,2] 16 1.0 0.2 ; ... +'9QFB1 ' 'SR09QPS03:CURRENT_MONITOR' 'SR09QPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.2 ; ... +'9QFB2 ' 'SR09QPS04:CURRENT_MONITOR' 'SR09QPS04:CURRENT_SP ' 1 [9,2] 18 1.0 0.2 ; ... +'10QFB1 ' 'SR10QPS03:CURRENT_MONITOR' 'SR10QPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.2 ; ... +'10QFB2 ' 'SR10QPS04:CURRENT_MONITOR' 'SR10QPS04:CURRENT_SP ' 1 [10,2] 20 1.0 0.2 ; ... +'11QFB1 ' 'SR11QPS03:CURRENT_MONITOR' 'SR11QPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.2 ; ... +'11QFB2 ' 'SR11QPS04:CURRENT_MONITOR' 'SR11QPS04:CURRENT_SP ' 1 [11,2] 22 1.0 0.2 ; ... +'12QFB1 ' 'SR12QPS03:CURRENT_MONITOR' 'SR12QPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.2 ; ... +'12QFB2 ' 'SR12QPS04:CURRENT_MONITOR' 'SR12QPS04:CURRENT_SP ' 1 [12,2] 24 1.0 0.2 ; ... +'13QFB1 ' 'SR13QPS03:CURRENT_MONITOR' 'SR13QPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.2 ; ... +'13QFB2 ' 'SR13QPS04:CURRENT_MONITOR' 'SR13QPS04:CURRENT_SP ' 1 [13,2] 26 1.0 0.2 ; ... +'14QFB1 ' 'SR14QPS03:CURRENT_MONITOR' 'SR14QPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.2 ; ... +'14QFB2 ' 'SR14QPS04:CURRENT_MONITOR' 'SR14QPS04:CURRENT_SP ' 1 [14,2] 28 1.0 0.2 ; ... +}; + +for ii=1:size(qfb,1) +name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; +name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; +name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; +val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; +val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; +val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; +val =qfb{ii,7}; % This is the scale factor +AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; + +AO.QFB.Setpoint.Range(ii,:) = [0 160]; +end + + +%=============== +%Sextupole data +%=============== +% *** SFA *** +AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); +AO.SFA.MemberOf = {'PlotFamily'; 'SF'; 'SEXT'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFA'); +Physics2HWParams = magnetcoefficients('SFA'); + +AO.SFA.Monitor.Mode = Mode; +AO.SFA.Monitor.DataType = 'Scalar'; +AO.SFA.Monitor.Units = 'Hardware'; +AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFA.Monitor.Physics2HWFcn = @k2amp; +AO.SFA.Monitor.HWUnits = 'ampere'; +AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFA.Setpoint.Mode = Mode; +AO.SFA.Setpoint.DataType = 'Scalar'; +AO.SFA.Setpoint.Units = 'Hardware'; +AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFA.Setpoint.Physics2HWFcn = @k2amp; +AO.SFA.Setpoint.HWUnits = 'ampere'; +AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfa={ +'1SFA1 ' 'SR01SPS01:CURRENT_MONITOR' 'SR01SPS01:CURRENT_SP ' 0 [1,1] 1 1.0 0.05 ; ... +'1SFA2 ' 'SR01SPS07:CURRENT_MONITOR' 'SR01SPS07:CURRENT_SP ' 0 [1,2] 2 1.0 0.05 ; ... +'2SFA1 ' 'SR02SPS01:CURRENT_MONITOR' 'SR02SPS01:CURRENT_SP ' 0 [2,1] 3 1.0 0.05 ; ... +'2SFA2 ' 'SR02SPS07:CURRENT_MONITOR' 'SR02SPS07:CURRENT_SP ' 0 [2,2] 4 1.0 0.05 ; ... +'3SFA1 ' 'SR03SPS01:CURRENT_MONITOR' 'SR03SPS01:CURRENT_SP ' 0 [3,1] 5 1.0 0.05 ; ... +'3SFA2 ' 'SR03SPS07:CURRENT_MONITOR' 'SR03SPS07:CURRENT_SP ' 0 [3,2] 6 1.0 0.05 ; ... +'4SFA1 ' 'SR04SPS01:CURRENT_MONITOR' 'SR04SPS01:CURRENT_SP ' 0 [4,1] 7 1.0 0.05 ; ... +'4SFA2 ' 'SR04SPS07:CURRENT_MONITOR' 'SR04SPS07:CURRENT_SP ' 0 [4,2] 8 1.0 0.05 ; ... +'5SFA1 ' 'SR05SPS01:CURRENT_MONITOR' 'SR05SPS01:CURRENT_SP ' 0 [5,1] 9 1.0 0.05 ; ... +'5SFA2 ' 'SR05SPS07:CURRENT_MONITOR' 'SR05SPS07:CURRENT_SP ' 0 [5,2] 10 1.0 0.05 ; ... +'6SFA1 ' 'SR06SPS01:CURRENT_MONITOR' 'SR06SPS01:CURRENT_SP ' 0 [6,1] 11 1.0 0.05 ; ... +'6SFA2 ' 'SR06SPS07:CURRENT_MONITOR' 'SR06SPS07:CURRENT_SP ' 0 [6,2] 12 1.0 0.05 ; ... +'7SFA1 ' 'SR07SPS01:CURRENT_MONITOR' 'SR07SPS01:CURRENT_SP ' 0 [7,1] 13 1.0 0.05 ; ... +'7SFA2 ' 'SR07SPS07:CURRENT_MONITOR' 'SR07SPS07:CURRENT_SP ' 1 [7,2] 14 1.0 0.05 ; ... +'8SFA1 ' 'SR08SPS01:CURRENT_MONITOR' 'SR08SPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.05 ; ... +'8SFA2 ' 'SR08SPS07:CURRENT_MONITOR' 'SR08SPS07:CURRENT_SP ' 1 [8,2] 16 1.0 0.05 ; ... +'9SFA1 ' 'SR09SPS01:CURRENT_MONITOR' 'SR09SPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.05 ; ... +'9SFA2 ' 'SR09SPS07:CURRENT_MONITOR' 'SR09SPS07:CURRENT_SP ' 1 [9,2] 18 1.0 0.05 ; ... +'10SFA1 ' 'SR10SPS01:CURRENT_MONITOR' 'SR10SPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.05 ; ... +'10SFA2 ' 'SR10SPS07:CURRENT_MONITOR' 'SR10SPS07:CURRENT_SP ' 1 [10,2] 20 1.0 0.05 ; ... +'11SFA1 ' 'SR11SPS01:CURRENT_MONITOR' 'SR11SPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.05 ; ... +'11SFA2 ' 'SR11SPS07:CURRENT_MONITOR' 'SR11SPS07:CURRENT_SP ' 1 [11,2] 22 1.0 0.05 ; ... +'12SFA1 ' 'SR12SPS01:CURRENT_MONITOR' 'SR12SPS01:CURRENT_SP ' 0 [12,1] 23 1.0 0.05 ; ... +'12SFA2 ' 'SR12SPS07:CURRENT_MONITOR' 'SR12SPS07:CURRENT_SP ' 1 [12,2] 24 1.0 0.05 ; ... +'13SFA1 ' 'SR13SPS01:CURRENT_MONITOR' 'SR13SPS01:CURRENT_SP ' 0 [13,1] 25 1.0 0.05 ; ... +'13SFA2 ' 'SR13SPS07:CURRENT_MONITOR' 'SR13SPS07:CURRENT_SP ' 0 [13,2] 26 1.0 0.05 ; ... +'14SFA1 ' 'SR14SPS01:CURRENT_MONITOR' 'SR14SPS01:CURRENT_SP ' 0 [14,1] 27 1.0 0.05 ; ... +'14SFA2 ' 'SR14SPS07:CURRENT_MONITOR' 'SR14SPS07:CURRENT_SP ' 0 [14,2] 28 1.0 0.05 ; ... +}; + +for ii=1:size(sfa,1) +name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; +name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; +name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; +val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; +val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; +val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; +val =sfa{ii,7}; % This is the scale factor +AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; + +AO.SFA.Setpoint.Range(ii,:) = [0 140]; +end + + + +% *** SDA *** +AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); +AO.SDA.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDA'); +Physics2HWParams = magnetcoefficients('SDA'); + +AO.SDA.Monitor.Mode = Mode; +AO.SDA.Monitor.DataType = 'Scalar'; +AO.SDA.Monitor.Units = 'Hardware'; +AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDA.Monitor.Physics2HWFcn = @k2amp; +AO.SDA.Monitor.HWUnits = 'ampere'; +AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDA.Setpoint.Mode = Mode; +AO.SDA.Setpoint.DataType = 'Scalar'; +AO.SDA.Setpoint.Units = 'Hardware'; +AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDA.Setpoint.Physics2HWFcn = @k2amp; +AO.SDA.Setpoint.HWUnits = 'ampere'; +AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; + + +% common monitor setpoint stat devlist elem scale tol +sda={ +'1SDA1 ' 'SR01SPS02:CURRENT_MONITOR' 'SR01SPS02:CURRENT_SP ' 0 [1,1] 1 1.0 0.05 ; ... +'1SDA2 ' 'SR01SPS06:CURRENT_MONITOR' 'SR01SPS06:CURRENT_SP ' 0 [1,2] 2 1.0 0.05 ; ... +'2SDA1 ' 'SR02SPS02:CURRENT_MONITOR' 'SR02SPS02:CURRENT_SP ' 0 [2,1] 3 1.0 0.05 ; ... +'2SDA2 ' 'SR02SPS06:CURRENT_MONITOR' 'SR02SPS06:CURRENT_SP ' 0 [2,2] 4 1.0 0.05 ; ... +'3SDA1 ' 'SR03SPS02:CURRENT_MONITOR' 'SR03SPS02:CURRENT_SP ' 0 [3,1] 5 1.0 0.05 ; ... +'3SDA2 ' 'SR03SPS06:CURRENT_MONITOR' 'SR03SPS06:CURRENT_SP ' 0 [3,2] 6 1.0 0.05 ; ... +'4SDA1 ' 'SR04SPS02:CURRENT_MONITOR' 'SR04SPS02:CURRENT_SP ' 0 [4,1] 7 1.0 0.05 ; ... +'4SDA2 ' 'SR04SPS06:CURRENT_MONITOR' 'SR04SPS06:CURRENT_SP ' 0 [4,2] 8 1.0 0.05 ; ... +'5SDA1 ' 'SR05SPS02:CURRENT_MONITOR' 'SR05SPS02:CURRENT_SP ' 0 [5,1] 9 1.0 0.05 ; ... +'5SDA2 ' 'SR05SPS06:CURRENT_MONITOR' 'SR05SPS06:CURRENT_SP ' 0 [5,2] 10 1.0 0.05 ; ... +'6SDA1 ' 'SR06SPS02:CURRENT_MONITOR' 'SR06SPS02:CURRENT_SP ' 0 [6,1] 11 1.0 0.05 ; ... +'6SDA2 ' 'SR06SPS06:CURRENT_MONITOR' 'SR06SPS06:CURRENT_SP ' 0 [6,2] 12 1.0 0.05 ; ... +'7SDA1 ' 'SR07SPS02:CURRENT_MONITOR' 'SR07SPS02:CURRENT_SP ' 0 [7,1] 13 1.0 0.05 ; ... +'7SDA2 ' 'SR07SPS06:CURRENT_MONITOR' 'SR07SPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.05 ; ... +'8SDA1 ' 'SR08SPS02:CURRENT_MONITOR' 'SR08SPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.05 ; ... +'8SDA2 ' 'SR08SPS06:CURRENT_MONITOR' 'SR08SPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.05 ; ... +'9SDA1 ' 'SR09SPS02:CURRENT_MONITOR' 'SR09SPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.05 ; ... +'9SDA2 ' 'SR09SPS06:CURRENT_MONITOR' 'SR09SPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.05 ; ... +'10SDA1 ' 'SR10SPS02:CURRENT_MONITOR' 'SR10SPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.05 ; ... +'10SDA2 ' 'SR10SPS06:CURRENT_MONITOR' 'SR10SPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.05 ; ... +'11SDA1 ' 'SR11SPS02:CURRENT_MONITOR' 'SR11SPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.05 ; ... +'11SDA2 ' 'SR11SPS06:CURRENT_MONITOR' 'SR11SPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.05 ; ... +'12SDA1 ' 'SR12SPS02:CURRENT_MONITOR' 'SR12SPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.05 ; ... +'12SDA2 ' 'SR12SPS06:CURRENT_MONITOR' 'SR12SPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.05 ; ... +'13SDA1 ' 'SR13SPS02:CURRENT_MONITOR' 'SR13SPS02:CURRENT_SP ' 0 [13,1] 25 1.0 0.05 ; ... +'13SDA2 ' 'SR13SPS06:CURRENT_MONITOR' 'SR13SPS06:CURRENT_SP ' 0 [13,2] 26 1.0 0.05 ; ... +'14SDA1 ' 'SR14SPS02:CURRENT_MONITOR' 'SR14SPS02:CURRENT_SP ' 0 [14,1] 27 1.0 0.05 ; ... +'14SDA2 ' 'SR14SPS06:CURRENT_MONITOR' 'SR14SPS06:CURRENT_SP ' 0 [14,2] 28 1.0 0.05 ; ... +}; + +for ii=1:size(sda,1) +name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; +name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; +name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; +val =sda{ii,4}; AO.SDA.Status(ii,1) = val; +val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; +val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; +val =sda{ii,7}; % This is the scale factor +AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; + +AO.SDA.Setpoint.Range(ii,:) = [0 140]; +end + + +% *** SDB *** +AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); +AO.SDB.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDB'); +Physics2HWParams = magnetcoefficients('SDB'); + +AO.SDB.Monitor.Mode = Mode; +AO.SDB.Monitor.DataType = 'Scalar'; +AO.SDB.Monitor.Units = 'Hardware'; +AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDB.Monitor.Physics2HWFcn = @k2amp; +AO.SDB.Monitor.HWUnits = 'ampere'; +AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDB.Setpoint.Mode = Mode; +AO.SDB.Setpoint.DataType = 'Scalar'; +AO.SDB.Setpoint.Units = 'Hardware'; +AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDB.Setpoint.Physics2HWFcn = @k2amp; +AO.SDB.Setpoint.HWUnits = 'ampere'; +AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sdb={ +'1SDB1 ' 'SR01SPS03:CURRENT_MONITOR' 'SR01SPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.05 ; ... +'1SDB2 ' 'SR01SPS05:CURRENT_MONITOR' 'SR01SPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.05 ; ... +'2SDB1 ' 'SR02SPS03:CURRENT_MONITOR' 'SR02SPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.05 ; ... +'2SDB2 ' 'SR02SPS05:CURRENT_MONITOR' 'SR02SPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.05 ; ... +'3SDB1 ' 'SR03SPS03:CURRENT_MONITOR' 'SR03SPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.05 ; ... +'3SDB2 ' 'SR03SPS05:CURRENT_MONITOR' 'SR03SPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.05 ; ... +'4SDB1 ' 'SR04SPS03:CURRENT_MONITOR' 'SR04SPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.05 ; ... +'4SDB2 ' 'SR04SPS05:CURRENT_MONITOR' 'SR04SPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.05 ; ... +'5SDB1 ' 'SR05SPS03:CURRENT_MONITOR' 'SR05SPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.05 ; ... +'5SDB2 ' 'SR05SPS05:CURRENT_MONITOR' 'SR05SPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.05 ; ... +'6SDB1 ' 'SR06SPS03:CURRENT_MONITOR' 'SR06SPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.05 ; ... +'6SDB2 ' 'SR06SPS05:CURRENT_MONITOR' 'SR06SPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.05 ; ... +'7SDB1 ' 'SR07SPS03:CURRENT_MONITOR' 'SR07SPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.05 ; ... +'7SDB2 ' 'SR07SPS05:CURRENT_MONITOR' 'SR07SPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.05 ; ... +'8SDB1 ' 'SR08SPS03:CURRENT_MONITOR' 'SR08SPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.05 ; ... +'8SDB2 ' 'SR08SPS05:CURRENT_MONITOR' 'SR08SPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.05 ; ... +'9SDB1 ' 'SR09SPS03:CURRENT_MONITOR' 'SR09SPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.05 ; ... +'9SDB2 ' 'SR09SPS05:CURRENT_MONITOR' 'SR09SPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.05 ; ... +'10SDB1 ' 'SR10SPS03:CURRENT_MONITOR' 'SR10SPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.05 ; ... +'10SDB2 ' 'SR10SPS05:CURRENT_MONITOR' 'SR10SPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.05 ; ... +'11SDB1 ' 'SR11SPS03:CURRENT_MONITOR' 'SR11SPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.05 ; ... +'11SDB2 ' 'SR11SPS05:CURRENT_MONITOR' 'SR11SPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.05 ; ... +'12SDB1 ' 'SR12SPS03:CURRENT_MONITOR' 'SR12SPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.05 ; ... +'12SDB2 ' 'SR12SPS05:CURRENT_MONITOR' 'SR12SPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.05 ; ... +'13SDB1 ' 'SR13SPS03:CURRENT_MONITOR' 'SR13SPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.05 ; ... +'13SDB2 ' 'SR13SPS05:CURRENT_MONITOR' 'SR13SPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.05 ; ... +'14SDB1 ' 'SR14SPS03:CURRENT_MONITOR' 'SR14SPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.05 ; ... +'14SDB2 ' 'SR14SPS05:CURRENT_MONITOR' 'SR14SPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.05 ; ... +}; + +for ii=1:size(sdb,1) +name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; +name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; +name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; +val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; +val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; +val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; +val =sdb{ii,7}; % This is the scale factor +AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; + +AO.SDB.Setpoint.Range(ii,:) = [0 140]; +end + + + +% *** SFB *** +AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); +AO.SFB.MemberOf = {'PlotFamily'; 'SF'; 'SEXT'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFB'); +Physics2HWParams = magnetcoefficients('SFB'); + +AO.SFB.Monitor.Mode = Mode; +AO.SFB.Monitor.DataType = 'Scalar'; +AO.SFB.Monitor.Units = 'Hardware'; +AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFB.Monitor.Physics2HWFcn = @k2amp; +AO.SFB.Monitor.HWUnits = 'ampere'; +AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFB.Setpoint.Mode = Mode; +AO.SFB.Setpoint.DataType = 'Scalar'; +AO.SFB.Setpoint.Units = 'Hardware'; +AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFB.Setpoint.Physics2HWFcn = @k2amp; +AO.SFB.Setpoint.HWUnits = 'ampere'; +AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfb={ +'1SFB1 ' 'SR01SPS04:CURRENT_MONITOR' 'SR01SPS04:CURRENT_SP ' 1 [1,1] 1 1.0 0.05 ; ... +'2SFB1 ' 'SR02SPS04:CURRENT_MONITOR' 'SR02SPS04:CURRENT_SP ' 1 [2,1] 2 1.0 0.05 ; ... +'3SFB1 ' 'SR03SPS04:CURRENT_MONITOR' 'SR03SPS04:CURRENT_SP ' 1 [3,1] 3 1.0 0.05 ; ... +'4SFB1 ' 'SR04SPS04:CURRENT_MONITOR' 'SR04SPS04:CURRENT_SP ' 1 [4,1] 4 1.0 0.05 ; ... +'5SFB1 ' 'SR05SPS04:CURRENT_MONITOR' 'SR05SPS04:CURRENT_SP ' 1 [5,1] 5 1.0 0.05 ; ... +'6SFB1 ' 'SR06SPS04:CURRENT_MONITOR' 'SR06SPS04:CURRENT_SP ' 1 [6,1] 6 1.0 0.05 ; ... +'7SFB1 ' 'SR07SPS04:CURRENT_MONITOR' 'SR07SPS04:CURRENT_SP ' 1 [7,1] 7 1.0 0.05 ; ... +'8SFB1 ' 'SR08SPS04:CURRENT_MONITOR' 'SR08SPS04:CURRENT_SP ' 1 [8,1] 8 1.0 0.05 ; ... +'9SFB1 ' 'SR09SPS04:CURRENT_MONITOR' 'SR09SPS04:CURRENT_SP ' 1 [9,1] 9 1.0 0.05 ; ... +'10SFB1 ' 'SR10SPS04:CURRENT_MONITOR' 'SR10SPS04:CURRENT_SP ' 1 [10,1] 10 1.0 0.05 ; ... +'11SFB1 ' 'SR11SPS04:CURRENT_MONITOR' 'SR11SPS04:CURRENT_SP ' 1 [11,1] 11 1.0 0.05 ; ... +'12SFB1 ' 'SR12SPS04:CURRENT_MONITOR' 'SR12SPS04:CURRENT_SP ' 1 [12,1] 12 1.0 0.05 ; ... +'13SFB1 ' 'SR13SPS04:CURRENT_MONITOR' 'SR13SPS04:CURRENT_SP ' 1 [13,1] 13 1.0 0.05 ; ... +'14SFB1 ' 'SR14SPS04:CURRENT_MONITOR' 'SR14SPS04:CURRENT_SP ' 1 [14,1] 14 1.0 0.05 ; ... +}; + +for ii=1:size(sfb,1) +name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; +name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; +name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; +val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; +val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; +val =sfb{ii,6}; AO.SFB.ElementLsist(ii,1) = val; +val =sfb{ii,7}; % This is the scale factor +AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; + +AO.SFB.Setpoint.Range(ii,:) = [0 140]; +end + +%=============== +%Skew Quad data +%=============== +% *** Skew quadrupoles *** 2005/09/27 Eugene +AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); +AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('SKQ'); +Physics2HWParams = magnetcoefficients('SKQ'); + +AO.SKQ.Monitor.Mode = Mode; +AO.SKQ.Monitor.DataType = 'Scalar'; +AO.SKQ.Monitor.Units = 'Hardware'; +AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; +AO.SKQ.Monitor.Physics2HWFcn = @k2amp; +AO.SKQ.Monitor.HWUnits = 'ampere'; +AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; + +AO.SKQ.Setpoint.Mode = Mode; +AO.SKQ.Setpoint.DataType = 'Scalar'; +AO.SKQ.Setpoint.Units = 'Hardware'; +AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; +AO.SKQ.Setpoint.HWUnits = 'ampere'; +AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +sq={ +'1SKQ1 ' 'SR01CPS03:CURRENT_MONITOR' 'SR01CPS03:CURRENT_SP ' 1 [1,1] 1 1 ; ... +'1SKQ2 ' 'SR01CPS08:CURRENT_MONITOR' 'SR01CPS08:CURRENT_SP ' 1 [1,2] 2 1 ; ... +'2SKQ1 ' 'SR02CPS03:CURRENT_MONITOR' 'SR02CPS03:CURRENT_SP ' 1 [2,1] 3 1 ; ... +'2SKQ2 ' 'SR02CPS08:CURRENT_MONITOR' 'SR02CPS08:CURRENT_SP ' 1 [2,2] 4 1 ; ... +'3SKQ1 ' 'SR03CPS03:CURRENT_MONITOR' 'SR03CPS03:CURRENT_SP ' 1 [3,1] 5 1 ; ... +'3SKQ2 ' 'SR03CPS08:CURRENT_MONITOR' 'SR03CPS08:CURRENT_SP ' 1 [3,2] 6 1 ; ... +'4SKQ1 ' 'SR04CPS03:CURRENT_MONITOR' 'SR04CPS03:CURRENT_SP ' 1 [4,1] 7 1 ; ... +'4SKQ2 ' 'SR04CPS08:CURRENT_MONITOR' 'SR04CPS08:CURRENT_SP ' 1 [4,2] 8 1 ; ... +'5SKQ1 ' 'SR05CPS03:CURRENT_MONITOR' 'SR05CPS03:CURRENT_SP ' 1 [5,1] 9 1 ; ... +'5SKQ2 ' 'SR05CPS08:CURRENT_MONITOR' 'SR05CPS08:CURRENT_SP ' 1 [5,2] 10 1 ; ... +'6SKQ1 ' 'SR06CPS03:CURRENT_MONITOR' 'SR06CPS03:CURRENT_SP ' 1 [6,1] 11 1 ; ... +'6SKQ2 ' 'SR06CPS08:CURRENT_MONITOR' 'SR06CPS08:CURRENT_SP ' 1 [6,2] 12 1 ; ... +'7SKQ1 ' 'SR07CPS03:CURRENT_MONITOR' 'SR07CPS03:CURRENT_SP ' 1 [7,1] 13 1 ; ... +'7SKQ2 ' 'SR07CPS08:CURRENT_MONITOR' 'SR07CPS08:CURRENT_SP ' 1 [7,2] 14 1 ; ... +'8SKQ1 ' 'SR08CPS03:CURRENT_MONITOR' 'SR08CPS03:CURRENT_SP ' 1 [8,1] 15 1 ; ... +'8SKQ2 ' 'SR08CPS08:CURRENT_MONITOR' 'SR08CPS08:CURRENT_SP ' 1 [8,2] 16 1 ; ... +'9SKQ1 ' 'SR09CPS03:CURRENT_MONITOR' 'SR09CPS03:CURRENT_SP ' 1 [9,1] 17 1 ; ... +'9SKQ2 ' 'SR09CPS08:CURRENT_MONITOR' 'SR09CPS08:CURRENT_SP ' 1 [9,2] 18 1 ; ... +'10SKQ1 ' 'SR10CPS03:CURRENT_MONITOR' 'SR10CPS03:CURRENT_SP ' 1 [10,1] 19 1 ; ... +'10SKQ2 ' 'SR10CPS08:CURRENT_MONITOR' 'SR10CPS08:CURRENT_SP ' 1 [10,2] 20 1 ; ... +'11SKQ1 ' 'SR11CPS03:CURRENT_MONITOR' 'SR11CPS03:CURRENT_SP ' 1 [11,1] 21 1 ; ... +'11SKQ2 ' 'SR11CPS08:CURRENT_MONITOR' 'SR11CPS08:CURRENT_SP ' 1 [11,2] 22 1 ; ... +'12SKQ1 ' 'SR12CPS03:CURRENT_MONITOR' 'SR12CPS03:CURRENT_SP ' 1 [12,1] 23 1 ; ... +'12SKQ2 ' 'SR12CPS08:CURRENT_MONITOR' 'SR12CPS08:CURRENT_SP ' 1 [12,2] 24 1 ; ... +'13SKQ1 ' 'SR13CPS03:CURRENT_MONITOR' 'SR13CPS03:CURRENT_SP ' 1 [13,1] 25 1 ; ... +'13SKQ2 ' 'SR13CPS08:CURRENT_MONITOR' 'SR13CPS08:CURRENT_SP ' 1 [13,2] 26 1 ; ... +'14SKQ1 ' 'SR14CPS03:CURRENT_MONITOR' 'SR14CPS03:CURRENT_SP ' 1 [14,1] 27 1 ; ... +'14SKQ2 ' 'SR14CPS08:CURRENT_MONITOR' 'SR14CPS08:CURRENT_SP ' 1 [14,2] 28 1 ; ... +}; + +for ii=1:size(sq,1) +name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; +name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; +name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; +val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; +val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; +val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; +val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; +AO.SKQ.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SKQ.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SKQ.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SKQ.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; + +AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; +end + + +%=============== +%Kicker data +%=============== +AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); +AO.KICK.MemberOf = {'Injection','MachineConfig'}; + +AO.KICK.Monitor.Mode = Mode; +AO.KICK.Monitor.DataType = 'Scalar'; +AO.KICK.Monitor.Units = 'Hardware'; +AO.KICK.Monitor.HWUnits = 'kVolts'; +AO.KICK.Monitor.PhysicsUnits = 'mradian'; + +AO.KICK.Setpoint.Mode = Mode; +AO.KICK.Setpoint.DataType = 'Scalar'; +AO.KICK.Setpoint.Units = 'Hardware'; +AO.KICK.Setpoint.HWUnits = 'Volts'; +AO.KICK.Setpoint.PhysicsUnits = 'radian'; + +% From kicker deisgn review the kickers are rated to 4380 Amps giving 0.038 +% Tesla converting this to kickangle. Also convert voltage into amps for +% the conversion? +% +% 2780 V on the capacitor banks will create 5240 A delivered to the kicker +% magnets. +% From simulations 4380 A creates 0.038607 T over a length of 0.7 m. +% Therefore 4380 A => 2.7006 mrad. Therefore 2323.740 V => 2.7006 mrad. +% HW2PHYSICS conversion factor (kV to rad) is therefore 0.0027006/2.32374 = +% 0.00116217821271. The Ps also goes through a 1:3 transformer therefore +% the conversion factor increases by 3. Ie 0.00348653463813 +% For V to rad then 0.00000348653463813. +hw2physics_conversionfactor = 0.00000348653463813; + +%common monitor setpoint stat devlist elem tol +kickeramp={ +'KICK1 ' 'SR14KPS01:VOLTAGE_MONITOR' 'SR14KPS01:VOLTAGE_SP ' 1 [1,1] 1 0.10 ; ... +'KICK2 ' 'SR01KPS01:VOLTAGE_MONITOR' 'SR01KPS01:VOLTAGE_SP ' 1 [1,2] 2 0.10 ; ... +'KICK3 ' 'SR01KPS02:VOLTAGE_MONITOR' 'SR01KPS02:VOLTAGE_SP ' 1 [1,3] 3 0.10 ; ... +'KICK4 ' 'SR02KPS01:VOLTAGE_MONITOR' 'SR02KPS01:VOLTAGE_SP ' 1 [1,4] 4 0.10 ; ... +}; + +for ii=1:size(kickeramp,1) +name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; +name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; +name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; +val =kickeramp{ii,4}; AO.KICK.Status(ii,1) = val; +val =kickeramp{ii,5}; AO.KICK.DeviceList(ii,:) = val; +val =kickeramp{ii,6}; AO.KICK.ElementList(ii,1) = val; +val =kickeramp{ii,7}; AO.KICK.Setpoint.Tolerance(ii,1) = val; + +if ii==1||ii==4 + AO.KICK.Monitor.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; + AO.KICK.Monitor.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; + AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; + AO.KICK.Setpoint.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; + AO.KICK.Setpoint.Range(ii,:) = [-1300 +1300]; +else + AO.KICK.Monitor.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; + AO.KICK.Monitor.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; + AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; + AO.KICK.Setpoint.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; + AO.KICK.Setpoint.Range(ii,:) = [+1300 -1300]; +end +end + +% *** KICK Delay *** +% AO.KICK.Delay +% >> removed >> see previous versions if info needed + + +%============ +%RF System +%============ +AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); +AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +%-------------------------------- 4 cavity Case +%common stat devlist elem +rfcommon={ +'RF1 ' 1 [1,1] 1 ; ... +'RF2 ' 1 [1,2] 2 ; ... +'RF3 ' 1 [1,3] 3 ; ... +'RF4 ' 1 [1,4] 4 ; ... + }; + +%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance +rffreq={ +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 2500000] 100.0; ... + }; + +% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfphase={ +'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... +'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... +'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... +'SR07RF01LLE01:MASTER_PHASE_REFERENCE_SP' 'SR07RF01LLE01:MASTER_PHASE_MONITOR' 1 1 [-200 200] inf ; ... + }; + +% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfvolt={ +'SRF1:STN:VOLT:CTRL ' 'SR06RF01CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... +'SRF2:STN:VOLT:CTRL ' 'SR06RF02CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... +'SRF3:STN:VOLT:CTRL ' 'SR07RF01CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... +'SRF4:STN:VOLT:CTRL ' 'SR07RF02CAV01:VOLTAGE_MONITOR' 1 1 [0 750] inf ; ... + }; + +% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance +% rfpower={ +% 'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SRF1:KLYSDRIVFRWD:POWER' 'SRF1:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +% 'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SRF2:KLYSDRIVFRWD:POWER' 'SRF2:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +% 'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SRF3:KLYSDRIVFRWD:POWER' 'SRF3:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +% 'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SRF4:KLYSDRIVFRWD:POWER' 'SRF4:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +% }; + +for ii=1:size(rfcommon,1) +name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; +val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; +val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; +val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; +end + +for ii=1:size(rffreq,1) +name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; +name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; +val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; + AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; +val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; + AO.RF.Setpoint.Physics2HWParams(ii,1) = val; +val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; +val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfphase,1) +name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; +name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; +val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Phase.HW2PhysicsParams(ii,1) = val; +val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Phase.Physics2HWParams(ii,1) = val; +val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; + AO.RF.Phase.Range(ii,:) = val; +val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; + AO.RF.Phase.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfvolt,1) +% name=rfvolt{ii,1}; AO.RF.VoltageCtrl.ChannelNames(ii,:) = name; +name=rfvolt{ii,2}; AO.RF.Voltage.ChannelNames(ii,:) = name; +val =rfvolt{ii,3}; % AO.RF.VoltageCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Voltage.HW2PhysicsParams(ii,1) = val; +val =rfvolt{ii,4}; % AO.RF.VoltageCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Voltage.Physics2HWParams(ii,1) = val; +val =rfvolt{ii,5}; % AO.RF.VoltageCtrl.Range(ii,:) = val; + AO.RF.Voltage.Range(ii,:) = val; +val =rfvolt{ii,6}; % AO.RF.VoltageCtrl.Tolerance(ii,1) = val; + AO.RF.Voltage.Tolerance(ii,1) = val; +end + + +% for ii=1:size(rfpower,1) +% name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; +% name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; +% name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; +% val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; +% AO.RF.Power.HW2PhysicsParams(ii,1) = val; +% AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; +% val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; +% AO.RF.Power.Physics2HWParams(ii,1) = val; +% AO.RF.KlysPower.Physics2HWParams(ii,1) = val; +% val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; +% AO.RF.Power.Range(ii,:) = val; +% AO.RF.KlysPower.Range(ii,:) = val; +% val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; +% AO.RF.Power.Tolerance(ii,1) = val; +% AO.RF.KlysPower.Tolerance(ii,1) = val; +% end + +%Frequency Readback +AO.RF.Monitor.Mode = Mode; +AO.RF.Monitor.DataType = 'Scalar'; +AO.RF.Monitor.Units = 'Hardware'; +AO.RF.Monitor.HWUnits = 'Hz'; +AO.RF.Monitor.PhysicsUnits = 'Hz'; +%Frequency Setpoint +AO.RF.Setpoint.Mode = Mode; +AO.RF.Setpoint.DataType = 'Scalar'; +AO.RF.Setpoint.Units = 'Hardware'; +AO.RF.Setpoint.HWUnits = 'Hz'; +AO.RF.Setpoint.PhysicsUnits = 'Hz'; + +%Voltage control +% AO.RF.VoltageCtrl.Mode = Mode; +% AO.RF.VoltageCtrl.DataType = 'Scalar'; +% AO.RF.VoltageCtrl.Units = 'Hardware'; +% AO.RF.VoltageCtrl.HWUnits = 'Volts'; +% AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; + +%Voltage monitor +AO.RF.Voltage.Mode = Mode; +AO.RF.Voltage.DataType = 'Scalar'; +AO.RF.Voltage.Units = 'Hardware'; +AO.RF.Voltage.HWUnits = 'Volts'; +AO.RF.Voltage.PhysicsUnits = 'Volts'; + +%Power Control +% AO.RF.PowerCtrl.Mode = Mode; +% AO.RF.PowerCtrl.DataType = 'Scalar'; +% AO.RF.PowerCtrl.Units = 'Hardware'; +% AO.RF.PowerCtrl.HWUnits = 'MWatts'; +% AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; + +%Power Monitor +AO.RF.Power.Mode = Mode; +AO.RF.Power.DataType = 'Scalar'; +AO.RF.Power.Units = 'Hardware'; +AO.RF.Power.HWUnits = 'MWatts'; +AO.RF.Power.PhysicsUnits = 'MWatts'; + +% %Klystron Forward Power +% AO.RF.KlysPower.Mode = Mode; +% AO.RF.KlysPower.DataType = 'Scalar'; +% AO.RF.KlysPower.Units = 'Hardware'; +% AO.RF.KlysPower.HWUnits = 'MWatts'; +% AO.RF.KlysPower.PhysicsUnits = 'MWatts'; + +% %Station Phase Control +% AO.RF.PhaseCtrl.Mode = Mode; +% AO.RF.PhaseCtrl.DataType = 'Scalar'; +% AO.RF.PhaseCtrl.Units = 'Hardware'; +% AO.RF.PhaseCtrl.HWUnits = 'Degrees'; +% AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; + +%Station Phase Monitor +AO.RF.Phase.Mode = Mode; +AO.RF.Phase.DataType = 'Scalar'; +AO.RF.Phase.Units = 'Hardware'; +AO.RF.Phase.HWUnits = 'Degrees'; +AO.RF.Phase.PhysicsUnits = 'Degrees'; + +%==== +%TUNE +%==== +AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); +AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; +AO.TUNE.CommonNames = ['xtune';'ytune';'stune']; +AO.TUNE.DeviceList = [ 1 1; 1 2; 1 3]; +AO.TUNE.ElementList = [1 2 3]'; +AO.TUNE.Status = [1 1 0]'; + +AO.TUNE.Monitor.Mode = Mode; +AO.TUNE.Monitor.DataType = 'Vector'; +AO.TUNE.Monitor.DataTypeIndex = [1 2 3]'; +AO.TUNE.Monitor.ChannelNames = 'MeasTune'; +AO.TUNE.Monitor.Units = 'Hardware'; +AO.TUNE.Monitor.HW2PhysicsParams = 1; +AO.TUNE.Monitor.Physics2HWParams = 1; +AO.TUNE.Monitor.HWUnits = 'fractional tune'; +AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; + + +%==== +%DCCT +%==== +AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); +AO.DCCT.MemberOf = {'Diagnostics'}; +AO.DCCT.CommonNames = 'DCCT'; +AO.DCCT.DeviceList = [1 1]; +AO.DCCT.ElementList = [1]; +AO.DCCT.Status = [1]; + +AO.DCCT.Monitor.Mode = Mode; +AO.DCCT.Monitor.DataType = 'Scalar'; +AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; +AO.DCCT.Monitor.Units = 'Hardware'; +AO.DCCT.Monitor.HWUnits = 'milli-ampere'; +AO.DCCT.Monitor.PhysicsUnits = 'ampere'; +AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; +AO.DCCT.Monitor.Physics2HWParams = 1000; + + +% %================== +% %Machine Parameters +% %================== +% Removed in this version, see pervious version for more info + +%====== +%Septum +%====== +% ifam=ifam+1; +% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); +% AO.Septum.MemberOf = {'Injection'}; +% AO.Septum.Status = 1; +% +% AO.Septum.CommonNames = 'Septum '; +% AO.Septum.DeviceList = [3 1]; +% AO.Septum.ElementList = [1]; +% +% AO.Septum.Monitor.Mode = Mode; +% AO.Septum.Monitor.DataType = 'Scalar'; +% AO.Septum.Monitor.Units = 'Hardware'; +% AO.Septum.Monitor.HWUnits = 'ampere'; +% AO.Septum.Monitor.PhysicsUnits = 'radian'; +% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; +% +% AO.Septum.Setpoint.Mode = Mode; +% AO.Septum.Setpoint.DataType = 'Scalar'; +% AO.Septum.Setpoint.Units = 'Hardware'; +% AO.Septum.Setpoint.HWUnits = 'ampere'; +% AO.Septum.Setpoint.PhysicsUnits = 'radian'; +% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; +% AO.Septum.Setpoint.Range = [0, 2500]; +% AO.Septum.Setpoint.Tolerance = 100.0; +% +% AO.Septum.Monitor.HW2PhysicsParams = 1; +% AO.Septum.Monitor.Physics2HWParams = 1; +% AO.Septum.Setpoint.HW2PhysicsParams = 1; +% AO.Septum.Setpoint.Physics2HWParams = 1; + + +%==================== +%Photon Beamline Data +%==================== +% >> removed >> see previous versions if info needed + +%==================== +%BPLD Data +%==================== +% >> removed >> see previous versions if info needed + + + +% The operational mode sets the path, filenames, and other important parameters +% Run setoperationalmode after most of the AO is built so that the Units and Mode fields +% can be set in setoperationalmode +fprintf('\n'); +setao(AO); +setoperationalmode(OperationalMode); +AO = getao; + + +%%%%%%%%%%%%%%%% +% DeltaRespMat % +%%%%%%%%%%%%%%%% + +% I remove the physics2hw conversion because the physics2hw is +% is calibrated yet. + +% Set response matrix kick size in hardware units (amps) +AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', .15e-3 / 1, AO.HCM.DeviceList); +AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', .15e-3 / 1, AO.VCM.DeviceList); + +%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point +%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); +%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); + + +AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); +AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); +AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); + + +AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); +AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); +AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); +AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Get S-positions [meters] % +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Using ...ATIndex(:,1) will accomodata for split elements where the first +% of a group of elements is put in the first column ie, if SFA is split in +% two then ATIndex will look like [2 3; 11 12; ...] where each row is a +% magnet and column represents each split. +global THERING +AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; +AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; +AO.FTx.Position = findspos(THERING, AO.FTx.AT.ATIndex(:,1))'; +AO.FTy.Position = findspos(THERING, AO.FTy.AT.ATIndex(:,1))'; +AO.FTsum.Position= findspos(THERING, AO.FTsum.AT.ATIndex(:,1))'; +AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; +AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; +AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; +AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; +AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; +AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; +AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; +AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; +AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; +AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; +AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; +AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; +AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; +AO.DCCT.Position = 0; +AO.TUNE.Position = 0; + + +% Save AO +setao(AO); + + +function dispobject(AO,name) + +n = length(fieldnames(AO)); + +if n > 0 + fprintf(' %10s ',name); + if mod(n,5) == 0 + fprintf('\n'); + end end \ No newline at end of file diff --git a/machine/ASP/StorageRing/aspinit_20061204.m b/machine/ASP/StorageRing/aspinit_20061204.m index 17cba8f3..aaf1d6d4 100644 --- a/machine/ASP/StorageRing/aspinit_20061204.m +++ b/machine/ASP/StorageRing/aspinit_20061204.m @@ -1,1777 +1,1777 @@ -function aspinit(OperationalMode) -% aspinit(OperationalMode) -% -% Initialize parameters for ASP control in MATLAB -% -%========================== -% Accelerator Family Fields -%========================== -% FamilyName BPMx, HCM, etc -% CommonNames Shortcut name for each element (optional) -% DeviceList [Sector, Number] -% ElementList number in list -% Position m, magnet center -% -% MONITOR FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units Physics or HW -% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% -% SETPOINT FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units hardware or physics -% HW2PhysicsFcn function handle used to convert from hardware to physics units -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% Range minsetpoint, maxsetpoint; -% Tolerance setpoint-monitor -% -%============================================= -% Accelerator Toolbox Simulation Fields -%============================================= -% ATType Quad, Sext, etc -% ATIndex index in THERING -% ATParameterGroup parameter group -% -%============ -% Family List -%============ -% BPMx BPMy - beam position monitors -% HCM VCM - corrector magnets wound into sextupoles -% BEND - gradient dipoles -% QFA QDA QFB - quadrupole magnets -% SFA SDA SDB SFB - sextupole magnets -% SQK - skew quads wound into SDA magnets -% KICK - injection kickers (DELTA type) -% RF - 4 cavities (KEK type?) -% DCCT -% Septum (Not in model yet) -% -% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 -% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 - -% === Change Log === -% Mark Boland 2004-02-12 -% Eugene Tan 2004-02-23 -% Eugene Tan 2004-12-13 -% Eugene Tan 2005-09-27 ver 4 -% Updated naming convention of the process variables, use version 4 of -% the lattice "assr4.m" where the correctors have been merged into the -% sextupoles. Made the necessary changes to updateatindex. Added skew -% quadrupoles and updated generate_init. -% Mark Boland 2006-05-27 -% Changed the BPM PVs to ...:SA_HPOS_MONITOR and ...:SA_VPOS_MONITOR -% -% Mark Boland 2006-08-29 -% Changed range on HCM and VCM from - to + since the polarity of the -% correctors was physically changed in the last weeks. -% -% === Still to do === -% - kicker delays -% - BPM names and other possible PVs of interest eg. Q factor etc. -% - clean up and configure the amp2k and k2amp conversion. Control system -% designed to calculate the strengths and amp values using calc records, -% therefore we should only need to change the PV name to access for -% readback at setpoints. Only problem will be in simulation/offline mode -% where those value are not available online. How do you keep the offline -% conversion factors up to date with online vals? -% -% === Generated from === -% aspinit_v5skeleton.m - -% Default operational mode -if nargin < 1 - OperationalMode = 1; -end - - -%============================================= -% START DEFINITION OF ACCELERATOR OBJECTS -%============================================= -fprintf(' Defining the Accelerator Objects. Objects being defined:\n') - - -% Clear previous AcceleratorObjects -setao([]); - - -Mode = 'Online'; % This gets reset in setoperationalmode - -%============================================= -%BPM data: status field designates if BPM in use -%============================================= -ntbpm=98; -AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); -AO.BPMx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMx'}; -AO.BPMx.Monitor.Mode = Mode; -AO.BPMx.Monitor.DataType = 'Scalar'; -AO.BPMx.Monitor.Units = 'Hardware'; -AO.BPMx.Monitor.HWUnits = 'mm'; -AO.BPMx.Monitor.PhysicsUnits = 'meter'; - -AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); -AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMy'}; -AO.BPMy.Monitor.Mode = Mode; -AO.BPMy.Monitor.DataType = 'Scalar'; -AO.BPMy.Monitor.Units = 'Hardware'; -AO.BPMy.Monitor.HWUnits = 'mm'; -AO.BPMy.Monitor.PhysicsUnits = 'meter'; - -% x-name x-chname xstat y-name y-chname ystat DevList Elem -bpm={ -'1BPMx1 ' 'SR01BPM01:SA_HPOS_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:SA_VPOS_MONITOR' 1 [1,1] 1 ; ... -'1BPMx2 ' 'SR01BPM02:SA_HPOS_MONITOR' 1 '1BPMy2 ' 'SR01BPM02:SA_VPOS_MONITOR' 1 [1,2] 2 ; ... -'1BPMx3 ' 'SR01BPM03:SA_HPOS_MONITOR' 1 '1BPMy3 ' 'SR01BPM03:SA_VPOS_MONITOR' 1 [1,3] 3 ; ... -'1BPMx4 ' 'SR01BPM04:SA_HPOS_MONITOR' 1 '1BPMy4 ' 'SR01BPM04:SA_VPOS_MONITOR' 1 [1,4] 4 ; ... -'1BPMx5 ' 'SR01BPM05:SA_HPOS_MONITOR' 1 '1BPMy5 ' 'SR01BPM05:SA_VPOS_MONITOR' 1 [1,5] 5 ; ... -'1BPMx6 ' 'SR01BPM06:SA_HPOS_MONITOR' 1 '1BPMy6 ' 'SR01BPM06:SA_VPOS_MONITOR' 1 [1,6] 6 ; ... -'1BPMx7 ' 'SR01BPM07:SA_HPOS_MONITOR' 1 '1BPMy7 ' 'SR01BPM07:SA_VPOS_MONITOR' 1 [1,7] 7 ; ... -'2BPMx1 ' 'SR02BPM01:SA_HPOS_MONITOR' 1 '2BPMy1 ' 'SR02BPM01:SA_VPOS_MONITOR' 1 [2,1] 8 ; ... -'2BPMx2 ' 'SR02BPM02:SA_HPOS_MONITOR' 0 '2BPMy2 ' 'SR02BPM02:SA_VPOS_MONITOR' 0 [2,2] 9 ; ... -'2BPMx3 ' 'SR02BPM03:SA_HPOS_MONITOR' 1 '2BPMy3 ' 'SR02BPM03:SA_VPOS_MONITOR' 1 [2,3] 10 ; ... -'2BPMx4 ' 'SR02BPM04:SA_HPOS_MONITOR' 1 '2BPMy4 ' 'SR02BPM04:SA_VPOS_MONITOR' 1 [2,4] 11 ; ... -'2BPMx5 ' 'SR02BPM05:SA_HPOS_MONITOR' 1 '2BPMy5 ' 'SR02BPM05:SA_VPOS_MONITOR' 1 [2,5] 12 ; ... -'2BPMx6 ' 'SR02BPM06:SA_HPOS_MONITOR' 1 '2BPMy6 ' 'SR02BPM06:SA_VPOS_MONITOR' 1 [2,6] 13 ; ... -'2BPMx7 ' 'SR02BPM07:SA_HPOS_MONITOR' 1 '2BPMy7 ' 'SR02BPM07:SA_VPOS_MONITOR' 1 [2,7] 14 ; ... -'3BPMx1 ' 'SR03BPM01:SA_HPOS_MONITOR' 1 '3BPMy1 ' 'SR03BPM01:SA_VPOS_MONITOR' 1 [3,1] 15 ; ... -'3BPMx2 ' 'SR03BPM02:SA_HPOS_MONITOR' 1 '3BPMy2 ' 'SR03BPM02:SA_VPOS_MONITOR' 1 [3,2] 16 ; ... -'3BPMx3 ' 'SR03BPM03:SA_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:SA_VPOS_MONITOR' 1 [3,3] 17 ; ... -'3BPMx4 ' 'SR03BPM04:SA_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:SA_VPOS_MONITOR' 1 [3,4] 18 ; ... -'3BPMx5 ' 'SR03BPM05:SA_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:SA_VPOS_MONITOR' 1 [3,5] 19 ; ... -'3BPMx6 ' 'SR03BPM06:SA_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:SA_VPOS_MONITOR' 1 [3,6] 20 ; ... -'3BPMx7 ' 'SR03BPM07:SA_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:SA_VPOS_MONITOR' 1 [3,7] 21 ; ... -'4BPMx1 ' 'SR04BPM01:SA_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:SA_VPOS_MONITOR' 1 [4,1] 22 ; ... -'4BPMx2 ' 'SR04BPM02:SA_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:SA_VPOS_MONITOR' 1 [4,2] 23 ; ... -'4BPMx3 ' 'SR04BPM03:SA_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:SA_VPOS_MONITOR' 1 [4,3] 24 ; ... -'4BPMx4 ' 'SR04BPM04:SA_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:SA_VPOS_MONITOR' 1 [4,4] 25 ; ... -'4BPMx5 ' 'SR04BPM05:SA_HPOS_MONITOR' 0 '4BPMy5 ' 'SR04BPM05:SA_VPOS_MONITOR' 0 [4,5] 26 ; ... -'4BPMx6 ' 'SR04BPM06:SA_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:SA_VPOS_MONITOR' 1 [4,6] 27 ; ... -'4BPMx7 ' 'SR04BPM07:SA_HPOS_MONITOR' 0 '4BPMy7 ' 'SR04BPM07:SA_VPOS_MONITOR' 0 [4,7] 28 ; ... -'5BPMx1 ' 'SR05BPM01:SA_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:SA_VPOS_MONITOR' 1 [5,1] 29 ; ... -'5BPMx2 ' 'SR05BPM02:SA_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:SA_VPOS_MONITOR' 1 [5,2] 30 ; ... -'5BPMx3 ' 'SR05BPM03:SA_HPOS_MONITOR' 0 '5BPMy3 ' 'SR05BPM03:SA_VPOS_MONITOR' 0 [5,3] 31 ; ... -'5BPMx4 ' 'SR05BPM04:SA_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:SA_VPOS_MONITOR' 1 [5,4] 32 ; ... -'5BPMx5 ' 'SR05BPM05:SA_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:SA_VPOS_MONITOR' 1 [5,5] 33 ; ... -'5BPMx6 ' 'SR05BPM06:SA_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:SA_VPOS_MONITOR' 1 [5,6] 34 ; ... -'5BPMx7 ' 'SR05BPM07:SA_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:SA_VPOS_MONITOR' 1 [5,7] 35 ; ... -'6BPMx1 ' 'SR06BPM01:SA_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:SA_VPOS_MONITOR' 1 [6,1] 36 ; ... -'6BPMx2 ' 'SR06BPM02:SA_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:SA_VPOS_MONITOR' 1 [6,2] 37 ; ... -'6BPMx3 ' 'SR06BPM03:SA_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:SA_VPOS_MONITOR' 1 [6,3] 38 ; ... -'6BPMx4 ' 'SR06BPM04:SA_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:SA_VPOS_MONITOR' 1 [6,4] 39 ; ... -'6BPMx5 ' 'SR06BPM05:SA_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:SA_VPOS_MONITOR' 1 [6,5] 40 ; ... -'6BPMx6 ' 'SR06BPM06:SA_HPOS_MONITOR' 0 '6BPMy6 ' 'SR06BPM06:SA_VPOS_MONITOR' 0 [6,6] 41 ; ... -'6BPMx7 ' 'SR06BPM07:SA_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:SA_VPOS_MONITOR' 1 [6,7] 42 ; ... -'7BPMx1 ' 'SR07BPM01:SA_HPOS_MONITOR' 0 '7BPMy1 ' 'SR07BPM01:SA_VPOS_MONITOR' 0 [7,1] 43 ; ... -'7BPMx2 ' 'SR07BPM02:SA_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:SA_VPOS_MONITOR' 1 [7,2] 44 ; ... -'7BPMx3 ' 'SR07BPM03:SA_HPOS_MONITOR' 0 '7BPMy3 ' 'SR07BPM03:SA_VPOS_MONITOR' 0 [7,3] 45 ; ... -'7BPMx4 ' 'SR07BPM04:SA_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:SA_VPOS_MONITOR' 1 [7,4] 46 ; ... -'7BPMx5 ' 'SR07BPM05:SA_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:SA_VPOS_MONITOR' 1 [7,5] 47 ; ... -'7BPMx6 ' 'SR07BPM06:SA_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:SA_VPOS_MONITOR' 1 [7,6] 48 ; ... -'7BPMx7 ' 'SR07BPM07:SA_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:SA_VPOS_MONITOR' 1 [7,7] 49 ; ... -'8BPMx1 ' 'SR08BPM01:SA_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:SA_VPOS_MONITOR' 1 [8,1] 50 ; ... -'8BPMx2 ' 'SR08BPM02:SA_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:SA_VPOS_MONITOR' 1 [8,2] 51 ; ... -'8BPMx3 ' 'SR08BPM03:SA_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:SA_VPOS_MONITOR' 1 [8,3] 52 ; ... -'8BPMx4 ' 'SR08BPM04:SA_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:SA_VPOS_MONITOR' 1 [8,4] 53 ; ... -'8BPMx5 ' 'SR08BPM05:SA_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:SA_VPOS_MONITOR' 1 [8,5] 54 ; ... -'8BPMx6 ' 'SR08BPM06:SA_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:SA_VPOS_MONITOR' 1 [8,6] 55 ; ... -'8BPMx7 ' 'SR08BPM07:SA_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:SA_VPOS_MONITOR' 1 [8,7] 56 ; ... -'9BPMx1 ' 'SR09BPM01:SA_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:SA_VPOS_MONITOR' 1 [9,1] 57 ; ... -'9BPMx2 ' 'SR09BPM02:SA_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:SA_VPOS_MONITOR' 1 [9,2] 58 ; ... -'9BPMx3 ' 'SR09BPM03:SA_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:SA_VPOS_MONITOR' 1 [9,3] 59 ; ... -'9BPMx4 ' 'SR09BPM04:SA_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:SA_VPOS_MONITOR' 1 [9,4] 60 ; ... -'9BPMx5 ' 'SR09BPM05:SA_HPOS_MONITOR' 0 '9BPMy5 ' 'SR09BPM05:SA_VPOS_MONITOR' 0 [9,5] 61 ; ... -'9BPMx6 ' 'SR09BPM06:SA_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:SA_VPOS_MONITOR' 1 [9,6] 62 ; ... -'9BPMx7 ' 'SR09BPM07:SA_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:SA_VPOS_MONITOR' 1 [9,7] 63 ; ... -'10BPMx1 ' 'SR10BPM01:SA_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:SA_VPOS_MONITOR' 1 [10,1] 64 ; ... -'10BPMx2 ' 'SR10BPM02:SA_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:SA_VPOS_MONITOR' 1 [10,2] 65 ; ... -'10BPMx3 ' 'SR10BPM03:SA_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:SA_VPOS_MONITOR' 1 [10,3] 66 ; ... -'10BPMx4 ' 'SR10BPM04:SA_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:SA_VPOS_MONITOR' 1 [10,4] 67 ; ... -'10BPMx5 ' 'SR10BPM05:SA_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:SA_VPOS_MONITOR' 1 [10,5] 68 ; ... -'10BPMx6 ' 'SR10BPM06:SA_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:SA_VPOS_MONITOR' 1 [10,6] 69 ; ... -'10BPMx7 ' 'SR10BPM07:SA_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:SA_VPOS_MONITOR' 1 [10,7] 70 ; ... -'11BPMx1 ' 'SR11BPM01:SA_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:SA_VPOS_MONITOR' 1 [11,1] 71 ; ... -'11BPMx2 ' 'SR11BPM02:SA_HPOS_MONITOR' 0 '11BPMy2 ' 'SR11BPM02:SA_VPOS_MONITOR' 0 [11,2] 72 ; ... -'11BPMx3 ' 'SR11BPM03:SA_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:SA_VPOS_MONITOR' 1 [11,3] 73 ; ... -'11BPMx4 ' 'SR11BPM04:SA_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:SA_VPOS_MONITOR' 1 [11,4] 74 ; ... -'11BPMx5 ' 'SR11BPM05:SA_HPOS_MONITOR' 0 '11BPMy5 ' 'SR11BPM05:SA_VPOS_MONITOR' 0 [11,5] 75 ; ... -'11BPMx6 ' 'SR11BPM06:SA_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:SA_VPOS_MONITOR' 1 [11,6] 76 ; ... -'11BPMx7 ' 'SR11BPM07:SA_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:SA_VPOS_MONITOR' 1 [11,7] 77 ; ... -'12BPMx1 ' 'SR12BPM01:SA_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:SA_VPOS_MONITOR' 1 [12,1] 78 ; ... -'12BPMx2 ' 'SR12BPM02:SA_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:SA_VPOS_MONITOR' 1 [12,2] 79 ; ... -'12BPMx3 ' 'SR12BPM03:SA_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:SA_VPOS_MONITOR' 1 [12,3] 80 ; ... -'12BPMx4 ' 'SR12BPM04:SA_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:SA_VPOS_MONITOR' 1 [12,4] 81 ; ... -'12BPMx5 ' 'SR12BPM05:SA_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:SA_VPOS_MONITOR' 1 [12,5] 82 ; ... -'12BPMx6 ' 'SR12BPM06:SA_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:SA_VPOS_MONITOR' 1 [12,6] 83 ; ... -'12BPMx7 ' 'SR12BPM07:SA_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:SA_VPOS_MONITOR' 1 [12,7] 84 ; ... -'13BPMx1 ' 'SR13BPM01:SA_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:SA_VPOS_MONITOR' 1 [13,1] 85 ; ... -'13BPMx2 ' 'SR13BPM02:SA_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:SA_VPOS_MONITOR' 1 [13,2] 86 ; ... -'13BPMx3 ' 'SR13BPM03:SA_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:SA_VPOS_MONITOR' 1 [13,3] 87 ; ... -'13BPMx4 ' 'SR13BPM04:SA_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:SA_VPOS_MONITOR' 1 [13,4] 88 ; ... -'13BPMx5 ' 'SR13BPM05:SA_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:SA_VPOS_MONITOR' 1 [13,5] 89 ; ... -'13BPMx6 ' 'SR13BPM06:SA_HPOS_MONITOR' 0 '13BPMy6 ' 'SR13BPM06:SA_VPOS_MONITOR' 0 [13,6] 90 ; ... -'13BPMx7 ' 'SR13BPM07:SA_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:SA_VPOS_MONITOR' 1 [13,7] 91 ; ... -'14BPMx1 ' 'SR14BPM01:SA_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:SA_VPOS_MONITOR' 1 [14,1] 92 ; ... -'14BPMx2 ' 'SR14BPM02:SA_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:SA_VPOS_MONITOR' 1 [14,2] 93 ; ... -'14BPMx3 ' 'SR14BPM03:SA_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:SA_VPOS_MONITOR' 1 [14,3] 94 ; ... -'14BPMx4 ' 'SR14BPM04:SA_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:SA_VPOS_MONITOR' 1 [14,4] 95 ; ... -'14BPMx5 ' 'SR14BPM05:SA_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:SA_VPOS_MONITOR' 1 [14,5] 96 ; ... -'14BPMx6 ' 'SR14BPM06:SA_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:SA_VPOS_MONITOR' 1 [14,6] 97 ; ... -'14BPMx7 ' 'SR14BPM07:SA_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:SA_VPOS_MONITOR' 1 [14,7] 98 ; ... -}; - -%Load fields from data block -for ii=1:size(bpm,1) -name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; -name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; -name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; -name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; -val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; - AO.BPMy.DeviceList(ii,:) = val; -val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; - AO.BPMy.ElementList(ii,:) = val; - AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1000; - AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1000; -end - - -% % Get sum value from button. Don't need handles and PV namelist as -% % parameters are the same as the 'monitor' subcategory. -% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; -% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; -% AO.BPMx.Sum.HWUnits = 'ADC Counts'; -% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; -% AO.BPMx.Sum.HW2PhysicsParams = 1; -% AO.BPMx.Sum.Physics2HWParams = 1; -% % Get q value from BPMs. Don't need handles and PV namelist. -% AO.BPMx.Q = AO.BPMx.Monitor; -% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; -% AO.BPMx.Q.HWUnits = 'mm'; -% AO.BPMx.Q.PhysicsUnits = 'meter'; -% AO.BPMx.Q.HW2PhysicsParams = 1e-3; -% AO.BPMx.Q.Physics2HWParams = 1000; -% -% % Definition above for horiz0ontal. Replicate for vertical. -% AO.BPMy.Sum = AO.BPMx.Sum; -% AO.BPMy.Q = AO.BPMx.Q; - - - -%============================================= -% First Turn BPM data from Libera -%============================================= -ntbpm=98; -AO.FTx.FamilyName = 'FTx'; dispobject(AO,AO.FTx.FamilyName); -AO.FTx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTx.Monitor.Mode = Mode; -AO.FTx.Monitor.DataType = 'Scalar'; -AO.FTx.Monitor.Units = 'Hardware'; -AO.FTx.Monitor.HWUnits = 'mm'; -AO.FTx.Monitor.PhysicsUnits = 'meter'; - -AO.FTy.FamilyName = 'FTy'; dispobject(AO,AO.FTy.FamilyName); -AO.FTy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTy.Monitor.Mode = Mode; -AO.FTy.Monitor.DataType = 'Scalar'; -AO.FTy.Monitor.Units = 'Hardware'; -AO.FTy.Monitor.HWUnits = 'mm'; -AO.FTy.Monitor.PhysicsUnits = 'meter'; - -% x-name x-chname xstat y-name y-chname ystat DevList Elem -bpm={ -'1FTx1 ' 'SR01BPM01:FT_HPOS_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:FT_VPOS_MONITOR' 1 [1,1] 1 ; ... -'1FTx2 ' 'SR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7 ' 'SR02BPM07:FT_HPOS_MONITOR' 1 '2BPMy7 ' 'SR02BPM07:FT_VPOS_MONITOR' 1 [2,7] 14 ; ... -'3FTx1 ' 'SR03BPM01:FT_HPOS_MONITOR' 1 '3BPMy1 ' 'SR03BPM01:FT_VPOS_MONITOR' 1 [3,1] 15 ; ... -'3FTx2 ' 'SR03BPM02:FT_HPOS_MONITOR' 1 '3BPMy2 ' 'SR03BPM02:FT_VPOS_MONITOR' 1 [3,2] 16 ; ... -'3FTx3 ' 'SR03BPM03:FT_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:FT_VPOS_MONITOR' 1 [3,3] 17 ; ... -'3FTx4 ' 'SR03BPM04:FT_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:FT_VPOS_MONITOR' 1 [3,4] 18 ; ... -'3FTx5 ' 'SR03BPM05:FT_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:FT_VPOS_MONITOR' 1 [3,5] 19 ; ... -'3FTx6 ' 'SR03BPM06:FT_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:FT_VPOS_MONITOR' 1 [3,6] 20 ; ... -'3FTx7 ' 'SR03BPM07:FT_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:FT_VPOS_MONITOR' 1 [3,7] 21 ; ... -'4FTx1 ' 'SR04BPM01:FT_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:FT_VPOS_MONITOR' 1 [4,1] 22 ; ... -'4FTx2 ' 'SR04BPM02:FT_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:FT_VPOS_MONITOR' 1 [4,2] 23 ; ... -'4FTx3 ' 'SR04BPM03:FT_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:FT_VPOS_MONITOR' 1 [4,3] 24 ; ... -'4FTx4 ' 'SR04BPM04:FT_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:FT_VPOS_MONITOR' 1 [4,4] 25 ; ... -'4FTx5 ' 'SR04BPM05:FT_HPOS_MONITOR' 1 '4BPMy5 ' 'SR04BPM05:FT_VPOS_MONITOR' 1 [4,5] 26 ; ... -'4FTx6 ' 'SR04BPM06:FT_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:FT_VPOS_MONITOR' 1 [4,6] 27 ; ... -'4FTx7 ' 'SR04BPM07:FT_HPOS_MONITOR' 1 '4BPMy7 ' 'SR04BPM07:FT_VPOS_MONITOR' 1 [4,7] 28 ; ... -'5FTx1 ' 'SR05BPM01:FT_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:FT_VPOS_MONITOR' 1 [5,1] 29 ; ... -'5FTx2 ' 'SR05BPM02:FT_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:FT_VPOS_MONITOR' 1 [5,2] 30 ; ... -'5FTx3 ' 'SR05BPM03:FT_HPOS_MONITOR' 1 '5BPMy3 ' 'SR05BPM03:FT_VPOS_MONITOR' 1 [5,3] 31 ; ... -'5FTx4 ' 'SR05BPM04:FT_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:FT_VPOS_MONITOR' 1 [5,4] 32 ; ... -'5FTx5 ' 'SR05BPM05:FT_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:FT_VPOS_MONITOR' 1 [5,5] 33 ; ... -'5FTx6 ' 'SR05BPM06:FT_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:FT_VPOS_MONITOR' 1 [5,6] 34 ; ... -'5FTx7 ' 'SR05BPM07:FT_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:FT_VPOS_MONITOR' 1 [5,7] 35 ; ... -'6FTx1 ' 'SR06BPM01:FT_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:FT_VPOS_MONITOR' 1 [6,1] 36 ; ... -'6FTx2 ' 'SR06BPM02:FT_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:FT_VPOS_MONITOR' 1 [6,2] 37 ; ... -'6FTx3 ' 'SR06BPM03:FT_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:FT_VPOS_MONITOR' 1 [6,3] 38 ; ... -'6FTx4 ' 'SR06BPM04:FT_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:FT_VPOS_MONITOR' 1 [6,4] 39 ; ... -'6FTx5 ' 'SR06BPM05:FT_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:FT_VPOS_MONITOR' 1 [6,5] 40 ; ... -'6FTx6 ' 'SR06BPM06:FT_HPOS_MONITOR' 1 '6BPMy6 ' 'SR06BPM06:FT_VPOS_MONITOR' 1 [6,6] 41 ; ... -'6FTx7 ' 'SR06BPM07:FT_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:FT_VPOS_MONITOR' 1 [6,7] 42 ; ... -'7FTx1 ' 'SR07BPM01:FT_HPOS_MONITOR' 1 '7BPMy1 ' 'SR07BPM01:FT_VPOS_MONITOR' 1 [7,1] 43 ; ... -'7FTx2 ' 'SR07BPM02:FT_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:FT_VPOS_MONITOR' 1 [7,2] 44 ; ... -'7FTx3 ' 'SR07BPM03:FT_HPOS_MONITOR' 1 '7BPMy3 ' 'SR07BPM03:FT_VPOS_MONITOR' 1 [7,3] 45 ; ... -'7FTx4 ' 'SR07BPM04:FT_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:FT_VPOS_MONITOR' 1 [7,4] 46 ; ... -'7FTx5 ' 'SR07BPM05:FT_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:FT_VPOS_MONITOR' 1 [7,5] 47 ; ... -'7FTx6 ' 'SR07BPM06:FT_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:FT_VPOS_MONITOR' 1 [7,6] 48 ; ... -'7FTx7 ' 'SR07BPM07:FT_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:FT_VPOS_MONITOR' 1 [7,7] 49 ; ... -'8FTx1 ' 'SR08BPM01:FT_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:FT_VPOS_MONITOR' 1 [8,1] 50 ; ... -'8FTx2 ' 'SR08BPM02:FT_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:FT_VPOS_MONITOR' 1 [8,2] 51 ; ... -'8FTx3 ' 'SR08BPM03:FT_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:FT_VPOS_MONITOR' 1 [8,3] 52 ; ... -'8FTx4 ' 'SR08BPM04:FT_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:FT_VPOS_MONITOR' 1 [8,4] 53 ; ... -'8FTx5 ' 'SR08BPM05:FT_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:FT_VPOS_MONITOR' 1 [8,5] 54 ; ... -'8FTx6 ' 'SR08BPM06:FT_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:FT_VPOS_MONITOR' 1 [8,6] 55 ; ... -'8FTx7 ' 'SR08BPM07:FT_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:FT_VPOS_MONITOR' 1 [8,7] 56 ; ... -'9FTx1 ' 'SR09BPM01:FT_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:FT_VPOS_MONITOR' 1 [9,1] 57 ; ... -'9FTx2 ' 'SR09BPM02:FT_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:FT_VPOS_MONITOR' 1 [9,2] 58 ; ... -'9FTx3 ' 'SR09BPM03:FT_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:FT_VPOS_MONITOR' 1 [9,3] 59 ; ... -'9FTx4 ' 'SR09BPM04:FT_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:FT_VPOS_MONITOR' 1 [9,4] 60 ; ... -'9FTx5 ' 'SR09BPM05:FT_HPOS_MONITOR' 1 '9BPMy5 ' 'SR09BPM05:FT_VPOS_MONITOR' 1 [9,5] 61 ; ... -'9FTx6 ' 'SR09BPM06:FT_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:FT_VPOS_MONITOR' 1 [9,6] 62 ; ... -'9FTx7 ' 'SR09BPM07:FT_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:FT_VPOS_MONITOR' 1 [9,7] 63 ; ... -'10FTx1 ' 'SR10BPM01:FT_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:FT_VPOS_MONITOR' 1 [10,1] 64 ; ... -'10FTx2 ' 'SR10BPM02:FT_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:FT_VPOS_MONITOR' 1 [10,2] 65 ; ... -'10FTx3 ' 'SR10BPM03:FT_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:FT_VPOS_MONITOR' 1 [10,3] 66 ; ... -'10FTx4 ' 'SR10BPM04:FT_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:FT_VPOS_MONITOR' 1 [10,4] 67 ; ... -'10FTx5 ' 'SR10BPM05:FT_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:FT_VPOS_MONITOR' 1 [10,5] 68 ; ... -'10FTx6 ' 'SR10BPM06:FT_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:FT_VPOS_MONITOR' 1 [10,6] 69 ; ... -'10FTx7 ' 'SR10BPM07:FT_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:FT_VPOS_MONITOR' 1 [10,7] 70 ; ... -'11FTx1 ' 'SR11BPM01:FT_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:FT_VPOS_MONITOR' 1 [11,1] 71 ; ... -'11FTx2 ' 'SR11BPM02:FT_HPOS_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:FT_VPOS_MONITOR' 1 [11,2] 72 ; ... -'11FTx3 ' 'SR11BPM03:FT_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:FT_VPOS_MONITOR' 1 [11,3] 73 ; ... -'11FTx4 ' 'SR11BPM04:FT_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:FT_VPOS_MONITOR' 1 [11,4] 74 ; ... -'11FTx5 ' 'SR11BPM05:FT_HPOS_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:FT_VPOS_MONITOR' 1 [11,5] 75 ; ... -'11FTx6 ' 'SR11BPM06:FT_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:FT_VPOS_MONITOR' 1 [11,6] 76 ; ... -'11FTx7 ' 'SR11BPM07:FT_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:FT_VPOS_MONITOR' 1 [11,7] 77 ; ... -'12FTx1 ' 'SR12BPM01:FT_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:FT_VPOS_MONITOR' 1 [12,1] 78 ; ... -'12FTx2 ' 'SR12BPM02:FT_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:FT_VPOS_MONITOR' 1 [12,2] 79 ; ... -'12FTx3 ' 'SR12BPM03:FT_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:FT_VPOS_MONITOR' 1 [12,3] 80 ; ... -'12FTx4 ' 'SR12BPM04:FT_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:FT_VPOS_MONITOR' 1 [12,4] 81 ; ... -'12FTx5 ' 'SR12BPM05:FT_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:FT_VPOS_MONITOR' 1 [12,5] 82 ; ... -'12FTx6 ' 'SR12BPM06:FT_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:FT_VPOS_MONITOR' 1 [12,6] 83 ; ... -'12FTx7 ' 'SR12BPM07:FT_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:FT_VPOS_MONITOR' 1 [12,7] 84 ; ... -'13FTx1 ' 'SR13BPM01:FT_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:FT_VPOS_MONITOR' 1 [13,1] 85 ; ... -'13FTx2 ' 'SR13BPM02:FT_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:FT_VPOS_MONITOR' 1 [13,2] 86 ; ... -'13FTx3 ' 'SR13BPM03:FT_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:FT_VPOS_MONITOR' 1 [13,3] 87 ; ... -'13FTx4 ' 'SR13BPM04:FT_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:FT_VPOS_MONITOR' 1 [13,4] 88 ; ... -'13FTx5 ' 'SR13BPM05:FT_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:FT_VPOS_MONITOR' 1 [13,5] 89 ; ... -'13FTx6 ' 'SR13BPM06:FT_HPOS_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:FT_VPOS_MONITOR' 1 [13,6] 90 ; ... -'13FTx7 ' 'SR13BPM07:FT_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:FT_VPOS_MONITOR' 1 [13,7] 91 ; ... -'14FTx1 ' 'SR14BPM01:FT_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:FT_VPOS_MONITOR' 1 [14,1] 92 ; ... -'14FTx2 ' 'SR14BPM02:FT_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:FT_VPOS_MONITOR' 1 [14,2] 93 ; ... -'14FTx3 ' 'SR14BPM03:FT_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:FT_VPOS_MONITOR' 1 [14,3] 94 ; ... -'14FTx4 ' 'SR14BPM04:FT_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:FT_VPOS_MONITOR' 1 [14,4] 95 ; ... -'14FTx5 ' 'SR14BPM05:FT_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:FT_VPOS_MONITOR' 1 [14,5] 96 ; ... -'14FTx6 ' 'SR14BPM06:FT_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:FT_VPOS_MONITOR' 1 [14,6] 97 ; ... -'14FTx7 ' 'SR14BPM07:FT_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:FT_VPOS_MONITOR' 1 [14,7] 98 ; ... -}; - -%Load fields from data block -for ii=1:size(bpm,1) -name=bpm{ii,1}; AO.FTx.CommonNames(ii,:) = name; -name=bpm{ii,2}; AO.FTx.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,3}; AO.FTx.Status(ii,:) = val; -name=bpm{ii,4}; AO.FTy.CommonNames(ii,:) = name; -name=bpm{ii,5}; AO.FTy.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,6}; AO.FTy.Status(ii,:) = val; -val =bpm{ii,7}; AO.FTx.DeviceList(ii,:) = val; - AO.FTy.DeviceList(ii,:) = val; -val =bpm{ii,8}; AO.FTx.ElementList(ii,:) = val; - AO.FTy.ElementList(ii,:) = val; - AO.FTx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.FTx.Monitor.Physics2HWParams(ii,:) = 1000; - AO.FTy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.FTy.Monitor.Physics2HWParams(ii,:) = 1000; -end -AO.FTx.Status = AO.BPMx.Status; -AO.FTy.Status = AO.BPMy.Status; - -AO.FTsum = AO.FTx; -AO.FTsum.FamilyName = 'FTsum'; dispobject(AO,AO.FTsum.FamilyName); -AO.FTsum.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTsum.Monitor.Mode = 'Special'; -AO.FTsum.Monitor.Units = 'Hardware'; -AO.FTsum.Monitor.DataType = 'Scalar'; -AO.FTsum.Monitor.SpecialFunction = 'getftsum'; -AO.FTsum.Monitor.HWUnits = 'ADC counts'; -AO.FTsum.Monitor.PhysicsUnits = 'ADC counts'; -AO.FTsum.Monitor.HW2PhysicsParams(:) = 1; -AO.FTsum.Monitor.Physics2HWParams(:) = 1; - - -% % Get sum value from button. Don't need handles and PV namelist as -% % parameters are the same as the 'monitor' subcategory. -AO.FTx.Off.Mode = 'Special'; -AO.FTx.Off.Units = 'Hardware'; -AO.FTx.Off.DataType = 'Scalar'; -AO.FTx.Off.SpecialFunction = 'getftoffset'; -AO.FTx.Off.SpecialFunctionSet = 'setftoffset'; -AO.FTx.Off.HWUnits = '32ns samples'; -AO.FTx.Off.PhysicsUnits = '32ns samples'; -AO.FTx.Off.HW2PhysicsParams = 1; -AO.FTx.Off.Physics2HWParams = 1; - -AO.FTx.Length.Mode = 'Special'; -AO.FTx.Length.Units = 'Hardware'; -AO.FTx.Length.DataType = 'Scalar'; -AO.FTx.Length.SpecialFunction = 'getftlength'; -AO.FTx.Length.SpecialFunctionSet = 'setftlength'; -AO.FTx.Length.HWUnits = '32ns samples'; -AO.FTx.Length.PhysicsUnits = '32ns samples'; -AO.FTx.Length.HW2PhysicsParams = 1; -AO.FTx.Length.Physics2HWParams = 1; - -AO.FTx.Maxadc.Mode = 'Special'; -AO.FTx.Maxadc.Units = 'Hardware'; -AO.FTx.Maxadc.DataType = 'Scalar'; -AO.FTx.Maxadc.SpecialFunction = 'getftmaxadc'; -AO.FTx.Maxadc.HWUnits = 'ADC counts'; -AO.FTx.Maxadc.PhysicsUnits = 'ADC counts'; -AO.FTx.Maxadc.HW2PhysicsParams = 1; -AO.FTx.Maxadc.Physics2HWParams = 1; - -% AO.FTx.Sum.Mode = 'Special'; -% AO.FTx.Sum.Units = 'Hardware'; -% AO.FTx.Sum.DataType = 'Scalar'; -% AO.FTx.Sum.SpecialFunction = 'getftsum'; -% AO.FTx.Sum.HWUnits = 'ADC counts'; -% AO.FTx.Sum.PhysicsUnits = 'ADC counts'; -% AO.FTx.Sum.HW2PhysicsParams = 1; -% AO.FTx.Sum.Physics2HWParams = 1; - - -%=========================================================== -% Corrector data: status field designates if corrector in use -% ASP corrector coils wound into sextupoles. Not dynamic correctors. -%=========================================================== - -AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); -AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'}; - -AO.HCM.Monitor.Mode = Mode; -AO.HCM.Monitor.DataType = 'Scalar'; -AO.HCM.Monitor.Units = 'Hardware'; -AO.HCM.Monitor.HWUnits = 'ampere'; -AO.HCM.Monitor.PhysicsUnits = 'radian'; -AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.HCM.Monitor.Physics2HWFcn = @k2amp; - -AO.HCM.Setpoint.Mode = Mode; -AO.HCM.Setpoint.DataType = 'Scalar'; -AO.HCM.Setpoint.Units = 'Hardware'; -AO.HCM.Setpoint.HWUnits = 'ampere'; -AO.HCM.Setpoint.PhysicsUnits = 'radian'; -AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.HCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian. Respmat settings below AO definitions. -% x-common x-monitor x-setpoint stat devlist elem tol -cor={ -'1HCM1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... -'1HCM2 ' 'SR01CPS05:CURRENT_MONITOR' 'SR01CPS05:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... -'1HCM3 ' 'SR01CPS09:CURRENT_MONITOR' 'SR01CPS09:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... -'2HCM1 ' 'SR02CPS01:CURRENT_MONITOR' 'SR02CPS01:CURRENT_SP ' 1 [2,1] 4 1.000 ; ... -'2HCM2 ' 'SR02CPS05:CURRENT_MONITOR' 'SR02CPS05:CURRENT_SP ' 1 [2,2] 5 1.000 ; ... -'2HCM3 ' 'SR02CPS09:CURRENT_MONITOR' 'SR02CPS09:CURRENT_SP ' 1 [2,3] 6 1.000 ; ... -'3HCM1 ' 'SR03CPS01:CURRENT_MONITOR' 'SR03CPS01:CURRENT_SP ' 1 [3,1] 7 1.000 ; ... -'3HCM2 ' 'SR03CPS05:CURRENT_MONITOR' 'SR03CPS05:CURRENT_SP ' 1 [3,2] 8 1.000 ; ... -'3HCM3 ' 'SR03CPS09:CURRENT_MONITOR' 'SR03CPS09:CURRENT_SP ' 1 [3,3] 9 1.000 ; ... -'4HCM1 ' 'SR04CPS01:CURRENT_MONITOR' 'SR04CPS01:CURRENT_SP ' 1 [4,1] 10 1.000 ; ... -'4HCM2 ' 'SR04CPS05:CURRENT_MONITOR' 'SR04CPS05:CURRENT_SP ' 1 [4,2] 11 1.000 ; ... -'4HCM3 ' 'SR04CPS09:CURRENT_MONITOR' 'SR04CPS09:CURRENT_SP ' 1 [4,3] 12 1.000 ; ... -'5HCM1 ' 'SR05CPS01:CURRENT_MONITOR' 'SR05CPS01:CURRENT_SP ' 1 [5,1] 13 1.000 ; ... -'5HCM2 ' 'SR05CPS05:CURRENT_MONITOR' 'SR05CPS05:CURRENT_SP ' 1 [5,2] 14 1.000 ; ... -'5HCM3 ' 'SR05CPS09:CURRENT_MONITOR' 'SR05CPS09:CURRENT_SP ' 1 [5,3] 15 1.000 ; ... -'6HCM1 ' 'SR06CPS01:CURRENT_MONITOR' 'SR06CPS01:CURRENT_SP ' 1 [6,1] 16 1.000 ; ... -'6HCM2 ' 'SR06CPS05:CURRENT_MONITOR' 'SR06CPS05:CURRENT_SP ' 1 [6,2] 17 1.000 ; ... -'6HCM3 ' 'SR06CPS09:CURRENT_MONITOR' 'SR06CPS09:CURRENT_SP ' 1 [6,3] 18 1.000 ; ... -'7HCM1 ' 'SR07CPS01:CURRENT_MONITOR' 'SR07CPS01:CURRENT_SP ' 1 [7,1] 19 1.000 ; ... -'7HCM2 ' 'SR07CPS05:CURRENT_MONITOR' 'SR07CPS05:CURRENT_SP ' 1 [7,2] 20 1.000 ; ... -'7HCM3 ' 'SR07CPS09:CURRENT_MONITOR' 'SR07CPS09:CURRENT_SP ' 1 [7,3] 21 1.000 ; ... -'8HCM1 ' 'SR08CPS01:CURRENT_MONITOR' 'SR08CPS01:CURRENT_SP ' 1 [8,1] 22 1.000 ; ... -'8HCM2 ' 'SR08CPS05:CURRENT_MONITOR' 'SR08CPS05:CURRENT_SP ' 1 [8,2] 23 1.000 ; ... -'8HCM3 ' 'SR08CPS09:CURRENT_MONITOR' 'SR08CPS09:CURRENT_SP ' 1 [8,3] 24 1.000 ; ... -'9HCM1 ' 'SR09CPS01:CURRENT_MONITOR' 'SR09CPS01:CURRENT_SP ' 1 [9,1] 25 1.000 ; ... -'9HCM2 ' 'SR09CPS05:CURRENT_MONITOR' 'SR09CPS05:CURRENT_SP ' 1 [9,2] 26 1.000 ; ... -'9HCM3 ' 'SR09CPS09:CURRENT_MONITOR' 'SR09CPS09:CURRENT_SP ' 1 [9,3] 27 1.000 ; ... -'10HCM1 ' 'SR10CPS01:CURRENT_MONITOR' 'SR10CPS01:CURRENT_SP ' 1 [10,1] 28 1.000 ; ... -'10HCM2 ' 'SR10CPS05:CURRENT_MONITOR' 'SR10CPS05:CURRENT_SP ' 1 [10,2] 29 1.000 ; ... -'10HCM3 ' 'SR10CPS09:CURRENT_MONITOR' 'SR10CPS09:CURRENT_SP ' 1 [10,3] 30 1.000 ; ... -'11HCM1 ' 'SR11CPS01:CURRENT_MONITOR' 'SR11CPS01:CURRENT_SP ' 1 [11,1] 31 1.000 ; ... -'11HCM2 ' 'SR11CPS05:CURRENT_MONITOR' 'SR11CPS05:CURRENT_SP ' 1 [11,2] 32 1.000 ; ... -'11HCM3 ' 'SR11CPS09:CURRENT_MONITOR' 'SR11CPS09:CURRENT_SP ' 1 [11,3] 33 1.000 ; ... -'12HCM1 ' 'SR12CPS01:CURRENT_MONITOR' 'SR12CPS01:CURRENT_SP ' 1 [12,1] 34 1.000 ; ... -'12HCM2 ' 'SR12CPS05:CURRENT_MONITOR' 'SR12CPS05:CURRENT_SP ' 1 [12,2] 35 1.000 ; ... -'12HCM3 ' 'SR12CPS09:CURRENT_MONITOR' 'SR12CPS09:CURRENT_SP ' 1 [12,3] 36 1.000 ; ... -'13HCM1 ' 'SR13CPS01:CURRENT_MONITOR' 'SR13CPS01:CURRENT_SP ' 1 [13,1] 37 1.000 ; ... -'13HCM2 ' 'SR13CPS05:CURRENT_MONITOR' 'SR13CPS05:CURRENT_SP ' 1 [13,2] 38 1.000 ; ... -'13HCM3 ' 'SR13CPS09:CURRENT_MONITOR' 'SR13CPS09:CURRENT_SP ' 1 [13,3] 39 1.000 ; ... -'14HCM1 ' 'SR14CPS01:CURRENT_MONITOR' 'SR14CPS01:CURRENT_SP ' 1 [14,1] 40 1.000 ; ... -'14HCM2 ' 'SR14CPS05:CURRENT_MONITOR' 'SR14CPS05:CURRENT_SP ' 1 [14,2] 41 1.000 ; ... -'14HCM3 ' 'SR14CPS09:CURRENT_MONITOR' 'SR14CPS09:CURRENT_SP ' 1 [14,3] 42 1.000 ; ... -}; - -[C, Leff, MagnetType] = magnetcoefficients('HCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.HCM.Status(ii,1) = val; -val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; - -AO.HCM.Setpoint.Range(ii,:) = [-90 +90]; -AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); -AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'}; - -AO.VCM.Monitor.Mode = Mode; -AO.VCM.Monitor.DataType = 'Scalar'; -AO.VCM.Monitor.Units = 'Hardware'; -AO.VCM.Monitor.HWUnits = 'ampere'; -AO.VCM.Monitor.PhysicsUnits = 'radian'; -AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.VCM.Monitor.Physics2HWFcn = @k2amp; - -AO.VCM.Setpoint.Mode = Mode; -AO.VCM.Setpoint.DataType = 'Scalar'; -AO.VCM.Setpoint.Units = 'Hardware'; -AO.VCM.Setpoint.HWUnits = 'ampere'; -AO.VCM.Setpoint.PhysicsUnits = 'radian'; -AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.VCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian ** radian units converted to ampere below *** -% y-common y-monitor y-setpoint stat devlist elem -cor={ -'1VCM1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... -'1VCM2 ' 'SR01CPS04:CURRENT_MONITOR' 'SR01CPS04:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... -'1VCM3 ' 'SR01CPS06:CURRENT_MONITOR' 'SR01CPS06:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... -'1VCM4 ' 'SR01CPS07:CURRENT_MONITOR' 'SR01CPS07:CURRENT_SP ' 1 [1,4] 4 1.000 ; ... -'2VCM1 ' 'SR02CPS02:CURRENT_MONITOR' 'SR02CPS02:CURRENT_SP ' 1 [2,1] 5 1.000 ; ... -'2VCM2 ' 'SR02CPS04:CURRENT_MONITOR' 'SR02CPS04:CURRENT_SP ' 1 [2,2] 6 1.000 ; ... -'2VCM3 ' 'SR02CPS06:CURRENT_MONITOR' 'SR02CPS06:CURRENT_SP ' 1 [2,3] 7 1.000 ; ... -'2VCM4 ' 'SR02CPS07:CURRENT_MONITOR' 'SR02CPS07:CURRENT_SP ' 1 [2,4] 8 1.000 ; ... -'3VCM1 ' 'SR03CPS02:CURRENT_MONITOR' 'SR03CPS02:CURRENT_SP ' 1 [3,1] 9 1.000 ; ... -'3VCM2 ' 'SR03CPS04:CURRENT_MONITOR' 'SR03CPS04:CURRENT_SP ' 1 [3,2] 10 1.000 ; ... -'3VCM3 ' 'SR03CPS06:CURRENT_MONITOR' 'SR03CPS06:CURRENT_SP ' 1 [3,3] 11 1.000 ; ... -'3VCM4 ' 'SR03CPS07:CURRENT_MONITOR' 'SR03CPS07:CURRENT_SP ' 1 [3,4] 12 1.000 ; ... -'4VCM1 ' 'SR04CPS02:CURRENT_MONITOR' 'SR04CPS02:CURRENT_SP ' 1 [4,1] 13 1.000 ; ... -'4VCM2 ' 'SR04CPS04:CURRENT_MONITOR' 'SR04CPS04:CURRENT_SP ' 1 [4,2] 14 1.000 ; ... -'4VCM3 ' 'SR04CPS06:CURRENT_MONITOR' 'SR04CPS06:CURRENT_SP ' 1 [4,3] 15 1.000 ; ... -'4VCM4 ' 'SR04CPS07:CURRENT_MONITOR' 'SR04CPS07:CURRENT_SP ' 1 [4,4] 16 1.000 ; ... -'5VCM1 ' 'SR05CPS02:CURRENT_MONITOR' 'SR05CPS02:CURRENT_SP ' 1 [5,1] 17 1.000 ; ... -'5VCM2 ' 'SR05CPS04:CURRENT_MONITOR' 'SR05CPS04:CURRENT_SP ' 1 [5,2] 18 1.000 ; ... -'5VCM3 ' 'SR05CPS06:CURRENT_MONITOR' 'SR05CPS06:CURRENT_SP ' 1 [5,3] 19 1.000 ; ... -'5VCM4 ' 'SR05CPS07:CURRENT_MONITOR' 'SR05CPS07:CURRENT_SP ' 1 [5,4] 20 1.000 ; ... -'6VCM1 ' 'SR06CPS02:CURRENT_MONITOR' 'SR06CPS02:CURRENT_SP ' 1 [6,1] 21 1.000 ; ... -'6VCM2 ' 'SR06CPS04:CURRENT_MONITOR' 'SR06CPS04:CURRENT_SP ' 1 [6,2] 22 1.000 ; ... -'6VCM3 ' 'SR06CPS06:CURRENT_MONITOR' 'SR06CPS06:CURRENT_SP ' 1 [6,3] 23 1.000 ; ... -'6VCM4 ' 'SR06CPS07:CURRENT_MONITOR' 'SR06CPS07:CURRENT_SP ' 1 [6,4] 24 1.000 ; ... -'7VCM1 ' 'SR07CPS02:CURRENT_MONITOR' 'SR07CPS02:CURRENT_SP ' 1 [7,1] 25 1.000 ; ... -'7VCM2 ' 'SR07CPS04:CURRENT_MONITOR' 'SR07CPS04:CURRENT_SP ' 1 [7,2] 26 1.000 ; ... -'7VCM3 ' 'SR07CPS06:CURRENT_MONITOR' 'SR07CPS06:CURRENT_SP ' 1 [7,3] 27 1.000 ; ... -'7VCM4 ' 'SR07CPS07:CURRENT_MONITOR' 'SR07CPS07:CURRENT_SP ' 1 [7,4] 28 1.000 ; ... -'8VCM1 ' 'SR08CPS02:CURRENT_MONITOR' 'SR08CPS02:CURRENT_SP ' 1 [8,1] 29 1.000 ; ... -'8VCM2 ' 'SR08CPS04:CURRENT_MONITOR' 'SR08CPS04:CURRENT_SP ' 1 [8,2] 30 1.000 ; ... -'8VCM3 ' 'SR08CPS06:CURRENT_MONITOR' 'SR08CPS06:CURRENT_SP ' 1 [8,3] 31 1.000 ; ... -'8VCM4 ' 'SR08CPS07:CURRENT_MONITOR' 'SR08CPS07:CURRENT_SP ' 1 [8,4] 32 1.000 ; ... -'9VCM1 ' 'SR09CPS02:CURRENT_MONITOR' 'SR09CPS02:CURRENT_SP ' 1 [9,1] 33 1.000 ; ... -'9VCM2 ' 'SR09CPS04:CURRENT_MONITOR' 'SR09CPS04:CURRENT_SP ' 1 [9,2] 34 1.000 ; ... -'9VCM3 ' 'SR09CPS06:CURRENT_MONITOR' 'SR09CPS06:CURRENT_SP ' 1 [9,3] 35 1.000 ; ... -'9VCM4 ' 'SR09CPS07:CURRENT_MONITOR' 'SR09CPS07:CURRENT_SP ' 1 [9,4] 36 1.000 ; ... -'10VCM1 ' 'SR10CPS02:CURRENT_MONITOR' 'SR10CPS02:CURRENT_SP ' 1 [10,1] 37 1.000 ; ... -'10VCM2 ' 'SR10CPS04:CURRENT_MONITOR' 'SR10CPS04:CURRENT_SP ' 1 [10,2] 38 1.000 ; ... -'10VCM3 ' 'SR10CPS06:CURRENT_MONITOR' 'SR10CPS06:CURRENT_SP ' 1 [10,3] 39 1.000 ; ... -'10VCM4 ' 'SR10CPS07:CURRENT_MONITOR' 'SR10CPS07:CURRENT_SP ' 1 [10,4] 40 1.000 ; ... -'11VCM1 ' 'SR11CPS02:CURRENT_MONITOR' 'SR11CPS02:CURRENT_SP ' 1 [11,1] 41 1.000 ; ... -'11VCM2 ' 'SR11CPS04:CURRENT_MONITOR' 'SR11CPS04:CURRENT_SP ' 1 [11,2] 42 1.000 ; ... -'11VCM3 ' 'SR11CPS06:CURRENT_MONITOR' 'SR11CPS06:CURRENT_SP ' 1 [11,3] 43 1.000 ; ... -'11VCM4 ' 'SR11CPS07:CURRENT_MONITOR' 'SR11CPS07:CURRENT_SP ' 1 [11,4] 44 1.000 ; ... -'12VCM1 ' 'SR12CPS02:CURRENT_MONITOR' 'SR12CPS02:CURRENT_SP ' 1 [12,1] 45 1.000 ; ... -'12VCM2 ' 'SR12CPS04:CURRENT_MONITOR' 'SR12CPS04:CURRENT_SP ' 1 [12,2] 46 1.000 ; ... -'12VCM3 ' 'SR12CPS06:CURRENT_MONITOR' 'SR12CPS06:CURRENT_SP ' 1 [12,3] 47 1.000 ; ... -'12VCM4 ' 'SR12CPS07:CURRENT_MONITOR' 'SR12CPS07:CURRENT_SP ' 1 [12,4] 48 1.000 ; ... -'13VCM1 ' 'SR13CPS02:CURRENT_MONITOR' 'SR13CPS02:CURRENT_SP ' 1 [13,1] 49 1.000 ; ... -'13VCM2 ' 'SR13CPS04:CURRENT_MONITOR' 'SR13CPS04:CURRENT_SP ' 1 [13,2] 50 1.000 ; ... -'13VCM3 ' 'SR13CPS06:CURRENT_MONITOR' 'SR13CPS06:CURRENT_SP ' 1 [13,3] 51 1.000 ; ... -'13VCM4 ' 'SR13CPS07:CURRENT_MONITOR' 'SR13CPS07:CURRENT_SP ' 1 [13,4] 52 1.000 ; ... -'14VCM1 ' 'SR14CPS02:CURRENT_MONITOR' 'SR14CPS02:CURRENT_SP ' 1 [14,1] 53 1.000 ; ... -'14VCM2 ' 'SR14CPS04:CURRENT_MONITOR' 'SR14CPS04:CURRENT_SP ' 1 [14,2] 54 1.000 ; ... -'14VCM3 ' 'SR14CPS06:CURRENT_MONITOR' 'SR14CPS06:CURRENT_SP ' 1 [14,3] 55 1.000 ; ... -'14VCM4 ' 'SR14CPS07:CURRENT_MONITOR' 'SR14CPS07:CURRENT_SP ' 1 [14,4] 56 1.000 ; ... -}; - -[C, Leff, MagnetType] = magnetcoefficients('VCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.VCM.Status(ii,1) = val; -val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; - -AO.VCM.Setpoint.Range(ii,:) = [-125 +125]; -AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -%============================= -% MAIN MAGNETS -%============================= - -%=========== -%Dipole data -%=========== - -% *** BEND *** -AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); -AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('BEND'); -Physics2HWParams = magnetcoefficients('BEND'); - -AO.BEND.Monitor.Mode = Mode; -AO.BEND.Monitor.DataType = 'Scalar'; -AO.BEND.Monitor.Units = 'Hardware'; -AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? -AO.BEND.Monitor.Physics2HWFcn = @gev2bend; -AO.BEND.Monitor.HWUnits = 'ampere'; -AO.BEND.Monitor.PhysicsUnits = 'energy'; - -AO.BEND.Setpoint.Mode = Mode; -AO.BEND.Setpoint.DataType = 'Scalar'; -AO.BEND.Setpoint.Units = 'Hardware'; -AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; -AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; -AO.BEND.Setpoint.HWUnits = 'ampere'; -AO.BEND.Setpoint.PhysicsUnits = 'energy'; - -% common monitor setpoint stat devlist elem scale tol -bend={ -'1BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.10 ; ... -'1BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,2] 2 1.0 0.10 ; ... -'2BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.10 ; ... -'2BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,2] 4 1.0 0.10 ; ... -'3BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.10 ; ... -'3BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,2] 6 1.0 0.10 ; ... -'4BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.10 ; ... -'4BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,2] 8 1.0 0.10 ; ... -'5BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.10 ; ... -'5BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,2] 10 1.0 0.10 ; ... -'6BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.10 ; ... -'6BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,2] 12 1.0 0.10 ; ... -'7BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.10 ; ... -'7BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,2] 14 1.0 0.10 ; ... -'8BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.10 ; ... -'8BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,2] 16 1.0 0.10 ; ... -'9BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.10 ; ... -'9BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,2] 18 1.0 0.10 ; ... -'10BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.10 ; ... -'10BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,2] 20 1.0 0.10 ; ... -'11BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.10 ; ... -'11BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,2] 22 1.0 0.10 ; ... -'12BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.10 ; ... -'12BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,2] 24 1.0 0.10 ; ... -'13BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.10 ; ... -'13BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,2] 26 1.0 0.10 ; ... -'14BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.10 ; ... -'14BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,2] 28 1.0 0.10 ; ... -}; - -for ii=1:size(bend,1) -name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; -name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; -name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; -val =bend{ii,4}; AO.BEND.Status(ii,1) = val; -val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; -val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; -val =bend{ii,7}; % This is the scale factor -AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; - -AO.BEND.Setpoint.Range(ii,:) = [50 695]; -end - -%=============== -%Quadrupole data -%=============== - -% *** QFA *** -AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); -AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFA'); -Physics2HWParams = magnetcoefficients('QFA'); - -AO.QFA.Monitor.Mode = Mode; -AO.QFA.Monitor.DataType = 'Scalar'; -AO.QFA.Monitor.Units = 'Hardware'; -AO.QFA.Monitor.HWUnits = 'ampere'; -AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFA.Monitor.Physics2HWFcn = @k2amp; - -AO.QFA.Setpoint.Mode = Mode; -AO.QFA.Setpoint.DataType = 'Scalar'; -AO.QFA.Setpoint.Units = 'Hardware'; -AO.QFA.Setpoint.HWUnits = 'ampere'; -AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qfa={ -'1QFA1 ' 'SR01QPS01:CURRENT_MONITOR' 'SR01QPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1QFA2 ' 'SR01QPS06:CURRENT_MONITOR' 'SR01QPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2QFA1 ' 'SR02QPS01:CURRENT_MONITOR' 'SR02QPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2QFA2 ' 'SR02QPS06:CURRENT_MONITOR' 'SR02QPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... -'3QFA1 ' 'SR03QPS01:CURRENT_MONITOR' 'SR03QPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3QFA2 ' 'SR03QPS06:CURRENT_MONITOR' 'SR03QPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4QFA1 ' 'SR04QPS01:CURRENT_MONITOR' 'SR04QPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4QFA2 ' 'SR04QPS06:CURRENT_MONITOR' 'SR04QPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5QFA1 ' 'SR05QPS01:CURRENT_MONITOR' 'SR05QPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5QFA2 ' 'SR05QPS06:CURRENT_MONITOR' 'SR05QPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6QFA1 ' 'SR06QPS01:CURRENT_MONITOR' 'SR06QPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6QFA2 ' 'SR06QPS06:CURRENT_MONITOR' 'SR06QPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7QFA1 ' 'SR07QPS01:CURRENT_MONITOR' 'SR07QPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7QFA2 ' 'SR07QPS06:CURRENT_MONITOR' 'SR07QPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8QFA1 ' 'SR08QPS01:CURRENT_MONITOR' 'SR08QPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8QFA2 ' 'SR08QPS06:CURRENT_MONITOR' 'SR08QPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9QFA1 ' 'SR09QPS01:CURRENT_MONITOR' 'SR09QPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9QFA2 ' 'SR09QPS06:CURRENT_MONITOR' 'SR09QPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10QFA1 ' 'SR10QPS01:CURRENT_MONITOR' 'SR10QPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10QFA2 ' 'SR10QPS06:CURRENT_MONITOR' 'SR10QPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11QFA1 ' 'SR11QPS01:CURRENT_MONITOR' 'SR11QPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11QFA2 ' 'SR11QPS06:CURRENT_MONITOR' 'SR11QPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12QFA1 ' 'SR12QPS01:CURRENT_MONITOR' 'SR12QPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12QFA2 ' 'SR12QPS06:CURRENT_MONITOR' 'SR12QPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13QFA1 ' 'SR13QPS01:CURRENT_MONITOR' 'SR13QPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13QFA2 ' 'SR13QPS06:CURRENT_MONITOR' 'SR13QPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14QFA1 ' 'SR14QPS01:CURRENT_MONITOR' 'SR14QPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14QFA2 ' 'SR14QPS06:CURRENT_MONITOR' 'SR14QPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(qfa,1) -name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; -name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; -name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; -val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; -val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; -val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; -val =qfa{ii,7}; % This is the scale factor -AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; - -% Important! This determines the cycling range -AO.QFA.Setpoint.Range(ii,:) = [0 160]; -end - - -% *** QDA *** -AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); -AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; -HW2PhysicsParams = magnetcoefficients('QDA'); -Physics2HWParams = magnetcoefficients('QDA'); - -AO.QDA.Monitor.Mode = Mode; -AO.QDA.Monitor.DataType = 'Scalar'; -AO.QDA.Monitor.Units = 'Hardware'; -AO.QDA.Monitor.HWUnits = 'ampere'; -AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QDA.Monitor.Physics2HWFcn = @k2amp; - -AO.QDA.Setpoint.Mode = Mode; -AO.QDA.Setpoint.DataType = 'Scalar'; -AO.QDA.Setpoint.Units = 'Hardware'; -AO.QDA.Setpoint.HWUnits = 'ampere'; -AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QDA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qda={ -'1QDA1 ' 'SR01QPS02:CURRENT_MONITOR' 'SR01QPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1QDA2 ' 'SR01QPS05:CURRENT_MONITOR' 'SR01QPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2QDA1 ' 'SR02QPS02:CURRENT_MONITOR' 'SR02QPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2QDA2 ' 'SR02QPS05:CURRENT_MONITOR' 'SR02QPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... -'3QDA1 ' 'SR03QPS02:CURRENT_MONITOR' 'SR03QPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3QDA2 ' 'SR03QPS05:CURRENT_MONITOR' 'SR03QPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4QDA1 ' 'SR04QPS02:CURRENT_MONITOR' 'SR04QPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4QDA2 ' 'SR04QPS05:CURRENT_MONITOR' 'SR04QPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5QDA1 ' 'SR05QPS02:CURRENT_MONITOR' 'SR05QPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5QDA2 ' 'SR05QPS05:CURRENT_MONITOR' 'SR05QPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6QDA1 ' 'SR06QPS02:CURRENT_MONITOR' 'SR06QPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6QDA2 ' 'SR06QPS05:CURRENT_MONITOR' 'SR06QPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7QDA1 ' 'SR07QPS02:CURRENT_MONITOR' 'SR07QPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7QDA2 ' 'SR07QPS05:CURRENT_MONITOR' 'SR07QPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8QDA1 ' 'SR08QPS02:CURRENT_MONITOR' 'SR08QPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8QDA2 ' 'SR08QPS05:CURRENT_MONITOR' 'SR08QPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9QDA1 ' 'SR09QPS02:CURRENT_MONITOR' 'SR09QPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9QDA2 ' 'SR09QPS05:CURRENT_MONITOR' 'SR09QPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10QDA1 ' 'SR10QPS02:CURRENT_MONITOR' 'SR10QPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10QDA2 ' 'SR10QPS05:CURRENT_MONITOR' 'SR10QPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11QDA1 ' 'SR11QPS02:CURRENT_MONITOR' 'SR11QPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11QDA2 ' 'SR11QPS05:CURRENT_MONITOR' 'SR11QPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12QDA1 ' 'SR12QPS02:CURRENT_MONITOR' 'SR12QPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12QDA2 ' 'SR12QPS05:CURRENT_MONITOR' 'SR12QPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13QDA1 ' 'SR13QPS02:CURRENT_MONITOR' 'SR13QPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13QDA2 ' 'SR13QPS05:CURRENT_MONITOR' 'SR13QPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14QDA1 ' 'SR14QPS02:CURRENT_MONITOR' 'SR14QPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14QDA2 ' 'SR14QPS05:CURRENT_MONITOR' 'SR14QPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(qda,1) -name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; -name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; -name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; -val =qda{ii,4}; AO.QDA.Status(ii,1) = val; -val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; -val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; -val =qda{ii,7}; % This is the scale factor -AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; - -% Important! This determines the cycling range -AO.QDA.Setpoint.Range(ii,:) = [0 90]; -end - - - -% *** QFB *** -AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); -AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFB'); -Physics2HWParams = magnetcoefficients('QFB'); - -AO.QFB.Monitor.Mode = Mode; -AO.QFB.Monitor.DataType = 'Scalar'; -AO.QFB.Monitor.Units = 'Hardware'; -AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFB.Monitor.Physics2HWFcn = @k2amp; -AO.QFB.Monitor.HWUnits = 'ampere'; -AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; - -AO.QFB.Setpoint.Mode = Mode; -AO.QFB.Setpoint.DataType = 'Scalar'; -AO.QFB.Setpoint.Units = 'Hardware'; -AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFB.Setpoint.Physics2HWFcn = @k2amp; -AO.QFB.Setpoint.HWUnits = 'ampere'; -AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -qfb={ -'1QFB1 ' 'SR01QPS03:CURRENT_MONITOR' 'SR01QPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1QFB2 ' 'SR01QPS04:CURRENT_MONITOR' 'SR01QPS04:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2QFB1 ' 'SR02QPS03:CURRENT_MONITOR' 'SR02QPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2QFB2 ' 'SR02QPS04:CURRENT_MONITOR' 'SR02QPS04:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... -'3QFB1 ' 'SR03QPS03:CURRENT_MONITOR' 'SR03QPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3QFB2 ' 'SR03QPS04:CURRENT_MONITOR' 'SR03QPS04:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4QFB1 ' 'SR04QPS03:CURRENT_MONITOR' 'SR04QPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4QFB2 ' 'SR04QPS04:CURRENT_MONITOR' 'SR04QPS04:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5QFB1 ' 'SR05QPS03:CURRENT_MONITOR' 'SR05QPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5QFB2 ' 'SR05QPS04:CURRENT_MONITOR' 'SR05QPS04:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6QFB1 ' 'SR06QPS03:CURRENT_MONITOR' 'SR06QPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6QFB2 ' 'SR06QPS04:CURRENT_MONITOR' 'SR06QPS04:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7QFB1 ' 'SR07QPS03:CURRENT_MONITOR' 'SR07QPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7QFB2 ' 'SR07QPS04:CURRENT_MONITOR' 'SR07QPS04:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8QFB1 ' 'SR08QPS03:CURRENT_MONITOR' 'SR08QPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8QFB2 ' 'SR08QPS04:CURRENT_MONITOR' 'SR08QPS04:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9QFB1 ' 'SR09QPS03:CURRENT_MONITOR' 'SR09QPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9QFB2 ' 'SR09QPS04:CURRENT_MONITOR' 'SR09QPS04:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10QFB1 ' 'SR10QPS03:CURRENT_MONITOR' 'SR10QPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10QFB2 ' 'SR10QPS04:CURRENT_MONITOR' 'SR10QPS04:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11QFB1 ' 'SR11QPS03:CURRENT_MONITOR' 'SR11QPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11QFB2 ' 'SR11QPS04:CURRENT_MONITOR' 'SR11QPS04:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12QFB1 ' 'SR12QPS03:CURRENT_MONITOR' 'SR12QPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12QFB2 ' 'SR12QPS04:CURRENT_MONITOR' 'SR12QPS04:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13QFB1 ' 'SR13QPS03:CURRENT_MONITOR' 'SR13QPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13QFB2 ' 'SR13QPS04:CURRENT_MONITOR' 'SR13QPS04:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14QFB1 ' 'SR14QPS03:CURRENT_MONITOR' 'SR14QPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14QFB2 ' 'SR14QPS04:CURRENT_MONITOR' 'SR14QPS04:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(qfb,1) -name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; -name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; -name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; -val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; -val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; -val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; -val =qfb{ii,7}; % This is the scale factor -AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; - -% Important! This determines the cycling range -AO.QFB.Setpoint.Range(ii,:) = [0 160]; -end - - -%=============== -%Sextupole data -%=============== -% *** SFA *** -AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); -AO.SFA.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFA'); -Physics2HWParams = magnetcoefficients('SFA'); - -AO.SFA.Monitor.Mode = Mode; -AO.SFA.Monitor.DataType = 'Scalar'; -AO.SFA.Monitor.Units = 'Hardware'; -AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFA.Monitor.Physics2HWFcn = @k2amp; -AO.SFA.Monitor.HWUnits = 'ampere'; -AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFA.Setpoint.Mode = Mode; -AO.SFA.Setpoint.DataType = 'Scalar'; -AO.SFA.Setpoint.Units = 'Hardware'; -AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFA.Setpoint.Physics2HWFcn = @k2amp; -AO.SFA.Setpoint.HWUnits = 'ampere'; -AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfa={ -'1SFA1 ' 'SR01SPS01:CURRENT_MONITOR' 'SR01SPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1SFA2 ' 'SR01SPS07:CURRENT_MONITOR' 'SR01SPS07:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2SFA1 ' 'SR02SPS01:CURRENT_MONITOR' 'SR02SPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2SFA2 ' 'SR02SPS07:CURRENT_MONITOR' 'SR02SPS07:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... -'3SFA1 ' 'SR03SPS01:CURRENT_MONITOR' 'SR03SPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3SFA2 ' 'SR03SPS07:CURRENT_MONITOR' 'SR03SPS07:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4SFA1 ' 'SR04SPS01:CURRENT_MONITOR' 'SR04SPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4SFA2 ' 'SR04SPS07:CURRENT_MONITOR' 'SR04SPS07:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5SFA1 ' 'SR05SPS01:CURRENT_MONITOR' 'SR05SPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5SFA2 ' 'SR05SPS07:CURRENT_MONITOR' 'SR05SPS07:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6SFA1 ' 'SR06SPS01:CURRENT_MONITOR' 'SR06SPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6SFA2 ' 'SR06SPS07:CURRENT_MONITOR' 'SR06SPS07:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7SFA1 ' 'SR07SPS01:CURRENT_MONITOR' 'SR07SPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7SFA2 ' 'SR07SPS07:CURRENT_MONITOR' 'SR07SPS07:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8SFA1 ' 'SR08SPS01:CURRENT_MONITOR' 'SR08SPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8SFA2 ' 'SR08SPS07:CURRENT_MONITOR' 'SR08SPS07:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9SFA1 ' 'SR09SPS01:CURRENT_MONITOR' 'SR09SPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9SFA2 ' 'SR09SPS07:CURRENT_MONITOR' 'SR09SPS07:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10SFA1 ' 'SR10SPS01:CURRENT_MONITOR' 'SR10SPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10SFA2 ' 'SR10SPS07:CURRENT_MONITOR' 'SR10SPS07:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11SFA1 ' 'SR11SPS01:CURRENT_MONITOR' 'SR11SPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11SFA2 ' 'SR11SPS07:CURRENT_MONITOR' 'SR11SPS07:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12SFA1 ' 'SR12SPS01:CURRENT_MONITOR' 'SR12SPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12SFA2 ' 'SR12SPS07:CURRENT_MONITOR' 'SR12SPS07:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13SFA1 ' 'SR13SPS01:CURRENT_MONITOR' 'SR13SPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13SFA2 ' 'SR13SPS07:CURRENT_MONITOR' 'SR13SPS07:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14SFA1 ' 'SR14SPS01:CURRENT_MONITOR' 'SR14SPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14SFA2 ' 'SR14SPS07:CURRENT_MONITOR' 'SR14SPS07:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(sfa,1) -name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; -name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; -name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; -val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; -val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; -val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; -val =sfa{ii,7}; % This is the scale factor -AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; - -AO.SFA.Setpoint.Range(ii,:) = [0 90]; -end - - - -% *** SDA *** -AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); -AO.SDA.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'MachineConfig'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDA'); -Physics2HWParams = magnetcoefficients('SDA'); -AO.SDA.Monitor.Mode = Mode; -AO.SDA.Monitor.DataType = 'Scalar'; -AO.SDA.Monitor.Units = 'Hardware'; -AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDA.Monitor.Physics2HWFcn = @k2amp; -AO.SDA.Monitor.HWUnits = 'ampere'; -AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDA.Setpoint.Mode = Mode; -AO.SDA.Setpoint.DataType = 'Scalar'; -AO.SDA.Setpoint.Units = 'Hardware'; -AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDA.Setpoint.Physics2HWFcn = @k2amp; -AO.SDA.Setpoint.HWUnits = 'ampere'; -AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; - - -% common monitor setpoint stat devlist elem scale tol -sda={ -'1SDA1 ' 'SR01SPS02:CURRENT_MONITOR' 'SR01SPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1SDA2 ' 'SR01SPS06:CURRENT_MONITOR' 'SR01SPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2SDA1 ' 'SR02SPS02:CURRENT_MONITOR' 'SR02SPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2SDA2 ' 'SR02SPS06:CURRENT_MONITOR' 'SR02SPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... -'3SDA1 ' 'SR03SPS02:CURRENT_MONITOR' 'SR03SPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3SDA2 ' 'SR03SPS06:CURRENT_MONITOR' 'SR03SPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4SDA1 ' 'SR04SPS02:CURRENT_MONITOR' 'SR04SPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4SDA2 ' 'SR04SPS06:CURRENT_MONITOR' 'SR04SPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5SDA1 ' 'SR05SPS02:CURRENT_MONITOR' 'SR05SPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5SDA2 ' 'SR05SPS06:CURRENT_MONITOR' 'SR05SPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6SDA1 ' 'SR06SPS02:CURRENT_MONITOR' 'SR06SPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6SDA2 ' 'SR06SPS06:CURRENT_MONITOR' 'SR06SPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7SDA1 ' 'SR07SPS02:CURRENT_MONITOR' 'SR07SPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7SDA2 ' 'SR07SPS06:CURRENT_MONITOR' 'SR07SPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8SDA1 ' 'SR08SPS02:CURRENT_MONITOR' 'SR08SPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8SDA2 ' 'SR08SPS06:CURRENT_MONITOR' 'SR08SPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9SDA1 ' 'SR09SPS02:CURRENT_MONITOR' 'SR09SPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9SDA2 ' 'SR09SPS06:CURRENT_MONITOR' 'SR09SPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10SDA1 ' 'SR10SPS02:CURRENT_MONITOR' 'SR10SPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10SDA2 ' 'SR10SPS06:CURRENT_MONITOR' 'SR10SPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11SDA1 ' 'SR11SPS02:CURRENT_MONITOR' 'SR11SPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11SDA2 ' 'SR11SPS06:CURRENT_MONITOR' 'SR11SPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12SDA1 ' 'SR12SPS02:CURRENT_MONITOR' 'SR12SPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12SDA2 ' 'SR12SPS06:CURRENT_MONITOR' 'SR12SPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13SDA1 ' 'SR13SPS02:CURRENT_MONITOR' 'SR13SPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13SDA2 ' 'SR13SPS06:CURRENT_MONITOR' 'SR13SPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14SDA1 ' 'SR14SPS02:CURRENT_MONITOR' 'SR14SPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14SDA2 ' 'SR14SPS06:CURRENT_MONITOR' 'SR14SPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(sda,1) -name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; -name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; -name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; -val =sda{ii,4}; AO.SDA.Status(ii,1) = val; -val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; -val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; -val =sda{ii,7}; % This is the scale factor -AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; - -AO.SDA.Setpoint.Range(ii,:) = [0 90]; -end - - -% *** SDB *** -AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); -AO.SDB.MemberOf = {'PlotFamily'; 'SD'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDB'); -Physics2HWParams = magnetcoefficients('SDB'); -AO.SDB.Monitor.Mode = Mode; -AO.SDB.Monitor.DataType = 'Scalar'; -AO.SDB.Monitor.Units = 'Hardware'; -AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDB.Monitor.Physics2HWFcn = @k2amp; -AO.SDB.Monitor.HWUnits = 'ampere'; -AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDB.Setpoint.Mode = Mode; -AO.SDB.Setpoint.DataType = 'Scalar'; -AO.SDB.Setpoint.Units = 'Hardware'; -AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDB.Setpoint.Physics2HWFcn = @k2amp; -AO.SDB.Setpoint.HWUnits = 'ampere'; -AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sdb={ -'1SDB1 ' 'SR01SPS03:CURRENT_MONITOR' 'SR01SPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'1SDB2 ' 'SR01SPS05:CURRENT_MONITOR' 'SR01SPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... -'2SDB1 ' 'SR02SPS03:CURRENT_MONITOR' 'SR02SPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... -'2SDB2 ' 'SR02SPS05:CURRENT_MONITOR' 'SR02SPS05:CURRENT_SP ' 1 [2,2] 4 1.0 3.0 ; ... -'3SDB1 ' 'SR03SPS03:CURRENT_MONITOR' 'SR03SPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... -'3SDB2 ' 'SR03SPS05:CURRENT_MONITOR' 'SR03SPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... -'4SDB1 ' 'SR04SPS03:CURRENT_MONITOR' 'SR04SPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... -'4SDB2 ' 'SR04SPS05:CURRENT_MONITOR' 'SR04SPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... -'5SDB1 ' 'SR05SPS03:CURRENT_MONITOR' 'SR05SPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... -'5SDB2 ' 'SR05SPS05:CURRENT_MONITOR' 'SR05SPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... -'6SDB1 ' 'SR06SPS03:CURRENT_MONITOR' 'SR06SPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... -'6SDB2 ' 'SR06SPS05:CURRENT_MONITOR' 'SR06SPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... -'7SDB1 ' 'SR07SPS03:CURRENT_MONITOR' 'SR07SPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... -'7SDB2 ' 'SR07SPS05:CURRENT_MONITOR' 'SR07SPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... -'8SDB1 ' 'SR08SPS03:CURRENT_MONITOR' 'SR08SPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... -'8SDB2 ' 'SR08SPS05:CURRENT_MONITOR' 'SR08SPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... -'9SDB1 ' 'SR09SPS03:CURRENT_MONITOR' 'SR09SPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... -'9SDB2 ' 'SR09SPS05:CURRENT_MONITOR' 'SR09SPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... -'10SDB1 ' 'SR10SPS03:CURRENT_MONITOR' 'SR10SPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... -'10SDB2 ' 'SR10SPS05:CURRENT_MONITOR' 'SR10SPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... -'11SDB1 ' 'SR11SPS03:CURRENT_MONITOR' 'SR11SPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... -'11SDB2 ' 'SR11SPS05:CURRENT_MONITOR' 'SR11SPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... -'12SDB1 ' 'SR12SPS03:CURRENT_MONITOR' 'SR12SPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... -'12SDB2 ' 'SR12SPS05:CURRENT_MONITOR' 'SR12SPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... -'13SDB1 ' 'SR13SPS03:CURRENT_MONITOR' 'SR13SPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... -'13SDB2 ' 'SR13SPS05:CURRENT_MONITOR' 'SR13SPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... -'14SDB1 ' 'SR14SPS03:CURRENT_MONITOR' 'SR14SPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... -'14SDB2 ' 'SR14SPS05:CURRENT_MONITOR' 'SR14SPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... -}; - -for ii=1:size(sdb,1) -name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; -name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; -name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; -val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; -val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; -val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; -val =sdb{ii,7}; % This is the scale factor -AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; - -AO.SDB.Setpoint.Range(ii,:) = [0 80]; -end - - - -% *** SFB *** -AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); -AO.SFB.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFB'); -Physics2HWParams = magnetcoefficients('SFB'); - -AO.SFB.Monitor.Mode = Mode; -AO.SFB.Monitor.DataType = 'Scalar'; -AO.SFB.Monitor.Units = 'Hardware'; -AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFB.Monitor.Physics2HWFcn = @k2amp; -AO.SFB.Monitor.HWUnits = 'ampere'; -AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFB.Setpoint.Mode = Mode; -AO.SFB.Setpoint.DataType = 'Scalar'; -AO.SFB.Setpoint.Units = 'Hardware'; -AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFB.Setpoint.Physics2HWFcn = @k2amp; -AO.SFB.Setpoint.HWUnits = 'ampere'; -AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfb={ -'1SFB1 ' 'SR01SPS04:CURRENT_MONITOR' 'SR01SPS04:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... -'2SFB1 ' 'SR02SPS04:CURRENT_MONITOR' 'SR02SPS04:CURRENT_SP ' 1 [2,1] 2 1.0 0.5 ; ... -'3SFB1 ' 'SR03SPS04:CURRENT_MONITOR' 'SR03SPS04:CURRENT_SP ' 1 [3,1] 3 1.0 0.5 ; ... -'4SFB1 ' 'SR04SPS04:CURRENT_MONITOR' 'SR04SPS04:CURRENT_SP ' 1 [4,1] 4 1.0 0.5 ; ... -'5SFB1 ' 'SR05SPS04:CURRENT_MONITOR' 'SR05SPS04:CURRENT_SP ' 1 [5,1] 5 1.0 0.5 ; ... -'6SFB1 ' 'SR06SPS04:CURRENT_MONITOR' 'SR06SPS04:CURRENT_SP ' 1 [6,1] 6 1.0 0.5 ; ... -'7SFB1 ' 'SR07SPS04:CURRENT_MONITOR' 'SR07SPS04:CURRENT_SP ' 1 [7,1] 7 1.0 0.5 ; ... -'8SFB1 ' 'SR08SPS04:CURRENT_MONITOR' 'SR08SPS04:CURRENT_SP ' 1 [8,1] 8 1.0 0.5 ; ... -'9SFB1 ' 'SR09SPS04:CURRENT_MONITOR' 'SR09SPS04:CURRENT_SP ' 1 [9,1] 9 1.0 0.5 ; ... -'10SFB1 ' 'SR10SPS04:CURRENT_MONITOR' 'SR10SPS04:CURRENT_SP ' 1 [10,1] 10 1.0 0.5 ; ... -'11SFB1 ' 'SR11SPS04:CURRENT_MONITOR' 'SR11SPS04:CURRENT_SP ' 1 [11,1] 11 1.0 0.5 ; ... -'12SFB1 ' 'SR12SPS04:CURRENT_MONITOR' 'SR12SPS04:CURRENT_SP ' 1 [12,1] 12 1.0 0.5 ; ... -'13SFB1 ' 'SR13SPS04:CURRENT_MONITOR' 'SR13SPS04:CURRENT_SP ' 1 [13,1] 13 1.0 0.5 ; ... -'14SFB1 ' 'SR14SPS04:CURRENT_MONITOR' 'SR14SPS04:CURRENT_SP ' 1 [14,1] 14 1.0 0.5 ; ... -}; - -for ii=1:size(sfb,1) -name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; -name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; -name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; -val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; -val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; -val =sfb{ii,6}; AO.SFB.ElementLsist(ii,1) = val; -val =sfb{ii,7}; % This is the scale factor -AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; - -AO.SFB.Setpoint.Range(ii,:) = [0 60]; -end - -%=============== -%Skew Quad data -%=============== -% *** Skew quadrupoles *** 2005/09/27 Eugene -AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); -AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('SKQ'); -Physics2HWParams = magnetcoefficients('SKQ'); - -AO.SKQ.Monitor.Mode = Mode; -AO.SKQ.Monitor.DataType = 'Scalar'; -AO.SKQ.Monitor.Units = 'Hardware'; -AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; -AO.SKQ.Monitor.Physics2HWFcn = @k2amp; -AO.SKQ.Monitor.HWUnits = 'ampere'; -AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; - -AO.SKQ.Setpoint.Mode = Mode; -AO.SKQ.Setpoint.DataType = 'Scalar'; -AO.SKQ.Setpoint.Units = 'Hardware'; -AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; -AO.SKQ.Setpoint.HWUnits = 'ampere'; -AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -sq={ -'1SKQ1 ' 'SR01CPS03:CURRENT_MONITOR' 'SR01CPS03:CURRENT_SP ' 1 [1,1] 1 1 ; ... -'1SKQ2 ' 'SR01CPS08:CURRENT_MONITOR' 'SR01CPS08:CURRENT_SP ' 1 [1,2] 2 1 ; ... -'2SKQ1 ' 'SR02CPS03:CURRENT_MONITOR' 'SR02CPS03:CURRENT_SP ' 1 [2,1] 3 1 ; ... -'2SKQ2 ' 'SR02CPS08:CURRENT_MONITOR' 'SR02CPS08:CURRENT_SP ' 1 [2,2] 4 1 ; ... -'3SKQ1 ' 'SR03CPS03:CURRENT_MONITOR' 'SR03CPS03:CURRENT_SP ' 1 [3,1] 5 1 ; ... -'3SKQ2 ' 'SR03CPS08:CURRENT_MONITOR' 'SR03CPS08:CURRENT_SP ' 1 [3,2] 6 1 ; ... -'4SKQ1 ' 'SR04CPS03:CURRENT_MONITOR' 'SR04CPS03:CURRENT_SP ' 1 [4,1] 7 1 ; ... -'4SKQ2 ' 'SR04CPS08:CURRENT_MONITOR' 'SR04CPS08:CURRENT_SP ' 1 [4,2] 8 1 ; ... -'5SKQ1 ' 'SR05CPS03:CURRENT_MONITOR' 'SR05CPS03:CURRENT_SP ' 1 [5,1] 9 1 ; ... -'5SKQ2 ' 'SR05CPS08:CURRENT_MONITOR' 'SR05CPS08:CURRENT_SP ' 1 [5,2] 10 1 ; ... -'6SKQ1 ' 'SR06CPS03:CURRENT_MONITOR' 'SR06CPS03:CURRENT_SP ' 1 [6,1] 11 1 ; ... -'6SKQ2 ' 'SR06CPS08:CURRENT_MONITOR' 'SR06CPS08:CURRENT_SP ' 1 [6,2] 12 1 ; ... -'7SKQ1 ' 'SR07CPS03:CURRENT_MONITOR' 'SR07CPS03:CURRENT_SP ' 1 [7,1] 13 1 ; ... -'7SKQ2 ' 'SR07CPS08:CURRENT_MONITOR' 'SR07CPS08:CURRENT_SP ' 1 [7,2] 14 1 ; ... -'8SKQ1 ' 'SR08CPS03:CURRENT_MONITOR' 'SR08CPS03:CURRENT_SP ' 1 [8,1] 15 1 ; ... -'8SKQ2 ' 'SR08CPS08:CURRENT_MONITOR' 'SR08CPS08:CURRENT_SP ' 1 [8,2] 16 1 ; ... -'9SKQ1 ' 'SR09CPS03:CURRENT_MONITOR' 'SR09CPS03:CURRENT_SP ' 1 [9,1] 17 1 ; ... -'9SKQ2 ' 'SR09CPS08:CURRENT_MONITOR' 'SR09CPS08:CURRENT_SP ' 1 [9,2] 18 1 ; ... -'10SKQ1 ' 'SR10CPS03:CURRENT_MONITOR' 'SR10CPS03:CURRENT_SP ' 1 [10,1] 19 1 ; ... -'10SKQ2 ' 'SR10CPS08:CURRENT_MONITOR' 'SR10CPS08:CURRENT_SP ' 1 [10,2] 20 1 ; ... -'11SKQ1 ' 'SR11CPS03:CURRENT_MONITOR' 'SR11CPS03:CURRENT_SP ' 1 [11,1] 21 1 ; ... -'11SKQ2 ' 'SR11CPS08:CURRENT_MONITOR' 'SR11CPS08:CURRENT_SP ' 1 [11,2] 22 1 ; ... -'12SKQ1 ' 'SR12CPS03:CURRENT_MONITOR' 'SR12CPS03:CURRENT_SP ' 1 [12,1] 23 1 ; ... -'12SKQ2 ' 'SR12CPS08:CURRENT_MONITOR' 'SR12CPS08:CURRENT_SP ' 1 [12,2] 24 1 ; ... -'13SKQ1 ' 'SR13CPS03:CURRENT_MONITOR' 'SR13CPS03:CURRENT_SP ' 1 [13,1] 25 1 ; ... -'13SKQ2 ' 'SR13CPS08:CURRENT_MONITOR' 'SR13CPS08:CURRENT_SP ' 1 [13,2] 26 1 ; ... -'14SKQ1 ' 'SR14CPS03:CURRENT_MONITOR' 'SR14CPS03:CURRENT_SP ' 1 [14,1] 27 1 ; ... -'14SKQ2 ' 'SR14CPS08:CURRENT_MONITOR' 'SR14CPS08:CURRENT_SP ' 1 [14,2] 28 1 ; ... -}; - -for ii=1:size(sq,1) -name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; -name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; -name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; -val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; -val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; -val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; -val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; -AO.SKQ.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SKQ.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SKQ.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SKQ.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; - -AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; -end - - -%=============== -%Kicker data -%=============== -AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); -AO.KICK.MemberOf = {'Injection','MachineConfig' 'Plotfamily'}; - -AO.KICK.Monitor.Mode = Mode; -AO.KICK.Monitor.DataType = 'Scalar'; -AO.KICK.Monitor.Units = 'Hardware'; -AO.KICK.Monitor.HWUnits = 'kVolts'; -AO.KICK.Monitor.PhysicsUnits = 'mradian'; - -AO.KICK.Setpoint.Mode = Mode; -AO.KICK.Setpoint.DataType = 'Scalar'; -AO.KICK.Setpoint.Units = 'Hardware'; -AO.KICK.Setpoint.HWUnits = 'Volts'; -AO.KICK.Setpoint.PhysicsUnits = 'radian'; - -% From kicker deisgn review the kickers are rated to 4380 Amps giving 0.038 -% Tesla converting this to kickangle. Also convert voltage into amps for -% the conversion? -% -% 2780 V on the capacitor banks will create 5240 A delivered to the kicker -% magnets. -% From simulations 4380 A creates 0.038607 T over a length of 0.7 m. -% Therefore 4380 A => 2.7006 mrad. Therefore 2323.740 V => 2.7006 mrad. -% HW2PHYSICS conversion factor (kV to rad) is therefore 0.0027006/2.32374 = -% 0.00116217821271. The Ps also goes through a 1:3 transformer therefore -% the conversion factor increases by 3. Ie 0.00348653463813 -% For V to rad then 0.00000348653463813. -hw2physics_conversionfactor = 0.00000348653463813; - -% Measured -% Kicker1 100 V = 0.176 mrad -% Kicker2 100 V = -0.138 mrad -% Kicker3 100 V = -0.134 mrad -% Kicker4 100 V = 0.176 mrad - -%common monitor setpoint stat devlist elem tol -kickeramp={ -'KICK1 ' 'SR14KPS01:VOLTAGE_MONITOR' 'SR14KPS01:VOLTAGE_SP ' 1 [1,1] 1 0.10 ; ... -'KICK2 ' 'SR01KPS01:VOLTAGE_MONITOR' 'SR01KPS01:VOLTAGE_SP ' 1 [1,2] 2 0.10 ; ... -'KICK3 ' 'SR01KPS02:VOLTAGE_MONITOR' 'SR01KPS02:VOLTAGE_SP ' 1 [1,3] 3 0.10 ; ... -'KICK4 ' 'SR02KPS01:VOLTAGE_MONITOR' 'SR02KPS01:VOLTAGE_SP ' 1 [1,4] 4 0.10 ; ... -}; - -for ii=1:size(kickeramp,1) -name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; -name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; -name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; -val =kickeramp{ii,4}; AO.KICK.Status(ii,1) = val; -val =kickeramp{ii,5}; AO.KICK.DeviceList(ii,:) = val; -val =kickeramp{ii,6}; AO.KICK.ElementList(ii,1) = val; -val =kickeramp{ii,7}; AO.KICK.Setpoint.Tolerance(ii,1) = val; - -if ii==1||ii==4 - hw2physics_conversionfactor = 1.7600e-06; - AO.KICK.Monitor.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; - AO.KICK.Setpoint.Range(ii,:) = [-1300 +1300]; -else - hw2physics_conversionfactor = 1.3600e-06; - AO.KICK.Monitor.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; - AO.KICK.Setpoint.Range(ii,:) = [+1300 -1300]; -end -end - -% *** KICK Delay *** -% AO.KICK.Delay -% >> removed >> see previous versions if info needed - - -%============ -%RF System -%============ -AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); -AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; - -%-------------------------------- 4 cavity Case -%common stat devlist elem -rfcommon={ -'RF1 ' 1 [1,1] 1 ; ... -'RF2 ' 1 [1,2] 2 ; ... -'RF3 ' 1 [1,3] 3 ; ... -'RF4 ' 1 [1,4] 4 ; ... - }; - -%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance -rffreq={ -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... -'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... - }; - -% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfphase={ -'SRF1:STN:PHASE' 'SRF1:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF2:STN:PHASE' 'SRF2:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF3:STN:PHASE' 'SRF3:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF4:STN:PHASE' 'SRF4:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... - }; - -% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfvolt={ -'SRF1:STN:VOLT:CTRL ' 'SRF1:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF2:STN:VOLT:CTRL ' 'SRF2:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF3:STN:VOLT:CTRL ' 'SRF3:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF4:STN:VOLT:CTRL ' 'SRF4:STN:VOLT' 1 1 [-inf inf] inf ; ... - }; -% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance -rfpower={ -'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SRF1:KLYSDRIVFRWD:POWER' 'SRF1:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SRF2:KLYSDRIVFRWD:POWER' 'SRF2:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SRF3:KLYSDRIVFRWD:POWER' 'SRF3:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SRF4:KLYSDRIVFRWD:POWER' 'SRF4:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... - }; - -for ii=1:size(rfcommon,1) -name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; -val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; -val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; -val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; -end - -for ii=1:size(rffreq,1) -name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; -name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; -val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; - AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; -val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; - AO.RF.Setpoint.Physics2HWParams(ii,1) = val; -val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; -val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfphase,1) -name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; -name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; -val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Phase.HW2PhysicsParams(ii,1) = val; -val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Phase.Physics2HWParams(ii,1) = val; -val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; - AO.RF.Phase.Range(ii,:) = val; -val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; - AO.RF.Phase.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfvolt,1) -name=rfvolt{ii,1}; AO.RF.VoltageCtrl.ChannelNames(ii,:) = name; -name=rfvolt{ii,2}; AO.RF.Voltage.ChannelNames(ii,:) = name; -val =rfvolt{ii,3}; AO.RF.VoltageCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Voltage.HW2PhysicsParams(ii,1) = val; -val =rfvolt{ii,4}; AO.RF.VoltageCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Voltage.Physics2HWParams(ii,1) = val; -val =rfvolt{ii,5}; AO.RF.VoltageCtrl.Range(ii,:) = val; - AO.RF.Voltage.Range(ii,:) = val; -val =rfvolt{ii,6}; AO.RF.VoltageCtrl.Tolerance(ii,1) = val; - AO.RF.Voltage.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfpower,1) -name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; -name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; -name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; -val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Power.HW2PhysicsParams(ii,1) = val; - AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; -val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Power.Physics2HWParams(ii,1) = val; - AO.RF.KlysPower.Physics2HWParams(ii,1) = val; -val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; - AO.RF.Power.Range(ii,:) = val; - AO.RF.KlysPower.Range(ii,:) = val; -val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; - AO.RF.Power.Tolerance(ii,1) = val; - AO.RF.KlysPower.Tolerance(ii,1) = val; -end - -%Frequency Readback -AO.RF.Monitor.Mode = Mode; -AO.RF.Monitor.DataType = 'Scalar'; -AO.RF.Monitor.Units = 'Hardware'; -AO.RF.Monitor.HWUnits = 'Hz'; -AO.RF.Monitor.PhysicsUnits = 'Hz'; -%Frequency Setpoint -AO.RF.Setpoint.Mode = Mode; -AO.RF.Setpoint.DataType = 'Scalar'; -AO.RF.Setpoint.Units = 'Hardware'; -AO.RF.Setpoint.HWUnits = 'Hz'; -AO.RF.Setpoint.PhysicsUnits = 'Hz'; - -%Voltage control -AO.RF.VoltageCtrl.Mode = Mode; -AO.RF.VoltageCtrl.DataType = 'Scalar'; -AO.RF.VoltageCtrl.Units = 'Hardware'; -AO.RF.VoltageCtrl.HWUnits = 'Volts'; -AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; - -%Voltage monitor -AO.RF.Voltage.Mode = Mode; -AO.RF.Voltage.DataType = 'Scalar'; -AO.RF.Voltage.Units = 'Hardware'; -AO.RF.Voltage.HWUnits = 'Volts'; -AO.RF.Voltage.PhysicsUnits = 'Volts'; - -%Power Control -AO.RF.PowerCtrl.Mode = Mode; -AO.RF.PowerCtrl.DataType = 'Scalar'; -AO.RF.PowerCtrl.Units = 'Hardware'; -AO.RF.PowerCtrl.HWUnits = 'MWatts'; -AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; - -%Power Monitor -AO.RF.Power.Mode = Mode; -AO.RF.Power.DataType = 'Scalar'; -AO.RF.Power.Units = 'Hardware'; -AO.RF.Power.HWUnits = 'MWatts'; -AO.RF.Power.PhysicsUnits = 'MWatts'; - -%Klystron Forward Power -AO.RF.KlysPower.Mode = Mode; -AO.RF.KlysPower.DataType = 'Scalar'; -AO.RF.KlysPower.Units = 'Hardware'; -AO.RF.KlysPower.HWUnits = 'MWatts'; -AO.RF.KlysPower.PhysicsUnits = 'MWatts'; - -%Station Phase Control -AO.RF.PhaseCtrl.Mode = Mode; -AO.RF.PhaseCtrl.DataType = 'Scalar'; -AO.RF.PhaseCtrl.Units = 'Hardware'; -AO.RF.PhaseCtrl.HWUnits = 'Degrees'; -AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; - - -%Station Phase Monitor -AO.RF.Phase.Mode = Mode; -AO.RF.Phase.DataType = 'Scalar'; -AO.RF.Phase.Units = 'Hardware'; -AO.RF.Phase.HWUnits = 'Degrees'; -AO.RF.Phase.PhysicsUnits = 'Degrees'; - -%==== -%TUNE -%==== -AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); -AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; -AO.TUNE.CommonNames = ['xtune';'ytune']; -AO.TUNE.DeviceList = [ 1 1; 1 2]; -AO.TUNE.ElementList = [1 2]'; -AO.TUNE.Status = [1 1]'; - -AO.TUNE.Monitor.Mode = 'Special'; -AO.TUNE.Monitor.SpecialFunction = 'meastune'; -AO.TUNE.Monitor.DataType = 'Vector'; -AO.TUNE.Monitor.DataTypeIndex = [1 2]'; -AO.TUNE.Monitor.Units = 'Hardware'; -AO.TUNE.Monitor.HW2PhysicsParams = 1; -AO.TUNE.Monitor.Physics2HWParams = 1; -AO.TUNE.Monitor.HWUnits = 'fractional tune'; -AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; - - -% AO.FTx.Length.Mode = 'Special'; -% AO.FTx.Length.Units = 'Hardware'; -% AO.FTx.Length.DataType = 'Scalar'; -% AO.FTx.Length.SpecialFunction = 'getftlength'; -% AO.FTx.Length.SpecialFunctionSet = 'setftlength'; -% AO.FTx.Length.HWUnits = '32ns samples'; -% AO.FTx.Length.PhysicsUnits = '32ns samples'; -% AO.FTx.Length.HW2PhysicsParams = 1; -% AO.FTx.Length.Physics2HWParams = 1; - - -%==== -%DCCT -%==== -AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); -AO.DCCT.MemberOf = {'Diagnostics'}; -AO.DCCT.CommonNames = 'DCCT'; -AO.DCCT.DeviceList = [1 1]; -AO.DCCT.ElementList = [1]; -AO.DCCT.Status = [1]; - -AO.DCCT.Monitor.Mode = Mode; -AO.DCCT.Monitor.DataType = 'Scalar'; -AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; -AO.DCCT.Monitor.Units = 'Hardware'; -AO.DCCT.Monitor.HWUnits = 'milli-ampere'; -AO.DCCT.Monitor.PhysicsUnits = 'ampere'; -AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; -AO.DCCT.Monitor.Physics2HWParams = 1000; - - -% %================== -% %Machine Parameters -% %================== -% Removed in this version, see pervious version for more info - -%====== -%Septum -%====== -% ifam=ifam+1; -% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); -% AO.Septum.MemberOf = {'Injection'}; -% AO.Septum.Status = 1; -% -% AO.Septum.CommonNames = 'Septum '; -% AO.Septum.DeviceList = [3 1]; -% AO.Septum.ElementList = [1]; -% -% AO.Septum.Monitor.Mode = Mode; -% AO.Septum.Monitor.DataType = 'Scalar'; -% AO.Septum.Monitor.Units = 'Hardware'; -% AO.Septum.Monitor.HWUnits = 'ampere'; -% AO.Septum.Monitor.PhysicsUnits = 'radian'; -% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; -% -% AO.Septum.Setpoint.Mode = Mode; -% AO.Septum.Setpoint.DataType = 'Scalar'; -% AO.Septum.Setpoint.Units = 'Hardware'; -% AO.Septum.Setpoint.HWUnits = 'ampere'; -% AO.Septum.Setpoint.PhysicsUnits = 'radian'; -% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; -% AO.Septum.Setpoint.Range = [0, 2500]; -% AO.Septum.Setpoint.Tolerance = 100.0; -% -% AO.Septum.Monitor.HW2PhysicsParams = 1; -% AO.Septum.Monitor.Physics2HWParams = 1; -% AO.Septum.Setpoint.HW2PhysicsParams = 1; -% AO.Septum.Setpoint.Physics2HWParams = 1; - - -%==================== -%Photon Beamline Data -%==================== -% >> removed >> see previous versions if info needed - -%==================== -%BPLD Data -%==================== -% >> removed >> see previous versions if info needed - - - -% The operational mode sets the path, filenames, and other important parameters -% Run setoperationalmode after most of the AO is built so that the Units and Mode fields -% can be set in setoperationalmode -fprintf('\n'); -setao(AO); -setoperationalmode(OperationalMode); -AO = getao; - - -%%%%%%%%%%%%%%%% -% DeltaRespMat % -%%%%%%%%%%%%%%%% - -% I remove the physics2hw conversion because the physics2hw is -% is calibrated yet. - -% Set response matrix kick size in hardware units (amps) -AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', 2.0e-4, AO.HCM.DeviceList); -AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', 1.0e-4, AO.VCM.DeviceList); - -%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point -%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); -%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); - - -AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); -AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); -AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); - - -AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); -AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); -AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); -AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get S-positions [meters] % -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Using ...ATIndex(:,1) will accomodata for split elements where the first -% of a group of elements is put in the first column ie, if SFA is split in -% two then ATIndex will look like [2 3; 11 12; ...] where each row is a -% magnet and column represents each split. -global THERING -AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; -AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; -AO.FTx.Position = findspos(THERING, AO.FTx.AT.ATIndex(:,1))'; -AO.FTy.Position = findspos(THERING, AO.FTy.AT.ATIndex(:,1))'; -AO.FTsum.Position= findspos(THERING, AO.FTsum.AT.ATIndex(:,1))'; -AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; -AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; -AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; -AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; -AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; -AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; -AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; -AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; -AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; -AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; -AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; -AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; -AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; -AO.DCCT.Position = 0; -AO.TUNE.Position = 0; - - -% Save AO -setao(AO); - - -function dispobject(AO,name) - -n = length(fieldnames(AO)); - -if n > 0 - fprintf(' %10s ',name); - if mod(n,5) == 0 - fprintf('\n'); - end +function aspinit(OperationalMode) +% aspinit(OperationalMode) +% +% Initialize parameters for ASP control in MATLAB +% +%========================== +% Accelerator Family Fields +%========================== +% FamilyName BPMx, HCM, etc +% CommonNames Shortcut name for each element (optional) +% DeviceList [Sector, Number] +% ElementList number in list +% Position m, magnet center +% +% MONITOR FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units Physics or HW +% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% +% SETPOINT FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units hardware or physics +% HW2PhysicsFcn function handle used to convert from hardware to physics units +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% Range minsetpoint, maxsetpoint; +% Tolerance setpoint-monitor +% +%============================================= +% Accelerator Toolbox Simulation Fields +%============================================= +% ATType Quad, Sext, etc +% ATIndex index in THERING +% ATParameterGroup parameter group +% +%============ +% Family List +%============ +% BPMx BPMy - beam position monitors +% HCM VCM - corrector magnets wound into sextupoles +% BEND - gradient dipoles +% QFA QDA QFB - quadrupole magnets +% SFA SDA SDB SFB - sextupole magnets +% SQK - skew quads wound into SDA magnets +% KICK - injection kickers (DELTA type) +% RF - 4 cavities (KEK type?) +% DCCT +% Septum (Not in model yet) +% +% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 +% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 + +% === Change Log === +% Mark Boland 2004-02-12 +% Eugene Tan 2004-02-23 +% Eugene Tan 2004-12-13 +% Eugene Tan 2005-09-27 ver 4 +% Updated naming convention of the process variables, use version 4 of +% the lattice "assr4.m" where the correctors have been merged into the +% sextupoles. Made the necessary changes to updateatindex. Added skew +% quadrupoles and updated generate_init. +% Mark Boland 2006-05-27 +% Changed the BPM PVs to ...:SA_HPOS_MONITOR and ...:SA_VPOS_MONITOR +% +% Mark Boland 2006-08-29 +% Changed range on HCM and VCM from - to + since the polarity of the +% correctors was physically changed in the last weeks. +% +% === Still to do === +% - kicker delays +% - BPM names and other possible PVs of interest eg. Q factor etc. +% - clean up and configure the amp2k and k2amp conversion. Control system +% designed to calculate the strengths and amp values using calc records, +% therefore we should only need to change the PV name to access for +% readback at setpoints. Only problem will be in simulation/offline mode +% where those value are not available online. How do you keep the offline +% conversion factors up to date with online vals? +% +% === Generated from === +% aspinit_v5skeleton.m + +% Default operational mode +if nargin < 1 + OperationalMode = 1; +end + + +%============================================= +% START DEFINITION OF ACCELERATOR OBJECTS +%============================================= +fprintf(' Defining the Accelerator Objects. Objects being defined:\n') + + +% Clear previous AcceleratorObjects +setao([]); + + +Mode = 'Online'; % This gets reset in setoperationalmode + +%============================================= +%BPM data: status field designates if BPM in use +%============================================= +ntbpm=98; +AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); +AO.BPMx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMx'}; +AO.BPMx.Monitor.Mode = Mode; +AO.BPMx.Monitor.DataType = 'Scalar'; +AO.BPMx.Monitor.Units = 'Hardware'; +AO.BPMx.Monitor.HWUnits = 'mm'; +AO.BPMx.Monitor.PhysicsUnits = 'meter'; + +AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); +AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'; 'BPMy'}; +AO.BPMy.Monitor.Mode = Mode; +AO.BPMy.Monitor.DataType = 'Scalar'; +AO.BPMy.Monitor.Units = 'Hardware'; +AO.BPMy.Monitor.HWUnits = 'mm'; +AO.BPMy.Monitor.PhysicsUnits = 'meter'; + +% x-name x-chname xstat y-name y-chname ystat DevList Elem +bpm={ +'1BPMx1 ' 'SR01BPM01:SA_HPOS_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:SA_VPOS_MONITOR' 1 [1,1] 1 ; ... +'1BP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 1 [2,6] 13 ; ... +'2BPMx7 ' 'SR02BPM07:SA_HPOS_MONITOR' 1 '2BPMy7 ' 'SR02BPM07:SA_VPOS_MONITOR' 1 [2,7] 14 ; ... +'3BPMx1 ' 'SR03BPM01:SA_HPOS_MONITOR' 1 '3BPMy1 ' 'SR03BPM01:SA_VPOS_MONITOR' 1 [3,1] 15 ; ... +'3BPMx2 ' 'SR03BPM02:SA_HPOS_MONITOR' 1 '3BPMy2 ' 'SR03BPM02:SA_VPOS_MONITOR' 1 [3,2] 16 ; ... +'3BPMx3 ' 'SR03BPM03:SA_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:SA_VPOS_MONITOR' 1 [3,3] 17 ; ... +'3BPMx4 ' 'SR03BPM04:SA_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:SA_VPOS_MONITOR' 1 [3,4] 18 ; ... +'3BPMx5 ' 'SR03BPM05:SA_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:SA_VPOS_MONITOR' 1 [3,5] 19 ; ... +'3BPMx6 ' 'SR03BPM06:SA_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:SA_VPOS_MONITOR' 1 [3,6] 20 ; ... +'3BPMx7 ' 'SR03BPM07:SA_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:SA_VPOS_MONITOR' 1 [3,7] 21 ; ... +'4BPMx1 ' 'SR04BPM01:SA_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:SA_VPOS_MONITOR' 1 [4,1] 22 ; ... +'4BPMx2 ' 'SR04BPM02:SA_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:SA_VPOS_MONITOR' 1 [4,2] 23 ; ... +'4BPMx3 ' 'SR04BPM03:SA_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:SA_VPOS_MONITOR' 1 [4,3] 24 ; ... +'4BPMx4 ' 'SR04BPM04:SA_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:SA_VPOS_MONITOR' 1 [4,4] 25 ; ... +'4BPMx5 ' 'SR04BPM05:SA_HPOS_MONITOR' 0 '4BPMy5 ' 'SR04BPM05:SA_VPOS_MONITOR' 0 [4,5] 26 ; ... +'4BPMx6 ' 'SR04BPM06:SA_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:SA_VPOS_MONITOR' 1 [4,6] 27 ; ... +'4BPMx7 ' 'SR04BPM07:SA_HPOS_MONITOR' 0 '4BPMy7 ' 'SR04BPM07:SA_VPOS_MONITOR' 0 [4,7] 28 ; ... +'5BPMx1 ' 'SR05BPM01:SA_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:SA_VPOS_MONITOR' 1 [5,1] 29 ; ... +'5BPMx2 ' 'SR05BPM02:SA_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:SA_VPOS_MONITOR' 1 [5,2] 30 ; ... +'5BPMx3 ' 'SR05BPM03:SA_HPOS_MONITOR' 0 '5BPMy3 ' 'SR05BPM03:SA_VPOS_MONITOR' 0 [5,3] 31 ; ... +'5BPMx4 ' 'SR05BPM04:SA_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:SA_VPOS_MONITOR' 1 [5,4] 32 ; ... +'5BPMx5 ' 'SR05BPM05:SA_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:SA_VPOS_MONITOR' 1 [5,5] 33 ; ... +'5BPMx6 ' 'SR05BPM06:SA_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:SA_VPOS_MONITOR' 1 [5,6] 34 ; ... +'5BPMx7 ' 'SR05BPM07:SA_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:SA_VPOS_MONITOR' 1 [5,7] 35 ; ... +'6BPMx1 ' 'SR06BPM01:SA_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:SA_VPOS_MONITOR' 1 [6,1] 36 ; ... +'6BPMx2 ' 'SR06BPM02:SA_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:SA_VPOS_MONITOR' 1 [6,2] 37 ; ... +'6BPMx3 ' 'SR06BPM03:SA_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:SA_VPOS_MONITOR' 1 [6,3] 38 ; ... +'6BPMx4 ' 'SR06BPM04:SA_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:SA_VPOS_MONITOR' 1 [6,4] 39 ; ... +'6BPMx5 ' 'SR06BPM05:SA_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:SA_VPOS_MONITOR' 1 [6,5] 40 ; ... +'6BPMx6 ' 'SR06BPM06:SA_HPOS_MONITOR' 0 '6BPMy6 ' 'SR06BPM06:SA_VPOS_MONITOR' 0 [6,6] 41 ; ... +'6BPMx7 ' 'SR06BPM07:SA_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:SA_VPOS_MONITOR' 1 [6,7] 42 ; ... +'7BPMx1 ' 'SR07BPM01:SA_HPOS_MONITOR' 0 '7BPMy1 ' 'SR07BPM01:SA_VPOS_MONITOR' 0 [7,1] 43 ; ... +'7BPMx2 ' 'SR07BPM02:SA_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:SA_VPOS_MONITOR' 1 [7,2] 44 ; ... +'7BPMx3 ' 'SR07BPM03:SA_HPOS_MONITOR' 0 '7BPMy3 ' 'SR07BPM03:SA_VPOS_MONITOR' 0 [7,3] 45 ; ... +'7BPMx4 ' 'SR07BPM04:SA_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:SA_VPOS_MONITOR' 1 [7,4] 46 ; ... +'7BPMx5 ' 'SR07BPM05:SA_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:SA_VPOS_MONITOR' 1 [7,5] 47 ; ... +'7BPMx6 ' 'SR07BPM06:SA_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:SA_VPOS_MONITOR' 1 [7,6] 48 ; ... +'7BPMx7 ' 'SR07BPM07:SA_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:SA_VPOS_MONITOR' 1 [7,7] 49 ; ... +'8BPMx1 ' 'SR08BPM01:SA_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:SA_VPOS_MONITOR' 1 [8,1] 50 ; ... +'8BPMx2 ' 'SR08BPM02:SA_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:SA_VPOS_MONITOR' 1 [8,2] 51 ; ... +'8BPMx3 ' 'SR08BPM03:SA_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:SA_VPOS_MONITOR' 1 [8,3] 52 ; ... +'8BPMx4 ' 'SR08BPM04:SA_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:SA_VPOS_MONITOR' 1 [8,4] 53 ; ... +'8BPMx5 ' 'SR08BPM05:SA_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:SA_VPOS_MONITOR' 1 [8,5] 54 ; ... +'8BPMx6 ' 'SR08BPM06:SA_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:SA_VPOS_MONITOR' 1 [8,6] 55 ; ... +'8BPMx7 ' 'SR08BPM07:SA_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:SA_VPOS_MONITOR' 1 [8,7] 56 ; ... +'9BPMx1 ' 'SR09BPM01:SA_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:SA_VPOS_MONITOR' 1 [9,1] 57 ; ... +'9BPMx2 ' 'SR09BPM02:SA_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:SA_VPOS_MONITOR' 1 [9,2] 58 ; ... +'9BPMx3 ' 'SR09BPM03:SA_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:SA_VPOS_MONITOR' 1 [9,3] 59 ; ... +'9BPMx4 ' 'SR09BPM04:SA_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:SA_VPOS_MONITOR' 1 [9,4] 60 ; ... +'9BPMx5 ' 'SR09BPM05:SA_HPOS_MONITOR' 0 '9BPMy5 ' 'SR09BPM05:SA_VPOS_MONITOR' 0 [9,5] 61 ; ... +'9BPMx6 ' 'SR09BPM06:SA_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:SA_VPOS_MONITOR' 1 [9,6] 62 ; ... +'9BPMx7 ' 'SR09BPM07:SA_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:SA_VPOS_MONITOR' 1 [9,7] 63 ; ... +'10BPMx1 ' 'SR10BPM01:SA_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:SA_VPOS_MONITOR' 1 [10,1] 64 ; ... +'10BPMx2 ' 'SR10BPM02:SA_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:SA_VPOS_MONITOR' 1 [10,2] 65 ; ... +'10BPMx3 ' 'SR10BPM03:SA_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:SA_VPOS_MONITOR' 1 [10,3] 66 ; ... +'10BPMx4 ' 'SR10BPM04:SA_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:SA_VPOS_MONITOR' 1 [10,4] 67 ; ... +'10BPMx5 ' 'SR10BPM05:SA_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:SA_VPOS_MONITOR' 1 [10,5] 68 ; ... +'10BPMx6 ' 'SR10BPM06:SA_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:SA_VPOS_MONITOR' 1 [10,6] 69 ; ... +'10BPMx7 ' 'SR10BPM07:SA_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:SA_VPOS_MONITOR' 1 [10,7] 70 ; ... +'11BPMx1 ' 'SR11BPM01:SA_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:SA_VPOS_MONITOR' 1 [11,1] 71 ; ... +'11BPMx2 ' 'SR11BPM02:SA_HPOS_MONITOR' 0 '11BPMy2 ' 'SR11BPM02:SA_VPOS_MONITOR' 0 [11,2] 72 ; ... +'11BPMx3 ' 'SR11BPM03:SA_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:SA_VPOS_MONITOR' 1 [11,3] 73 ; ... +'11BPMx4 ' 'SR11BPM04:SA_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:SA_VPOS_MONITOR' 1 [11,4] 74 ; ... +'11BPMx5 ' 'SR11BPM05:SA_HPOS_MONITOR' 0 '11BPMy5 ' 'SR11BPM05:SA_VPOS_MONITOR' 0 [11,5] 75 ; ... +'11BPMx6 ' 'SR11BPM06:SA_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:SA_VPOS_MONITOR' 1 [11,6] 76 ; ... +'11BPMx7 ' 'SR11BPM07:SA_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:SA_VPOS_MONITOR' 1 [11,7] 77 ; ... +'12BPMx1 ' 'SR12BPM01:SA_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:SA_VPOS_MONITOR' 1 [12,1] 78 ; ... +'12BPMx2 ' 'SR12BPM02:SA_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:SA_VPOS_MONITOR' 1 [12,2] 79 ; ... +'12BPMx3 ' 'SR12BPM03:SA_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:SA_VPOS_MONITOR' 1 [12,3] 80 ; ... +'12BPMx4 ' 'SR12BPM04:SA_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:SA_VPOS_MONITOR' 1 [12,4] 81 ; ... +'12BPMx5 ' 'SR12BPM05:SA_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:SA_VPOS_MONITOR' 1 [12,5] 82 ; ... +'12BPMx6 ' 'SR12BPM06:SA_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:SA_VPOS_MONITOR' 1 [12,6] 83 ; ... +'12BPMx7 ' 'SR12BPM07:SA_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:SA_VPOS_MONITOR' 1 [12,7] 84 ; ... +'13BPMx1 ' 'SR13BPM01:SA_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:SA_VPOS_MONITOR' 1 [13,1] 85 ; ... +'13BPMx2 ' 'SR13BPM02:SA_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:SA_VPOS_MONITOR' 1 [13,2] 86 ; ... +'13BPMx3 ' 'SR13BPM03:SA_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:SA_VPOS_MONITOR' 1 [13,3] 87 ; ... +'13BPMx4 ' 'SR13BPM04:SA_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:SA_VPOS_MONITOR' 1 [13,4] 88 ; ... +'13BPMx5 ' 'SR13BPM05:SA_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:SA_VPOS_MONITOR' 1 [13,5] 89 ; ... +'13BPMx6 ' 'SR13BPM06:SA_HPOS_MONITOR' 0 '13BPMy6 ' 'SR13BPM06:SA_VPOS_MONITOR' 0 [13,6] 90 ; ... +'13BPMx7 ' 'SR13BPM07:SA_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:SA_VPOS_MONITOR' 1 [13,7] 91 ; ... +'14BPMx1 ' 'SR14BPM01:SA_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:SA_VPOS_MONITOR' 1 [14,1] 92 ; ... +'14BPMx2 ' 'SR14BPM02:SA_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:SA_VPOS_MONITOR' 1 [14,2] 93 ; ... +'14BPMx3 ' 'SR14BPM03:SA_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:SA_VPOS_MONITOR' 1 [14,3] 94 ; ... +'14BPMx4 ' 'SR14BPM04:SA_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:SA_VPOS_MONITOR' 1 [14,4] 95 ; ... +'14BPMx5 ' 'SR14BPM05:SA_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:SA_VPOS_MONITOR' 1 [14,5] 96 ; ... +'14BPMx6 ' 'SR14BPM06:SA_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:SA_VPOS_MONITOR' 1 [14,6] 97 ; ... +'14BPMx7 ' 'SR14BPM07:SA_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:SA_VPOS_MONITOR' 1 [14,7] 98 ; ... +}; + +%Load fields from data block +for ii=1:size(bpm,1) +name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; +name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; +name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; +name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; +val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; + AO.BPMy.DeviceList(ii,:) = val; +val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; + AO.BPMy.ElementList(ii,:) = val; + AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1000; + AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1000; +end + + +% % Get sum value from button. Don't need handles and PV namelist as +% % parameters are the same as the 'monitor' subcategory. +% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; +% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; +% AO.BPMx.Sum.HWUnits = 'ADC Counts'; +% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; +% AO.BPMx.Sum.HW2PhysicsParams = 1; +% AO.BPMx.Sum.Physics2HWParams = 1; +% % Get q value from BPMs. Don't need handles and PV namelist. +% AO.BPMx.Q = AO.BPMx.Monitor; +% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; +% AO.BPMx.Q.HWUnits = 'mm'; +% AO.BPMx.Q.PhysicsUnits = 'meter'; +% AO.BPMx.Q.HW2PhysicsParams = 1e-3; +% AO.BPMx.Q.Physics2HWParams = 1000; +% +% % Definition above for horiz0ontal. Replicate for vertical. +% AO.BPMy.Sum = AO.BPMx.Sum; +% AO.BPMy.Q = AO.BPMx.Q; + + + +%============================================= +% First Turn BPM data from Libera +%============================================= +ntbpm=98; +AO.FTx.FamilyName = 'FTx'; dispobject(AO,AO.FTx.FamilyName); +AO.FTx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTx.Monitor.Mode = Mode; +AO.FTx.Monitor.DataType = 'Scalar'; +AO.FTx.Monitor.Units = 'Hardware'; +AO.FTx.Monitor.HWUnits = 'mm'; +AO.FTx.Monitor.PhysicsUnits = 'meter'; + +AO.FTy.FamilyName = 'FTy'; dispobject(AO,AO.FTy.FamilyName); +AO.FTy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTy.Monitor.Mode = Mode; +AO.FTy.Monitor.DataType = 'Scalar'; +AO.FTy.Monitor.Units = 'Hardware'; +AO.FTy.Monitor.HWUnits = 'mm'; +AO.FTy.Monitor.PhysicsUnits = 'meter'; + +% x-name x-chname xstat y-name y-chname ystat DevList Elem +bpm={ +'1FTx1 ' 'SR01BPM01:FT_HPOS_MONITOR' 1 '1BPMy1 ' 'SR01BPM01:FT_VPOS_MONITOR' 1 [1,1] 1 ; ... +'1FTx2 ' 'SR01BPM02:FT_HPOS_MONITOR' 1 '1BPMy2 ' 'SR01BPM02:FT_VPOS_MONITOR' 1 [1,2] 2 ; ... +'1FTx3 ' 'SR01BPM03:FT_HPOS_MONITOR' 1 '1BPMy3 ' 'SR01BPM03:FT_VPOS_MONITOR' 1 [1,3] 3 ; ... +'1FTx4 ' 'SR01BPM04:FT_HPOS_MONITOR' 1 '1BPMy4 ' 'SR01BPM04:FT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03BPM02:FT_VPOS_MONITOR' 1 [3,2] 16 ; ... +'3FTx3 ' 'SR03BPM03:FT_HPOS_MONITOR' 1 '3BPMy3 ' 'SR03BPM03:FT_VPOS_MONITOR' 1 [3,3] 17 ; ... +'3FTx4 ' 'SR03BPM04:FT_HPOS_MONITOR' 1 '3BPMy4 ' 'SR03BPM04:FT_VPOS_MONITOR' 1 [3,4] 18 ; ... +'3FTx5 ' 'SR03BPM05:FT_HPOS_MONITOR' 1 '3BPMy5 ' 'SR03BPM05:FT_VPOS_MONITOR' 1 [3,5] 19 ; ... +'3FTx6 ' 'SR03BPM06:FT_HPOS_MONITOR' 1 '3BPMy6 ' 'SR03BPM06:FT_VPOS_MONITOR' 1 [3,6] 20 ; ... +'3FTx7 ' 'SR03BPM07:FT_HPOS_MONITOR' 1 '3BPMy7 ' 'SR03BPM07:FT_VPOS_MONITOR' 1 [3,7] 21 ; ... +'4FTx1 ' 'SR04BPM01:FT_HPOS_MONITOR' 1 '4BPMy1 ' 'SR04BPM01:FT_VPOS_MONITOR' 1 [4,1] 22 ; ... +'4FTx2 ' 'SR04BPM02:FT_HPOS_MONITOR' 1 '4BPMy2 ' 'SR04BPM02:FT_VPOS_MONITOR' 1 [4,2] 23 ; ... +'4FTx3 ' 'SR04BPM03:FT_HPOS_MONITOR' 1 '4BPMy3 ' 'SR04BPM03:FT_VPOS_MONITOR' 1 [4,3] 24 ; ... +'4FTx4 ' 'SR04BPM04:FT_HPOS_MONITOR' 1 '4BPMy4 ' 'SR04BPM04:FT_VPOS_MONITOR' 1 [4,4] 25 ; ... +'4FTx5 ' 'SR04BPM05:FT_HPOS_MONITOR' 1 '4BPMy5 ' 'SR04BPM05:FT_VPOS_MONITOR' 1 [4,5] 26 ; ... +'4FTx6 ' 'SR04BPM06:FT_HPOS_MONITOR' 1 '4BPMy6 ' 'SR04BPM06:FT_VPOS_MONITOR' 1 [4,6] 27 ; ... +'4FTx7 ' 'SR04BPM07:FT_HPOS_MONITOR' 1 '4BPMy7 ' 'SR04BPM07:FT_VPOS_MONITOR' 1 [4,7] 28 ; ... +'5FTx1 ' 'SR05BPM01:FT_HPOS_MONITOR' 1 '5BPMy1 ' 'SR05BPM01:FT_VPOS_MONITOR' 1 [5,1] 29 ; ... +'5FTx2 ' 'SR05BPM02:FT_HPOS_MONITOR' 1 '5BPMy2 ' 'SR05BPM02:FT_VPOS_MONITOR' 1 [5,2] 30 ; ... +'5FTx3 ' 'SR05BPM03:FT_HPOS_MONITOR' 1 '5BPMy3 ' 'SR05BPM03:FT_VPOS_MONITOR' 1 [5,3] 31 ; ... +'5FTx4 ' 'SR05BPM04:FT_HPOS_MONITOR' 1 '5BPMy4 ' 'SR05BPM04:FT_VPOS_MONITOR' 1 [5,4] 32 ; ... +'5FTx5 ' 'SR05BPM05:FT_HPOS_MONITOR' 1 '5BPMy5 ' 'SR05BPM05:FT_VPOS_MONITOR' 1 [5,5] 33 ; ... +'5FTx6 ' 'SR05BPM06:FT_HPOS_MONITOR' 1 '5BPMy6 ' 'SR05BPM06:FT_VPOS_MONITOR' 1 [5,6] 34 ; ... +'5FTx7 ' 'SR05BPM07:FT_HPOS_MONITOR' 1 '5BPMy7 ' 'SR05BPM07:FT_VPOS_MONITOR' 1 [5,7] 35 ; ... +'6FTx1 ' 'SR06BPM01:FT_HPOS_MONITOR' 1 '6BPMy1 ' 'SR06BPM01:FT_VPOS_MONITOR' 1 [6,1] 36 ; ... +'6FTx2 ' 'SR06BPM02:FT_HPOS_MONITOR' 1 '6BPMy2 ' 'SR06BPM02:FT_VPOS_MONITOR' 1 [6,2] 37 ; ... +'6FTx3 ' 'SR06BPM03:FT_HPOS_MONITOR' 1 '6BPMy3 ' 'SR06BPM03:FT_VPOS_MONITOR' 1 [6,3] 38 ; ... +'6FTx4 ' 'SR06BPM04:FT_HPOS_MONITOR' 1 '6BPMy4 ' 'SR06BPM04:FT_VPOS_MONITOR' 1 [6,4] 39 ; ... +'6FTx5 ' 'SR06BPM05:FT_HPOS_MONITOR' 1 '6BPMy5 ' 'SR06BPM05:FT_VPOS_MONITOR' 1 [6,5] 40 ; ... +'6FTx6 ' 'SR06BPM06:FT_HPOS_MONITOR' 1 '6BPMy6 ' 'SR06BPM06:FT_VPOS_MONITOR' 1 [6,6] 41 ; ... +'6FTx7 ' 'SR06BPM07:FT_HPOS_MONITOR' 1 '6BPMy7 ' 'SR06BPM07:FT_VPOS_MONITOR' 1 [6,7] 42 ; ... +'7FTx1 ' 'SR07BPM01:FT_HPOS_MONITOR' 1 '7BPMy1 ' 'SR07BPM01:FT_VPOS_MONITOR' 1 [7,1] 43 ; ... +'7FTx2 ' 'SR07BPM02:FT_HPOS_MONITOR' 1 '7BPMy2 ' 'SR07BPM02:FT_VPOS_MONITOR' 1 [7,2] 44 ; ... +'7FTx3 ' 'SR07BPM03:FT_HPOS_MONITOR' 1 '7BPMy3 ' 'SR07BPM03:FT_VPOS_MONITOR' 1 [7,3] 45 ; ... +'7FTx4 ' 'SR07BPM04:FT_HPOS_MONITOR' 1 '7BPMy4 ' 'SR07BPM04:FT_VPOS_MONITOR' 1 [7,4] 46 ; ... +'7FTx5 ' 'SR07BPM05:FT_HPOS_MONITOR' 1 '7BPMy5 ' 'SR07BPM05:FT_VPOS_MONITOR' 1 [7,5] 47 ; ... +'7FTx6 ' 'SR07BPM06:FT_HPOS_MONITOR' 1 '7BPMy6 ' 'SR07BPM06:FT_VPOS_MONITOR' 1 [7,6] 48 ; ... +'7FTx7 ' 'SR07BPM07:FT_HPOS_MONITOR' 1 '7BPMy7 ' 'SR07BPM07:FT_VPOS_MONITOR' 1 [7,7] 49 ; ... +'8FTx1 ' 'SR08BPM01:FT_HPOS_MONITOR' 1 '8BPMy1 ' 'SR08BPM01:FT_VPOS_MONITOR' 1 [8,1] 50 ; ... +'8FTx2 ' 'SR08BPM02:FT_HPOS_MONITOR' 1 '8BPMy2 ' 'SR08BPM02:FT_VPOS_MONITOR' 1 [8,2] 51 ; ... +'8FTx3 ' 'SR08BPM03:FT_HPOS_MONITOR' 1 '8BPMy3 ' 'SR08BPM03:FT_VPOS_MONITOR' 1 [8,3] 52 ; ... +'8FTx4 ' 'SR08BPM04:FT_HPOS_MONITOR' 1 '8BPMy4 ' 'SR08BPM04:FT_VPOS_MONITOR' 1 [8,4] 53 ; ... +'8FTx5 ' 'SR08BPM05:FT_HPOS_MONITOR' 1 '8BPMy5 ' 'SR08BPM05:FT_VPOS_MONITOR' 1 [8,5] 54 ; ... +'8FTx6 ' 'SR08BPM06:FT_HPOS_MONITOR' 1 '8BPMy6 ' 'SR08BPM06:FT_VPOS_MONITOR' 1 [8,6] 55 ; ... +'8FTx7 ' 'SR08BPM07:FT_HPOS_MONITOR' 1 '8BPMy7 ' 'SR08BPM07:FT_VPOS_MONITOR' 1 [8,7] 56 ; ... +'9FTx1 ' 'SR09BPM01:FT_HPOS_MONITOR' 1 '9BPMy1 ' 'SR09BPM01:FT_VPOS_MONITOR' 1 [9,1] 57 ; ... +'9FTx2 ' 'SR09BPM02:FT_HPOS_MONITOR' 1 '9BPMy2 ' 'SR09BPM02:FT_VPOS_MONITOR' 1 [9,2] 58 ; ... +'9FTx3 ' 'SR09BPM03:FT_HPOS_MONITOR' 1 '9BPMy3 ' 'SR09BPM03:FT_VPOS_MONITOR' 1 [9,3] 59 ; ... +'9FTx4 ' 'SR09BPM04:FT_HPOS_MONITOR' 1 '9BPMy4 ' 'SR09BPM04:FT_VPOS_MONITOR' 1 [9,4] 60 ; ... +'9FTx5 ' 'SR09BPM05:FT_HPOS_MONITOR' 1 '9BPMy5 ' 'SR09BPM05:FT_VPOS_MONITOR' 1 [9,5] 61 ; ... +'9FTx6 ' 'SR09BPM06:FT_HPOS_MONITOR' 1 '9BPMy6 ' 'SR09BPM06:FT_VPOS_MONITOR' 1 [9,6] 62 ; ... +'9FTx7 ' 'SR09BPM07:FT_HPOS_MONITOR' 1 '9BPMy7 ' 'SR09BPM07:FT_VPOS_MONITOR' 1 [9,7] 63 ; ... +'10FTx1 ' 'SR10BPM01:FT_HPOS_MONITOR' 1 '10BPMy1 ' 'SR10BPM01:FT_VPOS_MONITOR' 1 [10,1] 64 ; ... +'10FTx2 ' 'SR10BPM02:FT_HPOS_MONITOR' 1 '10BPMy2 ' 'SR10BPM02:FT_VPOS_MONITOR' 1 [10,2] 65 ; ... +'10FTx3 ' 'SR10BPM03:FT_HPOS_MONITOR' 1 '10BPMy3 ' 'SR10BPM03:FT_VPOS_MONITOR' 1 [10,3] 66 ; ... +'10FTx4 ' 'SR10BPM04:FT_HPOS_MONITOR' 1 '10BPMy4 ' 'SR10BPM04:FT_VPOS_MONITOR' 1 [10,4] 67 ; ... +'10FTx5 ' 'SR10BPM05:FT_HPOS_MONITOR' 1 '10BPMy5 ' 'SR10BPM05:FT_VPOS_MONITOR' 1 [10,5] 68 ; ... +'10FTx6 ' 'SR10BPM06:FT_HPOS_MONITOR' 1 '10BPMy6 ' 'SR10BPM06:FT_VPOS_MONITOR' 1 [10,6] 69 ; ... +'10FTx7 ' 'SR10BPM07:FT_HPOS_MONITOR' 1 '10BPMy7 ' 'SR10BPM07:FT_VPOS_MONITOR' 1 [10,7] 70 ; ... +'11FTx1 ' 'SR11BPM01:FT_HPOS_MONITOR' 1 '11BPMy1 ' 'SR11BPM01:FT_VPOS_MONITOR' 1 [11,1] 71 ; ... +'11FTx2 ' 'SR11BPM02:FT_HPOS_MONITOR' 1 '11BPMy2 ' 'SR11BPM02:FT_VPOS_MONITOR' 1 [11,2] 72 ; ... +'11FTx3 ' 'SR11BPM03:FT_HPOS_MONITOR' 1 '11BPMy3 ' 'SR11BPM03:FT_VPOS_MONITOR' 1 [11,3] 73 ; ... +'11FTx4 ' 'SR11BPM04:FT_HPOS_MONITOR' 1 '11BPMy4 ' 'SR11BPM04:FT_VPOS_MONITOR' 1 [11,4] 74 ; ... +'11FTx5 ' 'SR11BPM05:FT_HPOS_MONITOR' 1 '11BPMy5 ' 'SR11BPM05:FT_VPOS_MONITOR' 1 [11,5] 75 ; ... +'11FTx6 ' 'SR11BPM06:FT_HPOS_MONITOR' 1 '11BPMy6 ' 'SR11BPM06:FT_VPOS_MONITOR' 1 [11,6] 76 ; ... +'11FTx7 ' 'SR11BPM07:FT_HPOS_MONITOR' 1 '11BPMy7 ' 'SR11BPM07:FT_VPOS_MONITOR' 1 [11,7] 77 ; ... +'12FTx1 ' 'SR12BPM01:FT_HPOS_MONITOR' 1 '12BPMy1 ' 'SR12BPM01:FT_VPOS_MONITOR' 1 [12,1] 78 ; ... +'12FTx2 ' 'SR12BPM02:FT_HPOS_MONITOR' 1 '12BPMy2 ' 'SR12BPM02:FT_VPOS_MONITOR' 1 [12,2] 79 ; ... +'12FTx3 ' 'SR12BPM03:FT_HPOS_MONITOR' 1 '12BPMy3 ' 'SR12BPM03:FT_VPOS_MONITOR' 1 [12,3] 80 ; ... +'12FTx4 ' 'SR12BPM04:FT_HPOS_MONITOR' 1 '12BPMy4 ' 'SR12BPM04:FT_VPOS_MONITOR' 1 [12,4] 81 ; ... +'12FTx5 ' 'SR12BPM05:FT_HPOS_MONITOR' 1 '12BPMy5 ' 'SR12BPM05:FT_VPOS_MONITOR' 1 [12,5] 82 ; ... +'12FTx6 ' 'SR12BPM06:FT_HPOS_MONITOR' 1 '12BPMy6 ' 'SR12BPM06:FT_VPOS_MONITOR' 1 [12,6] 83 ; ... +'12FTx7 ' 'SR12BPM07:FT_HPOS_MONITOR' 1 '12BPMy7 ' 'SR12BPM07:FT_VPOS_MONITOR' 1 [12,7] 84 ; ... +'13FTx1 ' 'SR13BPM01:FT_HPOS_MONITOR' 1 '13BPMy1 ' 'SR13BPM01:FT_VPOS_MONITOR' 1 [13,1] 85 ; ... +'13FTx2 ' 'SR13BPM02:FT_HPOS_MONITOR' 1 '13BPMy2 ' 'SR13BPM02:FT_VPOS_MONITOR' 1 [13,2] 86 ; ... +'13FTx3 ' 'SR13BPM03:FT_HPOS_MONITOR' 1 '13BPMy3 ' 'SR13BPM03:FT_VPOS_MONITOR' 1 [13,3] 87 ; ... +'13FTx4 ' 'SR13BPM04:FT_HPOS_MONITOR' 1 '13BPMy4 ' 'SR13BPM04:FT_VPOS_MONITOR' 1 [13,4] 88 ; ... +'13FTx5 ' 'SR13BPM05:FT_HPOS_MONITOR' 1 '13BPMy5 ' 'SR13BPM05:FT_VPOS_MONITOR' 1 [13,5] 89 ; ... +'13FTx6 ' 'SR13BPM06:FT_HPOS_MONITOR' 1 '13BPMy6 ' 'SR13BPM06:FT_VPOS_MONITOR' 1 [13,6] 90 ; ... +'13FTx7 ' 'SR13BPM07:FT_HPOS_MONITOR' 1 '13BPMy7 ' 'SR13BPM07:FT_VPOS_MONITOR' 1 [13,7] 91 ; ... +'14FTx1 ' 'SR14BPM01:FT_HPOS_MONITOR' 1 '14BPMy1 ' 'SR14BPM01:FT_VPOS_MONITOR' 1 [14,1] 92 ; ... +'14FTx2 ' 'SR14BPM02:FT_HPOS_MONITOR' 1 '14BPMy2 ' 'SR14BPM02:FT_VPOS_MONITOR' 1 [14,2] 93 ; ... +'14FTx3 ' 'SR14BPM03:FT_HPOS_MONITOR' 1 '14BPMy3 ' 'SR14BPM03:FT_VPOS_MONITOR' 1 [14,3] 94 ; ... +'14FTx4 ' 'SR14BPM04:FT_HPOS_MONITOR' 1 '14BPMy4 ' 'SR14BPM04:FT_VPOS_MONITOR' 1 [14,4] 95 ; ... +'14FTx5 ' 'SR14BPM05:FT_HPOS_MONITOR' 1 '14BPMy5 ' 'SR14BPM05:FT_VPOS_MONITOR' 1 [14,5] 96 ; ... +'14FTx6 ' 'SR14BPM06:FT_HPOS_MONITOR' 1 '14BPMy6 ' 'SR14BPM06:FT_VPOS_MONITOR' 1 [14,6] 97 ; ... +'14FTx7 ' 'SR14BPM07:FT_HPOS_MONITOR' 1 '14BPMy7 ' 'SR14BPM07:FT_VPOS_MONITOR' 1 [14,7] 98 ; ... +}; + +%Load fields from data block +for ii=1:size(bpm,1) +name=bpm{ii,1}; AO.FTx.CommonNames(ii,:) = name; +name=bpm{ii,2}; AO.FTx.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,3}; AO.FTx.Status(ii,:) = val; +name=bpm{ii,4}; AO.FTy.CommonNames(ii,:) = name; +name=bpm{ii,5}; AO.FTy.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,6}; AO.FTy.Status(ii,:) = val; +val =bpm{ii,7}; AO.FTx.DeviceList(ii,:) = val; + AO.FTy.DeviceList(ii,:) = val; +val =bpm{ii,8}; AO.FTx.ElementList(ii,:) = val; + AO.FTy.ElementList(ii,:) = val; + AO.FTx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.FTx.Monitor.Physics2HWParams(ii,:) = 1000; + AO.FTy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.FTy.Monitor.Physics2HWParams(ii,:) = 1000; +end +AO.FTx.Status = AO.BPMx.Status; +AO.FTy.Status = AO.BPMy.Status; + +AO.FTsum = AO.FTx; +AO.FTsum.FamilyName = 'FTsum'; dispobject(AO,AO.FTsum.FamilyName); +AO.FTsum.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTsum.Monitor.Mode = 'Special'; +AO.FTsum.Monitor.Units = 'Hardware'; +AO.FTsum.Monitor.DataType = 'Scalar'; +AO.FTsum.Monitor.SpecialFunction = 'getftsum'; +AO.FTsum.Monitor.HWUnits = 'ADC counts'; +AO.FTsum.Monitor.PhysicsUnits = 'ADC counts'; +AO.FTsum.Monitor.HW2PhysicsParams(:) = 1; +AO.FTsum.Monitor.Physics2HWParams(:) = 1; + + +% % Get sum value from button. Don't need handles and PV namelist as +% % parameters are the same as the 'monitor' subcategory. +AO.FTx.Off.Mode = 'Special'; +AO.FTx.Off.Units = 'Hardware'; +AO.FTx.Off.DataType = 'Scalar'; +AO.FTx.Off.SpecialFunction = 'getftoffset'; +AO.FTx.Off.SpecialFunctionSet = 'setftoffset'; +AO.FTx.Off.HWUnits = '32ns samples'; +AO.FTx.Off.PhysicsUnits = '32ns samples'; +AO.FTx.Off.HW2PhysicsParams = 1; +AO.FTx.Off.Physics2HWParams = 1; + +AO.FTx.Length.Mode = 'Special'; +AO.FTx.Length.Units = 'Hardware'; +AO.FTx.Length.DataType = 'Scalar'; +AO.FTx.Length.SpecialFunction = 'getftlength'; +AO.FTx.Length.SpecialFunctionSet = 'setftlength'; +AO.FTx.Length.HWUnits = '32ns samples'; +AO.FTx.Length.PhysicsUnits = '32ns samples'; +AO.FTx.Length.HW2PhysicsParams = 1; +AO.FTx.Length.Physics2HWParams = 1; + +AO.FTx.Maxadc.Mode = 'Special'; +AO.FTx.Maxadc.Units = 'Hardware'; +AO.FTx.Maxadc.DataType = 'Scalar'; +AO.FTx.Maxadc.SpecialFunction = 'getftmaxadc'; +AO.FTx.Maxadc.HWUnits = 'ADC counts'; +AO.FTx.Maxadc.PhysicsUnits = 'ADC counts'; +AO.FTx.Maxadc.HW2PhysicsParams = 1; +AO.FTx.Maxadc.Physics2HWParams = 1; + +% AO.FTx.Sum.Mode = 'Special'; +% AO.FTx.Sum.Units = 'Hardware'; +% AO.FTx.Sum.DataType = 'Scalar'; +% AO.FTx.Sum.SpecialFunction = 'getftsum'; +% AO.FTx.Sum.HWUnits = 'ADC counts'; +% AO.FTx.Sum.PhysicsUnits = 'ADC counts'; +% AO.FTx.Sum.HW2PhysicsParams = 1; +% AO.FTx.Sum.Physics2HWParams = 1; + + +%=========================================================== +% Corrector data: status field designates if corrector in use +% ASP corrector coils wound into sextupoles. Not dynamic correctors. +%=========================================================== + +AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); +AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'}; + +AO.HCM.Monitor.Mode = Mode; +AO.HCM.Monitor.DataType = 'Scalar'; +AO.HCM.Monitor.Units = 'Hardware'; +AO.HCM.Monitor.HWUnits = 'ampere'; +AO.HCM.Monitor.PhysicsUnits = 'radian'; +AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.HCM.Monitor.Physics2HWFcn = @k2amp; + +AO.HCM.Setpoint.Mode = Mode; +AO.HCM.Setpoint.DataType = 'Scalar'; +AO.HCM.Setpoint.Units = 'Hardware'; +AO.HCM.Setpoint.HWUnits = 'ampere'; +AO.HCM.Setpoint.PhysicsUnits = 'radian'; +AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.HCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian. Respmat settings below AO definitions. +% x-common x-monitor x-setpoint stat devlist elem tol +cor={ +'1HCM1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... +'1HCM2 ' 'SR01CPS05:CURRENT_MONITOR' 'SR01CPS05:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... +'1HCM3 ' 'SR01CPS09:CURRENT_MONITOR' 'SR01CPS09:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... +'2HCM1 ' 'SR02CPS01:CURRENT_MONITOR' 'SR02CPS01:CURRENT_SP ' 1 [2,1] 4 1.000 ; ... +'2HCM2 ' 'SR02CPS05:CURRENT_MONITOR' 'SR02CPS05:CURRENT_SP ' 1 [2,2] 5 1.000 ; ... +'2HCM3 ' 'SR02CPS09:CURRENT_MONITOR' 'SR02CPS09:CURRENT_SP ' 1 [2,3] 6 1.000 ; ... +'3HCM1 ' 'SR03CPS01:CURRENT_MONITOR' 'SR03CPS01:CURRENT_SP ' 1 [3,1] 7 1.000 ; ... +'3HCM2 ' 'SR03CPS05:CURRENT_MONITOR' 'SR03CPS05:CURRENT_SP ' 1 [3,2] 8 1.000 ; ... +'3HCM3 ' 'SR03CPS09:CURRENT_MONITOR' 'SR03CPS09:CURRENT_SP ' 1 [3,3] 9 1.000 ; ... +'4HCM1 ' 'SR04CPS01:CURRENT_MONITOR' 'SR04CPS01:CURRENT_SP ' 1 [4,1] 10 1.000 ; ... +'4HCM2 ' 'SR04CPS05:CURRENT_MONITOR' 'SR04CPS05:CURRENT_SP ' 1 [4,2] 11 1.000 ; ... +'4HCM3 ' 'SR04CPS09:CURRENT_MONITOR' 'SR04CPS09:CURRENT_SP ' 1 [4,3] 12 1.000 ; ... +'5HCM1 ' 'SR05CPS01:CURRENT_MONITOR' 'SR05CPS01:CURRENT_SP ' 1 [5,1] 13 1.000 ; ... +'5HCM2 ' 'SR05CPS05:CURRENT_MONITOR' 'SR05CPS05:CURRENT_SP ' 1 [5,2] 14 1.000 ; ... +'5HCM3 ' 'SR05CPS09:CURRENT_MONITOR' 'SR05CPS09:CURRENT_SP ' 1 [5,3] 15 1.000 ; ... +'6HCM1 ' 'SR06CPS01:CURRENT_MONITOR' 'SR06CPS01:CURRENT_SP ' 1 [6,1] 16 1.000 ; ... +'6HCM2 ' 'SR06CPS05:CURRENT_MONITOR' 'SR06CPS05:CURRENT_SP ' 1 [6,2] 17 1.000 ; ... +'6HCM3 ' 'SR06CPS09:CURRENT_MONITOR' 'SR06CPS09:CURRENT_SP ' 1 [6,3] 18 1.000 ; ... +'7HCM1 ' 'SR07CPS01:CURRENT_MONITOR' 'SR07CPS01:CURRENT_SP ' 1 [7,1] 19 1.000 ; ... +'7HCM2 ' 'SR07CPS05:CURRENT_MONITOR' 'SR07CPS05:CURRENT_SP ' 1 [7,2] 20 1.000 ; ... +'7HCM3 ' 'SR07CPS09:CURRENT_MONITOR' 'SR07CPS09:CURRENT_SP ' 1 [7,3] 21 1.000 ; ... +'8HCM1 ' 'SR08CPS01:CURRENT_MONITOR' 'SR08CPS01:CURRENT_SP ' 1 [8,1] 22 1.000 ; ... +'8HCM2 ' 'SR08CPS05:CURRENT_MONITOR' 'SR08CPS05:CURRENT_SP ' 1 [8,2] 23 1.000 ; ... +'8HCM3 ' 'SR08CPS09:CURRENT_MONITOR' 'SR08CPS09:CURRENT_SP ' 1 [8,3] 24 1.000 ; ... +'9HCM1 ' 'SR09CPS01:CURRENT_MONITOR' 'SR09CPS01:CURRENT_SP ' 1 [9,1] 25 1.000 ; ... +'9HCM2 ' 'SR09CPS05:CURRENT_MONITOR' 'SR09CPS05:CURRENT_SP ' 1 [9,2] 26 1.000 ; ... +'9HCM3 ' 'SR09CPS09:CURRENT_MONITOR' 'SR09CPS09:CURRENT_SP ' 1 [9,3] 27 1.000 ; ... +'10HCM1 ' 'SR10CPS01:CURRENT_MONITOR' 'SR10CPS01:CURRENT_SP ' 1 [10,1] 28 1.000 ; ... +'10HCM2 ' 'SR10CPS05:CURRENT_MONITOR' 'SR10CPS05:CURRENT_SP ' 1 [10,2] 29 1.000 ; ... +'10HCM3 ' 'SR10CPS09:CURRENT_MONITOR' 'SR10CPS09:CURRENT_SP ' 1 [10,3] 30 1.000 ; ... +'11HCM1 ' 'SR11CPS01:CURRENT_MONITOR' 'SR11CPS01:CURRENT_SP ' 1 [11,1] 31 1.000 ; ... +'11HCM2 ' 'SR11CPS05:CURRENT_MONITOR' 'SR11CPS05:CURRENT_SP ' 1 [11,2] 32 1.000 ; ... +'11HCM3 ' 'SR11CPS09:CURRENT_MONITOR' 'SR11CPS09:CURRENT_SP ' 1 [11,3] 33 1.000 ; ... +'12HCM1 ' 'SR12CPS01:CURRENT_MONITOR' 'SR12CPS01:CURRENT_SP ' 1 [12,1] 34 1.000 ; ... +'12HCM2 ' 'SR12CPS05:CURRENT_MONITOR' 'SR12CPS05:CURRENT_SP ' 1 [12,2] 35 1.000 ; ... +'12HCM3 ' 'SR12CPS09:CURRENT_MONITOR' 'SR12CPS09:CURRENT_SP ' 1 [12,3] 36 1.000 ; ... +'13HCM1 ' 'SR13CPS01:CURRENT_MONITOR' 'SR13CPS01:CURRENT_SP ' 1 [13,1] 37 1.000 ; ... +'13HCM2 ' 'SR13CPS05:CURRENT_MONITOR' 'SR13CPS05:CURRENT_SP ' 1 [13,2] 38 1.000 ; ... +'13HCM3 ' 'SR13CPS09:CURRENT_MONITOR' 'SR13CPS09:CURRENT_SP ' 1 [13,3] 39 1.000 ; ... +'14HCM1 ' 'SR14CPS01:CURRENT_MONITOR' 'SR14CPS01:CURRENT_SP ' 1 [14,1] 40 1.000 ; ... +'14HCM2 ' 'SR14CPS05:CURRENT_MONITOR' 'SR14CPS05:CURRENT_SP ' 1 [14,2] 41 1.000 ; ... +'14HCM3 ' 'SR14CPS09:CURRENT_MONITOR' 'SR14CPS09:CURRENT_SP ' 1 [14,3] 42 1.000 ; ... +}; + +[C, Leff, MagnetType] = magnetcoefficients('HCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.HCM.Status(ii,1) = val; +val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; + +AO.HCM.Setpoint.Range(ii,:) = [-90 +90]; +AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + + +AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); +AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'}; + +AO.VCM.Monitor.Mode = Mode; +AO.VCM.Monitor.DataType = 'Scalar'; +AO.VCM.Monitor.Units = 'Hardware'; +AO.VCM.Monitor.HWUnits = 'ampere'; +AO.VCM.Monitor.PhysicsUnits = 'radian'; +AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.VCM.Monitor.Physics2HWFcn = @k2amp; + +AO.VCM.Setpoint.Mode = Mode; +AO.VCM.Setpoint.DataType = 'Scalar'; +AO.VCM.Setpoint.Units = 'Hardware'; +AO.VCM.Setpoint.HWUnits = 'ampere'; +AO.VCM.Setpoint.PhysicsUnits = 'radian'; +AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.VCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian ** radian units converted to ampere below *** +% y-common y-monitor y-setpoint stat devlist elem +cor={ +'1VCM1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:CURRENT_SP ' 1 [1,1] 1 1.000 ; ... +'1VCM2 ' 'SR01CPS04:CURRENT_MONITOR' 'SR01CPS04:CURRENT_SP ' 1 [1,2] 2 1.000 ; ... +'1VCM3 ' 'SR01CPS06:CURRENT_MONITOR' 'SR01CPS06:CURRENT_SP ' 1 [1,3] 3 1.000 ; ... +'1VCM4 ' 'SR01CPS07:CURRENT_MONITOR' 'SR01CPS07:CURRENT_SP ' 1 [1,4] 4 1.000 ; ... +'2VCM1 ' 'SR02CPS02:CURRENT_MONITOR' 'SR02CPS02:CURRENT_SP ' 1 [2,1] 5 1.000 ; ... +'2VCM2 ' 'SR02CPS04:CURRENT_MONITOR' 'SR02CPS04:CURRENT_SP ' 1 [2,2] 6 1.000 ; ... +'2VCM3 ' 'SR02CPS06:CURRENT_MONITOR' 'SR02CPS06:CURRENT_SP ' 1 [2,3] 7 1.000 ; ... +'2VCM4 ' 'SR02CPS07:CURRENT_MONITOR' 'SR02CPS07:CURRENT_SP ' 1 [2,4] 8 1.000 ; ... +'3VCM1 ' 'SR03CPS02:CURRENT_MONITOR' 'SR03CPS02:CURRENT_SP ' 1 [3,1] 9 1.000 ; ... +'3VCM2 ' 'SR03CPS04:CURRENT_MONITOR' 'SR03CPS04:CURRENT_SP ' 1 [3,2] 10 1.000 ; ... +'3VCM3 ' 'SR03CPS06:CURRENT_MONITOR' 'SR03CPS06:CURRENT_SP ' 1 [3,3] 11 1.000 ; ... +'3VCM4 ' 'SR03CPS07:CURRENT_MONITOR' 'SR03CPS07:CURRENT_SP ' 1 [3,4] 12 1.000 ; ... +'4VCM1 ' 'SR04CPS02:CURRENT_MONITOR' 'SR04CPS02:CURRENT_SP ' 1 [4,1] 13 1.000 ; ... +'4VCM2 ' 'SR04CPS04:CURRENT_MONITOR' 'SR04CPS04:CURRENT_SP ' 1 [4,2] 14 1.000 ; ... +'4VCM3 ' 'SR04CPS06:CURRENT_MONITOR' 'SR04CPS06:CURRENT_SP ' 1 [4,3] 15 1.000 ; ... +'4VCM4 ' 'SR04CPS07:CURRENT_MONITOR' 'SR04CPS07:CURRENT_SP ' 1 [4,4] 16 1.000 ; ... +'5VCM1 ' 'SR05CPS02:CURRENT_MONITOR' 'SR05CPS02:CURRENT_SP ' 1 [5,1] 17 1.000 ; ... +'5VCM2 ' 'SR05CPS04:CURRENT_MONITOR' 'SR05CPS04:CURRENT_SP ' 1 [5,2] 18 1.000 ; ... +'5VCM3 ' 'SR05CPS06:CURRENT_MONITOR' 'SR05CPS06:CURRENT_SP ' 1 [5,3] 19 1.000 ; ... +'5VCM4 ' 'SR05CPS07:CURRENT_MONITOR' 'SR05CPS07:CURRENT_SP ' 1 [5,4] 20 1.000 ; ... +'6VCM1 ' 'SR06CPS02:CURRENT_MONITOR' 'SR06CPS02:CURRENT_SP ' 1 [6,1] 21 1.000 ; ... +'6VCM2 ' 'SR06CPS04:CURRENT_MONITOR' 'SR06CPS04:CURRENT_SP ' 1 [6,2] 22 1.000 ; ... +'6VCM3 ' 'SR06CPS06:CURRENT_MONITOR' 'SR06CPS06:CURRENT_SP ' 1 [6,3] 23 1.000 ; ... +'6VCM4 ' 'SR06CPS07:CURRENT_MONITOR' 'SR06CPS07:CURRENT_SP ' 1 [6,4] 24 1.000 ; ... +'7VCM1 ' 'SR07CPS02:CURRENT_MONITOR' 'SR07CPS02:CURRENT_SP ' 1 [7,1] 25 1.000 ; ... +'7VCM2 ' 'SR07CPS04:CURRENT_MONITOR' 'SR07CPS04:CURRENT_SP ' 1 [7,2] 26 1.000 ; ... +'7VCM3 ' 'SR07CPS06:CURRENT_MONITOR' 'SR07CPS06:CURRENT_SP ' 1 [7,3] 27 1.000 ; ... +'7VCM4 ' 'SR07CPS07:CURRENT_MONITOR' 'SR07CPS07:CURRENT_SP ' 1 [7,4] 28 1.000 ; ... +'8VCM1 ' 'SR08CPS02:CURRENT_MONITOR' 'SR08CPS02:CURRENT_SP ' 1 [8,1] 29 1.000 ; ... +'8VCM2 ' 'SR08CPS04:CURRENT_MONITOR' 'SR08CPS04:CURRENT_SP ' 1 [8,2] 30 1.000 ; ... +'8VCM3 ' 'SR08CPS06:CURRENT_MONITOR' 'SR08CPS06:CURRENT_SP ' 1 [8,3] 31 1.000 ; ... +'8VCM4 ' 'SR08CPS07:CURRENT_MONITOR' 'SR08CPS07:CURRENT_SP ' 1 [8,4] 32 1.000 ; ... +'9VCM1 ' 'SR09CPS02:CURRENT_MONITOR' 'SR09CPS02:CURRENT_SP ' 1 [9,1] 33 1.000 ; ... +'9VCM2 ' 'SR09CPS04:CURRENT_MONITOR' 'SR09CPS04:CURRENT_SP ' 1 [9,2] 34 1.000 ; ... +'9VCM3 ' 'SR09CPS06:CURRENT_MONITOR' 'SR09CPS06:CURRENT_SP ' 1 [9,3] 35 1.000 ; ... +'9VCM4 ' 'SR09CPS07:CURRENT_MONITOR' 'SR09CPS07:CURRENT_SP ' 1 [9,4] 36 1.000 ; ... +'10VCM1 ' 'SR10CPS02:CURRENT_MONITOR' 'SR10CPS02:CURRENT_SP ' 1 [10,1] 37 1.000 ; ... +'10VCM2 ' 'SR10CPS04:CURRENT_MONITOR' 'SR10CPS04:CURRENT_SP ' 1 [10,2] 38 1.000 ; ... +'10VCM3 ' 'SR10CPS06:CURRENT_MONITOR' 'SR10CPS06:CURRENT_SP ' 1 [10,3] 39 1.000 ; ... +'10VCM4 ' 'SR10CPS07:CURRENT_MONITOR' 'SR10CPS07:CURRENT_SP ' 1 [10,4] 40 1.000 ; ... +'11VCM1 ' 'SR11CPS02:CURRENT_MONITOR' 'SR11CPS02:CURRENT_SP ' 1 [11,1] 41 1.000 ; ... +'11VCM2 ' 'SR11CPS04:CURRENT_MONITOR' 'SR11CPS04:CURRENT_SP ' 1 [11,2] 42 1.000 ; ... +'11VCM3 ' 'SR11CPS06:CURRENT_MONITOR' 'SR11CPS06:CURRENT_SP ' 1 [11,3] 43 1.000 ; ... +'11VCM4 ' 'SR11CPS07:CURRENT_MONITOR' 'SR11CPS07:CURRENT_SP ' 1 [11,4] 44 1.000 ; ... +'12VCM1 ' 'SR12CPS02:CURRENT_MONITOR' 'SR12CPS02:CURRENT_SP ' 1 [12,1] 45 1.000 ; ... +'12VCM2 ' 'SR12CPS04:CURRENT_MONITOR' 'SR12CPS04:CURRENT_SP ' 1 [12,2] 46 1.000 ; ... +'12VCM3 ' 'SR12CPS06:CURRENT_MONITOR' 'SR12CPS06:CURRENT_SP ' 1 [12,3] 47 1.000 ; ... +'12VCM4 ' 'SR12CPS07:CURRENT_MONITOR' 'SR12CPS07:CURRENT_SP ' 1 [12,4] 48 1.000 ; ... +'13VCM1 ' 'SR13CPS02:CURRENT_MONITOR' 'SR13CPS02:CURRENT_SP ' 1 [13,1] 49 1.000 ; ... +'13VCM2 ' 'SR13CPS04:CURRENT_MONITOR' 'SR13CPS04:CURRENT_SP ' 1 [13,2] 50 1.000 ; ... +'13VCM3 ' 'SR13CPS06:CURRENT_MONITOR' 'SR13CPS06:CURRENT_SP ' 1 [13,3] 51 1.000 ; ... +'13VCM4 ' 'SR13CPS07:CURRENT_MONITOR' 'SR13CPS07:CURRENT_SP ' 1 [13,4] 52 1.000 ; ... +'14VCM1 ' 'SR14CPS02:CURRENT_MONITOR' 'SR14CPS02:CURRENT_SP ' 1 [14,1] 53 1.000 ; ... +'14VCM2 ' 'SR14CPS04:CURRENT_MONITOR' 'SR14CPS04:CURRENT_SP ' 1 [14,2] 54 1.000 ; ... +'14VCM3 ' 'SR14CPS06:CURRENT_MONITOR' 'SR14CPS06:CURRENT_SP ' 1 [14,3] 55 1.000 ; ... +'14VCM4 ' 'SR14CPS07:CURRENT_MONITOR' 'SR14CPS07:CURRENT_SP ' 1 [14,4] 56 1.000 ; ... +}; + +[C, Leff, MagnetType] = magnetcoefficients('VCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.VCM.Status(ii,1) = val; +val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; + +AO.VCM.Setpoint.Range(ii,:) = [-125 +125]; +AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + + +%============================= +% MAIN MAGNETS +%============================= + +%=========== +%Dipole data +%=========== + +% *** BEND *** +AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); +AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('BEND'); +Physics2HWParams = magnetcoefficients('BEND'); + +AO.BEND.Monitor.Mode = Mode; +AO.BEND.Monitor.DataType = 'Scalar'; +AO.BEND.Monitor.Units = 'Hardware'; +AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? +AO.BEND.Monitor.Physics2HWFcn = @gev2bend; +AO.BEND.Monitor.HWUnits = 'ampere'; +AO.BEND.Monitor.PhysicsUnits = 'energy'; + +AO.BEND.Setpoint.Mode = Mode; +AO.BEND.Setpoint.DataType = 'Scalar'; +AO.BEND.Setpoint.Units = 'Hardware'; +AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; +AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; +AO.BEND.Setpoint.HWUnits = 'ampere'; +AO.BEND.Setpoint.PhysicsUnits = 'energy'; + +% common monitor setpoint stat devlist elem scale tol +bend={ +'1BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.10 ; ... +'1BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [1,2] 2 1.0 0.10 ; ... +'2BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.10 ; ... +'2BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [2,2] 4 1.0 0.10 ; ... +'3BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.10 ; ... +'3BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [3,2] 6 1.0 0.10 ; ... +'4BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.10 ; ... +'4BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [4,2] 8 1.0 0.10 ; ... +'5BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.10 ; ... +'5BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [5,2] 10 1.0 0.10 ; ... +'6BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.10 ; ... +'6BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [6,2] 12 1.0 0.10 ; ... +'7BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.10 ; ... +'7BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [7,2] 14 1.0 0.10 ; ... +'8BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.10 ; ... +'8BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [8,2] 16 1.0 0.10 ; ... +'9BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.10 ; ... +'9BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [9,2] 18 1.0 0.10 ; ... +'10BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.10 ; ... +'10BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [10,2] 20 1.0 0.10 ; ... +'11BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.10 ; ... +'11BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [11,2] 22 1.0 0.10 ; ... +'12BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.10 ; ... +'12BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [12,2] 24 1.0 0.10 ; ... +'13BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.10 ; ... +'13BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [13,2] 26 1.0 0.10 ; ... +'14BEND1 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.10 ; ... +'14BEND2 ' 'SR00DPS01:CURRENT_MONITOR' 'SR00DPS01:CURRENT_SP ' 1 [14,2] 28 1.0 0.10 ; ... +}; + +for ii=1:size(bend,1) +name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; +name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; +name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; +val =bend{ii,4}; AO.BEND.Status(ii,1) = val; +val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; +val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; +val =bend{ii,7}; % This is the scale factor +AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; + +AO.BEND.Setpoint.Range(ii,:) = [50 695]; +end + +%=============== +%Quadrupole data +%=============== + +% *** QFA *** +AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); +AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFA'); +Physics2HWParams = magnetcoefficients('QFA'); + +AO.QFA.Monitor.Mode = Mode; +AO.QFA.Monitor.DataType = 'Scalar'; +AO.QFA.Monitor.Units = 'Hardware'; +AO.QFA.Monitor.HWUnits = 'ampere'; +AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFA.Monitor.Physics2HWFcn = @k2amp; + +AO.QFA.Setpoint.Mode = Mode; +AO.QFA.Setpoint.DataType = 'Scalar'; +AO.QFA.Setpoint.Units = 'Hardware'; +AO.QFA.Setpoint.HWUnits = 'ampere'; +AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qfa={ +'1QFA1 ' 'SR01QPS01:CURRENT_MONITOR' 'SR01QPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1QFA2 ' 'SR01QPS06:CURRENT_MONITOR' 'SR01QPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2QFA1 ' 'SR02QPS01:CURRENT_MONITOR' 'SR02QPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2QFA2 ' 'SR02QPS06:CURRENT_MONITOR' 'SR02QPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... +'3QFA1 ' 'SR03QPS01:CURRENT_MONITOR' 'SR03QPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3QFA2 ' 'SR03QPS06:CURRENT_MONITOR' 'SR03QPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4QFA1 ' 'SR04QPS01:CURRENT_MONITOR' 'SR04QPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4QFA2 ' 'SR04QPS06:CURRENT_MONITOR' 'SR04QPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5QFA1 ' 'SR05QPS01:CURRENT_MONITOR' 'SR05QPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5QFA2 ' 'SR05QPS06:CURRENT_MONITOR' 'SR05QPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6QFA1 ' 'SR06QPS01:CURRENT_MONITOR' 'SR06QPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6QFA2 ' 'SR06QPS06:CURRENT_MONITOR' 'SR06QPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7QFA1 ' 'SR07QPS01:CURRENT_MONITOR' 'SR07QPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7QFA2 ' 'SR07QPS06:CURRENT_MONITOR' 'SR07QPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8QFA1 ' 'SR08QPS01:CURRENT_MONITOR' 'SR08QPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8QFA2 ' 'SR08QPS06:CURRENT_MONITOR' 'SR08QPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9QFA1 ' 'SR09QPS01:CURRENT_MONITOR' 'SR09QPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9QFA2 ' 'SR09QPS06:CURRENT_MONITOR' 'SR09QPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10QFA1 ' 'SR10QPS01:CURRENT_MONITOR' 'SR10QPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10QFA2 ' 'SR10QPS06:CURRENT_MONITOR' 'SR10QPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11QFA1 ' 'SR11QPS01:CURRENT_MONITOR' 'SR11QPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11QFA2 ' 'SR11QPS06:CURRENT_MONITOR' 'SR11QPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12QFA1 ' 'SR12QPS01:CURRENT_MONITOR' 'SR12QPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12QFA2 ' 'SR12QPS06:CURRENT_MONITOR' 'SR12QPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13QFA1 ' 'SR13QPS01:CURRENT_MONITOR' 'SR13QPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13QFA2 ' 'SR13QPS06:CURRENT_MONITOR' 'SR13QPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14QFA1 ' 'SR14QPS01:CURRENT_MONITOR' 'SR14QPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14QFA2 ' 'SR14QPS06:CURRENT_MONITOR' 'SR14QPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +for ii=1:size(qfa,1) +name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; +name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; +name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; +val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; +val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; +val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; +val =qfa{ii,7}; % This is the scale factor +AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; + +% Important! This determines the cycling range +AO.QFA.Setpoint.Range(ii,:) = [0 160]; +end + + +% *** QDA *** +AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); +AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; +HW2PhysicsParams = magnetcoefficients('QDA'); +Physics2HWParams = magnetcoefficients('QDA'); + +AO.QDA.Monitor.Mode = Mode; +AO.QDA.Monitor.DataType = 'Scalar'; +AO.QDA.Monitor.Units = 'Hardware'; +AO.QDA.Monitor.HWUnits = 'ampere'; +AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QDA.Monitor.Physics2HWFcn = @k2amp; + +AO.QDA.Setpoint.Mode = Mode; +AO.QDA.Setpoint.DataType = 'Scalar'; +AO.QDA.Setpoint.Units = 'Hardware'; +AO.QDA.Setpoint.HWUnits = 'ampere'; +AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QDA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qda={ +'1QDA1 ' 'SR01QPS02:CURRENT_MONITOR' 'SR01QPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1QDA2 ' 'SR01QPS05:CURRENT_MONITOR' 'SR01QPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2QDA1 ' 'SR02QPS02:CURRENT_MONITOR' 'SR02QPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2QDA2 ' 'SR02QPS05:CURRENT_MONITOR' 'SR02QPS05:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... +'3QDA1 ' 'SR03QPS02:CURRENT_MONITOR' 'SR03QPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3QDA2 ' 'SR03QPS05:CURRENT_MONITOR' 'SR03QPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4QDA1 ' 'SR04QPS02:CURRENT_MONITOR' 'SR04QPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4QDA2 ' 'SR04QPS05:CURRENT_MONITOR' 'SR04QPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5QDA1 ' 'SR05QPS02:CURRENT_MONITOR' 'SR05QPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5QDA2 ' 'SR05QPS05:CURRENT_MONITOR' 'SR05QPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6QDA1 ' 'SR06QPS02:CURRENT_MONITOR' 'SR06QPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6QDA2 ' 'SR06QPS05:CURRENT_MONITOR' 'SR06QPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7QDA1 ' 'SR07QPS02:CURRENT_MONITOR' 'SR07QPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7QDA2 ' 'SR07QPS05:CURRENT_MONITOR' 'SR07QPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8QDA1 ' 'SR08QPS02:CURRENT_MONITOR' 'SR08QPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8QDA2 ' 'SR08QPS05:CURRENT_MONITOR' 'SR08QPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9QDA1 ' 'SR09QPS02:CURRENT_MONITOR' 'SR09QPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9QDA2 ' 'SR09QPS05:CURRENT_MONITOR' 'SR09QPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10QDA1 ' 'SR10QPS02:CURRENT_MONITOR' 'SR10QPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10QDA2 ' 'SR10QPS05:CURRENT_MONITOR' 'SR10QPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11QDA1 ' 'SR11QPS02:CURRENT_MONITOR' 'SR11QPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11QDA2 ' 'SR11QPS05:CURRENT_MONITOR' 'SR11QPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12QDA1 ' 'SR12QPS02:CURRENT_MONITOR' 'SR12QPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12QDA2 ' 'SR12QPS05:CURRENT_MONITOR' 'SR12QPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13QDA1 ' 'SR13QPS02:CURRENT_MONITOR' 'SR13QPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13QDA2 ' 'SR13QPS05:CURRENT_MONITOR' 'SR13QPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14QDA1 ' 'SR14QPS02:CURRENT_MONITOR' 'SR14QPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14QDA2 ' 'SR14QPS05:CURRENT_MONITOR' 'SR14QPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +for ii=1:size(qda,1) +name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; +name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; +name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; +val =qda{ii,4}; AO.QDA.Status(ii,1) = val; +val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; +val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; +val =qda{ii,7}; % This is the scale factor +AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; + +% Important! This determines the cycling range +AO.QDA.Setpoint.Range(ii,:) = [0 90]; +end + + + +% *** QFB *** +AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); +AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFB'); +Physics2HWParams = magnetcoefficients('QFB'); + +AO.QFB.Monitor.Mode = Mode; +AO.QFB.Monitor.DataType = 'Scalar'; +AO.QFB.Monitor.Units = 'Hardware'; +AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFB.Monitor.Physics2HWFcn = @k2amp; +AO.QFB.Monitor.HWUnits = 'ampere'; +AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; + +AO.QFB.Setpoint.Mode = Mode; +AO.QFB.Setpoint.DataType = 'Scalar'; +AO.QFB.Setpoint.Units = 'Hardware'; +AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFB.Setpoint.Physics2HWFcn = @k2amp; +AO.QFB.Setpoint.HWUnits = 'ampere'; +AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +qfb={ +'1QFB1 ' 'SR01QPS03:CURRENT_MONITOR' 'SR01QPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1QFB2 ' 'SR01QPS04:CURRENT_MONITOR' 'SR01QPS04:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2QFB1 ' 'SR02QPS03:CURRENT_MONITOR' 'SR02QPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2QFB2 ' 'SR02QPS04:CURRENT_MONITOR' 'SR02QPS04:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... +'3QFB1 ' 'SR03QPS03:CURRENT_MONITOR' 'SR03QPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3QFB2 ' 'SR03QPS04:CURRENT_MONITOR' 'SR03QPS04:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4QFB1 ' 'SR04QPS03:CURRENT_MONITOR' 'SR04QPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4QFB2 ' 'SR04QPS04:CURRENT_MONITOR' 'SR04QPS04:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5QFB1 ' 'SR05QPS03:CURRENT_MONITOR' 'SR05QPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5QFB2 ' 'SR05QPS04:CURRENT_MONITOR' 'SR05QPS04:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6QFB1 ' 'SR06QPS03:CURRENT_MONITOR' 'SR06QPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6QFB2 ' 'SR06QPS04:CURRENT_MONITOR' 'SR06QPS04:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7QFB1 ' 'SR07QPS03:CURRENT_MONITOR' 'SR07QPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7QFB2 ' 'SR07QPS04:CURRENT_MONITOR' 'SR07QPS04:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8QFB1 ' 'SR08QPS03:CURRENT_MONITOR' 'SR08QPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8QFB2 ' 'SR08QPS04:CURRENT_MONITOR' 'SR08QPS04:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9QFB1 ' 'SR09QPS03:CURRENT_MONITOR' 'SR09QPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9QFB2 ' 'SR09QPS04:CURRENT_MONITOR' 'SR09QPS04:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10QFB1 ' 'SR10QPS03:CURRENT_MONITOR' 'SR10QPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10QFB2 ' 'SR10QPS04:CURRENT_MONITOR' 'SR10QPS04:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11QFB1 ' 'SR11QPS03:CURRENT_MONITOR' 'SR11QPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11QFB2 ' 'SR11QPS04:CURRENT_MONITOR' 'SR11QPS04:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12QFB1 ' 'SR12QPS03:CURRENT_MONITOR' 'SR12QPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12QFB2 ' 'SR12QPS04:CURRENT_MONITOR' 'SR12QPS04:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13QFB1 ' 'SR13QPS03:CURRENT_MONITOR' 'SR13QPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13QFB2 ' 'SR13QPS04:CURRENT_MONITOR' 'SR13QPS04:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14QFB1 ' 'SR14QPS03:CURRENT_MONITOR' 'SR14QPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14QFB2 ' 'SR14QPS04:CURRENT_MONITOR' 'SR14QPS04:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +for ii=1:size(qfb,1) +name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; +name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; +name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; +val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; +val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; +val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; +val =qfb{ii,7}; % This is the scale factor +AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; + +% Important! This determines the cycling range +AO.QFB.Setpoint.Range(ii,:) = [0 160]; +end + + +%=============== +%Sextupole data +%=============== +% *** SFA *** +AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); +AO.SFA.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFA'); +Physics2HWParams = magnetcoefficients('SFA'); + +AO.SFA.Monitor.Mode = Mode; +AO.SFA.Monitor.DataType = 'Scalar'; +AO.SFA.Monitor.Units = 'Hardware'; +AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFA.Monitor.Physics2HWFcn = @k2amp; +AO.SFA.Monitor.HWUnits = 'ampere'; +AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFA.Setpoint.Mode = Mode; +AO.SFA.Setpoint.DataType = 'Scalar'; +AO.SFA.Setpoint.Units = 'Hardware'; +AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFA.Setpoint.Physics2HWFcn = @k2amp; +AO.SFA.Setpoint.HWUnits = 'ampere'; +AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfa={ +'1SFA1 ' 'SR01SPS01:CURRENT_MONITOR' 'SR01SPS01:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1SFA2 ' 'SR01SPS07:CURRENT_MONITOR' 'SR01SPS07:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2SFA1 ' 'SR02SPS01:CURRENT_MONITOR' 'SR02SPS01:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2SFA2 ' 'SR02SPS07:CURRENT_MONITOR' 'SR02SPS07:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... +'3SFA1 ' 'SR03SPS01:CURRENT_MONITOR' 'SR03SPS01:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3SFA2 ' 'SR03SPS07:CURRENT_MONITOR' 'SR03SPS07:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4SFA1 ' 'SR04SPS01:CURRENT_MONITOR' 'SR04SPS01:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4SFA2 ' 'SR04SPS07:CURRENT_MONITOR' 'SR04SPS07:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5SFA1 ' 'SR05SPS01:CURRENT_MONITOR' 'SR05SPS01:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5SFA2 ' 'SR05SPS07:CURRENT_MONITOR' 'SR05SPS07:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6SFA1 ' 'SR06SPS01:CURRENT_MONITOR' 'SR06SPS01:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6SFA2 ' 'SR06SPS07:CURRENT_MONITOR' 'SR06SPS07:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7SFA1 ' 'SR07SPS01:CURRENT_MONITOR' 'SR07SPS01:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7SFA2 ' 'SR07SPS07:CURRENT_MONITOR' 'SR07SPS07:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8SFA1 ' 'SR08SPS01:CURRENT_MONITOR' 'SR08SPS01:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8SFA2 ' 'SR08SPS07:CURRENT_MONITOR' 'SR08SPS07:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9SFA1 ' 'SR09SPS01:CURRENT_MONITOR' 'SR09SPS01:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9SFA2 ' 'SR09SPS07:CURRENT_MONITOR' 'SR09SPS07:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10SFA1 ' 'SR10SPS01:CURRENT_MONITOR' 'SR10SPS01:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10SFA2 ' 'SR10SPS07:CURRENT_MONITOR' 'SR10SPS07:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11SFA1 ' 'SR11SPS01:CURRENT_MONITOR' 'SR11SPS01:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11SFA2 ' 'SR11SPS07:CURRENT_MONITOR' 'SR11SPS07:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12SFA1 ' 'SR12SPS01:CURRENT_MONITOR' 'SR12SPS01:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12SFA2 ' 'SR12SPS07:CURRENT_MONITOR' 'SR12SPS07:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13SFA1 ' 'SR13SPS01:CURRENT_MONITOR' 'SR13SPS01:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13SFA2 ' 'SR13SPS07:CURRENT_MONITOR' 'SR13SPS07:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14SFA1 ' 'SR14SPS01:CURRENT_MONITOR' 'SR14SPS01:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14SFA2 ' 'SR14SPS07:CURRENT_MONITOR' 'SR14SPS07:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +for ii=1:size(sfa,1) +name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; +name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; +name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; +val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; +val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; +val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; +val =sfa{ii,7}; % This is the scale factor +AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; + +AO.SFA.Setpoint.Range(ii,:) = [0 90]; +end + + + +% *** SDA *** +AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); +AO.SDA.MemberOf = {'PlotFamily'; 'SD'; 'SEXT'; 'MachineConfig'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDA'); +Physics2HWParams = magnetcoefficients('SDA'); +AO.SDA.Monitor.Mode = Mode; +AO.SDA.Monitor.DataType = 'Scalar'; +AO.SDA.Monitor.Units = 'Hardware'; +AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDA.Monitor.Physics2HWFcn = @k2amp; +AO.SDA.Monitor.HWUnits = 'ampere'; +AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDA.Setpoint.Mode = Mode; +AO.SDA.Setpoint.DataType = 'Scalar'; +AO.SDA.Setpoint.Units = 'Hardware'; +AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDA.Setpoint.Physics2HWFcn = @k2amp; +AO.SDA.Setpoint.HWUnits = 'ampere'; +AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; + + +% common monitor setpoint stat devlist elem scale tol +sda={ +'1SDA1 ' 'SR01SPS02:CURRENT_MONITOR' 'SR01SPS02:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1SDA2 ' 'SR01SPS06:CURRENT_MONITOR' 'SR01SPS06:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2SDA1 ' 'SR02SPS02:CURRENT_MONITOR' 'SR02SPS02:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2SDA2 ' 'SR02SPS06:CURRENT_MONITOR' 'SR02SPS06:CURRENT_SP ' 1 [2,2] 4 1.0 0.5 ; ... +'3SDA1 ' 'SR03SPS02:CURRENT_MONITOR' 'SR03SPS02:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3SDA2 ' 'SR03SPS06:CURRENT_MONITOR' 'SR03SPS06:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4SDA1 ' 'SR04SPS02:CURRENT_MONITOR' 'SR04SPS02:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4SDA2 ' 'SR04SPS06:CURRENT_MONITOR' 'SR04SPS06:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5SDA1 ' 'SR05SPS02:CURRENT_MONITOR' 'SR05SPS02:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5SDA2 ' 'SR05SPS06:CURRENT_MONITOR' 'SR05SPS06:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6SDA1 ' 'SR06SPS02:CURRENT_MONITOR' 'SR06SPS02:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6SDA2 ' 'SR06SPS06:CURRENT_MONITOR' 'SR06SPS06:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7SDA1 ' 'SR07SPS02:CURRENT_MONITOR' 'SR07SPS02:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7SDA2 ' 'SR07SPS06:CURRENT_MONITOR' 'SR07SPS06:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8SDA1 ' 'SR08SPS02:CURRENT_MONITOR' 'SR08SPS02:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8SDA2 ' 'SR08SPS06:CURRENT_MONITOR' 'SR08SPS06:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9SDA1 ' 'SR09SPS02:CURRENT_MONITOR' 'SR09SPS02:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9SDA2 ' 'SR09SPS06:CURRENT_MONITOR' 'SR09SPS06:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10SDA1 ' 'SR10SPS02:CURRENT_MONITOR' 'SR10SPS02:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10SDA2 ' 'SR10SPS06:CURRENT_MONITOR' 'SR10SPS06:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11SDA1 ' 'SR11SPS02:CURRENT_MONITOR' 'SR11SPS02:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11SDA2 ' 'SR11SPS06:CURRENT_MONITOR' 'SR11SPS06:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12SDA1 ' 'SR12SPS02:CURRENT_MONITOR' 'SR12SPS02:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12SDA2 ' 'SR12SPS06:CURRENT_MONITOR' 'SR12SPS06:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13SDA1 ' 'SR13SPS02:CURRENT_MONITOR' 'SR13SPS02:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13SDA2 ' 'SR13SPS06:CURRENT_MONITOR' 'SR13SPS06:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14SDA1 ' 'SR14SPS02:CURRENT_MONITOR' 'SR14SPS02:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14SDA2 ' 'SR14SPS06:CURRENT_MONITOR' 'SR14SPS06:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +for ii=1:size(sda,1) +name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; +name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; +name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; +val =sda{ii,4}; AO.SDA.Status(ii,1) = val; +val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; +val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; +val =sda{ii,7}; % This is the scale factor +AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; + +AO.SDA.Setpoint.Range(ii,:) = [0 90]; +end + + +% *** SDB *** +AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); +AO.SDB.MemberOf = {'PlotFamily'; 'SD'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDB'); +Physics2HWParams = magnetcoefficients('SDB'); +AO.SDB.Monitor.Mode = Mode; +AO.SDB.Monitor.DataType = 'Scalar'; +AO.SDB.Monitor.Units = 'Hardware'; +AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDB.Monitor.Physics2HWFcn = @k2amp; +AO.SDB.Monitor.HWUnits = 'ampere'; +AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDB.Setpoint.Mode = Mode; +AO.SDB.Setpoint.DataType = 'Scalar'; +AO.SDB.Setpoint.Units = 'Hardware'; +AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDB.Setpoint.Physics2HWFcn = @k2amp; +AO.SDB.Setpoint.HWUnits = 'ampere'; +AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sdb={ +'1SDB1 ' 'SR01SPS03:CURRENT_MONITOR' 'SR01SPS03:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'1SDB2 ' 'SR01SPS05:CURRENT_MONITOR' 'SR01SPS05:CURRENT_SP ' 1 [1,2] 2 1.0 0.5 ; ... +'2SDB1 ' 'SR02SPS03:CURRENT_MONITOR' 'SR02SPS03:CURRENT_SP ' 1 [2,1] 3 1.0 0.5 ; ... +'2SDB2 ' 'SR02SPS05:CURRENT_MONITOR' 'SR02SPS05:CURRENT_SP ' 1 [2,2] 4 1.0 3.0 ; ... +'3SDB1 ' 'SR03SPS03:CURRENT_MONITOR' 'SR03SPS03:CURRENT_SP ' 1 [3,1] 5 1.0 0.5 ; ... +'3SDB2 ' 'SR03SPS05:CURRENT_MONITOR' 'SR03SPS05:CURRENT_SP ' 1 [3,2] 6 1.0 0.5 ; ... +'4SDB1 ' 'SR04SPS03:CURRENT_MONITOR' 'SR04SPS03:CURRENT_SP ' 1 [4,1] 7 1.0 0.5 ; ... +'4SDB2 ' 'SR04SPS05:CURRENT_MONITOR' 'SR04SPS05:CURRENT_SP ' 1 [4,2] 8 1.0 0.5 ; ... +'5SDB1 ' 'SR05SPS03:CURRENT_MONITOR' 'SR05SPS03:CURRENT_SP ' 1 [5,1] 9 1.0 0.5 ; ... +'5SDB2 ' 'SR05SPS05:CURRENT_MONITOR' 'SR05SPS05:CURRENT_SP ' 1 [5,2] 10 1.0 0.5 ; ... +'6SDB1 ' 'SR06SPS03:CURRENT_MONITOR' 'SR06SPS03:CURRENT_SP ' 1 [6,1] 11 1.0 0.5 ; ... +'6SDB2 ' 'SR06SPS05:CURRENT_MONITOR' 'SR06SPS05:CURRENT_SP ' 1 [6,2] 12 1.0 0.5 ; ... +'7SDB1 ' 'SR07SPS03:CURRENT_MONITOR' 'SR07SPS03:CURRENT_SP ' 1 [7,1] 13 1.0 0.5 ; ... +'7SDB2 ' 'SR07SPS05:CURRENT_MONITOR' 'SR07SPS05:CURRENT_SP ' 1 [7,2] 14 1.0 0.5 ; ... +'8SDB1 ' 'SR08SPS03:CURRENT_MONITOR' 'SR08SPS03:CURRENT_SP ' 1 [8,1] 15 1.0 0.5 ; ... +'8SDB2 ' 'SR08SPS05:CURRENT_MONITOR' 'SR08SPS05:CURRENT_SP ' 1 [8,2] 16 1.0 0.5 ; ... +'9SDB1 ' 'SR09SPS03:CURRENT_MONITOR' 'SR09SPS03:CURRENT_SP ' 1 [9,1] 17 1.0 0.5 ; ... +'9SDB2 ' 'SR09SPS05:CURRENT_MONITOR' 'SR09SPS05:CURRENT_SP ' 1 [9,2] 18 1.0 0.5 ; ... +'10SDB1 ' 'SR10SPS03:CURRENT_MONITOR' 'SR10SPS03:CURRENT_SP ' 1 [10,1] 19 1.0 0.5 ; ... +'10SDB2 ' 'SR10SPS05:CURRENT_MONITOR' 'SR10SPS05:CURRENT_SP ' 1 [10,2] 20 1.0 0.5 ; ... +'11SDB1 ' 'SR11SPS03:CURRENT_MONITOR' 'SR11SPS03:CURRENT_SP ' 1 [11,1] 21 1.0 0.5 ; ... +'11SDB2 ' 'SR11SPS05:CURRENT_MONITOR' 'SR11SPS05:CURRENT_SP ' 1 [11,2] 22 1.0 0.5 ; ... +'12SDB1 ' 'SR12SPS03:CURRENT_MONITOR' 'SR12SPS03:CURRENT_SP ' 1 [12,1] 23 1.0 0.5 ; ... +'12SDB2 ' 'SR12SPS05:CURRENT_MONITOR' 'SR12SPS05:CURRENT_SP ' 1 [12,2] 24 1.0 0.5 ; ... +'13SDB1 ' 'SR13SPS03:CURRENT_MONITOR' 'SR13SPS03:CURRENT_SP ' 1 [13,1] 25 1.0 0.5 ; ... +'13SDB2 ' 'SR13SPS05:CURRENT_MONITOR' 'SR13SPS05:CURRENT_SP ' 1 [13,2] 26 1.0 0.5 ; ... +'14SDB1 ' 'SR14SPS03:CURRENT_MONITOR' 'SR14SPS03:CURRENT_SP ' 1 [14,1] 27 1.0 0.5 ; ... +'14SDB2 ' 'SR14SPS05:CURRENT_MONITOR' 'SR14SPS05:CURRENT_SP ' 1 [14,2] 28 1.0 0.5 ; ... +}; + +for ii=1:size(sdb,1) +name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; +name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; +name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; +val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; +val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; +val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; +val =sdb{ii,7}; % This is the scale factor +AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; + +AO.SDB.Setpoint.Range(ii,:) = [0 80]; +end + + + +% *** SFB *** +AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); +AO.SFB.MemberOf = {'PlotFamily'; 'SF'; 'MachineConfig'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFB'); +Physics2HWParams = magnetcoefficients('SFB'); + +AO.SFB.Monitor.Mode = Mode; +AO.SFB.Monitor.DataType = 'Scalar'; +AO.SFB.Monitor.Units = 'Hardware'; +AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFB.Monitor.Physics2HWFcn = @k2amp; +AO.SFB.Monitor.HWUnits = 'ampere'; +AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFB.Setpoint.Mode = Mode; +AO.SFB.Setpoint.DataType = 'Scalar'; +AO.SFB.Setpoint.Units = 'Hardware'; +AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFB.Setpoint.Physics2HWFcn = @k2amp; +AO.SFB.Setpoint.HWUnits = 'ampere'; +AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfb={ +'1SFB1 ' 'SR01SPS04:CURRENT_MONITOR' 'SR01SPS04:CURRENT_SP ' 1 [1,1] 1 1.0 0.5 ; ... +'2SFB1 ' 'SR02SPS04:CURRENT_MONITOR' 'SR02SPS04:CURRENT_SP ' 1 [2,1] 2 1.0 0.5 ; ... +'3SFB1 ' 'SR03SPS04:CURRENT_MONITOR' 'SR03SPS04:CURRENT_SP ' 1 [3,1] 3 1.0 0.5 ; ... +'4SFB1 ' 'SR04SPS04:CURRENT_MONITOR' 'SR04SPS04:CURRENT_SP ' 1 [4,1] 4 1.0 0.5 ; ... +'5SFB1 ' 'SR05SPS04:CURRENT_MONITOR' 'SR05SPS04:CURRENT_SP ' 1 [5,1] 5 1.0 0.5 ; ... +'6SFB1 ' 'SR06SPS04:CURRENT_MONITOR' 'SR06SPS04:CURRENT_SP ' 1 [6,1] 6 1.0 0.5 ; ... +'7SFB1 ' 'SR07SPS04:CURRENT_MONITOR' 'SR07SPS04:CURRENT_SP ' 1 [7,1] 7 1.0 0.5 ; ... +'8SFB1 ' 'SR08SPS04:CURRENT_MONITOR' 'SR08SPS04:CURRENT_SP ' 1 [8,1] 8 1.0 0.5 ; ... +'9SFB1 ' 'SR09SPS04:CURRENT_MONITOR' 'SR09SPS04:CURRENT_SP ' 1 [9,1] 9 1.0 0.5 ; ... +'10SFB1 ' 'SR10SPS04:CURRENT_MONITOR' 'SR10SPS04:CURRENT_SP ' 1 [10,1] 10 1.0 0.5 ; ... +'11SFB1 ' 'SR11SPS04:CURRENT_MONITOR' 'SR11SPS04:CURRENT_SP ' 1 [11,1] 11 1.0 0.5 ; ... +'12SFB1 ' 'SR12SPS04:CURRENT_MONITOR' 'SR12SPS04:CURRENT_SP ' 1 [12,1] 12 1.0 0.5 ; ... +'13SFB1 ' 'SR13SPS04:CURRENT_MONITOR' 'SR13SPS04:CURRENT_SP ' 1 [13,1] 13 1.0 0.5 ; ... +'14SFB1 ' 'SR14SPS04:CURRENT_MONITOR' 'SR14SPS04:CURRENT_SP ' 1 [14,1] 14 1.0 0.5 ; ... +}; + +for ii=1:size(sfb,1) +name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; +name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; +name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; +val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; +val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; +val =sfb{ii,6}; AO.SFB.ElementLsist(ii,1) = val; +val =sfb{ii,7}; % This is the scale factor +AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; + +AO.SFB.Setpoint.Range(ii,:) = [0 60]; +end + +%=============== +%Skew Quad data +%=============== +% *** Skew quadrupoles *** 2005/09/27 Eugene +AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); +AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('SKQ'); +Physics2HWParams = magnetcoefficients('SKQ'); + +AO.SKQ.Monitor.Mode = Mode; +AO.SKQ.Monitor.DataType = 'Scalar'; +AO.SKQ.Monitor.Units = 'Hardware'; +AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; +AO.SKQ.Monitor.Physics2HWFcn = @k2amp; +AO.SKQ.Monitor.HWUnits = 'ampere'; +AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; + +AO.SKQ.Setpoint.Mode = Mode; +AO.SKQ.Setpoint.DataType = 'Scalar'; +AO.SKQ.Setpoint.Units = 'Hardware'; +AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; +AO.SKQ.Setpoint.HWUnits = 'ampere'; +AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +sq={ +'1SKQ1 ' 'SR01CPS03:CURRENT_MONITOR' 'SR01CPS03:CURRENT_SP ' 1 [1,1] 1 1 ; ... +'1SKQ2 ' 'SR01CPS08:CURRENT_MONITOR' 'SR01CPS08:CURRENT_SP ' 1 [1,2] 2 1 ; ... +'2SKQ1 ' 'SR02CPS03:CURRENT_MONITOR' 'SR02CPS03:CURRENT_SP ' 1 [2,1] 3 1 ; ... +'2SKQ2 ' 'SR02CPS08:CURRENT_MONITOR' 'SR02CPS08:CURRENT_SP ' 1 [2,2] 4 1 ; ... +'3SKQ1 ' 'SR03CPS03:CURRENT_MONITOR' 'SR03CPS03:CURRENT_SP ' 1 [3,1] 5 1 ; ... +'3SKQ2 ' 'SR03CPS08:CURRENT_MONITOR' 'SR03CPS08:CURRENT_SP ' 1 [3,2] 6 1 ; ... +'4SKQ1 ' 'SR04CPS03:CURRENT_MONITOR' 'SR04CPS03:CURRENT_SP ' 1 [4,1] 7 1 ; ... +'4SKQ2 ' 'SR04CPS08:CURRENT_MONITOR' 'SR04CPS08:CURRENT_SP ' 1 [4,2] 8 1 ; ... +'5SKQ1 ' 'SR05CPS03:CURRENT_MONITOR' 'SR05CPS03:CURRENT_SP ' 1 [5,1] 9 1 ; ... +'5SKQ2 ' 'SR05CPS08:CURRENT_MONITOR' 'SR05CPS08:CURRENT_SP ' 1 [5,2] 10 1 ; ... +'6SKQ1 ' 'SR06CPS03:CURRENT_MONITOR' 'SR06CPS03:CURRENT_SP ' 1 [6,1] 11 1 ; ... +'6SKQ2 ' 'SR06CPS08:CURRENT_MONITOR' 'SR06CPS08:CURRENT_SP ' 1 [6,2] 12 1 ; ... +'7SKQ1 ' 'SR07CPS03:CURRENT_MONITOR' 'SR07CPS03:CURRENT_SP ' 1 [7,1] 13 1 ; ... +'7SKQ2 ' 'SR07CPS08:CURRENT_MONITOR' 'SR07CPS08:CURRENT_SP ' 1 [7,2] 14 1 ; ... +'8SKQ1 ' 'SR08CPS03:CURRENT_MONITOR' 'SR08CPS03:CURRENT_SP ' 1 [8,1] 15 1 ; ... +'8SKQ2 ' 'SR08CPS08:CURRENT_MONITOR' 'SR08CPS08:CURRENT_SP ' 1 [8,2] 16 1 ; ... +'9SKQ1 ' 'SR09CPS03:CURRENT_MONITOR' 'SR09CPS03:CURRENT_SP ' 1 [9,1] 17 1 ; ... +'9SKQ2 ' 'SR09CPS08:CURRENT_MONITOR' 'SR09CPS08:CURRENT_SP ' 1 [9,2] 18 1 ; ... +'10SKQ1 ' 'SR10CPS03:CURRENT_MONITOR' 'SR10CPS03:CURRENT_SP ' 1 [10,1] 19 1 ; ... +'10SKQ2 ' 'SR10CPS08:CURRENT_MONITOR' 'SR10CPS08:CURRENT_SP ' 1 [10,2] 20 1 ; ... +'11SKQ1 ' 'SR11CPS03:CURRENT_MONITOR' 'SR11CPS03:CURRENT_SP ' 1 [11,1] 21 1 ; ... +'11SKQ2 ' 'SR11CPS08:CURRENT_MONITOR' 'SR11CPS08:CURRENT_SP ' 1 [11,2] 22 1 ; ... +'12SKQ1 ' 'SR12CPS03:CURRENT_MONITOR' 'SR12CPS03:CURRENT_SP ' 1 [12,1] 23 1 ; ... +'12SKQ2 ' 'SR12CPS08:CURRENT_MONITOR' 'SR12CPS08:CURRENT_SP ' 1 [12,2] 24 1 ; ... +'13SKQ1 ' 'SR13CPS03:CURRENT_MONITOR' 'SR13CPS03:CURRENT_SP ' 1 [13,1] 25 1 ; ... +'13SKQ2 ' 'SR13CPS08:CURRENT_MONITOR' 'SR13CPS08:CURRENT_SP ' 1 [13,2] 26 1 ; ... +'14SKQ1 ' 'SR14CPS03:CURRENT_MONITOR' 'SR14CPS03:CURRENT_SP ' 1 [14,1] 27 1 ; ... +'14SKQ2 ' 'SR14CPS08:CURRENT_MONITOR' 'SR14CPS08:CURRENT_SP ' 1 [14,2] 28 1 ; ... +}; + +for ii=1:size(sq,1) +name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; +name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; +name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; +val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; +val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; +val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; +val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; +AO.SKQ.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SKQ.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SKQ.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SKQ.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; + +AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; +end + + +%=============== +%Kicker data +%=============== +AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); +AO.KICK.MemberOf = {'Injection','MachineConfig' 'Plotfamily'}; + +AO.KICK.Monitor.Mode = Mode; +AO.KICK.Monitor.DataType = 'Scalar'; +AO.KICK.Monitor.Units = 'Hardware'; +AO.KICK.Monitor.HWUnits = 'kVolts'; +AO.KICK.Monitor.PhysicsUnits = 'mradian'; + +AO.KICK.Setpoint.Mode = Mode; +AO.KICK.Setpoint.DataType = 'Scalar'; +AO.KICK.Setpoint.Units = 'Hardware'; +AO.KICK.Setpoint.HWUnits = 'Volts'; +AO.KICK.Setpoint.PhysicsUnits = 'radian'; + +% From kicker deisgn review the kickers are rated to 4380 Amps giving 0.038 +% Tesla converting this to kickangle. Also convert voltage into amps for +% the conversion? +% +% 2780 V on the capacitor banks will create 5240 A delivered to the kicker +% magnets. +% From simulations 4380 A creates 0.038607 T over a length of 0.7 m. +% Therefore 4380 A => 2.7006 mrad. Therefore 2323.740 V => 2.7006 mrad. +% HW2PHYSICS conversion factor (kV to rad) is therefore 0.0027006/2.32374 = +% 0.00116217821271. The Ps also goes through a 1:3 transformer therefore +% the conversion factor increases by 3. Ie 0.00348653463813 +% For V to rad then 0.00000348653463813. +hw2physics_conversionfactor = 0.00000348653463813; + +% Measured +% Kicker1 100 V = 0.176 mrad +% Kicker2 100 V = -0.138 mrad +% Kicker3 100 V = -0.134 mrad +% Kicker4 100 V = 0.176 mrad + +%common monitor setpoint stat devlist elem tol +kickeramp={ +'KICK1 ' 'SR14KPS01:VOLTAGE_MONITOR' 'SR14KPS01:VOLTAGE_SP ' 1 [1,1] 1 0.10 ; ... +'KICK2 ' 'SR01KPS01:VOLTAGE_MONITOR' 'SR01KPS01:VOLTAGE_SP ' 1 [1,2] 2 0.10 ; ... +'KICK3 ' 'SR01KPS02:VOLTAGE_MONITOR' 'SR01KPS02:VOLTAGE_SP ' 1 [1,3] 3 0.10 ; ... +'KICK4 ' 'SR02KPS01:VOLTAGE_MONITOR' 'SR02KPS01:VOLTAGE_SP ' 1 [1,4] 4 0.10 ; ... +}; + +for ii=1:size(kickeramp,1) +name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; +name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; +name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; +val =kickeramp{ii,4}; AO.KICK.Status(ii,1) = val; +val =kickeramp{ii,5}; AO.KICK.DeviceList(ii,:) = val; +val =kickeramp{ii,6}; AO.KICK.ElementList(ii,1) = val; +val =kickeramp{ii,7}; AO.KICK.Setpoint.Tolerance(ii,1) = val; + +if ii==1||ii==4 + hw2physics_conversionfactor = 1.7600e-06; + AO.KICK.Monitor.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; + AO.KICK.Monitor.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; + AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = hw2physics_conversionfactor; + AO.KICK.Setpoint.Physics2HWParams(ii,:) = 1/hw2physics_conversionfactor; + AO.KICK.Setpoint.Range(ii,:) = [-1300 +1300]; +else + hw2physics_conversionfactor = 1.3600e-06; + AO.KICK.Monitor.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; + AO.KICK.Monitor.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; + AO.KICK.Setpoint.HW2PhysicsParams(ii,:) = -hw2physics_conversionfactor; + AO.KICK.Setpoint.Physics2HWParams(ii,:) = -1/hw2physics_conversionfactor; + AO.KICK.Setpoint.Range(ii,:) = [+1300 -1300]; +end +end + +% *** KICK Delay *** +% AO.KICK.Delay +% >> removed >> see previous versions if info needed + + +%============ +%RF System +%============ +AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); +AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +%-------------------------------- 4 cavity Case +%common stat devlist elem +rfcommon={ +'RF1 ' 1 [1,1] 1 ; ... +'RF2 ' 1 [1,2] 2 ; ... +'RF3 ' 1 [1,3] 3 ; ... +'RF4 ' 1 [1,4] 4 ; ... + }; + +%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance +rffreq={ +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... +'SR00MOS01:FREQUENCY_MONITOR' 'SR00MOS01:FREQUENCY_SP' 1 1 [0 6e8] 100.0; ... + }; + +% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfphase={ +'SRF1:STN:PHASE' 'SRF1:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... +'SRF2:STN:PHASE' 'SRF2:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... +'SRF3:STN:PHASE' 'SRF3:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... +'SRF4:STN:PHASE' 'SRF4:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... + }; + +% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfvolt={ +'SRF1:STN:VOLT:CTRL ' 'SRF1:STN:VOLT' 1 1 [-inf inf] inf ; ... +'SRF2:STN:VOLT:CTRL ' 'SRF2:STN:VOLT' 1 1 [-inf inf] inf ; ... +'SRF3:STN:VOLT:CTRL ' 'SRF3:STN:VOLT' 1 1 [-inf inf] inf ; ... +'SRF4:STN:VOLT:CTRL ' 'SRF4:STN:VOLT' 1 1 [-inf inf] inf ; ... + }; +% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance +rfpower={ +'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SRF1:KLYSDRIVFRWD:POWER' 'SRF1:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SRF2:KLYSDRIVFRWD:POWER' 'SRF2:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SRF3:KLYSDRIVFRWD:POWER' 'SRF3:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SRF4:KLYSDRIVFRWD:POWER' 'SRF4:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... + }; + +for ii=1:size(rfcommon,1) +name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; +val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; +val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; +val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; +end + +for ii=1:size(rffreq,1) +name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; +name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; +val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; + AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; +val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; + AO.RF.Setpoint.Physics2HWParams(ii,1) = val; +val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; +val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfphase,1) +name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; +name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; +val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Phase.HW2PhysicsParams(ii,1) = val; +val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Phase.Physics2HWParams(ii,1) = val; +val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; + AO.RF.Phase.Range(ii,:) = val; +val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; + AO.RF.Phase.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfvolt,1) +name=rfvolt{ii,1}; AO.RF.VoltageCtrl.ChannelNames(ii,:) = name; +name=rfvolt{ii,2}; AO.RF.Voltage.ChannelNames(ii,:) = name; +val =rfvolt{ii,3}; AO.RF.VoltageCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Voltage.HW2PhysicsParams(ii,1) = val; +val =rfvolt{ii,4}; AO.RF.VoltageCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Voltage.Physics2HWParams(ii,1) = val; +val =rfvolt{ii,5}; AO.RF.VoltageCtrl.Range(ii,:) = val; + AO.RF.Voltage.Range(ii,:) = val; +val =rfvolt{ii,6}; AO.RF.VoltageCtrl.Tolerance(ii,1) = val; + AO.RF.Voltage.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfpower,1) +name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; +name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; +name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; +val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Power.HW2PhysicsParams(ii,1) = val; + AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; +val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Power.Physics2HWParams(ii,1) = val; + AO.RF.KlysPower.Physics2HWParams(ii,1) = val; +val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; + AO.RF.Power.Range(ii,:) = val; + AO.RF.KlysPower.Range(ii,:) = val; +val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; + AO.RF.Power.Tolerance(ii,1) = val; + AO.RF.KlysPower.Tolerance(ii,1) = val; +end + +%Frequency Readback +AO.RF.Monitor.Mode = Mode; +AO.RF.Monitor.DataType = 'Scalar'; +AO.RF.Monitor.Units = 'Hardware'; +AO.RF.Monitor.HWUnits = 'Hz'; +AO.RF.Monitor.PhysicsUnits = 'Hz'; +%Frequency Setpoint +AO.RF.Setpoint.Mode = Mode; +AO.RF.Setpoint.DataType = 'Scalar'; +AO.RF.Setpoint.Units = 'Hardware'; +AO.RF.Setpoint.HWUnits = 'Hz'; +AO.RF.Setpoint.PhysicsUnits = 'Hz'; + +%Voltage control +AO.RF.VoltageCtrl.Mode = Mode; +AO.RF.VoltageCtrl.DataType = 'Scalar'; +AO.RF.VoltageCtrl.Units = 'Hardware'; +AO.RF.VoltageCtrl.HWUnits = 'Volts'; +AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; + +%Voltage monitor +AO.RF.Voltage.Mode = Mode; +AO.RF.Voltage.DataType = 'Scalar'; +AO.RF.Voltage.Units = 'Hardware'; +AO.RF.Voltage.HWUnits = 'Volts'; +AO.RF.Voltage.PhysicsUnits = 'Volts'; + +%Power Control +AO.RF.PowerCtrl.Mode = Mode; +AO.RF.PowerCtrl.DataType = 'Scalar'; +AO.RF.PowerCtrl.Units = 'Hardware'; +AO.RF.PowerCtrl.HWUnits = 'MWatts'; +AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; + +%Power Monitor +AO.RF.Power.Mode = Mode; +AO.RF.Power.DataType = 'Scalar'; +AO.RF.Power.Units = 'Hardware'; +AO.RF.Power.HWUnits = 'MWatts'; +AO.RF.Power.PhysicsUnits = 'MWatts'; + +%Klystron Forward Power +AO.RF.KlysPower.Mode = Mode; +AO.RF.KlysPower.DataType = 'Scalar'; +AO.RF.KlysPower.Units = 'Hardware'; +AO.RF.KlysPower.HWUnits = 'MWatts'; +AO.RF.KlysPower.PhysicsUnits = 'MWatts'; + +%Station Phase Control +AO.RF.PhaseCtrl.Mode = Mode; +AO.RF.PhaseCtrl.DataType = 'Scalar'; +AO.RF.PhaseCtrl.Units = 'Hardware'; +AO.RF.PhaseCtrl.HWUnits = 'Degrees'; +AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; + + +%Station Phase Monitor +AO.RF.Phase.Mode = Mode; +AO.RF.Phase.DataType = 'Scalar'; +AO.RF.Phase.Units = 'Hardware'; +AO.RF.Phase.HWUnits = 'Degrees'; +AO.RF.Phase.PhysicsUnits = 'Degrees'; + +%==== +%TUNE +%==== +AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); +AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; +AO.TUNE.CommonNames = ['xtune';'ytune']; +AO.TUNE.DeviceList = [ 1 1; 1 2]; +AO.TUNE.ElementList = [1 2]'; +AO.TUNE.Status = [1 1]'; + +AO.TUNE.Monitor.Mode = 'Special'; +AO.TUNE.Monitor.SpecialFunction = 'meastune'; +AO.TUNE.Monitor.DataType = 'Vector'; +AO.TUNE.Monitor.DataTypeIndex = [1 2]'; +AO.TUNE.Monitor.Units = 'Hardware'; +AO.TUNE.Monitor.HW2PhysicsParams = 1; +AO.TUNE.Monitor.Physics2HWParams = 1; +AO.TUNE.Monitor.HWUnits = 'fractional tune'; +AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; + + +% AO.FTx.Length.Mode = 'Special'; +% AO.FTx.Length.Units = 'Hardware'; +% AO.FTx.Length.DataType = 'Scalar'; +% AO.FTx.Length.SpecialFunction = 'getftlength'; +% AO.FTx.Length.SpecialFunctionSet = 'setftlength'; +% AO.FTx.Length.HWUnits = '32ns samples'; +% AO.FTx.Length.PhysicsUnits = '32ns samples'; +% AO.FTx.Length.HW2PhysicsParams = 1; +% AO.FTx.Length.Physics2HWParams = 1; + + +%==== +%DCCT +%==== +AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); +AO.DCCT.MemberOf = {'Diagnostics'}; +AO.DCCT.CommonNames = 'DCCT'; +AO.DCCT.DeviceList = [1 1]; +AO.DCCT.ElementList = [1]; +AO.DCCT.Status = [1]; + +AO.DCCT.Monitor.Mode = Mode; +AO.DCCT.Monitor.DataType = 'Scalar'; +AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; +AO.DCCT.Monitor.Units = 'Hardware'; +AO.DCCT.Monitor.HWUnits = 'milli-ampere'; +AO.DCCT.Monitor.PhysicsUnits = 'ampere'; +AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; +AO.DCCT.Monitor.Physics2HWParams = 1000; + + +% %================== +% %Machine Parameters +% %================== +% Removed in this version, see pervious version for more info + +%====== +%Septum +%====== +% ifam=ifam+1; +% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); +% AO.Septum.MemberOf = {'Injection'}; +% AO.Septum.Status = 1; +% +% AO.Septum.CommonNames = 'Septum '; +% AO.Septum.DeviceList = [3 1]; +% AO.Septum.ElementList = [1]; +% +% AO.Septum.Monitor.Mode = Mode; +% AO.Septum.Monitor.DataType = 'Scalar'; +% AO.Septum.Monitor.Units = 'Hardware'; +% AO.Septum.Monitor.HWUnits = 'ampere'; +% AO.Septum.Monitor.PhysicsUnits = 'radian'; +% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; +% +% AO.Septum.Setpoint.Mode = Mode; +% AO.Septum.Setpoint.DataType = 'Scalar'; +% AO.Septum.Setpoint.Units = 'Hardware'; +% AO.Septum.Setpoint.HWUnits = 'ampere'; +% AO.Septum.Setpoint.PhysicsUnits = 'radian'; +% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; +% AO.Septum.Setpoint.Range = [0, 2500]; +% AO.Septum.Setpoint.Tolerance = 100.0; +% +% AO.Septum.Monitor.HW2PhysicsParams = 1; +% AO.Septum.Monitor.Physics2HWParams = 1; +% AO.Septum.Setpoint.HW2PhysicsParams = 1; +% AO.Septum.Setpoint.Physics2HWParams = 1; + + +%==================== +%Photon Beamline Data +%==================== +% >> removed >> see previous versions if info needed + +%==================== +%BPLD Data +%==================== +% >> removed >> see previous versions if info needed + + + +% The operational mode sets the path, filenames, and other important parameters +% Run setoperationalmode after most of the AO is built so that the Units and Mode fields +% can be set in setoperationalmode +fprintf('\n'); +setao(AO); +setoperationalmode(OperationalMode); +AO = getao; + + +%%%%%%%%%%%%%%%% +% DeltaRespMat % +%%%%%%%%%%%%%%%% + +% I remove the physics2hw conversion because the physics2hw is +% is calibrated yet. + +% Set response matrix kick size in hardware units (amps) +AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', 2.0e-4, AO.HCM.DeviceList); +AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', 1.0e-4, AO.VCM.DeviceList); + +%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point +%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); +%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); + + +AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); +AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); +AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); + + +AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); +AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); +AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); +AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Get S-positions [meters] % +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Using ...ATIndex(:,1) will accomodata for split elements where the first +% of a group of elements is put in the first column ie, if SFA is split in +% two then ATIndex will look like [2 3; 11 12; ...] where each row is a +% magnet and column represents each split. +global THERING +AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; +AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; +AO.FTx.Position = findspos(THERING, AO.FTx.AT.ATIndex(:,1))'; +AO.FTy.Position = findspos(THERING, AO.FTy.AT.ATIndex(:,1))'; +AO.FTsum.Position= findspos(THERING, AO.FTsum.AT.ATIndex(:,1))'; +AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; +AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; +AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; +AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; +AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; +AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; +AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; +AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; +AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; +AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; +AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; +AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; +AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; +AO.DCCT.Position = 0; +AO.TUNE.Position = 0; + + +% Save AO +setao(AO); + + +function dispobject(AO,name) + +n = length(fieldnames(AO)); + +if n > 0 + fprintf(' %10s ',name); + if mod(n,5) == 0 + fprintf('\n'); + end end \ No newline at end of file diff --git a/machine/ASP/StorageRing/aspinit_v5skeleton.m b/machine/ASP/StorageRing/aspinit_v5skeleton.m index 3815bc57..a47852a5 100644 --- a/machine/ASP/StorageRing/aspinit_v5skeleton.m +++ b/machine/ASP/StorageRing/aspinit_v5skeleton.m @@ -1,1335 +1,1335 @@ -function aspinit(OperationalMode) -% aspinit(OperationalMode) -% -% Initialize parameters for ASP control in MATLAB -% -%========================== -% Accelerator Family Fields -%========================== -% FamilyName BPMx, HCM, etc -% CommonNames Shortcut name for each element (optional) -% DeviceList [Sector, Number] -% ElementList number in list -% Position m, magnet center -% -% MONITOR FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units Physics or HW -% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% -% SETPOINT FIELDS -% Mode online/manual/special/simulator -% ChannelNames PV for monitor -% Units hardware or physics -% HW2PhysicsFcn function handle used to convert from hardware to physics units -% HW2PhysicsParams parameters used for conversion function -% Physics2HWFcn function handle used to convert from physics to hardware units -% Physics2HWParams parameters used for conversion function -% HWUnits units for Hardware 'ampere'; -% PhysicsUnits units for physics 'Rad'; -% Range minsetpoint, maxsetpoint; -% Tolerance setpoint-monitor -% -%============================================= -% Accelerator Toolbox Simulation Fields -%============================================= -% ATType Quad, Sext, etc -% ATIndex index in THERING -% ATParameterGroup parameter group -% -%============ -% Family List -%============ -% BPMx BPMy - beam position monitors -% HCM VCM - corrector magnets wound into sextupoles -% BEND - gradient dipoles -% QFA QDA QFB - quadrupole magnets -% SFA SDA SDB SFB - sextupole magnets -% SQK - skew quads wound into SDA magnets -% KICK - injection kickers (DELTA type) -% RF - 4 cavities (KEK type?) -% DCCT -% Septum (Not in model yet) -% -% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 -% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 - -% === Change Log === -% Mark Boland 2004-02-12 -% Eugene Tan 2004-02-23 -% Eugene Tan 2004-12-13 -% Eugene Tan 2005-09-27 ver 4 -% Updated naming convention of the process variables, use version 4 of -% the lattice "assr4.m" where the correctors have been merged into the -% sextupoles. Made the necessary changes to updateatindex. Added skew -% quadrupoles and updated generate_init. -% Mark Boland 2006-05-27 -% Changed the BPM PVs to ...:SA_HPOS_MONITOR and ...:SA_VPOS_MONITOR -% -% === Still to do === -% - kicker delays -% - BPM names and other possible PVs of interest eg. Q factor etc. -% - clean up and configure the amp2k and k2amp conversion. Control system -% designed to calculate the strengths and amp values using calc records, -% therefore we should only need to change the PV name to access for -% readback at setpoints. Only problem will be in simulation/offline mode -% where those value are not available online. How do you keep the offline -% conversion factors up to date with online vals? -% -% === Generated from === - -% Default operational mode -if nargin < 1 - OperationalMode = 1; -end - - -%============================================= -% START DEFINITION OF ACCELERATOR OBJECTS -%============================================= -fprintf(' Defining the Accelerator Objects. Objects being defined:\n') - - -% Clear previous AcceleratorObjects -setao([]); - - -Mode = 'Online'; % This gets reset in setoperationalmode - -%============================================= -%BPM data: status field designates if BPM in use -%============================================= -ntbpm=98; -AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); -AO.BPMx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.BPMx.Monitor.Mode = Mode; -AO.BPMx.Monitor.DataType = 'Scalar'; -AO.BPMx.Monitor.Units = 'Hardware'; -AO.BPMx.Monitor.HWUnits = 'mm'; -AO.BPMx.Monitor.PhysicsUnits = 'meter'; - -AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); -AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.BPMy.Monitor.Mode = Mode; -AO.BPMy.Monitor.DataType = 'Scalar'; -AO.BPMy.Monitor.Units = 'Hardware'; -AO.BPMy.Monitor.HWUnits = 'mm'; -AO.BPMy.Monitor.PhysicsUnits = 'meter'; - -% x-name x-chname xstat y-name y-chname ystat DevList Elem -bpm={ -% INSERT BPM HERE -}; - -%Load fields from data block -for ii=1:size(bpm,1) -name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; -name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; -name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; -name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; -val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; - AO.BPMy.DeviceList(ii,:) = val; -val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; - AO.BPMy.ElementList(ii,:) = val; - AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1000; - AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1000; -end - - -% % Get sum value from button. Don't need handles and PV namelist as -% % parameters are the same as the 'monitor' subcategory. -% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; -% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; -% AO.BPMx.Sum.HWUnits = 'ADC Counts'; -% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; -% AO.BPMx.Sum.HW2PhysicsParams = 1; -% AO.BPMx.Sum.Physics2HWParams = 1; -% % Get q value from BPMs. Don't need handles and PV namelist. -% AO.BPMx.Q = AO.BPMx.Monitor; -% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; -% AO.BPMx.Q.HWUnits = 'mm'; -% AO.BPMx.Q.PhysicsUnits = 'meter'; -% AO.BPMx.Q.HW2PhysicsParams = 1e-3; -% AO.BPMx.Q.Physics2HWParams = 1000; -% -% % Definition above for horizontal. Replicate for vertical. -% AO.BPMy.Sum = AO.BPMx.Sum; -% AO.BPMy.Q = AO.BPMx.Q; - - - -%============================================= -% First Turn BPM data from Libera -%============================================= -ntbpm=98; -AO.FTx.FamilyName = 'FTx'; dispobject(AO,AO.FTx.FamilyName); -AO.FTx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTx.Monitor.Mode = Mode; -AO.FTx.Monitor.DataType = 'Scalar'; -AO.FTx.Monitor.Units = 'Hardware'; -AO.FTx.Monitor.HWUnits = 'mm'; -AO.FTx.Monitor.PhysicsUnits = 'meter'; - -AO.FTy.FamilyName = 'FTy'; dispobject(AO,AO.FTy.FamilyName); -AO.FTy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTy.Monitor.Mode = Mode; -AO.FTy.Monitor.DataType = 'Scalar'; -AO.FTy.Monitor.Units = 'Hardware'; -AO.FTy.Monitor.HWUnits = 'mm'; -AO.FTy.Monitor.PhysicsUnits = 'meter'; - -% x-name x-chname xstat y-name y-chname ystat DevList Elem -bpm={ -% INSERT FT HERE -}; - -%Load fields from data block -for ii=1:size(bpm,1) -name=bpm{ii,1}; AO.FTx.CommonNames(ii,:) = name; -name=bpm{ii,2}; AO.FTx.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,3}; AO.FTx.Status(ii,:) = val; -name=bpm{ii,4}; AO.FTy.CommonNames(ii,:) = name; -name=bpm{ii,5}; AO.FTy.Monitor.ChannelNames(ii,:)= name; -val =bpm{ii,6}; AO.FTy.Status(ii,:) = val; -val =bpm{ii,7}; AO.FTx.DeviceList(ii,:) = val; - AO.FTy.DeviceList(ii,:) = val; -val =bpm{ii,8}; AO.FTx.ElementList(ii,:) = val; - AO.FTy.ElementList(ii,:) = val; - AO.FTx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.FTx.Monitor.Physics2HWParams(ii,:) = 1000; - AO.FTy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; - AO.FTy.Monitor.Physics2HWParams(ii,:) = 1000; -end -AO.FTx.Status = AO.BPMx.Status; -AO.FTy.Status = AO.BPMy.Status; - -% % Get sum value from button. Don't need handles and PV namelist as -% % parameters are the same as the 'monitor' subcategory. -AO.FTx.Offset.Mode = 'Special'; -AO.FTx.Offset.Units = 'Hardware'; -AO.FTx.Offset.DataType = 'Scalar'; -AO.FTx.Offset.SpecialFunction = 'getftoffset'; -AO.FTx.Offset.SpecialFunctionSet = 'setftoffset'; -AO.FTx.Offset.HWUnits = '32ns samples'; -AO.FTx.Offset.PhysicsUnits = '32ns samples'; -AO.FTx.Offset.HW2PhysicsParams = 1; -AO.FTx.Offset.Physics2HWParams = 1; - -AO.FTx.Length.Mode = 'Special'; -AO.FTx.Length.Units = 'Hardware'; -AO.FTx.Length.DataType = 'Scalar'; -AO.FTx.Length.SpecialFunction = 'getftlength'; -AO.FTx.Length.SpecialFunctionSet = 'setftlength'; -AO.FTx.Length.HWUnits = '32ns samples'; -AO.FTx.Length.PhysicsUnits = '32ns samples'; -AO.FTx.Length.HW2PhysicsParams = 1; -AO.FTx.Length.Physics2HWParams = 1; - -AO.FTx.Maxadc.Mode = 'Special'; -AO.FTx.Maxadc.Units = 'Hardware'; -AO.FTx.Maxadc.DataType = 'Scalar'; -AO.FTx.Maxadc.SpecialFunction = 'getftmaxadc'; -AO.FTx.Maxadc.HWUnits = 'ADC counts'; -AO.FTx.Maxadc.PhysicsUnits = 'ADC counts'; -AO.FTx.Maxadc.HW2PhysicsParams = 1; -AO.FTx.Maxadc.Physics2HWParams = 1; - -% AO.FTx.Sum.Mode = 'Special'; -% AO.FTx.Sum.Units = 'Hardware'; -% AO.FTx.Sum.DataType = 'Scalar'; -% AO.FTx.Sum.SpecialFunction = 'getftsum'; -% AO.FTx.Sum.HWUnits = 'ADC counts'; -% AO.FTx.Sum.PhysicsUnits = 'ADC counts'; -% AO.FTx.Sum.HW2PhysicsParams = 1; -% AO.FTx.Sum.Physics2HWParams = 1; - - -AO.FTsum.FamilyName = 'FTsum'; dispobject(AO,AO.FTsum.FamilyName); -AO.FTsum.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; -AO.FTsum.Monitor.Mode = 'Special'; -AO.FTsum.Monitor.Units = 'Hardware'; -AO.FTsum.Monitor.DataType = 'Scalar'; -AO.FTsum.Monitor.SpecialFunction = 'getftsum'; -AO.FTsum.Monitor.HWUnits = 'ADC counts'; -AO.FTsum.Monitor.PhysicsUnits = 'ADC counts'; -AO.FTsum.Monitor.HW2PhysicsParams = 1; -AO.FTsum.Monitor.Physics2HWParams = 1; - - -%=========================================================== -% Corrector data: status field designates if corrector in use -% ASP corrector coils wound into sextupoles. Not dynamic correctors. -%=========================================================== - -AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); -AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'}; - -AO.HCM.Monitor.Mode = Mode; -AO.HCM.Monitor.DataType = 'Scalar'; -AO.HCM.Monitor.Units = 'Hardware'; -AO.HCM.Monitor.HWUnits = 'ampere'; -AO.HCM.Monitor.PhysicsUnits = 'radian'; -AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.HCM.Monitor.Physics2HWFcn = @k2amp; - -AO.HCM.Setpoint.Mode = Mode; -AO.HCM.Setpoint.DataType = 'Scalar'; -AO.HCM.Setpoint.Units = 'Hardware'; -AO.HCM.Setpoint.HWUnits = 'ampere'; -AO.HCM.Setpoint.PhysicsUnits = 'radian'; -AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.HCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian. Respmat settings below AO definitions. -% x-common x-monitor x-setpoint stat devlist elem tol -cor={ -% INSERT HCM HERE -}; - -[C, Leff, MagnetType] = magnetcoefficients('HCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.HCM.Status(ii,1) = val; -val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; - -AO.HCM.Setpoint.Range(ii,:) = [-90 +90]; -AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); -AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'}; - -AO.VCM.Monitor.Mode = Mode; -AO.VCM.Monitor.DataType = 'Scalar'; -AO.VCM.Monitor.Units = 'Hardware'; -AO.VCM.Monitor.HWUnits = 'ampere'; -AO.VCM.Monitor.PhysicsUnits = 'radian'; -AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; -AO.VCM.Monitor.Physics2HWFcn = @k2amp; - -AO.VCM.Setpoint.Mode = Mode; -AO.VCM.Setpoint.DataType = 'Scalar'; -AO.VCM.Setpoint.Units = 'Hardware'; -AO.VCM.Setpoint.HWUnits = 'ampere'; -AO.VCM.Setpoint.PhysicsUnits = 'radian'; -AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; -AO.VCM.Setpoint.Physics2HWFcn = @k2amp; - -% HW in ampere, Physics in radian ** radian units converted to ampere below *** -% y-common y-monitor y-setpoint stat devlist elem -cor={ -% INSERT VCM HERE -}; - -[C, Leff, MagnetType] = magnetcoefficients('VCM'); - -for ii=1:size(cor,1) -name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; -name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; -name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; -val =cor{ii,4}; AO.VCM.Status(ii,1) = val; -val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; -val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; -val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; - -AO.VCM.Setpoint.Range(ii,:) = [-125 +125]; -AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; -AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; -AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; -end - - -%============================= -% MAIN MAGNETS -%============================= - -%=========== -%Dipole data -%=========== - -% *** BEND *** -AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); -AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('BEND'); -Physics2HWParams = magnetcoefficients('BEND'); - -AO.BEND.Monitor.Mode = Mode; -AO.BEND.Monitor.DataType = 'Scalar'; -AO.BEND.Monitor.Units = 'Hardware'; -AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? -AO.BEND.Monitor.Physics2HWFcn = @gev2bend; -AO.BEND.Monitor.HWUnits = 'ampere'; -AO.BEND.Monitor.PhysicsUnits = 'energy'; - -AO.BEND.Setpoint.Mode = Mode; -AO.BEND.Setpoint.DataType = 'Scalar'; -AO.BEND.Setpoint.Units = 'Hardware'; -AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; -AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; -AO.BEND.Setpoint.HWUnits = 'ampere'; -AO.BEND.Setpoint.PhysicsUnits = 'energy'; - -% common monitor setpoint stat devlist elem scale tol -bend={ -% INSERT BEND HERE -}; - -for ii=1:size(bend,1) -name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; -name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; -name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; -val =bend{ii,4}; AO.BEND.Status(ii,1) = val; -val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; -val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; -val =bend{ii,7}; % This is the scale factor -AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; - -AO.BEND.Setpoint.Range(ii,:) = [0 500]; -end - -%=============== -%Quadrupole data -%=============== - -% *** QFA *** -AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); -AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFA'); -Physics2HWParams = magnetcoefficients('QFA'); - -AO.QFA.Monitor.Mode = Mode; -AO.QFA.Monitor.DataType = 'Scalar'; -AO.QFA.Monitor.Units = 'Hardware'; -AO.QFA.Monitor.HWUnits = 'ampere'; -AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFA.Monitor.Physics2HWFcn = @k2amp; - -AO.QFA.Setpoint.Mode = Mode; -AO.QFA.Setpoint.DataType = 'Scalar'; -AO.QFA.Setpoint.Units = 'Hardware'; -AO.QFA.Setpoint.HWUnits = 'ampere'; -AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qfa={ -% INSERT QFA HERE -}; - -for ii=1:size(qfa,1) -name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; -name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; -name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; -val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; -val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; -val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; -val =qfa{ii,7}; % This is the scale factor -AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; - -AO.QFA.Setpoint.Range(ii,:) = [0 180]; -end - - -% *** QDA *** -AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); -AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; -HW2PhysicsParams = magnetcoefficients('QDA'); -Physics2HWParams = magnetcoefficients('QDA'); - -AO.QDA.Monitor.Mode = Mode; -AO.QDA.Monitor.DataType = 'Scalar'; -AO.QDA.Monitor.Units = 'Hardware'; -AO.QDA.Monitor.HWUnits = 'ampere'; -AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; -AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.QDA.Monitor.Physics2HWFcn = @k2amp; - -AO.QDA.Setpoint.Mode = Mode; -AO.QDA.Setpoint.DataType = 'Scalar'; -AO.QDA.Setpoint.Units = 'Hardware'; -AO.QDA.Setpoint.HWUnits = 'ampere'; -AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; -AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QDA.Setpoint.Physics2HWFcn = @k2amp; - -% common monitor setpoint stat devlist elem scale tol -qda={ -% INSERT QDA HERE -}; - -for ii=1:size(qda,1) -name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; -name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; -name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; -val =qda{ii,4}; AO.QDA.Status(ii,1) = val; -val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; -val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; -val =qda{ii,7}; % This is the scale factor -AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; - -AO.QDA.Setpoint.Range(ii,:) = [0 100]; -end - - - -% *** QFB *** -AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); -AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; -HW2PhysicsParams = magnetcoefficients('QFB'); -Physics2HWParams = magnetcoefficients('QFB'); - -AO.QFB.Monitor.Mode = Mode; -AO.QFB.Monitor.DataType = 'Scalar'; -AO.QFB.Monitor.Units = 'Hardware'; -AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.QFB.Monitor.Physics2HWFcn = @k2amp; -AO.QFB.Monitor.HWUnits = 'ampere'; -AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; - -AO.QFB.Setpoint.Mode = Mode; -AO.QFB.Setpoint.DataType = 'Scalar'; -AO.QFB.Setpoint.Units = 'Hardware'; -AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.QFB.Setpoint.Physics2HWFcn = @k2amp; -AO.QFB.Setpoint.HWUnits = 'ampere'; -AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -qfb={ -% INSERT QFB HERE -}; - -for ii=1:size(qfb,1) -name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; -name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; -name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; -val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; -val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; -val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; -val =qfb{ii,7}; % This is the scale factor -AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; - -AO.QFB.Setpoint.Range(ii,:) = [0 180]; -end - - -%=============== -%Sextupole data -%=============== -% *** SFA *** -AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); -AO.SFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SF'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFA'); -Physics2HWParams = magnetcoefficients('SFA'); - -AO.SFA.Monitor.Mode = Mode; -AO.SFA.Monitor.DataType = 'Scalar'; -AO.SFA.Monitor.Units = 'Hardware'; -AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFA.Monitor.Physics2HWFcn = @k2amp; -AO.SFA.Monitor.HWUnits = 'ampere'; -AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFA.Setpoint.Mode = Mode; -AO.SFA.Setpoint.DataType = 'Scalar'; -AO.SFA.Setpoint.Units = 'Hardware'; -AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFA.Setpoint.Physics2HWFcn = @k2amp; -AO.SFA.Setpoint.HWUnits = 'ampere'; -AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfa={ -% INSERT SFA HERE -}; - -for ii=1:size(sfa,1) -name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; -name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; -name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; -val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; -val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; -val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; -val =sfa{ii,7}; % This is the scale factor -AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; - -AO.SFA.Setpoint.Range(ii,:) = [0 140]; -end - - - -% *** SDA *** -AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); -AO.SDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SD'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDA'); -Physics2HWParams = magnetcoefficients('SDA'); - -AO.SDA.Monitor.Mode = Mode; -AO.SDA.Monitor.DataType = 'Scalar'; -AO.SDA.Monitor.Units = 'Hardware'; -AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDA.Monitor.Physics2HWFcn = @k2amp; -AO.SDA.Monitor.HWUnits = 'ampere'; -AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDA.Setpoint.Mode = Mode; -AO.SDA.Setpoint.DataType = 'Scalar'; -AO.SDA.Setpoint.Units = 'Hardware'; -AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDA.Setpoint.Physics2HWFcn = @k2amp; -AO.SDA.Setpoint.HWUnits = 'ampere'; -AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; - - -% common monitor setpoint stat devlist elem scale tol -sda={ -% INSERT SDA HERE -}; - -for ii=1:size(sda,1) -name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; -name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; -name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; -val =sda{ii,4}; AO.SDA.Status(ii,1) = val; -val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; -val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; -val =sda{ii,7}; % This is the scale factor -AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; - -AO.SDA.Setpoint.Range(ii,:) = [0 140]; -end - - -% *** SDB *** -AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); -AO.SDB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SD'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SDB'); -Physics2HWParams = magnetcoefficients('SDB'); - -AO.SDB.Monitor.Mode = Mode; -AO.SDB.Monitor.DataType = 'Scalar'; -AO.SDB.Monitor.Units = 'Hardware'; -AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SDB.Monitor.Physics2HWFcn = @k2amp; -AO.SDB.Monitor.HWUnits = 'ampere'; -AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SDB.Setpoint.Mode = Mode; -AO.SDB.Setpoint.DataType = 'Scalar'; -AO.SDB.Setpoint.Units = 'Hardware'; -AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SDB.Setpoint.Physics2HWFcn = @k2amp; -AO.SDB.Setpoint.HWUnits = 'ampere'; -AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sdb={ -% INSERT SDB HERE -}; - -for ii=1:size(sdb,1) -name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; -name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; -name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; -val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; -val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; -val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; -val =sdb{ii,7}; % This is the scale factor -AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; - -AO.SDB.Setpoint.Range(ii,:) = [0 140]; -end - - - -% *** SFB *** -AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); -AO.SFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SF'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; -HW2PhysicsParams = magnetcoefficients('SFB'); -Physics2HWParams = magnetcoefficients('SFB'); - -AO.SFB.Monitor.Mode = Mode; -AO.SFB.Monitor.DataType = 'Scalar'; -AO.SFB.Monitor.Units = 'Hardware'; -AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; -AO.SFB.Monitor.Physics2HWFcn = @k2amp; -AO.SFB.Monitor.HWUnits = 'ampere'; -AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; - -AO.SFB.Setpoint.Mode = Mode; -AO.SFB.Setpoint.DataType = 'Scalar'; -AO.SFB.Setpoint.Units = 'Hardware'; -AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SFB.Setpoint.Physics2HWFcn = @k2amp; -AO.SFB.Setpoint.HWUnits = 'ampere'; -AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; - -% common monitor setpoint stat devlist elem scale tol -sfb={ -% INSERT SFB HERE -}; - -for ii=1:size(sfb,1) -name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; -name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; -name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; -val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; -val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; -val =sfb{ii,6}; AO.SFB.ElementLsist(ii,1) = val; -val =sfb{ii,7}; % This is the scale factor -AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; -AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; -AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; -AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; -AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; -val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; - -AO.SFB.Setpoint.Range(ii,:) = val; -end - -%=============== -%Skew Quad data -%=============== -% *** Skew quadrupoles *** 2005/09/27 Eugene -AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); -AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; -HW2PhysicsParams = magnetcoefficients('SKQ'); -Physics2HWParams = magnetcoefficients('SKQ'); - -AO.SKQ.Monitor.Mode = Mode; -AO.SKQ.Monitor.DataType = 'Scalar'; -AO.SKQ.Monitor.Units = 'Hardware'; -AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; -AO.SKQ.Monitor.Physics2HWFcn = @k2amp; -AO.SKQ.Monitor.HWUnits = 'ampere'; -AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; - -AO.SKQ.Setpoint.Mode = Mode; -AO.SKQ.Setpoint.DataType = 'Scalar'; -AO.SKQ.Setpoint.Units = 'Hardware'; -AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; -AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; -AO.SKQ.Setpoint.HWUnits = 'ampere'; -AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; - -% common monitor setpoint stat devlist elem scale tol -sq={ -% INSERT SKQ HERE -}; - -for ii=1:size(sq,1) -name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; -name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; -name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; -val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; -val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; -val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; -val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; -AO.SKQ.Monitor.HW2PhysicsParams(ii,:) = HW2PhysicsParams; -AO.SKQ.Setpoint.HW2PhysicsParams(ii,:) = HW2PhysicsParams; -AO.SKQ.Monitor.Physics2HWParams(ii,:) = Physics2HWParams; -AO.SKQ.Setpoint.Physics2HWParams(ii,:) = Physics2HWParams; - -AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; -end - - -%=============== -%Kicker data -%=============== -AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); -AO.KICK.MemberOf = {'Injection','MachineConfig'}; - -AO.KICK.Monitor.Mode = Mode; -AO.KICK.Monitor.DataType = 'Scalar'; -AO.KICK.Monitor.Units = 'Hardware'; -AO.KICK.Monitor.HWUnits = 'kVolts'; -AO.KICK.Monitor.PhysicsUnits = 'mradian'; - -AO.KICK.Setpoint.Mode = Mode; -AO.KICK.Setpoint.DataType = 'Scalar'; -AO.KICK.Setpoint.Units = 'Hardware'; -AO.KICK.Setpoint.HWUnits = 'kVolts'; -AO.KICK.Setpoint.PhysicsUnits = 'mradian'; - -hw2physics_conversionfactor = 1; - -%common monitor setpoint stat devlist elem tol -kickeramp={ -% INSERT KICKERS HERE -}; - -for ii=1:size(kickeramp,1) -name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; -name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; -name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; -val =kickeramp{ii,4}; AO.KICK.Status(ii,1) = val; -val =kickeramp{ii,5}; AO.KICK.DeviceList(ii,:) = val; -val =kickeramp{ii,6}; AO.KICK.ElementList(ii,1) = val; -val =kickeramp{ii,7}; AO.KICK.Setpoint.Tolerance(ii,1) = val; - -AO.KICK.Setpoint.Range(ii,:) = [0 3]; - -if ii==1||ii==4 - AO.KICK.Monitor.HW2PhysicsParams = -hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams = -1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams = -hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams = -1/hw2physics_conversionfactor; -else - AO.KICK.Monitor.HW2PhysicsParams = hw2physics_conversionfactor; - AO.KICK.Monitor.Physics2HWParams = 1/hw2physics_conversionfactor; - AO.KICK.Setpoint.HW2PhysicsParams = hw2physics_conversionfactor; - AO.KICK.Setpoint.Physics2HWParams = 1/hw2physics_conversionfactor; -end -end - -% *** KICK Delay *** -% AO.KICK.Delay -% >> removed >> see previous versions if info needed - - -%============ -%RF System -%============ -AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); -AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; - -if OperationalMode == 3 -%-------------------------------- 4 cavity Case -%common stat devlist elem -rfcommon={ -'RF1 ' 1 [6,1] 1 ; ... -'RF2 ' 1 [6,2] 2 ; ... -'RF3 ' 1 [7,1] 3 ; ... -'RF4 ' 1 [7,2] 4 ; ... - }; - -%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance -rffreq={ -'ASP:RFFreq1 ' 'ASP:RFFreqSetpt1' 1e+6 1e-6 [0 2500] 100.0; ... -'ASP:RFFreq2 ' 'ASP:RFFreqSetpt2' 1e+6 1e-6 [0 2500] 100.0; ... -'ASP:RFFreq3 ' 'ASP:RFFreqSetpt3' 1e+6 1e-6 [0 2500] 100.0; ... -'ASP:RFFreq4 ' 'ASP:RFFreqSetpt4' 1e+6 1e-6 [0 2500] 100.0; ... - }; - -% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfphase={ -'SRF1:STN:PHASE' 'SRF1:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF2:STN:PHASE' 'SRF2:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF3:STN:PHASE' 'SRF3:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... -'SRF4:STN:PHASE' 'SRF4:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... - }; - -% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance -rfvolt={ -'SRF1:STN:VOLT:CTRL ' 'SRF1:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF2:STN:VOLT:CTRL ' 'SRF2:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF3:STN:VOLT:CTRL ' 'SRF3:STN:VOLT' 1 1 [-inf inf] inf ; ... -'SRF4:STN:VOLT:CTRL ' 'SRF4:STN:VOLT' 1 1 [-inf inf] inf ; ... - }; -% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance -rfpower={ -'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SRF1:KLYSDRIVFRWD:POWER' 'SRF1:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SRF2:KLYSDRIVFRWD:POWER' 'SRF2:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SRF3:KLYSDRIVFRWD:POWER' 'SRF3:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... -'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SRF4:KLYSDRIVFRWD:POWER' 'SRF4:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... - }; - -for ii=1:size(rfcommon,1) -name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; -val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; -val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; -val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; -end - -for ii=1:size(rffreq,1) -name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; -name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; -val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; - AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; -val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; - AO.RF.Setpoint.Physics2HWParams(ii,1) = val; -val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; -val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfphase,1) -name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; -name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; -val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Phase.HW2PhysicsParams(ii,1) = val; -val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Phase.Physics2HWParams(ii,1) = val; -val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; - AO.RF.Phase.Range(ii,:) = val; -val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; - AO.RF.Phase.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfvolt,1) -name=rfvolt{ii,1}; AO.RF.VoltageCtrl.ChannelNames(ii,:) = name; -name=rfvolt{ii,2}; AO.RF.Voltage.ChannelNames(ii,:) = name; -val =rfvolt{ii,3}; AO.RF.VoltageCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Voltage.HW2PhysicsParams(ii,1) = val; -val =rfvolt{ii,4}; AO.RF.VoltageCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Voltage.Physics2HWParams(ii,1) = val; -val =rfvolt{ii,5}; AO.RF.VoltageCtrl.Range(ii,:) = val; - AO.RF.Voltage.Range(ii,:) = val; -val =rfvolt{ii,6}; AO.RF.VoltageCtrl.Tolerance(ii,1) = val; - AO.RF.Voltage.Tolerance(ii,1) = val; -end - - -for ii=1:size(rfpower,1) -name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; -name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; -name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; -val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; - AO.RF.Power.HW2PhysicsParams(ii,1) = val; - AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; -val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; - AO.RF.Power.Physics2HWParams(ii,1) = val; - AO.RF.KlysPower.Physics2HWParams(ii,1) = val; -val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; - AO.RF.Power.Range(ii,:) = val; - AO.RF.KlysPower.Range(ii,:) = val; -val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; - AO.RF.Power.Tolerance(ii,1) = val; - AO.RF.KlysPower.Tolerance(ii,1) = val; -end - -%Frequency Readback -AO.RF.Monitor.Mode = Mode; -AO.RF.Monitor.DataType = 'Scalar'; -AO.RF.Monitor.Units = 'Hardware'; -AO.RF.Monitor.HWUnits = 'MHz'; -AO.RF.Monitor.PhysicsUnits = 'Hz'; -%Frequency Setpoint -AO.RF.Setpoint.Mode = Mode; -AO.RF.Setpoint.DataType = 'Scalar'; -AO.RF.Setpoint.Units = 'Hardware'; -AO.RF.Setpoint.HWUnits = 'MHz'; -AO.RF.Setpoint.PhysicsUnits = 'Hz'; - -%Voltage control -AO.RF.VoltageCtrl.Mode = Mode; -AO.RF.VoltageCtrl.DataType = 'Scalar'; -AO.RF.VoltageCtrl.Units = 'Hardware'; -AO.RF.VoltageCtrl.HWUnits = 'Volts'; -AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; - -%Voltage monitor -AO.RF.Voltage.Mode = Mode; -AO.RF.Voltage.DataType = 'Scalar'; -AO.RF.Voltage.Units = 'Hardware'; -AO.RF.Voltage.HWUnits = 'Volts'; -AO.RF.Voltage.PhysicsUnits = 'Volts'; - -%Power Control -AO.RF.PowerCtrl.Mode = Mode; -AO.RF.PowerCtrl.DataType = 'Scalar'; -AO.RF.PowerCtrl.Units = 'Hardware'; -AO.RF.PowerCtrl.HWUnits = 'MWatts'; -AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; - -%Power Monitor -AO.RF.Power.Mode = Mode; -AO.RF.Power.DataType = 'Scalar'; -AO.RF.Power.Units = 'Hardware'; -AO.RF.Power.HWUnits = 'MWatts'; -AO.RF.Power.PhysicsUnits = 'MWatts'; - -%Klystron Forward Power -AO.RF.KlysPower.Mode = Mode; -AO.RF.KlysPower.DataType = 'Scalar'; -AO.RF.KlysPower.Units = 'Hardware'; -AO.RF.KlysPower.HWUnits = 'MWatts'; -AO.RF.KlysPower.PhysicsUnits = 'MWatts'; - -%Station Phase Control -AO.RF.PhaseCtrl.Mode = Mode; -AO.RF.PhaseCtrl.DataType = 'Scalar'; -AO.RF.PhaseCtrl.Units = 'Hardware'; -AO.RF.PhaseCtrl.HWUnits = 'Degrees'; -AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; - - -%Station Phase Monitor -AO.RF.Phase.Mode = Mode; -AO.RF.Phase.DataType = 'Scalar'; -AO.RF.Phase.Units = 'Hardware'; -AO.RF.Phase.HWUnits = 'Degrees'; -AO.RF.Phase.PhysicsUnits = 'Degrees'; - - -else -%------------------------------------- 1 Cavity Case -AO.RF.Status = 1; -AO.RF.CommonNames = 'RF'; -AO.RF.DeviceList = [1 1]; -AO.RF.ElementList = [1]; - -%Frequency Readback -AO.RF.Monitor.Mode = Mode; -AO.RF.Monitor.DataType = 'Scalar'; -AO.RF.Monitor.Units = 'Hardware'; -AO.RF.Monitor.HW2PhysicsParams = 1e+6; %no hw2physics function necessary -AO.RF.Monitor.Physics2HWParams = 1e-6; -AO.RF.Monitor.HWUnits = 'MHz'; -AO.RF.Monitor.PhysicsUnits = 'Hz'; -AO.RF.Monitor.ChannelNames = 'ASP:RFFreqSetpt'; - -%Frequency Setpoint -AO.RF.Setpoint.Mode = Mode; -AO.RF.Setpoint.DataType = 'Scalar'; -AO.RF.Setpoint.Units = 'Hardware'; -AO.RF.Setpoint.HW2PhysicsParams = 1e+6; -AO.RF.Setpoint.Physics2HWParams = 1e-6; -AO.RF.Setpoint.HWUnits = 'MHz'; -AO.RF.Setpoint.PhysicsUnits = 'Hz'; -AO.RF.Setpoint.ChannelNames = 'ASP:RFFreqSetpt'; -AO.RF.Setpoint.Range = [0 2500]; -AO.RF.Setpoint.Tolerance = 100.0; - -%Voltage control -AO.RF.VoltageCtrl.Mode = Mode; -AO.RF.VoltageCtrl.DataType = 'Scalar'; -AO.RF.VoltageCtrl.Units = 'Hardware'; -AO.RF.VoltageCtrl.HW2PhysicsParams = 1; -AO.RF.VoltageCtrl.Physics2HWParams = 1; -AO.RF.VoltageCtrl.HWUnits = 'Volts'; -AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; -AO.RF.VoltageCtrl.ChannelNames = 'SRF1:STN:VOLT:CTRL'; -AO.RF.VoltageCtrl.Range = [-inf inf]; -AO.RF.VoltageCtrl.Tolerance = inf; - -%Voltage monitor -AO.RF.Voltage.Mode = Mode; -AO.RF.Voltage.DataType = 'Scalar'; -AO.RF.Voltage.Units = 'Hardware'; -AO.RF.Voltage.HW2PhysicsParams = 1; -AO.RF.Voltage.Physics2HWParams = 1; -AO.RF.Voltage.HWUnits = 'Volts'; -AO.RF.Voltage.PhysicsUnits = 'Volts'; -AO.RF.Voltage.ChannelNames = 'SRF1:STN:VOLT'; -AO.RF.Voltage.Range = [-inf inf]; -AO.RF.Voltage.Tolerance = inf; - -%Power Control -AO.RF.PowerCtrl.Mode = Mode; -AO.RF.PowerCtrl.DataType = 'Scalar'; -AO.RF.PowerCtrl.Units = 'Hardware'; -AO.RF.PowerCtrl.HW2PhysicsParams = 1; -AO.RF.PowerCtrl.Physics2HWParams = 1; -AO.RF.PowerCtrl.HWUnits = 'MWatts'; -AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; -AO.RF.PowerCtrl.ChannelNames = 'SRF1:KLYSDRIVFRWD:POWER:ON'; -AO.RF.PowerCtrl.Range = [-inf inf]; -AO.RF.PowerCtrl.Tolerance = inf; - -%Power Monitor -AO.RF.Power.Mode = Mode; -AO.RF.Power.DataType = 'Scalar'; -AO.RF.Power.Units = 'Hardware'; -AO.RF.Power.HW2PhysicsParams = 1; -AO.RF.Power.Physics2HWParams = 1; -AO.RF.Power.HWUnits = 'MWatts'; -AO.RF.Power.PhysicsUnits = 'MWatts'; -AO.RF.Power.ChannelNames = 'SRF1:KLYSDRIVFRWD:POWER'; -AO.RF.Power.Range = [-inf inf]; -AO.RF.Power.Tolerance = inf; - -%Klystron Forward Power -AO.RF.KlysPower.Mode = Mode; -AO.RF.KlysPower.DataType = 'Scalar'; -AO.RF.KlysPower.Units = 'Hardware'; -AO.RF.KlysPower.HW2PhysicsParams = 1; -AO.RF.KlysPower.Physics2HWParams = 1; -AO.RF.KlysPower.HWUnits = 'MWatts'; -AO.RF.KlysPower.PhysicsUnits = 'MWatts'; -AO.RF.KlysPower.ChannelNames = 'SRF1:KLYSOUTFRWD:POWER'; -AO.RF.KlysPower.Range = [-inf inf]; -AO.RF.KlysPower.Tolerance = inf; - - -%Station Phase Control -AO.RF.PhaseCtrl.Mode = Mode; -AO.RF.PhaseCtrl.DataType = 'Scalar'; -AO.RF.PhaseCtrl.Units = 'Hardware'; -AO.RF.PhaseCtrl.HW2PhysicsParams = 1; -AO.RF.PhaseCtrl.Physics2HWParams = 1; -AO.RF.PhaseCtrl.HWUnits = 'Degrees'; -AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; -AO.RF.PhaseCtrl.ChannelNames = 'SRF1:STN:PHASE'; -AO.RF.PhaseCtrl.Range = [-200 200]; -AO.RF.PhaseCtrl.Tolerance = inf; - -%Station Phase Monitor -AO.RF.Phase.Mode = Mode; -AO.RF.Phase.DataType = 'Scalar'; -AO.RF.Phase.Units = 'Hardware'; -AO.RF.Phase.HW2PhysicsParams = 1; -AO.RF.Phase.Physics2HWParams = 1; -AO.RF.Phase.HWUnits = 'Degrees'; -AO.RF.Phase.PhysicsUnits = 'Degrees'; -AO.RF.Phase.ChannelNames = 'SRF1:STN:PHASE:CALC'; -AO.RF.Phase.Range = [-200 200]; -AO.RF.Phase.Tolerance = inf; -end - - - -%==== -%TUNE -%==== -AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); -AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; -AO.TUNE.CommonNames = ['xtune';'ytune';'stune']; -AO.TUNE.DeviceList = [ 1 1; 1 2; 1 3]; -AO.TUNE.ElementList = [1 2 3]'; -AO.TUNE.Status = [1 1 0]'; - -AO.TUNE.Monitor.Mode = Mode; -AO.TUNE.Monitor.DataType = 'Vector'; -AO.TUNE.Monitor.DataTypeIndex = [1 2 3]'; -AO.TUNE.Monitor.ChannelNames = 'MeasTune'; -AO.TUNE.Monitor.Units = 'Hardware'; -AO.TUNE.Monitor.HW2PhysicsParams = 1; -AO.TUNE.Monitor.Physics2HWParams = 1; -AO.TUNE.Monitor.HWUnits = 'fractional tune'; -AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; - - -%==== -%DCCT -%==== -AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); -AO.DCCT.MemberOf = {'Diagnostics'}; -AO.DCCT.CommonNames = 'DCCT'; -AO.DCCT.DeviceList = [1 1]; -AO.DCCT.ElementList = [1]; -AO.DCCT.Status = [1]; - -AO.DCCT.Monitor.Mode = Mode; -AO.DCCT.Monitor.DataType = 'Scalar'; -AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; -AO.DCCT.Monitor.Units = 'Hardware'; -AO.DCCT.Monitor.HWUnits = 'milli-ampere'; -AO.DCCT.Monitor.PhysicsUnits = 'ampere'; -AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; -AO.DCCT.Monitor.Physics2HWParams = 1000; - - -% %================== -% %Machine Parameters -% %================== -% Removed in this version, see pervious version for more info - -%====== -%Septum -%====== -% ifam=ifam+1; -% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); -% AO.Septum.MemberOf = {'Injection'}; -% AO.Septum.Status = 1; -% -% AO.Septum.CommonNames = 'Septum '; -% AO.Septum.DeviceList = [3 1]; -% AO.Septum.ElementList = [1]; -% -% AO.Septum.Monitor.Mode = Mode; -% AO.Septum.Monitor.DataType = 'Scalar'; -% AO.Septum.Monitor.Units = 'Hardware'; -% AO.Septum.Monitor.HWUnits = 'ampere'; -% AO.Septum.Monitor.PhysicsUnits = 'radian'; -% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; -% -% AO.Septum.Setpoint.Mode = Mode; -% AO.Septum.Setpoint.DataType = 'Scalar'; -% AO.Septum.Setpoint.Units = 'Hardware'; -% AO.Septum.Setpoint.HWUnits = 'ampere'; -% AO.Septum.Setpoint.PhysicsUnits = 'radian'; -% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; -% AO.Septum.Setpoint.Range = [0, 2500]; -% AO.Septum.Setpoint.Tolerance = 100.0; -% -% AO.Septum.Monitor.HW2PhysicsParams = 1; -% AO.Septum.Monitor.Physics2HWParams = 1; -% AO.Septum.Setpoint.HW2PhysicsParams = 1; -% AO.Septum.Setpoint.Physics2HWParams = 1; - - -%==================== -%Photon Beamline Data -%==================== -% >> removed >> see previous versions if info needed - -%==================== -%BPLD Data -%==================== -% >> removed >> see previous versions if info needed - - - -% The operational mode sets the path, filenames, and other important parameters -% Run setoperationalmode after most of the AO is built so that the Units and Mode fields -% can be set in setoperationalmode -fprintf('\n'); -setao(AO); -setoperationalmode(OperationalMode); -AO = getao; - - -%%%%%%%%%%%%%%%% -% DeltaRespMat % -%%%%%%%%%%%%%%%% - -% I remove the physics2hw conversion because the physics2hw is -% is calibrated yet. - -% Set response matrix kick size in hardware units (amps) -AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', .15e-3 / 3, AO.HCM.DeviceList); -AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', .15e-3 / 3, AO.VCM.DeviceList); - -%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point -%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); -%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); - - -AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); -AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); -AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); - - -AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); -AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); -AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); -AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get S-positions [meters] % -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Using ...ATIndex(:,1) will accomodata for split elements where the first -% of a group of elements is put in the first column ie, if SFA is split in -% two then ATIndex will look like [2 3; 11 12; ...] where each row is a -% magnet and column represents each split. -global THERING -AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; -AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; -AO.FTx.Position = findspos(THERING, AO.FTx.AT.ATIndex(:,1))'; -AO.FTy.Position = findspos(THERING, AO.FTy.AT.ATIndex(:,1))'; -AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; -AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; -AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; -AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; -AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; -AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; -AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; -AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; -AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; -AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; -AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; -AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; -AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; -AO.DCCT.Position = 0; -AO.TUNE.Position = 0; - - -% Save AO -setao(AO); - - -function dispobject(AO,name) - -n = length(fieldnames(AO)); - -if n > 0 - fprintf(' %10s ',name); - if mod(n,5) == 0 - fprintf('\n'); - end +function aspinit(OperationalMode) +% aspinit(OperationalMode) +% +% Initialize parameters for ASP control in MATLAB +% +%========================== +% Accelerator Family Fields +%========================== +% FamilyName BPMx, HCM, etc +% CommonNames Shortcut name for each element (optional) +% DeviceList [Sector, Number] +% ElementList number in list +% Position m, magnet center +% +% MONITOR FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units Physics or HW +% HW2PhysicsFcn function handle used to convert from hardware to physics units ==> inline will not compile, see below +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% +% SETPOINT FIELDS +% Mode online/manual/special/simulator +% ChannelNames PV for monitor +% Units hardware or physics +% HW2PhysicsFcn function handle used to convert from hardware to physics units +% HW2PhysicsParams parameters used for conversion function +% Physics2HWFcn function handle used to convert from physics to hardware units +% Physics2HWParams parameters used for conversion function +% HWUnits units for Hardware 'ampere'; +% PhysicsUnits units for physics 'Rad'; +% Range minsetpoint, maxsetpoint; +% Tolerance setpoint-monitor +% +%============================================= +% Accelerator Toolbox Simulation Fields +%============================================= +% ATType Quad, Sext, etc +% ATIndex index in THERING +% ATParameterGroup parameter group +% +%============ +% Family List +%============ +% BPMx BPMy - beam position monitors +% HCM VCM - corrector magnets wound into sextupoles +% BEND - gradient dipoles +% QFA QDA QFB - quadrupole magnets +% SFA SDA SDB SFB - sextupole magnets +% SQK - skew quads wound into SDA magnets +% KICK - injection kickers (DELTA type) +% RF - 4 cavities (KEK type?) +% DCCT +% Septum (Not in model yet) +% +% Normal cell: d1 bpm s1 hcor d2 q1 d3 s2 d4 bpm dip bpm d4 hcor s3 d5 q2 d6 q3 d2 bpm s4 +% d2 q3 d6 q2 d5 s3 hcor d4 bpm dip bpm d4 s2 d3 q1 d2 hcor s1 bpm d1 + +% === Change Log === +% Mark Boland 2004-02-12 +% Eugene Tan 2004-02-23 +% Eugene Tan 2004-12-13 +% Eugene Tan 2005-09-27 ver 4 +% Updated naming convention of the process variables, use version 4 of +% the lattice "assr4.m" where the correctors have been merged into the +% sextupoles. Made the necessary changes to updateatindex. Added skew +% quadrupoles and updated generate_init. +% Mark Boland 2006-05-27 +% Changed the BPM PVs to ...:SA_HPOS_MONITOR and ...:SA_VPOS_MONITOR +% +% === Still to do === +% - kicker delays +% - BPM names and other possible PVs of interest eg. Q factor etc. +% - clean up and configure the amp2k and k2amp conversion. Control system +% designed to calculate the strengths and amp values using calc records, +% therefore we should only need to change the PV name to access for +% readback at setpoints. Only problem will be in simulation/offline mode +% where those value are not available online. How do you keep the offline +% conversion factors up to date with online vals? +% +% === Generated from === + +% Default operational mode +if nargin < 1 + OperationalMode = 1; +end + + +%============================================= +% START DEFINITION OF ACCELERATOR OBJECTS +%============================================= +fprintf(' Defining the Accelerator Objects. Objects being defined:\n') + + +% Clear previous AcceleratorObjects +setao([]); + + +Mode = 'Online'; % This gets reset in setoperationalmode + +%============================================= +%BPM data: status field designates if BPM in use +%============================================= +ntbpm=98; +AO.BPMx.FamilyName = 'BPMx'; dispobject(AO,AO.BPMx.FamilyName); +AO.BPMx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.BPMx.Monitor.Mode = Mode; +AO.BPMx.Monitor.DataType = 'Scalar'; +AO.BPMx.Monitor.Units = 'Hardware'; +AO.BPMx.Monitor.HWUnits = 'mm'; +AO.BPMx.Monitor.PhysicsUnits = 'meter'; + +AO.BPMy.FamilyName = 'BPMy'; dispobject(AO,AO.BPMy.FamilyName); +AO.BPMy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.BPMy.Monitor.Mode = Mode; +AO.BPMy.Monitor.DataType = 'Scalar'; +AO.BPMy.Monitor.Units = 'Hardware'; +AO.BPMy.Monitor.HWUnits = 'mm'; +AO.BPMy.Monitor.PhysicsUnits = 'meter'; + +% x-name x-chname xstat y-name y-chname ystat DevList Elem +bpm={ +% INSERT BPM HERE +}; + +%Load fields from data block +for ii=1:size(bpm,1) +name=bpm{ii,1}; AO.BPMx.CommonNames(ii,:) = name; +name=bpm{ii,2}; AO.BPMx.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,3}; AO.BPMx.Status(ii,:) = val; +name=bpm{ii,4}; AO.BPMy.CommonNames(ii,:) = name; +name=bpm{ii,5}; AO.BPMy.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,6}; AO.BPMy.Status(ii,:) = val; +val =bpm{ii,7}; AO.BPMx.DeviceList(ii,:) = val; + AO.BPMy.DeviceList(ii,:) = val; +val =bpm{ii,8}; AO.BPMx.ElementList(ii,:) = val; + AO.BPMy.ElementList(ii,:) = val; + AO.BPMx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.BPMx.Monitor.Physics2HWParams(ii,:) = 1000; + AO.BPMy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.BPMy.Monitor.Physics2HWParams(ii,:) = 1000; +end + + +% % Get sum value from button. Don't need handles and PV namelist as +% % parameters are the same as the 'monitor' subcategory. +% AO.BPMx.Sum.Monitor = AO.BPMx.Monitor; +% AO.BPMx.Sum.SpecialFunction = 'getbpmsumspear'; +% AO.BPMx.Sum.HWUnits = 'ADC Counts'; +% AO.BPMx.Sum.PhysicsUnits = 'ADC Counts'; +% AO.BPMx.Sum.HW2PhysicsParams = 1; +% AO.BPMx.Sum.Physics2HWParams = 1; +% % Get q value from BPMs. Don't need handles and PV namelist. +% AO.BPMx.Q = AO.BPMx.Monitor; +% AO.BPMx.Q.SpecialFunction = 'getbpmqspear'; +% AO.BPMx.Q.HWUnits = 'mm'; +% AO.BPMx.Q.PhysicsUnits = 'meter'; +% AO.BPMx.Q.HW2PhysicsParams = 1e-3; +% AO.BPMx.Q.Physics2HWParams = 1000; +% +% % Definition above for horizontal. Replicate for vertical. +% AO.BPMy.Sum = AO.BPMx.Sum; +% AO.BPMy.Q = AO.BPMx.Q; + + + +%============================================= +% First Turn BPM data from Libera +%============================================= +ntbpm=98; +AO.FTx.FamilyName = 'FTx'; dispobject(AO,AO.FTx.FamilyName); +AO.FTx.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTx.Monitor.Mode = Mode; +AO.FTx.Monitor.DataType = 'Scalar'; +AO.FTx.Monitor.Units = 'Hardware'; +AO.FTx.Monitor.HWUnits = 'mm'; +AO.FTx.Monitor.PhysicsUnits = 'meter'; + +AO.FTy.FamilyName = 'FTy'; dispobject(AO,AO.FTy.FamilyName); +AO.FTy.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTy.Monitor.Mode = Mode; +AO.FTy.Monitor.DataType = 'Scalar'; +AO.FTy.Monitor.Units = 'Hardware'; +AO.FTy.Monitor.HWUnits = 'mm'; +AO.FTy.Monitor.PhysicsUnits = 'meter'; + +% x-name x-chname xstat y-name y-chname ystat DevList Elem +bpm={ +% INSERT FT HERE +}; + +%Load fields from data block +for ii=1:size(bpm,1) +name=bpm{ii,1}; AO.FTx.CommonNames(ii,:) = name; +name=bpm{ii,2}; AO.FTx.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,3}; AO.FTx.Status(ii,:) = val; +name=bpm{ii,4}; AO.FTy.CommonNames(ii,:) = name; +name=bpm{ii,5}; AO.FTy.Monitor.ChannelNames(ii,:)= name; +val =bpm{ii,6}; AO.FTy.Status(ii,:) = val; +val =bpm{ii,7}; AO.FTx.DeviceList(ii,:) = val; + AO.FTy.DeviceList(ii,:) = val; +val =bpm{ii,8}; AO.FTx.ElementList(ii,:) = val; + AO.FTy.ElementList(ii,:) = val; + AO.FTx.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.FTx.Monitor.Physics2HWParams(ii,:) = 1000; + AO.FTy.Monitor.HW2PhysicsParams(ii,:) = 1e-3; + AO.FTy.Monitor.Physics2HWParams(ii,:) = 1000; +end +AO.FTx.Status = AO.BPMx.Status; +AO.FTy.Status = AO.BPMy.Status; + +% % Get sum value from button. Don't need handles and PV namelist as +% % parameters are the same as the 'monitor' subcategory. +AO.FTx.Offset.Mode = 'Special'; +AO.FTx.Offset.Units = 'Hardware'; +AO.FTx.Offset.DataType = 'Scalar'; +AO.FTx.Offset.SpecialFunction = 'getftoffset'; +AO.FTx.Offset.SpecialFunctionSet = 'setftoffset'; +AO.FTx.Offset.HWUnits = '32ns samples'; +AO.FTx.Offset.PhysicsUnits = '32ns samples'; +AO.FTx.Offset.HW2PhysicsParams = 1; +AO.FTx.Offset.Physics2HWParams = 1; + +AO.FTx.Length.Mode = 'Special'; +AO.FTx.Length.Units = 'Hardware'; +AO.FTx.Length.DataType = 'Scalar'; +AO.FTx.Length.SpecialFunction = 'getftlength'; +AO.FTx.Length.SpecialFunctionSet = 'setftlength'; +AO.FTx.Length.HWUnits = '32ns samples'; +AO.FTx.Length.PhysicsUnits = '32ns samples'; +AO.FTx.Length.HW2PhysicsParams = 1; +AO.FTx.Length.Physics2HWParams = 1; + +AO.FTx.Maxadc.Mode = 'Special'; +AO.FTx.Maxadc.Units = 'Hardware'; +AO.FTx.Maxadc.DataType = 'Scalar'; +AO.FTx.Maxadc.SpecialFunction = 'getftmaxadc'; +AO.FTx.Maxadc.HWUnits = 'ADC counts'; +AO.FTx.Maxadc.PhysicsUnits = 'ADC counts'; +AO.FTx.Maxadc.HW2PhysicsParams = 1; +AO.FTx.Maxadc.Physics2HWParams = 1; + +% AO.FTx.Sum.Mode = 'Special'; +% AO.FTx.Sum.Units = 'Hardware'; +% AO.FTx.Sum.DataType = 'Scalar'; +% AO.FTx.Sum.SpecialFunction = 'getftsum'; +% AO.FTx.Sum.HWUnits = 'ADC counts'; +% AO.FTx.Sum.PhysicsUnits = 'ADC counts'; +% AO.FTx.Sum.HW2PhysicsParams = 1; +% AO.FTx.Sum.Physics2HWParams = 1; + + +AO.FTsum.FamilyName = 'FTsum'; dispobject(AO,AO.FTsum.FamilyName); +AO.FTsum.MemberOf = {'PlotFamily'; 'BPM'; 'Diagnostics'}; +AO.FTsum.Monitor.Mode = 'Special'; +AO.FTsum.Monitor.Units = 'Hardware'; +AO.FTsum.Monitor.DataType = 'Scalar'; +AO.FTsum.Monitor.SpecialFunction = 'getftsum'; +AO.FTsum.Monitor.HWUnits = 'ADC counts'; +AO.FTsum.Monitor.PhysicsUnits = 'ADC counts'; +AO.FTsum.Monitor.HW2PhysicsParams = 1; +AO.FTsum.Monitor.Physics2HWParams = 1; + + +%=========================================================== +% Corrector data: status field designates if corrector in use +% ASP corrector coils wound into sextupoles. Not dynamic correctors. +%=========================================================== + +AO.HCM.FamilyName = 'HCM'; dispobject(AO,AO.HCM.FamilyName); +AO.HCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'HCM'; 'Magnet'}; + +AO.HCM.Monitor.Mode = Mode; +AO.HCM.Monitor.DataType = 'Scalar'; +AO.HCM.Monitor.Units = 'Hardware'; +AO.HCM.Monitor.HWUnits = 'ampere'; +AO.HCM.Monitor.PhysicsUnits = 'radian'; +AO.HCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.HCM.Monitor.Physics2HWFcn = @k2amp; + +AO.HCM.Setpoint.Mode = Mode; +AO.HCM.Setpoint.DataType = 'Scalar'; +AO.HCM.Setpoint.Units = 'Hardware'; +AO.HCM.Setpoint.HWUnits = 'ampere'; +AO.HCM.Setpoint.PhysicsUnits = 'radian'; +AO.HCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.HCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian. Respmat settings below AO definitions. +% x-common x-monitor x-setpoint stat devlist elem tol +cor={ +% INSERT HCM HERE +}; + +[C, Leff, MagnetType] = magnetcoefficients('HCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.HCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.HCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.HCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.HCM.Status(ii,1) = val; +val =cor{ii,5}; AO.HCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.HCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.HCM.Setpoint.Tolerance(ii,1) = val; + +AO.HCM.Setpoint.Range(ii,:) = [-90 +90]; +AO.HCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.HCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.HCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + + +AO.VCM.FamilyName = 'VCM'; dispobject(AO,AO.VCM.FamilyName); +AO.VCM.MemberOf = {'PlotFamily'; 'MachineConfig'; 'COR'; 'VCM'; 'Magnet'}; + +AO.VCM.Monitor.Mode = Mode; +AO.VCM.Monitor.DataType = 'Scalar'; +AO.VCM.Monitor.Units = 'Hardware'; +AO.VCM.Monitor.HWUnits = 'ampere'; +AO.VCM.Monitor.PhysicsUnits = 'radian'; +AO.VCM.Monitor.HW2PhysicsFcn = @amp2k; +AO.VCM.Monitor.Physics2HWFcn = @k2amp; + +AO.VCM.Setpoint.Mode = Mode; +AO.VCM.Setpoint.DataType = 'Scalar'; +AO.VCM.Setpoint.Units = 'Hardware'; +AO.VCM.Setpoint.HWUnits = 'ampere'; +AO.VCM.Setpoint.PhysicsUnits = 'radian'; +AO.VCM.Setpoint.HW2PhysicsFcn = @amp2k; +AO.VCM.Setpoint.Physics2HWFcn = @k2amp; + +% HW in ampere, Physics in radian ** radian units converted to ampere below *** +% y-common y-monitor y-setpoint stat devlist elem +cor={ +% INSERT VCM HERE +}; + +[C, Leff, MagnetType] = magnetcoefficients('VCM'); + +for ii=1:size(cor,1) +name=cor{ii,1}; AO.VCM.CommonNames(ii,:) = name; +name=cor{ii,2}; AO.VCM.Monitor.ChannelNames(ii,:) = name; +name=cor{ii,3}; AO.VCM.Setpoint.ChannelNames(ii,:) = name; +val =cor{ii,4}; AO.VCM.Status(ii,1) = val; +val =cor{ii,5}; AO.VCM.DeviceList(ii,:) = val; +val =cor{ii,6}; AO.VCM.ElementList(ii,1) = val; +val =cor{ii,7}; AO.VCM.Setpoint.Tolerance(ii,1) = val; + +AO.VCM.Setpoint.Range(ii,:) = [-125 +125]; +AO.VCM.Monitor.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Monitor.Physics2HWParams{1}(ii,:) = C; +AO.VCM.Setpoint.HW2PhysicsParams{1}(ii,:) = C; +AO.VCM.Setpoint.Physics2HWParams{1}(ii,:) = C; +end + + +%============================= +% MAIN MAGNETS +%============================= + +%=========== +%Dipole data +%=========== + +% *** BEND *** +AO.BEND.FamilyName = 'BEND'; dispobject(AO,AO.BEND.FamilyName); +AO.BEND.MemberOf = {'PlotFamily'; 'MachineConfig'; 'BEND'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('BEND'); +Physics2HWParams = magnetcoefficients('BEND'); + +AO.BEND.Monitor.Mode = Mode; +AO.BEND.Monitor.DataType = 'Scalar'; +AO.BEND.Monitor.Units = 'Hardware'; +AO.BEND.Monitor.HW2PhysicsFcn = @bend2gev; % @bend2gev ??? +AO.BEND.Monitor.Physics2HWFcn = @gev2bend; +AO.BEND.Monitor.HWUnits = 'ampere'; +AO.BEND.Monitor.PhysicsUnits = 'energy'; + +AO.BEND.Setpoint.Mode = Mode; +AO.BEND.Setpoint.DataType = 'Scalar'; +AO.BEND.Setpoint.Units = 'Hardware'; +AO.BEND.Setpoint.HW2PhysicsFcn = @bend2gev; +AO.BEND.Setpoint.Physics2HWFcn = @gev2bend; +AO.BEND.Setpoint.HWUnits = 'ampere'; +AO.BEND.Setpoint.PhysicsUnits = 'energy'; + +% common monitor setpoint stat devlist elem scale tol +bend={ +% INSERT BEND HERE +}; + +for ii=1:size(bend,1) +name=bend{ii,1}; AO.BEND.CommonNames(ii,:) = name; +name=bend{ii,2}; AO.BEND.Monitor.ChannelNames(ii,:) = name; +name=bend{ii,3}; AO.BEND.Setpoint.ChannelNames(ii,:) = name; +val =bend{ii,4}; AO.BEND.Status(ii,1) = val; +val =bend{ii,5}; AO.BEND.DeviceList(ii,:) = val; +val =bend{ii,6}; AO.BEND.ElementList(ii,1) = val; +val =bend{ii,7}; % This is the scale factor +AO.BEND.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.BEND.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.BEND.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.BEND.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.BEND.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =bend{ii,8}; AO.BEND.Setpoint.Tolerance(ii,1) = val; + +AO.BEND.Setpoint.Range(ii,:) = [0 500]; +end + +%=============== +%Quadrupole data +%=============== + +% *** QFA *** +AO.QFA.FamilyName = 'QFA'; dispobject(AO,AO.QFA.FamilyName); +AO.QFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFA'); +Physics2HWParams = magnetcoefficients('QFA'); + +AO.QFA.Monitor.Mode = Mode; +AO.QFA.Monitor.DataType = 'Scalar'; +AO.QFA.Monitor.Units = 'Hardware'; +AO.QFA.Monitor.HWUnits = 'ampere'; +AO.QFA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFA.Monitor.Physics2HWFcn = @k2amp; + +AO.QFA.Setpoint.Mode = Mode; +AO.QFA.Setpoint.DataType = 'Scalar'; +AO.QFA.Setpoint.Units = 'Hardware'; +AO.QFA.Setpoint.HWUnits = 'ampere'; +AO.QFA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qfa={ +% INSERT QFA HERE +}; + +for ii=1:size(qfa,1) +name=qfa{ii,1}; AO.QFA.CommonNames(ii,:) = name; +name=qfa{ii,2}; AO.QFA.Monitor.ChannelNames(ii,:) = name; +name=qfa{ii,3}; AO.QFA.Setpoint.ChannelNames(ii,:) = name; +val =qfa{ii,4}; AO.QFA.Status(ii,1) = val; +val =qfa{ii,5}; AO.QFA.DeviceList(ii,:) = val; +val =qfa{ii,6}; AO.QFA.ElementList(ii,1) = val; +val =qfa{ii,7}; % This is the scale factor +AO.QFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfa{ii,8}; AO.QFA.Setpoint.Tolerance(ii,1) = val; + +AO.QFA.Setpoint.Range(ii,:) = [0 180]; +end + + +% *** QDA *** +AO.QDA.FamilyName = 'QDA'; dispobject(AO,AO.QDA.FamilyName); +AO.QDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QD';}; +HW2PhysicsParams = magnetcoefficients('QDA'); +Physics2HWParams = magnetcoefficients('QDA'); + +AO.QDA.Monitor.Mode = Mode; +AO.QDA.Monitor.DataType = 'Scalar'; +AO.QDA.Monitor.Units = 'Hardware'; +AO.QDA.Monitor.HWUnits = 'ampere'; +AO.QDA.Monitor.PhysicsUnits = 'meter^-2'; +AO.QDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.QDA.Monitor.Physics2HWFcn = @k2amp; + +AO.QDA.Setpoint.Mode = Mode; +AO.QDA.Setpoint.DataType = 'Scalar'; +AO.QDA.Setpoint.Units = 'Hardware'; +AO.QDA.Setpoint.HWUnits = 'ampere'; +AO.QDA.Setpoint.PhysicsUnits = 'meter^-2'; +AO.QDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QDA.Setpoint.Physics2HWFcn = @k2amp; + +% common monitor setpoint stat devlist elem scale tol +qda={ +% INSERT QDA HERE +}; + +for ii=1:size(qda,1) +name=qda{ii,1}; AO.QDA.CommonNames(ii,:) = name; +name=qda{ii,2}; AO.QDA.Monitor.ChannelNames(ii,:) = name; +name=qda{ii,3}; AO.QDA.Setpoint.ChannelNames(ii,:) = name; +val =qda{ii,4}; AO.QDA.Status(ii,1) = val; +val =qda{ii,5}; AO.QDA.DeviceList(ii,:) = val; +val =qda{ii,6}; AO.QDA.ElementList(ii,1) = val; +val =qda{ii,7}; % This is the scale factor +AO.QDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qda{ii,8}; AO.QDA.Setpoint.Tolerance(ii,1) = val; + +AO.QDA.Setpoint.Range(ii,:) = [0 100]; +end + + + +% *** QFB *** +AO.QFB.FamilyName = 'QFB'; dispobject(AO,AO.QFB.FamilyName); +AO.QFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'QUAD'; 'Magnet'; 'Tune Corrector'; 'QF';}; +HW2PhysicsParams = magnetcoefficients('QFB'); +Physics2HWParams = magnetcoefficients('QFB'); + +AO.QFB.Monitor.Mode = Mode; +AO.QFB.Monitor.DataType = 'Scalar'; +AO.QFB.Monitor.Units = 'Hardware'; +AO.QFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.QFB.Monitor.Physics2HWFcn = @k2amp; +AO.QFB.Monitor.HWUnits = 'ampere'; +AO.QFB.Monitor.PhysicsUnits = 'meter^-2'; + +AO.QFB.Setpoint.Mode = Mode; +AO.QFB.Setpoint.DataType = 'Scalar'; +AO.QFB.Setpoint.Units = 'Hardware'; +AO.QFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.QFB.Setpoint.Physics2HWFcn = @k2amp; +AO.QFB.Setpoint.HWUnits = 'ampere'; +AO.QFB.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +qfb={ +% INSERT QFB HERE +}; + +for ii=1:size(qfb,1) +name=qfb{ii,1}; AO.QFB.CommonNames(ii,:) = name; +name=qfb{ii,2}; AO.QFB.Monitor.ChannelNames(ii,:) = name; +name=qfb{ii,3}; AO.QFB.Setpoint.ChannelNames(ii,:) = name; +val =qfb{ii,4}; AO.QFB.Status(ii,1) = val; +val =qfb{ii,5}; AO.QFB.DeviceList(ii,:) = val; +val =qfb{ii,6}; AO.QFB.ElementList(ii,1) = val; +val =qfb{ii,7}; % This is the scale factor +AO.QFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.QFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.QFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.QFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.QFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.QFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =qfb{ii,8}; AO.QFB.Setpoint.Tolerance(ii,1) = val; + +AO.QFB.Setpoint.Range(ii,:) = [0 180]; +end + + +%=============== +%Sextupole data +%=============== +% *** SFA *** +AO.SFA.FamilyName = 'SFA'; dispobject(AO,AO.SFA.FamilyName); +AO.SFA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SF'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFA'); +Physics2HWParams = magnetcoefficients('SFA'); + +AO.SFA.Monitor.Mode = Mode; +AO.SFA.Monitor.DataType = 'Scalar'; +AO.SFA.Monitor.Units = 'Hardware'; +AO.SFA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFA.Monitor.Physics2HWFcn = @k2amp; +AO.SFA.Monitor.HWUnits = 'ampere'; +AO.SFA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFA.Setpoint.Mode = Mode; +AO.SFA.Setpoint.DataType = 'Scalar'; +AO.SFA.Setpoint.Units = 'Hardware'; +AO.SFA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFA.Setpoint.Physics2HWFcn = @k2amp; +AO.SFA.Setpoint.HWUnits = 'ampere'; +AO.SFA.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfa={ +% INSERT SFA HERE +}; + +for ii=1:size(sfa,1) +name=sfa{ii,1}; AO.SFA.CommonNames(ii,:) = name; +name=sfa{ii,2}; AO.SFA.Monitor.ChannelNames(ii,:) = name; +name=sfa{ii,3}; AO.SFA.Setpoint.ChannelNames(ii,:) = name; +val =sfa{ii,4}; AO.SFA.Status(ii,1) = val; +val =sfa{ii,5}; AO.SFA.DeviceList(ii,:) = val; +val =sfa{ii,6}; AO.SFA.ElementList(ii,1) = val; +val =sfa{ii,7}; % This is the scale factor +AO.SFA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfa{ii,8}; AO.SFA.Setpoint.Tolerance(ii,1) = val; + +AO.SFA.Setpoint.Range(ii,:) = [0 140]; +end + + + +% *** SDA *** +AO.SDA.FamilyName = 'SDA'; dispobject(AO,AO.SDA.FamilyName); +AO.SDA.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SD'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDA'); +Physics2HWParams = magnetcoefficients('SDA'); + +AO.SDA.Monitor.Mode = Mode; +AO.SDA.Monitor.DataType = 'Scalar'; +AO.SDA.Monitor.Units = 'Hardware'; +AO.SDA.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDA.Monitor.Physics2HWFcn = @k2amp; +AO.SDA.Monitor.HWUnits = 'ampere'; +AO.SDA.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDA.Setpoint.Mode = Mode; +AO.SDA.Setpoint.DataType = 'Scalar'; +AO.SDA.Setpoint.Units = 'Hardware'; +AO.SDA.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDA.Setpoint.Physics2HWFcn = @k2amp; +AO.SDA.Setpoint.HWUnits = 'ampere'; +AO.SDA.Setpoint.PhysicsUnits = 'meter^-3'; + + +% common monitor setpoint stat devlist elem scale tol +sda={ +% INSERT SDA HERE +}; + +for ii=1:size(sda,1) +name=sda{ii,1}; AO.SDA.CommonNames(ii,:) = name; +name=sda{ii,2}; AO.SDA.Monitor.ChannelNames(ii,:) = name; +name=sda{ii,3}; AO.SDA.Setpoint.ChannelNames(ii,:) = name; +val =sda{ii,4}; AO.SDA.Status(ii,1) = val; +val =sda{ii,5}; AO.SDA.DeviceList(ii,:) = val; +val =sda{ii,6}; AO.SDA.ElementList(ii,1) = val; +val =sda{ii,7}; % This is the scale factor +AO.SDA.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDA.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDA.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDA.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDA.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sda{ii,8}; AO.SDA.Setpoint.Tolerance(ii,1) = val; + +AO.SDA.Setpoint.Range(ii,:) = [0 140]; +end + + +% *** SDB *** +AO.SDB.FamilyName = 'SDB'; dispobject(AO,AO.SDB.FamilyName); +AO.SDB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SD'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SDB'); +Physics2HWParams = magnetcoefficients('SDB'); + +AO.SDB.Monitor.Mode = Mode; +AO.SDB.Monitor.DataType = 'Scalar'; +AO.SDB.Monitor.Units = 'Hardware'; +AO.SDB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SDB.Monitor.Physics2HWFcn = @k2amp; +AO.SDB.Monitor.HWUnits = 'ampere'; +AO.SDB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SDB.Setpoint.Mode = Mode; +AO.SDB.Setpoint.DataType = 'Scalar'; +AO.SDB.Setpoint.Units = 'Hardware'; +AO.SDB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SDB.Setpoint.Physics2HWFcn = @k2amp; +AO.SDB.Setpoint.HWUnits = 'ampere'; +AO.SDB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sdb={ +% INSERT SDB HERE +}; + +for ii=1:size(sdb,1) +name=sdb{ii,1}; AO.SDB.CommonNames(ii,:) = name; +name=sdb{ii,2}; AO.SDB.Monitor.ChannelNames(ii,:) = name; +name=sdb{ii,3}; AO.SDB.Setpoint.ChannelNames(ii,:)= name; +val =sdb{ii,4}; AO.SDB.Status(ii,1) = val; +val =sdb{ii,5}; AO.SDB.DeviceList(ii,:) = val; +val =sdb{ii,6}; AO.SDB.ElementList(ii,1) = val; +val =sdb{ii,7}; % This is the scale factor +AO.SDB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SDB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SDB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SDB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SDB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sdb{ii,8}; AO.SDB.Setpoint.Tolerance(ii,1) = val; + +AO.SDB.Setpoint.Range(ii,:) = [0 140]; +end + + + +% *** SFB *** +AO.SFB.FamilyName = 'SFB'; dispobject(AO,AO.SFB.FamilyName); +AO.SFB.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SF'; 'SEXT'; 'Magnet'; 'Chromaticity Corrector';}; +HW2PhysicsParams = magnetcoefficients('SFB'); +Physics2HWParams = magnetcoefficients('SFB'); + +AO.SFB.Monitor.Mode = Mode; +AO.SFB.Monitor.DataType = 'Scalar'; +AO.SFB.Monitor.Units = 'Hardware'; +AO.SFB.Monitor.HW2PhysicsFcn = @amp2k; +AO.SFB.Monitor.Physics2HWFcn = @k2amp; +AO.SFB.Monitor.HWUnits = 'ampere'; +AO.SFB.Monitor.PhysicsUnits = 'meter^-3'; + +AO.SFB.Setpoint.Mode = Mode; +AO.SFB.Setpoint.DataType = 'Scalar'; +AO.SFB.Setpoint.Units = 'Hardware'; +AO.SFB.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SFB.Setpoint.Physics2HWFcn = @k2amp; +AO.SFB.Setpoint.HWUnits = 'ampere'; +AO.SFB.Setpoint.PhysicsUnits = 'meter^-3'; + +% common monitor setpoint stat devlist elem scale tol +sfb={ +% INSERT SFB HERE +}; + +for ii=1:size(sfb,1) +name=sfb{ii,1}; AO.SFB.CommonNames(ii,:) = name; +name=sfb{ii,2}; AO.SFB.Monitor.ChannelNames(ii,:) = name; +name=sfb{ii,3}; AO.SFB.Setpoint.ChannelNames(ii,:)= name; +val =sfb{ii,4}; AO.SFB.Status(ii,1) = val; +val =sfb{ii,5}; AO.SFB.DeviceList(ii,:) = val; +val =sfb{ii,6}; AO.SFB.ElementLsist(ii,1) = val; +val =sfb{ii,7}; % This is the scale factor +AO.SFB.Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Monitor.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; +AO.SFB.Setpoint.HW2PhysicsParams{2}(ii,:) = val; +AO.SFB.Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Monitor.Physics2HWParams{2}(ii,:) = val; +AO.SFB.Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; +AO.SFB.Setpoint.Physics2HWParams{2}(ii,:) = val; +val =sfb{ii,8}; AO.SFB.Setpoint.Tolerance(ii,1) = val; + +AO.SFB.Setpoint.Range(ii,:) = val; +end + +%=============== +%Skew Quad data +%=============== +% *** Skew quadrupoles *** 2005/09/27 Eugene +AO.SKQ.FamilyName = 'SKQ'; dispobject(AO,AO.SKQ.FamilyName); +AO.SKQ.MemberOf = {'PlotFamily'; 'MachineConfig'; 'SkewQuad'; 'Magnet';}; +HW2PhysicsParams = magnetcoefficients('SKQ'); +Physics2HWParams = magnetcoefficients('SKQ'); + +AO.SKQ.Monitor.Mode = Mode; +AO.SKQ.Monitor.DataType = 'Scalar'; +AO.SKQ.Monitor.Units = 'Hardware'; +AO.SKQ.Monitor.HW2PhysicsFcn = @amp2k; +AO.SKQ.Monitor.Physics2HWFcn = @k2amp; +AO.SKQ.Monitor.HWUnits = 'ampere'; +AO.SKQ.Monitor.PhysicsUnits = 'meter^-2'; + +AO.SKQ.Setpoint.Mode = Mode; +AO.SKQ.Setpoint.DataType = 'Scalar'; +AO.SKQ.Setpoint.Units = 'Hardware'; +AO.SKQ.Setpoint.HW2PhysicsFcn = @amp2k; +AO.SKQ.Setpoint.Physics2HWFcn = @k2amp; +AO.SKQ.Setpoint.HWUnits = 'ampere'; +AO.SKQ.Setpoint.PhysicsUnits = 'meter^-2'; + +% common monitor setpoint stat devlist elem scale tol +sq={ +% INSERT SKQ HERE +}; + +for ii=1:size(sq,1) +name=sq{ii,1}; AO.SKQ.CommonNames(ii,:) = name; +name=sq{ii,2}; AO.SKQ.Monitor.ChannelNames(ii,:) = name; +name=sq{ii,3}; AO.SKQ.Setpoint.ChannelNames(ii,:) = name; +val =sq{ii,4}; AO.SKQ.Status(ii,1) = val; +val =sq{ii,5}; AO.SKQ.DeviceList(ii,:) = val; +val =sq{ii,6}; AO.SKQ.ElementList(ii,1) = val; +val =sq{ii,7}; AO.SKQ.Setpoint.Tolerance(ii,1) = val; +AO.SKQ.Monitor.HW2PhysicsParams(ii,:) = HW2PhysicsParams; +AO.SKQ.Setpoint.HW2PhysicsParams(ii,:) = HW2PhysicsParams; +AO.SKQ.Monitor.Physics2HWParams(ii,:) = Physics2HWParams; +AO.SKQ.Setpoint.Physics2HWParams(ii,:) = Physics2HWParams; + +AO.SKQ.Setpoint.Range(ii,:) = [-5 +5]; +end + + +%=============== +%Kicker data +%=============== +AO.KICK.FamilyName = 'KICK'; dispobject(AO,AO.KICK.FamilyName); +AO.KICK.MemberOf = {'Injection','MachineConfig'}; + +AO.KICK.Monitor.Mode = Mode; +AO.KICK.Monitor.DataType = 'Scalar'; +AO.KICK.Monitor.Units = 'Hardware'; +AO.KICK.Monitor.HWUnits = 'kVolts'; +AO.KICK.Monitor.PhysicsUnits = 'mradian'; + +AO.KICK.Setpoint.Mode = Mode; +AO.KICK.Setpoint.DataType = 'Scalar'; +AO.KICK.Setpoint.Units = 'Hardware'; +AO.KICK.Setpoint.HWUnits = 'kVolts'; +AO.KICK.Setpoint.PhysicsUnits = 'mradian'; + +hw2physics_conversionfactor = 1; + +%common monitor setpoint stat devlist elem tol +kickeramp={ +% INSERT KICKERS HERE +}; + +for ii=1:size(kickeramp,1) +name=kickeramp{ii,1}; AO.KICK.CommonNames(ii,:) = name; +name=kickeramp{ii,2}; AO.KICK.Monitor.ChannelNames(ii,:) = name; +name=kickeramp{ii,3}; AO.KICK.Setpoint.ChannelNames(ii,:)= name; +val =kickeramp{ii,4}; AO.KICK.Status(ii,1) = val; +val =kickeramp{ii,5}; AO.KICK.DeviceList(ii,:) = val; +val =kickeramp{ii,6}; AO.KICK.ElementList(ii,1) = val; +val =kickeramp{ii,7}; AO.KICK.Setpoint.Tolerance(ii,1) = val; + +AO.KICK.Setpoint.Range(ii,:) = [0 3]; + +if ii==1||ii==4 + AO.KICK.Monitor.HW2PhysicsParams = -hw2physics_conversionfactor; + AO.KICK.Monitor.Physics2HWParams = -1/hw2physics_conversionfactor; + AO.KICK.Setpoint.HW2PhysicsParams = -hw2physics_conversionfactor; + AO.KICK.Setpoint.Physics2HWParams = -1/hw2physics_conversionfactor; +else + AO.KICK.Monitor.HW2PhysicsParams = hw2physics_conversionfactor; + AO.KICK.Monitor.Physics2HWParams = 1/hw2physics_conversionfactor; + AO.KICK.Setpoint.HW2PhysicsParams = hw2physics_conversionfactor; + AO.KICK.Setpoint.Physics2HWParams = 1/hw2physics_conversionfactor; +end +end + +% *** KICK Delay *** +% AO.KICK.Delay +% >> removed >> see previous versions if info needed + + +%============ +%RF System +%============ +AO.RF.FamilyName = 'RF'; dispobject(AO,AO.RF.FamilyName); +AO.RF.MemberOf = {'MachineConfig'; 'RF'; 'RFSystem'}; + +if OperationalMode == 3 +%-------------------------------- 4 cavity Case +%common stat devlist elem +rfcommon={ +'RF1 ' 1 [6,1] 1 ; ... +'RF2 ' 1 [6,2] 2 ; ... +'RF3 ' 1 [7,1] 3 ; ... +'RF4 ' 1 [7,2] 4 ; ... + }; + +%FreqMon FreqSetpoint HW2PhysicsParams Physics2HWParams Range Tolerance +rffreq={ +'ASP:RFFreq1 ' 'ASP:RFFreqSetpt1' 1e+6 1e-6 [0 2500] 100.0; ... +'ASP:RFFreq2 ' 'ASP:RFFreqSetpt2' 1e+6 1e-6 [0 2500] 100.0; ... +'ASP:RFFreq3 ' 'ASP:RFFreqSetpt3' 1e+6 1e-6 [0 2500] 100.0; ... +'ASP:RFFreq4 ' 'ASP:RFFreqSetpt4' 1e+6 1e-6 [0 2500] 100.0; ... + }; + +% PhaseCtrl PhaseMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfphase={ +'SRF1:STN:PHASE' 'SRF1:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... +'SRF2:STN:PHASE' 'SRF2:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... +'SRF3:STN:PHASE' 'SRF3:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... +'SRF4:STN:PHASE' 'SRF4:STN:PHASE:CALC' 1 1 [-200 200] inf ; ... + }; + +% VoltCtrl VoltMon HW2PhysicsParams Physics2HWParams Range Tolerance +rfvolt={ +'SRF1:STN:VOLT:CTRL ' 'SRF1:STN:VOLT' 1 1 [-inf inf] inf ; ... +'SRF2:STN:VOLT:CTRL ' 'SRF2:STN:VOLT' 1 1 [-inf inf] inf ; ... +'SRF3:STN:VOLT:CTRL ' 'SRF3:STN:VOLT' 1 1 [-inf inf] inf ; ... +'SRF4:STN:VOLT:CTRL ' 'SRF4:STN:VOLT' 1 1 [-inf inf] inf ; ... + }; +% PowerCtrl PowerMon Klystronpower HW2PhysicsParams Physics2HWParams Range Tolerance +rfpower={ +'SRF1:KLYSDRIVFRWD:POWER:ON ' 'SRF1:KLYSDRIVFRWD:POWER' 'SRF1:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +'SRF2:KLYSDRIVFRWD:POWER:ON ' 'SRF2:KLYSDRIVFRWD:POWER' 'SRF2:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +'SRF3:KLYSDRIVFRWD:POWER:ON ' 'SRF3:KLYSDRIVFRWD:POWER' 'SRF3:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... +'SRF4:KLYSDRIVFRWD:POWER:ON ' 'SRF4:KLYSDRIVFRWD:POWER' 'SRF4:KLYSOUTFRWD:POWER' 1 1 [-inf inf] inf ; ... + }; + +for ii=1:size(rfcommon,1) +name=rfcommon{ii,1}; AO.RF.CommonNames(ii,:) = name; +val =rfcommon{ii,2}; AO.RF.Status(ii,1) = val; +val =rfcommon{ii,3}; AO.RF.DeviceList(ii,:) = val; +val =rfcommon{ii,4}; AO.RF.ElementList(ii,1) = val; +end + +for ii=1:size(rffreq,1) +name=rffreq{ii,1}; AO.RF.Monitor.ChannelNames(ii,:) = name; +name=rffreq{ii,2}; AO.RF.Setpoint.ChannelNames(ii,:) = name; +val =rffreq{ii,3}; AO.RF.Monitor.HW2PhysicsParams(ii,1) = val; + AO.RF.Setpoint.HW2PhysicsParams(ii,1) = val; +val =rffreq{ii,4}; AO.RF.Monitor.Physics2HWParams(ii,1) = val; + AO.RF.Setpoint.Physics2HWParams(ii,1) = val; +val =rffreq{ii,5}; AO.RF.Setpoint.Range(ii,:) = val; +val =rffreq{ii,6}; AO.RF.Setpoint.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfphase,1) +name=rfphase{ii,1}; AO.RF.PhaseCtrl.ChannelNames(ii,:) = name; +name=rfphase{ii,2}; AO.RF.Phase.ChannelNames(ii,:) = name; +val =rfphase{ii,3}; AO.RF.PhaseCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Phase.HW2PhysicsParams(ii,1) = val; +val =rfphase{ii,4}; AO.RF.PhaseCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Phase.Physics2HWParams(ii,1) = val; +val =rfphase{ii,5}; AO.RF.PhaseCtrl.Range(ii,:) = val; + AO.RF.Phase.Range(ii,:) = val; +val =rfphase{ii,6}; AO.RF.PhaseCtrl.Tolerance(ii,1) = val; + AO.RF.Phase.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfvolt,1) +name=rfvolt{ii,1}; AO.RF.VoltageCtrl.ChannelNames(ii,:) = name; +name=rfvolt{ii,2}; AO.RF.Voltage.ChannelNames(ii,:) = name; +val =rfvolt{ii,3}; AO.RF.VoltageCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Voltage.HW2PhysicsParams(ii,1) = val; +val =rfvolt{ii,4}; AO.RF.VoltageCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Voltage.Physics2HWParams(ii,1) = val; +val =rfvolt{ii,5}; AO.RF.VoltageCtrl.Range(ii,:) = val; + AO.RF.Voltage.Range(ii,:) = val; +val =rfvolt{ii,6}; AO.RF.VoltageCtrl.Tolerance(ii,1) = val; + AO.RF.Voltage.Tolerance(ii,1) = val; +end + + +for ii=1:size(rfpower,1) +name=rfpower{ii,1}; AO.RF.PowerCtrl.ChannelNames(ii,:) = name; +name=rfpower{ii,2}; AO.RF.Power.ChannelNames(ii,:) = name; +name=rfpower{ii,3}; AO.RF.KlysPower.ChannelNames(ii,:) = name; +val =rfpower{ii,4}; AO.RF.PowerCtrl.HW2PhysicsParams(ii,1) = val; + AO.RF.Power.HW2PhysicsParams(ii,1) = val; + AO.RF.KlysPower.HW2PhysicsParams(ii,1) = val; +val =rfpower{ii,5}; AO.RF.PowerCtrl.Physics2HWParams(ii,1) = val; + AO.RF.Power.Physics2HWParams(ii,1) = val; + AO.RF.KlysPower.Physics2HWParams(ii,1) = val; +val =rfpower{ii,6}; AO.RF.PowerCtrl.Range(ii,:) = val; + AO.RF.Power.Range(ii,:) = val; + AO.RF.KlysPower.Range(ii,:) = val; +val =rfpower{ii,7}; AO.RF.PowerCtrl.Tolerance(ii,1) = val; + AO.RF.Power.Tolerance(ii,1) = val; + AO.RF.KlysPower.Tolerance(ii,1) = val; +end + +%Frequency Readback +AO.RF.Monitor.Mode = Mode; +AO.RF.Monitor.DataType = 'Scalar'; +AO.RF.Monitor.Units = 'Hardware'; +AO.RF.Monitor.HWUnits = 'MHz'; +AO.RF.Monitor.PhysicsUnits = 'Hz'; +%Frequency Setpoint +AO.RF.Setpoint.Mode = Mode; +AO.RF.Setpoint.DataType = 'Scalar'; +AO.RF.Setpoint.Units = 'Hardware'; +AO.RF.Setpoint.HWUnits = 'MHz'; +AO.RF.Setpoint.PhysicsUnits = 'Hz'; + +%Voltage control +AO.RF.VoltageCtrl.Mode = Mode; +AO.RF.VoltageCtrl.DataType = 'Scalar'; +AO.RF.VoltageCtrl.Units = 'Hardware'; +AO.RF.VoltageCtrl.HWUnits = 'Volts'; +AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; + +%Voltage monitor +AO.RF.Voltage.Mode = Mode; +AO.RF.Voltage.DataType = 'Scalar'; +AO.RF.Voltage.Units = 'Hardware'; +AO.RF.Voltage.HWUnits = 'Volts'; +AO.RF.Voltage.PhysicsUnits = 'Volts'; + +%Power Control +AO.RF.PowerCtrl.Mode = Mode; +AO.RF.PowerCtrl.DataType = 'Scalar'; +AO.RF.PowerCtrl.Units = 'Hardware'; +AO.RF.PowerCtrl.HWUnits = 'MWatts'; +AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; + +%Power Monitor +AO.RF.Power.Mode = Mode; +AO.RF.Power.DataType = 'Scalar'; +AO.RF.Power.Units = 'Hardware'; +AO.RF.Power.HWUnits = 'MWatts'; +AO.RF.Power.PhysicsUnits = 'MWatts'; + +%Klystron Forward Power +AO.RF.KlysPower.Mode = Mode; +AO.RF.KlysPower.DataType = 'Scalar'; +AO.RF.KlysPower.Units = 'Hardware'; +AO.RF.KlysPower.HWUnits = 'MWatts'; +AO.RF.KlysPower.PhysicsUnits = 'MWatts'; + +%Station Phase Control +AO.RF.PhaseCtrl.Mode = Mode; +AO.RF.PhaseCtrl.DataType = 'Scalar'; +AO.RF.PhaseCtrl.Units = 'Hardware'; +AO.RF.PhaseCtrl.HWUnits = 'Degrees'; +AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; + + +%Station Phase Monitor +AO.RF.Phase.Mode = Mode; +AO.RF.Phase.DataType = 'Scalar'; +AO.RF.Phase.Units = 'Hardware'; +AO.RF.Phase.HWUnits = 'Degrees'; +AO.RF.Phase.PhysicsUnits = 'Degrees'; + + +else +%------------------------------------- 1 Cavity Case +AO.RF.Status = 1; +AO.RF.CommonNames = 'RF'; +AO.RF.DeviceList = [1 1]; +AO.RF.ElementList = [1]; + +%Frequency Readback +AO.RF.Monitor.Mode = Mode; +AO.RF.Monitor.DataType = 'Scalar'; +AO.RF.Monitor.Units = 'Hardware'; +AO.RF.Monitor.HW2PhysicsParams = 1e+6; %no hw2physics function necessary +AO.RF.Monitor.Physics2HWParams = 1e-6; +AO.RF.Monitor.HWUnits = 'MHz'; +AO.RF.Monitor.PhysicsUnits = 'Hz'; +AO.RF.Monitor.ChannelNames = 'ASP:RFFreqSetpt'; + +%Frequency Setpoint +AO.RF.Setpoint.Mode = Mode; +AO.RF.Setpoint.DataType = 'Scalar'; +AO.RF.Setpoint.Units = 'Hardware'; +AO.RF.Setpoint.HW2PhysicsParams = 1e+6; +AO.RF.Setpoint.Physics2HWParams = 1e-6; +AO.RF.Setpoint.HWUnits = 'MHz'; +AO.RF.Setpoint.PhysicsUnits = 'Hz'; +AO.RF.Setpoint.ChannelNames = 'ASP:RFFreqSetpt'; +AO.RF.Setpoint.Range = [0 2500]; +AO.RF.Setpoint.Tolerance = 100.0; + +%Voltage control +AO.RF.VoltageCtrl.Mode = Mode; +AO.RF.VoltageCtrl.DataType = 'Scalar'; +AO.RF.VoltageCtrl.Units = 'Hardware'; +AO.RF.VoltageCtrl.HW2PhysicsParams = 1; +AO.RF.VoltageCtrl.Physics2HWParams = 1; +AO.RF.VoltageCtrl.HWUnits = 'Volts'; +AO.RF.VoltageCtrl.PhysicsUnits = 'Volts'; +AO.RF.VoltageCtrl.ChannelNames = 'SRF1:STN:VOLT:CTRL'; +AO.RF.VoltageCtrl.Range = [-inf inf]; +AO.RF.VoltageCtrl.Tolerance = inf; + +%Voltage monitor +AO.RF.Voltage.Mode = Mode; +AO.RF.Voltage.DataType = 'Scalar'; +AO.RF.Voltage.Units = 'Hardware'; +AO.RF.Voltage.HW2PhysicsParams = 1; +AO.RF.Voltage.Physics2HWParams = 1; +AO.RF.Voltage.HWUnits = 'Volts'; +AO.RF.Voltage.PhysicsUnits = 'Volts'; +AO.RF.Voltage.ChannelNames = 'SRF1:STN:VOLT'; +AO.RF.Voltage.Range = [-inf inf]; +AO.RF.Voltage.Tolerance = inf; + +%Power Control +AO.RF.PowerCtrl.Mode = Mode; +AO.RF.PowerCtrl.DataType = 'Scalar'; +AO.RF.PowerCtrl.Units = 'Hardware'; +AO.RF.PowerCtrl.HW2PhysicsParams = 1; +AO.RF.PowerCtrl.Physics2HWParams = 1; +AO.RF.PowerCtrl.HWUnits = 'MWatts'; +AO.RF.PowerCtrl.PhysicsUnits = 'MWatts'; +AO.RF.PowerCtrl.ChannelNames = 'SRF1:KLYSDRIVFRWD:POWER:ON'; +AO.RF.PowerCtrl.Range = [-inf inf]; +AO.RF.PowerCtrl.Tolerance = inf; + +%Power Monitor +AO.RF.Power.Mode = Mode; +AO.RF.Power.DataType = 'Scalar'; +AO.RF.Power.Units = 'Hardware'; +AO.RF.Power.HW2PhysicsParams = 1; +AO.RF.Power.Physics2HWParams = 1; +AO.RF.Power.HWUnits = 'MWatts'; +AO.RF.Power.PhysicsUnits = 'MWatts'; +AO.RF.Power.ChannelNames = 'SRF1:KLYSDRIVFRWD:POWER'; +AO.RF.Power.Range = [-inf inf]; +AO.RF.Power.Tolerance = inf; + +%Klystron Forward Power +AO.RF.KlysPower.Mode = Mode; +AO.RF.KlysPower.DataType = 'Scalar'; +AO.RF.KlysPower.Units = 'Hardware'; +AO.RF.KlysPower.HW2PhysicsParams = 1; +AO.RF.KlysPower.Physics2HWParams = 1; +AO.RF.KlysPower.HWUnits = 'MWatts'; +AO.RF.KlysPower.PhysicsUnits = 'MWatts'; +AO.RF.KlysPower.ChannelNames = 'SRF1:KLYSOUTFRWD:POWER'; +AO.RF.KlysPower.Range = [-inf inf]; +AO.RF.KlysPower.Tolerance = inf; + + +%Station Phase Control +AO.RF.PhaseCtrl.Mode = Mode; +AO.RF.PhaseCtrl.DataType = 'Scalar'; +AO.RF.PhaseCtrl.Units = 'Hardware'; +AO.RF.PhaseCtrl.HW2PhysicsParams = 1; +AO.RF.PhaseCtrl.Physics2HWParams = 1; +AO.RF.PhaseCtrl.HWUnits = 'Degrees'; +AO.RF.PhaseCtrl.PhysicsUnits = 'Degrees'; +AO.RF.PhaseCtrl.ChannelNames = 'SRF1:STN:PHASE'; +AO.RF.PhaseCtrl.Range = [-200 200]; +AO.RF.PhaseCtrl.Tolerance = inf; + +%Station Phase Monitor +AO.RF.Phase.Mode = Mode; +AO.RF.Phase.DataType = 'Scalar'; +AO.RF.Phase.Units = 'Hardware'; +AO.RF.Phase.HW2PhysicsParams = 1; +AO.RF.Phase.Physics2HWParams = 1; +AO.RF.Phase.HWUnits = 'Degrees'; +AO.RF.Phase.PhysicsUnits = 'Degrees'; +AO.RF.Phase.ChannelNames = 'SRF1:STN:PHASE:CALC'; +AO.RF.Phase.Range = [-200 200]; +AO.RF.Phase.Tolerance = inf; +end + + + +%==== +%TUNE +%==== +AO.TUNE.FamilyName = 'TUNE'; dispobject(AO,AO.TUNE.FamilyName); +AO.TUNE.MemberOf = {'Tune'; 'Diagnostics'}; +AO.TUNE.CommonNames = ['xtune';'ytune';'stune']; +AO.TUNE.DeviceList = [ 1 1; 1 2; 1 3]; +AO.TUNE.ElementList = [1 2 3]'; +AO.TUNE.Status = [1 1 0]'; + +AO.TUNE.Monitor.Mode = Mode; +AO.TUNE.Monitor.DataType = 'Vector'; +AO.TUNE.Monitor.DataTypeIndex = [1 2 3]'; +AO.TUNE.Monitor.ChannelNames = 'MeasTune'; +AO.TUNE.Monitor.Units = 'Hardware'; +AO.TUNE.Monitor.HW2PhysicsParams = 1; +AO.TUNE.Monitor.Physics2HWParams = 1; +AO.TUNE.Monitor.HWUnits = 'fractional tune'; +AO.TUNE.Monitor.PhysicsUnits = 'fractional tune'; + + +%==== +%DCCT +%==== +AO.DCCT.FamilyName = 'DCCT'; dispobject(AO,AO.DCCT.FamilyName); +AO.DCCT.MemberOf = {'Diagnostics'}; +AO.DCCT.CommonNames = 'DCCT'; +AO.DCCT.DeviceList = [1 1]; +AO.DCCT.ElementList = [1]; +AO.DCCT.Status = [1]; + +AO.DCCT.Monitor.Mode = Mode; +AO.DCCT.Monitor.DataType = 'Scalar'; +AO.DCCT.Monitor.ChannelNames = 'SR11BCM01:CURRENT_MONITOR'; +AO.DCCT.Monitor.Units = 'Hardware'; +AO.DCCT.Monitor.HWUnits = 'milli-ampere'; +AO.DCCT.Monitor.PhysicsUnits = 'ampere'; +AO.DCCT.Monitor.HW2PhysicsParams = 1e-3; +AO.DCCT.Monitor.Physics2HWParams = 1000; + + +% %================== +% %Machine Parameters +% %================== +% Removed in this version, see pervious version for more info + +%====== +%Septum +%====== +% ifam=ifam+1; +% AO.Septum.FamilyName = 'Septum'; dispobject(AO,AO.Septum.FamilyName); +% AO.Septum.MemberOf = {'Injection'}; +% AO.Septum.Status = 1; +% +% AO.Septum.CommonNames = 'Septum '; +% AO.Septum.DeviceList = [3 1]; +% AO.Septum.ElementList = [1]; +% +% AO.Septum.Monitor.Mode = Mode; +% AO.Septum.Monitor.DataType = 'Scalar'; +% AO.Septum.Monitor.Units = 'Hardware'; +% AO.Septum.Monitor.HWUnits = 'ampere'; +% AO.Septum.Monitor.PhysicsUnits = 'radian'; +% AO.Septum.Monitor.ChannelNames = 'BTS-B9V:Curr'; +% +% AO.Septum.Setpoint.Mode = Mode; +% AO.Septum.Setpoint.DataType = 'Scalar'; +% AO.Septum.Setpoint.Units = 'Hardware'; +% AO.Septum.Setpoint.HWUnits = 'ampere'; +% AO.Septum.Setpoint.PhysicsUnits = 'radian'; +% AO.Septum.Setpoint.ChannelNames = 'BTS-B9V:CurrSetpt'; +% AO.Septum.Setpoint.Range = [0, 2500]; +% AO.Septum.Setpoint.Tolerance = 100.0; +% +% AO.Septum.Monitor.HW2PhysicsParams = 1; +% AO.Septum.Monitor.Physics2HWParams = 1; +% AO.Septum.Setpoint.HW2PhysicsParams = 1; +% AO.Septum.Setpoint.Physics2HWParams = 1; + + +%==================== +%Photon Beamline Data +%==================== +% >> removed >> see previous versions if info needed + +%==================== +%BPLD Data +%==================== +% >> removed >> see previous versions if info needed + + + +% The operational mode sets the path, filenames, and other important parameters +% Run setoperationalmode after most of the AO is built so that the Units and Mode fields +% can be set in setoperationalmode +fprintf('\n'); +setao(AO); +setoperationalmode(OperationalMode); +AO = getao; + + +%%%%%%%%%%%%%%%% +% DeltaRespMat % +%%%%%%%%%%%%%%%% + +% I remove the physics2hw conversion because the physics2hw is +% is calibrated yet. + +% Set response matrix kick size in hardware units (amps) +AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', .15e-3 / 3, AO.HCM.DeviceList); +AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', .15e-3 / 3, AO.VCM.DeviceList); + +%% 'NoEnergyScaling' because I don't want to force a BEND magnet read at this point +%AO.HCM.Setpoint.DeltaRespMat = mm2amps('HCM', .5, AO.HCM.DeviceList, 'NoEnergyScaling'); +%AO.VCM.Setpoint.DeltaRespMat = mm2amps('VCM', .5, AO.VCM.DeviceList, 'NoEnergyScaling'); + + +AO.QFA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFA.FamilyName, 'Setpoint', AO.QFA.Setpoint.DeltaRespMat, AO.QFA.DeviceList); +AO.QFB.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QFB.FamilyName, 'Setpoint', AO.QFB.Setpoint.DeltaRespMat, AO.QFB.DeviceList); +AO.QDA.Setpoint.DeltaRespMat = .2; %physics2hw(AO.QDA.FamilyName, 'Setpoint', AO.QDA.Setpoint.DeltaRespMat, AO.QDA.DeviceList); + + +AO.SFA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFA.FamilyName, 'Setpoint', AO.SFA.Setpoint.DeltaRespMat, AO.SFA.DeviceList); +AO.SFB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SFB.FamilyName, 'Setpoint', AO.SFB.Setpoint.DeltaRespMat, AO.SFB.DeviceList); +AO.SDA.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDA.FamilyName, 'Setpoint', AO.SDA.Setpoint.DeltaRespMat, AO.SDA.DeviceList); +AO.SDB.Setpoint.DeltaRespMat = 3; %physics2hw(AO.SDB.FamilyName, 'Setpoint', AO.SDB.Setpoint.DeltaRespMat, AO.SDB.DeviceList); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Get S-positions [meters] % +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Using ...ATIndex(:,1) will accomodata for split elements where the first +% of a group of elements is put in the first column ie, if SFA is split in +% two then ATIndex will look like [2 3; 11 12; ...] where each row is a +% magnet and column represents each split. +global THERING +AO.BPMx.Position = findspos(THERING, AO.BPMx.AT.ATIndex(:,1))'; +AO.BPMy.Position = findspos(THERING, AO.BPMy.AT.ATIndex(:,1))'; +AO.FTx.Position = findspos(THERING, AO.FTx.AT.ATIndex(:,1))'; +AO.FTy.Position = findspos(THERING, AO.FTy.AT.ATIndex(:,1))'; +AO.HCM.Position = findspos(THERING, AO.HCM.AT.ATIndex(:,1))'; +AO.VCM.Position = findspos(THERING, AO.VCM.AT.ATIndex(:,1))'; +AO.QFA.Position = findspos(THERING, AO.QFA.AT.ATIndex(:,1))'; +AO.QDA.Position = findspos(THERING, AO.QDA.AT.ATIndex(:,1))'; +AO.QFB.Position = findspos(THERING, AO.QFB.AT.ATIndex(:,1))'; +AO.SFA.Position = findspos(THERING, AO.SFA.AT.ATIndex(:,1))'; +AO.SFB.Position = findspos(THERING, AO.SFB.AT.ATIndex(:,1))'; +AO.SDA.Position = findspos(THERING, AO.SDA.AT.ATIndex(:,1))'; +AO.SDB.Position = findspos(THERING, AO.SDB.AT.ATIndex(:,1))'; +AO.SKQ.Position = findspos(THERING, AO.SKQ.AT.ATIndex(:,1))'; +AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; +AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; +AO.KICK.Position = findspos(THERING, AO.KICK.AT.ATIndex(:,1))'; +AO.DCCT.Position = 0; +AO.TUNE.Position = 0; + + +% Save AO +setao(AO); + + +function dispobject(AO,name) + +n = length(fieldnames(AO)); + +if n > 0 + fprintf(' %10s ',name); + if mod(n,5) == 0 + fprintf('\n'); + end end \ No newline at end of file diff --git a/machine/ASP/StorageRing/assr4.m b/machine/ASP/StorageRing/assr4.m index 717b646a..51959daa 100644 --- a/machine/ASP/StorageRing/assr4.m +++ b/machine/ASP/StorageRing/assr4.m @@ -22,7 +22,9 @@ function assr4(varargin) GLOBVAL.LatticeFile = mfilename; FAMLIST = cell(0); -L0 = 2.159946602239996e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. +L0 = 2.159946602239996e+02; % calculated using findspos +L0 = 2.159945540689997e+02;% with new dipole path lengths. Designed for 216m. 28/4/2010 Eugene + C0 = 299792458; % speed of light [m/s] HarmNumber = 360; @@ -37,12 +39,15 @@ function assr4(varargin) % ap = aperture('AP',[-32 17 -16 16]*1e-3,'AperturePass'); ap = aperture('AP',[-16 17 -16 16]*1e2,'AperturePass'); +% Quadrupole field extent on one end past the magnet iron length as +% measured by RMIT student Neville. +quadDL_2 = 0.0042; d1 = drift('D1' ,2.698300e+000,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) -d2 = drift('D2' ,1.900000e-001,'DriftPass'); -d3 = drift('D3' ,1.650000e-001,'DriftPass'); +d2 = drift('D2' ,1.900000e-001-quadDL_2,'DriftPass'); +d3 = drift('D3' ,1.650000e-001-quadDL_2,'DriftPass'); d4 = drift('D4' ,2.750000e-001,'DriftPass'); -d5 = drift('D5' ,1.550000e-001,'DriftPass'); -d6 = drift('D6' ,4.500000e-001,'DriftPass'); +d5 = drift('D5' ,1.550000e-001-quadDL_2,'DriftPass'); +d6 = drift('D6' ,4.500000e-001-quadDL_2*2,'DriftPass'); % Modified drifts around BPM sections. bpm = monitor('BPM' ,'IdentityPass'); @@ -58,15 +63,30 @@ function assr4(varargin) d2b = drift('D2B' , 1.030000e-001,'DriftPass'); % Dipoles -% design -> rbend('BEND',1.726000e+000,2.243995e-001,1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); % From numerical studies -> L: 1.72579121675e+000 % K: 0.33295132 % Sext: 0.01092687 % Oct: 0.15166053 -scalek = 0.98855592463187; -edge_offset = 0.03603626237179; -dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4Pass'); -dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4Pass'); +% 1.006150825679126; % scaling factor for chromaticity comparison Eugene +% 24/1/2008 +scalek = 1; +edge_offset = 0.01; +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4E2Pass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4E2Pass'); +FAMLIST{dip1}.ElemData.PolynomA = [0 0 0 0]; +FAMLIST{dip1}.ElemData.PolynomB = [0 -0.33295132*scalek -.05 0]; +FAMLIST{dip1}.ElemData.FullGap = 0.045; +FAMLIST{dip1}.ElemData.FringeInt1 = 0.5; +FAMLIST{dip1}.ElemData.FringeInt2 = 0.5; +FAMLIST{dip2}.ElemData.PolynomA = [0 0 0 0]; +FAMLIST{dip2}.ElemData.PolynomB = [0 -0.33295132*scalek -.05 0]; +FAMLIST{dip2}.ElemData.FullGap = 0.045; +FAMLIST{dip2}.ElemData.FringeInt1 = 0.5; +FAMLIST{dip2}.ElemData.FringeInt2 = 0.5; + + % Quadrupoles (for design dipole: [QFA,QDA,QFB]=[1.761741,-1.038377,1.533802]; % To match new dipole values from numerical studies @@ -76,18 +96,37 @@ function assr4(varargin) % qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); % To match split dipole values from numerical studies (SBENDS) % tune of 13.29, 5.216 and 0 dispersion in straights. -qfa = quadrupole('QFA' ,3.550000e-001, 1.76272982211693,'QuadLinearPass'); -qda = quadrupole('QDA' ,1.800000e-001,-1.06276736743823,'QuadLinearPass'); -qfb = quadrupole('QFB' ,3.550000e-001, 1.53992875479511,'QuadLinearPass'); +% qfa = quadrupole('QFA' ,3.550000e-001, 1.76272982211693,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.06276736743823,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.53992875479511,'QuadLinearPass'); +% Match single bends above to tune of 13.29, 5.216 and 0 dispersion. EUgene +% 9/2/2009 +qfa = quadrupole('QFA' ,3.550000e-001 + quadDL_2*2, 1.762632151326440/1.0282,'StrMPoleSymplectic4Pass'); +qda = quadrupole('QDA' ,1.800000e-001 + quadDL_2*2,-1.064480621954161/1.0555,'StrMPoleSymplectic4Pass'); +qfb = quadrupole('QFB' ,3.550000e-001 + quadDL_2*2, 1.540311343769903/1.0282,'StrMPoleSymplectic4Pass'); + % Sextupoles with built in correctors. Corrector settings given by kick % angle in radians. -sfa = sextcorr('SFA' ,2.000000e-001, 1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); -sda = sextcorr('SDA' ,2.000000e-001,-1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); -sdb = sextcorr('SDB' ,2.000000e-001,-7.014635e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); -sfb = sextcorr('SFB' ,2.000000e-001, 7.189346e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); - +if exist('StrCorrMPoleSymplectic4Pass') == 3 + % Old AT 1.3 + sfa = sextcorr('SFA' ,2.000000e-001, 1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); + sda = sextcorr('SDA' ,2.000000e-001,-1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); + sdb = sextcorr('SDB' ,2.000000e-001,-7.014635e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); + sfb = sextcorr('SFB' ,2.000000e-001, 7.189346e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); +else + sfa = sextupole('SFA' ,2.000000e-001, 1.400000e+001,'StrMPoleSymplectic4Pass'); + sda = sextupole('SDA' ,2.000000e-001,-1.400000e+001,'StrMPoleSymplectic4Pass'); + sdb = sextupole('SDB' ,2.000000e-001,-7.098322,'StrMPoleSymplectic4Pass'); + sfb = sextupole('SFB' ,2.000000e-001, 7.271212,'StrMPoleSymplectic4Pass'); + + FAMLIST{sfa}.ElemData.KickAngle = [0 0]; + FAMLIST{sda}.ElemData.KickAngle = [0 0]; + FAMLIST{sfb}.ElemData.KickAngle = [0 0]; + FAMLIST{sdb}.ElemData.KickAngle = [0 0]; +end + % RF cavity and the corresponding straight used to position the cavity. % 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also % we are using ThinCavities therefore the drifts have to be set @@ -181,7 +220,8 @@ function assr4(varargin) % Definition of the types of rings kickring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; cavity1ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14];; -cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 celrf07_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +% cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 celrf07_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +cavity4ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel celrf06_4 celrf07_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel]; fullring_startwithRF = [ ap cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 ]; ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; diff --git a/machine/ASP/StorageRing/assr4_disp.m b/machine/ASP/StorageRing/assr4_disp.m index 2e4d74bc..d1e5cb5e 100644 --- a/machine/ASP/StorageRing/assr4_disp.m +++ b/machine/ASP/StorageRing/assr4_disp.m @@ -58,13 +58,14 @@ function assr4(varargin) d2b = drift('D2B' , 1.030000e-001,'DriftPass'); % Dipoles -% design -> rbend_asp('BEND',1.726000e+000,2.243995e-001,1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); % From numerical studies -> L: 1.72579121675e+000 % K: 0.33295132 % Sext: 0.01092687 % Oct: 0.15166053 -dip1 = rbend_asp('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); -dip2 = rbend_asp('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); scalek = 1; leftdrift_a = drift('leftdrift',0.076,'DriftPass'); @@ -72,38 +73,38 @@ function assr4(varargin) rightdrift_b = drift('rightdrift',0.064,'DriftPass'); rightdrift_a = drift('rightdrift',0.0887292346-len(rightdrift_b),'DriftPass'); -% b_left01 = rbend_asp('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892 -1.2289013273]); -% b_left02 = rbend_asp('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949 -0.0632750927]); -% b_left03 = rbend_asp('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966 -0.1103893288]); -% b_left04 = rbend_asp('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022 0.6681103839]); -% b_left05 = rbend_asp('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205 0.3349521492]); -% b_centre01 = rbend_asp('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817 0.2965845308]); -% b_centre02 = rbend_asp('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994 -0.2196079070]); -% b_centre03 = rbend_asp('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); -% b_centre04 = rbend_asp('b_centre04',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098 -0.2148826863]); -% b_centre05 = rbend_asp('b_centre05',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753 0.2969171603]); -% b_right01 = rbend_asp('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494 0.3681905186]); -% b_right02 = rbend_asp('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712 0.9528854933]); -% b_right03 = rbend_asp('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022 0.7022676128]); -% b_right04 = rbend_asp('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318 0.2460706289]); -% b_right05 = rbend_asp('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629 0.7697020810]); - -% rbend_asp -b_left01 = rbend_asp('b_left01',0.0695312761,0.0001700782,0.1121962211,-0.1120187381,0.0026580668*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026580668*scalek -0.0222542890 -0.0307698880]); -b_left02 = rbend_asp('b_left02',0.0695282915,0.0007118132,0.1120187381,-0.1112734474,0.0004302895*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0004302895*scalek -0.0824996146 -0.0652385243]); -b_left03 = rbend_asp('b_left03',0.0695152451,0.0032678721,0.1112734474,-0.1078414785,-0.1045888695*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1045888695*scalek -0.0928717833 0.2254072448]); -b_left04 = rbend_asp('b_left04',0.0694679183,0.0088002187,0.1078414785,-0.0989182337,-0.3486275471*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3486275471*scalek -0.0656081148 0.3572852967]); -b_left05 = rbend_asp('b_left05',0.0694041758,0.0092692888,0.0989182337,-0.0896518010,-0.3281526271*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3281526271*scalek -0.0355726539 0.3355904266]); -b_centre01 = rbend_asp('b_centre01',0.2820465390,0.0367531221,0.0896518010,-0.0529125655,-0.3312315118*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312315118*scalek 0.0081060667 0.2963931827]); -b_centre02 = rbend_asp('b_centre02',0.2815037989,0.0354072962,0.0529125655,-0.0175134439,-0.3306429237*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306429237*scalek 0.0237264198 -0.2192733272]); -b_centre03 = rbend_asp('b_centre03',0.2813281018,0.0349189640,0.0175134439,0.0174054578,-0.3300984023*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300984023*scalek 0.0101509428 -0.5218382720]); -b_centre04 = rbend_asp('b_centre04',0.2814996751,0.0353946633,-0.0174054578,0.0528080683,-0.3302048119*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302048119*scalek 0.0235987043 -0.2144554284]); -b_centre05 = rbend_asp('b_centre05',0.2820380879,0.0367421699,-0.0528080683,0.0895641319,-0.3309037380*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3309037380*scalek 0.0102169077 0.2963545009]); -b_right01 = rbend_asp('b_right01',0.0694014448,0.0092683188,-0.0895641319,0.0988345428,-0.3275972520*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3275972520*scalek -0.0308930090 0.3680490900]); -b_right02 = rbend_asp('b_right02',0.0694650575,0.0090032960,-0.0988345428,0.1077882518,-0.3467634133*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3467634133*scalek -0.0345063628 0.6218385567]); -b_right03 = rbend_asp('b_right03',0.0695141539,0.0037116695,-0.1077882518,0.1112699557,-0.1347732139*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1347732139*scalek 0.0189958278 0.8526578807]); -b_right04 = rbend_asp('b_right04',0.0695280819,0.0007961566,-0.1112699557,0.1120205593,-0.0014988960*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0014988960*scalek -0.0849450391 0.2100836063]); -b_right05 = rbend_asp('b_right05',0.0695312501,0.0001897883,-0.1120205593,0.1121997376,0.0026764692*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026764692*scalek -0.0276971797 0.0360627830]); +% b_left01 = rbend('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892 -1.2289013273]); +% b_left02 = rbend('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949 -0.0632750927]); +% b_left03 = rbend('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966 -0.1103893288]); +% b_left04 = rbend('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022 0.6681103839]); +% b_left05 = rbend('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205 0.3349521492]); +% b_centre01 = rbend('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817 0.2965845308]); +% b_centre02 = rbend('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994 -0.2196079070]); +% b_centre03 = rbend('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); +% b_centre04 = rbend('b_centre04',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098 -0.2148826863]); +% b_centre05 = rbend('b_centre05',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753 0.2969171603]); +% b_right01 = rbend('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494 0.3681905186]); +% b_right02 = rbend('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712 0.9528854933]); +% b_right03 = rbend('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022 0.7022676128]); +% b_right04 = rbend('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318 0.2460706289]); +% b_right05 = rbend('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629 0.7697020810]); + +% RBEND +b_left01 = rbend('b_left01',0.0695312761,0.0001700782,0.1121962211,-0.1120187381,0.0026580668*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026580668*scalek -0.0222542890 -0.0307698880]); +b_left02 = rbend('b_left02',0.0695282915,0.0007118132,0.1120187381,-0.1112734474,0.0004302895*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0004302895*scalek -0.0824996146 -0.0652385243]); +b_left03 = rbend('b_left03',0.0695152451,0.0032678721,0.1112734474,-0.1078414785,-0.1045888695*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1045888695*scalek -0.0928717833 0.2254072448]); +b_left04 = rbend('b_left04',0.0694679183,0.0088002187,0.1078414785,-0.0989182337,-0.3486275471*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3486275471*scalek -0.0656081148 0.3572852967]); +b_left05 = rbend('b_left05',0.0694041758,0.0092692888,0.0989182337,-0.0896518010,-0.3281526271*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3281526271*scalek -0.0355726539 0.3355904266]); +b_centre01 = rbend('b_centre01',0.2820465390,0.0367531221,0.0896518010,-0.0529125655,-0.3312315118*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312315118*scalek 0.0081060667 0.2963931827]); +b_centre02 = rbend('b_centre02',0.2815037989,0.0354072962,0.0529125655,-0.0175134439,-0.3306429237*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306429237*scalek 0.0237264198 -0.2192733272]); +b_centre03 = rbend('b_centre03',0.2813281018,0.0349189640,0.0175134439,0.0174054578,-0.3300984023*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300984023*scalek 0.0101509428 -0.5218382720]); +b_centre04 = rbend('b_centre04',0.2814996751,0.0353946633,-0.0174054578,0.0528080683,-0.3302048119*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302048119*scalek 0.0235987043 -0.2144554284]); +b_centre05 = rbend('b_centre05',0.2820380879,0.0367421699,-0.0528080683,0.0895641319,-0.3309037380*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3309037380*scalek 0.0102169077 0.2963545009]); +b_right01 = rbend('b_right01',0.0694014448,0.0092683188,-0.0895641319,0.0988345428,-0.3275972520*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3275972520*scalek -0.0308930090 0.3680490900]); +b_right02 = rbend('b_right02',0.0694650575,0.0090032960,-0.0988345428,0.1077882518,-0.3467634133*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3467634133*scalek -0.0345063628 0.6218385567]); +b_right03 = rbend('b_right03',0.0695141539,0.0037116695,-0.1077882518,0.1112699557,-0.1347732139*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1347732139*scalek 0.0189958278 0.8526578807]); +b_right04 = rbend('b_right04',0.0695280819,0.0007961566,-0.1112699557,0.1120205593,-0.0014988960*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0014988960*scalek -0.0849450391 0.2100836063]); +b_right05 = rbend('b_right05',0.0695312501,0.0001897883,-0.1120205593,0.1121997376,0.0026764692*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026764692*scalek -0.0276971797 0.0360627830]); newbend = [leftdrift_a bpm leftdrift_b b_left01 b_left02 b_left03 b_left04 ... b_left05 b_centre01 b_centre02 b_centre03 b_centre04 ... diff --git a/machine/ASP/StorageRing/assr4_id.m b/machine/ASP/StorageRing/assr4_id.m index f6ee4e3f..cc79eb5e 100644 --- a/machine/ASP/StorageRing/assr4_id.m +++ b/machine/ASP/StorageRing/assr4_id.m @@ -65,10 +65,17 @@ function assr4(varargin) % K: 0.33295132 % Sext: 0.01092687 % Oct: 0.15166053 -scalek = 0.98855592463187; -edge_offset = 0.03603626237179; -dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4Pass'); -dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4Pass'); +scalek = 1; +edge_offset = 0.01; +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4E2Pass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4E2Pass'); +FAMLIST{dip1}.ElemData.FullGap = 0.045; +FAMLIST{dip1}.ElemData.FringeInt1 = 0.5; +FAMLIST{dip1}.ElemData.FringeInt2 = 0.5; +FAMLIST{dip2}.ElemData.FullGap = 0.045; +FAMLIST{dip2}.ElemData.FringeInt1 = 0.5; +FAMLIST{dip2}.ElemData.FringeInt2 = 0.5; + % Quadrupoles (for design dipole: [QFA,QDA,QFB]=[1.761741,-1.038377,1.533802]; % To match new dipole values from numerical studies @@ -91,28 +98,153 @@ function assr4(varargin) sfb = sextcorr('SFB' ,2.000000e-001, 7.189346e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); % Define the wiggler as a 6x6 matrix element pass -wig = marker('wig','Matrix66Pass'); + +id01 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id01}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +id02 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id02}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +ivu_sector3 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{ivu_sector3}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +id04 = marker('wig','Matrix66Pass'); L = 0; Kx = 0; Ky = 0; -FAMLIST{wig}.ElemData.M66 = [1 L 0 0 0 0; +FAMLIST{id04}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +ivu_sector5 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{ivu_sector5}.ElemData.M66 = [1 L 0 0 0 0; Kx 1 0 0 0 0; 0 0 1 L 0 0; 0 0 Ky 1 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1]; +id06 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id06}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; +id07 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id07}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +id08 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id08}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +id09 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id09}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +id10 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id10}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +id11 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id11}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + + +wig_12 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{wig_12}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + +ivu_sector13 = marker('wig','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{ivu_sector13}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; % Define the APPLE2 as a 6x6 matrix element pass -app = marker('wig','Matrix66Pass'); +EPU_14 = marker('wig','Matrix66Pass'); L = 0; Kx = 0; Ky = 0; -FAMLIST{app}.ElemData.M66 = [1 L 0 0 0 0; +FAMLIST{EPU_14}.ElemData.M66 = [1 L 0 0 0 0; Kx 1 0 0 0 0; 0 0 1 L 0 0; 0 0 Ky 1 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1]; + + + + + % RF cavity and the corresponding straight used to position the cavity. % 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also % we are using ThinCavities therefore the drifts have to be set @@ -213,7 +345,7 @@ function assr4(varargin) %fast feedback kicker included: ffbring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel celffb10_1 unit_cel unit_cel unit_cel celkick14]; % wiggler ring (based on cavity4ring). Wiggler in sector 12 -wigring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 celrf07_4 unit_cel unit_cel unit_cel unit_cel wig unit_cel unit_cel app celkick14]; +wigring = [ ap id01 celkick01 id02 unit_cel ivu_sector3 unit_cel id04 unit_cel ivu_sector5 unit_cel id06 celrf06_4 id07 celrf07_4 id08 unit_cel id09 unit_cel id10 unit_cel id11 unit_cel wig_12 unit_cel ivu_sector13 unit_cel EPU_14 celkick14]; % Choose which lattice to load else load "fullring" as the default. if nargin > 0 diff --git a/machine/ASP/StorageRing/assr4_modbend.m b/machine/ASP/StorageRing/assr4_modbend.m new file mode 100644 index 00000000..646af0b5 --- /dev/null +++ b/machine/ASP/StorageRing/assr4_modbend.m @@ -0,0 +1,242 @@ +function assr4(varargin) +% Lattice definition file - generated by dimad2at v1.300000 +% +% Eugene 2004-12-13 Updating the generalised file to realign the family +% names and elements with aspinit. NOTE: aspinit will not work with split +% elements... not without modification of the init file. +% +% Eugene 2005-09-16 Standardise all lattices being used to this. "Custom" +% versions of the lattice files, eg for ML, ID studies etc will take this +% file as a template. The following major changes were made - +% * All family names in CAPS in line with ALS and SPEAR convention. +% * Dipole path and gradient updated to reflect numerical studies on +% measured data. Quadrupole values fitted for a tune of 13.3, 5.2 and +% zero dispersion given the new dipole gradient fields. +% * Merged with "aspsr_msrf.m" with independent/individual cavitie(s). +% * Element positions/lengths should be inline with engineering +% drawings. + +global FAMLIST THERING GLOBVAL + +GLOBVAL.E0 = 3e9; +GLOBVAL.LatticeFile = mfilename; +FAMLIST = cell(0); + +L0 = 2.159946602239996e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. +C0 = 299792458; % speed of light [m/s] +HarmNumber = 360; + +disp(' '); +fprintf('*** Loading lattice from %s.m ***\n',GLOBVAL.LatticeFile); + +% With AT1.3 ringpass and linepass, particles limited by the apperturepass +% will have [x,x',y,y',delta,dl] = [NaN,0,0,0,0,0]. All pass methods will +% check for this and do nothing to particles with these coordinates. +% Ring/linepass will both return particle positions as well as the number +% of turns the particles achieved. +% ap = aperture('AP',[-32 17 -16 16]*1e-3,'AperturePass'); +ap = aperture('AP',[-16 17 -16 16]*1e2,'AperturePass'); + +d1 = drift('D1' ,2.698300e+000,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) +d2 = drift('D2' ,1.900000e-001,'DriftPass'); +d3 = drift('D3' ,1.650000e-001,'DriftPass'); +d4 = drift('D4' ,2.750000e-001,'DriftPass'); +d5 = drift('D5' ,1.550000e-001,'DriftPass'); +d6 = drift('D6' ,4.500000e-001,'DriftPass'); + +% Modified drifts around BPM sections. +bpm = monitor('BPM' ,'IdentityPass'); +d1a = drift('D1A' ,len(d1)-3.942860e-001,'DriftPass'); % 2.304000e+000 +d1b = drift('D1B' , 3.942860e-001,'DriftPass'); +d1aa= drift('D1A' ,len(d1)-0.58,'DriftPass'); % Last bpm +d1bb= drift('D1B' , 0.58,'DriftPass'); +d4a = drift('D4A' ,len(d4)-1.990000e-001,'DriftPass'); % 7.600000e-002 +d4b = drift('D4B' , 1.990000e-001,'DriftPass'); +d4aa = drift('D4AA' ,len(d4)-6.400000e-002,'DriftPass'); % 2.110000e-001 +d4bb = drift('D4BB' , 6.400000e-002,'DriftPass'); +d2a = drift('D2A' ,len(d2)-1.030000e-001,'DriftPass'); % 8.700000e-002 +d2b = drift('D2B' , 1.030000e-001,'DriftPass'); + +% Dipoles +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% From numerical studies -> L: 1.72579121675e+000 +% K: 0.33295132 +% Sext: 0.01092687 +% Oct: 0.15166053 +% 1.006150825679126; % scaling factor for chromaticity comparison Eugene +% 24/1/2008 +scalek = 1; 0.981726405990326; +0.981726405990326; % with edge offset +0.995226405990326; % without edge offset +0.98855592463187*(1-(1/3000)); +edge_offset = 0.012; 0.03603626237179; +% dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'ASBndMPoleSymplectic4Pass'); +% dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'ASBndMPoleSymplectic4Pass'); +% 2E +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4E2Pass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001+edge_offset,1.121997e-001+edge_offset,-0.33295132*scalek,'BndMPoleSymplectic4E2Pass'); + + +% Quadrupoles (for design dipole: [QFA,QDA,QFB]=[1.761741,-1.038377,1.533802]; +% To match new dipole values from numerical studies +% tune of 13.3, 5.2 and 0 dispersion in straights. +% qfa = quadrupole('QFA' ,3.550000e-001, 1.7610967e+000,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.0715748e+000,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); +% To match split dipole values from numerical studies (SBENDS) +% tune of 13.29, 5.216 and 0 dispersion in straights. + +% qfa = quadrupole('QFA' ,3.550000e-001, 1.76272982211693,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.06276736743823,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.53992875479511,'QuadLinearPass'); + +qfa = quadrupole('QFA' ,3.550000e-001, 1.76272982211693,'StrMPoleSymplectic4Pass'); +qda = quadrupole('QDA' ,1.800000e-001,-1.06276736743823,'StrMPoleSymplectic4Pass'); +qfb = quadrupole('QFB' ,3.550000e-001, 1.53992875479511,'StrMPoleSymplectic4Pass'); + +% Sextupoles with built in correctors. Corrector settings given by kick +% angle in radians. +try + % applies to AT1.3 only. for older installations + sfa = sextcorr('SFA' ,2.000000e-001, 1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); + sda = sextcorr('SDA' ,2.000000e-001,-1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); + sdb = sextcorr('SDB' ,2.000000e-001,-7.014635e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); + sfb = sextcorr('SFB' ,2.000000e-001, 7.189346e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); +catch + % used for AT1.4 onwards + sfa = sextupole('SFA' ,2.000000e-001, 1.400000e+001,'StrMPoleSymplectic4Pass'); + sda = sextupole('SDA' ,2.000000e-001,-1.400000e+001,'StrMPoleSymplectic4Pass'); + sdb = sextupole('SDB' ,2.000000e-001,-7.014635e+000,'StrMPoleSymplectic4Pass'); + sfb = sextupole('SFB' ,2.000000e-001, 7.189346e+000,'StrMPoleSymplectic4Pass'); + FAMLIST{sfa}.ElemData.KickAngle = [0 0]; + FAMLIST{sda}.ElemData.KickAngle = [0 0]; + FAMLIST{sfb}.ElemData.KickAngle = [0 0]; + FAMLIST{sdb}.ElemData.KickAngle = [0 0]; +end + +% RF cavity and the corresponding straight used to position the cavity. +% 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also +% we are using ThinCavities therefore the drifts have to be set +% accordingly. +cav_single = rfcavity('RF' ,0.0,3.00e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); +cav = rfcavity('RF' ,0.0,0.75e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); +% drifts around the rf cavities and space between them +d1ar1 = drift('D1AR1' ,len(d1a)-len(cav_single)/2 ,'DriftPass'); % for just 1 cavity +drf = drift('DRF' ,0.45 ,'DriftPass'); % space between cavities +d1ar4 = drift('D1AR4' ,len(d1a)-len(cav)-len(drf)/2,'DriftPass'); % for 4 cavities +cav_pair = [cav drf cav]; +dRF1 = drift('dRF1' ,len(d1)-2.55 ,'DriftPass'); +dRF2 = drift('dRF2' ,2.55/3 ,'DriftPass'); + + +% Kickers and the associated drifts to position them. (to be checked) +kick1 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick2 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick3 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick4 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +%fast feedback kicks +ffbh = corrector('FFBH' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +ffbv = corrector('FFBV' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +% Drift spaces to replace D1A for the upstream kickers, ie kickers 1 and 3. +d1ak2_up= drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); +d1ak1_up= drift('D1AK1_UP' ,len(d1a) - len(d1ak2_up),'DriftPass'); +% Drift spaces to replace D1A for the downstream kickers, ie kickers 2 and 4. +d1ak2_do= drift('D1AK2_DO' ,1.073 - len(d1bb),'DriftPass'); +d1ak1_do= drift('D1AK1_DO' ,len(d1aa) - len(d1ak2_do),'DriftPass'); + + +% Define the position of the bpm. bpm1d1 represents BPM number 1 in the D1 +% straight and bpm5d4 represents BPM number 5 in straight d4. bpm7dk and +% bpm7dr repreents BPM number 7 in either the kicker stright or RF +% straight. +bpm1d1 = [ d1a bpm d1b ]; +bpm1d1k = inline(['[' num2str(d1ak1_up) ' ' 'kicker ' num2str(d1ak2_up) ' ' num2str(bpm) ' ' num2str(d1b) ' ' ']' ], 'kicker'); % Kicker +bpm1d1r1 = [ d1ar1 bpm d1b ]; % RF 1 cavity +%bpm1d1r4 = [ d1ar4 bpm d1b ]; % RF 4 cavity +bpm2d4 = [ d4a bpm d4b ]; +bpm3d4 = [ d4aa bpm d4bb ]; +bpm4d2 = [ d2a bpm d2b ]; +bpm5d4 = [ bpm2d4 ]; +bpm6d4 = [ bpm3d4 ]; +bpm7d1 = [ d1bb bpm d1aa ]; +bpm7d1k = inline(['[' num2str(d1bb) ' ' num2str(bpm) ' ' num2str(d1ak2_do) ' ' 'kicker ' num2str(d1ak1_do) ' ' ']' ], 'kicker'); % Kicker +bpm7d1r1 = [ d1b bpm d1ar1 ]; % RF 1 cavity +%bpm7d1r4 = [ d1b bpm d1ar4 ]; % RF 4 cavity +bpm1d1RF = [ dRF1 bpm dRF2 cav dRF2 cav dRF2 ]; + +d1ffb = []; +bpm7d1ffb = [ d1b bpm d1ffb ]; %fast feedback kicker + +% Arrange the elements onto the girders and use markers to define the +% sections for misalignment studies. +g1m1 = marker('g1m1','IdentityPass'); +g1m2 = marker('g1m2','IdentityPass'); +g2m1 = marker('g2m1','IdentityPass'); +g2m2 = marker('g2m2','IdentityPass'); +% girder1 = [ g1m1 sfa hcor sfa d2 qfa d3 sda vcor sda g1m2]; +% girder2 = [ g2m1 sdb vcor sdb d5 qda d6 qfb d2 sfb hcor sfb bpm4d2 qfb d6 qda d5 sdb vcor sdb g2m2]; +% girder3 = [ g1m1 sda vcor sda d3 qfa d2 sfa hcor sfa g1m2]; +girder1 = [ g1m1 sfa d2 qfa d3 sda g1m2]; +girder2 = [ g2m1 sdb d5 qda d6 qfb d2 sfb bpm4d2 qfb d6 qda d5 sdb g2m2]; +girder3 = [ g1m1 sda d3 qfa d2 sfa g1m2]; + +dipole_arc1 = [bpm2d4 dip1 bpm3d4]; +dipole_arc2 = [bpm5d4 dip2 bpm6d4]; + +% Arrange the girders into the different cell arrangements. +unit_cel = [ bpm1d1 girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1 ]; +% Kickers in cells 1 and 14 +celkick14 = [ bpm1d1k(kick1) girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1k(kick2) ]; +celkick01 = [ bpm1d1k(kick3) girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1k(kick4) ]; +% Shorten the straights in cells 6, 7 and 8 to put in the rf +% 4 RF cavities + +celrf06_4 = [ bpm1d1RF girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1 ]; +celrf07_4 = [ bpm1d1RF girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1 ]; +%celrf06_4 = [ bpm1d1 girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1r4 ]; +%celrf07_4 = [ bpm1d1r4 girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1r4 ]; +%celrf08_4 = [ bpm1d1r4 girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1 ]; + +% Single RF cavity +celrf06_1 = [ bpm1d1 girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1r1 ]; +celrf07_1 = [ bpm1d1r1 girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1 ]; +%diagnostic straight with fast feedback kicker +celffb10_1 = [ bpm1d1 girder1 dipole_arc1 girder2 dipole_arc2 girder3 bpm7d1ffb ]; %includes fast feedback kicker + + +% Definition of the types of rings +kickring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +cavity1ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14];; +cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 celrf07_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; + +fullring_startwithRF = [ ap cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 ]; +ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +%fast feedback kicker included: +ffbring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel celffb10_1 unit_cel unit_cel unit_cel celkick14]; + +% Choose which lattice to load else load "fullring" as the default. +if nargin > 0 + fprintf('Using lattice : %s \n', varargin{1}); + eval(['buildlat(' varargin{1} ');']); +else + % Default lattice to load + fprintf('Using default lattice : cavity4ring\n'); + buildlat(cavity4ring); +end + +% Make the variables THERING and GLOBVAL available to the caller's +% workspace. +evalin('caller','global THERING GLOBVAL'); +disp('** Done **'); + +% New AT 1.3 does not require FAMLIST and is fazing out GLOBVAL +clear global FAMLIST + +setenergymodel(3); + +% Internal function used to return the length of a defined element. +function res = len(id) +global FAMLIST +res = FAMLIST{id}.ElemData.Length; + diff --git a/machine/ASP/StorageRing/assr4_splitbends.m b/machine/ASP/StorageRing/assr4_splitbends.m index 4ec84f0b..f4d6a981 100644 --- a/machine/ASP/StorageRing/assr4_splitbends.m +++ b/machine/ASP/StorageRing/assr4_splitbends.m @@ -15,17 +15,40 @@ function assr4(varargin) % * Merged with "aspsr_msrf.m" with independent/individual cavitie(s). % * Element positions/lengths should be inline with engineering % drawings. +% +% Eugene 2010-07-08 +% * now we define the RF frequency and this will automatically scale the +% drift sections to match +% * Changed the dipole pass method to BndMPoleSymplectic4E2RadPass that +% correctly tracks off energy particles through the dipole. +% * added scaling factors. +% +% Eugene 2010-07-27 +% * Plan to make this lattice the standard general lattice for all LOCO +% fits. +% * Added IDs into this lattice. Scaling of 'quadDL_2', 'scalek' and +% 'scalem' set by balancing the relative quadrupole strengths between +% families so that they are the same as in the machine. The sextupole +% component was scaled so that the modeled chromaticity matches what we +% measure. + global FAMLIST THERING GLOBVAL -GLOBVAL.E0 = 3e9; +GLOBVAL.E0 = 3.0134e9; % Measured by Harris and Kent using resonant depolrasiation July 2010. GLOBVAL.LatticeFile = mfilename; FAMLIST = cell(0); -L0 = 2.159946602239996e+02; -L0 = 2.159946602239993e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. +arclen = 10.031590015999999; % length bpm to bpm without the straight sections. +% ringrf = 499.6716341346960e6; +% ringrf = 499.674000e6; +ringrf = 499.675982e6; % 16/01/2017 ET C0 = 299792458; % speed of light [m/s] HarmNumber = 360; +L0 = C0*HarmNumber/ringrf; +halfstraightlength = (L0/14-arclen)/2; (L0 - arclen*14)/14/2; +% L0 = 2.159946602239996e+02; +% L0 = 2.159946602239993e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. disp(' '); fprintf('*** Loading lattice from %s.m ***\n',GLOBVAL.LatticeFile); @@ -35,15 +58,19 @@ function assr4(varargin) % check for this and do nothing to particles with these coordinates. % Ring/linepass will both return particle positions as well as the number % of turns the particles achieved. -% ap = aperture('AP',[-32 17 -16 16]*1e-3,'AperturePass'); ap = aperture('AP',[-16 17 -16 16]*1e2,'AperturePass'); -d1 = drift('D1' ,2.698300e+000,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) -d2 = drift('D2' ,1.900000e-001,'DriftPass'); -d3 = drift('D3' ,1.650000e-001,'DriftPass'); +% Quadrupole field extent on one end past the magnet iron length as +% measured by RMIT student Neville. quadDL_2 = 0.005; +% Empirically modified so relative strengths between QFA, QDA and QFB are +% the same as those set on the ring. +quadDL_2 = 0.0042; +d1 = drift('D1' ,halfstraightlength,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) +d2 = drift('D2' ,1.900000e-001-quadDL_2,'DriftPass'); +d3 = drift('D3' ,1.650000e-001-quadDL_2,'DriftPass'); d4 = drift('D4' ,2.750000e-001,'DriftPass'); -d5 = drift('D5' ,1.550000e-001,'DriftPass'); -d6 = drift('D6' ,4.500000e-001,'DriftPass'); +d5 = drift('D5' ,1.550000e-001-quadDL_2,'DriftPass'); +d6 = drift('D6' ,4.500000e-001-quadDL_2*2,'DriftPass'); % Modified drifts around BPM sections. bpm = monitor('BPM' ,'IdentityPass'); @@ -59,113 +86,91 @@ function assr4(varargin) d2b = drift('D2B' , 1.030000e-001,'DriftPass'); % Dipoles -% design -> rbend_asp('BEND',1.726000e+000,2.243995e-001,1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); % From numerical studies -> L: 1.72579121675e+000 % K: 0.33295132 % Sext: 0.01092687 % Oct: 0.15166053 -dip1 = rbend_asp('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); -dip2 = rbend_asp('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BendLinearPass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BendLinearPass'); -scalek = 1.00; +scalek = 1; % Quadrupole components scaled to get the relative strengths between the quadrupoles in the model to match with the machine. +scalem = 3.15; % Sextupole component scaled to get model chromaticities to match with measured chromaticities +scalen = 0.0; +thinsext = sextupole('thinsext' ,0,0.0,'ThinMPolePass'); leftdrift_a = drift('leftdrift',0.076,'DriftPass'); leftdrift_b = drift('leftdrift',0.0837626757-len(leftdrift_a),'DriftPass'); rightdrift_b = drift('rightdrift',0.064,'DriftPass'); rightdrift_a = drift('rightdrift',0.0887292346-len(rightdrift_b),'DriftPass'); -b_left01 = rbend_asp('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892 -1.2289013273]); -b_left02 = rbend_asp('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949 -0.0632750927]); -b_left03 = rbend_asp('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966 -0.1103893288]); -b_left04 = rbend_asp('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022 0.6681103839]); -b_left05 = rbend_asp('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205 0.3349521492]); -b_centre01 = rbend_asp('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817 0.2965845308]); -b_centre02 = rbend_asp('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994 -0.2196079070]); -b_centre03 = rbend_asp('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); -b_centre04 = rbend_asp('b_centre04',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098 -0.2148826863]); -b_centre05 = rbend_asp('b_centre05',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753 0.2969171603]); -b_right01 = rbend_asp('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494 0.3681905186]); -b_right02 = rbend_asp('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712 0.9528854933]); -b_right03 = rbend_asp('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022 0.7022676128]); -b_right04 = rbend_asp('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318 0.2460706289]); -b_right05 = rbend_asp('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629 0.7697020810]); - -% rbend_asp -% b_left01 = rbend_asp('b_left01',0.0695312761,0.0001700782,0.1121962211,-0.1120187381,0.0026580668*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026580668*scalek -0.0222542890 -0.0307698880]); -% b_left02 = rbend_asp('b_left02',0.0695282915,0.0007118132,0.1120187381,-0.1112734474,0.0004302895*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0004302895*scalek -0.0824996146 -0.0652385243]); -% b_left03 = rbend_asp('b_left03',0.0695152451,0.0032678721,0.1112734474,-0.1078414785,-0.1045888695*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1045888695*scalek -0.0928717833 0.2254072448]); -% b_left04 = rbend_asp('b_left04',0.0694679183,0.0088002187,0.1078414785,-0.0989182337,-0.3486275471*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3486275471*scalek -0.0656081148 0.3572852967]); -% b_left05 = rbend_asp('b_left05',0.0694041758,0.0092692888,0.0989182337,-0.0896518010,-0.3281526271*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3281526271*scalek -0.0355726539 0.3355904266]); -% b_centre01 = rbend_asp('b_centre01',0.2820465390,0.0367531221,0.0896518010,-0.0529125655,-0.3312315118*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312315118*scalek 0.0081060667 0.2963931827]); -% b_centre02 = rbend_asp('b_centre02',0.2815037989,0.0354072962,0.0529125655,-0.0175134439,-0.3306429237*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306429237*scalek 0.0237264198 -0.2192733272]); -% b_centre03 = rbend_asp('b_centre03',0.2813281018,0.0349189640,0.0175134439,0.0174054578,-0.3300984023*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300984023*scalek 0.0101509428 -0.5218382720]); -% b_centre04 = rbend_asp('b_centre04',0.2814996751,0.0353946633,-0.0174054578,0.0528080683,-0.3302048119*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302048119*scalek 0.0235987043 -0.2144554284]); -% b_centre05 = rbend_asp('b_centre05',0.2820380879,0.0367421699,-0.0528080683,0.0895641319,-0.3309037380*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3309037380*scalek 0.0102169077 0.2963545009]); -% b_right01 = rbend_asp('b_right01',0.0694014448,0.0092683188,-0.0895641319,0.0988345428,-0.3275972520*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3275972520*scalek -0.0308930090 0.3680490900]); -% b_right02 = rbend_asp('b_right02',0.0694650575,0.0090032960,-0.0988345428,0.1077882518,-0.3467634133*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3467634133*scalek -0.0345063628 0.6218385567]); -% b_right03 = rbend_asp('b_right03',0.0695141539,0.0037116695,-0.1077882518,0.1112699557,-0.1347732139*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1347732139*scalek 0.0189958278 0.8526578807]); -% b_right04 = rbend_asp('b_right04',0.0695280819,0.0007961566,-0.1112699557,0.1120205593,-0.0014988960*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0014988960*scalek -0.0849450391 0.2100836063]); -% b_right05 = rbend_asp('b_right05',0.0695312501,0.0001897883,-0.1120205593,0.1121997376,0.0026764692*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026764692*scalek -0.0276971797 0.0360627830]); +b_left01 = rbend('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892*scalem -1.2289013273*scalen]); +b_left02 = rbend('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949*scalem -0.0632750927*scalen]); +b_left03 = rbend('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966*scalem -0.1103893288*scalen]); +b_left04 = rbend('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022*scalem 0.6681103839*scalen]); +b_left05 = rbend('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205*scalem 0.3349521492*scalen]); +b_centre01 = rbend('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817*scalem 0.2965845308*scalen]); +b_centre02 = rbend('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994*scalem -0.2196079070*scalen]); + +b_centre03a = rbend('b_centre03',0.07039827720955,0.0349189639*0.2502,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +b_centre03b = rbend('b_centre04',0.16393005016542,0.0349189639*0.5827,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +b_centre03c = rbend('b_centre05',0.04699977442503,0.0349189639*0.1671,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +source_six = marker('source_six','IdentityPass'); +source_seven = marker('source_seven','IdentityPass'); +b_centre03 = [b_centre03a source_six b_centre03b source_seven b_centre03c]; +%b_centre03 = rbend('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); + +b_centre04 = rbend('b_centre06',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098*scalem -0.2148826863*scalen]); +b_centre05 = rbend('b_centre07',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753*scalem 0.2969171603*scalen]); +b_right01 = rbend('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494*scalem 0.3681905186*scalen]); +b_right02 = rbend('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712*scalem 0.9528854933*scalen]); +b_right03 = rbend('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022*scalem 0.7022676128*scalen]); +b_right04 = rbend('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318*scalem 0.2460706289*scalen]); +b_right05 = rbend('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629*scalem 0.7697020810*scalen]); + dipole_arc = [leftdrift_a bpm leftdrift_b b_left01 b_left02 b_left03 b_left04 ... - b_left05 b_centre01 b_centre02 b_centre03 b_centre04 ... - b_centre05 b_right01 b_right02 b_right03 b_right04 ... + b_left05 thinsext b_centre01 b_centre02 b_centre03 b_centre04 ... + b_centre05 thinsext b_right01 b_right02 b_right03 b_right04 ... b_right05 rightdrift_a bpm rightdrift_b]; -% Quadrupoles (for design dipole: [QFA,QDA,QFB]=[1.761741,-1.038377,1.533802]; -% To match new single dipole values from numerical studies -% tune of 13.3, 5.2 and 0 dispersion in straights. -% qfa = quadrupole('QFA' ,3.550000e-001, 1.7610967e+000,'QuadLinearPass'); -% qda = quadrupole('QDA' ,1.800000e-001,-1.0715748e+000,'QuadLinearPass'); -% qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); - -% To match split dipole values from numerical studies (SBENDS) -% tune of 13.216, 5.3006 and 0 dispersion in straights. -% qfa = quadrupole('QFA' ,3.550000e-001, 1.7610967e+000,'QuadLinearPass'); -% qda = quadrupole('QDA' ,1.800000e-001,-1.0715748e+000,'QuadLinearPass'); -% qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); - -% To match split dipole values from numerical studies (RBENDS) -% tune of 13.216, 5.3006 and 0 dispersion in straights. -% qfa = quadrupole('QFA' ,3.550000e-001, 1.7521052e+000,'QuadLinearPass'); -% qda = quadrupole('QDA' ,1.800000e-001,-1.0897262e+000,'QuadLinearPass'); -% qfb = quadrupole('QFB' ,3.550000e-001, 1.5452228e+000,'QuadLinearPass'); - -% To match split dipole values from numerical studies (RBENDS) -% tune of 13.29, 5.216 and 0 dispersion in straights. -% -1.08597141914729 -% qfa = quadrupole('QFA' ,3.550000e-001, 1.76190217411609,'QuadLinearPass'); -% qda = quadrupole('QDA' ,1.800000e-001,-1.08597141914729,'QuadLinearPass'); -% qfb = quadrupole('QFB' ,3.550000e-001, 1.54443756044807,'QuadLinearPass'); - % To match split dipole values from numerical studies (SBENDS) % tune of 13.29, 5.216 and 0 dispersion in straights. -qfa = quadrupole('QFA' ,3.550000e-001, 1.76272982211693,'QuadLinearPass'); -qda = quadrupole('QDA' ,1.800000e-001,-1.06276736743823,'QuadLinearPass'); -qfb = quadrupole('QFB' ,3.550000e-001, 1.53992875479511,'QuadLinearPass'); +qfa = quadrupole('QFA' ,3.550000e-001 + quadDL_2*2, 1.725375769247917,'StrMPoleSymplectic4Pass'); +qda = quadrupole('QDA' ,1.800000e-001 + quadDL_2*2,-1.025712814328698,'StrMPoleSymplectic4Pass'); +qfb = quadrupole('QFB' ,3.550000e-001 + quadDL_2*2, 1.508192835147978,'StrMPoleSymplectic4Pass'); % Sextupoles with built in correctors. Corrector settings given by kick -% angle in radians. +% angle in radians. ([1 1] chromaticity with zero dispersion) sfa = sextcorr('SFA' ,2.000000e-001, 1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); sda = sextcorr('SDA' ,2.000000e-001,-1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); -sdb = sextcorr('SDB' ,2.000000e-001,-7.014635e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); -sfb = sextcorr('SFB' ,2.000000e-001, 7.189346e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); - - -wig = multipole('wig',0,[0 0 0 0],[0 0 0 10],'ThinMPolePass'); +sdb = sextcorr('SDB' ,2.000000e-001,-7.158624455551593,[0 0],'StrCorrMPoleSymplectic4Pass'); +sfb = sextcorr('SFB' ,2.000000e-001, 7.327438689781832,[0 0],'StrCorrMPoleSymplectic4Pass'); + +% +id = marker('ID','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; Kxy = 0; Kyx = 0; +FAMLIST{id}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 Kxy 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + Kyx 0 0 0 1 0; + 0 0 0 0 0 1]; + +% id = corrector('ID',0,[0 0],'CorrectorPass'); % RF cavity and the corresponding straight used to position the cavity. % 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also % we are using ThinCavities therefore the drifts have to be set % accordingly. -cav_single = rfcavity('RF' ,0.0,3.00e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); -cav = rfcavity('RF' ,0.0,0.75e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); +cav_single = rfcavity('RF' ,0.0,3.00e+006,ringrf,HarmNumber,'DriftPass'); +cav = rfcavity('RF' ,0.0,0.75e+006,ringrf,HarmNumber,'DriftPass'); % drifts around the rf cavities and space between them d1ar1 = drift('D1AR1' ,len(d1a)-len(cav_single)/2 ,'DriftPass'); % for just 1 cavity drf = drift('DRF' ,0.45 ,'DriftPass'); % space between cavities d1ar4 = drift('D1AR4' ,len(d1a)-len(cav)-len(drf)/2,'DriftPass'); % for 4 cavities cav_pair = [cav drf cav]; -% dRF1 = drift('dRF1' ,len(d1)-2.55 ,'DriftPass'); -% dRF2 = drift('dRF2' ,2.55/3 ,'DriftPass'); dRF1 = drift('dRF1' ,len(d1)-2.55 ,'DriftPass'); dRF2 = drift('dRF2' ,2.55/3 ,'DriftPass'); @@ -178,6 +183,7 @@ function assr4(varargin) ffbh = corrector('FFBH' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); ffbv = corrector('FFBV' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); % Drift spaces to replace D1A for the upstream kickers, ie kickers 1 and 3. +% d1ak2_up= drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); d1ak2_up= drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); d1ak1_up= drift('D1AK1_UP' ,len(d1a) - len(d1ak2_up),'DriftPass'); % Drift spaces to replace D1A for the downstream kickers, ie kickers 2 and 4. @@ -249,18 +255,19 @@ function assr4(varargin) kickring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; % cavity1ring = [ ap celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; % cavity4ring = [ ap celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; -cavity1ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14];; -cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 celrf07_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +cavity1ring = [ ap id celkick01 id unit_cel id unit_cel id unit_cel id unit_cel id celrf06_1 id cav_single id celrf07_1 id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id celkick14]; +cavity4ring = [ ap id celkick01 id unit_cel id unit_cel id unit_cel id unit_cel id celrf06_4 id celrf07_4 id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id celkick14]; %cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +% Ring starting with the RF fullring_startwithRF = [ ap cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 ]; +% Ring with no RF and no Kickers ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% Ring starting in straight 14 rather than straight 1, outside of the kick orbit. fullring = [ ap celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; -%fast feedback kicker included: +% fast feedback kicker included: ffbring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel celffb10_1 unit_cel unit_cel unit_cel celkick14]; -% Wiggler -wigring = [ ap unit_cel wig unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; % Choose which lattice to load else load "fullring" as the default. if nargin > 0 @@ -285,5 +292,4 @@ function assr4(varargin) % Internal function used to return the length of a defined element. function res = len(id) global FAMLIST -res = FAMLIST{id}.ElemData.Length; - +res = FAMLIST{id}.ElemData.Length; \ No newline at end of file diff --git a/machine/ASP/StorageRing/assr4_splitbends.m.bak b/machine/ASP/StorageRing/assr4_splitbends.m.bak new file mode 100644 index 00000000..4d1a2382 --- /dev/null +++ b/machine/ASP/StorageRing/assr4_splitbends.m.bak @@ -0,0 +1,258 @@ +function assr4(varargin) +% Lattice definition file - generated by dimad2at v1.300000 +% +% Eugene 2004-12-13 Updating the generalised file to realign the family +% names and elements with aspinit. NOTE: aspinit will not work with split +% elements... not without modification of the init file. +% +% Eugene 2005-09-16 Standardise all lattices being used to this. "Custom" +% versions of the lattice files, eg for ML, ID studies etc will take this +% file as a template. The following major changes were made - +% * All family names in CAPS in line with ALS and SPEAR convention. +% * Dipole path and gradient updated to reflect numerical studies on +% measured data. Quadrupole values fitted for a tune of 13.3, 5.2 and +% zero dispersion given the new dipole gradient fields. +% * Merged with "aspsr_msrf.m" with independent/individual cavitie(s). +% * Element positions/lengths should be inline with engineering +% drawings. + +global FAMLIST THERING GLOBVAL + +GLOBVAL.E0 = 3e9; +GLOBVAL.LatticeFile = mfilename; +FAMLIST = cell(0); + +L0 = 2.159946602239996e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. +C0 = 299792458; % speed of light [m/s] +HarmNumber = 360; + +disp(' '); +fprintf('*** Loading lattice from %s.m ***\n',GLOBVAL.LatticeFile); + +% With AT1.3 ringpass and linepass, particles limited by the apperturepass +% will have [x,x',y,y',delta,dl] = [NaN,0,0,0,0,0]. All pass methods will +% check for this and do nothing to particles with these coordinates. +% Ring/linepass will both return particle positions as well as the number +% of turns the particles achieved. +% ap = aperture('AP',[-32 17 -16 16]*1e-3,'AperturePass'); +ap = aperture('AP',[-16 17 -16 16]*1e2,'AperturePass'); + +d1 = drift('D1' ,2.698300e+000,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) +d2 = drift('D2' ,1.900000e-001,'DriftPass'); +d3 = drift('D3' ,1.650000e-001,'DriftPass'); +d4 = drift('D4' ,2.750000e-001,'DriftPass'); +d5 = drift('D5' ,1.550000e-001,'DriftPass'); +d6 = drift('D6' ,4.500000e-001,'DriftPass'); + +% Modified drifts around BPM sections. +bpm = monitor('BPM' ,'IdentityPass'); +d1a = drift('D1A' ,len(d1)-3.942860e-001,'DriftPass'); % 2.304000e+000 +d1b = drift('D1B' , 3.942860e-001,'DriftPass'); +d4a = drift('D4A' ,len(d4)-1.990000e-001,'DriftPass'); % 7.600000e-002 +d4b = drift('D4B' , 1.990000e-001,'DriftPass'); +d4aa = drift('D4AA' ,len(d4)-6.400000e-002,'DriftPass'); % 2.110000e-001 +d4bb = drift('D4BB' , 6.400000e-002,'DriftPass'); +d2a = drift('D2A' ,len(d2)-1.030000e-001,'DriftPass'); % 8.700000e-002 +d2b = drift('D2B' , 1.030000e-001,'DriftPass'); + +% Dipoles +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% From numerical studies -> L: 1.72579121675e+000 +% K: 0.33295132 +% Sext: 0.01092687 +% Oct: 0.15166053 +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); + +scalek = 1; +leftdrift = drift('leftdrift',0.0837626757,'DriftPass'); +rightdrift = drift('rightdrift',0.0887292346,'DriftPass'); +% b_left01 = rbend('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892 -1.2289013273]); +% b_left02 = rbend('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949 -0.0632750927]); +% b_left03 = rbend('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966 -0.1103893288]); +% b_left04 = rbend('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022 0.6681103839]); +% b_left05 = rbend('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205 0.3349521492]); +% b_centre01 = rbend('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817 0.2965845308]); +% b_centre02 = rbend('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994 -0.2196079070]); +% b_centre03 = rbend('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); +% b_centre04 = rbend('b_centre04',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098 -0.2148826863]); +% b_centre05 = rbend('b_centre05',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753 0.2969171603]); +% b_right01 = rbend('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494 0.3681905186]); +% b_right02 = rbend('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712 0.9528854933]); +% b_right03 = rbend('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022 0.7022676128]); +% b_right04 = rbend('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318 0.2460706289]); +% b_right05 = rbend('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629 0.7697020810]); + +% RBEND +b_left01 = rbend('b_left01',0.0695312761,0.0001700782,0.1121962211,-0.1120187381,0.0026580668*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026580668*scalek -0.0222542890 -0.0307698880]); +b_left02 = rbend('b_left02',0.0695282915,0.0007118132,0.1120187381,-0.1112734474,0.0004302895*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0004302895*scalek -0.0824996146 -0.0652385243]); +b_left03 = rbend('b_left03',0.0695152451,0.0032678721,0.1112734474,-0.1078414785,-0.1045888695*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1045888695*scalek -0.0928717833 0.2254072448]); +b_left04 = rbend('b_left04',0.0694679183,0.0088002187,0.1078414785,-0.0989182337,-0.3486275471*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3486275471*scalek -0.0656081148 0.3572852967]); +b_left05 = rbend('b_left05',0.0694041758,0.0092692888,0.0989182337,-0.0896518010,-0.3281526271*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3281526271*scalek -0.0355726539 0.3355904266]); +b_centre01 = rbend('b_centre01',0.2820465390,0.0367531221,0.0896518010,-0.0529125655,-0.3312315118*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312315118*scalek 0.0081060667 0.2963931827]); +b_centre02 = rbend('b_centre02',0.2815037989,0.0354072962,0.0529125655,-0.0175134439,-0.3306429237*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306429237*scalek 0.0237264198 -0.2192733272]); +b_centre03 = rbend('b_centre03',0.2813281018,0.0349189640,0.0175134439,0.0174054578,-0.3300984023*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300984023*scalek 0.0101509428 -0.5218382720]); +b_centre04 = rbend('b_centre04',0.2814996751,0.0353946633,-0.0174054578,0.0528080683,-0.3302048119*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302048119*scalek 0.0235987043 -0.2144554284]); +b_centre05 = rbend('b_centre05',0.2820380879,0.0367421699,-0.0528080683,0.0895641319,-0.3309037380*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3309037380*scalek 0.0102169077 0.2963545009]); +b_right01 = rbend('b_right01',0.0694014448,0.0092683188,-0.0895641319,0.0988345428,-0.3275972520*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3275972520*scalek -0.0308930090 0.3680490900]); +b_right02 = rbend('b_right02',0.0694650575,0.0090032960,-0.0988345428,0.1077882518,-0.3467634133*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3467634133*scalek -0.0345063628 0.6218385567]); +b_right03 = rbend('b_right03',0.0695141539,0.0037116695,-0.1077882518,0.1112699557,-0.1347732139*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1347732139*scalek 0.0189958278 0.8526578807]); +b_right04 = rbend('b_right04',0.0695280819,0.0007961566,-0.1112699557,0.1120205593,-0.0014988960*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0014988960*scalek -0.0849450391 0.2100836063]); +b_right05 = rbend('b_right05',0.0695312501,0.0001897883,-0.1120205593,0.1121997376,0.0026764692*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026764692*scalek -0.0276971797 0.0360627830]); + +newbend = [leftdrift bpm b_left01 b_left02 b_left03 b_left04 ... + b_left05 b_centre01 b_centre02 b_centre03 b_centre04 ... + b_centre05 b_right01 b_right02 b_right03 b_right04 ... + b_right05 bpm rightdrift]; + +% Quadrupoles (for design dipole: [QFA,QDA,QFB]=[1.761741,-1.038377,1.533802]; +% To match new single dipole values from numerical studies +% tune of 13.3, 5.2 and 0 dispersion in straights. +% qfa = quadrupole('QFA' ,3.550000e-001, 1.7610967e+000,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.0715748e+000,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); + +% To match split dipole values from numerical studies (SBENDS) +% tune of 13.216, 5.3006 and 0 dispersion in straights. +% qfa = quadrupole('QFA' ,3.550000e-001, 1.7610967e+000,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.0715748e+000,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); + +% To match split dipole values from numerical studies (RBENDS) +% tune of 13.216, 5.3006 and 0 dispersion in straights. +qfa = quadrupole('QFA' ,3.550000e-001, 1.7521052e+000,'QuadLinearPass'); +qda = quadrupole('QDA' ,1.800000e-001,-1.0897262e+000,'QuadLinearPass'); +qfb = quadrupole('QFB' ,3.550000e-001, 1.5452228e+000,'QuadLinearPass'); + + +% Sextupoles with built in correctors. Corrector settings given by kick +% angle in radians. +sfa = sextcorr('SFA' ,2.000000e-001, 1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); +sda = sextcorr('SDA' ,2.000000e-001,-1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); +sdb = sextcorr('SDB' ,2.000000e-001,-7.014635e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); +sfb = sextcorr('SFB' ,2.000000e-001, 7.189346e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); + +wig = multipole('wig',0,[0 0 0 0],[0 0 0 10],'ThinMPolePass'); + +% RF cavity and the corresponding straight used to position the cavity. +% 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also +% we are using ThinCavities therefore the drifts have to be set +% accordingly. +cav_single = rfcavity('RF' ,0.0,3.00e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); +cav = rfcavity('RF' ,0.0,0.75e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); +% drifts around the rf cavities and space between them +d1ar1 = drift('D1AR1' ,len(d1a)-len(cav_single)/2 ,'DriftPass'); % for just 1 cavity +drf = drift('DRF' ,0.45 ,'DriftPass'); % space between cavities +d1ar4 = drift('D1AR4' ,len(d1a)-len(cav)-len(drf)/2,'DriftPass'); % for 4 cavities +cav_pair = [cav drf cav]; + +% Kickers and the associated drifts to position them. (to be checked) +kick1 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick2 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick3 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick4 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +%fast feedback kicks +ffbh = corrector('FFBH' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +ffbv = corrector('FFBV' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +% Drift spaces to replace D1A for the upstream kickers, ie kickers 1 and 3. +d1ak2_up= drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); +d1ak1_up= drift('D1AK1_UP' ,len(d1a) - len(d1ak2_up),'DriftPass'); +% Drift spaces to replace D1A for the downstream kickers, ie kickers 2 and 4. +d1ak2_do= drift('D1AK2_DO' ,1.073 - len(d1b),'DriftPass'); +d1ak1_do= drift('D1AK1_DO' ,len(d1a) - len(d1ak2_do),'DriftPass'); + + +% Define the position of the bpm. bpm1d1 represents BPM number 1 in the D1 +% straight and bpm5d4 represents BPM number 5 in straight d4. bpm7dk and +% bpm7dr repreents BPM number 7 in either the kicker stright or RF +% straight. +bpm1d1 = [ d1a bpm d1b ]; +bpm1d1k = inline(['[' num2str(d1ak1_up) ' ' 'kicker ' num2str(d1ak2_up) ' ' num2str(bpm) ' ' num2str(d1b) ' ' ']' ], 'kicker'); % Kicker +bpm1d1r1 = [ d1ar1 bpm d1b ]; % RF 1 cavity +bpm1d1r4 = [ d1ar4 bpm d1b ]; % RF 4 cavity +bpm2d4 = [ d4a bpm d4b ]; +bpm3d4 = [ d4aa bpm d4bb ]; +bpm4d2 = [ d2a bpm d2b ]; +bpm5d4 = [ bpm2d4 ]; +bpm6d4 = [ bpm3d4 ]; +bpm7d1 = [ d1b bpm d1a ]; +bpm7d1k = inline(['[' num2str(d1b) ' ' num2str(bpm) ' ' num2str(d1ak2_do) ' ' 'kicker ' num2str(d1ak1_do) ' ' ']' ], 'kicker'); % Kicker +bpm7d1r1 = [ d1b bpm d1ar1 ]; % RF 1 cavity +bpm7d1r4 = [ d1b bpm d1ar4 ]; % RF 4 cavity + +d1ffb = []; +bpm7d1ffb = [ d1b bpm d1ffb ]; %fast feedback kicker + +% Arrange the elements onto the girders and use markers to define the +% sections for misalignment studies. +g1m1 = marker('g1m1','IdentityPass'); +g1m2 = marker('g1m2','IdentityPass'); +g2m1 = marker('g2m1','IdentityPass'); +g2m2 = marker('g2m2','IdentityPass'); +% girder1 = [ g1m1 sfa hcor sfa d2 qfa d3 sda vcor sda g1m2]; +% girder2 = [ g2m1 sdb vcor sdb d5 qda d6 qfb d2 sfb hcor sfb bpm4d2 qfb d6 qda d5 sdb vcor sdb g2m2]; +% girder3 = [ g1m1 sda vcor sda d3 qfa d2 sfa hcor sfa g1m2]; +girder1 = [ g1m1 sfa d2 qfa d3 sda g1m2]; +girder2 = [ g2m1 sdb d5 qda d6 qfb d2 sfb bpm4d2 qfb d6 qda d5 sdb g2m2]; +girder3 = [ g1m1 sda d3 qfa d2 sfa g1m2]; + + +% Arrange the girders into the different cell arrangements. +unit_cel = [ bpm1d1 girder1 newbend girder2 newbend girder3 bpm7d1 ]; +% Kickers in cells 1 and 14 +celkick14 = [ bpm1d1k(kick1) girder1 newbend girder2 newbend girder3 bpm7d1k(kick2) ]; +celkick01 = [ bpm1d1k(kick3) girder1 newbend girder2 newbend girder3 bpm7d1k(kick4) ]; +% Shorten the straights in cells 6, 7 and 8 to put in the rf +% 4 RF cavities +celrf06_4 = [ bpm1d1 girder1 newbend girder2 newbend girder3 bpm7d1r4 ]; +celrf07_4 = [ bpm1d1r4 girder1 newbend girder2 newbend girder3 bpm7d1r4 ]; +celrf08_4 = [ bpm1d1r4 girder1 newbend girder2 newbend girder3 bpm7d1 ]; +% Single RF cavity +celrf06_1 = [ bpm1d1 girder1 newbend girder2 newbend girder3 bpm7d1r1 ]; +celrf07_1 = [ bpm1d1r1 girder1 newbend girder2 newbend girder3 bpm7d1 ]; +%diagnostic straight with fast feedback kicker +celffb10_1 = [ bpm1d1 girder1 newbend girder2 newbend girder3 bpm7d1ffb ]; %includes fast feedback kicker + +% Shift sector +shift1 = quadrupole('SHIFT1' ,0, 0,'QuadLinearPass'); +shift2 = quadrupole('SHIFT2' ,0, 0,'QuadLinearPass'); + +% Definition of the types of rings +kickring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +% cavity1ring = [ ap celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% cavity4ring = [ ap celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +cavity1ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14];; +cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +fullring_startwithRF = [ ap cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 ]; +ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +fullring = [ ap celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +%fast feedback kicker included: +ffbring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel celffb10_1 unit_cel unit_cel unit_cel celkick14]; +% Wiggler +wigring = [ ap unit_cel wig unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; + +% Choose which lattice to load else load "fullring" as the default. +if nargin > 0 + fprintf('Using lattice : %s \n', varargin{1}); + eval(['buildlat(' varargin{1} ');']); +else + % Default lattice to load + fprintf('Using default lattice : cavity1ring\n'); + buildlat(cavity4ring); +end + +% Make the variables THERING and GLOBVAL available to the caller's +% workspace. +evalin('caller','global THERING GLOBVAL'); +disp('** Done **'); + +% New AT 1.3 does not require FAMLIST and is fazing out GLOBVAL +clear global FAMLIST + +setenergymodel(3); + +% Internal function used to return the length of a defined element. +function res = len(id) +global FAMLIST +res = FAMLIST{id}.ElemData.Length; diff --git a/machine/ASP/StorageRing/assr4_splitbends_kent.m b/machine/ASP/StorageRing/assr4_splitbends_kent.m new file mode 100644 index 00000000..c3fd9e5d --- /dev/null +++ b/machine/ASP/StorageRing/assr4_splitbends_kent.m @@ -0,0 +1,490 @@ +function assr4_splitbends_kent(varargin) +% Lattice definition file - generated by dimad2at v1.300000 +% +% Eugene 2004-12-13 Updating the generalised file to realign the family +% names and elements with aspinit. NOTE: aspinit will not work with split +% elements... not without modification of the init file. +% +% Eugene 2005-09-16 Standardise all lattices being used to this. "Custom" +% versions of the lattice files, eg for ML, ID studies etc will take this +% file as a template. The following major changes were made - +% * All family names in CAPS in line with ALS and SPEAR convention. +% * Dipole path and gradient updated to reflect numerical studies on +% measured data. Quadrupole values fitted for a tune of 13.3, 5.2 and +% zero dispersion given the new dipole gradient fields. +% * Merged with "aspsr_msrf.m" with independent/individual cavitie(s). +% * Element positions/lengths should be inline with engineering +% drawings. +% +% Eugene 2010-07-08 +% * now we define the RF frequency and this will automatically scale the +% drift sections to match +% * Changed the dipole pass method to BndMPoleSymplectic4E2RadPass that +% correctly tracks off energy particles through the dipole. +% * added scaling factors. +% +% Eugene 2010-07-27 +% * Plan to make this lattice the standard general lattice for all LOCO +% fits. +% * Added IDs into this lattice. Scaling of 'quadDL_2', 'scalek' and +% 'scalem' set by balancing the relative quadrupole strengths between +% families so that they are the same as in the machine. The sextupole +% component was scaled so that the modeled chromaticity matches what we +% measure. + + +global FAMLIST THERING GLOBVAL + +GLOBVAL.E0 = 3.0134e9; % Measured by Harris and Kent using resonant depolrasiation July 2010. +GLOBVAL.LatticeFile = mfilename; +FAMLIST = cell(0); + +arclen = 10.031590015999999; % length bpm to bpm without the straight sections. +ringrf = 499.6685923893040e6; +C0 = 299792458; % speed of light [m/s] +HarmNumber = 360; +L0 = C0*HarmNumber/ringrf; +halfstraightlength = (L0/14-arclen)/2; (L0 - arclen*14)/14/2; +% L0 = 2.159946602239996e+02; +% L0 = 2.159946602239993e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. + + +disp(' '); +fprintf('*** Loading lattice from %s.m ***\n',GLOBVAL.LatticeFile); + +% With AT1.3 ringpass and linepass, particles limited by the apperturepass +% will have [x,x',y,y',delta,dl] = [NaN,0,0,0,0,0]. All pass methods will +% check for this and do nothing to particles with these coordinates. +% Ring/linepass will both return particle positions as well as the number +% of turns the particles achieved. +% ap = aperture('AP',[-32 17 -16 16]*1e-3,'AperturePass'); +ap = aperture('AP',[-16 17 -16 16]*1e2,'AperturePass'); + +% Quadrupole field extent on one end past the magnet iron length as +% measured by RMIT student Neville. quadDL_2 = 0.005; +% Empirically modified so relative strengths between QFA, QDA and QFB are +% the same as those set on the ring. +quadDL_2 = 0.0042; +d1 = drift('D1' ,halfstraightlength,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) +d2 = drift('D2' ,0.1900000 - quadDL_2,'DriftPass'); +d3 = drift('D3' ,0.1650000 - quadDL_2,'DriftPass'); +d4 = drift('D4' ,0.2750000, 'DriftPass'); +d5 = drift('D5' ,0.1550000 - quadDL_2,'DriftPass'); +d6 = drift('D6' ,0.4500000 - quadDL_2*2,'DriftPass'); + +% Modified drifts around BPM sections. +bpm = monitor('BPM', 'IdentityPass'); +d1a = drift('D1A', len(d1)-0.3942860,'DriftPass'); % 2.304000e+000 +d1b = drift('D1B', 0.3942860,'DriftPass'); +d1aa= drift('D1A', len(d1)-0.58,'DriftPass'); % Last bpm +d1bb= drift('D1B', 0.58,'DriftPass'); +d4a = drift('D4A', len(d4)-0.1990000,'DriftPass'); % 7.600000e-002 +d4b = drift('D4B', 0.1990000,'DriftPass'); +d4aa= drift('D4AA',len(d4)-6.400000e-002,'DriftPass'); % 2.110000e-001 +d4bb= drift('D4BB', 6.400000e-002,'DriftPass'); +d2a = drift('D2A' ,len(d2)-0.1030000,'DriftPass'); % 8.700000e-002 +d2b = drift('D2B' , 0.1030000,'DriftPass'); + +% Dipoles +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% From numerical studies -> L: 1.72579121675e+000 +% K: 0.33295132 +% Sext: 0.01092687 +% Oct: 0.15166053 +dip1 = rbend('BEND' ,1.72579121675,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BendLinearPass'); +dip2 = rbend('BEND' ,1.72579121675,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BendLinearPass'); + +scalek = 1.0135; % Quadrupole components scaled to get the relative strengths between the quadrupoles in the model to match with the machine. +scalem = 3.15; % Sextupole component scaled to get model chromaticities to match with measured chromaticities +scalen = 0.0; +thinsext = sextupole('thinsext' ,0,0.0,'ThinMPolePass'); +leftdrift_a = drift('leftdrift',0.076,'DriftPass'); +leftdrift_b = drift('leftdrift',0.0837626757-len(leftdrift_a),'DriftPass'); +rightdrift_b = drift('rightdrift',0.064,'DriftPass'); +rightdrift_a = drift('rightdrift',0.0887292346-len(rightdrift_b),'DriftPass'); + +b_left01 = rbend('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892*scalem -1.2289013273*scalen]); +b_left02 = rbend('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949*scalem -0.0632750927*scalen]); +b_left03 = rbend('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966*scalem -0.1103893288*scalen]); +b_left04 = rbend('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022*scalem 0.6681103839*scalen]); +b_left05 = rbend('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205*scalem 0.3349521492*scalen]); +b_centre01 = rbend('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817*scalem 0.2965845308*scalen]); +b_centre02 = rbend('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994*scalem -0.2196079070*scalen]); + +b_centre03a = rbend('b_centre03',0.07039827720955,0.0349189639*0.2502,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +b_centre03b = rbend('b_centre04',0.16393005016542,0.0349189639*0.5827,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +b_centre03c = rbend('b_centre05',0.04699977442503,0.0349189639*0.1671,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +source_six = marker('source_six','IdentityPass'); +source_seven = marker('source_seven','IdentityPass'); +b_centre03 = [b_centre03a source_six b_centre03b source_seven b_centre03c]; +%b_centre03 = rbend('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); + +b_centre04 = rbend('b_centre06',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098*scalem -0.2148826863*scalen]); +b_centre05 = rbend('b_centre07',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753*scalem 0.2969171603*scalen]); +b_right01 = rbend('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494*scalem 0.3681905186*scalen]); +b_right02 = rbend('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712*scalem 0.9528854933*scalen]); +b_right03 = rbend('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022*scalem 0.7022676128*scalen]); +b_right04 = rbend('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318*scalem 0.2460706289*scalen]); +b_right05 = rbend('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629*scalem 0.7697020810*scalen]); + +% RBEND +% b_left01 = rbend('b_left01',0.0695312761,0.0001700782,0.1121962211,-0.1120187381,0.0026580668*scalek,'BendLinearPass',[0 0 0 0],[0 0.0026580668*scalek -0.0222542890 -0.0307698880]); +% b_left02 = rbend('b_left02',0.0695282915,0.0007118132,0.1120187381,-0.1112734474,0.0004302895*scalek,'BendLinearPass',[0 0 0 0],[0 0.0004302895*scalek -0.0824996146 -0.0652385243]); +% b_left03 = rbend('b_left03',0.0695152451,0.0032678721,0.1112734474,-0.1078414785,-0.1045888695*scalek,'BendLinearPass',[0 0 0 0],[0 -0.1045888695*scalek -0.0928717833 0.2254072448]); +% b_left04 = rbend('b_left04',0.0694679183,0.0088002187,0.1078414785,-0.0989182337,-0.3486275471*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3486275471*scalek -0.0656081148 0.3572852967]); +% b_left05 = rbend('b_left05',0.0694041758,0.0092692888,0.0989182337,-0.0896518010,-0.3281526271*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3281526271*scalek -0.0355726539 0.3355904266]); +% b_centre01 = rbend('b_centre01',0.2820465390,0.0367531221,0.0896518010,-0.0529125655,-0.3312315118*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3312315118*scalek 0.0081060667 0.2963931827]); +% b_centre02 = rbend('b_centre02',0.2815037989,0.0354072962,0.0529125655,-0.0175134439,-0.3306429237*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3306429237*scalek 0.0237264198 -0.2192733272]); +% b_centre03 = rbend('b_centre03',0.2813281018,0.0349189640,0.0175134439,0.0174054578,-0.3300984023*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3300984023*scalek 0.0101509428 -0.5218382720]); +% b_centre04 = rbend('b_centre04',0.2814996751,0.0353946633,-0.0174054578,0.0528080683,-0.3302048119*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3302048119*scalek 0.0235987043 -0.2144554284]); +% b_centre05 = rbend('b_centre05',0.2820380879,0.0367421699,-0.0528080683,0.0895641319,-0.3309037380*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3309037380*scalek 0.0102169077 0.2963545009]); +% b_right01 = rbend('b_right01',0.0694014448,0.0092683188,-0.0895641319,0.0988345428,-0.3275972520*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3275972520*scalek -0.0308930090 0.3680490900]); +% b_right02 = rbend('b_right02',0.0694650575,0.0090032960,-0.0988345428,0.1077882518,-0.3467634133*scalek,'BendLinearPass',[0 0 0 0],[0 -0.3467634133*scalek -0.0345063628 0.6218385567]); +% b_right03 = rbend('b_right03',0.0695141539,0.0037116695,-0.1077882518,0.1112699557,-0.1347732139*scalek,'BendLinearPass',[0 0 0 0],[0 -0.1347732139*scalek 0.0189958278 0.8526578807]); +% b_right04 = rbend('b_right04',0.0695280819,0.0007961566,-0.1112699557,0.1120205593,-0.0014988960*scalek,'BendLinearPass',[0 0 0 0],[0 -0.0014988960*scalek -0.0849450391 0.2100836063]); +% b_right05 = rbend('b_right05',0.0695312501,0.0001897883,-0.1120205593,0.1121997376,0.0026764692*scalek,'BendLinearPass',[0 0 0 0],[0 0.0026764692*scalek -0.0276971797 0.0360627830]); + +dipole_arc = [leftdrift_a bpm leftdrift_b b_left01 b_left02 b_left03 b_left04 ... + b_left05 thinsext b_centre01 b_centre02 b_centre03 b_centre04 ... + b_centre05 thinsext b_right01 b_right02 b_right03 b_right04 ... + b_right05 rightdrift_a bpm rightdrift_b]; + +% To match split dipole values from numerical studies (SBENDS) +% tune of 13.29, 5.216 and 0 dispersion in straights. +qfa = quadrupole('QFA', 0.355 + quadDL_2*2, 1.725373108609119,'StrMPoleSymplectic4Pass'); +qda = quadrupole('QDA', 0.180 + quadDL_2*2,-1.025718284909907,'StrMPoleSymplectic4Pass'); +qfb = quadrupole('QFB', 0.355 + quadDL_2*2, 1.508194290530376,'StrMPoleSymplectic4Pass'); + +% Sextupoles with built in correctors. Corrector settings given by kick +% angle in radians. ([1 1] chromaticity with zero dispersion) +sfa = sextcorr('SFA', 0.200, 14.00000,[0 0],'StrCorrMPoleSymplectic4Pass'); +sda = sextcorr('SDA', 0.200,-14.00000,[0 0],'StrCorrMPoleSymplectic4Pass'); +sdb = sextcorr('SDB', 0.200,-7.098322,[0 0],'StrCorrMPoleSymplectic4Pass'); +sfb = sextcorr('SFB', 0.200, 7.271212,[0 0],'StrCorrMPoleSymplectic4Pass'); + +%-------------------------------------------------------------------------- + +% RF cavity and the corresponding straight used to position the cavity. +% 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also +% we are using ThinCavities therefore the drifts have to be set +% accordingly. +cav_single = rfcavity('RF' ,0.0,3.00e+006,ringrf,HarmNumber,'DriftPass'); +cav = rfcavity('RF' ,0.0,0.75e+006,ringrf,HarmNumber,'DriftPass'); +% drifts around the rf cavities and space between them +d1ar1 = drift('D1AR1' ,len(d1a)-len(cav_single)/2 ,'DriftPass'); % for just 1 cavity +drf = drift('DRF' ,0.45 ,'DriftPass'); % space between cavities +d1ar4 = drift('D1AR4' ,len(d1a)-len(cav)-len(drf)/2,'DriftPass'); % for 4 cavities +cav_pair = [cav drf cav]; +dRF1 = drift('dRF1' ,len(d1)-2.55 ,'DriftPass'); +dRF2 = drift('dRF2' ,2.55/3 ,'DriftPass'); + +%-------------------------------------------------------------------------- +% Kickers and the associated drifts to position them. (to be checked) +kicker_14_1 = corrector('KICK' ,0.000000,[0.000000 0.0],'CorrectorPass'); +kicker_01_1 = corrector('KICK' ,0.000000,[0.000000 0.0],'CorrectorPass'); +kicker_01_2 = corrector('KICK' ,0.000000,[0.000000 0.0],'CorrectorPass'); +kicker_02_1 = corrector('KICK' ,0.000000,[0.000000 0.0],'CorrectorPass'); +%fast feedback kicks +ffbh = corrector('FFBH' ,0.000000,[0.000000 0.0],'CorrectorPass'); +ffbv = corrector('FFBV' ,0.000000,[0.000000 0.0],'CorrectorPass'); +% Drift spaces to replace D1A for the upstream kickers, ie kickers 1 and 3. +% As in, upstream of the Unit Cell, which is downstream of the centre of +% the straight. +% KICKER 1 is kicker 14 1 +d1ak2_up = drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); +d1ak1_up = drift('D1AK1_UP' ,len(d1a) - len(d1ak2_up),'DriftPass'); +% Drift spaces to replace D1A for the downstream kickers, ie kickers 2 and 4. +d1ak2_do = drift('D1AK2_DO' ,1.073 - len(d1bb),'DriftPass'); +d1ak1_do = drift('D1AK1_DO' ,len(d1aa) - len(d1ak2_do),'DriftPass'); + +%-------------------------------------------------------------------------- +% Define the position of the bpm. bpm1d1 represents BPM number 1 in the D1 +% straight and bpm5d4 represents BPM number 5 in straight d4. bpm7dk and +% bpm7dr repreents BPM number 7 in either the kicker stright or RF +% straight. +bpm1d1 = [ d1a bpm d1b ]; +bpm1d1r1 = [ d1ar1 bpm d1b ]; % RF 1 cavity +bpm1d1_id = [bpm d1b]; +%bpm1d1r4 = [ d1ar4 bpm d1b ]; % RF 4 cavity +bpm2d4 = [ d4a bpm d4b ]; +bpm3d4 = [ d4aa bpm d4bb ]; +bpm4d2 = [ d2a bpm d2b ]; +bpm5d4 = [ bpm2d4 ]; +bpm6d4 = [ bpm3d4 ]; +bpm7d1 = [ d1bb bpm d1aa ]; +bpm7d1r1 = [ d1b bpm d1ar1 ]; % RF 1 cavity +%bpm7d1r4 = [ d1b bpm d1ar4 ]; % RF 4 cavity +bpm1d1RF = [ dRF1 bpm dRF2 cav dRF2 cav dRF2 ]; +bpm7d1_id = [ d1bb bpm ]; + +d1ffb = []; +bpm7d1ffb = [ d1b bpm d1ffb ]; %fast feedback kicker + +% Arrange the elements onto the girders and use markers to define the +% sections for misalignment studies. +g1m1 = marker('g1m1','IdentityPass'); +g1m2 = marker('g1m2','IdentityPass'); +g2m1 = marker('g2m1','IdentityPass'); +g2m2 = marker('g2m2','IdentityPass'); +% girder1 = [ g1m1 sfa hcor sfa d2 qfa d3 sda vcor sda g1m2]; +% girder2 = [ g2m1 sdb vcor sdb d5 qda d6 qfb d2 sfb hcor sfb bpm4d2 qfb d6 qda d5 sdb vcor sdb g2m2]; +% girder3 = [ g1m1 sda vcor sda d3 qfa d2 sfa hcor sfa g1m2]; +girder1 = [ g1m1 sfa d2 qfa d3 sda g1m2]; +girder2 = [ g2m1 sdb d5 qda d6 qfb d2 sfb bpm4d2 qfb d6 qda d5 sdb g2m2]; +girder3 = [ g1m1 sda d3 qfa d2 sfa g1m2]; + + +% IDs +%-------------------------------------------------------------------------- +% Want the lattice to be able to place an arbitrary length ID in an +% arbitrary straight, within the constraint of straights with RF and +% kickers already installed. +% +% To that end, I'm giving the drifts (between the BPMs) to the straights, +% and the leaving the unit cell as just the unit cell. + +% Define the length of the ID +L_id = [0; %1 kicker - kicker % please don't try to put an ID here + 0; %2 kicker - ID + 3; %3 + 0; %4 + 2; %5 + 0; %6 ID - RF + 0; %7 ID - RF + 2.5; %8 + 0; %9 + 0; %10 + 0; %11 + 2.5; %12 + 3; %13 + 2]; %14 ID - kicker + +% Total wiggler length [m] +L_id = [0; %1 kicker - kicker % please don't try to put an ID here + 0; %2 kicker - ID + 0; %3 + 0; %4 + 0; %5 + 0; %6 ID - RF + 0; %7 ID - RF + 0; %8 + 0; %9 + 0; %10 + 0; %11 + 0; %12 + 0; %13 + 1.95]; %14 ID - kicker + +% Wiggler period [m] +period_id = [ 0; %1 kicker - kicker % please don't try to put an ID here + 0; %2 kicker - ID + 0; %3 + 0; %4 + 0; %5 + 0; %6 ID - RF + 0; %7 ID - RF + 0; %8 + 0; %9 + 0; %10 + 0; %11 + 0; %12 + 0; %13 + 0.075]; %14 ID - kicker + +% magnetic field [T] +Bmax_id = [ 0; %1 kicker - kicker % please don't try to put an ID here + 0; %2 kicker - ID + 0; %3 + 0; %4 + 0; %5 + 0; %6 ID - RF + 0; %7 ID - RF + 0; %8 + 0; %9 + 0; %10 + 0; %11 + 0; %12 + 0; %13 + 0.49]; %14 ID - kicker + +% Vertical magnetic field [T] +By_id = [ 0 0 0 0 0; %1 kicker - kicker % please don't try to put an ID here + 0 0 0 0 0; %2 kicker - ID + 0 0 0 0 0; %3 + 0 0 0 0 0; %4 + 0 0 0 0 0; %5 + 0 0 0 0 0; %6 ID - RF + 0 0 0 0 0; %7 ID - RF + 0 0 0 0 0; %8 + 0 0 0 0 0; %9 + 0 0 0 0 0; %10 + 0 0 0 0 0; %11 + 0 0 0 0 0; %12 + 0 0 0 0 0; %13 + 0 0 0 0 0]; %14 ID - kicker + + % Vertical magnetic field [T] +Bx_id = [ 0 0 0 0 0; %1 kicker - kicker % please don't try to put an ID here + 0 0 0 0 0; %2 kicker - ID + 0 0 0 0 0; %3 + 0 0 0 0 0; %4 + 0 0 0 0 0; %5 + 0 0 0 0 0; %6 ID - RF + 0 0 0 0 0; %7 ID - RF + 0 0 0 0 0; %8 + 0 0 0 0 0; %9 + 0 0 0 0 0; %10 + 0 0 0 0 0; %11 + 0 0 0 0 0; %12 + 0 0 0 0 0; %13 + 1 1 1 0 0]; %14 ID - kicker + +Nstep = 5; % num of integration steps per period +Nmeth = 4; % symplectic integration method, 2nd or 4th order: 2 or 4 + +% Kx = 0; Ky = 0; Kxy = 0; Kyx = 0; + +for n = 1:14 + % Define the ID + %id(n) = drift('ID',L_id(n), 'Matrix66Pass'); +% id(n) = ins_dev('ID',L_id(n), 'InsDevPass'); + if L_id(n) ~= 0 + %id(n) = wiggler('ID', L_id(n), period_id(n), Bmax_id(n), Nstep, Nmeth, [], Bx_id(n,:)', 'WigSymplectic4Pass'); + id(n) = wiggler('ID', L_id(n), period_id(n), Bmax_id(n), Nstep, Nmeth, [], Bx_id(n,:)', 'WigSymplectic4Pass'); + else + id(n) = drift('ID', 0, 'DriftPass'); + end + % Define transfer matrix +% FAMLIST{id(n)}.ElemData.M66 = [1 L_id(n) 0 0 0 0; +% Kx 1 Kxy 0 0 0; +% Kyx 0 1 L_id(n) 0 0; +% 0 0 Ky 1 0 0; +% 0 0 0 0 1 L_id(n); +% 0 0 0 0 0 1 ]; + % Define the drifts around it + switch n + case 1 % kicker kicker + bpm7d1_01 = [d1bb bpm d1ak2_do kicker_01_2]; + d1aa_id(n) = drift('D1A', len(d1ak1_do) - L_id(n)/2,'DriftPass'); + d1a_id(n) = drift('D1A', len(d1ak1_up) - L_id(n)/2,'DriftPass'); + bpm1d1_01 = [kicker_01_1 d1ak2_up bpm d1b]; + + straight{n} = [bpm7d1_01 d1aa_id(n) id(n) d1a_id(n) bpm1d1_01]; + straight_01_01 = [bpm7d1_01 d1aa_id(n)]; + straight_01_02 = [d1a_id(n) bpm1d1_01]; + case 2 % kicker - ID + bpm7d1_02 = [d1bb bpm d1ak2_do kicker_02_1]; + d1aa_id(n) = drift('D1A', (len(d1ak1_do) + len(d1a) - L_id(n)) ./ 2,'DriftPass'); + d1a_id(n) = drift('D1A', (len(d1ak1_do) + len(d1a) - L_id(n)) ./ 2,'DriftPass'); + + straight{n} = [bpm7d1_02 d1aa_id(n) id(n) d1a_id(n) bpm1d1_id]; + case 6 % ID - RF + d1aa_id(n) = drift('D1A', (len(d1aa) + len(dRF1) - L_id(n))/2,'DriftPass'); + d1a_id(n) = drift('D1A', (len(d1aa) + len(dRF1) - L_id(n))/2,'DriftPass'); + bpm1d1_06 = [bpm dRF2 cav dRF2 cav dRF2]; + + straight{n} = [bpm7d1_id d1aa_id(n) id(n) d1a_id(n) bpm1d1_06]; + case 7 % ID - RF + d1aa_id(n) = drift('D1A', (len(d1aa) + len(dRF1) - L_id(n))/2,'DriftPass'); + d1a_id(n) = drift('D1A', (len(d1aa) + len(dRF1) - L_id(n))/2,'DriftPass'); + bpm1d1_07 = [bpm dRF2 cav dRF2 cav dRF2]; + + straight{n} = [bpm7d1_id d1aa_id(n) id(n) d1a_id(n) bpm1d1_07]; + case 14 % ID - kicker + d1aa_id(n) = drift('D1A', (len(d1ak1_up) + len(d1aa) - L_id(n)) ./ 2,'DriftPass'); + d1a_id(n) = drift('D1A', (len(d1ak1_up) + len(d1aa) - L_id(n)) ./ 2,'DriftPass'); + bpm1d1_14 = [kicker_14_1 d1ak2_up bpm d1b]; + + straight{n} = [bpm7d1_id d1aa_id(n) id(n) d1a_id(n) bpm1d1_14]; + otherwise % Normal straight + % Define drifts around ID + d1aa_id(n) = drift('D1A', len(d1aa) - L_id(n)/2,'DriftPass'); + d1a_id(n) = drift('D1A', len(d1a) - L_id(n)/2,'DriftPass'); +% % Define position of BPMs for ID lattice definition +% for n = 1:14 +% bpm7d1_id(n) = [d1bb bpm d1aa_id(n)]; +% bpm1d1_id(n) = [d1a_id(n) bpm d1b]; +% end + + straight{n} = [d1bb bpm d1aa_id(n) id(n) d1a_id(n) bpm d1b]; + end +end + +% Define the special straights + +%------------------------------------------------------------------------- +% Ring lattices + +% ID ring +arc_cell = [girder1 dipole_arc girder2 dipole_arc girder3]; +%cavity4ringkent = [ ap straight{1} arc_cell straight{2} arc_cell straight{3} arc_cell straight{4} arc_cell straight{5} arc_cell straight{6} arc_cell straight{7} arc_cell straight{8} arc_cell straight{9} arc_cell straight{10} arc_cell straight{11} arc_cell straight{12} arc_cell straight{13} arc_cell straight{14} arc_cell]; +%2012_03_05 - need to start in middle of straight 1 to have BPM index correct. +cavity4ringkent = [ ap id(1) straight_01_02 arc_cell straight{2} arc_cell straight{3} arc_cell straight{4} arc_cell straight{5} arc_cell straight{6} arc_cell straight{7} arc_cell straight{8} arc_cell straight{9} arc_cell straight{10} arc_cell straight{11} arc_cell straight{12} arc_cell straight{13} arc_cell straight{14} arc_cell straight_01_01]; + +% % Arrange the girders into the different cell arrangements. +% unit_cel = [bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1]; +% % Kickers in cells 1 and 14 +% % celkick14 = [ bpm1d1k(kicker_14_1) girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1k(kicker_01_1) ]; +% % celkick01 = [ bpm1d1k(kicker_01_2) girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1k(kicker_02_1) ]; +% % Shorten the straights in cells 6, 7 and 8 to put in the rf +% % 4 RF cavities +% +% celrf06_4 = [ bpm1d1RF girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +% celrf07_4 = [ bpm1d1RF girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +% %celrf06_4 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r4 ]; +% %celrf07_4 = [ bpm1d1r4 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r4 ]; +% %celrf08_4 = [ bpm1d1r4 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +% +% % Single RF cavity +% celrf06_1 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r1 ]; +% celrf07_1 = [ bpm1d1r1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +% %diagnostic straight with fast feedback kicker +% celffb10_1 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1ffb ]; %includes fast feedback kicker +% +% % Shift sector +% shift1 = quadrupole('SHIFT1' ,0, 0,'QuadLinearPass'); +% shift2 = quadrupole('SHIFT2' ,0, 0,'QuadLinearPass'); + +% Definition of the types of rings +% kickring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +% cavity1ring = [ ap celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% cavity4ring = [ ap celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% cavity1ring = [ ap id celkick01 id unit_cel id unit_cel id unit_cel id unit_cel id celrf06_1 id cav_single id celrf07_1 id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id celkick14]; +% cavity4ring = [ ap id celkick01 id unit_cel id unit_cel id unit_cel id unit_cel id celrf06_4 id celrf07_4 id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id celkick14]; + +%cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; + +% Ring starting with the RF +% fullring_startwithRF = [ ap cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 ]; +% Ring with no RF and no Kickers +% ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% Ring starting in straight 14 rather than straight 1, outside of the kick orbit. +% fullring = [ ap celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% fast feedback kicker included: +% ffbring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel celffb10_1 unit_cel unit_cel unit_cel celkick14]; + +% Choose which lattice to load else load "fullring" as the default. +if nargin > 0 + fprintf('Using lattice : %s \n', varargin{1}); + eval(['buildlat(' varargin{1} ');']); +else + % Default lattice to load + fprintf('Using default lattice : cavity4ringkent\n'); + buildlat(cavity4ringkent); +end + +% Make the variables THERING and GLOBVAL available to the caller's +% workspace. +evalin('caller','global THERING GLOBVAL'); +disp('** Done **'); + +% New AT 1.3 does not require FAMLIST and is fazing out GLOBVAL +clear global FAMLIST + +setenergymodel(3); + +% Internal function used to return the length of a defined element. +function res = len(id) +global FAMLIST +res = FAMLIST{id}.ElemData.Length; \ No newline at end of file diff --git a/machine/ASP/StorageRing/assr4_splitbends_mod.m b/machine/ASP/StorageRing/assr4_splitbends_mod.m new file mode 100644 index 00000000..98d69a23 --- /dev/null +++ b/machine/ASP/StorageRing/assr4_splitbends_mod.m @@ -0,0 +1,386 @@ +function assr4(varargin) +% Lattice definition file - generated by dimad2at v1.300000 +% +% Eugene 2004-12-13 Updating the generalised file to realign the family +% names and elements with aspinit. NOTE: aspinit will not work with split +% elements... not without modification of the init file. +% +% Eugene 2005-09-16 Standardise all lattices being used to this. "Custom" +% versions of the lattice files, eg for ML, ID studies etc will take this +% file as a template. The following major changes were made - +% * All family names in CAPS in line with ALS and SPEAR convention. +% * Dipole path and gradient updated to reflect numerical studies on +% measured data. Quadrupole values fitted for a tune of 13.3, 5.2 and +% zero dispersion given the new dipole gradient fields. +% * Merged with "aspsr_msrf.m" with independent/individual cavitie(s). +% * Element positions/lengths should be inline with engineering +% drawings. +% +% Eugene 2010-07-08 +% * now we define the RF frequency and this will automatically scale the +% drift sections to match +% * Changed the dipole pass method to BndMPoleSymplectic4E2Pass that +% correctly tracks off energy particles through the dipole. +% * added scaling factors. +% +% Eugene 2010-07-27 +% * Plan to make this lattice the standard general lattice for all LOCO +% fits. +% * Added IDs into this lattice. Scaling of 'quadDL_2', 'scalek' and +% 'scalem' set by balancing the relative quadrupole strengths between +% families so that they are the same as in the machine. The sextupole +% component was scaled so that the modeled chromaticity matches what we +% measure. +% +% Eugene 2011-07-20 +% * Finally added the calibrated cavity voltage. The ring energy was +% changed in July 2010 after direct measurement however the cavity voltage +% was not changed. + +global FAMLIST THERING GLOBVAL + +GLOBVAL.E0 = 3.0134e9; % Measured by Harris and Kent using resonant depolrasiation July 2010. +GLOBVAL.LatticeFile = mfilename; +FAMLIST = cell(0); + +arclen = 10.031590015999972; % length bpm to bpm without the straight sections. +ringrf = 499670012; 499.6685923893040e6; 499666449; +ringrf = 499.675982e6; % 16/01/2017 ET +C0 = 299792458; % speed of light [m/s] +HarmNumber = 360; +L0 = C0*HarmNumber/ringrf; +halfstraightlength = (L0/14-arclen)/2; (L0 - arclen*14)/14/2; +% L0 = 2.159946602239996e+02; +% L0 = 2.159946602239993e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. + + +disp(' '); +fprintf('*** Loading lattice from %s.m ***\n',GLOBVAL.LatticeFile); + +% With AT1.3 ringpass and linepass, particles limited by the apperturepass +% will have [x,x',y,y',delta,dl] = [NaN,0,0,0,0,0]. All pass methods will +% check for this and do nothing to particles with these coordinates. +% Ring/linepass will both return particle positions as well as the number +% of turns the particles achieved. +% ap = aperture('AP',[-32 17 -16 16]*1e-3,'AperturePass'); +ap = aperture('AP',[-16 17 -16 16]*1e2,'AperturePass'); + +% Quadrupole field extent on one end past the magnet iron length as +% measured by RMIT student Neville. +% Empirically modified so relative strengths between QFA, QDA and QFB are +% the same as those set on the ring. +quadDL_2 = 0.0042; +d1 = drift('D1' ,halfstraightlength,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) +% d1 = drift('D1' ,2.698286,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) +d2 = drift('D2' ,1.900000e-001-quadDL_2,'DriftPass'); +d3 = drift('D3' ,1.650000e-001-quadDL_2,'DriftPass'); +d4 = drift('D4' ,2.750000e-001,'DriftPass'); +d5 = drift('D5' ,1.550000e-001-quadDL_2,'DriftPass'); +d6 = drift('D6' ,4.500000e-001-quadDL_2*2,'DriftPass'); + +% Modified drifts around BPM sections. +bpm = monitor('BPM' ,'IdentityPass'); +d1a = drift('D1A' ,len(d1)-3.942860e-001,'DriftPass'); % 2.304000e+000 +d1b = drift('D1B' , 3.942860e-001,'DriftPass'); +d1aa= drift('D1A' ,len(d1)-0.58,'DriftPass'); % Last bpm +d1bb= drift('D1B' , 0.58,'DriftPass'); +d4a = drift('D4A' ,len(d4)-1.990000e-001,'DriftPass'); % 7.600000e-002 +d4b = drift('D4B' , 1.990000e-001,'DriftPass'); +d4aa = drift('D4AA' ,len(d4)-6.400000e-002,'DriftPass'); % 2.110000e-001 +d4bb = drift('D4BB' , 6.400000e-002,'DriftPass'); +d2a = drift('D2A' ,len(d2)-1.030000e-001,'DriftPass'); % 8.700000e-002 +d2b = drift('D2B' , 1.030000e-001,'DriftPass'); + +% Dipoles +% design -> rbendMod('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% From numerical studies -> L: 1.72579121675e+000 +% K: 0.33295132 +% Sext: 0.01092687 +% Oct: 0.15166053 +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BendLinearPass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BendLinearPass'); + +scalek = 1; +scalem = 3.15; % Sextupole component scaled to get model chromaticities to match with measured chromaticities +scalen = 0.0; +thinsext = sextupole('thinsext' ,0,0.0,'ThinMPolePass'); +leftdrift_a = drift('leftdrift',0.076,'DriftPass'); +leftdrift_b = drift('leftdrift',0.0837626757-len(leftdrift_a),'DriftPass'); +rightdrift_b = drift('rightdrift',0.064,'DriftPass'); +rightdrift_a = drift('rightdrift',0.0887292346-len(rightdrift_b),'DriftPass'); + +b_left01 = rbendMod('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892*scalem -1.2289013273*scalen]); +b_left02 = rbendMod('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949*scalem -0.0632750927*scalen]); +b_left03 = rbendMod('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966*scalem -0.1103893288*scalen]); +b_left04 = rbendMod('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022*scalem 0.6681103839*scalen]); +b_left05 = rbendMod('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205*scalem 0.3349521492*scalen]); +b_centre01 = rbendMod('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817*scalem 0.2965845308*scalen]); +b_centre02 = rbendMod('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994*scalem -0.2196079070*scalen]); + +b_centre03a = rbendMod('b_centre03',0.2813281018*0.2962,0.0349189639*0.2962,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +b_centre03b = rbendMod('b_centre04',0.2813281018*0.4998,0.0349189639*0.4998,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +b_centre03c = rbendMod('b_centre05',0.2813281018*0.2040,0.0349189639*0.2040,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673*scalem -0.5218735605*scalen]); +source_six = marker('source_six','IdentityPass'); % Dipole 2 +source_seven = marker('source_seven','IdentityPass'); % Dipole 1 +b_centre03 = [b_centre03a source_six b_centre03b source_seven b_centre03c]; +%b_centre03 = rbendMod('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); + +b_centre04 = rbendMod('b_centre06',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098*scalem -0.2148826863*scalen]); +b_centre05 = rbendMod('b_centre07',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753*scalem 0.2969171603*scalen]); +b_right01 = rbendMod('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494*scalem 0.3681905186*scalen]); +b_right02 = rbendMod('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712*scalem 0.9528854933*scalen]); +b_right03 = rbendMod('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022*scalem 0.7022676128*scalen]); +b_right04 = rbendMod('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318*scalem 0.2460706289*scalen]); +b_right05 = rbendMod('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629*scalem 0.7697020810*scalen]); + +% RBEND +% b_left01 = rbend('b_left01',0.0695312761,0.0001700782,0.1121962211,-0.1120187381,0.0026580668*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 0.0026580668*scalek -0.0222542890 -0.0307698880]); +% b_left02 = rbend('b_left02',0.0695282915,0.0007118132,0.1120187381,-0.1112734474,0.0004302895*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 0.0004302895*scalek -0.0824996146 -0.0652385243]); +% b_left03 = rbend('b_left03',0.0695152451,0.0032678721,0.1112734474,-0.1078414785,-0.1045888695*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.1045888695*scalek -0.0928717833 0.2254072448]); +% b_left04 = rbend('b_left04',0.0694679183,0.0088002187,0.1078414785,-0.0989182337,-0.3486275471*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3486275471*scalek -0.0656081148 0.3572852967]); +% b_left05 = rbend('b_left05',0.0694041758,0.0092692888,0.0989182337,-0.0896518010,-0.3281526271*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3281526271*scalek -0.0355726539 0.3355904266]); +% b_centre01 = rbend('b_centre01',0.2820465390,0.0367531221,0.0896518010,-0.0529125655,-0.3312315118*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3312315118*scalek 0.0081060667 0.2963931827]); +% b_centre02 = rbend('b_centre02',0.2815037989,0.0354072962,0.0529125655,-0.0175134439,-0.3306429237*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3306429237*scalek 0.0237264198 -0.2192733272]); +% b_centre03 = rbend('b_centre03',0.2813281018,0.0349189640,0.0175134439,0.0174054578,-0.3300984023*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3300984023*scalek 0.0101509428 -0.5218382720]); +% b_centre04 = rbend('b_centre04',0.2814996751,0.0353946633,-0.0174054578,0.0528080683,-0.3302048119*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3302048119*scalek 0.0235987043 -0.2144554284]); +% b_centre05 = rbend('b_centre05',0.2820380879,0.0367421699,-0.0528080683,0.0895641319,-0.3309037380*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3309037380*scalek 0.0102169077 0.2963545009]); +% b_right01 = rbend('b_right01',0.0694014448,0.0092683188,-0.0895641319,0.0988345428,-0.3275972520*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3275972520*scalek -0.0308930090 0.3680490900]); +% b_right02 = rbend('b_right02',0.0694650575,0.0090032960,-0.0988345428,0.1077882518,-0.3467634133*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.3467634133*scalek -0.0345063628 0.6218385567]); +% b_right03 = rbend('b_right03',0.0695141539,0.0037116695,-0.1077882518,0.1112699557,-0.1347732139*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.1347732139*scalek 0.0189958278 0.8526578807]); +% b_right04 = rbend('b_right04',0.0695280819,0.0007961566,-0.1112699557,0.1120205593,-0.0014988960*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 -0.0014988960*scalek -0.0849450391 0.2100836063]); +% b_right05 = rbend('b_right05',0.0695312501,0.0001897883,-0.1120205593,0.1121997376,0.0026764692*scalek,'BndMPoleSymplectic4E2Pass',[0 0 0 0],[0 0.0026764692*scalek -0.0276971797 0.0360627830]); + +dipole_arc = [leftdrift_a bpm leftdrift_b b_left01 b_left02 b_left03 b_left04 ... + b_left05 thinsext b_centre01 b_centre02 b_centre03 b_centre04 ... + b_centre05 thinsext b_right01 b_right02 b_right03 b_right04 ... + b_right05 rightdrift_a bpm rightdrift_b]; + +% To match split dipole values from numerical studies (SBENDS) +% tune of 13.29, 5.216 and 0.1 dispersion in straights. +qfa = quadrupole('QFA' ,3.550000e-001 + quadDL_2*2, 1.733657724410066,'StrMPoleSymplectic4Pass'); +qda = quadrupole('QDA' ,1.800000e-001 + quadDL_2*2,-1.022013422983443,'StrMPoleSymplectic4Pass'); +qfb = quadrupole('QFB' ,3.550000e-001 + quadDL_2*2, 1.501312135889473,'StrMPoleSymplectic4Pass'); + +% Sextupoles with built in correctors. Corrector settings given by kick +% angle in radians. ([1 1] chromaticity with zero dispersion) +%sfa = sextcorr('SFA' ,2.000000e-001, 1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); +%sda = sextcorr('SDA' ,2.000000e-001,-1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); +%sdb = sextcorr('SDB' ,2.000000e-001,-7.098322,[0 0],'StrCorrMPoleSymplectic4Pass'); +%sfb = sextcorr('SFB' ,2.000000e-001, 7.271212,[0 0],'StrCorrMPoleSymplectic4Pass'); +sfa = sextupole('SFA' ,2.000000e-001, 1.400000e+001,'StrMPoleSymplectic4Pass'); +sda = sextupole('SDA' ,2.000000e-001,-1.400000e+001,'StrMPoleSymplectic4Pass'); +sdb = sextupole('SDB' ,2.000000e-001,-7.098322,'StrMPoleSymplectic4Pass'); +sfb = sextupole('SFB' ,2.000000e-001, 7.271212,'StrMPoleSymplectic4Pass'); + +FAMLIST{sfa}.ElemData.KickAngle = [0 0]; +FAMLIST{sda}.ElemData.KickAngle = [0 0]; +FAMLIST{sfb}.ElemData.KickAngle = [0 0]; +FAMLIST{sdb}.ElemData.KickAngle = [0 0]; + +id = marker('ID','Matrix66Pass'); +L = 0; +Kx = 0; Ky = 0; +FAMLIST{id}.ElemData.M66 = [1 L 0 0 0 0; + Kx 1 0 0 0 0; + 0 0 1 L 0 0; + 0 0 Ky 1 0 0; + 0 0 0 0 1 0; + 0 0 0 0 0 1]; + + +% RF cavity and the corresponding straight used to position the cavity. +% 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also +% we are using ThinCavities therefore the drifts have to be set +% accordingly. + +cav_single = rfcavityMod('RF' ,0.0,2993700,ringrf,HarmNumber,GLOBVAL.E0,'CavityPass'); +cav = rfcavityMod('RF' ,0.0,2993700/4,ringrf,HarmNumber,GLOBVAL.E0,'CavityPass'); +% drifts around the rf cavities and space between them +d1ar1 = drift('D1AR1' ,len(d1a)-len(cav_single)/2 ,'DriftPass'); % for just 1 cavity +drf = drift('DRF' ,0.45 ,'DriftPass'); % space between cavities +d1ar4 = drift('D1AR4' ,len(d1a)-len(cav)-len(drf)/2,'DriftPass'); % for 4 cavities +cav_pair = [cav drf cav]; +dRF1 = drift('dRF1' ,len(d1)-2.55 ,'DriftPass'); +dRF2 = drift('dRF2' ,2.55/3 ,'DriftPass'); + +% Kickers and the associated drifts to position them. (to be checked) +kick1 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick2 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick3 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick4 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +%fast feedback kicks +ffbh = corrector('FFBH' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +ffbv = corrector('FFBV' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +% Drift spaces to replace D1A for the upstream kickers, ie kickers 1 and 3. +% d1ak2_up= drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); +d1ak2_up= drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); +d1ak1_up= drift('D1AK1_UP' ,len(d1a) - len(d1ak2_up),'DriftPass'); +% Drift spaces to replace D1A for the downstream kickers, ie kickers 2 and 4. +d1ak2_do= drift('D1AK2_DO' ,1.073 - len(d1bb),'DriftPass'); +d1ak1_do= drift('D1AK1_DO' ,len(d1aa) - len(d1ak2_do),'DriftPass'); + +%fast feedback kicks +fcorr = []; +% fcorr = corrector('FCORR' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); + + +% Define the position of the bpm. bpm1d1 represents BPM number 1 in the D1 +% straight and bpm5d4 represents BPM number 5 in straight d4. bpm7dk and +% bpm7dr repreents BPM number 7 in either the kicker stright or RF +% straight. +bpm1d1 = [ d1a bpm fcorr d1b ]; +bpm1d1k = inline(['[' num2str(d1ak1_up) ' ' 'kicker ' num2str(d1ak2_up) ' ' num2str(bpm) ' ' num2str(fcorr) ' ' num2str(d1b) ' ' ']' ], 'kicker'); % Kicker +bpm1d1r1 = [ d1ar1 bpm fcorr d1b ]; % RF 1 cavity +bpm1d1RF = [ dRF1 bpm fcorr dRF2 cav dRF2 cav dRF2 ]; +bpm2d4 = [ d4a bpm d4b ]; +bpm3d4 = [ d4aa bpm d4bb ]; +bpm4d2 = [ d2a bpm d2b ]; +bpm5d4 = [ bpm2d4 ]; +bpm6d4 = [ bpm3d4 ]; +bpm7d1 = [ d1bb bpm fcorr d1aa ]; +bpm7d1k = inline(['[' num2str(d1bb) ' ' num2str(fcorr) ' ' num2str(bpm) ' ' num2str(d1ak2_do) ' ' 'kicker ' num2str(d1ak1_do) ' ' ']' ], 'kicker'); % Kicker +bpm7d1r1 = [ d1b bpm fcorr d1ar1 ]; % RF 1 cavity + +d1ffb = []; +bpm7d1ffb = [ d1b bpm d1ffb ]; %fast feedback kicker + +% Arrange the elements onto the girders and use markers to define the +% sections for misalignment studies. +g1m1 = marker('g1m1','IdentityPass'); +g1m2 = marker('g1m2','IdentityPass'); +g2m1 = marker('g2m1','IdentityPass'); +g2m2 = marker('g2m2','IdentityPass'); +% girder1 = [ g1m1 sfa hcor sfa d2 qfa d3 sda vcor sda g1m2]; +% girder2 = [ g2m1 sdb vcor sdb d5 qda d6 qfb d2 sfb hcor sfb bpm4d2 qfb d6 qda d5 sdb vcor sdb g2m2]; +% girder3 = [ g1m1 sda vcor sda d3 qfa d2 sfa hcor sfa g1m2]; +girder1 = [ g1m1 sfa d2 qfa d3 sda g1m2]; +girder2 = [ g2m1 sdb d5 qda d6 qfb d2 sfb bpm4d2 qfb d6 qda d5 sdb g2m2]; +girder3 = [ g1m1 sda d3 qfa d2 sfa g1m2]; + + +% Arrange the girders into the different cell arrangements. +unit_cel = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +unit_cel2 = [unit_cel unit_cel]; +unit_cel3 = [unit_cel unit_cel unit_cel]; +unit_cel7 = [unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel]; +% Kickers in cells 1 and 14 +celkick14 = [ bpm1d1k(kick1) girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1k(kick2) ]; +celkick01 = [ bpm1d1k(kick3) girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1k(kick4) ]; +% Shorten the straights in cells 6, 7 and 8 to put in the rf +% 4 RF cavities + +celrf06_4 = [ bpm1d1RF girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +celrf07_4 = [ bpm1d1RF girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +%celrf06_4 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r4 ]; +%celrf07_4 = [ bpm1d1r4 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r4 ]; +%celrf08_4 = [ bpm1d1r4 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; + +% Single RF cavity +celrf06_1 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r1 ]; +celrf07_1 = [ bpm1d1r1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +%diagnostic straight with fast feedback kicker +celffb10_1 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1ffb ]; %includes fast feedback kicker + +% Shift sector +shift1 = quadrupole('SHIFT1' ,0, 0,'QuadLinearPass'); +shift2 = quadrupole('SHIFT2' ,0, 0,'QuadLinearPass'); + +% Definition of the types of rings +kickring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +% cavity1ring = [ ap celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% cavity4ring = [ ap celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +cavity1ring = [ ap id celkick01 id unit_cel id unit_cel id unit_cel id unit_cel id celrf06_1 id cav_single id celrf07_1 id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id celkick14];; +cavity4ring = [ ap id celkick01 id unit_cel id unit_cel id unit_cel id unit_cel id celrf06_4 id celrf07_4 id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id unit_cel id celkick14]; + +%cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; + +% Ring starting with the RF +fullring_startwithRF = [ ap cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 ]; +% Ring with no RF and no Kickers +ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% Ring starting in straight 14 rather than straight 1, outside of the kick orbit. +fullring = [ ap celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% fast feedback kicker included: +ffbring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel celffb10_1 unit_cel unit_cel unit_cel celkick14]; + +% Choose which lattice to load else load "fullring" as the default. +if nargin > 0 + fprintf('Using lattice : %s \n', varargin{1}); + eval(['buildlat(' varargin{1} ');']); +else + % Default lattice to load + fprintf('Using default lattice : cavity4ring\n'); + buildlat(cavity4ring); +end + +% Make the variables THERING and GLOBVAL available to the caller's +% workspace. +evalin('caller','global THERING GLOBVAL'); +disp('** Done **'); + +% New AT 1.3 does not require FAMLIST and is fazing out GLOBVAL +clear global FAMLIST + +%setenergymodel(GLOBVAL.E0*1e-9); + +% Internal function used to return the length of a defined element. +function res = len(id) +global FAMLIST +res = FAMLIST{id}.ElemData.Length; + + +%modified rbend function +function z=rbendMod(fname,L,A,A1,A2,K,method,PolynomA,PolynomB) +%BEND('FAMILYNAME', Length[m], BendingAngle[rad], EntranceAngle[rad], +% ExitAngle[rad], K, 'METHOD') +% creates a new family in the FAMLIST - a structure with fields +% FamName family name +% Length length of the arc for an on-energy particle [m] +% BendingAngle total bending angle [rad] +% EntranceAngle [rad] (A/2 - for rectangular bends) +% ExitAngle [rad] (A/2 - for rectangular bends) +% ByError error in the dipole field relative to the design value +% K quadrupole K-value for combined funtion bends +% PassMethod name of the function to use for tracking +% returns assigned address in the FAMLIST that is uniquely identifies +% the family + +ElemData=atrbend(fname,L,A,K,method); +ElemData.EntranceAngle=A1; %for backwards compatibility +ElemData.ExitAngle=A2; +ElemData.PolynomA=PolynomA; +ElemData.PolynomB=PolynomB; +ElemData.MaxOrder=3; + + +global FAMLIST +z = length(FAMLIST)+1; % number of declare families including this one +FAMLIST{z}.FamName = fname; +FAMLIST{z}.NumKids = 0; +FAMLIST{z}.KidsList= []; +FAMLIST{z}.ElemData= ElemData; + + +function z = rfcavityMod(fname,L,V,F,H,E,method) +%RFCAVITY('FAMILYNAME',Length [m],Voltage[V], Frequency[Hz], Harmonic Number,'METHOD') +% creates a new family in the FAMLIST - a structure with fields +% FamName family name +% Length length[m] +% Voltage peak voltage (V) +% Frequency RF frequency [Hz] +% HarmNumber Harmonic Number +% PassMethod name of the function on disk to use for tracking +% returns assigned address in the FAMLIST that uniquely identifies +% the family + +ElemData = atrfcavity(fname,L,V,F,H,E,method); + +global FAMLIST +z = length(FAMLIST)+1; % number of declare families including this one +FAMLIST{z}.FamName = fname; +FAMLIST{z}.NumKids = 0; +FAMLIST{z}.KidsList= []; +FAMLIST{z}.ElemData= ElemData; + + diff --git a/machine/ASP/StorageRing/assr4_splitbends_sourcedip.m b/machine/ASP/StorageRing/assr4_splitbends_sourcedip.m new file mode 100644 index 00000000..e0b3e612 --- /dev/null +++ b/machine/ASP/StorageRing/assr4_splitbends_sourcedip.m @@ -0,0 +1,297 @@ +function assr4(varargin) +% Lattice definition file - generated by dimad2at v1.300000 +% +% Eugene 2004-12-13 Updating the generalised file to realign the family +% names and elements with aspinit. NOTE: aspinit will not work with split +% elements... not without modification of the init file. +% +% Eugene 2005-09-16 Standardise all lattices being used to this. "Custom" +% versions of the lattice files, eg for ML, ID studies etc will take this +% file as a template. The following major changes were made - +% * All family names in CAPS in line with ALS and SPEAR convention. +% * Dipole path and gradient updated to reflect numerical studies on +% measured data. Quadrupole values fitted for a tune of 13.3, 5.2 and +% zero dispersion given the new dipole gradient fields. +% * Merged with "aspsr_msrf.m" with independent/individual cavitie(s). +% * Element positions/lengths should be inline with engineering +% drawings. + +global FAMLIST THERING GLOBVAL + +GLOBVAL.E0 = 3e9; +GLOBVAL.LatticeFile = mfilename; +FAMLIST = cell(0); + +L0 = 2.159946602239996e+02; +L0 = 2.159946602239993e+02; % calculated using findspos %215.9945540689991;% with new dipole path lengths. Designed for 216m. +C0 = 299792458; % speed of light [m/s] +HarmNumber = 360; + +disp(' '); +fprintf('*** Loading lattice from %s.m ***\n',GLOBVAL.LatticeFile); + +% With AT1.3 ringpass and linepass, particles limited by the apperturepass +% will have [x,x',y,y',delta,dl] = [NaN,0,0,0,0,0]. All pass methods will +% check for this and do nothing to particles with these coordinates. +% Ring/linepass will both return particle positions as well as the number +% of turns the particles achieved. +% ap = aperture('AP',[-32 17 -16 16]*1e-3,'AperturePass'); +ap = aperture('AP',[-16 17 -16 16]*1e2,'AperturePass'); + +d1 = drift('D1' ,2.698300e+000,'DriftPass'); % (2.698286 -> to get closer to the design distance of 216m) +d2 = drift('D2' ,1.900000e-001,'DriftPass'); +d3 = drift('D3' ,1.650000e-001,'DriftPass'); +d4 = drift('D4' ,2.750000e-001,'DriftPass'); +d5 = drift('D5' ,1.550000e-001,'DriftPass'); +d6 = drift('D6' ,4.500000e-001,'DriftPass'); + +% Modified drifts around BPM sections. +bpm = monitor('BPM' ,'IdentityPass'); +d1a = drift('D1A' ,len(d1)-3.942860e-001,'DriftPass'); % 2.304000e+000 +d1b = drift('D1B' , 3.942860e-001,'DriftPass'); +d1aa= drift('D1A' ,len(d1)-0.58,'DriftPass'); % Last bpm +d1bb= drift('D1B' , 0.58,'DriftPass'); +d4a = drift('D4A' ,len(d4)-1.990000e-001,'DriftPass'); % 7.600000e-002 +d4b = drift('D4B' , 1.990000e-001,'DriftPass'); +d4aa = drift('D4AA' ,len(d4)-6.400000e-002,'DriftPass'); % 2.110000e-001 +d4bb = drift('D4BB' , 6.400000e-002,'DriftPass'); +d2a = drift('D2A' ,len(d2)-1.030000e-001,'DriftPass'); % 8.700000e-002 +d2b = drift('D2B' , 1.030000e-001,'DriftPass'); + +% Dipoles +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% From numerical studies -> L: 1.72579121675e+000 +% K: 0.33295132 +% Sext: 0.01092687 +% Oct: 0.15166053 +dip1 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); +dip2 = rbend('BEND' ,1.72579121675e+000,2.243995e-001,1.121997e-001,1.121997e-001,-0.33295132,'BndMPoleSymplectic4Pass'); + +scalek = 1.00; +leftdrift_a = drift('leftdrift',0.076,'DriftPass'); +leftdrift_b = drift('leftdrift',0.0837626757-len(leftdrift_a),'DriftPass'); +rightdrift_b = drift('rightdrift',0.064,'DriftPass'); +rightdrift_a = drift('rightdrift',0.0887292346-len(rightdrift_b),'DriftPass'); + +b_left01 = rbend('b_left01',0.0695312761,0.0001684486,0.0000000000,0.0000000000,-0.0058550750*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0058550750*scalek 0.0862147892 -1.2289013273]); +b_left02 = rbend('b_left02',0.0695282915,0.0007117061,0.0000000000,0.0000000000,-0.0239389168*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0239389168*scalek -0.0583359949 -0.0632750927]); +b_left03 = rbend('b_left03',0.0695152451,0.0032675350,0.0000000000,0.0000000000,-0.2254325358*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2254325358*scalek 0.2451727966 -0.1103893288]); +b_left04 = rbend('b_left04',0.0694679183,0.0087995936,0.0000000000,0.0000000000,-0.4158165694*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.4158165694*scalek -0.1443627022 0.6681103839]); +b_left05 = rbend('b_left05',0.0694041758,0.0092692887,0.0000000000,0.0000000000,-0.3298403749*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3298403749*scalek -0.0340207205 0.3349521492]); +b_centre01 = rbend('b_centre01',0.2820465390,0.0367531161,0.0000000000,0.0000000000,-0.3315842393*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3315842393*scalek 0.0083655817 0.2965845308]); +b_centre02 = rbend('b_centre02',0.2815037989,0.0354072994,0.0000000000,0.0000000000,-0.3306516396*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306516396*scalek 0.0236710994 -0.2196079070]); + +b_centre03a = rbend('b_centre03',0.07039827720955,0.0349189639*0.2502,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); +b_centre03b = rbend('b_centre04',0.16393005016542,0.0349189639*0.5827,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); +b_centre03c = rbend('b_centre05',0.04699977442503,0.0349189639*0.1671,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); +b_centre03 = [b_centre03a b_centre03b b_centre03c]; +%b_centre03 = rbend('b_centre03',0.2813281018,0.0349189639,0.0000000000,0.0000000000,-0.3300962629*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300962629*scalek 0.0101400673 -0.5218735605]); + +b_centre04 = rbend('b_centre06',0.2814996751,0.0353946664,0.0000000000,0.0000000000,-0.3302155286*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302155286*scalek 0.0236248098 -0.2148826863]); +b_centre05 = rbend('b_centre07',0.2820380879,0.0367421671,0.0000000000,0.0000000000,-0.3312220213*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312220213*scalek 0.0103909753 0.2969171603]); +b_right01 = rbend('b_right01',0.0694014448,0.0092683157,0.0000000000,0.0000000000,-0.3292611055*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3292611055*scalek -0.0291322494 0.3681905186]); +b_right02 = rbend('b_right02',0.0694650575,0.0090036557,0.0000000000,0.0000000000,-0.3961176951*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3961176951*scalek -0.1539214712 0.9528854933]); +b_right03 = rbend('b_right03',0.0695141539,0.0037120061,0.0000000000,0.0000000000,-0.2701751814*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.2701751814*scalek 0.3742213022 0.7022676128]); +b_right04 = rbend('b_right04',0.0695280819,0.0007962279,0.0000000000,0.0000000000,-0.0288159660*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0288159660*scalek -0.0571472318 0.2460706289]); +b_right05 = rbend('b_right05',0.0695312501,0.0001902235,0.0000000000,0.0000000000,-0.0028161106*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0028161106*scalek -0.1077402629 0.7697020810]); + +% RBEND +% b_left01 = rbend('b_left01',0.0695312761,0.0001700782,0.1121962211,-0.1120187381,0.0026580668*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026580668*scalek -0.0222542890 -0.0307698880]); +% b_left02 = rbend('b_left02',0.0695282915,0.0007118132,0.1120187381,-0.1112734474,0.0004302895*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0004302895*scalek -0.0824996146 -0.0652385243]); +% b_left03 = rbend('b_left03',0.0695152451,0.0032678721,0.1112734474,-0.1078414785,-0.1045888695*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1045888695*scalek -0.0928717833 0.2254072448]); +% b_left04 = rbend('b_left04',0.0694679183,0.0088002187,0.1078414785,-0.0989182337,-0.3486275471*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3486275471*scalek -0.0656081148 0.3572852967]); +% b_left05 = rbend('b_left05',0.0694041758,0.0092692888,0.0989182337,-0.0896518010,-0.3281526271*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3281526271*scalek -0.0355726539 0.3355904266]); +% b_centre01 = rbend('b_centre01',0.2820465390,0.0367531221,0.0896518010,-0.0529125655,-0.3312315118*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3312315118*scalek 0.0081060667 0.2963931827]); +% b_centre02 = rbend('b_centre02',0.2815037989,0.0354072962,0.0529125655,-0.0175134439,-0.3306429237*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3306429237*scalek 0.0237264198 -0.2192733272]); +% b_centre03 = rbend('b_centre03',0.2813281018,0.0349189640,0.0175134439,0.0174054578,-0.3300984023*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3300984023*scalek 0.0101509428 -0.5218382720]); +% b_centre04 = rbend('b_centre04',0.2814996751,0.0353946633,-0.0174054578,0.0528080683,-0.3302048119*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3302048119*scalek 0.0235987043 -0.2144554284]); +% b_centre05 = rbend('b_centre05',0.2820380879,0.0367421699,-0.0528080683,0.0895641319,-0.3309037380*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3309037380*scalek 0.0102169077 0.2963545009]); +% b_right01 = rbend('b_right01',0.0694014448,0.0092683188,-0.0895641319,0.0988345428,-0.3275972520*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3275972520*scalek -0.0308930090 0.3680490900]); +% b_right02 = rbend('b_right02',0.0694650575,0.0090032960,-0.0988345428,0.1077882518,-0.3467634133*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.3467634133*scalek -0.0345063628 0.6218385567]); +% b_right03 = rbend('b_right03',0.0695141539,0.0037116695,-0.1077882518,0.1112699557,-0.1347732139*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.1347732139*scalek 0.0189958278 0.8526578807]); +% b_right04 = rbend('b_right04',0.0695280819,0.0007961566,-0.1112699557,0.1120205593,-0.0014988960*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 -0.0014988960*scalek -0.0849450391 0.2100836063]); +% b_right05 = rbend('b_right05',0.0695312501,0.0001897883,-0.1120205593,0.1121997376,0.0026764692*scalek,'BndMPoleSymplectic4Pass',[0 0 0 0],[0 0.0026764692*scalek -0.0276971797 0.0360627830]); + +dipole_arc = [leftdrift_a bpm leftdrift_b b_left01 b_left02 b_left03 b_left04 ... + b_left05 b_centre01 b_centre02 b_centre03 b_centre04 ... + b_centre05 b_right01 b_right02 b_right03 b_right04 ... + b_right05 rightdrift_a bpm rightdrift_b]; + +% Quadrupoles (for design dipole: [QFA,QDA,QFB]=[1.761741,-1.038377,1.533802]; +% To match new single dipole values from numerical studies +% tune of 13.3, 5.2 and 0 dispersion in straights. +% qfa = quadrupole('QFA' ,3.550000e-001, 1.7610967e+000,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.0715748e+000,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); + +% To match split dipole values from numerical studies (SBENDS) +% tune of 13.216, 5.3006 and 0 dispersion in straights. +% qfa = quadrupole('QFA' ,3.550000e-001, 1.7610967e+000,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.0715748e+000,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.5406418e+000,'QuadLinearPass'); + +% To match split dipole values from numerical studies (RBENDS) +% tune of 13.216, 5.3006 and 0 dispersion in straights. +% qfa = quadrupole('QFA' ,3.550000e-001, 1.7521052e+000,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.0897262e+000,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.5452228e+000,'QuadLinearPass'); + +% To match split dipole values from numerical studies (RBENDS) +% tune of 13.29, 5.216 and 0 dispersion in straights. +% -1.08597141914729 +% qfa = quadrupole('QFA' ,3.550000e-001, 1.76190217411609,'QuadLinearPass'); +% qda = quadrupole('QDA' ,1.800000e-001,-1.08597141914729,'QuadLinearPass'); +% qfb = quadrupole('QFB' ,3.550000e-001, 1.54443756044807,'QuadLinearPass'); + +% To match split dipole values from numerical studies (SBENDS) +% tune of 13.29, 5.216 and 0 dispersion in straights. +qfa = quadrupole('QFA' ,3.550000e-001, 1.76272982211693,'QuadLinearPass'); +qda = quadrupole('QDA' ,1.800000e-001,-1.06276736743823,'QuadLinearPass'); +qfb = quadrupole('QFB' ,3.550000e-001, 1.53992875479511,'QuadLinearPass'); + +% Sextupoles with built in correctors. Corrector settings given by kick +% angle in radians. (zero chromaticity with zero dispersion and original +% model without split measured bends) +sfa = sextcorr('SFA' ,2.000000e-001, 1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); +sda = sextcorr('SDA' ,2.000000e-001,-1.400000e+001,[0 0],'StrCorrMPoleSymplectic4Pass'); +sdb = sextcorr('SDB' ,2.000000e-001,-7.014635e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); +sfb = sextcorr('SFB' ,2.000000e-001, 7.189346e+000,[0 0],'StrCorrMPoleSymplectic4Pass'); + + +wig = multipole('wig',0,[0 0 0 0],[0 0 0 10],'ThinMPolePass'); + +% RF cavity and the corresponding straight used to position the cavity. +% 4.996540652069698e+008 old freq for 216m for 216.0004 its different. Also +% we are using ThinCavities therefore the drifts have to be set +% accordingly. +cav_single = rfcavity('RF' ,0.0,3.00e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); +cav = rfcavity('RF' ,0.0,0.75e+006,C0/L0*HarmNumber,HarmNumber,'CavityPass'); +% drifts around the rf cavities and space between them +d1ar1 = drift('D1AR1' ,len(d1a)-len(cav_single)/2 ,'DriftPass'); % for just 1 cavity +drf = drift('DRF' ,0.45 ,'DriftPass'); % space between cavities +d1ar4 = drift('D1AR4' ,len(d1a)-len(cav)-len(drf)/2,'DriftPass'); % for 4 cavities +cav_pair = [cav drf cav]; +% dRF1 = drift('dRF1' ,len(d1)-2.55 ,'DriftPass'); +% dRF2 = drift('dRF2' ,2.55/3 ,'DriftPass'); +dRF1 = drift('dRF1' ,len(d1)-2.55 ,'DriftPass'); +dRF2 = drift('dRF2' ,2.55/3 ,'DriftPass'); + +% Kickers and the associated drifts to position them. (to be checked) +kick1 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick2 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick3 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +kick4 = corrector('KICK' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +%fast feedback kicks +ffbh = corrector('FFBH' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +ffbv = corrector('FFBV' ,0.000000e+000,[0.000000e+000 0.0],'CorrectorPass'); +% Drift spaces to replace D1A for the upstream kickers, ie kickers 1 and 3. +d1ak2_up= drift('D1AK2_UP' ,0.779 - len(d1b),'DriftPass'); +d1ak1_up= drift('D1AK1_UP' ,len(d1a) - len(d1ak2_up),'DriftPass'); +% Drift spaces to replace D1A for the downstream kickers, ie kickers 2 and 4. +d1ak2_do= drift('D1AK2_DO' ,1.073 - len(d1bb),'DriftPass'); +d1ak1_do= drift('D1AK1_DO' ,len(d1aa) - len(d1ak2_do),'DriftPass'); + + +% Define the position of the bpm. bpm1d1 represents BPM number 1 in the D1 +% straight and bpm5d4 represents BPM number 5 in straight d4. bpm7dk and +% bpm7dr repreents BPM number 7 in either the kicker stright or RF +% straight. +bpm1d1 = [ d1a bpm d1b ]; +bpm1d1k = inline(['[' num2str(d1ak1_up) ' ' 'kicker ' num2str(d1ak2_up) ' ' num2str(bpm) ' ' num2str(d1b) ' ' ']' ], 'kicker'); % Kicker +bpm1d1r1 = [ d1ar1 bpm d1b ]; % RF 1 cavity +%bpm1d1r4 = [ d1ar4 bpm d1b ]; % RF 4 cavity +bpm2d4 = [ d4a bpm d4b ]; +bpm3d4 = [ d4aa bpm d4bb ]; +bpm4d2 = [ d2a bpm d2b ]; +bpm5d4 = [ bpm2d4 ]; +bpm6d4 = [ bpm3d4 ]; +bpm7d1 = [ d1bb bpm d1aa ]; +bpm7d1k = inline(['[' num2str(d1bb) ' ' num2str(bpm) ' ' num2str(d1ak2_do) ' ' 'kicker ' num2str(d1ak1_do) ' ' ']' ], 'kicker'); % Kicker +bpm7d1r1 = [ d1b bpm d1ar1 ]; % RF 1 cavity +%bpm7d1r4 = [ d1b bpm d1ar4 ]; % RF 4 cavity +bpm1d1RF = [ dRF1 bpm dRF2 cav dRF2 cav dRF2 ]; + +d1ffb = []; +bpm7d1ffb = [ d1b bpm d1ffb ]; %fast feedback kicker + +% Arrange the elements onto the girders and use markers to define the +% sections for misalignment studies. +g1m1 = marker('g1m1','IdentityPass'); +g1m2 = marker('g1m2','IdentityPass'); +g2m1 = marker('g2m1','IdentityPass'); +g2m2 = marker('g2m2','IdentityPass'); +% girder1 = [ g1m1 sfa hcor sfa d2 qfa d3 sda vcor sda g1m2]; +% girder2 = [ g2m1 sdb vcor sdb d5 qda d6 qfb d2 sfb hcor sfb bpm4d2 qfb d6 qda d5 sdb vcor sdb g2m2]; +% girder3 = [ g1m1 sda vcor sda d3 qfa d2 sfa hcor sfa g1m2]; +girder1 = [ g1m1 sfa d2 qfa d3 sda g1m2]; +girder2 = [ g2m1 sdb d5 qda d6 qfb d2 sfb bpm4d2 qfb d6 qda d5 sdb g2m2]; +girder3 = [ g1m1 sda d3 qfa d2 sfa g1m2]; + + +% Arrange the girders into the different cell arrangements. +unit_cel = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +% Kickers in cells 1 and 14 +celkick14 = [ bpm1d1k(kick1) girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1k(kick2) ]; +celkick01 = [ bpm1d1k(kick3) girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1k(kick4) ]; +% Shorten the straights in cells 6, 7 and 8 to put in the rf +% 4 RF cavities + +celrf06_4 = [ bpm1d1RF girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +celrf07_4 = [ bpm1d1RF girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +%celrf06_4 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r4 ]; +%celrf07_4 = [ bpm1d1r4 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r4 ]; +%celrf08_4 = [ bpm1d1r4 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; + +% Single RF cavity +celrf06_1 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1r1 ]; +celrf07_1 = [ bpm1d1r1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1 ]; +%diagnostic straight with fast feedback kicker +celffb10_1 = [ bpm1d1 girder1 dipole_arc girder2 dipole_arc girder3 bpm7d1ffb ]; %includes fast feedback kicker + +% Shift sector +shift1 = quadrupole('SHIFT1' ,0, 0,'QuadLinearPass'); +shift2 = quadrupole('SHIFT2' ,0, 0,'QuadLinearPass'); + +% Definition of the types of rings +kickring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; +% cavity1ring = [ ap celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +% cavity4ring = [ ap celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +cavity1ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14];; +cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 celrf07_4 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; + +%cavity4ring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_4 cav_pair celrf07_4 cav_pair celrf08_4 unit_cel unit_cel unit_cel unit_cel unit_cel celkick14]; + +fullring_startwithRF = [ ap cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 ]; +ring = [ ap unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +fullring = [ ap celkick14 celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; +%fast feedback kicker included: +ffbring = [ ap celkick01 unit_cel unit_cel unit_cel unit_cel celrf06_1 cav_single celrf07_1 unit_cel unit_cel celffb10_1 unit_cel unit_cel unit_cel celkick14]; +% Wiggler +wigring = [ ap unit_cel wig unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel unit_cel ]; + +% Choose which lattice to load else load "fullring" as the default. +if nargin > 0 + fprintf('Using lattice : %s \n', varargin{1}); + eval(['buildlat(' varargin{1} ');']); +else + % Default lattice to load + fprintf('Using default lattice : cavity4ring\n'); + buildlat(cavity4ring); +end + +% Make the variables THERING and GLOBVAL available to the caller's +% workspace. +evalin('caller','global THERING GLOBVAL'); +disp('** Done **'); + +% New AT 1.3 does not require FAMLIST and is fazing out GLOBVAL +clear global FAMLIST + +setenergymodel(3); + +% Internal function used to return the length of a defined element. +function res = len(id) +global FAMLIST +res = FAMLIST{id}.ElemData.Length; + diff --git a/machine/ASP/StorageRing/assr4_wiggler.m b/machine/ASP/StorageRing/assr4_wiggler.m index a2a51975..ad09184d 100644 --- a/machine/ASP/StorageRing/assr4_wiggler.m +++ b/machine/ASP/StorageRing/assr4_wiggler.m @@ -59,7 +59,8 @@ function assr4(varargin) d2b = drift('D2B' , 1.030000e-001,'DriftPass'); % Dipoles -% design -> rbend('BEND',1.726000e+000,2.243995e-001,1.121997e-001,1.121997e-001,-3.349992e-001,[method]); +% design -> rbend('BEND',1.726000e+000,2.243995e-001,... +% 1.121997e-001,1.121997e-001,-3.349992e-001,[method]); % From numerical studies -> L: 1.72579121675e+000 % K: 0.33295132 % Sext: 0.01092687 diff --git a/machine/ASP/StorageRing/atsummary.m b/machine/ASP/StorageRing/atsummary.m deleted file mode 100644 index 9441095d..00000000 --- a/machine/ASP/StorageRing/atsummary.m +++ /dev/null @@ -1,151 +0,0 @@ -function varargout = atsummary(varargin) -% ATSUMMARY(['verbose']) will print out the paramters of the lattice -% currently loaded in AT. The parameters that come after the Synchrotron -% Integrals are parameters that depend on the Integrals themselves. The -% equations to calculate them were taken from [1]. -% -% 'verbose' will make ATSUMMARY print out a summary -% -% [1] Alexander Wu Chao and Maury Tigner, Handbook of Accelerator Physics -% and Engineering (World Scientific, Singapore, 1998), pp. 183-187. (or -% 187-190 in ed. 2) -% -% Written by Eugene Tan -% Updated 04/05/2005: Check for EntranceAngle since multipoles have -% BendingAngle as well. -% Revised by Laurent S. Nadolski - - -global THERING GLOBVAL - -% if exist('sum','var') -% clear global sum; -% global sum; -% end - -% Structure to store info -sum.e0 = GLOBVAL.E0*1e-9; -sum.circumference = findspos(THERING, length(THERING)+1); -sum.revTime = sum.circumference / 2.99792458e8; -sum.revFreq = 2.99792458e8 / sum.circumference; -sum.gamma = sum.e0 / 0.51099906e-3; -sum.beta = sqrt(1 - 1/sum.gamma); -[TD sum.tunes sum.chromaticity] = twissring(THERING, 0, 1:length(THERING)+1, 'chrom', 1e-8); -sum.compactionFactor = mcf(THERING); - -% For calculating the synchrotron interals -temp = cat(2,TD.Dispersion); -D_x = temp(1,:)'; -D_x_ = temp(2,:)'; -beta = cat(1, TD.beta); -alpha = cat(1, TD.alpha); -gamma = (1 + alpha.^2) ./ beta; -circ = TD(length(THERING)+1).SPos; - -% Synchrotron integral calculation -sum.integrals = [0.0 0.0 0.0 0.0 0.0 0.0]; - -for i = 1:length(THERING) - if isfield(THERING{i}, 'BendingAngle') && isfield(THERING{i}, 'EntranceAngle') - rho = THERING{i}.Length/THERING{i}.BendingAngle; - dispersion = 0.5*(D_x(i)+D_x(i+1)); - sum.integrals(1) = sum.integrals(1) + dispersion*THERING{i}.Length/rho; - sum.integrals(2) = sum.integrals(2) + THERING{i}.Length/(rho^2); - sum.integrals(3) = sum.integrals(3) + THERING{i}.Length/(rho^3); - % For general wedge magnets - sum.integrals(4) = sum.integrals(4) + ... - D_x(i)*tan(THERING{i}.EntranceAngle)/rho^2 + ... - (1 + 2*rho^2*THERING{i}.PolynomB(2))*(D_x(i)+D_x(i+1))*THERING{i}.Length/(2*rho^3) + ... - D_x(i+1)*tan(THERING{i}.ExitAngle)/rho^2; - % sum.integrals(4) = sum.integrals(4) + 2*0.5*(D_x(i)+D_x(i+1))*THERING{i}.Length/rho^3; - H1 = beta(i,1)*D_x_(i)*D_x_(i)+2*alpha(i)*D_x(i)*D_x_(i)+gamma(i)*D_x(i)*D_x(i); - H0 = beta(i+1,1)*D_x_(i+1)*D_x_(i+1)+2*alpha(i+1)*D_x(i+1)*D_x_(i+1)+gamma(i+1)*D_x(i+1)*D_x(i+1); - sum.integrals(5) = sum.integrals(5) + THERING{i}.Length*(H1+H0)*0.5/(rho^3); - % if H1+H0 < 0 - % fprintf('%f %i %s\n', H1+H0, i, THERING{i}.FamName) - % end - sum.integrals(6) = sum.integrals(6) + ... - THERING{i}.PolynomB(2)^2*dispersion^2*THERING{i}.Length; - end -end - -% Damping numbers -% Use Robinson's Theorem -sum.damping(1) = 1 - sum.integrals(4)/sum.integrals(2); -sum.damping(2) = 1; -sum.damping(3) = 2 + sum.integrals(4)/sum.integrals(2); - -sum.radiation = 8.846e-5*sum.e0.^4*sum.integrals(2)/(2*pi); -sum.naturalEnergySpread = sqrt(3.8319e-13*sum.gamma.^2*sum.integrals(3)/(2*sum.integrals(2) + sum.integrals(4))); -sum.naturalEmittance = 3.8319e-13*(sum.e0*1e3/0.510999).^2*sum.integrals(5)/(sum.damping(1)*sum.integrals(2)); - -% Damping times -sum.radiationDamping(1) = 1/(2113.1*sum.e0.^3*sum.integrals(2)*sum.damping(1)/circ); -sum.radiationDamping(2) = 1/(2113.1*sum.e0.^3*sum.integrals(2)*sum.damping(2)/circ); -sum.radiationDamping(3) = 1/(2113.1*sum.e0.^3*sum.integrals(2)*sum.damping(3)/circ); - -% Slip factor -sum.etac = sum.gamma^(-2) - sum.compactionFactor; - -cavind = findcells(THERING,'HarmNumber'); -if ~isempty(cavind) - freq = THERING{cavind(1)}.Frequency; - v_cav = THERING{cavind(1)}.Voltage*length(cavind); -else - % Default - freq = 4.996540652069698e+008; - v_cav = 3e6; -end -sum.harmon = sum.circumference/(2.99792458e8/freq); % Assuming 499.654MHz RF -sum.overvoltage = v_cav/(sum.radiation*1e9); % Assuming 3e6 volt cavities. -% Assuming the harmon and overvoltage above. -% references: H. Winick, "Synchrotron Radiation Sources: A Primer", -% World Scientific Publishing, Singapore, pp92-95. (1995) -% Wiedermann, pp290,350. Chao, pp189. -sum.syncphase = pi - asin(1/sum.overvoltage); -sum.energyacceptance = sqrt(v_cav*sin(sum.syncphase)*2*(sqrt(sum.overvoltage^2-1) - acos(1/sum.overvoltage))/(pi*sum.harmon*abs(sum.etac)*sum.e0*1e9)); -sum.synctune = sqrt((sum.etac*sum.harmon*v_cav*cos(sum.syncphase))/(2*pi*sum.e0*1e9)); -sum.bunchlength = sum.beta*299792458*abs(sum.etac)*sum.naturalEnergySpread/(sum.synctune*sum.revFreq*2*pi); - -if nargin > 0 && ischar(varargin{1}) && strcmpi(varargin{1},'verbose') - fprintf('\n'); - fprintf(' ******** Summary for ''%s'' ********\n', GLOBVAL.LatticeFile); - fprintf(' Energy: \t\t\t%4.5f [GeV]\n', sum.e0); - fprintf(' Gamma: \t\t\t%4.5f \n', sum.gamma); - fprintf(' Circumference: \t\t%4.5f [m]\n', sum.circumference); - fprintf(' Revolution time: \t\t%4.5f [ns] (%4.5f [MHz]) \n', sum.revTime*1e9,sum.revFreq*1e-6); - fprintf(' Betatron tune H: \t\t%4.5f (%4.5f [kHz])\n', sum.tunes(1),sum.tunes(1)/sum.revTime*1e-3); - fprintf(' V: \t\t%4.5f (%4.5f [kHz])\n', sum.tunes(2),sum.tunes(2)/sum.revTime*1e-3); - fprintf(' Momentum Compaction Factor: \t%4.5f\n', sum.compactionFactor); - fprintf(' Chromaticity H: \t\t%+4.5f\n', sum.chromaticity(1)); - fprintf(' V: \t\t%+4.5f\n', sum.chromaticity(2)); - fprintf(' Synchrotron Integral 1: \t%4.5f [m]\n', sum.integrals(1)); - fprintf(' 2: \t%4.5f [m^-1]\n', sum.integrals(2)); - fprintf(' 3: \t%4.5f [m^-2]\n', sum.integrals(3)); - fprintf(' 4: \t%4.5f [m^-1]\n', sum.integrals(4)); - fprintf(' 5: \t%4.5f [m^-1]\n', sum.integrals(5)); - fprintf(' 6: \t%4.5f [m^-1]\n', sum.integrals(6)); - fprintf(' Damping Partition H: \t%4.5f\n', sum.damping(1)); - fprintf(' V: \t%4.5f\n', sum.damping(2)); - fprintf(' E: \t%4.5f\n', sum.damping(3)); - fprintf(' Radiation Loss: \t\t%4.5f [keV]\n', sum.radiation*1e6); - fprintf(' Natural Energy Spread: \t%4.5e\n', sum.naturalEnergySpread); - fprintf(' Natural Emittance: \t\t%4.5e [mrad]\n', sum.naturalEmittance); - fprintf(' Radiation Damping H: \t%4.5f [ms]\n', sum.radiationDamping(1)*1e3); - fprintf(' V: \t%4.5f [ms]\n', sum.radiationDamping(2)*1e3); - fprintf(' E: \t%4.5f [ms]\n', sum.radiationDamping(3)*1e3); - fprintf(' Slip factor : \t%4.5f\n', sum.etac); - fprintf('\n'); - fprintf(' Assuming cavities Voltage: %4.5f [kV]\n', v_cav/1e3); - fprintf(' Frequency: %4.5f [MHz]\n', freq/1e6); - fprintf(' Harmonic Number: %4.5f\n', sum.harmon); - fprintf(' Overvoltage factor: %4.5f\n', sum.overvoltage); - fprintf(' Synchronous Phase: %4.5f [rad] (%4.5f [deg])\n', sum.syncphase, sum.syncphase*180/pi); - fprintf(' Linear Energy Acceptance: %4.5f %%\n', sum.energyacceptance*100); - fprintf(' Synchrotron Tune: %4.5f (%4.5f kHz or %4.2f turns) \n', sum.synctune, sum.synctune/sum.revTime*1e-3, 1/sum.synctune); - fprintf(' Bunch Length: %4.5f [mm]\n', sum.bunchlength*1e3); -end - -if nargout > 0 - varargout{1} = sum; -end \ No newline at end of file diff --git a/machine/ASP/StorageRing/bend2gev.m b/machine/ASP/StorageRing/bend2gev.m index 3bd5a084..b2880fa5 100644 --- a/machine/ASP/StorageRing/bend2gev.m +++ b/machine/ASP/StorageRing/bend2gev.m @@ -1,231 +1,231 @@ -function GeV = bend2gev(varargin) -%BEND2GEV - Compute the energy based on the ramp tables -% GeV = bend2gev(Family, Field, Amps, DeviceList, BranchFlag) -% -% INPUTS -% 1. Bend - Bend magnet family {Optional} -% 2. Field - Field {Optional} -% 3. Amps - Bend magnet current -% 4. DeviceList - Bend magnet device list to reference energy to {Default: BEND(1,1)} -% 5. BranchFlag - 1 -> Lower branch -% 2 -> Upper branch {Default} -% Not working at Spear yet, since there isn't any magnet measurements on hysteresis -% -% OUTPUTS -% 1. GeV - Electron beam energy [GeV] -% -% Written by Greg Portmann -% Modified by E. Tan for ASP 31/05/2006 - -% Default -Family = ''; -Field = ''; -Amps = []; -DeviceList = []; -BranchFlag = []; - -ModeFlag = ''; % model, online, manual -UnitsFlag = ''; % hardware, physics -for i = length(varargin):-1:1 - if isstruct(varargin{i}) - % Ignor structures - elseif iscell(varargin{i}) - % Ignor cells - elseif strcmpi(varargin{i},'struct') - varargin(i) = []; - elseif strcmpi(varargin{i},'numeric') - varargin(i) = []; - elseif strcmpi(varargin{i},'physics') - UnitsFlag = 'Physics'; - varargin(i) = []; - elseif strcmpi(varargin{i},'hardware') - UnitsFlag = 'Hardware'; - varargin(i) = []; - elseif strcmpi(varargin{i},'simulator') | strcmpi(varargin{i},'model') - ModeFlag = varargin{i}; - varargin(i) = []; - elseif strcmpi(varargin{i},'online') - ModeFlag = varargin{i}; - varargin(i) = []; - elseif strcmpi(varargin{i},'manual') - ModeFlag = varargin{i}; - varargin(i) = []; - end -end - - -if length(varargin) >= 1 - if ischar(varargin{1}) - Family = varargin{1}; - varargin(1) = []; - else - Amps = varargin{1}; - varargin(1) = []; - if length(varargin) >= 1 - DeviceList = varargin{1}; - varargin(1) = []; - end - if length(varargin) >= 1 - BranchFlag = varargin{1}; - varargin(1:end) = []; - end - end -end -if length(varargin) >= 1 & ischar(varargin{1}) - Field = varargin{1}; - varargin(1) = []; -end -if length(varargin) >= 1 - Amps = varargin{1}; - varargin(1) = []; -end -if length(varargin) >= 1 - DeviceList = varargin{1}; - varargin(1) = []; -end -if length(varargin) >= 1 - BranchFlag = varargin{1}; - varargin(1) = []; -end - - -if isempty(Family) - Family = 'BEND'; -end -if isempty(ModeFlag) - ModeFlag = getmode(Family); -end - -if isempty(Field) - Field = 'Setpoint'; -end -if isempty(DeviceList) - DeviceList = family2dev(Family); - if all(size(Amps)==[1 1]) | isempty(Amps) - DeviceList = DeviceList(1,:); - end -end -if isempty(BranchFlag) - % Default is upper branch - BranchFlag = 2; -end -if isempty(Amps) - if strcmpi(ModeFlag,'simulator') | strcmpi(ModeFlag,'model') - % The model energy is used only if Amps is empty - % Otherwise "Maximum recursion limit" - GeV = getenergymodel; - return; - - %GeVmodel = getenergymodel; - %kmodel = getpvmodel(Family, Field, DeviceList, 'Physics'); - %Amps = k2amp(Family, Field, kmodel, DeviceList, [], 1, GeVmodel); - else - Amps = getpv(Family, Field, [1 1], 'Hardware', ModeFlag); - UnitsFlag = 'UnitsFlag'; - end -end - -% End of input checking -% Machine dependent stuff below - - -% Amps should be in hardware units -if strcmpi(UnitsFlag,'Physics') - Amps = physics2hw(Family, 'Setpoint', Amps, DeviceList); -end - -DeviceListTotal = family2dev(Family, 0); - -for ii = 1:size(DeviceList,1) - if length(Amps) == 1 - BEND = Amps; - else - BEND = Amps(ii); - end - - % Convert to energy - - temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList(ii,:)); - C = temp{1}; - - % The function/curve used here is Energy vs Current and is calculated - % from tracking studies using a 2D field map. - splitind = size(C,2)/2; - I = C(1,1:splitind); - Energy = C(1,splitind+1:end); % in GeV - gev1 = interp1(I,Energy,BEND,'linear','extrap'); - - if size(Amps,2) == 1 - GeV(ii,1) = gev1; - else - GeV(1,ii) = gev1; - end - -end - -% -% B = C(8)*BEND + C(7)*BEND.^2 + C(6)*BEND.^3 + C(5)*BEND.^4 + C(4)*BEND.^5 + C(3)*BEND.^6 + C(2)*BEND.^7 + C(1)*BEND.^8; -% % k(i,1) = polyval(C, Amps(i)) / brho; -% -% % k is fixed to be -0.31537858 -% k = -0.31537858; -% -% % Convert to BEND angle -% %K2BendingAngle = 2.54842790129284; -% if any(DeviceList(ii,1) == [1 9 10 18]) -% K2BendingAngle = 2.54842790129284 * -0.43947079695140; % BendAngle / K -% else -% K2BendingAngle = 2.54842790129284 * -0.58596106939159; % BendAngle / K -% end -% %K2BendingAngle = -0.43947079695140; % BendAngle / K -% k = K2BendingAngle * k; -% -% -% boverbprime = 0.392348; -% bprime = B / boverbprime; -% brho = bprime / k; -% -% % now return energy in GeV -% gev1 = brho / 3.33620907461447; -% -% cur = BEND; -% % Convert to energy -% -% a7= 0.0137956; -% a6=-0.0625519; -% a5= 0.1156769; -% a4=-0.1141570; -% a3= 0.0652128; -% a2=-0.0216472; -% a1= 0.0038866; -% a0= 0.0028901; -% -% i0=700.; -% c7=a7/(i0^7); -% c6=a6/(i0^6); -% c5=a5/(i0^5); -% c4=a4/(i0^4); -% c3=a3/(i0^3); -% c2=a2/(i0^2); -% c1=a1/i0; -% c0=a0; -% leff=1.5048; -% -% -% % kl = (cur/brho)*(c0+c1*cur+c2*cur^2+c3*cur^3+c4*cur^4+c5*cur^5+c6*cur^6+c7*cur^7); -% % k = kl/Leff; -% % k is fixed to be -0.31537858 -% k = -0.31537858; -% -% BLeff = cur.*(c0+c1*cur+c2*cur.^2+c3*cur.^3+c4*cur.^4+c5*cur.^5+c6*cur.^6+c7*cur.^7); -% field = BLeff / Leff; -% -% boverbprime = 0.392348; -% bprime = field / boverbprime; -% brho = bprime / k; -% -% % now return energy in GeV -% GeV = brho / 3.33620907461447; - - - +function GeV = bend2gev(varargin) +%BEND2GEV - Compute the energy based on the ramp tables +% GeV = bend2gev(Family, Field, Amps, DeviceList, BranchFlag) +% +% INPUTS +% 1. Bend - Bend magnet family {Optional} +% 2. Field - Field {Optional} +% 3. Amps - Bend magnet current +% 4. DeviceList - Bend magnet device list to reference energy to {Default: BEND(1,1)} +% 5. BranchFlag - 1 -> Lower branch +% 2 -> Upper branch {Default} +% Not working at Spear yet, since there isn't any magnet measurements on hysteresis +% +% OUTPUTS +% 1. GeV - Electron beam energy [GeV] +% +% Written by Greg Portmann +% Modified by E. Tan for ASP 31/05/2006 + +% Default +Family = ''; +Field = ''; +Amps = []; +DeviceList = []; +BranchFlag = []; + +ModeFlag = ''; % model, online, manual +UnitsFlag = ''; % hardware, physics +for i = length(varargin):-1:1 + if isstruct(varargin{i}) + % Ignor structures + elseif iscell(varargin{i}) + % Ignor cells + elseif strcmpi(varargin{i},'struct') + varargin(i) = []; + elseif strcmpi(varargin{i},'numeric') + varargin(i) = []; + elseif strcmpi(varargin{i},'physics') + UnitsFlag = 'Physics'; + varargin(i) = []; + elseif strcmpi(varargin{i},'hardware') + UnitsFlag = 'Hardware'; + varargin(i) = []; + elseif strcmpi(varargin{i},'simulator') | strcmpi(varargin{i},'model') + ModeFlag = varargin{i}; + varargin(i) = []; + elseif strcmpi(varargin{i},'online') + ModeFlag = varargin{i}; + varargin(i) = []; + elseif strcmpi(varargin{i},'manual') + ModeFlag = varargin{i}; + varargin(i) = []; + end +end + + +if length(varargin) >= 1 + if ischar(varargin{1}) + Family = varargin{1}; + varargin(1) = []; + else + Amps = varargin{1}; + varargin(1) = []; + if length(varargin) >= 1 + DeviceList = varargin{1}; + varargin(1) = []; + end + if length(varargin) >= 1 + BranchFlag = varargin{1}; + varargin(1:end) = []; + end + end +end +if length(varargin) >= 1 & ischar(varargin{1}) + Field = varargin{1}; + varargin(1) = []; +end +if length(varargin) >= 1 + Amps = varargin{1}; + varargin(1) = []; +end +if length(varargin) >= 1 + DeviceList = varargin{1}; + varargin(1) = []; +end +if length(varargin) >= 1 + BranchFlag = varargin{1}; + varargin(1) = []; +end + + +if isempty(Family) + Family = 'BEND'; +end +if isempty(ModeFlag) + ModeFlag = getmode(Family); +end + +if isempty(Field) + Field = 'Setpoint'; +end +if isempty(DeviceList) + DeviceList = family2dev(Family); + if all(size(Amps)==[1 1]) | isempty(Amps) + DeviceList = DeviceList(1,:); + end +end +if isempty(BranchFlag) + % Default is upper branch + BranchFlag = 2; +end +if isempty(Amps) + if strcmpi(ModeFlag,'simulator') | strcmpi(ModeFlag,'model') + % The model energy is used only if Amps is empty + % Otherwise "Maximum recursion limit" + GeV = getenergymodel; + return; + + %GeVmodel = getenergymodel; + %kmodel = getpvmodel(Family, Field, DeviceList, 'Physics'); + %Amps = k2amp(Family, Field, kmodel, DeviceList, [], 1, GeVmodel); + else + Amps = getpv(Family, Field, [1 1], 'Hardware', ModeFlag); + UnitsFlag = 'UnitsFlag'; + end +end + +% End of input checking +% Machine dependent stuff below + + +% Amps should be in hardware units +if strcmpi(UnitsFlag,'Physics') + Amps = physics2hw(Family, 'Setpoint', Amps, DeviceList); +end + +DeviceListTotal = family2dev(Family, 0); + +for ii = 1:size(DeviceList,1) + if length(Amps) == 1 + BEND = Amps; + else + BEND = Amps(ii); + end + + % Convert to energy + + temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList(ii,:)); + C = temp{1}; + + % The function/curve used here is Energy vs Current and is calculated + % from tracking studies using a 2D field map. + splitind = size(C,2)/2; + I = C(1,1:splitind); + Energy = C(1,splitind+1:end); % in GeV + gev1 = interp1(I,Energy,BEND,'linear','extrap'); + + if size(Amps,2) == 1 + GeV(ii,1) = gev1; + else + GeV(1,ii) = gev1; + end + +end + +% +% B = C(8)*BEND + C(7)*BEND.^2 + C(6)*BEND.^3 + C(5)*BEND.^4 + C(4)*BEND.^5 + C(3)*BEND.^6 + C(2)*BEND.^7 + C(1)*BEND.^8; +% % k(i,1) = polyval(C, Amps(i)) / brho; +% +% % k is fixed to be -0.31537858 +% k = -0.31537858; +% +% % Convert to BEND angle +% %K2BendingAngle = 2.54842790129284; +% if any(DeviceList(ii,1) == [1 9 10 18]) +% K2BendingAngle = 2.54842790129284 * -0.43947079695140; % BendAngle / K +% else +% K2BendingAngle = 2.54842790129284 * -0.58596106939159; % BendAngle / K +% end +% %K2BendingAngle = -0.43947079695140; % BendAngle / K +% k = K2BendingAngle * k; +% +% +% boverbprime = 0.392348; +% bprime = B / boverbprime; +% brho = bprime / k; +% +% % now return energy in GeV +% gev1 = brho / 3.33620907461447; +% +% cur = BEND; +% % Convert to energy +% +% a7= 0.0137956; +% a6=-0.0625519; +% a5= 0.1156769; +% a4=-0.1141570; +% a3= 0.0652128; +% a2=-0.0216472; +% a1= 0.0038866; +% a0= 0.0028901; +% +% i0=700.; +% c7=a7/(i0^7); +% c6=a6/(i0^6); +% c5=a5/(i0^5); +% c4=a4/(i0^4); +% c3=a3/(i0^3); +% c2=a2/(i0^2); +% c1=a1/i0; +% c0=a0; +% leff=1.5048; +% +% +% % kl = (cur/brho)*(c0+c1*cur+c2*cur^2+c3*cur^3+c4*cur^4+c5*cur^5+c6*cur^6+c7*cur^7); +% % k = kl/Leff; +% % k is fixed to be -0.31537858 +% k = -0.31537858; +% +% BLeff = cur.*(c0+c1*cur+c2*cur.^2+c3*cur.^3+c4*cur.^4+c5*cur.^5+c6*cur.^6+c7*cur.^7); +% field = BLeff / Leff; +% +% boverbprime = 0.392348; +% bprime = field / boverbprime; +% brho = bprime / k; +% +% % now return energy in GeV +% GeV = brho / 3.33620907461447; + + + diff --git a/machine/ASP/StorageRing/bpm_scripts/archivedoffsets/archivedoffsets.mat b/machine/ASP/StorageRing/bpm_scripts/archivedoffsets/archivedoffsets.mat new file mode 100644 index 0000000000000000000000000000000000000000..df73b856d749cfaf0d521d81b52fd83e2726bb69 GIT binary patch literal 163491 zcma%?LwF_(tf;4UJGH;swr$&;+O}=mwr$(CZQDHm)&6FcMY6~u$&)vUjDWJVfFM2# zEj_-BfHIAVxs@?BzPy#blZmZ^H7CB9w5+-SD>F5|kb|+lld%!Ltqmu>lCurIlCd2= z13f+i8z&P3CnF<1BRvBf{{N@^`F{c=A%pOrj_m{d$1UqB#hrQCa&vS#Um9})qb1JX zc5o-8?Nx8{ghDWZz_26%Cm~5VLUw%4uj~+okhsyCBR*ddaU26tgp3=J(mmUl{nY!1 zbJk=0B9_ccH8y8-oR2V)O&4|m6ngEaNGg^wJ+kBQ#M zctclg;Foitudf@&IW>Ld(eShMYb&+T^ZAPpYt%toJttN{mSVK%Rx~M8Q{gLXr7U*V z;IIdiQWz3tAtYv_prj%~xP?NfNEk8GE$~#^J0g!Fcc1C?)L4F`R{rF0uG=l@b0 z{VzRc!EDN;cH7j{l6ZJ1+j_wQ$i~7&Jy;ty4aK~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luM-Cn5ar7r}OM4aj?se1z#-ruxw0i+^RgG;0_mJI`#3l2xWqm zzDo6{em3#Sw;C?VtMm69AFA=2@ZMGe-F6@Lo6hHc=Wzu4T>1?59{%=b=KxiGU*vo6 z=*d2&pt4Wo8|A|)KR7ZuJ^iFP4xaZJ9Ft$F=2aLohpRCeM8`GfRaJbCEzaRxaPT?( zK4xaX8EQBrKgMDMud&M%>*HmQqcrr?g~#~8EKt-dox69OJD5njW9aVRu4VTpnm&?G z>){w|*k8w=`5kn6mOa3Dn==vDJD;l>-qp;X@DiD>W7|Oh(p`YPU-bhk-WEH z^EtXL?_61-#&L0#Q3}7xulY z^Qk6tk*vRdlGpxN`tO~s&zt0ntusBv+4`YLe%q>SCNR&EC?V3iAEz3OdB*Sa z)mMI&o_C@sdL2C;FUf~WO9A3km!7;p~?kRx|GOL&^cvFBJYQX*Kv3l z-w;-kqQdbBNSZ0_A^|c{RKVA2=n||KGw$ymou;GHH1ot6e5(b{jDVRN!$%__K29Az z#s)m7oUFnnEUBPcB4>K;ilTB+`|#e z-_hy+mJW2F$HpLd$;M%NiKCaS=_Om`5-|oP?t|xXQ+>+^V_biuZD1U~&wks~NG+JN zDc(IdI=3F3BS+_`*5P(`&>*T=rXBy4hx^9iVq6b%G$Q|i)7`?c$EJ1iIqx~|f8eO=!M}TXni?$IL9lTK^x+(S-kX)w$Qh8 z&cepG?{N25xN+Q$dx1W;a*}qOMq&NUp~JyA>BM?bR;6ILEl4Wv@{C4*R!6>m<&%?# z@nai-EnP-N1#S{^ey2OSoPi+OPigtS`FiW{F}547_M3)sHr1)+bgH-a^!KNzRJQ$# z4d=qcX*isQ<@Cb#(T`3(#=S1guVEzeqR0u$=qarCZ9ady4tKZWR$%>FqX&-9-z$fM uF{8^0^3*<+PbQKoY^kw(7o{$zy3Dc}VN number of +% available data then getliberatbt will only return as many +% data points as there are in the PV. +% +% Eugene +% 10-04-2007 +% 14-06-2011 Small update to the way it triggers using new BPM Event. + +if nargin > 0 && ischar(varargin{1}) + stream = varargin{1}; +else + stream = 'DD3'; +end + +if nargin > 1 && ~isempty(varargin{2}) + % User specified device list + devicelist = varargin{2}; +else + % Use default bpms + devicelist = getlist('BPMx'); +end + +if nargin > 2 && isnumeric(varargin{3}) + trigger = varargin{3}; +else + trigger = 1; +end + +if nargin > 3 && isnumeric(varargin{4}) + nelem = varargin{4}; +else + nelem = 0; +end + +if trigger + % Disable the BPM trigger event from the EVG. 0: disable, 1: + % continuous, 3: single shot. +% setpv('TS01EVG01:EVENT_02_MODE_CMD',0); +% pause(0.1); + + % read current counter then arm for a single acquisition + finished_num = getlibera([stream '_FINISHED_MONITOR'], devicelist); +% % setlibera(['DD4_ON_NEXT_TRIG_CMD'],1, devicelist); + setlibera([stream '_ON_NEXT_TRIG_CMD'],1, devicelist); + pause(1.5); + + % Get the EVR to send a trigger signal to the Liberas. + setliberatrigger(1); + + ii = 0; + temp = getlibera([stream '_FINISHED_MONITOR'],devicelist) == finished_num; + while any(temp) + pause(0.1); + temp = getlibera([stream '_FINISHED_MONITOR'],devicelist) == finished_num; + ii = ii + 1; + if ii > 60 + disp('Trigger may not be enabled for the Liberas (please check)'); + disp('The data acquisition counter did not increment for the following BPMs:'); + fprintf('[%2d %d]\n',devicelist(temp,:)'); + if nargout > 0 + varargout{1} = []; + end + + return + end + end +end + +% Convert the nm units that is Hardware into meters (physics) or nm (hardware). +if strcmpi(getunits('BPMx'),'Physics') + units_conversion = 1e-9; % in meters + unitsstr = 'm'; +else + units_conversion = 1; % hardware in nm + unitsstr = 'nm'; +end + +if strcmpi(stream,'ADC') + etime = zeros(1,4); + datatime = zeros(size(devicelist,1),4); + + [data.a etime(:,1) datatime(:,1)] = getlibera([stream '_A_MONITOR'],devicelist,0,nelem); + [data.b etime(:,2) datatime(:,2)] = getlibera([stream '_B_MONITOR'],devicelist,0,nelem); + [data.c etime(:,3) datatime(:,3)] = getlibera([stream '_C_MONITOR'],devicelist,0,nelem); + [data.d etime(:,4) datatime(:,4)] = getlibera([stream '_D_MONITOR'],devicelist,0,nelem); +elseif strcmpi(stream,'DD2') + etime = zeros(1,10); + datatime = zeros(size(devicelist,1),10); + % Try to avoid memory problems + [data.ia etime(:,1) datatime(:,1)] = getlibera([stream '_IA_MONITOR'],devicelist,0,nelem); + [data.qa etime(:,2) datatime(:,2)] = getlibera([stream '_QA_MONITOR'],devicelist,0,nelem); + [data.ib etime(:,3) datatime(:,3)] = getlibera([stream '_IB_MONITOR'],devicelist,0,nelem); + [data.qb etime(:,4) datatime(:,4)] = getlibera([stream '_QB_MONITOR'],devicelist,0,nelem); + [data.ic etime(:,5) datatime(:,5)] = getlibera([stream '_IC_MONITOR'],devicelist,0,nelem); + [data.qc etime(:,6) datatime(:,6)] = getlibera([stream '_QC_MONITOR'],devicelist,0,nelem); + [data.id etime(:,7) datatime(:,7)] = getlibera([stream '_ID_MONITOR'],devicelist,0,nelem); + [data.qd etime(:,8) datatime(:,8)] = getlibera([stream '_QD_MONITOR'],devicelist,0,nelem); + [data.MT etime(:,9) datatime(:,9)] = getlibera([stream '_MT_MONITOR'],devicelist,0,nelem); + [data.ST etime(:,10) datatime(:,10)] = getlibera([stream '_ST_MONITOR'],devicelist,0,nelem); +else + etime = zeros(1,9); + datatime = zeros(size(devicelist,1),9); + % Try to avoid memory problems + [data.tbtsum etime(:,1) datatime(:,1)] = getlibera([stream '_SUM_MONITOR'],devicelist,0,nelem); + [data.tbtx etime(:,2) datatime(:,2)] = getlibera([stream '_X_MONITOR'],devicelist,0,nelem); + data.tbtx = data.tbtx*units_conversion; + [data.tbty etime(:,3) datatime(:,3)] = getlibera([stream '_Y_MONITOR'],devicelist,0,nelem); + data.tbty = data.tbty*units_conversion; + [data.VA etime(:,4) datatime(:,4)] = getlibera([stream '_VA_MONITOR'],devicelist,0,nelem); + [data.VB etime(:,5) datatime(:,5)] = getlibera([stream '_VB_MONITOR'],devicelist,0,nelem); + [data.VC etime(:,6) datatime(:,6)] = getlibera([stream '_VC_MONITOR'],devicelist,0,nelem); + [data.VD etime(:,7) datatime(:,7)] = getlibera([stream '_VD_MONITOR'],devicelist,0,nelem); + [data.MT etime(:,8) datatime(:,8)] = getlibera([stream '_MT_MONITOR'],devicelist,0,nelem); + [data.ST etime(:,9) datatime(:,9)] = getlibera([stream '_ST_MONITOR'],devicelist,0,nelem); + + % Turn offset to try to synchronise the turns +% for i=1:size(devicelist,1) +% switch devicelist(i,1) +% case {6 7 8 9 10 11 13 14} +% data.tbtsum(i,:) = circshift(data.tbtsum(i,:),[0 -1]); +% data.tbtx(i,:) = circshift(data.tbtx(i,:),[0 -1]); +% data.tbty(i,:) = circshift(data.tbty(i,:),[0 -1]); +% data.VA(i,:) = circshift(data.VA(i,:),[0 -1]); +% data.VB(i,:) = circshift(data.VB(i,:),[0 -1]); +% data.VC(i,:) = circshift(data.VC(i,:),[0 -1]); +% data.VD(i,:) = circshift(data.VD(i,:),[0 -1]); +% case 12 +% data.tbtsum(i,:) = circshift(data.tbtsum(i,:),[0 -1]); +% data.tbtx(i,:) = circshift(data.tbtx(i,:),[0 -1]); +% data.VA(i,:) = circshift(data.VA(i,:),[0 -1]); +% data.VB(i,:) = circshift(data.VB(i,:),[0 -1]); +% data.VC(i,:) = circshift(data.VC(i,:),[0 -1]); +% data.VD(i,:) = circshift(data.VD(i,:),[0 -1]); +% end +% end +end +data.elapsed_time = sum(etime); % elapsed time to download the PV the wait is longer to ensure all the Liberas have triggered. +data.mean_datatime = mean(datatime,2); % mean data time that all the PVs have been updated, as a function of the devicelist. + +% Log status of the Libera +if isnumeric(devicelist) + % To differentiate the the booster BPMs that are currently not + % version 2.06 and don't have some of these features. + data.switches = getlibera('ENV_SWITCHES_MONITOR',devicelist,0,nelem); + data.plloffset = getlibera('ENV_PLL_OFFSETTUNE_MONITOR',devicelist,0,nelem); + data.pllcomptune = getlibera('ENV_PLL_COMPTUNE_MONITOR',devicelist,0,nelem); +end + +data.deviceList = devicelist; +data.TimeStamp = clock; +data.CreatedBy = mfilename; +data.UnitsString = unitsstr; +data.Units = getunits('BPMx'); +data.Mode = 'Online'; % By definition for now. + +varargout{1} = data; \ No newline at end of file diff --git a/machine/ASP/StorageRing/bpm_scripts/booster/plotbrdata.m b/machine/ASP/StorageRing/bpm_scripts/booster/plotbrdata.m new file mode 100644 index 00000000..8cd0ce91 --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/booster/plotbrdata.m @@ -0,0 +1,75 @@ +clear data; + +data.dd1.x = getpv('BR01BPM12:DD1_X_MONITOR'); +data.dd1.y = getpv('BR01BPM12:DD1_Y_MONITOR'); +data.dd1.sum = getpv('BR01BPM12:DD1_SUM_MONITOR'); + +data.dd3.x = getpv('BR01BPM12:DD3_X_MONITOR'); +data.dd3.y = getpv('BR01BPM12:DD3_Y_MONITOR'); +data.dd3.sum = getpv('BR01BPM12:DD3_SUM_MONITOR'); + +data.adc.A = getpv('BR01BPM12:ADC_A_MONITOR'); +data.adc.B = getpv('BR01BPM12:ADC_B_MONITOR'); +data.adc.C = getpv('BR01BPM12:ADC_C_MONITOR'); +data.adc.D = getpv('BR01BPM12:ADC_D_MONITOR'); + +data.picoscope.A = getpv('BR01PSC01:CHANNEL_A_MONITOR'); +data.picoscope.B = getpv('BR01PSC01:CHANNEL_B_MONITOR'); + +%% +figure(440); +fs = 119361788.8; +t = ((1:1024)-1)/fs * 1e6; + +subplot(2,2,1); +plot(t,data.adc.A); title('A'); +xlabel('Time (us)'); +subplot(2,2,2); +plot(t,data.adc.B); title('B'); +xlabel('Time (us)'); +subplot(2,2,3); +plot(t,data.adc.C); title('C'); +xlabel('Time (us)'); +subplot(2,2,4); +plot(t,data.adc.D); title('D'); +xlabel('Time (us)'); + +figure(441); +set(gcf,'Position',[ 24 490 1204 823]) +clf; +fs = 1.387927776744186e+06/64; 1.387991888888889e+06/64; +t = ((1:2e4)-1)/fs * 1e3; +t2 = (1:1000)/(1000) * 1e3; % NEED TO CONFIRM SAMPLE TIME of the picoscope + +h(1) = subplot(2,2,1); +plot(t,data.dd1.x*1e-3) +grid on; +ylabel('X (um)'); +xlabel('Time (ms)'); +title('BR01BPM12 (21.69 kHz)') + +h(2) = subplot(2,2,2); +plot(t,data.dd1.y*1e-3) +grid on; +ylabel('Y (um)'); +xlabel('Time (ms)'); +h(3) = subplot(2,1,2); +toffset = t2( find(data.picoscope.A < -0.1,1,'first') ); +plot(t + toffset,data.dd1.sum); +hold on; +yscale = diff(ylim); +plot(t2,(-data.picoscope.A)*yscale) +plot(t2,(data.picoscope.B)*yscale/10) +grid on; +xlabel('Time (ms)'); +legend('BPM Sum','Pico A','Pico B'); +linkaxes(h,'x') + + +figure(443); +clf; +fs = 1.387991888888889e+06; +t = ((1:1e4)-1)/fs * 1e6; + +plotyy(t,data.dd3.x,t,data.dd3.sum) +xlabel('Time (us)'); \ No newline at end of file diff --git a/machine/ASP/StorageRing/bpm_scripts/booster/setbr01bpm12.m b/machine/ASP/StorageRing/bpm_scripts/booster/setbr01bpm12.m new file mode 100644 index 00000000..6e51ab7e --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/booster/setbr01bpm12.m @@ -0,0 +1,35 @@ +setpv('BR01BPM12:ENV_AGC_SP',0); +setpv('BR01BPM12:ENV_GAIN_SP',-51); +setpv('BR01BPM12:ENV_DSC_SP',0); +setpv('BR01BPM12:ENV_TRIGDELAY_SP',0); + +% set these to zero to start triggering to get data. +fprintf('Warning: trigger turned off at the moment!!!!\n'); +setpv('BR01BPM12:ADC_IGNORE_TRIG_SP',1); +setpv('BR01BPM12:DD1_IGNORE_TRIG_SP',1); +setpv('BR01BPM12:DD2_IGNORE_TRIG_SP',1); +setpv('BR01BPM12:DD3_IGNORE_TRIG_SP',1); +setpv('BR01BPM12:DD4_IGNORE_TRIG_SP',1); + + +setpv('BR01BPM12:ADC_ON_NEXT_TRIG_CMD',1); +setpv('BR01BPM12:DD1_ON_NEXT_TRIG_CMD',1); +setpv('BR01BPM12:DD2_ON_NEXT_TRIG_CMD',1); +setpv('BR01BPM12:DD3_ON_NEXT_TRIG_CMD',1); +setpv('BR01BPM12:DD4_ON_NEXT_TRIG_CMD',0); + +setpv('BR01BPM12:DD1_MT_OFFSET_SP',0); +setpv('BR01BPM12:DD2_MT_OFFSET_SP',0); +setpv('BR01BPM12:DD3_MT_OFFSET_SP',0); +setpv('BR01BPM12:DD4_MT_OFFSET_SP',0); + +setpv('BR01BPM12:DD1_ST_OFFSET_SP',0); +setpv('BR01BPM12:DD2_ST_OFFSET_SP',0); +setpv('BR01BPM12:DD3_ST_OFFSET_SP',0); +setpv('BR01BPM12:DD4_ST_OFFSET_SP',0); + +% Seek point 0 (trigger), 1 (MT), 2 (ST) +setpv('BR01BPM12:DD1_SEEK_POINT_SP',0); +setpv('BR01BPM12:DD2_SEEK_POINT_SP',0); +setpv('BR01BPM12:DD3_SEEK_POINT_SP',0); +setpv('BR01BPM12:DD4_SEEK_POINT_SP',0); \ No newline at end of file diff --git a/machine/ASP/StorageRing/bpm_scripts/booster/setliberaconfig.m b/machine/ASP/StorageRing/bpm_scripts/booster/setliberaconfig.m new file mode 100644 index 00000000..fedeb292 --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/booster/setliberaconfig.m @@ -0,0 +1,444 @@ +function varargout = setliberaconfig(varargin) + +% SETLIBERACONFIG([deviceList | 'diag']) +% +% This function sets the default configuration for the Liberas. The +% optional parameters are: +% +% deviceList A vector of nx2 specifying which devices to configure +% 'diag' (String) configure the diagnostic BPM +% +% If no parameters are set, the configuration will be applied to all the +% liberas that are enabled in middleLayer ("aspinit"). +% +% e.g. >> setliberaconfig +% >> setliberaconfig([1 2; 1 3; 1 4; 1 5;]) +% >> setliberaconfig('diag') +% +% 13/08/0009 Eugene Added comments and modified to add deviceList options + +% 21/11/2012 Removed Topup Check as added event to topup_timing.pcf JT +% if getpv('TS01FPC01:FILL_CMD') == 7 +% % If in Topup + +% setpv('TS01EVR01:TTL01_EVENT_CODE_CMD',3); % Gun event +% else +% % Set the BPM trigger to Storage Ring BPM event +% setpv('TS01EVR01:TTL01_EVENT_CODE_CMD',13); +% end + +error('**** Need to run setliberabconfig for the Brilliance+ units ****'); + +% configure the diagnostic BPM only +if nargin > 0 && ischar(varargin{1}) && strcmpi(lower(varargin{1}),'diag') + disp('Configuring Diagnostic BPM'); + fprintf('Setting SWITCHES to 255\n'); + setlibera('ENV_SWITCHES_SP',255,[-1 -1]); + + % Digital signal conditioning + fprintf('Turning _ON_ DSC\n'); + setlibera('ENV_DSC_SP',2,[-1 -1]); + + % Auto Gain Control + fprintf('Turning _ON_ AGC\n'); + setlibera('ENV_AGC_SP',1,[-1 -1]); + + % Interlocks + fprintf('Turning _OFF_ Interlocks\n'); + setlibera('ENV_ILK_MODE_SP',0,[-1 -1]); + pause(5); + setlibera('ENV_SET_INTERLOCK_PARAM_CMD.PROC',0,[-1 -1]); + + % Setting gains on the Diag libera + fprintf('Setting Kx and Ky...\n'); + setlibera('ENV_KX_SP',14.8e6,[-1 -1]); + setlibera('ENV_KY_SP',15.1e6,[-1 -1]); + + % Setting offsets on the Diag libera + fprintf('Setting x_offset and y_offset...\n'); + setlibera('ENV_X_OFFSET_SP',-810474,[-1 -1]); + setlibera('ENV_Y_OFFSET_SP',+386743,[-1 -1]); + + fprintf('Setting Swithing Synchronisation to External'); + setlibera('ENV_EXTSWITCH_SP',1,[-1 -1]); + fprintf(' done.\n'); + + fprintf('Turning Spike Removal OFF: \n'); + setliberasr('off','off',[-1 -1]); + fprintf(' done.\n'); + + fprintf('Setting PLL offset tune to 434 units (~17 kHz): \n'); + setlibera('ENV_PLL_OFFSETTUNE_SP',434,[-1 -1]); + setlibera('ENV_PLL_COMPTUNE_SP',1,[-1 -1]); + fprintf(' done.\n'); + + return +elseif nargin > 0 && isnumeric(varargin{1}) + deviceList = varargin{1}; +else + deviceList = getlist('BPMx'); +end + +if ~(nargin > 0 && isnumeric(varargin{1})) + % If configuring for specific Liberas, its been unlikely I'd want to + % change the timing. So when specifying the deviceList don't run this + % part. + + % Set the delay. This has been optimised for topup and should also work for + % normal operation. + setliberatiming +end + +bpmstatus = getfamilydata('BPMx','Status',deviceList); + +% Switches +fprintf('Setting SWITCHES to 255\n'); +setlibera('ENV_SWITCHES_SP',255,deviceList); + +% Digital signal conditioning +fprintf('Turning _ON_ DSC\n'); +setlibera('ENV_DSC_SP',2,deviceList); + +fprintf(' Setting Libera Interlocks ... '); +% Setting HW interlock parameters +% Limits have been changed after reevaluation of raytrace information +% 18-10-2007 ET +xlimits = [-1 1]; %mm +ylimits = [-1 1]; %mm + +% Below is a list of BPMs that need the orbit interlock. Have added 2's and +% 6's as backups if the primary ones fail. [2 2; and 2 3] aer for the IR +% mirror. +templist = [ [[1:14]' ones(14,1)]; [[1:14]' ones(14,1)*7]; + [[1:14]' ones(14,1)*2]; [[1:14]' ones(14,1)*6]; [2 3] ]; +ind = findrowindex(templist,deviceList); +devlist = deviceList(sort(ind),:); +if ~isempty(devlist) + % 0 = disable; 1 = position; 3 = position and gain + setlibera('ENV_ILK_MODE_SP',0,deviceList); % turn everything else off and only turn specific ones on. + setlibera('ENV_ILK_MODE_SP',3,devlist); + setlibera('ENV_ILK_X_LOW_SP',xlimits(1)*1e6,devlist); + setlibera('ENV_ILK_X_HIGH_SP',xlimits(2)*1e6,devlist); + setlibera('ENV_ILK_Y_LOW_SP',ylimits(1)*1e6,devlist); + setlibera('ENV_ILK_Y_HIGH_SP',ylimits(2)*1e6,devlist); + setlibera('ENV_ILK_OF_LIMIT_SP',1900,devlist); + % The duration changed to match the rough duration of a standard fill + % pattern in the ring in raw ADC samples. + setlibera('ENV_ILK_OF_DUR_SP',40,devlist); +end + +% Backup interlocks (ultra conservative here) +templist = [[1:14]' ones(14,1)*2]; [[1:14]' ones(14,1)*6]; +ind = findrowindex(templist,deviceList); +devlist = deviceList(sort(ind),:); +if ~isempty(devlist) + setlibera('ENV_ILK_Y_LOW_SP',-0.5*1e6,devlist); + setlibera('ENV_ILK_Y_HIGH_SP',0.5*1e6,devlist); +end + +% IR interlock (something different from the rest) +templist = [2 2; 2 3]; +ind = findrowindex(templist,deviceList); +devlist = devlist(sort(ind),:); +if ~isempty(devlist) + setlibera('ENV_ILK_Y_LOW_SP',-0.7*1e6,devlist); + setlibera('ENV_ILK_Y_HIGH_SP',0.7*1e6,devlist); +end + +% Measured at 18.45 mA on 16/02/07 +gain_limit = [... + -26.00000000 -26.00000000 -26.00000000 -24.00000000 -24.00000000 -26.00000000 -26.00000000, ... % + -27.00000000 -30.00000000 -32.00000000 -30.00000000 -30.00000000 -30.00000000 -30.00000000, ... % + -30.00000000 -33.00000000 -34.00000000 -33.00000000 -34.00000000 -34.00000000 -34.00000000, ... % + -28.00000000 -28.00000000 -27.00000000 -28.00000000 -29.00000000 -26.00000000 -26.00000000, ... % + -27.00000000 -27.00000000 -28.00000000 -27.00000000 -27.00000000 -25.00000000 -25.00000000, ... % + -33.00000000 -33.00000000 -35.00000000 -34.00000000 -34.00000000 -29.00000000 -29.00000000, ... % + -37.00000000 -37.00000000 -38.00000000 -38.00000000 -37.00000000 -32.00000000 -32.00000000, ... % + -31.00000000 -31.00000000 -32.00000000 -32.00000000 -32.00000000 -28.00000000 -28.00000000, ... % + -29.00000000 -28.00000000 -30.00000000 -29.00000000 -30.00000000 -28.00000000 -27.00000000, ... % + -29.00000000 -30.00000000 -32.00000000 -32.00000000 -32.00000000 -29.00000000 -29.00000000, ... % + -29.00000000 -29.00000000 -30.00000000 -30.00000000 -30.00000000 -29.00000000 -31.00000000, ... % + -32.00000000 -30.00000000 -32.00000000 -33.00000000 -33.00000000 -33.00000000 -34.00000000, ... % + -27.00000000 -28.00000000 -28.00000000 -26.00000000 -27.00000000 -25.00000000 -26.00000000, ... % + -27.00000000 -26.00000000 -27.00000000 -28.00000000 -28.00000000 -28.00000000 -28.00000000, ... % +]; + +% Measured at 25 mA on 22/02/07 +gain_limit = [... + -24 -23 -23 -23 -23 -24 -24, ... % + -24 -23 -29 -28 -29 -28 -27, ... % + -31 -31 -32 -31 -32 -31 -31, ... % + -26 -27 -26 -26 -27 -23 -24, ... % + -24 -25 -26 -26 -25 -23 -23, ... % + -31 -32 -32 -31 -32 -27 -26, ... % + -35 -34 -36 -35 -35 -30 -30, ... % + -29 -28 -29 -30 -28 -26 -26, ... % + -26 -26 -28 -26 -27 -27 -25, ... % + -26 -28 -29 -29 -30 -26 -26, ... % + -26 -27 -28 -27 -27 -28 -29, ... % + -29 -29 -29 -31 -30 -31 -32, ... % + -25 -26 -26 -24 -24 -23 -24, ... % + -26 -24 -26 -26 -26 -26 -26, ... % + ]; + +% Measured at 26.7 mA on 17/11/2008 +% Changed thresholds for sector 7 after move. Cable attenuation reduced by +% 6 dB. ET 2/8/2009 +gain_limit = [... + -23 -22 -23 -21 -21 -23 -23, ... % + -23 -22 -29 -27 -28 -27 -27, ... % + -29 -29 -31 -30 -31 -31 -31, ... % + -25 -26 -26 -26 -26 -22 -22, ... % + -23 -24 -25 -24 -23 -22 -21, ... % + -30 -30 -32 -31 -31 -27 -26, ... % + [-33 -33 -34 -34 -33 -29 -29]+6, ... % + -28 -28 -29 -29 -28 -26 -24, ... % + -26 -25 -27 -26 -27 -26 -23, ... % + -26 -28 -29 -29 -29 -26 -26, ... % + -26 -26 -27 -27 -27 -28 -26, ... % + -28 -28 -29 -30 -30 -30 -30, ... % + -24 -25 -25 -23 -23 -22 -23, ... % + -24 -23 -24 -25 -25 -26 -25, ... % + ]; +% However as the AGC is slow to respond the gain limits should be put at a +% lower level comparable to + +% Ensure that a column vector is passed to setlibera. +temp = gain_limit(dev2elem('BPMx',deviceList)); +setlibera('ENV_ILK_GAIN_LIMIT_SP',temp(:),deviceList); +% Apply changes. This also resets the orbit interlock status PV. +setlibera('ENV_SET_INTERLOCK_PARAM_CMD',1,deviceList); + +% Acknowledge all interlocks +setlibera('ENV_INTERLOCK_CLEAR_CMD.PROC',1,deviceList); + +fprintf(' done.\n'); + +% As of 22/09/2011 Software orbit interlock has been removed. Eugene +% fprintf(' Disabling software orbit interlock...'); +% for i=[1 2 3 4 5 6 7 8 9 10 11 12 13 14] +% try +% setpv(sprintf('SR%02dOI01:INHIBIT_ENABLE_CMD.DISP',i),0); +% pause(0.01); +% setpv(sprintf('SR%02dOI01:INHIBIT_ENABLE_CMD',i),1); +% catch +% end +% end; +% fprintf(' done.\n'); + + +fprintf(' Setting Libera Gain ... '); +K = [14.593 14.648]; +libera_gain_x = [ ... + +0.966948080 +0.959619910 +0.959120392 +0.959046416 +0.958646839 +0.970136269 +0.989077507, ... % + +0.962305519 +1.000000000 +0.972453818 +0.973353564 +0.968318612 +0.974381125 +0.950104340, ... % + +0.955556319 +0.967719387 +0.981479354 +0.967697565 +0.974265951 +0.974843991 +0.960286102, ... % + +0.955195998 +0.962080805 +0.966617065 +0.963776590 +1.000000000 +0.962251920 +0.950797707, ... % + +0.962338934 +0.960510260 +1.000000000 +0.963476055 +0.955816561 +0.970940062 +0.970461463, ... % + +0.978357029 +0.960498444 +0.978981418 +0.975108996 +0.967525095 +1.000000000 +0.995110939, ... % + +1.008955830 +0.981430592 +1.000000000 +0.975632632 +0.983720220 +0.965493949 +0.968582952, ... % + +0.961121710 +0.966910076 +0.961221400 +0.980075750 +0.965634395 +0.965313494 +0.955373284, ... % + +0.970222644 +0.965991662 +0.962625146 +0.966684034 +1.000000000 +0.959439683 +0.957108540, ... % + +0.963204585 +0.966602116 +0.984932228 +0.968120932 +0.972003650 +0.973590996 +0.979101961, ... % + +0.952306249 +1.000000000 +0.964035998 +0.974901575 +0.985506540 +0.968637792 +0.982478924, ... % + +0.983423472 +0.971033202 +0.968951290 +0.974224051 +0.981495416 +0.975066573 +0.965662919, ... % + +0.962029114 +0.959208439 +0.967355776 +0.967418693 +0.971780196 +1.000000000 +0.957020986, ... % + +0.976673428 +0.973211075 +0.964885897 +0.968629156 +0.960083213 +0.959900844 +0.945449626, ... % + ]'; +libera_gain_y = [ ... + +0.948742740 +0.938985980 +0.947990664 +0.946717526 +0.943606693 +0.948187874 +0.919157421, ... % + +0.942776941 +1.000000000 +0.946087417 +0.956274522 +0.947370487 +0.949872141 +0.946387610, ... % + +0.939869535 +0.954926521 +0.956387595 +0.949416686 +0.953505592 +0.953622843 +0.954557915, ... % + +0.945121854 +0.952457360 +0.947382619 +0.941596137 +1.000000000 +0.936874260 +0.928534297, ... % + +0.942307791 +0.945010554 +1.000000000 +0.946576270 +0.946095974 +0.940937320 +0.940093187, ... % + +0.939533330 +0.948664068 +0.953825209 +0.952652917 +0.956446497 +1.000000000 +0.921532602, ... % + +0.959464550 +0.950304327 +1.000000000 +0.953212616 +0.958565862 +0.947571387 +0.946256864, ... % + +0.947723060 +0.946544009 +0.945606560 +0.962324655 +0.953574090 +0.949310515 +0.946090734, ... % + +0.950022254 +0.933364762 +0.943970019 +0.952200155 +1.000000000 +0.935012402 +0.943822892, ... % + +0.948076061 +0.948695079 +0.955976906 +0.949857838 +0.946005079 +0.948099472 +0.998813326, ... % + +0.936645213 +1.000000000 +0.938436145 +0.951387541 +0.970085370 +0.943411291 +0.943139410, ... % + +0.955283538 +0.949711620 +0.952274079 +0.958000353 +0.953091159 +0.941295894 +0.948895146, ... % + +0.942522818 +0.936837423 +0.944267089 +0.940357974 +0.947760848 +1.000000000 +0.921421809, ... % + +0.925439928 +0.938130282 +0.942509420 +0.951921198 +0.942846824 +0.946266672 +0.951273619, ... % + ]'; +% 16/02/2007 +libera_gain_x = [ ... + +0.98065084 +0.96332305 +0.96462458 +0.97356900 +0.96644755 +0.98972762 +0.99803758, ... % + +0.97381483 +1.00000000 +0.97937956 +0.98981618 +0.98112604 +0.98608984 +0.95923814, ... % + +0.95555632 +0.97971727 +1.00418594 +0.97887852 +0.98570080 +0.99278104 +0.97781389, ... % + +0.96079200 +0.97471975 +0.96661706 +0.97214864 +1.04170927 +0.96953238 +0.94940742, ... % + +0.97111888 +0.96728025 +1.04651477 +0.97728357 +0.96134764 +0.97719961 +0.98916880, ... % + +1.00224357 +0.97100221 +0.99091069 +0.99486417 +0.98754895 +1.03052325 +1.00773195, ... % + +1.03127963 +1.01229856 +1.03881681 +0.99565998 +1.01411043 +0.97823481 +0.98682531, ... % + +0.96897460 +0.97478013 +0.96496404 +1.00582362 +0.97265235 +0.97059168 +0.96498306, ... % + +0.98836325 +0.97360393 +0.96967122 +0.97685603 +1.04347456 +0.96842185 +0.96794714, ... % + +0.96987239 +0.97460713 +1.01118380 +0.98267390 +0.98871913 +0.99071220 +1.00808455, ... % + +0.94231696 +1.04594128 +0.97280204 +0.99082037 +1.00855885 +0.98444284 +1.01422470, ... % + +1.03416337 +0.97676445 +0.98023853 +1.00049481 +1.00887827 +0.99040517 +0.98213874, ... % + +0.97292523 +0.96235993 +0.97823893 +0.97860437 +0.98810766 +1.03935436 +0.96070000, ... % + +0.98200130 +0.98785254 +0.95847647 +0.97832909 +0.95822393 +0.96253495 +0.95473355, ... % +]'; +libera_gain_y = [ ... + +0.97309509 +0.95609923 +0.96630216 +0.96348775 +0.95850788 +0.96687943 +0.91988411, ... % + +0.95833878 +1.00000000 +0.96101345 +0.97624167 +0.96241716 +0.96955358 +0.96275598, ... % + +0.93986954 +0.97532650 +0.97840062 +0.96031310 +0.97333007 +0.97804858 +0.97561475, ... % + +0.96234509 +0.97390607 +0.94738262 +0.95395284 +1.07350723 +0.94489729 +0.93738772, ... % + +0.95643798 +0.95852768 +1.06902251 +0.96104282 +0.95822695 +0.95902437 +0.95678273, ... % + +0.95319748 +0.96729898 +0.97248842 +0.96621831 +0.97749538 +1.07041318 +0.92861579, ... % + +1.00004803 +0.97045198 +1.07282384 +0.96641823 +0.98364057 +0.96840075 +0.96511461, ... % + +0.96646593 +0.96477837 +0.95773646 +0.98867225 +0.97471819 +0.96884309 +0.96058673, ... % + +0.96605015 +0.93746399 +0.95458147 +0.97029753 +1.07443478 +0.94686388 +0.95509890, ... % + +0.96180766 +0.96899984 +0.97873461 +0.96592276 +0.96368095 +0.96553179 +1.07651530, ... % + +0.94872454 +1.07492964 +0.95261031 +0.96855645 +1.00765275 +0.94137132 +0.94387467, ... % + +0.96791978 +0.97084230 +0.96651960 +0.98027098 +0.97387417 +0.95433885 +0.97518112, ... % + +0.95650968 +0.94694534 +0.95358627 +0.94820797 +0.96586596 +1.07797176 +0.92007440, ... % + +0.93155173 +0.95037365 +0.95099987 +0.96492413 +0.95059941 +0.95620621 +0.95743179, ... % +]'; + +% setlibera('ENV_KX_SP',K(1).*libera_gain_x(find(bpmstatus))*1e6); +% setlibera('ENV_KY_SP',K(2).*libera_gain_y(find(bpmstatus))*1e6); + +% 9-3-2008 Eugenee: Make gains uniform for now. This needs to be revisited +setlibera('ENV_KX_SP',14.8e6,deviceList); +setlibera('ENV_KY_SP',15.1e6,deviceList); + +fprintf(' done.\n'); + + +% With the new I-Tech epics driver commissioning we need to make sure +% certain features are turned off first. +% fprintf('\nSetting Gains\n'); +setgains('auto',deviceList); + +fprintf('Setting Swithing Synchronisation to External'); +setlibera('ENV_EXTSWITCH_SP',1,deviceList); +fprintf(' done.\n'); + +fprintf('Turning Spike Removal OFF: \n') +setliberasr('off','off',deviceList); +fprintf(' done.\n'); + +% 30/03/2016 Eugene change default offset tuning from 125 to 110, to shift +% the major noise peaks to above 500 Hz. +% 31/03/2016 Eugene: further investigation showed pll offset = 434 was +% better still. +fprintf('Setting PLL offset tune to 434 units (17.36 kHz): \n'); +setlibera('ENV_PLL_OFFSETTUNE_SP',434,deviceList); +setlibera('ENV_PLL_COMPTUNE_SP',1,deviceList); +fprintf(' done.\n'); + +% Libera synchronisation MUST be after setting the PLL tune and offset +% tune. +fprintf('Machine time INITIALISATION (will take 5 seconds)') +setliberasync(deviceList); +fprintf(' done.\n'); + + + +fprintf('-------------[ BR Libera ]-------------\n') +try + setliberabr; +catch + lasterr +end +fprintf('-------------[ LTB/BTS Libera ]-------------\n') +try + setliberaconfig_tl; +catch + lasterr +end + +% temporary +fprintf('*** TEMP PV CORRECTIONS (FANS) ***\n'); +% deviceList = getlist('BPMx'); +setlibera('ENV_FRONT_VENT_ACT_MONITOR.HIHI',5500,deviceList); +setlibera('ENV_FRONT_VENT_ACT_MONITOR.LOLO',3500,deviceList); +setlibera('ENV_FRONT_VENT_ACT_MONITOR.HIGH',5500,deviceList); +setlibera('ENV_FRONT_VENT_ACT_MONITOR.LOW',3500,deviceList); +setlibera('ENV_BACK_VENT_ACT_MONITOR.HIHI',5500,deviceList); +setlibera('ENV_BACK_VENT_ACT_MONITOR.LOLO',3500,deviceList); +setlibera('ENV_BACK_VENT_ACT_MONITOR.HIGH',5500,deviceList); +setlibera('ENV_BACK_VENT_ACT_MONITOR.LOW',3500,deviceList); + +fprintf('*** TEMP PV CORRECTIONS (DD seek point and Ignore trig) ***\n'); +% deviceList = getlist('BPMx'); +setlibera('DD1_SEEK_POINT_SP',0,deviceList); +setlibera('DD2_SEEK_POINT_SP',0,deviceList); +setlibera('DD3_SEEK_POINT_SP',0,deviceList); +setlibera('DD4_SEEK_POINT_SP',0,deviceList); +setlibera('DD5_SEEK_POINT_SP',0,deviceList); + +setlibera('ADC_IGNORE_TRIG_SP',0,deviceList); +setlibera('DD1_IGNORE_TRIG_SP',0,deviceList); +setlibera('DD2_IGNORE_TRIG_SP',1,deviceList); +setlibera('DD3_IGNORE_TRIG_SP',0,deviceList); +setlibera('DD4_IGNORE_TRIG_SP',1,deviceList); +setlibera('DD5_IGNORE_TRIG_SP',0,deviceList); + + +return + + + + + + + + +% Set to 1 to set the attenuation factors for the liberas. Refer to the +% attenuation table below to determine exactly what attenuations are used. +setLiberaAttenuation = 0; + +if setLiberaAttenuation + fprintf(' Setting Libera Attenuation ... '); + + [pin att1_list att2_list] = textread('libera_attn_table3.txt','%d %d %d','headerlines',1); + + BPMcableattenuation = [... + -6.6500 -5.9750 -5.9250 -5.6000 -5.4500 -6.3750 -6.3750, ... % Sector 1 + -6.8250 -6.5000 -12.2750 -11.9500 -11.5250 -10.9000 -10.8250, ... % 2 + -13.3750 -13.5750 -14.8250 -14.4000 -14.3250 -14.7750 -14.8000, ... % 3 + -9.4250 -9.3500 -10.8500 -10.4250 -10.4000 -5.9000 -5.9000, ... % 4 + -7.1000 -7.0000 -8.4000 -7.9000 -7.8000 -5.4000 -5.4750, ... % 5 + -13.7750 -13.7150 -15.3250 -14.8250 -14.7000 -10.3000 -10.3000, ... % 6 + -16.6650 -16.5225 -18.1550 -17.7575 -17.3075 -12.7400 -12.7125, ... % 7 + -11.9150 -11.5875 -13.0550 -12.5450 -12.3350 -9.0550 -9.1575, ... % 8 + -10.0225 -9.7075 -11.0775 -10.7075 -10.6400 -8.6800 -8.4350, ... % 9 + -11.4725 -11.3575 -12.4475 -12.1825 -11.9750 -9.6700 -9.6575, ... %10 + -9.9525 -9.7900 -10.6475 -10.5100 -10.4750 -11.5050 -11.5725, ... %11 + -12.9225 -12.6525 -14.0425 -13.6075 -13.4225 -14.1350 -14.0025, ... %12 + -8.7000 -8.8750 -8.3250 -7.7250 -7.4200 -6.4150 -6.5250, ... %13 + -8.0925 -7.7950 -9.0725 -8.5625 -8.4475 -9.2050 -9.2225, ... %14 + ]; + + % Beam power -12 dBm at 70.0 mA --> mean(getam('FTx', 'Maxadc')) = 1312. + % Beam power -14 dBm at 49.8 mA --> mean(getam('FTx', 'Maxadc')) = 1319. + % Beam power -15 dBm at 45.5 mA --> mean(getam('FTx', 'Maxadc')) = 1384. + % Beam power -17 dBm at 35.0 mA --> mean(getam('FTx', 'Maxadc')) = 1306. + % Beam power -18 dBm at 32.4 mA --> mean(getam('FTx', 'Maxadc')) = 1345. + % Beam power -19 dBm at 29.7 mA --> mean(getam('FTx', 'Maxadc')) = 1356. + + % With an even fill the maximum ADC values have decreased a lot to get + % the same signal level as before we need to apply a factor of 0.11 +% beam_power = fix(getam('DCCT')*0.11/3 - 28); + beam_power = fix(110*0.11/3 - 28); + beam_power = -20; + + power_into_libera = beam_power + BPMcableattenuation; + + bpmstatus = getfamilydata('BPMx','Status'); + setlibera('ENV_GAIN_SP',round(power_into_libera(find(bpmstatus)))'); + +% att1 = zeros(size(family2dev('BPMx',0),1)); +% att2 = att1; +% for i=1:length(power_into_libera) +% att1(i) = interp1(pin,att1_list,power_into_libera(i),'nearest'); +% att2(i) = interp1(pin,att2_list,power_into_libera(i),'nearest'); +% end +% +% bpmstatus = getfamilydata('BPMx','Status'); +% setlibera('CF_ATT1_S_SP',att1(find(bpmstatus))); +% setlibera('CF_ATT2_S_SP',att2(find(bpmstatus))); + + fprintf(' done.\n'); +end diff --git a/machine/ASP/StorageRing/bpm_scripts/functionSignatures.json b/machine/ASP/StorageRing/bpm_scripts/functionSignatures.json new file mode 100644 index 00000000..b4760f74 --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/functionSignatures.json @@ -0,0 +1,197 @@ +{ +"srbpm.getfield": +{ + "inputs": + [ + {"name":"field", "kind":"required", "type":"choices={ +'SA_X_MONITOR', +'SA_Y_MONITOR', +'AGC_ATT_MONITOR', +'AGC_POWER_LEVEL_MONITOR', +'AGC_ENABLED_STATUS', +'AGC_ENABLED_CMD', +'AGC_ATT_SP', +'AGC_POWER_LEVEL_SP', +'DSC_COEFF_ADJUST_STATUS', +'DSC_COEFF_ATT_DEPENDENT_STATUS', +'SWITCHING_DELAY_MONITOR', +'SWITCHING_ENABLE_STATUS', +'SWITCHING_SOURCE_STATUS', +'DSC_COEFF_TYPE_STATUS', +'DSC_COEFF_ADJUST_CMD', +'DSC_COEFF_ADJUST_CMD', +'DSC_COEFF_ATT_DEPENDENT_CMD', +'DSC_COEFF_ATT_DEPENDENT_CMD', +'SWITCHING_ENABLE_CMD', +'SWITCHING_ENABLE_CMD', +'SWITCHING_SOURCE_CMD', +'SWITCHING_SOURCE_CMD', +'DSC_COEFF_TYPE_CMD', +'DSC_COEFF_TYPE_CMD', +'SWITCHING_DELAY_SP', +'ILK_ENABLED_STATUS', +'ILK_GAIN_DEPENDENT_ENABLED_STATUS', +'ILK_GAIN_DEPENDENT_THRESHOLD_MONITOR', +'ILK_GAIN_DEPENDENT_THRESHOLD_DB_MONITOR', +'ILK_LIMITS_MIN_X_MONITOR', +'ILK_LIMITS_MIN_Y_MONITOR', +'ILK_LIMITS_MAX_X_MONITOR', +'ILK_LIMITS_MAX_Y_MONITOR', +'ILK_LIMITS_OVF_THRESHOLD_MONITOR', +'ILK_LIMITS_OVF_MODE_STATUS', +'ILK_LIMITS_OVF_DURATION_MONITOR', +'ILK_STATUS_X_STATUS', +'ILK_STATUS_RESET_CMD', +'ILK_STATUS_ATTENUATOR_STATUS', +'ILK_STATUS_STATUS', +'ILK_STATUS_Y_STATUS', +'ILK_LIMITS_MAX_X_SP', +'ILK_LIMITS_MIN_Y_SP', +'ILK_LIMITS_MAX_Y_SP', +'ILK_LIMITS_MIN_X_SP', +'ILK_STATUS_RESET_CMD', +'ILK_ENABLED_CMD', +'ILK_GAIN_DEPENDENT_ENABLED_CMD', +'ILK_GAIN_DEPENDENT_ENABLED_CMD', +'ILK_GAIN_DEPENDENT_THRESHOLD_SP', +'ILK_LIMITS_OVF_DURATION_SP', +'ILK_LIMITS_OVF_THRESHOLD_SP', +'KX_MONITOR', +'KY_MONITOR', +'OFF_X_MONITOR', +'OFF_Y_MONITOR', +'OFF_S_MONITOR', +'OFF_Q_MONITOR', +'KS_MONITOR', +'MAXADC_MONITOR', +'OFF_S_SP', +'OFF_Q_SP', +'OFF_Y_SP', +'OFF_X_SP', +'KX_SP', +'KS_SP', +'KY_SP', +'STAT_SA_X_MEAN_MONITOR', +'STAT_SA_Y_MEAN_MONITOR', +'STAT_SA_Y_STD_MONITOR', +'STAT_SA_X_STD_MONITOR', +'STAT_TBT_Y_MEAN_MONITOR', +'STAT_TBT_Y_STD_MONITOR', +'STAT_TBT_X_STD_MONITOR', +'STAT_TBT_X_MEAN_MONITOR', +'STAT_TBT_MODE_STATUS', +'STAT_TBT_PERIOD_MONITOR', +'STAT_TBT_WINDOW_MONITOR', +'STAT_TBT_MODE_CMD', +'STAT_TBT_PERIOD_SP', +'STAT_TBT_WINDOW_SP', +'STAT_SA_WINDOW_MONITOR', +'STAT_SA_STEP_MONITOR', +'STAT_SA_WINDOW_SP', +'STAT_SA_STEP_SP', +'ID_MONITOR', +'ID_SP', +'TDP_SYNTH_SIGNAL.X', +'TDP_SYNTH_SIGNAL.Y', +'TDP_SYNTH_SIGNAL.Sum', +'TDP_SYNTH_SIGNAL.Va', +'TDP_SYNTH_SIGNAL.Vb', +'TDP_SYNTH_SIGNAL.Vc', +'TDP_SYNTH_SIGNAL.Vd', +'TDP_SYNTH_SIGNAL.SCAN', +'TDP_SYNTH_SIGNAL.ACQM', +'TDP_SYNTH_SIGNAL.MT', +'ADC_SIGNAL.SCAN', +'ADC_SIGNAL.ACQM', +'ADC_SIGNAL.ChannelB', +'ADC_SIGNAL.ChannelA', +'ADC_SIGNAL.ChannelD', +'ADC_SIGNAL.ChannelC', +'EVRX_PLL_LOCKED_STATUS', +'EVRX_PLL_MAX_ERR_MONITOR', +'EVRX_PLL_OS_UNLOCK_TIME_MONITOR', +'SYNC_ST_M_STATUS', +'GDX_SYNC_STATUS', +'EVRX_RTC_MC_IN_MASK_MONITOR', +'EVRX_RTC_MC_IN_FUNCTION_MONITOR', +'EVRX_TRIGGERS_MC_SOURCE_STATUS', +'EVRX_EVENTS_MC_COUNT_MONITOR', +'EVRX_RTC_T0_IN_MASK_MONITOR', +'EVRX_RTC_T0_IN_FUNCTION_MONITOR', +'EVRX_TRIGGERS_T0_SOURCE_STATUS', +'EVRX_EVENTS_T0_COUNT_MONITOR', +'EVRX_RTC_T1_IN_MASK_MONITOR', +'EVRX_RTC_T1_IN_FUNCTION_MONITOR', +'EVRX_TRIGGERS_T1_SOURCE_STATUS', +'EVRX_EVENTS_T1_COUNT_MONITOR', +'EVRX_RTC_T2_IN_MASK_MONITOR', +'EVRX_RTC_T2_IN_FUNCTION_MONITOR', +'EVRX_TRIGGERS_T2_SOURCE_STATUS', +'EVRX_EVENTS_T2_COUNT_MONITOR', +}"} + ] +} +, +"srbpm.setfield": +{ + "inputs": + [ + {"name":"field", "kind":"required", "type":"choices={ +'AGC_ENABLED_CMD', +'AGC_ATT_SP', +'AGC_POWER_LEVEL_SP', +'DSC_COEFF_ADJUST_CMD', +'DSC_COEFF_ADJUST_CMD', +'DSC_COEFF_ATT_DEPENDENT_CMD', +'DSC_COEFF_ATT_DEPENDENT_CMD', +'SWITCHING_ENABLE_CMD', +'SWITCHING_ENABLE_CMD', +'SWITCHING_SOURCE_CMD', +'SWITCHING_SOURCE_CMD', +'DSC_COEFF_TYPE_CMD', +'DSC_COEFF_TYPE_CMD', +'SWITCHING_DELAY_SP', +'ILK_LIMITS_MAX_X_SP', +'ILK_LIMITS_MIN_Y_SP', +'ILK_LIMITS_MAX_Y_SP', +'ILK_LIMITS_MIN_X_SP', +'ILK_ENABLED_CMD', +'ILK_GAIN_DEPENDENT_ENABLED_CMD', +'ILK_GAIN_DEPENDENT_ENABLED_CMD', +'ILK_GAIN_DEPENDENT_THRESHOLD_SP', +'ILK_LIMITS_OVF_DURATION_SP', +'ILK_LIMITS_OVF_THRESHOLD_SP', +'OFF_S_SP', +'OFF_Q_SP', +'OFF_Y_SP', +'OFF_X_SP', +'KX_SP', +'KS_SP', +'KY_SP', +'STAT_TBT_MODE_CMD', +'STAT_TBT_PERIOD_SP', +'STAT_TBT_WINDOW_SP', +'STAT_SA_WINDOW_SP', +'STAT_SA_STEP_SP', +'ID_SP', +'TDP_SYNTH_SIGNAL.X', +'TDP_SYNTH_SIGNAL.Y', +'TDP_SYNTH_SIGNAL.Sum', +'TDP_SYNTH_SIGNAL.Va', +'TDP_SYNTH_SIGNAL.Vb', +'TDP_SYNTH_SIGNAL.Vc', +'TDP_SYNTH_SIGNAL.Vd', +'TDP_SYNTH_SIGNAL.SCAN', +'TDP_SYNTH_SIGNAL.ACQM', +'TDP_SYNTH_SIGNAL.MT', +'ADC_SIGNAL.SCAN', +'ADC_SIGNAL.ACQM', +'ADC_SIGNAL.ChannelB', +'ADC_SIGNAL.ChannelA', +'ADC_SIGNAL.ChannelD', +'ADC_SIGNAL.ChannelC', +'', +}"} + ] +} +} diff --git a/machine/ASP/StorageRing/bpm_scripts/generatefunctionSignatures.m b/machine/ASP/StorageRing/bpm_scripts/generatefunctionSignatures.m new file mode 100644 index 00000000..2af7562d --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/generatefunctionSignatures.m @@ -0,0 +1,66 @@ +fid = fopen('functionSignatures.json','w'); + +fprintf(fid,'{\n'); % open object + +fprintf(fid,'"srbpm.getfield":\n'); +fprintf(fid,'{\n'); +fprintf(fid,' "inputs":\n'); +fprintf(fid,' [\n'); +fprintf(fid,' {"name":"field", "kind":"required", "type":"choices={\n'); + +pvfid = fopen('tlibera_brilliance_bpm_form_20180720_155855.txt','r'); +C = textscan(pvfid,'%s%s\n','CommentStyle','#','Whitespace',' \b\t:'); +fclose(pvfid); +fprintf(fid,'''%s'',\n',string(C{2})); + +addpvs = [ + "EVRX_PLL_LOCKED_STATUS" + "EVRX_PLL_MAX_ERR_MONITOR" + "EVRX_PLL_OS_UNLOCK_TIME_MONITOR" + "SYNC_ST_M_STATUS" + "GDX_SYNC_STATUS" + "EVRX_RTC_MC_IN_MASK_MONITOR" + "EVRX_RTC_MC_IN_FUNCTION_MONITOR" + "EVRX_TRIGGERS_MC_SOURCE_STATUS" + "EVRX_EVENTS_MC_COUNT_MONITOR" + "EVRX_RTC_T0_IN_MASK_MONITOR" + "EVRX_RTC_T0_IN_FUNCTION_MONITOR" + "EVRX_TRIGGERS_T0_SOURCE_STATUS" + "EVRX_EVENTS_T0_COUNT_MONITOR" + "EVRX_RTC_T1_IN_MASK_MONITOR" + "EVRX_RTC_T1_IN_FUNCTION_MONITOR" + "EVRX_TRIGGERS_T1_SOURCE_STATUS" + "EVRX_EVENTS_T1_COUNT_MONITOR" + "EVRX_RTC_T2_IN_MASK_MONITOR" + "EVRX_RTC_T2_IN_FUNCTION_MONITOR" + "EVRX_TRIGGERS_T2_SOURCE_STATUS" + "EVRX_EVENTS_T2_COUNT_MONITOR" + ]; +fprintf(fid,'''%s'',\n',addpvs); + +fprintf(fid,'}"}\n'); +fprintf(fid,' ]\n'); +fprintf(fid,'}\n'); + +fprintf(fid,',\n'); + +fprintf(fid,'"srbpm.setfield":\n'); +fprintf(fid,'{\n'); +fprintf(fid,' "inputs":\n'); +fprintf(fid,' [\n'); +fprintf(fid,' {"name":"field", "kind":"required", "type":"choices={\n'); + +% Same as before but remove all monitors and status PVs as these cannot be +% set +fprintf(fid,'''%s'',\n',string( C{2}( ~contains(C{2},'MONITOR') & ~contains(C{2},'STATUS') ) )); +fprintf(fid,'''%s'',\n',addpvs( ~contains(addpvs,'MONITOR') & ~contains(addpvs,'STATUS') )); + +fprintf(fid,'}"}\n'); +fprintf(fid,' ]\n'); +fprintf(fid,'}\n'); + + + +fprintf(fid,'}\n'); % Close object + +fclose(fid); \ No newline at end of file diff --git a/machine/ASP/StorageRing/bpm_scripts/getbpmaverages.m b/machine/ASP/StorageRing/bpm_scripts/getbpmaverages.m new file mode 100644 index 00000000..ec4e7a8a --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/getbpmaverages.m @@ -0,0 +1,32 @@ +function [N, T] = getbpmaverages(varargin) +%GETBPMAVERAGES - Gets the BPM averages +% [N, T] = getbpmaverages +% N = Number of averages +% T = Sampling period after averaging [seconds] +% +% In Simlutor mode, N = 1 and T = 0 +% +% This is used by MML to determine the delays required for fresh BPM data. + +Mode = getfamilydata('BPMx','Monitor','Mode'); +if strcmpi(Mode,'Simulator') + + N = 1; + T = 0; + +else + + % Libera update period, T, should be around 0.1 s but for added + % security we'll use something larger. This value is important as the + % use of WaitFlags = -2 will use this time period to wait for the BPMs + % to update with new data. + % changed to 0.1 from 0.3 ET 02-11-2009 + % Changed back from 0.1 to 0.3 ET 03/02/2017 + T = 0.3; + % N is supposed to signify how many samples are averaged over to get + % the resulting BPM position. With Liberas this is not so clear cut so + % for now will use 5000. + % 27-07-2006 Eugene + N = 5000; + +end diff --git a/machine/ASP/StorageRing/bpm_scripts/getliberadata.m b/machine/ASP/StorageRing/bpm_scripts/getliberadata.m new file mode 100644 index 00000000..c518542c --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/getliberadata.m @@ -0,0 +1,161 @@ +function varargout = getliberadata(varargin) +% +% data = getliberadata(STREAM, [DEVICELIST, TRIG_ACQUIRE, NUMSAMPLES]) +% +% STREAM = libera stream e.g. 'DD1' 'DD3'. (default = 'DD3') +% * ADC_SIGNAL - RAW ADC acquired data +% * TBT_TBT_WINDOW_SIGNAL - ADC points used to compute TBT data +% * DDC_RAW_SIGNAL - amplitude and phase data +% * DDC_SYNTH_SIGNAL - down converted x and y data +% * TDP_SYNTH_SIGNAL - time domain converted x and y data +% * PM_DDC_SYNTH_SIGNAL - post mortem data +% DEVICELIST = devicelist, [] will use all devices returned by +% getlist('BPMx'). (default = []) +% TRIG_ACQUIRE = this will get the liberas to acquire fresh data. Currently +% defaults to on trigger with whatever offsets loaded into +% the libera. '0' to not acquire fresh data while '1' will +% refresh the data. (default = 0) +% NUMSAMPLES = number of samples to return. If NUMSAMPLES > number of +% available data then getliberabtbt will only return as many +% data points as there are in the PV. +% +% Examples +% +% >> d = getliberadata('TDP_SYNTH'); +% >> d = getliberadata('TDP_SYNTH',[],1); % Collect from all bpms and apply trigger (SR BPM trigger) +% +% Eugene +% 10-04-2007 +% 14-06-2011 Small update to the way it triggers using new BPM Event. +% 06-09-2017 ET updated for libera Brilliance +% + + + + +if nargin > 0 && ischar(varargin{1}) + stream = [varargin{1}]; +else + stream = 'TDP_SYNTH_SIGNAL'; +end + +if nargin > 1 && ~isempty(varargin{2}) + % User specified device list + devicelist = varargin{2}; +else + % Use default bpms + devicelist = getlist('BPMx'); +end +if size(devicelist,2) == 1 + % assume user has used element number instead + devicelist = elem2dev('BPMx',devicelist); +end + +if nargin > 2 && isnumeric(varargin{3}) + trigger = varargin{3}; +else + trigger = 0; +end + +if nargin > 3 && isnumeric(varargin{4}) + nelem = varargin{4}; +else + nelem = 0; +end + + +% No need for trigger for PM data +if trigger && ~(strcmpi(stream,'PM_DDC_SYNTH_SIGNAL') || strcmpi(stream,'PM_DDC_RAW_SIGNAL')) + % We will assume here that there is no trigger being sent to the bpm. + % Also assume the first in the devicelist as a representative of the + % rest that it is receiving the trigger and updating data. + if strncmp(stream,'ADC_SIGNAL',3) + timestampfield = [stream '.LMT']; + else + timestampfield = [stream '.MT' ]; + end + mt0 = srbpm.getfield(timestampfield,devicelist(1,:)); + pause(0.1); + + % TBT_TBT_WINDOW needs to be proc'ed however there is no valid MT data + % to compare to see if there is fresh data. + if ~strcmpi(stream,'TBT_TBT_WINDOW_SIGNAL') + % Get the EVR to send a trigger signal to the Liberas. Triggers at the + % AS are slaved to the 1Hz master clock. To ensure that the data is + % refreshed we + srbpm.trigger; + while mt0 == srbpm.getfield(timestampfield,devicelist(1,:)) + pause(0.1); + end + end +end + +% Convert the nm units that is Hardware into meters (physics) or nm (hardware). +if strcmpi(getunits('BPMx'),'Physics') + units_conversion = 1e-9; % in meters + unitsstr = 'm'; +else + units_conversion = 1; % hardware in nm + unitsstr = 'nm'; +end + + +if strcmpi(stream,'ADC_SIGNAL') || strcmpi(stream,'TBT_TBT_WINDOW_SIGNAL') + etime = zeros(1,4); + datatime = zeros(size(devicelist,1),4); + + [data.a etime(:,1) datatime(:,1)] = srbpm.getfield([stream '.ChannelA'],devicelist,'Waveform',nelem); + [data.b etime(:,2) datatime(:,2)] = srbpm.getfield([stream '.ChannelB'],devicelist,'Waveform',nelem); + [data.c etime(:,3) datatime(:,3)] = srbpm.getfield([stream '.ChannelC'],devicelist,'Waveform',nelem); + [data.d etime(:,4) datatime(:,4)] = srbpm.getfield([stream '.ChannelD'],devicelist,'Waveform',nelem); + [data.LMT etime(:,5) datatime(:,5)] = srbpm.getfield([stream '.LMT'],devicelist); +elseif strcmpi(stream,'DDC_RAW_SIGNAL') || strcmpi(stream,'PM_DDC_RAW_SIGNAL') + etime = zeros(1,9); + datatime = zeros(size(devicelist,1),9); + % Try to avoid memory problems + [data.ia etime(:,1) datatime(:,1)] = srbpm.getfield([stream '.Ia'],devicelist,'Waveform',nelem); + [data.qa etime(:,2) datatime(:,2)] = srbpm.getfield([stream '.Qa'],devicelist,'Waveform',nelem); + [data.ib etime(:,3) datatime(:,3)] = srbpm.getfield([stream '.Ib'],devicelist,'Waveform',nelem); + [data.qb etime(:,4) datatime(:,4)] = srbpm.getfield([stream '.Qb'],devicelist,'Waveform',nelem); + [data.ic etime(:,5) datatime(:,5)] = srbpm.getfield([stream '.Ic'],devicelist,'Waveform',nelem); + [data.qc etime(:,6) datatime(:,6)] = srbpm.getfield([stream '.Qc'],devicelist,'Waveform',nelem); + [data.id etime(:,7) datatime(:,7)] = srbpm.getfield([stream '.Id'],devicelist,'Waveform',nelem); + [data.qd etime(:,8) datatime(:,8)] = srbpm.getfield([stream '.Qd'],devicelist,'Waveform',nelem); + [data.MT etime(:,9) datatime(:,9)] = srbpm.getfield([stream '.MT'],devicelist); +else + etime = zeros(1,8); + datatime = zeros(size(devicelist,1),8); + % Try to avoid memory problems + [data.sum etime(:,1) datatime(:,1)] = srbpm.getfield([stream '.Sum'],devicelist,'Waveform',nelem); + [data.x etime(:,2) datatime(:,2)] = srbpm.getfield([stream '.X'],devicelist,'Waveform',nelem); + data.x = data.x*units_conversion; + [data.y etime(:,3) datatime(:,3)] = srbpm.getfield([stream '.Y'],devicelist,'Waveform',nelem); + data.y = data.y*units_conversion; + [data.VA etime(:,4) datatime(:,4)] = srbpm.getfield([stream '.Va'],devicelist,'Waveform',nelem); + [data.VB etime(:,5) datatime(:,5)] = srbpm.getfield([stream '.Vb'],devicelist,'Waveform',nelem); + [data.VC etime(:,6) datatime(:,6)] = srbpm.getfield([stream '.Vc'],devicelist,'Waveform',nelem); + [data.VD etime(:,7) datatime(:,7)] = srbpm.getfield([stream '.Vd'],devicelist,'Waveform',nelem); + [data.MT etime(:,8) datatime(:,8)] = srbpm.getfield([stream '.MT'],devicelist); +end +data.elapsed_time = sum(etime); % elapsed time to download the PV the wait is longer to ensure all the Liberas have triggered. +data.mean_datatime = mean(datatime,2); % mean data time that all the PVs have been updated, as a function of the devicelist. +data.datatime = datatime; + + +% Log status of the Libera +% if isnumeric(devicelist) +% % To differentiate the the booster BPMs that are currently not +% % version 2.06 and don't have some of these features. +% data.switches = srbpm.getfield('ENV_SWITCHES_MONITOR',devicelist,'Waveform',nelem); +% data.plloffset = srbpm.getfield('ENV_PLL_OFFSETTUNE_MONITOR',devicelist,'Waveform',nelem); +% data.pllcomptune = srbpm.getfield('ENV_PLL_COMPTUNE_MONITOR',devicelist,'Waveform',nelem); +% end + +data.DeviceList = devicelist; +data.TimeStamp = clock; +data.CreatedBy = mfilename; +data.UnitsString = unitsstr; +data.Units = getunits('BPMx'); +data.Mode = 'Online'; % By definition for now. + +varargout{1} = data; \ No newline at end of file diff --git a/machine/ASP/StorageRing/bpm_scripts/getliberafadata.m b/machine/ASP/StorageRing/bpm_scripts/getliberafadata.m new file mode 100644 index 00000000..fb929b5e --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/getliberafadata.m @@ -0,0 +1,145 @@ +function varargout = getliberafadata(varargin) +% +% fadata = GETLIBERAFADATA(end_date,[keyword_pairs]) +% +% END_DATE = end of the data acquisition +% +% The default without any other parameters is to return 10,000 samples of +% 10kHz data up undil the END_DATE +% +% NOTE: the date format can be the Matlab numeric format (i.e. output of +% the function 'datenum') +% +% KEYWORD_PAIRS: +% +% 'decimation' = 'F' -> 10 kHz +% 'd' -> 10058/64 decimated +% 'D' -> 10058/16384 decimated +% 'start' = start date 'dd/mm/yyyy HH:MM:SS' format +% +% E.g. +% +% fadata = getliberafadata('4/2/2013 09:00:00'); +% fadata = getliberafadata(now); +% getliberafadata('4/2/2013 09:00:00') +% +% 4/2/2013 Eugene. Beta release. +% +% +% if length of first parameter is equal to 1 and is numeric +% retreive data using the first parameter as offset in seconds till now +% else if length of first parameter is equal to 1 and is a character array +% retrieve data using the frist parameter as a date till now +% else if length of first parameter is equal to 2 and is numeric +% retrieve data using the two numbers as datenum in Matlab formatl. +% else if length of first parameter is equal to 2 and is a character array +% retrive data using the two character strings as date in Matlab format +% else +% don't know what you want +% end + +[reg, prop] = parseparams(varargin); +sec2day = inline('x/(24*60*60)'); + +if nargin > 0 + if isempty(reg) + reg{1} = prop{1}; + prop = {prop{2:end}}; + end + + if ischar(reg{1}) + enddate = datenum(reg{1},'dd/mm/yyyy HH:MM:SS'); + else + enddate = reg{1}; + end + + if abs(now - enddate) < sec2day(5) + % If the enddate is too close to the current time period it can + % cause problems with the archiver, so wait 5 seconds. + pause(5); + end + +else + disp('Need an end date.'); + return +end + +% defaults +decimation = 'F'; +startdate = []; +for i=1:length(prop)/2 + ind = (i-1)*2+1; + switch lower(prop{ind}) + case 'decimation' + decimation = prop{ind+1}; + case 'start' + if ischar(prop{ind+1}) + startdate = datenum(prop{ind+1},'dd/mm/yyyy HH:MM:SS'); + else + startdate = prop{ind+1}; + end + end +end + +% dt = time period per sample +switch decimation + case 'F' + dt = 1/10058; + case 'd' + dt = 64/10058; + case 'D' + dt = 64/10058; +end + +if isempty(startdate) + % Default 10000 samples grab a bit more so we don't accidentally have + % less than 10000. + startdate = datenum(enddate) - sec2day(10100*dt); + + defaultsused = 1; +else + defaultsused = 0; +end + +temp = fa_load([startdate enddate],[1:98],decimation,'10.17.100.25'); +% temp = fa_load([startdate enddate],[18],decimation,'10.17.100.25'); + +if strcmpi(decimation,'F') + if defaultsused + % Just return everything so dont' truncate to 10000 Eugene + % 24/10/2016 +% temp.data = temp.data(:,:,1:10000); +% temp.t = temp.t(1:10000); + end + temp.x = squeeze(temp.data(1,:,:)); + temp.y = squeeze(temp.data(2,:,:)); + temp = rmfield(temp,'data'); + temp.DeviceList = elem2dev('BPMx',temp.ids); + temp.timestamp = datestr(temp.timestamp); +else + if defaultsused + % Just return everything so dont' truncate to 10000 Eugene + % 24/10/2016 +% temp.data = temp.data(:,:,:,1:10000); +% temp.t = temp.t(1:10000); + end + + n = size(temp.data,3); + + temp.x = squeeze(temp.data(1,1,:,:)); + temp.xmin = squeeze(temp.data(1,2,:,:)); + temp.xmax = squeeze(temp.data(1,3,:,:)); + temp.xstd = squeeze(temp.data(1,4,:,:)); + + temp.y = squeeze(temp.data(2,1,:,:)); + temp.ymin = squeeze(temp.data(2,2,:,:)); + temp.ymax = squeeze(temp.data(2,3,:,:)); + temp.ystd = squeeze(temp.data(2,4,:,:)); + + temp = rmfield(temp,'data'); + temp.DeviceList = elem2dev('BPMx',temp.ids); + temp.timestamp = datestr(temp.timestamp); +end +varargout{1} = orderfields(temp); + + diff --git a/machine/ASP/StorageRing/bpm_scripts/mytestf.m b/machine/ASP/StorageRing/bpm_scripts/mytestf.m new file mode 100644 index 00000000..bc609cdd --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/mytestf.m @@ -0,0 +1,4 @@ +function mytestf(field) + +fprintf('something: %s\n',field); + diff --git a/machine/ASP/StorageRing/bpm_scripts/new_EPICS_conversion/srbpm_v2.m b/machine/ASP/StorageRing/bpm_scripts/new_EPICS_conversion/srbpm_v2.m new file mode 100644 index 00000000..5e683d1d --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/new_EPICS_conversion/srbpm_v2.m @@ -0,0 +1,760 @@ +classdef srbpm_v2 + properties (Access=private) + fullDeviceList + bpmpvnames + iocpvnames + end + + methods (Static) + %% Version and Help functions + + function version(varargin) + fprintf("srbpm\n"); + fprintf("Version 2.1\n"); + fprintf("Updated to use the new PV's with the updated EPICS base\n\n"); + end + + function help(varargin) + fprintf("Help Menu\n"); + fprintf("(WIP)\n\n"); + end + + %% Get Methods + + function varargout = getfield(field,varargin) + % Wrap the internal function as a method + varargout = getfield(field,varargin{:}); + end + + function status = getagc(varargin) + % agcstate = getagc([DeviceList]); + % + % Returns the state of the AGC + status = local_getPV('BPMx','AGC_ENABLED_STATUS',varargin{1:end}); + if isnan(status) + fprintf("Failed to get AGC status\n"); + return; + end + end + + function maxadc = getmaxadc(varargin) + % maxadc = getmaxadc([DeviceList]); + % + % Returns the MAXADC values + maxadc = local_getPV('BPMx','MAXADC_MONITOR',varargin{1:end}); + if isnan(maxadc) + fprintf("Failed to get max adc values\n"); + return; + end + end + + function status = getsyncstate(varargin) + % Return the synchronisation state of all the BPMs + % 0:NoSync, 1:tracking, 2:synchronised + status = local_getPV('BPMx','SYNC_ST_M_STATUS',varargin{:}); + if isnan(status) + fprintf("Failed to get synchronisation state\n"); + return; + end + end + + function eventcode = gettriggerevent(varargin) + % eventcode = gettriggerevent + % + % Get the current T2 (general trigger) event codes + eventcode = getfield('EVRX_RTC_T2_IN_FUNCTION_MONITOR', varargin{1:end}); + end + + function eventcode = getpmevent(varargin) + % eventcode = getpmevent + % + % Get the current T1 (post mortem trigger) event codes + eventcode = getfield('EVRX_RTC_T1_IN_FUNCTION_MONITOR', varargin{1:end}); + end + + function status = getmclock(varargin) + % mclockstate = getmclock([DeviceList]); + % + % Returns the state of the MC lock (EVRX_PLL_LOCKED) + status = getfield('EVRX_PLL_LOCKED_STATUS', varargin{1:end}); + end + + + %% Set Methods + + function status = setfield(field,value,varargin) + % Wrap the internal function as a method + status = setfield(field,value,varargin{:}); + end + + function setagc(varargin) + % getagc(['on'/1,'off'/0],[DeviceList]) + % + % Set the state of the Auto Gain Control (AGC) + if nargin > 0 + switch varargin{1} + case {'on', 1} + local_setPV('BPMx','AGC_ENABLED',1,varargin{2:end}); + case {'off', 0} + local_setPV('BPMx','AGC_ENABLED',0,varargin{2:end}); + end + end + end + + function setswitches(varargin) + % setswitches(['on'/1,'off/0],[DeviceList])col + % + % Set the state of the crossbar switches on the Brilliance+ + % units in conjunction with the digital signal conditioning. + if nargin > 0 + if ischar(varargin{1}); varargin{1} = lower(varargin{1}); end + if getpv('SR00OFB01:MODE_STATUS') == 2 + warning('Changing switching status while orbit feedback is RUNNING is not recommended.'); + end + switch varargin{1} + case {'on', 1} + local_setPV('BPMx','SWITCHING_ENABLE',1,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_ADJUST',1,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_TYPE',1,varargin{2:end}); + case {'off', 0} + local_setPV('BPMx','SWITCHING_ENABLE',0,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_ADJUST',0,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_TYPE',1,varargin{2:end}); + end + end + end + + function settriggerevent(eventcode, varargin) + % settriggerevent(eventcode, [DeviceList]) + % Set the current T2 (general trigger) event codes + % + % 0 = nullevent + % 1 = master + % 2 = injection + % 3 = gun + % 4 = extraction without gun + % 5 = extraction with gun + % 6 = User Event_ bunch by bunch + % 7 = User Event_ SR BPM + % 8 = User Event_ General purpose (default) + % 9 = User Event_ topup warning + % 10 = User Event_ beam dump + % 11 = User Event_ FFM timing reset + % 16 = User Event_ SR Injection + % 20 = SROC/N1 + % 21 = SROC/N2 + % 22 = SROC/N3 + % + % you can set multiple events to trigger on. Example: + % + % >> srbpm.settriggerevent([7 8]) + % >> srbpm.settriggerevent([7 5]) + if nargin > 1 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + eventmaskarr = [repmat(hex2dec('00ff'),length(deviceList),length(eventcode)), repmat(65535,length(deviceList),16-length(eventcode))]; + eventcodearr = [repmat(eventcode ,length(deviceList),1), repmat(65535,length(deviceList),16-length(eventcode))]; + + setfield('EVRX_RTC_T2_IN_FUNCTION', eventcodearr); + setfield('EVRX_RTC_T2_IN_MASK', eventmaskarr); + end + + function setpmevent(eventcode, varargin) + % setpmevent(eventcode, [DeviceList]) + % Set the current T1 (Post Mortem trigger) see SETTRIGGEREVENTS + % for the event codes. You can set multiple events to trigger + % on. Example: + % + % >> srbpm.setpmevent([10 7]) + % >> srbpm.setpmevent([10]) + if nargin > 1 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + eventmaskarr = [repmat(hex2dec('00ff'),length(deviceList),length(eventcode)), repmat(65535,length(deviceList),16-length(eventcode))]; + eventcodearr = [repmat(eventcode ,length(deviceList),1), repmat(65535,length(deviceList),16-length(eventcode))]; + + setfield('EVRX_RTC_T1_IN_FUNCTION', eventcodearr); + setfield('EVRX_RTC_T1_IN_MASK', eventmaskarr); + end + + function setevrxmode(mode,varargin) + % setevrxmode(mode,[DeviceList]) + % Set EVRx mode for MC, T1 and T2 to 'RTC' or 'External'. + switch mode + case 'RTC' + setfield('EVRX_TRIGGERS_MC_SOURCE' , 5, varargin{:}); + setfield('EVRX_TRIGGERS_T0_SOURCE' , 0, varargin{:}); + setfield('EVRX_TRIGGERS_T1_SOURCE' , 5, varargin{:}); + setfield('EVRX_TRIGGERS_T2_SOURCE' , 5, varargin{:}); + case 'External' + setfield('EVRX_TRIGGERS_MC_SOURCE' , 1, varargin{:}); + setfield('EVRX_TRIGGERS_T0_SOURCE' , 0, varargin{:}); + setfield('EVRX_TRIGGERS_T1_SOURCE' , 1, varargin{:}); + setfield('EVRX_TRIGGERS_T2_SOURCE' , 1, varargin{:}); + otherwise + disp('Nothing done'); + end + end + + + %% File I/O + + function [xoff, yoff] = getarchivedoffsets(varargin) + % [xoff yoff] = getarchivedoffsets([number],['quiet']) + % + % will search and extract the offsets from: + % ../bpm_scripts/archivedoffsets/archivedoffsets_[num]_[date].mat + % Default without a number will return the last set of offsets. + % The option of 'quiet' will stop all printout. + % + + archivedir = fileparts(mfilename('fullpath')); + archivedir = [archivedir filesep 'archivedoffsets']; + + files = dir([archivedir filesep 'archivedoffsets_*.mat']); + + if nargin > 0 && isnumeric(varargin{1}) + % user specified a specific offset to retrieve + filename = files(varargin{1}).name; + else + % assume that you want the last one if you don't have any + % input + filename = files(end).name; + end + + load(fullfile(archivedir,filename)); + if ~any(strcmpi(varargin,'quiet')) + fprintf('Loading: %s\n',filename); + fprintf(' Datestr: %s\n',offsetdata.datatime); + fprintf(' Comments: %s\n',offsetdata.comment); + end + + % The archived offsets are in meters + if strcmpi(getunits('BPMx'),'hardware') + scale = 1e9; + else + scale = 1; + end + + if nargout > 0 + xoff = offsetdata.xoffsets*scale; + end + if nargout > 1 + yoff = offsetdata.yoffsets*scale; + end + end + + function setarchivedoffsets(xoff,xdev,yoff,ydev) + % setarchivedoffsets(xoff,xdev,yoff,ydev) + % + % save the offsets into the archive. + archivedir = fileparts(mfilename('fullpath')); + archivedir = [archivedir filesep 'archivedoffsets']; + files = dir([archivedir filesep 'archivedoffsets_*.mat']); + i = sscanf(files(end).name,'archivedoffsets_%d_%*s.mat'); + + % Grab previous list + [xoff0, yoff0] = srbpm.getarchivedoffsets('quiet'); + % Updated with new + ind = dev2elem('BPMx',xdev); + xoff0(ind) = xoff; + ind = dev2elem('BPMx',ydev); + yoff0(ind) = yoff; + + % Prompt user to input data + prompt = {'Date','Comments'}; + dlg_title = 'Archive Offsets to file'; + t = now; + def = {datestr(t) ''}; + answer = inputdlg(prompt, dlg_title,1,def); + if isempty(answer) + disp('No offsets saved'); + return + end + + offsetdata.xoffsets = xoff0; + offsetdata.yoffsets = yoff0; + offsetdata.comment = answer{2}; + offsetdata.datatime = answer{1}; + + % Increment the index of the archived datafiles and resave + prefix = sprintf('archivedoffsets_%04d',i+1); + fname = appendtimestamp(prefix,datevec(t)); + save(fullfile(archivedir,fname),'offsetdata'); + + end + + %% Utilities + + function trigger(varargin) + % trigger([triggertype]) + % + % Gets the event generator to transmit a SR BPM event, where + % triggertype=0/'stop' + % triggertype=1/'single' (default) + % triggertype=2/'continuous'/'cont' + % + if nargin == 0 + varargin{1} = 1; + end + switch varargin{1} + case {0,'stop'} + % set the BPM trigger event on the EVG for a single event. + setpv('TS01EVG01:EVENT_02_MODE_CMD',0); % stop + case {1,'single'} + % set the BPM trigger event on the EVG for a single event. + setpv('TS01EVG01:EVENT_02_MODE_CMD',3); % single shot + case {2,'continuous','cont'} + % set the BPM trigger event on the EVG for a continuous event. + setpv('TS01EVG01:EVENT_02_MODE_CMD',1); % continuous shot + end + end + + function synchronise(varargin) + % Synchronise *ALL ACTIVE* Libera Brillinace+ units. Assumes + % that Trigger event code is 7 (SR BPM Event). + + % Disable Sync Event + % Stop SR BPM trigger: 0=Disabled, 1:Continuous, 2:Active/Single, 3:Armed + setpv('TS01EVG01:EVENT_02_MODE_CMD',0); + pause(1); + % Arm the Liberas to Synchronise + % Wait before sending the trigger + setfield('SYNC_CMD.PROC',1,varargin{:}); + + fprintf('Waiting to get into tracking mode: '); + while any( getfield('SYNC_ST_M_STATUS') ~= 1 ) + fprintf('.'); + pause(0.5); + end + fprintf('\n'); + pause(0.5); + + + % Send Single Trigger to Synchronise + % Wait for system to synchronise + setpv('TS01EVG01:EVENT_02_MODE_CMD',3); + end + + function varargout = collectpmdata(varargin) + % this script will collect the PM data, collect the interlock statuses, + % reset the interlock statuse on the liberas and reset the PM triggering + % system. + % + % All data will be archived to /asp/usr/data/bpmpmdata/ + + datenow = datevec(now); + if isunix + dirname = sprintf('/asp/usr/data/bpmpmdata/'); + elseif ispc + dirname = sprintf('u:\\data\\bpmpmdata\\'); + end + if exist(dirname,'dir') ~= 7 + mkdir(dirname); + end + + fprintf('Collecting PM data...'); + pm = getliberadata('PM_DDC_SYNTH'); + fprintf(' done\n'); + + fprintf('Collecting Interlock Status... '); + pm.ilkxstatus = getfield('ILK_STATUS_X'); + pm.ilkystatus = getfield('ILK_STATUS_Y'); + fprintf(' done\n'); + + fprintf('Acknowledging interlock status and resetting PM on the Libera...'); + setfield('ILK_STATUS_RESET',0); + setfield('PM_CAPTURE',1); + fprintf(' done\n'); + + fprintf('Reseting the PM triggering system...'); + setpv('TS01EVR11:TTL03_ENABLE_CMD',1); + pause(1); + setpv('TS01EVR11:TTL03_ENABLE_CMD',0); + fprintf(' done\n'); + + fname = appendtimestamp([dirname 'pmdata']); + fprintf('Saving to file: %s.mat\n',fname); + save(fname,'pm') + if nargout > 0 + varargout{1} = pm; + end + end + + function setdefaultconfig(varargin) + % setdefaultconfig([DeviceList]) + % + % This function sets the default configuration for the Liberas Brillinace+ + % in the storage ring. Optional parameters: + % + % DeviceList A vector of nx2 specifying which devices to configure + % + % If no parameters are set, the configuration will be applied to all the + % liberas that are enabled in middleLayer ("aspinit"). + % + % e.g. >> setliberabconfig + % >> setliberabconfig([1 2; 1 3; 1 4; 1 5;]) + + if nargin > 0 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + el = dev2elem('BPMx',deviceList); + + + % ======================================================================= + % EVRX related PVs +% fprintf('Setting TIMING to RTC\n'); +% % Make sure the decoder is turned on +% setfield('EVRX_RTC_DECODER_SWITCH' , 1, varargin{:}); +% % MC to trigger on SROC with a hex value of 0x0200 +% setfield('EVRX_RTC_MC_IN_MASK' , hex2dec('0200'), varargin{:}); +% setfield('EVRX_RTC_MC_IN_FUNCTION' , hex2dec('0200'), varargin{:}); +% +% % Post mortem event is locked in as event code 10 (Beam Dump +% % Event) +% setfield('EVRX_RTC_T1_IN_MASK' , hex2dec('00ff'), varargin{:}); +% setfield('EVRX_RTC_T1_IN_FUNCTION' , 10 , varargin{:}); +% +% % Trigger event is defaulted to event code 7 (SR BPM Event) +% setfield('EVRX_RTC_T2_IN_MASK' , hex2dec('00ff'), varargin{:}); +% setfield('EVRX_RTC_T2_IN_FUNCTION' , 7 , varargin{:}); +% +% % PLL offset tuning +% fprintf('Setting PLL offset tune to 0 units (0 kHz) and no compensation: \n'); +% setfield('EVRX_PLL_VCXO_OFFSET' ,0,varargin{:}); +% setfield('EVRX_PLL_COMPENSATE_OFFSET' ,0,varargin{:}); + + % ======================================================================= + + + % AGC + fprintf('Settting AGC to 1 (ENABLED)\n'); + if (local_setPV('BPMx','AGC_ENABLED',1,varargin{:}) == 0) + fprintf("Failed to set PV"); + return; + end + + % Switches + fprintf('Setting SWITCHES to 1 (ENABLED)\n'); + local_setPV('BPMx','SWITCHING_ENABLE',1,varargin{:}); + local_setPV('BPMx','SWITCHING_SOURCE',1,varargin{:}); + local_setPV('BPMx','SWITCHING_DELAY',0,varargin{:}); + + % Digital signal conditioning + fprintf('Turning _ON_ DSC\n'); + local_setPV('BPMx','DSC_COEFF_ADJUST',1,varargin{:}); + local_setPV('BPMx','DSC_COEFF_TYPE',2,varargin{:}); %0-PHASE, 1-AMPLITUDE, 2-ADJUST + local_setPV('BPMx','DSC_COEFF_ATT_DEPENDENT',0,varargin{:}); + + % Gain + fprintf('Setting GAINS \n'); + local_setPV('BPMx','KX',14.8e6,varargin{:}); + local_setPV('BPMx','KY',15.1e6,varargin{:}); + local_setPV('BPMx','KS',67108864,varargin{:}); + + % Libera Offsets + [libera_offset_x, libera_offset_y] = srbpm.getarchivedoffsets('last'); + fprintf('Setting Libera Offsets \n'); + local_setPV('BPMx','OFF_X',libera_offset_x(el),varargin{:}); + local_setPV('BPMx','OFF_Y',libera_offset_y(el),varargin{:}); + + % Interlock + fprintf('Setting INTERLOCKS \n'); + gain_threshold = [... + -23 -22 -23 -21 -21 -23 -23, ... % + -23 -22 -29 -27 -28 -27 -27, ... % + -29 -29 -31 -30 -31 -31 -31, ... % + -25 -26 -26 -26 -26 -22 -22, ... % + -23 -24 -25 -24 -23 -22 -21, ... % + -30 -30 -32 -31 -31 -27 -26, ... % + -33 -33 -34 -34 -33 -29 -29, ... % + -28 -28 -29 -29 -28 -26 -24, ... % + -26 -25 -27 -26 -27 -26 -23, ... % + -26 -28 -29 -29 -29 -26 -26, ... % + -26 -26 -27 -27 -27 -28 -26, ... % + -28 -28 -29 -30 -30 -30 -30, ... % + -24 -25 -25 -23 -23 -22 -23, ... % + -24 -23 -24 -25 -25 -26 -25, ... % + ] + 3 ; gain_threshold(gain_threshold<-32) = -32; + local_setPV('BPMx','ILK_LIMITS_MIN_X',-1e6,deviceList); + local_setPV('BPMx','ILK_LIMITS_MIN_Y',-1e6,deviceList); + local_setPV('BPMx','ILK_LIMITS_MAX_X',+1e6,deviceList); + local_setPV('BPMx','ILK_LIMITS_MAX_Y',+1e6,deviceList); + local_setPV('BPMx','ILK_GAIN_DEPENDENT_THRESHOLD',gain_threshold(el)',deviceList); + local_setPV('BPMx','ILK_ENABLED',0,deviceList); + local_setPV('BPMx','ILK_GAIN_DEPENDENT_ENABLED',0,deviceList); + ii = [find(deviceList(:,2) == 1 | deviceList(:,2) == 7); findrowindex([2 2; 2 3],getlist('BPMx'))]; + local_setPV('BPMx','ILK_ENABLED',1,deviceList(ii,:)); + local_setPV('BPMx','ILK_GAIN_DEPENDENT_ENABLED',1,deviceList(ii,:)); + local_setPV('BPMx','ILK_STATUS_RESET',0,deviceList); + +% delay=[ +% 22 94 180 282 350 506 483 538 475 416 349 297 198 129 +% 21 92 184 284 354 504 487 538 475 414 350 298 200 125 +% 20 109 188 286 354 513 490 540 477 419 355 297 200 132 +% 19 110 184 289 356 512 487 543 478 419 352 301 198 132 +% 0 86 164 264 330 441 464 520 454 396 331 278 173 109 +% 0 83 166 254 325 433 457 510 452 392 336 277 172 109 +% 3 87 166 259 326 430 455 512 450 395 335 277 173 113]; + delay=[ + 29 102 188 288 356 514 491 545 479 421 354 299 204 134 + 25 101 189 290 358 517 492 545 479 421 355 300 206 133 + 27 115 193 294 361 518 495 549 484 424 358 302 203 138 + 26 113 192 292 360 520 495 550 482 423 358 303 204 137 + 4 89 169 271 337 447 471 527 459 401 334 282 181 113 + 7 89 172 261 333 436 464 519 457 396 337 284 180 116 + 7 90 171 263 333 438 465 521 455 395 339 284 178 117]; + local_setPV('BPMx','TRIG_DELAY',delay(el),deviceList); % Send default + % SR02BPM01:TBT_TBT_WINDOW.ChannelA --> set offset so that data 1 to 86 is + % used for turn 1, 87 to 172 for turn 2, etc. + local_setPV('BPMx','TBT_PHASE_OFFSET',10,varargin{:}); + + + % Setting whether to use DDC (0) or TDP (1) tbt data for decimated data + local_setPV('BPMx','TBT_DATA_TYPE',0,varargin{:}); + + % After setting the mask it this result can be seen on the TBT_TBT_WINDOW + % !!!!!!! Below does not work yet !!!!!!!!!!!!!!!! + % setpv('BPMx','TBT_ADC_MASK',ones(98,86)); % zero or one to mask the ADC samples to use to calculate TBT data + % setpv('BPMx','TBT_ADC_MASK',repmat([zeros(43,1); ones(43,1)],1,98)'); + + % Post mortem + %info PM signal arrives ~78.5 SROC after event (6752 ADC Clocks) + fprintf('Setting PM \n'); + local_setPV('BPMx','PM_CAPTURE',1,varargin{:}); %Enable PM Capture + local_setPV('BPMx','PM_SOURCE_SELECT',0,varargin{:}); %Select external Trigger + local_setPV('BPMx','PM_OFFSET',-15000,varargin{:}); + + % Disable Spike removal for now ET 5/9/2017 + fprintf('Setting spike removal DISABLE\n'); + local_setPV('BPMx','TBT_SR_TBT_ENABLE',0,varargin{:}); + local_setPV('BPMx','TBT_SR_FA_ENABLE',0,varargin{:}); + + % Set the libera IDs (careful as this will affect the FOFB) + fprintf('Setting data BPM unique IDs\n'); + ids = dev2elem('BPMx',varargin{:}); + local_setPV('BPMx','ID',ids,varargin{:}); + + fprintf('Setting data on demand PVs\n'); + % ACQM: now (1), Event (2), Stream (3) only for FA and SA + % SCAN: passive (0), Event (1-unused), i/O interupt (2), periodic (3-9) + % If SCAN==0 then sequence is .PROC --> [trigger] --> caget + local_setPV('BPMx','ADC.ACQM',2,varargin{:}); + local_setPV('BPMx','ADC.SCAN',2,varargin{:}); + + local_setPV('BPMx','TBT_TBT_WINDOW.ACQM',1,varargin{:}); + local_setPV('BPMx','TBT_TBT_WINDOW.SCAN',0,varargin{:}); + local_setPV('BPMx','TBT_TBT_WINDOW.PROC',0,varargin{:}); + + local_setPV('BPMx','DDC_RAW.ACQM',2,varargin{:}); + local_setPV('BPMx','DDC_RAW.SCAN',0,varargin{:}); + local_setPV('BPMx','DDC_RAW.OFFS',23298,varargin{:}); % Offset relative to extraction trigger + + local_setPV('BPMx','DDC_SYNTH.ACQM',2,varargin{:}); + local_setPV('BPMx','DDC_SYNTH.SCAN',0,varargin{:}); + local_setPV('BPMx','DDC_SYNTH.OFFS',23298,varargin{:}); % Offset relative to extraction trigger + + local_setPV('BPMx','TDP_SYNTH.ACQM',2,varargin{:}); + local_setPV('BPMx','TDP_SYNTH.SCAN',2,varargin{:}); + local_setPV('BPMx','TDP_SYNTH.OFFS',23298,varargin{:}); % Offset relative to extraction trigger + + local_setPV('BPMx','PM_DDC_SYNTH.ACQM',2,varargin{:}); + local_setPV('BPMx','PM_DDC_SYNTH.SCAN',2,varargin{:}); + local_setPV('BPMx','PM_DDC_SYNTH.PROC',0,varargin{:}); + + + fprintf('Resetting MC PLL status monitor\n'); + srbpm.reset_pll_status; + + end + + %% Misc Functions + + function plotadcsynchronisation(varargin) + % plotadcsynchronisation + % + % function to plot the adc channels to see if the TRIG_DELAY + % and TBT_PHASE_OFFSET are set correctly. + fprintf('Collecting ADC data... '); + adc = getliberadata('ADC'); + fprintf('TBT_TBT_WINDOW data... '); + tbtw = getliberadata('TBT_TBT_WINDOW'); + fprintf('done.\n'); + + ii = 1:200; + + h = figure(301); + set(h,'Position',[1794 44 1147 1124]); + clf; + subplot(1,2,1); + surface(adc.a(:,ii) + adc.b(:,ii) + adc.c(:,ii) + adc.d(:,ii)); + shading flat; + xlabel('BPM number'); + ylabel('Time (ADC samples)'); + title({'Sum ADC values';'Set TRIG_DELAY to align ADCs'},'Interpreter','None'); + axis tight; + + subplot(2,2,2); + plot(adc.a(1,ii),'.-'); + hold on; + plot(tbtw.a(1,ii),'r.-','LineWidth',1.5); + a = axis; + plot([86 86],[-16000 16000],'r--','LineWidth',1.5); + axis(a); + title({'BPM 1-1';'Set TBT_PHASE_OFFSET to put';'bunch train (red) within first 86 samples'}','Interpreter','None'); + legend('ADC','TBT TBT WINDOW'); + grid on; + xlabel('Time (ADC samples)'); + ylabel('Amplitude (Counts)'); + + subplot(2,2,4); + plot(adc.a(3,ii),'.-'); + hold on; + plot(tbtw.a(3,ii),'r.-','LineWidth',1.5); + a = axis; + plot([86 86],[-16000 16000],'r--','LineWidth',1.5); + axis(a); + title('BPM 1-3'); + grid on; + xlabel('Time (ADC samples)'); + ylabel('Amplitude (Counts)'); + end + + function reset_pll_status(varargin) + % Function to reset the PLL latched status monitor + % srbpm.reset_pll_status([DeviceList]) + % + setfield('EVRX_PLL_MAX_ERR_RESET_CMD',0,varargin{:}); + setfield('EVRX_PLL_OS_UNLOCK_TIME_RESET_CMD',0,varargin{:}); + + end + + function varargout = printraftemps(varargin) + % table plots and/or returns the temperatures for all the BPMs + % temptable = printraftemps([DeviceList]) + if nargin > 0 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + for i=1:7 + raftemps{i} = local_getPV('BPMx', sprintf('ID_%d_VALUE',i), deviceList); + temp = char(local_getPV('BPMx',sprintf('ID_%d_NAME',i),deviceList)); + temp = strrep(temp,'-','_'); + temp = strrep(temp,'.','_'); + raftempnames{i} = ['Temp_', temp]; + end + rafrownames = strrep(cellstr(family2channel('BPMx',deviceList)),':SA_X_MONITOR',''); + + t = table(raftemps{:},'VariableNames',raftempnames,'RowNames',rafrownames); + if nargout > 0 + varargout{1} = t; + end + + end + + end + + %% Other Methods + methods + function obj = srbpm + obj.fullDeviceList = family2dev('BPMx','',0); + obj.bpmpvnames = cellstr(family2channel('BPMx',obj.fullDeviceList)); + obj.bpmpvnames = regexprep(obj.bpmpvnames,'SA_X_MONITOR','MYCOMMAND'); + obj.iocpvnames = regexprep(obj.bpmpvnames,'BPM0[1,2,3,4]','IOC41'); + obj.iocpvnames = regexprep(obj.iocpvnames,'BPM0[5,6,7,8]','IOC42'); + end + end +end + +%% Utility Functions + +function output = local_getPV(varargin) +% Wrapper for getpv to try add some error handling. + try + output = getpv(varargin{:}); + catch + warning('Problem using getpv. Are the BPMs online?'); + output = nan; + end +end + +function output = local_setPV(varargin) +% Wrapper for setpv to try add some error handling. + try + output = setpv(varargin{:}); + catch + warning('Problem using setpv. Are the BPMs online?'); + output = nan; + end +end + +function varargout = getfield(field,varargin) + % data = getfield(field,[DeviceList,...]) + % + % Function to return an arbitrary field and is a wrapper for + % getpv('BPMx',field,[DeviceList,...]) + if strncmpi(field,'evrx',4) || strncmpi(field,'gdx',4) || strncmpi(field,'box_status',4) || (strncmpi(field,'sync',4) && ~strncmpi(field,'sync_st_m',6)) + % Change the original SR01BPM01 channel names to SR01IOC41 + % temporarily then reset the channel names. + origpvnames = getfamilydata('BPMx','Monitor','ChannelNames'); + newpvnames = char(regexprep( regexprep(cellstr(origpvnames),'BPM0[1,2,3,4]','IOC41'), 'BPM0[5,6,7,8]','IOC42')); + setfamilydata(newpvnames,'BPMx','Monitor','ChannelNames'); + + try + [data, tout, DataTime] = getpv( 'BPMx', field , varargin{:}); + catch + warning('Problem using getpv. Are the BPMs online?'); + varargout = nan; + return + end + + % Put PVs back + setfamilydata(origpvnames,'BPMx','Monitor','ChannelNames'); + else + try + [data, tout, DataTime] = getpv( 'BPMx', field , varargin{:}); + catch + warning('Problem using getpv. Are the BPMs online?'); + varargout = nan; + return + end + end + + varargout{1} = data; + if nargout > 1 + varargout{2} = tout; + end + if nargout > 2 + varargout{3} = DataTime; + end +end + +function status = setfield(field,value,varargin) + % data = setfield(field,value,[DeviceList,...]) + % + % Function to return an arbitrary field and is a wrapper for + % setpv('BPMx',field,value,[DeviceList,...]) + if strncmpi(field,'evrx',4) || strncmpi(field,'gdx',4) || strncmpi(field,'box_status',4) || (strncmpi(field,'sync',4) && ~strncmpi(field,'sync_st_m',6)) + % Change the original SR01BPM01 channel names to SR01IOC41 + % temporarily then reset the channel names. + origpvnames = getfamilydata('BPMx','Monitor','ChannelNames'); + newpvnames = char(regexprep( regexprep(cellstr(origpvnames),'BPM0[1,2,3,4]','IOC41'), 'BPM0[5,6,7,8]','IOC42')); + setfamilydata(newpvnames,'BPMx','Monitor','ChannelNames'); + + status = local_setPV( 'BPMx', field , value, varargin{:}); + % Put PVs back + setfamilydata(origpvnames,'BPMx','Monitor','ChannelNames'); + else + status = local_setPV( 'BPMx', field , value, varargin{:}); + end +end + + + diff --git a/machine/ASP/StorageRing/bpm_scripts/srbpm.m b/machine/ASP/StorageRing/bpm_scripts/srbpm.m new file mode 100644 index 00000000..2861a429 --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/srbpm.m @@ -0,0 +1,1536 @@ +classdef srbpm + % SRBPM is an object that contains functions related to the SR BPM + % system. Below is a summary of the current functions. See help + % srbpm.(method) to get more detail on how to use the function. + % + % getfield: a function to make it easier to access a particular PV on + % all the BPMs. Retrieves any PV where {BPM}:field + % setfield: a function to make it easier to set a particular PV on all + % the BPMs. Sets the PV where {BPM}:field + % + % setdefaultconfig: re-sets all the default configuration parameters + % for the SR bpms. + % + % getmaxadc: gets the maximum ADC count (across the 4 channels) from + % each of the BPMs + % getagc: get the current state of the Auto Gain Control (AGC) + % setagc: sets the state of the the Auto Gain Control (AGC). + % + % getswitches: gets the state of the switches which is AND of two PVs. + % SWITCHING_ENABLE_CMD & DSC_COEFF_ADJUST_CMD + % setswitches: sets the default state of the switches. This is + % actually a combination of parameters that has been set + % and defined as "on" and "off". + % + % ============== TIMING related methods ================== + % gettriggerevent: returns the general trigger event (T2) codes that + % are used by the Libera EVR. + % settriggerevent: sets the general trigger event (T2) codes. + % setevrxmode: sets the default EVR mode for MC, T1 and T2 to 'RTC' or + % 'External' + % trigger: manually sets the SR BPM event trigger on the EVG to a + % single trigger, continuous or stop. + % + % getsyncstate: gets the syncronisation state of the BPMs. + % getmclock: returns the state of the machine clock (MC) lock. + % reset_pll_status: function to reset the latched PLL status monitor + % synchronise: function to synchronise all the active libera + % brilliance units using the SR BPM event code (7). + % + % ============== POST MORTEM related methods ================== + % getpmevent: returns the Post Mortem Trigger Event (T1) codes that + % are used by the Libera EVR. + % setpmevent: sets the Post Mortem Trigger Event (T1) codes + % collectpmdata: script gets data from the post mortem buffer and + % archives it to /asp/usr/data/bpmpmdata/ + % + % ============== ORBIT related methods ================== + % setoffset: sets the offsets on the BPMs + % getoffset: returns the offsets from the BPMs + % setarchivedoffsets: saves bpm offsets into an archive (.mat file) + % getarchivedoffsets: returns the arvhived bpm offsets + % getreferenceorbit: returns the reference orbit used by the orbit + % feedback system. + % setreferenceorbit: sets the reference orbit used by the orbit + % feedback system. + % stepreferenceorbit: step changes the reference orbit used by the + % orbit feedback system. + % + % ============== PLOTTING related methods ================== + % plotadcsynchronisation: plots the synchronisation of the internal + % acquistion clocks for fine tuning + % TBT_PHASE_OFFSET. + % plotadc: plots the raw ADC data from the 4 RF channels to see if + % there are problems with the cable or RF input. + % plotfillpattern: plot the fill pattern using ADC data + % plotbetafunctions: uses TBT data to try and extract the beta + % functions. + % + % printraftemps: returns and prints out a table of the internal sensor + % temperaturs for all the bpms. + % + % + % Examples: + % >> help srbpm.settriggerevent + % >> srbpm.plotadc([12, 1]) + % >> state = srbpm.getfield('TBT_SR_TBT_ENABLE_STATUS'); + % >> srbpm.settriggerevent([7 5]) + % + % + % See Also: plotpmdata, getliberadata, getliberafadata + + properties (Access=public) + sumoffset + ks + bpmgain + fullDeviceList + bpmpvnames + iocpvnames + end + + methods (Static) + %% Version and Help functions + + function version(varargin) + fprintf("srbpm\n"); + fprintf("Version 2.1\n"); + fprintf("Updated to use the new PV's with the updated EPICS base\n\n"); + end + + %% Get Methods + function varargout = getfield(field,varargin) + % [data,tout,datatime,errorflag] = getfield(field,[DeviceList,...]) + % + % Function to return an arbitrary field and is a wrapper for + % getpv('BPMx',field,[DeviceList,...]) + if strncmpi(field,'evrx',4) || strncmpi(field,'gdx',4) || strncmpi(field,'box_status',4) || (strncmpi(field,'sync',4) && ~strncmpi(field,'sync_st_m',6)) + % Change the original SR01BPM01 channel names to SR01IOC41 + % temporarily then reset the channel names. + origpvnames = getfamilydata('BPMx','Monitor','ChannelNames'); + newpvnames = char(regexprep( regexprep(cellstr(origpvnames),'BPM0[1,2,3,4]','IOC41'), 'BPM0[5,6,7,8]','IOC42')); + setfamilydata(newpvnames,'BPMx','Monitor','ChannelNames'); + + try + [data, tout, DataTime, ErrorFlag] = getpv( 'BPMx', field , varargin{:}); + catch + warning('Problem using getpv. Are the BPMs online?'); + varargout{1} = nan; + varargout{2} = nan; + return + end + + % Put PVs back + setfamilydata(origpvnames,'BPMx','Monitor','ChannelNames'); + else + try + [data, tout, DataTime, ErrorFlag] = getpv( 'BPMx', field , varargin{:}); + catch + warning('Problem using getpv. Are the BPMs online?'); + varargout{1} = nan; + varargout{2} = nan; + return + end + end + + varargout{1} = data; + if nargout > 1 + varargout{2} = tout; + end + if nargout > 2 + varargout{3} = DataTime; + end + if nargout > 3 + varargout{4} = ErrorFlag; + end + end + + function status = setfield(field,value,varargin) + % data = setfield(field,value,[DeviceList,...]) + % + % Function to return an arbitrary field and is a wrapper for + % setpv('BPMx',field,value,[DeviceList,...]) + if strncmpi(field,'evrx',4) || strncmpi(field,'gdx',4) || strncmpi(field,'box_status',4) || (strncmpi(field,'sync',4) && ~strncmpi(field,'sync_st_m',6)) + % Change the original SR01BPM01 channel names to SR01IOC41 + % temporarily then reset the channel names. + origpvnames = getfamilydata('BPMx','Monitor','ChannelNames'); + newpvnames = char(regexprep( regexprep(cellstr(origpvnames),'BPM0[1,2,3,4]','IOC41'), 'BPM0[5,6,7,8]','IOC42')); + setfamilydata(newpvnames,'BPMx','Monitor','ChannelNames'); + + status = local_setPV( 'BPMx', field , value, varargin{:}); + % Put PVs back + setfamilydata(origpvnames,'BPMx','Monitor','ChannelNames'); + else + status = local_setPV( 'BPMx', field , value, varargin{:}); + end + end + + function status = getagc(varargin) + % agcstate = getagc([DeviceList]); + % + % Returns the state of the AGC + status = local_getPV('BPMx','AGC_ENABLED_STATUS',varargin{1:end}); + if isnan(status) + fprintf("Failed to get AGC status\n"); + return; + end + end + + function maxadc = getmaxadc(varargin) + % maxadc = getmaxadc([DeviceList]); + % + % Returns the MAXADC values + maxadc = local_getPV('BPMx','MAXADC_MONITOR',varargin{1:end}); + if isnan(maxadc) + fprintf("Failed to get max adc values\n"); + return; + end + end + + function status = getsyncstate(varargin) + % Return the synchronisation state of all the BPMs (PV: + % SYNC_ST_M_STATUS). + % 0:NoSync, 1:tracking, 2:synchronised + status = local_getPV('BPMx','SYNC_ST_M_STATUS',varargin{:}); + if isnan(status) + fprintf("Failed to get synchronisation state\n"); + return; + end + end + + function eventcode = gettriggerevent(varargin) + % eventcode = gettriggerevent + % + % Get the current T2 (general trigger) event codes + eventcode = srbpm.getfield('EVRX_RTC_T2_IN_FUNCTION_MONITOR', varargin{1:end}); + end + + function eventcode = getpmevent(varargin) + % eventcode = getpmevent + % + % Get the current T1 (post mortem trigger) event codes + eventcode = srbpm.getfield('EVRX_RTC_T1_IN_FUNCTION_MONITOR', varargin{1:end}); + end + + function status = getmclock(varargin) + % mclockstate = getmclock([DeviceList]); + % + % Returns the state of the MC lock (EVRX_PLL_LOCKED) + status = srbpm.getfield('EVRX_PLL_LOCKED_STATUS', varargin{1:end}); + end + + function status = getswitches(varargin) + % switchstate = getswitches([DeviceList]) + % + % Returns the state of the switches which is the state of + % SWITCHING_ENABLE_CMD & DSC_COEFF_ADJUST_CMD + + sw = logical(local_getPV('BPMx','SWITCHING_ENABLE_CMD',varargin{1:end})); + dsc = logical(local_getPV('BPMx','DSC_COEFF_ADJUST_CMD',varargin{1:end})); + + status = double(sw & dsc); + end + + + %% Set Methods + function setagc(varargin) + % getagc(['on'/1,'off'/0],[DeviceList]) + % + % Set the state of the Auto Gain Control (AGC) + if nargin > 0 + switch varargin{1} + case {'on', 1} + local_setPV('BPMx','AGC_ENABLED_CMD',1,varargin{2:end}); + case {'off', 0} + local_setPV('BPMx','AGC_ENABLED_CMD',0,varargin{2:end}); + end + end + end + + function setswitches(varargin) + % setswitches(['on'/1,'off/0],[DeviceList]) + % + % Set the state of the crossbar switches on the Brilliance+ + % units in conjunction with the digital signal conditioning. + if nargin > 0 + if ischar(varargin{1}); varargin{1} = lower(varargin{1}); end + if getpv('SR00OFB01:MODE_STATUS') == 2 + warning('Changing switching status while orbit feedback is RUNNING is not recommended.'); + end + switch varargin{1} + case {'on', 1} + local_setPV('BPMx','SWITCHING_ENABLE_CMD',1,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_ADJUST_CMD',1,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_TYPE_CMD',1,varargin{2:end}); + case {'off', 0} + local_setPV('BPMx','SWITCHING_ENABLE_CMD',0,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_ADJUST_CMD',0,varargin{2:end}); + local_setPV('BPMx','DSC_COEFF_TYPE_CMD',1,varargin{2:end}); + end + end + end + + function settriggerevent(eventcode, varargin) + % settriggerevent(eventcode, [DeviceList]) + % Set the current T2 (general trigger) event codes + % + % 0 = nullevent + % 1 = master + % 2 = injection + % 3 = gun + % 4 = extraction without gun + % 5 = extraction with gun + % 6 = User Event_ bunch by bunch + % 7 = User Event_ SR BPM + % 8 = User Event_ General purpose (default) + % 9 = User Event_ topup warning + % 10 = User Event_ beam dump + % 11 = User Event_ FFM timing reset + % 16 = User Event_ SR Injection + % 20 = SROC/N1 + % 21 = SROC/N2 + % 22 = SROC/N3 + % + % you can set multiple events to trigger on. Example: + % + % >> srbpm.settriggerevent([7 8]) + % >> srbpm.settriggerevent([7 5]) + if nargin > 1 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + eventmaskarr = [repmat(hex2dec('00ff'),length(deviceList),length(eventcode)), repmat(65535,length(deviceList),16-length(eventcode))]; + eventcodearr = [repmat(eventcode ,length(deviceList),1), repmat(65535,length(deviceList),16-length(eventcode))]; + + srbpm.setfield('EVRX_RTC_T2_IN_FUNCTION_SP', eventcodearr); + srbpm.setfield('EVRX_RTC_T2_IN_MASK_SP', eventmaskarr); + end + + function setpmevent(eventcode, varargin) + % setpmevent(eventcode, [DeviceList]) + % Set the current T1 (Post Mortem trigger) see SETTRIGGEREVENTS + % for the event codes. You can set multiple events to trigger + % on. Example: + % + % >> srbpm.setpmevent([10 7]) + % >> srbpm.setpmevent([10]) + if nargin > 1 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + eventmaskarr = [repmat(hex2dec('00ff'),length(deviceList),length(eventcode)), repmat(65535,length(deviceList),16-length(eventcode))]; + eventcodearr = [repmat(eventcode ,length(deviceList),1), repmat(65535,length(deviceList),16-length(eventcode))]; + + srbpm.setfield('EVRX_RTC_T1_IN_FUNCTION', eventcodearr); + srbpm.setfield('EVRX_RTC_T1_IN_MASK', eventmaskarr); + end + + function setevrxmode(mode,varargin) + % setevrxmode(mode,[DeviceList]) + % Set EVRx mode for MC, T1 and T2 to 'RTC' or 'External'. + switch mode + case 'RTC' + srbpm.setfield('EVRX_TRIGGERS_MC_SOURCE' , 5, varargin{:}); + srbpm.setfield('EVRX_TRIGGERS_T0_SOURCE' , 0, varargin{:}); + srbpm.setfield('EVRX_TRIGGERS_T1_SOURCE' , 5, varargin{:}); + srbpm.setfield('EVRX_TRIGGERS_T2_SOURCE' , 5, varargin{:}); + case 'External' + srbpm.setfield('EVRX_TRIGGERS_MC_SOURCE' , 1, varargin{:}); + srbpm.setfield('EVRX_TRIGGERS_T0_SOURCE' , 0, varargin{:}); + srbpm.setfield('EVRX_TRIGGERS_T1_SOURCE' , 1, varargin{:}); + srbpm.setfield('EVRX_TRIGGERS_T2_SOURCE' , 1, varargin{:}); + otherwise + disp('Nothing done'); + end + end + + + %% File I/O + function varargout = getoffset(varargin) + % [AM, tout, DataTime, ErrorFlag] = srbpm.getoffset - Returns horizontal or + % vertical offsets in the liberas. + % + % offset = srbpm.getoffset(Plane, [DeviceList]) + % + % Plane: 'x' or 'y' + % DeviceList: standard MML definition + + if nargin > 0 && ischar(varargin{1}) + switch lower(varargin{1}) + case 'x' + % [varargout{1} varargout{2} varargout{3} varargout{4}] = getlibera('ENV_X_OFFSET_MONITOR',varargin{2:end}); % AM, tout, DataTime + [varargout{1}, varargout{2}, varargout{3}, varargout{4}] = srbpm.getfield('OFF_X_SP',varargin{2:end}); % AM, tout, DataTime + case 'y' + % [varargout{1} varargout{2} varargout{3} varargout{4}] = getlibera('ENV_Y_OFFSET_MONITOR',varargin{2:end}); % AM, tout, DataTime + [varargout{1}, varargout{2}, varargout{3}, varargout{4}] = srbpm.getfield('OFF_Y_SP',varargin{2:end}); % AM, tout, DataTime + end + else + error('Error using srbpm.getoffset') + end + end + + function varargout = setoffset(varargin) + % [AM, tout, DataTime, ErrorFlag] = srbpm.setoffset - Set horizontal or + % vertical offsets in the liberas. + % + % srbpm.setoffset(Plane, Vals, DeviceList) + % + % where Plane: 'x' or 'y' and DeviceList is the standard MML definition. + % In the second option with no parameters at all it will print a list of + % the archived offsets and ask the user which set to load. + if nargin > 1 && ischar(varargin{1}) && isnumeric(varargin{2}) + switch lower(varargin{1}) + case 'x' + status = srbpm.setfield('OFF_X_SP',varargin{2:end}); % AM, tout, DataTime + case 'y' + status = srbpm.setfield('OFF_Y_SP',varargin{2:end}); % AM, tout, DataTime + otherwise + error('Unknown plane: %s', varargin{1}); + end + elseif nargin == 0 + printarchivedoffsets; + id = str2num(input('Which set of offsets to load? ID number: ','s')); + + if ~isempty(id) && isnumeric(id) && isfinite(id) + [xoff yoff] = getarchivedliberaoffsets(id); + + ind = dev2elem('BPMx',getlist('BPMx')); + status = srbpm.setfield('OFF_X_SP',xoff(ind),getlist('BPMx')); + status = status | srbpm.setfield('OFF_Y_SP',yoff(ind),getlist('BPMx')); + else + disp('Nothing applied'); + end + + else + error('Error using srbpm.setoffset') + end + + if nargout > 0 + varargout{1} = status; + end + end + + function [xoff, yoff] = getarchivedoffsets(varargin) + % [xoff yoff] = getarchivedoffsets([number],['quiet']) + % + % will search and extract the offsets from: + % ../bpm_scripts/archivedoffsets/archivedoffsets_[num]_[date].mat + % Default without a number will return the last set of offsets. + % The option of 'quiet' will stop all printout. + % + + archivedir = fileparts(mfilename('fullpath')); + archivedir = [archivedir filesep 'archivedoffsets']; + + files = dir([archivedir filesep 'archivedoffsets_*.mat']); + + if nargin > 0 && isnumeric(varargin{1}) + % user specified a specific offset to retrieve + filename = files(varargin{1}).name; + else + % assume that you want the last one if you don't have any + % input + filename = files(end).name; + end + + load(fullfile(archivedir,filename)); + if ~any(strcmpi(varargin,'quiet')) + fprintf('Loading: %s\n',filename); + fprintf(' Datestr: %s\n',offsetdata.datatime); + fprintf(' Comments: %s\n',offsetdata.comment); + end + + % The archived offsets are in meters + if strcmpi(getunits('BPMx'),'hardware') + scale = 1e9; + else + scale = 1; + end + + if nargout > 0 + xoff = offsetdata.xoffsets*scale; + end + if nargout > 1 + yoff = offsetdata.yoffsets*scale; + end + end + + function setarchivedoffsets(xoff,xdev,yoff,ydev) + % setarchivedoffsets(xoff,xdev,yoff,ydev) + % + % save the offsets into the archive. + % + % !!!!!!!!!! NOTE !!!!!!! + % offsets are ALWAYs archived in units of METERS. + % For the future I should just save the units of the values + % so as to avoid confusion. This came about when changing + % between units in MML where HW is in units of nm while + % Physics units are meters. + + archivedir = fileparts(mfilename('fullpath')); + archivedir = [archivedir filesep 'archivedoffsets']; + files = dir([archivedir filesep 'archivedoffsets_*.mat']); + i = sscanf(files(end).name,'archivedoffsets_%d_%*s.mat'); + + % Grab previous list + [xoff0, yoff0] = srbpm.getarchivedoffsets('quiet'); + % Updated with new + ind = dev2elem('BPMx',xdev); + xoff0(ind) = xoff; + ind = dev2elem('BPMx',ydev); + yoff0(ind) = yoff; + + % Prompt user to input data + prompt = {'Date','Comments'}; + dlg_title = 'Archive Offsets to file'; + t = now; + def = {datestr(t) ''}; + answer = inputdlg(prompt, dlg_title,1,def); + if isempty(answer) + disp('No offsets saved'); + return + end + + offsetdata.xoffsets = xoff0; + offsetdata.yoffsets = yoff0; + offsetdata.comment = answer{2}; + offsetdata.datatime = answer{1}; + + % Increment the index of the archived datafiles and resave + prefix = sprintf('archivedoffsets_%04d',i+1); + fname = appendtimestamp(prefix,datevec(t)); + save(fullfile(archivedir,fname),'offsetdata'); + + end + + %% Utilities + + function trigger(varargin) + % trigger([triggertype]) + % + % Gets the event generator to transmit a SR BPM event, where + % triggertype=0/'stop' + % triggertype=1/'single' (default) + % triggertype=2/'continuous'/'cont' + % + if nargin == 0 + varargin{1} = 1; + end + switch varargin{1} + case {0,'stop'} + % set the BPM trigger event on the EVG for a single event. + setpv('TS01EVG01:EVENT_02_MODE_CMD',0); % stop + case {1,'single'} + % set the BPM trigger event on the EVG for a single event. + setpv('TS01EVG01:EVENT_02_MODE_CMD',3); % single shot + case {2,'continuous','cont'} + % set the BPM trigger event on the EVG for a continuous event. + setpv('TS01EVG01:EVENT_02_MODE_CMD',1); % continuous shot + end + end + + function synchronise(varargin) + % Synchronise *ALL ACTIVE* Libera Brillinace+ units. Assumes + % that Trigger event code is 7 (SR BPM Event). + + % Disable Sync Event + % Stop SR BPM trigger: 0=Disabled, 1:Continuous, 2:Active/Single, 3:Armed + setpv('TS01EVG01:EVENT_02_MODE_CMD',0); + pause(1); + % Arm the Liberas to Synchronise + % Wait before sending the trigger + srbpm.setfield('SYNC_CMD.PROC',1,varargin{:}); + + fprintf('Waiting to get into tracking mode: '); + while any( srbpm.getfield('SYNC_ST_M_STATUS') ~= 1 ) + fprintf('.'); + pause(0.5); + end + fprintf('\n'); + pause(0.5); + + + % Send Single Trigger to Synchronise + % Wait for system to synchronise + setpv('TS01EVG01:EVENT_02_MODE_CMD',3); + end + + function varargout = collectpmdata(varargin) + % this script will collect the PM data, collect the interlock statuses, + % reset the interlock statuse on the liberas and reset the PM triggering + % system. + % + % All data will be archived to /asp/usr/data/bpmpmdata/ + + datenow = datevec(now); + if isunix + dirname = sprintf('/asp/usr/data/bpmpmdata/'); + elseif ispc + dirname = sprintf('u:\\data\\bpmpmdata\\'); + end + if exist(dirname,'dir') ~= 7 + mkdir(dirname); + end + + fprintf('Collecting PM data...'); + pm = getliberadata('PM_DDC_SYNTH_SIGNAL'); + fprintf(' done\n'); + + fprintf('Collecting Interlock Status and Offset... '); + pm.ilkxstatus = srbpm.getfield('ILK_STATUS_X_STATUS'); + pm.ilkystatus = srbpm.getfield('ILK_STATUS_Y_STATUS'); + pm.ilk_mode_status = srbpm.getfield('ILK_ENABLED_STATUS'); + pm.offset = srbpm.getfield('PM_OFFSET_SP'); + fprintf(' done\n'); + + fprintf('Acknowledging interlock status and resetting PM on the Libera...'); + srbpm.setfield('ILK_STATUS_RESET_CMD',0); + srbpm.setfield('PM_CAPTURE_CMD',1); + fprintf(' done\n'); + + fprintf('Reseting the PM triggering system...'); + setpv('TS01EVR11:TTL03_ENABLE_CMD',1); + pause(0.2); + setpv('TS01EVR11:TTL03_ENABLE_CMD',0); + fprintf(' done\n'); + + fname = appendtimestamp([dirname 'pmdata']); + fprintf('Saving to file: %s.mat\n',fname); + save(fname,'pm') + if nargout > 0 + varargout{1} = pm; + end + end + + function setdefaultconfig(varargin) + % setdefaultconfig([DeviceList]) + % + % This function sets the default configuration for the Liberas Brillinace+ + % in the storage ring. Optional parameters: + % + % DeviceList A vector of nx2 specifying which devices to configure + % + % If no parameters are set, the configuration will be applied to all the + % liberas that are enabled in middleLayer ("aspinit"). + % + % e.g. >> setliberabconfig + % >> setliberabconfig([1 2; 1 3; 1 4; 1 5;]) + + if nargin > 0 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + el = dev2elem('BPMx',deviceList); + + mysrbpm = srbpm; + + % ======================================================================= + % EVRX related PVs + fprintf('Setting TRIGGER event 5 (extraction with gun) and 7 (SR BPM trigger)\n'); + mysrbpm.settriggerevent([5 7]); + + % We do not normally change the following and will only do this + % if we know the timing settings have changed. + + % Make sure the decoder is turned on +% mysrbpm.setfield('EVRX_RTC_DECODER_SWITCH_CMD' , 1, varargin{:}); +% % MC to trigger on SROC with a hex value of 0x0200 +% mysrbpm.setfield('EVRX_RTC_MC_IN_MASK_SP' , hex2dec('0210'), varargin{:}); +% mysrbpm.setfield('EVRX_RTC_MC_IN_FUNCTION_SP' , hex2dec('0210'), varargin{:}); +% +% % Post mortem event is locked in as event code 10 (Beam Dump +% % Event) +% mysrbpm.setfield('EVRX_RTC_T1_IN_MASK_SP' , hex2dec('00ff'), varargin{:}); +% mysrbpm.setfield('EVRX_RTC_T1_IN_FUNCTION_SP' , 10 , varargin{:}); +% +% % Trigger event is defaulted to event code 5 (ext with gun) and 7 (SR BPM Event) +% mysrbpm.setfield('EVRX_RTC_T2_IN_MASK_SP' , hex2dec('00ff'), varargin{:}); +% +% +% % PLL offset tuning +% fprintf('Setting PLL offset tune to 0 units (0 kHz) and no compensation: \n'); +% mysrbpm.setfield('EVRX_PLL_VCXO_OFFSET_MONITOR' ,0,varargin{:}); +% mysrbpm.setfield('EVRX_PLL_COMPENSATE_OFFSET_STATUS' ,0,varargin{:}); + + + % ======================================================================= + + + % AGC + fprintf('Settting AGC to 1 (ENABLED)\n'); + if isnan(local_setPV('BPMx','AGC_ENABLED_CMD',1,varargin{:})) + fprintf("Failed to set PV"); + return; + end + + % Switches + fprintf('Setting SWITCHES to 1 (ENABLED)\n'); + local_setPV('BPMx','SWITCHING_ENABLE_CMD',1,varargin{:}); + local_setPV('BPMx','SWITCHING_SOURCE_CMD',1,varargin{:}); + local_setPV('BPMx','SWITCHING_DELAY_SP',0,varargin{:}); + + % Digital signal conditioning + fprintf('Turning _ON_ DSC\n'); + local_setPV('BPMx','DSC_COEFF_ADJUST_CMD',1,varargin{:}); + local_setPV('BPMx','DSC_COEFF_TYPE_CMD',2,varargin{:}); %0-PHASE, 1-AMPLITUDE, 2-ADJUST + local_setPV('BPMx','DSC_COEFF_ATT_DEPENDENT_CMD',0,varargin{:}); + + % Gain + fprintf('Setting GAINS \n'); + local_setPV('BPMx','KX_SP',14.8e6,varargin{:}); + local_setPV('BPMx','KY_SP',15.1e6,varargin{:}); + % local_setPV('BPMx','KS_SP',67108864,varargin{:}); + local_setPV('BPMx','KS_SP',mysrbpm.ks(el),varargin{:}); + + % Libera Offsets + [libera_offset_x, libera_offset_y] = mysrbpm.getarchivedoffsets('last'); + fprintf('Setting Libera Offsets \n'); + local_setPV('BPMx','OFF_X_SP',libera_offset_x(el),varargin{:}); + local_setPV('BPMx','OFF_Y_SP',libera_offset_y(el),varargin{:}); + local_setPV('BPMx','OFF_S_SP',mysrbpm.sumoffset(el),varargin{:}); + + % Interlock + fprintf('Setting INTERLOCKS \n'); +% gain_threshold = [... +% -23 -22 -23 -21 -21 -23 -23, ... % +% -23 -22 -29 -27 -28 -27 -27, ... % +% -29 -29 -31 -30 -31 -31 -31, ... % +% -25 -26 -26 -26 -26 -22 -22, ... % +% -23 -24 -25 -24 -23 -22 -21, ... % +% -30 -30 -32 -31 -31 -27 -26, ... % +% -33 -33 -34 -34 -33 -29 -29, ... % +% -28 -28 -29 -29 -28 -26 -24, ... % +% -26 -25 -27 -26 -27 -26 -23, ... % +% -26 -28 -29 -29 -29 -26 -26, ... % +% -26 -26 -27 -27 -27 -28 -26, ... % +% -28 -28 -29 -30 -30 -30 -30, ... % +% -24 -25 -25 -23 -23 -22 -23, ... % +% -24 -23 -24 -25 -25 -26 -25, ... % +% ]' + 3 ; gain_threshold(gain_threshold<-32) = -32; + % For the new Brilliance+ the gain table is quite coarse and + % our 10dB singal range due to cable lengths means that we have + % to have a lower threshold + gain_threshold = repmat(-32,size(libera_offset_y)); + local_setPV('BPMx','ILK_LIMITS_MIN_X_SP',-1e6,deviceList); + local_setPV('BPMx','ILK_LIMITS_MIN_Y_SP',-1e6,deviceList); + local_setPV('BPMx','ILK_LIMITS_MAX_X_SP',+1e6,deviceList); + local_setPV('BPMx','ILK_LIMITS_MAX_Y_SP',+1e6,deviceList); + local_setPV('BPMx','ILK_GAIN_DEPENDENT_THRESHOLD_SP',gain_threshold(el),deviceList); + + % Index into deviceList for those that need to be interlocked + % and those that don't need to + ii_ikl = sort([find(deviceList(:,2) == 1 | deviceList(:,2) == 7); findrowindex([2 2; 2 3],getlist('BPMx'))]); + ii_noilk = setxor(ii_ikl,1:size(deviceList,1)); + + % ILK_GAIN_DEPENDENT_ENABLED_CMD must come first before + % ILK_ENABLED_CMD otherwise you risk dumping beam!! + local_setPV('BPMx','ILK_GAIN_DEPENDENT_ENABLED_CMD',1,deviceList(ii_ikl,:)); + local_setPV('BPMx','ILK_ENABLED_CMD',1,deviceList(ii_ikl,:)); + + % Disable the interlocks for those that we do not need. + local_setPV('BPMx','ILK_ENABLED_CMD',0,deviceList(ii_noilk,:)); + local_setPV('BPMx','ILK_GAIN_DEPENDENT_ENABLED_CMD',0,deviceList(ii_noilk,:)); + + local_setPV('BPMx','ILK_STATUS_RESET_CMD',0,deviceList); + + delay=[ + 29 102 188 288 356 461 514 545 479 421 354 299 204 134 + 25 101 189 290 358 462 517 545 479 421 355 300 206 133 + 27 115 193 294 361 465 518 549 484 424 358 302 203 138 + 26 113 192 292 360 465 520 550 482 423 358 303 204 137 + 4 89 169 271 337 447 491 527 459 401 334 282 181 113 + 7 89 172 261 333 436 494 519 457 396 337 284 180 116 + 7 90 171 263 333 438 495 521 455 395 339 284 178 117]; + + % Commands to easily adjust the libera parameters +% setpv('BPMx','TRIG_DELAY_SP',delay(:)); +% setpv('BPMx','TBT_PHASE_OFFSET_SP',40); + + local_setPV('BPMx','TRIG_DELAY_SP',delay(el),deviceList); % Send default + % SR02BPM01:TBT_TBT_WINDOW.ChannelA --> set offset so that data 1 to 86 is + % used for turn 1, 87 to 172 for turn 2, etc. + % With an offset of 20, we make sure that injecting in bucket 1 + % is always within the "turn" integration window. + local_setPV('BPMx','TBT_PHASE_OFFSET_SP',20,varargin{:}); + + + % Setting whether to use DDC (0) or TDP (1) tbt data for decimated data + local_setPV('BPMx','TBT_DATA_TYPE_CMD',0,varargin{:}); + + % After setting the mask it this result can be seen on the TBT_TBT_WINDOW + % !!!!!!! Below does not work yet !!!!!!!!!!!!!!!! + % setpv('BPMx','TBT_ADC_MASK',ones(98,86)); % zero or one to mask the ADC samples to use to calculate TBT data + % setpv('BPMx','TBT_ADC_MASK',repmat([zeros(43,1); ones(43,1)],1,98)'); + + % Post mortem + %info PM signal arrives ~78.5 SROC after event (6752 ADC Clocks) + fprintf('Setting PM \n'); + local_setPV('BPMx','PM_CAPTURE_CMD',1,varargin{:}); %Enable PM Capture + local_setPV('BPMx','PM_SOURCE_SELECT_CMD',0,varargin{:}); %Select external Trigger + % Collects data from -20000 turns to trigger point. Therefore + % an offset of 2000 means that it collects data from -18000 to + % +2000 where 0 is when the trigger occured. + local_setPV('BPMx','PM_OFFSET_SP',10000,varargin{:}); + + % Disable Spike removal for now ET 5/9/2017 + % to re-enable we will have to also do a BBA with them enabled. + % There is something to be gained by enabling the FA spike + % removal as this should further drop the noise floor for the + % FA data. HOWEVER we will need to do a BBA or re-calibrate the + % offsets immediately after enabling this feature. We can do + % this by doing a orbit before and orbit after to calculate the + % necessary changes to the offsets. + % the spike removal from TBT data however is questionable as + % it adds unwanted features in the spectrum when you do an FFT. + fprintf('Setting spike removal DISABLE\n'); + local_setPV('BPMx','TBT_SR_TBT_ENABLE_CMD',0,varargin{:}); + local_setPV('BPMx','TBT_SR_FA_ENABLE_CMD',0,varargin{:}); + + % Set the libera IDs (careful as this will affect the FOFB) + fprintf('Setting data BPM unique IDs\n'); + ids = dev2elem('BPMx',varargin{:}); + local_setPV('BPMx','ID_SP',ids,varargin{:}); + + % configure the statistics gathering + fprintf('Settingg the parameters for STATISTICS\n'); + local_setPV('BPMx','STAT_SA_STEP_SP',10,varargin{:}); + local_setPV('BPMx','STAT_SA_WINDOW_SP',100,varargin{:}); + local_setPV('BPMx','STAT_TBT_PERIOD_SP',5,varargin{:}); + local_setPV('BPMx','STAT_TBT_WINDOW_SP',1000,varargin{:}); + local_setPV('BPMx','STAT_TBT_MODE_CMD',1,varargin{:}); + + + fprintf('Setting data on demand PVs\n'); + % ACQM: now (1), Event (2), Stream (3) only for FA and SA + % SCAN: passive (0), Event (1-unused), i/O interupt (2), periodic (3-9) + % If SCAN==0 then sequence is .PROC --> [trigger] --> caget + % + % 29/01/2018:tane: as of now you have to set the scan to + % passive (0) first before changing the acquisition mode then + % resetting the scan mode to your desired scan. + fprintf(' - ADC_SIGNAL'); + local_setPV('BPMx','ADC_SIGNAL.SCAN',0 ,varargin{:}); + local_setPV('BPMx','ADC_SIGNAL.ACQM',2,varargin{:}); + local_setPV('BPMx','ADC_SIGNAL.SCAN',2,varargin{:}); +% local_setPV('BPMx','ADC_SIGNAL.SCAN',2,varargin{:}); + + fprintf(',TBT_TBT_WINDOW_SIGNAL'); + % The acqm must be now(1) and scan set to passive(0). + local_setPV('BPMx','TBT_TBT_WINDOW_SIGNAL.SCAN',0,varargin{:}); + local_setPV('BPMx','TBT_TBT_WINDOW_SIGNAL.ACQM',1,varargin{:}); + local_setPV('BPMx','TBT_TBT_WINDOW_SIGNAL.PROC',0,varargin{:}); + + fprintf(',DDC_RAW_SIGNAL'); + local_setPV('BPMx','DDC_RAW_SIGNAL.SCAN',0,varargin{:}); + local_setPV('BPMx','DDC_RAW_SIGNAL.ACQM',1,varargin{:}); + local_setPV('BPMx','DDC_RAW_SIGNAL.OFFS',23198,varargin{:}); % Offset relative to extraction trigger + + fprintf(',DDC_SYNTH_SIGNAL'); + local_setPV('BPMx','DDC_SYNTH_SIGNAL.SCAN',0,varargin{:}); + local_setPV('BPMx','DDC_SYNTH_SIGNAL.ACQM',2,varargin{:}); + local_setPV('BPMx','DDC_SYNTH_SIGNAL.SCAN',2,varargin{:}); + local_setPV('BPMx','DDC_SYNTH_SIGNAL.OFFS',23198,varargin{:}); % Offset relative to extraction trigger + + + fprintf(',TDP_SYNTH_SIGNAL'); + local_setPV('BPMx','TDP_SYNTH_SIGNAL.SCAN',0,varargin{:}); + local_setPV('BPMx','TDP_SYNTH_SIGNAL.ACQM',2,varargin{:}); + local_setPV('BPMx','TDP_SYNTH_SIGNAL.SCAN',2,varargin{:}); + local_setPV('BPMx','TDP_SYNTH_SIGNAL.OFFS',23198,varargin{:}); % Offset relative to extraction trigger + + fprintf(',PM_DDC_SYNTH_SIGNAL'); + local_setPV('BPMx','PM_DDC_SYNTH_SIGNAL.SCAN',0,varargin{:}); + local_setPV('BPMx','PM_DDC_SYNTH_SIGNAL.ACQM',2,varargin{:}); + local_setPV('BPMx','PM_DDC_SYNTH_SIGNAL.SCAN',2,varargin{:}); + local_setPV('BPMx','PM_DDC_SYNTH_SIGNAL.OFFS',0,varargin{:}); + + fprintf(',PM_DDC_RAW_SIGNAL'); + local_setPV('BPMx','PM_DDC_RAW_SIGNAL.SCAN',0,varargin{:}); + local_setPV('BPMx','PM_DDC_RAW_SIGNAL.ACQM',2,varargin{:}); + local_setPV('BPMx','PM_DDC_RAW_SIGNAL.SCAN',2,varargin{:}); + local_setPV('BPMx','PM_DDC_RAW_SIGNAL.OFFS',0,varargin{:}); + + % the proc pv doesn't appear to have a ca_put_callback. By + % default setpv in Matlab waits for a callback before returning + % therefore this part of the code will hang. +% local_setPV('BPMx','PM_DDC_SYNTH_MONITOR.PROC',0,varargin{:}); + + fprintf(' done.\n'); + + fprintf('Resetting MC PLL status monitor\n'); + mysrbpm.reset_pll_status; + + end + + %% Misc Functions + + function plotadcsynchronisation(varargin) + % plotadcsynchronisation + % + % function to plot the adc channels to see if the TRIG_DELAY + % and TBT_PHASE_OFFSET are set correctly. + fprintf('Collecting ADC data... '); + adc = getliberadata('ADC_SIGNAL'); + fprintf('TBT_TBT_WINDOW data... '); + tbtw = getliberadata('TBT_TBT_WINDOW_SIGNAL'); + fprintf('done.\n'); + + ii = 1:200; + + h = figure(301); + set(h,'Position',[1794 44 1147 1124]); + clf; + subplot(1,2,1); + surface(ii,[1:98]/7+1,adc.a(:,ii) + adc.b(:,ii) + adc.c(:,ii) + adc.d(:,ii)); + shading flat; + ylabel('BPM number'); + xlabel('Time (ADC samples)'); + title({'Sum ADC values';'Set TRIG_DELAY to align ADCs'},'Interpreter','None'); + axis tight; + + subplot(2,2,2); + plot(adc.a(1,ii),'.-'); + hold on; + plot(tbtw.a(1,ii),'r.-','LineWidth',1.5); + a = axis; + plot([86 86],[-16000 16000],'r--','LineWidth',1.5); + axis(a); + title({'BPM 1-1';'Set TBT_PHASE_OFFSET to put';'bunch train (red) within first 86 samples'}','Interpreter','None'); + legend('ADC','TBT TBT WINDOW'); + grid on; + xlabel('Time (ADC samples)'); + ylabel('Amplitude (Counts)'); + + subplot(2,2,4); + plot(adc.a(3,ii),'.-'); + hold on; + plot(tbtw.a(3,ii),'r.-','LineWidth',1.5); + a = axis; + plot([86 86],[-16000 16000],'r--','LineWidth',1.5); + axis(a); + title('BPM 1-3'); + grid on; + xlabel('Time (ADC samples)'); + ylabel('Amplitude (Counts)'); + end + + function plotadc(DeviceList) + % Function to plot the ADC values for a particular BPM + % srbpm.plotadc(DeviceList) + if nargin < 1 + error('%s.plotadc: requires a device list or element number as an input parameter',mfilename); + end + adc = getliberadata('ADC_SIGNAL',DeviceList); + + for i=1:size(adc.a,1) + h = figure(301); + clf; + ax(1) = subplot(2,2,1); + plot(adc.a(i,:)); + title('A'); xlabel('samples'); ylabel('counts'); grid on; + ax(2) = subplot(2,2,2); + plot(adc.b(i,:)); + title('B'); xlabel('samples'); ylabel('counts'); grid on; + ax(3) = subplot(2,2,3); + plot(adc.c(i,:)); + title('C'); xlabel('samples'); ylabel('counts'); grid on; + ax(4) = subplot(2,2,4); + plot(adc.d(i,:)); + title('D'); xlabel('samples'); ylabel('counts'); grid on; + + linkaxes(ax,'x'); + + % Create textbox + annotation(h,'textbox',... + [0.380853983415142 0.946275307747930 0.265826498520414 0.030100333883345],... + 'String',{sprintf('BPM [%02d, %02d]',adc.DeviceList(i,:))},... + 'HorizontalAlignment','Center','FontSize',11); + + if size(adc.a,1) > 1 + fprintf('Plotting for BPM [%02d, %02d]. Press any key to plot the next BPM...\n', adc.DeviceList(i,:)); + pause; + end + end + end + + function plotfillpattern + % Use the ADC data from the Libera B+ to extract the fill + % pattern. Data will only refresh when there is a trigger. + adc = getliberadata('ADC_SIGNAL'); + + inter_freq = 360/86 - 4; % expected intermediate freq + N2 = length(adc.a)/2; + ii = [1:(N2-1*256*2.25), (N2+1*256*2.25):(N2*2)]; + + % Quadrature mixing at the IF + br = cos(2*pi*inter_freq*(0:length(adc.a)-1)); + bi = sin(2*pi*inter_freq*(0:length(adc.a)-1)); + + mixa = abs(adc.a .* complex(br,bi)); + % a low pass filter + ffta = fftshift(fft(mixa,[],2)); + ffta(:,ii) = 0; + newa = ifft( ifftshift(ffta) ,[],2); + + mixb = abs(adc.b .* complex(br,bi)); + % a low pass filter + fftb = fftshift(fft(mixb,[],2)); + fftb(:,ii) = 0; + newb = ifft( ifftshift(fftb) ,[],2); + + mixc = abs(adc.c .* complex(br,bi)); + % a low pass filter + fftc = fftshift(fft(mixc,[],2)); + fftc(:,ii) = 0; + newc = ifft( ifftshift(fftc) ,[],2); + + mixd = abs(adc.d .* complex(br,bi)); + % a low pass filter + fftd = fftshift(fft(mixd,[],2)); + fftd(:,ii) = 0; + newd = ifft( ifftshift(fftd) ,[],2); + + + + dt = 8.377502778920296e-09; + t = (0:(N2*2-1))*dt * 1e6; + figure(8); clf; + plot(t,abs(real(newa(3,:)+newb(3,:)+newc(3,:)+newd(3,:))),'.-'); + hold on; + % Average over multiple revolutions and plot only one fill + % pattern. +% [newt,newtind]=sort(mod(t,0.72046520)); +% plot(newt, abs(real(newa(3,newtind)+newb(3,newtind)+newc(3,newtind)+newd(3,newtind))),'.-'); +% plot(t,abs(real(newb(3,:))),'.-'); + fpmdata = getfpm * 1.07 * max(ylim); + t = (0:359)*0.002 + 0.26; + plot(t, fpmdata); + xlim([0 1.5]); + grid on; + xlabel('Time (us)'); + ylabel('Amplitude (arb)'); + legend('Channel A+B+C+D','FPM'); + title('BPM 1-3'); + end + + function plotbetafunctions(varargin) + % Function that uses the TBT data during injection to extract + % the beta function. The caveat is that it looks for an + % injection event using the horizontal position. Makes the + % following analysis + % 1. remove DC component, takes the last 100 samples as the + % reference/DC component + % 2. find first sample where the horizontal orbit exceeds 500 + % um. + % 3. skips the first 10 samples as we assume this contains + % the kicker pulse. We only want the residual oscillations + % 4. use 200 samples and extract the fundamental spatial + % modes using SVD. Plot the amplitude function of the two + % modes sqrt( mode1^2 + mode2^2 ); + + mysrbpm = srbpm; + + data = getliberadata('TDP_SYNTH_SIGNAL'); + + x = data.x - mean(data.x(:,end-100:end),2); + y = data.y - mean(data.y(:,end-100:end),2); + + ix = find( abs(x(1,:)) > 500000 , 1, 'first') + 200; + iy = find( abs(x(1,:)) > 500000 , 1, 'first') + 30; + + if isempty(ix) + fprintf('No TBT betatron oscillations detected. Cannot plot beta functions.\n'); + return + end + + [ux,sx,vx]=svd(x(:,ix:ix+100)); + sx = diag(sx); + [uy,sy,vy]=svd(y(:,iy:iy+100)); + sy = diag(sy); + + mach = machine_at; + bpmind = family2atindex('BPMx'); + + figure(121); + clf; + subplot(2,1,1); + measbetax = mysrbpm.bpmgain(:,1).*( (ux(:,1) * sx(1)).^2 + (ux(:,2) * sx(2)).^2 ); + plot( mach.spos(bpmind), mach.betax(bpmind)/sum(mach.betax(bpmind)) * sum(measbetax) ,'--','LineWidth',2); + hold on; + plot( getspos('BPMx'), measbetax, '.-'); + xlabel('S (m)'); + ylabel('\beta_x (arb)'); + grid on; + xlim([0 216]); + + + subplot(2,1,2); + measbetay = mysrbpm.bpmgain(:,2).*( (uy(:,1) * sy(1)).^2 + (uy(:,2)* sy(2)).^2 ); + plot( mach.spos(bpmind), mach.betay(bpmind)/sum(mach.betay(bpmind)) * sum(measbetay) ,'--','LineWidth',2); + hold on; + plot( getspos('BPMx'), measbetay, '.-'); + xlabel('S (m)'); + ylabel('\beta_y (arb)'); + grid on; + xlim([0 216]); + + plotelementsat; + + subplot(2,1,2); + legend('Model (Normalised)','Extracted from TBT','Location','northoutside','Orientation','Horizontal'); + end + + function reset_pll_status(varargin) + % Function to reset the latched PLL status monitor + % srbpm.reset_pll_status([DeviceList]) + % + srbpm.setfield('EVRX_PLL_MAX_ERR_RESET_CMD',0,varargin{:}); + srbpm.setfield('EVRX_PLL_OS_UNLOCK_TIME_RESET_CMD',0,varargin{:}); + + end + + function varargout = printraftemps(varargin) + % table plots and/or returns the temperatures for all the BPMs + % temptable = printraftemps([DeviceList]) + if nargin > 0 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + for i=1:7 + raftemps{i} = local_getPV('BPMx', sprintf('ID_%d_VALUE',i), deviceList); + temp = char(local_getPV('BPMx',sprintf('ID_%d_NAME',i),deviceList)); + temp = strrep(temp,'-','_'); + temp = strrep(temp,'.','_'); + raftempnames{i} = ['Temp_', temp]; + end + rafrownames = strrep(cellstr(family2channel('BPMx',deviceList)),':SA_X_MONITOR',''); + + t = table(raftemps{:},'VariableNames',raftempnames,'RowNames',rafrownames); + if nargout > 0 + varargout{1} = t; + end + + end + + function varargout = getreferenceorbit(varargin) + % function to return the x and y reference orbits + % [xref, yref] = getreferenceorbit([DeviceList]) + % where xref and yref are the reference orbits that the orbit + % feedback system uses to stabilise the orbit. DeviceList + % defaults to all BPMs. + if nargin > 0 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + el = dev2elem('BPMx',deviceList); + + xref = getpv('SR00:X_REFERENCE_ORBIT_SP'); + yref = getpv('SR00:Y_REFERENCE_ORBIT_SP'); + + varargout{1} = xref(el); + if nargout > 1 + varargout{2} = yref(el); + end + + end + + function setreferenceorbit(xref, yref, varargin) + % function to set the x and y reference orbits + % setreferenceorbit(xref, yref, [DeviceList]) + % where xref and yref are the reference orbits that the orbit + % feedback system uses to stabilise the orbit. DeviceList + % defaults to all BPMs. + if nargin > 2 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + el = dev2elem('BPMx',deviceList); + + xref0 = getpv('SR00:X_REFERENCE_ORBIT_SP'); + yref0 = getpv('SR00:Y_REFERENCE_ORBIT_SP'); + + xref0(el) = xref; + yref0(el) = yref; + + setpv('SR00:X_REFERENCE_ORBIT_SP',xref0); + setpv('SR00:Y_REFERENCE_ORBIT_SP',yref0); + % Necessary to ensure that the FOFB updated with the new + % reference orbit + setpv('SR00FPGA01:X_REF_ORBIT_SP',xref0); + setpv('SR00FPGA01:Y_REF_ORBIT_SP',yref0); + end + + function stepreferenceorbit(dxref, dyref, varargin) + % function to set the x and y reference orbits + % stepreferenceorbit(dxref, dyref, [DeviceList]) + % where dxref and dyref are the incremental change in the + % reference orbits that the orbit feedback system uses to + % stabilise the orbit. DeviceList defaults to all BPMs. + if nargin > 2 && isnumeric(varargin{1}) + deviceList = varargin{1}; + else + deviceList = getlist('BPMx'); + end + el = dev2elem('BPMx',deviceList); + + xref0 = getpv('SR00:X_REFERENCE_ORBIT_SP'); + yref0 = getpv('SR00:Y_REFERENCE_ORBIT_SP'); + + xref0(el) = xref0(el) + dxref; + yref0(el) = yref0(el) + dyref; + + % Necessary to ensure that the FOFB updated with the new + % reference orbit + setpv('SR00FPGA01:X_REF_ORBIT_SP',xref0); + setpv('SR00FPGA01:Y_REF_ORBIT_SP',yref0); + + setpv('SR00:X_REFERENCE_ORBIT_SP',xref0); + setpv('SR00:Y_REFERENCE_ORBIT_SP',yref0); + + end + + + end + + %% Other Methods + methods + function obj = srbpm + obj.fullDeviceList = family2dev('BPMx','',0); + obj.bpmpvnames = cellstr(family2channel('BPMx',obj.fullDeviceList)); + obj.bpmpvnames = regexprep(obj.bpmpvnames,'SA_X_MONITOR','MYCOMMAND'); + obj.iocpvnames = regexprep(obj.bpmpvnames,'BPM0[1,2,3,4]','IOC41'); + obj.iocpvnames = regexprep(obj.iocpvnames,'BPM0[5,6,7,8]','IOC42'); + obj.ks = [ + 8.853144058638271 + 8.553306227504132 + 8.709132643088015 + 8.477664456962398 + 8.233688939144534 + 8.895346739566085 + 8.721513375075650 + 9.103217124052739 + 8.999880217452990 + 6.606422763758233 + 6.407833139336645 + 5.562751575849251 + 5.413825461056707 + 5.053280276363035 + 6.991592129366940 + 7.481833719548828 + 8.281085417262730 + 7.925489448484424 + 7.914870034764797 + 8.162522846617552 + 8.171564386392882 + 3.660878471680461 + 3.413765681521329 + 5.036065454589901 + 4.815456587262468 + 4.604935339579755 + 8.371365821865076 + 8.651566704317215 + 9.125604474249256 + 9.239282285827398 + 2.671642243071018 + 9.698171364999478 + 9.570043697681594 + 8.242264363336110 + 8.375851661989921 + 7.543909697039786 + 7.629795359470272 + 8.440516983045685 + 8.332406374729588 + 7.791323076737103 + 4.655329538099621 + 4.603700490577416 + 5.372786227190657 + 5.585528578962895 + 6.540146185660331 + 6.553028466806546 + 5.904565380688806 + 9.355732822203581 + 9.367068332590062 + 6.039076724951013 + 5.877083820690847 + 7.119030158217719 + 6.749281256413786 + 6.334805091123380 + 3.236166925518648 + 3.703253650372533 + 4.325761779448408 + 4.211005860626395 + 5.628944846571070 + 5.373084728836499 + 4.910786478512518 + 2.811053706835495 + 9.803054080498494 + 5.867845405424647 + 5.615183042150490 + 6.708891187270635 + 6.786661275722777 + 6.142381584574993 + 3.965525957698259 + 4.006345295554352 + 4.234393567820267 + 4.181619441099762 + 5.118671561855333 + 5.006864741800872 + 4.842279664109178 + 5.409323329157485 + 6.026071865507837 + 6.955325231431114 + 6.613194868350434 + 7.687788776692916 + 7.507718094764419 + 7.105881640403740 + 7.640416058346170 + 7.660964783297761 + 9.790246546623754 + 3.019178964094080 + 2.603690545016278 + 9.559704405793719 + 9.343961628044473 + 8.939288350455401 + 8.865611882508913 + 9.798036611388095 + 9.445557552438173 + 3.343369796160038 + 9.789639106597445 + 9.769521857642903 + 3.144556886316249 + 3.376069939210053]*1e7; + obj.sumoffset = [ + -37794968 + -33713000 + -35837667 + -32686512 + -29364150 + -38373965 + -36006511 + -41202651 + -39796127 + -7211087 + -4507444 + 6995619 + 9025526 + 13940586 + -12486410 + -19157585 + -30027606 + -25184305 + -25047272 + -28423461 + -28529769 + 32896940 + 36260764 + 14181087 + 17185244 + 20042584 + -31235587 + -35047966 + -41513719 + -43063319 + 46354078 + -49311153 + -47570392 + -29491103 + -31301076 + -19963944 + -21134002 + -32171762 + -30700330 + -23335674 + 19364488 + 20070222 + 9599938 + 6704088 + -6294716 + -6470263 + 2353816 + -44638423 + -44790333 + 513376 + 2716546 + -14186651 + -9155438 + -3527839 + 38646868 + -56088284 + 23886219 + 25445830 + 6129850 + 9612204 + 15898680 + 44488253 + -50722387 + 2846162 + 6284323 + -8604653 + -9660656 + -880406 + 28761466 + 28214592 + 25066359 + 25794402 + 13047079 + 14572006 + 16795486 + 9084446 + 694647 + -11958341 + -7299881 + -21931451 + -19483184 + -14015294 + -21294123 + -21564190 + -50551628 + 41638356 + 47290127 + -47417794 + -44470947 + -38961451 + -37959938 + -50661637 + -45861868 + 37215126 + -50549385 + -50266332 + 39943356 + -54711490 + ]; + obj.bpmgain = [ + 1.019790109888349 0.949249236697061 + 1.024345702167348 0.944567780180548 + 1.028407517410135 0.949971969517302 + 1.020991304026051 0.949754897634992 + 1.021849017694516 0.949577106063936 + 1.025037670416168 0.947907821687370 + 1.017501470167591 0.947592777966483 + 1.024632857704001 0.944949791219086 + 1.022079367144060 0.944685038931816 + 1.028511008951802 0.950372296240851 + 1.030136333826651 0.950350485323705 + 1.020682111166259 0.948336665697476 + 1.031556858365583 0.944907524436659 + 1.009291932163525 0.948464064620007 + 1.001278289551558 0.953965386019827 + 1.023103845670566 0.946160238296460 + 1.030402019475276 0.951593430397251 + 1.024146312673317 0.953414683578349 + 1.020729066883117 0.949077046775849 + 1.023846696209035 0.945414799066340 + 1.018143559950577 0.944143527629333 + 1.017925418129258 0.944617884435187 + 1.023412423446008 0.943081823899102 + 1.031924980084887 0.949018137851589 + 1.026382021997893 0.949941703778988 + 1.022458007452477 0.948457253608398 + 1.027280512177995 0.949214139867137 + 1.021997143239133 0.944288603523116 + 1.021074628188609 0.945520163985390 + 1.021691607862558 0.945829924189481 + 1.029941389181460 0.951970829792339 + 1.024481714154421 0.948857280999855 + 1.017871754557471 0.948878478965569 + 1.032758752996909 0.944015928733466 + 1.024448402969096 0.941102863729423 + 1.029698260057182 0.940474056955320 + 1.022693771154018 0.945973422540821 + 1.030544121758183 0.950547633996902 + 1.026212659683978 0.950647145431741 + 1.021407530136615 0.944867450035861 + 1.031619838497942 0.949141416218957 + 1.021382522307063 0.945342040171411 + 1.021057527546628 0.943223842692008 + 1.023746796550166 0.944275805748237 + 1.027538119417079 0.951558042146971 + 1.029456301004033 0.948490243940171 + 1.018177972100218 0.950573185796091 + 1.034452259395351 0.946740254185632 + 1.024147881810003 0.942881200945415 + 1.038325846809106 0.936561741800745 + 1.022572791412994 0.943006647874190 + 1.027122655196820 0.958706283595653 + 1.025506825923074 0.952733083899000 + 1.016215347893387 0.954396898514942 + 1.029273031839981 0.949011613738053 + 1.007064310784053 0.952589983950634 + 1.016318457809970 0.944735626524407 + 1.019237109964916 0.943936810762869 + 1.030792749899852 0.949791147416936 + 1.026964606033962 0.952633795347244 + 1.018846527268870 0.949914297621846 + 1.023960828093981 0.947513016431224 + 1.020223576489132 0.945300297769261 + 1.006519198340487 0.950645913942196 + 1.021513235834946 0.944912992629821 + 1.031792920092355 0.950142626826064 + 1.027376776130119 0.950682774407246 + 1.020884936363761 0.947392195057050 + 1.028636597037438 0.948004087742045 + 1.019025182396520 0.943955259689677 + 1.020545204425863 0.945517066632875 + 1.022885700217636 0.945411996357065 + 1.029142102233283 0.953451620100816 + 1.030005772502432 0.952283871955482 + 1.017581952880327 0.949416416849636 + 1.028470983014986 0.947735052660074 + 1.013344871828959 0.948743169882161 + 1.013532090189818 0.950370439122627 + 1.022328613980134 0.946130470255584 + 1.029026841823260 0.951594758454078 + 1.026216978697642 0.951406205219404 + 1.020289851575935 0.953767887022197 + 1.031488922711221 0.948220981231094 + 1.020132484357270 0.947084079353503 + 1.017546520163332 0.944178949835829 + 1.018594771147928 0.942441745340540 + 1.028679136500693 0.947776610642991 + 1.028410765350595 0.951171327672612 + 1.022751556141560 0.949473473570070 + 1.035406953996921 0.948267624382191 + 1.018176205632190 0.947973893186085 + 1.029789721519192 0.940961615137810 + 1.025537211988558 0.943228906137280 + 1.028086681301332 0.950763553589283 + 1.026763830522217 0.951615684296115 + 1.020705832577648 0.951536321031235 + 1.031131510436517 0.949371115034835 + 1.029865390300549 0.944310705084420]; + end + end +end + +%% Utility Functions + +function output = local_getPV(varargin) +% Wrapper for getpv to try add some error handling. + try + output = getpv(varargin{:}); + catch + warning('Problem using getpv. Are the BPMs online?'); + output = nan; + end +end + +function output = local_setPV(varargin) +% Wrapper for setpv to try add some error handling. +% try + output = setpv(varargin{:}); +% catch +% warning('Problem using setpv. Are the BPMs online?'); +% output = nan; +% end +end + + + + + + diff --git a/machine/ASP/StorageRing/bpm_scripts/tlibera_brilliance_bpm_form_20180720_155855.txt b/machine/ASP/StorageRing/bpm_scripts/tlibera_brilliance_bpm_form_20180720_155855.txt new file mode 100644 index 00000000..18b4f3c1 --- /dev/null +++ b/machine/ASP/StorageRing/bpm_scripts/tlibera_brilliance_bpm_form_20180720_155855.txt @@ -0,0 +1,108 @@ +# TLibera_Brilliance_BPM_Form +# + +SR08BPM01:SA_X_MONITOR +SR08BPM01:SA_Y_MONITOR +SR08BPM01:AGC_ATT_MONITOR +SR08BPM01:AGC_POWER_LEVEL_MONITOR +SR08BPM01:AGC_ENABLED_STATUS +SR08BPM01:AGC_ENABLED_CMD +SR08BPM01:AGC_ATT_SP +SR08BPM01:AGC_POWER_LEVEL_SP +SR08BPM01:DSC_COEFF_ADJUST_STATUS +SR08BPM01:DSC_COEFF_ATT_DEPENDENT_STATUS +SR08BPM01:SWITCHING_DELAY_MONITOR +SR08BPM01:SWITCHING_ENABLE_STATUS +SR08BPM01:SWITCHING_SOURCE_STATUS +SR08BPM01:DSC_COEFF_TYPE_STATUS +SR08BPM01:DSC_COEFF_ADJUST_CMD +SR08BPM01:DSC_COEFF_ADJUST_CMD +SR08BPM01:DSC_COEFF_ATT_DEPENDENT_CMD +SR08BPM01:DSC_COEFF_ATT_DEPENDENT_CMD +SR08BPM01:SWITCHING_ENABLE_CMD +SR08BPM01:SWITCHING_ENABLE_CMD +SR08BPM01:SWITCHING_SOURCE_CMD +SR08BPM01:SWITCHING_SOURCE_CMD +SR08BPM01:DSC_COEFF_TYPE_CMD +SR08BPM01:DSC_COEFF_TYPE_CMD +SR08BPM01:SWITCHING_DELAY_SP +SR08BPM01:ILK_ENABLED_STATUS +SR08BPM01:ILK_GAIN_DEPENDENT_ENABLED_STATUS +SR08BPM01:ILK_GAIN_DEPENDENT_THRESHOLD_MONITOR +SR08BPM01:ILK_GAIN_DEPENDENT_THRESHOLD_DB_MONITOR +SR08BPM01:ILK_LIMITS_MIN_X_MONITOR +SR08BPM01:ILK_LIMITS_MIN_Y_MONITOR +SR08BPM01:ILK_LIMITS_MAX_X_MONITOR +SR08BPM01:ILK_LIMITS_MAX_Y_MONITOR +SR08BPM01:ILK_LIMITS_OVF_THRESHOLD_MONITOR +SR08BPM01:ILK_LIMITS_OVF_MODE_STATUS +SR08BPM01:ILK_LIMITS_OVF_DURATION_MONITOR +SR08BPM01:ILK_STATUS_X_STATUS +SR08BPM01:ILK_STATUS_RESET_CMD +SR08BPM01:ILK_STATUS_ATTENUATOR_STATUS +SR08BPM01:ILK_STATUS_STATUS +SR08BPM01:ILK_STATUS_Y_STATUS +SR08BPM01:ILK_LIMITS_MAX_X_SP +SR08BPM01:ILK_LIMITS_MIN_Y_SP +SR08BPM01:ILK_LIMITS_MAX_Y_SP +SR08BPM01:ILK_LIMITS_MIN_X_SP +SR08BPM01:ILK_STATUS_RESET_CMD +SR08BPM01:ILK_ENABLED_CMD +SR08BPM01:ILK_GAIN_DEPENDENT_ENABLED_CMD +SR08BPM01:ILK_GAIN_DEPENDENT_ENABLED_CMD +SR08BPM01:ILK_GAIN_DEPENDENT_THRESHOLD_SP +SR08BPM01:ILK_LIMITS_OVF_DURATION_SP +SR08BPM01:ILK_LIMITS_OVF_THRESHOLD_SP +SR08BPM01:KX_MONITOR +SR08BPM01:KY_MONITOR +SR08BPM01:OFF_X_MONITOR +SR08BPM01:OFF_Y_MONITOR +SR08BPM01:OFF_S_MONITOR +SR08BPM01:OFF_Q_MONITOR +SR08BPM01:KS_MONITOR +SR08BPM01:MAXADC_MONITOR +SR08BPM01:OFF_S_SP +SR08BPM01:OFF_Q_SP +SR08BPM01:OFF_Y_SP +SR08BPM01:OFF_X_SP +SR08BPM01:KX_SP +SR08BPM01:KS_SP +SR08BPM01:KY_SP +SR08BPM01:STAT_SA_X_MEAN_MONITOR +SR08BPM01:STAT_SA_Y_MEAN_MONITOR +SR08BPM01:STAT_SA_Y_STD_MONITOR +SR08BPM01:STAT_SA_X_STD_MONITOR +SR08BPM01:STAT_TBT_Y_MEAN_MONITOR +SR08BPM01:STAT_TBT_Y_STD_MONITOR +SR08BPM01:STAT_TBT_X_STD_MONITOR +SR08BPM01:STAT_TBT_X_MEAN_MONITOR +SR08BPM01:STAT_TBT_MODE_STATUS +SR08BPM01:STAT_TBT_PERIOD_MONITOR +SR08BPM01:STAT_TBT_WINDOW_MONITOR +SR08BPM01:STAT_TBT_MODE_CMD +SR08BPM01:STAT_TBT_PERIOD_SP +SR08BPM01:STAT_TBT_WINDOW_SP +SR08BPM01:STAT_SA_WINDOW_MONITOR +SR08BPM01:STAT_SA_STEP_MONITOR +SR08BPM01:STAT_SA_WINDOW_SP +SR08BPM01:STAT_SA_STEP_SP +SR08BPM01:ID_MONITOR +SR08BPM01:ID_SP +SR08BPM01:TDP_SYNTH_SIGNAL.X +SR08BPM01:TDP_SYNTH_SIGNAL.Y +SR08BPM01:TDP_SYNTH_SIGNAL.Sum +SR08BPM01:TDP_SYNTH_SIGNAL.Va +SR08BPM01:TDP_SYNTH_SIGNAL.Vb +SR08BPM01:TDP_SYNTH_SIGNAL.Vc +SR08BPM01:TDP_SYNTH_SIGNAL.Vd +SR08BPM01:TDP_SYNTH_SIGNAL.SCAN +SR08BPM01:TDP_SYNTH_SIGNAL.ACQM +SR08BPM01:TDP_SYNTH_SIGNAL.MT +SR08BPM01:ADC_SIGNAL.SCAN +SR08BPM01:ADC_SIGNAL.ACQM +SR08BPM01:ADC_SIGNAL.ChannelB +SR08BPM01:ADC_SIGNAL.ChannelA +SR08BPM01:ADC_SIGNAL.ChannelD +SR08BPM01:ADC_SIGNAL.ChannelC + +# end diff --git a/machine/ASP/StorageRing/changeaspoptics.m b/machine/ASP/StorageRing/changeaspoptics.m index 1a59904f..34a68ceb 100644 --- a/machine/ASP/StorageRing/changeaspoptics.m +++ b/machine/ASP/StorageRing/changeaspoptics.m @@ -1,134 +1,134 @@ -function varargout = changeaspoptics(varargin) -% RING = CHANGEASPOPTICS([RING or 'model'],[number]) is used to change the -% optics of RING or if 'model' is specified then it will modify the lattice -% that is stored in the global variable THERING. If no string parameters -% are used then a list of options will be displayed for the user to -% interactively choose. - -if nargin >= 1 - usemodel = 0; - RING = {}; - if iscell(varargin{1}) - RING = varargin{1}; - FAMLIST = buildfamlist(RING); - elseif strcmpi(varargin{1},'model') - global THERING FAMLIST - RING = THERING; - usemodel = 1; - end -else - fprintf('\nRING not defined. See help below for more info\n\n'); - help changeaspoptics - return -end - -if nargin >= 2 & isnumeric(varargin{2}) - selection = varargin{2}; -else - selection = menu('Choose the optics for the ASP SR lattice',... - '[13.3 5.2] 0.00 disp [0.0 0.0] chrom (+-14)',... - '[13.3 5.2] 0.10 disp [0.0 0.0] chrom (+-14)',... - '[13.3 5.2] 0.24 disp [0.0 0.0] chrom (+-14)',... - '[13.3 5.2] 0.00 disp [1.0 1.0] chrom (+-14)',... - '[13.3 5.2] 0.10 disp [1.0 1.0] chrom (+-14)',... - '[13.3 5.2] 0.24 disp [1.0 1.0] chrom (+-14)'); -end - -% Make parameter groups for the major magnet families. -qfa = mkparamgroup(RING,'qfa','K'); -qda = mkparamgroup(RING,'qda','K'); -qfb = mkparamgroup(RING,'qfb','K'); -sfa = mkparamgroup(RING,'sfa','K2'); -sda = mkparamgroup(RING,'sda','K2'); -sdb = mkparamgroup(RING,'sdb','K2'); -sfb = mkparamgroup(RING,'sfb','K2'); - - -switch selection - case 1 - qfaval = 1.7617410683215; - qdaval = -1.038377057025; - qfbval = 1.5338016353322; - sfaval = 1.400000e+001; - sdaval = -1.400000e+001; - sdbval = -7.0146346579091; - sfbval = 7.1893457157312; - case 2 - qfaval = 1.772006257777; - qdaval = -1.038979133445; - qfbval = 1.5282806930542; - sfaval = 1.400000e+001; - sdaval = -1.400000e+001; - sdbval = -7.0943368258914; - sfbval = 7.0061440937644; - case 3 - qfaval = 1.788288337253; - qdaval = -1.040097688513; - qfbval = 1.5198075294908; - sfaval = 1.400000e+001; - sdaval = -1.400000e+001; - sdbval = -7.719687342473; - sfbval = 6.9366519209212; - case 4 - qfaval = 1.7617410683215; - qdaval = -1.038377057025; - qfbval = 1.5338016353322; - sfaval = 1.400000e+001; - sdaval = -1.400000e+001; - sdbval = -7.2625874274048; - sfbval = 7.4301465642566; - case 5 - qfaval = 1.772006257777; - qdaval = -1.038979133445; - qfbval = 1.5282806930542; - sfaval = 1.400000e+001; - sdaval = -1.400000e+001; - sdbval = -7.4114847309303; - sfbval = 7.3195664597002; - case 6 - qfaval = 1.788288337253; - qdaval = -1.040097688513; - qfbval = 1.5198075294908; - sfaval = 1.400000e+001; - sdaval = -1.400000e+001; - sdbval = -8.2576610441099; - sfbval = 7.4837072741028; - otherwise - disp('Invalid selection!!'); -end - -RING = setparamgroup(RING,qfa,qfaval); -RING = setparamgroup(RING,qda,qdaval); -RING = setparamgroup(RING,qfb,qfbval); -RING = setparamgroup(RING,sfa,sfaval); -RING = setparamgroup(RING,sda,sdaval); -RING = setparamgroup(RING,sdb,sdbval); -RING = setparamgroup(RING,sfb,sfbval); - -if usemodel - THERING = RING; -else - varargout{1} = RING; -end - - - - - -function FAMLIST = buildfamlist(RING) - -elnames = {}; -elfamilies = {}; -for i=1:length(RING) - elnames{i} = RING{i}.FamName; -end -elfamilies = unique(elnames); - -FAMLIST = {}; -for i=1:length(elfamilies) - FAMLIST{i}.FamName = elfamilies{i}; - FAMLIST{i}.KidsList = findcells(RING,'FamName',elfamilies{i}); - FAMLIST{i}.NumKids = length(FAMLIST{i}.KidsList); - FAMLIST{i}.ElemData = RING{FAMLIST{i}.KidsList(1)}; -end - +function varargout = changeaspoptics(varargin) +% RING = CHANGEASPOPTICS([RING or 'model'],[number]) is used to change the +% optics of RING or if 'model' is specified then it will modify the lattice +% that is stored in the global variable THERING. If no string parameters +% are used then a list of options will be displayed for the user to +% interactively choose. + +if nargin >= 1 + usemodel = 0; + RING = {}; + if iscell(varargin{1}) + RING = varargin{1}; + FAMLIST = buildfamlist(RING); + elseif strcmpi(varargin{1},'model') + global THERING FAMLIST + RING = THERING; + usemodel = 1; + end +else + fprintf('\nRING not defined. See help below for more info\n\n'); + help changeaspoptics + return +end + +if nargin >= 2 & isnumeric(varargin{2}) + selection = varargin{2}; +else + selection = menu('Choose the optics for the ASP SR lattice',... + '[13.3 5.2] 0.00 disp [0.0 0.0] chrom (+-14)',... + '[13.3 5.2] 0.10 disp [0.0 0.0] chrom (+-14)',... + '[13.3 5.2] 0.24 disp [0.0 0.0] chrom (+-14)',... + '[13.3 5.2] 0.00 disp [1.0 1.0] chrom (+-14)',... + '[13.3 5.2] 0.10 disp [1.0 1.0] chrom (+-14)',... + '[13.3 5.2] 0.24 disp [1.0 1.0] chrom (+-14)'); +end + +% Make parameter groups for the major magnet families. +qfa = mkparamgroup(RING,'qfa','K'); +qda = mkparamgroup(RING,'qda','K'); +qfb = mkparamgroup(RING,'qfb','K'); +sfa = mkparamgroup(RING,'sfa','K2'); +sda = mkparamgroup(RING,'sda','K2'); +sdb = mkparamgroup(RING,'sdb','K2'); +sfb = mkparamgroup(RING,'sfb','K2'); + + +switch selection + case 1 + qfaval = 1.7617410683215; + qdaval = -1.038377057025; + qfbval = 1.5338016353322; + sfaval = 1.400000e+001; + sdaval = -1.400000e+001; + sdbval = -7.0146346579091; + sfbval = 7.1893457157312; + case 2 + qfaval = 1.772006257777; + qdaval = -1.038979133445; + qfbval = 1.5282806930542; + sfaval = 1.400000e+001; + sdaval = -1.400000e+001; + sdbval = -7.0943368258914; + sfbval = 7.0061440937644; + case 3 + qfaval = 1.788288337253; + qdaval = -1.040097688513; + qfbval = 1.5198075294908; + sfaval = 1.400000e+001; + sdaval = -1.400000e+001; + sdbval = -7.719687342473; + sfbval = 6.9366519209212; + case 4 + qfaval = 1.7617410683215; + qdaval = -1.038377057025; + qfbval = 1.5338016353322; + sfaval = 1.400000e+001; + sdaval = -1.400000e+001; + sdbval = -7.2625874274048; + sfbval = 7.4301465642566; + case 5 + qfaval = 1.772006257777; + qdaval = -1.038979133445; + qfbval = 1.5282806930542; + sfaval = 1.400000e+001; + sdaval = -1.400000e+001; + sdbval = -7.4114847309303; + sfbval = 7.3195664597002; + case 6 + qfaval = 1.788288337253; + qdaval = -1.040097688513; + qfbval = 1.5198075294908; + sfaval = 1.400000e+001; + sdaval = -1.400000e+001; + sdbval = -8.2576610441099; + sfbval = 7.4837072741028; + otherwise + disp('Invalid selection!!'); +end + +RING = setparamgroup(RING,qfa,qfaval); +RING = setparamgroup(RING,qda,qdaval); +RING = setparamgroup(RING,qfb,qfbval); +RING = setparamgroup(RING,sfa,sfaval); +RING = setparamgroup(RING,sda,sdaval); +RING = setparamgroup(RING,sdb,sdbval); +RING = setparamgroup(RING,sfb,sfbval); + +if usemodel + THERING = RING; +else + varargout{1} = RING; +end + + + + + +function FAMLIST = buildfamlist(RING) + +elnames = {}; +elfamilies = {}; +for i=1:length(RING) + elnames{i} = RING{i}.FamName; +end +elfamilies = unique(elnames); + +FAMLIST = {}; +for i=1:length(elfamilies) + FAMLIST{i}.FamName = elfamilies{i}; + FAMLIST{i}.KidsList = findcells(RING,'FamName',elfamilies{i}); + FAMLIST{i}.NumKids = length(FAMLIST{i}.KidsList); + FAMLIST{i}.ElemData = RING{FAMLIST{i}.KidsList(1)}; +end + diff --git a/machine/ASP/StorageRing/contattem1.mat b/machine/ASP/StorageRing/contattem1.mat deleted file mode 100644 index 39b1607fafd18be492c5a2eaf9ac3c5d4e1f72ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3846 zcmb7Hc|6qX9{!EdSQ0|W#mt~Ai5dGg42ooIWlO3Vq!co;3}I+wDB?(&EZJkMIpvU+ zv5Y8$8A@fz(!`uHIb@BlsjhoI_x3sW-1&Uwzwh(B&-43!-}il9J9B4@xdlvD0|B!$ zci!vk=YLWi=ID$qyZGBapmWl*4yRLGo0|lDGy(Qml{@bmA5%KxaLl2_&eZ68#Qc^Q z2A}T~f|GrhZf|E26Z^&h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te(f!d~pc3=g9nVBSUREkB@OTS@F442ZcsTy0Fuh*_0@+=b6=nhhL{wVA z=otW5UD{K}B{BR963BOw?+ka0HW(ISfBiK!jGYdf107gV3*r*|=L7FYo(CZnB}hv* zBW~_0iJ-P&usb0Tz+x2qo(nPET=Ub9H=!hiAA9MKopJ86n7fFKVwNO7dKtcxD#*nr V847;m5KP)nbw%TWzF 3) -% error('Incorrect number of inputs') -% end - - - -NE = length(CELLARRAY); -matchesfound = 0; -index = zeros(1,NE); -for I = 1:NE - if(isfield(CELLARRAY{I},field)) - matchesfound = matchesfound+1; - index(matchesfound) = I; - end -end - -index = index(1:matchesfound); -if(nargin > 2) - index1 = index; - matchesfound = 0; - for I = index - for j=1:length(varargin) -% if isequal(getfield(CELLARRAY{I},field),varargin{j}) - if regexpi(getfield(CELLARRAY{I},field),['^' varargin{j} '$']) - matchesfound = matchesfound+1; - % since 'matchesfound' counter is <= loop number, - % it is save to modify elements of 'index' inside the loop - index(matchesfound) = I; - - end - end - end - - index = index(1:matchesfound); -end - - +function index = findcells(CELLARRAY, field, varargin) +%FINDCELLS performs a search on MATLAB cell arrays of structures +% +% INDEX = FINDCELLS(CELLARRAY, 'field') +% returns indexes of elements that have a field named 'field' +% +% INDEX = FINDCELLS(CELLARRAY, 'field', VALUE1, VALUE2, ...) +% returns indexes of elements whose field 'field' +% is equal to VALUE1, VALUE2, ... or VALUEN. +% +% See also GETCELLSTRUCT, SETCELLSTRUCT, + +% Check if the first argument is the cell arrray of tstructures +if(~iscell(CELLARRAY) | ~isstruct(CELLARRAY{1}) | isempty(CELLARRAY)) + error('The first argument must be a non-empty cell array of structures') +end +% Chechk if the second argument is a string +if(~ischar(field)) + error('The second argument must be a character string') +end +% if(nargin > 3) +% error('Incorrect number of inputs') +% end + + + +NE = length(CELLARRAY); +matchesfound = 0; +index = zeros(1,NE); +for I = 1:NE + if(isfield(CELLARRAY{I},field)) + matchesfound = matchesfound+1; + index(matchesfound) = I; + end +end + +index = index(1:matchesfound); +if(nargin > 2) + index1 = index; + matchesfound = 0; + for I = index + for j=1:length(varargin) +% if isequal(getfield(CELLARRAY{I},field),varargin{j}) + if regexpi(getfield(CELLARRAY{I},field),['^' varargin{j} '$']) + matchesfound = matchesfound+1; + % since 'matchesfound' counter is <= loop number, + % it is save to modify elements of 'index' inside the loop + index(matchesfound) = I; + + end + end + end + + index = index(1:matchesfound); +end + + diff --git a/machine/ASP/StorageRing/generate_hwinit.m b/machine/ASP/StorageRing/generate_hwinit.m index f5ce8471..195a06ff 100644 --- a/machine/ASP/StorageRing/generate_hwinit.m +++ b/machine/ASP/StorageRing/generate_hwinit.m @@ -1,198 +1,198 @@ -function generate_hwinit(filename) - -% This function generates some of the more basic and repetitious aspects of -% creating an init file. -% -% Notes: When generating the string elements in the definitions below, they -% have to be all the same length. If the actual string is short you have to -% padd it with spaces. -% -% Eugene -filename = 'hwinit'; -skeleton_filename = 'hwinit_skeleton.m'; - -if ~exist('filename','var') - disp('Use: generate_hwinit([filaname]).'); - return -end - -[fin,message]=fopen(skeleton_filename,'r'); -if fin==-1 - disp([' WARNING: Unable to open file :' skeleton_filename]); - disp(message); - return -end -disp([' Reading skeleton file: ' skeleton_filename]); -skeleton_dir = fileparts(which(skeleton_filename)); - -filename = appendtimestamp(filename, now); -[fid,message]=fopen(fullfile(skeleton_dir,[filename '.m']),'w'); -if fid==-1 - disp([' WARNING: Unable to open file :' filename '.m']); - disp(message); - return -end -disp([' Writing init file to: ' filename '.m']); - -% Define some basic parameters and formatting. -n_cell = 14; -zeropad = 3; -namepad = 8; -chanpad = 24; -line = ''; - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ION PUMP CONTROLLERS -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% name channel name status device el -% vp={ -% '1vp1 ' 'SR-001-VP1 ' 1 [1,1] 1;... -while isempty(strfind(upper(line),'INSERT IPC HERE')) - if feof(fin) - error('Unexpected eof while looking for ''INSERT IPC HERE''') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('IPC\n'); - -n_percell = 3; -ionPumpFile = 'ionpumps.csv'; % File where PVs for ion pumps are stored. -pumpPVs = textread(ionPumpFile,'%s'); - -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'IPC' num2str(el_number)]; name = strpad(name, namepad); - chname = pumpPVs{(cell-1)*n_percell + i}; chname = strpad(chname, chanpad); % Skip the status pv names - stat = 1; - fprintf(fid,'''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... - name,chname,stat,cell,el_number,i); -end - -while isempty(strfind(upper(line),'INSERT IPC POSITION')) - if feof(fin) - error('Unexpected eof while looking for ''INSERT IPC POSITION''') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; - -% The position of VP has to be in a column vector -% base_ipc_positions_per_cell = [0 1.45 4.7661 6.1822 6.9983 8.6144 10.0305 11.3466 12.6627 13.9788]; -base_ipc_positions_per_cell = [0 6.9983 10.0305]; -fprintf(fid,'AO.IPC.Position = ['); -for i=1:n_cell - fprintf(fid,'%6.2f ', (i-1)*(216/n_cell) + base_ipc_positions_per_cell); - if i ~= n_cell - fprintf(fid,'\t...\n\t\t'); - else - fprintf(fid,'\t]'';\n'); - end -end - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% GAUGE CONTROLLERS -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% name channel name status device el -% vp={ -% '1vp1 ' 'SR-001-VP1 ' 1 [1,1] 1;... -while isempty(strfind(upper(line),'INSERT GC HERE')) - if feof(fin) - error('Unexpected eof while looking for ''INSERT GC HERE''') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('GC\n'); - -n_percell = 5; -ionPumpFile = 'gauges.csv'; % File where PVs for ion pumps are stored. -pumpPVs = textread(ionPumpFile,'%s'); - -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'GC' num2str(el_number)]; name = strpad(name, namepad); - chname = pumpPVs{(cell-1)*n_percell + i}; chname = strpad(chname, chanpad); % Skip the status pv names - stat = 1; - fprintf(fid,'''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... - name,chname,stat,cell,el_number,i); -end - -while isempty(strfind(upper(line),'INSERT GC POSITION')) - if feof(fin) - error('Unexpected eof while looking for ''INSERT GC POSITION''') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; - -% The position of VP has to be in a column vector -% base_ipc_positions_per_cell = [0 1.45 4.7661 6.1822 6.9983 8.6144 10.0305 11.3466 12.6627 13.9788]; -base_ipc_positions_per_cell = [10.0305-0.1, 10.0305, 10.0305+0.1, 12.6627-0.1, 12.6627]; -fprintf(fid,'AO.GC.Position = ['); -for i=1:n_cell - fprintf(fid,'%6.2f ', (i-1)*(216/n_cell) + base_ipc_positions_per_cell); - if i ~= n_cell - fprintf(fid,'\t...\n\t\t'); - else - fprintf(fid,'\t]'';\n'); - end -end - -% Continue to the end of the skeleton file -while ~feof(fin) - fprintf(fid,'%s',line); - line = fgets(fin); -end -fprintf(fid,'%s',line); - -fclose(fid); -fclose(fin); -disp('Finished updating hwinit') - - -%======================================== -function str = padzeros(val, charlen) - -numstring = num2str(val); -diff = charlen - length(numstring); -temp = ' '; -temp(1:charlen) = ' '; -if diff > 0 - temp(1:diff) = '0'; - temp(diff+1:charlen) = numstring; -elseif diff == 0 - temp = numstring; -elseif diff < 0 - error(['Increase ''zeropad'' by at least: ' num2str(abs(diff))]); -end - -str = temp; - - -%======================================== -function str = strpad(instring, charlen) - -diff = charlen - length(instring); -temp = ' '; -temp(1:charlen) = ' '; - -if diff > 0 - temp(1:end-diff) = instring; -elseif diff == 0 - temp = instring; -elseif diff < 0 - error(['Increase ''space padding'' for names and channel names by at least: ' num2str(abs(diff))]); -end - +function generate_hwinit(filename) + +% This function generates some of the more basic and repetitious aspects of +% creating an init file. +% +% Notes: When generating the string elements in the definitions below, they +% have to be all the same length. If the actual string is short you have to +% padd it with spaces. +% +% Eugene +filename = 'hwinit'; +skeleton_filename = 'hwinit_skeleton.m'; + +if ~exist('filename','var') + disp('Use: generate_hwinit([filaname]).'); + return +end + +[fin,message]=fopen(skeleton_filename,'r'); +if fin==-1 + disp([' WARNING: Unable to open file :' skeleton_filename]); + disp(message); + return +end +disp([' Reading skeleton file: ' skeleton_filename]); +skeleton_dir = fileparts(which(skeleton_filename)); + +filename = appendtimestamp(filename, now); +[fid,message]=fopen(fullfile(skeleton_dir,[filename '.m']),'w'); +if fid==-1 + disp([' WARNING: Unable to open file :' filename '.m']); + disp(message); + return +end +disp([' Writing init file to: ' filename '.m']); + +% Define some basic parameters and formatting. +n_cell = 14; +zeropad = 3; +namepad = 8; +chanpad = 24; +line = ''; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% ION PUMP CONTROLLERS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% name channel name status device el +% vp={ +% '1vp1 ' 'SR-001-VP1 ' 1 [1,1] 1;... +while isempty(strfind(upper(line),'INSERT IPC HERE')) + if feof(fin) + error('Unexpected eof while looking for ''INSERT IPC HERE''') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('IPC\n'); + +n_percell = 3; +ionPumpFile = 'ionpumps.csv'; % File where PVs for ion pumps are stored. +pumpPVs = textread(ionPumpFile,'%s'); + +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'IPC' num2str(el_number)]; name = strpad(name, namepad); + chname = pumpPVs{(cell-1)*n_percell + i}; chname = strpad(chname, chanpad); % Skip the status pv names + stat = 1; + fprintf(fid,'''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... + name,chname,stat,cell,el_number,i); +end + +while isempty(strfind(upper(line),'INSERT IPC POSITION')) + if feof(fin) + error('Unexpected eof while looking for ''INSERT IPC POSITION''') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; + +% The position of VP has to be in a column vector +% base_ipc_positions_per_cell = [0 1.45 4.7661 6.1822 6.9983 8.6144 10.0305 11.3466 12.6627 13.9788]; +base_ipc_positions_per_cell = [0 6.9983 10.0305]; +fprintf(fid,'AO.IPC.Position = ['); +for i=1:n_cell + fprintf(fid,'%6.2f ', (i-1)*(216/n_cell) + base_ipc_positions_per_cell); + if i ~= n_cell + fprintf(fid,'\t...\n\t\t'); + else + fprintf(fid,'\t]'';\n'); + end +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% GAUGE CONTROLLERS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% name channel name status device el +% vp={ +% '1vp1 ' 'SR-001-VP1 ' 1 [1,1] 1;... +while isempty(strfind(upper(line),'INSERT GC HERE')) + if feof(fin) + error('Unexpected eof while looking for ''INSERT GC HERE''') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('GC\n'); + +n_percell = 5; +ionPumpFile = 'gauges.csv'; % File where PVs for ion pumps are stored. +pumpPVs = textread(ionPumpFile,'%s'); + +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'GC' num2str(el_number)]; name = strpad(name, namepad); + chname = pumpPVs{(cell-1)*n_percell + i}; chname = strpad(chname, chanpad); % Skip the status pv names + stat = 1; + fprintf(fid,'''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... + name,chname,stat,cell,el_number,i); +end + +while isempty(strfind(upper(line),'INSERT GC POSITION')) + if feof(fin) + error('Unexpected eof while looking for ''INSERT GC POSITION''') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; + +% The position of VP has to be in a column vector +% base_ipc_positions_per_cell = [0 1.45 4.7661 6.1822 6.9983 8.6144 10.0305 11.3466 12.6627 13.9788]; +base_ipc_positions_per_cell = [10.0305-0.1, 10.0305, 10.0305+0.1, 12.6627-0.1, 12.6627]; +fprintf(fid,'AO.GC.Position = ['); +for i=1:n_cell + fprintf(fid,'%6.2f ', (i-1)*(216/n_cell) + base_ipc_positions_per_cell); + if i ~= n_cell + fprintf(fid,'\t...\n\t\t'); + else + fprintf(fid,'\t]'';\n'); + end +end + +% Continue to the end of the skeleton file +while ~feof(fin) + fprintf(fid,'%s',line); + line = fgets(fin); +end +fprintf(fid,'%s',line); + +fclose(fid); +fclose(fin); +disp('Finished updating hwinit') + + +%======================================== +function str = padzeros(val, charlen) + +numstring = num2str(val); +diff = charlen - length(numstring); +temp = ' '; +temp(1:charlen) = ' '; +if diff > 0 + temp(1:diff) = '0'; + temp(diff+1:charlen) = numstring; +elseif diff == 0 + temp = numstring; +elseif diff < 0 + error(['Increase ''zeropad'' by at least: ' num2str(abs(diff))]); +end + +str = temp; + + +%======================================== +function str = strpad(instring, charlen) + +diff = charlen - length(instring); +temp = ' '; +temp(1:charlen) = ' '; + +if diff > 0 + temp(1:end-diff) = instring; +elseif diff == 0 + temp = instring; +elseif diff < 0 + error(['Increase ''space padding'' for names and channel names by at least: ' num2str(abs(diff))]); +end + str = temp; \ No newline at end of file diff --git a/machine/ASP/StorageRing/generate_init.m b/machine/ASP/StorageRing/generate_init.m index 40985a3a..0f9c20d3 100644 --- a/machine/ASP/StorageRing/generate_init.m +++ b/machine/ASP/StorageRing/generate_init.m @@ -1,503 +1,503 @@ -function generate_init(filename) - -% This function generates some of the more basic and repetitious aspects of -% creating an init file. -% -% Notes: When generating the string elements in the definitions below, they -% have to be all the same length. If the actual string is short you have to -% padd it with spaces. -% -% Eugene -% ETan 14/12/04 Changed family names to coincide with controls definition -% of families. -% ETan 30/09/05 Added skew quads (SQ) and updated fields to be printed for -% version 4 of the lattice and ao init file. Cleaned up some of the fields -% to remove some redudent info that was left over from SPEAR that we don't -% use. -% ETan 01/06/06 Updating for new naming convention and the addition of -% other elements such as FTBPM (first turn bpm). Also removed some fields -% that are generated, eg range. At ASP most ranges are constant so no need -% for individual assignment. Removed DeltaResp and moved assignment to the -% end of the AO element definitions. This is for use with version 5 of the -% init skeleton file. - -filename = 'aspinit'; -skeleton_filename = 'aspinit_v5skeleton.m'; - -if ~exist('filename','var') - disp('Use: generate_init([filaname]).'); - return -end - -[fin,message]=fopen(skeleton_filename,'r'); -if fin==-1 - disp([' WARNING: Unable to open file :' skeleton_filename]); - disp(message); - return -end -disp([' Reading skeleton file: ' skeleton_filename]); -skeleton_dir = fileparts(which(skeleton_filename)); - -filename = appendtimestamp(filename, now); -[fid,message]=fopen(fullfile(skeleton_dir,[filename '.m']),'w'); -if fid==-1 - disp([' WARNING: Unable to open file :' filename '.m']); - disp(message); - return -end -disp([' Writing init file to: ' filename '.m']); - -% Some basic parameters -n_cell = 14; % Number of repeated sectors -zeropad = 3; % zero padding for numbers works eqally well with %03d -namepad = 8; % space padding for common names -chanpad = 25; % space padding for channel names - -line = ''; - -% Read and insert comment line to tell that the init file "parameters" have -% been generated from which version of the "skeleton" file. -while isempty(strfind(line,'% === Generated from ===')) - if feof(fin) - error('Unexpected eof while looking for "generated by" header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -fprintf(fid,'%s',line); -fprintf(fid,'%% %s\n',skeleton_filename); -line = fgets(fin); - -% BPM -% x-name x-chname xstat y-name y-chname ystat DevList Elem -% bpm={ -% '1BPMx1 ' 'SR01BPM01:H ' 1 '1BPMy1 ' 'SR01BPM01:V ' 1 [1,1] 1; ... -while isempty(strfind(upper(line),'INSERT BPM HERE')) - if feof(fin) - error('Unexpected eof while looking for BPM header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('BPMs\n'); -n_percell = 7; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - xname = sprintf('%dBPMx%d',cell,el_number); xname = strpad(xname, namepad); - xchname = sprintf('SR%02dBPM%02d:SA_HPOS_MONITOR',cell,el_number); xchname = strpad(xchname, chanpad); - yname = sprintf('%dBPMy%d',cell,el_number); yname = strpad(yname, namepad); - ychname = sprintf('SR%02dBPM%02d:SA_VPOS_MONITOR',cell,el_number); ychname = strpad(ychname, chanpad); - xstat = 1; ystat = 1; - fprintf(fid,'''%s''\t''%s''\t%d\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... - xname,xchname,xstat,yname,ychname,ystat,cell,el_number,i); -end - -% BPM -% x-name x-chname xstat y-name y-chname ystat DevList Elem -% bpm={ -% '1BPMx1 ' 'SR01BPM01:H ' 1 '1BPMy1 ' 'SR01BPM01:V ' 1 [1,1] 1; ... -while isempty(strfind(upper(line),'INSERT FT HERE')) - if feof(fin) - error('Unexpected eof while looking for FT header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('FT BPMs\n'); -n_percell = 7; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - xname = sprintf('%dFTx%d',cell,el_number); xname = strpad(xname, namepad); - xchname = sprintf('SR%02dBPM%02d:FT_HPOS_MONITOR',cell,el_number); xchname = strpad(xchname, chanpad); - yname = sprintf('%dBPMy%d',cell,el_number); yname = strpad(yname, namepad); - ychname = sprintf('SR%02dBPM%02d:FT_VPOS_MONITOR',cell,el_number); ychname = strpad(ychname, chanpad); - xstat = 1; ystat = 1; - fprintf(fid,'''%s''\t''%s''\t%d\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... - xname,xchname,xstat,yname,ychname,ystat,cell,el_number,i); -end - - -% Correctors -% -% NOTE: CHANGED THE STRUCTURE OF THE DEFINITION OF THE CORRECTRO MAGNETS. -% SPEAR USES INDIVIDUAL CORRECTORS THAT CAN BE CONFIGURED TO BE USED AS -% EITHER HORIZONTAL OR VERTICAL CORRECTORS. ASP CORRECTORS ARE BUILT INTO -% THE SEXTUPOLES AND ARE EFFICEVELY FIXED. THERE ARE 42 HORIZONTAL -% CORRECTORS AND 56 VERTICAL CORRECTORS. -% -% HW in ampere, Physics in radian. Respmat settings below AO definitions. -% x-common x-monitor x-setpoint stat devlist elem tol -% cor={ -% '1CX1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:CURRENT_SP' 1 -% '1CY1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:CURRENT_SP' 1 [1 ,1] 1 0.750 ; ... - -while isempty(strfind(upper(line),'INSERT HCM HERE')) - if feof(fin) - error('Unexpected eof while looking for HCM header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('HCM\n'); - -n_percell = 3; -vec = [1 5 9]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - xname = [num2str(cell) 'HCM' num2str(el_number)]; xname = strpad(xname, namepad); - xmon = sprintf('SR%02dCPS%02d:CURRENT_MONITOR',cell, vec(el_number)); xmon = strpad(xmon, chanpad); - xset = sprintf('SR%02dCPS%02d:CURRENT_SP',cell, vec(el_number)); xset = strpad(xset, chanpad); - xstat = 1; - % Range in amps and the response amplitude kicks are in radians. - tol = 1; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%5.3f\t; ...\n',... - xname,xmon,xset,xstat,cell,el_number,i,tol); -end - -while isempty(strfind(upper(line),'INSERT VCM HERE')) - if feof(fin) - error('Unexpected eof while looking for VCM header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('VCM\n'); - -n_percell = 4; -vec = [2 4 6 7]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - yname = [num2str(cell) 'VCM' num2str(el_number)]; yname = strpad(yname, namepad); - ymon = sprintf('SR%02dCPS%02d:CURRENT_MONITOR',cell, vec(el_number)); ymon = strpad(ymon, chanpad); - yset = sprintf('SR%02dCPS%02d:CURRENT_SP',cell, vec(el_number)); yset = strpad(yset, chanpad); - ystat = 1; - % Range in amps and the response amplitude kicks are in radians. - tol = 1; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%5.3f\t; ...\n',... - yname,ymon,yset,ystat,cell,el_number,i,tol); -end - - -% Magnets -%common desired monitor setpoint stat devlist elem scalefactor range tol respkick -% bend={ -% '1BEND1 ' 'SR-BD:CurrSetptDes ' 'SR-BD:Curr ' 'SR-BD:CurrSetpt ' 1 [1 ,1] 1 1.0 [0, 500] 0.050 0.05 ; ... -while isempty(strfind(upper(line),'INSERT BEND HERE')) - if feof(fin) - error('Unexpected eof while looking for BEND header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('BEND\n'); -n_percell = 2; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'BEND' num2str(el_number)]; name = strpad(name, namepad); - monitor = 'SR00DPS01:CURRENT_MONITOR'; monitor = strpad(monitor, chanpad); - setpoint= 'SR00DPS01:CURRENT_SP'; setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end - -%common desired monitor setpoint stat devlist elem scalefactor range tol respkick -% qf={ -% '2QF1 ' 'MS1-QF:CurrSetptDes ' 'MS1-QF:Curr ' 'MS1-QF:CurrSetpt ' 1 [2 ,1] 1 qf1to6factor [0, 500] 0.050 0.05; ... -while isempty(strfind(upper(line),'INSERT QFA HERE')) - if feof(fin) - error('Unexpected eof while looking for QFA header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('QFA\n'); -n_percell = 2; -vec = [1 6]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'QFA' num2str(el_number)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dQPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dQPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end -while isempty(strfind(upper(line),'INSERT QDA HERE')) - if feof(fin) - error('Unexpected eof while looking for QDB header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('QDA\n'); -n_percell = 2; -vec = [2 5]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'QDA' num2str(el_number)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dQPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dQPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end -while isempty(strfind(upper(line),'INSERT QFB HERE')) - if feof(fin) - error('Unexpected eof while looking for QFB header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('QFB\n'); -n_percell = 2; -vec = [3 4]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'QFB' num2str(el_number)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dQPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dQPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end - -% Sextupole -while isempty(strfind(upper(line),'INSERT SFA HERE')) - if feof(fin) - error('Unexpected eof while looking for SFA header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('SFA\n'); -n_percell = 2; -vec = [1 7]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'SFA' num2str(el_number)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end -while isempty(strfind(upper(line),'INSERT SDA HERE')) - if feof(fin) - error('Unexpected eof while looking for SDA header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('SDA\n'); -n_percell = 2; -vec = [2 6]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'SDA' num2str(el_number)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end -while isempty(strfind(upper(line),'INSERT SDB HERE')) - if feof(fin) - error('Unexpected eof while looking for SDB header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('SDB\n'); -n_percell = 2; -vec = [3 5]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'SDB' num2str(el_number)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end -while isempty(strfind(upper(line),'INSERT SFB HERE')) - if feof(fin) - error('Unexpected eof while looking for SFB header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('SFB\n'); -n_percell = 1; -vec = [4]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - name = [num2str(cell) 'SFB' num2str(el_number)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); - stat = 1; - scalefactor_tol = '1.0 0.05'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); -end - -% skew quadrupoles -while isempty(strfind(upper(line),'INSERT SKQ HERE')) - if feof(fin) - error('Unexpected eof while looking for SKQ header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('SKQ\n'); -n_percell = 2; -vec = [3 8]; -ntotal = n_percell*n_cell; -for i=1:ntotal - cell = ceil(i/n_percell); - el_number = mod(i,n_percell); - if el_number == 0 el_number = n_percell; end - yname = [num2str(cell) 'SKQ' num2str(el_number)]; yname = strpad(yname, namepad); - ymon = sprintf('SR%02dCPS%02d:CURRENT_MONITOR',cell, vec(el_number)); ymon = strpad(ymon, chanpad); - yset = sprintf('SR%02dCPS%02d:CURRENT_SP',cell, vec(el_number)); yset = strpad(yset, chanpad); - ystat = 1; - % Range in amps and the response amplitude kicks are in radians. - tol = '1'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - yname,ymon,yset,ystat,cell,el_number,i,tol); -end - -% Kickers -%common monitor setpoint stat devlist elem range tol -% kickeramp={ -% 'KICK1 ' 'SR-014-K1:PulseAmpl ' 'SR-014-K1:PulseAmplSetpt ' 1 [1 ,1] 1 [0 9] 0.10 ; ... -% 'KICK2 ' 'SR-014-K2:PulseAmpl ' 'SR-014-K2:PulseAmplSetpt ' 1 [1 ,2] 2 [0 9] 0.10 ; ... -% 'KICK3 ' 'SR-001-K3:PulseAmpl ' 'SR-001-K3:PulseAmplSetpt ' 1 [1 ,3] 3 [0 9] 0.10 ; ... -% 'KICK4 ' 'SR-001-K4:PulseAmpl ' 'SR-001-K4:PulseAmplSetpt ' 1 [1 ,4] 4 [0 9] 0.10 ; ... -% }; -while isempty(strfind(upper(line),'INSERT KICKERS HERE')) - if feof(fin) - error('Unexpected eof while looking for SFB header.') - end - fprintf(fid,'%s',line); - line = fgets(fin); -end -line = ''; -fprintf('KICKERS\n'); -n_kickers = 4; -sec = [14 1 1 2]; -vec = [1 1 2 1]; -for i=1:n_kickers - name = ['KICK' num2str(i)]; name = strpad(name, namepad); - monitor = sprintf('SR%02dKPS%02d:VOLTAGE_MONITOR',sec(i), vec(i)); monitor = strpad(monitor, chanpad); - setpoint = sprintf('SR%02dKPS%02d:VOLTAGE_SP',sec(i), vec(i)); setpoint = strpad(setpoint, chanpad); - stat = 1; - tol = '0.10'; - fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... - name,monitor,setpoint,stat,1,i,i,tol); -end - - -% Continue to the end of the skeleton file -while ~feof(fin) - fprintf(fid,'%s',line); - line = fgets(fin); -end -fprintf(fid,'%s',line); - -fclose(fid); -fclose(fin); -disp(['Finished updating ' filename]) - - -%======================================== -function str = padzeros(val, charlen) - -numstring = num2str(val); -diff = charlen - length(numstring); -temp = ' '; -temp(1:charlen) = ' '; -if diff > 0 - temp(1:diff) = '0'; - temp(diff+1:charlen) = numstring; -elseif diff == 0 - temp = numstring; -elseif diff < 0 - error(['Increase ''zeropad'' by at least: ' num2str(abs(diff))]); -end - -str = temp; - - -%======================================== -function str = strpad(instring, charlen) - -diff = charlen - length(instring); -temp = ' '; -temp(1:charlen) = ' '; - -if diff > 0 - temp(1:end-diff) = instring; -elseif diff == 0 - temp = instring; -elseif diff < 0 - error(['Increase ''space padding'' for names and channel names by at least: ' num2str(abs(diff))]); -end - +function generate_init(filename) + +% This function generates some of the more basic and repetitious aspects of +% creating an init file. +% +% Notes: When generating the string elements in the definitions below, they +% have to be all the same length. If the actual string is short you have to +% padd it with spaces. +% +% Eugene +% ETan 14/12/04 Changed family names to coincide with controls definition +% of families. +% ETan 30/09/05 Added skew quads (SQ) and updated fields to be printed for +% version 4 of the lattice and ao init file. Cleaned up some of the fields +% to remove some redudent info that was left over from SPEAR that we don't +% use. +% ETan 01/06/06 Updating for new naming convention and the addition of +% other elements such as FTBPM (first turn bpm). Also removed some fields +% that are generated, eg range. At ASP most ranges are constant so no need +% for individual assignment. Removed DeltaResp and moved assignment to the +% end of the AO element definitions. This is for use with version 5 of the +% init skeleton file. + +filename = 'aspinit'; +skeleton_filename = 'aspinit_v5skeleton.m'; + +if ~exist('filename','var') + disp('Use: generate_init([filaname]).'); + return +end + +[fin,message]=fopen(skeleton_filename,'r'); +if fin==-1 + disp([' WARNING: Unable to open file :' skeleton_filename]); + disp(message); + return +end +disp([' Reading skeleton file: ' skeleton_filename]); +skeleton_dir = fileparts(which(skeleton_filename)); + +filename = appendtimestamp(filename, now); +[fid,message]=fopen(fullfile(skeleton_dir,[filename '.m']),'w'); +if fid==-1 + disp([' WARNING: Unable to open file :' filename '.m']); + disp(message); + return +end +disp([' Writing init file to: ' filename '.m']); + +% Some basic parameters +n_cell = 14; % Number of repeated sectors +zeropad = 3; % zero padding for numbers works eqally well with %03d +namepad = 8; % space padding for common names +chanpad = 25; % space padding for channel names + +line = ''; + +% Read and insert comment line to tell that the init file "parameters" have +% been generated from which version of the "skeleton" file. +while isempty(strfind(line,'% === Generated from ===')) + if feof(fin) + error('Unexpected eof while looking for "generated by" header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +fprintf(fid,'%s',line); +fprintf(fid,'%% %s\n',skeleton_filename); +line = fgets(fin); + +% BPM +% x-name x-chname xstat y-name y-chname ystat DevList Elem +% bpm={ +% '1BPMx1 ' 'SR01BPM01:H ' 1 '1BPMy1 ' 'SR01BPM01:V ' 1 [1,1] 1; ... +while isempty(strfind(upper(line),'INSERT BPM HERE')) + if feof(fin) + error('Unexpected eof while looking for BPM header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('BPMs\n'); +n_percell = 7; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + xname = sprintf('%dBPMx%d',cell,el_number); xname = strpad(xname, namepad); + xchname = sprintf('SR%02dBPM%02d:SA_HPOS_MONITOR',cell,el_number); xchname = strpad(xchname, chanpad); + yname = sprintf('%dBPMy%d',cell,el_number); yname = strpad(yname, namepad); + ychname = sprintf('SR%02dBPM%02d:SA_VPOS_MONITOR',cell,el_number); ychname = strpad(ychname, chanpad); + xstat = 1; ystat = 1; + fprintf(fid,'''%s''\t''%s''\t%d\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... + xname,xchname,xstat,yname,ychname,ystat,cell,el_number,i); +end + +% BPM +% x-name x-chname xstat y-name y-chname ystat DevList Elem +% bpm={ +% '1BPMx1 ' 'SR01BPM01:H ' 1 '1BPMy1 ' 'SR01BPM01:V ' 1 [1,1] 1; ... +while isempty(strfind(upper(line),'INSERT FT HERE')) + if feof(fin) + error('Unexpected eof while looking for FT header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('FT BPMs\n'); +n_percell = 7; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + xname = sprintf('%dFTx%d',cell,el_number); xname = strpad(xname, namepad); + xchname = sprintf('SR%02dBPM%02d:FT_HPOS_MONITOR',cell,el_number); xchname = strpad(xchname, chanpad); + yname = sprintf('%dBPMy%d',cell,el_number); yname = strpad(yname, namepad); + ychname = sprintf('SR%02dBPM%02d:FT_VPOS_MONITOR',cell,el_number); ychname = strpad(ychname, chanpad); + xstat = 1; ystat = 1; + fprintf(fid,'''%s''\t''%s''\t%d\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t; ...\n',... + xname,xchname,xstat,yname,ychname,ystat,cell,el_number,i); +end + + +% Correctors +% +% NOTE: CHANGED THE STRUCTURE OF THE DEFINITION OF THE CORRECTRO MAGNETS. +% SPEAR USES INDIVIDUAL CORRECTORS THAT CAN BE CONFIGURED TO BE USED AS +% EITHER HORIZONTAL OR VERTICAL CORRECTORS. ASP CORRECTORS ARE BUILT INTO +% THE SEXTUPOLES AND ARE EFFICEVELY FIXED. THERE ARE 42 HORIZONTAL +% CORRECTORS AND 56 VERTICAL CORRECTORS. +% +% HW in ampere, Physics in radian. Respmat settings below AO definitions. +% x-common x-monitor x-setpoint stat devlist elem tol +% cor={ +% '1CX1 ' 'SR01CPS01:CURRENT_MONITOR' 'SR01CPS01:CURRENT_SP' 1 +% '1CY1 ' 'SR01CPS02:CURRENT_MONITOR' 'SR01CPS02:CURRENT_SP' 1 [1 ,1] 1 0.750 ; ... + +while isempty(strfind(upper(line),'INSERT HCM HERE')) + if feof(fin) + error('Unexpected eof while looking for HCM header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('HCM\n'); + +n_percell = 3; +vec = [1 5 9]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + xname = [num2str(cell) 'HCM' num2str(el_number)]; xname = strpad(xname, namepad); + xmon = sprintf('SR%02dCPS%02d:CURRENT_MONITOR',cell, vec(el_number)); xmon = strpad(xmon, chanpad); + xset = sprintf('SR%02dCPS%02d:CURRENT_SP',cell, vec(el_number)); xset = strpad(xset, chanpad); + xstat = 1; + % Range in amps and the response amplitude kicks are in radians. + tol = 1; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%5.3f\t; ...\n',... + xname,xmon,xset,xstat,cell,el_number,i,tol); +end + +while isempty(strfind(upper(line),'INSERT VCM HERE')) + if feof(fin) + error('Unexpected eof while looking for VCM header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('VCM\n'); + +n_percell = 4; +vec = [2 4 6 7]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + yname = [num2str(cell) 'VCM' num2str(el_number)]; yname = strpad(yname, namepad); + ymon = sprintf('SR%02dCPS%02d:CURRENT_MONITOR',cell, vec(el_number)); ymon = strpad(ymon, chanpad); + yset = sprintf('SR%02dCPS%02d:CURRENT_SP',cell, vec(el_number)); yset = strpad(yset, chanpad); + ystat = 1; + % Range in amps and the response amplitude kicks are in radians. + tol = 1; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%5.3f\t; ...\n',... + yname,ymon,yset,ystat,cell,el_number,i,tol); +end + + +% Magnets +%common desired monitor setpoint stat devlist elem scalefactor range tol respkick +% bend={ +% '1BEND1 ' 'SR-BD:CurrSetptDes ' 'SR-BD:Curr ' 'SR-BD:CurrSetpt ' 1 [1 ,1] 1 1.0 [0, 500] 0.050 0.05 ; ... +while isempty(strfind(upper(line),'INSERT BEND HERE')) + if feof(fin) + error('Unexpected eof while looking for BEND header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('BEND\n'); +n_percell = 2; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'BEND' num2str(el_number)]; name = strpad(name, namepad); + monitor = 'SR00DPS01:CURRENT_MONITOR'; monitor = strpad(monitor, chanpad); + setpoint= 'SR00DPS01:CURRENT_SP'; setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end + +%common desired monitor setpoint stat devlist elem scalefactor range tol respkick +% qf={ +% '2QF1 ' 'MS1-QF:CurrSetptDes ' 'MS1-QF:Curr ' 'MS1-QF:CurrSetpt ' 1 [2 ,1] 1 qf1to6factor [0, 500] 0.050 0.05; ... +while isempty(strfind(upper(line),'INSERT QFA HERE')) + if feof(fin) + error('Unexpected eof while looking for QFA header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('QFA\n'); +n_percell = 2; +vec = [1 6]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'QFA' num2str(el_number)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dQPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dQPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end +while isempty(strfind(upper(line),'INSERT QDA HERE')) + if feof(fin) + error('Unexpected eof while looking for QDB header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('QDA\n'); +n_percell = 2; +vec = [2 5]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'QDA' num2str(el_number)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dQPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dQPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end +while isempty(strfind(upper(line),'INSERT QFB HERE')) + if feof(fin) + error('Unexpected eof while looking for QFB header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('QFB\n'); +n_percell = 2; +vec = [3 4]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'QFB' num2str(el_number)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dQPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dQPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end + +% Sextupole +while isempty(strfind(upper(line),'INSERT SFA HERE')) + if feof(fin) + error('Unexpected eof while looking for SFA header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('SFA\n'); +n_percell = 2; +vec = [1 7]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'SFA' num2str(el_number)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end +while isempty(strfind(upper(line),'INSERT SDA HERE')) + if feof(fin) + error('Unexpected eof while looking for SDA header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('SDA\n'); +n_percell = 2; +vec = [2 6]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'SDA' num2str(el_number)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end +while isempty(strfind(upper(line),'INSERT SDB HERE')) + if feof(fin) + error('Unexpected eof while looking for SDB header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('SDB\n'); +n_percell = 2; +vec = [3 5]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'SDB' num2str(el_number)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end +while isempty(strfind(upper(line),'INSERT SFB HERE')) + if feof(fin) + error('Unexpected eof while looking for SFB header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('SFB\n'); +n_percell = 1; +vec = [4]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + name = [num2str(cell) 'SFB' num2str(el_number)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dSPS%02d:CURRENT_MONITOR',cell, vec(el_number)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dSPS%02d:CURRENT_SP',cell, vec(el_number)); setpoint = strpad(setpoint, chanpad); + stat = 1; + scalefactor_tol = '1.0 0.05'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,cell,el_number,i,scalefactor_tol); +end + +% skew quadrupoles +while isempty(strfind(upper(line),'INSERT SKQ HERE')) + if feof(fin) + error('Unexpected eof while looking for SKQ header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('SKQ\n'); +n_percell = 2; +vec = [3 8]; +ntotal = n_percell*n_cell; +for i=1:ntotal + cell = ceil(i/n_percell); + el_number = mod(i,n_percell); + if el_number == 0 el_number = n_percell; end + yname = [num2str(cell) 'SKQ' num2str(el_number)]; yname = strpad(yname, namepad); + ymon = sprintf('SR%02dCPS%02d:CURRENT_MONITOR',cell, vec(el_number)); ymon = strpad(ymon, chanpad); + yset = sprintf('SR%02dCPS%02d:CURRENT_SP',cell, vec(el_number)); yset = strpad(yset, chanpad); + ystat = 1; + % Range in amps and the response amplitude kicks are in radians. + tol = '1'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + yname,ymon,yset,ystat,cell,el_number,i,tol); +end + +% Kickers +%common monitor setpoint stat devlist elem range tol +% kickeramp={ +% 'KICK1 ' 'SR-014-K1:PulseAmpl ' 'SR-014-K1:PulseAmplSetpt ' 1 [1 ,1] 1 [0 9] 0.10 ; ... +% 'KICK2 ' 'SR-014-K2:PulseAmpl ' 'SR-014-K2:PulseAmplSetpt ' 1 [1 ,2] 2 [0 9] 0.10 ; ... +% 'KICK3 ' 'SR-001-K3:PulseAmpl ' 'SR-001-K3:PulseAmplSetpt ' 1 [1 ,3] 3 [0 9] 0.10 ; ... +% 'KICK4 ' 'SR-001-K4:PulseAmpl ' 'SR-001-K4:PulseAmplSetpt ' 1 [1 ,4] 4 [0 9] 0.10 ; ... +% }; +while isempty(strfind(upper(line),'INSERT KICKERS HERE')) + if feof(fin) + error('Unexpected eof while looking for SFB header.') + end + fprintf(fid,'%s',line); + line = fgets(fin); +end +line = ''; +fprintf('KICKERS\n'); +n_kickers = 4; +sec = [14 1 1 2]; +vec = [1 1 2 1]; +for i=1:n_kickers + name = ['KICK' num2str(i)]; name = strpad(name, namepad); + monitor = sprintf('SR%02dKPS%02d:VOLTAGE_MONITOR',sec(i), vec(i)); monitor = strpad(monitor, chanpad); + setpoint = sprintf('SR%02dKPS%02d:VOLTAGE_SP',sec(i), vec(i)); setpoint = strpad(setpoint, chanpad); + stat = 1; + tol = '0.10'; + fprintf(fid,'''%s''\t''%s''\t''%s''\t%d\t[%d,%d]\t%d\t%s\t; ...\n',... + name,monitor,setpoint,stat,1,i,i,tol); +end + + +% Continue to the end of the skeleton file +while ~feof(fin) + fprintf(fid,'%s',line); + line = fgets(fin); +end +fprintf(fid,'%s',line); + +fclose(fid); +fclose(fin); +disp(['Finished updating ' filename]) + + +%======================================== +function str = padzeros(val, charlen) + +numstring = num2str(val); +diff = charlen - length(numstring); +temp = ' '; +temp(1:charlen) = ' '; +if diff > 0 + temp(1:diff) = '0'; + temp(diff+1:charlen) = numstring; +elseif diff == 0 + temp = numstring; +elseif diff < 0 + error(['Increase ''zeropad'' by at least: ' num2str(abs(diff))]); +end + +str = temp; + + +%======================================== +function str = strpad(instring, charlen) + +diff = charlen - length(instring); +temp = ' '; +temp(1:charlen) = ' '; + +if diff > 0 + temp(1:end-diff) = instring; +elseif diff == 0 + temp = instring; +elseif diff < 0 + error(['Increase ''space padding'' for names and channel names by at least: ' num2str(abs(diff))]); +end + str = temp; \ No newline at end of file diff --git a/machine/ASP/StorageRing/getemit.m b/machine/ASP/StorageRing/getemit.m index cc729cf2..ec4cedee 100644 --- a/machine/ASP/StorageRing/getemit.m +++ b/machine/ASP/StorageRing/getemit.m @@ -1,82 +1,82 @@ -function gemit -% -% INPUTS -% 1. RING = e.g. THERING, or RINGData.Lattice from LOCO file. - -%GLOBVAL.E0 = 2.80e9; - -global THERING; - -THERING1 = THERING; - -%Change the integration method for Ohmi calculation -% BENDINDEX = findcells(THERING1, 'PassMethod', 'BendLinearPass'); -% for i = BENDINDEX -% THERING1{i}.PassMethod = 'BndMPoleSymplectic4RadPass'; -% THERING1{i}.NumIntSteps = 30; -% if THERING1{i}.K ~= THERING1{i}.PolynomB(2) -% THERING1{i}.K = THERING1{i}.PolynomB(2); -% end -% end -% -% QUADINDEX = findcells(THERING1, 'PassMethod', 'QuadLinearPass'); -% for i = QUADINDEX -% THERING1{i}.PassMethod = 'StrMPoleSymplectic4RadPass'; -% THERING1{i}.NumIntSteps = 30; -% if THERING1{i}.K ~= THERING1{i}.PolynomB(2) -% THERING1{i}.PolynomB(2)= THERING1{i}.K; -% end -% end -% -% SEXTINDEX = findcells(THERING1,'PassMethod', 'StrMPoleSymplectic4Pass'); -% for i = SEXTINDEX -% THERING1{i}.PassMethod = 'StrMPoleSymplectic4RadPass'; -% end - -BENDINDEX = findcells(THERING1, 'PassMethod', 'BndMPoleSymplectic4Pass'); -THERING1 = setcellstruct(THERING1,'PassMethod',BENDINDEX, 'BndMPoleSymplectic4RadPass'); -THERING1 = setcellstruct(THERING1,'Energy',BENDINDEX, 3e9); - -QUADINDEX = findcells(THERING1, 'PassMethod', 'QuadLinearPass'); -THERING1 = setcellstruct(THERING1,'PassMethod',QUADINDEX, 'StrMPoleSymplectic4RadPass'); -THERING1 = setcellstruct(THERING1,'Energy',QUADINDEX, 3e9); - -SEXTINDEX = findcells(THERING1,'PassMethod', 'StrMPoleSymplectic4Pass'); -THERING1 = setcellstruct(THERING1,'PassMethod',SEXTINDEX, 'StrMPoleSymplectic4RadPass'); -THERING1 = setcellstruct(THERING1,'Energy',SEXTINDEX, 3e9); - -RADELEMINDEX = sort([BENDINDEX QUADINDEX SEXTINDEX]); - -[ENV, sigP, DL] = ohmienvelope(THERING1, RADELEMINDEX, 1:length(THERING1)+1) -sigmas = cat(2, ENV.Sigma); tilt = cat(2, ENV.Tilt); -spos = findspos(THERING1, 1:length(THERING1)+1); - -figure(1); -plot(spos, tilt*180/pi, '.-'); -title('Beam Ellipse Rotation Angle [degrees]'); -set(gca, 'XLim', [0 spos(end)]); -xlabel('s-position [m]'); - -figure(2); -plot(spos, sigmas(1, :)); -title('Beam Ellipse Principal Axis [m]'); -xlabel('s-position [m]'); ylabel('Beam Size [m]'); - -% Get emittance from sigmax -refpts = 1:length(THERING1)+1; -[TwissData, tune, chrom] = twissring(THERING1, 0, refpts, 'chrom'); -for i = 1:length(refpts) - betax(i) = TwissData(i).beta(1); etax(i) = TwissData(i).Dispersion(1); - betay(i) = TwissData(i).beta(2); etay(i) = TwissData(i).Dispersion(2); -end -epsx = (sigmas(1,:).^2 - sigP^2.*etax.^2)./betax; -epsy = (sigmas(2,:).^2 - sigP^2.*etay.^2)./betay; -figure(3); -plot(spos, epsx); -title('Horizontal Emittance vs. s') - -figure(4); -plot(spos, epsy); -title('Vertical Emittance vs. s') - +function gemit +% +% INPUTS +% 1. RING = e.g. THERING, or RINGData.Lattice from LOCO file. + +%GLOBVAL.E0 = 2.80e9; + +global THERING; + +THERING1 = THERING; + +%Change the integration method for Ohmi calculation +% BENDINDEX = findcells(THERING1, 'PassMethod', 'BendLinearPass'); +% for i = BENDINDEX +% THERING1{i}.PassMethod = 'BndMPoleSymplectic4RadPass'; +% THERING1{i}.NumIntSteps = 30; +% if THERING1{i}.K ~= THERING1{i}.PolynomB(2) +% THERING1{i}.K = THERING1{i}.PolynomB(2); +% end +% end +% +% QUADINDEX = findcells(THERING1, 'PassMethod', 'QuadLinearPass'); +% for i = QUADINDEX +% THERING1{i}.PassMethod = 'StrMPoleSymplectic4RadPass'; +% THERING1{i}.NumIntSteps = 30; +% if THERING1{i}.K ~= THERING1{i}.PolynomB(2) +% THERING1{i}.PolynomB(2)= THERING1{i}.K; +% end +% end +% +% SEXTINDEX = findcells(THERING1,'PassMethod', 'StrMPoleSymplectic4Pass'); +% for i = SEXTINDEX +% THERING1{i}.PassMethod = 'StrMPoleSymplectic4RadPass'; +% end + +BENDINDEX = findcells(THERING1, 'PassMethod', 'BndMPoleSymplectic4Pass'); +THERING1 = setcellstruct(THERING1,'PassMethod',BENDINDEX, 'BndMPoleSymplectic4RadPass'); +THERING1 = setcellstruct(THERING1,'Energy',BENDINDEX, 3e9); + +QUADINDEX = findcells(THERING1, 'PassMethod', 'QuadLinearPass'); +THERING1 = setcellstruct(THERING1,'PassMethod',QUADINDEX, 'StrMPoleSymplectic4RadPass'); +THERING1 = setcellstruct(THERING1,'Energy',QUADINDEX, 3e9); + +SEXTINDEX = findcells(THERING1,'PassMethod', 'StrMPoleSymplectic4Pass'); +THERING1 = setcellstruct(THERING1,'PassMethod',SEXTINDEX, 'StrMPoleSymplectic4RadPass'); +THERING1 = setcellstruct(THERING1,'Energy',SEXTINDEX, 3e9); + +RADELEMINDEX = sort([BENDINDEX QUADINDEX SEXTINDEX]); + +[ENV, sigP, DL] = ohmienvelope(THERING1, RADELEMINDEX, 1:length(THERING1)+1) +sigmas = cat(2, ENV.Sigma); tilt = cat(2, ENV.Tilt); +spos = findspos(THERING1, 1:length(THERING1)+1); + +figure(1); +plot(spos, tilt*180/pi, '.-'); +title('Beam Ellipse Rotation Angle [degrees]'); +set(gca, 'XLim', [0 spos(end)]); +xlabel('s-position [m]'); + +figure(2); +plot(spos, sigmas(1, :)); +title('Beam Ellipse Principal Axis [m]'); +xlabel('s-position [m]'); ylabel('Beam Size [m]'); + +% Get emittance from sigmax +refpts = 1:length(THERING1)+1; +[TwissData, tune, chrom] = twissring(THERING1, 0, refpts, 'chrom'); +for i = 1:length(refpts) + betax(i) = TwissData(i).beta(1); etax(i) = TwissData(i).Dispersion(1); + betay(i) = TwissData(i).beta(2); etay(i) = TwissData(i).Dispersion(2); +end +epsx = (sigmas(1,:).^2 - sigP^2.*etax.^2)./betax; +epsy = (sigmas(2,:).^2 - sigP^2.*etay.^2)./betay; +figure(3); +plot(spos, epsx); +title('Horizontal Emittance vs. s') + +figure(4); +plot(spos, epsy); +title('Vertical Emittance vs. s') + clear THERING1; \ No newline at end of file diff --git a/machine/ASP/StorageRing/getkey.m b/machine/ASP/StorageRing/getkey.m index 6becc445..7055c803 100644 --- a/machine/ASP/StorageRing/getkey.m +++ b/machine/ASP/StorageRing/getkey.m @@ -1,62 +1,62 @@ -function ch = getkey(m) - -% GETKEY - get a single keypress -% CH = GETKEY waits for a keypress and returns the ASCII code. Accepts -% all ascii characters, including backspace (8), space (32), enter (13), -% etc, that can be typed on the keyboard. CH is a double. -% -% CH = GETKEY('non-ascii') uses non-documented matlab 6.5 features to -% return a string describing the key pressed so keys like ctrl, alt, tab -% etc. can also be used. CH is a string. -% -% This function is kind of a workaround for getch in C. It uses a modal, but -% non-visible window, which does show up in the taskbar. -% C-language keywords: KBHIT, KEYPRESS, GETKEY, GETCH -% -% Examples: -% -% fprintf('\nPress any key: ') ; -% ch = getkey ; -% fprintf('%c\n',ch) ; -% -% fprintf('\nPress the Ctrl-key: ') ; -% if strcmp(getkey('non-ascii'),'control'), -% fprintf('OK\n') ; -% else -% fprintf(' ... wrong key ...\n') ; -% end -% -% See also INPUT, CHAR - -% (c) 2005 Jos -% email jos @ jasen .nl -% Feel free to (ab)use, modify or change this contribution - - -% Determine the callback string to use -if nargin == 1, - if strcmp(lower(m),'non-ascii'), - callstr = ['set(gcbf,''Userdata'',get(gcbf,''Currentkey'')) ; uiresume '] ; - else - error('Argument should be the string ''non-ascii''') ; - end -else - callstr = ['set(gcbf,''Userdata'',double(get(gcbf,''Currentcharacter''))) ; uiresume '] ; -end - -% Set up the figure -% May be the position property should be individually tweaked to avoid visibility -fh = figure('keypressfcn',callstr, ... - 'windowstyle','modal',... - 'position',[0 0 1 1],... - 'Name','GETKEY', ... - 'userdata','timeout') ; -try - % Wait for something to happen - uiwait ; - ch = get(fh,'Userdata') ; -catch - % Something went wrong, return and empty matrix. - ch = [] ; -end -close(fh) ; +function ch = getkey(m) + +% GETKEY - get a single keypress +% CH = GETKEY waits for a keypress and returns the ASCII code. Accepts +% all ascii characters, including backspace (8), space (32), enter (13), +% etc, that can be typed on the keyboard. CH is a double. +% +% CH = GETKEY('non-ascii') uses non-documented matlab 6.5 features to +% return a string describing the key pressed so keys like ctrl, alt, tab +% etc. can also be used. CH is a string. +% +% This function is kind of a workaround for getch in C. It uses a modal, but +% non-visible window, which does show up in the taskbar. +% C-language keywords: KBHIT, KEYPRESS, GETKEY, GETCH +% +% Examples: +% +% fprintf('\nPress any key: ') ; +% ch = getkey ; +% fprintf('%c\n',ch) ; +% +% fprintf('\nPress the Ctrl-key: ') ; +% if strcmp(getkey('non-ascii'),'control'), +% fprintf('OK\n') ; +% else +% fprintf(' ... wrong key ...\n') ; +% end +% +% See also INPUT, CHAR + +% (c) 2005 Jos +% email jos @ jasen .nl +% Feel free to (ab)use, modify or change this contribution + + +% Determine the callback string to use +if nargin == 1, + if strcmp(lower(m),'non-ascii'), + callstr = ['set(gcbf,''Userdata'',get(gcbf,''Currentkey'')) ; uiresume '] ; + else + error('Argument should be the string ''non-ascii''') ; + end +else + callstr = ['set(gcbf,''Userdata'',double(get(gcbf,''Currentcharacter''))) ; uiresume '] ; +end + +% Set up the figure +% May be the position property should be individually tweaked to avoid visibility +fh = figure('keypressfcn',callstr, ... + 'windowstyle','modal',... + 'position',[0 0 1 1],... + 'Name','GETKEY', ... + 'userdata','timeout') ; +try + % Wait for something to happen + uiwait ; + ch = get(fh,'Userdata') ; +catch + % Something went wrong, return and empty matrix. + ch = [] ; +end +close(fh) ; diff --git a/machine/ASP/StorageRing/getquad.m b/machine/ASP/StorageRing/getquad.m index 7a6239da..c03aa619 100644 --- a/machine/ASP/StorageRing/getquad.m +++ b/machine/ASP/StorageRing/getquad.m @@ -1,29 +1,18 @@ -function [SP, AM] = getquad(QMS) -%GETQUAD - Get quadrupole setpoint (used by quadcenter) -% [SP, AM] = getquad(QMS) -% -% See also setquad, quadcenter - - -if nargin == 0 - error('At least 1 input is required'); -end - -QuadFamily = QMS.QuadFamily; -QuadDev = QMS.QuadDev; - -Mode = getfamilydata(QuadFamily,'Setpoint','Mode'); - -if strcmpi(Mode,'Simulator') - % Simulator - SP = getsp(QuadFamily, QuadDev); - if nargout >= 2 - AM = getam(QuadFamily, QuadDev); - end -else - % Online - SP = getsp(QuadFamily, QuadDev); - if nargout >= 2 - AM = getam(QuadFamily, QuadDev); - end -end \ No newline at end of file +function [SP, AM] = getquad(QMS) +% [SP, AM] = getquad(QMS) +% Used by quadcenter + + +if nargin < 1 + QuadFamily = 'QFA'; + QuadDev = [1 1]; +else + QuadFamily = QMS.QuadFamily; + QuadDev = QMS.QuadDev; +end + +SP = getsp(QuadFamily, QuadDev); + +if nargout >= 2 + AM = getam(QuadFamily, QuadDev); +end diff --git a/machine/ASP/StorageRing/gev2bend.m b/machine/ASP/StorageRing/gev2bend.m index 0744e5e7..20471cdc 100644 --- a/machine/ASP/StorageRing/gev2bend.m +++ b/machine/ASP/StorageRing/gev2bend.m @@ -1,221 +1,221 @@ -function Amps = gev2bend(varargin) -%GEV2BEND - Compute the energy based on the ramp tables -% Bend = gev2bend(Family, Field, GeV, DeviceList, BranchFlag) -% -% INPUTS -% 1. Bend - Bend magnet family {Optional} -% 2. Field - Field {Optional} -% 3. GeV - Electron beam energy [GeV] -% 4. DeviceList - Bend magnet device list to reference energy to {Default: BEND(1,1)} -% 5. BranchFlag - 1 -> Lower branch -% 2 -> Upper branch {Default} -% Not working at Spear yet -% -% OUTPUTS -% 1. Bend - Bend magnet current [Amps] -% -% Written by Greg Portmann - - -% Default -Family = ''; -Field = ''; -GeV = []; -DeviceList = []; -BranchFlag = []; -ModeFlag = ''; % model, online, manual -UnitsFlag = ''; % hardware, physics -for i = length(varargin):-1:1 - if isstruct(varargin{i}) - % Ignor structures - elseif iscell(varargin{i}) - % Ignor cells - elseif strcmpi(varargin{i},'struct') - varargin(i) = []; - elseif strcmpi(varargin{i},'numeric') - varargin(i) = []; - elseif strcmpi(varargin{i},'physics') - UnitsFlag = varargin{i}; - varargin(i) = []; - elseif strcmpi(varargin{i},'hardware') - UnitsFlag = varargin{i}; - varargin(i) = []; - elseif strcmpi(varargin{i},'simulator') | strcmpi(varargin{i},'model') - ModeFlag = varargin{i}; - varargin(i) = []; - elseif strcmpi(varargin{i},'online') - ModeFlag = varargin{i}; - varargin(i) = []; - elseif strcmpi(varargin{i},'manual') - ModeFlag = varargin{i}; - varargin(i) = []; - end -end - - -if length(varargin) >= 1 - if ischar(varargin{1}) - Family = varargin{1}; - varargin(1) = []; - else - GeV = varargin{1}; - varargin(1) = []; - if length(varargin) >= 1 - DeviceList = varargin{1}; - varargin(1) = []; - end - if length(varargin) >= 1 - BranchFlag = varargin{1}; - varargin(1:end) = []; - end - end -end -if length(varargin) >= 1 & ischar(varargin{1}) - Field = varargin{1}; - varargin(1) = []; -end -if length(varargin) >= 1 - GeV = varargin{1}; - varargin(1) = []; -end -if length(varargin) >= 1 - DeviceList = varargin{1}; - varargin(1) = []; -end -if length(varargin) >= 1 - BranchFlag = varargin{1}; - varargin(1) = []; -end - - -if isempty(Family) - Family = 'BEND'; -end -if isempty(Field) - Field = 'Setpoint'; -end - -if isempty(UnitsFlag) - UnitsFlag = getunits(Family); -end - -if isempty(GeV) - if isempty(ModeFlag) - ModeFlag = getmode(Family); - end - if strcmpi(ModeFlag,'simulator') | strcmpi(ModeFlag,'model') - GeV = getenergymodel; - else - error('GeV input required'); - end -end - -if isempty(DeviceList) - DeviceList = family2dev(Family); - if all(size(GeV)==[1 1]) - DeviceList = DeviceList(1,:); - end -end -if isempty(BranchFlag) - % Default is upper branch - BranchFlag = 2; -end - -% End of input checking -% Machine dependant stuff below - - -for ii = 1:size(DeviceList,1) - if length(GeV) == 1 - gev1 = GeV; - else - gev1 = GeV(ii); - end - - % Convert to BEND current - temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList(ii,:)); - C = temp{1}; - - % The function/curve used here is Energy vs Current and is calculated - % from tracking studies using a 2D field map. - splitind = size(C,2)/2; - I = C(1,1:splitind); - Energy = C(1,splitind+1:end); % in GeV - BEND = interp1(Energy,I,gev1,'linear','extrap'); - - if size(GeV,2) == 1 - Amps(ii,1) = BEND; - else - Amps(1,ii) = BEND; - end -end - - -if strcmpi(UnitsFlag,'Physics') - Amps = hw2physics(Family, 'Setpoint', Amps, DeviceList, GeV); -end - - - - -% % k is fixed to be -0.31537858 -% k = 0.31537858; -% -% % Convert to BEND angle -% if any(DeviceList(ii) == [1 9 10 18]) -% K2BendingAngle = 2.54842790129284 * -0.43947079695140; % BendAngle / K -% else -% K2BendingAngle = 2.54842790129284 * -0.58596106939159; % BendAngle / K -% end -% k = K2BendingAngle * k; -% -% bprime = k * brho; -% b0 = bprime * 0.392348; -% bl = b0; -% k = -k; -% -% -% % Solve for roots based on polynomial coefficient (coefficients already divided by Leff) -% % p = [C(1) C(2) C(3) C(4) C(5) C(6) C(7) C(8) C(9)-bl]; -% % C(9) = 0 -% -% p = C; -% p(9) = bl; -% %p = [c7 c6 c5 c4 c3 c2 c1 c0 -bl]; -% -% -% if 0 -% % Real and between 200-800 amps approach -% r = roots(p); -% -% pp = poly(r); -% -% for i = 1:8 -% if (imag(r(i))==0. & real(r(i))<800. & real(r(i))>200.); -% BEND = r(i); -% end -% end -% -% -% else -% % Closest to the linear line approach -% -% r1inear = -bl / C(end-1); -% -% r = roots(p); -% -% % Choose the closest solution to the linear one -% BEND = inf; -% for i = 1:length(r) -% if isreal(r(i)) -% %if r(i)>0 & abs(r(i)) < BEND(j,1) % Smallest, positive -% if abs(r(i) - r1inear) < abs(BEND - r1inear) % Closest to linear solution -% BEND = r(i); -% end -% end -% end -% -% if isinf(BEND) -% error(sprintf('Solution for GeV=%.3f not found (all roots are complex)', gev1)); -% end +function Amps = gev2bend(varargin) +%GEV2BEND - Compute the energy based on the ramp tables +% Bend = gev2bend(Family, Field, GeV, DeviceList, BranchFlag) +% +% INPUTS +% 1. Bend - Bend magnet family {Optional} +% 2. Field - Field {Optional} +% 3. GeV - Electron beam energy [GeV] +% 4. DeviceList - Bend magnet device list to reference energy to {Default: BEND(1,1)} +% 5. BranchFlag - 1 -> Lower branch +% 2 -> Upper branch {Default} +% Not working at Spear yet +% +% OUTPUTS +% 1. Bend - Bend magnet current [Amps] +% +% Written by Greg Portmann + + +% Default +Family = ''; +Field = ''; +GeV = []; +DeviceList = []; +BranchFlag = []; +ModeFlag = ''; % model, online, manual +UnitsFlag = ''; % hardware, physics +for i = length(varargin):-1:1 + if isstruct(varargin{i}) + % Ignor structures + elseif iscell(varargin{i}) + % Ignor cells + elseif strcmpi(varargin{i},'struct') + varargin(i) = []; + elseif strcmpi(varargin{i},'numeric') + varargin(i) = []; + elseif strcmpi(varargin{i},'physics') + UnitsFlag = varargin{i}; + varargin(i) = []; + elseif strcmpi(varargin{i},'hardware') + UnitsFlag = varargin{i}; + varargin(i) = []; + elseif strcmpi(varargin{i},'simulator') | strcmpi(varargin{i},'model') + ModeFlag = varargin{i}; + varargin(i) = []; + elseif strcmpi(varargin{i},'online') + ModeFlag = varargin{i}; + varargin(i) = []; + elseif strcmpi(varargin{i},'manual') + ModeFlag = varargin{i}; + varargin(i) = []; + end +end + + +if length(varargin) >= 1 + if ischar(varargin{1}) + Family = varargin{1}; + varargin(1) = []; + else + GeV = varargin{1}; + varargin(1) = []; + if length(varargin) >= 1 + DeviceList = varargin{1}; + varargin(1) = []; + end + if length(varargin) >= 1 + BranchFlag = varargin{1}; + varargin(1:end) = []; + end + end +end +if length(varargin) >= 1 & ischar(varargin{1}) + Field = varargin{1}; + varargin(1) = []; +end +if length(varargin) >= 1 + GeV = varargin{1}; + varargin(1) = []; +end +if length(varargin) >= 1 + DeviceList = varargin{1}; + varargin(1) = []; +end +if length(varargin) >= 1 + BranchFlag = varargin{1}; + varargin(1) = []; +end + + +if isempty(Family) + Family = 'BEND'; +end +if isempty(Field) + Field = 'Setpoint'; +end + +if isempty(UnitsFlag) + UnitsFlag = getunits(Family); +end + +if isempty(GeV) + if isempty(ModeFlag) + ModeFlag = getmode(Family); + end + if strcmpi(ModeFlag,'simulator') | strcmpi(ModeFlag,'model') + GeV = getenergymodel; + else + error('GeV input required'); + end +end + +if isempty(DeviceList) + DeviceList = family2dev(Family); + if all(size(GeV)==[1 1]) + DeviceList = DeviceList(1,:); + end +end +if isempty(BranchFlag) + % Default is upper branch + BranchFlag = 2; +end + +% End of input checking +% Machine dependant stuff below + + +for ii = 1:size(DeviceList,1) + if length(GeV) == 1 + gev1 = GeV; + else + gev1 = GeV(ii); + end + + % Convert to BEND current + temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList(ii,:)); + C = temp{1}; + + % The function/curve used here is Energy vs Current and is calculated + % from tracking studies using a 2D field map. + splitind = size(C,2)/2; + I = C(1,1:splitind); + Energy = C(1,splitind+1:end); % in GeV + BEND = interp1(Energy,I,gev1,'linear','extrap'); + + if size(GeV,2) == 1 + Amps(ii,1) = BEND; + else + Amps(1,ii) = BEND; + end +end + + +if strcmpi(UnitsFlag,'Physics') + Amps = hw2physics(Family, 'Setpoint', Amps, DeviceList, GeV); +end + + + + +% % k is fixed to be -0.31537858 +% k = 0.31537858; +% +% % Convert to BEND angle +% if any(DeviceList(ii) == [1 9 10 18]) +% K2BendingAngle = 2.54842790129284 * -0.43947079695140; % BendAngle / K +% else +% K2BendingAngle = 2.54842790129284 * -0.58596106939159; % BendAngle / K +% end +% k = K2BendingAngle * k; +% +% bprime = k * brho; +% b0 = bprime * 0.392348; +% bl = b0; +% k = -k; +% +% +% % Solve for roots based on polynomial coefficient (coefficients already divided by Leff) +% % p = [C(1) C(2) C(3) C(4) C(5) C(6) C(7) C(8) C(9)-bl]; +% % C(9) = 0 +% +% p = C; +% p(9) = bl; +% %p = [c7 c6 c5 c4 c3 c2 c1 c0 -bl]; +% +% +% if 0 +% % Real and between 200-800 amps approach +% r = roots(p); +% +% pp = poly(r); +% +% for i = 1:8 +% if (imag(r(i))==0. & real(r(i))<800. & real(r(i))>200.); +% BEND = r(i); +% end +% end +% +% +% else +% % Closest to the linear line approach +% +% r1inear = -bl / C(end-1); +% +% r = roots(p); +% +% % Choose the closest solution to the linear one +% BEND = inf; +% for i = 1:length(r) +% if isreal(r(i)) +% %if r(i)>0 & abs(r(i)) < BEND(j,1) % Smallest, positive +% if abs(r(i) - r1inear) < abs(BEND - r1inear) % Closest to linear solution +% BEND = r(i); +% end +% end +% end +% +% if isinf(BEND) +% error(sprintf('Solution for GeV=%.3f not found (all roots are complex)', gev1)); +% end % end \ No newline at end of file diff --git a/machine/ASP/StorageRing/insertscw.m b/machine/ASP/StorageRing/insertscw.m new file mode 100644 index 00000000..5ad25800 --- /dev/null +++ b/machine/ASP/StorageRing/insertscw.m @@ -0,0 +1,46 @@ +function varargout = id_insertscw(B) + +global THERING + +ii = findcells(THERING,'FamName','scw'); +if any(ii) + fprintf('SCW alreay in the lattice. Setting the field B = %f T.\n',B); + THERING{ii}.Bmax = B; + return +end + +lambda = 52e-3; + +elemdata.FamName = 'scw'; +elemdata.Length = lambda*63/2; +elemdata.Lw = lambda; +elemdata.Bmax = B; +elemdata.Nstep = 5; +elemdata.Nmeth = 4; % 2 or 4 for 2nd or 4th order. +elemdata.NHharm = 0; % Number of harmonics +elemdata.NVharm = 0; +elemdata.By = []; % Harmonic data [n C_n kx_n ky_n kz_n phiz_n] +elemdata.Bx = []; +elemdata.R1 = eye(6,6); +elemdata.R2 = eye(6,6); +elemdata.T1 = zeros(6,1); +elemdata.T2 = zeros(6,1); +elemdata.PassMethod = 'GWigSymplecticPass'; +elemdata.Energy = THERING{1}.Energy; + +n = 1; +kw = 2*pi/lambda; +kx = 10; +kz = n*kw; +ky = sqrt(kx^2 + kz^2); +tz = 0; +C = 1; + +elemdata.NHharm = 1; +elemdata.By = [1 C kx/kw ky/kw kz/kw tz]; + +idind = findcells(THERING,'FamName','id'); + +THERING{idind(8)} = elemdata; +THERING{idind(8)-1}.Length = THERING{idind(8)-1}.Length - elemdata.Length/2; +THERING{idind(8)+1}.Length = THERING{idind(8)+1}.Length - elemdata.Length/2; \ No newline at end of file diff --git a/machine/ASP/StorageRing/k2amp.m b/machine/ASP/StorageRing/k2amp.m index a9170723..f483e5b5 100644 --- a/machine/ASP/StorageRing/k2amp.m +++ b/machine/ASP/StorageRing/k2amp.m @@ -1,89 +1,89 @@ -function Amps = k2amp(Family, Field, k, DeviceList, Energy, C, K2AmpScaleFactor, varargin) -%K2AMP - Converts simulator values to amperes -% Amps = k2amp(Family, Field, k, DeviceList, Energy, Coefficients, K2AmpScaleFactor) -% or -% Amps = k2amp(Family, Field, k, DeviceList, Energy, MagnetCoreType, K2AmpScaleFactor) -% -% Calculates the current [amperes] from the coefficients (or -% MagnetCoreType), "K-value", energy, and linear scale factor -% -% For dipole: k = B / Brho -% For quadrupole: k = B'/ Brho -% For sextupole: k = B"/ Brho / 2 (to be compatible with AT) -% -% A curve vector or a MagnetCoreType string (current curves found from -% magnetcoefficents.m) can be used. Amps and Coefficients must have equal -% number of rows or one must only have one row. -% -% Energy can be anything getenergy accepts, like 'Model' or 'Online'. -% -% The K2AmpScaleFactor linearly scales the output current: Amps = K2AmpScaleFactor .* Amps -% -% If energy is not an input or empty, then the energy is read from the accelerator data object (AD) -% This can be used to account for linear calibration errors of the power supply and magnet -% -% NOTES -% 1. If energy is not an input or empty, then the energy is obtained from getenergy. -% 2. Family and Field inputs are not used but there automatically part of the physics2hw call. -% -% Original structure set up using polynomials by M. Yoon 4/8/03 -% Modified for ASP by E. Tan 31/05/2006 - -if nargin < 4 - error('At least 4 inputs required'); -end - -if nargin < 6 - C = []; -end -if isempty(C) - %[CC, Leff, MagnetName] = magnetcoefficients(Family); - temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList); - C = temp{1}; -end - -if nargin < 5 - Energy = []; -end -if isempty(Energy) - Energy = getenergy; -elseif ischar(Energy) - Energy = getenergy(Energy); -end - -% If k is a row vector make it a column vector -k = k(:); - -brho = getbrho(Energy); - -if isstr(C) - [C, Leff, MagnetName] = magnetcoefficients(C); -end - -if any(size(C,1) ~= length(k)) - if length(k) == 1 - k = ones(size(C,1),1) * k; - elseif size(C,1) == 1 - % Ok as is - %C = ones(size(k,1),1) * C; - else - error('k and Coefficients must have equal number of rows or one must only have one row'); - end -end - -% Simple interpolation function therefore assuming monotonic function -% for the magnets (which is reasonable) the it is a simple matter of -% reversing from B vs I to I vs B. -splitind = size(C,2)/2; -for i = 1:length(k) - if size(C,1) == 1 - Amps(i,1) = interp1(C(1,splitind+1:end),C(1,1:splitind),k(i)*brho,'linear','extrap'); - else - Amps(i,1) = interp1(C(i,splitind+1:end),C(i,1:splitind),k(i)*brho,'linear','extrap'); - end -end - -% Scale solution if required -if nargin >= 7 - Amps = Amps .* K2AmpScaleFactor; +function Amps = k2amp(Family, Field, k, DeviceList, Energy, C, K2AmpScaleFactor, varargin) +%K2AMP - Converts simulator values to amperes +% Amps = k2amp(Family, Field, k, DeviceList, Energy, Coefficients, K2AmpScaleFactor) +% or +% Amps = k2amp(Family, Field, k, DeviceList, Energy, MagnetCoreType, K2AmpScaleFactor) +% +% Calculates the current [amperes] from the coefficients (or +% MagnetCoreType), "K-value", energy, and linear scale factor +% +% For dipole: k = B / Brho +% For quadrupole: k = B'/ Brho +% For sextupole: k = B"/ Brho / 2 (to be compatible with AT) +% +% A curve vector or a MagnetCoreType string (current curves found from +% magnetcoefficents.m) can be used. Amps and Coefficients must have equal +% number of rows or one must only have one row. +% +% Energy can be anything getenergy accepts, like 'Model' or 'Online'. +% +% The K2AmpScaleFactor linearly scales the output current: Amps = K2AmpScaleFactor .* Amps +% +% If energy is not an input or empty, then the energy is read from the accelerator data object (AD) +% This can be used to account for linear calibration errors of the power supply and magnet +% +% NOTES +% 1. If energy is not an input or empty, then the energy is obtained from getenergy. +% 2. Family and Field inputs are not used but there automatically part of the physics2hw call. +% +% Original structure set up using polynomials by M. Yoon 4/8/03 +% Modified for ASP by E. Tan 31/05/2006 + +if nargin < 4 + error('At least 4 inputs required'); +end + +if nargin < 6 + C = []; +end +if isempty(C) + %[CC, Leff, MagnetName] = magnetcoefficients(Family); + temp = getfamilydata(Family, Field, 'HW2PhysicsParams', DeviceList); + C = temp{1}; +end + +if nargin < 5 + Energy = []; +end +if isempty(Energy) + Energy = getenergy; +elseif ischar(Energy) + Energy = getenergy(Energy); +end + +% If k is a row vector make it a column vector +k = k(:); + +brho = getbrho(Energy); + +if isstr(C) + [C, Leff, MagnetName] = magnetcoefficients(C); +end + +if any(size(C,1) ~= length(k)) + if length(k) == 1 + k = ones(size(C,1),1) * k; + elseif size(C,1) == 1 + % Ok as is + %C = ones(size(k,1),1) * C; + else + error('k and Coefficients must have equal number of rows or one must only have one row'); + end +end + +% Simple interpolation function therefore assuming monotonic function +% for the magnets (which is reasonable) the it is a simple matter of +% reversing from B vs I to I vs B. +splitind = size(C,2)/2; +for i = 1:length(k) + if size(C,1) == 1 + Amps(i,1) = interp1(C(1,splitind+1:end),C(1,1:splitind),k(i)*brho,'linear','extrap'); + else + Amps(i,1) = interp1(C(i,splitind+1:end),C(i,1:splitind),k(i)*brho,'linear','extrap'); + end +end + +% Scale solution if required +if nargin >= 7 + Amps = Amps ./ K2AmpScaleFactor; end \ No newline at end of file diff --git a/machine/ASP/StorageRing/lifetime.m b/machine/ASP/StorageRing/lifetime.m index 519a612a..bcb7a7dc 100644 --- a/machine/ASP/StorageRing/lifetime.m +++ b/machine/ASP/StorageRing/lifetime.m @@ -1,109 +1,219 @@ -function [lifetdcct error] = lifetime(timetaken,varargin); -%[lifetime error] = lifetime(time taken in seconds,varargin) -% -%This function returns the lifetime and error calculated over -%the time given as an input in seconds -% -%It is also possible to specify a process variable to use to find the -%lifetime -% -%If you use 'sum' as the second input then it will sum over a number of -%BPMs as you edit in the code below. -% -%Written by Martin Spencer - - -%bpmsasum(1,:) = 'SR01BPM01:SA_S_MONITOR'; -%bpmsasum(2,:) = 'SR02BPM01:SA_S_MONITOR'; -flag=1; -if nargin == 1 - monitor = 'SR11BCM01:CURRENT_MONITOR'; -elseif nargin == 2 - if ~strcmp('sum',varargin{1}) - monitor = varargin{1}; - else - flag =1; - end -end - -if flag == 1; - count=1; - for(i=1:1) %sector numbers to sum over!!! - for(j=1:1) %bpm numbers to sum over!!!! - if(0) - elseif i >= 10 - bpmsasum(count,:) = ['SR' num2str(i) 'BPM0' num2str(j) ':SA_SUM_MONITOR']; - elseif i<10 - bpmsasum(count,:) = ['SR0' num2str(i) 'BPM0' num2str(j) ':SA_SUM_MONITOR']; - end - count = count+1; - end - end -end -%dcct = 'SR11BCM01:TT_S_MONITOR'; - -if nargin > 1 - Ns = timetaken*10; -else - Ns = timetaken; -end - -a = zeros(2,Ns); -tic; -for(i=1:Ns); - - if flag == 1 - for(j=1:count-1) - s(j) = getpv(bpmsasum(j,:)); - end - d = mean(s); - else - d = getpv(monitor); - end - - a(2,i)=d; - if(nargin > 1) - pause(0.1) - else - pause(1) - end -end; -t=toc; - -%a(1,:) = a(1,:)/a(1,end); %normalise -a(2,:) = a(2,:)/a(2,end); %normalise - -figure; -clf; -%plot([1:Ns]*0.1,a(1,:),'b*-'); -%hold on; -plot([1:Ns]*0.1,a(2,:),'r*-'); -hold on; - -%p = polyfit([1:Ns]*0.1,a(1,:),1); -%f = polyval(p,[1:Ns]*0.1); -%plot([1:Ns]*0.1,f,'b'); - -[p1 s] = polyfit([1:Ns]*0.1,a(2,:),1); -[f1 delta] = polyval(p1,[1:Ns]*0.1,s); -plot([1:Ns]*0.1,f1,'b'); - -meandelta = mean(delta); - -%lifetdcct = -((t)/(3600))/log(f1(end)/f1(1)); -%lifetmax = -((t)/(3600))/log((f1(end)-meandelta)/(f1(1)+meandelta)); -%lifetmin = -((t)/(3600))/log((f1(end)+meandelta)/(f1(1)-meandelta)); -%error = abs(lifetmax-lifetmin)/2; - -lifetdcct = (f1(end)/(f1(1)-f1(end)))*(t/3600); -grad = (f1(1)-f1(end))/(t/3600); -gradmax = ((f1(1)+meandelta)-(f1(end)-meandelta))/(t/3600); -gradmin = ((f1(1)-meandelta)-(f1(end)+meandelta))/(t/3600); -graderror = abs(gradmax-gradmin)/2; -properror = graderror/grad; -error = lifetdcct*properror; - -temp = ['The lifetime is: ' num2str(lifetdcct) ' hours. With a error of about: ' num2str(error) ' hours. Time taken: ' num2str(t) ' seconds.']; -disp(temp); - -hold off; \ No newline at end of file +function [lifetdcct error] = lifetime(timetaken,varargin) +%[lifetime error] = lifetime(time taken in seconds,varargin) +% +%This function returns the lifetime and error calculated over +%the time given as an input in seconds +% +%It is also possible to specify a process variable to use to find the +%lifetime +% +%If you use 'sum' as the second input then it will sum over a number of +%BPMs as you edit in the code below. +% +%Written by Martin Spencer +% Modified 18-12-2007 ET + +if nargin == 1 + % Default to only using the DCCT + monitor = 'SR11BCM01:CURRENT_MONITOR'; + usebpm = 0; +elseif nargin == 2 + % Use the SA data of the BPMs + monitor = 'SA_SIGNAL.Sum'; + usebpm = 1; +else + return +end + +tic +if usebpm == 1 + % Select the BPMs of interest here or leave empty and will select all + % BPMs. + % The measurements seems to indicate that there are some BPMs that are + % noisier than others. If you just chose the quiet ones the results are + % comparable to the DCCT. +% deviceList = getlist('BPMx',[1:7:98]'); + deviceList = getlist('BPMx'); +% [rawdata tout] = getlibera(monitor,deviceList,[1:timetaken]); + [rawdata, tout] = srbpm.getfield(monitor,deviceList,[1:0.25:timetaken]); + + rawdata = squeeze(rawdata); + + % Normalise before averaging across all BPMs + bpmdata = rawdata./repmat(rawdata(:,end),1,size(rawdata,2)); + data = mean(bpmdata); + +else + [data, tout] = getpv(monitor,[1:timetaken]); +end +t = toc; + +data = squeeze(data/data(end)); %normalise + +if usebpm + figure(23); clf; + set(gcf,'Position',[ 122 656 985 625]) +else + figure(22); clf; + set(gcf,'Position',[ 122 656 985 625]) +end +plot(tout,data,'r*-'); +hold on; + +%p = polyfit([1:Ns]*0.1,a(1,:),1); +%f = polyval(p,[1:Ns]*0.1); +%plot([1:Ns]*0.1,f,'b'); + +[p1 s] = polyfit(tout,data,1); +[f1 delta] = polyval(p1,tout,s); +plot(tout,f1,'b'); +grid on; +xlabel('Time (s)'); + +meandelta = mean(delta); + +%lifetdcct = -((t)/(3600))/log(f1(end)/f1(1)); +%lifetmax = -((t)/(3600))/log((f1(end)-meandelta)/(f1(1)+meandelta)); +%lifetmin = -((t)/(3600))/log((f1(end)+meandelta)/(f1(1)-meandelta)); +%error = abs(lifetmax-lifetmin)/2; + +lifetdcct = (f1(end)/(f1(1)-f1(end)))*(t/3600); +grad = (f1(1)-f1(end))/(t/3600); +gradmax = ((f1(1)+meandelta)-(f1(end)-meandelta))/(t/3600); +gradmin = ((f1(1)-meandelta)-(f1(end)+meandelta))/(t/3600); +graderror = abs(gradmax-gradmin)/2; +properror = graderror/grad; +error = lifetdcct*properror; + + +% temp = ['The lifetime is: ' num2str(lifetdcct) ' hours. With a error of about: ' num2str(error) ' hours. Time taken: ' num2str(t) ' seconds.']; + +temp = sprintf('The lifetime is: %5.2f Hr; approx. error: %5.2f Hr. Time taken: %4.1f seconds',... + lifetdcct, error, t); + +if usebpm + ylabel('BPM sum (Normalised)'); +else + ylabel('DCCT (Normalised)'); +end +title(temp); +disp(temp); + +hold off; + + +%% Old Version +% function [lifetdcct error] = lifetime(timetaken,varargin); +% %[lifetime error] = lifetime(time taken in seconds,varargin) +% % +% %This function returns the lifetime and error calculated over +% %the time given as an input in seconds +% % +% %It is also possible to specify a process variable to use to find the +% %lifetime +% % +% %If you use 'sum' as the second input then it will sum over a number of +% %BPMs as you edit in the code below. +% % +% %Written by Martin Spencer +% +% +% %bpmsasum(1,:) = 'SR01BPM01:SA_S_MONITOR'; +% %bpmsasum(2,:) = 'SR02BPM01:SA_S_MONITOR'; +% flag=0; +% if nargin == 1 +% monitor = 'SR11BCM01:CURRENT_MONITOR'; +% elseif nargin == 2 +% if ~strcmp('sum',varargin{1}) +% monitor = varargin{1}; +% else +% flag =1; +% end +% end +% +% if flag == 1; +% % Select the BPMs of interest here or leave empty and will select all +% % BPMs. +% % deviceList = []; +% % [data tout] = getlibera('SA_SUM_MONITOR',deviceList,[1:timetaken]) +% +% count=1; +% for(i=[1:2 4:10 12:14]) %sector numbers to sum over!!! +% for(j=1:7) %bpm numbers to sum over!!!! +% if(0) +% elseif i >= 10 +% bpmsasum(count,:) = ['SR' num2str(i) 'BPM0' num2str(j) ':SA_SUM_MONITOR']; +% elseif i<10 +% bpmsasum(count,:) = ['SR0' num2str(i) 'BPM0' num2str(j) ':SA_SUM_MONITOR']; +% end +% count = count+1; +% end +% end +% end +% %dcct = 'SR11BCM01:TT_S_MONITOR'; +% +% if nargin > 1 +% Ns = timetaken*10; +% else +% Ns = timetaken; +% end +% +% a = zeros(2,Ns); +% tic; +% for(i=1:Ns); +% +% if flag == 1 +% for(j=1:count-1) +% s(j) = getpv(bpmsasum(j,:)); +% end +% d = mean(s); +% else +% d = getpv(monitor); +% end +% +% a(2,i)=d; +% if(nargin > 1) +% pause(0.1) +% else +% pause(1) +% end +% end; +% t=toc; +% +% %a(1,:) = a(1,:)/a(1,end); %normalise +% a(2,:) = a(2,:)/a(2,end); %normalise +% +% figure(22); +% clf; +% %plot([1:Ns]*0.1,a(1,:),'b*-'); +% %hold on; +% plot([1:Ns]*0.1,a(2,:),'r*-'); +% hold on; +% +% %p = polyfit([1:Ns]*0.1,a(1,:),1); +% %f = polyval(p,[1:Ns]*0.1); +% %plot([1:Ns]*0.1,f,'b'); +% +% [p1 s] = polyfit([1:Ns]*0.1,a(2,:),1); +% [f1 delta] = polyval(p1,[1:Ns]*0.1,s); +% plot([1:Ns]*0.1,f1,'b'); +% +% meandelta = mean(delta); +% +% %lifetdcct = -((t)/(3600))/log(f1(end)/f1(1)); +% %lifetmax = -((t)/(3600))/log((f1(end)-meandelta)/(f1(1)+meandelta)); +% %lifetmin = -((t)/(3600))/log((f1(end)+meandelta)/(f1(1)-meandelta)); +% %error = abs(lifetmax-lifetmin)/2; +% +% lifetdcct = (f1(end)/(f1(1)-f1(end)))*(t/3600); +% grad = (f1(1)-f1(end))/(t/3600); +% gradmax = ((f1(1)+meandelta)-(f1(end)-meandelta))/(t/3600); +% gradmin = ((f1(1)-meandelta)-(f1(end)+meandelta))/(t/3600); +% graderror = abs(gradmax-gradmin)/2; +% properror = graderror/grad; +% error = lifetdcct*properror; +% +% temp = ['The lifetime is: ' num2str(lifetdcct) ' hours. With a error of about: ' num2str(error) ' hours. Time taken: ' num2str(t) ' seconds.']; +% disp(temp); +% +% hold off; \ No newline at end of file diff --git a/machine/ASP/StorageRing/linear_fit_remove_betabeat.m b/machine/ASP/StorageRing/linear_fit_remove_betabeat.m index 9fb8891e..e68819a0 100644 --- a/machine/ASP/StorageRing/linear_fit_remove_betabeat.m +++ b/machine/ASP/StorageRing/linear_fit_remove_betabeat.m @@ -1,20 +1,57 @@ -initialisations = ['global THERING;',... +setoperationalmode(2); +global THERING_NOWIG +THERING_NOWIG = THERING; + +ind = findcells(THERING,'FamName','ID'); +mach_init = machine_at; +qfai = getsp('QFA','model'); +qdai = getsp('QDA','model'); +qfbi = getsp('QFB','model'); + +% ID12 Wiggler +idnum = 12; +% 18.16 mm +kx = 0.0003416; +ky = -0.0210746; +% 14.6 mm +% kx = 0.0005088; +% ky = -0.0281203; + +THERING{ind(idnum)}.M66(2,1) = kx; +THERING{ind(idnum)}.M66(4,3) = ky; + +initialisations = ['global THERING THERING_NOWIG;',... 'qfaind = getfamilydata(''QFA'',''AT'',''ATIndex'',[11 2; 12 1]);',... 'qdaind = getfamilydata(''QDA'',''AT'',''ATIndex'',[11 2; 12 1]);',... - 'sfbind = getfamilydata(''SFB'',''AT'',''ATIndex'');'; + 'qfbind = getfamilydata(''QFB'',''AT'',''ATIndex'',[11 2; 12 1]);',... + 'sfbind = getfamilydata(''SFB'',''AT'',''ATIndex'');']; varget = {'getcellstruct(THERING,''K'',qfaind)';... - 'getcellstruct(THERING,''K'',qdaind)'}; + 'getcellstruct(THERING,''K'',qdaind)';... + 'getcellstruct(THERING,''K'',qfbind)'}; -% varset = {'THERING = setcellstruct(THERING,''PolynomB'',qfaind,variable,2); THERING = setcellstruct(THERING,''K'',qfaind,variable);';... -% 'THERING = setcellstruct(THERING,''PolynomB'',qdaind,variable,2); THERING = setcellstruct(THERING,''K'',qdaind,variable);'}; -varset = {'THERING = setcellstruct(THERING,''K'',qfaind,variable);';... - 'THERING = setcellstruct(THERING,''K'',qdaind,variable);'}; +varset = {'THERING = setcellstruct(THERING,''PolynomB'',qfaind,variable,2); THERING = setcellstruct(THERING,''K'',qfaind,variable);';... + 'THERING = setcellstruct(THERING,''PolynomB'',qdaind,variable,2); THERING = setcellstruct(THERING,''K'',qdaind,variable);';... + 'THERING = setcellstruct(THERING,''PolynomB'',qfbind,variable,2); THERING = setcellstruct(THERING,''K'',qfbind,variable);'}; +% varset = {'THERING = setcellstruct(THERING,''K'',qfaind,variable);';... +% 'THERING = setcellstruct(THERING,''K'',qdaind,variable);'}; -paramget = {'std(machine_at(THERING,0,sfbind,''betax''))';... - 'std(machine_at(THERING,0,sfbind,''betay''))'}; +paramget = {'std(machine_at(THERING,0,sfbind'',''betax''))';... + 'std(machine_at(THERING,0,sfbind'',''betay''))';... + 'std(machine_at(THERING,0,sfbind'',''etax'')*10)'}; -goalparam = [0 0]; +goalparam = [0 0 0]; + +linearfit(varget,varset,paramget,goalparam,initialisations); +mach_final = machine_at; + +% fittunedisp2([mach_init.nux(end) mach_init.nuy(end) mach_init.etax(end)],'QFA','QDA','QFB',1); + +qfaf = getsp('QFA','model'); +qdaf = getsp('QDA','model'); +qfbf = getsp('QFB','model'); -linearfit(varget,varset,paramget,goalparam,initialisations); \ No newline at end of file +qfa_rel = qfaf./qfai; +qda_rel = qdaf./qdai; +qfb_rel = qfbf./qfbi; diff --git a/machine/ASP/StorageRing/magnetcoefficients.m b/machine/ASP/StorageRing/magnetcoefficients.m index 38506fa6..7c4af0f9 100644 --- a/machine/ASP/StorageRing/magnetcoefficients.m +++ b/machine/ASP/StorageRing/magnetcoefficients.m @@ -1,212 +1,233 @@ -function [C, Leff, MagnetType] = magnetcoefficients(MagnetCoreType) -% [C, Leff, MagnetType] = magnetcoefficients(MagnetCoreType) -% -% C is a curve for the particular magnet and is a 2 column vector. The -% first column contains the current values at which the magnet was tested -% and the second colum the measured B, B' or B" values. -% -% Unlike Spear3 that use polynomials we will use a simple curve defined -% over a specific domain. To do the calculations, simple linear -% interpolation will only be used. -% -% The amp2k and k2amp functions convert between the two types of units. -% amp2k returns B , B' , or B" scaled by Brho. -% -% For dipole: k = B / Brho (for AT: KickAngle = BLeff / Brho) -% For quadrupole: k = B'/ Brho -% For sextupole: k = B"/ Brho / 2 (to be compatible with AT) -% (all coefficients all divided by 2 for sextupoles) -% -% MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell) -% For ASP: BEND -% QFA, QFB, QDA, SKQ -% SFA, SFB, SDA, SDB -% HCM, VCM -% -% Leff is the effective length of the magnet. In most cases this will be -% the same as the model length. -% -% Original structure set up using polynomials by M. Yoon 4/8/03 -% Modified for ASP by E. Tan 31/05/2006 - -% Todo -% * What to do about Leff and how should it help in this instance? - -if nargin < 1 - error('MagnetCoreType input required'); -end - - -% For a string matrix -if iscell(MagnetCoreType) - for i = 1:size(MagnetCoreType,1) - for j = 1:size(MagnetCoreType,2) - [C{i,j}, Leff{i,j}, MagnetType{i,j}] = magnetcoefficients(MagnetCoreType{i}); - end - end - return -end - -% For a string matrix -if size(MagnetCoreType,1) > 1 - C=[]; Leff=[]; MagnetType=[]; - for i = 1:size(MagnetCoreType,1) - [C1, Leff1, MagnetType1] = magnetcoefficients(MagnetCoreType(i,:)); - C(i,:) = C1; - Leff(i,:) = Leff1; - MagnetType = strvcat(MagnetType, MagnetType1); - end - return -end - - -% Directory containing the magnet calibration curves. At the moment the -% data is brought from various sources and processed in with the script -% read_BI_into_mat.m. The script draws data that has been generated from -% magnetic measurements (for quads, sextupoles and correctors) and tracking -% studies (for dipoles based on 2D field maps). See script files for more -% details. Variable saved should be BIdata. -filepath = fileparts([mfilename('fullpath')]); -load([filepath filesep 'magnet_calibration_curves' filesep 'B_vs_I_data.mat']) - -switch upper(deblank(MagnetCoreType)) - - case 'BEND' - - MagnetType = 'bend'; - Leff=1.726; - - I = BIdata.DIP.I; - Energy = BIdata.DIP.Energy; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = Energy; - - case 'QDA' - - MagnetType = 'quad'; - Leff=0.18; - CorrectionFactor = 1.01898761594704; - - % The below is negative because defocusing quadrupoles must return - % negative k values. - I = BIdata.QD.I_gen; - B = -BIdata.QD.dBdx/Leff; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = B; - - case {'QFA','QFB'} - - MagnetType = 'quad'; - Leff=0.355; - - I = BIdata.QF.I_gen; - B = BIdata.QF.dBdx/Leff; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = B; - - case {'SFA','SFB'} - - MagnetType = 'sext'; - Leff=0.2; - - % Power Series Denominator (Factoral) be AT compatible. For - % sextupole its 2! = 2. - I = BIdata.SVR.I_gen; - - B = BIdata.SVR.d2Bdx2/Leff/2; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = B; - - case {'SDA','SDB'} - - MagnetType = 'sext'; - Leff=0.2; - - % Power Series Denominator (Factoral) be AT compatible. For - % sextupole its 2! = 2. - % The B field is negative below because SD magnets should return - % negative K values. - I = BIdata.SVR.I_gen; - B = -BIdata.SVR.d2Bdx2/Leff/2; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = B; - - case 'SKQ' - % There are no magnetic measurment for this configuration on the - % sextupoles therefore we will use the calculations done by Jack - % Tanabe in the original design documents M009.doc. The - % specification was to design a skew gradient field of 0.035 T/m - % and requires 47.6 AmpTurns. With a coil configuration of 12 - % turns this corresponds to ~4 Amps. Therefore we will assume a - % linear relationship from zero. - - MagnetType = 'quad'; - Leff=0.2; - - I = [-8:8]; - B = 0.035/(47.6/12)*I; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = B; - - case 'HCM' % horizontal corrector trim coils in SH magnets - % Magnet Spec: Theta = 1.0e-3 radians @ 3 GeV and 75.3 amps - % Theta = BLeff / Brho [radians] - % Therefore, - % Theta = ((BLeff/Amp)/ Brho) * I - % BLeff/Amp = 1.0e-3 * getbrho(3) / 30 - % B*Leff = a0 * I => a0 = 1.5e-3 * getbrho(3) / 30 - % - % The C coefficients are w.r.t B - % B = c0 + c1*I = (0 + a0*I)/Leff - % However, AT uses Theta in radians so the A coefficients - % must be used for correctors with the middle layer with - % the addition of the DC term - - % Find the current from the given polynomial for BLeff and B - % NOTE: AT used BLeff (A) for correctors - Leff = 0.2; - MagnetType = 'COR'; - - i0 = BIdata.HCM.I; - BLeff = BIdata.HCM.Bharmon(1); - - I = [-90:10:90]; - BL = (BLeff/i0)*I; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = BL; - - case 'VCM' % vertical corrector trim coils in SD magnets - % Magnet Spec: Theta = 1.0e-3 radians @ 3 GeV and 130 amps - % Find the current from the given polynomial for BLeff and B - Leff = 0.2; - MagnetType = 'COR'; - - i0 = BIdata.VCM.I; - BLeff = BIdata.VCM.Bharmon(1); - - I = [-120:10:120]; - BL = (BLeff/i0)*I; - - C = zeros(1,2*length(I)); - C(1,1:length(I)) = I; - C(1,length(I)+1:end) = BL; - - otherwise - error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType)); -end - -MagnetType = upper(MagnetType); +function [C, Leff, MagnetType] = magnetcoefficients(MagnetCoreType) +% [C, Leff, MagnetType] = magnetcoefficients(MagnetCoreType) +% +% C is a curve for the particular magnet and is a 2 column vector. The +% first column contains the current values at which the magnet was tested +% and the second colum the measured B, B' or B" values. +% +% Unlike Spear3 that use polynomials we will use a simple curve defined +% over a specific domain. To do the calculations, simple linear +% interpolation will only be used. +% +% The amp2k and k2amp functions convert between the two types of units. +% amp2k returns B , B' , or B" scaled by Brho. +% +% For dipole: k = B / Brho (for AT: KickAngle = BLeff / Brho) +% For quadrupole: k = B'/ Brho +% For sextupole: k = B"/ Brho / 2 (to be compatible with AT) +% (all coefficients all divided by 2 for sextupoles) +% +% MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell) +% For ASP: BEND +% QFA, QFB, QDA, SKQ +% SFA, SFB, SDA, SDB +% HCM, VCM +% +% Leff is the effective length of the magnet. In most cases this will be +% the same as the model length. +% +% Original structure set up using polynomials by M. Yoon 4/8/03 +% Modified for ASP by E. Tan 31/05/2006 +% Rohan, Eugene: 10/02/2009: changed sign for SKQ based on measurements. + +% Todo +% * What to do about Leff and how should it help in this instance? + +if nargin < 1 + error('MagnetCoreType input required'); +end + + +% For a string matrix +if iscell(MagnetCoreType) + for i = 1:size(MagnetCoreType,1) + for j = 1:size(MagnetCoreType,2) + [C{i,j}, Leff{i,j}, MagnetType{i,j}] = magnetcoefficients(MagnetCoreType{i}); + end + end + return +end + +% For a string matrix +if size(MagnetCoreType,1) > 1 + C=[]; Leff=[]; MagnetType=[]; + for i = 1:size(MagnetCoreType,1) + [C1, Leff1, MagnetType1] = magnetcoefficients(MagnetCoreType(i,:)); + C(i,:) = C1; + Leff(i,:) = Leff1; + MagnetType = strvcat(MagnetType, MagnetType1); + end + return +end + + +% Directory containing the magnet calibration curves. At the moment the +% data is brought from various sources and processed in with the script +% read_BI_into_mat.m. The script draws data that has been generated from +% magnetic measurements (for quads, sextupoles and correctors) and tracking +% studies (for dipoles based on 2D field maps). See script files for more +% details. Variable saved should be BIdata. +% Path defined in aoinit.m +load(fullfile(getmmlroot('IgnoreTheAD'),'machine','ASP','StorageRing','magnet_calibration_curves','B_vs_I_data.mat')); +% load('B_vs_I_data.mat') + +switch upper(deblank(MagnetCoreType)) + + case 'BEND' + + MagnetType = 'bend'; + Leff=1.726; + + I = BIdata.DIP.I; + Energy = BIdata.DIP.Energy; + + % Scaling used here is based on spin depolarisation measurements + % that put the SR energy at 3.0134 GeV when the dipole was set to + % 614.968 Amps (RF freq 499 674 670 Hz). 27/07/2010 Eugene + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; + C(1,length(I)+1:end) = Energy*1.024754; + + case 'QDA' + + MagnetType = 'quad'; + Leff=0.18+0.0084; + + % The below is negative because defocusing quadrupoles must return + % negative k values. + I = BIdata.QD.I_gen; + B = -BIdata.QD.dBdx/Leff; + + % Scaling factor for B empirically determined by comparing model + % predictions with measured. Eugene 21-07-2010 + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; +% C(1,length(I)+1:end) = B*0.995540071082187/0.995537735778454; + C(1,length(I)+1:end) = B*0.997549129779699; + + case {'QFA','QFB'} + + MagnetType = 'quad'; + Leff=0.355+0.0084; + + I = BIdata.QF.I_gen; + B = BIdata.QF.dBdx/Leff; + + % Scaling factor for B empirically determined by comparing model + % predictions with measured. Eugene 21-07-2010 + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; +% C(1,length(I)+1:end) = B*1.016228140568382/0.995267695340687; + C(1,length(I)+1:end) = B*1.016867410211431; + + case {'SFA','SFB'} + + MagnetType = 'sext'; + Leff=0.2; + + % Power Series Denominator (Factoral) be AT compatible. For + % sextupole its 2! = 2. + I = BIdata.SVR.I_gen; + + B = BIdata.SVR.d2Bdx2/Leff/2; + + % Scaling factor for B empirically determined by comparing model + % predictions with measured chromaticities. Eugene 21-07-2010 + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; + C(1,length(I)+1:end) = B*0.998;0.995; + + case {'SDA','SDB'} + + MagnetType = 'sext'; + Leff=0.2; + + % Power Series Denominator (Factoral) be AT compatible. For + % sextupole its 2! = 2. + % The B field is negative below because SD magnets should return + % negative K values. + I = BIdata.SVR.I_gen; + B = -BIdata.SVR.d2Bdx2/Leff/2; + + % Scaling factor for B empirically determined by comparing model + % predictions with measured chromaticities. Eugene 21-07-2010 + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; + C(1,length(I)+1:end) = B*0.998;0.995; + + case 'SKQ' + % There are no magnetic measurment for this configuration on the + % sextupoles therefore we will use the calculations done by Jack + % Tanabe in the original design documents M009.doc. The + % specification was to design a skew gradient field of 0.035 T/m + % and requires 47.6 AmpTurns. With a coil configuration of 12 + % turns this corresponds to ~4 Amps. Therefore we will assume a + % linear relationship from zero. + + % Rohan, Eugene 10/02/2009: Changed the sign as a positive current + % corresponds to a negative skew component. See operations elog + % entries. (eg. + % http://asapp01/elog/servlet/XMLlist?file=/operationselog/data/2008/30/26.07&xsl=/elogbook/xsl/elog.xsl&picture=true#2008-07-26T12:00:25) + % + + MagnetType = 'quad'; + Leff=0.2; + + I = [-8:8]; + %B = 0.035/(47.6/12)*I; + B = -0.02*I; + + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; + C(1,length(I)+1:end) = B; + + case 'HCM' % horizontal corrector trim coils in SH magnets + % Magnet Spec: Theta = 1.0e-3 radians @ 3 GeV and 75.3 amps + % Theta = BLeff / Brho [radians] + % Therefore, + % Theta = ((BLeff/Amp)/ Brho) * I + % BLeff/Amp = 1.0e-3 * getbrho(3) / 30 + % B*Leff = a0 * I => a0 = 1.5e-3 * getbrho(3) / 30 + % + % The C coefficients are w.r.t B + % B = c0 + c1*I = (0 + a0*I)/Leff + % However, AT uses Theta in radians so the A coefficients + % must be used for correctors with the middle layer with + % the addition of the DC term + + % Find the current from the given polynomial for BLeff and B + % NOTE: AT used BLeff (A) for correctors + Leff = 0.2; + MagnetType = 'COR'; + + i0 = BIdata.HCM.I; + BLeff = BIdata.HCM.Bharmon(1)*1.1; % 23/11/2009 ET: 1.1 added to fix the gain issues + + I = [-90:10:90]; + BL = (BLeff/i0)*I; + + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; + C(1,length(I)+1:end) = BL; + + case 'VCM' % vertical corrector trim coils in SD magnets + % Magnet Spec: Theta = 1.0e-3 radians @ 3 GeV and 130 amps + % Find the current from the given polynomial for BLeff and B + Leff = 0.2; + MagnetType = 'COR'; + + i0 = BIdata.VCM.I; + BLeff = BIdata.VCM.Bharmon(1); + + I = [-120:10:120]; + BL = (BLeff/i0)*I*1.06; % 23/11/2009 ET: 1.06 added to fix the gain issues + + C = zeros(1,2*length(I)); + C(1,1:length(I)) = I; + C(1,length(I)+1:end) = BL; + + otherwise + error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType)); +end + +MagnetType = upper(MagnetType); diff --git a/machine/ASP/StorageRing/meastune.m b/machine/ASP/StorageRing/meastune.m index bcfd399c..61eedcf2 100644 --- a/machine/ASP/StorageRing/meastune.m +++ b/machine/ASP/StorageRing/meastune.m @@ -1,48 +1,349 @@ function varargout = meastune(varargin) +% MEASTUNE measures the tune using various possible sources. The default is +% from Turn-by-Turn (TBT) data from the Liberas. The probram does not turn +% on or off any magnets. +% +% >> tunes = meastune; +% +% Eugene + t0 = clock; -% if nargin == 1 - % Mexed version of the tune measurement interface - +% Source of tunes +% 1: From general PVs +% 2: From TBT data +% 3: From automated tune measurement system +% 4: From BbB +choice = 4; + +switch choice + + case 1 % From General PVs + tune(1) = getpv('CR01:GENERAL_ANALOG_02_MONITOR'); tune(2) = getpv('CR01:GENERAL_ANALOG_03_MONITOR'); -disp('Tunes from the kicker:') -disp(tune) -% -% printf ("rsib-spa test v2.01\n\n"); -% printf ("Master Oscillator Frequency = %e\n", Master_Oscillator_Frequency); -% printf ("Centre Frequency = %e\n", Centre_Frequency); -% printf ("XTune Guess = %e\n", X_Tune_Guess); -% printf ("XTune Half Span = %e\n", X_Tune_Half_Span); -% printf ("YTune Guess = %e\n", Y_Tune_Guess); -% printf ("YTune Half Span = %e\n\n", Y_Tune_Half_Span); - - mo = getsp('RF'); - tune = sr11spa01_matlab(mo(1),29.1474444e6,0.29,0.04,0.22,0.04); -disp('Tunes from the SPA (returned by program):') -disp(tune') -% tune = sr11spa01_matlab(mo(1),1.665566720000000e+07,0.3,0.04,0.22,0.04); + + case 2 % Using TBT data + % Method + % 1: SVD component method with zero padding for frequency interpolation. + % 2: FFT with background subtraction + method = 2; + % Test + % 0: No test + % 1: Sample dataset + % 2: Pure function + testsource = 0; + + %Check excitation + if sum(getpv('KICK','OFF_ON_STATUS')) == 4 + warning('You can get better tune measurements with just a single kicker.\n'); + elseif sum(getpv('KICK','OFF_ON_STATUS')) == 0 + warning('No kickers turned ON! Data may not be valid.'); + end + % Check septum + if getpv('PS-SEI-3:STATUS1') == 1 + warning('Septum (SEI-3) is turned on. This broadens the tunelines making it harder to measure the vertical tune'); + end + % Check timing. Dependent on the function 'meastunearm' + % Events + if getpv('TS01EVR01:TTL01_EVENT_CODE_STATUS') ~= 13 + warning('Timing: BPM trigger event not set to ''Storage Ring BPM'''); + end + if getpv('TS01EVR06:TTL01_EVENT_CODE_STATUS') ~= 13 + warning('Timing: Kicker 2''s trigger event not set to ''Storage Ring BPM'''); + end + % BPMs must be triggered 85.4 turns (61.528 us) before the kickers. I + % presume these are delays in the BPM fanout and/or internal delays in the + % Liberas. Calculate time difference in turns relative to +85.4. + timedifference = (getpv('TS01EVR06:TTL01_TIME_DELAY_MONITOR') - getpv('TS01EVR01:TTL01_TIME_DELAY_MONITOR'))/720.5e-9 - 85.4; + if timedifference < -250 || timedifference > 250 + warning(sprintf('Timing: BPM delay not set properly. Nominal TS01EVR01:TTL01_TIME_DELAY_SP: %11.9f seconds.',... + getpv('TS01EVR06:TTL01_TIME_DELAY_MONITOR') - 85.4*720.5e-9)); + end + + if method == 1 + if any(getliberaswitches) + warning('Method 1 (SVD) best used with libera switches turned off'); + end + if getpv('SR00SOF01:STATUS') == 2 + warning('Turn off SOFB before turning switches off'); + end + % Check to see if SOFB it turned on. Ask user to turn off before + % continuing. or Cancel +% while getpv('SR00SOF01:STATUS') == 2 && method == 1 && testsource == 0 +% switch questdlg('Please turn off SOFB before running MEASTUNE.','Slow Orbit Feedback Running','Continue','Exit','Continue') +% case 'Continue' +% measure = 1; +% otherwise +% measure = 0; +% end +% end +% turnswitches off &; +% pause(1); + + N = 16384; + % turns to evaluate at each BPM to get an accurate measure of the tunes. + % Generally 1000 turns is sufficient as the damping of the ring means the + % useful data is only if the first 1000 turns (for low amplitude kicks). + % For larger amplitude kicks you should select turns at the end as we + % probably do not want to include amplitude tuneshifts in our measurement. + % The improvement in the accuracy is linear with number of turns. + xturns = 30:1000; + yturns = 30:1000; + %xturns = 1:5000; % DJP + %yturns = 1:5000; + % Which BPMs to select from. By default based on some trial studies it + % seems around 40 BPMs gives a very accurate measurement of the tunes + % (horizontally). Adding more BPMs does not seem to help. Strangely + % vertical seems not to have this effect and would require all BPMs. + nbpm = [1:15];[2 4 5 6 8 9 10 11 12 15 20 25 30 40 50 60 70]; +% nbpm = [2 4]; + % Component number. Try changing these numbers between 1 and 5 and see + % if you can get a better measure for the tune. + inum(1) = 1; %2 + inum(2) = 1; %2 + + if testsource == 0 + dev = elem2dev('BPMx',nbpm(:)); + tt = getliberatbt('DD3',dev); + elseif testsource == 1 + warning('Running in test mode 1'); + filestr = '/asp/usr/measurements/bpm/2011_02_28_tbtdataproblem/offsettune_125_tbtdata.mat'; + load(filestr); + tt = data; + clear data; + elseif testsource == 2 + warning('Running in test mode 2'); + fxstr = '500e-6*sin(2*pi*0.290*[1:10000]).*exp(-[1:10000]/1500)+0.5e-6*randn(1,10000)'; + fystr = '100e-6*sin(2*pi*0.216*[1:10000]).*exp(-[1:10000]/1500)+0.5e-6*randn(1,10000)'; + tt.tbtx = repmat(eval(fxstr),10,1); + tt.tbty = repmat(eval(fystr),10,1); + end + +% turnswitches on &; + + for plane=1:2 + if plane==1 + data = tt.tbtx(:,xturns); + else + data = tt.tbty(:,yturns); + end + ndata = size(data,2); + % subtract DC + data = data - repmat(mean(data,2),1,ndata); + % Singular value decomposition. Probably the most time consuming part. + [u s v] = svd(data); + % Calculate the spectra. + vdata(:,plane) = v(:,inum(plane)); + [powerspectra amplitude f] = getfftspectrum([v(:,inum(plane)); zeros(N-ndata,1)],1,N,0); + figure(100+plane); + subplot(2,2,1); + plot(data(1,:)); + title('Input data first sample'); + subplot(2,2,2); + semilogy(diag(s),'.-'); + title('Singular Values'); + subplot(2,1,2); + plot(f(2:end),10*log10(powerspectra(2:end))); + title(sprintf('Power spectra in dB for component %d',inum)) + % Find the frequency peak x + % ET: getfftspectrum returns only half the FFT power spectra. So no + % need to find the peak in just the lower half. 06/04/2009 + if plane==1 + [maxval maxindx] = max(amplitude); + diffind = maxindx-2:maxindx+2; + diffb = gradient(amplitude(diffind)); + tune(plane) = interp1(diffb,f(diffind),0); + end + % Find the frequency peak y using x peak as limiting range -50 + % points + if plane ==2 + offset_start = 100; + [maxval maxindy] = max(amplitude(1+offset_start:maxindx-50)); + maxindy = maxindy + offset_start; + diffind = maxindy-2:maxindy+2; + diffb = gradient(amplitude(diffind)); + tune(plane) = interp1(diffb,f(diffind),0); + end + end + elseif method == 2 + + if testsource == 0 + % use only every 5 + tt = getliberatbt('DD3',elem2dev('BPMx',sort([2:7:98 6:7:98]))); + datax = tt.tbtx-repmat(mean(tt.tbtx,2),1,size(tt.tbtx,2)); % remove DC + datay = tt.tbty-repmat(mean(tt.tbty,2),1,size(tt.tbty,2)); + clear tt; + elseif testsource == 1 + warning('Running in test mode 1'); + filestr = '/asp/usr/measurements/bpm/2011_02_28_tbtdataproblem/offsettune_125_tbtdata.mat'; + load(filestr); + datax = data.tbtx-repmat(mean(data.tbtx,2),1,size(data.tbtx,2)); + datay = data.tbty-repmat(mean(data.tbty,2),1,size(data.tbty,2)); + clear data; + elseif testsource == 2 + warning('Running in test mode 2'); + fxstr = '500e-6*sin(2*pi*0.290*[1:10000]).*exp(-[1:10000]/1500)+0.5e-6*randn(1,10000)'; + fystr = '100e-6*sin(2*pi*0.216*[1:10000]).*exp(-[1:10000]/1500)+0.5e-6*randn(1,10000)'; + datax = repmat(eval(fxstr),10,1); + datay = repmat(eval(fystr),10,1); + end + + % Range where the main betatron oscillations will be. With 5000 + % samples the resolution is 2e-4; + % 06/2011Eugene currently starts at 131 turns as the Liberas seem + % to have some issues in the first 100 turns where the data is + % corrupted. + range = 131:5130; + N = length(range); + f = (0:N/2) / N; + + t = [1:length(range)]; + p = 1; + kai = ( 2^p*(factorial(p))^2*(1+cos(pi*(2*(t-max(t)/2)/max(t)))).^p/factorial(2*p) ); + kai = 1;repmat(kai/max(kai),size(datax,1),1)'; + + fftdatax1 = fft(kai.*datax(:,range)'); + fftdatay1 = fft(kai.*datay(:,range)'); + + range = 1:430; + + t = [1:length(range)]; + p = 1; + kai = ( 2^p*(factorial(p))^2*(1+cos(pi*(2*(t-max(t)/2)/max(t)))).^p/factorial(2*p) ); + kai = 1;repmat(kai/max(kai),size(datax,1),1)'; + + fftdataysmall = fft(kai.*datay(:,range)'); + Nsmall = length(range); + fsmall = (0:Nsmall/2) / Nsmall; + + % The back end where some damping have occured and use this as a + % baseline + range = 5001:10000; + + t = [1:length(range)]; + p = 1; + kai = ( 2^p*(factorial(p))^2*(1+cos(pi*(2*(t-max(t)/2)/max(t)))).^p/factorial(2*p) ); + kai = 1;repmat(kai/max(kai),size(datax,1),1)'; + + + fftdatax2 = fft(kai.*datax(:,range)'); + fftdatay2 = fft(kai.*datay(:,range)'); + + % Calculate the relative amplitude of the signal. Subtract the + % baseline spectrum. + range = 1:fix(N/2)+1; + ampxraw = abs(fftdatax1(range,:))/(N/2); + ampxbase = abs(fftdatax2(range,:))/(N/2); + ampyraw = abs(fftdatay1(range,:))/(N/2); + ampybase = abs(fftdatay2(range,:))/(N/2); + ampx = ampxraw - ampxbase; + ampy = ampyraw - ampybase; + + % Horizontal Tune + [val(1) ind] = max(mean(ampx(500:end,:),2)); + ind = ind + 500-1; + tune(1) = f(ind); + + % Try and remove the horizontal component from the measurement. In + % this way relative amplitudes between horizontal and vertical + % should not be used as betatron coupling... + ampyxcomp = max(mean(ampy'))/max(mean(ampx'))*mean(ampx'); +% ampyxcomp = sum(mean(ampx')/sum(mean(ampx')).*mean(ampy')/sum(mean(ampy')))*mean(ampx'); + +% Possibly use the smaller FFT to find the peak then search around +% it however this encounters poblems with the synchrotron tune +% being stronger and also the horizontal tune. So for now this idea +% is abandoned. The smaller FFT also has an issue with frequency +% resolution where if the the resonant peak at the FFT data point +% will be larger in amplitude than if the resonant peak is between +% data points. Therefore as the tune drifts its amplitude will go +% up and down and can swap in maximum amplitude with its sidebands. +% This may be overcome with max resolution FTT coupled with binning +% before peak searching. + range = 1:fix(Nsmall/2)+1; + ampysmall = abs(fftdataysmall(range,:))/(N/2); +% [tempval tempind] = max(mean(ampysmall')); +% peaksearchrange = find(f > fsmall(tempind)-0.009 & f < fsmall(tempind)+0.009); + + + ampy = mean(ampy') - ampyxcomp; + ampy = filter([1 1 1 1]/4,1,ampy); + [val(2) ind] = max(ampy(:)); + tune(2) = f(ind); + + figure(104); clf; +% set(gcf,'Position',[588 431 744 606]); + subplot(2,1,1); + semilogy(f,abs(mean(ampx,2))); + ylabel('X Amplitude (nm) [bg subtraction]'); + xlabel('Fractional Tune'); + if testsource == 1; + hold on; + semilogy(f,mean(ampxraw,2),'r'); + semilogy(f,mean(ampxbase,2),'k'); + hold off; + title(sprintf('From data saved in: %s (Tune: %7.5f, Amp: %5.1f um)',filestr,tune(1),val(1)*1e-3),'Interpreter','none'); + elseif testsource == 2 + hold on; + semilogy(f,mean(ampxraw,2),'r'); + semilogy(f,mean(ampxbase,2),'k'); + hold off; + title(sprintf('Test function: %s (Tune: %7.5f, Amp: %5.1f um)',fxstr,tune(1),val(1)*1e6)); + end + + subplot(2,1,2); + semilogy(f,abs(ampy)); +% plot(f,abs(ampy)) + ylabel('Y Amplitude (nm) [bg subtraction & H comp. removal]'); + xlabel('Fractional Tune'); + + if testsource == 0 + hold on; + semilogy(fsmall, abs(mean(ampysmall,2)),'r'); + hold off; + %legend('High resolution averaged spectrum','Low resolution averaged spectrum'); + elseif testsource == 1; + hold on; + semilogy(f,mean(ampyraw,2),'r'); + semilogy(f,mean(ampybase,2),'k'); + semilogy(f,ampyxcomp,'g'); + hold off;nargout + title(sprintf('From data saved in: %s (Tune: %7.5f, Amp: %5.1f um)',filestr,tune(2),val(2)*1e-3),'Interpreter','none'); + legend('Treated spectrum','Raw Spectrum','Base line spectrum subtraced from raw spectrum','Horizontal compoennt'); + elseif testsource == 2 + hold on; + semilogy(f,mean(ampyraw,2),'r'); + semilogy(f,mean(ampybase,2),'k'); + semilogy(f,ampyxcomp,'g'); + hold off; + title(sprintf('Test function: %s (Tune: %7.5f, Amp: %5.1f um)',fystr,tune(2),val(2)*1e6)); + legend('Treated spectrum','Raw Spectrum','Base line spectrum subtraced from raw spectrum','Horizontal compoennt'); + end + else + tune = [NaN NaN]; + end + + case 3 % FRom R&S SPA + +%TUNES FROM THE SPA +% mo = getsp('RF'); +% tune = sr11spa01_matlab(mo(1),29.1474444e6,0.29,0.04,0.22,0.04); +% disp('Tunes from the SPA (returned by program):') +% disp(tune') + + pause(5); + tune(1) = getpv('SR00TUM01:X_TUNE_MONITOR'); + tune(2) = getpv('SR00TUM01:Y_TUNE_MONITOR'); -% else + case 4 + pause(2); + tune(1) = getpv('IGPF:X:SRAM:PEAKTUNE2'); + tune(2) = getpv('IGPF:Y:SRAM:PEAKTUNE2'); -% directory = pwd; -% -% mo = getsp('SR00MOS01:FREQUENCY_MONITOR'); -% -% cd /asp/usr/middleLayer/machine/asp/spa -% -% t0 = clock; -% temp = ['sr11spa01 ' num2str(mo) ' ' num2str(5550000) ' ' num2str(0.28) ' ' num2str(0.03) ' ' num2str(0.23) ' ' num2str(0.03)]; -% -% [a tune] = system(temp); -% tune = str2num(tune); -% -% cd(directory); -% end - -if nargout > 0 - varargout{1} = tune(:); end + +varargout{1} = tune(:); if nargout > 1 % tout varargout{2} = clock; @@ -55,6 +356,7 @@ % Error flag varargout{4} = 0; end - - - +if nargout > 4 + % tune amplitude + varargout{5} = 0; +end \ No newline at end of file diff --git a/machine/ASP/StorageRing/measureoffsets.m b/machine/ASP/StorageRing/measureoffsets.m new file mode 100644 index 00000000..1cbd6720 --- /dev/null +++ b/machine/ASP/StorageRing/measureoffsets.m @@ -0,0 +1,181 @@ +% Ensure the following are done before carrying out BBA. +% - Inject to 200 mA with cavities at full voltage +% - Injection system turned off (minimise noise) +% - No SOFB program running. +switch questdlg({'Have the following been done?';... + '1. Inject to 200 mA with cavities at full voltage';... + '2. Injection system turned off (minimise noise)';... + '3. No SOFB program running'},... + 'Checklist before starting measuring offsets',... + 'Yes','No','No'); + case 'No' + return; +end +fprintf('\nStarting BBA...\n'); + +% Choose which plane +switch questdlg('Which plane to measure?',... + 'Plane selection',... + 'Both','Horizontal','Vertical','Both'); + case 'Both' + plane = 0; + case 'Horizontal' + plane = 1; + case 'Vertical' + plane = 2; + otherwise + disp('Unknown selection! Quitting'); + return +end +fprintf('Plane selected (0-both, 1-Horiz, 2-Vert): %d\n',plane); + +% Beam based alignment needs to be done in 3 sections to minimise the beam +% current dependance and get more accurate results. +switch questdlg('You are about to perform Beam Based Alignment and can take up to 3 hours. Continue?',... + 'Final Check',... + 'Yes','No','No'); + case 'No' + disp('Bye Bye'); + return; +end +disp('The following measurements will be done in 3 parts as follows:'); +disp(' Sectors 1-4, sectors 5-9 followed by 10-14'); + +% problem BPMs +prob_dev = []; + +% Beam based alignment needs to be done in 3 sections to minimise the beam +% current dependance and get more accurate results. +switch questdlg('Please correct the orbit before continuing.','BBA Sectors 1-4','Done','Cancel','Done'); + case 'Cancel' + disp('Leaving BBA. Bye bye'); + return +end +% Sector number for BPM +for i=1:4 + % BPM number within the sector + for j=1:7 + + BPMDev = [i j]; + if getfamilydata('BPMx','Status',BPMDev) == 0 + continue; + end + + switch BPMDev(2) + case {1 2} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 1]; + case 3 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 1]; + case 4 + quadfam = 'QFB'; + quaddev = [BPMDev(1) 1]; + case 5 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 2]; + case {6 7} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 2]; + end + + try +% quadcenter(quadfam,quaddev,plane,BPMDev); + catch + prob_dev(end+1,1:2) = BPMDev; + end + end +end + +% Now do sectors 5-9 +% Beam based alignment needs to be done in 3 sections to minimise the beam +% current dependance and get more accurate results. +switch questdlg('Inject to 200 mA and correct the orbit before continuing.','BBA Sectors 5-9','Done','Cancel','Done'); + case 'Cancel' + disp('Leaving BBA. Bye bye'); + return +end +% Sector number for BPM +for i=5:9 + % BPM number within the sector + for j=1:7 + + BPMDev = [i j]; + if getfamilydata('BPMx','Status',BPMDev) == 0 + continue; + end + + switch BPMDev(2) + case {1 2} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 1]; + case 3 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 1]; + case 4 + quadfam = 'QFB'; + quaddev = [BPMDev(1) 1]; + case 5 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 2]; + case {6 7} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 2]; + end + + try +% quadcenter(quadfam,quaddev,plane,BPMDev); + catch + prob_dev(end+1,1:2) = BPMDev; + end + end +end + +% Now do sectors 10-14 +% Beam based alignment needs to be done in 3 sections to minimise the beam +% current dependance and get more accurate results. +switch questdlg('Inject to 200 mA and correct the orbit before continuing.','BBA Sectors 10-14','Done','Cancel','Done'); + case 'Cancel' + disp('Leaving BBA. Bye bye'); + return +end +% Sector number for BPM +for i=10:14 + % BPM number within the sector + for j=1:7 + + BPMDev = [i j]; + if getfamilydata('BPMx','Status',BPMDev) == 0 + continue; + end + + switch BPMDev(2) + case {1 2} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 1]; + case 3 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 1]; + case 4 + quadfam = 'QFB'; + quaddev = [BPMDev(1) 1]; + case 5 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 2]; + case {6 7} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 2]; + end + + try +% quadcenter(quadfam,quaddev,plane,BPMDev); + catch + prob_dev(end+1,1:2) = BPMDev; + end + end +end + +if ~isempty(prob_dev) + fprintf('\nSOME PROBLEMS WITH THE FOLLOWING BPMs when doing BBA:\n'); + fprintf(' %02d %1d\n',prob_dev'); +end \ No newline at end of file diff --git a/machine/ASP/StorageRing/opticalbpmanalyse.m b/machine/ASP/StorageRing/opticalbpmanalyse.m deleted file mode 100644 index b7591dfc..00000000 --- a/machine/ASP/StorageRing/opticalbpmanalyse.m +++ /dev/null @@ -1,100 +0,0 @@ - -if 0 - time = 1:3600; - - pos = getpv({'SR07BM01PSD01:XPOS_MONITOR' 'SR07BM01PSD01:YPOS_MONITOR' 'SR01BPM07:SA_X_MONITOR' 'SR01BPM07:SA_Y_MONITOR'},time); - xposopt = cell2mat(pos(1)); - yposopt = cell2mat(pos(2)); - xposlib = cell2mat(pos(3)); - yposlib = cell2mat(pos(4)); - - now = clock; - filesave = ['/asp/usr/commissioning/instabilities/' datestr(now,'yyyy-mm-dd') '-' num2str(now(4)) '-' num2str(now(5)) '-' num2str(fix(now(6)))]; - fprintf('Data saved to: %s\n',filesave); - save(filesave, 'xposopt', 'yposopt', 'xposlib', 'yposlib', 'time'); -end - - xpos = xposopt; - ypos = yposopt; - - xpos = xpos - mean(xpos); - ypos = ypos - mean(ypos); - - xpos = xpos/max(xpos); - ypos = ypos/max(ypos); - -% xpos = sin(time); -% ypos = sin(time).*sin(0.1*time); - -xpos_fft = fft(xpos); -ypos_fft = fft(ypos); - -figure; - -subplot(2,2,1) -plot(time,xpos,'b*-') -title('X position') -xlabel('seconds') -ylabel('beam position') -hold on; - -subplot(2,2,3) -plot(time(1:end/2)/length(time),xpos_fft(1:end/2).*conj(xpos_fft(1:end/2)),'b*-'); -title('FFT of X position') -xlabel('Hz') -hold on; - -subplot(2,2,2) -plot(time,ypos,'b*-') -title('Y position') -xlabel('seconds') -ylabel('beam position') -hold on; - -subplot(2,2,4) -plot(time(1:end/2)/length(time),ypos_fft(1:end/2).*conj(ypos_fft(1:end/2)),'b*-'); -title('FFT of Y position') -xlabel('Hz') -hold on; - -xpos = xposlib; -ypos = yposlib; - - xpos = xpos - mean(xpos); - ypos = ypos - mean(ypos); - - xpos = xpos/max(xpos); - ypos = ypos/max(ypos); - -% xpos = sin(time); -% ypos = sin(time).*sin(0.1*time); - -xpos_fft = fft(xpos); -ypos_fft = fft(ypos); - -subplot(2,2,1) -plot(time,xpos,'r*-') -title('X position') -xlabel('seconds') -ylabel('beam position') - - -subplot(2,2,3) -plot(time(1:end/2)/length(time),xpos_fft(1:end/2).*conj(xpos_fft(1:end/2)),'r*-'); -title('FFT of X position') -xlabel('Hz') - - -subplot(2,2,2) -plot(time,ypos,'r*-') -title('Y position') -xlabel('seconds') -ylabel('beam position') - - -subplot(2,2,4) -plot(time(1:end/2)/length(time),ypos_fft(1:end/2).*conj(ypos_fft(1:end/2)),'r*-'); -title('FFT of Y position') -xlabel('Hz') -legend('optical BPM','Button BPM'); - diff --git a/machine/ASP/StorageRing/orbitdrift.mat b/machine/ASP/StorageRing/orbitdrift.mat deleted file mode 100644 index cd485c2d6b96c4daad7e3df45c35347e76ce0dd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2307 zcmbW%={FRN0tWC=UQ4o;$T}wbHj90P5R+*vX;3mW7-TZmF=Q=7$nx5=WeG)Z_AEui zkX>)thsKg+LZr)B8guKz{c!Jxd(OSjInO!IKk)o4jnOD$6QGtl1ZZiDR`a-X7pDre zxr+_*@D1>R0}&{z8@k%6K+^ymHVEeq^d-Q7Xd(`1j&lXVAV8=l9HIq>L4R$C4)A{s zfX%{^9{>Pop9BCx3e*yLYzEl?@vI(nx!2U2ud?=;KfFuVCcO2yc*0a2nkw*Q2j~3EJ($>`*2;R*k^S+G~EoRW z&)J~w4e_X~LPsL@Te(pcpUS>-NNd6elJtWQ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-^?~w!G1Y( zjR}G(P}QT3y045?JMUpU{A`xOKl@ZApCm28t3f1nc~#PKzI9-oKi*}p7I9WpEOG8i zQd!B$hZ;gAqFZeZAv+G`_<`8U{MMIjT$24vzQ&D=pLB$NbStrpS`@Ywh{uFZBCmJ! zV7<7RqDkiQ5a=2RJ=1aCB?e709M z>w_Xf8);`{kdpGf>WfFywx{jO z3(G{1{;9ZpiE(+eq4P0j)=n@-a6x-ffZ};=WZu<41neFHWYRg+|Dk^h5=?P;IIR)& zJ-!Ks618d@s>)d4=S@WG|9;QmeAK`07KXKTaABxE_l|zP0-|D`NQM~7SzySJksB$Vr>$9C0PEesh}7x4UtOdDu1(MhuvMi a4Z?OTPi5ll+} diff --git a/machine/ASP/StorageRing/orbitgui.m b/machine/ASP/StorageRing/orbitgui.m new file mode 100644 index 00000000..a0a9facd --- /dev/null +++ b/machine/ASP/StorageRing/orbitgui.m @@ -0,0 +1,6 @@ +function orbitgui(varargin) + warning('orbitgui is deprecated. Please use setorbitgui instead.\nIf you really want to use orbitgui, run orbitgui(1)', ''); + if nargin + run('/asp/usr/middleLayer/applications/orbit/asp/orbitgui.m'); + end +end \ No newline at end of file diff --git a/machine/ASP/StorageRing/plotfamilystartup.m b/machine/ASP/StorageRing/plotfamilystartup.m index 45a23116..bdecfb62 100644 --- a/machine/ASP/StorageRing/plotfamilystartup.m +++ b/machine/ASP/StorageRing/plotfamilystartup.m @@ -1,48 +1,48 @@ -function plotfamilystartup(handles) -% plotfamilystartup(handles) - - -Menu0 = handles.('LatticeConfiguration'); - -%MenuAdd = uimenu(Menu0, 'Label','Add an Injection Bump - bumpinj'); -%set(MenuAdd,'Callback', 'bumpinj'); -%set(MenuAdd, 'Separator','Off'); - - - -% Add a sector menu -Sectors = 14; -L = getfamilydata('Circumference'); -if ~isempty(L) - Menu0 = handles.figure1; - Menu0 = uimenu(Menu0, 'Label', 'Sector'); - set(Menu0, 'Position', 3); - set(Menu0, 'Separator', 'On'); - - % Arc sections - Extra = 4; % meters - i = 1; - Menu1 = uimenu(Menu0, 'Label',sprintf('Arc Sector %d',i)); - set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[0 Extra+L/Sectors]+(i-1)*L/Sectors),'],guidata(gcbo))']); - for i = 2:Sectors-1 - Menu1 = uimenu(Menu0, 'Label',sprintf('Arc Sector %d',i)); - set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[0-Extra Extra+L/Sectors]+(i-1)*L/Sectors),'],guidata(gcbo))']); - end - i = Sectors; - Menu1 = uimenu(Menu0, 'Label',sprintf('Arc Sector %d',i)); - set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[L-L/Sectors-Extra L]),'],guidata(gcbo))']); - - % Straight sections - Extra = 9; % meters - for i = 1:Sectors-1 - Menu1 = uimenu(Menu0, 'Label',sprintf('Straight Section %d',i)); - %set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[-Extra Extra]+(i-1)*L/Sectors),'],guidata(gcbo))']); - set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[-Extra Extra]+i*L/Sectors),'],guidata(gcbo))']); - end - Menu1 = uimenu(Menu0, 'Label',sprintf('Straight Section %d',14)); - set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[L-Extra L]),'],guidata(gcbo))']); -end - - - -drawnow; +function plotfamilystartup(handles) +% plotfamilystartup(handles) + + +Menu0 = handles.('LatticeConfiguration'); + +%MenuAdd = uimenu(Menu0, 'Label','Add an Injection Bump - bumpinj'); +%set(MenuAdd,'Callback', 'bumpinj'); +%set(MenuAdd, 'Separator','Off'); + + + +% Add a sector menu +Sectors = 14; +L = getfamilydata('Circumference'); +if ~isempty(L) + Menu0 = handles.figure1; + Menu0 = uimenu(Menu0, 'Label', 'Sector'); + set(Menu0, 'Position', 3); + set(Menu0, 'Separator', 'On'); + + % Arc sections + Extra = 4; % meters + i = 1; + Menu1 = uimenu(Menu0, 'Label',sprintf('Arc Sector %d',i)); + set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[0 Extra+L/Sectors]+(i-1)*L/Sectors),'],guidata(gcbo))']); + for i = 2:Sectors-1 + Menu1 = uimenu(Menu0, 'Label',sprintf('Arc Sector %d',i)); + set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[0-Extra Extra+L/Sectors]+(i-1)*L/Sectors),'],guidata(gcbo))']); + end + i = Sectors; + Menu1 = uimenu(Menu0, 'Label',sprintf('Arc Sector %d',i)); + set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[L-L/Sectors-Extra L]),'],guidata(gcbo))']); + + % Straight sections + Extra = 9; % meters + for i = 1:Sectors-1 + Menu1 = uimenu(Menu0, 'Label',sprintf('Straight Section %d',i)); + %set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[-Extra Extra]+(i-1)*L/Sectors),'],guidata(gcbo))']); + set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[-Extra Extra]+i*L/Sectors),'],guidata(gcbo))']); + end + Menu1 = uimenu(Menu0, 'Label',sprintf('Straight Section %d',14)); + set(Menu1,'Callback', ['plotfamily(''HorizontalAxisSector_Callback'',gcbo,[',sprintf('%f %f',[L-Extra L]),'],guidata(gcbo))']); +end + + + +drawnow; diff --git a/machine/ASP/StorageRing/plotturnorbit.m b/machine/ASP/StorageRing/plotturnorbit.m index 76245fbe..1d24ccac 100644 --- a/machine/ASP/StorageRing/plotturnorbit.m +++ b/machine/ASP/StorageRing/plotturnorbit.m @@ -20,12 +20,12 @@ % setlibera('TT_READY_STATUS',0,deviceList(ind,:)); % setlibera('TT_ARM_CMD',1,deviceList(ind,:)); -finished_num = getlibera('DD3_FINISHED_MONITOR',deviceList); -setlibera('DD3_ON_NEXT_TRIG_CMD',1,deviceList); +finished_num = getlibera('DD3_FINISHED_MONITOR',deviceList(ind,:)); +setlibera('DD3_ON_NEXT_TRIG_CMD',1,deviceList(ind,:)); pause(1); ii = 0; -while any(getlibera('DD3_FINISHED_MONITOR',deviceList) == finished_num) +while any(getlibera('DD3_FINISHED_MONITOR',deviceList(ind,:)) == finished_num) pause(0.3); ii = ii + 1; if ii > 20 @@ -34,6 +34,7 @@ end end +% Convert the nm units that is Hardware into meters (physics) or mm (hardware). if strcmpi(getunits('BPMx'),'Physics') units_conversion = 1e-9; % in meters unitsstr = 'm'; @@ -44,20 +45,20 @@ for i=1:length(ind) % Try to avoid memory problems - tbtsum(i,:) = getlibera('DD3_SUM_MONITOR',deviceList(ind(i),:)); +% tbtsum(i,:) = getlibera('DD3_SUM_MONITOR',deviceList(ind(i),:)); tbtx(i,:) = getlibera('DD3_X_MONITOR',deviceList(ind(i),:))*units_conversion; tbty(i,:) = getlibera('DD3_Y_MONITOR',deviceList(ind(i),:))*units_conversion; end - +% Turn offset to try to synchronise the turns for i=1:length(ind) switch deviceList(ind(i),1) case [5 6 7 8 9 10 11 13 14] - tbtsum(i,:) = circshift(tbtsum(i,:),[0 -1]); +% tbtsum(i,:) = circshift(tbtsum(i,:),[0 -1]); tbtx(i,:) = circshift(tbtx(i,:),[0 -1]); tbty(i,:) = circshift(tbty(i,:),[0 -1]); case 12 - tbtsum(i,:) = circshift(tbtsum(i,:),[0 -2]); +% tbtsum(i,:) = circshift(tbtsum(i,:),[0 -2]); tbtx(i,:) = circshift(tbtx(i,:),[0 -2]); tbty(i,:) = circshift(tbty(i,:),[0 -2]); end @@ -175,5 +176,16 @@ if nargout > 0 varargout{1} = tbtx(:,turnsind); end +if nargout > 1 + varargout{2} = tbty(:,turnsind); +end +if nargout > 2 + tmp.tbtx = tbtx; + tmp.tbty = tbty; + tmp.closedorbitx = closedorbitx; + tmp.closedorbity = closedorbity; + varargout{3} = tmp; + clear tmp; +end clear tbtsum tbtx tbty; \ No newline at end of file diff --git a/machine/ASP/StorageRing/quadcenter_all.m b/machine/ASP/StorageRing/quadcenter_all.m index 18a17ac6..94db95c5 100644 --- a/machine/ASP/StorageRing/quadcenter_all.m +++ b/machine/ASP/StorageRing/quadcenter_all.m @@ -1,14 +1,78 @@ -close all -% 0 = both planes; 1 = x-plane; 2 = y-plane -plane = 0; +% This script is designed to run BBA on all BPMs. For manual measurements +% of BPMs please use QUADCENTER_MANUAL +% +% Eugene Tan 09-10-2007 +% Eugene Tan 15-01-2008: Modified to check the DCCT instead of just + +% Ensure the following are done before carrying out BBA. +% - Inject to 200 mA with cavities at full voltage +% - Injection system turned off (minimise noise) +% - No SOFB program running. +% Will assume for now that AGC will not have an adverse effect since we are +% keeping the beam current to 185 mA and above. +dcctvalue = 200; % current initally injected to +tol = 15; % allowable current drop before having to reinject + +switch questdlg({'Have the following been done?';... + sprintf('1. Inject to %3d mA with cavities at full voltage',dcctvalue);... + '2. Injection system turned off (minimise noise)';... + '3. No OFB program running';... + '4. Run "setliberaconfig" to initialise the BPMs';... + '5. Ramped down the SCW';... + '6. IDs set correctly';},... + 'Checklist before starting measuring offsets',... + 'Yes','No','No'); + case 'No' + disp('Bye bye'); + return; +end +fprintf('\nStarting BBA...\n'); + +% Choose which plane +switch questdlg('Which plane to measure?',... + 'Plane selection',... + 'Both','Horizontal','Vertical','Both'); + case 'Both' + plane = 0; + case 'Horizontal' + plane = 1; + case 'Vertical' + plane = 2; + otherwise + disp('Unknown selection! Quitting'); + return +end +fprintf('Plane selected (0-both, 1-Horiz, 2-Vert): %d\n',plane); + +% Beam based alignment needs to be done in 3 sections to minimise the beam +% current dependance and get more accurate results. +switch questdlg('You are about to perform Beam Based Alignment and can take up to 3 hours. Continue?',... + 'Final Check',... + 'Yes','No','No'); + case 'No' + disp('Bye Bye'); + return; +end + +%Commented for Brilliance+ testing, check with Eugene if it is needed for +%BBA (08/09/2017) +%fprintf('Turning AGC off on the Liberas before continuing...'); +%setlibera('ENV_AGC_SP',0); pause(1); +%setlibera('ENV_SET_INTERLOCK_PARAM_CMD',1); +%fprintf('done!\n'); + +% disp(' The following measurements will be done in 3 parts as follows:'); +% disp(' Sectors 1-4, sectors 5-9 followed by 10-14'); + +% problem BPMs +prob_dev = []; % Sector number for BPM for i=1:14 % BPM number within the sector for j=1:7 - BPMDev = [i j]; - + BPMDev = [i j]; if getfamilydata('BPMx','Status',BPMDev) == 0 continue; end @@ -31,13 +95,239 @@ quaddev = [BPMDev(1) 2]; end - QMS = quadcenterinit(quadfam,quaddev,plane,BPMDev); - quadcenter(QMS); + try + % Store corrector magnet setpoints incase an error is + % encountered which stops quadcenter() from reloading these + % setpoints. + HCM0 = getsp('HCM'); + VCM0 = getsp('VCM'); + QFA0 = getsp('QFA'); + QDA0 = getsp('QDA'); + quadcenter(quadfam,quaddev,plane,BPMDev); + catch + % quadcenter() encountered an error, reload the magnet + % setpoints and log which BPMs the error occured for. + setsp('HCM',HCM0); + setsp('VCM',VCM0); + setsp('QFA',QFA0); + setsp('QDA',QDA0); + prob_dev(end+1,1:2) = BPMDev; + end + + %Added to stop window spam (RH - 08/09/17) + close all; end + +% fid = fopen('/scratch/mhave/announce/TimeToCorrect5.del','w'); fprintf(fid,'test'); fclose(fid); +% questdlg('Please correct the orbit.','Orbit correction','Done','Done'); + + if getdcct < dcctvalue-tol + % if the current drops below the tolerance + + % ---- File name changed + %fid = fopen('/scratch/mhave/announce/5mins_to_injection.del','w'); fprintf(fid,'test'); fclose(fid); + switch questdlg(sprintf('Please refill to %3d mA and correct the orbit before continuing.',dcctvalue),'Refill ring','Done','Cancel','Done'); + case 'Cancel' + if ~isempty(prob_dev) + fprintf('\nSOME PROBLEMS WITH THE FOLLOWING BPMs when doing BBA:\n'); + fprintf(' %02d %1d\n',prob_dev'); + end + disp('Leaving BBA. Those that have been done have been saved. Bye bye'); + return + end + end + +end + + +if ~isempty(prob_dev) + fprintf('\nSOME PROBLEMS WITH THE FOLLOWING BPMs when doing BBA:\n'); + fprintf(' %02d %1d\n',prob_dev'); end return +%% OLD PROGRAM + +% % Beam based alignment needs to be done in 3 sections to minimise the beam +% % current dependance and get more accurate results. +% switch questdlg('Please correct the orbit before continuing.','BBA Sectors 1-4','Done','Cancel','Done'); +% case 'Cancel' +% disp('Leaving BBA. Bye bye'); +% return +% end +% % Sector number for BPM +% for i=1:4 +% % BPM number within the sector +% for j=1:7 +% +% BPMDev = [i j]; +% if getfamilydata('BPMx','Status',BPMDev) == 0 +% continue; +% end +% +% switch BPMDev(2) +% case {1 2} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 1]; +% case 3 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 1]; +% case 4 +% quadfam = 'QFB'; +% quaddev = [BPMDev(1) 2]; +% case 5 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 2]; +% case {6 7} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 2]; +% end +% +% try +% quadcenter(quadfam,quaddev,plane,BPMDev); +% catch +% prob_dev(end+1,1:2) = BPMDev; +% end +% end +% end +% +% % Now do sectors 5-9 +% % Beam based alignment needs to be done in 3 sections to minimise the beam +% % current dependance and get more accurate results. +% switch questdlg('Inject to 200 mA and correct the orbit before continuing.','BBA Sectors 5-9','Done','Cancel','Done'); +% case 'Cancel' +% disp('Leaving BBA. Bye bye'); +% return +% end +% % Sector number for BPM +% for i=5:9 +% % BPM number within the sector +% for j=1:7 +% +% BPMDev = [i j]; +% if getfamilydata('BPMx','Status',BPMDev) == 0 +% continue; +% end +% +% switch BPMDev(2) +% case {1 2} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 1]; +% case 3 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 1]; +% case 4 +% quadfam = 'QFB'; +% quaddev = [BPMDev(1) 2]; +% case 5 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 2]; +% case {6 7} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 2]; +% end +% +% try +% quadcenter(quadfam,quaddev,plane,BPMDev); +% catch +% prob_dev(end+1,1:2) = BPMDev; +% end +% end +% end +% +% % Now do sectors 10-14 +% % Beam based alignment needs to be done in 3 sections to minimise the beam +% % current dependance and get more accurate results. +% switch questdlg('Inject to 200 mA and correct the orbit before continuing.','BBA Sectors 10-14','Done','Cancel','Done'); +% case 'Cancel' +% disp('Leaving BBA. Bye bye'); +% return +% end +% % Sector number for BPM +% for i=10:14 +% % BPM number within the sector +% for j=1:7 +% +% BPMDev = [i j]; +% if getfamilydata('BPMx','Status',BPMDev) == 0 +% continue; +% end +% +% switch BPMDev(2) +% case {1 2} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 1]; +% case 3 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 1]; +% case 4 +% quadfam = 'QFB'; +% quaddev = [BPMDev(1) 2]; +% case 5 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 2]; +% case {6 7} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 2]; +% end +% +% try +% quadcenter(quadfam,quaddev,plane,BPMDev); +% catch +% prob_dev(end+1,1:2) = BPMDev; +% end +% end +% end +% +% if ~isempty(prob_dev) +% fprintf('\nSOME PROBLEMS WITH THE FOLLOWING BPMs when doing BBA:\n'); +% fprintf(' %02d %1d\n',prob_dev'); +% end +% +% +% return +% +% close all +% % 0 = both planes; 1 = x-plane; 2 = y-plane +% plane = 0; +% +% +% % Sector number for BPM +% for i=4 +% % BPM number within the sector +% for j=3 +% +% BPMDev = [i j]; +% +% if getfamilydata('BPMx','Status',BPMDev) == 0 +% continue; +% end +% +% switch BPMDev(2) +% case {1 2} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 1]; +% case 3 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 1]; +% case 4 +% quadfam = 'QFB'; +% quaddev = [BPMDev(1) 1]; +% case 5 +% quadfam = 'QDA'; +% quaddev = [BPMDev(1) 2]; +% case {6 7} +% quadfam = 'QFA'; +% quaddev = [BPMDev(1) 2]; +% end +% +% quadcenter(quadfam,quaddev,plane,BPMDev); +% end +% end +% +% +% return @@ -147,4 +437,4 @@ % voffsets(quadstruct(i).bpmelemind) = qms2; % end % end -% end +% end \ No newline at end of file diff --git a/machine/ASP/StorageRing/quadcenter_eugene.m b/machine/ASP/StorageRing/quadcenter_eugene.m new file mode 100644 index 00000000..d0efc419 --- /dev/null +++ b/machine/ASP/StorageRing/quadcenter_eugene.m @@ -0,0 +1,1025 @@ +function [QMS1, QMS2] = quadcenter(QuadFamily, QuadDev, XYPlane, BPMDev, FigureHandle) +%QUADCENTER - Measure the magnet center of a quadrupole magnet +% [QMS1, QMS2] = quadcenter(QuadFamily, QuadDev, XYPlane, BPMDev, FigureHandle) +% or +% [QMS1, QMS2] = quadcenter(QMSstructure, FigureHandle) +% +% Finds the center of an individual quadrupole magnet. +% The data is automatically appended to quadcenter.log and +% saved to an individual mat file named by family, sector, and element number +% +% INPUTS +% 1. QuadFamily = Family name +% 2. QuadDev = Device list for quadrupole family +% 3. XYPlane = 0 -> both horizontal and vertical {default} +% 1 -> horizontal only +% 2 -> vertical only +% 4. BPMDev = Device list for BPM family (defined in quadcenterinit) +% 5. FigureHandle can be a figure handle, a vector of 4 axes handles +% (used by quadplot), or zero for no plots +% +% The QuadFamily and QuadDev input get converted to a QMSstructure using quadcenterinit. +% One can also directly input this data structure. +% QMSstructure = +% QuadFamily: Quadrupole family name, like 'QF' +% QuadDev: Quadrupole device, like [7 1] +% QuadDelta: Modulation amplitude in the quadrupole, like 1 +% QuadPlane: Horizontal (1) or vertical (2) plane +% CorrFamily: Corrector magnet family, like 'HCM' +% CorrDevList: Corrector magnet(s) using to vary the orbit in the quadrupole, like [7 1] +% CorrDelta: Maximum change in the corrector(s), like 0.5000 +% BPMFamily: BPM family name, like 'BPMx' +% BPMDev: BPM device next to the quadrupole, like [7 1] +% BPMDevList: BPM device list used calculate the center and for orbit correction ([nx2 array]) +% ModulationMethod: Method for changing the quadrupole +% 'bipolar' changes the quadrupole by +/- QuadDelta on each step +% 'unipolar' changes the quadrupole from 0 to QuadDelta on each step +% 'sweep' moves the quadrupole by QuadDelta at each step. This allows for +% staying on a given hysteresis branch. +% NumberOfPoints: Number of points, like 3 +% DataDirectory: Directory to store the results. Leave this field out or '.' will put the data +% in the present directory. +% QuadraticFit: 0 = linear fit, else quadratic fit (used by quadplot) +% OutlierFactor: if abs(data - fit) > OutlierFactor, then remove that BPM from the center calculation [mm] (used by quadplot) +% ExtraDelay: Extra delay added before reading the BPMs [seconds] {optional} +% +% OUTPUTS +% The QMSstructure input structure will get the following output fields appended to it. +% This structure will be output as well as saved to a file which is named based on the +% sector, quadrupole family name, and device number. A log file will also be updated. +% QMSstructure = +% OldCenter: Old quadrupole center (from getoffsetorbit) +% x1: horizonal data at quadrupole value #1 +% x2: horizonal data at quadrupole value #2 +% y1: vertical data at quadrupole value #1 +% y2: vertical data at quadrupole value #2 +% Xerr: Horizonal BPM starting error +% Yerr: Vertical BPM starting error +% TimeStamp: Time stamp as output by clock (6 element vector) +% CreatedBy: 'quadcenter' +% QMS.BPMStatus: Status of the BPMs +% QMS.BPMSTD: Standard deviation of the BPMs (from getsigma) +% Center: Mean of the BPM center calculations +% CenterSTD: Standard deviation of the BPM center calculations +% For two planes, QMS1 is the horizontal and QMS2 is the vertical. When only finding +% one plane, only the first output is used. For multiple magnets, the output is a column +% vector containing the quadrupole center. +% +% NOTE +% 1. It is a good idea to have the global orbit reasonable well corrected at the start +% 2. If the quadrupole modulation system is not a simple device with one family name then +% edit the setquad function (machine specific). +% 3. For the new BPM offsets to take effect, they must be loaded into the main AO data structure. +% 4. This program changes the MML warning level to -2 -> Dialog Box +% That way the measurement can be salvaged if something goes wrong +% +% Machine specific setup: +% 1. setquad and getquad must exist for setting and getting the quadrupole current. +% These function are often machine dependent. +% +% Written by Greg Portmann +% 30/03/2007 modified Eugene to add BPMDev + + + +% Extra delay can be written over by the QMS.ExtraDelay field. If this +% does not exist, then the value below is used. +ExtraDelay = 0; + + +% Set the waitflag on power supply setpoints to wait for fresh data from the BPMs +WaitFlag = -2; + + +% Record the tune at each point. +% In simulate mode the tunes are always saved unless the TUNE family does not exist. +GetTuneFlag = 0; + + +% Inputs +QMS1 = []; +QMS2 = []; +if nargin < 1 + FamilyList = getfamilylist; + [tmp,i] = ismemberof(FamilyList,'QUAD'); + if ~isempty(i) + FamilyList = FamilyList(i,:); + end + if size(FamilyList,1) == 1 + QuadFamily = deblank(FamilyList); + else + [i,ok] = listdlg('PromptString', 'Select a quadrupole family:', ... + 'SelectionMode', 'single', ... + 'ListString', FamilyList); + if ok == 0 + return + else + QuadFamily = deblank(FamilyList(i,:)); + end + end +end + +if isstruct(QuadFamily) + QMS = QuadFamily; + XYPlane = QMS.QuadPlane; + if QMS.QuadPlane == 1 + QMS_Horizontal = QMS; + QMS_Vertical = quadcenterinit(QMS.QuadFamily, QMS.QuadDev, 2, QMS.BPMDev); + QMS_Vertical.CorrectOrbit = QMS.CorrectOrbit; + elseif QMS.QuadPlane == 2 + QMS_Horizontal = quadcenterinit(QMS.QuadFamily, QMS.QuadDev, 1, QMS.BPMDev); + QMS_Horizontal.CorrectOrbit = QMS.CorrectOrbit; + QMS_Vertical = QMS; + else + error('QMS.QuadPlane must be 1 or 2 when using a QMS structure input'); + end + if nargin >= 2 + FigureHandle = QuadDev; + else + FigureHandle = []; + end + QuadFamily = QMS.QuadFamily; + QuadDev = QMS.QuadDev; +else + if ~isfamily(QuadFamily) + error(sprintf('Quadrupole family %s does not exist. Make sure the middle layer had been initialized properly.',QuadFamily)); + end + if nargin < 2 + QuadDev = editlist(getlist(QuadFamily),QuadFamily,zeros(length(getlist(QuadFamily)),1)); + end + if nargin < 3 + ButtonNumber = menu('Which Plane?', 'Both','Horizontal Only','Vertical Only','Cancel'); + drawnow; + switch ButtonNumber + case 1 + XYPlane = 0; + case 2 + XYPlane = 1; + case 3 + XYPlane = 2; + otherwise + fprintf(' quadcenter cancelled\n'); + return + end + end + if nargin < 5 + FigureHandle = []; + end + + % If QuadDev is a vector +% if size(QuadDev,1) > 1 +% for i = 1:size(QuadDev,1) +% if XYPlane == 0 +% [Q1, Q2] = quadcenter(QuadFamily, QuadDev(i,:), XYPlane, BPMDev(i,:), FigureHandle); +% QMS1(i,1) = Q1.Center; +% QMS2(i,1) = Q2.Center; +% else +% [Q1] = quadcenter(QuadFamily, QuadDev(i,:), XYPlane, BPMDev(i,:), FigureHandle); +% QMS1(i,1) = Q1.Center; +% end +% end +% return +% end + + + % Get QMS structure + QMS_Horizontal = quadcenterinit(QuadFamily, QuadDev, 1, BPMDev); + QMS_Vertical = quadcenterinit(QuadFamily, QuadDev, 2, BPMDev); +end + + +% Change the MML warning level to -2 -> Dialog Box +% That way the measurement can be salvaged if something goes wrong +ErrorWarningLevel = getfamilydata('ErrorWarningLevel'); +setfamilydata(-2, 'ErrorWarningLevel'); + + +% Initialize variables +HCMFamily = QMS_Horizontal.CorrFamily; +HCMDev = QMS_Horizontal.CorrDevList; +DelHCM = QMS_Horizontal.CorrDelta; +BPMxFamily = QMS_Horizontal.BPMFamily; +BPMxDev = QMS_Horizontal.BPMDev; +BPMxDevList= QMS_Horizontal.BPMDevList; + +VCMFamily = QMS_Vertical.CorrFamily; +VCMDev = QMS_Vertical.CorrDevList; +DelVCM = QMS_Vertical.CorrDelta; +BPMyFamily = QMS_Vertical.BPMFamily; +BPMyDev = QMS_Vertical.BPMDev; +BPMyDevList= QMS_Vertical.BPMDevList; + +Xcenter = NaN; +Ycenter = NaN; + + +% Check status for BPMs next to the quadrupole and correctors used in orbit correction +HCMStatus = family2status(HCMFamily, HCMDev); + +if ~any(isnan(HCMStatus)) && any(HCMStatus==0) + error(sprintf('A %s corrector used in finding the center has a bad status', HCMFamily)); +end +VCMStatus = family2status(VCMFamily, VCMDev); +if ~any(isnan(VCMStatus)) && any(VCMStatus==0) + error(sprintf('A %s corrector used in finding the center has a bad status', VCMFamily)); +end +BPMxStatus = family2status(BPMxFamily, BPMxDev); +if ~any(isnan(BPMxStatus)) && any(BPMxStatus==0) + error(sprintf('The %s monitor next to the quadrupole has bad status', BPMxFamily)); +end +BPMyStatus = family2status(BPMxFamily, BPMxDev); +if ~any(isnan(BPMyStatus)) && any(BPMyStatus==0) + error(sprintf('The %s monitor next to the quadrupole has bad status', BPMxFamily)); +end + + +% Record start directory +DirStart = pwd; + + +% Get the current offset orbit +Xoffset = getoffset(BPMxFamily, BPMxDev); +Yoffset = getoffset(BPMyFamily, BPMyDev); +XoffsetOld = Xoffset; +YoffsetOld = Yoffset; + +% Starting correctors +HCM00 = getsp(HCMFamily, HCMDev); +VCM00 = getsp(VCMFamily, VCMDev); + + +% % Global orbit correction +% CM = getsp('HCM','struct'); +% BPM = getx('struct'); +% BPMWeight = ones(size(BPM.DeviceList,1),1); +% i = findrowindex(BPMxDev, BPM.DeviceList); +% +% x = getoffset('BPMx'); +% x = .1 * BPMWeight; +% %x(i) = -.2; +% BPMWeight(i) = 100; +% +% setorbit(x, BPM, CM, 3, 20, BPMWeight, 'Display'); + + +% Correct orbit to the old offsets first +if strcmpi(QMS_Horizontal.CorrectOrbit, 'yes') + fprintf(' Correcting the orbit to the old horizontal center of %s(%d,%d)\n', QuadFamily, QuadDev); pause(0); + if ~isnan(Xoffset) + OrbitCorrection(Xoffset, BPMxFamily, BPMxDev, HCMFamily, HCMDev, 4); + end +end +if strcmpi(QMS_Vertical.CorrectOrbit, 'yes') + fprintf(' Correcting the orbit to the old vertical center of %s(%d,%d)\n', QuadFamily, QuadDev); pause(0); + if ~isnan(Yoffset) + OrbitCorrection(Yoffset, BPMyFamily, BPMyDev, VCMFamily, VCMDev, 4); + end +end + +%OrbitCorrection(Xoffset, BPMxFamily, BPMxDev, HCMFamily, HCMDev); +%OrbitCorrection(Yoffset, BPMyFamily, BPMyDev, VCMFamily, VCMDev); + + + +% Algorithm +% 1. Change the horzontal orbit in the quad +% 2. Correct the vertical orbit +% 3. Record the orbit +% 4. Step the quad +% 5. Record the orbit + + +% FIND HORIZONTAL OFFSET +if XYPlane==0 || XYPlane==1 + FigureHandle = 1; + + % BPM processor delay + if isfield(QMS_Horizontal, 'ExtraDelay') + ExtraDelay = QMS_Horizontal.ExtraDelay; + end + + % Get mode + Mode = getmode(QMS_Horizontal.QuadFamily); + + % Record starting point + QUAD0 = getquad(QMS_Horizontal); + HCM0 = getsp(HCMFamily, HCMDev); + VCM0 = getsp(VCMFamily, VCMDev); + Xerr = getam(BPMxFamily, BPMxDev) - Xoffset; + Yerr = getam(BPMyFamily, BPMyDev) - Yoffset; + xstart = getam(BPMxFamily, BPMxDevList); + ystart = getam(BPMyFamily, BPMyDevList); + + QMS_Horizontal.Orbit0 = getam(BPMxFamily, BPMxDevList, 'Struct'); + + [tmp, iNotFound] = findrowindex(BPMxDev, BPMxDevList); + if ~isempty(iNotFound) + setsp(HCMFamily, HCM00, HCMDev, 0); + setsp(VCMFamily, VCM00, VCMDev, 0); + error('BPM at the quadrupole not found in the BPM device list'); + end + + DelQuad = QMS_Horizontal.QuadDelta; + N = abs(round(QMS_Horizontal.NumberOfPoints)); + if N < 1 + error('The number of points must be 2 or more.'); + end + + + fprintf(' Finding horizontal center of %s(%d,%d)\n', QuadFamily, QuadDev); + fprintf(' Starting orbit error: %s(%d,%d)=%f , %s(%d,%d)=%f %s\n', BPMxFamily, BPMxDev, Xerr, BPMyFamily, BPMyDev, Yerr, QMS_Horizontal.Orbit0.UnitsString); + if strcmpi(QMS_Horizontal.ModulationMethod, 'bipolar') + fprintf(' Quadrupole starting current = %.3f, modulate by +/- %.3f\n', getquad(QMS_Horizontal), DelQuad); + elseif strcmpi(QMS_Horizontal.ModulationMethod, 'unipolar') + fprintf(' Quadrupole starting current = %.3f, modulate by 0 to %.3f\n', getquad(QMS_Horizontal), DelQuad); + elseif strcmpi(QMS_Horizontal.ModulationMethod, 'sweep') + fprintf(' Quadrupole starting current = %.3f, sweep by %.3f on each step\n', getquad(QMS_Horizontal), DelQuad); + else + % Reset or error + setsp(HCMFamily, HCM00, HCMDev, 0); + setsp(VCMFamily, VCM00, VCMDev, 0); + setquad(QMS_Horizontal, QUAD0, 0); + cd(DirStart); + error('Unknown ModulationMethod in the QMS input structure (likely a problem with quadcenterinit)'); + end + pause(0); + + % Establish a hysteresis loop + if strcmpi(QMS_Horizontal.ModulationMethod, 'bipolar') + fprintf(' Establishing a hysteresis loop on the quadrupole (bi-polar case)\n'); pause(0); + setquad(QMS_Horizontal, DelQuad+QUAD0, -1); + setquad(QMS_Horizontal,-DelQuad+QUAD0, -1); + setquad(QMS_Horizontal, DelQuad+QUAD0, -1); + setquad(QMS_Horizontal,-DelQuad+QUAD0, -1); + setquad(QMS_Horizontal, QUAD0, -1); + elseif strcmpi(QMS_Horizontal.ModulationMethod, 'unipolar') + fprintf(' Establishing a hysteresis loop on the quadrupole (uni-polar case)\n'); pause(0); + setquad(QMS_Horizontal, DelQuad+QUAD0, -1); + setquad(QMS_Horizontal, QUAD0, -1); + setquad(QMS_Horizontal, DelQuad+QUAD0, -1); + setquad(QMS_Horizontal, QUAD0, -1); + end + + + % Corrector step size + CorrStep = 2 * DelHCM / (N-1); + + + % Start the corrector a little lower first for hysteresis reasons + %stepsp(HCMFamily, -1.0*DelHCM, HCMDev, -1); + stepsp(HCMFamily, -1.2*DelHCM, HCMDev, -1); + stepsp(HCMFamily, .2*DelHCM, HCMDev, WaitFlag); + + + % Main horizontal data loop + clear DCCT + for i = 1:N + % Step the horizontal orbit + if i ~= 1 + stepsp(HCMFamily, CorrStep, HCMDev, WaitFlag); + end + + fprintf(' %d. %s(%d,%d) sp/am = %+.4f/%+.4f, %s(%d,%d) = %+.5f %s\n', i, HCMFamily, HCMDev(1,:), getsp(HCMFamily, HCMDev(1,:)), getam(HCMFamily, HCMDev(1,:)), BPMxFamily, BPMxDev, getam(BPMxFamily, BPMxDev), QMS_Horizontal.Orbit0.UnitsString); pause(0); + + % If correcting the orbit, then recorrect the vertical center now + if strcmpi(QMS_Horizontal.CorrectOrbit, 'yes') + % Correct the vertical orbit + OrbitCorrection(Yoffset, BPMyFamily, BPMyDev, VCMFamily, VCMDev, 4); + end + + if strcmpi(QMS_Horizontal.ModulationMethod, 'sweep') + % One directional sweep of the quadrupole + sleep(ExtraDelay); + x1(:,i) = getam(BPMxFamily, BPMxDevList); + y1(:,i) = getam(BPMyFamily, BPMyDevList); + x0(:,i) = x1(:,i); + y0(:,i) = y1(:,i); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Horizontal.Tune1(:,i) = gettune; + end + + setquad(QMS_Horizontal, i*DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Horizontal.CorrectOrbit, 'yes') + % Correct the vertical orbit + OrbitCorrection(Yoffset, BPMyFamily, BPMyDev, VCMFamily, VCMDev, 4); + sleep(ExtraDelay); + end + + x2(:,i) = getam(BPMxFamily, BPMxDevList); + y2(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Horizontal.Tune2(:,i) = gettune; + end + + elseif strcmpi(QMS_Horizontal.ModulationMethod, 'bipolar') + % Modulate the quadrupole + sleep(ExtraDelay); + x0(:,i) = getam(BPMxFamily, BPMxDevList); + y0(:,i) = getam(BPMyFamily, BPMyDevList); + setquad(QMS_Horizontal, DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Horizontal.CorrectOrbit, 'yes') + % Correct the vertical orbit + OrbitCorrection(Yoffset, BPMyFamily, BPMyDev, VCMFamily, VCMDev, 4); + sleep(ExtraDelay); + end + + x1(:,i) = getam(BPMxFamily, BPMxDevList); + y1(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Horizontal.Tune1(:,i) = gettune; + end + + setquad(QMS_Horizontal,-DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Horizontal.CorrectOrbit, 'yes') + % Correct the vertical orbit + OrbitCorrection(Yoffset, BPMyFamily, BPMyDev, VCMFamily, VCMDev, 4); + sleep(ExtraDelay); + end + + x2(:,i) = getam(BPMxFamily, BPMxDevList); + y2(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Horizontal.Tune2(:,i) = gettune; + end + + setquad(QMS_Horizontal, QUAD0, WaitFlag); + + elseif strcmpi(QMS_Horizontal.ModulationMethod, 'unipolar') + % Modulate the quadrupole + sleep(ExtraDelay); + x1(:,i) = getam(BPMxFamily, BPMxDevList); + y1(:,i) = getam(BPMyFamily, BPMyDevList); + x0(:,i) = x1(:,i); + y0(:,i) = y1(:,i); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Horizontal.Tune1(:,i) = gettune; + end + + setquad(QMS_Horizontal, DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Horizontal.CorrectOrbit, 'yes') + % Correct the vertical orbit + OrbitCorrection(Yoffset, BPMyFamily, BPMyDev, VCMFamily, VCMDev, 4); + sleep(ExtraDelay); + end + + x2(:,i) = getam(BPMxFamily, BPMxDevList); + y2(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Horizontal.Tune2(:,i) = gettune; + end + + setquad(QMS_Horizontal, QUAD0, WaitFlag); + end + + DCCT(i) = getdcct; + end + + % Get the horizontal data filename and save the data + % Append data and time + FileName = ['s', num2str(QuadDev(1,1)), QuadFamily, num2str(QuadDev(1,2)), 'h1']; + FileName = appendtimestamp(FileName, clock); + + % Use a version number + %i=1; + %FileName = ['s', num2str(QuadDev(1,1)), QuadFamily, num2str(QuadDev(1,2)), 'h', num2str(i)]; + %while exist([FileName,'.mat'], 'file') + % i = i + 1; + % FileName = ['s', num2str(QuadDev(1,1)), QuadFamily, num2str(QuadDev(1,2)), 'h', num2str(i)]; + %end + + QMS = QMS_Horizontal; + QMS.QuadPlane = 1; + + QMS.OldCenter = Xoffset; + QMS.XOffsetOld = XoffsetOld; + QMS.YOffsetOld = YoffsetOld; + + QMS.xstart = xstart; + QMS.ystart = ystart; + + QMS.x0 = x0; + QMS.x1 = x1; + QMS.x2 = x2; + QMS.y0 = y0; + QMS.y1 = y1; + QMS.y2 = y2; + QMS.Xerr = Xerr; + QMS.Yerr = Yerr; + QMS.TimeStamp = clock; + QMS.DCCT = DCCT; + QMS.DataDescriptor = 'Quadrupole Center'; + QMS.CreatedBy = 'quadcenter'; + + % Get and store the BPM status and standard deviation (to be used by the center calculation routine) + QMS.BPMStatus = family2status(BPMxFamily, BPMxDevList); + N = getbpmaverages(BPMxDevList); + QMS.BPMSTD = getsigma(BPMxFamily, BPMxDevList, N); + + % Set up figures, plot and find horizontal center + try + if isempty(FigureHandle) + QMS = quadplot(QMS); + else + QMS = quadplot(QMS, FigureHandle); + end + drawnow; + catch + fprintf('\n%s\n', lasterr); + end + QMS1 = QMS; + + % Save the horizontal data + if isfield(QMS_Horizontal, 'DataDirectory') + [FinalDir, ErrorFlag] = gotodirectory(QMS_Horizontal.DataDirectory); + end + QMS.DataDirectory = pwd; + save(FileName, 'QMS'); + fprintf(' Data saved to file %s in directory %s\n\n', FileName, QMS.DataDirectory); + + % Output data to file + fid1 = fopen('quadcenter.log','at'); + time=clock; + fprintf(fid1, '%s %d:%d:%2.0f \n', date, time(4),time(5),time(6)); + fprintf(fid1, 'Data saved to file %s (%s)\n', FileName, QMS.DataDirectory); + fprintf(fid1, '%s(%d,%d) %s(%d,%d) = %f (+/- %f) [%s]\n\n', QuadFamily, QuadDev, BPMxFamily, BPMxDev, QMS.Center, QMS.CenterSTD, QMS_Horizontal.Orbit0.UnitsString); + fclose(fid1); + cd(DirStart); + + % Change the offset orbit to the new center so that the vertical plane uses it + Xoffset = QMS.Center; + + % Restore magnets their starting points (correctors to values after orbit correction) + setsp(HCMFamily, HCM0, HCMDev, WaitFlag); + setsp(VCMFamily, VCM0, VCMDev, WaitFlag); + setquad(QMS_Horizontal, QUAD0, WaitFlag); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + % Print the tune information + fprintf(' Tune and tune difference for the 1st points in the merit function (QMS.Tune1): \n'); + fprintf(' %8.5f', QMS.Tune1(1,:)); + fprintf(' Horizontal\n'); + fprintf(' %8.5f', QMS.Tune1(2,:)); + fprintf(' Vertical\n'); + fprintf(' ===================================================\n'); + fprintf(' %8.5f', diff(QMS.Tune1)); + fprintf(' Difference \n\n'); + + fprintf(' Tune and tune difference for the 2nd points in the merit function (QMS.Tune2): \n'); + fprintf(' %8.5f', QMS.Tune2(1,:)); + fprintf(' Horizontal\n'); + fprintf(' %8.5f', QMS.Tune2(2,:)); + fprintf(' Vertical\n'); + fprintf(' ===================================================\n'); + fprintf(' %8.5f', diff(QMS.Tune2)); + fprintf(' Difference\n\n'); + + dTune1 = diff(QMS.Tune1); + dTune2 = diff(QMS.Tune2); + + if any(sign(dTune1/dTune1(1))==-1) + fprintf(' Tune change sign!!!\n'); + end + + if any(abs(dTune1) < .025) || any(abs(dTune2) < .025) + fprintf(' Horizontal and vertical tunes seem too close.\n'); + end + end +end + + + +% FIND VERTICAL OFFSET +if XYPlane==0 || XYPlane==2 + FigureHandle = 1; + + % BPM processor delay + if isfield(QMS_Vertical, 'ExtraDelay') + ExtraDelay = QMS_Vertical.ExtraDelay; + end + + % Get mode + Mode = getmode(QMS_Horizontal.QuadFamily); + + % Record starting point + QUAD0 = getquad(QMS_Vertical); + HCM0 = getsp(HCMFamily, HCMDev); + VCM0 = getsp(VCMFamily, VCMDev); + Xerr = getam(BPMxFamily, BPMxDev) - Xoffset; + Yerr = getam(BPMyFamily, BPMyDev) - Yoffset; + xstart = getam(BPMxFamily, BPMxDevList); + ystart = getam(BPMyFamily, BPMyDevList); + + QMS_Vertical.Orbit0 = getam(BPMxFamily, BPMxDevList, 'Struct'); + + [tmp, iNotFound] = findrowindex(BPMyDev, BPMyDevList); + if ~isempty(iNotFound) + setsp(HCMFamily, HCM00, HCMDev, 0); + setsp(VCMFamily, VCM00, VCMDev, 0); + error('BPM at the quadrupole not found in the BPM device list'); + end + + DelQuad = QMS_Vertical.QuadDelta; + N = abs(round(QMS_Vertical.NumberOfPoints)); + if N < 1 + error('The number of points must be 2 or more.'); + end + + fprintf(' Finding vertical center of %s(%d,%d)\n', QuadFamily, QuadDev); + fprintf(' Starting orbit error: %s(%d,%d)=%f , %s(%d,%d)=%f %s\n', BPMxFamily, BPMxDev, Xerr, BPMyFamily, BPMyDev, Yerr, QMS_Vertical.Orbit0.UnitsString); + if strcmpi(QMS_Vertical.ModulationMethod, 'bipolar') + fprintf(' Quadrupole starting current = %.3f, modulate by +/- %.3f\n', getquad(QMS_Vertical), DelQuad); + elseif strcmpi(QMS_Vertical.ModulationMethod, 'unipolar') + fprintf(' Quadrupole starting current = %.3f, modulate by 0 to %.3f\n', getquad(QMS_Vertical), DelQuad); + elseif strcmpi(QMS_Vertical.ModulationMethod, 'sweep') + fprintf(' Quadrupole starting current = %.3f, sweep by %.3f on each step\n', getquad(QMS_Vertical), DelQuad); + else + setsp(HCMFamily, HCM00, HCMDev, 0); + setsp(VCMFamily, VCM00, VCMDev, 0); + setquad(QMS_Vertical, QUAD0, 0); + cd(DirStart); + error('Unknown ModulationMethod in the QMS input structure (likely a problem with quadcenterinit)'); + end + pause(0); + + + % Establish a hysteresis loop (if not already done, or if the horizontal plane was sweep) + if XYPlane == 2 || strcmpi(QMS_Horizontal.ModulationMethod, 'sweep') + if strcmpi(QMS_Vertical.ModulationMethod, 'bipolar') + fprintf(' Establishing a hysteresis loop on the quadrupole (bi-polar case)\n'); pause(0); + setquad(QMS_Vertical, DelQuad+QUAD0, -1); + setquad(QMS_Vertical,-DelQuad+QUAD0, -1); + setquad(QMS_Vertical, DelQuad+QUAD0, -1); + setquad(QMS_Vertical,-DelQuad+QUAD0, -1); + setquad(QMS_Vertical, QUAD0, -1); + elseif strcmpi(QMS_Vertical.ModulationMethod, 'unipolar') + fprintf(' Establishing a hysteresis loop on the quadrupole (uni-polar case)\n'); pause(0); + setquad(QMS_Vertical, DelQuad+QUAD0, -1); + setquad(QMS_Vertical, QUAD0, -1); + setquad(QMS_Vertical, DelQuad+QUAD0, -1); + setquad(QMS_Vertical, QUAD0, -1); + end + end + + + % Corrector step size + CorrStep = 2 * DelVCM / (N-1); + + + % Start the corrector a little lower first for hysteresis reasons + stepsp(VCMFamily, -1.2*DelVCM, VCMDev, -1); + stepsp(VCMFamily, .2*DelVCM, VCMDev, WaitFlag); + + +% Debug +% setquad(QMS_Vertical, DelQuad+QUAD0, WaitFlag); +% QUAD0 = getquad(QMS_Vertical); +% Xstart = getam(BPMxFamily, BPMxDev) + + + clear DCCT + for i = 1:N + + % Step the vertical orbit + if i ~= 1 + stepsp(VCMFamily, CorrStep, VCMDev, WaitFlag); + end + + fprintf(' %d. %s(%d,%d) sp/am = %+.4f/%+.4f, %s(%d,%d) = %+.5f %s\n', i, VCMFamily, VCMDev(1,:), getsp(VCMFamily, VCMDev(1,:)), getam(VCMFamily, VCMDev(1,:)), BPMyFamily, BPMyDev, getam(BPMyFamily, BPMyDev), QMS_Vertical.Orbit0.UnitsString); pause(0); + + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Vertical.CorrectOrbit, 'yes') + % Correct the horizontal orbit + OrbitCorrection(Xoffset, BPMxFamily, BPMxDev, HCMFamily, HCMDev, 4); + end + + + if strcmpi(QMS_Vertical.ModulationMethod, 'sweep') + % One dimensional sweep of the quadrupole + sleep(ExtraDelay); + x1(:,i) = getam(BPMxFamily, BPMxDevList); + y1(:,i) = getam(BPMyFamily, BPMyDevList); + x0(:,i) = x1(:,i); + y0(:,i) = y1(:,i); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Vertical.Tune1(:,i) = gettune; + end + + setquad(QMS_Vertical, i*DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Vertical.CorrectOrbit, 'yes') + % Correct the horizontal orbit + OrbitCorrection(Xoffset, BPMxFamily, BPMxDev, HCMFamily, HCMDev, 4); + sleep(ExtraDelay); + end + + x2(:,i) = getam(BPMxFamily, BPMxDevList); + y2(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Vertical.Tune2(:,i) = gettune; + end + + elseif strcmpi(QMS_Vertical.ModulationMethod, 'bipolar') + % Modulate the quadrupole + sleep(ExtraDelay); + x0(:,i) = getam(BPMxFamily, BPMxDevList); + y0(:,i) = getam(BPMyFamily, BPMyDevList); + setquad(QMS_Vertical, DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Vertical.CorrectOrbit, 'yes') + % Correct the horizontal orbit + OrbitCorrection(Xoffset, BPMxFamily, BPMxDev, HCMFamily, HCMDev, 4); + sleep(ExtraDelay); + end + + x1(:,i) = getam(BPMxFamily, BPMxDevList); + y1(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Vertical.Tune1(:,i) = gettune; + end + + setquad(QMS_Vertical,-DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Vertical.CorrectOrbit, 'yes') + % Correct the horizontal orbit + OrbitCorrection(Xoffset, BPMxFamily, BPMxDev, HCMFamily, HCMDev, 4); + sleep(ExtraDelay); + end + + x2(:,i) = getam(BPMxFamily, BPMxDevList); + y2(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Vertical.Tune2(:,i) = gettune; + end + + setquad(QMS_Vertical, QUAD0, WaitFlag); + + elseif strcmpi(QMS_Vertical.ModulationMethod, 'unipolar') + % Modulate the quadrupole + sleep(ExtraDelay); + x1(:,i) = getam(BPMxFamily, BPMxDevList); + y1(:,i) = getam(BPMyFamily, BPMyDevList); + x0(:,i) = x1(:,i); + y0(:,i) = y1(:,i); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Vertical.Tune1(:,i) = gettune; + end + + setquad(QMS_Vertical, DelQuad+QUAD0, WaitFlag); + sleep(ExtraDelay); + + % If correcting the orbit, then recorrect the horizontal center now + if strcmpi(QMS_Vertical.CorrectOrbit, 'yes') + % Correct the horizontal orbit + OrbitCorrection(Xoffset, BPMxFamily, BPMxDev, HCMFamily, HCMDev, 4); + sleep(ExtraDelay); + end + + x2(:,i) = getam(BPMxFamily, BPMxDevList); + y2(:,i) = getam(BPMyFamily, BPMyDevList); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + QMS_Vertical.Tune2(:,i) = gettune; + end + + setquad(QMS_Vertical, QUAD0, WaitFlag); + end + + DCCT(i) = getdcct; + end + + setsp(VCMFamily, VCM0, VCMDev, -1); + + + % Get the vertical data filename and save the data + % Append data and time + FileName = ['s', num2str(QuadDev(1,1)), QuadFamily, num2str(QuadDev(1,2)), 'v1']; + FileName = appendtimestamp(FileName, clock); + + %% Append version number + %i=1; + %FileName = ['s', num2str(QuadDev(1,1)), QuadFamily, num2str(QuadDev(1,2)), 'v', num2str(i)]; + %while exist([FileName,'.mat'], 'file') + % i = i + 1; + % FileName = ['s', num2str(QuadDev(1,1)), QuadFamily, num2str(QuadDev(1,2)), 'v', num2str(i)]; + %end + + QMS = QMS_Vertical; + QMS.QuadPlane = 2; + + QMS.OldCenter = Yoffset; + QMS.XOffsetOld = XoffsetOld; + QMS.YOffsetOld = YoffsetOld; + + QMS.xstart = xstart; + QMS.ystart = ystart; + QMS.x0 = x0; + QMS.x1 = x1; + QMS.x2 = x2; + QMS.y0 = y0; + QMS.y1 = y1; + QMS.y2 = y2; + QMS.Xerr = Xerr; + QMS.Yerr = Yerr; + QMS.TimeStamp = clock; + QMS.DCCT = DCCT; + QMS.DataDescriptor = 'Quadrupole Center'; + QMS.CreatedBy = 'quadcenter'; + + % Get and store the BPM status and standard deviation (to be used by the center calculation routine) + QMS.BPMStatus = family2status(BPMyFamily, BPMyDevList); + N = getbpmaverages(BPMyDevList); + QMS.BPMSTD = getsigma(BPMyFamily, BPMyDevList, N); + + + % Set up figures, plot and find vertical center + if isempty(FigureHandle) + QMS = quadplot(QMS); + else + QMS = quadplot(QMS, FigureHandle); + end + drawnow; + + if XYPlane==0 + QMS2 = QMS; + else + QMS1 = QMS; + end + + + % Save the vertical data + if isfield(QMS_Vertical,'DataDirectory') + [FinalDir, ErrorFlag] = gotodirectory(QMS_Vertical.DataDirectory); + end + QMS.DataDirectory = pwd; + save(FileName, 'QMS'); + fprintf(' Data saved to file %s in directory %s\n\n', FileName, QMS.DataDirectory); + + % Output data to log file + fid1 = fopen('quadcenter.log','at'); + time=clock; + fprintf(fid1, '%s %d:%d:%2.0f \n', date, time(4),time(5),time(6)); + fprintf(fid1, 'Data saved to file %s (%s)\n', FileName, QMS.DataDirectory); + fprintf(fid1, '%s(%d,%d) %s(%d,%d) = %f (+/- %f) [%s]\n\n', QuadFamily, QuadDev, BPMyFamily, BPMyDev, QMS.Center, QMS.CenterSTD); + fclose(fid1); + cd(DirStart); + + if (GetTuneFlag || strcmpi(Mode, 'Simulator')) && isfamily('TUNE') + % Print the tune information + fprintf(' Tune and tune difference for the 1st points in the merit function (QMS.Tune1): \n'); + fprintf(' %8.5f', QMS.Tune1(1,:)); + fprintf(' Horizontal\n'); + fprintf(' %8.5f', QMS.Tune1(2,:)); + fprintf(' Vertical\n'); + fprintf(' ===================================================\n'); + fprintf(' %8.5f', diff(QMS.Tune1)); + fprintf(' Difference \n\n'); + + fprintf(' Tune and tune difference for the 2nd points in the merit function (QMS.Tune2): \n'); + fprintf(' %8.5f', QMS.Tune2(1,:)); + fprintf(' Horizontal\n'); + fprintf(' %8.5f', QMS.Tune2(2,:)); + fprintf(' Vertical\n'); + fprintf(' ===================================================\n'); + fprintf(' %8.5f', diff(QMS.Tune2)); + fprintf(' Difference\n\n'); + + dTune1 = diff(QMS.Tune1); + dTune2 = diff(QMS.Tune2); + + if any(sign(dTune1/dTune1(1))==-1) + fprintf(' Tune change sign!!!\n'); + end + + if any(abs(dTune1) < .025) || any(abs(dTune2) < .025) + fprintf(' Horizontal and vertical tunes seem too close.\n'); + end + end +end + + +% Restore magnets their starting points +setsp(HCMFamily, HCM00, HCMDev, 0); +setsp(VCMFamily, VCM00, VCMDev, 0); +setquad(QMS_Horizontal, QUAD0, 0); + + +% Restore the MML error warning level +setfamilydata(ErrorWarningLevel, 'ErrorWarningLevel'); + + +%%%%%%%%%%%%%%%%%%%%% +% End Main Function % +%%%%%%%%%%%%%%%%%%%%% + + + +%%%%%%%%%%%%%%%%% +% Sub-Functions % +%%%%%%%%%%%%%%%%% + +function OrbitCorrection(GoalOrbit, BPMFamily, BPMDevList, CMFamily, CMDevList, Iter) + +WaitFlag = -2; + +if nargin < 6 + Iter = 3; +end + +if size(CMDevList,1) > 1 + % Pick the corrector based on the most effective corrector in the response matrix + % This routine does not handle local bumps at the moment + R = getrespmat(BPMFamily, BPMDevList, CMFamily, [], 'Struct', 'Physics'); + [i, iNotFound] = findrowindex(BPMDevList, R.Monitor.DeviceList); + m = R.Data(i,:); + [MaxValue, j] = max(abs(m)); + CMDevList = R.Actuator.DeviceList(j,:); +end + +s = getrespmat(BPMFamily, BPMDevList, CMFamily, CMDevList); +if any(any(isnan(s))) + error('Response matrix has a NaN'); +end + + +for i = 1:Iter + x = getam(BPMFamily, BPMDevList) - GoalOrbit; + + CorrectorSP = -(x./s); + CorrectorSP = CorrectorSP(:); + + % Check limits + MinSP = minsp(CMFamily, CMDevList); + MaxSP = maxsp(CMFamily, CMDevList); + if any(getsp(CMFamily,CMDevList)+CorrectorSP > MaxSP-5) + fprintf(' Orbit not corrected because a maximum power supply limit would have been exceeded!\n'); + return; + end + if any(getsp(CMFamily,CMDevList)+CorrectorSP < MinSP+5) + fprintf(' Orbit not corrected because a minimum power supply limit would have been exceeded!\n'); + return; + end + + stepsp(CMFamily, CorrectorSP, CMDevList, WaitFlag); + + %x = getam(BPMFamily, BPMDevList) - GoalOrbit +end + + + + +% function AM = getquad(QMS) +% % AM = getquad(QMS) +% +% QuadFamily = QMS.QuadFamily; +% QuadDev = QMS.QuadDev; +% +% % Check operational mode +% %mode = getfamilydata(QuadFamily, 'Setpoint', 'Mode', QuadDev); +% +% AM = getam(QuadFamily, QuadDev); + + +% function setquad(QMS, QuadSetpoint, WaitFlag) +% % setquad(QMS, QuadSetpoint, WaitFlag) +% +% if nargin < 3 +% WaitFlag = -2; +% end +% +% QuadFamily = QMS.QuadFamily; +% QuadDev = QMS.QuadDev; +% +% setsp(QuadFamily, QuadSetpoint, QuadDev, WaitFlag); + + + diff --git a/machine/ASP/StorageRing/quadcenter_manual.m b/machine/ASP/StorageRing/quadcenter_manual.m new file mode 100644 index 00000000..d67382c4 --- /dev/null +++ b/machine/ASP/StorageRing/quadcenter_manual.m @@ -0,0 +1,79 @@ +% close all +% 0 = both planes; 1 = x-plane; 2 = y-plane +plane = 0; + + +sector = [8]; % sector number eg 1:14 or 5 +BPM_num = [1:7]; % BPM number eg 1:7 + +% Turn on to furn BBA with paired quadrupoles +paired = 0; + +% Sector number for BPM +for i=sector + % BPM number within the sector + for j=BPM_num + +% if (i == 5 && j == 3) || (i == 11 && j == 5) % Measure BPM's + + %elseif i == 14 && j == 5 % Omit any BPM's that are not working + + + BPMDev = [i j]; + + % if getfamilydata('BPMx','Status',BPMDev) == 0 + % continue; + % end + + switch BPMDev(2) + case {1 2} + quadfam = 'QFA'; + if ~paired + quaddev = [BPMDev(1) 1]; + else + if BPMDev(1) == 1 + quaddev = [14 2; BPMDev(1) 1]; + else + quaddev = [BPMDev(1)-1 2; BPMDev(1) 1]; + end + end + case 3 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 1]; + case 4 + quadfam = 'QFB'; + if ~paired + quaddev = [BPMDev(1) 2]; + else + quaddev = [BPMDev(1) 1; BPMDev(1) 2]; + end + case 5 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 2]; + case {6 7} + quadfam = 'QFA'; + if ~paired + quaddev = [BPMDev(1) 2]; + else + if BPMDev(1) == 14 + quaddev = [BPMDev(1) 2; 1 1]; + else + quaddev = [BPMDev(1) 2; BPMDev(1)+1 1]; + end + end + end + + if ~paired + quadcenter(quadfam,quaddev,plane,BPMDev); + else + quadcenter_eugene(quadfam,quaddev,plane,BPMDev); + end + + end +end + + +for i = 1:4 + beep + pause(1) +end \ No newline at end of file diff --git a/machine/ASP/StorageRing/quadcenter_manual_non_continuous.m b/machine/ASP/StorageRing/quadcenter_manual_non_continuous.m new file mode 100644 index 00000000..61ef7958 --- /dev/null +++ b/machine/ASP/StorageRing/quadcenter_manual_non_continuous.m @@ -0,0 +1,48 @@ +close all +% 0 = both planes; 1 = x-plane; 2 = y-plane +plane = 0; + +sector = [4 4 5]; % sector number +BPM_num = [6 7 1]; % BPM number eg 1:7 + +% Sector number for BPM +for h=1:length(sector) + i=sector(h); + % BPM number within the sector + %for j=BPM_num + j=BPM_num(h); + if i == 10 && j == 5 + continue; + else + BPMDev = [i j]; + + % if getfamilydata('BPMx','Status',BPMDev) == 0 + % continue; + % end + + switch BPMDev(2) + case {1 2} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 1]; + case 3 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 1]; + case 4 + quadfam = 'QFB'; + quaddev = [BPMDev(1) 2]; + case 5 + quadfam = 'QDA'; + quaddev = [BPMDev(1) 2]; + case {6 7} + quadfam = 'QFA'; + quaddev = [BPMDev(1) 2]; + end + + + quadcenter(quadfam,quaddev,plane,BPMDev); + end + %end +end + +beep +return diff --git a/machine/ASP/StorageRing/quadcenterinit.m b/machine/ASP/StorageRing/quadcenterinit.m index c09045d4..85e5e0f8 100644 --- a/machine/ASP/StorageRing/quadcenterinit.m +++ b/machine/ASP/StorageRing/quadcenterinit.m @@ -1,225 +1,252 @@ -function QMS = quadcenterinit(QuadFamily, QuadDev, QuadPlane, varargin) -% QMS = quadcenterinit(Family, Device, QuadPlane, [BPMdev]) -% -% If BPMDev is not given the the closest BPM to the quadrupole is used. -% -% QuadFamily = Quadrupole family -% QuadDev = Quadrupole device -% QuadPlane = Plane (1=horizontal {default}, 2=vertical) -% -% QMS structure contains fields: -% QMS.QuadFamily -% QMS.QuadDev -% QMS.QuadDelta -% QMS.QuadPlane -% QMS.BPMFamily -% QMS.BPMDev -% QMS.BPMDevList -% QMS.CorrFamily -% QMS.CorrDevList % Often one magnet but bumps or anything else is fine -% QMS.CorrDelta % Scale factor for each magnet in CorrDevList -% QMS.DataDirectory % From AD or '.' -% QMS.QuadraticFit = 1; % 1=quadratic fit, else linear fit -% QMS.OutlierFactor = 1; % if abs(data - fit) > OutlierFactor * BPMstd, then remove that BPM [mm] -% QMS.NumberOfPoints = 3; -% QMS.ModulationMethod = 'bipolar' -% QMS.CorrectOrbit 'yes' or 'no' -% QMS.CreatedBy - - -if nargin < 1 - FamilyList = getfamilylist; - [tmp,i] = ismemberof(FamilyList,'QUAD'); - if ~isempty(i) - FamilyList = FamilyList(i,:); - end - [i,ok] = listdlg('PromptString', 'Select a quadrupole family:', ... - 'SelectionMode', 'single', ... - 'ListString', FamilyList); - if ok == 0 - return - else - QuadFamily = deblank(FamilyList(i,:)); - end -end -if ~isfamily(QuadFamily) - error(sprintf('Quadrupole family %s does not exist. Make sure the middle layer had been initialized properly.',QuadFamily)); -end -if nargin < 2 - QuadDev = editlist(getlist(QuadFamily),QuadFamily,zeros(length(getlist(QuadFamily)),1)); -end -if nargin < 3 - %QuadPlane = 1; % Horizontal default - ButtonNumber = menu('Which Plane?', 'Horizontal','Vertical','Cancel'); - switch ButtonNumber - case 1 - QuadPlane = 1; - case 2 - QuadPlane = 2; - otherwise - fprintf(' quadcenterinit cancelled'); - return - end -end - -% Initialize the QMS structure -QMS.QuadPlane = QuadPlane; -QMS.QuadFamily = QuadFamily; -QMS.QuadDev = QuadDev; -QMS.QuadraticFit = 0; % 0 = linear fit, else quadratic fit -QMS.OutlierFactor = 6; % BPM Outlier: abs(fit - measured data) > OutlierFactor * std(BPM) -QMS.NumberOfPoints = 5; % 5 -QMS.ModulationMethod = 'bipolar'; -QMS.CorrectOrbit = 'no'; % 'yes' or 'no'; % Only do if the orbit is reasonably close to the offset orbit - - -% Note: DataDirectory must start with the root of the tree and end with filesep or be '.' -QMSDirectory = [getfamilydata('Directory','DataRoot') 'QMS' filesep]; -if isempty(QMSDirectory) - QMS.DataDirectory = '.'; -else - QMS.DataDirectory = QMSDirectory; -end - - -% Select whether to use the first or second bpm to measure the offset -% for the QFA magnets. -bpm_in_short_girder = 2; % first (1) or second (2) - -% Default QMS structure -if QMS.QuadPlane==1 - % Default families - QMS.BPMFamily = 'BPMx'; - QMS.CorrFamily = 'HCM'; - - % Quad delta - spmax = getsp(QMS.QuadFamily, QMS.QuadDev); - switch QMS.QuadFamily - case 'QFA' - %QMS.QuadDelta = .05 * spmax; % in amps - QMS.QuadDelta = 0.03*spmax; - case 'QFB' - %QMS.QuadDelta = .02 * spmax; - QMS.QuadDelta = 0.03*spmax; - case 'QDA' - %QMS.QuadDelta = .02 * spmax; - QMS.QuadDelta = 0.03*spmax; - end - - if nargin < 4 - % BPM closest to the quad - QMS.BPMDevList = getlist(QMS.BPMFamily); - BPMspos = getspos(QMS.BPMFamily); - Quadspos = getspos(QMS.QuadFamily, QMS.QuadDev); - i = find(abs(Quadspos-BPMspos)==min(abs(Quadspos-BPMspos))); - QMS.BPMDev = QMS.BPMDevList(i,:); - if strcmpi(QMS.QuadFamily,'QFA') - QMS.BPMDev(2) = QMS.BPMDev(2) + (bpm_in_short_girder-1); - end - else - QMS.BPMDevList = getlist(QMS.BPMFamily); - QMS.BPMDev = varargin{1}; - end - - % Pick the corrector based on the response matrix to pick the most - % effective corrector. - R = getbpmresp('Struct','Hardware'); - [i, iNotFound] = findrowindex(QMS.BPMDev, R(1,1).Monitor.DeviceList); - m = R(1,1).Data(i,:); - [MaxValue, j] = max(abs(m)); - QMS.CorrDevList = R(1,1).Actuator.DeviceList(j,:); - - % Move beam closer to 0 if starting position is greater than +-2 mm. -% currpos = getam(QMS.BPMFamily,QMS.BPMDev,'Hardware'); -% if abs(currpos) > 2 -% resp_val = m(j); -% stepcorrval = -currpos./resp_val; -% stepsp(QMS.CorrFamily,stepcorrval,QMS.CorrDevList); -% end - - % Corrector delta in ampere. m(j) is the response of the bpm of interest due to - % the corrector of interest and is in units of mm/ampere. Therefore the - % number that we multiply against below are mm offsets that we want to - % observe at the BPM. - switch QMS.BPMDev(2) - case {1 7} - QMS.CorrDelta = 2; %abs((1./m(j)) * 1); - case {2 6} - QMS.CorrDelta = 2; %abs((1./m(j)) * 1); - case {4} - QMS.CorrDelta = 2; %abs((1./m(j)) * 1); - case {3 5} - QMS.CorrDelta = 2; %abs((1./m(j)) * 1); - end - if strcmpi(getunits(QMS.CorrFamily),'Physics') - % Calculated values above are in HW units. If the default units are - % in physics then we have to do a conversion into radians. - QMS.CorrDelta = hw2physics(QMS.CorrFamily,'Setpoint',QMS.CorrDelta,QMS.CorrDevList); - end - -elseif QMS.QuadPlane==2 - % Default families - QMS.BPMFamily = 'BPMy'; - QMS.CorrFamily = 'VCM'; - - % Quad delta - spmax = getsp(QMS.QuadFamily, QMS.QuadDev); - switch QMS.QuadFamily - case 'QFA' - %QMS.QuadDelta = .05 * spmax; % in amps - QMS.QuadDelta = 0.03*spmax; - case 'QFB' - %QMS.QuadDelta = .02 * spmax; - QMS.QuadDelta = 0.03*spmax; - case 'QDA' - %QMS.QuadDelta = .02 * spmax; - QMS.QuadDelta = 0.03*spmax; - end - - if nargin < 4 - % BPM closest to the quad - QMS.BPMDevList = getlist(QMS.BPMFamily); - BPMspos = getspos(QMS.BPMFamily); - Quadspos = getspos(QMS.QuadFamily, QMS.QuadDev); - i = find(abs(Quadspos-BPMspos)==min(abs(Quadspos-BPMspos))); - QMS.BPMDev = QMS.BPMDevList(i,:); - if strcmpi(QMS.QuadFamily,'QFA') - QMS.BPMDev(2) = QMS.BPMDev(2) + (bpm_in_short_girder-1); - end - else - QMS.BPMDevList = getlist(QMS.BPMFamily); - QMS.BPMDev = varargin{1}; - end - - % Pick the corrector based on the response matrix - R = getbpmresp('Struct','Hardware'); - [i, iNotFound] = findrowindex(QMS.BPMDev, R(2,2).Monitor.DeviceList); - m = R(2,2).Data(i,:); - [MaxValue, j] = max(abs(m)); - QMS.CorrDevList = R(2,2).Actuator.DeviceList(j,:); - - % Corrector delta in ampere. m(j) is the response of the bpm of interest due to - % the corrector of interest and is in units of mm/ampere. Therefore the - % number that we multiply against below are mm offsets that we want to - % observe at the BPM. - switch QMS.BPMDev(2) - case {1 7} - QMS.CorrDelta = 2; %-abs((1./m(j)) * 0.5); - case {2 6} - QMS.CorrDelta = 2; %-abs((1./m(j)) * 0.5); - case {4} - QMS.CorrDelta = 2; %-abs((1./m(j)) * 0.5); - case {3 5} - QMS.CorrDelta = 2; %-abs((1./m(j)) * 0.5); - end - if strcmpi(getunits(QMS.CorrFamily),'Physics') - % Calculated values above are in HW units. If the default units are - % in physics then we have to do a conversion into radians. - QMS.CorrDelta = hw2physics(QMS.CorrFamily,'Setpoint',QMS.CorrDelta,QMS.CorrDevList); - end -else - error('QMS.QuadPlane must be 1 or 2'); -end - -QMS.CreatedBy = 'quadcenterinit'; -QMS = orderfields(QMS); +function QMS = quadcenterinit(QuadFamily, QuadDev, QuadPlane, varargin) +% QMS = quadcenterinit(Family, Device, QuadPlane, [BPMdev]) +% +% If BPMDev is not given the the closest BPM to the quadrupole is used. +% +% QuadFamily = Quadrupole family +% QuadDev = Quadrupole device +% QuadPlane = Plane (1=horizontal {default}, 2=vertical) +% +% QMS structure contains fields: +% QMS.QuadFamily +% QMS.QuadDev +% QMS.QuadDelta +% QMS.QuadPlane +% QMS.BPMFamily +% QMS.BPMDev +% QMS.BPMDevList +% QMS.CorrFamily +% QMS.CorrDevList % Often one magnet but bumps or anything else is fine +% QMS.CorrDelta % Scale factor for each magnet in CorrDevList +% QMS.DataDirectory % From AD or '.' +% QMS.QuadraticFit = 1; % 1=quadratic fit, else linear fit +% QMS.OutlierFactor = 1; % if abs(data - fit) > OutlierFactor * BPMstd, then remove that BPM [mm] +% QMS.NumberOfPoints = 3; +% QMS.ModulationMethod = 'bipolar' +% QMS.CorrectOrbit 'yes' or 'no' +% QMS.CreatedBy + + +if nargin < 1 + FamilyList = getfamilylist; + [tmp,i] = ismemberof(FamilyList,'QUAD'); + if ~isempty(i) + FamilyList = FamilyList(i,:); + end + [i,ok] = listdlg('PromptString', 'Select a quadrupole family:', ... + 'SelectionMode', 'single', ... + 'ListString', FamilyList); + if ok == 0 + return + else + QuadFamily = deblank(FamilyList(i,:)); + end +end +if ~isfamily(QuadFamily) + error(sprintf('Quadrupole family %s does not exist. Make sure the middle layer had been initialized properly.',QuadFamily)); +end +if nargin < 2 + QuadDev = editlist(getlist(QuadFamily),QuadFamily,zeros(length(getlist(QuadFamily)),1)); +end +if nargin < 3 + %QuadPlane = 1; % Horizontal default + ButtonNumber = menu('Which Plane?', 'Horizontal','Vertical','Cancel'); + switch ButtonNumber + case 1 + QuadPlane = 1; + case 2 + QuadPlane = 2; + otherwise + fprintf(' quadcenterinit cancelled'); + return + end +end + +% Initialize the QMS structure +QMS.QuadPlane = QuadPlane; +QMS.QuadFamily = QuadFamily; +QMS.QuadDev = QuadDev; +QMS.QuadraticFit = 0; % 0 = linear fit, else quadratic fit +QMS.OutlierFactor = 6; % BPM Outlier: abs(fit - measured data) > OutlierFactor * std(BPM) +QMS.NumberOfPoints = 4; % 5 +QMS.ModulationMethod = 'bipolar'; +QMS.CorrectOrbit = 'no'; % 'yes' or 'no'; % Only do if the orbit is reasonably close to the offset orbit + + +% Note: DataDirectory must start with the root of the tree and end with filesep or be '.' +QMSDirectory = [getfamilydata('Directory','DataRoot') 'QMS' filesep]; +if isempty(QMSDirectory) + QMS.DataDirectory = '.'; +else + QMS.DataDirectory = QMSDirectory; +end + + +% Select whether to use the first or second bpm to measure the offset +% for the QFA magnets. +bpm_in_short_girder = 2; % first (1) or second (2) + +% Default QMS structure +if QMS.QuadPlane==1 + % Default families + QMS.BPMFamily = 'BPMx'; + QMS.CorrFamily = 'HCM'; + + % Quad delta. Can actuate more than one quadrupole... so scale + % the strength linearly with the number of quads to actuate. + spmax = getsp(QMS.QuadFamily, QMS.QuadDev); + switch QMS.QuadFamily + case 'QFA' + %QMS.QuadDelta = .05 * spmax; % in amps + QMS.QuadDelta = 0.02*spmax/length(spmax); + case 'QFB' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 0.01*spmax/length(spmax); + case 'QDA' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 0.03*spmax/length(spmax); + case 'SFA' + %QMS.QuadDelta = .05 * spmax; % in amps + QMS.QuadDelta = 20; + case 'SDA' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 20; + case 'SDB' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 20; + case 'SFB' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 20; + end + + if nargin < 4 + % BPM closest to the quad + QMS.BPMDevList = getlist(QMS.BPMFamily); + BPMspos = getspos(QMS.BPMFamily); + Quadspos = getspos(QMS.QuadFamily, QMS.QuadDev); + i = find(abs(Quadspos-BPMspos)==min(abs(Quadspos-BPMspos))); + QMS.BPMDev = QMS.BPMDevList(i,:); + if strcmpi(QMS.QuadFamily,'QFA') + QMS.BPMDev(2) = QMS.BPMDev(2) + (bpm_in_short_girder-1); + end + else + QMS.BPMDevList = getlist(QMS.BPMFamily); + QMS.BPMDev = varargin{1}; + end + + % Pick the corrector based on the response matrix to pick the most + % effective corrector. + R = getbpmresp('Struct','Hardware'); + [i, iNotFound] = findrowindex(QMS.BPMDev, R(1,1).Monitor.DeviceList); +% [i, iNotFound] = findrowindex([3 3], R(1,1).Monitor.DeviceList); + m = R(1,1).Data(i,:); + [MaxValue, j] = max(abs(m)); + QMS.CorrDevList = R(1,1).Actuator.DeviceList(j,:); + + % Move beam closer to 0 if starting position is greater than +-2 mm. +% currpos = getam(QMS.BPMFamily,QMS.BPMDev,'Hardware'); +% if abs(currpos) > 2 +% resp_val = m(j); +% stepcorrval = -currpos./resp_val; +% stepsp(QMS.CorrFamily,stepcorrval,QMS.CorrDevList); +% end + + % Corrector delta in ampere. m(j) is the response of the bpm of interest due to + % the corrector of interest and is in units of mm/ampere. Therefore the + % number that we multiply against below are mm offsets that we want to + % observe at the BPM. + switch QMS.BPMDev(2) + case {1 7} + QMS.CorrDelta = 1; %2; %abs((1./m(j)) * 1); + case {2 6} + QMS.CorrDelta = 1; %2; %abs((1./m(j)) * 1); + case {4} + QMS.CorrDelta = 1; %2; %abs((1./m(j)) * 1); + case {3 5} + QMS.CorrDelta = 2; %3; %abs((1./m(j)) * 1); + end + if strcmpi(getunits(QMS.CorrFamily),'Physics') + % Calculated values above are in HW units. If the default units are + % in physics then we have to do a conversion into radians. + QMS.CorrDelta = hw2physics(QMS.CorrFamily,'Setpoint',QMS.CorrDelta,QMS.CorrDevList); + end + +elseif QMS.QuadPlane==2 + % Default families + QMS.BPMFamily = 'BPMy'; + QMS.CorrFamily = 'VCM'; + + % Quad delta + spmax = getsp(QMS.QuadFamily, QMS.QuadDev); + switch QMS.QuadFamily + case 'QFA' + %QMS.QuadDelta = .05 * spmax; % in amps + QMS.QuadDelta = 0.02*spmax/length(spmax); + case 'QFB' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 0.01*spmax/length(spmax); + case 'QDA' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 0.03*spmax/length(spmax); + case 'SFA' + %QMS.QuadDelta = .05 * spmax; % in amps + QMS.QuadDelta = 40; + case 'SDA' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 40; + case 'SDB' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 40; + case 'SFB' + %QMS.QuadDelta = .02 * spmax; + QMS.QuadDelta = 40; + end + + if nargin < 4 + % BPM closest to the quad + QMS.BPMDevList = getlist(QMS.BPMFamily); + BPMspos = getspos(QMS.BPMFamily); + Quadspos = getspos(QMS.QuadFamily, QMS.QuadDev); + i = find(abs(Quadspos-BPMspos)==min(abs(Quadspos-BPMspos))); + QMS.BPMDev = QMS.BPMDevList(i,:); + if strcmpi(QMS.QuadFamily,'QFA') + QMS.BPMDev(2) = QMS.BPMDev(2) + (bpm_in_short_girder-1); + end + else + QMS.BPMDevList = getlist(QMS.BPMFamily); + QMS.BPMDev = varargin{1}; + end + + % Pick the corrector based on the response matrix + R = getbpmresp('Struct','Hardware'); + [i, iNotFound] = findrowindex(QMS.BPMDev, R(2,2).Monitor.DeviceList); +% [i, iNotFound] = findrowindex([3 3], R(2,2).Monitor.DeviceList); + m = R(2,2).Data(i,:); + [MaxValue, j] = max(abs(m)); + QMS.CorrDevList = R(2,2).Actuator.DeviceList(j,:); + + % Corrector delta in ampere. m(j) is the response of the bpm of interest due to + % the corrector of interest and is in units of mm/ampere. Therefore the + % number that we multiply against below are mm offsets that we want to + % observe at the BPM. + switch QMS.BPMDev(2) + case {1 7} + QMS.CorrDelta = 1; %-abs((1./m(j)) * 0.5); + case {2 6} + QMS.CorrDelta = 1; %-abs((1./m(j)) * 0.5); + case {4} + QMS.CorrDelta = 1; %-abs((1./m(j)) * 0.5); + case {3 5} + QMS.CorrDelta = 1; %-abs((1./m(j)) * 0.5); + end + if strcmpi(getunits(QMS.CorrFamily),'Physics') + % Calculated values above are in HW units. If the default units are + % in physics then we have to do a conversion into radians. + QMS.CorrDelta = hw2physics(QMS.CorrFamily,'Setpoint',QMS.CorrDelta,QMS.CorrDevList); + end +else + error('QMS.QuadPlane must be 1 or 2'); +end + +QMS.CreatedBy = 'quadcenterinit'; +QMS = orderfields(QMS); diff --git a/machine/ASP/StorageRing/ramp_sext_down.m b/machine/ASP/StorageRing/ramp_sext_down.m new file mode 100644 index 00000000..37412597 --- /dev/null +++ b/machine/ASP/StorageRing/ramp_sext_down.m @@ -0,0 +1,51 @@ +afamily = [ + 0.95 + 0.9 + 0.85 + 0.8 + 0.75 + 0.7 + 0.6 + 0.5 + 0.45 + 0.4 + 0.35 + 0.3 + 0.25 + 0.2 + 0.15 + 0.10 + 0]; +bfamily = [ + 0.95 + 0.9 + 0.85 + 0.8 + 0.75 + 0.7 + 0.65 + 0.6 + 0.55 + 0.5 + 0.45 + 0.4 + 0.35 + 0.3 + 0.25 + 0.2 + 0.0]; + +sfa_init = getsp('SFA'); +sda_init = getsp('SDA'); +sfb_init = getsp('SFB'); +sdb_init = getsp('SDB'); + +for i=1:length(afamily) + % The [] means all devices in that family and -1 means that it will + % also monitor the readback and only return when the readback reaches + % the setpoint. + setsp('SFA',sfa_init*afamily,[],-1); + setsp('SDA',sda_init*afamily,[],-1); + setsp('SFB',sfb_init*bfamily,[],-1); + setsp('SDB',sdb_init*bfamily,[],-1); +end \ No newline at end of file diff --git a/machine/ASP/StorageRing/scalekickers.m b/machine/ASP/StorageRing/scalekickers.m index 30c75aef..ef50f33b 100644 --- a/machine/ASP/StorageRing/scalekickers.m +++ b/machine/ASP/StorageRing/scalekickers.m @@ -1,22 +1,42 @@ -start_kick = [... -754.436200;... -729.816200;... -778.147200;... -790.224000;... - ]; +% +% start_kick = 1e3*[... +% 1.0766;... +% 0.8100;... +% 0.8505;... +% 1.0766;... +% ]; -scale_kick_dc = 1.23; -scale_kick = scale_kick_dc + [... - 0;... - 0;... - 0;... - 0;... +start_kick = 1e3*[... + 1.085361125348219 + 0.777860772891015 + 0.826628872449025 + 1.085902123286940 ]; -setsp('KICK',start_kick([1 2 3 4]).*scale_kick,'Hardware'); +% 1.62 GeV +start_kick = [ + 737.4172 + 584.0000 + 582.5500 + 737.4172]; +%scale_kick_dc = 1.23; +scale_kick_dc = 0.92; +scale_kick = scale_kick_dc + [... + -0.00;... + 0.00;... + 0.00;... + -0.00;... + ]; +setsp('KICK',start_kick([1 2 3 4]).*scale_kick,'Hardware','Online'); +%start_kick = [... +%754.436200;... +%729.816200;... +%778.147200;... +%790.224000;... +% ]; % start_kick = [... diff --git a/machine/ASP/StorageRing/scraper_app.m b/machine/ASP/StorageRing/scraper_app.m index 09eb7cc2..d5926254 100644 --- a/machine/ASP/StorageRing/scraper_app.m +++ b/machine/ASP/StorageRing/scraper_app.m @@ -1,62 +1,187 @@ -function scraper_app(choice) - -%funtion is given choice of UPPER or LOWER -%function returns the lifetime and current at each of a number of scraper positions - -steps = 23; %21; - -if strcmp(choice,'UPPER') || strcmp(choice,'LOWER') - data = zeros(4,steps); - data(1,:) = [6 7 8 9 10 11 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12 12.1 12.2 12.3 12.4 12.5 13 13.5 ]; -elseif strcmp(choice,'INNER') - data = zeros(3,21); - data(1,:) = [6 8 10 12 12.5 13 13.5 14 14.5 14.8 15 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16]; -elseif strcmp(choice,'OUTER') - data = zeros(3,21); - data(1,:) = [6 8 10 12 12.5 13 13.5 14 14.5 14.8 15 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16]; -end - -time = clock; -filesave = ['/asp/usr/commissioning/scraperscan/ScraperScan' date '-' num2str(time(4)) '-' num2str(time(5)) '-' num2str(fix(time(6)))]; -fprintf('Data saved to: %s\n',filesave); - - -scrape = ['SR11SCR01:' num2str(choice) '_POSITION_SP']; - -for(i=1:steps) - - if getpv('SR11BCM01:CURRENT_MONITOR')<=5 - disp('ERROR: CURRENT IS LOW!'); - setpv(scrape,0); - return - end - - setpv(scrape,data(1,i)); - pause(3); - disp('gathering lifetime data') - data(2,i) = lifetime(45); - data(3,i) = getpv('SR11BCM01:CURRENT_MONITOR') - data(4,i) = data(2,i) * (data(3,i)/data(3,1)); - - save(filesave, 'data'); - -end - -setpv(scrape,0); -save(filesave, 'data'); - -figure(47) -plot(data(1,:),data(4,:)) -temp = [choice ' SCRAPER DATA']; -title(temp) -xlabel('Scraper position (mm)') -ylabel('Normalised lifetime (h)') - - - - - - - - - \ No newline at end of file +function scraper_app(choice,lifemeas) + +%funtion is given choice of UPPER or LOWER +%function returns the lifetime and current at each of a number of scraper positions + + +% 24/5/2007 curerntly runs both upper and lower scraper in. Will need to +% edit again to use only one scrper at a time. +% 04/07/2011 ET updated so single and double move of the scraper blades is +% possible. filename changes as well so data plots will not be compatible +% to previous files. Data saved is exactly the same will use the filename +% as the timestamp. + +% +-0.15 is a calibration factor to account for the offset of the +% scraper relative to the beam center. +switch lower(choice) + case 'upper' + data(1,:) = [8:0.25:10 10.1:0.1:11 11.05:0.05:12.5 12.6:.1:14]; +% data(1,:) = [8 10 11 11.5 12 12.5 13 13.5 14 14.01 14.02 14.03 14.04 14.05 14.06 14.07 14.08 14.09 14.1 14.11 14.12 ... +% 14.13 14.14 14.15 14.16 14.17 14.18 14.19 14.2 14.21 14.22 14.23 14.24 14.25 14.26 14.27 14.28 14.29 14.3 14.31 ... +% 14.32 14.34 14.35 14.36 14.37 14.38 14.39 14.4 14.41 14.42 14.43 14.44 14.45 14.46 14.47 14.48 14.49 ... +% 14.5 14.51 14.52 14.53 14.54 14.55 14.56 14.57 14.58 14.59 14.6 14.61 14.62 14.63 14.64 14.65 14.66 ... +% 14.67 14.68 14.69 14.7 14.71 14.72 14.73 14.74 14.75 14.76 14.77 14.78 14.79 14.8 14.81 14.82 14.83 ... +% 14.84 14.85 14.86 14.87 14.88 14.89 14.9 14.91 14.92 14.93 14.94 14.95 14.96 14.97 14.98 14.99 15 ]; +% data(1,:) = [8 10 11 11.25 11.5 11.75 12 12.25 12.5 12.75 13 13.25 13.5 13.75 14 14.05 14.1 14.15 14.2 14.25 14.3 14.35 ... +% 14.4 14.45 14.5 14.55 14.6 14.65 14.7 14.75 14.8 14.81 14.82 14.83 14.85 14.9 14.95 15 15.01 15.02 15.03 15.04 15.05 ... +% 15.06 15.07 15.08 15.09 15.1 15.11 15.12 15.13 15.14 15.15 15.16 15.17 15.18 15.19 15.2 15.21 15.22 15.23 15.24 15.25 ... +% 15.26 15.27 15.28 15.29 15.3 15.31 15.32 15.33 15.34 15.35 15.36 15.37 15.38 15.39 15.4 15.41 15.42 15.43 15.44 15.45 ... +% 15.46 15.47 15.48 15.49 15.5 15.51 15.52 15.53 15.54 15.55 15.56 15.57 15.58 15.59 15.6 15.61 15.62 15.63 15.64 15.65 ... +% 15.66 15.67 15.68 15.69 15.7 15.71 15.72 15.73 15.74 15.75 15.76 15.77 15.78 15.79 15.8 15.81 15.82 15.83 15.84 15.85 ... +% 15.86 15.87 15.88 15.89 15.9 15.91 15.92 15.93 15.94 15.95 15.96 15.97 15.98 15.99 16]; + + + pospv = {'SR11SCR01:UPPER_POSITION_SP'}; + enablepv = {'SR11SCR01:UPPER_ENABLE_CMD'}; + + case 'lower' + data(1,:) = [8:0.25:10 10.1:0.1:11 11.05:0.05:12.5 12.6:.1:14]; +% data(1,:) = [8 10 11 11.5 12 12.5 13 13.5 14 14.01 14.02 14.03 14.04 14.05 14.06 14.07 14.08 14.09 14.1 14.11 14.12 ... +% 14.13 14.14 14.15 14.16 14.17 14.18 14.19 14.2 14.21 14.22 14.23 14.24 14.25 14.26 14.27 14.28 14.29 14.3 14.31 ... +% 14.32 14.34 14.35 14.36 14.37 14.38 14.39 14.4 14.41 14.42 14.43 14.44 14.45 14.46 14.47 14.48 14.49 ... +% 14.5 14.51 14.52 14.53 14.54 14.55 14.56 14.57 14.58 14.59 14.6 14.61 14.62 14.63 14.64 14.65 14.66 ... +% 14.67 14.68 14.69 14.7 14.71 14.72 14.73 14.74 14.75 14.76 14.77 14.78 14.79 14.8 14.81 14.82 14.83 ... +% 14.84 14.85 14.86 14.87 14.88 14.89 14.9 14.91 14.92 14.93 14.94 14.95 14.96 14.97 14.98 14.99 15 ]; + pospv = {'SR11SCR01:LOWER_POSITION_SP'}; + enablepv = {'SR11SCR01:LOWER_ENABLE_CMD'}; + + case 'inner' + data(1,:) = [6 8 10 12 12.25, ... + 12.5 12.75 13 13.5 14 14.5 14.8 15 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16]; + pospv = {'SR11SCR01:INNER_POSITION_SP'}; + enablepv = {'SR11SCR01:INNER_ENABLE_CMD'}; + case 'outer' + data(1,:) = [6 8 10 12 12.5 13 13.5 14 14.5 14.8 15 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16]; + pospv = {'SR11SCR01:OUTER_POSITION_SP'}; + enablepv = {'SR11SCR01:OUTER_ENABLE_CMD'}; + + case 'both' + data(1,:) = [8:0.25:10 10.1:0.1:11 11.05:0.05:12.5 12.6:.1:14]; + pospv = {'SR11SCR01:UPPER_POSITION_SP','SR11SCR01:LOWER_POSITION_SP'}; + enablepv = {'SR11SCR01:UPPER_ENABLE_CMD','SR11SCR01:LOWER_ENABLE_CMD'}; +end + +steps = size(data,2); + + +time = clock; +filesave = ['/asp/usr/measurements/scrapers/' appendtimestamp('ScraperScan')]; +fprintf('Data saved to: %s\n',filesave); + +for i=1:steps + + % if there is too little current then stop gathering data, save and + % return may have dumped beam. + if getpv('SR11BCM01:CURRENT_MONITOR')<=0.1 + disp('ERROR: CURRENT IS LOW!'); + % open up the scrapers + setpv(pospv,repmat({0},size(pospv))); + + save(filesave, 'data'); + + figure(47) + plot(data(1,:),data(4,:)) + temp = ['UPPER & LOWER SCRAPER DATA']; + title(temp) + xlabel('Scraper position (mm)') + ylabel('Normalised lifetime (h)') + beep; + return + end + + setpv(enablepv,repmat({1},size(pospv))); + pause(0.3); + if strcmpi(choice,'both') + setpv(pospv,{data(1,i)+0.15,data(1,i)-0.15}); + else + setpv(pospv,{data(1,i)}); + end + pause(3); + + % disable to improve lifetime measurements + setpv(enablepv,repmat({0},size(pospv))); + pause(0.3) + disp('gathering lifetime data') + if i > 1 && data(2,i-1) < data(2,1)/2 + % attempt to decrease the time required for a lifetime measurement + % if the previous results show that the lifetime has already + % decreased by 1/3 of the initial lifetime. + data(2,i) = lifetime(lifemeas/2); + else + data(2,i) = lifetime(lifemeas); + end + data(3,i) = getpv('SR11BCM01:CURRENT_MONITOR'); + data(4,i) = data(2,i) * (data(3,i)/data(3,1)); + + + save(filesave, 'data'); + +end + +setpv(enablepv,repmat({1},size(pospv))); +setpv(pospv,repmat({0},size(pospv))); +pause(6); +setpv(enablepv,repmat({0},size(pospv))); + +save(filesave, 'data'); + +figure(47) +plot(data(1,:),data(4,:)) + +xlabel('Scraper position (mm)') +ylabel('Normalised lifetime (h)') + +beep; +return + + +%% +time = clock; +filesave = ['/asp/usr/measurements/scrapers/ScraperScan' date '-' num2str(time(4)) '-' num2str(time(5)) '-' num2str(fix(time(6)))]; +fprintf('Data saved to: %s\n',filesave); + +scrape = ['SR11SCR01:' num2str(choice) '_POSITION_SP']; + +for(j=1:steps) + + if getpv('SR11BCM01:CURRENT_MONITOR')<=5 + disp('ERROR: CURRENT IS LOW!'); + setpv(scrape,0); + + save(filesave, 'data'); + + figure(47) + plot(data(1,:),data(4,:)) + temp = [choice 'SCRAPER DATA']; + title(temp) + xlabel('Scraper position (mm)') + ylabel('Normalised lifetime (h)') + beep; + return + end + + setpv(scrape,data(1,j)); + pause(3); + disp('gathering lifetime data') + data(2,j) = lifetime(10); + data(3,j) = getpv('SR11BCM01:CURRENT_MONITOR') + data(4,j) = data(2,j) * (data(3,j)/data(3,j)); + + save(filesave, 'data'); + +end + +setpv(scrape,0); +save(filesave, 'data'); + +figure(47) +plot(data(1,:),data(4,:)) +temp = [choice 'SCRAPER DATA']; +title(temp) +xlabel('Scraper position (mm)') +ylabel('Normalised lifetime (h)') + +beep + + + diff --git a/machine/ASP/StorageRing/setchromaticity.m b/machine/ASP/StorageRing/setchromaticity.m new file mode 100644 index 00000000..338ecffb --- /dev/null +++ b/machine/ASP/StorageRing/setchromaticity.m @@ -0,0 +1,166 @@ +function varargout = setchromaticity(varargin) +% SETCHROMATICITY([CHROMX CHROMY],[SFAval SDAval],Mode,'fitonly') +% +% Uses the model to determine how to set the sextupolesn (SFB and SDB) to get the desired +% chromaticity. If SFAval and SDAval is supplies (in PHYSICS units) then +% these will values will be used in the model and also applied to the +% machine. +% +% CHROMX, CHROMY - horizontal and vertical chromacitity +% SFAval, SDAval - desired setpoint for SFA and SDA in PHYSICS units (optional) +% Mode - lattice selection (optional). +% 'fitonly' - if fit only specified then don't set. +% +% Frequency: 499.67163 [MHz] +% Operational setpoint as of 23/01/2014: +% setchromaticity ([3.5 13], [15.9 -17.3]) +% +% ET + +fitonly = 0; +for i=1:nargin + if ischar(varargin{i}) + switch varargin{i} + case 'fitonly' + fitonly = 1; + end + end +end +if nargin > 0 + chromx = varargin{1}(1); + chromy = varargin{1}(2); +else + error('See usage of SETCHROMATICITY'); +end + +if nargin > 1 + sfa = varargin{2}(1); + sda = varargin{2}(2); +else + sfa = getsp('SFA',1,'physics'); + sda = getsp('SDA',1,'physics'); +end + +ModeCell = {'User mode 0.1 m dispersion', + 'Low Alpha -0.7 m dispersion' + 'Low Alpha -0.88 m dispersion' + 'User mode 0.0 m dispersion' + 'User mode 0.24 m dispersion' + '7-fold lattice' + 'Use current THERING'}; +if nargin > 2 && isnumeric(varargin{3}) + ButtonName = varargin{3}; + OKFlag = 1; +else + [ButtonName, OKFlag] = listdlg('Name','Set Chromaticity','PromptString','Currently used lattice?', 'SelectionMode','single', 'ListString', ModeCell, 'ListSize', [350 125]); + % OKFlag = 1; + % ButtonName = 2; +end + +if ~OKFlag + disp('Nothing done. Exiting setchromaticity.'); + return +else + fprintf('Using lattice: %s\n',ModeCell{ButtonName}); +end + +global THERING +OLDTHERING = THERING; + +switch ButtonName + case 1 + assr4_modbend; +% fittunedisp2([13.29 5.216 0.0],'QFA','QDA','QFB',1); % Eugene 16/5/2010 removed to optimise speed for sextupole scan. +% fittunedisp2([13.29 5.216 0.096],'QFA','QDA','QFB',1); % Eugene +% 16/5/2010 removed to optimise speed for sextupole scan. + ind = findcells(THERING,'FamName','QFA'); + THERING = setcellstruct(THERING,'PolynomB',ind,1.7712776,2); + THERING = setcellstruct(THERING,'K',ind,1.7712776); + ind = findcells(THERING,'FamName','QDA'); + THERING = setcellstruct(THERING,'PolynomB',ind,-1.0565061,2); + THERING = setcellstruct(THERING,'K',ind,-1.0565061); + ind = findcells(THERING,'FamName','QFB'); + THERING = setcellstruct(THERING,'PolynomB',ind,1.5324321,2); + THERING = setcellstruct(THERING,'K',ind,1.5324321); + case 2 + setoperationalmode(7); + fittunedisp2([13.29 5.20 -0.7],'QFA','QDA','QFB',1); + case 3 + setoperationalmode(9); + fittunedisp2([13.29 5.216 -0.88],'QFA','QDA','QFB',1); + case 4 + assr4_modbend; + fittunedisp2([13.289 5.205 0],'QFA','QDA','QFB',1); + case 5 + assr4_modbend; + fittunedisp2([13.29 5.216 0.24],'QFA','QDA','QFB',1); + case 6 + setoperationalmode(10); + case 7 + % do nothing; use current lattice + +end + +sind(:,1) = findcells(THERING,'FamName','SFA'); +sind(:,2) = findcells(THERING,'FamName','SDA'); +% Hack just to make it a little neater, should not really affect the +% results. there are 28 other family of sext but for SFB there are only 14. +sind(:,3) = [findcells(THERING,'FamName','SFB') findcells(THERING,'FamName','SFB')]; +sind(:,4) = findcells(THERING,'FamName','SDB'); +% Set as close to storage ring settings as possible. These numbers 15.6 and +% -16.6 etc. are taken from the machine using getsp(...,'physics'); So as +% the machine energy is 1.4% less than the design of 3 GeV the values need +% to be multiplied by 1.014 before putting it into the model (model is +% assuming 3 GeV). +% THERING = setcellstruct(THERING,'PolynomB',sind(:,1),15.6*1.014,3); +% THERING = setcellstruct(THERING,'PolynomB',sind(:,2),-16.6*1.014,3); + +THERING = setcellstruct(THERING,'PolynomB',sind(:,1),sfa*1.014,3); +THERING = setcellstruct(THERING,'PolynomB',sind(:,2),sda*1.014,3); + +THERING = setcellstruct(THERING,'PolynomB',sind(:,3),7.54467314*1.014,3); +THERING = setcellstruct(THERING,'PolynomB',sind(:,4),-8.21721*1.014,3); + +% THERING = setcellstruct(THERING,'PolynomB',sind(:,1),getsp('SFA',[1 1],'physics')*1.014,3); +% THERING = setcellstruct(THERING,'PolynomB',sind(:,2),getsp('SDA',[1 1],'physics')*1.014,3); +% THERING = setcellstruct(THERING,'PolynomB',sind(:,3),getsp('SFB',[1 1],'physics')*1.014,3); +% THERING = setcellstruct(THERING,'PolynomB',sind(:,4),getsp('SDB',[1 1],'physics')*1.014,3); + +fitchrom2([chromx chromy],'SFB','SDB'); + + +sfaind = findcells(THERING,'FamName','SFA'); +sdaind = findcells(THERING,'FamName','SDA'); +sfbind = findcells(THERING,'FamName','SFB'); +sdbind = findcells(THERING,'FamName','SDB'); + +modelSFA = physics2hw('SFA','Setpoint',getcellstruct(THERING,'PolynomB',sfaind(1),3)/1.014); +modelSDA = physics2hw('SDA','Setpoint',getcellstruct(THERING,'PolynomB',sdaind(1),3)/1.014); + +modelSFB = physics2hw('SFB','Setpoint',getcellstruct(THERING,'PolynomB',sfbind(1),3)/1.014); +modelSDB = physics2hw('SDB','Setpoint',getcellstruct(THERING,'PolynomB',sdbind(1),3)/1.014); + + +THERING = OLDTHERING; + +if ~fitonly + %Slowly ramp up to new setpoint + curSFA = getsp('SFA',[1 1],'Hardware'); + curSDA = getsp('SDA',[1 1],'Hardware'); + curSFB = getsp('SFB',[1 1],'Hardware'); + curSDB = getsp('SDB',[1 1],'Hardware'); + + for j=1:5 + setsp('SFA',curSFA + (modelSFA - curSFA)*j/5,'Hardware'); + setsp('SDA',curSDA + (modelSDA - curSDA)*j/5,'Hardware'); + setsp('SFB',curSFB + (modelSFB - curSFB)*j/5,'Hardware'); + setsp('SDB',curSDB + (modelSDB - curSDB)*j/5,'Hardware'); + % pause(0.2); + end + disp('Done. Chromaticity set.'); +end + +if nargout > 0 + varargout{1} = [mean(modelSFA) mean(modelSDA) mean(modelSFB) mean(modelSDB)]; +end + diff --git a/machine/ASP/StorageRing/setchromaticity_et.m b/machine/ASP/StorageRing/setchromaticity_et.m new file mode 100644 index 00000000..93083cd9 --- /dev/null +++ b/machine/ASP/StorageRing/setchromaticity_et.m @@ -0,0 +1,73 @@ +function varargout = setchromaticity(varargin) +% SETCHROMATICITY([CHROMX CHROMY]) + +% disp('Warning: this only applies to zero dispersion lattice'); +% disp('Warning: will also change setoperatioalmode(1)'); + +if nargin > 0 + chromx = varargin{1}(1); + chromy = varargin{1}(2); +else + error('See usage of SETCHROMATICITY'); +end + +ModeCell = {'User mode 0.1 m dispersion', + 'Low Alpha -0.5 m dispersion' + 'Low Alpha -0.75 m dispersion'}; +[ButtonName, OKFlag] = listdlg('Name','Set Chromaticity','PromptString','Currently used lattice?', 'SelectionMode','single', 'ListString', ModeCell, 'ListSize', [350 125]); + +if ~OKFlag + disp('Nothing done. Exiting setchromaticity.'); + return +else + fprintf('Using lattice: %s\n',ModeCell{ButtonName}); +end + +switch ButtonName + case 1 + assr4_modbend; + fittunedisp2([13.29 5.216 0.096],'QFA','QDA','QFB',1); + case 2 + setoperationalmode(8); + fittunedisp2([13.29 5.22 -0.5],'QFA','QDA','QFB',1); + case 3 + setoperationalmode(9); + fittunedisp2([13.29 5.22 -0.75],'QFA','QDA','QFB',1); +end + +global THERING +sind(:,1) = findcells(THERING,'FamName','SFA'); +sind(:,2) = findcells(THERING,'FamName','SDA'); +% Hack just to make it a little neater, should not really affect the +% results. there are 28 other family of sext but for SFB there are only 14. +sind(:,3) = [findcells(THERING,'FamName','SFB') findcells(THERING,'FamName','SFB')]; +sind(:,4) = findcells(THERING,'FamName','SDB'); +% Set as close to storage ring settings as possible. These numbers 15.6 and +% -16.6 etc. are taken from the machine using getsp(...,'physics'); So as +% the machine energy is 1.4% less than the design of 3 GeV the values need +% to be multiplied by 1.014 before putting it into the model (model is +% assuming 3 GeV). +THERING = setcellstruct(THERING,'PolynomB',sind(:,1),15.6*1.014,3); +THERING = setcellstruct(THERING,'PolynomB',sind(:,2),-16.9*1.014,3); +THERING = setcellstruct(THERING,'PolynomB',sind(:,3),7.67314*1.014,3); +THERING = setcellstruct(THERING,'PolynomB',sind(:,4),-8.21721*1.014,3); +fitchrom2([chromx chromy],'SFB','SDB'); + + +sfbind = findcells(THERING,'FamName','SFB'); +sdbind = findcells(THERING,'FamName','SDB'); + +modelSFB = physics2hw('SFB','Setpoint',getcellstruct(THERING,'PolynomB',sfbind(1),3)/1.014); +modelSDB = physics2hw('SDB','Setpoint',getcellstruct(THERING,'PolynomB',sdbind(1),3)/1.014); + + +%Slowly ramp up to new setpoint +curSFB = getsp('SFB',[1 1],'Online','Hardware'); +curSDB = getsp('SDB',[1 1],'Online','Hardware'); +for j=1:5 + setsp('SFB',curSFB + (modelSFB - curSFB)*j/5,'Hardware','Online'); + setsp('SDB',curSDB + (modelSDB - curSDB)*j/5,'Hardware','Online'); + pause(0.2); +end + +disp('Done. Chromaticity set.'); diff --git a/machine/ASP/StorageRing/setinjectionbump.m b/machine/ASP/StorageRing/setinjectionbump.m index bc4d19a8..cb138056 100644 --- a/machine/ASP/StorageRing/setinjectionbump.m +++ b/machine/ASP/StorageRing/setinjectionbump.m @@ -1,6 +1,6 @@ -function setinjectionbump(injoffset,varargin) +function varargout=setinjectionbump(injoffset,varargin) % -% SETINJECTIONBUMP(INJOFFSET,[angle]) will set the kickers to creates a local +% SETINJECTIONBUMP(INJOFFSET,[angle in mrad]) will set the kickers to creates a local % injection bump INJOFFSET mm from the beam axis. This uses the model to % calculate the beam kicker response matrix in order to set the bumps. The % angle is optional and defined in mradians. @@ -18,17 +18,17 @@ function setinjectionbump(injoffset,varargin) setcavity off; -bpm = getam('BPMx',elem2dev('BPMx',[1 8:91 98]),'Struct'); +bpm = getam('BPMx',elem2dev('BPMx',[1 8:2:91 98]),'Struct'); bpm.Data(:) = 0; bpmfamily = 'BPMx'; -bpmdevlist = elem2dev('BPMx',[1 8:91 98]); +bpmdevlist = elem2dev('BPMx',[1 8:2:91 98]); % BPMWeight = [1; ones(size(bpm.DeviceList,1)-2,1)*1; 1]; % Select "correctors". cmfamily = 'KICK'; cmdevlist = getfamilydata('KICK','DeviceList'); cm = getsp('KICK','Struct','Online'); cm.Data(:) = 0; -Niter = 1; +Niter = 5; SVDIndex = 'All'; % Calculate the offsets necessary at each bpm given the offset and angle @@ -41,8 +41,8 @@ function setinjectionbump(injoffset,varargin) % Distance between the BPMs in the in the injection straight. L = 2.3041; -injoffset_bpm01 = injoffset*1e-3 + L*sin(inangle*1e-3) -injoffset_bpm98 = injoffset*1e-3 - L*sin(inangle*1e-3) +injoffset_bpm01 = injoffset*1e-3 + L*sin(inangle*1e-3); +injoffset_bpm98 = injoffset*1e-3 - L*sin(inangle*1e-3); % if abs(injoffset) >= 10 % % Take in two steps @@ -55,5 +55,18 @@ function setinjectionbump(injoffset,varargin) cc = setorbit(goalorbit, bpm, cm, Niter, SVDIndex, 'ModelResp','ModelDisp','SetSP','Model'); % setsp(physics2hw(cc.CM),'Model'); % end +data = physics2hw(cc.CM); + +if nargout == 0 + fprintf('Setting Kicker in the model to:\n'); + fprintf(' Kicker1=%f Volts\n Kicker2=%f Volts\n Kicker3=%f Volts\n Kicker4=%f Volts\n',... + data.Data'); +else + varargout{1} = data; +end +% setsp(data,'model'); + +switch2hw +switch2online + -% switch2online diff --git a/machine/ASP/StorageRing/setinjkicks.m b/machine/ASP/StorageRing/setinjkicks.m index 0c0b92fe..2bfab977 100644 --- a/machine/ASP/StorageRing/setinjkicks.m +++ b/machine/ASP/StorageRing/setinjkicks.m @@ -1,55 +1,56 @@ -function setinjkicks(xpos) -% setinjkicks(xpos) -% -% Sets the strengths in the four injection kickers required -% to make a closed bump in the injection straight -% -% xpos - amplitude of the parallel bump used for injection (meters) - -global THERING - -% read the kicks from file which have been calculated previously -% IjectionKicks - 21x5 matrix col1=xpos (m) col2=kick1 (rad) col3=kick2 -% (rad) col4=kick3 (rad) col5=kick4 (rad) -% load injection_kicks.mat InjectionKicks -InjectionKicks = [... - 0.00000000000000 0.00000000000000 0.00000000000000 0.00000000000000 0.00000000000000; - -0.00100000000000 0.00014800000000 -0.00013052060116 -0.00013000000000 0.00014753369343; - -0.00200000000000 0.00029600000000 -0.00026035436784 -0.00025900000000 0.00029477130201; - -0.00300000000000 0.00044400000000 -0.00038949631871 -0.00038900000000 0.00044354400860; - -0.00400000000000 0.00059000000000 -0.00051621109982 -0.00051500000000 0.00058887355431; - -0.00500000000000 0.00073600000000 -0.00064224513240 -0.00064100000000 0.00073482774839; - -0.00600000000000 0.00088100000000 -0.00076673956508 -0.00076600000000 0.00088029536904; - -0.00700000000000 0.00102500000000 -0.00088970655856 -0.00088900000000 0.00102431889887; - -0.00800000000000 0.00116800000000 -0.00101115901209 -0.00101000000000 0.00116686986828; - -0.00900000000000 0.00131000000000 -0.00113111053835 -0.00113000000000 0.00130890487737; - -0.01000000000000 0.00145200000000 -0.00125041333291 -0.00125000000000 0.00145158784082; - -0.01100000000000 0.00159200000000 -0.00136740207938 -0.00136600000000 0.00159058670747; - -0.01200000000000 0.00173200000000 -0.00148376374419 -0.00148300000000 0.00173122185276; - -0.01300000000000 0.00187200000000 -0.00159950129343 -0.00159900000000 0.00187148382025; - -0.01400000000000 0.00201000000000 -0.00171297835899 -0.00171200000000 0.00200898217080; - -0.01500000000000 0.00214800000000 -0.00182585721434 -0.00182500000000 0.00214709907931; - -0.01600000000000 0.00228500000000 -0.00193733166414 -0.00193600000000 0.00228358641690; - -0.01700000000000 0.00242200000000 -0.00204822792023 -0.00204700000000 0.00242068362261; - -0.01800000000000 0.00255800000000 -0.00215774973517 -0.00215700000000 0.00255718843470; - -0.01900000000000 0.00269300000000 -0.00226591717537 -0.00226500000000 0.00269199772944; - -0.02000000000000 0.00282700000000 -0.00237275076547 -0.00237200000000 0.00282617190946; - -0.02100000000000 0.00296100000000 -0.00247906292307 -0.00247800000000 0.00295981679006; - -0.02200000000000 0.00309500000000 -0.00258486374573 -0.00258400000000 0.00309402973700; -]; -% find the kicks in InjectionKicks table -row = find(InjectionKicks==xpos); - -if (isempty(row)) - disp('xpos not in lookup table (-22e-3 to -2e-3 in steps of 1e-3 m)') - eval('help setinjkicks') - return -end - -% get the kick data for xpos -for i = 1:4 - new_kicks(i) = InjectionKicks(row(1,1),i+1); -end - -setsp('KICK', new_kicks'); - +function setinjkicks(xpos) +% setinjkicks(xpos) +% +% Sets the strengths in the four injection kickers required +% to make a closed bump in the injection straight for the ideal lattice. +% Default being 0.1 dispersion latttice (?) +% +% xpos - amplitude of the parallel bump used for injection (meters) + +global THERING + +% read the kicks from file which have been calculated previously +% IjectionKicks - 21x5 matrix col1=xpos (m) col2=kick1 (rad) col3=kick2 +% (rad) col4=kick3 (rad) col5=kick4 (rad) +% load injection_kicks.mat InjectionKicks +InjectionKicks = [... + 0.00000000000000 0.00000000000000 0.00000000000000 0.00000000000000 0.00000000000000; + -0.00100000000000 0.00014800000000 -0.00013052060116 -0.00013000000000 0.00014753369343; + -0.00200000000000 0.00029600000000 -0.00026035436784 -0.00025900000000 0.00029477130201; + -0.00300000000000 0.00044400000000 -0.00038949631871 -0.00038900000000 0.00044354400860; + -0.00400000000000 0.00059000000000 -0.00051621109982 -0.00051500000000 0.00058887355431; + -0.00500000000000 0.00073600000000 -0.00064224513240 -0.00064100000000 0.00073482774839; + -0.00600000000000 0.00088100000000 -0.00076673956508 -0.00076600000000 0.00088029536904; + -0.00700000000000 0.00102500000000 -0.00088970655856 -0.00088900000000 0.00102431889887; + -0.00800000000000 0.00116800000000 -0.00101115901209 -0.00101000000000 0.00116686986828; + -0.00900000000000 0.00131000000000 -0.00113111053835 -0.00113000000000 0.00130890487737; + -0.01000000000000 0.00145200000000 -0.00125041333291 -0.00125000000000 0.00145158784082; + -0.01100000000000 0.00159200000000 -0.00136740207938 -0.00136600000000 0.00159058670747; + -0.01200000000000 0.00173200000000 -0.00148376374419 -0.00148300000000 0.00173122185276; + -0.01300000000000 0.00187200000000 -0.00159950129343 -0.00159900000000 0.00187148382025; + -0.01400000000000 0.00201000000000 -0.00171297835899 -0.00171200000000 0.00200898217080; + -0.01500000000000 0.00214800000000 -0.00182585721434 -0.00182500000000 0.00214709907931; + -0.01600000000000 0.00228500000000 -0.00193733166414 -0.00193600000000 0.00228358641690; + -0.01700000000000 0.00242200000000 -0.00204822792023 -0.00204700000000 0.00242068362261; + -0.01800000000000 0.00255800000000 -0.00215774973517 -0.00215700000000 0.00255718843470; + -0.01900000000000 0.00269300000000 -0.00226591717537 -0.00226500000000 0.00269199772944; + -0.02000000000000 0.00282700000000 -0.00237275076547 -0.00237200000000 0.00282617190946; + -0.02100000000000 0.00296100000000 -0.00247906292307 -0.00247800000000 0.00295981679006; + -0.02200000000000 0.00309500000000 -0.00258486374573 -0.00258400000000 0.00309402973700; +]; +% find the kicks in InjectionKicks table +row = find(InjectionKicks==xpos); + +if (isempty(row)) + disp('xpos not in lookup table (-22e-3 to -2e-3 in steps of 1e-3 m)') + eval('help setinjkicks') + return +end + +% get the kick data for xpos +for i = 1:4 + new_kicks(i) = InjectionKicks(row(1,1),i+1); +end + +setsp('KICK', new_kicks'); + diff --git a/machine/ASP/StorageRing/setkicker.m b/machine/ASP/StorageRing/setkicker.m index ca236864..26539dd3 100644 --- a/machine/ASP/StorageRing/setkicker.m +++ b/machine/ASP/StorageRing/setkicker.m @@ -1,66 +1,63 @@ function varargout = setkicker(varargin) +% SETKICKER('ON'/'OFF',[DeviceList]) +% +% 15-05-2007 Eugene: Changed from original that used mca to just using +% setpv and getpv. +% 11-05-2010 Eugene: Updated and removed SEP and SEI control. Should not be +% here. + if nargin > 0 && ischar(varargin{1}) cmd = varargin{1}; else error('Usage : setkicker (on/off)'); end +if nargin > 1 && isnumeric(varargin{2}) + devlist = varargin{2}; +else + devlist = getlist('KICK'); +end -pvname = {... - 'SR14KPS01:OFF_ON_CMD'; - 'SR01KPS01:OFF_ON_CMD'; - 'SR01KPS02:OFF_ON_CMD'; - 'SR02KPS01:OFF_ON_CMD';}; +pvname = getfamilydata('KICK','Setpoint','ChannelNames',devlist); +pvname = strrep(cellstr(pvname),'VOLTAGE_SP','OFF_ON_CMD'); -switch cmd +% pvname = {... +% 'SR14KPS01:OFF_ON_CMD'; +% 'SR01KPS01:OFF_ON_CMD'; +% 'SR01KPS02:OFF_ON_CMD'; +% 'SR02KPS01:OFF_ON_CMD';}; + +switch lower(cmd) case 'on' - kval = 2; + kval = 2'; + checkstr = 'off'; case 'off' kval = 1; + checkstr = 'on'; otherwise error(sprintf('Unknown option: %s',cmd)); end -% Turn trigger off first before turning on or off the kickers -trigh = mcaopen('SR00TRG01:INJ_TRIGGER_CMD'); -mcaput(trigh,2); -% Turn off septum -seph = mcaopen('PS-SEP-3:OFF_CMD'); -seih = mcaopen('PS-SEI-3:OFF_CMD'); -mcaput(seph,1); pause(0.2); mcaput(seph,0); -mcaput(seih,1); pause(0.2); mcaput(seih,0); -pause(0.2); -mcaclose(seph); -mcaclose(seih); +if any(getsp('KICK',devlist) > 200) + % Turn trigger off first before turning on or off the kickers + oldtrigstate = getpv('TS01EVG01:INJECTION_TRIGGER_ENABLE_CMD'); + setpv('TS01EVG01:INJECTION_TRIGGER_ENABLE_CMD',0); % 0 to stop and 1 to start + pause(2); % wait some time and to make sure that the trigger has stopped +end -pause(1.5); -for i=1:length(pvname) - hh = mcaopen(pvname{i}); - mcaput(hh,kval); % Doesn't always turn on the kicker at first attempt - if (hh ~= kval) % but after three attempts its almost always going. - mcaput(hh,kval); - end - if (hh ~= kval) - mcaput(hh,kval); - end - if (hh ~= kval) - mcaput(hh,kval); - end - if (hh ~= kval) - mcaput(hh,kval); - end +try + setpv(pvname,kval); pause(0.2); - mcaclose(hh); + % check if any haven't been turned off/on and reapply the command. + % Should not need to do more than twice. 11-05-2010 Eugene + if any(strcmpi(lcaGet(strrep(cellstr(pvname),'OFF_ON_CMD','OFF_ON_STATUS')),checkstr)) + setpv(pvname,kval); + end +catch + return end -pause(1.5); -% Turn on septum -seph = mcaopen('PS-SEP-3:ON_CMD'); -seih = mcaopen('PS-SEI-3:ON_CMD'); -mcaput(seph,1); pause(0.2); mcaput(seph,0); -mcaput(seih,1); pause(0.2); mcaput(seih,0); -pause(0.2); -mcaclose(seph); -mcaclose(seih); -pause(3); -mcaput(trigh,1); -mcaclose(trigh); \ No newline at end of file + +if any(getsp('KICK',devlist) > 200) + pause(1); + setpv('TS01EVG01:INJECTION_TRIGGER_ENABLE_CMD',oldtrigstate); +end \ No newline at end of file diff --git a/machine/ASP/StorageRing/setlocodata.m b/machine/ASP/StorageRing/setlocodata.m index fdcd4fdf..f68a1a11 100644 --- a/machine/ASP/StorageRing/setlocodata.m +++ b/machine/ASP/StorageRing/setlocodata.m @@ -1,409 +1,410 @@ -function setlocodata(CommandInput, FileName) -%SETLOCODATA - Applies the LOCO calibration data to both the middle layer & the accelerator -% setlocodata(CommandInput, FileName) -% -% INPUTS -% 1. CommandInput -% 'Nominal' - Sets nominal gains (1) / rolls (0) to the model. -% 'SetGains' - Set gains/coupling from a LOCO file. -% 'Symmetrize' - Symmetry correction of the lattice based on a LOCO file. -% 'CorrectCoupling' - Coupling correction of the lattice based on a LOCO file. -% 'SetModel' - Set the model from a LOCO file. But it only changes -% the part of the model that does not get corrected -% in 'Symmetrize' (also does a SetGains). -% 'LOCO2Model' - Set the model from a LOCO file (also does a 'SetGains'). -% This sets all lattice machines fit in the LOCO run to -% the model. -% 2. FileName - LOCO file name {Default: getfamilydata('OpsData', 'LOCOFile')} -% '' to browse for a file -% -% NOTES -% How one uses this function depends on how LOCO was setup. -% 1. Use setlocodata('Nominal') if no model calibration information is known. -% 2. The most typical situation is to apply: -% setlocodata('Symmetrize') to the accelerator -% setlocodata('SetModel') to the middle layer (usually done in setoperationalmode) -% 3. If a LOCO run was done on the present lattice with no changes made to lattice -% after LOCO run, then setting all the LOCO fits to the model makes sense. -% setlocodata('LOCO2Model') -% 4. This function obviously has machine dependent parts. -% -% Written by Greg Portmann - - -global THERING - -if nargin < 1 - %CommandInput = 'Default'; - ModeCell = {'Nominal - Set Gain=1 & Rolls=0 in the model', 'SetGains - Set gains/rolls from a LOCO file','Symmetrize - Symmetry correction of the lattice', 'CorrectCoupling - Coupling correction of the lattice', 'SetModel - Set the model from a LOCO file','LOCO2Model - Set the model from a LOCO file (also does a SetGains)', 'see "help setlocodata" for more details'}; - [ModeNumber, OKFlag] = listdlg('Name','ASP','PromptString', ... - 'Select the proper set LOCO data command:', ... - 'SelectionMode','single', 'ListString', ModeCell, 'ListSize', [500 200]); - if OKFlag ~= 1 - fprintf(' setlocodata cancelled\n'); - return - end - if ModeNumber == 1 - CommandInput = 'Nominal'; - elseif ModeNumber == 2 - CommandInput = 'SetGains'; - elseif ModeNumber == 3 - CommandInput = 'Symmetrize'; - elseif ModeNumber == 4 - CommandInput = 'CorrectCoupling'; - elseif ModeNumber == 5 - CommandInput = 'SetModel'; - elseif ModeNumber == 6 - CommandInput = 'LOCO2Model'; - elseif ModeNumber == 7 - help setlocodata; - return - end -end - -if nargin < 2 - % Default (Golden) LOCO file - % If empty, the user will be prompted if needed. - FileName = getfamilydata('OpsData','LOCOFile'); -end - - -%%%%%%%%%%%%%%%%%%%%%%% -% Initialize Defaults % -%%%%%%%%%%%%%%%%%%%%%%% -BPMxFamily = findmemberof('BPMx'); -if isempty(BPMxFamily) - BPMxFamily = 'BPMx'; -else - BPMxFamily = BPMxFamily{1}; -end - -BPMyFamily = findmemberof('BPMy'); -if isempty(BPMyFamily) - BPMyFamily = 'BPMy'; -else - BPMyFamily = BPMyFamily{1}; -end - -HCMFamily = findmemberof('HCM'); -if isempty(HCMFamily) - HCMFamily = 'HCM'; -else - HCMFamily = HCMFamily{1}; -end - -VCMFamily = findmemberof('VCM'); -if isempty(VCMFamily) - VCMFamily = 'VCM'; -else - VCMFamily = VCMFamily{1}; -end - - -% Device list for the entire family -BPMxDeviceListTotal = family2dev(BPMxFamily, 0); -BPMyDeviceListTotal = family2dev(BPMyFamily, 0); -HCMDeviceListTotal = family2dev(HCMFamily, 0); -VCMDeviceListTotal = family2dev(VCMFamily, 0); - -% % Active devices -% BPMxDeviceList = family2dev(BPMxFamily); -% BPMyDeviceList = family2dev(BPMyFamily); -% HCMDeviceList = family2dev(HCMFamily); -% VCMDeviceList = family2dev(VCMFamily); - - -if any(strcmpi(CommandInput, 'Nominal')) - fprintf(' Using nominal BPM and corrector gains (1) and rolls (0).\n'); - - % To speed things up, put Gains/Rolls/etc in the AO - AO = getao; - - % Zero or one the gains and rolls - AO.(BPMxFamily).Gain = ones(size(BPMxDeviceListTotal,1),1); - AO.(BPMyFamily).Gain = ones(size(BPMyDeviceListTotal,1),1); - AO.(BPMxFamily).Roll = zeros(size(BPMxDeviceListTotal,1),1); - AO.(BPMyFamily).Roll = zeros(size(BPMyDeviceListTotal,1),1); - AO.(BPMxFamily).Crunch = zeros(size(BPMxDeviceListTotal,1),1); - AO.(BPMyFamily).Crunch = zeros(size(BPMyDeviceListTotal,1),1); - - % Set the gain, roll, & crunch to the AT model to be used by getpvmodel, setpvmodel, etc - setatfield(BPMxFamily, 'GCR', [AO.(BPMxFamily).Gain AO.(BPMyFamily).Gain AO.(BPMxFamily).Crunch AO.(BPMxFamily).Roll], BPMxDeviceListTotal); - - - % Corrector magnet gains/rolls - AO.(HCMFamily).Gain = ones(size(HCMDeviceListTotal,1),1); - AO.(VCMFamily).Gain = ones(size(VCMDeviceListTotal,1),1); - AO.(HCMFamily).Roll = zeros(size(HCMDeviceListTotal,1),1); - AO.(VCMFamily).Roll = zeros(size(VCMDeviceListTotal,1),1); - - % Set the AT model as well since they are used by getpvmodel, setpvmodel, etc - % Make sure the Roll field is 1x2 even for single plane correctors - % First set the cross planes to zero - setatfield(HCMFamily, 'Roll', 0*AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 2); - setatfield(VCMFamily, 'Roll', 0*AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 1); - - % Then set the roll field - setatfield(HCMFamily, 'Roll', AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 1); - setatfield(VCMFamily, 'Roll', AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 2); - - - % Magnet gains set to unity (rolls are set in the AT model) (This is not really needed) - AO.QFA.Gain = ones(size(family2dev('QFA',0),1),1); - AO.QDA.Gain = ones(size(family2dev('QDA',0),1),1); - AO.QFB.Gain = ones(size(family2dev('QFB',0),1),1); - - AO.SFA.Gain = ones(size(family2dev('SFA',0),1),1); - AO.SFB.Gain = ones(size(family2dev('SFB',0),1),1); - AO.SDA.Gain = ones(size(family2dev('SDA',0),1),1); - AO.SDB.Gain = ones(size(family2dev('SDB',0),1),1); - - setao(AO); - - -elseif any(strcmpi(CommandInput, 'SetGains')) - - if isempty(FileName) || strcmp(FileName, '.') - if isempty(FileName) - [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?', [getfamilydata('Directory','DataRoot'), 'LOCO', filesep]); - else - [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?'); - end - drawnow; - if FileName == 0 - fprintf(' setlocodata canceled\n'); - return - end - FileName = [DirectoryName FileName]; - end - - % Set the model gains - setlocodata('Nominal'); - - AO = getao; - - % Load the LOCO data - fprintf(' Setting BPM and corrector gains and rolls based on %s.\n', FileName); - load(FileName); - - - % Get the device list from the LOCO file - try - BPMxDeviceList = LocoMeasData.HBPM.DeviceList; - BPMyDeviceList = LocoMeasData.VBPM.DeviceList; - HCMDeviceList = LocoMeasData.HCM.DeviceList; - VCMDeviceList = LocoMeasData.VCM.DeviceList; - catch - % Legacy - BPMxDeviceList = LocoMeasData.(BPMxFamily).DeviceList; - BPMyDeviceList = LocoMeasData.(BPMyFamily).DeviceList; - HCMDeviceList = LocoMeasData.(HCMFamily).DeviceList; - VCMDeviceList = LocoMeasData.(VCMFamily).DeviceList; - end - - - % Change to Gain, Roll, Crunch system (Need to add a logic for single view BPMs???) - i = findrowindex(BPMxDeviceList, BPMxDeviceListTotal); - for j = 1:length(BPMData(end).HBPMGain) - MLOCO = [BPMData(end).HBPMGain(j) BPMData(end).HBPMCoupling(j) - BPMData(end).VBPMCoupling(j) BPMData(end).VBPMGain(j) ]; - - [AO.(BPMxFamily).Gain(i(j),:), AO.(BPMyFamily).Gain(i(j),:), AO.(BPMxFamily).Crunch(i(j),:), AO.(BPMxFamily).Roll(i(j),:)] = loco2gcr(MLOCO); - end - AO.(BPMyFamily).Roll = AO.(BPMxFamily).Roll; - AO.(BPMyFamily).Crunch = AO.(BPMxFamily).Crunch; - - if ~isreal(AO.(BPMxFamily).Gain) - error('Horizontal BPM gain is complex.'); - end - if ~isreal(AO.(BPMyFamily).Gain) - error('Vertical BPM gain is complex.'); - end - if ~isreal(AO.(BPMxFamily).Crunch) - error('BPM Crunch is complex.'); - end - if ~isreal(AO.(BPMxFamily).Roll) - error('BPM roll is complex.'); - end - - - - %%%%%%%%%%%%%% - % Correctors % - %%%%%%%%%%%%%% - - % Kick strength (LOCO is in milliradian) - % LOCO is run with the original gain in hw2physics (stored in LocoMeasData.VCMGain/LocoMeasData.HCMGain). - % The new gain must combine the new CM gain and the one used in buildlocoinput. - % hw2physics: Rad = G * amps (original) - % LOCO gain: Gloco = KickNew/KickStart - % New hw2physics gain: Gloco * G - - % HCM - i = findrowindex(HCMDeviceList, HCMDeviceListTotal); - - HCMGainOldLOCO = LocoMeasData.HCMGain .* cos(LocoMeasData.HCMRoll); - HCMGainLOCO = HCMGainOldLOCO .* CMData(end).HCMKicks ./ CMData(1).HCMKicks; - HCMCouplingLOCO = HCMGainLOCO .* CMData(end).HCMCoupling; - - %AO.(HCMFamily).Roll(i) = atan2(-HCMCouplingLOCO, HCMGainLOCO); - AO.(HCMFamily).Roll(i) = atan(HCMCouplingLOCO ./ abs(HCMGainLOCO)); - AO.(HCMFamily).Gain(i) = sign(HCMGainLOCO) .* sqrt(HCMCouplingLOCO.^2 + HCMGainLOCO.^2); - - - % VCM - i = findrowindex(VCMDeviceList, VCMDeviceListTotal); - - VCMGainOldLOCO = LocoMeasData.VCMGain .* cos(LocoMeasData.VCMRoll); - VCMGainLOCO = VCMGainOldLOCO .* CMData(end).VCMKicks ./ CMData(1).VCMKicks; - VCMCouplingLOCO = VCMGainLOCO .* CMData(end).VCMCoupling; - - %AO.(VCMFamily).Roll(i) = atan2(-VCMCouplingLOCO, VCMGainLOCO); - AO.(VCMFamily).Roll(i) = atan(-VCMCouplingLOCO ./ abs(VCMGainLOCO)); - AO.(VCMFamily).Gain(i) = sign(VCMGainLOCO) .* sqrt(VCMCouplingLOCO.^2 + VCMGainLOCO.^2); - - - % Set the roll, crunch to the AT model to be used by getpvmodel, setpvmodel, etc - setatfield(BPMxFamily, 'GCR', [AO.(BPMxFamily).Gain AO.(BPMyFamily).Gain AO.(BPMxFamily).Crunch AO.(BPMxFamily).Roll], BPMxDeviceListTotal); - - % Set the gains to the AT model to be used by getpvmodel, setpvmodel, etc - % Make sure the Roll field is 1x2 even for single plane correctors - - % First set the cross planes to zero - setatfield(HCMFamily, 'Roll', 0*AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 2); - setatfield(VCMFamily, 'Roll', 0*AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 1); - - % Then set the roll field - setatfield(HCMFamily, 'Roll', AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 1); - setatfield(VCMFamily, 'Roll', AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 2); - - - % If other magnet fits were done (like roll), it should be add to the AT model as well - - setao(AO); - - -elseif any(strcmpi(CommandInput, 'SetModel')) - - % Some LOCO errors are applied to the accelerator 'Symmetrize' and some - % go to the model. If errors detected by LOCO are not applied to the accelerator, - % then include them in the AT and Middle Layer model. - - error(' Option not programmed yet'); - - -elseif any(strcmpi(CommandInput, 'LOCO2Model')) - - % LOCO is usually used to correct the model. If the LOCO fit parameters are - % not applied to the accelerator, then the entire model needs to be updated. - % Ie, the machine lattice file is the same as it was when the LOCO data was - % taken, then put the LOCO output settings in the model. - - if isempty(FileName) || strcmp(FileName, '.') - if isempty(FileName) - [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?', [getfamilydata('Directory','DataRoot'), 'LOCO', filesep]); - else - [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?'); - end - drawnow; - if FileName == 0 - fprintf(' setlocodata canceled\n'); - return - end - FileName = [DirectoryName FileName]; - end - - - % Load the LOCO data - load(FileName); - - - % Use loco file for the lattice and the fit parameter - % Using the loco lattice may not be what you want??? - global THERING - %RINGData.Lattice = THERING; - for i = 1:length(FitParameters(end).Params) - RINGData = locosetlatticeparam(RINGData, FitParameters(end).Params{i}, FitParameters(end).Values(i)); - end - THERING = RINGData.Lattice; - - - % Since the lattice may have changed - updateatindex; - - - % Set the model gains (this added GCR field to lattice) - setlocodata('SetGains', FileName); - - -elseif any(strcmpi(CommandInput, 'CorrectCoupling')) - - if isempty(FileName) || strcmp(FileName, '.') - if isempty(FileName) - [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?', [getfamilydata('Directory','DataRoot'), 'LOCO', filesep]); - else - [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?'); - end - drawnow; - if FileName == 0 - fprintf(' setlocodata canceled\n'); - return - end - FileName = [DirectoryName FileName]; - end - - - - error(' Option not programmed yet'); - - - - % Load the LOCO data - load(FileName); - - fprintf(' Correcting the coupling based on LOCO file %s.\n', FileName); - - % Find the skew quadrupole fits ??????????? - if length(FitParameters(end).Values) < 83 - error('Did not find the skew quads fit parameters.'); - elseif length(FitParameters(end).Values) > 83 - fprintf(' There are more than 83 fit parameters, hopefully the skew quads fits are still 60:83\n'); - fprintf(' If all 24 skew quadrupoles were fit this function will fail!\n'); - end - - SQK = FitParameters(end).Values(60:70); % ?????????? - - % Starting point for the skew quadrupoles - MachineConfig = LocoMeasData.MachineConfig; - setpv(MachineConfig.SQK.Setpoint); - - % Since the skew power supplies are wired backwards, just apply the fit directly - SQSFhw = physics2hw('SQSF', 'Setpoint', SQSF); - - % Maximum setpoint check - if any(abs(MachineConfig.SQK.Setpoint.Data+SQKhw)>maxsp('SQK')) - error('At least one of the SQSF would go beyond it''s limit ... aborting'); - end - - - % Make the setpoint change - stepsp('SQK', SQKhw); - - % Keep the change? - CorrectFlag = questdlg('Keep the new skew quadrupole setpoints or return to the old values?','SETLOCOGAINS(''SetCoupling'')','Keep this lattice','Restore Old Lattice','Keep this lattice'); - if strcmpi(CorrectFlag, 'Restore Old Lattice') | isempty(CorrectFlag) - fprintf(' Changing the skew quadrupole magnets back to the original setpoints.\n'); - stepsp('SQK', -SQKhw); - end - - -elseif any(strcmpi(CommandInput, 'Symmetrize')) - - error(' Option not programmed yet'); - -else - - error(' SETLOCODATA command not known.'); - -end - +function setlocodata(CommandInput, FileName) +%SETLOCODATA - Applies the LOCO calibration data to both the middle layer & the accelerator +% setlocodata(CommandInput, FileName) +% +% INPUTS +% 1. CommandInput +% 'Nominal' - Sets nominal gains (1) / rolls (0) to the model. +% 'SetGains' - Set gains/coupling from a LOCO file. +% 'Symmetrize' - Symmetry correction of the lattice based on a LOCO file. +% 'CorrectCoupling' - Coupling correction of the lattice based on a LOCO file. +% 'SetModel' - Set the model from a LOCO file. But it only changes +% the part of the model that does not get corrected +% in 'Symmetrize' (also does a SetGains). +% 'LOCO2Model' - Set the model from a LOCO file (also does a 'SetGains'). +% This sets all lattice machines fit in the LOCO run to +% the model. +% 2. FileName - LOCO file name {Default: getfamilydata('OpsData', 'LOCOFile')} +% '' to browse for a file +% +% NOTES +% How one uses this function depends on how LOCO was setup. +% 1. Use setlocodata('Nominal') if no model calibration information is known. +% 2. The most typical situation is to apply: +% setlocodata('Symmetrize') to the accelerator +% setlocodata('SetModel') to the middle layer (usually done in setoperationalmode) +% 3. If a LOCO run was done on the present lattice with no changes made to lattice +% after LOCO run, then setting all the LOCO fits to the model makes sense. +% setlocodata('LOCO2Model') +% 4. This function obviously has machine dependent parts. +% +% Written by Greg Portmann + + +global THERING + +if nargin < 1 + %CommandInput = 'Default'; + ModeCell = {'Nominal - Set Gain=1 & Rolls=0 in the model', 'SetGains - Set gains/rolls from a LOCO file','Symmetrize - Symmetry correction of the lattice', 'CorrectCoupling - Coupling correction of the lattice', 'SetModel - Set the model from a LOCO file','LOCO2Model - Set the model from a LOCO file (also does a SetGains)', 'see "help setlocodata" for more details'}; + [ModeNumber, OKFlag] = listdlg('Name','ASP','PromptString', ... + 'Select the proper set LOCO data command:', ... + 'SelectionMode','single', 'ListString', ModeCell, 'ListSize', [500 200]); + if OKFlag ~= 1 + fprintf(' setlocodata cancelled\n'); + return + end + if ModeNumber == 1 + CommandInput = 'Nominal'; + elseif ModeNumber == 2 + CommandInput = 'SetGains'; + elseif ModeNumber == 3 + CommandInput = 'Symmetrize'; + elseif ModeNumber == 4 + CommandInput = 'CorrectCoupling'; + elseif ModeNumber == 5 + CommandInput = 'SetModel'; + elseif ModeNumber == 6 + CommandInput = 'LOCO2Model'; + elseif ModeNumber == 7 + help setlocodata; + return + end +end + +if nargin < 2 + % Default (Golden) LOCO file + % If empty, the user will be prompted if needed. + FileName = getfamilydata('OpsData','LOCOFile'); +end + + +%%%%%%%%%%%%%%%%%%%%%%% +% Initialize Defaults % +%%%%%%%%%%%%%%%%%%%%%%% +BPMxFamily = findmemberof('BPMx'); +if isempty(BPMxFamily) + BPMxFamily = 'BPMx'; +else + BPMxFamily = BPMxFamily{1}; +end + +BPMyFamily = findmemberof('BPMy'); +if isempty(BPMyFamily) + BPMyFamily = 'BPMy'; +else + BPMyFamily = BPMyFamily{1}; +end + +HCMFamily = findmemberof('HCM'); +if isempty(HCMFamily) + HCMFamily = 'HCM'; +else + HCMFamily = HCMFamily{1}; +end + +VCMFamily = findmemberof('VCM'); +if isempty(VCMFamily) + VCMFamily = 'VCM'; +else + VCMFamily = VCMFamily{1}; +end + + +% Device list for the entire family +BPMxDeviceListTotal = family2dev(BPMxFamily, 0); +BPMyDeviceListTotal = family2dev(BPMyFamily, 0); +HCMDeviceListTotal = family2dev(HCMFamily, 0); +VCMDeviceListTotal = family2dev(VCMFamily, 0); + +% % Active devices +% BPMxDeviceList = family2dev(BPMxFamily); +% BPMyDeviceList = family2dev(BPMyFamily); +% HCMDeviceList = family2dev(HCMFamily); +% VCMDeviceList = family2dev(VCMFamily); + + +if any(strcmpi(CommandInput, 'Nominal')) + fprintf(' Using nominal BPM and corrector gains (1) and rolls (0).\n'); + disp('NOMINAL') + + % To speed things up, put Gains/Rolls/etc in the AO + AO = getao; + + % Zero or one the gains and rolls + AO.(BPMxFamily).Gain = ones(size(BPMxDeviceListTotal,1),1); + AO.(BPMyFamily).Gain = ones(size(BPMyDeviceListTotal,1),1); + AO.(BPMxFamily).Roll = zeros(size(BPMxDeviceListTotal,1),1); + AO.(BPMyFamily).Roll = zeros(size(BPMyDeviceListTotal,1),1); + AO.(BPMxFamily).Crunch = zeros(size(BPMxDeviceListTotal,1),1); + AO.(BPMyFamily).Crunch = zeros(size(BPMyDeviceListTotal,1),1); + + % Set the gain, roll, & crunch to the AT model to be used by getpvmodel, setpvmodel, etc + setatfield(BPMxFamily, 'GCR', [AO.(BPMxFamily).Gain AO.(BPMyFamily).Gain AO.(BPMxFamily).Crunch AO.(BPMxFamily).Roll], BPMxDeviceListTotal); + + + % Corrector magnet gains/rolls + AO.(HCMFamily).Gain = ones(size(HCMDeviceListTotal,1),1); + AO.(VCMFamily).Gain = ones(size(VCMDeviceListTotal,1),1); + AO.(HCMFamily).Roll = zeros(size(HCMDeviceListTotal,1),1); + AO.(VCMFamily).Roll = zeros(size(VCMDeviceListTotal,1),1); + + % Set the AT model as well since they are used by getpvmodel, setpvmodel, etc + % Make sure the Roll field is 1x2 even for single plane correctors + % First set the cross planes to zero + setatfield(HCMFamily, 'Roll', 0*AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 2); + setatfield(VCMFamily, 'Roll', 0*AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 1); + + % Then set the roll field + setatfield(HCMFamily, 'Roll', AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 1); + setatfield(VCMFamily, 'Roll', AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 2); + + + % Magnet gains set to unity (rolls are set in the AT model) (This is not really needed) + AO.QFA.Gain = ones(size(family2dev('QFA',0),1),1); + AO.QDA.Gain = ones(size(family2dev('QDA',0),1),1); + AO.QFB.Gain = ones(size(family2dev('QFB',0),1),1); + + AO.SFA.Gain = ones(size(family2dev('SFA',0),1),1); + AO.SFB.Gain = ones(size(family2dev('SFB',0),1),1); + AO.SDA.Gain = ones(size(family2dev('SDA',0),1),1); + AO.SDB.Gain = ones(size(family2dev('SDB',0),1),1); + + setao(AO); + + +elseif any(strcmpi(CommandInput, 'SetGains')) + + if isempty(FileName) || strcmp(FileName, '.') + if isempty(FileName) + [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?', [getfamilydata('Directory','DataRoot'), 'LOCO', filesep]); + else + [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?'); + end + drawnow; + if FileName == 0 + fprintf(' setlocodata canceled\n'); + return + end + FileName = [DirectoryName FileName]; + end + + % Set the model gains + setlocodata('Nominal'); + + AO = getao; + + % Load the LOCO data + fprintf(' Setting BPM and corrector gains and rolls based on %s.\n', FileName); + load(FileName); + + + % Get the device list from the LOCO file + try + BPMxDeviceList = LocoMeasData.HBPM.DeviceList; + BPMyDeviceList = LocoMeasData.VBPM.DeviceList; + HCMDeviceList = LocoMeasData.HCM.DeviceList; + VCMDeviceList = LocoMeasData.VCM.DeviceList; + catch + % Legacy + BPMxDeviceList = LocoMeasData.(BPMxFamily).DeviceList; + BPMyDeviceList = LocoMeasData.(BPMyFamily).DeviceList; + HCMDeviceList = LocoMeasData.(HCMFamily).DeviceList; + VCMDeviceList = LocoMeasData.(VCMFamily).DeviceList; + end + + + % Change to Gain, Roll, Crunch system (Need to add a logic for single view BPMs???) + i = findrowindex(BPMxDeviceList, BPMxDeviceListTotal); + for j = 1:length(BPMData(end).HBPMGain) + MLOCO = [BPMData(end).HBPMGain(j) BPMData(end).HBPMCoupling(j) + BPMData(end).VBPMCoupling(j) BPMData(end).VBPMGain(j) ]; + + [AO.(BPMxFamily).Gain(i(j),:), AO.(BPMyFamily).Gain(i(j),:), AO.(BPMxFamily).Crunch(i(j),:), AO.(BPMxFamily).Roll(i(j),:)] = loco2gcr(MLOCO); + end + AO.(BPMyFamily).Roll = AO.(BPMxFamily).Roll; + AO.(BPMyFamily).Crunch = AO.(BPMxFamily).Crunch; + + if ~isreal(AO.(BPMxFamily).Gain) + error('Horizontal BPM gain is complex.'); + end + if ~isreal(AO.(BPMyFamily).Gain) + error('Vertical BPM gain is complex.'); + end + if ~isreal(AO.(BPMxFamily).Crunch) + error('BPM Crunch is complex.'); + end + if ~isreal(AO.(BPMxFamily).Roll) + error('BPM roll is complex.'); + end + + + + %%%%%%%%%%%%%% + % Correctors % + %%%%%%%%%%%%%% + + % Kick strength (LOCO is in milliradian) + % LOCO is run with the original gain in hw2physics (stored in LocoMeasData.VCMGain/LocoMeasData.HCMGain). + % The new gain must combine the new CM gain and the one used in buildlocoinput. + % hw2physics: Rad = G * amps (original) + % LOCO gain: Gloco = KickNew/KickStart + % New hw2physics gain: Gloco * G + + % HCM + i = findrowindex(HCMDeviceList, HCMDeviceListTotal); + + HCMGainOldLOCO = LocoMeasData.HCMGain .* cos(LocoMeasData.HCMRoll); + HCMGainLOCO = HCMGainOldLOCO .* CMData(end).HCMKicks ./ CMData(1).HCMKicks; + HCMCouplingLOCO = HCMGainLOCO .* CMData(end).HCMCoupling; + + %AO.(HCMFamily).Roll(i) = atan2(-HCMCouplingLOCO, HCMGainLOCO); + AO.(HCMFamily).Roll(i) = atan(HCMCouplingLOCO ./ abs(HCMGainLOCO)); + AO.(HCMFamily).Gain(i) = sign(HCMGainLOCO) .* sqrt(HCMCouplingLOCO.^2 + HCMGainLOCO.^2); + + + % VCM + i = findrowindex(VCMDeviceList, VCMDeviceListTotal); + + VCMGainOldLOCO = LocoMeasData.VCMGain .* cos(LocoMeasData.VCMRoll); + VCMGainLOCO = VCMGainOldLOCO .* CMData(end).VCMKicks ./ CMData(1).VCMKicks; + VCMCouplingLOCO = VCMGainLOCO .* CMData(end).VCMCoupling; + + %AO.(VCMFamily).Roll(i) = atan2(-VCMCouplingLOCO, VCMGainLOCO); + AO.(VCMFamily).Roll(i) = atan(-VCMCouplingLOCO ./ abs(VCMGainLOCO)); + AO.(VCMFamily).Gain(i) = sign(VCMGainLOCO) .* sqrt(VCMCouplingLOCO.^2 + VCMGainLOCO.^2); + + + % Set the roll, crunch to the AT model to be used by getpvmodel, setpvmodel, etc + setatfield(BPMxFamily, 'GCR', [AO.(BPMxFamily).Gain AO.(BPMyFamily).Gain AO.(BPMxFamily).Crunch AO.(BPMxFamily).Roll], BPMxDeviceListTotal); + + % Set the gains to the AT model to be used by getpvmodel, setpvmodel, etc + % Make sure the Roll field is 1x2 even for single plane correctors + + % First set the cross planes to zero + setatfield(HCMFamily, 'Roll', 0*AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 2); + setatfield(VCMFamily, 'Roll', 0*AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 1); + + % Then set the roll field + setatfield(HCMFamily, 'Roll', AO.(HCMFamily).Roll, HCMDeviceListTotal, 1, 1); + setatfield(VCMFamily, 'Roll', AO.(VCMFamily).Roll, VCMDeviceListTotal, 1, 2); + + + % If other magnet fits were done (like roll), it should be add to the AT model as well + + setao(AO); + + +elseif any(strcmpi(CommandInput, 'SetModel')) + + % Some LOCO errors are applied to the accelerator 'Symmetrize' and some + % go to the model. If errors detected by LOCO are not applied to the accelerator, + % then include them in the AT and Middle Layer model. + + error(' Option not programmed yet'); + + +elseif any(strcmpi(CommandInput, 'LOCO2Model')) + + % LOCO is usually used to correct the model. If the LOCO fit parameters are + % not applied to the accelerator, then the entire model needs to be updated. + % Ie, the machine lattice file is the same as it was when the LOCO data was + % taken, then put the LOCO output settings in the model. + + if isempty(FileName) || strcmp(FileName, '.') + if isempty(FileName) + [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?', [getfamilydata('Directory','DataRoot'), 'LOCO', filesep]); + else + [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?'); + end + drawnow; + if FileName == 0 + fprintf(' setlocodata canceled\n'); + return + end + FileName = [DirectoryName FileName]; + end + + + % Load the LOCO data + load(FileName); + + + % Use loco file for the lattice and the fit parameter + % Using the loco lattice may not be what you want??? + global THERING + %RINGData.Lattice = THERING; + for i = 1:length(FitParameters(end).Params) + RINGData = locosetlatticeparam(RINGData, FitParameters(end).Params{i}, FitParameters(end).Values(i)); + end + THERING = RINGData.Lattice; + + + % Since the lattice may have changed + updateatindex; + + + % Set the model gains (this added GCR field to lattice) + setlocodata('SetGains', FileName); + + +elseif any(strcmpi(CommandInput, 'CorrectCoupling')) + + if isempty(FileName) || strcmp(FileName, '.') + if isempty(FileName) + [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?', [getfamilydata('Directory','DataRoot'), 'LOCO', filesep]); + else + [FileName, DirectoryName] = uigetfile('*.mat', 'LOCO Output File Name?'); + end + drawnow; + if FileName == 0 + fprintf(' setlocodata canceled\n'); + return + end + FileName = [DirectoryName FileName]; + end + + + + error(' Option not programmed yet'); + + + + % Load the LOCO data + load(FileName); + + fprintf(' Correcting the coupling based on LOCO file %s.\n', FileName); + + % Find the skew quadrupole fits ??????????? + if length(FitParameters(end).Values) < 83 + error('Did not find the skew quads fit parameters.'); + elseif length(FitParameters(end).Values) > 83 + fprintf(' There are more than 83 fit parameters, hopefully the skew quads fits are still 60:83\n'); + fprintf(' If all 24 skew quadrupoles were fit this function will fail!\n'); + end + + SQK = FitParameters(end).Values(60:70); % ?????????? + + % Starting point for the skew quadrupoles + MachineConfig = LocoMeasData.MachineConfig; + setpv(MachineConfig.SQK.Setpoint); + + % Since the skew power supplies are wired backwards, just apply the fit directly + SQSFhw = physics2hw('SQSF', 'Setpoint', SQSF); + + % Maximum setpoint check + if any(abs(MachineConfig.SQK.Setpoint.Data+SQKhw)>maxsp('SQK')) + error('At least one of the SQSF would go beyond it''s limit ... aborting'); + end + + + % Make the setpoint change + stepsp('SQK', SQKhw); + + % Keep the change? + CorrectFlag = questdlg('Keep the new skew quadrupole setpoints or return to the old values?','SETLOCOGAINS(''SetCoupling'')','Keep this lattice','Restore Old Lattice','Keep this lattice'); + if strcmpi(CorrectFlag, 'Restore Old Lattice') | isempty(CorrectFlag) + fprintf(' Changing the skew quadrupole magnets back to the original setpoints.\n'); + stepsp('SQK', -SQKhw); + end + + +elseif any(strcmpi(CommandInput, 'Symmetrize')) + + error(' Option not programmed yet'); + +else + + error(' SETLOCODATA command not known.'); + +end + diff --git a/machine/ASP/StorageRing/setmachineconfig.m b/machine/ASP/StorageRing/setmachineconfig.m new file mode 100644 index 00000000..7d9dd546 --- /dev/null +++ b/machine/ASP/StorageRing/setmachineconfig.m @@ -0,0 +1,253 @@ +function [ConfigSetpoint, FileName] = setmachineconfig(varargin) +%SETMACHINECONFIG - Sets the storage ring setpoints from a file or configuratino data structure +% [ConfigSetpoint, FileName] = setmachineconfig(FamilyName, FileName, WaitFlag, ExtraInputs ...) +% [ConfigSetpoint, FileName] = setmachineconfig(FileName, WaitFlag, ExtraInputs ...) +% [ConfigSetpoint, FileName] = setmachineconfig(ConfigSetpoint, WaitFlag, ExtraInputs ...) +% +% INPUTS +% 1. FamilyName - Name of family/families to set (string, string matrix, cell array of families) +% {Default: all families (as returned by getfamilylist)} +% 2. FileName - File name to get setpoint data (if necessary, include full path) +% 'Production' or 'Golden' will get the lattice from the "golden lattice" which stored in +% 'Injection' will get the injection lattice stored in +% {Default: browse for the desired file} +% or +% ConfigSetpoint - A configuration structure as returned by getmachineconfig can also be used. +% 3. WaitFlag - {optional} (see getpv for details) +% 4. ExtraInputs - Extra inputs get passed to setpv (like 'Online', 'Simulator', 'Display') +% See >> help setpv for more details +% +% OUTPUTS +% 1. ConfigSetpoint - structure of setpoint structures +% each field being a family +% 2. FileName - filename where the data came from (if the data came from a file) +% +% EXAMPLES +% 1. To browse for a configuration to set: +% >> setmachineconfig; +% 2. To set to golden configuration: +% >> setmachineconfig('Golden'); +% 3. To only restore the HCM and VCM corrector families from the golden lattice: +% >> setmachineconfig('HCM', 'Golden'); +% or +% >> setmachineconfig({'HCM','VCM'}, 'Golden'); +% +% See also getmachineconfig +% +% Written by Greg Portmann + + +WaitFlag = -1; +FamilyName = []; +FileName = ''; +DisplayFlag = 0; +ConfigSetpoint = []; + + +% Look for keywords on the input line +InputFlags = {}; +for i = length(varargin):-1:1 + if isstruct(varargin{i}) + % Ignor structures + elseif iscell(varargin{i}) + % Ignor cells + elseif strcmpi(varargin{i},'struct') + % Remove + varargin(i) = []; + elseif strcmpi(varargin{i},'numeric') + % Remove + varargin(i) = []; + elseif strcmpi(varargin{i},'Display') + DisplayFlag = 1; + varargin(i) = []; + elseif strcmpi(varargin{i},'NoDisplay') + DisplayFlag = 0; + varargin(i) = []; + elseif strcmpi(varargin{i},'simulator') | strcmpi(varargin{i},'model') + InputFlags = [InputFlags varargin(i)]; + varargin(i) = []; + elseif strcmpi(varargin{i},'Online') + InputFlags = [InputFlags varargin(i)]; + varargin(i) = []; + elseif strcmpi(varargin{i},'Manual') + InputFlags = [InputFlags varargin(i)]; + varargin(i) = []; + elseif strcmpi(varargin{i},'physics') + InputFlags = [InputFlags varargin(i)]; + varargin(i) = []; + elseif strcmpi(varargin{i},'hardware') + InputFlags = [InputFlags varargin(i)]; + varargin(i) = []; + end +end + +if length(varargin) >= 1 + if iscell(varargin{1}) + FamilyName = varargin{1}; + varargin(1) = []; + elseif size(varargin{1},1) > 1 & ischar(varargin{1}) + FamilyName = varargin{1}; + varargin(1) = []; + elseif isstruct(varargin{1}) + ConfigSetpoint = varargin{1}; + varargin(1) = []; + elseif isfamily(varargin{1}) + FamilyName = varargin{1}; + varargin(1) = []; + elseif ischar(varargin{1}) + FileName = varargin{1}; + varargin(1) = []; + end +end +% if length(varargin) >= 1 +% if iscell(varargin{1}) +% FamilyName = varargin{1}; +% varargin(1) = []; +% elseif size(varargin{1},1) > 1 & ischar(varargin{1}) +% FamilyName = varargin{1}; +% varargin(1) = []; +% elseif isfamily(varargin{1}) +% FamilyName = varargin{1}; +% varargin(1) = []; +% elseif isstruct(varargin{1}) +% ConfigSetpoint = varargin{1}; +% varargin(1) = []; +% elseif ischar(varargin{1}) +% FileName = varargin{1}; +% varargin(1) = []; +% end +% end + +% WaitFlag +if length(varargin) >= 1 + if isnumeric(varargin{1}) + WaitFlag = varargin{1}; + varargin(1) = []; + end +end + + +% Get config structure +if isempty(ConfigSetpoint) + AskStartQuestion = 1; + try + if isempty(FileName) + % Default file + %FileName = getfamilydata('Default', 'CNFArchiveFile'); + DirectoryName = getfamilydata('Directory', 'ConfigData'); + [FileName, DirectoryName] = uigetfile('*.mat', 'Select a configuration file to load', DirectoryName); + if FileName == 0 + fprintf(' No change to lattice (setmachineconfig)\n'); + return + end + load([DirectoryName FileName]); + FileName = [DirectoryName FileName]; + AskStartQuestion = 0; + elseif any(strcmpi(FileName, {'Golden','Production'})) + FileName = getfamilydata('OpsData', 'LatticeFile'); + DirectoryName = getfamilydata('Directory', 'OpsData'); + load([DirectoryName FileName]); + FileName = [DirectoryName FileName]; + elseif strcmpi(FileName, 'Injection') + FileName = getfamilydata('OpsData', 'InjectionFile'); + DirectoryName = getfamilydata('Directory', 'OpsData'); + load([DirectoryName FileName]); + FileName = [DirectoryName FileName]; + else + % Input file name + load(FileName); + end + catch + fprintf('%s\n', lasterr) + fprintf('No change made to lattice (setmachineconfig)\n'); + return + end + + % Query to begin measurement + if DisplayFlag & ~isempty(FileName) & AskStartQuestion + tmp = questdlg(sprintf('Change the lattice to %s?', FileName),'setmachineconfig','Yes','No','No'); + if ~strcmpi(tmp,'Yes') + fprintf(' No change made to lattice (setmachineconfig)\n'); + return + end + end +end + + +if isempty(FamilyName) + FieldNameCell = fieldnames(ConfigSetpoint); +elseif iscell(FamilyName) + FieldNameCell = FamilyName; +elseif size(FamilyName,1) > 1 + for i = 1:size(FamilyName,1) + FieldNameCell{i} = FamilyName(i,:); + end +else + FieldNameCell = {FamilyName}; +end + + +% Build the cell array +j = 0; +for i = 1:length(FieldNameCell) + FieldNameCell{i} = deblank(FieldNameCell{i}); + if isfield(ConfigSetpoint, FieldNameCell{i}) + if isfield(ConfigSetpoint.(FieldNameCell{i}),'Data') & isfield(ConfigSetpoint.(FieldNameCell{i}),'FamilyName') + j = j + 1; + SPcell{j} = ConfigSetpoint.(FieldNameCell{i}); + else + % Find all the subfields that are data structures + SubFieldNameCell = fieldnames(ConfigSetpoint.(FieldNameCell{i})); + for ii = 1:length(SubFieldNameCell) + if isfield(ConfigSetpoint.(FieldNameCell{i}).(SubFieldNameCell{ii}),'Data') & isfield(ConfigSetpoint.(FieldNameCell{i}).(SubFieldNameCell{ii}),'FamilyName') + j = j + 1; + SPcell{j} = ConfigSetpoint.(FieldNameCell{i}).(SubFieldNameCell{ii}); + end + end + end + else + fprintf(' %s field does not exist for family, hence ignored (setmachineconfig)\n', deblank(FieldNameCell{i})); + end +end + + +% Make the setpoint change w/o a WaitFlag +for k = 1:length(SPcell) + try + if DisplayFlag + Time = clock; + %fprintf(' Setting family %s (%s %d:%d:%.2f)\n', SPcell{k}.FamilyName, datestr(clock,1), Time(4), Time(5), Time(6)); + fprintf(' %s %d:%d:%.2f Setting family %s.%s\n', datestr(clock,1), Time(4), Time(5), Time(6), SPcell{k}.FamilyName, SPcell{k}.Field); + drawnow; + end + setpv(SPcell{k}, 0, InputFlags{:}); + catch + fprintf('%s\n', lasterr) + fprintf('Trouble with setsp(''%s'',''%s''), hence ignored (setmachineconfig)\n', SPcell{k}.FamilyName, SPcell{k}.Field); + end +end + + +% Make the setpoint change with a WaitFlag +if WaitFlag ~= 0 + try + if DisplayFlag + fprintf(' Waiting for Setpoint-Monitor to be within tolerance\n'); + drawnow; + end + for k = 1:length(SPcell) + try + setpv(SPcell{k}, WaitFlag, InputFlags{:}); + end + end + if DisplayFlag + Time = clock; + fprintf(' %s %d:%d:%.2f Lattice change complete (setmachineconfig)\n\n', datestr(clock,1), Time(4), Time(5), Time(6)); + drawnow; + end + catch + fprintf('%s\n', lasterr) + fprintf('Error occurred waiting for Setpoint-Monitor comparison.\n'); + fprintf('Lattice is in an unknown state! (setmachineconfig)\n\n'); + end +end diff --git a/machine/ASP/StorageRing/setoperationalmode.m b/machine/ASP/StorageRing/setoperationalmode.m index 8af9894d..878ff7ed 100644 --- a/machine/ASP/StorageRing/setoperationalmode.m +++ b/machine/ASP/StorageRing/setoperationalmode.m @@ -1,324 +1,843 @@ -function setoperationalmode(ModeNumber) -%SETOPERATIONALMODE - Set all the variables associated with an operational mode -% setoperationalmode(ModeNumber) -% -% ModeNumber = 1. 3.0 GeV, User Mode -% 2. 3.0 GeV, User Mode with Split Bend in the model -% 3. 3.0 GeV, Model -% -% See also aoinit, updateatindex - -global THERING - - -% Check if the AO exists -checkforao; - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Accelerator Dependent Modes % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -if nargin < 1 - ModeCell = {'Commissioning Mode','User Mode', 'Model', 'Test'}; - [ModeNumber, OKFlag] = listdlg('Name','ASP','PromptString','Select the Operational Mode:', 'SelectionMode','single', 'ListString', ModeCell); - if OKFlag ~= 1 - fprintf(' Operational mode not changed\n'); - return - end -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Accelerator Data Structure % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -AD = getad; -AD.Machine = 'ASP'; % Will already be defined if setpathmml was used -AD.SubMachine = 'StorageRing'; % Will already be defined if setpathmml was used -AD.OperationalMode = ''; % Gets filled in later -AD.Energy = 3.0; -AD.InjectionEnergy = 3.0; -AD.HarmonicNumber = 360; - - -% Defaults RF for disperion and chromaticity measurements (must be in Hardware units) ??? -AD.DeltaRFDisp = 2000/4; -AD.DeltaRFChro = [-2000 -1000 0 1000 2000]/2; -AD.DeltaRFChro = [0:-500:-4000 -3500:500:0 500:500:4000 3500:-500:0]; - - -% SP-AM Error level -% AD.ErrorWarningLevel = 0 -> SP-AM errors are Matlab errors {Default} -% -1 -> SP-AM errors are Matlab warnings -% -2 -> SP-AM errors prompt a dialog box -% -3 -> SP-AM errors are ignored (ErrorFlag=-1 is returned) -AD.ErrorWarningLevel = 0; - - -%%%%%%%%%%%%%%%%%%%%% -% Operational Modes % -%%%%%%%%%%%%%%%%%%%%% - -% Mode setup variables (mostly path and file names) -% AD.OperationalMode - String used in titles -% MachineName - String used to build directory structure off DataRoot -% ModeName - String used for mode directory name off DataRoot/MachineName -% OpsFileExtension - string add to default file names -MachineName = 'asp'; -if ModeNumber == 1 - % User mode - AD.OperationalMode = '3.0 GeV, Prelim Commissioning Mode'; - ModeName = 'Comm'; - OpsFileExtension = '_Comm'; - - % AT lattice -% AD.ATModel = 'aspsr_msrf1cav'; -% aspsr_msrf1cav; - AD.ATModel = 'assr4_splitbends'; - assr4_splitbends cavity4ring; - - % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? - AO = getao; - AO.TUNE.Monitor.Golden = [ - 0.290 - 0.216 - NaN]; - setao(AO); - - % Golden chromaticity is in the AD (Physics units) - AD.Chromaticity.Golden = [1; 1]; % ??? - - % Tune processor delay: delay required to wait - % to have a fresh tune measurement after changing - % a variable like the RF frequency. Setpv will wait - % 2.2 * TuneDelay to be guaranteed a fresh data point. - AD.TuneDelay = 2.5; - - switch2online; -% switch2sim; - switch2hw; - -elseif ModeNumber == 2 - - % User mode - Distributed Dispersion - AD.OperationalMode = '3.0 GeV, Prelim User Mode'; - ModeName = 'CommUser'; - OpsFileExtension = '_CommUser'; - - % AT lattice -% AD.ATModel = 'aspsr_msrf1cav'; -% aspsr_msrf1cav; - AD.ATModel = 'assr4_disp'; - assr4_disp cavity4ring; - - % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? - AO = getao; - AO.TUNE.Monitor.Golden = [ - 0.290 - 0.216 - NaN]; - setao(AO); - - % Golden chromaticity is in the AD (Physics units) - AD.Chromaticity.Golden = [1; 1]; % ??? - - % Tune processor delay: delay required to wait - % to have a fresh tune measurement after changing - % a variable like the RF frequency. Setpv will wait - % 2.2 * TuneDelay to be guaranteed a fresh data point. - AD.TuneDelay = 2.5; - - switch2online; -% switch2sim; - switch2hw; - - -elseif ModeNumber == 3 - % Model mode - AD.OperationalMode = '3.0 GeV, Model'; - ModeName = 'Model'; - OpsFileExtension = ''; - - % AT lattice -% AD.ATModel = 'aspsr_msrf1cav'; -% aspsr_msrf1cav; - AD.ATModel = 'assr4'; - assr4; - - % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? - AO = getao; - AO.TUNE.Monitor.Golden = [ - 0.290 - 0.216 - NaN]; - setao(AO); - - - % Golden chromaticity is in the AD (Physics units) - AD.Chromaticity.Golden = [1; 1]; % ??? - - % Tune processor delay: delay required to wait - % to have a fresh tune measurement after changing - % a variable like the RF frequency. Setpv will wait - % 2.2 * TuneDelay to be guaranteed a fresh data point. - AD.TuneDelay = 2.5; - - switch2sim; - switch2hw; - -elseif ModeNumber == 4 - % Model mode - AD.OperationalMode = '3.0 GeV, test'; - ModeName = 'test'; - OpsFileExtension = ''; - - % AT lattice -% AD.ATModel = 'aspsr_msrf'; -% aspsr_msrf; - AD.ATModel = 'assr4_id'; - assr4_wiggler; - - % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? - AO = getao; - AO.TUNE.Monitor.Golden = [ - 0.29 - 0.216 - NaN]; - setao(AO); - - - % Golden chromaticity is in the AD (Physics units) - AD.Chromaticity.Golden = [1; 1]; % ??? - - % Tune processor delay: delay required to wait - % to have a fresh tune measurement after changing - % a variable like the RF frequency. Setpv will wait - % 2.2 * TuneDelay to be guaranteed a fresh data point. - AD.TuneDelay = 0; - - switch2sim; - switch2hw; - -else - error('Operational mode unknown'); -end - - -% Set the AD directory path -setad(AD); -MMLROOT = setmmldirectories(AD.Machine, AD.SubMachine, ModeName, OpsFileExtension); -AD = getad; - -%Application Programs WJC Sept 18, 2006 -AD.Directory.Orbit = [MMLROOT, 'applications', filesep, 'orbit', filesep, 'asp', filesep]; -AD.Directory.SOFB = [MMLROOT, 'applications', filesep, 'SOFB', filesep]; - - -% Circumference -AD.Circumference = findspos(THERING,length(THERING)+1); - - -% Updates the AT indices in the MiddleLayer with the present AT lattice -updateatindex; - - -% Set the model energy -setenergymodel(AD.Energy); - - -% Cavity and radiation -setcavity off; -setradiation off; -fprintf(' Radiation and Cavities are OFF. Use setcavity/setradiation to modify\n'); - -% Momentum compaction factor -MCF = getmcf('Model'); -if isnan(MCF) - AD.MCF = 0.0020; - fprintf(' Model alpha calculation failed, middlelayer alpha set to %f\n', AD.MCF); -else - AD.MCF = MCF; - fprintf(' Middlelayer alpha set to %f (AT model).\n', AD.MCF); -end -setad(AD); - - -% Final mode changes -% Note: setlocogains was changed to setlocodata -if ModeNumber == 1 - % Commissionign Mode - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % Add LOCO Parameters to AO and AT-Model % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - %LocoFileDirectory = getfamilydata('Directory','OpsData'); - %setlocodata('SetGains',[LocoFileDirectory,'LOCOFilename?']); - %setlocodata('LOCO2Model',[LocoFileDirectory,'LOCOFilename']); - setlocodata('Nominal'); - -elseif ModeNumber == 2 - % User Mode - setlocodata('Nominal'); - setfamilydata(0,'BPMx','Offset'); - setfamilydata(0,'BPMy','Offset'); - setfamilydata(0,'BPMx','Golden'); - setfamilydata(0,'BPMy','Golden'); - - setfamilydata(0,'TuneDelay'); - - %setsp('SQSF', 0, 'Simulator', 'Physics'); - %setsp('SQSD', 0, 'Simulator', 'Physics'); - setsp('HCM', 0, 'Simulator', 'Physics'); - setsp('VCM', 0, 'Simulator', 'Physics'); - -elseif ModeNumber == 3 - % Model Mode - setlocodata('Nominal'); - setfamilydata(0,'BPMx','Offset'); - setfamilydata(0,'BPMy','Offset'); - setfamilydata(0,'BPMx','Golden'); - setfamilydata(0,'BPMy','Golden'); - - setfamilydata(0,'TuneDelay'); - - %setsp('SQSF', 0, 'Simulator', 'Physics'); - %setsp('SQSD', 0, 'Simulator', 'Physics'); - setsp('HCM', 0, 'Simulator', 'Physics'); - setsp('VCM', 0, 'Simulator', 'Physics'); -end - - -% Change defaults for LabCA if using it -try - if exist('lcaSetRetryCount','file') - % read dummy pv to initialize labca - % ChannelName = family2channel('BPMx'); - % lcaGet(family2channel(ChannelName(1,:)); - - % Retry count - RetryCountNew = 1000; % Default: 599-old labca, 299-labca_2_1_beta - RetryCount = lcaGetRetryCount; - lcaSetRetryCount(RetryCountNew); - if RetryCount ~= RetryCountNew - fprintf(' Setting LabCA retry count to %d (was %d)\n', RetryCountNew, RetryCount); - end - - % Timeout - TimeoutNew = .005; % Defaul: .05-old labca, .1-labca_2_1_beta - Timeout = lcaGetTimeout; - lcaSetTimeout(TimeoutNew); - if abs(Timeout - TimeoutNew) > 1e-5 - fprintf(' Setting LabCA TimeOut to %f (was %f)\n', TimeoutNew, Timeout); - end - - % To avoid UDF errors, set the WarnLevel to 4 (Default is 3) - lcaSetSeverityWarnLevel(4); - fprintf(' Setting lcaSetSeverityWarnLevel to 4 to avoid annoying UDF errors.\n'); - end -catch - fprintf(' LabCA Timeout not set, need to run lcaSetRetryCount(1000), lcaSetTimeout(.01).\n'); -end - - -fprintf(' Middlelayer setup for operational mode: %s\n', AD.OperationalMode); - - +function varargout = setoperationalmode(ModeNumber) +%SETOPERATIONALMODE - Set all the variables associated with an operational mode +% STATUS = setoperationalmode(ModeNumber) +% +% If STATUS == 1, the mode has been changed. +% If STATUS == 0, the mode has NOT been changed. +% +% See also aoinit, updateatindex +% +% Updated: +% 02/02/2009: ET ModeCell updated to reflect current modes. +% 10/11/2009: ET Returns the if mode changed or not +% 24/02/2012: KW added splitbends all IDs model + +global THERING + + +% Check if the AO exists +checkforao; + +ModeCell = {... + 'Mode 1 - 3.0 GeV User Mode (0.0 m Dispersion)'; + 'Mode 2 - 3.0 GeV User Mode (0.1 m Dispersion) - SCW @ 0 T'; + 'Mode 3 - 3.0 GeV User Mode (0.24 m Dispersion)'; + 'Mode 4 - 3.0 GeV Model, single bend (0.0 m Dispersion)'; + 'Mode 5 - 3.0 GeV Model, single bend (0.1 m Dispersion)'; + 'Mode 6 - Low alpha intermediate lattice'; + 'Mode 7 - Low alpha intermediate lattice (-0.7m dispersion)'; + 'Mode 8 - 7-fold lattice'; + 'Mode 9 - Low alpha intermediate lattice (-0.86m dispersion)'; + 'Mode 10 - 3.0 GeV User Mode, all IDs (0.1m dispersion)'; + 'Mode 11 - 3.0 GeV User Mode (0.1 m Dispersion) - SCW @ 3 T'; + 'Mode 12 - 1.6 GeV User Mode (0.1 m Dispersion) - SCW @ 0 T'; + }; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Accelerator Dependent Modes % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +if nargin < 1 + [ModeNumber, OKFlag] = listdlg('Name','ASP','PromptString','Select the Operational Mode:',... + 'SelectionMode','single', 'ListString', ModeCell,'ListSize',[450 300]); + if OKFlag ~= 1 + fprintf(' Operational mode not changed\n'); + varargout{1} = 0; + return + end +end +varargout{1} = 1; + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Accelerator Data Structure % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +AD = getad; +AD.Machine = 'ASP'; % Will already be defined if setpathmml was used +AD.SubMachine = 'StorageRing'; % Will already be defined if setpathmml was used +AD.OperationalMode = ''; % Gets filled in later +AD.Energy = 3.033; 3.0314; 3.0134; %3.0134 % 19/05/2008 ET machine's energy seems to be ~1.4% lower than the model prediction based on the collective magnetic measurements of quadrupoles and sextupoles. +AD.InjectionEnergy = 3.0134; +AD.HarmonicNumber = 360; + +% Defaults RF for disperion and chromaticity measurements (must be in Hardware units) ??? +AD.DeltaRFDisp = 2000/4; +AD.DeltaRFChro = [0 -1000 -2000 -1000 0 1000 2000 1000 0]/2; + + + +% Tune processor delay: delay required to wait +% to have a fresh tune measurement after changing +% a variable like the RF frequency. Setpv will wait +% 2.2 * TuneDelay to be guaranteed a fresh data point. +AD.TuneDelay = 1.0; + +% SP-AM Error level +% AD.ErrorWarningLevel = 0 -> SP-AM errors are Matlab errors {Default} +% -1 -> SP-AM errors are Matlab warnings +% -2 -> SP-AM errors prompt a dialog box +% -3 -> SP-AM errors are ignored (ErrorFlag=-1 is returned) +AD.ErrorWarningLevel = 0; + + +%%%%%%%%%%%%%%%%%%%%% +% Operational Modes % +%%%%%%%%%%%%%%%%%%%%% + +% Mode setup variables (mostly path and file names) +% AD.OperationalMode - String used in titles +% MachineName - String used to build directory structure off DataRoot +% ModeName - String used for mode directory name off DataRoot/MachineName +% OpsFileExtension - string add to default file names +MachineName = 'asp'; +AD.OperationalMode = ModeCell{ModeNumber}; +if ModeNumber == 1 + % User mode split bends, zero dispersion + ModeName = 'User0'; + OpsFileExtension = '_user0'; + + % AT lattice + [status,res]=system('hostname -s'); + switch lower(strtrim(res)) + case {'cr01opi07'} + AD.ATModel = 'assr4_splitbends'; + assr4_splitbends cavity4ring; + otherwise + AD.ATModel = 'assr4_splitbends_mod'; + assr4_splitbends_mod cavity4ring; + end + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (2000 MV) ***\n') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 6.79e5; %6.68e5; + THERING{cavind(2)}.Voltage = 6.86e5; %0; + THERING{cavind(3)}.Voltage = 0; %6.58e5; + THERING{cavind(4)}.Voltage = 6.61e5; %6.48e5; + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + % Online and hardware units + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Add LOCO Parameters to AO and AT-Model % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %LocoFileDirectory = getfamilydata('Directory','OpsData'); + %setlocodata('SetGains',[LocoFileDirectory,'LOCOFilename?']); + %setlocodata('LOCO2Model',[LocoFileDirectory,'LOCOFilename']); + setlocodata('Nominal'); + +% fittunedisp2([13.29 5.216 0.0],'QFA','QDA','QFB',1) + setsp('QFA', 1.723428335912745,'physics','model'); + setsp('QDA',-1.021524810038134,'physics','model'); + setsp('QFB', 1.506832980875907,'physics','model'); + + % Set the nominal chromaticity + setsp('SFA', 11,'physics','model'); + setsp('SDA', -12,'physics','model'); +% fitchrom2([1,1],'SFB','SDB'); disp([getsp('SFB',1,'physics','model'),getsp('SDB',1,'physics','model')]) + setsp('SFB', 7.363955546172189,'physics','model'); + setsp('SDB', -7.179245538366332,'physics','model'); + +elseif ModeNumber == 2 + + % User mode - Split bends, Distributed Dispersion (0.1) + ModeName = 'User1'; + OpsFileExtension = '_user1'; + + % AT lattice + [status,res]=system('hostname -s'); + switch lower(strtrim(res)) + case {'cr01opi07'} + AD.ATModel = 'assr4_splitbends'; + assr4_splitbends cavity4ring; + otherwise + AD.ATModel = 'assr4_splitbends_mod'; + assr4_splitbends_mod cavity4ring; + end + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (2000 MV) ***\n') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 6.79e5; %6.68e5; + THERING{cavind(2)}.Voltage = 6.86e5; %0; + THERING{cavind(3)}.Voltage = 0; %6.58e5; + THERING{cavind(4)}.Voltage = 6.61e5; %6.48e5; + + % Insert super conducting wiggler +% insertscw(0); + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + % Set model parameters + setlocodata('Nominal'); +% fittunedisp2([13.29 5.216 0.10],'QFA','QDA','QFB',1) + setpv('QFA', +1.733644317160764,'physics','model'); + setpv('QDA', -1.022026077359464,'physics','model'); + setpv('QFB', +1.501323674315535,'physics','model'); + + % In order to get the right chromaticity + % operations changed to low chromaticity for BBB operation + setsp('SFA', 11,'physics','model'); + setsp('SDA', -12,'physics','model'); +% fitchrom2([1,1],'SFB','SDB'); disp([getsp('SFB',1,'physics','model'),getsp('SDB',1,'physics','model')]) + setsp('SFB', 7.758558385071983,'physics','model'); + setsp('SDB', -7.578367804452122,'physics','model'); + +elseif ModeNumber == 3 + + % User mode - Split bends, Distributed Dispersion (0.24) + ModeName = 'User2'; + OpsFileExtension = '_user2'; + + % AT lattice + [status,res]=system('hostname -s'); + switch lower(strtrim(res)) + case {'cr01opi07'} + AD.ATModel = 'assr4_splitbends'; + assr4_splitbends cavity4ring; + otherwise + AD.ATModel = 'assr4_splitbends_mod'; + assr4_splitbends_mod cavity4ring; + end + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (1900 MV) ***') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 6.68e5; + THERING{cavind(2)}.Voltage =6.68e5; + THERING{cavind(3)}.Voltage = 6.58e5; + THERING{cavind(4)}.Voltage = 6.48e5; + + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + setlocodata('Nominal'); +% fittunedisp2([13.29 5.216 0.24],'QFA','QDA','QFB',1) + setpv('QFA', +1.749877620130296,'physics','model'); + setpv('QDA', -1.022984475040535,'physics','model'); + setpv('QFB', +1.492855475998011,'physics','model'); + + % Set the nominal chromaticity + setsp('SFA', 11,'physics','model'); + setsp('SDA', -12,'physics','model'); +% fitchrom2([1,1],'SFB','SDB'); disp([getsp('SFB',1,'physics','model'),getsp('SDB',1,'physics','model')]) + setsp('SFB', 9.397721020313263,'physics','model'); + setsp('SDB', -9.152478741386210,'physics','model'); + +elseif ModeNumber == 4 + % single bends with zero-dispersion + ModeName = 'Model'; + OpsFileExtension = ''; + + % AT lattice + AD.ATModel = 'assr4'; + assr4; + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (1900 MV) ***') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 6.68e5; + THERING{cavind(2)}.Voltage = 0; + THERING{cavind(3)}.Voltage = 6.58e5; + THERING{cavind(4)}.Voltage = 6.48e5; + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2sim; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + setlocodata('Nominal'); +% fittunedisp2([13.29 5.216 0.0],'QFA','QDA','QFB',1) + setsp('QFA', 1.721721539410648,'physics','model'); + setsp('QDA',-1.018590780985194,'physics','model'); + setsp('QFB', 1.505499577114660,'physics','model'); + + % Set the nominal chromaticity + setsp('SFA', 11,'physics','model'); + setsp('SDA', -12,'physics','model'); +% fitchrom2([1,1],'SFB','SDB'); disp([getsp('SFB',1,'physics','model'),getsp('SDB',1,'physics','model')]) + setsp('SFB', 7.376336647962120,'physics','model'); + setsp('SDB', -7.127633424850286,'physics','model'); + +elseif ModeNumber == 5 + % Model mode, single bends with distributed dispersion (0.1) + ModeName = 'Model'; + OpsFileExtension = ''; + + % AT lattice + AD.ATModel = 'assr4'; + assr4 cavity4ring; + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (1900 MV) ***') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 6.68e5; + THERING{cavind(2)}.Voltage = 0; + THERING{cavind(3)}.Voltage = 6.58e5; + THERING{cavind(4)}.Voltage = 6.48e5; + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + % Tune processor delay: delay required to wait + % to have a fresh tune measurement after changing + % a variable like the RF frequency. Setpv will wait + % 2.2 * TuneDelay to be guaranteed a fresh data point. + AD.TuneDelay = 0; + + switch2sim; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + +% fittunedisp2([13.29 5.216 0.10],'QFA','QDA','QFB',1) + setpv('QFA', +1.731975160162291,'physics','model'); + setpv('QDA', -1.019100405961120,'physics','model'); + setpv('QFB', +1.499963551732084,'physics','model'); + + % In order to get the right chromaticity + % operations changed to low chromaticity for BBB operation + setsp('SFA', 11,'physics','model'); + setsp('SDA', -12,'physics','model'); +% fitchrom2([1,1],'SFB','SDB'); disp([getsp('SFB',1,'physics','model'),getsp('SDB',1,'physics','model')]) + setsp('SFB', 7.770807107941121,'physics','model'); + setsp('SDB', -7.502482318683351,'physics','model'); + +elseif ModeNumber == 6 + + % Low alpha intermediate lattice with -0.5 meter dispersion + ModeName = 'Alpha_intermediate'; + OpsFileExtension = '_alpha_int'; + + % AT lattice using new assr4 with modified bends. + AD.ATModel = 'assr4_modbend'; + assr4_modbend; + + AD.DeltaRFChro = AD.DeltaRFChro/2; + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + setlocodata('Nominal'); + setsp('QFA', 1.717973104075701,'physics','model'); + setsp('QDA', -1.071945364781163,'physics','model'); + setsp('QFB', 1.565332600016605,'physics','model'); + +elseif ModeNumber == 7 + + % Low alpha intermediate lattice with -0.70 meter dispersion + ModeName = 'Alpha_intermediate2'; + OpsFileExtension = '_alpha_int2'; + + % AT lattice using new assr4 with modified bends. + AD.ATModel = 'assr4_splitbends_mod'; +% assr4_modbend; + assr4_splitbends_mod; + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (1900 MV) ***') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 6.68e5; + THERING{cavind(2)}.Voltage = 0; + THERING{cavind(3)}.Voltage = 6.58e5; + THERING{cavind(4)}.Voltage = 6.48e5; + + + % Momentum compaction factor reduced by factor 10. So requires RF + % change also scales by factor 10. + AD.DeltaRFDisp = 250/10; + AD.DeltaRFChro = AD.DeltaRFChro/10*3; + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + setlocodata('Nominal'); +% setsp('QFA', 1.701360482677673,'physics','model'); +% setsp('QDA', -1.072306322936900 ,'physics','model'); +% setsp('QFB', 1.576013680596304,'physics','model'); +% setsp('QFA', 1.702923622325624 ,'physics','model'); +% setsp('QDA', -1.048908889625475 ,'physics','model'); +% setsp('QFB', 1.571570870143046,'physics','model'); + % Modbend model for -0.75 m dispersion +% setsp('QFA', 1.667596906749336 ,'physics','model'); +% setsp('QDA', -1.022625725276466 ,'physics','model'); +% setsp('QFB', 1.528329348576760,'physics','model'); + % for -0.7 meter dispersion +% setsp('QFA', 1.672129504597714 ,'physics','model'); +% setsp('QDA', -1.024920210424092 ,'physics','model'); +% setsp('QFB', 1.539699300919924,'physics','model'); + fittunedisp2([13.29 5.216 -0.7],'QFA','QDA','QFB',1); + +elseif ModeNumber == 8 + + % 7-fold lattice for custom straigth section betas and beam sizes. + ModeName = 'SevenFold_Lattice'; + OpsFileExtension = '_7fold'; + + % AT lattice using new assr4 with modified bends. + AD.ATModel = 'assr4'; + assr4_splitbends; + + % Momentum compaction factor reduced by factor 10. So requires RF + % change also scales by factor 10. + AD.DeltaRFDisp = 250; + AD.DeltaRFChro = AD.DeltaRFChro; + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + setlocodata('Nominal'); + q1 = []; + q2 = []; + for i=1:7 + q1 = [q1 ([1 4]+(i-1)*4)]; + q2 = [q2 ([2 3]+(i-1)*4)]; + end + % 0.1 disp and 1.5 meter betay in first straight + setsp('QFA', 1.606767660323437,elem2dev('QFA',q2),'physics','model'); + setsp('QFA', 1.933334650614699,elem2dev('QFA',q1),'physics','model'); + setsp('QDA', -1.131939477770982,elem2dev('QDA',q2),'physics','model'); + setsp('QDA', -0.920134397770982,elem2dev('QDA',q1),'physics','model'); + setsp('QFB', 1.448641081159739,elem2dev('QFB',q2),'physics','model'); + setsp('QFB', 1.542221081159739,elem2dev('QFB',q1),'physics','model'); + + % In order to get the right chromaticity + setsp('SFA', 16.89,'physics','model'); + setsp('SDA', -16.49,'physics','model'); + fitchrom2([3.2 13],'SFB','SDB') + +elseif ModeNumber == 9 + % Low alpha intermediate lattice with -0.86 meter dispersion + ModeName = 'Alpha_intermediate3'; + OpsFileExtension = '_alpha_int3'; + + % AT lattice using new assr4 with modified bends. + AD.ATModel = 'assr4_splitbends_mod'; +% assr4_modbend; + assr4_splitbends_mod; + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (1900 MV) ***') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 6.68e5; + THERING{cavind(2)}.Voltage = 0; + THERING{cavind(3)}.Voltage = 6.58e5; + THERING{cavind(4)}.Voltage = 6.48e5; + + fittunedisp2([13.29 5.216 -0.86],'QFA','QDA','QFB',1); + + % Momentum compaction factor reduced by factor 10. So requires RF + % change also scales by factor 10. + AD.DeltaRFDisp = 250/10; + AD.DeltaRFChro = AD.DeltaRFChro/10; + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + % In order to get the right chromaticity + setsp('SFA', 11,'physics','model'); + setsp('SDA', -10.4,'physics','model'); + fitchrom2([1 1],'SFB','SDB') + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + +elseif ModeNumber == 10 + + % User mode - Split bends, Distributed Dispersion (0.1) + ModeName = 'User1'; + OpsFileExtension = '_user1'; + + % AT lattice + AD.ATModel = 'assr4_splitbends_kent'; + assr4_splitbends_kent cavity4ringkent; + + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + % Set model parameters + setlocodata('Nominal'); + +% fittunedisp2([13.29 5.214 0.10],'QFA','QDA','QFB',1) + + setsp('QFA', 1.735450634682162,'physics','model'); + setsp('QDA',-1.026232260610199,'physics','model'); + setsp('QFB', 1.502798566761560,'physics','model'); + + % In order to get the right chromaticity + setsp('SFA', 17,'physics','model'); + setsp('SDA', -16.6,'physics','model'); + fitchrom2([3.2 13],'SFB','SDB') + +% idind = findcells(THERING,'FamName','ID'); +% kx = 0.0003416; +% ky = -0.0210746; +% THERING{idind(12)}.M66(2,1) = kx; +% THERING{idind(12)}.M66(4,3) = ky; +elseif ModeNumber == 11 + + % User mode - Split bends, Distributed Dispersion (0.1) + ModeName = 'User1'; + OpsFileExtension = '_user1'; + + % AT lattice + AD.ATModel = 'assr4_splitbends'; + assr4_splitbends cavity4ring; + + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + % Set the model energy + setenergymodel(AD.Energy); + + % Set model parameters + setlocodata('Nominal'); + +% fittunedisp2([13.29 5.214 0.10],'QFA','QDA','QFB',1) + + setsp('QFA', 1.735450634682162,'physics','model'); + setsp('QDA',-1.026232260610199,'physics','model'); + setsp('QFB', 1.502798566761560,'physics','model'); + + % In order to get the right chromaticity + setsp('SFA', 17,'physics','model'); + setsp('SDA', -16.6,'physics','model'); + fitchrom2([3.2 13],'SFB','SDB') + + % SCW at 4.3T +% global THERING +% idind = findcells(THERING,'FamName','ID'); +% kx = [ 0.0026]; +% ky = [-0.1219]; +% THERING{idind(8)}.M66(2,1) = kx; +% THERING{idind(8)}.M66(4,3) = ky; + + % SCW at 3.0 T + global THERING + idind = findcells(THERING,'FamName','ID'); + + % Measured with increasing field strength + ii = 2; + gaps = [3 2 1.4 1.0 0.2 0]; + kx = [-0.000831772685971 -0.000292523070982 -0.000583821679539 0.000059901469698 0 0]; + ky = [-0.071186619313300 -0.034495700926302 -0.019418887097436 -0.011923601576230 0 0]; + measdate = '20.12.2014'; + load /asp/usr/scripts/insertiondevice/feedforward/WIG_08_SCW/SR08ID01_SCW_QuadFF_2014-12-20_18-41-43-upramp + +% kx = [-0.0012]; +% ky = [-0.0369]; +% load /asp/usr/scripts/insertiondevice/feedforward/WIG_08_SCW/SR08ID01_SCW_QuadFF_2013-01-25_16-09-11.mat + +% kx = [0.0098]; +% ky = [-0.0551]; +% load /asp/usr/scripts/insertiondevice/feedforward/WIG_08_SCW/SR08ID01_SCW_QuadFF_2013-01-25_20-20-45.mat +% +% kx = -0.001269426242865; +% ky = -0.064681552652870; +% load /asp/usr/scripts/insertiondevice/feedforward/WIG_08_SCW/SR08ID01_SCW_QuadFF_2013-01-25_22-27-26.mat + + THERING{idind(8)}.M66(2,1) = kx(ii); + THERING{idind(8)}.M66(4,3) = ky(ii); + + stepsp('QFA',idcorrection.qfasd(:,ii),'model','hardware'); + stepsp('QDA',idcorrection.qdasd(:,ii),'model','hardware'); + stepsp('QFB',idcorrection.qfbsd(:,ii),'model','hardware'); + +elseif ModeNumber == 12 + + % User mode - Split bends, Distributed Dispersion (0.1) + ModeName = 'Lowenergy'; + OpsFileExtension = '_lowenergy'; + + % Set the ring energy + AD.Energy = 1.62; + AD.InjectionEnergy = 1.62; + + % AT lattice + AD.ATModel = 'assr4_splitbends'; + assr4_splitbends cavity4ring; + % 3 cavity operation + fprintf('*** Starting 3 cavity operation (1900 MV) ***') + cavind = findcells(THERING,'HarmNumber'); + THERING{cavind(1)}.Voltage = 2.5e5; 6.68e5; + THERING{cavind(2)}.Voltage = 2.5e5; 0; + THERING{cavind(3)}.Voltage = 0; 6.58e5; + THERING{cavind(4)}.Voltage = 2.5e5; 6.48e5; + + % Set the model energy + setenergymodel(1.62); + + % Golden TUNE is with the TUNE family (This could have been in aspphysdata) % ??? + AO = getao; + AO.TUNE.Monitor.Golden = [ + 0.290 + 0.216 + NaN]; + + % Reset the deltarespmat because the default is in HW units and for 3 + % GeV. + AO.HCM.Setpoint.DeltaRespMat = physics2hw('HCM', 'Setpoint', 1.8e-5*AD.Energy/3.03, AO.HCM.DeviceList); + AO.VCM.Setpoint.DeltaRespMat = physics2hw('VCM', 'Setpoint', 0.9e-5*AD.Energy/3.03, AO.VCM.DeviceList); + + setao(AO); + + % Golden chromaticity is in the AD (Physics units) + AD.Chromaticity.Golden = [1; 1]; % ??? + + switch2online; + switch2hw; + + % Updates the AT indices in the MiddleLayer with the present AT lattice + updateatindex; + + % Set model parameters + setlocodata('Nominal'); + +% fittunedisp2([13.29 5.214 0.10],'QFA','QDA','QFB',1) + + % 0.1 m disp +% setpv('QFA', +1.735451639222026,'physics','model'); +% setpv('QDA', -1.026238981593949,'physics','model'); +% setpv('QFB', +1.502800258212542,'physics','model'); + + % 0.24 m disp + setpv('QFA', +1.751424202841732,'physics','model'); + setpv('QDA', -1.026976173811566,'physics','model'); + setpv('QFB', +1.494479036840916,'physics','model'); + + + % In order to get the right chromaticity + setsp('SFA', 17,'physics','model'); + setsp('SDA', -16.6,'physics','model'); + fitchrom2([3.2 13],'SFB','SDB'); + +else + error('Operational mode unknown'); +end + + +% Set the AD directory path +setad(AD); +MMLROOT = setmmldirectories(AD.Machine, AD.SubMachine, ModeName, OpsFileExtension); +AD = getad; + +%Application Programs WJC Sept 18, 2006 +AD.Directory.Orbit = [MMLROOT, 'applications', filesep, 'orbit', filesep, 'asp', filesep]; +AD.Directory.SOFB = [MMLROOT, 'applications', filesep, 'SOFB', filesep]; + +% Circumference +AD.Circumference = findspos(THERING,length(THERING)+1); + + +% Cavity and radiation +setcavity off; % Needed for tune +setradiation off; % ??? +fprintf(' Radiation and Cavities are OFF. Use setcavity/setradiation to modify\n'); + +% Momentum compaction factor +MCF = getmcf('Model'); +if isnan(MCF) + AD.MCF = 0.0020; + fprintf(' Model alpha calculation failed, middlelayer alpha set to %f\n', AD.MCF); +else + AD.MCF = MCF; + fprintf(' Middlelayer alpha set to %f (AT model).\n', AD.MCF); +end +setad(AD); + +% Change defaults for LabCA if using it +try + if exist('lcaSetRetryCount','file') + % read dummy pv to initialize labca + % ChannelName = family2channel('BPMx'); + % lcaGet(family2channel(ChannelName(1,:)); + + % Retry count + % 5/4/2017 Eugene: set to 100 so the total timeout is only 0.5s + % rather than 10 seconds! + RetryCountNew = 100; % Default: 599-old labca, 299-labca_2_1_beta, + RetryCount = lcaGetRetryCount; + lcaSetRetryCount(RetryCountNew); + if RetryCount ~= RetryCountNew + fprintf(' Setting LabCA retry count to %d (was %d)\n', RetryCountNew, RetryCount); + end + + % Timeout + TimeoutNew = 0.1; % Defaul: .05-old labca, .1-labca_2_1_beta + Timeout = lcaGetTimeout; + lcaSetTimeout(TimeoutNew); + if abs(Timeout - TimeoutNew) > 1e-5 + fprintf(' Setting LabCA TimeOut to %f (was %f)\n', TimeoutNew, Timeout); + end + + % To avoid UDF errors, set the WarnLevel to 4 (Default is 3) + lcaSetSeverityWarnLevel(4); + fprintf(' Setting lcaSetSeverityWarnLevel to 4 to avoid annoying UDF errors.\n'); + end +catch + fprintf(' LabCA Timeout not set, need to run lcaSetRetryCount(200), lcaSetTimeout(.01).\n'); +end + +fprintf(' Middlelayer setup for operational mode: %s\n', AD.OperationalMode); + + diff --git a/machine/ASP/StorageRing/setorbitdefault.m b/machine/ASP/StorageRing/setorbitdefault.m index b864260d..8737ec45 100644 --- a/machine/ASP/StorageRing/setorbitdefault.m +++ b/machine/ASP/StorageRing/setorbitdefault.m @@ -1,166 +1,166 @@ -function setorbitdefault(varargin) -% setorbitdefault(Evectors {1e-4}, Iters {1}, RemoveBPMDeviceList, RemoveHCMDeviceList, RemoveVCMDeviceList) - - -% Defaults -PlaneFlag = 0; % Both planes -ItersDefault = 1; -EvectorsDefault = 1e-3; -RemoveBPMDeviceList = []; -RemoveHCMDeviceList = []; -RemoveVCMDeviceList = []; -DisplayFlag = 'Display'; - -% Input parsing -Evectors = []; -Iters = []; -for i = length(varargin):-1:1 - if isstruct(varargin{i}) - % Just remove - varargin(i) = []; - elseif iscell(varargin{i}) - % Just remove - varargin(i) = []; - elseif strcmpi(varargin{i},'struct') - % Just remove - varargin(i) = []; - elseif strcmpi(varargin{i},'numeric') - % Just remove - varargin(i) = []; - elseif strcmpi(varargin{i},'Display') - DisplayFlag = 'Display'; - varargin(i) = []; - elseif strcmpi(varargin{i},'NoDisplay') - DisplayFlag = 'NoDisplay'; - varargin(i) = []; - elseif any(strcmpi(varargin{i},{'x','Horizontal'})) - PlaneFlag = 1; - varargin(i) = []; - elseif any(strcmpi(varargin{i},{'y','Vertical'})) - PlaneFlag = 2; - varargin(i) = []; - end -end - - -if length(varargin) >= 1 - if isnumeric(varargin{1}) - Evectors = varargin{1}; - varargin(i) = []; - end -end -if isempty(Evectors) - if PlaneFlag == 0 - Evectors = EvectorsDefault; - elseif PlaneFlag == 1 - Evectors = EvectorsDefault; - elseif PlaneFlag == 2 - Evectors = EvectorsDefault; - end -end - -if length(varargin) >= 1 - if isnumeric(varargin{1}) - Iters = varargin{1}; - varargin(i) = []; - end -end -if isempty(Iters) - Iters = ItersDefault; -end - -if length(varargin) >= 1 - if isnumeric(varargin{1}) - RemoveBPMDeviceList = varargin{1}; - varargin(i) = []; - end -end - - - -if PlaneFlag == 0 - % Get BPM and CM structures - CM = {getsp('HCM','struct'),getsp('VCM','struct')}; - BPM = {getx('struct'), gety('struct')}; - - - % Remove devices - - % HCM - i = findrowindex(RemoveHCMDeviceList, CM{1}.DeviceList); - CM{1}.DeviceList(i,:) = []; - CM{1}.Data(i,:) = []; - CM{1}.Status(i,:) = []; - - % VCM - i = findrowindex(RemoveVCMDeviceList, CM{2}.DeviceList); - CM{2}.DeviceList(i,:) = []; - CM{2}.Data(i,:) = []; - CM{2}.Status(i,:) = []; - - % BPMx and BPMy - i = findrowindex(RemoveBPMDeviceList, BPM{1}.DeviceList); - BPM{1}.DeviceList(i,:) = []; - BPM{1}.Data(i,:) = []; - BPM{1}.Status(i,:) = []; - - i = findrowindex(RemoveBPMDeviceList, BPM{2}.DeviceList); - BPM{2}.DeviceList(i,:) = []; - BPM{2}.Data(i,:) = []; - BPM{2}.Status(i,:) = []; - - - % Corrector orbit - setorbit('Golden', BPM, CM, Iters, Evectors, DisplayFlag, varargin{:}); - -elseif PlaneFlag == 1 - - % Get BPM and CM structures - CM = getsp('HCM','struct'); - BPM = getx('struct'); - - - % Remove devices - - % HCM - i = findrowindex(RemoveHCMDeviceList, CM.DeviceList); - CM.DeviceList(i,:) = []; - CM.Data(i,:) = []; - CM.Status(i,:) = []; - - % BPMx - i = findrowindex(RemoveBPMDeviceList, BPM.DeviceList); - BPM.DeviceList(i,:) = []; - BPM.Data(i,:) = []; - BPM.Status(i,:) = []; - - - % Corrector orbit - setorbit('Golden', BPM, CM, Iters, Evectors, DisplayFlag, varargin{:}); - -elseif PlaneFlag == 2 - - % Get BPM and CM structures - CM = getsp('VCM','struct'); - BPM = gety('struct'); - - - % Remove devices - - % VCM - i = findrowindex(RemoveVCMDeviceList, CM.DeviceList); - CM.DeviceList(i,:) = []; - CM.Data(i,:) = []; - CM.Status(i,:) = []; - - % BPMy - i = findrowindex(RemoveBPMDeviceList, BPM.DeviceList); - BPM.DeviceList(i,:) = []; - BPM.Data(i,:) = []; - BPM.Status(i,:) = []; - - - % Corrector orbit - setorbit('Golden', BPM, CM, Iters, Evectors, DisplayFlag, varargin{:}); -end - +function setorbitdefault(varargin) +% setorbitdefault(Evectors {1e-4}, Iters {1}, RemoveBPMDeviceList, RemoveHCMDeviceList, RemoveVCMDeviceList) + + +% Defaults +PlaneFlag = 0; % Both planes +ItersDefault = 1; +EvectorsDefault = 1e-3; +RemoveBPMDeviceList = []; +RemoveHCMDeviceList = []; +RemoveVCMDeviceList = []; +DisplayFlag = 'Display'; + +% Input parsing +Evectors = []; +Iters = []; +for i = length(varargin):-1:1 + if isstruct(varargin{i}) + % Just remove + varargin(i) = []; + elseif iscell(varargin{i}) + % Just remove + varargin(i) = []; + elseif strcmpi(varargin{i},'struct') + % Just remove + varargin(i) = []; + elseif strcmpi(varargin{i},'numeric') + % Just remove + varargin(i) = []; + elseif strcmpi(varargin{i},'Display') + DisplayFlag = 'Display'; + varargin(i) = []; + elseif strcmpi(varargin{i},'NoDisplay') + DisplayFlag = 'NoDisplay'; + varargin(i) = []; + elseif any(strcmpi(varargin{i},{'x','Horizontal'})) + PlaneFlag = 1; + varargin(i) = []; + elseif any(strcmpi(varargin{i},{'y','Vertical'})) + PlaneFlag = 2; + varargin(i) = []; + end +end + + +if length(varargin) >= 1 + if isnumeric(varargin{1}) + Evectors = varargin{1}; + varargin(i) = []; + end +end +if isempty(Evectors) + if PlaneFlag == 0 + Evectors = EvectorsDefault; + elseif PlaneFlag == 1 + Evectors = EvectorsDefault; + elseif PlaneFlag == 2 + Evectors = EvectorsDefault; + end +end + +if length(varargin) >= 1 + if isnumeric(varargin{1}) + Iters = varargin{1}; + varargin(i) = []; + end +end +if isempty(Iters) + Iters = ItersDefault; +end + +if length(varargin) >= 1 + if isnumeric(varargin{1}) + RemoveBPMDeviceList = varargin{1}; + varargin(i) = []; + end +end + + + +if PlaneFlag == 0 + % Get BPM and CM structures + CM = {getsp('HCM','struct'),getsp('VCM','struct')}; + BPM = {getx('struct'), gety('struct')}; + + + % Remove devices + + % HCM + i = findrowindex(RemoveHCMDeviceList, CM{1}.DeviceList); + CM{1}.DeviceList(i,:) = []; + CM{1}.Data(i,:) = []; + CM{1}.Status(i,:) = []; + + % VCM + i = findrowindex(RemoveVCMDeviceList, CM{2}.DeviceList); + CM{2}.DeviceList(i,:) = []; + CM{2}.Data(i,:) = []; + CM{2}.Status(i,:) = []; + + % BPMx and BPMy + i = findrowindex(RemoveBPMDeviceList, BPM{1}.DeviceList); + BPM{1}.DeviceList(i,:) = []; + BPM{1}.Data(i,:) = []; + BPM{1}.Status(i,:) = []; + + i = findrowindex(RemoveBPMDeviceList, BPM{2}.DeviceList); + BPM{2}.DeviceList(i,:) = []; + BPM{2}.Data(i,:) = []; + BPM{2}.Status(i,:) = []; + + + % Corrector orbit + setorbit('Golden', BPM, CM, Iters, Evectors, DisplayFlag, varargin{:}); + +elseif PlaneFlag == 1 + + % Get BPM and CM structures + CM = getsp('HCM','struct'); + BPM = getx('struct'); + + + % Remove devices + + % HCM + i = findrowindex(RemoveHCMDeviceList, CM.DeviceList); + CM.DeviceList(i,:) = []; + CM.Data(i,:) = []; + CM.Status(i,:) = []; + + % BPMx + i = findrowindex(RemoveBPMDeviceList, BPM.DeviceList); + BPM.DeviceList(i,:) = []; + BPM.Data(i,:) = []; + BPM.Status(i,:) = []; + + + % Corrector orbit + setorbit('Golden', BPM, CM, Iters, Evectors, DisplayFlag, varargin{:}); + +elseif PlaneFlag == 2 + + % Get BPM and CM structures + CM = getsp('VCM','struct'); + BPM = gety('struct'); + + + % Remove devices + + % VCM + i = findrowindex(RemoveVCMDeviceList, CM.DeviceList); + CM.DeviceList(i,:) = []; + CM.Data(i,:) = []; + CM.Status(i,:) = []; + + % BPMy + i = findrowindex(RemoveBPMDeviceList, BPM.DeviceList); + BPM.DeviceList(i,:) = []; + BPM.Data(i,:) = []; + BPM.Status(i,:) = []; + + + % Corrector orbit + setorbit('Golden', BPM, CM, Iters, Evectors, DisplayFlag, varargin{:}); +end + diff --git a/machine/ASP/StorageRing/setquad.m b/machine/ASP/StorageRing/setquad.m index 6d990670..817e2bdc 100644 --- a/machine/ASP/StorageRing/setquad.m +++ b/machine/ASP/StorageRing/setquad.m @@ -1,26 +1,20 @@ -function setquad(QMS, QuadSetpoint, WaitFlag) -%SETQUAD - Set quadrupole setpoint (used by quadcenter) -% setquad(QMS, QuadSetpoint, WaitFlag) -% -% See also getquad, quadcenter - - -if nargin < 2 - error('At least 2 inputs required'); -end -if nargin < 3 - WaitFlag = -2; -end - -QuadFamily = QMS.QuadFamily; -QuadDev = QMS.QuadDev; - -Mode = getfamilydata(QuadFamily,'Setpoint','Mode'); - -if strcmpi(Mode,'Simulator') - % Simulator - setsp(QuadFamily, QuadSetpoint, QuadDev, WaitFlag); -else - % Online - setsp(QuadFamily, QuadSetpoint, QuadDev, WaitFlag); -end +function setquad(QMS, QuadSetpoint, WaitFlag) +% setquad(QMS, QuadSetpoint, WaitFlag) +% Used by quadcenter + +if nargin < 2 + error('At least 2 inputs required'); +end +if nargin < 3 + WaitFlag = -2; +end + +QuadFamily = QMS.QuadFamily; +QuadDev = QMS.QuadDev; + +% if strcmpi(QuadFamily,'QFB') +% del = QuadSetpoint-getsp(QuadFamily,QuadDev); +% setsp(QuadFamily, getsp(QuadFamily,[QuadDev(1) 1; QuadDev(1) 2]) + del, [QuadDev(1) 1; QuadDev(1) 2], WaitFlag); +% else + setsp(QuadFamily, QuadSetpoint, QuadDev, WaitFlag); +% end diff --git a/machine/ASP/StorageRing/sextcenter_manual.m b/machine/ASP/StorageRing/sextcenter_manual.m new file mode 100644 index 00000000..0d7f3a1e --- /dev/null +++ b/machine/ASP/StorageRing/sextcenter_manual.m @@ -0,0 +1,46 @@ +close all +% 0 = both planes; 1 = x-plane; 2 = y-plane +plane = 2; + + +% Sector number for BPM +for i=3 + % BPM number within the sector + for j=3 + + BPMDev = [i j]; + +% if getfamilydata('BPMx','Status',BPMDev) == 0 +% continue; +% end + + switch BPMDev(2) + case 1 + quadfam = 'SFA'; + quaddev = [BPMDev(1) 1]; + case 2 + quadfam = 'SDA'; + quaddev = [BPMDev(1) 1]; + case 3 + quadfam = 'SDB'; + quaddev = [BPMDev(1) 1]; + case 4 + quadfam = 'SFB'; + quaddev = [BPMDev(1) 1]; + case 5 + quadfam = 'SDB'; + quaddev = [BPMDev(1) 2]; + case 6 + quadfam = 'SDA'; + quaddev = [BPMDev(1) 2]; + case 7 + quadfam = 'SFA'; + quaddev = [BPMDev(1) 2]; + end + + quadcenter(quadfam,quaddev,plane,BPMDev); + end +end + +beep +return diff --git a/machine/ASP/StorageRing/snap.m b/machine/ASP/StorageRing/snap.m index 360f95ad..e39e569b 100644 --- a/machine/ASP/StorageRing/snap.m +++ b/machine/ASP/StorageRing/snap.m @@ -1,9 +1,12 @@ function [image_out] = snap(cam_name,varargin) + +error('snap is deprecated. Use getcameradata instead.'); + % SNAP % -% Snaps an image from a CCD camera - -%function [cam_name] = snap(c) +% Snaps an image from a CCD camera, specified by string c +% +%function [image] = snap(cam_name) if nargin > 1 && strcmpi(varargin{1},'plot') plotimage = 1; @@ -17,65 +20,67 @@ -disp('starting snap') +% disp('starting snap') % open CA to camera PVs -h1 = mcaopen([cam_name ':HEIGHT_MONITOR']); -h2 = mcaopen([cam_name ':WIDTH_MONITOR']); -h3 = mcaopen([cam_name ':DATA_MONITOR']); -h4 = mcaopen([cam_name ':EUID_MONITOR']); -h5 = mcaopen([cam_name ':ISO_STATUS']); -h6 = mcaopen([cam_name ':COUNTER_MONITOR']); -h7 = mcaopen([cam_name ':BPP_MONITOR']); -h8 = mcaopen([cam_name ':TRIGGER_MODE_STATUS']); -h9 = mcaopen([cam_name ':TRIGGER_ON_OFF_STATUS']); -h10 = mcaopen([cam_name ':TRIGGER_DELAY_MONITOR']); -h11 = mcaopen([cam_name ':FRAMERATE_STATUS']); -h12 = mcaopen([cam_name ':MODE_STATUS']); -h13 = mcaopen([cam_name ':SHUTTER_MONITOR']); -h14 = mcaopen([cam_name ':SHUTTER_MODE_STATUS']); -h15 = mcaopen([cam_name ':EXPOSURE_MONITOR']); -h16 = mcaopen([cam_name ':EXPOSURE_MODE_STATUS']); -h17 = mcaopen([cam_name ':GAIN_MONITOR']); -h18 = mcaopen([cam_name ':GAIN_MODE_STATUS']); -h19 = mcaopen([cam_name ':WOFFSET_MONITOR']); -h20 = mcaopen([cam_name ':HOFFSET_MONITOR']); -h21 = mcaopen([cam_name ':BRIGHTNESS_MONITOR']); -h22 = mcaopen([cam_name ':BRIGHTNESS_MODE_STATUS']); -%h23 = mcaopen([cam_name ':XP_MONITOR']); -%h24 = mcaopen([cam_name ':YP_MONITOR']); +h1 = getpv([cam_name ':HEIGHT_MONITOR']); +h2 = getpv([cam_name ':WIDTH_MONITOR']); +h3 = getpv([cam_name ':DATA_MONITOR']); +h4 = getpv([cam_name ':EUID_MONITOR']); +h5 = getpv([cam_name ':ISO_STATUS']); +h6 = getpv([cam_name ':COUNTER_MONITOR']); +h7 = getpv([cam_name ':BPP_MONITOR']); +h8 = getpv([cam_name ':TRIGGER_MODE_STATUS']); +h9 = getpv([cam_name ':TRIGGER_ON_OFF_STATUS']); +h10 = getpv([cam_name ':TRIGGER_DELAY_MONITOR']); +h11 = getpv([cam_name ':FRAMERATE_STATUS']); +h12 = getpv([cam_name ':MODE_STATUS']); +h13 = getpv([cam_name ':SHUTTER_MONITOR']); +h14 = getpv([cam_name ':SHUTTER_MODE_STATUS']); +h15 = getpv([cam_name ':EXPOSURE_MONITOR']); +h16 = getpv([cam_name ':EXPOSURE_MODE_STATUS']); +h17 = getpv([cam_name ':GAIN_MONITOR']); +h18 = getpv([cam_name ':GAIN_MODE_STATUS']); +h19 = getpv([cam_name ':WOFFSET_MONITOR']); +h20 = getpv([cam_name ':HOFFSET_MONITOR']); +h21 = getpv([cam_name ':BRIGHTNESS_MONITOR']); +h22 = getpv([cam_name ':BRIGHTNESS_MODE_STATUS']); +%h23 = getpv([cam_name ':XP_MONITOR']); +%h24 = getpv([cam_name ':YP_MONITOR']); % get the PV through CA -height = mcaget(h1); -width = mcaget(h2); -iso_status = mcaget(h5); +height = (h1); +width = (h2); +iso_status = (h5); +% pre allocate memory +data = zeros(1,786432); if iso_status == 0 - mcaput(h5,1); - data = mcaget(h3); - mcaput(h5,0); + setpv([cam_name ':ISO_STATUS'],1); + data = h3; + setpv([cam_name ':ISO_STATUS'],0); else - data =mcaget(h3); + data =h3; end -euid = mcaget(h4); - -counter = mcaget(h6); -BPP = mcaget(h7); -trigger_mode = mcaget(h8); -trigger_on_off = mcaget(h9); -trigger_delay = mcaget(h10); -framerate_status = mcaget(h11); -mode1 = mcaget(h12); -shutter_monitor = mcaget(h13); -shutter_mode = mcaget(h14); -exposure_monitor = mcaget(h15); -exposure_mode = mcaget(h16); -gain_monitor = mcaget(h17); -gain_mode = mcaget(h18); -WOFFSET = mcaget(h19); -HOFFSET = mcaget(h20); -brightness_monitor = mcaget(h21); -brightness_mode = mcaget(h22); -% XP = mcaget(h23); -% YP = mcaget(h24); +euid = h4; + +counter = h6; +BPP = h7; +trigger_mode = h8; +trigger_on_off = h9; +trigger_delay = h10; +framerate_status = h11; +mode1 = h12; +shutter_monitor = h13; +shutter_mode = h14; +exposure_monitor = h15; +exposure_mode = h16; +gain_monitor = h17; +gain_mode = h18; +WOFFSET = h19; +HOFFSET = h20; +brightness_monitor = h21; +brightness_mode = h22; +% XP = h23; +% YP = h24; @@ -87,38 +92,13 @@ if plotimage % intensity of RGB high - figure(666); + figure(61); % imagesc(x); imagesc(x'); colormap gray; end -% close CA -mcaclose(h1) -mcaclose(h2) -mcaclose(h3) -mcaclose(h4) -mcaclose(h5) -mcaclose(h6) -mcaclose(h7) -mcaclose(h8) -mcaclose(h9) -mcaclose(h10) -mcaclose(h11) -mcaclose(h12) -mcaclose(h13) -mcaclose(h14) -mcaclose(h15) -mcaclose(h16) -mcaclose(h17) -mcaclose(h18) -mcaclose(h19) -mcaclose(h20) -mcaclose(h21) -mcaclose(h22) -% mcaclose(h23) -% mcaclose(h24) @@ -162,4 +142,4 @@ % fprintf('***** Don''t believe everything you read. NaN. *****\n'); %end -disp('snap finished') +% disp('snap finished') diff --git a/machine/ASP/StorageRing/srcycle.m b/machine/ASP/StorageRing/srcycle.m deleted file mode 100644 index ec64613d..00000000 --- a/machine/ASP/StorageRing/srcycle.m +++ /dev/null @@ -1,271 +0,0 @@ -function srcycle(LatticeFile, DisplayFlag) -%SRCYCLE - Standardize the storage ring magnets to the golden lattice -% -% INPUTS -% 1. LatticeFile - No input - cycle to the present lattice {Default} -% 'Golden' - cycle to the golden lattice -% LatticeFilename - cycle to the ConfigSetpoint in that file -% 2. 'Display' or 'NoDisplay' - to varify before standardizing and display results (or not) -% -% Written by Greg Portmann - - -disp('!!! Do not use yet !!!'); - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Input parsing and checking % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -LatticeFileDefault = 'Present'; % was 'Golden'; -if nargin < 1 - LatticeFile = LatticeFileDefault; -end -if nargin < 2 - DisplayFlag = 'Display'; -end -if strcmpi(LatticeFile, 'Display') | strcmpi(LatticeFile, 'NoDisplay') - DisplayFlag = LatticeFile; - LatticeFile = LatticeFileDefault; -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get the proper lattice % -%%%%%%%%%%%%%%%%%%%%%%%%%% -if isempty(LatticeFile) - [FileName, DirectoryName, FilterIndex] = uigetfile('*.mat', 'Select a Machine Configuration File for Standardization', getfamilydata('Directory', 'DataRoot')); - if FilterIndex == 0 - if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization cancelled\n'); - end - return - end - try - load([DirectoryName FileName]); - Lattice = ConfigSetpoint; - catch - error(sprintf('Problem getting data from machine configuration file\n%s',lasterr)); - end - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the lattice file %s\n', [DirectoryName FileName]); - end -elseif strcmpi(LatticeFile, 'Present') - % Present lattice - Lattice = getmachineconfig; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the present lattice\n'); - end -elseif strcmpi(LatticeFile, 'Golden') - % Golden lattice - FileName = getfamilydata('OpsData', 'LatticeFile'); - DirectoryName = getfamilydata('Directory', 'OpsData'); - load([DirectoryName FileName]); - - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the golden lattice %s\n', [DirectoryName FileName]); - end -elseif ischar(LatticeFile) - load(LatticeFile); - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to lattice file %s\n', LatticeFile); - end -else - error('Not sure what lattice to cycle to!'); -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Query to begin measurement % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -if strcmpi(DisplayFlag, 'Display') - tmp = questdlg('Begin storage ring standardization?','SRCYCLE','Yes','No','No'); - if strcmpi(tmp,'No') - fprintf(' Lattice standardization cancelled\n'); - return - end -end - -% Number of cycles -N = 2; - -% Set everything to zero -% famlist = {'BEND','QFA','QFB','QDA','SFA','SDA','SFB','SDB'}; -% famlist = {'QDA','QFA','QFB'}; -famlist = {}; - -for i=1:length(famlist) - range = getfamilydata(famlist{i},'Setpoint','Range'); - - uppersetpoint.(famlist{i}) = Lattice.(famlist{i}); - uppersetpoint.(famlist{i}).Setpoint.Data = range(:,2); - - lowersetpoint.(famlist{i}) = Lattice.(famlist{i}); - lowersetpoint.(famlist{i}).Setpoint.Data(:) = range(:,1); - - nominal.(famlist{i}) = Lattice.(famlist{i}); -end - -% Different for BEND, need to set to upper limit and turn on and off -% the supply to cycle the magent. Will have to montior the readback to -% see if it has reached the maximum and if its turned completely off. - -% Dipole on off command handle -dipole_handle = mcaopen('SR00DPS01:OFF_ON_CMD'); - -% Nominal -dipole_nomsp = Lattice.BEND.Setpoint.Data(1,1); - -% Get dipole upper setpoint -temp = getfamilydata('BEND','Setpoint','Range',[1 1]); -dipole_uppersp = temp(2); - -try - % Turn off the dipole and check its off. - dipolewaitoff(dipole_handle); - - % Wait flag of -1 will wait for the ramp to complete. - for j=1:N - disp('Turning ON dipole'); - dipoleturnon(dipole_handle, dipole_uppersp); - if exist('lowersetpoint','var') - disp('Turning ON all other multipoles'); - setmachineconfig(lowersetpoint, -1); - end - pause(1); - - disp('Turning OFF dipole'); - dipolewaitoff(dipole_handle); - if exist('lowersetpoint','var') - disp('Turning OFF all other multipoles'); - setmachineconfig(uppersetpoint, -1); - end - pause(1); - end - - - % Make sure all the setpoints are there - dipoleturnon(dipole_handle, dipole_nomsp); - if exist('nominal','var') - setmachineconfig(nominal, -1); - end - -catch - disp(lasterr) - disp('Error'); - mcaclose(dipole_handle); - return -end - -mcaclose(dipole_handle); - -if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization complete\n'); -end - - - -function dipolewaitoff(dipole_handle) -% Two step process go to 50 amps first then wait before going to 0.1 amps. -DEBUG = 1; - -% Generate normalised curve with 101 points -% curve =[ 0.0000000 0.0004501 0.0009766 0.0015905 0.0023039 ... -% 0.0031305 0.0040851 0.0051840 0.0064449 0.0078871 ... -% 0.0095315 0.0114004 0.0135176 0.0159085 0.0185999 ... -% 0.0216197 0.0249973 0.0287631 0.0329482 0.0375843 ... -% 0.0427039 0.0483391 0.0545222 0.0612847 0.0686573 ... -% 0.0766694 0.0853485 0.0947203 0.1048077 0.1156307 ... -% 0.1272057 0.1395455 0.1526587 0.1665491 0.1812159 ... -% 0.1966530 0.2128489 0.2297867 0.2474438 0.2657919 ... -% 0.2847972 0.3044203 0.3246166 0.3453365 0.3665256 ... -% 0.3881254 0.4100734 0.4323042 0.4547493 0.4773384 ... -% 0.5000000 0.5226616 0.5452507 0.5676958 0.5899266 ... -% 0.6118746 0.6334744 0.6546635 0.6753834 0.6955797 ... -% 0.7152028 0.7342081 0.7525562 0.7702133 0.7871511 ... -% 0.8033470 0.8187841 0.8334509 0.8473413 0.8604545 ... -% 0.8727943 0.8843693 0.8951923 0.9052797 0.9146515 ... -% 0.9233306 0.9313427 0.9387153 0.9454778 0.9516609 ... -% 0.9572961 0.9624157 0.9670518 0.9712369 0.9750027 ... -% 0.9783803 0.9814001 0.9840915 0.9864824 0.9885996 ... -% 0.9904685 0.9921129 0.9935551 0.9948160 0.9959149 ... -% 0.9968695 0.9976961 0.9984095 0.9990234 0.9995499 1.0000000]; -x = 0:0.01:1; -curve = (erf(3*x-1.5)/max(abs(erf(3*x-1.5))) + 1)./2; -offcurve = curve(end:-1:1); - -% Current dipvalue -dipval = getam('BEND',[1,1]); -% Dipole PS tolerance -tol = 0.2; %getfamilydata('BEND','Setpoint','Tolerance',[1 1]); - -if DEBUG; saveval = []; end - -setvals = offcurve.*dipval; -j = 1; j_previous = 1; -for i=1:length(setvals) - setsp('BEND',setvals(i),[1,1]); - - % 10 Second limit - while abs(dipval - setvals(i)) > tol && j < j_previous + 20 - pause(0.5); - dipval = getam('BEND',[1,1]); - - if DEBUG; saveval(j) = dipval; end - - j = j + 1; -% if j > 21 && std(saveval(end-20)) < 0.0 -% if DEBUG; figure; plot(saveval); end; -% error('Dipole didn'' seem to reach desired current!'); -% end - end - j_previous = j; -end -% Additional wait of 2 seconds to wait till current regulates to final -% value. -pause(2); - -if DEBUG; figure; plot(saveval); end; - - - -function dipoleturnon(dipole_handle, val) -DEBUG = 1; - -x = 0:0.01:1; -curve = (erf(3*x-1.5)/max(abs(erf(3*x-1.5))) + 1)./2; - -tol = 0.3; %getfamilydata('BEND','Setpoint','Tolerance',[1,1]); -dipval = getam('BEND',[1,1]); - -if DEBUG; saveval = []; end - -setvals = curve.*val; -temp = find(setvals > dipval); -starti = (1); - - -j = 1; j_previous = 1; -for i=starti:length(setvals) - setsp('BEND',setvals(i),[1,1]); - - while abs(dipval - setvals(i)) > tol && j < j_previous+20 - pause(0.5); - dipval = getam('BEND',[1,1]); - - if DEBUG; saveval(j) = dipval; end - - j = j + 1; -% if j > 20 && std(saveval(end-20)) < 0.0 -% if DEBUG; figure; plot(saveval); end; -% error('Dipole didn'' seem to reach desired current!'); -% end - end - j_previous = j; -end -% Additional wait of 2 seconds to wait till current regulates to final -% value. -pause(2); - -if DEBUG; figure; plot(saveval); end; \ No newline at end of file diff --git a/machine/ASP/StorageRing/srcycle_qda.m b/machine/ASP/StorageRing/srcycle_qda.m deleted file mode 100644 index 06fbe446..00000000 --- a/machine/ASP/StorageRing/srcycle_qda.m +++ /dev/null @@ -1,145 +0,0 @@ -function srcycle(LatticeFile, DisplayFlag) -%SRCYCLE - Standardize the storage ring magnets to the golden lattice -% -% INPUTS -% 1. LatticeFile - No input - cycle to the present lattice {Default} -% 'Golden' - cycle to the golden lattice -% LatticeFilename - cycle to the ConfigSetpoint in that file -% 2. 'Display' or 'NoDisplay' - to varify before standardizing and display results (or not) -% -% Written by Greg Portmann - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Input parsing and checking % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -LatticeFileDefault = 'Present'; % was 'Golden'; -if nargin < 1 - LatticeFile = LatticeFileDefault; -end -if nargin < 2 - DisplayFlag = 'Display'; -end -if strcmpi(LatticeFile, 'Display') | strcmpi(LatticeFile, 'NoDisplay') - DisplayFlag = LatticeFile; - LatticeFile = LatticeFileDefault; -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get the proper lattice % -%%%%%%%%%%%%%%%%%%%%%%%%%% -if isempty(LatticeFile) - [FileName, DirectoryName, FilterIndex] = uigetfile('*.mat', 'Select a Machine Configuration File for Standardization', getfamilydata('Directory', 'DataRoot')); - if FilterIndex == 0 - if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization cancelled\n'); - end - return - end - try - load([DirectoryName FileName]); - Lattice = ConfigSetpoint; - catch - error(sprintf('Problem getting data from machine configuration file\n%s',lasterr)); - end - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the lattice file %s\n', [DirectoryName FileName]); - end -elseif strcmpi(LatticeFile, 'Present') - % Present lattice - Lattice = getmachineconfig; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the present lattice\n'); - end -elseif strcmpi(LatticeFile, 'Golden') - % Golden lattice - FileName = getfamilydata('OpsData', 'LatticeFile'); - DirectoryName = getfamilydata('Directory', 'OpsData'); - load([DirectoryName FileName]); - - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the golden lattice %s\n', [DirectoryName FileName]); - end -elseif ischar(LatticeFile) - load(LatticeFile); - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to lattice file %s\n', LatticeFile); - end -else - error('Not sure what lattice to cycle to!'); -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Query to begin measurement % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -if strcmpi(DisplayFlag, 'Display') - tmp = questdlg('Begin storage ring standardization?','SRCYCLE','Yes','No','No'); - if strcmpi(tmp,'No') - fprintf(' Lattice standardization cancelled\n'); - return - end -end - -% Number of cycles -N = 1; - -% Set everything to zero -% famlist = {'BEND','QFA','QFB','QDA','SFA','SDA','SFB','SDB'}; -% famlist = {'QDA','QFA','QFB'}; -famlist = {'QDA'}; - -for i=1:length(famlist) - range = getfamilydata(famlist{i},'Setpoint','Range'); - - uppersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch uppersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - uppersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,2),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - uppersetpoint.(famlist{i}).Setpoint.Data = range(:,2); - end - - lowersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch lowersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - lowersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,1),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - lowersetpoint.(famlist{i}).Setpoint.Data = range(:,1); - end - - nominal.(famlist{i}) = Lattice.(famlist{i}); -end - -try - % Wait flag of -1 will wait for the ramp to complete. - for j=1:N - if exist('lowersetpoint','var') - disp('Turning ON all other multipoles'); - setmachineconfig(lowersetpoint, -1); - end - pause(10); - - if exist('lowersetpoint','var') - disp('Turning OFF all other multipoles'); - setmachineconfig(uppersetpoint, -1); - end - pause(20); - end - - if exist('nominal','var') - setmachineconfig(nominal, -1); - end - -catch - disp(lasterr) - disp('Error'); - return -end - -if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization complete\n'); -end \ No newline at end of file diff --git a/machine/ASP/StorageRing/srcycle_qfa.m b/machine/ASP/StorageRing/srcycle_qfa.m deleted file mode 100644 index d6dd74ed..00000000 --- a/machine/ASP/StorageRing/srcycle_qfa.m +++ /dev/null @@ -1,145 +0,0 @@ -function srcycle(LatticeFile, DisplayFlag) -%SRCYCLE - Standardize the storage ring magnets to the golden lattice -% -% INPUTS -% 1. LatticeFile - No input - cycle to the present lattice {Default} -% 'Golden' - cycle to the golden lattice -% LatticeFilename - cycle to the ConfigSetpoint in that file -% 2. 'Display' or 'NoDisplay' - to varify before standardizing and display results (or not) -% -% Written by Greg Portmann - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Input parsing and checking % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -LatticeFileDefault = 'Present'; % was 'Golden'; -if nargin < 1 - LatticeFile = LatticeFileDefault; -end -if nargin < 2 - DisplayFlag = 'Display'; -end -if strcmpi(LatticeFile, 'Display') | strcmpi(LatticeFile, 'NoDisplay') - DisplayFlag = LatticeFile; - LatticeFile = LatticeFileDefault; -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get the proper lattice % -%%%%%%%%%%%%%%%%%%%%%%%%%% -if isempty(LatticeFile) - [FileName, DirectoryName, FilterIndex] = uigetfile('*.mat', 'Select a Machine Configuration File for Standardization', getfamilydata('Directory', 'DataRoot')); - if FilterIndex == 0 - if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization cancelled\n'); - end - return - end - try - load([DirectoryName FileName]); - Lattice = ConfigSetpoint; - catch - error(sprintf('Problem getting data from machine configuration file\n%s',lasterr)); - end - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the lattice file %s\n', [DirectoryName FileName]); - end -elseif strcmpi(LatticeFile, 'Present') - % Present lattice - Lattice = getmachineconfig; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the present lattice\n'); - end -elseif strcmpi(LatticeFile, 'Golden') - % Golden lattice - FileName = getfamilydata('OpsData', 'LatticeFile'); - DirectoryName = getfamilydata('Directory', 'OpsData'); - load([DirectoryName FileName]); - - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the golden lattice %s\n', [DirectoryName FileName]); - end -elseif ischar(LatticeFile) - load(LatticeFile); - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to lattice file %s\n', LatticeFile); - end -else - error('Not sure what lattice to cycle to!'); -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Query to begin measurement % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -if strcmpi(DisplayFlag, 'Display') - tmp = questdlg('Begin storage ring standardization?','SRCYCLE','Yes','No','No'); - if strcmpi(tmp,'No') - fprintf(' Lattice standardization cancelled\n'); - return - end -end - -% Number of cycles -N = 1; - -% Set everything to zero -% famlist = {'BEND','QFA','QFB','QDA','SFA','SDA','SFB','SDB'}; -% famlist = {'QDA','QFA','QFB'}; -famlist = {'QFA'}; - -for i=1:length(famlist) - range = getfamilydata(famlist{i},'Setpoint','Range'); - - uppersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch uppersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - uppersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,2),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - uppersetpoint.(famlist{i}).Setpoint.Data = range(:,2); - end - - lowersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch lowersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - lowersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,1),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - lowersetpoint.(famlist{i}).Setpoint.Data = range(:,1); - end - - nominal.(famlist{i}) = Lattice.(famlist{i}); -end - -try - % Wait flag of -1 will wait for the ramp to complete. - for j=1:N - if exist('lowersetpoint','var') - disp('Turning ON all other multipoles'); - setmachineconfig(lowersetpoint, -1); - end - pause(10); - - if exist('lowersetpoint','var') - disp('Turning OFF all other multipoles'); - setmachineconfig(uppersetpoint, -1); - end - pause(20); - end - - if exist('nominal','var') - setmachineconfig(nominal, -1); - end - -catch - disp(lasterr) - disp('Error'); - return -end - -if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization complete\n'); -end \ No newline at end of file diff --git a/machine/ASP/StorageRing/srcycle_qfb.m b/machine/ASP/StorageRing/srcycle_qfb.m deleted file mode 100644 index 54e462d6..00000000 --- a/machine/ASP/StorageRing/srcycle_qfb.m +++ /dev/null @@ -1,145 +0,0 @@ -function srcycle(LatticeFile, DisplayFlag) -%SRCYCLE - Standardize the storage ring magnets to the golden lattice -% -% INPUTS -% 1. LatticeFile - No input - cycle to the present lattice {Default} -% 'Golden' - cycle to the golden lattice -% LatticeFilename - cycle to the ConfigSetpoint in that file -% 2. 'Display' or 'NoDisplay' - to varify before standardizing and display results (or not) -% -% Written by Greg Portmann - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Input parsing and checking % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -LatticeFileDefault = 'Present'; % was 'Golden'; -if nargin < 1 - LatticeFile = LatticeFileDefault; -end -if nargin < 2 - DisplayFlag = 'Display'; -end -if strcmpi(LatticeFile, 'Display') | strcmpi(LatticeFile, 'NoDisplay') - DisplayFlag = LatticeFile; - LatticeFile = LatticeFileDefault; -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get the proper lattice % -%%%%%%%%%%%%%%%%%%%%%%%%%% -if isempty(LatticeFile) - [FileName, DirectoryName, FilterIndex] = uigetfile('*.mat', 'Select a Machine Configuration File for Standardization', getfamilydata('Directory', 'DataRoot')); - if FilterIndex == 0 - if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization cancelled\n'); - end - return - end - try - load([DirectoryName FileName]); - Lattice = ConfigSetpoint; - catch - error(sprintf('Problem getting data from machine configuration file\n%s',lasterr)); - end - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the lattice file %s\n', [DirectoryName FileName]); - end -elseif strcmpi(LatticeFile, 'Present') - % Present lattice - Lattice = getmachineconfig; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the present lattice\n'); - end -elseif strcmpi(LatticeFile, 'Golden') - % Golden lattice - FileName = getfamilydata('OpsData', 'LatticeFile'); - DirectoryName = getfamilydata('Directory', 'OpsData'); - load([DirectoryName FileName]); - - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the golden lattice %s\n', [DirectoryName FileName]); - end -elseif ischar(LatticeFile) - load(LatticeFile); - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to lattice file %s\n', LatticeFile); - end -else - error('Not sure what lattice to cycle to!'); -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Query to begin measurement % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -if strcmpi(DisplayFlag, 'Display') - tmp = questdlg('Begin storage ring standardization?','SRCYCLE','Yes','No','No'); - if strcmpi(tmp,'No') - fprintf(' Lattice standardization cancelled\n'); - return - end -end - -% Number of cycles -N = 1; - -% Set everything to zero -% famlist = {'BEND','QFA','QFB','QDA','SFA','SDA','SFB','SDB'}; -% famlist = {'QDA','QFA','QFB'}; -famlist = {'QFB'}; - -for i=1:length(famlist) - range = getfamilydata(famlist{i},'Setpoint','Range'); - - uppersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch uppersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - uppersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,2),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - uppersetpoint.(famlist{i}).Setpoint.Data = range(:,2); - end - - lowersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch lowersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - lowersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,1),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - lowersetpoint.(famlist{i}).Setpoint.Data = range(:,1); - end - - nominal.(famlist{i}) = Lattice.(famlist{i}); -end - -try - % Wait flag of -1 will wait for the ramp to complete. - for j=1:N - if exist('lowersetpoint','var') - disp('Turning ON all other multipoles'); - setmachineconfig(lowersetpoint, -1); - end - pause(10); - - if exist('lowersetpoint','var') - disp('Turning OFF all other multipoles'); - setmachineconfig(uppersetpoint, -1); - end - pause(20); - end - - if exist('nominal','var') - setmachineconfig(nominal, -1); - end - -catch - disp(lasterr) - disp('Error'); - return -end - -if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization complete\n'); -end \ No newline at end of file diff --git a/machine/ASP/StorageRing/srcycle_quads.m b/machine/ASP/StorageRing/srcycle_quads.m deleted file mode 100644 index 0f186bee..00000000 --- a/machine/ASP/StorageRing/srcycle_quads.m +++ /dev/null @@ -1,211 +0,0 @@ -function srcycle(LatticeFile, DisplayFlag) -%SRCYCLE - Standardize the storage ring magnets to the golden lattice -% -% INPUTS -% 1. LatticeFile - No input - cycle to the present lattice {Default} -% 'Golden' - cycle to the golden lattice -% LatticeFilename - cycle to the ConfigSetpoint in that file -% 2. 'Display' or 'NoDisplay' - to varify before standardizing and display results (or not) -% -% Written by Greg Portmann - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Input parsing and checking % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -LatticeFileDefault = 'Present'; % was 'Golden'; -if nargin < 1 - LatticeFile = LatticeFileDefault; -end -if nargin < 2 - DisplayFlag = 'Display'; -end -if strcmpi(LatticeFile, 'Display') | strcmpi(LatticeFile, 'NoDisplay') - DisplayFlag = LatticeFile; - LatticeFile = LatticeFileDefault; -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%% -% Get the proper lattice % -%%%%%%%%%%%%%%%%%%%%%%%%%% -if isempty(LatticeFile) - [FileName, DirectoryName, FilterIndex] = uigetfile('*.mat', 'Select a Machine Configuration File for Standardization', getfamilydata('Directory', 'DataRoot')); - if FilterIndex == 0 - if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization cancelled\n'); - end - return - end - try - load([DirectoryName FileName]); - Lattice = ConfigSetpoint; - catch - error(sprintf('Problem getting data from machine configuration file\n%s',lasterr)); - end - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the lattice file %s\n', [DirectoryName FileName]); - end -elseif strcmpi(LatticeFile, 'Present') - % Present lattice - Lattice = getmachineconfig; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the present lattice\n'); - end -elseif strcmpi(LatticeFile, 'Golden') - % Golden lattice - FileName = getfamilydata('OpsData', 'LatticeFile'); - DirectoryName = getfamilydata('Directory', 'OpsData'); - load([DirectoryName FileName]); - - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to the golden lattice %s\n', [DirectoryName FileName]); - end -elseif ischar(LatticeFile) - load(LatticeFile); - Lattice = ConfigSetpoint; - if strcmpi(DisplayFlag, 'Display') - fprintf(' Standardizing to lattice file %s\n', LatticeFile); - end -else - error('Not sure what lattice to cycle to!'); -end - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Query to begin measurement % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -if strcmpi(DisplayFlag, 'Display') - tmp = questdlg('Begin storage ring standardization?','SRCYCLE','Yes','No','No'); - if strcmpi(tmp,'No') - fprintf(' Lattice standardization cancelled\n'); - return - end -end - -% Number of cycles -N = 2; - -% Set everything to zero -% famlist = {'BEND','QFA','QFB','QDA','SFA','SDA','SFB','SDB'}; -% famlist = {'QDA','QFA','QFB'}; -famlist = {'QDA','QFA', 'QFB','SFA','SDA','SFB','SDB'}; - -for i=1:length(famlist) - range = getfamilydata(famlist{i},'Setpoint','Range',getlist(famlist{i})); - - uppersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch uppersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - uppersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,2),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - uppersetpoint.(famlist{i}).Setpoint.Data = range(:,2); - end - - lowersetpoint.(famlist{i}) = Lattice.(famlist{i}); - switch lowersetpoint.(famlist{i}).Setpoint.Units - case 'Physics' - lowersetpoint.(famlist{i}).Setpoint.Data = hw2physics(famlist{i},'Setpoint',range(:,1),uppersetpoint.(famlist{i}).Setpoint.DeviceList); - case 'Hardware' - lowersetpoint.(famlist{i}).Setpoint.Data = range(:,1); - end - - nominal.(famlist{i}) = Lattice.(famlist{i}); -end - -try - % Wait flag of -1 will wait for the ramp to complete. - for j=1:N - if exist('lowersetpoint','var') - disp('Setting lower setpoint'); - if local_setmachineconfig(lowersetpoint, 25) - % error occured - break; - end - end - pause(5); - - if exist('lowersetpoint','var') - disp('Setting upper setpoint'); - if local_setmachineconfig(uppersetpoint, 40) - % error occured - break; - end - end - pause(5); - end - - if exist('nominal','var') - disp('Setting NOMINAL'); - local_setmachineconfig(nominal, 5); - end - -catch - disp(lasterr) - disp('Error'); - return -end - -if strcmpi(DisplayFlag, 'Display') - fprintf(' Storage ring standardization complete\n'); -end - - - -function err = local_setmachineconfig(config, varargin) - -err = 0; -WaitFlag = 0; -Time = 10; % Default of 10 seconds to achieve goal -N = 2; - -if nargin > 1 - Time = varargin{1}; -end - -if nargin > 2 - WaitFlag = varargin{2}; -end - - -families = fieldnames(config)'; - -for i=1:length(families) - units = config.(families{i}).Setpoint.Units; - - % getcurrent values Assuming setpoint available - if isfield(config.(families{i}),'Setpoint') - devicelists{1,i} = config.(families{i}).Setpoint.DeviceList; - - curr = getpv(config.(families{i}).Setpoint); - delta = config.(families{i}).Setpoint.Data - curr.Data; - for j=1:N - data(j).newvals{1,i} = curr.Data + delta.*(j/N); - end - else - fprintf('Warning: No setpoint field found for family %s\n',families{i}); - return; - end -end - -for j=1:N - try - setpv(families,'Setpoint',data(j).newvals,devicelists,units,-1); - catch - disp(lasterr); - disp('Will try again...'); - try - % Wait some time before trying again. - pause(10); - setpv(families,'Setpoint',data(j).newvals,devicelists,units,-1); - disp('... successful second attempt'); - catch - disp(lasterr); - disp('Still did not work... maybe something wrong. Will put setpoints back to initial values.'); - err = 1; - end - end -end - -pause(0); \ No newline at end of file diff --git a/machine/ASP/StorageRing/storagering_inject_store.m b/machine/ASP/StorageRing/storagering_inject_store.m index 0ea1657f..c0097a7e 100644 --- a/machine/ASP/StorageRing/storagering_inject_store.m +++ b/machine/ASP/StorageRing/storagering_inject_store.m @@ -1,12 +1,15 @@ % A simple method to set the sextupoles in the storage ring for injecting % or storing beam. To inject select "i" and to store select "s". Easy. - +% Update: just press 'y' and 'y' to change state +disp('THIS IS NO LONGER NECESSARY') +return; disp(' '); disp('You are about to Change Sextupoles for Storing or Injecting.'); disp('ARE YOU SURE THAT YOU WANT TO CONTINUE?? '); answer = input('[y/n]: ','s'); +answer = 'n'; if ~strcmp(answer,'y') error('... , goodbye.'); return diff --git a/machine/ASP/StorageRing/track_tunes.m b/machine/ASP/StorageRing/track_tunes.m index 0cc96310..3d8d5c38 100644 --- a/machine/ASP/StorageRing/track_tunes.m +++ b/machine/ASP/StorageRing/track_tunes.m @@ -1,9 +1,24 @@ function track_tunes(current_tunes,fixtunes2,varargin) - +% track_tunes([curr_tunes curr_disp],[want_tunes want_disp],[calc_J,'increment']) +% +% Example: track_tunes([0.31 0.24 0.1],[0.290 0.216 0.1]) +% track_tunes([0.31 0.24 0.1],[0.290 0.216 0.1],1,'increment'); +% +% The value calc_J asks track_tunes to calculate the jacobian from the +% loaded model. Default is to calculate. + +calc_from_model = 1; increment = 0; -if nargin > 2 && ischar(varargin{1}) && strcmpi(varargin{1},'increment') +if nargin > 3 && ischar(varargin{2}) && strcmpi(varargin{2},'increment') increment = 1; end +if nargin > 2 && isnumeric(varargin{1}) + calc_from_model = varargin{1}; +end + +if length(current_tunes) ~= 3 && length(fixtunes2) ~= 3 + error('TRACK_TUNES requires 3 values [xtune ytune disp]'); +end % xtune_pv = 'CR01:GENERAL_ANALOG_02_MONITOR'; % xtune_handle = mcacheckopen(xtune_pv); @@ -21,26 +36,117 @@ function track_tunes(current_tunes,fixtunes2,varargin) % current_tunes = [mcaget(xtune_handle) mcaget(ytune_handle) 0]; % current_tunes = [0.2913 0.2145 0.00]; % current_tunes = [getam('TUNE')' 0]; -delta_nu = fixtunes2 - current_tunes; -delta_nu(3) = 0; +delta_nu = fixtunes2(1:2) - current_tunes(1:2); +delta_nu(3) = fixtunes2(3) - current_tunes(3); % fprintf('\n Current fractional tunes are: [%6.3f %6.3f] dispersion = %6.7f\n', current_tunes); % fprintf(' Delta fractional tunes are: [%6.3f %6.3f] dispersion = %6.7f\n', delta_nu); -% Inverse Jacobian measured using the model. -Jinv = [... - 0.130094898781898,0.000379003570963,0.100529311940219;... - -0.105532343683691,-0.139777190998969,-0.004112213885454;... - 0.022078330803986,0.029242080859334,-0.054916466546098;]; - -% Order QFA QDA QFB -initk = [1.7619022 -1.0859714 1.5444376]'; +if calc_from_model + global THERING; + delta = 1e-6; + quadfam1 = 'QFA'; + quadfam2 = 'QDA'; + quadfam3 = 'QFB'; + % Fit the model + fittunedisp2(current_tunes+[13 5 0],'QFA','QDA','QFB',1) + + % find indexes of the 2 quadrupole families use for fitting + Q1I = findcells(THERING,'FamName',quadfam1); + if isempty(Q1I); fprintf('Cannot find quadfamily: %s\n',quadfam1); return; end; + Q2I = findcells(THERING,'FamName',quadfam2); + if isempty(Q2I); fprintf('Cannot find quadfamily: %s\n',quadfam2); return; end; + Q3I = findcells(THERING,'FamName',quadfam3); + if isempty(Q3I); fprintf('Cannot find quadfamily: %s\n',quadfam3); return; end; + + + InitialK1 = getcellstruct(THERING,'K',Q1I); + InitialK2 = getcellstruct(THERING,'K',Q2I); + InitialK3 = getcellstruct(THERING,'K',Q3I); + InitialPolB1 = getcellstruct(THERING,'PolynomB',Q1I,2); + InitialPolB2 = getcellstruct(THERING,'PolynomB',Q2I,2); + InitialPolB3 = getcellstruct(THERING,'PolynomB',Q3I,2); + + % Compute initial tunes before fitting + % [ LD, InitialTunes] = linopt(THERING,0); + mach = machine_at; + TempTunes = [mach.nux(end);mach.nuy(end)]; + TempDisp = mach.etax(1); + TempK1 = InitialK1; + TempK2 = InitialK2; + TempK3 = InitialK3; + TempPolB1 = InitialPolB1; + TempPolB2 = InitialPolB2; + TempPolB3 = InitialPolB3; + + disp('Calculating Jacobian from current model'); + fprintf('Tunes and Dispersion: %14.10f (H) %14.10f (V) %14.10f (D)\n',... + TempTunes(1),TempTunes(2),TempDisp); + + % Take Derivative + THERING = setcellstruct(THERING,'K',Q1I,TempK1+delta); + THERING = setcellstruct(THERING,'PolynomB',Q1I,TempPolB1+delta,2); + mach = machine_at; + Tunes_dK1 = [mach.nux(end);mach.nuy(end)]; + Disp_dK1 = mach.etax(1); + THERING = setcellstruct(THERING,'K',Q1I,TempK1); + THERING = setcellstruct(THERING,'PolynomB',Q1I,TempPolB1,2); + + THERING = setcellstruct(THERING,'K',Q2I,TempK2+delta); + THERING = setcellstruct(THERING,'PolynomB',Q2I,TempPolB2+delta,2); + mach = machine_at; + Tunes_dK2 = [mach.nux(end);mach.nuy(end)]; + Disp_dK2 = mach.etax(1); + THERING = setcellstruct(THERING,'K',Q2I,TempK2); + THERING = setcellstruct(THERING,'PolynomB',Q2I,TempPolB2,2); + + THERING = setcellstruct(THERING,'K',Q3I,TempK3+delta); + THERING = setcellstruct(THERING,'PolynomB',Q3I,TempPolB3+delta,2); + mach = machine_at; + Tunes_dK3 = [mach.nux(end);mach.nuy(end)]; + Disp_dK3 = mach.etax(1); + THERING = setcellstruct(THERING,'K',Q3I,TempK3); + THERING = setcellstruct(THERING,'PolynomB',Q3I,TempPolB3,2); + + + %Construct the Jacobian + change_dK = zeros(3); + tempTunesDisp = zeros(3); + + change_dK(:,1) = [Tunes_dK1(1); Tunes_dK1(2); Disp_dK1]; + change_dK(:,2) = [Tunes_dK2(1); Tunes_dK2(2); Disp_dK2]; + change_dK(:,3) = [Tunes_dK3(1); Tunes_dK3(2); Disp_dK3]; + tempTunesDisp(:,1) = [TempTunes(1); TempTunes(2); TempDisp]; + tempTunesDisp(:,2) = [TempTunes(1); TempTunes(2); TempDisp]; + tempTunesDisp(:,3) = [TempTunes(1); TempTunes(2); TempDisp]; + + + J = (change_dK - tempTunesDisp)/delta; + Jinv = inv(J); + initk = [InitialK1(1) InitialK2(1) InitialK3(1)]'; +else + % Inverse Jacobian measured using the model. + Jinv = [... + 0.130094898781898,0.000379003570963,0.100529311940219;... + -0.105532343683691,-0.139777190998969,-0.004112213885454;... + 0.022078330803986,0.029242080859334,-0.054916466546098;]; + % Order QFA QDA QFB + initk = [1.7619022 -1.0859714 1.5444376]'; + + % -0.75 dispersion (9ps) + % Jinv = [... + % 0.220177508545285 0.000615853133914 0.062397330857094 + % -0.083404182378964 -0.148030962548666 0.002243208844560 + % -0.059742956049518 0.030032260554950 -0.041325062084519]; + % % % Order QFA QDA QFB + % initk = [1.701360482635349 -1.072306322947120 1.576013680632028]'; +end % Fit the tunes but don't change the dispersion, therefore the last element % is zero. deltak = Jinv*[delta_nu]'; -percentage_change = deltak./initk; +percentage_change = deltak./initk % Read current setpoints currentquads = []; @@ -55,8 +161,10 @@ function track_tunes(current_tunes,fixtunes2,varargin) if max(percentage_change) > 0.05 % If greater than 5% change then ask for confirmation - switch questdlg('Change in quads > 5%%. Are you sure?','Tune Tracking Question',... + switch questdlg('Change in quads > 5%%. Will force increment. Are you sure?','Tune Tracking Question',... 'Yes','No','Yes'); + case 'Yes' + increment = 1; case 'No' disp('No changes made. goodbye'); return @@ -73,7 +181,7 @@ function track_tunes(current_tunes,fixtunes2,varargin) setsp('QFA',currentquads(:,1) + deltacurrentquads(:,1)*(i/10),'Hardware'); setsp('QDA',currentquads(:,2) + deltacurrentquads(:,2)*(i/10),'Hardware'); setsp('QFB',currentquads(:,3) + deltacurrentquads(:,3)*(i/10),'Hardware'); - switch questdlg(sprintf('Continue with tracking tunes? Step %d/10',i),'Tune Tracking Question',... + switch questdlg(sprintf('Continue with tracking tunes? Applied %d/10',i),'Tune Tracking Question',... 'Continue','Backstep','Finished','Continue'); case 'Continue' i = i + 1; @@ -82,6 +190,8 @@ function track_tunes(current_tunes,fixtunes2,varargin) case 'Finished' finished = 1; end +% t = getliberatbt('DD1',[1 4]); +% getfftspectrum(t.tbtx(1,:),499671948/360/64); end else % switch questdlg('Apply new tunes?','Tune Tracking Question',... @@ -102,6 +212,8 @@ function track_tunes(current_tunes,fixtunes2,varargin) setsp('QDA',currentquads(:,2) + deltacurrentquads(:,2),'Hardware'); setsp('QFB',currentquads(:,3) + deltacurrentquads(:,3),'Hardware'); end +fprintf('(%s): Tunes adjusted\n',datestr(now)); + % otherwise % disp('Not applying changes. Goodbye'); % end diff --git a/machine/ASP/StorageRing/track_tunes_modified.m b/machine/ASP/StorageRing/track_tunes_modified.m new file mode 100644 index 00000000..c2f1fce2 --- /dev/null +++ b/machine/ASP/StorageRing/track_tunes_modified.m @@ -0,0 +1,240 @@ +function track_tunes_modified(current_tunes,fixtunes2,varargin) +%%%%%%%%%%%%%%% This file has been modified for headless run by +%%%%%%%%%%%%%%% Paul Bennetto. It no longer prompts for a 5% change +%%%%%%%%%%%%%%% in quads, instead it throws an error. +% track_tunes([curr_tunes curr_disp],[want_tunes want_disp],[calc_J,'increment']) +% +% Example: track_tunes([0.31 0.24 0.1],[0.290 0.216 0.1]) +% track_tunes([0.31 0.24 0.1],[0.290 0.216 0.1],1,'increment'); +% +% The value calc_J asks track_tunes to calculate the jacobian from the +% loaded model. Default is to calculate. + +calc_from_model = 1; +increment = 0; +if nargin > 3 && ischar(varargin{2}) && strcmpi(varargin{2},'increment') + increment = 1; +end +if nargin > 2 && isnumeric(varargin{1}) + calc_from_model = varargin{1}; +end + +if length(current_tunes) ~= 3 && length(fixtunes2) ~= 3 + error('TRACK_TUNES requires 3 values [xtune ytune disp]'); +end + +% xtune_pv = 'CR01:GENERAL_ANALOG_02_MONITOR'; +% xtune_handle = mcacheckopen(xtune_pv); +% ytune_pv = 'CR01:GENERAL_ANALOG_03_MONITOR'; +% ytune_handle = mcacheckopen(ytune_pv); +% if xtune_handle == 0 +% error('Cant open channel to xtune'); +% end +% if ytune_handle == 0 +% error('Cant open channel to xtune'); +% end + + +% fixtunes2 = [0.29 0.216 0]; +% current_tunes = [mcaget(xtune_handle) mcaget(ytune_handle) 0]; +% current_tunes = [0.2913 0.2145 0.00]; +% current_tunes = [getam('TUNE')' 0]; +delta_nu = fixtunes2(1:2) - current_tunes(1:2); +delta_nu(3) = fixtunes2(3) - current_tunes(3); + +% fprintf('\n Current fractional tunes are: [%6.3f %6.3f] dispersion = %6.7f\n', current_tunes); +% fprintf(' Delta fractional tunes are: [%6.3f %6.3f] dispersion = %6.7f\n', delta_nu); + +if calc_from_model + global THERING; + delta = 1e-6; + quadfam1 = 'QFA'; + quadfam2 = 'QDA'; + quadfam3 = 'QFB'; + % Fit the model + fittunedisp2(current_tunes+[13 5 0],'QFA','QDA','QFB',1) + + % find indexes of the 2 quadrupole families use for fitting + Q1I = findcells(THERING,'FamName',quadfam1); + if isempty(Q1I); fprintf('Cannot find quadfamily: %s\n',quadfam1); return; end; + Q2I = findcells(THERING,'FamName',quadfam2); + if isempty(Q2I); fprintf('Cannot find quadfamily: %s\n',quadfam2); return; end; + Q3I = findcells(THERING,'FamName',quadfam3); + if isempty(Q3I); fprintf('Cannot find quadfamily: %s\n',quadfam3); return; end; + + + InitialK1 = getcellstruct(THERING,'K',Q1I); + InitialK2 = getcellstruct(THERING,'K',Q2I); + InitialK3 = getcellstruct(THERING,'K',Q3I); + InitialPolB1 = getcellstruct(THERING,'PolynomB',Q1I,2); + InitialPolB2 = getcellstruct(THERING,'PolynomB',Q2I,2); + InitialPolB3 = getcellstruct(THERING,'PolynomB',Q3I,2); + + % Compute initial tunes before fitting + % [ LD, InitialTunes] = linopt(THERING,0); + mach = machine_at; + TempTunes = [mach.nux(end);mach.nuy(end)]; + TempDisp = mach.etax(1); + TempK1 = InitialK1; + TempK2 = InitialK2; + TempK3 = InitialK3; + TempPolB1 = InitialPolB1; + TempPolB2 = InitialPolB2; + TempPolB3 = InitialPolB3; + + disp('Calculating Jacobian from current model'); + fprintf('Tunes and Dispersion: %14.10f (H) %14.10f (V) %14.10f (D)\n',... + TempTunes(1),TempTunes(2),TempDisp); + + % Take Derivative + THERING = setcellstruct(THERING,'K',Q1I,TempK1+delta); + THERING = setcellstruct(THERING,'PolynomB',Q1I,TempPolB1+delta,2); + mach = machine_at; + Tunes_dK1 = [mach.nux(end);mach.nuy(end)]; + Disp_dK1 = mach.etax(1); + THERING = setcellstruct(THERING,'K',Q1I,TempK1); + THERING = setcellstruct(THERING,'PolynomB',Q1I,TempPolB1,2); + + THERING = setcellstruct(THERING,'K',Q2I,TempK2+delta); + THERING = setcellstruct(THERING,'PolynomB',Q2I,TempPolB2+delta,2); + mach = machine_at; + Tunes_dK2 = [mach.nux(end);mach.nuy(end)]; + Disp_dK2 = mach.etax(1); + THERING = setcellstruct(THERING,'K',Q2I,TempK2); + THERING = setcellstruct(THERING,'PolynomB',Q2I,TempPolB2,2); + + THERING = setcellstruct(THERING,'K',Q3I,TempK3+delta); + THERING = setcellstruct(THERING,'PolynomB',Q3I,TempPolB3+delta,2); + mach = machine_at; + Tunes_dK3 = [mach.nux(end);mach.nuy(end)]; + Disp_dK3 = mach.etax(1); + THERING = setcellstruct(THERING,'K',Q3I,TempK3); + THERING = setcellstruct(THERING,'PolynomB',Q3I,TempPolB3,2); + + + %Construct the Jacobian + change_dK = zeros(3); + tempTunesDisp = zeros(3); + + change_dK(:,1) = [Tunes_dK1(1); Tunes_dK1(2); Disp_dK1]; + change_dK(:,2) = [Tunes_dK2(1); Tunes_dK2(2); Disp_dK2]; + change_dK(:,3) = [Tunes_dK3(1); Tunes_dK3(2); Disp_dK3]; + tempTunesDisp(:,1) = [TempTunes(1); TempTunes(2); TempDisp]; + tempTunesDisp(:,2) = [TempTunes(1); TempTunes(2); TempDisp]; + tempTunesDisp(:,3) = [TempTunes(1); TempTunes(2); TempDisp]; + + + J = (change_dK - tempTunesDisp)/delta; + Jinv = inv(J); + initk = [InitialK1(1) InitialK2(1) InitialK3(1)]'; +else + % Inverse Jacobian measured using the model. + Jinv = [... + 0.130094898781898,0.000379003570963,0.100529311940219;... + -0.105532343683691,-0.139777190998969,-0.004112213885454;... + 0.022078330803986,0.029242080859334,-0.054916466546098;]; + % Order QFA QDA QFB + initk = [1.7619022 -1.0859714 1.5444376]'; + + % -0.75 dispersion (9ps) + % Jinv = [... + % 0.220177508545285 0.000615853133914 0.062397330857094 + % -0.083404182378964 -0.148030962548666 0.002243208844560 + % -0.059742956049518 0.030032260554950 -0.041325062084519]; + % % % Order QFA QDA QFB + % initk = [1.701360482635349 -1.072306322947120 1.576013680632028]'; +end + +% Fit the tunes but don't change the dispersion, therefore the last element +% is zero. +deltak = Jinv*[delta_nu]'; + +percentage_change = deltak./initk; + +% Read current setpoints +currentquads = []; +currentquads(:,1) = getsp('QFA','Hardware'); +currentquads(:,2) = getsp('QDA','Hardware'); +currentquads(:,3) = getsp('QFB','Hardware'); + +% Calculate percentage changes +deltacurrentquads(:,1) = percentage_change(1).*currentquads(:,1); +deltacurrentquads(:,2) = percentage_change(2).*currentquads(:,2); +deltacurrentquads(:,3) = percentage_change(3).*currentquads(:,3); + +if max(percentage_change) > 0.05 + % If greater than 5% break + error('Out by 5%'); + +end +% fprintf(' Change in currents are: %6.3f (QFA) %6.3f (QDA) %6.3f (QFB)\n',... +% deltacurrentquads(1,:)); + +if increment + % In 10 incremental steps + finished = 0; + i = 0; + while ~finished + setsp('QFA',currentquads(:,1) + deltacurrentquads(:,1)*(i/10),'Hardware'); + setsp('QDA',currentquads(:,2) + deltacurrentquads(:,2)*(i/10),'Hardware'); + setsp('QFB',currentquads(:,3) + deltacurrentquads(:,3)*(i/10),'Hardware'); + switch questdlg(sprintf('Continue with tracking tunes? Applied %d/10',i),'Tune Tracking Question',... + 'Continue','Backstep','Finished','Continue'); + case 'Continue' + i = i + 1; + case 'Backstep' + i = i - 1; + case 'Finished' + finished = 1; + end +% t = getliberatbt('DD1',[1 4]); +% getfftspectrum(t.tbtx(1,:),499671948/360/64); + end +else +% switch questdlg('Apply new tunes?','Tune Tracking Question',... +% 'Yes','No','No'); +% case 'Yes' +% Apply quad values completely +if max(percentage_change) > 0.05 + % Do in two steps + setsp('QFA',currentquads(:,1) + deltacurrentquads(:,1)*0.5,'Hardware'); + setsp('QDA',currentquads(:,2) + deltacurrentquads(:,2)*0.5,'Hardware'); + setsp('QFB',currentquads(:,3) + deltacurrentquads(:,3)*0.5,'Hardware'); + pause(1); + setsp('QFA',currentquads(:,1) + deltacurrentquads(:,1),'Hardware'); + setsp('QDA',currentquads(:,2) + deltacurrentquads(:,2),'Hardware'); + setsp('QFB',currentquads(:,3) + deltacurrentquads(:,3),'Hardware'); +else + setsp('QFA',currentquads(:,1) + deltacurrentquads(:,1),'Hardware'); + setsp('QDA',currentquads(:,2) + deltacurrentquads(:,2),'Hardware'); + setsp('QFB',currentquads(:,3) + deltacurrentquads(:,3),'Hardware'); +end +fprintf('(%s): Tunes adjusted\n',datestr(now)); + +% otherwise +% disp('Not applying changes. Goodbye'); +% end +end + +return + + + +% Some measurements taken on the 11/10/06 +mf = 1387.866895; +Initatunes = [407.4654 286.44708]./mf; +Finaltunes = [400.8038 289.77786]./mf; +% Delta Tune due to QFA +J(1:2,1) = ([492.95544 223.16226]-[325.3061 350.8421])./mf; +% Delta Dispersion due to QFA +J(3,1) = -0.003501+0.003327; + +% Delta Tune due to QDA +J(1:2,2) = ([384.14996 354.1729] - [425.2295 225.3827])./mf; +% Delta Dispersion due to QDA +J(3,2) = 0.01104+0.02191; + +% Delta Tune due to QFB +J(1:2,3) = ([548.800 190.400] - [277.7620 385.5622])./mf; +% Delta Dispersion due to QFB +J(3,3) = -0.1851-0.08853; diff --git a/machine/ASP/StorageRing/updateatindex.m b/machine/ASP/StorageRing/updateatindex.m index 45f909b8..ab910c29 100644 --- a/machine/ASP/StorageRing/updateatindex.m +++ b/machine/ASP/StorageRing/updateatindex.m @@ -1,114 +1,130 @@ -function updateatindex -%UPDATEATINDEX - Updates the AT indices in the MiddleLayer with the present AT lattice (THERING) - - -global THERING - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Append Accelerator Toolbox information % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% Since changes in the AT model could change the AT indexes, etc, -% It's best to regenerate all the model indices whenever a model is loaded - -% Sort by family first (findcells is linear and slow) -Indices = atindex(THERING); - -AO = getao; - -AOelements = fieldnames(AO); - -for aoElement = AOelements' - aoElement = aoElement{1}; - switch aoElement - case {'BPMx' 'FTx' 'FTsum'} - ATType = 'X'; - ATIndex = Indices.BPM(:); - case {'BPMy' 'FTy'} - ATType = 'Y'; - ATIndex = Indices.BPM(:); - case 'HCM' - ATType = 'HCM'; -% ATIndex = Indices.HCM(:);%union(Indices.SFA, Indices.SFB); - ATIndex = union(Indices.SFA, Indices.SFB); - case 'VCM' - ATType = 'VCM'; -% ATIndex = Indices.VCM(:);%union(Indices.SDA, Indices.SDB); - ATIndex = union(Indices.SDA, Indices.SDB); - case 'QFA' - ATType = 'QUAD'; - ATIndex = Indices.(aoElement)(:); - case 'QFB' - ATType = 'QUAD'; - ATIndex = Indices.(aoElement)(:); - case 'QDA' - ATType = 'QUAD'; - ATIndex = Indices.(aoElement)(:); - case 'SFA' - ATType = 'SEXT'; - ATIndex = Indices.(aoElement)(:); - case 'SFB' - ATType = 'SEXT'; - ATIndex = Indices.(aoElement)(:); - case 'SDA' - ATType = 'SEXT'; - ATIndex = Indices.(aoElement)(:); - case 'SDB' - ATType = 'SEXT'; - ATIndex = Indices.(aoElement)(:); - case 'RF' - ATType = 'RF'; - ATIndex = Indices.(aoElement)(:); - case 'SKQ' - ATType = 'SkewQuad'; - ATIndex = Indices.SDA(:); - case {'KICK' 'Kicker'} - ATType = 'Kicker'; - if isfield(Indices,'KICK') - ATIndex = Indices.(aoElement)([3 4 1 2]); - else - ATIndex = [Indices.KICK1 Indices.KICK2 Indices.KICK3 Indices.KICK4]; - end - case 'BEND' - if isfield(Indices,'BEND') - ATType = 'BEND'; - ATIndex = Indices.(aoElement)(:); - elseif isfield(Indices,'b_left01') - ATType = 'BEND'; - tempmat = []; - i=1; - while isfield(Indices,sprintf('b_left%02d',i)) - tempmat = [tempmat; Indices.(sprintf('b_left%02d',i))(:)]; - i = i + 1; - end - i=1; - while isfield(Indices,sprintf('b_centre%02d',i)) - tempmat = [tempmat; Indices.(sprintf('b_left%02d',i))(:)]; - i = i + 1; - end - i=1; - while isfield(Indices,sprintf('b_right%02d',i)) - tempmat = [tempmat; Indices.(sprintf('b_left%02d',i))(:)]; - i = i + 1; - end - ATIndex = tempmat(:); - end - otherwise - ATType = ''; - end - - if ~isempty(ATType) - AO.(aoElement).AT.ATType = ATType; - AO.(aoElement).AT.ATIndex = buildatindex(AO.(aoElement).FamilyName, ATIndex); - end -end - - -% SEPTUM -% AO.Septum.AT.ATType = 'Septum'; -% AO.Septum.AT.ATIndex = Indices.SEPTUM(:); -% AO.Septum.Position = s(AO.Septum.AT.ATIndex); - - -setao(AO); \ No newline at end of file +function updateatindex +%UPDATEATINDEX - Updates the AT indices in the MiddleLayer with the present AT lattice (THERING) + + +global THERING + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Append Accelerator Toolbox information % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Since changes in the AT model could change the AT indexes, etc, +% It's best to regenerate all the model indices whenever a model is loaded + +% Sort by family first (findcells is linear and slow) +Indices = atindex(THERING); + +AO = getao; + +AOelements = fieldnames(AO); + +for aoElement = AOelements' + aoElement = aoElement{1}; + switch aoElement + case {'BPMx' 'FTx' 'FTsum'} + ATType = 'X'; + ATIndex = [Indices.BPM(:); 1]; + case {'BPMy' 'FTy'} + ATType = 'Y'; + ATIndex = [Indices.BPM(:); 1]; + % test swap of the BPMs to see if its obvious eugene 29/08/2007 +% ttt = ATIndex(4); +% ATIndex(4) = ATIndex(3); +% ATIndex(3) = ttt; + case 'HCM' + ATType = 'HCM'; +% ATIndex = Indices.HCM(:);%union(Indices.SFA, Indices.SFB); + ATIndex = union(Indices.SFA, Indices.SFB); + case 'VCM' + ATType = 'VCM'; +% ATIndex = Indices.VCM(:);%union(Indices.SDA, Indices.SDB); + ATIndex = union(Indices.SDA, Indices.SDB); + case 'HFC' + ATType = 'HCM'; + ATIndex = union(Indices.SDA, Indices.SDB(1:2:end)); % Only the first SDB is wired in every arc as a HFC + case 'VFC' + ATType = 'VCM'; + ATIndex = union(Indices.SFA, Indices.SFB); + case 'QFA' + ATType = 'QUAD'; + ATIndex = Indices.(aoElement)(:); + case 'QFB' + ATType = 'QUAD'; + ATIndex = Indices.(aoElement)(:); + case 'QDA' + ATType = 'QUAD'; + ATIndex = Indices.(aoElement)(:); + case 'SFA' + ATType = 'SEXT'; + ATIndex = Indices.(aoElement)(:); + case 'SFB' + ATType = 'SEXT'; + ATIndex = Indices.(aoElement)(:); + case 'SDA' + ATType = 'SEXT'; + ATIndex = Indices.(aoElement)(:); + case 'SDB' + ATType = 'SEXT'; + ATIndex = Indices.(aoElement)(:); + case 'RF' + ATType = 'RF'; + if isfield(Indices,'RF') + ATIndex = Indices.(aoElement)(:); + else + ATIndex = []; + end + case 'SKQ' + ATType = 'SkewQuad'; + ATIndex = Indices.SDA(:); + case {'KICK' 'Kicker'} + ATType = 'Kicker'; + if isfield(Indices,'KICK') + ATIndex = Indices.(aoElement)([3 4 1 2]); + elseif isfield(Indices,'KICK1') + ATIndex = [Indices.KICK1 Indices.KICK2 Indices.KICK3 Indices.KICK4]; + else + ATIndex = []; + end + case 'BEND' + if isfield(Indices,'BEND') + ATType = 'BEND'; + ATIndex = Indices.(aoElement)(:); + elseif isfield(Indices,'b_left01') + ATType = 'BEND'; + tempmat = []; + i=1; + while isfield(Indices,sprintf('b_left%02d',i)) + tempmat = [tempmat Indices.(sprintf('b_left%02d',i))(:)]; + i = i + 1; + end + i=1; + while isfield(Indices,sprintf('b_centre%02d',i)) + tempmat = [tempmat Indices.(sprintf('b_centre%02d',i))(:)]; + i = i + 1; + end + i=1; + while isfield(Indices,sprintf('b_right%02d',i)) + tempmat = [tempmat Indices.(sprintf('b_right%02d',i))(:)]; + i = i + 1; + end + ATIndex = tempmat'; + end + otherwise + ATType = ''; + end + + if ~isempty(ATType) && ~isempty(ATIndex) + AO.(aoElement).AT.ATType = ATType; + AO.(aoElement).AT.ATIndex = buildatindex(AO.(aoElement).FamilyName, ATIndex); + end +end + + +% SEPTUM +% AO.Septum.AT.ATType = 'Septum'; +% AO.Septum.AT.ATIndex = Indices.SEPTUM(:); +% AO.Septum.Position = s(AO.Septum.AT.ATIndex); + + +setao(AO); diff --git a/mml/gotoat.m b/mml/gotoat.m index 738f805b..f00768d4 100644 --- a/mml/gotoat.m +++ b/mml/gotoat.m @@ -12,6 +12,7 @@ ATPATHDirectory = ''; ATVersion = []; +ATVersionDefault = 1.4; while length(varargin) > 0 if isstruct(varargin{1}) || iscell(varargin{1}) @@ -36,10 +37,10 @@ if ismac || ispc % Not linking properly on Linux yet!!! ATVersion = 2.0; else - ATVersion = 1.3; + ATVersion = ATVersionDefault; end else - ATVersion = 1.3; + ATVersion = ATVersionDefault; end end diff --git a/mml/setpathasp.m b/mml/setpathasp.m index 7e8bab82..44bc9197 100644 --- a/mml/setpathasp.m +++ b/mml/setpathasp.m @@ -44,11 +44,13 @@ if isempty(LinkFlag) if strncmp(computer,'PC',2) - LinkFlag = 'MCA_ASP'; - elseif isunix - LinkFlag = 'LABCA'; + LinkFlag = 'LabCA'; + elseif strncmp(computer,'GLNX86',6) + LinkFlag = 'LabCA'; + elseif strncmp(computer,'GLNXA64',6) + LinkFlag = 'LabCA'; else - LinkFlag = 'LABCA'; + LinkFlag = 'LabCA'; end end @@ -77,7 +79,9 @@ if any(strcmpi(SubMachineName, {'Storage Ring','Ring'})) SubMachineName = 'StorageRing'; end - +if any(strcmpi(SubMachineName, {'Booster Ring','BoosterRing'})) + SubMachineName = 'BoosterRing'; +end if strcmpi(SubMachineName,'StorageRing') [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'StorageRing', 'StorageRing', LinkFlag); @@ -89,4 +93,4 @@ [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'BTS', 'Transport', LinkFlag); elseif strcmpi(SubMachineName,'Injector') [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'Injector', 'Booster', LinkFlag); -end +end \ No newline at end of file diff --git a/simulators/at1.4.1/atintegrators/mexpassmethod.m b/simulators/at1.4.1/atintegrators/mexpassmethod.m index a6574653..d5620442 100644 --- a/simulators/at1.4.1/atintegrators/mexpassmethod.m +++ b/simulators/at1.4.1/atintegrators/mexpassmethod.m @@ -53,7 +53,7 @@ function mexpassmethod(PASSMETHODS, varargin) ldf=regexprep(mex.getCompilerConfigurations('C').Details.LinkerFlags,['(' exportarg '\s?)([^\s,]+)'],['$1',fullfile(pdir,'%s')]); EXPORT=[' LDFLAGS=''',strrep(ldf,'$','\\$'),''' ']; else - EXPORT=[' LINKEXPORT=''',exportarg,fullfile(pdir,'%s'),''' ']; + EXPORT=[' LINKEXPORTVER=''',exportarg,fullfile(pdir,'%s'),''' ']; end end