def test_3(self): CL = LHCCavityLoop(self.rf, self.profile, f_c=self.f_c, G_gen=1, I_gen_offset=0.2778, n_cav=8, n_pretrack=0, Q_L=20000, R_over_Q=90, tau_loop=650e-9, tau_otfb=1472e-9, RFFB=self.RFFB) CL.track_one_turn() # Steady-state antenna voltage [MV] V_ant = np.mean(np.absolute(CL.V_ANT[-10:])) * 1e-6 self.assertAlmostEqual(V_ant, 0.99635982, places=7) # Updated generator current [A] I_gen = np.mean(np.absolute(CL.I_GEN[-CL.n_coarse:])) self.assertAlmostEqual(I_gen, 0.2778000000, places=10) # Generator power [kW] P_gen = CL.generator_power()[-1] * 1e-3 self.assertAlmostEqual(P_gen, 69.4555560000, places=10)
plt.ylabel('Macroparticles [1]') plt.show() logging.info( 'Initialising LHCCavityLoop, tuned to injection (with no beam current)') logging.info('CLOSED LOOP, no excitation, 1 turn tracking') # DUMMY TO CALCULATE PEAK BEAM CURRENT CL = LHCCavityLoop(rf, profile, f_c=rf.omega_rf[0, 0] / (2 * np.pi), G_gen=1, I_gen_offset=0, n_cav=8, n_pretrack=2, Q_L=35000, R_over_Q=R_over_Q, tau_loop=650e-9, RFFB=LHCRFFeedback(open_loop=False, open_otfb=True, G_a=6.8e-6, G_d=10, excitation=False)) if PLOT_NO_BEAM: plt.figure('Generator current') plt.plot(np.real(CL.I_GEN), label='real') plt.plot(np.imag(CL.I_GEN), label='imag') plt.xlabel('Samples [at 40 MS/s]') plt.ylabel('Generator current [A]') plt.figure('Antenna voltage')
beam = Beam(ring, N_p, N_b) profile = Profile(beam, CutOptions(n_slices=100), FitOptions(fit_option='gaussian')) logging.info( 'Initialising LHCCavityLoop, tuned to injection (with no beam current)') logging.info('CLOSED LOOP, no excitation, 1 turn tracking') CL = LHCCavityLoop( rf, profile, f_c=rf.omega_rf[0, 0] / (2 * np.pi), G_gen=1, I_gen_offset=0, n_cav=8, n_pretrack=1, Q_L=20000, R_over_Q=45, tau_loop=650e-9, #T_s=25e-9, RFFB=LHCRFFeedback( open_loop=False, G_a=6.8e-6, G_d=10, #G_a=0.00001, G_d=10, excitation=False)) logging.info('Initial generator current is %.4f A', np.mean(np.absolute(CL.I_GEN[0:10]))) logging.info('Samples (omega x T_s) is %.4f', CL.samples) logging.info('Cavity response to generator current') logging.info('Antenna voltage is %.10f MV', np.mean(np.absolute(CL.V_ANT[-10:])) * 1.e-6) logging.info('Final generator current is %.10f A', np.mean(np.absolute(CL.I_GEN[-10:])))
# Logger for messages on console & in file Logger(debug=True) ring = Ring(C, alpha, p_s, Particle=Proton(), n_turns=1) rf = RFStation(ring, [h], [V], [dphi]) beam = Beam(ring, N_p, N_b) profile = Profile(beam, CutOptions(n_slices=100), FitOptions(fit_option='gaussian')) logging.info('Initialising LHCCavityLoop, tuned to injection (with no beam current)') CL = LHCCavityLoop(rf, profile, G_gen=1, f_c=rf.omega_rf[0,0]/(2*np.pi), I_gen_offset=0.2778, n_cav=8, Q_L=20000, R_over_Q=45, tau_loop=650e-9, n_pretrack=1, RFFB=LHCRFFeedback(open_drive=True, G_a=0.00001)) logging.info('Initial generator current is %.4f A', np.mean(np.absolute(CL.I_GEN[0:10]))) logging.info('Samples (omega x T_s) is %.4f', CL.samples) logging.info('Cavity response to generator current') logging.info('Antenna voltage is %.10f MV', np.mean(np.absolute(CL.V_ANT[-10:]))*1.e-6) plt.figure('Generator current (to cav)') plt.plot(np.real(CL.I_GEN), label='real') plt.plot(np.imag(CL.I_GEN), label='imag') plt.xlabel('Samples [at 40 MS/s]') plt.ylabel('Generator current [A]') plt.figure('Generator current (to gen)') plt.plot(np.real(CL.I_TEST), label='real') plt.plot(np.imag(CL.I_TEST), label='imag')