コード例 #1
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            //ChartLocalizer.ShouldTranslate = true;
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(2, GlobalConsts.CSVCharacter,
                              configSetter: x => x.Enable(CalcOption.ActivationFrequencies));
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new AffordanceTaggingSet(ccps, fft, cp);
                Logger.Debug("Making picture");
                var             di  = new DirectoryInfo(cs.DstDir);
                ResultFileEntry rfe = cs.GetRfeByFilename("AffordanceTaggingSet.Wo bleibt die Zeit.HH1.csv");

                aeupp.MakePlot(rfe);
                Logger.Debug("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "AffordanceTaggingSet.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            Logger.Warning("Open threads for database: " + Connection.ConnectionCount);
            Command.PrintOpenConnections();
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
コード例 #2
0
        public static Profile LoadProfiles([NotNull] ResultFileEntry rfe,
                                           [NotNull] string dstDirectory,
                                           [NotNull] out FileInfo loadedFile)
        {
            DirectoryInfo di  = new DirectoryInfo(dstDirectory);
            var           fis = di.GetFiles("*.json", SearchOption.AllDirectories);

            if (fis.Length == 0)
            {
                throw new FlaException("Not a single json file was found.");
            }

            if (rfe.ResultFileID != ResultFileID.ExternalSumsForHouseholdsJson)
            {
                throw new FlaException("Invalid result file id");
            }

            var fi = fis.Single(x => x.Name == rfe.FileName);

            loadedFile = fi;
            string        json   = File.ReadAllText(fi.FullName);
            List <double> values = JsonConvert.DeserializeObject <List <double> >(json);

            Profile p = new Profile(rfe.HouseholdKey, values.AsReadOnly(), EnergyOrPower.Energy);

            p = p.AdjustValueCountForLeapYear();
            return(p);
        }
コード例 #3
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());

            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              configSetter: x =>
            {
                x.Enable(CalcOption.DesiresLogfile);
            });
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                fft.ReadExistingFilesFromSql();
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new Desires(ccps, fft, cp);
                Logger.Info("Making picture");
                var             di  = new DirectoryInfo(cs.DstDir);
                ResultFileEntry rfe = cs.GetRfeByFilename("Desires.HH1.CHR02 Katee (37 Female).csv");

                aeupp.MakePlot(rfe);
                Logger.Info("finished picture");
                //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName);
                var imagefiles = FileFinder.GetRecursiveFiles(di, "Desires.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
コード例 #4
0
        protected static void AddImageToSection([NotNull] Section sec, [NotNull] ResultFileEntry rfe)
        {
            var mytitle  = rfe.FileTitle;
            var imgtitle = sec.AddParagraph(mytitle);

            imgtitle.Format.Font.Size    = 12;
            imgtitle.Format.KeepWithNext = true;
            imgtitle.Format.SpaceAfter   = "0.5cm";
            imgtitle.Format.SpaceBefore  = "0.5cm";
            imgtitle.Format.Font.Color   = Colors.Blue;
            var img  = sec.AddImage(rfe.FullFilename);
            var size = GetDimensions(rfe.FullFilename);

            if (size.Height > 5000)
            {
                img.Height = "20cm";
            }
            else if (size.Height > size.Width)
            {
                img.Height = "10cm";
            }
            else
            {
                img.Width = "16cm";
            }
        }
        public void RegisterFile([NotNull] string fileName, [NotNull] string description, bool displayResultFileEntry, ResultFileID rfid1,
                                 [NotNull] HouseholdKey householdKey, TargetDirectory targetDirectory, CalcOption enablingOption,
                                 [CanBeNull] string additionalFileIndex = null)
        {
            if (!HouseholdRegistry.IsHouseholdRegistered(householdKey))
            {
                throw new LPGException("Forgotten Household Key: " + householdKey);
            }

            if (fileName.Contains(".."))
            {
                throw new LPGException("Filename with two dots. This looks bad. Please fix: " + fileName);
            }
            if (fileName.Contains("  "))
            {
                throw new LPGException("Filename with two spaces. This looks bad. Please fix: " + fileName);
            }
            string          fullFileName = Path.Combine(GetFullPathForTargetdirectry(targetDirectory), fileName);
            FileInfo        fi           = new FileInfo(fullFileName);
            ResultFileEntry rfe          = new ResultFileEntry(description, fi, displayResultFileEntry, rfid1, householdKey.Key,
                                                               additionalFileIndex, enablingOption);

            _inputDataLogger.Save(rfe);
            ResultFileList.ResultFiles.Add(rfe.HashKey, rfe);
        }
コード例 #6
0
        public void MakePlotTest()
        {
            CleanTestBase.RunAutomatically(false);
            using var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass());
            cs.StartHousehold(1, GlobalConsts.CSVCharacter,
                              LoadTypePriority.Mandatory,
                              configSetter: x =>
            {
                x.Enable(CalcOption.SumProfileExternalEntireHouse);
                x.ExternalTimeResolution = "00:30:00";
            });
            using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger))
            {
                CalculationProfiler     cp   = new CalculationProfiler();
                ChartCreationParameters ccps = new ChartCreationParameters(300, 4000,
                                                                           2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir));
                var aeupp = new SumProfiles(ccps, fft, cp);
                Logger.Info("Making picture");
                var di = new DirectoryInfo(cs.DstDir);
                //var files = FileFinder.GetRecursiveFiles(di, );
                ResultFileEntry rfe = cs.GetRfeByFilename("SumProfiles_1800s.Electricity.csv");
                //Assert.GreaterOrEqual(files.Count, 1);

                aeupp.MakePlot(rfe);

                Logger.Info("finished picture");
                var imagefiles = FileFinder.GetRecursiveFiles(di, "SumProfiles_1800s.*.png");
                imagefiles.Count.Should().BeGreaterOrEqualTo(1);
                fft.ResultFileList.ResultFiles.Count.Should().BeGreaterOrEqualTo(1);
            }
            cs.CleanUp();
            CleanTestBase.RunAutomatically(true);
        }
コード例 #7
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcEntry)
        {
            //AffordanceEnergyUseLogger aeul = new AffordanceEnergyUseLogger(_srls);
            string plotName = "Affordance Energy Use " + srcEntry.HouseholdNumberString + " " +
                              srcEntry.LoadTypeInformation?.Name;

            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            const FileProcessingResult fpr = FileProcessingResult.ShouldCreateFiles;
            var consumption = new List <Tuple <string, double> >();
            var taggingSets = new List <ChartTaggingSet>();

            if (srcEntry.FullFileName == null)
            {
                throw new LPGException("Srcfile was null");
            }
            using (var sr = new StreamReader(srcEntry.FullFileName)) {
                var header = sr.ReadLine();
                if (header == null)
                {
                    throw new LPGException("Affordance Energy Use file was empty.");
                }
                var headerArr = header.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                for (var i = 2; i < headerArr.Length; i++)
                {
                    if (!string.IsNullOrWhiteSpace(headerArr[i]))
                    {
                        taggingSets.Add(new ChartTaggingSet(headerArr[i]));
                    }
                }
                while (!sr.EndOfStream)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed.");
                    }
                    var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    var d    = Convert.ToDouble(cols[1], CultureInfo.CurrentCulture);
                    consumption.Add(new Tuple <string, double>(cols[0], d));
                    if (cols.Length < 2)
                    {
                        throw new LPGException("The string " + s +
                                               " did not contain any csv characters, even though it should. Affordance energy use plot could not be created.");
                    }
                    for (var i = 2; i < cols.Length; i++)
                    {
                        taggingSets[i - 2].AffordanceToCategories.Add(cols[0], cols[i]);
                    }
                }
            }
            if (taggingSets.Count == 0)
            {
                Profiler.StopPart(Utili.GetCurrentMethodAndClass());
                return(FileProcessingResult.NoFilesTocreate);
            }
            MakeIntervalBars(srcEntry, plotName, Parameters.BaseDirectory, consumption, taggingSets);
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(fpr);
        }
コード例 #8
0
 public bool IsEnabled(ResultFileEntry resultFileEntry)
 {
     if (ResultFileIDs.Contains(resultFileEntry.ResultFileID))
     {
         return(true);
     }
     return(false);
 }
