コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 private static Func <MetricAnalogInput, bool> UniquenessBy(NidaqSingleton.Channel channel) =>
 p => p.Channel == channel && p.Type == NidaqSingleton.Channel.ChannelType.DigitalIn;
コード例 #5
0
 public MetricDigitalInput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g, XmlNode node) : this(device, channel, g)
 {
 }
コード例 #6
0
 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());
 }
コード例 #7
0
 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);
 }