예제 #1
0
        public DeltaTsOperatorTest()
        {
            m_Delta = new DeltaTsOperator();
            m_t0 = new DateTime(2015, 01, 01, 0, 0, 0, 0);
            m_t1 = new DateTime(2015, 02, 01, 0, 0, 0, 0);
            m_t2 = new DateTime(2015, 02, 02, 0, 0, 0, 0);

            m_Tvq5 = new Tvq(m_t0, 5, Quality.Ok);
            m_Tvq7 = new Tvq(m_t1, 7, Quality.Ok);
            m_Tvq11 = new Tvq(m_t2, 11, Quality.Ok);
        }
예제 #2
0
        public static Timeseries GetMonthlyAverages(string registerId)
        {
            var storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting("StorageConnectionString"));

            var repo = new RegistryEntryRepo(storageAccount);
            var sortedTvqs = repo.GetRegistryEntries().OrderBy(x => x.Time);

            var tsWithRegisterEntries = new Timeseries();
            tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

            var periodizer = new Periodizer();
            var monthlyRegisterEntries = periodizer.MonthlyAverage(tsWithRegisterEntries);

            var deltaOperator = new DeltaTsOperator();
            var monthlyAverages = deltaOperator.Apply(monthlyRegisterEntries);

            return monthlyAverages;
        }
예제 #3
0
        public static Timeseries GetMonthlyAverages()
        {
            var repo = new RegistryEntryRepoFactory().GetRegistryEntryRepo();
            var sortedTvqs = repo.GetRegistryEntries(Thread.CurrentPrincipal).OrderBy(x => x.Time);

            var tsWithRegisterEntries = new Timeseries();
            tsWithRegisterEntries.AddRange(sortedTvqs.ToList());

            var periodizer = new Periodizer();
            var monthlyRegisterEntries = periodizer.MonthlyAverage(tsWithRegisterEntries);

            const int minMonths = 2;
            var tooFewEntries = monthlyRegisterEntries.Count < minMonths;
            var areTooFewEntries = tooFewEntries;
            if (areTooFewEntries)
            {
                throw new TooFewEntriesException(minMonths);
            }

            var deltaOperator = new DeltaTsOperator();
            var monthlyAverages = deltaOperator.Apply(monthlyRegisterEntries);

            return monthlyAverages;
        }