コード例 #9
0
        public FileProcessingResult MakePlot(ResultFileEntry srcResultFileEntry)
        {
            _calculationProfiler.StartPart(StepName);
            var result = MakeOnePlot(srcResultFileEntry);

            _calculationProfiler.StopPart(StepName);
            return(result);
        }
        public bool CheckForResultFileEntry(ResultFileID rfid, [NotNull] string loadTypeName,
                                            [NotNull] HouseholdKey householdKey, [CanBeNull] PersonInformation pi, [CanBeNull] string additionalFileIndex)
        {
            var key = ResultFileEntry.CalculateHashKey(rfid, _calcObjectName, loadTypeName, householdKey.Key, pi?.Name,
                                                       additionalFileIndex);

            return(ResultFileList.ResultFiles.ContainsKey(key));
        }
        public bool CheckForFile(ResultFileID rfid1, [NotNull] HouseholdKey householdKey, [CanBeNull] string additionalFileIndex = null)
        {
            string key = ResultFileEntry.CalculateHashKey(rfid1, null, null, householdKey.Key, null, additionalFileIndex);

            if (ResultFileList.ResultFiles.ContainsKey(key))
            {
                return(true);
            }
            return(false);
        }
コード例 #12
0
        private void MakeIntervalBars([JetBrains.Annotations.NotNull] ResultFileEntry rfe, [JetBrains.Annotations.NotNull] string plotName, [JetBrains.Annotations.NotNull] DirectoryInfo basisPath,
                                      [JetBrains.Annotations.NotNull][ItemNotNull] List <Tuple <string, double> > consumption, [ItemNotNull][JetBrains.Annotations.NotNull] List <ChartTaggingSet> taggingSets)
        {
            IntervallBarMaker ivbm = new IntervallBarMaker();

            foreach (var chartTaggingSet in taggingSets)
            {
                ivbm.MakeIntervalBars(rfe, plotName, basisPath, consumption, chartTaggingSet, chartTaggingSet.Name, false, this, CalcOption.AffordanceEnergyUse);
            }
        }
コード例 #13
0
        /*
         * private void MakeHeatingDensityMap([NotNull] ScenarioSliceParameters up,[ItemNotNull] [NotNull] List<House> houses,
         *                                 [NotNull] MyDb dbHouses )
         * {
         *  const string section = "Heizungseffizienz [kWh/m2/a]";
         *  const string sectionDescription = "Heizungseffizenz über alle Gebäude";
         * //heating energy density
         *  //var heatingMethods = dbHouses.Fetch<HouseHeating>();
         *      var heatingEnergyPoints = new List<MapPoint>();
         *      double adjustmentFactor = houses.Max(x => x.MergedTotalHeatingEnergyDemand)/100;
         *      foreach (var house in houses) {
         *          if (house.GeoCoords.Count == 0) {
         *              continue;
         *          }
         *
         *          //var hm = heatingMethods.FirstOrDefault(x => x.HouseGuid == house.HouseGuid);
         *
         *          var co = house.GeoCoords[0];
         *          var adjustedRadius = (int)(house.MergedTotalHeatingEnergyDemand / adjustmentFactor);
         *          heatingEnergyPoints.Add(new MapPoint(co.X, co.Y, house.MergedHeatingEnergyIntensity, adjustedRadius));
         *      }
         *
         *      string dstFileName2 = dbHouses.GetFullFilename(up.GetFileName() + "_HeatDensity_Map.svg",SequenceNumber,Name);
         *      ResultFileEntry rfe2 = new ResultFileEntry(section, sectionDescription, dstFileName2.Replace(".svg", ".png"),
         *          "", "", up.DstScenario, up.DstYear, Stage.PresentVisualisation);
         *      rfe2.Save();
         *  Services.MapDrawer.DrawMapSvg(heatingEnergyPoints, dstFileName2, new List<MapLegendEntry>());
         *      Log(MessageType.Info, "Heat Density Maps written");
         * }*/
        /*
         * private void MakeCarMaps([NotNull] ScenarioSliceParameters up, [NotNull] MyDb dbHouses, [ItemNotNull] [NotNull] List<House> houses)
         * {
         *  var cars = dbHouses.Database.Fetch<Car>();
         *  if (cars.Count == 0)
         *  {
         *      return;
         *  }
         *
         *  var carPoints = new List<MapPoint>();
         *  foreach (House house in houses)
         *  {
         *      if (house.GeoCoords.Count == 0)
         *      {
         *          continue;
         *      }
         *
         *      var carsAtHouse = cars.Where(x => x.HouseGuid == house.HouseGuid).ToList();
         *
         *      bool hasElectric = carsAtHouse.Any(x => x.CarType == CarType.Electric);
         *      var co = house.GeoCoords[0];
         *          if (carsAtHouse.Count == 0) {
         *          carPoints.Add(new MapPoint(co.X, co.Y, 10, 0, 0, 0));
         *      }
         *      else {
         *              int radius = 10+ carsAtHouse.Count;
         *              if (!hasElectric) {
         *              carPoints.Add(new MapPoint(co.X, co.Y, radius, 255, 0, 0));
         *          }
         *          else {
         *              carPoints.Add(new MapPoint(co.X, co.Y, radius, 0, 255, 0));
         *          }
         *      }
         *  }
         *  if (carPoints.Count == 0) {
         *      throw new Exception("No points");
         *  }
         *
         *  const string section = "Fahrzeuge";
         *  const string sectionDescription = "Typ und Anzahl von Fahrzeugen";
         *
         *  string dstFileName2 = dbHouses.GetFullFilename(up.GetFileName() + "_Cars_Map.svg",SequenceNumber,Name);
         *  ResultFileEntry rfe2 = new ResultFileEntry(section, sectionDescription, dstFileName2.Replace(".svg", ".png"),
         *      "", "", up.DstScenario, up.DstYear, Stage.PresentVisualisation);
         *  rfe2.Save();
         *  Services.MapDrawer.DrawMapSvg(carPoints, dstFileName2, new List<MapLegendEntry>());
         *  Log(MessageType.Info, "Car Maps written");
         * }*/
        /*
         * private void MakeHeatingSystemMap([NotNull] ScenarioSliceParameters up, [NotNull] MyDb dbHouses, [ItemNotNull] [NotNull] List<House> houses)
         * {
         *  var heatingSystemEntries = dbHouses.Database.Fetch<HeatingSystemEntry>();
         *  if (heatingSystemEntries.Count == 0)
         *  {
         *      return;
         *  }
         *
         *  var pvPoints = new List<MapPoint>();
         *  foreach (House house in houses) {
         *      if (house.GeoCoords.Count == 0)
         *      {
         *          continue;
         *      }
         *      List<HeatingSystemEntry> hses = new List<HeatingSystemEntry>();
         *          var entry = heatingSystemEntries.FirstOrDefault(x => x.HouseGuid == house.HouseGuid);
         *          if (entry != null) {
         *              hses.Add(entry);
         *          }
         *
         *          if(hses.Count == 0) {
         *          continue;
         *      }
         *
         *      bool hasHP = hses.Any(x => x.HeatingSystemType == HeatingSystemType.Heatpump);
         *      bool hasGas = hses.Any(x => x.HeatingSystemType == HeatingSystemType.Gasheating);
         *      bool hasOil = hses.Any(x => x.HeatingSystemType == HeatingSystemType.OilHeating);
         *
         *      var co = house.GeoCoords[0];
         *      if(hasHP) {
         *          pvPoints.Add(new MapPoint(co.X, co.Y,  10,255,0,0));
         *      }
         *      else if(hasGas) {
         *          pvPoints.Add(new MapPoint(co.X, co.Y, 10, 0, 255, 0));
         *      }
         *      else if (hasOil) {
         *          pvPoints.Add(new MapPoint(co.X, co.Y, 10, 0, 0, 255));
         *      }
         *      else {
         *          pvPoints.Add(new MapPoint(co.X, co.Y, 10, 0, 0, 0));
         *      }
         *
         *  }
         *  if(pvPoints.Count == 0) {
         *      throw new Exception("No points");
         *  }
         *
         *  const string section = "Heizungssysteme";
         *  const string sectionDescription = "Art des Heizungssystems";
         *  string dstFileName2 = dbHouses.GetFullFilename( up.GetFileName() + "_HeatingSystem_Map.svg",SequenceNumber,Name);
         *  ResultFileEntry rfe2 = new ResultFileEntry(section, sectionDescription, dstFileName2.Replace(".svg", ".png"),
         *      "", "", up.DstScenario, up.DstYear, Stage.PresentVisualisation);
         *  rfe2.Save();
         *  Services.MapDrawer.DrawMapSvg(pvPoints, dstFileName2, new List<MapLegendEntry>());
         *  Log(MessageType.Info, "PV Maps written");
         * }*/

        private void MakePVMap([NotNull] ScenarioSliceParameters parameters, [NotNull] MyDb dbHouses, [ItemNotNull][NotNull] List <House> houses)
        {
            var pvSystems = dbHouses.Database.Fetch <PvSystemEntry>();

            if (pvSystems.Count == 0)
            {
                return;
            }

            var adjustmentfactor = pvSystems.Max(x => x.YearlyPotential) / 100;
            var pvPoints         = new List <MapPoint>();

            foreach (var house in houses)
            {
                if (house.WgsGwrCoords.Count == 0)
                {
                    continue;
                }

                var co       = house.WgsGwrCoords[0];
                var pvSystem = pvSystems.FirstOrDefault(x => x.HouseGuid == house.HouseGuid);
                if (pvSystem != null)
                {
                    var radius = (int)(pvSystem.YearlyPotential / adjustmentfactor);
                    if (radius < 10)
                    {
                        radius = 10;
                    }

                    pvPoints.Add(new MapPoint(co.Lat, co.Lon, radius, 255, 0, 0));
                }
                else
                {
                    pvPoints.Add(new MapPoint(co.Lat, co.Lon, 10, 0, 0, 0));
                }
            }

            const string section            = "Photovoltaik";
            const string sectionDescription = "Leistung der PV-Systeme";
            var          dstFileName2       = dbHouses.GetFullFilename(parameters.GetFileName() + "_PV_power_Map.svg", SequenceNumber, Name);
            var          rfe2 = new ResultFileEntry(section, sectionDescription,
                                                    dstFileName2.Replace(".svg", ".png"), "", "",
                                                    parameters, MyStage);

            rfe2.Save();
            var lge = new List <MapLegendEntry> {
                new MapLegendEntry(parameters.DstScenario.ToString() + " Jahr " + parameters.DstYear.ToString(), Constants.Black)
            };

            Services.MapDrawer.DrawMapSvg(pvPoints, dstFileName2, lge, MyStage);
            Log(MessageType.Info, "PV Maps written");
        }
        public ResultFileEntry GetResultFileEntry(ResultFileID rfid, [CanBeNull] string loadTypeName,
                                                  [NotNull] HouseholdKey householdKey, [CanBeNull] PersonInformation pi, [CanBeNull]  string additionalFileIndex)
        {
            var key = ResultFileEntry.CalculateHashKey(rfid, _calcObjectName, loadTypeName, householdKey.Key, pi?.Name,
                                                       additionalFileIndex);

            if (!ResultFileList.ResultFiles.ContainsKey(key))
            {
                throw new LPGException("The file with the ID " + rfid + ", the loadtype " + loadTypeName +
                                       ", and the householdID " + householdKey +
                                       " is missing. This is probably a bug. Please report.");
            }
            return(ResultFileList.ResultFiles[key]);
        }
