# Presentation: 551488

## OAG Tools for General UsersA Contribution to the “Getting Started with EPICS” Lecture Series

- Michael Borland
- Operations Analysis Group
- APS Operations Division
- Argonne National Laboratory
- August 24, 2004

## Brief Introduction to OAG

- Group of accelerator physicists and programmers formed in 1995 to “apply the lessons of commissioning to accelerator operation.”
- We write high-level applications for physicists, engineers, and operators, e.g.,
- Automated startup and shutdown
- Orbit correction and steering
- Accelerator experiments
- We manage the accelerator data logging systems and configuration control systems.
- Much of the software we write is generic and can be used in any EPICS context.

## Outline

- Brief introduction to Operations Analysis Group
- Intended audience
- What you'll learn
- How to access the software
- General features of OAG applications
- Accessing the accelerator data logs
- Performing data analysis
- Controlling things through EPICS
- Summary

## Intended Audience

- We cater to a range of users
- Programmers in a variety of languages
- Those who want commandline tools
- Those who want an easy-to-use graphical user interface (GUI)
- Today, we'll concentrate the last type.
- Underlying software is the same.
- Two later talks will concentrate on the details.

## A Few Details

- We build our applications out of two components
- Tcl/Tk: a scripting language that allows easily making graphical user interfaces (GUIs).
- SDDS: a type of general data file and a toolkit of C programs that work with such files.
- Almost all the screen-shots in this presentation are Tcl/Tk GUIs.
- The data processing is done by SDDS tools hidden under the Tcl/Tk layer
- SDDS Toolkit for data processing and display
- SDDS/EPICS Toolkit for EPICS-specific functions

## What You Can Learn from this Talk

- Types of applications that are available from OAG
- Features and usage of specific applications
- Detailed click-by-click guidance,
- Review of the interface, or
- Listing of major features.
- Important concepts for using OAG applications
- SDDS files and “meta-applications”
- Reusing data and programs
- How you can do even more with SDDS Toolkits
- How OAG software differs from similar EPICS clients

## For AOD, ASD, and XFD staff with access to a Sun workstation, access is via your workspace menu

- Accessing the Software

## OAGapps Main Menu

## A Typical OAG-Style Application

## Context-Help Feature

## The “F” button bringsup a  file selection

- The “F” button bringsup a  file selection
- dialog.

## The Command-Selection Feature Helps Link Applications

- Select file
- Select recently-used file
- Launch another application using given file

## Why All the Files?

- OAG applications require input and output filenames as part of data processing
- Some feel this is inconvenient or even bad software design
- However, using files
- Lets user name and identify data and results
- Creates open-ended “meta-applications” out of many small, simple applications
- Lets anyone add to the application suite
- Avoids getting trapped by software that doesn't do what you want

## Data Logger

- Review SubMenu

- Access archives of accelerator-related data
- Review alarm history
- Review signal values
- Review history of setpoint changes
- Review glitches
- Find process variables in the data loggers

## Alarm Logger Review

- The alarm logger review utility allows
- Reviewing alarms by subsystem and time period
- Finding alarm times, severity, and status
- Viewing related information (e.g., status bits)
- Histogramming alarm density
- Look for overlapping alarms
- We monitor alarms on 14k process variables
- Private alarm logs also supported

## Alarm Logging or ALH?

- ALH (ALarm Handler) is a GUI for alerting operators to alarms
- ALH logs data, but
- Must have GUI open
- Not space efficient
- No analysis tools
- sddsalarmlog provides
- Background logging
- Space-efficient format
- Sophisticated analysis and review tools

- You need both!

## Alarm LogReview

- Alarm LogReview
- Application

## “Monitor Data Review” Application

- Provides access to
-  37k logged quantities.

## Preset Plots Dialog

## A Typical “SDDS Plot”

- X-windows
- interface by
- K. Evans.

## Web Access to Accelerator

- Data Logs

## Listing of data

- groups same as
- in the Tcl/Tk
- application

## In this example, we select

- some process variables
- explicitly.

## Sample output

- from web-based
- data review

## Exporting Data

- In this case, “sddsExportData” is launched from the data review
- application to allow exporting the selected data.

## Exporting Data

- The air temperatures for
- all zones were selected.

## Exporting Data

## Working with Exported Data

## SDDS Utilities

- SubMenu

- “Quick” interfaces to basic SDDS capabilities
- Graphics
- Fitting
- Digital signal processing
- Statistical analyses
- Edit
- Export/import

## “quick SDDS DSP”: Digital Signal Processing

- Fast
- Fourier
- Transforms

## Example of FFT Results

- FFT shows 1 and
- 0.5 day components
- to temperature
- variation

## More DSP: NAFF

- Numerical
- Analysis of
- Fundamental
- Frequencies

- To make it more
- interesting, look
- at all 172 AHU
- temperatures for
- the experimental
- hall.

## NAFF Reveals a Wealth of Information

- Periods cluster
- near 1 day with
- up to 1.7 deg
- amplitude

- Phases
- cluster near
- 100 degrees

- Diurnal effect
- accounts for
- 10~80% of
- variation

## “quick SDDS Statistics”

- Histograms
- Statistics computation
- Outlier analysis
- Correlation analysis

- The idea of using
- one program's
- output as another
- program's input
- is central to SDDS.

## Sample Histogram Results

## Searching for Correlations

## Correlation Analysis: Experimental Hall Temps. with Outside Air Temp.

## Correlation Scatter Plot Example

## Statistics Computation

- Example of
- computing a
- variety of
- statistics for
- AHU temperatures

## Statistics Results

## SDDS Utilities

- SubMenu(again)

- “Quick” interfaces to basic SDDS capabilities
- Data collection
- Experiment execution

## Data Collection

