From 3d00ee03406e0616fe6ebfeff87a57e25edd558b Mon Sep 17 00:00:00 2001
From: Gamelin Alexis <gamelin@synchrotron-soleil.fr>
Date: Fri, 27 Nov 2020 15:30:12 +0100
Subject: [PATCH] Bugfix : now return the correct voltage

---
 vlasov/beamloading.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vlasov/beamloading.py b/vlasov/beamloading.py
index 67a863c..07688a1 100644
--- a/vlasov/beamloading.py
+++ b/vlasov/beamloading.py
@@ -181,7 +181,7 @@ class BeamLoadingVlasov():
         Vtot = 0
         for i in range(self.n_cavity):
             cavity = self.cavity_list[i]
-            Vtot += cavity.VRF(z, self.F[i], self.PHI[i])
+            Vtot += cavity.VRF(z, self.I0, self.F[i], self.PHI[i])
         return Vtot
     
     def dV(self, z):
@@ -189,7 +189,7 @@ class BeamLoadingVlasov():
         Vtot = 0
         for i in range(self.n_cavity):
             cavity = self.cavity_list[i]
-            Vtot += cavity.dVRF(z, self.F[i], self.PHI[i])
+            Vtot += cavity.dVRF(z, self.I0, self.F[i], self.PHI[i])
         return Vtot
     
     def ddV(self, z):
@@ -197,7 +197,7 @@ class BeamLoadingVlasov():
         Vtot = 0
         for i in range(self.n_cavity):
             cavity = self.cavity_list[i]
-            Vtot += cavity.ddVRF(z, self.F[i], self.PHI[i])
+            Vtot += cavity.ddVRF(z, self.I0, self.F[i], self.PHI[i])
         return Vtot
     
     def deltaVRF(self, z):
@@ -205,7 +205,7 @@ class BeamLoadingVlasov():
         Vtot = 0
         for i in range(self.n_cavity):
             cavity = self.cavity_list[i]
-            Vtot += cavity.deltaVRF(z, self.F[i], self.PHI[i])
+            Vtot += cavity.deltaVRF(z, self.I0, self.F[i], self.PHI[i])
         return Vtot
     
     def plot_dV(self, z1=None, z2=None):
-- 
GitLab