diff --git a/java/devicebeans/src/main/java/DeviceInputs.java b/java/devicebeans/src/main/java/DeviceInputs.java index 55a8a832fe..440811fbb9 100644 --- a/java/devicebeans/src/main/java/DeviceInputs.java +++ b/java/devicebeans/src/main/java/DeviceInputs.java @@ -16,7 +16,6 @@ public class DeviceInputs extends DeviceComponent private JTextField valuesTF[], fieldsTF[][]; private JLabel labels[]; int numParameters[], numFields[]; - private int numInputChildren = 0; public DeviceInputs() { } @@ -41,17 +40,18 @@ protected void initializeData(String data, boolean is_on) JPanel jp = new JPanel(); jp.setLayout(new GridLayout(numInputs, 1)); int currInputNid = currNid + 1; - try { - int children = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_CHILDREN\')"); - int members = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_MEMBERS\')"); - numInputChildren = children + members; - }catch(Exception exc) - { - System.out.println("Error getting number of input children"); - } for(int i = 0; i < numInputs; i++) { - try { + int numInputChildren = 0; + try { + int children = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_CHILDREN\')"); + int members = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_MEMBERS\')"); + numInputChildren = children + members; + }catch(Exception exc) + { + System.out.println("Error getting number of input children"); + } + try { numParameters[i] = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid+6)+",\'NUMBER_OF_CHILDREN\')"); }catch(Exception exc) { @@ -114,6 +114,15 @@ protected void displayData(String data, boolean is_on) int currInputNid = baseNid + offsetNid + 1; for(int inputIdx = 0; inputIdx < numInputs; inputIdx++) { + int numInputChildren = 0; + try { + int children = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_CHILDREN\')"); + int members = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_MEMBERS\')"); + numInputChildren = children + members; + }catch(Exception exc) + { + System.out.println("Error getting number of input children"); + } try { valuesTF[inputIdx].setText(subtree.getDataExpr(currInputNid + 4)); }catch(Exception exc) @@ -138,10 +147,11 @@ public void apply() throws Exception int currInputNid = baseNid + offsetNid + 1; for(int inputIdx = 0; inputIdx < numInputs; inputIdx++) { - try { - int children = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_CHILDREN\')"); - int members = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_MEMBERS\')"); - numInputChildren = children + members; + int numInputChildren = 0; + try { + int children = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_CHILDREN\')"); + int members = subtree.getInt("GETNCI("+subtree.getFullPath(currInputNid)+",\'NUMBER_OF_MEMBERS\')"); + numInputChildren = children + members; }catch(Exception exc) { System.out.println("Error getting number of input children"); diff --git a/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java index dfff1af1fe..08618061a4 100644 --- a/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java +++ b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java @@ -29,6 +29,8 @@ private void initComponents() { deviceButtons1 = new DeviceButtons(); jPanel2 = new javax.swing.JPanel(); deviceField1 = new DeviceField(); + deviceField2 = new DeviceField(); + deviceField3 = new DeviceField(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); deviceInputs1 = new DeviceInputs(); @@ -41,7 +43,7 @@ private void initComponents() { setDeviceTitle("DTT Simularot"); setDeviceType("MARTE2_SIMULINK_DTT"); setHeight(500); - setWidth(400); + setWidth(700); getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); deviceField1.setIdentifier(""); @@ -50,25 +52,37 @@ private void initComponents() { deviceField1.setOffsetNid(3); jPanel2.add(deviceField1); + deviceField2.setIdentifier(""); + deviceField2.setLabelString("Time Div.:"); + deviceField2.setNumCols(4); + deviceField2.setOffsetNid(253); + jPanel2.add(deviceField2); + + deviceField3.setIdentifier(""); + deviceField3.setLabelString("Write CPU Mask: "); + deviceField3.setNumCols(4); + deviceField3.setOffsetNid(120); + jPanel2.add(deviceField3); + getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_START); jPanel1.setLayout(new java.awt.BorderLayout()); - deviceInputs1.setOffsetNid(23); + deviceInputs1.setOffsetNid(26); jPanel1.add(deviceInputs1, java.awt.BorderLayout.CENTER); jTabbedPane1.addTab("Inputs", jPanel1); jPanel3.setLayout(new java.awt.BorderLayout()); - deviceOutputs1.setOffsetNid(104); + deviceOutputs1.setOffsetNid(114); jPanel3.add(deviceOutputs1, java.awt.BorderLayout.CENTER); jTabbedPane1.addTab("Outputs", jPanel3); jPanel4.setLayout(new java.awt.BorderLayout()); - deviceParameters1.setNumParameters(1); + deviceParameters1.setNumParameters(3); deviceParameters1.setOffsetNid(4); deviceParameters1.setParameterOffset(4); jPanel4.add(deviceParameters1, java.awt.BorderLayout.CENTER); @@ -82,6 +96,8 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; private DeviceField deviceField1; + private DeviceField deviceField2; + private DeviceField deviceField3; private DeviceInputs deviceInputs1; private DeviceOutputs deviceOutputs1; private DeviceParameters deviceParameters1; diff --git a/java/jdevices/src/main/java/MARTE2_SIMULINK_DTT_VSSetup.java b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTT_VSSetup.java new file mode 100644 index 0000000000..ef64e36558 --- /dev/null +++ b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTT_VSSetup.java @@ -0,0 +1,83 @@ +/* + * 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 MARTE2_SIMULINK_DTT_VSSetup extends DeviceSetup { + + /** + * Creates new form MARTE2_SIMULINK_DTT_VSSetup + */ + public MARTE2_SIMULINK_DTT_VSSetup() { + 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() { + + deviceButtons1 = new DeviceButtons(); + jPanel1 = new javax.swing.JPanel(); + deviceField1 = new DeviceField(); + deviceField2 = new DeviceField(); + deviceField3 = new DeviceField(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + deviceInputs1 = new DeviceInputs(); + deviceOutputs1 = new DeviceOutputs(); + + setDeviceProvider("localhost:8100"); + setDeviceTitle("DTT VS Control"); + setDeviceType("MARTE2_SIMULINK_DTT_VS"); + setHeight(400); + setWidth(800); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Timebase: "); + deviceField1.setNumCols(25); + deviceField1.setOffsetNid(3); + jPanel1.add(deviceField1); + + deviceField2.setIdentifier(""); + deviceField2.setLabelString("Time Div.: "); + deviceField2.setNumCols(4); + deviceField2.setOffsetNid(54); + jPanel1.add(deviceField2); + + deviceField3.setIdentifier(""); + deviceField3.setLabelString("Write CPU Mask: "); + deviceField3.setNumCols(6); + deviceField3.setOffsetNid(44); + jPanel1.add(deviceField3); + + getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START); + + deviceInputs1.setOffsetNid(17); + jTabbedPane1.addTab("Inputs", deviceInputs1); + jTabbedPane1.addTab("Outputs", deviceOutputs1); + + 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 deviceField2; + private DeviceField deviceField3; + private DeviceInputs deviceInputs1; + private DeviceOutputs deviceOutputs1; + private javax.swing.JPanel jPanel1; + private javax.swing.JTabbedPane jTabbedPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form b/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form index 2d8f9c638c..e7e21e5ac6 100644 --- a/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form @@ -6,7 +6,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -50,6 +50,22 @@ + + + + + + + + + + + + + + + + @@ -74,7 +90,7 @@ - + @@ -99,7 +115,7 @@ - + @@ -124,7 +140,7 @@ - + diff --git a/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTT_VSSetup.form b/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTT_VSSetup.form new file mode 100644 index 0000000000..b7e422b2d3 --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTT_VSSetup.form @@ -0,0 +1,108 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mdsobjects/cpp/mdstreeobjects.cpp b/mdsobjects/cpp/mdstreeobjects.cpp index 979a2f844d..2be90a2d74 100644 --- a/mdsobjects/cpp/mdstreeobjects.cpp +++ b/mdsobjects/cpp/mdstreeobjects.cpp @@ -199,7 +199,7 @@ Tree::Tree(char const *name, int shot, void *ctx) } Tree::Tree(Tree *tree) - : name(tree->name), shot(tree->shot), fromActiveTree(true) + : name(tree->name), shot(tree->shot), fromActiveTree(true), ronly(tree->ronly) { struct TreeThreadContextInfo ttci = {GET_THREAD_ID, tree->getCtx()}; threadContextV.push_back(ttci); diff --git a/pydevices/RfxDevices/MARTE2_COMPONENT.py b/pydevices/RfxDevices/MARTE2_COMPONENT.py index 19c249fc61..904b901552 100644 --- a/pydevices/RfxDevices/MARTE2_COMPONENT.py +++ b/pydevices/RfxDevices/MARTE2_COMPONENT.py @@ -1532,9 +1532,13 @@ def getMarteGamInfo(self, threadMap, gams, dataSources, gamList, typeDicts): currSamples = outputDict['samples'] except: currSamples = 1 + timeSegLen = 1000 + for outputDict in outputDicts: + if outputDict['seg_len'] > 0: + timeSegLen = outputDict['seg_len'] dataSourceText += ' Period = '+str(period/currSamples)+'\n' - dataSourceText += ' MakeSegmentAfterNWrites = 100\n' + dataSourceText += ' MakeSegmentAfterNWrites = '+str(timeSegLen) + '\n' dataSourceText += ' AutomaticSegmentation = 0\n' if outputTrigger != None: dataSourceText += ' TimeSignal = 1\n' @@ -2218,6 +2222,7 @@ def getMarteGamInfo(self, threadMap, gams, dataSources, gamList, typeDicts): if len(asynchThreadSignals) > 0: dataSourceText = ' +'+gamName+'_Output_Asynch = {\n' dataSourceText += ' Class = RealTimeThreadAsyncBridge\n' + dataSourceText += ' BlockingMode = 1\n' dataSourceText += ' }\n' dataSources.append(dataSourceText) @@ -2594,7 +2599,14 @@ def getMarteInputInfo(self, threadMap, gams, dataSources, gamList, isSynch): # We must keep into account the number of samples in an input device dataSourceText += ' Period = ' + \ str(period/outputDict['samples'])+'\n' - dataSourceText += ' MakeSegmentAfterNWrites = 100\n' + + + timeSegLen = 1000 + for outputDict in outputDicts: + if outputDict['seg_len'] > 0: + timeSegLen = outputDict['seg_len'] + dataSourceText += ' MakeSegmentAfterNWrites = '+str(timeSegLen) + '\n' + # dataSourceText += ' MakeSegmentAfterNWrites = 100\n' dataSourceText += ' AutomaticSegmentation = 0\n' dataSourceText += ' Type = uint32\n' #if startTime != 0: