/// <summary>
 /// Update button status
 /// </summary>
 /// <param name="bTransmitting">boolean if generator is power on or transmitting sweep</param>
 public void UpdateButtonStatus(bool TransmittingSweep)
 {
     if (!m_objGenerator.PortConnected)
     {
         this.Enabled = true;
         m_groupControl_RFEGen_Tracking.EnableGroup(m_objGenerator.PortConnected);
     }
     else
     {
         m_nRFGENIterationAverage.Enabled = true;
         m_labRFGenAverage.Enabled        = true;
         m_chkSNAAutoStop.Enabled         = true;
         m_listSNAOptions.Enabled         = true;
         bool bTransmitting = TransmittingSweep || m_objGenerator.RFGenPowerON;
         m_btnNormalizeTracking.Enabled = !bTransmitting;
         m_btnTrackingStart.Enabled     = !bTransmitting && m_objAnalyzer.IsTrackingNormalized();
         m_btnTrackingStop.Enabled      = ((m_objAnalyzer.Mode == RFECommunicator.eMode.MODE_TRACKING) && m_objGenerator.RFGenPowerON);
     }
 }
Exemple #2
0
        /// <summary>
        /// To validate generator sweep frequency ranges
        /// </summary>
        /// <param name="bResetNormalizeData">boolean to normalize sweep data</param>
        private void ValidateRFGenSweepFreqRanges(bool bResetNormalizeData, eFreqRangeOptions eOption)
        {
            if (m_objGenerator == null || !m_objGenerator.PortConnected)
            {
                return;
            }

            int    nSteps    = Convert.ToInt32(m_sRFGenFreqSweepSteps.Text);
            double dStartMHZ = Convert.ToDouble(m_sRFGenFreqSweepStart.Text);
            double dStopMHZ  = Convert.ToDouble(m_sRFGenFreqSweepStop.Text);

            if (dStartMHZ <= m_objGenerator.MinFreqMHZ)
            {
                dStartMHZ = m_objGenerator.MinFreqMHZ;
            }
            else if (dStartMHZ >= m_objGenerator.MaxFreqMHZ)
            {
                dStartMHZ = m_objGenerator.MaxFreqMHZ - (nSteps / 1000.0);
            }
            if (dStartMHZ >= dStopMHZ && dStopMHZ > (m_objGenerator.MinFreqMHZ + (nSteps / 1000.0)))
            {
                if (eOption == eFreqRangeOptions.STARTFREQ)
                {
                    dStopMHZ = dStartMHZ + (nSteps / 1000.0);
                }
                else if (eOption == eFreqRangeOptions.STOPFREQ)
                {
                    dStartMHZ = dStopMHZ - (nSteps / 1000.0);
                }
            }

            if (dStopMHZ > m_objGenerator.MaxFreqMHZ)
            {
                dStopMHZ = m_objGenerator.MaxFreqMHZ;
            }
            else if (dStopMHZ <= m_objGenerator.MinFreqMHZ)
            {
                dStopMHZ = m_objGenerator.MinFreqMHZ - (nSteps / 1000.0);
            }
            if (dStopMHZ <= dStartMHZ)
            {
                dStartMHZ = dStopMHZ - (nSteps / 1000.0);
            }

            if (m_objAnalyzer.PortConnected)
            {
                if (dStartMHZ < m_objAnalyzer.MinFreqMHZ)
                {
                    dStartMHZ = m_objAnalyzer.MinFreqMHZ;
                    if (dStopMHZ < m_objAnalyzer.MinFreqMHZ)
                    {
                        dStopMHZ = dStartMHZ + (nSteps / 1000.0);
                    }
                }
                else if (dStartMHZ >= (m_objAnalyzer.MaxFreqMHZ - (nSteps / 1000.0)))
                {
                    dStartMHZ = m_objAnalyzer.MaxFreqMHZ - (nSteps / 1000.0);
                    dStopMHZ  = m_objAnalyzer.MaxFreqMHZ;
                }

                if (dStopMHZ > m_objAnalyzer.MaxFreqMHZ)
                {
                    dStopMHZ = m_objAnalyzer.MaxFreqMHZ;
                }
            }
            m_sRFGenFreqSweepStop.Text  = dStopMHZ.ToString("f3");
            m_sRFGenFreqSweepStart.Text = dStartMHZ.ToString("f3");


            if (bResetNormalizeData && (m_objAnalyzer != null) && (m_objAnalyzer.PortConnected))
            {
                //if previous setup was normalized, reset as it will no longer be valid
                if (m_objAnalyzer.IsTrackingNormalized())
                {
                    if ((m_objGenerator.RFGenSweepSteps != nSteps) ||
                        (m_objGenerator.RFGenStartFrequencyMHZ != dStartMHZ) ||
                        (m_objGenerator.RFGenStopFrequencyMHZ != dStopMHZ)
                        )
                    {
                        m_objAnalyzer.ResetTrackingNormalizedData();
                        OnRFGenFreqSweepStepsLeaveEvent(new EventArgs());
                    }
                }
            }
        }