コード例 #15
0
        public static void CheckIfAllFilesAreRegistered()
        {
            var di   = new DirectoryInfo(Constants.BasePath);
            var pngs = di.GetFiles("*.png", SearchOption.AllDirectories);
            var rfes = ResultFileEntry.LoadAllForScenario(null);

            foreach (var info in pngs)
            {
                if (!rfes.Any(x => x.FullFilename == info.FullName))
                {
                    throw new Exception("Forgotten to register " + info.FullName);
                }
            }
        }
コード例 #16
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcEntry)
        {
            string plotName = "Devices " + srcEntry.HouseholdKey + " " + srcEntry.LoadTypeInformation?.Name;

            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            var lti = srcEntry.LoadTypeInformation;

            if (lti == null)
            {
                throw new LPGException("LTI was null");
            }

            var timestep         = srcEntry.TimeResolution;
            var unitName         = lti.Name + " in " + lti.UnitOfPower + string.Empty;
            var yaxisLabel       = ChartLocalizer.Get().GetTranslation(unitName);
            var conversionfactor = lti.ConversionFaktor;

            if (srcEntry.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            GetFirstAndLastDate(srcEntry.FullFileName, out DateTime first, out var last);
            var selectedDateTimes = new List <DateTime>();
            var r       = new Random();
            var allDays = new List <DateTime>();
            var curr    = first;

            while (curr <= last)
            {
                allDays.Add(curr);
                curr = curr.AddDays(1);
            }
            for (var i = 0; i < DaysToMake && allDays.Count > 0; i++)
            {
                var idx = r.Next(allDays.Count);
                selectedDateTimes.Add(allDays[idx]);
                allDays.RemoveAt(idx);
            }
            selectedDateTimes.Sort();
            //var tagFiles =_Parameters.BaseDirectory.GetFiles(Constants.DeviceTaggingSetFileName);
            var taggingSets = DeviceTaggingSetList.Read(_srls);
            var x           = ReadAllDays(srcEntry, conversionfactor, selectedDateTimes,
                                          taggingSets, plotName, Parameters.BaseDirectory,
                                          yaxisLabel, timestep);

            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(x);
        }
コード例 #17
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcEntry)
        {
            return(FileProcessingResult.NoFilesTocreate);

            /*
             * string plotName = "Device Sums " + srcEntry.HouseholdNumberString + " " + srcEntry.LoadTypeInformation?.Name;
             * _CalculationProfiler.StartPart(Utili.GetCurrentMethodAndClass());
             * const int numberOfFixedColumnsBeforeFirstTaggingSet = 6;
             * var consumption = new List<Tuple<string, double>>();
             * var taggingSets = new List<ChartTaggingSet>();
             * using (var sr = new StreamReader(srcEntry.FullFileName)) {
             *  var top = sr.ReadLine();
             *  if (top == null) {
             *      throw new LPGException("Empty file:" + srcEntry.FullFileName);
             *  }
             *  var headerArr = top.Split(_Parameters.CSVCharacterArr, StringSplitOptions.None);
             *  for (var i = numberOfFixedColumnsBeforeFirstTaggingSet; i < headerArr.Length; i++) {
             *      if (!string.IsNullOrWhiteSpace(headerArr[i])) {
             *          taggingSets.Add(new ChartTaggingSet(headerArr[i]));
             *      }
             *  }
             *  while (!sr.EndOfStream) {
             *      var s = sr.ReadLine();
             *      if (s == null) {
             *          throw new LPGException("Readline failed");
             *      }
             *      if (!s.StartsWith("Sums" + _Parameters.CSVCharacter, StringComparison.Ordinal)) {
             *          var cols = s.Split(_Parameters.CSVCharacterArr, StringSplitOptions.None);
             *          var d = Math.Abs(Convert.ToDouble(cols[1], CultureInfo.CurrentCulture));
             *          consumption.Add(new Tuple<string, double>(cols[0], d));
             *          for (var i = numberOfFixedColumnsBeforeFirstTaggingSet; i < cols.Length - 1; i++) {
             *              taggingSets[i - numberOfFixedColumnsBeforeFirstTaggingSet].AffordanceToCategories.Add(
             *                  cols[0], cols[i]);
             *          }
             *      }
             *  }
             * }
             * var filtered = consumption.Where(x => x.Item2 > 0.05).ToList();
             * foreach (var set in taggingSets) {
             *  MakeIntervalBars(srcEntry, plotName, _Parameters.BaseDirectory, filtered, set, "." + set.Name);
             * }
             * _CalculationProfiler.StopPart(Utili.GetCurrentMethodAndClass());
             * if (taggingSets.Count > 0) {
             *  return FileProcessingResult.ShouldCreateFiles;
             * }
             * return FileProcessingResult.NoFilesTocreate;*/
        }
コード例 #18
0
        private static void ProcessScenario([NotNull] Document document, Scenario scenario)
        {
            CheckIfAllFilesAreRegistered();

            var scenarioRfes = ResultFileEntry.LoadAllForScenario(scenario);
            var cp           = new CoverPage();

            cp.MakePage(document, scenario);
            var sections = scenarioRfes.Select(x => x.Section).Distinct().ToList();

            foreach (var section in sections)
            {
                var scm         = new SectionMaker();
                var sectionRfes = scenarioRfes.Where(x => x.Section == section).ToList();
                scm.MakePage(document, sectionRfes);
            }
        }
