/// <summary> /// AO写入数据AI读取数据 /// </summary> private void AOWriteAIRead() { //配置AI与AO AIConfig(); AOConfig(); //添加延时 aotask.SamplesToUpdate = writeValue.Length; aitask.SamplesToAcquire = writeValue.Length + (int)numericUpDownDelaySamples.Value; readValue = new double[aitask.SamplesToAcquire, aitask.Channels.Count]; //AO写入数据 AI读取数据 aotask.WriteData(writeValue, -1); aotask.Start(); aitask.Start(); aitask.SendSoftTrigger(); aitask.ReadData(ref readValue, -1); TempInput = new double[writeValue.Length]; TempOutput = new double[writeValue.Length]; for (int k = 0; k < writeValue.Length; k++) { TempInput[k] = readValue[k, 0]; //TempInput[k] = writeValue[k]; TempOutput[k] = readValue[k + (int)numericUpDownDelaySamples.Value, 1]; } aotask.WaitUntilDone(-1); aotask.Stop(); aotask.Channels.Clear(); aitask.Stop(); aitask.Channels.Clear(); //WriteData(); }
/// <summary> /// 启动流盘任务 /// </summary> public override void Start() { startTime = DateTime.Now; currentTime = startTime.ToString("m") + "_" + Convert.ToString(startTime.Hour) + "_" + Convert.ToString(startTime.Minute) + "_" + Convert.ToString(startTime.Second); if (FilePath != null) { _recordDone = false; _previewBufferLock = new Mutex(); txtFileStream = new FileStream(FilePath + "\\" + currentTime + ".txt", FileMode.Create); _fs = new FileStream(FilePath + "\\" + currentTime + ".bin", FileMode.OpenOrCreate); _wt = new BinaryWriter(_fs); WriteInfoToTxt(txtFileStream); txtFileStream.Close(); aitask.Start(); _thdFetchAndWriteData = new Thread(ThdFetchAndWriteData); _thdFetchAndWriteData.Start(); } else { throw new Exception("请指定文件保存路径!"); } }
public void Start() { AITask.Start(); }