diff --git a/Jenkinsfile b/Jenkinsfile index 1a3574447a..c4da0826b1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,7 @@ def OSList = [ 'ubuntu18', 'ubuntu20', 'ubuntu22', + 'ubuntu24', 'rhel7', 'rhel8', 'rhel9', @@ -13,6 +14,7 @@ def OSList = [ 'debian9-64', 'debian10-64', 'debian11-64', + 'debian12-64', 'test-asan', 'test-tsan', 'test-ubsan', @@ -39,6 +41,7 @@ if (BRANCH_NAME == "stable") { } def new_version = '0.0.0'; +def new_tag = null; def release_file_list = []; @@ -105,6 +108,8 @@ pipeline { if (new_version == '0.0.0') { error "Failed to calculate new version" } + + new_tag = "${BRANCH_NAME}_release-" + new_version.replaceAll("\\.", "-") echo "Calculated new version to be ${new_version}" } @@ -121,10 +126,14 @@ pipeline { ws("${WORKSPACE}/${OS}") { stage("${OS} Clone") { checkout scm; + + if (new_tag) { + sh "git tag ${new_tag} || true" + } } stage("${OS} Bootstrap") { - sh "./deploy/build.sh --os=bootstrap --branch=${BRANCH_NAME} --version=${new_version}" + sh "./deploy/build.sh --os=bootstrap --branch=${BRANCH_NAME}" if (OS.endsWith("armhf")) { sh "docker run --rm --privileged multiarch/qemu-user-static:register --reset" @@ -146,7 +155,7 @@ pipeline { if (!OS.startsWith("test-")) { stage("${OS} Release") { - sh "./deploy/build.sh --os=${OS} --release --branch=${BRANCH_NAME} --version=${new_version}" + sh "./deploy/build.sh --os=${OS} --release --branch=${BRANCH_NAME} --version=${new_version} --keys=/mdsplus/certs" findFiles(glob: "packages/*.tgz").each { file -> release_file_list.add(WORKSPACE + "/" + file.path) @@ -220,8 +229,7 @@ pipeline { stage("Publish to GitHub") { ws("${WORKSPACE}/publish") { - def tag = "${BRANCH_NAME}_release-" + new_version.replaceAll("\\.", "-") - echo "Creating GitHub Release and Tag for ${tag}" + echo "Creating GitHub Release and Tag for ${new_tag}" withCredentials([ usernamePassword( credentialsId: 'MDSplusJenkins', @@ -231,7 +239,7 @@ pipeline { // TODO: Protect against spaces in filenames def release_file_list_arg = release_file_list.join(" ") - sh "./deploy/create_github_release.py --tag ${tag} --api-token \$GITHUB_ACCESS_TOKEN ${release_file_list_arg}" + sh "./deploy/create_github_release.py --tag ${new_tag} --api-token \$GITHUB_ACCESS_TOKEN ${release_file_list_arg}" } } diff --git a/_include/_mdsversion.h.in b/_include/_mdsversion.h.in index 0f78c33da8..99a298a9cc 100644 --- a/_include/_mdsversion.h.in +++ b/_include/_mdsversion.h.in @@ -8,6 +8,7 @@ #define VERSIONCONST CONCAT(LIBPREFIX, Version) #define GETRELEASE CONCAT(LIBPREFIX, Release) #define GETRELEASEDSC CONCAT(LIBPREFIX, ReleaseDsc) +#define GETRELEASEDATE CONCAT(LIBPREFIX, ReleaseDate) EXPORT const mds_version_t VERSIONCONST = { @@ -17,14 +18,15 @@ const mds_version_t VERSIONCONST = { "@RELEASE_BRANCH@", }; - static pthread_once_t once = PTHREAD_ONCE_INIT; static char tag[64]; static mdsdsc_t RELEASE_D = { 0, DTYPE_T, CLASS_S, tag }; +static const char release_date[64] = "@RELEASE_DATE@"; + static void buildtag() { - RELEASE_D.length = snprintf(tag, sizeof(tag), "%.12s_release_%d.%d.%d", + RELEASE_D.length = snprintf(tag, sizeof(tag), "%.12s_release-%d-%d-%d", VERSIONCONST.BRANCH, VERSIONCONST.MAJOR, VERSIONCONST.MINOR, @@ -44,3 +46,9 @@ const mdsdsc_t *GETRELEASEDSC() pthread_once(&once, buildtag); return &RELEASE_D; } + +EXPORT +const char *GETRELEASEDATE() +{ + return release_date; +} diff --git a/_include/mdsmsg.h b/_include/mdsmsg.h index 498a0a6465..4faf764be2 100644 --- a/_include/mdsmsg.h +++ b/_include/mdsmsg.h @@ -1,6 +1,8 @@ #include #include +#include +// To activate the MDSDBG() debug messages, uncomment the following line. //#define DEBUG //#undef DEBUG #ifdef MDSDBG @@ -27,7 +29,7 @@ #define __MDSMSGPREFIX(LV) ( \ { \ pos = __FILE__; \ - while (!strncmp(pos, "../", 3)) \ + while (!strncmp(pos, "../", (unsigned long int) 3)) \ pos += 3; \ pos = msg + sprintf(msg, "%c, %u:%lu, %u.%09u: %s:%d ", \ LV, getpid(), CURRENT_THREAD_ID(), \ diff --git a/configure.ac b/configure.ac index 348d69737c..fa0bf49877 100644 --- a/configure.ac +++ b/configure.ac @@ -533,6 +533,7 @@ esac # add specific flags for fortran depending on compiler version AX_FORTRAN_FLAGS([FCFLAGS]) +AX_C_FLAGS([CFLAGS]) AC_CHECK_SIZEOF(long) diff --git a/deploy/os/debian12-64.opts b/deploy/os/debian12-64.opts new file mode 100644 index 0000000000..26ad1cec2a --- /dev/null +++ b/deploy/os/debian12-64.opts @@ -0,0 +1 @@ +--platform=debian --valgrind=memcheck,helgrind --dockerimage=mdsplus/builder:debian_bookworm-64 --distname=DebianBookworm --arch=amd64 diff --git a/deploy/os/ubuntu24.opts b/deploy/os/ubuntu24.opts new file mode 100644 index 0000000000..285502c7dd --- /dev/null +++ b/deploy/os/ubuntu24.opts @@ -0,0 +1 @@ +--platform=debian --valgrind=memcheck,helgrind --dockerimage=mdsplus/builder:ubuntu24-64 --distname=Ubuntu24 --arch=amd64 diff --git a/deploy/packaging/debian/kernel.noarch b/deploy/packaging/debian/kernel.noarch index 7238981dce..2a377ec5bd 100644 --- a/deploy/packaging/debian/kernel.noarch +++ b/deploy/packaging/debian/kernel.noarch @@ -231,6 +231,7 @@ ./usr/local/mdsplus/tdi/treeshr/TreeOpenEdit.fun ./usr/local/mdsplus/tdi/treeshr/TreeOpenNew.fun ./usr/local/mdsplus/tdi/treeshr/TreePut.fun +./usr/local/mdsplus/tdi/treeshr/TreePutDeserialized.fun ./usr/local/mdsplus/tdi/treeshr/TreePutRecord.fun ./usr/local/mdsplus/tdi/treeshr/TreeQuit.fun ./usr/local/mdsplus/tdi/treeshr/TreeSetCurrentShot.fun diff --git a/deploy/packaging/debian/matlab.noarch b/deploy/packaging/debian/matlab.noarch index 997eda5fa2..530d9820f0 100644 --- a/deploy/packaging/debian/matlab.noarch +++ b/deploy/packaging/debian/matlab.noarch @@ -16,8 +16,10 @@ ./usr/local/mdsplus/matlab/private/javaConnect.m ./usr/local/mdsplus/matlab/private/javaExecute.m ./usr/local/mdsplus/matlab/private/javaFromMatlab.m +./usr/local/mdsplus/matlab/private/javaFromMatlabCell.m ./usr/local/mdsplus/matlab/private/javaFromMatlabStruct.m ./usr/local/mdsplus/matlab/private/javaToMatlab.m +./usr/local/mdsplus/matlab/private/javaToMatlabCell.m ./usr/local/mdsplus/matlab/private/javaToMatlabStruct.m ./usr/local/mdsplus/matlab/private/pythonActivate.m ./usr/local/mdsplus/matlab/private/pythonConnect.m diff --git a/deploy/packaging/debian/python.noarch b/deploy/packaging/debian/python.noarch index 4086298248..9ca17ae7d4 100644 --- a/deploy/packaging/debian/python.noarch +++ b/deploy/packaging/debian/python.noarch @@ -13,9 +13,9 @@ ./usr/local/mdsplus/python/MDSplus/mdsdcl.py ./usr/local/mdsplus/python/MDSplus/mdsscalar.py ./usr/local/mdsplus/python/MDSplus/modpython.py +./usr/local/mdsplus/python/MDSplus/pyproject.toml ./usr/local/mdsplus/python/MDSplus/scope.py ./usr/local/mdsplus/python/MDSplus/setup.py -./usr/local/mdsplus/python/MDSplus/pyproject.toml ./usr/local/mdsplus/python/MDSplus/tests/__init__.py ./usr/local/mdsplus/python/MDSplus/tests/_common.py ./usr/local/mdsplus/python/MDSplus/tests/connection_case.py diff --git a/deploy/packaging/debian/rfxdevices.noarch b/deploy/packaging/debian/rfxdevices.noarch index 002f32e131..2132b79d52 100644 --- a/deploy/packaging/debian/rfxdevices.noarch +++ b/deploy/packaging/debian/rfxdevices.noarch @@ -30,9 +30,12 @@ ./usr/local/mdsplus/pydevices/RfxDevices/MARTE.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_COMPONENT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_CONVERSION.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DOUBLEH_MASTER.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DOUBLEH_SLAVE.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DTACQAI.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DTACQAO.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DUTY_CYCLE.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EPICSCA.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EPICS_IN.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EPICS_OUT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EXPR.py @@ -51,13 +54,19 @@ ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_NI6368_DAC.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_NI6368_DO.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_NI6368_SYNCH_DI.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OPCUA_IN.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OPCUA_OUT.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OPCUA_SERVER.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OUT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON_GENERIC.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON_PID.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON_PWM.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RAMP.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RESAMPLER.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RFXMODEL.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RTNIN.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RTNOUT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RTSM.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT.py diff --git a/deploy/packaging/linux.xml b/deploy/packaging/linux.xml index 182302d729..ea5539729a 100644 --- a/deploy/packaging/linux.xml +++ b/deploy/packaging/linux.xml @@ -836,6 +836,12 @@ rm -f /etc/ld.so.conf.d/mdsplus.conf 2>/dev/null + + + + + + @@ -848,6 +854,12 @@ rm -f /etc/ld.so.conf.d/mdsplus.conf 2>/dev/null + + + + + + diff --git a/deploy/packaging/redhat/kernel.noarch b/deploy/packaging/redhat/kernel.noarch index f601a3b3c6..066cf33ec0 100644 --- a/deploy/packaging/redhat/kernel.noarch +++ b/deploy/packaging/redhat/kernel.noarch @@ -263,6 +263,7 @@ ./usr/local/mdsplus/tdi/treeshr/TreeOpenEdit.fun ./usr/local/mdsplus/tdi/treeshr/TreeOpenNew.fun ./usr/local/mdsplus/tdi/treeshr/TreePut.fun +./usr/local/mdsplus/tdi/treeshr/TreePutDeserialized.fun ./usr/local/mdsplus/tdi/treeshr/TreePutRecord.fun ./usr/local/mdsplus/tdi/treeshr/TreeQuit.fun ./usr/local/mdsplus/tdi/treeshr/TreeSetCurrentShot.fun diff --git a/deploy/packaging/redhat/matlab.noarch b/deploy/packaging/redhat/matlab.noarch index a674d12481..776deed597 100644 --- a/deploy/packaging/redhat/matlab.noarch +++ b/deploy/packaging/redhat/matlab.noarch @@ -18,8 +18,10 @@ ./usr/local/mdsplus/matlab/private/javaConnect.m ./usr/local/mdsplus/matlab/private/javaExecute.m ./usr/local/mdsplus/matlab/private/javaFromMatlab.m +./usr/local/mdsplus/matlab/private/javaFromMatlabCell.m ./usr/local/mdsplus/matlab/private/javaFromMatlabStruct.m ./usr/local/mdsplus/matlab/private/javaToMatlab.m +./usr/local/mdsplus/matlab/private/javaToMatlabCell.m ./usr/local/mdsplus/matlab/private/javaToMatlabStruct.m ./usr/local/mdsplus/matlab/private/pythonActivate.m ./usr/local/mdsplus/matlab/private/pythonConnect.m diff --git a/deploy/packaging/redhat/python.noarch b/deploy/packaging/redhat/python.noarch index 10aaaf3ed2..64d9f4a033 100644 --- a/deploy/packaging/redhat/python.noarch +++ b/deploy/packaging/redhat/python.noarch @@ -14,9 +14,9 @@ ./usr/local/mdsplus/python/MDSplus/mdsdcl.py ./usr/local/mdsplus/python/MDSplus/mdsscalar.py ./usr/local/mdsplus/python/MDSplus/modpython.py +./usr/local/mdsplus/python/MDSplus/pyproject.toml ./usr/local/mdsplus/python/MDSplus/scope.py ./usr/local/mdsplus/python/MDSplus/setup.py -./usr/local/mdsplus/python/MDSplus/pyproject.toml ./usr/local/mdsplus/python/MDSplus/tests ./usr/local/mdsplus/python/MDSplus/tests/__init__.py ./usr/local/mdsplus/python/MDSplus/tests/_common.py diff --git a/deploy/packaging/redhat/rfxdevices.noarch b/deploy/packaging/redhat/rfxdevices.noarch index e114a6eedf..e907de8bd9 100644 --- a/deploy/packaging/redhat/rfxdevices.noarch +++ b/deploy/packaging/redhat/rfxdevices.noarch @@ -31,9 +31,12 @@ ./usr/local/mdsplus/pydevices/RfxDevices/MARTE.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_COMPONENT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_CONVERSION.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DOUBLEH_MASTER.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DOUBLEH_SLAVE.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DTACQAI.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DTACQAO.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_DUTY_CYCLE.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EPICSCA.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EPICS_IN.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EPICS_OUT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_EXPR.py @@ -52,13 +55,19 @@ ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_NI6368_DAC.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_NI6368_DO.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_NI6368_SYNCH_DI.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OPCUA_IN.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OPCUA_OUT.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OPCUA_SERVER.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_OUT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON_GENERIC.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON_PID.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_PYTHON_PWM.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RAMP.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RESAMPLER.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RFXMODEL.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RTNIN.py +./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RTNOUT.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_RTSM.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK.py ./usr/local/mdsplus/pydevices/RfxDevices/MARTE2_SIMULINK_DTT.py diff --git a/deploy/platform/bootstrap/bootstrap_build.sh b/deploy/platform/bootstrap/bootstrap_build.sh index 89b6989494..ec2493dbed 100755 --- a/deploy/platform/bootstrap/bootstrap_build.sh +++ b/deploy/platform/bootstrap/bootstrap_build.sh @@ -14,5 +14,7 @@ trap cleanup EXIT INT docker run -t -a stdout -a stderr --cidfile=$cid \ -u $(id -u):$(id -g) --privileged \ -e "HOME=/tmp" \ + -e "BRANCH" \ + -e "RELEASE_VERSION" \ -v "${SRCDIR}:${DOCKER_SRCDIR}" \ ${DOCKERIMAGE} "${DOCKER_SRCDIR}/bootstrap" diff --git a/include/mdsobjects.h b/include/mdsobjects.h index f44af2f12f..d86aba4fc3 100644 --- a/include/mdsobjects.h +++ b/include/mdsobjects.h @@ -4504,9 +4504,10 @@ namespace MDSplus closeAllTrees(); } void setDefault(char *path); - Data *get(const char *expr, Data **args, int nArgs); + Data *get(const char *expr, Data **args, int nArgs, bool serialized = true); Data *get(const char *expr) { return get(expr, 0, 0); } void put(const char *path, char *expr, Data **args, int nArgs); + void put(const char *path, Data *data); PutMany *putMany() { return new PutMany(this); } GetMany *getMany() { return new GetMany(this); } // Get TreeNode instance for (a subset of) TreeNode functionality in thin diff --git a/java/devicebeans/src/main/java/DeviceInputs.java b/java/devicebeans/src/main/java/DeviceInputs.java index 0ca648b8ad..d9df047bcf 100644 --- a/java/devicebeans/src/main/java/DeviceInputs.java +++ b/java/devicebeans/src/main/java/DeviceInputs.java @@ -13,9 +13,22 @@ public class DeviceInputs extends DeviceComponent private JScrollPane scrollP; private int numInputs; - private JTextField valuesTF[], fieldsTF[][], parametersTF[][]; + private JTextField valuesTF[], dimensionsTF[], fieldsTF[][], parametersTF[][]; + private JTextField typesTF[]; + private boolean parametersIsText[][]; private JLabel labels[]; int numParameters[], numFields[]; + static final String types[] = {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}; + private int stringToIdx(String type) + { + for(int i = 0; i < types.length; i++) + { + if(types[i].equals(type)) + return i; + } + return 0; + } + public DeviceInputs() { } @@ -33,11 +46,14 @@ protected void initializeData(String data, boolean is_on) numInputs = subtree.getInt("GETNCI("+subtree.getFullPath(currNid)+",\'NUMBER_OF_CHILDREN\')"); }catch(Exception exc){numInputs = 0;} valuesTF = new JTextField[numInputs]; + typesTF = new JTextField[numInputs]; + dimensionsTF = new JTextField[numInputs]; labels = new JLabel[numInputs]; fieldsTF = new JTextField[numInputs][]; numParameters = new int[numInputs]; numFields = new int[numInputs]; parametersTF = new JTextField[numInputs][]; + parametersIsText = new boolean[numInputs][]; JPanel jp = new JPanel(); jp.setLayout(new GridLayout(numInputs, 1)); int currInputNid = currNid + 1; @@ -71,6 +87,7 @@ protected void initializeData(String data, boolean is_on) } fieldsTF[i] = new JTextField[numFields[i]]; parametersTF[i] = new JTextField[numParameters[i]]; + parametersIsText[i] = new boolean[numParameters[i]]; String inputName; try { inputName = subtree.getString(subtree.getDataExpr(currInputNid + 5)); @@ -85,9 +102,12 @@ protected void initializeData(String data, boolean is_on) jp1.setLayout(new GridLayout(1 + numFields[i],1)); JPanel jp2 = new JPanel(); - // jp2.setLayout(new BorderLayout()); - //jp2.add(valuesTF[i] = new JTextField(), "Center"); + jp2.add(new JLabel("Value:")); jp2.add(valuesTF[i] = new JTextField(30)); + jp2.add(new JLabel("Type:")); + jp2.add(typesTF[i] = new JTextField(10)); + jp2.add(new JLabel("Dimensions:")); + jp2.add(dimensionsTF[i] = new JTextField(4)); for(int parIdx = 0; parIdx < numParameters[i]; parIdx++) { java.lang.String parName = ""; @@ -99,13 +119,19 @@ protected void initializeData(String data, boolean is_on) } jp2.add(new JLabel(parName+":")); jp2.add(parametersTF[i][parIdx] = new JTextField(10)); + try { + parametersIsText[i][parIdx] = subtree.getUsage(currInputNid + 8 + 1 + 3 * parIdx).equals("TEXT"); + }catch(Exception exc) + { + System.out.println("OHI CANNOT TAKE USAGE"); + } } jp1.add(jp2); for (int fieldIdx = 0; fieldIdx < numFields[i]; fieldIdx++) { String fieldName; try { - fieldName = subtree.getString(subtree.getDataExpr(currInputNid + 8 + 3 * numParameters[i] + 6 * fieldIdx + 4)); + fieldName = subtree.getString(subtree.getDataExpr(currInputNid + 8 + 3 * numParameters[i] + 8 * fieldIdx + 5)); }catch(Exception exc) { fieldName = ""; @@ -116,7 +142,7 @@ protected void initializeData(String data, boolean is_on) jp2.add(fieldsTF[i][fieldIdx] = new JTextField(), "Center"); jp1.add(jp2); } - currInputNid += numInputChildren + 1 + 3 * numParameters[i] + 6 * numFields[i]; + currInputNid += numInputChildren + 1 + 3 * numParameters[i] + 8 * numFields[i]; jp.add(jp1); } scrollP = new JScrollPane(jp); @@ -139,15 +165,37 @@ protected void displayData(String data, boolean is_on) System.out.println("Error getting number of input children"); } try { - valuesTF[inputIdx].setText(subtree.getDataExpr(currInputNid + 4)); + valuesTF[inputIdx].setText(subtree.getDataExpr(currInputNid + 4)); }catch(Exception exc) { valuesTF[inputIdx].setText(""); } + try { + String typeStr = subtree.getDataExpr(currInputNid + 1).replace("\"", ""); + typesTF[inputIdx].setText(typeStr); + }catch(Exception exc) + { + typesTF[inputIdx].setText(""); + } + try { + dimensionsTF[inputIdx].setText(subtree.getDataExpr(currInputNid + 2)); + }catch(Exception exc) + { + dimensionsTF[inputIdx].setText(""); + } for(int parIdx = 0; parIdx < numParameters[inputIdx]; parIdx++) { try { - parametersTF[inputIdx][parIdx].setText(subtree.getDataExpr(currInputNid + 9 + 3 * parIdx)); + String parVal = subtree.getDataExpr(currInputNid + 9 + 3 * parIdx); + if(parametersIsText[inputIdx][parIdx]) + { + parametersTF[inputIdx][parIdx].setText(parVal.substring(1, parVal.length() - 1)); + } + else + { + parametersTF[inputIdx][parIdx].setText(parVal); + } + }catch(Exception exc) { parametersTF[inputIdx][parIdx].setText(""); @@ -156,10 +204,10 @@ protected void displayData(String data, boolean is_on) for(int fieldIdx = 0; fieldIdx < numFields[inputIdx]; fieldIdx++) { try { - fieldsTF[inputIdx][fieldIdx].setText(subtree.getDataExpr(currInputNid + 8 + 3 * numParameters[inputIdx] + 6 * fieldIdx + 5)); + fieldsTF[inputIdx][fieldIdx].setText(subtree.getDataExpr(currInputNid + 8 + 3 * numParameters[inputIdx] + 8 * fieldIdx + 4)); }catch(Exception exc){fieldsTF[inputIdx][fieldIdx].setText("");} } - currInputNid += numInputChildren + 1 + 3 * numParameters[inputIdx] + 6 * numFields[inputIdx]; + currInputNid += numInputChildren + 1 + 3 * numParameters[inputIdx] + 8 * numFields[inputIdx]; } } @@ -180,6 +228,18 @@ public void apply() throws Exception { System.out.println("Error getting number of input children"); } + try { + subtree.putDataExpr(currInputNid + 1, "\""+typesTF[inputIdx].getText()+"\""); + }catch(Exception exc) + { + JOptionPane.showMessageDialog(null, ""+exc, "Error in input field "+inputIdx, JOptionPane.WARNING_MESSAGE); + } + try { + subtree.putDataExpr(currInputNid + 2, dimensionsTF[inputIdx].getText()); + }catch(Exception exc) + { + JOptionPane.showMessageDialog(null, ""+exc, "Error in input field "+inputIdx, JOptionPane.WARNING_MESSAGE); + } try { subtree.putDataExpr(currInputNid + 4, valuesTF[inputIdx].getText()); }catch(Exception exc) @@ -189,8 +249,16 @@ public void apply() throws Exception for(int parIdx = 0; parIdx < numParameters[inputIdx]; parIdx++) { try { - subtree.putDataExpr(currInputNid + 9 + 3 * parIdx, parametersTF[inputIdx][parIdx].getText()); - }catch(Exception exc) + String parVal = parametersTF[inputIdx][parIdx].getText(); + if(parametersIsText[inputIdx][parIdx]) + { + subtree.putDataExpr(currInputNid + 9 + 3 * parIdx, "\'"+parVal+"\'"); + } + else + { + subtree.putDataExpr(currInputNid + 9 + 3 * parIdx, parVal); + } + }catch(Exception exc) { JOptionPane.showMessageDialog(null, ""+exc, "Error in paremeter field "+inputIdx, JOptionPane.WARNING_MESSAGE); } @@ -198,14 +266,14 @@ public void apply() throws Exception for(int fieldIdx = 0; fieldIdx < numFields[inputIdx]; fieldIdx++) { try { - subtree.putDataExpr(currInputNid + 8 + 3 * numParameters[inputIdx] + 6 * fieldIdx + 5, fieldsTF[inputIdx][fieldIdx].getText()); + subtree.putDataExpr(currInputNid + 8 + 3 * numParameters[inputIdx] + 8 * fieldIdx + 4, fieldsTF[inputIdx][fieldIdx].getText()); }catch(Exception exc) { JOptionPane.showMessageDialog(null, ""+exc, "Error in subfield of input field "+inputIdx, JOptionPane.WARNING_MESSAGE); } } - currInputNid += numInputChildren + 1 + 3 * numParameters[inputIdx] + 6 * numFields[inputIdx]; + currInputNid += numInputChildren + 1 + 3 * numParameters[inputIdx] + 8 * numFields[inputIdx]; } } } diff --git a/java/devicebeans/src/main/java/DeviceOutputs.java b/java/devicebeans/src/main/java/DeviceOutputs.java index 7d90b7677d..30772c3c4b 100644 --- a/java/devicebeans/src/main/java/DeviceOutputs.java +++ b/java/devicebeans/src/main/java/DeviceOutputs.java @@ -13,7 +13,6 @@ public class DeviceOutputs extends DeviceComponent { - class FromTransferHandler extends TransferHandler { String path; @@ -43,10 +42,23 @@ public int getSourceActions(JComponent comp) private JScrollPane scrollP; private int numOutputs; private JTextField segLensTF[], parametersTF[], dimensionsTF[]; - private int segLenNids[], parameterNids[], dimensionNids[]; + private JTextField typesTF[]; + private boolean parametersIsText[]; + private int segLenNids[], parameterNids[], dimensionNids[], typeNids[]; private int numOutputChildren = 0; private int numItems; private int numParItems; + static final String types[] = {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}; + private int stringToIdx(String type) + { + for(int i = 0; i < types.length; i++) + { + if(types[i].equals(type)) + return i; + } + return 0; + } + public DeviceOutputs() { } @@ -93,12 +105,15 @@ protected void initializeData(String data, boolean is_on) numBusItems++; } numParItems += numPars; - currOutNid += 1 + numChildren + numMembers + 3 * numPars + 8 * numFields; + currOutNid += 1 + numChildren + numMembers + 3 * numPars + 10 * numFields; } + typesTF = new JTextField[numItems]; dimensionsTF = new JTextField[numItems]; segLensTF = new JTextField[numItems]; parametersTF = new JTextField[numParItems]; - + parametersIsText = new boolean[numParItems]; + + typeNids = new int[numItems]; dimensionNids = new int[numItems]; segLenNids = new int[numItems]; parameterNids = new int[numParItems]; @@ -138,8 +153,11 @@ protected void initializeData(String data, boolean is_on) jp1.add(new JLabel("Dimensions: ")); jp1.add(dimensionsTF[currItem] = new JTextField(4)); dimensionNids[currItem] = currOutNid + 4; + jp1.add(new JLabel("Type: ")); + jp1.add(typesTF[currItem] = new JTextField(10)); + typeNids[currItem] = currOutNid + 2; jp1.add(new JLabel("Segment len.: ")); - jp1.add(segLensTF[currItem] = new JTextField(10)); + jp1.add(segLensTF[currItem] = new JTextField(4)); segLenNids[currItem] = currOutNid + 5; currItem++; for(int parIdx = 0; parIdx < numPars; parIdx++) @@ -151,6 +169,13 @@ protected void initializeData(String data, boolean is_on) }catch(Exception exc){parName = "";} jp1.add(new JLabel(parName+":")); jp1.add(parametersTF[numParItems] = new JTextField(10)); + try { + parametersIsText[numParItems] = subtree.getUsage(currOutNid + 11 + 3 * parIdx).equals("TEXT"); + }catch(Exception exc) + { + System.out.println("Internal error: cannot state whether parameter is text"); + parametersIsText[numParItems] = false; + } parameterNids[numParItems++] = currOutNid + 11 + 3 * parIdx; } jp.add(jp1); @@ -174,17 +199,25 @@ public void mousePressed(MouseEvent me) jp.add(busLabel); for(int fieldIdx = 0; fieldIdx < numFields; fieldIdx++) { - int fieldNid = currOutNid + numChildren +numMembers +1 + 3 * numPars + 8 * fieldIdx; + int fieldNid = currOutNid + numChildren +numMembers +1 + 3 * numPars + 10 * fieldIdx; segLenNids[currItem] = fieldNid + 5; + dimensionNids[currItem] = currOutNid + 4; + typeNids[currItem] = currOutNid + 2; String fieldName = ""; try { fieldName = subtree.getString(subtree.getDataExpr(fieldNid + 1)); }catch(Exception exc){} JPanel jp1 = new JPanel(); jp1.setBorder(new TitledBorder(outName+'.'+fieldName)); - jp1.setLayout(new GridLayout(1,2)); + // jp1.setLayout(new GridLayout(1,2)); + //jp1.add(new JLabel("Dimensions: ")); + jp1.add(dimensionsTF[currItem] = new JTextField(4)); + dimensionsTF[currItem].setVisible(false); + //jp1.add(new JLabel("Type: ")); + jp1.add(typesTF[currItem] = new JTextField(10)); + typesTF[currItem].setVisible(false); jp1.add(new JLabel("Segment len.: ")); - jp1.add(segLensTF[currItem] = new JTextField(10)); + jp1.add(segLensTF[currItem] = new JTextField(4)); try { jp1.setTransferHandler(new FromTransferHandler(subtree.getFullPath(currOutNid)+".FIELDS."+fieldName+":VALUE")); @@ -202,9 +235,10 @@ public void mousePressed(MouseEvent me) currItem++; } } - currOutNid += 1 + numChildren + numMembers + 3 * numPars + 8 * numFields; + currOutNid += 1 + numChildren + numMembers + 3 * numPars + 10 * numFields; } + numItems = currItem; scrollP = new JScrollPane(jp); setLayout(new BorderLayout()); add(scrollP, "Center"); @@ -212,7 +246,7 @@ public void mousePressed(MouseEvent me) } protected void displayData(String data, boolean is_on) { -for(int idx = 0; idx < numItems; idx++) + for(int idx = 0; idx < numItems; idx++) { try { segLensTF[idx].setText(subtree.getDataExpr(segLenNids[idx])); @@ -221,19 +255,38 @@ protected void displayData(String data, boolean is_on) segLensTF[idx].setText(""); } try { - dimensionsTF[idx].setText(subtree.getDataExpr(dimensionNids[idx])); + if(dimensionsTF[idx].isVisible()) + dimensionsTF[idx].setText(subtree.getDataExpr(dimensionNids[idx])); }catch(Exception exc) { dimensionsTF[idx].setText(""); } + try { + if(typesTF[idx].isVisible()) + { + typesTF[idx].setText(subtree.getDataExpr(typeNids[idx]).replace("\"", "")); + } + }catch(Exception exc) + { + typesTF[idx].setText(""); + } } - for(int idx = 0; idx < numParItems; idx++) + for(int parIdx = 0; parIdx < numParItems; parIdx++) { try { - parametersTF[idx].setText(subtree.getDataExpr(parameterNids[idx])); + String parValue = subtree.getDataExpr(parameterNids[parIdx]); + if(parametersIsText[parIdx]) + { + parametersTF[parIdx].setText(parValue.substring(1, parValue.length() - 1)); + } + else + { + parametersTF[parIdx].setText(parValue); + } + }catch(Exception exc) { - parametersTF[idx].setText(""); + parametersTF[parIdx].setText(""); } } } @@ -246,11 +299,22 @@ public void apply() throws Exception for(int idx = 0; idx < numItems; idx++) { try { - subtree.putDataExpr(dimensionNids[idx], dimensionsTF[idx].getText()); + if(dimensionsTF[idx].isVisible()) + subtree.putDataExpr(dimensionNids[idx], dimensionsTF[idx].getText()); }catch(Exception exc) { System.out.println("Error saving Dimensions"); } + try { + if(typesTF[idx].isVisible()) + { + String typeStr = typesTF[idx].getText(); + subtree.putDataExpr(typeNids[idx], "\""+typeStr+"\""); + } + }catch(Exception exc) + { + System.out.println("Error saving Type"); + } try { subtree.putDataExpr(segLenNids[idx], segLensTF[idx].getText()); }catch(Exception exc) @@ -261,7 +325,15 @@ public void apply() throws Exception for(int idx = 0; idx < numParItems; idx++) { try { - subtree.putDataExpr(parameterNids[idx], parametersTF[idx].getText()); + if(parametersIsText[idx]) + { + subtree.putDataExpr(parameterNids[idx], "\'"+parametersTF[idx].getText()+"\'"); + } + else + { + subtree.putDataExpr(parameterNids[idx], parametersTF[idx].getText()); + } + }catch(Exception exc) { System.out.println("Error saving Parameter"); diff --git a/java/devicebeans/src/main/java/DeviceParameters.java b/java/devicebeans/src/main/java/DeviceParameters.java index b67c277754..2b4b846a36 100644 --- a/java/devicebeans/src/main/java/DeviceParameters.java +++ b/java/devicebeans/src/main/java/DeviceParameters.java @@ -28,13 +28,22 @@ protected void initializeData(String data, boolean is_on) JPanel jp = new JPanel(); jp.setLayout(new GridLayout(numParameters, 1)); int currNid = baseNid + offsetNid + 2 + 3 * parameterOffset; - for(int i = 0; i < numParameters; i++) + int i = 0; + while(i < numParameters) { + int numChildren = 0; + try { + numChildren = subtree.getInt("GETNCI("+subtree.getFullPath(currNid+1)+",\'NUMBER_OF_CHILDREN\')"); + }catch(Exception exc){System.out.println("Internal error in DeviceParameters.initialize)");} + if(numChildren > 0) + { + currNid += 3; + continue; + } JPanel jp1 = new JPanel(); String parName = ""; try { parName = subtree.getString(subtree.getDataExpr(currNid)); - parName = parName.substring(11); }catch(Exception exc){System.out.println("Cannot read parameter name");} jp1.setBorder(new TitledBorder(parName)); @@ -42,6 +51,7 @@ protected void initializeData(String data, boolean is_on) jp1.add(valuesTF[i] = new JTextField(), "Center"); jp.add(jp1); currNid += 3; + i++; } scrollP = new JScrollPane(jp); setLayout(new BorderLayout()); @@ -52,12 +62,23 @@ protected void initializeData(String data, boolean is_on) protected void displayData(String data, boolean is_on) { int currNid = baseNid + offsetNid + 3 + 3 * parameterOffset; - for(int parIdx = 0; parIdx < numParameters; parIdx++) + int parIdx = 0; + while(parIdx < numParameters) { + int numChildren = 0; + try { + numChildren = subtree.getInt("GETNCI("+subtree.getFullPath(currNid)+",\'NUMBER_OF_CHILDREN\')"); + }catch(Exception exc){System.out.println("Internal error in DeviceParameters.initialize)");} + if(numChildren > 0) + { + currNid += 3; + continue; + } try { valuesTF[parIdx].setText(subtree.getDataExpr(currNid)); }catch(Exception exc){System.out.println("Cannot read parameter value");} currNid += 3; + parIdx++; } } @@ -67,12 +88,23 @@ protected void displayData(String data, boolean is_on) public void apply() throws Exception { int currNid = baseNid + offsetNid + 3 + 3 * parameterOffset; - for(int parIdx = 0; parIdx < numParameters; parIdx++) + int parIdx = 0; + while(parIdx < numParameters) { + int numChildren = 0; + try { + numChildren = subtree.getInt("GETNCI("+subtree.getFullPath(currNid)+",\'NUMBER_OF_CHILDREN\')"); + }catch(Exception exc){System.out.println("Internal error in DeviceParameters.initialize)");} + if(numChildren > 0) + { + currNid += 3; + continue; + } try { subtree.putDataExpr(currNid, valuesTF[parIdx].getText()); }catch(Exception exc){System.out.println("Cannot write parameter "+labels[parIdx]+": "+exc);} currNid += 3; + parIdx++; } } public int getNumParameters() {return numParameters;} diff --git a/java/jdevices/src/main/java/MARTE2_DOUBLEH_MASTERSetup.java b/java/jdevices/src/main/java/MARTE2_DOUBLEH_MASTERSetup.java new file mode 100644 index 0000000000..be205fd82f --- /dev/null +++ b/java/jdevices/src/main/java/MARTE2_DOUBLEH_MASTERSetup.java @@ -0,0 +1,69 @@ +/* + * 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_DOUBLEH_MASTERSetup extends DeviceSetup { + + /** + * Creates new form MARTE2_DOUBLEH_MASTERSetup + */ + public MARTE2_DOUBLEH_MASTERSetup() { + 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(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel1 = new javax.swing.JPanel(); + deviceInputs1 = new DeviceInputs(); + jPanel2 = new javax.swing.JPanel(); + deviceOutputs1 = new DeviceOutputs(); + + setDeviceProvider("localhost:8100"); + setDeviceTitle("MARTe2 DoulbeHandhakeMaster"); + setDeviceType("MARTE2_DOUBLEH_MASTER"); + setHeight(300); + setWidth(500); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + jPanel1.setLayout(new java.awt.BorderLayout()); + + deviceInputs1.setOffsetNid(5); + jPanel1.add(deviceInputs1, java.awt.BorderLayout.CENTER); + + jTabbedPane1.addTab("Inputs", jPanel1); + + jPanel2.setLayout(new java.awt.BorderLayout()); + + deviceOutputs1.setOffsetNid(102); + jPanel2.add(deviceOutputs1, java.awt.BorderLayout.CENTER); + + jTabbedPane1.addTab("Outputs", jPanel2); + + getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private DeviceButtons deviceButtons1; + private DeviceInputs deviceInputs1; + private DeviceOutputs deviceOutputs1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JTabbedPane jTabbedPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/java/jdevices/src/main/java/MARTE2_DOUBLEH_SLAVESetup.java b/java/jdevices/src/main/java/MARTE2_DOUBLEH_SLAVESetup.java new file mode 100644 index 0000000000..25c635c2bd --- /dev/null +++ b/java/jdevices/src/main/java/MARTE2_DOUBLEH_SLAVESetup.java @@ -0,0 +1,70 @@ +/* + * 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_DOUBLEH_SLAVESetup extends DeviceSetup { + + /** + * Creates new form MARTE2_DOUBLEH_SLAVESetup + */ + public MARTE2_DOUBLEH_SLAVESetup() { + 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(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel1 = new javax.swing.JPanel(); + deviceInputs1 = new DeviceInputs(); + jPanel2 = new javax.swing.JPanel(); + deviceOutputs1 = new DeviceOutputs(); + + setDeviceProvider("localhost:8100"); + setDeviceTitle("MARTe2 DoubleHanshaking Slave"); + setDeviceType("MARTE2_DOUBLEH_SLAVE"); + setHeight(200); + setUpdateEvent(""); + setWidth(500); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + jPanel1.setLayout(new java.awt.BorderLayout()); + + deviceInputs1.setOffsetNid(5); + jPanel1.add(deviceInputs1, java.awt.BorderLayout.CENTER); + + jTabbedPane1.addTab("Inputs", jPanel1); + + jPanel2.setLayout(new java.awt.BorderLayout()); + + deviceOutputs1.setOffsetNid(70); + jPanel2.add(deviceOutputs1, java.awt.BorderLayout.CENTER); + + jTabbedPane1.addTab("Outputs", jPanel2); + + getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private DeviceButtons deviceButtons1; + private DeviceInputs deviceInputs1; + private DeviceOutputs deviceOutputs1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JTabbedPane jTabbedPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/java/jdevices/src/main/java/MARTE2_EXPRSetup.java b/java/jdevices/src/main/java/MARTE2_EXPRSetup.java index fe2c424534..5f5cf70b58 100644 --- a/java/jdevices/src/main/java/MARTE2_EXPRSetup.java +++ b/java/jdevices/src/main/java/MARTE2_EXPRSetup.java @@ -35,674 +35,39 @@ private void initComponents() { deviceButtons1 = new DeviceButtons(); jPanel1 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); - jPanel2 = new javax.swing.JPanel(); - jPanel3 = new javax.swing.JPanel(); - deviceField1 = new DeviceField(); - deviceChoice1 = new DeviceChoice(); - jPanel4 = new javax.swing.JPanel(); - deviceField2 = new DeviceField(); - jPanel5 = new javax.swing.JPanel(); - jPanel6 = new javax.swing.JPanel(); - deviceField3 = new DeviceField(); - deviceChoice2 = new DeviceChoice(); - jPanel7 = new javax.swing.JPanel(); - deviceField4 = new DeviceField(); - jPanel8 = new javax.swing.JPanel(); - jPanel9 = new javax.swing.JPanel(); - deviceField5 = new DeviceField(); - deviceChoice3 = new DeviceChoice(); - jPanel10 = new javax.swing.JPanel(); - deviceField6 = new DeviceField(); - jPanel11 = new javax.swing.JPanel(); - jPanel12 = new javax.swing.JPanel(); - deviceField7 = new DeviceField(); - deviceChoice4 = new DeviceChoice(); - jPanel13 = new javax.swing.JPanel(); - deviceField8 = new DeviceField(); - jPanel14 = new javax.swing.JPanel(); - jPanel15 = new javax.swing.JPanel(); - deviceField9 = new DeviceField(); - deviceChoice5 = new DeviceChoice(); - jPanel16 = new javax.swing.JPanel(); - deviceField10 = new DeviceField(); - jPanel17 = new javax.swing.JPanel(); - jPanel18 = new javax.swing.JPanel(); - deviceField11 = new DeviceField(); - deviceChoice6 = new DeviceChoice(); - jPanel19 = new javax.swing.JPanel(); - deviceField12 = new DeviceField(); - jPanel20 = new javax.swing.JPanel(); - jPanel21 = new javax.swing.JPanel(); - deviceField13 = new DeviceField(); - deviceChoice7 = new DeviceChoice(); - jPanel22 = new javax.swing.JPanel(); - deviceField14 = new DeviceField(); - jPanel23 = new javax.swing.JPanel(); - jPanel24 = new javax.swing.JPanel(); - deviceField15 = new DeviceField(); - deviceChoice8 = new DeviceChoice(); - jPanel25 = new javax.swing.JPanel(); - deviceField16 = new DeviceField(); - jTabbedPane2 = new javax.swing.JTabbedPane(); - jPanel26 = new javax.swing.JPanel(); - jPanel27 = new javax.swing.JPanel(); - deviceField17 = new DeviceField(); - deviceChoice9 = new DeviceChoice(); - deviceField33 = new DeviceField(); - jPanel28 = new javax.swing.JPanel(); - deviceField18 = new DeviceField(); - deviceField44 = new DeviceField(); - jPanel29 = new javax.swing.JPanel(); - jPanel30 = new javax.swing.JPanel(); - deviceField19 = new DeviceField(); - deviceChoice10 = new DeviceChoice(); - deviceField34 = new DeviceField(); - jPanel31 = new javax.swing.JPanel(); - deviceField20 = new DeviceField(); - deviceField45 = new DeviceField(); - jPanel32 = new javax.swing.JPanel(); - jPanel33 = new javax.swing.JPanel(); - deviceField21 = new DeviceField(); - deviceChoice11 = new DeviceChoice(); - deviceField35 = new DeviceField(); - jPanel34 = new javax.swing.JPanel(); - deviceField22 = new DeviceField(); - deviceField46 = new DeviceField(); - jPanel35 = new javax.swing.JPanel(); - jPanel36 = new javax.swing.JPanel(); - deviceField23 = new DeviceField(); - deviceChoice12 = new DeviceChoice(); - deviceField36 = new DeviceField(); - jPanel37 = new javax.swing.JPanel(); - deviceField24 = new DeviceField(); - deviceField47 = new DeviceField(); - jPanel38 = new javax.swing.JPanel(); - jPanel39 = new javax.swing.JPanel(); - deviceField25 = new DeviceField(); - deviceChoice13 = new DeviceChoice(); - deviceField37 = new DeviceField(); - jPanel40 = new javax.swing.JPanel(); - deviceField26 = new DeviceField(); - deviceField48 = new DeviceField(); - jPanel41 = new javax.swing.JPanel(); - jPanel42 = new javax.swing.JPanel(); - deviceField27 = new DeviceField(); - deviceChoice14 = new DeviceChoice(); - deviceField38 = new DeviceField(); - jPanel43 = new javax.swing.JPanel(); - deviceField28 = new DeviceField(); - deviceField49 = new DeviceField(); - jPanel44 = new javax.swing.JPanel(); - jPanel45 = new javax.swing.JPanel(); - deviceField29 = new DeviceField(); - deviceChoice15 = new DeviceChoice(); - deviceField39 = new DeviceField(); - jPanel46 = new javax.swing.JPanel(); - deviceField30 = new DeviceField(); - deviceField50 = new DeviceField(); - jPanel47 = new javax.swing.JPanel(); - jPanel48 = new javax.swing.JPanel(); - deviceField31 = new DeviceField(); - deviceChoice16 = new DeviceChoice(); - deviceField40 = new DeviceField(); - jPanel49 = new javax.swing.JPanel(); - deviceField32 = new DeviceField(); - deviceField51 = new DeviceField(); + jScrollPane1 = new javax.swing.JScrollPane(); + deviceInputs1 = new DeviceInputs(); + jScrollPane2 = new javax.swing.JScrollPane(); + deviceOutputs1 = new DeviceOutputs(); jPanel50 = new javax.swing.JPanel(); - deviceField41 = new DeviceField(); - deviceField43 = new DeviceField(); deviceField42 = new DeviceField(); - setDeviceProvider("spilds:8100"); + setDeviceProvider("localhost:8100"); setDeviceType("MARTE2_EXPR"); setHeight(400); setWidth(900); getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - jPanel1.setLayout(new java.awt.GridLayout(2, 1)); + jPanel1.setLayout(new java.awt.BorderLayout()); - jPanel2.setLayout(new java.awt.GridLayout(2, 1)); + deviceInputs1.setOffsetNid(29); + jScrollPane1.setViewportView(deviceInputs1); - deviceField1.setIdentifier(""); - deviceField1.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField1.setOffsetNid(32); - jPanel3.add(deviceField1); + jTabbedPane1.addTab("Inputs", jScrollPane1); - deviceChoice1.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice1.setIdentifier(""); - deviceChoice1.setLabelString(""); - deviceChoice1.setOffsetNid(31); - deviceChoice1.setUpdateIdentifier(""); - jPanel3.add(deviceChoice1); + deviceOutputs1.setOffsetNid(94); + jScrollPane2.setViewportView(deviceOutputs1); - jPanel2.add(jPanel3); + jTabbedPane1.addTab("Outputs", jScrollPane2); - deviceField2.setIdentifier(""); - deviceField2.setLabelString("Value:"); - deviceField2.setNumCols(25); - deviceField2.setOffsetNid(34); - jPanel4.add(deviceField2); - - jPanel2.add(jPanel4); - - jTabbedPane1.addTab("In1", jPanel2); - - jPanel5.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField3.setIdentifier(""); - deviceField3.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField3.setOffsetNid(39); - jPanel6.add(deviceField3); - - deviceChoice2.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice2.setIdentifier(""); - deviceChoice2.setLabelString(""); - deviceChoice2.setOffsetNid(38); - deviceChoice2.setUpdateIdentifier(""); - jPanel6.add(deviceChoice2); - - jPanel5.add(jPanel6); - - deviceField4.setIdentifier(""); - deviceField4.setLabelString("Value:"); - deviceField4.setNumCols(25); - deviceField4.setOffsetNid(41); - jPanel7.add(deviceField4); - - jPanel5.add(jPanel7); - - jTabbedPane1.addTab("In2", jPanel5); - - jPanel8.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField5.setIdentifier(""); - deviceField5.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField5.setOffsetNid(46); - jPanel9.add(deviceField5); - - deviceChoice3.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice3.setIdentifier(""); - deviceChoice3.setLabelString(""); - deviceChoice3.setOffsetNid(45); - deviceChoice3.setUpdateIdentifier(""); - jPanel9.add(deviceChoice3); - - jPanel8.add(jPanel9); - - deviceField6.setIdentifier(""); - deviceField6.setLabelString("Value:"); - deviceField6.setNumCols(25); - deviceField6.setOffsetNid(48); - jPanel10.add(deviceField6); - - jPanel8.add(jPanel10); - - jTabbedPane1.addTab("In3", jPanel8); - - jPanel11.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField7.setIdentifier(""); - deviceField7.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField7.setOffsetNid(53); - jPanel12.add(deviceField7); - - deviceChoice4.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice4.setIdentifier(""); - deviceChoice4.setLabelString(""); - deviceChoice4.setOffsetNid(52); - deviceChoice4.setUpdateIdentifier(""); - jPanel12.add(deviceChoice4); - - jPanel11.add(jPanel12); - - deviceField8.setIdentifier(""); - deviceField8.setLabelString("Value:"); - deviceField8.setNumCols(25); - deviceField8.setOffsetNid(55); - jPanel13.add(deviceField8); - - jPanel11.add(jPanel13); - - jTabbedPane1.addTab("In4", jPanel11); - - jPanel14.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField9.setIdentifier(""); - deviceField9.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField9.setOffsetNid(60); - jPanel15.add(deviceField9); - - deviceChoice5.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice5.setIdentifier(""); - deviceChoice5.setLabelString(""); - deviceChoice5.setOffsetNid(59); - deviceChoice5.setUpdateIdentifier(""); - jPanel15.add(deviceChoice5); - - jPanel14.add(jPanel15); - - deviceField10.setIdentifier(""); - deviceField10.setLabelString("Value:"); - deviceField10.setNumCols(25); - deviceField10.setOffsetNid(62); - jPanel16.add(deviceField10); - - jPanel14.add(jPanel16); - - jTabbedPane1.addTab("In5", jPanel14); - - jPanel17.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField11.setIdentifier(""); - deviceField11.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField11.setOffsetNid(67); - jPanel18.add(deviceField11); - - deviceChoice6.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice6.setIdentifier(""); - deviceChoice6.setLabelString(""); - deviceChoice6.setOffsetNid(66); - deviceChoice6.setUpdateIdentifier(""); - jPanel18.add(deviceChoice6); - - jPanel17.add(jPanel18); - - deviceField12.setIdentifier(""); - deviceField12.setLabelString("Value:"); - deviceField12.setNumCols(25); - deviceField12.setOffsetNid(69); - jPanel19.add(deviceField12); - - jPanel17.add(jPanel19); - - jTabbedPane1.addTab("In6", jPanel17); - - jPanel20.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField13.setIdentifier(""); - deviceField13.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField13.setOffsetNid(74); - jPanel21.add(deviceField13); - - deviceChoice7.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice7.setIdentifier(""); - deviceChoice7.setLabelString(""); - deviceChoice7.setOffsetNid(73); - deviceChoice7.setUpdateIdentifier(""); - jPanel21.add(deviceChoice7); - - jPanel20.add(jPanel21); - - deviceField14.setIdentifier(""); - deviceField14.setLabelString("Value:"); - deviceField14.setNumCols(25); - deviceField14.setOffsetNid(76); - jPanel22.add(deviceField14); - - jPanel20.add(jPanel22); - - jTabbedPane1.addTab("In7", jPanel20); - - jPanel23.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField15.setIdentifier(""); - deviceField15.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField15.setOffsetNid(81); - jPanel24.add(deviceField15); - - deviceChoice8.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice8.setIdentifier(""); - deviceChoice8.setLabelString(""); - deviceChoice8.setOffsetNid(80); - deviceChoice8.setUpdateIdentifier(""); - jPanel24.add(deviceChoice8); - - jPanel23.add(jPanel24); - - deviceField16.setIdentifier(""); - deviceField16.setLabelString("Value:"); - deviceField16.setNumCols(25); - deviceField16.setOffsetNid(83); - jPanel25.add(deviceField16); - - jPanel23.add(jPanel25); - - jTabbedPane1.addTab("In8", jPanel23); - - jPanel1.add(jTabbedPane1); - - jPanel26.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField17.setIdentifier(""); - deviceField17.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField17.setOffsetNid(97); - jPanel27.add(deviceField17); - - deviceChoice9.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice9.setIdentifier(""); - deviceChoice9.setLabelString("Type: "); - deviceChoice9.setOffsetNid(95); - deviceChoice9.setUpdateIdentifier(""); - jPanel27.add(deviceChoice9); - - deviceField33.setIdentifier(""); - deviceField33.setLabelString("Seg. Len (0 to disable writing):"); - deviceField33.setNumCols(4); - deviceField33.setOffsetNid(98); - jPanel27.add(deviceField33); - - jPanel26.add(jPanel27); - - deviceField18.setIdentifier(""); - deviceField18.setLabelString("Expression:"); - deviceField18.setNumCols(35); - deviceField18.setOffsetNid(104); - deviceField18.setTextOnly(true); - jPanel28.add(deviceField18); - - deviceField44.setIdentifier(""); - deviceField44.setLabelString("Stream Name: "); - deviceField44.setOffsetNid(99); - deviceField44.setTextOnly(true); - jPanel28.add(deviceField44); - - jPanel26.add(jPanel28); - - jTabbedPane2.addTab("Out1", jPanel26); - - jPanel29.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField19.setIdentifier(""); - deviceField19.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField19.setOffsetNid(109); - jPanel30.add(deviceField19); - - deviceChoice10.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice10.setIdentifier(""); - deviceChoice10.setLabelString("Type: "); - deviceChoice10.setOffsetNid(107); - deviceChoice10.setUpdateIdentifier(""); - jPanel30.add(deviceChoice10); - - deviceField34.setIdentifier(""); - deviceField34.setLabelString("Seg. Len (0 to disable writing):"); - deviceField34.setNumCols(4); - deviceField34.setOffsetNid(109); - jPanel30.add(deviceField34); - - jPanel29.add(jPanel30); - - deviceField20.setIdentifier(""); - deviceField20.setLabelString("Expression:"); - deviceField20.setNumCols(35); - deviceField20.setOffsetNid(116); - deviceField20.setTextOnly(true); - jPanel31.add(deviceField20); - - deviceField45.setIdentifier(""); - deviceField45.setLabelString("Stream Name: "); - deviceField45.setOffsetNid(111); - deviceField45.setTextOnly(true); - jPanel31.add(deviceField45); - - jPanel29.add(jPanel31); - - jTabbedPane2.addTab("Out2", jPanel29); - - jPanel32.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField21.setIdentifier(""); - deviceField21.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField21.setOffsetNid(121); - jPanel33.add(deviceField21); - - deviceChoice11.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice11.setIdentifier(""); - deviceChoice11.setLabelString("Type: "); - deviceChoice11.setOffsetNid(119); - deviceChoice11.setUpdateIdentifier(""); - jPanel33.add(deviceChoice11); - - deviceField35.setIdentifier(""); - deviceField35.setLabelString("Seg. Len (0 to disable writing):"); - deviceField35.setNumCols(4); - deviceField35.setOffsetNid(120); - jPanel33.add(deviceField35); - - jPanel32.add(jPanel33); - - deviceField22.setIdentifier(""); - deviceField22.setLabelString("Expression:"); - deviceField22.setNumCols(35); - deviceField22.setOffsetNid(128); - deviceField22.setTextOnly(true); - jPanel34.add(deviceField22); - - deviceField46.setIdentifier(""); - deviceField46.setLabelString("Stream Name: "); - deviceField46.setOffsetNid(123); - deviceField46.setTextOnly(true); - jPanel34.add(deviceField46); - - jPanel32.add(jPanel34); - - jTabbedPane2.addTab("Out3", jPanel32); - - jPanel35.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField23.setIdentifier(""); - deviceField23.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField23.setOffsetNid(133); - jPanel36.add(deviceField23); - - deviceChoice12.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice12.setIdentifier(""); - deviceChoice12.setLabelString("Type: "); - deviceChoice12.setOffsetNid(131); - deviceChoice12.setUpdateIdentifier(""); - jPanel36.add(deviceChoice12); - - deviceField36.setIdentifier(""); - deviceField36.setLabelString("Seg. Len (0 to disable writing):"); - deviceField36.setNumCols(4); - deviceField36.setOffsetNid(131); - jPanel36.add(deviceField36); - - jPanel35.add(jPanel36); - - deviceField24.setIdentifier(""); - deviceField24.setLabelString("Expression:"); - deviceField24.setNumCols(35); - deviceField24.setOffsetNid(140); - deviceField24.setTextOnly(true); - jPanel37.add(deviceField24); - - deviceField47.setIdentifier(""); - deviceField47.setLabelString("Stream Name: "); - deviceField47.setOffsetNid(135); - deviceField47.setTextOnly(true); - jPanel37.add(deviceField47); - - jPanel35.add(jPanel37); - - jTabbedPane2.addTab("Out4", jPanel35); - - jPanel38.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField25.setIdentifier(""); - deviceField25.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField25.setOffsetNid(145); - jPanel39.add(deviceField25); - - deviceChoice13.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice13.setIdentifier(""); - deviceChoice13.setLabelString("Type: "); - deviceChoice13.setOffsetNid(143); - deviceChoice13.setUpdateIdentifier(""); - jPanel39.add(deviceChoice13); - - deviceField37.setIdentifier(""); - deviceField37.setLabelString("Seg. Len (0 to disable writing):"); - deviceField37.setNumCols(4); - deviceField37.setOffsetNid(142); - jPanel39.add(deviceField37); - - jPanel38.add(jPanel39); - - deviceField26.setIdentifier(""); - deviceField26.setLabelString("Expression:"); - deviceField26.setNumCols(35); - deviceField26.setOffsetNid(152); - deviceField26.setTextOnly(true); - jPanel40.add(deviceField26); - - deviceField48.setIdentifier(""); - deviceField48.setLabelString("Stream Name: "); - deviceField48.setOffsetNid(147); - deviceField48.setTextOnly(true); - jPanel40.add(deviceField48); - - jPanel38.add(jPanel40); - - jTabbedPane2.addTab("Out5", jPanel38); - - jPanel41.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField27.setIdentifier(""); - deviceField27.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField27.setOffsetNid(157); - jPanel42.add(deviceField27); - - deviceChoice14.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice14.setIdentifier(""); - deviceChoice14.setLabelString("Type: "); - deviceChoice14.setOffsetNid(155); - deviceChoice14.setUpdateIdentifier(""); - jPanel42.add(deviceChoice14); - - deviceField38.setIdentifier(""); - deviceField38.setLabelString("Seg. Len (0 to disable writing):"); - deviceField38.setNumCols(4); - deviceField38.setOffsetNid(153); - jPanel42.add(deviceField38); - - jPanel41.add(jPanel42); - - deviceField28.setIdentifier(""); - deviceField28.setLabelString("Expression:"); - deviceField28.setNumCols(35); - deviceField28.setOffsetNid(164); - deviceField28.setTextOnly(true); - jPanel43.add(deviceField28); - - deviceField49.setIdentifier(""); - deviceField49.setLabelString("Stream Name: "); - deviceField49.setOffsetNid(159); - deviceField49.setTextOnly(true); - jPanel43.add(deviceField49); - - jPanel41.add(jPanel43); - - jTabbedPane2.addTab("Out6", jPanel41); - - jPanel44.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField29.setIdentifier(""); - deviceField29.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField29.setOffsetNid(169); - jPanel45.add(deviceField29); - - deviceChoice15.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice15.setIdentifier(""); - deviceChoice15.setLabelString("Type: "); - deviceChoice15.setOffsetNid(167); - deviceChoice15.setUpdateIdentifier(""); - jPanel45.add(deviceChoice15); - - deviceField39.setIdentifier(""); - deviceField39.setLabelString("Seg. Len (0 to disable writing):"); - deviceField39.setNumCols(4); - deviceField39.setOffsetNid(164); - jPanel45.add(deviceField39); - - jPanel44.add(jPanel45); - - deviceField30.setIdentifier(""); - deviceField30.setLabelString("Expression:"); - deviceField30.setNumCols(35); - deviceField30.setOffsetNid(176); - deviceField30.setTextOnly(true); - jPanel46.add(deviceField30); - - deviceField50.setIdentifier(""); - deviceField50.setLabelString("Stream Name: "); - deviceField50.setOffsetNid(171); - deviceField50.setTextOnly(true); - jPanel46.add(deviceField50); - - jPanel44.add(jPanel46); - - jTabbedPane2.addTab("Out7", jPanel44); - - jPanel47.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField31.setIdentifier(""); - deviceField31.setLabelString("Dimensions (0 for scalar, array otherwise):"); - deviceField31.setOffsetNid(181); - jPanel48.add(deviceField31); - - deviceChoice16.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); - deviceChoice16.setIdentifier(""); - deviceChoice16.setLabelString("Type: "); - deviceChoice16.setOffsetNid(179); - deviceChoice16.setUpdateIdentifier(""); - jPanel48.add(deviceChoice16); - - deviceField40.setIdentifier(""); - deviceField40.setLabelString("Seg. Len (0 to disable writing):"); - deviceField40.setNumCols(4); - deviceField40.setOffsetNid(175); - jPanel48.add(deviceField40); - - jPanel47.add(jPanel48); - - deviceField32.setIdentifier(""); - deviceField32.setLabelString("Expression:"); - deviceField32.setNumCols(35); - deviceField32.setOffsetNid(188); - deviceField32.setTextOnly(true); - jPanel49.add(deviceField32); - - deviceField51.setIdentifier(""); - deviceField51.setLabelString("Stream Name: "); - deviceField51.setOffsetNid(183); - deviceField51.setTextOnly(true); - jPanel49.add(deviceField51); - - jPanel47.add(jPanel49); - - jTabbedPane2.addTab("Out8", jPanel47); - - jPanel1.add(jTabbedPane2); + jPanel1.add(jTabbedPane1, java.awt.BorderLayout.CENTER); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); - deviceField41.setIdentifier(""); - deviceField41.setLabelString("Timebase:"); - deviceField41.setNumCols(25); - deviceField41.setOffsetNid(3); - jPanel50.add(deviceField41); - - deviceField43.setIdentifier(""); - deviceField43.setLabelString("Timebase Division (Valid if timebase on another thread):"); - deviceField43.setNumCols(4); - deviceField43.setOffsetNid(181); - jPanel50.add(deviceField43); - deviceField42.setIdentifier(""); deviceField42.setLabelString("Storage CPUs: "); deviceField42.setNumCols(4); - deviceField42.setOffsetNid(92); + deviceField42.setOffsetNid(100); jPanel50.add(deviceField42); getContentPane().add(jPanel50, java.awt.BorderLayout.PAGE_START); @@ -712,124 +77,13 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; - private DeviceChoice deviceChoice1; - private DeviceChoice deviceChoice10; - private DeviceChoice deviceChoice11; - private DeviceChoice deviceChoice12; - private DeviceChoice deviceChoice13; - private DeviceChoice deviceChoice14; - private DeviceChoice deviceChoice15; - private DeviceChoice deviceChoice16; - private DeviceChoice deviceChoice2; - private DeviceChoice deviceChoice3; - private DeviceChoice deviceChoice4; - private DeviceChoice deviceChoice5; - private DeviceChoice deviceChoice6; - private DeviceChoice deviceChoice7; - private DeviceChoice deviceChoice8; - private DeviceChoice deviceChoice9; - 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 deviceField27; - private DeviceField deviceField28; - private DeviceField deviceField29; - private DeviceField deviceField3; - private DeviceField deviceField30; - private DeviceField deviceField31; - private DeviceField deviceField32; - private DeviceField deviceField33; - private DeviceField deviceField34; - private DeviceField deviceField35; - private DeviceField deviceField36; - private DeviceField deviceField37; - private DeviceField deviceField38; - private DeviceField deviceField39; - private DeviceField deviceField4; - private DeviceField deviceField40; - private DeviceField deviceField41; private DeviceField deviceField42; - private DeviceField deviceField43; - private DeviceField deviceField44; - private DeviceField deviceField45; - private DeviceField deviceField46; - private DeviceField deviceField47; - private DeviceField deviceField48; - private DeviceField deviceField49; - private DeviceField deviceField5; - private DeviceField deviceField50; - private DeviceField deviceField51; - private DeviceField deviceField6; - private DeviceField deviceField7; - private DeviceField deviceField8; - private DeviceField deviceField9; + private DeviceInputs deviceInputs1; + private DeviceOutputs deviceOutputs1; 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 jPanel23; - private javax.swing.JPanel jPanel24; - private javax.swing.JPanel jPanel25; - private javax.swing.JPanel jPanel26; - private javax.swing.JPanel jPanel27; - private javax.swing.JPanel jPanel28; - private javax.swing.JPanel jPanel29; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel30; - private javax.swing.JPanel jPanel31; - private javax.swing.JPanel jPanel32; - private javax.swing.JPanel jPanel33; - private javax.swing.JPanel jPanel34; - private javax.swing.JPanel jPanel35; - private javax.swing.JPanel jPanel36; - private javax.swing.JPanel jPanel37; - private javax.swing.JPanel jPanel38; - private javax.swing.JPanel jPanel39; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel40; - private javax.swing.JPanel jPanel41; - private javax.swing.JPanel jPanel42; - private javax.swing.JPanel jPanel43; - private javax.swing.JPanel jPanel44; - private javax.swing.JPanel jPanel45; - private javax.swing.JPanel jPanel46; - private javax.swing.JPanel jPanel47; - private javax.swing.JPanel jPanel48; - private javax.swing.JPanel jPanel49; - private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel50; - private javax.swing.JPanel jPanel6; - private javax.swing.JPanel jPanel7; - private javax.swing.JPanel jPanel8; - private javax.swing.JPanel jPanel9; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTabbedPane jTabbedPane1; - private javax.swing.JTabbedPane jTabbedPane2; // End of variables declaration//GEN-END:variables } diff --git a/java/jdevices/src/main/java/MARTE2_LOGGERSetup.java b/java/jdevices/src/main/java/MARTE2_LOGGERSetup.java index c30f608485..c6267d600f 100644 --- a/java/jdevices/src/main/java/MARTE2_LOGGERSetup.java +++ b/java/jdevices/src/main/java/MARTE2_LOGGERSetup.java @@ -27,9 +27,6 @@ public MARTE2_LOGGERSetup() { private void initComponents() { deviceButtons1 = new DeviceButtons(); - jPanel1 = new javax.swing.JPanel(); - deviceField1 = new DeviceField(); - deviceField2 = new DeviceField(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); @@ -80,27 +77,13 @@ private void initComponents() { jPanel25 = new javax.swing.JPanel(); deviceField18 = new DeviceField(); - setDeviceProvider("spilds:8100"); + setDeviceProvider("localhost:8100"); setDeviceTitle("MARTe2 Logger"); setDeviceType("MARTE2_LOGGER"); setHeight(300); setWidth(700); getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - deviceField1.setIdentifier(""); - deviceField1.setLabelString("Timebase: "); - deviceField1.setNumCols(20); - deviceField1.setOffsetNid(3); - jPanel1.add(deviceField1); - - deviceField2.setIdentifier(""); - deviceField2.setLabelString("Timebase Div.: "); - deviceField2.setNumCols(4); - deviceField2.setOffsetNid(62); - jPanel1.add(deviceField2); - - getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START); - jPanel2.setLayout(new java.awt.GridLayout(2, 1)); deviceChoice1.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); @@ -133,14 +116,14 @@ private void initComponents() { deviceChoice2.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); deviceChoice2.setIdentifier(""); deviceChoice2.setLabelString("Type:"); - deviceChoice2.setOffsetNid(14); + deviceChoice2.setOffsetNid(15); deviceChoice2.setUpdateIdentifier(""); jPanel6.add(deviceChoice2); deviceField5.setIdentifier(""); deviceField5.setLabelString("Dimensions: "); deviceField5.setNumCols(6); - deviceField5.setOffsetNid(15); + deviceField5.setOffsetNid(16); jPanel6.add(deviceField5); jPanel5.add(jPanel6); @@ -148,7 +131,7 @@ private void initComponents() { deviceField6.setIdentifier(""); deviceField6.setLabelString("Value: "); deviceField6.setNumCols(25); - deviceField6.setOffsetNid(17); + deviceField6.setOffsetNid(18); jPanel7.add(deviceField6); jPanel5.add(jPanel7); @@ -160,14 +143,14 @@ private void initComponents() { deviceChoice3.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); deviceChoice3.setIdentifier(""); deviceChoice3.setLabelString("Type:"); - deviceChoice3.setOffsetNid(21); + deviceChoice3.setOffsetNid(23); deviceChoice3.setUpdateIdentifier(""); jPanel9.add(deviceChoice3); deviceField7.setIdentifier(""); deviceField7.setLabelString("Dimensions: "); deviceField7.setNumCols(6); - deviceField7.setOffsetNid(22); + deviceField7.setOffsetNid(24); jPanel9.add(deviceField7); jPanel8.add(jPanel9); @@ -175,7 +158,7 @@ private void initComponents() { deviceField8.setIdentifier(""); deviceField8.setLabelString("Value: "); deviceField8.setNumCols(25); - deviceField8.setOffsetNid(24); + deviceField8.setOffsetNid(26); jPanel10.add(deviceField8); jPanel8.add(jPanel10); @@ -187,14 +170,14 @@ private void initComponents() { deviceChoice4.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); deviceChoice4.setIdentifier(""); deviceChoice4.setLabelString("Type:"); - deviceChoice4.setOffsetNid(28); + deviceChoice4.setOffsetNid(31); deviceChoice4.setUpdateIdentifier(""); jPanel12.add(deviceChoice4); deviceField9.setIdentifier(""); deviceField9.setLabelString("Dimensions: "); deviceField9.setNumCols(6); - deviceField9.setOffsetNid(29); + deviceField9.setOffsetNid(32); jPanel12.add(deviceField9); jPanel11.add(jPanel12); @@ -202,7 +185,7 @@ private void initComponents() { deviceField10.setIdentifier(""); deviceField10.setLabelString("Value: "); deviceField10.setNumCols(25); - deviceField10.setOffsetNid(31); + deviceField10.setOffsetNid(34); jPanel13.add(deviceField10); jPanel11.add(jPanel13); @@ -214,14 +197,14 @@ private void initComponents() { deviceChoice5.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); deviceChoice5.setIdentifier(""); deviceChoice5.setLabelString("Type:"); - deviceChoice5.setOffsetNid(35); + deviceChoice5.setOffsetNid(39); deviceChoice5.setUpdateIdentifier(""); jPanel15.add(deviceChoice5); deviceField11.setIdentifier(""); deviceField11.setLabelString("Dimensions: "); deviceField11.setNumCols(6); - deviceField11.setOffsetNid(36); + deviceField11.setOffsetNid(40); jPanel15.add(deviceField11); jPanel14.add(jPanel15); @@ -229,7 +212,7 @@ private void initComponents() { deviceField12.setIdentifier(""); deviceField12.setLabelString("Value: "); deviceField12.setNumCols(25); - deviceField12.setOffsetNid(38); + deviceField12.setOffsetNid(42); jPanel16.add(deviceField12); jPanel14.add(jPanel16); @@ -241,14 +224,14 @@ private void initComponents() { deviceChoice6.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); deviceChoice6.setIdentifier(""); deviceChoice6.setLabelString("Type:"); - deviceChoice6.setOffsetNid(42); + deviceChoice6.setOffsetNid(47); deviceChoice6.setUpdateIdentifier(""); jPanel18.add(deviceChoice6); deviceField13.setIdentifier(""); deviceField13.setLabelString("Dimensions: "); deviceField13.setNumCols(6); - deviceField13.setOffsetNid(43); + deviceField13.setOffsetNid(48); jPanel18.add(deviceField13); jPanel17.add(jPanel18); @@ -256,7 +239,7 @@ private void initComponents() { deviceField14.setIdentifier(""); deviceField14.setLabelString("Value: "); deviceField14.setNumCols(25); - deviceField14.setOffsetNid(45); + deviceField14.setOffsetNid(50); jPanel19.add(deviceField14); jPanel17.add(jPanel19); @@ -268,14 +251,14 @@ private void initComponents() { deviceChoice7.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); deviceChoice7.setIdentifier(""); deviceChoice7.setLabelString("Type:"); - deviceChoice7.setOffsetNid(49); + deviceChoice7.setOffsetNid(55); deviceChoice7.setUpdateIdentifier(""); jPanel21.add(deviceChoice7); deviceField15.setIdentifier(""); deviceField15.setLabelString("Dimensions: "); deviceField15.setNumCols(6); - deviceField15.setOffsetNid(50); + deviceField15.setOffsetNid(56); jPanel21.add(deviceField15); jPanel20.add(jPanel21); @@ -283,7 +266,7 @@ private void initComponents() { deviceField16.setIdentifier(""); deviceField16.setLabelString("Value: "); deviceField16.setNumCols(25); - deviceField16.setOffsetNid(52); + deviceField16.setOffsetNid(58); jPanel22.add(deviceField16); jPanel20.add(jPanel22); @@ -295,14 +278,14 @@ private void initComponents() { deviceChoice8.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); deviceChoice8.setIdentifier(""); deviceChoice8.setLabelString("Type:"); - deviceChoice8.setOffsetNid(56); + deviceChoice8.setOffsetNid(63); deviceChoice8.setUpdateIdentifier(""); jPanel24.add(deviceChoice8); deviceField17.setIdentifier(""); deviceField17.setLabelString("Dimensions: "); deviceField17.setNumCols(6); - deviceField17.setOffsetNid(57); + deviceField17.setOffsetNid(64); jPanel24.add(deviceField17); jPanel23.add(jPanel24); @@ -310,7 +293,7 @@ private void initComponents() { deviceField18.setIdentifier(""); deviceField18.setLabelString("Value: "); deviceField18.setNumCols(25); - deviceField18.setOffsetNid(59); + deviceField18.setOffsetNid(66); jPanel25.add(deviceField18); jPanel23.add(jPanel25); @@ -333,7 +316,6 @@ private void initComponents() { private DeviceChoice deviceChoice6; private DeviceChoice deviceChoice7; private DeviceChoice deviceChoice8; - private DeviceField deviceField1; private DeviceField deviceField10; private DeviceField deviceField11; private DeviceField deviceField12; @@ -343,7 +325,6 @@ private void initComponents() { private DeviceField deviceField16; private DeviceField deviceField17; private DeviceField deviceField18; - private DeviceField deviceField2; private DeviceField deviceField3; private DeviceField deviceField4; private DeviceField deviceField5; @@ -351,7 +332,6 @@ private void initComponents() { 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; diff --git a/java/jdevices/src/main/java/MARTE2_OPCUA_INSetup.java b/java/jdevices/src/main/java/MARTE2_OPCUA_INSetup.java new file mode 100644 index 0000000000..edca5e5601 --- /dev/null +++ b/java/jdevices/src/main/java/MARTE2_OPCUA_INSetup.java @@ -0,0 +1,116 @@ +/* + * 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_OPCUA_INSetup extends DeviceSetup { + + /** + * Creates new form MARTE2_OPCUA_INSetup + */ + public MARTE2_OPCUA_INSetup() { + 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(); + jPanel2 = new javax.swing.JPanel(); + deviceField1 = new DeviceField(); + deviceField2 = new DeviceField(); + deviceField6 = new DeviceField(); + jPanel3 = new javax.swing.JPanel(); + deviceField3 = new DeviceField(); + deviceField4 = new DeviceField(); + deviceField5 = new DeviceField(); + jScrollPane1 = new javax.swing.JScrollPane(); + deviceOutputs1 = new DeviceOutputs(); + + setDeviceProvider("localhost:8100"); + setDeviceTitle("MARTE2 OPCUA In"); + setDeviceType("MARTE2_OPCUA_IN"); + setHeight(300); + setWidth(800); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + jPanel1.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Address"); + deviceField1.setNumCols(25); + deviceField1.setOffsetNid(7); + deviceField1.setTextOnly(true); + jPanel2.add(deviceField1); + + deviceField2.setIdentifier(""); + deviceField2.setLabelString("CPU Mask"); + deviceField2.setNumCols(8); + deviceField2.setOffsetNid(22); + jPanel2.add(deviceField2); + + deviceField6.setIdentifier(""); + deviceField6.setLabelString("RootIdentifierType: "); + deviceField6.setOffsetNid(37); + deviceField6.setTextOnly(true); + jPanel2.add(deviceField6); + + jPanel1.add(jPanel2); + + deviceField3.setIdentifier(""); + deviceField3.setLabelString("Traverse"); + deviceField3.setNumCols(4); + deviceField3.setOffsetNid(28); + jPanel3.add(deviceField3); + + deviceField4.setIdentifier(""); + deviceField4.setLabelString("RootNameSpaceIndex:"); + deviceField4.setNumCols(4); + deviceField4.setOffsetNid(31); + jPanel3.add(deviceField4); + + deviceField5.setIdentifier(""); + deviceField5.setLabelString("RootIdentifierValue:"); + deviceField5.setNumCols(15); + deviceField5.setOffsetNid(34); + deviceField5.setTextOnly(true); + jPanel3.add(deviceField5); + + jPanel1.add(jPanel3); + + getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START); + + deviceOutputs1.setOffsetNid(26); + jScrollPane1.setViewportView(deviceOutputs1); + + getContentPane().add(jScrollPane1, 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 DeviceField deviceField4; + private DeviceField deviceField5; + private DeviceField deviceField6; + private DeviceOutputs deviceOutputs1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JScrollPane jScrollPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/java/jdevices/src/main/java/MARTE2_OPCUA_OUTSetup.java b/java/jdevices/src/main/java/MARTE2_OPCUA_OUTSetup.java new file mode 100644 index 0000000000..037cfe3c6a --- /dev/null +++ b/java/jdevices/src/main/java/MARTE2_OPCUA_OUTSetup.java @@ -0,0 +1,107 @@ +/* + * 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_OPCUA_OUTSetup extends DeviceSetup { + + /** + * Creates new form MARTE2_OPC_OUTSetup + */ + public MARTE2_OPCUA_OUTSetup() { + 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(); + jPanel2 = new javax.swing.JPanel(); + deviceField1 = new DeviceField(); + deviceField5 = new DeviceField(); + jPanel3 = new javax.swing.JPanel(); + deviceField2 = new DeviceField(); + deviceField3 = new DeviceField(); + deviceField4 = new DeviceField(); + jScrollPane1 = new javax.swing.JScrollPane(); + deviceInputs1 = new DeviceInputs(); + + setDeviceProvider("localhost:8100"); + setDeviceTitle("MARTE2 OPCUA OUT"); + setDeviceType("MARTE2_OPCUA_OUT"); + setHeight(300); + setWidth(800); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + jPanel1.setLayout(new java.awt.GridLayout(2, 1)); + + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Address"); + deviceField1.setNumCols(25); + deviceField1.setOffsetNid(7); + deviceField1.setTextOnly(true); + jPanel2.add(deviceField1); + + deviceField5.setIdentifier(""); + deviceField5.setLabelString("RootIdentifierType"); + deviceField5.setOffsetNid(25); + deviceField5.setTextOnly(true); + jPanel2.add(deviceField5); + + jPanel1.add(jPanel2); + + deviceField2.setIdentifier(""); + deviceField2.setLabelString("Traverse: "); + deviceField2.setNumCols(4); + deviceField2.setOffsetNid(16); + jPanel3.add(deviceField2); + + deviceField3.setIdentifier(""); + deviceField3.setLabelString("RootNameSpaceIndex: "); + deviceField3.setNumCols(4); + deviceField3.setOffsetNid(19); + jPanel3.add(deviceField3); + + deviceField4.setIdentifier(""); + deviceField4.setLabelString("RootIdentifierValue: "); + deviceField4.setNumCols(15); + deviceField4.setOffsetNid(22); + deviceField4.setTextOnly(true); + jPanel3.add(deviceField4); + + jPanel1.add(jPanel3); + + getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START); + + jScrollPane1.setViewportView(deviceInputs1); + + getContentPane().add(jScrollPane1, 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 DeviceField deviceField4; + private DeviceField deviceField5; + private DeviceInputs deviceInputs1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JScrollPane jScrollPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/java/jdevices/src/main/java/MARTE2_OPCUA_SERVERSetup.java b/java/jdevices/src/main/java/MARTE2_OPCUA_SERVERSetup.java new file mode 100644 index 0000000000..67b3312e63 --- /dev/null +++ b/java/jdevices/src/main/java/MARTE2_OPCUA_SERVERSetup.java @@ -0,0 +1,458 @@ +/* + * 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_OPCUA_SERVERSetup extends DeviceSetup { + + /** + * Creates new form MARTE2_OPCUA_SERVERSetup + */ + public MARTE2_OPCUA_SERVERSetup() { + 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(); + jPanel2 = new javax.swing.JPanel(); + deviceField1 = new DeviceField(); + deviceField2 = new DeviceField(); + jScrollPane1 = new javax.swing.JScrollPane(); + jPanel1 = new javax.swing.JPanel(); + jPanel3 = new javax.swing.JPanel(); + deviceField3 = new DeviceField(); + deviceChoice1 = new DeviceChoice(); + jPanel4 = new javax.swing.JPanel(); + deviceField4 = new DeviceField(); + deviceChoice2 = new DeviceChoice(); + jPanel5 = new javax.swing.JPanel(); + deviceField5 = new DeviceField(); + deviceChoice3 = new DeviceChoice(); + jPanel6 = new javax.swing.JPanel(); + deviceField6 = new DeviceField(); + deviceChoice4 = new DeviceChoice(); + jPanel7 = new javax.swing.JPanel(); + deviceField7 = new DeviceField(); + deviceChoice5 = new DeviceChoice(); + jPanel8 = new javax.swing.JPanel(); + deviceField8 = new DeviceField(); + deviceChoice6 = new DeviceChoice(); + jPanel9 = new javax.swing.JPanel(); + deviceField9 = new DeviceField(); + deviceChoice7 = new DeviceChoice(); + jPanel10 = new javax.swing.JPanel(); + deviceField10 = new DeviceField(); + deviceChoice8 = new DeviceChoice(); + jPanel11 = new javax.swing.JPanel(); + deviceField11 = new DeviceField(); + deviceChoice9 = new DeviceChoice(); + jPanel12 = new javax.swing.JPanel(); + deviceField12 = new DeviceField(); + deviceChoice10 = new DeviceChoice(); + jPanel13 = new javax.swing.JPanel(); + deviceField13 = new DeviceField(); + deviceChoice11 = new DeviceChoice(); + jPanel14 = new javax.swing.JPanel(); + deviceField14 = new DeviceField(); + deviceChoice12 = new DeviceChoice(); + jPanel15 = new javax.swing.JPanel(); + deviceField15 = new DeviceField(); + deviceChoice13 = new DeviceChoice(); + jPanel16 = new javax.swing.JPanel(); + deviceField16 = new DeviceField(); + deviceChoice14 = new DeviceChoice(); + jPanel17 = new javax.swing.JPanel(); + deviceField17 = new DeviceField(); + deviceChoice15 = new DeviceChoice(); + jPanel18 = new javax.swing.JPanel(); + deviceField18 = new DeviceField(); + deviceChoice16 = new DeviceChoice(); + + setDeviceProvider("localhost:8100"); + setDeviceTitle("OPCUA Server Interface"); + setDeviceType("MARTE2_OPCUA_SERVER"); + setHeight(500); + setUpdateEvent(""); + setWidth(600); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Port: "); + deviceField1.setNumCols(8); + deviceField1.setOffsetNid(6); + jPanel2.add(deviceField1); + + deviceField2.setIdentifier(""); + deviceField2.setLabelString("CPU Mask: "); + deviceField2.setNumCols(8); + deviceField2.setOffsetNid(9); + jPanel2.add(deviceField2); + + getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_START); + + jPanel1.setLayout(new java.awt.GridLayout(16, 1)); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 1")); + + deviceField3.setIdentifier(""); + deviceField3.setLabelString("Name: "); + deviceField3.setNumCols(15); + deviceField3.setOffsetNid(17); + deviceField3.setTextOnly(true); + jPanel3.add(deviceField3); + + deviceChoice1.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice1.setIdentifier(""); + deviceChoice1.setLabelString("Type"); + deviceChoice1.setOffsetNid(21); + deviceChoice1.setUpdateIdentifier(""); + jPanel3.add(deviceChoice1); + + jPanel1.add(jPanel3); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 2")); + + deviceField4.setIdentifier(""); + deviceField4.setLabelString("Name: "); + deviceField4.setNumCols(15); + deviceField4.setOffsetNid(23); + deviceField4.setTextOnly(true); + jPanel4.add(deviceField4); + + deviceChoice2.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice2.setIdentifier(""); + deviceChoice2.setLabelString("Type"); + deviceChoice2.setOffsetNid(27); + deviceChoice2.setUpdateIdentifier(""); + jPanel4.add(deviceChoice2); + + jPanel1.add(jPanel4); + + jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 3")); + + deviceField5.setIdentifier(""); + deviceField5.setLabelString("Name: "); + deviceField5.setNumCols(15); + deviceField5.setOffsetNid(29); + deviceField5.setTextOnly(true); + jPanel5.add(deviceField5); + + deviceChoice3.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice3.setIdentifier(""); + deviceChoice3.setLabelString("Type"); + deviceChoice3.setOffsetNid(33); + deviceChoice3.setUpdateIdentifier(""); + jPanel5.add(deviceChoice3); + + jPanel1.add(jPanel5); + + jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 4")); + + deviceField6.setIdentifier(""); + deviceField6.setLabelString("Name: "); + deviceField6.setNumCols(15); + deviceField6.setOffsetNid(35); + deviceField6.setTextOnly(true); + jPanel6.add(deviceField6); + + deviceChoice4.setChoiceItems(new String[] {"iint8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice4.setIdentifier(""); + deviceChoice4.setLabelString("Type"); + deviceChoice4.setOffsetNid(39); + deviceChoice4.setUpdateIdentifier(""); + jPanel6.add(deviceChoice4); + + jPanel1.add(jPanel6); + + jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 5")); + + deviceField7.setIdentifier(""); + deviceField7.setLabelString("Name: "); + deviceField7.setNumCols(15); + deviceField7.setOffsetNid(41); + deviceField7.setTextOnly(true); + jPanel7.add(deviceField7); + + deviceChoice5.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice5.setIdentifier(""); + deviceChoice5.setLabelString("Type"); + deviceChoice5.setOffsetNid(45); + deviceChoice5.setUpdateIdentifier(""); + jPanel7.add(deviceChoice5); + + jPanel1.add(jPanel7); + + jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 6")); + + deviceField8.setIdentifier(""); + deviceField8.setLabelString("Name: "); + deviceField8.setNumCols(15); + deviceField8.setOffsetNid(47); + deviceField8.setTextOnly(true); + jPanel8.add(deviceField8); + + deviceChoice6.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice6.setIdentifier(""); + deviceChoice6.setLabelString("Type"); + deviceChoice6.setOffsetNid(51); + deviceChoice6.setUpdateIdentifier(""); + jPanel8.add(deviceChoice6); + + jPanel1.add(jPanel8); + + jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 7")); + + deviceField9.setIdentifier(""); + deviceField9.setLabelString("Name: "); + deviceField9.setNumCols(15); + deviceField9.setOffsetNid(53); + deviceField9.setTextOnly(true); + jPanel9.add(deviceField9); + + deviceChoice7.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice7.setIdentifier(""); + deviceChoice7.setLabelString("Type"); + deviceChoice7.setOffsetNid(57); + deviceChoice7.setUpdateIdentifier(""); + jPanel9.add(deviceChoice7); + + jPanel1.add(jPanel9); + + jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 8")); + + deviceField10.setIdentifier(""); + deviceField10.setLabelString("Name: "); + deviceField10.setNumCols(15); + deviceField10.setOffsetNid(59); + deviceField10.setTextOnly(true); + jPanel10.add(deviceField10); + + deviceChoice8.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice8.setIdentifier(""); + deviceChoice8.setLabelString("Type"); + deviceChoice8.setOffsetNid(63); + deviceChoice8.setUpdateIdentifier(""); + jPanel10.add(deviceChoice8); + + jPanel1.add(jPanel10); + + jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 9")); + + deviceField11.setIdentifier(""); + deviceField11.setLabelString("Name: "); + deviceField11.setNumCols(15); + deviceField11.setOffsetNid(65); + deviceField11.setTextOnly(true); + jPanel11.add(deviceField11); + + deviceChoice9.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice9.setIdentifier(""); + deviceChoice9.setLabelString("Type"); + deviceChoice9.setOffsetNid(69); + deviceChoice9.setUpdateIdentifier(""); + jPanel11.add(deviceChoice9); + + jPanel1.add(jPanel11); + + jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 10")); + + deviceField12.setIdentifier(""); + deviceField12.setLabelString("Name: "); + deviceField12.setNumCols(15); + deviceField12.setOffsetNid(71); + deviceField12.setTextOnly(true); + jPanel12.add(deviceField12); + + deviceChoice10.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice10.setIdentifier(""); + deviceChoice10.setLabelString("Type"); + deviceChoice10.setOffsetNid(75); + deviceChoice10.setUpdateIdentifier(""); + jPanel12.add(deviceChoice10); + + jPanel1.add(jPanel12); + + jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 11")); + + deviceField13.setIdentifier(""); + deviceField13.setLabelString("Name: "); + deviceField13.setNumCols(15); + deviceField13.setOffsetNid(77); + deviceField13.setTextOnly(true); + jPanel13.add(deviceField13); + + deviceChoice11.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice11.setIdentifier(""); + deviceChoice11.setLabelString("Type"); + deviceChoice11.setOffsetNid(81); + deviceChoice11.setUpdateIdentifier(""); + jPanel13.add(deviceChoice11); + + jPanel1.add(jPanel13); + + jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 12")); + + deviceField14.setIdentifier(""); + deviceField14.setLabelString("Name: "); + deviceField14.setNumCols(15); + deviceField14.setOffsetNid(83); + deviceField14.setTextOnly(true); + jPanel14.add(deviceField14); + + deviceChoice12.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice12.setIdentifier(""); + deviceChoice12.setLabelString("Type"); + deviceChoice12.setOffsetNid(87); + deviceChoice12.setUpdateIdentifier(""); + jPanel14.add(deviceChoice12); + + jPanel1.add(jPanel14); + + jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 13")); + + deviceField15.setIdentifier(""); + deviceField15.setLabelString("Name: "); + deviceField15.setNumCols(15); + deviceField15.setOffsetNid(89); + deviceField15.setTextOnly(true); + jPanel15.add(deviceField15); + + deviceChoice13.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice13.setIdentifier(""); + deviceChoice13.setLabelString("Type"); + deviceChoice13.setOffsetNid(93); + deviceChoice13.setUpdateIdentifier(""); + jPanel15.add(deviceChoice13); + + jPanel1.add(jPanel15); + + jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 14")); + + deviceField16.setIdentifier(""); + deviceField16.setLabelString("Name: "); + deviceField16.setNumCols(15); + deviceField16.setOffsetNid(95); + deviceField16.setTextOnly(true); + jPanel16.add(deviceField16); + + deviceChoice14.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice14.setIdentifier(""); + deviceChoice14.setLabelString("Type"); + deviceChoice14.setOffsetNid(99); + deviceChoice14.setUpdateIdentifier(""); + jPanel16.add(deviceChoice14); + + jPanel1.add(jPanel16); + + jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 15")); + + deviceField17.setIdentifier(""); + deviceField17.setLabelString("Name: "); + deviceField17.setNumCols(15); + deviceField17.setOffsetNid(101); + deviceField17.setTextOnly(true); + jPanel17.add(deviceField17); + + deviceChoice15.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice15.setIdentifier(""); + deviceChoice15.setLabelString("Type"); + deviceChoice15.setOffsetNid(105); + deviceChoice15.setUpdateIdentifier(""); + jPanel17.add(deviceChoice15); + + jPanel1.add(jPanel17); + + jPanel18.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 16")); + + deviceField18.setIdentifier(""); + deviceField18.setLabelString("Name: "); + deviceField18.setNumCols(15); + deviceField18.setOffsetNid(107); + deviceField18.setTextOnly(true); + jPanel18.add(deviceField18); + + deviceChoice16.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "float32", "float64"}); + deviceChoice16.setIdentifier(""); + deviceChoice16.setLabelString("Type"); + deviceChoice16.setOffsetNid(111); + deviceChoice16.setUpdateIdentifier(""); + jPanel18.add(deviceChoice16); + + jPanel1.add(jPanel18); + + jScrollPane1.setViewportView(jPanel1); + + getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private DeviceButtons deviceButtons1; + private DeviceChoice deviceChoice1; + private DeviceChoice deviceChoice10; + private DeviceChoice deviceChoice11; + private DeviceChoice deviceChoice12; + private DeviceChoice deviceChoice13; + private DeviceChoice deviceChoice14; + private DeviceChoice deviceChoice15; + private DeviceChoice deviceChoice16; + private DeviceChoice deviceChoice2; + private DeviceChoice deviceChoice3; + private DeviceChoice deviceChoice4; + private DeviceChoice deviceChoice5; + private DeviceChoice deviceChoice6; + private DeviceChoice deviceChoice7; + private DeviceChoice deviceChoice8; + private DeviceChoice deviceChoice9; + 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 deviceField2; + 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 jPanel2; + 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.JScrollPane jScrollPane1; + // End of variables declaration//GEN-END:variables +} diff --git a/java/jdevices/src/main/java/MARTE2_PYTHON_PIDSetup.java b/java/jdevices/src/main/java/MARTE2_PYTHON_PIDSetup.java index 98ab267398..bdcac504a7 100644 --- a/java/jdevices/src/main/java/MARTE2_PYTHON_PIDSetup.java +++ b/java/jdevices/src/main/java/MARTE2_PYTHON_PIDSetup.java @@ -32,9 +32,6 @@ public MARTE2_PYTHON_PIDSetup() // //GEN-BEGIN:initComponents private void initComponents() { - jPanel2 = new javax.swing.JPanel(); - deviceField1 = new DeviceField(); - deviceField2 = new DeviceField(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); deviceField3 = new DeviceField(); @@ -44,56 +41,42 @@ private void initComponents() { jPanel4 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); deviceField6 = new DeviceField(); - deviceChoice1 = new DeviceChoice(); jPanel6 = new javax.swing.JPanel(); deviceField7 = new DeviceField(); deviceField9 = new DeviceField(); + deviceChoice1 = new DeviceChoice(); deviceButtons1 = new DeviceButtons(); - setDeviceProvider("spilds:8100"); + setDeviceProvider("localhost:8100"); setDeviceTitle("Python PID"); setDeviceType("MARTE2_PYTHON_PID"); - setHeight(250); - setWidth(800); - - deviceField1.setIdentifier(""); - deviceField1.setLabelString("Timebase"); - deviceField1.setNumCols(20); - deviceField1.setOffsetNid(3); - jPanel2.add(deviceField1); - - deviceField2.setIdentifier(""); - deviceField2.setLabelString("Timebase Div:"); - deviceField2.setNumCols(4); - deviceField2.setOffsetNid(40); - jPanel2.add(deviceField2); - - getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_START); + setHeight(230); + setWidth(650); jPanel1.setLayout(new java.awt.GridLayout(2, 1)); deviceField3.setIdentifier(""); deviceField3.setLabelString("Kp:"); deviceField3.setNumCols(6); - deviceField3.setOffsetNid(10); + deviceField3.setOffsetNid(13); jPanel3.add(deviceField3); deviceField4.setIdentifier(""); deviceField4.setLabelString("Ki:"); deviceField4.setNumCols(6); - deviceField4.setOffsetNid(13); + deviceField4.setOffsetNid(16); jPanel3.add(deviceField4); deviceField5.setIdentifier(""); deviceField5.setLabelString("Kd:"); deviceField5.setNumCols(6); - deviceField5.setOffsetNid(16); + deviceField5.setOffsetNid(19); jPanel3.add(deviceField5); deviceField8.setIdentifier(""); deviceField8.setLabelString("Period:"); deviceField8.setNumCols(4); - deviceField8.setOffsetNid(19); + deviceField8.setOffsetNid(22); jPanel3.add(deviceField8); jPanel1.add(jPanel3); @@ -103,30 +86,30 @@ private void initComponents() { deviceField6.setIdentifier(""); deviceField6.setLabelString("Input"); deviceField6.setNumCols(35); - deviceField6.setOffsetNid(25); + deviceField6.setOffsetNid(28); jPanel5.add(deviceField6); - deviceChoice1.setChoiceItems(new String[] {"int16", "int32", "float32", "float64"}); - deviceChoice1.setIdentifier(""); - deviceChoice1.setLabelString("Output type: "); - deviceChoice1.setOffsetNid(37); - deviceChoice1.setUpdateIdentifier(""); - jPanel5.add(deviceChoice1); - jPanel4.add(jPanel5); deviceField7.setIdentifier(""); deviceField7.setLabelString("Seg. len (0 to disable writing)"); deviceField7.setNumCols(4); - deviceField7.setOffsetNid(40); + deviceField7.setOffsetNid(44); jPanel6.add(deviceField7); deviceField9.setIdentifier(""); deviceField9.setLabelString("Out CPUs:"); deviceField9.setNumCols(4); - deviceField9.setOffsetNid(34); + deviceField9.setOffsetNid(38); jPanel6.add(deviceField9); + deviceChoice1.setChoiceItems(new String[] {"int16", "int32", "float32", "float64"}); + deviceChoice1.setIdentifier(""); + deviceChoice1.setLabelString("Output type: "); + deviceChoice1.setOffsetNid(41); + deviceChoice1.setUpdateIdentifier(""); + jPanel6.add(deviceChoice1); + jPanel4.add(jPanel6); jPanel1.add(jPanel4); @@ -140,8 +123,6 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; private DeviceChoice deviceChoice1; - private DeviceField deviceField1; - private DeviceField deviceField2; private DeviceField deviceField3; private DeviceField deviceField4; private DeviceField deviceField5; @@ -150,7 +131,6 @@ private void initComponents() { private DeviceField deviceField8; private DeviceField deviceField9; private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; diff --git a/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java index 08618061a4..b1141a24f5 100644 --- a/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java +++ b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTTSetup.java @@ -28,9 +28,8 @@ private void initComponents() { deviceButtons1 = new DeviceButtons(); jPanel2 = new javax.swing.JPanel(); - deviceField1 = new DeviceField(); - deviceField2 = new DeviceField(); deviceField3 = new DeviceField(); + deviceField1 = new DeviceField(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); deviceInputs1 = new DeviceInputs(); @@ -46,24 +45,18 @@ private void initComponents() { setWidth(700); getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - deviceField1.setIdentifier(""); - deviceField1.setLabelString("Timebase"); - deviceField1.setNumCols(20); - 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); + deviceField3.setOffsetNid(145); jPanel2.add(deviceField3); + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Port: "); + deviceField1.setNumCols(6); + deviceField1.setOffsetNid(309); + jPanel2.add(deviceField1); + getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_START); jPanel1.setLayout(new java.awt.BorderLayout()); @@ -75,7 +68,7 @@ private void initComponents() { jPanel3.setLayout(new java.awt.BorderLayout()); - deviceOutputs1.setOffsetNid(114); + deviceOutputs1.setOffsetNid(139); jPanel3.add(deviceOutputs1, java.awt.BorderLayout.CENTER); jTabbedPane1.addTab("Outputs", jPanel3); @@ -96,7 +89,6 @@ 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; diff --git a/java/jdevices/src/main/java/MARTE2_SIMULINK_DTT_VSSetup.java b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTT_VSSetup.java index ef64e36558..98b67464d1 100644 --- a/java/jdevices/src/main/java/MARTE2_SIMULINK_DTT_VSSetup.java +++ b/java/jdevices/src/main/java/MARTE2_SIMULINK_DTT_VSSetup.java @@ -28,9 +28,8 @@ private void initComponents() { deviceButtons1 = new DeviceButtons(); jPanel1 = new javax.swing.JPanel(); - deviceField1 = new DeviceField(); - deviceField2 = new DeviceField(); deviceField3 = new DeviceField(); + deviceField1 = new DeviceField(); jTabbedPane1 = new javax.swing.JTabbedPane(); deviceInputs1 = new DeviceInputs(); deviceOutputs1 = new DeviceOutputs(); @@ -42,24 +41,18 @@ private void initComponents() { 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); + deviceField3.setOffsetNid(51); jPanel1.add(deviceField3); + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Port"); + deviceField1.setNumCols(6); + deviceField1.setOffsetNid(62); + jPanel1.add(deviceField1); + getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START); deviceInputs1.setOffsetNid(17); @@ -73,7 +66,6 @@ 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; diff --git a/java/jdevices/src/main/java/MARTE2_SIMULINK_GENERICSetup.java b/java/jdevices/src/main/java/MARTE2_SIMULINK_GENERICSetup.java index c7df326104..9dd6a17718 100644 --- a/java/jdevices/src/main/java/MARTE2_SIMULINK_GENERICSetup.java +++ b/java/jdevices/src/main/java/MARTE2_SIMULINK_GENERICSetup.java @@ -32,167 +32,12 @@ private void initComponents() { deviceButtons1 = new DeviceButtons(); jTabbedPane1 = new javax.swing.JTabbedPane(); jScrollPane1 = new javax.swing.JScrollPane(); - jPanel4 = new javax.swing.JPanel(); - jPanel5 = new javax.swing.JPanel(); - jPanel6 = new javax.swing.JPanel(); - deviceField5 = new DeviceField(); - deviceChoice1 = new DeviceChoice(); - deviceField6 = new DeviceField(); - jPanel7 = new javax.swing.JPanel(); - deviceField7 = new DeviceField(); - jPanel8 = new javax.swing.JPanel(); - jPanel9 = new javax.swing.JPanel(); - deviceField8 = new DeviceField(); - deviceChoice2 = new DeviceChoice(); - deviceField9 = new DeviceField(); - jPanel10 = new javax.swing.JPanel(); - deviceField10 = new DeviceField(); - jPanel11 = new javax.swing.JPanel(); - jPanel12 = new javax.swing.JPanel(); - deviceField11 = new DeviceField(); - deviceChoice3 = new DeviceChoice(); - deviceField12 = new DeviceField(); - jPanel13 = new javax.swing.JPanel(); - deviceField13 = new DeviceField(); - jPanel14 = new javax.swing.JPanel(); - jPanel15 = new javax.swing.JPanel(); - deviceField14 = new DeviceField(); - deviceChoice4 = new DeviceChoice(); - deviceField15 = new DeviceField(); - jPanel16 = new javax.swing.JPanel(); - deviceField16 = new DeviceField(); - jPanel17 = new javax.swing.JPanel(); - jPanel18 = new javax.swing.JPanel(); - deviceField17 = new DeviceField(); - deviceChoice5 = new DeviceChoice(); - deviceField18 = new DeviceField(); - jPanel19 = new javax.swing.JPanel(); - deviceField19 = new DeviceField(); - jPanel20 = new javax.swing.JPanel(); - jPanel21 = new javax.swing.JPanel(); - deviceField20 = new DeviceField(); - deviceChoice6 = new DeviceChoice(); - deviceField21 = new DeviceField(); - jPanel22 = new javax.swing.JPanel(); - deviceField22 = new DeviceField(); - jPanel23 = new javax.swing.JPanel(); - jPanel24 = new javax.swing.JPanel(); - deviceField23 = new DeviceField(); - deviceChoice7 = new DeviceChoice(); - deviceField24 = new DeviceField(); - jPanel25 = new javax.swing.JPanel(); - deviceField25 = new DeviceField(); - jPanel26 = new javax.swing.JPanel(); - jPanel27 = new javax.swing.JPanel(); - deviceField26 = new DeviceField(); - deviceChoice8 = new DeviceChoice(); - deviceField27 = new DeviceField(); - jPanel28 = new javax.swing.JPanel(); - deviceField28 = new DeviceField(); + deviceInputs1 = new DeviceInputs(); jScrollPane2 = new javax.swing.JScrollPane(); - jPanel29 = new javax.swing.JPanel(); - jPanel30 = new javax.swing.JPanel(); - deviceField29 = new DeviceField(); - deviceChoice9 = new DeviceChoice(); - deviceField30 = new DeviceField(); - deviceField31 = new DeviceField(); - deviceField69 = new DeviceField(); - jPanel31 = new javax.swing.JPanel(); - deviceField32 = new DeviceField(); - deviceChoice10 = new DeviceChoice(); - deviceField33 = new DeviceField(); - deviceField34 = new DeviceField(); - deviceField70 = new DeviceField(); - jPanel32 = new javax.swing.JPanel(); - deviceField35 = new DeviceField(); - deviceChoice11 = new DeviceChoice(); - deviceField36 = new DeviceField(); - deviceField37 = new DeviceField(); - deviceField71 = new DeviceField(); - jPanel33 = new javax.swing.JPanel(); - deviceField38 = new DeviceField(); - deviceChoice12 = new DeviceChoice(); - deviceField39 = new DeviceField(); - deviceField40 = new DeviceField(); - deviceField72 = new DeviceField(); - jPanel34 = new javax.swing.JPanel(); - deviceField41 = new DeviceField(); - deviceChoice13 = new DeviceChoice(); - deviceField42 = new DeviceField(); - deviceField43 = new DeviceField(); - deviceField73 = new DeviceField(); - jPanel35 = new javax.swing.JPanel(); - deviceField44 = new DeviceField(); - deviceChoice14 = new DeviceChoice(); - deviceField45 = new DeviceField(); - deviceField46 = new DeviceField(); - deviceField74 = new DeviceField(); - jPanel36 = new javax.swing.JPanel(); - deviceField47 = new DeviceField(); - deviceChoice15 = new DeviceChoice(); - deviceField48 = new DeviceField(); - deviceField49 = new DeviceField(); - deviceField75 = new DeviceField(); - jPanel37 = new javax.swing.JPanel(); - deviceField50 = new DeviceField(); - deviceChoice16 = new DeviceChoice(); - deviceField51 = new DeviceField(); - deviceField52 = new DeviceField(); - deviceField76 = new DeviceField(); + deviceOutputs1 = new DeviceOutputs(); jScrollPane3 = new javax.swing.JScrollPane(); - jPanel38 = new javax.swing.JPanel(); - jPanel39 = new javax.swing.JPanel(); - deviceField53 = new DeviceField(); - deviceField54 = new DeviceField(); - jPanel40 = new javax.swing.JPanel(); - deviceField55 = new DeviceField(); - deviceField56 = new DeviceField(); - jPanel41 = new javax.swing.JPanel(); - deviceField57 = new DeviceField(); - deviceField58 = new DeviceField(); - jPanel42 = new javax.swing.JPanel(); - deviceField59 = new DeviceField(); - deviceField60 = new DeviceField(); - jPanel43 = new javax.swing.JPanel(); - deviceField61 = new DeviceField(); - deviceField62 = new DeviceField(); - jPanel44 = new javax.swing.JPanel(); - deviceField63 = new DeviceField(); - deviceField64 = new DeviceField(); - jPanel45 = new javax.swing.JPanel(); - deviceField65 = new DeviceField(); - deviceField66 = new DeviceField(); - jPanel46 = new javax.swing.JPanel(); - deviceField67 = new DeviceField(); - deviceField68 = new DeviceField(); - jPanel48 = new javax.swing.JPanel(); - deviceField79 = new DeviceField(); - deviceField80 = new DeviceField(); - jPanel49 = new javax.swing.JPanel(); - deviceField81 = new DeviceField(); - deviceField82 = new DeviceField(); - jPanel50 = new javax.swing.JPanel(); - deviceField83 = new DeviceField(); - deviceField84 = new DeviceField(); - jPanel51 = new javax.swing.JPanel(); - deviceField85 = new DeviceField(); - deviceField86 = new DeviceField(); - jPanel52 = new javax.swing.JPanel(); - deviceField87 = new DeviceField(); - deviceField88 = new DeviceField(); - jPanel53 = new javax.swing.JPanel(); - deviceField89 = new DeviceField(); - deviceField90 = new DeviceField(); - jPanel54 = new javax.swing.JPanel(); - deviceField91 = new DeviceField(); - deviceField92 = new DeviceField(); - jPanel55 = new javax.swing.JPanel(); - deviceField93 = new DeviceField(); - deviceField94 = new DeviceField(); + deviceParameters1 = new DeviceParameters(); jPanel1 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - deviceField1 = new DeviceField(); - deviceField2 = new DeviceField(); jPanel3 = new javax.swing.JPanel(); deviceField3 = new DeviceField(); deviceField4 = new DeviceField(); @@ -209,833 +54,26 @@ private void initComponents() { setWidth(850); getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - jPanel4.setLayout(new java.awt.GridLayout(8, 1)); - - jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 1")); - jPanel5.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField5.setIdentifier(""); - deviceField5.setLabelString("Name: "); - deviceField5.setOffsetNid(71); - deviceField5.setTextOnly(true); - jPanel6.add(deviceField5); - - deviceChoice1.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice1.setIdentifier(""); - deviceChoice1.setLabelString("Type: "); - deviceChoice1.setOffsetNid(67); - deviceChoice1.setUpdateIdentifier(""); - jPanel6.add(deviceChoice1); - - deviceField6.setIdentifier(""); - deviceField6.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField6.setNumCols(4); - deviceField6.setOffsetNid(68); - jPanel6.add(deviceField6); - - jPanel5.add(jPanel6); - - deviceField7.setIdentifier(""); - deviceField7.setLabelString("Value: "); - deviceField7.setNumCols(40); - deviceField7.setOffsetNid(70); - jPanel7.add(deviceField7); - - jPanel5.add(jPanel7); - - jPanel4.add(jPanel5); - - jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 2")); - jPanel8.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField8.setIdentifier(""); - deviceField8.setLabelString("Name: "); - deviceField8.setOffsetNid(78); - deviceField8.setTextOnly(true); - jPanel9.add(deviceField8); - - deviceChoice2.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice2.setIdentifier(""); - deviceChoice2.setLabelString("Type: "); - deviceChoice2.setOffsetNid(74); - deviceChoice2.setUpdateIdentifier(""); - jPanel9.add(deviceChoice2); - - deviceField9.setIdentifier(""); - deviceField9.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField9.setNumCols(4); - deviceField9.setOffsetNid(75); - jPanel9.add(deviceField9); - - jPanel8.add(jPanel9); - - deviceField10.setIdentifier(""); - deviceField10.setLabelString("Value: "); - deviceField10.setNumCols(40); - deviceField10.setOffsetNid(77); - jPanel10.add(deviceField10); - - jPanel8.add(jPanel10); - - jPanel4.add(jPanel8); - - jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 3")); - jPanel11.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField11.setIdentifier(""); - deviceField11.setLabelString("Name: "); - deviceField11.setOffsetNid(85); - deviceField11.setTextOnly(true); - jPanel12.add(deviceField11); - - deviceChoice3.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice3.setIdentifier(""); - deviceChoice3.setLabelString("Type: "); - deviceChoice3.setOffsetNid(81); - deviceChoice3.setUpdateIdentifier(""); - jPanel12.add(deviceChoice3); - - deviceField12.setIdentifier(""); - deviceField12.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField12.setNumCols(4); - deviceField12.setOffsetNid(82); - jPanel12.add(deviceField12); - - jPanel11.add(jPanel12); - - deviceField13.setIdentifier(""); - deviceField13.setLabelString("Value: "); - deviceField13.setNumCols(40); - deviceField13.setOffsetNid(84); - jPanel13.add(deviceField13); - - jPanel11.add(jPanel13); - - jPanel4.add(jPanel11); - - jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 4")); - jPanel14.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField14.setIdentifier(""); - deviceField14.setLabelString("Name: "); - deviceField14.setOffsetNid(92); - deviceField14.setTextOnly(true); - jPanel15.add(deviceField14); - - deviceChoice4.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice4.setIdentifier(""); - deviceChoice4.setLabelString("Type: "); - deviceChoice4.setOffsetNid(88); - deviceChoice4.setUpdateIdentifier(""); - jPanel15.add(deviceChoice4); - - deviceField15.setIdentifier(""); - deviceField15.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField15.setNumCols(4); - deviceField15.setOffsetNid(89); - jPanel15.add(deviceField15); - - jPanel14.add(jPanel15); - - deviceField16.setIdentifier(""); - deviceField16.setLabelString("Value: "); - deviceField16.setNumCols(40); - deviceField16.setOffsetNid(91); - jPanel16.add(deviceField16); - - jPanel14.add(jPanel16); - - jPanel4.add(jPanel14); - - jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 5")); - jPanel17.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField17.setIdentifier(""); - deviceField17.setLabelString("Name: "); - deviceField17.setOffsetNid(99); - deviceField17.setTextOnly(true); - jPanel18.add(deviceField17); - - deviceChoice5.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice5.setIdentifier(""); - deviceChoice5.setLabelString("Type: "); - deviceChoice5.setOffsetNid(95); - deviceChoice5.setUpdateIdentifier(""); - jPanel18.add(deviceChoice5); - - deviceField18.setIdentifier(""); - deviceField18.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField18.setNumCols(4); - deviceField18.setOffsetNid(96); - jPanel18.add(deviceField18); - - jPanel17.add(jPanel18); - - deviceField19.setIdentifier(""); - deviceField19.setLabelString("Value: "); - deviceField19.setNumCols(40); - deviceField19.setOffsetNid(98); - jPanel19.add(deviceField19); - - jPanel17.add(jPanel19); - - jPanel4.add(jPanel17); - - jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 6")); - jPanel20.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField20.setIdentifier(""); - deviceField20.setLabelString("Name: "); - deviceField20.setOffsetNid(106); - deviceField20.setTextOnly(true); - jPanel21.add(deviceField20); - - deviceChoice6.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice6.setIdentifier(""); - deviceChoice6.setLabelString("Type: "); - deviceChoice6.setOffsetNid(102); - deviceChoice6.setUpdateIdentifier(""); - jPanel21.add(deviceChoice6); - - deviceField21.setIdentifier(""); - deviceField21.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField21.setNumCols(4); - deviceField21.setOffsetNid(103); - jPanel21.add(deviceField21); - - jPanel20.add(jPanel21); - - deviceField22.setIdentifier(""); - deviceField22.setLabelString("Value: "); - deviceField22.setNumCols(40); - deviceField22.setOffsetNid(105); - jPanel22.add(deviceField22); - - jPanel20.add(jPanel22); - - jPanel4.add(jPanel20); - - jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 7")); - jPanel23.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField23.setIdentifier(""); - deviceField23.setLabelString("Name: "); - deviceField23.setOffsetNid(113); - deviceField23.setTextOnly(true); - jPanel24.add(deviceField23); - - deviceChoice7.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice7.setIdentifier(""); - deviceChoice7.setLabelString("Type: "); - deviceChoice7.setOffsetNid(109); - deviceChoice7.setUpdateIdentifier(""); - jPanel24.add(deviceChoice7); - - deviceField24.setIdentifier(""); - deviceField24.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField24.setNumCols(4); - deviceField24.setOffsetNid(110); - jPanel24.add(deviceField24); - - jPanel23.add(jPanel24); - - deviceField25.setIdentifier(""); - deviceField25.setLabelString("Value: "); - deviceField25.setNumCols(40); - deviceField25.setOffsetNid(112); - jPanel25.add(deviceField25); - - jPanel23.add(jPanel25); - - jPanel4.add(jPanel23); - - jPanel26.setBorder(javax.swing.BorderFactory.createTitledBorder("Input 8")); - jPanel26.setLayout(new java.awt.GridLayout(2, 1)); - - deviceField26.setIdentifier(""); - deviceField26.setLabelString("Name: "); - deviceField26.setOffsetNid(120); - deviceField26.setTextOnly(true); - jPanel27.add(deviceField26); - - deviceChoice8.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice8.setIdentifier(""); - deviceChoice8.setLabelString("Type: "); - deviceChoice8.setOffsetNid(116); - deviceChoice8.setUpdateIdentifier(""); - jPanel27.add(deviceChoice8); - - deviceField27.setIdentifier(""); - deviceField27.setLabelString("Dimension (0 for scalar, array otherwise):"); - deviceField27.setNumCols(4); - deviceField27.setOffsetNid(117); - jPanel27.add(deviceField27); - - jPanel26.add(jPanel27); - - deviceField28.setIdentifier(""); - deviceField28.setLabelString("Value: "); - deviceField28.setNumCols(40); - deviceField28.setOffsetNid(119); - jPanel28.add(deviceField28); - - jPanel26.add(jPanel28); - - jPanel4.add(jPanel26); - - jScrollPane1.setViewportView(jPanel4); + deviceInputs1.setOffsetNid(65); + jScrollPane1.setViewportView(deviceInputs1); jTabbedPane1.addTab("Inputs", jScrollPane1); - jPanel29.setLayout(new java.awt.GridLayout(8, 1)); - - jPanel30.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 1")); - - deviceField29.setIdentifier(""); - deviceField29.setLabelString("Name:"); - deviceField29.setOffsetNid(130); - deviceField29.setTextOnly(true); - jPanel30.add(deviceField29); - - deviceChoice9.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice9.setIdentifier(""); - deviceChoice9.setLabelString("Type:"); - deviceChoice9.setOffsetNid(131); - deviceChoice9.setUpdateIdentifier(""); - jPanel30.add(deviceChoice9); - - deviceField30.setIdentifier(""); - deviceField30.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField30.setNumCols(8); - deviceField30.setOffsetNid(133); - jPanel30.add(deviceField30); - - deviceField31.setIdentifier(""); - deviceField31.setLabelString("Seg. Len (0 to disable):"); - deviceField31.setNumCols(14); - deviceField31.setOffsetNid(134); - jPanel30.add(deviceField31); - - deviceField69.setIdentifier(""); - deviceField69.setLabelString("Stream: "); - deviceField69.setOffsetNid(135); - deviceField69.setTextOnly(true); - jPanel30.add(deviceField69); - - jPanel29.add(jPanel30); - - jPanel31.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 2")); - - deviceField32.setIdentifier(""); - deviceField32.setLabelString("Name:"); - deviceField32.setOffsetNid(139); - deviceField32.setTextOnly(true); - jPanel31.add(deviceField32); - - deviceChoice10.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice10.setIdentifier(""); - deviceChoice10.setLabelString("Type:"); - deviceChoice10.setOffsetNid(140); - deviceChoice10.setUpdateIdentifier(""); - jPanel31.add(deviceChoice10); - - deviceField33.setIdentifier(""); - deviceField33.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField33.setNumCols(8); - deviceField33.setOffsetNid(142); - jPanel31.add(deviceField33); - - deviceField34.setIdentifier(""); - deviceField34.setLabelString("Seg. Len (0 to disable):"); - deviceField34.setNumCols(14); - deviceField34.setOffsetNid(143); - jPanel31.add(deviceField34); - - deviceField70.setIdentifier(""); - deviceField70.setLabelString("Stream: "); - deviceField70.setOffsetNid(144); - deviceField70.setTextOnly(true); - jPanel31.add(deviceField70); - - jPanel29.add(jPanel31); - - jPanel32.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 3")); - - deviceField35.setIdentifier(""); - deviceField35.setLabelString("Name:"); - deviceField35.setOffsetNid(148); - deviceField35.setTextOnly(true); - jPanel32.add(deviceField35); - - deviceChoice11.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice11.setIdentifier(""); - deviceChoice11.setLabelString("Type:"); - deviceChoice11.setOffsetNid(149); - deviceChoice11.setUpdateIdentifier(""); - jPanel32.add(deviceChoice11); - - deviceField36.setIdentifier(""); - deviceField36.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField36.setNumCols(8); - deviceField36.setOffsetNid(151); - jPanel32.add(deviceField36); - - deviceField37.setIdentifier(""); - deviceField37.setLabelString("Seg. Len (0 to disable):"); - deviceField37.setNumCols(14); - deviceField37.setOffsetNid(152); - jPanel32.add(deviceField37); - - deviceField71.setIdentifier(""); - deviceField71.setLabelString("Stream: "); - deviceField71.setOffsetNid(153); - deviceField71.setTextOnly(true); - jPanel32.add(deviceField71); - - jPanel29.add(jPanel32); - - jPanel33.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 4")); - - deviceField38.setIdentifier(""); - deviceField38.setLabelString("Name:"); - deviceField38.setOffsetNid(157); - deviceField38.setTextOnly(true); - jPanel33.add(deviceField38); - - deviceChoice12.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice12.setIdentifier(""); - deviceChoice12.setLabelString("Type:"); - deviceChoice12.setOffsetNid(158); - deviceChoice12.setUpdateIdentifier(""); - jPanel33.add(deviceChoice12); - - deviceField39.setIdentifier(""); - deviceField39.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField39.setNumCols(8); - deviceField39.setOffsetNid(160); - jPanel33.add(deviceField39); - - deviceField40.setIdentifier(""); - deviceField40.setLabelString("Seg. Len (0 to disable):"); - deviceField40.setNumCols(14); - deviceField40.setOffsetNid(161); - jPanel33.add(deviceField40); - - deviceField72.setIdentifier(""); - deviceField72.setLabelString("Stream: "); - deviceField72.setOffsetNid(162); - deviceField72.setTextOnly(true); - jPanel33.add(deviceField72); - - jPanel29.add(jPanel33); - - jPanel34.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 5")); - - deviceField41.setIdentifier(""); - deviceField41.setLabelString("Name:"); - deviceField41.setOffsetNid(166); - deviceField41.setTextOnly(true); - jPanel34.add(deviceField41); - - deviceChoice13.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice13.setIdentifier(""); - deviceChoice13.setLabelString("Type:"); - deviceChoice13.setOffsetNid(167); - deviceChoice13.setUpdateIdentifier(""); - jPanel34.add(deviceChoice13); - - deviceField42.setIdentifier(""); - deviceField42.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField42.setNumCols(8); - deviceField42.setOffsetNid(169); - jPanel34.add(deviceField42); - - deviceField43.setIdentifier(""); - deviceField43.setLabelString("Seg. Len (0 to disable):"); - deviceField43.setNumCols(14); - deviceField43.setOffsetNid(170); - jPanel34.add(deviceField43); - - deviceField73.setIdentifier(""); - deviceField73.setLabelString("Stream: "); - deviceField73.setOffsetNid(171); - deviceField73.setTextOnly(true); - jPanel34.add(deviceField73); - - jPanel29.add(jPanel34); - - jPanel35.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 6")); - - deviceField44.setIdentifier(""); - deviceField44.setLabelString("Name:"); - deviceField44.setOffsetNid(175); - deviceField44.setTextOnly(true); - jPanel35.add(deviceField44); - - deviceChoice14.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice14.setIdentifier(""); - deviceChoice14.setLabelString("Type:"); - deviceChoice14.setOffsetNid(176); - deviceChoice14.setUpdateIdentifier(""); - jPanel35.add(deviceChoice14); - - deviceField45.setIdentifier(""); - deviceField45.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField45.setNumCols(8); - deviceField45.setOffsetNid(178); - jPanel35.add(deviceField45); - - deviceField46.setIdentifier(""); - deviceField46.setLabelString("Seg. Len (0 to disable):"); - deviceField46.setNumCols(14); - deviceField46.setOffsetNid(179); - jPanel35.add(deviceField46); - - deviceField74.setIdentifier(""); - deviceField74.setLabelString("Stream: "); - deviceField74.setOffsetNid(180); - deviceField74.setTextOnly(true); - jPanel35.add(deviceField74); - - jPanel29.add(jPanel35); - - jPanel36.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 7")); - - deviceField47.setIdentifier(""); - deviceField47.setLabelString("Name:"); - deviceField47.setOffsetNid(184); - deviceField47.setTextOnly(true); - jPanel36.add(deviceField47); - - deviceChoice15.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice15.setIdentifier(""); - deviceChoice15.setLabelString("Type:"); - deviceChoice15.setOffsetNid(185); - deviceChoice15.setUpdateIdentifier(""); - jPanel36.add(deviceChoice15); - - deviceField48.setIdentifier(""); - deviceField48.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField48.setNumCols(8); - deviceField48.setOffsetNid(187); - jPanel36.add(deviceField48); - - deviceField49.setIdentifier(""); - deviceField49.setLabelString("Seg. Len (0 to disable):"); - deviceField49.setNumCols(14); - deviceField49.setOffsetNid(188); - jPanel36.add(deviceField49); - - deviceField75.setIdentifier(""); - deviceField75.setLabelString("Stream: "); - deviceField75.setOffsetNid(189); - deviceField75.setTextOnly(true); - jPanel36.add(deviceField75); - - jPanel29.add(jPanel36); - - jPanel37.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder("Output 1"), "Output 8")); - - deviceField50.setIdentifier(""); - deviceField50.setLabelString("Name:"); - deviceField50.setOffsetNid(193); - deviceField50.setTextOnly(true); - jPanel37.add(deviceField50); - - deviceChoice16.setChoiceItems(new String[] {"int8", "int16", "int32", "int64", "float32", "float64"}); - deviceChoice16.setIdentifier(""); - deviceChoice16.setLabelString("Type:"); - deviceChoice16.setOffsetNid(194); - deviceChoice16.setUpdateIdentifier(""); - jPanel37.add(deviceChoice16); - - deviceField51.setIdentifier(""); - deviceField51.setLabelString("Dimension (0 for scalar, -1 to disable)"); - deviceField51.setNumCols(8); - deviceField51.setOffsetNid(196); - jPanel37.add(deviceField51); - - deviceField52.setIdentifier(""); - deviceField52.setLabelString("Seg. Len (0 to disable):"); - deviceField52.setNumCols(14); - deviceField52.setOffsetNid(197); - jPanel37.add(deviceField52); - - deviceField76.setIdentifier(""); - deviceField76.setLabelString("Stream: "); - deviceField76.setOffsetNid(198); - deviceField76.setTextOnly(true); - jPanel37.add(deviceField76); - - jPanel29.add(jPanel37); - - jScrollPane2.setViewportView(jPanel29); + deviceOutputs1.setOffsetNid(130); + jScrollPane2.setViewportView(deviceOutputs1); jTabbedPane1.addTab("Outputs", jScrollPane2); - jPanel38.setLayout(new java.awt.GridLayout(16, 1)); - - jPanel39.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 1")); - - deviceField53.setIdentifier(""); - deviceField53.setLabelString("Name:"); - deviceField53.setOffsetNid(18); - deviceField53.setTextOnly(true); - jPanel39.add(deviceField53); - - deviceField54.setIdentifier(""); - deviceField54.setLabelString("Value: "); - deviceField54.setOffsetNid(19); - jPanel39.add(deviceField54); - - jPanel38.add(jPanel39); - - jPanel40.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 2")); - - deviceField55.setIdentifier(""); - deviceField55.setLabelString("Name:"); - deviceField55.setOffsetNid(21); - deviceField55.setTextOnly(true); - jPanel40.add(deviceField55); - - deviceField56.setIdentifier(""); - deviceField56.setLabelString("Value: "); - deviceField56.setOffsetNid(22); - jPanel40.add(deviceField56); - - jPanel38.add(jPanel40); - - jPanel41.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 3")); - - deviceField57.setIdentifier(""); - deviceField57.setLabelString("Name:"); - deviceField57.setOffsetNid(24); - deviceField57.setTextOnly(true); - jPanel41.add(deviceField57); - - deviceField58.setIdentifier(""); - deviceField58.setLabelString("Value: "); - deviceField58.setOffsetNid(25); - jPanel41.add(deviceField58); - - jPanel38.add(jPanel41); - - jPanel42.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 4")); - - deviceField59.setIdentifier(""); - deviceField59.setLabelString("Name:"); - deviceField59.setOffsetNid(27); - deviceField59.setTextOnly(true); - jPanel42.add(deviceField59); - - deviceField60.setIdentifier(""); - deviceField60.setLabelString("Value: "); - deviceField60.setOffsetNid(28); - jPanel42.add(deviceField60); - - jPanel38.add(jPanel42); - - jPanel43.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 5")); - - deviceField61.setIdentifier(""); - deviceField61.setLabelString("Name:"); - deviceField61.setOffsetNid(30); - deviceField61.setTextOnly(true); - jPanel43.add(deviceField61); - - deviceField62.setIdentifier(""); - deviceField62.setLabelString("Value: "); - deviceField62.setOffsetNid(31); - jPanel43.add(deviceField62); - - jPanel38.add(jPanel43); - - jPanel44.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 6")); - - deviceField63.setIdentifier(""); - deviceField63.setLabelString("Name:"); - deviceField63.setOffsetNid(33); - deviceField63.setTextOnly(true); - jPanel44.add(deviceField63); - - deviceField64.setIdentifier(""); - deviceField64.setLabelString("Value: "); - deviceField64.setOffsetNid(34); - jPanel44.add(deviceField64); - - jPanel38.add(jPanel44); - - jPanel45.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 7")); - - deviceField65.setIdentifier(""); - deviceField65.setLabelString("Name:"); - deviceField65.setOffsetNid(36); - deviceField65.setTextOnly(true); - jPanel45.add(deviceField65); - - deviceField66.setIdentifier(""); - deviceField66.setLabelString("Value: "); - deviceField66.setOffsetNid(37); - jPanel45.add(deviceField66); - - jPanel38.add(jPanel45); - - jPanel46.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 8")); - - deviceField67.setIdentifier(""); - deviceField67.setLabelString("Name:"); - deviceField67.setOffsetNid(39); - deviceField67.setTextOnly(true); - jPanel46.add(deviceField67); - - deviceField68.setIdentifier(""); - deviceField68.setLabelString("Value: "); - deviceField68.setOffsetNid(40); - jPanel46.add(deviceField68); - - jPanel38.add(jPanel46); - - jPanel48.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 9")); - - deviceField79.setIdentifier(""); - deviceField79.setLabelString("Name:"); - deviceField79.setOffsetNid(42); - deviceField79.setTextOnly(true); - jPanel48.add(deviceField79); - - deviceField80.setIdentifier(""); - deviceField80.setLabelString("Value: "); - deviceField80.setOffsetNid(43); - jPanel48.add(deviceField80); - - jPanel38.add(jPanel48); - - jPanel49.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 10")); - - deviceField81.setIdentifier(""); - deviceField81.setLabelString("Name:"); - deviceField81.setOffsetNid(45); - deviceField81.setTextOnly(true); - jPanel49.add(deviceField81); - - deviceField82.setIdentifier(""); - deviceField82.setLabelString("Value: "); - deviceField82.setOffsetNid(46); - jPanel49.add(deviceField82); - - jPanel38.add(jPanel49); - - jPanel50.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 11")); - - deviceField83.setIdentifier(""); - deviceField83.setLabelString("Name:"); - deviceField83.setOffsetNid(48); - deviceField83.setTextOnly(true); - jPanel50.add(deviceField83); - - deviceField84.setIdentifier(""); - deviceField84.setLabelString("Value: "); - deviceField84.setOffsetNid(49); - jPanel50.add(deviceField84); - - jPanel38.add(jPanel50); - - jPanel51.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 12")); - - deviceField85.setIdentifier(""); - deviceField85.setLabelString("Name:"); - deviceField85.setOffsetNid(51); - deviceField85.setTextOnly(true); - jPanel51.add(deviceField85); - - deviceField86.setIdentifier(""); - deviceField86.setLabelString("Value: "); - deviceField86.setOffsetNid(52); - jPanel51.add(deviceField86); - - jPanel38.add(jPanel51); - - jPanel52.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 13")); - - deviceField87.setIdentifier(""); - deviceField87.setLabelString("Name:"); - deviceField87.setOffsetNid(54); - deviceField87.setTextOnly(true); - jPanel52.add(deviceField87); - - deviceField88.setIdentifier(""); - deviceField88.setLabelString("Value: "); - deviceField88.setOffsetNid(55); - jPanel52.add(deviceField88); - - jPanel38.add(jPanel52); - - jPanel53.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 14")); - - deviceField89.setIdentifier(""); - deviceField89.setLabelString("Name:"); - deviceField89.setOffsetNid(57); - deviceField89.setTextOnly(true); - jPanel53.add(deviceField89); - - deviceField90.setIdentifier(""); - deviceField90.setLabelString("Value: "); - deviceField90.setOffsetNid(58); - jPanel53.add(deviceField90); - - jPanel38.add(jPanel53); - - jPanel54.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 15")); - - deviceField91.setIdentifier(""); - deviceField91.setLabelString("Name:"); - deviceField91.setOffsetNid(60); - deviceField91.setTextOnly(true); - jPanel54.add(deviceField91); - - deviceField92.setIdentifier(""); - deviceField92.setLabelString("Value: "); - deviceField92.setOffsetNid(61); - jPanel54.add(deviceField92); - - jPanel38.add(jPanel54); - - jPanel55.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameter 16")); - - deviceField93.setIdentifier(""); - deviceField93.setLabelString("Name:"); - deviceField93.setOffsetNid(63); - deviceField93.setTextOnly(true); - jPanel55.add(deviceField93); - - deviceField94.setIdentifier(""); - deviceField94.setLabelString("Value: "); - deviceField94.setOffsetNid(64); - jPanel55.add(deviceField94); - - jPanel38.add(jPanel55); - - jScrollPane3.setViewportView(jPanel38); + deviceParameters1.setNumParameters(16); + deviceParameters1.setOffsetNid(4); + deviceParameters1.setParameterOffset(4); + jScrollPane3.setViewportView(deviceParameters1); jTabbedPane1.addTab("Parameters", jScrollPane3); getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); - jPanel1.setLayout(new java.awt.GridLayout(3, 0)); - - deviceField1.setIdentifier(""); - deviceField1.setLabelString("Timebase:"); - deviceField1.setNumCols(20); - deviceField1.setOffsetNid(3); - jPanel2.add(deviceField1); - - deviceField2.setIdentifier(""); - deviceField2.setLabelString("Timebase div. (if from another thread):"); - deviceField2.setNumCols(4); - deviceField2.setOffsetNid(174); - jPanel2.add(deviceField2); - - jPanel1.add(jPanel2); + jPanel1.setLayout(new java.awt.GridLayout(2, 0)); deviceField3.setIdentifier(""); deviceField3.setLabelString("Simulink module: "); @@ -1046,7 +84,7 @@ private void initComponents() { deviceField4.setIdentifier(""); deviceField4.setLabelString("Write CPU Mask: "); deviceField4.setNumCols(4); - deviceField4.setOffsetNid(101); + deviceField4.setOffsetNid(128); jPanel3.add(deviceField4); jButton1.setText("Fill fields"); @@ -1070,13 +108,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { deviceField77.setIdentifier(""); deviceField77.setLabelString("MDS write trigger:"); deviceField77.setNumCols(30); - deviceField77.setOffsetNid(96); + deviceField77.setOffsetNid(131); jPanel47.add(deviceField77); deviceField78.setIdentifier(""); deviceField78.setLabelString("Post trig. Samples: "); deviceField78.setNumCols(6); - deviceField78.setOffsetNid(98); + deviceField78.setOffsetNid(133); jPanel47.add(deviceField78); jPanel1.add(jPanel47); @@ -1103,173 +141,18 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; - private DeviceChoice deviceChoice1; - private DeviceChoice deviceChoice10; - private DeviceChoice deviceChoice11; - private DeviceChoice deviceChoice12; - private DeviceChoice deviceChoice13; - private DeviceChoice deviceChoice14; - private DeviceChoice deviceChoice15; - private DeviceChoice deviceChoice16; private DeviceChoice deviceChoice17; - private DeviceChoice deviceChoice2; - private DeviceChoice deviceChoice3; - private DeviceChoice deviceChoice4; - private DeviceChoice deviceChoice5; - private DeviceChoice deviceChoice6; - private DeviceChoice deviceChoice7; - private DeviceChoice deviceChoice8; - private DeviceChoice deviceChoice9; - 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 deviceField27; - private DeviceField deviceField28; - private DeviceField deviceField29; private DeviceField deviceField3; - private DeviceField deviceField30; - private DeviceField deviceField31; - private DeviceField deviceField32; - private DeviceField deviceField33; - private DeviceField deviceField34; - private DeviceField deviceField35; - private DeviceField deviceField36; - private DeviceField deviceField37; - private DeviceField deviceField38; - private DeviceField deviceField39; private DeviceField deviceField4; - private DeviceField deviceField40; - private DeviceField deviceField41; - private DeviceField deviceField42; - private DeviceField deviceField43; - private DeviceField deviceField44; - private DeviceField deviceField45; - private DeviceField deviceField46; - private DeviceField deviceField47; - private DeviceField deviceField48; - private DeviceField deviceField49; - private DeviceField deviceField5; - private DeviceField deviceField50; - private DeviceField deviceField51; - private DeviceField deviceField52; - private DeviceField deviceField53; - private DeviceField deviceField54; - private DeviceField deviceField55; - private DeviceField deviceField56; - private DeviceField deviceField57; - private DeviceField deviceField58; - private DeviceField deviceField59; - private DeviceField deviceField6; - private DeviceField deviceField60; - private DeviceField deviceField61; - private DeviceField deviceField62; - private DeviceField deviceField63; - private DeviceField deviceField64; - private DeviceField deviceField65; - private DeviceField deviceField66; - private DeviceField deviceField67; - private DeviceField deviceField68; - private DeviceField deviceField69; - private DeviceField deviceField7; - private DeviceField deviceField70; - private DeviceField deviceField71; - private DeviceField deviceField72; - private DeviceField deviceField73; - private DeviceField deviceField74; - private DeviceField deviceField75; - private DeviceField deviceField76; private DeviceField deviceField77; private DeviceField deviceField78; - private DeviceField deviceField79; - private DeviceField deviceField8; - private DeviceField deviceField80; - private DeviceField deviceField81; - private DeviceField deviceField82; - private DeviceField deviceField83; - private DeviceField deviceField84; - private DeviceField deviceField85; - private DeviceField deviceField86; - private DeviceField deviceField87; - private DeviceField deviceField88; - private DeviceField deviceField89; - private DeviceField deviceField9; - private DeviceField deviceField90; - private DeviceField deviceField91; - private DeviceField deviceField92; - private DeviceField deviceField93; - private DeviceField deviceField94; + private DeviceInputs deviceInputs1; + private DeviceOutputs deviceOutputs1; + private DeviceParameters deviceParameters1; private javax.swing.JButton jButton1; 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 jPanel23; - private javax.swing.JPanel jPanel24; - private javax.swing.JPanel jPanel25; - private javax.swing.JPanel jPanel26; - private javax.swing.JPanel jPanel27; - private javax.swing.JPanel jPanel28; - private javax.swing.JPanel jPanel29; private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel30; - private javax.swing.JPanel jPanel31; - private javax.swing.JPanel jPanel32; - private javax.swing.JPanel jPanel33; - private javax.swing.JPanel jPanel34; - private javax.swing.JPanel jPanel35; - private javax.swing.JPanel jPanel36; - private javax.swing.JPanel jPanel37; - private javax.swing.JPanel jPanel38; - private javax.swing.JPanel jPanel39; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel40; - private javax.swing.JPanel jPanel41; - private javax.swing.JPanel jPanel42; - private javax.swing.JPanel jPanel43; - private javax.swing.JPanel jPanel44; - private javax.swing.JPanel jPanel45; - private javax.swing.JPanel jPanel46; private javax.swing.JPanel jPanel47; - private javax.swing.JPanel jPanel48; - private javax.swing.JPanel jPanel49; - private javax.swing.JPanel jPanel5; - private javax.swing.JPanel jPanel50; - private javax.swing.JPanel jPanel51; - private javax.swing.JPanel jPanel52; - private javax.swing.JPanel jPanel53; - private javax.swing.JPanel jPanel54; - private javax.swing.JPanel jPanel55; - private javax.swing.JPanel jPanel6; - private javax.swing.JPanel jPanel7; - private javax.swing.JPanel jPanel8; - private javax.swing.JPanel jPanel9; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; diff --git a/java/jdevices/src/main/java/MARTE2_SIMULINK_TANKSetup.java b/java/jdevices/src/main/java/MARTE2_SIMULINK_TANKSetup.java index bdd721a983..bfaa50d6f1 100644 --- a/java/jdevices/src/main/java/MARTE2_SIMULINK_TANKSetup.java +++ b/java/jdevices/src/main/java/MARTE2_SIMULINK_TANKSetup.java @@ -34,43 +34,26 @@ private void initComponents() { deviceButtons1 = new DeviceButtons(); 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(); - setDeviceProvider("spilds:8100"); + setDeviceProvider("localhost:8100"); setDeviceTitle("MARTe2 Simulink Tank"); setDeviceType("MARTE2_SIMULINK_TANK"); - setHeight(250); + setHeight(200); + setUpdateEvent(""); setWidth(600); getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - jPanel1.setLayout(new java.awt.GridLayout(3, 1)); - - deviceField1.setIdentifier(""); - deviceField1.setLabelString("Timebase: "); - deviceField1.setNumCols(25); - deviceField1.setOffsetNid(3); - jPanel2.add(deviceField1); - - deviceField2.setIdentifier(""); - deviceField2.setLabelString("Timebase Div: "); - deviceField2.setNumCols(4); - deviceField2.setOffsetNid(44); - jPanel2.add(deviceField2); - - jPanel1.add(jPanel2); + jPanel1.setLayout(new java.awt.GridLayout(2, 1)); deviceField3.setIdentifier(""); deviceField3.setLabelString("Input"); deviceField3.setNumCols(25); - deviceField3.setOffsetNid(25); + deviceField3.setOffsetNid(28); jPanel3.add(deviceField3); jPanel1.add(jPanel3); @@ -78,21 +61,15 @@ private void initComponents() { deviceField4.setIdentifier(""); deviceField4.setLabelString("Out Segment len (0 to disable writing): "); deviceField4.setNumCols(4); - deviceField4.setOffsetNid(40); + deviceField4.setOffsetNid(44); jPanel4.add(deviceField4); deviceField5.setIdentifier(""); deviceField5.setLabelString("Out CPUs"); deviceField5.setNumCols(4); - deviceField5.setOffsetNid(34); + deviceField5.setOffsetNid(38); jPanel4.add(deviceField5); - deviceField6.setIdentifier(""); - deviceField6.setLabelString("Stream:"); - deviceField6.setOffsetNid(41); - deviceField6.setTextOnly(true); - jPanel4.add(deviceField6); - jPanel1.add(jPanel4); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); @@ -100,14 +77,10 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; - private DeviceField deviceField1; - private DeviceField deviceField2; private DeviceField deviceField3; private DeviceField deviceField4; private DeviceField deviceField5; - private DeviceField deviceField6; private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; // End of variables declaration//GEN-END:variables diff --git a/java/jdevices/src/main/java/MARTE2_STREAMSetup.java b/java/jdevices/src/main/java/MARTE2_STREAMSetup.java index e484f0bb1c..537a92dcf4 100644 --- a/java/jdevices/src/main/java/MARTE2_STREAMSetup.java +++ b/java/jdevices/src/main/java/MARTE2_STREAMSetup.java @@ -44,87 +44,7 @@ private void initComponents() { deviceField10 = new DeviceField(); deviceButtons1 = new DeviceButtons(); jScrollPane1 = new javax.swing.JScrollPane(); - jPanel1 = new javax.swing.JPanel(); - jPanel3 = new javax.swing.JPanel(); - deviceField2 = new DeviceField(); - deviceChoice1 = new DeviceChoice(); - deviceField15 = new DeviceField(); - deviceField199 = new DeviceField(); - jPanel4 = new javax.swing.JPanel(); - deviceField3 = new DeviceField(); - deviceChoice2 = new DeviceChoice(); - deviceField16 = new DeviceField(); - deviceField200 = new DeviceField(); - jPanel5 = new javax.swing.JPanel(); - deviceField4 = new DeviceField(); - deviceChoice3 = new DeviceChoice(); - deviceField17 = new DeviceField(); - deviceField201 = new DeviceField(); - jPanel6 = new javax.swing.JPanel(); - deviceField5 = new DeviceField(); - deviceChoice4 = new DeviceChoice(); - deviceField18 = new DeviceField(); - deviceField202 = new DeviceField(); - jPanel7 = new javax.swing.JPanel(); - deviceField6 = new DeviceField(); - deviceChoice5 = new DeviceChoice(); - deviceField19 = new DeviceField(); - deviceField203 = new DeviceField(); - jPanel8 = new javax.swing.JPanel(); - deviceField7 = new DeviceField(); - deviceChoice6 = new DeviceChoice(); - deviceField20 = new DeviceField(); - deviceField204 = new DeviceField(); - jPanel9 = new javax.swing.JPanel(); - deviceField8 = new DeviceField(); - deviceChoice7 = new DeviceChoice(); - deviceField21 = new DeviceField(); - deviceField205 = new DeviceField(); - jPanel10 = new javax.swing.JPanel(); - deviceField9 = new DeviceField(); - deviceChoice8 = new DeviceChoice(); - deviceField22 = new DeviceField(); - deviceField206 = new DeviceField(); - jPanel13 = new javax.swing.JPanel(); - deviceField23 = new DeviceField(); - deviceChoice10 = new DeviceChoice(); - deviceField24 = new DeviceField(); - deviceField207 = new DeviceField(); - jPanel14 = new javax.swing.JPanel(); - deviceField25 = new DeviceField(); - deviceChoice11 = new DeviceChoice(); - deviceField26 = new DeviceField(); - deviceField208 = new DeviceField(); - jPanel15 = new javax.swing.JPanel(); - deviceField27 = new DeviceField(); - deviceChoice12 = new DeviceChoice(); - deviceField28 = new DeviceField(); - deviceField209 = new DeviceField(); - jPanel16 = new javax.swing.JPanel(); - deviceField29 = new DeviceField(); - deviceChoice13 = new DeviceChoice(); - deviceField30 = new DeviceField(); - deviceField210 = new DeviceField(); - jPanel17 = new javax.swing.JPanel(); - deviceField31 = new DeviceField(); - deviceChoice14 = new DeviceChoice(); - deviceField32 = new DeviceField(); - deviceField211 = new DeviceField(); - jPanel18 = new javax.swing.JPanel(); - deviceField33 = new DeviceField(); - deviceChoice15 = new DeviceChoice(); - deviceField34 = new DeviceField(); - deviceField212 = new DeviceField(); - jPanel19 = new javax.swing.JPanel(); - deviceField35 = new DeviceField(); - deviceChoice16 = new DeviceChoice(); - deviceField36 = new DeviceField(); - deviceField213 = new DeviceField(); - jPanel20 = new javax.swing.JPanel(); - deviceField37 = new DeviceField(); - deviceChoice17 = new DeviceChoice(); - deviceField38 = new DeviceField(); - deviceField214 = new DeviceField(); + deviceInputs1 = new DeviceInputs(); setDeviceProvider("localhost:8100"); setDeviceTitle("MARTe2 Stream"); @@ -187,489 +107,8 @@ private void initComponents() { getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - jPanel1.setLayout(new java.awt.GridLayout(16, 1)); - - jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 1(Time if TimeStreaming mode)")); - - deviceField2.setIdentifier(""); - deviceField2.setLabelString("Value: "); - deviceField2.setNumCols(35); - deviceField2.setOffsetNid(31); - jPanel3.add(deviceField2); - - deviceChoice1.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice1.setIdentifier(""); - deviceChoice1.setLabelString("Type: "); - deviceChoice1.setOffsetNid(28); - deviceChoice1.setUpdateIdentifier(""); - jPanel3.add(deviceChoice1); - - deviceField15.setIdentifier(""); - deviceField15.setLabelString("Channel: "); - deviceField15.setNumCols(15); - deviceField15.setOffsetNid(36); - deviceField15.setTextOnly(true); - jPanel3.add(deviceField15); - - deviceField199.setIdentifier(""); - deviceField199.setLabelString("Dimensions: "); - deviceField199.setNumCols(4); - deviceField199.setOffsetNid(29); - jPanel3.add(deviceField199); - - jPanel1.add(jPanel3); - - jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 2")); - - deviceField3.setIdentifier(""); - deviceField3.setLabelString("Value: "); - deviceField3.setNumCols(35); - deviceField3.setOffsetNid(41); - jPanel4.add(deviceField3); - - deviceChoice2.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "uint32"}); - deviceChoice2.setIdentifier(""); - deviceChoice2.setLabelString("Type: "); - deviceChoice2.setOffsetNid(38); - deviceChoice2.setUpdateIdentifier(""); - jPanel4.add(deviceChoice2); - - deviceField16.setIdentifier(""); - deviceField16.setLabelString("Channel: "); - deviceField16.setNumCols(15); - deviceField16.setOffsetNid(46); - deviceField16.setTextOnly(true); - jPanel4.add(deviceField16); - - deviceField200.setIdentifier(""); - deviceField200.setLabelString("Dimensions: "); - deviceField200.setNumCols(4); - deviceField200.setOffsetNid(39); - jPanel4.add(deviceField200); - - jPanel1.add(jPanel4); - - jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 3")); - - deviceField4.setIdentifier(""); - deviceField4.setLabelString("Value: "); - deviceField4.setNumCols(35); - deviceField4.setOffsetNid(51); - jPanel5.add(deviceField4); - - deviceChoice3.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice3.setIdentifier(""); - deviceChoice3.setLabelString("Type: "); - deviceChoice3.setOffsetNid(48); - deviceChoice3.setUpdateIdentifier(""); - jPanel5.add(deviceChoice3); - - deviceField17.setIdentifier(""); - deviceField17.setLabelString("Channel: "); - deviceField17.setNumCols(15); - deviceField17.setOffsetNid(56); - deviceField17.setTextOnly(true); - jPanel5.add(deviceField17); - - deviceField201.setIdentifier(""); - deviceField201.setLabelString("Dimensions: "); - deviceField201.setNumCols(4); - deviceField201.setOffsetNid(49); - jPanel5.add(deviceField201); - - jPanel1.add(jPanel5); - - jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 4")); - - deviceField5.setIdentifier(""); - deviceField5.setLabelString("Value: "); - deviceField5.setNumCols(35); - deviceField5.setOffsetNid(61); - jPanel6.add(deviceField5); - - deviceChoice4.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice4.setIdentifier(""); - deviceChoice4.setLabelString("Type: "); - deviceChoice4.setOffsetNid(58); - deviceChoice4.setUpdateIdentifier(""); - jPanel6.add(deviceChoice4); - - deviceField18.setIdentifier(""); - deviceField18.setLabelString("Channel: "); - deviceField18.setNumCols(15); - deviceField18.setOffsetNid(66); - deviceField18.setTextOnly(true); - jPanel6.add(deviceField18); - - deviceField202.setIdentifier(""); - deviceField202.setLabelString("Dimensions: "); - deviceField202.setNumCols(4); - deviceField202.setOffsetNid(59); - jPanel6.add(deviceField202); - - jPanel1.add(jPanel6); - - jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 5")); - - deviceField6.setIdentifier(""); - deviceField6.setLabelString("Value: "); - deviceField6.setNumCols(35); - deviceField6.setOffsetNid(71); - jPanel7.add(deviceField6); - - deviceChoice5.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice5.setIdentifier(""); - deviceChoice5.setLabelString("Type: "); - deviceChoice5.setOffsetNid(68); - deviceChoice5.setUpdateIdentifier(""); - jPanel7.add(deviceChoice5); - - deviceField19.setIdentifier(""); - deviceField19.setLabelString("Channel: "); - deviceField19.setNumCols(15); - deviceField19.setOffsetNid(76); - deviceField19.setTextOnly(true); - jPanel7.add(deviceField19); - - deviceField203.setIdentifier(""); - deviceField203.setLabelString("Dimensions: "); - deviceField203.setNumCols(4); - deviceField203.setOffsetNid(69); - jPanel7.add(deviceField203); - - jPanel1.add(jPanel7); - - jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 6")); - - deviceField7.setIdentifier(""); - deviceField7.setLabelString("Value: "); - deviceField7.setNumCols(35); - deviceField7.setOffsetNid(81); - jPanel8.add(deviceField7); - - deviceChoice6.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice6.setIdentifier(""); - deviceChoice6.setLabelString("Type: "); - deviceChoice6.setOffsetNid(68); - deviceChoice6.setUpdateIdentifier(""); - jPanel8.add(deviceChoice6); - - deviceField20.setIdentifier(""); - deviceField20.setLabelString("Channel: "); - deviceField20.setNumCols(15); - deviceField20.setOffsetNid(86); - deviceField20.setTextOnly(true); - jPanel8.add(deviceField20); - - deviceField204.setIdentifier(""); - deviceField204.setLabelString("Dimensions: "); - deviceField204.setNumCols(4); - deviceField204.setOffsetNid(79); - jPanel8.add(deviceField204); - - jPanel1.add(jPanel8); - - jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 7")); - - deviceField8.setIdentifier(""); - deviceField8.setLabelString("Value: "); - deviceField8.setNumCols(35); - deviceField8.setOffsetNid(91); - jPanel9.add(deviceField8); - - deviceChoice7.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice7.setIdentifier(""); - deviceChoice7.setLabelString("Type: "); - deviceChoice7.setOffsetNid(88); - deviceChoice7.setUpdateIdentifier(""); - jPanel9.add(deviceChoice7); - - deviceField21.setIdentifier(""); - deviceField21.setLabelString("Channel: "); - deviceField21.setNumCols(15); - deviceField21.setOffsetNid(96); - deviceField21.setTextOnly(true); - jPanel9.add(deviceField21); - - deviceField205.setIdentifier(""); - deviceField205.setLabelString("Dimensions: "); - deviceField205.setNumCols(4); - deviceField205.setOffsetNid(89); - jPanel9.add(deviceField205); - - jPanel1.add(jPanel9); - - jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 8")); - - deviceField9.setIdentifier(""); - deviceField9.setLabelString("Value: "); - deviceField9.setNumCols(35); - deviceField9.setOffsetNid(101); - jPanel10.add(deviceField9); - - deviceChoice8.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice8.setIdentifier(""); - deviceChoice8.setLabelString("Type: "); - deviceChoice8.setOffsetNid(98); - deviceChoice8.setUpdateIdentifier(""); - jPanel10.add(deviceChoice8); - - deviceField22.setIdentifier(""); - deviceField22.setLabelString("Channel: "); - deviceField22.setNumCols(15); - deviceField22.setOffsetNid(106); - deviceField22.setTextOnly(true); - jPanel10.add(deviceField22); - - deviceField206.setIdentifier(""); - deviceField206.setLabelString("Dimensions: "); - deviceField206.setNumCols(4); - deviceField206.setOffsetNid(99); - jPanel10.add(deviceField206); - - jPanel1.add(jPanel10); - - jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 9")); - - deviceField23.setIdentifier(""); - deviceField23.setLabelString("Value: "); - deviceField23.setNumCols(45); - deviceField23.setOffsetNid(111); - jPanel13.add(deviceField23); - - deviceChoice10.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice10.setIdentifier(""); - deviceChoice10.setLabelString("Type: "); - deviceChoice10.setOffsetNid(108); - deviceChoice10.setUpdateIdentifier(""); - jPanel13.add(deviceChoice10); - - deviceField24.setIdentifier(""); - deviceField24.setLabelString("Channel: "); - deviceField24.setNumCols(15); - deviceField24.setOffsetNid(116); - deviceField24.setTextOnly(true); - jPanel13.add(deviceField24); - - deviceField207.setIdentifier(""); - deviceField207.setLabelString("Dimensions: "); - deviceField207.setNumCols(4); - deviceField207.setOffsetNid(109); - jPanel13.add(deviceField207); - - jPanel1.add(jPanel13); - - jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 10")); - - deviceField25.setIdentifier(""); - deviceField25.setLabelString("Value: "); - deviceField25.setNumCols(45); - deviceField25.setOffsetNid(121); - jPanel14.add(deviceField25); - - deviceChoice11.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice11.setIdentifier(""); - deviceChoice11.setLabelString("Type: "); - deviceChoice11.setOffsetNid(118); - deviceChoice11.setUpdateIdentifier(""); - jPanel14.add(deviceChoice11); - - deviceField26.setIdentifier(""); - deviceField26.setLabelString("Channel: "); - deviceField26.setNumCols(15); - deviceField26.setOffsetNid(126); - deviceField26.setTextOnly(true); - jPanel14.add(deviceField26); - - deviceField208.setIdentifier(""); - deviceField208.setLabelString("Dimensions: "); - deviceField208.setNumCols(4); - deviceField208.setOffsetNid(119); - jPanel14.add(deviceField208); - - jPanel1.add(jPanel14); - - jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 11")); - - deviceField27.setIdentifier(""); - deviceField27.setLabelString("Value: "); - deviceField27.setNumCols(45); - deviceField27.setOffsetNid(131); - jPanel15.add(deviceField27); - - deviceChoice12.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice12.setIdentifier(""); - deviceChoice12.setLabelString("Type: "); - deviceChoice12.setOffsetNid(128); - deviceChoice12.setUpdateIdentifier(""); - jPanel15.add(deviceChoice12); - - deviceField28.setIdentifier(""); - deviceField28.setLabelString("Channel: "); - deviceField28.setNumCols(15); - deviceField28.setOffsetNid(136); - deviceField28.setTextOnly(true); - jPanel15.add(deviceField28); - - deviceField209.setIdentifier(""); - deviceField209.setLabelString("Dimensions: "); - deviceField209.setNumCols(4); - deviceField209.setOffsetNid(129); - jPanel15.add(deviceField209); - - jPanel1.add(jPanel15); - - jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 12")); - - deviceField29.setIdentifier(""); - deviceField29.setLabelString("Value: "); - deviceField29.setNumCols(45); - deviceField29.setOffsetNid(141); - jPanel16.add(deviceField29); - - deviceChoice13.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice13.setIdentifier(""); - deviceChoice13.setLabelString("Type: "); - deviceChoice13.setOffsetNid(138); - deviceChoice13.setUpdateIdentifier(""); - jPanel16.add(deviceChoice13); - - deviceField30.setIdentifier(""); - deviceField30.setLabelString("Channel: "); - deviceField30.setNumCols(15); - deviceField30.setOffsetNid(146); - deviceField30.setTextOnly(true); - jPanel16.add(deviceField30); - - deviceField210.setIdentifier(""); - deviceField210.setLabelString("Dimensions: "); - deviceField210.setNumCols(4); - deviceField210.setOffsetNid(139); - jPanel16.add(deviceField210); - - jPanel1.add(jPanel16); - - jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 13")); - - deviceField31.setIdentifier(""); - deviceField31.setLabelString("Value: "); - deviceField31.setNumCols(45); - deviceField31.setOffsetNid(151); - jPanel17.add(deviceField31); - - deviceChoice14.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice14.setIdentifier(""); - deviceChoice14.setLabelString("Type: "); - deviceChoice14.setOffsetNid(148); - deviceChoice14.setUpdateIdentifier(""); - jPanel17.add(deviceChoice14); - - deviceField32.setIdentifier(""); - deviceField32.setLabelString("Channel: "); - deviceField32.setNumCols(15); - deviceField32.setOffsetNid(156); - deviceField32.setTextOnly(true); - jPanel17.add(deviceField32); - - deviceField211.setIdentifier(""); - deviceField211.setLabelString("Dimensions: "); - deviceField211.setNumCols(4); - deviceField211.setOffsetNid(149); - jPanel17.add(deviceField211); - - jPanel1.add(jPanel17); - - jPanel18.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 14")); - - deviceField33.setIdentifier(""); - deviceField33.setLabelString("Value: "); - deviceField33.setNumCols(45); - deviceField33.setOffsetNid(161); - jPanel18.add(deviceField33); - - deviceChoice15.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice15.setIdentifier(""); - deviceChoice15.setLabelString("Type: "); - deviceChoice15.setOffsetNid(158); - deviceChoice15.setUpdateIdentifier(""); - jPanel18.add(deviceChoice15); - - deviceField34.setIdentifier(""); - deviceField34.setLabelString("Channel: "); - deviceField34.setNumCols(15); - deviceField34.setOffsetNid(166); - deviceField34.setTextOnly(true); - jPanel18.add(deviceField34); - - deviceField212.setIdentifier(""); - deviceField212.setLabelString("Dimensions: "); - deviceField212.setNumCols(4); - deviceField212.setOffsetNid(159); - jPanel18.add(deviceField212); - - jPanel1.add(jPanel18); - - jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 15")); - - deviceField35.setIdentifier(""); - deviceField35.setLabelString("Value: "); - deviceField35.setNumCols(45); - deviceField35.setOffsetNid(171); - jPanel19.add(deviceField35); - - deviceChoice16.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice16.setIdentifier(""); - deviceChoice16.setLabelString("Type: "); - deviceChoice16.setOffsetNid(168); - deviceChoice16.setUpdateIdentifier(""); - jPanel19.add(deviceChoice16); - - deviceField36.setIdentifier(""); - deviceField36.setLabelString("Channel: "); - deviceField36.setNumCols(15); - deviceField36.setOffsetNid(176); - deviceField36.setTextOnly(true); - jPanel19.add(deviceField36); - - deviceField213.setIdentifier(""); - deviceField213.setLabelString("Dimensions: "); - deviceField213.setNumCols(4); - deviceField213.setOffsetNid(169); - jPanel19.add(deviceField213); - - jPanel1.add(jPanel19); - - jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 16")); - - deviceField37.setIdentifier(""); - deviceField37.setLabelString("Value: "); - deviceField37.setNumCols(45); - deviceField37.setOffsetNid(181); - jPanel20.add(deviceField37); - - deviceChoice17.setChoiceItems(new String[] {"float32", "float64", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64"}); - deviceChoice17.setIdentifier(""); - deviceChoice17.setLabelString("Type: "); - deviceChoice17.setOffsetNid(178); - deviceChoice17.setUpdateIdentifier(""); - jPanel20.add(deviceChoice17); - - deviceField38.setIdentifier(""); - deviceField38.setLabelString("Channel: "); - deviceField38.setNumCols(15); - deviceField38.setOffsetNid(186); - deviceField38.setTextOnly(true); - jPanel20.add(deviceField38); - - deviceField214.setIdentifier(""); - deviceField214.setLabelString("Dimensions: "); - deviceField214.setNumCols(4); - deviceField214.setOffsetNid(179); - jPanel20.add(deviceField214); - - jPanel1.add(jPanel20); - - jScrollPane1.setViewportView(jPanel1); + deviceInputs1.setOffsetNid(26); + jScrollPane1.setViewportView(deviceInputs1); getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER); @@ -678,22 +117,6 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; - private DeviceChoice deviceChoice1; - private DeviceChoice deviceChoice10; - private DeviceChoice deviceChoice11; - private DeviceChoice deviceChoice12; - private DeviceChoice deviceChoice13; - private DeviceChoice deviceChoice14; - private DeviceChoice deviceChoice15; - private DeviceChoice deviceChoice16; - private DeviceChoice deviceChoice17; - private DeviceChoice deviceChoice2; - private DeviceChoice deviceChoice3; - private DeviceChoice deviceChoice4; - private DeviceChoice deviceChoice5; - private DeviceChoice deviceChoice6; - private DeviceChoice deviceChoice7; - private DeviceChoice deviceChoice8; private DeviceChoice deviceChoice9; private DeviceField deviceField1; private DeviceField deviceField10; @@ -701,74 +124,10 @@ private void initComponents() { 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 deviceField199; - private DeviceField deviceField2; - private DeviceField deviceField20; - private DeviceField deviceField200; - private DeviceField deviceField201; - private DeviceField deviceField202; - private DeviceField deviceField203; - private DeviceField deviceField204; - private DeviceField deviceField205; - private DeviceField deviceField206; - private DeviceField deviceField207; - private DeviceField deviceField208; - private DeviceField deviceField209; - private DeviceField deviceField21; - private DeviceField deviceField210; - private DeviceField deviceField211; - private DeviceField deviceField212; - private DeviceField deviceField213; - private DeviceField deviceField214; - private DeviceField deviceField22; - private DeviceField deviceField23; - private DeviceField deviceField24; - private DeviceField deviceField25; - private DeviceField deviceField26; - private DeviceField deviceField27; - private DeviceField deviceField28; - private DeviceField deviceField29; - private DeviceField deviceField3; - private DeviceField deviceField30; - private DeviceField deviceField31; - private DeviceField deviceField32; - private DeviceField deviceField33; - private DeviceField deviceField34; - private DeviceField deviceField35; - private DeviceField deviceField36; - private DeviceField deviceField37; - private DeviceField deviceField38; - 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 DeviceInputs deviceInputs1; 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 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.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables } diff --git a/java/jdevices/src/main/java/MARTE2_STREAM_INSetup.java b/java/jdevices/src/main/java/MARTE2_STREAM_INSetup.java index 6b971ae3f5..66670cc2cf 100644 --- a/java/jdevices/src/main/java/MARTE2_STREAM_INSetup.java +++ b/java/jdevices/src/main/java/MARTE2_STREAM_INSetup.java @@ -44,29 +44,9 @@ private void initComponents() { deviceField5 = new DeviceField(); jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); - jPanel5 = new javax.swing.JPanel(); - jPanel6 = new javax.swing.JPanel(); - deviceField6 = new DeviceField(); - deviceChoice1 = new DeviceChoice(); - deviceField7 = new DeviceField(); - deviceField8 = new DeviceField(); - jPanel7 = new javax.swing.JPanel(); - deviceField9 = new DeviceField(); - deviceChoice2 = new DeviceChoice(); - deviceField10 = new DeviceField(); - deviceField11 = new DeviceField(); - jPanel8 = new javax.swing.JPanel(); - deviceField12 = new DeviceField(); - deviceChoice3 = new DeviceChoice(); - deviceField13 = new DeviceField(); - deviceField14 = new DeviceField(); - jPanel9 = new javax.swing.JPanel(); - deviceField15 = new DeviceField(); - deviceChoice4 = new DeviceChoice(); - deviceField16 = new DeviceField(); - deviceField17 = new DeviceField(); + deviceOutputs1 = new DeviceOutputs(); - setDeviceProvider("spilds:8100"); + setDeviceProvider("localhost:8100"); setDeviceTitle("MARTe2 Input Stream"); setDeviceType("MARTE2_STREAM_IN"); setHeight(400); @@ -112,117 +92,8 @@ private void initComponents() { jPanel1.setLayout(new java.awt.BorderLayout()); - jPanel5.setLayout(new java.awt.GridLayout(4, 1)); - - deviceField6.setIdentifier(""); - deviceField6.setLabelString("Dimensions:"); - deviceField6.setOffsetNid(31); - jPanel6.add(deviceField6); - - deviceChoice1.setChoiceItems(new String[] {"int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice1.setIdentifier(""); - deviceChoice1.setLabelString("Type:"); - deviceChoice1.setOffsetNid(29); - deviceChoice1.setUpdateIdentifier(""); - jPanel6.add(deviceChoice1); - - deviceField7.setIdentifier(""); - deviceField7.setLabelString("Channel: "); - deviceField7.setNumCols(12); - deviceField7.setOffsetNid(38); - deviceField7.setTextOnly(true); - jPanel6.add(deviceField7); - - deviceField8.setIdentifier(""); - deviceField8.setLabelString("Seg. len: "); - deviceField8.setNumCols(4); - deviceField8.setOffsetNid(32); - jPanel6.add(deviceField8); - - jPanel5.add(jPanel6); - - deviceField9.setIdentifier(""); - deviceField9.setLabelString("Dimensions:"); - deviceField9.setOffsetNid(43); - jPanel7.add(deviceField9); - - deviceChoice2.setChoiceItems(new String[] {"int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice2.setIdentifier(""); - deviceChoice2.setLabelString("Type:"); - deviceChoice2.setOffsetNid(41); - deviceChoice2.setUpdateIdentifier(""); - jPanel7.add(deviceChoice2); - - deviceField10.setIdentifier(""); - deviceField10.setLabelString("Channel: "); - deviceField10.setNumCols(12); - deviceField10.setOffsetNid(50); - deviceField10.setTextOnly(true); - jPanel7.add(deviceField10); - - deviceField11.setIdentifier(""); - deviceField11.setLabelString("Seg. len: "); - deviceField11.setNumCols(4); - deviceField11.setOffsetNid(44); - jPanel7.add(deviceField11); - - jPanel5.add(jPanel7); - - deviceField12.setIdentifier(""); - deviceField12.setLabelString("Dimensions:"); - deviceField12.setOffsetNid(55); - jPanel8.add(deviceField12); - - deviceChoice3.setChoiceItems(new String[] {"int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice3.setIdentifier(""); - deviceChoice3.setLabelString("Type:"); - deviceChoice3.setOffsetNid(53); - deviceChoice3.setUpdateIdentifier(""); - jPanel8.add(deviceChoice3); - - deviceField13.setIdentifier(""); - deviceField13.setLabelString("Channel: "); - deviceField13.setNumCols(12); - deviceField13.setOffsetNid(62); - deviceField13.setTextOnly(true); - jPanel8.add(deviceField13); - - deviceField14.setIdentifier(""); - deviceField14.setLabelString("Seg. len: "); - deviceField14.setNumCols(4); - deviceField14.setOffsetNid(56); - jPanel8.add(deviceField14); - - jPanel5.add(jPanel8); - - deviceField15.setIdentifier(""); - deviceField15.setLabelString("Dimensions:"); - deviceField15.setOffsetNid(67); - jPanel9.add(deviceField15); - - deviceChoice4.setChoiceItems(new String[] {"int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice4.setIdentifier(""); - deviceChoice4.setLabelString("Type:"); - deviceChoice4.setOffsetNid(65); - deviceChoice4.setUpdateIdentifier(""); - jPanel9.add(deviceChoice4); - - deviceField16.setIdentifier(""); - deviceField16.setLabelString("Channel: "); - deviceField16.setNumCols(12); - deviceField16.setOffsetNid(74); - deviceField16.setTextOnly(true); - jPanel9.add(deviceField16); - - deviceField17.setIdentifier(""); - deviceField17.setLabelString("Seg. len: "); - deviceField17.setNumCols(4); - deviceField17.setOffsetNid(68); - jPanel9.add(deviceField17); - - jPanel5.add(jPanel9); - - jScrollPane1.setViewportView(jPanel5); + deviceOutputs1.setOffsetNid(20); + jScrollPane1.setViewportView(deviceOutputs1); jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER); @@ -233,37 +104,17 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; - private DeviceChoice deviceChoice1; - private DeviceChoice deviceChoice2; - private DeviceChoice deviceChoice3; - private DeviceChoice deviceChoice4; 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 deviceField2; private DeviceField deviceField3; private DeviceField deviceField4; private DeviceField deviceField5; - private DeviceField deviceField6; - private DeviceField deviceField7; - private DeviceField deviceField8; - private DeviceField deviceField9; + private DeviceOutputs deviceOutputs1; private DeviceSetup deviceSetup1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; 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.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables } diff --git a/java/jdevices/src/main/java/MARTE2_STREAM_IN_ASetup.java b/java/jdevices/src/main/java/MARTE2_STREAM_IN_ASetup.java index d1b6dcfc68..673f03848c 100644 --- a/java/jdevices/src/main/java/MARTE2_STREAM_IN_ASetup.java +++ b/java/jdevices/src/main/java/MARTE2_STREAM_IN_ASetup.java @@ -39,47 +39,7 @@ private void initComponents() { deviceField30 = new DeviceField(); deviceField31 = new DeviceField(); jScrollPane1 = new javax.swing.JScrollPane(); - jPanel1 = new javax.swing.JPanel(); - jPanel5 = new javax.swing.JPanel(); - deviceField6 = new DeviceField(); - deviceChoice1 = new DeviceChoice(); - deviceField7 = new DeviceField(); - deviceField8 = new DeviceField(); - jPanel6 = new javax.swing.JPanel(); - deviceField9 = new DeviceField(); - deviceChoice2 = new DeviceChoice(); - deviceField10 = new DeviceField(); - deviceField11 = new DeviceField(); - jPanel7 = new javax.swing.JPanel(); - deviceField12 = new DeviceField(); - deviceChoice3 = new DeviceChoice(); - deviceField13 = new DeviceField(); - deviceField14 = new DeviceField(); - jPanel8 = new javax.swing.JPanel(); - deviceField15 = new DeviceField(); - deviceChoice4 = new DeviceChoice(); - deviceField16 = new DeviceField(); - deviceField17 = new DeviceField(); - jPanel9 = new javax.swing.JPanel(); - deviceField18 = new DeviceField(); - deviceChoice5 = new DeviceChoice(); - deviceField19 = new DeviceField(); - deviceField20 = new DeviceField(); - jPanel10 = new javax.swing.JPanel(); - deviceField21 = new DeviceField(); - deviceChoice6 = new DeviceChoice(); - deviceField22 = new DeviceField(); - deviceField23 = new DeviceField(); - jPanel11 = new javax.swing.JPanel(); - deviceField24 = new DeviceField(); - deviceChoice7 = new DeviceChoice(); - deviceField25 = new DeviceField(); - deviceField26 = new DeviceField(); - jPanel12 = new javax.swing.JPanel(); - deviceField27 = new DeviceField(); - deviceChoice8 = new DeviceChoice(); - deviceField28 = new DeviceField(); - deviceField29 = new DeviceField(); + deviceOutputs1 = new DeviceOutputs(); setDeviceProvider("localhost:8100"); setDeviceTitle("Async Stream In"); @@ -138,233 +98,8 @@ private void initComponents() { getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_START); - jPanel1.setLayout(new java.awt.GridLayout(8, 1)); - - deviceField6.setIdentifier(""); - deviceField6.setLabelString("Dimensions: "); - deviceField6.setNumCols(8); - deviceField6.setOffsetNid(28); - jPanel5.add(deviceField6); - - deviceChoice1.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice1.setIdentifier(""); - deviceChoice1.setLabelString("Type: "); - deviceChoice1.setOffsetNid(26); - deviceChoice1.setUpdateIdentifier(""); - jPanel5.add(deviceChoice1); - - deviceField7.setIdentifier(""); - deviceField7.setLabelString("Channel: "); - deviceField7.setNumCols(15); - deviceField7.setOffsetNid(35); - deviceField7.setTextOnly(true); - jPanel5.add(deviceField7); - - deviceField8.setIdentifier(""); - deviceField8.setLabelString("Seg. Len: "); - deviceField8.setNumCols(4); - deviceField8.setOffsetNid(29); - jPanel5.add(deviceField8); - - jPanel1.add(jPanel5); - - deviceField9.setIdentifier(""); - deviceField9.setLabelString("Dimensions: "); - deviceField9.setNumCols(8); - deviceField9.setOffsetNid(40); - jPanel6.add(deviceField9); - - deviceChoice2.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice2.setIdentifier(""); - deviceChoice2.setLabelString("Type: "); - deviceChoice2.setOffsetNid(38); - deviceChoice2.setUpdateIdentifier(""); - jPanel6.add(deviceChoice2); - - deviceField10.setIdentifier(""); - deviceField10.setLabelString("Channel: "); - deviceField10.setNumCols(15); - deviceField10.setOffsetNid(47); - deviceField10.setTextOnly(true); - jPanel6.add(deviceField10); - - deviceField11.setIdentifier(""); - deviceField11.setLabelString("Seg. Len: "); - deviceField11.setNumCols(4); - deviceField11.setOffsetNid(41); - jPanel6.add(deviceField11); - - jPanel1.add(jPanel6); - - deviceField12.setIdentifier(""); - deviceField12.setLabelString("Dimensions: "); - deviceField12.setNumCols(8); - deviceField12.setOffsetNid(52); - jPanel7.add(deviceField12); - - deviceChoice3.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice3.setIdentifier(""); - deviceChoice3.setLabelString("Type: "); - deviceChoice3.setOffsetNid(50); - deviceChoice3.setUpdateIdentifier(""); - jPanel7.add(deviceChoice3); - - deviceField13.setIdentifier(""); - deviceField13.setLabelString("Channel: "); - deviceField13.setNumCols(15); - deviceField13.setOffsetNid(59); - deviceField13.setTextOnly(true); - jPanel7.add(deviceField13); - - deviceField14.setIdentifier(""); - deviceField14.setLabelString("Seg. Len: "); - deviceField14.setNumCols(4); - deviceField14.setOffsetNid(53); - jPanel7.add(deviceField14); - - jPanel1.add(jPanel7); - - deviceField15.setIdentifier(""); - deviceField15.setLabelString("Dimensions: "); - deviceField15.setNumCols(8); - deviceField15.setOffsetNid(64); - jPanel8.add(deviceField15); - - deviceChoice4.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice4.setIdentifier(""); - deviceChoice4.setLabelString("Type: "); - deviceChoice4.setOffsetNid(62); - deviceChoice4.setUpdateIdentifier(""); - jPanel8.add(deviceChoice4); - - deviceField16.setIdentifier(""); - deviceField16.setLabelString("Channel: "); - deviceField16.setNumCols(15); - deviceField16.setOffsetNid(71); - deviceField16.setTextOnly(true); - jPanel8.add(deviceField16); - - deviceField17.setIdentifier(""); - deviceField17.setLabelString("Seg. Len: "); - deviceField17.setNumCols(4); - deviceField17.setOffsetNid(65); - jPanel8.add(deviceField17); - - jPanel1.add(jPanel8); - - deviceField18.setIdentifier(""); - deviceField18.setLabelString("Dimensions: "); - deviceField18.setNumCols(8); - deviceField18.setOffsetNid(76); - jPanel9.add(deviceField18); - - deviceChoice5.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice5.setIdentifier(""); - deviceChoice5.setLabelString("Type: "); - deviceChoice5.setOffsetNid(74); - deviceChoice5.setUpdateIdentifier(""); - jPanel9.add(deviceChoice5); - - deviceField19.setIdentifier(""); - deviceField19.setLabelString("Channel: "); - deviceField19.setNumCols(15); - deviceField19.setOffsetNid(83); - deviceField19.setTextOnly(true); - jPanel9.add(deviceField19); - - deviceField20.setIdentifier(""); - deviceField20.setLabelString("Seg. Len: "); - deviceField20.setNumCols(4); - deviceField20.setOffsetNid(77); - jPanel9.add(deviceField20); - - jPanel1.add(jPanel9); - - deviceField21.setIdentifier(""); - deviceField21.setLabelString("Dimensions: "); - deviceField21.setNumCols(8); - deviceField21.setOffsetNid(88); - jPanel10.add(deviceField21); - - deviceChoice6.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice6.setIdentifier(""); - deviceChoice6.setLabelString("Type: "); - deviceChoice6.setOffsetNid(86); - deviceChoice6.setUpdateIdentifier(""); - jPanel10.add(deviceChoice6); - - deviceField22.setIdentifier(""); - deviceField22.setLabelString("Channel: "); - deviceField22.setNumCols(15); - deviceField22.setOffsetNid(95); - deviceField22.setTextOnly(true); - jPanel10.add(deviceField22); - - deviceField23.setIdentifier(""); - deviceField23.setLabelString("Seg. Len: "); - deviceField23.setNumCols(4); - deviceField23.setOffsetNid(89); - jPanel10.add(deviceField23); - - jPanel1.add(jPanel10); - - deviceField24.setIdentifier(""); - deviceField24.setLabelString("Dimensions: "); - deviceField24.setNumCols(8); - deviceField24.setOffsetNid(100); - jPanel11.add(deviceField24); - - deviceChoice7.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice7.setIdentifier(""); - deviceChoice7.setLabelString("Type: "); - deviceChoice7.setOffsetNid(98); - deviceChoice7.setUpdateIdentifier(""); - jPanel11.add(deviceChoice7); - - deviceField25.setIdentifier(""); - deviceField25.setLabelString("Channel: "); - deviceField25.setNumCols(15); - deviceField25.setOffsetNid(107); - deviceField25.setTextOnly(true); - jPanel11.add(deviceField25); - - deviceField26.setIdentifier(""); - deviceField26.setLabelString("Seg. Len: "); - deviceField26.setNumCols(4); - deviceField26.setOffsetNid(101); - jPanel11.add(deviceField26); - - jPanel1.add(jPanel11); - - deviceField27.setIdentifier(""); - deviceField27.setLabelString("Dimensions: "); - deviceField27.setNumCols(8); - deviceField27.setOffsetNid(112); - jPanel12.add(deviceField27); - - deviceChoice8.setChoiceItems(new String[] {"int8", "uint8", "int16", "uint16", "int32", "uint32", "float32", "float64"}); - deviceChoice8.setIdentifier(""); - deviceChoice8.setLabelString("Type: "); - deviceChoice8.setOffsetNid(110); - deviceChoice8.setUpdateIdentifier(""); - jPanel12.add(deviceChoice8); - - deviceField28.setIdentifier(""); - deviceField28.setLabelString("Channel: "); - deviceField28.setNumCols(15); - deviceField28.setOffsetNid(119); - deviceField28.setTextOnly(true); - jPanel12.add(deviceField28); - - deviceField29.setIdentifier(""); - deviceField29.setLabelString("Seg. Len: "); - deviceField29.setNumCols(4); - deviceField29.setOffsetNid(113); - jPanel12.add(deviceField29); - - jPanel1.add(jPanel12); - - jScrollPane1.setViewportView(jPanel1); + deviceOutputs1.setOffsetNid(17); + jScrollPane1.setViewportView(deviceOutputs1); getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER); }// //GEN-END:initComponents @@ -372,58 +107,18 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables private DeviceButtons deviceButtons1; - private DeviceChoice deviceChoice1; - private DeviceChoice deviceChoice2; - private DeviceChoice deviceChoice3; - private DeviceChoice deviceChoice4; - private DeviceChoice deviceChoice5; - private DeviceChoice deviceChoice6; - private DeviceChoice deviceChoice7; - private DeviceChoice deviceChoice8; 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 deviceField27; - private DeviceField deviceField28; - private DeviceField deviceField29; private DeviceField deviceField3; private DeviceField deviceField30; private DeviceField deviceField31; 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 DeviceOutputs deviceOutputs1; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel2; 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.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables } diff --git a/java/jdevices/src/main/java/MARTE2_SUPERVISORSetup.java b/java/jdevices/src/main/java/MARTE2_SUPERVISORSetup.java index 6c19a433c4..01e237f599 100644 --- a/java/jdevices/src/main/java/MARTE2_SUPERVISORSetup.java +++ b/java/jdevices/src/main/java/MARTE2_SUPERVISORSetup.java @@ -31,1322 +31,1395 @@ public MARTE2_SUPERVISORSetup() */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents - private void initComponents() - { - deviceButtons1 = new DeviceButtons(); - jPanel1 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - jPanel3 = new javax.swing.JPanel(); - deviceField1 = new DeviceField(); - jButton1 = new javax.swing.JButton(); - jPanel4 = new javax.swing.JPanel(); - deviceField2 = new DeviceField(); - deviceField3 = new DeviceField(); - deviceDispatch1 = new DeviceDispatch(); - jTabbedPane1 = new javax.swing.JTabbedPane(); - jPanel5 = new javax.swing.JPanel(); - jPanel6 = new javax.swing.JPanel(); - deviceField4 = new DeviceField(); - deviceField5 = new DeviceField(); - jTabbedPane2 = new javax.swing.JTabbedPane(); - jPanel7 = new javax.swing.JPanel(); - jPanel8 = new javax.swing.JPanel(); - deviceField6 = new DeviceField(); - deviceField7 = new DeviceField(); - deviceField108 = new DeviceField(); - deviceField109 = new DeviceField(); - jPanel9 = new javax.swing.JPanel(); - deviceField8 = new DeviceField(); - jPanel10 = new javax.swing.JPanel(); - jPanel11 = new javax.swing.JPanel(); - deviceField9 = new DeviceField(); - deviceField10 = new DeviceField(); - deviceField110 = new DeviceField(); - deviceField111 = new DeviceField(); - jPanel12 = new javax.swing.JPanel(); - deviceField11 = new DeviceField(); - jPanel13 = new javax.swing.JPanel(); - jPanel14 = new javax.swing.JPanel(); - deviceField12 = new DeviceField(); - deviceField13 = new DeviceField(); - deviceField112 = new DeviceField(); - deviceField113 = new DeviceField(); - jPanel15 = new javax.swing.JPanel(); - deviceField14 = new DeviceField(); - jPanel16 = new javax.swing.JPanel(); - jPanel17 = new javax.swing.JPanel(); - deviceField15 = new DeviceField(); - deviceField16 = new DeviceField(); - deviceField114 = new DeviceField(); - deviceField115 = new DeviceField(); - jPanel18 = new javax.swing.JPanel(); - deviceField17 = new DeviceField(); - jPanel19 = new javax.swing.JPanel(); - jPanel20 = new javax.swing.JPanel(); - deviceField18 = new DeviceField(); - deviceField19 = new DeviceField(); - deviceField116 = new DeviceField(); - deviceField117 = new DeviceField(); - jPanel21 = new javax.swing.JPanel(); - deviceField20 = new DeviceField(); - jPanel22 = new javax.swing.JPanel(); - jPanel23 = new javax.swing.JPanel(); - deviceField21 = new DeviceField(); - deviceField22 = new DeviceField(); - deviceField118 = new DeviceField(); - deviceField119 = new DeviceField(); - jPanel24 = new javax.swing.JPanel(); - deviceField23 = new DeviceField(); - jPanel25 = new javax.swing.JPanel(); - jPanel26 = new javax.swing.JPanel(); - deviceField24 = new DeviceField(); - deviceField25 = new DeviceField(); - deviceField120 = new DeviceField(); - deviceField121 = new DeviceField(); - jPanel27 = new javax.swing.JPanel(); - deviceField26 = new DeviceField(); - jPanel28 = new javax.swing.JPanel(); - jPanel29 = new javax.swing.JPanel(); - deviceField27 = new DeviceField(); - deviceField28 = new DeviceField(); - deviceField122 = new DeviceField(); - deviceField123 = new DeviceField(); - jPanel30 = new javax.swing.JPanel(); - deviceField29 = new DeviceField(); - jPanel31 = new javax.swing.JPanel(); - jPanel32 = new javax.swing.JPanel(); - deviceField30 = new DeviceField(); - deviceField31 = new DeviceField(); - jTabbedPane3 = new javax.swing.JTabbedPane(); - jPanel33 = new javax.swing.JPanel(); - jPanel34 = new javax.swing.JPanel(); - deviceField32 = new DeviceField(); - deviceField33 = new DeviceField(); - deviceField124 = new DeviceField(); - deviceField125 = new DeviceField(); - jPanel35 = new javax.swing.JPanel(); - deviceField34 = new DeviceField(); - jPanel36 = new javax.swing.JPanel(); - jPanel37 = new javax.swing.JPanel(); - deviceField35 = new DeviceField(); - deviceField36 = new DeviceField(); - deviceField126 = new DeviceField(); - deviceField127 = new DeviceField(); - jPanel38 = new javax.swing.JPanel(); - deviceField37 = new DeviceField(); - jPanel39 = new javax.swing.JPanel(); - jPanel40 = new javax.swing.JPanel(); - deviceField38 = new DeviceField(); - deviceField39 = new DeviceField(); - deviceField128 = new DeviceField(); - deviceField129 = new DeviceField(); - jPanel41 = new javax.swing.JPanel(); - deviceField40 = new DeviceField(); - jPanel42 = new javax.swing.JPanel(); - jPanel43 = new javax.swing.JPanel(); - deviceField41 = new DeviceField(); - deviceField42 = new DeviceField(); - deviceField130 = new DeviceField(); - deviceField131 = new DeviceField(); - jPanel44 = new javax.swing.JPanel(); - deviceField43 = new DeviceField(); - jPanel45 = new javax.swing.JPanel(); - jPanel46 = new javax.swing.JPanel(); - deviceField44 = new DeviceField(); - deviceField45 = new DeviceField(); - deviceField132 = new DeviceField(); - deviceField133 = new DeviceField(); - jPanel47 = new javax.swing.JPanel(); - deviceField46 = new DeviceField(); - jPanel48 = new javax.swing.JPanel(); - jPanel49 = new javax.swing.JPanel(); - deviceField47 = new DeviceField(); - deviceField48 = new DeviceField(); - deviceField134 = new DeviceField(); - deviceField135 = new DeviceField(); - jPanel50 = new javax.swing.JPanel(); - deviceField49 = new DeviceField(); - jPanel51 = new javax.swing.JPanel(); - jPanel52 = new javax.swing.JPanel(); - deviceField50 = new DeviceField(); - deviceField51 = new DeviceField(); - deviceField136 = new DeviceField(); - deviceField137 = new DeviceField(); - jPanel53 = new javax.swing.JPanel(); - deviceField52 = new DeviceField(); - jPanel54 = new javax.swing.JPanel(); - jPanel55 = new javax.swing.JPanel(); - deviceField53 = new DeviceField(); - deviceField54 = new DeviceField(); - deviceField138 = new DeviceField(); - deviceField139 = new DeviceField(); - jPanel56 = new javax.swing.JPanel(); - deviceField55 = new DeviceField(); - jPanel57 = new javax.swing.JPanel(); - jPanel58 = new javax.swing.JPanel(); - deviceField56 = new DeviceField(); - deviceField57 = new DeviceField(); - jTabbedPane4 = new javax.swing.JTabbedPane(); - jPanel59 = new javax.swing.JPanel(); - jPanel60 = new javax.swing.JPanel(); - deviceField58 = new DeviceField(); - deviceField59 = new DeviceField(); - deviceField140 = new DeviceField(); - deviceField141 = new DeviceField(); - jPanel61 = new javax.swing.JPanel(); - deviceField60 = new DeviceField(); - jPanel62 = new javax.swing.JPanel(); - jPanel63 = new javax.swing.JPanel(); - deviceField61 = new DeviceField(); - deviceField62 = new DeviceField(); - deviceField142 = new DeviceField(); - deviceField143 = new DeviceField(); - jPanel64 = new javax.swing.JPanel(); - deviceField63 = new DeviceField(); - jPanel65 = new javax.swing.JPanel(); - jPanel66 = new javax.swing.JPanel(); - deviceField64 = new DeviceField(); - deviceField65 = new DeviceField(); - deviceField144 = new DeviceField(); - deviceField145 = new DeviceField(); - jPanel67 = new javax.swing.JPanel(); - deviceField66 = new DeviceField(); - jPanel68 = new javax.swing.JPanel(); - jPanel69 = new javax.swing.JPanel(); - deviceField67 = new DeviceField(); - deviceField68 = new DeviceField(); - deviceField146 = new DeviceField(); - deviceField147 = new DeviceField(); - jPanel70 = new javax.swing.JPanel(); - deviceField69 = new DeviceField(); - jPanel71 = new javax.swing.JPanel(); - jPanel72 = new javax.swing.JPanel(); - deviceField70 = new DeviceField(); - deviceField71 = new DeviceField(); - deviceField148 = new DeviceField(); - deviceField149 = new DeviceField(); - jPanel73 = new javax.swing.JPanel(); - deviceField72 = new DeviceField(); - jPanel74 = new javax.swing.JPanel(); - jPanel75 = new javax.swing.JPanel(); - deviceField73 = new DeviceField(); - deviceField74 = new DeviceField(); - deviceField150 = new DeviceField(); - deviceField151 = new DeviceField(); - jPanel76 = new javax.swing.JPanel(); - deviceField75 = new DeviceField(); - jPanel77 = new javax.swing.JPanel(); - jPanel78 = new javax.swing.JPanel(); - deviceField76 = new DeviceField(); - deviceField77 = new DeviceField(); - deviceField152 = new DeviceField(); - deviceField153 = new DeviceField(); - jPanel79 = new javax.swing.JPanel(); - deviceField78 = new DeviceField(); - jPanel80 = new javax.swing.JPanel(); - jPanel81 = new javax.swing.JPanel(); - deviceField79 = new DeviceField(); - deviceField80 = new DeviceField(); - deviceField154 = new DeviceField(); - deviceField155 = new DeviceField(); - jPanel82 = new javax.swing.JPanel(); - deviceField81 = new DeviceField(); - jPanel83 = new javax.swing.JPanel(); - jPanel84 = new javax.swing.JPanel(); - deviceField82 = new DeviceField(); - deviceField83 = new DeviceField(); - jTabbedPane5 = new javax.swing.JTabbedPane(); - jPanel85 = new javax.swing.JPanel(); - jPanel86 = new javax.swing.JPanel(); - deviceField84 = new DeviceField(); - deviceField85 = new DeviceField(); - deviceField156 = new DeviceField(); - deviceField157 = new DeviceField(); - jPanel87 = new javax.swing.JPanel(); - deviceField86 = new DeviceField(); - jPanel88 = new javax.swing.JPanel(); - jPanel89 = new javax.swing.JPanel(); - deviceField87 = new DeviceField(); - deviceField88 = new DeviceField(); - deviceField158 = new DeviceField(); - deviceField159 = new DeviceField(); - jPanel90 = new javax.swing.JPanel(); - deviceField89 = new DeviceField(); - jPanel91 = new javax.swing.JPanel(); - jPanel92 = new javax.swing.JPanel(); - deviceField90 = new DeviceField(); - deviceField91 = new DeviceField(); - deviceField160 = new DeviceField(); - deviceField161 = new DeviceField(); - jPanel93 = new javax.swing.JPanel(); - deviceField92 = new DeviceField(); - jPanel94 = new javax.swing.JPanel(); - jPanel95 = new javax.swing.JPanel(); - deviceField93 = new DeviceField(); - deviceField94 = new DeviceField(); - deviceField162 = new DeviceField(); - deviceField163 = new DeviceField(); - jPanel96 = new javax.swing.JPanel(); - deviceField95 = new DeviceField(); - jPanel97 = new javax.swing.JPanel(); - jPanel98 = new javax.swing.JPanel(); - deviceField96 = new DeviceField(); - deviceField97 = new DeviceField(); - deviceField164 = new DeviceField(); - deviceField165 = new DeviceField(); - jPanel99 = new javax.swing.JPanel(); - deviceField98 = new DeviceField(); - jPanel100 = new javax.swing.JPanel(); - jPanel101 = new javax.swing.JPanel(); - deviceField99 = new DeviceField(); - deviceField100 = new DeviceField(); - deviceField166 = new DeviceField(); - deviceField167 = new DeviceField(); - jPanel102 = new javax.swing.JPanel(); - deviceField101 = new DeviceField(); - jPanel103 = new javax.swing.JPanel(); - jPanel104 = new javax.swing.JPanel(); - deviceField102 = new DeviceField(); - deviceField103 = new DeviceField(); - deviceField168 = new DeviceField(); - deviceField169 = new DeviceField(); - jPanel105 = new javax.swing.JPanel(); - deviceField104 = new DeviceField(); - jPanel106 = new javax.swing.JPanel(); - jPanel107 = new javax.swing.JPanel(); - deviceField105 = new DeviceField(); - deviceField106 = new DeviceField(); - deviceField170 = new DeviceField(); - deviceField171 = new DeviceField(); - jPanel108 = new javax.swing.JPanel(); - deviceField107 = new DeviceField(); - setDeviceProvider("scdevail.rfx.local:8200"); - setDeviceTitle("MARTe2 Supervisor"); - setDeviceType("MARTE2_SUPERVISOR"); - setHeight(350); - setWidth(800); - getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); - jPanel1.setLayout(new java.awt.BorderLayout()); - jPanel2.setLayout(new java.awt.GridLayout(2, 0)); - deviceField1.setIdentifier(""); - deviceField1.setLabelString("Comment: "); - deviceField1.setNumCols(30); - deviceField1.setOffsetNid(2); - deviceField1.setTextOnly(true); - jPanel3.add(deviceField1); - jButton1.setText("Check"); - jButton1.addActionListener(new java.awt.event.ActionListener() - { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) - { - jButton1ActionPerformed(evt); - } - }); - jPanel3.add(jButton1); - jPanel2.add(jPanel3); - deviceField2.setIdentifier(""); - deviceField2.setLabelString("Application Name: "); - deviceField2.setNumCols(15); - deviceField2.setOffsetNid(1); - deviceField2.setTextOnly(true); - jPanel4.add(deviceField2); - deviceField3.setIdentifier(""); - deviceField3.setLabelString("Num. States: "); - deviceField3.setOffsetNid(3); - jPanel4.add(deviceField3); - jPanel4.add(deviceDispatch1); - jPanel2.add(jPanel4); - jPanel1.add(jPanel2, java.awt.BorderLayout.NORTH); - jPanel5.setLayout(new java.awt.BorderLayout()); - deviceField4.setIdentifier(""); - deviceField4.setLabelString("Name: "); - deviceField4.setNumCols(15); - deviceField4.setOffsetNid(5); - deviceField4.setTextOnly(true); - jPanel6.add(deviceField4); - deviceField5.setIdentifier(""); - deviceField5.setLabelString("Num Threads: "); - deviceField5.setOffsetNid(6); - jPanel6.add(deviceField5); - jPanel5.add(jPanel6, java.awt.BorderLayout.NORTH); - jPanel7.setLayout(new java.awt.GridLayout(2, 0)); - deviceField6.setIdentifier(""); - deviceField6.setLabelString("Name: "); - deviceField6.setNumCols(15); - deviceField6.setOffsetNid(8); - deviceField6.setTextOnly(true); - jPanel8.add(deviceField6); - deviceField7.setIdentifier(""); - deviceField7.setLabelString("CPU Mask: "); - deviceField7.setOffsetNid(9); - jPanel8.add(deviceField7); - deviceField108.setIdentifier(""); - deviceField108.setLabelString("Seg. Len (0 to disable):"); - deviceField108.setNumCols(4); - deviceField108.setOffsetNid(437); - jPanel8.add(deviceField108); - deviceField109.setIdentifier(""); - deviceField109.setLabelString("Write CPU mask:"); - deviceField109.setNumCols(4); - deviceField109.setOffsetNid(438); - jPanel8.add(deviceField109); - jPanel7.add(jPanel8); - deviceField8.setIdentifier(""); - deviceField8.setLabelString("GAMs:"); - deviceField8.setNumCols(50); - deviceField8.setOffsetNid(10); - jPanel9.add(deviceField8); - jPanel7.add(jPanel9); - jTabbedPane2.addTab("Thread1", jPanel7); - jPanel10.setLayout(new java.awt.GridLayout(2, 0)); - deviceField9.setIdentifier(""); - deviceField9.setLabelString("Name: "); - deviceField9.setNumCols(15); - deviceField9.setOffsetNid(12); - deviceField9.setTextOnly(true); - jPanel11.add(deviceField9); - deviceField10.setIdentifier(""); - deviceField10.setLabelString("CPU Mask: "); - deviceField10.setOffsetNid(13); - jPanel11.add(deviceField10); - deviceField110.setIdentifier(""); - deviceField110.setLabelString("Seg. Len (0 to disable):"); - deviceField110.setNumCols(4); - deviceField110.setOffsetNid(449); - jPanel11.add(deviceField110); - deviceField111.setIdentifier(""); - deviceField111.setLabelString("Write CPU mask:"); - deviceField111.setNumCols(4); - deviceField111.setOffsetNid(450); - jPanel11.add(deviceField111); - jPanel10.add(jPanel11); - deviceField11.setIdentifier(""); - deviceField11.setLabelString("GAMs:"); - deviceField11.setNumCols(50); - deviceField11.setOffsetNid(14); - jPanel12.add(deviceField11); - jPanel10.add(jPanel12); - jTabbedPane2.addTab("Thread2", jPanel10); - jPanel13.setLayout(new java.awt.GridLayout(2, 0)); - deviceField12.setIdentifier(""); - deviceField12.setLabelString("Name: "); - deviceField12.setNumCols(15); - deviceField12.setOffsetNid(16); - deviceField12.setTextOnly(true); - jPanel14.add(deviceField12); - deviceField13.setIdentifier(""); - deviceField13.setLabelString("CPU Mask: "); - deviceField13.setOffsetNid(17); - jPanel14.add(deviceField13); - deviceField112.setIdentifier(""); - deviceField112.setLabelString("Seg. Len (0 to disable):"); - deviceField112.setNumCols(4); - deviceField112.setOffsetNid(461); - jPanel14.add(deviceField112); - deviceField113.setIdentifier(""); - deviceField113.setLabelString("Write CPU mask:"); - deviceField113.setNumCols(4); - deviceField113.setOffsetNid(462); - jPanel14.add(deviceField113); - jPanel13.add(jPanel14); - deviceField14.setIdentifier(""); - deviceField14.setLabelString("GAMs:"); - deviceField14.setNumCols(50); - deviceField14.setOffsetNid(18); - jPanel15.add(deviceField14); - jPanel13.add(jPanel15); - jTabbedPane2.addTab("Thread3", jPanel13); - jPanel16.setLayout(new java.awt.GridLayout(2, 0)); - deviceField15.setIdentifier(""); - deviceField15.setLabelString("Name: "); - deviceField15.setNumCols(15); - deviceField15.setOffsetNid(20); - deviceField15.setTextOnly(true); - jPanel17.add(deviceField15); - deviceField16.setIdentifier(""); - deviceField16.setLabelString("CPU Mask: "); - deviceField16.setOffsetNid(21); - jPanel17.add(deviceField16); - deviceField114.setIdentifier(""); - deviceField114.setLabelString("Seg. Len (0 to disable):"); - deviceField114.setNumCols(4); - deviceField114.setOffsetNid(473); - jPanel17.add(deviceField114); - deviceField115.setIdentifier(""); - deviceField115.setLabelString("Write CPU mask:"); - deviceField115.setNumCols(4); - deviceField115.setOffsetNid(474); - jPanel17.add(deviceField115); - jPanel16.add(jPanel17); - deviceField17.setIdentifier(""); - deviceField17.setLabelString("GAMs:"); - deviceField17.setNumCols(50); - deviceField17.setOffsetNid(22); - jPanel18.add(deviceField17); - jPanel16.add(jPanel18); - jTabbedPane2.addTab("Thread4", jPanel16); - jPanel19.setLayout(new java.awt.GridLayout(2, 0)); - deviceField18.setIdentifier(""); - deviceField18.setLabelString("Name: "); - deviceField18.setNumCols(15); - deviceField18.setOffsetNid(24); - deviceField18.setTextOnly(true); - jPanel20.add(deviceField18); - deviceField19.setIdentifier(""); - deviceField19.setLabelString("CPU Mask: "); - deviceField19.setOffsetNid(25); - jPanel20.add(deviceField19); - deviceField116.setIdentifier(""); - deviceField116.setLabelString("Seg. Len (0 to disable):"); - deviceField116.setNumCols(4); - deviceField116.setOffsetNid(485); - jPanel20.add(deviceField116); - deviceField117.setIdentifier(""); - deviceField117.setLabelString("Write CPU mask:"); - deviceField117.setNumCols(4); - deviceField117.setOffsetNid(486); - jPanel20.add(deviceField117); - jPanel19.add(jPanel20); - deviceField20.setIdentifier(""); - deviceField20.setLabelString("GAMs:"); - deviceField20.setNumCols(50); - deviceField20.setOffsetNid(26); - jPanel21.add(deviceField20); - jPanel19.add(jPanel21); - jTabbedPane2.addTab("Thread5", jPanel19); - jPanel22.setLayout(new java.awt.GridLayout(2, 0)); - deviceField21.setIdentifier(""); - deviceField21.setLabelString("Name: "); - deviceField21.setNumCols(15); - deviceField21.setOffsetNid(28); - deviceField21.setTextOnly(true); - jPanel23.add(deviceField21); - deviceField22.setIdentifier(""); - deviceField22.setLabelString("CPU Mask: "); - deviceField22.setOffsetNid(29); - jPanel23.add(deviceField22); - deviceField118.setIdentifier(""); - deviceField118.setLabelString("Seg. Len (0 to disable):"); - deviceField118.setNumCols(4); - deviceField118.setOffsetNid(497); - jPanel23.add(deviceField118); - deviceField119.setIdentifier(""); - deviceField119.setLabelString("Write CPU mask:"); - deviceField119.setNumCols(4); - deviceField119.setOffsetNid(498); - jPanel23.add(deviceField119); - jPanel22.add(jPanel23); - deviceField23.setIdentifier(""); - deviceField23.setLabelString("GAMs:"); - deviceField23.setNumCols(50); - deviceField23.setOffsetNid(30); - jPanel24.add(deviceField23); - jPanel22.add(jPanel24); - jTabbedPane2.addTab("Thread6", jPanel22); - jPanel25.setLayout(new java.awt.GridLayout(2, 0)); - deviceField24.setIdentifier(""); - deviceField24.setLabelString("Name: "); - deviceField24.setNumCols(15); - deviceField24.setOffsetNid(32); - deviceField24.setTextOnly(true); - jPanel26.add(deviceField24); - deviceField25.setIdentifier(""); - deviceField25.setLabelString("CPU Mask: "); - deviceField25.setOffsetNid(33); - jPanel26.add(deviceField25); - deviceField120.setIdentifier(""); - deviceField120.setLabelString("Seg. Len (0 to disable):"); - deviceField120.setNumCols(4); - deviceField120.setOffsetNid(509); - jPanel26.add(deviceField120); - deviceField121.setIdentifier(""); - deviceField121.setLabelString("Write CPU mask:"); - deviceField121.setNumCols(4); - deviceField121.setOffsetNid(510); - jPanel26.add(deviceField121); - jPanel25.add(jPanel26); - deviceField26.setIdentifier(""); - deviceField26.setLabelString("GAMs:"); - deviceField26.setNumCols(50); - deviceField26.setOffsetNid(34); - jPanel27.add(deviceField26); - jPanel25.add(jPanel27); - jTabbedPane2.addTab("Thread7", jPanel25); - jPanel28.setLayout(new java.awt.GridLayout(2, 0)); - deviceField27.setIdentifier(""); - deviceField27.setLabelString("Name: "); - deviceField27.setNumCols(15); - deviceField27.setOffsetNid(36); - deviceField27.setTextOnly(true); - jPanel29.add(deviceField27); - deviceField28.setIdentifier(""); - deviceField28.setLabelString("CPU Mask: "); - deviceField28.setOffsetNid(37); - jPanel29.add(deviceField28); - deviceField122.setIdentifier(""); - deviceField122.setLabelString("Seg. Len (0 to disable):"); - deviceField122.setNumCols(4); - deviceField122.setOffsetNid(521); - jPanel29.add(deviceField122); - deviceField123.setIdentifier(""); - deviceField123.setLabelString("Write CPU mask:"); - deviceField123.setNumCols(4); - deviceField123.setOffsetNid(522); - jPanel29.add(deviceField123); - jPanel28.add(jPanel29); - deviceField29.setIdentifier(""); - deviceField29.setLabelString("GAMs:"); - deviceField29.setNumCols(50); - deviceField29.setOffsetNid(38); - jPanel30.add(deviceField29); - jPanel28.add(jPanel30); - jTabbedPane2.addTab("Thread8", jPanel28); - jPanel5.add(jTabbedPane2, java.awt.BorderLayout.CENTER); - jTabbedPane1.addTab("State1", jPanel5); - jPanel31.setLayout(new java.awt.BorderLayout()); - deviceField30.setIdentifier(""); - deviceField30.setLabelString("Name: "); - deviceField30.setNumCols(15); - deviceField30.setOffsetNid(48); - deviceField30.setTextOnly(true); - jPanel32.add(deviceField30); - deviceField31.setIdentifier(""); - deviceField31.setLabelString("Num Threads: "); - deviceField31.setOffsetNid(49); - jPanel32.add(deviceField31); - jPanel31.add(jPanel32, java.awt.BorderLayout.NORTH); - jPanel33.setLayout(new java.awt.GridLayout(2, 0)); - deviceField32.setIdentifier(""); - deviceField32.setLabelString("Name: "); - deviceField32.setNumCols(15); - deviceField32.setOffsetNid(51); - deviceField32.setTextOnly(true); - jPanel34.add(deviceField32); - deviceField33.setIdentifier(""); - deviceField33.setLabelString("CPU Mask: "); - deviceField33.setOffsetNid(52); - jPanel34.add(deviceField33); - deviceField124.setIdentifier(""); - deviceField124.setLabelString("Seg. Len (0 to disable):"); - deviceField124.setNumCols(4); - deviceField124.setOffsetNid(558); - jPanel34.add(deviceField124); - deviceField125.setIdentifier(""); - deviceField125.setLabelString("Write CPU mask:"); - deviceField125.setNumCols(4); - deviceField125.setOffsetNid(559); - jPanel34.add(deviceField125); - jPanel33.add(jPanel34); - deviceField34.setIdentifier(""); - deviceField34.setLabelString("GAMs:"); - deviceField34.setNumCols(50); - deviceField34.setOffsetNid(53); - jPanel35.add(deviceField34); - jPanel33.add(jPanel35); - jTabbedPane3.addTab("Thread1", jPanel33); - jPanel36.setLayout(new java.awt.GridLayout(2, 0)); - deviceField35.setIdentifier(""); - deviceField35.setLabelString("Name: "); - deviceField35.setNumCols(15); - deviceField35.setOffsetNid(55); - deviceField35.setTextOnly(true); - jPanel37.add(deviceField35); - deviceField36.setIdentifier(""); - deviceField36.setLabelString("CPU Mask: "); - deviceField36.setOffsetNid(56); - jPanel37.add(deviceField36); - deviceField126.setIdentifier(""); - deviceField126.setLabelString("Seg. Len (0 to disable):"); - deviceField126.setNumCols(4); - deviceField126.setOffsetNid(570); - jPanel37.add(deviceField126); - deviceField127.setIdentifier(""); - deviceField127.setLabelString("Write CPU mask:"); - deviceField127.setNumCols(4); - deviceField127.setOffsetNid(571); - jPanel37.add(deviceField127); - jPanel36.add(jPanel37); - deviceField37.setIdentifier(""); - deviceField37.setLabelString("GAMs:"); - deviceField37.setNumCols(50); - deviceField37.setOffsetNid(57); - jPanel38.add(deviceField37); - jPanel36.add(jPanel38); - jTabbedPane3.addTab("Thread2", jPanel36); - jPanel39.setLayout(new java.awt.GridLayout(2, 0)); - deviceField38.setIdentifier(""); - deviceField38.setLabelString("Name: "); - deviceField38.setNumCols(15); - deviceField38.setOffsetNid(59); - deviceField38.setTextOnly(true); - jPanel40.add(deviceField38); - deviceField39.setIdentifier(""); - deviceField39.setLabelString("CPU Mask: "); - deviceField39.setOffsetNid(60); - jPanel40.add(deviceField39); - deviceField128.setIdentifier(""); - deviceField128.setLabelString("Seg. Len (0 to disable):"); - deviceField128.setNumCols(4); - deviceField128.setOffsetNid(582); - jPanel40.add(deviceField128); - deviceField129.setIdentifier(""); - deviceField129.setLabelString("Write CPU mask:"); - deviceField129.setNumCols(4); - deviceField129.setOffsetNid(583); - jPanel40.add(deviceField129); - jPanel39.add(jPanel40); - deviceField40.setIdentifier(""); - deviceField40.setLabelString("GAMs:"); - deviceField40.setNumCols(50); - deviceField40.setOffsetNid(61); - jPanel41.add(deviceField40); - jPanel39.add(jPanel41); - jTabbedPane3.addTab("Thread3", jPanel39); - jPanel42.setLayout(new java.awt.GridLayout(2, 0)); - deviceField41.setIdentifier(""); - deviceField41.setLabelString("Name: "); - deviceField41.setNumCols(15); - deviceField41.setOffsetNid(63); - deviceField41.setTextOnly(true); - jPanel43.add(deviceField41); - deviceField42.setIdentifier(""); - deviceField42.setLabelString("CPU Mask: "); - deviceField42.setOffsetNid(64); - jPanel43.add(deviceField42); - deviceField130.setIdentifier(""); - deviceField130.setLabelString("Seg. Len (0 to disable):"); - deviceField130.setNumCols(4); - deviceField130.setOffsetNid(594); - jPanel43.add(deviceField130); - deviceField131.setIdentifier(""); - deviceField131.setLabelString("Write CPU mask:"); - deviceField131.setNumCols(4); - deviceField131.setOffsetNid(595); - jPanel43.add(deviceField131); - jPanel42.add(jPanel43); - deviceField43.setIdentifier(""); - deviceField43.setLabelString("GAMs:"); - deviceField43.setNumCols(50); - deviceField43.setOffsetNid(65); - jPanel44.add(deviceField43); - jPanel42.add(jPanel44); - jTabbedPane3.addTab("Thread4", jPanel42); - jPanel45.setLayout(new java.awt.GridLayout(2, 0)); - deviceField44.setIdentifier(""); - deviceField44.setLabelString("Name: "); - deviceField44.setNumCols(15); - deviceField44.setOffsetNid(67); - deviceField44.setTextOnly(true); - jPanel46.add(deviceField44); - deviceField45.setIdentifier(""); - deviceField45.setLabelString("CPU Mask: "); - deviceField45.setOffsetNid(68); - jPanel46.add(deviceField45); - deviceField132.setIdentifier(""); - deviceField132.setLabelString("Seg. Len (0 to disable):"); - deviceField132.setNumCols(4); - deviceField132.setOffsetNid(606); - jPanel46.add(deviceField132); - deviceField133.setIdentifier(""); - deviceField133.setLabelString("Write CPU mask:"); - deviceField133.setNumCols(4); - deviceField133.setOffsetNid(607); - jPanel46.add(deviceField133); - jPanel45.add(jPanel46); - deviceField46.setIdentifier(""); - deviceField46.setLabelString("GAMs:"); - deviceField46.setNumCols(50); - deviceField46.setOffsetNid(69); - jPanel47.add(deviceField46); - jPanel45.add(jPanel47); - jTabbedPane3.addTab("Thread5", jPanel45); - jPanel48.setLayout(new java.awt.GridLayout(2, 0)); - deviceField47.setIdentifier(""); - deviceField47.setLabelString("Name: "); - deviceField47.setNumCols(15); - deviceField47.setOffsetNid(71); - deviceField47.setTextOnly(true); - jPanel49.add(deviceField47); - deviceField48.setIdentifier(""); - deviceField48.setLabelString("CPU Mask: "); - deviceField48.setOffsetNid(72); - jPanel49.add(deviceField48); - deviceField134.setIdentifier(""); - deviceField134.setLabelString("Seg. Len (0 to disable):"); - deviceField134.setNumCols(4); - deviceField134.setOffsetNid(618); - jPanel49.add(deviceField134); - deviceField135.setIdentifier(""); - deviceField135.setLabelString("Write CPU mask:"); - deviceField135.setNumCols(4); - deviceField135.setOffsetNid(619); - jPanel49.add(deviceField135); - jPanel48.add(jPanel49); - deviceField49.setIdentifier(""); - deviceField49.setLabelString("GAMs:"); - deviceField49.setNumCols(50); - deviceField49.setOffsetNid(73); - jPanel50.add(deviceField49); - jPanel48.add(jPanel50); - jTabbedPane3.addTab("Thread6", jPanel48); - jPanel51.setLayout(new java.awt.GridLayout(2, 0)); - deviceField50.setIdentifier(""); - deviceField50.setLabelString("Name: "); - deviceField50.setNumCols(15); - deviceField50.setOffsetNid(75); - deviceField50.setTextOnly(true); - jPanel52.add(deviceField50); - deviceField51.setIdentifier(""); - deviceField51.setLabelString("CPU Mask: "); - deviceField51.setOffsetNid(76); - jPanel52.add(deviceField51); - deviceField136.setIdentifier(""); - deviceField136.setLabelString("Seg. Len (0 to disable):"); - deviceField136.setNumCols(4); - deviceField136.setOffsetNid(630); - jPanel52.add(deviceField136); - deviceField137.setIdentifier(""); - deviceField137.setLabelString("Write CPU mask:"); - deviceField137.setNumCols(4); - deviceField137.setOffsetNid(631); - jPanel52.add(deviceField137); - jPanel51.add(jPanel52); - deviceField52.setIdentifier(""); - deviceField52.setLabelString("GAMs:"); - deviceField52.setNumCols(50); - deviceField52.setOffsetNid(77); - jPanel53.add(deviceField52); - jPanel51.add(jPanel53); - jTabbedPane3.addTab("Thread7", jPanel51); - jPanel54.setLayout(new java.awt.GridLayout(2, 0)); - deviceField53.setIdentifier(""); - deviceField53.setLabelString("Name: "); - deviceField53.setNumCols(15); - deviceField53.setOffsetNid(79); - deviceField53.setTextOnly(true); - jPanel55.add(deviceField53); - deviceField54.setIdentifier(""); - deviceField54.setLabelString("CPU Mask: "); - deviceField54.setOffsetNid(80); - jPanel55.add(deviceField54); - deviceField138.setIdentifier(""); - deviceField138.setLabelString("Seg. Len (0 to disable):"); - deviceField138.setNumCols(4); - deviceField138.setOffsetNid(642); - jPanel55.add(deviceField138); - deviceField139.setIdentifier(""); - deviceField139.setLabelString("Write CPU mask:"); - deviceField139.setNumCols(4); - deviceField139.setOffsetNid(643); - jPanel55.add(deviceField139); - jPanel54.add(jPanel55); - deviceField55.setIdentifier(""); - deviceField55.setLabelString("GAMs:"); - deviceField55.setNumCols(50); - deviceField55.setOffsetNid(81); - jPanel56.add(deviceField55); - jPanel54.add(jPanel56); - jTabbedPane3.addTab("Thread8", jPanel54); - jPanel31.add(jTabbedPane3, java.awt.BorderLayout.CENTER); - jTabbedPane1.addTab("State2", jPanel31); - jPanel57.setLayout(new java.awt.BorderLayout()); - deviceField56.setIdentifier(""); - deviceField56.setLabelString("Name: "); - deviceField56.setNumCols(15); - deviceField56.setOffsetNid(91); - deviceField56.setTextOnly(true); - jPanel58.add(deviceField56); - deviceField57.setIdentifier(""); - deviceField57.setLabelString("Num Threads: "); - deviceField57.setOffsetNid(92); - jPanel58.add(deviceField57); - jPanel57.add(jPanel58, java.awt.BorderLayout.NORTH); - jPanel59.setLayout(new java.awt.GridLayout(2, 0)); - deviceField58.setIdentifier(""); - deviceField58.setLabelString("Name: "); - deviceField58.setNumCols(15); - deviceField58.setOffsetNid(94); - deviceField58.setTextOnly(true); - jPanel60.add(deviceField58); - deviceField59.setIdentifier(""); - deviceField59.setLabelString("CPU Mask: "); - deviceField59.setOffsetNid(95); - jPanel60.add(deviceField59); - deviceField140.setIdentifier(""); - deviceField140.setLabelString("Seg. Len (0 to disable):"); - deviceField140.setNumCols(4); - deviceField140.setOffsetNid(679); - jPanel60.add(deviceField140); - deviceField141.setIdentifier(""); - deviceField141.setLabelString("Write CPU mask:"); - deviceField141.setNumCols(4); - deviceField141.setOffsetNid(680); - jPanel60.add(deviceField141); - jPanel59.add(jPanel60); - deviceField60.setIdentifier(""); - deviceField60.setLabelString("GAMs:"); - deviceField60.setNumCols(50); - deviceField60.setOffsetNid(96); - jPanel61.add(deviceField60); - jPanel59.add(jPanel61); - jTabbedPane4.addTab("Thread1", jPanel59); - jPanel62.setLayout(new java.awt.GridLayout(2, 0)); - deviceField61.setIdentifier(""); - deviceField61.setLabelString("Name: "); - deviceField61.setNumCols(15); - deviceField61.setOffsetNid(98); - deviceField61.setTextOnly(true); - jPanel63.add(deviceField61); - deviceField62.setIdentifier(""); - deviceField62.setLabelString("CPU Mask: "); - deviceField62.setOffsetNid(99); - jPanel63.add(deviceField62); - deviceField142.setIdentifier(""); - deviceField142.setLabelString("Seg. Len (0 to disable):"); - deviceField142.setNumCols(4); - deviceField142.setOffsetNid(691); - jPanel63.add(deviceField142); - deviceField143.setIdentifier(""); - deviceField143.setLabelString("Write CPU mask:"); - deviceField143.setNumCols(4); - deviceField143.setOffsetNid(692); - jPanel63.add(deviceField143); - jPanel62.add(jPanel63); - deviceField63.setIdentifier(""); - deviceField63.setLabelString("GAMs:"); - deviceField63.setNumCols(50); - deviceField63.setOffsetNid(100); - jPanel64.add(deviceField63); - jPanel62.add(jPanel64); - jTabbedPane4.addTab("Thread2", jPanel62); - jPanel65.setLayout(new java.awt.GridLayout(2, 0)); - deviceField64.setIdentifier(""); - deviceField64.setLabelString("Name: "); - deviceField64.setNumCols(15); - deviceField64.setOffsetNid(102); - deviceField64.setTextOnly(true); - jPanel66.add(deviceField64); - deviceField65.setIdentifier(""); - deviceField65.setLabelString("CPU Mask: "); - deviceField65.setOffsetNid(103); - jPanel66.add(deviceField65); - deviceField144.setIdentifier(""); - deviceField144.setLabelString("Seg. Len (0 to disable):"); - deviceField144.setNumCols(4); - deviceField144.setOffsetNid(703); - jPanel66.add(deviceField144); - deviceField145.setIdentifier(""); - deviceField145.setLabelString("Write CPU mask:"); - deviceField145.setNumCols(4); - deviceField145.setOffsetNid(704); - jPanel66.add(deviceField145); - jPanel65.add(jPanel66); - deviceField66.setIdentifier(""); - deviceField66.setLabelString("GAMs:"); - deviceField66.setNumCols(50); - deviceField66.setOffsetNid(104); - jPanel67.add(deviceField66); - jPanel65.add(jPanel67); - jTabbedPane4.addTab("Thread3", jPanel65); - jPanel68.setLayout(new java.awt.GridLayout(2, 0)); - deviceField67.setIdentifier(""); - deviceField67.setLabelString("Name: "); - deviceField67.setNumCols(15); - deviceField67.setOffsetNid(106); - deviceField67.setTextOnly(true); - jPanel69.add(deviceField67); - deviceField68.setIdentifier(""); - deviceField68.setLabelString("CPU Mask: "); - deviceField68.setOffsetNid(107); - jPanel69.add(deviceField68); - deviceField146.setIdentifier(""); - deviceField146.setLabelString("Seg. Len (0 to disable):"); - deviceField146.setNumCols(4); - deviceField146.setOffsetNid(715); - jPanel69.add(deviceField146); - deviceField147.setIdentifier(""); - deviceField147.setLabelString("Write CPU mask:"); - deviceField147.setNumCols(4); - deviceField147.setOffsetNid(716); - jPanel69.add(deviceField147); - jPanel68.add(jPanel69); - deviceField69.setIdentifier(""); - deviceField69.setLabelString("GAMs:"); - deviceField69.setNumCols(50); - deviceField69.setOffsetNid(108); - jPanel70.add(deviceField69); - jPanel68.add(jPanel70); - jTabbedPane4.addTab("Thread4", jPanel68); - jPanel71.setLayout(new java.awt.GridLayout(2, 0)); - deviceField70.setIdentifier(""); - deviceField70.setLabelString("Name: "); - deviceField70.setNumCols(15); - deviceField70.setOffsetNid(110); - deviceField70.setTextOnly(true); - jPanel72.add(deviceField70); - deviceField71.setIdentifier(""); - deviceField71.setLabelString("CPU Mask: "); - deviceField71.setOffsetNid(111); - jPanel72.add(deviceField71); - deviceField148.setIdentifier(""); - deviceField148.setLabelString("Seg. Len (0 to disable):"); - deviceField148.setNumCols(4); - deviceField148.setOffsetNid(727); - jPanel72.add(deviceField148); - deviceField149.setIdentifier(""); - deviceField149.setLabelString("Write CPU mask:"); - deviceField149.setNumCols(4); - deviceField149.setOffsetNid(728); - jPanel72.add(deviceField149); - jPanel71.add(jPanel72); - deviceField72.setIdentifier(""); - deviceField72.setLabelString("GAMs:"); - deviceField72.setNumCols(50); - deviceField72.setOffsetNid(112); - jPanel73.add(deviceField72); - jPanel71.add(jPanel73); - jTabbedPane4.addTab("Thread5", jPanel71); - jPanel74.setLayout(new java.awt.GridLayout(2, 0)); - deviceField73.setIdentifier(""); - deviceField73.setLabelString("Name: "); - deviceField73.setNumCols(15); - deviceField73.setOffsetNid(114); - deviceField73.setTextOnly(true); - jPanel75.add(deviceField73); - deviceField74.setIdentifier(""); - deviceField74.setLabelString("CPU Mask: "); - deviceField74.setOffsetNid(115); - jPanel75.add(deviceField74); - deviceField150.setIdentifier(""); - deviceField150.setLabelString("Seg. Len (0 to disable):"); - deviceField150.setNumCols(4); - deviceField150.setOffsetNid(739); - jPanel75.add(deviceField150); - deviceField151.setIdentifier(""); - deviceField151.setLabelString("Write CPU mask:"); - deviceField151.setNumCols(4); - deviceField151.setOffsetNid(740); - jPanel75.add(deviceField151); - jPanel74.add(jPanel75); - deviceField75.setIdentifier(""); - deviceField75.setLabelString("GAMs:"); - deviceField75.setNumCols(50); - deviceField75.setOffsetNid(116); - jPanel76.add(deviceField75); - jPanel74.add(jPanel76); - jTabbedPane4.addTab("Thread6", jPanel74); - jPanel77.setLayout(new java.awt.GridLayout(2, 0)); - deviceField76.setIdentifier(""); - deviceField76.setLabelString("Name: "); - deviceField76.setNumCols(15); - deviceField76.setOffsetNid(118); - deviceField76.setTextOnly(true); - jPanel78.add(deviceField76); - deviceField77.setIdentifier(""); - deviceField77.setLabelString("CPU Mask: "); - deviceField77.setOffsetNid(119); - jPanel78.add(deviceField77); - deviceField152.setIdentifier(""); - deviceField152.setLabelString("Seg. Len (0 to disable):"); - deviceField152.setNumCols(4); - deviceField152.setOffsetNid(751); - jPanel78.add(deviceField152); - deviceField153.setIdentifier(""); - deviceField153.setLabelString("Write CPU mask:"); - deviceField153.setNumCols(4); - deviceField153.setOffsetNid(752); - jPanel78.add(deviceField153); - jPanel77.add(jPanel78); - deviceField78.setIdentifier(""); - deviceField78.setLabelString("GAMs:"); - deviceField78.setNumCols(50); - deviceField78.setOffsetNid(120); - jPanel79.add(deviceField78); - jPanel77.add(jPanel79); - jTabbedPane4.addTab("Thread7", jPanel77); - jPanel80.setLayout(new java.awt.GridLayout(2, 0)); - deviceField79.setIdentifier(""); - deviceField79.setLabelString("Name: "); - deviceField79.setNumCols(15); - deviceField79.setOffsetNid(122); - deviceField79.setTextOnly(true); - jPanel81.add(deviceField79); - deviceField80.setIdentifier(""); - deviceField80.setLabelString("CPU Mask: "); - deviceField80.setOffsetNid(123); - jPanel81.add(deviceField80); - deviceField154.setIdentifier(""); - deviceField154.setLabelString("Seg. Len (0 to disable):"); - deviceField154.setNumCols(4); - deviceField154.setOffsetNid(763); - jPanel81.add(deviceField154); - deviceField155.setIdentifier(""); - deviceField155.setLabelString("Write CPU mask:"); - deviceField155.setNumCols(4); - deviceField155.setOffsetNid(764); - jPanel81.add(deviceField155); - jPanel80.add(jPanel81); - deviceField81.setIdentifier(""); - deviceField81.setLabelString("GAMs:"); - deviceField81.setNumCols(50); - deviceField81.setOffsetNid(124); - jPanel82.add(deviceField81); - jPanel80.add(jPanel82); - jTabbedPane4.addTab("Thread8", jPanel80); - jPanel57.add(jTabbedPane4, java.awt.BorderLayout.CENTER); - jTabbedPane1.addTab("State3", jPanel57); - jPanel83.setLayout(new java.awt.BorderLayout()); - deviceField82.setIdentifier(""); - deviceField82.setLabelString("Name: "); - deviceField82.setNumCols(15); - deviceField82.setOffsetNid(134); - deviceField82.setTextOnly(true); - jPanel84.add(deviceField82); - deviceField83.setIdentifier(""); - deviceField83.setLabelString("Num Threads: "); - deviceField83.setOffsetNid(135); - jPanel84.add(deviceField83); - jPanel83.add(jPanel84, java.awt.BorderLayout.NORTH); - jPanel85.setLayout(new java.awt.GridLayout(2, 0)); - deviceField84.setIdentifier(""); - deviceField84.setLabelString("Name: "); - deviceField84.setNumCols(15); - deviceField84.setOffsetNid(137); - deviceField84.setTextOnly(true); - jPanel86.add(deviceField84); - deviceField85.setIdentifier(""); - deviceField85.setLabelString("CPU Mask: "); - deviceField85.setOffsetNid(138); - jPanel86.add(deviceField85); - deviceField156.setIdentifier(""); - deviceField156.setLabelString("Seg. Len (0 to disable):"); - deviceField156.setNumCols(4); - deviceField156.setOffsetNid(800); - jPanel86.add(deviceField156); - deviceField157.setIdentifier(""); - deviceField157.setLabelString("Write CPU mask:"); - deviceField157.setNumCols(4); - deviceField157.setOffsetNid(801); - jPanel86.add(deviceField157); - jPanel85.add(jPanel86); - deviceField86.setIdentifier(""); - deviceField86.setLabelString("GAMs:"); - deviceField86.setNumCols(50); - deviceField86.setOffsetNid(139); - jPanel87.add(deviceField86); - jPanel85.add(jPanel87); - jTabbedPane5.addTab("Thread1", jPanel85); - jPanel88.setLayout(new java.awt.GridLayout(2, 0)); - deviceField87.setIdentifier(""); - deviceField87.setLabelString("Name: "); - deviceField87.setNumCols(15); - deviceField87.setOffsetNid(141); - deviceField87.setTextOnly(true); - jPanel89.add(deviceField87); - deviceField88.setIdentifier(""); - deviceField88.setLabelString("CPU Mask: "); - deviceField88.setOffsetNid(142); - jPanel89.add(deviceField88); - deviceField158.setIdentifier(""); - deviceField158.setLabelString("Seg. Len (0 to disable):"); - deviceField158.setNumCols(4); - deviceField158.setOffsetNid(812); - jPanel89.add(deviceField158); - deviceField159.setIdentifier(""); - deviceField159.setLabelString("Write CPU mask:"); - deviceField159.setNumCols(4); - deviceField159.setOffsetNid(813); - jPanel89.add(deviceField159); - jPanel88.add(jPanel89); - deviceField89.setIdentifier(""); - deviceField89.setLabelString("GAMs:"); - deviceField89.setNumCols(50); - deviceField89.setOffsetNid(143); - jPanel90.add(deviceField89); - jPanel88.add(jPanel90); - jTabbedPane5.addTab("Thread2", jPanel88); - jPanel91.setLayout(new java.awt.GridLayout(2, 0)); - deviceField90.setIdentifier(""); - deviceField90.setLabelString("Name: "); - deviceField90.setNumCols(15); - deviceField90.setOffsetNid(145); - deviceField90.setTextOnly(true); - jPanel92.add(deviceField90); - deviceField91.setIdentifier(""); - deviceField91.setLabelString("CPU Mask: "); - deviceField91.setOffsetNid(146); - jPanel92.add(deviceField91); - deviceField160.setIdentifier(""); - deviceField160.setLabelString("Seg. Len (0 to disable):"); - deviceField160.setNumCols(4); - deviceField160.setOffsetNid(824); - jPanel92.add(deviceField160); - deviceField161.setIdentifier(""); - deviceField161.setLabelString("Write CPU mask:"); - deviceField161.setNumCols(4); - deviceField161.setOffsetNid(825); - jPanel92.add(deviceField161); - jPanel91.add(jPanel92); - deviceField92.setIdentifier(""); - deviceField92.setLabelString("GAMs:"); - deviceField92.setNumCols(50); - deviceField92.setOffsetNid(147); - jPanel93.add(deviceField92); - jPanel91.add(jPanel93); - jTabbedPane5.addTab("Thread3", jPanel91); - jPanel94.setLayout(new java.awt.GridLayout(2, 0)); - deviceField93.setIdentifier(""); - deviceField93.setLabelString("Name: "); - deviceField93.setNumCols(15); - deviceField93.setOffsetNid(149); - deviceField93.setTextOnly(true); - jPanel95.add(deviceField93); - deviceField94.setIdentifier(""); - deviceField94.setLabelString("CPU Mask: "); - deviceField94.setOffsetNid(150); - jPanel95.add(deviceField94); - deviceField162.setIdentifier(""); - deviceField162.setLabelString("Seg. Len (0 to disable):"); - deviceField162.setNumCols(4); - deviceField162.setOffsetNid(836); - jPanel95.add(deviceField162); - deviceField163.setIdentifier(""); - deviceField163.setLabelString("Write CPU mask:"); - deviceField163.setNumCols(4); - deviceField163.setOffsetNid(837); - jPanel95.add(deviceField163); - jPanel94.add(jPanel95); - deviceField95.setIdentifier(""); - deviceField95.setLabelString("GAMs:"); - deviceField95.setNumCols(50); - deviceField95.setOffsetNid(151); - jPanel96.add(deviceField95); - jPanel94.add(jPanel96); - jTabbedPane5.addTab("Thread4", jPanel94); - jPanel97.setLayout(new java.awt.GridLayout(2, 0)); - deviceField96.setIdentifier(""); - deviceField96.setLabelString("Name: "); - deviceField96.setNumCols(15); - deviceField96.setOffsetNid(153); - deviceField96.setTextOnly(true); - jPanel98.add(deviceField96); - deviceField97.setIdentifier(""); - deviceField97.setLabelString("CPU Mask: "); - deviceField97.setOffsetNid(154); - jPanel98.add(deviceField97); - deviceField164.setIdentifier(""); - deviceField164.setLabelString("Seg. Len (0 to disable):"); - deviceField164.setNumCols(4); - deviceField164.setOffsetNid(848); - jPanel98.add(deviceField164); - deviceField165.setIdentifier(""); - deviceField165.setLabelString("Write CPU mask:"); - deviceField165.setNumCols(4); - deviceField165.setOffsetNid(849); - jPanel98.add(deviceField165); - jPanel97.add(jPanel98); - deviceField98.setIdentifier(""); - deviceField98.setLabelString("GAMs:"); - deviceField98.setNumCols(50); - deviceField98.setOffsetNid(155); - jPanel99.add(deviceField98); - jPanel97.add(jPanel99); - jTabbedPane5.addTab("Thread5", jPanel97); - jPanel100.setLayout(new java.awt.GridLayout(2, 0)); - deviceField99.setIdentifier(""); - deviceField99.setLabelString("Name: "); - deviceField99.setNumCols(15); - deviceField99.setOffsetNid(157); - deviceField99.setTextOnly(true); - jPanel101.add(deviceField99); - deviceField100.setIdentifier(""); - deviceField100.setLabelString("CPU Mask: "); - deviceField100.setOffsetNid(158); - jPanel101.add(deviceField100); - deviceField166.setIdentifier(""); - deviceField166.setLabelString("Seg. Len (0 to disable):"); - deviceField166.setNumCols(4); - deviceField166.setOffsetNid(860); - jPanel101.add(deviceField166); - deviceField167.setIdentifier(""); - deviceField167.setLabelString("Write CPU mask:"); - deviceField167.setNumCols(4); - deviceField167.setOffsetNid(861); - jPanel101.add(deviceField167); - jPanel100.add(jPanel101); - deviceField101.setIdentifier(""); - deviceField101.setLabelString("GAMs:"); - deviceField101.setNumCols(50); - deviceField101.setOffsetNid(159); - jPanel102.add(deviceField101); - jPanel100.add(jPanel102); - jTabbedPane5.addTab("Thread6", jPanel100); - jPanel103.setLayout(new java.awt.GridLayout(2, 0)); - deviceField102.setIdentifier(""); - deviceField102.setLabelString("Name: "); - deviceField102.setNumCols(15); - deviceField102.setOffsetNid(161); - deviceField102.setTextOnly(true); - jPanel104.add(deviceField102); - deviceField103.setIdentifier(""); - deviceField103.setLabelString("CPU Mask: "); - deviceField103.setOffsetNid(162); - jPanel104.add(deviceField103); - deviceField168.setIdentifier(""); - deviceField168.setLabelString("Seg. Len (0 to disable):"); - deviceField168.setNumCols(4); - deviceField168.setOffsetNid(872); - jPanel104.add(deviceField168); - deviceField169.setIdentifier(""); - deviceField169.setLabelString("Write CPU mask:"); - deviceField169.setNumCols(4); - deviceField169.setOffsetNid(873); - jPanel104.add(deviceField169); - jPanel103.add(jPanel104); - deviceField104.setIdentifier(""); - deviceField104.setLabelString("GAMs:"); - deviceField104.setNumCols(50); - deviceField104.setOffsetNid(163); - jPanel105.add(deviceField104); - jPanel103.add(jPanel105); - jTabbedPane5.addTab("Thread7", jPanel103); - jPanel106.setLayout(new java.awt.GridLayout(2, 0)); - deviceField105.setIdentifier(""); - deviceField105.setLabelString("Name: "); - deviceField105.setNumCols(15); - deviceField105.setOffsetNid(165); - deviceField105.setTextOnly(true); - jPanel107.add(deviceField105); - deviceField106.setIdentifier(""); - deviceField106.setLabelString("CPU Mask: "); - deviceField106.setOffsetNid(166); - jPanel107.add(deviceField106); - deviceField170.setIdentifier(""); - deviceField170.setLabelString("Seg. Len (0 to disable):"); - deviceField170.setNumCols(4); - deviceField170.setOffsetNid(884); - jPanel107.add(deviceField170); - deviceField171.setIdentifier(""); - deviceField171.setLabelString("Write CPU mask:"); - deviceField171.setNumCols(4); - deviceField171.setOffsetNid(885); - jPanel107.add(deviceField171); - jPanel106.add(jPanel107); - deviceField107.setIdentifier(""); - deviceField107.setLabelString("GAMs:"); - deviceField107.setNumCols(50); - deviceField107.setOffsetNid(167); - jPanel108.add(deviceField107); - jPanel106.add(jPanel108); - jTabbedPane5.addTab("Thread8", jPanel106); - jPanel83.add(jTabbedPane5, java.awt.BorderLayout.CENTER); - jTabbedPane1.addTab("State4", jPanel83); - jPanel1.add(jTabbedPane1, java.awt.BorderLayout.CENTER); - getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); - getAccessibleContext().setAccessibleName(""); - }// //GEN-END:initComponents + // //GEN-BEGIN:initComponents + private void initComponents() { + + deviceButtons1 = new DeviceButtons(); + jPanel1 = new javax.swing.JPanel(); + jPanel2 = new javax.swing.JPanel(); + jPanel3 = new javax.swing.JPanel(); + deviceField1 = new DeviceField(); + deviceField173 = new DeviceField(); + jButton1 = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + deviceField2 = new DeviceField(); + deviceField3 = new DeviceField(); + deviceField9 = new DeviceField(); + deviceDispatch1 = new DeviceDispatch(); + jPanel109 = new javax.swing.JPanel(); + deviceField172 = new DeviceField(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel5 = new javax.swing.JPanel(); + jPanel6 = new javax.swing.JPanel(); + deviceField4 = new DeviceField(); + deviceField5 = new DeviceField(); + jTabbedPane2 = new javax.swing.JTabbedPane(); + jPanel7 = new javax.swing.JPanel(); + jPanel8 = new javax.swing.JPanel(); + deviceField6 = new DeviceField(); + deviceField7 = new DeviceField(); + deviceField108 = new DeviceField(); + deviceField109 = new DeviceField(); + jPanel110 = new javax.swing.JPanel(); + deviceChoice1 = new DeviceChoice(); + deviceField174 = new DeviceField(); + deviceField175 = new DeviceField(); + deviceField176 = new DeviceField(); + jPanel9 = new javax.swing.JPanel(); + deviceField8 = new DeviceField(); + jPanel111 = new javax.swing.JPanel(); + jPanel112 = new javax.swing.JPanel(); + deviceField177 = new DeviceField(); + deviceField178 = new DeviceField(); + deviceField179 = new DeviceField(); + deviceField180 = new DeviceField(); + jPanel113 = new javax.swing.JPanel(); + deviceChoice2 = new DeviceChoice(); + deviceField181 = new DeviceField(); + deviceField182 = new DeviceField(); + deviceField183 = new DeviceField(); + jPanel114 = new javax.swing.JPanel(); + deviceField184 = new DeviceField(); + jPanel115 = new javax.swing.JPanel(); + jPanel116 = new javax.swing.JPanel(); + deviceField185 = new DeviceField(); + deviceField186 = new DeviceField(); + deviceField187 = new DeviceField(); + deviceField188 = new DeviceField(); + jPanel117 = new javax.swing.JPanel(); + deviceChoice3 = new DeviceChoice(); + deviceField189 = new DeviceField(); + deviceField190 = new DeviceField(); + deviceField191 = new DeviceField(); + jPanel118 = new javax.swing.JPanel(); + deviceField192 = new DeviceField(); + jPanel119 = new javax.swing.JPanel(); + jPanel120 = new javax.swing.JPanel(); + deviceField193 = new DeviceField(); + deviceField194 = new DeviceField(); + deviceField195 = new DeviceField(); + deviceField196 = new DeviceField(); + jPanel121 = new javax.swing.JPanel(); + deviceChoice4 = new DeviceChoice(); + deviceField197 = new DeviceField(); + deviceField198 = new DeviceField(); + deviceField199 = new DeviceField(); + jPanel122 = new javax.swing.JPanel(); + deviceField200 = new DeviceField(); + jPanel123 = new javax.swing.JPanel(); + jPanel124 = new javax.swing.JPanel(); + deviceField201 = new DeviceField(); + deviceField202 = new DeviceField(); + deviceField203 = new DeviceField(); + deviceField204 = new DeviceField(); + jPanel125 = new javax.swing.JPanel(); + deviceChoice5 = new DeviceChoice(); + deviceField205 = new DeviceField(); + deviceField206 = new DeviceField(); + deviceField207 = new DeviceField(); + jPanel126 = new javax.swing.JPanel(); + deviceField208 = new DeviceField(); + jPanel127 = new javax.swing.JPanel(); + jPanel128 = new javax.swing.JPanel(); + deviceField209 = new DeviceField(); + deviceField210 = new DeviceField(); + deviceField211 = new DeviceField(); + deviceField212 = new DeviceField(); + jPanel129 = new javax.swing.JPanel(); + deviceChoice6 = new DeviceChoice(); + deviceField213 = new DeviceField(); + deviceField214 = new DeviceField(); + deviceField215 = new DeviceField(); + jPanel130 = new javax.swing.JPanel(); + deviceField216 = new DeviceField(); + jPanel131 = new javax.swing.JPanel(); + jPanel132 = new javax.swing.JPanel(); + deviceField217 = new DeviceField(); + deviceField218 = new DeviceField(); + deviceField219 = new DeviceField(); + deviceField220 = new DeviceField(); + jPanel133 = new javax.swing.JPanel(); + deviceChoice7 = new DeviceChoice(); + deviceField221 = new DeviceField(); + deviceField222 = new DeviceField(); + deviceField223 = new DeviceField(); + jPanel134 = new javax.swing.JPanel(); + deviceField224 = new DeviceField(); + jPanel135 = new javax.swing.JPanel(); + jPanel136 = new javax.swing.JPanel(); + deviceField225 = new DeviceField(); + deviceField226 = new DeviceField(); + deviceField227 = new DeviceField(); + deviceField228 = new DeviceField(); + jPanel137 = new javax.swing.JPanel(); + deviceChoice8 = new DeviceChoice(); + deviceField229 = new DeviceField(); + deviceField230 = new DeviceField(); + deviceField231 = new DeviceField(); + jPanel138 = new javax.swing.JPanel(); + deviceField232 = new DeviceField(); + jPanel139 = new javax.swing.JPanel(); + jPanel140 = new javax.swing.JPanel(); + deviceField233 = new DeviceField(); + deviceField234 = new DeviceField(); + jTabbedPane6 = new javax.swing.JTabbedPane(); + jPanel141 = new javax.swing.JPanel(); + jPanel142 = new javax.swing.JPanel(); + deviceField235 = new DeviceField(); + deviceField236 = new DeviceField(); + deviceField237 = new DeviceField(); + deviceField238 = new DeviceField(); + jPanel143 = new javax.swing.JPanel(); + deviceChoice9 = new DeviceChoice(); + deviceField239 = new DeviceField(); + deviceField240 = new DeviceField(); + deviceField241 = new DeviceField(); + jPanel144 = new javax.swing.JPanel(); + deviceField242 = new DeviceField(); + jPanel173 = new javax.swing.JPanel(); + jPanel174 = new javax.swing.JPanel(); + deviceField299 = new DeviceField(); + deviceField300 = new DeviceField(); + deviceField301 = new DeviceField(); + deviceField302 = new DeviceField(); + jPanel175 = new javax.swing.JPanel(); + deviceChoice17 = new DeviceChoice(); + deviceField303 = new DeviceField(); + deviceField304 = new DeviceField(); + deviceField305 = new DeviceField(); + jPanel176 = new javax.swing.JPanel(); + deviceField306 = new DeviceField(); + jPanel177 = new javax.swing.JPanel(); + jPanel178 = new javax.swing.JPanel(); + deviceField307 = new DeviceField(); + deviceField308 = new DeviceField(); + deviceField309 = new DeviceField(); + deviceField310 = new DeviceField(); + jPanel179 = new javax.swing.JPanel(); + deviceChoice18 = new DeviceChoice(); + deviceField311 = new DeviceField(); + deviceField312 = new DeviceField(); + deviceField313 = new DeviceField(); + jPanel180 = new javax.swing.JPanel(); + deviceField314 = new DeviceField(); + jPanel181 = new javax.swing.JPanel(); + jPanel182 = new javax.swing.JPanel(); + deviceField315 = new DeviceField(); + deviceField316 = new DeviceField(); + deviceField317 = new DeviceField(); + deviceField318 = new DeviceField(); + jPanel183 = new javax.swing.JPanel(); + deviceChoice19 = new DeviceChoice(); + deviceField319 = new DeviceField(); + deviceField320 = new DeviceField(); + deviceField321 = new DeviceField(); + jPanel184 = new javax.swing.JPanel(); + deviceField322 = new DeviceField(); + jPanel185 = new javax.swing.JPanel(); + jPanel186 = new javax.swing.JPanel(); + deviceField323 = new DeviceField(); + deviceField324 = new DeviceField(); + deviceField325 = new DeviceField(); + deviceField326 = new DeviceField(); + jPanel187 = new javax.swing.JPanel(); + deviceChoice20 = new DeviceChoice(); + deviceField327 = new DeviceField(); + deviceField328 = new DeviceField(); + deviceField329 = new DeviceField(); + jPanel188 = new javax.swing.JPanel(); + deviceField330 = new DeviceField(); + jPanel189 = new javax.swing.JPanel(); + jPanel190 = new javax.swing.JPanel(); + deviceField331 = new DeviceField(); + deviceField332 = new DeviceField(); + deviceField333 = new DeviceField(); + deviceField334 = new DeviceField(); + jPanel191 = new javax.swing.JPanel(); + deviceChoice21 = new DeviceChoice(); + deviceField335 = new DeviceField(); + deviceField336 = new DeviceField(); + deviceField337 = new DeviceField(); + jPanel192 = new javax.swing.JPanel(); + deviceField338 = new DeviceField(); + jPanel193 = new javax.swing.JPanel(); + jPanel194 = new javax.swing.JPanel(); + deviceField339 = new DeviceField(); + deviceField340 = new DeviceField(); + deviceField341 = new DeviceField(); + deviceField342 = new DeviceField(); + jPanel195 = new javax.swing.JPanel(); + deviceChoice22 = new DeviceChoice(); + deviceField343 = new DeviceField(); + deviceField344 = new DeviceField(); + deviceField345 = new DeviceField(); + jPanel196 = new javax.swing.JPanel(); + deviceField346 = new DeviceField(); + jPanel197 = new javax.swing.JPanel(); + jPanel198 = new javax.swing.JPanel(); + deviceField347 = new DeviceField(); + deviceField348 = new DeviceField(); + deviceField349 = new DeviceField(); + deviceField350 = new DeviceField(); + jPanel199 = new javax.swing.JPanel(); + deviceChoice23 = new DeviceChoice(); + deviceField351 = new DeviceField(); + deviceField352 = new DeviceField(); + deviceField353 = new DeviceField(); + jPanel200 = new javax.swing.JPanel(); + deviceField354 = new DeviceField(); + + setDeviceProvider("localhost:8100"); + setDeviceTitle("MARTe2 Supervisor"); + setDeviceType("MARTE2_SUPERVISOR"); + setHeight(400); + setWidth(1200); + getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END); + + jPanel1.setLayout(new java.awt.BorderLayout()); + + jPanel2.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField1.setIdentifier(""); + deviceField1.setLabelString("Comment: "); + deviceField1.setNumCols(30); + deviceField1.setOffsetNid(2); + deviceField1.setTextOnly(true); + jPanel3.add(deviceField1); + + deviceField173.setIdentifier(""); + deviceField173.setLabelString("IP Addresss: "); + deviceField173.setNumCols(12); + deviceField173.setOffsetNid(3); + deviceField173.setTextOnly(true); + jPanel3.add(deviceField173); + + jButton1.setText("Check"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + jPanel3.add(jButton1); + + jPanel2.add(jPanel3); + + deviceField2.setIdentifier(""); + deviceField2.setLabelString("Application Name: "); + deviceField2.setOffsetNid(1); + deviceField2.setTextOnly(true); + jPanel4.add(deviceField2); + + deviceField3.setIdentifier(""); + deviceField3.setLabelString("Num. States: "); + deviceField3.setNumCols(4); + deviceField3.setOffsetNid(4); + jPanel4.add(deviceField3); + + deviceField9.setIdentifier(""); + deviceField9.setLabelString("Supervisors: "); + deviceField9.setNumCols(20); + deviceField9.setOffsetNid(6); + jPanel4.add(deviceField9); + jPanel4.add(deviceDispatch1); + + jPanel2.add(jPanel4); + + deviceField172.setIdentifier(""); + deviceField172.setLabelString("Interfaces: "); + deviceField172.setNumCols(50); + deviceField172.setOffsetNid(5); + jPanel109.add(deviceField172); + + jPanel2.add(jPanel109); + + jPanel1.add(jPanel2, java.awt.BorderLayout.NORTH); + + jPanel5.setLayout(new java.awt.BorderLayout()); + + deviceField4.setIdentifier(""); + deviceField4.setLabelString("Name: "); + deviceField4.setNumCols(15); + deviceField4.setOffsetNid(8); + deviceField4.setTextOnly(true); + jPanel6.add(deviceField4); + + deviceField5.setIdentifier(""); + deviceField5.setLabelString("Num Threads: "); + deviceField5.setOffsetNid(9); + jPanel6.add(deviceField5); + + jPanel5.add(jPanel6, java.awt.BorderLayout.NORTH); + + jPanel7.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField6.setIdentifier(""); + deviceField6.setLabelString("Name: "); + deviceField6.setNumCols(15); + deviceField6.setOffsetNid(11); + deviceField6.setTextOnly(true); + jPanel8.add(deviceField6); + + deviceField7.setIdentifier(""); + deviceField7.setLabelString("CPU Mask: "); + deviceField7.setOffsetNid(12); + jPanel8.add(deviceField7); + + deviceField108.setIdentifier(""); + deviceField108.setLabelString("Seg. Len (0 to disable):"); + deviceField108.setNumCols(4); + deviceField108.setOffsetNid(840); + jPanel8.add(deviceField108); + + deviceField109.setIdentifier(""); + deviceField109.setLabelString("Write CPU mask:"); + deviceField109.setNumCols(4); + deviceField109.setOffsetNid(841); + jPanel8.add(deviceField109); + + jPanel7.add(jPanel8); + + deviceChoice1.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice1.setIdentifier(""); + deviceChoice1.setLabelString("Timebase Mode: "); + deviceChoice1.setOffsetNid(14); + deviceChoice1.setUpdateIdentifier(""); + jPanel110.add(deviceChoice1); + + deviceField174.setIdentifier(""); + deviceField174.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField174.setNumCols(15); + deviceField174.setOffsetNid(15); + jPanel110.add(deviceField174); + + deviceField175.setIdentifier(""); + deviceField175.setLabelString("Timebase div (valid if derived):"); + deviceField175.setNumCols(4); + deviceField175.setOffsetNid(16); + jPanel110.add(deviceField175); + + deviceField176.setIdentifier(""); + deviceField176.setLabelString("IP Port: "); + deviceField176.setNumCols(4); + deviceField176.setOffsetNid(17); + jPanel110.add(deviceField176); + + jPanel7.add(jPanel110); + + deviceField8.setIdentifier(""); + deviceField8.setLabelString("GAMs:"); + deviceField8.setNumCols(50); + deviceField8.setOffsetNid(13); + jPanel9.add(deviceField8); + + jPanel7.add(jPanel9); + + jTabbedPane2.addTab("Thread1", jPanel7); + + jPanel111.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField177.setIdentifier(""); + deviceField177.setLabelString("Name: "); + deviceField177.setNumCols(15); + deviceField177.setOffsetNid(19); + deviceField177.setTextOnly(true); + jPanel112.add(deviceField177); + + deviceField178.setIdentifier(""); + deviceField178.setLabelString("CPU Mask: "); + deviceField178.setOffsetNid(20); + jPanel112.add(deviceField178); + + deviceField179.setIdentifier(""); + deviceField179.setLabelString("Seg. Len (0 to disable):"); + deviceField179.setNumCols(4); + deviceField179.setOffsetNid(852); + jPanel112.add(deviceField179); + + deviceField180.setIdentifier(""); + deviceField180.setLabelString("Write CPU mask:"); + deviceField180.setNumCols(4); + deviceField180.setOffsetNid(853); + jPanel112.add(deviceField180); + + jPanel111.add(jPanel112); + + deviceChoice2.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice2.setIdentifier(""); + deviceChoice2.setLabelString("Timebase Mode: "); + deviceChoice2.setOffsetNid(22); + deviceChoice2.setUpdateIdentifier(""); + jPanel113.add(deviceChoice2); + + deviceField181.setIdentifier(""); + deviceField181.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField181.setNumCols(15); + deviceField181.setOffsetNid(23); + jPanel113.add(deviceField181); + + deviceField182.setIdentifier(""); + deviceField182.setLabelString("Timebase div (valid if derived):"); + deviceField182.setNumCols(4); + deviceField182.setOffsetNid(24); + jPanel113.add(deviceField182); + + deviceField183.setIdentifier(""); + deviceField183.setLabelString("IP Port: "); + deviceField183.setNumCols(4); + deviceField183.setOffsetNid(25); + jPanel113.add(deviceField183); + + jPanel111.add(jPanel113); + + deviceField184.setIdentifier(""); + deviceField184.setLabelString("GAMs:"); + deviceField184.setNumCols(50); + deviceField184.setOffsetNid(21); + jPanel114.add(deviceField184); + + jPanel111.add(jPanel114); + + jTabbedPane2.addTab("Thread2", jPanel111); + + jPanel115.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField185.setIdentifier(""); + deviceField185.setLabelString("Name: "); + deviceField185.setNumCols(15); + deviceField185.setOffsetNid(27); + deviceField185.setTextOnly(true); + jPanel116.add(deviceField185); + + deviceField186.setIdentifier(""); + deviceField186.setLabelString("CPU Mask: "); + deviceField186.setOffsetNid(28); + jPanel116.add(deviceField186); + + deviceField187.setIdentifier(""); + deviceField187.setLabelString("Seg. Len (0 to disable):"); + deviceField187.setNumCols(4); + deviceField187.setOffsetNid(864); + jPanel116.add(deviceField187); + + deviceField188.setIdentifier(""); + deviceField188.setLabelString("Write CPU mask:"); + deviceField188.setNumCols(4); + deviceField188.setOffsetNid(865); + jPanel116.add(deviceField188); + + jPanel115.add(jPanel116); + + deviceChoice3.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice3.setIdentifier(""); + deviceChoice3.setLabelString("Timebase Mode: "); + deviceChoice3.setOffsetNid(30); + deviceChoice3.setUpdateIdentifier(""); + jPanel117.add(deviceChoice3); + + deviceField189.setIdentifier(""); + deviceField189.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField189.setNumCols(15); + deviceField189.setOffsetNid(31); + jPanel117.add(deviceField189); + + deviceField190.setIdentifier(""); + deviceField190.setLabelString("Timebase div (valid if derived):"); + deviceField190.setNumCols(4); + deviceField190.setOffsetNid(32); + jPanel117.add(deviceField190); + + deviceField191.setIdentifier(""); + deviceField191.setLabelString("IP Port: "); + deviceField191.setNumCols(4); + deviceField191.setOffsetNid(33); + jPanel117.add(deviceField191); + + jPanel115.add(jPanel117); + + deviceField192.setIdentifier(""); + deviceField192.setLabelString("GAMs:"); + deviceField192.setNumCols(50); + deviceField192.setOffsetNid(29); + jPanel118.add(deviceField192); + + jPanel115.add(jPanel118); + + jTabbedPane2.addTab("Thread3", jPanel115); + + jPanel119.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField193.setIdentifier(""); + deviceField193.setLabelString("Name: "); + deviceField193.setNumCols(15); + deviceField193.setOffsetNid(35); + deviceField193.setTextOnly(true); + jPanel120.add(deviceField193); + + deviceField194.setIdentifier(""); + deviceField194.setLabelString("CPU Mask: "); + deviceField194.setOffsetNid(36); + jPanel120.add(deviceField194); + + deviceField195.setIdentifier(""); + deviceField195.setLabelString("Seg. Len (0 to disable):"); + deviceField195.setNumCols(4); + deviceField195.setOffsetNid(876); + jPanel120.add(deviceField195); + + deviceField196.setIdentifier(""); + deviceField196.setLabelString("Write CPU mask:"); + deviceField196.setNumCols(4); + deviceField196.setOffsetNid(877); + jPanel120.add(deviceField196); + + jPanel119.add(jPanel120); + + deviceChoice4.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice4.setIdentifier(""); + deviceChoice4.setLabelString("Timebase Mode: "); + deviceChoice4.setOffsetNid(38); + deviceChoice4.setUpdateIdentifier(""); + jPanel121.add(deviceChoice4); + + deviceField197.setIdentifier(""); + deviceField197.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField197.setNumCols(15); + deviceField197.setOffsetNid(39); + jPanel121.add(deviceField197); + + deviceField198.setIdentifier(""); + deviceField198.setLabelString("Timebase div (valid if derived):"); + deviceField198.setNumCols(4); + deviceField198.setOffsetNid(40); + jPanel121.add(deviceField198); + + deviceField199.setIdentifier(""); + deviceField199.setLabelString("IP Port: "); + deviceField199.setNumCols(4); + deviceField199.setOffsetNid(41); + jPanel121.add(deviceField199); + + jPanel119.add(jPanel121); + + deviceField200.setIdentifier(""); + deviceField200.setLabelString("GAMs:"); + deviceField200.setNumCols(50); + deviceField200.setOffsetNid(37); + jPanel122.add(deviceField200); + + jPanel119.add(jPanel122); + + jTabbedPane2.addTab("Thread4", jPanel119); + + jPanel123.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField201.setIdentifier(""); + deviceField201.setLabelString("Name: "); + deviceField201.setNumCols(15); + deviceField201.setOffsetNid(43); + deviceField201.setTextOnly(true); + jPanel124.add(deviceField201); + + deviceField202.setIdentifier(""); + deviceField202.setLabelString("CPU Mask: "); + deviceField202.setOffsetNid(44); + jPanel124.add(deviceField202); + + deviceField203.setIdentifier(""); + deviceField203.setLabelString("Seg. Len (0 to disable):"); + deviceField203.setNumCols(4); + deviceField203.setOffsetNid(888); + jPanel124.add(deviceField203); + + deviceField204.setIdentifier(""); + deviceField204.setLabelString("Write CPU mask:"); + deviceField204.setNumCols(4); + deviceField204.setOffsetNid(889); + jPanel124.add(deviceField204); + + jPanel123.add(jPanel124); + + deviceChoice5.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice5.setIdentifier(""); + deviceChoice5.setLabelString("Timebase Mode: "); + deviceChoice5.setOffsetNid(46); + deviceChoice5.setUpdateIdentifier(""); + jPanel125.add(deviceChoice5); + + deviceField205.setIdentifier(""); + deviceField205.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField205.setNumCols(15); + deviceField205.setOffsetNid(47); + jPanel125.add(deviceField205); + + deviceField206.setIdentifier(""); + deviceField206.setLabelString("Timebase div (valid if derived):"); + deviceField206.setNumCols(4); + deviceField206.setOffsetNid(48); + jPanel125.add(deviceField206); + + deviceField207.setIdentifier(""); + deviceField207.setLabelString("IP Port: "); + deviceField207.setNumCols(4); + deviceField207.setOffsetNid(49); + jPanel125.add(deviceField207); + + jPanel123.add(jPanel125); + + deviceField208.setIdentifier(""); + deviceField208.setLabelString("GAMs:"); + deviceField208.setNumCols(50); + deviceField208.setOffsetNid(45); + jPanel126.add(deviceField208); + + jPanel123.add(jPanel126); + + jTabbedPane2.addTab("Thread5", jPanel123); + + jPanel127.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField209.setIdentifier(""); + deviceField209.setLabelString("Name: "); + deviceField209.setNumCols(15); + deviceField209.setOffsetNid(51); + deviceField209.setTextOnly(true); + jPanel128.add(deviceField209); + + deviceField210.setIdentifier(""); + deviceField210.setLabelString("CPU Mask: "); + deviceField210.setOffsetNid(52); + jPanel128.add(deviceField210); + + deviceField211.setIdentifier(""); + deviceField211.setLabelString("Seg. Len (0 to disable):"); + deviceField211.setNumCols(4); + deviceField211.setOffsetNid(900); + jPanel128.add(deviceField211); + + deviceField212.setIdentifier(""); + deviceField212.setLabelString("Write CPU mask:"); + deviceField212.setNumCols(4); + deviceField212.setOffsetNid(901); + jPanel128.add(deviceField212); + + jPanel127.add(jPanel128); + + deviceChoice6.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice6.setIdentifier(""); + deviceChoice6.setLabelString("Timebase Mode: "); + deviceChoice6.setOffsetNid(54); + deviceChoice6.setUpdateIdentifier(""); + jPanel129.add(deviceChoice6); + + deviceField213.setIdentifier(""); + deviceField213.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField213.setNumCols(15); + deviceField213.setOffsetNid(55); + jPanel129.add(deviceField213); + + deviceField214.setIdentifier(""); + deviceField214.setLabelString("Timebase div (valid if derived):"); + deviceField214.setNumCols(4); + deviceField214.setOffsetNid(56); + jPanel129.add(deviceField214); + + deviceField215.setIdentifier(""); + deviceField215.setLabelString("IP Port: "); + deviceField215.setNumCols(4); + deviceField215.setOffsetNid(57); + jPanel129.add(deviceField215); + + jPanel127.add(jPanel129); + + deviceField216.setIdentifier(""); + deviceField216.setLabelString("GAMs:"); + deviceField216.setNumCols(50); + deviceField216.setOffsetNid(53); + jPanel130.add(deviceField216); + + jPanel127.add(jPanel130); + + jTabbedPane2.addTab("Thread6", jPanel127); + + jPanel131.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField217.setIdentifier(""); + deviceField217.setLabelString("Name: "); + deviceField217.setNumCols(15); + deviceField217.setOffsetNid(59); + deviceField217.setTextOnly(true); + jPanel132.add(deviceField217); + + deviceField218.setIdentifier(""); + deviceField218.setLabelString("CPU Mask: "); + deviceField218.setOffsetNid(60); + jPanel132.add(deviceField218); + + deviceField219.setIdentifier(""); + deviceField219.setLabelString("Seg. Len (0 to disable):"); + deviceField219.setNumCols(4); + deviceField219.setOffsetNid(912); + jPanel132.add(deviceField219); + + deviceField220.setIdentifier(""); + deviceField220.setLabelString("Write CPU mask:"); + deviceField220.setNumCols(4); + deviceField220.setOffsetNid(913); + jPanel132.add(deviceField220); + + jPanel131.add(jPanel132); + + deviceChoice7.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice7.setIdentifier(""); + deviceChoice7.setLabelString("Timebase Mode: "); + deviceChoice7.setOffsetNid(62); + deviceChoice7.setUpdateIdentifier(""); + jPanel133.add(deviceChoice7); + + deviceField221.setIdentifier(""); + deviceField221.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField221.setNumCols(15); + deviceField221.setOffsetNid(63); + jPanel133.add(deviceField221); + + deviceField222.setIdentifier(""); + deviceField222.setLabelString("Timebase div (valid if derived):"); + deviceField222.setNumCols(4); + deviceField222.setOffsetNid(64); + jPanel133.add(deviceField222); + + deviceField223.setIdentifier(""); + deviceField223.setLabelString("IP Port: "); + deviceField223.setNumCols(4); + deviceField223.setOffsetNid(65); + jPanel133.add(deviceField223); + + jPanel131.add(jPanel133); + + deviceField224.setIdentifier(""); + deviceField224.setLabelString("GAMs:"); + deviceField224.setNumCols(50); + deviceField224.setOffsetNid(61); + jPanel134.add(deviceField224); + + jPanel131.add(jPanel134); + + jTabbedPane2.addTab("Thread7", jPanel131); + + jPanel135.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField225.setIdentifier(""); + deviceField225.setLabelString("Name: "); + deviceField225.setNumCols(15); + deviceField225.setOffsetNid(67); + deviceField225.setTextOnly(true); + jPanel136.add(deviceField225); + + deviceField226.setIdentifier(""); + deviceField226.setLabelString("CPU Mask: "); + deviceField226.setOffsetNid(68); + jPanel136.add(deviceField226); + + deviceField227.setIdentifier(""); + deviceField227.setLabelString("Seg. Len (0 to disable):"); + deviceField227.setNumCols(4); + deviceField227.setOffsetNid(924); + jPanel136.add(deviceField227); + + deviceField228.setIdentifier(""); + deviceField228.setLabelString("Write CPU mask:"); + deviceField228.setNumCols(4); + deviceField228.setOffsetNid(925); + jPanel136.add(deviceField228); + + jPanel135.add(jPanel136); + + deviceChoice8.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice8.setIdentifier(""); + deviceChoice8.setLabelString("Timebase Mode: "); + deviceChoice8.setOffsetNid(70); + deviceChoice8.setUpdateIdentifier(""); + jPanel137.add(deviceChoice8); + + deviceField229.setIdentifier(""); + deviceField229.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField229.setNumCols(15); + deviceField229.setOffsetNid(71); + jPanel137.add(deviceField229); + + deviceField230.setIdentifier(""); + deviceField230.setLabelString("Timebase div (valid if derived):"); + deviceField230.setNumCols(4); + deviceField230.setOffsetNid(72); + jPanel137.add(deviceField230); + + deviceField231.setIdentifier(""); + deviceField231.setLabelString("IP Port: "); + deviceField231.setNumCols(4); + deviceField231.setOffsetNid(73); + jPanel137.add(deviceField231); + + jPanel135.add(jPanel137); + + deviceField232.setIdentifier(""); + deviceField232.setLabelString("GAMs:"); + deviceField232.setNumCols(50); + deviceField232.setOffsetNid(69); + jPanel138.add(deviceField232); + + jPanel135.add(jPanel138); + + jTabbedPane2.addTab("Thread8", jPanel135); + + jPanel5.add(jTabbedPane2, java.awt.BorderLayout.CENTER); + + jTabbedPane1.addTab("State1", jPanel5); + + jPanel139.setLayout(new java.awt.BorderLayout()); + + deviceField233.setIdentifier(""); + deviceField233.setLabelString("Name: "); + deviceField233.setNumCols(15); + deviceField233.setOffsetNid(91); + deviceField233.setTextOnly(true); + jPanel140.add(deviceField233); + + deviceField234.setIdentifier(""); + deviceField234.setLabelString("Num Threads: "); + deviceField234.setOffsetNid(92); + jPanel140.add(deviceField234); + + jPanel139.add(jPanel140, java.awt.BorderLayout.NORTH); + + jPanel141.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField235.setIdentifier(""); + deviceField235.setLabelString("Name: "); + deviceField235.setNumCols(15); + deviceField235.setOffsetNid(94); + deviceField235.setTextOnly(true); + jPanel142.add(deviceField235); + + deviceField236.setIdentifier(""); + deviceField236.setLabelString("CPU Mask: "); + deviceField236.setOffsetNid(95); + jPanel142.add(deviceField236); + + deviceField237.setIdentifier(""); + deviceField237.setLabelString("Seg. Len (0 to disable):"); + deviceField237.setNumCols(4); + deviceField237.setOffsetNid(961); + jPanel142.add(deviceField237); + + deviceField238.setIdentifier(""); + deviceField238.setLabelString("Write CPU mask:"); + deviceField238.setNumCols(4); + deviceField238.setOffsetNid(962); + jPanel142.add(deviceField238); + + jPanel141.add(jPanel142); + + deviceChoice9.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice9.setIdentifier(""); + deviceChoice9.setLabelString("Timebase Mode: "); + deviceChoice9.setOffsetNid(97); + deviceChoice9.setUpdateIdentifier(""); + jPanel143.add(deviceChoice9); + + deviceField239.setIdentifier(""); + deviceField239.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField239.setNumCols(15); + deviceField239.setOffsetNid(98); + jPanel143.add(deviceField239); + + deviceField240.setIdentifier(""); + deviceField240.setLabelString("Timebase div (valid if derived):"); + deviceField240.setNumCols(4); + deviceField240.setOffsetNid(99); + jPanel143.add(deviceField240); + + deviceField241.setIdentifier(""); + deviceField241.setLabelString("IP Port: "); + deviceField241.setNumCols(4); + deviceField241.setOffsetNid(100); + jPanel143.add(deviceField241); + + jPanel141.add(jPanel143); + + deviceField242.setIdentifier(""); + deviceField242.setLabelString("GAMs:"); + deviceField242.setNumCols(50); + deviceField242.setOffsetNid(96); + jPanel144.add(deviceField242); + + jPanel141.add(jPanel144); + + jTabbedPane6.addTab("Thread1", jPanel141); + + jPanel173.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField299.setIdentifier(""); + deviceField299.setLabelString("Name: "); + deviceField299.setNumCols(15); + deviceField299.setOffsetNid(102); + deviceField299.setTextOnly(true); + jPanel174.add(deviceField299); + + deviceField300.setIdentifier(""); + deviceField300.setLabelString("CPU Mask: "); + deviceField300.setOffsetNid(103); + jPanel174.add(deviceField300); + + deviceField301.setIdentifier(""); + deviceField301.setLabelString("Seg. Len (0 to disable):"); + deviceField301.setNumCols(4); + deviceField301.setOffsetNid(973); + jPanel174.add(deviceField301); + + deviceField302.setIdentifier(""); + deviceField302.setLabelString("Write CPU mask:"); + deviceField302.setNumCols(4); + deviceField302.setOffsetNid(974); + jPanel174.add(deviceField302); + + jPanel173.add(jPanel174); + + deviceChoice17.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice17.setIdentifier(""); + deviceChoice17.setLabelString("Timebase Mode: "); + deviceChoice17.setOffsetNid(105); + deviceChoice17.setUpdateIdentifier(""); + jPanel175.add(deviceChoice17); + + deviceField303.setIdentifier(""); + deviceField303.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField303.setNumCols(15); + deviceField303.setOffsetNid(106); + jPanel175.add(deviceField303); + + deviceField304.setIdentifier(""); + deviceField304.setLabelString("Timebase div (valid if derived):"); + deviceField304.setNumCols(4); + deviceField304.setOffsetNid(107); + jPanel175.add(deviceField304); + + deviceField305.setIdentifier(""); + deviceField305.setLabelString("IP Port: "); + deviceField305.setNumCols(4); + deviceField305.setOffsetNid(108); + jPanel175.add(deviceField305); + + jPanel173.add(jPanel175); + + deviceField306.setIdentifier(""); + deviceField306.setLabelString("GAMs:"); + deviceField306.setNumCols(50); + deviceField306.setOffsetNid(104); + jPanel176.add(deviceField306); + + jPanel173.add(jPanel176); + + jTabbedPane6.addTab("Thread2", jPanel173); + + jPanel177.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField307.setIdentifier(""); + deviceField307.setLabelString("Name: "); + deviceField307.setNumCols(15); + deviceField307.setOffsetNid(110); + deviceField307.setTextOnly(true); + jPanel178.add(deviceField307); + + deviceField308.setIdentifier(""); + deviceField308.setLabelString("CPU Mask: "); + deviceField308.setOffsetNid(111); + jPanel178.add(deviceField308); + + deviceField309.setIdentifier(""); + deviceField309.setLabelString("Seg. Len (0 to disable):"); + deviceField309.setNumCols(4); + deviceField309.setOffsetNid(985); + jPanel178.add(deviceField309); + + deviceField310.setIdentifier(""); + deviceField310.setLabelString("Write CPU mask:"); + deviceField310.setNumCols(4); + deviceField310.setOffsetNid(986); + jPanel178.add(deviceField310); + + jPanel177.add(jPanel178); + + deviceChoice18.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice18.setIdentifier(""); + deviceChoice18.setLabelString("Timebase Mode: "); + deviceChoice18.setOffsetNid(113); + deviceChoice18.setUpdateIdentifier(""); + jPanel179.add(deviceChoice18); + + deviceField311.setIdentifier(""); + deviceField311.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField311.setNumCols(15); + deviceField311.setOffsetNid(114); + jPanel179.add(deviceField311); + + deviceField312.setIdentifier(""); + deviceField312.setLabelString("Timebase div (valid if derived):"); + deviceField312.setNumCols(4); + deviceField312.setOffsetNid(115); + jPanel179.add(deviceField312); + + deviceField313.setIdentifier(""); + deviceField313.setLabelString("IP Port: "); + deviceField313.setNumCols(4); + deviceField313.setOffsetNid(116); + jPanel179.add(deviceField313); + + jPanel177.add(jPanel179); + + deviceField314.setIdentifier(""); + deviceField314.setLabelString("GAMs:"); + deviceField314.setNumCols(50); + deviceField314.setOffsetNid(112); + jPanel180.add(deviceField314); + + jPanel177.add(jPanel180); + + jTabbedPane6.addTab("Thread3", jPanel177); + + jPanel181.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField315.setIdentifier(""); + deviceField315.setLabelString("Name: "); + deviceField315.setNumCols(15); + deviceField315.setOffsetNid(118); + deviceField315.setTextOnly(true); + jPanel182.add(deviceField315); + + deviceField316.setIdentifier(""); + deviceField316.setLabelString("CPU Mask: "); + deviceField316.setOffsetNid(119); + jPanel182.add(deviceField316); + + deviceField317.setIdentifier(""); + deviceField317.setLabelString("Seg. Len (0 to disable):"); + deviceField317.setNumCols(4); + deviceField317.setOffsetNid(997); + jPanel182.add(deviceField317); + + deviceField318.setIdentifier(""); + deviceField318.setLabelString("Write CPU mask:"); + deviceField318.setNumCols(4); + deviceField318.setOffsetNid(998); + jPanel182.add(deviceField318); + + jPanel181.add(jPanel182); + + deviceChoice19.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice19.setIdentifier(""); + deviceChoice19.setLabelString("Timebase Mode: "); + deviceChoice19.setOffsetNid(121); + deviceChoice19.setUpdateIdentifier(""); + jPanel183.add(deviceChoice19); + + deviceField319.setIdentifier(""); + deviceField319.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField319.setNumCols(15); + deviceField319.setOffsetNid(122); + jPanel183.add(deviceField319); + + deviceField320.setIdentifier(""); + deviceField320.setLabelString("Timebase div (valid if derived):"); + deviceField320.setNumCols(4); + deviceField320.setOffsetNid(123); + jPanel183.add(deviceField320); + + deviceField321.setIdentifier(""); + deviceField321.setLabelString("IP Port: "); + deviceField321.setNumCols(4); + deviceField321.setOffsetNid(124); + jPanel183.add(deviceField321); + + jPanel181.add(jPanel183); + + deviceField322.setIdentifier(""); + deviceField322.setLabelString("GAMs:"); + deviceField322.setNumCols(50); + deviceField322.setOffsetNid(120); + jPanel184.add(deviceField322); + + jPanel181.add(jPanel184); + + jTabbedPane6.addTab("Thread4", jPanel181); + + jPanel185.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField323.setIdentifier(""); + deviceField323.setLabelString("Name: "); + deviceField323.setNumCols(15); + deviceField323.setOffsetNid(126); + deviceField323.setTextOnly(true); + jPanel186.add(deviceField323); + + deviceField324.setIdentifier(""); + deviceField324.setLabelString("CPU Mask: "); + deviceField324.setOffsetNid(127); + jPanel186.add(deviceField324); + + deviceField325.setIdentifier(""); + deviceField325.setLabelString("Seg. Len (0 to disable):"); + deviceField325.setNumCols(4); + deviceField325.setOffsetNid(1009); + jPanel186.add(deviceField325); + + deviceField326.setIdentifier(""); + deviceField326.setLabelString("Write CPU mask:"); + deviceField326.setNumCols(4); + deviceField326.setOffsetNid(1010); + jPanel186.add(deviceField326); + + jPanel185.add(jPanel186); + + deviceChoice20.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice20.setIdentifier(""); + deviceChoice20.setLabelString("Timebase Mode: "); + deviceChoice20.setOffsetNid(129); + deviceChoice20.setUpdateIdentifier(""); + jPanel187.add(deviceChoice20); + + deviceField327.setIdentifier(""); + deviceField327.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField327.setNumCols(15); + deviceField327.setOffsetNid(130); + jPanel187.add(deviceField327); + + deviceField328.setIdentifier(""); + deviceField328.setLabelString("Timebase div (valid if derived):"); + deviceField328.setNumCols(4); + deviceField328.setOffsetNid(131); + jPanel187.add(deviceField328); + + deviceField329.setIdentifier(""); + deviceField329.setLabelString("IP Port: "); + deviceField329.setNumCols(4); + deviceField329.setOffsetNid(132); + jPanel187.add(deviceField329); + + jPanel185.add(jPanel187); + + deviceField330.setIdentifier(""); + deviceField330.setLabelString("GAMs:"); + deviceField330.setNumCols(50); + deviceField330.setOffsetNid(128); + jPanel188.add(deviceField330); + + jPanel185.add(jPanel188); + + jTabbedPane6.addTab("Thread5", jPanel185); + + jPanel189.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField331.setIdentifier(""); + deviceField331.setLabelString("Name: "); + deviceField331.setNumCols(15); + deviceField331.setOffsetNid(134); + deviceField331.setTextOnly(true); + jPanel190.add(deviceField331); + + deviceField332.setIdentifier(""); + deviceField332.setLabelString("CPU Mask: "); + deviceField332.setOffsetNid(135); + jPanel190.add(deviceField332); + + deviceField333.setIdentifier(""); + deviceField333.setLabelString("Seg. Len (0 to disable):"); + deviceField333.setNumCols(4); + deviceField333.setOffsetNid(1021); + jPanel190.add(deviceField333); + + deviceField334.setIdentifier(""); + deviceField334.setLabelString("Write CPU mask:"); + deviceField334.setNumCols(4); + deviceField334.setOffsetNid(1022); + jPanel190.add(deviceField334); + + jPanel189.add(jPanel190); + + deviceChoice21.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice21.setIdentifier(""); + deviceChoice21.setLabelString("Timebase Mode: "); + deviceChoice21.setOffsetNid(137); + deviceChoice21.setUpdateIdentifier(""); + jPanel191.add(deviceChoice21); + + deviceField335.setIdentifier(""); + deviceField335.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField335.setNumCols(15); + deviceField335.setOffsetNid(138); + jPanel191.add(deviceField335); + + deviceField336.setIdentifier(""); + deviceField336.setLabelString("Timebase div (valid if derived):"); + deviceField336.setNumCols(4); + deviceField336.setOffsetNid(139); + jPanel191.add(deviceField336); + + deviceField337.setIdentifier(""); + deviceField337.setLabelString("IP Port: "); + deviceField337.setNumCols(4); + deviceField337.setOffsetNid(140); + jPanel191.add(deviceField337); + + jPanel189.add(jPanel191); + + deviceField338.setIdentifier(""); + deviceField338.setLabelString("GAMs:"); + deviceField338.setNumCols(50); + deviceField338.setOffsetNid(136); + jPanel192.add(deviceField338); + + jPanel189.add(jPanel192); + + jTabbedPane6.addTab("Thread6", jPanel189); + + jPanel193.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField339.setIdentifier(""); + deviceField339.setLabelString("Name: "); + deviceField339.setNumCols(15); + deviceField339.setOffsetNid(142); + deviceField339.setTextOnly(true); + jPanel194.add(deviceField339); + + deviceField340.setIdentifier(""); + deviceField340.setLabelString("CPU Mask: "); + deviceField340.setOffsetNid(143); + jPanel194.add(deviceField340); + + deviceField341.setIdentifier(""); + deviceField341.setLabelString("Seg. Len (0 to disable):"); + deviceField341.setNumCols(4); + deviceField341.setOffsetNid(1033); + jPanel194.add(deviceField341); + + deviceField342.setIdentifier(""); + deviceField342.setLabelString("Write CPU mask:"); + deviceField342.setNumCols(4); + deviceField342.setOffsetNid(1034); + jPanel194.add(deviceField342); + + jPanel193.add(jPanel194); + + deviceChoice22.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice22.setIdentifier(""); + deviceChoice22.setLabelString("Timebase Mode: "); + deviceChoice22.setOffsetNid(145); + deviceChoice22.setUpdateIdentifier(""); + jPanel195.add(deviceChoice22); + + deviceField343.setIdentifier(""); + deviceField343.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField343.setNumCols(15); + deviceField343.setOffsetNid(146); + jPanel195.add(deviceField343); + + deviceField344.setIdentifier(""); + deviceField344.setLabelString("Timebase div (valid if derived):"); + deviceField344.setNumCols(4); + deviceField344.setOffsetNid(147); + jPanel195.add(deviceField344); + + deviceField345.setIdentifier(""); + deviceField345.setLabelString("IP Port: "); + deviceField345.setNumCols(4); + deviceField345.setOffsetNid(148); + jPanel195.add(deviceField345); + + jPanel193.add(jPanel195); + + deviceField346.setIdentifier(""); + deviceField346.setLabelString("GAMs:"); + deviceField346.setNumCols(50); + deviceField346.setOffsetNid(144); + jPanel196.add(deviceField346); + + jPanel193.add(jPanel196); + + jTabbedPane6.addTab("Thread7", jPanel193); + + jPanel197.setLayout(new java.awt.GridLayout(3, 0)); + + deviceField347.setIdentifier(""); + deviceField347.setLabelString("Name: "); + deviceField347.setNumCols(15); + deviceField347.setOffsetNid(150); + deviceField347.setTextOnly(true); + jPanel198.add(deviceField347); + + deviceField348.setIdentifier(""); + deviceField348.setLabelString("CPU Mask: "); + deviceField348.setOffsetNid(151); + jPanel198.add(deviceField348); + + deviceField349.setIdentifier(""); + deviceField349.setLabelString("Seg. Len (0 to disable):"); + deviceField349.setNumCols(4); + deviceField349.setOffsetNid(1045); + jPanel198.add(deviceField349); + + deviceField350.setIdentifier(""); + deviceField350.setLabelString("Write CPU mask:"); + deviceField350.setNumCols(4); + deviceField350.setOffsetNid(1046); + jPanel198.add(deviceField350); + + jPanel197.add(jPanel198); + + deviceChoice23.setChoiceItems(new String[] {"INTERNAL", "EXTERNAL", "DERIVED", "EXT_DERIVED"}); + deviceChoice23.setIdentifier(""); + deviceChoice23.setLabelString("Timebase Mode: "); + deviceChoice23.setOffsetNid(153); + deviceChoice23.setUpdateIdentifier(""); + jPanel199.add(deviceChoice23); + + deviceField351.setIdentifier(""); + deviceField351.setLabelString("Frequency(Hz, Internal)/Thread Id (derived):"); + deviceField351.setNumCols(15); + deviceField351.setOffsetNid(154); + jPanel199.add(deviceField351); + + deviceField352.setIdentifier(""); + deviceField352.setLabelString("Timebase div (valid if derived):"); + deviceField352.setNumCols(4); + deviceField352.setOffsetNid(155); + jPanel199.add(deviceField352); + + deviceField353.setIdentifier(""); + deviceField353.setLabelString("IP Port: "); + deviceField353.setNumCols(4); + deviceField353.setOffsetNid(156); + jPanel199.add(deviceField353); + + jPanel197.add(jPanel199); + + deviceField354.setIdentifier(""); + deviceField354.setLabelString("GAMs:"); + deviceField354.setNumCols(50); + deviceField354.setOffsetNid(152); + jPanel200.add(deviceField354); + + jPanel197.add(jPanel200); + + jTabbedPane6.addTab("Thread8", jPanel197); + + jPanel139.add(jTabbedPane6, java.awt.BorderLayout.CENTER); + + jTabbedPane1.addTab("State2", jPanel139); + + jPanel1.add(jTabbedPane1, java.awt.BorderLayout.CENTER); + + getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); + + getAccessibleContext().setAccessibleName(""); + }// //GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButton1ActionPerformed @@ -1365,293 +1438,239 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) JOptionPane.showMessageDialog(this, msg); }// GEN-LAST:event_jButton1ActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables - private DeviceButtons deviceButtons1; - private DeviceDispatch deviceDispatch1; - private DeviceField deviceField1; - private DeviceField deviceField10; - private DeviceField deviceField100; - private DeviceField deviceField101; - private DeviceField deviceField102; - private DeviceField deviceField103; - private DeviceField deviceField104; - private DeviceField deviceField105; - private DeviceField deviceField106; - private DeviceField deviceField107; - private DeviceField deviceField108; - private DeviceField deviceField109; - private DeviceField deviceField11; - private DeviceField deviceField110; - private DeviceField deviceField111; - private DeviceField deviceField112; - private DeviceField deviceField113; - private DeviceField deviceField114; - private DeviceField deviceField115; - private DeviceField deviceField116; - private DeviceField deviceField117; - private DeviceField deviceField118; - private DeviceField deviceField119; - private DeviceField deviceField12; - private DeviceField deviceField120; - private DeviceField deviceField121; - private DeviceField deviceField122; - private DeviceField deviceField123; - private DeviceField deviceField124; - private DeviceField deviceField125; - private DeviceField deviceField126; - private DeviceField deviceField127; - private DeviceField deviceField128; - private DeviceField deviceField129; - private DeviceField deviceField13; - private DeviceField deviceField130; - private DeviceField deviceField131; - private DeviceField deviceField132; - private DeviceField deviceField133; - private DeviceField deviceField134; - private DeviceField deviceField135; - private DeviceField deviceField136; - private DeviceField deviceField137; - private DeviceField deviceField138; - private DeviceField deviceField139; - private DeviceField deviceField14; - private DeviceField deviceField140; - private DeviceField deviceField141; - private DeviceField deviceField142; - private DeviceField deviceField143; - private DeviceField deviceField144; - private DeviceField deviceField145; - private DeviceField deviceField146; - private DeviceField deviceField147; - private DeviceField deviceField148; - private DeviceField deviceField149; - private DeviceField deviceField15; - private DeviceField deviceField150; - private DeviceField deviceField151; - private DeviceField deviceField152; - private DeviceField deviceField153; - private DeviceField deviceField154; - private DeviceField deviceField155; - private DeviceField deviceField156; - private DeviceField deviceField157; - private DeviceField deviceField158; - private DeviceField deviceField159; - private DeviceField deviceField16; - private DeviceField deviceField160; - private DeviceField deviceField161; - private DeviceField deviceField162; - private DeviceField deviceField163; - private DeviceField deviceField164; - private DeviceField deviceField165; - private DeviceField deviceField166; - private DeviceField deviceField167; - private DeviceField deviceField168; - private DeviceField deviceField169; - private DeviceField deviceField17; - private DeviceField deviceField170; - private DeviceField deviceField171; - 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 deviceField27; - private DeviceField deviceField28; - private DeviceField deviceField29; - private DeviceField deviceField3; - private DeviceField deviceField30; - private DeviceField deviceField31; - private DeviceField deviceField32; - private DeviceField deviceField33; - private DeviceField deviceField34; - private DeviceField deviceField35; - private DeviceField deviceField36; - private DeviceField deviceField37; - private DeviceField deviceField38; - private DeviceField deviceField39; - private DeviceField deviceField4; - private DeviceField deviceField40; - private DeviceField deviceField41; - private DeviceField deviceField42; - private DeviceField deviceField43; - private DeviceField deviceField44; - private DeviceField deviceField45; - private DeviceField deviceField46; - private DeviceField deviceField47; - private DeviceField deviceField48; - private DeviceField deviceField49; - private DeviceField deviceField5; - private DeviceField deviceField50; - private DeviceField deviceField51; - private DeviceField deviceField52; - private DeviceField deviceField53; - private DeviceField deviceField54; - private DeviceField deviceField55; - private DeviceField deviceField56; - private DeviceField deviceField57; - private DeviceField deviceField58; - private DeviceField deviceField59; - private DeviceField deviceField6; - private DeviceField deviceField60; - private DeviceField deviceField61; - private DeviceField deviceField62; - private DeviceField deviceField63; - private DeviceField deviceField64; - private DeviceField deviceField65; - private DeviceField deviceField66; - private DeviceField deviceField67; - private DeviceField deviceField68; - private DeviceField deviceField69; - private DeviceField deviceField7; - private DeviceField deviceField70; - private DeviceField deviceField71; - private DeviceField deviceField72; - private DeviceField deviceField73; - private DeviceField deviceField74; - private DeviceField deviceField75; - private DeviceField deviceField76; - private DeviceField deviceField77; - private DeviceField deviceField78; - private DeviceField deviceField79; - private DeviceField deviceField8; - private DeviceField deviceField80; - private DeviceField deviceField81; - private DeviceField deviceField82; - private DeviceField deviceField83; - private DeviceField deviceField84; - private DeviceField deviceField85; - private DeviceField deviceField86; - private DeviceField deviceField87; - private DeviceField deviceField88; - private DeviceField deviceField89; - private DeviceField deviceField9; - private DeviceField deviceField90; - private DeviceField deviceField91; - private DeviceField deviceField92; - private DeviceField deviceField93; - private DeviceField deviceField94; - private DeviceField deviceField95; - private DeviceField deviceField96; - private DeviceField deviceField97; - private DeviceField deviceField98; - private DeviceField deviceField99; - private javax.swing.JButton jButton1; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel10; - private javax.swing.JPanel jPanel100; - private javax.swing.JPanel jPanel101; - private javax.swing.JPanel jPanel102; - private javax.swing.JPanel jPanel103; - private javax.swing.JPanel jPanel104; - private javax.swing.JPanel jPanel105; - private javax.swing.JPanel jPanel106; - private javax.swing.JPanel jPanel107; - private javax.swing.JPanel jPanel108; - 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 jPanel23; - private javax.swing.JPanel jPanel24; - private javax.swing.JPanel jPanel25; - private javax.swing.JPanel jPanel26; - private javax.swing.JPanel jPanel27; - private javax.swing.JPanel jPanel28; - private javax.swing.JPanel jPanel29; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel30; - private javax.swing.JPanel jPanel31; - private javax.swing.JPanel jPanel32; - private javax.swing.JPanel jPanel33; - private javax.swing.JPanel jPanel34; - private javax.swing.JPanel jPanel35; - private javax.swing.JPanel jPanel36; - private javax.swing.JPanel jPanel37; - private javax.swing.JPanel jPanel38; - private javax.swing.JPanel jPanel39; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel40; - private javax.swing.JPanel jPanel41; - private javax.swing.JPanel jPanel42; - private javax.swing.JPanel jPanel43; - private javax.swing.JPanel jPanel44; - private javax.swing.JPanel jPanel45; - private javax.swing.JPanel jPanel46; - private javax.swing.JPanel jPanel47; - private javax.swing.JPanel jPanel48; - private javax.swing.JPanel jPanel49; - private javax.swing.JPanel jPanel5; - private javax.swing.JPanel jPanel50; - private javax.swing.JPanel jPanel51; - private javax.swing.JPanel jPanel52; - private javax.swing.JPanel jPanel53; - private javax.swing.JPanel jPanel54; - private javax.swing.JPanel jPanel55; - private javax.swing.JPanel jPanel56; - private javax.swing.JPanel jPanel57; - private javax.swing.JPanel jPanel58; - private javax.swing.JPanel jPanel59; - private javax.swing.JPanel jPanel6; - private javax.swing.JPanel jPanel60; - private javax.swing.JPanel jPanel61; - private javax.swing.JPanel jPanel62; - private javax.swing.JPanel jPanel63; - private javax.swing.JPanel jPanel64; - private javax.swing.JPanel jPanel65; - private javax.swing.JPanel jPanel66; - private javax.swing.JPanel jPanel67; - private javax.swing.JPanel jPanel68; - private javax.swing.JPanel jPanel69; - private javax.swing.JPanel jPanel7; - private javax.swing.JPanel jPanel70; - private javax.swing.JPanel jPanel71; - private javax.swing.JPanel jPanel72; - private javax.swing.JPanel jPanel73; - private javax.swing.JPanel jPanel74; - private javax.swing.JPanel jPanel75; - private javax.swing.JPanel jPanel76; - private javax.swing.JPanel jPanel77; - private javax.swing.JPanel jPanel78; - private javax.swing.JPanel jPanel79; - private javax.swing.JPanel jPanel8; - private javax.swing.JPanel jPanel80; - private javax.swing.JPanel jPanel81; - private javax.swing.JPanel jPanel82; - private javax.swing.JPanel jPanel83; - private javax.swing.JPanel jPanel84; - private javax.swing.JPanel jPanel85; - private javax.swing.JPanel jPanel86; - private javax.swing.JPanel jPanel87; - private javax.swing.JPanel jPanel88; - private javax.swing.JPanel jPanel89; - private javax.swing.JPanel jPanel9; - private javax.swing.JPanel jPanel90; - private javax.swing.JPanel jPanel91; - private javax.swing.JPanel jPanel92; - private javax.swing.JPanel jPanel93; - private javax.swing.JPanel jPanel94; - private javax.swing.JPanel jPanel95; - private javax.swing.JPanel jPanel96; - private javax.swing.JPanel jPanel97; - private javax.swing.JPanel jPanel98; - private javax.swing.JPanel jPanel99; - private javax.swing.JTabbedPane jTabbedPane1; - private javax.swing.JTabbedPane jTabbedPane2; - private javax.swing.JTabbedPane jTabbedPane3; - private javax.swing.JTabbedPane jTabbedPane4; - private javax.swing.JTabbedPane jTabbedPane5; - // End of variables declaration//GEN-END:variables + // Variables declaration - do not modify//GEN-BEGIN:variables + private DeviceButtons deviceButtons1; + private DeviceChoice deviceChoice1; + private DeviceChoice deviceChoice17; + private DeviceChoice deviceChoice18; + private DeviceChoice deviceChoice19; + private DeviceChoice deviceChoice2; + private DeviceChoice deviceChoice20; + private DeviceChoice deviceChoice21; + private DeviceChoice deviceChoice22; + private DeviceChoice deviceChoice23; + private DeviceChoice deviceChoice3; + private DeviceChoice deviceChoice4; + private DeviceChoice deviceChoice5; + private DeviceChoice deviceChoice6; + private DeviceChoice deviceChoice7; + private DeviceChoice deviceChoice8; + private DeviceChoice deviceChoice9; + private DeviceDispatch deviceDispatch1; + private DeviceField deviceField1; + private DeviceField deviceField108; + private DeviceField deviceField109; + private DeviceField deviceField172; + private DeviceField deviceField173; + private DeviceField deviceField174; + private DeviceField deviceField175; + private DeviceField deviceField176; + private DeviceField deviceField177; + private DeviceField deviceField178; + private DeviceField deviceField179; + private DeviceField deviceField180; + private DeviceField deviceField181; + private DeviceField deviceField182; + private DeviceField deviceField183; + private DeviceField deviceField184; + private DeviceField deviceField185; + private DeviceField deviceField186; + private DeviceField deviceField187; + private DeviceField deviceField188; + private DeviceField deviceField189; + private DeviceField deviceField190; + private DeviceField deviceField191; + private DeviceField deviceField192; + private DeviceField deviceField193; + private DeviceField deviceField194; + private DeviceField deviceField195; + private DeviceField deviceField196; + private DeviceField deviceField197; + private DeviceField deviceField198; + private DeviceField deviceField199; + private DeviceField deviceField2; + private DeviceField deviceField200; + private DeviceField deviceField201; + private DeviceField deviceField202; + private DeviceField deviceField203; + private DeviceField deviceField204; + private DeviceField deviceField205; + private DeviceField deviceField206; + private DeviceField deviceField207; + private DeviceField deviceField208; + private DeviceField deviceField209; + private DeviceField deviceField210; + private DeviceField deviceField211; + private DeviceField deviceField212; + private DeviceField deviceField213; + private DeviceField deviceField214; + private DeviceField deviceField215; + private DeviceField deviceField216; + private DeviceField deviceField217; + private DeviceField deviceField218; + private DeviceField deviceField219; + private DeviceField deviceField220; + private DeviceField deviceField221; + private DeviceField deviceField222; + private DeviceField deviceField223; + private DeviceField deviceField224; + private DeviceField deviceField225; + private DeviceField deviceField226; + private DeviceField deviceField227; + private DeviceField deviceField228; + private DeviceField deviceField229; + private DeviceField deviceField230; + private DeviceField deviceField231; + private DeviceField deviceField232; + private DeviceField deviceField233; + private DeviceField deviceField234; + private DeviceField deviceField235; + private DeviceField deviceField236; + private DeviceField deviceField237; + private DeviceField deviceField238; + private DeviceField deviceField239; + private DeviceField deviceField240; + private DeviceField deviceField241; + private DeviceField deviceField242; + private DeviceField deviceField299; + private DeviceField deviceField3; + private DeviceField deviceField300; + private DeviceField deviceField301; + private DeviceField deviceField302; + private DeviceField deviceField303; + private DeviceField deviceField304; + private DeviceField deviceField305; + private DeviceField deviceField306; + private DeviceField deviceField307; + private DeviceField deviceField308; + private DeviceField deviceField309; + private DeviceField deviceField310; + private DeviceField deviceField311; + private DeviceField deviceField312; + private DeviceField deviceField313; + private DeviceField deviceField314; + private DeviceField deviceField315; + private DeviceField deviceField316; + private DeviceField deviceField317; + private DeviceField deviceField318; + private DeviceField deviceField319; + private DeviceField deviceField320; + private DeviceField deviceField321; + private DeviceField deviceField322; + private DeviceField deviceField323; + private DeviceField deviceField324; + private DeviceField deviceField325; + private DeviceField deviceField326; + private DeviceField deviceField327; + private DeviceField deviceField328; + private DeviceField deviceField329; + private DeviceField deviceField330; + private DeviceField deviceField331; + private DeviceField deviceField332; + private DeviceField deviceField333; + private DeviceField deviceField334; + private DeviceField deviceField335; + private DeviceField deviceField336; + private DeviceField deviceField337; + private DeviceField deviceField338; + private DeviceField deviceField339; + private DeviceField deviceField340; + private DeviceField deviceField341; + private DeviceField deviceField342; + private DeviceField deviceField343; + private DeviceField deviceField344; + private DeviceField deviceField345; + private DeviceField deviceField346; + private DeviceField deviceField347; + private DeviceField deviceField348; + private DeviceField deviceField349; + private DeviceField deviceField350; + private DeviceField deviceField351; + private DeviceField deviceField352; + private DeviceField deviceField353; + private DeviceField deviceField354; + private DeviceField deviceField4; + private DeviceField deviceField5; + private DeviceField deviceField6; + private DeviceField deviceField7; + private DeviceField deviceField8; + private DeviceField deviceField9; + private javax.swing.JButton jButton1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel109; + private javax.swing.JPanel jPanel110; + private javax.swing.JPanel jPanel111; + private javax.swing.JPanel jPanel112; + private javax.swing.JPanel jPanel113; + private javax.swing.JPanel jPanel114; + private javax.swing.JPanel jPanel115; + private javax.swing.JPanel jPanel116; + private javax.swing.JPanel jPanel117; + private javax.swing.JPanel jPanel118; + private javax.swing.JPanel jPanel119; + private javax.swing.JPanel jPanel120; + private javax.swing.JPanel jPanel121; + private javax.swing.JPanel jPanel122; + private javax.swing.JPanel jPanel123; + private javax.swing.JPanel jPanel124; + private javax.swing.JPanel jPanel125; + private javax.swing.JPanel jPanel126; + private javax.swing.JPanel jPanel127; + private javax.swing.JPanel jPanel128; + private javax.swing.JPanel jPanel129; + private javax.swing.JPanel jPanel130; + private javax.swing.JPanel jPanel131; + private javax.swing.JPanel jPanel132; + private javax.swing.JPanel jPanel133; + private javax.swing.JPanel jPanel134; + private javax.swing.JPanel jPanel135; + private javax.swing.JPanel jPanel136; + private javax.swing.JPanel jPanel137; + private javax.swing.JPanel jPanel138; + private javax.swing.JPanel jPanel139; + private javax.swing.JPanel jPanel140; + private javax.swing.JPanel jPanel141; + private javax.swing.JPanel jPanel142; + private javax.swing.JPanel jPanel143; + private javax.swing.JPanel jPanel144; + private javax.swing.JPanel jPanel173; + private javax.swing.JPanel jPanel174; + private javax.swing.JPanel jPanel175; + private javax.swing.JPanel jPanel176; + private javax.swing.JPanel jPanel177; + private javax.swing.JPanel jPanel178; + private javax.swing.JPanel jPanel179; + private javax.swing.JPanel jPanel180; + private javax.swing.JPanel jPanel181; + private javax.swing.JPanel jPanel182; + private javax.swing.JPanel jPanel183; + private javax.swing.JPanel jPanel184; + private javax.swing.JPanel jPanel185; + private javax.swing.JPanel jPanel186; + private javax.swing.JPanel jPanel187; + private javax.swing.JPanel jPanel188; + private javax.swing.JPanel jPanel189; + private javax.swing.JPanel jPanel190; + private javax.swing.JPanel jPanel191; + private javax.swing.JPanel jPanel192; + private javax.swing.JPanel jPanel193; + private javax.swing.JPanel jPanel194; + private javax.swing.JPanel jPanel195; + private javax.swing.JPanel jPanel196; + private javax.swing.JPanel jPanel197; + private javax.swing.JPanel jPanel198; + private javax.swing.JPanel jPanel199; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel200; + 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; + private javax.swing.JTabbedPane jTabbedPane2; + private javax.swing.JTabbedPane jTabbedPane6; + // End of variables declaration//GEN-END:variables } diff --git a/java/jdevices/src/main/resources/ELADSetup.form b/java/jdevices/src/main/resources/ELADSetup.form index 41b890aa67..8d53ec84ef 100644 --- a/java/jdevices/src/main/resources/ELADSetup.form +++ b/java/jdevices/src/main/resources/ELADSetup.form @@ -1,12 +1,13 @@ -
+ - - + + + @@ -21,7 +22,7 @@ - + @@ -36,7 +37,7 @@ - + @@ -125,6 +126,990 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_DOUBLEH_MASTERSetup.form b/java/jdevices/src/main/resources/MARTE2_DOUBLEH_MASTERSetup.form new file mode 100644 index 0000000000..7028373d4d --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_DOUBLEH_MASTERSetup.form @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_DOUBLEH_SLAVESetup.form b/java/jdevices/src/main/resources/MARTE2_DOUBLEH_SLAVESetup.form new file mode 100644 index 0000000000..4b70407f09 --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_DOUBLEH_SLAVESetup.form @@ -0,0 +1,99 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_EPICSCASetup.form b/java/jdevices/src/main/resources/MARTE2_EPICSCASetup.form new file mode 100644 index 0000000000..24c8da44a9 --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_EPICSCASetup.form @@ -0,0 +1,303 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_EXPRSetup.form b/java/jdevices/src/main/resources/MARTE2_EXPRSetup.form index ca56c06297..65e14a8bf8 100644 --- a/java/jdevices/src/main/resources/MARTE2_EXPRSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_EXPRSetup.form @@ -2,7 +2,7 @@
- + @@ -42,1194 +42,54 @@ - - - - + + + + + + - + - - + + - - - - + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - - - + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1246,28 +106,12 @@ - - - - - - - - - - - - - - - - - + diff --git a/java/jdevices/src/main/resources/MARTE2_LOGGERSetup.form b/java/jdevices/src/main/resources/MARTE2_LOGGERSetup.form index 8fc3444839..baa7140d9b 100644 --- a/java/jdevices/src/main/resources/MARTE2_LOGGERSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_LOGGERSetup.form @@ -2,7 +2,7 @@ - + @@ -36,33 +36,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -174,7 +147,7 @@ - + @@ -183,7 +156,7 @@ - + @@ -197,7 +170,7 @@ - + @@ -240,7 +213,7 @@ - + @@ -249,7 +222,7 @@ - + @@ -263,7 +236,7 @@ - + @@ -306,7 +279,7 @@ - + @@ -315,7 +288,7 @@ - + @@ -329,7 +302,7 @@ - + @@ -372,7 +345,7 @@ - + @@ -381,7 +354,7 @@ - + @@ -395,7 +368,7 @@ - + @@ -438,7 +411,7 @@ - + @@ -447,7 +420,7 @@ - + @@ -461,7 +434,7 @@ - + @@ -504,7 +477,7 @@ - + @@ -513,7 +486,7 @@ - + @@ -527,7 +500,7 @@ - + @@ -570,7 +543,7 @@ - + @@ -579,7 +552,7 @@ - + @@ -593,7 +566,7 @@ - + diff --git a/java/jdevices/src/main/resources/MARTE2_OPCUA_INSetup.form b/java/jdevices/src/main/resources/MARTE2_OPCUA_INSetup.form new file mode 100644 index 0000000000..1c47b1d180 --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_OPCUA_INSetup.form @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_OPCUA_OUTSetup.form b/java/jdevices/src/main/resources/MARTE2_OPCUA_OUTSetup.form new file mode 100644 index 0000000000..5d6d5a72c0 --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_OPCUA_OUTSetup.form @@ -0,0 +1,120 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_OPCUA_SERVERSetup.form b/java/jdevices/src/main/resources/MARTE2_OPCUA_SERVERSetup.form new file mode 100644 index 0000000000..f53c86aa66 --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_OPCUA_SERVERSetup.form @@ -0,0 +1,725 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_PYTHON_PIDSetup.form b/java/jdevices/src/main/resources/MARTE2_PYTHON_PIDSetup.form index e551e89056..8ef4d0aab6 100644 --- a/java/jdevices/src/main/resources/MARTE2_PYTHON_PIDSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_PYTHON_PIDSetup.form @@ -2,11 +2,11 @@
- + - - + + @@ -24,38 +24,11 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -77,7 +50,7 @@ - + @@ -85,7 +58,7 @@ - + @@ -93,7 +66,7 @@ - + @@ -101,7 +74,7 @@ - + @@ -122,23 +95,7 @@ - - - - - - - - - - - - - - - - - + @@ -152,7 +109,7 @@ - + @@ -160,7 +117,23 @@ - + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_RAMPSetup.form b/java/jdevices/src/main/resources/MARTE2_RAMPSetup.form new file mode 100644 index 0000000000..22e07e382c --- /dev/null +++ b/java/jdevices/src/main/resources/MARTE2_RAMPSetup.form @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form b/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form index e7e21e5ac6..1db06ab2a2 100644 --- a/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTTSetup.form @@ -42,28 +42,20 @@ - - - - - - - - - + - + - + - + - - - + + + @@ -115,7 +107,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 index b7e422b2d3..8223e95249 100644 --- a/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTT_VSSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_SIMULINK_DTT_VSSetup.form @@ -21,7 +21,7 @@ - + @@ -42,28 +42,20 @@ - - - - - - - - - + - - - + + + - + - + - + diff --git a/java/jdevices/src/main/resources/MARTE2_SIMULINK_GENERICSetup.form b/java/jdevices/src/main/resources/MARTE2_SIMULINK_GENERICSetup.form index de07fa0d95..2ff75580a8 100644 --- a/java/jdevices/src/main/resources/MARTE2_SIMULINK_GENERICSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_SIMULINK_GENERICSetup.form @@ -21,7 +21,7 @@ - + @@ -53,574 +53,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + @@ -635,550 +73,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
@@ -1193,462 +93,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + @@ -1663,31 +115,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - @@ -1705,7 +135,7 @@ - + @@ -1745,7 +175,7 @@ - + @@ -1753,7 +183,7 @@ - + diff --git a/java/jdevices/src/main/resources/MARTE2_SIMULINK_TANKSetup.form b/java/jdevices/src/main/resources/MARTE2_SIMULINK_TANKSetup.form index 43b984acce..07f4ff8a68 100644 --- a/java/jdevices/src/main/resources/MARTE2_SIMULINK_TANKSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_SIMULINK_TANKSetup.form @@ -2,10 +2,11 @@
- + - + + @@ -21,7 +22,7 @@ - + @@ -42,31 +43,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - @@ -76,7 +55,7 @@ - + @@ -90,7 +69,7 @@ - + @@ -98,15 +77,7 @@ - - - - - - - - - + diff --git a/java/jdevices/src/main/resources/MARTE2_STREAMSetup.form b/java/jdevices/src/main/resources/MARTE2_STREAMSetup.form index cfa5e9b2d4..e4243c8804 100644 --- a/java/jdevices/src/main/resources/MARTE2_STREAMSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_STREAMSetup.form @@ -139,975 +139,12 @@ - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/java/jdevices/src/main/resources/MARTE2_STREAM_INSetup.form b/java/jdevices/src/main/resources/MARTE2_STREAM_INSetup.form index f9ba7ae94c..e2af94f618 100644 --- a/java/jdevices/src/main/resources/MARTE2_STREAM_INSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_STREAM_INSetup.form @@ -8,7 +8,7 @@ - + @@ -125,206 +125,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/java/jdevices/src/main/resources/MARTE2_STREAM_IN_ASetup.form b/java/jdevices/src/main/resources/MARTE2_STREAM_IN_ASetup.form index 129c4d5d7e..f174e04d12 100644 --- a/java/jdevices/src/main/resources/MARTE2_STREAM_IN_ASetup.form +++ b/java/jdevices/src/main/resources/MARTE2_STREAM_IN_ASetup.form @@ -128,422 +128,12 @@ - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/java/jdevices/src/main/resources/MARTE2_SUPERVISORSetup.form b/java/jdevices/src/main/resources/MARTE2_SUPERVISORSetup.form index 6dd527bc94..a0db62e969 100644 --- a/java/jdevices/src/main/resources/MARTE2_SUPERVISORSetup.form +++ b/java/jdevices/src/main/resources/MARTE2_SUPERVISORSetup.form @@ -1,12 +1,12 @@ - + - + - - + + @@ -24,7 +24,7 @@ - + @@ -54,7 +54,7 @@ - + @@ -70,6 +70,15 @@ + + + + + + + + + @@ -88,7 +97,6 @@ - @@ -97,13 +105,36 @@ - + + + + + + + + + + + + + + + + + + + + + + + + @@ -140,7 +171,7 @@ - + @@ -148,7 +179,7 @@ - + @@ -173,7 +204,7 @@ - + @@ -185,7 +216,7 @@ - + @@ -193,7 +224,7 @@ - + @@ -201,7 +232,7 @@ - + @@ -209,7 +240,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -223,14 +300,14 @@ - + - + @@ -241,64 +318,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -309,64 +432,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -377,64 +546,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -445,64 +660,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -513,64 +774,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -581,64 +888,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -649,1247 +1002,103 @@ - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + + - + - + - + - + - + - + - + - + - + @@ -1900,18 +1109,18 @@ - + - - + + - + @@ -1920,25 +1129,25 @@ - + - + - + - + - + @@ -1947,7 +1156,7 @@ - + @@ -1958,64 +1167,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -2026,64 +1281,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -2094,64 +1395,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -2162,64 +1509,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -2230,64 +1623,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -2298,64 +1737,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -2366,64 +1851,110 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -2434,57 +1965,103 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/java/jdevices/src/main/resources/RFX_RPADC_SERIALSetup.form b/java/jdevices/src/main/resources/RFX_RPADC_SERIALSetup.form index 7b35a48160..99f81c8cde 100644 --- a/java/jdevices/src/main/resources/RFX_RPADC_SERIALSetup.form +++ b/java/jdevices/src/main/resources/RFX_RPADC_SERIALSetup.form @@ -22,7 +22,7 @@ - + @@ -73,14 +73,6 @@ - - - - - - - - @@ -223,14 +215,14 @@ - + - + diff --git a/java/jdispatcher/src/main/java/mds/jdispatcher/jServer.java b/java/jdispatcher/src/main/java/mds/jdispatcher/jServer.java index ab25f3dbca..05e8ac4822 100644 --- a/java/jdispatcher/src/main/java/mds/jdispatcher/jServer.java +++ b/java/jdispatcher/src/main/java/mds/jdispatcher/jServer.java @@ -201,6 +201,8 @@ public void run() { currentActionAborted = false; currMaker = new ActionMaker(currAction); + currMaker.run(); //Avoid useless thread with potential deadlock +/* currMaker.start(); try { @@ -208,6 +210,7 @@ public void run() } catch (final InterruptedException exc) {} +*/ } if (currentActionAborted) { diff --git a/java/jscope/src/main/java/mds/jscope/jScopeMultiWave.java b/java/jscope/src/main/java/mds/jscope/jScopeMultiWave.java index 16b2f0a0b2..98555d01ea 100644 --- a/java/jscope/src/main/java/mds/jscope/jScopeMultiWave.java +++ b/java/jscope/src/main/java/mds/jscope/jScopeMultiWave.java @@ -256,10 +256,10 @@ public void Refresh() } catch (final IOException e) {} - final Thread p = new Thread() - { - @Override - public void run() + // final Thread p = new Thread() + // { + // @Override + // public void run() { final MdsWaveInterface mwi = (MdsWaveInterface) wi; try @@ -277,8 +277,8 @@ public void run() } }); } - }; - p.start(); + // }; + // p.start(); } public void RefreshOnEvent() diff --git a/java/jtraverser/src/main/java/mds/jtraverser/CompileTree.java b/java/jtraverser/src/main/java/mds/jtraverser/CompileTree.java index 425ba998b8..bd279a7e0a 100644 --- a/java/jtraverser/src/main/java/mds/jtraverser/CompileTree.java +++ b/java/jtraverser/src/main/java/mds/jtraverser/CompileTree.java @@ -17,8 +17,8 @@ public static void main(String args[]) int shot = -1; if (args.length < 1) { - System.out.println("Usage: java CompileTree []"); - System.exit(0); + System.err.println("Usage: java CompileTree []"); + System.exit(1); } experiment = args[0]; if (args.length > 1) @@ -29,8 +29,8 @@ public static void main(String args[]) } catch (final Exception exc) { - System.out.println("Error Parsing shot number"); - System.exit(0); + System.err.println("Error Parsing shot number"); + System.exit(1); } } (new CompileTree(experiment, shot)).start(); @@ -124,7 +124,7 @@ void recCompile(Element node) } catch (final Exception exc) { - System.out.println("Error writing data: " + exc); + System.err.println("Error writing data: " + exc); } } return; @@ -168,7 +168,7 @@ void recCompile(Element node) } catch (final Exception exc) { - System.out.println("Error adding member " + name + " : " + exc); + System.err.println("Error adding member " + name + " : " + exc); } } if (type.equals("member")) @@ -183,7 +183,7 @@ void recCompile(Element node) } catch (final Exception exc) { - System.out.println("Error adding member " + name + " : " + exc); + System.err.println("Error adding member " + name + " : " + exc); } } if (type.equals("device")) @@ -210,7 +210,7 @@ void recCompile(Element node) } catch (final Exception exc) { - System.out.println("WARNING: device field " + name + " not found in model "); + System.err.println("WARNING: device field " + name + " not found in model "); } } if (success) @@ -231,7 +231,7 @@ void recCompile(Element node) } catch (final Exception exc) { - System.out.println("Error adding tags " + tagsStr + " : " + exc); + System.err.println("Error adding tags " + tagsStr + " : " + exc); } } // flags @@ -262,7 +262,7 @@ void recCompile(Element node) } catch (final Exception exc) { - System.out.println("Error setting flags to node " + name + " : " + exc); + System.err.println("Error setting flags to node " + name + " : " + exc); } } // state @@ -278,7 +278,7 @@ void recCompile(Element node) } catch (final Exception exc) { - // System.out.println("Error setting state of node " + name + " : " + exc); + // System.err.println("Error setting state of node " + name + " : " + exc); } } // Descend @@ -294,7 +294,7 @@ void recCompile(Element node) } catch (final Exception exc) { - System.out.println("Internal error in recCompile: " + exc); + System.err.println("Internal error in recCompile: " + exc); exc.printStackTrace(); } } @@ -312,8 +312,8 @@ public void run() catch (final SAXParseException spe) { // Error generated by the parser - System.out.println("\n** Parsing error" + ", line " + spe.getLineNumber() + ", uri " + spe.getSystemId()); - System.out.println(" " + spe.getMessage()); + System.err.println("\n** Parsing error" + ", line " + spe.getLineNumber() + ", uri " + spe.getSystemId()); + System.err.println(" " + spe.getMessage()); // Use the contained exception, if any Exception x = spe; if (spe.getException() != null) @@ -344,8 +344,8 @@ public void run() } catch (final Exception exc) { - System.out.println(exc); - System.exit(0); + System.err.println(exc); + System.exit(1); } final Element rootNode = document.getDocumentElement(); final NodeList nodes = rootNode.getChildNodes(); @@ -371,7 +371,7 @@ public void run() } catch (final Exception exc) { - System.out.println("Error renaming node of " + deviceName + " to " + newName + " : " + exc); + System.err.println("Error renaming node of " + deviceName + " to " + newName + " : " + exc); } } for (int i = 0; i < unresolvedNidV.size(); i++) @@ -381,13 +381,13 @@ public void run() MDSplus.Data data = null; try { - // System.out.println((String) unresolvedExprV.elementAt(i)); + // System.err.println((String) unresolvedExprV.elementAt(i)); tree.setDefault(unresolvedNidV.elementAt(i)); data = tree.tdiCompile(unresolvedExprV.elementAt(i)); } catch (final Exception exc) { - System.out.println("Error parsing expression " + unresolvedExprV.elementAt(i) + " : " + exc); + System.err.println("Error parsing expression " + unresolvedExprV.elementAt(i) + " : " + exc); } try { @@ -395,7 +395,7 @@ public void run() } catch (final Exception exc) { - System.out.println("Error writing data: " + exc); + System.err.println("Error writing data: " + exc); } } //Set subtrees (apparently this must be done at the end.... @@ -407,7 +407,7 @@ public void run() } catch (final Exception exc) { - System.out.println("Error setting subtree: " + exc); + System.err.println("Error setting subtree: " + exc); } } try @@ -417,7 +417,7 @@ public void run() } catch (final Exception exc) { - System.out.println("Error closeing tree: " + exc); + System.err.println("Error closing tree: " + exc); } } } diff --git a/java/jtraverser/src/main/java/mds/jtraverser/Node.java b/java/jtraverser/src/main/java/mds/jtraverser/Node.java index 43265f4f8f..a31f1bf198 100644 --- a/java/jtraverser/src/main/java/mds/jtraverser/Node.java +++ b/java/jtraverser/src/main/java/mds/jtraverser/Node.java @@ -7,6 +7,7 @@ //package jTraverser; import java.text.SimpleDateFormat; import java.util.HashMap; +import java.lang.reflect.InvocationTargetException; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; @@ -771,13 +772,18 @@ public void setupDevice() } catch (final Exception e) { + if (e instanceof InvocationTargetException) { + // Exceptions thrown through reflected code are wrapped in InvocationTargetException + // so we call printStackTrace to allow debugging + e.printStackTrace(); + } + /* * try { nid.doMethod("dw_setup") ; } catch(Exception exc) */ { - JOptionPane.showMessageDialog(FrameRepository.frame, "Class " + e.getMessage() + " not found", + JOptionPane.showMessageDialog(FrameRepository.frame, "Class " + e + " not found", "Error in device setup 4", JOptionPane.WARNING_MESSAGE); - // e.printStackTrace(); return; } } diff --git a/java/mdsobjects/Makefile.am b/java/mdsobjects/Makefile.am index 0a71deb473..3ad424cd1b 100644 --- a/java/mdsobjects/Makefile.am +++ b/java/mdsobjects/Makefile.am @@ -1,4 +1,4 @@ -JAVASOURCE = 6 +JAVASOURCE = 8 DEPENDENCIES = $(srcdir)/src/main/resources/javax.json-1.0.4.jar include ../Makefile.inc.am diff --git a/java/mdsobjects/src/main/java/MDSplus/Apd.java b/java/mdsobjects/src/main/java/MDSplus/Apd.java index 65463243c5..241786bd4d 100644 --- a/java/mdsobjects/src/main/java/MDSplus/Apd.java +++ b/java/mdsobjects/src/main/java/MDSplus/Apd.java @@ -65,10 +65,12 @@ public Data getDescAt(int idx) { return descs[idx]; } + public int[] getShape() { - return new int[]{descs.length}; + return new int[]{nDescs}; } + protected void resizeDescs(int newDim) { if (descs == null) diff --git a/java/mdsobjects/src/main/java/MDSplus/Connection.java b/java/mdsobjects/src/main/java/MDSplus/Connection.java index 19d7d10e21..eef1cb2d29 100644 --- a/java/mdsobjects/src/main/java/MDSplus/Connection.java +++ b/java/mdsobjects/src/main/java/MDSplus/Connection.java @@ -96,21 +96,55 @@ public Data get(java.lang.String expr, Data args[]) throws MdsException { if (!checkArgs(args)) throw new MdsException( - "Invalid arguments: only scalars and arrays arguments can be passed to COnnection.get()"); - return get(sockId, expr, args); + "Invalid arguments: only scalars and arrays arguments can be passed to Connection.get()"); + java.lang.String expandedExpr; + if(expr.equals("$")) + { + expandedExpr = "serializeout(`("+expr+"))"; + } + else + { + expandedExpr = "serializeout(`(data(("+expr+"))))"; + } + Data serData = get(sockId, expandedExpr, args); + return Data.deserialize(serData.getByteArray()); + } public Data get(java.lang.String expr) throws MdsException { - return get(expr, new Data[0]); + java.lang.String expandedExpr = "serializeout(`(data(("+expr+"))))"; + Data serData = get(sockId, expandedExpr, new Data[0]); + if(serData instanceof Array) + return Data.deserialize(serData.getByteArray()); + else //error code + return serData; } - public void put(java.lang.String path, java.lang.String expr, Data args[]) throws MdsException + public void put(java.lang.String path, java.lang.String expr, Data inArgs[]) throws MdsException { + Data args[] = new Data[inArgs.length]; + //Check if any passed argument is Apd + boolean serialized = false; + for(int i = 0; i < inArgs.length; i++) + { + if(inArgs[i] instanceof Apd) + { + serialized = true; + } + } + + for(int i = 0; i < inArgs.length; i++) + { + if(serialized) + args[i] = new Uint8Array(inArgs[i].serialize()); + else + args[i] = inArgs[i]; + } if (!checkArgs(args)) throw new MdsException( "Invalid arguments: only scalars and arrays arguments can be passed to COnnection.put()"); - put(sockId, path, expr, args); + put(sockId, path, expr, args, serialized); } public void put(java.lang.String path, java.lang.String expr) throws MdsException @@ -136,7 +170,7 @@ public void put(java.lang.String path, Data data) throws MdsException public native Data get(int sockId, java.lang.String expr, Data args[]) throws MdsException; - public native void put(int sockId, java.lang.String path, java.lang.String expr, Data args[]) throws MdsException; + public native void put(int sockId, java.lang.String path, java.lang.String expr, Data args[], boolean serialized) throws MdsException; public GetMany getMany() { return new GetManyInConnection(); } @@ -145,7 +179,19 @@ public PutMany putMany() { return new PutManyInConnection(); } - + public static void main(java.lang.String args[]) + { + try { + + MDSplus.Connection c = new MDSplus.Connection("localhost:8001"); + c.openTree("test", -1); + System.out.println(c.get("anyapd")); + }catch(Exception exc) + { + System.out.println(exc); + } + } + ////////// GetMany class GetManyInConnection extends List implements GetMany { @@ -288,5 +334,7 @@ public void checkStatus(java.lang.String path) throws MdsException throw new MdsException(retMsg.getString()); } } + + } diff --git a/java/mdsobjects/src/main/java/MDSplus/Data.java b/java/mdsobjects/src/main/java/MDSplus/Data.java index 9a8ab19b85..1292811f15 100644 --- a/java/mdsobjects/src/main/java/MDSplus/Data.java +++ b/java/mdsobjects/src/main/java/MDSplus/Data.java @@ -453,10 +453,12 @@ public java.lang.String[] getStringArray() throws MdsException return data.getStringArray(); } - public int getSize() + public int getSize() throws MdsException { - final Data data = data(); - return data.getSize(); + final Data data = executeWithContext("SIZE($1)", this); + if (!(data instanceof Int32)) + throw new MdsException("Cannot get data size"); + return data.getInt(); } public int getSizeInBytes() diff --git a/java/mdsobjects/src/main/java/MDSplus/List.java b/java/mdsobjects/src/main/java/MDSplus/List.java index 437191383e..69f5e9fa4e 100644 --- a/java/mdsobjects/src/main/java/MDSplus/List.java +++ b/java/mdsobjects/src/main/java/MDSplus/List.java @@ -10,6 +10,7 @@ public List() public List(Data[] descs) { super(descs, null, null, null, null); + dtype = DTYPE_LIST; } public List(Data[] descs, Data help, Data units, Data error, Data validation) diff --git a/java/mdsplus/Makefile.am b/java/mdsplus/Makefile.am index bb93661f43..4712490d69 100644 --- a/java/mdsplus/Makefile.am +++ b/java/mdsplus/Makefile.am @@ -1,4 +1,4 @@ -JAVASOURCE = 6 +JAVASOURCE = 8 include ../Makefile.inc.am java_srcdir = $(srcdir)/src/main/java diff --git a/javamds/MDSplus_Connection.h b/javamds/MDSplus_Connection.h index 55a6905648..9e955d7864 100644 --- a/javamds/MDSplus_Connection.h +++ b/javamds/MDSplus_Connection.h @@ -63,7 +63,7 @@ extern "C" */ JNIEXPORT void JNICALL Java_MDSplus_Connection_put(JNIEnv *, jobject, jint, jstring, jstring, - jobjectArray); + jobjectArray, jboolean); #ifdef __cplusplus } diff --git a/javamds/mdsobjects.c b/javamds/mdsobjects.c index 61a2390af8..8cf411be12 100644 --- a/javamds/mdsobjects.c +++ b/javamds/mdsobjects.c @@ -3909,7 +3909,7 @@ Java_MDSplus_Connection_get(JNIEnv *env, jobject obj __attribute__((unused)), */ JNIEXPORT void JNICALL Java_MDSplus_Connection_put( JNIEnv *env, jobject obj __attribute__((unused)), jint sockId, - jstring jPath, jstring jExpr, jobjectArray jArgs) + jstring jPath, jstring jExpr, jobjectArray jArgs, jboolean serialized) { const char *expr = (*env)->GetStringUTFChars(env, jExpr, 0); const char *inPath = (*env)->GetStringUTFChars(env, jPath, 0); @@ -3936,12 +3936,25 @@ JNIEXPORT void JNICALL Java_MDSplus_Connection_put( else strcpy(path, inPath); + if(serialized) + { + putExpr = malloc(strlen("TreePutDeserialized(") + strlen(expr) + strlen(path) + 5 + + nArgs * 2 + 2); + if (nArgs > 0) + sprintf(putExpr, "TreePutDeserialized(\'%s\',\'%s\',", path, expr); + else + sprintf(putExpr, "TreePutDeserialized(\'%s\',\'%s\'", path, expr); + } + else + { putExpr = malloc(strlen("TreePut(") + strlen(expr) + strlen(path) + 5 + nArgs * 2 + 2); if (nArgs > 0) sprintf(putExpr, "TreePut(\'%s\',\'%s\',", path, expr); else sprintf(putExpr, "TreePut(\'%s\',\'%s\'", path, expr); + + } for (varIdx = 0; varIdx < nArgs; varIdx++) { if (varIdx < nArgs - 1) diff --git a/m4/m4_ax_c_flags.m4 b/m4/m4_ax_c_flags.m4 new file mode 100644 index 0000000000..850a73bc34 --- /dev/null +++ b/m4/m4_ax_c_flags.m4 @@ -0,0 +1,21 @@ +# +# SYNOPSIS +# +# AX_C_FLAGS([C variable name]) +# +# DESCRIPTION +# + +# AX_C_FLAGS([C variable name]) +# +AC_DEFUN([AX_C_FLAGS],[ + AX_COMPILER_VERSION + + if [ test x"$GCC" = x"yes" ]; then + # GCC 12+ triggers a lot of false-positives + AX_COMPARE_VERSION([${ax_cv_c_compiler_version}], [ge], [12.0.0], + [AS_VAR_SET([_c_cxx_flags_fix],["-Wno-strict-aliasing -Wno-uninitialized -Wno-clobbered -Wno-stringop-overflow -Wno-array-bounds -Wno-use-after-free -Wno-nonnull"])]) + AS_VAR_APPEND([$1],[" ${_c_cxx_flags_fix}"]) + fi +]) + diff --git a/matlab/mdsput.m b/matlab/mdsput.m index 5d03c05d55..31cb3d7ce8 100755 --- a/matlab/mdsput.m +++ b/matlab/mdsput.m @@ -1,5 +1,51 @@ function [ status ] = mdsput( node, expression, varargin) % MDSPUT put data into MDSplus tree node -% This routine invokes treeput(node, expression, ...) -status = mdsvalue(sprintf('treeput($, $%s)', repmat(', $', 1, nargin - 2)), node, expression, varargin{:}); +% This routine uses the java or python interface +info = mdsInfo(); +n = nargin - 2; +if info.usePython + args = cell(n, 1); +else + if info.isConnected + extra = 0; + else + extra = 1; + end + args = javaArray('MDSplus.Data', max(1, n + extra)); +end +for k = 1 : n + argin = varargin(k); + if iscell(argin{1}) + argout = mdsFromMatlab(argin{1}); + else + argout = mdsFromMatlab(cell2mat(argin)); + end + if info.usePython + args{k} = argout; + else + args(k) = argout; + end +end +try + if info.isConnected + if n > 0 + if info.usePython + info.connection.put(node, expression, args{:}); + else + info.connection.put(node, expression, args); + end + else + info.connection.put(node, expression); + end + else + [mdsres, mdsok] = mdsvalue(sprintf('treeput($, $%s)', repmat(', $', 1, nargin - 2)), node, expression, varargin{:}); + if mdsok==0 || ~isnumeric(mdsres) || rem(mdsres,2)==0 + throw(MException('MDSplus:treeput', 'treeput error %d: %s', mdsok, string(mdsres))); + end + end + status = 1; +catch err + status = 0; + error(err.message); +end diff --git a/matlab/private/javaFromMatlab.m b/matlab/private/javaFromMatlab.m index 510428e09d..6cd58c642d 100644 --- a/matlab/private/javaFromMatlab.m +++ b/matlab/private/javaFromMatlab.m @@ -21,7 +21,8 @@ case 'uint8' javaclass = 'MDSplus.Uint8'; case 'cell' - javaclass = 'MDSplus.String'; + result = javaFromMatlabCell(value); + return case 'struct' result = javaFromMatlabStruct(value); return @@ -31,11 +32,10 @@ result = javaObject('MDSplus.String', value); return otherwise - result = value; - return + throw(MException('MDSplus:javaFromMatlab', 'Unsupported type')) end sz = size(value); -if isequal(sz, [1, 1]) +if isscalar(value) result = javaObject(javaclass, value); else result = javaObject(strcat(javaclass, 'Array'), reshape(value, [], 1), sz); diff --git a/matlab/private/javaFromMatlabCell.m b/matlab/private/javaFromMatlabCell.m new file mode 100644 index 0000000000..b486acd2dd --- /dev/null +++ b/matlab/private/javaFromMatlabCell.m @@ -0,0 +1,33 @@ +function result = javaFromMatlabCell(value) + if ~iscell(value) + throw(MException('MDSplus:javaFromMatlabCell', 'only cell allowed')); + end + result = MDSplus.Apd(); + if isscalar(value) + result.setDescAt(0, javaFromMatlab(value{:})); + elseif isvector(value) + numItems = length(value); + for itemIdx = 1:numItems + if isrow(value) + result.setDescAt(itemIdx - 1, javaFromMatlab(value{itemIdx})); + else + result.setDescAt(itemIdx - 1, javaFromMatlab({value{itemIdx}})); + end + end + elseif ismatrix(value) + elemSize = size(value); + for rowIdx = 1:elemSize(1) + result.setDescAt(rowIdx - 1, javaFromMatlab(value(rowIdx,:))); + end + else + elemSize = size(value); + n = ndims(value); + idx = cell(1,n); + idx(:) = {':'}; + for currDim = 1:elemSize(end) + idx{end} = currDim; + result.setDescAt(currDim - 1, javaFromMatlab(value(idx{:}))); + end + end + +end \ No newline at end of file diff --git a/matlab/private/javaFromMatlabStruct.m b/matlab/private/javaFromMatlabStruct.m index 12ab9a93c8..e1ba6dbcf3 100644 --- a/matlab/private/javaFromMatlabStruct.m +++ b/matlab/private/javaFromMatlabStruct.m @@ -1,5 +1,5 @@ function result = javaFromMatlabStruct(value) - if ~strcmp(class(value), 'struct') + if ~isstruct(value) throw(MException('MDSplus:javaFromMatlabStruct', 'only struct allowed')); end @@ -9,16 +9,36 @@ for fieldIdx = 1:length(fields) fieldName = fields{fieldIdx}; fieldValue = value.(fieldName); - javaFromMatlab(fieldValue); result.setItem(MDSplus.String(fieldName), javaFromMatlab(fieldValue)); end - else - result = MDSplus.Apd(); + elseif isvector(value) + result = MDSplus.List(); numItems = length(value); for itemIdx = 1:numItems - result.setDescAt(itemIdx - 1, javaFromMatlab(value(itemIdx))); + if isrow(value) + result.append(javaFromMatlabStruct(value(itemIdx))); + else + temp = MDSplus.List(); + temp.append(javaFromMatlabStruct(value(itemIdx))); + result.append(temp); + end + end + elseif ismatrix(value) + result = MDSplus.List(); + elemSize = size(value); + for rowIdx = 1:elemSize(1) + result.append(javaFromMatlabStruct(value(rowIdx,:))); + end + else + result = MDSplus.List(); + elemSize = size(value); + n = ndims(value); + idx = cell(1,n); + idx(:) = {':'}; + for currDim = 1:elemSize(end) + idx{end} = currDim; + result.append(javaFromMatlab(value(idx{:}))); end - end end \ No newline at end of file diff --git a/matlab/private/javaToMatlab.m b/matlab/private/javaToMatlab.m index 8915ca5a5a..a55cbd78eb 100644 --- a/matlab/private/javaToMatlab.m +++ b/matlab/private/javaToMatlab.m @@ -31,11 +31,13 @@ case 'MDSplus.Float32Array' result = reshape(mdsthing.getFloatArray, shape); case 'MDSplus.StringArray' - result = reshape(cellstr(string(mdsthing.getStringArray)), shape); + result = reshape(string(mdsthing.getStringArray), shape); case 'MDSplus.Dictionary' result = javaToMatlabStruct(mdsthing); - case 'MDSplus.Apd' + case 'MDSplus.List' result = javaToMatlabStruct(mdsthing); + case 'MDSplus.Apd' + result = javaToMatlabCell(mdsthing); otherwise throw(MException('MDSplus:mdsToMatlab', 'class %s not supported by mdsToMatlab function\n', class(mdsthing))); end diff --git a/matlab/private/javaToMatlabCell.m b/matlab/private/javaToMatlabCell.m new file mode 100755 index 0000000000..39e110dec0 --- /dev/null +++ b/matlab/private/javaToMatlabCell.m @@ -0,0 +1,32 @@ +function result = javaToMatlabCell(value) + if ~isa(value, 'MDSplus.Apd') + throw(MException('MDSplus:javaToMatlabCell', 'only MDSplus.Apd allowed')); + end + fields = value.getDescs(); + numItems = length(fields); + itemClasses = arrayfun(@class, fields, 'UniformOutput', false); + result = {}; + for itemIdx = 1:numItems + currElem = javaToMatlab(fields(itemIdx)); + if all(string(itemClasses)=='MDSplus.Apd') && numItems ~= 1 + + % build the index + if isscalar(currElem) || isvector(currElem) + numDims = 2; + else + numDims = ndims(currElem) + 1; + end + idx = cell(1, numDims); + idx(:) = {':'}; + if isscalar(currElem) || isvector(currElem) + idx{1} = itemIdx; + else + idx{end} = itemIdx; + end + + result(idx{:}) = currElem; + else + result(:, itemIdx) = {currElem}; + end + end +end \ No newline at end of file diff --git a/matlab/private/javaToMatlabStruct.m b/matlab/private/javaToMatlabStruct.m index a09ad98dfb..5e8665676f 100644 --- a/matlab/private/javaToMatlabStruct.m +++ b/matlab/private/javaToMatlabStruct.m @@ -1,21 +1,45 @@ function result = javaToMatlabStruct(value) - if ~strcmp(class(value), 'MDSplus.Dictionary') && ~strcmp(class(value), 'MDSplus.Apd') - throw(MException('MDSplus:javaToMatlabStruct', 'only MDSplus.Dictionary or MDSplus.Apd allowed')); - end - fields = value.getDescs(); - if strcmp(class(value), 'MDSplus.Dictionary') - numItems = length(fields)/2; - for itemIdx = 1:numItems - fieldName = javaToMatlab(fields(itemIdx * 2 - 1)); - fieldValue = javaToMatlab(fields(itemIdx * 2)); - result.(fieldName) = fieldValue; - end - else - numItems = length(fields); - for itemIdx = 1:numItems - result(itemIdx) = javaToMatlab(fields(itemIdx)); - end - - end - + if ~isa(value, 'MDSplus.Dictionary') && ~isa(value, 'MDSplus.List') + throw(MException('MDSplus:javaToMatlabStruct', 'only MDSplus.Dictionary and MDSplus.List allowed')); + end + fields = value.getDescs(); + if value.getSize() == 0 + result = struct(); + end + if isa(value, 'MDSplus.Dictionary') % structure + numItems = length(fields)/2; + for itemIdx = 1:numItems + fieldName = javaToMatlab(fields(itemIdx * 2 - 1)); + fieldValue = javaToMatlab(fields(itemIdx * 2)); + result.(fieldName) = fieldValue; + end + else + numItems = length(fields); + itemClasses = arrayfun(@class, fields, 'UniformOutput', false); + for itemIdx =1:numItems + if all(string(itemClasses)=='MDSplus.Dictionary') % list of dict mapped to struct array + result(itemIdx) = javaToMatlabStruct(fields(itemIdx)); + elseif all(string(itemClasses)=='MDSplus.List') % struct matrix + currElem = javaToMatlab(fields(itemIdx)); + + % build the index + if isscalar(currElem) || isvector(currElem) + numDims = 2; + else + numDims = ndims(currElem) + 1; + end + idx = cell(1, numDims); + idx(:) = {':'}; + if isscalar(currElem) || isvector(currElem) + idx{1} = itemIdx; + else + idx{end} = itemIdx; + end + + result(idx{:}) = currElem; + else + throw(MException('MDSplus:javaToMatlabStruct', 'incompatible types')); + end + end + end end \ No newline at end of file diff --git a/mdsdcl/Makefile.in b/mdsdcl/Makefile.in index 0e62d87bce..3f67426b54 100644 --- a/mdsdcl/Makefile.in +++ b/mdsdcl/Makefile.in @@ -10,6 +10,7 @@ VPATH=@srcdir@ CFLAGS += -I$(srcdir) @MINGW_TRUE@ IMPLIB=@MAKELIBDIR@Mdsdcl.dll.a +@MINGW_TRUE@CFLAGS += -DLIBXML_STATIC @MINGW_TRUE@ XML_LIBS=-Wl,-Bstatic -lxml2 -lz @LIBLZMA@ -Wl,-Bdynamic -liconv @LIBDL@ $(LIBSOCKET) @MINGW_FALSE@ XML_LIBS=@XML_LIBS@ @LIBDL@ diff --git a/mdsdcl/cmdExecute.c b/mdsdcl/cmdExecute.c index 121d74a118..b0661faf10 100644 --- a/mdsdcl/cmdExecute.c +++ b/mdsdcl/cmdExecute.c @@ -43,6 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "dcl_p.h" #include "mdsdclthreadstatic.h" +#define ERROR_MESSAGE_LENGTH 512 + /*! Free the memory associated with a parameter definition structure. \param p [in,out] the address of a pointer to a dclParameter struct. */ @@ -672,8 +674,8 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, } if (j == cmdDef->qualifier_count) { - char *errstr = malloc(100); - sprintf(errstr, "Qualifier \"%s\" is not valid for this command\n", + char *errstr = malloc(ERROR_MESSAGE_LENGTH); + snprintf(errstr, ERROR_MESSAGE_LENGTH, "Qualifier \"%s\" is not valid for this command\n", cmd->qualifiers[i]->name); *error = errstr; return MdsdclIVQUAL; @@ -683,8 +685,8 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, if (cmd->parameter_count > cmdDef->parameter_count) { - char *errstr = malloc(100); - sprintf(errstr, + char *errstr = malloc(ERROR_MESSAGE_LENGTH); + snprintf(errstr, ERROR_MESSAGE_LENGTH, "Too many parameters specified in the command. Maximum supported " "is %d. Provided was %d.\n", cmdDef->parameter_count, cmd->parameter_count); @@ -703,8 +705,9 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, { if ((i < cmd->parameter_count) && (cmd->parameters[i]->value_count > 1)) { - char *errstr = malloc(500); - sprintf(errstr, + char *errstr = malloc(ERROR_MESSAGE_LENGTH); + snprintf(errstr, + ERROR_MESSAGE_LENGTH, "Parameter number %d does not accept a list of values. " "Perhaps that parameter needs to enclosed in double quotes?\n", i + 1); @@ -775,8 +778,8 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, { if (cmd->qualifiers[q]->value_count == 0) { - char *errstr = malloc(100); - sprintf(errstr, + char *errstr = malloc(ERROR_MESSAGE_LENGTH); + snprintf(errstr, ERROR_MESSAGE_LENGTH, "Qualifier \"%s\" requires a value and none was provided\n", cmdDef->qualifiers[i]->name); *error = errstr; @@ -870,8 +873,8 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, if ((cmd->qualifiers[i]->value_count > 1) && (cmdDef->qualifiers[q]->listOk == 0)) { - char *errstr = malloc(100); - sprintf(errstr, "Qualifier \"%s\" does not permit a list of values\n", + char *errstr = malloc(ERROR_MESSAGE_LENGTH); + snprintf(errstr, ERROR_MESSAGE_LENGTH, "Qualifier \"%s\" does not permit a list of values\n", cmdDef->qualifiers[i]->name); *error = errstr; return MdsdclTOO_MANY_VALS; @@ -884,8 +887,8 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, { if (cmdDef->qualifiers[q]->nonnegatable) { - char *errstr = malloc(100); - sprintf(errstr, "Qualifier \"%s\" cannot be negated\n", realname); + char *errstr = malloc(ERROR_MESSAGE_LENGTH); + snprintf(errstr, ERROR_MESSAGE_LENGTH, "Qualifier \"%s\" cannot be negated\n", realname); *error = errstr; return MdsdclNOTNEGATABLE; } @@ -904,8 +907,8 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, } if (q == cmdDef->qualifier_count) { - char *errstr = malloc(100); - sprintf(errstr, "Qualifier \"%s\" is not valid for this command\n", + char *errstr = malloc(ERROR_MESSAGE_LENGTH); + snprintf(errstr, ERROR_MESSAGE_LENGTH, "Qualifier \"%s\" is not valid for this command\n", cmd->qualifiers[i]->name); *error = errstr; return MdsdclIVQUAL; @@ -938,8 +941,9 @@ static int dispatchToHandler(char *image, dclCommandPtr cmd, if ((*error == 0) && (status != 0)) { char *msg = MdsGetMsg(status); - *error = malloc(strlen(msg) + 100); - sprintf(*error, "Error message was: %s\n", msg); + size_t length = strlen(msg) + 100; + *error = malloc(length); + snprintf(*error, length, "Error message was: %s\n", msg); } else if (*error == 0) *error = strdup(""); @@ -1320,8 +1324,9 @@ EXPORT int mdsdclAddCommands(const char *name_in, char **error) if (doc == 0) { pthread_mutex_unlock(&lock); - char *errstr = malloc(strlen(filename) + 50); - sprintf(errstr, " Error: unable to parse %s\n", filename); + size_t length = strlen(filename) + 50; + char *errstr = malloc(length); + snprintf(errstr, length, " Error: unable to parse %s\n", filename); *error = errstr; status = -1; } diff --git a/mdsdcl/mdsdcl_show_version.c b/mdsdcl/mdsdcl_show_version.c index b995076a6b..fd1e04df3c 100644 --- a/mdsdcl/mdsdcl_show_version.c +++ b/mdsdcl/mdsdcl_show_version.c @@ -13,24 +13,21 @@ extern MDSplusGitVersionInfo MDSplusGitVersion; extern const mds_version_t MdsVersion; extern const char *MdsRelease(); +extern const char *MdsReleaseDate(); EXPORT int mdsdcl_show_version(void *ctx __attribute__((unused)), char **error __attribute__((unused)), char **output) { + const char *tag = MdsRelease(); char *info = *output = malloc(1024); info += sprintf(info, "\n\n"); - info += sprintf(info, "MDSplus version: %d.%d.%d\n", MdsVersion.MAJOR, - MdsVersion.MINOR, MdsVersion.MICRO); + info += sprintf(info, "MDSplus version: %d.%d.%d\n", MdsVersion.MAJOR, MdsVersion.MINOR, MdsVersion.MICRO); info += sprintf(info, "----------------------\n"); - const char *tag = MdsRelease(); info += sprintf(info, " Release: %s\n", tag); - info += sprintf( - info, " Browse: https://github.com/MDSplus/mdsplus/tree/%s\n", tag); - info += sprintf( - info, - " Download: https://github.com/MDSplus/mdsplus/archive/%s.tar.gz\n", - tag); + info += sprintf(info, " Date: %s\n", MdsReleaseDate()); + info += sprintf(info, " Browse: https://github.com/MDSplus/mdsplus/tree/%s\n", tag); + info += sprintf(info, " Download: https://github.com/MDSplus/mdsplus/releases/tag/%s\n", tag); info += sprintf(info, "\n\n"); return 1; } diff --git a/mdsmisc/MdsFilter.c b/mdsmisc/MdsFilter.c index d5b0f08e6a..55fbb12201 100644 --- a/mdsmisc/MdsFilter.c +++ b/mdsmisc/MdsFilter.c @@ -32,55 +32,101 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* *4 21-NOV-1994 14:08:37 MDSPLUS "Boh?" */ /* *3 21-NOV-1994 14:07:40 MDSPLUS "Boh?" */ /* *2 21-NOV-1994 13:53:26 MDSPLUS "Boh?" */ -/* *1 21-NOV-1994 13:11:53 MDSPLUS "Low pass filter (10 poles Butterworth)" - */ +/* *1 21-NOV-1994 13:11:53 MDSPLUS "Low pass filter (10 poles Butterworth)" */ /* DEC/CMS REPLACEMENT HISTORY, Element MDS$FILTER.C */ /*------------------------------------------------------------------------------ - Name: MDS$FILTER + Name: MDS$FILTER - Type: C function + Type: C function - Author: Gabriele Manduchi - Istituto Gas Ionizzati del CNR - Padova (Italy) + Author: Gabriele Manduchi + Istituto Gas Ionizzati del CNR - Padova (Italy) - Date: 21-NOV-1994 + Date: 21-NOV-1994 - Purpose: Filter a signal using a 10 poles Butterworth filter and Impulse -Invariance Method --------------------------------------------------------------------------------- -*/ -#include "filter.h" -#include + Purpose: Filter a signal using a 10 poles Butterworth filter and Impulse Invariance Method +-------------------------------------------------------------------------------- */ #include +#include #include #include -#include +#include +#include +#include "filter.h" + +// Check whether the signal has been originated by MinMax resampling, i.e. whether the X values are the same in pairs +//If not, copy the signal, otherwise build a signal with half the points, removing dumplicated X dimension and replacing the +//corresponding par of Y samples with their average -EXPORT struct descriptor_xd *MdsFilter(float *in_data, float *in_dim, int *size, - float *cut_off, int *num_in_poles) +static void checkSignal(float *inData, float *inDim, int size, float **outData, float **outDim, int *retSize, double *outDelta) { - static struct descriptor_xd out_xd = {0, DTYPE_DSC, CLASS_XD, 0, 0}; + int i; + + if(size > 4 && (inDim[0] == inDim[1] && inDim[2] == inDim[3])) + { //Derived from MinMax resampling + *outData = (float *)malloc(sizeof(float)*size); + *outDim = (float *)malloc(sizeof(float)*size); + for(i = 0; i < size - 1; i++) + { + (*outData)[i] = inData[i]; + (*outDim)[i] = (inDim[i] + inDim[i+1])/2.; + *retSize = size; + } + (*outDim)[size - 1] = inDim[size - 1]; + (*outData)[size - 1] = inData[size - 1]; + } + else + { + *outData = (float *)malloc(sizeof(float)*size); + *outDim = (float *)malloc(sizeof(float)*size); + memcpy(*outData, inData,sizeof(float)*size); + memcpy(*outDim, inDim,sizeof(float)*size); + *retSize = size; + } + *outDelta = 0; + for(i = 0; i < size - 1; i++) + { + *outDelta += (*outDim)[i+1] - (*outDim)[i]; + } + *outDelta /= (size - 1); +} + + + +EXPORT struct descriptor_xd *MdsFilter(float *inData, float *inDim, int *inSize, float *cut_off, + int *num_in_poles) +{ + static struct descriptor_xd out_xd = { 0, DTYPE_DSC, CLASS_XD, 0, 0 }; DESCRIPTOR_A(data_d, sizeof(float), DTYPE_FLOAT, 0, 0); DESCRIPTOR_SIGNAL(signal_d, 1, 0, 0); DESCRIPTOR_DIMENSION(dimension_d, 0, 0); DESCRIPTOR_WINDOW(window_d, 0, 0, 0); DESCRIPTOR_RANGE(range_d, 0, 0, 0); - - struct descriptor start_d = {sizeof(float), DTYPE_FLOAT, CLASS_S, 0}, - end_d = {sizeof(float), DTYPE_FLOAT, CLASS_S, 0}, - delta_d = {sizeof(float), DTYPE_FLOAT, CLASS_S, 0}, - start_idx_d = {sizeof(int), DTYPE_L, CLASS_S, 0}, - end_idx_d = {sizeof(int), DTYPE_L, CLASS_S, 0}, - time_at_0_d = {sizeof(float), DTYPE_FLOAT, CLASS_S, 0}; + + + float *in_data = 0, *in_dim = 0; + int size = 0; + + + struct descriptor start_d = { sizeof(float), DTYPE_FLOAT, CLASS_S, 0 }, end_d = { + sizeof(float), DTYPE_FLOAT, CLASS_S, 0}, delta_d = { + sizeof(double), DTYPE_DOUBLE, CLASS_S, 0}, start_idx_d = { + sizeof(int), DTYPE_L, CLASS_S, 0}, end_idx_d = { + sizeof(int), DTYPE_L, CLASS_S, 0}, time_at_0_d = { + sizeof(float), DTYPE_FLOAT, CLASS_S, 0}; int num_samples, num_poles, start_idx, end_idx, i; - float fc, delta, dummy, *filtered_data, start, end, time_at_0; + float fc, dummy, *filtered_data, start, end, time_at_0; + double delta = 0; float phs_steep; float delay = 0.0f; static Filter *filter; + checkSignal(inData, inDim, *inSize, &in_data, &in_dim, &size, &delta); + + if (*num_in_poles > 0) num_poles = *num_in_poles; else @@ -103,7 +149,7 @@ EXPORT struct descriptor_xd *MdsFilter(float *in_data, float *in_dim, int *size, end_d.pointer = (char *)&end; delta_d.pointer = (char *)δ - num_samples = *size; + num_samples = size; fc = 1 / (in_dim[1] - in_dim[0]); filter = ButtwInvar(cut_off, &dummy, &dummy, &dummy, &fc, &num_poles); @@ -113,13 +159,9 @@ EXPORT struct descriptor_xd *MdsFilter(float *in_data, float *in_dim, int *size, float phs[1000]; TestFilter(filter, fc, 1000, mod, phs); - for (i = 1; i < 1000 - 1 && !isnan(phs[i]) && !isnan(phs[i + 1]) && - phs[i] > phs[i + 1]; - i++) - ; + for (i = 1; i < 1000 - 1 && !isnan(phs[i]) && !isnan(phs[i + 1]) && phs[i] > phs[i + 1]; i++) ; - if (i > 1) - { + if (i > 1) { phs_steep = (phs[1] - phs[i]) / ((i / 1000.) * fc / 2.); delay = phs_steep / (2 * PI); } @@ -130,7 +172,7 @@ EXPORT struct descriptor_xd *MdsFilter(float *in_data, float *in_dim, int *size, data_d.arsize = num_samples * sizeof(float); start = in_dim[0] - delay; end = in_dim[num_samples - 1] - delay; - delta = in_dim[1] - in_dim[0]; + //delta = (double)in_dim[1] - (double)in_dim[0]; start_idx = 0; end_idx = num_samples - 1; time_at_0 = in_dim[0] - delay; @@ -138,23 +180,25 @@ EXPORT struct descriptor_xd *MdsFilter(float *in_data, float *in_dim, int *size, MdsCopyDxXd((struct descriptor *)&signal_d, &out_xd); free(filtered_data); + free((char *)in_data); + free((char *)in_dim); return &out_xd; } -EXPORT void PrintFilter(Filter *filter) +EXPORT void PrintFilter(Filter * filter) { int i, j; - for (i = 0; i < filter->num_parallels; i++) - { - // if(filter->units[i].den_degree > 0) + for (i = 0; i < filter->num_parallels; i++) { + //if(filter->units[i].den_degree > 0) { for (j = 0; j < filter->units[i].num_degree; j++) - printf("%f ", filter->units[i].num[j]); + printf("%f ", filter->units[i].num[j]); for (j = 0; j < filter->units[i].den_degree; j++) - printf("%f ", filter->units[i].den[j]); + printf("%f ", filter->units[i].den[j]); printf("\n"); } } } + diff --git a/mdsobjects/cpp/mdsdatastreams.cpp b/mdsobjects/cpp/mdsdatastreams.cpp index 43b2edd83b..ec978f6efc 100644 --- a/mdsobjects/cpp/mdsdatastreams.cpp +++ b/mdsobjects/cpp/mdsdatastreams.cpp @@ -183,7 +183,7 @@ EXPORT void EventStream::send(int shot, const char *name, Data *timesD, Data *sa { bool isAbsTime = (timesD->dtype == DTYPE_Q || timesD->dtype == DTYPE_QU); int nTimes, nSamples; - int *dims; + int *dims = NULL; float *samples, sample; int nDims = 1; diff --git a/mdsobjects/cpp/mdsipobjects.cpp b/mdsobjects/cpp/mdsipobjects.cpp index f8d21c899d..2498c7048e 100644 --- a/mdsobjects/cpp/mdsipobjects.cpp +++ b/mdsobjects/cpp/mdsipobjects.cpp @@ -372,7 +372,7 @@ void Connection::closeAllTrees() throw MdsException(status); } -Data *Connection::get(const char *expr, Data **args, int nArgs) +Data *Connection::get(const char *expr, Data **args, int nArgs, bool serialized) { char clazz, dtype, nDims; short length; @@ -395,8 +395,22 @@ Data *Connection::get(const char *expr, Data **args, int nArgs) } lockLocal(); - status = SendArg(sockId, 0, DTYPE_CSTRING_IP, nArgs + 1, - std::string(expr).size(), 0, 0, (char *)expr); + + if(serialized) + { + std::string expExpr("serializeout(`(data("); + expExpr +=expr; + expExpr += ")))"; + status = SendArg(sockId, 0, DTYPE_CSTRING_IP, nArgs + 1, + expExpr.size(), 0, 0, (char *)expExpr.c_str()); + } + else + { + status = SendArg(sockId, 0, DTYPE_CSTRING_IP, nArgs + 1, + strlen((char *)expr), 0, 0, (char *)expr); + } +// std::string(expr).size(), 0, 0, (char *)expr); + if (STATUS_NOT_OK) { unlockLocal(); @@ -519,10 +533,23 @@ Data *Connection::get(const char *expr, Data **args, int nArgs) if (mem) FreeMessage(mem); - return resData; + + + if(!serialized || nDims == 0) //Error code returned + return resData; + + + Data *deserData = deserialize(resData); //Otherwise deserialze it + deleteData(resData); + + return deserData; +} +void Connection::put(const char *inPath, Data *data) +{ + put(inPath, (char *)"$", &data, 1); } -void Connection::put(const char *inPath, char *expr, Data **args, int nArgs) +void Connection::put(const char *inPath, char *expr, Data **inArgs, int nArgs) { char clazz, dtype, nDims; short length; @@ -532,15 +559,33 @@ void Connection::put(const char *inPath, char *expr, Data **args, int nArgs) int sockId = getSockId(); - // Check whether arguments are compatible (Scalars or Arrays) - for (std::size_t argIdx = 0; argIdx < (std::size_t)nArgs; ++argIdx) + + Data **args; + + //Check id any passed argument is APD. Serialize arguments only in this case + bool serialized = false; + + for(int i = 0; i < nArgs; i++) { - args[argIdx]->getInfo(&clazz, &dtype, &length, &nDims, &dims, &ptr); - if (!ptr) - throw MdsException("Invalid argument passed to Connection::put(). Can " - "only be Scalar or Array"); - if (nDims > 0) - delete[] dims; + if (inArgs[i]->clazz == CLASS_APD) + serialized = true; + } + +//Serialize Arguments + if(serialized) + { + args = new Data*[nArgs]; + for (std::size_t argIdx = 0; argIdx < (std::size_t)nArgs; ++argIdx) + { + int currSerSize; + char *currSer = inArgs[argIdx]->serialize(&currSerSize); + args[argIdx] = new Uint8Array((unsigned char *)currSer, currSerSize); + delete []currSer; + } + } + else + { + args = inArgs; } // Double backslashes!! @@ -548,7 +593,16 @@ void Connection::put(const char *inPath, char *expr, Data **args, int nArgs) if (path.at(0) == '\\') path.insert(path.begin(), '\\'); - std::string putExpr("TreePut(\'"); + std::string putExpr; + if(serialized) + { + putExpr += "TreePutDeserialized(\'"; + } + else + { + putExpr += "TreePut(\'"; + } + putExpr += path + "\',\'" + expr + "\'"; for (int varIdx = 0; varIdx < nArgs; ++varIdx) putExpr += ",$"; @@ -588,6 +642,18 @@ void Connection::put(const char *inPath, char *expr, Data **args, int nArgs) status = *(reinterpret_cast(ptr)); if (mem) FreeMessage(mem); + +//Delete serialize args + if (serialized) + { + for (std::size_t argIdx = 0; argIdx < (std::size_t)nArgs; ++argIdx) + { + deleteData(args[argIdx]); + } + delete [] args; + } + + if (STATUS_NOT_OK) throw MdsException(status); } diff --git a/mdsobjects/cpp/testing/MdsConnectionTest.cpp b/mdsobjects/cpp/testing/MdsConnectionTest.cpp index 72540142af..8a19f055d4 100644 --- a/mdsobjects/cpp/testing/MdsConnectionTest.cpp +++ b/mdsobjects/cpp/testing/MdsConnectionTest.cpp @@ -139,7 +139,7 @@ void test_tree_open(const char *prot, const unsigned short port, int main(int argc, char *argv[]) { int ipv6 = (argc > 1 && !strcmp(argv[1], "ipv6")); - TEST_TIMEOUT(30); + // TEST_TIMEOUT(30); setenv("t_connect_path", ".", 1); #ifdef _WIN32 diff --git a/mdsobjects/cpp/testing/MdsTdiTest.cpp b/mdsobjects/cpp/testing/MdsTdiTest.cpp index a0c791738b..b0554680ce 100644 --- a/mdsobjects/cpp/testing/MdsTdiTest.cpp +++ b/mdsobjects/cpp/testing/MdsTdiTest.cpp @@ -176,8 +176,9 @@ int main(int argc, char *argv[]) if (single) exit(1); - TEST_TIMEOUT(100); + // TEST_TIMEOUT(100); + // TODO: Query the stack size for windows if (stksize < 0x40000) { std::cout << " -- [MultiThread] -- Skipped because the default thread " diff --git a/mdsobjects/cpp/testing/MdsTreeNodeTest.cpp b/mdsobjects/cpp/testing/MdsTreeNodeTest.cpp index 3f1ad232d2..d869f354b2 100644 --- a/mdsobjects/cpp/testing/MdsTreeNodeTest.cpp +++ b/mdsobjects/cpp/testing/MdsTreeNodeTest.cpp @@ -136,7 +136,7 @@ namespace testing void main_test() { - TEST_TIMEOUT(100); + // TEST_TIMEOUT(100); BEGIN_TESTING(TreeNode); @@ -889,8 +889,11 @@ void main_test() delete n1->addDevice("device", "DIO2"); } + // If we don't close the existing "t_treenode" tree, windows will fail when attempting to make a NEW one + tree = NULL; { + // TODO: Rename these so they don't use the same names from the top of this function Tree *tree = new Tree("t_treenode", -1, "NEW"); TreeNode *n = tree->addNode(":DATA", "NUMERIC"); delete n; diff --git a/mdsobjects/cpp/testing/MdsTreeSegments.cpp b/mdsobjects/cpp/testing/MdsTreeSegments.cpp index 51caecea81..dae8a29207 100644 --- a/mdsobjects/cpp/testing/MdsTreeSegments.cpp +++ b/mdsobjects/cpp/testing/MdsTreeSegments.cpp @@ -350,7 +350,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused))) { setenv("t_treeseg_path", ".", 1); - TEST_TIMEOUT(100); + // TEST_TIMEOUT(100); TEST(putSegment); TEST(BlockAndRows); TEST(makeSegment); diff --git a/mdsobjects/cpp/testing/MdsTreeTest.cpp b/mdsobjects/cpp/testing/MdsTreeTest.cpp index 4abd426003..2b5ba53e6b 100644 --- a/mdsobjects/cpp/testing/MdsTreeTest.cpp +++ b/mdsobjects/cpp/testing/MdsTreeTest.cpp @@ -111,7 +111,7 @@ using namespace testing; int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused))) { - TEST_TIMEOUT(100); + // TEST_TIMEOUT(100); BEGIN_TESTING(Tree); #ifdef _WIN32 diff --git a/mdsshr/Makefile.in b/mdsshr/Makefile.in index f05c05ac13..46886951fc 100644 --- a/mdsshr/Makefile.in +++ b/mdsshr/Makefile.in @@ -12,6 +12,7 @@ CFLAGS += $(THREAD) @GLOBUS_CFLAGS@ @XML_CPPFLAGS@ LDFLAGS += $(THREAD) @MINGW_TRUE@IMPLIB = @MAKELIBDIR@MdsShr.dll.a +@MINGW_TRUE@CFLAGS += -DLIBXML_STATIC @MINGW_TRUE@XML_LIBS = -Wl,-Bstatic -lxml2 -lz @LIBLZMA@ -Wl,-Bdynamic -liconv @MINGW_FALSE@XML_LIBS = @XML_LIBS@ LIBS=@LIBS@ @LIBDL@ $(XML_LIBS) @CLOCK_GETTIME_LIB@ $(LIBSOCKET) \ diff --git a/mdstcpip/mdsipshr/ConnectToMds.c b/mdstcpip/mdsipshr/ConnectToMds.c index 5036a821c7..32bb0d9ac3 100644 --- a/mdstcpip/mdsipshr/ConnectToMds.c +++ b/mdstcpip/mdsipshr/ConnectToMds.c @@ -82,7 +82,7 @@ static int do_login(Connection *c) int status = SendMdsMsgC(c, msend, 0); int err; free(msend); - if (STATUS_NOT_OK) + if ((status == SsINTERNAL) || STATUS_NOT_OK) { perror("Error during login: send"); err = C_ERROR; diff --git a/mdstcpip/mdsipshr/Connections.c b/mdstcpip/mdsipshr/Connections.c index 184729e7e8..cb07e0bb50 100644 --- a/mdstcpip/mdsipshr/Connections.c +++ b/mdstcpip/mdsipshr/Connections.c @@ -38,6 +38,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // #define DEBUG #include +// Because threads have their own MdsipThreadStatic data, the receiver thread +// cannot access the connection list that is stored in the main thread. If +// that capability is ever needed, must use a global pointer. However, sharing +// the connection list with both threads is inadvisable because it can result +// in deadlock. Connection *_FindConnection(int id, Connection **prev, MDSIPTHREADSTATIC_ARG) { if (id == INVALID_CONNECTION_ID) @@ -553,7 +558,7 @@ int AcceptConnection(char *protocol, char *info_name, SOCKET readfd, void *info, fprintf(stderr, "Access denied: %s\n", user_p); } msg->h.msglen = sizeof(MsgHdr); - msg->h.status = STATUS_OK ? (1 | (c->compression_level << 1)) : 0; + msg->h.status = IS_OK(auth_status) ? (1 | (c->compression_level << 1)) : 0; msg->h.ndims = 1; msg->h.dims[0] = MDSIP_VERSION; // reply to client // @@ -573,6 +578,7 @@ int AcceptConnection(char *protocol, char *info_name, SOCKET readfd, void *info, else { destroyConnection(c); + status = MDSplusERROR; } } return status; diff --git a/mdstcpip/mdsipshr/GetAnswerInfo.c b/mdstcpip/mdsipshr/GetAnswerInfo.c index e035dbc389..0f285f1138 100644 --- a/mdstcpip/mdsipshr/GetAnswerInfo.c +++ b/mdstcpip/mdsipshr/GetAnswerInfo.c @@ -74,6 +74,7 @@ int GetAnswerInfoTO(int id, char *dtype, short *length, char *ndims, int *dims, CloseConnection(id); status = MDSplusERROR; } + if (status == SsINTERNAL) status = MDSplusERROR; if (STATUS_NOT_OK) { free(m); diff --git a/mdstcpip/mdsipshr/GetMdsMsg.c b/mdstcpip/mdsipshr/GetMdsMsg.c index a8c4f1cfb1..3d93c8cc39 100644 --- a/mdstcpip/mdsipshr/GetMdsMsg.c +++ b/mdstcpip/mdsipshr/GetMdsMsg.c @@ -35,6 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //#define DEBUG #include +// Can return non-MDSplus error code, SsINTERNAL static int get_bytes_to(Connection *c, void *buffer, size_t bytes_to_recv, int to_msec) { char *bptr = (char *)buffer; @@ -83,6 +84,7 @@ static int get_bytes_to(Connection *c, void *buffer, size_t bytes_to_recv, int t // GetMdsMsg ///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// +// Can set status to non-MDSplus error code, SsINTERNAL Message *GetMdsMsgTOC(Connection *c, int *status, int to_msec) { MsgHdr header; @@ -125,7 +127,7 @@ Message *GetMdsMsgTOC(Connection *c, int *status, int to_msec) m = malloc(msglen); m->h = header; *status = uncompress((unsigned char *)m->bytes, &dlen, - (unsigned char *)msg->bytes + 4, dlen - 4) == 0; + (unsigned char *)msg->bytes + 4, dlen - 4) == Z_OK; if (IS_OK(*status)) { m->h.msglen = msglen; diff --git a/mdstcpip/mdsipshr/MdsValue.c b/mdstcpip/mdsipshr/MdsValue.c index f770b6e40b..03972d77c0 100644 --- a/mdstcpip/mdsipshr/MdsValue.c +++ b/mdstcpip/mdsipshr/MdsValue.c @@ -77,11 +77,11 @@ EXPORT int MdsIpGetDescriptor(int id, const char *expression, int nargs, strcat(newexp, ",__si($)"); strcat(newexp, "))"); nargs += 2; - MDSDBG(newexp); + MDSDBG("%s", newexp); status = SendArg(id, 0, DTYPE_CSTRING, nargs, strlen(newexp), 0, &dim, (char *)newexp); free(newexp); - MDSDBG(expression); + MDSDBG("%s", expression); struct descriptor_a *arr; status = SendArg(id, 1, DTYPE_CSTRING, nargs, strlen(expression), 0, &dim, (char *)expression); diff --git a/mdstcpip/mdsipshr/SendArg.c b/mdstcpip/mdsipshr/SendArg.c index 825a8f33a4..0af7d3e3d7 100644 --- a/mdstcpip/mdsipshr/SendArg.c +++ b/mdstcpip/mdsipshr/SendArg.c @@ -103,6 +103,7 @@ int SendArg(int id, unsigned char idx, char dtype, unsigned char nargs, m->h.message_id = (idx == 0 || nargs == 0) ? ConnectionIncMessageId(c) : c->message_id; int status = m->h.message_id ? SendMdsMsgC(c, m, 0) : MDSplusERROR; + if (status == SsINTERNAL) status = MDSplusERROR; free(m); if (STATUS_NOT_OK) UnlockConnection(c); diff --git a/mdstcpip/mdsipshr/SendMdsMsg.c b/mdstcpip/mdsipshr/SendMdsMsg.c index fd6c60e451..a46c1f5b31 100644 --- a/mdstcpip/mdsipshr/SendMdsMsg.c +++ b/mdstcpip/mdsipshr/SendMdsMsg.c @@ -34,6 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //#define DEBUG #include +// Can return non-MDSplus error code, SsINTERNAL static int send_bytes(Connection *c, void *buffer, size_t bytes_to_send, int options) { if (!c || !c->io) @@ -74,6 +75,7 @@ static int send_bytes(Connection *c, void *buffer, size_t bytes_to_send, int opt return MDSplusSUCCESS; } +// Can return non-MDSplus error code of SsINTERNAL because of send_bytes() int SendMdsMsgC(Connection *c, Message *m, int msg_options) { unsigned long len = m->h.msglen - sizeof(m->h); @@ -104,7 +106,7 @@ int SendMdsMsgC(Connection *c, Message *m, int msg_options) m->h.client_type = ClientType(); if (clength && compress2((unsigned char *)cm->bytes + 4, &clength, - (unsigned char *)m->bytes, len, c->compression_level) == 0 && + (unsigned char *)m->bytes, len, c->compression_level) == Z_OK && clength < len) { cm->h = m->h; diff --git a/pydevices/MitDevices/dt100.py b/pydevices/MitDevices/dt100.py index c43aa2899b..c8e7ac1319 100755 --- a/pydevices/MitDevices/dt100.py +++ b/pydevices/MitDevices/dt100.py @@ -158,7 +158,7 @@ def acq2sh(self, command): def waitState(self, state): import pexpect - regstr = '([0-9\.]*) [0-9] ST_(.*)\r\n' + regstr = '([0-9\\.]*) [0-9] ST_(.*)\r\n' dprint("waitState %s" % regstr) wantex = re.compile(regstr) diff --git a/pydevices/RfxDevices/CYGNET4K.py b/pydevices/RfxDevices/CYGNET4K.py index d1803ce73e..536d5d01d3 100644 --- a/pydevices/RfxDevices/CYGNET4K.py +++ b/pydevices/RfxDevices/CYGNET4K.py @@ -358,7 +358,7 @@ def setValue(self, addrlist, value, useExtReg=False): def resetMicro(self): """Will trap Micro causing watchdog and reset of firmware.""" # The camera will give no response to this command - self.serialIO(b'\x55\x99\x66\x11\x50\EB', None) + self.serialIO(b'\x55\x99\x66\x11\x50\xEB', None) return self def setSystemState(self, byte): @@ -458,7 +458,7 @@ def setRoiXSize(self, value): def setRoiXOffset(self, value): """set ROI X offset as 12-bit value""" - return self.setValue(b'\81\x82', min(0xFFF, value), True) + return self.setValue(b'\x81\x82', min(0xFFF, value), True) def setRoiYSize(self, value): """set ROI Y size as 12-bit value""" diff --git a/pydevices/RfxDevices/DTACQ_SUPERVISOR.py b/pydevices/RfxDevices/DTACQ_SUPERVISOR.py index ea35f71a37..039775bac3 100644 --- a/pydevices/RfxDevices/DTACQ_SUPERVISOR.py +++ b/pydevices/RfxDevices/DTACQ_SUPERVISOR.py @@ -56,6 +56,7 @@ class DTACQ_SUPERVISOR(Device): {'path': '.PG2:D4_TIMES', 'type': 'numeric'}, {'path': '.PG2:D5_TIMES', 'type': 'numeric'}, {'path': ':PASSWD', 'type': 'text', 'value':'d-t1012q'}, + {'path': ':THIS_UDP_ADD', 'type': 'text'}, {'path': ':INIT', 'type': 'action', 'valueExpr': "Action(Dispatch('MARTE_SERVER','INIT',50,None),Method(None,'init',head))", 'options': ('no_write_shot',)}] @@ -217,6 +218,13 @@ def init(self): except: print('Cannot read UDP port') raise mdsExceptions.TclFAILED_ESSENTIAL + try: + thisUdpAddress = self.this_udp_add.data() + except: + thisUdpAddress = socket.gethostbyname(socket.gethostname()) + + + try: clockMode = self.clock_mode.data() @@ -363,18 +371,19 @@ def init(self): try: dtackAi = self.ai_b_device.getData() hasBulkAi = True - 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)) - dtackAi.parameters_par_4_value.putData(len(aiSites)) - dtackAi.parameters_par_5_value.putData(Int32(numDis)) - dtackAi.parameters_par_6_value.putData(Int32Array(aiChans)) - dtackAi.parameters_par_7_value.putData(Float64Array(cals)) - dtackAi.parameters_par_8_value.putData(Float64Array(offs)) - dtackAi.parameters_par_9_value.putData(String(ipAddr)) - dtackAi.parameters_par_10_value.putData(Int32(4210)) - dtackAi.parameters_par_12_value.putData(Int32(spadSize)) + dtackAi.getNode('.PARAMETERS.PAR_13:VALUE').putData(Int32(clockFreq)) #num samples +# dtackAi.parameters_par_1_value.putData(Float64(clockFreq/numSamples)) + dtackAi.getNode('.PARAMETERS.PAR_1:VALUE').putData(Float64(1)) #1 segment per second + dtackAi.getNode('.PARAMETERS.PAR_2:VALUE').putData(Float64(triggerTime)) + dtackAi.getNode('.PARAMETERS.PAR_3:VALUE').putData(Int32(1)) + dtackAi.getNode('.PARAMETERS.PAR_4:VALUE').putData(len(aiSites)) + dtackAi.getNode('.PARAMETERS.PAR_5:VALUE').putData(Int32(numDis)) + dtackAi.getNode('.PARAMETERS.PAR_6:VALUE').putData(Int32Array(aiChans)) + dtackAi.getNode('.PARAMETERS.PAR_7:VALUE').putData(Float64Array(cals)) + dtackAi.getNode('.PARAMETERS.PAR_8:VALUE').putData(Float64Array(offs)) + dtackAi.getNode('.PARAMETERS.PAR_9:VALUE').putData(String(ipAddr)) + dtackAi.getNode('.PARAMETERS.PAR_10:VALUE').putData(Int32(4210)) + dtackAi.getNode('.PARAMETERS.PAR_12:VALUE').putData(Int32(spadSize)) except: print('No Bulk AI MARTe2 device') @@ -388,19 +397,19 @@ def init(self): raise mdsExceptions.TclFAILED_ESSENTIAL - 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)) - dtackAi.parameters_par_4_value.putData(len(aiSites)) - dtackAi.parameters_par_5_value.putData(Int32(numDis)) - dtackAi.parameters_par_6_value.putData(Int32Array(aiChans)) - dtackAi.parameters_par_7_value.putData(Float64Array(cals)) - dtackAi.parameters_par_8_value.putData(Float64Array(offs)) - dtackAi.parameters_par_9_value.putData(String(udpAddress)) - dtackAi.parameters_par_10_value.putData(Int32(udpPort)) - dtackAi.parameters_par_12_value.putData(Int32(spadSize)) - dtackAi.parameters_par_14_value.putData(Int32(freqDivision)) + dtackAi.getNode('.PARAMETERS.PAR_13:VALUE').putData(Int32(1)) #num samples + dtackAi.getNode('.PARAMETERS.PAR_1:VALUE').putData(Float64(clockFreq/freqDiv)) + dtackAi.getNode('.PARAMETERS.PAR_2:VALUE').putData(Float64(triggerTime)) + dtackAi.getNode('.PARAMETERS.PAR_3:VALUE').putData(Int32(2)) + dtackAi.getNode('.PARAMETERS.PAR_4:VALUE').putData(len(aiSites)) + dtackAi.getNode('.PARAMETERS.PAR_5:VALUE').putData(Int32(numDis)) + dtackAi.getNode('.PARAMETERS.PAR_6:VALUE').putData(Int32Array(aiChans)) + dtackAi.getNode('.PARAMETERS.PAR_7:VALUE').putData(Float64Array(cals)) + dtackAi.getNode('.PARAMETERS.PAR_8:VALUE').putData(Float64Array(offs)) + dtackAi.getNode('.PARAMETERS.PAR_9:VALUE').putData(String(udpAddress)) + dtackAi.getNode('.PARAMETERS.PAR_10:VALUE').putData(Int32(udpPort)) + dtackAi.getNode('.PARAMETERS.PAR_12:VALUE').putData(Int32(spadSize)) + dtackAi.getNode('.PARAMETERS.PAR_14:VALUE').putData(Int32(freqDivision)) except: print('No Realtime AI MARTe2 device') @@ -414,7 +423,8 @@ def init(self): # st += ' 1,'+str(spadSize)+',0' st += ' 1,'+str(spadSize/4)+',0' if hasRealtimeAi: - args = self.Args('255.255.255.0', udpAddress, socket.gethostbyname(socket.gethostname()), udpGateway, udpPort, st, '', hudp_decim = freqDiv) +# args = self.Args('255.255.255.0', udpAddress, socket.gethostbyname(socket.gethostname()), udpGateway, udpPort, st, '', hudp_decim = freqDiv) + args = self.Args('255.255.255.0', udpAddress, thisUdpAddress, udpGateway, udpPort, st, '', hudp_decim = freqDiv) self.config_tx_uut(uut, args) if hasBulkAi: print("BULK ") @@ -428,11 +438,12 @@ def init(self): except: print('Cannot fine MARTE2_TACQAO device') raise mdsExceptions.TclFAILED_ESSENTIAL - dtackAo.parameters_par_1_value.putData(Int32(len(aoSites))) - dtackAo.parameters_par_2_value.putData(Int32(numDos)) - dtackAo.parameters_par_3_value.putData(Int32Array(aoChans)) - dtackAo.parameters_par_4_value.putData(udpAddress) - dtackAo.parameters_par_5_value.putData(Int32(udpPort)) + print(dtackAo) + dtackAo.getNode('.PARAMETERS.PAR_1:VALUE').putData(Int32(len(aoSites))) + dtackAo.getNode('.PARAMETERS.PAR_2:VALUE').putData(Int32(numDos)) + dtackAo.getNode('.PARAMETERS.PAR_3:VALUE').putData(Int32Array(aoChans)) + dtackAo.getNode('.PARAMETERS.PAR_4:VALUE').putData(udpAddress) + dtackAo.getNode('.PARAMETERS.PAR_5:VALUE').putData(Int32(udpPort)) st = '' for i in range(len(aoSites)): @@ -443,7 +454,8 @@ def init(self): st += ','+str(dioSite) st += ' 0' - args = self.Args('255.255.255.0', socket.gethostbyname(socket.gethostname()), udpAddress, udpGateway, udpPort, '', st) +# args = self.Args('255.255.255.0', socket.gethostbyname(socket.gethostname()), udpAddress, udpGateway, udpPort, '', st) + args = self.Args('255.255.255.0', thisUdpAddress, udpAddress, udpGateway, udpPort, '', st) self.config_rx_uut(uut, args) ####################HUDP_SEUP Stuff diff --git a/pydevices/RfxDevices/FAKECAMERA.py b/pydevices/RfxDevices/FAKECAMERA.py index b802e769ea..5c188a5af6 100644 --- a/pydevices/RfxDevices/FAKECAMERA.py +++ b/pydevices/RfxDevices/FAKECAMERA.py @@ -37,7 +37,7 @@ class FAKECAMERA(Device): {'path': ':COMMENT', 'type': 'text'}, {'path': ':EXP_NAME', 'type': 'text', 'value': 'cameratest'}, {'path': ':EXP_SHOT', 'type': 'text', 'value': '84'}, - {'path': ':EXP_NODE', 'type': 'text', 'value': '\CAMERATEST::FLIR:FRAMES'}, + {'path': ':EXP_NODE', 'type': 'text', 'value': '\\CAMERATEST::FLIR:FRAMES'}, {'path': ':FRAME_RATE', 'type': 'numeric', 'value': 25}, {'path': ':READ_LOOP', 'type': 'text', 'value': 'NO'}, {'path': ':STREAMING', 'type': 'text', 'value': 'Stream and Store'}, diff --git a/pydevices/RfxDevices/MARTE2_COMPONENT.py b/pydevices/RfxDevices/MARTE2_COMPONENT.py index 487d04c1dc..8f1e77cc04 100644 --- a/pydevices/RfxDevices/MARTE2_COMPONENT.py +++ b/pydevices/RfxDevices/MARTE2_COMPONENT.py @@ -23,46 +23,65 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -from MDSplus import Device, Data, TreeNode, Range, TreePath, Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Float32, Float64, Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Int64Array, Uint64Array, Float32Array, Float64Array +import MDSplus +import RfxDevices import numpy as np +import copy + + +class BUILDER: + def __init__(self, clazz, mode, timebaseExpr=None): + self.clazz = clazz + self.mode = mode + self.timebaseExpr = timebaseExpr + + def __call__(self, cls): + cls.buildGam(cls.parts, self.clazz, self.mode, self.timebaseExpr) + return cls + + +class MARTE2_COMPONENT(MDSplus.Device): + + + -class MARTE2_COMPONENT(Device): """MARTE2 components superclass""" MODE_GAM = 1 MODE_INPUT = 2 MODE_SYNCH_INPUT = 3 MODE_OUTPUT = 4 - - TIMEBASE_GENERATOR = 1 - TIMEBASE_FROM_SAME_THREAD = 2 - TIMEBASE_FROM_ANOTHER_THREAD = 2 + MODE_INTERFACE = 5 @classmethod - def buildParameters(cls, parts): - parts.append({'path': '.PARAMETERS', 'type': 'structure'}) + def buildParameters(cls, parts, prefix = 'PARAMETERS', buildParameters = None): idx = 1 - for parameter in cls.parameters: - parts.append({'path': '.PARAMETERS.PAR_' + + if buildParameters == None: + buildParameters = cls.parameters + for parameter in buildParameters: + parts.append({'path': prefix + '.PAR_' + str(idx), 'type': 'structure'}) - parts.append({'path': '.PARAMETERS.PAR_'+str(idx) + + parts.append({'path': prefix + '.PAR_'+str(idx) + ':NAME', 'type': 'text', 'value': parameter['name']}) - if(parameter['type'] == 'string'): + if(parameter['type'] == 'structure'): + parts.append({'path': prefix + '.PAR_'+str(idx) + + '.VALUE', 'type': 'structure'}) + cls.buildParameters(parts, prefix = prefix + '.PAR_'+str(idx) +'.VALUE', buildParameters = parameter['value']) + elif(parameter['type'] == 'string'): if 'value' in parameter: - parts.append({'path': '.PARAMETERS.PAR_'+str(idx) + + parts.append({'path': prefix + '.PAR_'+str(idx) + ':VALUE', 'type': 'text', 'value': parameter['value']}) else: - parts.append({'path': '.PARAMETERS.PAR_' + + parts.append({'path': prefix + '.PAR_' + str(idx)+':VALUE', 'type': 'text'}) else: if 'value' in parameter: - parts.append({'path': '.PARAMETERS.PAR_'+str(idx)+':VALUE', + parts.append({'path': prefix + '.PAR_'+str(idx)+':VALUE', 'type': 'numeric', 'value': parameter['value']}) else: - parts.append({'path': '.PARAMETERS.PAR_' + + parts.append({'path': prefix + '.PAR_' + str(idx)+':VALUE', 'type': 'numeric'}) idx = idx+1 - @classmethod def buildOutputs(cls, parts): parts.append({'path': '.OUTPUTS', 'type': 'structure'}) @@ -79,320 +98,135 @@ def buildOutputs(cls, parts): # CPU Mask for MdsWriter thread parts.append({'path': '.OUTPUTS:CPU_MASK', 'type': 'numeric', 'value': 15}) - idx = 1 nameList = [] - for output in cls.outputs: + cls.buildOutputsRec(parts, currOutputs = cls.outputs, prefix = '.OUTPUTS') + + @classmethod + def buildOutputsRec(cls, parts, currOutputs = None, prefix = '', nameList = []): + for output in currOutputs: # sigName = output['name'][0:12] sigName = cls.convertName(output['name'], nameList) - parts.append({'path': '.OUTPUTS.'+sigName, 'type': 'structure'}) - parts.append({'path': '.OUTPUTS.'+sigName+':NAME', + parts.append({'path': prefix + '.'+sigName, 'type': 'structure'}) + parts.append({'path': prefix + '.'+sigName+':NAME', 'type': 'text', 'value': output['name']}) - parts.append({'path': '.OUTPUTS.'+sigName+':TYPE', + parts.append({'path': prefix + '.'+sigName+':TYPE', 'type': 'text', 'value': output['type']}) - parts.append({'path': '.OUTPUTS.'+sigName+':SAMPLES', + parts.append({'path': prefix + '.'+sigName+':SAMPLES', 'type': 'numeric', 'value': 1}) - parts.append({'path': '.OUTPUTS.'+sigName+':DIMENSIONS', - 'type': 'numeric', 'value': Data.compile(str(output['dimensions']))}) + parts.append({'path': prefix + '.'+sigName+':DIMENSIONS', + 'type': 'numeric', 'value': MDSplus.Data.compile(str(output['dimensions']))}) if 'seg_len' in output: - parts.append({'path': '.OUTPUTS.'+sigName+':SEG_LEN', + parts.append({'path': prefix + '.'+sigName+':SEG_LEN', 'type': 'numeric', 'value': output['seg_len']}) else: - parts.append({'path': '.OUTPUTS.'+sigName + + parts.append({'path': prefix + '.'+sigName + ':SEG_LEN', 'type': 'numeric', 'value': 0}) if 'stream' in output: - parts.append({'path': '.OUTPUTS.'+sigName+':STREAM', + parts.append({'path': prefix + '.'+sigName+':STREAM', 'type': 'text', 'value': output['stream']}) else: - parts.append({'path': '.OUTPUTS.'+sigName + + parts.append({'path': prefix + '.'+sigName + ':STREAM', 'type': 'text'}) if(output['type'] == 'string'): parts.append( - {'path': '.OUTPUTS.'+sigName+':VALUE', 'type': 'text'}) + {'path': prefix + '.'+sigName+':VALUE', 'type': 'text'}) else: - parts.append({'path': '.OUTPUTS.'+sigName + + parts.append({'path': prefix + '.'+sigName + ':VALUE', 'type': 'signal'}) - pars = output['parameters'] - idx = 1 - parts.append({'path': '.OUTPUTS.'+sigName + + try: + pars = output['parameters'] + except: + pars = [] + parts.append({'path': prefix + '.'+sigName + '.PARAMETERS', 'type': 'structure'}) if len(pars) > 0: - for par in pars: - parts.append( - {'path': '.OUTPUTS.'+sigName+'.PARAMETERS.PAR_'+str(idx), 'type': 'structure'}) - parts.append({'path': '.OUTPUTS.'+sigName+'.PARAMETERS.PAR_' + - str(idx)+':NAME', 'type': 'text', 'value': par['name']}) - if(par['type'] == 'string'): - parts.append({'path': '.OUTPUTS.'+sigName+'.PARAMETERS.PAR_' + - str(idx)+':VALUE', 'type': 'text', 'value': par['value']}) - else: - parts.append({'path': '.OUTPUTS.'+sigName+'.PARAMETERS.PAR_' + - str(idx)+':VALUE', 'type': 'numeric', 'value': par['value']}) + cls.buildParameters(parts, prefix = prefix + '.'+sigName+'.PARAMETERS', buildParameters = output['parameters']) - idx = idx + 1 # structured outputs try: fields = output['fields'] except: fields = [] + parts.append({'path': prefix+'.'+sigName + '.FIELDS', 'type': 'structure'}) if len(fields) > 0: - parts.append({'path': '.OUTPUTS.'+sigName + - '.FIELDS', 'type': 'structure'}) - for field in fields: - fieldName = cls.convertName(field['name'], nameList) - parts.append({'path': '.OUTPUTS.'+sigName + - '.FIELDS.'+fieldName, 'type': 'structure'}) - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.' + - fieldName+':NAME', 'type': 'text', 'value': field['name']}) - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.' + - fieldName+':TYPE', 'type': 'text', 'value': field['type']}) - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.' + - fieldName+':SAMPLES', 'type': 'numeric', 'value': 1}) - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.'+fieldName+':DIMENSIONS', - 'type': 'numeric', 'value': Data.compile(str(field['dimensions']))}) - if 'seg_len' in field: - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.'+fieldName + - ':SEG_LEN', 'type': 'numeric', 'value': field['seg_len']}) - else: - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.' + - fieldName+':SEG_LEN', 'type': 'numeric', 'value': 0}) - if 'stream' in field: - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.'+fieldName + - ':STREAM', 'type': 'text', 'value': field['stream']}) - else: - parts.append({'path': '.OUTPUTS.'+sigName+'.FIELDS.' + - fieldName+':STREAM', 'type': 'text'}) - - if(field['type'] == 'string'): - parts.append( - {'path': '.OUTPUTS.'+sigName+'.FIELDS.'+fieldName+':VALUE', 'type': 'text'}) - else: - parts.append( - {'path': '.OUTPUTS.'+sigName+'.FIELDS.'+fieldName+':VALUE', 'type': 'signal'}) + cls.buildOutputsRec(parts, currOutputs = fields, prefix = prefix+'.'+sigName+'.FIELDS', nameList=nameList) @classmethod def buildInputs(cls, parts): parts.append({'path': '.INPUTS', 'type': 'structure'}) - idx = 1 nameList = [] - for input in cls.inputs: + cls.buildInputsRec(parts, inputs = cls.inputs, prefix = '.INPUTS') + + @classmethod + def buildInputsRec(cls, parts, nameList = [], prefix = '', inputs = None): + + for input in inputs: # sigName = input['name'][0:12] sigName = cls.convertName(input['name'], nameList) - parts.append({'path': '.INPUTS.'+sigName, 'type': 'structure'}) - parts.append({'path': '.INPUTS.'+sigName+':TYPE', + parts.append({'path': prefix+'.'+sigName, 'type': 'structure'}) + parts.append({'path': prefix+'.'+sigName+':TYPE', 'type': 'text', 'value': input['type']}) - parts.append({'path': '.INPUTS.'+sigName+':DIMENSIONS', - 'type': 'numeric', 'value': Data.compile(str(input['dimensions']))}) - parts.append({'path': '.INPUTS.'+sigName+':COL_ORDER', + parts.append({'path': prefix+'.'+sigName+':DIMENSIONS', + 'type': 'numeric', 'value': MDSplus.Data.compile(str(input['dimensions']))}) + parts.append({'path': prefix+'.'+sigName+':COL_ORDER', 'type': 'text', 'value': 'NO'}) - parts.append({'path': '.INPUTS.'+sigName + + parts.append({'path': prefix+'.'+sigName + ':VALUE', 'type': 'signal'}) if 'name' in input: - parts.append({'path': '.INPUTS.'+sigName+':NAME', + parts.append({'path': prefix+'.'+sigName+':NAME', 'type': 'text', 'value': input['name']}) else: parts.append( - {'path': '.INPUTS.'+sigName+':NAME', 'type': 'text'}) + {'path': prefix+'.'+sigName+':NAME', 'type': 'text'}) - pars = input['parameters'] - idx = 1 - parts.append({'path': '.INPUTS.'+sigName + + try: + pars = input['parameters'] + except: + pars = [] + parts.append({'path': prefix+'.'+sigName + '.PARAMETERS', 'type': 'structure'}) if len(pars) > 0: - for par in pars: - parts.append( - {'path': '.INPUTS.'+sigName+'.PARAMETERS.PAR_'+str(idx), 'type': 'structure'}) - parts.append({'path': '.INPUTS.'+sigName+'.PARAMETERS.PAR_' + - str(idx)+':NAME', 'type': 'text', 'value': par['name']}) - if(par['type'] == 'string'): - parts.append({'path': '.INPUTS.'+sigName+'.PARAMETERS.PAR_' + - str(idx)+':VALUE', 'type': 'text', 'value': par['value']}) - else: - parts.append({'path': '.INPUTS.'+sigName+'.PARAMETERS.PAR_' + - str(idx)+':VALUE', 'type': 'numeric', 'value': par['value']}) - idx = idx + 1 + cls.buildParameters(parts, prefix = prefix + '.'+sigName+'.PARAMETERS', buildParameters = input['parameters']) try: fields = input['fields'] except: fields = [] + parts.append({'path': prefix+'.'+sigName + '.FIELDS', 'type': 'structure'}) if len(fields) > 0: - parts.append({'path': '.INPUTS.'+sigName + - '.FIELDS', 'type': 'structure'}) - for field in fields: - fieldName = cls.convertName(field['name'], nameList) - parts.append({'path': '.INPUTS.'+sigName + - '.FIELDS.'+fieldName, 'type': 'structure'}) - parts.append({'path': '.INPUTS.'+sigName+'.FIELDS.' + - fieldName+':TYPE', 'type': 'text', 'value': field['type']}) - parts.append({'path': '.INPUTS.'+sigName+'.FIELDS.'+fieldName+':DIMENSIONS', - 'type': 'numeric', 'value': Data.compile(str(field['dimensions']))}) - parts.append({'path': '.INPUTS.'+sigName+'.FIELDS.' + - fieldName+':COL_ORDER', 'type': 'text', 'value': 'NO'}) - if 'name' in field: - parts.append({'path': '.INPUTS.'+sigName+'.FIELDS.' + - fieldName+':NAME', 'type': 'text', 'value': field['name']}) - else: - parts.append( - {'path': '.INPUTS.'+sigName+'.FIELDS.'+fieldName+':NAME', 'type': 'text'}) - parts.append( - {'path': '.INPUTS.'+sigName+'.FIELDS.'+fieldName+':VALUE', 'type': 'signal'}) + cls.buildInputsRec(parts, nameList = nameList, prefix = prefix + '.'+sigName+'.FIELDS', inputs = fields) @classmethod def buildGam(cls, parts, clazz, mode, timebaseExpr=None): + parts.append({'path': ':GAM_CLASS', 'type': 'text', 'value': clazz}) parts.append({'path': ':MODE', 'type': 'numeric', 'value': mode}) - if timebaseExpr == None: - parts.append({'path': ':TIMEBASE', 'type': 'numeric'}) - else: - parts.append({'path': ':TIMEBASE', 'type': 'numeric', - 'value': Data.compile(timebaseExpr)}) + if mode != MARTE2_COMPONENT.MODE_INTERFACE: + if timebaseExpr == None: + parts.append({'path': ':TIMEBASE', 'type': 'numeric'}) + else: + parts.append({'path': ':TIMEBASE', 'type': 'numeric', + 'value': MDSplus.Data.compile(timebaseExpr)}) + parts.append({'path': '.PARAMETERS', 'type': 'structure'}) cls.buildParameters(parts) - if mode == MARTE2_COMPONENT.MODE_GAM or mode == MARTE2_COMPONENT.MODE_OUTPUT: + if (mode == MARTE2_COMPONENT.MODE_GAM or mode == MARTE2_COMPONENT.MODE_OUTPUT) and mode != MARTE2_COMPONENT.MODE_INTERFACE: cls.buildInputs(parts) - if mode != MARTE2_COMPONENT.MODE_OUTPUT: + if mode != MARTE2_COMPONENT.MODE_OUTPUT and mode != MARTE2_COMPONENT.MODE_INTERFACE: cls.buildOutputs(parts) + if mode != MARTE2_COMPONENT.MODE_INTERFACE: + parts.append({'path': ':PORT', 'type': 'numeric'}) + # add debug definition. When 'ENABLED' input and outputs will be printed via LoggerDataSOurce + parts.append( + {'path': ':PRINT_DEBUG', 'type': 'text', 'value': 'DISABLED'}) + parts.append( + {'path': ':JSCOPE_EV', 'type': 'text', 'value': 'updatejScope'}) -# add timebase division, valid only if the timebase refers to a MASRTE2 device belonging to a different thread - parts.append({'path': ':TIMEBASE_DIV', 'type': 'numeric'}) -# add debug definition. When 'ENABLED' input and outputs will be printed via LoggetDataSOurce - parts.append( - {'path': ':PRINT_DEBUG', 'type': 'text', 'value': 'DISABLED'}) - -# for part in parts: -# print(part) - - name = None - inputs = [] - outputs = [] - parameters = [] - - def convertVal(self, valStr): - # distantiate [ and ] - currValStr = '' - for char in valStr: - if char == '[' or char == ']': - currValStr += ' '+char+' ' - else: - currValStr += char - tokens = currValStr.split() - if len(tokens) <= 1: - return valStr - outVal = '' - tokCounts = [0] - for token in tokens: - if token[0] == '[': - if tokCounts[-1] > 0: - outVal += ',' - outVal += '{' - tokCounts.append(0) - elif token == ']': - outVal += '}' - tokCounts.pop() - tokCounts[-1] = tokCounts[-1] + 1 - else: - if tokCounts[-1] > 0: - outVal += ',' - outVal += token - tokCounts[-1] = tokCounts[-1] + 1 - return outVal - - def convertPath(self, path): - name = path[path.find('::TOP')+6:] - name = name.replace(':', '_') - name = name.replace('.', '_') - return name - - def addSignalParametersOLD(self, parsNode, text): - for parNode in parsNode.getChildren(): - name = parNode.getNode(':NAME').data() - value = parNode.getNode(':VALUE').data() - if parNode.getNode(':VALUE').getUsage() == 'TEXT': - text += ' '+name+' = "'+str(value)+'"\n' - else: - text += ' '+name+' = '+str(value)+'\n' - return text - - def addSignalParameters(self, parsNode, text): - paramDicts = [] - for parNode in parsNode.getChildren(): - name = parNode.getNode(':NAME').data() - # value = parNode.getNode(':VALUE').data() - value = parNode.getNode(':VALUE').getData() - if parNode.getNode(':VALUE').getUsage() == 'TEXT': - paramDicts.append( - {'name': name, 'value': value, 'is_text': True}) - else: - paramDicts.append( - {'name': name, 'value': value, 'is_text': False}) - - text = self.reportParameters(paramDicts, text, 2) - return text - - def reportParameters(self, paramDicts, outText, nTabs=1): - np.set_printoptions(threshold=np.inf) - rootParDict = {} - for paramDict in paramDicts: - currName = paramDict['name'] - names = currName.split('.') - if len(names) == 1: # resolve current level of parameters - for tab in range(nTabs): - outText += ' ' - if paramDict['is_text']: - outText += paramDict['name']+' = "' + \ - str(paramDict['value'])+'"\n' - else: - if isinstance(paramDict['value'], Int8) or isinstance(paramDict['value'], Int8Array): - outText += paramDict['name']+' = (int8)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Uint8) or isinstance(paramDict['value'], Uint8Array): - outText += paramDict['name']+' = (uint8)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Int16) or isinstance(paramDict['value'], Int16Array): - outText += paramDict['name']+' = (int16)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Uint16) or isinstance(paramDict['value'], Uint16Array): - outText += paramDict['name']+' = (uint16)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Int32) or isinstance(paramDict['value'], Int32Array): - outText += paramDict['name']+' = (int32)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Uint32) or isinstance(paramDict['value'], Uint32Array): - outText += paramDict['name']+' = (uint32)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Int64) or isinstance(paramDict['value'], Int64Array): - outText += paramDict['name']+' = (int64)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Uint64) or isinstance(paramDict['value'], Uint64Array): - outText += paramDict['name']+' = (uint64)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - elif isinstance(paramDict['value'], Float32) or isinstance(paramDict['value'], Float32Array): - outText += paramDict['name']+' = (float32)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - else: - outText += paramDict['name']+' = (float64)'+self.convertVal( - str(paramDict['value'].data()))+'\n' - else: - if names[0] in rootParDict: - rootParDict[names[0]].append({'name': currName[currName.find( - '.')+1:], 'is_text': paramDict['is_text'], 'value': paramDict['value']}) - else: - rootParDict[names[0]] = [{'name': currName[currName.find( - '.')+1:], 'is_text': paramDict['is_text'], 'value': paramDict['value']}] - for key in rootParDict.keys(): - for tab in range(nTabs): - outText += ' ' - outText += key+' = {\n' - outText = self.reportParameters( - rootParDict[key], outText, nTabs + 1) - for tab in range(nTabs): - outText += ' ' - outText += '}\n' - return outText @classmethod + # NON USATA QUA PER IL MOMENTO def convertName(cls, name, nameList): # remove angulars (possibly from simuluink) if name[0] == '<': @@ -410,3055 +244,1572 @@ def convertName(cls, name, nameList): i = i+1 nameList.append(name1) return name1 - - def getGamInfo(self): - try: - isDebug = (self.print_debug.data().upper() == 'ENABLED') - except: - isDebug = False - try: - timebase = self.timebase.getData() - except: - timebase = None - mode = self.mode.getData() - gamName = self.convertPath(self.getFullPath()) - gamClass = self.gam_class.data() # class is a py - gamMode = self.mode.data() - - paramDicts = [] - for parameter in self.getNode('parameters').getChildren(): - paramDict = {} + + def getParametersDict(self, parRoot): + pars = {} + for parNode in parRoot.getChildren(): try: - paramDict['name'] = parameter.getNode('name').data() - paramDict['value'] = parameter.getNode('value').getData() - paramDict['is_text'] = ( - parameter.getNode('value').getUsage() == 'TEXT') - paramDicts.append(paramDict) + name = parNode.getNode('name').data() except: - pass - inputDicts = [] - if mode == MARTE2_COMPONENT.MODE_GAM or mode == MARTE2_COMPONENT.MODE_OUTPUT: - inputNids = np.sort(self.getNode('inputs').getChildren()) - for inputNid in inputNids: + continue #Skip parameter if missing name + valNode = parNode.getNode('value') + childPars = valNode.getChildren() + if len(childPars) > 0: + val = self.getParametersDict(valNode) + if val == {}: + continue + else: try: - input = TreeNode(inputNid, self.getTree()) - inputDict = {} - inputDict['type'] = input.getNode('type').data() - try: - isStruct = ( - len(input.getNode('fields').getChildren()) > 0) - except: - isStruct = False - - if not isStruct: - inputDict['dimensions'] = input.getNode( - 'dimensions').data() - try: - inputDict['value'] = input.getNode('value').getData() # NOT data() - except: - pass - inputDict['value_nid'] = input.getNode('value') - inputDict['col_order'] = input.getNode( - 'col_order').data().upper() == 'YES' - try: - inputDict['name'] = input.getNode( - 'name').data() # Name is optional - except: - pass - inputDict['fields'] = [] - else: # structured input - inputDict['dimensions'] = 0 - inputDict['value_nid'] = input.getNode('value') - inputDict['name'] = input.getNode( - 'name').data() # Name is optional - fields = [] - try: - inputDict['value'] = input.getNode( - 'value').getData() - except: # node not directly connected, but its fields may - - # Handle possibly structured data. In thos case node 'fields' will contain a list of fields - fieldsNode = input.getNode('fields') - fieldNids = np.sort(fieldsNode.getChildren()) - for fieldNid in fieldNids: - field = TreeNode(fieldNid, self.getTree()) - fieldDict = {} - fieldDict['type'] = field.getNode( - 'type').data() - fieldDict['dimensions'] = field.getNode( - 'dimensions').data() - - if fieldDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(fieldDict['dimensions']) - numberOfElements = 1 - for currDim in fieldDict['dimensions']: - numberOfElements *= currDim - fieldDict['elements'] = numberOfElements - try: - fieldDict['value'] = field.getNode('value').getData() # NOT data() - except: - pass - fieldDict['value_nid'] = field.getNode('value') - fieldDict['col_order'] = field.getNode( - 'col_order').data().upper() == 'YES' - fieldDict['name'] = field.getNode( - 'name').data() # Name is mandatory here - fields.append(fieldDict) - # end except - inputDict['fields'] = fields - # end if len(inputDict['fields'] == 0) - inputDicts.append(inputDict) + val = parNode.getNode('value').getData() except: - pass - outputDicts = [] - if mode != MARTE2_COMPONENT.MODE_OUTPUT: - storeSignals = False - streamSignals = False - outputNids = np.sort(self.getNode('outputs').getChildren()) - for outputNid in outputNids: - output = TreeNode(outputNid, self.getTree()) - try: - outputDict = {} - outputDict['name'] = output.getNode('name').data() - outputDict['type'] = output.getNode('type').data() - outputDict['dimensions'] = output.getNode( - 'dimensions').data() - if(outputDict['dimensions'] == -1): - continue # dimensions set to -1 means that the output is not used - #outputDict['value'] = output.getNode('value').getData() # NOT data() - outputDict['value_nid'] = output.getNode(':value') - outputDict['seg_len'] = output.getNode(':seg_len').data() - if outputDict['seg_len'] > 0: - storeSignals = True - outputDict['samples'] = output.getNode(':samples').data() - try: - streamName = output.getNode(':stream').data() - if len(streamName) > 0: - outputDict['stream'] = streamName - streamSignals = True - else: - outputDict['stream'] = None - except: - outputDict['stream'] = None - -# Handle possibly structured data. In this case node 'fields' will contain a list of fields - fields = [] - try: - fieldsNode = output.getNode('fields') - fieldNids = np.sort(fieldsNode.getChildren()) - for fieldNid in fieldNids: - field = TreeNode(fieldNid, self.getTree()) - fieldDict = {} - fieldDict['name'] = field.getNode(':name').data() - fieldDict['type'] = field.getNode(':type').data() - fieldDict['dimensions'] = field.getNode( - ':dimensions').data() - if fieldDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(fieldDict['dimensions']) - numberOfElements = 1 - for currDim in fieldDict['dimensions']: - numberOfElements *= currDim - fieldDict['elements'] = numberOfElements - try: - fieldDict['value'] = field.getNode('value').getData() # NOT data() - except: - pass - fieldDict['value_nid'] = field.getNode(':value') - fieldDict['seg_len'] = field.getNode( - ':seg_len').data() - if fieldDict['seg_len'] > 0: - storeSignals = True - try: - streamName = field.getNode(':stream').data() - if len(streamName) > 0: - fieldDict['stream'] = field.getNode(':stream').data() - streamSignals = True - else: - fieldDict['stream'] = None - except: - fieldDict['stream'] = None - fields.append(fieldDict) - except: - pass - outputDict['fields'] = fields + print('Warning: Empty value for parameter '+parNode.getPath()) + continue + if isinstance(val, MDSplus.Apd): + if not isinstance(val, MDSplus.Dictionary): + raise Exception('Wrong parameter in ' + parNode.getPath()+' Only Dictionaries, string, scalar and arrays supported') + else: + val = val.data() + pars[name] = val + return pars + + # get the name associated with that signal node subtree, including name of nested signals. Valid for bot input and output signals + def getSignalName(self, sigNode): + #passed sigNode may either refer to a VALUE field or to its parent + if sigNode.getName() == 'VALUE': + currSigNode = sigNode.getParent() + else: + currSigNode = sigNode + try: + nameNode = currSigNode.getNode(':NAME') + except: + raise Exception('Internal error in getSignal node for '+sigNode.getPath()) - outputDicts.append(outputDict) - except: - pass try: - outputTrigger = self.outputs_trigger.getData() + name = nameNode.data() except: - outputTrigger = None + name = currSigNode.getName() - if mode != MARTE2_COMPONENT.MODE_OUTPUT: - outTimeNid = self.outputs_out_time - outTimeIdx = self.outputs_time_idx.data() + while not isinstance(currSigNode.getParent().getParent(), RfxDevices.MARTE2_COMPONENT): + currSigNode = currSigNode.getParent().getParent() try: - preTrigger = self.outputs_pre_trigger.data() + currName = currSigNode.getNode('NAME').data() except: - preTrigger = 0 - try: - postTrigger = self.outputs_post_trigger.data() - except: - postTrigger = 100 - - cpuMask = self.outputs_cpu_mask.data() - - return {'gamName': gamName, 'gamClass': gamClass, 'gamMode': gamMode, - 'timebase': timebase, 'paramDicts': paramDicts, 'inputDicts': inputDicts, 'outputDicts': outputDicts, - 'outputTrigger': outputTrigger, 'outTimeNid': outTimeNid, 'outTimeIdx': outTimeIdx, 'preTrigger': preTrigger, - 'postTrigger': postTrigger, 'storeSignals': storeSignals, 'streamSignals': streamSignals, 'cpuMask': cpuMask, 'debug': isDebug} - else: - return {'gamName': gamName, 'gamClass': gamClass, 'gamMode': gamMode, - 'timebase': timebase, 'paramDicts': paramDicts, 'inputDicts': inputDicts, 'outputDicts': outputDicts} - - def onSameThread(self, threadMap, node, otherNode = None): - if otherNode == None: - otherNode = self - nid1 = otherNode.getNid() - nid2 = node.getNid() + currName = currSigNode.getName() + name = currName+'_'+name + + return name + + + + #return the containing MARTE2 device + def getMarteDevice(self, node): + currNode = node + while not isinstance(currNode, RfxDevices.MARTE2_COMPONENT): + if currNode.getParent().getNid() == 0: #TOP reached + raise Exception('Node '+ node.getPath() +' is not contained in a MARTe2 device') + currNode = currNode.getParent() + return currNode + + + #return the containing MARTE2 device name. The name is obtained from the full path (except \\experiment::TOP) replacing : and . with _ + def getMarteDeviceName(self, node = None): + if node == None: + node = self + currNode = self.getMarteDevice(node) + devName = currNode.getFullPath() + return devName[devName.index('::TOP')+6:].replace(':', '_').replace('.', '_') + + #Check whether the passed value is a reference to TIMEBASE of this device + def isTimebase(self, value): + if isinstance(value, MDSplus.TreeNode) and value.getNid() == self.getNode('TIMEBASE').getNid(): + return True + return False + + #Check whether the value refers to a MARTe2 device + def isMarteDeviceRef(self, value): try: - if len(threadMap[nid1]) != len(threadMap[nid2]): - return False + self.getMarteDevice(value) except: return False - for idx in range(len(threadMap[nid1])): - if threadMap[nid1][idx] != threadMap[nid2][idx]: - return False return True - def sameSynchSource(self, dev): - timebase = self.timebase.getData() - if not isinstance(timebase, TreeNode): - synch1 = self.getNid() - else: - prevTimebase = timebase - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() - synch1 = prevTimebase.getParent().getNid() + def checkMarteDeviceRef(self, value, sigNode): + #If we arrive here, value refers to MARTe2 device. + #Consistency checks + refSigNode = value.getParent() + try: + refTypeNode = refSigNode.getNode('TYPE') + except: + raise Exception ('Not a valid MARTE2 device reference for '+ self.getSignalName(sigNode) + ' of '+self.getPath()+ ': '+ value()) - timebase = dev.getNode('TIMEBASE').getData() - if not isinstance(timebase, TreeNode): - synch2 = dev.getNid() - else: - prevTimebase = timebase - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() - synch2 = prevTimebase.getParent().getNid() - return synch1 == synch2 - - def getDevList(self, threadMap): - devList = [] - for nid in threadMap: - devList.append(TreeNode(nid, self.getTree())) - return devList - - -#GAB NOVEMBER 2022 -#Get Synchronizing device. Note that for Synchronized inputs timebase will contain a range descriptor - def getSynchDev(self): - timebase = self.timebase.getData() - if not isinstance(timebase, TreeNode): - synch = self - else: - prevTimebase = timebase - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() - synch = prevTimebase.getParent() - return synch - -#GAB OCTOBER 2023 -#Get type (as string) of the Time field of the synchronizing device - def getTimebaseType(self): - synchDev = self.getSynchDev() + if refTypeNode.data() != sigNode.getNode('TYPE').data(): + raise Exception ('Invalid type for signal '+ self.getSignalName(sigNode) + ' of '+self.getPath()+':'+value.getPath()+': '+refTypeNode.data()+' '+sigNode.getNode('TYPE').data()) try: - return synchDev.outputs_time_type.data() + refDimNode = refSigNode.getNode('DIMENSIONS') except: - return 'int32' + raise Exception ('Not a valid MARTE2 device reference for '+ sigNode + ' of '+self.getPath()) + if refDimNode.data() != sigNode.getNode('DIMENSIONS').data(): + raise Exception ('Invalid dimension for signal '+ sigNode.getPath()+ ' of '+self.getPath() ) + return True - #Get devices connected to the passed node - def getConnectedDev(self, threadMap, outValueNode): - outDevs = [] - devList = self.getDevList(threadMap) - for dev in devList: - try: - timebaseNode = TreeNode(dev, self.getTree()).getNode(':TIMEBASE') - if timebaseNode.getData().getNid() == outValueNode.getNid(): - outDevs.append(dev) - except: - print('WARNING: timebase not defined for '+str(timebaseNode)) - pass - try: # If it is an input device it has an INPUTS subtree - inputSigs = dev.getNode('.INPUTS') - for inputChan in inputSigs.getChildren(): - # check first the case of a structure - try: - fieldsChan = inputChan.getNode('FIELDS') - for fieldChan in fieldsChan.getChildren(): - try: - fieldNid = fieldChan.getNode('VALUE').getData().getNid() - if fieldNid == outValueNode.getNid(): - outDevs.append(dev) - except: - continue - except: - pass - # Non structure case - try: - inputNid = inputChan.getNode('VALUE').getData().getNid() - except: - continue - if inputNid == outValueNode.getNid(): - outDevs.append(dev) - except: - pass - # We need to check also Output Trigger + #check whether MARTe2 thread referred by value belongs to the same thread for this device + def hostedInSameThread(self, value, threadMap): + if not self.hostedInSameSupervisor(value, threadMap): + return False + # threadMap is a Dictionary with two keys: + # 'DeviceInfo': defining for every MARTe2 device NID a dictionary: + # 'ThreadName': name of the thread it belongs to + # 'SupervisorNid': NID of the supervirsor hosting the device + # 'SupervisorIp': IP address of the superisor hosting the device + # 'DevicePort': Posr number foir that device + # 'ThreadInfo': defining for every thread for this supervisor a dictionary: + # 'SyncThreadName': The name of the Synchronizing thread or None if this thread is not synchronized + # 'SyncThreadSupervisor': The NID of the MARTE2 supervisor hosting the synchronizing thread or None if not synchronized + # 'SyncDiv': Frequency division from synchronizing thread or None is not synchronized + + + valueNid = self.getMarteDevice(value).getNid() + if not valueNid in threadMap['DeviceInfo'].keys(): + raise Exception('Internal error: a device input may refer to the output of a device not considered for this state') + thisNid = self.getNid() + return (threadMap['DeviceInfo'][valueNid]['ThreadName'] == threadMap['DeviceInfo'][thisNid]['ThreadName']) and \ + (threadMap['DeviceInfo'][valueNid]['SupervisorNid'] == threadMap['DeviceInfo'][thisNid]['SupervisorNid']) + + #check whether MARTe2 device referred by value belongs to the same supervisor + def hostedInSameSupervisor(self, value, threadMap): + valueNid = self.getMarteDevice(value).getNid() + if not valueNid in threadMap['DeviceInfo'].keys(): + raise Exception('Internal error: a device input may refer to the output of a device not considered for this state') + return threadMap['DeviceInfo'][self.getNid()]['SupervisorNid'] == threadMap['DeviceInfo'][valueNid]['SupervisorNid'] + + #Check whether MARTe2 thread synchronizes the thread for this device + def hostedInSynchronizingThread(self, value, threadMap): + valueNid = self.getMarteDevice(value).getNid() + if not valueNid in threadMap['DeviceInfo'].keys(): + raise Exception('Internal error: a device input may refer to the output of a device not considered for this state') + thisNid = self.getNid() + refThreadName = threadMap['DeviceInfo'][valueNid]['ThreadName'] + thisThreadName = threadMap['DeviceInfo'][thisNid]['ThreadName'] + refSupervisorNid = threadMap['DeviceInfo'][valueNid]['SupervisorNid'] + thisSupervisorNid = threadMap['DeviceInfo'][thisNid]['SupervisorNid'] + + return threadMap['ThreadInfo'][thisThreadName]['SyncThreadName'] == refThreadName and \ + threadMap['ThreadInfo'][thisThreadName]['SyncThreadSupervisor'] == refSupervisorNid + + #Get subsamplingRatio for synchronized thread + def getSubsamplingRatio(self, value, threadMap): + valueNid = self.getMarteDevice(value).getNid() + thisNid = self.getNid() + refThreadName = threadMap['DeviceInfo'][valueNid]['ThreadName'] + thisThreadName = threadMap['DeviceInfo'][thisNid]['ThreadName'] + refSupervisorNid = threadMap['DeviceInfo'][valueNid]['SupervisorNid'] + thisSupervisorNid = threadMap['DeviceInfo'][thisNid]['SupervisorNid'] + + if not (threadMap['ThreadInfo'][thisThreadName]['SyncThreadName'] == refThreadName and \ + threadMap['ThreadInfo'][thisThreadName]['SyncThreadSupervisor'] == refSupervisorNid): + raise Exception('Internal error: getSubsamplingRation called for non sychronized threads') + + return threadMap['ThreadInfo'][thisThreadName]['SyncDiv'] + + #returns the type of the referenced output + def getReferencedType(self, value): + try: + return value.getParent().getNode('TYPE').data() + except: + raise Exception('Internal error: getReferenced Type failed for node '+value.getPath()) + + + # extends type definition. TypeDict is organized as a Dictionary whose keys are the assigned type names ('Type1, Type2, ....') and the corresponding + # contents are lists of dicts corresponding to the type fields. At every field corresponds a dictionaty with the following fields + # 'Name': name of the filed + # 'Type' : type of the field. Can be a native type or in turn the assigned name of an existing type + # 'NumberOfElememts': number of instances (array) + # buildTypes makes sure that the same structure is never replicated in diferent types + def getTypeName(self, fieldsRoot, typesDict): + typeName = fieldsRoot.getParent().getNode('NAME').data()+'_Type' + retType = [] + for fieldNode in fieldsRoot.getChildren(): + currField = {} + currField['Name'] = fieldNode.getNode('NAME').data() try: - outputTriggerNid = dev.getNode('.OUTPUTS:TRIGGER').getData().getNid() - if outputTriggerNid == outValueNode.getNid(): - outDevs.append(dev) + numFields = len(fieldNode.getNode('FIELDS').getChildren()) except: - pass - - return outDevs + numFields = 0 + if numFields > 0: + currField['Type'] = self.getTypeName(fieldNode.getNode('FIELDS'), typesDict) + else: + try: + currField['Type'] = fieldNode.getNode('TYPE').data() + except: + raise Exception("Missing required type definition for "+fieldNode.getPath()) + numDims, numEls = self.parseDimension(fieldNode.getNode('DIMENSIONS').data()) + currField['NumberOfElements'] = numEls + retType.append(currField) + typesDict[typeName] = retType + return typeName + + #Check whether the type is a legal one (either builtin or defines in typesDict) + def checkNativeType(self, inType, typesDict): + builtinTypes = ['int8', 'uint8', 'int16', 'uint16', 'char8', 'int32', 'uint32', 'int64', 'uint64', 'float32', 'float64'] + if inType in builtinTypes: + return + if inType in typesDict.keys(): + return + raise Exception('Unrecognized type for '+self.getPath()+' : '+inType) + + # Returns None if the passed definition is not contained in typesDict + def checkTypeName(self, typeDef, typesDict): + for typeName in typesDict.keys(): + if self.sameType(typesDict[typeName], typeDef): + return typeName + return None + + + # Check if the two types are idenycal (including field names) + def sameType(self, typeDef1, typeDef2): + if len(typeDef1) != len(typeDef2): + return False + for idx in range(len(typeDef1)): + if typeDef1[idx]['Name'] != typeDef2[idx]['Name']: + return False + if typeDef1[idx]['Type'] != typeDef2[idx]['Type']: + return False + if typeDef1[idx]['NumberOfElements'] != typeDef2[idx]['NumberOfElements']: + return False + return True - def isUsedOnAnotherThreadSynch(self, threadMap, outValueNode): -#return True if outValueNode is refrenced by a device in a different synchronized thread, BUT NOT the sychronizing one - connectedDev = self.getConnectedDev(threadMap, outValueNode) - if len(connectedDev) == 0: - return False #out not referenced by any other devices - isUsed = False - for dev in connectedDev: - if not self.onSameThread(threadMap, dev): - if self.sameSynchSource(dev): #if referenced by a device belonging to a synchronized thread - synchDev = self.getSynchDev() - if not self.onSameThread(threadMap, synchDev, dev): - #out referenced by a synchronized device not belonging to the synchronizing Thread - isUsed = True - return isUsed - - def isUsedOnAnotherThreadAsynch(self, threadMap, outValueNode): -#return True if outValueNode is refrenced by a device in a different synchronized thread, BUT NOT the sychronizing one - connectedDev = self.getConnectedDev(threadMap, outValueNode) - if len(connectedDev) == 0: - return False #out not referenced by any other devices - isUsed = False - for dev in connectedDev: - if not self.onSameThread(threadMap, dev): - if self.sameSynchSource(dev): #if referenced by a device belonging to a synchronized thread - synchDev = self.getSynchDev() - if self.onSameThread(threadMap, synchDev, dev): - #out referenced by a synchronized device belonging to the synchronizing Thread - isUsed = True - else: - isUsed = True - return isUsed - - def isUsedOnAnotherThread(self, threadMap, outValueNode): -#return True if refers to a device in another thread - connectedDev = self.getConnectedDev(threadMap, outValueNode) - if len(connectedDev) == 0: - return False #out not referenced by any other devices - isUsed = False - for dev in connectedDev: - if not self.onSameThread(threadMap, dev): - isUsed = True - return isUsed - - - def isUsed(self, threadMap, outValueNode): - devList = self.getDevList(threadMap) - for dev in devList: - # Check first timebase dependency + # Convert dimensions array into NumberOfDimensions, NumberOfElements + def parseDimension(self, dimensions): + if np.isscalar(dimensions): + if dimensions != 0: + raise Exception('Scalar value for dimensions can be only 0 '+str(dimensions) + ' in '+self.getPath()) + numEls = 1 + numDims = 0 + else: + numDims = len(dimensions) + numEls = 1 + for dim in dimensions: + numEls *= dim + return numDims, numEls + + #return a flattened list of structure fields ORDERED BY NID NUMBER. Valid for both Inputs and Outputs + def getFlattenedFields(self, fieldRoot): + fieldNodes = fieldRoot.getChildren() + fieldNodes.sort() + retFields = [] + for fieldNode in fieldNodes: try: - timebaseNode = TreeNode(dev, self.getTree).getNode(':TIMEBASE') - if timebaseNode.getData().getNid() == outValueNode.getNid(): - return True + numFields = len(fieldNode.getNode('FIELDS').getChildren()) except: - pass - try: # If it is an input device it has an INPUTS subtree - inputSigs = dev.getNode('.INPUTS') - for inputChan in inputSigs.getChildren(): - # check first the case of a structure - try: - fieldsChan = inputChan.getNode('FIELDS') - for fieldChan in fieldsChan.getChildren(): - try: - fieldNid = fieldChan.getNode( - 'VALUE').getData().getNid() - if fieldNid == outValueNode.getNid(): - return True - except: - pass - except: - pass - # Non structure case - try: - inputNid = inputChan.getNode( - 'VALUE').getData().getNid() - except: - continue - if inputNid == outValueNode.getNid(): - return True + numFields = 0 + if numFields > 0: + retFields += self.getFlattenedFields(fieldNode.getNode('FIELDS')) + else: + retFields.append(fieldNode) + return retFields + + + #Build the representation of the Input signals of a MARTe2 device (Array of dictionaries) and complete the auxiliary + #passed information + def getInputSignalsDict(self, sigNodes, threadMap, typesDict, resampledSyncSigs, syncInputsToBeReceived, + asyncInputsToBeReceived, treeRefs, constRefs, inputsToBePacked, isFieldCheck = False): + sigDicts = [] + for sigNode in sigNodes: + currSig = {} +#Value. Missing value forces skipping the input. Here skipping will be carried out also for struct inputs that are defined element by element + try: + value = sigNode.getNode(':VALUE').getData() except: - pass - return False # this output is not used by any input - -# Check if any field of this output structure is used - def isAnyFieldUsed(self, threadMap, outputDict): - for fieldDict in outputDict['fields']: - if self.isUsed(threadMap, fieldDict['value_nid']): - return True - return False - -#get alias for struct fields - def getFieldAliasName(self, fieldValNode): - aliasName = fieldValNode.getParent().getParent().getParent().getNode( - ':name').data()+'_'+fieldValNode.getParent().getNode(':name').data() - return aliasName - - - -# Add a new type to the current type list. If a type with the same name is not found, the dictionary (name, fields) is added, -# otherwise its fields are checked for consistency. Return false mismatch deteched, true otherwise - def addType(self, name, fieldDicts, typeDicts): - for typeDict in typeDicts: - if typeDict['name'] == name: - if len(typeDict['fields']) != len(fieldDicts): - print('Number of fields mismatch for type '+name) - return False - for typeIdx in range(len(typeDict['fields'])): - if typeDict['fields'][typeIdx]['name'] != fieldDicts[typeIdx]['name']: - print('Field name mismatch for Type '+name+' ' + - fieldDicts[typeIdx]['name'] + ' ' + typeDict['fields'][typeIdx]['name']) - return False - if typeDict['fields'][typeIdx]['type'] != fieldDicts[typeIdx]['type']: - print('Field type mismatch for Type '+name+' ' + - fieldDicts[typeIdx]['type'] + ' ' + typeDict['fields'][typeIdx]['type']) - return False - if typeDict['fields'][typeIdx]['dimensions'] != fieldDicts[typeIdx]['dimensions']: - print('Field dimensions mismatch for Type '+name+' ' + - fieldDicts[typeIdx]['dimensions'] + ' ' + typeDict['fields'][typeIdx]['dimensions']) - return False - return True - # If we arrive here, the type is new - typeDicts.append({'name': name, 'fields': fieldDicts}) - return True - - -# GAM - - def getMarteGamInfo(self, threadMap, gams, dataSources, gamList, typeDicts): - configDict = self.getGamInfo() - gamName = configDict['gamName'] - gamClass = configDict['gamClass'] - timebase = configDict['timebase'] - paramDicts = configDict['paramDicts'] - inputDicts = configDict['inputDicts'] - outputDicts = configDict['outputDicts'] - outputTrigger = configDict['outputTrigger'] - debugEnabled = configDict['debug'] - - outPeriod = 0 # If different from 0, this means that the corresponing component is driving the thread timing + if isFieldCheck: + #If isFieldCheck getInputSignalsDict is working on the flattened field nodes that are assured not to be empty + raise Exception('Internal error: Unexpected empty field for '+sigNode.getPath()) + try: + numFields = len(sigNode.getNode('FIELDS').getChildren()) + except: + numFields = 0 + if numFields == 0: + continue #Missing value for non strct inputs forces skipping the input. + # we need to handle here the possible case of a structured input + # getFlattenedFields check also that if a field is non empty, then all fields must be nonempty. If all fields are empty, [] is returned + fieldNodes = self.getFlattenedFields(sigNode.getNode('FIELDS')) + fieldDicts = {} + fieldDicts['Inputs'] = self.getInputSignalsDict(fieldNodes, threadMap, typesDict, resampledSyncSigs, syncInputsToBeReceived, + asyncInputsToBeReceived, treeRefs, constRefs, [], True) + fieldDicts['Name'] = self.getSignalName(sigNode) + fieldDicts['Type'] = self.getTypeName(sigNode.getNode('FIELDS'), typesDict) + inputsToBePacked.append(fieldDicts) + value = None +#Name + currSig['Name'] = self.getSignalName(sigNode) +#Type + try: + numFields = len(sigNode.getNode('FIELDS').getChildren()) + except: + numFields = 0 -#GAB Oct 2022: define preGamList and postGamList for a proper order of generated GAMs - preGamList = [] - postGamList = [] + if numFields > 0: + type = self.getTypeName(sigNode.getNode('FIELDS'), typesDict) + else: + try: + type = sigNode.getNode(':TYPE').data() + except: + raise Exception('Missing type definition for '+sigNode.getNode(':TYPE').getPath()) + currSig['Type'] = type - try: - syncDiv = self.timebase_div.data() - except: - syncDiv = 1 - resampledSyncSigs = [] #Input Signals for which PickSampleGAM is required -# timebase - if isinstance(timebase, Range): - period = timebase.getDescAt(2).data() - try: - startTime = timebase.getDescAt(0).data() - except: - startTime = 0 - outPeriod = period # Driving thread timing - dataSourceText = ' +'+gamName+'_Timer' + ' = {\n' - dataSourceText += ' Class = LinuxTimer\n' - dataSourceText += ' SleepNature = "Default"\n' - dataSourceText += ' Signals = {\n' - dataSourceText += ' Counter = {\n' - dataSourceText += ' Type = uint32\n' - dataSourceText += ' }\n' - dataSourceText += ' Time = {\n' - dataSourceText += ' Type = uint32\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - dataSourceText = ' +'+gamName+'_Timer_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - -# gamList.append(gamName+'Timer_IOGAM') - preGamList.append(gamName+'Timer_IOGAM') - gamText = ' +'+gamName+'Timer_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+gamName+'_Timer\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+gamName+'_Timer\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' Frequency = '+str(round(1./period, 4))+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+gamName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+gamName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - # Check if time information is required by another synchronized thread - if self.isUsedOnAnotherThreadSynch(threadMap, self.timebase): - - dataSourceText = ' +'+gamName+'_Timer_Synch = {\n' - dataSourceText += ' Class = RealTimeThreadSynchronisation\n' - dataSourceText += ' Timeout = 1000000\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - preGamList.append(gamName+'Timer_Synch_IOGAM') - gamText = ' +'+gamName+'Timer_Synch_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+gamName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+gamName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - # gamText += ' Frequency = '+str(round(1./period,4))+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+gamName+'_Timer_Synch\n' - gamText += ' Type = uint32\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+gamName+'_Timer_Synch\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - timerDDB = gamName+'_Timer_DDB' - - # Link to other component up in the chain - elif isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - prevTimebase = timebase - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() - origName = self.convertPath(prevTimebase.getParent().getFullPath()) - # Check whether the synchronization source is a Synch Input. Only in this case, the origin DDB is its output DDB since that device is expected to produce Time - originMode = prevTimebase.getParent().getNode('mode').data() +#NumberOfElements, NumberOfDimensions + if numFields == 0: + try: + dimensions = sigNode.getNode(':DIMENSIONS').data() + except: + raise Exception('Missing dimension definition for '+sigNode.getNode(':DIMENSIONS').getPath()) + currSig['NumberOfDimensions'], currSig['NumberOfElements'] = self.parseDimension(dimensions) + else: #Arrays of Structures not suppported + currSig['NumberOfDimensions'] = 0 + currSig['NumberOfElements'] = 1 +#samples try: - startTime = timebase.getDescAt(0).data() + samples = sigNode.getNode(':SAMPLES').data() except: - startTime = 0 - if originMode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: - if self.onSameThread(threadMap, prevTimebase.getParent()): - timerDDB = origName+'_Output_DDB' - else: - timerDDB = gamName+'_Res_DDB' - resampledSyncSigs.append({'name': 'Time', 'datasource': origName+'_Output_Synch', - 'type': 'uint32', 'dimensions': 0, 'elements': 1, 'samples':syncDiv}) -# timerDDB = origName+'_Output_Synch' - try: - # Get period from driving synchronizing device - outPeriod = timebase.getDescAt(2).data() - except: - outPeriod = 0 + samples = 1 + currSig['Samples'] = samples + #Parameters + if not isFieldCheck: + try: + numParameters = len(sigNode.getNode('PARAMETERS').getChildren()) + except: + numParameters = 0 else: - if self.onSameThread(threadMap, prevTimebase.getParent()): - timerDDB = origName+'_Timer_DDB' - else: - timerDDB = origName+'_Timer_Synch' - try: - # Get period from driving synchronizing device - outPeriod = timebase.getDescAt(2).data() - except: - outPeriod = 0 + numParameters = 0 + if numParameters > 0: + currSig['Parameters'] = self.getParametersDict(sigNode.getNode('PARAMETERS')) +#Data Source + if value == None: #Handle the case the structured input has been defined by means of its fields + currSig['DataSource'] = self.getMarteDeviceName(sigNode)+'_Input_Bus_DDB' + sigDicts.append(currSig) + continue - else: - print('ERROR: Invalid timebase definition') - return 0 - - # check for inpu bus conversions (defined later) ADDED AFTERWARDS - needInputBusConversion = False - for inputDict in inputDicts: - if len(inputDict['fields']) > 0 and not 'value' in inputDict: - needInputBusConversion = True -# if needInputBusConversion: - # Will be defined later, but must execute before this GAM -# gamList.append(gamName+'_Input_Bus_IOGAM') -# preGamList.append(gamName+'_Input_Bus_IOGAM') - - #Head and parameters - gamText = ' +'+gamName+' = {\n' - gamText += ' Class = '+gamClass+'\n' - gamText = self.reportParameters(paramDicts, gamText, 1) - # for paramDict in paramDicts: - # if paramDict['is_text']: - # gamText += ' '+paramDict['name']+' = "'+str(paramDict['value'])+'"\n' - # else: - # gamText += ' '+paramDict['name']+' = '+self.convertVal(str(paramDict['value']))+'\n' - -# input Signals - inputSignals = [] # Used for debug printout - inputSignals.append({'name': 'Time', 'datasource': timerDDB, - 'type': 'uint32', 'dimensions': 0, 'elements': 1}) - - if len(inputDicts) > 0: - gamText += ' InputSignals = {\n' - nonGamInputNodes = [] - for inputDict in inputDicts: - if len(inputDict['fields']) == 0 and not 'value' in inputDict: #no value, skip + if self.isTimebase(value): + currSig['DataSource'] = self.timerDDB + currSig['Type'] = self.timerType + currSig['Alias'] = 'Time' + currSig['NumberOfElements'] = 1 + currSig['NumberOfDimensions'] = 0 + sigDicts.append(currSig) continue - signalDict = {} - # This is a Time field referring to this timebase - if 'value' in inputDict and isinstance(inputDict['value'], TreeNode) and inputDict['value'].getNodeName() == 'TIMEBASE' and inputDict['value'].getParent() == self: - gamText += ' Time = {\n' - gamText += ' DataSource = ' + timerDDB+'\n' - gamText += ' Samples = '+str(syncDiv)+'\n' - else: # Normal reference - isTreeRef = False - forceUsingSamples = False - # --------------------------------------------If this is a structured input - if len(inputDict['fields']) > 0: - if not self.addType(inputDict['type'], inputDict['fields'], typeDicts): - raise Exception( - 'Incompatible Type definition: '+inputDict['type']) - if not 'value' in inputDict: # it shall be specified in its fields - gamText += ' '+inputDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Input_Bus_DDB\n' - gamText += ' Type = '+inputDict['type']+'\n' - gamText += ' NumberOfDimensions = 0\n' - # Arrays of structures are not suppprted - gamText += ' NumberOfElements = 1\n' - signalDict['name'] = inputDict['name'] - signalDict['datasource'] = gamName+'_Input_Bus_DDB' + + + if self.isMarteDeviceRef(value): #If it is the reference to the output of another MARTe2 device (consistency checks also carried out) + self.checkMarteDeviceRef(value, sigNode) #Perform consistecny checks, raise Exception on case + currSig['Alias'] = self.getSignalName(value) + if self.hostedInSameThread(value, threadMap): #Reference within same thread + if isFieldCheck: + currSig['DataSource'] = self.getMarteDeviceName(value)+'_Expanded_Output_DDB' else: - sourceNode = inputDict['value'].getParent( - ).getParent().getParent() - if sourceNode.getUsage() != 'DEVICE': - raise Exception( - 'Invalid value for struct input ' + inputDict['name']) - sourceGamName = self.convertPath( - sourceNode.getFullPath()) - if 'name' in inputDict: - signalGamName = inputDict['name'] - aliasName = inputDict['value'].getParent().getNode( - ':name').data() - signalDict['alias'] = aliasName - else: - signalGamName = inputDict['value'].getParent().getNode( - ':name').data() - - gamText += ' '+signalGamName+' = {\n' - if self.onSameThread(threadMap, sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Output_DDB\n' - signalDict['name'] = signalGamName - signalDict['datasource'] = sourceGamName + \ - '_Output_DDB' - ##elif self.sameSynchSource(sourceNode): - elif self.isUsedOnAnotherThreadSynch(threadMap, sourceNode): - signalDict['type'] = inputDict['type'] - if syncDiv > 1: - gamText += ' DataSource = '+gamName+'_Res_DDB\n' - signalDict['datasource'] = sourceGamName + '_Output_Synch' - signalDict['samples'] = syncDiv - signalDict['dimensions'] = inputDict['dimensions'] - signalDict['elements'] = inputDict['elements'] - resampledSyncSigs.append(signalDict) + currSig['DataSource'] = self.getMarteDeviceName(value)+'_Output_DDB' + else: + if self.hostedInSameSupervisor(value, threadMap): #Reference within same supervisor + if self.hostedInSynchronizingThread(value, threadMap): + subsamplingRatio = self.getSubsamplingRatio(value, threadMap) + if subsamplingRatio > 1: + currSig['DataSource'] = self.getMarteDeviceName(sigNode)+'_Res_DDB' + resampledSyncSigs.append({'Name':currSig['Name'], + 'DataSource': self.getMarteDeviceName(value)+'_Output_Sync', + 'Type': currSig['Type'], + 'NumberOfDimensions': currSig['NumberOfDimensions'], + 'NumberOfElements' : currSig['NumberOfElements'], + 'Alias' : currSig['Alias'], + 'Samples': subsamplingRatio * samples, + }) else: - gamText += ' DataSource = '+sourceGamName+'_Output_Synch\n' - signalDict['name'] = signalGamName - signalDict['datasource'] = sourceGamName + '_Output_Synch' + currSig['DataSource'] = self.getMarteDeviceName(value)+'_Output_Sync' else: - gamText += ' DataSource = '+sourceGamName+'_Output_Asynch\n' - if 'name' in inputDict: - gamText += ' Alias = "'+aliasName+'"\n' - gamText += ' Type = '+inputDict['type']+'\n' - gamText += ' NumberOfDimensions = 0\n' - # Arrays of structures are not suppprted - gamText += ' NumberOfElements = 1\n' - # endif direct structured link - # endif structured input - else: # Non structured input + currSig['DataSource'] = self.getMarteDeviceName(value)+'_Output_Async' + else: #Reference from another supervisor + if self.hostedInSynchronizingThread(value, threadMap): + subsamplingRatio = self.getSubsamplingRatio(value, threadMap) + syncInputsToBeReceived.append({'Name':currSig['Name'], + 'DataSource': self.getMarteDeviceName(value)+'_Output_Sync', + 'Type': currSig['Type'], + 'NumberOfDimensions': currSig['NumberOfDimensions'], + 'NumberOfElements' : currSig['NumberOfElements'], + 'Alias' : currSig['Alias'], + 'Samples': subsamplingRatio * samples, + }) + subsamplingRatio = self.getSubsamplingRatio(value, threadMap) + if subsamplingRatio > 1: + currSig['DataSource'] = self.getMarteDeviceName(sigNode)+'_Res_DDB' + resampledSyncSigs.append({'Name':currSig['Name'], + 'DataSource': self.getMarteDeviceName(self)+'_RTN_IN_DDB', + 'Type': currSig['Type'], + 'NumberOfDimensions': currSig['NumberOfDimensions'], + 'NumberOfElements' : currSig['NumberOfElements'], + 'Alias' : currSig['Alias'], + 'Samples': subsamplingRatio*samples, + }) + else: #Not subsampled + currSig['DataSource'] = self.getMarteDeviceName(self)+'_RTN_IN_DDB' + else: #not synchronous + asyncInputsToBeReceived.append({'Name':currSig['Name'], + 'DataSource': self.getMarteDeviceName(value)+'_Output_Sync', + 'Type': currSig['Type'], + 'NumberOfDimensions': currSig['NumberOfDimensions'], + 'NumberOfElements' : currSig['NumberOfElements'], + 'Alias' : currSig['Alias'], + 'Samples': samples, + }) + currSig['DataSource'] = self.getMarteDeviceName(self)+'_RTN_IN_DDB' + else: #Not a reference to the output of a MARTe2 device + try: + currInput = value.evaluate() + except: + raise Exception('Missing Input signal for '+self.getPath()) + if isinstance(currInput, MDSplus.Signal): + currSig['DataSource'] = self.getMarteDeviceName(self)+'_TreeInDDB' try: - # it may be a struct field - try: - isInputStructField = (inputDict['value'].getParent().getParent().getName() == 'FIELDS') - except: - isInpuStructField = False - if isInputStructField: - sourceNode = inputDict['value'].getParent( - ).getParent().getParent().getParent().getParent() - else: # normal field - sourceNode = inputDict['value'].getParent( - ).getParent().getParent() - if sourceNode.getUsage() != 'DEVICE': - isTreeRef = True + if sigNode.getNode['COL_ORDER'].data() == 'YES': + useColumnOrder = 1 else: - sourceGamName = self.convertPath( - sourceNode.getFullPath()) - if 'name' in inputDict: - signalGamName = inputDict['name'] - if isInputStructField: - aliasName = inputDict['value'].getParent().getParent().getParent().getNode( - ':name').data()+'_'+inputDict['value'].getParent().getNode(':name').data() - else: - aliasName = inputDict['value'].getParent().getNode( - ':name').data() - signalDict['alias'] = aliasName - else: - signalGamName = inputDict['value'].getParent().getNode( - ':name').data() + useColumnOrder = 0 except: - isTreeRef = True - - if isTreeRef: - if 'name' in inputDict: - signalName = inputDict['name'] - aliasName = self.convertPath( - inputDict['value_nid'].getPath()) - signalDict['alias'] = aliasName - try: - nonGamInputNodes.append( - {'expr': inputDict['value'], 'dimensions': inputDict['dimensions'], 'name': aliasName, 'col_order': inputDict['col_order']}) - except: - pass - else: - signalName = self.convertPath( - inputDict['value_nid'].getPath()) - nonGamInputNodes.append( - {'expr': inputDict['value'], 'dimensions': inputDict['dimensions'], 'name': signalName, 'col_order': inputDict['col_order']}) - gamText += ' '+signalName+' = {\n' - gamText += ' DataSource = '+gamName+'_TreeInDDB\n' - signalDict['name'] = signalName - #GAB 2022 signalDict['datasource'] = gamName+'_TreeInput_Logger' - signalDict['datasource'] = gamName+'_TreeInput_LoggerDDB' - else: - gamText += ' '+signalGamName+' = {\n' - if isInputStructField: - if self.onSameThread(threadMap, sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Expanded_Output_DDB\n' - signalDict['name'] = signalGamName - signalDict['datasource'] = sourceGamName + '_Expanded_Output_DDB' - aliasName = inputDict['value'].getParent().getParent().getParent().getNode( - ':name').data()+'_'+inputDict['value'].getParent().getNode(':name').data() - gamText += ' Alias = '+aliasName+'\n' - - else: - synchDev = self.getSynchDev() - if self.isUsedOnAnotherThreadSync(threadMap, sourceNode): - #fromDev = self.getDevForOutput(threadMap, sourceNode) - #if synchDev.getNid() == fromDev.getNid(): #If input derives from synchronizing thread - if syncDiv > 1: - gamText += ' DataSource = '+gamName+'_Res_DDB\n' - signalDict['datasource'] = sourceGamName + '_OutputSynch' - signalDict['samples'] = syncDiv - signalDict['type'] = inputDict['type'] - signalDict['dimensions'] = inputDict['dimensions'] - try: - signalDict['elements'] = inputDict['elements'] - except: - signalDict['elements'] = 1 - resampledSyncSigs.append(signalDict) - else: - gamText += ' DataSource = '+sourceGamName+'_Output_Synch\n' - signalDict['datasource'] = sourceGamName + '_Output_Synch' - if self.isUsedOnAnotherThreadAsync(threadMap, sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Output_Asynch\n' - signalDict['datasource'] = sourceGamName + '_Output_Asynch' - - + useColumnOrder = 0 + treeRefs.append({ + 'Name':currSig['Name'], + 'Expression': value, + 'UseColumnOrder': useColumnOrder, + 'Type': currSig['Type']}) + else: #It is a constant + if not isinstance(value.evaluate(), MDSplus.Scalar): + raise Exception('Invalid input for '+sigNode.getPath()+': '+value.decompile()) + currSig['DataSource'] = self.getMarteDeviceName(sigNode)+'_ConstInDDB' + constRefs.append({ + 'Name':currSig['Name'], + 'Value': value.data(), + 'Type': currSig['Type']}) + sigDicts.append(currSig) + #endfor + return sigDicts + + #Management of the trigger input for storing outputs, if defined. It does not declares anything but possibly affects the passed structures + def handleOutputTrigger(self, threadMap, resampledSyncSigs, syncInputsToBeReceived, + asyncInputsToBeReceived, treeRefs): + try: + value = self.getNode('OUTPUTS:TRIGGER').getData() + except: + return #No trigger defined + if self.isMarteDeviceRef(value): #If it is the reference to the output of another MARTe2 device (consistency checks also carried out) + alias = self.getSignalName(value) + if self.hostedInSameSupervisor(value, threadMap): #Reference within same supervisor + if self.hostedInSynchronizingThread(value, threadMap): + subsamplingRatio = self.getSubsamplingRatio(value, threadMap) + if subsamplingRatio > 1: + resampledSyncSigs.append({'Name':'OutputTrigger', + 'DataSource': self.getMarteDeviceName(value)+'_Output_Sync', + 'Type': self.getReferencedType(value), + 'NumberOfDimensions': 0, + 'NumberOfElements' : 1, + 'Alias' : alias, + 'Samples': subsamplingRatio, + }) + else: #Reference from another supervisor + if self.hostedInSynchronizingThread(value, threadMap): + syncInputsToBeReceived.append({'Name':'OutputTrigger', + 'DataSource': self.getMarteDeviceName(value)+'_Output_Sync', + 'Type': self.getReferencedType(value), + 'NumberOfDimensions': 0, + 'NumberOfElements' : 1, + 'Alias' : alias, + 'Samples': 1, + }) + subsamplingRatio = self.getSubsamplingRatio(value, threadMap) + if subsamplingRatio > 1: + resampledSyncSigs.append({'Name':'OutputTrigger', + 'DataSource': self.getMarteDeviceName(self)+'_RTN_IN_DDB', + 'Type': self.getReferencedType(value), + 'NumberOfDimensions': 0, + 'NumberOfElements' : 1, + 'Alias' : alias, + 'Samples': subsamplingRatio, + }) + else: #Not synchornized to other supervisor's thread + asyncInputsToBeReceived.append({'Name':'OutputTrigger', + 'DataSource': self.getMarteDeviceName(value)+'_Output_Sync', + 'Type': self.getReferencedType(value), + 'NumberOfDimensions': 0, + 'NumberOfElements' : 1, + 'Alias' : alias, + 'Samples': 1, + }) + + else: #Not a reference to the output of a MARTe2 device + if isinstance(value.evaluate(), MDSplus.Signal): + treeRefs.append({'Name':'OutputTrigger', 'Expression': value, 'UseColumnOrder': 0, 'Type': 'uint8'}) - # NOTE: for expanded outputs communication is supported only within the same thread!!!!!!!!!!!! - # gamText += ' DataSource = '+sourceGamName+'_Expanded_Output_DDB\n' - signalDict['name'] = signalGamName - else: - if self.onSameThread(threadMap, sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Output_DDB\n' - signalDict['name'] = signalGamName - signalDict['datasource'] = sourceGamName + \ - '_Output_DDB' - elif self.sameSynchSource(sourceNode): - if syncDiv > 1: - gamText += ' DataSource = '+gamName+'_Res_DDB\n' - elif self.isUsedOnAnotherThreadSynch(threadMap, sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Output_Synch\n' - else: - gamText += ' DataSource = '+sourceGamName+'_Output_Asynch\n' - signalDict['name'] = signalGamName - signalDict['type'] = inputDict['type'] - signalDict['datasource'] = sourceGamName + '_Output_Synch' - if syncDiv > 1: - signalDict['datasource'] = sourceGamName+'_Output_Synch' - signalDict['samples'] = syncDiv - signalDict['dimensions'] = inputDict['dimensions'] - signalDict['elements'] = inputDict['elements'] - resampledSyncSigs.append(signalDict) - else: - gamText += ' DataSource = '+sourceGamName+'_Output_Asynch\n' - if 'name' in inputDict: - gamText += ' Alias = "'+aliasName+'"\n' - - if 'type' in inputDict: - gamText += ' Type = '+inputDict['type']+'\n' - - signalDict['type'] = inputDict['type'] - if 'dimensions' in inputDict and not forceUsingSamples: - dimensions = inputDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(inputDict['dimensions']) - numberOfElements = 1 - for currDim in inputDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - gamText = self.addSignalParameters( - inputDict['value_nid'].getParent().getNode('parameters'), gamText) - signalDict['dimensions'] = numberOfDimensions - signalDict['elements'] = numberOfElements -# endif len(inputDict['fields']) > 0 -# endif Normal Reference - gamText += ' }\n' - - inputSignals.append(signalDict) - if len(inputDicts) > 0: - gamText += ' }\n' - - - -# print('*****NON GAM INPUT NODES******') -# print(nonGamInputNodes) -# if len(nonGamInputNodes) > 0: -# gamList.append(gamName+'_TreeIn') -# gamList.append(gamName) - ######################################################### Output Signals - outputSignals = [] # For debug printout - - synchThreadSignals = [] - asynchThreadSignals = [] - outputsToBeExpanded = [] - - if len(outputDicts) > 0: - gamText += ' OutputSignals = {\n' - for outputDict in outputDicts: - outputSignalDict = {} - outputSignalDict['name'] = outputDict['name'] - gamText += ' '+outputDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' Type = '+outputDict['type']+'\n' - outputSignalDict['type'] = outputDict['type'] - if outputDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - outputSignalDict['dimensions'] = 0 - outputSignalDict['elements'] = 1 - else: - numberOfDimensions = len(outputDict['dimensions']) - numberOfElements = 1 - for currDim in outputDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = '+str(numberOfElements)+'\n' - outputSignalDict['dimensions'] = numberOfDimensions - outputSignalDict['elements'] = numberOfElements - gamText = self.addSignalParameters( - outputDict['value_nid'].getParent().getNode('parameters'), gamText) - gamText += ' }\n' - if self.isUsedOnAnotherThreadSynch(threadMap, outputDict['value_nid']): - synchThreadSignals.append(outputSignalDict) - elif self.isUsedOnAnotherThread(threadMap, outputDict['value_nid']): - asynchThreadSignals.append(outputSignalDict) - outputSignals.append(outputSignalDict) - # --------------------------------------------If this is a structured output - if len(outputDict['fields']) > 0: - if not self.addType(outputDict['type'], outputDict['fields'], typeDicts): - raise Exception( - 'Incompatible Type definition: '+inputDict['type']) - # Check if any expanded field of thid output is used by other components - if self.isAnyFieldUsed(threadMap, outputDict): - outputsToBeExpanded.append(outputDict) - - if len(outputDicts) > 0: - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - dataSourceText = ' +'+gamName+'_Output_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - # If any structured output has to be expanded because any of its fields is referenced, create DDB and relative IOGAM - if len(outputsToBeExpanded) > 0: - gamText = ' +'+gamName+'_Output_Bus_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - for outputDict in outputsToBeExpanded: - gamText += ' '+outputDict['name']+' = {\n' - gamText += ' Type = '+outputDict['type']+'\n' - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - for outputDict in outputsToBeExpanded: - for fieldDict in outputDict['fields']: - if self.isUsedOnAnotherThreadSynch(threadMap, fieldDict['value_nid']): - synchThreadSignals.append(fieldDict) - elif self.isUsedOnAnotherThread(threadMap, fieldDict['value_nid']): - asynchThreadSignals.append(fieldDict) - - gamText += ' ' + \ - outputDict['name']+'_'+fieldDict['name'] + ' = {\n' - gamText += ' Type = '+fieldDict['type']+'\n' - gamText += ' DataSource = '+gamName+'_Expanded_Output_DDB\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - # NOTE: for expanded outputs communication is supported only within the same thread!!!!!!!!!!!! -# gamList.append(gamName+'_Output_Bus_IOGAM') - postGamList.append(gamName+'_Output_Bus_IOGAM') - dataSourceText = ' +'+gamName+'_Expanded_Output_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - # If any output has to be stored We need to declare out DDB, out MdsWriter and relative IOGAM - if configDict['storeSignals']: - dataSourceText = ' +'+gamName+'_TreeOutput = {\n' - dataSourceText += ' Class = MDSWriter\n' - - if outputTrigger == None: - dataSourceText += ' NumberOfBuffers = 20000\n' - else: - dataSourceText += ' NumberOfBuffers = ' + \ - str(configDict['preTrigger'] + - configDict['postTrigger']+1)+'\n' - - dataSourceText += ' NumberOfPreTriggers = ' + \ - str(configDict['preTrigger'])+'\n' - dataSourceText += ' NumberOfPostTriggers = ' + \ - str(configDict['postTrigger'])+'\n' - dataSourceText += ' CPUMask = ' + \ - str(configDict['cpuMask'])+'\n' - dataSourceText += ' StackSize = 10000000\n' - dataSourceText += ' TreeName = "'+self.getTree().name+'"\n' - dataSourceText += ' PulseNumber = ' + \ - str(self.getTree().shot)+'\n' - if outputTrigger == None: - dataSourceText += ' StoreOnTrigger = 0\n' - else: - dataSourceText += ' StoreOnTrigger = 1\n' - dataSourceText += ' EventName = "'+gamName+'UpdatejScope"\n' - dataSourceText += ' TimeRefresh = 1\n' - dataSourceText += ' Signals = {\n' - currTimebase = self.timebase.evaluate() - if isinstance(currTimebase, Range): - period = currTimebase.delta.data() - else: - currTimebase = currTimebase.data() - period = currTimebase[1] - currTimebase[0] - - try: - syncDiv = self.timebase_div.data() - period = period * syncDiv - except: - pass - + #Return DataSource definition (dictionary) handling the inputs to be received form other supervisors + def handleInputsToBeReceived(self, inputs, isSync): + retDataSources = [] + retGams = [] + retData = {} + if isSync: + retData['Name'] = self.getMarteDeviceName(self)+'_SYNC_RTN_IN' + else: + retData['Name'] = self.getMarteDeviceName(self)+'_ASYNC_RTN_IN' -# If trigger is defined put it as first signal - if outputTrigger != None: - dataSourceText += ' Trigger = {\n' - dataSourceText += ' Type = uint8\n' - dataSourceText += ' }\n' -# Time Management - dataSourceText += ' Time = {\n' - dataSourceText += ' DiscontinuityFactor = 1\n' - dataSourceText += ' Type = '+self.getTimebaseType()+'\n' - dataSourceText += ' NodeName = "' + \ - configDict['outTimeNid'].getFullPath()+'"\n' -# keep into account possibl sample information for that GAM - currSamples = 1 - try: - 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 = '+str(timeSegLen) + '\n' - dataSourceText += ' AutomaticSegmentation = 0\n' - if outputTrigger != None: - dataSourceText += ' TimeSignal = 1\n' - #if startTime != 0: - # dataSourceText += ' SamplePhase = ' + \ - # str(int(round(startTime/period)))+'\n' - dataSourceText += ' }\n' - - for outputDict in outputDicts: - if outputDict['seg_len'] > 0: - dataSourceText += ' '+outputDict['name']+' = {\n' - dataSourceText += ' NodeName = "' + \ - outputDict['value_nid'].getFullPath()+'"\n' - dataSourceText += ' Period = ' + \ - str(period/currSamples)+'\n' - dataSourceText += ' DiscontinuityFactor = 1\n' - dataSourceText += ' MakeSegmentAfterNWrites = ' + \ - str(outputDict['seg_len'])+'\n' - dataSourceText += ' AutomaticSegmentation = 0\n' - dataSourceText += ' }\n' - - # Check if the output is a struct and seglen is > 0 for one o more fields - for fieldDict in outputDict['fields']: - if fieldDict['seg_len'] > 0: - dataSourceText += ' ' + \ - outputDict['name']+'_'+fieldDict['name']+' = {\n' - dataSourceText += ' NodeName = "' + \ - fieldDict['value_nid'].getFullPath()+'"\n' - dataSourceText += ' Period = ' + \ - str(period/currSamples)+'\n' - dataSourceText += ' MakeSegmentAfterNWrites = ' + \ - str(fieldDict['seg_len'])+'\n' - dataSourceText += ' AutomaticSegmentation = 0\n' - dataSourceText += ' }\n' - # end for fieldDict in outputDict['fields']: - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - -# gamList.append(gamName+'_TreeOutIOGAM') - postGamList.append(gamName+'_TreeOutIOGAM') - gamText = ' +'+gamName+'_TreeOutIOGAM = {\n' - if outputTrigger != None and syncDiv == 1: # If using output trigger, the trigger must be converted to uint8 GAB OCTOBER 2023 - gamText += ' Class = ConversionGAM\n' + try : + port = self.getNode('PORT').data() + except: + raise Exception('Missing Port definition for device '+ self.getPath()) + retData['Class'] = 'RTNIn' + if isSync: + retData['Parameters'] = {'IsSynch':1, 'CircuitId': self.getNid(), 'Port':port} + else: + retData['Parameters'] = {'IsSynch':0, 'CircuitId': self.getNid(), 'Port':port} + signals = [] + for syncInput in inputs: + currInput = copy.deepcopy(syncInput) + currInput['Name'] = currInput['Alias'] + currInput.pop('Alias') + currInput.pop('DataSource') + currInput.pop('Samples') + signals.append(currInput) + retData['Signals'] = signals + retDataSources.append(retData) + retDataSources.append({ + 'Name': self.getMarteDeviceName(self)+'_RTN_IN_DDB', + 'Class': 'GAMDataSource' + }) + retGam = {} + retGam['Name'] = self.getMarteDeviceName(self)+'_RTN_IN_IOGAM' + retGam['Class'] = 'IOGAM' + gamInputs = [] + for syncInput in inputs: + currInput = copy.deepcopy(syncInput) + currInput['DataSource'] = retData['Name'] + gamInputs.append(currInput) + retGam['Inputs'] = gamInputs + gamOutputs = [] + for syncInput in inputs: + currOutput = copy.deepcopy(syncInput) + # currOutput['Name'] = currInput['Alias'] + # currOutput.pop('Alias') + currOutput['DataSource'] = self.getMarteDeviceName(self)+'_RTN_IN_DDB' + gamOutputs.append(currOutput) + retGam['Outputs'] = gamOutputs + retGams.append(retGam) + return { + 'DataSources': retDataSources, + 'Gams': retGams + } + + #Build PickSampleGAM instance required to handle resampling + def handleResampledSyncSigs(self, resampledSyncSigs): + retGam = {} + retGam['Name'] = self.getMarteDeviceName(self)+'_Resampler' + retGam['Class'] = 'PickSampleGAM' + inputs = [] + for resSig in resampledSyncSigs: + inputs.append(resSig) + retGam['Inputs'] = inputs + outputs = [] + for resSig in resampledSyncSigs: + outputs.append({'Name': resSig['Alias'], 'Type': resSig['Type'], 'NumberOfDimensions': resSig['NumberOfDimensions'], + 'NumberOfElements': resSig['NumberOfElements'], 'Samples': 1, 'DataSource': self.getMarteDeviceName(self)+'_Res_DDB'}) + retGam['Outputs'] = outputs + return retGam + + # Build IOGAM required to pack struct inputs when their fields are indivividually defined + def handleInputPacking(self, inputsToBePacked): + retGam = {} + retGam['Name'] = self.getMarteDeviceName(self)+'_Input_Bus_IOGAM' + retGam['Class'] = 'IOGAM' + inputs = [] + for inputToBePacked in inputsToBePacked: + for currSig in inputToBePacked['Inputs']: + inputs.append(self.removeParametersFromDict(currSig)) + retGam['Inputs'] = inputs + outputs = [] + for inputToBePacked in inputsToBePacked: + outputs.append({'Name': inputToBePacked['Name'], 'Type': inputToBePacked['Type'], 'NumberOfDimensions':0, + 'NumberOfElements': 1, 'DataSource': self.getMarteDeviceName(self)+'_Input_Bus_DDB'}) + retGam['Outputs'] = outputs + return retGam + + #Build the MDSReaderGAM instance for hanling readout of signals defined in treeRefs + def handleTreeRefs(self, treeRefs): + outGam = {} + outGam['Name'] = self.getMarteDeviceName(self)+'_TreeIn' + outGam['Class'] = 'MDSReaderGAM' + outGam['Parameters'] = {'TreeName': self.getTree().name, 'ShotNumber': self.getTree().shot} + outGam['Inputs'] = [{'Name':'Time', 'DataSource':self.timerDDB, 'Type': self.timerType, 'NumberOfDimensions': 0, 'NumberOfElements': 1}] + outputs = [] + for treeRef in treeRefs: + outputs.append({ + 'Name': treeRef['Name'], + 'NumberOfDimensions': 0, + 'NumberOfElements': 1, + 'Type': treeRef['Type'], + 'UseColumnOrder': treeRef['UseColumnOrder'], + 'DataExpr': treeRef['Expression'].decompile(), + 'TimebaseExpr': '\"DIM_OF('+treeRef['Expression'].decompile()+')\"', + 'DataSource': self.getMarteDeviceName(self)+'_TreeInDDB'}) + outGam['Outputs'] = outputs + return outGam + + #Build a ConstantGAM instance to provide constant inputs + def handleConstRefs(self, constRefs): + outGam = {} + outGam['Class'] = 'ConstantGAM' + outGam['Name'] = self.getMarteDeviceName(self)+'_ConstInGAM' + outputs = [] + for constRef in constRefs: + outputs.append({ + 'Name': constRef['Name'], + 'Type': constRef['Type'], + 'Default': constRef['Value'], + 'DataSource': self.getMarteDeviceName(self)+'_ConstInDDB'}) + outGam['Outputs'] = outputs + return outGam + +#****************OUTPUTS + # Check if the passed output value node is referenced by any of the inputs passed in inputs + def isReferenced(self, outValNode, inputNodes): + outValNid = outValNode.getNid() + for currInputNode in inputNodes: + if currInputNode.getName() == 'TRIGGER': + try : + refTrigger = currInputNode.getData() + if isinstance(refTrigger, MDSplus.TreeNode) and refTrigger.getNid() == outValNid: + return True + except: + continue else: - if syncDiv > 1: - gamText += ' Class = PickSampleGAM\n' - else: - gamText += ' Class = IOGAM\n' - - gamText += ' InputSignals = {\n' - -# MdsWriter Trigger management - if outputTrigger != None: - physicalTrigger = True try: - triggerNode = outputTrigger.getParent().getParent().getParent() - - # If the trigger is pysically generated, i.e. it is derived from another device (GAM or Input) - if triggerNode.getUsage() == 'DEVICE': - - triggerGamName = self.convertPath( - triggerNode.getFullPath()) - triggerSigName = outputTrigger.getParent().getNode(':name').data() - gamText += ' '+triggerSigName+' = {\n' - if self.onSameThread(threadMap, triggerNode): - gamText += ' DataSource = '+triggerGamName+'_Output_DDB\n' - elif self.sameSynchSource(sourceNode): - gamText += ' DataSource = '+triggerGamName+'_Output_Synch\n' - - try: - syncDiv = self.timebase_div.data() - gamText += ' Samples = ' + \ - str(syncDiv)+'\n' - except: - pass # Consider RealTimeSynchronization downsampling only if timebase_div is defined - - else: - gamText += ' DataSource = '+triggerGamName+'_Output_Asynch\n' - gamText += ' }\n' - else: - physicalTrigger = False + if currInputNode.getNode('VALUE').getData().getNid() == outValNid: + return True except: - physicalTrigger = False - - if(not physicalTrigger): # Trigger source is derived from a stored input waveform - nonGamInputNodes.append({'expr': outputTrigger.decompile( - ), 'dimensions': 0, 'name': 'Trigger', 'col_order': False}) - gamText += ' '+'Trigger'+' = {\n' - gamText += ' DataSource = '+gamName+'_TreeInDDB\n' - gamText += ' Type = uint8\n' - gamText += ' }\n' -# end Trigger Management - -# Time signal management - gamText += ' Time = {\n' - gamText += ' DataSource = ' + timerDDB+'\n' -# gamText += ' Type = uint32\n' GAB2022 - gamText += ' Type = int32\n' - gamText += ' Samples = '+str(syncDiv)+'\n' - gamText += ' }\n' -# Other output signals -# first non struct outputs - for outputDict in outputDicts: - if outputDict['seg_len'] > 0 and len(outputDict['fields']) == 0: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' }\n' -# then struct outputs for which at least one field has seg_len > 0 - for outputDict in outputDicts: - fieldsToStore = False - for fieldDict in outputDict['fields']: - if fieldDict['seg_len'] > 0: - fieldsToStore = True - if fieldsToStore: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' Type = ' + outputDict['type']+'\n' - gamText += ' }\n' - # end for outputDict in outputDicts: - - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - if outputTrigger != None: - gamText += ' Trigger = {\n' - gamText += ' DataSource = '+gamName+'_TreeOutput\n' - gamText += ' type = uint8\n' - gamText += ' }\n' -# Time signal - gamText += ' Time = {\n' - gamText += ' DataSource = '+gamName+'_TreeOutput\n' -# gamText += ' Type = uint32\n' GAB2022 - gamText += ' Type = int32\n' - gamText += ' }\n' -# Other signals - for outputDict in outputDicts: - # first non struct outputs - if outputDict['seg_len'] > 0 and len(outputDict['fields']) == 0: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+gamName+'_TreeOutput\n' - gamText += ' Type = '+outputDict['type']+'\n' - - -# If the GAM device defines Samples in its output, take precedence over dimensions information - hasSamples = False try: - currSamples = outputDict['samples'] - if currSamples > 1: - hasSamples = True + numFields = len(currInputNode.getNode('FIELDS').getChildren()) except: - pass - - if hasSamples: # E.g. MARTE2_RESAMPLER - gamText += ' NumberOfDimensions = 0\n' - gamText += ' Samples = '+str(currSamples)+'\n' - else: # store single sample of scalar or array - if outputDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(outputDict['dimensions']) - numberOfElements = 1 - for currDim in outputDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - - gamText += ' }\n' - - needsOutput_Bus_DDB = False - for outputDict in outputDicts: # split fileds of structured outputs for which at least one field has seg_len > 0 - fieldsToStore = False - for fieldDict in outputDict['fields']: - if fieldDict['seg_len'] > 0: - fieldsToStore = True - if fieldsToStore: - for fieldDict in outputDict['fields']: - gamText += ' ' + \ - outputDict['name']+'_'+fieldDict['name']+' = {\n' - gamText += ' Type = ' + fieldDict['type']+'\n' - if fieldDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(fieldDict['dimensions']) - numberOfElements = 1 - for currDim in fieldDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - if fieldDict['seg_len'] > 0: - gamText += ' DataSource = '+gamName+'_TreeOutput\n' - else: - needsOutput_Bus_DDB = True - gamText += ' DataSource = '+gamName+'_Output_Bus_DDB\n' - gamText += ' }\n' - # end if fieldsToStore - # end for outputDict in outputDicts: - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - if needsOutput_Bus_DDB: - dataSourceText = ' +'+gamName+'_Output_Bus_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - # endif configDict['storeSignals'] - ###########Handle possible data streaming: declare IOGAM and StreamOut DataStream - if configDict['streamSignals']: - dataSourceText = ' +'+gamName+'_StreamOutput = {\n' - dataSourceText += ' Class = StreamOut\n' - dataSourceText += ' TimeIdx = 0\n' - dataSourceText += ' TimeStreaming = 1\n' - dataSourceText += ' CpuMask = ' + str(configDict['cpuMask'])+'\n' - dataSourceText += ' StackSize = 10000000\n' - dataSourceText += ' NumberOfBuffers = 10\n' - dataSourceText += ' Signals = {\n' - dataSourceText += ' Time = {\n' - dataSourceText += ' NumberOfDimensions = 0\n' - dataSourceText += ' NumberOfElements = 1\n' - dataSourceText += ' Channel = "'+gamName+'_Time"\n' - dataSourceText += ' }\n' - for outputDict in outputDicts: - if outputDict['stream'] != None: - dataSourceText += ' '+outputDict['name']+' = {\n' - dataSourceText += ' Channel = "' + outputDict['stream']+'"\n' - dataSourceText += ' }\n' - # Check if the output is a struct and seglen is > 0 for one o more fields - for fieldDict in outputDict['fields']: - if fieldDict['stream'] != None: - dataSourceText += ' ' + outputDict['name']+'_'+fieldDict['name']+' = {\n' - dataSourceText += ' Channel = "' + fieldDict['stream']+'"\n' - dataSourceText += ' }\n' - # end for fieldDict in outputDict['fields']: - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - -# gamList.append(gamName+'_StreamOutIOGAM') - postGamList.append(gamName+'_StreamOutIOGAM') - gamText = ' +'+gamName+'_StreamOutIOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' -# Time signal management - gamText += ' Time = {\n' - gamText += ' DataSource = ' + timerDDB+'\n' - gamText += ' Type = uint32\n' - gamText += ' }\n' -# first non struct outputs - for outputDict in outputDicts: - if outputDict['stream'] != None and len(outputDict['fields']) == 0: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' Type = ' + outputDict['type']+'\n' - gamText += ' }\n' -# then struct outputs for which at least one field has stream != None - for outputDict in outputDicts: - fieldsToStream = False - for fieldDict in outputDict['fields']: - if fieldDict['stream'] != None: - fieldsToStream = True - if fieldsToStream: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' Type = ' + outputDict['type']+'\n' - gamText += ' }\n' - # end for outputDict in outputDicts: - - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+gamName+'_StreamOutput\n' - gamText += ' Type = uint32\n' - gamText += ' }\n' -# Other signals - for outputDict in outputDicts: - # first non struct outputs - if outputDict['stream'] != None and len(outputDict['fields']) == 0: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+gamName+'_StreamOutput\n' - gamText += ' Type = '+outputDict['type']+'\n' - if outputDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(outputDict['dimensions']) - numberOfElements = 1 - for currDim in outputDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - - gamText += ' }\n' - - needsOutStream_Bus_DDB = False - for outputDict in outputDicts: # split fileds of structured outputs for which at least one field has seg_len > 0 - fieldsToStream = False - for fieldDict in outputDict['fields']: - if fieldDict['stream'] != None: - fieldsToStream = True - if fieldsToStream: - for fieldDict in outputDict['fields']: - gamText += ' ' + \ - outputDict['name']+'_'+fieldDict['name']+' = {\n' - gamText += ' Type = ' + fieldDict['type']+'\n' - if fieldDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(fieldDict['dimensions']) - numberOfElements = 1 - for currDim in fieldDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - if fieldDict['stream'] != None: - gamText += ' DataSource = '+gamName+'_StreamOutput\n' - else: - needsOutStream_Bus_DDB = True - gamText += ' DataSource = '+gamName+'_OutStream_Bus_DDB\n' - gamText += ' }\n' - # end if fieldsToStore - # end for outputDict in outputDicts: - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - if needsOutStream_Bus_DDB: - dataSourceText = ' +'+gamName+'_OutStream_Bus_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - # endif configDict['streamSignals'] - -# Check now if there are structured input signals not directly linked. For these signals, all their fields must be linked. In thic case a new -# IOGAM and DDB DDB will be created - if needInputBusConversion: - gamText = ' +'+gamName+'_Input_Bus_IOGAM = {\n' - if syncDiv > 1: - gamText += ' Class = PickSampleGAM\n' - else: - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - for inputDict in inputDicts: - if len(inputDict['fields']) > 0 and not 'value' in inputDict: - for fieldDict in inputDict['fields']: - - # it may be a reference to a struct field - try: - isInputStructField = (fieldDict['value'].getParent().getParent().getName() == 'FIELDS') - except: - isInputStructField = False - try: - if isInputStructField: - sourceNode = fieldDict['value'].getParent( - ).getParent().getParent().getParent().getParent() - else: # normal field - sourceNode = fieldDict['value'].getParent( - ).getParent().getParent() - if sourceNode.getUsage() != 'DEVICE': - isTreeRef = True - else: - sourceGamName = self.convertPath( - sourceNode.getFullPath()) - if 'name' in fieldDict: - signalGamName = fieldDict['name'] - if isInputStructField: - aliasName = fieldDict['value'].getParent().getParent().getParent().getNode( - ':name').data()+'_'+fieldDict['value'].getParent().getNode(':name').data() - else: - aliasName = fieldDict['value'].getParent().getNode( - ':name').data() - else: - signalGamName = fieldDict['value'].getParent().getNode( - ':name').data() - except: - isTreeRef = True - if isTreeRef: - if 'name' in fieldDict: - signalName = inputDict['name'] + \ - '_'+fieldDict['name'] - aliasName = inputDict['name']+'_'+self.convertPath( - fieldDict['value_nid'].getPath()) - nonGamInputNodes.append( - {'expr': fieldDict['value'], 'dimensions': fieldDict['dimensions'], 'name': aliasName, 'col_order': fieldDict['col_order']}) - else: - signalName = inputDict['name']+'_'+self.convertPath( - fieldDict['value_nid'].getPath()) - nonGamInputNodes.append( - {'expr': fieldDict['value'], 'dimensions': fieldDict['dimensions'], 'name': signalName, 'col_order': fieldDict['col_order']}) - gamText += ' '+signalName+' = {\n' -# GAB 2022 gamText += ' DataSource = '+gamName+'_TreeInput\n' - gamText += ' DataSource = '+gamName+'_TreeInDDB\n' - else: - gamText += ' '+signalGamName+' = {\n' - if isInputStructField: - if self.onSameThread(threadMap, sourceNode): - aliasName = fieldDict['value'].getParent().getParent().getParent().getNode( - ':name').data()+'_'+fieldDict['value'].getParent().getNode(':name').data() - gamText += ' DataSource = '+sourceGamName+'_Expanded_Output_DDB\n' - gamText += ' Alias = '+aliasName+'\n' - else: - synchDev = self.getSynchDev() - if synchDev.sameSynchSource(sourceNode): - #if synchDev.getNid() == sourceNode.getNid(): #If input derives from synchronizing thread - if syncDiv > 1: - gamText += ' DataSource = '+gamName+'_Res_DDB\n' - signalDict = {} - signalDict['name'] = fieldDict['name'] - signalDict['datasource'] = sourceGamName + '_Output_Synch' - signalDict['samples'] = syncDiv - signalDict['type'] = fieldDict['type'] - signalDict['dimensions'] = fieldDict['dimensions'] - try: - signalDict['elements'] = fieldDict['elements'] - except: - signalDict['elements'] = 1 - resampledSyncSigs.append(signalDict) - else: - gamText += ' DataSource = '+sourceGamName+'_Output_Synch\n' - else: - gamText += ' DataSource = '+sourceGamName+'_Output_Asynch\n' - else: - if self.onSameThread(threadMap, sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Output_DDB\n' - else: - synchDev = self.getSynchDev() - if synchDev.sameSynchSource(sourceNode): - # if synchDev.getNid() == sourceNode.getNid(): #If input derives from syncheonizing thread - gamText += ' DataSource = '+sourceGamName+'_Output_Synch\n' - try: - syncDiv = self.timebase_div.data() - gamText += ' Samples = ' + str(syncDiv)+'\n' - forceUsingSamples = True - except: - pass # Consider RealTimeSynchronization downsampling only if timebase_div is defined - else: - gamText += ' DataSource = '+sourceGamName+'_Output_Asynch\n' - if 'name' in fieldDict and not isInputStructField: #if struct field, alias has already been resolved - gamText += ' Alias = "'+aliasName+'"\n' - if 'type' in fieldDict: - gamText += ' Type = '+fieldDict['type']+'\n' - - if 'dimensions' in fieldDict and not forceUsingSamples: - dimensions = fieldDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len( - fieldDict['dimensions']) - numberOfElements = 1 - for currDim in fieldDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - gamText += ' }\n' - # endif 'dimensions' in fieldDict and not forceUsingSamples: - # endif for fieldDict in inputDict['fields']: - # endif len(fieldDict['fields']) > 0 - # end for inputDict in inputDicts: - - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - for inputDict in inputDicts: - if len(inputDict['fields']) > 0 and not 'value' in inputDict: - gamText += ' '+inputDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Input_Bus_DDB\n' - gamText += ' Type = '+inputDict['type']+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - - - gams.append(gamText) - - dataSourceText = ' +'+gamName+'_Input_Bus_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - # endif needInputBusConversion - - - -#If some inputs derive from resampled synch sources, instantiate PickSampleGAM - if len(resampledSyncSigs) > 0: -# gamList.append(gamName+'Resampler') - preGamList.append(gamName+'Resampler') - pickGamText = ' +'+gamName+'Resampler = {\n' - pickGamText += ' Class = PickSampleGAM\n' - pickGamText += ' InputSignals = {\n' - for sigDict in resampledSyncSigs: - pickGamText += ' '+sigDict['name']+' = {\n' - pickGamText += ' DataSource = '+sigDict['datasource']+'\n' - if 'alias' in sigDict: - pickGamText += ' Alias = '+sigDict['alias']+'\n' - pickGamText += ' Samples = '+str(sigDict['samples'])+'\n' - pickGamText += ' Type = '+sigDict['type']+'\n' - pickGamText += ' NumberOfDimensions = '+str(sigDict['dimensions'])+'\n' - pickGamText += ' NumberOfElements = '+str(sigDict['elements'])+'\n' - pickGamText += ' }\n' - pickGamText += ' }\n' - pickGamText += ' OutputSignals = {\n' - for sigDict in resampledSyncSigs: - if 'alias' in sigDict: - pickGamText += ' '+sigDict['alias']+' = {\n' - else: - pickGamText += ' '+sigDict['name']+' = {\n' - pickGamText += ' DataSource = '+gamName+'_Res_DDB\n' - pickGamText += ' Samples = 1\n' - pickGamText += ' Type = '+sigDict['type']+'\n' - pickGamText += ' NumberOfDimensions = '+str(sigDict['dimensions'])+'\n' - pickGamText += ' NumberOfElements = '+str(sigDict['elements'])+'\n' - pickGamText += ' }\n' - pickGamText += ' }\n' - pickGamText += ' }\n' - gams.append(pickGamText) - dataSourceText = ' +'+gamName+'_Res_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - - - - - - + numFields = 0 + if numFields > 0: + if self.isReferenced(outValNode, currInputNode.getNode('FIELDS').getChildren()): + return True + return False + # Check if any output value node is referenced by any of the inputs passed in inputs + def isAnyReferenced(self, outValNodes, inputNodes): + for outValNode in outValNodes: + if self.isReferenced(outValNode, inputNodes): + return True + return False + # Check if the passed output value node is referenced another MARTe2 device in the same Thread + def isReferencedByThisThread(self, outValNode, threadMap): + # threadMap is a Dictionary with two keys: + # 'DeviceInfo': defining for every MARTe2 device NID a dictionary: + # 'ThreadName': name of the thread it belongs to + # 'SupervisorNid': NID of the supervirsor hosting the device + # 'SupervisorIp': IP address of the superisor hosting the device + # 'DevicePort': Posr number foir that device + # 'ThreadInfo': defining for every thread for this supervisor a dictionary: + # 'SyncThreadName': The name of the Synchronizing thread or None if this thread is not synchronized + # 'SyncThreadSupervisor': The NID of the MARTE2 supervisor hosting the synchronizing thread or None if not synchronized + # 'SyncDiv': Frequency division from synchronizing thread or None is not synchronized + # Check if the passed output value node is referenced another MARTe2 device in a different Thread + thisNid = self.getNid() + marteNids = threadMap['DeviceInfo'].keys() + for marteNid in marteNids: + if marteNid == thisNid: + continue + inputNodes = MDSplus.TreeNode(marteNid).getNode('INPUTS').getChildren() + if self.isReferenced(outValNode, inputNodes): + return True + marteDevice = MDSplus.TreeNode(marteNid) + mode = marteDevice.getNode('MODE').data() + if mode != MARTE2_COMPONENT.MODE_OUTPUT and self.isReferenced(outValNode, [marteDevice.getNode('OUTPUTS:TRIGGER')]): + return True + return False + # Check if the passed output value node is referenced another MARTe2 device in any Thread + def isReferencedByAnyThread(self, outValNode, threadMap): + marteNids = threadMap['DeviceInfo'].keys() + for marteNid in marteNids: + inputNodes = MDSplus.TreeNode(marteNid).getNode('INPUTS').getChildren() + if self.isReferenced(outValNode, inputNodes): + return True + marteDevice = MDSplus.TreeNode(marteNid) + mode = marteDevice.getNode('MODE').data() + if mode != MARTE2_COMPONENT.MODE_OUTPUT and self.isReferenced(outValNode, [marteDevice.getNode('OUTPUTS:TRIGGER')]): + return True + return False + # Check if any passed output value node is referenced another MARTe2 device in any Thread + def isAnyOutputReferencedByAnyThread(self, outValNodes, threadMap): + for outValNode in outValNodes: + if self.isReferencedByAnyThread(outValNode.getNode('VALUE'), threadMap): + return True + + #get IP, Port of referenced device and Nid (CircuitId)of target device + def getReferencedNetInfo(self, outValNode, threadMap): + outValNid = outValNode.getNid() + netInfos = {} + ips = [] + ports = [] + circuitIds = [] + thisNid = self.getNid() + marteNids = threadMap['DeviceInfo'].keys() + for marteNid in marteNids: + if marteNid == thisNid: + continue + marteDevice = MDSplus.TreeNode(marteNid) + mode = marteDevice.getNode('MODE').data() + if mode == MARTE2_COMPONENT.MODE_INPUT or mode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: + continue + inputNodes = marteDevice.getNode('INPUTS').getChildren() + if self.isReferenced(outValNode, inputNodes): + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] != threadMap['DeviceInfo'][thisNid]['SupervisorNid']: + ips.append(threadMap['DeviceInfo'][marteNid]['SupervisorIp']) + ports.append(threadMap['DeviceInfo'][marteNid]['DevicePort']) + circuitIds.append(marteDevice.getNid()) + if mode != MARTE2_COMPONENT.MODE_OUTPUT and self.isReferenced(outValNode, [marteDevice.getNode('OUTPUTS:TRIGGER')]): + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] != threadMap['DeviceInfo'][thisNid]['SupervisorNid']: + ips.append(threadMap['DeviceInfo'][marteNid]['SupervisorIp']) + ports.append(threadMap['DeviceInfo'][marteNid]['DevicePort']) + circuitIds.append(marteDevice.getNid()) + netInfos['Ip'] = ips + netInfos['Port'] = ports + netInfos['CircuitId'] = circuitIds + return netInfos + + # Check if the passed output value node is referenced another MARTe2 device in the same supervisor + def isReferencedByThisSupervisor(self, outValNode, threadMap): + thisNid = self.getNid() + marteNids = threadMap['DeviceInfo'].keys() + for marteNid in marteNids: + if marteNid == thisNid: + continue + inputNodes = MDSplus.TreeNode(marteNid).getNode('INPUTS').getChildren() + if self.isReferenced(outValNode, inputNodes): + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] == threadMap['DeviceInfo'][thisNid]['SupervisorNid']: + return True + marteDevice = MDSplus.TreeNode(marteNid) + mode = marteDevice.getNode('MODE').data() + if mode != MARTE2_COMPONENT.MODE_OUTPUT and self.isReferenced(outValNode, [marteDevice.getNode('OUTPUTS:TRIGGER')]): + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] == threadMap['DeviceInfo'][thisNid]['SupervisorNid']: + return True + return False + # Check if the passed output value node is referenced another MARTe2 device of the same supervisor in a different Thread + def isReferencedByNonSynchronizedThreadSameSupervisor(self, outValNode, threadMap): + thisNid = self.getNid() + thisThreadName = threadMap['DeviceInfo'][thisNid]['ThreadName'] + marteNids = threadMap['DeviceInfo'].keys() + for marteNid in marteNids: + if marteNid == thisNid: + continue + marteDevice = MDSplus.TreeNode(marteNid) + mode = marteDevice.getNode('MODE').data() + if mode == MARTE2_COMPONENT.MODE_INPUT or mode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: + continue + inputNodes = marteDevice.getNode('INPUTS').getChildren() + if self.isReferenced(outValNode, inputNodes): + currThreadName = threadMap['DeviceInfo'][marteNid]['ThreadName'] + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] == threadMap['DeviceInfo'][thisNid]['SupervisorNid'] and \ + threadMap['DeviceInfo'][marteNid]['ThreadName'] != threadMap['DeviceInfo'][thisNid]['ThreadName'] and \ + threadMap['ThreadInfo'][currThreadName]['SyncThreadName'] != thisThreadName: + return True + if mode != MARTE2_COMPONENT.MODE_OUTPUT and self.isReferenced(outValNode, [marteDevice.getNode('OUTPUTS:TRIGGER')]): + currThreadName = threadMap['DeviceInfo'][marteNid]['ThreadName'] + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] == threadMap['DeviceInfo'][thisNid]['SupervisorNid'] and \ + threadMap['DeviceInfo'][marteNid]['ThreadName'] != threadMap['DeviceInfo'][thisNid]['ThreadName'] and \ + threadMap['ThreadInfo'][currThreadName]['SyncThreadName'] != thisThreadName: + return True + return False + #Check if the passed output is referenced by a sychornized thread of the same supervisor + def isReferencedBySynchronizedThreadSameSupervisor(self, outValNode, threadMap): + thisNid = self.getNid() + thisThreadName = threadMap['DeviceInfo'][thisNid]['ThreadName'] + thisSupervisorNid = threadMap['DeviceInfo'][thisNid]['SupervisorNid'] + marteNids = threadMap['DeviceInfo'].keys() + for marteNid in marteNids: + if marteNid == thisNid: + continue + marteDevice = MDSplus.TreeNode(marteNid) + mode = marteDevice.getNode('MODE').data() + if mode == MARTE2_COMPONENT.MODE_INPUT or mode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: + continue + inputNodes = marteDevice.getNode('INPUTS').getChildren() + if self.isReferenced(outValNode, inputNodes): + currThreadName = threadMap['DeviceInfo'][marteNid]['ThreadName'] + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] == threadMap['DeviceInfo'][thisNid]['SupervisorNid'] and \ + threadMap['ThreadInfo'][currThreadName]['SyncThreadName']== thisThreadName: + return True + if mode != MARTE2_COMPONENT.MODE_OUTPUT and self.isReferenced(outValNode, [MDSplus.TreeNode(marteNid).getNode('OUTPUTS:TRIGGER')]): + currThreadName = threadMap['DeviceInfo'][marteNid]['ThreadName'] + if threadMap['DeviceInfo'][marteNid]['SupervisorNid'] == threadMap['DeviceInfo'][thisNid]['SupervisorNid'] and \ + threadMap['ThreadInfo'][currThreadName]['SyncThreadName'] == thisThreadName: + return True + return False - # There are input references to tree nodes, we need to build a MdsReader DataSource named _TreeInput - # GAB 2022 here are input references to tree nodes, we need to build a MDSReaderGAM instance named _TreeInput and a DDB - # named _TreeInput_DDB - if len(nonGamInputNodes) > 0: - # if debugEnabled, we need to write TWO instances of MDSReaderGAM (_TreeInput and _TreeInput_Debug) - treeInputExtensions = [] - treeInputExtensions.append('_TreeIn') - if debugEnabled: - treeInputExtensions.append('_TreeIn_Logger') + #Check if if any output is requested data storage (seg_len > 0) + def isAnyOutputStored(self, fieldNodes): + for fieldNode in fieldNodes: + try: + if fieldNode.getNode('SEG_LEN').data() > 0: + return True + except: + pass + return False - for treeInputExtension in treeInputExtensions: - dataSourceText = ' +'+gamName+treeInputExtension+'DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) + #Convert the passed list into a MARTe array + def toMarteArray(self, list): + marteArr = '{' + for l in list: + marteArr += ' '+str(l)+' ' + marteArr += '}' + return marteArr + + def getOutputSignalsDict(self, sigNodes, threadMap, typesDict, syncThreadSignals, asyncThreadSignals, outputsToBeSent, + signalsToBeStored, outputsToBeUnpacked, isFieldCheck = False): + sigDicts = [] + for sigNode in sigNodes: + currSig = {} + try: + currDimension = sigNode.getNode('DIMENSIONS').data() + except: + currDimension = -1 + if currDimension == -1: + continue - mdsReaderText = ' +'+gamName+treeInputExtension + ' = {\n' - mdsReaderText += ' Class = MDSReaderGAM\n' - mdsReaderText += ' TreeName = "'+self.getTree().name+'"\n' - mdsReaderText += ' ShotNumber = ' + \ - str(self.getTree().shot)+'\n' - mdsReaderText += ' InputSignals = { \n' - mdsReaderText += ' Time = {\n' - mdsReaderText += ' DataSource = '+timerDDB + '\n' - mdsReaderText += ' } \n' - mdsReaderText += ' } \n' - mdsReaderText += ' OutputSignals = { \n' - for nodeDict in nonGamInputNodes: - mdsReaderText += ' '+nodeDict['name']+' = {\n' - mdsReaderText += ' DataSource = '+gamName+treeInputExtension+'DDB\n' - valExpr = nodeDict['expr'] - if isinstance(valExpr, TreeNode): - valExpr = str(valExpr) - else: - valExpr = str(valExpr) - valExpr = valExpr.replace('"', "'") - mdsReaderText += ' DataExpr = "'+valExpr+'"\n' - mdsReaderText += ' TimebaseExpr = "dim_of(' + \ - valExpr+')"\n' - numberOfElements = 1 - if not (np.isscalar(nodeDict['dimensions'])): - for currDim in nodeDict['dimensions']: - numberOfElements *= currDim - mdsReaderText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - if nodeDict['col_order']: - mdsReaderText += ' UseColumnOrder = 1\n' - else: - mdsReaderText += ' UseColumnOrder = 0\n' - mdsReaderText += ' DataManagement = 1\n' - mdsReaderText += ' }\n' - mdsReaderText += ' }\n' - mdsReaderText += ' }\n' - gams.append(mdsReaderText) - preGamList.append(gamName+treeInputExtension) -# Some outputs are connected to devices on separate synchronized threads - if needInputBusConversion: - preGamList.append(gamName+'_Input_Bus_IOGAM') - - if len(synchThreadSignals) > 0: - dataSourceText = ' +'+gamName+'_Output_Synch = {\n' - dataSourceText += ' Class = RealTimeThreadSynchronisation\n' - dataSourceText += ' Timeout = 1000000\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - -# gamList.append(gamName+'_Output_Synch_IOGAM') - postGamList.append(gamName+'_Output_Synch_IOGAM') - gamText = ' +'+gamName+'_Output_Synch_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - for signalDict in synchThreadSignals: + currName = self.getSignalName(sigNode) + if isFieldCheck: + numFields = 0 + else: try: - isInputStructField = (signalDict['value_nid'].getParent().getParent().getName() == 'FIELDS') + numFields = len(sigNode.getNode('FIELDS').getChildren()) except: - isInputStructField = False - gamText += ' '+signalDict['name']+' = {\n' - if isInputStructField: - gamText += ' DataSource = '+gamName+'_Expanded_Output_DDB\n' - gamText += ' Alias = '+self.getFieldAliasName(signalDict['value_nid'])+'\n' - else: - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' Type = '+signalDict['type']+'\n' - if 'dimensions' in signalDict: - dimensions = signalDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(signalDict['dimensions']) - numberOfElements = 1 - for currDim in signalDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - for signalDict in synchThreadSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Output_Synch\n' - #Check if it is the reference to a resampled timebase - gamText += ' Type = '+signalDict['type']+'\n' - if 'dimensions' in signalDict: - dimensions = signalDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(signalDict['dimensions']) - numberOfElements = 1 - for currDim in signalDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - # Some outputs are connected to devices on separate synchronized theads - if len(asynchThreadSignals) > 0: - dataSourceText = ' +'+gamName+'_Output_Asynch = {\n' - dataSourceText += ' Class = RealTimeThreadAsyncBridge\n' - dataSourceText += ' BlockingMode = 1\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - -# gamList.append(gamName+'_Output_Asynch_IOGAM') - postGamList.append(gamName+'_Output_Asynch_IOGAM') - gamText = ' +'+gamName+'_Output_Asynch_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - for signalDict in asynchThreadSignals: + numFields = 0 + if numFields == 0: try: - isInputStructField = (signalDict['value'].getParent().getParent().getName() == 'FIELDS') + currType = sigNode.getNode('TYPE').data() except: - isInputStructField = False - gamText += ' '+signalDict['name']+' = {\n' - if isInputStructField: - gamText += ' DataSource = '+gamName+'_Expanded_Output_DDB\n' - else: - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' NumberOfDimensions = ' + \ - str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - for signalDict in asynchThreadSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Output_Asynch\n' - gamText += ' Type = '+signalDict['type']+'\n' - gamText += ' NumberOfDimensions = ' + \ - str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' - gamText += ' }\n' - - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - -# If debug enabled we need one IOGAM for printing inputs and outputs - if debugEnabled: - gamText = ' +'+gamName+'_Logger_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - for signalDict in inputSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = ' + \ - signalDict['datasource']+'\n' - gamText += ' Type = '+signalDict['type']+'\n' - gamText += ' NumberOfDimensions = ' + \ - str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' + raise Exception('Missing type definition for '+ sigNode.getPath()) + self.checkNativeType(currType, typesDict) + try: - gamText += ' Alias = "'+signalDict['alias']+'"\n' + dimensions = sigNode.getNode('DIMENSIONS').data() except: - pass # Time signal shall not have value_nid key - gamText += ' }\n' - for signalDict in outputSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Output_DDB\n' - gamText += ' NumberOfDimensions = ' + \ - str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' - gamText += ' Type = '+signalDict['type']+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - for signalDict in inputSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Logger\n' - gamText += ' Type = '+signalDict['type']+'\n' - gamText += ' NumberOfDimensions = ' + \ - str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' - gamText += ' }\n' - for signalDict in outputSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = '+gamName+'_Logger\n' - gamText += ' NumberOfDimensions = ' + \ - str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' - gamText += ' Type = '+signalDict['type']+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - dataSourceText = ' +'+gamName+'_Logger = {\n' - dataSourceText += ' Class = LoggerDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) -# gamList.append(gamName+'_Logger_IOGAM') - postGamList.append(gamName+'_Logger_IOGAM') - - for currGam in preGamList: - gamList.append(currGam) - gamList.append(gamName) - for currGam in postGamList: - gamList.append(currGam) - return outPeriod - - -# SYNCH and NON SYNCH INPUT - def getMarteInputInfo(self, threadMap, gams, dataSources, gamList, isSynch): - configDict = self.getGamInfo() - dataSourceName = configDict['gamName'] - dataSourceClass = configDict['gamClass'] - timebase = configDict['timebase'] - paramDicts = configDict['paramDicts'] - outputDicts = configDict['outputDicts'] - outputTrigger = configDict['outputTrigger'] - outPeriod = 0 # If different from 0, this means that the corresponing component is driving the thread timing - synchThreadSignals = [] - asynchThreadSignals = [] - - nonGamInputNodes = [] #Only used for trigger signal for MdsWriter - - startTime = 0 - if not isSynch: - - # handle timebase as GAM for non synchronizing inputs - if isinstance(timebase, Range): - period = timebase.getDescAt(2).data() + raise Exception('Missing dimensios for '+ sigNode.getPath()) + numDims, numEls = self.parseDimension(sigNode.getNode('DIMENSIONS').data()) try: - startTime = timebase.getDescAt(0).data() + samples = sigNode.getNode('SAMPLES').data() except: - startTime = 0 - outPeriod = period # Driving thread timing - dataSourceText = ' +'+dataSourceName+'_Timer' + ' = {\n' - dataSourceText += ' Class = LinuxTimer\n' - dataSourceText += ' SleepNature = "Default"\n' - dataSourceText += ' Signals = {\n' - dataSourceText += ' Counter = {\n' - dataSourceText += ' Type = uint32\n' - dataSourceText += ' }\n' - dataSourceText += ' Time = {\n' - dataSourceText += ' Type = uint32\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - dataSourceText = ' +'+dataSourceName+'_Timer_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - gamList.append(dataSourceName+'Timer_IOGAM') - gamText = ' +'+dataSourceName+'Timer_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' Frequency = '+str(round(1./period, 4))+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - # Check if time information is required by another synchronized thread - if self.isUsedOnAnotherThreadSynch(threadMap, self.timebase): - dataSourceText = ' +'+dataSourceName+'_Timer_Synch = {\n' - dataSourceText += ' Class = RealTimeThreadSynchronisation\n' - dataSourceText += ' Timeout = 1000000\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - gamList.append(dataSourceName+'Timer_Synch_IOGAM') - gamText = ' +'+dataSourceName+'Timer_Synch_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' -# gamText += ' Frequency = '+str(round(1./period,4))+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_Synch\n' - gamText += ' Type = uint32\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_Synch\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - timerDDB = dataSourceName+'_Timer_DDB' - - elif isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if not self.onSameThread(threadMap, timebase.getParent()): - #Handle the case this async input is the first in the thread chain and synchronized to another thread - origName = self.convertPath(timebase.getParent().getFullPath()) - timerDDB = origName+'_Output_Synch' - originMode = timebase.getParent().getNode('mode').data() - if originMode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: - inTimerDDB = origName+'_Output_Synch' - else: - inTimerDDB = origName+'_Timer_Synch' - - try: - syncDiv = self.timebase_div.data() - except: - syncDiv = 1 - - gamText = ' +'+dataSourceName+'Timer_Synch_IOGAM = {\n' - gamText += ' Class = PickSampleGAM\n' - gamText += ' InputSignals = {\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+inTimerDDB+'\n' - gamText += ' Type = '+self.getTimebaseType()+'\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' Samples = ' + str(syncDiv)+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_Sync\n' - gamText += ' Type = '+self.getTimebaseType()+'\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - gamList.append(dataSourceName+'Timer_Synch_IOGAM') - - dataSourceText = ' +'+dataSourceName+'_Timer_Sync = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - timerDDB = dataSourceName+'_Timer_Sync' - - outPeriod = timebase.getData().getDescAt(2).data() - + samples = 1 + else: #structured output. Not occurring if isCheckField == True + currType = self.getTypeName(sigNode.getNode('FIELDS'), typesDict) + numDims = 0 + numEls = 1 + samples = 1 + fieldNodes = self.getFlattenedFields(sigNode.getNode('FIELDS')) + if self.isAnyOutputReferencedByAnyThread(fieldNodes, threadMap) or self.isAnyOutputStored(fieldNodes): + unpackedOutputs = self.getOutputSignalsDict(fieldNodes, threadMap, typesDict, syncThreadSignals, asyncThreadSignals, outputsToBeSent, + signalsToBeStored, [], isFieldCheck = True) + outputsToBeUnpacked.append({'Input':{'Name': currName, 'Type': currType}, 'Outputs': unpackedOutputs}) + + currSig['Name'] = currName + currSig['Type'] = currType + currSig['NumberOfDimensions'] = numDims + currSig['NumberOfElements'] = numEls + currSig['Samples'] = samples + currSig['DataSource'] = self.getMarteDeviceName(sigNode)+'_Output_DDB' + + if sigNode.getParent().getName() == 'FIELDS': #If it is an expanded signal + currDataSource = self.getMarteDeviceName(sigNode)+'_Expanded_Output_DDB' + else: + currDataSource= self.getMarteDeviceName(self)+'_Output_DDB' + outValNode = sigNode.getNode('VALUE') + if self.isReferencedBySynchronizedThreadSameSupervisor(outValNode, threadMap): + + syncThreadSignals.append({ + 'Name': currSig['Name'], + 'Type': currSig['Type'], + 'NumberOfDimensions': currSig['NumberOfDimensions'], + 'NumberOfElements': currSig['NumberOfElements'], + 'Samples': currSig['Samples'], + 'DataSource': currDataSource, + }) + if self.isReferencedByNonSynchronizedThreadSameSupervisor(outValNode, threadMap): + asyncThreadSignals.append({ + 'Name': currSig['Name'], + 'Type': currSig['Type'], + 'NumberOfDimensions': currSig['NumberOfDimensions'], + 'NumberOfElements': currSig['NumberOfElements'], + 'Samples': currSig['Samples'], + 'DataSource': currDataSource, + }) + netInfos = self.getReferencedNetInfo(outValNode, threadMap) + if len(netInfos['Ip']) > 0: + if isFieldCheck: + dataSource = self.getMarteDeviceName(sigNode)+'_Expanded_Output_DDB' else: - # Link to other component up in the chain - - prevTimebase = timebase - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() - origName = self.convertPath( - prevTimebase.getParent().getFullPath()) - # Check whether the synchronization source is a Synch Input. Only in this case, the origin DDB is its output DDB since that device is expected to produce Time - originMode = prevTimebase.getParent().getNode('mode').data() - try: - startTime = timebase.getDescAt(0).data() - except: - startTime = 0 - if originMode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: - if self.onSameThread(threadMap, prevTimebase.getParent()): - timerDDB = origName+'_Output_DDB' - else: - timerDDB = origName+'_Output_Synch' - try: - # Get period from driving synchronizing device - outPeriod = timebase.getDescAt(2).data() - except: - outPeriod = 0 - else: - if self.onSameThread(threadMap, prevTimebase.getParent()): - timerDDB = origName+'_Timer_DDB' - else: - timerDDB = origName+'_Timer_Synch' - try: - # Get period from driving synchronizing device - outPeriod = timebase.getDescAt(2).data() - except: - outPeriod = 0 + dataSource = self.getMarteDeviceName(sigNode)+'_Output_DDB' + + outputsToBeSent.append({ + 'Name': currSig['Name'], + 'Type': currSig['Type'], + 'NumberOfDimensions': currSig['NumberOfDimensions'], + 'NumberOfElements': currSig['NumberOfElements'], + 'Samples': currSig['Samples'], + 'DataSource': dataSource, + 'Ip': self.toMarteArray(netInfos['Ip']), + 'Port': self.toMarteArray(netInfos['Port']), + 'CircuitId': self.toMarteArray(netInfos['CircuitId']) + }) + try: + segLen = sigNode.getNode('SEG_LEN').data() + except: + segLen = 0 + if segLen > 0: + signalsToBeStored.append(sigNode) - else: - print('ERROR: Invalid timebase definition') - return 0 - -# Unlike GAM no other configuration needs to be considered since there are no inputs -# if isSynch, timebase Will contain the defintion of the time that will be generated. Specific subclasses will connect it to DataSource specific parameters -# therefore no actions are taken here in addition. In this case, however, the component is driving thread timing - else: # isSynch - currTimebase = self.getNode('timebase').evaluate() - if isinstance(currTimebase, Range): - outPeriod = currTimebase.delta.data() + if not isFieldCheck: try: - startTime = currTimebase.begin.data() + numParameters = len(sigNode.getNode('PARAMETERS').getChildren()) except: - startTime = 0 - else: - currTimebase = currTimebase.data() - outPeriod = currTimebase[1] - currTimebase[0] - startTime = currTimebase[0] - - - - # Check if time information is required by another synchronized thread Gabriele Jan 2022 - # for sync input devices, the check has to be performed on output Time - if self.isUsedOnAnotherThreadSynch(threadMap, self.timebase): - synchThreadSignals.append({'name':'Time', 'type':self.getTimebaseType(), 'dimensions':0, 'elements': 1}) -# GAB OCTOBER 2023 synchThreadSignals.append({'name':'Time', 'type':'uint32', 'dimensions':0, 'elements': 1}) -# endif isSynch - -#Head and parameters - dataSourceText = ' +'+dataSourceName+' = {\n' - dataSourceText += ' Class = '+dataSourceClass+'\n' - dataSourceText = self.reportParameters(paramDicts, dataSourceText, 1) -# for paramDict in paramDicts: -# if paramDict['is_text']: -# dataSourceText += ' '+paramDict['name']+' = "'+str(paramDict['value'])+'"\n' -# else: -# dataSourceText += ' '+paramDict['name']+' = '+self.convertVal(str(paramDict['value']))+'\n' - - # Output Signals - dataSourceText += ' Signals = {\n' - for outputDict in outputDicts: - dataSourceText += ' '+outputDict['name']+' = {\n' - dataSourceText += ' Type = '+outputDict['type']+'\n' - if outputDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(outputDict['dimensions']) - numberOfElements = 1 - for currDim in outputDict['dimensions']: - numberOfElements *= currDim - dataSourceText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - dataSourceText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - dataSourceText = self.addSignalParameters( - outputDict['value_nid'].getParent().getNode('parameters'), dataSourceText) - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - -# MDSWriter management - if configDict['storeSignals']: - dataSourceText = ' +'+dataSourceName+'_TreeOutput = {\n' - dataSourceText += ' Class = MDSWriter\n' - - if outputTrigger == None: - dataSourceText += ' NumberOfBuffers = 20000\n' + numParameters = 0 else: - dataSourceText += ' NumberOfBuffers = ' + \ - str(configDict['preTrigger'] + - configDict['postTrigger']+1)+'\n' - - dataSourceText += ' NumberOfPreTriggers = ' + \ - str(configDict['preTrigger'])+'\n' - dataSourceText += ' NumberOfPostTriggers = ' + \ - str(configDict['postTrigger'])+'\n' - dataSourceText += ' CPUMask = ' + \ - str(configDict['cpuMask'])+'\n' - dataSourceText += ' StackSize = 10000000\n' - dataSourceText += ' TreeName = "'+self.getTree().name+'"\n' - dataSourceText += ' PulseNumber = ' + \ - str(self.getTree().shot)+'\n' - if outputTrigger == None: - dataSourceText += ' StoreOnTrigger = 0\n' - else: - dataSourceText += ' StoreOnTrigger = 1\n' - dataSourceText += ' EventName = "'+dataSourceName+'UpdatejScope"\n' - dataSourceText += ' TimeRefresh = 1\n' - dataSourceText += ' Signals = {\n' - currTimebase = self.getNode('timebase').evaluate() - - if isinstance(currTimebase, Range): - period = currTimebase.delta.data() - else: - currTimebase = currTimebase.data() - period = currTimebase[1] - currTimebase[0] - - -# If trigger is defined put it as first signal - if outputTrigger != None: - dataSourceText += ' Trigger = {\n' - dataSourceText += ' Type = uint8\n' - dataSourceText += ' }\n' - -# If the Input device is not synchronising, store time in outputs:time - if not isSynch: - dataSourceText += ' Time = {\n' - dataSourceText += ' DiscontinuityFactor = 1\n' - dataSourceText += ' Type = '+self.getTimebaseType()+'\n' - dataSourceText += ' NodeName = "' + \ - configDict['outTimeNid'].getFullPath()+'"\n' - # We must keep into account the number of samples in an input device - dataSourceText += ' Period = ' + \ - str(period/outputDict['samples'])+'\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: - # dataSourceText += ' SamplePhase = ' + \ - # str(int(round(startTime/period)))+'\n' - if outputTrigger != None: - dataSourceText += ' TimeSignal = 1\n' - dataSourceText += ' }\n' - - outIdx = 0 - for outputDict in outputDicts: - if outputDict['seg_len'] > 0: - dataSourceText += ' '+outputDict['name']+' = {\n' - dataSourceText += ' DiscontinuityFactor = 1\n' - dataSourceText += ' NodeName = "' + \ - outputDict['value_nid'].getFullPath()+'"\n' - # We must keep into account the number of samples in an input device - dataSourceText += ' Period = ' + \ - str(period/outputDict['samples'])+'\n' - dataSourceText += ' MakeSegmentAfterNWrites = ' + \ - str(outputDict['seg_len'])+'\n' - dataSourceText += ' AutomaticSegmentation = 0\n' -# Keep track of index of time signal for synchronizing input devices - if isSynch and outIdx == configDict['outTimeIdx'] and outputTrigger != None: - dataSourceText += ' TimeSignal = 1\n' - - # if startTime != 0: - # dataSourceText += ' SamplePhase = ' + \ - # str(int(round(startTime/period)))+'\n' - dataSourceText += ' }\n' - outIdx = outIdx + 1 - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) -# endif configDict['storeSignals'] - - dataSourceText = ' +'+dataSourceName+'_Output_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - gamList.append(dataSourceName+'_DDBOutIOGAM') - gamText = ' +'+dataSourceName+'_DDBOutIOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - - firstOut = True - for outputDict in outputDicts: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+dataSourceName+'\n' - samples = outputDict['samples'] - gamText += ' Samples = '+str(samples)+'\n' - if isSynch and firstOut: - firstOut = False - # Must be correct(will be checked before) - period = timebase.getDescAt(2).data() - frequency = 1./period - - gamText += ' Frequency = '+str(round(frequency, 4))+'\n' - - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - - for outputDict in outputDicts: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+dataSourceName+'_Output_DDB\n' - gamText += ' Type = '+outputDict['type']+'\n' - if outputDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(outputDict['dimensions']) - numberOfElements = 1 - for currDim in outputDict['dimensions']: - numberOfElements *= currDim - - outputDict['elements'] = numberOfElements - samples = outputDict['samples'] - if samples > 1: - gamText += ' NumberOfDimensions = 1\n' - else: - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements * samples)+'\n' - gamText += ' }\n' - if self.isUsedOnAnotherThreadSynch(threadMap, outputDict['value_nid']): - synchThreadSignals.append(outputDict) - elif self.isUsedOnAnotherThread(threadMap, outputDict['value_nid']): - asynchThreadSignals.append(outputDict) - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - if configDict['storeSignals']: - gamList.append(dataSourceName+'_TreeOutIOGAM') - gamText = ' +'+dataSourceName+'_TreeOutIOGAM = {\n' - -# GAB OCTOBER 2023 + numParameters = 0 + if numParameters > 0: + currSig['Parameters'] = self.getParametersDict(sigNode.getNode('PARAMETERS')) + + sigDicts.append(currSig) + return sigDicts + + #Returns the dict definition of theIOGAM carrying out signal unpacking + def handleOutputUnpack(self, outputsToBeUnpacked): + retGam = {} + retGam['Name'] = self.getMarteDeviceName(self)+'_Output_Bus_IOGAM' + retGam['Class'] = 'IOGAM' + inputs = [] + outputs = [] + for currUnpacked in outputsToBeUnpacked: + inputs.append({ + 'Name': currUnpacked['Input']['Name'], + 'Type': currUnpacked['Input']['Type'], + 'DataSource': self.getMarteDeviceName(self)+'_Output_DDB'}) + outputs += currUnpacked['Outputs'] + retGam['Inputs'] = inputs + for currOutput in outputs: + currOutput['DataSource'] = self.getMarteDeviceName(self)+'_Expanded_Output_DDB' + retGam['Outputs'] = self.removeParametersFromList(outputs) + + return retGam + + #remove 'Parameters' key fron signal list + def removeParametersFromList(self,sigs): + outSigs = [] + for sig in sigs: + if 'Parameters' in sig: + sig.pop('Parameters') + outSigs.append(sig) + return outSigs + def removeParametersFromDict(self,sig): + if 'Parameters' in sig: + sig.pop('Parameters') + return sig + + #Returns the dict definition of theIOGAM carrying out synchronized signals + def handleSynchronoutOutputs(self, syncSignals): + retGam = {} + retGam['Class'] = 'IOGAM' + retGam['Name'] = self.getMarteDeviceName(self)+'_Output_Sync_IOGAM' + inputs = [] + outputs = [] + for syncSignal in syncSignals: + inputs.append(self.removeParametersFromDict(copy.deepcopy(syncSignal))) + currOutput = self.removeParametersFromDict(copy.deepcopy(syncSignal)) + currOutput['DataSource'] = self.getMarteDeviceName(self)+'_Output_Sync' + outputs.append(currOutput) + retGam['Inputs'] = inputs + retGam['Outputs'] = outputs + + return retGam + + #Returns the dict definition of theIOGAM carrying out synchronized signals + def handleAsynchronoutOutputs(self, asyncSignals): + retGam = {} + retGam['Class'] = 'IOGAM' + retGam['Name'] = self.getMarteDeviceName(self)+'_Output_Async_IOGAM' + inputs = [] + outputs = [] + for asyncSignal in asyncSignals: + inputs.append(self.removeParametersFromDict(copy.deepcopy(asyncSignal))) + currOutput = self.removeParametersFromDict(copy.deepcopy(asyncSignal)) + currOutput['DataSource'] = self.getMarteDeviceName(self)+'_Output_Async' + outputs.append(currOutput) + retGam['Inputs'] = inputs + retGam['Outputs'] = outputs + + return retGam + + #Return the definitions of MDSWriter DataSource and ConversionGAM GAM for handling the stored outputs + def handleOutputsStorage(self, signalsToBeStored, threadMap): + retDataSource = {} + retDataSource['Class'] = 'MDSWriter' + retDataSource['Name'] = self.getMarteDeviceName(self)+'_TreeOut' + parameters = {} + try: + cpuMask = self.getNode('OUTPUTS:CPU_MASK').data() + parameters['CPUMask'] = cpuMask + except: + raise Exception("Output CPU Mask must be defined in device "+self.getPath()) + parameters['StackSize'] = 10000000 + parameters['TimeRefresh'] = 5 + try: + jScopeEvent = self.getNode('JSCOPE_EV').data() + parameters['EventName'] = jScopeEvent + except: + parameters['EventName'] = 'updatejScope' + parameters['PulseNumber'] = self.getTree().shot + parameters['TreeName'] = self.getTree().name + try: + trigger = self.getNode('OUTPUTS:TRIGGER').getData() + except: + trigger = None + if trigger != None: + parameters['StoreOnTrigger'] = 1 + else: + parameters['StoreOnTrigger'] = 0 + if trigger != None: try: - syncDiv = self.timebase_div.data() + postTrigSamples = self.getNode('OUTPUTS:POST_TRIGGER').data() + preTrigSamples = self.getNode('OUTPUTS:PRE_TRIGGER').data() except: - synchDiv = 1 + raise Exception('When trigger defined, pre and post trigger must be set in device '+self.getPath()) + parameters['NumberOfPreTriggers'] = preTrigSamples + parameters['NumberOfPostTriggers'] = postTrigSamples + parameters['NumberOfBuffers'] = postTrigSamples + 10 + else: + parameters['NumberOfBuffers'] = 10000 + retDataSource['Parameters'] = parameters - if outputTrigger != None and syncDiv == 1: # If using output trigger, the trigger must be converted to uint8 GAB OCTOBER 2023 - gamText += ' Class = ConversionGAM\n' - else: - if syncDiv > 1: - gamText += ' Class = PickSampleGAM\n' + signals = [] + if trigger != None: + signals.append({'Name': 'Trigger', 'Type': 'uint8'}) + try: + numSamples = signalsToBeStored[0].getNode('SAMPLES') + except: + numSamples = 1 + signals.append({ + 'Name': 'Time', + 'Type': self.timerType, + 'NodeName': self.getNode('OUTPUTS:OUT_TIME').getFullPath(), + 'AutomaticSegmentation': 0, + 'TimeSignal': 1, + 'Period': str(self.timerPeriod * numSamples).replace('D', 'E'), + 'MakeSegmentAfterNWrites': signalsToBeStored[0].getNode('SEG_LEN').data(), + 'DiscontinuityFactor': 10 + }) + for sigNode in signalsToBeStored: + sigName = self.getSignalName(sigNode) + if sigName == 'Time': #Time signal has been already stored + continue + sigDef = {} + sigDef['Name'] = sigName + sigDef['Period'] = str(self.timerPeriod * numSamples).replace('D', 'E') + sigDef['MakeSegmentAfterNWrites'] = sigNode.getNode('SEG_LEN').data() + sigDef['NodeName'] = sigNode.getNode('VALUE').getFullPath() + sigDef['AutomaticSegmentation'] = 0 + sigDef['DiscontinuityFactor'] = 10 + signals.append(sigDef) + retDataSource['Signals'] = signals + + retGam = {} + if trigger == None: + retGam['Class'] = 'IOGAM' + else: + retGam['Class'] = 'ConversionGAM' + retGam['Name'] = self.getMarteDeviceName(self)+'_TreeOut_IOGAM' + + inputs = [] + if trigger != None: + currInput={'Name': self.getSignalName(trigger), 'Type': self.getReferencedType(trigger)} + if self.hostedInSameThread(trigger, threadMap): + currInput['DataSource'] = self.getMarteDeviceName(trigger)+'_Output_DDB' + elif self.hostedInSameSupervisor(trigger, threadMap): + if self.hostedInSynchronizingThread(trigger, threadMap): + currInput['DataSource'] = self.getMarteDeviceName(trigger)+'_Output_Sync' else: - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - -# MdsWriter Trigger management - if outputTrigger != None: - physicalTrigger = True - try: - triggerNode = outputTrigger.getParent().getParent().getParent() - # If the trigger is pysically generated, i.e. it is derived rom another device (GAM or Input) - if triggerNode.getUsage() == 'DEVICE': - triggerGamName = self.convertPath( - triggerNode.getFullPath()) - triggerSigName = outputTrigger.getParent().getNode(':name').data() - gamText += ' '+triggerSigName+' = {\n' - if self.onSameThread(threadMap, triggerNode): - gamText += ' DataSource = '+triggerGamName+'_Output_DDB\n' - # self.sameSynchSource(sourceNode): # FIXME: sourceNode undefined - elif self.sameSynchSource(triggerNode): #GAB OCTOBER 2023 - gamText += ' DataSource = '+triggerGamName+'_Output_Synch\n' - - # GAB OCTOBER 2023 try: - # syncDiv = self.timebase_div.data() - # gamText += ' Samples = ' + \ - # str(syncDiv)+'\n' - # except: - # pass # Consider ealTimeSynchronization downsampling only if timebase_div is defined - - else: - gamText += ' DataSource = '+triggerGamName+'_Output_Asynch\n' - gamText += ' }\n' - else: - physicalTrigger = False - except: - physicalTrigger = False - - if(not physicalTrigger): # Trigger source is derived from a stored input waveformTimebaseTy - nonGamInputNodes.append({'expr': outputTrigger.decompile( - ), 'dimensions': 0, 'name': 'Trigger', 'col_order': False}) - gamText += ' '+'Trigger'+' = {\n' -# GAB2022 gamText += ' DataSource = '+dataSourceName+'_TreeInput\n' - gamText += ' DataSource = '+dataSourceName+'_TreeInDDB\n' - gamText += ' Type = uint8\n' - gamText += ' }\n' -# end Trigger Management - -# If the Input device is not synchronising, transfer also time towards MdsWriter - if not isSynch: - gamText += ' Time = {\n' -# GABRIELE SEPT 2020 gamText += ' DataSource = '+dataSourceName+'_Timer_DDB' - gamText += ' DataSource = '+timerDDB + '\n' - gamText += ' Type = '+self.getTimebaseType()+'\n' -# GAB OCTOBER 2023 gamText += ' Type = int32\n' - gamText += ' }\n' - -# Other signals - for outputDict in outputDicts: - if outputDict['seg_len'] > 0: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+dataSourceName+'_Output_DDB\n' - gamText += ' NumberOfElemenrs = '+str(outputDict['elements']) - gamText += ' Type = '+outputDict['type'] - gamText += ' }\n' - - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - - if outputTrigger != None: - gamText += ' Trigger = {\n' - gamText += ' DataSource = '+dataSourceName+'_TreeOutput\n' - gamText += ' type = uint8\n' - gamText += ' }\n' - - # If the Input device is not synchronising, transfer also time towards MdsWriter - if not isSynch: - gamText += ' Time = {\n' - gamText += ' Type = '+self.getTimebaseType()+'\n' # GAB OCTOBER 2023 -# gamText += ' Type = int32\n' - gamText += ' DataSource = '+dataSourceName + \ - '_TreeOutput' # GABRIELE SEPT 2020 - gamText += ' }\n' - - for outputDict in outputDicts: - if outputDict['seg_len'] > 0: - gamText += ' '+outputDict['name'] + ' = {\n' - gamText += ' DataSource = '+dataSourceName+'_TreeOutput\n' - gamText += ' Type = '+outputDict['type']+'\n' - gamText += ' Samples = ' + \ - str(outputDict['samples'])+'\n' - if outputDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(outputDict['dimensions']) - numberOfElements = 1 - for currDim in outputDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - gamText += ' }\n' - - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - -# endif configDict['storeSignals'] -# GAB 2022 - if len(nonGamInputNodes) > 0: # For input devices this happens only if a trigger signal for MdsWriter is derived from a waveform stored in the tree - dataSourceText = ' +'+DataSourceName+'_TreeInDDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - mdsReaderText = ' +'+dataSourceName+ '_TreeIn = {\n' - mdsReaderText += ' Class = MDSReaderGAM\n' - mdsReaderText += ' TreeName = "'+self.getTree().name+'"\n' - mdsReaderText += ' ShotNumber = '+str(self.getTree().shot)+'\n' - mdsReaderText += ' InputSignals = { \n' - mdsReaderText += ' Time = {\n' - mdsReaderText += ' DataSource = '+timerDDB + '\n' - mdsReaderText += ' } \n' - mdsReaderText += ' } \n' - mdsReaderText += ' OutputSignals = { \n' - for nodeDict in nonGamInputNodes: - mdsReaderText += ' '+nodeDict['name']+' = {\n' - mdsReaderText += ' DataSource = '+dataSourceName+ '_TreeInDDB\n' - valExpr = nodeDict['expr'] - if isinstance(valExpr, TreeNode): - valExpr = valExpr.getFullPath() - valExpr = valExpr.replace('"', "'") - mdsReaderText += ' DataExpr = "'+valExpr+'"\n' - mdsReaderText += ' TimebaseExpr = "dim_of(' + \ - valExpr+')"\n' - numberOfElements = 1 - if not (np.isscalar(nodeDict['dimensions'])): - for currDim in nodeDict['dimensions']: - numberOfElements *= currDim - mdsReaderText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - if nodeDict['col_order']: - mdsReaderText += ' UseColumnOrder = 1\n' + currInput['DataSource'] = self.getMarteDeviceName(trigger)+'_Output_Async' + else: #Hosted in another supervisor + if self.hostedInSynchronizingThread(trigger, threadMap): + currInput['DataSource'] = self.getMarteDeviceName(self)+'_RTN_IN_DDB' else: - mdsReaderText += ' UseColumnOrder = 0\n' - mdsReaderText += ' DataManagement = 1\n' - mdsReaderText += ' }\n' - mdsReaderText += ' }\n' - gams.append(mdsReaderText) - # Some outputs are connected to devices on separate synchronized theads - if len(synchThreadSignals) > 0: - dataSourceText = ' +'+dataSourceName+'_Output_Synch = {\n' - dataSourceText += ' Class = RealTimeThreadSynchronisation\n' - dataSourceText += ' Timeout = 1000000\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) + currInput['DataSource'] = self.getMarteDeviceName(self)+'_RTN_IN_DDB' + inputs.append(currInput) - - gamList.append(dataSourceName+'_Output_Synch_IOGAM') - gamText = ' +'+dataSourceName+'_Output_Synch_IOGAM = {\n' + inputs.append({'Name': 'Time', 'Type': self.timerType, 'DataSource': self.timerDDB}) + for sigNode in signalsToBeStored: + try: + samples = sigNode.getNode('Samples').data() + except: + samples = 1 + sigName = self.getSignalName(sigNode) + if sigName == 'Time': + continue + sigDef = {} + sigDef['Name'] = sigName + sigDef['Type'] = sigNode.getNode('Type').data() - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - for signalDict in synchThreadSignals: - try: - isInputStructField = (signalDict['value_nid'].getParent().getParent().getName() == 'FIELDS') - except: - isInputStructField = False - gamText += ' '+signalDict['name']+' = {\n' - if isInputStructField: - gamText += ' DataSource = '+dataSourceName+'_Expanded_Output_DDB\n' - else: - gamText += ' DataSource = '+dataSourceName+'_Output_DDB\n' - gamText += ' Type = '+signalDict['type']+'\n' - if 'dimensions' in signalDict: - dimensions = signalDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(signalDict['dimensions']) - numberOfElements = 1 - for currDim in signalDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - for signalDict in synchThreadSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = '+dataSourceName+'_Output_Synch\n' - #Check if it is the reference to a resampled timebase - gamText += ' Type = '+signalDict['type']+'\n' - if 'dimensions' in signalDict: - dimensions = signalDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(signalDict['dimensions']) - numberOfElements = 1 - for currDim in signalDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - # Some outputs are connected to devices on separate synchronized threads - if len(asynchThreadSignals) > 0: - dataSourceText = ' +'+dataSourceName+'_Output_Asynch = {\n' - dataSourceText += ' Class = RealTimeThreadAsyncBridge\n' - dataSourceText += ' Timeout = 1000000\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - gamList.append(dataSourceName+'_Output_Asynch_IOGAM') - gamText = ' +'+dataSourceName+'_Output_Asynch_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - for signalDict in asynchThreadSignals: - try: - isInputStructField = (signalDict['value'].getParent().getParent().getName() == 'FIELDS') - except: - isInputStructField = False - gamText += ' '+signalDict['name']+' = {\n' - if isInputStructField: - gamText += ' DataSource = '+dataSourceName+'_Expanded_Output_DDB\n' - else: - gamText += ' DataSource = '+dataSourceName+'_Output_DDB\n' - # gamText += ' NumberOfDimensions = ' + \ - # str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - for signalDict in asynchThreadSignals: - gamText += ' '+signalDict['name']+' = {\n' - gamText += ' DataSource = '+dataSourceName+'_Output_Asynch\n' - # gamText += ' NumberOfDimensions = ' + \ - # str(signalDict['dimensions'])+'\n' - gamText += ' NumberOfElements = ' + \ - str(signalDict['elements'])+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - return outPeriod - - -# OUTPUT - - def getMarteOutputInfo(self, threadMap, gams, dataSources, gamList): - configDict = self.getGamInfo() - dataSourceName = configDict['gamName'] - dataSourceClass = configDict['gamClass'] - timebase = configDict['timebase'] - paramDicts = configDict['paramDicts'] - inputDicts = configDict['inputDicts'] - outputDicts = configDict['outputDicts'] # TODO: unused - outPeriod = 0 # If different from 0, this means that the corresponing component is driving the thread timing - - nonGamInputNodes = [] -# timebase - if isinstance(timebase, Range): - period = timebase.getDescAt(2).data() - outPeriod = period # driving thread timing - dataSourceText = ' +'+dataSourceName+'_Timer' + ' = {\n' - dataSourceText += ' Class = LinuxTimer\n' - dataSourceText += ' SleepNature = "Default"\n' - dataSourceText += ' Signals = {\n' - dataSourceText += ' Counter = {\n' - dataSourceText += ' Type = uint32\n' - dataSourceText += ' }\n' - dataSourceText += ' Time = {\n' - dataSourceText += ' Type = uint32\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - dataSourceText = ' +'+dataSourceName+'_Timer_DDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - gamList.append(dataSourceName+'Timer_IOGAM') - gamText = ' +'+dataSourceName+'Timer_IOGAM = {\n' - gamText += ' Class = IOGAM\n' - gamText += ' InputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' Frequency = '+str(round(1./period, 4))+'\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' OutputSignals = {\n' - gamText += ' Counter = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' }\n' - gamText += ' Time = {\n' - gamText += ' DataSource = '+dataSourceName+'_Timer_DDB\n' - gamText += ' Type = uint32\n' - gamText += ' NumberOfElements = 1\n' - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - timerDDB = dataSourceName+'_Timer_DDB' - - # Link to other component up in the chain - elif isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - prevTimebase = timebase - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() - origName = self.convertPath(prevTimebase.getParent().getFullPath()) - # Check whether the synchronization source is a Synch Input. Only in this case, the origin DDB is its output DDB - originMode = prevTimebase.getParent().getNode('mode').data() - - if originMode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: - if self.onSameThread(threadMap, prevTimebase.getParent()): - timerDDB = origName+'_Output_DDB' - else: - # timerDDB = origName+'_Output_Synch' Gabriele Jan 2022 - timerDDB = origName+'_Output_Synch' - try: - # Get period from driving synchronizing device - outPeriod = timebase.getDescAt(2).data() - except: - outPeriod = 0 + if sigNode.getParent().getName() == 'FIELDS': #If it is an expanded signal + sigDef['DataSource'] = self.getMarteDeviceName(self)+'_Expanded_Output_DDB' else: - if self.onSameThread(threadMap, prevTimebase.getParent()): - timerDDB = origName+'_Timer_DDB' - else: - timerDDB = origName+'_Timer_Synch' - try: - # Get period from driving synchronizing device - outPeriod = timebase.getDescAt(2).data() - except: - outPeriod = 0 - else: - print('ERROR: Invalid timebase definition') - return 0 - - #Head and parameters - gamText = ' +'+dataSourceName+'_IOGAM = {\n' -# gamText += ' Class = IOGAM\n' -#NOTE: default behavior for Output is different from that of GAM. Here a single sample is picked when subsampling is defined (syncDiv > 1) - gamText += ' Class = PickSampleGAM\n' - -# input Signals - gamText += ' InputSignals = {\n' -# nonGamInputNodes = [] - signalNames = [] - signalSamples = [] # to record the same number of samples for the output IOGAM fields - - for inputDict in inputDicts: - if not 'value' in inputDict: + sigDef['DataSource'] = self.getMarteDeviceName(self)+'_Output_DDB' + numDims, numEls = self.parseDimension(sigNode.getNode('DIMENSIONS').data()) +# sigDef['NumberOfDimensions'] = numDims +# sigDef['NumberOfElements'] = numEls + # if samples > 1: +# sigDef['Samples'] = samples + inputs.append(sigDef) + retGam['Inputs'] = inputs + + outputs = [] + if trigger != None: + outputs.append({ + 'Name':'Trigger', + 'Type':'uint8', + 'DataSource':self.getMarteDeviceName(self)+'_TreeOut'}) + outputs.append({ + 'Name': 'Time', + 'Type': self.timerType, + 'DataSource': self.getMarteDeviceName(self)+'_TreeOut', + 'Samples': samples + }) + for sigNode in signalsToBeStored: + sigName = self.getSignalName(sigNode) + if sigName == 'Time': continue - # This is a Time field referring to this timebase - if 'value' in inputDict and isinstance(inputDict['value'], TreeNode) and inputDict['value'].getNodeName() == 'TIMEBASE' and inputDict['value'].getParent().getNid() == self.getNid(): - signalNames.append('Time') - gamText += ' Time = {\n' - gamText += ' DataSource = ' + timerDDB+'\n' - try: - syncDiv = self.timebase_div.data() - gamText += ' Samples = ' + \ - str(syncDiv)+'\n' - signalSamples.append(syncDiv) - forceUsingSamples = True - except: - signalSamples.append(1) - pass # Consider ealTimeSynchronization downsampling only if timebase_div is defined - # signalSamples.append(1) Gabriele Jan 2022 - else: # Normal reference - isTreeRef = False - isInputStructField = ( - ('value' in inputDict) and isinstance(inputDict['value'], TreeNode) and inputDict['value'].getParent().getParent().getName() == 'FIELDS') - try: - if isInputStructField: - sourceNode = inputDict['value'].getParent( - ).getParent().getParent().getParent().getParent() - aliasName = inputDict['value'].getParent().getParent().getParent().getNode( - ':name').data()+'_'+inputDict['value'].getParent().getNode(':name').data() - else: # normal field - sourceNode = inputDict['value'].getParent( - ).getParent().getParent() - aliasName = inputDict['value'].getParent().getNode( - ':name').data() - - # signalGamName = inputDict['value'].getParent().getNode(':name').data() - signalGamName = inputDict['name'] - aliasName = inputDict['value'].getParent().getNode( - ':name').data() - sourceGamName = self.convertPath(sourceNode.getFullPath()) - except: - isTreeRef = True - if isTreeRef: - signalName = self.convertPath( - inputDict['value_nid'].getPath()) - signalNames.append(signalName) - signalSamples.append(1) - if 'value' in inputDict: - nonGamInputNodes.append( - {'expr': inputDict['value'], 'dimensions': inputDict['dimensions'], 'name': signalName, 'col_order': inputDict['col_order']}) - gamText += ' '+signalName+' = {\n' -# GAB 2022 gamText += ' DataSource = '+dataSourceName+'_TreeInput\n' - gamText += ' DataSource = '+dataSourceName+'_TreeInDDB\n' - if 'type' in inputDict: - gamText += ' Type = '+inputDict['type']+'\n' - else: - - # Used to force the use of Samples instead of dimensions in case of SYnch datasource - forceUsingSamples = False + sigDef = {} + sigDef['Name'] = sigName + sigDef['Type'] = sigNode.getNode('Type').data() + sigDef['DataSource'] = self.getMarteDeviceName(self)+'_TreeOut' + numDims, numEls = self.parseDimension(sigNode.getNode('DIMENSIONS').data()) + sigDef['NumberOfDimensions'] = numDims + sigDef['NumberOfElements'] = numEls + try: + samples = sigNode.getNode('Samples').data() + except: + samples = 1 + if samples > 1: + sigDef['Samples'] = samples + outputs.append(sigDef) + retGam['Outputs'] = outputs + + return retDataSource, retGam + + + #Return the definitions of RTNOut DataSource and IOGAM for handling data sending to other supervisors + def handleOutputsToBeSent(self, outputsToBeSent): + retDataSource = {} + retDataSource['Class'] = 'RTNOut' + retDataSource['Name'] = self.getMarteDeviceName(self)+'_RTN_OUT' + signals = [] + for currOutput in outputsToBeSent: + signals.append({ + 'Name': currOutput['Name'], + 'Type': currOutput['Type'], + 'NumberOfDimensions': currOutput['NumberOfDimensions'], + 'NumberOfElements': currOutput['NumberOfElements'], + 'Samples': currOutput['Samples'], + 'Ip': currOutput['Ip'], + 'Port': currOutput['Port'], + 'CircuitId': currOutput['CircuitId'], + }) + retDataSource['Signals'] = signals + + retGam = {} + retGam['Class'] = 'IOGAM' + retGam['Name'] = self.getMarteDeviceName(self)+'_RTN_OUT_IOGAM' + inputs = [] + for currOutput in outputsToBeSent: + inputs.append({ + 'Name': currOutput['Name'], + 'Type': currOutput['Type'], + 'NumberOfDimensions': currOutput['NumberOfDimensions'], + 'NumberOfElements': currOutput['NumberOfElements'], + 'Samples': currOutput['Samples'], + 'DataSource': currOutput['DataSource'], + }) + retGam['Inputs'] = inputs + outputs = [] + for currOutput in outputsToBeSent: + outputs.append({ + 'Name': currOutput['Name'], + 'Type': currOutput['Type'], + 'NumberOfDimensions': currOutput['NumberOfDimensions'], + 'NumberOfElements': currOutput['NumberOfElements'], + 'Samples': currOutput['Samples'], + 'DataSource': self.getMarteDeviceName(self)+'_RTN_OUT' + }) + retGam['Outputs'] = outputs + + return retDataSource, retGam + + + ###########Overall Generation + + #return the list of GAM and DataSource (dictionaries) corresponding to this GAM MARTe2 device + def generateMarteGamConfiguration(self, threadMap, timerDDB, timerType, timerPeriod, typesDict): + self.timerDDB = timerDDB + self.timerType = timerType + self.timerPeriod = timerPeriod + + retGams = [] + retDataSources = [] + + retGam = {} + retGam['Name'] = self.getMarteDeviceName(self) + try: + retGam['Class'] = self.getNode('GAM_CLASS').data() + except: + raise Exception('Missing GAM class definition for '+self.getPath()) + try: + numPars = len(self.getNode('PARAMETERS').getChildren()) + except: + numPars = 0 + if numPars > 0: + retGam['Parameters'] = self.getParametersDict(self.getNode('PARAMETERS')) + +################Inputs + resampledSyncSigs = [] + syncInputsToBeReceived = [] + asyncInputsToBeReceived = [] + treeRefs = [] + constRefs = [] + inputsToBePacked = [] + syncThreadSignals = [] + asyncThreadSignals = [] + outputsToBeSent = [] - signalNames.append(signalGamName) - gamText += ' '+signalGamName+' = {\n' - if isInputStructField: - gamText += ' DataSource = '+sourceGamName+'_Expanded_Output_DDB\n' - signalSamples.append(1) - else: - if self.onSameThread(threadMap, sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Output_DDB\n' - signalSamples.append(1) - elif self.sameSynchSource(sourceNode): - gamText += ' DataSource = '+sourceGamName+'_Output_Synch\n' - - try: - syncDiv = self.timebase_div.data() - gamText += ' Samples = ' + \ - str(syncDiv)+'\n' - signalSamples.append(syncDiv) - forceUsingSamples = True - except: - signalSamples.append(1) - pass # Consider ealTimeSynchronization downsampling only if timebase_div is defined - else: - gamText += ' DataSource = '+sourceGamName+'_Output_Asynch\n' - signalSamples.append(1) - gamText += ' Alias = ' + aliasName + '\n' - if 'type' in inputDict: - gamText += ' Type = '+inputDict['type']+'\n' - - if 'dimensions' in inputDict and not forceUsingSamples: - - dimensions = inputDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(inputDict['dimensions']) - numberOfElements = 1 - for currDim in inputDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - # gamText = self.addSignalParameters(inputDict['value_nid'].getParent().getNode('parameters'), gamText) - gamText += ' }\n' - gamText += ' }\n' - - # Output Signals IOGAM - gamText += ' OutputSignals = {\n' - idx = 0 - for outputDict in inputDicts: - if not 'value' in outputDict: - continue - gamText += ' '+signalNames[idx]+' = {\n' - gamText += ' Samples = 1\n' + try: + inputNodes = self.getNode('INPUTS').getChildren() + inputNodes.sort() + except: + raise Exception('No Inputs specified for GAM device '+self.getPath()) + retGam['Inputs'] = self.getInputSignalsDict(inputNodes, threadMap, typesDict, resampledSyncSigs, syncInputsToBeReceived, + asyncInputsToBeReceived, treeRefs, constRefs, inputsToBePacked, isFieldCheck = False) + self.handleOutputTrigger(threadMap, resampledSyncSigs, syncInputsToBeReceived, + asyncInputsToBeReceived, treeRefs) + + #Handle reception of input signals from devices belonging to a different supervisor + if len(syncInputsToBeReceived) > 0: + rtnInInfo = self.handleInputsToBeReceived(syncInputsToBeReceived, isSync = True) + retDataSources += rtnInInfo['DataSources'] + retGams += rtnInInfo['Gams'] + if len(asyncInputsToBeReceived) > 0: + rtnInInfo = self.handleInputsToBeReceived(asyncInputsToBeReceived, isSync = False) + retDataSources += rtnInInfo['DataSources'] + retGams += rtnInInfo['Gams'] - idx = idx+1 - gamText += ' DataSource = '+dataSourceName+'\n' - gamText += ' Type = '+outputDict['type']+'\n' + + #Handle resampling of Input Signals + if len(resampledSyncSigs) > 0: + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Res_DDB', 'Class': 'GAMDataSource'}) + retGams.append(self.handleResampledSyncSigs(resampledSyncSigs)) + + #Handle real-time input signals readout from pulse file + if len(treeRefs) > 0: + retGams.append(self.handleTreeRefs(treeRefs)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_TreeInDDB', 'Class': 'GAMDataSource'}) + + #Handle constant inputs + if len(constRefs) > 0: + retGams.append(self.handleConstRefs(constRefs)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_ConstInDDB', 'Class': 'GAMDataSource'}) + + #Handle Packing of input structures defined in separate fields + if len(inputsToBePacked) > 0: + retGams.append(self.handleInputPacking(inputsToBePacked)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Input_Bus_DDB', 'Class': 'GAMDataSource'}) + +###############Outputs + syncThreadSignals = [] + asyncThreadSignals = [] + outputsToBeSent = [] + signalsToBeStored = [] + outputsToBeUnpacked = [] + try: + outputNodes = self.getNode('OUTPUTS').getChildren() + outputNodes.sort() + except: + raise Exception('No outputs defined for GAM device '+self.getPath()) + + retGam['Outputs'] = self.getOutputSignalsDict(outputNodes, threadMap, typesDict, syncThreadSignals, asyncThreadSignals, + outputsToBeSent, signalsToBeStored, outputsToBeUnpacked, isFieldCheck = False) + + retGams.append(retGam) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Output_DDB', 'Class': 'GAMDataSource'}) + + + #Handle unpacking of output structures + if len(outputsToBeUnpacked) > 0: + retGams.append(self.handleOutputUnpack(outputsToBeUnpacked)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Expanded_Output_DDB', 'Class': 'GAMDataSource'}) + #Handle Synchronous Outputs + if len(syncThreadSignals) > 0: + retGams.append(self.handleSynchronoutOutputs(syncThreadSignals)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Output_Sync', 'Class': 'RealTimeThreadSynchronisation'}) + #Handle Asynchronous Outputs + if len(asyncThreadSignals) > 0: + retGams.append(self.handleAsynchronoutOutputs(asyncThreadSignals)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Output_Async', 'Class': 'RealTimeThreadAsyncBridge'}) + #Handle output storage + if len(signalsToBeStored) > 0: + storeDataSource, storeGam = self.handleOutputsStorage(signalsToBeStored, threadMap) + retDataSources.append(storeDataSource) + retGams.append(storeGam) + #Handle Output network send for signals + if len(outputsToBeSent) > 0: + sendDataSource, sendGam = self.handleOutputsToBeSent(outputsToBeSent) + retDataSources.append(sendDataSource) + retGams.append(sendGam) + + ############All Done!! + return retDataSources, retGams - if outputDict['dimensions'] == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(outputDict['dimensions']) - numberOfElements = 1 - for currDim in outputDict['dimensions']: - numberOfElements *= currDim - gamText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - gamText += ' NumberOfElements = '+str(numberOfElements)+'\n' - gamText = self.addSignalParameters(outputDict['value_nid'].getParent().getNode( - 'parameters'), gamText) # For output devices parameters are copied to out - gamText += ' }\n' - gamText += ' }\n' - gamText += ' }\n' - gams.append(gamText) - - if len(nonGamInputNodes) > 0: #GAB 2022 - gamList.append(dataSourceName+'_TreeIn') - gamList.append(dataSourceName+'_IOGAM') - - # There are input references to tree nodes, we need to build a MdsReader DataSource named _TreeInput - if len(nonGamInputNodes) > 0: - dataSourceText = ' +'+DataSourceName+'_TreeInDDB = {\n' - dataSourceText += ' Class = GAMDataSource\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - - mdsReaderText = ' +'+dataSourceName+ '_TreeIn = {\n' - mdsReaderText += ' Class = MDSReaderGAM\n' - mdsReaderText += ' TreeName = "'+self.getTree().name+'"\n' - mdsReaderText += ' ShotNumber = '+str(self.getTree().shot)+'\n' - mdsReaderText += ' InputSignals = { \n' - mdsReaderText += ' Time = {\n' - mdsReaderText += ' DataSource = '+timerDDB + '\n' - mdsReaderText += ' } \n' - mdsReaderText += ' } \n' - mdsReaderText += ' OutputSignals = { \n' - for nodeDict in nonGamInputNodes: - mdsReaderText += ' '+nodeDict['name']+' = {\n' - mdsReaderText += ' DataSource = '+dataSourceName+ '_TreeInDDB\n' - valExpr = nodeDict['expr'] - if isinstance(valExpr, TreeNode): - valExpr = valExpr.getFullPath() - valExpr = valExpr.replace('"', "'") - mdsReaderText += ' DataExpr = "'+valExpr+'"\n' - mdsReaderText += ' TimebaseExpr = "dim_of(' + \ - valExpr+')"\n' - numberOfElements = 1 - if not (np.isscalar(nodeDict['dimensions'])): - for currDim in nodeDict['dimensions']: - numberOfElements *= currDim - mdsReaderText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - if nodeDict['col_order']: - mdsReaderText += ' UseColumnOrder = 1\n' - else: - mdsReaderText += ' UseColumnOrder = 0\n' - mdsReaderText += ' DataManagement = 1\n' - mdsReaderText += ' }\n' - mdsReaderText += ' }\n' - gams.append(mdsReaderText) - #Head and parameters - dataSourceText = ' +'+dataSourceName+' = {\n' - dataSourceText += ' Class = '+dataSourceClass+'\n' -# parameters - dataSourceText = self.reportParameters(paramDicts, dataSourceText, 1) - -# input Signals - dataSourceText += ' Signals = {\n' - idx = 0 - for inputDict in inputDicts: - if not 'value' in inputDict: - continue - dataSourceText += ' '+signalNames[idx]+' = {\n' - idx = idx+1 - if 'type' in inputDict: - dataSourceText += ' Type = '+inputDict['type']+'\n' - if 'dimensions' in inputDict: - dimensions = inputDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 - else: - numberOfDimensions = len(inputDict['dimensions']) - numberOfElements = 1 - for currDim in inputDict['dimensions']: - numberOfElements *= currDim - dataSourceText += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - dataSourceText += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - dataSourceText = self.addSignalParameters( - inputDict['value_nid'].getParent().getNode('parameters'), dataSourceText) - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSourceText += ' }\n' - dataSources.append(dataSourceText) - return outPeriod - - def getMarteInfo(self, threadMap, gams, dataSources, gamList, typeDicts): - self.prepareMarteInfo() - mode = self.mode.data() - if mode == MARTE2_COMPONENT.MODE_GAM: - return self.getMarteGamInfo(threadMap, gams, dataSources, gamList, typeDicts) - elif mode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: + #return the list of GAM and DataSource (dictionaries) and time period corresponding to this Synchronized Input device + def generateMarteInputConfiguration(self, threadMap, timerDDB, timerType, timerPeriod, typesDict): + self.timerDDB = timerDDB + self.timerType = timerType + self.timerPeriod = timerPeriod - return self.getMarteInputInfo(threadMap, gams, dataSources, gamList, True) - elif mode == MARTE2_COMPONENT.MODE_INPUT: - return self.getMarteInputInfo(threadMap, gams, dataSources, gamList, False) - else: - return self.getMarteOutputInfo(threadMap, gams, dataSources, gamList) + retGams = [] + retDataSources = [] + retDataSource = {} + retDataSource['Name'] = self.getMarteDeviceName(self) + try: + retDataSource['Class'] = self.getNode('GAM_CLASS').data() + except: + raise Exception('Missing DataSource class definition for '+self.getPath()) + try: + numPars = len(self.getNode('PARAMETERS').getChildren()) + except: + numPars = 0 + if numPars > 0: + retDataSource['Parameters'] = self.getParametersDict(self.getNode('PARAMETERS')) -# Utility methods - # return information about the connection. Returned dictionary fields: gam_class, gam_nid, dimensions, type, samples. None if the input is not connected - def getInputChanInfo(self, valNid): +###############Outputs + syncThreadSignals = [] + asyncThreadSignals = [] + outputsToBeSent = [] + signalsToBeStored = [] + outputsToBeUnpacked = [] try: - chanNid = valNid.getData() - # Link to other component up in the chain - if not(isinstance(chanNid, TreeNode) or isinstance(chanNid, TreePath)): - return None - if isinstance(chanNid, TreePath): - chanNid = TreeNode(chanNid, self.getTree()) - chanNid = chanNid.getParent() - retInfo = {} - retInfo['gam_nid'] = chanNid.getParent().getParent() - retInfo['gam_class'] = chanNid.getParent().getParent().getNode( - ':GAM_CLASS').data() # Must not generate exception + outputNodes = self.getNode('OUTPUTS').getChildren() + outputNodes.sort() + except: + raise Exception('No outputs defined for GAM device '+self.getPath()) + + outputs = self.getOutputSignalsDict(outputNodes, threadMap, typesDict, syncThreadSignals, asyncThreadSignals, + outputsToBeSent, signalsToBeStored, outputsToBeUnpacked, isFieldCheck = False) + signals = copy.deepcopy(outputs) + inputs = copy.deepcopy(outputs) + + for currSignal in signals: + currSignal.pop('DataSource') + + retDataSource['Signals'] = signals + retDataSources.append(retDataSource) + + retGam = {} + retGam['Name'] = self.getMarteDeviceName(self)+'_IOGAM' + retGam['Class'] = 'IOGAM' + for currInput in inputs: + currInput['DataSource'] = self.getMarteDeviceName(self) + retGam['Inputs'] = self.removeParametersFromList(inputs) + for currOutput in outputs: try: - retInfo['dimensions'] = chanNid.getNode(':DIMENSIONS').data() + numSamples = currOutput['Samples'] except: - retInfo['dimensions'] = None + numSamples = 1 try: - retInfo['type'] = chanNid.getNode(':TYPE').data() + numElements = currOutput['NumberOfElements'] except: - retInfo['type'] = None + numElements = 1 try: - retInfo['samples'] = chanNid.getNode(':SAMPLES').data() + currOutput.pop('Samples') except: - retInfo['samples'] = None - except: # not connected - return None - return retInfo - + pass + currOutput['NumberOfElements'] = numSamples * numElements + + + + + retGam['Outputs'] = self.removeParametersFromList(outputs) + retGams.append(retGam) + + retDataSources.append({ + 'Name': self.getMarteDeviceName(self)+'_Output_DDB', + 'Class': 'GAMDataSource'}) + + #Handle Synchronous Outputs + if len(syncThreadSignals) > 0: + retGams.append(self.handleSynchronoutOutputs(syncThreadSignals)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Output_Sync', 'Class': 'RealTimeThreadSynchronisation'}) + #Handle Asynchronous Outputs + if len(asyncThreadSignals) > 0: + retGams.append(self.handleAsynchronoutOutputs(asyncThreadSignals)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Output_Async', 'Class': 'RealTimeThreadAsyncBridge'}) + #Handle output storage + if len(signalsToBeStored) > 0: + storeDataSource, storeGam = self.handleOutputsStorage(signalsToBeStored, threadMap) + retDataSources.append(storeDataSource) + retGams.append(storeGam) + #Handle Output network send for signals + if len(outputsToBeSent) > 0: + sendDataSource, sendGam = self.handleOutputsToBeSent(outputsToBeSent) + retDataSources.append(sendDataSource) + retGams.append(sendGam) + + ############All Done!! + return retDataSources, retGams -# Prpeparatory work before reading MARTe2 information. To be overridden by subclasses/ - def prepareMarteInfo(self): - pass + #return the list of GAM and DataSource (dictionaries) corresponding to this GAM MARTe2 device + def generateMarteOutputConfiguration(self, threadMap, timerDDB, timerType, timerPeriod, typesDict): + self.timerDDB = timerDDB + self.timerType = timerType + self.timerPeriod = timerPeriod -# Check timebase generation - def checkTimebase(self, threadMap): - mode = self.mode.getData() - if mode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: - return MARTE2_COMPONENT.TIMEBASE_GENERATOR + retGams = [] + retDataSources = [] - # Will always succeed since it is called AFTER checkGeneric - timebase = self.timebase.getData() - if isinstance(timebase, Range): - # Note this will be overridden by Sync - return MARTE2_COMPONENT.TIMEBASE_GENERATOR + retDataSource = {} + retDataSource['Name'] = self.getMarteDeviceName(self) + try: + retDataSource['Class'] = self.getNode('GAM_CLASS').data() + except: + raise Exception('Missing GAM class definition for '+self.getPath()) + try: + numPars = len(self.getNode('PARAMETERS').getChildren()) + except: + numPars = 0 + if numPars > 0: + retDataSource['Parameters'] = self.getParametersDict(self.getNode('PARAMETERS')) - prevTimebase = timebase # Checks no more needed here - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() +################Inputs + resampledSyncSigs = [] + syncInputsToBeReceived = [] + asyncInputsToBeReceived = [] + treeRefs = [] + constRefs = [] + inputsToBePacked = [] - if self.onSameThread(threadMap, prevTimebase.getParent()): - return MARTE2_COMPONENT.TIMEBASE_FROM_SAME_THREAD - else: - return MARTE2_COMPONENT.TIMEBASE_FROM_ANOTHER_THREAD -# Generic consistency check valid for every MARTE2_COMPONENT instance - def checkGeneric(self, threadMap): - - # Check Timebase try: - timebase = self.timebase.getData() + inputNodes = self.getNode('INPUTS').getChildren() + inputNodes.sort() except: - return "Missing timebase" - if isinstance(timebase, Range): - try: - period = timebase.getDescAt(2).data() - if(period <= 0): - return 'Invalid timebase period: '+str(period) - except: - return 'Invalid timebase period' - # Link to other component up in the chain - elif isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - prevTimebase = timebase + raise Exception('No Inputs specified for GAM device '+self.getPath()) + inputs = self.getInputSignalsDict(inputNodes, threadMap, typesDict, resampledSyncSigs, syncInputsToBeReceived, + asyncInputsToBeReceived, treeRefs, constRefs, inputsToBePacked, isFieldCheck = False) + + signals = copy.deepcopy(inputs) + outputs = copy.deepcopy(inputs) + + for currSignal in signals: + currSignal.pop('DataSource') try: - while isinstance(timebase, TreeNode) or isinstance(timebase, TreePath): - if isinstance(timebase, TreeNode): - prevTimebase = timebase - timebase = timebase.getData() - else: - prevTimebase = TreeNode(timebase, self.getTree()) - timebase = prevTimebase.getData() - if prevTimebase.getParent().getUsage() != 'DEVICE': - return 'Invalid timebase reference '+prevTimebase.getParent().getUsage() - gamClass = prevTimebase.getParent().getNode( - ':GAM_CLASS') # Make sure it is a MARTe2 device - if prevTimebase.getNodeName() != 'TIMEBASE': - return 'Invalid timebase reference: ' + prevTimebase().getNodeName() + currSignal.pop('Alias') except: - return 'Invalid timebase reference' -# Check Inputs - - configDict = self.getGamInfo() - inputDicts = configDict['inputDicts'] - inputIdx = 0 - for inputDict in inputDicts: - inputIdx += 1 - if 'value' in inputDict and isinstance(inputDict['value'], TreeNode) and inputDict['value'].getNodeName() == 'TIMEBASE': - # Must a Time field referring to this timebase - if inputDict['value'].getParent().getNid() != self.getNid(): - return 'Invalid input: TIMEBASE must refer to the same device' - continue - isTreeRef = False + pass + retDataSource['Signals'] = signals + retDataSources.append(retDataSource) + + for currOutput in outputs: + currOutput['DataSource'] = self.getMarteDeviceName(self) try: - sourceNode = inputDict['value'].getParent( - ).getParent().getParent() - if sourceNode.getUsage() != 'DEVICE': - isTreeRef = True - else: - # FIXME: all three vars unused - # Make sure it is a MARTe2 device - gamClass = sourceNode.getNode('GAM_CLASS') - sourceGamName = self.convertPath(sourceNode.getFullPath()) - signalGamName = inputDict['value'].getParent().getNode( - ':name').data() + currOutput.pop('Alias') except: - isTreeRef = True - if isTreeRef: - continue # We cannot say anything if it is a reference to a a node that is not the output of a MARTe2 device - - if inputDict['value'].getParent().getParent().getNodeName() != 'OUTPUTS': - return 'Input '+str(inputIdx)+' is not the output field of a MARTe2 device' - inType = inputDict['value'].getParent().getNode(':TYPE').getData() - if inType != inputDict['type']: - return 'Type mismatch for input '+str(inputIdx)+': expected '+inputDict['type']+' found '+inType - if not np.isscalar(inputDict['dimensions']) and len(inputDict['dimensions']) == 1 and inputDict['dimensions'][0] == inputDict['value'].getParent().getNode(':SAMPLES').getData(): - continue # for ADC producing a set of sampled every cycle - - if self.checkTimebase(threadMap) == MARTE2_COMPONENT.TIMEBASE_FROM_ANOTHER_THREAD: - try: - syncDiv = self.timebase_div.data() - except: - syncDiv = 1 - else: - syncDiv = 1 - inDimensions = inputDict['value'].getParent().getNode( - ':DIMENSIONS').getData() - if inDimensions != inputDict['dimensions']: - return 'Dimension mismatch for input '+str(inputIdx)+': expected '+str(inputDict['dimensions'])+' found '+str(inDimensions) + pass - return '' + #Handle reception of input signals from devices belonging to a different supervisor + if len(syncInputsToBeReceived) > 0: + rtnInInfo = self.handleInputsToBeReceived(syncInputsToBeReceived, isSync = True) + retDataSources += rtnInInfo['DataSources'] + retGams += rtnInInfo['Gams'] + if len(asyncInputsToBeReceived) > 0: + rtnInInfo = self.handleInputsToBeReceived(asyncInputsToBeReceived, isSync = False) + retDataSources += rtnInInfo['DataSources'] + retGams += rtnInInfo['Gams'] + + #Handle resampling of Input Signals + if len(resampledSyncSigs) > 0: + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_Res_DDB', 'Class': 'GAMDataSource'}) + retGams.append(self.handleResampledSyncSigs(resampledSyncSigs)) -# Specific consistency check to be implemented by MARTE2_COMPONENT subclasses - def checkSpecific(self): - return '' + #Handle real-time input signals readout from pulse file + if len(treeRefs) > 0: + retGams.append(self.handleTreeRefs(treeRefs)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_TreeInDDB', 'Class': 'GAMDataSource'}) -# Final check method + #Handle constant inputs + if len(constRefs) > 0: + retGams.append(self.handleConstRefs(constRefs)) + retDataSources.append({'Name': self.getMarteDeviceName(self)+'_ConstInDDB', 'Class': 'GAMDataSource'}) - def check(self, threadMap): - status = self.checkGeneric(threadMap) - if status != '': - return status - return self.checkSpecific() + + retGams.append({ + 'Name': self.getMarteDeviceName(self)+'_IOGAM', + 'Class': 'IOGAM', + 'Inputs': self.removeParametersFromList(inputs), + 'Outputs': self.removeParametersFromList(outputs)}) + + return retDataSources, retGams + + def generateMarteConfiguration(self, threadMap, timerDDB, timerType, timerPeriod, typesDict): + try: + mode = self.getNode('MODE').data() + except: + raise Exception('No mode field defined for '+self.getPath()) + if mode == MARTE2_COMPONENT.MODE_GAM: + return self.generateMarteGamConfiguration(threadMap, timerDDB, timerType, timerPeriod, typesDict) + elif mode == MARTE2_COMPONENT.MODE_INPUT or mode == MARTE2_COMPONENT.MODE_SYNCH_INPUT: + return self.generateMarteInputConfiguration(threadMap, timerDDB, timerType, timerPeriod, typesDict) + else: #MODE_OUTPUT + return self.generateMarteOutputConfiguration(threadMap, timerDDB, timerType, timerPeriod, typesDict) + + #return the Description (dictionary) corresponding ot this Interface device + def generateMarteInterfaceConfiguration(self): + retInterface = {} + retInterface['Name'] = self.getMarteDeviceName(self) + try: + retInterface['Class'] = self.getNode('GAM_CLASS').data() + except: + raise Exception('Missing class definition for '+self.getPath()) + try: + numPars = len(self.getNode('PARAMETERS').getChildren()) + except: + numPars = 0 + if numPars > 0: + retInterface['Parameters'] = self.getParametersDict(self.getNode('PARAMETERS')) + + return retInterface + + + + def prepareMarteInfo(self): + pass -class BUILDER: - def __init__(self, clazz, mode, timebaseExpr=None): - self.clazz = clazz - self.mode = mode - self.timebaseExpr = timebaseExpr - def __call__(self, cls): - cls.buildGam(cls.parts, self.clazz, self.mode, self.timebaseExpr) - return cls diff --git a/pydevices/RfxDevices/MARTE2_DOUBLEH_MASTER.py b/pydevices/RfxDevices/MARTE2_DOUBLEH_MASTER.py new file mode 100644 index 0000000000..c1243a96a8 --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_DOUBLEH_MASTER.py @@ -0,0 +1,62 @@ +# +# 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. +# + +from MDSplus import Data, TreeNode, TreePath + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('DoubleHandshakeGAM::DoubleHandshakeMasterGAM', MC.MARTE2_COMPONENT.MODE_GAM) +class MARTE2_DOUBLEH_MASTER(MC.MARTE2_COMPONENT): + inputs = [ + {'name': 'CommandIn0', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'CommandIn1', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'CommandIn2', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'CommandIn3', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'AckIn0', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'AckIn1', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'AckIn2', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'AckIn3', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn0', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn1', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn2', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn3', 'type': 'uint32', 'dimensions': 0, 'parameters': []}] + + outputs = [ + {'name': 'CommandOut0', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'CommandOut1', 'type': 'uint32', 'dimensions': -1, 'parameters': []}, + {'name': 'CommandOut2', 'type': 'uint32', 'dimensions': -1, 'parameters': []}, + {'name': 'CommandOut3', 'type': 'uint32', 'dimensions': -1, 'parameters': []}, + {'name': 'InternalState0', 'type': 'uint8', 'dimensions': 0, 'parameters': []}, + {'name': 'InternalState1', 'type': 'uint8', 'dimensions': -1, 'parameters': []}, + {'name': 'InternalState2', 'type': 'uint8', 'dimensions': -1, 'parameters': []}, + {'name': 'InternalState3', 'type': 'uint8', 'dimensions': -1, 'parameters': []}] + + parameters = [] + parts = [] + + def prepareMarteInfo(self): + pass + diff --git a/pydevices/RfxDevices/MARTE2_DOUBLEH_SLAVE.py b/pydevices/RfxDevices/MARTE2_DOUBLEH_SLAVE.py new file mode 100644 index 0000000000..0c426f4b21 --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_DOUBLEH_SLAVE.py @@ -0,0 +1,58 @@ +# +# 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. +# + +from MDSplus import Data, TreeNode, TreePath + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('DoubleHandshakeGAM::DoubleHandshakeSlaveGAM', MC.MARTE2_COMPONENT.MODE_GAM) +class MARTE2_DOUBLEH_SLAVE(MC.MARTE2_COMPONENT): + inputs = [ + {'name': 'CommandIn0', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'CommandIn1', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'CommandIn2', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'CommandIn3', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn0', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn1', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn2', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'ClearIn3', 'type': 'uint32', 'dimensions': 0, 'parameters': []}] + + outputs = [ + {'name': 'AckOut0', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'AckOut1', 'type': 'uint32', 'dimensions': -1, 'parameters': []}, + {'name': 'AckOut2', 'type': 'uint32', 'dimensions': -1, 'parameters': []}, + {'name': 'AckOut3', 'type': 'uint32', 'dimensions': -1, 'parameters': []}, + {'name': 'InternalState0', 'type': 'uint8', 'dimensions': 0, 'parameters': []}, + {'name': 'InternalState1', 'type': 'uint8', 'dimensions': -1, 'parameters': []}, + {'name': 'InternalState2', 'type': 'uint8', 'dimensions': -1, 'parameters': []}, + {'name': 'InternalState3', 'type': 'uint8', 'dimensions': -1, 'parameters': []}] + + parameters = [] + parts = [] + + def prepareMarteInfo(self): + pass + \ No newline at end of file diff --git a/pydevices/RfxDevices/MARTE2_DTACQAI.py b/pydevices/RfxDevices/MARTE2_DTACQAI.py index 9689b01bc1..4e7cecd819 100644 --- a/pydevices/RfxDevices/MARTE2_DTACQAI.py +++ b/pydevices/RfxDevices/MARTE2_DTACQAI.py @@ -61,10 +61,10 @@ class MARTE2_DTACQAI(MC.MARTE2_COMPONENT): def prepareMarteInfo(self): print('0:1000000 :1. / (build_path("\\'+self.getFullPath()+'.parameters:par_1:value"))') self.timebase.putData(Data.compile('0:1000000 : 1. / (build_path("\\'+self.getFullPath()+'.parameters:par_1:value"))')) - self.outputs_time_samples.putData(self.parameters_par_13_value.data()) - self.outputs_counter_samples.putData(self.parameters_par_13_value.data()) + self.outputs_time_samples.putData(self.getNode('PARAMETERS.PAR_13:VALUE').data()) + self.outputs_counter_samples.putData(self.getNode('PARAMETERS.PAR_13:VALUE').data()) for i in range(64): - getattr(self, 'outputs_chan_'+str(i+1)+'_samples').putData(self.parameters_par_13_value.data()) + getattr(self, 'outputs_chan_'+str(i+1)+'_samples').putData(self.getNode('PARAMETERS.PAR_13:VALUE').data()) for i in range(32): - getattr(self, 'outputs_di_'+str(i+1)+'_samples').putData(self.parameters_par_13_value.data()) + getattr(self, 'outputs_di_'+str(i+1)+'_samples').putData(self.getNode('PARAMETERS.PAR_13:VALUE').data()) diff --git a/pydevices/RfxDevices/MARTE2_EPICSCA.py b/pydevices/RfxDevices/MARTE2_EPICSCA.py new file mode 100644 index 0000000000..9546aa84da --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_EPICSCA.py @@ -0,0 +1,54 @@ + +from MDSplus import Data +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('EPICS::EPICSCAClient', MC.MARTE2_COMPONENT.MODE_INTERFACE) +class MARTE2_EPICSCA(MC.MARTE2_COMPONENT): + parameters = [ + {'name':'+PV1', 'type':'structure', 'value': [ + {'name':'Class', 'type':'string', 'value':'EPICS::EPICSPV'}, + {'name':'PVName', 'type':'string', 'value':'PV1'}, + {'name':'PVType', 'type':'string', 'value':'int32'}, + {'name':'NumberOfElements', 'type':'int32', 'value':1}, + {'name':'Event', 'type':'structure', 'value':[ + {'name':'Destination','type':'string', 'value':'GAMDest1'}, + {'name':'PVValue','type':'string', 'value':'Parameter'}, + {'name':'Function','type':'string', 'value':'UpdateSetPoint'}, + ]}, + ]}, + {'name':'+PV2', 'type':'structure', 'value': [ + {'name':'Class', 'type':'string', 'value':'EPICS::EPICSPV'}, + {'name':'PVName', 'type':'string', 'value':'PV2'}, + {'name':'PVType', 'type':'string', 'value':'int32'}, + {'name':'NumberOfElements', 'type':'int32', 'value':1}, + {'name':'Event', 'type':'structure', 'value':[ + {'name':'Destination','type':'string', 'value':'GAMDest1'}, + {'name':'PVValue','type':'string', 'value':'Parameter'}, + {'name':'Function','type':'string', 'value':'UpdateSetPoint'}, + ]}, + ]}, + {'name':'+PV3', 'type':'structure', 'value': [ + {'name':'Class', 'type':'string', 'value':'EPICS::EPICSPV'}, + {'name':'PVName', 'type':'string', 'value':'PV3'}, + {'name':'PVType', 'type':'string', 'value':'int32'}, + {'name':'NumberOfElements', 'type':'int32', 'value':1}, + {'name':'Event', 'type':'structure', 'value':[ + {'name':'Destination','type':'string', 'value':'GAMDest1'}, + {'name':'PVValue','type':'string', 'value':'Parameter'}, + {'name':'Function','type':'string', 'value':'UpdateSetPoint'}, + ]}, + ]}, + {'name':'+PV4', 'type':'structure', 'value': [ + {'name':'Class', 'type':'string', 'value':'EPICS::EPICSPV'}, + {'name':'PVName', 'type':'string', 'value':'PV4'}, + {'name':'PVType', 'type':'string', 'value':'int32'}, + {'name':'NumberOfElements', 'type':'int32', 'value':1}, + {'name':'Event', 'type':'structure', 'value':[ + {'name':'Destination','type':'string', 'value':'GAMDest1'}, + {'name':'PVValue','type':'string', 'value':'Parameter'}, + {'name':'Function','type':'string', 'value':'UpdateSetPoint'}, + ]}, + ]} + ] + parts = [] \ No newline at end of file diff --git a/pydevices/RfxDevices/MARTE2_OPCUA_IN.py b/pydevices/RfxDevices/MARTE2_OPCUA_IN.py new file mode 100644 index 0000000000..391c7a0309 --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_OPCUA_IN.py @@ -0,0 +1,54 @@ +# +# 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. +# + +from MDSplus import Data + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('OPCUADataSource::OPCUADSInput', MC.MARTE2_COMPONENT.MODE_INPUT) +class MARTE2_OPCUA_IN(MC.MARTE2_COMPONENT): + outputs = [] + for idx in range(128): + outputs += [{'name': 'Out'+str(idx+1), 'type': 'int32', 'dimensions': -1, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}] + parameters = [ + {'name': 'Address', 'type': 'string', 'value': ''}, + {'name': 'Authentication', 'type': 'string', 'value': 'None'}, + {'name': 'ReadMode', 'type': 'string', 'value': 'Read'}, + {'name': 'SamplingTime', 'type': 'int32', 'value': 300}, + {'name': 'Synchronise', 'type': 'string', 'value': 'yes'}, + {'name': 'CpuMask', 'type': 'int32', 'value': 255}, + {'name': 'StackSize', 'type': 'int32', 'value': 10000000}, + {'name': 'Traverse', 'type': 'int32', 'value': 0}, + {'name': 'RootNamespaceIndex', 'type': 'int32', 'value': 1}, + {'name': 'RootIdentifierValue', 'type': 'string', 'value': 'DataBlocksGlobal'}, + {'name': 'RootIdentifierType', 'type': 'string'}] + parts = [] + + def prepareMarteInfo(self): + self.timebase.putData(Data.compile( + ' * : * : (build_path("\\'+self.getFullPath()+'.parameters:par_4:value"))')) diff --git a/pydevices/RfxDevices/MARTE2_OPCUA_OUT.py b/pydevices/RfxDevices/MARTE2_OPCUA_OUT.py new file mode 100644 index 0000000000..e8fde64745 --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_OPCUA_OUT.py @@ -0,0 +1,148 @@ +# +# 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. +# + + + + +from MDSplus import Data + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER(' OPCUADataSource::OPCUADSOutput', MC.MARTE2_COMPONENT.MODE_OUTPUT) +class MARTE2_OPCUA_OUT(MC.MARTE2_COMPONENT): + inputs = [ + {'name': 'In1', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In2', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In3', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In4', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In5', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In6', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In7', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In8', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In9', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In10', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In11', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In12', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In13', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In14', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In15', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In16', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In17', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In18', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In19', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In20', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In21', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In22', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In23', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In24', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In25', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In26', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In27', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In28', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In29', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In30', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In31', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + {'name': 'In32', 'type': 'int32', 'dimensions': 0, 'parameters': [ + {'name': 'NamespaceIndex', 'type':'int32', 'value': 0}, + {'name': 'Path', 'type':'string', 'value': ''} ]}, + ] + + parameters = [ + {'name': 'Address', 'type': 'string', 'value': ''}, + {'name': 'Authentication', 'type': 'string', 'value': 'None'}, + {'name': 'UserPawsswordFile', 'type': 'string', 'value': ''}, + {'name': 'Traverse', 'type': 'int32', 'value': 0}, + {'name': 'RootNamespaceIndex', 'type': 'int32', 'value': 1}, + {'name': 'RootIdentifierValue', 'type': 'string', 'value': 'DataBlocksGlobal'}, + {'name': 'RootIdentifierType', 'type': 'string'}] + parts = [] + + def prepareMarteInfo(self): + pass + + \ No newline at end of file diff --git a/pydevices/RfxDevices/MARTE2_OPCUA_SERVER.py b/pydevices/RfxDevices/MARTE2_OPCUA_SERVER.py new file mode 100644 index 0000000000..9972c6ef43 --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_OPCUA_SERVER.py @@ -0,0 +1,80 @@ + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('OPCUA::OPCUAServer', MC.MARTE2_COMPONENT.MODE_INTERFACE) +class MARTE2_OPCUA_SERVER(MC.MARTE2_COMPONENT): + parameters = [ + {'name': 'Port', 'type':'int32', 'value': 4840}, + {'name': 'CPUMask', 'type':'int32', 'value': 255}, + {'name': 'Authentication', 'type':'string', 'value': 'None'}, + {'name':'AddressSpace', 'type':'structure', 'value': [ + {'name': 'ciccio', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': 'bombo', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + {'name': '', 'type': 'structure', 'value': [ + {'name': 'Type', 'type': 'string'} + ] + }, + ] + } + ] + parts = [] + diff --git a/pydevices/RfxDevices/MARTE2_PYTHON.py b/pydevices/RfxDevices/MARTE2_PYTHON.py index e8b4f01af7..feca46de8e 100644 --- a/pydevices/RfxDevices/MARTE2_PYTHON.py +++ b/pydevices/RfxDevices/MARTE2_PYTHON.py @@ -77,9 +77,9 @@ def convert_param(cls, name, dim, dtype, val): except KeyError: dtype = 'int32' return { - 'name': 'Parameters.' + name, + 'name': name, 'type': dtype, - 'value': np.array(val, dtype), + 'value': val, } def __call__(self, cls): @@ -107,7 +107,8 @@ def __call__(self, cls): 'name': 'FileName', 'type': 'string', 'value': self.module.__file__.split('/')[-1].split('.')[0]}, - ] + [ + ] + pyParams = [ self.convert_param( self.pygam.getParameterName(self.module.__name__, i), self.pygam.getParameterDimensions(self.module.__name__, i), @@ -116,6 +117,11 @@ def __call__(self, cls): ) for i in range(self.pygam.getNumberOfParameters(self.module.__name__)) ] + cls.parameters.append({ + 'name': 'Parameters', + 'type': 'structure', + 'value': pyParams + }) cls.parts = [] cls.buildGam(cls.parts, 'PyGAM', MC.MARTE2_COMPONENT.MODE_GAM) return cls diff --git a/pydevices/RfxDevices/MARTE2_RAMP.py b/pydevices/RfxDevices/MARTE2_RAMP.py new file mode 100644 index 0000000000..9a3d72f76c --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_RAMP.py @@ -0,0 +1,56 @@ +# +# 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. +# + + + + +from MDSplus import Data, TreeNode, TreePath + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('PiecewiseLinearGAM', MC.MARTE2_COMPONENT.MODE_GAM) +class MARTE2_RAMP(MC.MARTE2_COMPONENT): + inputs = [ + {'name': 'Time', 'type': 'uint32', 'dimensions': 0, 'parameters': []}, + {'name': 'Enable', 'type': 'uint8', 'dimensions': 0, 'parameters': []}, + {'name': 'SoftLandingTrigger', 'type': 'uint8', 'dimensions': 0, 'parameters': []}] + outputs = [ + {'name': 'ramp', 'type': 'float64', 'dimensions':0, 'parameters': []}] + parameters = [ + {'name': 'InitialValue', 'type': 'float64'}, + {'name': 'SetPoint', 'type': 'float64'}, + {'name': 'Vertices', 'type': 'float64'}, + {'name': 'Slopes', 'type': 'float64'}, + {'name': 'SetPointScaling', 'type': 'float64'}, + {'name': 'SlopeScaling', 'type': 'float64'}, + {'name': 'TimeScaling', 'type': 'float64'}, + {'name': 'SoftLandingSlope', 'type': 'float64'} + ] + + parts = [] + + def prepareMarteInfo(self): + pass \ No newline at end of file diff --git a/pydevices/RfxDevices/MARTE2_RTNIN.py b/pydevices/RfxDevices/MARTE2_RTNIN.py new file mode 100644 index 0000000000..8a67b6f55b --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_RTNIN.py @@ -0,0 +1,43 @@ +# +# 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. +# + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('RTNIn', MC.MARTE2_COMPONENT.MODE_INPUT) +class MARTE2_RTNIN(MC.MARTE2_COMPONENT): + outputs = [ + {'name': 'Out1', 'type': 'float32', 'dimensions': 0, 'parameters': []}, + {'name': 'Out2', 'type': 'float32', 'dimensions': 0, 'parameters': []}, + {'name': 'Out3', 'type': 'float32', 'dimensions': 0, 'parameters': []}, + {'name': 'Out4', 'type': 'float32', 'dimensions': 0, 'parameters': []} ] + parameters = [ + {'name': 'Ip', 'type': 'string', 'value': 'localhost'}, + {'name': 'Port', 'type': 'int32', 'value': 8123}, + {'name': 'CircuitId', 'type': 'int32', 'value': 1}, + {'name': 'IsSynch', 'type': 'int32', 'value': 1}, + {'name': 'CpuMask', 'type': 'int32'} + ] + parts = [] diff --git a/pydevices/RfxDevices/MARTE2_RTNOUT.py b/pydevices/RfxDevices/MARTE2_RTNOUT.py new file mode 100644 index 0000000000..43838f8b63 --- /dev/null +++ b/pydevices/RfxDevices/MARTE2_RTNOUT.py @@ -0,0 +1,49 @@ +# +# 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. +# + +MC = __import__('MARTE2_COMPONENT', globals()) + + +@MC.BUILDER('RTNOut', MC.MARTE2_COMPONENT.MODE_OUTPUT) +class MARTE2_RTNOUT(MC.MARTE2_COMPONENT): + inputs = [ + {'name': 'In1', 'type': 'float32', 'dimensions': 0, 'parameters': + [{'name': 'Ip', 'type': 'string', 'value': 'Localhost'}, + {'name': 'Port', 'type': 'int32', 'value': 8123}, + {'name': 'CircuitId', 'type': 'int32', 'value': 1}]}, + {'name': 'In2', 'type': 'float32', 'dimensions': 0, 'parameters': + [{'name': 'Ip', 'type': 'string', 'value': 'Localhost'}, + {'name': 'Port', 'type': 'int32', 'value': 8123}, + {'name': 'CircuitId', 'type': 'int32', 'value': 1}]}, + {'name': 'In3', 'type': 'float32', 'dimensions': 0, 'parameters': + [{'name': 'Ip', 'type': 'string', 'value': 'Localhost'}, + {'name': 'Port', 'type': 'int32', 'value': 8123}, + {'name': 'CircuitId', 'type': 'int32', 'value': 1}]}, + {'name': 'In4', 'type': 'float32', 'dimensions': 0, 'parameters': + [{'name': 'Ip', 'type': 'string', 'value': 'Localhost'}, + {'name': 'Port', 'type': 'int32', 'value': 8123}, + {'name': 'CircuitId', 'type': 'int32', 'value': 1}]}] + parameters = [] + parts = [] diff --git a/pydevices/RfxDevices/MARTE2_SIMULINK.py b/pydevices/RfxDevices/MARTE2_SIMULINK.py index 52b04baf2b..052694e8b1 100644 --- a/pydevices/RfxDevices/MARTE2_SIMULINK.py +++ b/pydevices/RfxDevices/MARTE2_SIMULINK.py @@ -572,13 +572,17 @@ def GetModelParameterData(ParameterStruct, numOfParameters): raise Exception('Unsupported parameter datatype.') # retrieved data is saved to a dictionary - paramDict = dict(name='Parameters.'+retrievedName, + # paramDict = dict(name='Parameters.'+retrievedName, + # type=MARTe2Typename, dimensions=dimension, value=mdsplusValue) + paramDict = dict(name=retrievedName, type=MARTe2Typename, dimensions=dimension, value=mdsplusValue) # dictionary is appended to the MDSplus-style list paramList.append(paramDict) else: #retrievedSLIdType == 255 SRUCTURED PARAMETERS - GetModelParameterFields(retrievedTypeIdx, ParameterStruct, paramIdx, 'Parameters.'+retrievedName, paramList, 1) + paramDict = dict(name=retrievedName, type = 'structure', + value = GetModelParameterFields(retrievedTypeIdx, ParameterStruct, paramIdx, 1)) + #GetModelParameterFields(retrievedTypeIdx, ParameterStruct, paramIdx, 'Parameters.'+retrievedName, paramList, 1) #numFields = WrapperLib.WCAPI_GetDataTypeNumElements( #DataTypeMap, retrievedTypeIdx) @@ -737,15 +741,17 @@ def GetModelParameterData(ParameterStruct, numOfParameters): #endif STRUCTURED PARAMETER #endfor parameters #print('PARAMETRI FATTI') - return paramList + return [dict(name='Parameters', + type='structure', + value= paramList)] ################################################################# #Recursive method for parameter structures ################################################################## - def GetModelParameterFields(structTypeIdx, ParameterStruct, paramIdx, baseParName, paramList, recLev ): + def GetModelParameterFields(structTypeIdx, ParameterStruct, paramIdx, recLev ): if recLev == 10: raise Exception - + paramList = [] numFields = WrapperLib.WCAPI_GetDataTypeNumElements( DataTypeMap, structTypeIdx) elementMapIndex = WrapperLib.WCAPI_GetDataTypeElemMapIndex( @@ -828,7 +834,10 @@ def GetModelParameterFields(structTypeIdx, ParameterStruct, paramIdx, baseParNam raise Exception('Unsupported Enum datatype.') else: #NESTED STRUCTURES!!!!!!!!!!!!!!!! #print('TYPE '+str(fieldSLIdType) + ' '+str(fieldTypeIdx)) - GetModelParameterFields(fieldTypeIdx, ParameterStruct, paramIdx, baseParName + '-'+fieldName, paramList, recLev+1) + paramDict = dict(name=fieldName, + type='structure', + value= GetModelParameterFields(fieldTypeIdx, ParameterStruct, paramIdx, recLev+1)) + paramList.append(paramDict) continue #no direct data associated # field dimensions # dimensions are retrieved @@ -901,10 +910,11 @@ def GetModelParameterFields(structTypeIdx, ParameterStruct, paramIdx, baseParNam else: raise Exception('Unsupported parameter datatype.') - paramDict = dict(name=baseParName+'-'+fieldName, + paramDict = dict(name=fieldName, type=fieldMARTe2Typename, dimensions=fieldDimension, value=mdsplusValue) # dictionary is appended to the MDSplus-style list paramList.append(paramDict) + return paramList #end GetModelParameterFields # First parameter should be the model name diff --git a/pydevices/RfxDevices/MARTE2_STREAM.py b/pydevices/RfxDevices/MARTE2_STREAM.py index 3852881c0b..8eff3e875f 100644 --- a/pydevices/RfxDevices/MARTE2_STREAM.py +++ b/pydevices/RfxDevices/MARTE2_STREAM.py @@ -47,18 +47,4 @@ class MARTE2_STREAM(MC.MARTE2_COMPONENT): parts = [] def prepareMarteInfo(self): - if self.parameters_par_4_value.data() == 0: # If oscilloscope mode - for chanIdx in range(8): - currInput = getattr( - self, 'inputs_outstream%d_value' % (chanIdx+1)) - info = self.getInputChanInfo(currInput) - if info != None: - getattr(self, 'inputs_outstream%d_type' % - (chanIdx+1)).putData(info['type']) - if info['samples'] != None and info['samples'] > 1: - getattr(self, 'inputs_outstream%d_dimensions' % ( - chanIdx+1)).putData(Data.compile('[$]', info['samples'])) - else: - if info['dimensions'] != None: - getattr(self, 'inputs_outstream%d_dimensions' % - (chanIdx+1)).putData(info['dimensions']) + pass \ No newline at end of file diff --git a/pydevices/RfxDevices/MARTE2_SUPERVISOR.py b/pydevices/RfxDevices/MARTE2_SUPERVISOR.py index 1cf6e4ee50..e0129c64e7 100644 --- a/pydevices/RfxDevices/MARTE2_SUPERVISOR.py +++ b/pydevices/RfxDevices/MARTE2_SUPERVISOR.py @@ -1,5 +1,6 @@ -from MDSplus import Device, Event, VECTOR, Uint8Array +import MDSplus +import RfxDevices import subprocess import numpy as np import time @@ -9,17 +10,27 @@ MC = __import__('MARTE2_COMPONENT', globals()) -class MARTE2_SUPERVISOR(Device): +class MARTE2_SUPERVISOR(MDSplus.Device): """National Instrument 6683 device. Generation of clock and triggers and recording of events """ - parts = [{'path': ':NAME', 'type': 'text'}, {'path': ':COMMENT', - 'type': 'text'}, {'path': ':NUM_STATES', 'type': 'numeric'}] - for stateIdx in range(10): + parts = [ + {'path': ':NAME', 'type': 'text'}, + {'path': ':COMMENT','type': 'text'}, + {'path': ':IP_ADDRESS','type': 'text', 'value':'localhost'}, + {'path': ':NUM_STATES', 'type': 'numeric', 'value': 1}, + {'path': ':INTERFACES', 'type': 'numeric'}, + {'path': ':SUPERVISORS', 'type': 'numeric'}, + ] + + MAX_STATES = 10 + MAX_THREADS = 10 + + for stateIdx in range(MAX_STATES): parts.append({'path': '.STATE_'+str(stateIdx+1), 'type': 'structure'}) parts.append( {'path': '.STATE_'+str(stateIdx+1)+':NAME', 'type': 'text'}) parts.append({'path': '.STATE_'+str(stateIdx+1) + - ':NUM_THREADS', 'type': 'numeric'}) - for threadIdx in range(10): + ':NUM_THREADS', 'type': 'numeric', 'value': 1}) + for threadIdx in range(MAX_THREADS): parts.append({'path': '.STATE_'+str(stateIdx+1) + '.THREAD_'+str(threadIdx+1), 'type': 'structure'}) parts.append({'path': '.STATE_'+str(stateIdx+1) + @@ -28,11 +39,19 @@ class MARTE2_SUPERVISOR(Device): '.THREAD_'+str(threadIdx+1)+':CORE', 'type': 'numeric'}) parts.append({'path': '.STATE_'+str(stateIdx+1) + '.THREAD_'+str(threadIdx+1)+':GAMS', 'type': 'numeric'}) + parts.append({'path': '.STATE_'+str(stateIdx+1) + + '.THREAD_'+str(threadIdx+1)+':TIMEBASE_MOD', 'type': 'text', 'value': 'EXTERNAL'}) + parts.append({'path': '.STATE_'+str(stateIdx+1) + + '.THREAD_'+str(threadIdx+1)+':TIMEBASE_DEF', 'type': 'numeric'}) + parts.append({'path': '.STATE_'+str(stateIdx+1) + + '.THREAD_'+str(threadIdx+1)+':TIMEBASE_DIV', 'type': 'numeric'}) + parts.append({'path': '.STATE_'+str(stateIdx+1) + + '.THREAD_'+str(threadIdx+1)+':TIME_PORT', 'type': 'numeric'}) parts.append({'path': '.TIMES', 'type': 'structure'}) - for stateIdx in range(10): + for stateIdx in range(MAX_STATES): parts.append({'path': '.TIMES.STATE_' + str(stateIdx+1), 'type': 'structure'}) - for threadIdx in range(10): + for threadIdx in range(MAX_THREADS): parts.append({'path': '.TIMES.STATE_'+str(stateIdx+1) + '.THREAD_'+str(threadIdx+1), 'type': 'structure'}) parts.append({'path': '.TIMES.STATE_'+str(stateIdx+1)+'.THREAD_' + @@ -72,498 +91,1211 @@ class MARTE2_SUPERVISOR(Device): MODE_GAM = 1 MODE_INPUT = 2 - MODE_SYNCH_INPUT = 3 + MODE_SYNC_INPUT = 3 MODE_OUTPUT = 4 + MODE_INTERFACE = 5 - def getGamList(self, state, thread): - t = self.getTree() - gams = getattr(self, 'state_%d_thread_%d_gams' % - (state+1, thread+1)).getData() - gamNids = [] - if isinstance(gams, VECTOR): + + #Return the list (TreeNodes) of MARTe2 devices associated based on thread Node + def getThreadGamNodes(self, threadNode): + try: + gams = threadNode.getNode('GAMS').getData() + except: + return [] + return self.convertGamNodes(gams) + + + + def convertGamNodes(self, gams): + gamNodes = [] + if isinstance(gams, MDSplus.VECTOR): for i in range(gams.getNumDescs()): - currGamNid = gams.getDescAt(i) - gamNids.append(currGamNid) + currGamNode = gams.getDescAt(i) + gamNodes.append(currGamNode) else: for gam1 in gams.data(): if isinstance(gam1, str): gam = gam1 else: gam = str(gam1, 'utf_8') - currGamNid = t.getNode(gam) - gamNids.append(currGamNid) - print(gamNids) - return gamNids + currGamNode = self.getTree().getNode(gam) + gamNodes.append(currGamNode) + #Check + for currGamNode in gamNodes: + if not isinstance(currGamNode, RfxDevices.MARTE2_COMPONENT): + raise Exception('Declared node is not a MARTE2_COMPONENT: '+ currGamNode(getPath())) + gamMode = currGamNode.getNode('MODE').data() + if not (gamMode == MARTE2_SUPERVISOR.MODE_GAM or gamMode ==MARTE2_SUPERVISOR. MODE_INPUT + or gamMode == MARTE2_SUPERVISOR.MODE_SYNC_INPUT or gamMode == MARTE2_SUPERVISOR.MODE_OUTPUT): + raise Exception('Declared MARTE2 device can only be GAM, Input or Output: '+ currGamNode.getPath()) + + return gamNodes + + - def getInfo(self): + #Return the list (TreeNodes) of MARTe2 devices associated with a given thread based on threda and state idx + def getGamNodes(self, state, thread): + t = self.getTree() + try: + gams = getattr(self, 'state_%d_thread_%d_gams' % + (state+1, thread+1)).getData() + except: + return [] + return self.convertGamNodes(gams) + + #return the list (TreeNodes) of declared interfaces + def getInterfaceNodes(self): + t = self.getTree() try: - error = '' - info = {} - t = self.getTree() - numStates = self.num_states.data() - statesInfo = [] - retData = [] - retGams = [] - threadMap = {} - typeDicts = [] - - # first iteration to get threadMap - for state in range(numStates): - numThreads = getattr( - self, 'state_%d_num_threads' % (state+1)).data() - for thread in range(numThreads): - threadName = getattr( - self, 'state_%d_thread_%d_name' % (state+1, thread+1)).data() + interfaces = self.getNode('INTERFACES').getData() + except: + return [] + + interfaceNodes = [] + if isinstance(interfaces, MDSplus.VECTOR): + for i in range(interfaces.getNumDescs()): + currInterface = interfaces.getDescAt(i) + interfaceNodes.append(currInterface) + else: + for interf1 in interfaces.data(): + if isinstance(interf1, str): + interf = interf1 + else: + interf = str(interf1, 'utf_8') + currInterface = t.getNode(interf) + interfaceNodes.append(currInterface) + #Check + for currInterface in interfaceNodes: + if not isinstance(currInterface, RfxDevices.MARTE2_COMPONENT): + raise Exception('Declared node is not a MARTE2_COMPONENT: '+ currInterface(getPath())) + gamMode = currInterface.getNode('MODE').data() + if not (gamMode == MARTE2_SUPERVISOR.MODE_INTERFACE): + raise Exception('Declared MARTE2 device can only be Interface: '+ currInterface.getPath()) + return interfaceNodes + + #return the list (TreeNodes) of associated MARTE2 supervisor + def getSupervisorNodes(self): + t = self.getTree() + try: + supervisors = self.getNode('SUPERVISORS').getData() + except: + return [] + + supervisorNodes = [] + if isinstance(supervisors, MDSplus.VECTOR): + for i in range(supervisors.getNumDescs()): + currSupervisor = supervisors.getDescAt(i) + supervisorNodes.append(currSupervisor) + else: + for superv1 in supervisors.data(): + if isinstance(superv1, str): + superv = superv1 + else: + superv = str(superv1, 'utf_8') + currSupervisor = t.getNode(superv) + supervisorNodes.append(currSupervisor) + #Check + for currSupervisor in supervisorNodes: + if not isinstance(currSupervisor, MARTE2_SUPERVISOR): + raise Exception('Declared node is not a MARTE2_SUPERVISOR: '+ currSupervisor(self.getPath())) + return supervisorNodes + + #Return the target timebase reference dor DERIVED and EXT_DERIVED mode + def getExtTimebaseRef(self, timebaseMode, stateIdx, threadIdx): + if timebaseMode == 'DERIVED': + try: + refTimebaseNode = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_DEF' % (stateIdx+1, threadIdx+1)) + refThreadIdx = refTimebaseNode.data() + timebaseDef = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_DEF' % (stateIdx+1, refThreadIdx)) + except: + raise Exception('Invalid derived Thread timebase for thread in supervisor '+self.getPath()) + supervisorNode = self + elif timebaseMode == 'EXT_DERIVED': + supervisors = self.getSupervisorNodes() + if supervisors == []: + raise Exception('Supervisor list must be defined when timebase mode is EXD_DERIVED') + try: + refTimebaseNode = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_DEF' % (stateIdx+1, threadIdx+1)) + refThreadInfo = refTimebaseNode.data() + print('REF RTHREAD INFO') + print(refThreadInfo) + supervisorNode = supervisors[refThreadInfo[0]] + refThreadIdx = refThreadInfo[1] + except: + raise Exception('Invalid timebase definition for EXT_DERIVED mode. It must be an array [,]') + else: + raise Exception('Invalid timebase mode in supervisor '+self.getPath()) + try: + timebaseDef = supervisorNode.getNode('STATE_%d.THREAD_%d:TIMEBASE_DEF' % (stateIdx+1, refThreadIdx)) + except: + raise Exception('Missing Thread timebase for thread in supervisor '+self.getPath()) + return timebaseDef + + #return threadMap dictionary + # threadMap is a Dictionary with two keys: + # 'DeviceInfo': defining for every MARTe2 device NID a dictionary: + # 'ThreadName': name of the thread it belongs to + # 'SupervisorNid': NID of the supervirsor hosting the device + # 'SupervisorIp': IP address of the superisor hosting the device + # 'DevicePort': Port number foir that device + # 'ThreadInfo': defining for every thread for this supervisor a dictionary: + # 'SyncThreadName': The name of the Synchronizing thread or None if this thread is not synchronized + # 'SyncThreadSupervisor': The NID of the MARTE2 supervisor hosting the synchronizing thread or None if not synchronized + # 'SyncDiv': Frequency division from synchronizing thread or None is not synchronized + def getThreadMap(self, stateIdx): + threadMap = {} + threadInfo = {} + deviceInfo = {} + print('GET THERAD MAP') + supervisors = self.getSupervisorNodes() + print('SUPERVISORS') + print(supervisors) + supervisors.append(self) + for supervisorNode in supervisors: + print('CHECK') + print(supervisorNode) + try: + supervisorIp = supervisorNode.getNode('IP_ADDRESS').data() + except: + raise Exception('IP ADDRESS not defined foir supervisor '+ supervisorNode.getPath()) + + threadNames = [] + try: + numThreads = supervisorNode.getNode('STATE_'+str(stateIdx+1)+':NUM_THREADS') + except: + raise Exception("Missing NUM THREADS definition for supervisor "+supervisorNode.getPath()+' STATE '+str(stateIdx+1)) + for threadIdx in range(numThreads): + threadDevices = supervisorNode.getGamNodes(stateIdx, threadIdx) + if len(threadDevices) == 0: #if no components defined for this thread + continue + try: + threadName = self.getNode('STATE_%d.THREAD_%d:NAME' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Missing NAME for thread '+str(threadIdx)+' in state '+str(stateIdx)) + if threadName in threadNames: + raise Exception('Duplicated thread name: '+threadName) + threadNames.append(threadName) + for currDevice in threadDevices: + if not isinstance(currDevice, RfxDevices.MARTE2_COMPONENT): + raise Exception('Only MARTE2 devices can be declared in e thread list for supervospr '+self.getPath()) try: - gamNodes = self.getGamList(state, thread) + devicePort = currDevice.getNode('PORT').data() except: - raise Exception( - 'Cannot get GAM list for state: ' + str(state + 1) + ', thread: '+str(thread + 1)) - for currGamNode in gamNodes: - nid = currGamNode.getNid() - if nid in threadMap: - threadMap[nid] += [threadName] - else: - threadMap[nid] = [threadName] - - # Second iteration, build the remaining - for state in range(numStates): - stateInfo = {} - stateInfo['name'] = getattr( - self, 'state_%d_name' % (state+1)).data() - numThreads = getattr( - self, 'state_%d_num_threads' % (state+1)).data() - stateThreads = [] - for thread in range(numThreads): - threadInfo = {} - threadName = getattr( - self, 'state_%d_thread_%d_name' % (state+1, thread+1)).data() + devicePort = -1 + deviceNid = currDevice.getNid() + if deviceNid in deviceInfo: + raise Exception('Duplicated MARTE2 device definition: '+ currDevice.getPath()) + supervInfo = { + 'ThreadName': threadName, + 'SupervisorNid': supervisorNode.getNid(), + 'SupervisorIp': supervisorIp, + 'DevicePort': devicePort + } + deviceInfo[deviceNid] = supervInfo + + print('\nDEVICE INFO') + print(deviceInfo) + print('*****************************') + threadMap['DeviceInfo'] = deviceInfo + + for threadIdx in range(numThreads): + threadName = self.getNode('STATE_%d.THREAD_%d:NAME' % (stateIdx + 1, threadIdx + 1)).data() + threadDevices = supervisorNode.getGamNodes(stateIdx, threadIdx) + if len(threadDevices) == 0: + continue + try: + timebaseMode = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_MOD' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Missing Thread timebase mode for thread '+threadName+ ' in supervisor '+self.getPath()) + if timebaseMode == 'INTERNAL': + threadInfo[threadName] = { + 'SyncThreadName': None, + 'SyncThreadSupervisor': None, + 'SyncDiv': None, + } + elif timebaseMode == 'EXTERNAL': + threadInfo[threadName] = { + 'SyncThreadName': None, + 'SyncThreadSupervisor': None, + 'SyncDiv': None, + } + else: + timebaseDef = self.getExtTimebaseRef(timebaseMode, stateIdx, threadIdx) + if not isinstance(timebaseDef, MDSplus.TreeNode): + raise Exception('Invalid thread reference for thread '+threadName+ ' in supervisor '+self.getPath()) + supervisorNode = timebaseDef.getParent().getParent().getParent() + if not isinstance(supervisorNode, MARTE2_SUPERVISOR): + raise Exception('Invalid thread reference for thread '+threadName+' supervisor '+self.getPath()+' : '+timebaseDef.getPath()) + try: + syncThreadName = timebaseDef.getParent().getNode('NAME').data() + except: + raise Exception('Missing Thread name in supervisor '+supervisorNode.getPath()) + syncThreadSupervisor = supervisorNode.getNid() + try: + syncDiv = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_DIV' % (stateIdx+1, threadIdx+1)).getData() + except: + raise Exception('Missing timebase div for thread '+ threadName+' in supervisor '+supervisorNode.getPath()) + threadInfo[threadName] = { + 'SyncThreadName': syncThreadName, + 'SyncThreadSupervisor': syncThreadSupervisor, + 'SyncDiv': syncDiv, + } + + threadMap['ThreadInfo'] = threadInfo + + return threadMap + + #return the type of the synchronizing time + def getSynchonizationTimeTypePeriod(self, timebaseDefNode): + try: + timebaseMode = timebaseDefNode.getParent().getNode('TIMEBASE_MOD').data() + except: + raise Exception('Missing Timebase Mode for supervisor '+self.getPath()) + if timebaseMode == 'INTERNAL': + try: + frequency = timebaseDefNode.getParent().getNode('TIMEBASE_DEF').data() + except: + raise Exception('Missing frequency spec for supervisor '+self.getPath()) + return 'uint32', 1./frequency + if timebaseMode == 'EXTERNAL': + gamNodes = self.getThreadGamNodes(timebaseDefNode.getParent()) + if len(gamNodes) == 0: + raise Exception('Cannot get synchronizing device in external synchronization '+self.getPath()) + if gamNodes[0].getNode('MODE').data() != MARTE2_SUPERVISOR.MODE_SYNC_INPUT: + raise Exception('Cannot get synchronizing device in external synchronization '+self.getPath()) + try: + retType = gamNodes[0].getNode('OUTPUTS.TIME:TYPE').data() + except: + raise Exception('Cannot get time type in external synchronization '+self.getPath()) + try: + period = gamNodes[0].getNode('TIMEBASE').getData().getDescAt(2).data() + except: + raise Exception('Cannot get period external synchronization '+self.getPath()) + return retType, period + + if timebaseMode == 'EXTERNAL': + try : + timebaseRef = timebaseDefNode.getData() + except: + raise Exception('Cannot get referenced timebase in derived synchronization '+self.getPath()) + syncSupervisor = timebaseRef.getParent().getParent().getParent() + if not isinstance(syncSupervisor, MARTE2_SUPERVISOR): + raise Exception('Wrongly referenced timebase in derived synchronization '+self.getPath()) + + return syncSupervisor.getSynchonizationTimeTypePeriod(timebaseRef) + + raise Exception('Invalid timebase mode '+ timebaseMode+ ' for ' + self.getPath()) + + + #return the list of GAMs and DataSurces required to handle sychronization for the specified thread + #returns a Dictionary with fields 'TimerDDB', 'TimerType', 'TimerPeriod', 'DataSources', 'Gams' + def getSynchronizationInfo(self, stateIdx, threadIdx): + retInfo = {} + retDataSources = [] + retGams = [] + try: + timebaseMode = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_MOD' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Missing Timebase Mode for supervisor '+self.getPath()) + try: + threadName = self.getNode('STATE_%d.THREAD_%d:NAME' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Missing thread name for for supervisor '+self.getPath()) + + if timebaseMode == 'INTERNAL': + try: + frequency = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_DEF' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Missing period definition for Internal timebase mode in thread '+threadName+' supervisor '.self.getPath) + retDataSources.append( { + 'Name': threadName+'_Timer', + 'Class': 'LinuxTimer', + 'Signals': [{'Name':'Counter', 'Type': 'uint32'}, {'Name':'Time', 'Type': 'uint32'}] + }) + retDataSources.append( { + 'Name': threadName+'_TimerDDB', + 'Class': 'GAMDataSource' + }) + retGams.append( { + 'Name': threadName+'_TimerIOGAM', + 'Class': 'IOGAM', + 'Inputs': [{ + 'Name': 'Counter', + 'Type': 'uint32', + 'DataSource': threadName+'_Timer', + }, + { + 'Name': 'Time', + 'Type': 'uint32', + 'DataSource': threadName+'_Timer', + 'Frequency': frequency + }], + 'Outputs': [{ + 'Name': 'Counter', + 'Type': 'uint32', + 'DataSource': threadName+'_TimerDDB' + }, + { + 'Name': 'Time', + 'Type': 'uint32', + 'DataSource': threadName+'_TimerDDB' + }] + }) + retInfo['TimerDDB'] = threadName+'_TimerDDB' + retInfo['TimerType'] = 'uint32' + retInfo['TimerPeriod'] = 1./frequency + retInfo['DataSources'] = retDataSources + retInfo['Gams'] = retGams + return retInfo + if timebaseMode == 'EXTERNAL': + syncDevices = self.getGamNodes(stateIdx, threadIdx) + if len(syncDevices) == 0: + raise Exception('Cannot retrieve the synchronizing device for thread '+threadName+' supervisor '+self.getPath()) + syncDevice = syncDevices[0] + gamMode = syncDevice.getNode('MODE').data() + if gamMode != MARTE2_SUPERVISOR.MODE_SYNC_INPUT: + raise Exception('Only Synchronized Input can synchronize thread '+threadName+' supervisor '+self.getPath()) + #Check time definition + try: + timerType = syncDevice.getNode('OUTPUTS.TIME:TYPE').data() + except: + raise Exception('Cannot retrieve time type for thread '+threadName+' supervisor '+self.getPath()) + try: + timebase = syncDevice.getNode('TIMEBASE').getData() + except: + raise Exception('Cannot retrieve timebase for thread '+threadName+' supervisor '+self.getPath()) + if not isinstance(timebase, MDSplus.Range): + raise Exception('Timebase must be a range descriptor for thread '+threadName+' supervisor '+self.getPath()) + try: + timerPeriod = timebase.getDescAt(2).data() + except: + raise Exception('Cannot retrieve period for thread '+threadName+' supervisor '+self.getPath()) + + retInfo['TimerDDB'] = syncDevice.getMarteDeviceName(syncDevice)+'_Output_DDB' + retInfo['TimerType'] = timerType + retInfo['TimerPeriod'] = timerPeriod + retInfo['DataSources'] = [] + retInfo['Gams'] = [] + return retInfo + + if timebaseMode == 'DERIVED' or timebaseMode == 'EXT_DERIVED': + refTimebaseDef = self.getExtTimebaseRef(timebaseMode, stateIdx, threadIdx) + if not isinstance(refTimebaseDef, MDSplus.TreeNode): + raise Exception('Invalid timebase reference for thread '+threadName+' supervisor '+self.getPath()) + if not isinstance(refTimebaseDef.getParent().getParent().getParent(), MARTE2_SUPERVISOR): + raise Exception('Invalid timebase reference for thread '+threadName+' supervisor '+self.getPath()) + refSupervisor = refTimebaseDef.getParent().getParent().getParent() + try: + syncDiv = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_DIV' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Invalid timebase div for thread '+threadName+' supervisor '+self.getPath()) + + try: + refThreadName = refTimebaseDef.getParent().getNode('NAME').data() + except: + raise Exception('Cannot retrieve the name of the synchronizing thread r thread '+threadName+' supervisor '+self.getPath()) + print(refTimebaseDef) + timerType, timerPeriod = self.getSynchonizationTimeTypePeriod(refTimebaseDef) + if refSupervisor.getNid() == self.getNid(): #Thread synchronized by another thread of the same supervisor + retDataSources.append({ + 'Name': threadName+'_TimerDDB', + 'Class': 'GAMDataSource' + }) + retGams.append({ + 'Name': threadName+'_TimerGAM', + 'Class': 'PickSampleGAM', + 'Inputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': refThreadName+'_TimerSync', + 'Samples': syncDiv + }] , + 'Outputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': threadName+'_TimerDDB', + 'Samples': 1 + }] + }) + retInfo['TimerDDB'] = threadName+'_TimerDDB' + retInfo['TimerType'] = timerType + retInfo['TimerPeriod'] = timerPeriod * syncDiv + retInfo['DataSources'] = retDataSources + retInfo['Gams'] = retGams + return retInfo + else: #Synchronized on a thread from another supervisor + try: + port = self.getNode('STATE_%d.THREAD_%d:TIME_PORT' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Cannot get port number for derived timebase in '+self.getPath()) + + retDataSources.append({ + 'Name': threadName + '_SYNC_IN', + 'Class': 'RTNIn', + 'Parameters': { + 'CircuitId' : self.getNid(), + 'Port': port, + 'IsSynch': 1, + }, + 'Signals':[{ + 'Name': 'Time', + 'Type': timerType, + }] + }) + retDataSources.append({ + 'Name': threadName+'_TimerDDB', + 'Class': 'GAMDataSource' + }) + retGams.append({ + 'Name': threadName+'_TimerIOGAM', + 'Class': 'PickSampleGAM', + 'Inputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': threadName+'_SYNC_IN', + 'Samples': syncDiv + }], + 'Outputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': threadName+'_TimerDDB', + 'Samples': 1 + }] + }) + retInfo['TimerDDB'] = threadName+'_TimerDDB' + retInfo['TimerType'] = timerType + retInfo['TimerPeriod'] = timerPeriod * syncDiv + retInfo['DataSources'] = retDataSources + retInfo['Gams'] = retGams + return retInfo + raise Exception('Invalid timebase mode for '+self.getpath()) + + #check if this timebase def node is referenced by the timebaseRefNode of another thread of another supervisor + def getReferencingSupervisorsInfo(self, timebaseDefNode, stateIdx): + retIps = [] + retPorts = [] + retCircuitIds = [] + extSupervisors = self.getSupervisorNodes() + for extSupervisor in extSupervisors: + try: + supervisorIp = extSupervisor.getNode('IP_ADDRESS').data() + except: + raise Exception('Missing IP Address for superisor '+ extSupervisor.gatPath()) + try: + numThreads = extSupervisor.getNode('STATE_'+str(stateIdx+1)+':NUM_THREADS') + except: + raise Exception("Missing NUM THREADS definition for supervisor "+extSupervisor.getPath()+' STATE '+str(stateIdx+1)) + + for threadIdx in range(numThreads): + if len(extSupervisor.getGamNodes(stateIdx, threadIdx)) > 0: try: - core = getattr(self, 'state_%d_thread_%d_core' % - (state+1, thread+1)).data() - threadInfo['core'] = core + extTimebaseMode = extSupervisor.getNode('STATE_%d.THREAD_%d:TIMEBASE_MOD' % (stateIdx+1, threadIdx+1)).data() except: - pass - threadInfo['name'] = threadName - gamNames = [] - threadPeriod = 0 - gamNids = [] - gamNodes = self.getGamList(state, thread) - for currGamNode in gamNodes: - nid = currGamNode.getNid() - if currGamNode.isOn(): + raise Exception('Invalid timebase mode for supervisor '+ extSupervisor.getPath()) + if extTimebaseMode == 'DERIVED' or extTimebaseMode == 'EXT_DERIVED': + extTimebaseRef = extSupervisor.getExtTimebaseRef(extTimebaseMode, stateIdx, threadIdx) + if isinstance(extTimebaseRef, MDSplus.TreeNode) and extTimebaseRef.getNid() == timebaseDefNode.getNid(): try: - gamClass = currGamNode.getData().getDevice() - gamInstance = gamClass(currGamNode) + threadPort = extSupervisor.getNode('STATE_%d.THREAD_%d:TIME_PORT' % (stateIdx+1, threadIdx+1)).data() except: - raise Exception( - 'Cannot instantiate device for node '+currGamNode.getFullPath()) - gamList = [] - if not (currGamNode.getNid() in gamNids): - # try: - gamInstance.prepareMarteInfo() - currPeriod = gamInstance.getMarteInfo( - threadMap, retGams, retData, gamList, typeDicts) - # except: - # return 'Cannot get timebase for ' + gam, {},{} - gamNids.append(currGamNode.getNid()) - # if currPeriod > 0 and threadPeriod > 0: - if currPeriod > 0 and threadPeriod > 0 and currPeriod != threadPeriod: - raise Exception('More than one component driving thread timing for state: '+str( - state+1)+', thread: '+str(thread+1)) - else: - if currPeriod > 0: - threadPeriod = currPeriod - else: - dummyGams = [] - dummyData = [] - gamInstance.getMarteInfo( - threadMap, dummyGams, dummyData, gamList, typeDicts) - gamNames += gamList -# TIMINGS - if threadPeriod == 0: - raise Exception( - 'No component driving thread timing for state: '+str(state+1)+', thread: '+str(thread+1)) - gamList = [] - self.getTimingInfo( - state, thread, threadPeriod, retGams, retData, gamList) - gamNames += gamList -############################# - - threadInfo['gams'] = gamNames - stateThreads.append(threadInfo) - stateInfo['threads'] = stateThreads - statesInfo.append(stateInfo) - info['states'] = statesInfo - - info['gams'] = retGams - info['data_sources'] = retData - info['name'] = self.getNode('name').data() - return error, info, threadMap, typeDicts - except Exception as inst: - print(traceback.format_exc()) - # return inst.args[0], None, None - return str(inst), None, None, None - - -# Enrich GAMs and Data Sources with what is required to store timing information (IOGAM + TreeWriter) is seg_len > 0 - - def getTimingInfo(self, state, thread, threadPeriod, retGams, dataSources, gamList): + raise Exception('Missing port for derived timebase mode in '+ extSupervisor.getPath()) + retIps.append(supervisorIp) + retPorts.append(threadPort) + retCircuitIds.append(extSupervisor.getNid()) + return { + 'Ips': retIps, + 'Ports': retPorts, + 'CircuitIds': retCircuitIds + } + + #Convert the passed lits into a MARTe array + def toMarteArray(self, list): + marteArr = '{' + for l in list: + marteArr += ' '+str(l)+' ' + marteArr += '}' + return marteArr + + + #Check if this thread is referenced by another thread of the same supervisor + def isReferencedByAnotherThreadSameSupervisor(self, timebaseDefNode, stateIdx): + try: + numThreads = self.getNode('STATE_'+str(stateIdx+1)+':NUM_THREADS') + except: + raise Exception("Missing NUM THREADS definition for supervisor "+self.getPath()+' STATE '+str(stateIdx+1)) + + for threadIdx in range(numThreads): + if len(self.getGamNodes(stateIdx, threadIdx)) > 0: + try: + extTimebaseMode = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_MOD' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Invalid timebase mode for supervisor '+ self.getPath()) + if extTimebaseMode == 'DERIVED' or extTimebaseMode == 'EXT_DERIVED': + extTimebaseRef = self.getExtTimebaseRef(extTimebaseMode, stateIdx, threadIdx) + if isinstance(extTimebaseRef, MDSplus.TreeNode) and extTimebaseRef.getNid() == timebaseDefNode.getNid(): + return True + return False + + + + #return DataSource and Gam Dict lists (possibly empty) to be added after synchornization has ben establisher + #before any device of the thread if INTERNAL or DERIVED or after the first SyncInput device for EXTERNAL + def getPostSynchronizationInfo(self, stateIdx, threadIdx, timerType, timerDDB): + retGams = [] + retDataSources = [] + try: + threadName = self.getNode('STATE_%d.THREAD_%d:NAME' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception('Missing thread name for for supervisor '+self.getPath()) + timebaseDefNode = self.getNode('STATE_%d.THREAD_%d:TIMEBASE_DEF' % (stateIdx+1, threadIdx+1)) + if self.isReferencedByAnotherThreadSameSupervisor(timebaseDefNode, stateIdx): + retDataSources.append({ + 'Name': threadName+'_TimerSync', + 'Class': 'RealTimeThreadSynchronisation', + }) + retGams.append({ + 'Name': threadName+'TimerSync_IOGAM', + 'Class': 'IOGAM', + 'Inputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': timerDDB + }], + 'Outputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': threadName+'_TimerSync' + }] + }) + retInfo = self.getReferencingSupervisorsInfo(timebaseDefNode, stateIdx) + if len(retInfo['Ips']) > 0: + retDataSources.append({ + 'Name': threadName+'RTN_OUT', + 'Class': 'RTNOut', + 'Signals':[{ + 'Name':'Time', + 'Type': timerType, + 'Ip' : self.toMarteArray(retInfo['Ips']), + 'Port': self.toMarteArray(retInfo['Ports']) , + 'CircuitId': self.toMarteArray(retInfo['CircuitIds']) + }] + }) + retGams.append({ + 'Name': threadName+'RTN_OUT_IOGAM', + 'Class': 'IOGAM', + 'Inputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': timerDDB + }], + 'Outputs': [{ + 'Name': 'Time', + 'Type': timerType, + 'DataSource': threadName+'RTN_OUT' + }] + }) + return retDataSources, retGams + + #return the list of DataSources and GAMs and the types dict corresponding (in a dictionary) to the given thread in the given state + def getThreadInfo(self, threadMap, typesDict, stateIdx, threadIdx): + deviceNodes = self.getGamNodes(stateIdx, threadIdx) + if len(deviceNodes) == 0: + return [],[] + retSyncInfo = self.getSynchronizationInfo(stateIdx, threadIdx) + dataSources = retSyncInfo['DataSources'] + gams = retSyncInfo['Gams'] + if deviceNodes[0].getNode('MODE').data == MARTE2_SUPERVISOR.MODE_SYNC_INPUT: + currDataSources, gurrGams = deviceNodes[0].generateMarteConfiguration(threadMap, retSyncInfo['TimerDDB'], + retSyncInfo['TimerType'], retSyncInfo['TimerPeriod'], typesDict) + dataSources += (currDataSources) + gams += currGams + postSyncDataSources, postSyncGams = self.getPostSynchronizationInfo(stateIdx, threadIdx, + retSyncInfo['TimerType'], retSyncInfo['TimerDDB']) + dataSources += currDataSources + gams += currGams + for deviceIdx in range(1, len(deviceNodes)): + currDataSources, gurrGams = deviceNodes[deviceIdx].generateMarteConfiguration(threadMap, retSyncInfo['TimerDDB'], + retSyncInfo['TimerType'], retSyncInfo['TimerPeriod'], typesDict) + dataSources += currDataSources + gams += currGams + else: #thread not synchronized by synch input device + postSyncDataSources, postSyncGams = self.getPostSynchronizationInfo(stateIdx, threadIdx, + retSyncInfo['TimerType'], retSyncInfo['TimerDDB']) + dataSources += postSyncDataSources + gams += postSyncGams + for deviceIdx in range(0, len(deviceNodes)): + currDataSources, currGams = deviceNodes[deviceIdx].generateMarteConfiguration(threadMap, retSyncInfo['TimerDDB'], + retSyncInfo['TimerType'], retSyncInfo['TimerPeriod'], typesDict) + dataSources += currDataSources + gams += currGams + + #handle recording of timing information + timingDataSource, timingGam = self.getTimingInfo(stateIdx, threadIdx, retSyncInfo['TimerPeriod']) + if timingDataSource != None: + dataSources.append(timingDataSource) + gams.append(timingGam) + + + return dataSources, gams + + #call prepareMarteInfo method for all involved MARTE2 devic + def prepareStateInfo(self, stateIdx): + try: + numThreads = self.getNode('STATE_'+str(stateIdx+1)+':NUM_THREADS') + except: + raise Exception("Missing NUM THREADS definition for supervisor "+self.getPath()+' STATE '+str(stateIdx+1)) + for threadIdx in range(numThreads): + marte2Devices = self.getGamNodes(stateIdx, threadIdx) + for marte2Device in marte2Devices: + marte2Device.prepareMarteInfo() + + #return gams, DataSources and threadGams dict for a given state + def getStateInfo(self, typesDict, stateIdx): + threadMap = self.getThreadMap(stateIdx) + dataSources = [] + gams = [] + threadGamsDict = {} + try: + numThreads = self.getNode('STATE_'+str(stateIdx+1)+':NUM_THREADS') + except: + raise Exception("Missing NUM THREADS definition for supervisor "+self.getPath()+' STATE '+str(stateIdx+1)) + for threadIdx in range(numThreads): + try: + currThreadName = self.getNode('STATE_%d.THREAD_%d:NAME' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception("Missing name of thread "+str(threadIdx+1)+' state: '+str(stateIdx+1)) + + try: + threadCpu = self.getNode('STATE_%d.THREAD_%d:CORE' % (stateIdx+1, threadIdx+1)).data() + except: + raise Exception("Missing CPU mask of thread "+str(threadIdx+1)+' state: '+str(stateIdx+1)) + currDataSources, currGams = self.getThreadInfo(threadMap, typesDict, stateIdx, threadIdx) + if len(currGams) == 0: + continue + gamNames = [] + for currGam in currGams: + gamNames.append(currGam['Name']) + gams += currGams + dataSources += currDataSources + threadGamsDict[currThreadName] = {'GamNames':gamNames, 'CpuMask': threadCpu} + + return { + 'DataSources': dataSources, + 'Gams': gams, + 'ThreadGamsDict': threadGamsDict + } + + + #return GAM and DataSource for handling the recording of execution times for this thread + def getTimingInfo(self, stateIdx, threadIdx, threadPeriod): segLen = getattr(self, 'times_state_%d_thread_%d_seg_len' % - (state+1, thread+1)).data() + (stateIdx+1, threadIdx+1)).data() if(segLen == 0): - return - stateName = getattr(self, 'state_%d_name' % (state+1)).data() + return None, None + + stateName = getattr(self, 'state_%d_name' % (stateIdx+1)).data() threadName = getattr(self, 'state_%d_thread_%d_name' % - (state+1, thread+1)).data() + (stateIdx+1, threadIdx+1)).data() cpuMask = getattr(self, 'times_state_%d_thread_%d_cpu_mask' % - (state+1, thread+1)).data() + (stateIdx+1, threadIdx+1)).data() timeSignals = [] - gamNodes = self.getGamList(state, thread) - for currGamNid in gamNodes: - if currGamNid.isOn(): - gamName = currGamNid.getNodeName() - gamClass = currGamNid.getData().getDevice() - gamInstance = gamClass(currGamNid) - gamMode = gamInstance.mode.data() - if gamMode == MARTE2_SUPERVISOR.MODE_GAM: - timeSignals.append(gamName+'_ReadTime') - timeSignals.append(gamName+'_ExecTime') - elif gamMode == MARTE2_SUPERVISOR.MODE_OUTPUT: - timeSignals.append(gamName+'_IOGAM_WriteTime') - else: - timeSignals.append(gamName+'_DDBOutIOGAM_ReadTime') + gamNodes = self.getGamNodes(stateIdx, threadIdx) + for gamNode in gamNodes: + gamName = gamNode.getMarteDeviceName() + gamMode = gamNode.getData('MODE').getDevice() + if gamMode == MARTE2_SUPERVISOR.MODE_GAM: + timeSignals.append(gamName+'_ReadTime') + timeSignals.append(gamName+'_ExecTime') + elif gamMode == MARTE2_SUPERVISOR.MODE_OUTPUT: + timeSignals.append(gamName+'_IOGAM_WriteTime') + else: + timeSignals.append(gamName+'_DDBOutIOGAM_ReadTime') if len(timeSignals) == 0: - return - currGam = '+State_%d_Thread_%d_TIMES_IOGAM = {\n' % (state+1, thread+1) - currGam += ' Class = IOGAM\n' - currGam += ' InputSignals = {\n' - currGam += ' '+stateName+'_'+threadName+'_CycleTime = {\n' - currGam += ' Alias = '+stateName+'.'+threadName+'_CycleTime\n' - currGam += ' DataSource = Timings\n' - currGam += ' Type = uint32\n' - currGam += ' }\n' - + return None, None + + retGam = {} + retGam['Name'] = 'State_%d_Thread_%d_TIMES_IOGAM'%(stateIdx+1, threadIdx+1) + retGam['Class'] = 'IOGAM' + gamInputs = [] + gamInputs.append({ + 'Name': stateName+'_'+threadName+'_CycleTime', + 'Alias': stateName+'.'+threadName+'_CycleTime', + 'DataSource': 'Timings', + 'Type': 'uint32' + }) for timeSignal in timeSignals: - currGam += ' '+timeSignal+' = {\n' - currGam += ' DataSource = Timings\n' - currGam += ' Type = uint32\n' - currGam += ' }\n' - currGam += ' }\n' - currGam += ' OutputSignals = {\n' - currGam += ' CycleTime = {\n' - currGam += ' DataSource = State_%d_Thread_%d_TIMES_WRITER\n' % ( - state+1, thread+1) - currGam += ' Type = uint32\n' - currGam += ' }\n' + gamInputs.append({ + 'Name': timeSignal, + 'DataSource': 'Timings', + 'Type': 'uint32' + }) + retGam['Inputs'] = gamInputs + gamOutputs = [] + gamOutputs.append({ + 'Name': 'CycleTime', + 'DataSource': 'State_%d_Thread_%d_TIMES_WRITER\n' % (stateIdx+1, threadIdx+1), + 'Type': 'uint32' + }) for timeSignal in timeSignals: - currGam += ' '+timeSignal+' = {\n' - currGam += ' DataSource = State_%d_Thread_%d_TIMES_WRITER\n' % ( - state+1, thread+1) - currGam += ' Type = uint32\n' - currGam += ' }\n' - currGam += ' }\n' - currGam += '}\n' - - retGams.append(currGam) - gamList.append('State_%d_Thread_%d_TIMES_IOGAM' % (state+1, thread+1)) - - dataSource = ' +State_%d_Thread_%d_TIMES_WRITER = {\n' % ( - state+1, thread+1) - dataSource += ' Class = MDSWriter\n' - dataSource += ' NumberOfBuffers = 20000\n' - dataSource += ' CPUMask = ' + str(cpuMask)+'\n' - dataSource += ' StackSize = 10000000\n' - dataSource += ' TreeName = "'+self.getTree().name+'"\n' - dataSource += ' PulseNumber = '+str(self.getTree().shot)+'\n' - dataSource += ' StoreOnTrigger = 0\n' - dataSource += ' TimeRefresh = 1\n' - dataSource += ' EventName = "'+gamName+'UpdatejScope"\n' - dataSource += ' Signals = {\n' - dataSource += ' CycleTime = {\n' - dataSource += ' NodeName = "' + \ - getattr(self, 'times_state_%d_thread_%d_cycle' % - (state+1, thread+1)).getFullPath()+'"\n' - dataSource += ' Period = '+str(threadPeriod) + '\n' - dataSource += ' MakeSegmentAfterNWrites = '+str(segLen)+'\n' - dataSource += ' AutomaticSegmentation = 0\n' - dataSource += ' }\n' + gamOutputs.append({ + 'Name': timeSignal, + 'DataSource': 'State_%d_Thread_%d_TIMES_WRITER\n' % (stateIdx+1, threadIdx+1), + 'Type': 'uint32' + }) + retGam['Outputs'] = gamOutputs + retDataSource = {} + retDataSource['Name'] = 'State_%d_Thread_%d_TIMES_WRITER' % (stateIdx+1, threadIdx+1) + retDataSource['Class'] = 'MDSWriter' + retDataSource['Parameters'] = { + 'CPUMask': cpuMask, + 'NumberOfBuffers' : 20000, + 'StackSize': 1000000, + 'TreeName': self.getTree().name, + 'PulseNumber': self.getTree().shot, + 'StoreOnTrigger': 0, + 'TimeRefresh': 5, + 'EventName': 'UpdateTimes', + } + retSignals = [] + retSignals.append({ + 'Name': 'CycleTime', + 'Parameters': { + 'NodeName': getattr(self, 'times_state_%d_thread_%d_cycle' % (stateIdx+1, threadIdx+1)).getFullPath(), + 'Period': threadPeriod, + 'MakeSegmentAfterNWrites': segLen, + 'AutomaticSegmentation' : 0, + 'DiscontinuityFactor': 10 + } + }) sigIdx = 1 for timeSignal in timeSignals: - dataSource += ' '+timeSignal + ' = {\n' - dataSource += ' NodeName = "' + \ - getattr(self, 'times_state_%d_thread_%d_gam' % - (state+1, thread+1)+str(sigIdx)).getFullPath()+'"\n' - dataSource += ' Period = '+str(threadPeriod) + '\n' - dataSource += ' MakeSegmentAfterNWrites = '+str(segLen)+'\n' - dataSource += ' AutomaticSegmentation = 0\n' - dataSource += ' }\n' - sigIdx = sigIdx + 1 - dataSource += ' }\n' - dataSource += ' }\n' - dataSources.append(dataSource) - - def declareTypes(self, typeDicts): - if len(typeDicts) == 0: + retSignals.append({ + 'Name': timeSignal, + 'NodeName': getattr(self, 'times_state_%d_thread_%d_gam' % (stateIdx+1, threadIdx+1)+str(sigIdx)).getFullPath(), + 'Period': threadPeriod, + 'MakeSegmentAfterNWrites': segLen, + 'AutomaticSegmentation' : 0, + 'DiscontinuityFactor': 10 + }) + + retDataSource['Signals'] = retSignals + return retDataSource, retGam + + + #return as a dict the underlying MARTe2 configuration. The fields ot the returned dict are: + #'DataSources': list of all DataSources + #'Gams': list of all GAMs + #'TypeDict': Type dictionary + #'States': for each declared state a dictionary specifying for each thread of that stets the list of associated GAMs + #'Interfaces': list of declared interfaces + def getMarte2ConfigInfo(self): + typesDict = {} + dataSources = [] + gams = [] + stateDict = {} + try: + numStates = self.getNode('NUM_STATES') + except: + raise Exception("Missing NUM STATES definition for supervisor "+self.getPath()) + for stateIdx in range(numStates): + try: + currStateName = self.getNode('STATE_%d:NAME' % (stateIdx + 1)).data() + except: + raise Exception('Missing name of state '+str(stateIdx+1)) + + self.prepareStateInfo(stateIdx) + currStateDict = self.getStateInfo(typesDict, stateIdx) + dataSources += (currStateDict['DataSources']) + gams += (currStateDict['Gams']) + stateDict[currStateName] = currStateDict['ThreadGamsDict'] + + interfaces = [] + interfaceNodes = self.getInterfaceNodes() + for interfaceNode in interfaceNodes: + interfaces.append(interfaceNode.generateMarteInterfaceConfiguration()) + + return { + 'TypesDict': typesDict, + 'DataSources': dataSources, + 'Gams': gams, + 'Interfaces': interfaces, + 'StateDict': stateDict + } + + def skipTabs(self, tabCount): + tabs = '' + for tabIdx in range(tabCount): + tabs += '\t' + return tabs + + def expandTypes(self, typesDict): + if len(typesDict) == 0: return '' - typeDecl = '+Types = {\n' - typeDecl += ' Class = ReferenceContainer\n' - for typeDict in typeDicts: - typeDecl += ' +'+typeDict['name'] + ' = {\n' - typeDecl += ' Class = IntrospectionStructure\n' - for fieldDict in typeDict['fields']: - typeDecl += ' '+fieldDict['name'] + ' = {\n' - typeDecl += ' Type = '+fieldDict['type']+'\n' - dimensions = fieldDict['dimensions'] - if dimensions == 0: - numberOfElements = 1 - numberOfDimensions = 0 + typeConf = ''' ++Types = { + Class = ReferenceContainer +''' + for typeKey in typesDict: + typeConf += '\t+' + typeKey + ' = {\n\t\tClass = IntrospectionStructure\n' + for typeField in typesDict[typeKey]: + typeConf += '\t\t'+typeField['Name']+ ' = {\n' + typeConf += '\t\t\tType = '+typeField['Type']+'\n' + typeConf += '\t\t\tNumberOfElements = '+str(typeField['NumberOfElements'])+'\n\t\t}\n' + typeConf += '\t}\n' + typeConf += '}\n' + return typeConf + + def getParamType(self, value): #Converty MDSplus type to MARTe2 type + if isinstance(value, int): + return 'int32' + if value.dtype == np.int8: + return 'int8' + if value.dtype == np.int16: + return 'int16' + if value.dtype == np.int32: + return 'int32' + if value.dtype == np.int64: + return 'int64' + if value.dtype == np.float32: + return 'float32' + if value.dtype == np.float64: + return 'float64' + + def expandParameters(self, paramDict, tabCount): + paramConf = '' + for paramKey in paramDict: + if isinstance(paramDict[paramKey], dict): + paramConf += self.skipTabs(tabCount)+paramKey+' = {\n' + paramConf += self.expandParameters(paramDict[paramKey], tabCount+1) + paramConf += self.skipTabs(tabCount)+'}\n' + else: + if isinstance(paramDict[paramKey], str): + paramConf += self.skipTabs(tabCount)+paramKey+' = \"'+str(paramDict[paramKey])+'\"\n' else: - numberOfDimensions = len(fieldDict['dimensions']) - numberOfElements = 1 - for currDim in fieldDict['dimensions']: - numberOfElements *= currDim - typeDecl += ' NumberOfDimensions = ' + \ - str(numberOfDimensions)+'\n' - typeDecl += ' NumberOfElements = ' + \ - str(numberOfElements)+'\n' - typeDecl += ' }\n' - typeDecl += ' }\n' - typeDecl += '}\n' - return typeDecl + currValue = str(paramDict[paramKey]) + currValue = currValue.replace('[', '{') + currValue = currValue.replace(']', '}') + paramConf += self.skipTabs(tabCount)+paramKey+' = ('+self.getParamType(paramDict[paramKey])+')'+currValue+'\n' + return paramConf - def buildConfiguration(self): - print('START BUILD') - error, info, threadMap, typeDicts = self.getInfo() - if error != '': - return 0 - confText = self.declareTypes(typeDicts) - confText += '+MDS_EVENTS = {\n' - confText += ' Class = MDSEventManager\n' - confText += ' StackSize = 1048576\n' - confText += ' CPUs = 0x1\n' - confText += ' Name = '+info['name']+'\n' - confText += '}\n' - confText += '+WebRoot = {\n' - confText += ' Class = HttpObjectBrowser\n' - confText += ' Root = "."\n' - confText += ' +ObjectBrowse = {\n' - confText += ' Class = HttpObjectBrowser\n' - confText += ' Root = "/"\n' - confText += ' }\n' - confText += ' +ResourcesHtml = {\n' - confText += ' Class = HttpDirectoryResource\n' - confText += ' BaseDir = "/opt/MARTe2/MARTe2/Resources/HTTP/"\n' - confText += ' } \n' - confText += '}\n' - confText += '+WebServer = {\n' - confText += ' Class = HttpService\n' - confText += ' Port = 8085\n' - confText += ' WebRoot = WebRoot\n' - confText += ' Timeout = 0\n' - confText += ' ListenMaxConnections = 255\n' - confText += ' AcceptTimeout = 1000\n' - confText += ' MaxNumberOfThreads = 8\n' - confText += ' MinNumberOfThreads = 1\n' - confText += '} \n' - - confText += ' +StateMachine = {\n' - confText += ' Class = StateMachine\n' - confText += ' +INITIAL = {\n' - confText += ' Class = ReferenceContainer \n' - confText += ' +START = {\n' - confText += ' Class = StateMachineEvent\n' - confText += ' NextState = "IDLE"\n' - confText += ' NextStateError = "IDLE"\n' - confText += ' Timeout = 0\n' - confText += ' +StartHttpServer = {\n' - confText += ' Class = Message\n' - confText += ' Destination = "WebServer"\n' - confText += ' Function = "Start"\n' - confText += ' } \n' - confText += ' +ChangeToStateIdleMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = PrepareNextState\n' - confText += ' +Parameters = {\n' - confText += ' Class = ConfigurationDatabase\n' - confText += ' param1 = Idle\n' - confText += ' }\n' - confText += ' }\n' - confText += ' +StartNextStateExecutionMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = StartNextStateExecution\n' - confText += ' }\n' - confText += ' }\n' - confText += ' }\n' - confText += ' +IDLE = {\n' - confText += ' Class = ReferenceContainer\n' - confText += ' +GOTORUN = {\n' - confText += ' Class = StateMachineEvent\n' - confText += ' NextState = "RUN"\n' - confText += ' NextStateError = "IDLE"\n' - confText += ' Timeout = 0 \n' - confText += ' +ChangeToRunMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = PrepareNextState\n' - confText += ' +Parameters = {\n' - confText += ' Class = ConfigurationDatabase\n' - confText += ' param1 = ' + \ - info['states'][0]['name']+'\n' - confText += ' }\n' - confText += ' }\n' - confText += ' +StopCurrentStateExecutionMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = StopCurrentStateExecution\n' - confText += ' }\n' - confText += ' +StartNextStateExecutionMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = StartNextStateExecution\n' - confText += ' }\n' - confText += ' }\n' - confText += ' }\n' - confText += ' +RUN = {\n' - confText += ' Class = ReferenceContainer\n' - confText += ' +GOTOIDLE = {\n' - confText += ' Class = StateMachineEvent\n' - confText += ' NextState = "IDLE"\n' - confText += ' NextStateError = "IDLE"\n' - confText += ' Timeout = 0 \n' - confText += ' +ChangeToIdleMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = PrepareNextState\n' - confText += ' +Parameters = {\n' - confText += ' Class = ConfigurationDatabase\n' - confText += ' param1 = Idle\n' - confText += ' }\n' - confText += ' }\n' - confText += ' +StopCurrentStateExecutionMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = StopCurrentStateExecution\n' - confText += ' }\n' - confText += ' +StartNextStateExecutionMsg = {\n' - confText += ' Class = Message\n' - confText += ' Destination = '+info['name']+'\n' - confText += ' Function = StartNextStateExecution\n' - confText += ' }\n' - confText += ' } \n' - confText += ' }\n' - confText += '} \n' - - confText += '$'+info['name']+' = {\n' - confText += ' Class = RealTimeApplication\n' - confText += ' +Functions = {\n' - confText += ' Class = ReferenceContainer\n' - confText += ' +IDLE_MDSPLUS = {\n' - confText += ' Class = IOGAM\n' - confText += ' InputSignals = {\n' - confText += ' Counter = {\n' - confText += ' DataSource = IDLE_MDSPLUS_TIMER\n' - confText += ' Type = uint32\n' - confText += ' NumberOfElements = 1\n' - confText += ' }\n' - confText += ' Time = {\n' - confText += ' DataSource = IDLE_MDSPLUS_TIMER\n' - confText += ' Type = uint32\n' - confText += ' NumberOfElements = 1\n' - confText += ' Frequency = 10\n' - confText += ' }\n' - confText += ' }\n' - confText += ' OutputSignals = {\n' - confText += ' Counter = {\n' - confText += ' DataSource = IDLE_MDSPLUS_DDB\n' - confText += ' Type = uint32\n' - confText += ' }\n' - confText += ' Time = {\n' - confText += ' DataSource = IDLE_MDSPLUS_DDB\n' - confText += ' Type = uint32\n' - confText += ' NumberOfElements = 1\n' - confText += ' }\n' - confText += ' }\n' - confText += ' }\n' - - for gam in info['gams']: - confText += gam - confText += ' }\n' - confText += ' +Data = {\n' - confText += ' Class = ReferenceContainer\n' - confText += ' +IDLE_MDSPLUS_TIMER = {\n' - confText += ' Class = LinuxTimer\n' - confText += ' SleepNature = "Busy"\n' - confText += ' Signals = {\n' - confText += ' Counter = {\n' - confText += ' Type = uint32\n' - confText += ' }\n' - confText += ' Time = {\n' - confText += ' Type = uint32\n' - confText += ' }\n' - confText += ' }\n' - confText += ' }\n' - confText += ' +IDLE_MDSPLUS_DDB = {\n' - confText += ' Class = GAMDataSource\n' - confText += ' }\n' - confText += ' +Timings = {\n' - confText += ' Class = TimingDataSource\n' - confText += ' }\n' - - for dataSource in info['data_sources']: - confText += dataSource - confText += ' }\n' - - confText += ' +States = {\n' - confText += ' Class = ReferenceContainer\n' - confText += ' +Idle = {\n' - confText += ' Class = RealTimeState\n' - confText += ' +Threads = {\n' - confText += ' Class = ReferenceContainer\n' - confText += ' +Thread1 = {\n' - confText += ' Class = RealTimeThread\n' - confText += ' Functions = {IDLE_MDSPLUS}\n' - confText += ' }\n' - confText += ' }\n' - confText += ' }\n' - - for state in info['states']: - confText += ' +'+state['name'] + ' = {\n' - confText += ' Class = RealTimeState\n' - confText += ' +Threads = {\n' - confText += ' Class = ReferenceContainer\n' - for thread in state['threads']: - confText += ' +'+thread['name']+' = {\n' - confText += ' Class = RealTimeThread\n' - if 'core' in thread: - confText += ' CPUs = '+str(thread['core'])+'\n' - functionStr = '' - for gamName in thread['gams']: - functionStr += gamName + ' ' - confText += ' Functions = {'+functionStr+'}\n' - confText += ' }\n' - confText += ' }\n' - confText += ' }\n' - confText += ' }\n' - confText += ' +Scheduler = {\n' - confText += ' Class = GAMScheduler\n' - confText += ' TimingDataSource = Timings\n' - confText += ' }\n' - confText += '}\n' - print (confText) + def expandInterfaces(self, interfaces): + interfaceConf = '' + for interface in interfaces: + interfaceConf += '+'+interface['Name']+' = {\n\tClass = '+interface['Class']+'\n' + interfaceConf += self.expandParameters(interface['Parameters'], 1) + interfaceConf += '}\n' + return interfaceConf + + def expandGams(self, gams): + gamConf = '' + for gam in gams: + gamConf += '\t\t\t+'+gam['Name']+' = {\n' + gamConf += '\t\t\t\tClass = '+gam['Class']+'\n' + if 'Parameters' in gam: + gamConf += self.expandParameters(gam['Parameters'], 4) + if 'Inputs' in gam: + gamConf += '\t\t\t\tInputSignals = {\n' + for inSig in gam['Inputs']: + gamConf += '\t\t\t\t\t'+inSig['Name']+ ' = {\n' + for inSigKey in inSig: + if inSigKey == 'Name': + continue + if inSigKey == 'Parameters': + gamConf += self.expandParameters(inSig['Parameters'], 6) + else: + gamConf += '\t\t\t\t\t\t'+inSigKey+' = '+str(inSig[inSigKey])+'\n' + gamConf += '\t\t\t\t\t}\n' + gamConf += '\t\t\t\t}\n' + if 'Outputs' in gam: + gamConf += '\t\t\t\tOutputSignals = {\n' + for outSig in gam['Outputs']: + gamConf += '\t\t\t\t\t'+outSig['Name']+ ' = {\n' + for outSigKey in outSig: + if outSigKey == 'Name': + continue + if outSigKey == 'Parameters': + gamConf += self.expandParameters(outSig['Parameters'], 6) + else: + gamConf += '\t\t\t\t\t\t'+outSigKey+' = '+str(outSig[outSigKey])+'\n' + gamConf += '\t\t\t\t\t}\n' + gamConf += '\t\t\t\t}\n' + gamConf += '\t\t\t}\n' + return gamConf + + def expandDataSources(self, dataSources): + dsConf = '' + for dataSource in dataSources: + dsConf += '\t\t\t+'+dataSource['Name']+' = {\n' + dsConf += '\t\t\t\tClass = '+dataSource['Class']+'\n' + if 'Parameters' in dataSource: + dsConf += self.expandParameters(dataSource['Parameters'], 4) + if 'Signals' in dataSource and len(dataSource['Signals']) > 0: + dsConf += '\t\t\t\tSignals = {\n' + if 'Signals' in dataSource: + for inSig in dataSource['Signals']: + dsConf += '\t\t\t\t\t'+inSig['Name']+ ' = {\n' + for inSigKey in inSig: + if inSigKey == 'Name': + continue + if inSigKey == 'Parameters': + dsConf += self.expandParameters(inSig['Parameters'], 6) + else: + dsConf += '\t\t\t\t\t\t'+inSigKey+' = '+str(inSig[inSigKey])+'\n' + dsConf += '\t\t\t\t\t}\n' + dsConf += '\t\t\t\t}\n' + dsConf += '\t\t\t}\n' + return dsConf + + def expandStates(self, statesDict): + stateConf = '' + for stateKey in statesDict: + stateConf += '\t\t\t+'+stateKey+' = {\n' + stateConf += '\t\t\t\tClass = RealTimeState\n' + stateConf += '\t\t\t\t+Threads = {\n' + stateConf += '\t\t\t\t\tClass = ReferenceContainer\n' + for threadKey in statesDict[stateKey]: + stateConf += '\t\t\t\t\t+'+threadKey+' = {\n' + stateConf += '\t\t\t\t\t\tClass = RealTimeThread\n' + stateConf += '\t\t\t\t\t\tCPUs = '+str(statesDict[stateKey][threadKey]['CpuMask'])+'\n' + stateConf += '\t\t\t\t\t\tFunctions = {' + for gamName in statesDict[stateKey][threadKey]['GamNames']: + stateConf += ' '+gamName+' ' + stateConf += '}\n' + stateConf += '\t\t\t\t\t}\n' + stateConf += '\t\t\t\t}\n' + stateConf += '\t\t\t}\n' + return stateConf + + def generateConfiguration(self): + try: + appName = self.getNode('NAME').data() + except: + raise Exception('Missing application name for '+self.getPath()) try: - os.system('mv /tmp/'+info['name']+'_marte_configuration.cfg '+'/tmp/'+info['name']+'_marte_configuration_OLD.cfg ') + firstStateName = self.getNode('STATE_1:NAME').data() except: - pass - f = open('/tmp/'+info['name']+'_marte_configuration.cfg', 'w') - self.marte_config.putData(Uint8Array(bytearray(confText.encode()))) - f.write(confText) + raise Exception('Missing first state name for '+self.getPath()) + outConfig = ''' + ++MDS_EVENTS = { + Class = MDSEventManager + StackSize = 1048576 + CPUs = 0x1 + Name = +} +/* +WebRoot = { + Class = HttpObjectBrowser + Root = "." + +ObjectBrowse = { + Class = HttpObjectBrowser + Root = "/" + } + +ResourcesHtml = { + Class = HttpDirectoryResource + BaseDir = "/opt/MARTe2/MARTe2/Resources/HTTP/" + } +} ++WebServer = { + Class = HttpService + Port = 8085 + WebRoot = WebRoot + Timeout = 0 + ListenMaxConnections = 255 + AcceptTimeout = 1000 + MaxNumberOfThreads = 8 + MinNumberOfThreads = 1 +} */ + ++StateMachine = { + Class = StateMachine + +INITIAL = { + Class = ReferenceContainer + +START = { + Class = StateMachineEvent + NextState = "IDLE" + NextStateError = "IDLE" + Timeout = 0 + +StartHttpServer = { + Class = Message + Destination = "WebServer" + Function = "Start" + } + +ChangeToStateIdleMsg = { + Class = Message + Destination = + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Idle + } + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = + Function = StartNextStateExecution + } + } + } + +IDLE = { + Class = ReferenceContainer + +GOTORUN = { + Class = StateMachineEvent + NextState = "RUN" + NextStateError = "IDLE" + Timeout = 0 + +ChangeToRunMsg = { + Class = Message + Destination = + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = + } + } + +StopCurrentStateExecutionMsg = { + Class = Message + Destination = + Function = StopCurrentStateExecution + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = + Function = StartNextStateExecution + } + } + } + +RUN = { + Class = ReferenceContainer + +GOTOIDLE = { + Class = StateMachineEvent + NextState = "IDLE" + NextStateError = "IDLE" + Timeout = 0 + +ChangeToIdleMsg = { + Class = Message + Destination = + Function = PrepareNextState + +Parameters = { + Class = ConfigurationDatabase + param1 = Idle + } + } + +StopCurrentStateExecutionMsg = { + Class = Message + Destination = + Function = StopCurrentStateExecution + } + +StartNextStateExecutionMsg = { + Class = Message + Destination = + Function = StartNextStateExecution + } + } + } +} +$ = { + Class = RealTimeApplication + +Functions = { + Class = ReferenceContainer + +IDLE_MDSPLUS = { + Class = IOGAM + InputSignals = { + Counter = { + DataSource = IDLE_MDSPLUS_TIMER + Type = uint32 + NumberOfElements = 1 + } + Time = { + DataSource = IDLE_MDSPLUS_TIMER + Type = uint32 + NumberOfElements = 1 + Frequency = 10 + } + } + OutputSignals = { + Counter = { + DataSource = IDLE_MDSPLUS_DDB + Type = uint32 + } + Time = { + DataSource = IDLE_MDSPLUS_DDB + Type = uint32 + NumberOfElements = 1 + } + } + } + + } + +Data = { + Class = ReferenceContainer + +IDLE_MDSPLUS_TIMER = { + Class = LinuxTimer + Signals = { + Counter = { + Type = uint32 + } + Time = { + Type = uint32 + } + } + } + +IDLE_MDSPLUS_DDB = { + Class = GAMDataSource + } + +Timings = { + Class = TimingDataSource + } + + } + +States = { + Class = ReferenceContainer + +Idle = { + Class = RealTimeState + +Threads = { + Class = ReferenceContainer + +Thread1 = { + Class = RealTimeThread + Functions = {IDLE_MDSPLUS} + } + } + } + + } + + +Scheduler = { + Class = GAMScheduler + TimingDataSource = Timings + } +} +''' + config = self.getMarte2ConfigInfo() + outConfig = outConfig.replace('', appName) + outConfig = outConfig.replace('', self.expandTypes(config['TypesDict'])) + outConfig = outConfig.replace('', self.expandInterfaces(config['Interfaces'])) + outConfig = outConfig.replace('', self.expandGams(config['Gams'])) + outConfig = outConfig.replace('', self.expandDataSources(config['DataSources'])) + outConfig = outConfig.replace('', self.expandStates(config['StateDict'])) + outConfig = outConfig.replace('', firstStateName) + + return outConfig + def check(self): + try: + self.generateConfiguration() + except Exception as e: + return str(e) + return 'Configuration OK' + + + def buildConfiguration(self): + config = self.generateConfiguration() + #print(config) + name = self.getNode('NAME').data() + f = open('/tmp/'+name+'_marte_configuration.cfg', 'w') + f.write(config) f.close() - print('END BUILD') + def startMarteIdle(self): self.buildConfiguration() @@ -581,13 +1313,13 @@ def startMarte(self): def gotorun(self): marteName = self.getNode('name').data() eventString1 = 'StateMachine:GOTORUN' - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString1.encode(), dtype=np.uint8)) def gotoidle(self): marteName = self.getNode('name').data() eventString1 = 'StateMachine:GOTOIDLE' - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString1.encode(), dtype=np.uint8)) def doState(self, state): @@ -596,13 +1328,13 @@ def doState(self, state): eventString1 = marteName+':StopCurrentStateExecution:XX' eventString2 = marteName+':'+'PrepareNextState:'+stateName eventString3 = marteName+':StartNextStateExecution:XX' - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString1.encode(), dtype=np.uint8)) time.sleep(.1) - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString2.encode(), dtype=np.uint8)) time.sleep(.1) - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString3.encode(), dtype=np.uint8)) def doState1(self): @@ -625,22 +1357,22 @@ def suspendMarte(self): eventString1 = marteName+':StopCurrentStateExecution:XX' eventString2 = marteName+':'+'PrepareNextState:IDLE' eventString3 = marteName+':StartNextStateExecution:XX' - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString1.encode(), dtype=np.uint8)) time.sleep(0.1) - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString2.encode(), dtype=np.uint8)) time.sleep(0.1) - Event.seteventRaw(marteName, np.frombuffer( + MDSplus.Event.seteventRaw(marteName, np.frombuffer( eventString3.encode(), dtype=np.uint8)) def stopMarte(self): marteName = self.getNode('name').data() self.suspendMarte() time.sleep(2) - Event.seteventRaw(marteName, np.frombuffer(b'EXIT', dtype=np.uint8)) + MDSplus.Event.seteventRaw(marteName, np.frombuffer(b'EXIT', dtype=np.uint8)) time.sleep(2) - Event.seteventRaw(marteName, np.frombuffer(b'EXIT', dtype=np.uint8)) + MDSplus.Event.seteventRaw(marteName, np.frombuffer(b'EXIT', dtype=np.uint8)) # KILL MARTe process import subprocess import os @@ -661,58 +1393,3 @@ def stopMarte(self): os.kill(int(p), 9) print('MARTe Process PID : %s Killed\n' % (p)) - def check(self): - t = self.getTree() - numStates = self.num_states.data() - gamInstances = [] - - for state in range(numStates): - numThreads = getattr( - self, 'state_%d_num_threads' % (state+1)).data() - for thread in range(numThreads): - try: - gamNids = self.getGamList(state, thread) - for currGamNid in gamNids: - if currGamNid.isOn(): - gamClass = currGamNid.getData().getDevice() - gamInstance = gamClass(currGamNid) - gamInstances.append(gamInstance) - except: - return 'Cannot get Device list for tread '+str(thread)+' of state '+str(state) - for gamInstance in gamInstances: - try: - - gamInstance.prepareMarteInfo() - except: - return 'Device ' + gamInstance.getPath() + ' is not a MARTe2 device' - - error, info, threadMap, typeDicts = self.getInfo() - if error != '': - return error - for gamInstance in gamInstances: - status = gamInstance.check(threadMap) - if status != '': - return gamInstance.getPath()+': ' + status - return 'Configuration OK' - - -# Check timebases - for state in range(numStates): - numThreads = getattr( - self, 'state_%d_num_threads' % (state+1)).data() - for thread in range(numThreads): - timebaseGenerator = '' - gamNodes = self.getGamList(state, thread) - for currGamNid in gamNodes: - if currGamNid.isOn(): - gamClass = currGamNid.getData().getDevice() - gamInstance = gamClass(currGamNid) - timebaseMode = gamInstance.checkTimebase(threadMap) - if timebaseMode == MC.MARTE2_COMPONENT.TIMEBASE_GENERATOR: - if timebaseGenerator == '': - timebaseGenerator = gamInstance.name.data() - else: - return 'Multiple timebases in state %d, thread %d' % (state+1, thread+1)+': ' + timebaseGenerator + ', ' + gamInstance.name.data() - if timebaseGenerator == '': - return 'No Timebase defined in state %d, thread %d' % (state+1, thread+1) - return 'Configuration OK' diff --git a/pydevices/RfxDevices/PLFE.py b/pydevices/RfxDevices/PLFE.py index 3da78adffa..f8e502bcaf 100644 --- a/pydevices/RfxDevices/PLFE.py +++ b/pydevices/RfxDevices/PLFE.py @@ -217,9 +217,9 @@ def copyBits(self, source, dest, mask): def deserialize_msg(self, msg): assert re.match( - '^(\#[0-5][01]([01][0-9][0-9]|2[0-4][0-9]|25[0-5])){6}$', msg) + '^(\\#[0-5][01]([01][0-9][0-9]|2[0-4][0-9]|25[0-5])){6}$', msg) - # assert re.match('^(\#[0-5][01]([01][0-9][0-9]|2[0-5][0-5])){6}$', msg) + # assert re.match('^(\\#[0-5][01]([01][0-9][0-9]|2[0-5][0-5])){6}$', msg) data = [] diff --git a/pydevices/RfxDevices/__init__.py b/pydevices/RfxDevices/__init__.py index cfa75329d3..4fdd84cb2a 100644 --- a/pydevices/RfxDevices/__init__.py +++ b/pydevices/RfxDevices/__init__.py @@ -64,6 +64,9 @@ def _mimport(name, level=1): for filename in os.listdir(os.path.dirname(__file__)): if not filename.startswith("_"): if filename.endswith('.py'): - _mimport(filename[:-3]) + try: + _mimport(filename[:-3]) + except: + pass #print('RfxDevices loaded.') diff --git a/python/MDSplus/_version.py.in b/python/MDSplus/_version.py.in index 868878b7f7..970d9fd949 100644 --- a/python/MDSplus/_version.py.in +++ b/python/MDSplus/_version.py.in @@ -1,3 +1,3 @@ version = (@RELEASE_MAJOR@, @RELEASE_MINOR@, @RELEASE_RELEASE@) -release_tag = "@RELEASE_BRANCH@_release_@RELEASE_MAJOR@.@RELEASE_MINOR@.@RELEASE_RELEASE@" +release_tag = "@RELEASE_BRANCH@_release-@RELEASE_MAJOR@-@RELEASE_MINOR@-@RELEASE_RELEASE@" release_date = "@RELEASE_DATE@" diff --git a/python/MDSplus/compound.py.in b/python/MDSplus/compound.py.in index 3dadbda676..98f2db0d43 100644 --- a/python/MDSplus/compound.py.in +++ b/python/MDSplus/compound.py.in @@ -23,9 +23,20 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +import sys import ctypes as _C import numpy as _N +try: + import imp +except: + # imp was removed in 3.12 + from types import ModuleType + + class imp: + @staticmethod + def new_module(name): + return ModuleType(name) def _mimport(name, level=1): try: @@ -249,8 +260,7 @@ class Conglom(_dat.TreeRefX, Compound): def getDevice(self, *args, **kwargs): if not self.image == '__python__': raise _exc.DevNOT_A_PYDEVICE - import imp - import sys + model, unique = self.__model_unique if unique is None: module = imp.new_module(model) diff --git a/python/MDSplus/tree.py b/python/MDSplus/tree.py index 524c42fc19..4236f62534 100644 --- a/python/MDSplus/tree.py +++ b/python/MDSplus/tree.py @@ -2305,6 +2305,12 @@ def getSegmentDim(self, idx): return dim.value def getSegmentLimits(self, idx): + """Return the start and end times of a given segment + @param idx: The index of the segment to query. Indexes start with 0. + @type idx: int + @return: A Tuple of (startTime, endTime) + @rtype: Tuple(Data, Data) + """ start = _dsc.DescriptorXD()._setTree(self.tree) end = _dsc.DescriptorXD()._setTree(self.tree) _exc.checkStatus( @@ -2318,14 +2324,20 @@ def getSegmentLimits(self, idx): if start is not None or end is not None: return (start, end) - def getSegmentList(self, start, end): - start, end = map(_dat.Data, (start, end)) + def getSegmentList(self, startTime, endTime): + """Return a signal composed of the segments from startTime to endTime + @param startTime: The start of the time range of segments to return + @param endTime: The end of the time range of segments to return + @return: Segment dimension + @rtype: Signal + """ + startTime, endTime = map(_dat.Data, (startTime, endTime)) xd = _dsc.DescriptorXD()._setTree(self.tree) _exc.checkStatus( _XTreeShr._XTreeGetSegmentList(self.ctx, self._nid, - _dat.Data.byref(start), - _dat.Data.byref(end), + _dat.Data.byref(startTime), + _dat.Data.byref(endTime), xd.ref)) return xd.value diff --git a/servershr/Client.h b/servershr/Client.h index bc7aca0490..f213582749 100644 --- a/servershr/Client.h +++ b/servershr/Client.h @@ -86,8 +86,8 @@ static inline int Client_free(Client *client, fd_set *fdactive) MDSDBG(CLIENT_PRI, CLIENT_VAR(client)); if (client->reply_sock != INVALID_SOCKET) { - shutdown(client->reply_sock, 2); - close(client->reply_sock); + shutdown(client->reply_sock, SHUT_RDWR); + closesocket(client->reply_sock); if (fdactive) FD_CLR(client->reply_sock, fdactive); } @@ -161,7 +161,7 @@ static void Client_do_message(Client *c, fd_set *fdactive) if (nbytes != 0) MDSWRN(CLIENT_PRI " Invalid read %d/60", CLIENT_VAR(c), nbytes); else - MDSDBG(CLIENT_PRI " Clint disconnected", CLIENT_VAR(c)); + MDSDBG(CLIENT_PRI " Client disconnected", CLIENT_VAR(c)); Client_remove(c, fdactive); return; } @@ -188,6 +188,9 @@ static void Client_do_message(Client *c, fd_set *fdactive) } switch (replyType) { + // When an action service has processed an action, it sends back this reply. + // So update the status flags for the job. Don't remove the client because + // want the network connection to remain active. case SrvJobFINISHED: { Job *j = Job_get_by_jobid(jobid); diff --git a/servershr/ServerDispatchPhase.c b/servershr/ServerDispatchPhase.c index 486d87e6e4..300ac6001e 100644 --- a/servershr/ServerDispatchPhase.c +++ b/servershr/ServerDispatchPhase.c @@ -624,7 +624,7 @@ static void dispatch(int i) // ProgLoc = 7001; send_monitor(MonitorDispatched, i); // ProgLoc = 7002; - if (noact) + if (noact) // global, 1 = show actions but don't dispatch, 0 = dispatch { actions[i].dispatched = 1; actions[i].status = status = 1; @@ -634,20 +634,16 @@ static void dispatch(int i) } else { + actions[i].dispatched = 1; UNLOCK_ACTION(i, d_w); status = ServerDispatchAction( 0, Server(server, actions[i].server), table->tree, table->shot, actions[i].nid, action_done, (void *)(intptr_t)i, &actions[i].status, &actions[i].lock, &actions[i].netid, before); - if (STATUS_OK) - { - WRLOCK_ACTION(i, d_w); - actions[i].dispatched = 1; - UNLOCK_ACTION(i, d); - } - else + if (STATUS_NOT_OK) { WRLOCK_ACTION(i, d_w); + actions[i].dispatched = 0; actions[i].status = status; action_done_action_locked(i); UNLOCK_ACTION(i, d); @@ -691,6 +687,7 @@ static void action_done_action_locked(int idx) MdsFree1Dx(&xd, NULL); } +// Uses recursion to deal with cascade of actions static void action_done_action_unlocked(int idx) { if (is_abort_in_progress()) diff --git a/servershr/ServerQAction.c b/servershr/ServerQAction.c index 3351fc26e1..1f32e5ce58 100644 --- a/servershr/ServerQAction.c +++ b/servershr/ServerQAction.c @@ -75,9 +75,9 @@ static int DoSrvClose(SrvJob *job_in); static int DoSrvCreatePulse(SrvJob *job_in); static void DoSrvMonitor(SrvJob *job_in); -static void RemoveClient(SrvJob *job); extern uint32_t MdsGetClientAddr(); extern char *GetPortname(); +static pthread_mutex_t ClientsMutex = PTHREAD_MUTEX_INITIALIZER; static ClientList *Clients = NULL; static MonitorList *Monitors = NULL; @@ -838,68 +838,138 @@ static void KillWorker() } // both -static SOCKET AttachPort(uint32_t addr, uint16_t port) +static void close_socket(SOCKET sock) +{ + shutdown(sock, SHUT_RDWR); + closesocket(sock); +} +static SOCKET open_socket(uint32_t addr, uint16_t port) { - SOCKET sock; struct sockaddr_in sin; - ClientList *l, *new; - for (l = Clients; l; l = l->next) - if (l->addr == addr && l->port == port) - return l->sock; sin.sin_port = htons(port); sin.sin_family = AF_INET; *(uint32_t *)(&sin.sin_addr) = addr; - sock = socket(AF_INET, SOCK_STREAM, 0); - if (sock == INVALID_SOCKET) + SOCKET sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock != INVALID_SOCKET) { - MDSERR("Cannot get socket for " IPADDRPRI ":%u", IPADDRVAR(&addr), port); + if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) == 0) + { + MDSDBG("Connected to " IPADDRPRI ":%u", IPADDRVAR(&addr), port); + return sock; + } + MDSERR("Cannot connect to " IPADDRPRI ":%u", IPADDRVAR(&addr), port); + close_socket(sock); } else { - if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) == -1) + MDSERR("Cannot get socket for " IPADDRPRI ":%u", IPADDRVAR(&addr), port); + } + return INVALID_SOCKET; +} +static void add_client(uint32_t addr, uint16_t port, SOCKET sock) +{ + ClientList *new = (ClientList *)malloc(sizeof(ClientList)); + new->addr = addr; + new->port = port; + new->sock = sock; + MDSDBG("add socket %" PRI_SOCKET " for " IPADDRPRI ":%u", new->sock, IPADDRVAR(&new->addr), new->port); + pthread_mutex_lock(&ClientsMutex); + new->next = Clients; + Clients = new; + pthread_mutex_unlock(&ClientsMutex); +} +static int check_socket(SOCKET socket) +{ + if (socket != INVALID_SOCKET) + { + fd_set fdactive; + FD_ZERO(&fdactive); + FD_SET(socket, &fdactive); + struct timeval timeout = {0, 0}; // non-blocking + return select(socket + 1, &fdactive, 0, 0, &timeout) == 0; + } + return B_FALSE; +} +static SOCKET find_client(uint32_t addr, uint16_t port) +{ + ClientList **p; + SOCKET sock = INVALID_SOCKET; + pthread_mutex_lock(&ClientsMutex); + for (p = &Clients; *p != NULL; p = &(*p)->next) + { + if ((*p)->addr == addr && (*p)->port == port) { - MDSERR("Cannot connect to " IPADDRPRI ":%u", IPADDRVAR(&addr), port); - shutdown(sock, 2); - close(sock); - return INVALID_SOCKET; + ClientList *l = *p; + if (check_socket(l->sock)) + { + sock = l->sock; + MDSDBG("reuse socket %" PRI_SOCKET " for " IPADDRPRI ":%u", sock, IPADDRVAR(&addr), port); + } + else + { + *p = l->next; + close_socket(l->sock); + MDSDBG("cannot reuse socket %" PRI_SOCKET " for " IPADDRPRI ":%u?", l->sock, IPADDRVAR(&addr), port); + free(l); + } + break; } - MDSDBG("Connected to " IPADDRPRI ":%u", IPADDRVAR(&addr), port); - new = (ClientList *)malloc(sizeof(ClientList)); - l = Clients; - Clients = new; - new->addr = addr; - new->port = port; - new->sock = sock; - new->next = l; } + pthread_mutex_unlock(&ClientsMutex); return sock; } -// both -static void RemoveClient(SrvJob *job) +static SOCKET remove_client(uint32_t addr, uint16_t port) { - ClientList *l, *prev; - for (prev = 0, l = Clients; l;) + ClientList **p; + SOCKET sock = INVALID_SOCKET; + pthread_mutex_lock(&ClientsMutex); + for (p = &Clients; *p != NULL; p = &(*p)->next) { - if (job->h.addr == l->addr && job->h.port == l->port) + if ((*p)->addr == addr && (*p)->port == port) { - shutdown(l->sock, 2); - close(l->sock); - if (prev) - prev->next = l->next; - else - Clients = l->next; + ClientList *l = *p; + sock = l->sock; + *p = l->next; free(l); break; } - else + } + pthread_mutex_unlock(&ClientsMutex); + return sock; +} +static SOCKET setup_client(SrvJob *job) +{ + const uint32_t addr = job->h.addr; + const uint16_t port = job->h.port; + SOCKET sock = find_client(addr, port); + if (sock == INVALID_SOCKET) + { + sock = open_socket(addr, port); + if (sock != INVALID_SOCKET) { - prev = l; - l = l->next; + add_client(addr, port, sock); + MDSMSG("setup connection %" PRI_SOCKET " " SVRJOB_PRI, sock, SVRJOB_VAR(job)); } } + return sock; +} +// both +static void cleanup_client(SrvJob *job) +{ + SOCKET sock = remove_client(job->h.addr, job->h.port); + if (sock != INVALID_SOCKET) + close_socket(sock); + if (STATIC_Debug) + { + MDSMSG("cleanup connection %" PRI_SOCKET " " SVRJOB_PRI, sock, SVRJOB_VAR(job)); + } + else + { + MDSDBG("cleanup connection %" PRI_SOCKET " " SVRJOB_PRI, sock, SVRJOB_VAR(job)); + } } -/// returns the number of bytes sent +/// on success returns the number of bytes sent, on failure returns -1 static int send_all(SOCKET sock, char *msg, int len) { int sent; @@ -910,7 +980,8 @@ static int send_all(SOCKET sock, char *msg, int len) const int bytes = send(sock, msg + sent, len - sent, MSG_NOSIGNAL); if (bytes <= 0) { - sent = bytes; + if (bytes != 0) + sent = bytes; break; } sent += bytes; @@ -922,9 +993,7 @@ static int send_all(SOCKET sock, char *msg, int len) static int send_reply(SrvJob *job, int replyType, int status_in, int length, char *msg) { MDSDBG(SVRJOB_PRI " %d", SVRJOB_VAR(job), replyType); - int status; - status = MDSplusERROR; - SOCKET sock; + int status = MDSplusERROR; long msg_len = msg ? (long)strlen(msg) : 0; int try_again = FALSE; char reply[60]; @@ -933,32 +1002,31 @@ static int send_reply(SrvJob *job, int replyType, int status_in, int length, cha do { errno = 0; - sock = AttachPort(job->h.addr, (uint16_t)job->h.port); + SOCKET sock = setup_client(job); if (sock == INVALID_SOCKET) + { + MDSMSG(SVRJOB_PRI " break connection", SVRJOB_VAR(job)); + cleanup_client(job); break; + } int bytes = send_all(sock, reply, 60); + MDSDBG("send 60: %d %d", bytes, replyType); if (bytes == 60) { - bytes = send_all(sock, msg, length); - if (bytes == length) + if (check_socket(sock)) { - status = MDSplusSUCCESS; - break; + bytes = send_all(sock, msg, length); + MDSDBG("send msg: %d/%d", bytes, length); + if (bytes == length) + { + status = MDSplusSUCCESS; + break; + } } } - if (STATUS_NOT_OK) - { + else try_again = errno == EPIPE; - int debug; - pthread_mutex_lock(&STATIC_lock); - debug = STATIC_Debug; - pthread_mutex_unlock(&STATIC_lock); - if (debug) - { - MDSMSG(SVRJOB_PRI " drop connection", SVRJOB_VAR(job)); - } - RemoveClient(job); - } + cleanup_client(job); } while (try_again--); return status; } diff --git a/servershr/ServerSendMessage.c b/servershr/ServerSendMessage.c index d75bfbe23c..7626c41acf 100644 --- a/servershr/ServerSendMessage.c +++ b/servershr/ServerSendMessage.c @@ -62,6 +62,7 @@ int ServerSendMessage(); #include #endif +// #define DEBUG #include #include #include @@ -73,7 +74,6 @@ int ServerSendMessage(); #define _NO_SERVER_SEND_MESSAGE_PROTO #include "servershrp.h" -//#define DEBUG #include "Client.h" extern short ArgLen(); @@ -100,6 +100,11 @@ static SOCKET get_socket_by_conid(int conid) return INVALID_SOCKET; } +// Mdstcl has two threads: main and receiver. The main thread dispatches +// actions to action services (typically one service per computer). +// The receiver thread processes replies from all action services. +// Each thread uses a different port, thus a different network connection. +// Connections persist and thus handle all traffic between the endpoints. int ServerSendMessage(int *msgid, char *server, int op, int *retstatus, pthread_rwlock_t *lock, int *conid_out, void (*callback_done)(), void *callback_param, void (*callback_before)(), int numargs_in, @@ -148,7 +153,7 @@ int ServerSendMessage(int *msgid, char *server, int op, int *retstatus, addr = *(uint32_t *)&addr_struct.sin_addr; if (!addr) { - MDSWRN("could not resolve address the socket is bound to"); + MDSWRN("could not resolve address socket %" PRI_SOCKET " is bound to", sock); if (callback_done) callback_done(callback_param); return ServerSOCKET_ADDR_ERROR; @@ -196,13 +201,15 @@ int ServerSendMessage(int *msgid, char *server, int op, int *retstatus, status = SendArg(conid, 0, DTYPE_CSTRING, 1, (short)(ccmd - cmd), 0, 0, cmd); if (STATUS_NOT_OK) { - MDSWRN("could not sending message to server"); + MDSWRN("could not send message to server"); Job_cleanup(status, jobid); return status; } + // The "action service" immediately sends back a handshake status confirming + // that it received the command sent above. status = GetAnswerInfoTS(conid, &dtype, &len, &ndims, dims, &numbytes, (void **)&dptr, &mem); - if (op == SrvStop) + if (op == SrvStop) // If stopped the server, a failed status is expected { if (STATUS_NOT_OK) { @@ -246,7 +253,7 @@ static SOCKET new_reply_socket(uint16_t *port_out) { char *dash; for (dash = range; *dash && *dash != '-'; dash++) - ; + continue; if (dash) *(dash++) = 0; start_port = (uint16_t)(strtol(range, NULL, 0) & 0xffff); @@ -303,6 +310,7 @@ static SOCKET new_reply_socket(uint16_t *port_out) static Condition ReceiverRunning = CONDITION_INITIALIZER; +// Returns non-MDSplus status: -1, 0, or 1. OK is 0, others are error. static int start_receiver(uint16_t *port_out) { INIT_STATUS; @@ -323,7 +331,7 @@ static int start_receiver(uint16_t *port_out) if (!ReceiverRunning.value) { CREATE_DETACHED_THREAD(thread, *16, receiver_thread, &sock); - if (c_status) + if (c_status) // is from preceding macro { perror("Error creating pthread"); status = MDSplusERROR; @@ -342,7 +350,7 @@ static int start_receiver(uint16_t *port_out) static void receiver_atexit(void *arg) { (void)arg; - MDSDBG("ServerSendMessage thread exitted"); + MDSDBG("ServerSendMessage thread exited"); CONDITION_RESET(&ReceiverRunning); } @@ -376,6 +384,8 @@ static void reset_fdactive(int rep, SOCKET server, fd_set *fdactive) MDSWRN("reset fdactive in reset_fdactive"); } +// When any action service completes an action, a reply is sent back to mdstcl. +// The single receiver thread processes the replies from all action services. static void receiver_thread(void *sockptr) { atexit((void *)receiver_atexit); @@ -393,13 +403,15 @@ static void receiver_thread(void *sockptr) FD_ZERO(&fdactive); FD_SET(sock, &fdactive); int rep; + int num = 0; struct timeval readto, timeout = {10, 0}; + // Tries 10 times if select() always returns error (i.e., num < 0) for (rep = 0; rep < 10; rep++) { for (readfds = fdactive, readto = timeout;; readfds = fdactive, readto = timeout, rep = 0) { - int num = select(FD_SETSIZE, &readfds, NULL, NULL, &readto); + num = select(FD_SETSIZE, &readfds, NULL, NULL, &readto); if (num < 0) break; if (num == 0) @@ -522,20 +534,42 @@ EXPORT int ServerDisconnect(char *server_in) return status; } +// If a network connection already exists, reuse it. Only create a +// connection in two scenarios: new or defunct. +// In the simplest configuration, mdstcl has three connections: +// 1) to the mdsip service for tree access (to read the action nodes), +// 2) a connection to dispatch actions to the action service, and +// 3) a connection to receive replies from the action service. static inline int server_connect(char *server, uint32_t addr, uint16_t port) { int conid; LOCK_CLIENTS; - conid = ConnectToMds(server); - if (conid != INVALID_CONNECTION_ID) + Client *c = Client_get_by_addr_and_port_locked(addr, port); + if (c && get_socket_by_conid(c->conid) != INVALID_SOCKET) { - Client *c = newClient(addr, port, conid); - MDSDBG(CLIENT_PRI " connected to %s", CLIENT_VAR(c), server); - Client_push_locked(c); + conid = c->conid; } else { - MDSWRN("Could not connect to %s (" IPADDRPRI ":%d)", server, IPADDRVAR(&addr), port); + conid = ConnectToMds(server); + if (conid != INVALID_CONNECTION_ID) + { + if (c) + { + MDSDBG(CLIENT_PRI " re-connected to %s as %d", CLIENT_VAR(c), server, conid); + c->conid = conid; + } + else + { + c = newClient(addr, port, conid); + MDSDBG(CLIENT_PRI " connected to %s", CLIENT_VAR(c), server); + Client_push_locked(c); + } + } + else + { + MDSWRN("Could not connect to %s (" IPADDRPRI ":%d)", server, IPADDRVAR(&addr), port); + } } UNLOCK_CLIENTS; return conid; @@ -584,7 +618,7 @@ static void accept_client(SOCKET reply_sock, struct sockaddr_in *sin, fd_set *fd else { MDSWRN("Dropped connection from " IPADDRPRI ":%d", IPADDRVAR(&addr), port); - shutdown(reply_sock, 2); - close(reply_sock); + shutdown(reply_sock, SHUT_RDWR); + closesocket(reply_sock); } } diff --git a/servershr/servershrp.h b/servershr/servershrp.h index c1ff748c7b..8d6b84bbe1 100644 --- a/servershr/servershrp.h +++ b/servershr/servershrp.h @@ -4,11 +4,13 @@ #include #ifdef _WIN32 #include +#define PRI_SOCKET PRIdPTR #else #ifndef HAVE_PTHREAD_LOCK_GLOBAL_NP extern void pthread_lock_global_np(); extern void pthread_unlock_global_np(); #endif +#define PRI_SOCKET "d" #endif #ifdef MDSOBJECTSCPPSHRVS_EXPORTS diff --git a/sites.csv b/sites.csv index 0e11630753..d02229c537 100644 --- a/sites.csv +++ b/sites.csv @@ -85,4 +85,5 @@ CONICET,"Buenos Aires, Brazil",MDSplus, U. Of Saskatchewan,"Saskatoon, CA",Other, U. Tromso,"Tromso, Norway",Other, U. Oslo,"Oslo, Norway",Other, -SUNIST lab - Tsinghua University," Beijing,China",MDSplus, \ No newline at end of file +SUNIST lab - Tsinghua University," Beijing,China",MDSplus, +Startorus Fusion,"Xi'an, China",MDSplus diff --git a/tdi/RfxDevices/DIO2__init.fun b/tdi/RfxDevices/DIO2__init.fun index dd2862fbc3..2431f6c030 100644 --- a/tdi/RfxDevices/DIO2__init.fun +++ b/tdi/RfxDevices/DIO2__init.fun @@ -92,7 +92,7 @@ public fun DIO2__init(as_is _nid, optional _method) if(_remote != 0) { - _cmd = 'MdsConnect("'//_ip_addr//'",1)'; + _cmd = 'MdsConnect("'//_ip_addr//'")'; _status = execute(_cmd); diff --git a/tdi/RfxDevices/baseline_segmented.fun b/tdi/RfxDevices/baseline_segmented.fun index 62cd5d883b..189b75fc38 100644 --- a/tdi/RfxDevices/baseline_segmented.fun +++ b/tdi/RfxDevices/baseline_segmented.fun @@ -23,7 +23,7 @@ public fun baseline_segmented(as_is _node, optional in _npoints) _sum = 0.; - _sum = sum(_first_seg[0.._actpoints-1]); + _sum = sum(_first_seg[0 .. _actpoints-1]); _offset = _sum / _actpoints; _y = _y - _offset; diff --git a/tdi/java/checkMarte.py b/tdi/java/checkMarte.py index 2fb3044f6b..6328145bdd 100644 --- a/tdi/java/checkMarte.py +++ b/tdi/java/checkMarte.py @@ -2,7 +2,7 @@ def checkMarte(treeName, nid): - print('Checking MaARTe2 configuration...') + print('Checking MARTe2 configuration...') print(nid) t = Tree(treeName, -1) node = TreeNode(nid, t) diff --git a/tdi/treeshr/TreePutDeserialized.fun b/tdi/treeshr/TreePutDeserialized.fun new file mode 100644 index 0000000000..e3f83e9bc1 --- /dev/null +++ b/tdi/treeshr/TreePutDeserialized.fun @@ -0,0 +1,25 @@ +public fun TreePutDeserialized(in _nodename, in _expression, optional in _a, optional in _b, + optional in _c, optional in _d, optional in _e, optional in _f, optional in _g, optional in _h, + optional in _i, optional in _j, optional in _k, optional in _l, optional in _m, optional in _n, + optional in _o, optional in _p, optional in _q, optional in _r, optional in _s, optional in _t, + optional in _u, optional in _v, optional in _w, optional in _x, optional in _y, optional in _z) +{ + _list = List(*,_expression); + for (_narg=1;_narg <= 26; _narg++) + { + _argnam = "_"//char(96+_narg); /* char(97 is 'a') */ + _argcheck = "present("//_argnam//")"; + if (execute(_argcheck)) + _list = List(_list,SerializeIn(execute(_argnam))); + else + break; + } + _treeput_ans = *; + write(*, _list); + _status = TdiShr->TdiIntrinsic(val(BUILTIN_OPCODE("COMPILE")),val(_narg),ref(_list),xd(_treeput_ans)); + + write(*, 'STATUS ', _status); + if (_status & 1) + _status = TreeShr->TreePutRecord(val(getnci(_nodename,"nid_number")),xd(_treeput_ans),val(0)); + return(_status); +} diff --git a/tdishr/TdiGetDbi.c b/tdishr/TdiGetDbi.c index 58a8a7f268..ee74ff18da 100644 --- a/tdishr/TdiGetDbi.c +++ b/tdishr/TdiGetDbi.c @@ -72,7 +72,8 @@ extern int tdi_get_data(); extern int TdiGetLong(); extern int _TdiEvaluate(); -static int compare(struct descriptor *s1, struct item s2[1]) +// s2 is a pointer to the middle of the table, which is why the -1 below works +static int compare(struct descriptor *s1, struct item *s2) { int cmp, len1 = s1->length, len2 = strlen(s2[0].item_name); char c0; diff --git a/tdishr/TdiGetNci.c b/tdishr/TdiGetNci.c index f364aefdf1..adcde26dd5 100644 --- a/tdishr/TdiGetNci.c +++ b/tdishr/TdiGetNci.c @@ -243,7 +243,8 @@ static const struct usage_item }, }; -static int compare(struct descriptor *s1, struct item s2[1]) +// s2 is a pointer to the middle of the table, which is why the -1 below works +static int compare(struct descriptor *s1, struct item *s2) { int cmp, len1 = s1->length, len2 = strlen(s2[0].item_name); char c0; diff --git a/tditest/testing/test-tab.ans b/tditest/testing/test-tab.ans index a6cff6123d..65d649c0f7 100644 --- a/tditest/testing/test-tab.ans +++ b/tditest/testing/test-tab.ans @@ -9,17 +9,18 @@ TR %TDI Error in EXECUTE("TR") tree -tree_from_tag( treefindnodewild( treeput( -treeabspath( treefindtagend( treeputrecord( -treeaddnode( treefindtagwild( treequit( -treeaddtag( treeflushoff( treesetcurrentshot( -treeclose( treeflushreset( treesetdbiitm( -treecreatepulsefile( treegetcurrentshot( treesetdefault( -treedeletepulsefile( treegetrecord( treesetnciitm( -treedirname( treegetsource( treesetsource( -treefilename( treeopen( treeturnoff( -treefindnodetags( treeopenedit( treeturnon( -treefindnodetagsjeff( treeopennew( treewrite( +tree_from_tag( treefindtagend( treeputrecord( +treeabspath( treefindtagwild( treequit( +treeaddnode( treeflushoff( treesetcurrentshot( +treeaddtag( treeflushreset( treesetdbiitm( +treeclose( treegetcurrentshot( treesetdefault( +treecreatepulsefile( treegetrecord( treesetnciitm( +treedeletepulsefile( treegetsource( treesetsource( +treedirname( treeopen( treeturnoff( +treefilename( treeopenedit( treeturnon( +treefindnodetags( treeopennew( treewrite( +treefindnodetagsjeff( treeput( +treefindnodewild( treeputdeserialized( tree %TREE-W-NOT_OPEN, Tree not currently open %TDI Error compiling region marked by ^ @@ -27,3 +28,5 @@ tree ^ %TDI Error in EXECUTE("tree") + + diff --git a/testing/testing.h b/testing/testing.h index 5c4b4ef0db..20e0ea6b00 100644 --- a/testing/testing.h +++ b/testing/testing.h @@ -138,7 +138,7 @@ void __mark_point(const char *__assertion, const char *__file, // TEST ////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -#define TEST_DEFAULT_TIMEOUT 10 // seconds +#define TEST_DEFAULT_TIMEOUT 3600 // seconds #define TEST_FORK(value) __test_setfork(value); diff --git a/treeshr/TreeGetSetShotId.c b/treeshr/TreeGetSetShotId.c index 7289d201f7..6094afcd69 100644 --- a/treeshr/TreeGetSetShotId.c +++ b/treeshr/TreeGetSetShotId.c @@ -137,6 +137,7 @@ int WriteShotId(char * filename, int shot, int mode) return status; } +// On error returns 0 (a non-MDSplus error viewed as failure by the status macros) int TreeGetCurrentShotId(char const *experiment) { int shot = 0; @@ -144,6 +145,9 @@ int TreeGetCurrentShotId(char const *experiment) char experiment_lower[16] = {0}; size_t slen; char * pathlist = TreePath(experiment, experiment_lower); + if (pathlist == NULL) { + return 0; + } char * filename; char * saveptr = NULL; char * path = strtok_r(pathlist, TREE_PATH_LIST_DELIM, &saveptr);