public void DAQ_TaskFunction() { float[] data = acquisitionUnit.ReadData(numValuesAtOnce); if (data.Length > 0) { for (int i = 0; i < data.Length; ++i) { f[i % numChannels][(i / numChannels)] = f[i % numChannels][(i / numChannels) + (data.Length / numChannels)]; //left shift of the values f[i % numChannels][(i / numChannels) + (data.Length / numChannels)] = f[i % numChannels][(i / numChannels) + (2 * data.Length / numChannels)]; f[i % numChannels][(i / numChannels) + (2 * data.Length / numChannels)] = f[i % numChannels][(i / numChannels) + (3 * data.Length / numChannels)]; f[i % numChannels][(i / numChannels) + (3 * data.Length / numChannels)] = f[i % numChannels][(i / numChannels) + (4 * data.Length / numChannels)]; f[i % numChannels][(i / numChannels) + (4 * data.Length / numChannels)] = data[i]; } FFT_isRunning = true; Filter_isRunning = true; // Make sure there are data to filter before filtering them } // if (t2 > (120 * 1000 / DAQ_hThread_PERIOD)) //refresh the buffer to avoid overflow : introduce artefact every 2minutes, but doesn't really bother the detection { acquisitionUnit.StopAcquisition(); acquisitionUnit.StartAcquisition(devices); t2 = 0; } ++t2; }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------- public void DAQ_TaskInit() // data acquisition { DAQ_isRunning = true; acquisitionUnit = new DataAcquisitionUnit(); //determine how many bytes should be read and processed at once by the processing thread (not the acquisition thread!) numChannels = 0; foreach (DeviceConfiguration deviceConfiguration in devices.Values) { numChannels += (deviceConfiguration.SelectedChannels.Count + Convert.ToInt32(deviceConfiguration.TriggerLineEnabled)); } numValuesAtOnce = (int)Math.Floor(numScans * numChannels * NumSecondsRunning); acquisitionUnit.StartAcquisition(devices); f = new double[numChannels][]; for (int j = 0; j < numChannels; ++j) { f[j] = new double[(int)Math.Floor(5 * numScans * NumSecondsRunning)]; //save 5*NumSecondsRunning } }
public void DAQ_TaskInit() { DAQ_isRunning = true; //data = new double[] { 1.0, 2.0, 3.3, 4.7 }; acquisitionUnit = new DataAcquisitionUnit(); //create device configurations Dictionary <string, DeviceConfiguration> devices = CreateDefaultDeviceConfigurations("UB-2011.11.15"); //determine how many bytes should be read and processed at once by the processing thread (not the acquisition thread!) numScans = 512; numChannels = 0; foreach (DeviceConfiguration deviceConfiguration in devices.Values) { numChannels += (deviceConfiguration.SelectedChannels.Count + Convert.ToInt32(deviceConfiguration.TriggerLineEnabled)); } numValuesAtOnce = numScans * numChannels; acquisitionUnit.StartAcquisition(devices); f = new double[numChannels][]; for (int j = 0; j < numChannels; ++j) { f[j] = new double[numScans * NumSecondsRunning]; } x = 0; }