Esempio n. 1
0
        public void Run()
        {
            ConfigureGeneration();
            ConfigureMeasurement();
            ConfigureServo();
            ConfigureSweep();

            rfsgSession.Initiate();

            // Define sweep
            Stopwatch watch = new Stopwatch();

            watch.Reset();

            StreamWriter stream = new StreamWriter(File.Create("data.csv"));

            stream.WriteLine(string.Join(", ", "Frequency", "Averages", "Symbols"));

            var sweep = new Sweep(sweepSteps, () =>
            {
                // get rid of first run jitter
                wlan.Initiate("", "");
                wlan.WaitForMeasurementComplete("", 10.0);
                wlan.OfdmModAcc.Configuration.GetAveragingCount("", out int numAverages);
                wlan.OfdmModAcc.Results.GetNumberOfSymbolsUsed("", out int numSymbolsUsed);
                wlan.OfdmModAcc.Results.GetCompositeRmsEvmMean("", out double evm);

                wlan.GetCenterFrequency("", out double centFreq);
                string currentPoints = string.Join(", ", centFreq.ToString(), sweepSteps[1].GetCurrentPoint().ToString(),
                                                   sweepSteps[2].GetCurrentPoint().ToString());

                stream.Write(currentPoints);
                Console.WriteLine(currentPoints);

                for (int i = 0; i < repeatabilityCount; i++)
                {
                    powerServo.Disable();
                    powerServo.Enable();

                    watch.Restart();

                    wlan.Initiate("", "");

                    powerServo.Start();
                    powerServo.Wait(ServoTimeout, out ushort servoNumberOfAveragesCaptured, out bool servoDone, out bool servoFailed);
                    // powerServo.GetDigitalGain(out double servoRawDigitalGain, out double servoDigitalGain);
                    // powerServo.GetServoSteps(servoNumberOfAveragesCaptured, servoContinuous, false, 0, out servoMeasurementTimes, out servoMeasurementLevels);

                    wlan.WaitForMeasurementComplete("", 10.0);
                    wlan.OfdmModAcc.Configuration.GetAveragingCount("", out numAverages);
                    wlan.OfdmModAcc.Results.GetCompositeRmsEvmMean("", out evm);
                    wlan.OfdmModAcc.Results.GetNumberOfSymbolsUsed("", out numSymbolsUsed);

                    watch.Stop();

                    if (numAverages != (int)sweepSteps[1].GetCurrentPoint() || numSymbolsUsed != (int)sweepSteps[2].GetCurrentPoint())
                    {
                        throw new Exception();
                    }

                    stream.Write(", " + evm.ToString());
                    stream.Write(", " + watch.ElapsedMilliseconds.ToString());
                }