//glennj 7/25/2013 //sforell 8/9/13 modified the response format so it returns a more simple response rather than strange ascii characters /// <summary> /// Using WLISt:WAVeform:MARKer:DATA? get the waveform marker data /// </summary> /// <returns>Minimum granularity for a waveform </returns> public string GetAwgWaveformMarkerData(string wfmName, string startIndex, string size) { string commandLine = "WLISt:WAVeform:MARKer:DATA? " + '"' + wfmName + '"'; if (startIndex != null) { commandLine += ',' + startIndex; } if (size != null) { commandLine += ',' + size; } string response; _mAWGVisaSession.Query(commandLine, out response); return(UTILS.ConvertAsciiToString(response)); }
//glennj 6/11/2013 /// <summary> /// </summary> /// <param name="calConstantsAsXml"></param> /// <param name="requiredSubsystem"></param> /// <param name="optionalArea"></param> /// <param name="optionalProcedure"></param> public void AwgCalDataUser(string calConstantsAsXml, string requiredSubsystem, string optionalArea = "", string optionalProcedure = "") { //Initialize var utils = new UTILS(); //var xmlWithDoubleQuotes = utils.addDoubleQuotes(addBlockDtoHeader(calConstantsAsXml)); //var commandLine = "CALibration:DATA:USER " + // CreateParameterList(requiredSubsystem, optionalArea, optionalProcedure); //commandLine += commandLine + "," + '"' + xmlWithDoubleQuotes + '"'; var commandLine = "CALibration:DATA:USER " + CreateParameterList(requiredSubsystem, optionalArea, optionalProcedure); commandLine += "," + addBlockDtoHeader(calConstantsAsXml); _mAWGVisaSession.Timeout = 30000; // Set timeout to 15 seconds as command is blocking //Execute _mAWGVisaSession.Write(commandLine); _mAWGVisaSession.Timeout = _mDefaultVISATimeout; }
//shkv 1/28/2015 Ignoring DISP Command for *LRN? output comparision //glennj 1/6/2014 /// <summary> /// Given a file that contains the "golden" LRN results<para> /// compare them to a new LRN results response.</para> /// </summary> /// <param name="awg"></param> /// <param name="filePath"></param> public void VerifyLrnResultsMatchFile(IAWG awg, string filePath) { string rawActualText = awg.Lrn; // To be up to date, the LRN query should have happened. //string[] expectedLrnData = new string[100]; //string[] actualLrnData = new string[100]; //Parse out the current actual LRN data as an array of values string[] actualLrnData = UTILS.ParseLrnData(rawActualText); //Check to be sure the named file exists if (File.Exists(filePath)) { // Get the contents of the file string rawExpectedText = File.ReadAllText(filePath); //parse out the rawExpectedText into an array of values string[] expectedLrnData = UTILS.ParseLrnData(rawExpectedText); //Compare the array sizes - they should be equal if (expectedLrnData.Length != actualLrnData.Length) { Assert.Fail("The expected LRN result had " + expectedLrnData.Length.ToString(CultureInfo.InvariantCulture) + " elements. The actual LRN result had " + actualLrnData.Length.ToString(CultureInfo.InvariantCulture) + " elements. It is likely there are now new commands and the LRN captures have to be redone"); } //Compare the awg/lrn contents against the saved value for (int i = 0; i < expectedLrnData.Length; i++) { // The following is a list of fields whose contents should be ignored in a setup-to-LRN compare // ReSharper disable StringIndexOfIsCultureSpecific.1 if ((expectedLrnData[i].IndexOf(":SYST:DATE") == -1) & (expectedLrnData[i].IndexOf("TIME") == -1) & (expectedLrnData[i].IndexOf(":STAT:OPER:ENAB") == -1) & (expectedLrnData[i].IndexOf(":STAT:QUES:ENAB") == -1) & (expectedLrnData[i].IndexOf(":MMEM:CAT") == -1) & //CAL and DIAG FAILuresonly requires ACT:MODE is correctly set, but you cannot save a setup if the CAL or DIAG dialogs are up so ignore CAL values (expectedLrnData[i].IndexOf("FAIL") == -1) & (expectedLrnData[i].IndexOf(":OUTP1") == -1) & (expectedLrnData[i].IndexOf(":DISP") == -1) & (expectedLrnData[i].IndexOf(":OUTP2") == -1)) // ReSharper restore StringIndexOfIsCultureSpecific.1 { // ReSharper disable SpecifyACultureInStringConversionExplicitly if (expectedLrnData[i] != actualLrnData[i]) { System.Diagnostics.Trace.WriteLine("At field: " + i.ToString() + " - Expected: " + expectedLrnData[i] + " Actual: " + actualLrnData[i]); Assert.Fail("At field: " + i.ToString() + " - Expected: " + expectedLrnData[i] + " Actual: " + actualLrnData[i]); } // ReSharper restore SpecifyACultureInStringConversionExplicitly } } } else { Assert.Fail("The requested file:" + filePath + " does not exist!"); } }