コード例 #19
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcEntry)
        {
            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            string plotName = "Sum Profile for " + srcEntry.HouseholdNumberString + " " + srcEntry.LoadTypeInformation?.Name;
            var    values   = new List <double>();

            if (srcEntry.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            using (var sr = new StreamReader(srcEntry.FullFileName)) {
                sr.ReadLine();
                while (!sr.EndOfStream)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed");
                    }
                    var cols    = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    var col     = cols[cols.Length - 1];
                    var success = double.TryParse(col, out double d);
                    if (!success)
                    {
                        throw new LPGException("Double Trouble reading the file " + srcEntry.FileName);
                    }
                    if (srcEntry.LoadTypeInformation == null)
                    {
                        throw new LPGException("Lti was null");
                    }

                    values.Add(d / srcEntry.LoadTypeInformation.ConversionFaktor);
                }
            }
            MakeBoxPlot(srcEntry.FullFileName, plotName, Parameters.BaseDirectory, values, srcEntry.LoadTypeInformation ?? throw new InvalidOperationException());
            MakeLinePlot(srcEntry.FullFileName, plotName, Parameters.BaseDirectory, values, srcEntry.LoadTypeInformation);
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }
コード例 #20
0
        private List <SingleSankeyArrow> MakeFernwärmeArrow([ItemNotNull][NotNull] List <BuildingComplex> complexes, [ItemNotNull][NotNull] List <Localnet> rawEntries,
                                                            [ItemNotNull][NotNull] List <MonthlyElectricityUsePerStandort> monthlyElectricityUsePerStandorts)
        {
            var          slice              = Constants.PresentSlice;
            const string section            = "Erdgas";
            const string sectionDescription = "Analyse der Erdgasverbräuche";
            //write python
            var arrows = new List <SingleSankeyArrow>();

            {
                var arr1 = new SingleSankeyArrow("Fernwärme_NachStandorten", 2000, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, MyStage);
                rfe.Save();
                var verbrauchsList = rawEntries.Where(x => x.Verrechnungstyp == "Arbeitspreis").ToList();
                var totalSum       = verbrauchsList.Select(x => {
                    if (x.BasisVerbrauch == null)
                    {
                        throw new Exception("Basisverbrauch was null");
                    }

                    return(x.BasisVerbrauch.Value);
                }).Sum();
                const double factor = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Total aus Rohdaten", totalSum / factor, 1000, Orientation.Up));
                var monthlyElectricityUseNetz = monthlyElectricityUsePerStandorts.Sum(x => x.YearlyFernwaermeUse);
                arr1.AddEntry(new SankeyEntry("Arbeitspreis in Monthly", monthlyElectricityUseNetz / factor * -1, 1000, Orientation.Down));
                arrows.Add(arr1);
            }

            {
                var arr1 = new SingleSankeyArrow("Fernwärme_Verbrauch_Nach_Identified_Complexed_Standort", 2000, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, MyStage);
                rfe.Save();
                var          totalSum = monthlyElectricityUsePerStandorts.Select(x => x.YearlyFernwaermeUse).Sum();
                const double factor   = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Total", totalSum / factor, 1000, Orientation.Up));
                var cleandStandortIDs          = complexes.SelectMany(x => x.CleanedStandorte).ToList();
                var identifiedComplexStandorts = monthlyElectricityUsePerStandorts.Where(x => cleandStandortIDs.Contains(x.CleanedStandort));

                var identifiedmonthlygas = identifiedComplexStandorts.Sum(x => x.YearlyFernwaermeUse);
                arr1.AddEntry(new SankeyEntry("MonthlyElectricityUseNetz", identifiedmonthlygas / factor * -1, 1000, Orientation.Down));
                arrows.Add(arr1);
            }

            {
                var arr1 = new SingleSankeyArrow("Fernwärme_Verbrauch_Nach_BuildingWithGeoCoords", 500, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, MyStage);
                rfe.Save();
                var          totalSum = monthlyElectricityUsePerStandorts.Select(x => x.YearlyFernwaermeUse).Sum();
                const double factor   = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Fernwärmeverbrauch gesamt", totalSum / factor, 500, Orientation.Straight));
                var cleandStandortIDs                   = complexes.Where(x => x.Coords.Count > 0).SelectMany(x => x.CleanedStandorte).ToList();
                var identifiedComplexStandorts          = monthlyElectricityUsePerStandorts.Where(x => cleandStandortIDs.Contains(x.CleanedStandort));
                var identifiedmonthlyElectricityUseNetz = identifiedComplexStandorts.Sum(x => x.YearlyFernwaermeUse);
                arr1.AddEntry(new SankeyEntry("Fernwärmeverbrauch in\\n Gebäuden mit Geokoordinaten", identifiedmonthlyElectricityUseNetz / factor * -1, 200, Orientation.Straight));

                var notidentified = monthlyElectricityUsePerStandorts.Where(x => !cleandStandortIDs.Contains(x.CleanedStandort));
                var notidentifiedmonthlyElectricityUseNetz = notidentified.Sum(x => x.YearlyFernwaermeUse);
                arr1.AddEntry(new SankeyEntry("Fernwärmeverbrauch in nicht\\n zuordenbaren Gebäuden", notidentifiedmonthlyElectricityUseNetz / factor * -1, 200, Orientation.Up));

                arrows.Add(arr1);
            }
            return(arrows);
        }
