public void TestParallelLaunch()
        {
            WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass());

            ParallelJsonLauncher.CopyAll(DatabaseSetup.AssemblyDirectory, wd.WorkingDirectory);
            using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
            {
                Logger.Info("Assembly directory: " + DatabaseSetup.AssemblyDirectory);
                Directory.SetCurrentDirectory(wd.WorkingDirectory);
                HouseCreationAndCalculationJob hcj = new HouseCreationAndCalculationJob();
                Simulator             sim          = new Simulator(db.ConnectionString);
                JsonCalcSpecification cspec        = JsonCalcSpecification.MakeDefaultsForTesting();
                cspec.DefaultForOutputFiles = OutputFileDefault.OnlySums;
                cspec.CalcOptions           = new List <CalcOption>();
                cspec.CalcOptions.Add(CalcOption.SumProfileExternalEntireHouse);
                hcj.CalcSpec = cspec;

                MakeSingleHouse(cspec, wd, hcj, sim.Houses[0], "house1");
                MakeSingleHouse(cspec, wd, hcj, sim.Houses[1], "house2");
                var fn = wd.Combine("profilegenerator.db3");
                hcj.PathToDatabase = fn;
                HouseJobSerializer.WriteJsonToFile(wd.Combine("hj2.json"), hcj);
                File.Copy(db.FileName, fn, true);
            }
            ParallelJsonLauncher.ThrowOnInvalidFile = true;
            ParallelJsonLauncher.ParallelJsonLauncherOptions options = new ParallelJsonLauncher.ParallelJsonLauncherOptions();
            options.JsonDirectory = wd.WorkingDirectory;
            ParallelJsonLauncher.LaunchParallel(options);
            //wd.CleanUp(1);
        }
 public void RunColumnEntryLoggerTest()
 {
     using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
     {
         ColumnEntryLogger     ael    = new ColumnEntryLogger(wd.SqlResultLoggingService);
         HouseholdKey          key    = new HouseholdKey("hhkey");
         List <IDataSaverBase> savers = new List <IDataSaverBase>
         {
             ael
         };
         InputDataLogger    idl  = new InputDataLogger(savers.ToArray());
         CalcLoadTypeDto    cltd = new CalcLoadTypeDto("ltname", "kw", "kwh", 1, false, "guid".ToStrGuid());
         CalcDeviceDto      cdd  = new CalcDeviceDto("device", "guid".ToStrGuid(), key, OefcDeviceType.Device, "devcatname", "", "guid".ToStrGuid(), "guid".ToStrGuid(), "loc");
         ColumnEntry        ce   = new ColumnEntry("name", 1, "locname", "guid".ToStrGuid(), key, cltd, "oefckey", "devicecategory", cdd);
         List <ColumnEntry> aes  = new List <ColumnEntry>
         {
             ce
         };
         idl.Save(aes);
         var res = ael.Read(key);
         var s1  = JsonConvert.SerializeObject(aes, Formatting.Indented);
         var s2  = JsonConvert.SerializeObject(res, Formatting.Indented);
         File.WriteAllText(wd.Combine("original.json"), s1);
         File.WriteAllText(wd.Combine("deserialized.json"), s2);
         s1.Should().Be(s2);
     }
     //wd.CleanUp();
 }
