...
LEM (LINAC energy management) is a set of algorithms responsible for estimating the beam momentum profile and calculating the corresponding lattice quad settings. This code only calculates the momentum profile, errors and magnet settings. Actually setting magnets in the accelerator will be handled by a LEM server GUI (coming soon...)
Calculating the live
...
momentum profile
start with an estimated momentum profile based on reported klystron amplitudes & phases
Latex \[ E_{est}(s) = \sum_1^{N_{klys}(s)} ENLD_i cos(PDES_{SBST} + PDES_i)
The estimated momentum profile is unlikely to add up to exactly the correct energy, so we need to scale things by a fudge factor to match reality. Since the actual final energy of the beam in each linac is known form the bend magnet settings, we can calculate this number by comparing the estimated final energy to the actual energyuse the live momentum profile to calculate quad settings for the linac
Latex \[ f = E_{design}(end) / E_{est}(end) \quad \rightarrow \quad E_{live}(s) = f * E_{est}(s)
Calculating magnet settings
- From the use the live momentum profile to calculate quad settings for the linacfrom design momentum profile
- :
calculate a dimensionless "LEM error":
Latex \sigma_{LEM}(s) = E_{live}(s) / E_{design}(s)
calculate new magnet BDESes:
Latex BDES_{LEM} = \sigma_{LEM}(s) * BDES_{design}
- from design multipole coefficients (lcls style)
- get design multipole coefficients (k0_des, k1_des for bends/quads), and (effective) magnet lengths l_eff from the model
calculate the rigidity like so (where E_live is in GeV):
Latex \[ B\rho(s) = \frac{E_{live}(s)}{299.792458*10^4}
calculate new magnet BDESes
Latex BDES_{LEM} = B\rho * k_{design} * l_{eff}
F2 Live Model Server
The live model server runs its own BmadLiveModel
, and periodically writes live model data for NTTables accessible on the controls system via EPICS PVAccess. The code for the live model itself is relatively simple, and is derived from the lcls_live_model server.
...