Beispiel #1
0
        public static string GetResultArchiveDirectory([NotNull] ScenarioSliceParameters slice,
                                                       DateTime startingTime,
                                                       [NotNull] RunningConfig config,
                                                       RelativeDirectory relativeDir,
                                                       [CanBeNull] string chapter)
        {
            string date     = FilenameHelpers.CleanFileName(startingTime.ToString("yyyy-MM-dd"));
            string scenario = slice.GetFileName();

            if (slice.SmartGridEnabled)
            {
                scenario += "smart";
            }

            string resultArchiveDirectory = Path.Combine(config.Directories.ResultStorageDirectory, date, scenario, relativeDir.ToString());

            if (chapter != null)
            {
                resultArchiveDirectory = Path.Combine(config.Directories.ResultStorageDirectory,
                                                      "Abschlussbericht",
                                                      date,
                                                      "Kapitel " + chapter,
                                                      scenario);
            }

            if (!Directory.Exists(resultArchiveDirectory))
            {
                Directory.CreateDirectory(resultArchiveDirectory);
                Thread.Sleep(250);
            }

            return(resultArchiveDirectory);
        }
        public void RunProfileGenerationUtopia()
        {
            List <Stage> ptr = new List <Stage> {
                //Stage.ProfileGeneration,
                Stage.ProfileAnalysis
            };
            var myOptions = new List <Options> {
                Options.ReadFromExcel, Options.AddPresent
            };
            RunningConfig settings = RunningConfig.MakeDefaults();

            settings.MyOptions.Clear();
            settings.MyOptions.AddRange(myOptions);
            settings.StagesToExecute.Clear();
            settings.StagesToExecute.AddRange(ptr);
            settings.MakeCharts = true;
            settings.NumberOfTrafokreiseToProcess = -1;
            settings.LimitToScenarios.Add(Scenario.FromEnum(ScenarioEnum.Utopia));
            settings.MakeHouseSums = true;
            settings.LimitToYears.Add(2050);
            using (Logger logger = new Logger(_output, settings)) {
                settings.InitializeSlices(logger);
                RunBasedOnSettings(settings, logger);
            }
        }
Beispiel #3
0
        public void Run([NotNull] RunArgument args)
        {
            MainBurgdorfStatisticsCreator mb = new MainBurgdorfStatisticsCreator(null);

            if (!File.Exists(args.Filename))
            {
                Console.WriteLine("No config found.");
            }

            if (args.Filename == null)
            {
                throw new FlaException("filename was null");
            }
            RunningConfig rconfig = RunningConfig.Load(args.Filename);

            Console.WriteLine("Starting...");
            Console.WriteLine("Config is:");
            Console.WriteLine(JsonConvert.SerializeObject(rconfig, Formatting.Indented));
            Console.WriteLine("----");
            Logger logger = new Logger(null, rconfig);

            logger.Info("initializing slices", Stage.Preparation, nameof(Program));
            rconfig.InitializeSlices(logger);
            rconfig.CheckInitalisation();
            mb.RunBasedOnSettings(rconfig, logger);
        }
        public void RunSingleParameterSlice()
        {
            _output?.WriteLine("This is output from {0}", "RunSingleParameterSlice");
            RunningConfig settings = RunningConfig.MakeDefaults();

            settings.MyOptions.Add(Options.ReadFromExcel);
            settings.LimitToYears.Add(2050);
            settings.LimitToScenarios.Add(Scenario.FromEnum(ScenarioEnum.Utopia));
            settings.MakeCharts = false;
            using (Logger logger = new Logger(_output, settings)) {
                settings.InitializeSlices(logger);
                using (var container = CreateBuilderContainer(_output, logger, settings)) {
                    using (var scope = container.BeginLifetimeScope()) {
                        if (settings.Slices == null)
                        {
                            throw new FlaException("slices was not initalized");
                        }

                        ScenarioSliceParameters ssp = settings.Slices[0];
                        //ssp = Constants.PresentSlice;
                        var s1 = scope.Resolve <Z_GeneralExporter>();
                        s1.RunForScenarios(ssp);
                        var pm = scope.Resolve <PlotMaker>();
                        pm.Finish();
                        PngSvgConverter con = new PngSvgConverter(logger, Stage.Preparation);
                        con.ConvertAllSVG(settings);
                        logger.SaveToDatabase(Constants.PresentSlice);
                    }
                }
            }
        }
        public void RebuildHouses()
        {
            List <Stage> ptr = new List <Stage> {
                Stage.Raw,
                Stage.Complexes,
                Stage.ComplexEnergyData,
                Stage.Houses
            };
            var myOptions = new List <Options> {
                Options.ReadFromExcel, Options.AddPresent
            };
            RunningConfig settings = RunningConfig.MakeDefaults();

            settings.MyOptions.Clear();
            settings.MyOptions.AddRange(myOptions);
            settings.StagesToExecute.Clear();
            settings.StagesToExecute.AddRange(ptr);
            settings.MakeCharts                         = true;
            settings.CollectFilesForArchive             = false;
            settings.NumberOfTrafokreiseToProcess       = -1;
            settings.LimitLoadProfileGenerationToHouses = 50;
            settings.LimitToScenarios.Add(Scenario.Present());
            using (Logger logger = new Logger(_output, settings)) {
                settings.InitializeSlices(logger);
                RunBasedOnSettings(settings, logger);
            }
        }
