diff --git a/deploy/packaging/debian/rfxdevices.noarch b/deploy/packaging/debian/rfxdevices.noarch index d34ed467e0..278d075a04 100644 --- a/deploy/packaging/debian/rfxdevices.noarch +++ b/deploy/packaging/debian/rfxdevices.noarch @@ -16,6 +16,7 @@ ./usr/local/mdsplus/pydevices/RfxDevices/DIO2_ENCDEC.py ./usr/local/mdsplus/pydevices/RfxDevices/DIO4.py ./usr/local/mdsplus/pydevices/RfxDevices/DTACQ_SUPERVISOR.py +./usr/local/mdsplus/pydevices/RfxDevices/ELAD.py ./usr/local/mdsplus/pydevices/RfxDevices/ELPROBES_CFG.py ./usr/local/mdsplus/pydevices/RfxDevices/EPFE.py ./usr/local/mdsplus/pydevices/RfxDevices/EPFEM.py @@ -61,6 +62,7 @@ ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT_PCS.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT_VS.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_FLUXMAP.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_GENERIC.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_LEV_CTRLR.py @@ -132,6 +134,7 @@ ./usr/local/mdsplus/pydevices/RfxDevices/SPIDER_SM.py ./usr/local/mdsplus/pydevices/RfxDevices/STK_TEMP.py ./usr/local/mdsplus/pydevices/RfxDevices/STREAM_SETUP.py +./usr/local/mdsplus/pydevices/RfxDevices/TRIG_HUB.py ./usr/local/mdsplus/pydevices/RfxDevices/ZELOS2150GV.py ./usr/local/mdsplus/pydevices/RfxDevices/__init__.py ./usr/local/mdsplus/pydevices/RfxDevices/_version.py @@ -846,6 +849,7 @@ ./usr/local/mdsplus/tdi/RfxDevices/pxdtest.fun ./usr/local/mdsplus/tdi/RfxDevices/sawtooth.fun ./usr/local/mdsplus/tdi/RfxDevices/sawtooth1.fun +./usr/local/mdsplus/tdi/RfxDevices/setAbsoluteTime.py ./usr/local/mdsplus/tdi/RfxDevices/setversion.fun ./usr/local/mdsplus/tdi/RfxDevices/shotsDate.fun ./usr/local/mdsplus/tdi/RfxDevices/sigBit.fun diff --git a/deploy/packaging/redhat/rfxdevices.noarch b/deploy/packaging/redhat/rfxdevices.noarch index 86cf20bab8..041642ad7e 100644 --- a/deploy/packaging/redhat/rfxdevices.noarch +++ b/deploy/packaging/redhat/rfxdevices.noarch @@ -17,6 +17,7 @@ ./usr/local/mdsplus/pydevices/RfxDevices/DIO2_ENCDEC.py ./usr/local/mdsplus/pydevices/RfxDevices/DIO4.py ./usr/local/mdsplus/pydevices/RfxDevices/DTACQ_SUPERVISOR.py +./usr/local/mdsplus/pydevices/RfxDevices/ELAD.py ./usr/local/mdsplus/pydevices/RfxDevices/ELPROBES_CFG.py ./usr/local/mdsplus/pydevices/RfxDevices/EPFE.py ./usr/local/mdsplus/pydevices/RfxDevices/EPFEM.py @@ -62,6 +63,7 @@ ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT_PCS.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT_VS.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_FLUXMAP.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_GENERIC.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_LEV_CTRLR.py @@ -133,6 +135,7 @@ ./usr/local/mdsplus/pydevices/RfxDevices/SPIDER_SM.py ./usr/local/mdsplus/pydevices/RfxDevices/STK_TEMP.py ./usr/local/mdsplus/pydevices/RfxDevices/STREAM_SETUP.py +./usr/local/mdsplus/pydevices/RfxDevices/TRIG_HUB.py ./usr/local/mdsplus/pydevices/RfxDevices/ZELOS2150GV.py ./usr/local/mdsplus/pydevices/RfxDevices/__init__.py ./usr/local/mdsplus/pydevices/RfxDevices/_version.py @@ -848,6 +851,7 @@ ./usr/local/mdsplus/tdi/RfxDevices/pxdtest.fun ./usr/local/mdsplus/tdi/RfxDevices/sawtooth.fun ./usr/local/mdsplus/tdi/RfxDevices/sawtooth1.fun +./usr/local/mdsplus/tdi/RfxDevices/setAbsoluteTime.py ./usr/local/mdsplus/tdi/RfxDevices/setversion.fun ./usr/local/mdsplus/tdi/RfxDevices/shotsDate.fun ./usr/local/mdsplus/tdi/RfxDevices/sigBit.fun diff --git a/java/jdevices/src/main/java/RFX_RPADCSetup.java b/java/jdevices/src/main/java/RFX_RPADCSetup.java index 6b0db7d65a..79492a9b3b 100644 --- a/java/jdevices/src/main/java/RFX_RPADCSetup.java +++ b/java/jdevices/src/main/java/RFX_RPADCSetup.java @@ -55,17 +55,21 @@ private void initComponents() { deviceField10 = new DeviceField(); deviceField6 = new DeviceField(); deviceField3 = new DeviceField(); + jPanel9 = new javax.swing.JPanel(); + deviceField12 = new DeviceField(); + deviceField13 = new DeviceField(); + deviceField14 = new DeviceField(); jPanel5 = new javax.swing.JPanel(); deviceField5 = new DeviceField(); - setDeviceProvider("ropc1.rfx.local:8100"); + setDeviceProvider("localhost:8000"); setDeviceTitle("RedPitaya ADC"); setDeviceType("RFX_RPADC"); setHeight(300); setWidth(800); getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - jPanel1.setLayout(new java.awt.GridLayout(7, 1)); + jPanel1.setLayout(new java.awt.GridLayout(8, 1)); deviceField1.setIdentifier(""); deviceField1.setLabelString("Comment:"); @@ -112,7 +116,7 @@ private void initComponents() { jPanel1.add(jPanel4); - deviceChoice4.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "SYNC", "TRIG_EXTERNAL", "TRIG_SYNC"}); + deviceChoice4.setChoiceItems(new String[] {"INTERNAL", "TRIG_EXTERNAL", "EXTERNAL", "HIGHWAY"}); deviceChoice4.setIdentifier(""); deviceChoice4.setLabelString("Clock Mode:"); deviceChoice4.setOffsetNid(14); @@ -158,13 +162,33 @@ private void initComponents() { jPanel8.add(deviceField6); deviceField3.setIdentifier(""); - deviceField3.setLabelString("Dead time: "); - deviceField3.setNumCols(8); - deviceField3.setOffsetNid(34); + deviceField3.setLabelString("Timing Highway event code: "); + deviceField3.setNumCols(4); + deviceField3.setOffsetNid(23); jPanel8.add(deviceField3); jPanel1.add(jPanel8); + deviceField12.setIdentifier(""); + deviceField12.setLabelString("Dead Time(s):"); + deviceField12.setNumCols(6); + deviceField12.setOffsetNid(34); + jPanel9.add(deviceField12); + + deviceField13.setIdentifier(""); + deviceField13.setLabelString("Offset A (raw):"); + deviceField13.setNumCols(6); + deviceField13.setOffsetNid(35); + jPanel9.add(deviceField13); + + deviceField14.setIdentifier(""); + deviceField14.setLabelString("Offset B (raw): "); + deviceField14.setNumCols(6); + deviceField14.setOffsetNid(22); + jPanel9.add(deviceField14); + + jPanel1.add(jPanel9); + deviceField5.setIdentifier(""); deviceField5.setLabelString("Trigger: "); deviceField5.setNumCols(35); @@ -186,6 +210,9 @@ private void initComponents() { private DeviceField deviceField1; private DeviceField deviceField10; private DeviceField deviceField11; + private DeviceField deviceField12; + private DeviceField deviceField13; + private DeviceField deviceField14; private DeviceField deviceField2; private DeviceField deviceField3; private DeviceField deviceField4; @@ -202,5 +229,6 @@ private void initComponents() { private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel8; + private javax.swing.JPanel jPanel9; // End of variables declaration//GEN-END:variables } diff --git a/java/jdevices/src/main/java/TRIG_HUBSetup.java b/java/jdevices/src/main/java/TRIG_HUBSetup.java new file mode 100644 index 0000000000..39a0d6ecce --- /dev/null +++ b/java/jdevices/src/main/java/TRIG_HUBSetup.java @@ -0,0 +1,358 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author mdsplus + */ +public class TRIG_HUBSetup extends DeviceSetup { + + /** + * Creates new form TRIG_HUBSetup + */ + public TRIG_HUBSetup() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jPanel2 = new javax.swing.JPanel(); + deviceField1 = new DeviceField(); + deviceField2 = new DeviceField(); + jPanel3 = new javax.swing.JPanel(); + deviceField3 = new DeviceField(); + jPanel4 = new javax.swing.JPanel(); + deviceField4 = new DeviceField(); + deviceField5 = new DeviceField(); + deviceField6 = new DeviceField(); + deviceField7 = new DeviceField(); + deviceField8 = new DeviceField(); + deviceButtons1 = new DeviceButtons(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel5 = new javax.swing.JPanel(); + jPanel6 = new javax.swing.JPanel(); + deviceField9 = new DeviceField(); + deviceField10 = new DeviceField(); + jPanel7 = new javax.swing.JPanel(); + deviceField11 = new DeviceField(); + jPanel8 = new javax.swing.JPanel(); + jPanel9 = new javax.swing.JPanel(); + deviceField12 = new DeviceField(); + deviceField13 = new DeviceField(); + jPanel10 = new javax.swing.JPanel(); + deviceField14 = new DeviceField(); + jPanel11 = new javax.swing.JPanel(); + jPanel12 = new javax.swing.JPanel(); + deviceField15 = new DeviceField(); + deviceField16 = new DeviceField(); + jPanel13 = new javax.swing.JPanel(); + deviceField17 = new DeviceField(); + jPanel14 = new javax.swing.JPanel(); + jPanel15 = new javax.swing.JPanel(); + deviceField18 = new DeviceField(); + deviceField19 = new DeviceField(); + jPanel16 = new javax.swing.JPanel(); + deviceField20 = new DeviceField(); + jPanel17 = new javax.swing.JPanel(); + jPanel18 = new javax.swing.JPanel(); + deviceField21 = new DeviceField(); + deviceField22 = new DeviceField(); + jPanel19 = new javax.swing.JPanel(); + deviceField23 = new DeviceField(); + jPanel20 = new javax.swing.JPanel(); + jPanel21 = new javax.swing.JPanel(); + deviceField24 = new DeviceField(); + deviceField25 = new DeviceField(); + jPanel22 = new javax.swing.JPanel(); + deviceField26 = new DeviceField(); + + setDeviceProvider("localhost:8101"); + setDeviceTitle("Trigger Hub"); + setDeviceType("TRIG_HUB"); + setHeight(300); + setWidth(750); + + jPanel1.setLayout(new java.awt.GridLayout(3, 1)); + + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Comment: "); + deviceField1.setNumCols(20); + deviceField1.setOffsetNid(1); + deviceField1.setTextOnly(true); + jPanel2.add(deviceField1); + + deviceField2.setIdentifier(""); + deviceField2.setLabelString("IP: "); + deviceField2.setOffsetNid(2); + deviceField2.setTextOnly(true); + jPanel2.add(deviceField2); + + jPanel1.add(jPanel2); + + deviceField3.setIdentifier(""); + deviceField3.setLabelString("RP Signal:"); + deviceField3.setNumCols(25); + deviceField3.setOffsetNid(3); + jPanel3.add(deviceField3); + + jPanel1.add(jPanel3); + + deviceField4.setIdentifier(""); + deviceField4.setLabelString("Parent Idx:"); + deviceField4.setNumCols(4); + deviceField4.setOffsetNid(9); + jPanel4.add(deviceField4); + + deviceField5.setIdentifier(""); + deviceField5.setLabelString("Child 1 Idx: "); + deviceField5.setNumCols(4); + deviceField5.setOffsetNid(10); + jPanel4.add(deviceField5); + + deviceField6.setIdentifier(""); + deviceField6.setLabelString("Child 2 Idx: "); + deviceField6.setNumCols(4); + deviceField6.setOffsetNid(11); + jPanel4.add(deviceField6); + + deviceField7.setIdentifier(""); + deviceField7.setLabelString("Child 3 Idx: "); + deviceField7.setNumCols(4); + deviceField7.setOffsetNid(12); + jPanel4.add(deviceField7); + + deviceField8.setIdentifier(""); + deviceField8.setLabelString("Child 4 Idx: "); + deviceField8.setNumCols(4); + deviceField8.setOffsetNid(13); + jPanel4.add(deviceField8); + + jPanel1.add(jPanel4); + + getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + jPanel5.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField9.setIdentifier(""); + deviceField9.setLabelString("Delay: "); + deviceField9.setNumCols(20); + deviceField9.setOffsetNid(15); + jPanel6.add(deviceField9); + + deviceField10.setIdentifier(""); + deviceField10.setLabelString("Hub Path: "); + deviceField10.setNumCols(25); + deviceField10.setOffsetNid(16); + jPanel6.add(deviceField10); + + jPanel5.add(jPanel6); + + deviceField11.setIdentifier(""); + deviceField11.setLabelString("In Signal Path: "); + deviceField11.setNumCols(30); + deviceField11.setOffsetNid(17); + jPanel7.add(deviceField11); + + jPanel5.add(jPanel7); + + jTabbedPane1.addTab("In1", jPanel5); + + jPanel8.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField12.setIdentifier(""); + deviceField12.setLabelString("Delay: "); + deviceField12.setNumCols(20); + deviceField12.setOffsetNid(20); + jPanel9.add(deviceField12); + + deviceField13.setIdentifier(""); + deviceField13.setLabelString("Hub Path: "); + deviceField13.setNumCols(25); + deviceField13.setOffsetNid(21); + jPanel9.add(deviceField13); + + jPanel8.add(jPanel9); + + deviceField14.setIdentifier(""); + deviceField14.setLabelString("In Signal Path: "); + deviceField14.setNumCols(30); + deviceField14.setOffsetNid(22); + jPanel10.add(deviceField14); + + jPanel8.add(jPanel10); + + jTabbedPane1.addTab("In2", jPanel8); + + jPanel11.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField15.setIdentifier(""); + deviceField15.setLabelString("Delay: "); + deviceField15.setNumCols(20); + deviceField15.setOffsetNid(25); + jPanel12.add(deviceField15); + + deviceField16.setIdentifier(""); + deviceField16.setLabelString("Hub Path: "); + deviceField16.setNumCols(25); + deviceField16.setOffsetNid(26); + jPanel12.add(deviceField16); + + jPanel11.add(jPanel12); + + deviceField17.setIdentifier(""); + deviceField17.setLabelString("In Signal Path: "); + deviceField17.setNumCols(30); + deviceField17.setOffsetNid(27); + jPanel13.add(deviceField17); + + jPanel11.add(jPanel13); + + jTabbedPane1.addTab("In3", jPanel11); + + jPanel14.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField18.setIdentifier(""); + deviceField18.setLabelString("Delay: "); + deviceField18.setNumCols(20); + deviceField18.setOffsetNid(30); + jPanel15.add(deviceField18); + + deviceField19.setIdentifier(""); + deviceField19.setLabelString("Hub Path: "); + deviceField19.setNumCols(25); + deviceField19.setOffsetNid(31); + jPanel15.add(deviceField19); + + jPanel14.add(jPanel15); + + deviceField20.setIdentifier(""); + deviceField20.setLabelString("In Signal Path: "); + deviceField20.setNumCols(30); + deviceField20.setOffsetNid(32); + jPanel16.add(deviceField20); + + jPanel14.add(jPanel16); + + jTabbedPane1.addTab("In4", jPanel14); + + jPanel17.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField21.setIdentifier(""); + deviceField21.setLabelString("Delay: "); + deviceField21.setNumCols(20); + deviceField21.setOffsetNid(35); + jPanel18.add(deviceField21); + + deviceField22.setIdentifier(""); + deviceField22.setLabelString("Hub Path: "); + deviceField22.setNumCols(25); + deviceField22.setOffsetNid(36); + jPanel18.add(deviceField22); + + jPanel17.add(jPanel18); + + deviceField23.setIdentifier(""); + deviceField23.setLabelString("In Signal Path: "); + deviceField23.setNumCols(30); + deviceField23.setOffsetNid(37); + jPanel19.add(deviceField23); + + jPanel17.add(jPanel19); + + jTabbedPane1.addTab("In5", jPanel17); + + jPanel20.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField24.setIdentifier(""); + deviceField24.setLabelString("Delay: "); + deviceField24.setNumCols(20); + deviceField24.setOffsetNid(40); + jPanel21.add(deviceField24); + + deviceField25.setIdentifier(""); + deviceField25.setLabelString("Hub Path: "); + deviceField25.setNumCols(25); + deviceField25.setOffsetNid(41); + jPanel21.add(deviceField25); + + jPanel20.add(jPanel21); + + deviceField26.setIdentifier(""); + deviceField26.setLabelString("In Signal Path: "); + deviceField26.setNumCols(30); + deviceField26.setOffsetNid(42); + jPanel22.add(deviceField26); + + jPanel20.add(jPanel22); + + jTabbedPane1.addTab("In6", jPanel20); + + getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private DeviceButtons deviceButtons1; + private DeviceField deviceField1; + private DeviceField deviceField10; + private DeviceField deviceField11; + private DeviceField deviceField12; + private DeviceField deviceField13; + private DeviceField deviceField14; + private DeviceField deviceField15; + private DeviceField deviceField16; + private DeviceField deviceField17; + private DeviceField deviceField18; + private DeviceField deviceField19; + private DeviceField deviceField2; + private DeviceField deviceField20; + private DeviceField deviceField21; + private DeviceField deviceField22; + private DeviceField deviceField23; + private DeviceField deviceField24; + private DeviceField deviceField25; + private DeviceField deviceField26; + private DeviceField deviceField3; + private DeviceField deviceField4; + private DeviceField deviceField5; + private DeviceField deviceField6; + private DeviceField deviceField7; + private DeviceField deviceField8; + private DeviceField deviceField9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel10; + private javax.swing.JPanel jPanel11; + private javax.swing.JPanel jPanel12; + private javax.swing.JPanel jPanel13; + private javax.swing.JPanel jPanel14; + private javax.swing.JPanel jPanel15; + private javax.swing.JPanel jPanel16; + private javax.swing.JPanel jPanel17; + private javax.swing.JPanel jPanel18; + private javax.swing.JPanel jPanel19; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel20; + private javax.swing.JPanel jPanel21; + private javax.swing.JPanel jPanel22; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel6; + private javax.swing.JPanel jPanel7; + private javax.swing.JPanel jPanel8; + private javax.swing.JPanel jPanel9; + private javax.swing.JTabbedPane jTabbedPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/java/jdevices/src/main/resources/RFX_RPADCSetup.form b/java/jdevices/src/main/resources/RFX_RPADCSetup.form index 66722a6802..7614b2500a 100644 --- a/java/jdevices/src/main/resources/RFX_RPADCSetup.form +++ b/java/jdevices/src/main/resources/RFX_RPADCSetup.form @@ -2,7 +2,7 @@
- + @@ -42,7 +42,7 @@ - + @@ -140,12 +140,11 @@ - + - - - - + + + @@ -215,11 +214,41 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/TRIG_HUBSetup.form b/java/jdevices/src/main/resources/TRIG_HUBSetup.form new file mode 100644 index 0000000000..f9a8094c8e --- /dev/null +++ b/java/jdevices/src/main/resources/TRIG_HUBSetup.form @@ -0,0 +1,457 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mdsobjects/labview/mdsdataobjectswrp.cpp b/mdsobjects/labview/mdsdataobjectswrp.cpp index d3d60f23fb..d8ee437d23 100644 --- a/mdsobjects/labview/mdsdataobjectswrp.cpp +++ b/mdsobjects/labview/mdsdataobjectswrp.cpp @@ -1448,7 +1448,8 @@ namespace MDSplus treePtrIn = reinterpret_cast(const_cast(lvTreePtrIn)); - dataPtrOut = execute(const_cast(exprIn), treePtrIn); + + dataPtrOut = treePtrIn->tdiExecute(const_cast(exprIn)); *lvDataPtrOut = reinterpret_cast(dataPtrOut); } diff --git a/pydevices/RfxDevices/DTACQ_SUPERVISOR.py b/pydevices/RfxDevices/DTACQ_SUPERVISOR.py index 6bfd629241..ea35f71a37 100644 --- a/pydevices/RfxDevices/DTACQ_SUPERVISOR.py +++ b/pydevices/RfxDevices/DTACQ_SUPERVISOR.py @@ -363,8 +363,7 @@ def init(self): try: dtackAi = self.ai_b_device.getData() hasBulkAi = True - dtackAi.parameters_par13_value.putData(Int32(clockFreq)) #num samples -# dtackAi.parameters_par_1_value.putData(Float64(clockFreq/numSamples)) + dtackAi.parameters_par_13_value.putData(Int32(int(clockFreq))) #num samples dtackAi.parameters_par_1_value.putData(Float64(1)) #1 segment per second dtackAi.parameters_par_2_value.putData(Float64(triggerTime)) dtackAi.parameters_par_3_value.putData(Int32(1)) @@ -389,7 +388,7 @@ def init(self): raise mdsExceptions.TclFAILED_ESSENTIAL - dtackAi.parameters_par13_value.putData(Int32(1)) #num samples + dtackAi.parameters_par_13_value.putData(Int32(1)) #num samples dtackAi.parameters_par_1_value.putData(Float64(clockFreq/freqDiv)) dtackAi.parameters_par_2_value.putData(Float64(triggerTime)) dtackAi.parameters_par_3_value.putData(Int32(2)) diff --git a/pydevices/RfxDevices/ELAD.py b/pydevices/RfxDevices/ELAD.py new file mode 100644 index 0000000000..7c504f7734 --- /dev/null +++ b/pydevices/RfxDevices/ELAD.py @@ -0,0 +1,145 @@ +import MDSplus +from ctypes import CDLL, c_char_p, c_short, byref, c_int +import socket +import numpy as np + + +def recvall(sock, n): +# Helper function to recv n bytes or return None if EOF is hit + data = bytearray() + while len(data) < n: + packet = sock.recv(n - len(data)) + if not packet: + return None + data.extend(packet) + return data + +class ELAD(MDSplus.Device): + + parts = [ + {'path': ':COMMENT', 'type': 'text'}, + {'path': ':IP', 'type': 'text'}, + {'path': ':PORT', 'type': 'numeric', 'value': 8000}, + {'path': ':HW_TRIG', 'type': 'numeric', 'value': 0}, + {'path': ':TRIG_TIME', 'type': 'numeric', 'value': 0}, + {'path': ':PTS', 'type': 'numeric', 'value': 1000}, + ] + for i in range(12): + parts.extend([ + {'path': '.CHANNEL_%d' % (i+1), 'type': 'structure'}, + {'path': '.CHANNEL_%d:DATA' % (i+1), 'type': 'signal', 'options': ( + 'no_write_model', 'compress_on_put')}, + ]) + parts.extend([ + {'path': ':INIT_ACTION', 'type': 'action', + 'valueExpr': "Action(Dispatch('ELAD_SERVER','INIT',50,None),Method(None,'init',head))", + 'options': ('no_write_shot',)}, + {'path': ':STORE_ACTION', 'type': 'action', + 'valueExpr': "Action(Dispatch('ELAD_SERVER','STORE',50,None),Method(None,'store',head))", + 'options': ('no_write_shot',)}, + ]) + del(i) + + socketDict = {} + + + def init(self): + try: + ip = self.ip.data() + except: + print("Missing IP") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + try: + port = self.port.data() + except: + print("Missing Port") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + try: + pts = self.pts.data() + except: + print("Missing PTS") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + try: + useHwTrigger = self.hw_trig.data() + except: + print("Missing use HW Trigger flag") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + sock.connect((ip, port)) + except: + print("Cannot connect to "+ip+" Port "+str(port)) + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + + try: + sock.send(b'CHK') + one = 1 + sock.send(one.to_bytes(4,'little')) + print(sock.recv(2)) + + sock.send(b'PTS') + sock.send(pts.item().to_bytes(4,'little')) + print(sock.recv(2)) + + sock.send(b'ARM') + print(sock.recv(2)) + except: + print("Socket communication failed") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + ELAD.socketDict[self.getNid()] = sock + + def trigger(self): + try: + sock = ELAD.socketDict[self.getNid()] + except: + print("Cannot retrieve socket") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + try: + sock.send(b'TRG') + print(sock.recv(2)) + except: + print("Socket communication failed") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + + + def store(self): + try: + sock = ELAD.socketDict[self.getNid()] + except: + print("Cannot retrieve socket") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + try: + trigTime = self.trig_time.data() + except: + print("Cannot retrieve trigger time") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + try: + sock.send(b'STR') + numSamples = int.from_bytes(sock.recv(4),'little') + print('num Samples: ', numSamples) + samples = np.zeros(numSamples, np.int) + numChanSamples = int(numSamples/12) + print('num Chan Samples: ', numChanSamples) + samples = np.frombuffer(recvall(sock, 4 * numSamples), dtype = np.int32) + print('Received Samples: ', len(samples)) + except: + print("Cannot read samples from socket") + raise MDSplus.mdsExceptions.TclFAILED_ESSENTIAL + + timebase = MDSplus.Range(trigTime, trigTime + 1E-6 * numChanSamples, 1E-6) + for chan in range(12): + currSig = MDSplus.Signal(samples[chan * numChanSamples:(chan+1) * numChanSamples], None, timebase) + self.__getattr__('channel_%d_data' % (chan+1)).putData(currSig) + sock.close() + + + + diff --git a/pydevices/RfxDevices/MARTE2_SIMULINK_DTT_VS.py b/pydevices/RfxDevices/MARTE2_SIMULINK_DTT_VS.py new file mode 100644 index 0000000000..e3edacbb7b --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_SIMULINK_DTT_VS.py @@ -0,0 +1,31 @@ +# +# Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +MARTE2_SIMULINK = __import__('MARTE2_SIMULINK', globals()) + + +@MARTE2_SIMULINK.BUILDER +class MARTE2_SIMULINK_DTT_VS(MARTE2_SIMULINK.MARTE2_SIMULINK): + lib_name = 'VS' diff --git a/pydevices/RfxDevices/RFX_RPADC.py b/pydevices/RfxDevices/RFX_RPADC.py index b00e491ba3..5070884836 100644 --- a/pydevices/RfxDevices/RFX_RPADC.py +++ b/pydevices/RfxDevices/RFX_RPADC.py @@ -54,7 +54,11 @@ class RFX_RPADC(Device): 'options': ('no_write_shot',)}, {'path': ':START_TIME', 'type': 'numeric', 'value': 0}, {'path': ':ABS_TRIGGER', 'type': 'numeric', 'value': 0}, - {'path': ':DEAD_TIME', 'type': 'numeric', 'value': 1E-3} + {'path': ':DEAD_TIME', 'type': 'numeric', 'value': 1E-3}, + {'path': ':HW_OFFS_A', 'type': 'numeric', 'value': 0}, + {'path': ':HW_OFFS_B', 'type': 'numeric', 'value': 0}, + {'path': ':TRIG_RECV', 'type': 'signal', 'options': ( + 'no_write_model', 'no_compress_on_put')} ] class TriggerEvent(Event): @@ -66,7 +70,7 @@ def run(self): self.device.do_trigger() class Configuration: - def configure(self, lib, fd, name, shot, chanANid, chanBNid, triggerNid, startTimeNid, preSamples, + def configure(self, lib, fd, name, shot, chanANid, chanBNid, trigRecvNid, triggerNid, startTimeNid, preSamples, postSamples, segmentSamples, frequency, frequency1, single, absTriggerTimeFromFPGA, absTriggerNid): self.lib = lib self.fd = fd @@ -74,6 +78,7 @@ def configure(self, lib, fd, name, shot, chanANid, chanBNid, triggerNid, startTi self.shot = shot self.chanANid = chanANid self.chanBNid = chanBNid + self.trigRecvNid = trigRecvNid self.triggerNid = triggerNid self.startTimeNid = startTimeNid self.preSamples = preSamples @@ -93,6 +98,7 @@ def configure(self, conf): self.shot = conf.shot self.chanANid = conf.chanANid self.chanBNid = conf.chanBNid + self.trigRecvNid = conf.trigRecvNid self.triggerNid = conf.triggerNid self.startTimeNid = conf.startTimeNid self.preSamples = conf.preSamples @@ -105,10 +111,9 @@ def configure(self, conf): self.absTriggerNid = conf.absTriggerNid def run(self): - print('START THREAD', self.name, self.shot) try: self.lib.rpadcStream( - c_int(self.fd), c_char_p(self.name), c_int(self.shot), c_int(self.chanANid), c_int(self.chanBNid), + c_int(self.fd), c_char_p(self.name), c_int(self.shot), c_int(self.chanANid), c_int(self.chanBNid),c_int(self.trigRecvNid), c_int(self.triggerNid), c_int(self.preSamples), c_int(self.postSamples), c_int(self.segmentSamples), c_double(self.frequency), c_double(self.frequency1), c_int(self.single), c_int(self.absTriggerTimeFromFPGA), c_int(self.absTriggerNid)) except ValueError as e: @@ -187,11 +192,6 @@ def init(self): print('Cannot get decimation') raise mdsExceptions.TclFAILED_ESSENTIAL print('CLOCK') - try: - trig = self.trigger.getData() - except: - print('Cannot get trigger') - raise mdsExceptions.TclFAILED_ESSENTIAL if self.clock_mode.data() != 'INTERNAL': try: if self.clock_mode.data() == 'TRIG_SYNC': @@ -220,14 +220,26 @@ def init(self): except: print('Cannot resolve dead time') raise mdsExceptions.TclFAILED_ESSENTIAL + + try: + offsa = int(self.hw_offs_a) + except: + print('Cannot read hw_offs_a') + raise mdsExceptions.TclFAILED_ESSENTIAL + try: + offsb = int(self.hw_offs_b) + except: + print('Cannot read hw_offs_b') + raise mdsExceptions.TclFAILED_ESSENTIAL + print('opening device') self.fd = self.lib.rpadcInit(c_int(mode), c_int(clockMode), c_int(preSamples), c_int(postSamples), c_int(trigFromChanA), - c_int(trigAboveThreshold), c_int(evLevel), c_int(evSamples), c_int(decimation), c_int(deadTime)) + c_int(trigAboveThreshold), c_int(evLevel), c_int(evSamples), c_int(decimation-1), c_int(deadTime), c_int(offsa), c_int(offsb)) if self.fd < 0: print("Error opening device") raise mdsExceptions.TclFAILED_ESSENTIAL print('device opened') - self.conf.configure(self.lib, self.fd, self.getTree().name, self.getTree().shot, self.raw_a.getNid(), self.raw_b.getNid(), + self.conf.configure(self.lib, self.fd, self.getTree().name, self.getTree().shot, self.raw_a.getNid(), self.raw_b.getNid(), self.trig_recv.getNid(), self.trigger.getNid(), self.start_time.getNid(), preSamples, postSamples, segSize, frequency, frequency1, isSingle, absTriggerTimeFromFPGA, self.abs_trigger.getNid()) print('configured') @@ -247,8 +259,6 @@ def init(self): def start_store(self): try: - self.raw_a.deleteData() - self.raw_b.deleteData() worker = self.AsynchStore() worker.configure(self.conf) worker.daemon = True @@ -266,10 +276,10 @@ def start_store(self): def stop_store(self): try: self.conf.lib.rpadcStop(self.conf.fd) - #try: - #RFX_RPADC.triggerEv.cancel() - #except: - #pass + try: + RFX_RPADC.triggerEv.cancel() + except: + pass except: raise mdsExceptions.TclFAILED_ESSENTIAL diff --git a/pydevices/RfxDevices/TRIG_HUB.py b/pydevices/RfxDevices/TRIG_HUB.py new file mode 100644 index 0000000000..c4a4f40317 --- /dev/null +++ b/pydevices/RfxDevices/TRIG_HUB.py @@ -0,0 +1,264 @@ +from MDSplus import * +import numpy as np +from threading import Lock +import socket +import time + +class TRIG_HUB(Device): + NUM_INPUTS = 6 + SAMPLE_NS = 8 + lock = Lock() + parts = [ + {'path': ':COMMENT', 'type': 'text'}, + {'path': ':DEVICE_IP', 'type': 'text'}, + {'path': ':RP_SIG_PATH', 'type': 'any'}, + {'path': ':RAW_TIMES', 'type': 'signal'}, # For every trigger, the straight computation of relative delays starting from 0 + {'path': ':CORR_TIMES', 'type': 'signal'},# The above, including delay corrections + {'path': ':TRUE_TIMES', 'type': 'signal'},# The relative delays aligned to the root HUB + {'path': ':TIME_OFFSETS', 'type': 'numeric', 'value':0}, # Time offsets from root HUB + {'path': ':TIMES', 'type': 'numeric', 'value':0}, # Segment start time from root HUB + + + {'path': ':PARENT_IDX', 'type': 'numeric', 'value': -1}, # -1 means Hub Root + {'path': ':CHILD0_IDX', 'type': 'numeric', 'value': -1}, # -1 means No child + {'path': ':CHILD1_IDX', 'type': 'numeric', 'value': -1}, # -1 means No child + {'path': ':CHILD2_IDX', 'type': 'numeric', 'value': -1}, # -1 means No child + {'path': ':CHILD3_IDX', 'type': 'numeric', 'value': -1}, # -1 means No child + ] + + for i in range(NUM_INPUTS): + parts.extend([ + {'path': '.IN_%d' % (i),'type': 'structure'}, + {'path': '.IN_%d:DELAY' % (i), 'type': 'numeric', 'value': 0}, + {'path': '.IN_%d:HUB_PATH' % (i), 'type': 'any'}, # Only for children HUBs + {'path': '.IN_%d:IN_SIG' % (i), 'type': 'any'}, # Only for redPitaya + {'path': '.IN_%d:OUT_SIG' % (i), 'type': 'signal'}, # Only for redPitaya + ]) + parts.append( {'path': ':CONF_COMMAND', 'type': 'text'}) + + parts.extend([ + {'path': ':START_UPD', 'type': 'action', + 'valueExpr': "Action(Dispatch('RP_SERVER','PULSE_ON',50,None),Method(None,'startUpdate',head))", + 'options': ('no_write_shot',)}, + {'path': ':STOP_UPD', 'type': 'action', + 'valueExpr': "Action(Dispatch('RP_SERVER','POST_PULSE_CHECK',50,None),Method(None,'stopUpdate',head))", + 'options': ('no_write_shot',)}, + ]) + del(i) + + def getTriggerRelTimes(self, trigSignal): + parentIdx = self.parent_idx.data() - 1 + #125 MHz Sampling Speed -> 8ns period + if parentIdx >= 0: + mask = int(1) << parentIdx + else: + mask = int(0) + times = np.zeros(self.NUM_INPUTS, dtype = int) + firstTimeIdx = -1 + for sample in range(len(trigSignal)): + if (trigSignal[sample] & ~mask) != 0: + newBits = trigSignal[sample] & ~mask + mask = mask | newBits + for idx in range(self.NUM_INPUTS): + if ((newBits >> idx)&0x1)!=0: #A new trigger has been recorded + if firstTimeIdx < 0: + firstTimeIdx = sample #keep track of the index within the signal of the first received trigger (there may be pre trigger samples) + times[self.NUM_INPUTS - idx - 1] = (sample - firstTimeIdx) * self.SAMPLE_NS # Record time offset in ns from thre first recorded trigger + # Sono roversi + return times + + def configure(self): + cmd = self.conf_command.data() + if len(cmd) != 80: + print('The lengh of the command string shall be 80 chars') + raise mdsExceptions.TclFAILED_ESSENTIAL + try: + ipAddr = self.device_ip.data().split() + except: + print('Missing device IP') + raise mdsExceptions.TclFAILED_ESSENTIAL + ip = ipAddr[0] + if len(ipAddr)>1: + port = int(ipAddr[1]) + else: + port = 5500 + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((ip, port)) + time.sleep(0.1)# 100ms + s.settimeout(1.0) + time.sleep(0.1)# 100ms + s.sendall(b'\x19') + time.sleep(0.3)# 100ms + print("Write cmd %s "%(cmd)) + s.sendall(bytes(cmd, 'utf-8')) + except Exception as ex: + print('Cannot communicate to device : %s'%(str(ex))) + raise mdsExceptions.TclFAILED_ESSENTIAL + + s.close() # It's require to close socket after write string + + time.sleep(0.3)# 100ms + + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((ip, port)) + time.sleep(0.1)# 100ms + s.sendall(b'\x1E') + time.sleep(0.3)# 100ms + chunks = [] + bytesRec = 0 + count = 0 + while bytesRec < 80: + chunk = s.recv(80 - bytesRec) + if chunk == b'': + if count < 100: + count = count + 1 + time.sleep(0.1) + continue + raise RuntimeError("socket connection broken") + chunks.append(chunk) + bytesRec = bytesRec + len(chunk) + if b''.join(chunks).decode() != cmd: + print('Invalid message readout: ', b''.join(chunks).decode(), cmd) + raise mdsExceptions.TclFAILED_ESSENTIAL + + print("Read : %s"%(chunk)) + except Exception as ex: + print('Cannot read from device : %s'%(str(ex))) + raise mdsExceptions.TclFAILED_ESSENTIAL + finally: + if s is not None: + s.close() + + def clear(self): + self.raw_times.deleteData() + self.corr_times.deleteData() + self.true_times.deleteData() + self.times.deleteData() + self.time_offsets.deleteData() + self.in_0_out_sig.deleteData() + self.in_1_out_sig.deleteData() + self.in_2_out_sig.deleteData() + self.in_3_out_sig.deleteData() + self.in_4_out_sig.deleteData() + self.in_5_out_sig.deleteData() + + def update(self): + + TRIG_HUB.lock.acquire() + try: + try: + numSavedTriggers = len(self.raw_times.data()) + except: + numSavedTriggers = 0 + try: + rpSigNode = self.rp_sig_path.getData() + except: + print('Cannot get SetPitaya Raw Signal node') + raise mdsExceptions.TclFAILED_ESSENTIAL + numRpSegments = rpSigNode.getNumSegments() + for i in range(numSavedTriggers, numRpSegments): + currTrigSignal = rpSigNode.getSegment(i).data() + rawTimes = self.getTriggerRelTimes(currTrigSignal) + delays = np.zeros(self.NUM_INPUTS, dtype = int) + for inIdx in range(self.NUM_INPUTS): + currDelay = self.__getattr__('in_%d_delay' % (inIdx)).data() + print(currDelay) + try: + nSegs = len(currDelay) + print("redp_delay fun used!!") + if nSegs <= i: + print("WARNING: Internal Error: not enough signal RedPitaya segments!") + delays[inIdx] = currDelay[nSegs - 1] + else: + delays[inIdx] = currDelay[i] + except: + delays[inIdx] = currDelay + corrTimes = rawTimes - delays + self.raw_times.putRow(100, rawTimes, i) + self.corr_times.putRow(100, corrTimes, i) + if self.parent_idx.data() < 0: + self.true_times.putRow(100, corrTimes, i) #For the root HUB no offset is applied + startTime = rpSigNode.getSegmentStart(i).data() + for child in range(4): + childIdx =self.__getattr__('child%d_idx' % (child)).data() - 1 + if childIdx < 0: #children finished + break + currChildHub = self.__getattr__('in_%d_hub_path' % (child)).getData() #It must be a child HUB + currOffset = corrTimes[childIdx] + currChildHub.time_offsets.putRow(100, currOffset, i) + currChildHub.times.putRow(100, startTime, i) + self.times.putRow(100, startTime, i) + + # second step, affecting only non root HUBs + if self.parent_idx.data() >= 0: + try: + numTrueTimes = len(self.true_times.data()) + except: + numTrueTimes = 0 + try: + numCorrTimes = len(self.corr_times.data()) + except: + numCorrTimes = 0 + try: + numOffsets = len(self.time_offsets.data()) + except: + numOffsets = 0 + if numCorrTimes > 0 and numOffsets > numTrueTimes: + offsets = self.time_offsets.data() # 1D Array + corrTimes = self.corr_times.data() # 2D Array + times = self.times.data() # 1D Array, t will hase as many elements as offsets + for timeIdx in range(numTrueTimes, numOffsets): + if timeIdx < numCorrTimes: #We need to already have the corresponding corrected time array + trueTimesInst = corrTimes[timeIdx] + offsets[timeIdx] # 1D Array + Scalar -> 1D Array + self.true_times.putRow(100, trueTimesInst, timeIdx) + #propagate offsets to children HUBs + for child in range(4): + childIdx =self.__getattr__('child%d_idx' % (child)).data() + if childIdx < 0: #children finished + break + currOffsetInts = trueTimesInst[childIdx] + currChildHub = self.__getattr__('in_%d_hub_path' % (child)).getData() #It must be a HUB path + currChildHub.time_offsets.putRow(100, currOffsetInst, timeIdx) #The index is the same of the index in trueTimes here + currChildHub.times.putRow(100, times[timeIdx], timeIdx) + + # third step, valid for all: add adjusted segment for inputs from RP + times = self.times.data() #1 D Array + trueTimes = self.true_times.data() #2 D Array + if len(times) != len(trueTimes): + print('WARINING Internal error: different length in times and trueTimes: ', len(times), len(trueTimes)) + minLen = len(times) + if minLen > len(trueTimes): + minLen = len(trueTimes) + + for chanIdx in range(self.NUM_INPUTS): + try: + inSigNode = self.__getattr__('in_%d_in_sig' % (chanIdx)) + except: + continue # Not RP + try: + inSegments = inSigNode.getData().getNumSegments() + except: + inSegments = 0 + print('segments: ', inSegments) + if inSegments == 0: + continue #do not consider missing inputs + if len(trueTimes) > inSegments: + print('WARNING different length for RP signal segments and trueTimes: ', inSegments, len(trueTimes)) + outSegments = self.__getattr__('in_%d_out_sig' % (chanIdx)).getNumSegments() + for segIdx in range(outSegments, inSegments): + if segIdx >= minLen: + break # No more true time information + currSigData = inSigNode.getData().getSegment(segIdx).data() + currStart = times[segIdx] + trueTimes[segIdx][chanIdx] * 1E-9 + print(trueTimes[segIdx][chanIdx]) + currEnd = currStart + len(currSigData) * self.SAMPLE_NS * 1E-9 + currDelta = self.SAMPLE_NS * 1E-9 + dim = Range(Float64(currStart), Float64(currEnd),Float64(self.SAMPLE_NS * 1E-9)) + self.__getattr__('in_%d_out_sig' % (chanIdx)).makeSegment(Float64(currStart), Float64(currEnd), dim, Int32Array(currSigData)) + + finally: + TRIG_HUB.lock.release() + + diff --git a/tdi/RfxDevices/setAbsoluteTime.py b/tdi/RfxDevices/setAbsoluteTime.py new file mode 100644 index 0000000000..f6896867af --- /dev/null +++ b/tdi/RfxDevices/setAbsoluteTime.py @@ -0,0 +1,33 @@ +def setAbsoluteTime(devtype, devnum, node, delay): + from ctypes import CDLL, c_int, byref, c_uint64 + + tcnLib = None + if tcnLib is None: + tcnLib = CDLL("libtcn.so", use_errno=True) + print('OK') + + niLib = None + if niLib is None: + niLib = CDLL("libnisync.so", use_errno=True) + + print('OK') + + status = tcnLib.tcn_init() + + print('OK', status) + + FD = niLib.nisync_open_device(c_int(devtype), c_int(devnum)) + + print('OK', FD) + + curr_nanos = c_uint64() + + status = niLib.nisync_get_time_ns(c_int(FD), byref(curr_nanos)) + + print('OK', status) + + # SAVING THE TIME INFOMRATION IN THE PULSE + node.putData(curr_nanos.value + delay*1000000000) + + return(1) +