public static void ImportHouseholdDefinition([NotNull] HouseholdDefinitionImporterOptions o, [NotNull] string connectionString)
        {
            var sim = new Simulator(connectionString);

            try {
                var sett = ModularHouseholdSerializer.ImportFromCSV(o.File, sim);
                SimIntegrityChecker.Run(sim);
                var bo = new BatchOptions
                {
                    OutputFileDefault = OutputFileDefault.ReasonableWithCharts,
                    EnergyIntensity   = EnergyIntensityType.EnergySavingPreferMeasured
                };
                var count = 1;
                foreach (var settlement in sett)
                {
                    bo.Suffix         = "CSV" + count++;
                    bo.SettlementName = settlement.Name;
                    BatchfileFromSettlement.MakeBatchfileFromSettlement(sim, bo);
                }
            }
            catch (Exception ex) {
                Logger.Exception(ex);
                if (!Config.CatchErrors)
                {
                    throw;
                }
            }
        }
Beispiel #2
0
        //private static void MakeBatchfile([NotNull] string connectionString, CalcObjectType type) {
        //    Logger.Info("Loading...");
        //    var sim = new Simulator(connectionString);
        //    Logger.Info("Loading finished.");
        //    List<DBBase> items;
        //    string dirname;
        //    switch (type) {
        //        case CalcObjectType.ModularHousehold:
        //            items = new List<DBBase>(
        //                sim.ModularHouseholds.It.Where(x => !x.Name.StartsWith("x ", StringComparison.Ordinal)));
        //            dirname = "CHH";
        //            break;
        //        case CalcObjectType.House:
        //            items = new List<DBBase>(sim.Houses.It);
        //            dirname = "House";
        //            break;
        //        case CalcObjectType.Settlement:
        //            items = new List<DBBase>(sim.Settlements.It);
        //            dirname = "Settlement";
        //            break;
        //        default: throw new LPGException("Unknown type");
        //    }
        //    var batchfilename = "Start-" + type + ".cmd";
        //    using (var sw = new StreamWriter(batchfilename)) {
        //        for (var index = 0; index < items.Count; index++) {
        //            var cmd = "SimulationEngine.exe Calculate -CalcObjectType " + type + " -CalcObjectNumber " +
        //                      index +
        //                      " -OutputFileDefault Reasonable -LoadtypePriority RecommendedForHouses  -SkipExisting " +
        //                      " -OutputDirectory " + dirname + "_PDF_" + index + string.Empty;
        //            sw.WriteLine(cmd);
        //        }
        //    }
        //    Logger.Info("Finished writing to " + batchfilename);
        //}

        public static void RunProcessing([NotNull] BatchOptions bo, [NotNull] string connectionString)
        {
            if (bo.SettlementIndex != null)
            {
                BatchfileFromSettlement.MakeBatchfileFromSettlement(connectionString, bo);
            }
        }