Skip to content
Snippets Groups Projects
Commit 4109b3df authored by Alexis GAMELIN's avatar Alexis GAMELIN
Browse files

Improve Synchrotron.synchrotron_tune

Synchrotron.synchrotron_tune can now compute the synchrotron tune for single or multi-harmonic RF systems using linear approximation.
parent ca7ae18c
No related branches found
No related tags found
No related merge requests found
......@@ -85,8 +85,8 @@ class Synchrotron:
Methods
-------
synchrotron_tune(Vrf)
Compute synchrotron tune from RF voltage.
synchrotron_tune(V)
Compute the synchrotron tune for single or multi-harmonic RF systems.
sigma(position)
Return the RMS beam size at equilibrium in [m].
eta(delta)
......@@ -317,23 +317,58 @@ class Synchrotron:
self.optics.dispersion(position)[3]**2*self.sigma_delta**2)**0.5
return sigma
def synchrotron_tune(self, Vrf):
def synchrotron_tune(self, V, phase=None, harmonics=None):
"""
Compute synchrotron tune from RF voltage
Compute the synchrotron tune for single or multi-harmonic RF systems.
Hypthesis:
- Use the linear approximation (tau ~ 0).
- For higher haromics only, cos(phi) ~ 0 must be true.
Parameters
----------
Vrf : float
Main RF voltage in [V].
V : float or array-like of float
RF voltage in [V].
phase : float or array-like of float, optional
RF phase using cosine convention in [rad].
Default is None.
harmonics : int or array-like of int, optional
Harmonics of the cavities to consider.
Default is None.
Usage
-----
- If a single voltage value is given, compute the synchrotron tune for
a single RF system set at the synchronous phase.
- If a single pair of voltage/phase value is given, compute the
synchrotron tune for a single RF system.
- Otherwise, compute the synchrotron tune for a multi-harmonic RF
system.
Returns
-------
tuneS : float
Synchrotron tune.
Synchrotron tune in the linear approximation.
"""
phase = np.pi - np.arcsin(self.U0 / Vrf)
tuneS = np.sqrt( - (Vrf / self.E0) * (self.h * self.ac) / (2*np.pi)
* np.cos(phase) )
if isinstance(V, float) or isinstance(V, int):
V = [V]
if phase is None:
phase = [np.arccos(self.U0/V[0])]
elif isinstance(phase, float) or isinstance(phase, int):
phase = [phase]
if harmonics is None:
harmonics = [1]
if not (len(V) == len(phase) == len(harmonics)):
raise ValueError("You must provide array of the same length for"
" V, phase and harmonics")
Vsum = 0
for i in range(len(V)):
Vsum += harmonics[i] * V[i] * np.sin(phase[i])
phi = np.arccos(1 - self.eta(0) * np.pi * self.h / self.E0 * Vsum)
tuneS = phi / (2 * np.pi)
return tuneS
def get_adts(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment