예제 #1
0
        //Load toàn bộ giá trị tên limit TX từ file vào listLimitWifiTX
        public static bool readFromFile()
        {
            try {
                fileName = GlobalData.initSetting.ENWRITEBIN == false?string.Format("{0}TxLimit-Config.csv", filePath) : string.Format("{0}TxLimit-Config-NewBIN.csv", filePath);

                fileName = GlobalData.initSetting.STATION == "Trước đóng vỏ" ? fileName : string.Format("{0}TxLimit-Config-Anten.csv", filePath);

                GlobalData.listLimitWifiTX = new List <limittx>();
                if (File.Exists(fileName) == false)
                {
                    return(false);
                }
                var lines = File.ReadLines(fileName);
                foreach (var line in lines)
                {
                    if (!line.Contains("RangeFrequency"))
                    {
                        string[] buffer = line.Split(',');
                        limittx  lt     = new limittx()
                        {
                            rangefreq     = buffer[0],
                            wifi          = buffer[1],
                            mcs           = buffer[2],
                            power_MAX     = buffer[3],
                            power_MIN     = buffer[4],
                            evm_MAX       = buffer[5],
                            evm_MIN       = buffer[6],
                            freqError_MAX = buffer[7],
                            freqError_MIN = buffer[8],
                            symclock_MAX  = buffer[9],
                            symclock_MIN  = buffer[10]
                        };
                        GlobalData.listLimitWifiTX.Add(lt);
                    }
                }
                return(true);
            }
            catch {
                return(false);
            }
        }
예제 #2
0
 //Search tên limit TX từ listLimitWifiTX
 public static bool getData(string _rangefreq, string _wifi, string _mcs, out limittx _limit)
 {
     _limit = new limittx();
     try {
         if (GlobalData.listLimitWifiTX.Count == 0)
         {
             return(false);
         }
         foreach (var item in GlobalData.listLimitWifiTX)
         {
             if (item.rangefreq == _rangefreq && item.wifi == _wifi && item.mcs == _mcs)
             {
                 _limit = item;
                 break;
             }
         }
         return(true);
     }
     catch {
         return(false);
     }
 }
