Пример #1
0
        public void ProcessSweepModeDisplayAcquisition(NWTDevice.RunSweepModeParam AcquisitionParams)
        {
            CGraph Graph       = SpectrumPictureBox.GetGraphConfig();
            CCurve CurveConfig = (CCurve)CurveConfigPropertyGrid.SelectedObject;

            SpectrumPictureBox.SetActiveCurve(CurveConfig);

            CurveConfig.nSpectrumLowFrequency  = AcquisitionParams.nBaseFrequency;
            CurveConfig.nSpectrumHighFrequency = AcquisitionParams.nBaseFrequency + AcquisitionParams.nFrequencyStep * AcquisitionParams.nCount;
            CurveConfig.nFrequencyStep         = AcquisitionParams.nFrequencyStep;

            if (AcquisitionParams.ResultDatas != null)
            {
                Utility.FilterArray(AcquisitionParams.ResultDatas, (int)((FilterMode)FilterComboBox.SelectedItem));
                CurveConfig.SpectrumValues = AcquisitionParams.ResultDatas;
                CurveConfig.DetermineMinMaxLevels();
                CurveConfig.ComputeCaracteristicsParams();
                if (bLoop == false)
                {
                    LOGDraw(""); // new line
                    LOGDraw("*** ----- RESULTS----- ***");
                    LOGDraw(CurveConfig.GetCurveDescription());
                }
            }

            Graph.nLastDrawingLowFrequency  = nFrequencyDetectionStart;
            Graph.nLastDrawingHighFrequency = nFrequencyDetectionEnd;
            SpectrumPictureBox.DrawCurveCollection(SweepModeCurvesList, bLoop);
        }
Пример #2
0
        void SetAnalyzer(int Index, bool TakeAcountOfSave = false)
        {
            if (DeviceArray.Count > 0)
            {
                NWTCompatibleDeviceDef DeviceDef = (NWTCompatibleDeviceDef)DeviceArray[Index];
                CurrentDeviceDef = DeviceDef;
                DeviceInterface.SetDevice(DeviceDef);
                LoadCalibrationFile();

                Int64 LowRange;
                Int64 HighRange;

                if (TakeAcountOfSave == true)
                {
                    if (Program.Save.LowFrequency >= DeviceInterface.MinFrequency &&
                        Program.Save.LowFrequency <= DeviceInterface.MaxFrequency)
                    {
                        LowRange = Program.Save.LowFrequency;
                    }
                    else
                    {
                        LowRange = DeviceInterface.MinFrequency;
                    }

                    if (Program.Save.HighFrequency <= DeviceInterface.MaxFrequency &&
                        Program.Save.HighFrequency >= DeviceInterface.MinFrequency)
                    {
                        HighRange = Program.Save.HighFrequency;
                    }
                    else
                    {
                        HighRange = DeviceInterface.MaxFrequency;
                    }
                }
                else
                {
                    LowRange  = DeviceInterface.MinFrequency;
                    HighRange = DeviceInterface.MaxFrequency;
                }

                SetSweepFrequencies(LowRange, HighRange);
                SetSweepFrequencies(LowRange, HighRange);


                CGraph Graph = SpectrumPictureBox.GetGraphConfig();

                Graph.fLastDrawingLevelLow      = -90;
                Graph.fLastDrawingLevelHigh     = 10;
                Graph.nLastDrawingLowFrequency  = LowRange;
                Graph.nLastDrawingHighFrequency = HighRange;
                SpectrumPictureBox.GetGraphConfig().DrawBackGround();

                if (!DeviceDef.Attenuator)
                {
                    AttLevelcomboBox.SelectedIndex = 0;
                    AttLevelcomboBox.Enabled       = false;
                }
                else
                {
                    AttLevelcomboBox.Enabled = true;
                    if (Program.Save.LastUsedAttLevel != null)
                    {
                        AttLevel Level;
                        try
                        {
                            Level = (AttLevel)System.Enum.Parse(typeof(AttLevel), Program.Save.LastUsedAttLevel);
                        }
                        catch (Exception)
                        {
                            Level = AttLevel._0dB;
                        }
                        AttLevelcomboBox.SelectedIndex = (int)Level;
                    }
                    else
                    {
                        AttLevelcomboBox.SelectedIndex = 0;
                    }
                }

                if (!DeviceDef.HaveLinDetector)
                {
                    DetectorCombobox.SelectedIndex = 0;
                    DetectorCombobox.Enabled       = false;
                }
                else
                {
                    DetectorCombobox.Enabled = true;
                }

                AttCalCheckBox.Enabled = DeviceDef.Attenuator;
            }

            if (SerialPortComboBox.SelectedItem != null)
            {
                SerialPortInitialize((String)SerialPortComboBox.SelectedItem);
            }
        }