Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Light Source EPICS Meeting April 27, 2005 An Accelerator Control Middle Layer Using Matlab Greg Portmann, ALS/LBNL Jeff Corbett.

Similar presentations


Presentation on theme: "Advanced Light Source EPICS Meeting April 27, 2005 An Accelerator Control Middle Layer Using Matlab Greg Portmann, ALS/LBNL Jeff Corbett."— Presentation transcript:

1 Advanced Light Source EPICS Meeting April 27, 2005 An Accelerator Control Middle Layer Using Matlab Greg Portmann, ALS/LBNL (gjportmann@lbl.gov) Jeff Corbett and Andrei Terebilo, SSRL/SLAC James SaFranek (SSRL), Christoph Steier and Dave Robin (ALS)

2 Advanced Light Source EPICS Meeting April 27, 2005 Automating Physics Experiments (without becoming a software engineer) Goal m Develop an easy scripting method to experiment with accelerators (accelerator independent)  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.) m Integrate simulation and online control. Make working on an accelerator more like simulation codes. m Integrate data taking and data analysis tools m 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.

3 Advanced Light Source EPICS Meeting April 27, 2005 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 GUI capabilities m Platform Independents

4 Advanced Light Source EPICS Meeting April 27, 2005 Matlab Toolbox Suite for Accelerator Physics m MiddleLayer + 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, LabCA, SCAIII – Matlab to EPICS links m AT – Accelerator Toolbox for simulations m LOCO – Linear Optics from Closed Orbits (Calibration)

5 Advanced Light Source EPICS Meeting April 27, 2005 Software Interconnection Diagram High Level Matlab Applications (scripts and functions) Matlab to EPICS (MCA, LabCA, SCAIII) Matlab Middle Layer Accelerator Toolbox (AT) (Model) Channel Access to Accelerator Hardware AT Server (Simulator)

6 Advanced Light Source EPICS Meeting April 27, 2005 Basic Calling Syntax Naming Convention Family = Group descriptor (text string) Field = Subgroup descriptor(text string) DeviceList = [Sector Element-in-Sector] Basic Functions getpv(Family, Field, DeviceList); setpv(Family, Field, Value, DeviceList); steppv(Family, Field, Value, DeviceList); Examples: x = getpv('BPMx', 'Monitor', [3 4;5 2]); h = getpv('HCM', 'Setpoint', [2 1;12 4]); setpv('QF', 'Setpoint', 81);

7 Advanced Light Source EPICS Meeting April 27, 2005 Families Bend magnets – BEND Quadrupoles – QF, QD, QFA, QDA Sextupoles – SF, SD Skew quadrupoles - SQSF, SQSD Correctors – HCM, VCM, VCBSC Beam position monitors – BPMx and BPMy Insertion devices – ID, EPU Other - RF, DCCT, TUNE, GeV Fields Setpoint, Monitor, RampRate, RunFlag, DAC, OnOff, Reset, Ready, Voltage, Power, Velocity, HallProbe, etc… ALS Naming Scheme

8 Advanced Light Source EPICS Meeting April 27, 2005 Function Library There are hundreds of functions for accelerator control m setorbit – general purpose global orbit correction function m setorbitbump – general purpose local bump function m settune – sets the storage ring tune m setchro – sets the storage ring chromaticity m measchro – measure the chromaticity m measdisp – measure the dispersion function m quadcenter, quadplot – finds the quadrupole center m physcis2hw – converts between physics and hardware units m measbpmresp – measure a BPM response matrix m measlifetime – computes the beam lifetime m minpv/maxpv – min/max value for family/field m srcycle – standardizes the storage ring magnets m scantune – scan in tune space and record the lifetime m scanaperture – scans the electron beam in the straight sections and monitors lifetime m finddispquad – finds the setpoint that minimizes the dispersion in the straight sections. m rmdisp – adjusts the RF frequency to remove the dispersion component of the orbit by fitting the orbit to the dispersion orbit m etc

9 Advanced Light Source EPICS Meeting April 27, 2005 Data Management m Beam 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 matrices (Orbit, Tune, Chromaticity) m Lattices (Save and restore) m Measurement archiving  Dispersion, tunes, chromaticity, quadrupole centers, etc.

10 Advanced Light Source EPICS Meeting April 27, 2005 MiddleLayer Data Flow Diagram Accelerator Hardware AT Model Hardware Units (Usual Command Window Location) Calibrated Hardware Units Physics Units (Opt. Command Window Location) BPM and Corrector Coordinate Change raw2real real2raw hw2physics physics2hw getpvonline setpvonline getpvmodel setpvmodel BPM Gain (Units scaling) Correctors (amp2k, k2amp) Gain (amps to rad.) Energy Scaling Lattice Magnets (amp2k, k2amp) Gain (amp to K) Energy Scaling Hysteresis RealData = Gain*(RawData - Offset) BPM Gain (LOCO) Offset (BBA) Correctors Gain (LOCO) Lattice Magnets Gain (LOCO) BPM Roll, Crunch Correctors Roll Correction offset Lattice Magnets Correction offset All other known errors are already in the AT model. Data flow for getpv and setpv

11 Advanced Light Source EPICS Meeting April 27, 2005 High Level Applications m Magnet lattice save / restore / configuration control m Energy Ramping m Slow orbit feedback m Insertion device compensation m Quadrupole centering m Display (plotfamily) / Diagnostics m LOCO (Response matrix analysis)

12 Advanced Light Source EPICS Meeting April 27, 2005 plotfamily application

13 Advanced Light Source EPICS Meeting April 27, 2005 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'); % 120x70 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 DeltaAmps = -V(:,Ivec) * S(Ivec,Ivec)^-1 * U(:,Ivec)' * Y; % Changes the corrector strengths stepsp('VCM', DeltaAmps);

14 Advanced Light Source EPICS Meeting April 27, 2005 Chromaticity Measurement

15 Advanced Light Source EPICS Meeting April 27, 2005 Beam-based alignment

16 Advanced Light Source EPICS Meeting April 27, 2005 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 SPEAR3 Synchrotron Light Source.Accelerator Physics Group Stanford Synchrotron Radiation LaboratorySPEAR3 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

17 Advanced Light Source EPICS Meeting April 27, 2005 AT – Accelerator Toolbox

18 Advanced Light Source EPICS Meeting April 27, 2005 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

19 Advanced Light Source EPICS Meeting April 27, 2005 Conclusion m Relatively easy to use. Most people start writing useful scripts in a few hours. m MiddleLayer + LOCO + AT + MCA/LabCA/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 MiddleLayer 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.


Download ppt "Advanced Light Source EPICS Meeting April 27, 2005 An Accelerator Control Middle Layer Using Matlab Greg Portmann, ALS/LBNL Jeff Corbett."

Similar presentations


Ads by Google