Skip to content
Snippets Groups Projects
Commit 3e8ac74f authored by SAURET's avatar SAURET
Browse files

Simple feedback class

parent 929672e4
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 8 16:24:19 2022
@author: sauret
"""
from mbtrack2.tracking.element import Element
import numpy as np
class SimpleFB(Element) :
"""
Simple feedback system proceeding bunch by bunch correction to counter beam
instabilities
Parameters
----------
ring : Synchrotron object
damping_time : array of shape (3,), optional
Contains the desired damping time in seconds for each plane in the same
order sepcified in plane.
phase_diff : float, optional
Phase of the damper kick in degrees.
plane : bool array of shape (3,), optional
Allow to choose on which plane the feedback is active. State True to
turn on the feedback or False otherwise. Element 0 of the array defines
the longitunal plane as 1 and 2 define the horizontal and vertical plane
respectively.
"""
def __init__(self, ring,phase_diff = 90, damping_time = np.array([2e-3,2e-5,2e-5]),plane = np.ones((3,), dtype= bool)):
self.ring = ring
self.damping_time = damping_time
self.phase_diff = phase_diff
self.plane = plane
@Element.parallel
def track(self, bunch):
"""
Tracking method for the feedback system
No bunch to bunch interaction, so written for Bunch object and
@Element.parallel is used to handle Beam object.
Parameters
----------
bunch : Bunch or Beam object
"""
if(self.plane[0] == True):
bunch["delta"] -= (2*self.ring.T0/self.damping_time[0])*np.sin(self.phase_diff)*bunch.mean[5]
if(self.plane[1] == True):
bunch["xp"] -= (2*self.ring.T0/self.damping_time[1])*np.sin(self.phase_diff)*bunch.mean[1]
if(self.plane[2] == True):
bunch["yp"] -= (2*self.ring.T0/self.damping_time[2])*np.sin(self.phase_diff)*bunch.mean[3]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment