public void MakeShortRawList2() { while (!ShallStop) { for (int i = 0; i < 1000; i++) { FullList.Add(_collection.Take()); // Adds 1000 samples into the treatment list. This is equivalent to 1 s worth of data from the transducer } if (FullList.Count >= 2000 && DownsampledRawList.Count < 300) { for (int i = FullList.Count - 1000; i < FullList.Count; i += 17) // Starts downsampling from the 1000th measured sample. Downsampling 17 (8+1+8) { Total = 0; Average = 0; Total = FullList[i - 8].Voltage + FullList[i - 7].Voltage + FullList[i - 6].Voltage + FullList[i - 5].Voltage + FullList[i - 4].Voltage + FullList[i - 3].Voltage + FullList[i - 2].Voltage + FullList[i - 1].Voltage + FullList[i].Voltage + FullList[i + 1].Voltage + FullList[i + 2].Voltage + FullList[i + 3].Voltage + FullList[i + 4].Voltage + FullList[i + 5].Voltage + FullList[i + 6].Voltage + FullList[i + 7].Voltage + FullList[i + 8].Voltage; // Finds sum of voltage value of points in question Average = Total / 17; // Finds average Time++; DownsampledRawList.Add(new RawData(Time, Average)); // Saves average and time to downsampled list. The downsampled list is used for the filter. } } if (DownsampledRawList.Count == 236) { Thread.Sleep(50); } } }
public void MakeGraphList2() { while (!ShallStop) { Thread.Sleep(70); //if (60 <= DownsampledRawList.Count && DownsampledRawList.Count <= 300) if (DownsampledRawList.Count == 236) { Done(); for (int i = DownsampledRawList.Count - 60; i < DownsampledRawList.Count; i++) { int graphcounter = +1; //GraphList.Add(new ConvertedData(DownsampledRawList[i].Second, ConvertAlgorithm.ConvertData(DownsampledRawList[i].Voltage))); //GraphList.Add(new ConvertedData(DownsampledRawList[i].Second, DownsampledRawList[i].Voltage)); GraphList.Add(new ConvertedData(graphcounter, DownsampledRawList[i].Voltage)); DownsampledRawList.RemoveAt(i); } // Done(); } } }