public void SetTheExtSrcSamplingFrequencywUnits(string channel, string setValue, string units) { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); string valueToSet = _converter.GigaToMegaHertz(setValue, units); _extSourceSourceGroup.SetExtSrcFreq(extSource, channel, valueToSet); }
/// <summary> /// Checks to verify that no system error has occured on the external source /// /// SYSTem:ERRor? /// </summary> /// <param name="extSource">the EXTSOURCE object</param> /// <returns>System error code and message</returns> public void TheExtSrcShouldHaveNoErrors(IEXTSOURCE extSource) { extSource.GetExtSrcSystemErrorQuery(); Regex responseRegex = new Regex("^0,\"No error\"$"); Match m = responseRegex.Match(extSource.ExtSrcSystemError); Assert.IsTrue(m.Success, "An unexpected value:" + extSource.ExtSrcSystemError + " was returned from SYST:ERR?"); }
/// <summary> /// Saves the external source's settings to a file /// /// AWGControl:SSave /// </summary> /// <param name="extSource">the EXTSOURCE object</param> /// <param name="filename">filename to save settings to</param> /// <param name="msus">mass storage unit specifier aka drive</param> public void SaveExtSrcSettings(IEXTSOURCE extSource, string filename, string msus) { if (msus != "") { msus = "," + "\"" + msus + "\""; } extSource.SaveExtSrcSettings(filename, msus); }
/// <summary> /// Restores the AWG's settings from a speficied settings file and MSUS for the external source /// /// AWGControl:SREStore /// </summary> /// <param name="extSource">the EXTSOURCE object</param> /// <param name="filename">settings file to load</param> /// <param name="msus">mass storage unit specifier aka drive</param> public void SetExtSrcFileWithMsusRestore(IEXTSOURCE extSource, string filename, string msus) { if (msus != "") { msus = "," + "\"" + msus + "\""; } extSource.SetExtSrcFileWithMsusRestore(filename, msus); }
public void GivenAnExternalSource() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(true); _extSourceSystemGroup.GetExtSrcIDNQuery(extSource); //Make sure no errors from previous tests/runs _extSourceSystemGroup.ExtSrcCLS(extSource); }
/// <summary> /// Waits for the external source to complete in a matter of seconds /// /// *OPC? /// </summary> /// <param name="extSource">the EXTSOURCE object</param> /// <param name="timeLimit">How long to wait for the OPC to return</param> /// <returns>OPC result</returns> public void WaitForTimelimitExternalSource(IEXTSOURCE extSource, string timeLimit) { uint seconds = uint.Parse(timeLimit); uint timeout = seconds * 1000; // Convert to milliseconds extSource.GetExtSrcOPCQuery(timeout); Assert.AreEqual("1", extSource.ExtSrcOPC, "*OPC? query failed! Error was: " + extSource.ExtSrcOPC); }
/// <summary> /// Gets the id of the external source /// /// *IDN? /// </summary> /// <param name="extSource">the EXTSOURCE object</param> /// <returns>Id of the external source</returns> public void GetExtSrcIDNQuery(IEXTSOURCE extSource) { bool found = false; const int timesToFind = 3; for (int n = 0; n <= timesToFind; n++) //Giving the external source a certain number of tries to get the right response { extSource.GetExtSrcIDNQuery(); // found = utils.GetExtSourceIDInformation(extSource.ExtSrcIDResponse); //Parsing ExtSourceID returns a bool if (found) //If returns true, valid id so a ExtSource is talking back! { break; } Thread.Sleep(1000); } if (!found) //External source still won't talk back { Assert.Inconclusive("No External Source Found. ID Response returned " + extSource.ExtSrcIDResponse); } }
public void WaitForWfmListToAddWfms(IEXTSOURCE extSource, string numEntries, string seconds) { UTILS.HiPerfTimer timer = new UTILS.HiPerfTimer(); double totalTime = 0; int currentEntries = Int16.Parse(extSource.ExtSrcWfmListSize); int expectedEntries = Int16.Parse(numEntries) + currentEntries; while ((totalTime < double.Parse(seconds))) { timer.Start(); extSource.GetExtSrcWfmListSize(); if (Int16.Parse(extSource.ExtSrcWfmListSize) == expectedEntries) { return; } Thread.Sleep(50); // Have to make sure this is between the start/stop commands timer.Stop(); // Add the current interval to the total totalTime = totalTime + timer.Duration; } Assert.Fail("Waveform entries were not added in the allowed " + seconds + " seconds time limit. Waveform Entries Found: " + extSource.ExtSrcWfmListSize); }
public void SetupTheAwg7122AsExternalReferenceSource(string fileName, string repRate, string zeroingOn) { const string channelNumber = "1"; IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); // Put AWG7122C into a known(default) state _extSourceSystemGroup.ExtSrcRst(extSource); // Always wait for it to complete or you can get into trouble _extSourceSystemGroup.WaitForExternalSource(extSource); // Turn the interleave mode to On const string interleaveOn = "1"; _extSourceControlGroup.SetExtSrcInterLeaveState(extSource, interleaveOn); // Set state on interleave zeroing _extSourceControlGroup.SetExtSrcInterLeaveZeroing(extSource, zeroingOn); // Loading a known waveform to produce our external clock waveform for reference _extSourceSourceGroup.SetExtSrcFunctUser(extSource, fileName, channelNumber); // Not sure this is necessary but set the repetition rate _extSourceControlGroup.SetExtSrcRepRate(extSource, repRate); // Make sure the output state is on for Channel 1 const string outputStateOn = "1"; _extSourceSystemGroup.SetExtSrcOutputState(extSource, channelNumber, outputStateOn); }
public void TheCurrentSetupFileOnExtSrcShouldBe(string expectedFile) { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.TheExtSrcSetupNameShouldBe(extSource, expectedFile); }
public void OpenASetupOntoExtSrc(string filename, string msus) { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcFileWithMsusRestore(extSource, filename, msus); }
public void RunTheWaveformInTheExtSrc() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcRunImm(extSource); }
public void GettheCurrentSetupNameOnExtSrc() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.GetExtSrcSetupNameQuery(extSource); }
public void SetTheExtSrcRunModeToContinuous() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcRunMode(extSource, "CONTinuous"); }
public void SetRepetitionRateOnExternalSource(string setValue) { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcRepRate(extSource, setValue); }
public void TheExtSrcRunModeShouldBeGated() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.TheExtSrcRunModeShouldBe(extSource, "GAT"); }
public void StopTheExtSrc() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcStopImm(extSource); }
public void SetExtSrcTheInterleaveStateOff() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcInterLeaveState(extSource, "OFF"); }
/// <summary> /// Gets the the size(number of waveforms) of the waveform list from the externl source /// /// WLISt:SIZE? /// </summary> /// <param name="extSource">the EXTSOURCE object</param> /// <returns>the size(number of waveforms) of the waveform list</returns> public void GetExtSrcWfmListSize(IEXTSOURCE extSource) { extSource.GetExtSrcWfmListSize(); }
public void SetTheExtSrcRunModeToTriggered() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcRunMode(extSource, "TRIGgered"); }
public void SetTheExtSrcRunModeToSequence() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcRunMode(extSource, "SEQuence"); }
public void SetTheExtSrcRunModeToGated() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcRunMode(extSource, "GATed"); }
public void RestoreAnExtSrcSetupFile(string filename) { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcFileRestore(extSource, filename); }
public void TheExtSrcRunModeShouldBeSequence() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.TheExtSrcRunModeShouldBe(extSource, "SEQ"); }
public void SaveTheSetupofExtSrcToFile(string filename, string msus) { IEXTSOURCE extsource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SaveExtSrcSettings(extsource, filename, msus); }
public void TheExtSrcRunModeShouldBeTriggered() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.TheExtSrcRunModeShouldBe(extSource, "TRIG"); }
public void GetExternalSourceRunModeValue() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.GetExtSrcRunModeQuery(extSource); }
/// <summary> /// Creates a new empty waveform in the waveform list of the current setup on the external source /// /// WLISt:WAVeform:NEW /// </summary> /// <param name="extSource">the EXTSOURCE object</param> /// <param name="wfmName">waveform name</param> /// <param name="wfmSize">waveform size(number of points)</param> /// <param name="wfmType">waveform type</param> public void SetExtSrcWfmNew(IEXTSOURCE extSource, string wfmName, string wfmSize, string wfmType) { extSource.SetExtSrcWfmNew(wfmName, wfmSize, wfmType); }
public void SetInterleaveZeroingToOn() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.SetExtSrcInterLeaveZeroing(extSource, "ON"); }
public void TheExtSrcRunModeShouldBeContinuous() { IEXTSOURCE extSource = EXTSOURCE.GetExtSource(false); _extSourceControlGroup.TheExtSrcRunModeShouldBe(extSource, "CONT"); }