Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduleViewerDialogViewModel"/> class.
        /// </summary>
        /// <param name="solution">The solution to visualize.</param>
        public ScheduleViewerDialogViewModel(ScheduleSolution solution)
        {
            this.Warnings = new ObservableCollection <ScheduleSolution.SchedulerProblem>(
                solution.Problems.Where(p => p.Level == ScheduleSolution.SchedulerProblem.SeverityLevel.Warning));

            this.Errors = new ObservableCollection <ScheduleSolution.SchedulerProblem>(
                solution.Problems.Where(p => p.Level == ScheduleSolution.SchedulerProblem.SeverityLevel.Error));

            this.Fatal = new ObservableCollection <ScheduleSolution.SchedulerProblem>(
                solution.Problems.Where(p => p.Level == ScheduleSolution.SchedulerProblem.SeverityLevel.Fatal));

            this.SolutionPerPass = new Dictionary <PassOrbit, string>();
            foreach (var passSln in solution.ViableProfiles)
            {
                // TODO - this is a placeholder just to show both enc and compression in the same place
                var description = string.Empty;

                var phasesForPass = passSln.Value;

                description += "Optimized AES Profile: ";
                if (phasesForPass.ContainsKey(Enums.PhaseType.Encryption))
                {
                    description += $"\n{passSln.Value[Enums.PhaseType.Encryption]?.FullProfileDescription}\n\n";
                }
                else
                {
                    description += "No viable solution\n\n";
                }

                description += "Optimized Compression Profile: ";
                if (phasesForPass.ContainsKey(Enums.PhaseType.Datalink))
                {
                    description += $"\n{passSln.Value[Enums.PhaseType.Datalink]?.FullProfileDescription}\n\n";
                }
                else
                {
                    description += "No viable solution\n\n";
                }

                this.SolutionPerPass.Add(passSln.Key, description);
            }
        }
Пример #2
0
        private void InitSolution(IEnumerable <PassOrbit> passes)
        {
            this.solution = new ScheduleSolution()
            {
                IsSolvable     = true, // Start out assuming it is solvable unless we encounter a problem.
                ViableProfiles = new Dictionary <PassOrbit, Dictionary <PhaseType, IByteStreamProcessor> >(),
                Problems       = new List <ScheduleSolution.SchedulerProblem>(),
            };

            // Zero out all the energies used before calculation.
            // That way, if the scheduler fails, the only values that will be set
            // are the passes that were completed successfully.
            foreach (var pass in passes)
            {
                pass.PassPhases.First(p => p.PhaseName == PhaseType.Encryption).TotalEnergyUsed = 0;
                pass.PassPhases.First(p => p.PhaseName == PhaseType.Datalink).TotalEnergyUsed   = 0;
                pass.IsScheduledSuccessfully = false;

                this.solution.ViableProfiles[pass] = new Dictionary <PhaseType, IByteStreamProcessor>();
            }
        }
Пример #3
0
        /// <summary>
        /// Generates a report to summarize all the entered and computed values for the scheduling process.
        /// </summary>
        /// <param name="passes">All orbital passes.</param>
        /// <param name="batterySpecs">The battery specifications used in the schedule.</param>
        /// <param name="solarSpecs">The solar panel specifications used in the schedule.</param>
        /// <param name="schedulerSolution">The computed schedule.</param>
        /// <returns>A <see cref="FlowDocument"/> report.</returns>
        public static FlowDocument GenerateReport(IEnumerable <PassOrbit> passes, Battery batterySpecs, SolarPanel solarSpecs, ScheduleSolution schedulerSolution)
        {
            var report = new FlowDocument()
            {
                PagePadding = new Thickness(100),
            };

            report.Blocks.Add(ReportTheme.MakeTitle("Scheduler App Report"));

            // Pass Data
            report.Blocks.Add(ReportTheme.MakeHeader1("Pass Configuration"));
            report.Blocks.Add(GeneratePassDataSection(passes));

            // Battery Capacity Graph
            var graphSection = new Section
            {
                BreakPageBefore = true,
            };

            graphSection.Blocks.Add(ReportTheme.MakeHeader1("Battery Utilization Graph"));
            graphSection.Blocks.Add(GenerateEnergyCapacityGraphExport(passes, batterySpecs));
            graphSection.Blocks.Add(ReportTheme.MakeHeader1("Power Specifications"));
            graphSection.Blocks.Add(GenerateEnergySourceSection(batterySpecs, solarSpecs));
            report.Blocks.Add(graphSection);

            // Scheduler results
            var resultsSection = new Section
            {
                BreakPageBefore = true,
            };

            resultsSection.Blocks.Add(ReportTheme.MakeHeader1("Computed Schedule"));
            resultsSection.Blocks.Add(ReportTheme.MakeHeader1("Info, Warnings, and Errors"));
            resultsSection.Blocks.Add(GenerateWarningsSection(schedulerSolution));
            resultsSection.Blocks.Add(GenerateOptimizedProfileSection(schedulerSolution, PhaseType.Encryption, "Optimized AES Profile: ", PhaseType.Datalink, "Optimized Compression Profile: "));
            report.Blocks.Add(resultsSection);

            // Scheduler results
            var aboutSection = new Section();

            resultsSection.Blocks.Add(ReportTheme.MakeHeader1("About Scheduler App"));
            report.Blocks.Add(new Paragraph()
            {
                Inlines =
                {
                    new Run($"Generated by UAH CPE656 (Fall 2020) Satellite Power Scheduler App\n"),
                    new Run($"Report Generated on {DateTime.Now:MM/dd/yyyy hh:mm:ss tt}\n"),
                    new Run($"Application build {GlobalAssemblyInfo.InformationalVersion}\n"),
                },
            });