private void StartMeasure() { StartChVal = int.Parse(this.comboBoxStrtCh.SelectedItem.ToString()); EndChVal = int.Parse(this.comboBoxEndCh.SelectedItem.ToString()); ChStep = int.Parse(this.comboBoxChStep.SelectedItem.ToString()); Range = this.comboBoxRange.SelectedIndex + 1; formProcess.progressBarTotal.Maximum = 0; formProcess.progressBarCurrent.Maximum = 1024; lvPlotOption.Items.Clear(); //ll.head = null; tlr = new TxLeakageRSSI(); ll = new LinkedList(); DTC1_idx = 0; DTC2_idx = 31; for (int i = StartChVal; i <= EndChVal; i = i + ChStep) { lvPlotOption.Items.Add(i.ToString()); formProcess.progressBarTotal.Maximum += 1024; } formProcess.Show(); if ((threadFullScan == null) || (threadFullScan.IsAlive == false)) { threadFullScan = new System.Threading.Thread(new System.Threading.ThreadStart(FullScan)); this.Enabled = false; threadFullScan.Start(); } }
public string GetPointInformation(int x, int y, int[] array) { string result = string.Empty; bool Selected = false; for (TxLeakageRSSI i = head; i != null; i = i.Next) { for (int s = 0; s < array.Length; s++) { if (array[s] == i.Ch) { Selected = true; break; } } if (Selected == true) { if ((x == i.MinDTC1) && (y == i.MinDTC2)) { result += "Channel : " + i.Ch.ToString() + "\r\n"; result += "(DTC1, DTC2) = " + "(" + i.MinDTC1.ToString() + ", " + i.MinDTC2.ToString() + ")" + "\r\n"; result += "RSSI : " + i.TLRval[x, y].ToString("N2") + "\r\n"; } } Selected = false; } return(result); }
public void valToTxt(string path) { for (TxLeakageRSSI i = head; i != null; i = i.Next) { i.tlrTotxt(path); } }
private void LoadToolStripButton_Click(object sender, EventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.AutoUpgradeEnabled = false; ofd.Title = "Open File"; ofd.Filter = "Text Files (*.txt)|*.txt"; ofd.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + "\\Plot\\RawData"; if (ofd.ShowDialog() == DialogResult.OK) { ll.head = null; lvPlotOption.Items.Clear(); StreamReader sr = new StreamReader(ofd.FileName); string line = string.Empty; string[] lineArr; int cnt = 0; while ((line = sr.ReadLine()) != null) { if (line.IndexOf("Channel") >= 0) { lineArr = line.Split(':'); lineArr[1] = lineArr[1].Trim(); tlr = new TxLeakageRSSI(); tlr.Ch = int.Parse(lineArr[1]); cnt = 0; } else { lineArr = line.Split('\t'); for (int i = 0; i < 32; i++) { tlr.TLRval[i, cnt] = double.Parse(lineArr[i]); } cnt++; if (cnt >= 32) { ll.addToHead(tlr.TLRval, tlr.Ch); lvPlotOption.Items.Add(tlr.Ch.ToString()); } } } sr.Close(); } } catch { } }
public void addToHead(double[,] tlr, int i) { TxLeakageRSSI item = new TxLeakageRSSI(); item.TLRval = tlr; item.Ch = i; item.Next = head; head = item; numNodes++; }
public string GetPointInformation(int ch, int x, int y) { string result = string.Empty; for (TxLeakageRSSI i = head; i != null; i = i.Next) { if (ch == i.Ch) { result = i.TLRval[x, y].ToString("N2"); } } return(result); }
public Bitmap SinglePlot(int ch) { Bitmap result = null; for (TxLeakageRSSI i = head; i != null; i = i.Next) { if (ch == i.Ch) { result = i.tlrTorgb(); } } return(result); }
public string GetPointInformation(int x, int y) { string result = string.Empty; for (TxLeakageRSSI i = head; i != null; i = i.Next) { if ((x == i.MinDTC1) && (y == i.MinDTC2)) { result += "Channel : " + i.Ch.ToString() + "\r\n"; result += "(DTC1, DTC2) = " + "(" + i.MinDTC1.ToString() + ", " + i.MinDTC2.ToString() + ")" + "\r\n"; result += "RSSI : " + i.TLRval[x, y].ToString("N2") + "\r\n"; } } return(result); }
private void FullScan() { byte i_dtc_112, i_dtc_113; DateTime current = DateTime.Now; byte[] DTC_POINT = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; TxLeakageTest = true; m_bTestProcess = true; if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_LEAK_CAL_MODE, new byte[] { 0 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Set RX Gain if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_RF_REG, new byte[] { 0x01, 0x04, 0x1C, 0x00, 0x1C, 0x00 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Set DCOC if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_RF_REG, new byte[] { 0x10, 0x11, 0xFF, 0xFF }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Disable AGC if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_MODEM_REG, new byte[] { 0xE0, 0xE0, 0x03, 0x58 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Set Inductor if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_INDUCTOR, new byte[] { (byte)Range }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // CW ON if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_CW, new byte[] { 0xFF }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; for (int i = StartChVal; i <= EndChVal; i = i + ChStep) { tlr = new TxLeakageRSSI(); RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_CH, new byte[] { (byte)i, 0 })); System.Threading.Thread.Sleep(500); InitProcessState(); for (i_dtc_112 = 0; i_dtc_112 < DTC_POINT.Length; i_dtc_112++) { for (i_dtc_113 = 0; i_dtc_113 < DTC_POINT.Length; i_dtc_113++) { // Set DTC Value (Address == 112) if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_DTC, new byte[] { 0x70, DTC_POINT[i_dtc_112] }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Set DTC Value (Address = 113) if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_DTC, new byte[] { 0x71, DTC_POINT[i_dtc_113] }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Set RSSI Enable if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_MODEM_REG, new byte[] { 0x90, 0x90, 0x03, 0x22 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Get RSSI if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_GET_MODEM_REG, new byte[] { 0x91, 0x92, 0x03 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; UpdateProcessState(); } } ll.addToHead(tlr.TLRval, i); } System.Threading.Thread.Sleep(30); // CW Off if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_CW, new byte[] { 0x00 }))) { } m_bTestProcess = false; System.Threading.Thread.Sleep(100); // Set RX Gain if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_RF_REG, new byte[] { 0x01, 0x04, 0xDC, 0x00, 0xDC, 0x00 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Enable AGC if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_MODEM_REG, new byte[] { 0xE0, 0xE0, 0x03, 0x59 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Set DCOC if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_RF_REG, new byte[] { 0x10, 0x11, 0xF0, 0x7F }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; // Enable Tx Leakage RSSI Report (Code:0xCA) if (!RcpProtocol.Instance.SendBytePkt(RcpProtocol.Instance.BuildCmdPacketByte(RcpProtocol.RCP_MSG_CMD, RcpProtocol.RCP_CMD_SET_LEAK_CAL_MODE, new byte[] { 1 }))) { } WaitForReceived(); TxLRP_Rx_Flag = false; TxLeakageTest = false; HideProcessState(); }
public LinkedList() { head = null; numNodes = 0; }
public Bitmap MultiPlot(int[] array) { Bitmap result = null; bool Selected = false; // Initialize Matrix with 0 (gonna be whited) for (int i = 0; i < 352; i++) { for (int j = 0; j < 352; j++) { SharedMatrix[i, j] = 255; } } for (TxLeakageRSSI k = head; k != null; k = k.Next) { for (int s = 0; s < array.Length; s++) { if (array[s] == k.Ch) { Selected = true; break; } } if (Selected == true) { k.mkUpSampledMatrix(); for (int i = 0; i < 352; i++) { for (int j = 0; j < 352; j++) { if (SharedMatrix[i, j] > k.TLRrgbUpSampled[i, j]) { SharedMatrix[i, j] = k.TLRrgbUpSampled[i, j]; } } } } Selected = false; } int width = 352, height = 352; result = new Bitmap(width, height); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { BiLinearInterpolation(i, j); } } Color temp = new Color(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { if (SharedMatrix[x, y] < 10) // Black -> Blue Section { temp = Color.FromArgb(255, 0, 0, (byte)((double)28.3 * (double)SharedMatrix[x, y])); } else if ((10 <= SharedMatrix[x, y]) && (SharedMatrix[x, y] < 30)) // Blue -> Teal Section { double r = GetColorFactor(x, y, 127 / (29 - 10), 10); temp = Color.FromArgb(255, 0, (byte)r, 255 - (byte)r); } else if ((30 <= SharedMatrix[x, y]) && (SharedMatrix[x, y] < 50)) // Teal -> Cyan { double r = GetColorFactor(x, y, 127 / (49 - 30), 30); temp = Color.FromArgb(255, 0, 128 + (byte)r, 128 + (byte)r); } else if ((50 <= SharedMatrix[x, y]) && (SharedMatrix[x, y] < 70)) // Cyan -> Spring Green { double r = GetColorFactor(x, y, 127 / (69 - 50), 50); temp = Color.FromArgb(255, 0, 255, 255 - (byte)r); } else if ((70 <= SharedMatrix[x, y]) && (SharedMatrix[x, y] < 90)) // Spring green -> Lime { double r = GetColorFactor(x, y, 127 / (89 - 70), 70); temp = Color.FromArgb(255, 0, 255, 127 - (byte)r); } else if ((90 <= SharedMatrix[x, y]) && (SharedMatrix[x, y] < 110)) // Lime -> Yellow { double r = GetColorFactor(x, y, 255 / (109 - 90), 90); temp = Color.FromArgb(255, (byte)r, 255, 0); } else if ((110 <= SharedMatrix[x, y]) && (SharedMatrix[x, y] < 140)) { double r = GetColorFactor(x, y, 90 / (139 - 110), 110); temp = Color.FromArgb(255, 255, 255 - (byte)r, 0); // yellow } else if ((140 <= SharedMatrix[x, y]) && (SharedMatrix[x, y] < 170)) // Orange -> Red { double r = GetColorFactor(x, y, 165 / (169 - 140), 140); temp = Color.FromArgb(255, 255, 165 - (byte)r, 0); } else if (170 <= SharedMatrix[x, y]) { temp = Color.FromArgb(255, 255, 0, 0); // red } result.SetPixel(x, y, temp); } } // make Point for (TxLeakageRSSI i = head; i != null; i = i.Next) { for (int s = 0; s < array.Length; s++) { if (array[s] == i.Ch) { Selected = true; break; } } if (Selected == true) { // min DTC1,DTC2 gonna be setted i.FindOptimzedDTC_Coordinate(); for (int j = 11 * i.MinDTC1; j < 11 * i.MinDTC1 + 11; j++) { for (int k = 11 * i.MinDTC2; k < 11 * i.MinDTC2 + 11; k++) { if (SharedMatrix[j, k] <= 30) { result.SetPixel(j, k, Color.Black); } } } } Selected = false; } for (int i = 55; i < 352; i += 55) { i++; for (int j = 13; j < 297; j += 55) { j++; result.SetPixel(i, j, Color.Black); result.SetPixel(i + 1, j, Color.Black); result.SetPixel(i, j + 1, Color.Black); result.SetPixel(i + 1, j + 1, Color.Black); } } return(result); }