Download presentation
Presentation is loading. Please wait.
Published byCharla Heath Modified over 9 years ago
1
BROOKHAVEN SCIENCE ASSOCIATES High level applications and EPICS control GUOBAO SHEN NSLS-II, Control Group May 4 th, 2009
2
2 BROOKHAVEN SCIENCE ASSOCIATES Contents From device control to beam control HLA environments MMLT Python Model server
3
3 BROOKHAVEN SCIENCE ASSOCIATES From device control to beam control Goal Desired accelerator beam Accelerator device control Hardware subsystem control Magnet power supply, beam diagnostics,… Accelerator beam control Realized through device control
4
4 BROOKHAVEN SCIENCE ASSOCIATES Accelerator device control Displayer Controller Device Model Sensor Actuator Device From device control to beam control
5
5 BROOKHAVEN SCIENCE ASSOCIATES From device control to beam control Accelerator device control Distributed and modular architecture EPICS based device control Flexible, extensible, reusable, pluggable Channel Access Client (CAC) Connection Data Transfers Channel Access Protocol Connection Server Connection Data Transfers Channel Access Server (CAS) DB Engine Device Support Driver Support I/O Controller Types Connection Data Transfers Channel Access Server (CAS) DB Engine Device Support Driver Support I/O Controller Types
6
6 BROOKHAVEN SCIENCE ASSOCIATES Accelerator beam control Operator Interface High Level Applications Model based Control Beam Monitor Accelerator Device Beam From device control to beam control
7
7 BROOKHAVEN SCIENCE ASSOCIATES HLA environments What is a HLA environment? A software environment for beam commissioning & operation Physics applications, model based control Data archiving & analysis Machine status save & restore Machine real time status presentation Database related applications Available environments MMLT, SDDS, XAL, …
8
8 BROOKHAVEN SCIENCE ASSOCIATES HLA environments Desired features Scripting Online simulator Convenient low level access Channel Access supporting Plotting and Graphical User Interface Numerical libraries (Optional)
9
9 BROOKHAVEN SCIENCE ASSOCIATES HLA environments A modular environment proposed at NSLS-II Client-server model Loose coupling, Pluggable, Reusable EPICS based low level control system Distributed IOC Process Databases Channel Access Application / Family Middle Layer Client/Server Name Mapping Conversions DipoleQuadSext.Corr.BPMRF Orbit Differences Gradient Errs & Corrections Beam R. M. Diff’s Data Server Optics Deviations Optics Resp. Matrix (S) Model Server Physics Applications (Thin Client) EPICS Client/Server Physics Applications (Thick Client) Measured Orbit Lattice Installations RDB
10
10 BROOKHAVEN SCIENCE ASSOCIATES HLA environments Communication protocol oriented architecture Thick HLA Client Measured Orbit Orbit Differences Gradient Errs & Corrections Beam R. M. Diff’s Data Server Optics Deviations Thin HLA Client Modularized HLA Srv Model Server TracyElegant API Name Mapping Conversions Lattice Installations RDB EPICS based low level control system Distributed IOC Process Databases DipoleQuadSext.Corr.BPMRF EPICS Client/Server Communication Protocol
11
11 BROOKHAVEN SCIENCE ASSOCIATES MMLT Matlab based HLA environment MMLT: Matlab Middle Layer Toolkit High Level Matlab Applications (scripts and functions) Matlab to EPICS (MCA, LabCA, SCAIII) Matlab Middle Layer Accelerator Toolbox (AT) (Model) Accelerator Hardware AT Server (Simulator) Channel Access HLA
12
12 BROOKHAVEN SCIENCE ASSOCIATES MMLT MMLT is selected Closer to our modular architecture Rich available applications Used by many facilities for many years
13
13 BROOKHAVEN SCIENCE ASSOCIATES MMLT MMLT Enhancement Multi-simulators support
14
14 BROOKHAVEN SCIENCE ASSOCIATES MMLT MMLT Enhancement Directory structure ATTracyElegant NSLS2 MMLT ROOT ApplicationsEPICS CALinksMachineMML Tracy (*.so) Elegant(*.so)AT S.R.S.R.
15
15 BROOKHAVEN SCIENCE ASSOCIATES MMLT Command to select model % use at simulator by default setpathnsls2 % use tracy simulator setpathnsls2 tracy % switch to online switch2online
16
16 BROOKHAVEN SCIENCE ASSOCIATES MMLT Display (plotfamily): Beta plotting (b) against AT (a) against Tracy-3
17
17 BROOKHAVEN SCIENCE ASSOCIATES MMLT Scripting Example: Orbit Correction Refer to Greg Portmann’s example: “EPICS Meeting April 27, 2005” % Create an Orbit Error vcm =.0005 * randn(180,1); % 180 vertical correctors at the NSLS-II setsp('VCM', vcm); % Get the vertical orbit Y = getam('BPMy'); %plot vertical orbit figure;subplot(3,1,1);plot(Y); % Get the Vertical response matrix from the model Ry = getrespmat('BPMy', 'VCM'); % 180x180 matrix % Computes the SVD of the response matrix Ivec = 1:24; [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 setsp('VCM', DeltaAmps); %plot residual orbit after one orbit-correction iteration Y2 = getam('BPMy');subplot(3,1,2);plot(Y2); %plot different between residual orbit and original subplot(3,1,3); plot(Y-Y2,Y);
18
18 BROOKHAVEN SCIENCE ASSOCIATES MMLT Chromaticity measurement (a) against Tracy-3 (b) against AT
19
19 BROOKHAVEN SCIENCE ASSOCIATES MMLT Beam based alignment against AT against Tracy-3 X Y X Y
20
20 BROOKHAVEN SCIENCE ASSOCIATES Model server Online model server Based on a so-called “virtual accelerator” Originally developed by SOLEIL and Diamond Wrap into EPICS based Integrate with the narrow API interface Support Tracy-3 and Elegant Use CA-V3 for the communication protocol Tracy/Elegant simulator (shared library) Lattice configuration Distributed IOC Process Databases EPICS device support (API Interface) EPICS Channel Access Lattice
21
21 BROOKHAVEN SCIENCE ASSOCIATES Real Machine Distributed IOC process databases DipoleQuadSext Corr BPMRF VIOC EPICS Client/Server Tracy Simulation Engine High level Low level MMLT XAL/Tracy Python/Tracy EPICS Client/Server DipoleQuadSext Corr BPM rf Elegant Simulation Engine DipoleQuadSext Corr BPM rf Model API VIOC EPICS Client/Server Model API AT Tracy Elegant EPICS Client/Server Model server HLA environments evaluated at NSLS-II
22
22 BROOKHAVEN SCIENCE ASSOCIATES Model server MMLT applications – orbit correction Against VIOC (using Tracy-3 simulator) Including whole bare lattice of NSLS-II Errors for all elements: ±0.005% Kick beam: 1e-5 for 1 st H&V During correction (with 5 iterations) After correction
23
23 BROOKHAVEN SCIENCE ASSOCIATES Python Why python? Good scripting language Good interface with other language Good math libraries Good GUI libraries Platform Independent Open source, free license
24
24 BROOKHAVEN SCIENCE ASSOCIATES Python #!/usr/bin/python2.5 # matplotlib is used for plotting "Virtual Accelerator Orbit Test" import sys from time import sleep from pylab import * # Use ca library from Diamond sys.path.append("./ca/build/lib") from dca import * Scripting Example: Access simulation server via CA System library Channel access library
25
25 BROOKHAVEN SCIENCE ASSOCIATES Python betax = caget("SR:C00-Glb:G00 RB:X").dbr.value subplot(2,1,1) plot(betax) betay = caget("SR:C00-Glb:G00 RB:Y").dbr.value subplot(2,1,2) plot(betay) show() Scripting Example: Access simulation server via CA Figure layout & plot Show on the displayer Channel Access caget()
26
26 BROOKHAVEN SCIENCE ASSOCIATES Python caput("SR:C01-MG:G02A Fld:SP", 1e-4) sleep(1.0) orbitx = caget("SR:C00-Glb:G00 RB:X").dbr.value subplot(2,1,1) plot(orbitx) orbity = caget("SR:C00-Glb:G00 RB:Y").dbr.value subplot(2,1,2) plot(orbity) caput("SR:C01-MG:G02A Fld:SP", 0) show() Scripting Example: Access simulation server via CA Figure layout & plot Show on the displayer Channel Access caget() Channel Access: caput()
27
27 BROOKHAVEN SCIENCE ASSOCIATES Applications of IRMIS lattice database Using IRMIS for lattice management IRMIS IRMIS Data Service Layer Model Deck Generator TracyElegant Simulation Server (Tracy) Simulation Server (Elegant) IRMIS to Deck Object Mapping Deck Input Deck to IRMIS Object Mapping Deck Parser Tracy/Elegant Elegant Deck Tracy Deck
28
28 BROOKHAVEN SCIENCE ASSOCIATES Applications of IRMIS lattice database Lattice and other database IRMIS Lattice DB (Bare Lattice) IRMIS Saving DB (EPICS PV Snapshot) Mapping table Lattice Generating IRMIS Data Service Layer XML protocol IRMIS Installation DB (Engineering Error) Mapping table
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.