예제 #3
0
        private bool Verify_Signal(testinginfo _ti, ModemTelnet ModemTelnet, Instrument instrument, string standard_2G_5G, string Mode, string MCS, string BW, string Channel_Freq, string Anten, double Attenuator, ref string _pw, ref string _evm, ref string _freqerr, ref string _pstd, ref string _evmmax)
        {
            try {
                standard_2G_5G = int.Parse(Channel_Freq.Substring(0, 4)) > 3000 ? "5G" : "2G";
                string  Result_Measure_temp = "";
                decimal Pwr_measure_temp, EVM_measure_temp, FreqErr_measure_temp;
                string  _wifi  = "";
                switch (Mode)
                {
                case "0": { _wifi = "b"; break; }

                case "1": { _wifi = "g"; break; }

                case "3": { _wifi = string.Format("n{0}", BW == "0" ? "20" : "40"); break; }

                case "4": {
                    switch (BW)
                    {
                    case "0": { _wifi = "ac20"; break; }

                    case "1": { _wifi = "ac40"; break; }

                    case "2": { _wifi = "ac80"; break; }

                    case "3": { _wifi = "ac160"; break; }
                    }
                    break;
                }
                }

                //Đọc giá trị tiêu chuẩn
                limittx _limit = null;
                LimitTx.getData(standard_2G_5G, FunctionSupport.Get_WifiStandard_By_Mode(Mode, BW), MCS, out _limit);

                //Thiết lập tần số máy đo
                string _error  = "";
                instrument.config_Instrument_Channel(Channel_Freq, ref _error);

                //Gửi lệnh yêu cầu ONT phát WIFI TX
                string _message = "";
                ModemTelnet.Verify_Signal_SendCommand(standard_2G_5G, Mode, MCS, BW, Channel_Freq, Anten, ref _message);
                //Hien_Thi.Hienthi.SetText(rtbAll, _message);

                //Đọc kết quả từ máy đo
                Result_Measure_temp = instrument.config_Instrument_get_TotalResult("RFB", _wifi);
                //Hien_Thi.Hienthi.SetText(rtbAll, Result_Measure_temp);

                //Lấy dữ liệu Power
                Pwr_measure_temp = Decimal.Parse(Result_Measure_temp.Split(',')[19], System.Globalization.NumberStyles.Float) + Convert.ToDecimal(Attenuator);
                if (Pwr_measure_temp < 15)
                {
                    instrument.config_Instrument_get_TotalResult("VID", _wifi);
                    Result_Measure_temp = instrument.config_Instrument_get_TotalResult("VID", _wifi);
                    //MessageBox.Show(Result_Measure_temp.ToString());
                    Pwr_measure_temp = Decimal.Parse(Result_Measure_temp.Split(',')[19], System.Globalization.NumberStyles.Float) + Convert.ToDecimal(Attenuator);
                }

                //Lấy dữ liệu EVM
                EVM_measure_temp = Decimal.Parse(Result_Measure_temp.Split(',')[1], System.Globalization.NumberStyles.Float);

                //Lấy dữ liệu Frequency Error
                FreqErr_measure_temp = Decimal.Parse(Result_Measure_temp.Split(',')[7], System.Globalization.NumberStyles.Float);

                //Hiển thị kết quả đo lên giao diện phần mềm (RichTextBox)
                _limit.power_MAX = "25";
                _limit.power_MIN = Anten == "1" ? GlobalData.initSetting.STDPWANTEN1 : GlobalData.initSetting.STDPWANTEN2;

                _pw      = Pwr_measure_temp.ToString("0.##");
                _evm     = EVM_measure_temp.ToString("0.##");
                _freqerr = FreqErr_measure_temp.ToString("0.##");
                _pstd    = string.Format("{0}~{1}", _limit.power_MIN, _limit.power_MAX);
                _evmmax  = string.Format("{0}", _limit.evm_MAX);

                _ti.LOGSYSTEM += "Power Limit = " + _pstd + " dBm, Average Power = " + _pw + " dBm\r\n";
                _ti.LOGSYSTEM += string.Format("EVM MAX = {0} {2}, EVM All Carriers = {1} {2}\r\n", _evmmax, _evm, _wifi == "b" ? " %" : " dB");
                _ti.LOGSYSTEM += "Center Frequency Error = " + _freqerr + " Hz\r\n";

                //_ti.LOGSYSTEM += "Average Power = " + Pwr_measure_temp.ToString("0.##") + " dBm\r\n";
                //_ti.LOGSYSTEM += string.Format("EVM All Carriers = {0} {1}", EVM_measure_temp.ToString("0.##"), _wifi == "b" ? " %" : " dB\r\n");
                //_ti.LOGSYSTEM += "Center Frequency Error = " + FreqErr_measure_temp.ToString("0.##") + " Hz\r\n";

                //So sánh kết quả đo với giá trị tiêu chuẩn
                bool _result = false, _powerOK = false, _evmOK = false, _freqerrOK = true;
                _powerOK   = FunctionSupport.Compare_TXMeasure_With_Standard(_limit.power_MAX, _limit.power_MIN, Pwr_measure_temp);
                _evmOK     = FunctionSupport.Compare_TXMeasure_With_Standard(_limit.evm_MAX, _limit.evm_MIN, EVM_measure_temp);
                _freqerrOK = FunctionSupport.Compare_TXMeasure_With_Standard(_limit.freqError_MAX, _limit.freqError_MIN, FreqErr_measure_temp);

                if (_powerOK == false)
                {
                    _ti.LOGSYSTEM += "FAIL: Power\r\n";
                }
                else if (_evmOK == false)
                {
                    _ti.LOGSYSTEM += "FAIL: EVM\r\n";
                }
                else if (_freqerrOK == false)
                {
                    _ti.LOGSYSTEM += "FAIL: Frequency Error\r\n";
                }
                _result = _powerOK && _evmOK && _freqerrOK;

                return(_result);
            }
            catch {
                return(false);
            }
        }