コード例 #21
0
        // ReSharper disable once FunctionComplexityOverflow
        private List <SingleSankeyArrow> MakeElectricityArrow([ItemNotNull][NotNull] List <BuildingComplex> complexes, [ItemNotNull][NotNull] List <Localnet> rawEntries,
                                                              [ItemNotNull][NotNull] List <MonthlyElectricityUsePerStandort> monthlyElectricityUsePerStandorts,
                                                              Stage mystage)
        {
            const string section            = "Stromverbräuche";
            const string sectionDescription = "Analyse der Stromverbräuche";
            var          slice = Constants.PresentSlice;
            //write python
            var arrows = new List <SingleSankeyArrow>();

            {
                var arr1 = new SingleSankeyArrow("Stromkunden_Anzahl_nach_Verrechnungstyp", 20000, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, mystage);
                rfe.Save();
                var verbrauchsList = rawEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)" || x.Verrechnungstyp == "Netz Tagesstrom (HT)").ToList();
                arr1.AddEntry(new SankeyEntry("Total", verbrauchsList.Count, 100, Orientation.Up));
                var count2 = rawEntries.Count(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)");
                arr1.AddEntry(new SankeyEntry("Nachtstrom", count2 * -1, 100, Orientation.Up));
                var countTag = rawEntries.Count(x => x.Verrechnungstyp == "Netz Tagesstrom (HT)");
                arr1.AddEntry(new SankeyEntry("Tagstrom", countTag * -1, 100, Orientation.Up));
                arrows.Add(arr1);
            }
            {
                var arr1 = new SingleSankeyArrow("Stromkunden_Verbrauch_nach_Verrechnungstyp", 2000, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, mystage);
                rfe.Save();
                var verbrauchsList = rawEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)" || x.Verrechnungstyp == "Netz Tagesstrom (HT)").ToList();

                var totalSum = verbrauchsList.Select(x => {
                    if (x.BasisVerbrauch == null)
                    {
                        throw new Exception("Basisverbrauch was null");
                    }

                    return(x.BasisVerbrauch.Value);
                }).Sum();
                const double factor = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Total", totalSum / factor, 1000, Orientation.Up));
                var sumNight = rawEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)").Select(x => {
                    if (x.BasisVerbrauch == null)
                    {
                        throw new Exception("Basisverbrauch was null");
                    }

                    return(x.BasisVerbrauch.Value);
                }).Sum();
                arr1.AddEntry(new SankeyEntry("Nachtstrom", sumNight / factor * -1, 1000, Orientation.Down));
                var sumDay = rawEntries.Where(x => x.Verrechnungstyp == "Netz Tagesstrom (HT)").Select(x => {
                    if (x.BasisVerbrauch == null)
                    {
                        throw new Exception("Basisverbrauch was null");
                    }

                    return(x.BasisVerbrauch.Value);
                }).Sum();
                arr1.AddEntry(new SankeyEntry("Tagstrom", sumDay / factor * -1, 1000, Orientation.Up));
                arrows.Add(arr1);
            }

            {
                var arr1 = new SingleSankeyArrow("Stromkunden_Verbrauch_Nach_Standort", 2000, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "",
                                               Constants.PresentSlice, MyStage);
                rfe.Save();
                var verbrauchsList = rawEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)" || x.Verrechnungstyp == "Netz Tagesstrom (HT)").ToList();
                var totalSum       = verbrauchsList.Select(x => {
                    if (x.BasisVerbrauch == null)
                    {
                        throw new Exception("Basisverbrauch was null");
                    }

                    return(x.BasisVerbrauch.Value);
                }).Sum();
                const double factor = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Total", totalSum / factor, 1000, Orientation.Up));
                var monthlyElectricityUseNetz = monthlyElectricityUsePerStandorts.Sum(x => x.YearlyElectricityUseNetz);
                arr1.AddEntry(new SankeyEntry("MonthlyElectricityUseNetz", monthlyElectricityUseNetz / factor * -1, 1000, Orientation.Down));
                arrows.Add(arr1);
            }

            {
                var arr1 = new SingleSankeyArrow("Stromkunden_Verbrauch_Nach_Rechnungsart", 2000, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, MyStage);
                rfe.Save();
                var verbrauchsList = rawEntries.Where(x => x.Verrechnungstyp == "Netz Nachtstrom (NT)" || x.Verrechnungstyp == "Netz Tagesstrom (HT)").ToList();
                var totalSum       = verbrauchsList.Select(x => {
                    if (x.BasisVerbrauch == null)
                    {
                        throw new Exception("Basisverbrauch was null");
                    }

                    return(x.BasisVerbrauch.Value);
                }).Sum();
                const double factor = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Total", totalSum / factor, 1000, Orientation.Up));
                var rechungsarten = verbrauchsList.Select(x => x.Rechnungsart).Distinct().ToList();
                var pathlength    = 500;
                foreach (var rechnungsart in rechungsarten)
                {
                    var rechnungsartSum = verbrauchsList.Where(x => x.Rechnungsart == rechnungsart).Select(x => {
                        if (x.BasisVerbrauch == null)
                        {
                            throw new Exception("Basisverbrauch was null");
                        }

                        return(x.BasisVerbrauch.Value);
                    }).Sum();
                    arr1.AddEntry(new SankeyEntry(rechnungsart, rechnungsartSum / factor * -1, pathlength, Orientation.Down));
                    pathlength += 500;
                }

                arrows.Add(arr1);
            }

            {
                var arr1 = new SingleSankeyArrow("Stromkunden_Verbrauch_Nach_Identified_Complexed_Standort", 2000, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, MyStage);
                rfe.Save();
                var          totalSum = monthlyElectricityUsePerStandorts.Select(x => x.YearlyElectricityUseNetz).Sum();
                const double factor   = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Total", totalSum / factor, 1000, Orientation.Up));
                var cleandStandortIDs          = complexes.SelectMany(x => x.CleanedStandorte).ToList();
                var identifiedComplexStandorts = monthlyElectricityUsePerStandorts.Where(x => cleandStandortIDs.Contains(x.CleanedStandort));

                var identifiedmonthlyElectricityUseNetz = identifiedComplexStandorts.Sum(x => x.YearlyElectricityUseNetz);
                arr1.AddEntry(new SankeyEntry("MonthlyElectricityUseNetz", identifiedmonthlyElectricityUseNetz / factor * -1, 1000, Orientation.Down));
                arrows.Add(arr1);
            }

            {
                var arr1 = new SingleSankeyArrow("Stromkunden_Verbrauch_Nach_BuildingWithGeoCoords", 500, MyStage, SequenceNumber, Name, Services.Logger, slice);
                var rfe  = new ResultFileEntry(section, sectionDescription, arr1.FullPngFileName(), arr1.ArrowName, "", Constants.PresentSlice, MyStage);
                rfe.Save();
                var          totalSum = monthlyElectricityUsePerStandorts.Select(x => x.YearlyElectricityUseNetz).Sum();
                const double factor   = 1_000_000;
                arr1.AddEntry(new SankeyEntry("Stromverbrauch gesamt", totalSum / factor, 500, Orientation.Straight));
                var cleandStandortIDs                   = complexes.Where(x => x.Coords.Count > 0).SelectMany(x => x.CleanedStandorte).ToList();
                var identifiedComplexStandorts          = monthlyElectricityUsePerStandorts.Where(x => cleandStandortIDs.Contains(x.CleanedStandort));
                var identifiedmonthlyElectricityUseNetz = identifiedComplexStandorts.Sum(x => x.YearlyElectricityUseNetz);
                arr1.AddEntry(new SankeyEntry("Stromverbrauch in\\n Gebäuden mit Geokoordinaten", identifiedmonthlyElectricityUseNetz / factor * -1, 200, Orientation.Straight));

                var notidentified = monthlyElectricityUsePerStandorts.Where(x => !cleandStandortIDs.Contains(x.CleanedStandort));
                var notidentifiedmonthlyElectricityUseNetz = notidentified.Sum(x => x.YearlyElectricityUseNetz);
                arr1.AddEntry(new SankeyEntry("Stromverbrauch in nicht\\n zuordenbaren Gebäuden", notidentifiedmonthlyElectricityUseNetz / factor * -1, 200, Orientation.Up));

                arrows.Add(arr1);
            }
            return(arrows);
        }
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry rfe)
        {
            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            string plotName    = "Execution Count for " + rfe.HouseholdNumberString;
            var    consumption =
                new Dictionary <string, List <Tuple <string, double> > >();
            var lastname = string.Empty;

            if (rfe.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            using (var sr = new StreamReader(rfe.FullFileName)) {
                while (!sr.EndOfStream)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed.");
                    }
                    var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    if (s == "-----")
                    {
                        var name = sr.ReadLine();
                        if (name == null)
                        {
                            throw new LPGException("Readline failed.");
                        }
                        consumption.Add(name, new List <Tuple <string, double> >());
                        lastname = name;
                        sr.ReadLine(); // header
                    }
                    else
                    {
                        var d = Convert.ToDouble(cols[1], CultureInfo.CurrentCulture);
                        consumption[lastname].Add(new Tuple <string, double>(cols[0], d));
                    }
                }
            }
            foreach (var pair in consumption)
            {
                var mylist = pair.Value;
                mylist.Sort(Comparison);
            }
            foreach (var pair in consumption)
            {
                var plotModel1 = new PlotModel
                {
                    // general
                    LegendBorderThickness = 0,
                    LegendOrientation     = LegendOrientation.Horizontal,
                    LegendPlacement       = LegendPlacement.Outside,
                    LegendPosition        = LegendPosition.BottomCenter
                };
                var personName = pair.Key;
                if (Parameters.ShowTitle)
                {
                    plotModel1.Title = plotName + " " + personName;
                }
                plotModel1.IsLegendVisible = false;
                // axes
                var cate = new CategoryAxis
                {
                    AbsoluteMinimum = 0,
                    MinimumPadding  = 0,
                    GapWidth        = 0,
                    MinorStep       = 1,
                    Title           = " ",
                    Angle           = 90,

                    AxisTitleDistance = 150,
                    ClipTitle         = false
                };
                plotModel1.Axes.Add(cate);

                var linearAxis2 = new LinearAxis
                {
                    AbsoluteMinimum = 0,
                    MaximumPadding  = 0.06,
                    MinimumPadding  = 0,
                    Title           = "Times of execution"
                };
                plotModel1.Axes.Add(linearAxis2);
                // data
                OxyPalette p;
                if (pair.Value.Count > 1)
                {
                    p = OxyPalettes.HueDistinct(pair.Value.Count);
                }
                else
                {
                    p = OxyPalettes.Hue64;
                }

                var columnSeries2 = new ColumnSeries
                {
                    StrokeThickness = 0,
                    Title           = "Actions"
                };
                for (var i = 0; i < pair.Value.Count; i++)
                {
                    var label = pair.Value[i].Item1;
                    if (label.Length > 40)
                    {
                        label = label.Substring(0, 40);
                    }
                    cate.Labels.Add(label);
                    var ci = new ColumnItem(pair.Value[i].Item2)
                    {
                        Color = p.Colors[i]
                    };
                    columnSeries2.Items.Add(ci);
                }
                plotModel1.Series.Add(columnSeries2);
                var fi          = new FileInfo(rfe.FullFileName);
                var pn          = fi.Name.Substring(0, fi.Name.Length - 3);
                var cleanedName = AutomationUtili.CleanFileName(pair.Key);
                if (fi.DirectoryName == null)
                {
                    throw new LPGException("Directory Name was null");
                }
                var correctfilename = Path.Combine(fi.DirectoryName, pn + cleanedName + ".png");
                Save(plotModel1, plotName, correctfilename, Parameters.BaseDirectory, CalcOption.ActivationsPerHour);
            }
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }
コード例 #23
0
        private FileProcessingResult ReadAllDays([JetBrains.Annotations.NotNull] ResultFileEntry rfe, double conversionfactor, [JetBrains.Annotations.NotNull] List <DateTime> selectedDateTimes,
                                                 [JetBrains.Annotations.NotNull] DeviceTaggingSetList taggingSets, [JetBrains.Annotations.NotNull] string plotName, [JetBrains.Annotations.NotNull] DirectoryInfo basisPath, [JetBrains.Annotations.NotNull] string yaxisLabel,
                                                 TimeSpan timestep)
        {
            var pngCount = 0;

            try {
                var headers = new List <string>();
                if (rfe.FullFileName == null)
                {
                    throw new LPGException("filename was null");
                }
                using (var sr = new StreamReader(rfe.FullFileName)) {
                    var topLine = sr.ReadLine();
                    if (topLine == null)
                    {
                        throw new LPGException("Readline failed.");
                    }
                    var header1 = topLine.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    if (header1.Length < 2)
                    {
                        throw new LPGException("Could not split the line from the device profiles properly: " +
                                               header1);
                    }
                    headers.AddRange(header1);
                    var dayEntry = new DayEntry(DateTime.MinValue);
                    while (!sr.EndOfStream)
                    {
                        var s = sr.ReadLine();
                        if (s == null)
                        {
                            throw new LPGException("Readline failed.");
                        }
                        var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                        if (cols.Length < 2)
                        {
                            throw new LPGException("Could not split the line from the device profiles properly: " + s);
                        }

                        var success1 = DateTime.TryParse(cols[1], CultureInfo.CurrentCulture, DateTimeStyles.None,
                                                         out var dt);
                        if (!success1)
                        {
                            Logger.Error("Parsing failed in Deviceprofile.MakePlot.");
                            continue;
                        }
                        if (GetDay(dt) != dayEntry.Day)
                        {
                            if (selectedDateTimes.Contains(dayEntry.Day))
                            {
                                var loadtypeNames =
                                    taggingSets.TaggingSets.SelectMany(x => x.LoadTypesForThisSet).Select(y => y.Name)
                                    .ToList();
                                foreach (var deviceTaggingSetInfo in taggingSets.TaggingSets)
                                {
                                    {
                                        var sum = dayEntry.Values.Select(x => x.Sum()).Sum();
                                        if (loadtypeNames.Contains(rfe.LoadTypeInformation?.Name) && Math.Abs(sum) > Constants.Ebsilon)
                                        {
                                            var makePng = pngCount <= 8;
                                            MakeChartFromDay(rfe.FullFileName, plotName, basisPath, yaxisLabel,
                                                             timestep,
                                                             headers,
                                                             dayEntry, deviceTaggingSetInfo, makePng);
                                            GC.WaitForPendingFinalizers();
                                            GC.Collect();

                                            pngCount++;
                                        }
                                    }
                                }
                            }
                            dayEntry = new DayEntry(GetDay(dt));
                        }
                        dayEntry.Times.Add(dt);
                        var result = new double[headers.Count];
                        for (var index = 0; index < cols.Length; index++)
                        {
                            var col     = cols[index];
                            var success = double.TryParse(col, out double d);
                            if (success)
                            {
                                result[index] = d / conversionfactor;
                            }
                        }
                        dayEntry.Values.Add(result);
                    }
                }
            }
            catch (Exception ex) {
                Logger.Exception(ex);
                throw;
            }
            if (pngCount > 0)
            {
                return(FileProcessingResult.ShouldCreateFiles);
            }
            return(FileProcessingResult.NoFilesTocreate);
        }
