Corrected WO write

Signed-off-by: Bernardo Carvalho <bernardo.carvalho@tecnico.ulisboa.pt>
This commit is contained in:
2024-04-16 16:02:24 +00:00
parent ff29fe6bdd
commit f90c6c67a6
3 changed files with 16 additions and 8 deletions

View File

@@ -71,21 +71,26 @@ p4 = win.addPlot(title="Channel Integrals")
p4.addLegend() p4.addLegend()
#for i in range(8,12): #for i in range(8,12):
start = args.irange[0] -1; stop = args.irange[1] - 1 start = args.irange[0] -1; stop = args.irange[1] - 1
print("WO: ", end='')
for i in range(start, stop): for i in range(start, stop):
#mdsNode = tree.getNode(f"ATCAIOP1.ADC8INT") #mdsNode = tree.getNode(f"ATCAIOP1.ADC8INT")
mdsNode = tree.getNode(f"ATCAIOP1.ADC{i}INT") mdsNode = tree.getNode(f"ATCAIOP1.ADC{i}INT")
try: try:
#print(f"ATCAIOP1.ADC{i:d}INT") dataAdcInt = mdsNode.getData().data()
dataAdcInt = mdsNode.getData().data() / 2.0e6 # LSB * sec
timeData = mdsNode.getDimensionAt(0).data() timeData = mdsNode.getDimensionAt(0).data()
y = dataAdcInt[ :args.maxsamples, 0] total_samples = DECIM_RATE * len(dataAdcInt[:, 0])
y = dataAdcInt[ :args.maxsamples, 0] / 2.0e6 # LSB * sec
if(args.zero): if(args.zero):
y = y - dataAdcInt[0, 0] y = y - dataAdcInt[0, 0] / 2.0e6 # LSB * sec
wo = (dataAdcInt[-1, 0] - dataAdcInt[0, 0]) /total_samples
print(f"{wo:0.4f} ", end='')
x = DECIM_RATE * np.arange(len(y)) / 2.0e6 # in sec x = DECIM_RATE * np.arange(len(y)) / 2.0e6 # in sec
p4.plot(x,y, pen=pg.mkPen(i, width=2), name=f"Ch {i+1}") p4.plot(x,y, pen=pg.mkPen(i, width=2), name=f"Ch {i+1}")
except: except:
print(f"No data ATCAIOP1.ADC{i:d}INT") print(f"No data ATCAIOP1.ADC{i:d}INT")
print(" ")
p4.setLabel('bottom', "Time", units='s') p4.setLabel('bottom', "Time", units='s')
#updatePlot() #updatePlot()

View File

@@ -1158,10 +1158,12 @@ $IsttokApp = {
ADCFrequency = "2000000" ADCFrequency = "2000000"
RTDecimation = "200" RTDecimation = "200"
ChopperPeriod = "2000" ChopperPeriod = "2000"
// ElectricalOffsets = {"86150" "-142" "130" "-165" "-280" "-187" "-10" "194" "40" "-36" "260" "-770"}
ElectricalOffsets = {"-151" "110" "-417" "-35" "-204" "0" "134" "-59" "-227" "-308" "-120" "-175"} ElectricalOffsets = {"-151" "110" "-417" "-35" "-204" "0" "134" "-59" "-227" "-308" "-120" "-175"}
WiringOffsets = {"0.271" "0.211" "0.098" "0.141" "0.312" "0.203" "0.212" "0.361" "-0.546" "-0.433" "-0.598" "1.362"} // "-141" "123" "-415" "-31" "-202" "8" "139" "-53" "-228" "-308" "-111" "-160"
//WiringOffsets = {"33.0" "34.89" "26.0" "38.0" "39.0" "-75.0" "30.0" "11.0" "-100.0" "-87.0" "-110.0" "-55.0"} //WiringOffsets = {"0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0"}
//WiringOffsets = { }
WiringOffsets = {0.354 0.288 -0.010 -0.083 0.347 0.228 0.088 0.186 -0.297 -0.101 0.025 -0.012 }
//WiringOffsets = {"0.271" "0.211" "0.098" "0.141" "0.312" "0.203" "0.212" "0.361" "-0.546" "-0.433" "-0.598" "1.362"}
Signals = { Signals = {
Counter = { Counter = {
Type = "uint32" Type = "uint32"

View File

@@ -409,7 +409,8 @@ bool AtcaIopADC::SetConfiguredDatabase(StructuredDataI& data) {
} }
for (i=0u; i < ATCA_IOP_N_ADCs ; i++) { for (i=0u; i < ATCA_IOP_N_ADCs ; i++) {
eo_conf.offset[i] = electricalOffsets[i]; eo_conf.offset[i] = electricalOffsets[i];
wo_conf.offset[i] = wiringOffsets[i]; wo_conf.offset[i] = static_cast<int32>(wiringOffsets[i] * 65536);
REPORT_ERROR(ErrorManagement::Information, "WiringOffset %d: %d", i, wo_conf.offset[i]);
} }
rc = ioctl(boardFileDescriptor, ATCA_PCIE_IOPS_EO_OFFSETS, &eo_conf); rc = ioctl(boardFileDescriptor, ATCA_PCIE_IOPS_EO_OFFSETS, &eo_conf);
rc = ioctl(boardFileDescriptor, ATCA_PCIE_IOPS_WO_OFFSETS, &wo_conf); rc = ioctl(boardFileDescriptor, ATCA_PCIE_IOPS_WO_OFFSETS, &wo_conf);