Overview
=========

1.0 RF Measurements
===========================================
1.1 Vector_Sum_Measurement
1.2 Incident_and_Reflected_Wave_Meas.
1.3 Forward and reflected power measurements
1.3 QL_and_Detuning_Meas.
1.4 Beam_Phase and beam current
1.5 Loop Gain and Loop Phase Measurement
1.6 Gamma_Dose_Rate
1.7 Neutron_Flux

2.0 RF Calibration
===========================================
2.1 Vector_Vector_Sum_Cal._Single_Bunch
2.2 Vector_Sum_Cal._Moderate_Current
2.3 Vector_Sum_Cal._High_Current
2.4 Vector_Inc._Ref._wave_Calibration
2.5 Vector_Gradient_Phase_Calibration
2.6 Neutron_Dosimetry_Calibration
2.7 Gamma_Dosimetry_Calibration

3.0 RF Field Control
===========================================
3.1 Set_Point generator
3.2 Simple_Feedforward
3.3 Adaptive/predictive_Feedforward
3.4 Redundant_Feedforward
3.5 Universal_Controller
3.6 Optimal_Controller

4.0 Cavity Resonance Control
===========================================
4.1 Slow_Cav._Freq._Control
4.2 Lorentz_Force_Compensation with fast piezo tuner
4.3 Bypass_and_Tune_Cavity (wide range tuning)

5.0 Subsystem Control
===========================================
5.1 Klystron_Linearization
5.2 Timing_Control
5.3 Klystron_Power_Overhead_Management
5.4 Adjust_Phase_of_Incident_Wave
5.5 Adjust_Loaded_Q

6.0 Subsystem Characterization
===========================================
6.1 Low Level RF System
6.2 Klystron_Characterization
6.3 Downconverter_Characterization
6.4 Cavity_Operational_Limits
6.5 System_Identification
6.6. Incident_wave_phase_shifter
6.7 Input power coupler coupling

7.0 Exception Detection
===========================================
7.1 Cavity_Quench
7.2 SEU_Hangup_or_corrupt_data
7.3 Signal_Integrity_Violation
7.4 Cavity_Operational_Limit_Exceeded
7.5 Klystron_Power_Overhead_Low

8.0 Exception Handling
===========================================
8.1 Recover_Cavity_Quench
8.2 Recover_SEU_Hangup
8.3 Adjust klystron overhead 

9.0 LLRF Diagnostic
===========================================
9.1 Configuration_Status
9.2 Calibration_Status
9.3 Field_Regulation_Performance_Monitor
9.4 Event Generation
9.5 Alarm generation
9.6 Warning generation
9.7 Fault statistics

10.0 Linac RF Global Control
===========================================
10.1 Momentum_Management
10.2 Beam_Energy_Feedback
10.3 Beam_Arrival_Feedback
10.4 Bunch Compression feedback