- quickMonitor
- Interface to basic features of the program sddsmonitor
- Time-interval-based data collection
- quickWaveformMonitor
- Interface to basic features of the program sddswmonitor
- Time-interval-based collection of waveforms and scalar values
- For more sophisticated applications, one can use commandline SDDS tools...

## SDDS Data Collection Capabilities

- Capabilities include
- Time series logging of values and statistics
- Glitch-, alarm-, or trigger-initiated logging with pre- and post-event samples
- Synchronous and quasi-synchronous logging
- Logging of changes to values
- Alarm logging with related data capture
- Input files for these programs are largely identical
- All APS accelerator data logging uses these tools
- See our web site or later talks for more...

## quickMonitor

## MEDM Allows Dragging and

- Dropping PV names

## quickMonitor Run Dialog

## quickMonitor or StripTool?

**StripTool is a popular EPICS client for time-series sampling**
**Convenient interface**
**Scrolling plots of the data**
**Use StripTool when**
**~5 channels or less**
**Primary interest is *****seeing***** the data**
**Note: StripTool can dump SDDS data**
**Use quickMonitor when**
**More than ~5 channels**
**Primary interest is *****analyzing***** the data**
**quickSDDSplot can perform “movie” plots of updating data**

## Homework: Analyse the Vlinac* Simulation

- Use quickMonitor to collect data on all PVs.
- Use quickSDDSplot to review signals: *Final current (FC1) varies with time.*
- Use quickSDDSStatistics to look for correlations with FC1: *Cathode temperature is highly correlated.*
- Use quickSDDSDSP to look for frequencies: *Clear 60s oscillations!*

- *N. Arnold, ASD

## Experiment Execution:quickExperiment

- Limited interface to sddsexperiment
- Perform 1-D experiments with several (ganged) variables
- Measure any number of readbacks, with averaging and statistics
- sddsexperiment offers more
- N-dimensional experiments
- Verification of response of variables
- Test limits to ensure data quality
- Script execution

## Example with Vlinac

- PV names loaded by
- hand or from SDDS file
- (compatible with quickMonitor)

## Variables Tab

## Parameters Tab

## Use quickSDDSFit to Look at Results

- Provides
- polynomial,
- exponential,
- and gaussian
- fitting and display.

## Intensity Data Is Bi-Linear

## Linear Fit to One Side

## Experiment Execution:ExperimentDesigner

- Allows designing complex experiments that involve
- Initialization
- Execution sequence
- User interaction
- Coordination of external programs and scripts
- Finalization
- Postprocessing
- Configurations can be saved and executed as a script with no interface
- Allows N-dimensional experiments

## ExperimentDesigner: PV Panel

## Experiment Designer: Initialization Design

- Set cathode current, check response
- Turn gun on, check response
- Open valve, check response
- Restore setpoints from SDDS file
- Launch cathode temperature regulator (more later)

## Experiment Designer: Execution Design

- Change control values
- Wait a specified time
- Read declared PVs
- Run program

## Experiment Designer: Run Program Dialog

- Allows easily invoking
- SDDS data collection
- engines

- Run Script action
- (not shown) used for
- general programs.

## Experiment Designer: Output Files Tab

- In this example, we
- select quickSDDSplot
- to review the statistical
- results.

## quickSDDSplot Interface

- Provides greatly
- attenuated access to
- sddsplot.

## quickSDDSplot Output Example

## Generic

- Controllers SubMenu

- Set up a one-readback, one-actuator feedback loop
- Set up and perform optimizations
- Change PVs in oscillatory or ramped fashion
- Set up knobs and 2D sliders

## Can use the script

- “maintainReadback”
- to regulate Vlinac
- cathode temperature

## Sample for 60s and use

- midpoint of readings to deal
- with the oscillation.

## sddsexperiment

- run dialog

- Graph of the
- response

## Effectiveness of Feedback

- Reduction in oscillation
- limited by update rate of
- the PVs

## Generic Optimizer*

- A common requirement in control systems is optimization of some quantity
- Feedback requires quasi-linear responses measured around the desired point
- Automated optimization is useful when none of these conditions apply
- Explores new territory
- Has advantages over manual tweaking
- It is relatively slow

- *Inspired by J. Lewellen's “amoeba” script.

## Example: Optimization of the Vlinac

- Deliberately mis-set all the correctors in the Vlinac simulation
- Set up optimizer with
- 10 variables: the setpoints for all the correctors
- 1 readback: the final beam current
- Use Simplex method without initial 1D scans
- To reduce current ripple and noise effects:
- Use maintainReadback to regulate cathode temperature
- Average for 60 seconds

## Optimizer Interface: Variables Tab

- Any number of actuators (“variables”)
- Enter limits and initial step sizes
- Provide composite knob definition files

## Optimizer Interface: Measurement Tab

- Optimizes the mean-absolute-value (MAV) or RMS of any number of readbacks with optional offsets and weighting

## Optimizer Interface: Tests Tab

- Optional “test values” to prevent optimizer from running when conditions are not right (e.g., no beam)

## Optimizer Interface: Parameters Tab

- Simplex or successive 1-D scan methods
- User-specified averaging and post-change pause
- Can optimize with user script to compute penalty function

## Optimizer Result

## Summary

- OAG provides a number of tools for the general EPICS user
- Access to accelerator data logs
- Perform data collection
- Plot and analyze data
- Design and execute experiments
- Feedback and optimization
- These tools are interlinked by SDDS files
- Don't miss follow-up lectures
- OAG Tcl/Tk (R. Soliday)
- SDDS (M. Borland)

## OAG Group Members

- Present:	M. Borland, L. Emery, N. Sereno, 	H. Shang, R. Soliday
- Emeritus:	D. Blachowicz, B. Dolin, K. Evans, C. Saunders