Beispiel #6
0
        public WorkingDirectory([NotNull] Logger logger, [NotNull] RunningConfig config) : base(logger, Stage.Preparation, nameof(WorkingDirectory))
        {
            string baseDir       = Path.Combine(config.Directories.BaseProcessingDirectory, "unittests");
            string callingMethod = GetCallingMethodAndClass();

            Info("Base dir: " + baseDir);
            Info("Calling Method: " + callingMethod);
            Dir = Path.Combine(baseDir, FilenameHelpers.CleanFileName(callingMethod));
            Info("Used Directory: " + Dir);
            DirDi = new DirectoryInfo(Dir);
            if (DirDi.Exists)
            {
                try {
                    DirDi.Delete(true);
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception ex) {
#pragma warning restore CA1031 // Do not catch general exception types
                    logger.ErrorM(ex.Message, Stage.Preparation, nameof(WorkingDirectory));
                }

                Thread.Sleep(250);
            }

            DirDi.Create();
            Thread.Sleep(250);
        }
        public void RunVarTuning()
        {
            List <double> energyuses;
            RunningConfig rc = RunningConfig.MakeDefaults();

            using (var sr = new StreamReader(Path.Combine(rc.Directories.BaseUserSettingsDirectory, "energyuses.json"))) {
                energyuses = JsonConvert.DeserializeObject <List <double> >(sr.ReadToEnd());
            }

            var peopleCounts = new Dictionary <int, int>();

            for (var i = 0; i < 10; i++)
            {
                peopleCounts.Add(i, 0);
            }

            var sum = 0;

            foreach (var energy in energyuses)
            {
                var people = GetPeopleCountForEnergy(energy);
                peopleCounts[people]++;
                sum += people;
            }

            foreach (var pair in peopleCounts)
            {
                Info(pair.Key + ": " + pair.Value);
            }

            Info("Total: " + sum);
        }
Beispiel #8
0
        public Profile Run([NotNull] RunningConfig config)
        {
            var data   = new Tooling.SAM.Data();
            var module = InitializeModule(data, PVSystemKey, AcPower, DcAcRatio, config);
            var result = ExecuteCalculation(module, data, AcPower, PVSystemKey);

            Info("Processing setting " + _idx);
            Result = result;
            Profile p = result.GetProfile();
            Profile pa;

            if ((p.Values.Count > 500000) & (p.Values.Count < 600000))
            {
                //1 minute resolution, need to reduce.
                pa = p.ReduceTimeResolutionFrom1MinuteTo15Minutes();
            }
            else if (p.Values.Count > 35000 && p.Values.Count < 36000)
            {
                pa = p;
            }
            else
            {
                throw new FlaException("Unknown time resolution");
            }

            return(pa);
        }