コード例 #24
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry rfe)
        {
            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            string plotName = "Time of Use " + rfe.HouseholdNumberString + " " + rfe.LoadTypeInformation?.Name;
            bool   isEnergy = rfe.ResultFileID == ResultFileID.TimeOfUseEnergy;
            var    devices  = new List <Device>();

            if (rfe.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            using (var sr = new StreamReader(rfe.FullFileName)) {
                var s = sr.ReadLine();
                if (s == null)
                {
                    throw new LPGException("Readline failed");
                }
                var header1 = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                foreach (var header in header1)
                {
                    devices.Add(new Device(header));
                }
                while (!sr.EndOfStream && s.Length > 0)
                {
                    s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed");
                    }
                    var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    for (var index = 2; index < cols.Length; index++)
                    {
                        var col = cols[index];
                        if (col.Length > 0)
                        {
                            if (col.Length > 0)
                            {
                                var success = double.TryParse(col, out double d);
                                if (!success)
                                {
                                    throw new LPGException("Double Trouble! " + rfe.FileName);
                                }
                                devices[index].Values.Add(d);
                            }
                        }
                    }
                }
            }
            devices.RemoveAt(0);
            devices.RemoveAt(0);
            devices.Sort((x, y) => y.Sum.CompareTo(x.Sum));
            double max = 0;

            for (var i = 0; i < devices[0].Values.Count; i++)
            {
                double sum = 0;
                foreach (var device in devices)
                {
                    if (device.Values.Count > i)
                    {
                        sum += device.Values[i];
                    }
                }
                if (sum > max)
                {
                    max = sum;
                }
            }
            var plotModel1 = new PlotModel
            {
                // general
                LegendBorderThickness = 0,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter
            };

            if (Parameters.ShowTitle)
            {
                plotModel1.Title = plotName;
            }
            // axes
            var cate = new CategoryAxis
            {
                AbsoluteMinimum = 0,
                MinimumPadding  = 0,
                GapWidth        = 0,
                MajorStep       = 60,

                Title = "Minutes"
            };

            plotModel1.Axes.Add(cate);

            var linearAxis2 = new LinearAxis
            {
                AbsoluteMinimum = 0,
                MaximumPadding  = 0.06,
                MinimumPadding  = 0
            };

            if (isEnergy)
            {
                linearAxis2.Title = rfe.LoadTypeInformation?.Name + " in " + rfe.LoadTypeInformation?.UnitOfPower;
            }
            else
            {
                linearAxis2.Title = "Minutes/(Household-Year)";
            }
            linearAxis2.Minimum = 0;
            linearAxis2.Maximum = max * 1.05;
            plotModel1.Axes.Add(linearAxis2);
            // data
            var p = OxyPalettes.HueDistinct(devices.Count);

            for (var i = 0; i < devices.Count; i++)
            {
                // main columns
                var columnSeries2 = new ColumnSeries
                {
                    IsStacked       = true,
                    StrokeThickness = 0,

                    Title = devices[i].Name
                };
                var myvalues = devices[i].Values;
                for (var j = 0; j < myvalues.Count; j++)
                {
                    columnSeries2.Items.Add(new ColumnItem(myvalues[j]));
                }
                columnSeries2.FillColor = p.Colors[i];
                plotModel1.Series.Add(columnSeries2);
            }
            Save(plotModel1, plotName, rfe.FullFileName, Parameters.BaseDirectory, CalcOption.TimeOfUsePlot);
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcResultFileEntry)
        {
            string plotName = "Device Profiles External Time Resolution  " + srcResultFileEntry.HouseholdNumberString + " " +
                              srcResultFileEntry.LoadTypeInformation?.Name;

            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            var headers = new List <string>();
            var values  = new List <double[]>();

            if (srcResultFileEntry.FullFileName == null)
            {
                throw new LPGException("fullfilename was null");
            }
            using (var sr = new StreamReader(srcResultFileEntry.FullFileName)) {
                var topLine = sr.ReadLine();
                if (topLine == null)
                {
                    throw new LPGException("Readline failed");
                }
                var header1 = topLine.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                headers.AddRange(header1);
                while (!sr.EndOfStream && values.Count < 5000)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed");
                    }
                    var cols   = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    var result = new double[headers.Count];
                    for (var index = 0; index < cols.Length; index++)
                    {
                        var col     = cols[index];
                        var success = double.TryParse(col, out double d);
                        if (success)
                        {
                            result[index] = d;
                        }
                    }
                    values.Add(result);
                }
            }
            var plotModel1 = new PlotModel
            {
                // general
                LegendBorderThickness = 0,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter
            };

            if (Parameters.ShowTitle)
            {
                plotModel1.Title = plotName;
            }
            // axes
            var linearAxis2 = new LinearAxis
            {
                AbsoluteMinimum = 0,
                MaximumPadding  = 0.06,
                MinimumPadding  = 0,
                Title           = "2"
            };

            plotModel1.Axes.Add(linearAxis2);
            // data
            OxyPalette p;

            if (headers.Count < 2)
            {
                p = OxyPalettes.Hue64;
            }
            else
            {
                p = OxyPalettes.HueDistinct(headers.Count);
            }

            for (var i = 2; i < headers.Count; i++)
            {
                // main columns
                var columnSeries2 = new AreaSeries
                {
                    StrokeThickness = 0,
                    Title           = headers[i]
                };

                for (var j = 0; j < values.Count; j++)
                {
                    double sum = 0;
                    for (var k = i - 1; k > 0; k--)
                    {
                        sum += values[j][k];
                    }

                    var bottom = new DataPoint(j, sum);
                    columnSeries2.Points.Add(bottom);

                    var top = new DataPoint(j, sum + values[j][i]);
                    columnSeries2.Points2.Add(top);
                }
                columnSeries2.Color = p.Colors[i];
                plotModel1.Series.Add(columnSeries2);
            }

            Save(plotModel1, plotName, srcResultFileEntry.FullFileName, Parameters.BaseDirectory, CalcOption.DeviceProfileExternalIndividualHouseholds);
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }
コード例 #26
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry rfe)
        {
            string plotName = "Affordance Tagging Set " + rfe.HouseholdNumberString;

            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            var    consumption = new Dictionary <string, List <double> >();
            var    colNames    = new Dictionary <int, string>();
            var    colSums     = new Dictionary <int, double>();
            double totalSum    = 0;

            if (rfe.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            using (var sr = new StreamReader(rfe.FullFileName)) {
                // read data
                var header = sr.ReadLine();
                if (header == null)
                {
                    throw new LPGException("Readline failed.");
                }
                var colheaders = header.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                for (var index = 1; index < colheaders.Length; index++)
                {
                    if (colheaders[index].Length > 0)
                    {
                        colNames.Add(index, colheaders[index]);
                        colSums.Add(index - 1, 0);
                    }
                }
                while (!sr.EndOfStream)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed.");
                    }
                    var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    var list = new List <double>();
                    consumption.Add(cols[0], list);

                    for (var index = 1; index < cols.Length - 1; index++)
                    {
                        var d = Convert.ToDouble(cols[index], CultureInfo.CurrentCulture);
                        list.Add(d);
                        totalSum += d;
                    }
                }
            }
            var plotModel1 = new PlotModel
            {
                // general
                LegendBorderThickness = 0,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendSymbolMargin    = 20
            };
            var labelFontSize = 11;
            var pngOffset     = 0.1;

            // in the pdfs the vertical text gets moved a little. this is the offset in the png to counter that.
            if (Config.MakePDFCharts)
            {
                plotModel1.DefaultFontSize = Parameters.PDFFontSize;
                plotModel1.LegendFontSize  = Parameters.PDFFontSize;
                labelFontSize = 16;
                pngOffset     = 0;
            }
            if (Parameters.ShowTitle)
            {
                plotModel1.Title = plotName;
            }
            // axes
            var categoryAxis1 = new CategoryAxis
            {
                MinorStep      = 1,
                MaximumPadding = 0.02,
                GapWidth       = 1,
                FontSize       = 18
            };

            foreach (var s in colNames.Values)
            {
                categoryAxis1.Labels.Add(ChartLocalizer.Get().GetTranslation(s));
            }
            plotModel1.Axes.Add(categoryAxis1);
            var linearAxis1 = new LinearAxis
            {
                AbsoluteMinimum = 0,
                MaximumPadding  = 0.03,
                MinimumPadding  = 0,
                MinorTickSize   = 0
            };

            linearAxis1.MajorStep *= 2;
            linearAxis1.Title      = ChartLocalizer.Get().GetTranslation("Time in Percent");
            plotModel1.Axes.Add(linearAxis1);

            OxyPalette p;

            if (consumption.Count > 1)
            {
                p = OxyPalettes.HueDistinct(consumption.Count);
            }
            else
            {
                p = OxyPalettes.Hue64;
            }
            // generate plot
            var colheight = totalSum / consumption.Values.First().Count;
            var count     = 0;

            foreach (var keyValuePair in consumption)
            {
                // main columns
                var columnSeries2 = new ColumnSeries
                {
                    IsStacked       = true,
                    StackGroup      = "1",
                    StrokeThickness = 0.5,
                    StrokeColor     = OxyColors.White,
                    Title           = ChartLocalizer.Get().GetTranslation(keyValuePair.Key),
                    LabelPlacement  = LabelPlacement.Middle
                };
                var col = 0;
                foreach (var minutes in keyValuePair.Value)
                {
                    var d  = minutes / colheight * 100;
                    var ci = new ColumnItem(d);
                    columnSeries2.Items.Add(ci);

                    if (d > 15)
                    {
                        {
                            var textAnnotation1 = new RectangleAnnotation
                            {
                                Text = minutes.ToString("N0", CultureInfo.CurrentCulture) + " min (" +
                                       d.ToString("N1", CultureInfo.CurrentCulture) + " %)",
                                TextHorizontalAlignment = HorizontalAlignment.Left,
                                TextVerticalAlignment   = VerticalAlignment.Top,
                                StrokeThickness         = 0,
                                MinimumY     = colSums[col],
                                MaximumY     = colSums[col] + d,
                                MinimumX     = col + 0.28 + pngOffset,
                                MaximumX     = col + 0.40 + pngOffset,
                                Fill         = OxyColors.Transparent,
                                TextRotation = 270,
                                FontSize     = labelFontSize
                            };
                            plotModel1.Annotations.Add(textAnnotation1);
                        }
                        {
                            var textAnnotation1 = new RectangleAnnotation();
                            var shortendName    = ChartLocalizer.Get().GetTranslation(keyValuePair.Key);
                            if (shortendName.Length > 20)
                            {
                                shortendName = shortendName.Substring(0, 17) + "...";
                            }
                            textAnnotation1.Text = shortendName.Trim();
                            textAnnotation1.TextHorizontalAlignment = HorizontalAlignment.Left;
                            textAnnotation1.TextVerticalAlignment   = VerticalAlignment.Top;
                            textAnnotation1.StrokeThickness         = 0;
                            textAnnotation1.MinimumY     = colSums[col];
                            textAnnotation1.MaximumY     = colSums[col] + d;
                            textAnnotation1.MinimumX     = col + 0.20 + pngOffset;
                            textAnnotation1.MaximumX     = col + 0.30 + pngOffset;
                            textAnnotation1.Fill         = OxyColors.Transparent;
                            textAnnotation1.TextRotation = 270;
                            textAnnotation1.FontSize     = labelFontSize;
                            plotModel1.Annotations.Add(textAnnotation1);
                        }
                    }
                    colSums[col] += d;
                    col++;
                }
                columnSeries2.FillColor = p.Colors[count];
                count++;
                plotModel1.Series.Add(columnSeries2);
            }
            Save(plotModel1, plotName, rfe.FullFileName, Parameters.BaseDirectory, CalcOption.HouseholdContents);
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }
コード例 #27
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcEntry)
        {
            const string plotName = "Weekday Profiles";
            var          entries  = new List <Entry>();

            if (srcEntry.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            using (var sr = new StreamReader(srcEntry.FullFileName)) {
                var s = sr.ReadLine();
                while (s != "By Season" && !sr.EndOfStream)
                {
                    s = sr.ReadLine();
                }
                if (s != "By Season")
                {
                    throw new LPGException("Wrong file!");
                }
                for (var i = 0; i < 3; i++)
                {
                    s = sr.ReadLine();
                }
                if (s == null)
                {
                    throw new LPGException("Readline failed");
                }
                var header = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);

                foreach (var s1 in header)
                {
                    entries.Add(new Entry(s1));
                }

                while (!sr.EndOfStream)
                {
                    var s1 = sr.ReadLine();
                    if (s1 == null)
                    {
                        throw new LPGException("Readline failed");
                    }
                    var cols = s1.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    for (var index = 0; index < cols.Length; index++)
                    {
                        var col = cols[index];
                        if (col.Length > 0)
                        {
                            var success = double.TryParse(col, out double d);
                            if (!success)
                            {
                                throw new LPGException("Double Trouble");
                            }
                            entries[index].Values.Add(d);
                        }
                    }
                }
            }
            entries.RemoveAt(0);
            entries.RemoveAt(entries.Count - 1);

            var plotModel1 = MakeChart(plotName, entries, Parameters.ShowTitle, srcEntry.LoadTypeInformation);

            Save(plotModel1, plotName, srcEntry.FullFileName, Parameters.BaseDirectory, CalcOption.WeekdayProfiles);
            return(FileProcessingResult.ShouldCreateFiles);
        }
