/*-----------------------------------------------------------*/ //Hàm gửi lệnh phát tín hiệu ở cả 2G và 5G public void Verify_Signal_SendCommand(string Standard_2G_or_5G, string Mode, string MCS, string BW, string Channel, string Anten, ref string message) { string ChannelNumber = Attenuator.getChannelNumber(Channel.Replace("000000", "")); List <string> ATEcommands = new List <string>() { string.Format("iwpriv {0} set ATE=ATESTART\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0"), string.Format("iwpriv {0} set ATECHANNEL={1}\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0", ChannelNumber), string.Format("iwpriv {0} set ATETXMODE={1}\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0", Mode), string.Format("iwpriv {0} set ATETXMCS={1}\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0", MCS), string.Format("iwpriv {0} set ATETXBW={1}\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0", BW), string.Format("iwpriv {0} set ATETXANT={1}\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0", Anten), string.Format("iwpriv {0} set ATETXCNT=0\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0"), string.Format("iwpriv {0} set ATE=TXFRAME\r\n", Standard_2G_or_5G == "2G" ? "ra0":"rai0") }; try { if (telnet2modem.IsConnected) { string _tmpStr = ""; foreach (var item in ATEcommands) { //telnet2modem.WriteLine(item); //telnet2modem.WriteLineAndWaitComplete(item); _tmpStr += item; message += item; } telnet2modem.WriteLineAndWaitComplete(_tmpStr); Thread.Sleep(1000); } } catch (Exception Ex) { MessageBox.Show("ERROR CODE: " + Ex.ToString()); } }
private bool AutoTestSensivitity(testinginfo _ti, ModemTelnet ModemTelnet, Instrument instrument, string _CarrierFreq) { List <sensivitity> list = null; _ti.LOGSYSTEM += "------------------------------------------------------------\r\n"; _ti.LOGSYSTEM += string.Format("Bắt đầu thực hiện Test Sensitivity {0}.\r\n", _CarrierFreq); list = _CarrierFreq == "2G" ? GlobalData.listSensivitity2G : GlobalData.listSensivitity5G; if (list.Count == 0) { return(false); } bool result = true; foreach (var item in list) { Stopwatch st = new Stopwatch(); st.Start(); string _channelNo = Attenuator.getChannelNumber(item.channelfreq); _ti.LOGSYSTEM += "*************************************************************************\r\n"; _ti.LOGSYSTEM += string.Format("{0} - {1} - {2} - MCS{3} - BW{4} - Anten {5} - Channel {6}\r\n", _CarrierFreq, RF_Port, FunctionSupport.Get_WifiStandard_By_Mode(item.wifi, item.bandwidth), item.rate, 20 * Math.Pow(2, double.Parse(item.bandwidth)), item.anten, _channelNo); int count = 0; REP: count++; if (!Test_Sensivitity_Detail(_ti, ModemTelnet, instrument, _CarrierFreq, item.wifi, item.rate, item.bandwidth, item.channelfreq, item.anten, item.packet)) { if (count < 3) { _ti.LOGSYSTEM += string.Format("RETRY = {0}\r\n", count); goto REP; } else { _ti.LOGSYSTEM += string.Format("Phán định = {0}", "FAIL\r\n"); result = false; } //result = false; } else { _ti.LOGSYSTEM += string.Format("Phán định = {0}", "PASS\r\n"); } st.Stop(); _ti.LOGSYSTEM += string.Format("Thời gian test độ nhạy thu : {0} ms\r\n", st.ElapsedMilliseconds); _ti.LOGSYSTEM += "\r\n"; } return(result); }
/// <summary> /// XÁC NHẬN WIFI-RX ******************************************* /// 1. Test_Sensivitity_Detail -------//Core /// 2. AutoTestSensivitity -----------//Hỗ trợ tự động test nhiều /// 3. Test_Sensitivity_2G -----------// /// 4. Test_Sensitivity_5G -----------// /// /// </summary> #region VERIFY RX private bool Test_Sensivitity_Detail(testinginfo _ti, ModemTelnet ModemTelnet, Instrument instrument, string standard_2G_5G, string Mode, string MCS, string BW, string Channel_Freq, string Anten, int packet) { try { string wave_form_name = ""; string _channelNo = Attenuator.getChannelNumber(Channel_Freq); double _attenuator = Attenuator.getAttenuator(Channel_Freq, Anten); double power_transmit = -1000; double stPER = 0.0; double PER = 0.0; int RXCounter = 0; //Đọc giá trị PER, POWER TRANSMIT limitrx _limit = null; LimitRx.getData(standard_2G_5G, FunctionSupport.Get_WifiStandard_By_Mode(Mode, BW), MCS, out _limit); power_transmit = _limit.power_Transmit.Trim() == "-" ? -1000 : double.Parse(_limit.power_Transmit); stPER = _limit.PER.Trim() == "-" ? 0 : double.Parse(_limit.PER.Trim().Replace("%", "")); //Lấy tên file wave form WaveForm.getData(Name_measurement, Mode, MCS, BW, out wave_form_name); //Cấu hình ONT về chế độ WIFI RX _ti.LOGSYSTEM += "Cấu hình ONT...\r\n"; string _message = ""; ModemTelnet.TestSensitivity_SendCommand(standard_2G_5G, Mode, MCS, BW, _channelNo, Anten, ref _message); //Hien_Thi.Hienthi.SetText(rtbAll, _message); //Điều khiển máy đo phát gói tin _ti.LOGSYSTEM += string.Format("Cấu hình máy đo phát tín hiệu: Power={0} dBm, waveform={1}\r\n", power_transmit, wave_form_name); instrument.config_HT20_RxTest_MAC(Channel_Freq, (power_transmit + _attenuator).ToString(), packet.ToString(), wave_form_name, RF_Port); //Đọc số gói tin nhận được từ ONT RXCounter = int.Parse(ModemTelnet.TestSensitivity_ReadPER_SendCommand(standard_2G_5G, ref _message)); //Hien_Thi.Hienthi.SetText(rtbAll, _message); //Tính PER và hiển thị PER = Math.Round(((packet - RXCounter) * 100.0) / packet, 2); _ti.LOGSYSTEM += string.Format("PER = {0}%, Sent={1}, Received={2}\r\n", PER, packet, RXCounter); //So sánh PER với tiêu chuẩn bool _result = false; _result = PER <= stPER; return(_result); } catch { return(false); } }
private bool AutoCalibPower(testinginfo _ti, ModemTelnet ModemTelnet, Instrument instrument, string _CarrierFreq) { try { List <calibpower> list = null; _ti.LOGSYSTEM += "------------------------------------------------------------\r\n"; _ti.LOGSYSTEM += string.Format("Bắt đầu thực hiện quá trình Calib Công Suất {0}.\r\n", _CarrierFreq); list = _CarrierFreq == "2G" ? GlobalData.listCalibPower2G : GlobalData.listCalibPower5G; string _error = ""; bool _result = true; instrument.config_Instrument_Total(RF_Port, "g", ref _error); if (list.Count == 0) { return(true); } foreach (var item in list) { Stopwatch st = new Stopwatch(); st.Start(); string _eqChannel = string.Format("{0}000000", item.channelfreq); double _attenuator = Attenuator.getAttenuator(item.channelfreq, item.anten); string _channelNo = Attenuator.getChannelNumber(item.channelfreq); _ti.LOGSYSTEM += "*************************************************************************\r\n"; _ti.LOGSYSTEM += string.Format("{0} - {1} - 802.11g - MCS7 - BW20 - Anten {2} - Channel {3} - {4}\r\n", _CarrierFreq, RF_Port, item.anten, _channelNo, item.register); int count = 0; REP: count++; if (!Calibrate_Pwr_Detail(_ti, ModemTelnet, instrument, _CarrierFreq, RF_Port, item.anten, _eqChannel, item.register, _attenuator)) { if (count < 3) { goto REP; } _result = false; } st.Stop(); _ti.LOGSYSTEM += string.Format("Thời gian calib : {0} ms\r\n", st.ElapsedMilliseconds); _ti.LOGSYSTEM += "\r\n"; } return(_result); } catch { return(false); } }
private bool AutoVerifySignal(formattinfo _fi, ModemTelnet ModemTelnet, Instrument instrument, int _Id) { try { List <verifysignal> list = null; _fi.LOGDATA += "------------------------------------------------------------\r\n"; _fi.LOGDATA += string.Format("Bắt đầu thực hiện quá trình đo master power.\r\n"); list = GlobalData.listCalMaster; if (list.Count == 0) { return(false); } bool result = true; string _oldwifi = ""; foreach (var item in list) { Stopwatch st = new Stopwatch(); st.Start(); string _eqChannel = string.Format("{0}000000", item.channelfreq); double _attenuator = Attenuator.getAttenuator(item.channelfreq, item.anten); string _channelNo = Attenuator.getChannelNumber(item.channelfreq); string _wifi = ""; switch (item.wifi) { case "0": { _wifi = "b"; break; } case "1": { _wifi = "g"; break; } case "3": { _wifi = string.Format("n{0}", item.bandwidth == "0" ? "20" : "40"); break; } case "4": { switch (item.bandwidth) { case "0": { _wifi = "ac20"; break; } case "1": { _wifi = "ac40"; break; } case "2": { _wifi = "ac80"; break; } case "3": { _wifi = "ac160"; break; } } break; } } if (_oldwifi != _wifi) { string _error = ""; instrument.config_Instrument_Total(RF_Port, _wifi, ref _error); _oldwifi = _wifi; } _fi.LOGDATA = ""; _fi.LOGDATA += "*************************************************************************\r\n"; _fi.LOGDATA += string.Format("{0} - {1} - MCS{2} - BW{3} - Anten {4} - Channel {5}\r\n", RF_Port, FunctionSupport.Get_WifiStandard_By_Mode(item.wifi, item.bandwidth), item.rate, 20 * Math.Pow(2, double.Parse(item.bandwidth)), item.anten, _channelNo); int count = 0; REP: count++; if (!Verify_Signal(_fi, ModemTelnet, instrument, item.wifi, item.rate, item.bandwidth, _eqChannel, item.anten, _Id)) { if (count < 2) { _fi.LOGDATA += string.Format("RETRY = {0}\r\n", count); goto REP; } else { _fi.LOGDATA += string.Format("Phán định = {0}", "FAIL\r\n"); result = false; } } else { _fi.LOGDATA += string.Format("Phán định = {0}\r\n", "PASS"); } st.Stop(); _fi.LOGDATA += string.Format("Thời gian đo : {0} ms\r\n", st.ElapsedMilliseconds); _fi.LOGDATA += "\r\n"; if (GlobalData.mtIsOk == false) { result = false; break; } } //Save master data //if (result == true) Master.Save(); //else // System.Windows.MessageBox.Show("Mạch không đủ tiêu chuẩn làm Master.", "Master", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); return(result); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.ToString()); return(false); } }
private bool AutoVerifySignal(formattinfo _fi, ModemTelnet ModemTelnet, Instrument instrument) { List <verifysignal> list = null; _fi.LOGDATA += "------------------------------------------------------------\r\n"; _fi.LOGDATA += string.Format("Bắt đầu thực hiện quá trình đo suy hao.\r\n"); list = GlobalData.listCalAttenuator; if (list.Count == 0) { return(false); } bool result = true; string _oldwifi = ""; foreach (var item in list) { Stopwatch st = new Stopwatch(); st.Start(); string _eqChannel = string.Format("{0}000000", item.channelfreq); double _attenuator = Attenuator.getAttenuator(item.channelfreq, item.anten); string _channelNo = Attenuator.getChannelNumber(item.channelfreq); string _wifi = ""; switch (item.wifi) { case "0": { _wifi = "b"; break; } case "1": { _wifi = "g"; break; } case "3": { _wifi = string.Format("n{0}", item.bandwidth == "0" ? "20" : "40"); break; } case "4": { switch (item.bandwidth) { case "0": { _wifi = "ac20"; break; } case "1": { _wifi = "ac40"; break; } case "2": { _wifi = "ac80"; break; } case "3": { _wifi = "ac160"; break; } } break; } } if (_oldwifi != _wifi) { string _error = ""; instrument.config_Instrument_Total(RF_Port, _wifi, ref _error); _oldwifi = _wifi; } _fi.LOGDATA += "*************************************************************************\r\n"; _fi.LOGDATA += string.Format("{0} - {1} - MCS{2} - BW{3} - Anten {4} - Channel {5}\r\n", RF_Port, FunctionSupport.Get_WifiStandard_By_Mode(item.wifi, item.bandwidth), item.rate, 20 * Math.Pow(2, double.Parse(item.bandwidth)), item.anten, _channelNo); int count = 0; REP: count++; if (!Verify_Signal(_fi, ModemTelnet, instrument, item.wifi, item.rate, item.bandwidth, _eqChannel, item.anten)) { if (count < 2) { _fi.LOGDATA += string.Format("RETRY = {0}\r\n", count); goto REP; } else { _fi.LOGDATA += string.Format("Phán định = {0}", "FAIL\r\n"); result = false; } } else { _fi.LOGDATA += string.Format("Phán định = {0}\r\n", "PASS"); } st.Stop(); _fi.LOGDATA += string.Format("Thời gian đo suy hao : {0} ms\r\n", st.ElapsedMilliseconds); _fi.LOGDATA += "\r\n"; System.Threading.Thread.Sleep(1000); } return(result); }
private bool AutoVerifySignal(testinginfo _ti, ModemTelnet ModemTelnet, Instrument instrument, int _anten, string _CarrierFreq) { List <verifysignal> list = null; _ti.LOGSYSTEM += "------------------------------------------------------------\r\n"; _ti.LOGSYSTEM += string.Format("Bắt đầu thực hiện quá trình kiểm tra anten {0}.\r\n", _anten); list = _anten == 1 ? GlobalData.listTestAnten1 : GlobalData.listTestAnten2; if (list.Count == 0) { return(false); } bool result = true; string _oldwifi = ""; foreach (var item in list) { Stopwatch st = new Stopwatch(); st.Start(); string _eqChannel = string.Format("{0}000000", item.channelfreq); double _attenuator = Attenuator.getAttenuator(item.channelfreq, item.anten); string _channelNo = Attenuator.getChannelNumber(item.channelfreq); string _wifi = ""; switch (item.wifi) { case "0": { _wifi = "b"; break; } case "1": { _wifi = "g"; break; } case "3": { _wifi = string.Format("n{0}", item.bandwidth == "0" ? "20" : "40"); break; } case "4": { switch (item.bandwidth) { case "0": { _wifi = "ac20"; break; } case "1": { _wifi = "ac40"; break; } case "2": { _wifi = "ac80"; break; } case "3": { _wifi = "ac160"; break; } } break; } } if (_oldwifi != _wifi) { string _error = ""; instrument.config_Instrument_Total(RF_Port, _wifi, ref _error); _oldwifi = _wifi; } _ti.LOGSYSTEM += "*************************************************************************\r\n"; _ti.LOGSYSTEM += string.Format("{0} - {1} - {2} - MCS{3} - BW{4} - Anten {5} - Channel {6}\r\n", _CarrierFreq, RF_Port, FunctionSupport.Get_WifiStandard_By_Mode(item.wifi, item.bandwidth), item.rate, 20 * Math.Pow(2, double.Parse(item.bandwidth)), item.anten, _channelNo); int count = 0; string _Power = "", _Evm = "", _FreqErr = "", _pStd = "", _eMax = ""; REP: count++; if (!Verify_Signal(_ti, ModemTelnet, instrument, _CarrierFreq, item.wifi, item.rate, item.bandwidth, _eqChannel, item.anten, _attenuator, ref _Power, ref _Evm, ref _FreqErr, ref _pStd, ref _eMax)) { if (count < 2) { _ti.LOGSYSTEM += string.Format("RETRY = {0}\r\n", count); goto REP; } else { _ti.LOGSYSTEM += string.Format("Phán định = {0}", "FAIL\r\n"); result = false; } } else { _ti.LOGSYSTEM += string.Format("Phán định = {0}\r\n", "PASS"); } App.Current.Dispatcher.Invoke(new Action(() => { string _w = "", _bw = ""; switch (item.wifi) { case "0": { _w = "802.11b"; break; } case "1": { _w = "802.11g"; break; } case "2": { _w = "802.11a"; break; } case "3": { _w = "802.11n"; break; } case "4": { _w = "802.11ac"; break; } } switch (item.bandwidth) { case "0": { _bw = "20"; break; } case "1": { _bw = "40"; break; } case "2": { _bw = "80"; break; } case "3": { _bw = "160"; break; } } GlobalData.datagridlogTX.Add(new logreviewtx() { rangeFreq = _CarrierFreq, Anten = item.anten, wifiStandard = _w, Rate = "MCS" + item.rate, Bandwidth = _bw, Channel = _channelNo, Result = result == true ? "PASS" : "FAIL", averagePower = _Power, centerFreqError = _FreqErr, Evm = _Evm, powerStd = _pStd, evmMAX = _eMax }); })); st.Stop(); _ti.LOGSYSTEM += string.Format("Thời gian verify : {0} ms\r\n", st.ElapsedMilliseconds); _ti.LOGSYSTEM += "\r\n"; } return(result); }