# Presentation: 083298

## EPICS-ness at KEKB Injector

- Kazuro Furukawa, KEK.
- < kazuro . furukawa @ kek . Jp >

- KEKB Injector and Legacy Controls
- Network Controllers
- EPICS Gateways
- Timing System

## Control Systems at KEK

- There are several Control systems in KEK, Some of them employ EPICS recently

**EPICS**

**Group**

**J-PARC**

**KEKB**

**PF-AR**

**PS**

**ATF**

**e**

**+**

**/e**

**–**

**Linac**

**PF**

## Linac in KEKB Collider Complex

- 8GeV Electron + 3.5GeV Positron for KEKB
- 2.5GeV Electron for PF
- 3.0GeV Electron for PF-AR
- 600m Linac with 59 S-band rf Stations with SLED
- Double Sub-Harmonic Bunchers for 10ps & 10nC
- 2-bunch in a Pulse and Continuous (Top-up) Injection

## Performance of KEKB

- Staffs in Linac
- are always
- Interested in
- performances
- in KEKB/Belle
- Here is the
- KEKB daily
- Performance
- Page updated
- Every minute

## Linac Controls

- KEKB = Factory Machine => Reliable Operation
- Controls should be Robust and Flexible
- ~1000 devices and ~10000 signals
- Frequent Beam Mode Switches; Four very Different Beam Modes, 300 times/day
- Precise Controls of Beam Parameters,Energy, Orbit, Emittance, Charge, Energy spread, Timing, etc.

## History and Design Concept

- History
- 1978-1982: Construction of First Computer-controlled 	System with 8 mini-computers, >200 micro-computers,	>30 optical loop networks
- 1989-1992: Design of the next system
- 1993-1997: Installation and expansion for KEKB
- Design Concept
- Use of International and/or de-facto Standards
- Use of Optical IP Networks for every Device controllers
- No new field Networks, only IP Network (to be inherited by J-PARC)
- Both of above should make future upgrade easier
- (EPICS was not available widely at that time)

## Physical Structure

- Multi-tier, Multi-hardware, Multi-client, ...

## Multi-tier Logical Structure

## Software Architecture

- Base control software structure for Multi-platform
- any Unix, OS9, LynxOS (Realtime), VMS, DOS, Windows, MacOS
- TCP - UDP General Communication Library
- Shared-Memory, Semaphore Library
- Simple How-grown RPC (Remote Procedure Call) Library
- Memory-resident Hash Database Library
- Control Server software
- Lower-layer servers (UDP-RPC) for control hardware
- Upper-layer server (TCP-RPC) for accelerator equipment
- Read-only Information on Distributed Shared Memory
- Works redundantly on multiple servers
- Client Applications
- Established applications in C language with RPC
- Many of the beam operation software in scripting language,
- Tcl/Tk and SADscript/Tk

## Recent Development

- Application software for Two-bunch in a Pulse
- Application software for Continuous Injection
- C-band Acceleration Project (for future SuperKEKB)
- More PLC adaptation, mainly by hardware groups
- Many slow feedback loops, including energy spread
- Slow Positron Facility inside Linac (60MeV e-)
- Intel-Linux-VME with Linac software and EPICS IOCcore
- CC/Net (embeded Linux CAMAC CC) for possible replace of Hytec (sorry)
- Evaluation of fast Waveform Digitizers
- Especially for 50Hz data acquisition
- Network connected RAS module, etc.
- Upgrade of EPICS gateway

## Simple Ethernet Interface - 50Hz Monitor

- Timing signals of ~150 TD4/TD4V/TD4R used in linac
- If a signal is missing beam loss and possible damage to devices
- There was a problem in comparators in TD4/TD4V
- A monitor module was built to monitor specific timing requirement
- PIC processors and a X-Port from Lantronics
- Monitored over Ethernet
- Now two other kinds of modules were developed

## VME RAS Module with Ethernet Interface