Beispiel #9
0
        public static string MakeAndRegisterFullFilenameStatic([NotNull] string filename,
                                                               Stage stage,
                                                               int sequenceNumber,
                                                               [NotNull] string name,
                                                               [NotNull] ScenarioSliceParameters slice,
                                                               [NotNull] RunningConfig config,
                                                               bool replaceSpaces)
        {
            if (replaceSpaces)
            {
                filename = filename.Replace(" ", "");
            }

            var fullpath = GetTargetDirectory(stage, sequenceNumber, name, slice, config);

            if (!Directory.Exists(fullpath))
            {
                Directory.CreateDirectory(fullpath);
                Thread.Sleep(500);
            }

            var fullName = Path.Combine(fullpath, filename);

            if (_usedFileNames.ContainsKey(fullName))
            {
                throw new FlaException("File already registered: " + fullName + " @ this location:\n" + _usedFileNames[fullName] +
                                       " \n--------------------------\n");
            }

            StackTrace t = new StackTrace();

            _usedFileNames.Add(fullName, t.ToString());
            return(fullName);
        }
Beispiel #10
0
        private static Module InitializeModule([NotNull] Tooling.SAM.Data data,
                                               PVSystemKey key,
                                               float powerinKw,
                                               float dcAcRatio,
                                               [NotNull] RunningConfig config)
        {
            data.SetString("solar_resource_file", Path.Combine(config.Directories.SamDirectory, "2050_V1_1.csv"));
            // data.SetString( "solar_resource_file", "C:/Users/Pan2/Downloads/weather/tmy_era_47.056_7.585_2005_2014.epw" );
            data.SetNumber("system_capacity", powerinKw);
            data.SetNumber("module_type", 0f);
            data.SetNumber("dc_ac_ratio", dcAcRatio);
            data.SetNumber("inv_eff", 96f);
            data.SetNumber("losses", 14.075660705566406f);
            data.SetNumber("array_type", 0f);
            data.SetNumber("tilt", key.Tilt);
            data.SetNumber("azimuth", key.Azimut);
            data.SetNumber("gcr", 0.40000000596046448f);
            data.SetNumber("adjust:constant", 0f);
            var module = new Module("pvwattsv5");

            if (null == module)
            {
                throw new FlaException("error: could not create 'pvwattsv5' module.");
            }

            return(module);
        }
        public void RebuildScenarios()
        {
            List <Stage> ptr = new List <Stage> {
                Stage.ScenarioCreation,
                Stage.ScenarioVisualisation
            };
            var myOptions = new List <Options> {
                Options.ReadFromExcel, Options.AddPresent
            };
            RunningConfig settings = RunningConfig.MakeDefaults();

            settings.MyOptions.Clear();
            settings.MyOptions.AddRange(myOptions);
            settings.StagesToExecute.Clear();
            settings.StagesToExecute.AddRange(ptr);
            settings.MakeCharts = false;
            settings.NumberOfTrafokreiseToProcess = -1;
            settings.LimitToScenarios.Clear();
            settings.LimitToScenarios.Add(Scenario.FromString("Utopia"));
            settings.LimitToScenarios.Add(Scenario.FromString("Dystopia"));
            settings.LimitToScenarios.Add(Scenario.FromString("Nep"));
            settings.LimitToScenarios.Add(Scenario.FromString("Pom"));
            settings.LimitToScenarios.Add(Scenario.Present());
            using (Logger logger = new Logger(_output, settings)) {
                settings.InitializeSlices(logger);
                RunBasedOnSettings(settings, logger);
            }
        }
