On-the-fly scanning: Improvements in the EPICS motor and mca modules Mark Rivers University of Chicago.

Slides:



Advertisements
Similar presentations
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Processor support devices Part 1:Interrupts and shared memory dr.ir. A.C. Verschueren.
EPICS Collaboration Meeting, June 3, 2010 asynPortDriver C++ Base Class for asyn Port Drivers Mark Rivers University of Chicago Advanced Photon Source.
Delta Tau Coordinate Systems and PLCs at Diamond Matthew Pearson Controls Group, Diamond Light Source Overview: Delta Tau Geobrick motor controller Delta.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
17th Oct 08 Matthew Pearson - Motion Control at DLS 1 Motion Control Developments at Diamond Light Source Matthew Pearson DLS Controls Group.
EPICS at APS Beamlines Tim Mooney Advanced Photon Source Argonne National Laboratory.
Yevgeny Petrilin Shay Dan Shadi Ibrahim. GUI : Graphical User Interface DAQ :Data Acquisition Data Acquisition device  a self-powered system that communicated.
DIRECT MEMORY ACCESS CS 147 Thursday July 5,2001 SEEMA RAI.
Technion – Israel Institute of Technology Department of Electrical Engineering High Speed Digital Systems Lab Project performed by: Naor Huri Idan Shmuel.
INTEGRATION OF EPICS ASYN INTO NON EPICS ENVIRONMENT PRERANA KANKIYA Brookhaven National Laboratory, New York EPICS COLLABORATION MEETING, 2014.
1 Input/Output Chapter 3 TOPICS Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Reference: Operating Systems Design.
SLAC asyn class, Day 1, August 26, 2010 Example asyn driver Modbus Mark Rivers, Marty Kraimer, Eric Norum University of Chicago Advanced Photon Source.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
RTOS Design & Implementation Swetanka Kumar Mishra & Kirti Chawla.
DELTA TAU Data Systems, Inc. 1 UMAC TurboTurbo PMAC PCIGeo Drive Single Source Machine Control motion logic data Power PMAC as a Linux Computer January.
EPICS Meeting, APS, June 14 th 2006 MCS-8 The 8 axes motion control system Rok Šabjan
Keep it Cheap: EPICS Devices for the Small Laboratory
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
26 February 2009Dietrich Beck FPGA Solutions... FPGA and LabVIEW Pattern Generator Multi-Channel-Scaler.
ORNL is managed by UT-Battelle for the US Department of Energy EPICS State Notation Language (SNL), “Sequencer” Kay Kasemir, SNS/ORNL Many slides from.
AreaDetector: Recent Additions and Future Plans Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
APS BPM and power supply applications on micro-IOCs W. Eric Norum
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Feb Motor Support.
Data Acquisition Data acquisition (DAQ) basics Connecting Signals Simple DAQ application Computer DAQ Device Terminal Block Cable Sensors.
Imperial College Tracker Slow Control & Monitoring.
Upgrade to Real Time Linux Target: A MATLAB-Based Graphical Control Environment Thesis Defense by Hai Xu CLEMSON U N I V E R S I T Y Department of Electrical.
4,000 Spectra or 4,000,000 ROIs per Second: EPICS Support for High-Speed Digital X-ray Spectroscopy with the XIA xMap Mark Rivers GeoSoilEnviroCARS, Advanced.
8 May 2001EPICS Group3 Carl Lionberger1 EPICS Support for Group3 Control System Carl Lionberger Group3™ optical-fiber-connected I/O Software and operational.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Conversion to EPICS R3.14 Mark Rivers. New capabilities Progress in converting synApps/GSECARS Outstanding issues Work to be done Outline.
Materials Science and Protein Crystallography Using the MX Beamline Control Toolkit William M. Lavender
1/15 G. Manduchi EPICS Collaboration Meeting, Aix-en-Provence, Spring 2010 INTEGRATION OF EPICS AND MDSplus G. Manduchi, A. Luchetta, C. Taliercio, R.
® SPARTAN Series High Volume System Solution. ® Spartan/XL Estimated design size (system gates) 30K 5K180K XC4000XL/A XC4000XV Virtex S05/XL.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
SNS Integrated Control System Timing Clients at SNS DH Thompson Epics Spring 2003.
Fast Fault Finder A Machine Protection Component.
EPICS Release 3.15 Bob Dalesio May 19, Features for 3.15 Support for large arrays - done for rsrv in 3.14 Channel access priorities - planned to.
An Introduction to Device Drivers Ted Baker  Andy Wang COP 5641 / CIS 4930.
UNIX Unit 1- Architecture of Unix - By Pratima.
Python Applications for Beamline Control Mark Rivers.
Motor drivers for asyn motor device support Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
An EPICS solution for Galil products that can provide a comprehensive, and high performance motor and PLC control system for use at synchrotrons and other.
IT3002 Computer Architecture
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
EPICS and LabVIEW Tony Vento, National Instruments
1 EPICS Transient Recorder Support EPICS Meeting at BESSY May 2002 Marty Kraimer.
Motion Control at the Advanced Photon Source Argonne National Laboratory Mark Rivers University of Chicago 7 GeV synchrotron x-ray light source, the largest.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
Office of Science U.S. Department of Energy “Traditional” Tools for Beamline Applications Mark Rivers University of Chicago October 16, 2008.
Software Troubleshooting Eliminate possible programming and timing errors by stopping all programs ( and ). Use the Executive program terminal and send.
Integrating Advantech PCI I/O cards into EPICS. Outline ANTARES computer control and data acquisition systems architecture STAR computer control and data.
AsynMotor: Support For Coordinated Multi-Axis Motion In EPICS Mark Rivers University of Chicago.
ESS Timing System Plans Timo Korhonen Chief Engineer, Integrated Control System Division Nov.27, 2014.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Diamond Motion Control Emma Shepherd & Matthew Pearson May 2011
Current Generation Hypervisor Type 1 Type 2.
Mark Rivers University of Chicago
C++ Base Class for asyn Port Drivers
Advanced Photon Source
asynMotor: Support For Coordinated Multi-Axis Motion In EPICS
EPICS MCA and Canberra Support
Motion Control (at APS)
asyn Driver Tutorial Measurement Computing 1608GX-2A0
C++ Base Class for asyn Port Drivers
quadEM: New Beam Position Monitor & Electrometer Hardware and Software
GeoSoilEnviroCARS The University of Chicago
Presentation transcript:

On-the-fly scanning: Improvements in the EPICS motor and mca modules Mark Rivers University of Chicago

Traditional step scanning overheads: –Start and stop motors & mechanical systems –Arm and read detectors. Typically much more efficient to collect data on-the-fly as the motors are moving. –Better detectors, more flux with APS Upgrade, don’t waste photons and time However, on-the-fly scanning with EPICS has been subject to limitations. –Typically limited to simple single-motor scans because EPICS did not provide a way to program motor controllers to perform synchronized motion of multi-axis controllers. Exception to this was the Trajectory Scanning software I wrote for the Newport XPS and MM4005 motor controllers. Not a clean solution: SNL program talking directly to the controller, “behind the back” of the motor record driver. PMAC does have motion control programs – good for fixed, simple geometry –New solution that incorporates a coordinated motion API in the motor driver layer SIS3801 and SIS3820 multi-channel scalers are typically used for collecting pulse counting data in on-the-fly scans. –Drivers were previously not able to handle very large arrays (1,000,000 elements or more) without unacceptable slowing down the IOC response. –Drivers have been rewritten to eliminate this problem, and to add a number of significant new features. Motivation

Top-level object is the EPICS motor record –Lots of code has been written to this object: spec, IDL and Python classes, etc. Next layer is EPICS device support –Knows about the motor record, talks to the driver Lowest layer is EPICS driver –Knows nothing about motor record, talks to the hardware 3 models of device and driver support have developed over time EPICS Motor Support

Device-dependent device support and driver support for each controller type Communication between device support and driver is custom for motor code and very limited Cannot use other records to talk to driver only motor record Cannot take advantage of controller-specific features not supported by motor record No provision for multi-axis coordination Most drivers in the motor package are written this way for historical reasons Model 1

