Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.

Commit 6110054

Browse files
Merge branch 'support' into devel
2 parents 38691c2 + e811ddd commit 6110054

16 files changed

+2296
-15
lines changed

FOFBApp/Db/FOFBData.template

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,12 @@ record(ao,"$(S)$(RTM_CHAN)$(OFFSET)-SP"){
4949
field(DESC,"set waveform offset")
5050
field(PINI,"YES")
5151
field(SCAN,"Passive")
52-
field(PREC,"15")
5352
field(FLNK,"$(S)$(RTM_CHAN)$(OFFSET)-RB CPP NMS")
5453
field(VAL, "0")
5554
}
5655
record(calc,"$(S)$(RTM_CHAN)$(OFFSET)-RB"){
5756
field(DESC,"get waveform offset")
5857
field(SCAN,"Passive")
59-
field(PREC,"15")
6058
field(INPA,"$(S)$(RTM_CHAN)$(OFFSET)-SP")
6159
field(CALC, "A")
6260
field(FLNK,"$(P)$(R)$(ACQ_NAME)ConvArrayDataC$(WVF_CHAN) CPP NMS")
@@ -65,8 +63,8 @@ record(calc,"$(S)$(RTM_CHAN)$(OFFSET)-RB"){
6563
record(ao,"$(S)$(RTM_CHAN)$(GAIN)-SP"){
6664
field(DESC,"set waveform gain")
6765
field(PINI,"YES")
68-
field(SCAN,"Passive")
6966
field(PREC,"15")
67+
field(SCAN,"Passive")
7068
field(FLNK,"$(S)$(RTM_CHAN)$(GAIN)-RB")
7169
field(VAL, "1")
7270
}

scripts/python/RAM/sirius_SOFB_InvRespMat_Horizontal_Plane.txt

Lines changed: 120 additions & 0 deletions
Large diffs are not rendered by default.

scripts/python/RAM/sirius_SOFB_InvRespMat_Vertical_Plane.txt

Lines changed: 160 additions & 0 deletions
Large diffs are not rendered by default.

scripts/python/RAM/sirius_SOFB_RespMat_Horizontal_Plane.txt

Lines changed: 160 additions & 0 deletions
Large diffs are not rendered by default.

scripts/python/RAM/sirius_SOFB_RespMat_Vertical_Plane.txt

Lines changed: 160 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# # # # # # # # # # # # # # # # # # # # # # # # # #
2+
# #
3+
# Description: Script to update RAM Coefficients #
4+
# #
5+
# Author: Melissa Aguiar #
6+
# #
7+
# Created: May. 05, 2022 #
8+
# #
9+
# # # # # # # # # # # # # # # # # # # # # # # # # #
10+
11+
# importing libraries
12+
from epics import PV
13+
import numpy as np
14+
from fxpmath import Fxp
15+
16+
# constants
17+
channels = 8 # number of FOFB Processing channels
18+
ram_size = 2**channels # size of RAM fixed in gateware
19+
addrs_in_use = 160 # size of RAM actually in use
20+
ram_addr = [] # list with RAM addresses in use
21+
ram_data_in = [] # list with RAM coefficients
22+
crates = ["01", "02", "03"]
23+
24+
print('\n')
25+
print(' # # # # # # # # # # # # # # # # # # # # # # # # # #')
26+
print(' # #')
27+
print(' # Description: Script to update RAM Coefficients #')
28+
print(' # #')
29+
print(' # #')
30+
print(' # Created: May. 05, 2022 #')
31+
print(' # #')
32+
print(' # # # # # # # # # # # # # # # # # # # # # # # # # #\n')
33+
34+
for j in range(0, channels):
35+
for i in range(j*ram_size, j*ram_size + addrs_in_use):
36+
ram_addr.append(i)
37+
38+
# load coefficients
39+
InvRespMat_h = np.loadtxt('sirius_SOFB_InvRespMat_Vertical_Plane.txt') # find the correct coefficients and change here
40+
InvRespMat_v = np.loadtxt('sirius_SOFB_InvRespMat_Vertical_Plane.txt')
41+
42+
# generate list with RAM coefficients for all channels
43+
for j in range(0, addrs_in_use):
44+
for i in InvRespMat_h[j][:]:
45+
s = Fxp(i, signed=True, n_word=32, n_frac=26)
46+
ram_data_in.append(s.raw())
47+
for i in InvRespMat_v[j][:]:
48+
s = Fxp(i, signed=True, n_word=32, n_frac=26)
49+
ram_data_in.append(s.raw())
50+
51+
cnt = 0
52+
for crate_number in crates:
53+
print('>>> Update RAM coefficients for crate ', crate_number)
54+
pv_prefix = "IA-" + crate_number + "RaBPM:BS-FOFBCtrl:"
55+
addr = PV(pv_prefix + 'FofbProcessingRamAddr-SP')
56+
data_in = PV(pv_prefix + 'FofbProcessingRamDataIn-SP')
57+
write_en = PV(pv_prefix + 'FofbProcessingRamWriteEnable-SP')
58+
for i in ram_addr:
59+
addr.put(i, wait=True)
60+
data_in.put(ram_data_in[cnt], wait=True)
61+
write_en.put(1, wait=True)
62+
cnt = cnt + 1
63+
print('... Done!')
64+
write_en.put(0, wait=True)
65+
66+
print('\n--------------------------------------------------------------------------')
67+
print('----------------------------------- END ----------------------------------')
68+
print('--------------------------------------------------------------------------\n')

scripts/python/all_racks_set_parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148

149149
new_offset = np.zeros(channels)
150150
for i in range(0, channels):
151-
new_offset[i] = np.mean(PV(pv_current_ArrayDataRAW[i]).get())
151+
new_offset[i] = int(np.mean(PV(pv_current_ArrayDataRAW[i]).get()))
152152

153153
print('\n>> New current offset values: \n', new_offset)
154154

0 commit comments

Comments
 (0)