From 2e2d019dc26380c46f81e235480b026fd7789c06 Mon Sep 17 00:00:00 2001
From: Gabriel Fedel <gabriel.fedel@ess.eu>
Date: Sun, 13 Jun 2021 18:28:39 +0200
Subject: [PATCH] Improve the way to generate "Beam pulses"

Keep the Beam delay fixed as 0.5, and beam width will always
be 90% of RF pulse - Beam Delay.
This way we always have valid beam pulses and the beam end
never falls out at the same moment than RF end
---
 .../evrislandApp/Db/evr-island.template       | 27 ++++++++-----------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/evrisland-loc/evrislandApp/Db/evr-island.template b/evrisland-loc/evrislandApp/Db/evr-island.template
index 4cbe1b4..3301b41 100644
--- a/evrisland-loc/evrislandApp/Db/evr-island.template
+++ b/evrisland-loc/evrislandApp/Db/evr-island.template
@@ -74,9 +74,11 @@ record(ao, "$(P)$(R=)RFSyncWdt-SP") {
 
 record(ao, "$(P)$(R=)BeamPulseDly-SP") {
     field(DESC, "Beam Pulse Delay")
-    field(VAL,  "300")
+    field(VAL,  "0.5")
     field(EGU, "us")
     field(DISP, "1") # Locked for this IOC version
+    field(PINI, "YES")
+    field(PREC, "3")
     info(autosaveFields_pass0, "VAL")
 }
 
@@ -85,26 +87,19 @@ record(ao, "$(P)$(R=)BeamPulseWdt-SP") {
     field(DESC, "Beam Pulse Width")
     field(VAL,  "2700")
     field(EGU, "us")
+    field(PREC, "3")
     info(autosaveFields_pass0, "VAL")
 }
 
-## Set Beam Delay and Width
+## Set Beam  Width
 
-# If rf pulse > beam pulse, set beam delay to 0.1
-record(calcout, "$(P)$(R=)#SetBeamDelay"){
-    field(INPA, "$(P)$(R=)RFSyncWdt-SP CP")
-    field(INPB, "$(P)$(R=)BeamPulseWdt-SP")
-    field(CALC, "A-B>1?A-B:0.1")
-    field(OUT, "$(P)$(R=)BeamPulseDly-SP PP")
-    field(FLNK, "$(P)$(R=)#SetBeamWidth")
-}
-
-# Always set beam width as rf pulse - beam delay - 0.5
-# So the beam end is always behind pulse end
+# Always set beam width as 90% of the Rf len - Beam Pulse Dly
+# The Beam Pulse Wdt never can fall out at the same moment as
+# RF End
 record(calcout, "$(P)$(R=)#SetBeamWidth"){
-    field(INPA, "$(P)$(R=)BeamPulseDly-SP")
-    field(INPB, "$(P)$(R=)RFSyncWdt-SP")
-    field(CALC, "(B-A)-0.5")
+    field(INPA, "$(P)$(R=)RFSyncWdt-SP CP")
+    field(INPB, "$(P)$(R=)BeamPulseDly-SP PP")
+    field(CALC, "(A-B)*0.9")
     field(OUT, "$(P)$(R=)BeamPulseWdt-SP PP")
 
 }
-- 
GitLab