public CalcDeviceTaggingSets GetDeviceTaggingSets([NotNull] Simulator sim, int personCount) { CalcDeviceTaggingSets cs = new CalcDeviceTaggingSets { AllCalcDeviceTaggingSets = new List <DeviceTaggingSetInformation>() }; foreach (var deviceTaggingSet in sim.DeviceTaggingSets.MyItems) { var calcset = new DeviceTaggingSetInformation(deviceTaggingSet.Name); foreach (var entry in deviceTaggingSet.Entries) { if (entry.Device == null) { throw new LPGException("Device was null"); } if (entry.Tag == null) { throw new LPGException("Tag was null"); } var devname = entry.Device.Name; //sim.MyGeneralConfig.CSVCharacter); var tagname = CalcAffordanceFactory.FixAffordanceName(entry.Tag.Name, _calcParameters.CSVCharacter); calcset.AddTag(devname, tagname); } foreach (var reference in deviceTaggingSet.References.Where(x => x.PersonCount == personCount)) { if (reference.Tag == null) { throw new LPGException("Tag was null"); } calcset.AddRefValue(reference.Tag.Name, reference.ReferenceValue, reference.LoadType.Name); } foreach (var loadType in deviceTaggingSet.LoadTypes) { if (loadType.LoadType == null) { throw new LPGException("Loadtype was null"); } if (_ltDict.SimulateLoadtype(loadType.LoadType)) { var clt = _ltDict.GetLoadtypeDtoByLoadType(loadType.LoadType); calcset.AddLoadType(clt.ConvertToLoadTypeInformation()); } } cs.AllCalcDeviceTaggingSets.Add(calcset); } return(cs); }
public MyColumn([JetBrains.Annotations.NotNull] string name, int column, [CanBeNull] DeviceTaggingSetInformation taggingSet, [JetBrains.Annotations.NotNull] DirectoryInfo basisPath, [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft, CalcParameters parameters) { Tag = ""; RawName = name; Column = column; if (name.Contains(" [")) { var deviceWithRoom = name.Substring(name.IndexOf(" - ", StringComparison.Ordinal) + 3); deviceWithRoom = deviceWithRoom.Substring(0, deviceWithRoom.IndexOf(" [", StringComparison.Ordinal)).Trim(); var device = deviceWithRoom.Substring(deviceWithRoom.IndexOf(" - ", StringComparison.Ordinal) + 3).Trim(); try { if (taggingSet == null) { throw new LPGException("Tagging set was null"); } if (parameters.IsSet(CalcOption.HouseholdContents) && !taggingSet.TagByDeviceName.ContainsKey(device)) { var fileName = Path.Combine(basisPath.FullName, "missingCategories.txt"); if (!fft.CheckForFile(ResultFileID.MissingTags, Constants.GeneralHouseholdKey)) { fft.RegisterFile(fileName, "Devices that are missing device tags", false, ResultFileID.MissingTags, Constants.GeneralHouseholdKey, TargetDirectory.Root, CalcOption.HouseholdContents); } taggingSet.TagByDeviceName.Add(device, "Other"); using (var sw = new StreamWriter(fileName, true)) { sw.WriteLine(device); } Logger.Error("Missing entry in the device tagging set " + taggingSet.Name + " for the device " + device); } } catch (Exception ex) { Logger.Error( "Couldn't write to missing categories file: " + basisPath + " Error message was:" + ex.Message); Logger.Exception(ex); } if (taggingSet == null) { throw new LPGException("Tagging set was null"); } Tag = taggingSet.TagByDeviceName[device]; } }
private void MakeChartFromDay([JetBrains.Annotations.NotNull] string fileName, [JetBrains.Annotations.NotNull] string plotName, [JetBrains.Annotations.NotNull] DirectoryInfo basisPath, [JetBrains.Annotations.NotNull] string yaxisLabel, TimeSpan timestep, [ItemNotNull][JetBrains.Annotations.NotNull] List <string> headers, [JetBrains.Annotations.NotNull] DayEntry day, [JetBrains.Annotations.NotNull] DeviceTaggingSetInformation taggingSet, bool makePng) { // process results var columns = new List <MyColumn>(); for (var i = 0; i < headers.Count; i++) { var header = headers[i]; columns.Add(new MyColumn(header, i, taggingSet, basisPath, FFT, _calcParameters)); } foreach (var valueArr in day.Values) { foreach (var column in columns) { column.Values.Add(valueArr[column.Column]); column.Sum += valueArr[column.Column]; } } columns.RemoveAt(0); // remove first two columns with the time stamps columns.RemoveAt(0); var newColumns = new List <MyColumn>(); var tags = columns.Select(x => x.Tag).Distinct().ToList(); var tagNumber = 0; foreach (var tag in tags) { var myc = new MyColumn(tag, tagNumber++, null, basisPath, FFT, _calcParameters); newColumns.Add(myc); } for (var j = 0; j < columns[0].Values.Count; j++) { foreach (var newColumn in newColumns) { var colsForTag = columns.Where(x => x.Tag == newColumn.RawName).ToList(); var sum = colsForTag.Sum(x => x.Values[j]); newColumn.Values.Add(sum); } var newSum = newColumns.Sum(x => x.Values[j]); var oldsum = columns.Sum(x => x.Values[j]); if (Math.Abs(newSum - oldsum) > 0.001) { throw new LPGException("Missing values"); } } foreach (var column in newColumns) { column.Sum = column.Values.Sum(); } newColumns.Sort((x, y) => y.Sum.CompareTo(x.Sum)); var plotModel1 = new PlotModel { // general LegendBorderThickness = 0, LegendOrientation = LegendOrientation.Horizontal, LegendPlacement = LegendPlacement.Outside, LegendPosition = LegendPosition.BottomCenter }; if (Config.MakePDFCharts) { plotModel1.LegendFontSize = Parameters.PDFFontSize; plotModel1.DefaultFontSize = Parameters.PDFFontSize; } if (Config.SpecialChartFontSize != null) { plotModel1.LegendFontSize = Config.SpecialChartFontSize.Value; plotModel1.DefaultFontSize = Config.SpecialChartFontSize.Value; } if (Parameters.ShowTitle) { plotModel1.Title = plotName; } var dateTimeAxis = new DateTimeAxis { Position = AxisPosition.Bottom, StringFormat = "dd.MM. HH:mm", MajorStep = 0.25, MaximumPadding = 0.05 }; plotModel1.Axes.Add(dateTimeAxis); // axes var linearAxis2 = new LinearAxis { AbsoluteMinimum = 0, MaximumPadding = 0.06, MinimumPadding = 0, Title = yaxisLabel }; plotModel1.Axes.Add(linearAxis2); // data var p = OxyPalettes.Hue64; if (newColumns.Count > 1) { p = OxyPalettes.Jet(newColumns.Count); } var currentTime = new TimeSpan(0); for (var i = 0; i < newColumns.Count; i++) { // main columns var column = newColumns[i]; var columnSeries2 = new AreaSeries { StrokeThickness = 0, Title = ChartLocalizer.Get().GetTranslation(column.RawName) }; for (var j = 0; j < column.Values.Count; j++) { currentTime = currentTime.Add(timestep); double sum = 0; for (var k = i - 1; k >= 0; k--) { sum += newColumns[k].Values[j]; } var dt = day.Times[j]; var bottom = new DataPoint(DateTimeAxis.ToDouble(dt), sum); columnSeries2.Points.Add(bottom); var top = new DataPoint(DateTimeAxis.ToDouble(dt), sum + column.Values[j]); columnSeries2.Points2.Add(top); } columnSeries2.Color2 = p.Colors[i]; columnSeries2.Color = p.Colors[i]; columnSeries2.Fill = p.Colors[i]; plotModel1.Series.Add(columnSeries2); } var thisname = fileName + "." + taggingSet.Name + "." + day.Day.Year + "." + day.Day.Month + "." + day.Day.Day; Save(plotModel1, plotName, thisname, basisPath, CalcOption.DeviceProfilesIndividualHouseholds, makePng: makePng); }
private void MakeTotalsPerDeviceTaggingSet([NotNull] IFileFactoryAndTracker fft, [NotNull] CalcLoadTypeDto dstLoadType, [ItemNotNull][NotNull] List <DeviceTaggingSetInformation> deviceTaggingSets, [NotNull] Dictionary <string, double> deviceEnergyDict, [NotNull] HouseholdKey hhkey) { var calcParameters = Repository.CalcParameters; using (var file = fft.MakeFile <StreamWriter>("DeviceTaggingSet." + dstLoadType.FileName + "." + hhkey.Key + ".csv", "Summed up energy use into the AffordanceToCategories in the device tagging sets for " + dstLoadType.Name, true, ResultFileID.DeviceTaggingSetFiles, hhkey, TargetDirectory.Reports, calcParameters.InternalStepsize, CalcOption.TotalsPerDevice, dstLoadType.ConvertToLoadTypeInformation())) { foreach (var tagSet in deviceTaggingSets) { file.WriteLine("-----"); file.WriteLine(tagSet.Name); var energyUsePerTag = new Dictionary <string, double>(); double sum = 0; foreach (var keyValuePair in deviceEnergyDict) { var device = keyValuePair.Key; if (!tagSet.TagByDeviceName.ContainsKey(device)) { tagSet.TagByDeviceName.Add(device, device); } var tag = tagSet.TagByDeviceName[device]; if (!energyUsePerTag.ContainsKey(tag)) { energyUsePerTag.Add(tag, 0); } energyUsePerTag[tag] += keyValuePair.Value; sum += keyValuePair.Value; } file.WriteLine("Tag" + calcParameters.CSVCharacter + "Energy Used [" + dstLoadType.UnitOfSum + "]" + calcParameters.CSVCharacter + "Percentage" + calcParameters.CSVCharacter + "Reference Value" + calcParameters.CSVCharacter); foreach (var tag in energyUsePerTag) { var referenceValue = string.Empty; var key = DeviceTaggingSetInformation.MakeKey(dstLoadType.Name, tag.Key); if (tagSet.ReferenceValues.ContainsKey(key)) { referenceValue = tagSet.ReferenceValues[key].ToString(Config.CultureInfo); } file.WriteLine(tag.Key + calcParameters.CSVCharacter + tag.Value * dstLoadType.ConversionFactor + calcParameters.CSVCharacter + (tag.Value / sum).ToString("0.0000", Config.CultureInfo) + calcParameters.CSVCharacter + referenceValue + calcParameters.CSVCharacter); } file.WriteLine(); file.WriteLine("Sum" + calcParameters.CSVCharacter + sum * dstLoadType.ConversionFactor + calcParameters.CSVCharacter + "1" + calcParameters.CSVCharacter); } } }
public void PostProcessingTestTwoActivation() { var startdate = new DateTime(2018, 1, 1); var enddate = startdate.AddMinutes(100); var calcParameters = CalcParametersFactory.MakeGoodDefaults().SetStartDate(startdate).SetEndDate(enddate).EnableShowSettlingPeriod(); //CalculationProfiler calculationProfiler = new CalculationProfiler(); var rnd = new Random(1); var nr = new NormalRandom(0, 1, rnd); using (var wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) { calcParameters.Enable(CalcOption.HouseSumProfilesFromDetailedDats); calcParameters.Enable(CalcOption.DeviceProfilesIndividualHouseholds); calcParameters.Enable(CalcOption.TotalsPerDevice); calcParameters.Enable(CalcOption.TotalsPerLoadtype); calcParameters.Enable(CalcOption.DeviceActivations); calcParameters.Enable(CalcOption.DetailedDatFiles); Config.IsInUnitTesting = true; wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new CalcParameterLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new CalcLoadTypeDtoLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new ColumnEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new CalcObjectInformationLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new DeviceActivationEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new CalcPersonDtoLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new DeviceTaggingSetLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.Save(calcParameters); using (var fft = new FileFactoryAndTracker(wd.WorkingDirectory, "hh1", wd.InputDataLogger)) { fft.RegisterHousehold(Constants.GeneralHouseholdKey, "general", HouseholdKeyType.General, "desc", null, null); //fft.RegisterHousehold(Constants.GeneralHouseholdKey, "general", HouseholdKeyType.General,"desc"); //SqlResultLoggingService srls =new SqlResultLoggingService(Path.Combine(wd.WorkingDirectory, "results.sqlite")); var dsc = new DateStampCreator(calcParameters); using (IOnlineLoggingData old = new OnlineLoggingData(dsc, wd.InputDataLogger, calcParameters)) { var coi = new CalcObjectInformation(CalcObjectType.ModularHousehold, "objname", wd.WorkingDirectory); wd.InputDataLogger.Save(coi); using (var lf = new LogFile(calcParameters, fft)) { var key = new HouseholdKey("hh1"); fft.RegisterHousehold(key, "hh1 key", HouseholdKeyType.Household, "Description", null, null); var odap = new OnlineDeviceActivationProcessor(old, calcParameters, fft); var clt = new CalcLoadType("lt1", "W", "kWh", 3, true, Guid.NewGuid().ToStrGuid()); var loadTypes = new List <CalcLoadTypeDto> { clt.ConvertToDto() }; wd.InputDataLogger.Save(loadTypes); var cdl = new CalcDeviceLoad("devload1", 10, clt, 666, 0); var deviceLoads = new List <CalcDeviceLoad> { cdl }; var cloc = new CalcLocation("locname", Guid.NewGuid().ToStrGuid()); var devguid = Guid.NewGuid().ToStrGuid(); var devcategoryguid = Guid.NewGuid().ToStrGuid(); var cdto = new CalcDeviceDto("devicename", devcategoryguid, key, OefcDeviceType.Device, "category", "", devguid, cloc.Guid, cloc.Name); var devices = new List <IHouseholdKey> { cdto }; wd.InputDataLogger.SaveList(devices); using (var calcRepo = new CalcRepo(odap, calcParameters: calcParameters, rnd: rnd, normalRandom: nr)) { var device = new CalcDevice(deviceLoads, cloc, cdto, calcRepo); //var devices = new List<CalcDevice> {device}; var cp = new CalcProfile("profile1", Guid.NewGuid().ToStrGuid(), new TimeSpan(0, 1, 0), ProfileType.Absolute, "custom"); cp.AddNewTimepoint(new TimeSpan(0), 0); cp.AddNewTimepoint(new TimeSpan(0, 1, 0), 10); cp.AddNewTimepoint(new TimeSpan(0, 2, 0), 0); cp.ConvertToTimesteps(); //var locations = new List<CalcLocation> {cloc}; var ts = new TimeStep(0, calcParameters); device.SetTimeprofile(cp, ts, clt, "affordanceName", "activatorName", 1, false); device.SetTimeprofile(cp, ts.AddSteps(5), clt, "affordanceName", "activatorName", 1, false); device.SetTimeprofile(cp.CompressExpandDoubleArray(0.5), ts.AddSteps(8), clt, "affordanceName", "activatorName", 1, false); device.SetTimeprofile(cp.CompressExpandDoubleArray(2), ts.AddSteps(10), clt, "affordanceName", "activatorName", 1, false); } for (var i = 0; i < 30; i++) { var ts1 = new TimeStep(i, calcParameters); var filerows = odap.ProcessOneTimestep(ts1); filerows.Count.Should().Be(1); filerows[0].EnergyEntries.Count.Should().Be(1); Logger.Info(filerows[0].EnergyEntries[0].ToString(CultureInfo.CurrentCulture)); foreach (var fileRow in filerows) { fileRow.Save(odap.BinaryOutStreams[fileRow.LoadType]); } } //var autoDevs = new List<CalcAutoDev>(); //var ps = new Postprocessor(lf.FileFactoryAndTracker, calculationProfiler,calcParameters); //var householdKeys = new HashSet<string> {"1"}; //var calcAffordanceTaggingSets = new List<CalcAffordanceTaggingSet>(); var deviceTaggingSetInformation = new DeviceTaggingSetInformation("name"); var taggingsets = new List <DeviceTaggingSetInformation> { deviceTaggingSetInformation }; wd.InputDataLogger.Save(taggingsets); //var householdPlans = new List<CalcHouseholdPlan>(); //var householdNamesByNumber = new Dictionary<string, string> {["HH1"] = "household"}; //var affordanceEnergyUseFile = new AffordanceEnergyUseFile(lf.FileFactoryAndTracker,calcParameters); //lf.Close(null); // needed to free file access //var results = new Dictionary<string, double>(); var persons = new List <CalcPersonDto>(); var dto = new CalcPersonDto("name", Guid.NewGuid().ToStrGuid(), 18, PermittedGender.Female, key, new List <DateSpan>(), new List <DateSpan>(), 1, "tag", "hhname"); persons.Add(dto); wd.InputDataLogger.SaveList(persons.ConvertAll(x => (IHouseholdKey)x)); //var deviceNamesToCategory = new Dictionary<string, string>(); old.FinalSaveToDatabase(); lf.Dispose(); fft.Dispose(); var cprof = new CalculationProfiler(); var ppm = new PostProcessingManager(cprof, fft); ppm.Run(wd.WorkingDirectory); var tel = new TotalsPerLoadtypeEntryLogger(wd.SqlResultLoggingService); var results = tel.Read(key); results[0].Value.Should().Be(150); } } } Logger.Info(wd.WorkingDirectory); wd.CleanUp(); } }
public void PostProcessingTestSingleActivation() { using (var wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) { wd.InputDataLogger.AddSaver(new CalcParameterLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new ColumnEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new DeviceActivationEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new CalcLoadTypeDtoLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new CalcPersonDtoLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new DeviceTaggingSetLogger(wd.SqlResultLoggingService)); var calculationProfiler = new CalculationProfiler(); var startdate = new DateTime(2018, 1, 1); var enddate = startdate.AddMinutes(1000); var calcParameters = CalcParametersFactory.MakeGoodDefaults().SetStartDate(startdate).SetEndDate(enddate).EnableShowSettlingPeriod(); var rnd = new Random(1); var nr = new NormalRandom(0, 1, rnd); calcParameters.Enable(CalcOption.HouseSumProfilesFromDetailedDats); calcParameters.Enable(CalcOption.DeviceProfilesIndividualHouseholds); calcParameters.Enable(CalcOption.TotalsPerDevice); calcParameters.Enable(CalcOption.TotalsPerLoadtype); calcParameters.Enable(CalcOption.DetailedDatFiles); calcParameters.Enable(CalcOption.DeviceActivations); var key = new HouseholdKey("hh1"); wd.InputDataLogger.Save(calcParameters); using (var fft = new FileFactoryAndTracker(wd.WorkingDirectory, "hhname", wd.InputDataLogger)) { //wd.InputDataLogger.AddSaver(new CalcDeviceDtoLogger(wd.SqlResultLoggingService)); var dsc = new DateStampCreator(calcParameters); using (IOnlineLoggingData old = new OnlineLoggingData(dsc, wd.InputDataLogger, calcParameters)) { var calcPersonDto = new CalcPersonDto("blub", "personguid".ToStrGuid(), 1, PermittedGender.Male, key, new List <DateSpan>(), new List <DateSpan>(), 1, "traittag", "householdname"); var persons = new List <CalcPersonDto> { calcPersonDto }; wd.InputDataLogger.SaveList(persons.ConvertAll(x => (IHouseholdKey)x)); using (var lf = new LogFile(calcParameters, fft)) { fft.RegisterHousehold(key, "test hh", HouseholdKeyType.Household, "Description", null, null); fft.RegisterHousehold(Constants.GeneralHouseholdKey, "General", HouseholdKeyType.General, "Description", null, null); var odap = new OnlineDeviceActivationProcessor(old, calcParameters, fft); var clt = new CalcLoadType("lt1", "W", "kWh", 3, true, Guid.NewGuid().ToStrGuid()); var loadTypeDtos = new List <CalcLoadTypeDto> { clt.ConvertToDto() }; wd.InputDataLogger.Save(loadTypeDtos); //var loadTypes = new List<CalcLoadType> {clt}; var cdl = new CalcDeviceLoad("devload1", 10, clt, 666, 0); var deviceLoads = new List <CalcDeviceLoad> { cdl }; var cloc = new CalcLocation("locname", Guid.NewGuid().ToStrGuid()); var deviceCategoryGuid = Guid.NewGuid().ToStrGuid(); var calcDeviceDto = new CalcDeviceDto("devicename", deviceCategoryGuid, key, OefcDeviceType.Device, "category", string.Empty, Guid.NewGuid().ToStrGuid(), cloc.Guid, cloc.Name); var calcDeviceDtos = new List <CalcDeviceDto> { calcDeviceDto }; wd.InputDataLogger.SaveList(calcDeviceDtos.ConvertAll(x => (IHouseholdKey)x)); //device tagging set for the post processing var cdts = new List <DeviceTaggingSetInformation>(); var dtsi = new DeviceTaggingSetInformation("myset"); dtsi.AddTag(calcDeviceDto.Name, "testTag "); cdts.Add(dtsi); wd.InputDataLogger.Save(cdts); //device using (var calcRepo = new CalcRepo(calcParameters: calcParameters, odap: odap, rnd: rnd, normalRandom: nr)) { var device = new CalcDevice(deviceLoads, cloc, calcDeviceDto, calcRepo); //var devices = new List<CalcDevice> {device}; double[] resultValues = { 0, 100.0, 0, 0, 0, 0, 0, 0, 0, 0 }; var cp = new CalcProfile("profile1", Guid.NewGuid().ToStrGuid(), new TimeSpan(0, 1, 0), ProfileType.Absolute, "custom"); cp.AddNewTimepoint(new TimeSpan(0), 0); cp.AddNewTimepoint(new TimeSpan(0, 1, 0), 10); cp.AddNewTimepoint(new TimeSpan(0, 2, 0), 0); cp.ConvertToTimesteps(); //var locations = new List<CalcLocation> {cloc}; var ts1 = new TimeStep(0, calcParameters); device.SetTimeprofile(cp, ts1, clt, "affordanceName", "activatorName", 10, false); for (var i = 0; i < 10; i++) { var ts = new TimeStep(i, calcParameters); var filerows = odap.ProcessOneTimestep(ts); filerows.Count.Should().Be(1); filerows[0].EnergyEntries.Count.Should().Be(1); Logger.Info(filerows[0].EnergyEntries[0].ToString(CultureInfo.CurrentCulture)); filerows[0].EnergyEntries[0].Should().Be(resultValues[i]); foreach (var fileRow in filerows) { fileRow.Save(odap.BinaryOutStreams[fileRow.LoadType]); } } } old.FinalSaveToDatabase(); fft.Dispose(); lf.Dispose(); // needed to free the file access //var autoDevs = new List<CalcAutoDev>(); //var ps = new Postprocessor(lf.FileFactoryAndTracker, calculationProfiler,calcParameters ); //var householdKeys = new HashSet<string> {"1"}; //var calcAffordanceTaggingSets = new List<CalcAffordanceTaggingSet>(); //var calcDeviceTaggingSets = new List<CalcDeviceTaggingSet>(); //var calcDeviceTaggingSets = new List<DeviceTaggingSetInformation>(); //var householdPlans = new List<CalcHouseholdPlan>(); //var householdNamesByNumber = new Dictionary<string, string> {["HH1"] = "household"}; //var affordanceEnergyUseFile = new AffordanceEnergyUseFile(lf.FileFactoryAndTracker,calcParameters); //var results = new Dictionary<string, double>(); //BitArray isSick = new BitArray(calcParameters.InternalTimesteps); //BitArray isOnVacation = new BitArray(calcParameters.InternalTimesteps); //CalcPersonDto cpd = new CalcPersonDto("personname", Guid.NewGuid().ToStrGuid(),18,PermittedGender.Female,key,new List<DateSpan>(),new List<DateSpan>(),1,"traittag","hhname" ); //var persons = new List<CalcPerson> {new CalcPerson(cpd, new Random(), lf,cloc,calcParameters,isSick,isOnVacation)}; //var deviceNamesToCategory = new Dictionary<string, string>(); //CalcDeviceTaggingSets calcDeviceTaggingSets = new CalcDeviceTaggingSets(); var cpp = new PostProcessingManager(calculationProfiler, fft); cpp.Run(wd.WorkingDirectory); /*ps.EndOfSimulationProcessing(devices, locations, autoDevs, loadTypes, odap.Oefc, householdKeys * ,calcAffordanceTaggingSets, calcDeviceTaggingSets, householdPlans, householdNamesByNumber * ,affordanceEnergyUseFile, results, CalcObjectType.ModularHousehold, persons, deviceNamesToCategory,10);*/ //var dstpath = Path.Combine(wd.WorkingDirectory,DirectoryNames.CalculateTargetdirectory(TargetDirectory.Reports),"DeviceSums." + clt.Name + ".csv"); lf.Dispose(); // needed to free the file access var di = new DirectoryInfo(wd.WorkingDirectory); var fis = di.GetFiles("DeviceSums.*", SearchOption.AllDirectories); if (fis.Length == 0) { throw new LPGException("No Sum File was generated"); } fft.Dispose(); using (var sr = new StreamReader(fis[0].FullName)) { sr.ReadLine(); //header var result = sr.ReadLine(); //0 if (result == null) { throw new LPGException("Result was null"); } var arr = result.Split(';'); Assert.Equal("300", arr[1]); } } } } Logger.Info(wd.WorkingDirectory); wd.CleanUp(); } }