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


C# Dataset.AddSensor方法代码示例

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


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

示例1: TestMissingValues

        public void TestMissingValues()
        {
            var contact = new Contact("Jim", "Does", "[email protected]", "Lollipops", "837773");
            var dataSet = new Dataset(new Site(4, "New Site", "Tim Jones", contact, contact, new GPSCoords(0, 0, "argis")));

            var sensor = new Sensor("Dummy Sensor", "Does stuff", 10, 0, "C", 5, dataSet);

            sensor.AddState(new SensorState(sensor, DateTime.Now));
            sensor.CurrentState.Values.Add(new DateTime(1990, 5, 1, 4, 0, 0), 15);
            sensor.CurrentState.Values.Add(new DateTime(1990, 5, 1, 5, 0, 0), 15);
            sensor.CurrentState.Values.Add(new DateTime(1991, 8, 2, 0, 0, 0), 15);

            dataSet.AddSensor(sensor);

            dataSet.DataInterval = 60;

            dataSet.HighestYearLoaded = 1;

            Assert.AreEqual(60, dataSet.DataInterval);

            var missingValues = missingValuesDetector.GetDetectedValues(sensor);

            for (var i = new DateTime(1990, 5, 1, 6, 0, 0); i < new DateTime(1991, 8, 2, 0, 0, 0); i = i.AddHours(1))
            {
                Assert.Contains(new ErroneousValue(i, missingValuesDetector, sensor), missingValues);
            }
        }
开发者ID:rwlamont,项目名称:AllItUp,代码行数:27,代码来源:MissingValuesDetectorTests.cs

示例2: ExportAsCSVCorrectValueCount

        public void ExportAsCSVCorrectValueCount()
        {
            var dateTime = new DateTime(2011, 8, 4, 0, 0, 0);
            var givenDataSet = new Dataset(new Site(1, "Steven", "Kerry", Contact, Contact, new GPSCoords(0, 0, "arcGis")));
            var sampleData = new Dictionary<DateTime, float> { { dateTime.AddMinutes(15), 100 }, { dateTime.AddMinutes(30), 100 }, { dateTime.AddMinutes(45), 100 }, { dateTime.AddMinutes(60), 100 } };
            var s = new Sensor("Awesome Sensor", "Awesome");
            var ss = new SensorState(s, DateTime.Now, sampleData, null);
            s.AddState(ss);
            givenDataSet.AddSensor(s);

            Assert.AreEqual(4, givenDataSet.ExpectedDataPointCount);

            dateTime = new DateTime(2011, 8, 4, 0, 0, 0);
            givenDataSet = new Dataset(new Site(1, "Steven", "Kerry", Contact, Contact, new GPSCoords(0, 0, "arcGis")));

            sampleData = new Dictionary<DateTime, float> { { dateTime.AddMinutes(60), 100 }, { dateTime.AddMinutes(75), 100 }, { dateTime.AddMinutes(90), 100 }, { dateTime.AddMinutes(105), 100 } };
            s = new Sensor("Awesome Sensor", "Awesome");
            ss = new SensorState(s, DateTime.Now, sampleData, null);
            s.AddState(ss);
            givenDataSet.AddSensor(s);

            Assert.AreEqual(4, givenDataSet.ExpectedDataPointCount);
        }
开发者ID:rwlamont,项目名称:AllItUp,代码行数:23,代码来源:DatasetExporterTest.cs

示例3: ExportCSVWithIndividualDateColumns

        public void ExportCSVWithIndividualDateColumns()
        {
            var dateTime = new DateTime(2011, 8, 4, 0, 0, 0);
            var givenDataSet = new Dataset(new Site(1, "Steven", "Kerry", Contact, Contact, new GPSCoords(0, 0, "arcGis")));
            var sampleData = new Dictionary<DateTime, float> { { dateTime.AddMinutes(15), 100 }, { dateTime.AddMinutes(30), 100 }, { dateTime.AddMinutes(45), 100 }, { dateTime.AddMinutes(60), 100 } };
            var s = new Sensor("Awesome Sensor", "Awesome");
            var ss = new SensorState(s, DateTime.Now, sampleData, null);
            s.AddState(ss);
            givenDataSet.AddSensor(s);

            DatasetExporter.Export(givenDataSet, _outputFilePath, ExportFormat.CSV, true, false, false, ExportedPoints.AllPoints, DateColumnFormat.OneDateColumn, loadInUnloadedValues: false);

            Assert.AreEqual(DatasetOutputWithIndividualColumns, File.ReadAllText(_outputFilePath));
        }
开发者ID:rwlamont,项目名称:AllItUp,代码行数:14,代码来源:DatasetExporterTest.cs


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