当前位置: 首页>>代码示例>>C#>>正文


C# InputData.DataWithUnits方法代码示例

本文整理汇总了C#中InputData.DataWithUnits方法的典型用法代码示例。如果您正苦于以下问题:C# InputData.DataWithUnits方法的具体用法?C# InputData.DataWithUnits怎么用?C# InputData.DataWithUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputData的用法示例。


在下文中一共展示了InputData.DataWithUnits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadStream

        public IInputData ReadStream(NIDAQInputStream stream)
        {
            double quantity;
            if (stream.PhysicalChannelType == PhysicalChannelTypes.AI)
                quantity = ReadSingleAnalog(stream);
            else if (stream.PhysicalChannelType == PhysicalChannelTypes.DIPort)
                quantity = ReadSingleDigital(stream);
            else
                throw new NotSupportedException("Unsupported stream channel type");

            var inData =
                new InputData(
                    new List<IMeasurement> {new Measurement(quantity, 0, stream.DAQUnits)},
                    new Measurement(0, 0, "Hz"),
                    DateTimeOffset.Now)
                    .DataWithStreamConfiguration(stream, stream.Configuration);

            return inData.DataWithUnits(stream.MeasurementConversionTarget);
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:19,代码来源:NIHardwareDevice.cs

示例2: ReadStreamAsyncIO

        public IInputData ReadStreamAsyncIO(HekaDAQInputStream stream)
        {
            lock(this)
            {
                var channelData = new ITCMM.ITCChannelDataEx[]
                                      {
                                          new ITCMM.ITCChannelDataEx
                                              {
                                                  ChannelNumber = stream.ChannelNumber,
                                                  ChannelType = (ushort) stream.ChannelType
                                              }
                                      };

                uint err = ItcmmCall(() => ITCMM.ITC_AsyncIO(DevicePtr, 1, channelData));
                if (err != ITCMM.ACQ_SUCCESS)
                {
                    throw new HekaDAQException("Unable to read AsyncIO", err);
                }

                var inData =
                    new InputData(
                        new List<IMeasurement> {new Measurement(channelData[0].Value, 0, HekaDAQInputStream.DAQCountUnits)},
                        new Measurement(0, 0, "Hz"),
                        DateTimeOffset.Now)
                        .DataWithStreamConfiguration(stream, stream.Configuration);

                return inData.DataWithUnits(stream.MeasurementConversionTarget);
            }
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:29,代码来源:QueuedHekaHardwareDevice.cs

示例3: InputDataConversion

        public void InputDataConversion()
        {
            IDictionary<string, object> config = new Dictionary<string, object>(2);
            config["param1"] = 10;
            config["param2"] = 1;

            IMeasurement srate = new Measurement(1000, "Hz");

            IInputData data = new InputData(this.Data,
                srate,
                DateTimeOffset.Now,
                new PipelineNodeConfiguration(IOData.STREAM_CONFIGURATION_NAME, new Dictionary<string, object>()))
                .DataWithExternalDeviceConfiguration(devFake, new Dictionary<string, object>());

            Converters.Clear();
            ConvertProc fooConversion = (m) => new Measurement(m.QuantityInBaseUnits * 10, 1, "foo");
            Converters.Register("V", "foo", fooConversion);

            IInputData expected = new InputData(data,
                data.Data.Select(m => new Measurement(m.QuantityInBaseUnits * 10, 1, "foo")).ToList());

            Assert.NotNull(expected.NodeConfigurationWithName(IOData.STREAM_CONFIGURATION_NAME));
            IInputData actual = data.DataWithUnits("foo");

            Assert.AreEqual(expected.Data, actual.Data);
            Assert.That(actual.NodeConfigurationWithName(IOData.EXTERNAL_DEVICE_CONFIGURATION_NAME),
                Is.EqualTo(expected.NodeConfigurationWithName(IOData.EXTERNAL_DEVICE_CONFIGURATION_NAME)));
            Assert.That(actual.NodeConfigurationWithName(IOData.STREAM_CONFIGURATION_NAME),
                Is.EqualTo(expected.NodeConfigurationWithName(IOData.STREAM_CONFIGURATION_NAME)));
            Assert.AreEqual(expected.InputTime, actual.InputTime);
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:31,代码来源:IODataTests.cs


注:本文中的InputData.DataWithUnits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。