Beispiel #12
0
 private void saveNewPriceBTN_Click(object sender, EventArgs e)
 {
     if (addNewPrice)
     {
         // adding new price to the database
         try
         {
             string title = newPriceNameTB.Text;
             //string c = newPriceCostTB.Text.Substring(1);
             double        cost      = (double)newPriceCostNUD.Value;
             string        setupTime = "0:0:0";
             int           countUp   = priceTypeStandardRBTN.Checked ? 0 : 1;
             RunningConfig rc        = new RunningConfig(0, title, cost, setupTime, countUp);
             db.NewConfiguration(rc);
             PopulateCurrentPriceOptions();
         } catch (FormatException)
         {
             newPriceNameTB.Text = "Invalid price entry. " + newPriceCostNUD.Value;
             //newPriceCostTB.Text = "$0.00";
         }
     }
     else
     {
     }
 }
        public static IContainer CreateBuilderContainer([CanBeNull] ITestOutputHelper unittestoutput,
                                                        [NotNull] Logger logger,
                                                        [NotNull] RunningConfig rc)
        {
            ContainerBuilder builder = new ContainerBuilder();

            builder.Register(_ => rc).As <RunningConfig>().SingleInstance();
            builder.Register(_ => logger).As <Logger>().As <ILogger>().SingleInstance();
            builder.Register(_ => unittestoutput).As <ITestOutputHelper>().SingleInstance();
            Random rnd = new Random(1);

            builder.Register(x => rnd).As <Random>().SingleInstance();
            builder.Register(x => new ServiceRepository(x.Resolve <PlotMaker>(),
                                                        x.Resolve <MapDrawer>(),
                                                        x.Resolve <Logger>(),
                                                        x.Resolve <RunningConfig>(),
                                                        x.Resolve <Random>())).As <ServiceRepository>().As <IServiceRepository>().SingleInstance();

            // import
            builder.RegisterType <OsmMapDrawer>().As <OsmMapDrawer>().SingleInstance();
            builder.RegisterType <PlotMaker>().As <PlotMaker>().SingleInstance();
            builder.Register(x => new MapDrawer(x.Resolve <ILogger>(), Stage.Plotting)).As <MapDrawer>().SingleInstance();
            var mainAssembly = Assembly.GetAssembly(typeof(MainBurgdorfStatisticsCreator));

            builder.RegisterAssemblyTypes(mainAssembly).Where(t => t.GetInterfaces().Contains(typeof(IBasicRunner))).AsSelf().As <IBasicRunner>();
            var container = builder.Build();

            return(container);
        }
Beispiel #14
0
 public Logger([CanBeNull] ITestOutputHelper unittestoutput, [NotNull] RunningConfig config)
 {
     config.CheckInitalisation();
     _unittestoutput = unittestoutput;
     _config         = config;
     _myThread       = ThreadProvider.Get().MakeThreadAndStart(SafeRun, "Logger");
     SLogger.Init(this);
 }
        public void RunTest()
        {
            RunningConfig rc = RunningConfig.MakeDefaults();
            BusinessProfileOverrideRepository bpoe = new BusinessProfileOverrideRepository(rc);

            bpoe.GetEntry("blub", "blub", "blub").Should().BeNull();
            bpoe.GetEntry("bla", "bla", "bla").Should().NotBeNull();
        }
Beispiel #16
0
 public ServiceRepository([NotNull] PlotMaker plotMaker, [NotNull] MapDrawer mapDrawer, [NotNull] MySqlConnection sqlConnection, [NotNull] Logger logger,
                          [NotNull] RunningConfig runningConfig, [NotNull] Random rnd)
 {
     PlotMaker     = plotMaker;
     MapDrawer     = mapDrawer;
     SqlConnection = sqlConnection;
     Logger        = logger;
     MyLogger      = logger;
     RunningConfig = runningConfig;
     Rnd           = rnd;
 }
