Пример #1
0
        /// <summary>
        /// Generates the output data.
        /// </summary>
        /// <param name="generatorReport">The generator report.</param>
        /// <returns>The generated output data.</returns>
        private GenerationOutput CreateGenerationOutput(GenerationReport generatorReport)
        {
            var generationOutput = new GenerationOutput();

            generationOutput.Totals = this.GetTotals(generatorReport).ToArray();
            generationOutput.MaxEmissionGenerators = this.GetEmissionData(generatorReport).ToArray();
            generationOutput.ActualHeatRates       = this.GetActualHeatRates(generatorReport).ToArray();

            return(generationOutput);
        }
Пример #2
0
        /// <summary>
        /// Gets the actual heat rates.
        /// </summary>
        /// <param name="generatorReport">The generator report.</param>
        /// <returns>The actual heat rates.</returns>
        private IEnumerable <ActualHeatRate> GetActualHeatRates(GenerationReport generatorReport)
        {
            var returnValue = new List <ActualHeatRate>();

            foreach (var coalGenerator in generatorReport.Coal)
            {
                returnValue.Add(new ActualHeatRate()
                {
                    Name     = coalGenerator.Name,
                    HeatRate = coalGenerator.CalculateActualHeatRate()
                });
            }

            return(returnValue);
        }
Пример #3
0
        /// <summary>
        /// Gets the highest daily emissions.
        /// </summary>
        /// <param name="generatorReport">The generator report.</param>
        /// <returns>The highest daily emissions.</returns>
        private IEnumerable <OutputDay> GetEmissionData(GenerationReport generatorReport)
        {
            var days = generatorReport.GetEmissionDays((EmissionsFactor)this.ConfigurationData.ReferenceData.Factors
                                                       .FirstOrDefault(x => x is EmissionsFactor)).OrderBy(x => x.Date).ThenByDescending(x => x.Emission);
            var returnValue = (from element in days
                               group element by element.Date
                               into groups
                               select groups.OrderBy(x => x.Date).First()).ToArray();

            return(returnValue.Select(x => new OutputDay()
            {
                Name = x.Name,
                Date = x.Date,
                Emission = x.Emission
            }));
        }
Пример #4
0
        /// <summary>
        /// Gets the total generation values.
        /// </summary>
        /// <param name="generatorReport">The generator report.</param>
        /// <returns>The total generation values.</returns>
        private IEnumerable <Generator> GetTotals(GenerationReport generatorReport)
        {
            var returnValue = new List <Generator>();
            var generators  = generatorReport.GetAllGenerators();

            foreach (var generator in generators)
            {
                returnValue.Add(new Generator()
                {
                    Name  = generator.Name,
                    Total = generator.CalculateTotalGenerationValue((ValueFactor)this.ConfigurationData.ReferenceData.Factors.FirstOrDefault(x => x is ValueFactor))
                });
            }

            return(returnValue);
        }