コード例 #28
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry rfe)
        {
            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            string plotName = "Location Statistics " + rfe.HouseholdNumberString;
            var    persons  = new List <PersonEntry>();

            if (rfe.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            using (var sr = new StreamReader(rfe.FullFileName)) {
                PersonEntry lastPerson = null;
                while (!sr.EndOfStream)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("File " + rfe.FullFileName + " was empty.");
                    }
                    if (s.StartsWith("----", StringComparison.CurrentCulture))
                    {
                        var s2 = sr.ReadLine();
                        if (s2 == null)
                        {
                            throw new LPGException("readline failed");
                        }
                        lastPerson = new PersonEntry(s2);
                        persons.Add(lastPerson);
                    }
                    else
                    {
                        if (lastPerson == null)
                        {
                            throw new LPGException("lastperson was null");
                        }
                        var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                        var val  = Utili.ConvertToDoubleWithMessage(cols[2], "LocationStatisticsPlot");
                        if (val > 0)
                        {
                            lastPerson.Percentages.Add(cols[0], val);
                        }
                    }
                }
            }
            foreach (var entry in persons)
            {
                var plotModel1 = new PlotModel
                {
                    LegendBorderThickness = 0,
                    LegendOrientation     = LegendOrientation.Horizontal,
                    LegendPlacement       = LegendPlacement.Outside,
                    LegendPosition        = LegendPosition.BottomCenter
                };
                if (Parameters.ShowTitle)
                {
                    plotModel1.Title = plotName;
                }

                var pieSeries1 = new PieSeries
                {
                    InsideLabelColor      = OxyColors.White,
                    InsideLabelPosition   = 0.8,
                    StrokeThickness       = 2,
                    AreInsideLabelsAngled = true
                };
                foreach (var tuple in entry.Percentages)
                {
                    var name = tuple.Key.Trim();
                    if (name.Length > 30)
                    {
                        name = name.Substring(0, 20) + "...";
                    }
                    var slice = new PieSlice(name, tuple.Value);

                    pieSeries1.Slices.Add(slice);
                }

                plotModel1.Series.Add(pieSeries1);
                var newfilename = "LocationStatistics." + entry.CleanName;
                Save(plotModel1, plotName, rfe.FullFileName, Parameters.BaseDirectory, CalcOption.LocationsFile, newfilename);
            }
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }
コード例 #29
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcEntry)
        {
            string plotName = "Activity Frequencies per Minute " + srcEntry.HouseholdNumberString;

            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            var consumption =
                new Dictionary <string, List <Tuple <string, List <double> > > >();
            var lastname = string.Empty;

            if (srcEntry.FullFileName == null)
            {
                throw new LPGException("filename was null");
            }
            using (var sr = new StreamReader(srcEntry.FullFileName)) {
                while (!sr.EndOfStream)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed");
                    }
                    var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                    if (cols.Length == 1)
                    {
                        consumption.Add(cols[0], new List <Tuple <string, List <double> > >());
                        lastname = cols[0];
                        sr.ReadLine();
                    }
                    else
                    {
                        var values = new List <double>();
                        for (var i = 1; i < cols.Length; i++)
                        {
                            var d = Convert.ToDouble(cols[i], CultureInfo.CurrentCulture);
                            values.Add(d);
                        }
                        consumption[lastname].Add(new Tuple <string, List <double> >(cols[0], values));
                    }
                }
            }
            foreach (var pair in consumption)
            {
                var plotModel1 = new PlotModel
                {
                    // general
                    LegendBorderThickness = 0,
                    LegendOrientation     = LegendOrientation.Horizontal,
                    LegendPlacement       = LegendPlacement.Outside,
                    LegendPosition        = LegendPosition.BottomCenter
                };
                var personName = pair.Key;
                if (Parameters.ShowTitle)
                {
                    plotModel1.Title = plotName + " " + personName;
                }
                // axes
                var categoryAxis = new CategoryAxis
                {
                    AbsoluteMinimum = 0,
                    MinimumPadding  = 0,
                    GapWidth        = 0,
                    MajorStep       = 60,
                    Title           = "Minutes"
                };
                plotModel1.Axes.Add(categoryAxis);

                var linearAxis2 = new LinearAxis
                {
                    AbsoluteMinimum = 0,
                    MaximumPadding  = 0.06,
                    MinimumPadding  = 0,
                    Title           = "Days"
                };
                plotModel1.Axes.Add(linearAxis2);
                // data
                OxyPalette p;
                if (pair.Value.Count < 2)
                {
                    p = OxyPalettes.Hue64;
                }
                else
                {
                    p = OxyPalettes.HueDistinct(pair.Value.Count);
                }

                for (var i = 0; i < pair.Value.Count; i++)
                {
                    var columnSeries2 = new ColumnSeries
                    {
                        IsStacked       = true,
                        StrokeThickness = 0,

                        Title = pair.Value[i].Item1
                    };
                    var values = pair.Value[i].Item2;
                    for (var j = 0; j < values.Count; j++)
                    {
                        columnSeries2.Items.Add(new ColumnItem(values[j]));
                    }
                    columnSeries2.FillColor = p.Colors[i];
                    plotModel1.Series.Add(columnSeries2);
                }
                Save(plotModel1, plotName, srcEntry.FullFileName + "." + personName, Parameters.BaseDirectory, CalcOption.ActivationFrequencies);
            }
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }
コード例 #30
0
        protected override FileProcessingResult MakeOnePlot(ResultFileEntry srcResultFileEntry)
        {
            string plotName = "Affordance Time Use " + srcResultFileEntry.HouseholdNumberString;

            Profiler.StartPart(Utili.GetCurrentMethodAndClass());
            var allConsumptions =
                new Dictionary <string, List <Tuple <string, double> > >();
            var lastName    = string.Empty;
            var taggingSets = new Dictionary <string, List <ChartTaggingSet> >();

            if (srcResultFileEntry.FullFileName == null)
            {
                throw new LPGException("Srcfile was null");
            }
            using (var sr = new StreamReader(srcResultFileEntry.FullFileName)) {
                while (!sr.EndOfStream)
                {
                    var s = sr.ReadLine();
                    if (s == null)
                    {
                        throw new LPGException("Readline failed");
                    }
                    if (s.StartsWith("----", StringComparison.Ordinal))
                    {
                        s = sr.ReadLine();
                        if (s == null)
                        {
                            throw new LPGException("Readline failed");
                        }
                        var arr = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                        lastName = arr[0];
                        allConsumptions.Add(lastName, new List <Tuple <string, double> >());
                        taggingSets.Add(lastName, new List <ChartTaggingSet>());
                        for (var i = 2; i < arr.Length; i++)
                        {
                            if (!string.IsNullOrWhiteSpace(arr[i]))
                            {
                                taggingSets[lastName].Add(new ChartTaggingSet(arr[i]));
                            }
                        }
                    }
                    else
                    {
                        var cols = s.Split(Parameters.CSVCharacterArr, StringSplitOptions.None);
                        var d    = Convert.ToDouble(cols[1], CultureInfo.CurrentCulture);
                        allConsumptions[lastName].Add(new Tuple <string, double>(cols[0], d));
                        for (var i = 2; i < cols.Length; i++)
                        {
                            taggingSets[lastName][i - 2].AffordanceToCategories.Add(cols[0], cols[i]);
                        }
                    }
                }
            }
            IntervallBarMaker ivm = new IntervallBarMaker();

            foreach (var pair in allConsumptions)
            {
                var cts = taggingSets[pair.Key];

                foreach (var set in cts)
                {
                    ivm.MakeIntervalBars(srcResultFileEntry, plotName, Parameters.BaseDirectory, pair.Value, set, "." + pair.Key + "." + set.Name, false, this, CalcOption.ActivationFrequencies);
                }
            }
            Profiler.StopPart(Utili.GetCurrentMethodAndClass());
            return(FileProcessingResult.ShouldCreateFiles);
        }