Advanced Light Source An Accelerator Control Middle Layer



















- Slides: 19
Advanced Light Source An Accelerator Control Middle Layer Using Matlab Greg Portmann, ALS/LBNL (gjportmann@lbl. gov) Jeff Corbett and Andrei Terebilo, SSRL/SLAC James Sa. Franek (SSRL), Christoph Steier and Dave Robin (ALS) EPICS Meeting April 27, 2005
Advanced Light Source Goal Automating Physics Experiments (without becoming a software engineer) Develop an easy scripting method to experiment with accelerators (accelerator independent) m Ä Remove the control system details from the physicist (like channel names and how to connect to the computer control system) Ä Easy access to important data (offsets, gains, rolls, max/min, etc. ) Integrate simulation and online control. Make working on an accelerator more like simulation codes. m m Integrate data taking and data analysis tools Develop a software library of common tasks (orbit correction, tune correction, chromaticity, ID compensation, etc. ) m Develop a high level control applications to automate the setup and control of a storage ring. m EPICS Meeting April 27, 2005
Advanced Light Source Why Matlab m Matrix programming language (variables default to a double precision matrix) m Extensive built-in math libraries m Active workspace for experimentation and algorithms development m Easy of import/export of data m Graphics m Compact code and good readability m Adequate m Platform GUI capabilities Independents EPICS Meeting April 27, 2005
Advanced Light Source Matlab Toolbox Suite for Accelerator Physics m Middle. Layer + High Level Applications 1. Link between applications and control system or simulator. 2. Functions to access accelerator data. 3. Provide a physics function library. m MCA, m AT Lab. CA, SCAIII – Matlab to EPICS links – Accelerator Toolbox for simulations m LOCO – Linear Optics from Closed Orbits (Calibration) EPICS Meeting April 27, 2005
Advanced Light Source Software Interconnection Diagram High Level Matlab Applications (scripts and functions) Matlab Middle Layer Matlab to EPICS (MCA, Lab. CA, SCAIII) Accelerator Toolbox (AT) (Model) Channel Access to Accelerator Hardware AT Server (Simulator) EPICS Meeting April 27, 2005
Advanced Light Source Basic Calling Syntax Naming Convention Family = Group descriptor (text string) Field = Subgroup descriptor (text string) Device. List = [Sector Element-in-Sector] Basic Functions getpv(Family, Field, Device. List); setpv(Family, Field, Value, Device. List); steppv(Family, Field, Value, Device. List); Examples: x = getpv('BPMx', 'Monitor', [3 4; 5 2]); h = getpv('HCM', 'Setpoint', [2 1; 12 4]); setpv('QF', 'Setpoint', 81); EPICS Meeting April 27, 2005
ALS Naming Scheme Advanced Light Source Families Bend magnets – BEND Quadrupoles – QF, QD, QFA, QDA Sextupoles – SF, SD Skew quadrupoles - SQSF, SQSD Correctors – HCM, VCBSC Beam position monitors – BPMx and BPMy Insertion devices – ID, EPU Other - RF, DCCT, TUNE, Ge. V Fields Setpoint, Monitor, Ramp. Rate, Run. Flag, DAC, On. Off, Reset, Ready, Voltage, Power, Velocity, Hall. Probe, etc… EPICS Meeting April 27, 2005
Advanced Light Source Function Library There are hundreds of functions for accelerator control m m m m m setorbit – general purpose global orbit correction function setorbitbump – general purpose local bump function settune – sets the storage ring tune setchro – sets the storage ring chromaticity measchro – measure the chromaticity measdisp – measure the dispersion function quadcenter, quadplot – finds the quadrupole center physcis 2 hw – converts between physics and hardware units measbpmresp – measure a BPM response matrix measlifetime – computes the beam lifetime minpv/maxpv – min/max value for family/field srcycle – standardizes the storage ring magnets scantune – scan in tune space and record the lifetime scanaperture – scans the electron beam in the straight sections and monitors lifetime finddispquad – finds the setpoint that minimizes the dispersion in the straight sections. rmdisp – adjusts the RF frequency to remove the dispersion component of the orbit by fitting the orbit to the dispersion orbit etc EPICS Meeting April 27, 2005
Advanced Light Source m Beam Ä Data Management Position Monitors Channel names, gains, roll, crunch, offsets, golden, standard deviations m Magnets Ä Channel names, gains, offsets, roll, setpoint-monitor tolerance, amp-to-simulator conversions, hysteresis loops, max/min setpoint m Response m Lattices matrices (Orbit, Tune, Chromaticity) (Save and restore) m Measurement Ä archiving Dispersion, tunes, chromaticity, quadrupole centers, etc. EPICS Meeting April 27, 2005
Advanced Light Source Middle. Layer Data Flow Diagram Accelerator Hardware Data flow for getpv and setpv getpvonline setpvonline AT Model getpvmodel BPM and Corrector setpvmodel Coordinate Change hw 2 physics 2 hw Hardware Units (Usual Command Window Location) raw 2 real 2 raw Calibrated Hardware Units Real. Data = Gain*(Raw. Data - Offset) BPM • Gain (LOCO) • Offset (BBA) Correctors • Gain (LOCO) Lattice Magnets • Gain (LOCO) Physics Units (Opt. Command Window Location) BPM • Gain (Units scaling) BPM • Roll, Crunch Correctors (amp 2 k, k 2 amp) • Gain (amps to rad. ) • Energy Scaling Correctors • Roll • Correction offset Lattice Magnets (amp 2 k, k 2 amp) • Gain (amp to K) • Energy Scaling • Hysteresis EPICS Meeting April 27, 2005 Lattice Magnets • Correction offset • All other known errors are already in the AT model.
Advanced Light Source High Level Applications m Magnet lattice save / restore / configuration control m Energy m Slow Ramping orbit feedback m Insertion device compensation m Quadrupole m Display m LOCO centering (plotfamily) / Diagnostics (Response matrix analysis) EPICS Meeting April 27, 2005
Advanced Light Source plotfamily application EPICS Meeting April 27, 2005
Advanced Light Source Scripting Example: Orbit Correction % Create an Orbit Error vcm =. 5 * randn(70, 1); % 70 vertical correctors at the ALS setsp('VCM', vcm); % Get the vertical orbit Y = getam('BPMy'); % Get the Vertical response matrix from the model Ry = getrespmat('BPMy', 'VCM'); % 120 x 70 matrix % Computes the SVD of the response matrix Ivec = 1: 48; [U, S, V] = svd(Ry, 0); % Find the corrector changes use 48 singular values Delta. Amps = -V(: , Ivec) * S(Ivec, Ivec)^-1 * U(: , Ivec)' * Y; % Changes the corrector strengths stepsp('VCM', Delta. Amps); EPICS Meeting April 27, 2005
Advanced Light Source Chromaticity Measurement EPICS Meeting April 27, 2005
Advanced Light Source Beam-based alignment EPICS Meeting April 27, 2005
Advanced Light Source AT – Accelerator Toolbox Andrei Terebilo MATLAB ® Toolbox for Particle Accelerator Modeling Accelerator Toolbox is a collection of tools to model particle accelerators and beam transport lines in MATLAB environment. It is being developed by Accelerator Physics Group at Stanford Synchrotron Radiation Laboratory for the ongoing design and future operation needs of SPEAR 3 Synchrotron Light Source. What is Accelerator Toolbox New in AT version 1. 2 Download and Installation Get Started Collaboration Publications e-mail AT Links www-ssrl. slac. stanford. edu/at/welcome. html EPICS Meeting April 27, 2005
Advanced Light Source AT – Accelerator Toolbox EPICS Meeting April 27, 2005
Advanced Light Source LOCO Optics Analysis m Calibrate/control optics using orbit response matrix m Determine quadrupole gradients m Correcte coupling m Calibrate BPM gains, steering magnets m Measure local chromaticity and transverse impedance New MATLAB version of code • rewritten from FORTRAN • linked to control system • linked to AT simulator EPICS Meeting April 27, 2005
Advanced Light Source Conclusion m Relatively easy to use. Most people start writing useful scripts in a few hours. m Middle. Layer + LOCO + AT + MCA/Lab. CA/SCAIII cover many of the high level software concerns for storage rings. Hence, not every accelerator has to spend resources coding the same algorithms. m Thousands of dedicated accelerator hours have been spent testing, improving, debugging, and exercising the Middle Layer software. m It’s a good scripting language for machine shifts or it can be the high level setup and control software for a storage ring. m Integration of the AT model is good for debugging software without using accelerator time. m 6 light sources are active Middle. Layer users -- ALS, Spear, BNL (vuv and x-ray ring), CLS, and PLS. Australian light source, DIAMOND, Soleil, Desy, and ALBA are experimenting with it (maybe more). m The semi-machine independence software has fostered collaboration and code sharing between the laboratories. EPICS Meeting April 27, 2005