Esempio n. 1
0
        private void connectInstrumentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                InstrumentControl sgTest = new InstrumentControl();
                string            id     = sgTest.IdentifySignalGenerator(parameter.SGVISAAddress);
                if (id.ToUpper().IndexOf("N5182") != -1)
                {
                    iSgControl = (SGControl)mxg;
                    Log("MXG found!");
                }
                else
                {
                    iSgControl = (SGControl)psg;
                    Log("ESG/PSG found");
                }


                if (!iSgControl.GetInitializedStatus())
                {
                    Log("Initialize SG!");
                    iSgControl.Initialize(parameter.SGVISAAddress);
                }
                if (!xSA.Initialized)
                {
                    Log("Initialize xSA!");
                    xSA.Initialize(parameter.xSAVISAAddress);
                    xSA.SendCommand("inst:sel wlan");
                    Thread.Sleep(2000);
                    //xSA.SendCommand("INST:SEL WLAN");
                    // Select 11ax 80Mhz
                    xSA.SendCommand("RAD:STAN AX80");
                    // configure EVM measurement
                    xSA.SendCommand("CONF:EVM");
                }
                if (!n6700x.Initialized)
                {
                    Log("Initialize Power Supply.");
                    n6700x.Initialize(parameter.N6700VISAAddress);
                }
                // Add MXA Initialization code here.
            }
            catch (Exception ex)
            {
                Log(ex.Message);
            }
        }
Esempio n. 2
0
        private void btnTestWithMXG_Click(object sender, EventArgs e)
        {
            try
            {
                InstrumentControl sgTest = new InstrumentControl();
                string            id     = sgTest.IdentifySignalGenerator(parameter.SGVISAAddress);
                if (id.ToUpper().IndexOf("N5182") != -1)
                {
                    iSgControl = (SGControl)mxg;
                    Log("MXG found!");
                }
                else
                {
                    iSgControl = (SGControl)psg;
                    Log("ESG/PSG found");
                }

                if (!iSgControl.GetInitializedStatus())
                {
                    Log("Connect to Signal Generator first.");
                    iSgControl.Initialize(parameter.SGVISAAddress);
                }
                string strWaveformToDownload = parameter.WaveformFileName;
                string strRead = "";
                //Log("Download Waveform with name TEST");
                //iSgControl.DownloadWaveform(strWaveformToDownload);

                Log("Setup SG");
                iSgControl.SetupSG(parameter.T1, parameter.T2, parameter.DutyCycle, parameter.SGFreqInMhz, parameter.SGPowerLevel, strWaveformToDownload, parameter.T1Adjustment, parameter.T2Adjustment);

                //iSgControl.SendCommand("sour:rad:arb:wav " + "\"TEST\"");
                //double WaveformSamplingRate = 0;
                //iSgControl.SendCommand("sour:rad:arb:scl:rate?");
                //iSgControl.Read(ref strRead);
                //WaveformSamplingRate = Convert.ToDouble(strRead);
                //int nTotalPoint = 0;
                //iSgControl.SendCommand("arb:waveform:poin?");
                //iSgControl.Read(ref strRead);
                //nTotalPoint = Convert.ToInt32(strRead);



                ////
                ////Waveform structure 1usec 132usec 36usec total 169usec.
                //byte[] Marker1 = new byte[nTotalPoint];
                //int nFirstOffNum = (int)((1e-6 - parameter.T1) * WaveformSamplingRate);
                ////int nSignalNum = (int)(132e-6 * WaveformSamplingRate);

                //double totalLength = nTotalPoint / WaveformSamplingRate;
                //double offtimeLegnth = totalLength * (1 - parameter.DutyCycle);

                //int nLastOffNum = (int)((offtimeLegnth - 1e-6 - parameter.T2) * WaveformSamplingRate);

                //Marker1.Initialize();
                //for (int i = nFirstOffNum; i < (nTotalPoint - nLastOffNum); i++)
                //    Marker1[i] = 1;

                //Log("Marker Setting!");
                //iSgControl.DownloadMarker(Marker1, 1);
                //iSgControl.SendCommand("SOUR:RAD:ARB:MARK:SET \"TEST\",2,1,100,0");

                //iSgControl.SendCommand("ROUTE:CONN:EVENT1 M1");
                //iSgControl.SendCommand("ROUTE:CONN:bbtr M2");

                //iSgControl.SendCommand("ARB:state on");
                //iSgControl.SendCommand("output:mod:state on");

                //iSgControl.SendCommand("FREQ " + parameter.SGFreqInMhz.ToString(".000") + "MHZ");
                //iSgControl.SendCommand("RADio:ARB:MARKer:RFBLank OFF");
                //iSgControl.SendCommand("POWER " + parameter.SGPowerLevel.ToString(".00") + "DBM");
                //iSgControl.SendCommand("output on");

                Log("Download and play..");
            }
            catch (Exception ex)
            {
                Log(ex.Message);
            }
        }