コード例 #3
0
 /*
  * private static void CopyAll([NotNull] DirectoryInfo source, [NotNull] DirectoryInfo target)
  * {
  *  Directory.CreateDirectory(target.FullName);
  *
  *  // Copy each file into the new directory.
  *  foreach (var fi in source.GetFiles())
  *  {
  *      Logger.Info(string.Format(CultureInfo.CurrentCulture, @"Copying {0}\{1}", target.FullName, fi.Name));
  *      fi.CopyTo(Path.Combine(target.FullName, fi.Name), true);
  *  }
  *
  *  // Copy each subdirectory using recursion.
  *  foreach (var diSourceSubDir in source.GetDirectories())
  *  {
  *      var nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
  *      CopyAll(diSourceSubDir, nextTargetSubDir);
  *  }
  * }*/
 public void RunDirectHouseholds()
 {
     using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
     {
         using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
         {
             Simulator sim = new Simulator(db.ConnectionString);
             string    dir = wd.Combine("DirectHouseJobs");
             if (!Directory.Exists(dir))
             {
                 Directory.CreateDirectory(dir);
             }
             foreach (var mhh in sim.ModularHouseholds.It)
             {
                 HouseCreationAndCalculationJob hj = new HouseCreationAndCalculationJob("Households", "2019", "TK", HouseDefinitionType.HouseData);
                 hj.House = new HouseData(Guid.NewGuid().ToStrGuid(), "HT01", 10000, 10000, "House for " + mhh.Name);
                 hj.House.Households.Add(new HouseholdData(Guid.NewGuid().ToString(),
                                                           mhh.Name, null, null,
                                                           null, null, HouseholdDataSpecificationType.ByHouseholdName));
                 hj.House.Households[0].HouseholdNameSpec = new HouseholdNameSpecification(mhh.GetJsonReference());
                 SetCalcSpec(hj, sim);
                 string fn = Path.Combine(dir, AutomationUtili.CleanFileName(mhh.Name) + ".json");
                 File.WriteAllText(fn, JsonConvert.SerializeObject(hj, Formatting.Indented));
             }
             //CopyAll(new DirectoryInfo(dir), new DirectoryInfo(@"X:\HouseJobs\Blockstrom\DirectHouseholds"));
         }
     }
 }
コード例 #4
0
        public void RunTest()
        {
            //make dummy csv file
            using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
            {
                string       csvfn = wd.Combine("mycsv.csv");
                StreamWriter sw    = new StreamWriter(csvfn);
                sw.WriteLine("Date;Value");
                sw.WriteLine("01.01.2019 00:00;1");
                sw.WriteLine("01.01.2019 00:01;2");
                sw.Close();
                CsvImportOptions cio = new CsvImportOptions();
                using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
                {
                    cio.Input     = csvfn;
                    cio.Delimiter = ";";
                    CsvTimeProfileImporter ctpi = new CsvTimeProfileImporter(db.ConnectionString);
                    if (!ctpi.Import(cio, out var dbp))
                    {
                        throw new LPGCommandlineException("Option not set. Cannnot proceed.");
                    }
                    if (dbp == null)
                    {
                        throw new LPGException("failed to import");
                    }

                    foreach (DateProfileDataPoint dataPoint in dbp.Datapoints)
                    {
                        Logger.Info(dataPoint.DateAndTimeString + " - " + dataPoint.Value);
                    }
                }
            }
        }