Developed 2006 by APS and DLS Uses standard asyn interfaces to communicate between device support and driver A single device-independent device support file A single device-independent driver support file for asyn interfaces Device dependent driver file below the asyn one Can use other records to talk to driver via asyn interfaces Not as easy as it should be to do so No implementation of multi-axis coordination A few drivers in the motor package are written with Model 2 –Simulation driver, Newport XPS, Newport MM4000, ProDex MAXnet, Attocube ANC150, Aerotech Ensemble Model 2

New C++ model introduced here. Two base classes, asynMotorController and asynMotorAxis. Base classes provide much functionality, only need to write device-specific implementations. Easy to support controller-specific features Don’t have to use motor record. Direct support for coordinated profile moves in the driver API. Model 3

class epicsShareFunc asynMotorController : public asynPortDriver { asynMotorController(const char *portName, int numAxes, int numParams, int interfaceMask, int interruptMask, int asynFlags, int autoConnect, int priority, int stackSize); virtual asynMotorAxis* getAxis(asynUser *pasynUser); virtual asynMotorAxis* getAxis(int axisNo); virtual asynStatus startPoller(double movingPollPeriod, double idlePollPeriod, int forcedFastPolls); virtual asynStatus wakeupPoller(); virtual asynStatus poll(); void asynMotorPoller(); virtual asynStatus initializeProfile(size_t maxPoints); virtual asynStatus buildProfile(); virtual asynStatus executeProfile(); virtual asynStatus abortProfile(); virtual asynStatus readbackProfile(); asynMotorController

class epicsShareFunc asynMotorAxis { virtual asynStatus move(double position, int relative, double minVelocity, double maxVelocity, double acceleration); virtual asynStatus moveVelocity(double minVelocity, double maxVelocity, double acceleration); virtual asynStatus home(double minVelocity, double maxVelocity, double acceleration, int forwards); virtual asynStatus stop(double acceleration); virtual asynStatus poll(bool *moving); virtual asynStatus setPosition(double position); virtual asynStatus initializeProfile(size_t maxPoints); virtual asynStatus defineProfile(double *positions, size_t numPoints); virtual asynStatus buildProfile(); virtual asynStatus executeProfile(); virtual asynStatus abortProfile(); virtual asynStatus readbackProfile(); asynMotorAxis

Parker ACR Model 3 Driver 650 lines of code total (ACRMotorDriver.h, ACRMotorDriver.cpp) Supports Jerk parameter, and bi, bo, longin records via standard asynUInt32Digital interface for TTL I/O lines Less than 100 lines of code for digital I/O support

Create arrays of target locations of each motor in a multi- axis controller Create array of time per element Define times/locations to output synchronization pulses to trigger detectors Execute coordinated move Optionally read back encoder positions when each synchronization pulse was output Many controllers have this capability –Newport MM4000, Newport XPS, Delta Tau PMAC, Prodex MAXv, Parker ACR series, etc. We now have an API to take use this capability in a consistent way Now done in same driver as for motor record, eliminates conflicts Coordinated Motion (Formerly called Trajectory Scanning)

Coordinated Motion ; IDL program to build, execute and readback profile ; This program builds a profile and executes it. nelements = 100 ; 100 elements in the profile. npulses = 100 ; 100 pulses in the profile. naxes=2 ; We will move the first 2 motors (Phi and Kappa) ; Define array of positions positions = dblarr(nelements, naxes) ; The Phi profile is a sin wave with two complete periods and an ; amplitude of +-1 degrees positions[*,0] = 1.*sin(findgen(nelements)/(nelements-1.)*4.*!pi) ; The Kappa profile is a sin wave with one complete period and an ; amplitude of +-1 degrees positions[*,1] = 1.*sin(findgen(nelements)/(nelements-1.)*2.*!pi) profile = 'IOC:Prof1:' group = 'GROUP1' time = 0.1 ; Fixed time per profile point status = profile_move(profile, positions, group=group, maxAxes=6, $ build=1, execute=1, readback=1, time=time, $ npulses=npulses, actual=actual, errors=errors) end

Phi output profile Kappa readback profile Kappa following error Phi following error

SPEC Interface SPEC macros have been written to allow SPEC to utilize profile moves via EPICS interface Low level interface, all of SPEC's standard scans can be done "on-the-fly" with profile move software. Replacement macros for: –_ascan # Used by all ascan and dscan macros –Mesh –hklscan # Used by hscan, kscan and lscan –_hklmesh –_hklline # Used by hkcircle, hlcircle, klcircle, hkradial, hlradial and klradial –_scanabort resume –_loop

SPEC Interface traj_index # Converts a SPEC motor index to an MM4005 motor index traj_build # Builds a trajectory traj_exec # Executes a trajectory traj_read_counts # Reads the data from the multi-channel scaler traj_read_actual # Reads back the actual MM4005 motor positions traj_scans_on # Enables trajectory scanning traj_scans_off # Disables trajectory scanning, uses step scanning Global variable TRAJ_USE_ACTUAL=(0,1)

Future Work Convert MAXv to Model 3 –Tim Mooney already has MAXv trajectory scanning running in SNL program Support other controllers –PMAC, etc. Add additional features Work on replacement for motor record?

SIS 3801/3820 Software Improvements Joerger VSC8/16 no longer available, SIS3820 attractive alternative 32 inputs, on-board FIFO buffer memory (64MB/512 MB) Works in 2 modes –Conventional scaler (like Joerger) with scaler record –Multi-channel scaler with MCA record Ideal for on-the-fly scanning –Internal channel advance, 1 microsecond to many seconds –External channel advance with divide-by-N Use encoder or motor pulses as channel advance SIS3801 is older model, much less memory, fewer features. –No preset capability, I emulate it in software when reading FIFO –Before that there was the nearly identical STR7201.

Problems with previous releases In previous releases the SIS3801 and SIS3820 drivers were "synchronous“: MCA records blocked while arrays were read from the FIFO on the VME modules. FIFO reads were done with VME program I/O (~4MB/s). –OK for small arrays (e.g channels) because it only took a few ms to read each array. For very large arrays (e.g. 2,000,000 channels) it took several seconds to read each array, blocking execution of other EPICS records and tasks, leading to channel access disconnects and other bad effects.

Improvements in new version (mca R7-0) FIFO is read by background thread into memory buffer –Uses DMA on 3820, much higher performance (> 40MB/s) –MCA or waveform records just read from memory buffer, no VME I/O Can use either MCA record or standard EPICS waveform record. –Performance better with waveform record for very large arrays, less overhead New PVs for –Software channel advance. –Initial software channel advance when acquisition is started –Configuration modes: 4 input control signals and the 4 output control signals. –Channel 1 source: internal 25/50 MHz clock or external pulse input. –control the user-defined LED and user-defined output control line on 3820 –Select which input is routed via the MUX output control signal on the –Current acquisition mode (MCS or Scaler), model number and firmware version. –Current channel number being acquired. Replaced logic in databases (e.g. Struck32.db) with simple SNL program –A single database can now be used. Previously needed different databases depending how many inputs (2, 8, 16, 32, etc.) were being used

Improvements in new version (mca R7-0) drvSIS38XX base class derived from asynPortDriver drvSIS3801 and drvSIS3820 derived from drvSIS38XX. With improvements and new features in the drivers the amount of code has decreased in R7-0 compared to previous releases

Performance with very large arrays Test configuration (simulating how XPCS might want to run): –SIS3820 module with 512MB of FIFO memory –MVME 5100 CPU with 512MB of memory –vxWorks with Andrew Johnson's BSP with DMA support –2 active inputs –10,000,000 channels per waveform –2 waveform records –Internal channel advance –1 microsecond dwell time –ReadAll.SCAN = Passive Theoretical time for this acquisition to complete is 10.0 seconds. Output from the EPICS "camonitor" program on a Linux client looking at the Acquiring PV, and the first 2 channels of each waveform record: > camonitor -tc -#2 SIS:3820:mca1 SIS:3820:mca2 SIS:3820:Acquiring SIS:3820:Acquiring ( :19: ) Acquiring SIS:3820:mca1 ( :19: ) SIS:3820:mca2 ( :19: ) SIS:3820:Acquiring ( :19: ) Done Time between when acquisition started and when the client received the data and the Acquiring=Done status was seconds. –Less than 1 second of overhead in collecting 2 waveforms of 10,000,000 elements each –= 80MB of data

SIS38XX.adl

scaler_more.adl