Beispiel #17
0
        public RunningConfig PullConfig(string title)
        {
            RunningConfig    rc  = null;
            string           sql = "SELECT * FROM " + cfgTbl + " WHERE " + cfgTblV[1] + "='" + title + "'";
            SQLiteDataReader dr  = ReadExe(sql);

            while (dr.Read())
            {
                rc = new RunningConfig((int)dr[cfgTblV[0]], (string)dr[cfgTblV[1]], (double)dr[cfgTblV[2]], (string)dr[cfgTblV[3]], (int)dr[cfgTblV[4]]);
            }
            dbc.Close();
            return(rc);
        }
Beispiel #18
0
        public void MakeConfig([NotNull] ExampleArgs ex)
        {
            string fn = ex.Filename;

            if (fn == null)
            {
                throw new FlaException("filename was null");
            }
            var rc = RunningConfig.MakeDefaults();

            rc.SaveThis(fn);
            Console.WriteLine("Finished writing the config file to " + fn + "");
        }
Beispiel #19
0
        private void PriceOptionSelectedChanged()
        {
            int selIndex = priceOptionsDD.SelectedIndex;

            if (selIndex < configIDs.Count)
            {
                int id = configIDs[selIndex];
                if (pricingConfigs.ContainsKey(id))
                {
                    RunningConfig rc = pricingConfigs[id];
                    priceRateLBL.Text = rc.HourRate.ToString("$#0.00") + " / HOUR";
                }
            }
        }
Beispiel #20
0
        public Dictionary <int, RunningConfig> AllConfigs()
        {
            Dictionary <int, RunningConfig> rc = new Dictionary <int, RunningConfig>();
            RunningConfig    rcc = null;
            string           sql = "SELECT * FROM " + cfgTbl;
            SQLiteDataReader dr  = ReadExe(sql);

            while (dr.Read())
            {
                rcc = new RunningConfig(Convert.ToInt32((long)dr[cfgTblV[0]]), (string)dr[cfgTblV[1]], (double)dr[cfgTblV[2]], (string)dr[cfgTblV[3]], Convert.ToInt32((long)dr[cfgTblV[4]]));
                rc.Add(Convert.ToInt32((long)dr[cfgTblV[0]]), rcc);
            }
            return(rc);
        }
 public ServiceRepository([NotNull] PlotMaker plotMaker,
                          [NotNull] MapDrawer mapDrawer,
                          [NotNull] Logger logger,
                          [NotNull] RunningConfig runningConfig,
                          [NotNull] Random rnd)
 {
     PlotMaker             = plotMaker;
     MapDrawer             = mapDrawer;
     Logger                = logger;
     MyLogger              = logger;
     RunningConfig         = runningConfig;
     Rnd                   = rnd;
     SqlConnectionPreparer = new SqlConnectionPreparer(runningConfig);
     StartingTime          = DateTime.Now;
 }
        public void WriteListOfStages()
        {
            RunningConfig rc     = RunningConfig.MakeDefaults();
            List <string> stages = new List <string>();

            foreach (string name in Enum.GetNames(typeof(Stage)))
            {
                stages.Add(name);
            }

            using (StreamWriter sw = new StreamWriter(Path.Combine(rc.Directories.BaseProcessingDirectory, "Stages.Json"))) {
                sw.WriteLine(JsonConvert.SerializeObject(stages, Formatting.Indented));
                sw.Close();
            }
        }
