public void RunChartGeneratorTests()
        {
            Config.ReallyMakeAllFilesIncludingBothSums = true;
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              configSetter: x =>
            {
                x.ApplyOptionDefault(OutputFileDefault.All);
                x.Disable(CalcOption.MakeGraphics);
                x.Disable(CalcOption.MakePDF);
            });
            CalculationProfiler     cp  = new CalculationProfiler();
            ChartCreationParameters ccp = new ChartCreationParameters(144, 2000, 1000, false, GlobalConsts.CSVCharacter,
                                                                      new DirectoryInfo(cs.DstDir));

            using (var fft = cs.GetFileTracker())
            {
                ChartGeneratorManager cgm = new ChartGeneratorManager(cp, fft, ccp);
                Logger.Info("Making picture");
                cgm.Run(cs.DstDir);
            }
            Logger.Info("finished picture");
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              LoadTypePriority.Mandatory,
                              configSetter: x => x.Enable(CalcOption.TimeOfUsePlot));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var tou = new TimeOfUse(ccps, fft, cp);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("TimeOfUseProfiles.Electricity.csv");
                tou.MakePlot(rfe);
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "TimeOfUseProfiles.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              LoadTypePriority.Mandatory, null,
                              x => x.Enable(CalcOption.VariableLogFile));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new VariableLogFileChart(ccps, fft, cp);
                Logger.Info("Making picture");
                var di = new DirectoryInfo(cs.DstDir);

                var rfe = cs.GetRfeByFilename("Variablelogfile.HH1.csv");
                aeupp.MakePlot(rfe);

                Logger.Info("finished picture");
                //OxyCalculationSetup.CopyImage(ffe);

                var imagefiles = FileFinder.GetRecursiveFiles(di, "Variablelogfile.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 4
0
        public void MakePlotTestForHouse()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              LoadTypePriority.RecommendedForHouses,
                              configSetter: x =>
            {
                x.Enable(CalcOption.DeviceProfileExternalEntireHouse);
                x.ExternalTimeResolution = "00:30:00";
                x.CSVCharacter           = ";";
            }, useHouse: true);
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new DeviceProfilesExternal(ccps, fft, cp);
                Logger.Info("Making picture");
                var di = new DirectoryInfo(cs.DstDir);

                var rfe = cs.GetRfeByFilename("DeviceProfiles_1800s.Electricity.csv");
                aeupp.MakePlot(rfe);
                Logger.Info("finished picture");
                var imagefiles = FileFinder.GetRecursiveFiles(di, "DeviceProfiles*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 5
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              configSetter: x => x.Enable(CalcOption.LocationsFile));
            //cs.Wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(cs.Wd.SqlResultLoggingService));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                Logger.Info("Making picture");
                var di    = new DirectoryInfo(cs.DstDir);
                var files = FileFinder.GetRecursiveFiles(di, "LocationStatistics.HH1.csv");
                files.Count.Should().BeGreaterOrEqualTo(1);
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var locationStatistics = new LocationStatistics(ccps, fft, cp);
                var rfe = cs.GetRfeByFilename("LocationStatistics.HH1.csv");
                locationStatistics.MakePlot(rfe);
                Logger.Info("finished picture");
                //   OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "LocationStatistics.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
        public void MainHouseholdPlanTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              configSetter: x =>
            {
                x.ApplyOptionDefault(OutputFileDefault.OnlyDeviceProfiles);
                //x.Enable(CalcOption.MakeGraphics);
                x.Enable(CalcOption.HouseholdPlan);
            }
                              );
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var hp = new HouseholdPlan(ccps, fft, cp);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("HouseholdPlan.Times.CHR02 Couple Both working, over 30.HH1.csv");
                hp.MakePlot(rfe);
                Logger.Info("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "HouseholdPlan.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 7
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(2, GlobalConsts.CSVCharacter, LoadTypePriority.Mandatory,
                              configSetter: x =>
            {
                x.CSVCharacter = ";";
                x.ApplyOptionDefault(OutputFileDefault.NoFiles);
                x.Enable(CalcOption.DeviceProfileExternalEntireHouse);
                x.Enable(CalcOption.HouseholdContents);
                x.ExternalTimeResolution  = "01:00:00";
                x.SelectedEnergyIntensity = EnergyIntensityType.EnergySavingPreferMeasured;
                x.EndDateString           = "31.01.2012";
            }, energyIntensity: EnergyIntensityType.EnergySavingPreferMeasured);
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new DeviceProfilesExternal(ccps, fft, cp);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("DeviceProfiles_3600s.Electricity.csv");
                aeupp.MakePlot(rfe);
                Logger.Info("finished picture");
                var imagefiles = FileFinder.GetRecursiveFiles(di, "DeviceProfiles*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 8
0
        public void MakePlotMonthlyTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter, enddate: new DateTime(2012, 3, 31),
                              configSetter: x => x.Enable(CalcOption.TotalsPerDevice));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new DeviceSums(ccps, fft, cp);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("DeviceSums_Monthly.Electricity.csv");
                aeupp.MakePlotMonthly(rfe, "monthly sums", di);
                Logger.Info("finished picture");

                var imagefiles = FileFinder.GetRecursiveFiles(di, "DeviceSums_Monthly.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 9
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            //ChartLocalizer.ShouldTranslate = true;
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(2, GlobalConsts.CSVCharacter,
                              configSetter: x => x.Enable(CalcOption.ActivationFrequencies));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new AffordanceTaggingSet(ccps, fft, cp);
                Logger.Debug("Making picture");
                var             di  = new DirectoryInfo(cs.DstDir);
                ResultFileEntry rfe = cs.GetRfeByFilename("AffordanceTaggingSet.Wo bleibt die Zeit.HH1.csv");

                aeupp.MakePlot(rfe);
                Logger.Debug("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "AffordanceTaggingSet.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            Logger.Warning("Open threads for database: " + Connection.ConnectionCount);
            Command.PrintOpenConnections();
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 10
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              configSetter: x => x.Enable(CalcOption.ActivationFrequencies));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var afpm = new ActivityPercentage(ccps, fft, cp);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("ActivityPercentage.HH1.csv");
                afpm.MakePlot(rfe);
                Logger.Info("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "ActivityPercentage.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(2);
            }
            Logger.Warning("Leftover connections: " + Connection.ConnectionCount);
            cs.CleanUp();

            //CleanTestBase.Run(true);
        }
Exemplo n.º 11
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var start = DateTime.Now;
            //ChartLocalizer.ShouldTranslate = true;
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(2, GlobalConsts.CSVCharacter, configSetter: x =>
            {
                x.Enable(CalcOption.TotalsPerDevice);
                x.Enable(CalcOption.HouseholdContents);
            });
            var simend = DateTime.Now;

            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new DeviceTaggingSet(ccps, fft, cp);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("DeviceTaggingSet.Electricity.General.csv");
                aeupp.MakePlot(rfe);
                Logger.Info("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                Logger.Info("Simulation Time:" + (simend - start));
                Logger.Info("Chart Time:" + (DateTime.Now - simend));
                var imagefiles = FileFinder.GetRecursiveFiles(di, "DeviceTaggingSet.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 12
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(2, GlobalConsts.CSVCharacter, LoadTypePriority.Mandatory,
                              configSetter: x =>
            {
                x.Enable(CalcOption.DeviceProfilesIndividualHouseholds);
                x.Enable(CalcOption.HouseholdContents);
                x.SelectedEnergyIntensity = EnergyIntensityType.EnergySavingPreferMeasured;
                x.EndDateDateTime         = new DateTime(2012, 12, 31);
            }, energyIntensity: EnergyIntensityType.EnergySavingPreferMeasured);
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                DeviceProfiles.DaysToMake = 365;
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var calcParameters = new CalcParameterLogger(cs.Wd.SqlResultLoggingService).Load();
                var aeupp          = new DeviceProfiles(ccps, fft, cp, cs.Wd.SqlResultLoggingService, calcParameters);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("DeviceProfiles.Electricity.csv");
                aeupp.MakePlot(rfe);
                Logger.Info("finished picture");
                var imagefiles = FileFinder.GetRecursiveFiles(di, "DeviceProfiles.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
Exemplo n.º 13
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            Config.MakePDFCharts = false;
            //ChartLocalizer.ShouldTranslate = false;
            var cs  = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());
            var rep = cs.StartHousehold(2, GlobalConsts.CSVCharacter,
                                        configSetter: x =>
            {
                x.Enable(CalcOption.AffordanceEnergyUse);
                x.Enable(CalcOption.HouseSumProfilesFromDetailedDats);
                x.Enable(CalcOption.DeviceProfilesIndividualHouseholds);
            });

            if (rep == null)
            {
                throw new LPGException("Failed to simulate");
            }

            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                ChartCreationParameters ccps = new ChartCreationParameters(144, 4000, 2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                CalculationProfiler     cp   = new CalculationProfiler();

                var affordanceEnergyUsePerPerson = new AffordanceEnergyUsePerPerson(ccps, fft, cp, rep);
                Logger.Info("Making picture");
                var di = new DirectoryInfo(cs.DstDir);
                //var rfe = cs.GetRfeByFilename("AffordanceEnergyUsePerPerson.HH1.Electricity.csv");
                var keys = rep.HouseholdKeys;
                rep.FindTableByKey(ResultTableID.AffordanceEnergyUse, keys[1].HHKey);
                affordanceEnergyUsePerPerson.MakePlot(keys[1]);
                Logger.Info("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "AffordanceEnergyUsePerPerson.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            //CleanTestBase.Run(true);
        }
Exemplo n.º 14
0
        public void MakePlotTest()
        {
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              configSetter: x => x.Enable(CalcOption.TotalsPerDevice));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new DeviceSums(ccps, fft, cp);
                Logger.Info("Making picture");
                var di  = new DirectoryInfo(cs.DstDir);
                var rfe = cs.GetRfeByFilename("DeviceSums.Electricity.csv");
                aeupp.MakePlot(rfe);
                Logger.Info("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "DeviceSums.Electricity.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
        }