/// <summary> /// Prepares a continuous measurement /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event arguments</param> public void PrepareContinuousMeasurementBt_Click(out string errormess) { errormess = ""; try { // prepare a continuous measurement with 2 signals // use the first signals of the first 2 connectors // on the same device signalsToMeasure = new List <Signal>(); signalsToMeasure.Add(myDevice.Connectors[0].Channels[0].Signals[0]); signalsToMeasure.Add(myDevice.Connectors[1].Channels[0].Signals[0]); signalsToMeasure.Add(myDevice.Connectors[2].Channels[0].Signals[0]); signalsToMeasure.Add(myDevice.Connectors[3].Channels[0].Signals[0]); //set sample rate for signals List <Problem> problems = new List <Problem>(); //this list of problems will be used to get the problems during a assign process foreach (Signal sig in signalsToMeasure) { sig.SampleRate = 2400; //check what happens, if you assign e.g. sig.SampleRate = 1234; myDevice.AssignSignal(sig, out problems); if (problems.Count > 0) { foreach (Problem prob in problems) { // AddToLog("Problem with " + prob.PropertyName + " occurred: " + prob.Message); } } } // add the chosen signals to the measurement Measurement.AddSignals(myDevice, signalsToMeasure); // AddToLog("4 signals added to the measurement."); // prepare data acqusisition; Measurement.PrepareDaq(); // try overloaded version of PrepareDaq ( e.g. to control number of filled timestamps- default is "timeStamp for the first measurement value only") //_daqMeasurement.PrepareDaq(2400, 1, 2400, false, false);// use this to get a timeStamp and a status for each measurement value // AddToLog("Measurement is prepared."); } catch (Exception ex) { errormess = ex.Message; // MessageBox.Show(ex.Message, ex.ToString()); } }
/// <summary> /// Prepares a continuous measurement /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event arguments</param> public void PrepareContinuousMeasurement(int sampleRate, int interval, out string error) { error = ""; Signal0.Clear(); Signal1.Clear(); Signal2.Clear(); Signal3.Clear(); try { // prepare a continuous measurement with 2 signals // use the first signals of the first 2 connectors // on the same device tempSignal0 = myDevice.Connectors[0].Channels[0].Signals[0]; tempSignal1 = myDevice.Connectors[1].Channels[0].Signals[0]; tempSignal2 = myDevice.Connectors[2].Channels[0].Signals[0]; tempSignal3 = myDevice.Connectors[3].Channels[0].Signals[0]; signalsToMeasure = new List <Signal>(); signalsToMeasure.Add(myDevice.Connectors[0].Channels[0].Signals[0]); signalsToMeasure.Add(myDevice.Connectors[1].Channels[0].Signals[0]); signalsToMeasure.Add(myDevice.Connectors[2].Channels[0].Signals[0]); signalsToMeasure.Add(myDevice.Connectors[3].Channels[0].Signals[0]); //set sample rate for signals List <Problem> problems = new List <Problem>(); //this list of problems will be used to get the problems during a assign process foreach (Signal sig in signalsToMeasure) { sig.SampleRate = sampleRate;//check what happens, if you assign e.g. sig.SampleRate = 1234; //internal enum SampleRate { // _1Hz = 6300, // _2Hz = 6301, // _5Hz = 6302, // _10Hz = 6303, // _20Hz = 6326, // _25Hz = 6304, // _50Hz = 6305, // _75Hz = 6307, // _100Hz = 6308, // _150Hz = 6309, // _200Hz = 6310, // _300Hz = 6311, // _600Hz = 6313, // _1200Hz = 6315, // _2400Hz = 6317, // _4800Hz = 6319, // _9600Hz = 6320, // _19200Hz = 6345 //} myDevice.AssignSignal(sig, out problems); if (problems.Count > 0) { foreach (Problem prob in problems) { // AddToLog("Problem with " + prob.PropertyName + " occurred: " + prob.Message); } } } // add the chosen signals to the measurement Measurement.AddSignals(myDevice, signalsToMeasure); // AddToLog("4 signals added to the measurement."); // prepare data acqusisition; Measurement.PrepareDaq(); // try overloaded version of PrepareDaq ( e.g. to control number of filled timestamps- default is "timeStamp for the first measurement value only") //_daqMeasurement.PrepareDaq(2400, 1, 2400, false, false);// use this to get a timeStamp and a status for each measurement value // AddToLog("Measurement is prepared."); } catch (Exception ex) { error = ex.Message; // MessageBox.Show(ex.Message, ex.ToString()); } }