Пример #1
0
 public AffordanceEnergyUse([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                            [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                            [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                             calculationProfiler, new List <ResultFileID>() { ResultFileID.AffordanceEnergyUse },
                                                                                                             "Affordance Energy Use", FileProcessingResult.ShouldCreateFiles)
 {
 }
Пример #2
0
        public static void MakeChartsAndPDF(CalculationProfiler calculationProfiler, string resultPath)
        {
            Exception innerException = null;
            var       t = new Thread(() => {
                try
                {
                    SqlResultLoggingService srls = new SqlResultLoggingService(resultPath);
                    CalcParameterLogger cpl      = new CalcParameterLogger(srls);
                    InputDataLogger idl          = new InputDataLogger(Array.Empty <IDataSaverBase>());
                    var calcParameters           = cpl.Load();
                    Logger.Info("Checking for charting parameters");
                    if (!calcParameters.IsSet(CalcOption.MakePDF) && !calcParameters.IsSet(CalcOption.MakeGraphics))
                    {
                        Logger.Info("No charts wanted");
                        return;
                    }
                    calculationProfiler.StartPart(Utili.GetCurrentMethodAndClass() + " - Charting");

                    using (FileFactoryAndTracker fileFactoryAndTracker =
                               new FileFactoryAndTracker(resultPath, "Name", idl)) {
                        calculationProfiler.StartPart(Utili.GetCurrentMethodAndClass() + " - Chart Generator RunAll");
                        ChartCreationParameters ccp = new ChartCreationParameters(144, 1600, 1000,
                                                                                  false, calcParameters.CSVCharacter, new DirectoryInfo(resultPath));
                        var cg = new ChartGeneratorManager(calculationProfiler, fileFactoryAndTracker, ccp);
                        cg.Run(resultPath);
                        calculationProfiler.StopPart(Utili.GetCurrentMethodAndClass() + " - Chart Generator RunAll");
                        if (calcParameters.IsSet(CalcOption.MakePDF))
                        {
                            calculationProfiler.StartPart(Utili.GetCurrentMethodAndClass() + " - PDF Creation");
                            Logger.ImportantInfo(
                                "Creating the PDF. This will take a really long time without any progress report...");

                            MigraPDFCreator mpc = new MigraPDFCreator(calculationProfiler);
                            mpc.MakeDocument(resultPath, "", false, false,
                                             calcParameters.CSVCharacter, fileFactoryAndTracker);
                            calculationProfiler.StopPart(Utili.GetCurrentMethodAndClass() + " - PDF Creation");
                        }
                    }
                    Logger.Info("Finished making the charts");
                    calculationProfiler.StopPart(Utili.GetCurrentMethodAndClass() + " - Charting");
                    CalculationDurationFlameChart cdfc = new CalculationDurationFlameChart();
                    cdfc.Run(calculationProfiler, resultPath, "CalcManager");
                }
                catch (Exception ex)
                {
                    innerException = ex;
                    Logger.Exception(ex);
                }
            });

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            t.Join();
            if (innerException != null)
            {
                Logger.Error("Exception during the PDF creation!");
                Logger.Exception(innerException);
                throw innerException;
            }
        }
 public DurationCurve([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                      [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                      [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                       calculationProfiler, new List <ResultFileID>() { ResultFileID.DurationCurveSums },
                                                                                                       "Duration Curve", FileProcessingResult.ShouldCreateFiles
                                                                                                       )
 {
 }
Пример #4
0
 public CriticalThresholdViolations([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                                    [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                                    [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                                     calculationProfiler, new List <ResultFileID>() { ResultFileID.CriticalThresholdViolations },
                                                                                                                     "Critical Threshold Violations", FileProcessingResult.ShouldCreateFiles
                                                                                                                     )
 {
 }
 public HouseholdPlan([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                      [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                      [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                       calculationProfiler, new List <ResultFileID>() { ResultFileID.HouseholdPlanTime },
                                                                                                       "Household Plan Results", FileProcessingResult.ShouldCreateFiles
                                                                                                       )
 {
 }
 public ExecutedActionsOverviewCount([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                                     [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                                     [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                                      calculationProfiler, new List <ResultFileID>() { ResultFileID.ExecutedActionsOverview },
                                                                                                                      "Executed Actions Overview Count", FileProcessingResult.ShouldCreateFiles
                                                                                                                      )
 {
 }
 public DeviceProfilesExternal([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                               [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                               [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                                calculationProfiler, new List <ResultFileID>() { ResultFileID.DeviceProfileCSVExternal },
                                                                                                                "Device Profiles Externals", FileProcessingResult.ShouldCreateFiles
                                                                                                                )
 {
 }
Пример #8
0
 public ActivityFrequenciesPerMinute([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                                     [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                                     [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                                      calculationProfiler, new List <ResultFileID>() { ResultFileID.ActivationFrequencies },
                                                                                                                      "Activity Frequencies per Minute ", FileProcessingResult.ShouldCreateFiles
                                                                                                                      )
 {
 }
 public LocationStatistics([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                           [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                           [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                            calculationProfiler, new List <ResultFileID>() { ResultFileID.LocationStatistic },
                                                                                                            "Location Statistics", FileProcessingResult.ShouldCreateFiles
                                                                                                            )
 {
 }
Пример #10
0
 public TimeOfUse([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                  [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                  [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                   calculationProfiler, new List <ResultFileID>() { ResultFileID.TimeOfUseEnergy, ResultFileID.TimeOfUse },
                                                                                                   "Activity Percentages", FileProcessingResult.ShouldCreateFiles
                                                                                                   )
 {
 }
Пример #11
0
 public VariableLogFileChart([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                             [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                             [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler) : base(parameters, fft,
                                                                                                              calculationProfiler, new List <ResultFileID>() { ResultFileID.VariableLogfile },
                                                                                                              "Variable Logfile", FileProcessingResult.ShouldCreateFiles
                                                                                                              )
 {
 }
 protected ChartBaseFileStep([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                             [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft, [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler,
                             [JetBrains.Annotations.NotNull] List <ResultFileID> validResultFileIds, [JetBrains.Annotations.NotNull] string stepName,
                             FileProcessingResult shouldHaveProducedFiles) : base(parameters, stepName, shouldHaveProducedFiles, fft)
 {
     _calculationProfiler = calculationProfiler;
     ResultFileIDs        = validResultFileIds;
 }
Пример #13
0
 public ChartGeneratorManager([JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler, [
                                  NotNull] FileFactoryAndTracker fft,
                              [JetBrains.Annotations.NotNull] ChartCreationParameters chartCreationParameters)
 {
     _calculationProfiler = calculationProfiler;
     _fft = fft;
     _chartCreationParameters = chartCreationParameters;
     _srls = new SqlResultLoggingService(_chartCreationParameters.BaseDirectory.FullName);
 }
Пример #14
0
 public NoOpChart([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                  [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                  [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler)
     : base(parameters, fft,
            calculationProfiler, FilesNotToChart(),
            "Noop Chart", FileProcessingResult.NoFilesTocreate
            )
 {
 }
 protected GenericChartBase([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                            [JetBrains.Annotations.NotNull] string stepName,
                            FileProcessingResult shouldHaveProducedFiles,
                            [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft)
 {
     _parameters             = parameters;
     StepName                = stepName;
     ShouldHaveProducedFiles = shouldHaveProducedFiles;
     FFT = fft;
 }
 public DeviceProfiles([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                       [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                       [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler,
                       [JetBrains.Annotations.NotNull] SqlResultLoggingService srls, CalcParameters calcParameters) : base(parameters, fft,
                                                                                                                           calculationProfiler, new List <ResultFileID>() { ResultFileID.DeviceProfileCSV },
                                                                                                                           "Device Profiles", FileProcessingResult.ShouldCreateFiles
                                                                                                                           )
 {
     _srls           = srls;
     _calcParameters = calcParameters;
 }
Пример #17
0
 public AffordanceEnergyUsePerPerson([JetBrains.Annotations.NotNull] ChartCreationParameters parameters,
                                     [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft,
                                     [JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler,
                                     [JetBrains.Annotations.NotNull] CalcDataRepository calcDataRepository) : base(parameters,
                                                                                                                   fft,
                                                                                                                   calculationProfiler,
                                                                                                                   new List <ResultTableID> {
     ResultTableID.AffordanceEnergyUse
 },
                                                                                                                   "Affordance Energy Use Per Person",
                                                                                                                   FileProcessingResult.ShouldCreateFiles,
                                                                                                                   calcDataRepository)
 {
 }
Пример #18
0
        public ChartGenerator([JetBrains.Annotations.NotNull] ICalculationProfiler calculationProfiler, [JetBrains.Annotations.NotNull] ChartCreationParameters generalParameters,
                              [JetBrains.Annotations.NotNull] FileFactoryAndTracker fft, [ItemNotNull][JetBrains.Annotations.NotNull] IChartMakerStep[] chartMakerSteps,
                              [ItemNotNull][JetBrains.Annotations.NotNull] ISqlChartMakerStep[] sqlChartMakerSteps,
                              [JetBrains.Annotations.NotNull] SqlResultLoggingService srls,
                              [JetBrains.Annotations.NotNull] CalcDataRepository repository)
        {
            GeneralParameters = generalParameters;
            _fft                 = fft;
            _chartMakerSteps     = chartMakerSteps;
            _sqlChartMakerSteps  = sqlChartMakerSteps;
            _srls                = srls;
            _repository          = repository;
            _calculationProfiler = calculationProfiler;
            HashSet <ResultFileID> fileIDs = new HashSet <ResultFileID>();

            foreach (var step in chartMakerSteps)
            {
                foreach (ResultFileID id in step.ResultFileIDs)
                {
                    if (!fileIDs.Add(id))
                    {
                        throw new LPGException("Duplicate file id added:" + id);
                    }
                }
            }
            HashSet <ResultTableID> tableIDs = new HashSet <ResultTableID>();

            foreach (var step in sqlChartMakerSteps)
            {
                foreach (var id in step.ValidResultTableIds)
                {
                    if (!tableIDs.Add(id))
                    {
                        throw new LPGException("Duplicate table id added:" + id);
                    }
                }
            }
        }