コード例 #5
0
 public void RunJsonCalculatorTestForExternalTimeResolutionJsonFile()
 {
     Logger.Get().StartCollectingAllMessages();
     using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
     {
         Directory.SetCurrentDirectory(wd.WorkingDirectory);
         using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
         {
             string dbPath = wd.Combine("my.db3");
             File.Copy(db.FileName, dbPath);
             Logger.Info("DB File Path: " + dbPath);
             JsonCalcSpecification jcs = new JsonCalcSpecification();
             if (jcs.CalcOptions == null)
             {
                 throw new LPGException("Calcoptions was null");
             }
             jcs.DefaultForOutputFiles = OutputFileDefault.NoFiles;
             jcs.CalcOptions.Add(CalcOption.SumProfileExternalIndividualHouseholdsAsJson);
             jcs.StartDate = new DateTime(2019, 1, 1);
             jcs.EndDate   = new DateTime(2019, 1, 3);
             jcs.ExternalTimeResolution = "00:15:00";
             jcs.LoadTypePriority       = LoadTypePriority.RecommendedForHouses;
             Simulator      sim = new Simulator(db.ConnectionString);
             JsonCalculator jc  = new JsonCalculator();
             jc.StartHousehold(sim, jcs, sim.Houses[0].GetJsonReference(), null);
         }
         Directory.SetCurrentDirectory(wd.PreviousCurrentDir);
         wd.CleanUp();
     }
 }
        private static void MakeSingleHouse([JetBrains.Annotations.NotNull] JsonCalcSpecification cspec, [JetBrains.Annotations.NotNull] WorkingDir wd, [JetBrains.Annotations.NotNull] HouseCreationAndCalculationJob hcj,
                                            [JetBrains.Annotations.NotNull] House house1, string housename)
        {
            cspec.OutputDirectory = housename;
            if (cspec.OutputDirectory == null)
            {
                throw new LPGException("Output directory was null");
            }
            var dirtodelete = wd.Combine(cspec.OutputDirectory);

            if (Directory.Exists(dirtodelete))
            {
                Directory.Delete(dirtodelete, true);
            }

            hcj.House = house1.MakeHouseData();
            HouseJobSerializer.WriteJsonToFile(wd.Combine(housename + ".json"), hcj);
        }
        public void RunSinglePredefinedJson()
        {
            Logger.Get().StartCollectingAllMessages();
            Logger.Threshold = Severity.Debug;
            const string srcfile = @"V:\Dropbox\LPGReleases\releases9.4.0\ExampleHouseJob-1.json";

            using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) {
                using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass())) {
                    FileInfo srcfi      = new FileInfo(srcfile);
                    string   targetfile = wd.Combine(srcfi.Name);
                    string   targetdb   = wd.Combine("profilegenerator.db3");
                    File.Copy(db.FileName, targetdb, true);
                    srcfi.CopyTo(targetfile, true);
                    Directory.SetCurrentDirectory(wd.WorkingDirectory);
                    HouseGenerator houseGenerator = new HouseGenerator();
                    houseGenerator.ProcessSingleHouseJob(targetfile, null);
                }
            }
        }
 public void HouseJobForHeatpump()
 {
     //setup
     Logger.Get().StartCollectingAllMessages();
     using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass())) {
         Simulator sim = new Simulator(db.ConnectionString);
         using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) {
             File.Copy(db.FileName, wd.Combine("profilegenerator.db3"));
             Directory.SetCurrentDirectory(wd.WorkingDirectory);
             //housedata
             HouseData houseData = new HouseData(Guid.NewGuid().ToStrGuid(),
                                                 "HT01", 10000, 1000, "HouseGeneratorJobHouse");
             HouseCreationAndCalculationJob houseJob = new HouseCreationAndCalculationJob(
                 "present", "2019", "trafokreis", HouseDefinitionType.HouseData);
             houseJob.House = houseData;
             var householdData = new HouseholdData(Guid.NewGuid().ToString(),
                                                   "blub", null, null, null, null, HouseholdDataSpecificationType.ByPersons);
             houseData.Households.Add(householdData);
             var persons = new List <PersonData> {
                 new PersonData(30, Gender.Male)
             };
             householdData.HouseholdDataPersonSpec = new HouseholdDataPersonSpecification(persons);
             houseJob.CalcSpec = new JsonCalcSpecification {
                 DefaultForOutputFiles = OutputFileDefault.NoFiles,
                 StartDate             = new DateTime(2017, 1, 1),
                 EndDate            = new DateTime(2017, 1, 3),
                 GeographicLocation = sim.GeographicLocations.FindFirstByName("Berlin", FindMode.Partial)
                                      ?.GetJsonReference() ??
                                      throw new LPGException("No Berlin in the DB"),
                                            TemperatureProfile = sim.TemperatureProfiles[0].GetJsonReference(),
                                            OutputDirectory    = wd.Combine("Results"),
                                            CalcOptions        = new List <CalcOption> {
                                                CalcOption.HouseSumProfilesFromDetailedDats, CalcOption.DeviceProfilesIndividualHouseholds,
                                                CalcOption.EnergyStorageFile, CalcOption.EnergyCarpetPlot,
                                                CalcOption.HouseholdContents
                                            }
             };
             StartHouseJob(houseJob, wd, "xxx");
         }
     }
 }
        private static void MakeAndCalculateHouseJob([JetBrains.Annotations.NotNull] HouseCreationAndCalculationJob houseJob,
                                                     [JetBrains.Annotations.NotNull] Simulator sim, [JetBrains.Annotations.NotNull] WorkingDir wd,
                                                     [JetBrains.Annotations.NotNull] DatabaseSetup db)
        {
//calcSpec
            houseJob.CalcSpec = new JsonCalcSpecification {
                DefaultForOutputFiles = OutputFileDefault.Reasonable,
                StartDate             = new DateTime(2017, 1, 1),
                EndDate            = new DateTime(2017, 1, 3),
                GeographicLocation = sim.GeographicLocations.FindFirstByName("Berlin", FindMode.Partial)
                                     ?.GetJsonReference() ??
                                     throw new LPGException("No Berlin in the DB"),
                                           TemperatureProfile = sim.TemperatureProfiles[0].GetJsonReference(),
                                           OutputDirectory    = wd.Combine("Results")
            };
            var dstDir = wd.Combine("profilegenerator.db3");

            File.Copy(db.FileName, dstDir, true);
            houseJob.PathToDatabase = dstDir;

            StartHouseJob(houseJob, wd, "xxx");
        }