Beispiel #23
0
 public MyDb(Stage stage,
             [JetBrains.Annotations.NotNull] ScenarioSliceParameters slice,
             [JetBrains.Annotations.NotNull] NPoco.Database database,
             [JetBrains.Annotations.NotNull] RunningConfig config,
             [JetBrains.Annotations.NotNull] string connectionString,
             [JetBrains.Annotations.NotNull] string dbFilename,
             DatabaseCode dbCode)
 {
     _slice            = slice;
     _config           = config;
     _connectionString = connectionString;
     _dbCode           = dbCode;
     MyStage           = stage;
     _database         = database;
     DBFilename        = dbFilename;
 }
        public void RunSingleParameterSliceForAllScenarios()
        {
            RunningConfig settings = RunningConfig.MakeDefaults();
            List <Stage>  ptr      = new List <Stage> {
                Stage.ScenarioCreation
//                Stage.ScenarioVisualisation,
            };

            settings.StagesToExecute.Clear();
            settings.StagesToExecute.AddRange(ptr);
            settings.MyOptions.Add(Options.ReadFromExcel);
            settings.LimitToScenarios.Add(Scenario.FromEnum(ScenarioEnum.Utopia));
            Logger logger = new Logger(_output, settings);

            settings.InitializeSlices(logger);

            using (var container = CreateBuilderContainer(_output, logger, settings)) {
                using (var scope = container.BeginLifetimeScope()) {
                    List <RunableForSingleSliceWithBenchmark> stuffToRun = new List <RunableForSingleSliceWithBenchmark> {
                        scope.Resolve <A01_Houses>()
                    };
                    if (settings.Slices == null)
                    {
                        throw new FlaException("slices was not initalized");
                    }

                    foreach (var slice in settings.Slices)
                    {
                        logger.Info("#######################################", Stage.Preparation, nameof(MainBurgdorfStatisticsCreator));
                        logger.Info(slice.DstYear + " - " + slice.DstScenario, Stage.Preparation, nameof(MainBurgdorfStatisticsCreator));
                        logger.Info("#######################################", Stage.Preparation, nameof(MainBurgdorfStatisticsCreator));
                        foreach (var runable in stuffToRun)
                        {
                            runable.RunForScenarios(slice);
                        }

                        logger.SaveToDatabase(slice);
                    }

                    var pm = scope.Resolve <PlotMaker>();
                    pm.Finish();
                    PngSvgConverter con = new PngSvgConverter(logger, Stage.Preparation);
                    con.ConvertAllSVG(settings);
                }
            }
        }
        private static void ProcessSliceSteps([ItemNotNull][NotNull] List <IBasicRunner> steps,
                                              [NotNull] Logger logger,
                                              [NotNull] RunningConfig settings,
                                              [NotNull] Dictionary <string, double> secondsPerStep,
                                              Stage currentStage)
        {
            var sliceSteps = steps.Select(x => (RunableForSingleSliceWithBenchmark)x).ToList();

            if (settings.Slices == null)
            {
                throw new FlaException("slices was not initalized");
            }

            List <int> years = settings.Slices.Select(x => x.DstYear).Distinct().ToList();

            years.Sort((x, y) => x.CompareTo(y));
            foreach (var year in years)
            {
                logger.Info("Processing " + year, Stage.Preparation, nameof(MainBurgdorfStatisticsCreator));
                var slicesForYear = settings.Slices.Where(x => x.DstYear == year).ToList();
                foreach (var step in sliceSteps)
                {
                    foreach (ScenarioSliceParameters sliceParameters in slicesForYear)
                    {
                        if (sliceParameters.Equals(Constants.PresentSlice) && currentStage == Stage.ScenarioCreation)
                        {
                            continue;
                        }

                        Stopwatch sw = Stopwatch.StartNew();
                        step.RunForScenarios(sliceParameters);
                        logger.SaveToDatabase(sliceParameters);
                        var stepname = step.Name;
                        sw.Stop();
                        if (!secondsPerStep.ContainsKey(stepname))
                        {
                            secondsPerStep.Add(stepname, 0);
                        }

                        secondsPerStep[stepname] += sw.ElapsedMilliseconds / 1000.0;
                    }
                }

                logger.Info("Finished Processing " + year, Stage.Preparation, nameof(MainBurgdorfStatisticsCreator));
            }
        }
        public void RunSave()
        {
            RunningConfig settings = RunningConfig.MakeDefaults();

            settings.MyOptions.Clear();
            settings.MyOptions.Add(Options.ReadFromExcel);
            settings.StagesToExecute.Clear();
            settings.StagesToExecute.Add(Stage.ScenarioCreation);
            settings.InitializeSlices(Logger);
            WorkingDirectory wd   = new WorkingDirectory(Logger, settings);
            string           path = wd.Combine("calcsettings.json");

            settings.SaveThis(path);
            RunningConfig loadedSettings = RunningConfig.Load(path);

            Assert.Equal(settings.MyOptions.Count, loadedSettings.MyOptions.Count);
            Assert.Equal(settings.StagesToExecute.Count, loadedSettings.StagesToExecute.Count);
        }
        public void RunSingleRunableStep()
        {
            RunningConfig rc = RunningConfig.MakeDefaults();

            using (Logger logger = new Logger(_output, rc)) {
                using (var container = CreateBuilderContainer(_output, logger, rc)) {
                    using (var scope = container.BeginLifetimeScope()) {
                        var s1 = scope.Resolve <E01_ScenarioDefinitionSheetFixer>();
                        s1.Run();
                        var pm = scope.Resolve <PlotMaker>();
                        pm.Finish();
                        PngSvgConverter con = new PngSvgConverter(logger, Stage.Preparation);
                        con.ConvertAllSVG(rc);
                        logger.SaveToDatabase(Constants.PresentSlice);
                        Process.Start(s1.GetThisTargetDirectory());
                    }
                }
            }
        }
        public void CopyCurrentVersionToStatistics()
        {
            RunningConfig rc = RunningConfig.MakeDefaults();
            FileInfo      fi = new FileInfo(Assembly.GetExecutingAssembly().Location);

            string dstPath = Path.Combine(rc.Directories.BaseProcessingDirectory, "exe", fi.Name);

            fi.CopyTo(dstPath, true);
            DirectoryInfo di = fi.Directory;

            if (di != null)
            {
                FileInfo[] fis = di.GetFiles("*.dll");
                foreach (FileInfo info in fis)
                {
                    string dstFile = Path.Combine(rc.Directories.BaseProcessingDirectory, "exe", info.Name);
                    info.CopyTo(dstFile, true);
                }
            }
        }
