Esempio n. 1
0
        public SequenceCallInfo[] ReinitializeSequenceCallInfo(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
        {
            PropertyObject seqContextPO = seqContext.AsPropertyObject();
            Step           activeStep   = seqContext.Step;
            string         stepID       = activeStep.UniqueStepId;

            return(ReinitializeSequenceCallInfo(seqContext, stepID));
        }
Esempio n. 2
0
        public IStimulusProfileSession StartStimulusProfile(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext, SequenceCallInfo[] seqCallInfoArray, string gatewayIP)
        {
            seqCallInfoArray = Array.FindAll(seqCallInfoArray, isNotNull).ToArray();
            Step           activeStep         = seqContext.Step;
            string         stepID             = activeStep.UniqueStepId;
            Sequence       selectedTSSequence = seqContext.Sequence;
            PropertyObject stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();

            try
            {
                PropertyObject seqContextPO = seqContext.AsPropertyObject();
                Factory        vsFact       = new Factory();
                string         sequenceName;
                try
                {
                    sequenceName = stepPropertyObject.GetValString("Veristand.RTSessionName", 0);
                }
                catch (System.Runtime.InteropServices.COMException ex)
                {
                    sequenceName = "CouldNotFindName";
                    VSDialogs dialogs = new VSDialogs();
                    dialogs.ShowWarningDialog("Could not find name of RT Sequence");
                }
                IStimulusProfileSession stimProfSession = vsFact.GetIStimulusProfileSession(gatewayIP, sequenceName, seqCallInfoArray, "Teststand Stimulus Profile Session");
                bool auto_start;
                try
                {
                    auto_start = stepPropertyObject.GetValBoolean("Veristand.StimProfAutoStart", 0);
                }
                catch (System.Runtime.InteropServices.COMException ex)
                {
                    auto_start = false;
                }
                string sessionName;
                NationalInstruments.VeriStand.Error vsError;
                stimProfSession.Deploy(auto_start, out sessionName, out vsError);
                if (vsError.Code != 0)
                {
                    VSDialogs dialogs2 = new VSDialogs();
                    dialogs2.ShowWarningDialog(vsError.ResolvedErrorMessage);
                }

                return(stimProfSession);
            }
            catch (NationalInstruments.VeriStand.VeriStandException ex)
            {
                VSDialogs dialogs = new VSDialogs();
                dialogs.ShowWarningDialog(ex.ResolvedErrorMessage + "------" + ex.StackTrace);
            }
            catch (System.InvalidCastException ex)
            {
                VSDialogs dialogs = new VSDialogs();
                dialogs.ShowWarningDialog(ex.Message + "------" + ex.StackTrace);
            }
            return(null);
        }
Esempio n. 3
0
        public SequenceCallInfo[] ConfigureRealTimeSequenceDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
        {
            ConcurrentQueue <SequenceCallInfo[]> cq = new ConcurrentQueue <SequenceCallInfo[]>();

            SequenceCallInfo[] seqCallInfo;
            Application.Run(new ConfigureRTSequence(seqContext, cq));
            bool elementFound = cq.TryDequeue(out seqCallInfo);

            return(seqCallInfo);
        }
Esempio n. 4
0
        public void SetAlarmState(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
        {
            //Gets all the current alarm info and modifies the state then sets the alarm data

            //Get TestStand Information
            PropertyObject seqContextPO = seqContext.AsPropertyObject();
            Step           activeStep   = seqContext.Step;
            string         stepID       = activeStep.UniqueStepId;

            Sequence       selectedTSSequence = seqContext.Sequence;
            PropertyObject stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            Factory        fact       = new Factory();
            string         alarmName  = StringUtilities.removeDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.AlarmName", 0));
            string         alarmValue = StringUtilities.removeDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.AlarmState", 0));
            IAlarm         thisAlarm  = fact.GetIAlarm(alarmName);
            AlarmInfo      alarmData;

            Error alarmError1 = thisAlarm.GetAlarmData(out alarmData, 5000);

            switch (alarmValue)
            {
            case "Disabled":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Disabled;
                break;

            case "Enabled":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Enabled;
                break;

            case "Tripped":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Tripped;
                break;

            case "Delayed Trip":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.DelayedTripped;
                break;

            case "Indicate":
                alarmData.State = NationalInstruments.VeriStand.ClientAPI.AlarmState.Indicate;
                break;
            }
            thisAlarm.SetAlarmData(alarmData);
        }
Esempio n. 5
0
        public string GetAlarmState(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
        {
            //Gets all alarm information and returns just the state

            //Get TestStand Information
            PropertyObject seqContextPO       = seqContext.AsPropertyObject();
            Step           activeStep         = seqContext.Step;
            string         stepID             = activeStep.UniqueStepId;
            Sequence       selectedTSSequence = seqContext.Sequence;
            PropertyObject stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();
            Factory        fact      = new Factory();
            string         alarmName = StringUtilities.removeDoubleQuotesAroundString(stepPropertyObject.GetValString("Veristand.AlarmName", 0));


            IAlarm    thisAlarm = fact.GetIAlarm(alarmName);
            AlarmInfo alarmData;

            thisAlarm.GetAlarmData(out alarmData, 5000);
            return(alarmData.State.ToString());
        }
Esempio n. 6
0
        public SequenceCallInfo[] ReinitializeSequenceCallInfo(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext, string stepID)
        {
            string         paramType    = "";
            string         paramValue   = "";
            string         paramName    = "";
            PropertyObject seqContextPO = seqContext.AsPropertyObject();
            Step           activeStep   = seqContext.Step;

            string[]         parameterTypes;
            string[]         parameterValues;
            string[]         parameterNames;
            SequenceCallInfo seqCallInfo;

            SequenceCallInfo[] seqCallInfoArray;
            Sequence           selectedTSSequence = seqContext.Sequence;
            PropertyObject     stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject();

            string[] sequenceNames = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.SequenceNames", 0), o => o.ToString());

            string gatewayIP;

            try
            {
                gatewayIP = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.GatewayIP", 0);
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                gatewayIP = "localhost";
            }
            try
            {
                parameterValues = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamValues", 0), o => o.ToString());
                parameterTypes  = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamTypes", 0), o => o.ToString());
                parameterNames  = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamNames", 0), o => o.ToString());
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                parameterValues = new string[0];
                parameterTypes  = new string[0];
                parameterNames  = new string[0];
            }

            int numberofSequences = (int)stepPropertyObject.GetValNumber("Veristand.RTNumSequences", 0);

            seqCallInfoArray = new SequenceCallInfo[numberofSequences];
            for (int sequenceNumber = 0; sequenceNumber < numberofSequences; sequenceNumber++)
            {
                string[] curParameterValues = StringUtilities.expressionArrayToStringArray(parameterValues[sequenceNumber]);
                string[] curParameterNames  = StringUtilities.expressionArrayToStringArray(parameterNames[sequenceNumber]);
                string[] curParameterTypes  = StringUtilities.expressionArrayToStringArray(parameterTypes[sequenceNumber]);

                int numParameters = curParameterNames.Length;
                if (numParameters > 0)
                {
                    resolveExpressions(ref curParameterValues, seqContextPO);
                }
                SequenceParameterAssignmentInfo[] seqParametersInfo = new SequenceParameterAssignmentInfo[numParameters];
                try
                {
                    for (uint parameterNumber = 0; parameterNumber < numParameters; parameterNumber++)
                    {
                        try
                        {
                            paramValue = curParameterValues[parameterNumber];
                            paramType  = curParameterTypes[parameterNumber];
                            paramName  = curParameterNames[parameterNumber];
                        }
                        catch (System.Runtime.InteropServices.COMException ex) //We have processed all the sequences
                        {
                        }
                        switch (paramType)
                        {//Initialize the correct type of parameter based on the Users Type setting
                        case "Path":
                            SystemDefinitionChannelResource sysDefChannel = new SystemDefinitionChannelResource(paramValue);
                            seqParametersInfo[parameterNumber] = new SequenceParameterAssignmentInfo(paramName, sysDefChannel);

                            break;

                        case "Boolean":
                            BooleanValue boolVal = new BooleanValue(Convert.ToBoolean(paramValue));
                            seqParametersInfo[parameterNumber] = new SequenceParameterAssignmentInfo(paramName, boolVal);
                            break;

                        case "Double":
                            DoubleValue doubleVal = new DoubleValue(Convert.ToDouble(paramValue));
                            seqParametersInfo[parameterNumber] = new SequenceParameterAssignmentInfo(paramName, doubleVal);
                            break;

                        case "I32":
                            I32Value i32Val = new I32Value(Convert.ToInt32(paramValue));
                            seqParametersInfo[parameterNumber] = new SequenceParameterAssignmentInfo(paramName, i32Val);
                            break;

                        case "I64":
                            I64Value i64Val = new I64Value(Convert.ToInt64(paramValue));
                            seqParametersInfo[parameterNumber] = new SequenceParameterAssignmentInfo(paramName, i64Val);
                            break;

                        case "U32":
                            U32Value u32Val = new U32Value(Convert.ToUInt32(paramValue));
                            seqParametersInfo[parameterNumber] = new SequenceParameterAssignmentInfo(paramName, u32Val);
                            break;

                        case "U64":
                            U64Value u64Val = new U64Value(Convert.ToUInt64(paramValue));
                            seqParametersInfo[parameterNumber] = new SequenceParameterAssignmentInfo(paramName, u64Val);
                            break;
                        }
                    }
                }
                catch (IndexOutOfRangeException ex)
                {
                    //Parameter numbers don't match up
                    VSDialogs vsdiag = new VSDialogs();
                    vsdiag.ShowWarningDialog("Parameter Import Failed");
                }



                seqCallInfo = new SequenceCallInfo(sequenceNames[sequenceNumber], "", seqParametersInfo, false, 1000);
                seqCallInfoArray[sequenceNumber] = seqCallInfo;
            }
            seqCallInfoArray = Array.FindAll(seqCallInfoArray, isNotNull).ToArray(); //Get rid of all null entries in the array
            return(seqCallInfoArray);
        }
Esempio n. 7
0
 public void SetMultipleChannelsDialogDGV(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext, SetMultipleChannelsDialogDGV.ChannelType channelType)
 {
     Application.Run(new SetMultipleChannelsDialogDGV(seqContext, channelType));
 }
Esempio n. 8
0
 public void ConfigureLoggingDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext, ConfigureLoggingFile.ChannelType channelType)
 {
     Application.Run(new ConfigureLoggingFile(seqContext, channelType));
 }
Esempio n. 9
0
 public void ShowAlarmStateDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
 {
     Application.Run(new ConfigureAlarm(seqContext));
 }
Esempio n. 10
0
 public void ShowUpdateModelParametersFromFileDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
 {
     Application.Run(new ModelParametersFromFile(seqContext));
 }
Esempio n. 11
0
 public static void ChannelNameThreadProc(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext, bool ModelList)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new ChannelSelectionDialog(seqContext, ModelList));
 }
Esempio n. 12
0
 public void ConfigureChannelNameDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext, NativeChannelSelectionDialog.ChannelType channelType)
 {
     Application.Run(new NativeChannelSelectionDialog(seqContext, channelType));
 }
Esempio n. 13
0
 public void ConfigureUndeploySystemDefinitionDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
 {
     Application.Run(new ConfigureSystemDefinition(seqContext, false));
 }
Esempio n. 14
0
 public void ConfigureStimulusProfileDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
 {
     Application.Run(new StimulusProfileDialog(seqContext));
 }
Esempio n. 15
0
 public void ConfigureRealTimeSequenceNumericLimitDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
 {
     Application.Run(new ConfigureRTSequenceNumericLimit(seqContext));
 }
Esempio n. 16
0
 public static void ShowUpdateModelParametersFromFileProc(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new ModelParametersFromFile(seqContext));
 }
Esempio n. 17
0
 public void ConfigureSequenceNameDialog(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext)
 {
     Application.Run(new ConfigureSequenceName(seqContext));
 }