コード例 #10
0
        public static void RunSingleHouse(Func <Simulator, HouseCreationAndCalculationJob> makeHj,
                                          Action <string> checkResults)
        {
            Logger.Get().StartCollectingAllMessages();
            Logger.Threshold = Severity.Debug;
            using (var wd = new WorkingDir(Utili.GetCallingMethodAndClass())) {
                using (var db = new DatabaseSetup(Utili.GetCallingMethodAndClass())) {
                    wd.SkipCleaning = true;
                    var targetdb = wd.Combine("profilegenerator.db3");
                    File.Copy(db.FileName, targetdb, true);
                    Directory.SetCurrentDirectory(wd.WorkingDirectory);
                    var sim            = new Simulator(db.ConnectionString);
                    var houseGenerator = new HouseGenerator();
                    var hj             = makeHj(sim);
                    houseGenerator.ProcessSingleHouseJob(hj, null, sim);
                    if (hj.CalcSpec == null)
                    {
                        throw new LPGException("calcspec was null");
                    }

                    checkResults(wd.Combine(hj.CalcSpec.OutputDirectory));
                }
            }
        }
 public void RunHouseholdTraitsWithDeviceCategories()
 {
     using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
     {
         using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
         {
             JsonDatabaseExporter      hte  = new JsonDatabaseExporter(db.ConnectionString);
             JsonDatabaseExportOptions hteo = new JsonDatabaseExportOptions();
             string jsonPath = wd.Combine("hhtraitexport.json");
             hteo.Output         = jsonPath;
             hteo.ProcessingType = TypesToProcess.HouseholdTraitsWithDeviceCategories;
             hte.Export(hteo);
         }
     }
 }
コード例 #12
0
 public void RunXlsDumperBasicTest()
 {
     using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
     {
         RowCollection rc = new RowCollection("mysheet");
         var           rb = XlsRowBuilder.Start("t1", "mytxt").Add("blub", 1).Add("blub2", 1);
         rc.Add(rb);
         var rb2 = XlsRowBuilder.Start("t1", "mytxt").Add("blub", 1).Add("blub5", 1);
         rc.Add(rb2);
         MyTst         mc  = new MyTst();
         RowCollection rc2 = new RowCollection("sheet2");
         var           rbc = XlsRowBuilder.GetAllProperties(mc);
         rc2.Add(rbc);
         XlsxDumper.WriteToXlsx(wd.Combine("t.xlsx"), rc, rc2);
     }
 }
 public void RunHouseholdTemplateTests()
 {
     using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
     {
         using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
         {
             JsonDatabaseExporter      hte  = new JsonDatabaseExporter(db.ConnectionString);
             JsonDatabaseExportOptions hteo = new JsonDatabaseExportOptions();
             string jsonPath = wd.Combine("hhexport.json");
             hteo.Output         = jsonPath;
             hteo.ProcessingType = TypesToProcess.HouseholdTemplates;
             hte.Export(hteo);
             JsonDatabaseImportOptions htio = new JsonDatabaseImportOptions {
                 Input = jsonPath, Type = TypesToProcess.HouseholdTemplates
             };
             JsonDatabaseImporter hti = new JsonDatabaseImporter(db.ConnectionString);
             hti.Import(htio);
         }
     }
 }