11.0 General_Functionality
===========================================
11.1  Hot-swap capability
      (System must continue operation while board is exchanged 
11.2  Framework for automation of procedures must be implemented
11.3  Event pushing capability (needed for automation)

Abbreviations:
.. Note for information
C1: required for commissioning
    ... subsystems installed in the accelerator
C2: required for initial operation
C3: required for advanced operation
C4: desirable future upgrade
F: benefit for field regulation
O: benefit for operability
A: benefit for availability
L: benefit for lifetime of components
D: benefit for diagnostics
M: benefit for maintainability
P: prerequisite for many other functions
+. ++, +++ : level of benefit (example F++)
PXZ: Personmonth of effort for function (example: P06 = 6 months)
     Note 1: effort includes everything from documenting requirements
     to commissioning in the accelerator.
     Note 2: Usually demonstrating the principle of a function is only
     a small fraction of the total effort.


Detailed list:
==============

RF Measurements
===========================================
RF Measurements are the basis for feedback control of the cavity 
field and cavity resonance as well as RF system monitoring.
Besides the directly accessible rf signals such as cavity probe signal,
forward wace, and reflected wave there are many derived signals
such as cavity loaded Q and cavity detuning.

1.1 Vector_Sum_Measurement
-------------------------------------------
The measured vector-sum of one rf station (usually 32 cavities)
is the necessary pre-requisite for field stabilization. Both - 
feedback and feedforward algorithms - will  attempt to control 
the measured vector-sum to the vector-sum setpoint
table. The vector-sum will be measured as I&Q and will be converted in 
amplitude and phase. 
For each cryomodule partial vector-sums of 8 cavities are calculated 
and added to the total vector-sum of the rf station. Also the
vector-sums of linac section will be available for crosscheck with the
measured energy gain of the associated section.

.. vector-sum needed for feedback and for adjustments for feedforward
.. measured vector-sum must agree with vector-sum seen by beam

- (C1) individual cavity field measurements
  .. needed for vector-sum calculation
- (C2) phase drift compensation of field measurement
  .. using 
  .. using calibration reference channel (8+1)
- (C2) amplitude drift correction of field measurements
- (C3) optional calculation from forward and reflected power
- (C2) linearization of downconverters
- (C4) measure level of non-linerarity (generate exception flag)
  .. warning to operator if VS is degraded by non-linearity of downconverter
- calculate cavity field vector from forward and reflected power
- broad band measurement of individual cavities (full sample rate)
  for diagnostics (excitation of passband modes etc.)
- level adjustment for downconverter
- buffering of data in 16 buffers for each pulse sequence



1.2 Incident_and_Reflected_Wave_Meas.
-------------------------------------------
The incident an reflected wave measurements are essential for the calibration
of the LLRF signals and the basis for exception detection and handling in the
high power section. The signals include phase information and amplitudes of the
waves (in units of sqrt(kw) ) are used since the cavity excitation is proportional
to the amplitude of the incident signals. Forward and reflected power are measured
at the direcctional coupler ports which have a pour directivity of the order of 20 dB.
Therefore it is necessary to correct the signals for the directivity of the couplers.
Forward and reflected power are measured for individual cavities but also as total
total output power signal at each klystron arm.

- detection of forward and reflected rf wave as vector
- correction for directivity
- calibration of incident and reflected wave in sqrt(kW)
- phase calibration with respect to the beam
- calibration of power in kW
- correction for downconverter non-linearity
- characterization of directivity of the directional coupler

1.3 Forward and reflected power measurements
-------------------------------------------
Precise measurements of incident and reflected wave are required for the vector-sum
calibration based on beam loading in closed loop. The signals from the directional
coupler must be corrected for directivity and calibrated in sqrt(kW). RF power 
measurements are required for the individual cavities, for klystron total power 
(output of each arm), the monitor points in the drive chain and various reference
signals.

- measure incident and reflected power for each cavity including correction for 
  directivity.
- measure total forward and reflected power at each klystron arm
- measure rf signals in drive chain
- maesure rf amplitude and phase of reference signals

1.3 QL_and_Detuning_Meas.
-------------------------------------------
The measurement of loaded Q and cavity detuning provide essential information
for the operation of the low level rf systems. The cavity loaded Q determines
the fill and steady state field characteristics while the detuning has an
impact on the phase and amplitude of the cavity field. 

- measurement of loaded Q at the end of the rf pulse
- measurement of detuning at the end of the rf pulse
- measurement of the time varying detuning after the pulse
- measurement of the time varying loaded Q after the pulse 
- real time measurement of the detuning during the pulse
- real time loaded Q measurement during the pulse
- high resolution measurement of loaded Q for quench detection
- high resolution measurement of cavity detuning during filling for 
  microphonics control


1.4 Beam_Phase and Beam current
-------------------------------------------
Knowledge about beam phase and beam current is essential for proper beam loading
compensation and setting the correct phase for acceleration. Since the phase of 
the beam with respect to the rf is initially not known (arbitrary phase offset from
cables and reference signals) it must be calibrated using beam loading effects or
beam energy measurements (see vector-sum calibration). It is however necessary to
use all available information (beam arrival time, toroids, calculation from beam
loading etc.) to estimate the beam phase and current.

- estimate beam phase and current from beam diagnostics
- estimate beam phase and current from special diagnostics
- estimate beam loading from rf signals

1.5 Loop Gain and Loop Phase Measurement
-------------------------------------------
Correct loop phase and loop gain settings are essential for stable
feedback operation and good field error suppression. Since loop gain
and loop phase depend on the klystron voltage setting and the klystron
output power, it will be necessary to constantly monitor  and if necessary
correct loop phase and loop gain.

- measure loop phase at beginning and end of rf pulse
- measure loop gain at beginning and end of rf pulse
- measure loop phase during the rf pulse
- measure loop gain during the rf pulse 


1.6 Gamma_Dose_Rate
-------------------------------------------
THe gamma dose rate resulting from field emission must be monitored on-line in 
realtime to prevent excessive radiation dose rate to damage the elecronics in 
the tunnel. The cavity gradients must be limited to limit the dose rate to about
0.1 mSv/hour to guarantee a lifetime of the electronics of 10 years (~1e5 hours).
The damage level for the most sensitive electronics is of the order of 10-100 Gy
and leakage current.

- measure dose rate with resolution of 0.1 mSvr/hour.
- determine the correlation of gamma dose rate and leakage current in 
  the LLRF electronics


1.7 Neutron_Flux
-------------------------------------------
The neutrons generated as photo-neutrons from the field emission will generate SEU 
in the LLRF digital  feedback system. Therefore the neutron fluence will strongly 
increase with the cavity gradient. This can lead to corrupt data or system hang-up.
Since the  SEU rate is proportional to the neutron fluence, it is desirable to monitor
the neutron fluence and limit the operating gradients as necessary. A neutron fluence
of 1e4/cm^2/sec will result in a few SEU events per day in the LLRF electronics of one
rf station. Displacement damage is expected to start at 1e11 n/cm^2.

- measure neutron fluence with resolution of 1e3 neutron/ cm^2 / hour
- determine the correlation of neutron fluence and system hang/ups and corrupt data
- automated recovery of neutron flux detector from SEU


2.0 RF System Calibration
===========================================
Calibration of the LLRF system parameters is essential to ensure
good field control and operability. While many calibrations can be
performed within the LLRF system (some require beam loading) others
requires information from beam diagnostics or rely on the calibration
of other subsystems.


2.1 Vector_Vector_Sum_Cal._Single_Bunch
-------------------------------------------
During commissioning of an accelerator section or after a (long) shut-down,
the phase of the cavity field with respect to the beam will not be well
defined or guaranteed. Therefore it will be necessary to calibrate (i.e.
measure) the phase of the accelerating field with respect to the beam.
Since large phase errors in the cavity fields can result in beam loss (due to
large energy errors) it is desirable to calibrate the cavity phase with
a bunch bunches to minimize beam loss and the resulting activation of the
the accelerator environment. The single bunch vector-sum calibration requires
special electronics to detect the transient of single bunches. The goal is
a coarse calibration (+-few degrees) with a single bunch.

- capture transient data from single bunch transient
- determine amplitude and phase of a single bunch transient of 1-3 nC.
- average many measurements to improve accuracy
- calibration using energy measuremen from beam diagnostics 
- correlation measurement of cavity detuning with energy measurement
- use data from short bunch train (<=30) for improved accuracy 
  during single pulse.
- continous online phase monitoring with individual bunches


2.2 Vector_Sum_Cal._Moderate_Current
-------------------------------------------
While the single bunch vector-sum calibration can provide a coarse calibration of
the cavity phase, more precise measurements can be achieved with moderate beam current
(100 - 300 nC per short bunch train (<= 60 us).

- vector-sum calibration with moderate current beam transient in open loop
- vector-sum calibration with moderate current beam transient in closed loop
- vector-sum calibration with klystron off (i.e. no klystron power)  


2.3 Vector_Sum_Cal._High_Current
-------------------------------------------
At high currents the calibration will be more precise due to the higher beam
induced voltage. For long bunch trains the signals will be close to steady
state conditions therefore simplifying the algorithm. Since the measurement must
be performed in closed loop precise measurements of forward and reflected power
are required. This includes the correction for the directivity of the forward and
reflected power couplers.

- measurement of beam phase with respect to cavity voltage
  in closed loop with knowledge of beam current.
- measurement of beam current and beam phase with respcted to cavity voltage
  in closed loop without knowledge of beam current.
- calibration based on beam energy measurement at end of linac section
- calibration based on beam energy measurements along the linac section
  based difference orbit measurements.
- calibration based correlation measurement modulating cavity detuning and
  measure autocorrelation with beam energy. 


2.4 Vector_Inc._Ref._wave_Calibration
-------------------------------------------
Precise measurements of incident and reflected wave are required for the vector-sum
calibration based on beam loading in closed loop. The signals from the directional
coupler must be corrected for directivity and calibrated in sqrt(kW).

- calibrate incident and reflected wave in sqrt(kW)
- display forward and reflected power in kW (per cavity) 
  and MW for the total klystron power
- RF Gun: calibrate power in sqrt(kW), MW and induced field (MV/m)


2.5 Vector_Gradient_Phase_Calibration
-------------------------------------------
While the vector-sum calibration ensures the the cavities are calibrated
with respect to each other (i.e. relative phase and relative amplitude are
correct) the measured vector-sum must be calibrated with respect the 
actual beam, a reference beam (derived from the master oscillator) and
the accelerator wide phase reference.  

- calibrate vector-sum phase with respect to the beam phase reference
- calibrate vector-sum phase with respect to the reference beam
- calibrate vector-sum phase with respect to the actual beam
- calibrate vector-sum voltage based on beam loading
- calibrate vector-sum voltage based on energy measurement
- beam phase measurement based on beam loading
- beam phase measurement based on energy measurement
- update database with calibration coefficients
- estimate calibration error from statistics of measurement
- estimate calibration error from beam diagnostics measurement


2.6 Neutron_Dosimetry_Calibration
-------------------------------------------
The neutron fluence must be calibrated to ensure that displacement damage
(starts at 1e11 n/cm^2) does not occur during the 10 year lifetime of the 
electronics. Furthermore a  calibrated  neutron flux allows to estimate the
expected frequency of SEU during accelerator operation,

- calibration with bubble dosimeters
- calibration with calibrated electronics
- update database with calibration coefficients


2.7 Gamma_Dosimetry_Calibration
-------------------------------------------
The gamma dose rate must be calibrated to ensure a life time of the electronics of 10 year.
The calibration will be performed with TLDs which are placed at representative locations.
The TLDs can be removed from the accelerator tunnel during a maintenance day.

- calibrate gamma dose rate in Gy/h
- calibrate daily/monthly/total dose in Gy
- up-date database with calibration coefficients 


3.0 RF Field Control
===========================================
The control of the cavity fields is essential for stable beam operation.
In the XFEL the vector-sum of the fields in the up to 32 cavities in each
rf station is controlled. Since the measured vector-sum deviates slightly
from the vector-sum field experienced by the beam, a precise calibration
of the measured vector-sum is required.
 

3.1 Set_Point generator
-------------------------------------------
Generates setpoint curves from basic parameter set:
1. RF station voltage
2. RF station phase
3. Fill time (contant DAC drive)
4. Start-fill time
5. Flat-top duration

- constant power (actual incident) fill curve
- constant phase (actual incident) fill curve 
- time varying fill phase (follow average cavity resonance)


3.2 Simple_Feedforward
-------------------------------------------
The simple feedforward will generate feedforward tables based on the input of
a few parameters. It will provide a feedforward table which generates a field
close to the setpoint. The tables will automatically scale with the setpoint amplitude
and phase. Beam loading information (expected beam current and phase) will be used to
compendate beam loading. It is assumed that Lorentz force detuning is active and 
reduces the detuning to +-20 Hz. Typical input parameters are:
1. start time rf pulse
2. cavity fill time
3. flat top duration
4. incident wave amplitude during flat-top
5. ratio of incident wave amplitudes flat-top/filling
6. beam start time
7. beam pulse duration
8. beam current
9. beam phase

- automated scaling from setpoint changes
- automated beam loading compensation for expected beam
- automated beam loading compensation from measured beam (toroid and BAM)
- time shift of complete rf pulse
- setpoint for constant beam energy at exit of linac section


3.3 Adaptive/predictive_Feedforward
-------------------------------------------
The adaptive feedforward compensates the repetitive component of field
errors using the measured vector-sum, the setpoint table for the vector-sum
and the incident wave (DAC and measured). Additional information such as 
beam loading and energy feedback will be required.

- adaptive feedforward based on system identification
- adaptive feedforward based on time reversed field error filtering
- adaptive feedforward using real time beam current information from toroids
- predictive feedforward using anticipated 
- comparison of measured error with error from model

3.4 Redundant_Feedforward
-------------------------------------------
In the case of unrecoverable problems with the field controller 
(feedback + feedforward) the LLRF system must switch to the redundant
feedforward to ensure high availability at reduced field stability.

- detect field controller problem and switch to redundant feedforward
- use current cavity drive signal
- use remaining field measurements to estimate correct feedforward
- use beam energy to adapt feedforward table


3.5 Universal_Controller
-------------------------------------------
The universal controller supports besides field regulation other functionality
needed for example for wide range cavity tuning and off-resonance coupler
conditioning. It supports self-excited loop operation, generator driven control
and various combinations of feedback and feedforward.

- vector-sum error calculation
- feedback controller filter
- feedforward control
- IQ, AP, and AQ control
- Self-excited loop, GDR, and VCO mode
- limiter ( for klystron output power)


3.6 Optimal_Controller
---------------------------------------------
The optimal controller is designed for best field regulation and robustness
(insensitivity against parameter changes). It supports MIMO controllers as
well as traditional PID controllers for for field vector control.

- Implementation of staionary MIMO controller
- Simulation of stability before loading
- Gain management for testing
- Build-in system identification for black and grey box models
- Combination of adaptibe feedback and adaptive feedforward


4.0 Cavity Resonance Control
===========================================
The cavity resonance must be controlled to tightly to ensure efficient
power tranfer to the beam, good field stability or to take cavities
off-line.


4.1 Slow_Cav._Freq._Control
-------------------------------------------
The cavity resonance frequency needs to be close to the operating frequency
to minimize the power required for acceleration and field control. In the case
of off-crest operation (such as in the injector) a small detuning will necessary.
Since the rf power requirements increase with the square of detuning it is desireable 
to maintain the resonance frequency within 10% - 20% of the cavity bandwidth 
(typically 200 Hz for a loaded Q of 1e6).

- tune cavity to the operating frequency or some offset 
  within  +-delta_f_min if detuning offset exceeds +-delta_f_max
- detune cavity by up to +-10 bandwidth


4.2 Lorentz_Force_Compensation with fast piezo tuner
-------------------------------------------
Dynamic Lorentz force compensation is accomplished with the fast piezo tuner.
Also small offsets (+-30 Hz) are corrected by the piezo tuner to improve motor
tuner lifetime.

- compensate Lorentz force detuning with single pulse
  adaptive feedforward during flat-top 
  (requires a few pulses to adapt)
- compensate Lorentz force detuning with single pulse predictive feedforward
  (compensates already first pulse)
- compensate Lorentz force with resonant excitation (adaptive FF)
- compensate Lorentz force with resonant excitation (predictive FF)
- store and retrieve compensation patterns for standard pulses in database
- compensate small frequency offset (drift of resonance frequency or change in
  gradient).
- lifetime management of piezo tuner 
- piezo sensor signal conditioning
- feedback for microphonics control (using piezo sensor)
- active damping following resonant compensation
- correlation measurement detuning - piezo sensor signal


4.3 Bypass_and_Tune_Cavity (wide range tuning)
-------------------------------------------
The cavity frequency tuner has a tuning range of about +- 300 kHz.
If a cavity needs to be taken off-line (i.e. no gradient even with 
beam loading) it is desirable to detune the cavity by many bandwidth
(for example 200 kHz detuning corresponds to 1000 x the cavity
bandwidth of 200Hz). In this case the steady state excitation is only
of the order of 1e-3. Since the detuning measurement requires field
levels of a least 0.3 MV/m (better a few MV/m) the cavity must be
excited in the SEL mode, sweep mode or using pseudo random excitation.

Basic functionality
- measure or estimate detuning
- operate frequency by estimating 

Optional functionality

- wide range tuning with self-excited loop operation 
  (each cavity separately)
  ... allows instant monitoring of resonance frequency (every pulse)
- wide range tuning during beam operating (switch briefly
  to SEL after beam pulse).
  ... allows continued beam operation
- wide range tuning measurement with sweep mode 
  ... measurement speed about 2 kHz / pulse 
- wide range tuning measurement with pseudo random excitation
  ... measurement speed about 20 kHz / pulse
- tune wide range with motor tuner (estimating resonance frequency
  change from tuner sensitivity and tuner motor heating).


5.0 Subsystem Control
===========================================

5.1 Klystron_Linearization
-------------------------------------------
The klystron output power is usually specified at klystron saturation.
For field control it is therefore necessary to operate the klystron
below saturation. The feedback gain is also a function of the klystron
output power since the incremental (or differential) gain (defined
as the slope of the output versus input power curve) decreases 
continually towards the saturation point. For operation close to klystron
saturation it is therefore necessary to linearize the klystron at
the controller output in amplitude and phase.

- klystron linearization using a mapping matrix (interpolation) for
  a fixed high voltage setting
- klystron linearization with polynomial approximation
- klystron linearization with time varying high voltage
- klystron saturation curve simulation (for test purposes)
- fast phase control loop around the klystron
- fast gain control loop around the klystron

5.2 Timing_Control
-------------------------------------------
Correct timing of many LLRF parameters and the related subsystem is necessary
to ensure the best performance of the LLRF control system. When changing the
accelerator parameters it will be necessary to change timing parameters accordingly.
Therefore precise and independent relative timing control of various subsystems
will be necessary without the need to readjust system internal timings.

- HV of klystron with respect to begin of rf pulse
- complete rf station timing with respect to begin of bunch train
- rf station phase with respect to beam phase


5.3 Klystron_Power_Overhead_Management
-------------------------------------------
The available klystron power can be adjusted with the high voltage of the 
modulator. The level can be set to ensure sufficient power headroom
for field regulation or proposed parameter (gradient, beam current) 
changes. It can be also used to minimize AC power consumption and
trip rates.

- adjust klystron high voltage for sufficient power overhead for field regulation
- adjust klystron high voltage for sufficient power overhead for 
  proposed parameter changes (gradient, beam current)
- interlock against parameter changes for which available power is not sufficient
- determine gradient and beam current reserve for current and maximum HV setting


5.4 Adjust_Phase_of_Incident_Wave
-------------------------------------------
The phase of the incident wave of each cavity must be adjusted for maximum
rf power efficiency.

- set incident phase with respect to cavity 1 of each rf station
  with cavity 1 setting in mid-range.
- optimize phase shifter setting for maximum correction headroom


5.5 Adjust_Loaded_Q
-------------------------------------------
The loaded Q must be adjusted correctly for a ensure an efficient 
energy transfer to the beam, low sensitivity to microphonics,
propoer cavity filling and to minimize slopes on individual 
flat-tops.

- Adjust loaded Q to set value using the variable input coupler 
- Adjust loaded Q for minimum slopes on flat-top


6.0 Subsystem Characterization
===========================================
The characterization of various LLRF subsystems and external 
accelerator subsystem is required to allow for compensation
of variations in the response and the operating limitation
of these systems. 


6.1 Low Level RF System
-------------------------------------------

- latency from ADC to DAC
- latency communication links
- transferfunction of complete system (open and closed loop)


6.2 Klystron_Characterization
-------------------------------------------
The klystron saturation characteristics (incl. preamplifier)
must be known for the implementation of the klystron 
linearization. The characterization must be performed
for each klystron HV setting.

- measurement of characteristics around operating point
- full phase and amplitude characterization into load
- maximum range characterization with detuned cavities
- maximum range characterization 



6.3 Downconverter_Characterization
-------------------------------------------


6.4 Cavity_Operational_Limits
-------------------------------------------
Knowledge about the operational limits of each cavity is 
nessecary to prevent operation of the cavities aboce their
limits. This would reduce availability and field regulation. 

- determine quench limit
- determine limit for field emission
- save information about operational limits in the database


6.5 System_Identification
-------------------------------------------
System identification method are used to determine the physical
parameters in the rf system or the coefficients in a grey box or
black box model. Typical input information are probe, forward and
reflected power signal. Others include current and beam phase.

- determine linearized model for each cavity around various operating point
- determine linear model for ensemble of 32 cavities (vector-sum)
- determine non-linear model of cavities including Lorentz force
- determine beam phase and beam current
- determine loop gain and loop phase
- calibrate vector-sum

6.6. Incident_wave_phase_shifter
-------------------------------------------

- measure characteristics of phase shifter (phase shift vs position)
- save characteristics in database


6.7 Input power coupler coupling
-------------------------------------------

- determine loaded Q as function of coupler position
- save characteristics in database


7.0 Exception Detection
===========================================


7.1 Cavity_Quench
-------------------------------------------
Cavity quenches occurs when a cavity disspates a large amount
of rf power due to a part of the cavity surface becoming
normalconduction. This is equivalent to a drop in unloaded Q
from the nominal 1e10 value by a several up to a few orders of
magnitude. The result is a droop in the cavity voltage since a 
significant part of the rf power is dissipated in the cavity
walls.

- detect voltage droop (simple but can have other causes)
- detect voltage droop relative to other cavities
  .. correct for detuning and beam loading changes
- detect droop of loaded Q (precision 1% to 0.1%)
- estimate cryo-heat load (using Qo(E_acc) date).


7.2 SEU_Hangup_or_corrupt_data
-------------------------------------------
The neutrons fluence can result in SEU which can corrupt data or
lead to a system hang-up.

- Detect hang-up of system 
- detect corrupt data in memory


7.3 Signal_Integrity_Violation
-------------------------------------------
Inconsistency between signals (measured and control) indicates a problem
in the rf system which can lead to beam instability and/or beam loss.
Also malfunctions of subsystems can be diagnosed with the help of knowledge
about inconsistencies between signals. 

- disagreement between cavity field vector measured at probe and from forward
  and reflected power
- disagreements between cavity field vector and expectations from model
  (using incident wave, beam loading, loaded Q and time varying detuning)
- disagreement between forward power and cavity gradient (incl. beam loading)

7.4 Cavity_Operational_Limit_Exceeded
-------------------------------------------
Generate event if the cavity operational limit is exceeded

- cavity quench limit exceeded (peak gradient)
- cavity field emission limit exceeded
- cryo-heat load excessive
- coupler power limit exceeded


7.5 Klystron_Power_Overhead_Low
-------------------------------------------
Measurement of the klystron overhead is required to ensure sufficient
power for field regulation and parameter settings (gradient, beam current).

- Determine operation point of klystron for peak power and during flat-top.
- Generate flag if power overhead is low during operation
- generate exception flag if power overhead for proposed parameter change
  is too low.


8.0 Exception Handling
===========================================

8.1 Recover_Cavity_Quench
-------------------------------------------
Recovery from a cavity can be accomplished by lowering the gradient
in a specific or all cavities of one rf station. This can be 
accomplished by reduction of incident power, detuning of cavity
or adjustment in loaded Q and detuning.

- detune individual cavity
- lower gradient in individual cavities using QL and detuning
- lower vector-sum voltage in rf station and compensate with 
  increase in another rf station


8.2 Recover_SEU_Hangup
-------------------------------------------
In the case of a SEU hang-up, some part of the LLRF system will
hang-up i.e. is subsequently not available for rf control. If the
feedback system fails, a redundant simple feedforward (designed SEU
tolerant) will allow continued operation at reduced performance
until the feedback system has been recovered.

- switch to redundant feedforward
- recover CPU in ATCA crate
- recover piezo controller and driver
- recover feedback ATCA carrier boards and AMC cards.


8.3 Adjust klystron overhead 
-------------------------------------------
Set klystron overhead for current and upcoming operating
conditions.

- adjust power overhead for the current operating conditions
- adjust power overhead for expected beam loading changes
  during the current user run.
- adjust overhead for expected gradients and beam loading
  for the next upcoming users runs.
- minimize klystron overhead to reduce AC power needs. 


9.0 LLRF Diagnostic
===========================================
The LLRF system requires built-in diagnostics to ensure that
potential problems with hardware and software including the 
correctness of all parameters required for proper operation
can be detected in a timely manner without additional personpower
effort. 

9.1 Configuration_Status
-------------------------------------------
The configuration of the LLRF system defines its functionality and
is a necessary prerequisite for field regulation and high availability.

- configuration controller FPGA
- configuration field detection FPGA
- configuration communication links
- configuration piezo control


9.2 Calibration_Status
-------------------------------------------
The calibration of the LLRF  is a necessary prerequisite
for field regulation and the ease of operation.

- calibration vector-sum
- calibration loop-phase and loop-gain
- calibration cavity gradients and phases
- calibration of measurements for monitoring
- calibration of control signal
- compare calibration coefficient in LLRF system with database 


9.3 Field_Regulation_Performance_Monitor
-------------------------------------------
Monitoring of the field stability and correlation with other measurements
(beam diagnostics, subsystem parameters) allows better understanding of 
sources for beam instabilities. The information is useful to diagnose problems
and to identify the cause.

- field stability (rms, peak-peak, intra-pulse, pulse-to-pulse)
- field stability statistics
- field stability correlations
- correlation of vector-sum measurement with beam energy measurement
- 

9.4 Event Generation
-------------------------------------------
Events reflect LLRF conditions or a subsystem status that requires immediate action
from the operator or the LLRF automation. In some case the action is required within
the same pulse, in other cases pulse-to-pulse response or response within a 
few pulses will be sufficient

- cavity operable limit exceeded (quench or quench)
- vector-sum calibration error (cal. does not agree with reference)
- gamma dose rate very high (> 100 mGy/hour; field emission and beam loss)
- neutron fluence very high ( > 1e6 n/cm^2/hour)
- klystron operated at saturation
- feedback loop unstable (Oscillation)

9.5 Alarm generation
-------------------------------------------
Alarms indicate severe problems with one or more accelerator subsystems. If
beam quality is sufficient for user operation, no immediate action is required.
However machine setting should be changed for he next experiment to lower
the risk of potential operational problems. 

- downconverter operated at level higher or equal 1 dB compression point
- ADC input voltage exceeds maximum value (clipping)
- cavity detuning excessive ( > 0.5 bandwidth)
- klystron operated (peak power) closer than 5% from saturation
 

9.6 Warning generation
-------------------------------------------
Warnings inform the operator about marginal accelerator operating conditions,
subsystem problems, potential future failures or performance degradation.
No immediate action is necessary but decisions mut be made whether to 
continue the with the existing operating conditions.

- downconverter linearity warning (linearity <1e-2 )
- cavity operates closer than 1 MV/m at quench limit
- cavity operates closer than 1 MV/m from field emission limit
- gamma dose rate high
- neutron flux high
- cavity detuning excessive ( > 0.2 bandwidth)
- excessive slope on cavity gradient during flat-top (> 10%)
- klystron operated (peak power) closer than 20% from saturation
- klystron HV pulse stability ( > 0.5 % during flat-top)
- loop phase error
- loop gain low
- loop gain high
- range of phase adjustment for not sufficient


9.7 Fault statistics
-------------------------------------------
The fault statistics allows to optimize machine setting to minimize accelerator
downtime and subsystem degradation for maximum availability and best beam
stability.

- correlation klystron trips and forward power
- correlation coupler trips and forward power
- correlation cavity quenches and cavity gradient


10.0 Linac RF Global Control
===========================================


10.1 Momentum_Management
-------------------------------------------
The momentum management system will distribute the voltage in the rf stations
according to several criteriae to 

1. Minimize accelerator section trip rate 
   (cavities, couplers, klystron)
2. Minimize cryo heatload
3. Maximize voltage overhead
4. Best field control
5. Best robustness against parameter variations
6. Maximum availability


10.2 Beam_Energy_Feedback
-------------------------------------------
Beam energy feedback is required to reduce correct long-term 
amplitude and phase drifts of the order of deg. and % and
and fast field fluctuations of the order of 0.1 deg. and 0.1%
in the llrf control system.

- slow feedback on gradient setpoint 
- fast feedback (within pulse)
- feedback only on pilot bunches

 
10.3 Beam_Arrival_Feedback
-------------------------------------------
The beam arrival time feedback in the injector corrects for
arrival time jitter and drift caused by field fluctuations and drifts.
Beam arrival time information from special diagnostics is used  for
this feedback.

- arrival time entrance L2
- arrival time entrance L3
- decouple arrival time feedback from energy feedback
- exception detection and handling (error of arrival time signal)

10.4 Bunch Compression feedback
------------------------------------------- 
The compression feedback corrects bunch compression (i.e peak current)
reduction due to drift of amplitude and phase of the cavity fields. 

- bunch compression feedback

11.0 General_Functionality
-------------------------------------------

- Hot-swap capability
  (System must continue operation while board is exchanged 
- Framework for automation of procedures must be implemented
- event pushing capability (needed for automation)