Starting the Lucretia live model
To start the Lucretia Live Model you must be in /usr/local/facet/tools/matlabTNG. There is file in there called startup.m that sets all the paths you need to get the live model working.
[fphysics@facet-srv01 /usr/local/facet/tools/matlabTNG ]$ matlab2023a & [1] 1699426 [fphysics@facet-srv01 /usr/local/facet/tools/matlabTNG ]$ /usr/local/facet/package/matlab/2023a/bin/matlab -nosplash -desktop -logfile /u1/facet/matlab/log/MATLAB_2023a-boshea-2024-May-06_11:01:10-0700-facet-srv01-localhost:16.0.log MATLAB is selecting SOFTWARE OPENGL rendering.
Next you need to load the live model:
LM = F2_LiveModelApp % This can take a few minutes and will barf a lot of output. global BEAMLINE global PS [stat, rmat] = RmatAtoB(120,122) rmat = 0.9384 0.1058 0 0 0 0 -1.1298 0.9384 0 0 0 0 0 0 1.0629 0.1103 0 0 0 0 1.1777 1.0629 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000
This is the model for QUAD 525. You can see this by checking the BEAMLINE elements
>> BEAMLINE{120} ans = struct with fields: Name: 'QE10525' S: 11.4811 P: 0.1251 Class: 'QUAD' L: 0.0540 B: 0.5000 dB: 0 Tilt: 0 aper: 0.0160 PS: 27 Offset: [0 0 0 0 0 0] Girder: 0 TrackFlag: [1×1 struct] Type: '1.26q3.5' Coordi: [3.6120 0 1.0117e+03] Anglei: [-0.6109 0 0] Coordf: [3.5811 0 1.0117e+03] Anglef: [-0.6109 0 0] Slices: [120 122] Block: [120 122]
This tells you that the momentum in the quad is P = 0.1251 GeV, the length of this half of the quad is L = 0.0540 m, and the power supply that defines the strength of the quad is PS = 27.
Element 120 is the first half of the quad, 121 is the BPM in the quad, 122 is the second half of the quad.
The following Matlab code shows how to derive the quad parameters from the live model, the control system BDES and theory.
quadLength = 2 * BEAMLINE{120}.L; % in meters quadB = PS(BEAMLINE{120}.PS).Ampl; % in T quadMom = BEAMLINE{120}.P; % In GeV/c kLucretia = sqrt( (quadB/quadLength) * (0.2998 / quadMom)); quadBDES = lcaGet('QUAD:IN10:525:BDES'); kBDES = sqrt((quadBDES/0.108) * 0.02998 / 0.1251); MQFLucretia = [[cos(kLucretia * quadLength), (1/kLucretia)*sin(kLucretia * quadLength)]; [-kLucretia*sin(kLucretia * quadLength), cos(kLucretia * quadLength)]]; [stat, MQFLiveModel] = RmatAtoB(120,122); MQFBDES = [[cos(kLucretia * 0.108), (1/kBDES)*sin(kBDES * 0.108)]; [-kBDES*sin(kBDES * 0.108), cos(kBDES * 0.108)]]; MQFBDES MQFLucretia MQFLiveModel(1:2, 1:2) MQFBDES = 0.9383 0.1058 -1.1299 0.9383 MQFLucretia = 0.9383 0.1058 -1.1298 0.9383 ans = 0.9384 0.1058 -1.1298 0.9384
Mathematically the quad strengths are defined as:
In Brendan notation [thing] = blah, means "the units of thing are blah". BDES = B' * L, with B' in kG/m and L the length of the quad in meters. B = B' * L with B in T/m and L in meters. The control system uses kG and Lucretia uses T. For more details on control system, Lucretia and specific quantities see Lucretia Conventions for Quad Magnet Strength.