Beispiel #29
0
        public void ResultReport([NotNull] RunArgument args)
        {
            if (!File.Exists(args.Filename))
            {
                Console.WriteLine("No config found.");
            }
            if (args.Filename == null)
            {
                throw new FlaException("filename was null");
            }
            RunningConfig rconfig = RunningConfig.Load(args.Filename);

            Console.WriteLine("Starting...");
            Console.WriteLine("Config is:");
            Console.WriteLine(JsonConvert.SerializeObject(rconfig, Formatting.Indented));
            Console.WriteLine("----");
            Logger          logger = new Logger(null, rconfig);
            ReportGenerator rgbt   = new ReportGenerator(logger);

            rgbt.Run(rconfig);
        }
        public void RunIsnImport()
        {
            RunningConfig rc = RunningConfig.MakeDefaults();

            using (Logger logger = new Logger(_output, rc)) {
                using (var container = CreateBuilderContainer(_output, logger, rc)) {
                    using (var scope = container.BeginLifetimeScope()) {
                        var s1 = scope.Resolve <A02_DirenIsnImport>();
                        s1.Run();
                        var s2 = scope.Resolve <C07_SupplementalISN>();
                        s2.Run();
                        var pm = scope.Resolve <PlotMaker>();
                        pm.Finish();
                        PngSvgConverter con = new PngSvgConverter(logger, Stage.Preparation);
                        con.ConvertAllSVG(rc);
                        logger.SaveToDatabase(Constants.PresentSlice);
                        Process.Start(s2.GetThisTargetDirectory());
                    }
                }
            }
        }