예제 #1
0
        public void NormalizeWindSpeedStrategyMax()
        {
            var stationObservations = CreateTestData();

            var factory = new WindSpeedBinFactory();
            var target  = factory.Create(stationObservations, NormalizeWindSpeedStrategy.MaxWindSpeed);

            Assert.AreEqual(new[] { 3, 18, 9 }.Max(), target[0].NormalizedWindSpeed);
        }
예제 #2
0
        public async Task <IActionResult> GetAnalysis([FromBody] AnalysisRequestViewModel vm)
        {
            var stationObservations = await _aeolusApiService.GetStationObservations(vm.StationIdentifier, vm.Start, vm.End);

            var factory  = new WindSpeedBinFactory();
            var bins     = factory.Create(stationObservations, vm.Strategy);
            var analysis = new PowerGenerationAnalysis(stationObservations.Station, bins, vm);

            return(PartialView("_AnalysisResults", analysis));
        }
예제 #3
0
        public void StationAndDateCorrect()
        {
            var stationObservations = CreateTestData();

            var factory = new WindSpeedBinFactory();
            var target  = factory.Create(stationObservations, NormalizeWindSpeedStrategy.AverageWindSpeed);

            Assert.AreEqual(1, target.Length);
            Assert.AreEqual("TEST", target[0].StationIdentifier);
            Assert.AreEqual(new DateTime(2018, 11, 2), target[0].Date);
        }
예제 #4
0
        public void NormalizedWindSpeedStrategyMinNotChangedByNull()
        {
            var stationObservations = CreateTestData();

            stationObservations.Observations.Append(new Observation()
            {
                Timestamp = new DateTime(2018, 11, 2, 0, 30, 0, DateTimeKind.Utc),
                WindSpeed = null
            });

            var factory = new WindSpeedBinFactory();
            var target  = factory.Create(stationObservations, NormalizeWindSpeedStrategy.AverageWindSpeed);

            Assert.AreEqual(new[] { 3, 18, 9 }.Average(), target[0].NormalizedWindSpeed);
        }