static HouseCreationAndCalculationJob PrepareHousejob(Simulator sim) { var hj = new HouseCreationAndCalculationJob(); hj.CalcSpec = JsonCalcSpecification.MakeDefaultsForTesting(); hj.CalcSpec.StartDate = new DateTime(2020, 1, 1); hj.CalcSpec.EndDate = new DateTime(2020, 1, 3); hj.CalcSpec.DeleteDAT = false; hj.CalcSpec.DefaultForOutputFiles = OutputFileDefault.Reasonable; hj.CalcSpec.DeleteSqlite = false; hj.CalcSpec.ExternalTimeResolution = "00:15:00"; hj.CalcSpec.EnableTransportation = true; if (hj.CalcSpec.CalcOptions == null) { throw new LPGException("calcoptions was null"); } hj.CalcSpec.CalcOptions.Add(CalcOption.TotalsPerLoadtype); hj.House = new HouseData(StrGuid.FromString("houseguid"), "HT01", 1000, 100, "housename"); hj.House.Households = new List <HouseholdData>(); var chargingstationSet = sim.ChargingStationSets.FindFirstByName("car electricity", FindMode.Partial); var hhd = new HouseholdData("householdid", "householdname", chargingstationSet.GetJsonReference(), sim.TransportationDeviceSets[0].GetJsonReference(), sim.TravelRouteSets[0].GetJsonReference(), null, HouseholdDataSpecificationType.ByHouseholdName); var hh = sim.ModularHouseholds.FindFirstByName("CHR01", FindMode.StartsWith); hhd.HouseholdNameSpec = new HouseholdNameSpecification(hh.GetJsonReference()); hj.House.Households.Add(hhd); return(hj); }
public static HouseCreationAndCalculationJob PrepareNewHouseForHousetypeTesting(Simulator sim, string guid) { var hj = new HouseCreationAndCalculationJob(); hj.CalcSpec = JsonCalcSpecification.MakeDefaultsForTesting(); hj.CalcSpec.StartDate = new DateTime(2020, 1, 1); hj.CalcSpec.EndDate = new DateTime(2020, 1, 3); hj.CalcSpec.DeleteDAT = false; hj.CalcSpec.DefaultForOutputFiles = OutputFileDefault.NoFiles; hj.CalcSpec.DeleteSqlite = false; hj.CalcSpec.ExternalTimeResolution = "00:15:00"; hj.CalcSpec.EnableTransportation = false; var ht = sim.HouseTypes.FindByGuid(guid.ToStrGuid()); hj.House = new HouseData(StrGuid.FromString("houseguid"), ht.HouseTypeCode, 1000, 100, "housename"); hj.House.Households = new List <HouseholdData>(); var hhd = new HouseholdData("householdid", "householdname", sim.ChargingStationSets[0].GetJsonReference(), sim.TransportationDeviceSets[0].GetJsonReference(), sim.TravelRouteSets[0].GetJsonReference(), null, HouseholdDataSpecificationType.ByHouseholdName); var hh = sim.ModularHouseholds[0]; hhd.HouseholdNameSpec = new HouseholdNameSpecification(hh.GetJsonReference()); hj.House.Households.Add(hhd); return(hj); }
public static HouseCreationAndCalculationJob PrepareNewHouseForOutputFileTesting(Simulator sim) { var hj = new HouseCreationAndCalculationJob(); hj.CalcSpec = JsonCalcSpecification.MakeDefaultsForTesting(); hj.CalcSpec.StartDate = new DateTime(2020, 1, 1); hj.CalcSpec.EndDate = new DateTime(2020, 1, 3); hj.CalcSpec.DeleteDAT = false; hj.CalcSpec.DefaultForOutputFiles = OutputFileDefault.NoFiles; hj.CalcSpec.DeleteSqlite = false; hj.CalcSpec.ExternalTimeResolution = "00:15:00"; hj.House = new HouseData(StrGuid.FromString("houseguid"), "HT01", 1000, 100, "housename"); hj.House.Households = new List <HouseholdData>(); var hhd = new HouseholdData("householdid", "householdname", null, null, null, null, HouseholdDataSpecificationType.ByHouseholdName); var hh = sim.ModularHouseholds.FindFirstByName("CHR01", FindMode.StartsWith); hhd.HouseholdNameSpec = new HouseholdNameSpecification(hh.GetJsonReference()); hj.House.Households.Add(hhd); return(hj); }
public static StrGuid ToStrGuid([NotNull] this string myguid) { return(StrGuid.FromString(myguid)); }