コード例 #14
0
        public void RunHouseholdTemplate()
        {
            using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
            {
                using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
                {
                    Simulator sim = new Simulator(db.ConnectionString);
                    string    dir = wd.Combine("DirectHouseJobs");
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }
                    Random rnd = new Random();

                    List <string> houseTypes = sim.HouseTypes.It.Select(x => x.Name.Substring(0, x.Name.IndexOf(" ", StringComparison.Ordinal))).ToList();
                    foreach (var mhh in sim.HouseholdTemplates.It)
                    {
                        for (int i = 0; i < 100; i++)
                        {
                            HouseCreationAndCalculationJob hj = new HouseCreationAndCalculationJob("TemplatedRandomHouseType", "2019", "TK", HouseDefinitionType.HouseData);
                            string ht = houseTypes[rnd.Next(houseTypes.Count)];
                            Logger.Info(ht);
                            hj.House = new HouseData(Guid.NewGuid().ToStrGuid(), ht, 10000, 10000, "House for " + mhh.Name + " " + i);
                            hj.House.Households.Add(new HouseholdData(Guid.NewGuid().ToString(), mhh.Name, null, null, null,
                                                                      null, HouseholdDataSpecificationType.ByTemplateName));
                            hj.House.Households[0].HouseholdTemplateSpec = new HouseholdTemplateSpecification(mhh.Name);
                            SetCalcSpec(hj, sim);
                            if (hj.CalcSpec?.CalcOptions == null)
                            {
                                throw new LPGException("calcoption not set");
                            }
                            hj.CalcSpec.CalcOptions.Add(CalcOption.EnergyCarpetPlot);
                            hj.CalcSpec.CalcOptions.Add(CalcOption.HouseSumProfilesFromDetailedDats);
                            string fn = Path.Combine(dir, AutomationUtili.CleanFileName(mhh.Name) + "." + i + ".json");
                            File.WriteAllText(fn, JsonConvert.SerializeObject(hj, Formatting.Indented));
                        }
                    }
                    //CopyAll(new DirectoryInfo(dir), new DirectoryInfo(@"X:\HouseJobs\Blockstrom\TemplatedHouses"));
                }
            }
        }
        public void RunModularHouseholdTests()
        {
            using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass()))
            {
                using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
                {
                    JsonDatabaseExporter      hte  = new JsonDatabaseExporter(db.ConnectionString);
                    JsonDatabaseExportOptions hteo = new JsonDatabaseExportOptions();
                    string jsonPath = wd.Combine("hhexport.json");
                    hteo.Output         = jsonPath;
                    hteo.ProcessingType = TypesToProcess.ModularHouseholds;
                    hte.Export(hteo);
                    Simulator sim1    = new Simulator(db.ConnectionString);
                    int       hhcount = sim1.ModularHouseholds.It.Count;
                    foreach (ModularHousehold household in sim1.ModularHouseholds.It)
                    {
                        household.DeleteFromDB();
                    }

                    foreach (var house in sim1.Houses.It)
                    {
                        var households = house.Households.ToList();
                        foreach (var household in households)
                        {
                            house.DeleteHouseholdFromDB(household);
                        }
                    }
                    Logger.Info("################################################");
                    Logger.Info("Finished deleting");
                    Logger.Info("################################################");
                    JsonDatabaseImportOptions htio = new JsonDatabaseImportOptions {
                        Input = jsonPath, Type = TypesToProcess.ModularHouseholds
                    };
                    JsonDatabaseImporter hti = new JsonDatabaseImporter(db.ConnectionString);
                    hti.Import(htio);
                    Simulator sim2 = new Simulator(db.ConnectionString);
                    hhcount.Should().Be(sim2.ModularHouseholds.It.Count);
                }
            }
        }
        private static void StartHouseJob([JetBrains.Annotations.NotNull] HouseCreationAndCalculationJob houseJob, [JetBrains.Annotations.NotNull] WorkingDir wd,
                                          string fnSuffix)
        {
            string houseJobFile = wd.Combine("houseJob." + fnSuffix + ".json");

            if (File.Exists(houseJobFile))
            {
                File.Delete(houseJobFile);
            }

            using (StreamWriter sw = new StreamWriter(houseJobFile)) {
                sw.WriteLine(JsonConvert.SerializeObject(houseJob, Formatting.Indented));
                sw.Close();
            }

            Logger.Info("======================================================");

            Logger.Info("======================================================");
            Logger.Info("starting house generation");
            Logger.Info("======================================================");
            HouseGenerator houseGenerator = new HouseGenerator();

            houseGenerator.ProcessSingleHouseJob(houseJobFile, null);
        }
        public void HouseJobForHouseTypes()
        {
            //setup
            Logger.Get().StartCollectingAllMessages();
            using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass())) {
                Simulator sim = new Simulator(db.ConnectionString);
                using (WorkingDir wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) {
                    var count = 0;
                    foreach (var houseType in sim.HouseTypes.It)
                    {
                        count++;
                        if (count < 22)
                        {
                            continue;
                        }

                        Logger.Info("================================================");
                        Logger.Info("================================================");
                        Logger.Info("================================================");
                        Logger.Info("Starting " + houseType.Name);
                        Logger.Info("================================================");
                        Logger.Info("================================================");
                        Logger.Info("================================================");
                        Logger.Get().StartCollectingAllMessages();
                        string htcode = houseType.Name.Substring(0, 4);
                        //housedata
                        const int targetheatdemand = 10000;
                        HouseData houseData        = new HouseData(Guid.NewGuid().ToStrGuid(), htcode, targetheatdemand, 1000,
                                                                   "HouseGeneratorJobHouse");
                        HouseCreationAndCalculationJob houseJob = new HouseCreationAndCalculationJob("present", "2019",
                                                                                                     "trafokreis", HouseDefinitionType.HouseData);
                        houseJob.House = houseData;

                        houseJob.CalcSpec = new JsonCalcSpecification {
                            DefaultForOutputFiles = OutputFileDefault.Reasonable,
                            StartDate             = new DateTime(2017, 1, 1),
                            EndDate            = new DateTime(2017, 12, 31),
                            GeographicLocation = sim.GeographicLocations.FindFirstByName("Berlin", FindMode.Partial)
                                                 ?.GetJsonReference() ??
                                                 throw new LPGException("No Berlin in the DB"),
                                                       TemperatureProfile = sim.TemperatureProfiles[0].GetJsonReference(),
                                                       OutputDirectory    = wd.Combine("Results." + htcode),
                                                       SkipExisting       = false,

                                                       CalcOptions = new List <CalcOption> {
                                                           CalcOption.HouseSumProfilesFromDetailedDats, CalcOption.DeviceProfilesIndividualHouseholds,
                                                           CalcOption.EnergyStorageFile, CalcOption.EnergyCarpetPlot,
                                                           CalcOption.HouseholdContents, CalcOption.TotalsPerLoadtype
                                                       },
                                                       DeleteDAT = false
                        };
                        StartHouseJob(houseJob, wd, htcode);
                        SqlResultLoggingService srls       = new SqlResultLoggingService(houseJob.CalcSpec.OutputDirectory);
                        HouseholdKeyLogger      hhkslogger = new HouseholdKeyLogger(srls);
                        var hhks = hhkslogger.Load();
                        TotalsPerLoadtypeEntryLogger tel = new TotalsPerLoadtypeEntryLogger(srls);
                        foreach (var entry in hhks)
                        {
                            if (entry.KeyType == HouseholdKeyType.General)
                            {
                                continue;
                            }

                            Logger.Info(entry.HHKey.ToString());
                            var res = tel.Read(entry.HHKey);
                            foreach (var totalsEntry in res)
                            {
                                Logger.Info(totalsEntry.Loadtype + ": " + totalsEntry.Value);
                                if (totalsEntry.Loadtype.Name == "Space Heating")
                                {
                                    if (Math.Abs(totalsEntry.Value - targetheatdemand) > 10)
                                    {
                                        throw new LPGException("Target heat demand didn't match for " + houseType.Name);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }