本文整理汇总了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);
}
}
示例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);
}
示例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));
}