- For reliability of VME crates (~25)
- Currently Hardwired modules are used: wiring issues
- Ethernet/IP connectivity is preferable
- Power voltage, temperature, fan
- Watchdog timers
- Four RS232C ports for CPU, Network, etc
- TTL inputs/outputs
- VME reset
- Firmware environment
- Micro-iTRON, or Linux
- SH4, 16MB RAM
- peripherals over I2C
- Interface to EPICS
- TCP communication with IOCs
- Possible Embedded EPICS on iTRON or Linux

## Why EPICS in my case

- We made too much effort on duplicate development on many control systems
- Our goal is to achieve high performance in the accelerator and the physics experiments
- Reuse of available resources is preferable
- Devices in Linac have been modernized, and development of EPICS device supports became possible
- Anyway we need interface to down-stream accelerators esp. KEKB
- Want to merge several archive formants in Linac
- May expect (?) man-power from other groups
- May contribute to world-wide EPICS collaboration

## Building EPICS Gateway

- Common Control System at the Top (of Linac and Ring)
- Needs too much resources
- Port EPICS onto our VME/OS9-LynxOS
- Failed to get support/budget for LynxOS at Linac
- (EPICS Maintenance with an unsupported Platform ?)
- Special Gateway Software, which interfaces to both the Linac Controls and EPICS IOCs as a Client
- Built to ensure the feasibility at 1995
- Portable Channel Access Server
- Implemented with EPICS 3.12 and being used on HP-UX since 1996
- It is being used for several application software including Alarm display
- Software IOC
- Being used and being extended on Linux since 2003

## Use of Existing EPICS IOC (Gateway IOC)

- Software availability
- Portable Channel Access Server was not available at around 1995
- Channel Access Server Emulation with Available Software Components
- New gateway software which is clients to the both Linac and EPICS, and group of EPICS soft records
- Real-time Operation is possible both ways using Monitors
- Tested for Magnet Controls
- MEDM panels were written

- Gateway

## Portable Channel Access Server (PCAS)

- Protocol Conversion
- Client to Linac Controls with Home-grown RPC and Cache Memory, Interface to Upper-level Servers (not directly to Lower-level Hardware Servers)
- Server to EPICS environment, with some Name wrapping
- Implemented for Linac in 1996-
- for Magnets, RF, Beam Instrumentations
- >4000 Records are available
- Write-access Possible, normally Read-only
- Still used for KEKB Unified Alarm,Operation Status, etc.

- CA Server

## Soft IOC

- IOCcore is available on Unix in EPICS 3.14
- We have Tru64unix, Linux, HP-UX
- Simple
- IOCcore hides the complexity of Channel Access, etc
- We design the device support to Upper-level Linac  Servers, as we access to hardware in normal IOC
- All standard EPICS facilities are available
- Alarms, Operation Limits, Links, Periodic processing, Monitors, etc.
- Implemented for Linac on Linux since 2003
- For RF, Beam Instrumentation, Vacuum, etc.
- >2200 Records are available and extending
- All the records are archived in Channel Archiver and KBlog
- KBlog is used to analyze correlations between Linac/Ring
- Developing Java viewer of the archive

## General Comparisons

- Symmetry
- Gateway IOC is Symmetric between outside and inside of EPICS
- Accessing from/to EPICS goes thru the same Gateway
- Others are (somewhat) asymmetric
- Name Resolution
- PCAS can resolve names dynamically (at run-time)
- Consumes less memory (?)
- SoftIOC has to be prepared with static database
- May be expected to give better response
- Can be impossible for a large installations
- Database processing and associate fields
- SoftIOC provides EPICS database Facilities like Limits, Alarms, Links, etc.
- If we archive them, Archive Deadband is most necessary
- Implementation of Gateway
- SoftIOC is relatively straight forward
- Simply adding device supports

## Application software

