private void TestSteppedBeamformer()
        {
            var beamformer = new SimulatedSteppedBeamformer(_rfsgSession, (double)frequencyNumeric.Value, (double)powerLevelNumeric.Value);

            beamformer.Connect();
            foreach (var offset in offsets)
            {
                beamformer.LoadOffset(offset);
                //measure
                var result = MessageBox.Show($"Measure\n\nExpected Result:\nPhase: {offset.Phase}\nAmplitude: {powerLevelNumeric.Value + offset.Amplitude}");
            }
            beamformer.Disconnect();
        }
        void StartGeneration()
        {
            //bool isMeasurementComplete = false;
            Tuple <double[], double[]> measurements;
            decimal amp;
            decimal phase;

            try
            {
                instr        = new RFmxInstrMX(rfsaNameComboBox.SelectedItem.ToString(), "AnalysisOnly=1");
                _rfsgSession = new NIRfsg(rfsgNameComboBox.SelectedItem.ToString(), false, true);

                SimulatedSteppedBeamformer simulatedSteppedBF = new SimulatedSteppedBeamformer(_rfsgSession, (double)frequencyNumeric.Value, (double)powerLevelNumeric.Value);
                simulatedSteppedBF.Connect();

                PAVTMeasurement measurement = new PAVTMeasurement(instr);
                measurement.StartMeasurement(offsets.Count, (double)frequencyNumeric.Value, (double)powerLevelNumeric.Value, (double)measurementOffsetNumeric.Value / 1000000, (double)measurementLengthNumeric.Value / 1000000);
                //measurement will occur after each trigger is sent from Beamformer

                for (int i = 0; i < offsets.Count; i++)
                {
                    simulatedSteppedBF.LoadOffset(offsets[i]); // set phase offset and power level
                    _rfsgSession.Triggers.                     //send a software trigger

                    //ComplexWaveform<ComplexDouble> IQData = simulatedSteppedBF.createWaveform(offsets); //creates complex waveform data
                    //simulatedSteppedBF.writeWaveform(IQData); //generate waveform
                }


                simulatedSteppedBF.Disconnect();
                measurements = measurement.GetMeasurements();
                phase        = Convert.ToDecimal(measurements.Item1);
                amp          = Convert.ToDecimal(measurements.Item2);
                PhaseAmplitudeOffset newValues = new PhaseAmplitudeOffset(phase, amp);
                lsvResults.Items.Add(CreateListViewItem(newValues)); // add results to results listview
            }
            catch (Exception ex)
            {
                ShowError("StartGeneration()", ex);
            }
        }