public void PlayWaveform(ControlModule ctrlParameter) { try { VXT2.Source.Modulation.Stop(); VXT2.Source.Triggers.ExternalTrigger.Enabled = ctrlParameter.SourceExtlTrigEnabled; VXT2.Source.Triggers.ExternalTrigger.Source = ctrlParameter.SourceExtTrig; VXT2.Source.Modulation.IQ.ArbEnabled = true; VXT2.Source.Modulation.Enabled = true; VXT2.Source.RF.OutputEnabled = true; VXT2.Source.RF.Frequency = ctrlParameter.FrequencyInMhz * 1e6; VXT2.Source.RF.Level = ctrlParameter.OutputPower; VXT2.Source.Modulation.PlaybackMode = ctrlParameter.PlaybackMode; Log(ctrlParameter.PlaybackMode.ToString()); //VXT2.Source.Modulation. VXT2.Apply(); if (ctrlParameter.SourceExtlTrigEnabled) { VXT2.Source.Modulation.PlayArb(refRFWaveformName, StartEvent.ExternalTrigger); Log("Play - External trigger."); } else { VXT2.Source.Modulation.PlayArb(refRFWaveformName, StartEvent.Immediate); Log("Play - immediate!"); } } catch (Exception ex) { Log(ex.Message); } }
public void VXT2QueueWaveform(double[] IQData, ControlModule ctrlParameter) { try { ErrorQueryResult result; do { //NOTE: it is necessary to create driver variable to read the error queue Ivi.Driver.IIviDriver driver = (Ivi.Driver.IIviDriver)VXT2; result = driver.Utility.ErrorQuery(); Log("ErrorQuery:" + result.Code.ToString() + " " + result.Message); } while (result.Code != 0); byte[] Marker; VXT2.Source.Modulation.Stop(); //Log("Load RF waveform."); Thread.Sleep(100); RemoveARB(refRFWaveformName); Marker = new byte[IQData.Length / 2]; for (int i = 0; i < 15; i++) { Marker[i] = 1; } Keysight.KtM941x.Marker rfBlankingMarker = Keysight.KtM941x.Marker.None; //VXT2.Source.Modulation.IQ.UploadArbDoubles(refRFWaveformName, dIQData, SamplingRateToSet, rmsPower, scaleFactor); //SamplingRate in Sa/s VXT2.Source.Modulation.IQ.UploadArbDoublesWithMarkers(refRFWaveformName, IQData, Marker, ctrlParameter.RFSamplingRateInMhz * 1e6, 2.5, 0.9, rfBlankingMarker); Log("Load Waveform Done!"); } catch (Exception ex) { Log(ex.Message); throw ex; } }
public void SetSyncOutputTriggering(ControlModule ctrlParameter) { IKtM941x VXT = VXT2; VXT.Source.Triggers.SynchronizationOutputTrigger.Type = Keysight.KtM941x.SynchronizationTriggerType.PerArb; VXT.Source.Triggers.SynchronizationOutputTrigger.DataMarker = Keysight.KtM941x.Marker.Marker1; VXT.Source.Triggers.SynchronizationOutputTrigger.Enabled = true; VXT.Source.Triggers.SynchronizationOutputTrigger.PulseWidth = 10e-6; VXT.Source.Triggers.SynchronizationOutputTrigger.Mode = Keysight.KtM941x.TriggerMode.Level; VXT.Source.Triggers.SynchronizationOutputTrigger.Polarity = Keysight.KtM941x.TriggerPolarity.Positive; VXT.Source.Triggers.SynchronizationOutputTrigger.Destination = ctrlParameter.SyncOutputTrg;// Keysight.KtM941x.Trigger.InternalTrigger; VXT.Source.Triggers.SynchronizationOutputTrigger2.Type = Keysight.KtM941x.SynchronizationTriggerType.PerArb; VXT.Source.Triggers.SynchronizationOutputTrigger2.DataMarker = Keysight.KtM941x.Marker.Marker1; VXT.Source.Triggers.SynchronizationOutputTrigger2.Enabled = true; VXT.Source.Triggers.SynchronizationOutputTrigger2.PulseWidth = 10e-6; VXT.Source.Triggers.SynchronizationOutputTrigger2.Mode = Keysight.KtM941x.TriggerMode.Level; VXT.Source.Triggers.SynchronizationOutputTrigger2.Polarity = Keysight.KtM941x.TriggerPolarity.Positive; VXT.Source.Triggers.SynchronizationOutputTrigger2.Destination = ctrlParameter.SyncOutputTrg2;// Keysight.KtM941x.Trigger.FrontPanelTrigger1; VXT.Source.Triggers.SynchronizationOutputTrigger3.Type = Keysight.KtM941x.SynchronizationTriggerType.PerArb; VXT.Source.Triggers.SynchronizationOutputTrigger3.DataMarker = Keysight.KtM941x.Marker.Marker1; VXT.Source.Triggers.SynchronizationOutputTrigger3.Enabled = true; VXT.Source.Triggers.SynchronizationOutputTrigger3.PulseWidth = 10e-6; VXT.Source.Triggers.SynchronizationOutputTrigger3.Mode = Keysight.KtM941x.TriggerMode.Level; VXT.Source.Triggers.SynchronizationOutputTrigger3.Polarity = Keysight.KtM941x.TriggerPolarity.Positive; VXT.Source.Triggers.SynchronizationOutputTrigger3.Destination = ctrlParameter.SyncOutputTrg3;// Keysight.KtM941x.Trigger.PXITrigger1; VXT.Source.Triggers.ExternalTrigger.Enabled = ctrlParameter.SourceExtlTrigEnabled;// true;// chkVXTExternalTrigger.Checked ? StartEvent.ExternalTrigger : StartEvent.Immediate; VXT.Source.Triggers.ExternalTrigger.Source = ctrlParameter.SourceExtTrig; VXT.Source.Modulation.StartPlaybackOn10MHzClock = true; VXT.Apply(); }
public void AWGQueueConfig(ControlModule ctrlParameter) { try { //Set AWG mode double amplitude = 1; nAWG = 1; // 100; //averaging double hwVer = moduleAOU.getHardwareVersion(); if (hwVer < 4) { nAWG = 0; } else { nAWG = 1; } moduleAOU.channelWaveShape(0 + nAWG, SD_Waveshapes.AOU_AWG); moduleAOU.channelAmplitude(0 + nAWG, 1); moduleAOU.channelOffset(0 + nAWG, 0.5); moduleAOU.channelWaveShape(1 + nAWG, SD_Waveshapes.AOU_PARTNER); moduleAOU.channelAmplitude(1 + nAWG, -1); moduleAOU.channelOffset(1 + nAWG, -0.5); //Queue settings int syncMode = SD_SyncModes.SYNC_CLK10; //int queueMode = Convert.ToInt32(SD_QueueMode.CYCLIC); //int startDelay = ctrlParameter.AWGTriggerDelay;// Convert.ToInt32(txtAWGDelay.Text); //1 GHz: 19456 + 587;//950 MHz: 19456 + 587 - 1041; //Unit is [10 ns]. Compensate for ~195us delay between AWGout and VXT2out //int prescaler = 0, nCycles = 0;// 1; // 0; moduleAOU.AWGqueueConfig(nAWG, (int)ctrlParameter.queueMode); //moduleAOU.AWGqueueConfig(nAWG, SD_QueueMode.ONE_SHOT); -> this demonstrates the "enum bug" moduleAOU.AWGqueueSyncMode(nAWG, syncMode); // Addd below setting. //Trigger settings //int syncMode = SD_SyncModes.SYNC_CLK10; int queueMode = Convert.ToInt32(ctrlParameter.queueMode); int extSource = SD_TriggerExternalSources.TRIGGER_PXI0 + ctrlParameter.AWGExternalPXITriggerNum; int triggerBehavior = SD_TriggerBehaviors.TRIGGER_RISE; moduleAOU.AWGtriggerExternalConfig(nAWG, extSource, triggerBehavior, syncMode); var t = moduleAOU.AWGtriggerExternalConfig(nAWG, extSource, triggerBehavior, syncMode); moduleAOU.triggerIOconfig(SD_TriggerDirections.AOU_TRG_OUT); int PXIMask = 1 << ctrlParameter.SyncTriggerOut; t = moduleAOU.AWGqueueMarkerConfig(nAWG, 3, PXIMask, 1, 0, 1, 18, 0); //Log("1.3 Configure Playing AWG.. " + t.ToString()); //t = moduleAOU.AWGqueueWaveform(nAWG, 0, (int)ctrlParameter.TriggerMode, ctrlParameter.AWGTriggerDelay, ctrlParameter.repeatCycle, 0); Log("Config AWG trigger mode and sync mode. "); } catch (Exception ex) { Log(ex.Message); throw ex; } }
public void AWGQueueWaveform(double SystemFrequency, ref double SynchronizeFrequency, double[] waveform, ControlModule ctrlParameter, double dummyWaveformLength = 1e-6, bool useDummyWaveform = false) { try { nAWG = 1; // 100; //averaging double hwVer = moduleAOU.getHardwareVersion(); if (hwVer < 4) { nAWG = 0; } else { nAWG = 1; } //multiple channels setting //int nChannels = 4; //int awgMask = 0; //for (int ii = 0; ii < nChannels; ii++) // awgMask |= 1 << ii; //AWG reset moduleAOU.AWGstop(nAWG); moduleAOU.waveformFlush(); moduleAOU.AWGflush(nAWG); Log(" > Set CLK frequency"); //SystemFrequency = 1e6 * Convert.ToDouble(clkFreqAWG.Value); int setMode = 0; //0->LOW_JITTER, 1->FAST_TUNE this.SetAWGClockFrequency(SystemFrequency, out scalingFactor, true); //moduleAOU.clockSetFrequency(SystemFrequency, setMode); SynchronizeFrequency = moduleAOU.clockGetSyncFrequency(); Log(" > AWG M320xA CLK Freqs"); Log(" *** CLKsysFreq = " + SystemFrequency.ToString()); Log(" *** CLKsyncFreq = " + SynchronizeFrequency.ToString()); //Log(""); //Wfm length //NOTE, 070519: set both RF and AWG wfm length to 1ms //int wfmLen = Convert.ToInt32((1e-3) * SystemFrequency); //Log("Queue Waveform."); this.AWGQueueConfig(ctrlParameter); //waveform int wfmType = SD_WaveformTypes.WAVE_ANALOG; int wfmNum = 0, onTime = 100; //wfmLen = 1000, //double[] wfmData = new double[wfmLen]; //for (int ii = 0; ii < onTime; ii++) //wfmData[ii] = 1; SD_Wave wave = new SD_Wave(wfmType, waveform); Log(" *** AWG Sampling Num : " + waveform.Length.ToString()); //SD_Wave wave = new SD_Wave(@"P:\4Francesco\ET_DPD\TestA_20000.csv"); //use this to create wfm from file var t = moduleAOU.waveformLoad(wave, wfmNum);//, wfmNum); if (!useDummyWaveform) { t = moduleAOU.AWGqueueWaveform(nAWG, wfmNum, (int)ctrlParameter.TriggerMode, ctrlParameter.AWGTriggerDelay, ctrlParameter.repeatCycle, scalingFactor); } else { int nDummyLength = (int)(dummyWaveformLength * SystemFrequency); int mod = nDummyLength % 16; nDummyLength -= mod; Log(" *** Dummy AWG Sampling Num : " + nDummyLength.ToString()); double[] dummyWave = new double[nDummyLength]; for (int i = 0; i < nDummyLength / 2; i++) { dummyWave[i] = 0.5; } for (int i = nDummyLength / 2; i < nDummyLength; i++) { dummyWave[i] = 0.5; } double[] normalDummy = Normalizer.Normalize(dummyWave); SD_Wave dWave = new SD_Wave(wfmType, normalDummy); t = moduleAOU.waveformLoad(dWave, wfmNum + 1); t = moduleAOU.AWGqueueWaveform(nAWG, wfmNum + 1, (int)ctrlParameter.TriggerMode, ctrlParameter.AWGTriggerDelay, 1, scalingFactor); t = moduleAOU.AWGqueueWaveform(nAWG, wfmNum, (int)AWGTRIGGERMODE.IMMEDIATE, 0, ctrlParameter.repeatCycle, scalingFactor); } } catch (Exception ex) { Log(ex.Message); throw ex; } }
public void InitializeVXT2(ControlModule ctrlParameter) { try { options = "QueryInstrStatus = true, Simulate = false, DriverSetup=UseFileSystemBackingStore=0,AppStart=" + (ctrlParameter.RunXapp.ToString().ToLower());// "QueryInstrStatus=true, Simulate=false, DriverSetup= DisableLoadCorrection=true,ModuleDiagnostics=true,ShareAllVisaSessions=true"; //options = "QueryInstrStatus = true, Simulate = false, DriverSetup=AppStart=" + (ctrlParameter.RunXapp.ToString().ToLower() );// "QueryInstrStatus=true, Simulate=false, DriverSetup= DisableLoadCorrection=true,ModuleDiagnostics=true,ShareAllVisaSessions=true"; Log(options); VXT2 = new KtM941x(ctrlParameter.VXTVISAAddress, true, true, options); VXT2.Source.Triggers.ExternalTrigger.Delay = 0; VXT2.Source.RF.Level = 0; VXT2.Source.RF.Frequency = ctrlParameter.FrequencyInMhz * 1e6; VXT2.Source.Modulation.Enabled = true; //VXT.Source.Modulation.IQ.ArbEnabled = true; VXT2.Source.RF.OutputEnabled = true; VXT2.Apply(); IKtM941x VXT = VXT2; VXT.Source.Triggers.SynchronizationOutputTrigger.Type = Keysight.KtM941x.SynchronizationTriggerType.PerArb; VXT.Source.Triggers.SynchronizationOutputTrigger.DataMarker = Keysight.KtM941x.Marker.Marker1; VXT.Source.Triggers.SynchronizationOutputTrigger.Enabled = true; VXT.Source.Triggers.SynchronizationOutputTrigger.PulseWidth = 10e-6; VXT.Source.Triggers.SynchronizationOutputTrigger.Mode = Keysight.KtM941x.TriggerMode.Level; VXT.Source.Triggers.SynchronizationOutputTrigger.Polarity = Keysight.KtM941x.TriggerPolarity.Positive; VXT.Source.Triggers.SynchronizationOutputTrigger.Destination = ctrlParameter.SyncOutputTrg;// Keysight.KtM941x.Trigger.InternalTrigger; VXT.Source.Triggers.SynchronizationOutputTrigger2.Type = Keysight.KtM941x.SynchronizationTriggerType.PerArb; VXT.Source.Triggers.SynchronizationOutputTrigger2.DataMarker = Keysight.KtM941x.Marker.Marker1; VXT.Source.Triggers.SynchronizationOutputTrigger2.Enabled = true; VXT.Source.Triggers.SynchronizationOutputTrigger2.PulseWidth = 10e-6; VXT.Source.Triggers.SynchronizationOutputTrigger2.Mode = Keysight.KtM941x.TriggerMode.Level; VXT.Source.Triggers.SynchronizationOutputTrigger2.Polarity = Keysight.KtM941x.TriggerPolarity.Positive; VXT.Source.Triggers.SynchronizationOutputTrigger2.Destination = ctrlParameter.SyncOutputTrg2;// Keysight.KtM941x.Trigger.FrontPanelTrigger1; VXT.Source.Triggers.SynchronizationOutputTrigger3.Type = Keysight.KtM941x.SynchronizationTriggerType.PerArb; VXT.Source.Triggers.SynchronizationOutputTrigger3.DataMarker = Keysight.KtM941x.Marker.Marker1; VXT.Source.Triggers.SynchronizationOutputTrigger3.Enabled = true; VXT.Source.Triggers.SynchronizationOutputTrigger3.PulseWidth = 10e-6; VXT.Source.Triggers.SynchronizationOutputTrigger3.Mode = Keysight.KtM941x.TriggerMode.Level; VXT.Source.Triggers.SynchronizationOutputTrigger3.Polarity = Keysight.KtM941x.TriggerPolarity.Positive; VXT.Source.Triggers.SynchronizationOutputTrigger3.Destination = ctrlParameter.SyncOutputTrg3;// Keysight.KtM941x.Trigger.PXITrigger1; VXT.Source.Triggers.ExternalTrigger.Enabled = ctrlParameter.SourceExtlTrigEnabled;// true;// chkVXTExternalTrigger.Checked ? StartEvent.ExternalTrigger : StartEvent.Immediate; VXT.Source.Triggers.ExternalTrigger.Source = ctrlParameter.SourceExtTrig; VXT.Source.Modulation.StartPlaybackOn10MHzClock = true; // Added for ET VXT2.Service.SetValue("Source;UseSourceDspTrigger", "true"); VXT.Apply(); //Set PXI0 as input trigger for external triggering of RF output //NOTE: this code is moved here to try to solve the conflict w HVI trigger class //VXT2.Source.Triggers.ExternalTrigger.Source = Trigger.PXITrigger0; //VXT2.Source.Triggers.ExternalTrigger.Enabled = true; //chkVXTExternalTrigger.Checked; Log("VXT2 Initialize Done!"); } catch (Exception ex) { Log(ex.Message); throw ex; } }