public MetricAnalogOutput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g) : base("AO " + channel.Path, g, UniquenessBy(channel)) { _portIn = new NodeSystemLib2.FormatData1D.InputPortData1D(this, "In"); Channel = channel; Device = device; Session = NidaqSingleton.Instance.AddToSession(this); }
public MetricDigitalInput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g) : base("DI " + channel.Path, g, UniquenessBy(channel)) { _portOut = new NodeSystemLib2.FormatData1D.OutputPortData1D(this, "Out"); Channel = channel; Device = device; lineNum = int.Parse(Channel.Path.Split('/').Last().Last().ToString()); // only add to session after the initialization is done Session = NidaqSingleton.Instance.AddToSession(this); _portOut.Samplerate = Session.GetTask <NidaqSessionDigitalIn>(Device).ClockRate; }
public SettingsDigitalOut(NidaqSingleton.Device dev, string clockPath, int bufferLength, int prebufferLength) { InitializeComponent(); numericUpDownBufferLength.Value = bufferLength; numericUpDownPreBufferLength.Value = prebufferLength; comboBoxClockSource.Text = clockPath; var terms = new StringBuilder(10000); var result = NidaQmxHelper.DAQmxGetDevTerminals(dev.Name, terms, terms.Capacity - 1); if (result >= 0) { comboBoxClockSource.Items.AddRange(terms.ToString().Split(',')); } }
public SettingsDigitalIn(NidaqSingleton.Device dev, NidaqSessionDigitalIn.ClockSource clockSrc, string clockPath, int clockRate) { InitializeComponent(); comboBoxClock.DataSource = Enum.GetValues(typeof(NidaqSessionDigitalIn.ClockSource)); comboBoxClock.SelectedItem = clockSrc; comboBoxClockSource.Text = clockPath; textBoxClockRate.Text = clockRate.ToString(); var terms = new StringBuilder(10000); var result = NidaQmxHelper.DAQmxGetDevTerminals(dev.Name, terms, terms.Capacity - 1); if (result >= 0) { comboBoxClockSource.Items.AddRange(terms.ToString().Split(',')); } }
public MetricAnalogInput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g) : base("AI " + channel.Path, g, UniquenessBy(channel)) { _portOut = new NodeSystemLib2.FormatData1D.OutputPortData1D(this, "Out"); Channel = channel; Device = device; // only add to session after the initialization is done Session = NidaqSingleton.Instance.AddToSession(this); _attrVMax = new AttributeValueDouble(this, "Vmax"); _attrVMin = new AttributeValueDouble(this, "Vmin"); _attrTerminalCfg = new AttributeValueEnum <NidaQmxHelper.TerminalCfg>(this, "TerminalConfig"); _attrVMax.SetRuntimeReadonly(); _attrVMin.SetRuntimeReadonly(); _attrTerminalCfg.SetRuntimeReadonly(); }
public void AnalogWrite(NidaqSingleton.Device dev, int channelNumber, double[] data, int offset, int samples) { var task = GetTask <NidaqSessionAnalogOut>(dev); if (task == null) { System.Diagnostics.Debug.WriteLine("Nidaq: Can't query task from session. Result null"); SessionGraph.AsyncEmergencyStop(null); return; } try { int written = task.Write(channelNumber, data, offset, samples); if (written != samples) { System.Diagnostics.Debug.WriteLine("Didn't write " + (samples - written)); } } catch (NationalInstruments.DAQmx.DaqException e) { System.Diagnostics.Debug.WriteLine("Nidaq: Error while writing: " + e.Message); SessionGraph.AsyncEmergencyStop(null); } }
public NidaqSessionAnalogIn(NidaqSingleton.Device dev, NidaqSession parent) { Parent = parent; Device = dev; }
public NidaqSessionDigitalIn(NidaqSingleton.Device device, NidaqSession parent) { Parent = parent; Device = device; }
public NidaqSessionDigitalOut(NidaqSingleton.Device dev, NidaqSession parent) { Parent = parent; Device = dev; }
public MetricDigitalInput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g, XmlNode node) : this(device, channel, g) { }
public MetricAnalogInput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g, XmlNode node) : this(device, channel, g) { _attrVMax.Deserialize(node.Attributes.GetNamedItem(_attrVMax.Name)?.Value ?? "10"); _attrVMin.Deserialize(node.Attributes.GetNamedItem(_attrVMin.Name)?.Value ?? "-10"); _attrTerminalCfg.Deserialize(node.Attributes.GetNamedItem(_attrTerminalCfg.Name)?.Value ?? NidaQmxHelper.TerminalCfg.RSE.ToString()); }
public T GetTask <T>(NidaqSingleton.Device dev) where T : INidaqSessionTask { return((T)_tasks.FirstOrDefault(task => task is T && task.Device == dev)); }
public MetricAnalogOutput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g, XmlNode node) : this(device, channel, g) { VMax = double.Parse(node.Attributes.GetNamedItem("vmax")?.Value ?? "10", System.Globalization.CultureInfo.InvariantCulture); VMin = double.Parse(node.Attributes.GetNamedItem("vmin")?.Value ?? "-10", System.Globalization.CultureInfo.InvariantCulture); }