- All the records from the Linac Soft IOC are archived both in Channel Archiver and in KBlog
- KBlog is used to analyze correlations between Linac/Ring
- (Developing Java viewer of the archive)
- KEKB Alarm is connected to Linac PCAS
- May migrate to Linac SoftIOC at Summer Shutdown(Linac PCAS is currently based on EPICS 3.12)
- Some other applications utilize PCAS as well
- (Many others access Linac Controls directly now)
- Small number of Records are going thru Gateway IOC, historically

## KEKB Alarm Panel

- Below is the KEKB Alarm Main Panel, which covers Linac Alarms as well.  Detailed alarm information/history is available in a separate panel

- Linac

- Ring

## Beam Optics Panels in SAD

- Beam Optics Matching and Optimization Panels						in SADscript

- Some Parameters goesthru EPICS Gateways, others directly to Linac

## Performance

- EPICS Gateway and Channel Archiver
- are Running on Linux 2.4.20 (Redhat) with Intel Xeon 2.4GHz and Memory of 2GB
- About 10% of CPU usage
- Monitors/Archives all of ~2200 Channels (partial in Kblog)
- Can process 5400~6600 Channel Access Requests over Network
- Archive size is about 400MB/day (300MB/day in Kblog)
- Both Channel Archiver and KBlog collect Data

## Timing

- Beam timing, 2 locations 4 signals
- loosely synchlonized to power line within 500 micro seconds
- Possible pulse-to-pulse interlace between clients
- for KEKB, 2 signals
- synchronized to 10.384MHz (common frequency for 2856,571,114,509)
- < 3 ps jitter now, < 1 ps near future
- 1Hz to 50Hz, any pattern
-  for PF, 1 signal
- synchronized to bunch selected 500MHz
- 1Hz to 25Hz, any pattern
-  for PF-AR, 1 signal
- synchronized to bunch selected 508MHz
- 1Hz to 25Hz, any pattern

## Timing

- Streak camera at 3 locations, 3 signal
- synchronized to beam timing within < 1 pico seconds
- beam pulse selection
- Most Beam monitors (90bpm, 14ws, 31rf) 27 locations 27 signals 40m each
- synchronized to beam timing within 1 nano seconds
- 1Hz, 5Hz, 50Hz, and selected beam pulse timing, etc.
- rf (69Klystron) stations 14 locations 101 signals 10m each
- synchronized to beam timing within 5 ns
- always 50Hz
- Septum/Kicker
- for KEKB, PF, PF-AR
- synchronized to beam timing within 1 ns
- Beam pulse or 25Hz fixed

## Timing

- Pulse-to-pulse changes
- rf system (phase and timing), pulse magnet (on/off) switching
- should send beam type just after previous beam timing to switch those equipment parameters
- pattern decision can be static
- pre-program only for now, no dynamic change at the beginning

## Summary

- Slow transition towards EPICS
- At Top
- At Bottom

## Summary

- There can be many signals outside of EPICS;In our case, Whole system was outside of EPICS
- EPICS provides several facilities to implement  gateways for EPICS services
- At KEK Linac several implementations were built in the past, and merging towards Soft IOC for now, which may cover ~10k records per Soft IOC
- Large installation may prefer to utilize PCAS
- Small installation may be satisfied with Gateway IOC
- Expected to extend the flexibility of the System, keeping the Original Control System Philosophy

## Future Development

- Linac Beam Measurement and Quality Control
- Beam Measurement
- 		Between Injections  —>  During Continuous Injection
- Stealth Bunch Measurement Possibility
- 		Between Injection Bunches
- 		Fast Kicker, To Prevent Dirty Beam Injection
- 		Fast Actuator Installation
- 			ex. Fast Phase Shifter is under Development
- 		Synchronous Data Acquisition Improvement
- 		Timing System Modification
- Fast (50Hz) Data Acquisition
- 		Under Development for BPM with Fast Digitizer
- 		Need to Measure Dual Bunch Simultaneously
- Need More Beam Quality Control
- 		More Precise Optics Control, etc