# Presentation: 864086

## The Main Injector Beam Position MonitorFront-End SoftwareLuciano Piccoli, Stephen Foulkes, Margaret Votava and Charles BriegelFermi National Accelerator Laboratory, P.O. Box 500, Batavia, IL, USA 60510

**The Main Injector Beam Position Monitor****Front-End Software**Luciano Piccoli, Stephen Foulkes, Margaret Votava and Charles Briegel*Fermi National Accelerator Laboratory, P.O. Box 500, Batavia, IL, USA 60510*

**Introduction**
- The upgrade of the beam position monitor (BPM) read out system for the Main Injector (MI) at Fermilab is part of the plan to increase the luminosity for Run II experiments. The front-end software is one of the key parts of the system. It must reliably read out beam position information for all the MI operating modes and provide application access to the data.
- The MI BPM upgrade environment is described, followed by the system requirements, software design and implementation.
**The Front-End System**
- The MI BPM upgrade components are located in the tunnel and in service buildings. The front-end software controls the hardware installed in the service buildings (Figure 1b).
- The front-end software runs on a Motorola processor board, and controls a custom made timing board and up to ten commercial digitizer boards (EchotekTM model ECDR-GC814-FV-2).

- This work was supported by Fermi National Accelerator Laboratory, operated by Universities Research Association Inc. under contract No. DE-AC02-76CH03000 with the United States Department of Energy

**Requirements**
-  Replicate functionality of old system to minimize disruptions during installation
-  Closed orbit mode at 500 Hz (Profile, display and user TCLK)
-  Turn-by-turn mode (2048 samples or 512 points on injections and extractions)
-  Measure particles bunched at either 2.5 MHz or 53 MHz
-  Follow sequence of commands based on the MI state
- Switch between closed orbit and turn-by-turn modes
- Turn-by-turn data readout at the end of a cycle (500 ms available between states)
-  Provide separate set of buffers for measurements from each MI state
-  Diagnostics mode
-  Safe mode - assumption of no reliable turn marker
**Generic Framework**
- The generic framework (GBPM) originally developed for the Tevatron BPM upgrade is reused for the MI BPM upgrade project.

- GBPM defines some basic modules that can be used to compose a simple event-driven data acquisition system.
- The library provides active components *Control Task*,* DAQ Tasks,* *Alarm Task *and *Event Sources*; and passive components such as *Event Queues*, *Data Sources *and *Data Buffers*.

**MI BPM Extension**
**Multiple MI state support**: the front-end software receives the list of commands for an MI state from the controls network. The commands available are: filter, closed orbit, flash, turn-by-turn and raw.
- The MDAT line informs the next MI state, which is read when a TCLK event signaling state change is received. Based on the state information from MDAT, the control task programs the sequence of timers in the timing board to activate the commands and also configures the digitizers.

**Closed orbit measurements**: digitizer boards receive a trigger signal from the timing board every 2 ms. Simultaneously the timing board generates an interrupt that triggers the closed orbit readout by the closed orbit task. The measurements are stored in the closed orbit buffer and are copied to profile, display or user TCLK buffer.

**Turn-by-turn measurements: **the system configures the digitizers to take samples once every turn. The timing system is configured to generate triggers synchronously with the beam. Due to the high volume of data generated in this mode the readout is delayed until the end-of-beam TCLK is received, signaling that the MI state has finished. There are 500 ms available to transfer data from the digitizers into the processor memory.
- Turn-by-turn data is taken for injections and extractions (flash buffers) and for user configured measurements. There are also variations on this mode that allows the system to make turn-by-turn measurement on the first injection without relying on accelerator turn marker signals.

**Performance Measurements**
**Closed orbit:** 1.3 ms is used to acquire data (average of 40 turns); remaining time used for reading out data from digitizers, calculate position and copy data to other buffers as needed.
**Turn-by-turn:** data transfer from digitizers into the processor memory takes 150 ms (of the 500 ms available) for a full crate when transferring 12K data samples from each channel pair.
**Mode change:** the system must quickly change between modes of operation (closed orbit to turn-by-turn and vice-versa). The system is capable of switching between modes within 1.8 ms.

**Digitizer configuration: **the functionality of the device driver developed for the Tevatron BPM upgrade is used and extended for the MI BPM upgrade project. The digitizer is configured to generate four streams of data (figure 6): two for closed orbit data (2.5 MHz and 53 MHz) and two for turn-by-turn data (2.5 MHz and 53 MHz). The software selects which buffer to readout based on the sequence of commands for the MI state.